@galacean/engine-spine 1.1.0-test.1 → 4.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -7
- package/dist/browser.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +1 -1
- 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 +37 -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/SpineAnimation.d.ts +0 -45
- package/types/SpineLoader.d.ts +0 -33
- package/types/SpineRenderer.d.ts +0 -38
- package/types/core/MeshGenerator.d.ts +0 -42
- 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/module.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{request as t,Texture2D as e,BufferMesh as n,VertexElement as r,VertexElementFormat as a,Buffer as i,BufferBindFlag as s,BufferUsage as o,IndexFormat as h,MeshRenderer as l,SubMesh as u,BlendFactor as c,BlendOperation as d,Shader as f,CullMode as p,RenderQueueType as v,Material as g,ignoreClone as m,Script as w,resourceLoader as E,AssetPromise as y,Entity as x,AssetType as b,Loader as S,TextureFilterMode as M,assignmentClone as A}from"@galacean/engine";function R(t,e){return R=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},R(t,e)}function T(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&&R(t,e)}function I(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 _(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 C(t,e,n){return e&&_(t.prototype,e),n&&_(t,n),t}function k(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 V(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 k(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)?k(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 P,F,N=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)}},C(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"}(P||(P={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(F||(F={}));var O=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},B=function(t){function e(){return t.apply(this,arguments)}T(e,t);var n=e.prototype;return n.setFilters=function(t,e){},n.setWraps=function(t,e){},n.dispose=function(){},e}(N),L=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 X(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 Y;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 h=parseInt(r[0]),l=parseInt(r[1]);n.readTuple(r);var u=parseInt(r[0]),c=parseInt(r[1]);s.u=h/a.width,s.v=l/a.height,s.rotate?(s.u2=(h+c)/a.width,s.v2=(l+u)/a.height):(s.u2=(h+u)/a.width,s.v2=(l+c)/a.height),s.x=h,s.y=l,s.width=Math.abs(u),s.height=Math.abs(c),4==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 D).name=i,2==n.readTuple(r)&&(a.width=parseInt(r[0]),a.height=parseInt(r[1]),n.readTuple(r)),n.readTuple(r),a.minFilter=N.filterFromString(r[0]),a.magFilter=N.filterFromString(r[1]);var d=n.readValue();a.uWrap=F.ClampToEdge,a.vWrap=F.ClampToEdge,"x"==d?a.uWrap=F.Repeat:"y"==d?a.vWrap=F.Repeat:"xy"==d&&(a.uWrap=a.vWrap=F.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}(),X=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}(),D=function(){},Y=function(t){function e(){return t.apply(this,arguments)}return T(e,t),e}(O),U=function(){function n(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 r=n.prototype;return r.downloadText=function(e,n,r){t(e,{type:"text"}).then((function(t){n(t)})).catch((function(t){r(t)}))},r.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()},r.setRawDataURI=function(t,e){this.rawDataUris[this.pathPrefix+t]=e},r.loadBinary=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null);var r=this;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++}))},r.loadText=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null);var r=this;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++}))},r.loadImage=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null);var r=this,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},r.loadTexture=function(e,n,r){void 0===n&&(n=null),void 0===r&&(r=null);var a=this,i=e=this.pathPrefix+e;this.toLoad++,this.rawDataUris[e]&&(e=this.rawDataUris[e]),t(e,{type:"image"}).then((function(t){var r=a.textureLoader(t);a.assets[i]=r,a.onLoad(),a.loaded++,n&&n(e,r)})).catch((function(t){r(t)}))},r.loadEngineTexture=function(t,e,n,r){void 0===n&&(n=null),void 0===r&&(r=null);var a=this,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)}))},r.loadTextureAtlas=function(t,n,r){void 0===n&&(n=null),void 0===r&&(r=null);var a=this,i=t.lastIndexOf("/")>=0?t.substring(0,t.lastIndexOf("/")):"";t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(s){var o=function(){var e=c.value,o=!1;a.loadTexture(e,(function(e,u){if(h.count++,h.count==l.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 L(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==l.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},l=new Array;try{new L(s,(function(t){return l.push(""==i?t:i+"/"+t),new B(new e(a.engine,16,16))}))}catch(e){var u=e;return a.errors[t]="Couldn't load texture atlas "+t+": "+u.message,r&&r("Couldn't load texture atlas "+t+": "+u.message),a.onLoad(),void a.loaded++}for(var c,d=V(l);!(c=d()).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++}))},r.get=function(t){return t=this.pathPrefix+t,this.assets[t]},r.remove=function(t){t=this.pathPrefix+t;var e=this.assets[t];e.dispose&&e.dispose(),this.assets[t]=null},r.removeAll=function(){for(var t in this.assets){var e=this.assets[t];e.dispose&&e.dispose()}this.assets={}},r.isLoadingComplete=function(){return 0==this.toLoad},r.onLoad=function(){this.toLoad--,0===this.toLoad&&this.onLoadComplete()},r.getToLoad=function(){return this.toLoad},r.getLoaded=function(){return this.loaded},r.dispose=function(){this.removeAll()},r.hasErrors=function(){return Object.keys(this.errors).length>0},r.getErrors=function(){return this.errors},C(n,[{key:"engine",get:function(){return this._engine}}]),n}();var W=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}(),q=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}();q.WHITE=new q(1,1,1,1),q.RED=new q(1,0,0,1),q.GREEN=new q(0,1,0,1),q.BLUE=new q(0,0,1,1),q.MAGENTA=new q(1,0,1,1);var H=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}();H.PI=3.1415927,H.PI2=2*H.PI,H.radiansToDegrees=180/H.PI,H.radDeg=H.radiansToDegrees,H.degreesToRadians=H.PI/180,H.degRad=H.degreesToRadians;var G=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}();G.SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;var j=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}(),z=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}(),Z=function(t){if(null==t)throw new Error("name cannot be null.");this.name=t},Q=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}T(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,h=this.vertices,l=this.bones;if(null!=l){for(var u=0,c=0,d=0;d<e;d+=2){var f=l[u];u+=f+1,c+=f}var p=s.bones;if(0==o.length)for(var v=a,g=3*c;v<n;v+=i){var m=0,w=0,E=l[u++];for(E+=u;u<E;u++,g+=3){var y=p[l[u]],x=h[g],b=h[g+1],S=h[g+2];m+=(x*y.a+b*y.b+y.worldX)*S,w+=(x*y.c+b*y.d+y.worldY)*S}r[v]=m,r[v+1]=w}else for(var M=o,A=a,R=3*c,T=c<<1;A<n;A+=i){var I=0,_=0,C=l[u++];for(C+=u;u<C;u++,R+=3,T+=2){var k=p[l[u]],V=h[R]+M[T],P=h[R+1]+M[T+1],F=h[R+2];I+=(V*k.a+P*k.b+k.worldX)*F,_+=(V*k.c+P*k.d+k.worldY)*F}r[A]=I,r[A+1]=_}}else{o.length>0&&(h=o);for(var N=t.bone,O=N.worldX,B=N.worldY,L=N.a,X=N.b,D=N.c,Y=N.d,U=e,W=a;W<n;U+=2,W+=i){var q=h[U],H=h[U+1];r[W]=q*L+H*X+O,r[W+1]=q*D+H*Y+B}}},n.copyTo=function(t){null!=this.bones?(t.bones=new Array(this.bones.length),G.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,null!=this.vertices?(t.vertices=G.newFloatArray(this.vertices.length),G.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment},e}(Z);Q.nextID=0;var J=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 q(1,1,1,1),n.offset=G.newFloatArray(8),n.uvs=G.newFloatArray(8),n.tempColor=new q(1,1,1,1),n}T(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,h=Math.cos(o),l=Math.sin(o),u=r*h+this.x,c=r*l,d=a*h+this.y,f=a*l,p=i*h+this.x,v=i*l,g=s*h+this.y,m=s*l,w=this.offset;w[e.OX1]=u-f,w[e.OY1]=d+c,w[e.OX2]=u-m,w[e.OY2]=g+c,w[e.OX3]=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,h=t.a,l=t.b,u=t.c,c=t.d,d=0,f=0;d=i[e.OX1],f=i[e.OY1],n[r]=d*h+f*l+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX2],f=i[e.OY2],n[r]=d*h+f*l+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX3],f=i[e.OY3],n[r]=d*h+f*l+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX4],f=i[e.OY4],n[r]=d*h+f*l+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,G.arrayCopy(this.uvs,0,t.uvs,0,8),G.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t},e}(Z);function K(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}J.OX1=0,J.OY1=1,J.OX2=2,J.OY2=3,J.OX3=4,J.OY3=5,J.OX4=6,J.OY4=7,J.X1=0,J.Y1=1,J.C1R=2,J.C1G=3,J.C1B=4,J.C1A=5,J.U1=6,J.V1=7,J.X2=8,J.Y2=9,J.C2R=10,J.C2G=11,J.C2B=12,J.C2A=13,J.U2=14,J.V2=15,J.X3=16,J.Y3=17,J.C3R=18,J.C3G=19,J.C3B=20,J.C3A=21,J.U3=22,J.V3=23,J.X4=24,J.Y4=25,J.C4R=26,J.C4G=27,J.C4B=28,J.C4A=29,J.U4=30,J.V4=31;var $,tt=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new q(1,1,1,1),n.tempColor=new q(0,0,0,0),n}T(e,t);var n=e.prototype;return n.updateUVs=function(){var t=this.regionUVs;null!=this.uvs&&this.uvs.length==t.length||(this.uvs=G.newFloatArray(t.length));var e=this.uvs,n=this.uvs.length,r=this.region.u,a=this.region.v,i=0,s=0;if(K(this.region,Y)){var o=this.region,h=o.texture.width,l=o.texture.height;switch(o.degrees){case 90:r-=(o.originalHeight-o.offsetY-o.height)/h,a-=(o.originalWidth-o.offsetX-o.width)/l,i=o.originalHeight/h,s=o.originalWidth/l;for(var u=0;u<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)/h,a-=o.offsetY/l,i=o.originalWidth/h,s=o.originalHeight/l;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/h,a-=o.offsetX/l,i=o.originalHeight/h,s=o.originalWidth/l;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/h,a-=(o.originalHeight-o.offsetY-o.height)/l,i=o.originalWidth/h,s=o.originalHeight/l}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),G.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),G.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),G.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,null!=this.edges&&(t.edges=new Array(this.edges.length),G.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}(Q),et=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new q(1,1,1,1),n}return T(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t},e}(Q),nt=function(t){function e(e){var n;return(n=t.call(this,e)||this).closed=!1,n.constantSpeed=!1,n.color=new q(1,1,1,1),n}return T(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),G.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t},e}(Q),rt=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new q(.38,.94,0,1),n.name=e,n}T(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=H.cosDeg(this.rotation),n=H.sinDeg(this.rotation),r=e*t.a+n*t.b,a=e*t.c+n*t.d;return Math.atan2(a,r)*H.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}(Q),at=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new q(.2275,.2275,.8078,1),n}return T(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}(Q),it=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 J(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 tt(e);return a.region=r,a},e.newBoundingBoxAttachment=function(t,e){return new et(e)},e.newPathAttachment=function(t,e){return new nt(e)},e.newPointAttachment=function(t,e){return new rt(e)},e.newClippingAttachment=function(t,e){return new at(e)},t}(),st=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}(),ot=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 q,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"}($||($={}));var ht,lt,ut,ct=function(t,e,n){if(this.color=new q(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},dt=function(t,e,n){this.name=t,this.order=e,this.skinRequired=n},ft=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 T(e,t),e}(dt),pt=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 T(e,t),e}(dt),vt=function(t){function e(e){var n;return(n=t.call(this,e,0,!1)||this).bones=new Array,n}return T(e,t),e}(dt);!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(ht||(ht={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent"}(lt||(lt={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(ut||(ut={}));var gt,mt,wt,Et=function(t,e,n){this.slotIndex=t,this.name=e,this.attachment=n},yt=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,h=0;h<this.constraints.length;h++)if(this.constraints[h]==s){o=!0;break}o||this.constraints.push(s)}for(var l=t.getAttachments(),u=0;u<l.length;u++){var c=l[u];this.setAttachment(c.slotIndex,c.name,c.attachment)}},e.copySkin=function(t){for(var e=0;e<t.bones.length;e++){for(var 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,h=0;h<this.constraints.length;h++)if(this.constraints[h]==s){o=!0;break}o||this.constraints.push(s)}for(var l=t.getAttachments(),u=0;u<l.length;u++){var c=l[u];null!=c.attachment&&(K(c.attachment,tt)?(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 Et(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 Et(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 h=this.getAttachment(n,o);null!=h&&a.setAttachment(h);break}}}n++}},t}(),xt=function(t){this.name=t},bt=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 h=this.timelines,l=0,u=h.length;l<u;l++)h[l].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"}(gt||(gt={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(mt||(mt={})),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"}(wt||(wt={}));var St=function(){function t(e){if(e<=0)throw new Error("frameCount must be > 0: "+e);this.curves=G.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),h=.006*(3*(n-a)+1),l=.006*(3*(r-i)+1),u=2*s+h,c=2*o+l,d=.3*n+s+.16666667*h,f=.3*r+o+.16666667*l,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+=h,c+=l,g+=d,m+=f},e.getCurvePercent=function(e,n){n=H.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,h=a+t.BEZIER_SIZE-1;a<h;a+=2)if((s=r[a])>=n){var l=void 0,u=void 0;return a==o?(l=0,u=0):(l=r[a-2],u=r[a-1]),u+(r[a+1]-u)*(n-l)/(s-l)}var c=r[a-1];return c+(1-c)*(n-s)/(1-s)},t}();St.LINEAR=0,St.STEPPED=1,St.BEZIER=2,St.BEZIER_SIZE=19;var Mt=function(t){function e(e){var n;return(n=t.call(this,e)||this).frames=G.newFloatArray(e<<1),n}T(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 h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(r<h[0])switch(s){case 0:return void(l.rotation=l.data.rotation);case 1:var u=l.data.rotation-l.rotation;l.rotation+=(u-360*(16384-(16384.499999999996-u/360|0)))*i}else if(r>=h[h.length-e.ENTRIES]){var c=h[h.length+e.PREV_ROTATION];switch(s){case 0:l.rotation=l.data.rotation+c*i;break;case 1:case 2:c+=l.data.rotation-l.rotation,c-=360*(16384-(16384.499999999996-c/360|0));case 3:l.rotation+=c*i}}else{var d=bt.binarySearch(h,r,e.ENTRIES),f=h[d+e.PREV_ROTATION],p=h[d],v=this.getCurvePercent((d>>1)-1,1-(r-p)/(h[d+e.PREV_TIME]-p)),g=h[d+e.ROTATION]-f;switch(g=f+(g-360*(16384-(16384.499999999996-g/360|0)))*v,s){case 0:l.rotation=l.data.rotation+(g-360*(16384-(16384.499999999996-g/360|0)))*i;break;case 1:case 2:g+=l.data.rotation-l.rotation;case 3:l.rotation+=(g-360*(16384-(16384.499999999996-g/360|0)))*i}}},e}(St);Mt.ENTRIES=2,Mt.PREV_TIME=-2,Mt.PREV_ROTATION=-1,Mt.ROTATION=1;var At=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=G.newFloatArray(n*e.ENTRIES),r}T(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 h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(r<h[0])switch(s){case 0:return l.x=l.data.x,void(l.y=l.data.y);case 1:l.x+=(l.data.x-l.x)*i,l.y+=(l.data.y-l.y)*i}else{var u=0,c=0;if(r>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_X],c=h[h.length+e.PREV_Y];else{var d=bt.binarySearch(h,r,e.ENTRIES);u=h[d+e.PREV_X],c=h[d+e.PREV_Y];var f=h[d],p=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(h[d+e.PREV_TIME]-f));u+=(h[d+e.X]-u)*p,c+=(h[d+e.Y]-c)*p}switch(s){case 0:l.x=l.data.x+u*i,l.y=l.data.y+c*i;break;case 1:case 2:l.x+=(l.data.x+u-l.x)*i,l.y+=(l.data.y+c-l.y)*i;break;case 3:l.x+=u*i,l.y+=c*i}}},e}(St);At.ENTRIES=3,At.PREV_TIME=-3,At.PREV_X=-2,At.PREV_Y=-1,At.X=1,At.Y=2;var Rt=function(t){function e(e){return t.call(this,e)}T(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 h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(r<h[0])switch(s){case 0:return l.scaleX=l.data.scaleX,void(l.scaleY=l.data.scaleY);case 1:l.scaleX+=(l.data.scaleX-l.scaleX)*i,l.scaleY+=(l.data.scaleY-l.scaleY)*i}else{var u=0,c=0;if(r>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_X]*l.data.scaleX,c=h[h.length+e.PREV_Y]*l.data.scaleY;else{var d=bt.binarySearch(h,r,e.ENTRIES);u=h[d+e.PREV_X],c=h[d+e.PREV_Y];var f=h[d],p=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(h[d+e.PREV_TIME]-f));u=(u+(h[d+e.X]-u)*p)*l.data.scaleX,c=(c+(h[d+e.Y]-c)*p)*l.data.scaleY}if(1==i)3==s?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{var v=0,g=0;if(1==o)switch(s){case 0:v=l.data.scaleX,g=l.data.scaleY,l.scaleX=v+(Math.abs(u)*H.signum(v)-v)*i,l.scaleY=g+(Math.abs(c)*H.signum(g)-g)*i;break;case 1:case 2:v=l.scaleX,g=l.scaleY,l.scaleX=v+(Math.abs(u)*H.signum(v)-v)*i,l.scaleY=g+(Math.abs(c)*H.signum(g)-g)*i;break;case 3:v=l.scaleX,g=l.scaleY,l.scaleX=v+(Math.abs(u)*H.signum(v)-l.data.scaleX)*i,l.scaleY=g+(Math.abs(c)*H.signum(g)-l.data.scaleY)*i}else switch(s){case 0:v=Math.abs(l.data.scaleX)*H.signum(u),g=Math.abs(l.data.scaleY)*H.signum(c),l.scaleX=v+(u-v)*i,l.scaleY=g+(c-g)*i;break;case 1:case 2:v=Math.abs(l.scaleX)*H.signum(u),g=Math.abs(l.scaleY)*H.signum(c),l.scaleX=v+(u-v)*i,l.scaleY=g+(c-g)*i;break;case 3:v=H.signum(u),g=H.signum(c),l.scaleX=Math.abs(l.scaleX)*v+(u-Math.abs(l.data.scaleX)*v)*i,l.scaleY=Math.abs(l.scaleY)*g+(c-Math.abs(l.data.scaleY)*g)*i}}}},e}(At),Tt=function(t){function e(e){return t.call(this,e)}T(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 h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(r<h[0])switch(s){case 0:return l.shearX=l.data.shearX,void(l.shearY=l.data.shearY);case 1:l.shearX+=(l.data.shearX-l.shearX)*i,l.shearY+=(l.data.shearY-l.shearY)*i}else{var u=0,c=0;if(r>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_X],c=h[h.length+e.PREV_Y];else{var d=bt.binarySearch(h,r,e.ENTRIES);u=h[d+e.PREV_X],c=h[d+e.PREV_Y];var f=h[d],p=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(h[d+e.PREV_TIME]-f));u+=(h[d+e.X]-u)*p,c+=(h[d+e.Y]-c)*p}switch(s){case 0:l.shearX=l.data.shearX+u*i,l.shearY=l.data.shearY+c*i;break;case 1:case 2:l.shearX+=(l.data.shearX+u-l.shearX)*i,l.shearY+=(l.data.shearY+c-l.shearY)*i;break;case 3:l.shearX+=u*i,l.shearY+=c*i}}},e}(At),It=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=G.newFloatArray(n*e.ENTRIES),r}T(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 h=t.slots[this.slotIndex];if(h.bone.active){var l=this.frames;if(r<l[0])switch(s){case 0:return void h.color.setFromColor(h.data.color);case 1:var u=h.color,c=h.data.color;u.add((c.r-u.r)*i,(c.g-u.g)*i,(c.b-u.b)*i,(c.a-u.a)*i)}else{var d=0,f=0,p=0,v=0;if(r>=l[l.length-e.ENTRIES]){var g=l.length;d=l[g+e.PREV_R],f=l[g+e.PREV_G],p=l[g+e.PREV_B],v=l[g+e.PREV_A]}else{var m=bt.binarySearch(l,r,e.ENTRIES);d=l[m+e.PREV_R],f=l[m+e.PREV_G],p=l[m+e.PREV_B],v=l[m+e.PREV_A];var w=l[m],E=this.getCurvePercent(m/e.ENTRIES-1,1-(r-w)/(l[m+e.PREV_TIME]-w));d+=(l[m+e.R]-d)*E,f+=(l[m+e.G]-f)*E,p+=(l[m+e.B]-p)*E,v+=(l[m+e.A]-v)*E}if(1==i)h.color.set(d,f,p,v);else{var y=h.color;0==s&&y.setFromColor(h.data.color),y.add((d-y.r)*i,(f-y.g)*i,(p-y.b)*i,(v-y.a)*i)}}}},e}(St);It.ENTRIES=5,It.PREV_TIME=-5,It.PREV_R=-4,It.PREV_G=-3,It.PREV_B=-2,It.PREV_A=-1,It.R=1,It.G=2,It.B=3,It.A=4;var _t=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=G.newFloatArray(n*e.ENTRIES),r}T(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,h,l){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]=h,this.frames[t+e.B2]=l},n.apply=function(t,n,r,a,i,s,o){var h=t.slots[this.slotIndex];if(h.bone.active){var l=this.frames;if(r<l[0])switch(s){case 0:return h.color.setFromColor(h.data.color),void h.darkColor.setFromColor(h.data.darkColor);case 1:var u=h.color,c=h.darkColor,d=h.data.color,f=h.data.darkColor;u.add((d.r-u.r)*i,(d.g-u.g)*i,(d.b-u.b)*i,(d.a-u.a)*i),c.add((f.r-c.r)*i,(f.g-c.g)*i,(f.b-c.b)*i,0)}else{var p=0,v=0,g=0,m=0,w=0,E=0,y=0;if(r>=l[l.length-e.ENTRIES]){var x=l.length;p=l[x+e.PREV_R],v=l[x+e.PREV_G],g=l[x+e.PREV_B],m=l[x+e.PREV_A],w=l[x+e.PREV_R2],E=l[x+e.PREV_G2],y=l[x+e.PREV_B2]}else{var b=bt.binarySearch(l,r,e.ENTRIES);p=l[b+e.PREV_R],v=l[b+e.PREV_G],g=l[b+e.PREV_B],m=l[b+e.PREV_A],w=l[b+e.PREV_R2],E=l[b+e.PREV_G2],y=l[b+e.PREV_B2];var S=l[b],M=this.getCurvePercent(b/e.ENTRIES-1,1-(r-S)/(l[b+e.PREV_TIME]-S));p+=(l[b+e.R]-p)*M,v+=(l[b+e.G]-v)*M,g+=(l[b+e.B]-g)*M,m+=(l[b+e.A]-m)*M,w+=(l[b+e.R2]-w)*M,E+=(l[b+e.G2]-E)*M,y+=(l[b+e.B2]-y)*M}if(1==i)h.color.set(p,v,g,m),h.darkColor.set(w,E,y,1);else{var A=h.color,R=h.darkColor;0==s&&(A.setFromColor(h.data.color),R.setFromColor(h.data.darkColor)),A.add((p-A.r)*i,(v-A.g)*i,(g-A.b)*i,(m-A.a)*i),R.add((w-R.r)*i,(E-R.g)*i,(y-R.b)*i,0)}}}},e}(St);_t.ENTRIES=8,_t.PREV_TIME=-8,_t.PREV_R=-7,_t.PREV_G=-6,_t.PREV_B=-5,_t.PREV_A=-4,_t.PREV_R2=-3,_t.PREV_G2=-2,_t.PREV_B2=-1,_t.R=1,_t.G=2,_t.B=3,_t.A=4,_t.R2=5,_t.G2=6,_t.B2=7;var Ct=function(){function t(t){this.frames=G.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 h=this.frames;if(n<h[0])0!=i&&1!=i||this.setAttachment(t,o,o.data.attachmentName);else{var l=0;l=n>=h[h.length-1]?h.length-1:bt.binarySearch(h,n,1)-1;var u=this.attachmentNames[l];t.slots[this.slotIndex].setAttachment(null==u?null:t.getAttachment(this.slotIndex,u))}}else 0==i&&this.setAttachment(t,o,o.data.attachmentName)},e.setAttachment=function(t,e,n){e.attachment=null==n?null:t.getAttachment(this.slotIndex,n)},t}(),kt=null,Vt=function(t){function e(e){var n;return(n=t.call(this,e)||this).frames=G.newFloatArray(e),n.frameVertices=new Array(e),null==kt&&(kt=G.newFloatArray(64)),n}T(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 h=o.getAttachment();if(K(h,Q)&&h.deformAttachment==this.attachment){var l=o.deform;0==l.length&&(i=0);var u=this.frameVertices,c=u[0].length,d=this.frames;if(n<d[0]){var f=h;switch(i){case 0:return void(l.length=0);case 1:if(1==a){l.length=0;break}var p=G.setArraySize(l,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=G.setArraySize(l,c);if(n>=d[d.length-1]){var w=u[d.length-1];if(1==a)if(3==i){var E=h;if(null==E.bones)for(var y=E.vertices,x=0;x<c;x++)m[x]+=w[x]-y[x];else for(var b=0;b<c;b++)m[b]+=w[b]}else G.arrayCopy(w,0,m,0,c);else switch(i){case 0:var S=h;if(null==S.bones)for(var M=S.vertices,A=0;A<c;A++){var R=M[A];m[A]=R+(w[A]-R)*a}else for(var T=0;T<c;T++)m[T]=w[T]*a;break;case 1:case 2:for(var I=0;I<c;I++)m[I]+=(w[I]-m[I])*a;break;case 3:var _=h;if(null==_.bones)for(var C=_.vertices,k=0;k<c;k++)m[k]+=(w[k]-C[k])*a;else for(var V=0;V<c;V++)m[V]+=w[V]*a}}else{var P=bt.binarySearch(d,n),F=u[P-1],N=u[P],O=d[P],B=this.getCurvePercent(P-1,1-(n-O)/(d[P-1]-O));if(1==a)if(3==i){var L=h;if(null==L.bones)for(var X=L.vertices,D=0;D<c;D++){var Y=F[D];m[D]+=Y+(N[D]-Y)*B-X[D]}else for(var U=0;U<c;U++){var W=F[U];m[U]+=W+(N[U]-W)*B}}else for(var q=0;q<c;q++){var H=F[q];m[q]=H+(N[q]-H)*B}else switch(i){case 0:var j=h;if(null==j.bones)for(var z=j.vertices,Z=0;Z<c;Z++){var J=F[Z],$=z[Z];m[Z]=$+(J+(N[Z]-J)*B-$)*a}else for(var tt=0;tt<c;tt++){var et=F[tt];m[tt]=(et+(N[tt]-et)*B)*a}break;case 1:case 2:for(var nt=0;nt<c;nt++){var rt=F[nt];m[nt]+=(rt+(N[nt]-rt)*B-m[nt])*a}break;case 3:var at=h;if(null==at.bones)for(var it=at.vertices,st=0;st<c;st++){var ot=F[st];m[st]+=(ot+(N[st]-ot)*B-it[st])*a}else for(var ht=0;ht<c;ht++){var lt=F[ht];m[ht]+=(lt+(N[ht]-lt)*B)*a}}}}}}},e}(St),Pt=function(){function t(t){this.frames=G.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,h=this.frames.length;if(e>n)this.apply(t,e,Number.MAX_VALUE,r,a,i,s),e=-1;else if(e>=o[h-1])return;if(!(n<o[0])){var l=0;if(e<o[0])l=0;else for(var u=o[l=bt.binarySearch(o,e)];l>0&&o[l-1]==u;)l--;for(;l<h&&n>=o[l];l++)r.push(this.events[l])}}},t}(),Ft=function(){function t(t){this.frames=G.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,h=t.slots;if(1!=s){var l=this.frames;if(n<l[0])0!=i&&1!=i||G.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{var u=0;u=n>=l[l.length-1]?l.length-1:bt.binarySearch(l,n)-1;var c=this.drawOrders[u];if(null==c)G.arrayCopy(h,0,o,0,h.length);else for(var d=0,f=c.length;d<f;d++)o[d]=h[c[d]]}}else 0==i&&G.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)},t}(),Nt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=G.newFloatArray(n*e.ENTRIES),r}T(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 h=this.frames,l=t.ikConstraints[this.ikConstraintIndex];if(l.active)if(r<h[0])switch(s){case 0:return l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,void(l.stretch=l.data.stretch);case 1:l.mix+=(l.data.mix-l.mix)*i,l.softness+=(l.data.softness-l.softness)*i,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}else if(r>=h[h.length-e.ENTRIES])0==s?(l.mix=l.data.mix+(h[h.length+e.PREV_MIX]-l.data.mix)*i,l.softness=l.data.softness+(h[h.length+e.PREV_SOFTNESS]-l.data.softness)*i,1==o?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=h[h.length+e.PREV_BEND_DIRECTION],l.compress=0!=h[h.length+e.PREV_COMPRESS],l.stretch=0!=h[h.length+e.PREV_STRETCH])):(l.mix+=(h[h.length+e.PREV_MIX]-l.mix)*i,l.softness+=(h[h.length+e.PREV_SOFTNESS]-l.softness)*i,0==o&&(l.bendDirection=h[h.length+e.PREV_BEND_DIRECTION],l.compress=0!=h[h.length+e.PREV_COMPRESS],l.stretch=0!=h[h.length+e.PREV_STRETCH]));else{var u=bt.binarySearch(h,r,e.ENTRIES),c=h[u+e.PREV_MIX],d=h[u+e.PREV_SOFTNESS],f=h[u],p=this.getCurvePercent(u/e.ENTRIES-1,1-(r-f)/(h[u+e.PREV_TIME]-f));0==s?(l.mix=l.data.mix+(c+(h[u+e.MIX]-c)*p-l.data.mix)*i,l.softness=l.data.softness+(d+(h[u+e.SOFTNESS]-d)*p-l.data.softness)*i,1==o?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=h[u+e.PREV_BEND_DIRECTION],l.compress=0!=h[u+e.PREV_COMPRESS],l.stretch=0!=h[u+e.PREV_STRETCH])):(l.mix+=(c+(h[u+e.MIX]-c)*p-l.mix)*i,l.softness+=(d+(h[u+e.SOFTNESS]-d)*p-l.softness)*i,0==o&&(l.bendDirection=h[u+e.PREV_BEND_DIRECTION],l.compress=0!=h[u+e.PREV_COMPRESS],l.stretch=0!=h[u+e.PREV_STRETCH]))}},e}(St);Nt.ENTRIES=6,Nt.PREV_TIME=-6,Nt.PREV_MIX=-5,Nt.PREV_SOFTNESS=-4,Nt.PREV_BEND_DIRECTION=-3,Nt.PREV_COMPRESS=-2,Nt.PREV_STRETCH=-1,Nt.MIX=1,Nt.SOFTNESS=2,Nt.BEND_DIRECTION=3,Nt.COMPRESS=4,Nt.STRETCH=5;var Ot=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=G.newFloatArray(n*e.ENTRIES),r}T(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 h=this.frames,l=t.transformConstraints[this.transformConstraintIndex];if(l.active)if(r<h[0]){var u=l.data;switch(s){case 0:return l.rotateMix=u.rotateMix,l.translateMix=u.translateMix,l.scaleMix=u.scaleMix,void(l.shearMix=u.shearMix);case 1:l.rotateMix+=(u.rotateMix-l.rotateMix)*i,l.translateMix+=(u.translateMix-l.translateMix)*i,l.scaleMix+=(u.scaleMix-l.scaleMix)*i,l.shearMix+=(u.shearMix-l.shearMix)*i}}else{var c=0,d=0,f=0,p=0;if(r>=h[h.length-e.ENTRIES]){var v=h.length;c=h[v+e.PREV_ROTATE],d=h[v+e.PREV_TRANSLATE],f=h[v+e.PREV_SCALE],p=h[v+e.PREV_SHEAR]}else{var g=bt.binarySearch(h,r,e.ENTRIES);c=h[g+e.PREV_ROTATE],d=h[g+e.PREV_TRANSLATE],f=h[g+e.PREV_SCALE],p=h[g+e.PREV_SHEAR];var m=h[g],w=this.getCurvePercent(g/e.ENTRIES-1,1-(r-m)/(h[g+e.PREV_TIME]-m));c+=(h[g+e.ROTATE]-c)*w,d+=(h[g+e.TRANSLATE]-d)*w,f+=(h[g+e.SCALE]-f)*w,p+=(h[g+e.SHEAR]-p)*w}if(0==s){var E=l.data;l.rotateMix=E.rotateMix+(c-E.rotateMix)*i,l.translateMix=E.translateMix+(d-E.translateMix)*i,l.scaleMix=E.scaleMix+(f-E.scaleMix)*i,l.shearMix=E.shearMix+(p-E.shearMix)*i}else l.rotateMix+=(c-l.rotateMix)*i,l.translateMix+=(d-l.translateMix)*i,l.scaleMix+=(f-l.scaleMix)*i,l.shearMix+=(p-l.shearMix)*i}},e}(St);Ot.ENTRIES=5,Ot.PREV_TIME=-5,Ot.PREV_ROTATE=-4,Ot.PREV_TRANSLATE=-3,Ot.PREV_SCALE=-2,Ot.PREV_SHEAR=-1,Ot.ROTATE=1,Ot.TRANSLATE=2,Ot.SCALE=3,Ot.SHEAR=4;var Bt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=G.newFloatArray(n*e.ENTRIES),r}T(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 h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(l.active)if(r<h[0])switch(s){case 0:return void(l.position=l.data.position);case 1:l.position+=(l.data.position-l.position)*i}else{var u=0;if(r>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_VALUE];else{var c=bt.binarySearch(h,r,e.ENTRIES);u=h[c+e.PREV_VALUE];var d=h[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(r-d)/(h[c+e.PREV_TIME]-d));u+=(h[c+e.VALUE]-u)*f}0==s?l.position=l.data.position+(u-l.data.position)*i:l.position+=(u-l.position)*i}},e}(St);Bt.ENTRIES=2,Bt.PREV_TIME=-2,Bt.PREV_VALUE=-1,Bt.VALUE=1;var Lt,Xt=function(t){function e(e){return t.call(this,e)}T(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 h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(l.active)if(r<h[0])switch(s){case 0:return void(l.spacing=l.data.spacing);case 1:l.spacing+=(l.data.spacing-l.spacing)*i}else{var u=0;if(r>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_VALUE];else{var c=bt.binarySearch(h,r,e.ENTRIES);u=h[c+e.PREV_VALUE];var d=h[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(r-d)/(h[c+e.PREV_TIME]-d));u+=(h[c+e.VALUE]-u)*f}0==s?l.spacing=l.data.spacing+(u-l.data.spacing)*i:l.spacing+=(u-l.spacing)*i}},e}(Bt),Dt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=G.newFloatArray(n*e.ENTRIES),r}T(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 h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(l.active)if(r<h[0])switch(s){case 0:return l.rotateMix=l.data.rotateMix,void(l.translateMix=l.data.translateMix);case 1:l.rotateMix+=(l.data.rotateMix-l.rotateMix)*i,l.translateMix+=(l.data.translateMix-l.translateMix)*i}else{var u=0,c=0;if(r>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_ROTATE],c=h[h.length+e.PREV_TRANSLATE];else{var d=bt.binarySearch(h,r,e.ENTRIES);u=h[d+e.PREV_ROTATE],c=h[d+e.PREV_TRANSLATE];var f=h[d],p=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(h[d+e.PREV_TIME]-f));u+=(h[d+e.ROTATE]-u)*p,c+=(h[d+e.TRANSLATE]-c)*p}0==s?(l.rotateMix=l.data.rotateMix+(u-l.data.rotateMix)*i,l.translateMix=l.data.translateMix+(c-l.data.translateMix)*i):(l.rotateMix+=(u-l.rotateMix)*i,l.translateMix+=(c-l.translateMix)*i)}},e}(St);Dt.ENTRIES=3,Dt.PREV_TIME=-3,Dt.PREV_ROTATE=-2,Dt.PREV_TRANSLATE=-1,Dt.ROTATE=1,Dt.TRANSLATE=2,function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(Lt||(Lt={}));var Yt,Ut=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e},Wt=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 st,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],h=null,l=this.getValue(o,"parent",null);if(null!=l&&null==(h=r.findBone(l)))throw new Error("Parent bone not found: "+l);var u=new ot(r.bones.length,o.name,h);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 ct(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 q(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 E=0;E<a.ik.length;E++){var y=a.ik[E],x=new ft(y.name);x.order=this.getValue(y,"order",0),x.skinRequired=this.getValue(y,"skin",!1);for(var b=0;b<y.bones.length;b++){var S=y.bones[b],M=r.findBone(S);if(null==M)throw new Error("IK bone not found: "+S);x.bones.push(M)}var A=y.target;if(x.target=r.findBone(A),null==x.target)throw new Error("IK target bone not found: "+A);x.mix=this.getValue(y,"mix",1),x.softness=this.getValue(y,"softness",0)*n,x.bendDirection=this.getValue(y,"bendPositive",!0)?1:-1,x.compress=this.getValue(y,"compress",!1),x.stretch=this.getValue(y,"stretch",!1),x.uniform=this.getValue(y,"uniform",!1),r.ikConstraints.push(x)}if(a.transform)for(var R=0;R<a.transform.length;R++){var T=a.transform[R],I=new pt(T.name);I.order=this.getValue(T,"order",0),I.skinRequired=this.getValue(T,"skin",!1);for(var _=0;_<T.bones.length;_++){var C=T.bones[_],k=r.findBone(C);if(null==k)throw new Error("Transform constraint bone not found: "+C);I.bones.push(k)}var V=T.target;if(I.target=r.findBone(V),null==I.target)throw new Error("Transform constraint target bone not found: "+V);I.local=this.getValue(T,"local",!1),I.relative=this.getValue(T,"relative",!1),I.offsetRotation=this.getValue(T,"rotation",0),I.offsetX=this.getValue(T,"x",0)*n,I.offsetY=this.getValue(T,"y",0)*n,I.offsetScaleX=this.getValue(T,"scaleX",0),I.offsetScaleY=this.getValue(T,"scaleY",0),I.offsetShearY=this.getValue(T,"shearY",0),I.rotateMix=this.getValue(T,"rotateMix",1),I.translateMix=this.getValue(T,"translateMix",1),I.scaleMix=this.getValue(T,"scaleMix",1),I.shearMix=this.getValue(T,"shearMix",1),r.transformConstraints.push(I)}if(a.path)for(var P=0;P<a.path.length;P++){var F=a.path[P],N=new vt(F.name);N.order=this.getValue(F,"order",0),N.skinRequired=this.getValue(F,"skin",!1);for(var O=0;O<F.bones.length;O++){var B=F.bones[O],L=r.findBone(B);if(null==L)throw new Error("Transform constraint bone not found: "+B);N.bones.push(L)}var X=F.target;if(N.target=r.findSlot(X),null==N.target)throw new Error("Path target slot not found: "+X);N.positionMode=t.positionModeFromString(this.getValue(F,"positionMode","percent")),N.spacingMode=t.spacingModeFromString(this.getValue(F,"spacingMode","length")),N.rotateMode=t.rotateModeFromString(this.getValue(F,"rotateMode","tangent")),N.offsetRotation=this.getValue(F,"rotation",0),N.position=this.getValue(F,"position",0),N.positionMode==ht.Fixed&&(N.position*=n),N.spacing=this.getValue(F,"spacing",0),N.spacingMode!=lt.Length&&N.spacingMode!=lt.Fixed||(N.spacing*=n),N.rotateMix=this.getValue(F,"rotateMix",1),N.translateMix=this.getValue(F,"translateMix",1),r.pathConstraints.push(N)}if(a.skins)for(var D=0;D<a.skins.length;D++){var Y=a.skins[D],U=new yt(Y.name);if(Y.bones)for(var W=0;W<Y.bones.length;W++){var H=r.findBone(Y.bones[W]);if(null==H)throw new Error("Skin bone not found: "+Y.bones[D]);U.bones.push(H)}if(Y.ik)for(var G=0;G<Y.ik.length;G++){var j=r.findIkConstraint(Y.ik[G]);if(null==j)throw new Error("Skin IK constraint not found: "+Y.ik[D]);U.constraints.push(j)}if(Y.transform)for(var z=0;z<Y.transform.length;z++){var Z=r.findTransformConstraint(Y.transform[z]);if(null==Z)throw new Error("Skin transform constraint not found: "+Y.transform[D]);U.constraints.push(Z)}if(Y.path)for(var Q=0;Q<Y.path.length;Q++){var J=r.findPathConstraint(Y.path[Q]);if(null==J)throw new Error("Skin path constraint not found: "+Y.path[D]);U.constraints.push(J)}for(var K in Y.attachments){var $=r.findSlot(K);if(null==$)throw new Error("Slot not found: "+K);var tt=Y.attachments[K];for(var et in tt){var nt=this.readAttachment(tt[et],U,$.index,et,r);null!=nt&&U.setAttachment($.index,et,nt)}}r.skins.push(U),"default"==U.name&&(r.defaultSkin=U)}for(var rt=0,at=this.linkedMeshes.length;rt<at;rt++){var it=this.linkedMeshes[rt],ut=null==it.skin?r.defaultSkin:r.findSkin(it.skin);if(null==ut)throw new Error("Skin not found: "+it.skin);var dt=ut.getAttachment(it.slotIndex,it.parent);if(null==dt)throw new Error("Parent mesh not found: "+it.parent);it.mesh.deformAttachment=it.inheritDeform?dt:it.mesh,it.mesh.setParentMesh(dt),it.mesh.updateUVs()}if(this.linkedMeshes.length=0,a.events)for(var gt in a.events){var mt=a.events[gt],wt=new xt(gt);wt.intValue=this.getValue(mt,"int",0),wt.floatValue=this.getValue(mt,"float",0),wt.stringValue=this.getValue(mt,"string",""),wt.audioPath=this.getValue(mt,"audio",null),null!=wt.audioPath&&(wt.volume=this.getValue(mt,"volume",1),wt.balance=this.getValue(mt,"balance",0)),r.events.push(wt)}if(a.animations)for(var Et in a.animations){var bt=a.animations[Et];this.readAnimation(bt,Et,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 h=this.getValue(t,"color",null);return null!=h&&o.color.setFromString(h),o.updateOffset(),o;case"boundingbox":var l=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(null==l)return null;this.readVertices(t,l,t.vertexCount<<1);var u=this.getValue(t,"color",null);return null!=u&&l.color.setFromString(u),l;case"mesh":case"linkedmesh":var c=this.getValue(t,"path",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 qt(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=G.newArray(m/3,0),E=0;E<t.lengths.length;E++)w[E]=t.lengths[E]*i;g.lengths=w;var y=this.getValue(t,"color",null);return null!=y&&g.color.setFromString(y),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 b=this.getValue(t,"color",null);return null!=b&&x.color.setFromString(b),x;case"clipping":var S=this.attachmentLoader.newClippingAttachment(e,r);if(null==S)return null;var M=this.getValue(t,"end",null);if(null!=M){var A=a.findSlot(M);if(null==A)throw new Error("Clipping end slot not found: "+M);S.endSlot=A}var R=t.vertexCount;this.readVertices(t,S,R<<1);var T=this.getValue(t,"color",null);return null!=T&&S.color.setFromString(T),S}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,h=a.length;o<h;){var l=a[o++];s.push(l);for(var u=o+4*l;o<u;o+=4)s.push(a[o]),i.push(a[o+1]*r),i.push(a[o+2]*r),i.push(a[o+3])}e.bones=s,e.vertices=G.toFloatArray(i)}else{var c=G.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],h=n.findSlotIndex(s);if(-1==h)throw new Error("Slot not found: "+s);for(var l in o){var u=o[l];if("attachment"==l){var c=new Ct(u.length);c.slotIndex=h;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"==l){var v=new It(u.length);v.slotIndex=h;for(var g=0,m=0;m<u.length;m++){var w=u[m],E=new q;E.setFromString(w.color),v.setFrame(g,this.getValue(w,"time",0),E.r,E.g,E.b,E.a),this.readCurve(w,v,g),g++}a.push(v),i=Math.max(i,v.frames[(v.getFrameCount()-1)*It.ENTRIES])}else{if("twoColor"!=l)throw new Error("Invalid timeline type for a slot: "+l+" ("+s+")");var y=new _t(u.length);y.slotIndex=h;for(var x=0,b=0;b<u.length;b++){var S=u[b],M=new q,A=new q;M.setFromString(S.light),A.setFromString(S.dark),y.setFrame(x,this.getValue(S,"time",0),M.r,M.g,M.b,M.a,A.r,A.g,A.b),this.readCurve(S,y,x),x++}a.push(y),i=Math.max(i,y.frames[(y.getFrameCount()-1)*_t.ENTRIES])}}}if(t.bones)for(var R in t.bones){var T=t.bones[R],I=n.findBoneIndex(R);if(-1==I)throw new Error("Bone not found: "+R);for(var _ in T){var C=T[_];if("rotate"===_){var k=new Mt(C.length);k.boneIndex=I;for(var V=0,P=0;P<C.length;P++){var F=C[P];k.setFrame(V,this.getValue(F,"time",0),this.getValue(F,"angle",0)),this.readCurve(F,k,V),V++}a.push(k),i=Math.max(i,k.frames[(k.getFrameCount()-1)*Mt.ENTRIES])}else{if("translate"!==_&&"scale"!==_&&"shear"!==_)throw new Error("Invalid timeline type for a bone: "+_+" ("+R+")");var N=null,O=1,B=0;"scale"===_?(N=new Rt(C.length),B=1):"shear"===_?N=new Tt(C.length):(N=new At(C.length),O=r),N.boneIndex=I;for(var L=0,X=0;X<C.length;X++){var D=C[X],Y=this.getValue(D,"x",B),U=this.getValue(D,"y",B);N.setFrame(L,this.getValue(D,"time",0),Y*O,U*O),this.readCurve(D,N,L),L++}a.push(N),i=Math.max(i,N.frames[(N.getFrameCount()-1)*At.ENTRIES])}}}if(t.ik)for(var W in t.ik){var H=t.ik[W],j=n.findIkConstraint(W),z=new Nt(H.length);z.ikConstraintIndex=n.ikConstraints.indexOf(j);for(var Z=0,Q=0;Q<H.length;Q++){var J=H[Q];z.setFrame(Z,this.getValue(J,"time",0),this.getValue(J,"mix",1),this.getValue(J,"softness",0)*r,this.getValue(J,"bendPositive",!0)?1:-1,this.getValue(J,"compress",!1),this.getValue(J,"stretch",!1)),this.readCurve(J,z,Z),Z++}a.push(z),i=Math.max(i,z.frames[(z.getFrameCount()-1)*Nt.ENTRIES])}if(t.transform)for(var K in t.transform){var $=t.transform[K],tt=n.findTransformConstraint(K),et=new Ot($.length);et.transformConstraintIndex=n.transformConstraints.indexOf(tt);for(var nt=0,rt=0;rt<$.length;rt++){var at=$[rt];et.setFrame(nt,this.getValue(at,"time",0),this.getValue(at,"rotateMix",1),this.getValue(at,"translateMix",1),this.getValue(at,"scaleMix",1),this.getValue(at,"shearMix",1)),this.readCurve(at,et,nt),nt++}a.push(et),i=Math.max(i,et.frames[(et.getFrameCount()-1)*Ot.ENTRIES])}if(t.path)for(var it in t.path){var st=t.path[it],ot=n.findPathConstraintIndex(it);if(-1==ot)throw new Error("Path constraint not found: "+it);var ut=n.pathConstraints[ot];for(var ct in st){var dt=st[ct];if("position"===ct||"spacing"===ct){var ft=null,pt=1;"spacing"===ct?(ft=new Xt(dt.length),ut.spacingMode!=lt.Length&&ut.spacingMode!=lt.Fixed||(pt=r)):(ft=new Bt(dt.length),ut.positionMode==ht.Fixed&&(pt=r)),ft.pathConstraintIndex=ot;for(var vt=0,gt=0;gt<dt.length;gt++){var mt=dt[gt];ft.setFrame(vt,this.getValue(mt,"time",0),this.getValue(mt,ct,0)*pt),this.readCurve(mt,ft,vt),vt++}a.push(ft),i=Math.max(i,ft.frames[(ft.getFrameCount()-1)*Bt.ENTRIES])}else if("mix"===ct){var wt=new Dt(dt.length);wt.pathConstraintIndex=ot;for(var Et=0,yt=0;yt<dt.length;yt++){var xt=dt[yt];wt.setFrame(Et,this.getValue(xt,"time",0),this.getValue(xt,"rotateMix",1),this.getValue(xt,"translateMix",1)),this.readCurve(xt,wt,Et),Et++}a.push(wt),i=Math.max(i,wt.frames[(wt.getFrameCount()-1)*Dt.ENTRIES])}}}if(t.deform)for(var St in t.deform){var kt=t.deform[St],Lt=n.findSkin(St);if(null==Lt)throw new Error("Skin not found: "+St);for(var Yt in kt){var Wt=kt[Yt],qt=n.findSlotIndex(Yt);if(-1==qt)throw new Error("Slot not found: "+Wt.name);for(var Ht in Wt){var Gt=Wt[Ht],jt=Lt.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 Vt(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?G.newFloatArray(Qt):Zt;else{ee=G.newFloatArray(Qt);var re=this.getValue(te,"offset",0);if(G.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 he=new Ft(oe.length),le=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=G.newArray(le,-1);for(var ve=G.newArray(le-pe.length,0),ge=0,me=0,we=0;we<pe.length;we++){var Ee=pe[we],ye=n.findSlotIndex(Ee.slot);if(-1==ye)throw new Error("Slot not found: "+Ee.slot);for(;ge!=ye;)ve[me++]=ge++;fe[ge+Ee.offset]=ge++}for(;ge<le;)ve[me++]=ge++;for(var xe=le-1;xe>=0;xe--)-1==fe[xe]&&(fe[xe]=ve[--me])}he.setFrame(ue++,this.getValue(de,"time",0),fe)}a.push(he),i=Math.max(i,he.frames[he.getFrameCount()-1])}if(t.events){for(var be=new Pt(t.events.length),Se=0,Me=0;Me<t.events.length;Me++){var Ae=t.events[Me],Re=n.findEvent(Ae.name);if(null==Re)throw new Error("Event not found: "+Ae.name);var Te=new Ut(G.toSinglePrecision(this.getValue(Ae,"time",0)),Re);Te.intValue=this.getValue(Ae,"int",Re.intValue),Te.floatValue=this.getValue(Ae,"float",Re.floatValue),Te.stringValue=this.getValue(Ae,"string",Re.stringValue),null!=Te.data.audioPath&&(Te.volume=this.getValue(Ae,"volume",1),Te.balance=this.getValue(Ae,"balance",0)),be.setFrame(Se++,Te)}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 bt(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 Lt.Normal;if("additive"==t)return Lt.Additive;if("multiply"==t)return Lt.Multiply;if("screen"==t)return Lt.Screen;throw new Error("Unknown blend mode: "+t)},t.positionModeFromString=function(t){if("fixed"==(t=t.toLowerCase()))return ht.Fixed;if("percent"==t)return ht.Percent;throw new Error("Unknown position mode: "+t)},t.spacingModeFromString=function(t){if("length"==(t=t.toLowerCase()))return lt.Length;if("fixed"==t)return lt.Fixed;if("percent"==t)return lt.Percent;throw new Error("Unknown position mode: "+t)},t.rotateModeFromString=function(t){if("tangent"==(t=t.toLowerCase()))return ut.Tangent;if("chain"==t)return ut.Chain;if("chainscale"==t)return ut.ChainScale;throw new Error("Unknown rotate mode: "+t)},t.transformModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return $.Normal;if("onlytranslation"==t)return $.OnlyTranslation;if("norotationorreflection"==t)return $.NoRotationOrReflection;if("noscale"==t)return $.NoScale;if("noscaleorreflection"==t)return $.NoScaleOrReflection;throw new Error("Unknown transform mode: "+t)},t}(),qt=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"}(Yt||(Yt={}));var Ht=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 st;r.name="";var a=new Gt(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 h=0;h<s;h++){var l=a.readString(),u=0==h?null:r.bones[a.readInt(!0)],c=new ot(h,l,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&&q.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 ct(d,f,p);q.rgba8888ToColor(v.color,a.readInt32());var g=a.readInt32();-1!=g&&q.rgb888ToColor(v.darkColor=new q,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 E=new ft(a.readString());E.order=a.readInt(!0),E.skinRequired=a.readBoolean(),m=a.readInt(!0);for(var y=0;y<m;y++)E.bones.push(r.bones[a.readInt(!0)]);E.target=r.bones[a.readInt(!0)],E.mix=a.readFloat(),E.softness=a.readFloat()*n,E.bendDirection=a.readByte(),E.compress=a.readBoolean(),E.stretch=a.readBoolean(),E.uniform=a.readBoolean(),r.ikConstraints.push(E)}s=a.readInt(!0);for(var x,b=0;b<s;b++){var S=new pt(a.readString());S.order=a.readInt(!0),S.skinRequired=a.readBoolean(),x=a.readInt(!0);for(var M=0;M<x;M++)S.bones.push(r.bones[a.readInt(!0)]);S.target=r.bones[a.readInt(!0)],S.local=a.readBoolean(),S.relative=a.readBoolean(),S.offsetRotation=a.readFloat(),S.offsetX=a.readFloat()*n,S.offsetY=a.readFloat()*n,S.offsetScaleX=a.readFloat(),S.offsetScaleY=a.readFloat(),S.offsetShearY=a.readFloat(),S.rotateMix=a.readFloat(),S.translateMix=a.readFloat(),S.scaleMix=a.readFloat(),S.shearMix=a.readFloat(),r.transformConstraints.push(S)}s=a.readInt(!0);for(var A,R=0;R<s;R++){var T=new vt(a.readString());T.order=a.readInt(!0),T.skinRequired=a.readBoolean(),A=a.readInt(!0);for(var I=0;I<A;I++)T.bones.push(r.bones[a.readInt(!0)]);T.target=r.slots[a.readInt(!0)],T.positionMode=t.PositionModeValues[a.readInt(!0)],T.spacingMode=t.SpacingModeValues[a.readInt(!0)],T.rotateMode=t.RotateModeValues[a.readInt(!0)],T.offsetRotation=a.readFloat(),T.position=a.readFloat(),T.positionMode==ht.Fixed&&(T.position*=n),T.spacing=a.readFloat(),T.spacingMode!=lt.Length&&T.spacingMode!=lt.Fixed||(T.spacing*=n),T.rotateMix=a.readFloat(),T.translateMix=a.readFloat(),r.pathConstraints.push(T)}var _=this.readSkin(a,r,!0,i);null!=_&&(r.defaultSkin=_,r.skins.push(_));var C=r.skins.length;for(G.setArraySize(r.skins,s=C+a.readInt(!0));C<s;C++)r.skins[C]=this.readSkin(a,r,!1,i);s=this.linkedMeshes.length;for(var k=0;k<s;k++){var V=this.linkedMeshes[k],P=null==V.skin?r.defaultSkin:r.findSkin(V.skin);if(null==P)throw new Error("Skin not found: "+V.skin);var F=P.getAttachment(V.slotIndex,V.parent);if(null==F)throw new Error("Parent mesh not found: "+V.parent);V.mesh.deformAttachment=V.inheritDeform?F:V.mesh,V.mesh.setParentMesh(F),V.mesh.updateUVs()}this.linkedMeshes.length=0,s=a.readInt(!0);for(var N=0;N<s;N++){var O=new xt(a.readStringRef());O.intValue=a.readInt(!1),O.floatValue=a.readFloat(),O.stringValue=a.readString(),O.audioPath=a.readString(),null!=O.audioPath&&(O.volume=a.readFloat(),O.balance=a.readFloat()),r.events.push(O)}s=a.readInt(!0);for(var B=0;B<s;B++)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 yt("default")}else{(a=new yt(t.readStringRef())).bones.length=t.readInt(!0);for(var s=0,o=a.bones.length;s<o;s++)a.bones[s]=e.bones[t.readInt(!0)];for(var h=0,l=t.readInt(!0);h<l;h++)a.constraints.push(e.ikConstraints[t.readInt(!0)]);for(var u=0,c=t.readInt(!0);u<c;u++)a.constraints.push(e.transformConstraints[t.readInt(!0)]);for(var d=0,f=t.readInt(!0);d<f;d++)a.constraints.push(e.pathConstraints[t.readInt(!0)]);i=t.readInt(!0)}for(var p=0;p<i;p++)for(var v=t.readInt(!0),g=0,m=t.readInt(!0);g<m;g++){var w=t.readStringRef(),E=this.readAttachment(t,e,a,v,w,r);null!=E&&a.setAttachment(v,w,E)}return a},e.readAttachment=function(e,n,r,a,i,s){var o=this.scale,h=e.readStringRef();null==h&&(h=i);var l=e.readByte();switch(t.AttachmentTypeValues[l]){case Yt.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=h);var E=this.attachmentLoader.newRegionAttachment(r,h,u);return null==E?null:(E.path=u,E.x=d*o,E.y=f*o,E.scaleX=p,E.scaleY=v,E.rotation=c,E.width=g*o,E.height=m*o,q.rgba8888ToColor(E.color,w),E.updateOffset(),E);case Yt.BoundingBox:var y=e.readInt(!0),x=this.readVertices(e,y),b=s?e.readInt32():0,S=this.attachmentLoader.newBoundingBoxAttachment(r,h);return null==S?null:(S.worldVerticesLength=y<<1,S.vertices=x.vertices,S.bones=x.bones,s&&q.rgba8888ToColor(S.color,b),S);case Yt.Mesh:var M=e.readStringRef(),A=e.readInt32(),R=e.readInt(!0),T=this.readFloatArray(e,R<<1,1),I=this.readShortArray(e),_=this.readVertices(e,R),C=e.readInt(!0),k=null,V=0,P=0;s&&(k=this.readShortArray(e),V=e.readFloat(),P=e.readFloat()),null==M&&(M=h);var F=this.attachmentLoader.newMeshAttachment(r,h,M);return null==F?null:(F.path=M,q.rgba8888ToColor(F.color,A),F.bones=_.bones,F.vertices=_.vertices,F.worldVerticesLength=R<<1,F.triangles=I,F.regionUVs=T,F.updateUVs(),F.hullLength=C<<1,s&&(F.edges=k,F.width=V*o,F.height=P*o),F);case Yt.LinkedMesh:var N=e.readStringRef(),O=e.readInt32(),B=e.readStringRef(),L=e.readStringRef(),X=e.readBoolean(),D=0,Y=0;s&&(D=e.readFloat(),Y=e.readFloat()),null==N&&(N=h);var U=this.attachmentLoader.newMeshAttachment(r,h,N);return null==U?null:(U.path=N,q.rgba8888ToColor(U.color,O),s&&(U.width=D*o,U.height=Y*o),this.linkedMeshes.push(new jt(U,B,a,L,X)),U);case Yt.Path:for(var W=e.readBoolean(),H=e.readBoolean(),j=e.readInt(!0),z=this.readVertices(e,j),Z=G.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,h);return null==$?null:($.closed=W,$.constantSpeed=H,$.worldVerticesLength=j<<1,$.vertices=z.vertices,$.bones=z.bones,$.lengths=Z,s&&q.rgba8888ToColor($.color,K),$);case Yt.Point:var tt=e.readFloat(),et=e.readFloat(),nt=e.readFloat(),rt=s?e.readInt32():0,at=this.attachmentLoader.newPointAttachment(r,h);return null==at?null:(at.x=et*o,at.y=nt*o,at.rotation=tt,s&&q.rgba8888ToColor(at.color,rt),at);case Yt.Clipping:var it=e.readInt(!0),st=e.readInt(!0),ot=this.readVertices(e,st),ht=s?e.readInt32():0,lt=this.attachmentLoader.newClippingAttachment(r,h);return null==lt?null:(lt.endSlot=n.slots[it],lt.worldVerticesLength=st<<1,lt.vertices=ot.vertices,lt.bones=ot.bones,s&&q.rgba8888ToColor(lt.color,ht),lt)}return null},e.readVertices=function(t,e){var n=e<<1,r=new zt,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 h=t.readInt(!0);s.push(h);for(var l=0;l<h;l++)s.push(t.readInt(!0)),i.push(t.readFloat()*a),i.push(t.readFloat()*a),i.push(t.readFloat())}return r.vertices=G.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 q,h=new q,l=0,u=e.readInt(!0);l<u;l++)for(var c=e.readInt(!0),d=0,f=e.readInt(!0);d<f;d++){var p=e.readByte(),v=e.readInt(!0);switch(p){case t.SLOT_ATTACHMENT:var g=new Ct(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 It(v);w.slotIndex=c;for(var E=0;E<v;E++){var y=e.readFloat();q.rgba8888ToColor(o,e.readInt32()),w.setFrame(E,y,o.r,o.g,o.b,o.a),E<v-1&&this.readCurve(e,E,w)}a.push(w),s=Math.max(s,w.frames[(v-1)*It.ENTRIES]);break;case t.SLOT_TWO_COLOR:var x=new _t(v);x.slotIndex=c;for(var b=0;b<v;b++){var S=e.readFloat();q.rgba8888ToColor(o,e.readInt32()),q.rgb888ToColor(h,e.readInt32()),x.setFrame(b,S,o.r,o.g,o.b,o.a,h.r,h.g,h.b),b<v-1&&this.readCurve(e,b,x)}a.push(x),s=Math.max(s,x.frames[(v-1)*_t.ENTRIES])}}for(var M=0,A=e.readInt(!0);M<A;M++)for(var R=e.readInt(!0),T=0,I=e.readInt(!0);T<I;T++){var _=e.readByte(),C=e.readInt(!0);switch(_){case t.BONE_ROTATE:var k=new Mt(C);k.boneIndex=R;for(var V=0;V<C;V++)k.setFrame(V,e.readFloat(),e.readFloat()),V<C-1&&this.readCurve(e,V,k);a.push(k),s=Math.max(s,k.frames[(C-1)*Mt.ENTRIES]);break;case t.BONE_TRANSLATE:case t.BONE_SCALE:case t.BONE_SHEAR:var P=void 0,F=1;_==t.BONE_SCALE?P=new Rt(C):_==t.BONE_SHEAR?P=new Tt(C):(P=new At(C),F=i),P.boneIndex=R;for(var N=0;N<C;N++)P.setFrame(N,e.readFloat(),e.readFloat()*F,e.readFloat()*F),N<C-1&&this.readCurve(e,N,P);a.push(P),s=Math.max(s,P.frames[(C-1)*At.ENTRIES])}}for(var O=0,B=e.readInt(!0);O<B;O++){var L=e.readInt(!0),X=e.readInt(!0),D=new Nt(X);D.ikConstraintIndex=L;for(var Y=0;Y<X;Y++)D.setFrame(Y,e.readFloat(),e.readFloat(),e.readFloat()*i,e.readByte(),e.readBoolean(),e.readBoolean()),Y<X-1&&this.readCurve(e,Y,D);a.push(D),s=Math.max(s,D.frames[(X-1)*Nt.ENTRIES])}for(var U=0,W=e.readInt(!0);U<W;U++){var H=e.readInt(!0),j=e.readInt(!0),z=new Ot(j);z.transformConstraintIndex=H;for(var Z=0;Z<j;Z++)z.setFrame(Z,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat()),Z<j-1&&this.readCurve(e,Z,z);a.push(z),s=Math.max(s,z.frames[(j-1)*Ot.ENTRIES])}for(var Q=0,J=e.readInt(!0);Q<J;Q++)for(var K=e.readInt(!0),$=r.pathConstraints[K],tt=0,et=e.readInt(!0);tt<et;tt++){var nt=e.readByte(),rt=e.readInt(!0);switch(nt){case t.PATH_POSITION:case t.PATH_SPACING:var at=void 0,it=1;nt==t.PATH_SPACING?(at=new Xt(rt),$.spacingMode!=lt.Length&&$.spacingMode!=lt.Fixed||(it=i)):(at=new Bt(rt),$.positionMode==ht.Fixed&&(it=i)),at.pathConstraintIndex=K;for(var st=0;st<rt;st++)at.setFrame(st,e.readFloat(),e.readFloat()*it),st<rt-1&&this.readCurve(e,st,at);a.push(at),s=Math.max(s,at.frames[(rt-1)*Bt.ENTRIES]);break;case t.PATH_MIX:var ot=new Dt(rt);ot.pathConstraintIndex=K;for(var ut=0;ut<rt;ut++)ot.setFrame(ut,e.readFloat(),e.readFloat(),e.readFloat()),ut<rt-1&&this.readCurve(e,ut,ot);a.push(ot),s=Math.max(s,ot.frames[(rt-1)*Dt.ENTRIES])}}for(var ct=0,dt=e.readInt(!0);ct<dt;ct++)for(var ft=r.skins[e.readInt(!0)],pt=0,vt=e.readInt(!0);pt<vt;pt++)for(var gt=e.readInt(!0),mt=0,wt=e.readInt(!0);mt<wt;mt++){var Et=ft.getAttachment(gt,e.readStringRef()),yt=null!=Et.bones,xt=Et.vertices,St=yt?xt.length/3*2:xt.length,kt=e.readInt(!0),Lt=new Vt(kt);Lt.slotIndex=gt,Lt.attachment=Et;for(var Yt=0;Yt<kt;Yt++){var Wt=e.readFloat(),qt=void 0,Ht=e.readInt(!0);if(0==Ht)qt=yt?G.newFloatArray(St):xt;else{qt=G.newFloatArray(St);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(!yt)for(var Zt=0,Qt=qt.length;Zt<Qt;Zt++)qt[Zt]+=xt[Zt]}Lt.setFrame(Yt,Wt,qt),Yt<kt-1&&this.readCurve(e,Yt,Lt)}a.push(Lt),s=Math.max(s,Lt.frames[kt-1])}var Jt=e.readInt(!0);if(Jt>0){for(var Kt=new Ft(Jt),$t=r.slots.length,te=0;te<Jt;te++){for(var ee=e.readFloat(),ne=e.readInt(!0),re=G.newArray($t,0),ae=$t-1;ae>=0;ae--)re[ae]=-1;for(var ie=G.newArray($t-ne,0),se=0,oe=0,he=0;he<ne;he++){for(var le=e.readInt(!0);se!=le;)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 Pt(ce),fe=0;fe<ce;fe++){var pe=e.readFloat(),ve=r.events[e.readInt(!0)],ge=new Ut(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 bt(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}();Ht.AttachmentTypeValues=[0,1,2,3,4,5,6],Ht.TransformModeValues=[$.Normal,$.OnlyTranslation,$.NoRotationOrReflection,$.NoScale,$.NoScaleOrReflection],Ht.PositionModeValues=[ht.Fixed,ht.Percent],Ht.SpacingModeValues=[lt.Length,lt.Fixed,lt.Percent],Ht.RotateModeValues=[ut.Tangent,ut.Chain,ut.ChainScale],Ht.BlendModeValues=[Lt.Normal,Lt.Additive,Lt.Multiply,Lt.Screen],Ht.BONE_ROTATE=0,Ht.BONE_TRANSLATE=1,Ht.BONE_SCALE=2,Ht.BONE_SHEAR=3,Ht.SLOT_ATTACHMENT=0,Ht.SLOT_COLOR=1,Ht.SLOT_TWO_COLOR=2,Ht.PATH_POSITION=0,Ht.PATH_SPACING=1,Ht.PATH_MIX=2,Ht.CURVE_LINEAR=0,Ht.CURVE_STEPPED=1,Ht.CURVE_BEZIER=2;var Gt=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 0!=(128&e)&&(n|=(127&(e=this.readByte()))<<7,0!=(128&e)&&(n|=(127&(e=this.readByte()))<<14,0!=(128&e)&&(n|=(127&(e=this.readByte()))<<21,0!=(128&e)&&(n|=(127&(e=this.readByte()))<<28)))),t?n:n>>>1^-(1&n)},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}(),jt=function(t,e,n,r,a){this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritDeform=a},zt=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e};function Zt(){return Zt=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},Zt.apply(this,arguments)}var Qt=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 h=this.skeleton,l=n+90+s,u=h.scaleX,c=h.scaleY;return this.a=H.cosDeg(n+i)*r*u,this.b=H.cosDeg(l)*a*u,this.c=H.sinDeg(n+i)*r*c,this.d=H.sinDeg(l)*a*c,this.worldX=t*u+h.x,void(this.worldY=e*c+h.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 $.Normal:var g=n+90+s,m=H.cosDeg(n+i)*r,w=H.cosDeg(g)*a,E=H.sinDeg(n+i)*r,y=H.sinDeg(g)*a;return this.a=d*m+f*E,this.b=d*w+f*y,this.c=p*m+v*E,void(this.d=p*w+v*y);case $.OnlyTranslation:var x=n+90+s;this.a=H.cosDeg(n+i)*r,this.b=H.cosDeg(x)*a,this.c=H.sinDeg(n+i)*r,this.d=H.sinDeg(x)*a;break;case $.NoRotationOrReflection:var b=d*d+p*p,S=0;b>1e-4?(b=Math.abs(d*v-f*p)/b,d/=this.skeleton.scaleX,f=(p/=this.skeleton.scaleY)*b,v=d*b,S=Math.atan2(p,d)*H.radDeg):(d=0,p=0,S=90-Math.atan2(v,f)*H.radDeg);var M=n+i-S,A=n+s-S+90,R=H.cosDeg(M)*r,T=H.cosDeg(A)*a,I=H.sinDeg(M)*r,_=H.sinDeg(A)*a;this.a=d*R-f*I,this.b=d*T-f*_,this.c=p*R+v*I,this.d=p*T+v*_;break;case $.NoScale:case $.NoScaleOrReflection:var C=H.cosDeg(n),k=H.sinDeg(n),V=(d*C+f*k)/this.skeleton.scaleX,P=(p*C+v*k)/this.skeleton.scaleY,F=Math.sqrt(V*V+P*P);F>1e-5&&(F=1/F),V*=F,P*=F,F=Math.sqrt(V*V+P*P),this.data.transformMode==$.NoScale&&d*v-f*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(F=-F);var N=Math.PI/2+Math.atan2(P,V),O=Math.cos(N)*F,B=Math.sin(N)*F,L=H.cosDeg(i)*r,X=H.cosDeg(90+s)*a,D=H.sinDeg(i)*r,Y=H.sinDeg(90+s)*a;this.a=V*L+O*D,this.b=V*X+O*Y,this.c=P*L+B*D,this.d=P*X+B*Y}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)*H.radDeg},e.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*H.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)*H.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)*H.radDeg);var e=t.a,n=t.b,r=t.c,a=t.d,i=1/(e*a-n*r),s=this.worldX-t.worldX,o=this.worldY-t.worldY;this.ax=s*a*i-o*n*i,this.ay=o*e*i-s*r*i;var h=i*a,l=i*e,u=i*n,c=i*r,d=h*this.a-u*this.c,f=h*this.b-u*this.d,p=l*this.c-c*this.a,v=l*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)*H.radDeg,this.arotation=Math.atan2(p,d)*H.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+v*v),this.ashearY=0,this.arotation=90-Math.atan2(v,f)*H.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=H.sinDeg(t),n=H.cosDeg(t);return Math.atan2(this.a*e-this.c*n,this.d*n-this.b*e)*H.radDeg+this.rotation-this.shearX},e.localToWorldRotation=function(t){t-=this.rotation-this.shearX;var e=H.sinDeg(t),n=H.cosDeg(t);return Math.atan2(n*this.c+e*this.d,n*this.a+e*this.b)*H.radDeg},e.rotateWorld=function(t){var e=this.a,n=this.b,r=this.c,a=this.d,i=H.cosDeg(t),s=H.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}(),Jt=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 q,this.darkColor=null==t.darkColor?null:new q,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}(),Kt=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,h=o.a,l=o.b,u=o.c,c=o.d,d=-t.ashearX-t.arotation,f=0,p=0;switch(t.data.transformMode){case $.OnlyTranslation:f=e-t.worldX,p=n-t.worldY;break;case $.NoRotationOrReflection:var v=Math.abs(h*c-l*u)/(h*h+u*u),g=h/t.skeleton.scaleX,m=u/t.skeleton.scaleY;l=-m*v*t.skeleton.scaleX,c=g*v*t.skeleton.scaleY,d+=Math.atan2(m,g)*H.radDeg;default:var w=e-o.worldX,E=n-o.worldY,y=h*c-l*u;f=(w*c-E*l)/y-t.ax,p=(E*h-w*u)/y-t.ay}d+=Math.atan2(p,f)*H.radDeg,t.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);var x=t.ascaleX,b=t.ascaleY;if(r||a){switch(t.data.transformMode){case $.NoScale:case $.NoScaleOrReflection:f=e-t.worldX,p=n-t.worldY}var S=t.data.length*x,M=Math.sqrt(f*f+p*p);if(r&&M<S||a&&M>S&&S>1e-4){var A=(M/S-1)*s+1;x*=A,i&&(b*=A)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+d*s,x,b,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 h=t.ax,l=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,E=0,y=0,x=t.a,b=t.b,S=t.c,M=t.d,A=Math.abs(u-d)<=1e-4;A?(E=x*m+b*(w=e.ay)+t.worldX,y=S*m+M*w+t.worldY):(w=0,E=x*m+t.worldX,y=S*m+t.worldY);var R=t.parent;x=R.a,b=R.b,S=R.c;var T,I,_=1/(x*(M=R.d)-b*S),C=E-R.worldX,k=y-R.worldY,V=(C*M-k*b)*_-h,P=(k*x-C*S)*_-l,F=Math.sqrt(V*V+P*P),N=e.data.length*f;if(F<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=((C=n-R.worldX)*M-(k=r-R.worldY)*b)*_-h,B=(k*x-C*S)*_-l,L=O*O+B*B;if(0!=s){s*=u*(f+1)/2;var X=Math.sqrt(L),D=X-F-N*u+s;if(D>0){var Y=Math.min(1,D/(2*s))-1;L=(O-=(Y=(D-s*(1-Y*Y))/X)*O)*O+(B-=Y*B)*B}}t:if(A){var U=(L-F*F-(N*=u)*N)/(2*F*N);U<-1?U=-1:U>1&&(U=1,i&&(c*=(Math.sqrt(L)/(F+N)-1)*o+1)),I=Math.acos(U)*a,x=F+N*U,b=N*Math.sin(I),T=Math.atan2(B*x-O*b,O*x+B*b)}else{var W=(x=u*N)*x,q=(b=d*N)*b,G=Math.atan2(B,O),j=-2*q*F,z=q-W;if((M=j*j-4*z*(S=q*F*F+W*L-W*q))>=0){var Z=Math.sqrt(M);j<0&&(Z=-Z);var Q=(Z=-(j+Z)/2)/z,J=S/Z,K=Math.abs(Q)<Math.abs(J)?Q:J;if(K*K<=L){k=Math.sqrt(L-K*K)*a,T=G-Math.atan2(k,K),I=Math.atan2(k/d,(K-F)/u);break t}}var $=H.PI,tt=F-x,et=tt*tt,nt=0,rt=0,at=F+x,it=at*at,st=0;(S=-x*F/(W-q))>=-1&&S<=1&&(S=Math.acos(S),(M=(C=x*Math.cos(S)+F)*C+(k=b*Math.sin(S))*k)<et&&($=S,et=M,tt=C,nt=k),M>it&&(rt=S,it=M,at=C,st=k)),L<=(et+it)/2?(T=G-Math.atan2(nt*a,tt),I=$*a):(T=G-Math.atan2(st*a,at),I=rt*a)}var ot=Math.atan2(w,m)*g,ht=t.arotation;(T=(T-ot)*H.radDeg+p-ht)>180?T-=360:T<-180&&(T+=360),t.updateWorldTransformWith(h,l,ht+T*o,c,t.ascaleY,0,0),ht=e.arotation,(I=((I+ot)*H.radDeg-e.ashearX)*g+v-ht)>180?I-=360:I<-180&&(I+=360),e.updateWorldTransformWith(m,w,ht+I*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}else e.updateWorldTransform()},t}(),$t=function(){function t(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new z,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,h=a.d,l=i*h-s*o>0?H.degRad:-H.degRad,u=this.data.offsetRotation*l,c=this.data.offsetShearY*l,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,E=v.c,y=v.d,x=Math.atan2(o,i)-Math.atan2(E,m)+u;x>H.PI?x-=H.PI2:x<-H.PI&&(x+=H.PI2),x*=t;var b=Math.cos(x),S=Math.sin(x);v.a=b*m-S*E,v.b=b*w-S*y,v.c=S*m+b*E,v.d=S*w+b*y,g=!0}if(0!=e){var M=this.temp;a.localToWorld(M.set(this.data.offsetX,this.data.offsetY)),v.worldX+=(M.x-v.worldX)*e,v.worldY+=(M.y-v.worldY)*e,g=!0}if(n>0){var A=Math.sqrt(v.a*v.a+v.c*v.c),R=Math.sqrt(i*i+o*o);A>1e-5&&(A=(A+(R-A+this.data.offsetScaleX)*n)/A),v.a*=A,v.c*=A,A=Math.sqrt(v.b*v.b+v.d*v.d),R=Math.sqrt(s*s+h*h),A>1e-5&&(A=(A+(R-A+this.data.offsetScaleY)*n)/A),v.b*=A,v.d*=A,g=!0}if(r>0){var T=v.b,I=v.d,_=Math.atan2(I,T),C=Math.atan2(h,s)-Math.atan2(o,i)-(_-Math.atan2(v.c,v.a));C>H.PI?C-=H.PI2:C<-H.PI&&(C+=H.PI2),C=_+(C+c)*r;var k=Math.sqrt(T*T+I*I);v.b=Math.cos(C)*k,v.d=Math.sin(C)*k,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,h=a.d,l=i*h-s*o>0?H.degRad:-H.degRad,u=this.data.offsetRotation*l,c=this.data.offsetShearY*l,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,E=v.c,y=v.d,x=Math.atan2(o,i)+u;x>H.PI?x-=H.PI2:x<-H.PI&&(x+=H.PI2),x*=t;var b=Math.cos(x),S=Math.sin(x);v.a=b*m-S*E,v.b=b*w-S*y,v.c=S*m+b*E,v.d=S*w+b*y,g=!0}if(0!=e){var M=this.temp;a.localToWorld(M.set(this.data.offsetX,this.data.offsetY)),v.worldX+=M.x*e,v.worldY+=M.y*e,g=!0}if(n>0){var A=(Math.sqrt(i*i+o*o)-1+this.data.offsetScaleX)*n+1;v.a*=A,v.c*=A,A=(Math.sqrt(s*s+h*h)-1+this.data.offsetScaleY)*n+1,v.b*=A,v.d*=A,g=!0}if(r>0){var R=Math.atan2(h,s)-Math.atan2(o,i);R>H.PI?R-=H.PI2:R<-H.PI&&(R+=H.PI2);var T=v.b,I=v.d;R=Math.atan2(I,T)+(R-H.PI/2+c)*r;var _=Math.sqrt(T*T+I*I);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 h=i[s];h.appliedValid||h.updateAppliedTransform();var l=h.arotation;if(0!=t){var u=a.arotation-l+this.data.offsetRotation;l+=(u-=360*(16384-(16384.499999999996-u/360|0)))*t}var c=h.ax,d=h.ay;0!=e&&(c+=(a.ax-c+this.data.offsetX)*e,d+=(a.ay-d+this.data.offsetY)*e);var f=h.ascaleX,p=h.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=h.ashearY;if(0!=r){var g=a.ashearY-v+this.data.offsetShearY;g-=360*(16384-(16384.499999999996-g/360|0)),h.shearY+=g*r}h.updateWorldTransformWith(c,d,l,f,p,h.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 h=i[s];h.appliedValid||h.updateAppliedTransform();var l=h.arotation;0!=t&&(l+=(a.arotation+this.data.offsetRotation)*t);var u=h.ax,c=h.ay;0!=e&&(u+=(a.ax+this.data.offsetX)*e,c+=(a.ay+this.data.offsetY)*e);var d=h.ascaleX,f=h.ascaleY;0!=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=h.ashearY;0!=r&&(p+=(a.ashearY+this.data.offsetShearY)*r),h.updateWorldTransformWith(u,c,l,d,f,h.ashearX,p)}},t}(),te=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(K(e,nt)){var n=this.rotateMix,r=this.translateMix,a=n>0;if(r>0||a){var i=this.data,s=i.spacingMode==lt.Percent,o=i.rotateMode,h=o==ut.Tangent,l=o==ut.ChainScale,u=this.bones.length,c=h?u:u+1,d=this.bones,f=G.setArraySize(this.spaces,c),p=null,v=this.spacing;if(l||!s){l&&(p=G.setArraySize(this.lengths,u));for(var g=i.spacingMode==lt.Length,m=0,w=c-1;m<w;){var E=d[m],y=E.data.length;if(y<t.epsilon)l&&(p[m]=0),f[++m]=0;else if(s){if(l){var x=y*E.a,b=y*E.c,S=Math.sqrt(x*x+b*b);p[m]=S}f[++m]=v}else{var M=y*E.a,A=y*E.c,R=Math.sqrt(M*M+A*A);l&&(p[m]=R),f[++m]=(g?y+v:v)*R/y}}}else for(var T=1;T<c;T++)f[T]=v;var I=this.computeWorldPositions(e,c,h,i.positionMode==ht.Percent,s),_=I[0],C=I[1],k=i.offsetRotation,V=!1;if(0==k)V=o==ut.Chain;else{V=!1;var P=this.target.bone;k*=P.a*P.d-P.b*P.c>0?H.degRad:-H.degRad}for(var F=0,N=3;F<u;F++,N+=3){var O=d[F];O.worldX+=(_-O.worldX)*r,O.worldY+=(C-O.worldY)*r;var B=I[N],L=I[N+1],X=B-_,D=L-C;if(l){var Y=p[F];if(0!=Y){var U=(Math.sqrt(X*X+D*D)/Y-1)*n+1;O.a*=U,O.c*=U}}if(_=B,C=L,a){var W=O.a,q=O.b,j=O.c,z=O.d,Z=0,Q=0,J=0;if(Z=h?I[N-1]:0==f[F+1]?I[N+2]:Math.atan2(D,X),Z-=Math.atan2(j,W),V){Q=Math.cos(Z),J=Math.sin(Z);var $=O.data.length;_+=($*(Q*W-J*j)-X)*n,C+=($*(J*W+Q*j)-D)*n}else Z+=k;Z>H.PI?Z-=H.PI2:Z<-H.PI&&(Z+=H.PI2),Z*=n,Q=Math.cos(Z),J=Math.sin(Z),O.a=Q*W-J*j,O.b=Q*q-J*z,O.c=J*W+Q*j,O.d=J*q+Q*z}O.appliedValid=!1}}}},e.computeWorldPositions=function(e,n,r,a,i){var s=this.target,o=this.position,h=this.spaces,l=G.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++)h[m]*=g;u=G.setArraySize(this.world,8);for(var w=0,E=0,y=0;w<n;w++,E+=3){var x=h[w],b=o+=x;if(c)(b%=g)<0&&(b+=g),y=0;else{if(b<0){p!=t.BEFORE&&(p=t.BEFORE,e.computeWorldVertices(s,2,4,u,0,2)),this.addBeforePosition(b,u,0,l,E);continue}if(b>g){p!=t.AFTER&&(p=t.AFTER,e.computeWorldVertices(s,d-6,4,u,0,2)),this.addAfterPosition(b-g,u,0,l,E);continue}}for(;;y++){var S=v[y];if(!(b>S)){if(0==y)b/=S;else{var M=v[y-1];b=(b-M)/(S-M)}break}}y!=p&&(p=y,c&&y==f?(e.computeWorldVertices(s,d-4,4,u,0,2),e.computeWorldVertices(s,0,4,u,4,2)):e.computeWorldVertices(s,6*y+2,8,u,0,2)),this.addCurvePosition(b,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],l,E,r||w>0&&0==x)}return l}c?(d+=2,u=G.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=G.setArraySize(this.world,d),e.computeWorldVertices(s,2,d,u,0,2));for(var A=G.setArraySize(this.curves,f),R=0,T=u[0],I=u[1],_=0,C=0,k=0,V=0,P=0,F=0,N=0,O=0,B=0,L=0,X=0,D=0,Y=0,U=0,W=0,q=2;W<f;W++,q+=6)_=u[q],C=u[q+1],k=u[q+2],V=u[q+3],X=2*(N=.1875*(T-2*_+k))+(B=.09375*(3*(_-k)-T+(P=u[q+4]))),D=2*(O=.1875*(I-2*C+V))+(L=.09375*(3*(C-V)-I+(F=u[q+5]))),Y=.75*(_-T)+N+.16666667*B,U=.75*(C-I)+O+.16666667*L,R+=Math.sqrt(Y*Y+U*U),Y+=X,U+=D,X+=B,D+=L,R+=Math.sqrt(Y*Y+U*U),Y+=X,U+=D,R+=Math.sqrt(Y*Y+U*U),Y+=X+B,U+=D+L,R+=Math.sqrt(Y*Y+U*U),A[W]=R,T=P,I=F;if(o*=a?R:R/e.lengths[f-1],i)for(var H=1;H<n;H++)h[H]*=R;for(var j=this.segments,z=0,Z=0,Q=0,J=0,K=0;Z<n;Z++,Q+=3){var $=h[Z],tt=o+=$;if(c)(tt%=R)<0&&(tt+=R),J=0;else{if(tt<0){this.addBeforePosition(tt,u,0,l,Q);continue}if(tt>R){this.addAfterPosition(tt-R,u,d-4,l,Q);continue}}for(;;J++){var et=A[J];if(!(tt>et)){if(0==J)tt/=et;else{var nt=A[J-1];tt=(tt-nt)/(et-nt)}break}}if(J!=p){p=J;var rt=6*J;for(T=u[rt],I=u[rt+1],_=u[rt+2],C=u[rt+3],k=u[rt+4],V=u[rt+5],X=2*(N=.03*(T-2*_+k))+(B=.006*(3*(_-k)-T+(P=u[rt+6]))),D=2*(O=.03*(I-2*C+V))+(L=.006*(3*(C-V)-I+(F=u[rt+7]))),Y=.3*(_-T)+N+.16666667*B,U=.3*(C-I)+O+.16666667*L,z=Math.sqrt(Y*Y+U*U),j[0]=z,rt=1;rt<8;rt++)Y+=X,U+=D,X+=B,D+=L,z+=Math.sqrt(Y*Y+U*U),j[rt]=z;Y+=X,U+=D,z+=Math.sqrt(Y*Y+U*U),j[8]=z,Y+=X+B,U+=D+L,z+=Math.sqrt(Y*Y+U*U),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,T,I,_,C,k,V,P,F,l,Q,r||Z>0&&0==$)}return l},e.addBeforePosition=function(t,e,n,r,a){var i=e[n],s=e[n+1],o=e[n+2]-i,h=e[n+3]-s,l=Math.atan2(h,o);r[a]=i+t*Math.cos(l),r[a+1]=s+t*Math.sin(l),r[a+2]=l},e.addAfterPosition=function(t,e,n,r,a){var i=e[n+2],s=e[n+3],o=i-e[n],h=s-e[n+1],l=Math.atan2(h,o);r[a]=i+t*Math.cos(l),r[a+1]=s+t*Math.sin(l),r[a+2]=l},e.addCurvePosition=function(t,e,n,r,a,i,s,o,h,l,u,c){if(0==t||isNaN(t))return l[u]=e,l[u+1]=n,void(l[u+2]=Math.atan2(a-n,r-e));var d=t*t,f=d*t,p=1-t,v=p*p,g=v*p,m=p*t,w=3*m,E=p*w,y=w*t,x=e*g+r*E+i*y+o*f,b=n*g+a*E+s*y+h*f;l[u]=x,l[u+1]=b,c&&(l[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}();te.NONE=-1,te.BEFORE=-2,te.AFTER=-3,te.epsilon=1e-5;var ee=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 Qt(n,this,null);else{var a=this.bones[n.parent.index];r=new Qt(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],h=new Jt(s,o);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(var l=0;l<t.ikConstraints.length;l++){var u=t.ikConstraints[l];this.ikConstraints.push(new Kt(u,this))}this.transformConstraints=new Array;for(var c=0;c<t.transformConstraints.length;c++){var d=t.transformConstraints[c];this.transformConstraints.push(new $t(d,this))}this.pathConstraints=new Array;for(var f=0;f<t.pathConstraints.length;f++){var p=t.pathConstraints[f];this.pathConstraints.push(new te(p,this))}this.color=new q(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 h=this.bones[i[s].index];do{h.sorted=!1,h.active=!0,h=h.parent}while(null!=h)}var l=this.ikConstraints,u=this.transformConstraints,c=this.pathConstraints,d=l.length,f=u.length,p=c.length,v=d+f+p;t:for(var g=0;g<v;g++){for(var m=0;m<d;m++){var w=l[m];if(w.data.order==g){this.sortIkConstraint(w);continue t}}for(var E=0;E<f;E++){var y=u[E];if(y.data.order==g){this.sortTransformConstraint(y);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&&G.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&&G.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();K(s,nt)&&this.sortPathConstraintAttachmentWith(s,r);for(var o=t.bones,h=o.length,l=0;l<h;l++)this.sortBone(o[l]);this._updateCache.push(t);for(var u=0;u<h;u++)this.sortReset(o[u].children);for(var c=0;c<h;c++)o[c].sorted=!0}},e.sortTransformConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||null!=this.skin&&G.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(K(t,nt)){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,h=0,l=o.length;h<l;h++){var u=o[h],c=u.data;u.rotateMix=c.rotateMix,u.translateMix=c.translateMix,u.scaleMix=c.scaleMix,u.shearMix=c.shearMix}for(var d=this.pathConstraints,f=0,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;G.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,h=0,l=r.length;h<l;h++){var u=r[h];if(u.bone.active){var c=0,d=null,f=u.getAttachment();if(K(f,J))c=8,d=G.setArraySize(n,c,0),f.computeWorldVertices(u.bone,d,0,2);else if(K(f,tt)){var p=f;c=p.worldVerticesLength,d=G.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}(),ne=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 ie(this),this.propertyIDs=new W,this.animationsChanged=!1,this.trackEntryPool=new j((function(){return new ae})),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 h=a.mixingFrom;for(a.mixingFrom=null,null!=h&&(h.mixingTo=null);null!=h;)this.queue.end(h),h=h.mixingFrom}a.trackTime+=i}}this.queue.drain()},e.updateMixingFrom=function(t,e){var 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 h=0==i?gt.first:o.mixBlend,l=o.alpha;null!=o.mixingFrom?l*=this.applyMixingFrom(o,e,h):o.trackTime>=o.trackEnd&&null==o.next&&(l=0);var u=o.animationLast,c=o.getAnimationTime(),d=o.animation.timelines.length,f=o.animation.timelines;if(0==i&&1==l||h==gt.add)for(var p=0;p<d;p++){G.webkit602BugfixHelper(l,h);var v=f[p];K(v,Ct)?this.applyAttachmentTimeline(v,e,c,h,!0):v.apply(e,u,c,n,l,h,mt.mixIn)}else{var g=o.timelineMode,m=0==o.timelinesRotation.length;m&&G.setArraySize(o.timelinesRotation,d<<1,null);for(var w=o.timelinesRotation,E=0;E<d;E++){var y=f[E],x=g[E]==t.SUBSEQUENT?h:gt.setup;K(y,Mt)?this.applyRotateTimeline(y,e,c,l,x,w,E<<1,m):K(y,Ct)?this.applyAttachmentTimeline(y,e,c,h,!0):(G.webkit602BugfixHelper(l,h),y.apply(e,u,c,n,l,x,mt.mixIn))}}this.queueEvents(o,c),n.length=0,o.nextAnimationLast=c,o.nextTrackLast=o.trackTime}}for(var b=this.unkeyedState+t.SETUP,S=e.slots,M=0,A=e.slots.length;M<A;M++){var R=S[M];if(R.attachmentState==b){var T=R.data.attachmentName;R.attachment=null==T?null:e.getAttachment(R.data.index,T)}}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==gt.first&&(r=gt.setup)):((i=e.mixTime/e.mixDuration)>1&&(i=1),r!=gt.first&&(r=a.mixBlend));var s=i<a.eventThreshold?this.events:null,o=i<a.attachmentThreshold,h=i<a.drawOrderThreshold,l=a.animationLast,u=a.getAnimationTime(),c=a.animation.timelines.length,d=a.animation.timelines,f=a.alpha*e.interruptAlpha,p=f*(1-i);if(r==gt.add)for(var v=0;v<c;v++)d[v].apply(n,l,u,s,p,r,mt.mixOut);else{var g=a.timelineMode,m=a.timelineHoldMix,w=0==a.timelinesRotation.length;w&&G.setArraySize(a.timelinesRotation,c<<1,null);var E=a.timelinesRotation;a.totalAlpha=0;for(var y=0;y<c;y++){var x=d[y],b=mt.mixOut,S=void 0,M=0;switch(g[y]){case t.SUBSEQUENT:if(!h&&K(x,Ft))continue;S=r,M=p;break;case t.FIRST:S=gt.setup,M=p;break;case t.HOLD_SUBSEQUENT:S=r,M=f;break;case t.HOLD_FIRST:S=gt.setup,M=f;break;default:S=gt.setup;var A=m[y];M=f*Math.max(0,1-A.mixTime/A.mixDuration)}a.totalAlpha+=M,K(x,Mt)?this.applyRotateTimeline(x,n,u,M,S,E,y<<1,w):K(x,Ct)?this.applyAttachmentTimeline(x,n,u,S,o):(G.webkit602BugfixHelper(M,r),h&&K(x,Ft)&&S==gt.setup&&(b=mt.mixIn),x.apply(n,l,u,s,M,S,b))}}return e.mixDuration>0&&this.queueEvents(a,u),this.events.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime,i},e.applyAttachmentTimeline=function(e,n,r,a,i){var s=n.slots[e.slotIndex];if(s.bone.active){var o,h=e.frames;if(r<h[0])a!=gt.setup&&a!=gt.first||this.setAttachment(n,s,s.data.attachmentName,i);else o=r>=h[h.length-1]?h.length-1:bt.binarySearch(h,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 h=t,l=h.frames,u=e.bones[h.boneIndex];if(u.active){var c=0,d=0;if(n<l[0])switch(a){case gt.setup:u.rotation=u.data.rotation;default:return;case gt.first:c=u.rotation,d=u.data.rotation}else if(c=a==gt.setup?u.data.rotation:u.rotation,n>=l[l.length-Mt.ENTRIES])d=u.data.rotation+l[l.length+Mt.PREV_ROTATION];else{var f=bt.binarySearch(l,n,Mt.ENTRIES),p=l[f+Mt.PREV_ROTATION],v=l[f],g=h.getCurvePercent((f>>1)-1,1-(n-v)/(l[f+Mt.PREV_TIME]-v));d=l[f+Mt.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 E=0,y=0;o?(E=0,y=w):(E=i[s],y=i[s+1]);var x=w>0,b=E>=0;H.signum(y)!=H.signum(w)&&Math.abs(y)<=90&&(Math.abs(E)>180&&(E+=360*H.signum(E)),b=x),m=w+E-E%360,b!=x&&(m+=360*H.signum(E)),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,mt.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,h=s.length;o<h;o++){var l=s[o];if(l.time<i)break;l.time>r||this.queue.event(t,l)}for((t.loop?0==a||i>t.trackTime%a:e>=r&&t.animationLast<r)&&this.queue.complete(t);o<h;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]:(G.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=gt.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==gt.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=G.setArraySize(e.timelineMode,a);e.timelineHoldMix.length=0;var s=G.setArraySize(e.timelineHoldMix,a),o=this.propertyIDs;if(null!=n&&n.holdPrevious)for(var h=0;h<a;h++)i[h]=o.add(r[h].getPropertyId())?t.HOLD_FIRST:t.HOLD_SUBSEQUENT;else t:for(var l=0;l<a;l++){var u=r[l],c=u.getPropertyId();if(o.add(c))if(null==n||K(u,Ct)||K(u,Ft)||K(u,Pt)||!n.animation.hasTimeline(c))i[l]=t.FIRST;else{for(var d=n.mixingTo;null!=d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(e.mixDuration>0){i[l]=t.HOLD_MIX,s[l]=d;continue t}break}i[l]=t.HOLD_FIRST}else i[l]=t.SUBSEQUENT}},e.getCurrent=function(t){return t>=this.tracks.length?null:this.tracks[t]},e.addListener=function(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)},e.removeListener=function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)},e.clearListeners=function(){this.listeners.length=0},e.clearListenerNotifications=function(){this.queue.clear()},t}();ne.emptyAnimation=new bt("<empty>",[],0),ne.SUBSEQUENT=0,ne.FIRST=1,ne.HOLD_SUBSEQUENT=2,ne.HOLD_FIRST=3,ne.HOLD_MIX=4,ne.SETUP=1,ne.CURRENT=2;var re,ae=function(){function t(){this.mixBlend=gt.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}(),ie=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 h=0;h<e.length;h++)e[h].dispose&&e[h].dispose(a);this.animState.trackEntryPool.free(a);break;case 4:null!=a.listener&&a.listener.complete&&a.listener.complete(a);for(var l=0;l<e.length;l++)e[l].complete&&e[l].complete(a);break;case 5:var u=t[2+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"}(re||(re={}));var se=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}(),oe=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 j((function(){return new Array})),this.polygonIndicesPool=new j((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,h=r;o<h;++o)s[o]=t.isConcave(o,r,n,a);var l=this.triangles;for(l.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],E=n[p+1],y=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(y,x,g,m,M,A)&&t.positiveArea(g,m,w,E,M,A)&&t.positiveArea(w,E,y,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}l.push(a[(r+c-1)%r]),l.push(a[c]),l.push(a[(c+1)%r]),a.splice(c,1),s.splice(c,1);var R=(--r+c-1)%r,T=c==r?0:c;s[R]=t.isConcave(R,r,n,a),s[T]=t.isConcave(T,r,n,a)}return 3==r&&(l.push(a[2]),l.push(a[0]),l.push(a[1])),l},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 h=-1,l=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],E=r[p],y=r[p+1],x=!1;if(h==d){var b=o.length-4,S=t.winding(o[b],o[b+1],o[b+2],o[b+3],E,y),M=t.winding(E,y,o[0],o[1],o[2],o[3]);S==l&&M==l&&(o.push(E),o.push(y),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(E),o.push(y),(s=this.polygonIndicesPool.obtain()).length=0,s.push(d),s.push(f),s.push(p),l=t.winding(v,g,m,w,E,y),h=d)}o.length>0&&(a.push(o),i.push(s));for(var A=0,R=a.length;A<R;A++)if(0!=(s=i[A]).length)for(var T=s[0],I=s[s.length-1],_=(o=a[A]).length-4,C=o[_],k=o[_+1],V=o[_+2],P=o[_+3],F=o[0],N=o[1],O=o[2],B=o[3],L=t.winding(C,k,V,P,F,N),X=0;X<R;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==T&&U==I){var j=t.winding(C,k,V,P,H,G),z=t.winding(H,G,F,N,O,B);j==L&&z==L&&(q.length=0,D.length=0,o.push(H),o.push(G),s.push(W),C=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}(),he=function(){function t(){this.triangulator=new oe,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=G.setArraySize(this.clippingPolygon,r);n.computeWorldVertices(e,0,r,a,0,2);var i=this.clippingPolygon;t.makeClockwise(i);for(var s=this.clippingPolygons=this.triangulator.decompose(i,this.triangulator.triangulate(i)),o=0,h=s.length;o<h;o++){var l=s[o];t.makeClockwise(l),l.push(l[0]),l.push(l[1])}return s.length},e.clipEndWithSlot=function(t){null!=this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()},e.clipEnd=function(){null!=this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)},e.isClipping=function(){return null!=this.clipAttachment},e.clipTriangles=function(t,e,n,r,a,i,s,o){var h=this.clipOutput,l=this.clippedVertices,u=this.clippedTriangles,c=this.clippingPolygons,d=this.clippingPolygons.length,f=o?12:8,p=0;l.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],E=a[g],y=a[g+1],x=t[g=n[v+1]<<1],b=t[g+1],S=a[g],M=a[g+1],A=t[g=n[v+2]<<1],R=t[g+1],T=a[g],I=a[g+1],_=0;_<d;_++){var C=l.length;if(!this.clip(m,w,x,b,A,R,c[_],h)){var k=G.setArraySize(l,C+3*f);k[C]=m,k[C+1]=w,k[C+2]=i.r,k[C+3]=i.g,k[C+4]=i.b,k[C+5]=i.a,o?(k[C+6]=E,k[C+7]=y,k[C+8]=s.r,k[C+9]=s.g,k[C+10]=s.b,k[C+11]=s.a,k[C+12]=x,k[C+13]=b,k[C+14]=i.r,k[C+15]=i.g,k[C+16]=i.b,k[C+17]=i.a,k[C+18]=S,k[C+19]=M,k[C+20]=s.r,k[C+21]=s.g,k[C+22]=s.b,k[C+23]=s.a,k[C+24]=A,k[C+25]=R,k[C+26]=i.r,k[C+27]=i.g,k[C+28]=i.b,k[C+29]=i.a,k[C+30]=T,k[C+31]=I,k[C+32]=s.r,k[C+33]=s.g,k[C+34]=s.b,k[C+35]=s.a):(k[C+6]=E,k[C+7]=y,k[C+8]=x,k[C+9]=b,k[C+10]=i.r,k[C+11]=i.g,k[C+12]=i.b,k[C+13]=i.a,k[C+14]=S,k[C+15]=M,k[C+16]=A,k[C+17]=R,k[C+18]=i.r,k[C+19]=i.g,k[C+20]=i.b,k[C+21]=i.a,k[C+22]=T,k[C+23]=I),C=u.length;var V=G.setArraySize(u,C+3);V[C]=p,V[C+1]=p+1,V[C+2]=p+2,p+=3;continue t}var P=h.length;if(0!=P){for(var F=b-R,N=A-x,O=m-A,B=R-w,L=1/(F*O+N*(w-R)),X=P>>1,D=this.clipOutput,Y=G.setArraySize(l,C+X*f),U=0;U<P;U+=2){var W=D[U],q=D[U+1];Y[C]=W,Y[C+1]=q,Y[C+2]=i.r,Y[C+3]=i.g,Y[C+4]=i.b,Y[C+5]=i.a;var H=W-A,j=q-R,z=(F*H+N*j)*L,Z=(B*H+O*j)*L,Q=1-z-Z;Y[C+6]=E*z+S*Z+T*Q,Y[C+7]=y*z+M*Z+I*Q,o&&(Y[C+8]=s.r,Y[C+9]=s.g,Y[C+10]=s.b,Y[C+11]=s.a),C+=f}C=u.length;var J=G.setArraySize(u,C+3*(X-2));X--;for(var K=1;K<X;K++)J[C]=p,J[C+1]=p+K,J[C+2]=p+K+1,C+=3;p+=X+1}}},e.clip=function(t,e,n,r,a,i,s,o){var h=o,l=!1,u=null;s.length%4>=2?(u=o,o=this.scratch):u=this.scratch,u.length=0,u.push(t),u.push(e),u.push(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,E=v-m,y=u,x=u.length-2,b=o.length,S=0;S<x;S+=2){var M=y[S],A=y[S+1],R=y[S+2],T=y[S+3],I=w*(T-m)-E*(R-g)>0;if(w*(A-m)-E*(M-g)>0){if(I){o.push(R),o.push(T);continue}var _=T-A,C=R-M,k=_*(g-p)-C*(m-v);if(Math.abs(k)>1e-6){var V=(C*(v-A)-_*(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=T-A,F=R-M,N=P*(g-p)-F*(m-v);if(Math.abs(N)>1e-6){var O=(F*(v-A)-P*(p-M))/N;o.push(p+(g-p)*O),o.push(v+(m-v)*O)}else o.push(p),o.push(v);o.push(R),o.push(T)}l=!0}if(b==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),f==d)break;var B=o;(o=u).length=0,u=B}if(h!=o){h.length=0;for(var L=0,X=o.length-2;L<X;L++)h[L]=o[L]}else h.length=h.length-2;return l},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,h=n-3;o<h;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 l=0,u=n-2,c=n>>1;l<c;l+=2){var d=e[l],f=e[l+1],p=u-l;e[l]=e[p],e[l+1]=e[p+1],e[p]=d,e[p+1]=f}},t}(),le=function(){function t(){}var e=t.prototype;return e.initialize=function(t,e){var l=this._mesh=new n(t),u=[new r("POSITION",0,a.Vector3,0),new r("COLOR_0",12,a.Vector4,0),new r("TEXCOORD_0",28,a.Vector2,0)],c=4*ue.VERTEX_STRIDE,d=c*e,f=new i(t,s.VertexBuffer,d,o.Dynamic),p=new i(t,s.IndexBuffer,2*e,o.Dynamic);this._indexBuffer=p,this._vertexBuffer=f,l.setVertexBufferBinding(f,c),l.setIndexBufferBinding(p,h.UInt16),l.setVertexElements(u),l.addSubMesh(0,e)},e.changeBuffer=function(t,e){var n=4*ue.VERTEX_STRIDE,r=n*e,a=new i(t,s.VertexBuffer,r,o.Dynamic),l=new i(t,s.IndexBuffer,2*e,o.Dynamic),u=this._mesh;this._indexBuffer=l,this._vertexBuffer=a,u.setVertexBufferBinding(a,n),u.setIndexBufferBinding(l,h.UInt16)},C(t,[{key:"mesh",get:function(){return this._mesh}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"vertexBuffer",get:function(){return this._vertexBuffer}}]),t}(),ue=function(){function t(t,e){this._clipper=new he,this._spineMesh=new le,this._needResize=!1,this._subMeshItems=[],this.separateSlots=[],this.separateSlotTextures=new Map,this._engine=t,this._entity=e}var e=t.prototype;return e.initialize=function(e,n){if(e){var r=this._entity.getComponent(l);if(r){this._meshRenderer=r,n&&(this._setting=n);for(var a=e.defaultSkin.attachments,i=0,s=t.QUAD_TRIANGLES.length,o=0,h=a.length;o<h;o++){var u=a[o];for(var c in u){var d=u[c];if(d)if(K(d,J))i+=s;else{if(!K(d,tt))continue;i+=d.triangles.length}}}this._vertexCount=i,this._prepareBufferData(this._vertexCount);var f=this._spineMesh;f.initialize(this._engine,this._vertexCount),r.mesh=f.mesh}else console.warn("You need add MeshRenderer component to entity first")}},e.buildMesh=function(e){var n=this._setting||{},r=n.useClipping,a=void 0===r||r,i=n.zSpacing,s=void 0===i?.01:i,o=0,h=0,l=e.drawOrder,c=l.length,d=this._clipper,f=this._spineMesh,p=f.mesh,v=this._subMeshItems;v.length=0;var g,m,w=this._vertices,E=0,y=0,x=Lt.Normal,b=null;t.tempBlendMode=null;for(var S=0;S<c;++S){var M=l[S];if(M.bone.active){var A=M.getAttachment(),R=null,T=s*S,I=0,_=d.isClipping()?2:t.VERTEX_SIZE;if(K(A,J)){var C=A;R=C.color,w=this._vertices,I=4*_,C.computeWorldVertices(M.bone,w,0,_),g=t.QUAD_TRIANGLES,m=C.uvs,b=C.region.renderObject.texture}else if(K(A,tt)){var k=A;R=k.color,w=this._vertices,(I=(k.worldVerticesLength>>1)*_)>w.length&&(w=this._vertices=new Float32Array(I)),k.computeWorldVertices(M,0,k.worldVerticesLength,w,0,_),g=k.triangles,m=k.uvs,b=k.region.renderObject.texture}else if(K(A,at)){if(a){var V=A;d.clipStart(M,V);continue}}else if(a){d.clipEndWithSlot(M);continue}if(null!=b){var P=M.data.name;if(x=M.data.blendMode,null!==t.tempBlendMode&&t.tempBlendMode!==M.data.blendMode&&y>0){var F=new u(E,y);v.push({blendMode:t.tempBlendMode,subMesh:F,texture:b}),E=h,y=0}t.tempBlendMode=M.data.blendMode;var N=void 0,O=void 0,B=void 0,L=void 0,X=M.bone.skeleton.color,D=M.color,Y=X.a*D.a*R.a,U=t.tempColor;if(U.set(X.r*D.r*R.r,X.g*D.g*R.g,X.b*D.b*R.b,Y),d.isClipping()){d.clipTriangles(w,I,g,g.length,m,U,null,!1);var W=d.clippedVertices,q=d.clippedTriangles;N=W,O=W.length,B=q,L=q.length}else{for(var H=w,G=2,j=0,z=I;G<z;G+=_,j+=2)H[G]=U.r,H[G+1]=U.g,H[G+2]=U.b,H[G+3]=U.a,H[G+4]=m[j],H[G+5]=m[j+1];N=w,O=I,B=g,L=g.length}for(var Z=o/t.VERTEX_STRIDE,Q=this._verticesWithZ,$=o,et=0;et<O;)Q[$++]=N[et++],Q[$++]=N[et++],Q[$++]=T,Q[$++]=N[et++],Q[$++]=N[et++],Q[$++]=N[et++],Q[$++]=N[et++],Q[$++]=N[et++],Q[$++]=N[et++];o=$;var nt=this._indices;for($=h,et=0;et<L;$++,et++)nt[$]=B[et]+Z;if(this.separateSlots.includes(P)){if(y>0){var rt=new u(E,y);v.push({blendMode:t.tempBlendMode,subMesh:rt,texture:b}),E=h}var it=this.separateSlotTextures[P];if(it){var st=b.texture;it.filterMode=st.filterMode,it.wrapModeU=st.wrapModeU,it.wrapModeV=st.wrapModeV,b=it}var ot=new u(E,L);v.push({blendMode:x,subMesh:ot,texture:b}),E+=L,y=0}else y+=L;h+=L}d.clipEndWithSlot(M)}else d.clipEndWithSlot(M)}if(d.clipEnd(),y>0){var ht=new u(E,y);v.push({blendMode:x,subMesh:ht,texture:b}),y=0}if(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 lt=this._meshRenderer,ut=0,ct=v.length;ut<ct;++ut){var dt=v[ut],ft=dt.blendMode;p.addSubMesh(dt.subMesh);var pt=lt.getMaterial(ut);pt||(pt=de.getDefaultMaterial(this._engine)),pt.shaderData.setTexture("material_SpineTexture",b.texture),pt._priority=ut,this.setBlendMode(pt,ft),lt.setMaterial(ut,pt)}this._needResize&&(f.changeBuffer(this._engine,this._vertexCount),this._needResize=!1),f.vertexBuffer.setData(this._verticesWithZ),f.indexBuffer.setData(this._indices)},e.addSeparateSlot=function(t){this.separateSlots.push(t)},e.addSeparateSlotTexture=function(t,e){this.separateSlotTextures[t]=new pe(e)},e._prepareBufferData=function(e){this._vertices=new Float32Array(e*t.VERTEX_SIZE),this._verticesWithZ=new Float32Array(e*t.VERTEX_STRIDE),this._indices=new Uint16Array(e)},e.setBlendMode=function(t,e){var n=t.renderState.blendState.targetBlendState;switch(e){case Lt.Additive:n.sourceColorBlendFactor=c.SourceAlpha,n.destinationColorBlendFactor=c.One,n.sourceAlphaBlendFactor=c.One,n.destinationAlphaBlendFactor=c.One,n.colorBlendOperation=n.alphaBlendOperation=d.Add;break;case Lt.Multiply:n.sourceColorBlendFactor=c.DestinationColor,n.destinationColorBlendFactor=c.Zero,n.sourceAlphaBlendFactor=c.One,n.destinationAlphaBlendFactor=c.Zero,n.colorBlendOperation=n.alphaBlendOperation=d.Add;break;case Lt.Screen:n.sourceColorBlendFactor=c.One,n.destinationColorBlendFactor=c.OneMinusSourceColor,n.sourceAlphaBlendFactor=c.One,n.destinationAlphaBlendFactor=c.OneMinusSourceColor,n.colorBlendOperation=n.alphaBlendOperation=d.Add;break;default:n.sourceColorBlendFactor=c.SourceAlpha,n.destinationColorBlendFactor=c.OneMinusSourceAlpha,n.sourceAlphaBlendFactor=c.One,n.destinationAlphaBlendFactor=c.OneMinusSourceAlpha,n.colorBlendOperation=n.alphaBlendOperation=d.Add}},C(t,[{key:"mesh",get:function(){return this._spineMesh.mesh}},{key:"subMeshItems",get:function(){return this._subMeshItems}}]),t}();ue.QUAD_TRIANGLES=[0,1,2,2,3,0],ue.VERTEX_SIZE=8,ue.VERTEX_STRIDE=9,ue.tempColor=new q,ue.tempBlendMode=null;var ce=function(t){function e(n){var r,a=f.find("galacean-spine-shader")||f.create("galacean-spine-shader",e._spineVS,e._spineFS),i=(r=t.call(this,n,a)||this).renderState,s=i.blendState.targetBlendState;return s.enabled=!0,s.sourceColorBlendFactor=c.SourceAlpha,s.destinationColorBlendFactor=c.OneMinusSourceAlpha,s.sourceAlphaBlendFactor=c.One,s.destinationAlphaBlendFactor=c.OneMinusSourceAlpha,s.colorBlendOperation=s.alphaBlendOperation=d.Add,i.depthState.writeEnabled=!1,i.rasterState.cullMode=p.Off,i.renderQueueType=v.Transparent,r}return T(e,t),e}(g);ce._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 ",ce._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 de=function(t){function e(e){var n;return(n=t.call(this,e)||this)._tempOffset=new z,n._tempSize=new z,n._tempArray=[0,0],n.autoUpdateBounds=!1,n.noPause=!1,n._meshGenerator=new ue(n.engine,e),n}T(e,t);var n=e.prototype;return n.setSkeletonData=function(t,e){t||console.error("SkeletonData is undefined"),this.setting=e,this._skeletonData=t,this._skeleton=new ee(t);var n=new se(t);this._state=new ne(n),this._meshGenerator.initialize(t,this.setting)},n.addSeparateSlot=function(t){this.skeleton||console.error("Skeleton not found!"),this.entity.getComponent(l)||console.warn("You need add MeshRenderer component to entity first"),this.skeleton.findSlot(t)?this._meshGenerator.addSeparateSlot(t):console.warn("Slot: "+t+" not find.")},n.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")},n.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()}},n.updateGeometry=function(){this._skeleton&&(this._meshGenerator.buildMesh(this._skeleton),this.autoUpdateBounds&&this.updateBounds())},n.updateBounds=function(){var t,e=this.entity.getComponent(l).bounds,n=this._tempOffset,r=this._tempSize,a=this._tempArray,i=(null==(t=this.setting)?void 0:t.zSpacing)||.01,s=this._skeleton;s.getBounds(n,r,a);var o=s.drawOrder;e.min.set(n.x,n.y,0),e.max.set(n.x+r.x,n.y+r.y,o.length*i)},n._cloneTo=function(t){t.setSkeletonData(this.skeletonData);var e=Zt({},this.setting);t.setting=e},n._disposeCurrentSkeleton=function(){this._skeletonData=null,this._skeleton=null,this._state=null},n.onDestroy=function(){this._disposeCurrentSkeleton(),this._meshGenerator=null,this.setting=null},e.getDefaultMaterial=function(t){var e=this._defaultMaterial;if(e){if(e.engine===t)return e.clone();e.destroy(!0),e=null}return(e=new ce(t)).isGCIgnored=!0,this._defaultMaterial=e,e.clone()},C(e,[{key:"skeletonData",get:function(){return this._skeletonData}},{key:"skeleton",get:function(){return this._skeleton}},{key:"state",get:function(){return this._state}},{key:"mesh",get:function(){return this._meshGenerator.mesh}},{key:"scale",set:function(t){this._skeleton&&(this._skeleton.scaleX=t,this._skeleton.scaleY=t)}}]),e}(w);I([m],de.prototype,"_skeletonData",void 0),I([m],de.prototype,"_skeleton",void 0),I([m],de.prototype,"_state",void 0),I([m],de.prototype,"_tempOffset",void 0),I([m],de.prototype,"_tempSize",void 0),I([m],de.prototype,"_tempArray",void 0),I([m],de.prototype,"_meshGenerator",void 0),I([m],de.prototype,"setting",void 0);var fe=function(t){function e(){return t.call(this,!1)}T(e,t);var n=e.prototype;return n.load=function(t,e){var n=this;return new y((function(r,a){"spine"!==t.type&&a("Asset type must be spine.");var i=null;t.urls?n.handleResource(e,t,i,r,a):n.request(t.url||"",{type:"json"}).then((function(s){s.jsonUrl&&s.atlasUrl&&s.pngUrl?(i=n.getResouceFromUrls([s.jsonUrl,s.atlasUrl,s.pngUrl],s.pngType),n.handleResource(e,t,i,r,a)):n.handleResource(e,t,i,r,a)})).catch((function(s){n.handleResource(e,t,i,r,a)}))}))},n.handleResource=function(t,e,n,r,a){var i=this,s=t.engine;n||(!e.urls&&e.url&&this.checkUrl(e.url)&&(n=this.getResouceFromUrl(e.url)),e.urls&&this.checkUrls(e.urls)&&(n=this.getResouceFromUrls(e.urls)));var o,h=!1;o=new U(s,null,(function(t){return i.createAdaptiveTexture(t)}));var u=n.skeletonFile,c=n.atlasFile,d=n.textureFile;o.onLoadComplete=function(){try{var t;if(h)t=o.get(c);else{var e=o.get(c);t=new L(e,i.textureAssetPicker.bind(i,o,d))}var n=new it(t),f=(i.isBinFile(u)?new Ht(n):new Wt(n)).readSkeletonData(o.get(u)),p=new x(s),v=p.addComponent(l),g=de.getDefaultMaterial(s);v.setMaterial(g),p.addComponent(de).setSkeletonData(f),r(p)}catch(t){a(t)}};var f=this.isBinFile(u);u&&c&&d?(f?o.loadBinary(u,null,a):o.loadText(u,null,a),o.loadText(c,null,a),o.loadEngineTexture(d,n.textureType,null,a)):u&&c&&!d?(h=!0,f?o.loadBinary(u,null,a):o.loadText(u,null,a),o.loadTextureAtlas(c,null,a)):a("Resouce param error")},n.textureAssetPicker=function(t,e){return t.get(e)},n.createAdaptiveTexture=function(t){return new pe(t)},n.isBinFile=function(t){return"bin"===this.getExtFromUrl(t)},n.checkUrl=function(t){var e=this.getExtFromUrl(t);return"json"===e||"bin"===e||(console.error("When use url as params, url must be json or bin file"),!1)},n.getResouceFromUrl=function(t){var e=t,n=t,r=n.indexOf("?");return r>0&&(n=n.substr(0,r)),{skeletonFile:e,atlasFile:n=n.substr(0,n.lastIndexOf("."))+".atlas"}},n.checkUrls=function(t){if(t.length<2)return console.error("When use urls as params, urls should at least contain: json/bin and atlas"),!1;if(t.length>3)return console.error("Spine runtime dont support multiple texture now"),!1;var e=this.getResouceFromUrls(t),n=e.skeletonFile,r=e.atlasFile;return!(!n||!r)||(console.error("Lack "+(n?"":"skeletonFile")+(r?" atlasFile":"")),!1)},n.getResouceFromUrls=function(t,e){var n,r,a;void 0===e&&(e=b.Texture2D);for(var i=e,s=0;s<t.length;++s){var o=t[s],h=this.getExtFromUrl(o);"json"!==h&&"bin"!==h||(n=o),"atlas"===h&&(r=o);["png","jpg","webp","jpeg","ktx2"].includes(h)&&(a=o)}return{skeletonFile:n,atlasFile:r,textureFile:a,textureType:i}},n.getExtFromUrl=function(t){return t.split(/[#?]/)[0].split(".").pop().trim()},e}(S);fe=I([E("spine",["json","bin"])],fe);var pe=function(t){function e(e){var n;return(n=t.call(this,e)||this).texture.generateMipmaps(),n}T(e,t);var n=e.prototype;return n.setFilters=function(t,e){t===P.Nearest?this.texture.filterMode=M.Point:e===P.MipMapLinearLinear?this.texture.filterMode=M.Trilinear:this.texture.filterMode=M.Bilinear},n.setWraps=function(t,e){this.texture.wrapModeU=t,this.texture.wrapModeV=e},n.dispose=function(){},e}(N),ve=function(t){function e(){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}T(e,t);var n=e.prototype;return n.onDestroy=function(){this.resource=null},n.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},n._cloneTo=function(t){t.entity.clearChildren(),t.resource=this.resource},n._removeResource=function(){this._resource&&this._spineAnimation&&(this.entity.removeChild(this._resource),this._resource.destroy(),this._resource=null,this._spineAnimation=null,this._animationName="",this._skinName="")},C(e,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority!==t&&(this._priority=t,this._resource&&(this._resource.getComponent(l).priority=t))}},{key:"resource",get:function(){return this._resource},set:function(t){var e=this._resource;if(t){if(e!==t){this._removeResource(),this._resource=t.clone(),this._resource.getComponent(l).priority=this.priority,this.entity.addChild(this._resource),this._spineAnimation=this._resource.getComponent(de),this._spineAnimation.scale=this._scale,this._spineAnimation.noPause=!this._paused;var n=this._spineAnimation.skeletonData,r=n.animations,a=n.skins,i=this._animationNames,s=this._skinNames;i.length=0;for(var o=0,h=r.length;o<h;++o)i.push(r[o].name);s.length=0;for(var u=0,c=a.length;u<c;++u)s.push(a[u].name);this.skinName=this._skinName||s[0],this._autoPlay&&i.length>0&&this.play(this._animationName||i[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}}]),e}(w);I([m],ve.prototype,"_resource",void 0),I([A],ve.prototype,"_animationName",void 0),I([A],ve.prototype,"_loop",void 0),I([A],ve.prototype,"_paused",void 0),I([A],ve.prototype,"_autoPlay",void 0),I([A],ve.prototype,"_skinName",void 0),I([A],ve.prototype,"_scale",void 0),I([m],ve.prototype,"_spineAnimation",void 0),I([m],ve.prototype,"_animationNames",void 0),I([m],ve.prototype,"_skinNames",void 0);var ge="1.1.0-test.1";S.registerClass("SpineRenderer",ve),console.log("Galacean spine version: "+ge);export{U as AssetManager,it as AtlasAttachmentLoader,Ht as SkeletonBinary,Wt as SkeletonJson,de as SpineAnimation,ve as SpineRenderer,N as Texture,L as TextureAtlas,ge as version};
|
|
1
|
+
import{AssetType as t,request as e,TextureFilterMode as s,TextureWrapMode as a,BlendFactor as n,BlendOperation as r,SubPrimitive as i,BoundingBox as o,Vector3 as l,Material as h,Shader as c,CullMode as d,RenderQueueType as u,Renderer as m,VertexElement as f,VertexElementFormat as g,Primitive as p,Buffer as x,BufferBindFlag as w,BufferUsage as b,VertexBufferBinding as y,IndexBufferBinding as k,IndexFormat as v,deepClone as S,ignoreClone as A,ReferResource as I,Loader as M,AssetPromise as C,resourceLoader as F}from"@galacean/engine";function T(t,e,s,a){var n,r=arguments.length,i=r<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,s):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,s,a);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(i=(r<3?n(i):r>3?n(e,s,i):n(e,s))||i);return r>3&&i&&Object.defineProperty(e,s,i),i}"function"==typeof SuppressedError&&SuppressedError;class E{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}}class Y{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,a=t.length;s<a;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}class R{r;g;b;a;static WHITE=new R(1,1,1,1);static RED=new R(1,0,0,1);static GREEN=new R(0,1,0,1);static BLUE=new R(0,0,1,1);static MAGENTA=new R(1,0,1,1);constructor(t=0,e=0,s=0,a=0){this.r=t,this.g=e,this.b=s,this.a=a}set(t,e,s,a){return this.r=t,this.g=e,this.b=s,this.a=a,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,a){return this.r+=t,this.g+=e,this.b+=s,this.a+=a,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 R).setFromString(t)}}class X{static PI=3.1415927;static PI2=2*X.PI;static invPI2=1/X.PI2;static radiansToDegrees=180/X.PI;static radDeg=X.radiansToDegrees;static degreesToRadians=X.PI/180;static degRad=X.degreesToRadians;static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*X.degRad)}static sinDeg(t){return Math.sin(t*X.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*X.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 X.randomTriangularWith(t,e,.5*(t+e))}static randomTriangularWith(t,e,s){let a=Math.random(),n=e-t;return a<=(s-t)/n?t+Math.sqrt(a*n*(s-t)):e-Math.sqrt((1-a)*n*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}}class _{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class B extends _{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 P extends B{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}class V{static SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;static arrayCopy(t,e,s,a,n){for(let r=e,i=a;r<e+n;r++,i++)s[i]=t[r]}static arrayFill(t,e,s,a){for(let n=e;n<s;n++)t[n]=a}static setArraySize(t,e,s=0){let a=t.length;if(a==e)return t;if(t.length=e,a<e)for(let n=a;n<e;n++)t[n]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:V.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let a=0;a<t;a++)s[a]=e;return s}static newFloatArray(t){if(V.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(V.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 V.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return V.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var a=0;a<t.length;a++)if(t[a]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}}class D{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)}}}class O{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 N{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 L{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)}}class q{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}}class U{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}class W extends U{static nextID=0;id=W.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,e,s,a,n,r){s=n+(s>>1)*r;let i=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(!h){o.length>0&&(l=o);let i=t.bone,h=i.worldX,c=i.worldY,d=i.a,u=i.b,m=i.c,f=i.d;for(let t=e,i=n;i<s;t+=2,i+=r){let e=l[t],s=l[t+1];a[i]=e*d+s*u+h,a[i+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=i.bones;if(0==o.length)for(let t=n,e=3*d;t<s;t+=r){let s=0,n=0,r=h[c++];for(r+=c;c<r;c++,e+=3){let t=u[h[c]],a=l[e],r=l[e+1],i=l[e+2];s+=(a*t.a+r*t.b+t.worldX)*i,n+=(a*t.c+r*t.d+t.worldY)*i}a[t]=s,a[t+1]=n}else{let t=o;for(let e=n,i=3*d,o=d<<1;e<s;e+=r){let s=0,n=0,r=h[c++];for(r+=c;c<r;c++,i+=3,o+=2){let e=u[h[c]],a=l[i]+t[o],r=l[i+1]+t[o+1],d=l[i+2];s+=(a*e.a+r*e.b+e.worldX)*d,n+=(a*e.c+r*e.d+e.worldY)*d}a[e]=s,a[e+1]=n}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),V.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=V.newFloatArray(this.vertices.length),V.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}}class z{static _nextID=0;id=z.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new z(this.regions.length);return V.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,e){let s=t.sequenceIndex;-1==s&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let a=this.regions[s];e.region!=a&&(e.region=a,e.updateRegion())}getPath(t,e){let s=t,a=(this.start+e).toString();for(let t=this.digits-a.length;t>0;t--)s+="0";return s+=a,s}static nextID(){return z._nextID++}}var $;!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"}($||($={}));const G=[$.hold,$.once,$.loop,$.pingpong,$.onceReverse,$.loopReverse,$.pingpongReverse];class j{name;timelines=[];timelineIds=new Y;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,a,n,r,i,o){if(!t)throw new Error("skeleton cannot be null.");a&&0!=this.duration&&(s%=this.duration,e>0&&(e%=this.duration));let l=this.timelines;for(let a=0,h=l.length;a<h;a++)l[a].apply(t,e,s,n,r,i,o)}}var H,J;!function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"}(H||(H={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(J||(J={}));const K={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 Z{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=V.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let a=1;a<s;a++)if(t[a]>e)return a-1;return s-1}static search(t,e,s){let a=t.length;for(let n=s;n<a;n+=s)if(t[n]>e)return n-s;return a-s}}class Q extends Z{curves;constructor(t,e,s){super(t,s),this.curves=V.newFloatArray(t+18*e),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+18*t;if(this.curves.length>e){let t=V.newFloatArray(e);V.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,s,a,n,r,i,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(a-2*r+o),f=.03*(n-2*i+l),g=.006*(3*(r-o)-a+h),p=.006*(3*(i-l)-n+c),x=2*m+g,w=2*f+p,b=.3*(r-a)+m+.16666667*g,y=.3*(i-n)+f+.16666667*p,k=a+b,v=n+y;for(let t=u+18;u<t;u+=2)d[u]=k,d[u+1]=v,b+=x,y+=w,x+=g,w+=p,k+=b,v+=y}getBezierValue(t,e,s,a){let n=this.curves;if(n[a]>t){let r=this.frames[e],i=this.frames[e+s];return i+(t-r)/(n[a]-r)*(n[a+1]-i)}let r=a+18;for(a+=2;a<r;a+=2)if(n[a]>=t){let e=n[a-2],s=n[a-1];return s+(t-e)/(n[a]-e)*(n[a+1]-s)}e+=this.getFrameEntries();let i=n[r-2],o=n[r-1];return o+(t-i)/(this.frames[e]-i)*(this.frames[e+s]-o)}}class tt extends Q{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 a=2;a<=s;a+=2)if(e[a]>t){s=a-2;break}let a=this.curves[s>>1];switch(a){case 0:let a=e[s],n=e[s+1];return n+(t-a)/(e[s+2]-a)*(e[s+2+1]-n);case 1:return e[s+1]}return this.getBezierValue(t,s,1,a-2)}getRelativeValue(t,e,s,a,n){if(t<this.frames[0]){switch(s){case H.setup:return n;case H.first:return a+(n-a)*e}return a}let r=this.getCurveValue(t);switch(s){case H.setup:return n+r*e;case H.first:case H.replace:r+=n-a}return a+r*e}getAbsoluteValue(t,e,s,a,n){if(t<this.frames[0]){switch(s){case H.setup:return n;case H.first:return a+(n-a)*e}return a}let r=this.getCurveValue(t);return s==H.setup?n+(r-n)*e:a+(r-a)*e}getAbsoluteValue2(t,e,s,a,n,r){if(t<this.frames[0]){switch(s){case H.setup:return n;case H.first:return a+(n-a)*e}return a}return s==H.setup?n+(r-n)*e:a+(r-a)*e}getScaleValue(t,e,s,a,n,r){if(t<this.frames[0]){switch(s){case H.setup:return r;case H.first:return n+(r-n)*e}return n}let i=this.getCurveValue(t)*r;if(1==e)return s==H.add?n+i-r:i;if(a==J.mixOut)switch(s){case H.setup:return r+(Math.abs(i)*X.signum(r)-r)*e;case H.first:case H.replace:return n+(Math.abs(i)*X.signum(n)-n)*e}else{let t=0;switch(s){case H.setup:return t=Math.abs(r)*X.signum(i),t+(i-t)*e;case H.first:case H.replace:return t=Math.abs(n)*X.signum(i),t+(i-t)*e}}return n+(i-r)*e}}class et extends Q{constructor(t,e,s,a){super(t,e,[s,a])}getFrameEntries(){return 3}setFrame(t,e,s,a){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=a}}class st extends tt{boneIndex=0;constructor(t,e,s){super(t,e,K.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,a,n,r,i){let o=t.bones[this.boneIndex];o.active&&(o.rotation=this.getRelativeValue(s,n,r,o.rotation,o.data.rotation))}}class at extends et{boneIndex=0;constructor(t,e,s){super(t,e,K.x+"|"+s,K.y+"|"+s),this.boneIndex=s}apply(t,e,s,a,n,r,i){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(r){case H.setup:return o.x=o.data.x,void(o.y=o.data.y);case H.first:o.x+=(o.data.x-o.x)*n,o.y+=(o.data.y-o.y)*n}return}let h=0,c=0,d=Z.search(l,s,3),u=this.curves[d/3];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+3]-t);h+=(l[d+3+1]-h)*e,c+=(l[d+3+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(r){case H.setup:o.x=o.data.x+h*n,o.y=o.data.y+c*n;break;case H.first:case H.replace:o.x+=(o.data.x+h-o.x)*n,o.y+=(o.data.y+c-o.y)*n;break;case H.add:o.x+=h*n,o.y+=c*n}}}class nt extends tt{boneIndex=0;constructor(t,e,s){super(t,e,K.x+"|"+s),this.boneIndex=s}apply(t,e,s,a,n,r,i){let o=t.bones[this.boneIndex];o.active&&(o.x=this.getRelativeValue(s,n,r,o.x,o.data.x))}}class rt extends tt{boneIndex=0;constructor(t,e,s){super(t,e,K.y+"|"+s),this.boneIndex=s}apply(t,e,s,a,n,r,i){let o=t.bones[this.boneIndex];o.active&&(o.y=this.getRelativeValue(s,n,r,o.y,o.data.y))}}class it extends et{boneIndex=0;constructor(t,e,s){super(t,e,K.scaleX+"|"+s,K.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,a,n,r,i){let o=t.bones[this.boneIndex];if(!o.active)return;let l,h,c=this.frames;if(s<c[0]){switch(r){case H.setup:return o.scaleX=o.data.scaleX,void(o.scaleY=o.data.scaleY);case H.first:o.scaleX+=(o.data.scaleX-o.scaleX)*n,o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}let d=Z.search(c,s,3),u=this.curves[d/3];switch(u){case 0:let t=c[d];l=c[d+1],h=c[d+2];let e=(s-t)/(c[d+3]-t);l+=(c[d+3+1]-l)*e,h+=(c[d+3+2]-h)*e;break;case 1:l=c[d+1],h=c[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),h=this.getBezierValue(s,d,2,u+18-2)}if(l*=o.data.scaleX,h*=o.data.scaleY,1==n)r==H.add?(o.scaleX+=l-o.data.scaleX,o.scaleY+=h-o.data.scaleY):(o.scaleX=l,o.scaleY=h);else{let t=0,e=0;if(i==J.mixOut)switch(r){case H.setup:t=o.data.scaleX,e=o.data.scaleY,o.scaleX=t+(Math.abs(l)*X.signum(t)-t)*n,o.scaleY=e+(Math.abs(h)*X.signum(e)-e)*n;break;case H.first:case H.replace:t=o.scaleX,e=o.scaleY,o.scaleX=t+(Math.abs(l)*X.signum(t)-t)*n,o.scaleY=e+(Math.abs(h)*X.signum(e)-e)*n;break;case H.add:o.scaleX+=(l-o.data.scaleX)*n,o.scaleY+=(h-o.data.scaleY)*n}else switch(r){case H.setup:t=Math.abs(o.data.scaleX)*X.signum(l),e=Math.abs(o.data.scaleY)*X.signum(h),o.scaleX=t+(l-t)*n,o.scaleY=e+(h-e)*n;break;case H.first:case H.replace:t=Math.abs(o.scaleX)*X.signum(l),e=Math.abs(o.scaleY)*X.signum(h),o.scaleX=t+(l-t)*n,o.scaleY=e+(h-e)*n;break;case H.add:o.scaleX+=(l-o.data.scaleX)*n,o.scaleY+=(h-o.data.scaleY)*n}}}}class ot extends tt{boneIndex=0;constructor(t,e,s){super(t,e,K.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,a,n,r,i){let o=t.bones[this.boneIndex];o.active&&(o.scaleX=this.getScaleValue(s,n,r,i,o.scaleX,o.data.scaleX))}}class lt extends tt{boneIndex=0;constructor(t,e,s){super(t,e,K.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,a,n,r,i){let o=t.bones[this.boneIndex];o.active&&(o.scaleY=this.getScaleValue(s,n,r,i,o.scaleY,o.data.scaleY))}}class ht extends et{boneIndex=0;constructor(t,e,s){super(t,e,K.shearX+"|"+s,K.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,a,n,r,i){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(r){case H.setup:return o.shearX=o.data.shearX,void(o.shearY=o.data.shearY);case H.first:o.shearX+=(o.data.shearX-o.shearX)*n,o.shearY+=(o.data.shearY-o.shearY)*n}return}let h=0,c=0,d=Z.search(l,s,3),u=this.curves[d/3];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+3]-t);h+=(l[d+3+1]-h)*e,c+=(l[d+3+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(r){case H.setup:o.shearX=o.data.shearX+h*n,o.shearY=o.data.shearY+c*n;break;case H.first:case H.replace:o.shearX+=(o.data.shearX+h-o.shearX)*n,o.shearY+=(o.data.shearY+c-o.shearY)*n;break;case H.add:o.shearX+=h*n,o.shearY+=c*n}}}class ct extends tt{boneIndex=0;constructor(t,e,s){super(t,e,K.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,a,n,r,i){let o=t.bones[this.boneIndex];o.active&&(o.shearX=this.getRelativeValue(s,n,r,o.shearX,o.data.shearX))}}class dt extends tt{boneIndex=0;constructor(t,e,s){super(t,e,K.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,a,n,r,i){let o=t.bones[this.boneIndex];o.active&&(o.shearY=this.getRelativeValue(s,n,r,o.shearY,o.data.shearY))}}class ut extends Z{boneIndex=0;constructor(t,e){super(t,[K.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,a,n,r,i){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;s<l[0]?r!=H.setup&&r!=H.first||(o.inherit=o.data.inherit):o.inherit=this.frames[Z.search(l,s,2)+1]}}class mt extends Q{slotIndex=0;constructor(t,e,s){super(t,e,[K.rgb+"|"+s,K.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,a,n,r){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=a,this.frames[t+3]=n,this.frames[t+4]=r}apply(t,e,s,a,n,r,i){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color;if(s<l[0]){let t=o.data.color;switch(r){case H.setup:return void h.setFromColor(t);case H.first:h.add((t.r-h.r)*n,(t.g-h.g)*n,(t.b-h.b)*n,(t.a-h.a)*n)}return}let c=0,d=0,u=0,m=0,f=Z.search(l,s,5),g=this.curves[f/5];switch(g){case 0:let t=l[f];c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];let e=(s-t)/(l[f+5]-t);c+=(l[f+5+1]-c)*e,d+=(l[f+5+2]-d)*e,u+=(l[f+5+3]-u)*e,m+=(l[f+5+4]-m)*e;break;case 1:c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];break;default:c=this.getBezierValue(s,f,1,g-2),d=this.getBezierValue(s,f,2,g+18-2),u=this.getBezierValue(s,f,3,g+36-2),m=this.getBezierValue(s,f,4,g+54-2)}1==n?h.set(c,d,u,m):(r==H.setup&&h.setFromColor(o.data.color),h.add((c-h.r)*n,(d-h.g)*n,(u-h.b)*n,(m-h.a)*n))}}class ft extends Q{slotIndex=0;constructor(t,e,s){super(t,e,[K.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,a,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=a,this.frames[t+3]=n}apply(t,e,s,a,n,r,i){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color;if(s<l[0]){let t=o.data.color;switch(r){case H.setup:return h.r=t.r,h.g=t.g,void(h.b=t.b);case H.first:h.r+=(t.r-h.r)*n,h.g+=(t.g-h.g)*n,h.b+=(t.b-h.b)*n}return}let c=0,d=0,u=0,m=Z.search(l,s,4),f=this.curves[m>>2];switch(f){case 0:let t=l[m];c=l[m+1],d=l[m+2],u=l[m+3];let e=(s-t)/(l[m+4]-t);c+=(l[m+4+1]-c)*e,d+=(l[m+4+2]-d)*e,u+=(l[m+4+3]-u)*e;break;case 1:c=l[m+1],d=l[m+2],u=l[m+3];break;default:c=this.getBezierValue(s,m,1,f-2),d=this.getBezierValue(s,m,2,f+18-2),u=this.getBezierValue(s,m,3,f+36-2)}if(1==n)h.r=c,h.g=d,h.b=u;else{if(r==H.setup){let t=o.data.color;h.r=t.r,h.g=t.g,h.b=t.b}h.r+=(c-h.r)*n,h.g+=(d-h.g)*n,h.b+=(u-h.b)*n}}}class gt extends tt{slotIndex=0;constructor(t,e,s){super(t,e,K.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,a,n,r,i){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.color;if(s<this.frames[0]){let t=o.data.color;switch(r){case H.setup:return void(l.a=t.a);case H.first:l.a+=(t.a-l.a)*n}return}let h=this.getCurveValue(s);1==n?l.a=h:(r==H.setup&&(l.a=o.data.color.a),l.a+=(h-l.a)*n)}}class pt extends Q{slotIndex=0;constructor(t,e,s){super(t,e,[K.rgb+"|"+s,K.alpha+"|"+s,K.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,a,n,r,i,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=a,this.frames[t+3]=n,this.frames[t+4]=r,this.frames[t+5]=i,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,a,n,r,i){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color,c=o.darkColor;if(s<l[0]){let t=o.data.color,e=o.data.darkColor;switch(r){case H.setup:return h.setFromColor(t),c.r=e.r,c.g=e.g,void(c.b=e.b);case H.first:h.add((t.r-h.r)*n,(t.g-h.g)*n,(t.b-h.b)*n,(t.a-h.a)*n),c.r+=(e.r-c.r)*n,c.g+=(e.g-c.g)*n,c.b+=(e.b-c.b)*n}return}let d=0,u=0,m=0,f=0,g=0,p=0,x=0,w=Z.search(l,s,8),b=this.curves[w>>3];switch(b){case 0:let t=l[w];d=l[w+1],u=l[w+2],m=l[w+3],f=l[w+4],g=l[w+5],p=l[w+6],x=l[w+7];let e=(s-t)/(l[w+8]-t);d+=(l[w+8+1]-d)*e,u+=(l[w+8+2]-u)*e,m+=(l[w+8+3]-m)*e,f+=(l[w+8+4]-f)*e,g+=(l[w+8+5]-g)*e,p+=(l[w+8+6]-p)*e,x+=(l[w+8+7]-x)*e;break;case 1:d=l[w+1],u=l[w+2],m=l[w+3],f=l[w+4],g=l[w+5],p=l[w+6],x=l[w+7];break;default:d=this.getBezierValue(s,w,1,b-2),u=this.getBezierValue(s,w,2,b+18-2),m=this.getBezierValue(s,w,3,b+36-2),f=this.getBezierValue(s,w,4,b+54-2),g=this.getBezierValue(s,w,5,b+72-2),p=this.getBezierValue(s,w,6,b+90-2),x=this.getBezierValue(s,w,7,b+108-2)}if(1==n)h.set(d,u,m,f),c.r=g,c.g=p,c.b=x;else{if(r==H.setup){h.setFromColor(o.data.color);let t=o.data.darkColor;c.r=t.r,c.g=t.g,c.b=t.b}h.add((d-h.r)*n,(u-h.g)*n,(m-h.b)*n,(f-h.a)*n),c.r+=(g-c.r)*n,c.g+=(p-c.g)*n,c.b+=(x-c.b)*n}}}class xt extends Q{slotIndex=0;constructor(t,e,s){super(t,e,[K.rgb+"|"+s,K.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,a,n,r,i,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=a,this.frames[t+3]=n,this.frames[t+4]=r,this.frames[t+5]=i,this.frames[t+6]=o}apply(t,e,s,a,n,r,i){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color,c=o.darkColor;if(s<l[0]){let t=o.data.color,e=o.data.darkColor;switch(r){case H.setup:return h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,void(c.b=e.b);case H.first:h.r+=(t.r-h.r)*n,h.g+=(t.g-h.g)*n,h.b+=(t.b-h.b)*n,c.r+=(e.r-c.r)*n,c.g+=(e.g-c.g)*n,c.b+=(e.b-c.b)*n}return}let d=0,u=0,m=0,f=0,g=0,p=0,x=Z.search(l,s,7),w=this.curves[x/7];switch(w){case 0:let t=l[x];d=l[x+1],u=l[x+2],m=l[x+3],f=l[x+4],g=l[x+5],p=l[x+6];let e=(s-t)/(l[x+7]-t);d+=(l[x+7+1]-d)*e,u+=(l[x+7+2]-u)*e,m+=(l[x+7+3]-m)*e,f+=(l[x+7+4]-f)*e,g+=(l[x+7+5]-g)*e,p+=(l[x+7+6]-p)*e;break;case 1:d=l[x+1],u=l[x+2],m=l[x+3],f=l[x+4],g=l[x+5],p=l[x+6];break;default:d=this.getBezierValue(s,x,1,w-2),u=this.getBezierValue(s,x,2,w+18-2),m=this.getBezierValue(s,x,3,w+36-2),f=this.getBezierValue(s,x,4,w+54-2),g=this.getBezierValue(s,x,5,w+72-2),p=this.getBezierValue(s,x,6,w+90-2)}if(1==n)h.r=d,h.g=u,h.b=m,c.r=f,c.g=g,c.b=p;else{if(r==H.setup){let t=o.data.color,e=o.data.darkColor;h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,c.b=e.b}h.r+=(d-h.r)*n,h.g+=(u-h.g)*n,h.b+=(m-h.b)*n,c.r+=(f-c.r)*n,c.g+=(g-c.g)*n,c.b+=(p-c.b)*n}}}class wt extends Z{slotIndex=0;attachmentNames;constructor(t,e){super(t,[K.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(t,e,s,a,n,r,i){let o=t.slots[this.slotIndex];o.bone.active&&(i!=J.mixOut?s<this.frames[0]?r!=H.setup&&r!=H.first||this.setAttachment(t,o,o.data.attachmentName):this.setAttachment(t,o,this.attachmentNames[Z.search1(this.frames,s)]):r==H.setup&&this.setAttachment(t,o,o.data.attachmentName))}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class bt extends Q{slotIndex=0;attachment;vertices;constructor(t,e,s,a){super(t,e,[K.deform+"|"+s+"|"+a.id]),this.slotIndex=s,this.attachment=a,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,a,n,r,i,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(a-2*r+o),f=.03*l-.06*i,g=.006*(3*(r-o)-a+h),p=.018*(i-l+.33333333),x=2*m+g,w=2*f+p,b=.3*(r-a)+m+.16666667*g,y=.3*i+f+.16666667*p,k=a+b,v=y;for(let t=u+18;u<t;u+=2)d[u]=k,d[u+1]=v,b+=x,y+=w,x+=g,w+=p,k+=b,v+=y}getCurvePercent(t,e){let s=this.curves,a=s[e];switch(a){case 0:let s=this.frames[e];return(t-s)/(this.frames[e+this.getFrameEntries()]-s);case 1:return 0}if(a-=2,s[a]>t){let n=this.frames[e];return s[a+1]*(t-n)/(s[a]-n)}let n=a+18;for(a+=2;a<n;a+=2)if(s[a]>=t){let e=s[a-2],n=s[a-1];return n+(t-e)/(s[a]-e)*(s[a+1]-n)}let r=s[n-2],i=s[n-1];return i+(1-i)*(t-r)/(this.frames[e+this.getFrameEntries()]-r)}apply(t,e,s,a,n,r,i){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.getAttachment();if(!l)return;if(!(l instanceof W)||l.timelineAttachment!=this.attachment)return;let h=o.deform;0==h.length&&(r=H.setup);let c=this.vertices,d=c[0].length,u=this.frames;if(s<u[0]){switch(r){case H.setup:return void(h.length=0);case H.first:if(1==n)return void(h.length=0);h.length=d;let t=l;if(t.bones){n=1-n;for(m=0;m<d;m++)h[m]*=n}else{let e=t.vertices;for(var m=0;m<d;m++)h[m]+=(e[m]-h[m])*n}}return}if(h.length=d,s>=u[u.length-1]){let t=c[u.length-1];if(1==n)if(r==H.add){let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e];else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=t[e]-s[e]}}else V.arrayCopy(t,0,h,0,d);else switch(r){case H.setup:{let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]=t[e]*n;else{let s=e.vertices;for(let e=0;e<d;e++){let a=s[e];h[e]=a+(t[e]-a)*n}}break}case H.first:case H.replace:for(let e=0;e<d;e++)h[e]+=(t[e]-h[e])*n;break;case H.add:let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e]*n;else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=(t[e]-s[e])*n}}return}let f=Z.search1(u,s),g=this.getCurvePercent(s,f),p=c[f],x=c[f+1];if(1==n)if(r==H.add){let t=l;if(t.bones)for(let t=0;t<d;t++){let e=p[t];h[t]+=e+(x[t]-e)*g}else{let e=t.vertices;for(let t=0;t<d;t++){let s=p[t];h[t]+=s+(x[t]-s)*g-e[t]}}}else for(let t=0;t<d;t++){let e=p[t];h[t]=e+(x[t]-e)*g}else switch(r){case H.setup:{let t=l;if(t.bones)for(let t=0;t<d;t++){let e=p[t];h[t]=(e+(x[t]-e)*g)*n}else{let e=t.vertices;for(let t=0;t<d;t++){let s=p[t],a=e[t];h[t]=a+(s+(x[t]-s)*g-a)*n}}break}case H.first:case H.replace:for(let t=0;t<d;t++){let e=p[t];h[t]+=(e+(x[t]-e)*g-h[t])*n}break;case H.add:let t=l;if(t.bones)for(let t=0;t<d;t++){let e=p[t];h[t]+=(e+(x[t]-e)*g)*n}else{let e=t.vertices;for(let t=0;t<d;t++){let s=p[t];h[t]+=(s+(x[t]-s)*g-e[t])*n}}}}}class yt extends Z{static propertyIds=[""+K.event];events;constructor(t){super(t,yt.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,a,n,r,i){if(!a)return;let o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,a,n,r,i),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=Z.search1(o,e)+1;let t=o[h];for(;h>0&&o[h-1]==t;)h--}for(;h<l&&s>=o[h];h++)a.push(this.events[h])}}class kt extends Z{static propertyIds=[""+K.drawOrder];drawOrders;constructor(t){super(t,kt.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,a,n,r,i){if(i==J.mixOut)return void(r==H.setup&&V.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s<this.frames[0])return void(r!=H.setup&&r!=H.first||V.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));let o=Z.search1(this.frames,s),l=this.drawOrders[o];if(l){let e=t.drawOrder,s=t.slots;for(let t=0,a=l.length;t<a;t++)e[t]=s[l[t]]}else V.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)}}class vt extends Q{constraintIndex=0;constructor(t,e,s){super(t,e,[K.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,a,n,r,i){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=a,this.frames[t+3]=n,this.frames[t+4]=r?1:0,this.frames[t+5]=i?1:0}apply(t,e,s,a,n,r,i){let o=t.ikConstraints[this.constraintIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(r){case H.setup:return o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,void(o.stretch=o.data.stretch);case H.first:o.mix+=(o.data.mix-o.mix)*n,o.softness+=(o.data.softness-o.softness)*n,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let h=0,c=0,d=Z.search(l,s,6),u=this.curves[d/6];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+6]-t);h+=(l[d+6+1]-h)*e,c+=(l[d+6+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}r==H.setup?(o.mix=o.data.mix+(h-o.data.mix)*n,o.softness=o.data.softness+(c-o.data.softness)*n,i==J.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5])):(o.mix+=(h-o.mix)*n,o.softness+=(c-o.softness)*n,i==J.mixIn&&(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5]))}}class St extends Q{constraintIndex=0;constructor(t,e,s){super(t,e,[K.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,a,n,r,i,o){let l=this.frames;l[t*=7]=e,l[t+1]=s,l[t+2]=a,l[t+3]=n,l[t+4]=r,l[t+5]=i,l[t+6]=o}apply(t,e,s,a,n,r,i){let o=t.transformConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d,u,m,f=this.frames;if(s<f[0]){let t=o.data;switch(r){case H.setup:return o.mixRotate=t.mixRotate,o.mixX=t.mixX,o.mixY=t.mixY,o.mixScaleX=t.mixScaleX,o.mixScaleY=t.mixScaleY,void(o.mixShearY=t.mixShearY);case H.first:o.mixRotate+=(t.mixRotate-o.mixRotate)*n,o.mixX+=(t.mixX-o.mixX)*n,o.mixY+=(t.mixY-o.mixY)*n,o.mixScaleX+=(t.mixScaleX-o.mixScaleX)*n,o.mixScaleY+=(t.mixScaleY-o.mixScaleY)*n,o.mixShearY+=(t.mixShearY-o.mixShearY)*n}return}let g=Z.search(f,s,7),p=this.curves[g/7];switch(p){case 0:let t=f[g];l=f[g+1],h=f[g+2],c=f[g+3],d=f[g+4],u=f[g+5],m=f[g+6];let e=(s-t)/(f[g+7]-t);l+=(f[g+7+1]-l)*e,h+=(f[g+7+2]-h)*e,c+=(f[g+7+3]-c)*e,d+=(f[g+7+4]-d)*e,u+=(f[g+7+5]-u)*e,m+=(f[g+7+6]-m)*e;break;case 1:l=f[g+1],h=f[g+2],c=f[g+3],d=f[g+4],u=f[g+5],m=f[g+6];break;default:l=this.getBezierValue(s,g,1,p-2),h=this.getBezierValue(s,g,2,p+18-2),c=this.getBezierValue(s,g,3,p+36-2),d=this.getBezierValue(s,g,4,p+54-2),u=this.getBezierValue(s,g,5,p+72-2),m=this.getBezierValue(s,g,6,p+90-2)}if(r==H.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*n,o.mixX=t.mixX+(h-t.mixX)*n,o.mixY=t.mixY+(c-t.mixY)*n,o.mixScaleX=t.mixScaleX+(d-t.mixScaleX)*n,o.mixScaleY=t.mixScaleY+(u-t.mixScaleY)*n,o.mixShearY=t.mixShearY+(m-t.mixShearY)*n}else o.mixRotate+=(l-o.mixRotate)*n,o.mixX+=(h-o.mixX)*n,o.mixY+=(c-o.mixY)*n,o.mixScaleX+=(d-o.mixScaleX)*n,o.mixScaleY+=(u-o.mixScaleY)*n,o.mixShearY+=(m-o.mixShearY)*n}}class At extends tt{constraintIndex=0;constructor(t,e,s){super(t,e,K.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,a,n,r,i){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.position=this.getAbsoluteValue(s,n,r,o.position,o.data.position))}}class It extends tt{constraintIndex=0;constructor(t,e,s){super(t,e,K.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,a,n,r,i){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.spacing=this.getAbsoluteValue(s,n,r,o.spacing,o.data.spacing))}}class Mt extends Q{constraintIndex=0;constructor(t,e,s){super(t,e,[K.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,a,n){let r=this.frames;r[t<<=2]=e,r[t+1]=s,r[t+2]=a,r[t+3]=n}apply(t,e,s,a,n,r,i){let o=t.pathConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d=this.frames;if(s<d[0]){switch(r){case H.setup:return o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,void(o.mixY=o.data.mixY);case H.first:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*n,o.mixX+=(o.data.mixX-o.mixX)*n,o.mixY+=(o.data.mixY-o.mixY)*n}return}let u=Z.search(d,s,4),m=this.curves[u>>2];switch(m){case 0:let t=d[u];l=d[u+1],h=d[u+2],c=d[u+3];let e=(s-t)/(d[u+4]-t);l+=(d[u+4+1]-l)*e,h+=(d[u+4+2]-h)*e,c+=(d[u+4+3]-c)*e;break;case 1:l=d[u+1],h=d[u+2],c=d[u+3];break;default:l=this.getBezierValue(s,u,1,m-2),h=this.getBezierValue(s,u,2,m+18-2),c=this.getBezierValue(s,u,3,m+36-2)}if(r==H.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*n,o.mixX=t.mixX+(h-t.mixX)*n,o.mixY=t.mixY+(c-t.mixY)*n}else o.mixRotate+=(l-o.mixRotate)*n,o.mixX+=(h-o.mixX)*n,o.mixY+=(c-o.mixY)*n}}class Ct extends tt{constraintIndex=0;constructor(t,e,s,a){super(t,e,a+"|"+s),this.constraintIndex=s}apply(t,e,s,a,n,r,i){let o;if(-1==this.constraintIndex){const e=s>=this.frames[0]?this.getCurveValue(s):0;for(const a of t.physicsConstraints)a.active&&this.global(a.data)&&this.set(a,this.getAbsoluteValue2(s,n,r,this.get(a),this.setup(a),e))}else o=t.physicsConstraints[this.constraintIndex],o.active&&this.set(o,this.getAbsoluteValue(s,n,r,this.get(o),this.setup(o)))}}class Ft extends Ct{constructor(t,e,s){super(t,e,s,K.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}}class Tt extends Ct{constructor(t,e,s){super(t,e,s,K.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}}class Et extends Ct{constructor(t,e,s){super(t,e,s,K.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}}class Yt extends Ct{constructor(t,e,s){super(t,e,s,K.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 Rt extends Ct{constructor(t,e,s){super(t,e,s,K.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}}class Xt extends Ct{constructor(t,e,s){super(t,e,s,K.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}}class _t extends Ct{constructor(t,e,s){super(t,e,s,K.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}}class Bt extends Z{static propertyIds=[K.physicsConstraintReset.toString()];constraintIndex;constructor(t,e){super(t,Bt.propertyIds),this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,a,n,r,i){let o;if(-1!=this.constraintIndex&&(o=t.physicsConstraints[this.constraintIndex],!o.active))return;const l=this.frames;if(e>s)this.apply(t,e,Number.MAX_VALUE,[],n,r,i),e=-1;else if(e>=l[l.length-1])return;if(!(s<l[0])&&(e<l[0]||s>=l[Z.search1(l,e)+1]))if(null!=o)o.reset();else for(const e of t.physicsConstraints)e.active&&e.reset()}}class Pt extends Z{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,e,s){super(t,[K.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return Pt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,a,n){let r=this.frames;r[t*=Pt.ENTRIES]=e,r[t+Pt.MODE]=s|a<<4,r[t+Pt.DELAY]=n}apply(t,e,s,a,n,r,i){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.attachment,h=this.attachment;if(!(l==h||l instanceof W&&l.timelineAttachment==h))return;let c=this.frames;if(s<c[0])return void(r!=H.setup&&r!=H.first||(o.sequenceIndex=-1));let d=Z.search(c,s,Pt.ENTRIES),u=c[d],m=c[d+Pt.MODE],f=c[d+Pt.DELAY];if(!this.attachment.sequence)return;let g=m>>4,p=this.attachment.sequence.regions.length,x=G[15&m];if(x!=$.hold)switch(g+=(s-u)/f+1e-5|0,x){case $.once:g=Math.min(p-1,g);break;case $.loop:g%=p;break;case $.pingpong:{let t=(p<<1)-2;g=0==t?0:g%t,g>=p&&(g=t-g);break}case $.onceReverse:g=Math.max(p-1-g,0);break;case $.loopReverse:g=p-1-g%p;break;case $.pingpongReverse:{let t=(p<<1)-2;g=0==t?0:(g+p-1)%t,g>=p&&(g=t-g)}}o.sequenceIndex=g}}class Vt{static _emptyAnimation=new j("<empty>",[],0);static emptyAnimation(){return Vt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Ot(this);propertyIDs=new Y;animationsChanged=!1;trackEntryPool=new O((()=>new Dt));constructor(t){this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,a=e.length;s<a;s++){let a=e[s];if(!a)continue;a.animationLast=a.nextAnimationLast,a.trackLast=a.nextTrackLast;let n=t*a.timeScale;if(a.delay>0){if(a.delay-=n,a.delay>0)continue;n=-a.delay,a.delay=0}let r=a.next;if(r){let e=a.trackLast-r.delay;if(e>=0){for(r.delay=0,r.trackTime+=0==a.timeScale?0:(e/a.timeScale+t)*r.timeScale,a.trackTime+=n,this.setCurrent(s,r,!0);r.mixingFrom;)r.mixTime+=t,r=r.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&!a.mixingFrom){e[s]=null,this.queue.end(a),this.clearNext(a);continue}if(a.mixingFrom&&this.updateMixingFrom(a,t)){let t=a.mixingFrom;for(a.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}a.trackTime+=n}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let a=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)),a):(s.trackTime+=e*s.timeScale,t.mixTime+=e,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let e=this.events,s=this.tracks,a=!1;for(let r=0,i=s.length;r<i;r++){let i=s[r];if(!i||i.delay>0)continue;a=!0;let o=0==r?H.first:i.mixBlend,l=i.alpha;i.mixingFrom?l*=this.applyMixingFrom(i,t,o):i.trackTime>=i.trackEnd&&!i.next&&(l=0);let h=l>=i.alphaAttachmentThreshold,c=i.animationLast,d=i.getAnimationTime(),u=d,m=e;i.reverse&&(u=i.animation.duration-u,m=null);let f=i.animation.timelines,g=f.length;if(0==r&&1==l||o==H.add){0==r&&(h=!0);for(let e=0;e<g;e++){V.webkit602BugfixHelper(l,o);var n=f[e];n instanceof wt?this.applyAttachmentTimeline(n,t,u,o,h):n.apply(t,c,u,m,l,o,J.mixIn)}}else{let e=i.timelineMode,s=i.shortestRotation,a=!s&&i.timelinesRotation.length!=g<<1;a&&(i.timelinesRotation.length=g<<1);for(let n=0;n<g;n++){let r=f[n],d=e[n]==qt?o:H.setup;!s&&r instanceof st?this.applyRotateTimeline(r,t,u,l,d,i.timelinesRotation,n<<1,a):r instanceof wt?this.applyAttachmentTimeline(r,t,u,o,h):(V.webkit602BugfixHelper(l,o),r.apply(t,c,u,m,l,d,J.mixIn))}}this.queueEvents(i,d),e.length=0,i.nextAnimationLast=d,i.nextTrackLast=i.trackTime}for(var r=this.unkeyedState+Gt,i=t.slots,o=0,l=t.slots.length;o<l;o++){var h=i[o];if(h.attachmentState==r){var c=h.data.attachmentName;h.setAttachment(c?t.getAttachment(h.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),a}applyMixingFrom(t,e,s){let a=t.mixingFrom;a.mixingFrom&&this.applyMixingFrom(a,e,s);let n=0;0==t.mixDuration?(n=1,s==H.first&&(s=H.setup)):(n=t.mixTime/t.mixDuration,n>1&&(n=1),s!=H.first&&(s=a.mixBlend));let r=n<a.mixAttachmentThreshold,i=n<a.mixDrawOrderThreshold,o=a.animation.timelines,l=o.length,h=a.alpha*t.interruptAlpha,c=h*(1-n),d=a.animationLast,u=a.getAnimationTime(),m=u,f=null;if(a.reverse?m=a.animation.duration-m:n<a.eventThreshold&&(f=this.events),s==H.add)for(let t=0;t<l;t++)o[t].apply(e,d,m,f,c,s,J.mixOut);else{let t=a.timelineMode,n=a.timelineHoldMix,u=a.shortestRotation,g=!u&&a.timelinesRotation.length!=l<<1;g&&(a.timelinesRotation.length=l<<1),a.totalAlpha=0;for(let p=0;p<l;p++){let l,x=o[p],w=J.mixOut,b=0;switch(t[p]){case qt:if(!i&&x instanceof kt)continue;l=s,b=c;break;case Ut:l=H.setup,b=c;break;case Wt:l=s,b=h;break;case zt:l=H.setup,b=h;break;default:l=H.setup;let t=n[p];b=h*Math.max(0,1-t.mixTime/t.mixDuration)}a.totalAlpha+=b,!u&&x instanceof st?this.applyRotateTimeline(x,e,m,b,l,a.timelinesRotation,p<<1,g):x instanceof wt?this.applyAttachmentTimeline(x,e,m,l,r&&b>=a.alphaAttachmentThreshold):(V.webkit602BugfixHelper(b,s),i&&x instanceof kt&&l==H.setup&&(w=J.mixIn),x.apply(e,d,m,f,b,l,w))}}return t.mixDuration>0&&this.queueEvents(a,u),this.events.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime,n}applyAttachmentTimeline(t,e,s,a,n){var r=e.slots[t.slotIndex];r.bone.active&&(s<t.frames[0]?a!=H.setup&&a!=H.first||this.setAttachment(e,r,r.data.attachmentName,n):this.setAttachment(e,r,t.attachmentNames[Z.search1(t.frames,s)],n),r.attachmentState<=this.unkeyedState&&(r.attachmentState=this.unkeyedState+Gt))}setAttachment(t,e,s,a){e.setAttachment(s?t.getAttachment(e.data.index,s):null),a&&(e.attachmentState=this.unkeyedState+jt)}applyRotateTimeline(t,e,s,a,n,r,i,o){if(o&&(r[i]=0),1==a)return void t.apply(e,0,s,null,1,n,J.mixIn);let l=e.bones[t.boneIndex];if(!l.active)return;let h=0,c=0;if(s<t.frames[0])switch(n){case H.setup:l.rotation=l.data.rotation;default:return;case H.first:h=l.rotation,c=l.data.rotation}else h=n==H.setup?l.data.rotation:l.rotation,c=l.data.rotation+t.getCurveValue(s);let d=0,u=c-h;if(u-=360*Math.ceil(u/360-.5),0==u)d=r[i];else{let t=0,e=0;o?(t=0,e=u):(t=r[i],e=r[i+1]);let s=t-t%360;d=u+s;let a=u>=0,n=t>=0;Math.abs(e)<=90&&X.signum(e)!=X.signum(u)&&(Math.abs(t-s)>180?(d+=360*X.signum(t),n=a):0!=s?d-=360*X.signum(t):n=a),n!=a&&(d+=360*X.signum(t)),r[i]=d}r[i+1]=u,l.rotation=h+d*a}queueEvents(t,e){let s=t.animationStart,a=t.animationEnd,n=a-s,r=t.trackLast%n,i=this.events,o=0,l=i.length;for(;o<l;o++){let e=i[o];if(e.time<r)break;e.time>a||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>=a&&t.animationLast<a;for(h&&this.queue.complete(t);o<l;o++){let e=i[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 a=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,a&&(s&&this.queue.interrupt(a),e.mixingFrom=a,a.mixingTo=e,e.mixTime=0,a.mixingFrom&&a.mixDuration>0&&(e.interruptAlpha*=Math.min(1,a.mixTime/a.mixDuration)),a.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let a=this.data.skeletonData.findAnimation(e);if(!a)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,a,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let a=!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,a=!1):this.clearNext(n));let r=this.trackEntry(t,e,s,n);return this.setCurrent(t,r,a),this.queue.drain(),r}addAnimation(t,e,s=!1,a=0){let n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,n,s,a)}addAnimationWith(t,e,s=!1,a=0){if(!e)throw new Error("animation cannot be null.");let n=this.expandToIndex(t);if(n)for(;n.next;)n=n.next;let r=this.trackEntry(t,e,s,n);return n?(n.next=r,r.previous=n,a<=0&&(a+=n.getTrackComplete()-r.mixDuration)):(this.setCurrent(t,r,!0),this.queue.drain()),r.delay=a,r}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,Vt.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let a=this.addAnimationWith(t,Vt.emptyAnimation(),!1,s);return s<=0&&(a.delay+=a.mixDuration-e),a.mixDuration=e,a.trackEnd=e,a}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){let s=this.tracks[e];s&&this.setEmptyAnimation(s.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(V.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,s,a){let n=this.trackEntryPool.obtain();return n.reset(),n.trackIndex=t,n.animation=e,n.loop=s,n.holdPrevious=!1,n.reverse=!1,n.shortestRotation=!1,n.eventThreshold=0,n.alphaAttachmentThreshold=0,n.mixAttachmentThreshold=0,n.mixDrawOrderThreshold=0,n.animationStart=0,n.animationEnd=e.duration,n.animationLast=-1,n.nextAnimationLast=-1,n.delay=0,n.trackTime=0,n.trackLast=-1,n.nextTrackLast=-1,n.trackEnd=Number.MAX_VALUE,n.timeScale=1,n.alpha=1,n.mixTime=0,n.mixDuration=a?this.data.getMix(a.animation,e):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=H.replace,n}clearNext(t){let e=t.next;for(;e;)this.queue.dispose(e),e=e.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let e=0,s=t.length;e<s;e++){let s=t[e];if(s){for(;s.mixingFrom;)s=s.mixingFrom;do{s.mixingTo&&s.mixBlend==H.add||this.computeHold(s),s=s.mixingTo}while(s)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,a=t.animation.timelines.length,n=t.timelineMode;n.length=a;let r=t.timelineHoldMix;r.length=0;let i=this.propertyIDs;if(e&&e.holdPrevious)for(let t=0;t<a;t++)n[t]=i.addAll(s[t].getPropertyIds())?zt:Wt;else t:for(let o=0;o<a;o++){let a=s[o],l=a.getPropertyIds();if(i.addAll(l))if(!e||a instanceof wt||a instanceof kt||a instanceof yt||!e.animation.hasTimeline(l))n[o]=Ut;else{for(let s=e.mixingTo;s;s=s.mixingTo)if(!s.animation.hasTimeline(l)){if(t.mixDuration>0){n[o]=$t,r[o]=s;continue t}break}n[o]=zt}else n[o]=qt}}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 Dt{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=H.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(t){this.objects.push(Nt.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(Nt.interrupt),this.objects.push(t)}end(t){this.objects.push(Nt.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(Nt.dispose),this.objects.push(t)}complete(t){this.objects.push(Nt.complete),this.objects.push(t)}event(t,e){this.objects.push(Nt.event),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let a=t[s],n=t[s+1];switch(a){case Nt.start:n.listener&&n.listener.start&&n.listener.start(n);for(let t=0;t<e.length;t++){let s=e[t];s.start&&s.start(n)}break;case Nt.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let t=0;t<e.length;t++){let s=e[t];s.interrupt&&s.interrupt(n)}break;case Nt.end:n.listener&&n.listener.end&&n.listener.end(n);for(let t=0;t<e.length;t++){let s=e[t];s.end&&s.end(n)}case Nt.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let t=0;t<e.length;t++){let s=e[t];s.dispose&&s.dispose(n)}this.animState.trackEntryPool.free(n);break;case Nt.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let t=0;t<e.length;t++){let s=e[t];s.complete&&s.complete(n)}break;case Nt.event:let a=t[2+s++];n.listener&&n.listener.event&&n.listener.event(n,a);for(let t=0;t<e.length;t++){let s=e[t];s.event&&s.event(n,a)}}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}}var Nt;!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"}(Nt||(Nt={}));class Lt{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}}const qt=0,Ut=1,Wt=2,zt=3,$t=4,Gt=1,jt=2;class Ht{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let a=this.skeletonData.findAnimation(t);if(!a)throw new Error("Animation not found: "+t);let n=this.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);this.setMixWith(a,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 a=t.name+"."+e.name;this.animationToMixTime[a]=s}getMix(t,e){let s=t.name+"."+e.name,a=this.animationToMixTime[s];return void 0===a?this.defaultMix:a}}class Jt extends W{color=new R(1,1,1,1);constructor(t){super(t)}copy(){let t=new Jt(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class Kt extends W{endSlot=null;color=new R(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new Kt(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class Zt{_image;constructor(t){this._image=t}getImage(){return this._image}}var Qt,te,ee,se,ae,ne,re,ie,oe;!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"}(Qt||(Qt={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(te||(te={}));class le{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0}class he extends Zt{setFilters(t,e){}setWraps(t,e){}dispose(){}}class ce{pages=new Array;regions=new Array;constructor(t){let e=new de(t),s=new Array(4),a={size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},format:()=>{},filter:t=>{t.minFilter=V.enumValue(Qt,s[1]),t.magFilter=V.enumValue(Qt,s[2])},repeat:t=>{-1!=s[1].indexOf("x")&&(t.uWrap=te.Repeat),-1!=s[1].indexOf("y")&&(t.vWrap=te.Repeat)},pma:t=>{t.pma="true"==s[1]}};var n={xy:t=>{t.x=parseInt(s[1]),t.y=parseInt(s[2])},size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},bounds:t=>{t.x=parseInt(s[1]),t.y=parseInt(s[2]),t.width=parseInt(s[3]),t.height=parseInt(s[4])},offset:t=>{t.offsetX=parseInt(s[1]),t.offsetY=parseInt(s[2])},orig:t=>{t.originalWidth=parseInt(s[1]),t.originalHeight=parseInt(s[2])},offsets:t=>{t.offsetX=parseInt(s[1]),t.offsetY=parseInt(s[2]),t.originalWidth=parseInt(s[3]),t.originalHeight=parseInt(s[4])},rotate:t=>{let e=s[1];"true"==e?t.degrees=90:"false"!=e&&(t.degrees=parseInt(e))},index:t=>{t.index=parseInt(s[1])}};let r=e.readLine();for(;r&&0==r.trim().length;)r=e.readLine();for(;r&&0!=r.trim().length&&0!=e.readEntry(s,r);)r=e.readLine();let i=null,o=null,l=null;for(;null!==r;)if(0==r.trim().length)i=null,r=e.readLine();else if(i){let t=new me(i,r);for(;;){let a=e.readEntry(s,r=e.readLine());if(0==a)break;let i=n[s[0]];if(i)i(t);else{o||(o=[]),l||(l=[]),o.push(s[0]);let t=[];for(let e=0;e<a;e++)t.push(parseInt(s[e+1]));l.push(t)}}0==t.originalWidth&&0==t.originalHeight&&(t.originalWidth=t.width,t.originalHeight=t.height),o&&o.length>0&&l&&l.length>0&&(t.names=o,t.values=l,o=null,l=null),t.u=t.x/i.width,t.v=t.y/i.height,90==t.degrees?(t.u2=(t.x+t.height)/i.width,t.v2=(t.y+t.width)/i.height):(t.u2=(t.x+t.width)/i.width,t.v2=(t.y+t.height)/i.height),this.regions.push(t)}else{for(i=new ue(r.trim());0!=e.readEntry(s,r=e.readLine());){let t=a[s[0]];t&&t(i)}this.pages.push(i)}}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 de{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 a=1,n=s+1;;a++){let s=e.indexOf(",",n);if(-1==s)return t[a]=e.substr(n).trim(),a;if(t[a]=e.substr(n,s-n).trim(),n=s+1,4==a)return 4}}}class ue{name;minFilter=Qt.Nearest;magFilter=Qt.Nearest;uWrap=te.ClampToEdge;vWrap=te.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 me extends le{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 fe extends W{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new R(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new R(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=V.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,a=this.region.u,n=this.region.v,r=0,i=0;if(this.region instanceof me){let o=this.region,l=o.page,h=l.width,c=l.height;switch(o.degrees){case 90:a-=(o.originalHeight-o.offsetY-o.height)/h,n-=(o.originalWidth-o.offsetX-o.width)/c,r=o.originalHeight/h,i=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=a+t[o+1]*r,e[o+1]=n+(1-t[o])*i;return;case 180:a-=(o.originalWidth-o.offsetX-o.width)/h,n-=o.offsetY/c,r=o.originalWidth/h,i=o.originalHeight/c;for(let o=0;o<s;o+=2)e[o]=a+(1-t[o])*r,e[o+1]=n+(1-t[o+1])*i;return;case 270:a-=o.offsetY/h,n-=o.offsetX/c,r=o.originalHeight/h,i=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=a+(1-t[o+1])*r,e[o+1]=n+t[o]*i;return}a-=o.offsetX/h,n-=(o.originalHeight-o.offsetY-o.height)/c,r=o.originalWidth/h,i=o.originalHeight/c}else this.region?(r=this.region.u2-a,i=this.region.v2-n):(a=n=0,r=i=1);for(let o=0;o<s;o+=2)e[o]=a+t[o]*r,e[o+1]=n+t[o+1]*i}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 fe(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),V.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),V.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),V.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=null!=this.sequence?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),V.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,a,n,r){null!=this.sequence&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,a,n,r)}newLinkedMesh(){let t=new fe(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 ge extends W{lengths=[];closed=!1;constantSpeed=!1;color=new R(1,1,1,1);constructor(t){super(t)}copy(){let t=new ge(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),V.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class pe extends W{x=0;y=0;rotation=0;color=new R(.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*X.degRad,s=Math.cos(e),a=Math.sin(e),n=s*t.a+a*t.b,r=s*t.c+a*t.d;return X.atan2Deg(r,n)}copy(){let t=new pe(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}class xe extends U{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new R(1,1,1,1);path;region=null;sequence=null;offset=V.newFloatArray(8);uvs=V.newFloatArray(8);tempColor=new R(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,a=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*a,i=n+this.region.width*s,o=r+this.region.height*a,l=this.rotation*X.degRad,h=Math.cos(l),c=Math.sin(l),d=this.x,u=this.y,m=n*h+d,f=n*c,g=r*h+u,p=r*c,x=i*h+d,w=i*c,b=o*h+u,y=o*c,k=this.offset;k[0]=m-p,k[1]=g+f,k[2]=m-y,k[3]=b+f,k[4]=x-y,k[5]=b+w,k[6]=x-p,k[7]=g+w,90==t.degrees?(e[0]=t.u2,e[1]=t.v2,e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,a){null!=this.sequence&&this.sequence.apply(t,this);let n=t.bone,r=this.offset,i=n.worldX,o=n.worldY,l=n.a,h=n.b,c=n.c,d=n.d,u=0,m=0;u=r[0],m=r[1],e[s]=u*l+m*h+i,e[s+1]=u*c+m*d+o,s+=a,u=r[2],m=r[3],e[s]=u*l+m*h+i,e[s+1]=u*c+m*d+o,s+=a,u=r[4],m=r[5],e[s]=u*l+m*h+i,e[s+1]=u*c+m*d+o,s+=a,u=r[6],m=r[7],e[s]=u*l+m*h+i,e[s+1]=u*c+m*d+o}copy(){let t=new xe(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,V.arrayCopy(this.uvs,0,t.uvs,0,8),V.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=null!=this.sequence?this.sequence.copy():null,t}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 we{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let a=s.regions;for(let n=0,r=a.length;n<r;n++){let r=s.getPath(e,n),i=this.atlas.findRegion(r);if(null==i)throw new Error("Region not found in atlas: "+r+" (sequence: "+t+")");a[n]=i}}newRegionAttachment(t,e,s,a){let n=new xe(e,s);if(null!=a)this.loadSequence(e,s,a);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,a){let n=new fe(e,s);if(null!=a)this.loadSequence(e,s,a);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 Jt(e)}newPathAttachment(t,e){return new ge(e)}newPointAttachment(t,e){return new pe(e)}newClippingAttachment(t,e){return new Kt(e)}}class be{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=ee.Normal;skinRequired=!1;color=new R;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}}!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"}(ee||(ee={}));class ye{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=ee.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(t,e,s,a,n,r,i){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=a,this.ascaleY=n,this.ashearX=r,this.ashearY=i;let o=this.parent;if(!o){let o=this.skeleton;const l=o.scaleX,h=o.scaleY,c=(s+r)*X.degRad,d=(s+90+i)*X.degRad;return this.a=Math.cos(c)*a*l,this.b=Math.cos(d)*n*l,this.c=Math.sin(c)*a*h,this.d=Math.sin(d)*n*h,this.worldX=t*l+o.x,void(this.worldY=e*h+o.y)}let l=o.a,h=o.b,c=o.c,d=o.d;switch(this.worldX=l*t+h*e+o.worldX,this.worldY=c*t+d*e+o.worldY,this.inherit){case ee.Normal:{const t=(s+r)*X.degRad,e=(s+90+i)*X.degRad,o=Math.cos(t)*a,u=Math.cos(e)*n,m=Math.sin(t)*a,f=Math.sin(e)*n;return this.a=l*o+h*m,this.b=l*u+h*f,this.c=c*o+d*m,void(this.d=c*u+d*f)}case ee.OnlyTranslation:{const t=(s+r)*X.degRad,e=(s+90+i)*X.degRad;this.a=Math.cos(t)*a,this.b=Math.cos(e)*n,this.c=Math.sin(t)*a,this.d=Math.sin(e)*n;break}case ee.NoRotationOrReflection:{let t=l*l+c*c,e=0;t>1e-4?(t=Math.abs(l*d-h*c)/t,l/=this.skeleton.scaleX,c/=this.skeleton.scaleY,h=c*t,d=l*t,e=Math.atan2(c,l)*X.radDeg):(l=0,c=0,e=90-Math.atan2(d,h)*X.radDeg);const o=(s+r-e)*X.degRad,u=(s+i-e+90)*X.degRad,m=Math.cos(o)*a,f=Math.cos(u)*n,g=Math.sin(o)*a,p=Math.sin(u)*n;this.a=l*m-h*g,this.b=l*f-h*p,this.c=c*m+d*g,this.d=c*f+d*p;break}case ee.NoScale:case ee.NoScaleOrReflection:{s*=X.degRad;const t=Math.cos(s),e=Math.sin(s);let o=(l*t+h*e)/this.skeleton.scaleX,u=(c*t+d*e)/this.skeleton.scaleY,m=Math.sqrt(o*o+u*u);m>1e-5&&(m=1/m),o*=m,u*=m,m=Math.sqrt(o*o+u*u),this.inherit==ee.NoScale&&l*d-h*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(m=-m),s=Math.PI/2+Math.atan2(u,o);const f=Math.cos(s)*m,g=Math.sin(s)*m;r*=X.degRad,i=(90+i)*X.degRad;const p=Math.cos(r)*a,x=Math.cos(i)*n,w=Math.sin(r)*a,b=Math.sin(i)*n;this.a=o*p+f*w,this.b=o*x+f*b,this.c=u*p+g*w,this.d=u*x+g*b;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t)return this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*X.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,void(this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*X.radDeg);let e,s,a,n,r=t.a,i=t.b,o=t.c,l=t.d,h=1/(r*l-i*o),c=l*h,d=i*h,u=o*h,m=r*h,f=this.worldX-t.worldX,g=this.worldY-t.worldY;if(this.ax=f*c-g*d,this.ay=g*m-f*u,this.inherit==ee.OnlyTranslation)e=this.a,s=this.b,a=this.c,n=this.d;else{switch(this.inherit){case ee.NoRotationOrReflection:{let t=Math.abs(r*l-i*o)/(r*r+o*o),e=r/this.skeleton.scaleX;i=-(o/this.skeleton.scaleY)*t*this.skeleton.scaleX,l=e*t*this.skeleton.scaleY,h=1/(r*l-i*o),c=l*h,d=i*h;break}case ee.NoScale:case ee.NoScaleOrReflection:let t=X.cosDeg(this.rotation),e=X.sinDeg(this.rotation);r=(r*t+i*e)/this.skeleton.scaleX,o=(o*t+l*e)/this.skeleton.scaleY;let s=Math.sqrt(r*r+o*o);s>1e-5&&(s=1/s),r*=s,o*=s,s=Math.sqrt(r*r+o*o),this.inherit==ee.NoScale&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(s=-s);let a=X.PI/2+Math.atan2(o,r);i=Math.cos(a)*s,l=Math.sin(a)*s,h=1/(r*l-i*o),c=l*h,d=i*h,u=o*h,m=r*h}e=c*this.a-d*this.c,s=c*this.b-d*this.d,a=m*this.c-u*this.a,n=m*this.d-u*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(e*e+a*a),this.ascaleX>1e-4){let t=e*n-s*a;this.ascaleY=t/this.ascaleX,this.ashearY=-Math.atan2(e*s+a*n,t)*X.radDeg,this.arotation=Math.atan2(a,e)*X.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(s*s+n*n),this.ashearY=0,this.arotation=90-Math.atan2(n,s)*X.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*X.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*X.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,a=t.y-this.worldY;return t.x=s*this.d*e-a*this.b*e,t.y=a*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.worldToLocal(t)}parentToWorld(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=X.sinDeg(t),s=X.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*X.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=X.sinDeg(t),s=X.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*X.radDeg}rotateWorld(t){t*=X.degRad;const e=Math.sin(t),s=Math.cos(t),a=this.a,n=this.b;this.a=s*a-e*this.c,this.b=s*n-e*this.d,this.c=e*a+s*this.c,this.d=e*n+s*this.d}}class ke{name;order;skinRequired;constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}class ve{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(t,e="",s=new Se){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,a)=>{this.error(s,t,`Couldn't load binary ${t}: status ${e}, ${a}`)}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,(s=>{this.success(e,t,s)}),((e,a)=>{this.error(s,t,`Couldn't load text ${t}: status ${e}, ${a}`)}))}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadJson(t,(s=>{this.success(e,t,s)}),((e,a)=>{this.error(s,t,`Couldn't load JSON ${t}: status ${e}, ${a}`)}))}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 a=new Image;a.crossOrigin="anonymous",a.onload=()=>{this.success(e,t,this.textureLoader(a))},a.onerror=()=>{this.error(s,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),a.src=t}}loadTextureAtlas(t,e=()=>{},s=()=>{},a){let n=t.lastIndexOf("/"),r=n>=0?t.substring(0,n+1):"";t=this.start(t),this.downloader.downloadText(t,(n=>{try{let i=new ce(n),o=i.pages.length,l=!1;for(let n of i.pages)this.loadTexture(a?a[n.name]:r+n.name,((s,a)=>{l||(n.setTexture(a),0==--o&&this.success(e,t,i))}),((e,a)=>{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,a)=>{this.error(s,t,`Couldn't load texture atlas ${t}: status ${e}, ${a}`)}))}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}}class Se{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,a=new Uint8Array(s),n=0;n<s;n++)a[n]=e.charCodeAt(n);return a}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 a=new XMLHttpRequest;a.overrideMimeType("text/html"),a.open("GET",t,!0);let n=()=>{this.finish(t,a.status,a.responseText)};a.onload=n,a.onerror=n,a.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 a=new XMLHttpRequest;a.open("GET",t,!0),a.responseType="arraybuffer";let n=()=>{this.finish(t,a.status,a.response)};a.onload=()=>{200==a.status||0==a.status?this.finish(t,200,new Uint8Array(a.response)):n()},a.onerror=n,a.send()}start(t,e,s){let a=this.callbacks[t];try{if(a)return!0;this.callbacks[t]=a=[]}finally{a.push(e,s)}}finish(t,e,s){let a=this.callbacks[t];delete this.callbacks[t];let n=200==e||0==e?[s]:[e,s];for(let t=n.length-1,e=a.length;t<e;t+=2)a[t].apply(null,n)}}class Ae{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 Ie{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}}class Me{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 a=e.findBone(t.bones[s].name);if(!a)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(a)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(0==this.mix)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix)}}apply1(t,e,s,a,n,r,i){let o=t.parent;if(!o)throw new Error("IK bone must have parent.");let l=o.a,h=o.b,c=o.c,d=o.d,u=-t.ashearX-t.arotation,m=0,f=0;switch(t.inherit){case ee.OnlyTranslation:m=(e-t.worldX)*X.signum(t.skeleton.scaleX),f=(s-t.worldY)*X.signum(t.skeleton.scaleY);break;case ee.NoRotationOrReflection:let a=Math.abs(l*d-h*c)/Math.max(1e-4,l*l+c*c),n=l/t.skeleton.scaleX,r=c/t.skeleton.scaleY;h=-r*a*t.skeleton.scaleX,d=n*a*t.skeleton.scaleY,u+=Math.atan2(r,n)*X.radDeg;default:let i=e-o.worldX,g=s-o.worldY,p=l*d-h*c;Math.abs(p)<=1e-4?(m=0,f=0):(m=(i*d-g*h)/p-t.ax,f=(g*l-i*c)/p-t.ay)}u+=Math.atan2(f,m)*X.radDeg,t.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let g=t.ascaleX,p=t.ascaleY;if(a||n){switch(t.inherit){case ee.NoScale:case ee.NoScaleOrReflection:m=e-t.worldX,f=s-t.worldY}const o=t.data.length*g;if(o>1e-4){const t=m*m+f*f;if(a&&t<o*o||n&&t>o*o){const e=(Math.sqrt(t)/o-1)*i+1;g*=e,r&&(p*=e)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*i,g,p,t.ashearX,t.ashearY)}apply2(t,e,s,a,n,r,i,o,l){if(t.inherit!=ee.Normal||e.inherit!=ee.Normal)return;let h=t.ax,c=t.ay,d=t.ascaleX,u=t.ascaleY,m=d,f=u,g=e.ascaleX,p=0,x=0,w=0;d<0?(d=-d,p=180,w=-1):(p=0,w=1),u<0&&(u=-u,w=-w),g<0?(g=-g,x=180):x=0;let b=e.ax,y=0,k=0,v=0,S=t.a,A=t.b,I=t.c,M=t.d,C=Math.abs(d-u)<=1e-4;!C||r?(y=0,k=S*b+t.worldX,v=I*b+t.worldY):(y=e.ay,k=S*b+A*y+t.worldX,v=I*b+M*y+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");S=F.a,A=F.b,I=F.c,M=F.d;let T=S*M-A*I,E=k-F.worldX,Y=v-F.worldY;T=Math.abs(T)<=1e-4?0:1/T;let R,_,B=(E*M-Y*A)*T-h,P=(Y*S-E*I)*T-c,V=Math.sqrt(B*B+P*P),D=e.data.length*g;if(V<1e-4)return this.apply1(t,s,a,!1,r,!1,l),void e.updateWorldTransformWith(b,y,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);E=s-F.worldX,Y=a-F.worldY;let O=(E*M-Y*A)*T-h,N=(Y*S-E*I)*T-c,L=O*O+N*N;if(0!=o){o*=d*(g+1)*.5;let t=Math.sqrt(L),e=t-V-D*d+o;if(e>0){let s=Math.min(1,e/(2*o))-1;s=(e-o*(1-s*s))/t,O-=s*O,N-=s*N,L=O*O+N*N}}t:if(C){D*=d;let t=(L-V*V-D*D)/(2*V*D);t<-1?(t=-1,_=Math.PI*n):t>1?(t=1,_=0,r&&(S=(Math.sqrt(L)/(V+D)-1)*l+1,m*=S,i&&(f*=S))):_=Math.acos(t)*n,S=V+D*t,A=D*Math.sin(_),R=Math.atan2(N*S-O*A,O*S+N*A)}else{S=d*D,A=u*D;let t=S*S,e=A*A,s=Math.atan2(N,O);I=e*V*V+t*L-t*e;let a=-2*e*V,r=e-t;if(M=a*a-4*r*I,M>=0){let t=Math.sqrt(M);a<0&&(t=-t),t=.5*-(a+t);let e=t/r,i=I/t,o=Math.abs(e)<Math.abs(i)?e:i;if(o*o<=L){Y=Math.sqrt(L-o*o)*n,R=s-Math.atan2(Y,o),_=Math.atan2(Y/u,(o-V)/d);break t}}let i=X.PI,o=V-S,l=o*o,h=0,c=0,m=V+S,f=m*m,g=0;I=-S*V/(t-e),I>=-1&&I<=1&&(I=Math.acos(I),E=S*Math.cos(I)+V,Y=A*Math.sin(I),M=E*E+Y*Y,M<l&&(i=I,l=M,o=E,h=Y),M>f&&(c=I,f=M,m=E,g=Y)),L<=.5*(l+f)?(R=s-Math.atan2(h*n,o),_=i*n):(R=s-Math.atan2(g*n,m),_=c*n)}let q=Math.atan2(y,b)*w,U=t.arotation;R=(R-q)*X.radDeg+p-U,R>180?R-=360:R<-180&&(R+=360),t.updateWorldTransformWith(h,c,U+R*l,m,f,0,0),U=e.arotation,_=((_+q)*X.radDeg-e.ashearX)*w+x-U,_>180?_-=360:_<-180&&(_+=360),e.updateWorldTransformWith(b,y,U+_*l,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class Ce extends ke{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 Fe extends ke{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=se.Fixed;spacingMode=ae.Fixed;rotateMode=ne.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}}!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(se||(se={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional"}(ae||(ae={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(ne||(ne={}));class Te{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,a=t.bones.length;s<a;s++){let a=e.findBone(t.bones[s].name);if(!a)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(a)}let s=e.findSlot(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=s,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let e=this.target.getAttachment();if(!(e instanceof ge))return;let s=this.mixRotate,a=this.mixX,n=this.mixY;if(0==s&&0==a&&0==n)return;let r=this.data,i=r.rotateMode==ne.Tangent,o=r.rotateMode==ne.ChainScale,l=this.bones,h=l.length,c=i?h:h+1,d=V.setArraySize(this.spaces,c),u=o?this.lengths=V.setArraySize(this.lengths,h):[],m=this.spacing;switch(r.spacingMode){case ae.Percent:if(o)for(let t=0,e=c-1;t<e;t++){let e=l[t],s=e.data.length,a=s*e.a,n=s*e.c;u[t]=Math.sqrt(a*a+n*n)}V.arrayFill(d,1,c,m);break;case ae.Proportional:let t=0;for(let e=0,s=c-1;e<s;){let s=l[e],a=s.data.length;if(a<Te.epsilon)o&&(u[e]=0),d[++e]=m;else{let n=a*s.a,r=a*s.c,i=Math.sqrt(n*n+r*r);o&&(u[e]=i),d[++e]=i,t+=i}}if(t>0){t=c/t*m;for(let e=1;e<c;e++)d[e]*=t}break;default:let e=r.spacingMode==ae.Length;for(let t=0,s=c-1;t<s;){let s=l[t],a=s.data.length;if(a<Te.epsilon)o&&(u[t]=0),d[++t]=m;else{let n=a*s.a,r=a*s.c,i=Math.sqrt(n*n+r*r);o&&(u[t]=i),d[++t]=(e?a+m:m)*i/a}}}let f=this.computeWorldPositions(e,c,i),g=f[0],p=f[1],x=r.offsetRotation,w=!1;if(0==x)w=r.rotateMode==ne.Chain;else{w=!1;let t=this.target.bone;x*=t.a*t.d-t.b*t.c>0?X.degRad:-X.degRad}for(let t=0,e=3;t<h;t++,e+=3){let r=l[t];r.worldX+=(g-r.worldX)*a,r.worldY+=(p-r.worldY)*n;let h=f[e],c=f[e+1],m=h-g,b=c-p;if(o){let e=u[t];if(0!=e){let t=(Math.sqrt(m*m+b*b)/e-1)*s+1;r.a*=t,r.c*=t}}if(g=h,p=c,s>0){let a=r.a,n=r.b,o=r.c,l=r.d,h=0,c=0,u=0;if(h=i?f[e-1]:0==d[t+1]?f[e+2]:Math.atan2(b,m),h-=Math.atan2(o,a),w){c=Math.cos(h),u=Math.sin(h);let t=r.data.length;g+=(t*(c*a-u*o)-m)*s,p+=(t*(u*a+c*o)-b)*s}else h+=x;h>X.PI?h-=X.PI2:h<-X.PI&&(h+=X.PI2),h*=s,c=Math.cos(h),u=Math.sin(h),r.a=c*a-u*o,r.b=c*n-u*l,r.c=u*a+c*o,r.d=u*n+c*l}r.updateAppliedTransform()}}computeWorldPositions(t,e,s){let a=this.target,n=this.position,r=this.spaces,i=V.setArraySize(this.positions,3*e+2),o=this.world,l=t.closed,h=t.worldVerticesLength,c=h/6,d=Te.NONE;if(!t.constantSpeed){let u=t.lengths;c-=l?1:2;let m,f=u[c];switch(this.data.positionMode==se.Percent&&(n*=f),this.data.spacingMode){case ae.Percent:m=f;break;case ae.Proportional:m=f/e;break;default:m=1}o=V.setArraySize(this.world,8);for(let g=0,p=0,x=0;g<e;g++,p+=3){let e=r[g]*m;n+=e;let w=n;if(l)w%=f,w<0&&(w+=f),x=0;else{if(w<0){d!=Te.BEFORE&&(d=Te.BEFORE,t.computeWorldVertices(a,2,4,o,0,2)),this.addBeforePosition(w,o,0,i,p);continue}if(w>f){d!=Te.AFTER&&(d=Te.AFTER,t.computeWorldVertices(a,h-6,4,o,0,2)),this.addAfterPosition(w-f,o,0,i,p);continue}}for(;;x++){let t=u[x];if(!(w>t)){if(0==x)w/=t;else{let e=u[x-1];w=(w-e)/(t-e)}break}}x!=d&&(d=x,l&&x==c?(t.computeWorldVertices(a,h-4,4,o,0,2),t.computeWorldVertices(a,0,4,o,4,2)):t.computeWorldVertices(a,6*x+2,8,o,0,2)),this.addCurvePosition(w,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],i,p,s||g>0&&0==e)}return i}l?(h+=2,o=V.setArraySize(this.world,h),t.computeWorldVertices(a,2,h-4,o,0,2),t.computeWorldVertices(a,0,2,o,h-4,2),o[h-2]=o[0],o[h-1]=o[1]):(c--,h-=4,o=V.setArraySize(this.world,h),t.computeWorldVertices(a,2,h,o,0,2));let u,m=V.setArraySize(this.curves,c),f=0,g=o[0],p=o[1],x=0,w=0,b=0,y=0,k=0,v=0,S=0,A=0,I=0,M=0,C=0,F=0,T=0,E=0;for(let t=0,e=2;t<c;t++,e+=6)x=o[e],w=o[e+1],b=o[e+2],y=o[e+3],k=o[e+4],v=o[e+5],S=.1875*(g-2*x+b),A=.1875*(p-2*w+y),I=.09375*(3*(x-b)-g+k),M=.09375*(3*(w-y)-p+v),C=2*S+I,F=2*A+M,T=.75*(x-g)+S+.16666667*I,E=.75*(w-p)+A+.16666667*M,f+=Math.sqrt(T*T+E*E),T+=C,E+=F,C+=I,F+=M,f+=Math.sqrt(T*T+E*E),T+=C,E+=F,f+=Math.sqrt(T*T+E*E),T+=C+I,E+=F+M,f+=Math.sqrt(T*T+E*E),m[t]=f,g=k,p=v;switch(this.data.positionMode==se.Percent&&(n*=f),this.data.spacingMode){case ae.Percent:u=f;break;case ae.Proportional:u=f/e;break;default:u=1}let Y=this.segments,R=0;for(let t=0,a=0,c=0,X=0;t<e;t++,a+=3){let e=r[t]*u;n+=e;let _=n;if(l)_%=f,_<0&&(_+=f),c=0;else{if(_<0){this.addBeforePosition(_,o,0,i,a);continue}if(_>f){this.addAfterPosition(_-f,o,h-4,i,a);continue}}for(;;c++){let t=m[c];if(!(_>t)){if(0==c)_/=t;else{let e=m[c-1];_=(_-e)/(t-e)}break}}if(c!=d){d=c;let t=6*c;for(g=o[t],p=o[t+1],x=o[t+2],w=o[t+3],b=o[t+4],y=o[t+5],k=o[t+6],v=o[t+7],S=.03*(g-2*x+b),A=.03*(p-2*w+y),I=.006*(3*(x-b)-g+k),M=.006*(3*(w-y)-p+v),C=2*S+I,F=2*A+M,T=.3*(x-g)+S+.16666667*I,E=.3*(w-p)+A+.16666667*M,R=Math.sqrt(T*T+E*E),Y[0]=R,t=1;t<8;t++)T+=C,E+=F,C+=I,F+=M,R+=Math.sqrt(T*T+E*E),Y[t]=R;T+=C,E+=F,R+=Math.sqrt(T*T+E*E),Y[8]=R,T+=C+I,E+=F+M,R+=Math.sqrt(T*T+E*E),Y[9]=R,X=0}for(_*=R;;X++){let t=Y[X];if(!(_>t)){if(0==X)_/=t;else{let e=Y[X-1];_=X+(_-e)/(t-e)}break}}this.addCurvePosition(.1*_,g,p,x,w,b,y,k,v,i,a,s||t>0&&0==e)}return i}addBeforePosition(t,e,s,a,n){let r=e[s],i=e[s+1],o=e[s+2]-r,l=e[s+3]-i,h=Math.atan2(l,o);a[n]=r+t*Math.cos(h),a[n+1]=i+t*Math.sin(h),a[n+2]=h}addAfterPosition(t,e,s,a,n){let r=e[s+2],i=e[s+3],o=r-e[s],l=i-e[s+1],h=Math.atan2(l,o);a[n]=r+t*Math.cos(h),a[n+1]=i+t*Math.sin(h),a[n+2]=h}addCurvePosition(t,e,s,a,n,r,i,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,a-e));let u=t*t,m=u*t,f=1-t,g=f*f,p=g*f,x=f*t,w=3*x,b=f*w,y=w*t,k=e*p+a*b+r*y+o*m,v=s*p+n*b+i*y+l*m;h[c]=k,h[c+1]=v,d&&(h[c+2]=t<.001?Math.atan2(n-s,a-e):Math.atan2(v-(s*g+n*x*2+i*u),k-(e*g+a*x*2+r*u)))}}class Ee{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(t){const e=this.mix;if(0==e)return;const s=this.data.x>0,a=this.data.y>0,n=this.data.rotate>0||this.data.shearX>0,r=this.data.scaleX>0,i=this.bone,o=i.data.length;switch(t){case re.none:return;case re.reset:this.reset();case re.update:const t=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=t,this.lastTime=this.skeleton.time;const l=i.worldX,h=i.worldY;if(this._reset)this._reset=!1,this.ux=l,this.uy=h;else{let c=this.remaining,d=this.inertia,u=this.data.limit*t,m=this.data.step,f=this.skeleton.data.referenceScale,g=-1;if(s||a){if(s){const t=(this.ux-l)*d;this.xOffset+=t>u?u:t<-u?-u:t,this.ux=l}if(a){const t=(this.uy-h)*d;this.yOffset+=t>u?u:t<-u?-u:t,this.uy=h}if(c>=m){g=Math.pow(this.damping,60*m);const t=this.massInverse*m,e=this.strength,n=this.wind*f,r=(Xe.yDown?-this.gravity:this.gravity)*f;do{s&&(this.xVelocity+=(n-this.xOffset*e)*t,this.xOffset+=this.xVelocity*m,this.xVelocity*=g),a&&(this.yVelocity-=(r+this.yOffset*e)*t,this.yOffset+=this.yVelocity*m,this.yVelocity*=g),c-=m}while(c>=m)}s&&(i.worldX+=this.xOffset*e*this.data.x),a&&(i.worldY+=this.yOffset*e*this.data.y)}if(n||r){let t=Math.atan2(i.c,i.a),s=0,a=0,l=0,h=this.cx-i.worldX,p=this.cy-i.worldY;if(h>u?h=u:h<-u&&(h=-u),p>u?p=u:p<-u&&(p=-u),n){l=(this.data.rotate+this.data.shearX)*e;let n=Math.atan2(p+this.ty,h+this.tx)-t-this.rotateOffset*l;this.rotateOffset+=(n-Math.ceil(n*X.invPI2-.5)*X.PI2)*d,n=this.rotateOffset*l+t,s=Math.cos(n),a=Math.sin(n),r&&(n=o*i.getWorldScaleX(),n>0&&(this.scaleOffset+=(h*s+p*a)*d/n))}else{s=Math.cos(t),a=Math.sin(t);const e=o*i.getWorldScaleX();e>0&&(this.scaleOffset+=(h*s+p*a)*d/e)}if(c=this.remaining,c>=m){-1==g&&(g=Math.pow(this.damping,60*m));const e=this.massInverse*m,i=this.strength,h=this.wind,d=Xe.yDown?-this.gravity:this.gravity,u=o/f;for(;;)if(c-=m,r&&(this.scaleVelocity+=(h*s-d*a-this.scaleOffset*i)*e,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=g),n){if(this.rotateVelocity-=((h*a+d*s)*u+this.rotateOffset*i)*e,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=g,c<m)break;const n=this.rotateOffset*l+t;s=Math.cos(n),a=Math.sin(n)}else if(c<m)break}}this.remaining=c}this.cx=i.worldX,this.cy=i.worldY;break;case re.pose:s&&(i.worldX+=this.xOffset*e*this.data.x),a&&(i.worldY+=this.yOffset*e*this.data.y)}if(n){let t=this.rotateOffset*e,s=0,a=0,n=0;if(this.data.shearX>0){let e=0;this.data.rotate>0&&(e=t*this.data.rotate,s=Math.sin(e),a=Math.cos(e),n=i.b,i.b=a*n-s*i.d,i.d=s*n+a*i.d),e+=t*this.data.shearX,s=Math.sin(e),a=Math.cos(e),n=i.a,i.a=a*n-s*i.c,i.c=s*n+a*i.c}else t*=this.data.rotate,s=Math.sin(t),a=Math.cos(t),n=i.a,i.a=a*n-s*i.c,i.c=s*n+a*i.c,n=i.b,i.b=a*n-s*i.d,i.d=s*n+a*i.d}if(r){const t=1+this.scaleOffset*e*this.data.scaleX;i.a*=t,i.c*=t}t!=re.pose&&(this.tx=o*i.a,this.ty=o*i.c),i.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const a=s*X.degRad,n=Math.cos(a),r=Math.sin(a),i=this.cx-t,o=this.cy-e;this.translate(i*n-o*r-i,i*r+o*n-o)}}class Ye{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 R,this.darkColor=t.darkColor?new R:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof W&&this.attachment instanceof W&&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 Re{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new N;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 a=e.findBone(t.bones[s].name);if(!a)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(a)}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,a=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,i=0!=e||0!=s,o=this.target,l=o.a,h=o.b,c=o.c,d=o.d,u=l*d-h*c>0?X.degRad:-X.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,g=this.bones;for(let u=0,p=g.length;u<p;u++){let p=g[u];if(0!=t){let e=p.a,s=p.b,a=p.c,n=p.d,r=Math.atan2(c,l)-Math.atan2(a,e)+m;r>X.PI?r-=X.PI2:r<-X.PI&&(r+=X.PI2),r*=t;let i=Math.cos(r),o=Math.sin(r);p.a=i*e-o*a,p.b=i*s-o*n,p.c=o*e+i*a,p.d=o*s+i*n}if(i){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),p.worldX+=(t.x-p.worldX)*e,p.worldY+=(t.y-p.worldY)*s}if(0!=a){let t=Math.sqrt(p.a*p.a+p.c*p.c);0!=t&&(t=(t+(Math.sqrt(l*l+c*c)-t+this.data.offsetScaleX)*a)/t),p.a*=t,p.c*=t}if(0!=n){let t=Math.sqrt(p.b*p.b+p.d*p.d);0!=t&&(t=(t+(Math.sqrt(h*h+d*d)-t+this.data.offsetScaleY)*n)/t),p.b*=t,p.d*=t}if(r>0){let t=p.b,e=p.d,s=Math.atan2(e,t),a=Math.atan2(d,h)-Math.atan2(c,l)-(s-Math.atan2(p.c,p.a));a>X.PI?a-=X.PI2:a<-X.PI&&(a+=X.PI2),a=s+(a+f)*r;let n=Math.sqrt(t*t+e*e);p.b=Math.cos(a)*n,p.d=Math.sin(a)*n}p.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,a=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,i=0!=e||0!=s,o=this.target,l=o.a,h=o.b,c=o.c,d=o.d,u=l*d-h*c>0?X.degRad:-X.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,g=this.bones;for(let u=0,p=g.length;u<p;u++){let p=g[u];if(0!=t){let e=p.a,s=p.b,a=p.c,n=p.d,r=Math.atan2(c,l)+m;r>X.PI?r-=X.PI2:r<-X.PI&&(r+=X.PI2),r*=t;let i=Math.cos(r),o=Math.sin(r);p.a=i*e-o*a,p.b=i*s-o*n,p.c=o*e+i*a,p.d=o*s+i*n}if(i){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),p.worldX+=t.x*e,p.worldY+=t.y*s}if(0!=a){let t=(Math.sqrt(l*l+c*c)-1+this.data.offsetScaleX)*a+1;p.a*=t,p.c*=t}if(0!=n){let t=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleY)*n+1;p.b*=t,p.d*=t}if(r>0){let t=Math.atan2(d,h)-Math.atan2(c,l);t>X.PI?t-=X.PI2:t<-X.PI&&(t+=X.PI2);let e=p.b,s=p.d;t=Math.atan2(s,e)+(t-X.PI/2+f)*r;let a=Math.sqrt(e*e+s*s);p.b=Math.cos(t)*a,p.d=Math.sin(t)*a}p.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,a=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,i=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+=(i.arotation-c+this.data.offsetRotation)*t);let d=h.ax,u=h.ay;d+=(i.ax-d+this.data.offsetX)*e,u+=(i.ay-u+this.data.offsetY)*s;let m=h.ascaleX,f=h.ascaleY;0!=a&&0!=m&&(m=(m+(i.ascaleX-m+this.data.offsetScaleX)*a)/m),0!=n&&0!=f&&(f=(f+(i.ascaleY-f+this.data.offsetScaleY)*n)/f);let g=h.ashearY;0!=r&&(g+=(i.ashearY-g+this.data.offsetShearY)*r),h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,g)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,a=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,i=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation+(i.arotation+this.data.offsetRotation)*t,d=h.ax+(i.ax+this.data.offsetX)*e,u=h.ay+(i.ay+this.data.offsetY)*s,m=h.ascaleX*((i.ascaleX-1+this.data.offsetScaleX)*a+1),f=h.ascaleY*((i.ascaleY-1+this.data.offsetScaleY)*n+1),g=h.ashearY+(i.ashearY+this.data.offsetShearY)*r;h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,g)}}}class Xe{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 Xe.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,a=t.bones[e];if(a.parent){let t=this.bones[a.parent.index];s=new ye(a,this,t),t.children.push(s)}else s=new ye(a,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],a=this.bones[s.boneData.index],n=new Ye(s,a);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 Me(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new Re(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new Te(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new Ee(s,this))}this.color=new R(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,a=this.pathConstraints,n=this.physicsConstraints,r=e.length,i=s.length,o=a.length,l=this.physicsConstraints.length,h=r+i+o+l;t:for(let t=0;t<h;t++){for(let s=0;s<r;s++){let a=e[s];if(a.data.order==t){this.sortIkConstraint(a);continue t}}for(let e=0;e<i;e++){let a=s[e];if(a.data.order==t){this.sortTransformConstraint(a);continue t}}for(let e=0;e<o;e++){let s=a[e];if(s.data.order==t){this.sortPathConstraint(s);continue t}}for(let e=0;e<l;e++){const s=n[e];if(s.data.order==t){this.sortPhysicsConstraint(s);continue t}}}for(let e=0,s=t.length;e<s;e++)this.sortBone(t[e])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&V.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,a=s[0];if(this.sortBone(a),1==s.length)this._updateCache.push(t),this.sortReset(a.children);else{let e=s[s.length-1];this.sortBone(e),this._updateCache.push(t),this.sortReset(a.children),e.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&V.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,a=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,a),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,a);for(let t=0,e=this.data.skins.length;t<e;t++)this.sortPathConstraintAttachment(this.data.skins[t],s,a);let n=e.getAttachment();n instanceof ge&&this.sortPathConstraintAttachmentWith(n,a);let r=t.bones,i=r.length;for(let t=0;t<i;t++)this.sortBone(r[t]);this._updateCache.push(t);for(let t=0;t<i;t++)this.sortReset(r[t].children);for(let t=0;t<i;t++)r[t].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&V.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let e=t.bones,s=e.length;if(t.data.local)for(let t=0;t<s;t++){let s=e[t];this.sortBone(s.parent),this.sortBone(s)}else for(let t=0;t<s;t++)this.sortBone(e[t]);this._updateCache.push(t);for(let t=0;t<s;t++)this.sortReset(e[t].children);for(let t=0;t<s;t++)e[t].sorted=!0}sortPathConstraintAttachment(t,e,s){let a=t.attachments[e];if(a)for(let t in a)this.sortPathConstraintAttachmentWith(a[t],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof ge))return;let s=t.bones;if(s){let t=this.bones;for(let e=0,a=s.length;e<a;){let a=s[e++];for(a+=e;e<a;)this.sortBone(t[s[e++]])}}else this.sortBone(e)}sortPhysicsConstraint(t){const e=t.bone;t.active=e.active&&(!t.data.skinRequired||null!=this.skin&&V.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(e),this._updateCache.push(t),this.sortReset(e.children),e.sorted=!0)}sortBone(t){if(!t)return;if(t.sorted)return;let e=t.parent;e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,s=t.length;e<s;e++){let s=t[e];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(t){if(null==t)throw new Error("physics is undefined");let e=this.bones;for(let t=0,s=e.length;t<s;t++){let s=e[t];s.ax=s.x,s.ay=s.y,s.arotation=s.rotation,s.ascaleX=s.scaleX,s.ascaleY=s.scaleY,s.ashearX=s.shearX,s.ashearY=s.shearY}let s=this._updateCache;for(let e=0,a=s.length;e<a;e++)s[e].update(t)}updateWorldTransformWith(t,e){let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let a=e.a,n=e.b,r=e.c,i=e.d;s.worldX=a*this.x+n*this.y+e.worldX,s.worldY=r*this.x+i*this.y+e.worldY;const o=(s.rotation+s.shearX)*X.degRad,l=(s.rotation+90+s.shearY)*X.degRad,h=Math.cos(o)*s.scaleX,c=Math.cos(l)*s.scaleY,d=Math.sin(o)*s.scaleX,u=Math.sin(l)*s.scaleY;s.a=(a*h+n*d)*this.scaleX,s.b=(a*c+n*u)*this.scaleX,s.c=(r*h+i*d)*this.scaleY,s.d=(r*c+i*u)*this.scaleY;let m=this._updateCache;for(let e=0,a=m.length;e<a;e++){let a=m[e];a!=s&&a.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;V.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,s=t.length;e<s;e++)t[e].setToSetupPose()}getRootBone(){return 0==this.bones.length?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,a=e.length;s<a;s++){let a=e[s];if(a.data.name==t)return a}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,a=e.length;s<a;s++){let a=e[s];if(a.data.name==t)return a}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,a=e.length;s<a;s++){let a=e[s],n=a.data.attachmentName;if(n){let e=t.getAttachment(s,n);e&&a.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 a=0,n=s.length;a<n;a++){let n=s[a];if(n.data.name==t){let s=null;if(e&&(s=this.getAttachment(a,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 N,e=new N;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}}getBounds(t,e,s=new Array(2),a=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let n=this.drawOrder,r=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let t=0,e=n.length;t<e;t++){let e=n[t];if(!e.bone.active)continue;let h=0,c=null,d=null,u=e.getAttachment();if(u instanceof xe)h=8,c=V.setArraySize(s,h,0),u.computeWorldVertices(e,c,0,2),d=Xe.quadTriangles;else if(u instanceof fe){let t=u;h=t.worldVerticesLength,c=V.setArraySize(s,h,0),t.computeWorldVertices(e,0,h,c,0,2),d=t.triangles}else if(u instanceof Kt&&null!=a){a.clipStart(e,u);continue}if(c&&d){null!=a&&a.isClipping()&&(a.clipTriangles(c,d,d.length),c=a.clippedVertices,h=a.clippedVertices.length);for(let t=0,e=c.length;t<e;t+=2){let e=c[t],s=c[t+1];r=Math.min(r,e),i=Math.min(i,s),o=Math.max(o,e),l=Math.max(l,s)}}null!=a&&a.clipEndWithSlot(e)}null!=a&&a.clipEnd(),t.set(r,i),e.set(o-r,l-i)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let a=0,n=s.length;a<n;a++)s[a].translate(t,e)}physicsRotate(t,e,s){const a=this.physicsConstraints;for(let n=0,r=a.length;n<r;n++)a[n].rotate(t,e,s)}}!function(t){t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose"}(re||(re={}));class _e extends ke{_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 Be{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,a=e.length;s<a;s++){let a=e[s];if(a.name==t)return a}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,a=e.length;s<a;s++){let a=e[s];if(a.name==t)return a}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,a=e.length;s<a;s++){let a=e[s];if(a.name==t)return a}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,a=e.length;s<a;s++){let a=e[s];if(a.name==t)return a}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,a=e.length;s<a;s++){let a=e[s];if(a.name==t)return a}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,a=e.length;s<a;s++){const a=e[s];if(a.name==t)return a}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,a=e.length;s<a;s++){const a=e[s];if(a.name==t)return a}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,a=e.length;s<a;s++){const a=e[s];if(a.name==t)return a}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,a=e.length;s<a;s++){const a=e[s];if(a.name==t)return a}return null}}class Pe{slotIndex;name;attachment;constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class Ve{name;attachments=new Array;bones=Array();constraints=new Array;color=new R(.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 a=this.attachments;t>=a.length&&(a.length=t+1),a[t]||(a[t]={}),a[t][e]=s}addSkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],a=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){a=!0;break}a||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],a=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){a=!0;break}a||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],a=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){a=!0;break}a||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],a=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){a=!0;break}a||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 fe?(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 a in s){let n=s[a];n&&t.push(new Pe(e,a,n))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let a in s){let n=s[a];n&&e.push(new Pe(t,a,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let a=0;a<t.slots.length;a++){let n=t.slots[a],r=n.getAttachment();if(r&&s<e.attachments.length){let t=e.attachments[s];for(let e in t){if(r==t[e]){let t=this.getAttachment(s,e);t&&n.setAttachment(t);break}}}s++}}}class De{index=0;name;boneData;color=new R(1,1,1,1);darkColor=null;attachmentName=null;blendMode=ie.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}}!function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(ie||(ie={}));class Oe extends ke{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 Ne{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Be;s.name="";let a=new Le(t),n=a.readInt32(),r=a.readInt32();s.hash=0==r&&0==n?null:r.toString(16)+n.toString(16),s.version=a.readString(),s.x=a.readFloat(),s.y=a.readFloat(),s.width=a.readFloat(),s.height=a.readFloat(),s.referenceScale=a.readFloat()*e;let i=a.readBoolean();i&&(s.fps=a.readFloat(),s.imagesPath=a.readString(),s.audioPath=a.readString());let o=0;o=a.readInt(!0);for(let t=0;t<o;t++){let t=a.readString();if(!t)throw new Error("String in string table must not be null.");a.strings.push(t)}o=a.readInt(!0);for(let t=0;t<o;t++){let n=a.readString();if(!n)throw new Error("Bone name must not be null.");let r=0==t?null:s.bones[a.readInt(!0)],o=new be(t,n,r);o.rotation=a.readFloat(),o.x=a.readFloat()*e,o.y=a.readFloat()*e,o.scaleX=a.readFloat(),o.scaleY=a.readFloat(),o.shearX=a.readFloat(),o.shearY=a.readFloat(),o.length=a.readFloat()*e,o.inherit=a.readByte(),o.skinRequired=a.readBoolean(),i&&(R.rgba8888ToColor(o.color,a.readInt32()),o.icon=a.readString()??void 0,o.visible=a.readBoolean()),s.bones.push(o)}o=a.readInt(!0);for(let t=0;t<o;t++){let e=a.readString();if(!e)throw new Error("Slot name must not be null.");let n=s.bones[a.readInt(!0)],r=new De(t,e,n);R.rgba8888ToColor(r.color,a.readInt32());let o=a.readInt32();-1!=o&&R.rgb888ToColor(r.darkColor=new R,o),r.attachmentName=a.readStringRef(),r.blendMode=a.readInt(!0),i&&(r.visible=a.readBoolean()),s.slots.push(r)}o=a.readInt(!0);for(let t,n=0;n<o;n++){let n=a.readString();if(!n)throw new Error("IK constraint data name must not be null.");let r=new Ce(n);r.order=a.readInt(!0),t=a.readInt(!0);for(let e=0;e<t;e++)r.bones.push(s.bones[a.readInt(!0)]);r.target=s.bones[a.readInt(!0)];let i=a.readByte();r.skinRequired=!!(1&i),r.bendDirection=2&i?1:-1,r.compress=!!(4&i),r.stretch=!!(8&i),r.uniform=!!(16&i),32&i&&(r.mix=64&i?a.readFloat():1),128&i&&(r.softness=a.readFloat()*e),s.ikConstraints.push(r)}o=a.readInt(!0);for(let t,n=0;n<o;n++){let n=a.readString();if(!n)throw new Error("Transform constraint data name must not be null.");let r=new Oe(n);r.order=a.readInt(!0),t=a.readInt(!0);for(let e=0;e<t;e++)r.bones.push(s.bones[a.readInt(!0)]);r.target=s.bones[a.readInt(!0)];let i=a.readByte();r.skinRequired=!!(1&i),r.local=!!(2&i),r.relative=!!(4&i),8&i&&(r.offsetRotation=a.readFloat()),16&i&&(r.offsetX=a.readFloat()*e),32&i&&(r.offsetY=a.readFloat()*e),64&i&&(r.offsetScaleX=a.readFloat()),128&i&&(r.offsetScaleY=a.readFloat()),i=a.readByte(),1&i&&(r.offsetShearY=a.readFloat()),2&i&&(r.mixRotate=a.readFloat()),4&i&&(r.mixX=a.readFloat()),8&i&&(r.mixY=a.readFloat()),16&i&&(r.mixScaleX=a.readFloat()),32&i&&(r.mixScaleY=a.readFloat()),64&i&&(r.mixShearY=a.readFloat()),s.transformConstraints.push(r)}o=a.readInt(!0);for(let t,n=0;n<o;n++){let n=a.readString();if(!n)throw new Error("Path constraint data name must not be null.");let r=new Fe(n);r.order=a.readInt(!0),r.skinRequired=a.readBoolean(),t=a.readInt(!0);for(let e=0;e<t;e++)r.bones.push(s.bones[a.readInt(!0)]);r.target=s.slots[a.readInt(!0)];const i=a.readByte();r.positionMode=1&i,r.spacingMode=i>>1&3,r.rotateMode=i>>3&3,128&i&&(r.offsetRotation=a.readFloat()),r.position=a.readFloat(),r.positionMode==se.Fixed&&(r.position*=e),r.spacing=a.readFloat(),r.spacingMode!=ae.Length&&r.spacingMode!=ae.Fixed||(r.spacing*=e),r.mixRotate=a.readFloat(),r.mixX=a.readFloat(),r.mixY=a.readFloat(),s.pathConstraints.push(r)}o=a.readInt(!0);for(let t=0;t<o;t++){const t=a.readString();if(!t)throw new Error("Physics constraint data name must not be null.");const n=new _e(t);n.order=a.readInt(!0),n.bone=s.bones[a.readInt(!0)];let r=a.readByte();n.skinRequired=!!(1&r),2&r&&(n.x=a.readFloat()),4&r&&(n.y=a.readFloat()),8&r&&(n.rotate=a.readFloat()),16&r&&(n.scaleX=a.readFloat()),32&r&&(n.shearX=a.readFloat()),n.limit=(64&r?a.readFloat():5e3)*e,n.step=1/a.readUnsignedByte(),n.inertia=a.readFloat(),n.strength=a.readFloat(),n.damping=a.readFloat(),n.massInverse=128&r?a.readFloat():1,n.wind=a.readFloat(),n.gravity=a.readFloat(),r=a.readByte(),1&r&&(n.inertiaGlobal=!0),2&r&&(n.strengthGlobal=!0),4&r&&(n.dampingGlobal=!0),8&r&&(n.massGlobal=!0),16&r&&(n.windGlobal=!0),32&r&&(n.gravityGlobal=!0),64&r&&(n.mixGlobal=!0),n.mix=128&r?a.readFloat():1,s.physicsConstraints.push(n)}let l=this.readSkin(a,s,!0,i);l&&(s.defaultSkin=l,s.skins.push(l));{let t=s.skins.length;for(V.setArraySize(s.skins,o=t+a.readInt(!0));t<o;t++){let e=this.readSkin(a,s,!1,i);if(!e)throw new Error("readSkin() should not have returned null.");s.skins[t]=e}}o=this.linkedMeshes.length;for(let t=0;t<o;t++){let e=this.linkedMeshes[t];const a=s.skins[e.skinIndex];if(!e.parent)throw new Error("Linked mesh parent must not be null");let n=a.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,o=a.readInt(!0);for(let t=0;t<o;t++){let t=a.readString();if(!t)throw new Error("Event data name must not be null");let e=new Ie(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()),s.events.push(e)}o=a.readInt(!0);for(let t=0;t<o;t++){let t=a.readString();if(!t)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(a,t,s))}return s}readSkin(t,e,s,a){let n=null,r=0;if(s){if(r=t.readInt(!0),0==r)return null;n=new Ve("default")}else{let s=t.readString();if(!s)throw new Error("Skin name must not be null.");n=new Ve(s),a&&R.rgba8888ToColor(n.color,t.readInt32()),n.bones.length=t.readInt(!0);for(let s=0,a=n.bones.length;s<a;s++)n.bones[s]=e.bones[t.readInt(!0)];for(let s=0,a=t.readInt(!0);s<a;s++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let s=0,a=t.readInt(!0);s<a;s++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let s=0,a=t.readInt(!0);s<a;s++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let s=0,a=t.readInt(!0);s<a;s++)n.constraints.push(e.physicsConstraints[t.readInt(!0)]);r=t.readInt(!0)}for(let s=0;s<r;s++){let s=t.readInt(!0);for(let r=0,i=t.readInt(!0);r<i;r++){let r=t.readStringRef();if(!r)throw new Error("Attachment name must not be null");let i=this.readAttachment(t,e,n,s,r,a);i&&n.setAttachment(s,r,i)}}return n}readAttachment(t,e,s,a,n,r){let i=this.scale,o=t.readByte();const l=8&o?t.readStringRef():n;if(!l)throw new Error("Attachment name must not be null");switch(7&o){case oe.Region:{let e=16&o?t.readStringRef():null;const a=32&o?t.readInt32():4294967295,n=64&o?this.readSequence(t):null;let r=128&o?t.readFloat():0,h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=t.readFloat(),m=t.readFloat(),f=t.readFloat();e||(e=l);let g=this.attachmentLoader.newRegionAttachment(s,l,e,n);return g?(g.path=e,g.x=h*i,g.y=c*i,g.scaleX=d,g.scaleY=u,g.rotation=r,g.width=m*i,g.height=f*i,R.rgba8888ToColor(g.color,a),g.sequence=n,null==n&&g.updateRegion(),g):null}case oe.BoundingBox:{let e=this.readVertices(t,!!(16&o)),a=r?t.readInt32():0,n=this.attachmentLoader.newBoundingBoxAttachment(s,l);return n?(n.worldVerticesLength=e.length,n.vertices=e.vertices,n.bones=e.bones,r&&R.rgba8888ToColor(n.color,a),n):null}case oe.Mesh:{let e=16&o?t.readStringRef():l;const a=32&o?t.readInt32():4294967295,n=64&o?this.readSequence(t):null,h=t.readInt(!0),c=this.readVertices(t,!!(128&o)),d=this.readFloatArray(t,c.length,1),u=this.readShortArray(t,3*(c.length-h-2));let m=[],f=0,g=0;r&&(m=this.readShortArray(t,t.readInt(!0)),f=t.readFloat(),g=t.readFloat()),e||(e=l);let p=this.attachmentLoader.newMeshAttachment(s,l,e,n);return p?(p.path=e,R.rgba8888ToColor(p.color,a),p.bones=c.bones,p.vertices=c.vertices,p.worldVerticesLength=c.length,p.triangles=u,p.regionUVs=d,null==n&&p.updateRegion(),p.hullLength=h<<1,p.sequence=n,r&&(p.edges=m,p.width=f*i,p.height=g*i),p):null}case oe.LinkedMesh:{const e=16&o?t.readStringRef():l;if(null==e)throw new Error("Path of linked mesh must not be null");const n=32&o?t.readInt32():4294967295,h=64&o?this.readSequence(t):null,c=!!(128&o),d=t.readInt(!0),u=t.readStringRef();let m=0,f=0;r&&(m=t.readFloat(),f=t.readFloat());let g=this.attachmentLoader.newMeshAttachment(s,l,e,h);return g?(g.path=e,R.rgba8888ToColor(g.color,n),g.sequence=h,r&&(g.width=m*i,g.height=f*i),this.linkedMeshes.push(new qe(g,d,a,u,c)),g):null}case oe.Path:{const e=!!(16&o),a=!!(32&o),n=this.readVertices(t,!!(64&o)),h=V.newArray(n.length/6,0);for(let e=0,s=h.length;e<s;e++)h[e]=t.readFloat()*i;const c=r?t.readInt32():0,d=this.attachmentLoader.newPathAttachment(s,l);return d?(d.closed=e,d.constantSpeed=a,d.worldVerticesLength=n.length,d.vertices=n.vertices,d.bones=n.bones,d.lengths=h,r&&R.rgba8888ToColor(d.color,c),d):null}case oe.Point:{const e=t.readFloat(),a=t.readFloat(),n=t.readFloat(),o=r?t.readInt32():0,h=this.attachmentLoader.newPointAttachment(s,l);return h?(h.x=a*i,h.y=n*i,h.rotation=e,r&&R.rgba8888ToColor(h.color,o),h):null}case oe.Clipping:{const a=t.readInt(!0),n=this.readVertices(t,!!(16&o));let i=r?t.readInt32():0,h=this.attachmentLoader.newClippingAttachment(s,l);return h?(h.endSlot=e.slots[a],h.worldVerticesLength=n.length,h.vertices=n.vertices,h.bones=n.bones,r&&R.rgba8888ToColor(h.color,i),h):null}}return null}readSequence(t){let e=new z(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,a=t.readInt(!0),n=new Ue;if(n.length=a<<1,!e)return n.vertices=this.readFloatArray(t,n.length,s),n;let r=new Array,i=new Array;for(let e=0;e<a;e++){let e=t.readInt(!0);i.push(e);for(let a=0;a<e;a++)i.push(t.readInt(!0)),r.push(t.readFloat()*s),r.push(t.readFloat()*s),r.push(t.readFloat())}return n.vertices=V.toFloatArray(r),n.bones=i,n}readFloatArray(t,e,s){let a=new Array(e);if(1==s)for(let s=0;s<e;s++)a[s]=t.readFloat();else for(let n=0;n<e;n++)a[n]=t.readFloat()*s;return a}readShortArray(t,e){let s=new Array(e);for(let a=0;a<e;a++)s[a]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let a=new Array,n=this.scale;for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,n=t.readInt(!0);s<n;s++){let s=t.readByte(),n=t.readInt(!0),r=n-1;switch(s){case ns:{let s=new wt(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat(),t.readStringRef());a.push(s);break}case rs:{let s=t.readInt(!0),i=new mt(n,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;for(let e=0,s=0;i.setFrame(e,o,l,h,c,d),e!=r;e++){let a=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;switch(t.readByte()){case Ss:i.setStepped(e);break;case As:$e(t,i,s++,e,0,o,a,l,n,1),$e(t,i,s++,e,1,o,a,h,r,1),$e(t,i,s++,e,2,o,a,c,u,1),$e(t,i,s++,e,3,o,a,d,m,1)}o=a,l=n,h=r,c=u,d=m}a.push(i);break}case is:{let s=t.readInt(!0),i=new ft(n,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255;for(let e=0,s=0;i.setFrame(e,o,l,h,c),e!=r;e++){let a=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;switch(t.readByte()){case Ss:i.setStepped(e);break;case As:$e(t,i,s++,e,0,o,a,l,n,1),$e(t,i,s++,e,1,o,a,h,r,1),$e(t,i,s++,e,2,o,a,c,d,1)}o=a,l=n,h=r,c=d}a.push(i);break}case os:{let s=t.readInt(!0),i=new pt(n,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255;for(let e=0,s=0;i.setFrame(e,o,l,h,c,d,u,m,f),e!=r;e++){let a=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255;switch(t.readByte()){case Ss:i.setStepped(e);break;case As:$e(t,i,s++,e,0,o,a,l,n,1),$e(t,i,s++,e,1,o,a,h,r,1),$e(t,i,s++,e,2,o,a,c,g,1),$e(t,i,s++,e,3,o,a,d,p,1),$e(t,i,s++,e,4,o,a,u,x,1),$e(t,i,s++,e,5,o,a,m,w,1),$e(t,i,s++,e,6,o,a,f,b,1)}o=a,l=n,h=r,c=g,d=p,u=x,m=w,f=b}a.push(i);break}case ls:{let s=t.readInt(!0),i=new xt(n,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;for(let e=0,s=0;i.setFrame(e,o,l,h,c,d,u,m),e!=r;e++){let a=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255;switch(t.readByte()){case Ss:i.setStepped(e);break;case As:$e(t,i,s++,e,0,o,a,l,n,1),$e(t,i,s++,e,1,o,a,h,r,1),$e(t,i,s++,e,2,o,a,c,f,1),$e(t,i,s++,e,3,o,a,d,g,1),$e(t,i,s++,e,4,o,a,u,p,1),$e(t,i,s++,e,5,o,a,m,x,1)}o=a,l=n,h=r,c=f,d=g,u=p,m=x}a.push(i);break}case hs:{let s=new gt(n,t.readInt(!0),e),i=t.readFloat(),o=t.readUnsignedByte()/255;for(let e=0,a=0;s.setFrame(e,i,o),e!=r;e++){let n=t.readFloat(),r=t.readUnsignedByte()/255;switch(t.readByte()){case Ss:s.setStepped(e);break;case As:$e(t,s,a++,e,0,i,n,o,r,1)}i=n,o=r}a.push(s)}}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,r=t.readInt(!0);s<r;s++){let s=t.readByte(),r=t.readInt(!0);if(s==as){let s=new ut(r,e);for(let e=0;e<r;e++)s.setFrame(e,t.readFloat(),t.readByte());a.push(s);continue}let i=t.readInt(!0);switch(s){case Ge:a.push(We(t,new st(r,i,e),1));break;case je:a.push(ze(t,new at(r,i,e),n));break;case He:a.push(We(t,new nt(r,i,e),n));break;case Je:a.push(We(t,new rt(r,i,e),n));break;case Ke:a.push(ze(t,new it(r,i,e),1));break;case Ze:a.push(We(t,new ot(r,i,e),1));break;case Qe:a.push(We(t,new lt(r,i,e),1));break;case ts:a.push(ze(t,new ht(r,i,e),1));break;case es:a.push(We(t,new ct(r,i,e),1));break;case ss:a.push(We(t,new dt(r,i,e),1))}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),r=s-1,i=new vt(s,t.readInt(!0),e),o=t.readByte(),l=t.readFloat(),h=1&o?2&o?t.readFloat():1:0,c=4&o?t.readFloat()*n:0;for(let e=0,s=0;i.setFrame(e,l,h,c,8&o?1:-1,!!(16&o),!!(32&o)),e!=r;e++){o=t.readByte();const a=t.readFloat(),r=1&o?2&o?t.readFloat():1:0,d=4&o?t.readFloat()*n:0;64&o?i.setStepped(e):128&o&&($e(t,i,s++,e,0,l,a,h,r,1),$e(t,i,s++,e,1,l,a,c,d,n)),l=a,h=r,c=d}a.push(i)}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),n=s-1,r=new St(s,t.readInt(!0),e),i=t.readFloat(),o=t.readFloat(),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=t.readFloat();for(let e=0,s=0;r.setFrame(e,i,o,l,h,c,d,u),e!=n;e++){let a=t.readFloat(),n=t.readFloat(),m=t.readFloat(),f=t.readFloat(),g=t.readFloat(),p=t.readFloat(),x=t.readFloat();switch(t.readByte()){case Ss:r.setStepped(e);break;case As:$e(t,r,s++,e,0,i,a,o,n,1),$e(t,r,s++,e,1,i,a,l,m,1),$e(t,r,s++,e,2,i,a,h,f,1),$e(t,r,s++,e,3,i,a,c,g,1),$e(t,r,s++,e,4,i,a,d,p,1),$e(t,r,s++,e,5,i,a,u,x,1)}i=a,o=n,l=m,h=f,c=g,d=p,u=x}a.push(r)}for(let e=0,r=t.readInt(!0);e<r;e++){let e=t.readInt(!0),r=s.pathConstraints[e];for(let s=0,i=t.readInt(!0);s<i;s++){const s=t.readByte(),i=t.readInt(!0),o=t.readInt(!0);switch(s){case us:a.push(We(t,new At(i,o,e),r.positionMode==se.Fixed?n:1));break;case ms:a.push(We(t,new It(i,o,e),r.spacingMode==ae.Length||r.spacingMode==ae.Fixed?n:1));break;case fs:let s=new Mt(i,o,e),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat();for(let e=0,a=0,n=s.getFrameCount()-1;s.setFrame(e,l,h,c,d),e!=n;e++){let n=t.readFloat(),r=t.readFloat(),i=t.readFloat(),o=t.readFloat();switch(t.readByte()){case Ss:s.setStepped(e);break;case As:$e(t,s,a++,e,0,l,n,h,r,1),$e(t,s,a++,e,1,l,n,c,i,1),$e(t,s,a++,e,2,l,n,d,o,1)}l=n,h=r,c=i,d=o}a.push(s)}}}for(let e=0,s=t.readInt(!0);e<s;e++){const e=t.readInt(!0)-1;for(let s=0,n=t.readInt(!0);s<n;s++){const s=t.readByte(),n=t.readInt(!0);if(s==vs){const s=new Bt(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat());a.push(s);continue}const r=t.readInt(!0);switch(s){case gs:a.push(We(t,new Ft(n,r,e),1));break;case ps:a.push(We(t,new Tt(n,r,e),1));break;case xs:a.push(We(t,new Et(n,r,e),1));break;case ws:a.push(We(t,new Yt(n,r,e),1));break;case bs:a.push(We(t,new Rt(n,r,e),1));break;case ys:a.push(We(t,new Xt(n,r,e),1));break;case ks:a.push(We(t,new _t(n,r,e),1))}}}for(let e=0,r=t.readInt(!0);e<r;e++){let e=s.skins[t.readInt(!0)];for(let s=0,r=t.readInt(!0);s<r;s++){let s=t.readInt(!0);for(let r=0,i=t.readInt(!0);r<i;r++){let r=t.readStringRef();if(!r)throw new Error("attachmentName must not be null.");let i=e.getAttachment(s,r),o=t.readByte(),l=t.readInt(!0),h=l-1;switch(o){case cs:{let e=i,r=e.bones,o=e.vertices,c=r?o.length/3*2:o.length,d=t.readInt(!0),u=new bt(l,d,s,e),m=t.readFloat();for(let e=0,s=0;;e++){let a,i=t.readInt(!0);if(0==i)a=r?V.newFloatArray(c):o;else{a=V.newFloatArray(c);let e=t.readInt(!0);if(i+=e,1==n)for(let s=e;s<i;s++)a[s]=t.readFloat();else for(let s=e;s<i;s++)a[s]=t.readFloat()*n;if(!r)for(let t=0,e=a.length;t<e;t++)a[t]+=o[t]}if(u.setFrame(e,m,a),e==h)break;let l=t.readFloat();switch(t.readByte()){case Ss:u.setStepped(e);break;case As:$e(t,u,s++,e,0,m,l,0,1,1)}m=l}a.push(u);break}case ds:{let e=new Pt(l,s,i);for(let s=0;s<l;s++){let a=t.readFloat(),n=t.readInt32();e.setFrame(s,a,G[15&n],n>>4,t.readFloat())}a.push(e);break}}}}}let r=t.readInt(!0);if(r>0){let e=new kt(r),n=s.slots.length;for(let s=0;s<r;s++){let a=t.readFloat(),r=t.readInt(!0),i=V.newArray(n,0);for(let t=n-1;t>=0;t--)i[t]=-1;let o=V.newArray(n-r,0),l=0,h=0;for(let e=0;e<r;e++){let e=t.readInt(!0);for(;l!=e;)o[h++]=l++;i[l+t.readInt(!0)]=l++}for(;l<n;)o[h++]=l++;for(let t=n-1;t>=0;t--)-1==i[t]&&(i[t]=o[--h]);e.setFrame(s,a,i)}a.push(e)}let i=t.readInt(!0);if(i>0){let e=new yt(i);for(let a=0;a<i;a++){let n=t.readFloat(),r=s.events[t.readInt(!0)],i=new Ae(n,r);i.intValue=t.readInt(!1),i.floatValue=t.readFloat(),i.stringValue=t.readString(),null==i.stringValue&&(i.stringValue=r.stringValue),i.data.audioPath&&(i.volume=t.readFloat(),i.balance=t.readFloat()),e.setFrame(a,i)}a.push(e)}let o=0;for(let t=0,e=a.length;t<e;t++)o=Math.max(o,a[t].getDuration());return new j(e,a,o)}}class Le{strings;index;buffer;constructor(t,e=new Array,s=0,a=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=a}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 qe{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,a,n){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=a,this.inheritTimeline=n}}class Ue{bones;vertices;length;constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}}function We(t,e,s){let a=t.readFloat(),n=t.readFloat()*s;for(let r=0,i=0,o=e.getFrameCount()-1;e.setFrame(r,a,n),r!=o;r++){let o=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case Ss:e.setStepped(r);break;case As:$e(t,e,i++,r,0,a,o,n,l,s)}a=o,n=l}return e}function ze(t,e,s){let a=t.readFloat(),n=t.readFloat()*s,r=t.readFloat()*s;for(let i=0,o=0,l=e.getFrameCount()-1;e.setFrame(i,a,n,r),i!=l;i++){let l=t.readFloat(),h=t.readFloat()*s,c=t.readFloat()*s;switch(t.readByte()){case Ss:e.setStepped(i);break;case As:$e(t,e,o++,i,0,a,l,n,h,s),$e(t,e,o++,i,1,a,l,r,c,s)}a=l,n=h,r=c}return e}function $e(t,e,s,a,n,r,i,o,l,h){e.setBezier(s,a,n,r,o,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,i,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"}(oe||(oe={}));const Ge=0,je=1,He=2,Je=3,Ke=4,Ze=5,Qe=6,ts=7,es=8,ss=9,as=10,ns=0,rs=1,is=2,os=3,ls=4,hs=5,cs=0,ds=1,us=0,ms=1,fs=2,gs=0,ps=1,xs=2,ws=4,bs=5,ys=6,ks=7,vs=8,Ss=1,As=2;class Is{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new O((()=>V.newFloatArray(16)));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,a=this.polygons,n=this.polygonPool,r=t.slots,i=r.length;s.length=0,n.freeAll(a),a.length=0;for(let t=0;t<i;t++){let e=r[t];if(!e.bone.active)continue;let i=e.getAttachment();if(i instanceof Jt){let t=i;s.push(t);let r=n.obtain();r.length!=t.worldVerticesLength&&(r=V.newFloatArray(t.worldVerticesLength)),a.push(r),t.computeWorldVertices(e,0,t.worldVerticesLength,r,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,a=Number.NEGATIVE_INFINITY,n=this.polygons;for(let r=0,i=n.length;r<i;r++){let i=n[r],o=i;for(let n=0,r=i.length;n<r;n+=2){let r=o[n],i=o[n+1];t=Math.min(t,r),e=Math.min(e,i),s=Math.max(s,r),a=Math.max(a,i)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=a}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,a){let n=this.minX,r=this.minY,i=this.maxX,o=this.maxY;if(t<=n&&s<=n||e<=r&&a<=r||t>=i&&s>=i||e>=o&&a>=o)return!1;let l=(a-e)/(s-t),h=l*(n-t)+e;if(h>r&&h<o)return!0;if(h=l*(i-t)+e,h>r&&h<o)return!0;let c=(r-e)/l+t;return c>n&&c<i||(c=(o-e)/l+t,c>n&&c<i)}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 a=0,n=s.length;a<n;a++)if(this.containsPointPolygon(s[a],t,e))return this.boundingBoxes[a];return null}containsPointPolygon(t,e,s){let a=t,n=t.length,r=n-2,i=!1;for(let t=0;t<n;t+=2){let n=a[t+1],o=a[r+1];if(n<s&&o>=s||o<s&&n>=s){let l=a[t];l+(s-n)/(o-n)*(a[r]-l)<e&&(i=!i)}r=t}return i}intersectsSegment(t,e,s,a){let n=this.polygons;for(let r=0,i=n.length;r<i;r++)if(this.intersectsSegmentPolygon(n[r],t,e,s,a))return this.boundingBoxes[r];return null}intersectsSegmentPolygon(t,e,s,a,n){let r=t,i=t.length,o=e-a,l=s-n,h=e*n-s*a,c=r[i-2],d=r[i-1];for(let t=0;t<i;t+=2){let i=r[t],u=r[t+1],m=c*u-d*i,f=c-i,g=d-u,p=o*g-l*f,x=(h*f-o*m)/p;if((x>=c&&x<=i||x>=i&&x<=c)&&(x>=e&&x<=a||x>=a&&x<=e)){let t=(h*g-l*m)/p;if((t>=d&&t<=u||t>=u&&t<=d)&&(t>=s&&t<=n||t>=n&&t<=s))return!0}c=i,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}}class Ms{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new O((()=>new Array));polygonIndicesPool=new O((()=>new Array));triangulate(t){let e=t,s=t.length>>1,a=this.indicesArray;a.length=0;for(let t=0;t<s;t++)a[t]=t;let n=this.isConcaveArray;n.length=0;for(let t=0,r=s;t<r;++t)n[t]=Ms.isConcave(t,s,e,a);let r=this.triangles;for(r.length=0;s>3;){let t=s-1,i=0,o=1;for(;;){t:if(!n[i]){let r=a[t]<<1,l=a[i]<<1,h=a[o]<<1,c=e[r],d=e[r+1],u=e[l],m=e[l+1],f=e[h],g=e[h+1];for(let r=(o+1)%s;r!=t;r=(r+1)%s){if(!n[r])continue;let t=a[r]<<1,s=e[t],i=e[t+1];if(Ms.positiveArea(f,g,c,d,s,i)&&Ms.positiveArea(c,d,u,m,s,i)&&Ms.positiveArea(u,m,f,g,s,i))break t}break}if(0==o){do{if(!n[i])break;i--}while(i>0);break}t=i,i=o,o=(o+1)%s}r.push(a[(s+i-1)%s]),r.push(a[i]),r.push(a[(i+1)%s]),a.splice(i,1),n.splice(i,1),s--;let l=(s+i-1)%s,h=i==s?0:i;n[l]=Ms.isConcave(l,s,e,a),n[h]=Ms.isConcave(h,s,e,a)}return 3==s&&(r.push(a[2]),r.push(a[0]),r.push(a[1])),r}decompose(t,e){let s=t,a=this.convexPolygons;this.polygonPool.freeAll(a),a.length=0;let n=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(n),n.length=0;let r=this.polygonIndicesPool.obtain();r.length=0;let i=this.polygonPool.obtain();i.length=0;let o=-1,l=0;for(let t=0,h=e.length;t<h;t+=3){let h=e[t]<<1,c=e[t+1]<<1,d=e[t+2]<<1,u=s[h],m=s[h+1],f=s[c],g=s[c+1],p=s[d],x=s[d+1],w=!1;if(o==h){let t=i.length-4,e=Ms.winding(i[t],i[t+1],i[t+2],i[t+3],p,x),s=Ms.winding(p,x,i[0],i[1],i[2],i[3]);e==l&&s==l&&(i.push(p),i.push(x),r.push(d),w=!0)}w||(i.length>0?(a.push(i),n.push(r)):(this.polygonPool.free(i),this.polygonIndicesPool.free(r)),i=this.polygonPool.obtain(),i.length=0,i.push(u),i.push(m),i.push(f),i.push(g),i.push(p),i.push(x),r=this.polygonIndicesPool.obtain(),r.length=0,r.push(h),r.push(c),r.push(d),l=Ms.winding(u,m,f,g,p,x),o=h)}i.length>0&&(a.push(i),n.push(r));for(let t=0,e=a.length;t<e;t++){if(r=n[t],0==r.length)continue;let s=r[0],o=r[r.length-1];i=a[t];let l=i.length-4,h=i[l],c=i[l+1],d=i[l+2],u=i[l+3],m=i[0],f=i[1],g=i[2],p=i[3],x=Ms.winding(h,c,d,u,m,f);for(let l=0;l<e;l++){if(l==t)continue;let e=n[l];if(3!=e.length)continue;let w=e[0],b=e[1],y=e[2],k=a[l],v=k[k.length-2],S=k[k.length-1];if(w!=s||b!=o)continue;let A=Ms.winding(h,c,d,u,v,S),I=Ms.winding(v,S,m,f,g,p);A==x&&I==x&&(k.length=0,e.length=0,i.push(v),i.push(S),r.push(y),h=d,c=u,d=v,u=S,l=0)}}for(let t=a.length-1;t>=0;t--)i=a[t],0==i.length&&(a.splice(t,1),this.polygonPool.free(i),r=n[t],n.splice(t,1),this.polygonIndicesPool.free(r));return a}static isConcave(t,e,s,a){let n=a[(e+t-1)%e]<<1,r=a[t]<<1,i=a[(t+1)%e]<<1;return!this.positiveArea(s[n],s[n+1],s[r],s[r+1],s[i],s[i+1])}static positiveArea(t,e,s,a,n,r){return t*(r-a)+s*(e-r)+n*(a-e)>=0}static winding(t,e,s,a,n,r){let i=s-t,o=a-e;return n*o-r*i+i*e-t*o>=0?1:-1}}class Cs{triangulator=new Ms;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,a=V.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,a,0,2);let n=this.clippingPolygon;Cs.makeClockwise(n);let r=this.clippingPolygons=this.triangulator.decompose(n,this.triangulator.triangulate(n));for(let t=0,e=r.length;t<e;t++){let e=r[t];Cs.makeClockwise(e),e.push(e[0]),e.push(e[1])}return r.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return null!=this.clipAttachment}clipTriangles(t,e,s,a,n,r,i){a&&n&&r&&"boolean"==typeof i?this.clipTrianglesRender(t,e,s,a,n,r,i):this.clipTrianglesNoRender(t,e,s)}clipTrianglesNoRender(t,e,s){let a=this.clipOutput,n=this.clippedVertices,r=this.clippedTriangles,i=this.clippingPolygons,o=i.length,l=0;n.length=0,r.length=0;for(let h=0;h<s;h+=3){let s=e[h]<<1,c=t[s],d=t[s+1];s=e[h+1]<<1;let u=t[s],m=t[s+1];s=e[h+2]<<1;let f=t[s],g=t[s+1];for(let t=0;t<o;t++){let e=n.length;if(!this.clip(c,d,u,m,f,g,i[t],a)){let t=V.setArraySize(n,e+6);t[e]=c,t[e+1]=d,t[e+2]=u,t[e+3]=m,t[e+4]=f,t[e+5]=g,e=r.length;let s=V.setArraySize(r,e+3);s[e]=l,s[e+1]=l+1,s[e+2]=l+2,l+=3;break}{let t=a.length;if(0==t)continue;let s=t>>1,i=this.clipOutput,o=V.setArraySize(n,e+2*s);for(let s=0;s<t;s+=2,e+=2){let t=i[s],a=i[s+1];o[e]=t,o[e+1]=a}e=r.length;let h=V.setArraySize(r,e+3*(s-2));s--;for(let t=1;t<s;t++,e+=3)h[e]=l,h[e+1]=l+t,h[e+2]=l+t+1;l+=s+1}}}}clipTrianglesRender(t,e,s,a,n,r,i){let o=this.clipOutput,l=this.clippedVertices,h=this.clippedTriangles,c=this.clippingPolygons,d=c.length,u=i?12:8,m=0;l.length=0,h.length=0;for(let f=0;f<s;f+=3){let s=e[f]<<1,g=t[s],p=t[s+1],x=a[s],w=a[s+1];s=e[f+1]<<1;let b=t[s],y=t[s+1],k=a[s],v=a[s+1];s=e[f+2]<<1;let S=t[s],A=t[s+1],I=a[s],M=a[s+1];for(let t=0;t<d;t++){let e=l.length;if(!this.clip(g,p,b,y,S,A,c[t],o)){let t=V.setArraySize(l,e+3*u);t[e]=g,t[e+1]=p,t[e+2]=n.r,t[e+3]=n.g,t[e+4]=n.b,t[e+5]=n.a,i?(t[e+6]=x,t[e+7]=w,t[e+8]=r.r,t[e+9]=r.g,t[e+10]=r.b,t[e+11]=r.a,t[e+12]=b,t[e+13]=y,t[e+14]=n.r,t[e+15]=n.g,t[e+16]=n.b,t[e+17]=n.a,t[e+18]=k,t[e+19]=v,t[e+20]=r.r,t[e+21]=r.g,t[e+22]=r.b,t[e+23]=r.a,t[e+24]=S,t[e+25]=A,t[e+26]=n.r,t[e+27]=n.g,t[e+28]=n.b,t[e+29]=n.a,t[e+30]=I,t[e+31]=M,t[e+32]=r.r,t[e+33]=r.g,t[e+34]=r.b,t[e+35]=r.a):(t[e+6]=x,t[e+7]=w,t[e+8]=b,t[e+9]=y,t[e+10]=n.r,t[e+11]=n.g,t[e+12]=n.b,t[e+13]=n.a,t[e+14]=k,t[e+15]=v,t[e+16]=S,t[e+17]=A,t[e+18]=n.r,t[e+19]=n.g,t[e+20]=n.b,t[e+21]=n.a,t[e+22]=I,t[e+23]=M),e=h.length;let s=V.setArraySize(h,e+3);s[e]=m,s[e+1]=m+1,s[e+2]=m+2,m+=3;break}{let t=o.length;if(0==t)continue;let s=y-A,a=S-b,c=g-S,d=A-p,f=1/(s*c+a*(p-A)),C=t>>1,F=this.clipOutput,T=V.setArraySize(l,e+C*u);for(let o=0;o<t;o+=2,e+=u){let t=F[o],l=F[o+1];T[e]=t,T[e+1]=l,T[e+2]=n.r,T[e+3]=n.g,T[e+4]=n.b,T[e+5]=n.a;let h=t-S,u=l-A,m=(s*h+a*u)*f,g=(d*h+c*u)*f,p=1-m-g;T[e+6]=x*m+k*g+I*p,T[e+7]=w*m+v*g+M*p,i&&(T[e+8]=r.r,T[e+9]=r.g,T[e+10]=r.b,T[e+11]=r.a)}e=h.length;let E=V.setArraySize(h,e+3*(C-2));C--;for(let t=1;t<C;t++,e+=3)E[e]=m,E[e+1]=m+t,E[e+2]=m+t+1;m+=C+1}}}}clipTrianglesUnpacked(t,e,s,a){let n=this.clipOutput,r=this.clippedVertices,i=this.clippedUVs,o=this.clippedTriangles,l=this.clippingPolygons,h=l.length,c=0;r.length=0,i.length=0,o.length=0;for(let d=0;d<s;d+=3){let s=e[d]<<1,u=t[s],m=t[s+1],f=a[s],g=a[s+1];s=e[d+1]<<1;let p=t[s],x=t[s+1],w=a[s],b=a[s+1];s=e[d+2]<<1;let y=t[s],k=t[s+1],v=a[s],S=a[s+1];for(let t=0;t<h;t++){let e=r.length;if(!this.clip(u,m,p,x,y,k,l[t],n)){let t=V.setArraySize(r,e+6);t[e]=u,t[e+1]=m,t[e+2]=p,t[e+3]=x,t[e+4]=y,t[e+5]=k;let s=V.setArraySize(i,e+6);s[e]=f,s[e+1]=g,s[e+2]=w,s[e+3]=b,s[e+4]=v,s[e+5]=S,e=o.length;let a=V.setArraySize(o,e+3);a[e]=c,a[e+1]=c+1,a[e+2]=c+2,c+=3;break}{let t=n.length;if(0==t)continue;let s=x-k,a=y-p,l=u-y,h=k-m,d=1/(s*l+a*(m-k)),A=t>>1,I=this.clipOutput,M=V.setArraySize(r,e+2*A),C=V.setArraySize(i,e+2*A);for(let n=0;n<t;n+=2,e+=2){let t=I[n],r=I[n+1];M[e]=t,M[e+1]=r;let i=t-y,o=r-k,c=(s*i+a*o)*d,u=(h*i+l*o)*d,m=1-c-u;C[e]=f*c+w*u+v*m,C[e+1]=g*c+b*u+S*m}e=o.length;let F=V.setArraySize(o,e+3*(A-2));A--;for(let t=1;t<A;t++,e+=3)F[e]=c,F[e+1]=c+t,F[e+2]=c+t+1;c+=A+1}}}}clip(t,e,s,a,n,r,i,o){let l,h=o,c=!1;i.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(a),l.push(n),l.push(r),l.push(t),l.push(e),o.length=0;let d=i.length-4,u=i;for(let t=0;;t+=2){let e=u[t],s=u[t+1],a=e-u[t+2],n=s-u[t+3],r=o.length,i=l;for(let t=0,r=l.length-2;t<r;){let r=i[t],l=i[t+1];t+=2;let h=i[t],d=i[t+1],u=n*(e-h)>a*(s-d),m=n*(e-r)-a*(s-l);if(m>0){if(u){o.push(h),o.push(d);continue}let t=h-r,e=d-l,s=m/(t*n-e*a);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(r+t*s),o.push(l+e*s)}else if(u){let t=h-r,e=d-l,s=m/(t*n-e*a);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(r+t*s),o.push(l+e*s),o.push(h),o.push(d)}c=!0}if(r==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),t==d)break;let m=o;(o=l).length=0,l=m}if(h!=o){h.length=0;for(let t=0,e=o.length-2;t<e;t++)h[t]=o[t]}else h.length=h.length-2;return c}static makeClockwise(t){let e=t,s=t.length,a=e[s-2]*e[1]-e[0]*e[s-1],n=0,r=0,i=0,o=0;for(let t=0,l=s-3;t<l;t+=2)n=e[t],r=e[t+1],i=e[t+2],o=e[t+3],a+=n*o-i*r;if(!(a<0))for(let t=0,a=s-2,n=s>>1;t<n;t+=2){let s=e[t],n=e[t+1],r=a-t;e[t]=e[r],e[t+1]=e[r+1],e[r]=s,e[r+1]=n}}}class Fs{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Be,a="string"==typeof t?JSON.parse(t):t,n=a.skeleton;if(n&&(s.hash=n.hash,s.version=n.spine,s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.referenceScale=Xs(n,"referenceScale",100)*e,s.fps=n.fps,s.imagesPath=n.images??null,s.audioPath=n.audio??null),a.bones)for(let t=0;t<a.bones.length;t++){let n=a.bones[t],r=null,i=Xs(n,"parent",null);i&&(r=s.findBone(i));let o=new be(s.bones.length,n.name,r);o.length=Xs(n,"length",0)*e,o.x=Xs(n,"x",0)*e,o.y=Xs(n,"y",0)*e,o.rotation=Xs(n,"rotation",0),o.scaleX=Xs(n,"scaleX",1),o.scaleY=Xs(n,"scaleY",1),o.shearX=Xs(n,"shearX",0),o.shearY=Xs(n,"shearY",0),o.inherit=V.enumValue(ee,Xs(n,"inherit","Normal")),o.skinRequired=Xs(n,"skin",!1);let l=Xs(n,"color",null);l&&o.color.setFromString(l),s.bones.push(o)}if(a.slots)for(let t=0;t<a.slots.length;t++){let e=a.slots[t],n=e.name,r=s.findBone(e.bone);if(!r)throw new Error(`Couldn't find bone ${e.bone} for slot ${n}`);let i=new De(s.slots.length,n,r),o=Xs(e,"color",null);o&&i.color.setFromString(o);let l=Xs(e,"dark",null);l&&(i.darkColor=R.fromString(l)),i.attachmentName=Xs(e,"attachment",null),i.blendMode=V.enumValue(ie,Xs(e,"blend","normal")),i.visible=Xs(e,"visible",!0),s.slots.push(i)}if(a.ik)for(let t=0;t<a.ik.length;t++){let n=a.ik[t],r=new Ce(n.name);r.order=Xs(n,"order",0),r.skinRequired=Xs(n,"skin",!1);for(let t=0;t<n.bones.length;t++){let e=s.findBone(n.bones[t]);if(!e)throw new Error(`Couldn't find bone ${n.bones[t]} for IK constraint ${n.name}.`);r.bones.push(e)}let i=s.findBone(n.target);if(!i)throw new Error(`Couldn't find target bone ${n.target} for IK constraint ${n.name}.`);r.target=i,r.mix=Xs(n,"mix",1),r.softness=Xs(n,"softness",0)*e,r.bendDirection=Xs(n,"bendPositive",!0)?1:-1,r.compress=Xs(n,"compress",!1),r.stretch=Xs(n,"stretch",!1),r.uniform=Xs(n,"uniform",!1),s.ikConstraints.push(r)}if(a.transform)for(let t=0;t<a.transform.length;t++){let n=a.transform[t],r=new Oe(n.name);r.order=Xs(n,"order",0),r.skinRequired=Xs(n,"skin",!1);for(let t=0;t<n.bones.length;t++){let e=n.bones[t],a=s.findBone(e);if(!a)throw new Error(`Couldn't find bone ${e} for transform constraint ${n.name}.`);r.bones.push(a)}let i=n.target,o=s.findBone(i);if(!o)throw new Error(`Couldn't find target bone ${i} for transform constraint ${n.name}.`);r.target=o,r.local=Xs(n,"local",!1),r.relative=Xs(n,"relative",!1),r.offsetRotation=Xs(n,"rotation",0),r.offsetX=Xs(n,"x",0)*e,r.offsetY=Xs(n,"y",0)*e,r.offsetScaleX=Xs(n,"scaleX",0),r.offsetScaleY=Xs(n,"scaleY",0),r.offsetShearY=Xs(n,"shearY",0),r.mixRotate=Xs(n,"mixRotate",1),r.mixX=Xs(n,"mixX",1),r.mixY=Xs(n,"mixY",r.mixX),r.mixScaleX=Xs(n,"mixScaleX",1),r.mixScaleY=Xs(n,"mixScaleY",r.mixScaleX),r.mixShearY=Xs(n,"mixShearY",1),s.transformConstraints.push(r)}if(a.path)for(let t=0;t<a.path.length;t++){let n=a.path[t],r=new Fe(n.name);r.order=Xs(n,"order",0),r.skinRequired=Xs(n,"skin",!1);for(let t=0;t<n.bones.length;t++){let e=n.bones[t],a=s.findBone(e);if(!a)throw new Error(`Couldn't find bone ${e} for path constraint ${n.name}.`);r.bones.push(a)}let i=n.target,o=s.findSlot(i);if(!o)throw new Error(`Couldn't find target slot ${i} for path constraint ${n.name}.`);r.target=o,r.positionMode=V.enumValue(se,Xs(n,"positionMode","Percent")),r.spacingMode=V.enumValue(ae,Xs(n,"spacingMode","Length")),r.rotateMode=V.enumValue(ne,Xs(n,"rotateMode","Tangent")),r.offsetRotation=Xs(n,"rotation",0),r.position=Xs(n,"position",0),r.positionMode==se.Fixed&&(r.position*=e),r.spacing=Xs(n,"spacing",0),r.spacingMode!=ae.Length&&r.spacingMode!=ae.Fixed||(r.spacing*=e),r.mixRotate=Xs(n,"mixRotate",1),r.mixX=Xs(n,"mixX",1),r.mixY=Xs(n,"mixY",r.mixX),s.pathConstraints.push(r)}if(a.physics)for(let t=0;t<a.physics.length;t++){const n=a.physics[t],r=new _e(n.name);r.order=Xs(n,"order",0),r.skinRequired=Xs(n,"skin",!1);const i=n.bone,o=s.findBone(i);if(null==o)throw new Error("Physics bone not found: "+i);r.bone=o,r.x=Xs(n,"x",0),r.y=Xs(n,"y",0),r.rotate=Xs(n,"rotate",0),r.scaleX=Xs(n,"scaleX",0),r.shearX=Xs(n,"shearX",0),r.limit=Xs(n,"limit",5e3)*e,r.step=1/Xs(n,"fps",60),r.inertia=Xs(n,"inertia",1),r.strength=Xs(n,"strength",100),r.damping=Xs(n,"damping",1),r.massInverse=1/Xs(n,"mass",1),r.wind=Xs(n,"wind",0),r.gravity=Xs(n,"gravity",0),r.mix=Xs(n,"mix",1),r.inertiaGlobal=Xs(n,"inertiaGlobal",!1),r.strengthGlobal=Xs(n,"strengthGlobal",!1),r.dampingGlobal=Xs(n,"dampingGlobal",!1),r.massGlobal=Xs(n,"massGlobal",!1),r.windGlobal=Xs(n,"windGlobal",!1),r.gravityGlobal=Xs(n,"gravityGlobal",!1),r.mixGlobal=Xs(n,"mixGlobal",!1),s.physicsConstraints.push(r)}if(a.skins)for(let t=0;t<a.skins.length;t++){let e=a.skins[t],n=new Ve(e.name);if(e.bones)for(let t=0;t<e.bones.length;t++){let a=e.bones[t],r=s.findBone(a);if(!r)throw new Error(`Couldn't find bone ${a} for skin ${e.name}.`);n.bones.push(r)}if(e.ik)for(let t=0;t<e.ik.length;t++){let a=e.ik[t],r=s.findIkConstraint(a);if(!r)throw new Error(`Couldn't find IK constraint ${a} for skin ${e.name}.`);n.constraints.push(r)}if(e.transform)for(let t=0;t<e.transform.length;t++){let a=e.transform[t],r=s.findTransformConstraint(a);if(!r)throw new Error(`Couldn't find transform constraint ${a} for skin ${e.name}.`);n.constraints.push(r)}if(e.path)for(let t=0;t<e.path.length;t++){let a=e.path[t],r=s.findPathConstraint(a);if(!r)throw new Error(`Couldn't find path constraint ${a} for skin ${e.name}.`);n.constraints.push(r)}if(e.physics)for(let t=0;t<e.physics.length;t++){let a=e.physics[t],r=s.findPhysicsConstraint(a);if(!r)throw new Error(`Couldn't find physics constraint ${a} for skin ${e.name}.`);n.constraints.push(r)}for(let t in e.attachments){let a=s.findSlot(t);if(!a)throw new Error(`Couldn't find slot ${t} for skin ${e.name}.`);let r=e.attachments[t];for(let t in r){let e=this.readAttachment(r[t],n,a.index,t,s);e&&n.setAttachment(a.index,t,e)}}s.skins.push(n),"default"==n.name&&(s.defaultSkin=n)}for(let t=0,e=this.linkedMeshes.length;t<e;t++){let e=this.linkedMeshes[t],a=e.skin?s.findSkin(e.skin):s.defaultSkin;if(!a)throw new Error(`Skin not found: ${e.skin}`);let n=a.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],n=new Ie(t);n.intValue=Xs(e,"int",0),n.floatValue=Xs(e,"float",0),n.stringValue=Xs(e,"string",""),n.audioPath=Xs(e,"audio",null),n.audioPath&&(n.volume=Xs(e,"volume",1),n.balance=Xs(e,"balance",0)),s.events.push(n)}if(a.animations)for(let t in a.animations){let e=a.animations[t];this.readAnimation(e,t,s)}return s}readAttachment(t,e,s,a,n){let r=this.scale;switch(a=Xs(t,"name",a),Xs(t,"type","region")){case"region":{let s=Xs(t,"path",a),n=this.readSequence(Xs(t,"sequence",null)),i=this.attachmentLoader.newRegionAttachment(e,a,s,n);if(!i)return null;i.path=s,i.x=Xs(t,"x",0)*r,i.y=Xs(t,"y",0)*r,i.scaleX=Xs(t,"scaleX",1),i.scaleY=Xs(t,"scaleY",1),i.rotation=Xs(t,"rotation",0),i.width=t.width*r,i.height=t.height*r,i.sequence=n;let o=Xs(t,"color",null);return o&&i.color.setFromString(o),null!=i.region&&i.updateRegion(),i}case"boundingbox":{let s=this.attachmentLoader.newBoundingBoxAttachment(e,a);if(!s)return null;this.readVertices(t,s,t.vertexCount<<1);let n=Xs(t,"color",null);return n&&s.color.setFromString(n),s}case"mesh":case"linkedmesh":{let n=Xs(t,"path",a),i=this.readSequence(Xs(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,a,n,i);if(!o)return null;o.path=n;let l=Xs(t,"color",null);l&&o.color.setFromString(l),o.width=Xs(t,"width",0)*r,o.height=Xs(t,"height",0)*r,o.sequence=i;let h=Xs(t,"parent",null);if(h)return this.linkedMeshes.push(new Ts(o,Xs(t,"skin",null),s,h,Xs(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=Xs(t,"edges",null),o.hullLength=2*Xs(t,"hull",0),o}case"path":{let s=this.attachmentLoader.newPathAttachment(e,a);if(!s)return null;s.closed=Xs(t,"closed",!1),s.constantSpeed=Xs(t,"constantSpeed",!0);let n=t.vertexCount;this.readVertices(t,s,n<<1);let i=V.newArray(n/3,0);for(let e=0;e<t.lengths.length;e++)i[e]=t.lengths[e]*r;s.lengths=i;let o=Xs(t,"color",null);return o&&s.color.setFromString(o),s}case"point":{let s=this.attachmentLoader.newPointAttachment(e,a);if(!s)return null;s.x=Xs(t,"x",0)*r,s.y=Xs(t,"y",0)*r,s.rotation=Xs(t,"rotation",0);let n=Xs(t,"color",null);return n&&s.color.setFromString(n),s}case"clipping":{let s=this.attachmentLoader.newClippingAttachment(e,a);if(!s)return null;let r=Xs(t,"end",null);r&&(s.endSlot=n.findSlot(r));let i=t.vertexCount;this.readVertices(t,s,i<<1);let o=Xs(t,"color",null);return o&&s.color.setFromString(o),s}}return null}readSequence(t){if(null==t)return null;let e=new z(Xs(t,"count",0));return e.start=Xs(t,"start",1),e.digits=Xs(t,"digits",0),e.setupIndex=Xs(t,"setup",0),e}readVertices(t,e,s){let a=this.scale;e.worldVerticesLength=s;let n=t.vertices;if(s==n.length){let t=V.toFloatArray(n);if(1!=a)for(let e=0,s=n.length;e<s;e++)t[e]*=a;return void(e.vertices=t)}let r=new Array,i=new Array;for(let t=0,e=n.length;t<e;){let e=n[t++];i.push(e);for(let s=t+4*e;t<s;t+=4)i.push(n[t]),r.push(n[t+1]*a),r.push(n[t+2]*a),r.push(n[t+3])}e.bones=i,e.vertices=V.toFloatArray(r)}readAnimation(t,e,s){let a=this.scale,n=new Array;if(t.slots)for(let e in t.slots){let a=t.slots[e],r=s.findSlot(e);if(!r)throw new Error("Slot not found: "+e);let i=r.index;for(let t in a){let e=a[t];if(!e)continue;let s=e.length;if("attachment"==t){let t=new wt(s,i);for(let a=0;a<s;a++){let s=e[a];t.setFrame(a,Xs(s,"time",0),Xs(s,"name",null))}n.push(t)}else if("rgba"==t){let t=new mt(s,s<<2,i),a=e[0],r=Xs(a,"time",0),o=R.fromString(a.color);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b,o.a);let i=e[s+1];if(!i){t.shrink(n);break}let l=Xs(i,"time",0),h=R.fromString(i.color),c=a.curve;c&&(n=Rs(c,t,n,s,0,r,l,o.r,h.r,1),n=Rs(c,t,n,s,1,r,l,o.g,h.g,1),n=Rs(c,t,n,s,2,r,l,o.b,h.b,1),n=Rs(c,t,n,s,3,r,l,o.a,h.a,1)),r=l,o=h,a=i}n.push(t)}else if("rgb"==t){let t=new ft(s,3*s,i),a=e[0],r=Xs(a,"time",0),o=R.fromString(a.color);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b);let i=e[s+1];if(!i){t.shrink(n);break}let l=Xs(i,"time",0),h=R.fromString(i.color),c=a.curve;c&&(n=Rs(c,t,n,s,0,r,l,o.r,h.r,1),n=Rs(c,t,n,s,1,r,l,o.g,h.g,1),n=Rs(c,t,n,s,2,r,l,o.b,h.b,1)),r=l,o=h,a=i}n.push(t)}else if("alpha"==t)n.push(Es(e,new gt(s,s,i),0,1));else if("rgba2"==t){let t=new pt(s,7*s,i),a=e[0],r=Xs(a,"time",0),o=R.fromString(a.light),l=R.fromString(a.dark);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b,o.a,l.r,l.g,l.b);let i=e[s+1];if(!i){t.shrink(n);break}let h=Xs(i,"time",0),c=R.fromString(i.light),d=R.fromString(i.dark),u=a.curve;u&&(n=Rs(u,t,n,s,0,r,h,o.r,c.r,1),n=Rs(u,t,n,s,1,r,h,o.g,c.g,1),n=Rs(u,t,n,s,2,r,h,o.b,c.b,1),n=Rs(u,t,n,s,3,r,h,o.a,c.a,1),n=Rs(u,t,n,s,4,r,h,l.r,d.r,1),n=Rs(u,t,n,s,5,r,h,l.g,d.g,1),n=Rs(u,t,n,s,6,r,h,l.b,d.b,1)),r=h,o=c,l=d,a=i}n.push(t)}else if("rgb2"==t){let t=new xt(s,6*s,i),a=e[0],r=Xs(a,"time",0),o=R.fromString(a.light),l=R.fromString(a.dark);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b,l.r,l.g,l.b);let i=e[s+1];if(!i){t.shrink(n);break}let h=Xs(i,"time",0),c=R.fromString(i.light),d=R.fromString(i.dark),u=a.curve;u&&(n=Rs(u,t,n,s,0,r,h,o.r,c.r,1),n=Rs(u,t,n,s,1,r,h,o.g,c.g,1),n=Rs(u,t,n,s,2,r,h,o.b,c.b,1),n=Rs(u,t,n,s,3,r,h,l.r,d.r,1),n=Rs(u,t,n,s,4,r,h,l.g,d.g,1),n=Rs(u,t,n,s,5,r,h,l.b,d.b,1)),r=h,o=c,l=d,a=i}n.push(t)}}}if(t.bones)for(let e in t.bones){let r=t.bones[e],i=s.findBone(e);if(!i)throw new Error("Bone not found: "+e);let o=i.index;for(let t in r){let e=r[t],s=e.length;if(0!=s)if("rotate"===t)n.push(Es(e,new st(s,s,o),0,1));else if("translate"===t){let t=new at(s,s<<1,o);n.push(Ys(e,t,"x","y",0,a))}else if("translatex"===t){let t=new nt(s,s,o);n.push(Es(e,t,0,a))}else if("translatey"===t){let t=new rt(s,s,o);n.push(Es(e,t,0,a))}else if("scale"===t){let t=new it(s,s<<1,o);n.push(Ys(e,t,"x","y",1,1))}else if("scalex"===t){let t=new ot(s,s,o);n.push(Es(e,t,1,1))}else if("scaley"===t){let t=new lt(s,s,o);n.push(Es(e,t,1,1))}else if("shear"===t){let t=new ht(s,s<<1,o);n.push(Ys(e,t,"x","y",0,1))}else if("shearx"===t){let t=new ct(s,s,o);n.push(Es(e,t,0,1))}else if("sheary"===t){let t=new dt(s,s,o);n.push(Es(e,t,0,1))}else if("inherit"===t){let t=new ut(s,i.index);for(let s=0;s<e.length;s++){let a=e[s];t.setFrame(s,Xs(a,"time",0),V.enumValue(ee,Xs(a,"inherit","Normal")))}n.push(t)}}}if(t.ik)for(let e in t.ik){let r=t.ik[e],i=r[0];if(!i)continue;let o=s.findIkConstraint(e);if(!o)throw new Error("IK Constraint not found: "+e);let l=s.ikConstraints.indexOf(o),h=new vt(r.length,r.length<<1,l),c=Xs(i,"time",0),d=Xs(i,"mix",1),u=Xs(i,"softness",0)*a;for(let t=0,e=0;;t++){h.setFrame(t,c,d,u,Xs(i,"bendPositive",!0)?1:-1,Xs(i,"compress",!1),Xs(i,"stretch",!1));let s=r[t+1];if(!s){h.shrink(e);break}let n=Xs(s,"time",0),o=Xs(s,"mix",1),l=Xs(s,"softness",0)*a,m=i.curve;m&&(e=Rs(m,h,e,t,0,c,n,d,o,1),e=Rs(m,h,e,t,1,c,n,u,l,a)),c=n,d=o,u=l,i=s}n.push(h)}if(t.transform)for(let e in t.transform){let a=t.transform[e],r=a[0];if(!r)continue;let i=s.findTransformConstraint(e);if(!i)throw new Error("Transform constraint not found: "+e);let o=s.transformConstraints.indexOf(i),l=new St(a.length,6*a.length,o),h=Xs(r,"time",0),c=Xs(r,"mixRotate",1),d=Xs(r,"mixX",1),u=Xs(r,"mixY",d),m=Xs(r,"mixScaleX",1),f=Xs(r,"mixScaleY",m),g=Xs(r,"mixShearY",1);for(let t=0,e=0;;t++){l.setFrame(t,h,c,d,u,m,f,g);let s=a[t+1];if(!s){l.shrink(e);break}let n=Xs(s,"time",0),i=Xs(s,"mixRotate",1),o=Xs(s,"mixX",1),p=Xs(s,"mixY",o),x=Xs(s,"mixScaleX",1),w=Xs(s,"mixScaleY",x),b=Xs(s,"mixShearY",1),y=r.curve;y&&(e=Rs(y,l,e,t,0,h,n,c,i,1),e=Rs(y,l,e,t,1,h,n,d,o,1),e=Rs(y,l,e,t,2,h,n,u,p,1),e=Rs(y,l,e,t,3,h,n,m,x,1),e=Rs(y,l,e,t,4,h,n,f,w,1),e=Rs(y,l,e,t,5,h,n,g,b,1)),h=n,c=i,d=o,u=p,m=x,f=w,m=x,r=s}n.push(l)}if(t.path)for(let e in t.path){let r=t.path[e],i=s.findPathConstraint(e);if(!i)throw new Error("Path constraint not found: "+e);let o=s.pathConstraints.indexOf(i);for(let t in r){let e=r[t],s=e[0];if(!s)continue;let l=e.length;if("position"===t){let t=new At(l,l,o);n.push(Es(e,t,0,i.positionMode==se.Fixed?a:1))}else if("spacing"===t){let t=new It(l,l,o);n.push(Es(e,t,0,i.spacingMode==ae.Length||i.spacingMode==ae.Fixed?a:1))}else if("mix"===t){let t=new Mt(l,3*l,o),a=Xs(s,"time",0),r=Xs(s,"mixRotate",1),i=Xs(s,"mixX",1),h=Xs(s,"mixY",i);for(let n=0,o=0;;n++){t.setFrame(n,a,r,i,h);let l=e[n+1];if(!l){t.shrink(o);break}let c=Xs(l,"time",0),d=Xs(l,"mixRotate",1),u=Xs(l,"mixX",1),m=Xs(l,"mixY",u),f=s.curve;f&&(o=Rs(f,t,o,n,0,a,c,r,d,1),o=Rs(f,t,o,n,1,a,c,i,u,1),o=Rs(f,t,o,n,2,a,c,h,m,1)),a=c,r=d,i=u,h=m,s=l}n.push(t)}}}if(t.physics)for(let e in t.physics){let a=t.physics[e],r=-1;if(e.length>0){let t=s.findPhysicsConstraint(e);if(!t)throw new Error("Physics constraint not found: "+e);r=s.physicsConstraints.indexOf(t)}for(let t in a){let e=a[t],s=e[0];if(!s)continue;let i,o=e.length;if("reset"!=t){if("inertia"==t)i=new Ft(o,o,r);else if("strength"==t)i=new Tt(o,o,r);else if("damping"==t)i=new Et(o,o,r);else if("mass"==t)i=new Yt(o,o,r);else if("wind"==t)i=new Rt(o,o,r);else if("gravity"==t)i=new Xt(o,o,r);else{if("mix"!=t)continue;i=new _t(o,o,r)}n.push(Es(e,i,0,1))}else{const t=new Bt(o,r);for(let a=0;null!=s;s=e[a+1],a++)t.setFrame(a,Xs(s,"time",0));n.push(t)}}}if(t.attachments)for(let e in t.attachments){let r=t.attachments[e],i=s.findSkin(e);if(!i)throw new Error("Skin not found: "+e);for(let t in r){let e=r[t],o=s.findSlot(t);if(!o)throw new Error("Slot not found: "+t);let l=o.index;for(let t in e){let s=e[t],r=i.getAttachment(l,t);for(let t in s){let e=s[t],i=e[0];if(i)if("deform"==t){let t=r.bones,s=r.vertices,o=t?s.length/3*2:s.length,h=new bt(e.length,e.length,l,r),c=Xs(i,"time",0);for(let n=0,r=0;;n++){let l,d=Xs(i,"vertices",null);if(d){l=V.newFloatArray(o);let e=Xs(i,"offset",0);if(V.arrayCopy(d,0,l,e,d.length),1!=a)for(let t=e,s=t+d.length;t<s;t++)l[t]*=a;if(!t)for(let t=0;t<o;t++)l[t]+=s[t]}else l=t?V.newFloatArray(o):s;h.setFrame(n,c,l);let u=e[n+1];if(!u){h.shrink(r);break}let m=Xs(u,"time",0),f=i.curve;f&&(r=Rs(f,h,r,n,0,c,m,0,1,1)),c=m,i=u}n.push(h)}else if("sequence"==t){let t=new Pt(e.length,l,r),s=0;for(let a=0;a<e.length;a++){let n=Xs(i,"delay",s),r=Xs(i,"time",0),o=$[Xs(i,"mode","hold")],l=Xs(i,"index",0);t.setFrame(a,r,o,l,n),s=n,i=e[a+1]}n.push(t)}}}}}if(t.drawOrder){let e=new kt(t.drawOrder.length),a=s.slots.length,r=0;for(let n=0;n<t.drawOrder.length;n++,r++){let i=t.drawOrder[n],o=null,l=Xs(i,"offsets",null);if(l){o=V.newArray(a,-1);let t=V.newArray(a-l.length,0),e=0,n=0;for(let a=0;a<l.length;a++){let r=l[a],i=s.findSlot(r.slot);if(!i)throw new Error("Slot not found: "+i);let h=i.index;for(;e!=h;)t[n++]=e++;o[e+r.offset]=e++}for(;e<a;)t[n++]=e++;for(let e=a-1;e>=0;e--)-1==o[e]&&(o[e]=t[--n])}e.setFrame(r,Xs(i,"time",0),o)}n.push(e)}if(t.events){let e=new yt(t.events.length),a=0;for(let n=0;n<t.events.length;n++,a++){let r=t.events[n],i=s.findEvent(r.name);if(!i)throw new Error("Event not found: "+r.name);let o=new Ae(V.toSinglePrecision(Xs(r,"time",0)),i);o.intValue=Xs(r,"int",i.intValue),o.floatValue=Xs(r,"float",i.floatValue),o.stringValue=Xs(r,"string",i.stringValue),o.data.audioPath&&(o.volume=Xs(r,"volume",1),o.balance=Xs(r,"balance",0)),e.setFrame(a,o)}n.push(e)}let r=0;for(let t=0,e=n.length;t<e;t++)r=Math.max(r,n[t].getDuration());s.animations.push(new j(e,n,r))}}class Ts{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,a,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=a,this.inheritTimeline=n}}function Es(t,e,s,a){let n=t[0],r=Xs(n,"time",0),i=Xs(n,"value",s)*a,o=0;for(let l=0;;l++){e.setFrame(l,r,i);let h=t[l+1];if(!h)return e.shrink(o),e;let c=Xs(h,"time",0),d=Xs(h,"value",s)*a;n.curve&&(o=Rs(n.curve,e,o,l,0,r,c,i,d,a)),r=c,i=d,n=h}}function Ys(t,e,s,a,n,r){let i=t[0],o=Xs(i,"time",0),l=Xs(i,s,n)*r,h=Xs(i,a,n)*r,c=0;for(let d=0;;d++){e.setFrame(d,o,l,h);let u=t[d+1];if(!u)return e.shrink(c),e;let m=Xs(u,"time",0),f=Xs(u,s,n)*r,g=Xs(u,a,n)*r,p=i.curve;p&&(c=Rs(p,e,c,d,0,o,m,l,f,r),c=Rs(p,e,c,d,1,o,m,h,g,r)),o=m,l=f,h=g,i=u}}function Rs(t,e,s,a,n,r,i,o,l,h){if("stepped"==t)return e.setStepped(a),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,a,n,r,o,d,u,m,f,i,l),s+1}function Xs(t,e,s){return void 0!==t[e]?t[e]:s}var _s;function Bs(t,e,s){const a=new we(t);return"json"===s?new Fs(a).readSkeletonData(e):new Ne(a).readSkeletonData(new Uint8Array(e))}async function Ps(e,s,a){let n;const r=e.map(((e,n)=>{const r=s[n];let i=t.Texture2D;return"ktx"===r?i=t.KTX:"ktx2"===r&&(i=t.KTX2),Os(e,a,i)}));try{n=await Promise.all(r)}catch(t){throw t}return n}async function Vs(t,s){const a=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,r;try{n=await e(t,{type:"text"})}catch(e){throw new Error(`Spine Atlas: ${t} load error: ${e}`)}let i=new ce(n);const o=[];for(let t of i.pages){const e=a+t.name;o.push(Os(e,s))}try{r=await Promise.all(o)}catch(t){throw new Error(`Spine Texture: load error: ${t}`)}return i=Ds(n,r),i}function Ds(t,e){const s=new ce(t);return s.pages.forEach(((t,s)=>{const a=function(t){return new Ns(new Image,t)}(e.find((e=>e.name===t.name))||e[s]);t.setTexture(a)})),s}function Os(e,s,a=t.Texture2D){return s.resourceManager.load({url:e,type:a})}void 0===Math.fround&&(Math.fround=(_s=new Float32Array(1),function(t){return _s[0]=t,_s[0]}));class Ns extends Zt{constructor(t,e){super(t),this.texture=e,this.texture.generateMipmaps()}getImage(){return this.texture}setFilters(t,e){t===Qt.Nearest?this.texture.filterMode=s.Point:e===Qt.MipMapLinearLinear?this.texture.filterMode=s.Trilinear:this.texture.filterMode=s.Bilinear}setWraps(t,e){this.texture.wrapModeU=this._convertWrapMode(t),this.texture.wrapModeV=this._convertWrapMode(e)}dispose(){}_convertWrapMode(t){switch(t){case te.ClampToEdge:return a.Clamp;case te.Repeat:return a.Repeat;case te.MirroredRepeat:return a.Mirror;default:throw new Error("Unsupported texture wrap mode.")}}}class Ls{constructor(t,e=1){this._type=t,this._lastElementIndex=e-1;const s=this._elements=new Array(e);for(let a=0;a<e;++a)s[a]=new t}get(){return this._lastElementIndex<0?new this._type:this._elements[this._lastElementIndex--]}return(t){this._elements[++this._lastElementIndex]=t}}class qs{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:Us,One:Ws,DestinationColor:zs,Zero:$s,OneMinusSourceColor:Gs,OneMinusSourceAlpha:js}=n,{Add:Hs}=r;function Js(t,e){const s=t.renderState.blendState.targetBlendState;switch(e){case ie.Additive:s.sourceColorBlendFactor=Us,s.destinationColorBlendFactor=Ws,s.sourceAlphaBlendFactor=Ws,s.destinationAlphaBlendFactor=Ws,s.colorBlendOperation=s.alphaBlendOperation=Hs;break;case ie.Multiply:s.sourceColorBlendFactor=zs,s.destinationColorBlendFactor=$s,s.sourceAlphaBlendFactor=Ws,s.destinationAlphaBlendFactor=$s,s.colorBlendOperation=s.alphaBlendOperation=Hs;break;case ie.Screen:s.sourceColorBlendFactor=Ws,s.destinationColorBlendFactor=Gs,s.sourceAlphaBlendFactor=Ws,s.destinationAlphaBlendFactor=Gs,s.colorBlendOperation=s.alphaBlendOperation=Hs;break;default:s.sourceColorBlendFactor=Us,s.destinationColorBlendFactor=js,s.sourceAlphaBlendFactor=Ws,s.destinationAlphaBlendFactor=js,s.colorBlendOperation=s.alphaBlendOperation=Hs}}class Ks{}const Zs=1/0,Qs=-1/0;class ta{static{this.QUAD_TRIANGLES=[0,1,2,2,3,0]}static{this.VERTEX_SIZE=8}static{this.VERTEX_STRIDE=9}static{this.tempDark=new R}static{this.tempColor=new R}static{this.tempVerts=new Array(8)}static{this.tempBlendMode=null}static{this.tempTexture=null}static{this.subPrimitivePool=new Ls(i)}static{this.subRenderItemPool=new qs(Ks)}static{this.bounds=new o(new l(Zs,Zs,Zs),new l(Qs,Qs,Qs))}getMaxVertexCount(t){let e=0;const{skins:s}=t,a=s.length;for(let t=0;t<a;t+=1){const a=s[t],n=this._getSkinVertexCount(a);e=Math.max(e,n)}return e}buildPrimitive(t,e){const{useClipping:s=!0,zSpacing:a=.01}=e.setting,{_clipper:n,_separateSlots:r,_subRenderItems:i,_separateSlotTextureMap:o}=this,{bounds:l}=ta;l.min.set(Zs,Zs,Zs),l.max.set(Qs,Qs,Qs);let h=0,c=0;const d=t.drawOrder,u=d.length,{engine:m,_indices:f,_vertices:g,_subPrimitives:p}=e;let{tempVerts:x,tempTexture:w,tempBlendMode:b,subRenderItemPool:y,subPrimitivePool:k}=ta;i.length=0,y.clear();let v,S,A=e._vertices,I=0,M=0,C=ie.Normal,F=null,T=0;ta.tempBlendMode=null,ta.tempTexture=null;for(let t=0;t<u;++t){const e=d[t];if(!e.bone.active){n.clipEndWithSlot(e);continue}const l=e.getAttachment();let u=null;const m=a*t;let E=0;const Y=n.isClipping();let R=Y?2:ta.VERTEX_SIZE;if(l){switch(l.constructor){case xe:const t=l;u=t.color,E=4*R,t.computeWorldVertices(e,x,0,R),v=ta.QUAD_TRIANGLES,S=t.uvs,F=t.region.texture;break;case fe:const a=l;u=a.color,E=(a.worldVerticesLength>>1)*R,E>A.length&&(ta.tempVerts=new Array(E)),a.computeWorldVertices(e,0,a.worldVerticesLength,x,0,R),v=a.triangles,S=a.uvs,F=a.region.texture;break;case Kt:if(s){let t=l;n.clipStart(e,t)}continue;default:s&&n.clipEndWithSlot(e);continue}if(null!=F){let t,s,a,l,d=e.bone.skeleton.color,A=e.color,X=d.a*A.a*u.a,_=ta.tempColor,B=ta.tempDark;if(_.set(d.r*A.r*u.r,d.g*A.g*u.g,d.b*A.b*u.b,X),Y)n.clipTriangles(x,v,v.length,S,_,B,!1),t=n.clippedVertices,s=t.length,a=n.clippedTriangles,l=a.length;else{let e=x;const{r:n,g:r,b:i,a:o}=_;for(let t=2,s=0,a=E;t<a;t+=R,s+=2)e[t]=n,e[t+1]=r,e[t+2]=i,e[t+3]=o,e[t+4]=S[s],e[t+5]=S[s+1];t=x,s=E,a=v,l=v.length}if(0==s||0==l){n.clipEndWithSlot(e);continue}let P=h/ta.VERTEX_STRIDE,V=g,D=h,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)}h=D;let N=f;for(D=c,O=0;O<l;D++,O++)N[D]=a[O]+P;c+=l;const L=e.data,q=L.name;C=L.blendMode;const U=null!==b&&b!==L.blendMode,W=null!==w&&w!==F,z=r.get(q);if(z||U||W){if(M>0){const t=p[T];t&&T++;const e=t||k.get();e.start=I,e.count=M;const s=y.get();s.subPrimitive=e,s.texture=w,s.blendMode=b,i.push(s),I+=M,M=0}if(z){const t=o.get(q);if(t){const e=F.texture;t.filterMode=e.filterMode,t.wrapModeU=e.wrapModeU,t.wrapModeV=e.wrapModeV}const e=p[T];e&&T++;const s=e||k.get();s.start=I,s.count=l;const a=y.get();a.blendMode=C,a.subPrimitive=s,a.texture=F,a.slotName=q,i.push(a),I+=l,M=0}else M+=l}else M+=l;w=F,b=C}n.clipEndWithSlot(e)}else s&&n.clipEndWithSlot(e)}if(M>0){const t=p[T];t&&T++;const e=t||k.get();e.start=I,e.count=M;const s=y.get();s.blendMode=C,s.subPrimitive=e,s.texture=F,i.push(s),M=0}n.clipEnd();const E=p.length,Y=i.length;if(Y<E)for(let t=Y;t<E;t++){const e=p[t];k.return(e)}e._clearSubPrimitives();for(let t=0,s=Y;t<s;++t){const s=i[t],{slotName:a,blendMode:n,texture:r}=s;e._addSubPrimitive(s.subPrimitive);let l=r.texture;o.has(a)&&(l=o.get(a));const h=`${l.instanceId}_${n}`;let c=sa._materialCache.get(h);c||(c=this._createMaterialForTexture(l,m,n),sa._materialCache.set(h,c)),e.setMaterial(t,c)}e._vertexBuffer.setData(g),e._indexBuffer.setData(f)}addSeparateSlot(t){this._separateSlots.set(t,t)}addSeparateSlotTexture(t,e){this._separateSlotTextureMap.set(t,e)}_createMaterialForTexture(t,e,s){const a=sa._getDefaultMaterial(e);return a.shaderData.setTexture("material_SpineTexture",t),Js(a,s),a}_expandByPoint(t,e,s){const{bounds:{min:a,max:n}}=ta,r=Math.min(a.x,t),i=Math.min(a.y,e),o=Math.min(a.z,s),l=Math.max(n.x,t),h=Math.max(n.y,e),c=Math.max(n.z,s);a.set(r,i,o),n.set(l,h,c)}_getSkinVertexCount(t){const{attachments:e}=t;let s=0;const a=ta.QUAD_TRIANGLES.length;for(let t=0,n=e.length;t<n;t++){const n=e[t];for(let t in n){const e=n[t];if(e)if(e instanceof xe)s+=a;else{if(!(e instanceof fe))continue;s+=e.triangles.length}}}return s}constructor(){this._clipper=new Cs,this._subRenderItems=[],this._separateSlots=new Map,this._separateSlotTextureMap=new Map}}class ea extends h{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(t){super(t,c.find("galacean-spine-shader")||c.create("galacean-spine-shader",ea._spineVS,ea._spineFS));const e=this.renderState;e.blendState.targetBlendState.enabled=!0,Js(this,ie.Normal),e.depthState.writeEnabled=!1,e.rasterState.cullMode=d.Off,e.renderQueueType=u.Transparent}}class sa extends m{static{this._spineGenerator=new ta}static{this._positionVertexElement=new f("POSITION",0,g.Vector3,0)}static{this._colorVertexElement=new f("COLOR_0",12,g.Vector4,0)}static{this._uvVertexElement=new f("TEXCOORD_0",28,g.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 ea(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 Xe(e);let s=sa._animationDataCache.get(e);s||(s=new Ht(e),sa._animationDataCache.set(e,s)),this._state=new Vt(s);const a=sa._spineGenerator.getMaxVertexCount(e);this._createBuffer(a),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 ra,this.defaultState=new ia,this._subPrimitives=[],this._needResizeBuffer=!1,this._vertexCount=0;const e=new p(this._engine);this._primitive=e,e.addVertexElement(sa._positionVertexElement),e.addVertexElement(sa._colorVertexElement),e.addVertexElement(sa._uvVertexElement)}addSeparateSlot(t){this._skeleton||console.error("Skeleton not found!");this._skeleton.findSlot(t)?sa._spineGenerator.addSeparateSlot(t):console.warn(`Slot: ${t} not find.`)}_onEnable(){this._initializeDefaultState()}update(t){const{_state:e,_skeleton:s}=this;e&&s&&(e.update(t),e.apply(s),s.update(t),s.updateWorldTransform(re.update),sa._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:a,_engine:n}=this,r=n._renderElementPool.get();r.set(this.priority,this._distanceForSort);const i=n._subRenderElementPool;if(s){for(let t=0,n=s.length;t<n;t++){let n=a[t];if(!n)continue;(n.destroyed||n.shader.destroyed)&&(n=this.engine._meshMagentaMaterial);const o=i.get();o.set(this,n,e,s[t]),r.addSubRenderElement(o)}t.camera._renderPipeline.pushRenderElement(t,r)}}_updateBounds(t){this._calculateGeneratorBounds(t)}_calculateGeneratorBounds(t){const{bounds:e}=ta;o.transform(e,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:e,_primitive:s}=this;this._vertices=new Float32Array(t*ta.VERTEX_STRIDE),this._indices=new Uint16Array(t);const a=4*ta.VERTEX_STRIDE,n=new x(e,w.VertexBuffer,this._vertices,b.Dynamic),r=new x(e,w.IndexBuffer,this._indices,b.Dynamic);this._indexBuffer=r,this._vertexBuffer=n;const i=new y(n,a);this._primitive.setVertexBufferBinding(0,i);const o=new k(r,v.UInt16);s.setIndexBufferBinding(o)}_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((t=>{const e=t.shaderData.getTexture("material_SpineTexture"),s=function(t){const e=t.renderState.blendState.targetBlendState;return e.sourceColorBlendFactor===Us&&e.destinationColorBlendFactor===Ws&&e.sourceAlphaBlendFactor===Ws&&e.destinationAlphaBlendFactor===Ws&&e.colorBlendOperation===Hs&&e.alphaBlendOperation===Hs?ie.Additive:e.sourceColorBlendFactor===zs&&e.destinationColorBlendFactor===$s&&e.sourceAlphaBlendFactor===Ws&&e.destinationAlphaBlendFactor===$s&&e.colorBlendOperation===Hs&&e.alphaBlendOperation===Hs?ie.Multiply:e.sourceColorBlendFactor===Ws&&e.destinationColorBlendFactor===Gs&&e.sourceAlphaBlendFactor===Ws&&e.destinationAlphaBlendFactor===Gs&&e.colorBlendOperation===Hs&&e.alphaBlendOperation===Hs?ie.Screen:ie.Normal}(t),a=`${e.instanceId}_${s}`;sa._materialCache.delete(a)}))}_initializeDefaultState(){const{skeleton:t,state:e}=this;if(t&&e){const{animationName:s,skinName:a,loop:n,scale:r}=this.defaultState;t.scaleX=r,t.scaleY=r,"default"!==a&&(t.setSkinByName(a),t.setToSetupPose()),s&&e.setAnimation(0,s,n)}}}var aa,na;T([S],sa.prototype,"setting",void 0),T([S],sa.prototype,"defaultState",void 0),T([A],sa.prototype,"_primitive",void 0),T([A],sa.prototype,"_subPrimitives",void 0),T([A],sa.prototype,"_indexBuffer",void 0),T([A],sa.prototype,"_vertexBuffer",void 0),T([A],sa.prototype,"_vertices",void 0),T([A],sa.prototype,"_indices",void 0),T([A],sa.prototype,"_needResizeBuffer",void 0),T([A],sa.prototype,"_vertexCount",void 0),T([A],sa.prototype,"_resource",void 0),T([A],sa.prototype,"_skeleton",void 0),T([A],sa.prototype,"_state",void 0),function(t){t[t.TransformVolume=1]="TransformVolume",t[t.AnimationVolume=2]="AnimationVolume",t[t.InitialVolume=4]="InitialVolume"}(aa||(aa={})),function(t){t[t.WorldVolume=1]="WorldVolume"}(na||(na={}));class ra{constructor(t=.01,e=!0){this.zSpacing=t,this.useClipping=e}}class ia{constructor(t=1,e=!0,s=null,a="default"){this.scale=t,this.loop=e,this.animationName=s,this.skinName=a}}class oa extends I{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),sa._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 la{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,a=t.length;s<a;s++)e+=String.fromCharCode(t[s]);return decodeURIComponent(encodeURIComponent(e))}}class ha extends M{static{this.imageExtensions=["png","jpg","webp","jpeg","ktx","ktx2"]}static{this.skeletonExtensions=["skel","json","bin"]}static parseAndAssignSpineAsset(t,e,s){const{imageExtensions:a,skeletonExtensions:n}=ha,r=ha.getUrlExtension(t,e);r&&(n.includes(r)&&(s.skeletonPath=t,s.skeletonExtension=r),"atlas"===r&&(s.atlasPath=t),a.includes(r)&&(s.imagePaths.push(t),s.imageExtensions.push(r)))}static deriveAndAssignSpineAsset(t,e,s){const a=ha.getUrlExtension(t,e);if(!a)return;s.skeletonPath=t,s.skeletonExtension=a;const n=/(\.(json|bin|skel))$/;let r;if(n.test(t)&&(r=t.replace(n,"")),r){const t=r+".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,e){return new C((async s=>{let a;if(t.urls)a=await this._handleOriginAsset(t,e);else{const s=await this.request(t.url,{type:"arraybuffer"}),n=new la(new Uint8Array(s)),r=n.nextStr();a=r.startsWith("spine")?await this._handleEditorAsset(s,n,r,e):await this._handleOriginAsset(t,e,s)}s(a)}))}async _handleEditorAsset(t,e,s,a){let n,r;const i=s.startsWith("spine:skel")?"skel":"json",{engine:o}=a;if("skel"===i)r=e.nextStr(),n=e.nextImageData();else{const e=new TextDecoder("utf-8").decode(new Uint8Array(t)),{data:s,atlas:a}=JSON.parse(e);r=a.refId,n=s}const l=Bs(await a.getResourceByRef({refId:r}),n,i);return new oa(o,l)}async _handleOriginAsset(t,e,s){let{fileExtensions:a}=t.params||{},n={skeletonPath:"",skeletonExtension:"",atlasPath:"",imagePaths:[],imageExtensions:[]};const{engine:r}=e;if(s){const e=ha.verifyFileExtensions(a,!1);ha.deriveAndAssignSpineAsset(t.url,e,n);const{skeletonPath:i,atlasPath:o}=n;if(!i||!o)throw new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included.");const l=await Vs(o,r),{data:h,type:c}=this._determineSkeletonDataType(s),d=Bs(l,h,c);return new oa(r,d)}{a=ha.verifyFileExtensions(a,!0);for(let e=0;e<t.urls.length;e+=1){const s=t.urls[e],r=a&&a[e]||null;ha.parseAndAssignSpineAsset(s,r,n)}const{skeletonPath:e,atlasPath:s,imagePaths:i,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(i.length>0){let t,e;u=u.concat([this.request(s,{type:"text"}),Ps(i,l,r)]),[d,t,e]=await Promise.all(u),c=Ds(t,e)}else u.push(Vs(s,r)),[d,c]=await Promise.all(u);const m=Bs(c,d,h);return new oa(r,m)}}_determineSkeletonDataType(t){let e,s;try{const a=new TextDecoder("utf-8").decode(t);JSON.parse(a),e=a,s="json"}catch(a){e=t,s="skel"}return{data:e,type:s}}}ha=T([F("spine",["json","bin","skel"])],ha);class ca extends M{load(t,e){return new C((async s=>{const a=await this.request(t.url,{type:"text"}),{data:n,textures:r}=JSON.parse(a),i=r.map((t=>e.getResourceByRef({refId:t.refId})));s(Ds(n,await Promise.all(i)))}))}}ca=T([F("EditorSpineAtlas",["atlas"])],ca);const da="4.2.0-beta.0";M.registerClass("SpineAnimationRenderer",sa),console.log(`Galacean spine version: ${da}`);export{gt as AlphaTimeline,j as Animation,Vt as AnimationState,Lt as AnimationStateAdapter,Ht as AnimationStateData,ve as AssetManagerBase,we as AtlasAttachmentLoader,U as Attachment,wt as AttachmentTimeline,Le as BinaryInput,ie as BlendMode,ye as Bone,be as BoneData,Jt as BoundingBoxAttachment,jt as CURRENT,Kt as ClippingAttachment,R as Color,ke as ConstraintData,Q as CurveTimeline,tt as CurveTimeline1,et as CurveTimeline2,D as DebugUtils,bt as DeformTimeline,Se as Downloader,kt as DrawOrderTimeline,Ae as Event,Ie as EventData,Ot as EventQueue,yt as EventTimeline,Nt as EventType,Ut as FIRST,he as FakeTexture,zt as HOLD_FIRST,$t as HOLD_MIX,Wt as HOLD_SUBSEQUENT,Me as IkConstraint,Ce as IkConstraintData,vt as IkConstraintTimeline,ee as Inherit,ut as InheritTimeline,E as IntSet,_ as Interpolation,X as MathUtils,fe as MeshAttachment,H as MixBlend,J as MixDirection,ge as PathAttachment,Te as PathConstraint,Fe as PathConstraintData,Mt as PathConstraintMixTimeline,At as PathConstraintPositionTimeline,It as PathConstraintSpacingTimeline,re as Physics,Et as PhysicsConstraintDampingTimeline,Xt as PhysicsConstraintGravityTimeline,Ft as PhysicsConstraintInertiaTimeline,Yt as PhysicsConstraintMassTimeline,_t as PhysicsConstraintMixTimeline,Bt as PhysicsConstraintResetTimeline,Tt as PhysicsConstraintStrengthTimeline,Ct as PhysicsConstraintTimeline,Rt as PhysicsConstraintWindTimeline,pe as PointAttachment,O as Pool,se as PositionMode,B as Pow,P as PowOut,xt as RGB2Timeline,pt as RGBA2Timeline,mt as RGBATimeline,ft as RGBTimeline,xe as RegionAttachment,ne as RotateMode,st as RotateTimeline,Gt as SETUP,qt as SUBSEQUENT,it as ScaleTimeline,ot as ScaleXTimeline,lt as ScaleYTimeline,Pt as SequenceTimeline,ht as ShearTimeline,ct as ShearXTimeline,dt as ShearYTimeline,Xe as Skeleton,Ne as SkeletonBinary,Is as SkeletonBounds,Cs as SkeletonClipping,Be as SkeletonData,oa as SkeletonDataResource,Fs as SkeletonJson,Ve as Skin,Pe as SkinEntry,Ye as Slot,De as SlotData,ae as SpacingMode,sa as SpineAnimationRenderer,Y as StringSet,Zt as Texture,ce as TextureAtlas,ue as TextureAtlasPage,me as TextureAtlasRegion,Qt as TextureFilter,le as TextureRegion,te as TextureWrap,L as TimeKeeper,Z as Timeline,Dt as TrackEntry,Re as TransformConstraint,Oe as TransformConstraintData,St as TransformConstraintTimeline,at as TranslateTimeline,nt as TranslateXTimeline,rt as TranslateYTimeline,Ms as Triangulator,V as Utils,N as Vector2,W as VertexAttachment,q as WindowedMean,Ds as createTextureAtlas,da as version};
|
|
2
2
|
//# sourceMappingURL=module.js.map
|