@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.
Files changed (70) hide show
  1. package/README.md +9 -7
  2. package/dist/browser.js +1 -1
  3. package/dist/main.js +1 -1
  4. package/dist/main.js.map +1 -1
  5. package/dist/miniprogram.js +1 -1
  6. package/dist/module.js +1 -1
  7. package/dist/module.js.map +1 -1
  8. package/package.json +65 -11
  9. package/types/SpineAnimationRenderer.d.ts +213 -0
  10. package/types/SpineGenerator.d.ts +37 -0
  11. package/types/index.d.ts +6 -9
  12. package/types/loader/EditorSpineAtlasLoader.d.ts +6 -0
  13. package/types/loader/LoaderUtils.d.ts +18 -0
  14. package/types/loader/SkeletonDataResource.d.ts +12 -0
  15. package/types/loader/SpineLoader.d.ts +29 -0
  16. package/types/util/BlendMode.d.ts +4 -0
  17. package/types/util/BufferReader.d.ts +10 -0
  18. package/types/util/ClearablePool.d.ts +8 -0
  19. package/types/util/ReturnablePool.d.ts +8 -0
  20. package/types/SpineAnimation.d.ts +0 -45
  21. package/types/SpineLoader.d.ts +0 -33
  22. package/types/SpineRenderer.d.ts +0 -38
  23. package/types/core/MeshGenerator.d.ts +0 -42
  24. package/types/core/SpineMesh.d.ts +0 -11
  25. package/types/spine-core/Animation.d.ts +0 -378
  26. package/types/spine-core/AnimationState.d.ts +0 -365
  27. package/types/spine-core/AnimationStateData.d.ts +0 -23
  28. package/types/spine-core/AssetManager.d.ts +0 -36
  29. package/types/spine-core/AtlasAttachmentLoader.d.ts +0 -23
  30. package/types/spine-core/BlendMode.d.ts +0 -7
  31. package/types/spine-core/Bone.d.ts +0 -110
  32. package/types/spine-core/BoneData.d.ts +0 -44
  33. package/types/spine-core/ConstraintData.d.ts +0 -7
  34. package/types/spine-core/Event.d.ts +0 -16
  35. package/types/spine-core/EventData.d.ts +0 -13
  36. package/types/spine-core/IkConstraint.d.ts +0 -38
  37. package/types/spine-core/IkConstraintData.d.ts +0 -26
  38. package/types/spine-core/PathConstraint.d.ts +0 -46
  39. package/types/spine-core/PathConstraintData.d.ts +0 -52
  40. package/types/spine-core/SharedAssetManager.d.ts +0 -19
  41. package/types/spine-core/Skeleton.d.ts +0 -134
  42. package/types/spine-core/SkeletonBinary.d.ts +0 -49
  43. package/types/spine-core/SkeletonBounds.d.ts +0 -48
  44. package/types/spine-core/SkeletonClipping.d.ts +0 -22
  45. package/types/spine-core/SkeletonData.d.ts +0 -89
  46. package/types/spine-core/SkeletonJson.d.ts +0 -34
  47. package/types/spine-core/Skin.d.ts +0 -43
  48. package/types/spine-core/Slot.d.ts +0 -42
  49. package/types/spine-core/SlotData.d.ts +0 -23
  50. package/types/spine-core/Texture.d.ts +0 -46
  51. package/types/spine-core/TextureAtlas.d.ts +0 -30
  52. package/types/spine-core/TransformConstraint.d.ts +0 -36
  53. package/types/spine-core/TransformConstraintData.d.ts +0 -34
  54. package/types/spine-core/Triangulator.d.ts +0 -14
  55. package/types/spine-core/Updatable.d.ts +0 -9
  56. package/types/spine-core/Utils.d.ts +0 -124
  57. package/types/spine-core/VertexEffect.d.ts +0 -7
  58. package/types/spine-core/attachments/Attachment.d.ts +0 -43
  59. package/types/spine-core/attachments/AttachmentLoader.d.ts +0 -25
  60. package/types/spine-core/attachments/AttachmentType.d.ts +0 -9
  61. package/types/spine-core/attachments/BoundingBoxAttachment.d.ts +0 -12
  62. package/types/spine-core/attachments/ClippingAttachment.d.ts +0 -14
  63. package/types/spine-core/attachments/MeshAttachment.d.ts +0 -46
  64. package/types/spine-core/attachments/PathAttachment.d.ts +0 -19
  65. package/types/spine-core/attachments/PointAttachment.d.ts +0 -20
  66. package/types/spine-core/attachments/RegionAttachment.d.ts +0 -88
  67. package/types/spine-core/polyfills.d.ts +0 -3
  68. package/types/spine-core/vertexeffects/JitterEffect.d.ts +0 -11
  69. package/types/spine-core/vertexeffects/SwirlEffect.d.ts +0 -16
  70. package/types/types.d.ts +0 -4
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@galacean/engine/dist/miniprogram"),e=require("@galacean/engine-miniprogram-adapter");function n(t,e){return n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(t,e)}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}function a(t,e,n,r){var a,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(s=(i<3?a(s):i>3?a(e,n,s):a(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function l(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}"function"==typeof SuppressedError&&SuppressedError;var h,u,c=function(){function t(t){this._texture=t}return t.filterFromString=function(t){switch(t.toLowerCase()){case"nearest":return 9728;case"linear":return 9729;case"mipmap":case"mipmaplinearlinear":return 9987;case"mipmapnearestnearest":return 9984;case"mipmaplinearnearest":return 9985;case"mipmapnearestlinear":return 9986;default:throw new Error("Unknown texture filter "+t)}},t.wrapFromString=function(t){switch(t.toLowerCase()){case"mirroredtepeat":return 33648;case"clamptoedge":return 33071;case"repeat":return 10497;default:throw new Error("Unknown texture wrap "+t)}},s(t,[{key:"width",get:function(){return this._texture.width}},{key:"height",get:function(){return this._texture.height}},{key:"texture",get:function(){return this._texture}}]),t}();!function(t){t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear"}(h||(h={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(u||(u={}));var d=function(){this.u=0,this.v=0,this.u2=0,this.v2=0,this.width=0,this.height=0,this.rotate=!1,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0},f=function(t){function e(){return t.apply(this,arguments)}r(e,t);var n=e.prototype;return n.setFilters=function(t,e){},n.setWraps=function(t,e){},n.dispose=function(){},e}(c),p=function(){function t(t,e){this.pages=new Array,this.regions=new Array,this.load(t,e)}var e=t.prototype;return e.load=function(t,e){if(null==e)throw new Error("textureLoader cannot be null.");for(var n=new v(t),r=new Array(4),a=null;;){var i=n.readLine();if(null==i)break;if(0==(i=i.trim()).length)a=null;else if(a){var s=new m;s.name=i,s.page=a;var o=n.readValue();"true"==o.toLocaleLowerCase()?s.degrees=90:"false"==o.toLocaleLowerCase()?s.degrees=0:s.degrees=parseFloat(o),s.rotate=90==s.degrees,n.readTuple(r);var l=parseInt(r[0]),h=parseInt(r[1]);n.readTuple(r);var d=parseInt(r[0]),f=parseInt(r[1]);s.u=l/a.width,s.v=h/a.height,s.rotate?(s.u2=(l+f)/a.width,s.v2=(h+d)/a.height):(s.u2=(l+d)/a.width,s.v2=(h+f)/a.height),s.x=l,s.y=h,s.width=Math.abs(d),s.height=Math.abs(f),4==n.readTuple(r)&&4==n.readTuple(r)&&n.readTuple(r),s.originalWidth=parseInt(r[0]),s.originalHeight=parseInt(r[1]),n.readTuple(r),s.offsetX=parseInt(r[0]),s.offsetY=parseInt(r[1]),s.index=parseInt(n.readValue()),s.texture=a.texture,this.regions.push(s)}else{(a=new g).name=i,2==n.readTuple(r)&&(a.width=parseInt(r[0]),a.height=parseInt(r[1]),n.readTuple(r)),n.readTuple(r),a.minFilter=c.filterFromString(r[0]),a.magFilter=c.filterFromString(r[1]);var p=n.readValue();a.uWrap=u.ClampToEdge,a.vWrap=u.ClampToEdge,"x"==p?a.uWrap=u.Repeat:"y"==p?a.vWrap=u.Repeat:"xy"==p&&(a.uWrap=a.vWrap=u.Repeat),a.texture=e(i),a.texture.setFilters(a.minFilter,a.magFilter),a.texture.setWraps(a.uWrap,a.vWrap),a.width=a.texture.width,a.height=a.texture.height,this.pages.push(a)}}},e.findRegion=function(t){for(var e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null},e.dispose=function(){for(var t=0;t<this.pages.length;t++)this.pages[t].texture.dispose()},t}(),v=function(){function t(t){this.index=0,this.lines=t.split(/\r\n|\r|\n/)}var e=t.prototype;return e.readLine=function(){return this.index>=this.lines.length?null:this.lines[this.index++]},e.readValue=function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw new Error("Invalid line: "+t);return t.substring(e+1).trim()},e.readTuple=function(t){var e=this.readLine(),n=e.indexOf(":");if(-1==n)throw new Error("Invalid line: "+e);for(var r=0,a=n+1;r<3;r++){var i=e.indexOf(",",a);if(-1==i)break;t[r]=e.substr(a,i-a).trim(),a=i+1}return t[r]=e.substring(a).trim(),r+1},t}(),g=function(){},m=function(t){function e(){return t.apply(this,arguments)}return r(e,t),e}(d),w=function(){function 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.request(e,{type:"text"}).then((function(t){n(t)})).catch((function(t){r(t)}))},r.downloadBinary=function(t,n,r){var a=new e.XMLHttpRequest;this.rawDataUris[t]&&(t=this.rawDataUris[t]),a.open("GET",t,!0),a.responseType="arraybuffer",a.onload=function(){200==a.status?n(new Uint8Array(a.response)):r(a.status,a.responseText)},a.onerror=function(){r(a.status,a.responseText)},a.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,n,r){void 0===n&&(n=null),void 0===r&&(r=null);var a=this,i=t=this.pathPrefix+t;this.toLoad++;var s=new e.Image;s.crossOrigin="anonymous",s.onload=function(e){a.assets[i]=s,a.onLoad(),a.loaded++,n&&n(t,s)},s.onerror=function(e){a.errors[t]="Couldn't load image "+t,a.onLoad(),a.loaded++,r&&r("Couldn't load image "+t)},this.rawDataUris[t]&&(t=this.rawDataUris[t]),s.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.request(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(e,n,r){void 0===n&&(n=null),void 0===r&&(r=null);var a=this,i=e.lastIndexOf("/")>=0?e.substring(0,e.lastIndexOf("/")):"";e=this.pathPrefix+e,this.toLoad++,this.downloadText(e,(function(s){var o=function(){var t=d.value,o=!1;a.loadTexture(t,(function(t,l){if(h.count++,h.count==u.length)if(o)a.errors[e]="Couldn't load texture atlas page "+t+"} of atlas "+e,r&&r("Couldn't load texture atlas page "+t+" of atlas "+e),a.onLoad(),a.loaded++;else try{var c=new p(s,(function(t){return a.get(""==i?t:i+"/"+t)}));a.assets[e]=c,n&&n(e,c),a.onLoad(),a.loaded++}catch(t){var d=t;a.errors[e]="Couldn't load texture atlas "+e+": "+d.message,r&&r("Couldn't load texture atlas "+e+": "+d.message),a.onLoad(),a.loaded++}}),(function(t){o=!0,h.count++,h.count==u.length&&(a.errors[e]="Couldn't load texture atlas page "+t+"} of atlas "+e,r&&r("Couldn't load texture atlas page "+t+" of atlas "+e),a.onLoad(),a.loaded++)}))},h={count:0},u=new Array;try{new p(s,(function(e){return u.push(""==i?e:i+"/"+e),new f(new t.Texture2D(a.engine,16,16))}))}catch(t){var c=t;return a.errors[e]="Couldn't load texture atlas "+e+": "+c.message,r&&r("Couldn't load texture atlas "+e+": "+c.message),a.onLoad(),void a.loaded++}for(var d,v=l(u);!(d=v()).done;)o()}),(function(t){a.errors[e]="Couldn't load texture atlas "+e+": "+JSON.stringify(t),r&&r("Couldn't load texture atlas "+e+": "+JSON.stringify(t)),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},s(n,[{key:"engine",get:function(){return this._engine}}]),n}();var x=function(){function t(){this.array=new Array}var e=t.prototype;return e.add=function(t){var e=this.contains(t);return this.array[0|t]=0|t,!e},e.contains=function(t){return null!=this.array[0|t]},e.remove=function(t){this.array[0|t]=void 0},e.clear=function(){this.array.length=0},t}(),E=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=n,this.a=r}var e=t.prototype;return e.set=function(t,e,n,r){return this.r=t,this.g=e,this.b=n,this.a=r,this.clamp(),this},e.setFromColor=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.setFromString=function(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=(8!=t.length?255:parseInt(t.substr(6,2),16))/255,this},e.add=function(t,e,n,r){return this.r+=t,this.g+=e,this.b+=n,this.a+=r,this.clamp(),this},e.clamp=function(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this},t.rgba8888ToColor=function(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255},t.rgb888ToColor=function(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255},t}();E.WHITE=new E(1,1,1,1),E.RED=new E(1,0,0,1),E.GREEN=new E(0,1,0,1),E.BLUE=new E(0,0,1,1),E.MAGENTA=new E(1,0,1,1);var y=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}();y.PI=3.1415927,y.PI2=2*y.PI,y.radiansToDegrees=180/y.PI,y.radDeg=y.radiansToDegrees,y.degreesToRadians=y.PI/180,y.degRad=y.degreesToRadians;var b=function(){function t(){}return t.arrayCopy=function(t,e,n,r,a){for(var i=e,s=r;i<e+a;i++,s++)n[s]=t[i]},t.setArraySize=function(t,e,n){void 0===n&&(n=0);var r=t.length;if(r==e)return t;if(t.length=e,r<e)for(var a=r;a<e;a++)t[a]=n;return t},t.ensureArrayCapacity=function(e,n,r){return void 0===r&&(r=0),e.length>=n?e:t.setArraySize(e,n,r)},t.newArray=function(t,e){for(var n=new Array(t),r=0;r<t;r++)n[r]=e;return n},t.newFloatArray=function(e){if(t.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);for(var n=new Array(e),r=0;r<n.length;r++)n[r]=0;return n},t.newShortArray=function(e){if(t.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);for(var n=new Array(e),r=0;r<n.length;r++)n[r]=0;return n},t.toFloatArray=function(e){return t.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e},t.toSinglePrecision=function(e){return t.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e},t.webkit602BugfixHelper=function(t,e){},t.contains=function(t,e,n){for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1},t}();b.SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;var S=function(){function t(t){this.items=new Array,this.instantiator=t}var e=t.prototype;return e.obtain=function(){return this.items.length>0?this.items.pop():this.instantiator()},e.free=function(t){t.reset&&t.reset(),this.items.push(t)},e.freeAll=function(t){for(var e=0;e<t.length;e++)this.free(t[e])},e.clear=function(){this.items.length=0},t}(),M=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.length=function(){var t=this.x,e=this.y;return Math.sqrt(t*t+e*e)},e.normalize=function(){var t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this},t}(),A=function(t){if(null==t)throw new Error("name cannot be null.");this.name=t},R=function(t){function e(n){var r;return(r=t.call(this,n)||this).id=(65535&e.nextID++)<<11,r.worldVerticesLength=0,r.deformAttachment=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(r),r}r(e,t);var n=e.prototype;return n.computeWorldVertices=function(t,e,n,r,a,i){n=a+(n>>1)*i;var s=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(null!=h){for(var u=0,c=0,d=0;d<e;d+=2){var f=h[u];u+=f+1,c+=f}var p=s.bones;if(0==o.length)for(var v=a,g=3*c;v<n;v+=i){var m=0,w=0,x=h[u++];for(x+=u;u<x;u++,g+=3){var E=p[h[u]],y=l[g],b=l[g+1],S=l[g+2];m+=(y*E.a+b*E.b+E.worldX)*S,w+=(y*E.c+b*E.d+E.worldY)*S}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,C=0,_=h[u++];for(_+=u;u<_;u++,R+=3,T+=2){var k=p[h[u]],V=l[R]+M[T],P=l[R+1]+M[T+1],F=l[R+2];I+=(V*k.a+P*k.b+k.worldX)*F,C+=(V*k.c+P*k.d+k.worldY)*F}r[A]=I,r[A+1]=C}}else{o.length>0&&(l=o);for(var N=t.bone,B=N.worldX,O=N.worldY,L=N.a,X=N.b,D=N.c,Y=N.d,U=e,W=a;W<n;U+=2,W+=i){var q=l[U],H=l[U+1];r[W]=q*L+H*X+B,r[W+1]=q*D+H*Y+O}}},n.copyTo=function(t){null!=this.bones?(t.bones=new Array(this.bones.length),b.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,null!=this.vertices?(t.vertices=b.newFloatArray(this.vertices.length),b.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment},e}(A);R.nextID=0;var T=function(t){function e(e){var n;return(n=t.call(this,e)||this).x=0,n.y=0,n.scaleX=1,n.scaleY=1,n.rotation=0,n.width=0,n.height=0,n.color=new E(1,1,1,1),n.offset=b.newFloatArray(8),n.uvs=b.newFloatArray(8),n.tempColor=new E(1,1,1,1),n}r(e,t);var n=e.prototype;return n.updateOffset=function(){var t=this.width/this.region.originalWidth*this.scaleX,n=this.height/this.region.originalHeight*this.scaleY,r=-this.width/2*this.scaleX+this.region.offsetX*t,a=-this.height/2*this.scaleY+this.region.offsetY*n,i=r+this.region.width*t,s=a+this.region.height*n,o=this.rotation*Math.PI/180,l=Math.cos(o),h=Math.sin(o),u=r*l+this.x,c=r*h,d=a*l+this.y,f=a*h,p=i*l+this.x,v=i*h,g=s*l+this.y,m=s*h,w=this.offset;w[e.OX1]=u-f,w[e.OY1]=d+c,w[e.OX2]=u-m,w[e.OY2]=g+c,w[e.OX3]=p-m,w[e.OY3]=g+v,w[e.OX4]=p-f,w[e.OY4]=d+v},n.setRegion=function(t){this.region=t;var e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)},n.computeWorldVertices=function(t,n,r,a){var i=this.offset,s=t.worldX,o=t.worldY,l=t.a,h=t.b,u=t.c,c=t.d,d=0,f=0;d=i[e.OX1],f=i[e.OY1],n[r]=d*l+f*h+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX2],f=i[e.OY2],n[r]=d*l+f*h+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX3],f=i[e.OY3],n[r]=d*l+f*h+s,n[r+1]=d*u+f*c+o,r+=a,d=i[e.OX4],f=i[e.OY4],n[r]=d*l+f*h+s,n[r+1]=d*u+f*c+o},n.copy=function(){var t=new e(this.name);return t.region=this.region,t.rendererObject=this.rendererObject,t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,b.arrayCopy(this.uvs,0,t.uvs,0,8),b.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t},e}(A);function I(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}T.OX1=0,T.OY1=1,T.OX2=2,T.OY2=3,T.OX3=4,T.OY3=5,T.OX4=6,T.OY4=7,T.X1=0,T.Y1=1,T.C1R=2,T.C1G=3,T.C1B=4,T.C1A=5,T.U1=6,T.V1=7,T.X2=8,T.Y2=9,T.C2R=10,T.C2G=11,T.C2B=12,T.C2A=13,T.U2=14,T.V2=15,T.X3=16,T.Y3=17,T.C3R=18,T.C3G=19,T.C3B=20,T.C3A=21,T.U3=22,T.V3=23,T.X4=24,T.Y4=25,T.C4R=26,T.C4G=27,T.C4B=28,T.C4A=29,T.U4=30,T.V4=31;var C,_=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new E(1,1,1,1),n.tempColor=new E(0,0,0,0),n}r(e,t);var n=e.prototype;return n.updateUVs=function(){var t=this.regionUVs;null!=this.uvs&&this.uvs.length==t.length||(this.uvs=b.newFloatArray(t.length));var e=this.uvs,n=this.uvs.length,r=this.region.u,a=this.region.v,i=0,s=0;if(I(this.region,m)){var o=this.region,l=o.texture.width,h=o.texture.height;switch(o.degrees){case 90:r-=(o.originalHeight-o.offsetY-o.height)/l,a-=(o.originalWidth-o.offsetX-o.width)/h,i=o.originalHeight/l,s=o.originalWidth/h;for(var u=0;u<n;u+=2)e[u]=r+t[u+1]*i,e[u+1]=a+(1-t[u])*s;return;case 180:r-=(o.originalWidth-o.offsetX-o.width)/l,a-=o.offsetY/h,i=o.originalWidth/l,s=o.originalHeight/h;for(var c=0;c<n;c+=2)e[c]=r+(1-t[c])*i,e[c+1]=a+(1-t[c+1])*s;return;case 270:r-=o.offsetY/l,a-=o.offsetX/h,i=o.originalHeight/l,s=o.originalWidth/h;for(var d=0;d<n;d+=2)e[d]=r+(1-t[d+1])*i,e[d+1]=a+t[d]*s;return}r-=o.offsetX/l,a-=(o.originalHeight-o.offsetY-o.height)/h,i=o.originalWidth/l,s=o.originalHeight/h}else null==this.region?(r=a=0,i=s=1):(i=this.region.u2-r,s=this.region.v2-a);for(var f=0;f<n;f+=2)e[f]=r+t[f]*i,e[f+1]=a+t[f+1]*s},n.getParentMesh=function(){return this.parentMesh},n.setParentMesh=function(t){this.parentMesh=t,null!=t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)},n.copy=function(){if(null!=this.parentMesh)return this.newLinkedMesh();var t=new e(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),b.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),b.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),b.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,null!=this.edges&&(t.edges=new Array(this.edges.length),b.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t},n.newLinkedMesh=function(){var t=new e(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),t.deformAttachment=this.deformAttachment,t.setParentMesh(null!=this.parentMesh?this.parentMesh:this),t.updateUVs(),t},e}(R),k=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new E(1,1,1,1),n}return r(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t},e}(R),V=function(t){function e(e){var n;return(n=t.call(this,e)||this).closed=!1,n.constantSpeed=!1,n.color=new E(1,1,1,1),n}return r(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),b.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t},e}(R),P=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new E(.38,.94,0,1),n.name=e,n}r(e,t);var n=e.prototype;return n.computeWorldPosition=function(t,e){return e.x=this.x*t.a+this.y*t.b+t.worldX,e.y=this.x*t.c+this.y*t.d+t.worldY,e},n.computeWorldRotation=function(t){var e=y.cosDeg(this.rotation),n=y.sinDeg(this.rotation),r=e*t.a+n*t.b,a=e*t.c+n*t.d;return Math.atan2(a,r)*y.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}(R),F=function(t){function e(e){var n;return(n=t.call(this,e)||this).color=new E(.2275,.2275,.8078,1),n}return r(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t},e}(R),N=function(){function t(t){this.atlas=t}var e=t.prototype;return e.newRegionAttachment=function(t,e,n){var r=this.atlas.findRegion(n);if(null==r)throw new Error("Region not found in atlas: "+n+" (region attachment: "+e+")");r.renderObject=r;var a=new T(e);return a.setRegion(r),a},e.newMeshAttachment=function(t,e,n){var r=this.atlas.findRegion(n);if(null==r)throw new Error("Region not found in atlas: "+n+" (mesh attachment: "+e+")");r.renderObject=r;var a=new _(e);return a.region=r,a},e.newBoundingBoxAttachment=function(t,e){return new k(e)},e.newPathAttachment=function(t,e){return new V(e)},e.newPointAttachment=function(t,e){return new P(e)},e.newClippingAttachment=function(t,e){return new F(e)},t}(),B=function(){function t(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}var e=t.prototype;return e.findBone=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findBoneIndex=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1},e.findSlot=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findSlotIndex=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1},e.findSkin=function(t){if(null==t)throw new Error("skinName cannot be null.");for(var e=this.skins,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findEvent=function(t){if(null==t)throw new Error("eventDataName cannot be null.");for(var e=this.events,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findAnimation=function(t){if(null==t)throw new Error("animationName cannot be null.");for(var e=this.animations,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findIkConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.ikConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findTransformConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.transformConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findPathConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.pathConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.name==t)return a}return null},e.findPathConstraintIndex=function(t){if(null==t)throw new Error("pathConstraintName cannot be null.");for(var e=this.pathConstraints,n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1},t}(),O=function(t,e,n){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=0,this.skinRequired=!1,this.color=new E,t<0)throw new Error("index must be >= 0.");if(null==e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=n};!function(t){t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection"}(C||(C={}));var L,X,D,Y=function(t,e,n){if(this.color=new E(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(null==e)throw new Error("name cannot be null.");if(null==n)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=n},U=function(t,e,n){this.name=t,this.order=e,this.skinRequired=n},W=function(t){function e(e){var n;return(n=t.call(this,e,0,!1)||this).bones=new Array,n.bendDirection=1,n.compress=!1,n.stretch=!1,n.uniform=!1,n.mix=1,n.softness=0,n}return r(e,t),e}(U),q=function(t){function e(e){var n;return(n=t.call(this,e,0,!1)||this).bones=new Array,n.rotateMix=0,n.translateMix=0,n.scaleMix=0,n.shearMix=0,n.offsetRotation=0,n.offsetX=0,n.offsetY=0,n.offsetScaleX=0,n.offsetScaleY=0,n.offsetShearY=0,n.relative=!1,n.local=!1,n}return r(e,t),e}(U),H=function(t){function e(e){var n;return(n=t.call(this,e,0,!1)||this).bones=new Array,n}return r(e,t),e}(U);!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(L||(L={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent"}(X||(X={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(D||(D={}));var G,j,z,Z=function(t,e,n){this.slotIndex=t,this.name=e,this.attachment=n},Q=function(){function t(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,null==t)throw new Error("name cannot be null.");this.name=t}var e=t.prototype;return e.setAttachment=function(t,e,n){if(null==n)throw new Error("attachment cannot be null.");var r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=n},e.addSkin=function(t){for(var e=0;e<t.bones.length;e++){for(var n=t.bones[e],r=!1,a=0;a<this.bones.length;a++)if(this.bones[a]==n){r=!0;break}r||this.bones.push(n)}for(var i=0;i<t.constraints.length;i++){for(var s=t.constraints[i],o=!1,l=0;l<this.constraints.length;l++)if(this.constraints[l]==s){o=!0;break}o||this.constraints.push(s)}for(var h=t.getAttachments(),u=0;u<h.length;u++){var c=h[u];this.setAttachment(c.slotIndex,c.name,c.attachment)}},e.copySkin=function(t){for(var e=0;e<t.bones.length;e++){for(var n=t.bones[e],r=!1,a=0;a<this.bones.length;a++)if(this.bones[a]==n){r=!0;break}r||this.bones.push(n)}for(var i=0;i<t.constraints.length;i++){for(var s=t.constraints[i],o=!1,l=0;l<this.constraints.length;l++)if(this.constraints[l]==s){o=!0;break}o||this.constraints.push(s)}for(var h=t.getAttachments(),u=0;u<h.length;u++){var c=h[u];null!=c.attachment&&(I(c.attachment,_)?(c.attachment=c.attachment.newLinkedMesh(),this.setAttachment(c.slotIndex,c.name,c.attachment)):(c.attachment=c.attachment.copy(),this.setAttachment(c.slotIndex,c.name,c.attachment)))}},e.getAttachment=function(t,e){var n=this.attachments[t];return n?n[e]:null},e.removeAttachment=function(t,e){var n=this.attachments[t];n&&(n[e]=null)},e.getAttachments=function(){for(var t=new Array,e=0;e<this.attachments.length;e++){var n=this.attachments[e];if(n)for(var r in n){var a=n[r];a&&t.push(new Z(e,r,a))}}return t},e.getAttachmentsForSlot=function(t,e){var n=this.attachments[t];if(n)for(var r in n){var a=n[r];a&&e.push(new Z(t,r,a))}},e.clear=function(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0},e.attachAll=function(t,e){for(var n=0,r=0;r<t.slots.length;r++){var a=t.slots[r],i=a.getAttachment();if(i&&n<e.attachments.length){var s=e.attachments[n];for(var o in s){if(i==s[o]){var l=this.getAttachment(n,o);null!=l&&a.setAttachment(l);break}}}n++}},t}(),J=function(t){this.name=t},K=function(){function t(t,e,n){if(null==t)throw new Error("name cannot be null.");if(null==e)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.timelineIds=[];for(var r=0;r<e.length;r++)this.timelineIds[e[r].getPropertyId()]=!0;this.duration=n}var e=t.prototype;return e.hasTimeline=function(t){return 1==this.timelineIds[t]},e.apply=function(t,e,n,r,a,i,s,o){if(null==t)throw new Error("skeleton cannot be null.");r&&0!=this.duration&&(n%=this.duration,e>0&&(e%=this.duration));for(var l=this.timelines,h=0,u=l.length;h<u;h++)l[h].apply(t,e,n,a,i,s,o)},t.binarySearch=function(t,e,n){void 0===n&&(n=1);var r=0,a=t.length/n-2;if(0==a)return n;for(var i=a>>>1;;){if(t[(i+1)*n]<=e?r=i+1:a=i,r==a)return(r+1)*n;i=r+a>>>1}},t.linearSearch=function(t,e,n){for(var r=0,a=t.length-n;r<=a;r+=n)if(t[r]>e)return r;return-1},t}();!function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"}(G||(G={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(j||(j={})),function(t){t[t.rotate=0]="rotate",t[t.translate=1]="translate",t[t.scale=2]="scale",t[t.shear=3]="shear",t[t.attachment=4]="attachment",t[t.color=5]="color",t[t.deform=6]="deform",t[t.event=7]="event",t[t.drawOrder=8]="drawOrder",t[t.ikConstraint=9]="ikConstraint",t[t.transformConstraint=10]="transformConstraint",t[t.pathConstraintPosition=11]="pathConstraintPosition",t[t.pathConstraintSpacing=12]="pathConstraintSpacing",t[t.pathConstraintMix=13]="pathConstraintMix",t[t.twoColor=14]="twoColor"}(z||(z={}));var $=function(){function t(e){if(e<=0)throw new Error("frameCount must be > 0: "+e);this.curves=b.newFloatArray((e-1)*t.BEZIER_SIZE)}var e=t.prototype;return e.getFrameCount=function(){return this.curves.length/t.BEZIER_SIZE+1},e.setLinear=function(e){this.curves[e*t.BEZIER_SIZE]=t.LINEAR},e.setStepped=function(e){this.curves[e*t.BEZIER_SIZE]=t.STEPPED},e.getCurveType=function(e){var n=e*t.BEZIER_SIZE;if(n==this.curves.length)return t.LINEAR;var r=this.curves[n];return r==t.LINEAR?t.LINEAR:r==t.STEPPED?t.STEPPED:t.BEZIER},e.setCurve=function(e,n,r,a,i){var s=.03*(2*-n+a),o=.03*(2*-r+i),l=.006*(3*(n-a)+1),h=.006*(3*(r-i)+1),u=2*s+l,c=2*o+h,d=.3*n+s+.16666667*l,f=.3*r+o+.16666667*h,p=e*t.BEZIER_SIZE,v=this.curves;v[p++]=t.BEZIER;for(var g=d,m=f,w=p+t.BEZIER_SIZE-1;p<w;p+=2)v[p]=g,v[p+1]=m,d+=u,f+=c,u+=l,c+=h,g+=d,m+=f},e.getCurvePercent=function(e,n){n=y.clamp(n,0,1);var r=this.curves,a=e*t.BEZIER_SIZE,i=r[a];if(i==t.LINEAR)return n;if(i==t.STEPPED)return 0;for(var s=0,o=++a,l=a+t.BEZIER_SIZE-1;a<l;a+=2)if((s=r[a])>=n){var h=void 0,u=void 0;return a==o?(h=0,u=0):(h=r[a-2],u=r[a-1]),u+(r[a+1]-u)*(n-h)/(s-h)}var c=r[a-1];return c+(1-c)*(n-s)/(1-s)},t}();$.LINEAR=0,$.STEPPED=1,$.BEZIER=2,$.BEZIER_SIZE=19;var tt=function(t){function e(e){var n;return(n=t.call(this,e)||this).frames=b.newFloatArray(e<<1),n}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return 0+this.boneIndex},n.setFrame=function(t,n,r){t<<=1,this.frames[t]=n,this.frames[t+e.ROTATION]=r},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(r<l[0])switch(s){case 0:return void(h.rotation=h.data.rotation);case 1:var u=h.data.rotation-h.rotation;h.rotation+=(u-360*(16384-(16384.499999999996-u/360|0)))*i}else if(r>=l[l.length-e.ENTRIES]){var c=l[l.length+e.PREV_ROTATION];switch(s){case 0:h.rotation=h.data.rotation+c*i;break;case 1:case 2:c+=h.data.rotation-h.rotation,c-=360*(16384-(16384.499999999996-c/360|0));case 3:h.rotation+=c*i}}else{var d=K.binarySearch(l,r,e.ENTRIES),f=l[d+e.PREV_ROTATION],p=l[d],v=this.getCurvePercent((d>>1)-1,1-(r-p)/(l[d+e.PREV_TIME]-p)),g=l[d+e.ROTATION]-f;switch(g=f+(g-360*(16384-(16384.499999999996-g/360|0)))*v,s){case 0:h.rotation=h.data.rotation+(g-360*(16384-(16384.499999999996-g/360|0)))*i;break;case 1:case 2:g+=h.data.rotation-h.rotation;case 3:h.rotation+=(g-360*(16384-(16384.499999999996-g/360|0)))*i}}},e}($);tt.ENTRIES=2,tt.PREV_TIME=-2,tt.PREV_ROTATION=-1,tt.ROTATION=1;var et=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(1<<24)+this.boneIndex},n.setFrame=function(t,n,r,a){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.X]=r,this.frames[t+e.Y]=a},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.x=h.data.x,void(h.y=h.data.y);case 1:h.x+=(h.data.x-h.x)*i,h.y+=(h.data.y-h.y)*i}else{var u=0,c=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X],c=l[l.length+e.PREV_Y];else{var d=K.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],p=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.X]-u)*p,c+=(l[d+e.Y]-c)*p}switch(s){case 0:h.x=h.data.x+u*i,h.y=h.data.y+c*i;break;case 1:case 2:h.x+=(h.data.x+u-h.x)*i,h.y+=(h.data.y+c-h.y)*i;break;case 3:h.x+=u*i,h.y+=c*i}}},e}($);et.ENTRIES=3,et.PREV_TIME=-3,et.PREV_X=-2,et.PREV_Y=-1,et.X=1,et.Y=2;var nt=function(t){function e(e){return t.call(this,e)}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(2<<24)+this.boneIndex},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.scaleX=h.data.scaleX,void(h.scaleY=h.data.scaleY);case 1:h.scaleX+=(h.data.scaleX-h.scaleX)*i,h.scaleY+=(h.data.scaleY-h.scaleY)*i}else{var u=0,c=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X]*h.data.scaleX,c=l[l.length+e.PREV_Y]*h.data.scaleY;else{var d=K.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],p=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u=(u+(l[d+e.X]-u)*p)*h.data.scaleX,c=(c+(l[d+e.Y]-c)*p)*h.data.scaleY}if(1==i)3==s?(h.scaleX+=u-h.data.scaleX,h.scaleY+=c-h.data.scaleY):(h.scaleX=u,h.scaleY=c);else{var v=0,g=0;if(1==o)switch(s){case 0:v=h.data.scaleX,g=h.data.scaleY,h.scaleX=v+(Math.abs(u)*y.signum(v)-v)*i,h.scaleY=g+(Math.abs(c)*y.signum(g)-g)*i;break;case 1:case 2:v=h.scaleX,g=h.scaleY,h.scaleX=v+(Math.abs(u)*y.signum(v)-v)*i,h.scaleY=g+(Math.abs(c)*y.signum(g)-g)*i;break;case 3:v=h.scaleX,g=h.scaleY,h.scaleX=v+(Math.abs(u)*y.signum(v)-h.data.scaleX)*i,h.scaleY=g+(Math.abs(c)*y.signum(g)-h.data.scaleY)*i}else switch(s){case 0:v=Math.abs(h.data.scaleX)*y.signum(u),g=Math.abs(h.data.scaleY)*y.signum(c),h.scaleX=v+(u-v)*i,h.scaleY=g+(c-g)*i;break;case 1:case 2:v=Math.abs(h.scaleX)*y.signum(u),g=Math.abs(h.scaleY)*y.signum(c),h.scaleX=v+(u-v)*i,h.scaleY=g+(c-g)*i;break;case 3:v=y.signum(u),g=y.signum(c),h.scaleX=Math.abs(h.scaleX)*v+(u-Math.abs(h.data.scaleX)*v)*i,h.scaleY=Math.abs(h.scaleY)*g+(c-Math.abs(h.data.scaleY)*g)*i}}}},e}(et),rt=function(t){function e(e){return t.call(this,e)}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(3<<24)+this.boneIndex},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.shearX=h.data.shearX,void(h.shearY=h.data.shearY);case 1:h.shearX+=(h.data.shearX-h.shearX)*i,h.shearY+=(h.data.shearY-h.shearY)*i}else{var u=0,c=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X],c=l[l.length+e.PREV_Y];else{var d=K.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],p=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.X]-u)*p,c+=(l[d+e.Y]-c)*p}switch(s){case 0:h.shearX=h.data.shearX+u*i,h.shearY=h.data.shearY+c*i;break;case 1:case 2:h.shearX+=(h.data.shearX+u-h.shearX)*i,h.shearY+=(h.data.shearY+c-h.shearY)*i;break;case 3:h.shearX+=u*i,h.shearY+=c*i}}},e}(et),at=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(5<<24)+this.slotIndex},n.setFrame=function(t,n,r,a,i,s){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.R]=r,this.frames[t+e.G]=a,this.frames[t+e.B]=i,this.frames[t+e.A]=s},n.apply=function(t,n,r,a,i,s,o){var l=t.slots[this.slotIndex];if(l.bone.active){var h=this.frames;if(r<h[0])switch(s){case 0:return void l.color.setFromColor(l.data.color);case 1:var u=l.color,c=l.data.color;u.add((c.r-u.r)*i,(c.g-u.g)*i,(c.b-u.b)*i,(c.a-u.a)*i)}else{var d=0,f=0,p=0,v=0;if(r>=h[h.length-e.ENTRIES]){var g=h.length;d=h[g+e.PREV_R],f=h[g+e.PREV_G],p=h[g+e.PREV_B],v=h[g+e.PREV_A]}else{var m=K.binarySearch(h,r,e.ENTRIES);d=h[m+e.PREV_R],f=h[m+e.PREV_G],p=h[m+e.PREV_B],v=h[m+e.PREV_A];var w=h[m],x=this.getCurvePercent(m/e.ENTRIES-1,1-(r-w)/(h[m+e.PREV_TIME]-w));d+=(h[m+e.R]-d)*x,f+=(h[m+e.G]-f)*x,p+=(h[m+e.B]-p)*x,v+=(h[m+e.A]-v)*x}if(1==i)l.color.set(d,f,p,v);else{var E=l.color;0==s&&E.setFromColor(l.data.color),E.add((d-E.r)*i,(f-E.g)*i,(p-E.b)*i,(v-E.a)*i)}}}},e}($);at.ENTRIES=5,at.PREV_TIME=-5,at.PREV_R=-4,at.PREV_G=-3,at.PREV_B=-2,at.PREV_A=-1,at.R=1,at.G=2,at.B=3,at.A=4;var it=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(14<<24)+this.slotIndex},n.setFrame=function(t,n,r,a,i,s,o,l,h){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.R]=r,this.frames[t+e.G]=a,this.frames[t+e.B]=i,this.frames[t+e.A]=s,this.frames[t+e.R2]=o,this.frames[t+e.G2]=l,this.frames[t+e.B2]=h},n.apply=function(t,n,r,a,i,s,o){var l=t.slots[this.slotIndex];if(l.bone.active){var h=this.frames;if(r<h[0])switch(s){case 0:return l.color.setFromColor(l.data.color),void l.darkColor.setFromColor(l.data.darkColor);case 1:var u=l.color,c=l.darkColor,d=l.data.color,f=l.data.darkColor;u.add((d.r-u.r)*i,(d.g-u.g)*i,(d.b-u.b)*i,(d.a-u.a)*i),c.add((f.r-c.r)*i,(f.g-c.g)*i,(f.b-c.b)*i,0)}else{var p=0,v=0,g=0,m=0,w=0,x=0,E=0;if(r>=h[h.length-e.ENTRIES]){var y=h.length;p=h[y+e.PREV_R],v=h[y+e.PREV_G],g=h[y+e.PREV_B],m=h[y+e.PREV_A],w=h[y+e.PREV_R2],x=h[y+e.PREV_G2],E=h[y+e.PREV_B2]}else{var b=K.binarySearch(h,r,e.ENTRIES);p=h[b+e.PREV_R],v=h[b+e.PREV_G],g=h[b+e.PREV_B],m=h[b+e.PREV_A],w=h[b+e.PREV_R2],x=h[b+e.PREV_G2],E=h[b+e.PREV_B2];var S=h[b],M=this.getCurvePercent(b/e.ENTRIES-1,1-(r-S)/(h[b+e.PREV_TIME]-S));p+=(h[b+e.R]-p)*M,v+=(h[b+e.G]-v)*M,g+=(h[b+e.B]-g)*M,m+=(h[b+e.A]-m)*M,w+=(h[b+e.R2]-w)*M,x+=(h[b+e.G2]-x)*M,E+=(h[b+e.B2]-E)*M}if(1==i)l.color.set(p,v,g,m),l.darkColor.set(w,x,E,1);else{var A=l.color,R=l.darkColor;0==s&&(A.setFromColor(l.data.color),R.setFromColor(l.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,(x-R.g)*i,(E-R.b)*i,0)}}}},e}($);it.ENTRIES=8,it.PREV_TIME=-8,it.PREV_R=-7,it.PREV_G=-6,it.PREV_B=-5,it.PREV_A=-4,it.PREV_R2=-3,it.PREV_G2=-2,it.PREV_B2=-1,it.R=1,it.G=2,it.B=3,it.A=4,it.R2=5,it.G2=6,it.B2=7;var st=function(){function t(t){this.frames=b.newFloatArray(t),this.attachmentNames=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return(4<<24)+this.slotIndex},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e,n){this.frames[t]=e,this.attachmentNames[t]=n},e.apply=function(t,e,n,r,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active)if(1!=s){var l=this.frames;if(n<l[0])0!=i&&1!=i||this.setAttachment(t,o,o.data.attachmentName);else{var h=0;h=n>=l[l.length-1]?l.length-1:K.binarySearch(l,n,1)-1;var u=this.attachmentNames[h];t.slots[this.slotIndex].setAttachment(null==u?null:t.getAttachment(this.slotIndex,u))}}else 0==i&&this.setAttachment(t,o,o.data.attachmentName)},e.setAttachment=function(t,e,n){e.attachment=null==n?null:t.getAttachment(this.slotIndex,n)},t}(),ot=null,lt=function(t){function e(e){var n;return(n=t.call(this,e)||this).frames=b.newFloatArray(e),n.frameVertices=new Array(e),null==ot&&(ot=b.newFloatArray(64)),n}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(6<<27)+ +this.attachment.id+this.slotIndex},n.setFrame=function(t,e,n){this.frames[t]=e,this.frameVertices[t]=n},n.apply=function(t,e,n,r,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active){var l=o.getAttachment();if(I(l,R)&&l.deformAttachment==this.attachment){var h=o.deform;0==h.length&&(i=0);var u=this.frameVertices,c=u[0].length,d=this.frames;if(n<d[0]){var f=l;switch(i){case 0:return void(h.length=0);case 1:if(1==a){h.length=0;break}var p=b.setArraySize(h,c);if(null==f.bones)for(var v=f.vertices,g=0;g<c;g++)p[g]+=(v[g]-p[g])*a;else{a=1-a;for(g=0;g<c;g++)p[g]*=a}}}else{var m=b.setArraySize(h,c);if(n>=d[d.length-1]){var w=u[d.length-1];if(1==a)if(3==i){var x=l;if(null==x.bones)for(var E=x.vertices,y=0;y<c;y++)m[y]+=w[y]-E[y];else for(var S=0;S<c;S++)m[S]+=w[S]}else b.arrayCopy(w,0,m,0,c);else switch(i){case 0:var M=l;if(null==M.bones)for(var A=M.vertices,T=0;T<c;T++){var C=A[T];m[T]=C+(w[T]-C)*a}else for(var _=0;_<c;_++)m[_]=w[_]*a;break;case 1:case 2:for(var k=0;k<c;k++)m[k]+=(w[k]-m[k])*a;break;case 3:var V=l;if(null==V.bones)for(var P=V.vertices,F=0;F<c;F++)m[F]+=(w[F]-P[F])*a;else for(var N=0;N<c;N++)m[N]+=w[N]*a}}else{var B=K.binarySearch(d,n),O=u[B-1],L=u[B],X=d[B],D=this.getCurvePercent(B-1,1-(n-X)/(d[B-1]-X));if(1==a)if(3==i){var Y=l;if(null==Y.bones)for(var U=Y.vertices,W=0;W<c;W++){var q=O[W];m[W]+=q+(L[W]-q)*D-U[W]}else for(var H=0;H<c;H++){var G=O[H];m[H]+=G+(L[H]-G)*D}}else for(var j=0;j<c;j++){var z=O[j];m[j]=z+(L[j]-z)*D}else switch(i){case 0:var Z=l;if(null==Z.bones)for(var Q=Z.vertices,J=0;J<c;J++){var $=O[J],tt=Q[J];m[J]=tt+($+(L[J]-$)*D-tt)*a}else for(var et=0;et<c;et++){var nt=O[et];m[et]=(nt+(L[et]-nt)*D)*a}break;case 1:case 2:for(var rt=0;rt<c;rt++){var at=O[rt];m[rt]+=(at+(L[rt]-at)*D-m[rt])*a}break;case 3:var it=l;if(null==it.bones)for(var st=it.vertices,ot=0;ot<c;ot++){var lt=O[ot];m[ot]+=(lt+(L[ot]-lt)*D-st[ot])*a}else for(var ht=0;ht<c;ht++){var ut=O[ht];m[ht]+=(ut+(L[ht]-ut)*D)*a}}}}}}},e}($),ht=function(){function t(t){this.frames=b.newFloatArray(t),this.events=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return 7<<24},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e){this.frames[t]=e.time,this.events[t]=e},e.apply=function(t,e,n,r,a,i,s){if(null!=r){var o=this.frames,l=this.frames.length;if(e>n)this.apply(t,e,Number.MAX_VALUE,r,a,i,s),e=-1;else if(e>=o[l-1])return;if(!(n<o[0])){var h=0;if(e<o[0])h=0;else for(var u=o[h=K.binarySearch(o,e)];h>0&&o[h-1]==u;)h--;for(;h<l&&n>=o[h];h++)r.push(this.events[h])}}},t}(),ut=function(){function t(t){this.frames=b.newFloatArray(t),this.drawOrders=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return 8<<24},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e,n){this.frames[t]=e,this.drawOrders[t]=n},e.apply=function(t,e,n,r,a,i,s){var o=t.drawOrder,l=t.slots;if(1!=s){var h=this.frames;if(n<h[0])0!=i&&1!=i||b.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{var u=0;u=n>=h[h.length-1]?h.length-1:K.binarySearch(h,n)-1;var c=this.drawOrders[u];if(null==c)b.arrayCopy(l,0,o,0,l.length);else for(var d=0,f=c.length;d<f;d++)o[d]=l[c[d]]}}else 0==i&&b.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)},t}(),ct=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(9<<24)+this.ikConstraintIndex},n.setFrame=function(t,n,r,a,i,s,o){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.MIX]=r,this.frames[t+e.SOFTNESS]=a,this.frames[t+e.BEND_DIRECTION]=i,this.frames[t+e.COMPRESS]=s?1:0,this.frames[t+e.STRETCH]=o?1:0},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.ikConstraints[this.ikConstraintIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.mix=h.data.mix,h.softness=h.data.softness,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,void(h.stretch=h.data.stretch);case 1:h.mix+=(h.data.mix-h.mix)*i,h.softness+=(h.data.softness-h.softness)*i,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch}else if(r>=l[l.length-e.ENTRIES])0==s?(h.mix=h.data.mix+(l[l.length+e.PREV_MIX]-h.data.mix)*i,h.softness=h.data.softness+(l[l.length+e.PREV_SOFTNESS]-h.data.softness)*i,1==o?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=l[l.length+e.PREV_BEND_DIRECTION],h.compress=0!=l[l.length+e.PREV_COMPRESS],h.stretch=0!=l[l.length+e.PREV_STRETCH])):(h.mix+=(l[l.length+e.PREV_MIX]-h.mix)*i,h.softness+=(l[l.length+e.PREV_SOFTNESS]-h.softness)*i,0==o&&(h.bendDirection=l[l.length+e.PREV_BEND_DIRECTION],h.compress=0!=l[l.length+e.PREV_COMPRESS],h.stretch=0!=l[l.length+e.PREV_STRETCH]));else{var u=K.binarySearch(l,r,e.ENTRIES),c=l[u+e.PREV_MIX],d=l[u+e.PREV_SOFTNESS],f=l[u],p=this.getCurvePercent(u/e.ENTRIES-1,1-(r-f)/(l[u+e.PREV_TIME]-f));0==s?(h.mix=h.data.mix+(c+(l[u+e.MIX]-c)*p-h.data.mix)*i,h.softness=h.data.softness+(d+(l[u+e.SOFTNESS]-d)*p-h.data.softness)*i,1==o?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=l[u+e.PREV_BEND_DIRECTION],h.compress=0!=l[u+e.PREV_COMPRESS],h.stretch=0!=l[u+e.PREV_STRETCH])):(h.mix+=(c+(l[u+e.MIX]-c)*p-h.mix)*i,h.softness+=(d+(l[u+e.SOFTNESS]-d)*p-h.softness)*i,0==o&&(h.bendDirection=l[u+e.PREV_BEND_DIRECTION],h.compress=0!=l[u+e.PREV_COMPRESS],h.stretch=0!=l[u+e.PREV_STRETCH]))}},e}($);ct.ENTRIES=6,ct.PREV_TIME=-6,ct.PREV_MIX=-5,ct.PREV_SOFTNESS=-4,ct.PREV_BEND_DIRECTION=-3,ct.PREV_COMPRESS=-2,ct.PREV_STRETCH=-1,ct.MIX=1,ct.SOFTNESS=2,ct.BEND_DIRECTION=3,ct.COMPRESS=4,ct.STRETCH=5;var dt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(10<<24)+this.transformConstraintIndex},n.setFrame=function(t,n,r,a,i,s){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.ROTATE]=r,this.frames[t+e.TRANSLATE]=a,this.frames[t+e.SCALE]=i,this.frames[t+e.SHEAR]=s},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.transformConstraints[this.transformConstraintIndex];if(h.active)if(r<l[0]){var u=h.data;switch(s){case 0:return h.rotateMix=u.rotateMix,h.translateMix=u.translateMix,h.scaleMix=u.scaleMix,void(h.shearMix=u.shearMix);case 1:h.rotateMix+=(u.rotateMix-h.rotateMix)*i,h.translateMix+=(u.translateMix-h.translateMix)*i,h.scaleMix+=(u.scaleMix-h.scaleMix)*i,h.shearMix+=(u.shearMix-h.shearMix)*i}}else{var c=0,d=0,f=0,p=0;if(r>=l[l.length-e.ENTRIES]){var v=l.length;c=l[v+e.PREV_ROTATE],d=l[v+e.PREV_TRANSLATE],f=l[v+e.PREV_SCALE],p=l[v+e.PREV_SHEAR]}else{var g=K.binarySearch(l,r,e.ENTRIES);c=l[g+e.PREV_ROTATE],d=l[g+e.PREV_TRANSLATE],f=l[g+e.PREV_SCALE],p=l[g+e.PREV_SHEAR];var m=l[g],w=this.getCurvePercent(g/e.ENTRIES-1,1-(r-m)/(l[g+e.PREV_TIME]-m));c+=(l[g+e.ROTATE]-c)*w,d+=(l[g+e.TRANSLATE]-d)*w,f+=(l[g+e.SCALE]-f)*w,p+=(l[g+e.SHEAR]-p)*w}if(0==s){var x=h.data;h.rotateMix=x.rotateMix+(c-x.rotateMix)*i,h.translateMix=x.translateMix+(d-x.translateMix)*i,h.scaleMix=x.scaleMix+(f-x.scaleMix)*i,h.shearMix=x.shearMix+(p-x.shearMix)*i}else h.rotateMix+=(c-h.rotateMix)*i,h.translateMix+=(d-h.translateMix)*i,h.scaleMix+=(f-h.scaleMix)*i,h.shearMix+=(p-h.shearMix)*i}},e}($);dt.ENTRIES=5,dt.PREV_TIME=-5,dt.PREV_ROTATE=-4,dt.PREV_TRANSLATE=-3,dt.PREV_SCALE=-2,dt.PREV_SHEAR=-1,dt.ROTATE=1,dt.TRANSLATE=2,dt.SCALE=3,dt.SHEAR=4;var ft=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(11<<24)+this.pathConstraintIndex},n.setFrame=function(t,n,r){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.VALUE]=r},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(r<l[0])switch(s){case 0:return void(h.position=h.data.position);case 1:h.position+=(h.data.position-h.position)*i}else{var u=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_VALUE];else{var c=K.binarySearch(l,r,e.ENTRIES);u=l[c+e.PREV_VALUE];var d=l[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(r-d)/(l[c+e.PREV_TIME]-d));u+=(l[c+e.VALUE]-u)*f}0==s?h.position=h.data.position+(u-h.data.position)*i:h.position+=(u-h.position)*i}},e}($);ft.ENTRIES=2,ft.PREV_TIME=-2,ft.PREV_VALUE=-1,ft.VALUE=1;var pt,vt=function(t){function e(e){return t.call(this,e)}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(12<<24)+this.pathConstraintIndex},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(r<l[0])switch(s){case 0:return void(h.spacing=h.data.spacing);case 1:h.spacing+=(h.data.spacing-h.spacing)*i}else{var u=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_VALUE];else{var c=K.binarySearch(l,r,e.ENTRIES);u=l[c+e.PREV_VALUE];var d=l[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(r-d)/(l[c+e.PREV_TIME]-d));u+=(l[c+e.VALUE]-u)*f}0==s?h.spacing=h.data.spacing+(u-h.data.spacing)*i:h.spacing+=(u-h.spacing)*i}},e}(ft),gt=function(t){function e(n){var r;return(r=t.call(this,n)||this).frames=b.newFloatArray(n*e.ENTRIES),r}r(e,t);var n=e.prototype;return n.getPropertyId=function(){return(13<<24)+this.pathConstraintIndex},n.setFrame=function(t,n,r,a){t*=e.ENTRIES,this.frames[t]=n,this.frames[t+e.ROTATE]=r,this.frames[t+e.TRANSLATE]=a},n.apply=function(t,n,r,a,i,s,o){var l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(r<l[0])switch(s){case 0:return h.rotateMix=h.data.rotateMix,void(h.translateMix=h.data.translateMix);case 1:h.rotateMix+=(h.data.rotateMix-h.rotateMix)*i,h.translateMix+=(h.data.translateMix-h.translateMix)*i}else{var u=0,c=0;if(r>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_ROTATE],c=l[l.length+e.PREV_TRANSLATE];else{var d=K.binarySearch(l,r,e.ENTRIES);u=l[d+e.PREV_ROTATE],c=l[d+e.PREV_TRANSLATE];var f=l[d],p=this.getCurvePercent(d/e.ENTRIES-1,1-(r-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.ROTATE]-u)*p,c+=(l[d+e.TRANSLATE]-c)*p}0==s?(h.rotateMix=h.data.rotateMix+(u-h.data.rotateMix)*i,h.translateMix=h.data.translateMix+(c-h.data.translateMix)*i):(h.rotateMix+=(u-h.rotateMix)*i,h.translateMix+=(c-h.translateMix)*i)}},e}($);gt.ENTRIES=3,gt.PREV_TIME=-3,gt.PREV_ROTATE=-2,gt.PREV_TRANSLATE=-1,gt.ROTATE=1,gt.TRANSLATE=2,function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(pt||(pt={}));var mt,wt=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e},xt=function(){function t(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}var e=t.prototype;return e.readSkeletonData=function(e){var n=this.scale,r=new B,a="string"==typeof e?JSON.parse(e):e,i=a.skeleton;if(null!=i){if(r.hash=i.hash,r.version=i.spine,"3.8.75"==r.version)throw new Error("Unsupported skeleton data, please export with a newer version of Spine.");r.x=i.x,r.y=i.y,r.width=i.width,r.height=i.height,r.fps=i.fps,r.imagesPath=i.images}if(a.bones)for(var s=0;s<a.bones.length;s++){var o=a.bones[s],l=null,h=this.getValue(o,"parent",null);if(null!=h&&null==(l=r.findBone(h)))throw new Error("Parent bone not found: "+h);var u=new O(r.bones.length,o.name,l);u.length=this.getValue(o,"length",0)*n,u.x=this.getValue(o,"x",0)*n,u.y=this.getValue(o,"y",0)*n,u.rotation=this.getValue(o,"rotation",0),u.scaleX=this.getValue(o,"scaleX",1),u.scaleY=this.getValue(o,"scaleY",1),u.shearX=this.getValue(o,"shearX",0),u.shearY=this.getValue(o,"shearY",0),u.transformMode=t.transformModeFromString(this.getValue(o,"transform","normal")),u.skinRequired=this.getValue(o,"skin",!1),r.bones.push(u)}if(a.slots)for(var c=0;c<a.slots.length;c++){var d=a.slots[c],f=d.name,p=d.bone,v=r.findBone(p);if(null==v)throw new Error("Slot bone not found: "+p);var g=new Y(r.slots.length,f,v),m=this.getValue(d,"color",null);null!=m&&g.color.setFromString(m);var w=this.getValue(d,"dark",null);null!=w&&(g.darkColor=new E(1,1,1,1),g.darkColor.setFromString(w)),g.attachmentName=this.getValue(d,"attachment",null),g.blendMode=t.blendModeFromString(this.getValue(d,"blend","normal")),r.slots.push(g)}if(a.ik)for(var x=0;x<a.ik.length;x++){var y=a.ik[x],b=new W(y.name);b.order=this.getValue(y,"order",0),b.skinRequired=this.getValue(y,"skin",!1);for(var S=0;S<y.bones.length;S++){var M=y.bones[S],A=r.findBone(M);if(null==A)throw new Error("IK bone not found: "+M);b.bones.push(A)}var R=y.target;if(b.target=r.findBone(R),null==b.target)throw new Error("IK target bone not found: "+R);b.mix=this.getValue(y,"mix",1),b.softness=this.getValue(y,"softness",0)*n,b.bendDirection=this.getValue(y,"bendPositive",!0)?1:-1,b.compress=this.getValue(y,"compress",!1),b.stretch=this.getValue(y,"stretch",!1),b.uniform=this.getValue(y,"uniform",!1),r.ikConstraints.push(b)}if(a.transform)for(var T=0;T<a.transform.length;T++){var I=a.transform[T],C=new q(I.name);C.order=this.getValue(I,"order",0),C.skinRequired=this.getValue(I,"skin",!1);for(var _=0;_<I.bones.length;_++){var k=I.bones[_],V=r.findBone(k);if(null==V)throw new Error("Transform constraint bone not found: "+k);C.bones.push(V)}var P=I.target;if(C.target=r.findBone(P),null==C.target)throw new Error("Transform constraint target bone not found: "+P);C.local=this.getValue(I,"local",!1),C.relative=this.getValue(I,"relative",!1),C.offsetRotation=this.getValue(I,"rotation",0),C.offsetX=this.getValue(I,"x",0)*n,C.offsetY=this.getValue(I,"y",0)*n,C.offsetScaleX=this.getValue(I,"scaleX",0),C.offsetScaleY=this.getValue(I,"scaleY",0),C.offsetShearY=this.getValue(I,"shearY",0),C.rotateMix=this.getValue(I,"rotateMix",1),C.translateMix=this.getValue(I,"translateMix",1),C.scaleMix=this.getValue(I,"scaleMix",1),C.shearMix=this.getValue(I,"shearMix",1),r.transformConstraints.push(C)}if(a.path)for(var F=0;F<a.path.length;F++){var N=a.path[F],D=new H(N.name);D.order=this.getValue(N,"order",0),D.skinRequired=this.getValue(N,"skin",!1);for(var U=0;U<N.bones.length;U++){var G=N.bones[U],j=r.findBone(G);if(null==j)throw new Error("Transform constraint bone not found: "+G);D.bones.push(j)}var z=N.target;if(D.target=r.findSlot(z),null==D.target)throw new Error("Path target slot not found: "+z);D.positionMode=t.positionModeFromString(this.getValue(N,"positionMode","percent")),D.spacingMode=t.spacingModeFromString(this.getValue(N,"spacingMode","length")),D.rotateMode=t.rotateModeFromString(this.getValue(N,"rotateMode","tangent")),D.offsetRotation=this.getValue(N,"rotation",0),D.position=this.getValue(N,"position",0),D.positionMode==L.Fixed&&(D.position*=n),D.spacing=this.getValue(N,"spacing",0),D.spacingMode!=X.Length&&D.spacingMode!=X.Fixed||(D.spacing*=n),D.rotateMix=this.getValue(N,"rotateMix",1),D.translateMix=this.getValue(N,"translateMix",1),r.pathConstraints.push(D)}if(a.skins)for(var Z=0;Z<a.skins.length;Z++){var K=a.skins[Z],$=new Q(K.name);if(K.bones)for(var tt=0;tt<K.bones.length;tt++){var et=r.findBone(K.bones[tt]);if(null==et)throw new Error("Skin bone not found: "+K.bones[Z]);$.bones.push(et)}if(K.ik)for(var nt=0;nt<K.ik.length;nt++){var rt=r.findIkConstraint(K.ik[nt]);if(null==rt)throw new Error("Skin IK constraint not found: "+K.ik[Z]);$.constraints.push(rt)}if(K.transform)for(var at=0;at<K.transform.length;at++){var it=r.findTransformConstraint(K.transform[at]);if(null==it)throw new Error("Skin transform constraint not found: "+K.transform[Z]);$.constraints.push(it)}if(K.path)for(var st=0;st<K.path.length;st++){var ot=r.findPathConstraint(K.path[st]);if(null==ot)throw new Error("Skin path constraint not found: "+K.path[Z]);$.constraints.push(ot)}for(var lt in K.attachments){var ht=r.findSlot(lt);if(null==ht)throw new Error("Slot not found: "+lt);var ut=K.attachments[lt];for(var ct in ut){var dt=this.readAttachment(ut[ct],$,ht.index,ct,r);null!=dt&&$.setAttachment(ht.index,ct,dt)}}r.skins.push($),"default"==$.name&&(r.defaultSkin=$)}for(var ft=0,pt=this.linkedMeshes.length;ft<pt;ft++){var vt=this.linkedMeshes[ft],gt=null==vt.skin?r.defaultSkin:r.findSkin(vt.skin);if(null==gt)throw new Error("Skin not found: "+vt.skin);var mt=gt.getAttachment(vt.slotIndex,vt.parent);if(null==mt)throw new Error("Parent mesh not found: "+vt.parent);vt.mesh.deformAttachment=vt.inheritDeform?mt:vt.mesh,vt.mesh.setParentMesh(mt),vt.mesh.updateUVs()}if(this.linkedMeshes.length=0,a.events)for(var wt in a.events){var xt=a.events[wt],Et=new J(wt);Et.intValue=this.getValue(xt,"int",0),Et.floatValue=this.getValue(xt,"float",0),Et.stringValue=this.getValue(xt,"string",""),Et.audioPath=this.getValue(xt,"audio",null),null!=Et.audioPath&&(Et.volume=this.getValue(xt,"volume",1),Et.balance=this.getValue(xt,"balance",0)),r.events.push(Et)}if(a.animations)for(var yt in a.animations){var bt=a.animations[yt];this.readAnimation(bt,yt,r)}return r},e.readAttachment=function(t,e,n,r,a){var i=this.scale;switch(r=this.getValue(t,"name",r),this.getValue(t,"type","region")){case"region":var s=this.getValue(t,"path",r),o=this.attachmentLoader.newRegionAttachment(e,r,s);if(null==o)return null;o.path=s,o.x=this.getValue(t,"x",0)*i,o.y=this.getValue(t,"y",0)*i,o.scaleX=this.getValue(t,"scaleX",1),o.scaleY=this.getValue(t,"scaleY",1),o.rotation=this.getValue(t,"rotation",0),o.width=t.width*i,o.height=t.height*i;var l=this.getValue(t,"color",null);return null!=l&&o.color.setFromString(l),o.updateOffset(),o;case"boundingbox":var h=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(null==h)return null;this.readVertices(t,h,t.vertexCount<<1);var u=this.getValue(t,"color",null);return null!=u&&h.color.setFromString(u),h;case"mesh":case"linkedmesh":var c=this.getValue(t,"path",r),d=this.attachmentLoader.newMeshAttachment(e,r,c);if(null==d)return null;d.path=c;var f=this.getValue(t,"color",null);null!=f&&d.color.setFromString(f),d.width=this.getValue(t,"width",0)*i,d.height=this.getValue(t,"height",0)*i;var p=this.getValue(t,"parent",null);if(null!=p)return this.linkedMeshes.push(new Et(d,this.getValue(t,"skin",null),n,p,this.getValue(t,"deform",!0))),d;var v=t.uvs;return this.readVertices(t,d,v.length),d.triangles=t.triangles,d.regionUVs=v,d.updateUVs(),d.edges=this.getValue(t,"edges",null),d.hullLength=2*this.getValue(t,"hull",0),d;case"path":var g=this.attachmentLoader.newPathAttachment(e,r);if(null==g)return null;g.closed=this.getValue(t,"closed",!1),g.constantSpeed=this.getValue(t,"constantSpeed",!0);var m=t.vertexCount;this.readVertices(t,g,m<<1);for(var w=b.newArray(m/3,0),x=0;x<t.lengths.length;x++)w[x]=t.lengths[x]*i;g.lengths=w;var E=this.getValue(t,"color",null);return null!=E&&g.color.setFromString(E),g;case"point":var y=this.attachmentLoader.newPointAttachment(e,r);if(null==y)return null;y.x=this.getValue(t,"x",0)*i,y.y=this.getValue(t,"y",0)*i,y.rotation=this.getValue(t,"rotation",0);var S=this.getValue(t,"color",null);return null!=S&&y.color.setFromString(S),y;case"clipping":var M=this.attachmentLoader.newClippingAttachment(e,r);if(null==M)return null;var A=this.getValue(t,"end",null);if(null!=A){var R=a.findSlot(A);if(null==R)throw new Error("Clipping end slot not found: "+A);M.endSlot=R}var T=t.vertexCount;this.readVertices(t,M,T<<1);var I=this.getValue(t,"color",null);return null!=I&&M.color.setFromString(I),M}return null},e.readVertices=function(t,e,n){var r=this.scale;e.worldVerticesLength=n;var a=t.vertices;if(n!=a.length){for(var i=new Array,s=new Array,o=0,l=a.length;o<l;){var h=a[o++];s.push(h);for(var u=o+4*h;o<u;o+=4)s.push(a[o]),i.push(a[o+1]*r),i.push(a[o+2]*r),i.push(a[o+3])}e.bones=s,e.vertices=b.toFloatArray(i)}else{var c=b.toFloatArray(a);if(1!=r)for(var d=0,f=a.length;d<f;d++)c[d]*=r;e.vertices=c}},e.readAnimation=function(t,e,n){var r=this.scale,a=new Array,i=0;if(t.slots)for(var s in t.slots){var o=t.slots[s],l=n.findSlotIndex(s);if(-1==l)throw new Error("Slot not found: "+s);for(var h in o){var u=o[h];if("attachment"==h){var c=new st(u.length);c.slotIndex=l;for(var d=0,f=0;f<u.length;f++){var p=u[f];c.setFrame(d++,this.getValue(p,"time",0),p.name)}a.push(c),i=Math.max(i,c.frames[c.getFrameCount()-1])}else if("color"==h){var v=new at(u.length);v.slotIndex=l;for(var g=0,m=0;m<u.length;m++){var w=u[m],x=new E;x.setFromString(w.color),v.setFrame(g,this.getValue(w,"time",0),x.r,x.g,x.b,x.a),this.readCurve(w,v,g),g++}a.push(v),i=Math.max(i,v.frames[(v.getFrameCount()-1)*at.ENTRIES])}else{if("twoColor"!=h)throw new Error("Invalid timeline type for a slot: "+h+" ("+s+")");var y=new it(u.length);y.slotIndex=l;for(var S=0,M=0;M<u.length;M++){var A=u[M],R=new E,T=new E;R.setFromString(A.light),T.setFromString(A.dark),y.setFrame(S,this.getValue(A,"time",0),R.r,R.g,R.b,R.a,T.r,T.g,T.b),this.readCurve(A,y,S),S++}a.push(y),i=Math.max(i,y.frames[(y.getFrameCount()-1)*it.ENTRIES])}}}if(t.bones)for(var I in t.bones){var C=t.bones[I],_=n.findBoneIndex(I);if(-1==_)throw new Error("Bone not found: "+I);for(var k in C){var V=C[k];if("rotate"===k){var P=new tt(V.length);P.boneIndex=_;for(var F=0,N=0;N<V.length;N++){var B=V[N];P.setFrame(F,this.getValue(B,"time",0),this.getValue(B,"angle",0)),this.readCurve(B,P,F),F++}a.push(P),i=Math.max(i,P.frames[(P.getFrameCount()-1)*tt.ENTRIES])}else{if("translate"!==k&&"scale"!==k&&"shear"!==k)throw new Error("Invalid timeline type for a bone: "+k+" ("+I+")");var O=null,D=1,Y=0;"scale"===k?(O=new nt(V.length),Y=1):"shear"===k?O=new rt(V.length):(O=new et(V.length),D=r),O.boneIndex=_;for(var U=0,W=0;W<V.length;W++){var q=V[W],H=this.getValue(q,"x",Y),G=this.getValue(q,"y",Y);O.setFrame(U,this.getValue(q,"time",0),H*D,G*D),this.readCurve(q,O,U),U++}a.push(O),i=Math.max(i,O.frames[(O.getFrameCount()-1)*et.ENTRIES])}}}if(t.ik)for(var j in t.ik){var z=t.ik[j],Z=n.findIkConstraint(j),Q=new ct(z.length);Q.ikConstraintIndex=n.ikConstraints.indexOf(Z);for(var J=0,$=0;$<z.length;$++){var ot=z[$];Q.setFrame(J,this.getValue(ot,"time",0),this.getValue(ot,"mix",1),this.getValue(ot,"softness",0)*r,this.getValue(ot,"bendPositive",!0)?1:-1,this.getValue(ot,"compress",!1),this.getValue(ot,"stretch",!1)),this.readCurve(ot,Q,J),J++}a.push(Q),i=Math.max(i,Q.frames[(Q.getFrameCount()-1)*ct.ENTRIES])}if(t.transform)for(var pt in t.transform){var mt=t.transform[pt],xt=n.findTransformConstraint(pt),Et=new dt(mt.length);Et.transformConstraintIndex=n.transformConstraints.indexOf(xt);for(var yt=0,bt=0;bt<mt.length;bt++){var St=mt[bt];Et.setFrame(yt,this.getValue(St,"time",0),this.getValue(St,"rotateMix",1),this.getValue(St,"translateMix",1),this.getValue(St,"scaleMix",1),this.getValue(St,"shearMix",1)),this.readCurve(St,Et,yt),yt++}a.push(Et),i=Math.max(i,Et.frames[(Et.getFrameCount()-1)*dt.ENTRIES])}if(t.path)for(var Mt in t.path){var At=t.path[Mt],Rt=n.findPathConstraintIndex(Mt);if(-1==Rt)throw new Error("Path constraint not found: "+Mt);var Tt=n.pathConstraints[Rt];for(var It in At){var Ct=At[It];if("position"===It||"spacing"===It){var _t=null,kt=1;"spacing"===It?(_t=new vt(Ct.length),Tt.spacingMode!=X.Length&&Tt.spacingMode!=X.Fixed||(kt=r)):(_t=new ft(Ct.length),Tt.positionMode==L.Fixed&&(kt=r)),_t.pathConstraintIndex=Rt;for(var Vt=0,Pt=0;Pt<Ct.length;Pt++){var Ft=Ct[Pt];_t.setFrame(Vt,this.getValue(Ft,"time",0),this.getValue(Ft,It,0)*kt),this.readCurve(Ft,_t,Vt),Vt++}a.push(_t),i=Math.max(i,_t.frames[(_t.getFrameCount()-1)*ft.ENTRIES])}else if("mix"===It){var Nt=new gt(Ct.length);Nt.pathConstraintIndex=Rt;for(var Bt=0,Ot=0;Ot<Ct.length;Ot++){var Lt=Ct[Ot];Nt.setFrame(Bt,this.getValue(Lt,"time",0),this.getValue(Lt,"rotateMix",1),this.getValue(Lt,"translateMix",1)),this.readCurve(Lt,Nt,Bt),Bt++}a.push(Nt),i=Math.max(i,Nt.frames[(Nt.getFrameCount()-1)*gt.ENTRIES])}}}if(t.deform)for(var Xt in t.deform){var Dt=t.deform[Xt],Yt=n.findSkin(Xt);if(null==Yt)throw new Error("Skin not found: "+Xt);for(var Ut in Dt){var Wt=Dt[Ut],qt=n.findSlotIndex(Ut);if(-1==qt)throw new Error("Slot not found: "+Wt.name);for(var Ht in Wt){var Gt=Wt[Ht],jt=Yt.getAttachment(qt,Ht);if(null==jt)throw new Error("Deform attachment not found: "+Gt.name);var zt=null!=jt.bones,Zt=jt.vertices,Qt=zt?Zt.length/3*2:Zt.length,Jt=new lt(Gt.length);Jt.slotIndex=qt,Jt.attachment=jt;for(var Kt=0,$t=0;$t<Gt.length;$t++){var te=Gt[$t],ee=void 0,ne=this.getValue(te,"vertices",null);if(null==ne)ee=zt?b.newFloatArray(Qt):Zt;else{ee=b.newFloatArray(Qt);var re=this.getValue(te,"offset",0);if(b.arrayCopy(ne,0,ee,re,ne.length),1!=r)for(var ae=re,ie=ae+ne.length;ae<ie;ae++)ee[ae]*=r;if(!zt)for(var se=0;se<Qt;se++)ee[se]+=Zt[se]}Jt.setFrame(Kt,this.getValue(te,"time",0),ee),this.readCurve(te,Jt,Kt),Kt++}a.push(Jt),i=Math.max(i,Jt.frames[Jt.getFrameCount()-1])}}}var oe=t.drawOrder;if(null==oe&&(oe=t.draworder),null!=oe){for(var le=new ut(oe.length),he=n.slots.length,ue=0,ce=0;ce<oe.length;ce++){var de=oe[ce],fe=null,pe=this.getValue(de,"offsets",null);if(null!=pe){fe=b.newArray(he,-1);for(var ve=b.newArray(he-pe.length,0),ge=0,me=0,we=0;we<pe.length;we++){var xe=pe[we],Ee=n.findSlotIndex(xe.slot);if(-1==Ee)throw new Error("Slot not found: "+xe.slot);for(;ge!=Ee;)ve[me++]=ge++;fe[ge+xe.offset]=ge++}for(;ge<he;)ve[me++]=ge++;for(var ye=he-1;ye>=0;ye--)-1==fe[ye]&&(fe[ye]=ve[--me])}le.setFrame(ue++,this.getValue(de,"time",0),fe)}a.push(le),i=Math.max(i,le.frames[le.getFrameCount()-1])}if(t.events){for(var be=new ht(t.events.length),Se=0,Me=0;Me<t.events.length;Me++){var Ae=t.events[Me],Re=n.findEvent(Ae.name);if(null==Re)throw new Error("Event not found: "+Ae.name);var Te=new wt(b.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 K(e,a,i))},e.readCurve=function(t,e,n){if(t.hasOwnProperty("curve"))if("stepped"==t.curve)e.setStepped(n);else{var r=t.curve;e.setCurve(n,r,this.getValue(t,"c2",0),this.getValue(t,"c3",1),this.getValue(t,"c4",1))}},e.getValue=function(t,e,n){return void 0!==t[e]?t[e]:n},t.blendModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return pt.Normal;if("additive"==t)return pt.Additive;if("multiply"==t)return pt.Multiply;if("screen"==t)return pt.Screen;throw new Error("Unknown blend mode: "+t)},t.positionModeFromString=function(t){if("fixed"==(t=t.toLowerCase()))return L.Fixed;if("percent"==t)return L.Percent;throw new Error("Unknown position mode: "+t)},t.spacingModeFromString=function(t){if("length"==(t=t.toLowerCase()))return X.Length;if("fixed"==t)return X.Fixed;if("percent"==t)return X.Percent;throw new Error("Unknown position mode: "+t)},t.rotateModeFromString=function(t){if("tangent"==(t=t.toLowerCase()))return D.Tangent;if("chain"==t)return D.Chain;if("chainscale"==t)return D.ChainScale;throw new Error("Unknown rotate mode: "+t)},t.transformModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return C.Normal;if("onlytranslation"==t)return C.OnlyTranslation;if("norotationorreflection"==t)return C.NoRotationOrReflection;if("noscale"==t)return C.NoScale;if("noscaleorreflection"==t)return C.NoScaleOrReflection;throw new Error("Unknown transform mode: "+t)},t}(),Et=function(t,e,n,r,a){this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritDeform=a};!function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"}(mt||(mt={}));var yt=function(){function t(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}var e=t.prototype;return e.readSkeletonData=function(e){var n=this.scale,r=new B;r.name="";var a=new bt(e);if(r.hash=a.readString(),r.version=a.readString(),"3.8.75"==r.version)throw new Error("Unsupported skeleton data, please export with a newer version of Spine.");r.x=a.readFloat(),r.y=a.readFloat(),r.width=a.readFloat(),r.height=a.readFloat();var i=a.readBoolean();i&&(r.fps=a.readFloat(),r.imagesPath=a.readString(),r.audioPath=a.readString());var s=0;s=a.readInt(!0);for(var o=0;o<s;o++)a.strings.push(a.readString());s=a.readInt(!0);for(var l=0;l<s;l++){var h=a.readString(),u=0==l?null:r.bones[a.readInt(!0)],c=new O(l,h,u);c.rotation=a.readFloat(),c.x=a.readFloat()*n,c.y=a.readFloat()*n,c.scaleX=a.readFloat(),c.scaleY=a.readFloat(),c.shearX=a.readFloat(),c.shearY=a.readFloat(),c.length=a.readFloat()*n,c.transformMode=t.TransformModeValues[a.readInt(!0)],c.skinRequired=a.readBoolean(),i&&E.rgba8888ToColor(c.color,a.readInt32()),r.bones.push(c)}s=a.readInt(!0);for(var d=0;d<s;d++){var f=a.readString(),p=r.bones[a.readInt(!0)],v=new Y(d,f,p);E.rgba8888ToColor(v.color,a.readInt32());var g=a.readInt32();-1!=g&&E.rgb888ToColor(v.darkColor=new E,g),v.attachmentName=a.readStringRef(),v.blendMode=t.BlendModeValues[a.readInt(!0)],r.slots.push(v)}s=a.readInt(!0);for(var m,w=0;w<s;w++){var x=new W(a.readString());x.order=a.readInt(!0),x.skinRequired=a.readBoolean(),m=a.readInt(!0);for(var y=0;y<m;y++)x.bones.push(r.bones[a.readInt(!0)]);x.target=r.bones[a.readInt(!0)],x.mix=a.readFloat(),x.softness=a.readFloat()*n,x.bendDirection=a.readByte(),x.compress=a.readBoolean(),x.stretch=a.readBoolean(),x.uniform=a.readBoolean(),r.ikConstraints.push(x)}s=a.readInt(!0);for(var S,M=0;M<s;M++){var A=new q(a.readString());A.order=a.readInt(!0),A.skinRequired=a.readBoolean(),S=a.readInt(!0);for(var R=0;R<S;R++)A.bones.push(r.bones[a.readInt(!0)]);A.target=r.bones[a.readInt(!0)],A.local=a.readBoolean(),A.relative=a.readBoolean(),A.offsetRotation=a.readFloat(),A.offsetX=a.readFloat()*n,A.offsetY=a.readFloat()*n,A.offsetScaleX=a.readFloat(),A.offsetScaleY=a.readFloat(),A.offsetShearY=a.readFloat(),A.rotateMix=a.readFloat(),A.translateMix=a.readFloat(),A.scaleMix=a.readFloat(),A.shearMix=a.readFloat(),r.transformConstraints.push(A)}s=a.readInt(!0);for(var T,I=0;I<s;I++){var C=new H(a.readString());C.order=a.readInt(!0),C.skinRequired=a.readBoolean(),T=a.readInt(!0);for(var _=0;_<T;_++)C.bones.push(r.bones[a.readInt(!0)]);C.target=r.slots[a.readInt(!0)],C.positionMode=t.PositionModeValues[a.readInt(!0)],C.spacingMode=t.SpacingModeValues[a.readInt(!0)],C.rotateMode=t.RotateModeValues[a.readInt(!0)],C.offsetRotation=a.readFloat(),C.position=a.readFloat(),C.positionMode==L.Fixed&&(C.position*=n),C.spacing=a.readFloat(),C.spacingMode!=X.Length&&C.spacingMode!=X.Fixed||(C.spacing*=n),C.rotateMix=a.readFloat(),C.translateMix=a.readFloat(),r.pathConstraints.push(C)}var k=this.readSkin(a,r,!0,i);null!=k&&(r.defaultSkin=k,r.skins.push(k));var V=r.skins.length;for(b.setArraySize(r.skins,s=V+a.readInt(!0));V<s;V++)r.skins[V]=this.readSkin(a,r,!1,i);s=this.linkedMeshes.length;for(var P=0;P<s;P++){var F=this.linkedMeshes[P],N=null==F.skin?r.defaultSkin:r.findSkin(F.skin);if(null==N)throw new Error("Skin not found: "+F.skin);var D=N.getAttachment(F.slotIndex,F.parent);if(null==D)throw new Error("Parent mesh not found: "+F.parent);F.mesh.deformAttachment=F.inheritDeform?D:F.mesh,F.mesh.setParentMesh(D),F.mesh.updateUVs()}this.linkedMeshes.length=0,s=a.readInt(!0);for(var U=0;U<s;U++){var G=new J(a.readStringRef());G.intValue=a.readInt(!1),G.floatValue=a.readFloat(),G.stringValue=a.readString(),G.audioPath=a.readString(),null!=G.audioPath&&(G.volume=a.readFloat(),G.balance=a.readFloat()),r.events.push(G)}s=a.readInt(!0);for(var j=0;j<s;j++)r.animations.push(this.readAnimation(a,a.readString(),r));return r},e.readSkin=function(t,e,n,r){var a=null,i=0;if(n){if(0==(i=t.readInt(!0)))return null;a=new Q("default")}else{(a=new Q(t.readStringRef())).bones.length=t.readInt(!0);for(var s=0,o=a.bones.length;s<o;s++)a.bones[s]=e.bones[t.readInt(!0)];for(var l=0,h=t.readInt(!0);l<h;l++)a.constraints.push(e.ikConstraints[t.readInt(!0)]);for(var u=0,c=t.readInt(!0);u<c;u++)a.constraints.push(e.transformConstraints[t.readInt(!0)]);for(var d=0,f=t.readInt(!0);d<f;d++)a.constraints.push(e.pathConstraints[t.readInt(!0)]);i=t.readInt(!0)}for(var p=0;p<i;p++)for(var v=t.readInt(!0),g=0,m=t.readInt(!0);g<m;g++){var w=t.readStringRef(),x=this.readAttachment(t,e,a,v,w,r);null!=x&&a.setAttachment(v,w,x)}return a},e.readAttachment=function(e,n,r,a,i,s){var o=this.scale,l=e.readStringRef();null==l&&(l=i);var h=e.readByte();switch(t.AttachmentTypeValues[h]){case mt.Region:var u=e.readStringRef(),c=e.readFloat(),d=e.readFloat(),f=e.readFloat(),p=e.readFloat(),v=e.readFloat(),g=e.readFloat(),m=e.readFloat(),w=e.readInt32();null==u&&(u=l);var x=this.attachmentLoader.newRegionAttachment(r,l,u);return null==x?null:(x.path=u,x.x=d*o,x.y=f*o,x.scaleX=p,x.scaleY=v,x.rotation=c,x.width=g*o,x.height=m*o,E.rgba8888ToColor(x.color,w),x.updateOffset(),x);case mt.BoundingBox:var y=e.readInt(!0),S=this.readVertices(e,y),M=s?e.readInt32():0,A=this.attachmentLoader.newBoundingBoxAttachment(r,l);return null==A?null:(A.worldVerticesLength=y<<1,A.vertices=S.vertices,A.bones=S.bones,s&&E.rgba8888ToColor(A.color,M),A);case mt.Mesh:var R=e.readStringRef(),T=e.readInt32(),I=e.readInt(!0),C=this.readFloatArray(e,I<<1,1),_=this.readShortArray(e),k=this.readVertices(e,I),V=e.readInt(!0),P=null,F=0,N=0;s&&(P=this.readShortArray(e),F=e.readFloat(),N=e.readFloat()),null==R&&(R=l);var B=this.attachmentLoader.newMeshAttachment(r,l,R);return null==B?null:(B.path=R,E.rgba8888ToColor(B.color,T),B.bones=k.bones,B.vertices=k.vertices,B.worldVerticesLength=I<<1,B.triangles=_,B.regionUVs=C,B.updateUVs(),B.hullLength=V<<1,s&&(B.edges=P,B.width=F*o,B.height=N*o),B);case mt.LinkedMesh:var O=e.readStringRef(),L=e.readInt32(),X=e.readStringRef(),D=e.readStringRef(),Y=e.readBoolean(),U=0,W=0;s&&(U=e.readFloat(),W=e.readFloat()),null==O&&(O=l);var q=this.attachmentLoader.newMeshAttachment(r,l,O);return null==q?null:(q.path=O,E.rgba8888ToColor(q.color,L),s&&(q.width=U*o,q.height=W*o),this.linkedMeshes.push(new St(q,X,a,D,Y)),q);case mt.Path:for(var H=e.readBoolean(),G=e.readBoolean(),j=e.readInt(!0),z=this.readVertices(e,j),Z=b.newArray(j/3,0),Q=0,J=Z.length;Q<J;Q++)Z[Q]=e.readFloat()*o;var K=s?e.readInt32():0,$=this.attachmentLoader.newPathAttachment(r,l);return null==$?null:($.closed=H,$.constantSpeed=G,$.worldVerticesLength=j<<1,$.vertices=z.vertices,$.bones=z.bones,$.lengths=Z,s&&E.rgba8888ToColor($.color,K),$);case mt.Point:var tt=e.readFloat(),et=e.readFloat(),nt=e.readFloat(),rt=s?e.readInt32():0,at=this.attachmentLoader.newPointAttachment(r,l);return null==at?null:(at.x=et*o,at.y=nt*o,at.rotation=tt,s&&E.rgba8888ToColor(at.color,rt),at);case mt.Clipping:var it=e.readInt(!0),st=e.readInt(!0),ot=this.readVertices(e,st),lt=s?e.readInt32():0,ht=this.attachmentLoader.newClippingAttachment(r,l);return null==ht?null:(ht.endSlot=n.slots[it],ht.worldVerticesLength=st<<1,ht.vertices=ot.vertices,ht.bones=ot.bones,s&&E.rgba8888ToColor(ht.color,lt),ht)}return null},e.readVertices=function(t,e){var n=e<<1,r=new Mt,a=this.scale;if(!t.readBoolean())return r.vertices=this.readFloatArray(t,n,a),r;for(var i=new Array,s=new Array,o=0;o<e;o++){var l=t.readInt(!0);s.push(l);for(var h=0;h<l;h++)s.push(t.readInt(!0)),i.push(t.readFloat()*a),i.push(t.readFloat()*a),i.push(t.readFloat())}return r.vertices=b.toFloatArray(i),r.bones=s,r},e.readFloatArray=function(t,e,n){var r=new Array(e);if(1==n)for(var a=0;a<e;a++)r[a]=t.readFloat();else for(var i=0;i<e;i++)r[i]=t.readFloat()*n;return r},e.readShortArray=function(t){for(var e=t.readInt(!0),n=new Array(e),r=0;r<e;r++)n[r]=t.readShort();return n},e.readAnimation=function(e,n,r){for(var a=new Array,i=this.scale,s=0,o=new E,l=new E,h=0,u=e.readInt(!0);h<u;h++)for(var c=e.readInt(!0),d=0,f=e.readInt(!0);d<f;d++){var p=e.readByte(),v=e.readInt(!0);switch(p){case t.SLOT_ATTACHMENT:var g=new st(v);g.slotIndex=c;for(var m=0;m<v;m++)g.setFrame(m,e.readFloat(),e.readStringRef());a.push(g),s=Math.max(s,g.frames[v-1]);break;case t.SLOT_COLOR:var w=new at(v);w.slotIndex=c;for(var x=0;x<v;x++){var y=e.readFloat();E.rgba8888ToColor(o,e.readInt32()),w.setFrame(x,y,o.r,o.g,o.b,o.a),x<v-1&&this.readCurve(e,x,w)}a.push(w),s=Math.max(s,w.frames[(v-1)*at.ENTRIES]);break;case t.SLOT_TWO_COLOR:var S=new it(v);S.slotIndex=c;for(var M=0;M<v;M++){var A=e.readFloat();E.rgba8888ToColor(o,e.readInt32()),E.rgb888ToColor(l,e.readInt32()),S.setFrame(M,A,o.r,o.g,o.b,o.a,l.r,l.g,l.b),M<v-1&&this.readCurve(e,M,S)}a.push(S),s=Math.max(s,S.frames[(v-1)*it.ENTRIES])}}for(var R=0,T=e.readInt(!0);R<T;R++)for(var I=e.readInt(!0),C=0,_=e.readInt(!0);C<_;C++){var k=e.readByte(),V=e.readInt(!0);switch(k){case t.BONE_ROTATE:var P=new tt(V);P.boneIndex=I;for(var F=0;F<V;F++)P.setFrame(F,e.readFloat(),e.readFloat()),F<V-1&&this.readCurve(e,F,P);a.push(P),s=Math.max(s,P.frames[(V-1)*tt.ENTRIES]);break;case t.BONE_TRANSLATE:case t.BONE_SCALE:case t.BONE_SHEAR:var N=void 0,B=1;k==t.BONE_SCALE?N=new nt(V):k==t.BONE_SHEAR?N=new rt(V):(N=new et(V),B=i),N.boneIndex=I;for(var O=0;O<V;O++)N.setFrame(O,e.readFloat(),e.readFloat()*B,e.readFloat()*B),O<V-1&&this.readCurve(e,O,N);a.push(N),s=Math.max(s,N.frames[(V-1)*et.ENTRIES])}}for(var D=0,Y=e.readInt(!0);D<Y;D++){var U=e.readInt(!0),W=e.readInt(!0),q=new ct(W);q.ikConstraintIndex=U;for(var H=0;H<W;H++)q.setFrame(H,e.readFloat(),e.readFloat(),e.readFloat()*i,e.readByte(),e.readBoolean(),e.readBoolean()),H<W-1&&this.readCurve(e,H,q);a.push(q),s=Math.max(s,q.frames[(W-1)*ct.ENTRIES])}for(var G=0,j=e.readInt(!0);G<j;G++){var z=e.readInt(!0),Z=e.readInt(!0),Q=new dt(Z);Q.transformConstraintIndex=z;for(var J=0;J<Z;J++)Q.setFrame(J,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat()),J<Z-1&&this.readCurve(e,J,Q);a.push(Q),s=Math.max(s,Q.frames[(Z-1)*dt.ENTRIES])}for(var $=0,ot=e.readInt(!0);$<ot;$++)for(var pt=e.readInt(!0),mt=r.pathConstraints[pt],xt=0,Et=e.readInt(!0);xt<Et;xt++){var yt=e.readByte(),bt=e.readInt(!0);switch(yt){case t.PATH_POSITION:case t.PATH_SPACING:var St=void 0,Mt=1;yt==t.PATH_SPACING?(St=new vt(bt),mt.spacingMode!=X.Length&&mt.spacingMode!=X.Fixed||(Mt=i)):(St=new ft(bt),mt.positionMode==L.Fixed&&(Mt=i)),St.pathConstraintIndex=pt;for(var At=0;At<bt;At++)St.setFrame(At,e.readFloat(),e.readFloat()*Mt),At<bt-1&&this.readCurve(e,At,St);a.push(St),s=Math.max(s,St.frames[(bt-1)*ft.ENTRIES]);break;case t.PATH_MIX:var Rt=new gt(bt);Rt.pathConstraintIndex=pt;for(var Tt=0;Tt<bt;Tt++)Rt.setFrame(Tt,e.readFloat(),e.readFloat(),e.readFloat()),Tt<bt-1&&this.readCurve(e,Tt,Rt);a.push(Rt),s=Math.max(s,Rt.frames[(bt-1)*gt.ENTRIES])}}for(var It=0,Ct=e.readInt(!0);It<Ct;It++)for(var _t=r.skins[e.readInt(!0)],kt=0,Vt=e.readInt(!0);kt<Vt;kt++)for(var Pt=e.readInt(!0),Ft=0,Nt=e.readInt(!0);Ft<Nt;Ft++){var Bt=_t.getAttachment(Pt,e.readStringRef()),Ot=null!=Bt.bones,Lt=Bt.vertices,Xt=Ot?Lt.length/3*2:Lt.length,Dt=e.readInt(!0),Yt=new lt(Dt);Yt.slotIndex=Pt,Yt.attachment=Bt;for(var Ut=0;Ut<Dt;Ut++){var Wt=e.readFloat(),qt=void 0,Ht=e.readInt(!0);if(0==Ht)qt=Ot?b.newFloatArray(Xt):Lt;else{qt=b.newFloatArray(Xt);var Gt=e.readInt(!0);if(Ht+=Gt,1==i)for(var jt=Gt;jt<Ht;jt++)qt[jt]=e.readFloat();else for(var zt=Gt;zt<Ht;zt++)qt[zt]=e.readFloat()*i;if(!Ot)for(var Zt=0,Qt=qt.length;Zt<Qt;Zt++)qt[Zt]+=Lt[Zt]}Yt.setFrame(Ut,Wt,qt),Ut<Dt-1&&this.readCurve(e,Ut,Yt)}a.push(Yt),s=Math.max(s,Yt.frames[Dt-1])}var Jt=e.readInt(!0);if(Jt>0){for(var Kt=new ut(Jt),$t=r.slots.length,te=0;te<Jt;te++){for(var ee=e.readFloat(),ne=e.readInt(!0),re=b.newArray($t,0),ae=$t-1;ae>=0;ae--)re[ae]=-1;for(var ie=b.newArray($t-ne,0),se=0,oe=0,le=0;le<ne;le++){for(var he=e.readInt(!0);se!=he;)ie[oe++]=se++;re[se+e.readInt(!0)]=se++}for(;se<$t;)ie[oe++]=se++;for(var ue=$t-1;ue>=0;ue--)-1==re[ue]&&(re[ue]=ie[--oe]);Kt.setFrame(te,ee,re)}a.push(Kt),s=Math.max(s,Kt.frames[Jt-1])}var ce=e.readInt(!0);if(ce>0){for(var de=new ht(ce),fe=0;fe<ce;fe++){var pe=e.readFloat(),ve=r.events[e.readInt(!0)],ge=new wt(pe,ve);ge.intValue=e.readInt(!1),ge.floatValue=e.readFloat(),ge.stringValue=e.readBoolean()?e.readString():ve.stringValue,null!=ge.data.audioPath&&(ge.volume=e.readFloat(),ge.balance=e.readFloat()),de.setFrame(fe,ge)}a.push(de),s=Math.max(s,de.frames[ce-1])}return new K(n,a,s)},e.readCurve=function(e,n,r){switch(e.readByte()){case t.CURVE_STEPPED:r.setStepped(n);break;case t.CURVE_BEZIER:this.setCurve(r,n,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat())}},e.setCurve=function(t,e,n,r,a,i){t.setCurve(e,n,r,a,i)},t}();yt.AttachmentTypeValues=[0,1,2,3,4,5,6],yt.TransformModeValues=[C.Normal,C.OnlyTranslation,C.NoRotationOrReflection,C.NoScale,C.NoScaleOrReflection],yt.PositionModeValues=[L.Fixed,L.Percent],yt.SpacingModeValues=[X.Length,X.Fixed,X.Percent],yt.RotateModeValues=[D.Tangent,D.Chain,D.ChainScale],yt.BlendModeValues=[pt.Normal,pt.Additive,pt.Multiply,pt.Screen],yt.BONE_ROTATE=0,yt.BONE_TRANSLATE=1,yt.BONE_SCALE=2,yt.BONE_SHEAR=3,yt.SLOT_ATTACHMENT=0,yt.SLOT_COLOR=1,yt.SLOT_TWO_COLOR=2,yt.PATH_POSITION=0,yt.PATH_SPACING=1,yt.PATH_MIX=2,yt.CURVE_LINEAR=0,yt.CURVE_STEPPED=1,yt.CURVE_BEZIER=2;var bt=function(){function t(t,e,n,r){void 0===e&&(e=new Array),void 0===n&&(n=0),void 0===r&&(r=new DataView(t.buffer)),this.strings=e,this.index=n,this.buffer=r}var e=t.prototype;return e.readByte=function(){return this.buffer.getInt8(this.index++)},e.readShort=function(){var t=this.buffer.getInt16(this.index);return this.index+=2,t},e.readInt32=function(){var t=this.buffer.getInt32(this.index);return this.index+=4,t},e.readInt=function(t){var e=this.readByte(),n=127&e;return 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}(),St=function(t,e,n,r,a){this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritDeform=a},Mt=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e};function At(){return At=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},At.apply(this,arguments)}var Rt=function(){function t(t,e,n){if(this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.sorted=!1,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=n,this.setToSetupPose()}var e=t.prototype;return e.isActive=function(){return this.active},e.update=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.updateWorldTransform=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.updateWorldTransformWith=function(t,e,n,r,a,i,s){this.ax=t,this.ay=e,this.arotation=n,this.ascaleX=r,this.ascaleY=a,this.ashearX=i,this.ashearY=s,this.appliedValid=!0;var o=this.parent;if(null==o){var l=this.skeleton,h=n+90+s,u=l.scaleX,c=l.scaleY;return this.a=y.cosDeg(n+i)*r*u,this.b=y.cosDeg(h)*a*u,this.c=y.sinDeg(n+i)*r*c,this.d=y.sinDeg(h)*a*c,this.worldX=t*u+l.x,void(this.worldY=e*c+l.y)}var d=o.a,f=o.b,p=o.c,v=o.d;switch(this.worldX=d*t+f*e+o.worldX,this.worldY=p*t+v*e+o.worldY,this.data.transformMode){case C.Normal:var g=n+90+s,m=y.cosDeg(n+i)*r,w=y.cosDeg(g)*a,x=y.sinDeg(n+i)*r,E=y.sinDeg(g)*a;return this.a=d*m+f*x,this.b=d*w+f*E,this.c=p*m+v*x,void(this.d=p*w+v*E);case C.OnlyTranslation:var b=n+90+s;this.a=y.cosDeg(n+i)*r,this.b=y.cosDeg(b)*a,this.c=y.sinDeg(n+i)*r,this.d=y.sinDeg(b)*a;break;case C.NoRotationOrReflection:var S=d*d+p*p,M=0;S>1e-4?(S=Math.abs(d*v-f*p)/S,d/=this.skeleton.scaleX,f=(p/=this.skeleton.scaleY)*S,v=d*S,M=Math.atan2(p,d)*y.radDeg):(d=0,p=0,M=90-Math.atan2(v,f)*y.radDeg);var A=n+i-M,R=n+s-M+90,T=y.cosDeg(A)*r,I=y.cosDeg(R)*a,_=y.sinDeg(A)*r,k=y.sinDeg(R)*a;this.a=d*T-f*_,this.b=d*I-f*k,this.c=p*T+v*_,this.d=p*I+v*k;break;case C.NoScale:case C.NoScaleOrReflection:var V=y.cosDeg(n),P=y.sinDeg(n),F=(d*V+f*P)/this.skeleton.scaleX,N=(p*V+v*P)/this.skeleton.scaleY,B=Math.sqrt(F*F+N*N);B>1e-5&&(B=1/B),F*=B,N*=B,B=Math.sqrt(F*F+N*N),this.data.transformMode==C.NoScale&&d*v-f*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(B=-B);var O=Math.PI/2+Math.atan2(N,F),L=Math.cos(O)*B,X=Math.sin(O)*B,D=y.cosDeg(i)*r,Y=y.cosDeg(90+s)*a,U=y.sinDeg(i)*r,W=y.sinDeg(90+s)*a;this.a=F*D+L*U,this.b=F*Y+L*W,this.c=N*D+X*U,this.d=N*Y+X*W}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY},e.setToSetupPose=function(){var t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY},e.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*y.radDeg},e.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*y.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)*y.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)*y.radDeg);var e=t.a,n=t.b,r=t.c,a=t.d,i=1/(e*a-n*r),s=this.worldX-t.worldX,o=this.worldY-t.worldY;this.ax=s*a*i-o*n*i,this.ay=o*e*i-s*r*i;var l=i*a,h=i*e,u=i*n,c=i*r,d=l*this.a-u*this.c,f=l*this.b-u*this.d,p=h*this.c-c*this.a,v=h*this.d-c*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+p*p),this.ascaleX>1e-4){var g=d*v-f*p;this.ascaleY=g/this.ascaleX,this.ashearY=Math.atan2(d*f+p*v,g)*y.radDeg,this.arotation=Math.atan2(p,d)*y.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+v*v),this.ashearY=0,this.arotation=90-Math.atan2(v,f)*y.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=y.sinDeg(t),n=y.cosDeg(t);return Math.atan2(this.a*e-this.c*n,this.d*n-this.b*e)*y.radDeg+this.rotation-this.shearX},e.localToWorldRotation=function(t){t-=this.rotation-this.shearX;var e=y.sinDeg(t),n=y.cosDeg(t);return Math.atan2(n*this.c+e*this.d,n*this.a+e*this.b)*y.radDeg},e.rotateWorld=function(t){var e=this.a,n=this.b,r=this.c,a=this.d,i=y.cosDeg(t),s=y.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}(),Tt=function(){function t(t,e){if(this.deform=new Array,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new E,this.darkColor=null==t.darkColor?null:new E,this.setToSetupPose()}var e=t.prototype;return e.getSkeleton=function(){return this.bone.skeleton},e.getAttachment=function(){return this.attachment},e.setAttachment=function(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.deform.length=0)},e.setAttachmentTime=function(t){this.attachmentTime=this.bone.skeleton.time-t},e.getAttachmentTime=function(){return this.bone.skeleton.time-this.attachmentTime},e.setToSetupPose=function(){this.color.setFromColor(this.data.color),null!=this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),null==this.data.attachmentName?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))},t}(),It=function(){function t(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(var n=0;n<t.bones.length;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findBone(t.target.name)}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){var t=this.target,e=this.bones;switch(e.length){case 1:this.apply1(e[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.softness,this.mix)}},e.apply1=function(t,e,n,r,a,i,s){t.appliedValid||t.updateAppliedTransform();var o=t.parent,l=o.a,h=o.b,u=o.c,c=o.d,d=-t.ashearX-t.arotation,f=0,p=0;switch(t.data.transformMode){case C.OnlyTranslation:f=e-t.worldX,p=n-t.worldY;break;case C.NoRotationOrReflection:var v=Math.abs(l*c-h*u)/(l*l+u*u),g=l/t.skeleton.scaleX,m=u/t.skeleton.scaleY;h=-m*v*t.skeleton.scaleX,c=g*v*t.skeleton.scaleY,d+=Math.atan2(m,g)*y.radDeg;default:var w=e-o.worldX,x=n-o.worldY,E=l*c-h*u;f=(w*c-x*h)/E-t.ax,p=(x*l-w*u)/E-t.ay}d+=Math.atan2(p,f)*y.radDeg,t.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);var b=t.ascaleX,S=t.ascaleY;if(r||a){switch(t.data.transformMode){case C.NoScale:case C.NoScaleOrReflection:f=e-t.worldX,p=n-t.worldY}var M=t.data.length*b,A=Math.sqrt(f*f+p*p);if(r&&A<M||a&&A>M&&M>1e-4){var R=(A/M-1)*s+1;b*=R,i&&(S*=R)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+d*s,b,S,t.ashearX,t.ashearY)},e.apply2=function(t,e,n,r,a,i,s,o){if(0!=o){t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();var l=t.ax,h=t.ay,u=t.ascaleX,c=u,d=t.ascaleY,f=e.ascaleX,p=0,v=0,g=0;u<0?(u=-u,p=180,g=-1):(p=0,g=1),d<0&&(d=-d,g=-g),f<0?(f=-f,v=180):v=0;var m=e.ax,w=0,x=0,E=0,b=t.a,S=t.b,M=t.c,A=t.d,R=Math.abs(u-d)<=1e-4;R?(x=b*m+S*(w=e.ay)+t.worldX,E=M*m+A*w+t.worldY):(w=0,x=b*m+t.worldX,E=M*m+t.worldY);var T=t.parent;b=T.a,S=T.b,M=T.c;var I,C,_=1/(b*(A=T.d)-S*M),k=x-T.worldX,V=E-T.worldY,P=(k*A-V*S)*_-l,F=(V*b-k*M)*_-h,N=Math.sqrt(P*P+F*F),B=e.data.length*f;if(N<1e-4)return this.apply1(t,n,r,!1,i,!1,o),void e.updateWorldTransformWith(m,w,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);var O=((k=n-T.worldX)*A-(V=r-T.worldY)*S)*_-l,L=(V*b-k*M)*_-h,X=O*O+L*L;if(0!=s){s*=u*(f+1)/2;var D=Math.sqrt(X),Y=D-N-B*u+s;if(Y>0){var U=Math.min(1,Y/(2*s))-1;X=(O-=(U=(Y-s*(1-U*U))/D)*O)*O+(L-=U*L)*L}}t:if(R){var W=(X-N*N-(B*=u)*B)/(2*N*B);W<-1?W=-1:W>1&&(W=1,i&&(c*=(Math.sqrt(X)/(N+B)-1)*o+1)),C=Math.acos(W)*a,b=N+B*W,S=B*Math.sin(C),I=Math.atan2(L*b-O*S,O*b+L*S)}else{var q=(b=u*B)*b,H=(S=d*B)*S,G=Math.atan2(L,O),j=-2*H*N,z=H-q;if((A=j*j-4*z*(M=H*N*N+q*X-q*H))>=0){var Z=Math.sqrt(A);j<0&&(Z=-Z);var Q=(Z=-(j+Z)/2)/z,J=M/Z,K=Math.abs(Q)<Math.abs(J)?Q:J;if(K*K<=X){V=Math.sqrt(X-K*K)*a,I=G-Math.atan2(V,K),C=Math.atan2(V/d,(K-N)/u);break t}}var $=y.PI,tt=N-b,et=tt*tt,nt=0,rt=0,at=N+b,it=at*at,st=0;(M=-b*N/(q-H))>=-1&&M<=1&&(M=Math.acos(M),(A=(k=b*Math.cos(M)+N)*k+(V=S*Math.sin(M))*V)<et&&($=M,et=A,tt=k,nt=V),A>it&&(rt=M,it=A,at=k,st=V)),X<=(et+it)/2?(I=G-Math.atan2(nt*a,tt),C=$*a):(I=G-Math.atan2(st*a,at),C=rt*a)}var ot=Math.atan2(w,m)*g,lt=t.arotation;(I=(I-ot)*y.radDeg+p-lt)>180?I-=360:I<-180&&(I+=360),t.updateWorldTransformWith(l,h,lt+I*o,c,t.ascaleY,0,0),lt=e.arotation,(C=((C+ot)*y.radDeg-e.ashearX)*g+v-lt)>180?C-=360:C<-180&&(C+=360),e.updateWorldTransformWith(m,w,lt+C*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}else e.updateWorldTransform()},t}(),Ct=function(){function t(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new M,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(var n=0;n<t.bones.length;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findBone(t.target.name)}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld()},e.applyAbsoluteWorld=function(){for(var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target,i=a.a,s=a.b,o=a.c,l=a.d,h=i*l-s*o>0?y.degRad:-y.degRad,u=this.data.offsetRotation*h,c=this.data.offsetShearY*h,d=this.bones,f=0,p=d.length;f<p;f++){var v=d[f],g=!1;if(0!=t){var m=v.a,w=v.b,x=v.c,E=v.d,b=Math.atan2(o,i)-Math.atan2(x,m)+u;b>y.PI?b-=y.PI2:b<-y.PI&&(b+=y.PI2),b*=t;var S=Math.cos(b),M=Math.sin(b);v.a=S*m-M*x,v.b=S*w-M*E,v.c=M*m+S*x,v.d=M*w+S*E,g=!0}if(0!=e){var A=this.temp;a.localToWorld(A.set(this.data.offsetX,this.data.offsetY)),v.worldX+=(A.x-v.worldX)*e,v.worldY+=(A.y-v.worldY)*e,g=!0}if(n>0){var R=Math.sqrt(v.a*v.a+v.c*v.c),T=Math.sqrt(i*i+o*o);R>1e-5&&(R=(R+(T-R+this.data.offsetScaleX)*n)/R),v.a*=R,v.c*=R,R=Math.sqrt(v.b*v.b+v.d*v.d),T=Math.sqrt(s*s+l*l),R>1e-5&&(R=(R+(T-R+this.data.offsetScaleY)*n)/R),v.b*=R,v.d*=R,g=!0}if(r>0){var I=v.b,C=v.d,_=Math.atan2(C,I),k=Math.atan2(l,s)-Math.atan2(o,i)-(_-Math.atan2(v.c,v.a));k>y.PI?k-=y.PI2:k<-y.PI&&(k+=y.PI2),k=_+(k+c)*r;var V=Math.sqrt(I*I+C*C);v.b=Math.cos(k)*V,v.d=Math.sin(k)*V,g=!0}g&&(v.appliedValid=!1)}},e.applyRelativeWorld=function(){for(var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target,i=a.a,s=a.b,o=a.c,l=a.d,h=i*l-s*o>0?y.degRad:-y.degRad,u=this.data.offsetRotation*h,c=this.data.offsetShearY*h,d=this.bones,f=0,p=d.length;f<p;f++){var v=d[f],g=!1;if(0!=t){var m=v.a,w=v.b,x=v.c,E=v.d,b=Math.atan2(o,i)+u;b>y.PI?b-=y.PI2:b<-y.PI&&(b+=y.PI2),b*=t;var S=Math.cos(b),M=Math.sin(b);v.a=S*m-M*x,v.b=S*w-M*E,v.c=M*m+S*x,v.d=M*w+S*E,g=!0}if(0!=e){var A=this.temp;a.localToWorld(A.set(this.data.offsetX,this.data.offsetY)),v.worldX+=A.x*e,v.worldY+=A.y*e,g=!0}if(n>0){var R=(Math.sqrt(i*i+o*o)-1+this.data.offsetScaleX)*n+1;v.a*=R,v.c*=R,R=(Math.sqrt(s*s+l*l)-1+this.data.offsetScaleY)*n+1,v.b*=R,v.d*=R,g=!0}if(r>0){var T=Math.atan2(l,s)-Math.atan2(o,i);T>y.PI?T-=y.PI2:T<-y.PI&&(T+=y.PI2);var I=v.b,C=v.d;T=Math.atan2(C,I)+(T-y.PI/2+c)*r;var _=Math.sqrt(I*I+C*C);v.b=Math.cos(T)*_,v.d=Math.sin(T)*_,g=!0}g&&(v.appliedValid=!1)}},e.applyAbsoluteLocal=function(){var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,s=0,o=i.length;s<o;s++){var l=i[s];l.appliedValid||l.updateAppliedTransform();var h=l.arotation;if(0!=t){var u=a.arotation-h+this.data.offsetRotation;h+=(u-=360*(16384-(16384.499999999996-u/360|0)))*t}var c=l.ax,d=l.ay;0!=e&&(c+=(a.ax-c+this.data.offsetX)*e,d+=(a.ay-d+this.data.offsetY)*e);var f=l.ascaleX,p=l.ascaleY;0!=n&&(f>1e-5&&(f=(f+(a.ascaleX-f+this.data.offsetScaleX)*n)/f),p>1e-5&&(p=(p+(a.ascaleY-p+this.data.offsetScaleY)*n)/p));var v=l.ashearY;if(0!=r){var g=a.ashearY-v+this.data.offsetShearY;g-=360*(16384-(16384.499999999996-g/360|0)),l.shearY+=g*r}l.updateWorldTransformWith(c,d,h,f,p,l.ashearX,v)}},e.applyRelativeLocal=function(){var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,s=0,o=i.length;s<o;s++){var l=i[s];l.appliedValid||l.updateAppliedTransform();var h=l.arotation;0!=t&&(h+=(a.arotation+this.data.offsetRotation)*t);var u=l.ax,c=l.ay;0!=e&&(u+=(a.ax+this.data.offsetX)*e,c+=(a.ay+this.data.offsetY)*e);var d=l.ascaleX,f=l.ascaleY;0!=n&&(d>1e-5&&(d*=(a.ascaleX-1+this.data.offsetScaleX)*n+1),f>1e-5&&(f*=(a.ascaleY-1+this.data.offsetScaleY)*n+1));var p=l.ashearY;0!=r&&(p+=(a.ashearY+this.data.offsetShearY)*r),l.updateWorldTransformWith(u,c,h,d,f,l.ashearX,p)}},t}(),_t=function(){function t(t,e){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(var n=0,r=t.bones.length;n<r;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findSlot(t.target.name),this.position=t.position,this.spacing=t.spacing,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){var e=this.target.getAttachment();if(I(e,V)){var n=this.rotateMix,r=this.translateMix,a=n>0;if(r>0||a){var i=this.data,s=i.spacingMode==X.Percent,o=i.rotateMode,l=o==D.Tangent,h=o==D.ChainScale,u=this.bones.length,c=l?u:u+1,d=this.bones,f=b.setArraySize(this.spaces,c),p=null,v=this.spacing;if(h||!s){h&&(p=b.setArraySize(this.lengths,u));for(var g=i.spacingMode==X.Length,m=0,w=c-1;m<w;){var x=d[m],E=x.data.length;if(E<t.epsilon)h&&(p[m]=0),f[++m]=0;else if(s){if(h){var S=E*x.a,M=E*x.c,A=Math.sqrt(S*S+M*M);p[m]=A}f[++m]=v}else{var R=E*x.a,T=E*x.c,C=Math.sqrt(R*R+T*T);h&&(p[m]=C),f[++m]=(g?E+v:v)*C/E}}}else for(var _=1;_<c;_++)f[_]=v;var k=this.computeWorldPositions(e,c,l,i.positionMode==L.Percent,s),P=k[0],F=k[1],N=i.offsetRotation,B=!1;if(0==N)B=o==D.Chain;else{B=!1;var O=this.target.bone;N*=O.a*O.d-O.b*O.c>0?y.degRad:-y.degRad}for(var Y=0,U=3;Y<u;Y++,U+=3){var W=d[Y];W.worldX+=(P-W.worldX)*r,W.worldY+=(F-W.worldY)*r;var q=k[U],H=k[U+1],G=q-P,j=H-F;if(h){var z=p[Y];if(0!=z){var Z=(Math.sqrt(G*G+j*j)/z-1)*n+1;W.a*=Z,W.c*=Z}}if(P=q,F=H,a){var Q=W.a,J=W.b,K=W.c,$=W.d,tt=0,et=0,nt=0;if(tt=l?k[U-1]:0==f[Y+1]?k[U+2]:Math.atan2(j,G),tt-=Math.atan2(K,Q),B){et=Math.cos(tt),nt=Math.sin(tt);var rt=W.data.length;P+=(rt*(et*Q-nt*K)-G)*n,F+=(rt*(nt*Q+et*K)-j)*n}else tt+=N;tt>y.PI?tt-=y.PI2:tt<-y.PI&&(tt+=y.PI2),tt*=n,et=Math.cos(tt),nt=Math.sin(tt),W.a=et*Q-nt*K,W.b=et*J-nt*$,W.c=nt*Q+et*K,W.d=nt*J+et*$}W.appliedValid=!1}}}},e.computeWorldPositions=function(e,n,r,a,i){var s=this.target,o=this.position,l=this.spaces,h=b.setArraySize(this.positions,3*n+2),u=null,c=e.closed,d=e.worldVerticesLength,f=d/6,p=t.NONE;if(!e.constantSpeed){var v=e.lengths,g=v[f-=c?1:2];if(a&&(o*=g),i)for(var m=1;m<n;m++)l[m]*=g;u=b.setArraySize(this.world,8);for(var w=0,x=0,E=0;w<n;w++,x+=3){var y=l[w],S=o+=y;if(c)(S%=g)<0&&(S+=g),E=0;else{if(S<0){p!=t.BEFORE&&(p=t.BEFORE,e.computeWorldVertices(s,2,4,u,0,2)),this.addBeforePosition(S,u,0,h,x);continue}if(S>g){p!=t.AFTER&&(p=t.AFTER,e.computeWorldVertices(s,d-6,4,u,0,2)),this.addAfterPosition(S-g,u,0,h,x);continue}}for(;;E++){var M=v[E];if(!(S>M)){if(0==E)S/=M;else{var A=v[E-1];S=(S-A)/(M-A)}break}}E!=p&&(p=E,c&&E==f?(e.computeWorldVertices(s,d-4,4,u,0,2),e.computeWorldVertices(s,0,4,u,4,2)):e.computeWorldVertices(s,6*E+2,8,u,0,2)),this.addCurvePosition(S,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],h,x,r||w>0&&0==y)}return h}c?(d+=2,u=b.setArraySize(this.world,d),e.computeWorldVertices(s,2,d-4,u,0,2),e.computeWorldVertices(s,0,2,u,d-4,2),u[d-2]=u[0],u[d-1]=u[1]):(f--,d-=4,u=b.setArraySize(this.world,d),e.computeWorldVertices(s,2,d,u,0,2));for(var R=b.setArraySize(this.curves,f),T=0,I=u[0],C=u[1],_=0,k=0,V=0,P=0,F=0,N=0,B=0,O=0,L=0,X=0,D=0,Y=0,U=0,W=0,q=0,H=2;q<f;q++,H+=6)_=u[H],k=u[H+1],V=u[H+2],P=u[H+3],D=2*(B=.1875*(I-2*_+V))+(L=.09375*(3*(_-V)-I+(F=u[H+4]))),Y=2*(O=.1875*(C-2*k+P))+(X=.09375*(3*(k-P)-C+(N=u[H+5]))),U=.75*(_-I)+B+.16666667*L,W=.75*(k-C)+O+.16666667*X,T+=Math.sqrt(U*U+W*W),U+=D,W+=Y,D+=L,Y+=X,T+=Math.sqrt(U*U+W*W),U+=D,W+=Y,T+=Math.sqrt(U*U+W*W),U+=D+L,W+=Y+X,T+=Math.sqrt(U*U+W*W),R[q]=T,I=F,C=N;if(o*=a?T:T/e.lengths[f-1],i)for(var G=1;G<n;G++)l[G]*=T;for(var j=this.segments,z=0,Z=0,Q=0,J=0,K=0;Z<n;Z++,Q+=3){var $=l[Z],tt=o+=$;if(c)(tt%=T)<0&&(tt+=T),J=0;else{if(tt<0){this.addBeforePosition(tt,u,0,h,Q);continue}if(tt>T){this.addAfterPosition(tt-T,u,d-4,h,Q);continue}}for(;;J++){var et=R[J];if(!(tt>et)){if(0==J)tt/=et;else{var nt=R[J-1];tt=(tt-nt)/(et-nt)}break}}if(J!=p){p=J;var rt=6*J;for(I=u[rt],C=u[rt+1],_=u[rt+2],k=u[rt+3],V=u[rt+4],P=u[rt+5],D=2*(B=.03*(I-2*_+V))+(L=.006*(3*(_-V)-I+(F=u[rt+6]))),Y=2*(O=.03*(C-2*k+P))+(X=.006*(3*(k-P)-C+(N=u[rt+7]))),U=.3*(_-I)+B+.16666667*L,W=.3*(k-C)+O+.16666667*X,z=Math.sqrt(U*U+W*W),j[0]=z,rt=1;rt<8;rt++)U+=D,W+=Y,D+=L,Y+=X,z+=Math.sqrt(U*U+W*W),j[rt]=z;U+=D,W+=Y,z+=Math.sqrt(U*U+W*W),j[8]=z,U+=D+L,W+=Y+X,z+=Math.sqrt(U*U+W*W),j[9]=z,K=0}for(tt*=z;;K++){var at=j[K];if(!(tt>at)){if(0==K)tt/=at;else{var it=j[K-1];tt=K+(tt-it)/(at-it)}break}}this.addCurvePosition(.1*tt,I,C,_,k,V,P,F,N,h,Q,r||Z>0&&0==$)}return h},e.addBeforePosition=function(t,e,n,r,a){var i=e[n],s=e[n+1],o=e[n+2]-i,l=e[n+3]-s,h=Math.atan2(l,o);r[a]=i+t*Math.cos(h),r[a+1]=s+t*Math.sin(h),r[a+2]=h},e.addAfterPosition=function(t,e,n,r,a){var i=e[n+2],s=e[n+3],o=i-e[n],l=s-e[n+1],h=Math.atan2(l,o);r[a]=i+t*Math.cos(h),r[a+1]=s+t*Math.sin(h),r[a+2]=h},e.addCurvePosition=function(t,e,n,r,a,i,s,o,l,h,u,c){if(0==t||isNaN(t))return h[u]=e,h[u+1]=n,void(h[u+2]=Math.atan2(a-n,r-e));var d=t*t,f=d*t,p=1-t,v=p*p,g=v*p,m=p*t,w=3*m,x=p*w,E=w*t,y=e*g+r*x+i*E+o*f,b=n*g+a*x+s*E+l*f;h[u]=y,h[u+1]=b,c&&(h[u+2]=t<.001?Math.atan2(a-n,r-e):Math.atan2(b-(n*v+a*m*2+s*d),y-(e*v+r*m*2+i*d)))},t}();_t.NONE=-1,_t.BEFORE=-2,_t.AFTER=-3,_t.epsilon=1e-5;var kt=function(){function t(t){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,null==t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(var e=0;e<t.bones.length;e++){var n=t.bones[e],r=void 0;if(null==n.parent)r=new Rt(n,this,null);else{var a=this.bones[n.parent.index];r=new Rt(n,this,a),a.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(var i=0;i<t.slots.length;i++){var s=t.slots[i],o=this.bones[s.boneData.index],l=new Tt(s,o);this.slots.push(l),this.drawOrder.push(l)}this.ikConstraints=new Array;for(var h=0;h<t.ikConstraints.length;h++){var u=t.ikConstraints[h];this.ikConstraints.push(new It(u,this))}this.transformConstraints=new Array;for(var c=0;c<t.transformConstraints.length;c++){var d=t.transformConstraints[c];this.transformConstraints.push(new Ct(d,this))}this.pathConstraints=new Array;for(var f=0;f<t.pathConstraints.length;f++){var p=t.pathConstraints[f];this.pathConstraints.push(new _t(p,this))}this.color=new E(1,1,1,1),this.updateCache()}var e=t.prototype;return e.updateCache=function(){var t=this._updateCache;t.length=0,this.updateCacheReset.length=0;for(var e=this.bones,n=0,r=e.length;n<r;n++){var a=e[n];a.sorted=a.data.skinRequired,a.active=!a.sorted}if(null!=this.skin)for(var i=this.skin.bones,s=0,o=this.skin.bones.length;s<o;s++){var l=this.bones[i[s].index];do{l.sorted=!1,l.active=!0,l=l.parent}while(null!=l)}var h=this.ikConstraints,u=this.transformConstraints,c=this.pathConstraints,d=h.length,f=u.length,p=c.length,v=d+f+p;t:for(var g=0;g<v;g++){for(var m=0;m<d;m++){var w=h[m];if(w.data.order==g){this.sortIkConstraint(w);continue t}}for(var x=0;x<f;x++){var E=u[x];if(E.data.order==g){this.sortTransformConstraint(E);continue t}}for(var y=0;y<p;y++){var b=c[y];if(b.data.order==g){this.sortPathConstraint(b);continue t}}}for(var S=0,M=e.length;S<M;S++)this.sortBone(e[S])},e.sortIkConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||null!=this.skin&&b.contains(this.skin.constraints,t.data,!0)),t.active){var e=t.target;this.sortBone(e);var n=t.bones,r=n[0];if(this.sortBone(r),n.length>1){var a=n[n.length-1];this._updateCache.indexOf(a)>-1||this.updateCacheReset.push(a)}this._updateCache.push(t),this.sortReset(r.children),n[n.length-1].sorted=!0}},e.sortPathConstraint=function(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||null!=this.skin&&b.contains(this.skin.constraints,t.data,!0)),t.active){var e=t.target,n=e.data.index,r=e.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,n,r),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,n,r);for(var a=0,i=this.data.skins.length;a<i;a++)this.sortPathConstraintAttachment(this.data.skins[a],n,r);var s=e.getAttachment();I(s,V)&&this.sortPathConstraintAttachmentWith(s,r);for(var o=t.bones,l=o.length,h=0;h<l;h++)this.sortBone(o[h]);this._updateCache.push(t);for(var u=0;u<l;u++)this.sortReset(o[u].children);for(var c=0;c<l;c++)o[c].sorted=!0}},e.sortTransformConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||null!=this.skin&&b.contains(this.skin.constraints,t.data,!0)),t.active){this.sortBone(t.target);var e=t.bones,n=e.length;if(t.data.local)for(var r=0;r<n;r++){var a=e[r];this.sortBone(a.parent),this._updateCache.indexOf(a)>-1||this.updateCacheReset.push(a)}else for(var i=0;i<n;i++)this.sortBone(e[i]);this._updateCache.push(t);for(var s=0;s<n;s++)this.sortReset(e[s].children);for(var o=0;o<n;o++)e[o].sorted=!0}},e.sortPathConstraintAttachment=function(t,e,n){var r=t.attachments[e];if(r)for(var a in r)this.sortPathConstraintAttachmentWith(r[a],n)},e.sortPathConstraintAttachmentWith=function(t,e){if(I(t,V)){var n=t.bones;if(null==n)this.sortBone(e);else for(var r=this.bones,a=0;a<n.length;)for(var i=n[a++],s=a+i;a<s;a++){var o=n[a];this.sortBone(r[o])}}},e.sortBone=function(t){if(!t.sorted){var e=t.parent;null!=e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}},e.sortReset=function(t){for(var e=0,n=t.length;e<n;e++){var r=t[e];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}},e.updateWorldTransform=function(){for(var t=this.updateCacheReset,e=0,n=t.length;e<n;e++){var r=t[e];r.ax=r.x,r.ay=r.y,r.arotation=r.rotation,r.ascaleX=r.scaleX,r.ascaleY=r.scaleY,r.ashearX=r.shearX,r.ashearY=r.shearY,r.appliedValid=!0}for(var a=this._updateCache,i=0,s=a.length;i<s;i++)a[i].update()},e.setToSetupPose=function(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()},e.setBonesToSetupPose=function(){for(var t=this.bones,e=0,n=t.length;e<n;e++)t[e].setToSetupPose();for(var r=this.ikConstraints,a=0,i=r.length;a<i;a++){var s=r[a];s.mix=s.data.mix,s.softness=s.data.softness,s.bendDirection=s.data.bendDirection,s.compress=s.data.compress,s.stretch=s.data.stretch}for(var o=this.transformConstraints,l=0,h=o.length;l<h;l++){var u=o[l],c=u.data;u.rotateMix=c.rotateMix,u.translateMix=c.translateMix,u.scaleMix=c.scaleMix,u.shearMix=c.shearMix}for(var d=this.pathConstraints,f=0,p=d.length;f<p;f++){var v=d[f],g=v.data;v.position=g.position,v.spacing=g.spacing,v.rotateMix=g.rotateMix,v.translateMix=g.translateMix}},e.setSlotsToSetupPose=function(){var t=this.slots;b.arrayCopy(t,0,this.drawOrder,0,t.length);for(var e=0,n=t.length;e<n;e++)t[e].setToSetupPose()},e.getRootBone=function(){return 0==this.bones.length?null:this.bones[0]},e.findBone=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.findBoneIndex=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,n=0,r=e.length;n<r;n++)if(e[n].data.name==t)return n;return-1},e.findSlot=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.findSlotIndex=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,n=0,r=e.length;n<r;n++)if(e[n].data.name==t)return n;return-1},e.setSkinByName=function(t){var e=this.data.findSkin(t);if(null==e)throw new Error("Skin not found: "+t);this.setSkin(e)},e.setSkin=function(t){if(t!=this.skin){if(null!=t)if(null!=this.skin)t.attachAll(this,this.skin);else for(var e=this.slots,n=0,r=e.length;n<r;n++){var a=e[n],i=a.data.attachmentName;if(null!=i){var s=t.getAttachment(n,i);null!=s&&a.setAttachment(s)}}this.skin=t,this.updateCache()}},e.getAttachmentByName=function(t,e){return this.getAttachment(this.data.findSlotIndex(t),e)},e.getAttachment=function(t,e){if(null==e)throw new Error("attachmentName cannot be null.");if(null!=this.skin){var n=this.skin.getAttachment(t,e);if(null!=n)return n}return null!=this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null},e.setAttachment=function(t,e){if(null==t)throw new Error("slotName cannot be null.");for(var n=this.slots,r=0,a=n.length;r<a;r++){var i=n[r];if(i.data.name==t){var s=null;if(null!=e&&null==(s=this.getAttachment(r,e)))throw new Error("Attachment not found: "+e+", for slot: "+t);return void i.setAttachment(s)}}throw new Error("Slot not found: "+t)},e.findIkConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.ikConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.findTransformConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.transformConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.findPathConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.pathConstraints,n=0,r=e.length;n<r;n++){var a=e[n];if(a.data.name==t)return a}return null},e.getBounds=function(t,e,n){if(void 0===n&&(n=new Array(2)),null==t)throw new Error("offset cannot be null.");if(null==e)throw new Error("size cannot be null.");for(var r=this.drawOrder,a=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=0,h=r.length;l<h;l++){var u=r[l];if(u.bone.active){var c=0,d=null,f=u.getAttachment();if(I(f,T))c=8,d=b.setArraySize(n,c,0),f.computeWorldVertices(u.bone,d,0,2);else if(I(f,_)){var p=f;c=p.worldVerticesLength,d=b.setArraySize(n,c,0),p.computeWorldVertices(u,0,c,d,0,2)}if(null!=d)for(var v=0,g=d.length;v<g;v+=2){var m=d[v],w=d[v+1];a=Math.min(a,m),i=Math.min(i,w),s=Math.max(s,m),o=Math.max(o,w)}}}t.set(a,i),e.set(s-a,o-i)},e.update=function(t){this.time+=t},t}(),Vt=function(){function t(t){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new Nt(this),this.propertyIDs=new x,this.animationsChanged=!1,this.trackEntryPool=new S((function(){return new Ft})),this.data=t}var e=t.prototype;return e.update=function(t){t*=this.timeScale;for(var e=this.tracks,n=0,r=e.length;n<r;n++){var a=e[n];if(null!=a){a.animationLast=a.nextAnimationLast,a.trackLast=a.nextTrackLast;var i=t*a.timeScale;if(a.delay>0){if(a.delay-=i,a.delay>0)continue;i=-a.delay,a.delay=0}var s=a.next;if(null!=s){var o=a.trackLast-s.delay;if(o>=0){for(s.delay=0,s.trackTime+=0==a.timeScale?0:(o/a.timeScale+t)*s.timeScale,a.trackTime+=i,this.setCurrent(n,s,!0);null!=s.mixingFrom;)s.mixTime+=t,s=s.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&null==a.mixingFrom){e[n]=null,this.queue.end(a),this.disposeNext(a);continue}if(null!=a.mixingFrom&&this.updateMixingFrom(a,t)){var l=a.mixingFrom;for(a.mixingFrom=null,null!=l&&(l.mixingTo=null);null!=l;)this.queue.end(l),l=l.mixingFrom}a.trackTime+=i}}this.queue.drain()},e.updateMixingFrom=function(t,e){var n=t.mixingFrom;if(null==n)return!0;var r=this.updateMixingFrom(n,e);return n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=n.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=n.mixingFrom,null!=n.mixingFrom&&(n.mixingFrom.mixingTo=t),t.interruptAlpha=n.interruptAlpha,this.queue.end(n)),r):(n.trackTime+=e*n.timeScale,t.mixTime+=e,!1)},e.apply=function(e){if(null==e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var n=this.events,r=this.tracks,a=!1,i=0,s=r.length;i<s;i++){var o=r[i];if(!(null==o||o.delay>0)){a=!0;var l=0==i?G.first:o.mixBlend,h=o.alpha;null!=o.mixingFrom?h*=this.applyMixingFrom(o,e,l):o.trackTime>=o.trackEnd&&null==o.next&&(h=0);var u=o.animationLast,c=o.getAnimationTime(),d=o.animation.timelines.length,f=o.animation.timelines;if(0==i&&1==h||l==G.add)for(var p=0;p<d;p++){b.webkit602BugfixHelper(h,l);var v=f[p];I(v,st)?this.applyAttachmentTimeline(v,e,c,l,!0):v.apply(e,u,c,n,h,l,j.mixIn)}else{var g=o.timelineMode,m=0==o.timelinesRotation.length;m&&b.setArraySize(o.timelinesRotation,d<<1,null);for(var w=o.timelinesRotation,x=0;x<d;x++){var E=f[x],y=g[x]==t.SUBSEQUENT?l:G.setup;I(E,tt)?this.applyRotateTimeline(E,e,c,h,y,w,x<<1,m):I(E,st)?this.applyAttachmentTimeline(E,e,c,l,!0):(b.webkit602BugfixHelper(h,l),E.apply(e,u,c,n,h,y,j.mixIn))}}this.queueEvents(o,c),n.length=0,o.nextAnimationLast=c,o.nextTrackLast=o.trackTime}}for(var S=this.unkeyedState+t.SETUP,M=e.slots,A=0,R=e.slots.length;A<R;A++){var T=M[A];if(T.attachmentState==S){var C=T.data.attachmentName;T.attachment=null==C?null:e.getAttachment(T.data.index,C)}}return this.unkeyedState+=2,this.queue.drain(),a},e.applyMixingFrom=function(e,n,r){var a=e.mixingFrom;null!=a.mixingFrom&&this.applyMixingFrom(a,n,r);var i=0;0==e.mixDuration?(i=1,r==G.first&&(r=G.setup)):((i=e.mixTime/e.mixDuration)>1&&(i=1),r!=G.first&&(r=a.mixBlend));var s=i<a.eventThreshold?this.events:null,o=i<a.attachmentThreshold,l=i<a.drawOrderThreshold,h=a.animationLast,u=a.getAnimationTime(),c=a.animation.timelines.length,d=a.animation.timelines,f=a.alpha*e.interruptAlpha,p=f*(1-i);if(r==G.add)for(var v=0;v<c;v++)d[v].apply(n,h,u,s,p,r,j.mixOut);else{var g=a.timelineMode,m=a.timelineHoldMix,w=0==a.timelinesRotation.length;w&&b.setArraySize(a.timelinesRotation,c<<1,null);var x=a.timelinesRotation;a.totalAlpha=0;for(var E=0;E<c;E++){var y=d[E],S=j.mixOut,M=void 0,A=0;switch(g[E]){case t.SUBSEQUENT:if(!l&&I(y,ut))continue;M=r,A=p;break;case t.FIRST:M=G.setup,A=p;break;case t.HOLD_SUBSEQUENT:M=r,A=f;break;case t.HOLD_FIRST:M=G.setup,A=f;break;default:M=G.setup;var R=m[E];A=f*Math.max(0,1-R.mixTime/R.mixDuration)}a.totalAlpha+=A,I(y,tt)?this.applyRotateTimeline(y,n,u,A,M,x,E<<1,w):I(y,st)?this.applyAttachmentTimeline(y,n,u,M,o):(b.webkit602BugfixHelper(A,r),l&&I(y,ut)&&M==G.setup&&(S=j.mixIn),y.apply(n,h,u,s,A,M,S))}}return e.mixDuration>0&&this.queueEvents(a,u),this.events.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime,i},e.applyAttachmentTimeline=function(e,n,r,a,i){var s=n.slots[e.slotIndex];if(s.bone.active){var o,l=e.frames;if(r<l[0])a!=G.setup&&a!=G.first||this.setAttachment(n,s,s.data.attachmentName,i);else o=r>=l[l.length-1]?l.length-1:K.binarySearch(l,r)-1,this.setAttachment(n,s,e.attachmentNames[o],i);s.attachmentState<=this.unkeyedState&&(s.attachmentState=this.unkeyedState+t.SETUP)}},e.setAttachment=function(e,n,r,a){n.attachment=null==r?null:e.getAttachment(n.data.index,r),a&&(n.attachmentState=this.unkeyedState+t.CURRENT)},e.applyRotateTimeline=function(t,e,n,r,a,i,s,o){if(o&&(i[s]=0),1!=r){var l=t,h=l.frames,u=e.bones[l.boneIndex];if(u.active){var c=0,d=0;if(n<h[0])switch(a){case G.setup:u.rotation=u.data.rotation;default:return;case G.first:c=u.rotation,d=u.data.rotation}else if(c=a==G.setup?u.data.rotation:u.rotation,n>=h[h.length-tt.ENTRIES])d=u.data.rotation+h[h.length+tt.PREV_ROTATION];else{var f=K.binarySearch(h,n,tt.ENTRIES),p=h[f+tt.PREV_ROTATION],v=h[f],g=l.getCurvePercent((f>>1)-1,1-(n-v)/(h[f+tt.PREV_TIME]-v));d=h[f+tt.ROTATION]-p,d=p+(d-=360*(16384-(16384.499999999996-d/360|0)))*g+u.data.rotation,d-=360*(16384-(16384.499999999996-d/360|0))}var m=0,w=d-c;if(0==(w-=360*(16384-(16384.499999999996-w/360|0))))m=i[s];else{var x=0,E=0;o?(x=0,E=w):(x=i[s],E=i[s+1]);var b=w>0,S=x>=0;y.signum(E)!=y.signum(w)&&Math.abs(E)<=90&&(Math.abs(x)>180&&(x+=360*y.signum(x)),S=b),m=w+x-x%360,S!=b&&(m+=360*y.signum(x)),i[s]=m}i[s+1]=w,c+=m*r,u.rotation=c-360*(16384-(16384.499999999996-c/360|0))}}else t.apply(e,0,n,null,1,a,j.mixIn)},e.queueEvents=function(t,e){for(var n=t.animationStart,r=t.animationEnd,a=r-n,i=t.trackLast%a,s=this.events,o=0,l=s.length;o<l;o++){var h=s[o];if(h.time<i)break;h.time>r||this.queue.event(t,h)}for((t.loop?0==a||i>t.trackTime%a:e>=r&&t.animationLast<r)&&this.queue.complete(t);o<l;o++){s[o].time<n||this.queue.event(t,s[o])}},e.clearTracks=function(){var t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var e=0,n=this.tracks.length;e<n;e++)this.clearTrack(e);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()},e.clearTrack=function(t){if(!(t>=this.tracks.length)){var e=this.tracks[t];if(null!=e){this.queue.end(e),this.disposeNext(e);for(var n=e;;){var r=n.mixingFrom;if(null==r)break;this.queue.end(r),n.mixingFrom=null,n.mixingTo=null,n=r}this.tracks[e.trackIndex]=null,this.queue.drain()}}},e.setCurrent=function(t,e,n){var r=this.expandToIndex(t);this.tracks[t]=e,null!=r&&(n&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,null!=r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)},e.setAnimation=function(t,e,n){var r=this.data.skeletonData.findAnimation(e);if(null==r)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,r,n)},e.setAnimationWith=function(t,e,n){if(null==e)throw new Error("animation cannot be null.");var r=!0,a=this.expandToIndex(t);null!=a&&(-1==a.nextTrackLast?(this.tracks[t]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.disposeNext(a),a=a.mixingFrom,r=!1):this.disposeNext(a));var i=this.trackEntry(t,e,n,a);return this.setCurrent(t,i,r),this.queue.drain(),i},e.addAnimation=function(t,e,n,r){var a=this.data.skeletonData.findAnimation(e);if(null==a)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,a,n,r)},e.addAnimationWith=function(t,e,n,r){if(null==e)throw new Error("animation cannot be null.");var a=this.expandToIndex(t);if(null!=a)for(;null!=a.next;)a=a.next;var i=this.trackEntry(t,e,n,a);if(null==a)this.setCurrent(t,i,!0),this.queue.drain();else if(a.next=i,r<=0){var s=a.animationEnd-a.animationStart;0!=s?(a.loop?r+=s*(1+(a.trackTime/s|0)):r+=Math.max(s,a.trackTime),r-=this.data.getMix(a.animation,e)):r=a.trackTime}return i.delay=r,i},e.setEmptyAnimation=function(e,n){var r=this.setAnimationWith(e,t.emptyAnimation,!1);return r.mixDuration=n,r.trackEnd=n,r},e.addEmptyAnimation=function(e,n,r){r<=0&&(r-=n);var a=this.addAnimationWith(e,t.emptyAnimation,!1,r);return a.mixDuration=n,a.trackEnd=n,a},e.setEmptyAnimations=function(t){var e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var n=0,r=this.tracks.length;n<r;n++){var a=this.tracks[n];null!=a&&this.setEmptyAnimation(a.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()},e.expandToIndex=function(t){return t<this.tracks.length?this.tracks[t]:(b.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)},e.trackEntry=function(t,e,n,r){var a=this.trackEntryPool.obtain();return a.trackIndex=t,a.animation=e,a.loop=n,a.holdPrevious=!1,a.eventThreshold=0,a.attachmentThreshold=0,a.drawOrderThreshold=0,a.animationStart=0,a.animationEnd=e.duration,a.animationLast=-1,a.nextAnimationLast=-1,a.delay=0,a.trackTime=0,a.trackLast=-1,a.nextTrackLast=-1,a.trackEnd=Number.MAX_VALUE,a.timeScale=1,a.alpha=1,a.interruptAlpha=1,a.mixTime=0,a.mixDuration=null==r?0:this.data.getMix(r.animation,e),a.mixBlend=G.replace,a},e.disposeNext=function(t){for(var e=t.next;null!=e;)this.queue.dispose(e),e=e.next;t.next=null},e._animationsChanged=function(){this.animationsChanged=!1,this.propertyIDs.clear();for(var t=0,e=this.tracks.length;t<e;t++){var n=this.tracks[t];if(null!=n){for(;null!=n.mixingFrom;)n=n.mixingFrom;do{null!=n.mixingFrom&&n.mixBlend==G.add||this.computeHold(n),n=n.mixingTo}while(null!=n)}}},e.computeHold=function(e){var n=e.mixingTo,r=e.animation.timelines,a=e.animation.timelines.length,i=b.setArraySize(e.timelineMode,a);e.timelineHoldMix.length=0;var s=b.setArraySize(e.timelineHoldMix,a),o=this.propertyIDs;if(null!=n&&n.holdPrevious)for(var l=0;l<a;l++)i[l]=o.add(r[l].getPropertyId())?t.HOLD_FIRST:t.HOLD_SUBSEQUENT;else t:for(var h=0;h<a;h++){var u=r[h],c=u.getPropertyId();if(o.add(c))if(null==n||I(u,st)||I(u,ut)||I(u,ht)||!n.animation.hasTimeline(c))i[h]=t.FIRST;else{for(var d=n.mixingTo;null!=d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(e.mixDuration>0){i[h]=t.HOLD_MIX,s[h]=d;continue t}break}i[h]=t.HOLD_FIRST}else i[h]=t.SUBSEQUENT}},e.getCurrent=function(t){return t>=this.tracks.length?null:this.tracks[t]},e.addListener=function(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)},e.removeListener=function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)},e.clearListeners=function(){this.listeners.length=0},e.clearListenerNotifications=function(){this.queue.clear()},t}();Vt.emptyAnimation=new K("<empty>",[],0),Vt.SUBSEQUENT=0,Vt.FIRST=1,Vt.HOLD_SUBSEQUENT=2,Vt.HOLD_FIRST=3,Vt.HOLD_MIX=4,Vt.SETUP=1,Vt.CURRENT=2;var Pt,Ft=function(){function t(){this.mixBlend=G.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}var e=t.prototype;return e.reset=function(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0},e.getAnimationTime=function(){if(this.loop){var t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)},e.setAnimationLast=function(t){this.animationLast=t,this.nextAnimationLast=t},e.isComplete=function(){return this.trackTime>=this.animationEnd-this.animationStart},e.resetRotationDirections=function(){this.timelinesRotation.length=0},t}(),Nt=function(){function t(t){this.objects=[],this.drainDisabled=!1,this.animState=t}var e=t.prototype;return e.start=function(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0},e.interrupt=function(t){this.objects.push(1),this.objects.push(t)},e.end=function(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0},e.dispose=function(t){this.objects.push(3),this.objects.push(t)},e.complete=function(t){this.objects.push(4),this.objects.push(t)},e.event=function(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)},e.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var t=this.objects,e=this.animState.listeners,n=0;n<t.length;n+=2){var r=t[n],a=t[n+1];switch(r){case 0:null!=a.listener&&a.listener.start&&a.listener.start(a);for(var i=0;i<e.length;i++)e[i].start&&e[i].start(a);break;case 1:null!=a.listener&&a.listener.interrupt&&a.listener.interrupt(a);for(var s=0;s<e.length;s++)e[s].interrupt&&e[s].interrupt(a);break;case 2:null!=a.listener&&a.listener.end&&a.listener.end(a);for(var o=0;o<e.length;o++)e[o].end&&e[o].end(a);case 3:null!=a.listener&&a.listener.dispose&&a.listener.dispose(a);for(var l=0;l<e.length;l++)e[l].dispose&&e[l].dispose(a);this.animState.trackEntryPool.free(a);break;case 4:null!=a.listener&&a.listener.complete&&a.listener.complete(a);for(var h=0;h<e.length;h++)e[h].complete&&e[h].complete(a);break;case 5:var u=t[2+n++];null!=a.listener&&a.listener.event&&a.listener.event(a,u);for(var c=0;c<e.length;c++)e[c].event&&e[c].event(a,u)}}this.clear(),this.drainDisabled=!1}},e.clear=function(){this.objects.length=0},t}();!function(t){t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event"}(Pt||(Pt={}));var Bt=function(){function t(t){if(this.animationToMixTime={},this.defaultMix=0,null==t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}var e=t.prototype;return e.setMix=function(t,e,n){var r=this.skeletonData.findAnimation(t);if(null==r)throw new Error("Animation not found: "+t);var a=this.skeletonData.findAnimation(e);if(null==a)throw new Error("Animation not found: "+e);this.setMixWith(r,a,n)},e.setMixWith=function(t,e,n){if(null==t)throw new Error("from cannot be null.");if(null==e)throw new Error("to cannot be null.");var r=t.name+"."+e.name;this.animationToMixTime[r]=n},e.getMix=function(t,e){var n=t.name+"."+e.name,r=this.animationToMixTime[n];return void 0===r?this.defaultMix:r},t}(),Ot=function(){function t(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new S((function(){return new Array})),this.polygonIndicesPool=new S((function(){return new Array}))}var e=t.prototype;return e.triangulate=function(e){var n=e,r=e.length>>1,a=this.indicesArray;a.length=0;for(var i=0;i<r;i++)a[i]=i;var s=this.isConcaveArray;s.length=0;for(var o=0,l=r;o<l;++o)s[o]=t.isConcave(o,r,n,a);var h=this.triangles;for(h.length=0;r>3;){for(var u=r-1,c=0,d=1;;){t:if(!s[c]){for(var f=a[u]<<1,p=a[c]<<1,v=a[d]<<1,g=n[f],m=n[f+1],w=n[p],x=n[p+1],E=n[v],y=n[v+1],b=(d+1)%r;b!=u;b=(b+1)%r)if(s[b]){var S=a[b]<<1,M=n[S],A=n[S+1];if(t.positiveArea(E,y,g,m,M,A)&&t.positiveArea(g,m,w,x,M,A)&&t.positiveArea(w,x,E,y,M,A))break t}break}if(0==d){do{if(!s[c])break;c--}while(c>0);break}u=c,c=d,d=(d+1)%r}h.push(a[(r+c-1)%r]),h.push(a[c]),h.push(a[(c+1)%r]),a.splice(c,1),s.splice(c,1);var 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&&(h.push(a[2]),h.push(a[0]),h.push(a[1])),h},e.decompose=function(e,n){var r=e,a=this.convexPolygons;this.polygonPool.freeAll(a),a.length=0;var i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;var s=this.polygonIndicesPool.obtain();s.length=0;var o=this.polygonPool.obtain();o.length=0;for(var l=-1,h=0,u=0,c=n.length;u<c;u+=3){var d=n[u]<<1,f=n[u+1]<<1,p=n[u+2]<<1,v=r[d],g=r[d+1],m=r[f],w=r[f+1],x=r[p],E=r[p+1],y=!1;if(l==d){var b=o.length-4,S=t.winding(o[b],o[b+1],o[b+2],o[b+3],x,E),M=t.winding(x,E,o[0],o[1],o[2],o[3]);S==h&&M==h&&(o.push(x),o.push(E),s.push(p),y=!0)}y||(o.length>0?(a.push(o),i.push(s)):(this.polygonPool.free(o),this.polygonIndicesPool.free(s)),(o=this.polygonPool.obtain()).length=0,o.push(v),o.push(g),o.push(m),o.push(w),o.push(x),o.push(E),(s=this.polygonIndicesPool.obtain()).length=0,s.push(d),s.push(f),s.push(p),h=t.winding(v,g,m,w,x,E),l=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],C=(o=a[A]).length-4,_=o[C],k=o[C+1],V=o[C+2],P=o[C+3],F=o[0],N=o[1],B=o[2],O=o[3],L=t.winding(_,k,V,P,F,N),X=0;X<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(_,k,V,P,H,G),z=t.winding(H,G,F,N,B,O);j==L&&z==L&&(q.length=0,D.length=0,o.push(H),o.push(G),s.push(W),_=V,k=P,V=H,P=G,X=0)}}}for(var Z=a.length-1;Z>=0;Z--)0==(o=a[Z]).length&&(a.splice(Z,1),this.polygonPool.free(o),s=i[Z],i.splice(Z,1),this.polygonIndicesPool.free(s));return a},t.isConcave=function(t,e,n,r){var a=r[(e+t-1)%e]<<1,i=r[t]<<1,s=r[(t+1)%e]<<1;return!this.positiveArea(n[a],n[a+1],n[i],n[i+1],n[s],n[s+1])},t.positiveArea=function(t,e,n,r,a,i){return t*(i-r)+n*(e-i)+a*(r-e)>=0},t.winding=function(t,e,n,r,a,i){var s=n-t,o=r-e;return a*o-i*s+s*e-t*o>=0?1:-1},t}(),Lt=function(){function t(){this.triangulator=new Ot,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array}var e=t.prototype;return e.clipStart=function(e,n){if(null!=this.clipAttachment)return 0;this.clipAttachment=n;var r=n.worldVerticesLength,a=b.setArraySize(this.clippingPolygon,r);n.computeWorldVertices(e,0,r,a,0,2);var i=this.clippingPolygon;t.makeClockwise(i);for(var s=this.clippingPolygons=this.triangulator.decompose(i,this.triangulator.triangulate(i)),o=0,l=s.length;o<l;o++){var h=s[o];t.makeClockwise(h),h.push(h[0]),h.push(h[1])}return s.length},e.clipEndWithSlot=function(t){null!=this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()},e.clipEnd=function(){null!=this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)},e.isClipping=function(){return null!=this.clipAttachment},e.clipTriangles=function(t,e,n,r,a,i,s,o){var l=this.clipOutput,h=this.clippedVertices,u=this.clippedTriangles,c=this.clippingPolygons,d=this.clippingPolygons.length,f=o?12:8,p=0;h.length=0,u.length=0;t:for(var v=0;v<r;v+=3)for(var g=n[v]<<1,m=t[g],w=t[g+1],x=a[g],E=a[g+1],y=t[g=n[v+1]<<1],S=t[g+1],M=a[g],A=a[g+1],R=t[g=n[v+2]<<1],T=t[g+1],I=a[g],C=a[g+1],_=0;_<d;_++){var k=h.length;if(!this.clip(m,w,y,S,R,T,c[_],l)){var V=b.setArraySize(h,k+3*f);V[k]=m,V[k+1]=w,V[k+2]=i.r,V[k+3]=i.g,V[k+4]=i.b,V[k+5]=i.a,o?(V[k+6]=x,V[k+7]=E,V[k+8]=s.r,V[k+9]=s.g,V[k+10]=s.b,V[k+11]=s.a,V[k+12]=y,V[k+13]=S,V[k+14]=i.r,V[k+15]=i.g,V[k+16]=i.b,V[k+17]=i.a,V[k+18]=M,V[k+19]=A,V[k+20]=s.r,V[k+21]=s.g,V[k+22]=s.b,V[k+23]=s.a,V[k+24]=R,V[k+25]=T,V[k+26]=i.r,V[k+27]=i.g,V[k+28]=i.b,V[k+29]=i.a,V[k+30]=I,V[k+31]=C,V[k+32]=s.r,V[k+33]=s.g,V[k+34]=s.b,V[k+35]=s.a):(V[k+6]=x,V[k+7]=E,V[k+8]=y,V[k+9]=S,V[k+10]=i.r,V[k+11]=i.g,V[k+12]=i.b,V[k+13]=i.a,V[k+14]=M,V[k+15]=A,V[k+16]=R,V[k+17]=T,V[k+18]=i.r,V[k+19]=i.g,V[k+20]=i.b,V[k+21]=i.a,V[k+22]=I,V[k+23]=C),k=u.length;var P=b.setArraySize(u,k+3);P[k]=p,P[k+1]=p+1,P[k+2]=p+2,p+=3;continue t}var F=l.length;if(0!=F){for(var N=S-T,B=R-y,O=m-R,L=T-w,X=1/(N*O+B*(w-T)),D=F>>1,Y=this.clipOutput,U=b.setArraySize(h,k+D*f),W=0;W<F;W+=2){var q=Y[W],H=Y[W+1];U[k]=q,U[k+1]=H,U[k+2]=i.r,U[k+3]=i.g,U[k+4]=i.b,U[k+5]=i.a;var G=q-R,j=H-T,z=(N*G+B*j)*X,Z=(L*G+O*j)*X,Q=1-z-Z;U[k+6]=x*z+M*Z+I*Q,U[k+7]=E*z+A*Z+C*Q,o&&(U[k+8]=s.r,U[k+9]=s.g,U[k+10]=s.b,U[k+11]=s.a),k+=f}k=u.length;var J=b.setArraySize(u,k+3*(D-2));D--;for(var K=1;K<D;K++)J[k]=p,J[k+1]=p+K,J[k+2]=p+K+1,k+=3;p+=D+1}}},e.clip=function(t,e,n,r,a,i,s,o){var l=o,h=!1,u=null;s.length%4>=2?(u=o,o=this.scratch):u=this.scratch,u.length=0,u.push(t),u.push(e),u.push(n),u.push(r),u.push(a),u.push(i),u.push(t),u.push(e),o.length=0;for(var c=s,d=s.length-4,f=0;;f+=2){for(var p=c[f],v=c[f+1],g=c[f+2],m=c[f+3],w=p-g,x=v-m,E=u,y=u.length-2,b=o.length,S=0;S<y;S+=2){var M=E[S],A=E[S+1],R=E[S+2],T=E[S+3],I=w*(T-m)-x*(R-g)>0;if(w*(A-m)-x*(M-g)>0){if(I){o.push(R),o.push(T);continue}var C=T-A,_=R-M,k=C*(g-p)-_*(m-v);if(Math.abs(k)>1e-6){var V=(_*(v-A)-C*(p-M))/k;o.push(p+(g-p)*V),o.push(v+(m-v)*V)}else o.push(p),o.push(v)}else if(I){var P=T-A,F=R-M,N=P*(g-p)-F*(m-v);if(Math.abs(N)>1e-6){var B=(F*(v-A)-P*(p-M))/N;o.push(p+(g-p)*B),o.push(v+(m-v)*B)}else o.push(p),o.push(v);o.push(R),o.push(T)}h=!0}if(b==o.length)return l.length=0,!0;if(o.push(o[0]),o.push(o[1]),f==d)break;var O=o;(o=u).length=0,u=O}if(l!=o){l.length=0;for(var L=0,X=o.length-2;L<X;L++)l[L]=o[L]}else l.length=l.length-2;return h},t.makeClockwise=function(t){for(var e=t,n=t.length,r=e[n-2]*e[1]-e[0]*e[n-1],a=0,i=0,s=0,o=0,l=n-3;o<l;o+=2)a=e[o],i=e[o+1],s=e[o+2],r+=a*e[o+3]-s*i;if(!(r<0))for(var h=0,u=n-2,c=n>>1;h<c;h+=2){var d=e[h],f=e[h+1],p=u-h;e[h]=e[p],e[h+1]=e[p+1],e[p]=d,e[p+1]=f}},t}(),Xt=function(){function e(){}var n=e.prototype;return n.initialize=function(e,n){var r=this._mesh=new t.BufferMesh(e),a=[new t.VertexElement("POSITION",0,t.VertexElementFormat.Vector3,0),new t.VertexElement("COLOR_0",12,t.VertexElementFormat.Vector4,0),new t.VertexElement("TEXCOORD_0",28,t.VertexElementFormat.Vector2,0)],i=4*Dt.VERTEX_STRIDE,s=i*n,o=new t.Buffer(e,t.BufferBindFlag.VertexBuffer,s,t.BufferUsage.Dynamic),l=new t.Buffer(e,t.BufferBindFlag.IndexBuffer,2*n,t.BufferUsage.Dynamic);this._indexBuffer=l,this._vertexBuffer=o,r.setVertexBufferBinding(o,i),r.setIndexBufferBinding(l,t.IndexFormat.UInt16),r.setVertexElements(a),r.addSubMesh(0,n)},n.changeBuffer=function(e,n){var r=4*Dt.VERTEX_STRIDE,a=r*n,i=new t.Buffer(e,t.BufferBindFlag.VertexBuffer,a,t.BufferUsage.Dynamic),s=new t.Buffer(e,t.BufferBindFlag.IndexBuffer,2*n,t.BufferUsage.Dynamic),o=this._mesh;this._indexBuffer=s,this._vertexBuffer=i,o.setVertexBufferBinding(i,r),o.setIndexBufferBinding(s,t.IndexFormat.UInt16)},s(e,[{key:"mesh",get:function(){return this._mesh}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"vertexBuffer",get:function(){return this._vertexBuffer}}]),e}(),Dt=function(){function e(t,e){this._clipper=new Lt,this._spineMesh=new Xt,this._needResize=!1,this._subMeshItems=[],this.separateSlots=[],this.separateSlotTextures=new Map,this._engine=t,this._entity=e}var n=e.prototype;return n.initialize=function(n,r){if(n){var a=this._entity.getComponent(t.MeshRenderer);if(a){this._meshRenderer=a,r&&(this._setting=r);for(var i=n.defaultSkin.attachments,s=0,o=e.QUAD_TRIANGLES.length,l=0,h=i.length;l<h;l++){var u=i[l];for(var c in u){var d=u[c];if(d)if(I(d,T))s+=o;else{if(!I(d,_))continue;s+=d.triangles.length}}}this._vertexCount=s,this._prepareBufferData(this._vertexCount);var f=this._spineMesh;f.initialize(this._engine,this._vertexCount),a.mesh=f.mesh}else console.warn("You need add MeshRenderer component to entity first")}},n.buildMesh=function(n){var r=this._setting||{},a=r.useClipping,i=void 0===a||a,s=r.zSpacing,o=void 0===s?.01:s,l=0,h=0,u=n.drawOrder,c=u.length,d=this._clipper,f=this._spineMesh,p=f.mesh,v=this._subMeshItems;v.length=0;var g,m,w=this._vertices,x=0,E=0,y=pt.Normal,b=null;e.tempBlendMode=null;for(var S=0;S<c;++S){var M=u[S];if(M.bone.active){var A=M.getAttachment(),R=null,C=o*S,k=0,V=d.isClipping()?2:e.VERTEX_SIZE;if(I(A,T)){var P=A;R=P.color,w=this._vertices,k=4*V,P.computeWorldVertices(M.bone,w,0,V),g=e.QUAD_TRIANGLES,m=P.uvs,b=P.region.renderObject.texture}else if(I(A,_)){var N=A;R=N.color,w=this._vertices,(k=(N.worldVerticesLength>>1)*V)>w.length&&(w=this._vertices=new Float32Array(k)),N.computeWorldVertices(M,0,N.worldVerticesLength,w,0,V),g=N.triangles,m=N.uvs,b=N.region.renderObject.texture}else if(I(A,F)){if(i){var B=A;d.clipStart(M,B);continue}}else if(i){d.clipEndWithSlot(M);continue}if(null!=b){var O=M.data.name;if(y=M.data.blendMode,null!==e.tempBlendMode&&e.tempBlendMode!==M.data.blendMode&&E>0){var L=new t.SubMesh(x,E);v.push({blendMode:e.tempBlendMode,subMesh:L,texture:b}),x=h,E=0}e.tempBlendMode=M.data.blendMode;var X=void 0,D=void 0,Y=void 0,U=void 0,W=M.bone.skeleton.color,q=M.color,H=W.a*q.a*R.a,G=e.tempColor;if(G.set(W.r*q.r*R.r,W.g*q.g*R.g,W.b*q.b*R.b,H),d.isClipping()){d.clipTriangles(w,k,g,g.length,m,G,null,!1);var j=d.clippedVertices,z=d.clippedTriangles;X=j,D=j.length,Y=z,U=z.length}else{for(var Z=w,Q=2,J=0,K=k;Q<K;Q+=V,J+=2)Z[Q]=G.r,Z[Q+1]=G.g,Z[Q+2]=G.b,Z[Q+3]=G.a,Z[Q+4]=m[J],Z[Q+5]=m[J+1];X=w,D=k,Y=g,U=g.length}for(var $=l/e.VERTEX_STRIDE,tt=this._verticesWithZ,et=l,nt=0;nt<D;)tt[et++]=X[nt++],tt[et++]=X[nt++],tt[et++]=C,tt[et++]=X[nt++],tt[et++]=X[nt++],tt[et++]=X[nt++],tt[et++]=X[nt++],tt[et++]=X[nt++],tt[et++]=X[nt++];l=et;var rt=this._indices;for(et=h,nt=0;nt<U;et++,nt++)rt[et]=Y[nt]+$;if(this.separateSlots.includes(O)){if(E>0){var at=new t.SubMesh(x,E);v.push({blendMode:e.tempBlendMode,subMesh:at,texture:b}),x=h}var it=this.separateSlotTextures[O];if(it){var st=b.texture;it.filterMode=st.filterMode,it.wrapModeU=st.wrapModeU,it.wrapModeV=st.wrapModeV,b=it}var ot=new t.SubMesh(x,U);v.push({blendMode:y,subMesh:ot,texture:b}),x+=U,E=0}else E+=U;h+=U}d.clipEndWithSlot(M)}else d.clipEndWithSlot(M)}if(d.clipEnd(),E>0){var lt=new t.SubMesh(x,E);v.push({blendMode:y,subMesh:lt,texture:b}),E=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 ht=this._meshRenderer,ut=0,ct=v.length;ut<ct;++ut){var dt=v[ut],ft=dt.blendMode;p.addSubMesh(dt.subMesh);var vt=ht.getMaterial(ut);vt||(vt=Ut.getDefaultMaterial(this._engine)),vt.shaderData.setTexture("material_SpineTexture",b.texture),vt._priority=ut,this.setBlendMode(vt,ft),ht.setMaterial(ut,vt)}this._needResize&&(f.changeBuffer(this._engine,this._vertexCount),this._needResize=!1),f.vertexBuffer.setData(this._verticesWithZ),f.indexBuffer.setData(this._indices)},n.addSeparateSlot=function(t){this.separateSlots.push(t)},n.addSeparateSlotTexture=function(t,e){this.separateSlotTextures[t]=new qt(e)},n._prepareBufferData=function(t){this._vertices=new Float32Array(t*e.VERTEX_SIZE),this._verticesWithZ=new Float32Array(t*e.VERTEX_STRIDE),this._indices=new Uint16Array(t)},n.setBlendMode=function(e,n){var r=e.renderState.blendState.targetBlendState;switch(n){case pt.Additive:r.sourceColorBlendFactor=t.BlendFactor.SourceAlpha,r.destinationColorBlendFactor=t.BlendFactor.One,r.sourceAlphaBlendFactor=t.BlendFactor.One,r.destinationAlphaBlendFactor=t.BlendFactor.One,r.colorBlendOperation=r.alphaBlendOperation=t.BlendOperation.Add;break;case pt.Multiply:r.sourceColorBlendFactor=t.BlendFactor.DestinationColor,r.destinationColorBlendFactor=t.BlendFactor.Zero,r.sourceAlphaBlendFactor=t.BlendFactor.One,r.destinationAlphaBlendFactor=t.BlendFactor.Zero,r.colorBlendOperation=r.alphaBlendOperation=t.BlendOperation.Add;break;case pt.Screen:r.sourceColorBlendFactor=t.BlendFactor.One,r.destinationColorBlendFactor=t.BlendFactor.OneMinusSourceColor,r.sourceAlphaBlendFactor=t.BlendFactor.One,r.destinationAlphaBlendFactor=t.BlendFactor.OneMinusSourceColor,r.colorBlendOperation=r.alphaBlendOperation=t.BlendOperation.Add;break;default:r.sourceColorBlendFactor=t.BlendFactor.SourceAlpha,r.destinationColorBlendFactor=t.BlendFactor.OneMinusSourceAlpha,r.sourceAlphaBlendFactor=t.BlendFactor.One,r.destinationAlphaBlendFactor=t.BlendFactor.OneMinusSourceAlpha,r.colorBlendOperation=r.alphaBlendOperation=t.BlendOperation.Add}},s(e,[{key:"mesh",get:function(){return this._spineMesh.mesh}},{key:"subMeshItems",get:function(){return this._subMeshItems}}]),e}();Dt.QUAD_TRIANGLES=[0,1,2,2,3,0],Dt.VERTEX_SIZE=8,Dt.VERTEX_STRIDE=9,Dt.tempColor=new E,Dt.tempBlendMode=null;var Yt=function(e){function n(r){var a,i=t.Shader.find("galacean-spine-shader")||t.Shader.create("galacean-spine-shader",n._spineVS,n._spineFS),s=(a=e.call(this,r,i)||this).renderState,o=s.blendState.targetBlendState;return o.enabled=!0,o.sourceColorBlendFactor=t.BlendFactor.SourceAlpha,o.destinationColorBlendFactor=t.BlendFactor.OneMinusSourceAlpha,o.sourceAlphaBlendFactor=t.BlendFactor.One,o.destinationAlphaBlendFactor=t.BlendFactor.OneMinusSourceAlpha,o.colorBlendOperation=o.alphaBlendOperation=t.BlendOperation.Add,s.depthState.writeEnabled=!1,s.rasterState.cullMode=t.CullMode.Off,s.renderQueueType=t.RenderQueueType.Transparent,a}return r(n,e),n}(t.Material);Yt._spineVS="\n uniform mat4 renderer_MVPMat;\n\n attribute vec3 POSITION;\n attribute vec2 TEXCOORD_0;\n attribute vec4 COLOR_0;\n \n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n gl_Position = renderer_MVPMat * vec4(POSITION, 1.0);\n \n v_uv = TEXCOORD_0;\n v_color = COLOR_0;\n }\n ",Yt._spineFS="\n uniform sampler2D material_SpineTexture;\n\n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n vec4 baseColor = texture2D(material_SpineTexture, v_uv);\n gl_FragColor = baseColor * v_color;\n }\n ";var Ut=function(e){function n(t){var n;return(n=e.call(this,t)||this)._tempOffset=new M,n._tempSize=new M,n._tempArray=[0,0],n.autoUpdateBounds=!1,n.noPause=!1,n._meshGenerator=new Dt(n.engine,t),n}r(n,e);var a=n.prototype;return a.setSkeletonData=function(t,e){t||console.error("SkeletonData is undefined"),this.setting=e,this._skeletonData=t,this._skeleton=new kt(t);var n=new Bt(t);this._state=new Vt(n),this._meshGenerator.initialize(t,this.setting)},a.addSeparateSlot=function(e){this.skeleton||console.error("Skeleton not found!"),this.entity.getComponent(t.MeshRenderer)||console.warn("You need add MeshRenderer component to entity first"),this.skeleton.findSlot(e)?this._meshGenerator.addSeparateSlot(e):console.warn("Slot: "+e+" not find.")},a.hackSeparateSlotTexture=function(t,e){var n=this._meshGenerator.separateSlots;0!==n.length?n.includes(t)?this._meshGenerator.addSeparateSlotTexture(t,e):console.warn("Slot "+t+" is not separated. You should use addSeparateSlot to separate it"):console.warn("You need add separate slot")},a.onUpdate=function(t){if(this._skeleton&&this.state){var e=this._state,n=this._skeleton;this.noPause&&e.update(t),e.apply(n),n.updateWorldTransform(),this.updateGeometry()}},a.updateGeometry=function(){this._skeleton&&(this._meshGenerator.buildMesh(this._skeleton),this.autoUpdateBounds&&this.updateBounds())},a.updateBounds=function(){var e,n=this.entity.getComponent(t.MeshRenderer).bounds,r=this._tempOffset,a=this._tempSize,i=this._tempArray,s=(null==(e=this.setting)?void 0:e.zSpacing)||.01,o=this._skeleton;o.getBounds(r,a,i);var l=o.drawOrder;n.min.set(r.x,r.y,0),n.max.set(r.x+a.x,r.y+a.y,l.length*s)},a._cloneTo=function(t){t.setSkeletonData(this.skeletonData);var e=At({},this.setting);t.setting=e},a._disposeCurrentSkeleton=function(){this._skeletonData=null,this._skeleton=null,this._state=null},a.onDestroy=function(){this._disposeCurrentSkeleton(),this._meshGenerator=null,this.setting=null},n.getDefaultMaterial=function(t){var e=this._defaultMaterial;if(e){if(e.engine===t)return e.clone();e.destroy(!0),e=null}return(e=new Yt(t)).isGCIgnored=!0,this._defaultMaterial=e,e.clone()},s(n,[{key:"skeletonData",get:function(){return this._skeletonData}},{key:"skeleton",get:function(){return this._skeleton}},{key:"state",get:function(){return this._state}},{key:"mesh",get:function(){return this._meshGenerator.mesh}},{key:"scale",set:function(t){this._skeleton&&(this._skeleton.scaleX=t,this._skeleton.scaleY=t)}}]),n}(t.Script);a([t.ignoreClone],Ut.prototype,"_skeletonData",void 0),a([t.ignoreClone],Ut.prototype,"_skeleton",void 0),a([t.ignoreClone],Ut.prototype,"_state",void 0),a([t.ignoreClone],Ut.prototype,"_tempOffset",void 0),a([t.ignoreClone],Ut.prototype,"_tempSize",void 0),a([t.ignoreClone],Ut.prototype,"_tempArray",void 0),a([t.ignoreClone],Ut.prototype,"_meshGenerator",void 0),a([t.ignoreClone],Ut.prototype,"setting",void 0);var Wt=function(e){function n(){return e.call(this,!1)}r(n,e);var a=n.prototype;return a.load=function(e,n){var r=this;return new t.AssetPromise((function(t,a){"spine"!==e.type&&a("Asset type must be spine.");var i=null;e.urls?r.handleResource(n,e,i,t,a):r.request(e.url||"",{type:"json"}).then((function(s){s.jsonUrl&&s.atlasUrl&&s.pngUrl?(i=r.getResouceFromUrls([s.jsonUrl,s.atlasUrl,s.pngUrl],s.pngType),r.handleResource(n,e,i,t,a)):r.handleResource(n,e,i,t,a)})).catch((function(s){r.handleResource(n,e,i,t,a)}))}))},a.handleResource=function(e,n,r,a,i){var s=this,o=e.engine;r||(!n.urls&&n.url&&this.checkUrl(n.url)&&(r=this.getResouceFromUrl(n.url)),n.urls&&this.checkUrls(n.urls)&&(r=this.getResouceFromUrls(n.urls)));var l,h=!1;l=new w(o,null,(function(t){return s.createAdaptiveTexture(t)}));var u=r.skeletonFile,c=r.atlasFile,d=r.textureFile;l.onLoadComplete=function(){try{var e;if(h)e=l.get(c);else{var n=l.get(c);e=new p(n,s.textureAssetPicker.bind(s,l,d))}var r=new N(e),f=(s.isBinFile(u)?new yt(r):new xt(r)).readSkeletonData(l.get(u)),v=new t.Entity(o),g=v.addComponent(t.MeshRenderer),m=Ut.getDefaultMaterial(o);g.setMaterial(m),v.addComponent(Ut).setSkeletonData(f),a(v)}catch(t){i(t)}};var f=this.isBinFile(u);u&&c&&d?(f?l.loadBinary(u,null,i):l.loadText(u,null,i),l.loadText(c,null,i),l.loadEngineTexture(d,r.textureType,null,i)):u&&c&&!d?(h=!0,f?l.loadBinary(u,null,i):l.loadText(u,null,i),l.loadTextureAtlas(c,null,i)):i("Resouce param error")},a.textureAssetPicker=function(t,e){return t.get(e)},a.createAdaptiveTexture=function(t){return new qt(t)},a.isBinFile=function(t){return"bin"===this.getExtFromUrl(t)},a.checkUrl=function(t){var e=this.getExtFromUrl(t);return"json"===e||"bin"===e||(console.error("When use url as params, url must be json or bin file"),!1)},a.getResouceFromUrl=function(t){var e=t,n=t,r=n.indexOf("?");return r>0&&(n=n.substr(0,r)),{skeletonFile:e,atlasFile:n=n.substr(0,n.lastIndexOf("."))+".atlas"}},a.checkUrls=function(t){if(t.length<2)return console.error("When use urls as params, urls should at least contain: json/bin and atlas"),!1;if(t.length>3)return console.error("Spine runtime dont support multiple texture now"),!1;var e=this.getResouceFromUrls(t),n=e.skeletonFile,r=e.atlasFile;return!(!n||!r)||(console.error("Lack "+(n?"":"skeletonFile")+(r?" atlasFile":"")),!1)},a.getResouceFromUrls=function(e,n){var r,a,i;void 0===n&&(n=t.AssetType.Texture2D);for(var s=n,o=0;o<e.length;++o){var l=e[o],h=this.getExtFromUrl(l);"json"!==h&&"bin"!==h||(r=l),"atlas"===h&&(a=l);["png","jpg","webp","jpeg","ktx2"].includes(h)&&(i=l)}return{skeletonFile:r,atlasFile:a,textureFile:i,textureType:s}},a.getExtFromUrl=function(t){return t.split(/[#?]/)[0].split(".").pop().trim()},n}(t.Loader);Wt=a([t.resourceLoader("spine",["json","bin"])],Wt);var qt=function(e){function n(t){var n;return(n=e.call(this,t)||this).texture.generateMipmaps(),n}r(n,e);var a=n.prototype;return a.setFilters=function(e,n){e===h.Nearest?this.texture.filterMode=t.TextureFilterMode.Point:n===h.MipMapLinearLinear?this.texture.filterMode=t.TextureFilterMode.Trilinear:this.texture.filterMode=t.TextureFilterMode.Bilinear},a.setWraps=function(t,e){this.texture.wrapModeU=t,this.texture.wrapModeV=e},a.dispose=function(){},n}(c),Ht=function(e){function n(){var t;return(t=e.apply(this,arguments)||this)._priority=0,t._animationName="",t._loop=!0,t._paused=!1,t._autoPlay=!0,t._skinName="",t._scale=1,t._spineAnimation=null,t._animationNames=[],t._skinNames=[],t}r(n,e);var a=n.prototype;return a.onDestroy=function(){this.resource=null},a.play=function(t,e){void 0===t&&(t=""),void 0===e&&(e=!0);var n=this._animationNames;n.length>0?-1!==n.indexOf(t)&&(this._animationName=t,this._loop=e,this._resource&&this._spineAnimation&&this._spineAnimation.state.setAnimation(0,t,e)):this._animationName=t},a._cloneTo=function(t){t.entity.clearChildren(),t.resource=this.resource},a._removeResource=function(){this._resource&&this._spineAnimation&&(this.entity.removeChild(this._resource),this._resource.destroy(),this._resource=null,this._spineAnimation=null,this._animationName="",this._skinName="")},s(n,[{key:"priority",get:function(){return this._priority},set:function(e){this._priority!==e&&(this._priority=e,this._resource&&(this._resource.getComponent(t.MeshRenderer).priority=e))}},{key:"resource",get:function(){return this._resource},set:function(e){var n=this._resource;if(e){if(n!==e){this._removeResource(),this._resource=e.clone(),this._resource.getComponent(t.MeshRenderer).priority=this.priority,this.entity.addChild(this._resource),this._spineAnimation=this._resource.getComponent(Ut),this._spineAnimation.scale=this._scale,this._spineAnimation.noPause=!this._paused;var r=this._spineAnimation.skeletonData,a=r.animations,i=r.skins,s=this._animationNames,o=this._skinNames;s.length=0;for(var l=0,h=a.length;l<h;++l)s.push(a[l].name);o.length=0;for(var u=0,c=i.length;u<c;++u)o.push(i[u].name);this.skinName=this._skinName||o[0],this._autoPlay&&s.length>0&&this.play(this._animationName||s[0],this._loop)}}else this._removeResource()}},{key:"animationName",get:function(){return this._animationName},set:function(t){this._animationName!=t&&(this._animationName=t),this._autoPlay&&this._spineAnimation&&this.play(t,this._loop)}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop!==t&&(this._resource&&this._spineAnimation&&(t?this._autoPlay&&this.play(this._animationName,t):this.play(this._animationName,t)),this._loop=t)}},{key:"paused",get:function(){return this._paused},set:function(t){this._paused!==t&&(this._paused=t,this.spineAnimation&&(this.spineAnimation.noPause=!t))}},{key:"autoPlay",get:function(){return this._autoPlay},set:function(t){this._autoPlay!==t&&(t&&this._resource&&this._spineAnimation&&this.play(this._animationName,this._loop),this._autoPlay=t)}},{key:"skinName",get:function(){return this._skinName},set:function(t){if(this._skinName!==t&&(this._skinName=t,this._spineAnimation)){var e=this._spineAnimation.skeleton;e.setSkinByName(t),e.setSlotsToSetupPose()}}},{key:"scale",get:function(){return this._scale},set:function(t){this._scale!==t&&(this._scale=t,this._spineAnimation&&(this._spineAnimation.scale=t))}},{key:"spineAnimation",get:function(){return this._spineAnimation}}]),n}(t.Script);a([t.ignoreClone],Ht.prototype,"_resource",void 0),a([t.assignmentClone],Ht.prototype,"_animationName",void 0),a([t.assignmentClone],Ht.prototype,"_loop",void 0),a([t.assignmentClone],Ht.prototype,"_paused",void 0),a([t.assignmentClone],Ht.prototype,"_autoPlay",void 0),a([t.assignmentClone],Ht.prototype,"_skinName",void 0),a([t.assignmentClone],Ht.prototype,"_scale",void 0),a([t.ignoreClone],Ht.prototype,"_spineAnimation",void 0),a([t.ignoreClone],Ht.prototype,"_animationNames",void 0),a([t.ignoreClone],Ht.prototype,"_skinNames",void 0);var Gt="1.1.0-test.1";t.Loader.registerClass("SpineRenderer",Ht),console.log("Galacean spine version: "+Gt),exports.AssetManager=w,exports.AtlasAttachmentLoader=N,exports.SkeletonBinary=yt,exports.SkeletonJson=xt,exports.SpineAnimation=Ut,exports.SpineRenderer=Ht,exports.Texture=c,exports.TextureAtlas=p,exports.version=Gt;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@galacean/engine/dist/miniprogram"),s=require("@galacean/engine-miniprogram-adapter");function r(t,e,s,r){var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,s,r);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(a=(n<3?i(a):n>3?i(e,s,a):i(e,s))||a);return n>3&&a&&Object.defineProperty(e,s,a),a}"function"==typeof SuppressedError&&SuppressedError;class i{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,!e&&(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,r=t.length;s<r;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}class n{r;g;b;a;static WHITE=new n(1,1,1,1);static RED=new n(1,0,0,1);static GREEN=new n(0,1,0,1);static BLUE=new n(0,0,1,1);static MAGENTA=new n(1,0,1,1);constructor(t=0,e=0,s=0,r=0){this.r=t,this.g=e,this.b=s,this.a=r}set(t,e,s,r){return this.r=t,this.g=e,this.b=s,this.a=r,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,r){return this.r+=t,this.g+=e,this.b+=s,this.a+=r,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255}static rgb888ToColor(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255}toRgb888(){const t=t=>("0"+(255*t).toString(16)).slice(-2);return Number("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t){return(new n).setFromString(t)}}class a{static PI=3.1415927;static PI2=2*a.PI;static invPI2=1/a.PI2;static radiansToDegrees=180/a.PI;static radDeg=a.radiansToDegrees;static degreesToRadians=a.PI/180;static degRad=a.degreesToRadians;static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*a.degRad)}static sinDeg(t){return Math.sin(t*a.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*a.degRad}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){let e=Math.pow(Math.abs(t),1/3);return t<0?-e:e}static randomTriangular(t,e){return a.randomTriangularWith(t,e,.5*(t+e))}static randomTriangularWith(t,e,s){let r=Math.random(),i=e-t;return r<=(s-t)/i?t+Math.sqrt(r*i*(s-t)):e-Math.sqrt((1-r)*i*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}}class o{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class l extends o{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 h{static SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;static arrayCopy(t,e,s,r,i){for(let n=e,a=r;n<e+i;n++,a++)s[a]=t[n]}static arrayFill(t,e,s,r){for(let i=e;i<s;i++)t[i]=r}static setArraySize(t,e,s=0){let r=t.length;if(r==e)return t;if(t.length=e,r<e)for(let i=r;i<e;i++)t[i]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:h.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let r=0;r<t;r++)s[r]=e;return s}static newFloatArray(t){if(h.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(h.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 h.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return h.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}}class c{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 d{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 u{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}class p extends u{static nextID=0;id=p.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,e,s,r,i,n){s=i+(s>>1)*n;let a=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(!h){o.length>0&&(l=o);let a=t.bone,h=a.worldX,c=a.worldY,d=a.a,u=a.b,p=a.c,m=a.d;for(let t=e,a=i;a<s;t+=2,a+=n){let e=l[t],s=l[t+1];r[a]=e*d+s*u+h,r[a+1]=e*p+s*m+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=a.bones;if(0==o.length)for(let t=i,e=3*d;t<s;t+=n){let s=0,i=0,n=h[c++];for(n+=c;c<n;c++,e+=3){let t=u[h[c]],r=l[e],n=l[e+1],a=l[e+2];s+=(r*t.a+n*t.b+t.worldX)*a,i+=(r*t.c+n*t.d+t.worldY)*a}r[t]=s,r[t+1]=i}else{let t=o;for(let e=i,a=3*d,o=d<<1;e<s;e+=n){let s=0,i=0,n=h[c++];for(n+=c;c<n;c++,a+=3,o+=2){let e=u[h[c]],r=l[a]+t[o],n=l[a+1]+t[o+1],d=l[a+2];s+=(r*e.a+n*e.b+e.worldX)*d,i+=(r*e.c+n*e.d+e.worldY)*d}r[e]=s,r[e+1]=i}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),h.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=h.newFloatArray(this.vertices.length),h.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}}class m{static _nextID=0;id=m.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new m(this.regions.length);return h.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 r=this.regions[s];e.region!=r&&(e.region=r,e.updateRegion())}getPath(t,e){let s=t,r=(this.start+e).toString();for(let t=this.digits-r.length;t>0;t--)s+="0";return s+=r,s}static nextID(){return m._nextID++}}!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"}(t||(t={}));const f=[t.hold,t.once,t.loop,t.pingpong,t.onceReverse,t.loopReverse,t.pingpongReverse];class g{name;timelines=[];timelineIds=new i;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,r,i,n,a,o){if(!t)throw new Error("skeleton cannot be null.");r&&0!=this.duration&&(s%=this.duration,e>0&&(e%=this.duration));let l=this.timelines;for(let r=0,h=l.length;r<h;r++)l[r].apply(t,e,s,i,n,a,o)}}var x,w;exports.MixBlend=void 0,(x=exports.MixBlend||(exports.MixBlend={}))[x.setup=0]="setup",x[x.first=1]="first",x[x.replace=2]="replace",x[x.add=3]="add",exports.MixDirection=void 0,(w=exports.MixDirection||(exports.MixDirection={}))[w.mixIn=0]="mixIn",w[w.mixOut=1]="mixOut";const b={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28};class y{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=h.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 r=1;r<s;r++)if(t[r]>e)return r-1;return s-1}static search(t,e,s){let r=t.length;for(let i=s;i<r;i+=s)if(t[i]>e)return i-s;return r-s}}class M extends y{curves;constructor(t,e,s){super(t,s),this.curves=h.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=h.newFloatArray(e);h.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,s,r,i,n,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let p=.03*(r-2*n+o),m=.03*(i-2*a+l),f=.006*(3*(n-o)-r+h),g=.006*(3*(a-l)-i+c),x=2*p+f,w=2*m+g,b=.3*(n-r)+p+.16666667*f,y=.3*(a-i)+m+.16666667*g,M=r+b,S=i+y;for(let t=u+18;u<t;u+=2)d[u]=M,d[u+1]=S,b+=x,y+=w,x+=f,w+=g,M+=b,S+=y}getBezierValue(t,e,s,r){let i=this.curves;if(i[r]>t){let n=this.frames[e],a=this.frames[e+s];return a+(t-n)/(i[r]-n)*(i[r+1]-a)}let n=r+18;for(r+=2;r<n;r+=2)if(i[r]>=t){let e=i[r-2],s=i[r-1];return s+(t-e)/(i[r]-e)*(i[r+1]-s)}e+=this.getFrameEntries();let a=i[n-2],o=i[n-1];return o+(t-a)/(this.frames[e]-a)*(this.frames[e+s]-o)}}class S extends M{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let r=2;r<=s;r+=2)if(e[r]>t){s=r-2;break}let r=this.curves[s>>1];switch(r){case 0:let r=e[s],i=e[s+1];return i+(t-r)/(e[s+2]-r)*(e[s+2+1]-i);case 1:return e[s+1]}return this.getBezierValue(t,s,1,r-2)}getRelativeValue(t,e,s,r,i){if(t<this.frames[0]){switch(s){case exports.MixBlend.setup:return i;case exports.MixBlend.first:return r+(i-r)*e}return r}let n=this.getCurveValue(t);switch(s){case exports.MixBlend.setup:return i+n*e;case exports.MixBlend.first:case exports.MixBlend.replace:n+=i-r}return r+n*e}getAbsoluteValue(t,e,s,r,i){if(t<this.frames[0]){switch(s){case exports.MixBlend.setup:return i;case exports.MixBlend.first:return r+(i-r)*e}return r}let n=this.getCurveValue(t);return s==exports.MixBlend.setup?i+(n-i)*e:r+(n-r)*e}getAbsoluteValue2(t,e,s,r,i,n){if(t<this.frames[0]){switch(s){case exports.MixBlend.setup:return i;case exports.MixBlend.first:return r+(i-r)*e}return r}return s==exports.MixBlend.setup?i+(n-i)*e:r+(n-r)*e}getScaleValue(t,e,s,r,i,n){if(t<this.frames[0]){switch(s){case exports.MixBlend.setup:return n;case exports.MixBlend.first:return i+(n-i)*e}return i}let o=this.getCurveValue(t)*n;if(1==e)return s==exports.MixBlend.add?i+o-n:o;if(r==exports.MixDirection.mixOut)switch(s){case exports.MixBlend.setup:return n+(Math.abs(o)*a.signum(n)-n)*e;case exports.MixBlend.first:case exports.MixBlend.replace:return i+(Math.abs(o)*a.signum(i)-i)*e}else{let t=0;switch(s){case exports.MixBlend.setup:return t=Math.abs(n)*a.signum(o),t+(o-t)*e;case exports.MixBlend.first:case exports.MixBlend.replace:return t=Math.abs(i)*a.signum(o),t+(o-t)*e}}return i+(o-n)*e}}class v extends M{constructor(t,e,s,r){super(t,e,[s,r])}getFrameEntries(){return 3}setFrame(t,e,s,r){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r}}class k extends S{boneIndex=0;constructor(t,e,s){super(t,e,b.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.rotation=this.getRelativeValue(s,i,n,o.rotation,o.data.rotation))}}class I extends v{boneIndex=0;constructor(t,e,s){super(t,e,b.x+"|"+s,b.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case exports.MixBlend.setup:return o.x=o.data.x,void(o.y=o.data.y);case exports.MixBlend.first:o.x+=(o.data.x-o.x)*i,o.y+=(o.data.y-o.y)*i}return}let h=0,c=0,d=y.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(n){case exports.MixBlend.setup:o.x=o.data.x+h*i,o.y=o.data.y+c*i;break;case exports.MixBlend.first:case exports.MixBlend.replace:o.x+=(o.data.x+h-o.x)*i,o.y+=(o.data.y+c-o.y)*i;break;case exports.MixBlend.add:o.x+=h*i,o.y+=c*i}}}class A extends S{boneIndex=0;constructor(t,e,s){super(t,e,b.x+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.x=this.getRelativeValue(s,i,n,o.x,o.data.x))}}class T extends S{boneIndex=0;constructor(t,e,s){super(t,e,b.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.y=this.getRelativeValue(s,i,n,o.y,o.data.y))}}class B extends v{boneIndex=0;constructor(t,e,s){super(t,e,b.scaleX+"|"+s,b.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,o){let l=t.bones[this.boneIndex];if(!l.active)return;let h,c,d=this.frames;if(s<d[0]){switch(n){case exports.MixBlend.setup:return l.scaleX=l.data.scaleX,void(l.scaleY=l.data.scaleY);case exports.MixBlend.first:l.scaleX+=(l.data.scaleX-l.scaleX)*i,l.scaleY+=(l.data.scaleY-l.scaleY)*i}return}let u=y.search(d,s,3),p=this.curves[u/3];switch(p){case 0:let t=d[u];h=d[u+1],c=d[u+2];let e=(s-t)/(d[u+3]-t);h+=(d[u+3+1]-h)*e,c+=(d[u+3+2]-c)*e;break;case 1:h=d[u+1],c=d[u+2];break;default:h=this.getBezierValue(s,u,1,p-2),c=this.getBezierValue(s,u,2,p+18-2)}if(h*=l.data.scaleX,c*=l.data.scaleY,1==i)n==exports.MixBlend.add?(l.scaleX+=h-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=h,l.scaleY=c);else{let t=0,e=0;if(o==exports.MixDirection.mixOut)switch(n){case exports.MixBlend.setup:t=l.data.scaleX,e=l.data.scaleY,l.scaleX=t+(Math.abs(h)*a.signum(t)-t)*i,l.scaleY=e+(Math.abs(c)*a.signum(e)-e)*i;break;case exports.MixBlend.first:case exports.MixBlend.replace:t=l.scaleX,e=l.scaleY,l.scaleX=t+(Math.abs(h)*a.signum(t)-t)*i,l.scaleY=e+(Math.abs(c)*a.signum(e)-e)*i;break;case exports.MixBlend.add:l.scaleX+=(h-l.data.scaleX)*i,l.scaleY+=(c-l.data.scaleY)*i}else switch(n){case exports.MixBlend.setup:t=Math.abs(l.data.scaleX)*a.signum(h),e=Math.abs(l.data.scaleY)*a.signum(c),l.scaleX=t+(h-t)*i,l.scaleY=e+(c-e)*i;break;case exports.MixBlend.first:case exports.MixBlend.replace:t=Math.abs(l.scaleX)*a.signum(h),e=Math.abs(l.scaleY)*a.signum(c),l.scaleX=t+(h-t)*i,l.scaleY=e+(c-e)*i;break;case exports.MixBlend.add:l.scaleX+=(h-l.data.scaleX)*i,l.scaleY+=(c-l.data.scaleY)*i}}}}class C extends S{boneIndex=0;constructor(t,e,s){super(t,e,b.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleX=this.getScaleValue(s,i,n,a,o.scaleX,o.data.scaleX))}}class F extends S{boneIndex=0;constructor(t,e,s){super(t,e,b.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleY=this.getScaleValue(s,i,n,a,o.scaleY,o.data.scaleY))}}class E extends v{boneIndex=0;constructor(t,e,s){super(t,e,b.shearX+"|"+s,b.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case exports.MixBlend.setup:return o.shearX=o.data.shearX,void(o.shearY=o.data.shearY);case exports.MixBlend.first:o.shearX+=(o.data.shearX-o.shearX)*i,o.shearY+=(o.data.shearY-o.shearY)*i}return}let h=0,c=0,d=y.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(n){case exports.MixBlend.setup:o.shearX=o.data.shearX+h*i,o.shearY=o.data.shearY+c*i;break;case exports.MixBlend.first:case exports.MixBlend.replace:o.shearX+=(o.data.shearX+h-o.shearX)*i,o.shearY+=(o.data.shearY+c-o.shearY)*i;break;case exports.MixBlend.add:o.shearX+=h*i,o.shearY+=c*i}}}class R extends S{boneIndex=0;constructor(t,e,s){super(t,e,b.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.shearX=this.getRelativeValue(s,i,n,o.shearX,o.data.shearX))}}class Y extends S{boneIndex=0;constructor(t,e,s){super(t,e,b.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.shearY=this.getRelativeValue(s,i,n,o.shearY,o.data.shearY))}}class P extends y{boneIndex=0;constructor(t,e){super(t,[b.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;s<l[0]?n!=exports.MixBlend.setup&&n!=exports.MixBlend.first||(o.inherit=o.data.inherit):o.inherit=this.frames[y.search(l,s,2)+1]}}class X extends M{slotIndex=0;constructor(t,e,s){super(t,e,[b.rgb+"|"+s,b.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,r,i,n){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=n}apply(t,e,s,r,i,n,a){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(n){case exports.MixBlend.setup:return void h.setFromColor(t);case exports.MixBlend.first:h.add((t.r-h.r)*i,(t.g-h.g)*i,(t.b-h.b)*i,(t.a-h.a)*i)}return}let c=0,d=0,u=0,p=0,m=y.search(l,s,5),f=this.curves[m/5];switch(f){case 0:let t=l[m];c=l[m+1],d=l[m+2],u=l[m+3],p=l[m+4];let e=(s-t)/(l[m+5]-t);c+=(l[m+5+1]-c)*e,d+=(l[m+5+2]-d)*e,u+=(l[m+5+3]-u)*e,p+=(l[m+5+4]-p)*e;break;case 1:c=l[m+1],d=l[m+2],u=l[m+3],p=l[m+4];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),p=this.getBezierValue(s,m,4,f+54-2)}1==i?h.set(c,d,u,p):(n==exports.MixBlend.setup&&h.setFromColor(o.data.color),h.add((c-h.r)*i,(d-h.g)*i,(u-h.b)*i,(p-h.a)*i))}}class _ extends M{slotIndex=0;constructor(t,e,s){super(t,e,[b.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,i){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i}apply(t,e,s,r,i,n,a){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(n){case exports.MixBlend.setup:return h.r=t.r,h.g=t.g,void(h.b=t.b);case exports.MixBlend.first:h.r+=(t.r-h.r)*i,h.g+=(t.g-h.g)*i,h.b+=(t.b-h.b)*i}return}let c=0,d=0,u=0,p=y.search(l,s,4),m=this.curves[p>>2];switch(m){case 0:let t=l[p];c=l[p+1],d=l[p+2],u=l[p+3];let e=(s-t)/(l[p+4]-t);c+=(l[p+4+1]-c)*e,d+=(l[p+4+2]-d)*e,u+=(l[p+4+3]-u)*e;break;case 1:c=l[p+1],d=l[p+2],u=l[p+3];break;default:c=this.getBezierValue(s,p,1,m-2),d=this.getBezierValue(s,p,2,m+18-2),u=this.getBezierValue(s,p,3,m+36-2)}if(1==i)h.r=c,h.g=d,h.b=u;else{if(n==exports.MixBlend.setup){let t=o.data.color;h.r=t.r,h.g=t.g,h.b=t.b}h.r+=(c-h.r)*i,h.g+=(d-h.g)*i,h.b+=(u-h.b)*i}}}class V extends S{slotIndex=0;constructor(t,e,s){super(t,e,b.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,r,i,n,a){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(n){case exports.MixBlend.setup:return void(l.a=t.a);case exports.MixBlend.first:l.a+=(t.a-l.a)*i}return}let h=this.getCurveValue(s);1==i?l.a=h:(n==exports.MixBlend.setup&&(l.a=o.data.color.a),l.a+=(h-l.a)*i)}}class D extends M{slotIndex=0;constructor(t,e,s){super(t,e,[b.rgb+"|"+s,b.alpha+"|"+s,b.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,r,i,n,a,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=n,this.frames[t+5]=a,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,r,i,n,a){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(n){case exports.MixBlend.setup:return h.setFromColor(t),c.r=e.r,c.g=e.g,void(c.b=e.b);case exports.MixBlend.first:h.add((t.r-h.r)*i,(t.g-h.g)*i,(t.b-h.b)*i,(t.a-h.a)*i),c.r+=(e.r-c.r)*i,c.g+=(e.g-c.g)*i,c.b+=(e.b-c.b)*i}return}let d=0,u=0,p=0,m=0,f=0,g=0,x=0,w=y.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],p=l[w+3],m=l[w+4],f=l[w+5],g=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,p+=(l[w+8+3]-p)*e,m+=(l[w+8+4]-m)*e,f+=(l[w+8+5]-f)*e,g+=(l[w+8+6]-g)*e,x+=(l[w+8+7]-x)*e;break;case 1:d=l[w+1],u=l[w+2],p=l[w+3],m=l[w+4],f=l[w+5],g=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),p=this.getBezierValue(s,w,3,b+36-2),m=this.getBezierValue(s,w,4,b+54-2),f=this.getBezierValue(s,w,5,b+72-2),g=this.getBezierValue(s,w,6,b+90-2),x=this.getBezierValue(s,w,7,b+108-2)}if(1==i)h.set(d,u,p,m),c.r=f,c.g=g,c.b=x;else{if(n==exports.MixBlend.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)*i,(u-h.g)*i,(p-h.b)*i,(m-h.a)*i),c.r+=(f-c.r)*i,c.g+=(g-c.g)*i,c.b+=(x-c.b)*i}}}class O extends M{slotIndex=0;constructor(t,e,s){super(t,e,[b.rgb+"|"+s,b.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,i,n,a,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=n,this.frames[t+5]=a,this.frames[t+6]=o}apply(t,e,s,r,i,n,a){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(n){case exports.MixBlend.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 exports.MixBlend.first:h.r+=(t.r-h.r)*i,h.g+=(t.g-h.g)*i,h.b+=(t.b-h.b)*i,c.r+=(e.r-c.r)*i,c.g+=(e.g-c.g)*i,c.b+=(e.b-c.b)*i}return}let d=0,u=0,p=0,m=0,f=0,g=0,x=y.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],p=l[x+3],m=l[x+4],f=l[x+5],g=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,p+=(l[x+7+3]-p)*e,m+=(l[x+7+4]-m)*e,f+=(l[x+7+5]-f)*e,g+=(l[x+7+6]-g)*e;break;case 1:d=l[x+1],u=l[x+2],p=l[x+3],m=l[x+4],f=l[x+5],g=l[x+6];break;default:d=this.getBezierValue(s,x,1,w-2),u=this.getBezierValue(s,x,2,w+18-2),p=this.getBezierValue(s,x,3,w+36-2),m=this.getBezierValue(s,x,4,w+54-2),f=this.getBezierValue(s,x,5,w+72-2),g=this.getBezierValue(s,x,6,w+90-2)}if(1==i)h.r=d,h.g=u,h.b=p,c.r=m,c.g=f,c.b=g;else{if(n==exports.MixBlend.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)*i,h.g+=(u-h.g)*i,h.b+=(p-h.b)*i,c.r+=(m-c.r)*i,c.g+=(f-c.g)*i,c.b+=(g-c.b)*i}}}class N extends y{slotIndex=0;attachmentNames;constructor(t,e){super(t,[b.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,i,n,a){let o=t.slots[this.slotIndex];o.bone.active&&(a!=exports.MixDirection.mixOut?s<this.frames[0]?n!=exports.MixBlend.setup&&n!=exports.MixBlend.first||this.setAttachment(t,o,o.data.attachmentName):this.setAttachment(t,o,this.attachmentNames[y.search1(this.frames,s)]):n==exports.MixBlend.setup&&this.setAttachment(t,o,o.data.attachmentName))}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class L extends M{slotIndex=0;attachment;vertices;constructor(t,e,s,r){super(t,e,[b.deform+"|"+s+"|"+r.id]),this.slotIndex=s,this.attachment=r,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,r,i,n,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let p=.03*(r-2*n+o),m=.03*l-.06*a,f=.006*(3*(n-o)-r+h),g=.018*(a-l+.33333333),x=2*p+f,w=2*m+g,b=.3*(n-r)+p+.16666667*f,y=.3*a+m+.16666667*g,M=r+b,S=y;for(let t=u+18;u<t;u+=2)d[u]=M,d[u+1]=S,b+=x,y+=w,x+=f,w+=g,M+=b,S+=y}getCurvePercent(t,e){let s=this.curves,r=s[e];switch(r){case 0:let s=this.frames[e];return(t-s)/(this.frames[e+this.getFrameEntries()]-s);case 1:return 0}if(r-=2,s[r]>t){let i=this.frames[e];return s[r+1]*(t-i)/(s[r]-i)}let i=r+18;for(r+=2;r<i;r+=2)if(s[r]>=t){let e=s[r-2],i=s[r-1];return i+(t-e)/(s[r]-e)*(s[r+1]-i)}let n=s[i-2],a=s[i-1];return a+(1-a)*(t-n)/(this.frames[e+this.getFrameEntries()]-n)}apply(t,e,s,r,i,n,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.getAttachment();if(!l)return;if(!(l instanceof p)||l.timelineAttachment!=this.attachment)return;let c=o.deform;0==c.length&&(n=exports.MixBlend.setup);let d=this.vertices,u=d[0].length,m=this.frames;if(s<m[0]){switch(n){case exports.MixBlend.setup:return void(c.length=0);case exports.MixBlend.first:if(1==i)return void(c.length=0);c.length=u;let t=l;if(t.bones){i=1-i;for(f=0;f<u;f++)c[f]*=i}else{let e=t.vertices;for(var f=0;f<u;f++)c[f]+=(e[f]-c[f])*i}}return}if(c.length=u,s>=m[m.length-1]){let t=d[m.length-1];if(1==i)if(n==exports.MixBlend.add){let e=l;if(e.bones)for(let e=0;e<u;e++)c[e]+=t[e];else{let s=e.vertices;for(let e=0;e<u;e++)c[e]+=t[e]-s[e]}}else h.arrayCopy(t,0,c,0,u);else switch(n){case exports.MixBlend.setup:{let e=l;if(e.bones)for(let e=0;e<u;e++)c[e]=t[e]*i;else{let s=e.vertices;for(let e=0;e<u;e++){let r=s[e];c[e]=r+(t[e]-r)*i}}break}case exports.MixBlend.first:case exports.MixBlend.replace:for(let e=0;e<u;e++)c[e]+=(t[e]-c[e])*i;break;case exports.MixBlend.add:let e=l;if(e.bones)for(let e=0;e<u;e++)c[e]+=t[e]*i;else{let s=e.vertices;for(let e=0;e<u;e++)c[e]+=(t[e]-s[e])*i}}return}let g=y.search1(m,s),x=this.getCurvePercent(s,g),w=d[g],b=d[g+1];if(1==i)if(n==exports.MixBlend.add){let t=l;if(t.bones)for(let t=0;t<u;t++){let e=w[t];c[t]+=e+(b[t]-e)*x}else{let e=t.vertices;for(let t=0;t<u;t++){let s=w[t];c[t]+=s+(b[t]-s)*x-e[t]}}}else for(let t=0;t<u;t++){let e=w[t];c[t]=e+(b[t]-e)*x}else switch(n){case exports.MixBlend.setup:{let t=l;if(t.bones)for(let t=0;t<u;t++){let e=w[t];c[t]=(e+(b[t]-e)*x)*i}else{let e=t.vertices;for(let t=0;t<u;t++){let s=w[t],r=e[t];c[t]=r+(s+(b[t]-s)*x-r)*i}}break}case exports.MixBlend.first:case exports.MixBlend.replace:for(let t=0;t<u;t++){let e=w[t];c[t]+=(e+(b[t]-e)*x-c[t])*i}break;case exports.MixBlend.add:let t=l;if(t.bones)for(let t=0;t<u;t++){let e=w[t];c[t]+=(e+(b[t]-e)*x)*i}else{let e=t.vertices;for(let t=0;t<u;t++){let s=w[t];c[t]+=(s+(b[t]-s)*x-e[t])*i}}}}}class q extends y{static propertyIds=[""+b.event];events;constructor(t){super(t,q.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,r,i,n,a){if(!r)return;let o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,i,n,a),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let h=0;if(e<o[0])h=0;else{h=y.search1(o,e)+1;let t=o[h];for(;h>0&&o[h-1]==t;)h--}for(;h<l&&s>=o[h];h++)r.push(this.events[h])}}class W extends y{static propertyIds=[""+b.drawOrder];drawOrders;constructor(t){super(t,W.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,r,i,n,a){if(a==exports.MixDirection.mixOut)return void(n==exports.MixBlend.setup&&h.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s<this.frames[0])return void(n!=exports.MixBlend.setup&&n!=exports.MixBlend.first||h.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));let o=y.search1(this.frames,s),l=this.drawOrders[o];if(l){let e=t.drawOrder,s=t.slots;for(let t=0,r=l.length;t<r;t++)e[t]=s[l[t]]}else h.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)}}class U extends M{constraintIndex=0;constructor(t,e,s){super(t,e,[b.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,r,i,n,a){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=n?1:0,this.frames[t+5]=a?1:0}apply(t,e,s,r,i,n,a){let o=t.ikConstraints[this.constraintIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case exports.MixBlend.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 exports.MixBlend.first:o.mix+=(o.data.mix-o.mix)*i,o.softness+=(o.data.softness-o.softness)*i,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let h=0,c=0,d=y.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)}n==exports.MixBlend.setup?(o.mix=o.data.mix+(h-o.data.mix)*i,o.softness=o.data.softness+(c-o.data.softness)*i,a==exports.MixDirection.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)*i,o.softness+=(c-o.softness)*i,a==exports.MixDirection.mixIn&&(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5]))}}class z extends M{constraintIndex=0;constructor(t,e,s){super(t,e,[b.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,i,n,a,o){let l=this.frames;l[t*=7]=e,l[t+1]=s,l[t+2]=r,l[t+3]=i,l[t+4]=n,l[t+5]=a,l[t+6]=o}apply(t,e,s,r,i,n,a){let o=t.transformConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d,u,p,m=this.frames;if(s<m[0]){let t=o.data;switch(n){case exports.MixBlend.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 exports.MixBlend.first:o.mixRotate+=(t.mixRotate-o.mixRotate)*i,o.mixX+=(t.mixX-o.mixX)*i,o.mixY+=(t.mixY-o.mixY)*i,o.mixScaleX+=(t.mixScaleX-o.mixScaleX)*i,o.mixScaleY+=(t.mixScaleY-o.mixScaleY)*i,o.mixShearY+=(t.mixShearY-o.mixShearY)*i}return}let f=y.search(m,s,7),g=this.curves[f/7];switch(g){case 0:let t=m[f];l=m[f+1],h=m[f+2],c=m[f+3],d=m[f+4],u=m[f+5],p=m[f+6];let e=(s-t)/(m[f+7]-t);l+=(m[f+7+1]-l)*e,h+=(m[f+7+2]-h)*e,c+=(m[f+7+3]-c)*e,d+=(m[f+7+4]-d)*e,u+=(m[f+7+5]-u)*e,p+=(m[f+7+6]-p)*e;break;case 1:l=m[f+1],h=m[f+2],c=m[f+3],d=m[f+4],u=m[f+5],p=m[f+6];break;default:l=this.getBezierValue(s,f,1,g-2),h=this.getBezierValue(s,f,2,g+18-2),c=this.getBezierValue(s,f,3,g+36-2),d=this.getBezierValue(s,f,4,g+54-2),u=this.getBezierValue(s,f,5,g+72-2),p=this.getBezierValue(s,f,6,g+90-2)}if(n==exports.MixBlend.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*i,o.mixX=t.mixX+(h-t.mixX)*i,o.mixY=t.mixY+(c-t.mixY)*i,o.mixScaleX=t.mixScaleX+(d-t.mixScaleX)*i,o.mixScaleY=t.mixScaleY+(u-t.mixScaleY)*i,o.mixShearY=t.mixShearY+(p-t.mixShearY)*i}else o.mixRotate+=(l-o.mixRotate)*i,o.mixX+=(h-o.mixX)*i,o.mixY+=(c-o.mixY)*i,o.mixScaleX+=(d-o.mixScaleX)*i,o.mixScaleY+=(u-o.mixScaleY)*i,o.mixShearY+=(p-o.mixShearY)*i}}class G extends S{constraintIndex=0;constructor(t,e,s){super(t,e,b.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,n,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.position=this.getAbsoluteValue(s,i,n,o.position,o.data.position))}}class $ extends S{constraintIndex=0;constructor(t,e,s){super(t,e,b.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,n,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.spacing=this.getAbsoluteValue(s,i,n,o.spacing,o.data.spacing))}}class j extends M{constraintIndex=0;constructor(t,e,s){super(t,e,[b.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,i){let n=this.frames;n[t<<=2]=e,n[t+1]=s,n[t+2]=r,n[t+3]=i}apply(t,e,s,r,i,n,a){let o=t.pathConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d=this.frames;if(s<d[0]){switch(n){case exports.MixBlend.setup:return o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,void(o.mixY=o.data.mixY);case exports.MixBlend.first:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*i,o.mixX+=(o.data.mixX-o.mixX)*i,o.mixY+=(o.data.mixY-o.mixY)*i}return}let u=y.search(d,s,4),p=this.curves[u>>2];switch(p){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,p-2),h=this.getBezierValue(s,u,2,p+18-2),c=this.getBezierValue(s,u,3,p+36-2)}if(n==exports.MixBlend.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*i,o.mixX=t.mixX+(h-t.mixX)*i,o.mixY=t.mixY+(c-t.mixY)*i}else o.mixRotate+=(l-o.mixRotate)*i,o.mixX+=(h-o.mixX)*i,o.mixY+=(c-o.mixY)*i}}class H extends S{constraintIndex=0;constructor(t,e,s,r){super(t,e,r+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,n,a){let o;if(-1==this.constraintIndex){const e=s>=this.frames[0]?this.getCurveValue(s):0;for(const r of t.physicsConstraints)r.active&&this.global(r.data)&&this.set(r,this.getAbsoluteValue2(s,i,n,this.get(r),this.setup(r),e))}else o=t.physicsConstraints[this.constraintIndex],o.active&&this.set(o,this.getAbsoluteValue(s,i,n,this.get(o),this.setup(o)))}}class J extends H{constructor(t,e,s){super(t,e,s,b.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}}class K extends H{constructor(t,e,s){super(t,e,s,b.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}}class Q extends H{constructor(t,e,s){super(t,e,s,b.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}}class Z extends H{constructor(t,e,s){super(t,e,s,b.physicsConstraintMass)}setup(t){return 1/t.data.massInverse}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}}class tt extends H{constructor(t,e,s){super(t,e,s,b.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}}class et extends H{constructor(t,e,s){super(t,e,s,b.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}}class st extends H{constructor(t,e,s){super(t,e,s,b.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}}class rt extends y{static propertyIds=[b.physicsConstraintReset.toString()];constraintIndex;constructor(t,e){super(t,rt.propertyIds),this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,r,i,n,a){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,[],i,n,a),e=-1;else if(e>=l[l.length-1])return;if(!(s<l[0])&&(e<l[0]||s>=l[y.search1(l,e)+1]))if(null!=o)o.reset();else for(const e of t.physicsConstraints)e.active&&e.reset()}}class it extends y{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,e,s){super(t,[b.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return it.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,r,i){let n=this.frames;n[t*=it.ENTRIES]=e,n[t+it.MODE]=s|r<<4,n[t+it.DELAY]=i}apply(e,s,r,i,n,a,o){let l=e.slots[this.slotIndex];if(!l.bone.active)return;let h=l.attachment,c=this.attachment;if(!(h==c||h instanceof p&&h.timelineAttachment==c))return;let d=this.frames;if(r<d[0])return void(a!=exports.MixBlend.setup&&a!=exports.MixBlend.first||(l.sequenceIndex=-1));let u=y.search(d,r,it.ENTRIES),m=d[u],g=d[u+it.MODE],x=d[u+it.DELAY];if(!this.attachment.sequence)return;let w=g>>4,b=this.attachment.sequence.regions.length,M=f[15&g];if(M!=t.hold)switch(w+=(r-m)/x+1e-5|0,M){case t.once:w=Math.min(b-1,w);break;case t.loop:w%=b;break;case t.pingpong:{let t=(b<<1)-2;w=0==t?0:w%t,w>=b&&(w=t-w);break}case t.onceReverse:w=Math.max(b-1-w,0);break;case t.loopReverse:w=b-1-w%b;break;case t.pingpongReverse:{let t=(b<<1)-2;w=0==t?0:(w+b-1)%t,w>=b&&(w=t-w)}}l.sequenceIndex=w}}class nt{static _emptyAnimation=new g("<empty>",[],0);static emptyAnimation(){return nt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new ot(this);propertyIDs=new i;animationsChanged=!1;trackEntryPool=new c((()=>new at));constructor(t){this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let i=t*r.timeScale;if(r.delay>0){if(r.delay-=i,r.delay>0)continue;i=-r.delay,r.delay=0}let n=r.next;if(n){let e=r.trackLast-n.delay;if(e>=0){for(n.delay=0,n.trackTime+=0==r.timeScale?0:(e/r.timeScale+t)*n.timeScale,r.trackTime+=i,this.setCurrent(s,n,!0);n.mixingFrom;)n.mixTime+=t,n=n.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){e[s]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,t)){let t=r.mixingFrom;for(r.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}r.trackTime+=i}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let r=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)),r):(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,r=!1;for(let n=0,a=s.length;n<a;n++){let a=s[n];if(!a||a.delay>0)continue;r=!0;let o=0==n?exports.MixBlend.first:a.mixBlend,l=a.alpha;a.mixingFrom?l*=this.applyMixingFrom(a,t,o):a.trackTime>=a.trackEnd&&!a.next&&(l=0);let c=l>=a.alphaAttachmentThreshold,d=a.animationLast,u=a.getAnimationTime(),p=u,m=e;a.reverse&&(p=a.animation.duration-p,m=null);let f=a.animation.timelines,g=f.length;if(0==n&&1==l||o==exports.MixBlend.add){0==n&&(c=!0);for(let e=0;e<g;e++){h.webkit602BugfixHelper(l,o);var i=f[e];i instanceof N?this.applyAttachmentTimeline(i,t,p,o,c):i.apply(t,d,p,m,l,o,exports.MixDirection.mixIn)}}else{let e=a.timelineMode,s=a.shortestRotation,r=!s&&a.timelinesRotation.length!=g<<1;r&&(a.timelinesRotation.length=g<<1);for(let i=0;i<g;i++){let n=f[i],u=e[i]==ht?o:exports.MixBlend.setup;!s&&n instanceof k?this.applyRotateTimeline(n,t,p,l,u,a.timelinesRotation,i<<1,r):n instanceof N?this.applyAttachmentTimeline(n,t,p,o,c):(h.webkit602BugfixHelper(l,o),n.apply(t,d,p,m,l,u,exports.MixDirection.mixIn))}}this.queueEvents(a,u),e.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime}for(var n=this.unkeyedState+mt,a=t.slots,o=0,l=t.slots.length;o<l;o++){var c=a[o];if(c.attachmentState==n){var d=c.data.attachmentName;c.setAttachment(d?t.getAttachment(c.data.index,d):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(t,e,s){let r=t.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,e,s);let i=0;0==t.mixDuration?(i=1,s==exports.MixBlend.first&&(s=exports.MixBlend.setup)):(i=t.mixTime/t.mixDuration,i>1&&(i=1),s!=exports.MixBlend.first&&(s=r.mixBlend));let n=i<r.mixAttachmentThreshold,a=i<r.mixDrawOrderThreshold,o=r.animation.timelines,l=o.length,c=r.alpha*t.interruptAlpha,d=c*(1-i),u=r.animationLast,p=r.getAnimationTime(),m=p,f=null;if(r.reverse?m=r.animation.duration-m:i<r.eventThreshold&&(f=this.events),s==exports.MixBlend.add)for(let t=0;t<l;t++)o[t].apply(e,u,m,f,d,s,exports.MixDirection.mixOut);else{let t=r.timelineMode,i=r.timelineHoldMix,p=r.shortestRotation,g=!p&&r.timelinesRotation.length!=l<<1;g&&(r.timelinesRotation.length=l<<1),r.totalAlpha=0;for(let x=0;x<l;x++){let l,w=o[x],b=exports.MixDirection.mixOut,y=0;switch(t[x]){case ht:if(!a&&w instanceof W)continue;l=s,y=d;break;case ct:l=exports.MixBlend.setup,y=d;break;case dt:l=s,y=c;break;case ut:l=exports.MixBlend.setup,y=c;break;default:l=exports.MixBlend.setup;let t=i[x];y=c*Math.max(0,1-t.mixTime/t.mixDuration)}r.totalAlpha+=y,!p&&w instanceof k?this.applyRotateTimeline(w,e,m,y,l,r.timelinesRotation,x<<1,g):w instanceof N?this.applyAttachmentTimeline(w,e,m,l,n&&y>=r.alphaAttachmentThreshold):(h.webkit602BugfixHelper(y,s),a&&w instanceof W&&l==exports.MixBlend.setup&&(b=exports.MixDirection.mixIn),w.apply(e,u,m,f,y,l,b))}}return t.mixDuration>0&&this.queueEvents(r,p),this.events.length=0,r.nextAnimationLast=p,r.nextTrackLast=r.trackTime,i}applyAttachmentTimeline(t,e,s,r,i){var n=e.slots[t.slotIndex];n.bone.active&&(s<t.frames[0]?r!=exports.MixBlend.setup&&r!=exports.MixBlend.first||this.setAttachment(e,n,n.data.attachmentName,i):this.setAttachment(e,n,t.attachmentNames[y.search1(t.frames,s)],i),n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+mt))}setAttachment(t,e,s,r){e.setAttachment(s?t.getAttachment(e.data.index,s):null),r&&(e.attachmentState=this.unkeyedState+ft)}applyRotateTimeline(t,e,s,r,i,n,o,l){if(l&&(n[o]=0),1==r)return void t.apply(e,0,s,null,1,i,exports.MixDirection.mixIn);let h=e.bones[t.boneIndex];if(!h.active)return;let c=0,d=0;if(s<t.frames[0])switch(i){case exports.MixBlend.setup:h.rotation=h.data.rotation;default:return;case exports.MixBlend.first:c=h.rotation,d=h.data.rotation}else c=i==exports.MixBlend.setup?h.data.rotation:h.rotation,d=h.data.rotation+t.getCurveValue(s);let u=0,p=d-c;if(p-=360*Math.ceil(p/360-.5),0==p)u=n[o];else{let t=0,e=0;l?(t=0,e=p):(t=n[o],e=n[o+1]);let s=t-t%360;u=p+s;let r=p>=0,i=t>=0;Math.abs(e)<=90&&a.signum(e)!=a.signum(p)&&(Math.abs(t-s)>180?(u+=360*a.signum(t),i=r):0!=s?u-=360*a.signum(t):i=r),i!=r&&(u+=360*a.signum(t)),n[o]=u}n[o+1]=p,h.rotation=c+u*r}queueEvents(t,e){let s=t.animationStart,r=t.animationEnd,i=r-s,n=t.trackLast%i,a=this.events,o=0,l=a.length;for(;o<l;o++){let e=a[o];if(e.time<n)break;e.time>r||this.queue.event(t,e)}let h=!1;if(t.loop)if(0==i)h=!0;else{const e=Math.floor(t.trackTime/i);h=e>0&&e>Math.floor(t.trackLast/i)}else h=e>=r&&t.animationLast<r;for(h&&this.queue.complete(t);o<l;o++){let e=a[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 r=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,r&&(s&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let r=this.data.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,r,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let r=!0,i=this.expandToIndex(t);i&&(-1==i.nextTrackLast?(this.tracks[t]=i.mixingFrom,this.queue.interrupt(i),this.queue.end(i),this.clearNext(i),i=i.mixingFrom,r=!1):this.clearNext(i));let n=this.trackEntry(t,e,s,i);return this.setCurrent(t,n,r),this.queue.drain(),n}addAnimation(t,e,s=!1,r=0){let i=this.data.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,i,s,r)}addAnimationWith(t,e,s=!1,r=0){if(!e)throw new Error("animation cannot be null.");let i=this.expandToIndex(t);if(i)for(;i.next;)i=i.next;let n=this.trackEntry(t,e,s,i);return i?(i.next=n,n.previous=i,r<=0&&(r+=i.getTrackComplete()-n.mixDuration)):(this.setCurrent(t,n,!0),this.queue.drain()),n.delay=r,n}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,nt.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let r=this.addAnimationWith(t,nt.emptyAnimation(),!1,s);return s<=0&&(r.delay+=r.mixDuration-e),r.mixDuration=e,r.trackEnd=e,r}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]:(h.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,s,r){let i=this.trackEntryPool.obtain();return i.reset(),i.trackIndex=t,i.animation=e,i.loop=s,i.holdPrevious=!1,i.reverse=!1,i.shortestRotation=!1,i.eventThreshold=0,i.alphaAttachmentThreshold=0,i.mixAttachmentThreshold=0,i.mixDrawOrderThreshold=0,i.animationStart=0,i.animationEnd=e.duration,i.animationLast=-1,i.nextAnimationLast=-1,i.delay=0,i.trackTime=0,i.trackLast=-1,i.nextTrackLast=-1,i.trackEnd=Number.MAX_VALUE,i.timeScale=1,i.alpha=1,i.mixTime=0,i.mixDuration=r?this.data.getMix(r.animation,e):0,i.interruptAlpha=1,i.totalAlpha=0,i.mixBlend=exports.MixBlend.replace,i}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==exports.MixBlend.add||this.computeHold(s),s=s.mixingTo}while(s)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,r=t.animation.timelines.length,i=t.timelineMode;i.length=r;let n=t.timelineHoldMix;n.length=0;let a=this.propertyIDs;if(e&&e.holdPrevious)for(let t=0;t<r;t++)i[t]=a.addAll(s[t].getPropertyIds())?ut:dt;else t:for(let o=0;o<r;o++){let r=s[o],l=r.getPropertyIds();if(a.addAll(l))if(!e||r instanceof N||r instanceof W||r instanceof q||!e.animation.hasTimeline(l))i[o]=ct;else{for(let s=e.mixingTo;s;s=s.mixingTo)if(!s.animation.hasTimeline(l)){if(t.mixDuration>0){i[o]=pt,n[o]=s;continue t}break}i[o]=ut}else i[o]=ht}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){let e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}}class at{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=exports.MixBlend.replace;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(0!=t){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return-1!=this.nextTrackLast}isNextReady(){return null!=this.next&&this.nextTrackLast-this.next.delay>=0}}class ot{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(exports.EventType.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(exports.EventType.interrupt),this.objects.push(t)}end(t){this.objects.push(exports.EventType.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(exports.EventType.dispose),this.objects.push(t)}complete(t){this.objects.push(exports.EventType.complete),this.objects.push(t)}event(t,e){this.objects.push(exports.EventType.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 r=t[s],i=t[s+1];switch(r){case exports.EventType.start:i.listener&&i.listener.start&&i.listener.start(i);for(let t=0;t<e.length;t++){let s=e[t];s.start&&s.start(i)}break;case exports.EventType.interrupt:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let t=0;t<e.length;t++){let s=e[t];s.interrupt&&s.interrupt(i)}break;case exports.EventType.end:i.listener&&i.listener.end&&i.listener.end(i);for(let t=0;t<e.length;t++){let s=e[t];s.end&&s.end(i)}case exports.EventType.dispose:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let t=0;t<e.length;t++){let s=e[t];s.dispose&&s.dispose(i)}this.animState.trackEntryPool.free(i);break;case exports.EventType.complete:i.listener&&i.listener.complete&&i.listener.complete(i);for(let t=0;t<e.length;t++){let s=e[t];s.complete&&s.complete(i)}break;case exports.EventType.event:let r=t[2+s++];i.listener&&i.listener.event&&i.listener.event(i,r);for(let t=0;t<e.length;t++){let s=e[t];s.event&&s.event(i,r)}}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}}var lt;exports.EventType=void 0,(lt=exports.EventType||(exports.EventType={}))[lt.start=0]="start",lt[lt.interrupt=1]="interrupt",lt[lt.end=2]="end",lt[lt.dispose=3]="dispose",lt[lt.complete=4]="complete",lt[lt.event=5]="event";const ht=0,ct=1,dt=2,ut=3,pt=4,mt=1,ft=2;class gt{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);this.setMixWith(r,i,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let r=t.name+"."+e.name;this.animationToMixTime[r]=s}getMix(t,e){let s=t.name+"."+e.name,r=this.animationToMixTime[s];return void 0===r?this.defaultMix:r}}class xt extends p{color=new n(1,1,1,1);constructor(t){super(t)}copy(){let t=new xt(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class wt extends p{endSlot=null;color=new n(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new wt(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class bt{_image;constructor(t){this._image=t}getImage(){return this._image}}var yt,Mt,St,vt,kt,It,At,Tt,Bt;exports.TextureFilter=void 0,(yt=exports.TextureFilter||(exports.TextureFilter={}))[yt.Nearest=9728]="Nearest",yt[yt.Linear=9729]="Linear",yt[yt.MipMap=9987]="MipMap",yt[yt.MipMapNearestNearest=9984]="MipMapNearestNearest",yt[yt.MipMapLinearNearest=9985]="MipMapLinearNearest",yt[yt.MipMapNearestLinear=9986]="MipMapNearestLinear",yt[yt.MipMapLinearLinear=9987]="MipMapLinearLinear",exports.TextureWrap=void 0,(Mt=exports.TextureWrap||(exports.TextureWrap={}))[Mt.MirroredRepeat=33648]="MirroredRepeat",Mt[Mt.ClampToEdge=33071]="ClampToEdge",Mt[Mt.Repeat=10497]="Repeat";class Ct{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0}class Ft{pages=new Array;regions=new Array;constructor(t){let e=new Et(t),s=new Array(4),r={size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},format:()=>{},filter:t=>{t.minFilter=h.enumValue(exports.TextureFilter,s[1]),t.magFilter=h.enumValue(exports.TextureFilter,s[2])},repeat:t=>{-1!=s[1].indexOf("x")&&(t.uWrap=exports.TextureWrap.Repeat),-1!=s[1].indexOf("y")&&(t.vWrap=exports.TextureWrap.Repeat)},pma:t=>{t.pma="true"==s[1]}};var i={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 n=e.readLine();for(;n&&0==n.trim().length;)n=e.readLine();for(;n&&0!=n.trim().length&&0!=e.readEntry(s,n);)n=e.readLine();let a=null,o=null,l=null;for(;null!==n;)if(0==n.trim().length)a=null,n=e.readLine();else if(a){let t=new Yt(a,n);for(;;){let r=e.readEntry(s,n=e.readLine());if(0==r)break;let a=i[s[0]];if(a)a(t);else{o||(o=[]),l||(l=[]),o.push(s[0]);let t=[];for(let e=0;e<r;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/a.width,t.v=t.y/a.height,90==t.degrees?(t.u2=(t.x+t.height)/a.width,t.v2=(t.y+t.width)/a.height):(t.u2=(t.x+t.width)/a.width,t.v2=(t.y+t.height)/a.height),this.regions.push(t)}else{for(a=new Rt(n.trim());0!=e.readEntry(s,n=e.readLine());){let t=r[s[0]];t&&t(a)}this.pages.push(a)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}}class Et{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e)return 0;if(0==(e=e.trim()).length)return 0;let s=e.indexOf(":");if(-1==s)return 0;t[0]=e.substr(0,s).trim();for(let r=1,i=s+1;;r++){let s=e.indexOf(",",i);if(-1==s)return t[r]=e.substr(i).trim(),r;if(t[r]=e.substr(i,s-i).trim(),i=s+1,4==r)return 4}}}class Rt{name;minFilter=exports.TextureFilter.Nearest;magFilter=exports.TextureFilter.Nearest;uWrap=exports.TextureWrap.ClampToEdge;vWrap=exports.TextureWrap.ClampToEdge;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}}class Yt extends Ct{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}}class Pt extends p{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new n(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new n(0,0,0,0);constructor(t,e){super(t),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;this.uvs&&this.uvs.length==t.length||(this.uvs=h.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,r=this.region.u,i=this.region.v,n=0,a=0;if(this.region instanceof Yt){let o=this.region,l=o.page,h=l.width,c=l.height;switch(o.degrees){case 90:r-=(o.originalHeight-o.offsetY-o.height)/h,i-=(o.originalWidth-o.offsetX-o.width)/c,n=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=r+t[o+1]*n,e[o+1]=i+(1-t[o])*a;return;case 180:r-=(o.originalWidth-o.offsetX-o.width)/h,i-=o.offsetY/c,n=o.originalWidth/h,a=o.originalHeight/c;for(let o=0;o<s;o+=2)e[o]=r+(1-t[o])*n,e[o+1]=i+(1-t[o+1])*a;return;case 270:r-=o.offsetY/h,i-=o.offsetX/c,n=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=r+(1-t[o+1])*n,e[o+1]=i+t[o]*a;return}r-=o.offsetX/h,i-=(o.originalHeight-o.offsetY-o.height)/c,n=o.originalWidth/h,a=o.originalHeight/c}else this.region?(n=this.region.u2-r,a=this.region.v2-i):(r=i=0,n=a=1);for(let o=0;o<s;o+=2)e[o]=r+t[o]*n,e[o+1]=i+t[o+1]*a}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new Pt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),h.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),h.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),h.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),h.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,r,i,n){null!=this.sequence&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,r,i,n)}newLinkedMesh(){let t=new Pt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),null!=t.region&&t.updateRegion(),t}}class Xt extends p{lengths=[];closed=!1;constantSpeed=!1;color=new n(1,1,1,1);constructor(t){super(t)}copy(){let t=new Xt(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),h.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class _t extends p{x=0;y=0;rotation=0;color=new n(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,e){return e.x=this.x*t.a+this.y*t.b+t.worldX,e.y=this.x*t.c+this.y*t.d+t.worldY,e}computeWorldRotation(t){const e=this.rotation*a.degRad,s=Math.cos(e),r=Math.sin(e),i=s*t.a+r*t.b,n=s*t.c+r*t.d;return a.atan2Deg(n,i)}copy(){let t=new _t(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}class Vt extends u{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new n(1,1,1,1);path;region=null;sequence=null;offset=h.newFloatArray(8);uvs=h.newFloatArray(8);tempColor=new n(1,1,1,1);constructor(t,e){super(t),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,e=this.uvs;if(null==t)return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=1,e[5]=1,e[6]=1,void(e[7]=0);let s=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,i=-this.width/2*this.scaleX+this.region.offsetX*s,n=-this.height/2*this.scaleY+this.region.offsetY*r,o=i+this.region.width*s,l=n+this.region.height*r,h=this.rotation*a.degRad,c=Math.cos(h),d=Math.sin(h),u=this.x,p=this.y,m=i*c+u,f=i*d,g=n*c+p,x=n*d,w=o*c+u,b=o*d,y=l*c+p,M=l*d,S=this.offset;S[0]=m-x,S[1]=g+f,S[2]=m-M,S[3]=y+f,S[4]=w-M,S[5]=y+b,S[6]=w-x,S[7]=g+b,90==t.degrees?(e[0]=t.u2,e[1]=t.v2,e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,r){null!=this.sequence&&this.sequence.apply(t,this);let i=t.bone,n=this.offset,a=i.worldX,o=i.worldY,l=i.a,h=i.b,c=i.c,d=i.d,u=0,p=0;u=n[0],p=n[1],e[s]=u*l+p*h+a,e[s+1]=u*c+p*d+o,s+=r,u=n[2],p=n[3],e[s]=u*l+p*h+a,e[s+1]=u*c+p*d+o,s+=r,u=n[4],p=n[5],e[s]=u*l+p*h+a,e[s+1]=u*c+p*d+o,s+=r,u=n[6],p=n[7],e[s]=u*l+p*h+a,e[s+1]=u*c+p*d+o}copy(){let t=new Vt(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,h.arrayCopy(this.uvs,0,t.uvs,0,8),h.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=null!=this.sequence?this.sequence.copy():null,t}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31}class Dt{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let r=s.regions;for(let i=0,n=r.length;i<n;i++){let n=s.getPath(e,i),a=this.atlas.findRegion(n);if(null==a)throw new Error("Region not found in atlas: "+n+" (sequence: "+t+")");r[i]=a}}newRegionAttachment(t,e,s,r){let i=new Vt(e,s);if(null!=r)this.loadSequence(e,s,r);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");i.region=t}return i}newMeshAttachment(t,e,s,r){let i=new Pt(e,s);if(null!=r)this.loadSequence(e,s,r);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");i.region=t}return i}newBoundingBoxAttachment(t,e){return new xt(e)}newPathAttachment(t,e){return new Xt(e)}newPointAttachment(t,e){return new _t(e)}newClippingAttachment(t,e){return new wt(e)}}class Ot{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=exports.Inherit.Normal;skinRequired=!1;color=new n;icon;visible=!1;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}}exports.Inherit=void 0,(St=exports.Inherit||(exports.Inherit={}))[St.Normal=0]="Normal",St[St.OnlyTranslation=1]="OnlyTranslation",St[St.NoRotationOrReflection=2]="NoRotationOrReflection",St[St.NoScale=3]="NoScale",St[St.NoScaleOrReflection=4]="NoScaleOrReflection";class Nt{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=exports.Inherit.Normal;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,r,i,n,o){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=r,this.ascaleY=i,this.ashearX=n,this.ashearY=o;let l=this.parent;if(!l){let l=this.skeleton;const h=l.scaleX,c=l.scaleY,d=(s+n)*a.degRad,u=(s+90+o)*a.degRad;return this.a=Math.cos(d)*r*h,this.b=Math.cos(u)*i*h,this.c=Math.sin(d)*r*c,this.d=Math.sin(u)*i*c,this.worldX=t*h+l.x,void(this.worldY=e*c+l.y)}let h=l.a,c=l.b,d=l.c,u=l.d;switch(this.worldX=h*t+c*e+l.worldX,this.worldY=d*t+u*e+l.worldY,this.inherit){case exports.Inherit.Normal:{const t=(s+n)*a.degRad,e=(s+90+o)*a.degRad,l=Math.cos(t)*r,p=Math.cos(e)*i,m=Math.sin(t)*r,f=Math.sin(e)*i;return this.a=h*l+c*m,this.b=h*p+c*f,this.c=d*l+u*m,void(this.d=d*p+u*f)}case exports.Inherit.OnlyTranslation:{const t=(s+n)*a.degRad,e=(s+90+o)*a.degRad;this.a=Math.cos(t)*r,this.b=Math.cos(e)*i,this.c=Math.sin(t)*r,this.d=Math.sin(e)*i;break}case exports.Inherit.NoRotationOrReflection:{let t=h*h+d*d,e=0;t>1e-4?(t=Math.abs(h*u-c*d)/t,h/=this.skeleton.scaleX,d/=this.skeleton.scaleY,c=d*t,u=h*t,e=Math.atan2(d,h)*a.radDeg):(h=0,d=0,e=90-Math.atan2(u,c)*a.radDeg);const l=(s+n-e)*a.degRad,p=(s+o-e+90)*a.degRad,m=Math.cos(l)*r,f=Math.cos(p)*i,g=Math.sin(l)*r,x=Math.sin(p)*i;this.a=h*m-c*g,this.b=h*f-c*x,this.c=d*m+u*g,this.d=d*f+u*x;break}case exports.Inherit.NoScale:case exports.Inherit.NoScaleOrReflection:{s*=a.degRad;const t=Math.cos(s),e=Math.sin(s);let l=(h*t+c*e)/this.skeleton.scaleX,p=(d*t+u*e)/this.skeleton.scaleY,m=Math.sqrt(l*l+p*p);m>1e-5&&(m=1/m),l*=m,p*=m,m=Math.sqrt(l*l+p*p),this.inherit==exports.Inherit.NoScale&&h*u-c*d<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(m=-m),s=Math.PI/2+Math.atan2(p,l);const f=Math.cos(s)*m,g=Math.sin(s)*m;n*=a.degRad,o=(90+o)*a.degRad;const x=Math.cos(n)*r,w=Math.cos(o)*i,b=Math.sin(n)*r,y=Math.sin(o)*i;this.a=l*x+f*b,this.b=l*w+f*y,this.c=p*x+g*b,this.d=p*w+g*y;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)*a.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,void(this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*a.radDeg);let e,s,r,i,n=t.a,o=t.b,l=t.c,h=t.d,c=1/(n*h-o*l),d=h*c,u=o*c,p=l*c,m=n*c,f=this.worldX-t.worldX,g=this.worldY-t.worldY;if(this.ax=f*d-g*u,this.ay=g*m-f*p,this.inherit==exports.Inherit.OnlyTranslation)e=this.a,s=this.b,r=this.c,i=this.d;else{switch(this.inherit){case exports.Inherit.NoRotationOrReflection:{let t=Math.abs(n*h-o*l)/(n*n+l*l),e=n/this.skeleton.scaleX;o=-(l/this.skeleton.scaleY)*t*this.skeleton.scaleX,h=e*t*this.skeleton.scaleY,c=1/(n*h-o*l),d=h*c,u=o*c;break}case exports.Inherit.NoScale:case exports.Inherit.NoScaleOrReflection:let t=a.cosDeg(this.rotation),e=a.sinDeg(this.rotation);n=(n*t+o*e)/this.skeleton.scaleX,l=(l*t+h*e)/this.skeleton.scaleY;let s=Math.sqrt(n*n+l*l);s>1e-5&&(s=1/s),n*=s,l*=s,s=Math.sqrt(n*n+l*l),this.inherit==exports.Inherit.NoScale&&c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(s=-s);let r=a.PI/2+Math.atan2(l,n);o=Math.cos(r)*s,h=Math.sin(r)*s,c=1/(n*h-o*l),d=h*c,u=o*c,p=l*c,m=n*c}e=d*this.a-u*this.c,s=d*this.b-u*this.d,r=m*this.c-p*this.a,i=m*this.d-p*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(e*e+r*r),this.ascaleX>1e-4){let t=e*i-s*r;this.ascaleY=t/this.ascaleX,this.ashearY=-Math.atan2(e*s+r*i,t)*a.radDeg,this.arotation=Math.atan2(r,e)*a.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(s*s+i*i),this.ashearY=0,this.arotation=90-Math.atan2(i,s)*a.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*a.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*a.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,r=t.y-this.worldY;return t.x=s*this.d*e-r*this.b*e,t.y=r*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.worldToLocal(t)}parentToWorld(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=a.sinDeg(t),s=a.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*a.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=a.sinDeg(t),s=a.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*a.radDeg}rotateWorld(t){t*=a.degRad;const e=Math.sin(t),s=Math.cos(t),r=this.a,i=this.b;this.a=s*r-e*this.c,this.b=s*i-e*this.d,this.c=e*r+s*this.c,this.d=e*i+s*this.d}}class Lt{name;order;skinRequired;constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}class qt{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return-1!=e?(e+=7,s.atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=s.window.atob(t),r=e.length,i=new Uint8Array(r),n=0;n<r;n++)i[n]=e.charCodeAt(n);return i}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(-1==e)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,r){if(this.start(t,e,r))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToString(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let i=new s.XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",t,!0);let n=()=>{this.finish(t,i.status,i.responseText)};i.onload=n,i.onerror=n,i.send()}downloadJson(t,e,s){this.downloadText(t,(t=>{e(JSON.parse(t))}),s)}downloadBinary(t,e,r){if(this.start(t,e,r))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToUint8Array(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let i=new s.XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer";let n=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{200==i.status||0==i.status?this.finish(t,200,new Uint8Array(i.response)):n()},i.onerror=n,i.send()}start(t,e,s){let r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,s)}}finish(t,e,s){let r=this.callbacks[t];delete this.callbacks[t];let i=200==e||0==e?[s]:[e,s];for(let t=i.length-1,e=r.length;t<e;t+=2)r[t].apply(null,i)}}class Wt{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 Ut{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}}class zt{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(r)}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,r,i,n,o){let l=t.parent;if(!l)throw new Error("IK bone must have parent.");let h=l.a,c=l.b,d=l.c,u=l.d,p=-t.ashearX-t.arotation,m=0,f=0;switch(t.inherit){case exports.Inherit.OnlyTranslation:m=(e-t.worldX)*a.signum(t.skeleton.scaleX),f=(s-t.worldY)*a.signum(t.skeleton.scaleY);break;case exports.Inherit.NoRotationOrReflection:let r=Math.abs(h*u-c*d)/Math.max(1e-4,h*h+d*d),i=h/t.skeleton.scaleX,n=d/t.skeleton.scaleY;c=-n*r*t.skeleton.scaleX,u=i*r*t.skeleton.scaleY,p+=Math.atan2(n,i)*a.radDeg;default:let o=e-l.worldX,g=s-l.worldY,x=h*u-c*d;Math.abs(x)<=1e-4?(m=0,f=0):(m=(o*u-g*c)/x-t.ax,f=(g*h-o*d)/x-t.ay)}p+=Math.atan2(f,m)*a.radDeg,t.ascaleX<0&&(p+=180),p>180?p-=360:p<-180&&(p+=360);let g=t.ascaleX,x=t.ascaleY;if(r||i){switch(t.inherit){case exports.Inherit.NoScale:case exports.Inherit.NoScaleOrReflection:m=e-t.worldX,f=s-t.worldY}const a=t.data.length*g;if(a>1e-4){const t=m*m+f*f;if(r&&t<a*a||i&&t>a*a){const e=(Math.sqrt(t)/a-1)*o+1;g*=e,n&&(x*=e)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+p*o,g,x,t.ashearX,t.ashearY)}apply2(t,e,s,r,i,n,o,l,h){if(t.inherit!=exports.Inherit.Normal||e.inherit!=exports.Inherit.Normal)return;let c=t.ax,d=t.ay,u=t.ascaleX,p=t.ascaleY,m=u,f=p,g=e.ascaleX,x=0,w=0,b=0;u<0?(u=-u,x=180,b=-1):(x=0,b=1),p<0&&(p=-p,b=-b),g<0?(g=-g,w=180):w=0;let y=e.ax,M=0,S=0,v=0,k=t.a,I=t.b,A=t.c,T=t.d,B=Math.abs(u-p)<=1e-4;!B||n?(M=0,S=k*y+t.worldX,v=A*y+t.worldY):(M=e.ay,S=k*y+I*M+t.worldX,v=A*y+T*M+t.worldY);let C=t.parent;if(!C)throw new Error("IK parent must itself have a parent.");k=C.a,I=C.b,A=C.c,T=C.d;let F=k*T-I*A,E=S-C.worldX,R=v-C.worldY;F=Math.abs(F)<=1e-4?0:1/F;let Y,P,X=(E*T-R*I)*F-c,_=(R*k-E*A)*F-d,V=Math.sqrt(X*X+_*_),D=e.data.length*g;if(V<1e-4)return this.apply1(t,s,r,!1,n,!1,h),void e.updateWorldTransformWith(y,M,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);E=s-C.worldX,R=r-C.worldY;let O=(E*T-R*I)*F-c,N=(R*k-E*A)*F-d,L=O*O+N*N;if(0!=l){l*=u*(g+1)*.5;let t=Math.sqrt(L),e=t-V-D*u+l;if(e>0){let s=Math.min(1,e/(2*l))-1;s=(e-l*(1-s*s))/t,O-=s*O,N-=s*N,L=O*O+N*N}}t:if(B){D*=u;let t=(L-V*V-D*D)/(2*V*D);t<-1?(t=-1,P=Math.PI*i):t>1?(t=1,P=0,n&&(k=(Math.sqrt(L)/(V+D)-1)*h+1,m*=k,o&&(f*=k))):P=Math.acos(t)*i,k=V+D*t,I=D*Math.sin(P),Y=Math.atan2(N*k-O*I,O*k+N*I)}else{k=u*D,I=p*D;let t=k*k,e=I*I,s=Math.atan2(N,O);A=e*V*V+t*L-t*e;let r=-2*e*V,n=e-t;if(T=r*r-4*n*A,T>=0){let t=Math.sqrt(T);r<0&&(t=-t),t=.5*-(r+t);let e=t/n,a=A/t,o=Math.abs(e)<Math.abs(a)?e:a;if(o*o<=L){R=Math.sqrt(L-o*o)*i,Y=s-Math.atan2(R,o),P=Math.atan2(R/p,(o-V)/u);break t}}let o=a.PI,l=V-k,h=l*l,c=0,d=0,m=V+k,f=m*m,g=0;A=-k*V/(t-e),A>=-1&&A<=1&&(A=Math.acos(A),E=k*Math.cos(A)+V,R=I*Math.sin(A),T=E*E+R*R,T<h&&(o=A,h=T,l=E,c=R),T>f&&(d=A,f=T,m=E,g=R)),L<=.5*(h+f)?(Y=s-Math.atan2(c*i,l),P=o*i):(Y=s-Math.atan2(g*i,m),P=d*i)}let q=Math.atan2(M,y)*b,W=t.arotation;Y=(Y-q)*a.radDeg+x-W,Y>180?Y-=360:Y<-180&&(Y+=360),t.updateWorldTransformWith(c,d,W+Y*h,m,f,0,0),W=e.arotation,P=((P+q)*a.radDeg-e.ashearX)*b+w-W,P>180?P-=360:P<-180&&(P+=360),e.updateWorldTransformWith(y,M,W+P*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class Gt extends Lt{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(t){super(t,0,!1)}}class $t extends Lt{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=exports.PositionMode.Fixed;spacingMode=exports.SpacingMode.Fixed;rotateMode=exports.RotateMode.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}}exports.PositionMode=void 0,(vt=exports.PositionMode||(exports.PositionMode={}))[vt.Fixed=0]="Fixed",vt[vt.Percent=1]="Percent",exports.SpacingMode=void 0,(kt=exports.SpacingMode||(exports.SpacingMode={}))[kt.Length=0]="Length",kt[kt.Fixed=1]="Fixed",kt[kt.Percent=2]="Percent",kt[kt.Proportional=3]="Proportional",exports.RotateMode=void 0,(It=exports.RotateMode||(exports.RotateMode={}))[It.Tangent=0]="Tangent",It[It.Chain=1]="Chain",It[It.ChainScale=2]="ChainScale";class jt{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0,r=t.bones.length;s<r;s++){let r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(r)}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 Xt))return;let s=this.mixRotate,r=this.mixX,i=this.mixY;if(0==s&&0==r&&0==i)return;let n=this.data,o=n.rotateMode==exports.RotateMode.Tangent,l=n.rotateMode==exports.RotateMode.ChainScale,c=this.bones,d=c.length,u=o?d:d+1,p=h.setArraySize(this.spaces,u),m=l?this.lengths=h.setArraySize(this.lengths,d):[],f=this.spacing;switch(n.spacingMode){case exports.SpacingMode.Percent:if(l)for(let t=0,e=u-1;t<e;t++){let e=c[t],s=e.data.length,r=s*e.a,i=s*e.c;m[t]=Math.sqrt(r*r+i*i)}h.arrayFill(p,1,u,f);break;case exports.SpacingMode.Proportional:let t=0;for(let e=0,s=u-1;e<s;){let s=c[e],r=s.data.length;if(r<jt.epsilon)l&&(m[e]=0),p[++e]=f;else{let i=r*s.a,n=r*s.c,a=Math.sqrt(i*i+n*n);l&&(m[e]=a),p[++e]=a,t+=a}}if(t>0){t=u/t*f;for(let e=1;e<u;e++)p[e]*=t}break;default:let e=n.spacingMode==exports.SpacingMode.Length;for(let t=0,s=u-1;t<s;){let s=c[t],r=s.data.length;if(r<jt.epsilon)l&&(m[t]=0),p[++t]=f;else{let i=r*s.a,n=r*s.c,a=Math.sqrt(i*i+n*n);l&&(m[t]=a),p[++t]=(e?r+f:f)*a/r}}}let g=this.computeWorldPositions(e,u,o),x=g[0],w=g[1],b=n.offsetRotation,y=!1;if(0==b)y=n.rotateMode==exports.RotateMode.Chain;else{y=!1;let t=this.target.bone;b*=t.a*t.d-t.b*t.c>0?a.degRad:-a.degRad}for(let t=0,e=3;t<d;t++,e+=3){let n=c[t];n.worldX+=(x-n.worldX)*r,n.worldY+=(w-n.worldY)*i;let h=g[e],d=g[e+1],u=h-x,f=d-w;if(l){let e=m[t];if(0!=e){let t=(Math.sqrt(u*u+f*f)/e-1)*s+1;n.a*=t,n.c*=t}}if(x=h,w=d,s>0){let r=n.a,i=n.b,l=n.c,h=n.d,c=0,d=0,m=0;if(c=o?g[e-1]:0==p[t+1]?g[e+2]:Math.atan2(f,u),c-=Math.atan2(l,r),y){d=Math.cos(c),m=Math.sin(c);let t=n.data.length;x+=(t*(d*r-m*l)-u)*s,w+=(t*(m*r+d*l)-f)*s}else c+=b;c>a.PI?c-=a.PI2:c<-a.PI&&(c+=a.PI2),c*=s,d=Math.cos(c),m=Math.sin(c),n.a=d*r-m*l,n.b=d*i-m*h,n.c=m*r+d*l,n.d=m*i+d*h}n.updateAppliedTransform()}}computeWorldPositions(t,e,s){let r=this.target,i=this.position,n=this.spaces,a=h.setArraySize(this.positions,3*e+2),o=this.world,l=t.closed,c=t.worldVerticesLength,d=c/6,u=jt.NONE;if(!t.constantSpeed){let p=t.lengths;d-=l?1:2;let m,f=p[d];switch(this.data.positionMode==exports.PositionMode.Percent&&(i*=f),this.data.spacingMode){case exports.SpacingMode.Percent:m=f;break;case exports.SpacingMode.Proportional:m=f/e;break;default:m=1}o=h.setArraySize(this.world,8);for(let h=0,g=0,x=0;h<e;h++,g+=3){let e=n[h]*m;i+=e;let w=i;if(l)w%=f,w<0&&(w+=f),x=0;else{if(w<0){u!=jt.BEFORE&&(u=jt.BEFORE,t.computeWorldVertices(r,2,4,o,0,2)),this.addBeforePosition(w,o,0,a,g);continue}if(w>f){u!=jt.AFTER&&(u=jt.AFTER,t.computeWorldVertices(r,c-6,4,o,0,2)),this.addAfterPosition(w-f,o,0,a,g);continue}}for(;;x++){let t=p[x];if(!(w>t)){if(0==x)w/=t;else{let e=p[x-1];w=(w-e)/(t-e)}break}}x!=u&&(u=x,l&&x==d?(t.computeWorldVertices(r,c-4,4,o,0,2),t.computeWorldVertices(r,0,4,o,4,2)):t.computeWorldVertices(r,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],a,g,s||h>0&&0==e)}return a}l?(c+=2,o=h.setArraySize(this.world,c),t.computeWorldVertices(r,2,c-4,o,0,2),t.computeWorldVertices(r,0,2,o,c-4,2),o[c-2]=o[0],o[c-1]=o[1]):(d--,c-=4,o=h.setArraySize(this.world,c),t.computeWorldVertices(r,2,c,o,0,2));let p,m=h.setArraySize(this.curves,d),f=0,g=o[0],x=o[1],w=0,b=0,y=0,M=0,S=0,v=0,k=0,I=0,A=0,T=0,B=0,C=0,F=0,E=0;for(let t=0,e=2;t<d;t++,e+=6)w=o[e],b=o[e+1],y=o[e+2],M=o[e+3],S=o[e+4],v=o[e+5],k=.1875*(g-2*w+y),I=.1875*(x-2*b+M),A=.09375*(3*(w-y)-g+S),T=.09375*(3*(b-M)-x+v),B=2*k+A,C=2*I+T,F=.75*(w-g)+k+.16666667*A,E=.75*(b-x)+I+.16666667*T,f+=Math.sqrt(F*F+E*E),F+=B,E+=C,B+=A,C+=T,f+=Math.sqrt(F*F+E*E),F+=B,E+=C,f+=Math.sqrt(F*F+E*E),F+=B+A,E+=C+T,f+=Math.sqrt(F*F+E*E),m[t]=f,g=S,x=v;switch(this.data.positionMode==exports.PositionMode.Percent&&(i*=f),this.data.spacingMode){case exports.SpacingMode.Percent:p=f;break;case exports.SpacingMode.Proportional:p=f/e;break;default:p=1}let R=this.segments,Y=0;for(let t=0,r=0,h=0,d=0;t<e;t++,r+=3){let e=n[t]*p;i+=e;let P=i;if(l)P%=f,P<0&&(P+=f),h=0;else{if(P<0){this.addBeforePosition(P,o,0,a,r);continue}if(P>f){this.addAfterPosition(P-f,o,c-4,a,r);continue}}for(;;h++){let t=m[h];if(!(P>t)){if(0==h)P/=t;else{let e=m[h-1];P=(P-e)/(t-e)}break}}if(h!=u){u=h;let t=6*h;for(g=o[t],x=o[t+1],w=o[t+2],b=o[t+3],y=o[t+4],M=o[t+5],S=o[t+6],v=o[t+7],k=.03*(g-2*w+y),I=.03*(x-2*b+M),A=.006*(3*(w-y)-g+S),T=.006*(3*(b-M)-x+v),B=2*k+A,C=2*I+T,F=.3*(w-g)+k+.16666667*A,E=.3*(b-x)+I+.16666667*T,Y=Math.sqrt(F*F+E*E),R[0]=Y,t=1;t<8;t++)F+=B,E+=C,B+=A,C+=T,Y+=Math.sqrt(F*F+E*E),R[t]=Y;F+=B,E+=C,Y+=Math.sqrt(F*F+E*E),R[8]=Y,F+=B+A,E+=C+T,Y+=Math.sqrt(F*F+E*E),R[9]=Y,d=0}for(P*=Y;;d++){let t=R[d];if(!(P>t)){if(0==d)P/=t;else{let e=R[d-1];P=d+(P-e)/(t-e)}break}}this.addCurvePosition(.1*P,g,x,w,b,y,M,S,v,a,r,s||t>0&&0==e)}return a}addBeforePosition(t,e,s,r,i){let n=e[s],a=e[s+1],o=e[s+2]-n,l=e[s+3]-a,h=Math.atan2(l,o);r[i]=n+t*Math.cos(h),r[i+1]=a+t*Math.sin(h),r[i+2]=h}addAfterPosition(t,e,s,r,i){let n=e[s+2],a=e[s+3],o=n-e[s],l=a-e[s+1],h=Math.atan2(l,o);r[i]=n+t*Math.cos(h),r[i+1]=a+t*Math.sin(h),r[i+2]=h}addCurvePosition(t,e,s,r,i,n,a,o,l,h,c,d){if(0==t||isNaN(t))return h[c]=e,h[c+1]=s,void(h[c+2]=Math.atan2(i-s,r-e));let u=t*t,p=u*t,m=1-t,f=m*m,g=f*m,x=m*t,w=3*x,b=m*w,y=w*t,M=e*g+r*b+n*y+o*p,S=s*g+i*b+a*y+l*p;h[c]=M,h[c+1]=S,d&&(h[c+2]=t<.001?Math.atan2(i-s,r-e):Math.atan2(S-(s*f+i*x*2+a*u),M-(e*f+r*x*2+n*u)))}}class Ht{data;_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(0==e)return;const s=this.data.x>0,r=this.data.y>0,i=this.data.rotate>0||this.data.shearX>0,n=this.data.scaleX>0,o=this.bone,l=o.data.length;switch(t){case exports.Physics.none:return;case exports.Physics.reset:this.reset();case exports.Physics.update:const t=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=t,this.lastTime=this.skeleton.time;const h=o.worldX,c=o.worldY;if(this._reset)this._reset=!1,this.ux=h,this.uy=c;else{let d=this.remaining,u=this.inertia,p=this.data.limit*t,m=this.data.step,f=this.skeleton.data.referenceScale,g=-1;if(s||r){if(s){const t=(this.ux-h)*u;this.xOffset+=t>p?p:t<-p?-p:t,this.ux=h}if(r){const t=(this.uy-c)*u;this.yOffset+=t>p?p:t<-p?-p:t,this.uy=c}if(d>=m){g=Math.pow(this.damping,60*m);const t=this.massInverse*m,e=this.strength,i=this.wind*f,n=(Qt.yDown?-this.gravity:this.gravity)*f;do{s&&(this.xVelocity+=(i-this.xOffset*e)*t,this.xOffset+=this.xVelocity*m,this.xVelocity*=g),r&&(this.yVelocity-=(n+this.yOffset*e)*t,this.yOffset+=this.yVelocity*m,this.yVelocity*=g),d-=m}while(d>=m)}s&&(o.worldX+=this.xOffset*e*this.data.x),r&&(o.worldY+=this.yOffset*e*this.data.y)}if(i||n){let t=Math.atan2(o.c,o.a),s=0,r=0,h=0,c=this.cx-o.worldX,x=this.cy-o.worldY;if(c>p?c=p:c<-p&&(c=-p),x>p?x=p:x<-p&&(x=-p),i){h=(this.data.rotate+this.data.shearX)*e;let i=Math.atan2(x+this.ty,c+this.tx)-t-this.rotateOffset*h;this.rotateOffset+=(i-Math.ceil(i*a.invPI2-.5)*a.PI2)*u,i=this.rotateOffset*h+t,s=Math.cos(i),r=Math.sin(i),n&&(i=l*o.getWorldScaleX(),i>0&&(this.scaleOffset+=(c*s+x*r)*u/i))}else{s=Math.cos(t),r=Math.sin(t);const e=l*o.getWorldScaleX();e>0&&(this.scaleOffset+=(c*s+x*r)*u/e)}if(d=this.remaining,d>=m){-1==g&&(g=Math.pow(this.damping,60*m));const e=this.massInverse*m,a=this.strength,o=this.wind,c=Qt.yDown?-this.gravity:this.gravity,u=l/f;for(;;)if(d-=m,n&&(this.scaleVelocity+=(o*s-c*r-this.scaleOffset*a)*e,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=g),i){if(this.rotateVelocity-=((o*r+c*s)*u+this.rotateOffset*a)*e,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=g,d<m)break;const i=this.rotateOffset*h+t;s=Math.cos(i),r=Math.sin(i)}else if(d<m)break}}this.remaining=d}this.cx=o.worldX,this.cy=o.worldY;break;case exports.Physics.pose:s&&(o.worldX+=this.xOffset*e*this.data.x),r&&(o.worldY+=this.yOffset*e*this.data.y)}if(i){let t=this.rotateOffset*e,s=0,r=0,i=0;if(this.data.shearX>0){let e=0;this.data.rotate>0&&(e=t*this.data.rotate,s=Math.sin(e),r=Math.cos(e),i=o.b,o.b=r*i-s*o.d,o.d=s*i+r*o.d),e+=t*this.data.shearX,s=Math.sin(e),r=Math.cos(e),i=o.a,o.a=r*i-s*o.c,o.c=s*i+r*o.c}else t*=this.data.rotate,s=Math.sin(t),r=Math.cos(t),i=o.a,o.a=r*i-s*o.c,o.c=s*i+r*o.c,i=o.b,o.b=r*i-s*o.d,o.d=s*i+r*o.d}if(n){const t=1+this.scaleOffset*e*this.data.scaleX;o.a*=t,o.c*=t}t!=exports.Physics.pose&&(this.tx=l*o.a,this.ty=l*o.c),o.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const r=s*a.degRad,i=Math.cos(r),n=Math.sin(r),o=this.cx-t,l=this.cy-e;this.translate(o*i-l*n-o,o*n+l*i-l)}}class Jt{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new n,this.darkColor=t.darkColor?new n:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof p&&this.attachment instanceof p&&t.timelineAttachment==this.attachment.timelineAttachment||(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}}class Kt{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new d;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 r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(r)}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,r=this.mixScaleX,i=this.mixScaleY,n=this.mixShearY,o=0!=e||0!=s,l=this.target,h=l.a,c=l.b,d=l.c,u=l.d,p=h*u-c*d>0?a.degRad:-a.degRad,m=this.data.offsetRotation*p,f=this.data.offsetShearY*p,g=this.bones;for(let p=0,x=g.length;p<x;p++){let x=g[p];if(0!=t){let e=x.a,s=x.b,r=x.c,i=x.d,n=Math.atan2(d,h)-Math.atan2(r,e)+m;n>a.PI?n-=a.PI2:n<-a.PI&&(n+=a.PI2),n*=t;let o=Math.cos(n),l=Math.sin(n);x.a=o*e-l*r,x.b=o*s-l*i,x.c=l*e+o*r,x.d=l*s+o*i}if(o){let t=this.temp;l.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),x.worldX+=(t.x-x.worldX)*e,x.worldY+=(t.y-x.worldY)*s}if(0!=r){let t=Math.sqrt(x.a*x.a+x.c*x.c);0!=t&&(t=(t+(Math.sqrt(h*h+d*d)-t+this.data.offsetScaleX)*r)/t),x.a*=t,x.c*=t}if(0!=i){let t=Math.sqrt(x.b*x.b+x.d*x.d);0!=t&&(t=(t+(Math.sqrt(c*c+u*u)-t+this.data.offsetScaleY)*i)/t),x.b*=t,x.d*=t}if(n>0){let t=x.b,e=x.d,s=Math.atan2(e,t),r=Math.atan2(u,c)-Math.atan2(d,h)-(s-Math.atan2(x.c,x.a));r>a.PI?r-=a.PI2:r<-a.PI&&(r+=a.PI2),r=s+(r+f)*n;let i=Math.sqrt(t*t+e*e);x.b=Math.cos(r)*i,x.d=Math.sin(r)*i}x.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,n=this.mixShearY,o=0!=e||0!=s,l=this.target,h=l.a,c=l.b,d=l.c,u=l.d,p=h*u-c*d>0?a.degRad:-a.degRad,m=this.data.offsetRotation*p,f=this.data.offsetShearY*p,g=this.bones;for(let p=0,x=g.length;p<x;p++){let x=g[p];if(0!=t){let e=x.a,s=x.b,r=x.c,i=x.d,n=Math.atan2(d,h)+m;n>a.PI?n-=a.PI2:n<-a.PI&&(n+=a.PI2),n*=t;let o=Math.cos(n),l=Math.sin(n);x.a=o*e-l*r,x.b=o*s-l*i,x.c=l*e+o*r,x.d=l*s+o*i}if(o){let t=this.temp;l.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),x.worldX+=t.x*e,x.worldY+=t.y*s}if(0!=r){let t=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleX)*r+1;x.a*=t,x.c*=t}if(0!=i){let t=(Math.sqrt(c*c+u*u)-1+this.data.offsetScaleY)*i+1;x.b*=t,x.d*=t}if(n>0){let t=Math.atan2(u,c)-Math.atan2(d,h);t>a.PI?t-=a.PI2:t<-a.PI&&(t+=a.PI2);let e=x.b,s=x.d;t=Math.atan2(s,e)+(t-a.PI/2+f)*n;let r=Math.sqrt(e*e+s*s);x.b=Math.cos(t)*r,x.d=Math.sin(t)*r}x.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,n=this.mixShearY,a=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+=(a.arotation-c+this.data.offsetRotation)*t);let d=h.ax,u=h.ay;d+=(a.ax-d+this.data.offsetX)*e,u+=(a.ay-u+this.data.offsetY)*s;let p=h.ascaleX,m=h.ascaleY;0!=r&&0!=p&&(p=(p+(a.ascaleX-p+this.data.offsetScaleX)*r)/p),0!=i&&0!=m&&(m=(m+(a.ascaleY-m+this.data.offsetScaleY)*i)/m);let f=h.ashearY;0!=n&&(f+=(a.ashearY-f+this.data.offsetShearY)*n),h.updateWorldTransformWith(d,u,c,p,m,h.ashearX,f)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,n=this.mixShearY,a=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation+(a.arotation+this.data.offsetRotation)*t,d=h.ax+(a.ax+this.data.offsetX)*e,u=h.ay+(a.ay+this.data.offsetY)*s,p=h.ascaleX*((a.ascaleX-1+this.data.offsetScaleX)*r+1),m=h.ascaleY*((a.ascaleY-1+this.data.offsetScaleY)*i+1),f=h.ashearY+(a.ashearY+this.data.offsetShearY)*n;h.updateWorldTransformWith(d,u,c,p,m,h.ashearX,f)}}}class Qt{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return Qt.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e<t.bones.length;e++){let s,r=t.bones[e];if(r.parent){let t=this.bones[r.parent.index];s=new Nt(r,this,t),t.children.push(s)}else s=new Nt(r,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],r=this.bones[s.boneData.index],i=new Jt(s,r);this.slots.push(i),this.drawOrder.push(i)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let s=t.ikConstraints[e];this.ikConstraints.push(new zt(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new Kt(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new jt(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new Ht(s,this))}this.color=new n(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0;let t=this.bones;for(let e=0,s=t.length;e<s;e++){let s=t[e];s.sorted=s.data.skinRequired,s.active=!s.sorted}if(this.skin){let t=this.skin.bones;for(let e=0,s=this.skin.bones.length;e<s;e++){let s=this.bones[t[e].index];do{s.sorted=!1,s.active=!0,s=s.parent}while(s)}}let e=this.ikConstraints,s=this.transformConstraints,r=this.pathConstraints,i=this.physicsConstraints,n=e.length,a=s.length,o=r.length,l=this.physicsConstraints.length,h=n+a+o+l;t:for(let t=0;t<h;t++){for(let s=0;s<n;s++){let r=e[s];if(r.data.order==t){this.sortIkConstraint(r);continue t}}for(let e=0;e<a;e++){let r=s[e];if(r.data.order==t){this.sortTransformConstraint(r);continue t}}for(let e=0;e<o;e++){let s=r[e];if(s.data.order==t){this.sortPathConstraint(s);continue t}}for(let e=0;e<l;e++){const s=i[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&&h.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,r=s[0];if(this.sortBone(r),1==s.length)this._updateCache.push(t),this.sortReset(r.children);else{let e=s[s.length-1];this.sortBone(e),this._updateCache.push(t),this.sortReset(r.children),e.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&h.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,r=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,r);for(let t=0,e=this.data.skins.length;t<e;t++)this.sortPathConstraintAttachment(this.data.skins[t],s,r);let i=e.getAttachment();i instanceof Xt&&this.sortPathConstraintAttachmentWith(i,r);let n=t.bones,a=n.length;for(let t=0;t<a;t++)this.sortBone(n[t]);this._updateCache.push(t);for(let t=0;t<a;t++)this.sortReset(n[t].children);for(let t=0;t<a;t++)n[t].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&h.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 r=t.attachments[e];if(r)for(let t in r)this.sortPathConstraintAttachmentWith(r[t],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof Xt))return;let s=t.bones;if(s){let t=this.bones;for(let e=0,r=s.length;e<r;){let r=s[e++];for(r+=e;e<r;)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&&h.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,r=s.length;e<r;e++)s[e].update(t)}updateWorldTransformWith(t,e){let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let r=e.a,i=e.b,n=e.c,o=e.d;s.worldX=r*this.x+i*this.y+e.worldX,s.worldY=n*this.x+o*this.y+e.worldY;const l=(s.rotation+s.shearX)*a.degRad,h=(s.rotation+90+s.shearY)*a.degRad,c=Math.cos(l)*s.scaleX,d=Math.cos(h)*s.scaleY,u=Math.sin(l)*s.scaleX,p=Math.sin(h)*s.scaleY;s.a=(r*c+i*u)*this.scaleX,s.b=(r*d+i*p)*this.scaleX,s.c=(n*c+o*u)*this.scaleY,s.d=(n*d+o*p)*this.scaleY;let m=this._updateCache;for(let e=0,r=m.length;e<r;e++){let r=m[e];r!=s&&r.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;h.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,r=e.length;s<r;s++){let r=e[s];if(r.data.name==t)return r}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.data.name==t)return r}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,r=e.length;s<r;s++){let r=e[s],i=r.data.attachmentName;if(i){let e=t.getAttachment(s,i);e&&r.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 r=0,i=s.length;r<i;r++){let i=s[r];if(i.data.name==t){let s=null;if(e&&(s=this.getAttachment(r,e),!s))throw new Error("Attachment not found: "+e+", for slot: "+t);return void i.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 d,e=new d;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}}getBounds(t,e,s=new Array(2),r=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let i=this.drawOrder,n=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let t=0,e=i.length;t<e;t++){let e=i[t];if(!e.bone.active)continue;let c=0,d=null,u=null,p=e.getAttachment();if(p instanceof Vt)c=8,d=h.setArraySize(s,c,0),p.computeWorldVertices(e,d,0,2),u=Qt.quadTriangles;else if(p instanceof Pt){let t=p;c=t.worldVerticesLength,d=h.setArraySize(s,c,0),t.computeWorldVertices(e,0,c,d,0,2),u=t.triangles}else if(p instanceof wt&&null!=r){r.clipStart(e,p);continue}if(d&&u){null!=r&&r.isClipping()&&(r.clipTriangles(d,u,u.length),d=r.clippedVertices,c=r.clippedVertices.length);for(let t=0,e=d.length;t<e;t+=2){let e=d[t],s=d[t+1];n=Math.min(n,e),a=Math.min(a,s),o=Math.max(o,e),l=Math.max(l,s)}}null!=r&&r.clipEndWithSlot(e)}null!=r&&r.clipEnd(),t.set(n,a),e.set(o-n,l-a)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let r=0,i=s.length;r<i;r++)s[r].translate(t,e)}physicsRotate(t,e,s){const r=this.physicsConstraints;for(let i=0,n=r.length;i<n;i++)r[i].rotate(t,e,s)}}exports.Physics=void 0,(At=exports.Physics||(exports.Physics={}))[At.none=0]="none",At[At.reset=1]="reset",At[At.update=2]="update",At[At.pose=3]="pose";class Zt extends Lt{_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(t){super(t,0,!1)}}class te{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}}class ee{slotIndex;name;attachment;constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class se{name;attachments=new Array;bones=Array();constraints=new Array;color=new n(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],r=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){r=!0;break}r||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],r=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){r=!0;break}r||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],r=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){r=!0;break}r||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],r=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){r=!0;break}r||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];s.attachment&&(s.attachment instanceof Pt?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let r in s){let i=s[r];i&&t.push(new ee(e,r,i))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let r in s){let i=s[r];i&&e.push(new ee(t,r,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){let i=t.slots[r],n=i.getAttachment();if(n&&s<e.attachments.length){let t=e.attachments[s];for(let e in t){if(n==t[e]){let t=this.getAttachment(s,e);t&&i.setAttachment(t);break}}}s++}}}class re{index=0;name;boneData;color=new n(1,1,1,1);darkColor=null;attachmentName=null;blendMode=exports.BlendMode.Normal;visible=!0;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}exports.BlendMode=void 0,(Tt=exports.BlendMode||(exports.BlendMode={}))[Tt.Normal=0]="Normal",Tt[Tt.Additive=1]="Additive",Tt[Tt.Multiply=2]="Multiply",Tt[Tt.Screen=3]="Screen";class ie extends Lt{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(t){super(t,0,!1)}}class ne{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new te;s.name="";let r=new ae(t),i=r.readInt32(),a=r.readInt32();s.hash=0==a&&0==i?null:a.toString(16)+i.toString(16),s.version=r.readString(),s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat(),s.referenceScale=r.readFloat()*e;let o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let l=0;l=r.readInt(!0);for(let t=0;t<l;t++){let t=r.readString();if(!t)throw new Error("String in string table must not be null.");r.strings.push(t)}l=r.readInt(!0);for(let t=0;t<l;t++){let i=r.readString();if(!i)throw new Error("Bone name must not be null.");let a=0==t?null:s.bones[r.readInt(!0)],l=new Ot(t,i,a);l.rotation=r.readFloat(),l.x=r.readFloat()*e,l.y=r.readFloat()*e,l.scaleX=r.readFloat(),l.scaleY=r.readFloat(),l.shearX=r.readFloat(),l.shearY=r.readFloat(),l.length=r.readFloat()*e,l.inherit=r.readByte(),l.skinRequired=r.readBoolean(),o&&(n.rgba8888ToColor(l.color,r.readInt32()),l.icon=r.readString()??void 0,l.visible=r.readBoolean()),s.bones.push(l)}l=r.readInt(!0);for(let t=0;t<l;t++){let e=r.readString();if(!e)throw new Error("Slot name must not be null.");let i=s.bones[r.readInt(!0)],a=new re(t,e,i);n.rgba8888ToColor(a.color,r.readInt32());let l=r.readInt32();-1!=l&&n.rgb888ToColor(a.darkColor=new n,l),a.attachmentName=r.readStringRef(),a.blendMode=r.readInt(!0),o&&(a.visible=r.readBoolean()),s.slots.push(a)}l=r.readInt(!0);for(let t,i=0;i<l;i++){let i=r.readString();if(!i)throw new Error("IK constraint data name must not be null.");let n=new Gt(i);n.order=r.readInt(!0),t=r.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[r.readInt(!0)]);n.target=s.bones[r.readInt(!0)];let a=r.readByte();n.skinRequired=!!(1&a),n.bendDirection=2&a?1:-1,n.compress=!!(4&a),n.stretch=!!(8&a),n.uniform=!!(16&a),32&a&&(n.mix=64&a?r.readFloat():1),128&a&&(n.softness=r.readFloat()*e),s.ikConstraints.push(n)}l=r.readInt(!0);for(let t,i=0;i<l;i++){let i=r.readString();if(!i)throw new Error("Transform constraint data name must not be null.");let n=new ie(i);n.order=r.readInt(!0),t=r.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[r.readInt(!0)]);n.target=s.bones[r.readInt(!0)];let a=r.readByte();n.skinRequired=!!(1&a),n.local=!!(2&a),n.relative=!!(4&a),8&a&&(n.offsetRotation=r.readFloat()),16&a&&(n.offsetX=r.readFloat()*e),32&a&&(n.offsetY=r.readFloat()*e),64&a&&(n.offsetScaleX=r.readFloat()),128&a&&(n.offsetScaleY=r.readFloat()),a=r.readByte(),1&a&&(n.offsetShearY=r.readFloat()),2&a&&(n.mixRotate=r.readFloat()),4&a&&(n.mixX=r.readFloat()),8&a&&(n.mixY=r.readFloat()),16&a&&(n.mixScaleX=r.readFloat()),32&a&&(n.mixScaleY=r.readFloat()),64&a&&(n.mixShearY=r.readFloat()),s.transformConstraints.push(n)}l=r.readInt(!0);for(let t,i=0;i<l;i++){let i=r.readString();if(!i)throw new Error("Path constraint data name must not be null.");let n=new $t(i);n.order=r.readInt(!0),n.skinRequired=r.readBoolean(),t=r.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[r.readInt(!0)]);n.target=s.slots[r.readInt(!0)];const a=r.readByte();n.positionMode=1&a,n.spacingMode=a>>1&3,n.rotateMode=a>>3&3,128&a&&(n.offsetRotation=r.readFloat()),n.position=r.readFloat(),n.positionMode==exports.PositionMode.Fixed&&(n.position*=e),n.spacing=r.readFloat(),n.spacingMode!=exports.SpacingMode.Length&&n.spacingMode!=exports.SpacingMode.Fixed||(n.spacing*=e),n.mixRotate=r.readFloat(),n.mixX=r.readFloat(),n.mixY=r.readFloat(),s.pathConstraints.push(n)}l=r.readInt(!0);for(let t=0;t<l;t++){const t=r.readString();if(!t)throw new Error("Physics constraint data name must not be null.");const i=new Zt(t);i.order=r.readInt(!0),i.bone=s.bones[r.readInt(!0)];let n=r.readByte();i.skinRequired=!!(1&n),2&n&&(i.x=r.readFloat()),4&n&&(i.y=r.readFloat()),8&n&&(i.rotate=r.readFloat()),16&n&&(i.scaleX=r.readFloat()),32&n&&(i.shearX=r.readFloat()),i.limit=(64&n?r.readFloat():5e3)*e,i.step=1/r.readUnsignedByte(),i.inertia=r.readFloat(),i.strength=r.readFloat(),i.damping=r.readFloat(),i.massInverse=128&n?r.readFloat():1,i.wind=r.readFloat(),i.gravity=r.readFloat(),n=r.readByte(),1&n&&(i.inertiaGlobal=!0),2&n&&(i.strengthGlobal=!0),4&n&&(i.dampingGlobal=!0),8&n&&(i.massGlobal=!0),16&n&&(i.windGlobal=!0),32&n&&(i.gravityGlobal=!0),64&n&&(i.mixGlobal=!0),i.mix=128&n?r.readFloat():1,s.physicsConstraints.push(i)}let c=this.readSkin(r,s,!0,o);c&&(s.defaultSkin=c,s.skins.push(c));{let t=s.skins.length;for(h.setArraySize(s.skins,l=t+r.readInt(!0));t<l;t++){let e=this.readSkin(r,s,!1,o);if(!e)throw new Error("readSkin() should not have returned null.");s.skins[t]=e}}l=this.linkedMeshes.length;for(let t=0;t<l;t++){let e=this.linkedMeshes[t];const r=s.skins[e.skinIndex];if(!e.parent)throw new Error("Linked mesh parent must not be null");let i=r.getAttachment(e.slotIndex,e.parent);if(!i)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?i:e.mesh,e.mesh.setParentMesh(i),null!=e.mesh.region&&e.mesh.updateRegion()}this.linkedMeshes.length=0,l=r.readInt(!0);for(let t=0;t<l;t++){let t=r.readString();if(!t)throw new Error("Event data name must not be null");let e=new Ut(t);e.intValue=r.readInt(!1),e.floatValue=r.readFloat(),e.stringValue=r.readString(),e.audioPath=r.readString(),e.audioPath&&(e.volume=r.readFloat(),e.balance=r.readFloat()),s.events.push(e)}l=r.readInt(!0);for(let t=0;t<l;t++){let t=r.readString();if(!t)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,t,s))}return s}readSkin(t,e,s,r){let i=null,a=0;if(s){if(a=t.readInt(!0),0==a)return null;i=new se("default")}else{let s=t.readString();if(!s)throw new Error("Skin name must not be null.");i=new se(s),r&&n.rgba8888ToColor(i.color,t.readInt32()),i.bones.length=t.readInt(!0);for(let s=0,r=i.bones.length;s<r;s++)i.bones[s]=e.bones[t.readInt(!0)];for(let s=0,r=t.readInt(!0);s<r;s++)i.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)i.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)i.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)i.constraints.push(e.physicsConstraints[t.readInt(!0)]);a=t.readInt(!0)}for(let s=0;s<a;s++){let s=t.readInt(!0);for(let n=0,a=t.readInt(!0);n<a;n++){let n=t.readStringRef();if(!n)throw new Error("Attachment name must not be null");let a=this.readAttachment(t,e,i,s,n,r);a&&i.setAttachment(s,n,a)}}return i}readAttachment(t,e,s,r,i,a){let o=this.scale,l=t.readByte();const c=8&l?t.readStringRef():i;if(!c)throw new Error("Attachment name must not be null");switch(7&l){case Bt.Region:{let e=16&l?t.readStringRef():null;const r=32&l?t.readInt32():4294967295,i=64&l?this.readSequence(t):null;let a=128&l?t.readFloat():0,h=t.readFloat(),d=t.readFloat(),u=t.readFloat(),p=t.readFloat(),m=t.readFloat(),f=t.readFloat();e||(e=c);let g=this.attachmentLoader.newRegionAttachment(s,c,e,i);return g?(g.path=e,g.x=h*o,g.y=d*o,g.scaleX=u,g.scaleY=p,g.rotation=a,g.width=m*o,g.height=f*o,n.rgba8888ToColor(g.color,r),g.sequence=i,null==i&&g.updateRegion(),g):null}case Bt.BoundingBox:{let e=this.readVertices(t,!!(16&l)),r=a?t.readInt32():0,i=this.attachmentLoader.newBoundingBoxAttachment(s,c);return i?(i.worldVerticesLength=e.length,i.vertices=e.vertices,i.bones=e.bones,a&&n.rgba8888ToColor(i.color,r),i):null}case Bt.Mesh:{let e=16&l?t.readStringRef():c;const r=32&l?t.readInt32():4294967295,i=64&l?this.readSequence(t):null,h=t.readInt(!0),d=this.readVertices(t,!!(128&l)),u=this.readFloatArray(t,d.length,1),p=this.readShortArray(t,3*(d.length-h-2));let m=[],f=0,g=0;a&&(m=this.readShortArray(t,t.readInt(!0)),f=t.readFloat(),g=t.readFloat()),e||(e=c);let x=this.attachmentLoader.newMeshAttachment(s,c,e,i);return x?(x.path=e,n.rgba8888ToColor(x.color,r),x.bones=d.bones,x.vertices=d.vertices,x.worldVerticesLength=d.length,x.triangles=p,x.regionUVs=u,null==i&&x.updateRegion(),x.hullLength=h<<1,x.sequence=i,a&&(x.edges=m,x.width=f*o,x.height=g*o),x):null}case Bt.LinkedMesh:{const e=16&l?t.readStringRef():c;if(null==e)throw new Error("Path of linked mesh must not be null");const i=32&l?t.readInt32():4294967295,h=64&l?this.readSequence(t):null,d=!!(128&l),u=t.readInt(!0),p=t.readStringRef();let m=0,f=0;a&&(m=t.readFloat(),f=t.readFloat());let g=this.attachmentLoader.newMeshAttachment(s,c,e,h);return g?(g.path=e,n.rgba8888ToColor(g.color,i),g.sequence=h,a&&(g.width=m*o,g.height=f*o),this.linkedMeshes.push(new oe(g,u,r,p,d)),g):null}case Bt.Path:{const e=!!(16&l),r=!!(32&l),i=this.readVertices(t,!!(64&l)),d=h.newArray(i.length/6,0);for(let e=0,s=d.length;e<s;e++)d[e]=t.readFloat()*o;const u=a?t.readInt32():0,p=this.attachmentLoader.newPathAttachment(s,c);return p?(p.closed=e,p.constantSpeed=r,p.worldVerticesLength=i.length,p.vertices=i.vertices,p.bones=i.bones,p.lengths=d,a&&n.rgba8888ToColor(p.color,u),p):null}case Bt.Point:{const e=t.readFloat(),r=t.readFloat(),i=t.readFloat(),l=a?t.readInt32():0,h=this.attachmentLoader.newPointAttachment(s,c);return h?(h.x=r*o,h.y=i*o,h.rotation=e,a&&n.rgba8888ToColor(h.color,l),h):null}case Bt.Clipping:{const r=t.readInt(!0),i=this.readVertices(t,!!(16&l));let o=a?t.readInt32():0,h=this.attachmentLoader.newClippingAttachment(s,c);return h?(h.endSlot=e.slots[r],h.worldVerticesLength=i.length,h.vertices=i.vertices,h.bones=i.bones,a&&n.rgba8888ToColor(h.color,o),h):null}}return null}readSequence(t){let e=new m(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,r=t.readInt(!0),i=new le;if(i.length=r<<1,!e)return i.vertices=this.readFloatArray(t,i.length,s),i;let n=new Array,a=new Array;for(let e=0;e<r;e++){let e=t.readInt(!0);a.push(e);for(let r=0;r<e;r++)a.push(t.readInt(!0)),n.push(t.readFloat()*s),n.push(t.readFloat()*s),n.push(t.readFloat())}return i.vertices=h.toFloatArray(n),i.bones=a,i}readFloatArray(t,e,s){let r=new Array(e);if(1==s)for(let s=0;s<e;s++)r[s]=t.readFloat();else for(let i=0;i<e;i++)r[i]=t.readFloat()*s;return r}readShortArray(t,e){let s=new Array(e);for(let r=0;r<e;r++)s[r]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let r=new Array,i=this.scale;for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,i=t.readInt(!0);s<i;s++){let s=t.readByte(),i=t.readInt(!0),n=i-1;switch(s){case ve:{let s=new N(i,e);for(let e=0;e<i;e++)s.setFrame(e,t.readFloat(),t.readStringRef());r.push(s);break}case ke:{let s=t.readInt(!0),a=new X(i,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;a.setFrame(e,o,l,h,c,d),e!=n;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255;switch(t.readByte()){case qe:a.setStepped(e);break;case We:de(t,a,s++,e,0,o,r,l,i,1),de(t,a,s++,e,1,o,r,h,n,1),de(t,a,s++,e,2,o,r,c,u,1),de(t,a,s++,e,3,o,r,d,p,1)}o=r,l=i,h=n,c=u,d=p}r.push(a);break}case Ie:{let s=t.readInt(!0),a=new _(i,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c),e!=n;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;switch(t.readByte()){case qe:a.setStepped(e);break;case We:de(t,a,s++,e,0,o,r,l,i,1),de(t,a,s++,e,1,o,r,h,n,1),de(t,a,s++,e,2,o,r,c,d,1)}o=r,l=i,h=n,c=d}r.push(a);break}case Ae:{let s=t.readInt(!0),a=new D(i,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,p=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d,u,p,m),e!=n;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255;switch(t.readByte()){case qe:a.setStepped(e);break;case We:de(t,a,s++,e,0,o,r,l,i,1),de(t,a,s++,e,1,o,r,h,n,1),de(t,a,s++,e,2,o,r,c,f,1),de(t,a,s++,e,3,o,r,d,g,1),de(t,a,s++,e,4,o,r,u,x,1),de(t,a,s++,e,5,o,r,p,w,1),de(t,a,s++,e,6,o,r,m,b,1)}o=r,l=i,h=n,c=f,d=g,u=x,p=w,m=b}r.push(a);break}case Te:{let s=t.readInt(!0),a=new O(i,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,p=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d,u,p),e!=n;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255;switch(t.readByte()){case qe:a.setStepped(e);break;case We:de(t,a,s++,e,0,o,r,l,i,1),de(t,a,s++,e,1,o,r,h,n,1),de(t,a,s++,e,2,o,r,c,m,1),de(t,a,s++,e,3,o,r,d,f,1),de(t,a,s++,e,4,o,r,u,g,1),de(t,a,s++,e,5,o,r,p,x,1)}o=r,l=i,h=n,c=m,d=f,u=g,p=x}r.push(a);break}case Be:{let s=new V(i,t.readInt(!0),e),a=t.readFloat(),o=t.readUnsignedByte()/255;for(let e=0,r=0;s.setFrame(e,a,o),e!=n;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255;switch(t.readByte()){case qe:s.setStepped(e);break;case We:de(t,s,r++,e,0,a,i,o,n,1)}a=i,o=n}r.push(s)}}}}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);if(s==Se){let s=new P(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat(),t.readByte());r.push(s);continue}let a=t.readInt(!0);switch(s){case ue:r.push(he(t,new k(n,a,e),1));break;case pe:r.push(ce(t,new I(n,a,e),i));break;case me:r.push(he(t,new A(n,a,e),i));break;case fe:r.push(he(t,new T(n,a,e),i));break;case ge:r.push(ce(t,new B(n,a,e),1));break;case xe:r.push(he(t,new C(n,a,e),1));break;case we:r.push(he(t,new F(n,a,e),1));break;case be:r.push(ce(t,new E(n,a,e),1));break;case ye:r.push(he(t,new R(n,a,e),1));break;case Me:r.push(he(t,new Y(n,a,e),1))}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),n=s-1,a=new U(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()*i:0;for(let e=0,s=0;a.setFrame(e,l,h,c,8&o?1:-1,!!(16&o),!!(32&o)),e!=n;e++){o=t.readByte();const r=t.readFloat(),n=1&o?2&o?t.readFloat():1:0,d=4&o?t.readFloat()*i:0;64&o?a.setStepped(e):128&o&&(de(t,a,s++,e,0,l,r,h,n,1),de(t,a,s++,e,1,l,r,c,d,i)),l=r,h=n,c=d}r.push(a)}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),i=s-1,n=new z(s,t.readInt(!0),e),a=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;n.setFrame(e,a,o,l,h,c,d,u),e!=i;e++){let r=t.readFloat(),i=t.readFloat(),p=t.readFloat(),m=t.readFloat(),f=t.readFloat(),g=t.readFloat(),x=t.readFloat();switch(t.readByte()){case qe:n.setStepped(e);break;case We:de(t,n,s++,e,0,a,r,o,i,1),de(t,n,s++,e,1,a,r,l,p,1),de(t,n,s++,e,2,a,r,h,m,1),de(t,n,s++,e,3,a,r,c,f,1),de(t,n,s++,e,4,a,r,d,g,1),de(t,n,s++,e,5,a,r,u,x,1)}a=r,o=i,l=p,h=m,c=f,d=g,u=x}r.push(n)}for(let e=0,n=t.readInt(!0);e<n;e++){let e=t.readInt(!0),n=s.pathConstraints[e];for(let s=0,a=t.readInt(!0);s<a;s++){const s=t.readByte(),a=t.readInt(!0),o=t.readInt(!0);switch(s){case Ee:r.push(he(t,new G(a,o,e),n.positionMode==exports.PositionMode.Fixed?i:1));break;case Re:r.push(he(t,new $(a,o,e),n.spacingMode==exports.SpacingMode.Length||n.spacingMode==exports.SpacingMode.Fixed?i:1));break;case Ye:let s=new j(a,o,e),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat();for(let e=0,r=0,i=s.getFrameCount()-1;s.setFrame(e,l,h,c,d),e!=i;e++){let i=t.readFloat(),n=t.readFloat(),a=t.readFloat(),o=t.readFloat();switch(t.readByte()){case qe:s.setStepped(e);break;case We:de(t,s,r++,e,0,l,i,h,n,1),de(t,s,r++,e,1,l,i,c,a,1),de(t,s,r++,e,2,l,i,d,o,1)}l=i,h=n,c=a,d=o}r.push(s)}}}for(let e=0,s=t.readInt(!0);e<s;e++){const e=t.readInt(!0)-1;for(let s=0,i=t.readInt(!0);s<i;s++){const s=t.readByte(),i=t.readInt(!0);if(s==Le){const s=new rt(i,e);for(let e=0;e<i;e++)s.setFrame(e,t.readFloat());r.push(s);continue}const n=t.readInt(!0);switch(s){case Pe:r.push(he(t,new J(i,n,e),1));break;case Xe:r.push(he(t,new K(i,n,e),1));break;case _e:r.push(he(t,new Q(i,n,e),1));break;case Ve:r.push(he(t,new Z(i,n,e),1));break;case De:r.push(he(t,new tt(i,n,e),1));break;case Oe:r.push(he(t,new et(i,n,e),1));break;case Ne:r.push(he(t,new st(i,n,e),1))}}}for(let e=0,n=t.readInt(!0);e<n;e++){let e=s.skins[t.readInt(!0)];for(let s=0,n=t.readInt(!0);s<n;s++){let s=t.readInt(!0);for(let n=0,a=t.readInt(!0);n<a;n++){let n=t.readStringRef();if(!n)throw new Error("attachmentName must not be null.");let a=e.getAttachment(s,n),o=t.readByte(),l=t.readInt(!0),c=l-1;switch(o){case Ce:{let e=a,n=e.bones,o=e.vertices,d=n?o.length/3*2:o.length,u=t.readInt(!0),p=new L(l,u,s,e),m=t.readFloat();for(let e=0,s=0;;e++){let r,a=t.readInt(!0);if(0==a)r=n?h.newFloatArray(d):o;else{r=h.newFloatArray(d);let e=t.readInt(!0);if(a+=e,1==i)for(let s=e;s<a;s++)r[s]=t.readFloat();else for(let s=e;s<a;s++)r[s]=t.readFloat()*i;if(!n)for(let t=0,e=r.length;t<e;t++)r[t]+=o[t]}if(p.setFrame(e,m,r),e==c)break;let l=t.readFloat();switch(t.readByte()){case qe:p.setStepped(e);break;case We:de(t,p,s++,e,0,m,l,0,1,1)}m=l}r.push(p);break}case Fe:{let e=new it(l,s,a);for(let s=0;s<l;s++){let r=t.readFloat(),i=t.readInt32();e.setFrame(s,r,f[15&i],i>>4,t.readFloat())}r.push(e);break}}}}}let n=t.readInt(!0);if(n>0){let e=new W(n),i=s.slots.length;for(let s=0;s<n;s++){let r=t.readFloat(),n=t.readInt(!0),a=h.newArray(i,0);for(let t=i-1;t>=0;t--)a[t]=-1;let o=h.newArray(i-n,0),l=0,c=0;for(let e=0;e<n;e++){let e=t.readInt(!0);for(;l!=e;)o[c++]=l++;a[l+t.readInt(!0)]=l++}for(;l<i;)o[c++]=l++;for(let t=i-1;t>=0;t--)-1==a[t]&&(a[t]=o[--c]);e.setFrame(s,r,a)}r.push(e)}let a=t.readInt(!0);if(a>0){let e=new q(a);for(let r=0;r<a;r++){let i=t.readFloat(),n=s.events[t.readInt(!0)],a=new Wt(i,n);a.intValue=t.readInt(!1),a.floatValue=t.readFloat(),a.stringValue=t.readString(),null==a.stringValue&&(a.stringValue=n.stringValue),a.data.audioPath&&(a.volume=t.readFloat(),a.balance=t.readFloat()),e.setFrame(r,a)}r.push(e)}let o=0;for(let t=0,e=r.length;t<e;t++)o=Math.max(o,r[t].getDuration());return new g(e,r,o)}}class ae{strings;index;buffer;constructor(t,e=new Array,s=0,r=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=r}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=127&e;return 128&e&&(e=this.readByte(),s|=(127&e)<<7,128&e&&(e=this.readByte(),s|=(127&e)<<14,128&e&&(e=this.readByte(),s|=(127&e)<<21,128&e&&(e=this.readByte(),s|=(127&e)<<28)))),t?s:s>>>1^-(1&s)}readStringRef(){let t=this.readInt(!0);return 0==t?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){let t=this.readUnsignedByte();switch(t>>4){case 12:case 13:e+=String.fromCharCode((31&t)<<6|63&this.readByte()),s+=2;break;case 14:e+=String.fromCharCode((15&t)<<12|(63&this.readByte())<<6|63&this.readByte()),s+=3;break;default:e+=String.fromCharCode(t),s++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return 0!=this.readByte()}}class oe{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,i){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}}class le{bones;vertices;length;constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}}function he(t,e,s){let r=t.readFloat(),i=t.readFloat()*s;for(let n=0,a=0,o=e.getFrameCount()-1;e.setFrame(n,r,i),n!=o;n++){let o=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case qe:e.setStepped(n);break;case We:de(t,e,a++,n,0,r,o,i,l,s)}r=o,i=l}return e}function ce(t,e,s){let r=t.readFloat(),i=t.readFloat()*s,n=t.readFloat()*s;for(let a=0,o=0,l=e.getFrameCount()-1;e.setFrame(a,r,i,n),a!=l;a++){let l=t.readFloat(),h=t.readFloat()*s,c=t.readFloat()*s;switch(t.readByte()){case qe:e.setStepped(a);break;case We:de(t,e,o++,a,0,r,l,i,h,s),de(t,e,o++,a,1,r,l,n,c,s)}r=l,i=h,n=c}return e}function de(t,e,s,r,i,n,a,o,l,h){e.setBezier(s,r,i,n,o,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,a,l)}!function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"}(Bt||(Bt={}));const ue=0,pe=1,me=2,fe=3,ge=4,xe=5,we=6,be=7,ye=8,Me=9,Se=10,ve=0,ke=1,Ie=2,Ae=3,Te=4,Be=5,Ce=0,Fe=1,Ee=0,Re=1,Ye=2,Pe=0,Xe=1,_e=2,Ve=4,De=5,Oe=6,Ne=7,Le=8,qe=1,We=2;class Ue{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new c((()=>new Array));polygonIndicesPool=new c((()=>new Array));triangulate(t){let e=t,s=t.length>>1,r=this.indicesArray;r.length=0;for(let t=0;t<s;t++)r[t]=t;let i=this.isConcaveArray;i.length=0;for(let t=0,n=s;t<n;++t)i[t]=Ue.isConcave(t,s,e,r);let n=this.triangles;for(n.length=0;s>3;){let t=s-1,a=0,o=1;for(;;){t:if(!i[a]){let n=r[t]<<1,l=r[a]<<1,h=r[o]<<1,c=e[n],d=e[n+1],u=e[l],p=e[l+1],m=e[h],f=e[h+1];for(let n=(o+1)%s;n!=t;n=(n+1)%s){if(!i[n])continue;let t=r[n]<<1,s=e[t],a=e[t+1];if(Ue.positiveArea(m,f,c,d,s,a)&&Ue.positiveArea(c,d,u,p,s,a)&&Ue.positiveArea(u,p,m,f,s,a))break t}break}if(0==o){do{if(!i[a])break;a--}while(a>0);break}t=a,a=o,o=(o+1)%s}n.push(r[(s+a-1)%s]),n.push(r[a]),n.push(r[(a+1)%s]),r.splice(a,1),i.splice(a,1),s--;let l=(s+a-1)%s,h=a==s?0:a;i[l]=Ue.isConcave(l,s,e,r),i[h]=Ue.isConcave(h,s,e,r)}return 3==s&&(n.push(r[2]),n.push(r[0]),n.push(r[1])),n}decompose(t,e){let s=t,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;let n=this.polygonIndicesPool.obtain();n.length=0;let a=this.polygonPool.obtain();a.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],p=s[h+1],m=s[c],f=s[c+1],g=s[d],x=s[d+1],w=!1;if(o==h){let t=a.length-4,e=Ue.winding(a[t],a[t+1],a[t+2],a[t+3],g,x),s=Ue.winding(g,x,a[0],a[1],a[2],a[3]);e==l&&s==l&&(a.push(g),a.push(x),n.push(d),w=!0)}w||(a.length>0?(r.push(a),i.push(n)):(this.polygonPool.free(a),this.polygonIndicesPool.free(n)),a=this.polygonPool.obtain(),a.length=0,a.push(u),a.push(p),a.push(m),a.push(f),a.push(g),a.push(x),n=this.polygonIndicesPool.obtain(),n.length=0,n.push(h),n.push(c),n.push(d),l=Ue.winding(u,p,m,f,g,x),o=h)}a.length>0&&(r.push(a),i.push(n));for(let t=0,e=r.length;t<e;t++){if(n=i[t],0==n.length)continue;let s=n[0],o=n[n.length-1];a=r[t];let l=a.length-4,h=a[l],c=a[l+1],d=a[l+2],u=a[l+3],p=a[0],m=a[1],f=a[2],g=a[3],x=Ue.winding(h,c,d,u,p,m);for(let l=0;l<e;l++){if(l==t)continue;let e=i[l];if(3!=e.length)continue;let w=e[0],b=e[1],y=e[2],M=r[l],S=M[M.length-2],v=M[M.length-1];if(w!=s||b!=o)continue;let k=Ue.winding(h,c,d,u,S,v),I=Ue.winding(S,v,p,m,f,g);k==x&&I==x&&(M.length=0,e.length=0,a.push(S),a.push(v),n.push(y),h=d,c=u,d=S,u=v,l=0)}}for(let t=r.length-1;t>=0;t--)a=r[t],0==a.length&&(r.splice(t,1),this.polygonPool.free(a),n=i[t],i.splice(t,1),this.polygonIndicesPool.free(n));return r}static isConcave(t,e,s,r){let i=r[(e+t-1)%e]<<1,n=r[t]<<1,a=r[(t+1)%e]<<1;return!this.positiveArea(s[i],s[i+1],s[n],s[n+1],s[a],s[a+1])}static positiveArea(t,e,s,r,i,n){return t*(n-r)+s*(e-n)+i*(r-e)>=0}static winding(t,e,s,r,i,n){let a=s-t,o=r-e;return i*o-n*a+a*e-t*o>=0?1:-1}}class ze{triangulator=new Ue;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,r=h.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,r,0,2);let i=this.clippingPolygon;ze.makeClockwise(i);let n=this.clippingPolygons=this.triangulator.decompose(i,this.triangulator.triangulate(i));for(let t=0,e=n.length;t<e;t++){let e=n[t];ze.makeClockwise(e),e.push(e[0]),e.push(e[1])}return n.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,r,i,n,a){r&&i&&n&&"boolean"==typeof a?this.clipTrianglesRender(t,e,s,r,i,n,a):this.clipTrianglesNoRender(t,e,s)}clipTrianglesNoRender(t,e,s){let r=this.clipOutput,i=this.clippedVertices,n=this.clippedTriangles,a=this.clippingPolygons,o=a.length,l=0;i.length=0,n.length=0;for(let c=0;c<s;c+=3){let s=e[c]<<1,d=t[s],u=t[s+1];s=e[c+1]<<1;let p=t[s],m=t[s+1];s=e[c+2]<<1;let f=t[s],g=t[s+1];for(let t=0;t<o;t++){let e=i.length;if(!this.clip(d,u,p,m,f,g,a[t],r)){let t=h.setArraySize(i,e+6);t[e]=d,t[e+1]=u,t[e+2]=p,t[e+3]=m,t[e+4]=f,t[e+5]=g,e=n.length;let s=h.setArraySize(n,e+3);s[e]=l,s[e+1]=l+1,s[e+2]=l+2,l+=3;break}{let t=r.length;if(0==t)continue;let s=t>>1,a=this.clipOutput,o=h.setArraySize(i,e+2*s);for(let s=0;s<t;s+=2,e+=2){let t=a[s],r=a[s+1];o[e]=t,o[e+1]=r}e=n.length;let c=h.setArraySize(n,e+3*(s-2));s--;for(let t=1;t<s;t++,e+=3)c[e]=l,c[e+1]=l+t,c[e+2]=l+t+1;l+=s+1}}}}clipTrianglesRender(t,e,s,r,i,n,a){let o=this.clipOutput,l=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,u=d.length,p=a?12:8,m=0;l.length=0,c.length=0;for(let f=0;f<s;f+=3){let s=e[f]<<1,g=t[s],x=t[s+1],w=r[s],b=r[s+1];s=e[f+1]<<1;let y=t[s],M=t[s+1],S=r[s],v=r[s+1];s=e[f+2]<<1;let k=t[s],I=t[s+1],A=r[s],T=r[s+1];for(let t=0;t<u;t++){let e=l.length;if(!this.clip(g,x,y,M,k,I,d[t],o)){let t=h.setArraySize(l,e+3*p);t[e]=g,t[e+1]=x,t[e+2]=i.r,t[e+3]=i.g,t[e+4]=i.b,t[e+5]=i.a,a?(t[e+6]=w,t[e+7]=b,t[e+8]=n.r,t[e+9]=n.g,t[e+10]=n.b,t[e+11]=n.a,t[e+12]=y,t[e+13]=M,t[e+14]=i.r,t[e+15]=i.g,t[e+16]=i.b,t[e+17]=i.a,t[e+18]=S,t[e+19]=v,t[e+20]=n.r,t[e+21]=n.g,t[e+22]=n.b,t[e+23]=n.a,t[e+24]=k,t[e+25]=I,t[e+26]=i.r,t[e+27]=i.g,t[e+28]=i.b,t[e+29]=i.a,t[e+30]=A,t[e+31]=T,t[e+32]=n.r,t[e+33]=n.g,t[e+34]=n.b,t[e+35]=n.a):(t[e+6]=w,t[e+7]=b,t[e+8]=y,t[e+9]=M,t[e+10]=i.r,t[e+11]=i.g,t[e+12]=i.b,t[e+13]=i.a,t[e+14]=S,t[e+15]=v,t[e+16]=k,t[e+17]=I,t[e+18]=i.r,t[e+19]=i.g,t[e+20]=i.b,t[e+21]=i.a,t[e+22]=A,t[e+23]=T),e=c.length;let s=h.setArraySize(c,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=M-I,r=k-y,d=g-k,u=I-x,f=1/(s*d+r*(x-I)),B=t>>1,C=this.clipOutput,F=h.setArraySize(l,e+B*p);for(let o=0;o<t;o+=2,e+=p){let t=C[o],l=C[o+1];F[e]=t,F[e+1]=l,F[e+2]=i.r,F[e+3]=i.g,F[e+4]=i.b,F[e+5]=i.a;let h=t-k,c=l-I,p=(s*h+r*c)*f,m=(u*h+d*c)*f,g=1-p-m;F[e+6]=w*p+S*m+A*g,F[e+7]=b*p+v*m+T*g,a&&(F[e+8]=n.r,F[e+9]=n.g,F[e+10]=n.b,F[e+11]=n.a)}e=c.length;let E=h.setArraySize(c,e+3*(B-2));B--;for(let t=1;t<B;t++,e+=3)E[e]=m,E[e+1]=m+t,E[e+2]=m+t+1;m+=B+1}}}}clipTrianglesUnpacked(t,e,s,r){let i=this.clipOutput,n=this.clippedVertices,a=this.clippedUVs,o=this.clippedTriangles,l=this.clippingPolygons,c=l.length,d=0;n.length=0,a.length=0,o.length=0;for(let u=0;u<s;u+=3){let s=e[u]<<1,p=t[s],m=t[s+1],f=r[s],g=r[s+1];s=e[u+1]<<1;let x=t[s],w=t[s+1],b=r[s],y=r[s+1];s=e[u+2]<<1;let M=t[s],S=t[s+1],v=r[s],k=r[s+1];for(let t=0;t<c;t++){let e=n.length;if(!this.clip(p,m,x,w,M,S,l[t],i)){let t=h.setArraySize(n,e+6);t[e]=p,t[e+1]=m,t[e+2]=x,t[e+3]=w,t[e+4]=M,t[e+5]=S;let s=h.setArraySize(a,e+6);s[e]=f,s[e+1]=g,s[e+2]=b,s[e+3]=y,s[e+4]=v,s[e+5]=k,e=o.length;let r=h.setArraySize(o,e+3);r[e]=d,r[e+1]=d+1,r[e+2]=d+2,d+=3;break}{let t=i.length;if(0==t)continue;let s=w-S,r=M-x,l=p-M,c=S-m,u=1/(s*l+r*(m-S)),I=t>>1,A=this.clipOutput,T=h.setArraySize(n,e+2*I),B=h.setArraySize(a,e+2*I);for(let i=0;i<t;i+=2,e+=2){let t=A[i],n=A[i+1];T[e]=t,T[e+1]=n;let a=t-M,o=n-S,h=(s*a+r*o)*u,d=(c*a+l*o)*u,p=1-h-d;B[e]=f*h+b*d+v*p,B[e+1]=g*h+y*d+k*p}e=o.length;let C=h.setArraySize(o,e+3*(I-2));I--;for(let t=1;t<I;t++,e+=3)C[e]=d,C[e+1]=d+t,C[e+2]=d+t+1;d+=I+1}}}}clip(t,e,s,r,i,n,a,o){let l,h=o,c=!1;a.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(r),l.push(i),l.push(n),l.push(t),l.push(e),o.length=0;let d=a.length-4,u=a;for(let t=0;;t+=2){let e=u[t],s=u[t+1],r=e-u[t+2],i=s-u[t+3],n=o.length,a=l;for(let t=0,n=l.length-2;t<n;){let n=a[t],l=a[t+1];t+=2;let h=a[t],d=a[t+1],u=i*(e-h)>r*(s-d),p=i*(e-n)-r*(s-l);if(p>0){if(u){o.push(h),o.push(d);continue}let t=h-n,e=d-l,s=p/(t*i-e*r);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(n+t*s),o.push(l+e*s)}else if(u){let t=h-n,e=d-l,s=p/(t*i-e*r);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(n+t*s),o.push(l+e*s),o.push(h),o.push(d)}c=!0}if(n==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),t==d)break;let p=o;(o=l).length=0,l=p}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,r=e[s-2]*e[1]-e[0]*e[s-1],i=0,n=0,a=0,o=0;for(let t=0,l=s-3;t<l;t+=2)i=e[t],n=e[t+1],a=e[t+2],o=e[t+3],r+=i*o-a*n;if(!(r<0))for(let t=0,r=s-2,i=s>>1;t<i;t+=2){let s=e[t],i=e[t+1],n=r-t;e[t]=e[n],e[t+1]=e[n+1],e[n]=s,e[n+1]=i}}}class Ge{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new te,r="string"==typeof t?JSON.parse(t):t,i=r.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=Ke(i,"referenceScale",100)*e,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),r.bones)for(let t=0;t<r.bones.length;t++){let i=r.bones[t],n=null,a=Ke(i,"parent",null);a&&(n=s.findBone(a));let o=new Ot(s.bones.length,i.name,n);o.length=Ke(i,"length",0)*e,o.x=Ke(i,"x",0)*e,o.y=Ke(i,"y",0)*e,o.rotation=Ke(i,"rotation",0),o.scaleX=Ke(i,"scaleX",1),o.scaleY=Ke(i,"scaleY",1),o.shearX=Ke(i,"shearX",0),o.shearY=Ke(i,"shearY",0),o.inherit=h.enumValue(exports.Inherit,Ke(i,"inherit","Normal")),o.skinRequired=Ke(i,"skin",!1);let l=Ke(i,"color",null);l&&o.color.setFromString(l),s.bones.push(o)}if(r.slots)for(let t=0;t<r.slots.length;t++){let e=r.slots[t],i=e.name,a=s.findBone(e.bone);if(!a)throw new Error(`Couldn't find bone ${e.bone} for slot ${i}`);let o=new re(s.slots.length,i,a),l=Ke(e,"color",null);l&&o.color.setFromString(l);let c=Ke(e,"dark",null);c&&(o.darkColor=n.fromString(c)),o.attachmentName=Ke(e,"attachment",null),o.blendMode=h.enumValue(exports.BlendMode,Ke(e,"blend","normal")),o.visible=Ke(e,"visible",!0),s.slots.push(o)}if(r.ik)for(let t=0;t<r.ik.length;t++){let i=r.ik[t],n=new Gt(i.name);n.order=Ke(i,"order",0),n.skinRequired=Ke(i,"skin",!1);for(let t=0;t<i.bones.length;t++){let e=s.findBone(i.bones[t]);if(!e)throw new Error(`Couldn't find bone ${i.bones[t]} for IK constraint ${i.name}.`);n.bones.push(e)}let a=s.findBone(i.target);if(!a)throw new Error(`Couldn't find target bone ${i.target} for IK constraint ${i.name}.`);n.target=a,n.mix=Ke(i,"mix",1),n.softness=Ke(i,"softness",0)*e,n.bendDirection=Ke(i,"bendPositive",!0)?1:-1,n.compress=Ke(i,"compress",!1),n.stretch=Ke(i,"stretch",!1),n.uniform=Ke(i,"uniform",!1),s.ikConstraints.push(n)}if(r.transform)for(let t=0;t<r.transform.length;t++){let i=r.transform[t],n=new ie(i.name);n.order=Ke(i,"order",0),n.skinRequired=Ke(i,"skin",!1);for(let t=0;t<i.bones.length;t++){let e=i.bones[t],r=s.findBone(e);if(!r)throw new Error(`Couldn't find bone ${e} for transform constraint ${i.name}.`);n.bones.push(r)}let a=i.target,o=s.findBone(a);if(!o)throw new Error(`Couldn't find target bone ${a} for transform constraint ${i.name}.`);n.target=o,n.local=Ke(i,"local",!1),n.relative=Ke(i,"relative",!1),n.offsetRotation=Ke(i,"rotation",0),n.offsetX=Ke(i,"x",0)*e,n.offsetY=Ke(i,"y",0)*e,n.offsetScaleX=Ke(i,"scaleX",0),n.offsetScaleY=Ke(i,"scaleY",0),n.offsetShearY=Ke(i,"shearY",0),n.mixRotate=Ke(i,"mixRotate",1),n.mixX=Ke(i,"mixX",1),n.mixY=Ke(i,"mixY",n.mixX),n.mixScaleX=Ke(i,"mixScaleX",1),n.mixScaleY=Ke(i,"mixScaleY",n.mixScaleX),n.mixShearY=Ke(i,"mixShearY",1),s.transformConstraints.push(n)}if(r.path)for(let t=0;t<r.path.length;t++){let i=r.path[t],n=new $t(i.name);n.order=Ke(i,"order",0),n.skinRequired=Ke(i,"skin",!1);for(let t=0;t<i.bones.length;t++){let e=i.bones[t],r=s.findBone(e);if(!r)throw new Error(`Couldn't find bone ${e} for path constraint ${i.name}.`);n.bones.push(r)}let a=i.target,o=s.findSlot(a);if(!o)throw new Error(`Couldn't find target slot ${a} for path constraint ${i.name}.`);n.target=o,n.positionMode=h.enumValue(exports.PositionMode,Ke(i,"positionMode","Percent")),n.spacingMode=h.enumValue(exports.SpacingMode,Ke(i,"spacingMode","Length")),n.rotateMode=h.enumValue(exports.RotateMode,Ke(i,"rotateMode","Tangent")),n.offsetRotation=Ke(i,"rotation",0),n.position=Ke(i,"position",0),n.positionMode==exports.PositionMode.Fixed&&(n.position*=e),n.spacing=Ke(i,"spacing",0),n.spacingMode!=exports.SpacingMode.Length&&n.spacingMode!=exports.SpacingMode.Fixed||(n.spacing*=e),n.mixRotate=Ke(i,"mixRotate",1),n.mixX=Ke(i,"mixX",1),n.mixY=Ke(i,"mixY",n.mixX),s.pathConstraints.push(n)}if(r.physics)for(let t=0;t<r.physics.length;t++){const i=r.physics[t],n=new Zt(i.name);n.order=Ke(i,"order",0),n.skinRequired=Ke(i,"skin",!1);const a=i.bone,o=s.findBone(a);if(null==o)throw new Error("Physics bone not found: "+a);n.bone=o,n.x=Ke(i,"x",0),n.y=Ke(i,"y",0),n.rotate=Ke(i,"rotate",0),n.scaleX=Ke(i,"scaleX",0),n.shearX=Ke(i,"shearX",0),n.limit=Ke(i,"limit",5e3)*e,n.step=1/Ke(i,"fps",60),n.inertia=Ke(i,"inertia",1),n.strength=Ke(i,"strength",100),n.damping=Ke(i,"damping",1),n.massInverse=1/Ke(i,"mass",1),n.wind=Ke(i,"wind",0),n.gravity=Ke(i,"gravity",0),n.mix=Ke(i,"mix",1),n.inertiaGlobal=Ke(i,"inertiaGlobal",!1),n.strengthGlobal=Ke(i,"strengthGlobal",!1),n.dampingGlobal=Ke(i,"dampingGlobal",!1),n.massGlobal=Ke(i,"massGlobal",!1),n.windGlobal=Ke(i,"windGlobal",!1),n.gravityGlobal=Ke(i,"gravityGlobal",!1),n.mixGlobal=Ke(i,"mixGlobal",!1),s.physicsConstraints.push(n)}if(r.skins)for(let t=0;t<r.skins.length;t++){let e=r.skins[t],i=new se(e.name);if(e.bones)for(let t=0;t<e.bones.length;t++){let r=e.bones[t],n=s.findBone(r);if(!n)throw new Error(`Couldn't find bone ${r} for skin ${e.name}.`);i.bones.push(n)}if(e.ik)for(let t=0;t<e.ik.length;t++){let r=e.ik[t],n=s.findIkConstraint(r);if(!n)throw new Error(`Couldn't find IK constraint ${r} for skin ${e.name}.`);i.constraints.push(n)}if(e.transform)for(let t=0;t<e.transform.length;t++){let r=e.transform[t],n=s.findTransformConstraint(r);if(!n)throw new Error(`Couldn't find transform constraint ${r} for skin ${e.name}.`);i.constraints.push(n)}if(e.path)for(let t=0;t<e.path.length;t++){let r=e.path[t],n=s.findPathConstraint(r);if(!n)throw new Error(`Couldn't find path constraint ${r} for skin ${e.name}.`);i.constraints.push(n)}if(e.physics)for(let t=0;t<e.physics.length;t++){let r=e.physics[t],n=s.findPhysicsConstraint(r);if(!n)throw new Error(`Couldn't find physics constraint ${r} for skin ${e.name}.`);i.constraints.push(n)}for(let t in e.attachments){let r=s.findSlot(t);if(!r)throw new Error(`Couldn't find slot ${t} for skin ${e.name}.`);let n=e.attachments[t];for(let t in n){let e=this.readAttachment(n[t],i,r.index,t,s);e&&i.setAttachment(r.index,t,e)}}s.skins.push(i),"default"==i.name&&(s.defaultSkin=i)}for(let t=0,e=this.linkedMeshes.length;t<e;t++){let e=this.linkedMeshes[t],r=e.skin?s.findSkin(e.skin):s.defaultSkin;if(!r)throw new Error(`Skin not found: ${e.skin}`);let i=r.getAttachment(e.slotIndex,e.parent);if(!i)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?i:e.mesh,e.mesh.setParentMesh(i),null!=e.mesh.region&&e.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let t in r.events){let e=r.events[t],i=new Ut(t);i.intValue=Ke(e,"int",0),i.floatValue=Ke(e,"float",0),i.stringValue=Ke(e,"string",""),i.audioPath=Ke(e,"audio",null),i.audioPath&&(i.volume=Ke(e,"volume",1),i.balance=Ke(e,"balance",0)),s.events.push(i)}if(r.animations)for(let t in r.animations){let e=r.animations[t];this.readAnimation(e,t,s)}return s}readAttachment(t,e,s,r,i){let n=this.scale;switch(r=Ke(t,"name",r),Ke(t,"type","region")){case"region":{let s=Ke(t,"path",r),i=this.readSequence(Ke(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,r,s,i);if(!a)return null;a.path=s,a.x=Ke(t,"x",0)*n,a.y=Ke(t,"y",0)*n,a.scaleX=Ke(t,"scaleX",1),a.scaleY=Ke(t,"scaleY",1),a.rotation=Ke(t,"rotation",0),a.width=t.width*n,a.height=t.height*n,a.sequence=i;let o=Ke(t,"color",null);return o&&a.color.setFromString(o),null!=a.region&&a.updateRegion(),a}case"boundingbox":{let s=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!s)return null;this.readVertices(t,s,t.vertexCount<<1);let i=Ke(t,"color",null);return i&&s.color.setFromString(i),s}case"mesh":case"linkedmesh":{let i=Ke(t,"path",r),a=this.readSequence(Ke(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,r,i,a);if(!o)return null;o.path=i;let l=Ke(t,"color",null);l&&o.color.setFromString(l),o.width=Ke(t,"width",0)*n,o.height=Ke(t,"height",0)*n,o.sequence=a;let h=Ke(t,"parent",null);if(h)return this.linkedMeshes.push(new $e(o,Ke(t,"skin",null),s,h,Ke(t,"timelines",!0))),o;let c=t.uvs;return this.readVertices(t,o,c.length),o.triangles=t.triangles,o.regionUVs=c,null!=o.region&&o.updateRegion(),o.edges=Ke(t,"edges",null),o.hullLength=2*Ke(t,"hull",0),o}case"path":{let s=this.attachmentLoader.newPathAttachment(e,r);if(!s)return null;s.closed=Ke(t,"closed",!1),s.constantSpeed=Ke(t,"constantSpeed",!0);let i=t.vertexCount;this.readVertices(t,s,i<<1);let a=h.newArray(i/3,0);for(let e=0;e<t.lengths.length;e++)a[e]=t.lengths[e]*n;s.lengths=a;let o=Ke(t,"color",null);return o&&s.color.setFromString(o),s}case"point":{let s=this.attachmentLoader.newPointAttachment(e,r);if(!s)return null;s.x=Ke(t,"x",0)*n,s.y=Ke(t,"y",0)*n,s.rotation=Ke(t,"rotation",0);let i=Ke(t,"color",null);return i&&s.color.setFromString(i),s}case"clipping":{let s=this.attachmentLoader.newClippingAttachment(e,r);if(!s)return null;let n=Ke(t,"end",null);n&&(s.endSlot=i.findSlot(n));let a=t.vertexCount;this.readVertices(t,s,a<<1);let o=Ke(t,"color",null);return o&&s.color.setFromString(o),s}}return null}readSequence(t){if(null==t)return null;let e=new m(Ke(t,"count",0));return e.start=Ke(t,"start",1),e.digits=Ke(t,"digits",0),e.setupIndex=Ke(t,"setup",0),e}readVertices(t,e,s){let r=this.scale;e.worldVerticesLength=s;let i=t.vertices;if(s==i.length){let t=h.toFloatArray(i);if(1!=r)for(let e=0,s=i.length;e<s;e++)t[e]*=r;return void(e.vertices=t)}let n=new Array,a=new Array;for(let t=0,e=i.length;t<e;){let e=i[t++];a.push(e);for(let s=t+4*e;t<s;t+=4)a.push(i[t]),n.push(i[t+1]*r),n.push(i[t+2]*r),n.push(i[t+3])}e.bones=a,e.vertices=h.toFloatArray(n)}readAnimation(e,s,r){let i=this.scale,a=new Array;if(e.slots)for(let t in e.slots){let s=e.slots[t],i=r.findSlot(t);if(!i)throw new Error("Slot not found: "+t);let o=i.index;for(let t in s){let e=s[t];if(!e)continue;let r=e.length;if("attachment"==t){let t=new N(r,o);for(let s=0;s<r;s++){let r=e[s];t.setFrame(s,Ke(r,"time",0),Ke(r,"name",null))}a.push(t)}else if("rgba"==t){let t=new X(r,r<<2,o),s=e[0],i=Ke(s,"time",0),l=n.fromString(s.color);for(let r=0,a=0;;r++){t.setFrame(r,i,l.r,l.g,l.b,l.a);let o=e[r+1];if(!o){t.shrink(a);break}let h=Ke(o,"time",0),c=n.fromString(o.color),d=s.curve;d&&(a=Je(d,t,a,r,0,i,h,l.r,c.r,1),a=Je(d,t,a,r,1,i,h,l.g,c.g,1),a=Je(d,t,a,r,2,i,h,l.b,c.b,1),a=Je(d,t,a,r,3,i,h,l.a,c.a,1)),i=h,l=c,s=o}a.push(t)}else if("rgb"==t){let t=new _(r,3*r,o),s=e[0],i=Ke(s,"time",0),l=n.fromString(s.color);for(let r=0,a=0;;r++){t.setFrame(r,i,l.r,l.g,l.b);let o=e[r+1];if(!o){t.shrink(a);break}let h=Ke(o,"time",0),c=n.fromString(o.color),d=s.curve;d&&(a=Je(d,t,a,r,0,i,h,l.r,c.r,1),a=Je(d,t,a,r,1,i,h,l.g,c.g,1),a=Je(d,t,a,r,2,i,h,l.b,c.b,1)),i=h,l=c,s=o}a.push(t)}else if("alpha"==t)a.push(je(e,new V(r,r,o),0,1));else if("rgba2"==t){let t=new D(r,7*r,o),s=e[0],i=Ke(s,"time",0),l=n.fromString(s.light),h=n.fromString(s.dark);for(let r=0,a=0;;r++){t.setFrame(r,i,l.r,l.g,l.b,l.a,h.r,h.g,h.b);let o=e[r+1];if(!o){t.shrink(a);break}let c=Ke(o,"time",0),d=n.fromString(o.light),u=n.fromString(o.dark),p=s.curve;p&&(a=Je(p,t,a,r,0,i,c,l.r,d.r,1),a=Je(p,t,a,r,1,i,c,l.g,d.g,1),a=Je(p,t,a,r,2,i,c,l.b,d.b,1),a=Je(p,t,a,r,3,i,c,l.a,d.a,1),a=Je(p,t,a,r,4,i,c,h.r,u.r,1),a=Je(p,t,a,r,5,i,c,h.g,u.g,1),a=Je(p,t,a,r,6,i,c,h.b,u.b,1)),i=c,l=d,h=u,s=o}a.push(t)}else if("rgb2"==t){let t=new O(r,6*r,o),s=e[0],i=Ke(s,"time",0),l=n.fromString(s.light),h=n.fromString(s.dark);for(let r=0,a=0;;r++){t.setFrame(r,i,l.r,l.g,l.b,h.r,h.g,h.b);let o=e[r+1];if(!o){t.shrink(a);break}let c=Ke(o,"time",0),d=n.fromString(o.light),u=n.fromString(o.dark),p=s.curve;p&&(a=Je(p,t,a,r,0,i,c,l.r,d.r,1),a=Je(p,t,a,r,1,i,c,l.g,d.g,1),a=Je(p,t,a,r,2,i,c,l.b,d.b,1),a=Je(p,t,a,r,3,i,c,h.r,u.r,1),a=Je(p,t,a,r,4,i,c,h.g,u.g,1),a=Je(p,t,a,r,5,i,c,h.b,u.b,1)),i=c,l=d,h=u,s=o}a.push(t)}}}if(e.bones)for(let t in e.bones){let s=e.bones[t],n=r.findBone(t);if(!n)throw new Error("Bone not found: "+t);let o=n.index;for(let t in s){let e=s[t],r=e.length;if(0!=r)if("rotate"===t)a.push(je(e,new k(r,r,o),0,1));else if("translate"===t){let t=new I(r,r<<1,o);a.push(He(e,t,"x","y",0,i))}else if("translatex"===t){let t=new A(r,r,o);a.push(je(e,t,0,i))}else if("translatey"===t){let t=new T(r,r,o);a.push(je(e,t,0,i))}else if("scale"===t){let t=new B(r,r<<1,o);a.push(He(e,t,"x","y",1,1))}else if("scalex"===t){let t=new C(r,r,o);a.push(je(e,t,1,1))}else if("scaley"===t){let t=new F(r,r,o);a.push(je(e,t,1,1))}else if("shear"===t){let t=new E(r,r<<1,o);a.push(He(e,t,"x","y",0,1))}else if("shearx"===t){let t=new R(r,r,o);a.push(je(e,t,0,1))}else if("sheary"===t){let t=new Y(r,r,o);a.push(je(e,t,0,1))}else if("inherit"===t){let t=new P(r,n.index);for(let s=0;s<e.length;s++){let r=e[s];t.setFrame(s,Ke(r,"time",0),h.enumValue(exports.Inherit,Ke(r,"inherit","Normal")))}a.push(t)}}}if(e.ik)for(let t in e.ik){let s=e.ik[t],n=s[0];if(!n)continue;let o=r.findIkConstraint(t);if(!o)throw new Error("IK Constraint not found: "+t);let l=r.ikConstraints.indexOf(o),h=new U(s.length,s.length<<1,l),c=Ke(n,"time",0),d=Ke(n,"mix",1),u=Ke(n,"softness",0)*i;for(let t=0,e=0;;t++){h.setFrame(t,c,d,u,Ke(n,"bendPositive",!0)?1:-1,Ke(n,"compress",!1),Ke(n,"stretch",!1));let r=s[t+1];if(!r){h.shrink(e);break}let a=Ke(r,"time",0),o=Ke(r,"mix",1),l=Ke(r,"softness",0)*i,p=n.curve;p&&(e=Je(p,h,e,t,0,c,a,d,o,1),e=Je(p,h,e,t,1,c,a,u,l,i)),c=a,d=o,u=l,n=r}a.push(h)}if(e.transform)for(let t in e.transform){let s=e.transform[t],i=s[0];if(!i)continue;let n=r.findTransformConstraint(t);if(!n)throw new Error("Transform constraint not found: "+t);let o=r.transformConstraints.indexOf(n),l=new z(s.length,6*s.length,o),h=Ke(i,"time",0),c=Ke(i,"mixRotate",1),d=Ke(i,"mixX",1),u=Ke(i,"mixY",d),p=Ke(i,"mixScaleX",1),m=Ke(i,"mixScaleY",p),f=Ke(i,"mixShearY",1);for(let t=0,e=0;;t++){l.setFrame(t,h,c,d,u,p,m,f);let r=s[t+1];if(!r){l.shrink(e);break}let n=Ke(r,"time",0),a=Ke(r,"mixRotate",1),o=Ke(r,"mixX",1),g=Ke(r,"mixY",o),x=Ke(r,"mixScaleX",1),w=Ke(r,"mixScaleY",x),b=Ke(r,"mixShearY",1),y=i.curve;y&&(e=Je(y,l,e,t,0,h,n,c,a,1),e=Je(y,l,e,t,1,h,n,d,o,1),e=Je(y,l,e,t,2,h,n,u,g,1),e=Je(y,l,e,t,3,h,n,p,x,1),e=Je(y,l,e,t,4,h,n,m,w,1),e=Je(y,l,e,t,5,h,n,f,b,1)),h=n,c=a,d=o,u=g,p=x,m=w,p=x,i=r}a.push(l)}if(e.path)for(let t in e.path){let s=e.path[t],n=r.findPathConstraint(t);if(!n)throw new Error("Path constraint not found: "+t);let o=r.pathConstraints.indexOf(n);for(let t in s){let e=s[t],r=e[0];if(!r)continue;let l=e.length;if("position"===t){let t=new G(l,l,o);a.push(je(e,t,0,n.positionMode==exports.PositionMode.Fixed?i:1))}else if("spacing"===t){let t=new $(l,l,o);a.push(je(e,t,0,n.spacingMode==exports.SpacingMode.Length||n.spacingMode==exports.SpacingMode.Fixed?i:1))}else if("mix"===t){let t=new j(l,3*l,o),s=Ke(r,"time",0),i=Ke(r,"mixRotate",1),n=Ke(r,"mixX",1),h=Ke(r,"mixY",n);for(let a=0,o=0;;a++){t.setFrame(a,s,i,n,h);let l=e[a+1];if(!l){t.shrink(o);break}let c=Ke(l,"time",0),d=Ke(l,"mixRotate",1),u=Ke(l,"mixX",1),p=Ke(l,"mixY",u),m=r.curve;m&&(o=Je(m,t,o,a,0,s,c,i,d,1),o=Je(m,t,o,a,1,s,c,n,u,1),o=Je(m,t,o,a,2,s,c,h,p,1)),s=c,i=d,n=u,h=p,r=l}a.push(t)}}}if(e.physics)for(let t in e.physics){let s=e.physics[t],i=-1;if(t.length>0){let e=r.findPhysicsConstraint(t);if(!e)throw new Error("Physics constraint not found: "+t);i=r.physicsConstraints.indexOf(e)}for(let t in s){let e=s[t],r=e[0];if(!r)continue;let n,o=e.length;if("reset"!=t){if("inertia"==t)n=new J(o,o,i);else if("strength"==t)n=new K(o,o,i);else if("damping"==t)n=new Q(o,o,i);else if("mass"==t)n=new Z(o,o,i);else if("wind"==t)n=new tt(o,o,i);else if("gravity"==t)n=new et(o,o,i);else{if("mix"!=t)continue;n=new st(o,o,i)}a.push(je(e,n,0,1))}else{const t=new rt(o,i);for(let s=0;null!=r;r=e[s+1],s++)t.setFrame(s,Ke(r,"time",0));a.push(t)}}}if(e.attachments)for(let s in e.attachments){let n=e.attachments[s],o=r.findSkin(s);if(!o)throw new Error("Skin not found: "+s);for(let e in n){let s=n[e],l=r.findSlot(e);if(!l)throw new Error("Slot not found: "+e);let c=l.index;for(let e in s){let r=s[e],n=o.getAttachment(c,e);for(let e in r){let s=r[e],o=s[0];if(o)if("deform"==e){let t=n.bones,e=n.vertices,r=t?e.length/3*2:e.length,l=new L(s.length,s.length,c,n),d=Ke(o,"time",0);for(let n=0,a=0;;n++){let c,u=Ke(o,"vertices",null);if(u){c=h.newFloatArray(r);let s=Ke(o,"offset",0);if(h.arrayCopy(u,0,c,s,u.length),1!=i)for(let t=s,e=t+u.length;t<e;t++)c[t]*=i;if(!t)for(let t=0;t<r;t++)c[t]+=e[t]}else c=t?h.newFloatArray(r):e;l.setFrame(n,d,c);let p=s[n+1];if(!p){l.shrink(a);break}let m=Ke(p,"time",0),f=o.curve;f&&(a=Je(f,l,a,n,0,d,m,0,1,1)),d=m,o=p}a.push(l)}else if("sequence"==e){let e=new it(s.length,c,n),r=0;for(let i=0;i<s.length;i++){let n=Ke(o,"delay",r),a=Ke(o,"time",0),l=t[Ke(o,"mode","hold")],h=Ke(o,"index",0);e.setFrame(i,a,l,h,n),r=n,o=s[i+1]}a.push(e)}}}}}if(e.drawOrder){let t=new W(e.drawOrder.length),s=r.slots.length,i=0;for(let n=0;n<e.drawOrder.length;n++,i++){let a=e.drawOrder[n],o=null,l=Ke(a,"offsets",null);if(l){o=h.newArray(s,-1);let t=h.newArray(s-l.length,0),e=0,i=0;for(let s=0;s<l.length;s++){let n=l[s],a=r.findSlot(n.slot);if(!a)throw new Error("Slot not found: "+a);let h=a.index;for(;e!=h;)t[i++]=e++;o[e+n.offset]=e++}for(;e<s;)t[i++]=e++;for(let e=s-1;e>=0;e--)-1==o[e]&&(o[e]=t[--i])}t.setFrame(i,Ke(a,"time",0),o)}a.push(t)}if(e.events){let t=new q(e.events.length),s=0;for(let i=0;i<e.events.length;i++,s++){let n=e.events[i],a=r.findEvent(n.name);if(!a)throw new Error("Event not found: "+n.name);let o=new Wt(h.toSinglePrecision(Ke(n,"time",0)),a);o.intValue=Ke(n,"int",a.intValue),o.floatValue=Ke(n,"float",a.floatValue),o.stringValue=Ke(n,"string",a.stringValue),o.data.audioPath&&(o.volume=Ke(n,"volume",1),o.balance=Ke(n,"balance",0)),t.setFrame(s,o)}a.push(t)}let o=0;for(let t=0,e=a.length;t<e;t++)o=Math.max(o,a[t].getDuration());r.animations.push(new g(s,a,o))}}class $e{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,i){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}}function je(t,e,s,r){let i=t[0],n=Ke(i,"time",0),a=Ke(i,"value",s)*r,o=0;for(let l=0;;l++){e.setFrame(l,n,a);let h=t[l+1];if(!h)return e.shrink(o),e;let c=Ke(h,"time",0),d=Ke(h,"value",s)*r;i.curve&&(o=Je(i.curve,e,o,l,0,n,c,a,d,r)),n=c,a=d,i=h}}function He(t,e,s,r,i,n){let a=t[0],o=Ke(a,"time",0),l=Ke(a,s,i)*n,h=Ke(a,r,i)*n,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 p=Ke(u,"time",0),m=Ke(u,s,i)*n,f=Ke(u,r,i)*n,g=a.curve;g&&(c=Je(g,e,c,d,0,o,p,l,m,n),c=Je(g,e,c,d,1,o,p,h,f,n)),o=p,l=m,h=f,a=u}}function Je(t,e,s,r,i,n,a,o,l,h){if("stepped"==t)return e.setStepped(r),s;let c=i<<2,d=t[c],u=t[c+1]*h,p=t[c+2],m=t[c+3]*h;return e.setBezier(s,r,i,n,o,d,u,p,m,a,l),s+1}function Ke(t,e,s){return void 0!==t[e]?t[e]:s}var Qe;function Ze(t,e,s){const r=new Dt(t);return"json"===s?new Ge(r).readSkeletonData(e):new ne(r).readSkeletonData(new Uint8Array(e))}async function ts(t,s,r){let i;const n=t.map(((t,i)=>{const n=s[i];let a=e.AssetType.Texture2D;return"ktx"===n?a=e.AssetType.KTX:"ktx2"===n&&(a=e.AssetType.KTX2),rs(t,r,a)}));try{i=await Promise.all(n)}catch(t){throw t}return i}async function es(t,r){const i=function(t){const e=new s.URL(t),r=e.origin+e.pathname;return r.endsWith("/")?r:r.substring(0,r.lastIndexOf("/")+1)}(t);let n,a;try{n=await e.request(t,{type:"text"})}catch(e){throw new Error(`Spine Atlas: ${t} load error: ${e}`)}let o=new Ft(n);const l=[];for(let t of o.pages){const e=i+t.name;l.push(rs(e,r))}try{a=await Promise.all(l)}catch(t){throw new Error(`Spine Texture: load error: ${t}`)}return o=ss(n,a),o}function ss(t,e){const r=new Ft(t);return r.pages.forEach(((t,r)=>{const i=function(t){return new is(new s.Image,t)}(e.find((e=>e.name===t.name))||e[r]);t.setTexture(i)})),r}function rs(t,s,r=e.AssetType.Texture2D){return s.resourceManager.load({url:t,type:r})}void 0===Math.fround&&(Math.fround=(Qe=new Float32Array(1),function(t){return Qe[0]=t,Qe[0]}));class is extends bt{constructor(t,e){super(t),this.texture=e,this.texture.generateMipmaps()}getImage(){return this.texture}setFilters(t,s){t===exports.TextureFilter.Nearest?this.texture.filterMode=e.TextureFilterMode.Point:s===exports.TextureFilter.MipMapLinearLinear?this.texture.filterMode=e.TextureFilterMode.Trilinear:this.texture.filterMode=e.TextureFilterMode.Bilinear}setWraps(t,e){this.texture.wrapModeU=this._convertWrapMode(t),this.texture.wrapModeV=this._convertWrapMode(e)}dispose(){}_convertWrapMode(t){switch(t){case exports.TextureWrap.ClampToEdge:return e.TextureWrapMode.Clamp;case exports.TextureWrap.Repeat:return e.TextureWrapMode.Repeat;case exports.TextureWrap.MirroredRepeat:return e.TextureWrapMode.Mirror;default:throw new Error("Unsupported texture wrap mode.")}}}class ns{constructor(t,e=1){this._type=t,this._lastElementIndex=e-1;const s=this._elements=new Array(e);for(let r=0;r<e;++r)s[r]=new t}get(){return this._lastElementIndex<0?new this._type:this._elements[this._lastElementIndex--]}return(t){this._elements[++this._lastElementIndex]=t}}class as{constructor(t){this._usedElementCount=0,this._type=t,this._elements=[]}get(){const{_usedElementCount:t,_elements:e}=this;if(this._usedElementCount++,e.length===t){const t=new this._type;return e.push(t),t}return e[t]}clear(){this._usedElementCount=0}}const{SourceAlpha:os,One:ls,DestinationColor:hs,Zero:cs,OneMinusSourceColor:ds,OneMinusSourceAlpha:us}=e.BlendFactor,{Add:ps}=e.BlendOperation;function ms(t,e){const s=t.renderState.blendState.targetBlendState;switch(e){case exports.BlendMode.Additive:s.sourceColorBlendFactor=os,s.destinationColorBlendFactor=ls,s.sourceAlphaBlendFactor=ls,s.destinationAlphaBlendFactor=ls,s.colorBlendOperation=s.alphaBlendOperation=ps;break;case exports.BlendMode.Multiply:s.sourceColorBlendFactor=hs,s.destinationColorBlendFactor=cs,s.sourceAlphaBlendFactor=ls,s.destinationAlphaBlendFactor=cs,s.colorBlendOperation=s.alphaBlendOperation=ps;break;case exports.BlendMode.Screen:s.sourceColorBlendFactor=ls,s.destinationColorBlendFactor=ds,s.sourceAlphaBlendFactor=ls,s.destinationAlphaBlendFactor=ds,s.colorBlendOperation=s.alphaBlendOperation=ps;break;default:s.sourceColorBlendFactor=os,s.destinationColorBlendFactor=us,s.sourceAlphaBlendFactor=ls,s.destinationAlphaBlendFactor=us,s.colorBlendOperation=s.alphaBlendOperation=ps}}class fs{}const gs=1/0,xs=-1/0;class ws{static{this.QUAD_TRIANGLES=[0,1,2,2,3,0]}static{this.VERTEX_SIZE=8}static{this.VERTEX_STRIDE=9}static{this.tempDark=new n}static{this.tempColor=new n}static{this.tempVerts=new Array(8)}static{this.tempBlendMode=null}static{this.tempTexture=null}static{this.subPrimitivePool=new ns(e.SubPrimitive)}static{this.subRenderItemPool=new as(fs)}static{this.bounds=new e.BoundingBox(new e.Vector3(gs,gs,gs),new e.Vector3(xs,xs,xs))}getMaxVertexCount(t){let e=0;const{skins:s}=t,r=s.length;for(let t=0;t<r;t+=1){const r=s[t],i=this._getSkinVertexCount(r);e=Math.max(e,i)}return e}buildPrimitive(t,e){const{useClipping:s=!0,zSpacing:r=.01}=e.setting,{_clipper:i,_separateSlots:n,_subRenderItems:a,_separateSlotTextureMap:o}=this,{bounds:l}=ws;l.min.set(gs,gs,gs),l.max.set(xs,xs,xs);let h=0,c=0;const d=t.drawOrder,u=d.length,{engine:p,_indices:m,_vertices:f,_subPrimitives:g}=e;let{tempVerts:x,tempTexture:w,tempBlendMode:b,subRenderItemPool:y,subPrimitivePool:M}=ws;a.length=0,y.clear();let S,v,k=e._vertices,I=0,A=0,T=exports.BlendMode.Normal,B=null,C=0;ws.tempBlendMode=null,ws.tempTexture=null;for(let t=0;t<u;++t){const e=d[t];if(!e.bone.active){i.clipEndWithSlot(e);continue}const l=e.getAttachment();let u=null;const p=r*t;let F=0;const E=i.isClipping();let R=E?2:ws.VERTEX_SIZE;if(l){switch(l.constructor){case Vt:const t=l;u=t.color,F=4*R,t.computeWorldVertices(e,x,0,R),S=ws.QUAD_TRIANGLES,v=t.uvs,B=t.region.texture;break;case Pt:const r=l;u=r.color,F=(r.worldVerticesLength>>1)*R,F>k.length&&(ws.tempVerts=new Array(F)),r.computeWorldVertices(e,0,r.worldVerticesLength,x,0,R),S=r.triangles,v=r.uvs,B=r.region.texture;break;case wt:if(s){let t=l;i.clipStart(e,t)}continue;default:s&&i.clipEndWithSlot(e);continue}if(null!=B){let t,s,r,l,d=e.bone.skeleton.color,k=e.color,Y=d.a*k.a*u.a,P=ws.tempColor,X=ws.tempDark;if(P.set(d.r*k.r*u.r,d.g*k.g*u.g,d.b*k.b*u.b,Y),E)i.clipTriangles(x,S,S.length,v,P,X,!1),t=i.clippedVertices,s=t.length,r=i.clippedTriangles,l=r.length;else{let e=x;const{r:i,g:n,b:a,a:o}=P;for(let t=2,s=0,r=F;t<r;t+=R,s+=2)e[t]=i,e[t+1]=n,e[t+2]=a,e[t+3]=o,e[t+4]=v[s],e[t+5]=v[s+1];t=x,s=F,r=S,l=S.length}if(0==s||0==l){i.clipEndWithSlot(e);continue}let _=h/ws.VERTEX_STRIDE,V=f,D=h,O=0;for(;O<s;){let e=t[O++],s=t[O++];V[D++]=e,V[D++]=s,V[D++]=p,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,p)}h=D;let N=m;for(D=c,O=0;O<l;D++,O++)N[D]=r[O]+_;c+=l;const L=e.data,q=L.name;T=L.blendMode;const W=null!==b&&b!==L.blendMode,U=null!==w&&w!==B,z=n.get(q);if(z||W||U){if(A>0){const t=g[C];t&&C++;const e=t||M.get();e.start=I,e.count=A;const s=y.get();s.subPrimitive=e,s.texture=w,s.blendMode=b,a.push(s),I+=A,A=0}if(z){const t=o.get(q);if(t){const e=B.texture;t.filterMode=e.filterMode,t.wrapModeU=e.wrapModeU,t.wrapModeV=e.wrapModeV}const e=g[C];e&&C++;const s=e||M.get();s.start=I,s.count=l;const r=y.get();r.blendMode=T,r.subPrimitive=s,r.texture=B,r.slotName=q,a.push(r),I+=l,A=0}else A+=l}else A+=l;w=B,b=T}i.clipEndWithSlot(e)}else s&&i.clipEndWithSlot(e)}if(A>0){const t=g[C];t&&C++;const e=t||M.get();e.start=I,e.count=A;const s=y.get();s.blendMode=T,s.subPrimitive=e,s.texture=B,a.push(s),A=0}i.clipEnd();const F=g.length,E=a.length;if(E<F)for(let t=E;t<F;t++){const e=g[t];M.return(e)}e._clearSubPrimitives();for(let t=0,s=E;t<s;++t){const s=a[t],{slotName:r,blendMode:i,texture:n}=s;e._addSubPrimitive(s.subPrimitive);let l=n.texture;o.has(r)&&(l=o.get(r));const h=`${l.instanceId}_${i}`;let c=ys._materialCache.get(h);c||(c=this._createMaterialForTexture(l,p,i),ys._materialCache.set(h,c)),e.setMaterial(t,c)}e._vertexBuffer.setData(f),e._indexBuffer.setData(m)}addSeparateSlot(t){this._separateSlots.set(t,t)}addSeparateSlotTexture(t,e){this._separateSlotTextureMap.set(t,e)}_createMaterialForTexture(t,e,s){const r=ys._getDefaultMaterial(e);return r.shaderData.setTexture("material_SpineTexture",t),ms(r,s),r}_expandByPoint(t,e,s){const{bounds:{min:r,max:i}}=ws,n=Math.min(r.x,t),a=Math.min(r.y,e),o=Math.min(r.z,s),l=Math.max(i.x,t),h=Math.max(i.y,e),c=Math.max(i.z,s);r.set(n,a,o),i.set(l,h,c)}_getSkinVertexCount(t){const{attachments:e}=t;let s=0;const r=ws.QUAD_TRIANGLES.length;for(let t=0,i=e.length;t<i;t++){const i=e[t];for(let t in i){const e=i[t];if(e)if(e instanceof Vt)s+=r;else{if(!(e instanceof Pt))continue;s+=e.triangles.length}}}return s}constructor(){this._clipper=new ze,this._subRenderItems=[],this._separateSlots=new Map,this._separateSlotTextureMap=new Map}}class bs extends e.Material{static{this._spineVS="\n uniform mat4 renderer_MVPMat;\n\n attribute vec3 POSITION;\n attribute vec2 TEXCOORD_0;\n attribute vec4 COLOR_0;\n \n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n gl_Position = renderer_MVPMat * vec4(POSITION, 1.0);\n \n v_uv = TEXCOORD_0;\n v_color = COLOR_0;\n }\n "}static{this._spineFS="\n uniform sampler2D material_SpineTexture;\n\n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n vec4 baseColor = texture2D(material_SpineTexture, v_uv);\n gl_FragColor = baseColor * v_color;\n }\n "}constructor(t){super(t,e.Shader.find("galacean-spine-shader")||e.Shader.create("galacean-spine-shader",bs._spineVS,bs._spineFS));const s=this.renderState;s.blendState.targetBlendState.enabled=!0,ms(this,exports.BlendMode.Normal),s.depthState.writeEnabled=!1,s.rasterState.cullMode=e.CullMode.Off,s.renderQueueType=e.RenderQueueType.Transparent}}class ys extends e.Renderer{static{this._spineGenerator=new ws}static{this._positionVertexElement=new e.VertexElement("POSITION",0,e.VertexElementFormat.Vector3,0)}static{this._colorVertexElement=new e.VertexElement("COLOR_0",12,e.VertexElementFormat.Vector4,0)}static{this._uvVertexElement=new e.VertexElement("TEXCOORD_0",28,e.VertexElementFormat.Vector2,0)}static{this._materialCache=new Map}static{this._animationDataCache=new Map}static _getDefaultMaterial(t){let e=this._defaultMaterial;if(e){if(e.engine===t)return e.clone();e.destroy(!0),e=null}return e=new bs(t),e.isGCIgnored=!0,this._defaultMaterial=e,e.clone()}get resource(){return this._resource}set resource(t){if(!t)return this._state=null,this._skeleton=null,void(this._resource=null);this._resource=t,this._addResourceReferCount(t,1);const{skeletonData:e}=t;this._skeleton=new Qt(e);let s=ys._animationDataCache.get(e);s||(s=new gt(e),ys._animationDataCache.set(e,s)),this._state=new nt(s);const r=ys._spineGenerator.getMaxVertexCount(e);this._createBuffer(r),this._initializeDefaultState(),this._dirtyUpdateFlag|=4,this._state.addListener({start:()=>{this._onAnimationStart()},complete:t=>{this._onAnimationComplete(t)}})}get state(){return this._state}get skeleton(){return this._skeleton}constructor(t){super(t),this.setting=new vs,this.defaultState=new ks,this._subPrimitives=[],this._needResizeBuffer=!1,this._vertexCount=0;const s=new e.Primitive(this._engine);this._primitive=s,s.addVertexElement(ys._positionVertexElement),s.addVertexElement(ys._colorVertexElement),s.addVertexElement(ys._uvVertexElement)}addSeparateSlot(t){this._skeleton||console.error("Skeleton not found!");this._skeleton.findSlot(t)?ys._spineGenerator.addSeparateSlot(t):console.warn(`Slot: ${t} not find.`)}_onEnable(){this._initializeDefaultState()}update(t){const{_state:e,_skeleton:s}=this;e&&s&&(e.update(t),e.apply(s),s.update(t),s.updateWorldTransform(exports.Physics.update),ys._spineGenerator.buildPrimitive(this._skeleton,this),this._isContainDirtyFlag(4)&&(this._onWorldVolumeChanged(),this._setDirtyFlagFalse(4)),this._isContainDirtyFlag(2)&&this._calculateGeneratorBounds(this.bounds))}_render(t){const{_primitive:e,_subPrimitives:s}=this,{_materials:r,_engine:i}=this,n=i._renderElementPool.get();n.set(this.priority,this._distanceForSort);const a=i._subRenderElementPool;if(s){for(let t=0,i=s.length;t<i;t++){let i=r[t];if(!i)continue;(i.destroyed||i.shader.destroyed)&&(i=this.engine._meshMagentaMaterial);const o=a.get();o.set(this,i,e,s[t]),n.addSubRenderElement(o)}t.camera._renderPipeline.pushRenderElement(t,n)}}_updateBounds(t){this._calculateGeneratorBounds(t)}_calculateGeneratorBounds(t){const{bounds:s}=ws;e.BoundingBox.transform(s,this.entity.transform.worldMatrix,t)}_cloneTo(t){t.resource=this._resource}_onDestroy(){const{_primitive:t,_subPrimitives:e,_resource:s}=this;e.length=0,t&&t.destroy(),s&&this._addResourceReferCount(s,-1),this._clearMaterialCache(),this._primitive=null,this._resource=null,this._skeleton=null,this._state=null,this.setting=null,super._onDestroy()}_createBuffer(t){const{_engine:s,_primitive:r}=this;this._vertices=new Float32Array(t*ws.VERTEX_STRIDE),this._indices=new Uint16Array(t);const i=4*ws.VERTEX_STRIDE,n=new e.Buffer(s,e.BufferBindFlag.VertexBuffer,this._vertices,e.BufferUsage.Dynamic),a=new e.Buffer(s,e.BufferBindFlag.IndexBuffer,this._indices,e.BufferUsage.Dynamic);this._indexBuffer=a,this._vertexBuffer=n;const o=new e.VertexBufferBinding(n,i);this._primitive.setVertexBufferBinding(0,o);const l=new e.IndexBufferBinding(a,e.IndexFormat.UInt16);r.setIndexBufferBinding(l)}_addSubPrimitive(t){this._subPrimitives.push(t)}_clearSubPrimitives(){this._subPrimitives.length=0}_isContainDirtyFlag(t){return!!(this._dirtyUpdateFlag&t)}_setDirtyFlagFalse(t){this._dirtyUpdateFlag&=~t}_onWorldVolumeChanged(){this._dirtyUpdateFlag|=1}_onAnimationStart(){this._dirtyUpdateFlag|=2}_onAnimationComplete(t){t.loop||this._setDirtyFlagFalse(2)}_clearMaterialCache(){this._materials.forEach((t=>{const e=t.shaderData.getTexture("material_SpineTexture"),s=function(t){const e=t.renderState.blendState.targetBlendState;return e.sourceColorBlendFactor===os&&e.destinationColorBlendFactor===ls&&e.sourceAlphaBlendFactor===ls&&e.destinationAlphaBlendFactor===ls&&e.colorBlendOperation===ps&&e.alphaBlendOperation===ps?exports.BlendMode.Additive:e.sourceColorBlendFactor===hs&&e.destinationColorBlendFactor===cs&&e.sourceAlphaBlendFactor===ls&&e.destinationAlphaBlendFactor===cs&&e.colorBlendOperation===ps&&e.alphaBlendOperation===ps?exports.BlendMode.Multiply:e.sourceColorBlendFactor===ls&&e.destinationColorBlendFactor===ds&&e.sourceAlphaBlendFactor===ls&&e.destinationAlphaBlendFactor===ds&&e.colorBlendOperation===ps&&e.alphaBlendOperation===ps?exports.BlendMode.Screen:exports.BlendMode.Normal}(t),r=`${e.instanceId}_${s}`;ys._materialCache.delete(r)}))}_initializeDefaultState(){const{skeleton:t,state:e}=this;if(t&&e){const{animationName:s,skinName:r,loop:i,scale:n}=this.defaultState;t.scaleX=n,t.scaleY=n,"default"!==r&&(t.setSkinByName(r),t.setToSetupPose()),s&&e.setAnimation(0,s,i)}}}var Ms,Ss;r([e.deepClone],ys.prototype,"setting",void 0),r([e.deepClone],ys.prototype,"defaultState",void 0),r([e.ignoreClone],ys.prototype,"_primitive",void 0),r([e.ignoreClone],ys.prototype,"_subPrimitives",void 0),r([e.ignoreClone],ys.prototype,"_indexBuffer",void 0),r([e.ignoreClone],ys.prototype,"_vertexBuffer",void 0),r([e.ignoreClone],ys.prototype,"_vertices",void 0),r([e.ignoreClone],ys.prototype,"_indices",void 0),r([e.ignoreClone],ys.prototype,"_needResizeBuffer",void 0),r([e.ignoreClone],ys.prototype,"_vertexCount",void 0),r([e.ignoreClone],ys.prototype,"_resource",void 0),r([e.ignoreClone],ys.prototype,"_skeleton",void 0),r([e.ignoreClone],ys.prototype,"_state",void 0),function(t){t[t.TransformVolume=1]="TransformVolume",t[t.AnimationVolume=2]="AnimationVolume",t[t.InitialVolume=4]="InitialVolume"}(Ms||(Ms={})),function(t){t[t.WorldVolume=1]="WorldVolume"}(Ss||(Ss={}));class vs{constructor(t=.01,e=!0){this.zSpacing=t,this.useClipping=e}}class ks{constructor(t=1,e=!0,s=null,r="default"){this.scale=t,this.loop=e,this.animationName=s,this.skinName=r}}class Is extends e.ReferResource{get skeletonData(){return this._skeletonData}constructor(t,e){super(t),this.textures=[],this._skeletonData=e,this._associationTextureInSkeletonData(e)}_onDestroy(){super._onDestroy();const{textures:t,_skeletonData:e}=this;t&&this._disassociationSuperResource(t),this._clearAttachmentTextures(e),ys._animationDataCache.delete(e),this._skeletonData=null}_disassociationSuperResource(t){for(let e=0,s=t.length;e<s;e++)t[e]._disassociationSuperResource(this)}_associationTextureInSkeletonData(t){const{skins:e}=t;e.forEach((t=>{const{attachments:e}=t;e.forEach((t=>{const e=Object.values(t)[0],s=e?.region?.texture.texture;s&&!this.textures.find((t=>t.instanceId===s.instanceId))&&(this.textures.push(s),s._associationSuperResource(this))}))}))}_clearAttachmentTextures(t){const{skins:e}=t;e.forEach((t=>{const{attachments:e}=t;e.forEach((t=>{const e=Object.values(t)[0];e?.region?.texture&&(e.region.texture.texture=null)}))}))}}class As{constructor(t,e=0,s){this.data=t,this._dataView=new DataView(t.buffer,t.byteOffset+e,s??t.byteLength-e),this._position=0}nextUint16(){const t=this._dataView.getUint16(this._position,!0);return this._position+=2,t}nextStr(){const t=this.nextUint16(),e=new Uint8Array(this.data.buffer,this._position+this._dataView.byteOffset,t);return this._position+=t,this.decodeText(e)}nextImageData(){return new Uint8Array(this.data.buffer,this.data.byteOffset+this._position)}decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let s=0,r=t.length;s<r;s++)e+=String.fromCharCode(t[s]);return decodeURIComponent(encodeURIComponent(e))}}class Ts extends e.Loader{static{this.imageExtensions=["png","jpg","webp","jpeg","ktx","ktx2"]}static{this.skeletonExtensions=["skel","json","bin"]}static parseAndAssignSpineAsset(t,e,s){const{imageExtensions:r,skeletonExtensions:i}=Ts,n=Ts.getUrlExtension(t,e);n&&(i.includes(n)&&(s.skeletonPath=t,s.skeletonExtension=n),"atlas"===n&&(s.atlasPath=t),r.includes(n)&&(s.imagePaths.push(t),s.imageExtensions.push(n)))}static deriveAndAssignSpineAsset(t,e,s){const r=Ts.getUrlExtension(t,e);if(!r)return;s.skeletonPath=t,s.skeletonExtension=r;const i=/(\.(json|bin|skel))$/;let n;if(i.test(t)&&(n=t.replace(i,"")),n){const t=n+".atlas";s.atlasPath=t}}static verifyFileExtensions(t,e){return t?e&&!Array.isArray(t)?(console.error("Expect fileExtensions to be an array."),[]):e||"string"==typeof t?t:(console.error("Expect fileExtensions to be a string."),null):null}static getUrlExtension(t,e){if(e)return e;const s=t.match(/\/([^\/?#]+)\.([a-zA-Z0-9]+)(\?|#|$)|\?[^#]*\.([a-zA-Z0-9]+)(\?|#|$)/);return s?s[2]||s[4]:null}load(t,s){return new e.AssetPromise((async e=>{let r;if(t.urls)r=await this._handleOriginAsset(t,s);else{const e=await this.request(t.url,{type:"arraybuffer"}),i=new As(new Uint8Array(e)),n=i.nextStr();r=n.startsWith("spine")?await this._handleEditorAsset(e,i,n,s):await this._handleOriginAsset(t,s,e)}e(r)}))}async _handleEditorAsset(t,e,s,r){let i,n;const a=s.startsWith("spine:skel")?"skel":"json",{engine:o}=r;if("skel"===a)n=e.nextStr(),i=e.nextImageData();else{const e=new TextDecoder("utf-8").decode(new Uint8Array(t)),{data:s,atlas:r}=JSON.parse(e);n=r.refId,i=s}const l=Ze(await r.getResourceByRef({refId:n}),i,a);return new Is(o,l)}async _handleOriginAsset(t,e,s){let{fileExtensions:r}=t.params||{},i={skeletonPath:"",skeletonExtension:"",atlasPath:"",imagePaths:[],imageExtensions:[]};const{engine:n}=e;if(s){const e=Ts.verifyFileExtensions(r,!1);Ts.deriveAndAssignSpineAsset(t.url,e,i);const{skeletonPath:a,atlasPath:o}=i;if(!a||!o)throw new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included.");const l=await es(o,n),{data:h,type:c}=this._determineSkeletonDataType(s),d=Ze(l,h,c);return new Is(n,d)}{r=Ts.verifyFileExtensions(r,!0);for(let e=0;e<t.urls.length;e+=1){const s=t.urls[e],n=r&&r[e]||null;Ts.parseAndAssignSpineAsset(s,n,i)}const{skeletonPath:e,atlasPath:s,imagePaths:a,skeletonExtension:o,imageExtensions:l}=i;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(a.length>0){let t,e;u=u.concat([this.request(s,{type:"text"}),ts(a,l,n)]),[d,t,e]=await Promise.all(u),c=ss(t,e)}else u.push(es(s,n)),[d,c]=await Promise.all(u);const p=Ze(c,d,h);return new Is(n,p)}}_determineSkeletonDataType(t){let e,s;try{const r=new TextDecoder("utf-8").decode(t);JSON.parse(r),e=r,s="json"}catch(r){e=t,s="skel"}return{data:e,type:s}}}Ts=r([e.resourceLoader("spine",["json","bin","skel"])],Ts);class Bs extends e.Loader{load(t,s){return new e.AssetPromise((async e=>{const r=await this.request(t.url,{type:"text"}),{data:i,textures:n}=JSON.parse(r),a=n.map((t=>s.getResourceByRef({refId:t.refId})));e(ss(i,await Promise.all(a)))}))}}Bs=r([e.resourceLoader("EditorSpineAtlas",["atlas"])],Bs);const Cs="4.2.0-beta.0";e.Loader.registerClass("SpineAnimationRenderer",ys),console.log(`Galacean spine version: ${Cs}`),exports.AlphaTimeline=V,exports.Animation=g,exports.AnimationState=nt,exports.AnimationStateAdapter=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},exports.AnimationStateData=gt,exports.AssetManagerBase=class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(t,e="",s=new qt){this.textureLoader=t,this.pathPrefix=e,this.downloader=s}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.assets[e]=s,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise(((t,e)=>{let r=()=>{this.isLoadingComplete()?this.hasErrors()?e(this.errors):t(this):s.requestAnimationFrame(r)};s.requestAnimationFrame(r)}))}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,r)=>{this.error(s,t,`Couldn't load binary ${t}: status ${e}, ${r}`)}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,(s=>{this.success(e,t,s)}),((e,r)=>{this.error(s,t,`Couldn't load text ${t}: status ${e}, ${r}`)}))}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadJson(t,(s=>{this.success(e,t,s)}),((e,r)=>{this.error(s,t,`Couldn't load JSON ${t}: status ${e}, ${r}`)}))}loadTexture(t,e=()=>{},r=()=>{}){if(t=this.start(t),!!(void 0===s.window||void 0===s.navigator||!s.window.document))fetch(t,{mode:"cors"}).then((e=>e.ok?e.blob():(this.error(r,t,`Couldn't load image: ${t}`),null))).then((t=>t?createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null)).then((s=>{s&&this.success(e,t,this.textureLoader(s))}));else{let i=new s.Image;i.crossOrigin="anonymous",i.onload=()=>{this.success(e,t,this.textureLoader(i))},i.onerror=()=>{this.error(r,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),i.src=t}}loadTextureAtlas(t,e=()=>{},s=()=>{},r){let i=t.lastIndexOf("/"),n=i>=0?t.substring(0,i+1):"";t=this.start(t),this.downloader.downloadText(t,(i=>{try{let a=new Ft(i),o=a.pages.length,l=!1;for(let i of a.pages)this.loadTexture(r?r[i.name]:n+i.name,((s,r)=>{l||(i.setTexture(r),0==--o&&this.success(e,t,a))}),((e,r)=>{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,r)=>{this.error(s,t,`Couldn't load texture atlas ${t}: status ${e}, ${r}`)}))}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}},exports.AtlasAttachmentLoader=Dt,exports.Attachment=u,exports.AttachmentTimeline=N,exports.BinaryInput=ae,exports.Bone=Nt,exports.BoneData=Ot,exports.BoundingBoxAttachment=xt,exports.CURRENT=ft,exports.ClippingAttachment=wt,exports.Color=n,exports.ConstraintData=Lt,exports.CurveTimeline=M,exports.CurveTimeline1=S,exports.CurveTimeline2=v,exports.DebugUtils=class{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},exports.DeformTimeline=L,exports.Downloader=qt,exports.DrawOrderTimeline=W,exports.Event=Wt,exports.EventData=Ut,exports.EventQueue=ot,exports.EventTimeline=q,exports.FIRST=ct,exports.FakeTexture=class extends bt{setFilters(t,e){}setWraps(t,e){}dispose(){}},exports.HOLD_FIRST=ut,exports.HOLD_MIX=pt,exports.HOLD_SUBSEQUENT=dt,exports.IkConstraint=zt,exports.IkConstraintData=Gt,exports.IkConstraintTimeline=U,exports.InheritTimeline=P,exports.IntSet=class{array=new Array;add(t){let e=this.contains(t);return this.array[0|t]=0|t,!e}contains(t){return null!=this.array[0|t]}remove(t){this.array[0|t]=void 0}clear(){this.array.length=0}},exports.Interpolation=o,exports.MathUtils=a,exports.MeshAttachment=Pt,exports.PathAttachment=Xt,exports.PathConstraint=jt,exports.PathConstraintData=$t,exports.PathConstraintMixTimeline=j,exports.PathConstraintPositionTimeline=G,exports.PathConstraintSpacingTimeline=$,exports.PhysicsConstraintDampingTimeline=Q,exports.PhysicsConstraintGravityTimeline=et,exports.PhysicsConstraintInertiaTimeline=J,exports.PhysicsConstraintMassTimeline=Z,exports.PhysicsConstraintMixTimeline=st,exports.PhysicsConstraintResetTimeline=rt,exports.PhysicsConstraintStrengthTimeline=K,exports.PhysicsConstraintTimeline=H,exports.PhysicsConstraintWindTimeline=tt,exports.PointAttachment=_t,exports.Pool=c,exports.Pow=l,exports.PowOut=class extends l{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},exports.RGB2Timeline=O,exports.RGBA2Timeline=D,exports.RGBATimeline=X,exports.RGBTimeline=_,exports.RegionAttachment=Vt,exports.RotateTimeline=k,exports.SETUP=mt,exports.SUBSEQUENT=ht,exports.ScaleTimeline=B,exports.ScaleXTimeline=C,exports.ScaleYTimeline=F,exports.SequenceTimeline=it,exports.ShearTimeline=E,exports.ShearXTimeline=R,exports.ShearYTimeline=Y,exports.Skeleton=Qt,exports.SkeletonBinary=ne,exports.SkeletonBounds=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new c((()=>h.newFloatArray(16)));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,r=this.polygons,i=this.polygonPool,n=t.slots,a=n.length;s.length=0,i.freeAll(r),r.length=0;for(let t=0;t<a;t++){let e=n[t];if(!e.bone.active)continue;let a=e.getAttachment();if(a instanceof xt){let t=a;s.push(t);let n=i.obtain();n.length!=t.worldVerticesLength&&(n=h.newFloatArray(t.worldVerticesLength)),r.push(n),t.computeWorldVertices(e,0,t.worldVerticesLength,n,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,r=Number.NEGATIVE_INFINITY,i=this.polygons;for(let n=0,a=i.length;n<a;n++){let a=i[n],o=a;for(let i=0,n=a.length;i<n;i+=2){let n=o[i],a=o[i+1];t=Math.min(t,n),e=Math.min(e,a),s=Math.max(s,n),r=Math.max(r,a)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=r}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,r){let i=this.minX,n=this.minY,a=this.maxX,o=this.maxY;if(t<=i&&s<=i||e<=n&&r<=n||t>=a&&s>=a||e>=o&&r>=o)return!1;let l=(r-e)/(s-t),h=l*(i-t)+e;if(h>n&&h<o)return!0;if(h=l*(a-t)+e,h>n&&h<o)return!0;let c=(n-e)/l+t;return c>i&&c<a||(c=(o-e)/l+t,c>i&&c<a)}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 r=0,i=s.length;r<i;r++)if(this.containsPointPolygon(s[r],t,e))return this.boundingBoxes[r];return null}containsPointPolygon(t,e,s){let r=t,i=t.length,n=i-2,a=!1;for(let t=0;t<i;t+=2){let i=r[t+1],o=r[n+1];if(i<s&&o>=s||o<s&&i>=s){let l=r[t];l+(s-i)/(o-i)*(r[n]-l)<e&&(a=!a)}n=t}return a}intersectsSegment(t,e,s,r){let i=this.polygons;for(let n=0,a=i.length;n<a;n++)if(this.intersectsSegmentPolygon(i[n],t,e,s,r))return this.boundingBoxes[n];return null}intersectsSegmentPolygon(t,e,s,r,i){let n=t,a=t.length,o=e-r,l=s-i,h=e*i-s*r,c=n[a-2],d=n[a-1];for(let t=0;t<a;t+=2){let a=n[t],u=n[t+1],p=c*u-d*a,m=c-a,f=d-u,g=o*f-l*m,x=(h*m-o*p)/g;if((x>=c&&x<=a||x>=a&&x<=c)&&(x>=e&&x<=r||x>=r&&x<=e)){let t=(h*f-l*p)/g;if((t>=d&&t<=u||t>=u&&t<=d)&&(t>=s&&t<=i||t>=i&&t<=s))return!0}c=a,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}},exports.SkeletonClipping=ze,exports.SkeletonData=te,exports.SkeletonDataResource=Is,exports.SkeletonJson=Ge,exports.Skin=se,exports.SkinEntry=ee,exports.Slot=Jt,exports.SlotData=re,exports.SpineAnimationRenderer=ys,exports.StringSet=i,exports.Texture=bt,exports.TextureAtlas=Ft,exports.TextureAtlasPage=Rt,exports.TextureAtlasRegion=Yt,exports.TextureRegion=Ct,exports.TimeKeeper=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},exports.Timeline=y,exports.TrackEntry=at,exports.TransformConstraint=Kt,exports.TransformConstraintData=ie,exports.TransformConstraintTimeline=z,exports.TranslateTimeline=I,exports.TranslateXTimeline=A,exports.TranslateYTimeline=T,exports.Triangulator=Ue,exports.Utils=h,exports.Vector2=d,exports.VertexAttachment=p,exports.WindowedMean=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}},exports.createTextureAtlas=ss,exports.version=Cs;