@galacean/engine-spine 1.2.0 → 4.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/dist/browser.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +1 -0
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/package.json +65 -11
- package/types/SpineAnimationRenderer.d.ts +213 -0
- package/types/SpineGenerator.d.ts +38 -0
- package/types/index.d.ts +6 -9
- package/types/loader/EditorSpineAtlasLoader.d.ts +6 -0
- package/types/loader/LoaderUtils.d.ts +18 -0
- package/types/loader/SkeletonDataResource.d.ts +12 -0
- package/types/loader/SpineLoader.d.ts +29 -0
- package/types/util/BlendMode.d.ts +4 -0
- package/types/util/BufferReader.d.ts +10 -0
- package/types/util/ClearablePool.d.ts +8 -0
- package/types/util/ReturnablePool.d.ts +8 -0
- package/types/AntGSpineLoader.d.ts +0 -22
- package/types/SpineAnimation.d.ts +0 -45
- package/types/SpineLoader.d.ts +0 -32
- package/types/SpineRenderer.d.ts +0 -38
- package/types/core/MeshGenerator.d.ts +0 -43
- package/types/core/SpineMesh.d.ts +0 -11
- package/types/spine-core/Animation.d.ts +0 -378
- package/types/spine-core/AnimationState.d.ts +0 -365
- package/types/spine-core/AnimationStateData.d.ts +0 -23
- package/types/spine-core/AssetManager.d.ts +0 -36
- package/types/spine-core/AtlasAttachmentLoader.d.ts +0 -23
- package/types/spine-core/BlendMode.d.ts +0 -7
- package/types/spine-core/Bone.d.ts +0 -110
- package/types/spine-core/BoneData.d.ts +0 -44
- package/types/spine-core/ConstraintData.d.ts +0 -7
- package/types/spine-core/Event.d.ts +0 -16
- package/types/spine-core/EventData.d.ts +0 -13
- package/types/spine-core/IkConstraint.d.ts +0 -38
- package/types/spine-core/IkConstraintData.d.ts +0 -26
- package/types/spine-core/PathConstraint.d.ts +0 -46
- package/types/spine-core/PathConstraintData.d.ts +0 -52
- package/types/spine-core/SharedAssetManager.d.ts +0 -19
- package/types/spine-core/Skeleton.d.ts +0 -134
- package/types/spine-core/SkeletonBinary.d.ts +0 -49
- package/types/spine-core/SkeletonBounds.d.ts +0 -48
- package/types/spine-core/SkeletonClipping.d.ts +0 -22
- package/types/spine-core/SkeletonData.d.ts +0 -89
- package/types/spine-core/SkeletonJson.d.ts +0 -34
- package/types/spine-core/Skin.d.ts +0 -43
- package/types/spine-core/Slot.d.ts +0 -42
- package/types/spine-core/SlotData.d.ts +0 -23
- package/types/spine-core/Texture.d.ts +0 -46
- package/types/spine-core/TextureAtlas.d.ts +0 -30
- package/types/spine-core/TransformConstraint.d.ts +0 -36
- package/types/spine-core/TransformConstraintData.d.ts +0 -34
- package/types/spine-core/Triangulator.d.ts +0 -14
- package/types/spine-core/Updatable.d.ts +0 -9
- package/types/spine-core/Utils.d.ts +0 -124
- package/types/spine-core/VertexEffect.d.ts +0 -7
- package/types/spine-core/attachments/Attachment.d.ts +0 -43
- package/types/spine-core/attachments/AttachmentLoader.d.ts +0 -25
- package/types/spine-core/attachments/AttachmentType.d.ts +0 -9
- package/types/spine-core/attachments/BoundingBoxAttachment.d.ts +0 -12
- package/types/spine-core/attachments/ClippingAttachment.d.ts +0 -14
- package/types/spine-core/attachments/MeshAttachment.d.ts +0 -46
- package/types/spine-core/attachments/PathAttachment.d.ts +0 -19
- package/types/spine-core/attachments/PointAttachment.d.ts +0 -20
- package/types/spine-core/attachments/RegionAttachment.d.ts +0 -88
- package/types/spine-core/polyfills.d.ts +0 -3
- package/types/spine-core/vertexeffects/JitterEffect.d.ts +0 -11
- package/types/spine-core/vertexeffects/SwirlEffect.d.ts +0 -16
- package/types/types.d.ts +0 -4
package/dist/browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@galacean/engine")):"function"==typeof define&&define.amd?define(["exports","@galacean/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).Galacean=t.Galacean||{},t.Galacean.Spine={}),t.Galacean)}(this,(function(t,e){"use strict";function n(t,e){return n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(t,e)}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}function a(t,e,n,r){var a,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(s=(i<3?a(s):i>3?a(e,n,s):a(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function l(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[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.")}"function"==typeof SuppressedError&&SuppressedError;var h,u,c=function(){function t(t){this._texture=t}return t.filterFromString=function(t){switch(t.toLowerCase()){case"nearest":return 9728;case"linear":return 9729;case"mipmap":case"mipmaplinearlinear":return 9987;case"mipmapnearestnearest":return 9984;case"mipmaplinearnearest":return 9985;case"mipmapnearestlinear":return 9986;default:throw new Error("Unknown texture filter "+t)}},t.wrapFromString=function(t){switch(t.toLowerCase()){case"mirroredtepeat":return 33648;case"clamptoedge":return 33071;case"repeat":return 10497;default:throw new Error("Unknown texture wrap "+t)}},s(t,[{key:"width",get:function(){return this._texture.width}},{key:"height",get:function(){return this._texture.height}},{key:"texture",get:function(){return this._texture}}]),t}();!function(t){t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear"}(h||(h={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(u||(u={}));var d=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},f=function(t){function e(){return t.apply(this,arguments)}r(e,t);var n=e.prototype;return n.setFilters=function(t,e){},n.setWraps=function(t,e){},n.dispose=function(){},e}(c),p=function(){function t(t,e){this.pages=new Array,this.regions=new Array,this.load(t,e)}var e=t.prototype;return e.load=function(t,e){if(null==e)throw new Error("textureLoader cannot be null.");for(var n=new v(t),r=new Array(4),a=null;;){var i=n.readLine();if(null==i)break;if(0==(i=i.trim()).length)a=null;else if(a){var s=new m;s.name=i,s.page=a;var o=n.readValue();"true"==o.toLocaleLowerCase()?s.degrees=90:"false"==o.toLocaleLowerCase()?s.degrees=0:s.degrees=parseFloat(o),s.rotate=90==s.degrees,n.readTuple(r);var l=parseInt(r[0]),h=parseInt(r[1]);n.readTuple(r);var d=parseInt(r[0]),f=parseInt(r[1]);s.u=l/a.width,s.v=h/a.height,s.rotate?(s.u2=(l+f)/a.width,s.v2=(h+d)/a.height):(s.u2=(l+d)/a.width,s.v2=(h+f)/a.height),s.x=l,s.y=h,s.width=Math.abs(d),s.height=Math.abs(f),4==n.readTuple(r)&&4==n.readTuple(r)&&n.readTuple(r),s.originalWidth=parseInt(r[0]),s.originalHeight=parseInt(r[1]),n.readTuple(r),s.offsetX=parseInt(r[0]),s.offsetY=parseInt(r[1]),s.index=parseInt(n.readValue()),s.texture=a.texture,this.regions.push(s)}else{(a=new g).name=i,2==n.readTuple(r)&&(a.width=parseInt(r[0]),a.height=parseInt(r[1]),n.readTuple(r)),n.readTuple(r),a.minFilter=c.filterFromString(r[0]),a.magFilter=c.filterFromString(r[1]);var p=n.readValue();a.uWrap=u.ClampToEdge,a.vWrap=u.ClampToEdge,"x"==p?a.uWrap=u.Repeat:"y"==p?a.vWrap=u.Repeat:"xy"==p&&(a.uWrap=a.vWrap=u.Repeat),a.texture=e(i),a.texture.setFilters(a.minFilter,a.magFilter),a.texture.setWraps(a.uWrap,a.vWrap),a.width=a.texture.width,a.height=a.texture.height,this.pages.push(a)}}},e.findRegion=function(t){for(var e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null},e.dispose=function(){for(var t=0;t<this.pages.length;t++)this.pages[t].texture.dispose()},t}(),v=function(){function t(t){this.index=0,this.lines=t.split(/\r\n|\r|\n/)}var e=t.prototype;return e.readLine=function(){return this.index>=this.lines.length?null:this.lines[this.index++]},e.readValue=function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw new Error("Invalid line: "+t);return t.substring(e+1).trim()},e.readTuple=function(t){var e=this.readLine(),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}(),g=function(){},m=function(t){function e(){return t.apply(this,arguments)}return r(e,t),e}(d),w=function(){function t(t,e,n){this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.rawDataUris={},this._engine=t,this.pathPrefix=e||"",this.textureLoader=n}var n=t.prototype;return n.downloadText=function(t,n,r){e.request(t,{type:"text"}).then((function(t){n(t)})).catch((function(t){r(t)}))},n.downloadBinary=function(t,e,n){var r=new XMLHttpRequest;this.rawDataUris[t]&&(t=this.rawDataUris[t]),r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=function(){200==r.status?e(new Uint8Array(r.response)):n(r.status,r.responseText)},r.onerror=function(){n(r.status,r.responseText)},r.send()},n.setRawDataURI=function(t,e){this.rawDataUris[this.pathPrefix+t]=e},n.loadBinary=function(t,e,n){var r=this;void 0===e&&(e=null),void 0===n&&(n=null),t=this.pathPrefix+t,this.toLoad++,this.downloadBinary(t,(function(n){r.assets[t]=n,e&&e(t,n),r.onLoad(),r.loaded++}),(function(e,a){r.errors[t]="Couldn't load binary "+t+": status "+status+", "+a,n&&n("Couldn't load binary "+t+": status "+status+", "+a),r.onLoad(),r.loaded++}))},n.loadText=function(t,e,n){var r=this;void 0===e&&(e=null),void 0===n&&(n=null),t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(n){r.assets[t]=n,e&&e(t,n),r.onLoad(),r.loaded++}),(function(e){r.errors[t]="Couldn't load text "+t+": "+JSON.stringify(e),n&&n("Couldn't load text "+t+": "+JSON.stringify(e)),r.onLoad(),r.loaded++}))},n.loadImage=function(t,e,n){var r=this;void 0===e&&(e=null),void 0===n&&(n=null);var a=t=this.pathPrefix+t;this.toLoad++;var i=new Image;i.crossOrigin="anonymous",i.onload=function(n){r.assets[a]=i,r.onLoad(),r.loaded++,e&&e(t,i)},i.onerror=function(e){r.errors[t]="Couldn't load image "+t,r.onLoad(),r.loaded++,n&&n("Couldn't load image "+t)},this.rawDataUris[t]&&(t=this.rawDataUris[t]),i.src=t},n.loadTexture=function(t,n,r){var a=this;void 0===n&&(n=null),void 0===r&&(r=null);var i=t=this.pathPrefix+t;this.toLoad++,this.rawDataUris[t]&&(t=this.rawDataUris[t]),e.request(t,{type:"image"}).then((function(e){var r=a.textureLoader(e);a.assets[i]=r,a.onLoad(),a.loaded++,n&&n(t,r)})).catch((function(t){r(t)}))},n.loadEngineTexture=function(t,e,n,r){var a=this;void 0===n&&(n=null),void 0===r&&(r=null);var i=t=this.pathPrefix+t;this.toLoad++,this.rawDataUris[t]&&(t=this.rawDataUris[t]),this.engine.resourceManager.load({url:t,type:e}).then((function(e){var r=a.textureLoader(e);a.assets[i]=r,a.onLoad(),a.loaded++,n&&n(t,r)})).catch((function(t){r(t)}))},n.loadTextureAtlas=function(t,n,r){var a=this;void 0===n&&(n=null),void 0===r&&(r=null);var i=t.lastIndexOf("/")>=0?t.substring(0,t.lastIndexOf("/")):"";t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(s){var o=function(){var e=d.value,o=!1;a.loadTexture(e,(function(e,l){if(h.count++,h.count==u.length)if(o)a.errors[t]="Couldn't load texture atlas page "+e+"} of atlas "+t,r&&r("Couldn't load texture atlas page "+e+" of atlas "+t),a.onLoad(),a.loaded++;else try{var c=new p(s,(function(t){return a.get(""==i?t:i+"/"+t)}));a.assets[t]=c,n&&n(t,c),a.onLoad(),a.loaded++}catch(e){var d=e;a.errors[t]="Couldn't load texture atlas "+t+": "+d.message,r&&r("Couldn't load texture atlas "+t+": "+d.message),a.onLoad(),a.loaded++}}),(function(e){o=!0,h.count++,h.count==u.length&&(a.errors[t]="Couldn't load texture atlas page "+e+"} of atlas "+t,r&&r("Couldn't load texture atlas page "+e+" of atlas "+t),a.onLoad(),a.loaded++)}))},h={count:0},u=new Array;try{new p(s,(function(t){return u.push(""==i?t:i+"/"+t),new f(new e.Texture2D(a.engine,16,16))}))}catch(e){var c=e;return a.errors[t]="Couldn't load texture atlas "+t+": "+c.message,r&&r("Couldn't load texture atlas "+t+": "+c.message),a.onLoad(),void a.loaded++}for(var d,v=l(u);!(d=v()).done;)o()}),(function(e){a.errors[t]="Couldn't load texture atlas "+t+": "+JSON.stringify(e),r&&r("Couldn't load texture atlas "+t+": "+JSON.stringify(e)),a.onLoad(),a.loaded++}))},n.get=function(t){return t=this.pathPrefix+t,this.assets[t]},n.remove=function(t){t=this.pathPrefix+t;var e=this.assets[t];e.dispose&&e.dispose(),this.assets[t]=null},n.removeAll=function(){for(var t in this.assets){var e=this.assets[t];e.dispose&&e.dispose()}this.assets={}},n.isLoadingComplete=function(){return 0==this.toLoad},n.onLoad=function(){this.toLoad--,0===this.toLoad&&this.onLoadComplete()},n.getToLoad=function(){return this.toLoad},n.getLoaded=function(){return this.loaded},n.dispose=function(){this.removeAll()},n.hasErrors=function(){return Object.keys(this.errors).length>0},n.getErrors=function(){return this.errors},s(t,[{key:"engine",get:function(){return this._engine}}]),t}();var y=function(){function t(){this.array=new Array}var e=t.prototype;return e.add=function(t){var e=this.contains(t);return this.array[0|t]=0|t,!e},e.contains=function(t){return null!=this.array[0|t]},e.remove=function(t){this.array[0|t]=void 0},e.clear=function(){this.array.length=0},t}(),E=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}var e=t.prototype;return e.set=function(t,e,n,r){return this.r=t,this.g=e,this.b=n,this.a=r,this.clamp(),this},e.setFromColor=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.setFromString=function(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=(8!=t.length?255:parseInt(t.substr(6,2),16))/255,this},e.add=function(t,e,n,r){return this.r+=t,this.g+=e,this.b+=n,this.a+=r,this.clamp(),this},e.clamp=function(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this},t.rgba8888ToColor=function(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255},t.rgb888ToColor=function(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255},t}();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 x=function(){function t(){}return t.clamp=function(t,e,n){return t<e?e:t>n?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}();x.PI=3.1415927,x.PI2=2*x.PI,x.radiansToDegrees=180/x.PI,x.radDeg=x.radiansToDegrees,x.degreesToRadians=x.PI/180,x.degRad=x.degreesToRadians;var b=function(){function t(){}return t.arrayCopy=function(t,e,n,r,a){for(var i=e,s=r;i<e+a;i++,s++)n[s]=t[i]},t.setArraySize=function(t,e,n){void 0===n&&(n=0);var r=t.length;if(r==e)return t;if(t.length=e,r<e)for(var a=r;a<e;a++)t[a]=n;return t},t.ensureArrayCapacity=function(e,n,r){return void 0===r&&(r=0),e.length>=n?e:t.setArraySize(e,n,r)},t.newArray=function(t,e){for(var n=new Array(t),r=0;r<t;r++)n[r]=e;return n},t.newFloatArray=function(e){if(t.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);for(var n=new Array(e),r=0;r<n.length;r++)n[r]=0;return n},t.newShortArray=function(e){if(t.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);for(var n=new Array(e),r=0;r<n.length;r++)n[r]=0;return n},t.toFloatArray=function(e){return t.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e},t.toSinglePrecision=function(e){return t.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e},t.webkit602BugfixHelper=function(t,e){},t.contains=function(t,e,n){for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1},t}();b.SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;var S=function(){function t(t){this.items=new Array,this.instantiator=t}var e=t.prototype;return e.obtain=function(){return this.items.length>0?this.items.pop():this.instantiator()},e.free=function(t){t.reset&&t.reset(),this.items.push(t)},e.freeAll=function(t){for(var e=0;e<t.length;e++)this.free(t[e])},e.clear=function(){this.items.length=0},t}(),M=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.length=function(){var t=this.x,e=this.y;return Math.sqrt(t*t+e*e)},e.normalize=function(){var t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this},t}(),A=function(t){if(null==t)throw new Error("name cannot be null.");this.name=t},T=function(t){function e(n){var r;return(r=t.call(this,n)||this).id=(65535&e.nextID++)<<11,r.worldVerticesLength=0,r.deformAttachment=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(r),r}r(e,t);var n=e.prototype;return n.computeWorldVertices=function(t,e,n,r,a,i){n=a+(n>>1)*i;var s=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(null!=h){for(var u=0,c=0,d=0;d<e;d+=2){var f=h[u];u+=f+1,c+=f}var p=s.bones;if(0==o.length)for(var v=a,g=3*c;v<n;v+=i){var m=0,w=0,y=h[u++];for(y+=u;u<y;u++,g+=3){var E=p[h[u]],x=l[g],b=l[g+1],S=l[g+2];m+=(x*E.a+b*E.b+E.worldX)*S,w+=(x*E.c+b*E.d+E.worldY)*S}r[v]=m,r[v+1]=w}else for(var M=o,A=a,T=3*c,R=c<<1;A<n;A+=i){var I=0,C=0,_=h[u++];for(_+=u;u<_;u++,T+=3,R+=2){var k=p[h[u]],V=l[T]+M[R],P=l[T+1]+M[R+1],F=l[T+2];I+=(V*k.a+P*k.b+k.worldX)*F,C+=(V*k.c+P*k.d+k.worldY)*F}r[A]=I,r[A+1]=C}}else{o.length>0&&(l=o);for(var N=t.bone,B=N.worldX,O=N.worldY,L=N.a,X=N.b,D=N.c,Y=N.d,U=e,W=a;W<n;U+=2,W+=i){var q=l[U],H=l[U+1];r[W]=q*L+H*X+B,r[W+1]=q*D+H*Y+O}}},n.copyTo=function(t){null!=this.bones?(t.bones=new Array(this.bones.length),b.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,null!=this.vertices?(t.vertices=b.newFloatArray(this.vertices.length),b.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment},e}(A);T.nextID=0;var R=function(t){function e(e){var n;return(n=t.call(this,e)||this).x=0,n.y=0,n.scaleX=1,n.scaleY=1,n.rotation=0,n.width=0,n.height=0,n.color=new E(1,1,1,1),n.offset=b.newFloatArray(8),n.uvs=b.newFloatArray(8),n.tempColor=new E(1,1,1,1),n}r(e,t);var n=e.prototype;return n.updateOffset=function(){var t=this.width/this.region.originalWidth*this.scaleX,n=this.height/this.region.originalHeight*this.scaleY,r=-this.width/2*this.scaleX+this.region.offsetX*t,a=-this.height/2*this.scaleY+this.region.offsetY*n,i=r+this.region.width*t,s=a+this.region.height*n,o=this.rotation*Math.PI/180,l=Math.cos(o),h=Math.sin(o),u=r*l+this.x,c=r*h,d=a*l+this.y,f=a*h,p=i*l+this.x,v=i*h,g=s*l+this.y,m=s*h,w=this.offset;w[e.OX1]=u-f,w[e.OY1]=d+c,w[e.OX2]=u-m,w[e.OY2]=g+c,w[e.OX3]=p-m,w[e.OY3]=g+v,w[e.OX4]=p-f,w[e.OY4]=d+v},n.setRegion=function(t){this.region=t;var e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)},n.computeWorldVertices=function(t,n,r,a){var i=this.offset,s=t.worldX,o=t.worldY,l=t.a,h=t.b,u=t.c,c=t.d,d=0,f=0;d=i[e.OX1],f=i[e.OY1],n[r]=d*l+f*h+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX2],f=i[e.OY2],n[r]=d*l+f*h+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX3],f=i[e.OY3],n[r]=d*l+f*h+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX4],f=i[e.OY4],n[r]=d*l+f*h+s,n[r+1]=d*u+f*c+o},n.copy=function(){var t=new e(this.name);return t.region=this.region,t.rendererObject=this.rendererObject,t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,b.arrayCopy(this.uvs,0,t.uvs,0,8),b.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t},e}(A);function I(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}R.OX1=0,R.OY1=1,R.OX2=2,R.OY2=3,R.OX3=4,R.OY3=5,R.OX4=6,R.OY4=7,R.X1=0,R.Y1=1,R.C1R=2,R.C1G=3,R.C1B=4,R.C1A=5,R.U1=6,R.V1=7,R.X2=8,R.Y2=9,R.C2R=10,R.C2G=11,R.C2B=12,R.C2A=13,R.U2=14,R.V2=15,R.X3=16,R.Y3=17,R.C3R=18,R.C3G=19,R.C3B=20,R.C3A=21,R.U3=22,R.V3=23,R.X4=24,R.Y4=25,R.C4R=26,R.C4G=27,R.C4B=28,R.C4A=29,R.U4=30,R.V4=31;var C,_=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new E(1,1,1,1),n.tempColor=new E(0,0,0,0),n}r(e,t);var n=e.prototype;return n.updateUVs=function(){var t=this.regionUVs;null!=this.uvs&&this.uvs.length==t.length||(this.uvs=b.newFloatArray(t.length));var e=this.uvs,n=this.uvs.length,r=this.region.u,a=this.region.v,i=0,s=0;if(I(this.region,m)){var o=this.region,l=o.texture.width,h=o.texture.height;switch(o.degrees){case 90:r-=(o.originalHeight-o.offsetY-o.height)/l,a-=(o.originalWidth-o.offsetX-o.width)/h,i=o.originalHeight/l,s=o.originalWidth/h;for(var u=0;u<n;u+=2)e[u]=r+t[u+1]*i,e[u+1]=a+(1-t[u])*s;return;case 180:r-=(o.originalWidth-o.offsetX-o.width)/l,a-=o.offsetY/h,i=o.originalWidth/l,s=o.originalHeight/h;for(var c=0;c<n;c+=2)e[c]=r+(1-t[c])*i,e[c+1]=a+(1-t[c+1])*s;return;case 270:r-=o.offsetY/l,a-=o.offsetX/h,i=o.originalHeight/l,s=o.originalWidth/h;for(var d=0;d<n;d+=2)e[d]=r+(1-t[d+1])*i,e[d+1]=a+t[d]*s;return}r-=o.offsetX/l,a-=(o.originalHeight-o.offsetY-o.height)/h,i=o.originalWidth/l,s=o.originalHeight/h}else null==this.region?(r=a=0,i=s=1):(i=this.region.u2-r,s=this.region.v2-a);for(var f=0;f<n;f+=2)e[f]=r+t[f]*i,e[f+1]=a+t[f+1]*s},n.getParentMesh=function(){return this.parentMesh},n.setParentMesh=function(t){this.parentMesh=t,null!=t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)},n.copy=function(){if(null!=this.parentMesh)return this.newLinkedMesh();var t=new e(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),b.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),b.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),b.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,null!=this.edges&&(t.edges=new Array(this.edges.length),b.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t},n.newLinkedMesh=function(){var t=new e(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),t.deformAttachment=this.deformAttachment,t.setParentMesh(null!=this.parentMesh?this.parentMesh:this),t.updateUVs(),t},e}(T),k=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new E(1,1,1,1),n}return r(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t},e}(T),V=function(t){function e(e){var n;return(n=t.call(this,e)||this).closed=!1,n.constantSpeed=!1,n.color=new E(1,1,1,1),n}return r(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),b.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t},e}(T),P=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new E(.38,.94,0,1),n.name=e,n}r(e,t);var n=e.prototype;return n.computeWorldPosition=function(t,e){return e.x=this.x*t.a+this.y*t.b+t.worldX,e.y=this.x*t.c+this.y*t.d+t.worldY,e},n.computeWorldRotation=function(t){var e=x.cosDeg(this.rotation),n=x.sinDeg(this.rotation),r=e*t.a+n*t.b,a=e*t.c+n*t.d;return Math.atan2(a,r)*x.radDeg},n.copy=function(){var t=new e(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t},e}(T),F=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new E(.2275,.2275,.8078,1),n}return r(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t},e}(T),N=function(){function t(t){this.atlas=t}var e=t.prototype;return e.newRegionAttachment=function(t,e,n){var r=this.atlas.findRegion(n);if(null==r)throw new Error("Region not found in atlas: "+n+" (region attachment: "+e+")");r.renderObject=r;var a=new R(e);return a.setRegion(r),a},e.newMeshAttachment=function(t,e,n){var r=this.atlas.findRegion(n);if(null==r)throw new Error("Region not found in atlas: "+n+" (mesh attachment: "+e+")");r.renderObject=r;var a=new _(e);return a.region=r,a},e.newBoundingBoxAttachment=function(t,e){return new k(e)},e.newPathAttachment=function(t,e){return new V(e)},e.newPointAttachment=function(t,e){return new P(e)},e.newClippingAttachment=function(t,e){return new F(e)},t}(),B=function(){function t(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}var e=t.prototype;return e.findBone=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findBoneIndex=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1},e.findSlot=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findSlotIndex=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1},e.findSkin=function(t){if(null==t)throw new Error("skinName cannot be null.");for(var e=this.skins,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findEvent=function(t){if(null==t)throw new Error("eventDataName cannot be null.");for(var e=this.events,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findAnimation=function(t){if(null==t)throw new Error("animationName cannot be null.");for(var e=this.animations,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findIkConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.ikConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findTransformConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.transformConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findPathConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.pathConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findPathConstraintIndex=function(t){if(null==t)throw new Error("pathConstraintName cannot be null.");for(var e=this.pathConstraints,n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1},t}(),O=function(t,e,n){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=0,this.skinRequired=!1,this.color=new E,t<0)throw new Error("index must be >= 0.");if(null==e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=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"}(C||(C={}));var L,X,D,Y=function(t,e,n){if(this.color=new E(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(null==e)throw new Error("name cannot be null.");if(null==n)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=n},U=function(t,e,n){this.name=t,this.order=e,this.skinRequired=n},W=function(t){function e(e){var n;return(n=t.call(this,e,0,!1)||this).bones=new Array,n.bendDirection=1,n.compress=!1,n.stretch=!1,n.uniform=!1,n.mix=1,n.softness=0,n}return r(e,t),e}(U),q=function(t){function e(e){var n;return(n=t.call(this,e,0,!1)||this).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 r(e,t),e}(U),H=function(t){function e(e){var n;return(n=t.call(this,e,0,!1)||this).bones=new Array,n}return r(e,t),e}(U);!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(L||(L={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent"}(X||(X={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(D||(D={}));var G,j,z,Z=function(t,e,n){this.slotIndex=t,this.name=e,this.attachment=n},Q=function(){function t(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,null==t)throw new Error("name cannot be null.");this.name=t}var e=t.prototype;return e.setAttachment=function(t,e,n){if(null==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},e.addSkin=function(t){for(var e=0;e<t.bones.length;e++){for(var n=t.bones[e],r=!1,a=0;a<this.bones.length;a++)if(this.bones[a]==n){r=!0;break}r||this.bones.push(n)}for(var i=0;i<t.constraints.length;i++){for(var s=t.constraints[i],o=!1,l=0;l<this.constraints.length;l++)if(this.constraints[l]==s){o=!0;break}o||this.constraints.push(s)}for(var h=t.getAttachments(),u=0;u<h.length;u++){var c=h[u];this.setAttachment(c.slotIndex,c.name,c.attachment)}},e.copySkin=function(t){for(var e=0;e<t.bones.length;e++){for(var n=t.bones[e],r=!1,a=0;a<this.bones.length;a++)if(this.bones[a]==n){r=!0;break}r||this.bones.push(n)}for(var i=0;i<t.constraints.length;i++){for(var s=t.constraints[i],o=!1,l=0;l<this.constraints.length;l++)if(this.constraints[l]==s){o=!0;break}o||this.constraints.push(s)}for(var h=t.getAttachments(),u=0;u<h.length;u++){var c=h[u];null!=c.attachment&&(I(c.attachment,_)?(c.attachment=c.attachment.newLinkedMesh(),this.setAttachment(c.slotIndex,c.name,c.attachment)):(c.attachment=c.attachment.copy(),this.setAttachment(c.slotIndex,c.name,c.attachment)))}},e.getAttachment=function(t,e){var n=this.attachments[t];return n?n[e]:null},e.removeAttachment=function(t,e){var n=this.attachments[t];n&&(n[e]=null)},e.getAttachments=function(){for(var t=new Array,e=0;e<this.attachments.length;e++){var n=this.attachments[e];if(n)for(var r in n){var a=n[r];a&&t.push(new Z(e,r,a))}}return t},e.getAttachmentsForSlot=function(t,e){var n=this.attachments[t];if(n)for(var r in n){var a=n[r];a&&e.push(new Z(t,r,a))}},e.clear=function(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0},e.attachAll=function(t,e){for(var n=0,r=0;r<t.slots.length;r++){var a=t.slots[r],i=a.getAttachment();if(i&&n<e.attachments.length){var s=e.attachments[n];for(var o in s){if(i==s[o]){var l=this.getAttachment(n,o);null!=l&&a.setAttachment(l);break}}}n++}},t}(),J=function(t){this.name=t},K=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;r<e.length;r++)this.timelineIds[e[r].getPropertyId()]=!0;this.duration=n}var e=t.prototype;return e.hasTimeline=function(t){return 1==this.timelineIds[t]},e.apply=function(t,e,n,r,a,i,s,o){if(null==t)throw new Error("skeleton cannot be null.");r&&0!=this.duration&&(n%=this.duration,e>0&&(e%=this.duration));for(var l=this.timelines,h=0,u=l.length;h<u;h++)l[h].apply(t,e,n,a,i,s,o)},t.binarySearch=function(t,e,n){void 0===n&&(n=1);var r=0,a=t.length/n-2;if(0==a)return n;for(var i=a>>>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}();!function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"}(G||(G={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(j||(j={})),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"}(z||(z={}));var $=function(){function t(e){if(e<=0)throw new Error("frameCount must be > 0: "+e);this.curves=b.newFloatArray((e-1)*t.BEZIER_SIZE)}var e=t.prototype;return e.getFrameCount=function(){return this.curves.length/t.BEZIER_SIZE+1},e.setLinear=function(e){this.curves[e*t.BEZIER_SIZE]=t.LINEAR},e.setStepped=function(e){this.curves[e*t.BEZIER_SIZE]=t.STEPPED},e.getCurveType=function(e){var n=e*t.BEZIER_SIZE;if(n==this.curves.length)return t.LINEAR;var r=this.curves[n];return r==t.LINEAR?t.LINEAR:r==t.STEPPED?t.STEPPED:t.BEZIER},e.setCurve=function(e,n,r,a,i){var s=.03*(2*-n+a),o=.03*(2*-r+i),l=.006*(3*(n-a)+1),h=.006*(3*(r-i)+1),u=2*s+l,c=2*o+h,d=.3*n+s+.16666667*l,f=.3*r+o+.16666667*h,p=e*t.BEZIER_SIZE,v=this.curves;v[p++]=t.BEZIER;for(var g=d,m=f,w=p+t.BEZIER_SIZE-1;p<w;p+=2)v[p]=g,v[p+1]=m,d+=u,f+=c,u+=l,c+=h,g+=d,m+=f},e.getCurvePercent=function(e,n){n=x.clamp(n,0,1);var r=this.curves,a=e*t.BEZIER_SIZE,i=r[a];if(i==t.LINEAR)return n;if(i==t.STEPPED)return 0;for(var s=0,o=++a,l=a+t.BEZIER_SIZE-1;a<l;a+=2)if((s=r[a])>=n){var h=void 0,u=void 0;return a==o?(h=0,u=0):(h=r[a-2],u=r[a-1]),u+(r[a+1]-u)*(n-h)/(s-h)}var c=r[a-1];return c+(1-c)*(n-s)/(1-s)},t}();$.LINEAR=0,$.STEPPED=1,$.BEZIER=2,$.BEZIER_SIZE=19;var tt=function(t){function e(e){var n;return(n=t.call(this,e)||this).frames=b.newFloatArray(e<<1),n}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return 0+this.boneIndex},n.setFrame=function(t,n,r){t<<=1,this.frames[t]=n,this.frames[t+e.ROTATION]=r},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(r<l[0])switch(s){case 0:return void(h.rotation=h.data.rotation);case 1:var u=h.data.rotation-h.rotation;h.rotation+=(u-360*(16384-(16384.499999999996-u/360|0)))*i}else if(r>=l[l.length-e.ENTRIES]){var c=l[l.length+e.PREV_ROTATION];switch(s){case 0:h.rotation=h.data.rotation+c*i;break;case 1:case 2:c+=h.data.rotation-h.rotation,c-=360*(16384-(16384.499999999996-c/360|0));case 3:h.rotation+=c*i}}else{var d=K.binarySearch(l,r,e.ENTRIES),f=l[d+e.PREV_ROTATION],p=l[d],v=this.getCurvePercent((d>>1)-1,1-(r-p)/(l[d+e.PREV_TIME]-p)),g=l[d+e.ROTATION]-f;switch(g=f+(g-360*(16384-(16384.499999999996-g/360|0)))*v,s){case 0:h.rotation=h.data.rotation+(g-360*(16384-(16384.499999999996-g/360|0)))*i;break;case 1:case 2:g+=h.data.rotation-h.rotation;case 3:h.rotation+=(g-360*(16384-(16384.499999999996-g/360|0)))*i}}},e}($);tt.ENTRIES=2,tt.PREV_TIME=-2,tt.PREV_ROTATION=-1,tt.ROTATION=1;var et=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(1<<24)+this.boneIndex},n.setFrame=function(t,n,r,a){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.X]=r,this.frames[t+e.Y]=a},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.x=h.data.x,void(h.y=h.data.y);case 1:h.x+=(h.data.x-h.x)*i,h.y+=(h.data.y-h.y)*i}else{var u=0,c=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X],c=l[l.length+e.PREV_Y];else{var d=K.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],p=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.X]-u)*p,c+=(l[d+e.Y]-c)*p}switch(s){case 0:h.x=h.data.x+u*i,h.y=h.data.y+c*i;break;case 1:case 2:h.x+=(h.data.x+u-h.x)*i,h.y+=(h.data.y+c-h.y)*i;break;case 3:h.x+=u*i,h.y+=c*i}}},e}($);et.ENTRIES=3,et.PREV_TIME=-3,et.PREV_X=-2,et.PREV_Y=-1,et.X=1,et.Y=2;var nt=function(t){function e(e){return t.call(this,e)}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(2<<24)+this.boneIndex},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.scaleX=h.data.scaleX,void(h.scaleY=h.data.scaleY);case 1:h.scaleX+=(h.data.scaleX-h.scaleX)*i,h.scaleY+=(h.data.scaleY-h.scaleY)*i}else{var u=0,c=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X]*h.data.scaleX,c=l[l.length+e.PREV_Y]*h.data.scaleY;else{var d=K.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],p=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u=(u+(l[d+e.X]-u)*p)*h.data.scaleX,c=(c+(l[d+e.Y]-c)*p)*h.data.scaleY}if(1==i)3==s?(h.scaleX+=u-h.data.scaleX,h.scaleY+=c-h.data.scaleY):(h.scaleX=u,h.scaleY=c);else{var v=0,g=0;if(1==o)switch(s){case 0:v=h.data.scaleX,g=h.data.scaleY,h.scaleX=v+(Math.abs(u)*x.signum(v)-v)*i,h.scaleY=g+(Math.abs(c)*x.signum(g)-g)*i;break;case 1:case 2:v=h.scaleX,g=h.scaleY,h.scaleX=v+(Math.abs(u)*x.signum(v)-v)*i,h.scaleY=g+(Math.abs(c)*x.signum(g)-g)*i;break;case 3:v=h.scaleX,g=h.scaleY,h.scaleX=v+(Math.abs(u)*x.signum(v)-h.data.scaleX)*i,h.scaleY=g+(Math.abs(c)*x.signum(g)-h.data.scaleY)*i}else switch(s){case 0:v=Math.abs(h.data.scaleX)*x.signum(u),g=Math.abs(h.data.scaleY)*x.signum(c),h.scaleX=v+(u-v)*i,h.scaleY=g+(c-g)*i;break;case 1:case 2:v=Math.abs(h.scaleX)*x.signum(u),g=Math.abs(h.scaleY)*x.signum(c),h.scaleX=v+(u-v)*i,h.scaleY=g+(c-g)*i;break;case 3:v=x.signum(u),g=x.signum(c),h.scaleX=Math.abs(h.scaleX)*v+(u-Math.abs(h.data.scaleX)*v)*i,h.scaleY=Math.abs(h.scaleY)*g+(c-Math.abs(h.data.scaleY)*g)*i}}}},e}(et),rt=function(t){function e(e){return t.call(this,e)}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(3<<24)+this.boneIndex},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.shearX=h.data.shearX,void(h.shearY=h.data.shearY);case 1:h.shearX+=(h.data.shearX-h.shearX)*i,h.shearY+=(h.data.shearY-h.shearY)*i}else{var u=0,c=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X],c=l[l.length+e.PREV_Y];else{var d=K.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],p=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.X]-u)*p,c+=(l[d+e.Y]-c)*p}switch(s){case 0:h.shearX=h.data.shearX+u*i,h.shearY=h.data.shearY+c*i;break;case 1:case 2:h.shearX+=(h.data.shearX+u-h.shearX)*i,h.shearY+=(h.data.shearY+c-h.shearY)*i;break;case 3:h.shearX+=u*i,h.shearY+=c*i}}},e}(et),at=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(5<<24)+this.slotIndex},n.setFrame=function(t,n,r,a,i,s){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.R]=r,this.frames[t+e.G]=a,this.frames[t+e.B]=i,this.frames[t+e.A]=s},n.apply=function(t,n,r,a,i,s,o){var l=t.slots[this.slotIndex];if(l.bone.active){var h=this.frames;if(r<h[0])switch(s){case 0:return void l.color.setFromColor(l.data.color);case 1:var u=l.color,c=l.data.color;u.add((c.r-u.r)*i,(c.g-u.g)*i,(c.b-u.b)*i,(c.a-u.a)*i)}else{var d=0,f=0,p=0,v=0;if(r>=h[h.length-e.ENTRIES]){var g=h.length;d=h[g+e.PREV_R],f=h[g+e.PREV_G],p=h[g+e.PREV_B],v=h[g+e.PREV_A]}else{var m=K.binarySearch(h,r,e.ENTRIES);d=h[m+e.PREV_R],f=h[m+e.PREV_G],p=h[m+e.PREV_B],v=h[m+e.PREV_A];var w=h[m],y=this.getCurvePercent(m/e.ENTRIES-1,1-(r-w)/(h[m+e.PREV_TIME]-w));d+=(h[m+e.R]-d)*y,f+=(h[m+e.G]-f)*y,p+=(h[m+e.B]-p)*y,v+=(h[m+e.A]-v)*y}if(1==i)l.color.set(d,f,p,v);else{var E=l.color;0==s&&E.setFromColor(l.data.color),E.add((d-E.r)*i,(f-E.g)*i,(p-E.b)*i,(v-E.a)*i)}}}},e}($);at.ENTRIES=5,at.PREV_TIME=-5,at.PREV_R=-4,at.PREV_G=-3,at.PREV_B=-2,at.PREV_A=-1,at.R=1,at.G=2,at.B=3,at.A=4;var it=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(14<<24)+this.slotIndex},n.setFrame=function(t,n,r,a,i,s,o,l,h){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.R]=r,this.frames[t+e.G]=a,this.frames[t+e.B]=i,this.frames[t+e.A]=s,this.frames[t+e.R2]=o,this.frames[t+e.G2]=l,this.frames[t+e.B2]=h},n.apply=function(t,n,r,a,i,s,o){var l=t.slots[this.slotIndex];if(l.bone.active){var h=this.frames;if(r<h[0])switch(s){case 0:return l.color.setFromColor(l.data.color),void l.darkColor.setFromColor(l.data.darkColor);case 1:var u=l.color,c=l.darkColor,d=l.data.color,f=l.data.darkColor;u.add((d.r-u.r)*i,(d.g-u.g)*i,(d.b-u.b)*i,(d.a-u.a)*i),c.add((f.r-c.r)*i,(f.g-c.g)*i,(f.b-c.b)*i,0)}else{var p=0,v=0,g=0,m=0,w=0,y=0,E=0;if(r>=h[h.length-e.ENTRIES]){var x=h.length;p=h[x+e.PREV_R],v=h[x+e.PREV_G],g=h[x+e.PREV_B],m=h[x+e.PREV_A],w=h[x+e.PREV_R2],y=h[x+e.PREV_G2],E=h[x+e.PREV_B2]}else{var b=K.binarySearch(h,r,e.ENTRIES);p=h[b+e.PREV_R],v=h[b+e.PREV_G],g=h[b+e.PREV_B],m=h[b+e.PREV_A],w=h[b+e.PREV_R2],y=h[b+e.PREV_G2],E=h[b+e.PREV_B2];var S=h[b],M=this.getCurvePercent(b/e.ENTRIES-1,1-(r-S)/(h[b+e.PREV_TIME]-S));p+=(h[b+e.R]-p)*M,v+=(h[b+e.G]-v)*M,g+=(h[b+e.B]-g)*M,m+=(h[b+e.A]-m)*M,w+=(h[b+e.R2]-w)*M,y+=(h[b+e.G2]-y)*M,E+=(h[b+e.B2]-E)*M}if(1==i)l.color.set(p,v,g,m),l.darkColor.set(w,y,E,1);else{var A=l.color,T=l.darkColor;0==s&&(A.setFromColor(l.data.color),T.setFromColor(l.data.darkColor)),A.add((p-A.r)*i,(v-A.g)*i,(g-A.b)*i,(m-A.a)*i),T.add((w-T.r)*i,(y-T.g)*i,(E-T.b)*i,0)}}}},e}($);it.ENTRIES=8,it.PREV_TIME=-8,it.PREV_R=-7,it.PREV_G=-6,it.PREV_B=-5,it.PREV_A=-4,it.PREV_R2=-3,it.PREV_G2=-2,it.PREV_B2=-1,it.R=1,it.G=2,it.B=3,it.A=4,it.R2=5,it.G2=6,it.B2=7;var st=function(){function t(t){this.frames=b.newFloatArray(t),this.attachmentNames=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return(4<<24)+this.slotIndex},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e,n){this.frames[t]=e,this.attachmentNames[t]=n},e.apply=function(t,e,n,r,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active)if(1!=s){var l=this.frames;if(n<l[0])0!=i&&1!=i||this.setAttachment(t,o,o.data.attachmentName);else{var h=0;h=n>=l[l.length-1]?l.length-1:K.binarySearch(l,n,1)-1;var u=this.attachmentNames[h];t.slots[this.slotIndex].setAttachment(null==u?null:t.getAttachment(this.slotIndex,u))}}else 0==i&&this.setAttachment(t,o,o.data.attachmentName)},e.setAttachment=function(t,e,n){e.attachment=null==n?null:t.getAttachment(this.slotIndex,n)},t}(),ot=null,lt=function(t){function e(e){var n;return(n=t.call(this,e)||this).frames=b.newFloatArray(e),n.frameVertices=new Array(e),null==ot&&(ot=b.newFloatArray(64)),n}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(6<<27)+ +this.attachment.id+this.slotIndex},n.setFrame=function(t,e,n){this.frames[t]=e,this.frameVertices[t]=n},n.apply=function(t,e,n,r,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active){var l=o.getAttachment();if(I(l,T)&&l.deformAttachment==this.attachment){var h=o.deform;0==h.length&&(i=0);var u=this.frameVertices,c=u[0].length,d=this.frames;if(n<d[0]){var f=l;switch(i){case 0:return void(h.length=0);case 1:if(1==a){h.length=0;break}var p=b.setArraySize(h,c);if(null==f.bones)for(var v=f.vertices,g=0;g<c;g++)p[g]+=(v[g]-p[g])*a;else{a=1-a;for(g=0;g<c;g++)p[g]*=a}}}else{var m=b.setArraySize(h,c);if(n>=d[d.length-1]){var w=u[d.length-1];if(1==a)if(3==i){var y=l;if(null==y.bones)for(var E=y.vertices,x=0;x<c;x++)m[x]+=w[x]-E[x];else for(var S=0;S<c;S++)m[S]+=w[S]}else b.arrayCopy(w,0,m,0,c);else switch(i){case 0:var M=l;if(null==M.bones)for(var A=M.vertices,R=0;R<c;R++){var C=A[R];m[R]=C+(w[R]-C)*a}else for(var _=0;_<c;_++)m[_]=w[_]*a;break;case 1:case 2:for(var k=0;k<c;k++)m[k]+=(w[k]-m[k])*a;break;case 3:var V=l;if(null==V.bones)for(var P=V.vertices,F=0;F<c;F++)m[F]+=(w[F]-P[F])*a;else for(var N=0;N<c;N++)m[N]+=w[N]*a}}else{var B=K.binarySearch(d,n),O=u[B-1],L=u[B],X=d[B],D=this.getCurvePercent(B-1,1-(n-X)/(d[B-1]-X));if(1==a)if(3==i){var Y=l;if(null==Y.bones)for(var U=Y.vertices,W=0;W<c;W++){var q=O[W];m[W]+=q+(L[W]-q)*D-U[W]}else for(var H=0;H<c;H++){var G=O[H];m[H]+=G+(L[H]-G)*D}}else for(var j=0;j<c;j++){var z=O[j];m[j]=z+(L[j]-z)*D}else switch(i){case 0:var Z=l;if(null==Z.bones)for(var Q=Z.vertices,J=0;J<c;J++){var $=O[J],tt=Q[J];m[J]=tt+($+(L[J]-$)*D-tt)*a}else for(var et=0;et<c;et++){var nt=O[et];m[et]=(nt+(L[et]-nt)*D)*a}break;case 1:case 2:for(var rt=0;rt<c;rt++){var at=O[rt];m[rt]+=(at+(L[rt]-at)*D-m[rt])*a}break;case 3:var it=l;if(null==it.bones)for(var st=it.vertices,ot=0;ot<c;ot++){var lt=O[ot];m[ot]+=(lt+(L[ot]-lt)*D-st[ot])*a}else for(var ht=0;ht<c;ht++){var ut=O[ht];m[ht]+=(ut+(L[ht]-ut)*D)*a}}}}}}},e}($),ht=function(){function t(t){this.frames=b.newFloatArray(t),this.events=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return 7<<24},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e){this.frames[t]=e.time,this.events[t]=e},e.apply=function(t,e,n,r,a,i,s){if(null!=r){var o=this.frames,l=this.frames.length;if(e>n)this.apply(t,e,Number.MAX_VALUE,r,a,i,s),e=-1;else if(e>=o[l-1])return;if(!(n<o[0])){var h=0;if(e<o[0])h=0;else for(var u=o[h=K.binarySearch(o,e)];h>0&&o[h-1]==u;)h--;for(;h<l&&n>=o[h];h++)r.push(this.events[h])}}},t}(),ut=function(){function t(t){this.frames=b.newFloatArray(t),this.drawOrders=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return 8<<24},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e,n){this.frames[t]=e,this.drawOrders[t]=n},e.apply=function(t,e,n,r,a,i,s){var o=t.drawOrder,l=t.slots;if(1!=s){var h=this.frames;if(n<h[0])0!=i&&1!=i||b.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{var u=0;u=n>=h[h.length-1]?h.length-1:K.binarySearch(h,n)-1;var c=this.drawOrders[u];if(null==c)b.arrayCopy(l,0,o,0,l.length);else for(var d=0,f=c.length;d<f;d++)o[d]=l[c[d]]}}else 0==i&&b.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)},t}(),ct=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(9<<24)+this.ikConstraintIndex},n.setFrame=function(t,n,r,a,i,s,o){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.MIX]=r,this.frames[t+e.SOFTNESS]=a,this.frames[t+e.BEND_DIRECTION]=i,this.frames[t+e.COMPRESS]=s?1:0,this.frames[t+e.STRETCH]=o?1:0},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.ikConstraints[this.ikConstraintIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.mix=h.data.mix,h.softness=h.data.softness,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,void(h.stretch=h.data.stretch);case 1:h.mix+=(h.data.mix-h.mix)*i,h.softness+=(h.data.softness-h.softness)*i,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch}else if(r>=l[l.length-e.ENTRIES])0==s?(h.mix=h.data.mix+(l[l.length+e.PREV_MIX]-h.data.mix)*i,h.softness=h.data.softness+(l[l.length+e.PREV_SOFTNESS]-h.data.softness)*i,1==o?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=l[l.length+e.PREV_BEND_DIRECTION],h.compress=0!=l[l.length+e.PREV_COMPRESS],h.stretch=0!=l[l.length+e.PREV_STRETCH])):(h.mix+=(l[l.length+e.PREV_MIX]-h.mix)*i,h.softness+=(l[l.length+e.PREV_SOFTNESS]-h.softness)*i,0==o&&(h.bendDirection=l[l.length+e.PREV_BEND_DIRECTION],h.compress=0!=l[l.length+e.PREV_COMPRESS],h.stretch=0!=l[l.length+e.PREV_STRETCH]));else{var u=K.binarySearch(l,r,e.ENTRIES),c=l[u+e.PREV_MIX],d=l[u+e.PREV_SOFTNESS],f=l[u],p=this.getCurvePercent(u/e.ENTRIES-1,1-(r-f)/(l[u+e.PREV_TIME]-f));0==s?(h.mix=h.data.mix+(c+(l[u+e.MIX]-c)*p-h.data.mix)*i,h.softness=h.data.softness+(d+(l[u+e.SOFTNESS]-d)*p-h.data.softness)*i,1==o?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=l[u+e.PREV_BEND_DIRECTION],h.compress=0!=l[u+e.PREV_COMPRESS],h.stretch=0!=l[u+e.PREV_STRETCH])):(h.mix+=(c+(l[u+e.MIX]-c)*p-h.mix)*i,h.softness+=(d+(l[u+e.SOFTNESS]-d)*p-h.softness)*i,0==o&&(h.bendDirection=l[u+e.PREV_BEND_DIRECTION],h.compress=0!=l[u+e.PREV_COMPRESS],h.stretch=0!=l[u+e.PREV_STRETCH]))}},e}($);ct.ENTRIES=6,ct.PREV_TIME=-6,ct.PREV_MIX=-5,ct.PREV_SOFTNESS=-4,ct.PREV_BEND_DIRECTION=-3,ct.PREV_COMPRESS=-2,ct.PREV_STRETCH=-1,ct.MIX=1,ct.SOFTNESS=2,ct.BEND_DIRECTION=3,ct.COMPRESS=4,ct.STRETCH=5;var dt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(10<<24)+this.transformConstraintIndex},n.setFrame=function(t,n,r,a,i,s){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.ROTATE]=r,this.frames[t+e.TRANSLATE]=a,this.frames[t+e.SCALE]=i,this.frames[t+e.SHEAR]=s},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.transformConstraints[this.transformConstraintIndex];if(h.active)if(r<l[0]){var u=h.data;switch(s){case 0:return h.rotateMix=u.rotateMix,h.translateMix=u.translateMix,h.scaleMix=u.scaleMix,void(h.shearMix=u.shearMix);case 1:h.rotateMix+=(u.rotateMix-h.rotateMix)*i,h.translateMix+=(u.translateMix-h.translateMix)*i,h.scaleMix+=(u.scaleMix-h.scaleMix)*i,h.shearMix+=(u.shearMix-h.shearMix)*i}}else{var c=0,d=0,f=0,p=0;if(r>=l[l.length-e.ENTRIES]){var v=l.length;c=l[v+e.PREV_ROTATE],d=l[v+e.PREV_TRANSLATE],f=l[v+e.PREV_SCALE],p=l[v+e.PREV_SHEAR]}else{var g=K.binarySearch(l,r,e.ENTRIES);c=l[g+e.PREV_ROTATE],d=l[g+e.PREV_TRANSLATE],f=l[g+e.PREV_SCALE],p=l[g+e.PREV_SHEAR];var m=l[g],w=this.getCurvePercent(g/e.ENTRIES-1,1-(r-m)/(l[g+e.PREV_TIME]-m));c+=(l[g+e.ROTATE]-c)*w,d+=(l[g+e.TRANSLATE]-d)*w,f+=(l[g+e.SCALE]-f)*w,p+=(l[g+e.SHEAR]-p)*w}if(0==s){var y=h.data;h.rotateMix=y.rotateMix+(c-y.rotateMix)*i,h.translateMix=y.translateMix+(d-y.translateMix)*i,h.scaleMix=y.scaleMix+(f-y.scaleMix)*i,h.shearMix=y.shearMix+(p-y.shearMix)*i}else h.rotateMix+=(c-h.rotateMix)*i,h.translateMix+=(d-h.translateMix)*i,h.scaleMix+=(f-h.scaleMix)*i,h.shearMix+=(p-h.shearMix)*i}},e}($);dt.ENTRIES=5,dt.PREV_TIME=-5,dt.PREV_ROTATE=-4,dt.PREV_TRANSLATE=-3,dt.PREV_SCALE=-2,dt.PREV_SHEAR=-1,dt.ROTATE=1,dt.TRANSLATE=2,dt.SCALE=3,dt.SHEAR=4;var ft=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(11<<24)+this.pathConstraintIndex},n.setFrame=function(t,n,r){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.VALUE]=r},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(r<l[0])switch(s){case 0:return void(h.position=h.data.position);case 1:h.position+=(h.data.position-h.position)*i}else{var u=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_VALUE];else{var c=K.binarySearch(l,r,e.ENTRIES);u=l[c+e.PREV_VALUE];var d=l[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(r-d)/(l[c+e.PREV_TIME]-d));u+=(l[c+e.VALUE]-u)*f}0==s?h.position=h.data.position+(u-h.data.position)*i:h.position+=(u-h.position)*i}},e}($);ft.ENTRIES=2,ft.PREV_TIME=-2,ft.PREV_VALUE=-1,ft.VALUE=1;var pt,vt=function(t){function e(e){return t.call(this,e)}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(12<<24)+this.pathConstraintIndex},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(r<l[0])switch(s){case 0:return void(h.spacing=h.data.spacing);case 1:h.spacing+=(h.data.spacing-h.spacing)*i}else{var u=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_VALUE];else{var c=K.binarySearch(l,r,e.ENTRIES);u=l[c+e.PREV_VALUE];var d=l[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(r-d)/(l[c+e.PREV_TIME]-d));u+=(l[c+e.VALUE]-u)*f}0==s?h.spacing=h.data.spacing+(u-h.data.spacing)*i:h.spacing+=(u-h.spacing)*i}},e}(ft),gt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(13<<24)+this.pathConstraintIndex},n.setFrame=function(t,n,r,a){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.ROTATE]=r,this.frames[t+e.TRANSLATE]=a},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.rotateMix=h.data.rotateMix,void(h.translateMix=h.data.translateMix);case 1:h.rotateMix+=(h.data.rotateMix-h.rotateMix)*i,h.translateMix+=(h.data.translateMix-h.translateMix)*i}else{var u=0,c=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_ROTATE],c=l[l.length+e.PREV_TRANSLATE];else{var d=K.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_ROTATE],c=l[d+e.PREV_TRANSLATE];var f=l[d],p=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.ROTATE]-u)*p,c+=(l[d+e.TRANSLATE]-c)*p}0==s?(h.rotateMix=h.data.rotateMix+(u-h.data.rotateMix)*i,h.translateMix=h.data.translateMix+(c-h.data.translateMix)*i):(h.rotateMix+=(u-h.rotateMix)*i,h.translateMix+=(c-h.translateMix)*i)}},e}($);gt.ENTRIES=3,gt.PREV_TIME=-3,gt.PREV_ROTATE=-2,gt.PREV_TRANSLATE=-1,gt.ROTATE=1,gt.TRANSLATE=2,function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(pt||(pt={}));var mt,wt=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e},yt=function(){function t(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}var e=t.prototype;return e.readSkeletonData=function(e){var n=this.scale,r=new B,a="string"==typeof e?JSON.parse(e):e,i=a.skeleton;if(null!=i){if(r.hash=i.hash,r.version=i.spine,"3.8.75"==r.version)throw new Error("Unsupported skeleton data, please export with a newer version of Spine.");r.x=i.x,r.y=i.y,r.width=i.width,r.height=i.height,r.fps=i.fps,r.imagesPath=i.images}if(a.bones)for(var s=0;s<a.bones.length;s++){var o=a.bones[s],l=null,h=this.getValue(o,"parent",null);if(null!=h&&null==(l=r.findBone(h)))throw new Error("Parent bone not found: "+h);var u=new O(r.bones.length,o.name,l);u.length=this.getValue(o,"length",0)*n,u.x=this.getValue(o,"x",0)*n,u.y=this.getValue(o,"y",0)*n,u.rotation=this.getValue(o,"rotation",0),u.scaleX=this.getValue(o,"scaleX",1),u.scaleY=this.getValue(o,"scaleY",1),u.shearX=this.getValue(o,"shearX",0),u.shearY=this.getValue(o,"shearY",0),u.transformMode=t.transformModeFromString(this.getValue(o,"transform","normal")),u.skinRequired=this.getValue(o,"skin",!1),r.bones.push(u)}if(a.slots)for(var c=0;c<a.slots.length;c++){var d=a.slots[c],f=d.name,p=d.bone,v=r.findBone(p);if(null==v)throw new Error("Slot bone not found: "+p);var g=new Y(r.slots.length,f,v),m=this.getValue(d,"color",null);null!=m&&g.color.setFromString(m);var w=this.getValue(d,"dark",null);null!=w&&(g.darkColor=new E(1,1,1,1),g.darkColor.setFromString(w)),g.attachmentName=this.getValue(d,"attachment",null),g.blendMode=t.blendModeFromString(this.getValue(d,"blend","normal")),r.slots.push(g)}if(a.ik)for(var y=0;y<a.ik.length;y++){var x=a.ik[y],b=new W(x.name);b.order=this.getValue(x,"order",0),b.skinRequired=this.getValue(x,"skin",!1);for(var S=0;S<x.bones.length;S++){var M=x.bones[S],A=r.findBone(M);if(null==A)throw new Error("IK bone not found: "+M);b.bones.push(A)}var T=x.target;if(b.target=r.findBone(T),null==b.target)throw new Error("IK target bone not found: "+T);b.mix=this.getValue(x,"mix",1),b.softness=this.getValue(x,"softness",0)*n,b.bendDirection=this.getValue(x,"bendPositive",!0)?1:-1,b.compress=this.getValue(x,"compress",!1),b.stretch=this.getValue(x,"stretch",!1),b.uniform=this.getValue(x,"uniform",!1),r.ikConstraints.push(b)}if(a.transform)for(var R=0;R<a.transform.length;R++){var I=a.transform[R],C=new q(I.name);C.order=this.getValue(I,"order",0),C.skinRequired=this.getValue(I,"skin",!1);for(var _=0;_<I.bones.length;_++){var k=I.bones[_],V=r.findBone(k);if(null==V)throw new Error("Transform constraint bone not found: "+k);C.bones.push(V)}var P=I.target;if(C.target=r.findBone(P),null==C.target)throw new Error("Transform constraint target bone not found: "+P);C.local=this.getValue(I,"local",!1),C.relative=this.getValue(I,"relative",!1),C.offsetRotation=this.getValue(I,"rotation",0),C.offsetX=this.getValue(I,"x",0)*n,C.offsetY=this.getValue(I,"y",0)*n,C.offsetScaleX=this.getValue(I,"scaleX",0),C.offsetScaleY=this.getValue(I,"scaleY",0),C.offsetShearY=this.getValue(I,"shearY",0),C.rotateMix=this.getValue(I,"rotateMix",1),C.translateMix=this.getValue(I,"translateMix",1),C.scaleMix=this.getValue(I,"scaleMix",1),C.shearMix=this.getValue(I,"shearMix",1),r.transformConstraints.push(C)}if(a.path)for(var F=0;F<a.path.length;F++){var N=a.path[F],D=new H(N.name);D.order=this.getValue(N,"order",0),D.skinRequired=this.getValue(N,"skin",!1);for(var U=0;U<N.bones.length;U++){var G=N.bones[U],j=r.findBone(G);if(null==j)throw new Error("Transform constraint bone not found: "+G);D.bones.push(j)}var z=N.target;if(D.target=r.findSlot(z),null==D.target)throw new Error("Path target slot not found: "+z);D.positionMode=t.positionModeFromString(this.getValue(N,"positionMode","percent")),D.spacingMode=t.spacingModeFromString(this.getValue(N,"spacingMode","length")),D.rotateMode=t.rotateModeFromString(this.getValue(N,"rotateMode","tangent")),D.offsetRotation=this.getValue(N,"rotation",0),D.position=this.getValue(N,"position",0),D.positionMode==L.Fixed&&(D.position*=n),D.spacing=this.getValue(N,"spacing",0),D.spacingMode!=X.Length&&D.spacingMode!=X.Fixed||(D.spacing*=n),D.rotateMix=this.getValue(N,"rotateMix",1),D.translateMix=this.getValue(N,"translateMix",1),r.pathConstraints.push(D)}if(a.skins)for(var Z=0;Z<a.skins.length;Z++){var K=a.skins[Z],$=new Q(K.name);if(K.bones)for(var tt=0;tt<K.bones.length;tt++){var et=r.findBone(K.bones[tt]);if(null==et)throw new Error("Skin bone not found: "+K.bones[Z]);$.bones.push(et)}if(K.ik)for(var nt=0;nt<K.ik.length;nt++){var rt=r.findIkConstraint(K.ik[nt]);if(null==rt)throw new Error("Skin IK constraint not found: "+K.ik[Z]);$.constraints.push(rt)}if(K.transform)for(var at=0;at<K.transform.length;at++){var it=r.findTransformConstraint(K.transform[at]);if(null==it)throw new Error("Skin transform constraint not found: "+K.transform[Z]);$.constraints.push(it)}if(K.path)for(var st=0;st<K.path.length;st++){var ot=r.findPathConstraint(K.path[st]);if(null==ot)throw new Error("Skin path constraint not found: "+K.path[Z]);$.constraints.push(ot)}for(var lt in K.attachments){var ht=r.findSlot(lt);if(null==ht)throw new Error("Slot not found: "+lt);var ut=K.attachments[lt];for(var ct in ut){var dt=this.readAttachment(ut[ct],$,ht.index,ct,r);null!=dt&&$.setAttachment(ht.index,ct,dt)}}r.skins.push($),"default"==$.name&&(r.defaultSkin=$)}for(var ft=0,pt=this.linkedMeshes.length;ft<pt;ft++){var vt=this.linkedMeshes[ft],gt=null==vt.skin?r.defaultSkin:r.findSkin(vt.skin);if(null==gt)throw new Error("Skin not found: "+vt.skin);var mt=gt.getAttachment(vt.slotIndex,vt.parent);if(null==mt)throw new Error("Parent mesh not found: "+vt.parent);vt.mesh.deformAttachment=vt.inheritDeform?mt:vt.mesh,vt.mesh.setParentMesh(mt),vt.mesh.updateUVs()}if(this.linkedMeshes.length=0,a.events)for(var wt in a.events){var yt=a.events[wt],Et=new J(wt);Et.intValue=this.getValue(yt,"int",0),Et.floatValue=this.getValue(yt,"float",0),Et.stringValue=this.getValue(yt,"string",""),Et.audioPath=this.getValue(yt,"audio",null),null!=Et.audioPath&&(Et.volume=this.getValue(yt,"volume",1),Et.balance=this.getValue(yt,"balance",0)),r.events.push(Et)}if(a.animations)for(var xt in a.animations){var bt=a.animations[xt];this.readAnimation(bt,xt,r)}return r},e.readAttachment=function(t,e,n,r,a){var i=this.scale;switch(r=this.getValue(t,"name",r),this.getValue(t,"type","region")){case"region":var s=this.getValue(t,"path",r),o=this.attachmentLoader.newRegionAttachment(e,r,s);if(null==o)return null;o.path=s,o.x=this.getValue(t,"x",0)*i,o.y=this.getValue(t,"y",0)*i,o.scaleX=this.getValue(t,"scaleX",1),o.scaleY=this.getValue(t,"scaleY",1),o.rotation=this.getValue(t,"rotation",0),o.width=t.width*i,o.height=t.height*i;var l=this.getValue(t,"color",null);return null!=l&&o.color.setFromString(l),o.updateOffset(),o;case"boundingbox":var h=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(null==h)return null;this.readVertices(t,h,t.vertexCount<<1);var u=this.getValue(t,"color",null);return null!=u&&h.color.setFromString(u),h;case"mesh":case"linkedmesh":var c=this.getValue(t,"path",r),d=this.attachmentLoader.newMeshAttachment(e,r,c);if(null==d)return null;d.path=c;var f=this.getValue(t,"color",null);null!=f&&d.color.setFromString(f),d.width=this.getValue(t,"width",0)*i,d.height=this.getValue(t,"height",0)*i;var p=this.getValue(t,"parent",null);if(null!=p)return this.linkedMeshes.push(new Et(d,this.getValue(t,"skin",null),n,p,this.getValue(t,"deform",!0))),d;var v=t.uvs;return this.readVertices(t,d,v.length),d.triangles=t.triangles,d.regionUVs=v,d.updateUVs(),d.edges=this.getValue(t,"edges",null),d.hullLength=2*this.getValue(t,"hull",0),d;case"path":var g=this.attachmentLoader.newPathAttachment(e,r);if(null==g)return null;g.closed=this.getValue(t,"closed",!1),g.constantSpeed=this.getValue(t,"constantSpeed",!0);var m=t.vertexCount;this.readVertices(t,g,m<<1);for(var w=b.newArray(m/3,0),y=0;y<t.lengths.length;y++)w[y]=t.lengths[y]*i;g.lengths=w;var E=this.getValue(t,"color",null);return null!=E&&g.color.setFromString(E),g;case"point":var x=this.attachmentLoader.newPointAttachment(e,r);if(null==x)return null;x.x=this.getValue(t,"x",0)*i,x.y=this.getValue(t,"y",0)*i,x.rotation=this.getValue(t,"rotation",0);var S=this.getValue(t,"color",null);return null!=S&&x.color.setFromString(S),x;case"clipping":var M=this.attachmentLoader.newClippingAttachment(e,r);if(null==M)return null;var A=this.getValue(t,"end",null);if(null!=A){var T=a.findSlot(A);if(null==T)throw new Error("Clipping end slot not found: "+A);M.endSlot=T}var R=t.vertexCount;this.readVertices(t,M,R<<1);var I=this.getValue(t,"color",null);return null!=I&&M.color.setFromString(I),M}return null},e.readVertices=function(t,e,n){var r=this.scale;e.worldVerticesLength=n;var a=t.vertices;if(n!=a.length){for(var i=new Array,s=new Array,o=0,l=a.length;o<l;){var h=a[o++];s.push(h);for(var u=o+4*h;o<u;o+=4)s.push(a[o]),i.push(a[o+1]*r),i.push(a[o+2]*r),i.push(a[o+3])}e.bones=s,e.vertices=b.toFloatArray(i)}else{var c=b.toFloatArray(a);if(1!=r)for(var d=0,f=a.length;d<f;d++)c[d]*=r;e.vertices=c}},e.readAnimation=function(t,e,n){var r=this.scale,a=new Array,i=0;if(t.slots)for(var s in t.slots){var o=t.slots[s],l=n.findSlotIndex(s);if(-1==l)throw new Error("Slot not found: "+s);for(var h in o){var u=o[h];if("attachment"==h){var c=new st(u.length);c.slotIndex=l;for(var d=0,f=0;f<u.length;f++){var p=u[f];c.setFrame(d++,this.getValue(p,"time",0),p.name)}a.push(c),i=Math.max(i,c.frames[c.getFrameCount()-1])}else if("color"==h){var v=new at(u.length);v.slotIndex=l;for(var g=0,m=0;m<u.length;m++){var w=u[m],y=new E;y.setFromString(w.color),v.setFrame(g,this.getValue(w,"time",0),y.r,y.g,y.b,y.a),this.readCurve(w,v,g),g++}a.push(v),i=Math.max(i,v.frames[(v.getFrameCount()-1)*at.ENTRIES])}else{if("twoColor"!=h)throw new Error("Invalid timeline type for a slot: "+h+" ("+s+")");var x=new it(u.length);x.slotIndex=l;for(var S=0,M=0;M<u.length;M++){var A=u[M],T=new E,R=new E;T.setFromString(A.light),R.setFromString(A.dark),x.setFrame(S,this.getValue(A,"time",0),T.r,T.g,T.b,T.a,R.r,R.g,R.b),this.readCurve(A,x,S),S++}a.push(x),i=Math.max(i,x.frames[(x.getFrameCount()-1)*it.ENTRIES])}}}if(t.bones)for(var I in t.bones){var C=t.bones[I],_=n.findBoneIndex(I);if(-1==_)throw new Error("Bone not found: "+I);for(var k in C){var V=C[k];if("rotate"===k){var P=new tt(V.length);P.boneIndex=_;for(var F=0,N=0;N<V.length;N++){var B=V[N];P.setFrame(F,this.getValue(B,"time",0),this.getValue(B,"angle",0)),this.readCurve(B,P,F),F++}a.push(P),i=Math.max(i,P.frames[(P.getFrameCount()-1)*tt.ENTRIES])}else{if("translate"!==k&&"scale"!==k&&"shear"!==k)throw new Error("Invalid timeline type for a bone: "+k+" ("+I+")");var O=null,D=1,Y=0;"scale"===k?(O=new nt(V.length),Y=1):"shear"===k?O=new rt(V.length):(O=new et(V.length),D=r),O.boneIndex=_;for(var U=0,W=0;W<V.length;W++){var q=V[W],H=this.getValue(q,"x",Y),G=this.getValue(q,"y",Y);O.setFrame(U,this.getValue(q,"time",0),H*D,G*D),this.readCurve(q,O,U),U++}a.push(O),i=Math.max(i,O.frames[(O.getFrameCount()-1)*et.ENTRIES])}}}if(t.ik)for(var j in t.ik){var z=t.ik[j],Z=n.findIkConstraint(j),Q=new ct(z.length);Q.ikConstraintIndex=n.ikConstraints.indexOf(Z);for(var J=0,$=0;$<z.length;$++){var ot=z[$];Q.setFrame(J,this.getValue(ot,"time",0),this.getValue(ot,"mix",1),this.getValue(ot,"softness",0)*r,this.getValue(ot,"bendPositive",!0)?1:-1,this.getValue(ot,"compress",!1),this.getValue(ot,"stretch",!1)),this.readCurve(ot,Q,J),J++}a.push(Q),i=Math.max(i,Q.frames[(Q.getFrameCount()-1)*ct.ENTRIES])}if(t.transform)for(var pt in t.transform){var mt=t.transform[pt],yt=n.findTransformConstraint(pt),Et=new dt(mt.length);Et.transformConstraintIndex=n.transformConstraints.indexOf(yt);for(var xt=0,bt=0;bt<mt.length;bt++){var St=mt[bt];Et.setFrame(xt,this.getValue(St,"time",0),this.getValue(St,"rotateMix",1),this.getValue(St,"translateMix",1),this.getValue(St,"scaleMix",1),this.getValue(St,"shearMix",1)),this.readCurve(St,Et,xt),xt++}a.push(Et),i=Math.max(i,Et.frames[(Et.getFrameCount()-1)*dt.ENTRIES])}if(t.path)for(var Mt in t.path){var At=t.path[Mt],Tt=n.findPathConstraintIndex(Mt);if(-1==Tt)throw new Error("Path constraint not found: "+Mt);var Rt=n.pathConstraints[Tt];for(var It in At){var Ct=At[It];if("position"===It||"spacing"===It){var _t=null,kt=1;"spacing"===It?(_t=new vt(Ct.length),Rt.spacingMode!=X.Length&&Rt.spacingMode!=X.Fixed||(kt=r)):(_t=new ft(Ct.length),Rt.positionMode==L.Fixed&&(kt=r)),_t.pathConstraintIndex=Tt;for(var Vt=0,Pt=0;Pt<Ct.length;Pt++){var Ft=Ct[Pt];_t.setFrame(Vt,this.getValue(Ft,"time",0),this.getValue(Ft,It,0)*kt),this.readCurve(Ft,_t,Vt),Vt++}a.push(_t),i=Math.max(i,_t.frames[(_t.getFrameCount()-1)*ft.ENTRIES])}else if("mix"===It){var Nt=new gt(Ct.length);Nt.pathConstraintIndex=Tt;for(var Bt=0,Ot=0;Ot<Ct.length;Ot++){var Lt=Ct[Ot];Nt.setFrame(Bt,this.getValue(Lt,"time",0),this.getValue(Lt,"rotateMix",1),this.getValue(Lt,"translateMix",1)),this.readCurve(Lt,Nt,Bt),Bt++}a.push(Nt),i=Math.max(i,Nt.frames[(Nt.getFrameCount()-1)*gt.ENTRIES])}}}if(t.deform)for(var Xt in t.deform){var Dt=t.deform[Xt],Yt=n.findSkin(Xt);if(null==Yt)throw new Error("Skin not found: "+Xt);for(var Ut in Dt){var Wt=Dt[Ut],qt=n.findSlotIndex(Ut);if(-1==qt)throw new Error("Slot not found: "+Wt.name);for(var Ht in Wt){var Gt=Wt[Ht],jt=Yt.getAttachment(qt,Ht);if(null==jt)throw new Error("Deform attachment not found: "+Gt.name);var zt=null!=jt.bones,Zt=jt.vertices,Qt=zt?Zt.length/3*2:Zt.length,Jt=new lt(Gt.length);Jt.slotIndex=qt,Jt.attachment=jt;for(var Kt=0,$t=0;$t<Gt.length;$t++){var te=Gt[$t],ee=void 0,ne=this.getValue(te,"vertices",null);if(null==ne)ee=zt?b.newFloatArray(Qt):Zt;else{ee=b.newFloatArray(Qt);var re=this.getValue(te,"offset",0);if(b.arrayCopy(ne,0,ee,re,ne.length),1!=r)for(var ae=re,ie=ae+ne.length;ae<ie;ae++)ee[ae]*=r;if(!zt)for(var se=0;se<Qt;se++)ee[se]+=Zt[se]}Jt.setFrame(Kt,this.getValue(te,"time",0),ee),this.readCurve(te,Jt,Kt),Kt++}a.push(Jt),i=Math.max(i,Jt.frames[Jt.getFrameCount()-1])}}}var oe=t.drawOrder;if(null==oe&&(oe=t.draworder),null!=oe){for(var le=new ut(oe.length),he=n.slots.length,ue=0,ce=0;ce<oe.length;ce++){var de=oe[ce],fe=null,pe=this.getValue(de,"offsets",null);if(null!=pe){fe=b.newArray(he,-1);for(var ve=b.newArray(he-pe.length,0),ge=0,me=0,we=0;we<pe.length;we++){var ye=pe[we],Ee=n.findSlotIndex(ye.slot);if(-1==Ee)throw new Error("Slot not found: "+ye.slot);for(;ge!=Ee;)ve[me++]=ge++;fe[ge+ye.offset]=ge++}for(;ge<he;)ve[me++]=ge++;for(var xe=he-1;xe>=0;xe--)-1==fe[xe]&&(fe[xe]=ve[--me])}le.setFrame(ue++,this.getValue(de,"time",0),fe)}a.push(le),i=Math.max(i,le.frames[le.getFrameCount()-1])}if(t.events){for(var be=new ht(t.events.length),Se=0,Me=0;Me<t.events.length;Me++){var Ae=t.events[Me],Te=n.findEvent(Ae.name);if(null==Te)throw new Error("Event not found: "+Ae.name);var Re=new wt(b.toSinglePrecision(this.getValue(Ae,"time",0)),Te);Re.intValue=this.getValue(Ae,"int",Te.intValue),Re.floatValue=this.getValue(Ae,"float",Te.floatValue),Re.stringValue=this.getValue(Ae,"string",Te.stringValue),null!=Re.data.audioPath&&(Re.volume=this.getValue(Ae,"volume",1),Re.balance=this.getValue(Ae,"balance",0)),be.setFrame(Se++,Re)}a.push(be),i=Math.max(i,be.frames[be.getFrameCount()-1])}if(isNaN(i))throw new Error("Error while parsing animation, duration is NaN");n.animations.push(new K(e,a,i))},e.readCurve=function(t,e,n){if(t.hasOwnProperty("curve"))if("stepped"==t.curve)e.setStepped(n);else{var r=t.curve;e.setCurve(n,r,this.getValue(t,"c2",0),this.getValue(t,"c3",1),this.getValue(t,"c4",1))}},e.getValue=function(t,e,n){return void 0!==t[e]?t[e]:n},t.blendModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return pt.Normal;if("additive"==t)return pt.Additive;if("multiply"==t)return pt.Multiply;if("screen"==t)return pt.Screen;throw new Error("Unknown blend mode: "+t)},t.positionModeFromString=function(t){if("fixed"==(t=t.toLowerCase()))return L.Fixed;if("percent"==t)return L.Percent;throw new Error("Unknown position mode: "+t)},t.spacingModeFromString=function(t){if("length"==(t=t.toLowerCase()))return X.Length;if("fixed"==t)return X.Fixed;if("percent"==t)return X.Percent;throw new Error("Unknown position mode: "+t)},t.rotateModeFromString=function(t){if("tangent"==(t=t.toLowerCase()))return D.Tangent;if("chain"==t)return D.Chain;if("chainscale"==t)return D.ChainScale;throw new Error("Unknown rotate mode: "+t)},t.transformModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return C.Normal;if("onlytranslation"==t)return C.OnlyTranslation;if("norotationorreflection"==t)return C.NoRotationOrReflection;if("noscale"==t)return C.NoScale;if("noscaleorreflection"==t)return C.NoScaleOrReflection;throw new Error("Unknown transform mode: "+t)},t}(),Et=function(t,e,n,r,a){this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritDeform=a};!function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"}(mt||(mt={}));var xt=function(){function t(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}var e=t.prototype;return e.readSkeletonData=function(e){var n=this.scale,r=new B;r.name="";var a=new bt(e);if(r.hash=a.readString(),r.version=a.readString(),"3.8.75"==r.version)throw new Error("Unsupported skeleton data, please export with a newer version of Spine.");r.x=a.readFloat(),r.y=a.readFloat(),r.width=a.readFloat(),r.height=a.readFloat();var i=a.readBoolean();i&&(r.fps=a.readFloat(),r.imagesPath=a.readString(),r.audioPath=a.readString());var s=0;s=a.readInt(!0);for(var o=0;o<s;o++)a.strings.push(a.readString());s=a.readInt(!0);for(var l=0;l<s;l++){var h=a.readString(),u=0==l?null:r.bones[a.readInt(!0)],c=new O(l,h,u);c.rotation=a.readFloat(),c.x=a.readFloat()*n,c.y=a.readFloat()*n,c.scaleX=a.readFloat(),c.scaleY=a.readFloat(),c.shearX=a.readFloat(),c.shearY=a.readFloat(),c.length=a.readFloat()*n,c.transformMode=t.TransformModeValues[a.readInt(!0)],c.skinRequired=a.readBoolean(),i&&E.rgba8888ToColor(c.color,a.readInt32()),r.bones.push(c)}s=a.readInt(!0);for(var d=0;d<s;d++){var f=a.readString(),p=r.bones[a.readInt(!0)],v=new Y(d,f,p);E.rgba8888ToColor(v.color,a.readInt32());var g=a.readInt32();-1!=g&&E.rgb888ToColor(v.darkColor=new E,g),v.attachmentName=a.readStringRef(),v.blendMode=t.BlendModeValues[a.readInt(!0)],r.slots.push(v)}s=a.readInt(!0);for(var m,w=0;w<s;w++){var y=new W(a.readString());y.order=a.readInt(!0),y.skinRequired=a.readBoolean(),m=a.readInt(!0);for(var x=0;x<m;x++)y.bones.push(r.bones[a.readInt(!0)]);y.target=r.bones[a.readInt(!0)],y.mix=a.readFloat(),y.softness=a.readFloat()*n,y.bendDirection=a.readByte(),y.compress=a.readBoolean(),y.stretch=a.readBoolean(),y.uniform=a.readBoolean(),r.ikConstraints.push(y)}s=a.readInt(!0);for(var S,M=0;M<s;M++){var A=new q(a.readString());A.order=a.readInt(!0),A.skinRequired=a.readBoolean(),S=a.readInt(!0);for(var T=0;T<S;T++)A.bones.push(r.bones[a.readInt(!0)]);A.target=r.bones[a.readInt(!0)],A.local=a.readBoolean(),A.relative=a.readBoolean(),A.offsetRotation=a.readFloat(),A.offsetX=a.readFloat()*n,A.offsetY=a.readFloat()*n,A.offsetScaleX=a.readFloat(),A.offsetScaleY=a.readFloat(),A.offsetShearY=a.readFloat(),A.rotateMix=a.readFloat(),A.translateMix=a.readFloat(),A.scaleMix=a.readFloat(),A.shearMix=a.readFloat(),r.transformConstraints.push(A)}s=a.readInt(!0);for(var R,I=0;I<s;I++){var C=new H(a.readString());C.order=a.readInt(!0),C.skinRequired=a.readBoolean(),R=a.readInt(!0);for(var _=0;_<R;_++)C.bones.push(r.bones[a.readInt(!0)]);C.target=r.slots[a.readInt(!0)],C.positionMode=t.PositionModeValues[a.readInt(!0)],C.spacingMode=t.SpacingModeValues[a.readInt(!0)],C.rotateMode=t.RotateModeValues[a.readInt(!0)],C.offsetRotation=a.readFloat(),C.position=a.readFloat(),C.positionMode==L.Fixed&&(C.position*=n),C.spacing=a.readFloat(),C.spacingMode!=X.Length&&C.spacingMode!=X.Fixed||(C.spacing*=n),C.rotateMix=a.readFloat(),C.translateMix=a.readFloat(),r.pathConstraints.push(C)}var k=this.readSkin(a,r,!0,i);null!=k&&(r.defaultSkin=k,r.skins.push(k));var V=r.skins.length;for(b.setArraySize(r.skins,s=V+a.readInt(!0));V<s;V++)r.skins[V]=this.readSkin(a,r,!1,i);s=this.linkedMeshes.length;for(var P=0;P<s;P++){var F=this.linkedMeshes[P],N=null==F.skin?r.defaultSkin:r.findSkin(F.skin);if(null==N)throw new Error("Skin not found: "+F.skin);var D=N.getAttachment(F.slotIndex,F.parent);if(null==D)throw new Error("Parent mesh not found: "+F.parent);F.mesh.deformAttachment=F.inheritDeform?D:F.mesh,F.mesh.setParentMesh(D),F.mesh.updateUVs()}this.linkedMeshes.length=0,s=a.readInt(!0);for(var U=0;U<s;U++){var G=new J(a.readStringRef());G.intValue=a.readInt(!1),G.floatValue=a.readFloat(),G.stringValue=a.readString(),G.audioPath=a.readString(),null!=G.audioPath&&(G.volume=a.readFloat(),G.balance=a.readFloat()),r.events.push(G)}s=a.readInt(!0);for(var j=0;j<s;j++)r.animations.push(this.readAnimation(a,a.readString(),r));return r},e.readSkin=function(t,e,n,r){var a=null,i=0;if(n){if(0==(i=t.readInt(!0)))return null;a=new Q("default")}else{(a=new Q(t.readStringRef())).bones.length=t.readInt(!0);for(var s=0,o=a.bones.length;s<o;s++)a.bones[s]=e.bones[t.readInt(!0)];for(var l=0,h=t.readInt(!0);l<h;l++)a.constraints.push(e.ikConstraints[t.readInt(!0)]);for(var u=0,c=t.readInt(!0);u<c;u++)a.constraints.push(e.transformConstraints[t.readInt(!0)]);for(var d=0,f=t.readInt(!0);d<f;d++)a.constraints.push(e.pathConstraints[t.readInt(!0)]);i=t.readInt(!0)}for(var p=0;p<i;p++)for(var v=t.readInt(!0),g=0,m=t.readInt(!0);g<m;g++){var w=t.readStringRef(),y=this.readAttachment(t,e,a,v,w,r);null!=y&&a.setAttachment(v,w,y)}return a},e.readAttachment=function(e,n,r,a,i,s){var o=this.scale,l=e.readStringRef();null==l&&(l=i);var h=e.readByte();switch(t.AttachmentTypeValues[h]){case mt.Region:var u=e.readStringRef(),c=e.readFloat(),d=e.readFloat(),f=e.readFloat(),p=e.readFloat(),v=e.readFloat(),g=e.readFloat(),m=e.readFloat(),w=e.readInt32();null==u&&(u=l);var y=this.attachmentLoader.newRegionAttachment(r,l,u);return null==y?null:(y.path=u,y.x=d*o,y.y=f*o,y.scaleX=p,y.scaleY=v,y.rotation=c,y.width=g*o,y.height=m*o,E.rgba8888ToColor(y.color,w),y.updateOffset(),y);case mt.BoundingBox:var x=e.readInt(!0),S=this.readVertices(e,x),M=s?e.readInt32():0,A=this.attachmentLoader.newBoundingBoxAttachment(r,l);return null==A?null:(A.worldVerticesLength=x<<1,A.vertices=S.vertices,A.bones=S.bones,s&&E.rgba8888ToColor(A.color,M),A);case mt.Mesh:var T=e.readStringRef(),R=e.readInt32(),I=e.readInt(!0),C=this.readFloatArray(e,I<<1,1),_=this.readShortArray(e),k=this.readVertices(e,I),V=e.readInt(!0),P=null,F=0,N=0;s&&(P=this.readShortArray(e),F=e.readFloat(),N=e.readFloat()),null==T&&(T=l);var B=this.attachmentLoader.newMeshAttachment(r,l,T);return null==B?null:(B.path=T,E.rgba8888ToColor(B.color,R),B.bones=k.bones,B.vertices=k.vertices,B.worldVerticesLength=I<<1,B.triangles=_,B.regionUVs=C,B.updateUVs(),B.hullLength=V<<1,s&&(B.edges=P,B.width=F*o,B.height=N*o),B);case mt.LinkedMesh:var O=e.readStringRef(),L=e.readInt32(),X=e.readStringRef(),D=e.readStringRef(),Y=e.readBoolean(),U=0,W=0;s&&(U=e.readFloat(),W=e.readFloat()),null==O&&(O=l);var q=this.attachmentLoader.newMeshAttachment(r,l,O);return null==q?null:(q.path=O,E.rgba8888ToColor(q.color,L),s&&(q.width=U*o,q.height=W*o),this.linkedMeshes.push(new St(q,X,a,D,Y)),q);case mt.Path:for(var H=e.readBoolean(),G=e.readBoolean(),j=e.readInt(!0),z=this.readVertices(e,j),Z=b.newArray(j/3,0),Q=0,J=Z.length;Q<J;Q++)Z[Q]=e.readFloat()*o;var K=s?e.readInt32():0,$=this.attachmentLoader.newPathAttachment(r,l);return null==$?null:($.closed=H,$.constantSpeed=G,$.worldVerticesLength=j<<1,$.vertices=z.vertices,$.bones=z.bones,$.lengths=Z,s&&E.rgba8888ToColor($.color,K),$);case mt.Point:var tt=e.readFloat(),et=e.readFloat(),nt=e.readFloat(),rt=s?e.readInt32():0,at=this.attachmentLoader.newPointAttachment(r,l);return null==at?null:(at.x=et*o,at.y=nt*o,at.rotation=tt,s&&E.rgba8888ToColor(at.color,rt),at);case mt.Clipping:var it=e.readInt(!0),st=e.readInt(!0),ot=this.readVertices(e,st),lt=s?e.readInt32():0,ht=this.attachmentLoader.newClippingAttachment(r,l);return null==ht?null:(ht.endSlot=n.slots[it],ht.worldVerticesLength=st<<1,ht.vertices=ot.vertices,ht.bones=ot.bones,s&&E.rgba8888ToColor(ht.color,lt),ht)}return null},e.readVertices=function(t,e){var n=e<<1,r=new Mt,a=this.scale;if(!t.readBoolean())return r.vertices=this.readFloatArray(t,n,a),r;for(var i=new Array,s=new Array,o=0;o<e;o++){var l=t.readInt(!0);s.push(l);for(var h=0;h<l;h++)s.push(t.readInt(!0)),i.push(t.readFloat()*a),i.push(t.readFloat()*a),i.push(t.readFloat())}return r.vertices=b.toFloatArray(i),r.bones=s,r},e.readFloatArray=function(t,e,n){var r=new Array(e);if(1==n)for(var a=0;a<e;a++)r[a]=t.readFloat();else for(var i=0;i<e;i++)r[i]=t.readFloat()*n;return r},e.readShortArray=function(t){for(var e=t.readInt(!0),n=new Array(e),r=0;r<e;r++)n[r]=t.readShort();return n},e.readAnimation=function(e,n,r){for(var a=new Array,i=this.scale,s=0,o=new E,l=new E,h=0,u=e.readInt(!0);h<u;h++)for(var c=e.readInt(!0),d=0,f=e.readInt(!0);d<f;d++){var p=e.readByte(),v=e.readInt(!0);switch(p){case t.SLOT_ATTACHMENT:var g=new st(v);g.slotIndex=c;for(var m=0;m<v;m++)g.setFrame(m,e.readFloat(),e.readStringRef());a.push(g),s=Math.max(s,g.frames[v-1]);break;case t.SLOT_COLOR:var w=new at(v);w.slotIndex=c;for(var y=0;y<v;y++){var x=e.readFloat();E.rgba8888ToColor(o,e.readInt32()),w.setFrame(y,x,o.r,o.g,o.b,o.a),y<v-1&&this.readCurve(e,y,w)}a.push(w),s=Math.max(s,w.frames[(v-1)*at.ENTRIES]);break;case t.SLOT_TWO_COLOR:var S=new it(v);S.slotIndex=c;for(var M=0;M<v;M++){var A=e.readFloat();E.rgba8888ToColor(o,e.readInt32()),E.rgb888ToColor(l,e.readInt32()),S.setFrame(M,A,o.r,o.g,o.b,o.a,l.r,l.g,l.b),M<v-1&&this.readCurve(e,M,S)}a.push(S),s=Math.max(s,S.frames[(v-1)*it.ENTRIES])}}for(var T=0,R=e.readInt(!0);T<R;T++)for(var I=e.readInt(!0),C=0,_=e.readInt(!0);C<_;C++){var k=e.readByte(),V=e.readInt(!0);switch(k){case t.BONE_ROTATE:var P=new tt(V);P.boneIndex=I;for(var F=0;F<V;F++)P.setFrame(F,e.readFloat(),e.readFloat()),F<V-1&&this.readCurve(e,F,P);a.push(P),s=Math.max(s,P.frames[(V-1)*tt.ENTRIES]);break;case t.BONE_TRANSLATE:case t.BONE_SCALE:case t.BONE_SHEAR:var N=void 0,B=1;k==t.BONE_SCALE?N=new nt(V):k==t.BONE_SHEAR?N=new rt(V):(N=new et(V),B=i),N.boneIndex=I;for(var O=0;O<V;O++)N.setFrame(O,e.readFloat(),e.readFloat()*B,e.readFloat()*B),O<V-1&&this.readCurve(e,O,N);a.push(N),s=Math.max(s,N.frames[(V-1)*et.ENTRIES])}}for(var D=0,Y=e.readInt(!0);D<Y;D++){var U=e.readInt(!0),W=e.readInt(!0),q=new ct(W);q.ikConstraintIndex=U;for(var H=0;H<W;H++)q.setFrame(H,e.readFloat(),e.readFloat(),e.readFloat()*i,e.readByte(),e.readBoolean(),e.readBoolean()),H<W-1&&this.readCurve(e,H,q);a.push(q),s=Math.max(s,q.frames[(W-1)*ct.ENTRIES])}for(var G=0,j=e.readInt(!0);G<j;G++){var z=e.readInt(!0),Z=e.readInt(!0),Q=new dt(Z);Q.transformConstraintIndex=z;for(var J=0;J<Z;J++)Q.setFrame(J,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat()),J<Z-1&&this.readCurve(e,J,Q);a.push(Q),s=Math.max(s,Q.frames[(Z-1)*dt.ENTRIES])}for(var $=0,ot=e.readInt(!0);$<ot;$++)for(var pt=e.readInt(!0),mt=r.pathConstraints[pt],yt=0,Et=e.readInt(!0);yt<Et;yt++){var xt=e.readByte(),bt=e.readInt(!0);switch(xt){case t.PATH_POSITION:case t.PATH_SPACING:var St=void 0,Mt=1;xt==t.PATH_SPACING?(St=new vt(bt),mt.spacingMode!=X.Length&&mt.spacingMode!=X.Fixed||(Mt=i)):(St=new ft(bt),mt.positionMode==L.Fixed&&(Mt=i)),St.pathConstraintIndex=pt;for(var At=0;At<bt;At++)St.setFrame(At,e.readFloat(),e.readFloat()*Mt),At<bt-1&&this.readCurve(e,At,St);a.push(St),s=Math.max(s,St.frames[(bt-1)*ft.ENTRIES]);break;case t.PATH_MIX:var Tt=new gt(bt);Tt.pathConstraintIndex=pt;for(var Rt=0;Rt<bt;Rt++)Tt.setFrame(Rt,e.readFloat(),e.readFloat(),e.readFloat()),Rt<bt-1&&this.readCurve(e,Rt,Tt);a.push(Tt),s=Math.max(s,Tt.frames[(bt-1)*gt.ENTRIES])}}for(var It=0,Ct=e.readInt(!0);It<Ct;It++)for(var _t=r.skins[e.readInt(!0)],kt=0,Vt=e.readInt(!0);kt<Vt;kt++)for(var Pt=e.readInt(!0),Ft=0,Nt=e.readInt(!0);Ft<Nt;Ft++){var Bt=_t.getAttachment(Pt,e.readStringRef()),Ot=null!=Bt.bones,Lt=Bt.vertices,Xt=Ot?Lt.length/3*2:Lt.length,Dt=e.readInt(!0),Yt=new lt(Dt);Yt.slotIndex=Pt,Yt.attachment=Bt;for(var Ut=0;Ut<Dt;Ut++){var Wt=e.readFloat(),qt=void 0,Ht=e.readInt(!0);if(0==Ht)qt=Ot?b.newFloatArray(Xt):Lt;else{qt=b.newFloatArray(Xt);var Gt=e.readInt(!0);if(Ht+=Gt,1==i)for(var jt=Gt;jt<Ht;jt++)qt[jt]=e.readFloat();else for(var zt=Gt;zt<Ht;zt++)qt[zt]=e.readFloat()*i;if(!Ot)for(var Zt=0,Qt=qt.length;Zt<Qt;Zt++)qt[Zt]+=Lt[Zt]}Yt.setFrame(Ut,Wt,qt),Ut<Dt-1&&this.readCurve(e,Ut,Yt)}a.push(Yt),s=Math.max(s,Yt.frames[Dt-1])}var Jt=e.readInt(!0);if(Jt>0){for(var Kt=new ut(Jt),$t=r.slots.length,te=0;te<Jt;te++){for(var ee=e.readFloat(),ne=e.readInt(!0),re=b.newArray($t,0),ae=$t-1;ae>=0;ae--)re[ae]=-1;for(var ie=b.newArray($t-ne,0),se=0,oe=0,le=0;le<ne;le++){for(var he=e.readInt(!0);se!=he;)ie[oe++]=se++;re[se+e.readInt(!0)]=se++}for(;se<$t;)ie[oe++]=se++;for(var ue=$t-1;ue>=0;ue--)-1==re[ue]&&(re[ue]=ie[--oe]);Kt.setFrame(te,ee,re)}a.push(Kt),s=Math.max(s,Kt.frames[Jt-1])}var ce=e.readInt(!0);if(ce>0){for(var de=new ht(ce),fe=0;fe<ce;fe++){var pe=e.readFloat(),ve=r.events[e.readInt(!0)],ge=new wt(pe,ve);ge.intValue=e.readInt(!1),ge.floatValue=e.readFloat(),ge.stringValue=e.readBoolean()?e.readString():ve.stringValue,null!=ge.data.audioPath&&(ge.volume=e.readFloat(),ge.balance=e.readFloat()),de.setFrame(fe,ge)}a.push(de),s=Math.max(s,de.frames[ce-1])}return new K(n,a,s)},e.readCurve=function(e,n,r){switch(e.readByte()){case t.CURVE_STEPPED:r.setStepped(n);break;case t.CURVE_BEZIER:this.setCurve(r,n,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat())}},e.setCurve=function(t,e,n,r,a,i){t.setCurve(e,n,r,a,i)},t}();xt.AttachmentTypeValues=[0,1,2,3,4,5,6],xt.TransformModeValues=[C.Normal,C.OnlyTranslation,C.NoRotationOrReflection,C.NoScale,C.NoScaleOrReflection],xt.PositionModeValues=[L.Fixed,L.Percent],xt.SpacingModeValues=[X.Length,X.Fixed,X.Percent],xt.RotateModeValues=[D.Tangent,D.Chain,D.ChainScale],xt.BlendModeValues=[pt.Normal,pt.Additive,pt.Multiply,pt.Screen],xt.BONE_ROTATE=0,xt.BONE_TRANSLATE=1,xt.BONE_SCALE=2,xt.BONE_SHEAR=3,xt.SLOT_ATTACHMENT=0,xt.SLOT_COLOR=1,xt.SLOT_TWO_COLOR=2,xt.PATH_POSITION=0,xt.PATH_SPACING=1,xt.PATH_MIX=2,xt.CURVE_LINEAR=0,xt.CURVE_STEPPED=1,xt.CURVE_BEZIER=2;var bt=function(){function t(t,e,n,r){void 0===e&&(e=new Array),void 0===n&&(n=0),void 0===r&&(r=new DataView(t.buffer)),this.strings=e,this.index=n,this.buffer=r}var e=t.prototype;return e.readByte=function(){return this.buffer.getInt8(this.index++)},e.readShort=function(){var t=this.buffer.getInt16(this.index);return this.index+=2,t},e.readInt32=function(){var t=this.buffer.getInt32(this.index);return this.index+=4,t},e.readInt=function(t){var e=this.readByte(),n=127&e;return 128&e&&(n|=(127&(e=this.readByte()))<<7,128&e&&(n|=(127&(e=this.readByte()))<<14,128&e&&(n|=(127&(e=this.readByte()))<<21,128&e&&(n|=(127&(e=this.readByte()))<<28)))),t?n:n>>>1^-(1&n)},e.readStringRef=function(){var t=this.readInt(!0);return 0==t?null:this.strings[t-1]},e.readString=function(){var t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;for(var e="",n=0;n<t;){var r=this.readByte();switch(r>>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},e.readFloat=function(){var t=this.buffer.getFloat32(this.index);return this.index+=4,t},e.readBoolean=function(){return 0!=this.readByte()},t}(),St=function(t,e,n,r,a){this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritDeform=a},Mt=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e};function At(){return At=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},At.apply(this,arguments)}var Tt=function(){function t(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()}var e=t.prototype;return e.isActive=function(){return this.active},e.update=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.updateWorldTransform=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.updateWorldTransformWith=function(t,e,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,this.appliedValid=!0;var o=this.parent;if(null==o){var l=this.skeleton,h=n+90+s,u=l.scaleX,c=l.scaleY;return this.a=x.cosDeg(n+i)*r*u,this.b=x.cosDeg(h)*a*u,this.c=x.sinDeg(n+i)*r*c,this.d=x.sinDeg(h)*a*c,this.worldX=t*u+l.x,void(this.worldY=e*c+l.y)}var d=o.a,f=o.b,p=o.c,v=o.d;switch(this.worldX=d*t+f*e+o.worldX,this.worldY=p*t+v*e+o.worldY,this.data.transformMode){case C.Normal:var g=n+90+s,m=x.cosDeg(n+i)*r,w=x.cosDeg(g)*a,y=x.sinDeg(n+i)*r,E=x.sinDeg(g)*a;return this.a=d*m+f*y,this.b=d*w+f*E,this.c=p*m+v*y,void(this.d=p*w+v*E);case C.OnlyTranslation:var b=n+90+s;this.a=x.cosDeg(n+i)*r,this.b=x.cosDeg(b)*a,this.c=x.sinDeg(n+i)*r,this.d=x.sinDeg(b)*a;break;case C.NoRotationOrReflection:var S=d*d+p*p,M=0;S>1e-4?(S=Math.abs(d*v-f*p)/S,d/=this.skeleton.scaleX,f=(p/=this.skeleton.scaleY)*S,v=d*S,M=Math.atan2(p,d)*x.radDeg):(d=0,p=0,M=90-Math.atan2(v,f)*x.radDeg);var A=n+i-M,T=n+s-M+90,R=x.cosDeg(A)*r,I=x.cosDeg(T)*a,_=x.sinDeg(A)*r,k=x.sinDeg(T)*a;this.a=d*R-f*_,this.b=d*I-f*k,this.c=p*R+v*_,this.d=p*I+v*k;break;case C.NoScale:case C.NoScaleOrReflection:var V=x.cosDeg(n),P=x.sinDeg(n),F=(d*V+f*P)/this.skeleton.scaleX,N=(p*V+v*P)/this.skeleton.scaleY,B=Math.sqrt(F*F+N*N);B>1e-5&&(B=1/B),F*=B,N*=B,B=Math.sqrt(F*F+N*N),this.data.transformMode==C.NoScale&&d*v-f*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(B=-B);var O=Math.PI/2+Math.atan2(N,F),L=Math.cos(O)*B,X=Math.sin(O)*B,D=x.cosDeg(i)*r,Y=x.cosDeg(90+s)*a,U=x.sinDeg(i)*r,W=x.sinDeg(90+s)*a;this.a=F*D+L*U,this.b=F*Y+L*W,this.c=N*D+X*U,this.d=N*Y+X*W}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY},e.setToSetupPose=function(){var t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY},e.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*x.radDeg},e.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*x.radDeg},e.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)},e.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)},e.updateAppliedTransform=function(){this.appliedValid=!0;var t=this.parent;if(null==t)return this.ax=this.worldX,this.ay=this.worldY,this.arotation=Math.atan2(this.c,this.a)*x.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,void(this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*x.radDeg);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 l=i*a,h=i*e,u=i*n,c=i*r,d=l*this.a-u*this.c,f=l*this.b-u*this.d,p=h*this.c-c*this.a,v=h*this.d-c*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+p*p),this.ascaleX>1e-4){var g=d*v-f*p;this.ascaleY=g/this.ascaleX,this.ashearY=Math.atan2(d*f+p*v,g)*x.radDeg,this.arotation=Math.atan2(p,d)*x.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+v*v),this.ashearY=0,this.arotation=90-Math.atan2(v,f)*x.radDeg},e.worldToLocal=function(t){var e=this.a,n=this.b,r=this.c,a=this.d,i=1/(e*a-n*r),s=t.x-this.worldX,o=t.y-this.worldY;return t.x=s*a*i-o*n*i,t.y=o*e*i-s*r*i,t},e.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.worldToLocalRotation=function(t){var e=x.sinDeg(t),n=x.cosDeg(t);return Math.atan2(this.a*e-this.c*n,this.d*n-this.b*e)*x.radDeg+this.rotation-this.shearX},e.localToWorldRotation=function(t){t-=this.rotation-this.shearX;var e=x.sinDeg(t),n=x.cosDeg(t);return Math.atan2(n*this.c+e*this.d,n*this.a+e*this.b)*x.radDeg},e.rotateWorld=function(t){var e=this.a,n=this.b,r=this.c,a=this.d,i=x.cosDeg(t),s=x.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,this.appliedValid=!1},t}(),Rt=function(){function t(t,e){if(this.deform=new Array,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new E,this.darkColor=null==t.darkColor?null:new E,this.setToSetupPose()}var e=t.prototype;return e.getSkeleton=function(){return this.bone.skeleton},e.getAttachment=function(){return this.attachment},e.setAttachment=function(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.deform.length=0)},e.setAttachmentTime=function(t){this.attachmentTime=this.bone.skeleton.time-t},e.getAttachmentTime=function(){return this.bone.skeleton.time-this.attachmentTime},e.setToSetupPose=function(){this.color.setFromColor(this.data.color),null!=this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),null==this.data.attachmentName?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))},t}(),It=function(){function t(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(var n=0;n<t.bones.length;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findBone(t.target.name)}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){var t=this.target,e=this.bones;switch(e.length){case 1:this.apply1(e[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.softness,this.mix)}},e.apply1=function(t,e,n,r,a,i,s){t.appliedValid||t.updateAppliedTransform();var o=t.parent,l=o.a,h=o.b,u=o.c,c=o.d,d=-t.ashearX-t.arotation,f=0,p=0;switch(t.data.transformMode){case C.OnlyTranslation:f=e-t.worldX,p=n-t.worldY;break;case C.NoRotationOrReflection:var v=Math.abs(l*c-h*u)/(l*l+u*u),g=l/t.skeleton.scaleX,m=u/t.skeleton.scaleY;h=-m*v*t.skeleton.scaleX,c=g*v*t.skeleton.scaleY,d+=Math.atan2(m,g)*x.radDeg;default:var w=e-o.worldX,y=n-o.worldY,E=l*c-h*u;f=(w*c-y*h)/E-t.ax,p=(y*l-w*u)/E-t.ay}d+=Math.atan2(p,f)*x.radDeg,t.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);var b=t.ascaleX,S=t.ascaleY;if(r||a){switch(t.data.transformMode){case C.NoScale:case C.NoScaleOrReflection:f=e-t.worldX,p=n-t.worldY}var M=t.data.length*b,A=Math.sqrt(f*f+p*p);if(r&&A<M||a&&A>M&&M>1e-4){var T=(A/M-1)*s+1;b*=T,i&&(S*=T)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+d*s,b,S,t.ashearX,t.ashearY)},e.apply2=function(t,e,n,r,a,i,s,o){if(0!=o){t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();var l=t.ax,h=t.ay,u=t.ascaleX,c=u,d=t.ascaleY,f=e.ascaleX,p=0,v=0,g=0;u<0?(u=-u,p=180,g=-1):(p=0,g=1),d<0&&(d=-d,g=-g),f<0?(f=-f,v=180):v=0;var m=e.ax,w=0,y=0,E=0,b=t.a,S=t.b,M=t.c,A=t.d,T=Math.abs(u-d)<=1e-4;T?(y=b*m+S*(w=e.ay)+t.worldX,E=M*m+A*w+t.worldY):(w=0,y=b*m+t.worldX,E=M*m+t.worldY);var R=t.parent;b=R.a,S=R.b,M=R.c;var I,C,_=1/(b*(A=R.d)-S*M),k=y-R.worldX,V=E-R.worldY,P=(k*A-V*S)*_-l,F=(V*b-k*M)*_-h,N=Math.sqrt(P*P+F*F),B=e.data.length*f;if(N<1e-4)return this.apply1(t,n,r,!1,i,!1,o),void e.updateWorldTransformWith(m,w,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);var O=((k=n-R.worldX)*A-(V=r-R.worldY)*S)*_-l,L=(V*b-k*M)*_-h,X=O*O+L*L;if(0!=s){s*=u*(f+1)/2;var D=Math.sqrt(X),Y=D-N-B*u+s;if(Y>0){var U=Math.min(1,Y/(2*s))-1;X=(O-=(U=(Y-s*(1-U*U))/D)*O)*O+(L-=U*L)*L}}t:if(T){var W=(X-N*N-(B*=u)*B)/(2*N*B);W<-1?W=-1:W>1&&(W=1,i&&(c*=(Math.sqrt(X)/(N+B)-1)*o+1)),C=Math.acos(W)*a,b=N+B*W,S=B*Math.sin(C),I=Math.atan2(L*b-O*S,O*b+L*S)}else{var q=(b=u*B)*b,H=(S=d*B)*S,G=Math.atan2(L,O),j=-2*H*N,z=H-q;if((A=j*j-4*z*(M=H*N*N+q*X-q*H))>=0){var Z=Math.sqrt(A);j<0&&(Z=-Z);var Q=(Z=-(j+Z)/2)/z,J=M/Z,K=Math.abs(Q)<Math.abs(J)?Q:J;if(K*K<=X){V=Math.sqrt(X-K*K)*a,I=G-Math.atan2(V,K),C=Math.atan2(V/d,(K-N)/u);break t}}var $=x.PI,tt=N-b,et=tt*tt,nt=0,rt=0,at=N+b,it=at*at,st=0;(M=-b*N/(q-H))>=-1&&M<=1&&(M=Math.acos(M),(A=(k=b*Math.cos(M)+N)*k+(V=S*Math.sin(M))*V)<et&&($=M,et=A,tt=k,nt=V),A>it&&(rt=M,it=A,at=k,st=V)),X<=(et+it)/2?(I=G-Math.atan2(nt*a,tt),C=$*a):(I=G-Math.atan2(st*a,at),C=rt*a)}var ot=Math.atan2(w,m)*g,lt=t.arotation;(I=(I-ot)*x.radDeg+p-lt)>180?I-=360:I<-180&&(I+=360),t.updateWorldTransformWith(l,h,lt+I*o,c,t.ascaleY,0,0),lt=e.arotation,(C=((C+ot)*x.radDeg-e.ashearX)*g+v-lt)>180?C-=360:C<-180&&(C+=360),e.updateWorldTransformWith(m,w,lt+C*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}else e.updateWorldTransform()},t}(),Ct=function(){function t(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new M,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(var n=0;n<t.bones.length;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findBone(t.target.name)}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld()},e.applyAbsoluteWorld=function(){for(var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target,i=a.a,s=a.b,o=a.c,l=a.d,h=i*l-s*o>0?x.degRad:-x.degRad,u=this.data.offsetRotation*h,c=this.data.offsetShearY*h,d=this.bones,f=0,p=d.length;f<p;f++){var v=d[f],g=!1;if(0!=t){var m=v.a,w=v.b,y=v.c,E=v.d,b=Math.atan2(o,i)-Math.atan2(y,m)+u;b>x.PI?b-=x.PI2:b<-x.PI&&(b+=x.PI2),b*=t;var S=Math.cos(b),M=Math.sin(b);v.a=S*m-M*y,v.b=S*w-M*E,v.c=M*m+S*y,v.d=M*w+S*E,g=!0}if(0!=e){var A=this.temp;a.localToWorld(A.set(this.data.offsetX,this.data.offsetY)),v.worldX+=(A.x-v.worldX)*e,v.worldY+=(A.y-v.worldY)*e,g=!0}if(n>0){var T=Math.sqrt(v.a*v.a+v.c*v.c),R=Math.sqrt(i*i+o*o);T>1e-5&&(T=(T+(R-T+this.data.offsetScaleX)*n)/T),v.a*=T,v.c*=T,T=Math.sqrt(v.b*v.b+v.d*v.d),R=Math.sqrt(s*s+l*l),T>1e-5&&(T=(T+(R-T+this.data.offsetScaleY)*n)/T),v.b*=T,v.d*=T,g=!0}if(r>0){var I=v.b,C=v.d,_=Math.atan2(C,I),k=Math.atan2(l,s)-Math.atan2(o,i)-(_-Math.atan2(v.c,v.a));k>x.PI?k-=x.PI2:k<-x.PI&&(k+=x.PI2),k=_+(k+c)*r;var V=Math.sqrt(I*I+C*C);v.b=Math.cos(k)*V,v.d=Math.sin(k)*V,g=!0}g&&(v.appliedValid=!1)}},e.applyRelativeWorld=function(){for(var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target,i=a.a,s=a.b,o=a.c,l=a.d,h=i*l-s*o>0?x.degRad:-x.degRad,u=this.data.offsetRotation*h,c=this.data.offsetShearY*h,d=this.bones,f=0,p=d.length;f<p;f++){var v=d[f],g=!1;if(0!=t){var m=v.a,w=v.b,y=v.c,E=v.d,b=Math.atan2(o,i)+u;b>x.PI?b-=x.PI2:b<-x.PI&&(b+=x.PI2),b*=t;var S=Math.cos(b),M=Math.sin(b);v.a=S*m-M*y,v.b=S*w-M*E,v.c=M*m+S*y,v.d=M*w+S*E,g=!0}if(0!=e){var A=this.temp;a.localToWorld(A.set(this.data.offsetX,this.data.offsetY)),v.worldX+=A.x*e,v.worldY+=A.y*e,g=!0}if(n>0){var T=(Math.sqrt(i*i+o*o)-1+this.data.offsetScaleX)*n+1;v.a*=T,v.c*=T,T=(Math.sqrt(s*s+l*l)-1+this.data.offsetScaleY)*n+1,v.b*=T,v.d*=T,g=!0}if(r>0){var R=Math.atan2(l,s)-Math.atan2(o,i);R>x.PI?R-=x.PI2:R<-x.PI&&(R+=x.PI2);var I=v.b,C=v.d;R=Math.atan2(C,I)+(R-x.PI/2+c)*r;var _=Math.sqrt(I*I+C*C);v.b=Math.cos(R)*_,v.d=Math.sin(R)*_,g=!0}g&&(v.appliedValid=!1)}},e.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,s=0,o=i.length;s<o;s++){var l=i[s];l.appliedValid||l.updateAppliedTransform();var h=l.arotation;if(0!=t){var u=a.arotation-h+this.data.offsetRotation;h+=(u-=360*(16384-(16384.499999999996-u/360|0)))*t}var c=l.ax,d=l.ay;0!=e&&(c+=(a.ax-c+this.data.offsetX)*e,d+=(a.ay-d+this.data.offsetY)*e);var f=l.ascaleX,p=l.ascaleY;0!=n&&(f>1e-5&&(f=(f+(a.ascaleX-f+this.data.offsetScaleX)*n)/f),p>1e-5&&(p=(p+(a.ascaleY-p+this.data.offsetScaleY)*n)/p));var v=l.ashearY;if(0!=r){var g=a.ashearY-v+this.data.offsetShearY;g-=360*(16384-(16384.499999999996-g/360|0)),l.shearY+=g*r}l.updateWorldTransformWith(c,d,h,f,p,l.ashearX,v)}},e.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,s=0,o=i.length;s<o;s++){var l=i[s];l.appliedValid||l.updateAppliedTransform();var h=l.arotation;0!=t&&(h+=(a.arotation+this.data.offsetRotation)*t);var u=l.ax,c=l.ay;0!=e&&(u+=(a.ax+this.data.offsetX)*e,c+=(a.ay+this.data.offsetY)*e);var d=l.ascaleX,f=l.ascaleY;0!=n&&(d>1e-5&&(d*=(a.ascaleX-1+this.data.offsetScaleX)*n+1),f>1e-5&&(f*=(a.ascaleY-1+this.data.offsetScaleY)*n+1));var p=l.ashearY;0!=r&&(p+=(a.ashearY+this.data.offsetShearY)*r),l.updateWorldTransformWith(u,c,h,d,f,l.ashearX,p)}},t}(),_t=function(){function t(t,e){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(var n=0,r=t.bones.length;n<r;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findSlot(t.target.name),this.position=t.position,this.spacing=t.spacing,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){var e=this.target.getAttachment();if(I(e,V)){var n=this.rotateMix,r=this.translateMix,a=n>0;if(r>0||a){var i=this.data,s=i.spacingMode==X.Percent,o=i.rotateMode,l=o==D.Tangent,h=o==D.ChainScale,u=this.bones.length,c=l?u:u+1,d=this.bones,f=b.setArraySize(this.spaces,c),p=null,v=this.spacing;if(h||!s){h&&(p=b.setArraySize(this.lengths,u));for(var g=i.spacingMode==X.Length,m=0,w=c-1;m<w;){var y=d[m],E=y.data.length;if(E<t.epsilon)h&&(p[m]=0),f[++m]=0;else if(s){if(h){var S=E*y.a,M=E*y.c,A=Math.sqrt(S*S+M*M);p[m]=A}f[++m]=v}else{var T=E*y.a,R=E*y.c,C=Math.sqrt(T*T+R*R);h&&(p[m]=C),f[++m]=(g?E+v:v)*C/E}}}else for(var _=1;_<c;_++)f[_]=v;var k=this.computeWorldPositions(e,c,l,i.positionMode==L.Percent,s),P=k[0],F=k[1],N=i.offsetRotation,B=!1;if(0==N)B=o==D.Chain;else{B=!1;var O=this.target.bone;N*=O.a*O.d-O.b*O.c>0?x.degRad:-x.degRad}for(var Y=0,U=3;Y<u;Y++,U+=3){var W=d[Y];W.worldX+=(P-W.worldX)*r,W.worldY+=(F-W.worldY)*r;var q=k[U],H=k[U+1],G=q-P,j=H-F;if(h){var z=p[Y];if(0!=z){var Z=(Math.sqrt(G*G+j*j)/z-1)*n+1;W.a*=Z,W.c*=Z}}if(P=q,F=H,a){var Q=W.a,J=W.b,K=W.c,$=W.d,tt=0,et=0,nt=0;if(tt=l?k[U-1]:0==f[Y+1]?k[U+2]:Math.atan2(j,G),tt-=Math.atan2(K,Q),B){et=Math.cos(tt),nt=Math.sin(tt);var rt=W.data.length;P+=(rt*(et*Q-nt*K)-G)*n,F+=(rt*(nt*Q+et*K)-j)*n}else tt+=N;tt>x.PI?tt-=x.PI2:tt<-x.PI&&(tt+=x.PI2),tt*=n,et=Math.cos(tt),nt=Math.sin(tt),W.a=et*Q-nt*K,W.b=et*J-nt*$,W.c=nt*Q+et*K,W.d=nt*J+et*$}W.appliedValid=!1}}}},e.computeWorldPositions=function(e,n,r,a,i){var s=this.target,o=this.position,l=this.spaces,h=b.setArraySize(this.positions,3*n+2),u=null,c=e.closed,d=e.worldVerticesLength,f=d/6,p=t.NONE;if(!e.constantSpeed){var v=e.lengths,g=v[f-=c?1:2];if(a&&(o*=g),i)for(var m=1;m<n;m++)l[m]*=g;u=b.setArraySize(this.world,8);for(var w=0,y=0,E=0;w<n;w++,y+=3){var x=l[w],S=o+=x;if(c)(S%=g)<0&&(S+=g),E=0;else{if(S<0){p!=t.BEFORE&&(p=t.BEFORE,e.computeWorldVertices(s,2,4,u,0,2)),this.addBeforePosition(S,u,0,h,y);continue}if(S>g){p!=t.AFTER&&(p=t.AFTER,e.computeWorldVertices(s,d-6,4,u,0,2)),this.addAfterPosition(S-g,u,0,h,y);continue}}for(;;E++){var M=v[E];if(!(S>M)){if(0==E)S/=M;else{var A=v[E-1];S=(S-A)/(M-A)}break}}E!=p&&(p=E,c&&E==f?(e.computeWorldVertices(s,d-4,4,u,0,2),e.computeWorldVertices(s,0,4,u,4,2)):e.computeWorldVertices(s,6*E+2,8,u,0,2)),this.addCurvePosition(S,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],h,y,r||w>0&&0==x)}return h}c?(d+=2,u=b.setArraySize(this.world,d),e.computeWorldVertices(s,2,d-4,u,0,2),e.computeWorldVertices(s,0,2,u,d-4,2),u[d-2]=u[0],u[d-1]=u[1]):(f--,d-=4,u=b.setArraySize(this.world,d),e.computeWorldVertices(s,2,d,u,0,2));for(var T=b.setArraySize(this.curves,f),R=0,I=u[0],C=u[1],_=0,k=0,V=0,P=0,F=0,N=0,B=0,O=0,L=0,X=0,D=0,Y=0,U=0,W=0,q=0,H=2;q<f;q++,H+=6)_=u[H],k=u[H+1],V=u[H+2],P=u[H+3],D=2*(B=.1875*(I-2*_+V))+(L=.09375*(3*(_-V)-I+(F=u[H+4]))),Y=2*(O=.1875*(C-2*k+P))+(X=.09375*(3*(k-P)-C+(N=u[H+5]))),U=.75*(_-I)+B+.16666667*L,W=.75*(k-C)+O+.16666667*X,R+=Math.sqrt(U*U+W*W),U+=D,W+=Y,D+=L,Y+=X,R+=Math.sqrt(U*U+W*W),U+=D,W+=Y,R+=Math.sqrt(U*U+W*W),U+=D+L,W+=Y+X,R+=Math.sqrt(U*U+W*W),T[q]=R,I=F,C=N;if(o*=a?R:R/e.lengths[f-1],i)for(var G=1;G<n;G++)l[G]*=R;for(var j=this.segments,z=0,Z=0,Q=0,J=0,K=0;Z<n;Z++,Q+=3){var $=l[Z],tt=o+=$;if(c)(tt%=R)<0&&(tt+=R),J=0;else{if(tt<0){this.addBeforePosition(tt,u,0,h,Q);continue}if(tt>R){this.addAfterPosition(tt-R,u,d-4,h,Q);continue}}for(;;J++){var et=T[J];if(!(tt>et)){if(0==J)tt/=et;else{var nt=T[J-1];tt=(tt-nt)/(et-nt)}break}}if(J!=p){p=J;var rt=6*J;for(I=u[rt],C=u[rt+1],_=u[rt+2],k=u[rt+3],V=u[rt+4],P=u[rt+5],D=2*(B=.03*(I-2*_+V))+(L=.006*(3*(_-V)-I+(F=u[rt+6]))),Y=2*(O=.03*(C-2*k+P))+(X=.006*(3*(k-P)-C+(N=u[rt+7]))),U=.3*(_-I)+B+.16666667*L,W=.3*(k-C)+O+.16666667*X,z=Math.sqrt(U*U+W*W),j[0]=z,rt=1;rt<8;rt++)U+=D,W+=Y,D+=L,Y+=X,z+=Math.sqrt(U*U+W*W),j[rt]=z;U+=D,W+=Y,z+=Math.sqrt(U*U+W*W),j[8]=z,U+=D+L,W+=Y+X,z+=Math.sqrt(U*U+W*W),j[9]=z,K=0}for(tt*=z;;K++){var at=j[K];if(!(tt>at)){if(0==K)tt/=at;else{var it=j[K-1];tt=K+(tt-it)/(at-it)}break}}this.addCurvePosition(.1*tt,I,C,_,k,V,P,F,N,h,Q,r||Z>0&&0==$)}return h},e.addBeforePosition=function(t,e,n,r,a){var i=e[n],s=e[n+1],o=e[n+2]-i,l=e[n+3]-s,h=Math.atan2(l,o);r[a]=i+t*Math.cos(h),r[a+1]=s+t*Math.sin(h),r[a+2]=h},e.addAfterPosition=function(t,e,n,r,a){var i=e[n+2],s=e[n+3],o=i-e[n],l=s-e[n+1],h=Math.atan2(l,o);r[a]=i+t*Math.cos(h),r[a+1]=s+t*Math.sin(h),r[a+2]=h},e.addCurvePosition=function(t,e,n,r,a,i,s,o,l,h,u,c){if(0==t||isNaN(t))return h[u]=e,h[u+1]=n,void(h[u+2]=Math.atan2(a-n,r-e));var d=t*t,f=d*t,p=1-t,v=p*p,g=v*p,m=p*t,w=3*m,y=p*w,E=w*t,x=e*g+r*y+i*E+o*f,b=n*g+a*y+s*E+l*f;h[u]=x,h[u+1]=b,c&&(h[u+2]=t<.001?Math.atan2(a-n,r-e):Math.atan2(b-(n*v+a*m*2+s*d),x-(e*v+r*m*2+i*d)))},t}();_t.NONE=-1,_t.BEFORE=-2,_t.AFTER=-3,_t.epsilon=1e-5;var kt=function(){function t(t){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,null==t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(var e=0;e<t.bones.length;e++){var n=t.bones[e],r=void 0;if(null==n.parent)r=new Tt(n,this,null);else{var a=this.bones[n.parent.index];r=new Tt(n,this,a),a.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(var i=0;i<t.slots.length;i++){var s=t.slots[i],o=this.bones[s.boneData.index],l=new Rt(s,o);this.slots.push(l),this.drawOrder.push(l)}this.ikConstraints=new Array;for(var h=0;h<t.ikConstraints.length;h++){var u=t.ikConstraints[h];this.ikConstraints.push(new It(u,this))}this.transformConstraints=new Array;for(var c=0;c<t.transformConstraints.length;c++){var d=t.transformConstraints[c];this.transformConstraints.push(new Ct(d,this))}this.pathConstraints=new Array;for(var f=0;f<t.pathConstraints.length;f++){var p=t.pathConstraints[f];this.pathConstraints.push(new _t(p,this))}this.color=new E(1,1,1,1),this.updateCache()}var e=t.prototype;return e.updateCache=function(){var t=this._updateCache;t.length=0,this.updateCacheReset.length=0;for(var e=this.bones,n=0,r=e.length;n<r;n++){var a=e[n];a.sorted=a.data.skinRequired,a.active=!a.sorted}if(null!=this.skin)for(var i=this.skin.bones,s=0,o=this.skin.bones.length;s<o;s++){var l=this.bones[i[s].index];do{l.sorted=!1,l.active=!0,l=l.parent}while(null!=l)}var h=this.ikConstraints,u=this.transformConstraints,c=this.pathConstraints,d=h.length,f=u.length,p=c.length,v=d+f+p;t:for(var g=0;g<v;g++){for(var m=0;m<d;m++){var w=h[m];if(w.data.order==g){this.sortIkConstraint(w);continue t}}for(var y=0;y<f;y++){var E=u[y];if(E.data.order==g){this.sortTransformConstraint(E);continue t}}for(var x=0;x<p;x++){var b=c[x];if(b.data.order==g){this.sortPathConstraint(b);continue t}}}for(var S=0,M=e.length;S<M;S++)this.sortBone(e[S])},e.sortIkConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||null!=this.skin&&b.contains(this.skin.constraints,t.data,!0)),t.active){var e=t.target;this.sortBone(e);var n=t.bones,r=n[0];if(this.sortBone(r),n.length>1){var a=n[n.length-1];this._updateCache.indexOf(a)>-1||this.updateCacheReset.push(a)}this._updateCache.push(t),this.sortReset(r.children),n[n.length-1].sorted=!0}},e.sortPathConstraint=function(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||null!=this.skin&&b.contains(this.skin.constraints,t.data,!0)),t.active){var e=t.target,n=e.data.index,r=e.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,n,r),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,n,r);for(var a=0,i=this.data.skins.length;a<i;a++)this.sortPathConstraintAttachment(this.data.skins[a],n,r);var s=e.getAttachment();I(s,V)&&this.sortPathConstraintAttachmentWith(s,r);for(var o=t.bones,l=o.length,h=0;h<l;h++)this.sortBone(o[h]);this._updateCache.push(t);for(var u=0;u<l;u++)this.sortReset(o[u].children);for(var c=0;c<l;c++)o[c].sorted=!0}},e.sortTransformConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||null!=this.skin&&b.contains(this.skin.constraints,t.data,!0)),t.active){this.sortBone(t.target);var e=t.bones,n=e.length;if(t.data.local)for(var r=0;r<n;r++){var a=e[r];this.sortBone(a.parent),this._updateCache.indexOf(a)>-1||this.updateCacheReset.push(a)}else for(var i=0;i<n;i++)this.sortBone(e[i]);this._updateCache.push(t);for(var s=0;s<n;s++)this.sortReset(e[s].children);for(var o=0;o<n;o++)e[o].sorted=!0}},e.sortPathConstraintAttachment=function(t,e,n){var r=t.attachments[e];if(r)for(var a in r)this.sortPathConstraintAttachmentWith(r[a],n)},e.sortPathConstraintAttachmentWith=function(t,e){if(I(t,V)){var n=t.bones;if(null==n)this.sortBone(e);else for(var r=this.bones,a=0;a<n.length;)for(var i=n[a++],s=a+i;a<s;a++){var o=n[a];this.sortBone(r[o])}}},e.sortBone=function(t){if(!t.sorted){var e=t.parent;null!=e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}},e.sortReset=function(t){for(var e=0,n=t.length;e<n;e++){var r=t[e];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}},e.updateWorldTransform=function(){for(var t=this.updateCacheReset,e=0,n=t.length;e<n;e++){var r=t[e];r.ax=r.x,r.ay=r.y,r.arotation=r.rotation,r.ascaleX=r.scaleX,r.ascaleY=r.scaleY,r.ashearX=r.shearX,r.ashearY=r.shearY,r.appliedValid=!0}for(var a=this._updateCache,i=0,s=a.length;i<s;i++)a[i].update()},e.setToSetupPose=function(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()},e.setBonesToSetupPose=function(){for(var t=this.bones,e=0,n=t.length;e<n;e++)t[e].setToSetupPose();for(var r=this.ikConstraints,a=0,i=r.length;a<i;a++){var s=r[a];s.mix=s.data.mix,s.softness=s.data.softness,s.bendDirection=s.data.bendDirection,s.compress=s.data.compress,s.stretch=s.data.stretch}for(var o=this.transformConstraints,l=0,h=o.length;l<h;l++){var u=o[l],c=u.data;u.rotateMix=c.rotateMix,u.translateMix=c.translateMix,u.scaleMix=c.scaleMix,u.shearMix=c.shearMix}for(var d=this.pathConstraints,f=0,p=d.length;f<p;f++){var v=d[f],g=v.data;v.position=g.position,v.spacing=g.spacing,v.rotateMix=g.rotateMix,v.translateMix=g.translateMix}},e.setSlotsToSetupPose=function(){var t=this.slots;b.arrayCopy(t,0,this.drawOrder,0,t.length);for(var e=0,n=t.length;e<n;e++)t[e].setToSetupPose()},e.getRootBone=function(){return 0==this.bones.length?null:this.bones[0]},e.findBone=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.findBoneIndex=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,n=0,r=e.length;n<r;n++)if(e[n].data.name==t)return n;return-1},e.findSlot=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.findSlotIndex=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,n=0,r=e.length;n<r;n++)if(e[n].data.name==t)return n;return-1},e.setSkinByName=function(t){var e=this.data.findSkin(t);if(null==e)throw new Error("Skin not found: "+t);this.setSkin(e)},e.setSkin=function(t){if(t!=this.skin){if(null!=t)if(null!=this.skin)t.attachAll(this,this.skin);else for(var e=this.slots,n=0,r=e.length;n<r;n++){var a=e[n],i=a.data.attachmentName;if(null!=i){var s=t.getAttachment(n,i);null!=s&&a.setAttachment(s)}}this.skin=t,this.updateCache()}},e.getAttachmentByName=function(t,e){return this.getAttachment(this.data.findSlotIndex(t),e)},e.getAttachment=function(t,e){if(null==e)throw new Error("attachmentName cannot be null.");if(null!=this.skin){var n=this.skin.getAttachment(t,e);if(null!=n)return n}return null!=this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null},e.setAttachment=function(t,e){if(null==t)throw new Error("slotName cannot be null.");for(var n=this.slots,r=0,a=n.length;r<a;r++){var i=n[r];if(i.data.name==t){var s=null;if(null!=e&&null==(s=this.getAttachment(r,e)))throw new Error("Attachment not found: "+e+", for slot: "+t);return void i.setAttachment(s)}}throw new Error("Slot not found: "+t)},e.findIkConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.ikConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.findTransformConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.transformConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.findPathConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.pathConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.getBounds=function(t,e,n){if(void 0===n&&(n=new Array(2)),null==t)throw new Error("offset cannot be null.");if(null==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,l=0,h=r.length;l<h;l++){var u=r[l];if(u.bone.active){var c=0,d=null,f=u.getAttachment();if(I(f,R))c=8,d=b.setArraySize(n,c,0),f.computeWorldVertices(u.bone,d,0,2);else if(I(f,_)){var p=f;c=p.worldVerticesLength,d=b.setArraySize(n,c,0),p.computeWorldVertices(u,0,c,d,0,2)}if(null!=d)for(var v=0,g=d.length;v<g;v+=2){var m=d[v],w=d[v+1];a=Math.min(a,m),i=Math.min(i,w),s=Math.max(s,m),o=Math.max(o,w)}}}t.set(a,i),e.set(s-a,o-i)},e.update=function(t){this.time+=t},t}(),Vt=function(){function t(t){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new Nt(this),this.propertyIDs=new y,this.animationsChanged=!1,this.trackEntryPool=new S((function(){return new Ft})),this.data=t}var e=t.prototype;return e.update=function(t){t*=this.timeScale;for(var e=this.tracks,n=0,r=e.length;n<r;n++){var a=e[n];if(null!=a){a.animationLast=a.nextAnimationLast,a.trackLast=a.nextTrackLast;var i=t*a.timeScale;if(a.delay>0){if(a.delay-=i,a.delay>0)continue;i=-a.delay,a.delay=0}var s=a.next;if(null!=s){var o=a.trackLast-s.delay;if(o>=0){for(s.delay=0,s.trackTime+=0==a.timeScale?0:(o/a.timeScale+t)*s.timeScale,a.trackTime+=i,this.setCurrent(n,s,!0);null!=s.mixingFrom;)s.mixTime+=t,s=s.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 l=a.mixingFrom;for(a.mixingFrom=null,null!=l&&(l.mixingTo=null);null!=l;)this.queue.end(l),l=l.mixingFrom}a.trackTime+=i}}this.queue.drain()},e.updateMixingFrom=function(t,e){var 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.apply=function(e){if(null==e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var n=this.events,r=this.tracks,a=!1,i=0,s=r.length;i<s;i++){var o=r[i];if(!(null==o||o.delay>0)){a=!0;var l=0==i?G.first:o.mixBlend,h=o.alpha;null!=o.mixingFrom?h*=this.applyMixingFrom(o,e,l):o.trackTime>=o.trackEnd&&null==o.next&&(h=0);var u=o.animationLast,c=o.getAnimationTime(),d=o.animation.timelines.length,f=o.animation.timelines;if(0==i&&1==h||l==G.add)for(var p=0;p<d;p++){b.webkit602BugfixHelper(h,l);var v=f[p];I(v,st)?this.applyAttachmentTimeline(v,e,c,l,!0):v.apply(e,u,c,n,h,l,j.mixIn)}else{var g=o.timelineMode,m=0==o.timelinesRotation.length;m&&b.setArraySize(o.timelinesRotation,d<<1,null);for(var w=o.timelinesRotation,y=0;y<d;y++){var E=f[y],x=g[y]==t.SUBSEQUENT?l:G.setup;I(E,tt)?this.applyRotateTimeline(E,e,c,h,x,w,y<<1,m):I(E,st)?this.applyAttachmentTimeline(E,e,c,l,!0):(b.webkit602BugfixHelper(h,l),E.apply(e,u,c,n,h,x,j.mixIn))}}this.queueEvents(o,c),n.length=0,o.nextAnimationLast=c,o.nextTrackLast=o.trackTime}}for(var S=this.unkeyedState+t.SETUP,M=e.slots,A=0,T=e.slots.length;A<T;A++){var R=M[A];if(R.attachmentState==S){var C=R.data.attachmentName;R.attachment=null==C?null:e.getAttachment(R.data.index,C)}}return this.unkeyedState+=2,this.queue.drain(),a},e.applyMixingFrom=function(e,n,r){var a=e.mixingFrom;null!=a.mixingFrom&&this.applyMixingFrom(a,n,r);var i=0;0==e.mixDuration?(i=1,r==G.first&&(r=G.setup)):((i=e.mixTime/e.mixDuration)>1&&(i=1),r!=G.first&&(r=a.mixBlend));var s=i<a.eventThreshold?this.events:null,o=i<a.attachmentThreshold,l=i<a.drawOrderThreshold,h=a.animationLast,u=a.getAnimationTime(),c=a.animation.timelines.length,d=a.animation.timelines,f=a.alpha*e.interruptAlpha,p=f*(1-i);if(r==G.add)for(var v=0;v<c;v++)d[v].apply(n,h,u,s,p,r,j.mixOut);else{var g=a.timelineMode,m=a.timelineHoldMix,w=0==a.timelinesRotation.length;w&&b.setArraySize(a.timelinesRotation,c<<1,null);var y=a.timelinesRotation;a.totalAlpha=0;for(var E=0;E<c;E++){var x=d[E],S=j.mixOut,M=void 0,A=0;switch(g[E]){case t.SUBSEQUENT:if(!l&&I(x,ut))continue;M=r,A=p;break;case t.FIRST:M=G.setup,A=p;break;case t.HOLD_SUBSEQUENT:M=r,A=f;break;case t.HOLD_FIRST:M=G.setup,A=f;break;default:M=G.setup;var T=m[E];A=f*Math.max(0,1-T.mixTime/T.mixDuration)}a.totalAlpha+=A,I(x,tt)?this.applyRotateTimeline(x,n,u,A,M,y,E<<1,w):I(x,st)?this.applyAttachmentTimeline(x,n,u,M,o):(b.webkit602BugfixHelper(A,r),l&&I(x,ut)&&M==G.setup&&(S=j.mixIn),x.apply(n,h,u,s,A,M,S))}}return e.mixDuration>0&&this.queueEvents(a,u),this.events.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime,i},e.applyAttachmentTimeline=function(e,n,r,a,i){var s=n.slots[e.slotIndex];if(s.bone.active){var o,l=e.frames;if(r<l[0])a!=G.setup&&a!=G.first||this.setAttachment(n,s,s.data.attachmentName,i);else o=r>=l[l.length-1]?l.length-1:K.binarySearch(l,r)-1,this.setAttachment(n,s,e.attachmentNames[o],i);s.attachmentState<=this.unkeyedState&&(s.attachmentState=this.unkeyedState+t.SETUP)}},e.setAttachment=function(e,n,r,a){n.attachment=null==r?null:e.getAttachment(n.data.index,r),a&&(n.attachmentState=this.unkeyedState+t.CURRENT)},e.applyRotateTimeline=function(t,e,n,r,a,i,s,o){if(o&&(i[s]=0),1!=r){var l=t,h=l.frames,u=e.bones[l.boneIndex];if(u.active){var c=0,d=0;if(n<h[0])switch(a){case G.setup:u.rotation=u.data.rotation;default:return;case G.first:c=u.rotation,d=u.data.rotation}else if(c=a==G.setup?u.data.rotation:u.rotation,n>=h[h.length-tt.ENTRIES])d=u.data.rotation+h[h.length+tt.PREV_ROTATION];else{var f=K.binarySearch(h,n,tt.ENTRIES),p=h[f+tt.PREV_ROTATION],v=h[f],g=l.getCurvePercent((f>>1)-1,1-(n-v)/(h[f+tt.PREV_TIME]-v));d=h[f+tt.ROTATION]-p,d=p+(d-=360*(16384-(16384.499999999996-d/360|0)))*g+u.data.rotation,d-=360*(16384-(16384.499999999996-d/360|0))}var m=0,w=d-c;if(0==(w-=360*(16384-(16384.499999999996-w/360|0))))m=i[s];else{var y=0,E=0;o?(y=0,E=w):(y=i[s],E=i[s+1]);var b=w>0,S=y>=0;x.signum(E)!=x.signum(w)&&Math.abs(E)<=90&&(Math.abs(y)>180&&(y+=360*x.signum(y)),S=b),m=w+y-y%360,S!=b&&(m+=360*x.signum(y)),i[s]=m}i[s+1]=w,c+=m*r,u.rotation=c-360*(16384-(16384.499999999996-c/360|0))}}else t.apply(e,0,n,null,1,a,j.mixIn)},e.queueEvents=function(t,e){for(var n=t.animationStart,r=t.animationEnd,a=r-n,i=t.trackLast%a,s=this.events,o=0,l=s.length;o<l;o++){var h=s[o];if(h.time<i)break;h.time>r||this.queue.event(t,h)}for((t.loop?0==a||i>t.trackTime%a:e>=r&&t.animationLast<r)&&this.queue.complete(t);o<l;o++){s[o].time<n||this.queue.event(t,s[o])}},e.clearTracks=function(){var t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var e=0,n=this.tracks.length;e<n;e++)this.clearTrack(e);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()},e.clearTrack=function(t){if(!(t>=this.tracks.length)){var e=this.tracks[t];if(null!=e){this.queue.end(e),this.disposeNext(e);for(var 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.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.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.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.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.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 s=a.animationEnd-a.animationStart;0!=s?(a.loop?r+=s*(1+(a.trackTime/s|0)):r+=Math.max(s,a.trackTime),r-=this.data.getMix(a.animation,e)):r=a.trackTime}return i.delay=r,i},e.setEmptyAnimation=function(e,n){var r=this.setAnimationWith(e,t.emptyAnimation,!1);return r.mixDuration=n,r.trackEnd=n,r},e.addEmptyAnimation=function(e,n,r){r<=0&&(r-=n);var a=this.addAnimationWith(e,t.emptyAnimation,!1,r);return a.mixDuration=n,a.trackEnd=n,a},e.setEmptyAnimations=function(t){var e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var n=0,r=this.tracks.length;n<r;n++){var a=this.tracks[n];null!=a&&this.setEmptyAnimation(a.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()},e.expandToIndex=function(t){return t<this.tracks.length?this.tracks[t]:(b.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)},e.trackEntry=function(t,e,n,r){var a=this.trackEntryPool.obtain();return a.trackIndex=t,a.animation=e,a.loop=n,a.holdPrevious=!1,a.eventThreshold=0,a.attachmentThreshold=0,a.drawOrderThreshold=0,a.animationStart=0,a.animationEnd=e.duration,a.animationLast=-1,a.nextAnimationLast=-1,a.delay=0,a.trackTime=0,a.trackLast=-1,a.nextTrackLast=-1,a.trackEnd=Number.MAX_VALUE,a.timeScale=1,a.alpha=1,a.interruptAlpha=1,a.mixTime=0,a.mixDuration=null==r?0:this.data.getMix(r.animation,e),a.mixBlend=G.replace,a},e.disposeNext=function(t){for(var e=t.next;null!=e;)this.queue.dispose(e),e=e.next;t.next=null},e._animationsChanged=function(){this.animationsChanged=!1,this.propertyIDs.clear();for(var t=0,e=this.tracks.length;t<e;t++){var n=this.tracks[t];if(null!=n){for(;null!=n.mixingFrom;)n=n.mixingFrom;do{null!=n.mixingFrom&&n.mixBlend==G.add||this.computeHold(n),n=n.mixingTo}while(null!=n)}}},e.computeHold=function(e){var n=e.mixingTo,r=e.animation.timelines,a=e.animation.timelines.length,i=b.setArraySize(e.timelineMode,a);e.timelineHoldMix.length=0;var s=b.setArraySize(e.timelineHoldMix,a),o=this.propertyIDs;if(null!=n&&n.holdPrevious)for(var l=0;l<a;l++)i[l]=o.add(r[l].getPropertyId())?t.HOLD_FIRST:t.HOLD_SUBSEQUENT;else t:for(var h=0;h<a;h++){var u=r[h],c=u.getPropertyId();if(o.add(c))if(null==n||I(u,st)||I(u,ut)||I(u,ht)||!n.animation.hasTimeline(c))i[h]=t.FIRST;else{for(var d=n.mixingTo;null!=d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(e.mixDuration>0){i[h]=t.HOLD_MIX,s[h]=d;continue t}break}i[h]=t.HOLD_FIRST}else i[h]=t.SUBSEQUENT}},e.getCurrent=function(t){return t>=this.tracks.length?null:this.tracks[t]},e.addListener=function(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)},e.removeListener=function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)},e.clearListeners=function(){this.listeners.length=0},e.clearListenerNotifications=function(){this.queue.clear()},t}();Vt.emptyAnimation=new K("<empty>",[],0),Vt.SUBSEQUENT=0,Vt.FIRST=1,Vt.HOLD_SUBSEQUENT=2,Vt.HOLD_FIRST=3,Vt.HOLD_MIX=4,Vt.SETUP=1,Vt.CURRENT=2;var Pt,Ft=function(){function t(){this.mixBlend=G.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}var e=t.prototype;return e.reset=function(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0},e.getAnimationTime=function(){if(this.loop){var t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)},e.setAnimationLast=function(t){this.animationLast=t,this.nextAnimationLast=t},e.isComplete=function(){return this.trackTime>=this.animationEnd-this.animationStart},e.resetRotationDirections=function(){this.timelinesRotation.length=0},t}(),Nt=function(){function t(t){this.objects=[],this.drainDisabled=!1,this.animState=t}var e=t.prototype;return e.start=function(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0},e.interrupt=function(t){this.objects.push(1),this.objects.push(t)},e.end=function(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0},e.dispose=function(t){this.objects.push(3),this.objects.push(t)},e.complete=function(t){this.objects.push(4),this.objects.push(t)},e.event=function(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)},e.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var t=this.objects,e=this.animState.listeners,n=0;n<t.length;n+=2){var r=t[n],a=t[n+1];switch(r){case 0:null!=a.listener&&a.listener.start&&a.listener.start(a);for(var i=0;i<e.length;i++)e[i].start&&e[i].start(a);break;case 1:null!=a.listener&&a.listener.interrupt&&a.listener.interrupt(a);for(var s=0;s<e.length;s++)e[s].interrupt&&e[s].interrupt(a);break;case 2:null!=a.listener&&a.listener.end&&a.listener.end(a);for(var o=0;o<e.length;o++)e[o].end&&e[o].end(a);case 3:null!=a.listener&&a.listener.dispose&&a.listener.dispose(a);for(var l=0;l<e.length;l++)e[l].dispose&&e[l].dispose(a);this.animState.trackEntryPool.free(a);break;case 4:null!=a.listener&&a.listener.complete&&a.listener.complete(a);for(var h=0;h<e.length;h++)e[h].complete&&e[h].complete(a);break;case 5:var u=t[2+n++];null!=a.listener&&a.listener.event&&a.listener.event(a,u);for(var c=0;c<e.length;c++)e[c].event&&e[c].event(a,u)}}this.clear(),this.drainDisabled=!1}},e.clear=function(){this.objects.length=0},t}();!function(t){t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event"}(Pt||(Pt={}));var Bt=function(){function t(t){if(this.animationToMixTime={},this.defaultMix=0,null==t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}var e=t.prototype;return e.setMix=function(t,e,n){var r=this.skeletonData.findAnimation(t);if(null==r)throw new Error("Animation not found: "+t);var a=this.skeletonData.findAnimation(e);if(null==a)throw new Error("Animation not found: "+e);this.setMixWith(r,a,n)},e.setMixWith=function(t,e,n){if(null==t)throw new Error("from cannot be null.");if(null==e)throw new Error("to cannot be null.");var r=t.name+"."+e.name;this.animationToMixTime[r]=n},e.getMix=function(t,e){var n=t.name+"."+e.name,r=this.animationToMixTime[n];return void 0===r?this.defaultMix:r},t}(),Ot=function(){function t(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new S((function(){return new Array})),this.polygonIndicesPool=new S((function(){return new Array}))}var e=t.prototype;return e.triangulate=function(e){var n=e,r=e.length>>1,a=this.indicesArray;a.length=0;for(var i=0;i<r;i++)a[i]=i;var s=this.isConcaveArray;s.length=0;for(var o=0,l=r;o<l;++o)s[o]=t.isConcave(o,r,n,a);var h=this.triangles;for(h.length=0;r>3;){for(var u=r-1,c=0,d=1;;){t:if(!s[c]){for(var f=a[u]<<1,p=a[c]<<1,v=a[d]<<1,g=n[f],m=n[f+1],w=n[p],y=n[p+1],E=n[v],x=n[v+1],b=(d+1)%r;b!=u;b=(b+1)%r)if(s[b]){var S=a[b]<<1,M=n[S],A=n[S+1];if(t.positiveArea(E,x,g,m,M,A)&&t.positiveArea(g,m,w,y,M,A)&&t.positiveArea(w,y,E,x,M,A))break t}break}if(0==d){do{if(!s[c])break;c--}while(c>0);break}u=c,c=d,d=(d+1)%r}h.push(a[(r+c-1)%r]),h.push(a[c]),h.push(a[(c+1)%r]),a.splice(c,1),s.splice(c,1);var T=(--r+c-1)%r,R=c==r?0:c;s[T]=t.isConcave(T,r,n,a),s[R]=t.isConcave(R,r,n,a)}return 3==r&&(h.push(a[2]),h.push(a[0]),h.push(a[1])),h},e.decompose=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 l=-1,h=0,u=0,c=n.length;u<c;u+=3){var d=n[u]<<1,f=n[u+1]<<1,p=n[u+2]<<1,v=r[d],g=r[d+1],m=r[f],w=r[f+1],y=r[p],E=r[p+1],x=!1;if(l==d){var b=o.length-4,S=t.winding(o[b],o[b+1],o[b+2],o[b+3],y,E),M=t.winding(y,E,o[0],o[1],o[2],o[3]);S==h&&M==h&&(o.push(y),o.push(E),s.push(p),x=!0)}x||(o.length>0?(a.push(o),i.push(s)):(this.polygonPool.free(o),this.polygonIndicesPool.free(s)),(o=this.polygonPool.obtain()).length=0,o.push(v),o.push(g),o.push(m),o.push(w),o.push(y),o.push(E),(s=this.polygonIndicesPool.obtain()).length=0,s.push(d),s.push(f),s.push(p),h=t.winding(v,g,m,w,y,E),l=d)}o.length>0&&(a.push(o),i.push(s));for(var A=0,T=a.length;A<T;A++)if(0!=(s=i[A]).length)for(var R=s[0],I=s[s.length-1],C=(o=a[A]).length-4,_=o[C],k=o[C+1],V=o[C+2],P=o[C+3],F=o[0],N=o[1],B=o[2],O=o[3],L=t.winding(_,k,V,P,F,N),X=0;X<T;X++)if(X!=A){var D=i[X];if(3==D.length){var Y=D[0],U=D[1],W=D[2],q=a[X],H=q[q.length-2],G=q[q.length-1];if(Y==R&&U==I){var j=t.winding(_,k,V,P,H,G),z=t.winding(H,G,F,N,B,O);j==L&&z==L&&(q.length=0,D.length=0,o.push(H),o.push(G),s.push(W),_=V,k=P,V=H,P=G,X=0)}}}for(var Z=a.length-1;Z>=0;Z--)0==(o=a[Z]).length&&(a.splice(Z,1),this.polygonPool.free(o),s=i[Z],i.splice(Z,1),this.polygonIndicesPool.free(s));return a},t.isConcave=function(t,e,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])},t.positiveArea=function(t,e,n,r,a,i){return t*(i-r)+n*(e-i)+a*(r-e)>=0},t.winding=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}(),Lt=function(){function t(){this.triangulator=new Ot,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array}var e=t.prototype;return e.clipStart=function(e,n){if(null!=this.clipAttachment)return 0;this.clipAttachment=n;var r=n.worldVerticesLength,a=b.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,l=s.length;o<l;o++){var h=s[o];t.makeClockwise(h),h.push(h[0]),h.push(h[1])}return s.length},e.clipEndWithSlot=function(t){null!=this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()},e.clipEnd=function(){null!=this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)},e.isClipping=function(){return null!=this.clipAttachment},e.clipTriangles=function(t,e,n,r,a,i,s,o){var l=this.clipOutput,h=this.clippedVertices,u=this.clippedTriangles,c=this.clippingPolygons,d=this.clippingPolygons.length,f=o?12:8,p=0;h.length=0,u.length=0;t:for(var v=0;v<r;v+=3)for(var g=n[v]<<1,m=t[g],w=t[g+1],y=a[g],E=a[g+1],x=t[g=n[v+1]<<1],S=t[g+1],M=a[g],A=a[g+1],T=t[g=n[v+2]<<1],R=t[g+1],I=a[g],C=a[g+1],_=0;_<d;_++){var k=h.length;if(!this.clip(m,w,x,S,T,R,c[_],l)){var V=b.setArraySize(h,k+3*f);V[k]=m,V[k+1]=w,V[k+2]=i.r,V[k+3]=i.g,V[k+4]=i.b,V[k+5]=i.a,o?(V[k+6]=y,V[k+7]=E,V[k+8]=s.r,V[k+9]=s.g,V[k+10]=s.b,V[k+11]=s.a,V[k+12]=x,V[k+13]=S,V[k+14]=i.r,V[k+15]=i.g,V[k+16]=i.b,V[k+17]=i.a,V[k+18]=M,V[k+19]=A,V[k+20]=s.r,V[k+21]=s.g,V[k+22]=s.b,V[k+23]=s.a,V[k+24]=T,V[k+25]=R,V[k+26]=i.r,V[k+27]=i.g,V[k+28]=i.b,V[k+29]=i.a,V[k+30]=I,V[k+31]=C,V[k+32]=s.r,V[k+33]=s.g,V[k+34]=s.b,V[k+35]=s.a):(V[k+6]=y,V[k+7]=E,V[k+8]=x,V[k+9]=S,V[k+10]=i.r,V[k+11]=i.g,V[k+12]=i.b,V[k+13]=i.a,V[k+14]=M,V[k+15]=A,V[k+16]=T,V[k+17]=R,V[k+18]=i.r,V[k+19]=i.g,V[k+20]=i.b,V[k+21]=i.a,V[k+22]=I,V[k+23]=C),k=u.length;var P=b.setArraySize(u,k+3);P[k]=p,P[k+1]=p+1,P[k+2]=p+2,p+=3;continue t}var F=l.length;if(0!=F){for(var N=S-R,B=T-x,O=m-T,L=R-w,X=1/(N*O+B*(w-R)),D=F>>1,Y=this.clipOutput,U=b.setArraySize(h,k+D*f),W=0;W<F;W+=2){var q=Y[W],H=Y[W+1];U[k]=q,U[k+1]=H,U[k+2]=i.r,U[k+3]=i.g,U[k+4]=i.b,U[k+5]=i.a;var G=q-T,j=H-R,z=(N*G+B*j)*X,Z=(L*G+O*j)*X,Q=1-z-Z;U[k+6]=y*z+M*Z+I*Q,U[k+7]=E*z+A*Z+C*Q,o&&(U[k+8]=s.r,U[k+9]=s.g,U[k+10]=s.b,U[k+11]=s.a),k+=f}k=u.length;var J=b.setArraySize(u,k+3*(D-2));D--;for(var K=1;K<D;K++)J[k]=p,J[k+1]=p+K,J[k+2]=p+K+1,k+=3;p+=D+1}}},e.clip=function(t,e,n,r,a,i,s,o){var l=o,h=!1,u=null;s.length%4>=2?(u=o,o=this.scratch):u=this.scratch,u.length=0,u.push(t),u.push(e),u.push(n),u.push(r),u.push(a),u.push(i),u.push(t),u.push(e),o.length=0;for(var c=s,d=s.length-4,f=0;;f+=2){for(var p=c[f],v=c[f+1],g=c[f+2],m=c[f+3],w=p-g,y=v-m,E=u,x=u.length-2,b=o.length,S=0;S<x;S+=2){var M=E[S],A=E[S+1],T=E[S+2],R=E[S+3],I=w*(R-m)-y*(T-g)>0;if(w*(A-m)-y*(M-g)>0){if(I){o.push(T),o.push(R);continue}var C=R-A,_=T-M,k=C*(g-p)-_*(m-v);if(Math.abs(k)>1e-6){var V=(_*(v-A)-C*(p-M))/k;o.push(p+(g-p)*V),o.push(v+(m-v)*V)}else o.push(p),o.push(v)}else if(I){var P=R-A,F=T-M,N=P*(g-p)-F*(m-v);if(Math.abs(N)>1e-6){var B=(F*(v-A)-P*(p-M))/N;o.push(p+(g-p)*B),o.push(v+(m-v)*B)}else o.push(p),o.push(v);o.push(T),o.push(R)}h=!0}if(b==o.length)return l.length=0,!0;if(o.push(o[0]),o.push(o[1]),f==d)break;var O=o;(o=u).length=0,u=O}if(l!=o){l.length=0;for(var L=0,X=o.length-2;L<X;L++)l[L]=o[L]}else l.length=l.length-2;return h},t.makeClockwise=function(t){for(var e=t,n=t.length,r=e[n-2]*e[1]-e[0]*e[n-1],a=0,i=0,s=0,o=0,l=n-3;o<l;o+=2)a=e[o],i=e[o+1],s=e[o+2],r+=a*e[o+3]-s*i;if(!(r<0))for(var h=0,u=n-2,c=n>>1;h<c;h+=2){var d=e[h],f=e[h+1],p=u-h;e[h]=e[p],e[h+1]=e[p+1],e[p]=d,e[p+1]=f}},t}(),Xt=function(){function t(){}var n=t.prototype;return n.initialize=function(t,n){var r=this._mesh=new e.BufferMesh(t),a=[new e.VertexElement("POSITION",0,e.VertexElementFormat.Vector3,0),new e.VertexElement("COLOR_0",12,e.VertexElementFormat.Vector4,0),new e.VertexElement("TEXCOORD_0",28,e.VertexElementFormat.Vector2,0)],i=4*Dt.VERTEX_STRIDE,s=i*n,o=new e.Buffer(t,e.BufferBindFlag.VertexBuffer,s,e.BufferUsage.Dynamic),l=new e.Buffer(t,e.BufferBindFlag.IndexBuffer,2*n,e.BufferUsage.Dynamic);this._indexBuffer=l,this._vertexBuffer=o,r.setVertexBufferBinding(o,i),r.setIndexBufferBinding(l,e.IndexFormat.UInt16),r.setVertexElements(a),r.addSubMesh(0,n)},n.changeBuffer=function(t,n){var r=4*Dt.VERTEX_STRIDE,a=r*n,i=new e.Buffer(t,e.BufferBindFlag.VertexBuffer,a,e.BufferUsage.Dynamic),s=new e.Buffer(t,e.BufferBindFlag.IndexBuffer,2*n,e.BufferUsage.Dynamic),o=this._mesh;this._indexBuffer=s,this._vertexBuffer=i,o.setVertexBufferBinding(i,r),o.setIndexBufferBinding(s,e.IndexFormat.UInt16)},s(t,[{key:"mesh",get:function(){return this._mesh}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"vertexBuffer",get:function(){return this._vertexBuffer}}]),t}(),Dt=function(){function t(t,e){this._clipper=new Lt,this._spineMesh=new Xt,this._needResize=!1,this._subMeshItems=[],this.separateSlots=[],this.separateSlotTextureMap=new Map,this._engine=t,this._entity=e}var n=t.prototype;return n.initialize=function(n,r){if(n){var a=this._entity.getComponent(e.MeshRenderer);if(a){this._meshRenderer=a,r&&(this._setting=r);for(var i=n.defaultSkin.attachments,s=0,o=t.QUAD_TRIANGLES.length,l=0,h=i.length;l<h;l++){var u=i[l];for(var c in u){var d=u[c];if(d)if(I(d,R))s+=o;else{if(!I(d,_))continue;s+=d.triangles.length}}}this._vertexCount=s,this._prepareBufferData(this._vertexCount);var f=this._spineMesh;f.initialize(this._engine,this._vertexCount),a.mesh=f.mesh}else console.warn("You need add MeshRenderer component to entity first")}},n.buildMesh=function(n){var r=this._setting||{},a=r.useClipping,i=void 0===a||a,s=r.zSpacing,o=void 0===s?.01:s,l=0,h=0,u=n.drawOrder,c=u.length,d=this._clipper,f=this._spineMesh,p=f.mesh,v=this._subMeshItems;v.length=0;var g,m,w=this._vertices,y=0,E=0,x=pt.Normal,b=null;t.tempBlendMode=null;for(var S=0;S<c;++S){var M=u[S];if(M.bone.active){var A=M.getAttachment(),T=null,C=o*S,k=0,V=d.isClipping()?2:t.VERTEX_SIZE;if(I(A,R)){var P=A;T=P.color,w=this._vertices,k=4*V,P.computeWorldVertices(M.bone,w,0,V),g=t.QUAD_TRIANGLES,m=P.uvs,b=P.region.renderObject.texture}else if(I(A,_)){var N=A;T=N.color,w=this._vertices,(k=(N.worldVerticesLength>>1)*V)>w.length&&(w=this._vertices=new Float32Array(k)),N.computeWorldVertices(M,0,N.worldVerticesLength,w,0,V),g=N.triangles,m=N.uvs,b=N.region.renderObject.texture}else if(I(A,F)){if(i){var B=A;d.clipStart(M,B);continue}}else if(i){d.clipEndWithSlot(M);continue}if(null!=b){var O=void 0,L=void 0,X=void 0,D=void 0,Y=M.bone.skeleton.color,U=M.color,W=Y.a*U.a*T.a,q=t.tempColor;if(q.set(Y.r*U.r*T.r,Y.g*U.g*T.g,Y.b*U.b*T.b,W),d.isClipping()){d.clipTriangles(w,k,g,g.length,m,q,null,!1);var H=d.clippedVertices,G=d.clippedTriangles;O=H,L=H.length,X=G,D=G.length}else{for(var j=w,z=2,Z=0,Q=k;z<Q;z+=V,Z+=2)j[z]=q.r,j[z+1]=q.g,j[z+2]=q.b,j[z+3]=q.a,j[z+4]=m[Z],j[z+5]=m[Z+1];O=w,L=k,X=g,D=g.length}for(var J=l/t.VERTEX_STRIDE,K=this._verticesWithZ,$=l,tt=0;tt<L;)K[$++]=O[tt++],K[$++]=O[tt++],K[$++]=C,K[$++]=O[tt++],K[$++]=O[tt++],K[$++]=O[tt++],K[$++]=O[tt++],K[$++]=O[tt++],K[$++]=O[tt++];l=$;var et=this._indices;for($=h,tt=0;tt<D;$++,tt++)et[$]=X[tt]+J;h+=D;var nt=M.data.name;x=M.data.blendMode;var rt=null!==t.tempBlendMode&&t.tempBlendMode!==M.data.blendMode,at=this.separateSlots.includes(nt);if(at||rt){if(E>0){var it=new e.SubMesh(y,E);v.push({blendMode:t.tempBlendMode,subMesh:it,texture:b}),y+=E,E=0}if(at){var st=this.separateSlotTextureMap.get(nt);if(st){var ot=b.texture;st.filterMode=ot.filterMode,st.wrapModeU=ot.wrapModeU,st.wrapModeV=ot.wrapModeV}var lt=new e.SubMesh(y,D);v.push({blendMode:x,subMesh:lt,texture:b,slotName:nt}),y+=D,E=0}else E+=D}else E+=D;t.tempBlendMode=x}d.clipEndWithSlot(M)}else d.clipEndWithSlot(M)}if(E>0){var ht=new e.SubMesh(y,E);v.push({blendMode:x,subMesh:ht,texture:b}),E=0}if(d.clipEnd(),v.sort((function(t,e){return t.subMesh.start-e.subMesh.start})),h>0&&h!==this._vertexCount&&h>this._vertexCount)return this._vertexCount=h,this._prepareBufferData(this._vertexCount),void(this._needResize=!0);p.clearSubMesh();for(var ut=this._meshRenderer,ct=0,dt=v.length;ct<dt;++ct){var ft=v[ct],vt=ft.slotName,gt=ft.blendMode;p.addSubMesh(ft.subMesh);var mt=ut.getMaterial(ct);mt||(mt=Ut.getDefaultMaterial(this._engine));var wt=b.texture;this.separateSlotTextureMap.has(vt)&&(wt=this.separateSlotTextureMap.get(vt)),mt.shaderData.setTexture("material_SpineTexture",wt),mt._priority=ct,this.setBlendMode(mt,gt),ut.setMaterial(ct,mt)}this._needResize&&(f.changeBuffer(this._engine,this._vertexCount),this._needResize=!1),f.vertexBuffer.setData(this._verticesWithZ),f.indexBuffer.setData(this._indices)},n.addSeparateSlot=function(t){this.separateSlots.push(t)},n.addSeparateSlotTexture=function(t,e){this.separateSlotTextureMap.set(t,e)},n._prepareBufferData=function(e){this._vertices=new Float32Array(e*t.VERTEX_SIZE),this._verticesWithZ=new Float32Array(e*t.VERTEX_STRIDE),this._indices=new Uint16Array(e)},n.setBlendMode=function(t,n){var r=t.renderState.blendState.targetBlendState;switch(n){case pt.Additive:r.sourceColorBlendFactor=e.BlendFactor.SourceAlpha,r.destinationColorBlendFactor=e.BlendFactor.One,r.sourceAlphaBlendFactor=e.BlendFactor.One,r.destinationAlphaBlendFactor=e.BlendFactor.One,r.colorBlendOperation=r.alphaBlendOperation=e.BlendOperation.Add;break;case pt.Multiply:r.sourceColorBlendFactor=e.BlendFactor.DestinationColor,r.destinationColorBlendFactor=e.BlendFactor.Zero,r.sourceAlphaBlendFactor=e.BlendFactor.One,r.destinationAlphaBlendFactor=e.BlendFactor.Zero,r.colorBlendOperation=r.alphaBlendOperation=e.BlendOperation.Add;break;case pt.Screen:r.sourceColorBlendFactor=e.BlendFactor.One,r.destinationColorBlendFactor=e.BlendFactor.OneMinusSourceColor,r.sourceAlphaBlendFactor=e.BlendFactor.One,r.destinationAlphaBlendFactor=e.BlendFactor.OneMinusSourceColor,r.colorBlendOperation=r.alphaBlendOperation=e.BlendOperation.Add;break;default:r.sourceColorBlendFactor=e.BlendFactor.SourceAlpha,r.destinationColorBlendFactor=e.BlendFactor.OneMinusSourceAlpha,r.sourceAlphaBlendFactor=e.BlendFactor.One,r.destinationAlphaBlendFactor=e.BlendFactor.OneMinusSourceAlpha,r.colorBlendOperation=r.alphaBlendOperation=e.BlendOperation.Add}},s(t,[{key:"mesh",get:function(){return this._spineMesh.mesh}},{key:"subMeshItems",get:function(){return this._subMeshItems}}]),t}();Dt.QUAD_TRIANGLES=[0,1,2,2,3,0],Dt.VERTEX_SIZE=8,Dt.VERTEX_STRIDE=9,Dt.tempColor=new E,Dt.tempBlendMode=null;var Yt=function(t){function n(r){var a,i=e.Shader.find("galacean-spine-shader")||e.Shader.create("galacean-spine-shader",n._spineVS,n._spineFS),s=(a=t.call(this,r,i)||this).renderState,o=s.blendState.targetBlendState;return o.enabled=!0,o.sourceColorBlendFactor=e.BlendFactor.SourceAlpha,o.destinationColorBlendFactor=e.BlendFactor.OneMinusSourceAlpha,o.sourceAlphaBlendFactor=e.BlendFactor.One,o.destinationAlphaBlendFactor=e.BlendFactor.OneMinusSourceAlpha,o.colorBlendOperation=o.alphaBlendOperation=e.BlendOperation.Add,s.depthState.writeEnabled=!1,s.rasterState.cullMode=e.CullMode.Off,s.renderQueueType=e.RenderQueueType.Transparent,a}return r(n,t),n}(e.Material);Yt._spineVS="\n uniform mat4 renderer_MVPMat;\n\n attribute vec3 POSITION;\n attribute vec2 TEXCOORD_0;\n attribute vec4 COLOR_0;\n \n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n gl_Position = renderer_MVPMat * vec4(POSITION, 1.0);\n \n v_uv = TEXCOORD_0;\n v_color = COLOR_0;\n }\n ",Yt._spineFS="\n uniform sampler2D material_SpineTexture;\n\n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n vec4 baseColor = texture2D(material_SpineTexture, v_uv);\n gl_FragColor = baseColor * v_color;\n }\n ";var Ut=function(t){function n(e){var n;return(n=t.call(this,e)||this)._tempOffset=new M,n._tempSize=new M,n._tempArray=[0,0],n.autoUpdateBounds=!1,n.noPause=!1,n._meshGenerator=new Dt(n.engine,e),n}r(n,t);var a=n.prototype;return a.setSkeletonData=function(t,e){t||console.error("SkeletonData is undefined"),this.setting=e,this._skeletonData=t,this._skeleton=new kt(t);var n=new Bt(t);this._state=new Vt(n),this._meshGenerator.initialize(t,this.setting)},a.addSeparateSlot=function(t){this.skeleton||console.error("Skeleton not found!"),this.entity.getComponent(e.MeshRenderer)||console.warn("You need add MeshRenderer component to entity first"),this.skeleton.findSlot(t)?this._meshGenerator.addSeparateSlot(t):console.warn("Slot: "+t+" not find.")},a.hackSeparateSlotTexture=function(t,e){var n=this._meshGenerator.separateSlots;0!==n.length?n.includes(t)?this._meshGenerator.addSeparateSlotTexture(t,e):console.warn("Slot "+t+" is not separated. You should use addSeparateSlot to separate it"):console.warn("You need add separate slot")},a.onUpdate=function(t){if(this._skeleton&&this.state){var e=this._state,n=this._skeleton;this.noPause&&e.update(t),e.apply(n),n.updateWorldTransform(),this.updateGeometry()}},a.updateGeometry=function(){this._skeleton&&(this._meshGenerator.buildMesh(this._skeleton),this.autoUpdateBounds&&this.updateBounds())},a.updateBounds=function(){var t,n=this.entity.getComponent(e.MeshRenderer).bounds,r=this._tempOffset,a=this._tempSize,i=this._tempArray,s=(null==(t=this.setting)?void 0:t.zSpacing)||.01,o=this._skeleton;o.getBounds(r,a,i);var l=o.drawOrder;n.min.set(r.x,r.y,0),n.max.set(r.x+a.x,r.y+a.y,l.length*s)},a._cloneTo=function(t){t.setSkeletonData(this.skeletonData);var e=At({},this.setting);t.setting=e},a._disposeCurrentSkeleton=function(){this._skeletonData=null,this._skeleton=null,this._state=null},a.onDestroy=function(){this._disposeCurrentSkeleton(),this._meshGenerator=null,this.setting=null},n.getDefaultMaterial=function(t){var e=this._defaultMaterial;if(e){if(e.engine===t)return e.clone();e.destroy(!0),e=null}return(e=new Yt(t)).isGCIgnored=!0,this._defaultMaterial=e,e.clone()},s(n,[{key:"skeletonData",get:function(){return this._skeletonData}},{key:"skeleton",get:function(){return this._skeleton}},{key:"state",get:function(){return this._state}},{key:"mesh",get:function(){return this._meshGenerator.mesh}},{key:"scale",set:function(t){this._skeleton&&(this._skeleton.scaleX=t,this._skeleton.scaleY=t)}}]),n}(e.Script);a([e.ignoreClone],Ut.prototype,"_skeletonData",void 0),a([e.ignoreClone],Ut.prototype,"_skeleton",void 0),a([e.ignoreClone],Ut.prototype,"_state",void 0),a([e.ignoreClone],Ut.prototype,"_tempOffset",void 0),a([e.ignoreClone],Ut.prototype,"_tempSize",void 0),a([e.ignoreClone],Ut.prototype,"_tempArray",void 0),a([e.ignoreClone],Ut.prototype,"_meshGenerator",void 0),a([e.ignoreClone],Ut.prototype,"setting",void 0);var Wt=function(t){function n(){return t.apply(this,arguments)}r(n,t);var a=n.prototype;return a.load=function(t,n){var r=this;return new e.AssetPromise((function(e,a){"spine"!==t.type&&a("Asset type must be spine.");var i=null;t.urls?r.handleResource(n,t,i,e,a):r.request(t.url||"",{type:"json"}).then((function(s){s.jsonUrl&&s.atlasUrl&&s.pngUrl?(i=r.getResouceFromUrls([s.jsonUrl,s.atlasUrl,s.pngUrl],s.pngType),r.handleResource(n,t,i,e,a)):r.handleResource(n,t,i,e,a)})).catch((function(s){r.handleResource(n,t,i,e,a)}))}))},a.handleResource=function(t,n,r,a,i){var s=this,o=t.engine;r||(!n.urls&&n.url&&this.checkUrl(n.url)&&(r=this.getResouceFromUrl(n.url)),n.urls&&this.checkUrls(n.urls)&&(r=this.getResouceFromUrls(n.urls)));var l,h=!1;l=new w(o,null,(function(t){return s.createAdaptiveTexture(t)}));var u=r.skeletonFile,c=r.atlasFile,d=r.textureFile;l.onLoadComplete=function(){try{var t;if(h)t=l.get(c);else{var n=l.get(c);t=new p(n,s.textureAssetPicker.bind(s,l,d))}var r=new N(t),f=(s.isBinFile(u)?new xt(r):new yt(r)).readSkeletonData(l.get(u)),v=new e.Entity(o),g=v.addComponent(e.MeshRenderer),m=Ut.getDefaultMaterial(o);g.setMaterial(m),v.addComponent(Ut).setSkeletonData(f),a(v)}catch(t){i(t)}};var f=this.isBinFile(u);u&&c&&d?(f?l.loadBinary(u,null,i):l.loadText(u,null,i),l.loadText(c,null,i),l.loadEngineTexture(d,r.textureType,null,i)):u&&c&&!d?(h=!0,f?l.loadBinary(u,null,i):l.loadText(u,null,i),l.loadTextureAtlas(c,null,i)):i("Resouce param error")},a.textureAssetPicker=function(t,e){return t.get(e)},a.createAdaptiveTexture=function(t){return new qt(t)},a.isBinFile=function(t){return"bin"===this.getExtFromUrl(t)},a.checkUrl=function(t){var e=this.getExtFromUrl(t);return"json"===e||"bin"===e||(console.error("When use url as params, url must be json or bin file"),!1)},a.getResouceFromUrl=function(t){var e=t,n=t,r=n.indexOf("?");return r>0&&(n=n.substr(0,r)),{skeletonFile:e,atlasFile:n=n.substr(0,n.lastIndexOf("."))+".atlas"}},a.checkUrls=function(t){if(t.length<2)return console.error("When use urls as params, urls should at least contain: json/bin and atlas"),!1;if(t.length>3)return console.error("Spine runtime dont support multiple texture now"),!1;var e=this.getResouceFromUrls(t),n=e.skeletonFile,r=e.atlasFile;return!(!n||!r)||(console.error("Lack "+(n?"":"skeletonFile")+(r?" atlasFile":"")),!1)},a.getResouceFromUrls=function(t,n){var r,a,i;void 0===n&&(n=e.AssetType.Texture2D);for(var s=n,o=0;o<t.length;++o){var l=t[o],h=this.getExtFromUrl(l);"json"!==h&&"bin"!==h||(r=l),"atlas"===h&&(a=l);["png","jpg","webp","jpeg","ktx2"].includes(h)&&(i=l)}return{skeletonFile:r,atlasFile:a,textureFile:i,textureType:s}},a.getExtFromUrl=function(t){return t.split(/[#?]/)[0].split(".").pop().trim()},n}(e.Loader);Wt=a([e.resourceLoader("spine",["json","bin"])],Wt);var qt=function(t){function n(e){var n;return(n=t.call(this,e)||this).texture.generateMipmaps(),n}r(n,t);var a=n.prototype;return a.setFilters=function(t,n){t===h.Nearest?this.texture.filterMode=e.TextureFilterMode.Point:n===h.MipMapLinearLinear?this.texture.filterMode=e.TextureFilterMode.Trilinear:this.texture.filterMode=e.TextureFilterMode.Bilinear},a.setWraps=function(t,e){this.texture.wrapModeU=t,this.texture.wrapModeV=e},a.dispose=function(){},n}(c),Ht=function(t){function n(){var e;return(e=t.apply(this,arguments)||this)._priority=0,e._animationName="",e._loop=!0,e._paused=!1,e._autoPlay=!0,e._skinName="",e._scale=1,e._spineAnimation=null,e._animationNames=[],e._skinNames=[],e}r(n,t);var a=n.prototype;return a.onDestroy=function(){this.resource=null},a.play=function(t,e){void 0===t&&(t=""),void 0===e&&(e=!0);var n=this._animationNames;n.length>0?-1!==n.indexOf(t)&&(this._animationName=t,this._loop=e,this._resource&&this._spineAnimation&&this._spineAnimation.state.setAnimation(0,t,e)):this._animationName=t},a._cloneTo=function(t){t.entity.clearChildren(),t.resource=this.resource},a._removeResource=function(){this._resource&&this._spineAnimation&&(this.entity.removeChild(this._resource),this._resource.destroy(),this._resource=null,this._spineAnimation=null,this._animationName="",this._skinName="")},s(n,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority!==t&&(this._priority=t,this._resource&&(this._resource.getComponent(e.MeshRenderer).priority=t))}},{key:"resource",get:function(){return this._resource},set:function(t){var n=this._resource;if(t){if(n!==t){this._removeResource(),this._resource=t.clone(),this._resource.getComponent(e.MeshRenderer).priority=this.priority,this.entity.addChild(this._resource),this._spineAnimation=this._resource.getComponent(Ut),this._spineAnimation.scale=this._scale,this._spineAnimation.noPause=!this._paused;var r=this._spineAnimation.skeletonData,a=r.animations,i=r.skins,s=this._animationNames,o=this._skinNames;s.length=0;for(var l=0,h=a.length;l<h;++l)s.push(a[l].name);o.length=0;for(var u=0,c=i.length;u<c;++u)o.push(i[u].name);var d=this._skinName||o[0],f=this._spineAnimation.skeleton;f.setSkinByName(d),f.setSlotsToSetupPose(),this._autoPlay&&s.length>0&&this.play(this._animationName||s[0],this._loop)}}else this._removeResource()}},{key:"animationName",get:function(){return this._animationName},set:function(t){this._animationName!=t&&(this._animationName=t),this._autoPlay&&this._spineAnimation&&this.play(t,this._loop)}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop!==t&&(this._resource&&this._spineAnimation&&(t?this._autoPlay&&this.play(this._animationName,t):this.play(this._animationName,t)),this._loop=t)}},{key:"paused",get:function(){return this._paused},set:function(t){this._paused!==t&&(this._paused=t,this.spineAnimation&&(this.spineAnimation.noPause=!t))}},{key:"autoPlay",get:function(){return this._autoPlay},set:function(t){this._autoPlay!==t&&(t&&this._resource&&this._spineAnimation&&this.play(this._animationName,this._loop),this._autoPlay=t)}},{key:"skinName",get:function(){return this._skinName},set:function(t){if(this._skinName!==t&&(this._skinName=t,this._spineAnimation)){var e=this._spineAnimation.skeleton;e.setSkinByName(t),e.setSlotsToSetupPose()}}},{key:"scale",get:function(){return this._scale},set:function(t){this._scale!==t&&(this._scale=t,this._spineAnimation&&(this._spineAnimation.scale=t))}},{key:"spineAnimation",get:function(){return this._spineAnimation}}]),n}(e.Script);a([e.ignoreClone],Ht.prototype,"_resource",void 0),a([e.assignmentClone],Ht.prototype,"_animationName",void 0),a([e.assignmentClone],Ht.prototype,"_loop",void 0),a([e.assignmentClone],Ht.prototype,"_paused",void 0),a([e.assignmentClone],Ht.prototype,"_autoPlay",void 0),a([e.assignmentClone],Ht.prototype,"_skinName",void 0),a([e.assignmentClone],Ht.prototype,"_scale",void 0),a([e.ignoreClone],Ht.prototype,"_spineAnimation",void 0),a([e.ignoreClone],Ht.prototype,"_animationNames",void 0),a([e.ignoreClone],Ht.prototype,"_skinNames",void 0);var Gt="1.2.0";e.Loader.registerClass("SpineRenderer",Ht),console.log("Galacean spine version: "+Gt),t.AssetManager=w,t.AtlasAttachmentLoader=N,t.SkeletonBinary=xt,t.SkeletonJson=yt,t.SpineAnimation=Ut,t.SpineRenderer=Ht,t.Texture=c,t.TextureAtlas=p,t.version=Gt,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@galacean/engine")):"function"==typeof define&&define.amd?define(["exports","@galacean/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).Galacean=t.Galacean||{},t.Galacean.Spine={}),t.Galacean)}(this,(function(t,e){"use strict";function s(t,e,s,i){var n,a=arguments.length,r=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,i);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(r=(a<3?n(r):a>3?n(e,s,r):n(e,s))||r);return a>3&&r&&Object.defineProperty(e,s,r),r}"function"==typeof SuppressedError&&SuppressedError;class i{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,!e&&(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}class n{r;g;b;a;static WHITE=new n(1,1,1,1);static RED=new n(1,0,0,1);static GREEN=new n(0,1,0,1);static BLUE=new n(0,0,1,1);static MAGENTA=new n(1,0,1,1);constructor(t=0,e=0,s=0,i=0){this.r=t,this.g=e,this.b=s,this.a=i}set(t,e,s,i){return this.r=t,this.g=e,this.b=s,this.a=i,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=8!=t.length?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,i){return this.r+=t,this.g+=e,this.b+=s,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255}static rgb888ToColor(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255}toRgb888(){const t=t=>("0"+(255*t).toString(16)).slice(-2);return Number("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t){return(new n).setFromString(t)}}class a{static PI=3.1415927;static PI2=2*a.PI;static invPI2=1/a.PI2;static radiansToDegrees=180/a.PI;static radDeg=a.radiansToDegrees;static degreesToRadians=a.PI/180;static degRad=a.degreesToRadians;static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*a.degRad)}static sinDeg(t){return Math.sin(t*a.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*a.degRad}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){let e=Math.pow(Math.abs(t),1/3);return t<0?-e:e}static randomTriangular(t,e){return a.randomTriangularWith(t,e,.5*(t+e))}static randomTriangularWith(t,e,s){let i=Math.random(),n=e-t;return i<=(s-t)/n?t+Math.sqrt(i*n*(s-t)):e-Math.sqrt((1-i)*n*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}}class r{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class o extends r{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1}}class l{static SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;static arrayCopy(t,e,s,i,n){for(let a=e,r=i;a<e+n;a++,r++)s[r]=t[a]}static arrayFill(t,e,s,i){for(let n=e;n<s;n++)t[n]=i}static setArraySize(t,e,s=0){let i=t.length;if(i==e)return t;if(t.length=e,i<e)for(let n=i;n<e;n++)t[n]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:l.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e;return s}static newFloatArray(t){if(l.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let e=new Array(t);for(let t=0;t<e.length;t++)e[t]=0;return e}}static newShortArray(t){if(l.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let e=new Array(t);for(let t=0;t<e.length;t++)e[t]=0;return e}}static toFloatArray(t){return l.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return l.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var i=0;i<t.length;i++)if(t[i]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}}class h{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}}class c{x;y;constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this}}class d{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}class u extends d{static nextID=0;id=u.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,e,s,i,n,a){s=n+(s>>1)*a;let r=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(!h){o.length>0&&(l=o);let r=t.bone,h=r.worldX,c=r.worldY,d=r.a,u=r.b,m=r.c,f=r.d;for(let t=e,r=n;r<s;t+=2,r+=a){let e=l[t],s=l[t+1];i[r]=e*d+s*u+h,i[r+1]=e*m+s*f+c}return}let c=0,d=0;for(let t=0;t<e;t+=2){let t=h[c];c+=t+1,d+=t}let u=r.bones;if(0==o.length)for(let t=n,e=3*d;t<s;t+=a){let s=0,n=0,a=h[c++];for(a+=c;c<a;c++,e+=3){let t=u[h[c]],i=l[e],a=l[e+1],r=l[e+2];s+=(i*t.a+a*t.b+t.worldX)*r,n+=(i*t.c+a*t.d+t.worldY)*r}i[t]=s,i[t+1]=n}else{let t=o;for(let e=n,r=3*d,o=d<<1;e<s;e+=a){let s=0,n=0,a=h[c++];for(a+=c;c<a;c++,r+=3,o+=2){let e=u[h[c]],i=l[r]+t[o],a=l[r+1]+t[o+1],d=l[r+2];s+=(i*e.a+a*e.b+e.worldX)*d,n+=(i*e.c+a*e.d+e.worldY)*d}i[e]=s,i[e+1]=n}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),l.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=l.newFloatArray(this.vertices.length),l.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}}class m{static _nextID=0;id=m.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new m(this.regions.length);return l.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,e){let s=t.sequenceIndex;-1==s&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let i=this.regions[s];e.region!=i&&(e.region=i,e.updateRegion())}getPath(t,e){let s=t,i=(this.start+e).toString();for(let t=this.digits-i.length;t>0;t--)s+="0";return s+=i,s}static nextID(){return m._nextID++}}var f;!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"}(f||(f={}));const p=[f.hold,f.once,f.loop,f.pingpong,f.onceReverse,f.loopReverse,f.pingpongReverse];class g{name;timelines=[];timelineIds=new i;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,n,a,r,o){if(!t)throw new Error("skeleton cannot be null.");i&&0!=this.duration&&(s%=this.duration,e>0&&(e%=this.duration));let l=this.timelines;for(let i=0,h=l.length;i<h;i++)l[i].apply(t,e,s,n,a,r,o)}}var x,w;t.MixBlend=void 0,(x=t.MixBlend||(t.MixBlend={}))[x.setup=0]="setup",x[x.first=1]="first",x[x.replace=2]="replace",x[x.add=3]="add",t.MixDirection=void 0,(w=t.MixDirection||(t.MixDirection={}))[w.mixIn=0]="mixIn",w[w.mixOut=1]="mixOut";const b={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28};class y{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=l.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){let i=t.length;for(let n=s;n<i;n+=s)if(t[n]>e)return n-s;return i-s}}class M extends y{curves;constructor(t,e,s){super(t,s),this.curves=l.newFloatArray(t+18*e),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+18*t;if(this.curves.length>e){let t=l.newFloatArray(e);l.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,s,i,n,a,r,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(i-2*a+o),f=.03*(n-2*r+l),p=.006*(3*(a-o)-i+h),g=.006*(3*(r-l)-n+c),x=2*m+p,w=2*f+g,b=.3*(a-i)+m+.16666667*p,y=.3*(r-n)+f+.16666667*g,M=i+b,S=n+y;for(let t=u+18;u<t;u+=2)d[u]=M,d[u+1]=S,b+=x,y+=w,x+=p,w+=g,M+=b,S+=y}getBezierValue(t,e,s,i){let n=this.curves;if(n[i]>t){let a=this.frames[e],r=this.frames[e+s];return r+(t-a)/(n[i]-a)*(n[i+1]-r)}let a=i+18;for(i+=2;i<a;i+=2)if(n[i]>=t){let e=n[i-2],s=n[i-1];return s+(t-e)/(n[i]-e)*(n[i+1]-s)}e+=this.getFrameEntries();let r=n[a-2],o=n[a-1];return o+(t-r)/(this.frames[e]-r)*(this.frames[e+s]-o)}}class S extends M{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let i=2;i<=s;i+=2)if(e[i]>t){s=i-2;break}let i=this.curves[s>>1];switch(i){case 0:let i=e[s],n=e[s+1];return n+(t-i)/(e[s+2]-i)*(e[s+2+1]-n);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}getRelativeValue(e,s,i,n,a){if(e<this.frames[0]){switch(i){case t.MixBlend.setup:return a;case t.MixBlend.first:return n+(a-n)*s}return n}let r=this.getCurveValue(e);switch(i){case t.MixBlend.setup:return a+r*s;case t.MixBlend.first:case t.MixBlend.replace:r+=a-n}return n+r*s}getAbsoluteValue(e,s,i,n,a){if(e<this.frames[0]){switch(i){case t.MixBlend.setup:return a;case t.MixBlend.first:return n+(a-n)*s}return n}let r=this.getCurveValue(e);return i==t.MixBlend.setup?a+(r-a)*s:n+(r-n)*s}getAbsoluteValue2(e,s,i,n,a,r){if(e<this.frames[0]){switch(i){case t.MixBlend.setup:return a;case t.MixBlend.first:return n+(a-n)*s}return n}return i==t.MixBlend.setup?a+(r-a)*s:n+(r-n)*s}getScaleValue(e,s,i,n,r,o){if(e<this.frames[0]){switch(i){case t.MixBlend.setup:return o;case t.MixBlend.first:return r+(o-r)*s}return r}let l=this.getCurveValue(e)*o;if(1==s)return i==t.MixBlend.add?r+l-o:l;if(n==t.MixDirection.mixOut)switch(i){case t.MixBlend.setup:return o+(Math.abs(l)*a.signum(o)-o)*s;case t.MixBlend.first:case t.MixBlend.replace:return r+(Math.abs(l)*a.signum(r)-r)*s}else{let e=0;switch(i){case t.MixBlend.setup:return e=Math.abs(o)*a.signum(l),e+(l-e)*s;case t.MixBlend.first:case t.MixBlend.replace:return e=Math.abs(r)*a.signum(l),e+(l-e)*s}}return r+(l-o)*s}}class v extends M{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}}class k extends S{boneIndex=0;constructor(t,e,s){super(t,e,b.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,a,r){let o=t.bones[this.boneIndex];o.active&&(o.rotation=this.getRelativeValue(s,n,a,o.rotation,o.data.rotation))}}class I extends v{boneIndex=0;constructor(t,e,s){super(t,e,b.x+"|"+s,b.y+"|"+s),this.boneIndex=s}apply(e,s,i,n,a,r,o){let l=e.bones[this.boneIndex];if(!l.active)return;let h=this.frames;if(i<h[0]){switch(r){case t.MixBlend.setup:return l.x=l.data.x,void(l.y=l.data.y);case t.MixBlend.first:l.x+=(l.data.x-l.x)*a,l.y+=(l.data.y-l.y)*a}return}let c=0,d=0,u=y.search(h,i,3),m=this.curves[u/3];switch(m){case 0:let t=h[u];c=h[u+1],d=h[u+2];let e=(i-t)/(h[u+3]-t);c+=(h[u+3+1]-c)*e,d+=(h[u+3+2]-d)*e;break;case 1:c=h[u+1],d=h[u+2];break;default:c=this.getBezierValue(i,u,1,m-2),d=this.getBezierValue(i,u,2,m+18-2)}switch(r){case t.MixBlend.setup:l.x=l.data.x+c*a,l.y=l.data.y+d*a;break;case t.MixBlend.first:case t.MixBlend.replace:l.x+=(l.data.x+c-l.x)*a,l.y+=(l.data.y+d-l.y)*a;break;case t.MixBlend.add:l.x+=c*a,l.y+=d*a}}}class A extends S{boneIndex=0;constructor(t,e,s){super(t,e,b.x+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,a,r){let o=t.bones[this.boneIndex];o.active&&(o.x=this.getRelativeValue(s,n,a,o.x,o.data.x))}}class T extends S{boneIndex=0;constructor(t,e,s){super(t,e,b.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,a,r){let o=t.bones[this.boneIndex];o.active&&(o.y=this.getRelativeValue(s,n,a,o.y,o.data.y))}}class B extends v{boneIndex=0;constructor(t,e,s){super(t,e,b.scaleX+"|"+s,b.scaleY+"|"+s),this.boneIndex=s}apply(e,s,i,n,r,o,l){let h=e.bones[this.boneIndex];if(!h.active)return;let c,d,u=this.frames;if(i<u[0]){switch(o){case t.MixBlend.setup:return h.scaleX=h.data.scaleX,void(h.scaleY=h.data.scaleY);case t.MixBlend.first:h.scaleX+=(h.data.scaleX-h.scaleX)*r,h.scaleY+=(h.data.scaleY-h.scaleY)*r}return}let m=y.search(u,i,3),f=this.curves[m/3];switch(f){case 0:let t=u[m];c=u[m+1],d=u[m+2];let e=(i-t)/(u[m+3]-t);c+=(u[m+3+1]-c)*e,d+=(u[m+3+2]-d)*e;break;case 1:c=u[m+1],d=u[m+2];break;default:c=this.getBezierValue(i,m,1,f-2),d=this.getBezierValue(i,m,2,f+18-2)}if(c*=h.data.scaleX,d*=h.data.scaleY,1==r)o==t.MixBlend.add?(h.scaleX+=c-h.data.scaleX,h.scaleY+=d-h.data.scaleY):(h.scaleX=c,h.scaleY=d);else{let e=0,s=0;if(l==t.MixDirection.mixOut)switch(o){case t.MixBlend.setup:e=h.data.scaleX,s=h.data.scaleY,h.scaleX=e+(Math.abs(c)*a.signum(e)-e)*r,h.scaleY=s+(Math.abs(d)*a.signum(s)-s)*r;break;case t.MixBlend.first:case t.MixBlend.replace:e=h.scaleX,s=h.scaleY,h.scaleX=e+(Math.abs(c)*a.signum(e)-e)*r,h.scaleY=s+(Math.abs(d)*a.signum(s)-s)*r;break;case t.MixBlend.add:h.scaleX+=(c-h.data.scaleX)*r,h.scaleY+=(d-h.data.scaleY)*r}else switch(o){case t.MixBlend.setup:e=Math.abs(h.data.scaleX)*a.signum(c),s=Math.abs(h.data.scaleY)*a.signum(d),h.scaleX=e+(c-e)*r,h.scaleY=s+(d-s)*r;break;case t.MixBlend.first:case t.MixBlend.replace:e=Math.abs(h.scaleX)*a.signum(c),s=Math.abs(h.scaleY)*a.signum(d),h.scaleX=e+(c-e)*r,h.scaleY=s+(d-s)*r;break;case t.MixBlend.add:h.scaleX+=(c-h.data.scaleX)*r,h.scaleY+=(d-h.data.scaleY)*r}}}}class C extends S{boneIndex=0;constructor(t,e,s){super(t,e,b.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,a,r){let o=t.bones[this.boneIndex];o.active&&(o.scaleX=this.getScaleValue(s,n,a,r,o.scaleX,o.data.scaleX))}}class F extends S{boneIndex=0;constructor(t,e,s){super(t,e,b.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,a,r){let o=t.bones[this.boneIndex];o.active&&(o.scaleY=this.getScaleValue(s,n,a,r,o.scaleY,o.data.scaleY))}}class E extends v{boneIndex=0;constructor(t,e,s){super(t,e,b.shearX+"|"+s,b.shearY+"|"+s),this.boneIndex=s}apply(e,s,i,n,a,r,o){let l=e.bones[this.boneIndex];if(!l.active)return;let h=this.frames;if(i<h[0]){switch(r){case t.MixBlend.setup:return l.shearX=l.data.shearX,void(l.shearY=l.data.shearY);case t.MixBlend.first:l.shearX+=(l.data.shearX-l.shearX)*a,l.shearY+=(l.data.shearY-l.shearY)*a}return}let c=0,d=0,u=y.search(h,i,3),m=this.curves[u/3];switch(m){case 0:let t=h[u];c=h[u+1],d=h[u+2];let e=(i-t)/(h[u+3]-t);c+=(h[u+3+1]-c)*e,d+=(h[u+3+2]-d)*e;break;case 1:c=h[u+1],d=h[u+2];break;default:c=this.getBezierValue(i,u,1,m-2),d=this.getBezierValue(i,u,2,m+18-2)}switch(r){case t.MixBlend.setup:l.shearX=l.data.shearX+c*a,l.shearY=l.data.shearY+d*a;break;case t.MixBlend.first:case t.MixBlend.replace:l.shearX+=(l.data.shearX+c-l.shearX)*a,l.shearY+=(l.data.shearY+d-l.shearY)*a;break;case t.MixBlend.add:l.shearX+=c*a,l.shearY+=d*a}}}class R extends S{boneIndex=0;constructor(t,e,s){super(t,e,b.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,a,r){let o=t.bones[this.boneIndex];o.active&&(o.shearX=this.getRelativeValue(s,n,a,o.shearX,o.data.shearX))}}class Y extends S{boneIndex=0;constructor(t,e,s){super(t,e,b.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,a,r){let o=t.bones[this.boneIndex];o.active&&(o.shearY=this.getRelativeValue(s,n,a,o.shearY,o.data.shearY))}}class P extends y{boneIndex=0;constructor(t,e){super(t,[b.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(e,s,i,n,a,r,o){let l=e.bones[this.boneIndex];if(!l.active)return;let h=this.frames;i<h[0]?r!=t.MixBlend.setup&&r!=t.MixBlend.first||(l.inherit=l.data.inherit):l.inherit=this.frames[y.search(h,i,2)+1]}}class X extends M{slotIndex=0;constructor(t,e,s){super(t,e,[b.rgb+"|"+s,b.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,n,a){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=a}apply(e,s,i,n,a,r,o){let l=e.slots[this.slotIndex];if(!l.bone.active)return;let h=this.frames,c=l.color;if(i<h[0]){let e=l.data.color;switch(r){case t.MixBlend.setup:return void c.setFromColor(e);case t.MixBlend.first:c.add((e.r-c.r)*a,(e.g-c.g)*a,(e.b-c.b)*a,(e.a-c.a)*a)}return}let d=0,u=0,m=0,f=0,p=y.search(h,i,5),g=this.curves[p/5];switch(g){case 0:let t=h[p];d=h[p+1],u=h[p+2],m=h[p+3],f=h[p+4];let e=(i-t)/(h[p+5]-t);d+=(h[p+5+1]-d)*e,u+=(h[p+5+2]-u)*e,m+=(h[p+5+3]-m)*e,f+=(h[p+5+4]-f)*e;break;case 1:d=h[p+1],u=h[p+2],m=h[p+3],f=h[p+4];break;default:d=this.getBezierValue(i,p,1,g-2),u=this.getBezierValue(i,p,2,g+18-2),m=this.getBezierValue(i,p,3,g+36-2),f=this.getBezierValue(i,p,4,g+54-2)}1==a?c.set(d,u,m,f):(r==t.MixBlend.setup&&c.setFromColor(l.data.color),c.add((d-c.r)*a,(u-c.g)*a,(m-c.b)*a,(f-c.a)*a))}}class _ extends M{slotIndex=0;constructor(t,e,s){super(t,e,[b.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n}apply(e,s,i,n,a,r,o){let l=e.slots[this.slotIndex];if(!l.bone.active)return;let h=this.frames,c=l.color;if(i<h[0]){let e=l.data.color;switch(r){case t.MixBlend.setup:return c.r=e.r,c.g=e.g,void(c.b=e.b);case t.MixBlend.first:c.r+=(e.r-c.r)*a,c.g+=(e.g-c.g)*a,c.b+=(e.b-c.b)*a}return}let d=0,u=0,m=0,f=y.search(h,i,4),p=this.curves[f>>2];switch(p){case 0:let t=h[f];d=h[f+1],u=h[f+2],m=h[f+3];let e=(i-t)/(h[f+4]-t);d+=(h[f+4+1]-d)*e,u+=(h[f+4+2]-u)*e,m+=(h[f+4+3]-m)*e;break;case 1:d=h[f+1],u=h[f+2],m=h[f+3];break;default:d=this.getBezierValue(i,f,1,p-2),u=this.getBezierValue(i,f,2,p+18-2),m=this.getBezierValue(i,f,3,p+36-2)}if(1==a)c.r=d,c.g=u,c.b=m;else{if(r==t.MixBlend.setup){let t=l.data.color;c.r=t.r,c.g=t.g,c.b=t.b}c.r+=(d-c.r)*a,c.g+=(u-c.g)*a,c.b+=(m-c.b)*a}}}class V extends S{slotIndex=0;constructor(t,e,s){super(t,e,b.alpha+"|"+s),this.slotIndex=s}apply(e,s,i,n,a,r,o){let l=e.slots[this.slotIndex];if(!l.bone.active)return;let h=l.color;if(i<this.frames[0]){let e=l.data.color;switch(r){case t.MixBlend.setup:return void(h.a=e.a);case t.MixBlend.first:h.a+=(e.a-h.a)*a}return}let c=this.getCurveValue(i);1==a?h.a=c:(r==t.MixBlend.setup&&(h.a=l.data.color.a),h.a+=(c-h.a)*a)}}class D extends M{slotIndex=0;constructor(t,e,s){super(t,e,[b.rgb+"|"+s,b.alpha+"|"+s,b.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,n,a,r,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=a,this.frames[t+5]=r,this.frames[t+6]=o,this.frames[t+7]=l}apply(e,s,i,n,a,r,o){let l=e.slots[this.slotIndex];if(!l.bone.active)return;let h=this.frames,c=l.color,d=l.darkColor;if(i<h[0]){let e=l.data.color,s=l.data.darkColor;switch(r){case t.MixBlend.setup:return c.setFromColor(e),d.r=s.r,d.g=s.g,void(d.b=s.b);case t.MixBlend.first:c.add((e.r-c.r)*a,(e.g-c.g)*a,(e.b-c.b)*a,(e.a-c.a)*a),d.r+=(s.r-d.r)*a,d.g+=(s.g-d.g)*a,d.b+=(s.b-d.b)*a}return}let u=0,m=0,f=0,p=0,g=0,x=0,w=0,b=y.search(h,i,8),M=this.curves[b>>3];switch(M){case 0:let t=h[b];u=h[b+1],m=h[b+2],f=h[b+3],p=h[b+4],g=h[b+5],x=h[b+6],w=h[b+7];let e=(i-t)/(h[b+8]-t);u+=(h[b+8+1]-u)*e,m+=(h[b+8+2]-m)*e,f+=(h[b+8+3]-f)*e,p+=(h[b+8+4]-p)*e,g+=(h[b+8+5]-g)*e,x+=(h[b+8+6]-x)*e,w+=(h[b+8+7]-w)*e;break;case 1:u=h[b+1],m=h[b+2],f=h[b+3],p=h[b+4],g=h[b+5],x=h[b+6],w=h[b+7];break;default:u=this.getBezierValue(i,b,1,M-2),m=this.getBezierValue(i,b,2,M+18-2),f=this.getBezierValue(i,b,3,M+36-2),p=this.getBezierValue(i,b,4,M+54-2),g=this.getBezierValue(i,b,5,M+72-2),x=this.getBezierValue(i,b,6,M+90-2),w=this.getBezierValue(i,b,7,M+108-2)}if(1==a)c.set(u,m,f,p),d.r=g,d.g=x,d.b=w;else{if(r==t.MixBlend.setup){c.setFromColor(l.data.color);let t=l.data.darkColor;d.r=t.r,d.g=t.g,d.b=t.b}c.add((u-c.r)*a,(m-c.g)*a,(f-c.b)*a,(p-c.a)*a),d.r+=(g-d.r)*a,d.g+=(x-d.g)*a,d.b+=(w-d.b)*a}}}class O extends M{slotIndex=0;constructor(t,e,s){super(t,e,[b.rgb+"|"+s,b.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,a,r,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=a,this.frames[t+5]=r,this.frames[t+6]=o}apply(e,s,i,n,a,r,o){let l=e.slots[this.slotIndex];if(!l.bone.active)return;let h=this.frames,c=l.color,d=l.darkColor;if(i<h[0]){let e=l.data.color,s=l.data.darkColor;switch(r){case t.MixBlend.setup:return c.r=e.r,c.g=e.g,c.b=e.b,d.r=s.r,d.g=s.g,void(d.b=s.b);case t.MixBlend.first:c.r+=(e.r-c.r)*a,c.g+=(e.g-c.g)*a,c.b+=(e.b-c.b)*a,d.r+=(s.r-d.r)*a,d.g+=(s.g-d.g)*a,d.b+=(s.b-d.b)*a}return}let u=0,m=0,f=0,p=0,g=0,x=0,w=y.search(h,i,7),b=this.curves[w/7];switch(b){case 0:let t=h[w];u=h[w+1],m=h[w+2],f=h[w+3],p=h[w+4],g=h[w+5],x=h[w+6];let e=(i-t)/(h[w+7]-t);u+=(h[w+7+1]-u)*e,m+=(h[w+7+2]-m)*e,f+=(h[w+7+3]-f)*e,p+=(h[w+7+4]-p)*e,g+=(h[w+7+5]-g)*e,x+=(h[w+7+6]-x)*e;break;case 1:u=h[w+1],m=h[w+2],f=h[w+3],p=h[w+4],g=h[w+5],x=h[w+6];break;default:u=this.getBezierValue(i,w,1,b-2),m=this.getBezierValue(i,w,2,b+18-2),f=this.getBezierValue(i,w,3,b+36-2),p=this.getBezierValue(i,w,4,b+54-2),g=this.getBezierValue(i,w,5,b+72-2),x=this.getBezierValue(i,w,6,b+90-2)}if(1==a)c.r=u,c.g=m,c.b=f,d.r=p,d.g=g,d.b=x;else{if(r==t.MixBlend.setup){let t=l.data.color,e=l.data.darkColor;c.r=t.r,c.g=t.g,c.b=t.b,d.r=e.r,d.g=e.g,d.b=e.b}c.r+=(u-c.r)*a,c.g+=(m-c.g)*a,c.b+=(f-c.b)*a,d.r+=(p-d.r)*a,d.g+=(g-d.g)*a,d.b+=(x-d.b)*a}}}class N extends y{slotIndex=0;attachmentNames;constructor(t,e){super(t,[b.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(e,s,i,n,a,r,o){let l=e.slots[this.slotIndex];l.bone.active&&(o!=t.MixDirection.mixOut?i<this.frames[0]?r!=t.MixBlend.setup&&r!=t.MixBlend.first||this.setAttachment(e,l,l.data.attachmentName):this.setAttachment(e,l,this.attachmentNames[y.search1(this.frames,i)]):r==t.MixBlend.setup&&this.setAttachment(e,l,l.data.attachmentName))}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class L extends M{slotIndex=0;attachment;vertices;constructor(t,e,s,i){super(t,e,[b.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,n,a,r,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(i-2*a+o),f=.03*l-.06*r,p=.006*(3*(a-o)-i+h),g=.018*(r-l+.33333333),x=2*m+p,w=2*f+g,b=.3*(a-i)+m+.16666667*p,y=.3*r+f+.16666667*g,M=i+b,S=y;for(let t=u+18;u<t;u+=2)d[u]=M,d[u+1]=S,b+=x,y+=w,x+=p,w+=g,M+=b,S+=y}getCurvePercent(t,e){let s=this.curves,i=s[e];switch(i){case 0:let s=this.frames[e];return(t-s)/(this.frames[e+this.getFrameEntries()]-s);case 1:return 0}if(i-=2,s[i]>t){let n=this.frames[e];return s[i+1]*(t-n)/(s[i]-n)}let n=i+18;for(i+=2;i<n;i+=2)if(s[i]>=t){let e=s[i-2],n=s[i-1];return n+(t-e)/(s[i]-e)*(s[i+1]-n)}let a=s[n-2],r=s[n-1];return r+(1-r)*(t-a)/(this.frames[e+this.getFrameEntries()]-a)}apply(e,s,i,n,a,r,o){let h=e.slots[this.slotIndex];if(!h.bone.active)return;let c=h.getAttachment();if(!c)return;if(!(c instanceof u)||c.timelineAttachment!=this.attachment)return;let d=h.deform;0==d.length&&(r=t.MixBlend.setup);let m=this.vertices,f=m[0].length,p=this.frames;if(i<p[0]){switch(r){case t.MixBlend.setup:return void(d.length=0);case t.MixBlend.first:if(1==a)return void(d.length=0);d.length=f;let e=c;if(e.bones){a=1-a;for(g=0;g<f;g++)d[g]*=a}else{let t=e.vertices;for(var g=0;g<f;g++)d[g]+=(t[g]-d[g])*a}}return}if(d.length=f,i>=p[p.length-1]){let e=m[p.length-1];if(1==a)if(r==t.MixBlend.add){let t=c;if(t.bones)for(let t=0;t<f;t++)d[t]+=e[t];else{let s=t.vertices;for(let t=0;t<f;t++)d[t]+=e[t]-s[t]}}else l.arrayCopy(e,0,d,0,f);else switch(r){case t.MixBlend.setup:{let t=c;if(t.bones)for(let t=0;t<f;t++)d[t]=e[t]*a;else{let s=t.vertices;for(let t=0;t<f;t++){let i=s[t];d[t]=i+(e[t]-i)*a}}break}case t.MixBlend.first:case t.MixBlend.replace:for(let t=0;t<f;t++)d[t]+=(e[t]-d[t])*a;break;case t.MixBlend.add:let s=c;if(s.bones)for(let t=0;t<f;t++)d[t]+=e[t]*a;else{let t=s.vertices;for(let s=0;s<f;s++)d[s]+=(e[s]-t[s])*a}}return}let x=y.search1(p,i),w=this.getCurvePercent(i,x),b=m[x],M=m[x+1];if(1==a)if(r==t.MixBlend.add){let t=c;if(t.bones)for(let t=0;t<f;t++){let e=b[t];d[t]+=e+(M[t]-e)*w}else{let e=t.vertices;for(let t=0;t<f;t++){let s=b[t];d[t]+=s+(M[t]-s)*w-e[t]}}}else for(let t=0;t<f;t++){let e=b[t];d[t]=e+(M[t]-e)*w}else switch(r){case t.MixBlend.setup:{let t=c;if(t.bones)for(let t=0;t<f;t++){let e=b[t];d[t]=(e+(M[t]-e)*w)*a}else{let e=t.vertices;for(let t=0;t<f;t++){let s=b[t],i=e[t];d[t]=i+(s+(M[t]-s)*w-i)*a}}break}case t.MixBlend.first:case t.MixBlend.replace:for(let t=0;t<f;t++){let e=b[t];d[t]+=(e+(M[t]-e)*w-d[t])*a}break;case t.MixBlend.add:let e=c;if(e.bones)for(let t=0;t<f;t++){let e=b[t];d[t]+=(e+(M[t]-e)*w)*a}else{let t=e.vertices;for(let e=0;e<f;e++){let s=b[e];d[e]+=(s+(M[e]-s)*w-t[e])*a}}}}}class q extends y{static propertyIds=[""+b.event];events;constructor(t){super(t,q.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,i,n,a,r){if(!i)return;let o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,i,n,a,r),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let h=0;if(e<o[0])h=0;else{h=y.search1(o,e)+1;let t=o[h];for(;h>0&&o[h-1]==t;)h--}for(;h<l&&s>=o[h];h++)i.push(this.events[h])}}class U extends y{static propertyIds=[""+b.drawOrder];drawOrders;constructor(t){super(t,U.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(e,s,i,n,a,r,o){if(o==t.MixDirection.mixOut)return void(r==t.MixBlend.setup&&l.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length));if(i<this.frames[0])return void(r!=t.MixBlend.setup&&r!=t.MixBlend.first||l.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length));let h=y.search1(this.frames,i),c=this.drawOrders[h];if(c){let t=e.drawOrder,s=e.slots;for(let e=0,i=c.length;e<i;e++)t[e]=s[c[e]]}else l.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length)}}class W extends M{constraintIndex=0;constructor(t,e,s){super(t,e,[b.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,n,a,r){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=a?1:0,this.frames[t+5]=r?1:0}apply(e,s,i,n,a,r,o){let l=e.ikConstraints[this.constraintIndex];if(!l.active)return;let h=this.frames;if(i<h[0]){switch(r){case t.MixBlend.setup:return l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,void(l.stretch=l.data.stretch);case t.MixBlend.first:l.mix+=(l.data.mix-l.mix)*a,l.softness+=(l.data.softness-l.softness)*a,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}return}let c=0,d=0,u=y.search(h,i,6),m=this.curves[u/6];switch(m){case 0:let t=h[u];c=h[u+1],d=h[u+2];let e=(i-t)/(h[u+6]-t);c+=(h[u+6+1]-c)*e,d+=(h[u+6+2]-d)*e;break;case 1:c=h[u+1],d=h[u+2];break;default:c=this.getBezierValue(i,u,1,m-2),d=this.getBezierValue(i,u,2,m+18-2)}r==t.MixBlend.setup?(l.mix=l.data.mix+(c-l.data.mix)*a,l.softness=l.data.softness+(d-l.data.softness)*a,o==t.MixDirection.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=h[u+3],l.compress=0!=h[u+4],l.stretch=0!=h[u+5])):(l.mix+=(c-l.mix)*a,l.softness+=(d-l.softness)*a,o==t.MixDirection.mixIn&&(l.bendDirection=h[u+3],l.compress=0!=h[u+4],l.stretch=0!=h[u+5]))}}class z extends M{constraintIndex=0;constructor(t,e,s){super(t,e,[b.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,a,r,o){let l=this.frames;l[t*=7]=e,l[t+1]=s,l[t+2]=i,l[t+3]=n,l[t+4]=a,l[t+5]=r,l[t+6]=o}apply(e,s,i,n,a,r,o){let l=e.transformConstraints[this.constraintIndex];if(!l.active)return;let h,c,d,u,m,f,p=this.frames;if(i<p[0]){let e=l.data;switch(r){case t.MixBlend.setup:return l.mixRotate=e.mixRotate,l.mixX=e.mixX,l.mixY=e.mixY,l.mixScaleX=e.mixScaleX,l.mixScaleY=e.mixScaleY,void(l.mixShearY=e.mixShearY);case t.MixBlend.first:l.mixRotate+=(e.mixRotate-l.mixRotate)*a,l.mixX+=(e.mixX-l.mixX)*a,l.mixY+=(e.mixY-l.mixY)*a,l.mixScaleX+=(e.mixScaleX-l.mixScaleX)*a,l.mixScaleY+=(e.mixScaleY-l.mixScaleY)*a,l.mixShearY+=(e.mixShearY-l.mixShearY)*a}return}let g=y.search(p,i,7),x=this.curves[g/7];switch(x){case 0:let t=p[g];h=p[g+1],c=p[g+2],d=p[g+3],u=p[g+4],m=p[g+5],f=p[g+6];let e=(i-t)/(p[g+7]-t);h+=(p[g+7+1]-h)*e,c+=(p[g+7+2]-c)*e,d+=(p[g+7+3]-d)*e,u+=(p[g+7+4]-u)*e,m+=(p[g+7+5]-m)*e,f+=(p[g+7+6]-f)*e;break;case 1:h=p[g+1],c=p[g+2],d=p[g+3],u=p[g+4],m=p[g+5],f=p[g+6];break;default:h=this.getBezierValue(i,g,1,x-2),c=this.getBezierValue(i,g,2,x+18-2),d=this.getBezierValue(i,g,3,x+36-2),u=this.getBezierValue(i,g,4,x+54-2),m=this.getBezierValue(i,g,5,x+72-2),f=this.getBezierValue(i,g,6,x+90-2)}if(r==t.MixBlend.setup){let t=l.data;l.mixRotate=t.mixRotate+(h-t.mixRotate)*a,l.mixX=t.mixX+(c-t.mixX)*a,l.mixY=t.mixY+(d-t.mixY)*a,l.mixScaleX=t.mixScaleX+(u-t.mixScaleX)*a,l.mixScaleY=t.mixScaleY+(m-t.mixScaleY)*a,l.mixShearY=t.mixShearY+(f-t.mixShearY)*a}else l.mixRotate+=(h-l.mixRotate)*a,l.mixX+=(c-l.mixX)*a,l.mixY+=(d-l.mixY)*a,l.mixScaleX+=(u-l.mixScaleX)*a,l.mixScaleY+=(m-l.mixScaleY)*a,l.mixShearY+=(f-l.mixShearY)*a}}class G extends S{constraintIndex=0;constructor(t,e,s){super(t,e,b.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,i,n,a,r){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.position=this.getAbsoluteValue(s,n,a,o.position,o.data.position))}}class $ extends S{constraintIndex=0;constructor(t,e,s){super(t,e,b.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,i,n,a,r){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.spacing=this.getAbsoluteValue(s,n,a,o.spacing,o.data.spacing))}}class j extends M{constraintIndex=0;constructor(t,e,s){super(t,e,[b.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){let a=this.frames;a[t<<=2]=e,a[t+1]=s,a[t+2]=i,a[t+3]=n}apply(e,s,i,n,a,r,o){let l=e.pathConstraints[this.constraintIndex];if(!l.active)return;let h,c,d,u=this.frames;if(i<u[0]){switch(r){case t.MixBlend.setup:return l.mixRotate=l.data.mixRotate,l.mixX=l.data.mixX,void(l.mixY=l.data.mixY);case t.MixBlend.first:l.mixRotate+=(l.data.mixRotate-l.mixRotate)*a,l.mixX+=(l.data.mixX-l.mixX)*a,l.mixY+=(l.data.mixY-l.mixY)*a}return}let m=y.search(u,i,4),f=this.curves[m>>2];switch(f){case 0:let t=u[m];h=u[m+1],c=u[m+2],d=u[m+3];let e=(i-t)/(u[m+4]-t);h+=(u[m+4+1]-h)*e,c+=(u[m+4+2]-c)*e,d+=(u[m+4+3]-d)*e;break;case 1:h=u[m+1],c=u[m+2],d=u[m+3];break;default:h=this.getBezierValue(i,m,1,f-2),c=this.getBezierValue(i,m,2,f+18-2),d=this.getBezierValue(i,m,3,f+36-2)}if(r==t.MixBlend.setup){let t=l.data;l.mixRotate=t.mixRotate+(h-t.mixRotate)*a,l.mixX=t.mixX+(c-t.mixX)*a,l.mixY=t.mixY+(d-t.mixY)*a}else l.mixRotate+=(h-l.mixRotate)*a,l.mixX+=(c-l.mixX)*a,l.mixY+=(d-l.mixY)*a}}class H extends S{constraintIndex=0;constructor(t,e,s,i){super(t,e,i+"|"+s),this.constraintIndex=s}apply(t,e,s,i,n,a,r){let o;if(-1==this.constraintIndex){const e=s>=this.frames[0]?this.getCurveValue(s):0;for(const i of t.physicsConstraints)i.active&&this.global(i.data)&&this.set(i,this.getAbsoluteValue2(s,n,a,this.get(i),this.setup(i),e))}else o=t.physicsConstraints[this.constraintIndex],o.active&&this.set(o,this.getAbsoluteValue(s,n,a,this.get(o),this.setup(o)))}}class J extends H{constructor(t,e,s){super(t,e,s,b.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}}class K extends H{constructor(t,e,s){super(t,e,s,b.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}}class Q extends H{constructor(t,e,s){super(t,e,s,b.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}}class Z extends H{constructor(t,e,s){super(t,e,s,b.physicsConstraintMass)}setup(t){return 1/t.data.massInverse}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}}class tt extends H{constructor(t,e,s){super(t,e,s,b.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}}class et extends H{constructor(t,e,s){super(t,e,s,b.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}}class st extends H{constructor(t,e,s){super(t,e,s,b.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}}class it extends y{static propertyIds=[b.physicsConstraintReset.toString()];constraintIndex;constructor(t,e){super(t,it.propertyIds),this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,i,n,a,r){let o;if(-1!=this.constraintIndex&&(o=t.physicsConstraints[this.constraintIndex],!o.active))return;const l=this.frames;if(e>s)this.apply(t,e,Number.MAX_VALUE,[],n,a,r),e=-1;else if(e>=l[l.length-1])return;if(!(s<l[0])&&(e<l[0]||s>=l[y.search1(l,e)+1]))if(null!=o)o.reset();else for(const e of t.physicsConstraints)e.active&&e.reset()}}class nt extends y{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,e,s){super(t,[b.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return nt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,i,n){let a=this.frames;a[t*=nt.ENTRIES]=e,a[t+nt.MODE]=s|i<<4,a[t+nt.DELAY]=n}apply(e,s,i,n,a,r,o){let l=e.slots[this.slotIndex];if(!l.bone.active)return;let h=l.attachment,c=this.attachment;if(!(h==c||h instanceof u&&h.timelineAttachment==c))return;let d=this.frames;if(i<d[0])return void(r!=t.MixBlend.setup&&r!=t.MixBlend.first||(l.sequenceIndex=-1));let m=y.search(d,i,nt.ENTRIES),g=d[m],x=d[m+nt.MODE],w=d[m+nt.DELAY];if(!this.attachment.sequence)return;let b=x>>4,M=this.attachment.sequence.regions.length,S=p[15&x];if(S!=f.hold)switch(b+=(i-g)/w+1e-5|0,S){case f.once:b=Math.min(M-1,b);break;case f.loop:b%=M;break;case f.pingpong:{let t=(M<<1)-2;b=0==t?0:b%t,b>=M&&(b=t-b);break}case f.onceReverse:b=Math.max(M-1-b,0);break;case f.loopReverse:b=M-1-b%M;break;case f.pingpongReverse:{let t=(M<<1)-2;b=0==t?0:(b+M-1)%t,b>=M&&(b=t-b)}}l.sequenceIndex=b}}class at{static _emptyAnimation=new g("<empty>",[],0);static emptyAnimation(){return at._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new ot(this);propertyIDs=new i;animationsChanged=!1;trackEntryPool=new h((()=>new rt));constructor(t){this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(!i)continue;i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast;let n=t*i.timeScale;if(i.delay>0){if(i.delay-=n,i.delay>0)continue;n=-i.delay,i.delay=0}let a=i.next;if(a){let e=i.trackLast-a.delay;if(e>=0){for(a.delay=0,a.trackTime+=0==i.timeScale?0:(e/i.timeScale+t)*a.timeScale,i.trackTime+=n,this.setCurrent(s,a,!0);a.mixingFrom;)a.mixTime+=t,a=a.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&!i.mixingFrom){e[s]=null,this.queue.end(i),this.clearNext(i);continue}if(i.mixingFrom&&this.updateMixingFrom(i,t)){let t=i.mixingFrom;for(i.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}i.trackTime+=n}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let i=this.updateMixingFrom(s,e);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=s.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=s.mixingFrom,s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),i):(s.trackTime+=e*s.timeScale,t.mixTime+=e,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,i=this.tracks,n=!1;for(let r=0,o=i.length;r<o;r++){let o=i[r];if(!o||o.delay>0)continue;n=!0;let h=0==r?t.MixBlend.first:o.mixBlend,c=o.alpha;o.mixingFrom?c*=this.applyMixingFrom(o,e,h):o.trackTime>=o.trackEnd&&!o.next&&(c=0);let d=c>=o.alphaAttachmentThreshold,u=o.animationLast,m=o.getAnimationTime(),f=m,p=s;o.reverse&&(f=o.animation.duration-f,p=null);let g=o.animation.timelines,x=g.length;if(0==r&&1==c||h==t.MixBlend.add){0==r&&(d=!0);for(let s=0;s<x;s++){l.webkit602BugfixHelper(c,h);var a=g[s];a instanceof N?this.applyAttachmentTimeline(a,e,f,h,d):a.apply(e,u,f,p,c,h,t.MixDirection.mixIn)}}else{let s=o.timelineMode,i=o.shortestRotation,n=!i&&o.timelinesRotation.length!=x<<1;n&&(o.timelinesRotation.length=x<<1);for(let a=0;a<x;a++){let r=g[a],m=s[a]==ht?h:t.MixBlend.setup;!i&&r instanceof k?this.applyRotateTimeline(r,e,f,c,m,o.timelinesRotation,a<<1,n):r instanceof N?this.applyAttachmentTimeline(r,e,f,h,d):(l.webkit602BugfixHelper(c,h),r.apply(e,u,f,p,c,m,t.MixDirection.mixIn))}}this.queueEvents(o,m),s.length=0,o.nextAnimationLast=m,o.nextTrackLast=o.trackTime}for(var r=this.unkeyedState+ft,o=e.slots,h=0,c=e.slots.length;h<c;h++){var d=o[h];if(d.attachmentState==r){var u=d.data.attachmentName;d.setAttachment(u?e.getAttachment(d.data.index,u):null)}}return this.unkeyedState+=2,this.queue.drain(),n}applyMixingFrom(e,s,i){let n=e.mixingFrom;n.mixingFrom&&this.applyMixingFrom(n,s,i);let a=0;0==e.mixDuration?(a=1,i==t.MixBlend.first&&(i=t.MixBlend.setup)):(a=e.mixTime/e.mixDuration,a>1&&(a=1),i!=t.MixBlend.first&&(i=n.mixBlend));let r=a<n.mixAttachmentThreshold,o=a<n.mixDrawOrderThreshold,h=n.animation.timelines,c=h.length,d=n.alpha*e.interruptAlpha,u=d*(1-a),m=n.animationLast,f=n.getAnimationTime(),p=f,g=null;if(n.reverse?p=n.animation.duration-p:a<n.eventThreshold&&(g=this.events),i==t.MixBlend.add)for(let e=0;e<c;e++)h[e].apply(s,m,p,g,u,i,t.MixDirection.mixOut);else{let e=n.timelineMode,a=n.timelineHoldMix,f=n.shortestRotation,x=!f&&n.timelinesRotation.length!=c<<1;x&&(n.timelinesRotation.length=c<<1),n.totalAlpha=0;for(let w=0;w<c;w++){let c,b=h[w],y=t.MixDirection.mixOut,M=0;switch(e[w]){case ht:if(!o&&b instanceof U)continue;c=i,M=u;break;case ct:c=t.MixBlend.setup,M=u;break;case dt:c=i,M=d;break;case ut:c=t.MixBlend.setup,M=d;break;default:c=t.MixBlend.setup;let e=a[w];M=d*Math.max(0,1-e.mixTime/e.mixDuration)}n.totalAlpha+=M,!f&&b instanceof k?this.applyRotateTimeline(b,s,p,M,c,n.timelinesRotation,w<<1,x):b instanceof N?this.applyAttachmentTimeline(b,s,p,c,r&&M>=n.alphaAttachmentThreshold):(l.webkit602BugfixHelper(M,i),o&&b instanceof U&&c==t.MixBlend.setup&&(y=t.MixDirection.mixIn),b.apply(s,m,p,g,M,c,y))}}return e.mixDuration>0&&this.queueEvents(n,f),this.events.length=0,n.nextAnimationLast=f,n.nextTrackLast=n.trackTime,a}applyAttachmentTimeline(e,s,i,n,a){var r=s.slots[e.slotIndex];r.bone.active&&(i<e.frames[0]?n!=t.MixBlend.setup&&n!=t.MixBlend.first||this.setAttachment(s,r,r.data.attachmentName,a):this.setAttachment(s,r,e.attachmentNames[y.search1(e.frames,i)],a),r.attachmentState<=this.unkeyedState&&(r.attachmentState=this.unkeyedState+ft))}setAttachment(t,e,s,i){e.setAttachment(s?t.getAttachment(e.data.index,s):null),i&&(e.attachmentState=this.unkeyedState+pt)}applyRotateTimeline(e,s,i,n,r,o,l,h){if(h&&(o[l]=0),1==n)return void e.apply(s,0,i,null,1,r,t.MixDirection.mixIn);let c=s.bones[e.boneIndex];if(!c.active)return;let d=0,u=0;if(i<e.frames[0])switch(r){case t.MixBlend.setup:c.rotation=c.data.rotation;default:return;case t.MixBlend.first:d=c.rotation,u=c.data.rotation}else d=r==t.MixBlend.setup?c.data.rotation:c.rotation,u=c.data.rotation+e.getCurveValue(i);let m=0,f=u-d;if(f-=360*Math.ceil(f/360-.5),0==f)m=o[l];else{let t=0,e=0;h?(t=0,e=f):(t=o[l],e=o[l+1]);let s=t-t%360;m=f+s;let i=f>=0,n=t>=0;Math.abs(e)<=90&&a.signum(e)!=a.signum(f)&&(Math.abs(t-s)>180?(m+=360*a.signum(t),n=i):0!=s?m-=360*a.signum(t):n=i),n!=i&&(m+=360*a.signum(t)),o[l]=m}o[l+1]=f,c.rotation=d+m*n}queueEvents(t,e){let s=t.animationStart,i=t.animationEnd,n=i-s,a=t.trackLast%n,r=this.events,o=0,l=r.length;for(;o<l;o++){let e=r[o];if(e.time<a)break;e.time>i||this.queue.event(t,e)}let h=!1;if(t.loop)if(0==n)h=!0;else{const e=Math.floor(t.trackTime/n);h=e>0&&e>Math.floor(t.trackLast/n)}else h=e>=i&&t.animationLast<i;for(h&&this.queue.complete(t);o<l;o++){let e=r[o];e.time<s||this.queue.event(t,e)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,e=this.tracks.length;t<e;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t>=this.tracks.length)return;let e=this.tracks[t];if(!e)return;this.queue.end(e),this.clearNext(e);let s=e;for(;;){let t=s.mixingFrom;if(!t)break;this.queue.end(t),s.mixingFrom=null,s.mixingTo=null,s=t}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,s){let i=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,i&&(s&&this.queue.interrupt(i),e.mixingFrom=i,i.mixingTo=e,e.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(e.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let i=this.data.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,i,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let i=!0,n=this.expandToIndex(t);n&&(-1==n.nextTrackLast?(this.tracks[t]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,i=!1):this.clearNext(n));let a=this.trackEntry(t,e,s,n);return this.setCurrent(t,a,i),this.queue.drain(),a}addAnimation(t,e,s=!1,i=0){let n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,n,s,i)}addAnimationWith(t,e,s=!1,i=0){if(!e)throw new Error("animation cannot be null.");let n=this.expandToIndex(t);if(n)for(;n.next;)n=n.next;let a=this.trackEntry(t,e,s,n);return n?(n.next=a,a.previous=n,i<=0&&(i+=n.getTrackComplete()-a.mixDuration)):(this.setCurrent(t,a,!0),this.queue.drain()),a.delay=i,a}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,at.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let i=this.addAnimationWith(t,at.emptyAnimation(),!1,s);return s<=0&&(i.delay+=i.mixDuration-e),i.mixDuration=e,i.trackEnd=e,i}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){let s=this.tracks[e];s&&this.setEmptyAnimation(s.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(l.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(e,s,i,n){let a=this.trackEntryPool.obtain();return a.reset(),a.trackIndex=e,a.animation=s,a.loop=i,a.holdPrevious=!1,a.reverse=!1,a.shortestRotation=!1,a.eventThreshold=0,a.alphaAttachmentThreshold=0,a.mixAttachmentThreshold=0,a.mixDrawOrderThreshold=0,a.animationStart=0,a.animationEnd=s.duration,a.animationLast=-1,a.nextAnimationLast=-1,a.delay=0,a.trackTime=0,a.trackLast=-1,a.nextTrackLast=-1,a.trackEnd=Number.MAX_VALUE,a.timeScale=1,a.alpha=1,a.mixTime=0,a.mixDuration=n?this.data.getMix(n.animation,s):0,a.interruptAlpha=1,a.totalAlpha=0,a.mixBlend=t.MixBlend.replace,a}clearNext(t){let e=t.next;for(;e;)this.queue.dispose(e),e=e.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do{i.mixingTo&&i.mixBlend==t.MixBlend.add||this.computeHold(i),i=i.mixingTo}while(i)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,i=t.animation.timelines.length,n=t.timelineMode;n.length=i;let a=t.timelineHoldMix;a.length=0;let r=this.propertyIDs;if(e&&e.holdPrevious)for(let t=0;t<i;t++)n[t]=r.addAll(s[t].getPropertyIds())?ut:dt;else t:for(let o=0;o<i;o++){let i=s[o],l=i.getPropertyIds();if(r.addAll(l))if(!e||i instanceof N||i instanceof U||i instanceof q||!e.animation.hasTimeline(l))n[o]=ct;else{for(let s=e.mixingTo;s;s=s.mixingTo)if(!s.animation.hasTimeline(l)){if(t.mixDuration>0){n[o]=mt,a[o]=s;continue t}break}n[o]=ut}else n[o]=ht}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){let e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}}class rt{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,null!=this.previous&&e<=0&&(e+=this.previous.getTrackComplete()-t),this.delay=e}mixBlend=t.MixBlend.replace;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(0!=t){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return-1!=this.nextTrackLast}isNextReady(){return null!=this.next&&this.nextTrackLast-this.next.delay>=0}}class ot{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(e){this.objects.push(t.EventType.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(t.EventType.interrupt),this.objects.push(e)}end(e){this.objects.push(t.EventType.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(t.EventType.dispose),this.objects.push(e)}complete(e){this.objects.push(t.EventType.complete),this.objects.push(e)}event(e,s){this.objects.push(t.EventType.event),this.objects.push(e),this.objects.push(s)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,s=this.animState.listeners;for(let i=0;i<e.length;i+=2){let n=e[i],a=e[i+1];switch(n){case t.EventType.start:a.listener&&a.listener.start&&a.listener.start(a);for(let t=0;t<s.length;t++){let e=s[t];e.start&&e.start(a)}break;case t.EventType.interrupt:a.listener&&a.listener.interrupt&&a.listener.interrupt(a);for(let t=0;t<s.length;t++){let e=s[t];e.interrupt&&e.interrupt(a)}break;case t.EventType.end:a.listener&&a.listener.end&&a.listener.end(a);for(let t=0;t<s.length;t++){let e=s[t];e.end&&e.end(a)}case t.EventType.dispose:a.listener&&a.listener.dispose&&a.listener.dispose(a);for(let t=0;t<s.length;t++){let e=s[t];e.dispose&&e.dispose(a)}this.animState.trackEntryPool.free(a);break;case t.EventType.complete:a.listener&&a.listener.complete&&a.listener.complete(a);for(let t=0;t<s.length;t++){let e=s[t];e.complete&&e.complete(a)}break;case t.EventType.event:let n=e[2+i++];a.listener&&a.listener.event&&a.listener.event(a,n);for(let t=0;t<s.length;t++){let e=s[t];e.event&&e.event(a,n)}}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}}var lt;t.EventType=void 0,(lt=t.EventType||(t.EventType={}))[lt.start=0]="start",lt[lt.interrupt=1]="interrupt",lt[lt.end=2]="end",lt[lt.dispose=3]="dispose",lt[lt.complete=4]="complete",lt[lt.event=5]="event";const ht=0,ct=1,dt=2,ut=3,mt=4,ft=1,pt=2;class gt{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);let n=this.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);this.setMixWith(i,n,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let i=t.name+"."+e.name;this.animationToMixTime[i]=s}getMix(t,e){let s=t.name+"."+e.name,i=this.animationToMixTime[s];return void 0===i?this.defaultMix:i}}class xt extends u{color=new n(1,1,1,1);constructor(t){super(t)}copy(){let t=new xt(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class wt extends u{endSlot=null;color=new n(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new wt(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class bt{_image;constructor(t){this._image=t}getImage(){return this._image}}var yt,Mt,St,vt,kt,It,At,Tt,Bt;t.TextureFilter=void 0,(yt=t.TextureFilter||(t.TextureFilter={}))[yt.Nearest=9728]="Nearest",yt[yt.Linear=9729]="Linear",yt[yt.MipMap=9987]="MipMap",yt[yt.MipMapNearestNearest=9984]="MipMapNearestNearest",yt[yt.MipMapLinearNearest=9985]="MipMapLinearNearest",yt[yt.MipMapNearestLinear=9986]="MipMapNearestLinear",yt[yt.MipMapLinearLinear=9987]="MipMapLinearLinear",t.TextureWrap=void 0,(Mt=t.TextureWrap||(t.TextureWrap={}))[Mt.MirroredRepeat=33648]="MirroredRepeat",Mt[Mt.ClampToEdge=33071]="ClampToEdge",Mt[Mt.Repeat=10497]="Repeat";class Ct{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0}class Ft{pages=new Array;regions=new Array;constructor(e){let s=new Et(e),i=new Array(4),n={size:t=>{t.width=parseInt(i[1]),t.height=parseInt(i[2])},format:()=>{},filter:e=>{e.minFilter=l.enumValue(t.TextureFilter,i[1]),e.magFilter=l.enumValue(t.TextureFilter,i[2])},repeat:e=>{-1!=i[1].indexOf("x")&&(e.uWrap=t.TextureWrap.Repeat),-1!=i[1].indexOf("y")&&(e.vWrap=t.TextureWrap.Repeat)},pma:t=>{t.pma="true"==i[1]}};var a={xy:t=>{t.x=parseInt(i[1]),t.y=parseInt(i[2])},size:t=>{t.width=parseInt(i[1]),t.height=parseInt(i[2])},bounds:t=>{t.x=parseInt(i[1]),t.y=parseInt(i[2]),t.width=parseInt(i[3]),t.height=parseInt(i[4])},offset:t=>{t.offsetX=parseInt(i[1]),t.offsetY=parseInt(i[2])},orig:t=>{t.originalWidth=parseInt(i[1]),t.originalHeight=parseInt(i[2])},offsets:t=>{t.offsetX=parseInt(i[1]),t.offsetY=parseInt(i[2]),t.originalWidth=parseInt(i[3]),t.originalHeight=parseInt(i[4])},rotate:t=>{let e=i[1];"true"==e?t.degrees=90:"false"!=e&&(t.degrees=parseInt(e))},index:t=>{t.index=parseInt(i[1])}};let r=s.readLine();for(;r&&0==r.trim().length;)r=s.readLine();for(;r&&0!=r.trim().length&&0!=s.readEntry(i,r);)r=s.readLine();let o=null,h=null,c=null;for(;null!==r;)if(0==r.trim().length)o=null,r=s.readLine();else if(o){let t=new Yt(o,r);for(;;){let e=s.readEntry(i,r=s.readLine());if(0==e)break;let n=a[i[0]];if(n)n(t);else{h||(h=[]),c||(c=[]),h.push(i[0]);let t=[];for(let s=0;s<e;s++)t.push(parseInt(i[s+1]));c.push(t)}}0==t.originalWidth&&0==t.originalHeight&&(t.originalWidth=t.width,t.originalHeight=t.height),h&&h.length>0&&c&&c.length>0&&(t.names=h,t.values=c,h=null,c=null),t.u=t.x/o.width,t.v=t.y/o.height,90==t.degrees?(t.u2=(t.x+t.height)/o.width,t.v2=(t.y+t.width)/o.height):(t.u2=(t.x+t.width)/o.width,t.v2=(t.y+t.height)/o.height),this.regions.push(t)}else{for(o=new Rt(r.trim());0!=s.readEntry(i,r=s.readLine());){let t=n[i[0]];t&&t(o)}this.pages.push(o)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}}class Et{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e)return 0;if(0==(e=e.trim()).length)return 0;let s=e.indexOf(":");if(-1==s)return 0;t[0]=e.substr(0,s).trim();for(let i=1,n=s+1;;i++){let s=e.indexOf(",",n);if(-1==s)return t[i]=e.substr(n).trim(),i;if(t[i]=e.substr(n,s-n).trim(),n=s+1,4==i)return 4}}}class Rt{name;minFilter=t.TextureFilter.Nearest;magFilter=t.TextureFilter.Nearest;uWrap=t.TextureWrap.ClampToEdge;vWrap=t.TextureWrap.ClampToEdge;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}}class Yt extends Ct{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}}class Pt extends u{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new n(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new n(0,0,0,0);constructor(t,e){super(t),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;this.uvs&&this.uvs.length==t.length||(this.uvs=l.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,i=this.region.u,n=this.region.v,a=0,r=0;if(this.region instanceof Yt){let o=this.region,l=o.page,h=l.width,c=l.height;switch(o.degrees){case 90:i-=(o.originalHeight-o.offsetY-o.height)/h,n-=(o.originalWidth-o.offsetX-o.width)/c,a=o.originalHeight/h,r=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=i+t[o+1]*a,e[o+1]=n+(1-t[o])*r;return;case 180:i-=(o.originalWidth-o.offsetX-o.width)/h,n-=o.offsetY/c,a=o.originalWidth/h,r=o.originalHeight/c;for(let o=0;o<s;o+=2)e[o]=i+(1-t[o])*a,e[o+1]=n+(1-t[o+1])*r;return;case 270:i-=o.offsetY/h,n-=o.offsetX/c,a=o.originalHeight/h,r=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=i+(1-t[o+1])*a,e[o+1]=n+t[o]*r;return}i-=o.offsetX/h,n-=(o.originalHeight-o.offsetY-o.height)/c,a=o.originalWidth/h,r=o.originalHeight/c}else this.region?(a=this.region.u2-i,r=this.region.v2-n):(i=n=0,a=r=1);for(let o=0;o<s;o+=2)e[o]=i+t[o]*a,e[o+1]=n+t[o+1]*r}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new Pt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),l.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),l.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),l.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=null!=this.sequence?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),l.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,i,n,a){null!=this.sequence&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,i,n,a)}newLinkedMesh(){let t=new Pt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),null!=t.region&&t.updateRegion(),t}}class Xt extends u{lengths=[];closed=!1;constantSpeed=!1;color=new n(1,1,1,1);constructor(t){super(t)}copy(){let t=new Xt(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),l.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class _t extends u{x=0;y=0;rotation=0;color=new n(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,e){return e.x=this.x*t.a+this.y*t.b+t.worldX,e.y=this.x*t.c+this.y*t.d+t.worldY,e}computeWorldRotation(t){const e=this.rotation*a.degRad,s=Math.cos(e),i=Math.sin(e),n=s*t.a+i*t.b,r=s*t.c+i*t.d;return a.atan2Deg(r,n)}copy(){let t=new _t(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}class Vt extends d{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new n(1,1,1,1);path;region=null;sequence=null;offset=l.newFloatArray(8);uvs=l.newFloatArray(8);tempColor=new n(1,1,1,1);constructor(t,e){super(t),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,e=this.uvs;if(null==t)return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=1,e[5]=1,e[6]=1,void(e[7]=0);let s=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*s,r=-this.height/2*this.scaleY+this.region.offsetY*i,o=n+this.region.width*s,l=r+this.region.height*i,h=this.rotation*a.degRad,c=Math.cos(h),d=Math.sin(h),u=this.x,m=this.y,f=n*c+u,p=n*d,g=r*c+m,x=r*d,w=o*c+u,b=o*d,y=l*c+m,M=l*d,S=this.offset;S[0]=f-x,S[1]=g+p,S[2]=f-M,S[3]=y+p,S[4]=w-M,S[5]=y+b,S[6]=w-x,S[7]=g+b,90==t.degrees?(e[0]=t.u2,e[1]=t.v2,e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,i){null!=this.sequence&&this.sequence.apply(t,this);let n=t.bone,a=this.offset,r=n.worldX,o=n.worldY,l=n.a,h=n.b,c=n.c,d=n.d,u=0,m=0;u=a[0],m=a[1],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o,s+=i,u=a[2],m=a[3],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o,s+=i,u=a[4],m=a[5],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o,s+=i,u=a[6],m=a[7],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o}copy(){let t=new Vt(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,l.arrayCopy(this.uvs,0,t.uvs,0,8),l.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=null!=this.sequence?this.sequence.copy():null,t}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31}class Dt{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let i=s.regions;for(let n=0,a=i.length;n<a;n++){let a=s.getPath(e,n),r=this.atlas.findRegion(a);if(null==r)throw new Error("Region not found in atlas: "+a+" (sequence: "+t+")");i[n]=r}}newRegionAttachment(t,e,s,i){let n=new Vt(e,s);if(null!=i)this.loadSequence(e,s,i);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");n.region=t}return n}newMeshAttachment(t,e,s,i){let n=new Pt(e,s);if(null!=i)this.loadSequence(e,s,i);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");n.region=t}return n}newBoundingBoxAttachment(t,e){return new xt(e)}newPathAttachment(t,e){return new Xt(e)}newPointAttachment(t,e){return new _t(e)}newClippingAttachment(t,e){return new wt(e)}}class Ot{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=t.Inherit.Normal;skinRequired=!1;color=new n;icon;visible=!1;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}}t.Inherit=void 0,(St=t.Inherit||(t.Inherit={}))[St.Normal=0]="Normal",St[St.OnlyTranslation=1]="OnlyTranslation",St[St.NoRotationOrReflection=2]="NoRotationOrReflection",St[St.NoScale=3]="NoScale",St[St.NoScaleOrReflection=4]="NoScaleOrReflection";class Nt{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=t.Inherit.Normal;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,s,i,n,r,o,l){this.ax=e,this.ay=s,this.arotation=i,this.ascaleX=n,this.ascaleY=r,this.ashearX=o,this.ashearY=l;let h=this.parent;if(!h){let t=this.skeleton;const h=t.scaleX,c=t.scaleY,d=(i+o)*a.degRad,u=(i+90+l)*a.degRad;return this.a=Math.cos(d)*n*h,this.b=Math.cos(u)*r*h,this.c=Math.sin(d)*n*c,this.d=Math.sin(u)*r*c,this.worldX=e*h+t.x,void(this.worldY=s*c+t.y)}let c=h.a,d=h.b,u=h.c,m=h.d;switch(this.worldX=c*e+d*s+h.worldX,this.worldY=u*e+m*s+h.worldY,this.inherit){case t.Inherit.Normal:{const t=(i+o)*a.degRad,e=(i+90+l)*a.degRad,s=Math.cos(t)*n,h=Math.cos(e)*r,f=Math.sin(t)*n,p=Math.sin(e)*r;return this.a=c*s+d*f,this.b=c*h+d*p,this.c=u*s+m*f,void(this.d=u*h+m*p)}case t.Inherit.OnlyTranslation:{const t=(i+o)*a.degRad,e=(i+90+l)*a.degRad;this.a=Math.cos(t)*n,this.b=Math.cos(e)*r,this.c=Math.sin(t)*n,this.d=Math.sin(e)*r;break}case t.Inherit.NoRotationOrReflection:{let t=c*c+u*u,e=0;t>1e-4?(t=Math.abs(c*m-d*u)/t,c/=this.skeleton.scaleX,u/=this.skeleton.scaleY,d=u*t,m=c*t,e=Math.atan2(u,c)*a.radDeg):(c=0,u=0,e=90-Math.atan2(m,d)*a.radDeg);const s=(i+o-e)*a.degRad,h=(i+l-e+90)*a.degRad,f=Math.cos(s)*n,p=Math.cos(h)*r,g=Math.sin(s)*n,x=Math.sin(h)*r;this.a=c*f-d*g,this.b=c*p-d*x,this.c=u*f+m*g,this.d=u*p+m*x;break}case t.Inherit.NoScale:case t.Inherit.NoScaleOrReflection:{i*=a.degRad;const e=Math.cos(i),s=Math.sin(i);let h=(c*e+d*s)/this.skeleton.scaleX,f=(u*e+m*s)/this.skeleton.scaleY,p=Math.sqrt(h*h+f*f);p>1e-5&&(p=1/p),h*=p,f*=p,p=Math.sqrt(h*h+f*f),this.inherit==t.Inherit.NoScale&&c*m-d*u<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p),i=Math.PI/2+Math.atan2(f,h);const g=Math.cos(i)*p,x=Math.sin(i)*p;o*=a.degRad,l=(90+l)*a.degRad;const w=Math.cos(o)*n,b=Math.cos(l)*r,y=Math.sin(o)*n,M=Math.sin(l)*r;this.a=h*w+g*y,this.b=h*b+g*M,this.c=f*w+x*y,this.d=f*b+x*M;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let e=this.parent;if(!e)return this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*a.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,void(this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*a.radDeg);let s,i,n,r,o=e.a,l=e.b,h=e.c,c=e.d,d=1/(o*c-l*h),u=c*d,m=l*d,f=h*d,p=o*d,g=this.worldX-e.worldX,x=this.worldY-e.worldY;if(this.ax=g*u-x*m,this.ay=x*p-g*f,this.inherit==t.Inherit.OnlyTranslation)s=this.a,i=this.b,n=this.c,r=this.d;else{switch(this.inherit){case t.Inherit.NoRotationOrReflection:{let t=Math.abs(o*c-l*h)/(o*o+h*h),e=o/this.skeleton.scaleX;l=-(h/this.skeleton.scaleY)*t*this.skeleton.scaleX,c=e*t*this.skeleton.scaleY,d=1/(o*c-l*h),u=c*d,m=l*d;break}case t.Inherit.NoScale:case t.Inherit.NoScaleOrReflection:let e=a.cosDeg(this.rotation),s=a.sinDeg(this.rotation);o=(o*e+l*s)/this.skeleton.scaleX,h=(h*e+c*s)/this.skeleton.scaleY;let i=Math.sqrt(o*o+h*h);i>1e-5&&(i=1/i),o*=i,h*=i,i=Math.sqrt(o*o+h*h),this.inherit==t.Inherit.NoScale&&d<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(i=-i);let n=a.PI/2+Math.atan2(h,o);l=Math.cos(n)*i,c=Math.sin(n)*i,d=1/(o*c-l*h),u=c*d,m=l*d,f=h*d,p=o*d}s=u*this.a-m*this.c,i=u*this.b-m*this.d,n=p*this.c-f*this.a,r=p*this.d-f*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(s*s+n*n),this.ascaleX>1e-4){let t=s*r-i*n;this.ascaleY=t/this.ascaleX,this.ashearY=-Math.atan2(s*i+n*r,t)*a.radDeg,this.arotation=Math.atan2(n,s)*a.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(i*i+r*r),this.ashearY=0,this.arotation=90-Math.atan2(r,i)*a.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*a.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*a.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,i=t.y-this.worldY;return t.x=s*this.d*e-i*this.b*e,t.y=i*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.worldToLocal(t)}parentToWorld(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=a.sinDeg(t),s=a.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*a.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=a.sinDeg(t),s=a.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*a.radDeg}rotateWorld(t){t*=a.degRad;const e=Math.sin(t),s=Math.cos(t),i=this.a,n=this.b;this.a=s*i-e*this.c,this.b=s*n-e*this.d,this.c=e*i+s*this.c,this.d=e*n+s*this.d}}class Lt{name;order;skinRequired;constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}class qt{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return-1!=e?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,i=new Uint8Array(s),n=0;n<s;n++)i[n]=e.charCodeAt(n);return i}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(-1==e)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToString(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",t,!0);let n=()=>{this.finish(t,i.status,i.responseText)};i.onload=n,i.onerror=n,i.send()}downloadJson(t,e,s){this.downloadText(t,(t=>{e(JSON.parse(t))}),s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToUint8Array(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer";let n=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{200==i.status||0==i.status?this.finish(t,200,new Uint8Array(i.response)):n()},i.onerror=n,i.send()}start(t,e,s){let i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,s)}}finish(t,e,s){let i=this.callbacks[t];delete this.callbacks[t];let n=200==e||0==e?[s]:[e,s];for(let t=n.length-1,e=i.length;t<e;t+=2)i[t].apply(null,n)}}class Ut{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}}class Wt{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}}class zt{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(0==this.mix)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix)}}apply1(e,s,i,n,r,o,l){let h=e.parent;if(!h)throw new Error("IK bone must have parent.");let c=h.a,d=h.b,u=h.c,m=h.d,f=-e.ashearX-e.arotation,p=0,g=0;switch(e.inherit){case t.Inherit.OnlyTranslation:p=(s-e.worldX)*a.signum(e.skeleton.scaleX),g=(i-e.worldY)*a.signum(e.skeleton.scaleY);break;case t.Inherit.NoRotationOrReflection:let n=Math.abs(c*m-d*u)/Math.max(1e-4,c*c+u*u),r=c/e.skeleton.scaleX,o=u/e.skeleton.scaleY;d=-o*n*e.skeleton.scaleX,m=r*n*e.skeleton.scaleY,f+=Math.atan2(o,r)*a.radDeg;default:let l=s-h.worldX,x=i-h.worldY,w=c*m-d*u;Math.abs(w)<=1e-4?(p=0,g=0):(p=(l*m-x*d)/w-e.ax,g=(x*c-l*u)/w-e.ay)}f+=Math.atan2(g,p)*a.radDeg,e.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let x=e.ascaleX,w=e.ascaleY;if(n||r){switch(e.inherit){case t.Inherit.NoScale:case t.Inherit.NoScaleOrReflection:p=s-e.worldX,g=i-e.worldY}const a=e.data.length*x;if(a>1e-4){const t=p*p+g*g;if(n&&t<a*a||r&&t>a*a){const e=(Math.sqrt(t)/a-1)*l+1;x*=e,o&&(w*=e)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+f*l,x,w,e.ashearX,e.ashearY)}apply2(e,s,i,n,r,o,l,h,c){if(e.inherit!=t.Inherit.Normal||s.inherit!=t.Inherit.Normal)return;let d=e.ax,u=e.ay,m=e.ascaleX,f=e.ascaleY,p=m,g=f,x=s.ascaleX,w=0,b=0,y=0;m<0?(m=-m,w=180,y=-1):(w=0,y=1),f<0&&(f=-f,y=-y),x<0?(x=-x,b=180):b=0;let M=s.ax,S=0,v=0,k=0,I=e.a,A=e.b,T=e.c,B=e.d,C=Math.abs(m-f)<=1e-4;!C||o?(S=0,v=I*M+e.worldX,k=T*M+e.worldY):(S=s.ay,v=I*M+A*S+e.worldX,k=T*M+B*S+e.worldY);let F=e.parent;if(!F)throw new Error("IK parent must itself have a parent.");I=F.a,A=F.b,T=F.c,B=F.d;let E=I*B-A*T,R=v-F.worldX,Y=k-F.worldY;E=Math.abs(E)<=1e-4?0:1/E;let P,X,_=(R*B-Y*A)*E-d,V=(Y*I-R*T)*E-u,D=Math.sqrt(_*_+V*V),O=s.data.length*x;if(D<1e-4)return this.apply1(e,i,n,!1,o,!1,c),void s.updateWorldTransformWith(M,S,0,s.ascaleX,s.ascaleY,s.ashearX,s.ashearY);R=i-F.worldX,Y=n-F.worldY;let N=(R*B-Y*A)*E-d,L=(Y*I-R*T)*E-u,q=N*N+L*L;if(0!=h){h*=m*(x+1)*.5;let t=Math.sqrt(q),e=t-D-O*m+h;if(e>0){let s=Math.min(1,e/(2*h))-1;s=(e-h*(1-s*s))/t,N-=s*N,L-=s*L,q=N*N+L*L}}t:if(C){O*=m;let t=(q-D*D-O*O)/(2*D*O);t<-1?(t=-1,X=Math.PI*r):t>1?(t=1,X=0,o&&(I=(Math.sqrt(q)/(D+O)-1)*c+1,p*=I,l&&(g*=I))):X=Math.acos(t)*r,I=D+O*t,A=O*Math.sin(X),P=Math.atan2(L*I-N*A,N*I+L*A)}else{I=m*O,A=f*O;let t=I*I,e=A*A,s=Math.atan2(L,N);T=e*D*D+t*q-t*e;let i=-2*e*D,n=e-t;if(B=i*i-4*n*T,B>=0){let t=Math.sqrt(B);i<0&&(t=-t),t=.5*-(i+t);let e=t/n,a=T/t,o=Math.abs(e)<Math.abs(a)?e:a;if(o*o<=q){Y=Math.sqrt(q-o*o)*r,P=s-Math.atan2(Y,o),X=Math.atan2(Y/f,(o-D)/m);break t}}let o=a.PI,l=D-I,h=l*l,c=0,d=0,u=D+I,p=u*u,g=0;T=-I*D/(t-e),T>=-1&&T<=1&&(T=Math.acos(T),R=I*Math.cos(T)+D,Y=A*Math.sin(T),B=R*R+Y*Y,B<h&&(o=T,h=B,l=R,c=Y),B>p&&(d=T,p=B,u=R,g=Y)),q<=.5*(h+p)?(P=s-Math.atan2(c*r,l),X=o*r):(P=s-Math.atan2(g*r,u),X=d*r)}let U=Math.atan2(S,M)*y,W=e.arotation;P=(P-U)*a.radDeg+w-W,P>180?P-=360:P<-180&&(P+=360),e.updateWorldTransformWith(d,u,W+P*c,p,g,0,0),W=s.arotation,X=((X+U)*a.radDeg-s.ashearX)*y+b-W,X>180?X-=360:X<-180&&(X+=360),s.updateWorldTransformWith(M,S,W+X*c,s.ascaleX,s.ascaleY,s.ashearX,s.ashearY)}}class Gt extends Lt{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(t){super(t,0,!1)}}class $t extends Lt{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=t.PositionMode.Fixed;spacingMode=t.SpacingMode.Fixed;rotateMode=t.RotateMode.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}}t.PositionMode=void 0,(vt=t.PositionMode||(t.PositionMode={}))[vt.Fixed=0]="Fixed",vt[vt.Percent=1]="Percent",t.SpacingMode=void 0,(kt=t.SpacingMode||(t.SpacingMode={}))[kt.Length=0]="Length",kt[kt.Fixed=1]="Fixed",kt[kt.Percent=2]="Percent",kt[kt.Proportional=3]="Proportional",t.RotateMode=void 0,(It=t.RotateMode||(t.RotateMode={}))[It.Tangent=0]="Tangent",It[It.Chain=1]="Chain",It[It.ChainScale=2]="ChainScale";class jt{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0,i=t.bones.length;s<i;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(i)}let s=e.findSlot(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=s,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(e){let s=this.target.getAttachment();if(!(s instanceof Xt))return;let i=this.mixRotate,n=this.mixX,r=this.mixY;if(0==i&&0==n&&0==r)return;let o=this.data,h=o.rotateMode==t.RotateMode.Tangent,c=o.rotateMode==t.RotateMode.ChainScale,d=this.bones,u=d.length,m=h?u:u+1,f=l.setArraySize(this.spaces,m),p=c?this.lengths=l.setArraySize(this.lengths,u):[],g=this.spacing;switch(o.spacingMode){case t.SpacingMode.Percent:if(c)for(let t=0,e=m-1;t<e;t++){let e=d[t],s=e.data.length,i=s*e.a,n=s*e.c;p[t]=Math.sqrt(i*i+n*n)}l.arrayFill(f,1,m,g);break;case t.SpacingMode.Proportional:let e=0;for(let t=0,s=m-1;t<s;){let s=d[t],i=s.data.length;if(i<jt.epsilon)c&&(p[t]=0),f[++t]=g;else{let n=i*s.a,a=i*s.c,r=Math.sqrt(n*n+a*a);c&&(p[t]=r),f[++t]=r,e+=r}}if(e>0){e=m/e*g;for(let t=1;t<m;t++)f[t]*=e}break;default:let s=o.spacingMode==t.SpacingMode.Length;for(let t=0,e=m-1;t<e;){let e=d[t],i=e.data.length;if(i<jt.epsilon)c&&(p[t]=0),f[++t]=g;else{let n=i*e.a,a=i*e.c,r=Math.sqrt(n*n+a*a);c&&(p[t]=r),f[++t]=(s?i+g:g)*r/i}}}let x=this.computeWorldPositions(s,m,h),w=x[0],b=x[1],y=o.offsetRotation,M=!1;if(0==y)M=o.rotateMode==t.RotateMode.Chain;else{M=!1;let t=this.target.bone;y*=t.a*t.d-t.b*t.c>0?a.degRad:-a.degRad}for(let t=0,e=3;t<u;t++,e+=3){let s=d[t];s.worldX+=(w-s.worldX)*n,s.worldY+=(b-s.worldY)*r;let o=x[e],l=x[e+1],u=o-w,m=l-b;if(c){let e=p[t];if(0!=e){let t=(Math.sqrt(u*u+m*m)/e-1)*i+1;s.a*=t,s.c*=t}}if(w=o,b=l,i>0){let n=s.a,r=s.b,o=s.c,l=s.d,c=0,d=0,p=0;if(c=h?x[e-1]:0==f[t+1]?x[e+2]:Math.atan2(m,u),c-=Math.atan2(o,n),M){d=Math.cos(c),p=Math.sin(c);let t=s.data.length;w+=(t*(d*n-p*o)-u)*i,b+=(t*(p*n+d*o)-m)*i}else c+=y;c>a.PI?c-=a.PI2:c<-a.PI&&(c+=a.PI2),c*=i,d=Math.cos(c),p=Math.sin(c),s.a=d*n-p*o,s.b=d*r-p*l,s.c=p*n+d*o,s.d=p*r+d*l}s.updateAppliedTransform()}}computeWorldPositions(e,s,i){let n=this.target,a=this.position,r=this.spaces,o=l.setArraySize(this.positions,3*s+2),h=this.world,c=e.closed,d=e.worldVerticesLength,u=d/6,m=jt.NONE;if(!e.constantSpeed){let f=e.lengths;u-=c?1:2;let p,g=f[u];switch(this.data.positionMode==t.PositionMode.Percent&&(a*=g),this.data.spacingMode){case t.SpacingMode.Percent:p=g;break;case t.SpacingMode.Proportional:p=g/s;break;default:p=1}h=l.setArraySize(this.world,8);for(let t=0,l=0,x=0;t<s;t++,l+=3){let s=r[t]*p;a+=s;let w=a;if(c)w%=g,w<0&&(w+=g),x=0;else{if(w<0){m!=jt.BEFORE&&(m=jt.BEFORE,e.computeWorldVertices(n,2,4,h,0,2)),this.addBeforePosition(w,h,0,o,l);continue}if(w>g){m!=jt.AFTER&&(m=jt.AFTER,e.computeWorldVertices(n,d-6,4,h,0,2)),this.addAfterPosition(w-g,h,0,o,l);continue}}for(;;x++){let t=f[x];if(!(w>t)){if(0==x)w/=t;else{let e=f[x-1];w=(w-e)/(t-e)}break}}x!=m&&(m=x,c&&x==u?(e.computeWorldVertices(n,d-4,4,h,0,2),e.computeWorldVertices(n,0,4,h,4,2)):e.computeWorldVertices(n,6*x+2,8,h,0,2)),this.addCurvePosition(w,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],o,l,i||t>0&&0==s)}return o}c?(d+=2,h=l.setArraySize(this.world,d),e.computeWorldVertices(n,2,d-4,h,0,2),e.computeWorldVertices(n,0,2,h,d-4,2),h[d-2]=h[0],h[d-1]=h[1]):(u--,d-=4,h=l.setArraySize(this.world,d),e.computeWorldVertices(n,2,d,h,0,2));let f,p=l.setArraySize(this.curves,u),g=0,x=h[0],w=h[1],b=0,y=0,M=0,S=0,v=0,k=0,I=0,A=0,T=0,B=0,C=0,F=0,E=0,R=0;for(let t=0,e=2;t<u;t++,e+=6)b=h[e],y=h[e+1],M=h[e+2],S=h[e+3],v=h[e+4],k=h[e+5],I=.1875*(x-2*b+M),A=.1875*(w-2*y+S),T=.09375*(3*(b-M)-x+v),B=.09375*(3*(y-S)-w+k),C=2*I+T,F=2*A+B,E=.75*(b-x)+I+.16666667*T,R=.75*(y-w)+A+.16666667*B,g+=Math.sqrt(E*E+R*R),E+=C,R+=F,C+=T,F+=B,g+=Math.sqrt(E*E+R*R),E+=C,R+=F,g+=Math.sqrt(E*E+R*R),E+=C+T,R+=F+B,g+=Math.sqrt(E*E+R*R),p[t]=g,x=v,w=k;switch(this.data.positionMode==t.PositionMode.Percent&&(a*=g),this.data.spacingMode){case t.SpacingMode.Percent:f=g;break;case t.SpacingMode.Proportional:f=g/s;break;default:f=1}let Y=this.segments,P=0;for(let t=0,e=0,n=0,l=0;t<s;t++,e+=3){let s=r[t]*f;a+=s;let u=a;if(c)u%=g,u<0&&(u+=g),n=0;else{if(u<0){this.addBeforePosition(u,h,0,o,e);continue}if(u>g){this.addAfterPosition(u-g,h,d-4,o,e);continue}}for(;;n++){let t=p[n];if(!(u>t)){if(0==n)u/=t;else{let e=p[n-1];u=(u-e)/(t-e)}break}}if(n!=m){m=n;let t=6*n;for(x=h[t],w=h[t+1],b=h[t+2],y=h[t+3],M=h[t+4],S=h[t+5],v=h[t+6],k=h[t+7],I=.03*(x-2*b+M),A=.03*(w-2*y+S),T=.006*(3*(b-M)-x+v),B=.006*(3*(y-S)-w+k),C=2*I+T,F=2*A+B,E=.3*(b-x)+I+.16666667*T,R=.3*(y-w)+A+.16666667*B,P=Math.sqrt(E*E+R*R),Y[0]=P,t=1;t<8;t++)E+=C,R+=F,C+=T,F+=B,P+=Math.sqrt(E*E+R*R),Y[t]=P;E+=C,R+=F,P+=Math.sqrt(E*E+R*R),Y[8]=P,E+=C+T,R+=F+B,P+=Math.sqrt(E*E+R*R),Y[9]=P,l=0}for(u*=P;;l++){let t=Y[l];if(!(u>t)){if(0==l)u/=t;else{let e=Y[l-1];u=l+(u-e)/(t-e)}break}}this.addCurvePosition(.1*u,x,w,b,y,M,S,v,k,o,e,i||t>0&&0==s)}return o}addBeforePosition(t,e,s,i,n){let a=e[s],r=e[s+1],o=e[s+2]-a,l=e[s+3]-r,h=Math.atan2(l,o);i[n]=a+t*Math.cos(h),i[n+1]=r+t*Math.sin(h),i[n+2]=h}addAfterPosition(t,e,s,i,n){let a=e[s+2],r=e[s+3],o=a-e[s],l=r-e[s+1],h=Math.atan2(l,o);i[n]=a+t*Math.cos(h),i[n+1]=r+t*Math.sin(h),i[n+2]=h}addCurvePosition(t,e,s,i,n,a,r,o,l,h,c,d){if(0==t||isNaN(t))return h[c]=e,h[c+1]=s,void(h[c+2]=Math.atan2(n-s,i-e));let u=t*t,m=u*t,f=1-t,p=f*f,g=p*f,x=f*t,w=3*x,b=f*w,y=w*t,M=e*g+i*b+a*y+o*m,S=s*g+n*b+r*y+l*m;h[c]=M,h[c+1]=S,d&&(h[c+2]=t<.001?Math.atan2(n-s,i-e):Math.atan2(S-(s*p+n*x*2+r*u),M-(e*p+i*x*2+a*u)))}}class Ht{data;_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(e){const s=this.mix;if(0==s)return;const i=this.data.x>0,n=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,o=this.data.scaleX>0,l=this.bone,h=l.data.length;switch(e){case t.Physics.none:return;case t.Physics.reset:this.reset();case t.Physics.update:const e=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=e,this.lastTime=this.skeleton.time;const c=l.worldX,d=l.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let t=this.remaining,u=this.inertia,m=this.data.limit*e,f=this.data.step,p=this.skeleton.data.referenceScale,g=-1;if(i||n){if(i){const t=(this.ux-c)*u;this.xOffset+=t>m?m:t<-m?-m:t,this.ux=c}if(n){const t=(this.uy-d)*u;this.yOffset+=t>m?m:t<-m?-m:t,this.uy=d}if(t>=f){g=Math.pow(this.damping,60*f);const e=this.massInverse*f,s=this.strength,a=this.wind*p,r=(Qt.yDown?-this.gravity:this.gravity)*p;do{i&&(this.xVelocity+=(a-this.xOffset*s)*e,this.xOffset+=this.xVelocity*f,this.xVelocity*=g),n&&(this.yVelocity-=(r+this.yOffset*s)*e,this.yOffset+=this.yVelocity*f,this.yVelocity*=g),t-=f}while(t>=f)}i&&(l.worldX+=this.xOffset*s*this.data.x),n&&(l.worldY+=this.yOffset*s*this.data.y)}if(r||o){let e=Math.atan2(l.c,l.a),i=0,n=0,c=0,d=this.cx-l.worldX,x=this.cy-l.worldY;if(d>m?d=m:d<-m&&(d=-m),x>m?x=m:x<-m&&(x=-m),r){c=(this.data.rotate+this.data.shearX)*s;let t=Math.atan2(x+this.ty,d+this.tx)-e-this.rotateOffset*c;this.rotateOffset+=(t-Math.ceil(t*a.invPI2-.5)*a.PI2)*u,t=this.rotateOffset*c+e,i=Math.cos(t),n=Math.sin(t),o&&(t=h*l.getWorldScaleX(),t>0&&(this.scaleOffset+=(d*i+x*n)*u/t))}else{i=Math.cos(e),n=Math.sin(e);const t=h*l.getWorldScaleX();t>0&&(this.scaleOffset+=(d*i+x*n)*u/t)}if(t=this.remaining,t>=f){-1==g&&(g=Math.pow(this.damping,60*f));const s=this.massInverse*f,a=this.strength,l=this.wind,d=Qt.yDown?-this.gravity:this.gravity,u=h/p;for(;;)if(t-=f,o&&(this.scaleVelocity+=(l*i-d*n-this.scaleOffset*a)*s,this.scaleOffset+=this.scaleVelocity*f,this.scaleVelocity*=g),r){if(this.rotateVelocity-=((l*n+d*i)*u+this.rotateOffset*a)*s,this.rotateOffset+=this.rotateVelocity*f,this.rotateVelocity*=g,t<f)break;const r=this.rotateOffset*c+e;i=Math.cos(r),n=Math.sin(r)}else if(t<f)break}}this.remaining=t}this.cx=l.worldX,this.cy=l.worldY;break;case t.Physics.pose:i&&(l.worldX+=this.xOffset*s*this.data.x),n&&(l.worldY+=this.yOffset*s*this.data.y)}if(r){let t=this.rotateOffset*s,e=0,i=0,n=0;if(this.data.shearX>0){let s=0;this.data.rotate>0&&(s=t*this.data.rotate,e=Math.sin(s),i=Math.cos(s),n=l.b,l.b=i*n-e*l.d,l.d=e*n+i*l.d),s+=t*this.data.shearX,e=Math.sin(s),i=Math.cos(s),n=l.a,l.a=i*n-e*l.c,l.c=e*n+i*l.c}else t*=this.data.rotate,e=Math.sin(t),i=Math.cos(t),n=l.a,l.a=i*n-e*l.c,l.c=e*n+i*l.c,n=l.b,l.b=i*n-e*l.d,l.d=e*n+i*l.d}if(o){const t=1+this.scaleOffset*s*this.data.scaleX;l.a*=t,l.c*=t}e!=t.Physics.pose&&(this.tx=h*l.a,this.ty=h*l.c),l.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const i=s*a.degRad,n=Math.cos(i),r=Math.sin(i),o=this.cx-t,l=this.cy-e;this.translate(o*n-l*r-o,o*r+l*n-l)}}class Jt{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new n,this.darkColor=t.darkColor?new n:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof u&&this.attachment instanceof u&&t.timelineAttachment==this.attachment.timelineAttachment||(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}}class Kt{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new c;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){0==this.mixRotate&&0==this.mixX&&0==this.mixY&&0==this.mixScaleX&&0==this.mixScaleY&&0==this.mixShearY||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,o=0!=e||0!=s,l=this.target,h=l.a,c=l.b,d=l.c,u=l.d,m=h*u-c*d>0?a.degRad:-a.degRad,f=this.data.offsetRotation*m,p=this.data.offsetShearY*m,g=this.bones;for(let m=0,x=g.length;m<x;m++){let x=g[m];if(0!=t){let e=x.a,s=x.b,i=x.c,n=x.d,r=Math.atan2(d,h)-Math.atan2(i,e)+f;r>a.PI?r-=a.PI2:r<-a.PI&&(r+=a.PI2),r*=t;let o=Math.cos(r),l=Math.sin(r);x.a=o*e-l*i,x.b=o*s-l*n,x.c=l*e+o*i,x.d=l*s+o*n}if(o){let t=this.temp;l.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),x.worldX+=(t.x-x.worldX)*e,x.worldY+=(t.y-x.worldY)*s}if(0!=i){let t=Math.sqrt(x.a*x.a+x.c*x.c);0!=t&&(t=(t+(Math.sqrt(h*h+d*d)-t+this.data.offsetScaleX)*i)/t),x.a*=t,x.c*=t}if(0!=n){let t=Math.sqrt(x.b*x.b+x.d*x.d);0!=t&&(t=(t+(Math.sqrt(c*c+u*u)-t+this.data.offsetScaleY)*n)/t),x.b*=t,x.d*=t}if(r>0){let t=x.b,e=x.d,s=Math.atan2(e,t),i=Math.atan2(u,c)-Math.atan2(d,h)-(s-Math.atan2(x.c,x.a));i>a.PI?i-=a.PI2:i<-a.PI&&(i+=a.PI2),i=s+(i+p)*r;let n=Math.sqrt(t*t+e*e);x.b=Math.cos(i)*n,x.d=Math.sin(i)*n}x.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,o=0!=e||0!=s,l=this.target,h=l.a,c=l.b,d=l.c,u=l.d,m=h*u-c*d>0?a.degRad:-a.degRad,f=this.data.offsetRotation*m,p=this.data.offsetShearY*m,g=this.bones;for(let m=0,x=g.length;m<x;m++){let x=g[m];if(0!=t){let e=x.a,s=x.b,i=x.c,n=x.d,r=Math.atan2(d,h)+f;r>a.PI?r-=a.PI2:r<-a.PI&&(r+=a.PI2),r*=t;let o=Math.cos(r),l=Math.sin(r);x.a=o*e-l*i,x.b=o*s-l*n,x.c=l*e+o*i,x.d=l*s+o*n}if(o){let t=this.temp;l.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),x.worldX+=t.x*e,x.worldY+=t.y*s}if(0!=i){let t=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleX)*i+1;x.a*=t,x.c*=t}if(0!=n){let t=(Math.sqrt(c*c+u*u)-1+this.data.offsetScaleY)*n+1;x.b*=t,x.d*=t}if(r>0){let t=Math.atan2(u,c)-Math.atan2(d,h);t>a.PI?t-=a.PI2:t<-a.PI&&(t+=a.PI2);let e=x.b,s=x.d;t=Math.atan2(s,e)+(t-a.PI/2+p)*r;let i=Math.sqrt(e*e+s*s);x.b=Math.cos(t)*i,x.d=Math.sin(t)*i}x.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,a=this.mixShearY,r=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation;0!=t&&(c+=(r.arotation-c+this.data.offsetRotation)*t);let d=h.ax,u=h.ay;d+=(r.ax-d+this.data.offsetX)*e,u+=(r.ay-u+this.data.offsetY)*s;let m=h.ascaleX,f=h.ascaleY;0!=i&&0!=m&&(m=(m+(r.ascaleX-m+this.data.offsetScaleX)*i)/m),0!=n&&0!=f&&(f=(f+(r.ascaleY-f+this.data.offsetScaleY)*n)/f);let p=h.ashearY;0!=a&&(p+=(r.ashearY-p+this.data.offsetShearY)*a),h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,p)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,a=this.mixShearY,r=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation+(r.arotation+this.data.offsetRotation)*t,d=h.ax+(r.ax+this.data.offsetX)*e,u=h.ay+(r.ay+this.data.offsetY)*s,m=h.ascaleX*((r.ascaleX-1+this.data.offsetScaleX)*i+1),f=h.ascaleY*((r.ascaleY-1+this.data.offsetScaleY)*n+1),p=h.ashearY+(r.ashearY+this.data.offsetShearY)*a;h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,p)}}}class Qt{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return Qt.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e<t.bones.length;e++){let s,i=t.bones[e];if(i.parent){let t=this.bones[i.parent.index];s=new Nt(i,this,t),t.children.push(s)}else s=new Nt(i,this,null);this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let s=t.slots[e],i=this.bones[s.boneData.index],n=new Jt(s,i);this.slots.push(n),this.drawOrder.push(n)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let s=t.ikConstraints[e];this.ikConstraints.push(new zt(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new Kt(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new jt(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new Ht(s,this))}this.color=new n(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0;let t=this.bones;for(let e=0,s=t.length;e<s;e++){let s=t[e];s.sorted=s.data.skinRequired,s.active=!s.sorted}if(this.skin){let t=this.skin.bones;for(let e=0,s=this.skin.bones.length;e<s;e++){let s=this.bones[t[e].index];do{s.sorted=!1,s.active=!0,s=s.parent}while(s)}}let e=this.ikConstraints,s=this.transformConstraints,i=this.pathConstraints,n=this.physicsConstraints,a=e.length,r=s.length,o=i.length,l=this.physicsConstraints.length,h=a+r+o+l;t:for(let t=0;t<h;t++){for(let s=0;s<a;s++){let i=e[s];if(i.data.order==t){this.sortIkConstraint(i);continue t}}for(let e=0;e<r;e++){let i=s[e];if(i.data.order==t){this.sortTransformConstraint(i);continue t}}for(let e=0;e<o;e++){let s=i[e];if(s.data.order==t){this.sortPathConstraint(s);continue t}}for(let e=0;e<l;e++){const s=n[e];if(s.data.order==t){this.sortPhysicsConstraint(s);continue t}}}for(let e=0,s=t.length;e<s;e++)this.sortBone(t[e])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&l.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,i=s[0];if(this.sortBone(i),1==s.length)this._updateCache.push(t),this.sortReset(i.children);else{let e=s[s.length-1];this.sortBone(e),this._updateCache.push(t),this.sortReset(i.children),e.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&l.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,i=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,i);for(let t=0,e=this.data.skins.length;t<e;t++)this.sortPathConstraintAttachment(this.data.skins[t],s,i);let n=e.getAttachment();n instanceof Xt&&this.sortPathConstraintAttachmentWith(n,i);let a=t.bones,r=a.length;for(let t=0;t<r;t++)this.sortBone(a[t]);this._updateCache.push(t);for(let t=0;t<r;t++)this.sortReset(a[t].children);for(let t=0;t<r;t++)a[t].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&l.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let e=t.bones,s=e.length;if(t.data.local)for(let t=0;t<s;t++){let s=e[t];this.sortBone(s.parent),this.sortBone(s)}else for(let t=0;t<s;t++)this.sortBone(e[t]);this._updateCache.push(t);for(let t=0;t<s;t++)this.sortReset(e[t].children);for(let t=0;t<s;t++)e[t].sorted=!0}sortPathConstraintAttachment(t,e,s){let i=t.attachments[e];if(i)for(let t in i)this.sortPathConstraintAttachmentWith(i[t],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof Xt))return;let s=t.bones;if(s){let t=this.bones;for(let e=0,i=s.length;e<i;){let i=s[e++];for(i+=e;e<i;)this.sortBone(t[s[e++]])}}else this.sortBone(e)}sortPhysicsConstraint(t){const e=t.bone;t.active=e.active&&(!t.data.skinRequired||null!=this.skin&&l.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(e),this._updateCache.push(t),this.sortReset(e.children),e.sorted=!0)}sortBone(t){if(!t)return;if(t.sorted)return;let e=t.parent;e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,s=t.length;e<s;e++){let s=t[e];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(t){if(null==t)throw new Error("physics is undefined");let e=this.bones;for(let t=0,s=e.length;t<s;t++){let s=e[t];s.ax=s.x,s.ay=s.y,s.arotation=s.rotation,s.ascaleX=s.scaleX,s.ascaleY=s.scaleY,s.ashearX=s.shearX,s.ashearY=s.shearY}let s=this._updateCache;for(let e=0,i=s.length;e<i;e++)s[e].update(t)}updateWorldTransformWith(t,e){let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let i=e.a,n=e.b,r=e.c,o=e.d;s.worldX=i*this.x+n*this.y+e.worldX,s.worldY=r*this.x+o*this.y+e.worldY;const l=(s.rotation+s.shearX)*a.degRad,h=(s.rotation+90+s.shearY)*a.degRad,c=Math.cos(l)*s.scaleX,d=Math.cos(h)*s.scaleY,u=Math.sin(l)*s.scaleX,m=Math.sin(h)*s.scaleY;s.a=(i*c+n*u)*this.scaleX,s.b=(i*d+n*m)*this.scaleX,s.c=(r*c+o*u)*this.scaleY,s.d=(r*d+o*m)*this.scaleY;let f=this._updateCache;for(let e=0,i=f.length;e<i;e++){let i=f[e];i!=s&&i.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;l.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,s=t.length;e<s;e++)t[e].setToSetupPose()}getRootBone(){return 0==this.bones.length?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.data.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.data.name==t)return i}return null}setSkinByName(t){let e=this.data.findSkin(t);if(!e)throw new Error("Skin not found: "+t);this.setSkin(e)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s],n=i.data.attachmentName;if(n){let e=t.getAttachment(s,n);e&&i.setAttachment(e)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,e){let s=this.data.findSlot(t);if(!s)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(s.index,e)}getAttachment(t,e){if(!e)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(t,e);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,n=s.length;i<n;i++){let n=s[i];if(n.data.name==t){let s=null;if(e&&(s=this.getAttachment(i,e),!s))throw new Error("Attachment not found: "+e+", for slot: "+t);return void n.setAttachment(s)}}throw new Error("Slot not found: "+t)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.ikConstraints.find((e=>e.data.name==t))??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find((e=>e.data.name==t))??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find((e=>e.data.name==t))??null}findPhysicsConstraint(t){if(null==t)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find((e=>e.data.name==t))??null}getBoundsRect(){let t=new c,e=new c;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}}getBounds(t,e,s=new Array(2),i=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let n=this.drawOrder,a=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let t=0,e=n.length;t<e;t++){let e=n[t];if(!e.bone.active)continue;let c=0,d=null,u=null,m=e.getAttachment();if(m instanceof Vt)c=8,d=l.setArraySize(s,c,0),m.computeWorldVertices(e,d,0,2),u=Qt.quadTriangles;else if(m instanceof Pt){let t=m;c=t.worldVerticesLength,d=l.setArraySize(s,c,0),t.computeWorldVertices(e,0,c,d,0,2),u=t.triangles}else if(m instanceof wt&&null!=i){i.clipStart(e,m);continue}if(d&&u){null!=i&&i.isClipping()&&(i.clipTriangles(d,u,u.length),d=i.clippedVertices,c=i.clippedVertices.length);for(let t=0,e=d.length;t<e;t+=2){let e=d[t],s=d[t+1];a=Math.min(a,e),r=Math.min(r,s),o=Math.max(o,e),h=Math.max(h,s)}}null!=i&&i.clipEndWithSlot(e)}null!=i&&i.clipEnd(),t.set(a,r),e.set(o-a,h-r)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let i=0,n=s.length;i<n;i++)s[i].translate(t,e)}physicsRotate(t,e,s){const i=this.physicsConstraints;for(let n=0,a=i.length;n<a;n++)i[n].rotate(t,e,s)}}t.Physics=void 0,(At=t.Physics||(t.Physics={}))[At.none=0]="none",At[At.reset=1]="reset",At[At.update=2]="update",At[At.pose=3]="pose";class Zt extends Lt{_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(t){super(t,0,!1)}}class te{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}}class ee{slotIndex;name;attachment;constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class se{name;attachments=new Array;bones=Array();constraints=new Array;color=new n(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],i=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){i=!0;break}i||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],i=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){i=!0;break}i||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],i=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){i=!0;break}i||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],i=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){i=!0;break}i||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];s.attachment&&(s.attachment instanceof Pt?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let i in s){let n=s[i];n&&t.push(new ee(e,i,n))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let i in s){let n=s[i];n&&e.push(new ee(t,i,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){let n=t.slots[i],a=n.getAttachment();if(a&&s<e.attachments.length){let t=e.attachments[s];for(let e in t){if(a==t[e]){let t=this.getAttachment(s,e);t&&n.setAttachment(t);break}}}s++}}}class ie{index=0;name;boneData;color=new n(1,1,1,1);darkColor=null;attachmentName=null;blendMode=t.BlendMode.Normal;visible=!0;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}t.BlendMode=void 0,(Tt=t.BlendMode||(t.BlendMode={}))[Tt.Normal=0]="Normal",Tt[Tt.Additive=1]="Additive",Tt[Tt.Multiply=2]="Multiply",Tt[Tt.Screen=3]="Screen";class ne extends Lt{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(t){super(t,0,!1)}}class ae{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(e){let s=this.scale,i=new te;i.name="";let a=new re(e),r=a.readInt32(),o=a.readInt32();i.hash=0==o&&0==r?null:o.toString(16)+r.toString(16),i.version=a.readString(),i.x=a.readFloat(),i.y=a.readFloat(),i.width=a.readFloat(),i.height=a.readFloat(),i.referenceScale=a.readFloat()*s;let h=a.readBoolean();h&&(i.fps=a.readFloat(),i.imagesPath=a.readString(),i.audioPath=a.readString());let c=0;c=a.readInt(!0);for(let t=0;t<c;t++){let t=a.readString();if(!t)throw new Error("String in string table must not be null.");a.strings.push(t)}c=a.readInt(!0);for(let t=0;t<c;t++){let e=a.readString();if(!e)throw new Error("Bone name must not be null.");let r=0==t?null:i.bones[a.readInt(!0)],o=new Ot(t,e,r);o.rotation=a.readFloat(),o.x=a.readFloat()*s,o.y=a.readFloat()*s,o.scaleX=a.readFloat(),o.scaleY=a.readFloat(),o.shearX=a.readFloat(),o.shearY=a.readFloat(),o.length=a.readFloat()*s,o.inherit=a.readByte(),o.skinRequired=a.readBoolean(),h&&(n.rgba8888ToColor(o.color,a.readInt32()),o.icon=a.readString()??void 0,o.visible=a.readBoolean()),i.bones.push(o)}c=a.readInt(!0);for(let t=0;t<c;t++){let e=a.readString();if(!e)throw new Error("Slot name must not be null.");let s=i.bones[a.readInt(!0)],r=new ie(t,e,s);n.rgba8888ToColor(r.color,a.readInt32());let o=a.readInt32();-1!=o&&n.rgb888ToColor(r.darkColor=new n,o),r.attachmentName=a.readStringRef(),r.blendMode=a.readInt(!0),h&&(r.visible=a.readBoolean()),i.slots.push(r)}c=a.readInt(!0);for(let t,e=0;e<c;e++){let e=a.readString();if(!e)throw new Error("IK constraint data name must not be null.");let n=new Gt(e);n.order=a.readInt(!0),t=a.readInt(!0);for(let e=0;e<t;e++)n.bones.push(i.bones[a.readInt(!0)]);n.target=i.bones[a.readInt(!0)];let r=a.readByte();n.skinRequired=!!(1&r),n.bendDirection=2&r?1:-1,n.compress=!!(4&r),n.stretch=!!(8&r),n.uniform=!!(16&r),32&r&&(n.mix=64&r?a.readFloat():1),128&r&&(n.softness=a.readFloat()*s),i.ikConstraints.push(n)}c=a.readInt(!0);for(let t,e=0;e<c;e++){let e=a.readString();if(!e)throw new Error("Transform constraint data name must not be null.");let n=new ne(e);n.order=a.readInt(!0),t=a.readInt(!0);for(let e=0;e<t;e++)n.bones.push(i.bones[a.readInt(!0)]);n.target=i.bones[a.readInt(!0)];let r=a.readByte();n.skinRequired=!!(1&r),n.local=!!(2&r),n.relative=!!(4&r),8&r&&(n.offsetRotation=a.readFloat()),16&r&&(n.offsetX=a.readFloat()*s),32&r&&(n.offsetY=a.readFloat()*s),64&r&&(n.offsetScaleX=a.readFloat()),128&r&&(n.offsetScaleY=a.readFloat()),r=a.readByte(),1&r&&(n.offsetShearY=a.readFloat()),2&r&&(n.mixRotate=a.readFloat()),4&r&&(n.mixX=a.readFloat()),8&r&&(n.mixY=a.readFloat()),16&r&&(n.mixScaleX=a.readFloat()),32&r&&(n.mixScaleY=a.readFloat()),64&r&&(n.mixShearY=a.readFloat()),i.transformConstraints.push(n)}c=a.readInt(!0);for(let e,n=0;n<c;n++){let n=a.readString();if(!n)throw new Error("Path constraint data name must not be null.");let r=new $t(n);r.order=a.readInt(!0),r.skinRequired=a.readBoolean(),e=a.readInt(!0);for(let t=0;t<e;t++)r.bones.push(i.bones[a.readInt(!0)]);r.target=i.slots[a.readInt(!0)];const o=a.readByte();r.positionMode=1&o,r.spacingMode=o>>1&3,r.rotateMode=o>>3&3,128&o&&(r.offsetRotation=a.readFloat()),r.position=a.readFloat(),r.positionMode==t.PositionMode.Fixed&&(r.position*=s),r.spacing=a.readFloat(),r.spacingMode!=t.SpacingMode.Length&&r.spacingMode!=t.SpacingMode.Fixed||(r.spacing*=s),r.mixRotate=a.readFloat(),r.mixX=a.readFloat(),r.mixY=a.readFloat(),i.pathConstraints.push(r)}c=a.readInt(!0);for(let t=0;t<c;t++){const t=a.readString();if(!t)throw new Error("Physics constraint data name must not be null.");const e=new Zt(t);e.order=a.readInt(!0),e.bone=i.bones[a.readInt(!0)];let n=a.readByte();e.skinRequired=!!(1&n),2&n&&(e.x=a.readFloat()),4&n&&(e.y=a.readFloat()),8&n&&(e.rotate=a.readFloat()),16&n&&(e.scaleX=a.readFloat()),32&n&&(e.shearX=a.readFloat()),e.limit=(64&n?a.readFloat():5e3)*s,e.step=1/a.readUnsignedByte(),e.inertia=a.readFloat(),e.strength=a.readFloat(),e.damping=a.readFloat(),e.massInverse=128&n?a.readFloat():1,e.wind=a.readFloat(),e.gravity=a.readFloat(),n=a.readByte(),1&n&&(e.inertiaGlobal=!0),2&n&&(e.strengthGlobal=!0),4&n&&(e.dampingGlobal=!0),8&n&&(e.massGlobal=!0),16&n&&(e.windGlobal=!0),32&n&&(e.gravityGlobal=!0),64&n&&(e.mixGlobal=!0),e.mix=128&n?a.readFloat():1,i.physicsConstraints.push(e)}let d=this.readSkin(a,i,!0,h);d&&(i.defaultSkin=d,i.skins.push(d));{let t=i.skins.length;for(l.setArraySize(i.skins,c=t+a.readInt(!0));t<c;t++){let e=this.readSkin(a,i,!1,h);if(!e)throw new Error("readSkin() should not have returned null.");i.skins[t]=e}}c=this.linkedMeshes.length;for(let t=0;t<c;t++){let e=this.linkedMeshes[t];const s=i.skins[e.skinIndex];if(!e.parent)throw new Error("Linked mesh parent must not be null");let n=s.getAttachment(e.slotIndex,e.parent);if(!n)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?n:e.mesh,e.mesh.setParentMesh(n),null!=e.mesh.region&&e.mesh.updateRegion()}this.linkedMeshes.length=0,c=a.readInt(!0);for(let t=0;t<c;t++){let t=a.readString();if(!t)throw new Error("Event data name must not be null");let e=new Wt(t);e.intValue=a.readInt(!1),e.floatValue=a.readFloat(),e.stringValue=a.readString(),e.audioPath=a.readString(),e.audioPath&&(e.volume=a.readFloat(),e.balance=a.readFloat()),i.events.push(e)}c=a.readInt(!0);for(let t=0;t<c;t++){let t=a.readString();if(!t)throw new Error("Animatio name must not be null.");i.animations.push(this.readAnimation(a,t,i))}return i}readSkin(t,e,s,i){let a=null,r=0;if(s){if(r=t.readInt(!0),0==r)return null;a=new se("default")}else{let s=t.readString();if(!s)throw new Error("Skin name must not be null.");a=new se(s),i&&n.rgba8888ToColor(a.color,t.readInt32()),a.bones.length=t.readInt(!0);for(let s=0,i=a.bones.length;s<i;s++)a.bones[s]=e.bones[t.readInt(!0)];for(let s=0,i=t.readInt(!0);s<i;s++)a.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)a.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)a.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)a.constraints.push(e.physicsConstraints[t.readInt(!0)]);r=t.readInt(!0)}for(let s=0;s<r;s++){let s=t.readInt(!0);for(let n=0,r=t.readInt(!0);n<r;n++){let n=t.readStringRef();if(!n)throw new Error("Attachment name must not be null");let r=this.readAttachment(t,e,a,s,n,i);r&&a.setAttachment(s,n,r)}}return a}readAttachment(t,e,s,i,a,r){let o=this.scale,h=t.readByte();const c=8&h?t.readStringRef():a;if(!c)throw new Error("Attachment name must not be null");switch(7&h){case Bt.Region:{let e=16&h?t.readStringRef():null;const i=32&h?t.readInt32():4294967295,a=64&h?this.readSequence(t):null;let r=128&h?t.readFloat():0,l=t.readFloat(),d=t.readFloat(),u=t.readFloat(),m=t.readFloat(),f=t.readFloat(),p=t.readFloat();e||(e=c);let g=this.attachmentLoader.newRegionAttachment(s,c,e,a);return g?(g.path=e,g.x=l*o,g.y=d*o,g.scaleX=u,g.scaleY=m,g.rotation=r,g.width=f*o,g.height=p*o,n.rgba8888ToColor(g.color,i),g.sequence=a,null==a&&g.updateRegion(),g):null}case Bt.BoundingBox:{let e=this.readVertices(t,!!(16&h)),i=r?t.readInt32():0,a=this.attachmentLoader.newBoundingBoxAttachment(s,c);return a?(a.worldVerticesLength=e.length,a.vertices=e.vertices,a.bones=e.bones,r&&n.rgba8888ToColor(a.color,i),a):null}case Bt.Mesh:{let e=16&h?t.readStringRef():c;const i=32&h?t.readInt32():4294967295,a=64&h?this.readSequence(t):null,l=t.readInt(!0),d=this.readVertices(t,!!(128&h)),u=this.readFloatArray(t,d.length,1),m=this.readShortArray(t,3*(d.length-l-2));let f=[],p=0,g=0;r&&(f=this.readShortArray(t,t.readInt(!0)),p=t.readFloat(),g=t.readFloat()),e||(e=c);let x=this.attachmentLoader.newMeshAttachment(s,c,e,a);return x?(x.path=e,n.rgba8888ToColor(x.color,i),x.bones=d.bones,x.vertices=d.vertices,x.worldVerticesLength=d.length,x.triangles=m,x.regionUVs=u,null==a&&x.updateRegion(),x.hullLength=l<<1,x.sequence=a,r&&(x.edges=f,x.width=p*o,x.height=g*o),x):null}case Bt.LinkedMesh:{const e=16&h?t.readStringRef():c;if(null==e)throw new Error("Path of linked mesh must not be null");const a=32&h?t.readInt32():4294967295,l=64&h?this.readSequence(t):null,d=!!(128&h),u=t.readInt(!0),m=t.readStringRef();let f=0,p=0;r&&(f=t.readFloat(),p=t.readFloat());let g=this.attachmentLoader.newMeshAttachment(s,c,e,l);return g?(g.path=e,n.rgba8888ToColor(g.color,a),g.sequence=l,r&&(g.width=f*o,g.height=p*o),this.linkedMeshes.push(new oe(g,u,i,m,d)),g):null}case Bt.Path:{const e=!!(16&h),i=!!(32&h),a=this.readVertices(t,!!(64&h)),d=l.newArray(a.length/6,0);for(let e=0,s=d.length;e<s;e++)d[e]=t.readFloat()*o;const u=r?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,c);return m?(m.closed=e,m.constantSpeed=i,m.worldVerticesLength=a.length,m.vertices=a.vertices,m.bones=a.bones,m.lengths=d,r&&n.rgba8888ToColor(m.color,u),m):null}case Bt.Point:{const e=t.readFloat(),i=t.readFloat(),a=t.readFloat(),l=r?t.readInt32():0,h=this.attachmentLoader.newPointAttachment(s,c);return h?(h.x=i*o,h.y=a*o,h.rotation=e,r&&n.rgba8888ToColor(h.color,l),h):null}case Bt.Clipping:{const i=t.readInt(!0),a=this.readVertices(t,!!(16&h));let o=r?t.readInt32():0,l=this.attachmentLoader.newClippingAttachment(s,c);return l?(l.endSlot=e.slots[i],l.worldVerticesLength=a.length,l.vertices=a.vertices,l.bones=a.bones,r&&n.rgba8888ToColor(l.color,o),l):null}}return null}readSequence(t){let e=new m(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,i=t.readInt(!0),n=new le;if(n.length=i<<1,!e)return n.vertices=this.readFloatArray(t,n.length,s),n;let a=new Array,r=new Array;for(let e=0;e<i;e++){let e=t.readInt(!0);r.push(e);for(let i=0;i<e;i++)r.push(t.readInt(!0)),a.push(t.readFloat()*s),a.push(t.readFloat()*s),a.push(t.readFloat())}return n.vertices=l.toFloatArray(a),n.bones=r,n}readFloatArray(t,e,s){let i=new Array(e);if(1==s)for(let s=0;s<e;s++)i[s]=t.readFloat();else for(let n=0;n<e;n++)i[n]=t.readFloat()*s;return i}readShortArray(t,e){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readInt(!0);return s}readAnimation(e,s,i){e.readInt(!0);let n=new Array,a=this.scale;for(let t=0,s=e.readInt(!0);t<s;t++){let t=e.readInt(!0);for(let s=0,i=e.readInt(!0);s<i;s++){let s=e.readByte(),i=e.readInt(!0),a=i-1;switch(s){case ve:{let s=new N(i,t);for(let t=0;t<i;t++)s.setFrame(t,e.readFloat(),e.readStringRef());n.push(s);break}case ke:{let s=e.readInt(!0),r=new X(i,s,t),o=e.readFloat(),l=e.readUnsignedByte()/255,h=e.readUnsignedByte()/255,c=e.readUnsignedByte()/255,d=e.readUnsignedByte()/255;for(let t=0,s=0;r.setFrame(t,o,l,h,c,d),t!=a;t++){let i=e.readFloat(),n=e.readUnsignedByte()/255,a=e.readUnsignedByte()/255,u=e.readUnsignedByte()/255,m=e.readUnsignedByte()/255;switch(e.readByte()){case qe:r.setStepped(t);break;case Ue:de(e,r,s++,t,0,o,i,l,n,1),de(e,r,s++,t,1,o,i,h,a,1),de(e,r,s++,t,2,o,i,c,u,1),de(e,r,s++,t,3,o,i,d,m,1)}o=i,l=n,h=a,c=u,d=m}n.push(r);break}case Ie:{let s=e.readInt(!0),r=new _(i,s,t),o=e.readFloat(),l=e.readUnsignedByte()/255,h=e.readUnsignedByte()/255,c=e.readUnsignedByte()/255;for(let t=0,s=0;r.setFrame(t,o,l,h,c),t!=a;t++){let i=e.readFloat(),n=e.readUnsignedByte()/255,a=e.readUnsignedByte()/255,d=e.readUnsignedByte()/255;switch(e.readByte()){case qe:r.setStepped(t);break;case Ue:de(e,r,s++,t,0,o,i,l,n,1),de(e,r,s++,t,1,o,i,h,a,1),de(e,r,s++,t,2,o,i,c,d,1)}o=i,l=n,h=a,c=d}n.push(r);break}case Ae:{let s=e.readInt(!0),r=new D(i,s,t),o=e.readFloat(),l=e.readUnsignedByte()/255,h=e.readUnsignedByte()/255,c=e.readUnsignedByte()/255,d=e.readUnsignedByte()/255,u=e.readUnsignedByte()/255,m=e.readUnsignedByte()/255,f=e.readUnsignedByte()/255;for(let t=0,s=0;r.setFrame(t,o,l,h,c,d,u,m,f),t!=a;t++){let i=e.readFloat(),n=e.readUnsignedByte()/255,a=e.readUnsignedByte()/255,p=e.readUnsignedByte()/255,g=e.readUnsignedByte()/255,x=e.readUnsignedByte()/255,w=e.readUnsignedByte()/255,b=e.readUnsignedByte()/255;switch(e.readByte()){case qe:r.setStepped(t);break;case Ue:de(e,r,s++,t,0,o,i,l,n,1),de(e,r,s++,t,1,o,i,h,a,1),de(e,r,s++,t,2,o,i,c,p,1),de(e,r,s++,t,3,o,i,d,g,1),de(e,r,s++,t,4,o,i,u,x,1),de(e,r,s++,t,5,o,i,m,w,1),de(e,r,s++,t,6,o,i,f,b,1)}o=i,l=n,h=a,c=p,d=g,u=x,m=w,f=b}n.push(r);break}case Te:{let s=e.readInt(!0),r=new O(i,s,t),o=e.readFloat(),l=e.readUnsignedByte()/255,h=e.readUnsignedByte()/255,c=e.readUnsignedByte()/255,d=e.readUnsignedByte()/255,u=e.readUnsignedByte()/255,m=e.readUnsignedByte()/255;for(let t=0,s=0;r.setFrame(t,o,l,h,c,d,u,m),t!=a;t++){let i=e.readFloat(),n=e.readUnsignedByte()/255,a=e.readUnsignedByte()/255,f=e.readUnsignedByte()/255,p=e.readUnsignedByte()/255,g=e.readUnsignedByte()/255,x=e.readUnsignedByte()/255;switch(e.readByte()){case qe:r.setStepped(t);break;case Ue:de(e,r,s++,t,0,o,i,l,n,1),de(e,r,s++,t,1,o,i,h,a,1),de(e,r,s++,t,2,o,i,c,f,1),de(e,r,s++,t,3,o,i,d,p,1),de(e,r,s++,t,4,o,i,u,g,1),de(e,r,s++,t,5,o,i,m,x,1)}o=i,l=n,h=a,c=f,d=p,u=g,m=x}n.push(r);break}case Be:{let s=new V(i,e.readInt(!0),t),r=e.readFloat(),o=e.readUnsignedByte()/255;for(let t=0,i=0;s.setFrame(t,r,o),t!=a;t++){let n=e.readFloat(),a=e.readUnsignedByte()/255;switch(e.readByte()){case qe:s.setStepped(t);break;case Ue:de(e,s,i++,t,0,r,n,o,a,1)}r=n,o=a}n.push(s)}}}}for(let t=0,s=e.readInt(!0);t<s;t++){let t=e.readInt(!0);for(let s=0,i=e.readInt(!0);s<i;s++){let s=e.readByte(),i=e.readInt(!0);if(s==Se){let s=new P(i,t);for(let t=0;t<i;t++)s.setFrame(t,e.readFloat(),e.readByte());n.push(s);continue}let r=e.readInt(!0);switch(s){case ue:n.push(he(e,new k(i,r,t),1));break;case me:n.push(ce(e,new I(i,r,t),a));break;case fe:n.push(he(e,new A(i,r,t),a));break;case pe:n.push(he(e,new T(i,r,t),a));break;case ge:n.push(ce(e,new B(i,r,t),1));break;case xe:n.push(he(e,new C(i,r,t),1));break;case we:n.push(he(e,new F(i,r,t),1));break;case be:n.push(ce(e,new E(i,r,t),1));break;case ye:n.push(he(e,new R(i,r,t),1));break;case Me:n.push(he(e,new Y(i,r,t),1))}}}for(let t=0,s=e.readInt(!0);t<s;t++){let t=e.readInt(!0),s=e.readInt(!0),i=s-1,r=new W(s,e.readInt(!0),t),o=e.readByte(),l=e.readFloat(),h=1&o?2&o?e.readFloat():1:0,c=4&o?e.readFloat()*a:0;for(let t=0,s=0;r.setFrame(t,l,h,c,8&o?1:-1,!!(16&o),!!(32&o)),t!=i;t++){o=e.readByte();const i=e.readFloat(),n=1&o?2&o?e.readFloat():1:0,d=4&o?e.readFloat()*a:0;64&o?r.setStepped(t):128&o&&(de(e,r,s++,t,0,l,i,h,n,1),de(e,r,s++,t,1,l,i,c,d,a)),l=i,h=n,c=d}n.push(r)}for(let t=0,s=e.readInt(!0);t<s;t++){let t=e.readInt(!0),s=e.readInt(!0),i=s-1,a=new z(s,e.readInt(!0),t),r=e.readFloat(),o=e.readFloat(),l=e.readFloat(),h=e.readFloat(),c=e.readFloat(),d=e.readFloat(),u=e.readFloat();for(let t=0,s=0;a.setFrame(t,r,o,l,h,c,d,u),t!=i;t++){let i=e.readFloat(),n=e.readFloat(),m=e.readFloat(),f=e.readFloat(),p=e.readFloat(),g=e.readFloat(),x=e.readFloat();switch(e.readByte()){case qe:a.setStepped(t);break;case Ue:de(e,a,s++,t,0,r,i,o,n,1),de(e,a,s++,t,1,r,i,l,m,1),de(e,a,s++,t,2,r,i,h,f,1),de(e,a,s++,t,3,r,i,c,p,1),de(e,a,s++,t,4,r,i,d,g,1),de(e,a,s++,t,5,r,i,u,x,1)}r=i,o=n,l=m,h=f,c=p,d=g,u=x}n.push(a)}for(let s=0,r=e.readInt(!0);s<r;s++){let s=e.readInt(!0),r=i.pathConstraints[s];for(let i=0,o=e.readInt(!0);i<o;i++){const i=e.readByte(),o=e.readInt(!0),l=e.readInt(!0);switch(i){case Ee:n.push(he(e,new G(o,l,s),r.positionMode==t.PositionMode.Fixed?a:1));break;case Re:n.push(he(e,new $(o,l,s),r.spacingMode==t.SpacingMode.Length||r.spacingMode==t.SpacingMode.Fixed?a:1));break;case Ye:let i=new j(o,l,s),h=e.readFloat(),c=e.readFloat(),d=e.readFloat(),u=e.readFloat();for(let t=0,s=0,n=i.getFrameCount()-1;i.setFrame(t,h,c,d,u),t!=n;t++){let n=e.readFloat(),a=e.readFloat(),r=e.readFloat(),o=e.readFloat();switch(e.readByte()){case qe:i.setStepped(t);break;case Ue:de(e,i,s++,t,0,h,n,c,a,1),de(e,i,s++,t,1,h,n,d,r,1),de(e,i,s++,t,2,h,n,u,o,1)}h=n,c=a,d=r,u=o}n.push(i)}}}for(let t=0,s=e.readInt(!0);t<s;t++){const t=e.readInt(!0)-1;for(let s=0,i=e.readInt(!0);s<i;s++){const s=e.readByte(),i=e.readInt(!0);if(s==Le){const s=new it(i,t);for(let t=0;t<i;t++)s.setFrame(t,e.readFloat());n.push(s);continue}const a=e.readInt(!0);switch(s){case Pe:n.push(he(e,new J(i,a,t),1));break;case Xe:n.push(he(e,new K(i,a,t),1));break;case _e:n.push(he(e,new Q(i,a,t),1));break;case Ve:n.push(he(e,new Z(i,a,t),1));break;case De:n.push(he(e,new tt(i,a,t),1));break;case Oe:n.push(he(e,new et(i,a,t),1));break;case Ne:n.push(he(e,new st(i,a,t),1))}}}for(let t=0,s=e.readInt(!0);t<s;t++){let t=i.skins[e.readInt(!0)];for(let s=0,i=e.readInt(!0);s<i;s++){let s=e.readInt(!0);for(let i=0,r=e.readInt(!0);i<r;i++){let i=e.readStringRef();if(!i)throw new Error("attachmentName must not be null.");let r=t.getAttachment(s,i),o=e.readByte(),h=e.readInt(!0),c=h-1;switch(o){case Ce:{let t=r,i=t.bones,o=t.vertices,d=i?o.length/3*2:o.length,u=e.readInt(!0),m=new L(h,u,s,t),f=e.readFloat();for(let t=0,s=0;;t++){let n,r=e.readInt(!0);if(0==r)n=i?l.newFloatArray(d):o;else{n=l.newFloatArray(d);let t=e.readInt(!0);if(r+=t,1==a)for(let s=t;s<r;s++)n[s]=e.readFloat();else for(let s=t;s<r;s++)n[s]=e.readFloat()*a;if(!i)for(let t=0,e=n.length;t<e;t++)n[t]+=o[t]}if(m.setFrame(t,f,n),t==c)break;let h=e.readFloat();switch(e.readByte()){case qe:m.setStepped(t);break;case Ue:de(e,m,s++,t,0,f,h,0,1,1)}f=h}n.push(m);break}case Fe:{let t=new nt(h,s,r);for(let s=0;s<h;s++){let i=e.readFloat(),n=e.readInt32();t.setFrame(s,i,p[15&n],n>>4,e.readFloat())}n.push(t);break}}}}}let r=e.readInt(!0);if(r>0){let t=new U(r),s=i.slots.length;for(let i=0;i<r;i++){let n=e.readFloat(),a=e.readInt(!0),r=l.newArray(s,0);for(let t=s-1;t>=0;t--)r[t]=-1;let o=l.newArray(s-a,0),h=0,c=0;for(let t=0;t<a;t++){let t=e.readInt(!0);for(;h!=t;)o[c++]=h++;r[h+e.readInt(!0)]=h++}for(;h<s;)o[c++]=h++;for(let t=s-1;t>=0;t--)-1==r[t]&&(r[t]=o[--c]);t.setFrame(i,n,r)}n.push(t)}let o=e.readInt(!0);if(o>0){let t=new q(o);for(let s=0;s<o;s++){let n=e.readFloat(),a=i.events[e.readInt(!0)],r=new Ut(n,a);r.intValue=e.readInt(!1),r.floatValue=e.readFloat(),r.stringValue=e.readString(),null==r.stringValue&&(r.stringValue=a.stringValue),r.data.audioPath&&(r.volume=e.readFloat(),r.balance=e.readFloat()),t.setFrame(s,r)}n.push(t)}let h=0;for(let t=0,e=n.length;t<e;t++)h=Math.max(h,n[t].getDuration());return new g(s,n,h)}}class re{strings;index;buffer;constructor(t,e=new Array,s=0,i=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=127&e;return 128&e&&(e=this.readByte(),s|=(127&e)<<7,128&e&&(e=this.readByte(),s|=(127&e)<<14,128&e&&(e=this.readByte(),s|=(127&e)<<21,128&e&&(e=this.readByte(),s|=(127&e)<<28)))),t?s:s>>>1^-(1&s)}readStringRef(){let t=this.readInt(!0);return 0==t?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){let t=this.readUnsignedByte();switch(t>>4){case 12:case 13:e+=String.fromCharCode((31&t)<<6|63&this.readByte()),s+=2;break;case 14:e+=String.fromCharCode((15&t)<<12|(63&this.readByte())<<6|63&this.readByte()),s+=3;break;default:e+=String.fromCharCode(t),s++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return 0!=this.readByte()}}class oe{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,n){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}}class le{bones;vertices;length;constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}}function he(t,e,s){let i=t.readFloat(),n=t.readFloat()*s;for(let a=0,r=0,o=e.getFrameCount()-1;e.setFrame(a,i,n),a!=o;a++){let o=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case qe:e.setStepped(a);break;case Ue:de(t,e,r++,a,0,i,o,n,l,s)}i=o,n=l}return e}function ce(t,e,s){let i=t.readFloat(),n=t.readFloat()*s,a=t.readFloat()*s;for(let r=0,o=0,l=e.getFrameCount()-1;e.setFrame(r,i,n,a),r!=l;r++){let l=t.readFloat(),h=t.readFloat()*s,c=t.readFloat()*s;switch(t.readByte()){case qe:e.setStepped(r);break;case Ue:de(t,e,o++,r,0,i,l,n,h,s),de(t,e,o++,r,1,i,l,a,c,s)}i=l,n=h,a=c}return e}function de(t,e,s,i,n,a,r,o,l,h){e.setBezier(s,i,n,a,o,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,r,l)}!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"}(Bt||(Bt={}));const ue=0,me=1,fe=2,pe=3,ge=4,xe=5,we=6,be=7,ye=8,Me=9,Se=10,ve=0,ke=1,Ie=2,Ae=3,Te=4,Be=5,Ce=0,Fe=1,Ee=0,Re=1,Ye=2,Pe=0,Xe=1,_e=2,Ve=4,De=5,Oe=6,Ne=7,Le=8,qe=1,Ue=2;class We{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new h((()=>new Array));polygonIndicesPool=new h((()=>new Array));triangulate(t){let e=t,s=t.length>>1,i=this.indicesArray;i.length=0;for(let t=0;t<s;t++)i[t]=t;let n=this.isConcaveArray;n.length=0;for(let t=0,a=s;t<a;++t)n[t]=We.isConcave(t,s,e,i);let a=this.triangles;for(a.length=0;s>3;){let t=s-1,r=0,o=1;for(;;){t:if(!n[r]){let a=i[t]<<1,l=i[r]<<1,h=i[o]<<1,c=e[a],d=e[a+1],u=e[l],m=e[l+1],f=e[h],p=e[h+1];for(let a=(o+1)%s;a!=t;a=(a+1)%s){if(!n[a])continue;let t=i[a]<<1,s=e[t],r=e[t+1];if(We.positiveArea(f,p,c,d,s,r)&&We.positiveArea(c,d,u,m,s,r)&&We.positiveArea(u,m,f,p,s,r))break t}break}if(0==o){do{if(!n[r])break;r--}while(r>0);break}t=r,r=o,o=(o+1)%s}a.push(i[(s+r-1)%s]),a.push(i[r]),a.push(i[(r+1)%s]),i.splice(r,1),n.splice(r,1),s--;let l=(s+r-1)%s,h=r==s?0:r;n[l]=We.isConcave(l,s,e,i),n[h]=We.isConcave(h,s,e,i)}return 3==s&&(a.push(i[2]),a.push(i[0]),a.push(i[1])),a}decompose(t,e){let s=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let n=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(n),n.length=0;let a=this.polygonIndicesPool.obtain();a.length=0;let r=this.polygonPool.obtain();r.length=0;let o=-1,l=0;for(let t=0,h=e.length;t<h;t+=3){let h=e[t]<<1,c=e[t+1]<<1,d=e[t+2]<<1,u=s[h],m=s[h+1],f=s[c],p=s[c+1],g=s[d],x=s[d+1],w=!1;if(o==h){let t=r.length-4,e=We.winding(r[t],r[t+1],r[t+2],r[t+3],g,x),s=We.winding(g,x,r[0],r[1],r[2],r[3]);e==l&&s==l&&(r.push(g),r.push(x),a.push(d),w=!0)}w||(r.length>0?(i.push(r),n.push(a)):(this.polygonPool.free(r),this.polygonIndicesPool.free(a)),r=this.polygonPool.obtain(),r.length=0,r.push(u),r.push(m),r.push(f),r.push(p),r.push(g),r.push(x),a=this.polygonIndicesPool.obtain(),a.length=0,a.push(h),a.push(c),a.push(d),l=We.winding(u,m,f,p,g,x),o=h)}r.length>0&&(i.push(r),n.push(a));for(let t=0,e=i.length;t<e;t++){if(a=n[t],0==a.length)continue;let s=a[0],o=a[a.length-1];r=i[t];let l=r.length-4,h=r[l],c=r[l+1],d=r[l+2],u=r[l+3],m=r[0],f=r[1],p=r[2],g=r[3],x=We.winding(h,c,d,u,m,f);for(let l=0;l<e;l++){if(l==t)continue;let e=n[l];if(3!=e.length)continue;let w=e[0],b=e[1],y=e[2],M=i[l],S=M[M.length-2],v=M[M.length-1];if(w!=s||b!=o)continue;let k=We.winding(h,c,d,u,S,v),I=We.winding(S,v,m,f,p,g);k==x&&I==x&&(M.length=0,e.length=0,r.push(S),r.push(v),a.push(y),h=d,c=u,d=S,u=v,l=0)}}for(let t=i.length-1;t>=0;t--)r=i[t],0==r.length&&(i.splice(t,1),this.polygonPool.free(r),a=n[t],n.splice(t,1),this.polygonIndicesPool.free(a));return i}static isConcave(t,e,s,i){let n=i[(e+t-1)%e]<<1,a=i[t]<<1,r=i[(t+1)%e]<<1;return!this.positiveArea(s[n],s[n+1],s[a],s[a+1],s[r],s[r+1])}static positiveArea(t,e,s,i,n,a){return t*(a-i)+s*(e-a)+n*(i-e)>=0}static winding(t,e,s,i,n,a){let r=s-t,o=i-e;return n*o-a*r+r*e-t*o>=0?1:-1}}class ze{triangulator=new We;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,e){if(this.clipAttachment)return 0;this.clipAttachment=e;let s=e.worldVerticesLength,i=l.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,i,0,2);let n=this.clippingPolygon;ze.makeClockwise(n);let a=this.clippingPolygons=this.triangulator.decompose(n,this.triangulator.triangulate(n));for(let t=0,e=a.length;t<e;t++){let e=a[t];ze.makeClockwise(e),e.push(e[0]),e.push(e[1])}return a.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return null!=this.clipAttachment}clipTriangles(t,e,s,i,n,a,r){i&&n&&a&&"boolean"==typeof r?this.clipTrianglesRender(t,e,s,i,n,a,r):this.clipTrianglesNoRender(t,e,s)}clipTrianglesNoRender(t,e,s){let i=this.clipOutput,n=this.clippedVertices,a=this.clippedTriangles,r=this.clippingPolygons,o=r.length,h=0;n.length=0,a.length=0;for(let c=0;c<s;c+=3){let s=e[c]<<1,d=t[s],u=t[s+1];s=e[c+1]<<1;let m=t[s],f=t[s+1];s=e[c+2]<<1;let p=t[s],g=t[s+1];for(let t=0;t<o;t++){let e=n.length;if(!this.clip(d,u,m,f,p,g,r[t],i)){let t=l.setArraySize(n,e+6);t[e]=d,t[e+1]=u,t[e+2]=m,t[e+3]=f,t[e+4]=p,t[e+5]=g,e=a.length;let s=l.setArraySize(a,e+3);s[e]=h,s[e+1]=h+1,s[e+2]=h+2,h+=3;break}{let t=i.length;if(0==t)continue;let s=t>>1,r=this.clipOutput,o=l.setArraySize(n,e+2*s);for(let s=0;s<t;s+=2,e+=2){let t=r[s],i=r[s+1];o[e]=t,o[e+1]=i}e=a.length;let c=l.setArraySize(a,e+3*(s-2));s--;for(let t=1;t<s;t++,e+=3)c[e]=h,c[e+1]=h+t,c[e+2]=h+t+1;h+=s+1}}}}clipTrianglesRender(t,e,s,i,n,a,r){let o=this.clipOutput,h=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,u=d.length,m=r?12:8,f=0;h.length=0,c.length=0;for(let p=0;p<s;p+=3){let s=e[p]<<1,g=t[s],x=t[s+1],w=i[s],b=i[s+1];s=e[p+1]<<1;let y=t[s],M=t[s+1],S=i[s],v=i[s+1];s=e[p+2]<<1;let k=t[s],I=t[s+1],A=i[s],T=i[s+1];for(let t=0;t<u;t++){let e=h.length;if(!this.clip(g,x,y,M,k,I,d[t],o)){let t=l.setArraySize(h,e+3*m);t[e]=g,t[e+1]=x,t[e+2]=n.r,t[e+3]=n.g,t[e+4]=n.b,t[e+5]=n.a,r?(t[e+6]=w,t[e+7]=b,t[e+8]=a.r,t[e+9]=a.g,t[e+10]=a.b,t[e+11]=a.a,t[e+12]=y,t[e+13]=M,t[e+14]=n.r,t[e+15]=n.g,t[e+16]=n.b,t[e+17]=n.a,t[e+18]=S,t[e+19]=v,t[e+20]=a.r,t[e+21]=a.g,t[e+22]=a.b,t[e+23]=a.a,t[e+24]=k,t[e+25]=I,t[e+26]=n.r,t[e+27]=n.g,t[e+28]=n.b,t[e+29]=n.a,t[e+30]=A,t[e+31]=T,t[e+32]=a.r,t[e+33]=a.g,t[e+34]=a.b,t[e+35]=a.a):(t[e+6]=w,t[e+7]=b,t[e+8]=y,t[e+9]=M,t[e+10]=n.r,t[e+11]=n.g,t[e+12]=n.b,t[e+13]=n.a,t[e+14]=S,t[e+15]=v,t[e+16]=k,t[e+17]=I,t[e+18]=n.r,t[e+19]=n.g,t[e+20]=n.b,t[e+21]=n.a,t[e+22]=A,t[e+23]=T),e=c.length;let s=l.setArraySize(c,e+3);s[e]=f,s[e+1]=f+1,s[e+2]=f+2,f+=3;break}{let t=o.length;if(0==t)continue;let s=M-I,i=k-y,d=g-k,u=I-x,p=1/(s*d+i*(x-I)),B=t>>1,C=this.clipOutput,F=l.setArraySize(h,e+B*m);for(let o=0;o<t;o+=2,e+=m){let t=C[o],l=C[o+1];F[e]=t,F[e+1]=l,F[e+2]=n.r,F[e+3]=n.g,F[e+4]=n.b,F[e+5]=n.a;let h=t-k,c=l-I,m=(s*h+i*c)*p,f=(u*h+d*c)*p,g=1-m-f;F[e+6]=w*m+S*f+A*g,F[e+7]=b*m+v*f+T*g,r&&(F[e+8]=a.r,F[e+9]=a.g,F[e+10]=a.b,F[e+11]=a.a)}e=c.length;let E=l.setArraySize(c,e+3*(B-2));B--;for(let t=1;t<B;t++,e+=3)E[e]=f,E[e+1]=f+t,E[e+2]=f+t+1;f+=B+1}}}}clipTrianglesUnpacked(t,e,s,i){let n=this.clipOutput,a=this.clippedVertices,r=this.clippedUVs,o=this.clippedTriangles,h=this.clippingPolygons,c=h.length,d=0;a.length=0,r.length=0,o.length=0;for(let u=0;u<s;u+=3){let s=e[u]<<1,m=t[s],f=t[s+1],p=i[s],g=i[s+1];s=e[u+1]<<1;let x=t[s],w=t[s+1],b=i[s],y=i[s+1];s=e[u+2]<<1;let M=t[s],S=t[s+1],v=i[s],k=i[s+1];for(let t=0;t<c;t++){let e=a.length;if(!this.clip(m,f,x,w,M,S,h[t],n)){let t=l.setArraySize(a,e+6);t[e]=m,t[e+1]=f,t[e+2]=x,t[e+3]=w,t[e+4]=M,t[e+5]=S;let s=l.setArraySize(r,e+6);s[e]=p,s[e+1]=g,s[e+2]=b,s[e+3]=y,s[e+4]=v,s[e+5]=k,e=o.length;let i=l.setArraySize(o,e+3);i[e]=d,i[e+1]=d+1,i[e+2]=d+2,d+=3;break}{let t=n.length;if(0==t)continue;let s=w-S,i=M-x,h=m-M,c=S-f,u=1/(s*h+i*(f-S)),I=t>>1,A=this.clipOutput,T=l.setArraySize(a,e+2*I),B=l.setArraySize(r,e+2*I);for(let n=0;n<t;n+=2,e+=2){let t=A[n],a=A[n+1];T[e]=t,T[e+1]=a;let r=t-M,o=a-S,l=(s*r+i*o)*u,d=(c*r+h*o)*u,m=1-l-d;B[e]=p*l+b*d+v*m,B[e+1]=g*l+y*d+k*m}e=o.length;let C=l.setArraySize(o,e+3*(I-2));I--;for(let t=1;t<I;t++,e+=3)C[e]=d,C[e+1]=d+t,C[e+2]=d+t+1;d+=I+1}}}}clip(t,e,s,i,n,a,r,o){let l,h=o,c=!1;r.length%4>=2?(l=o,o=this.scratch):l=this.scratch,l.length=0,l.push(t),l.push(e),l.push(s),l.push(i),l.push(n),l.push(a),l.push(t),l.push(e),o.length=0;let d=r.length-4,u=r;for(let t=0;;t+=2){let e=u[t],s=u[t+1],i=e-u[t+2],n=s-u[t+3],a=o.length,r=l;for(let t=0,a=l.length-2;t<a;){let a=r[t],l=r[t+1];t+=2;let h=r[t],d=r[t+1],u=n*(e-h)>i*(s-d),m=n*(e-a)-i*(s-l);if(m>0){if(u){o.push(h),o.push(d);continue}let t=h-a,e=d-l,s=m/(t*n-e*i);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(a+t*s),o.push(l+e*s)}else if(u){let t=h-a,e=d-l,s=m/(t*n-e*i);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(a+t*s),o.push(l+e*s),o.push(h),o.push(d)}c=!0}if(a==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),t==d)break;let m=o;(o=l).length=0,l=m}if(h!=o){h.length=0;for(let t=0,e=o.length-2;t<e;t++)h[t]=o[t]}else h.length=h.length-2;return c}static makeClockwise(t){let e=t,s=t.length,i=e[s-2]*e[1]-e[0]*e[s-1],n=0,a=0,r=0,o=0;for(let t=0,l=s-3;t<l;t+=2)n=e[t],a=e[t+1],r=e[t+2],o=e[t+3],i+=n*o-r*a;if(!(i<0))for(let t=0,i=s-2,n=s>>1;t<n;t+=2){let s=e[t],n=e[t+1],a=i-t;e[t]=e[a],e[t+1]=e[a+1],e[a]=s,e[a+1]=n}}}class Ge{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(e){let s=this.scale,i=new te,a="string"==typeof e?JSON.parse(e):e,r=a.skeleton;if(r&&(i.hash=r.hash,i.version=r.spine,i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height,i.referenceScale=Ke(r,"referenceScale",100)*s,i.fps=r.fps,i.imagesPath=r.images??null,i.audioPath=r.audio??null),a.bones)for(let e=0;e<a.bones.length;e++){let n=a.bones[e],r=null,o=Ke(n,"parent",null);o&&(r=i.findBone(o));let h=new Ot(i.bones.length,n.name,r);h.length=Ke(n,"length",0)*s,h.x=Ke(n,"x",0)*s,h.y=Ke(n,"y",0)*s,h.rotation=Ke(n,"rotation",0),h.scaleX=Ke(n,"scaleX",1),h.scaleY=Ke(n,"scaleY",1),h.shearX=Ke(n,"shearX",0),h.shearY=Ke(n,"shearY",0),h.inherit=l.enumValue(t.Inherit,Ke(n,"inherit","Normal")),h.skinRequired=Ke(n,"skin",!1);let c=Ke(n,"color",null);c&&h.color.setFromString(c),i.bones.push(h)}if(a.slots)for(let e=0;e<a.slots.length;e++){let s=a.slots[e],r=s.name,o=i.findBone(s.bone);if(!o)throw new Error(`Couldn't find bone ${s.bone} for slot ${r}`);let h=new ie(i.slots.length,r,o),c=Ke(s,"color",null);c&&h.color.setFromString(c);let d=Ke(s,"dark",null);d&&(h.darkColor=n.fromString(d)),h.attachmentName=Ke(s,"attachment",null),h.blendMode=l.enumValue(t.BlendMode,Ke(s,"blend","normal")),h.visible=Ke(s,"visible",!0),i.slots.push(h)}if(a.ik)for(let t=0;t<a.ik.length;t++){let e=a.ik[t],n=new Gt(e.name);n.order=Ke(e,"order",0),n.skinRequired=Ke(e,"skin",!1);for(let t=0;t<e.bones.length;t++){let s=i.findBone(e.bones[t]);if(!s)throw new Error(`Couldn't find bone ${e.bones[t]} for IK constraint ${e.name}.`);n.bones.push(s)}let r=i.findBone(e.target);if(!r)throw new Error(`Couldn't find target bone ${e.target} for IK constraint ${e.name}.`);n.target=r,n.mix=Ke(e,"mix",1),n.softness=Ke(e,"softness",0)*s,n.bendDirection=Ke(e,"bendPositive",!0)?1:-1,n.compress=Ke(e,"compress",!1),n.stretch=Ke(e,"stretch",!1),n.uniform=Ke(e,"uniform",!1),i.ikConstraints.push(n)}if(a.transform)for(let t=0;t<a.transform.length;t++){let e=a.transform[t],n=new ne(e.name);n.order=Ke(e,"order",0),n.skinRequired=Ke(e,"skin",!1);for(let t=0;t<e.bones.length;t++){let s=e.bones[t],a=i.findBone(s);if(!a)throw new Error(`Couldn't find bone ${s} for transform constraint ${e.name}.`);n.bones.push(a)}let r=e.target,o=i.findBone(r);if(!o)throw new Error(`Couldn't find target bone ${r} for transform constraint ${e.name}.`);n.target=o,n.local=Ke(e,"local",!1),n.relative=Ke(e,"relative",!1),n.offsetRotation=Ke(e,"rotation",0),n.offsetX=Ke(e,"x",0)*s,n.offsetY=Ke(e,"y",0)*s,n.offsetScaleX=Ke(e,"scaleX",0),n.offsetScaleY=Ke(e,"scaleY",0),n.offsetShearY=Ke(e,"shearY",0),n.mixRotate=Ke(e,"mixRotate",1),n.mixX=Ke(e,"mixX",1),n.mixY=Ke(e,"mixY",n.mixX),n.mixScaleX=Ke(e,"mixScaleX",1),n.mixScaleY=Ke(e,"mixScaleY",n.mixScaleX),n.mixShearY=Ke(e,"mixShearY",1),i.transformConstraints.push(n)}if(a.path)for(let e=0;e<a.path.length;e++){let n=a.path[e],r=new $t(n.name);r.order=Ke(n,"order",0),r.skinRequired=Ke(n,"skin",!1);for(let t=0;t<n.bones.length;t++){let e=n.bones[t],s=i.findBone(e);if(!s)throw new Error(`Couldn't find bone ${e} for path constraint ${n.name}.`);r.bones.push(s)}let o=n.target,h=i.findSlot(o);if(!h)throw new Error(`Couldn't find target slot ${o} for path constraint ${n.name}.`);r.target=h,r.positionMode=l.enumValue(t.PositionMode,Ke(n,"positionMode","Percent")),r.spacingMode=l.enumValue(t.SpacingMode,Ke(n,"spacingMode","Length")),r.rotateMode=l.enumValue(t.RotateMode,Ke(n,"rotateMode","Tangent")),r.offsetRotation=Ke(n,"rotation",0),r.position=Ke(n,"position",0),r.positionMode==t.PositionMode.Fixed&&(r.position*=s),r.spacing=Ke(n,"spacing",0),r.spacingMode!=t.SpacingMode.Length&&r.spacingMode!=t.SpacingMode.Fixed||(r.spacing*=s),r.mixRotate=Ke(n,"mixRotate",1),r.mixX=Ke(n,"mixX",1),r.mixY=Ke(n,"mixY",r.mixX),i.pathConstraints.push(r)}if(a.physics)for(let t=0;t<a.physics.length;t++){const e=a.physics[t],n=new Zt(e.name);n.order=Ke(e,"order",0),n.skinRequired=Ke(e,"skin",!1);const r=e.bone,o=i.findBone(r);if(null==o)throw new Error("Physics bone not found: "+r);n.bone=o,n.x=Ke(e,"x",0),n.y=Ke(e,"y",0),n.rotate=Ke(e,"rotate",0),n.scaleX=Ke(e,"scaleX",0),n.shearX=Ke(e,"shearX",0),n.limit=Ke(e,"limit",5e3)*s,n.step=1/Ke(e,"fps",60),n.inertia=Ke(e,"inertia",1),n.strength=Ke(e,"strength",100),n.damping=Ke(e,"damping",1),n.massInverse=1/Ke(e,"mass",1),n.wind=Ke(e,"wind",0),n.gravity=Ke(e,"gravity",0),n.mix=Ke(e,"mix",1),n.inertiaGlobal=Ke(e,"inertiaGlobal",!1),n.strengthGlobal=Ke(e,"strengthGlobal",!1),n.dampingGlobal=Ke(e,"dampingGlobal",!1),n.massGlobal=Ke(e,"massGlobal",!1),n.windGlobal=Ke(e,"windGlobal",!1),n.gravityGlobal=Ke(e,"gravityGlobal",!1),n.mixGlobal=Ke(e,"mixGlobal",!1),i.physicsConstraints.push(n)}if(a.skins)for(let t=0;t<a.skins.length;t++){let e=a.skins[t],s=new se(e.name);if(e.bones)for(let t=0;t<e.bones.length;t++){let n=e.bones[t],a=i.findBone(n);if(!a)throw new Error(`Couldn't find bone ${n} for skin ${e.name}.`);s.bones.push(a)}if(e.ik)for(let t=0;t<e.ik.length;t++){let n=e.ik[t],a=i.findIkConstraint(n);if(!a)throw new Error(`Couldn't find IK constraint ${n} for skin ${e.name}.`);s.constraints.push(a)}if(e.transform)for(let t=0;t<e.transform.length;t++){let n=e.transform[t],a=i.findTransformConstraint(n);if(!a)throw new Error(`Couldn't find transform constraint ${n} for skin ${e.name}.`);s.constraints.push(a)}if(e.path)for(let t=0;t<e.path.length;t++){let n=e.path[t],a=i.findPathConstraint(n);if(!a)throw new Error(`Couldn't find path constraint ${n} for skin ${e.name}.`);s.constraints.push(a)}if(e.physics)for(let t=0;t<e.physics.length;t++){let n=e.physics[t],a=i.findPhysicsConstraint(n);if(!a)throw new Error(`Couldn't find physics constraint ${n} for skin ${e.name}.`);s.constraints.push(a)}for(let t in e.attachments){let n=i.findSlot(t);if(!n)throw new Error(`Couldn't find slot ${t} for skin ${e.name}.`);let a=e.attachments[t];for(let t in a){let e=this.readAttachment(a[t],s,n.index,t,i);e&&s.setAttachment(n.index,t,e)}}i.skins.push(s),"default"==s.name&&(i.defaultSkin=s)}for(let t=0,e=this.linkedMeshes.length;t<e;t++){let e=this.linkedMeshes[t],s=e.skin?i.findSkin(e.skin):i.defaultSkin;if(!s)throw new Error(`Skin not found: ${e.skin}`);let n=s.getAttachment(e.slotIndex,e.parent);if(!n)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?n:e.mesh,e.mesh.setParentMesh(n),null!=e.mesh.region&&e.mesh.updateRegion()}if(this.linkedMeshes.length=0,a.events)for(let t in a.events){let e=a.events[t],s=new Wt(t);s.intValue=Ke(e,"int",0),s.floatValue=Ke(e,"float",0),s.stringValue=Ke(e,"string",""),s.audioPath=Ke(e,"audio",null),s.audioPath&&(s.volume=Ke(e,"volume",1),s.balance=Ke(e,"balance",0)),i.events.push(s)}if(a.animations)for(let t in a.animations){let e=a.animations[t];this.readAnimation(e,t,i)}return i}readAttachment(t,e,s,i,n){let a=this.scale;switch(i=Ke(t,"name",i),Ke(t,"type","region")){case"region":{let s=Ke(t,"path",i),n=this.readSequence(Ke(t,"sequence",null)),r=this.attachmentLoader.newRegionAttachment(e,i,s,n);if(!r)return null;r.path=s,r.x=Ke(t,"x",0)*a,r.y=Ke(t,"y",0)*a,r.scaleX=Ke(t,"scaleX",1),r.scaleY=Ke(t,"scaleY",1),r.rotation=Ke(t,"rotation",0),r.width=t.width*a,r.height=t.height*a,r.sequence=n;let o=Ke(t,"color",null);return o&&r.color.setFromString(o),null!=r.region&&r.updateRegion(),r}case"boundingbox":{let s=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!s)return null;this.readVertices(t,s,t.vertexCount<<1);let n=Ke(t,"color",null);return n&&s.color.setFromString(n),s}case"mesh":case"linkedmesh":{let n=Ke(t,"path",i),r=this.readSequence(Ke(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,i,n,r);if(!o)return null;o.path=n;let l=Ke(t,"color",null);l&&o.color.setFromString(l),o.width=Ke(t,"width",0)*a,o.height=Ke(t,"height",0)*a,o.sequence=r;let h=Ke(t,"parent",null);if(h)return this.linkedMeshes.push(new $e(o,Ke(t,"skin",null),s,h,Ke(t,"timelines",!0))),o;let c=t.uvs;return this.readVertices(t,o,c.length),o.triangles=t.triangles,o.regionUVs=c,null!=o.region&&o.updateRegion(),o.edges=Ke(t,"edges",null),o.hullLength=2*Ke(t,"hull",0),o}case"path":{let s=this.attachmentLoader.newPathAttachment(e,i);if(!s)return null;s.closed=Ke(t,"closed",!1),s.constantSpeed=Ke(t,"constantSpeed",!0);let n=t.vertexCount;this.readVertices(t,s,n<<1);let r=l.newArray(n/3,0);for(let e=0;e<t.lengths.length;e++)r[e]=t.lengths[e]*a;s.lengths=r;let o=Ke(t,"color",null);return o&&s.color.setFromString(o),s}case"point":{let s=this.attachmentLoader.newPointAttachment(e,i);if(!s)return null;s.x=Ke(t,"x",0)*a,s.y=Ke(t,"y",0)*a,s.rotation=Ke(t,"rotation",0);let n=Ke(t,"color",null);return n&&s.color.setFromString(n),s}case"clipping":{let s=this.attachmentLoader.newClippingAttachment(e,i);if(!s)return null;let a=Ke(t,"end",null);a&&(s.endSlot=n.findSlot(a));let r=t.vertexCount;this.readVertices(t,s,r<<1);let o=Ke(t,"color",null);return o&&s.color.setFromString(o),s}}return null}readSequence(t){if(null==t)return null;let e=new m(Ke(t,"count",0));return e.start=Ke(t,"start",1),e.digits=Ke(t,"digits",0),e.setupIndex=Ke(t,"setup",0),e}readVertices(t,e,s){let i=this.scale;e.worldVerticesLength=s;let n=t.vertices;if(s==n.length){let t=l.toFloatArray(n);if(1!=i)for(let e=0,s=n.length;e<s;e++)t[e]*=i;return void(e.vertices=t)}let a=new Array,r=new Array;for(let t=0,e=n.length;t<e;){let e=n[t++];r.push(e);for(let s=t+4*e;t<s;t+=4)r.push(n[t]),a.push(n[t+1]*i),a.push(n[t+2]*i),a.push(n[t+3])}e.bones=r,e.vertices=l.toFloatArray(a)}readAnimation(e,s,i){let a=this.scale,r=new Array;if(e.slots)for(let t in e.slots){let s=e.slots[t],a=i.findSlot(t);if(!a)throw new Error("Slot not found: "+t);let o=a.index;for(let t in s){let e=s[t];if(!e)continue;let i=e.length;if("attachment"==t){let t=new N(i,o);for(let s=0;s<i;s++){let i=e[s];t.setFrame(s,Ke(i,"time",0),Ke(i,"name",null))}r.push(t)}else if("rgba"==t){let t=new X(i,i<<2,o),s=e[0],a=Ke(s,"time",0),l=n.fromString(s.color);for(let i=0,r=0;;i++){t.setFrame(i,a,l.r,l.g,l.b,l.a);let o=e[i+1];if(!o){t.shrink(r);break}let h=Ke(o,"time",0),c=n.fromString(o.color),d=s.curve;d&&(r=Je(d,t,r,i,0,a,h,l.r,c.r,1),r=Je(d,t,r,i,1,a,h,l.g,c.g,1),r=Je(d,t,r,i,2,a,h,l.b,c.b,1),r=Je(d,t,r,i,3,a,h,l.a,c.a,1)),a=h,l=c,s=o}r.push(t)}else if("rgb"==t){let t=new _(i,3*i,o),s=e[0],a=Ke(s,"time",0),l=n.fromString(s.color);for(let i=0,r=0;;i++){t.setFrame(i,a,l.r,l.g,l.b);let o=e[i+1];if(!o){t.shrink(r);break}let h=Ke(o,"time",0),c=n.fromString(o.color),d=s.curve;d&&(r=Je(d,t,r,i,0,a,h,l.r,c.r,1),r=Je(d,t,r,i,1,a,h,l.g,c.g,1),r=Je(d,t,r,i,2,a,h,l.b,c.b,1)),a=h,l=c,s=o}r.push(t)}else if("alpha"==t)r.push(je(e,new V(i,i,o),0,1));else if("rgba2"==t){let t=new D(i,7*i,o),s=e[0],a=Ke(s,"time",0),l=n.fromString(s.light),h=n.fromString(s.dark);for(let i=0,r=0;;i++){t.setFrame(i,a,l.r,l.g,l.b,l.a,h.r,h.g,h.b);let o=e[i+1];if(!o){t.shrink(r);break}let c=Ke(o,"time",0),d=n.fromString(o.light),u=n.fromString(o.dark),m=s.curve;m&&(r=Je(m,t,r,i,0,a,c,l.r,d.r,1),r=Je(m,t,r,i,1,a,c,l.g,d.g,1),r=Je(m,t,r,i,2,a,c,l.b,d.b,1),r=Je(m,t,r,i,3,a,c,l.a,d.a,1),r=Je(m,t,r,i,4,a,c,h.r,u.r,1),r=Je(m,t,r,i,5,a,c,h.g,u.g,1),r=Je(m,t,r,i,6,a,c,h.b,u.b,1)),a=c,l=d,h=u,s=o}r.push(t)}else if("rgb2"==t){let t=new O(i,6*i,o),s=e[0],a=Ke(s,"time",0),l=n.fromString(s.light),h=n.fromString(s.dark);for(let i=0,r=0;;i++){t.setFrame(i,a,l.r,l.g,l.b,h.r,h.g,h.b);let o=e[i+1];if(!o){t.shrink(r);break}let c=Ke(o,"time",0),d=n.fromString(o.light),u=n.fromString(o.dark),m=s.curve;m&&(r=Je(m,t,r,i,0,a,c,l.r,d.r,1),r=Je(m,t,r,i,1,a,c,l.g,d.g,1),r=Je(m,t,r,i,2,a,c,l.b,d.b,1),r=Je(m,t,r,i,3,a,c,h.r,u.r,1),r=Je(m,t,r,i,4,a,c,h.g,u.g,1),r=Je(m,t,r,i,5,a,c,h.b,u.b,1)),a=c,l=d,h=u,s=o}r.push(t)}}}if(e.bones)for(let s in e.bones){let n=e.bones[s],o=i.findBone(s);if(!o)throw new Error("Bone not found: "+s);let h=o.index;for(let e in n){let s=n[e],i=s.length;if(0!=i)if("rotate"===e)r.push(je(s,new k(i,i,h),0,1));else if("translate"===e){let t=new I(i,i<<1,h);r.push(He(s,t,"x","y",0,a))}else if("translatex"===e){let t=new A(i,i,h);r.push(je(s,t,0,a))}else if("translatey"===e){let t=new T(i,i,h);r.push(je(s,t,0,a))}else if("scale"===e){let t=new B(i,i<<1,h);r.push(He(s,t,"x","y",1,1))}else if("scalex"===e){let t=new C(i,i,h);r.push(je(s,t,1,1))}else if("scaley"===e){let t=new F(i,i,h);r.push(je(s,t,1,1))}else if("shear"===e){let t=new E(i,i<<1,h);r.push(He(s,t,"x","y",0,1))}else if("shearx"===e){let t=new R(i,i,h);r.push(je(s,t,0,1))}else if("sheary"===e){let t=new Y(i,i,h);r.push(je(s,t,0,1))}else if("inherit"===e){let e=new P(i,o.index);for(let i=0;i<s.length;i++){let n=s[i];e.setFrame(i,Ke(n,"time",0),l.enumValue(t.Inherit,Ke(n,"inherit","Normal")))}r.push(e)}}}if(e.ik)for(let t in e.ik){let s=e.ik[t],n=s[0];if(!n)continue;let o=i.findIkConstraint(t);if(!o)throw new Error("IK Constraint not found: "+t);let l=i.ikConstraints.indexOf(o),h=new W(s.length,s.length<<1,l),c=Ke(n,"time",0),d=Ke(n,"mix",1),u=Ke(n,"softness",0)*a;for(let t=0,e=0;;t++){h.setFrame(t,c,d,u,Ke(n,"bendPositive",!0)?1:-1,Ke(n,"compress",!1),Ke(n,"stretch",!1));let i=s[t+1];if(!i){h.shrink(e);break}let r=Ke(i,"time",0),o=Ke(i,"mix",1),l=Ke(i,"softness",0)*a,m=n.curve;m&&(e=Je(m,h,e,t,0,c,r,d,o,1),e=Je(m,h,e,t,1,c,r,u,l,a)),c=r,d=o,u=l,n=i}r.push(h)}if(e.transform)for(let t in e.transform){let s=e.transform[t],n=s[0];if(!n)continue;let a=i.findTransformConstraint(t);if(!a)throw new Error("Transform constraint not found: "+t);let o=i.transformConstraints.indexOf(a),l=new z(s.length,6*s.length,o),h=Ke(n,"time",0),c=Ke(n,"mixRotate",1),d=Ke(n,"mixX",1),u=Ke(n,"mixY",d),m=Ke(n,"mixScaleX",1),f=Ke(n,"mixScaleY",m),p=Ke(n,"mixShearY",1);for(let t=0,e=0;;t++){l.setFrame(t,h,c,d,u,m,f,p);let i=s[t+1];if(!i){l.shrink(e);break}let a=Ke(i,"time",0),r=Ke(i,"mixRotate",1),o=Ke(i,"mixX",1),g=Ke(i,"mixY",o),x=Ke(i,"mixScaleX",1),w=Ke(i,"mixScaleY",x),b=Ke(i,"mixShearY",1),y=n.curve;y&&(e=Je(y,l,e,t,0,h,a,c,r,1),e=Je(y,l,e,t,1,h,a,d,o,1),e=Je(y,l,e,t,2,h,a,u,g,1),e=Je(y,l,e,t,3,h,a,m,x,1),e=Je(y,l,e,t,4,h,a,f,w,1),e=Je(y,l,e,t,5,h,a,p,b,1)),h=a,c=r,d=o,u=g,m=x,f=w,m=x,n=i}r.push(l)}if(e.path)for(let s in e.path){let n=e.path[s],o=i.findPathConstraint(s);if(!o)throw new Error("Path constraint not found: "+s);let l=i.pathConstraints.indexOf(o);for(let e in n){let s=n[e],i=s[0];if(!i)continue;let h=s.length;if("position"===e){let e=new G(h,h,l);r.push(je(s,e,0,o.positionMode==t.PositionMode.Fixed?a:1))}else if("spacing"===e){let e=new $(h,h,l);r.push(je(s,e,0,o.spacingMode==t.SpacingMode.Length||o.spacingMode==t.SpacingMode.Fixed?a:1))}else if("mix"===e){let t=new j(h,3*h,l),e=Ke(i,"time",0),n=Ke(i,"mixRotate",1),a=Ke(i,"mixX",1),o=Ke(i,"mixY",a);for(let r=0,l=0;;r++){t.setFrame(r,e,n,a,o);let h=s[r+1];if(!h){t.shrink(l);break}let c=Ke(h,"time",0),d=Ke(h,"mixRotate",1),u=Ke(h,"mixX",1),m=Ke(h,"mixY",u),f=i.curve;f&&(l=Je(f,t,l,r,0,e,c,n,d,1),l=Je(f,t,l,r,1,e,c,a,u,1),l=Je(f,t,l,r,2,e,c,o,m,1)),e=c,n=d,a=u,o=m,i=h}r.push(t)}}}if(e.physics)for(let t in e.physics){let s=e.physics[t],n=-1;if(t.length>0){let e=i.findPhysicsConstraint(t);if(!e)throw new Error("Physics constraint not found: "+t);n=i.physicsConstraints.indexOf(e)}for(let t in s){let e=s[t],i=e[0];if(!i)continue;let a,o=e.length;if("reset"!=t){if("inertia"==t)a=new J(o,o,n);else if("strength"==t)a=new K(o,o,n);else if("damping"==t)a=new Q(o,o,n);else if("mass"==t)a=new Z(o,o,n);else if("wind"==t)a=new tt(o,o,n);else if("gravity"==t)a=new et(o,o,n);else{if("mix"!=t)continue;a=new st(o,o,n)}r.push(je(e,a,0,1))}else{const t=new it(o,n);for(let s=0;null!=i;i=e[s+1],s++)t.setFrame(s,Ke(i,"time",0));r.push(t)}}}if(e.attachments)for(let t in e.attachments){let s=e.attachments[t],n=i.findSkin(t);if(!n)throw new Error("Skin not found: "+t);for(let t in s){let e=s[t],o=i.findSlot(t);if(!o)throw new Error("Slot not found: "+t);let h=o.index;for(let t in e){let s=e[t],i=n.getAttachment(h,t);for(let t in s){let e=s[t],n=e[0];if(n)if("deform"==t){let t=i.bones,s=i.vertices,o=t?s.length/3*2:s.length,c=new L(e.length,e.length,h,i),d=Ke(n,"time",0);for(let i=0,r=0;;i++){let h,u=Ke(n,"vertices",null);if(u){h=l.newFloatArray(o);let e=Ke(n,"offset",0);if(l.arrayCopy(u,0,h,e,u.length),1!=a)for(let t=e,s=t+u.length;t<s;t++)h[t]*=a;if(!t)for(let t=0;t<o;t++)h[t]+=s[t]}else h=t?l.newFloatArray(o):s;c.setFrame(i,d,h);let m=e[i+1];if(!m){c.shrink(r);break}let f=Ke(m,"time",0),p=n.curve;p&&(r=Je(p,c,r,i,0,d,f,0,1,1)),d=f,n=m}r.push(c)}else if("sequence"==t){let t=new nt(e.length,h,i),s=0;for(let i=0;i<e.length;i++){let a=Ke(n,"delay",s),r=Ke(n,"time",0),o=f[Ke(n,"mode","hold")],l=Ke(n,"index",0);t.setFrame(i,r,o,l,a),s=a,n=e[i+1]}r.push(t)}}}}}if(e.drawOrder){let t=new U(e.drawOrder.length),s=i.slots.length,n=0;for(let a=0;a<e.drawOrder.length;a++,n++){let r=e.drawOrder[a],o=null,h=Ke(r,"offsets",null);if(h){o=l.newArray(s,-1);let t=l.newArray(s-h.length,0),e=0,n=0;for(let s=0;s<h.length;s++){let a=h[s],r=i.findSlot(a.slot);if(!r)throw new Error("Slot not found: "+r);let l=r.index;for(;e!=l;)t[n++]=e++;o[e+a.offset]=e++}for(;e<s;)t[n++]=e++;for(let e=s-1;e>=0;e--)-1==o[e]&&(o[e]=t[--n])}t.setFrame(n,Ke(r,"time",0),o)}r.push(t)}if(e.events){let t=new q(e.events.length),s=0;for(let n=0;n<e.events.length;n++,s++){let a=e.events[n],r=i.findEvent(a.name);if(!r)throw new Error("Event not found: "+a.name);let o=new Ut(l.toSinglePrecision(Ke(a,"time",0)),r);o.intValue=Ke(a,"int",r.intValue),o.floatValue=Ke(a,"float",r.floatValue),o.stringValue=Ke(a,"string",r.stringValue),o.data.audioPath&&(o.volume=Ke(a,"volume",1),o.balance=Ke(a,"balance",0)),t.setFrame(s,o)}r.push(t)}let o=0;for(let t=0,e=r.length;t<e;t++)o=Math.max(o,r[t].getDuration());i.animations.push(new g(s,r,o))}}class $e{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}}function je(t,e,s,i){let n=t[0],a=Ke(n,"time",0),r=Ke(n,"value",s)*i,o=0;for(let l=0;;l++){e.setFrame(l,a,r);let h=t[l+1];if(!h)return e.shrink(o),e;let c=Ke(h,"time",0),d=Ke(h,"value",s)*i;n.curve&&(o=Je(n.curve,e,o,l,0,a,c,r,d,i)),a=c,r=d,n=h}}function He(t,e,s,i,n,a){let r=t[0],o=Ke(r,"time",0),l=Ke(r,s,n)*a,h=Ke(r,i,n)*a,c=0;for(let d=0;;d++){e.setFrame(d,o,l,h);let u=t[d+1];if(!u)return e.shrink(c),e;let m=Ke(u,"time",0),f=Ke(u,s,n)*a,p=Ke(u,i,n)*a,g=r.curve;g&&(c=Je(g,e,c,d,0,o,m,l,f,a),c=Je(g,e,c,d,1,o,m,h,p,a)),o=m,l=f,h=p,r=u}}function Je(t,e,s,i,n,a,r,o,l,h){if("stepped"==t)return e.setStepped(i),s;let c=n<<2,d=t[c],u=t[c+1]*h,m=t[c+2],f=t[c+3]*h;return e.setBezier(s,i,n,a,o,d,u,m,f,r,l),s+1}function Ke(t,e,s){return void 0!==t[e]?t[e]:s}var Qe;function Ze(t,e,s){const i=new Dt(t);return"json"===s?new Ge(i).readSkeletonData(e):new ae(i).readSkeletonData(new Uint8Array(e))}async function ts(t,s,i){let n;const a=t.map(((t,n)=>{const a=s[n];let r=e.AssetType.Texture2D;return"ktx"===a?r=e.AssetType.KTX:"ktx2"===a&&(r=e.AssetType.KTX2),is(t,i,r)}));try{n=await Promise.all(a)}catch(t){throw t}return n}async function es(t,s){const i=function(t){const e=new URL(t),s=e.origin+e.pathname;return s.endsWith("/")?s:s.substring(0,s.lastIndexOf("/")+1)}(t);let n,a;try{n=await e.request(t,{type:"text"})}catch(e){throw new Error(`Spine Atlas: ${t} load error: ${e}`)}let r=new Ft(n);const o=[];for(let t of r.pages){const e=i+t.name;o.push(is(e,s))}try{a=await Promise.all(o)}catch(t){throw new Error(`Spine Texture: load error: ${t}`)}return r=ss(n,a),r}function ss(t,e){const s=new Ft(t);return s.pages.forEach(((t,s)=>{const i=function(t){return new ns(new Image,t)}(e.find((e=>e.name===t.name))||e[s]);t.setTexture(i)})),s}function is(t,s,i=e.AssetType.Texture2D){return s.resourceManager.load({url:t,type:i})}void 0===Math.fround&&(Math.fround=(Qe=new Float32Array(1),function(t){return Qe[0]=t,Qe[0]}));class ns extends bt{constructor(t,e){super(t),this.texture=e,this.texture.generateMipmaps()}getImage(){return this.texture}setFilters(s,i){s===t.TextureFilter.Nearest?this.texture.filterMode=e.TextureFilterMode.Point:i===t.TextureFilter.MipMapLinearLinear?this.texture.filterMode=e.TextureFilterMode.Trilinear:this.texture.filterMode=e.TextureFilterMode.Bilinear}setWraps(t,e){this.texture.wrapModeU=this._convertWrapMode(t),this.texture.wrapModeV=this._convertWrapMode(e)}dispose(){}_convertWrapMode(s){switch(s){case t.TextureWrap.ClampToEdge:return e.TextureWrapMode.Clamp;case t.TextureWrap.Repeat:return e.TextureWrapMode.Repeat;case t.TextureWrap.MirroredRepeat:return e.TextureWrapMode.Mirror;default:throw new Error("Unsupported texture wrap mode.")}}}class as{constructor(t,e=1){this._type=t,this._lastElementIndex=e-1;const s=this._elements=new Array(e);for(let i=0;i<e;++i)s[i]=new t}get(){return this._lastElementIndex<0?new this._type:this._elements[this._lastElementIndex--]}return(t){this._elements[++this._lastElementIndex]=t}}class rs{constructor(t){this._usedElementCount=0,this._type=t,this._elements=[]}get(){const{_usedElementCount:t,_elements:e}=this;if(this._usedElementCount++,e.length===t){const t=new this._type;return e.push(t),t}return e[t]}clear(){this._usedElementCount=0}}const{SourceAlpha:os,One:ls,DestinationColor:hs,Zero:cs,OneMinusSourceColor:ds,OneMinusSourceAlpha:us}=e.BlendFactor,{Add:ms}=e.BlendOperation;function fs(e,s){const i=e.renderState.blendState.targetBlendState;switch(s){case t.BlendMode.Additive:i.sourceColorBlendFactor=os,i.destinationColorBlendFactor=ls,i.sourceAlphaBlendFactor=ls,i.destinationAlphaBlendFactor=ls,i.colorBlendOperation=i.alphaBlendOperation=ms;break;case t.BlendMode.Multiply:i.sourceColorBlendFactor=hs,i.destinationColorBlendFactor=us,i.sourceAlphaBlendFactor=ls,i.destinationAlphaBlendFactor=us,i.colorBlendOperation=i.alphaBlendOperation=ms;break;case t.BlendMode.Screen:i.sourceColorBlendFactor=ls,i.destinationColorBlendFactor=ds,i.sourceAlphaBlendFactor=ls,i.destinationAlphaBlendFactor=ds,i.colorBlendOperation=i.alphaBlendOperation=ms;break;default:i.sourceColorBlendFactor=os,i.destinationColorBlendFactor=us,i.sourceAlphaBlendFactor=ls,i.destinationAlphaBlendFactor=us,i.colorBlendOperation=i.alphaBlendOperation=ms}}class ps{}const gs=1/0,xs=-1/0;class ws{static{this.QUAD_TRIANGLES=[0,1,2,2,3,0]}static{this.VERTEX_SIZE=8}static{this.VERTEX_STRIDE=9}static{this.tempDark=new n}static{this.tempColor=new n}static{this.tempVerts=new Array(8)}static{this.tempBlendMode=null}static{this.tempTexture=null}static{this.subPrimitivePool=new as(e.SubPrimitive)}static{this.subRenderItemPool=new rs(ps)}static{this.bounds=new e.BoundingBox(new e.Vector3(gs,gs,gs),new e.Vector3(xs,xs,xs))}getMaxVertexCount(t){const e=new Set,{skins:s}=t,i=s.length;for(let t=0;t<i;t++){const i=s[t];this._collectUniqueAttachments(i,e)}return this._calculateTotalVertexCount(e)}buildPrimitive(e,s){const{useClipping:i=!0,zSpacing:n=.01}=s.setting,{_clipper:a,_separateSlots:r,_subRenderItems:o,_separateSlotTextureMap:l}=this,{bounds:h}=ws;h.min.set(gs,gs,gs),h.max.set(xs,xs,xs);let c=0,d=0;const u=e.drawOrder,m=u.length,{engine:f,_indices:p,_vertices:g,_subPrimitives:x}=s;let{tempVerts:w,tempTexture:b,tempBlendMode:y,subRenderItemPool:M,subPrimitivePool:S}=ws;o.length=0,M.clear();let v,k,I=s._vertices,A=0,T=0,B=t.BlendMode.Normal,C=null,F=0;ws.tempBlendMode=null,ws.tempTexture=null;for(let t=0;t<m;++t){const e=u[t];if(!e.bone.active){a.clipEndWithSlot(e);continue}const s=e.getAttachment();let h=null;const m=n*t;let f=0;const E=a.isClipping();let R=E?2:ws.VERTEX_SIZE;if(s){switch(s.constructor){case Vt:const t=s;h=t.color,f=4*R,t.computeWorldVertices(e,w,0,R),v=ws.QUAD_TRIANGLES,k=t.uvs,C=t.region.texture;break;case Pt:const n=s;h=n.color,f=(n.worldVerticesLength>>1)*R,f>I.length&&(ws.tempVerts=new Array(f)),n.computeWorldVertices(e,0,n.worldVerticesLength,w,0,R),v=n.triangles,k=n.uvs,C=n.region.texture;break;case wt:if(i){let t=s;a.clipStart(e,t)}continue;default:i&&a.clipEndWithSlot(e);continue}if(null!=C){let t,s,i,n,u=e.bone.skeleton.color,I=e.color,Y=u.a*I.a*h.a,P=ws.tempColor,X=ws.tempDark;if(P.set(u.r*I.r*h.r,u.g*I.g*h.g,u.b*I.b*h.b,Y),E)a.clipTriangles(w,v,v.length,k,P,X,!1),t=a.clippedVertices,s=t.length,i=a.clippedTriangles,n=i.length;else{let e=w;const{r:a,g:r,b:o,a:l}=P;for(let t=2,s=0,i=f;t<i;t+=R,s+=2)e[t]=a,e[t+1]=r,e[t+2]=o,e[t+3]=l,e[t+4]=k[s],e[t+5]=k[s+1];t=w,s=f,i=v,n=v.length}if(0==s||0==n){a.clipEndWithSlot(e);continue}let _=c/ws.VERTEX_STRIDE,V=g,D=c,O=0;for(;O<s;){let e=t[O++],s=t[O++];V[D++]=e,V[D++]=s,V[D++]=m,V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],this._expandByPoint(e,s,m)}c=D;let N=p;for(D=d,O=0;O<n;D++,O++)N[D]=i[O]+_;d+=n;const L=e.data,q=L.name;B=L.blendMode;const U=null!==y&&y!==L.blendMode,W=null!==b&&b!==C,z=r.get(q);if(z||U||W){if(T>0){const t=x[F];t&&F++;const e=t||S.get();e.start=A,e.count=T;const s=M.get();s.subPrimitive=e,s.texture=b,s.blendMode=y,o.push(s),A+=T,T=0}if(z){const t=l.get(q);if(t){const e=C.texture;t.filterMode=e.filterMode,t.wrapModeU=e.wrapModeU,t.wrapModeV=e.wrapModeV}const e=x[F];e&&F++;const s=e||S.get();s.start=A,s.count=n;const i=M.get();i.blendMode=B,i.subPrimitive=s,i.texture=C,i.slotName=q,o.push(i),A+=n,T=0}else T+=n}else T+=n;b=C,y=B}a.clipEndWithSlot(e)}else i&&a.clipEndWithSlot(e)}if(T>0){const t=x[F];t&&F++;const e=t||S.get();e.start=A,e.count=T;const s=M.get();s.blendMode=B,s.subPrimitive=e,s.texture=C,o.push(s),T=0}a.clipEnd();const E=x.length,R=o.length;if(R<E)for(let t=R;t<E;t++){const e=x[t];S.return(e)}s._clearSubPrimitives();for(let t=0,e=R;t<e;++t){const e=o[t],{slotName:i,blendMode:n,texture:a}=e;s._addSubPrimitive(e.subPrimitive);let r=a.texture;l.has(i)&&(r=l.get(i));const h=`${r.instanceId}_${n}`;let c=ys._materialCache.get(h);c||(c=this._createMaterialForTexture(r,f,n),ys._materialCache.set(h,c)),s.setMaterial(t,c)}s._vertexBuffer.setData(g),s._indexBuffer.setData(p)}addSeparateSlot(t){this._separateSlots.set(t,t)}addSeparateSlotTexture(t,e){this._separateSlotTextureMap.set(t,e)}_createMaterialForTexture(t,e,s){const i=ys._getDefaultMaterial(e);return i.shaderData.setTexture("material_SpineTexture",t),fs(i,s),i}_expandByPoint(t,e,s){const{bounds:{min:i,max:n}}=ws,a=Math.min(i.x,t),r=Math.min(i.y,e),o=Math.min(i.z,s),l=Math.max(n.x,t),h=Math.max(n.y,e),c=Math.max(n.z,s);i.set(a,r,o),n.set(l,h,c)}_collectUniqueAttachments(t,e){const{attachments:s}=t;for(let t=0,i=s.length;t<i;t++){const i=s[t];for(let t in i){const s=i[t];s&&!e.has(s)&&e.add(s)}}}_calculateTotalVertexCount(t){let e=0;const s=ws.QUAD_TRIANGLES.length;return t.forEach((t=>{t instanceof Vt?e+=s:t instanceof Pt&&(e+=t.triangles.length)})),e}constructor(){this._clipper=new ze,this._subRenderItems=[],this._separateSlots=new Map,this._separateSlotTextureMap=new Map}}class bs extends e.Material{static{this._spineVS="\n uniform mat4 renderer_MVPMat;\n\n attribute vec3 POSITION;\n attribute vec2 TEXCOORD_0;\n attribute vec4 COLOR_0;\n \n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n gl_Position = renderer_MVPMat * vec4(POSITION, 1.0);\n \n v_uv = TEXCOORD_0;\n v_color = COLOR_0;\n }\n "}static{this._spineFS="\n uniform sampler2D material_SpineTexture;\n\n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n vec4 baseColor = texture2D(material_SpineTexture, v_uv);\n gl_FragColor = baseColor * v_color;\n }\n "}constructor(s){super(s,e.Shader.find("galacean-spine-shader")||e.Shader.create("galacean-spine-shader",bs._spineVS,bs._spineFS));const i=this.renderState;i.blendState.targetBlendState.enabled=!0,fs(this,t.BlendMode.Normal),i.depthState.writeEnabled=!1,i.rasterState.cullMode=e.CullMode.Off,i.renderQueueType=e.RenderQueueType.Transparent}}class ys extends e.Renderer{static{this._spineGenerator=new ws}static{this._positionVertexElement=new e.VertexElement("POSITION",0,e.VertexElementFormat.Vector3,0)}static{this._colorVertexElement=new e.VertexElement("COLOR_0",12,e.VertexElementFormat.Vector4,0)}static{this._uvVertexElement=new e.VertexElement("TEXCOORD_0",28,e.VertexElementFormat.Vector2,0)}static{this._materialCache=new Map}static{this._animationDataCache=new Map}static _getDefaultMaterial(t){let e=this._defaultMaterial;if(e){if(e.engine===t)return e.clone();e.destroy(!0),e=null}return e=new bs(t),e.isGCIgnored=!0,this._defaultMaterial=e,e.clone()}get resource(){return this._resource}set resource(t){if(!t)return this._state=null,this._skeleton=null,void(this._resource=null);this._resource=t,this._addResourceReferCount(t,1);const{skeletonData:e}=t;this._skeleton=new Qt(e);let s=ys._animationDataCache.get(e);s||(s=new gt(e),ys._animationDataCache.set(e,s)),this._state=new at(s);const i=ys._spineGenerator.getMaxVertexCount(e);this._createBuffer(i),this._initializeDefaultState(),this._dirtyUpdateFlag|=4,this._state.addListener({start:()=>{this._onAnimationStart()},complete:t=>{this._onAnimationComplete(t)}})}get state(){return this._state}get skeleton(){return this._skeleton}constructor(t){super(t),this.setting=new vs,this.defaultState=new ks,this._subPrimitives=[],this._needResizeBuffer=!1,this._vertexCount=0;const s=new e.Primitive(this._engine);this._primitive=s,s.addVertexElement(ys._positionVertexElement),s.addVertexElement(ys._colorVertexElement),s.addVertexElement(ys._uvVertexElement)}addSeparateSlot(t){this._skeleton||console.error("Skeleton not found!");this._skeleton.findSlot(t)?ys._spineGenerator.addSeparateSlot(t):console.warn(`Slot: ${t} not find.`)}_onEnable(){this._initializeDefaultState()}update(e){const{_state:s,_skeleton:i}=this;s&&i&&(s.update(e),s.apply(i),i.update(e),i.updateWorldTransform(t.Physics.update),ys._spineGenerator.buildPrimitive(this._skeleton,this),this._isContainDirtyFlag(4)&&(this._onWorldVolumeChanged(),this._setDirtyFlagFalse(4)),this._isContainDirtyFlag(2)&&this._calculateGeneratorBounds(this.bounds))}_render(t){const{_primitive:e,_subPrimitives:s}=this,{_materials:i,_engine:n}=this,a=n._renderElementPool.get();a.set(this.priority,this._distanceForSort);const r=n._subRenderElementPool;if(s){for(let t=0,n=s.length;t<n;t++){let n=i[t];if(!n)continue;(n.destroyed||n.shader.destroyed)&&(n=this.engine._meshMagentaMaterial);const o=r.get();o.set(this,n,e,s[t]),a.addSubRenderElement(o)}t.camera._renderPipeline.pushRenderElement(t,a)}}_updateBounds(t){this._calculateGeneratorBounds(t)}_calculateGeneratorBounds(t){const{bounds:s}=ws;e.BoundingBox.transform(s,this.entity.transform.worldMatrix,t)}_cloneTo(t){t.resource=this._resource}_onDestroy(){const{_primitive:t,_subPrimitives:e,_resource:s}=this;e.length=0,t&&t.destroy(),s&&this._addResourceReferCount(s,-1),this._clearMaterialCache(),this._primitive=null,this._resource=null,this._skeleton=null,this._state=null,this.setting=null,super._onDestroy()}_createBuffer(t){const{_engine:s,_primitive:i}=this;this._vertices=new Float32Array(t*ws.VERTEX_STRIDE),this._indices=new Uint16Array(t);const n=4*ws.VERTEX_STRIDE,a=new e.Buffer(s,e.BufferBindFlag.VertexBuffer,this._vertices,e.BufferUsage.Dynamic),r=new e.Buffer(s,e.BufferBindFlag.IndexBuffer,this._indices,e.BufferUsage.Dynamic);this._indexBuffer=r,this._vertexBuffer=a;const o=new e.VertexBufferBinding(a,n);this._primitive.setVertexBufferBinding(0,o);const l=new e.IndexBufferBinding(r,e.IndexFormat.UInt16);i.setIndexBufferBinding(l)}_addSubPrimitive(t){this._subPrimitives.push(t)}_clearSubPrimitives(){this._subPrimitives.length=0}_isContainDirtyFlag(t){return!!(this._dirtyUpdateFlag&t)}_setDirtyFlagFalse(t){this._dirtyUpdateFlag&=~t}_onWorldVolumeChanged(){this._dirtyUpdateFlag|=1}_onAnimationStart(){this._dirtyUpdateFlag|=2}_onAnimationComplete(t){t.loop||this._setDirtyFlagFalse(2)}_clearMaterialCache(){this._materials.forEach((e=>{const s=e.shaderData.getTexture("material_SpineTexture"),i=function(e){const s=e.renderState.blendState.targetBlendState;return s.sourceColorBlendFactor===os&&s.destinationColorBlendFactor===ls&&s.sourceAlphaBlendFactor===ls&&s.destinationAlphaBlendFactor===ls&&s.colorBlendOperation===ms&&s.alphaBlendOperation===ms?t.BlendMode.Additive:s.sourceColorBlendFactor===hs&&s.destinationColorBlendFactor===cs&&s.sourceAlphaBlendFactor===ls&&s.destinationAlphaBlendFactor===cs&&s.colorBlendOperation===ms&&s.alphaBlendOperation===ms?t.BlendMode.Multiply:s.sourceColorBlendFactor===ls&&s.destinationColorBlendFactor===ds&&s.sourceAlphaBlendFactor===ls&&s.destinationAlphaBlendFactor===ds&&s.colorBlendOperation===ms&&s.alphaBlendOperation===ms?t.BlendMode.Screen:t.BlendMode.Normal}(e),n=`${s.instanceId}_${i}`;ys._materialCache.delete(n)}))}_initializeDefaultState(){const{skeleton:t,state:e}=this;if(t&&e){const{animationName:s,skinName:i,loop:n,scale:a}=this.defaultState;t.scaleX=a,t.scaleY=a,"default"!==i&&(t.setSkinByName(i),t.setToSetupPose()),s&&e.setAnimation(0,s,n)}}}var Ms,Ss;s([e.deepClone],ys.prototype,"setting",void 0),s([e.deepClone],ys.prototype,"defaultState",void 0),s([e.ignoreClone],ys.prototype,"_primitive",void 0),s([e.ignoreClone],ys.prototype,"_subPrimitives",void 0),s([e.ignoreClone],ys.prototype,"_indexBuffer",void 0),s([e.ignoreClone],ys.prototype,"_vertexBuffer",void 0),s([e.ignoreClone],ys.prototype,"_vertices",void 0),s([e.ignoreClone],ys.prototype,"_indices",void 0),s([e.ignoreClone],ys.prototype,"_needResizeBuffer",void 0),s([e.ignoreClone],ys.prototype,"_vertexCount",void 0),s([e.ignoreClone],ys.prototype,"_resource",void 0),s([e.ignoreClone],ys.prototype,"_skeleton",void 0),s([e.ignoreClone],ys.prototype,"_state",void 0),function(t){t[t.TransformVolume=1]="TransformVolume",t[t.AnimationVolume=2]="AnimationVolume",t[t.InitialVolume=4]="InitialVolume"}(Ms||(Ms={})),function(t){t[t.WorldVolume=1]="WorldVolume"}(Ss||(Ss={}));class vs{constructor(t=.01,e=!0){this.zSpacing=t,this.useClipping=e}}class ks{constructor(t=1,e=!0,s=null,i="default"){this.scale=t,this.loop=e,this.animationName=s,this.skinName=i}}class Is extends e.ReferResource{get skeletonData(){return this._skeletonData}constructor(t,e){super(t),this.textures=[],this._skeletonData=e,this._associationTextureInSkeletonData(e)}_onDestroy(){super._onDestroy();const{textures:t,_skeletonData:e}=this;t&&this._disassociationSuperResource(t),this._clearAttachmentTextures(e),ys._animationDataCache.delete(e),this._skeletonData=null}_disassociationSuperResource(t){for(let e=0,s=t.length;e<s;e++)t[e]._disassociationSuperResource(this)}_associationTextureInSkeletonData(t){const{skins:e}=t;e.forEach((t=>{const{attachments:e}=t;e.forEach((t=>{const e=Object.values(t)[0],s=e?.region?.texture.texture;s&&!this.textures.find((t=>t.instanceId===s.instanceId))&&(this.textures.push(s),s._associationSuperResource(this))}))}))}_clearAttachmentTextures(t){const{skins:e}=t;e.forEach((t=>{const{attachments:e}=t;e.forEach((t=>{const e=Object.values(t)[0];e?.region?.texture&&(e.region.texture.texture=null)}))}))}}class As{constructor(t,e=0,s){this.data=t,this._dataView=new DataView(t.buffer,t.byteOffset+e,s??t.byteLength-e),this._position=0}nextUint16(){const t=this._dataView.getUint16(this._position,!0);return this._position+=2,t}nextStr(){const t=this.nextUint16(),e=new Uint8Array(this.data.buffer,this._position+this._dataView.byteOffset,t);return this._position+=t,this.decodeText(e)}nextImageData(){return new Uint8Array(this.data.buffer,this.data.byteOffset+this._position)}decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let s=0,i=t.length;s<i;s++)e+=String.fromCharCode(t[s]);return decodeURIComponent(encodeURIComponent(e))}}class Ts extends e.Loader{static{this.imageExtensions=["png","jpg","webp","jpeg","ktx","ktx2"]}static{this.skeletonExtensions=["skel","json","bin"]}static parseAndAssignSpineAsset(t,e,s){const{imageExtensions:i,skeletonExtensions:n}=Ts,a=Ts.getUrlExtension(t,e);a&&(n.includes(a)&&(s.skeletonPath=t,s.skeletonExtension=a),"atlas"===a&&(s.atlasPath=t),i.includes(a)&&(s.imagePaths.push(t),s.imageExtensions.push(a)))}static deriveAndAssignSpineAsset(t,e,s){const i=Ts.getUrlExtension(t,e);if(!i)return;s.skeletonPath=t,s.skeletonExtension=i;const n=/(\.(json|bin|skel))$/;let a;if(n.test(t)&&(a=t.replace(n,"")),a){const t=a+".atlas";s.atlasPath=t}}static verifyFileExtensions(t,e){return t?e&&!Array.isArray(t)?(console.error("Expect fileExtensions to be an array."),[]):e||"string"==typeof t?t:(console.error("Expect fileExtensions to be a string."),null):null}static getUrlExtension(t,e){if(e)return e;const s=t.match(/\/([^\/?#]+)\.([a-zA-Z0-9]+)(\?|#|$)|\?[^#]*\.([a-zA-Z0-9]+)(\?|#|$)/);return s?s[2]||s[4]:null}load(t,s){return new e.AssetPromise((async e=>{let i;if(t.urls)i=await this._handleOriginAsset(t,s);else{const e=await this.request(t.url,{type:"arraybuffer"}),n=new As(new Uint8Array(e)),a=n.nextStr();i=a.startsWith("spine")?await this._handleEditorAsset(e,n,a,s):await this._handleOriginAsset(t,s,e)}e(i)}))}async _handleEditorAsset(t,e,s,i){let n,a;const r=s.startsWith("spine:skel")?"skel":"json",{engine:o}=i;if("skel"===r)a=e.nextStr(),n=e.nextImageData();else{const e=new TextDecoder("utf-8").decode(new Uint8Array(t)),{data:s,atlas:i}=JSON.parse(e);a=i.refId,n=s}const l=Ze(await i.getResourceByRef({refId:a}),n,r);return new Is(o,l)}async _handleOriginAsset(t,e,s){let{fileExtensions:i}=t.params||{},n={skeletonPath:"",skeletonExtension:"",atlasPath:"",imagePaths:[],imageExtensions:[]};const{engine:a}=e;if(s){const e=Ts.verifyFileExtensions(i,!1);Ts.deriveAndAssignSpineAsset(t.url,e,n);const{skeletonPath:r,atlasPath:o}=n;if(!r||!o)throw new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included.");const l=await es(o,a),{data:h,type:c}=this._determineSkeletonDataType(s),d=Ze(l,h,c);return new Is(a,d)}{i=Ts.verifyFileExtensions(i,!0);for(let e=0;e<t.urls.length;e+=1){const s=t.urls[e],a=i&&i[e]||null;Ts.parseAndAssignSpineAsset(s,a,n)}const{skeletonPath:e,atlasPath:s,imagePaths:r,skeletonExtension:o,imageExtensions:l}=n;if(!e||!s)throw new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included.");const h="json"===o?"json":"skel";let c,d,u=["json"===o?this.request(e,{type:"text"}):this.request(e,{type:"arraybuffer"})];if(r.length>0){let t,e;u=u.concat([this.request(s,{type:"text"}),ts(r,l,a)]),[d,t,e]=await Promise.all(u),c=ss(t,e)}else u.push(es(s,a)),[d,c]=await Promise.all(u);const m=Ze(c,d,h);return new Is(a,m)}}_determineSkeletonDataType(t){let e,s;try{const i=new TextDecoder("utf-8").decode(t);JSON.parse(i),e=i,s="json"}catch(i){e=t,s="skel"}return{data:e,type:s}}}Ts=s([e.resourceLoader("spine",["json","bin","skel"])],Ts);class Bs extends e.Loader{load(t,s){return new e.AssetPromise((async e=>{const i=await this.request(t.url,{type:"text"}),{data:n,textures:a}=JSON.parse(i),r=a.map((t=>s.getResourceByRef({refId:t.refId})));e(ss(n,await Promise.all(r)))}))}}Bs=s([e.resourceLoader("EditorSpineAtlas",["atlas"])],Bs);const Cs="4.2.0-beta.1";e.Loader.registerClass("SpineAnimationRenderer",ys),console.log(`Galacean spine version: ${Cs}`),t.AlphaTimeline=V,t.Animation=g,t.AnimationState=at,t.AnimationStateAdapter=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},t.AnimationStateData=gt,t.AssetManagerBase=class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(t,e="",s=new qt){this.textureLoader=t,this.pathPrefix=e,this.downloader=s}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.assets[e]=s,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise(((t,e)=>{let s=()=>{this.isLoadingComplete()?this.hasErrors()?e(this.errors):t(this):requestAnimationFrame(s)};requestAnimationFrame(s)}))}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadBinary(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load binary ${t}: status ${e}, ${i}`)}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load text ${t}: status ${e}, ${i}`)}))}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadJson(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load JSON ${t}: status ${e}, ${i}`)}))}loadTexture(t,e=()=>{},s=()=>{}){if(t=this.start(t),!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document))fetch(t,{mode:"cors"}).then((e=>e.ok?e.blob():(this.error(s,t,`Couldn't load image: ${t}`),null))).then((t=>t?createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null)).then((s=>{s&&this.success(e,t,this.textureLoader(s))}));else{let i=new Image;i.crossOrigin="anonymous",i.onload=()=>{this.success(e,t,this.textureLoader(i))},i.onerror=()=>{this.error(s,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),i.src=t}}loadTextureAtlas(t,e=()=>{},s=()=>{},i){let n=t.lastIndexOf("/"),a=n>=0?t.substring(0,n+1):"";t=this.start(t),this.downloader.downloadText(t,(n=>{try{let r=new Ft(n),o=r.pages.length,l=!1;for(let n of r.pages)this.loadTexture(i?i[n.name]:a+n.name,((s,i)=>{l||(n.setTexture(i),0==--o&&this.success(e,t,r))}),((e,i)=>{l||this.error(s,t,`Couldn't load texture atlas ${t} page image: ${e}`),l=!0}))}catch(e){this.error(s,t,`Couldn't parse texture atlas ${t}: ${e.message}`)}}),((e,i)=>{this.error(s,t,`Couldn't load texture atlas ${t}: status ${e}, ${i}`)}))}get(t){return this.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?"\n"+s:""))}remove(t){t=this.pathPrefix+t;let e=this.assets[t];return e.dispose&&e.dispose(),delete this.assets[t],e}removeAll(){for(let t in this.assets){let e=this.assets[t];e.dispose&&e.dispose()}this.assets={}}isLoadingComplete(){return 0==this.toLoad}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},t.AtlasAttachmentLoader=Dt,t.Attachment=d,t.AttachmentTimeline=N,t.BinaryInput=re,t.Bone=Nt,t.BoneData=Ot,t.BoundingBoxAttachment=xt,t.CURRENT=pt,t.ClippingAttachment=wt,t.Color=n,t.ConstraintData=Lt,t.CurveTimeline=M,t.CurveTimeline1=S,t.CurveTimeline2=v,t.DebugUtils=class{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},t.DeformTimeline=L,t.Downloader=qt,t.DrawOrderTimeline=U,t.Event=Ut,t.EventData=Wt,t.EventQueue=ot,t.EventTimeline=q,t.FIRST=ct,t.FakeTexture=class extends bt{setFilters(t,e){}setWraps(t,e){}dispose(){}},t.HOLD_FIRST=ut,t.HOLD_MIX=mt,t.HOLD_SUBSEQUENT=dt,t.IkConstraint=zt,t.IkConstraintData=Gt,t.IkConstraintTimeline=W,t.InheritTimeline=P,t.IntSet=class{array=new Array;add(t){let e=this.contains(t);return this.array[0|t]=0|t,!e}contains(t){return null!=this.array[0|t]}remove(t){this.array[0|t]=void 0}clear(){this.array.length=0}},t.Interpolation=r,t.MathUtils=a,t.MeshAttachment=Pt,t.PathAttachment=Xt,t.PathConstraint=jt,t.PathConstraintData=$t,t.PathConstraintMixTimeline=j,t.PathConstraintPositionTimeline=G,t.PathConstraintSpacingTimeline=$,t.PhysicsConstraintDampingTimeline=Q,t.PhysicsConstraintGravityTimeline=et,t.PhysicsConstraintInertiaTimeline=J,t.PhysicsConstraintMassTimeline=Z,t.PhysicsConstraintMixTimeline=st,t.PhysicsConstraintResetTimeline=it,t.PhysicsConstraintStrengthTimeline=K,t.PhysicsConstraintTimeline=H,t.PhysicsConstraintWindTimeline=tt,t.PointAttachment=_t,t.Pool=h,t.Pow=o,t.PowOut=class extends o{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},t.RGB2Timeline=O,t.RGBA2Timeline=D,t.RGBATimeline=X,t.RGBTimeline=_,t.RegionAttachment=Vt,t.RotateTimeline=k,t.SETUP=ft,t.SUBSEQUENT=ht,t.ScaleTimeline=B,t.ScaleXTimeline=C,t.ScaleYTimeline=F,t.SequenceTimeline=nt,t.ShearTimeline=E,t.ShearXTimeline=R,t.ShearYTimeline=Y,t.Skeleton=Qt,t.SkeletonBinary=ae,t.SkeletonBounds=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new h((()=>l.newFloatArray(16)));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,n=this.polygonPool,a=t.slots,r=a.length;s.length=0,n.freeAll(i),i.length=0;for(let t=0;t<r;t++){let e=a[t];if(!e.bone.active)continue;let r=e.getAttachment();if(r instanceof xt){let t=r;s.push(t);let a=n.obtain();a.length!=t.worldVerticesLength&&(a=l.newFloatArray(t.worldVerticesLength)),i.push(a),t.computeWorldVertices(e,0,t.worldVerticesLength,a,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,n=this.polygons;for(let a=0,r=n.length;a<r;a++){let r=n[a],o=r;for(let n=0,a=r.length;n<a;n+=2){let a=o[n],r=o[n+1];t=Math.min(t,a),e=Math.min(e,r),s=Math.max(s,a),i=Math.max(i,r)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,i){let n=this.minX,a=this.minY,r=this.maxX,o=this.maxY;if(t<=n&&s<=n||e<=a&&i<=a||t>=r&&s>=r||e>=o&&i>=o)return!1;let l=(i-e)/(s-t),h=l*(n-t)+e;if(h>a&&h<o)return!0;if(h=l*(r-t)+e,h>a&&h<o)return!0;let c=(a-e)/l+t;return c>n&&c<r||(c=(o-e)/l+t,c>n&&c<r)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let s=this.polygons;for(let i=0,n=s.length;i<n;i++)if(this.containsPointPolygon(s[i],t,e))return this.boundingBoxes[i];return null}containsPointPolygon(t,e,s){let i=t,n=t.length,a=n-2,r=!1;for(let t=0;t<n;t+=2){let n=i[t+1],o=i[a+1];if(n<s&&o>=s||o<s&&n>=s){let l=i[t];l+(s-n)/(o-n)*(i[a]-l)<e&&(r=!r)}a=t}return r}intersectsSegment(t,e,s,i){let n=this.polygons;for(let a=0,r=n.length;a<r;a++)if(this.intersectsSegmentPolygon(n[a],t,e,s,i))return this.boundingBoxes[a];return null}intersectsSegmentPolygon(t,e,s,i,n){let a=t,r=t.length,o=e-i,l=s-n,h=e*n-s*i,c=a[r-2],d=a[r-1];for(let t=0;t<r;t+=2){let r=a[t],u=a[t+1],m=c*u-d*r,f=c-r,p=d-u,g=o*p-l*f,x=(h*f-o*m)/g;if((x>=c&&x<=r||x>=r&&x<=c)&&(x>=e&&x<=i||x>=i&&x<=e)){let t=(h*p-l*m)/g;if((t>=d&&t<=u||t>=u&&t<=d)&&(t>=s&&t<=n||t>=n&&t<=s))return!0}c=r,d=u}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},t.SkeletonClipping=ze,t.SkeletonData=te,t.SkeletonDataResource=Is,t.SkeletonJson=Ge,t.Skin=se,t.SkinEntry=ee,t.Slot=Jt,t.SlotData=ie,t.SpineAnimationRenderer=ys,t.StringSet=i,t.Texture=bt,t.TextureAtlas=Ft,t.TextureAtlasPage=Rt,t.TextureAtlasRegion=Yt,t.TextureRegion=Ct,t.TimeKeeper=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},t.Timeline=y,t.TrackEntry=rt,t.TransformConstraint=Kt,t.TransformConstraintData=ne,t.TransformConstraintTimeline=z,t.TranslateTimeline=I,t.TranslateXTimeline=A,t.TranslateYTimeline=T,t.Triangulator=We,t.Utils=l,t.Vector2=c,t.VertexAttachment=u,t.WindowedMean=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}},t.createTextureAtlas=ss,t.version=Cs,Object.defineProperty(t,"__esModule",{value:!0})}));
|