@vgai/editor 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/dist/assets/{axe-BJjvBeOZ.js → axe-N4cNyzfs.js} +1 -1
  2. package/dist/assets/{browserAll-Dn0pgD87.js → browserAll-BIBT0Z2H.js} +1 -1
  3. package/dist/assets/{create-runtime-BF9OD-U8.js → create-runtime-DxLhdk4U.js} +1 -1
  4. package/dist/assets/{game-u6c2Patu.js → game-4NbNRROm.js} +1 -1
  5. package/dist/assets/{game-umrHIqFB.js → game-B3UH5LjS.js} +1 -1
  6. package/dist/assets/{game-BR0GBNgF.js → game-ByxRLJi1.js} +1 -1
  7. package/dist/assets/{game-DeTGdgYt.js → game-CJ5BqOYG.js} +1 -1
  8. package/dist/assets/{game-DQxhCYsZ.js → game-CSJm1kwB.js} +1 -1
  9. package/dist/assets/{game-CLNm2g0y.js → game-D9Mo4L3Q.js} +1 -1
  10. package/dist/assets/{game-B346oj_f.js → game-DJmU9BQF.js} +1 -1
  11. package/dist/assets/{game-BCNN63uV.js → game-ZqGLgxRj.js} +1 -1
  12. package/dist/assets/{game-loop-t5W_oqxz.js → game-loop-9YP76JB1.js} +1 -1
  13. package/dist/assets/{game-source-DzE9taML.js → game-source-DLKG9pmj.js} +1 -1
  14. package/dist/assets/{index-DbQzGLxv.js → index-8A4JLNIp.js} +902 -892
  15. package/dist/assets/{index-CgcH1RpF.js → index-Brzr17q0.js} +1 -1
  16. package/dist/assets/{index-D3tcNB2T.js → index-CnKtvrru.js} +1 -1
  17. package/dist/assets/{index-Fc8Ezr20.js → index-D-WR11Jw.js} +1 -1
  18. package/dist/assets/index-DiUacMXR.css +1 -0
  19. package/dist/assets/{ingest-siblings-CW_xbvrF.js → ingest-siblings-Cmx39OBK.js} +1 -1
  20. package/dist/assets/{mount-manifest-DgUscyaD.js → mount-manifest-kzdZgkkc.js} +1 -1
  21. package/dist/assets/{react-18-C4tVCii_.js → react-18-DvWsdwa_.js} +1 -1
  22. package/dist/assets/webworkerAll-C9GR-KrR.js +1 -0
  23. package/dist/assets/{world-documents-BSaA5YIF.js → world-documents-DM_aIMAW.js} +1 -1
  24. package/dist/index.html +2 -2
  25. package/dist-server/packaged.mjs +27125 -1075
  26. package/package.json +2 -2
  27. package/server/asset-history-snapshots.ts +189 -0
  28. package/server/asset-library-routes.ts +404 -53
  29. package/server/catalog-import-recipe.ts +97 -0
  30. package/server/catalog-reimport.ts +141 -0
  31. package/server/cloud-asset-catalog.ts +71 -5
  32. package/server/dev.ts +1 -1
  33. package/server/editor-server.ts +106 -51
  34. package/server/editor-sse.ts +5 -0
  35. package/server/generative-execution-context.ts +45 -0
  36. package/server/model-import-conversion.ts +345 -0
  37. package/server/packaged.ts +1 -1
  38. package/server/project-hmr-files.ts +3 -5
  39. package/server/project-output-writer.ts +440 -36
  40. package/server/project-tools.ts +529 -0
  41. package/server/server-utils.ts +14 -11
  42. package/src/EditorContext.tsx +4 -4
  43. package/src/action-registry.ts +12 -0
  44. package/src/asset-editor-context.tsx +9 -0
  45. package/src/asset-events.ts +3 -15
  46. package/src/asset-selection.ts +3 -0
  47. package/src/asset-workflow/asset-capabilities.ts +40 -0
  48. package/src/asset-workflow/asset-import-jobs.ts +108 -0
  49. package/src/asset-workflow/asset-library-query.ts +8 -1
  50. package/src/asset-workflow/asset-workflow-quality.ts +2 -0
  51. package/src/asset-workflow/import-contract.ts +2 -0
  52. package/src/asset-workflow/model-inspection.ts +92 -1
  53. package/src/asset-workflow/preview-resource-lifetime.ts +44 -0
  54. package/src/asset-workflow/project-asset-commands.ts +1 -0
  55. package/src/asset-workflow/project-asset-health.ts +3 -6
  56. package/src/asset-workflow/project-asset-operations.ts +119 -4
  57. package/src/command-listener.ts +37 -9
  58. package/src/components/ApplicationMenus.tsx +13 -15
  59. package/src/components/AssetBrowser.tsx +301 -26
  60. package/src/components/AssetImportDetails.tsx +207 -92
  61. package/src/components/AssetImportJobStatus.tsx +55 -0
  62. package/src/components/CenterDocuments.tsx +28 -1
  63. package/src/components/CommandPalette.tsx +2 -2
  64. package/src/components/DefaultEditorLayout.tsx +4 -0
  65. package/src/components/InspectorToolSection.tsx +12 -10
  66. package/src/components/OnlineAssetBrowser.tsx +197 -11
  67. package/src/components/ToolHost.tsx +8 -8
  68. package/src/components/ViewportOverlay.tsx +13 -26
  69. package/src/components/ViewportPanel.tsx +19 -14
  70. package/src/components/ViewportShadingMenu.tsx +103 -0
  71. package/src/components/WorkspaceDock.tsx +103 -17
  72. package/src/components/asset-documents.tsx +38 -11
  73. package/src/components/asset-editor-persistence.ts +300 -5
  74. package/src/components/asset-selection-section.tsx +83 -9
  75. package/src/components/asset-viewers/AudioViewer.tsx +4 -7
  76. package/src/components/asset-viewers/ModelViewer.tsx +168 -5
  77. package/src/components/asset-viewers/OnlineAssetDetail.tsx +52 -12
  78. package/src/components/asset-viewers/SourceAssetViewer.tsx +7 -26
  79. package/src/components/asset-workflow.css +30 -3
  80. package/src/components/primitives/editor-icons.ts +1 -0
  81. package/src/components/project-tool-documents.tsx +298 -0
  82. package/src/components/status-contributions.tsx +38 -0
  83. package/src/components/tool-documents.tsx +20 -17
  84. package/src/components/tool-schema-form.tsx +258 -0
  85. package/src/components/workspace-dock.css +16 -0
  86. package/src/editor-api.ts +159 -22
  87. package/src/editor-store.ts +6 -5
  88. package/src/editor-viewport.ts +12 -7
  89. package/src/game-viewport-state.ts +28 -0
  90. package/src/model-thumbnail.ts +97 -9
  91. package/src/play-mode.ts +30 -3
  92. package/src/project-tool-discovery.ts +5 -5
  93. package/src/{project-operations.ts → project-tools.ts} +39 -26
  94. package/src/scene-sync.ts +0 -67
  95. package/src/storage/handle-storage.ts +5 -1
  96. package/src/storage/http-storage.ts +7 -2
  97. package/src/storage/mem-storage.ts +7 -1
  98. package/src/storage/types.ts +2 -0
  99. package/src/theme-css.ts +17 -7
  100. package/src/tool-loader.ts +152 -241
  101. package/src/viewport-shading-boundary.ts +15 -0
  102. package/src/widgets/index.ts +2 -1
  103. package/src/workspace-dock-controller.ts +8 -0
  104. package/src/workspace-document-registry.ts +4 -4
  105. package/src/workspace-state-persistence.ts +36 -10
  106. package/template/.claude/skills/editor/SKILL.md +13 -3
  107. package/template/AGENTS.md +100 -83
  108. package/template/package.json +16 -0
  109. package/template/public/scenes/default.vscn.json +1 -2
  110. package/template/scripts/playtest.ts +7 -37
  111. package/template/server/rooms/game-room.ts +2 -2
  112. package/template/src/data/README.md +3 -2
  113. package/template/src/data/tuning.data.json +1 -3
  114. package/template/src/data/tuning.schema.json +0 -12
  115. package/template/src/data/tuning.schema.ts +2 -9
  116. package/template/src/data/tuning.ts +1 -1
  117. package/template/src/scripts/registry.ts +0 -3
  118. package/template/src/tools/README.md +151 -16
  119. package/template/src/tools/autoplay.tool.ts +31 -0
  120. package/template/src/tools/autoplay.ts +15 -0
  121. package/template/src/tools/tuning.document.tsx +107 -0
  122. package/template/src/tools/tuning.tool.ts +24 -0
  123. package/template/src/tools/tuning.ts +9 -0
  124. package/template/src/ui/Button.stories.tsx +1 -1
  125. package/template/tests/acceptance/example.spec.ts +4 -59
  126. package/template/vgai.game.json +1 -1
  127. package/dist/assets/index-bAGhEnnO.css +0 -1
  128. package/dist/assets/webworkerAll-BA4aq7xq.js +0 -1
  129. package/dist/project-scripts.bundle.js +0 -3917
  130. package/server/project-operations.ts +0 -343
  131. package/src/components/project-operation-documents.tsx +0 -226
  132. package/template/src/operations/README.md +0 -88
  133. package/template/src/scripts/components/data-spinner.ts +0 -86
  134. package/template/src/scripts/components/spin-lap-math.ts +0 -27
  135. package/template/src/tools/example.tool.tsx +0 -97
  136. package/template/src/tools/spin.tool.tsx +0 -101
  137. package/template/tests/logic/example.test.ts +0 -31
@@ -1,4 +1,4 @@
1
- import{a2 as Ve,bq as Oe,br as Mt,ag as oe,bo as Qt,bz as Ye,bA as Fs,bB as Nt,bn as _e,bC as Xs,bD as Ps,bE as Fe,bF as Zt,bG as Rs,bH as Bs,bI as Es,bJ as Ls,bK as Ds,bL as Ns,bM as Vs,bN as Os,bO as _s,bP as Ws,bQ as Us,bx as qs,bR as zs,bm as te,bS as Gs,_ as se,bT as ue,bU as Xe,Z as ct,a0 as $s}from"./index-DbQzGLxv.js";if(typeof window<"u"&&window.PIXI){const C=window.require;window.require=t=>{if(C)return C(t);if(t.startsWith("@pixi/")||t.startsWith("pixi.js"))return window.PIXI}}class ar{array=new Array;add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}}class We{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}class V{r;g;b;a;static WHITE=new V(1,1,1,1);static RED=new V(1,0,0,1);static GREEN=new V(0,1,0,1);static BLUE=new V(0,0,1,1);static MAGENTA=new V(1,0,1,1);constructor(t=0,e=0,s=0,i=0){this.r=t,this.g=e,this.b=s,this.a=i}set(t,e,s,i){return this.r=t,this.g=e,this.b=s,this.a=i,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t=t.charAt(0)=="#"?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=t.length!=8?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,i){return this.r+=t,this.g+=e,this.b+=s,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,e){t.r=((e&4278190080)>>>24)/255,t.g=((e&16711680)>>>16)/255,t.b=((e&65280)>>>8)/255,t.a=(e&255)/255}static rgb888ToColor(t,e){t.r=((e&16711680)>>>16)/255,t.g=((e&65280)>>>8)/255,t.b=(e&255)/255}toRgb888(){const t=e=>("0"+(e*255).toString(16)).slice(-2);return+("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t,e=new V){return e.setFromString(t)}}class B{static PI=3.1415927;static PI2=B.PI*2;static invPI2=1/B.PI2;static radiansToDegrees=180/B.PI;static radDeg=B.radiansToDegrees;static degreesToRadians=B.PI/180;static degRad=B.degreesToRadians;static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*B.degRad)}static sinDeg(t){return Math.sin(t*B.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*B.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),.3333333333333333);return t<0?-e:e}static randomTriangular(t,e){return B.randomTriangularWith(t,e,(t+e)*.5)}static randomTriangularWith(t,e,s){let i=Math.random(),n=e-t;return i<=(s-t)/n?t+Math.sqrt(i*n*(s-t)):e-Math.sqrt((1-i)*n*(e-s))}static isPowerOfTwo(t){return t&&(t&t-1)===0}}class Hs{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class js extends Hs{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}}class or extends js{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}class E{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,e,s,i,n){for(let h=e,a=i;h<e+n;h++,a++)s[a]=t[h]}static arrayFill(t,e,s,i){for(let n=e;n<s;n++)t[n]=i}static setArraySize(t,e,s=0){let i=t.length;if(i==e)return t;if(t.length=e,i<e)for(let n=i;n<e;n++)t[n]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:E.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e;return s}static newFloatArray(t){if(E.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let e=new Array(t);for(let s=0;s<e.length;s++)e[s]=0;return e}}static newShortArray(t){if(E.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let e=new Array(t);for(let s=0;s<e.length;s++)e[s]=0;return e}}static toFloatArray(t){return E.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return E.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var i=0;i<t.length;i++)if(t[i]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}}class lr{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}}class $t{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 ie{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 t!=0&&(this.x/=t,this.y/=t),this}}class hr{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}}class cr{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}}class Ue{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}class pt extends Ue{static nextID=0;id=pt.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,e,s,i,n,h){s=n+(s>>1)*h;let a=t.bone.skeleton,r=t.deform,o=this.vertices,l=this.bones;if(!l){r.length>0&&(o=r);let f=t.bone,m=f.worldX,g=f.worldY,w=f.a,b=f.b,p=f.c,x=f.d;for(let y=e,v=n;v<s;y+=2,v+=h){let A=o[y],k=o[y+1];i[v]=A*w+k*b+m,i[v+1]=A*p+k*x+g}return}let c=0,d=0;for(let f=0;f<e;f+=2){let m=l[c];c+=m+1,d+=m}let u=a.bones;if(r.length==0)for(let f=n,m=d*3;f<s;f+=h){let g=0,w=0,b=l[c++];for(b+=c;c<b;c++,m+=3){let p=u[l[c]],x=o[m],y=o[m+1],v=o[m+2];g+=(x*p.a+y*p.b+p.worldX)*v,w+=(x*p.c+y*p.d+p.worldY)*v}i[f]=g,i[f+1]=w}else{let f=r;for(let m=n,g=d*3,w=d<<1;m<s;m+=h){let b=0,p=0,x=l[c++];for(x+=c;c<x;c++,g+=3,w+=2){let y=u[l[c]],v=o[g]+f[w],A=o[g+1]+f[w+1],k=o[g+2];b+=(v*y.a+A*y.b+y.worldX)*k,p+=(v*y.c+A*y.d+y.worldY)*k}i[m]=b,i[m+1]=p}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),E.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=E.newFloatArray(this.vertices.length),E.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}}class Vt{static _nextID=0;id=Vt.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new Vt(this.regions.length);return E.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;s==-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let i=this.regions[s];e.region!=i&&(e.region=i,e.updateRegion())}getPath(t,e){let s=t,i=(this.start+e).toString();for(let n=this.digits-i.length;n>0;n--)s+="0";return s+=i,s}static nextID(){return Vt._nextID++}}var et;(function(C){C[C.hold=0]="hold",C[C.once=1]="once",C[C.loop=2]="loop",C[C.pingpong=3]="pingpong",C[C.onceReverse=4]="onceReverse",C[C.loopReverse=5]="loopReverse",C[C.pingpongReverse=6]="pingpongReverse"})(et||(et={}));const qe=[et.hold,et.once,et.loop,et.pingpong,et.onceReverse,et.loopReverse,et.pingpongReverse];class ye{name;timelines=[];timelineIds=new We;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,n,h,a,r){if(!t)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));let o=this.timelines;for(let l=0,c=o.length;l<c;l++)o[l].apply(t,e,s,n,h,a,r)}}var P;(function(C){C[C.setup=0]="setup",C[C.first=1]="first",C[C.replace=2]="replace",C[C.add=3]="add"})(P||(P={}));var nt;(function(C){C[C.mixIn=0]="mixIn",C[C.mixOut=1]="mixOut"})(nt||(nt={}));const _={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 J{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=E.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){let i=t.length;for(let n=s;n<i;n+=s)if(t[n]>e)return n-s;return i-s}}class Ct extends J{curves;constructor(t,e,s){super(t,s),this.curves=E.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+t*18;if(this.curves.length>e){let s=E.newFloatArray(e);E.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,i,n,h,a,r,o,l,c){let d=this.curves,u=this.getFrameCount()+t*18;s==0&&(d[e]=2+u);let f=(i-h*2+r)*.03,m=(n-a*2+o)*.03,g=((h-r)*3-i+l)*.006,w=((a-o)*3-n+c)*.006,b=f*2+g,p=m*2+w,x=(h-i)*.3+f+g*.16666667,y=(a-n)*.3+m+w*.16666667,v=i+x,A=n+y;for(let k=u+18;u<k;u+=2)d[u]=v,d[u+1]=A,x+=b,y+=p,b+=g,p+=w,v+=x,A+=y}getBezierValue(t,e,s,i){let n=this.curves;if(n[i]>t){let o=this.frames[e],l=this.frames[e+s];return l+(t-o)/(n[i]-o)*(n[i+1]-l)}let h=i+18;for(i+=2;i<h;i+=2)if(n[i]>=t){let o=n[i-2],l=n[i-1];return l+(t-o)/(n[i]-o)*(n[i+1]-l)}e+=this.getFrameEntries();let a=n[h-2],r=n[h-1];return r+(t-a)/(this.frames[e]-a)*(this.frames[e+s]-r)}}class xt extends Ct{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 n=2;n<=s;n+=2)if(e[n]>t){s=n-2;break}let i=this.curves[s>>1];switch(i){case 0:let n=e[s],h=e[s+1];return h+(t-n)/(e[s+2]-n)*(e[s+2+1]-h);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}getRelativeValue(t,e,s,i,n){if(t<this.frames[0]){switch(s){case P.setup:return n;case P.first:return i+(n-i)*e}return i}let h=this.getCurveValue(t);switch(s){case P.setup:return n+h*e;case P.first:case P.replace:h+=n-i}return i+h*e}getAbsoluteValue(t,e,s,i,n){if(t<this.frames[0]){switch(s){case P.setup:return n;case P.first:return i+(n-i)*e}return i}let h=this.getCurveValue(t);return s==P.setup?n+(h-n)*e:i+(h-i)*e}getAbsoluteValue2(t,e,s,i,n,h){if(t<this.frames[0]){switch(s){case P.setup:return n;case P.first:return i+(n-i)*e}return i}return s==P.setup?n+(h-n)*e:i+(h-i)*e}getScaleValue(t,e,s,i,n,h){const a=this.frames;if(t<a[0]){switch(s){case P.setup:return h;case P.first:return n+(h-n)*e}return n}let r=this.getCurveValue(t)*h;if(e==1)return s==P.add?n+r-h:r;if(i==nt.mixOut)switch(s){case P.setup:return h+(Math.abs(r)*B.signum(h)-h)*e;case P.first:case P.replace:return n+(Math.abs(r)*B.signum(n)-n)*e}else{let o=0;switch(s){case P.setup:return o=Math.abs(h)*B.signum(r),o+(r-o)*e;case P.first:case P.replace:return o=Math.abs(n)*B.signum(r),o+(r-o)*e}}return n+(r-h)*e}}class ve extends Ct{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}}class re extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.rotation=this.getRelativeValue(s,n,h,r.rotation,r.data.rotation))}}class ze extends ve{boneIndex=0;constructor(t,e,s){super(t,e,_.x+"|"+s,_.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case P.setup:r.x=r.data.x,r.y=r.data.y;return;case P.first:r.x+=(r.data.x-r.x)*n,r.y+=(r.data.y-r.y)*n}return}let l=0,c=0,d=J.search(o,s,3),u=this.curves[d/3];switch(u){case 0:let f=o[d];l=o[d+1],c=o[d+2];let m=(s-f)/(o[d+3]-f);l+=(o[d+3+1]-l)*m,c+=(o[d+3+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(h){case P.setup:r.x=r.data.x+l*n,r.y=r.data.y+c*n;break;case P.first:case P.replace:r.x+=(r.data.x+l-r.x)*n,r.y+=(r.data.y+c-r.y)*n;break;case P.add:r.x+=l*n,r.y+=c*n}}}class Ge extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.x+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.x=this.getRelativeValue(s,n,h,r.x,r.data.x))}}class $e extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.y=this.getRelativeValue(s,n,h,r.y,r.data.y))}}class He extends ve{boneIndex=0;constructor(t,e,s){super(t,e,_.scaleX+"|"+s,_.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case P.setup:r.scaleX=r.data.scaleX,r.scaleY=r.data.scaleY;return;case P.first:r.scaleX+=(r.data.scaleX-r.scaleX)*n,r.scaleY+=(r.data.scaleY-r.scaleY)*n}return}let l,c,d=J.search(o,s,3),u=this.curves[d/3];switch(u){case 0:let f=o[d];l=o[d+1],c=o[d+2];let m=(s-f)/(o[d+3]-f);l+=(o[d+3+1]-l)*m,c+=(o[d+3+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}if(l*=r.data.scaleX,c*=r.data.scaleY,n==1)h==P.add?(r.scaleX+=l-r.data.scaleX,r.scaleY+=c-r.data.scaleY):(r.scaleX=l,r.scaleY=c);else{let f=0,m=0;if(a==nt.mixOut)switch(h){case P.setup:f=r.data.scaleX,m=r.data.scaleY,r.scaleX=f+(Math.abs(l)*B.signum(f)-f)*n,r.scaleY=m+(Math.abs(c)*B.signum(m)-m)*n;break;case P.first:case P.replace:f=r.scaleX,m=r.scaleY,r.scaleX=f+(Math.abs(l)*B.signum(f)-f)*n,r.scaleY=m+(Math.abs(c)*B.signum(m)-m)*n;break;case P.add:r.scaleX+=(l-r.data.scaleX)*n,r.scaleY+=(c-r.data.scaleY)*n}else switch(h){case P.setup:f=Math.abs(r.data.scaleX)*B.signum(l),m=Math.abs(r.data.scaleY)*B.signum(c),r.scaleX=f+(l-f)*n,r.scaleY=m+(c-m)*n;break;case P.first:case P.replace:f=Math.abs(r.scaleX)*B.signum(l),m=Math.abs(r.scaleY)*B.signum(c),r.scaleX=f+(l-f)*n,r.scaleY=m+(c-m)*n;break;case P.add:r.scaleX+=(l-r.data.scaleX)*n,r.scaleY+=(c-r.data.scaleY)*n}}}}class je extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.scaleX=this.getScaleValue(s,n,h,a,r.scaleX,r.data.scaleX))}}class Je extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.scaleY=this.getScaleValue(s,n,h,a,r.scaleY,r.data.scaleY))}}class Ke extends ve{boneIndex=0;constructor(t,e,s){super(t,e,_.shearX+"|"+s,_.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case P.setup:r.shearX=r.data.shearX,r.shearY=r.data.shearY;return;case P.first:r.shearX+=(r.data.shearX-r.shearX)*n,r.shearY+=(r.data.shearY-r.shearY)*n}return}let l=0,c=0,d=J.search(o,s,3),u=this.curves[d/3];switch(u){case 0:let f=o[d];l=o[d+1],c=o[d+2];let m=(s-f)/(o[d+3]-f);l+=(o[d+3+1]-l)*m,c+=(o[d+3+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(h){case P.setup:r.shearX=r.data.shearX+l*n,r.shearY=r.data.shearY+c*n;break;case P.first:case P.replace:r.shearX+=(r.data.shearX+l-r.shearX)*n,r.shearY+=(r.data.shearY+c-r.shearY)*n;break;case P.add:r.shearX+=l*n,r.shearY+=c*n}}}class Qe extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.shearX=this.getRelativeValue(s,n,h,r.shearX,r.data.shearX))}}class Ze extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.shearY=this.getRelativeValue(s,n,h,r.shearY,r.data.shearY))}}class ts extends J{boneIndex=0;constructor(t,e){super(t,[_.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,i,n,h,a){let r=t.bones[this.boneIndex];if(!r.active)return;if(a==nt.mixOut){h==P.setup&&(r.inherit=r.data.inherit);return}let o=this.frames;if(s<o[0]){(h==P.setup||h==P.first)&&(r.inherit=r.data.inherit);return}r.inherit=this.frames[J.search(o,s,2)+1]}}class es extends Ct{slotIndex=0;constructor(t,e,s){super(t,e,[_.rgb+"|"+s,_.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,n,h){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=h}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color;if(s<o[0]){let w=r.data.color;switch(h){case P.setup:l.setFromColor(w);return;case P.first:l.add((w.r-l.r)*n,(w.g-l.g)*n,(w.b-l.b)*n,(w.a-l.a)*n)}return}let c=0,d=0,u=0,f=0,m=J.search(o,s,5),g=this.curves[m/5];switch(g){case 0:let w=o[m];c=o[m+1],d=o[m+2],u=o[m+3],f=o[m+4];let b=(s-w)/(o[m+5]-w);c+=(o[m+5+1]-c)*b,d+=(o[m+5+2]-d)*b,u+=(o[m+5+3]-u)*b,f+=(o[m+5+4]-f)*b;break;case 1:c=o[m+1],d=o[m+2],u=o[m+3],f=o[m+4];break;default:c=this.getBezierValue(s,m,1,g-2),d=this.getBezierValue(s,m,2,g+18-2),u=this.getBezierValue(s,m,3,g+36-2),f=this.getBezierValue(s,m,4,g+54-2)}n==1?l.set(c,d,u,f):(h==P.setup&&l.setFromColor(r.data.color),l.add((c-l.r)*n,(d-l.g)*n,(u-l.b)*n,(f-l.a)*n))}}class ss extends Ct{slotIndex=0;constructor(t,e,s){super(t,e,[_.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color;if(s<o[0]){let g=r.data.color;switch(h){case P.setup:l.r=g.r,l.g=g.g,l.b=g.b;return;case P.first:l.r+=(g.r-l.r)*n,l.g+=(g.g-l.g)*n,l.b+=(g.b-l.b)*n}return}let c=0,d=0,u=0,f=J.search(o,s,4),m=this.curves[f>>2];switch(m){case 0:let g=o[f];c=o[f+1],d=o[f+2],u=o[f+3];let w=(s-g)/(o[f+4]-g);c+=(o[f+4+1]-c)*w,d+=(o[f+4+2]-d)*w,u+=(o[f+4+3]-u)*w;break;case 1:c=o[f+1],d=o[f+2],u=o[f+3];break;default:c=this.getBezierValue(s,f,1,m-2),d=this.getBezierValue(s,f,2,m+18-2),u=this.getBezierValue(s,f,3,m+36-2)}if(n==1)l.r=c,l.g=d,l.b=u;else{if(h==P.setup){let g=r.data.color;l.r=g.r,l.g=g.g,l.b=g.b}l.r+=(c-l.r)*n,l.g+=(d-l.g)*n,l.b+=(u-l.b)*n}}}class is extends xt{slotIndex=0;constructor(t,e,s){super(t,e,_.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=r.color;if(s<this.frames[0]){let c=r.data.color;switch(h){case P.setup:o.a=c.a;return;case P.first:o.a+=(c.a-o.a)*n}return}let l=this.getCurveValue(s);n==1?o.a=l:(h==P.setup&&(o.a=r.data.color.a),o.a+=(l-o.a)*n)}}class rs extends Ct{slotIndex=0;constructor(t,e,s){super(t,e,[_.rgb+"|"+s,_.alpha+"|"+s,_.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,n,h,a,r,o){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=h,this.frames[t+5]=a,this.frames[t+6]=r,this.frames[t+7]=o}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color,c=r.darkColor;if(s<o[0]){let y=r.data.color,v=r.data.darkColor;switch(h){case P.setup:l.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case P.first:l.add((y.r-l.r)*n,(y.g-l.g)*n,(y.b-l.b)*n,(y.a-l.a)*n),c.r+=(v.r-c.r)*n,c.g+=(v.g-c.g)*n,c.b+=(v.b-c.b)*n}return}let d=0,u=0,f=0,m=0,g=0,w=0,b=0,p=J.search(o,s,8),x=this.curves[p>>3];switch(x){case 0:let y=o[p];d=o[p+1],u=o[p+2],f=o[p+3],m=o[p+4],g=o[p+5],w=o[p+6],b=o[p+7];let v=(s-y)/(o[p+8]-y);d+=(o[p+8+1]-d)*v,u+=(o[p+8+2]-u)*v,f+=(o[p+8+3]-f)*v,m+=(o[p+8+4]-m)*v,g+=(o[p+8+5]-g)*v,w+=(o[p+8+6]-w)*v,b+=(o[p+8+7]-b)*v;break;case 1:d=o[p+1],u=o[p+2],f=o[p+3],m=o[p+4],g=o[p+5],w=o[p+6],b=o[p+7];break;default:d=this.getBezierValue(s,p,1,x-2),u=this.getBezierValue(s,p,2,x+18-2),f=this.getBezierValue(s,p,3,x+36-2),m=this.getBezierValue(s,p,4,x+54-2),g=this.getBezierValue(s,p,5,x+72-2),w=this.getBezierValue(s,p,6,x+90-2),b=this.getBezierValue(s,p,7,x+108-2)}if(n==1)l.set(d,u,f,m),c.r=g,c.g=w,c.b=b;else{if(h==P.setup){l.setFromColor(r.data.color);let y=r.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}l.add((d-l.r)*n,(u-l.g)*n,(f-l.b)*n,(m-l.a)*n),c.r+=(g-c.r)*n,c.g+=(w-c.g)*n,c.b+=(b-c.b)*n}}}class ns extends Ct{slotIndex=0;constructor(t,e,s){super(t,e,[_.rgb+"|"+s,_.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,h,a,r){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=h,this.frames[t+5]=a,this.frames[t+6]=r}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color,c=r.darkColor;if(s<o[0]){let x=r.data.color,y=r.data.darkColor;switch(h){case P.setup:l.r=x.r,l.g=x.g,l.b=x.b,c.r=y.r,c.g=y.g,c.b=y.b;return;case P.first:l.r+=(x.r-l.r)*n,l.g+=(x.g-l.g)*n,l.b+=(x.b-l.b)*n,c.r+=(y.r-c.r)*n,c.g+=(y.g-c.g)*n,c.b+=(y.b-c.b)*n}return}let d=0,u=0,f=0,m=0,g=0,w=0,b=J.search(o,s,7),p=this.curves[b/7];switch(p){case 0:let x=o[b];d=o[b+1],u=o[b+2],f=o[b+3],m=o[b+4],g=o[b+5],w=o[b+6];let y=(s-x)/(o[b+7]-x);d+=(o[b+7+1]-d)*y,u+=(o[b+7+2]-u)*y,f+=(o[b+7+3]-f)*y,m+=(o[b+7+4]-m)*y,g+=(o[b+7+5]-g)*y,w+=(o[b+7+6]-w)*y;break;case 1:d=o[b+1],u=o[b+2],f=o[b+3],m=o[b+4],g=o[b+5],w=o[b+6];break;default:d=this.getBezierValue(s,b,1,p-2),u=this.getBezierValue(s,b,2,p+18-2),f=this.getBezierValue(s,b,3,p+36-2),m=this.getBezierValue(s,b,4,p+54-2),g=this.getBezierValue(s,b,5,p+72-2),w=this.getBezierValue(s,b,6,p+90-2)}if(n==1)l.r=d,l.g=u,l.b=f,c.r=m,c.g=g,c.b=w;else{if(h==P.setup){let x=r.data.color,y=r.data.darkColor;l.r=x.r,l.g=x.g,l.b=x.b,c.r=y.r,c.g=y.g,c.b=y.b}l.r+=(d-l.r)*n,l.g+=(u-l.g)*n,l.b+=(f-l.b)*n,c.r+=(m-c.r)*n,c.g+=(g-c.g)*n,c.b+=(w-c.b)*n}}}class Dt extends J{slotIndex=0;attachmentNames;constructor(t,e){super(t,[_.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,i,n,h,a){let r=t.slots[this.slotIndex];if(r.bone.active){if(a==nt.mixOut){h==P.setup&&this.setAttachment(t,r,r.data.attachmentName);return}if(s<this.frames[0]){(h==P.setup||h==P.first)&&this.setAttachment(t,r,r.data.attachmentName);return}this.setAttachment(t,r,this.attachmentNames[J.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class as extends Ct{slotIndex=0;attachment;vertices;constructor(t,e,s,i){super(t,e,[_.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,n,h,a,r,o,l,c){let d=this.curves,u=this.getFrameCount()+t*18;s==0&&(d[e]=2+u);let f=(i-h*2+r)*.03,m=o*.03-a*.06,g=((h-r)*3-i+l)*.006,w=(a-o+.33333333)*.018,b=f*2+g,p=m*2+w,x=(h-i)*.3+f+g*.16666667,y=a*.3+m+w*.16666667,v=i+x,A=y;for(let k=u+18;u<k;u+=2)d[u]=v,d[u+1]=A,x+=b,y+=p,b+=g,p+=w,v+=x,A+=y}getCurvePercent(t,e){let s=this.curves,i=s[e];switch(i){case 0:let r=this.frames[e];return(t-r)/(this.frames[e+this.getFrameEntries()]-r);case 1:return 0}if(i-=2,s[i]>t){let r=this.frames[e];return s[i+1]*(t-r)/(s[i]-r)}let n=i+18;for(i+=2;i<n;i+=2)if(s[i]>=t){let r=s[i-2],o=s[i-1];return o+(t-r)/(s[i]-r)*(s[i+1]-o)}let h=s[n-2],a=s[n-1];return a+(1-a)*(t-h)/(this.frames[e+this.getFrameEntries()]-h)}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=r.getAttachment();if(!o||!(o instanceof pt)||o.timelineAttachment!=this.attachment)return;let l=r.deform;l.length==0&&(h=P.setup);let c=this.vertices,d=c[0].length,u=this.frames;if(s<u[0]){switch(h){case P.setup:l.length=0;return;case P.first:if(n==1){l.length=0;return}l.length=d;let p=o;if(p.bones){n=1-n;for(var f=0;f<d;f++)l[f]*=n}else{let x=p.vertices;for(var f=0;f<d;f++)l[f]+=(x[f]-l[f])*n}}return}if(l.length=d,s>=u[u.length-1]){let p=c[u.length-1];if(n==1)if(h==P.add){let x=o;if(x.bones)for(let y=0;y<d;y++)l[y]+=p[y];else{let y=x.vertices;for(let v=0;v<d;v++)l[v]+=p[v]-y[v]}}else E.arrayCopy(p,0,l,0,d);else switch(h){case P.setup:{let y=o;if(y.bones)for(let v=0;v<d;v++)l[v]=p[v]*n;else{let v=y.vertices;for(let A=0;A<d;A++){let k=v[A];l[A]=k+(p[A]-k)*n}}break}case P.first:case P.replace:for(let y=0;y<d;y++)l[y]+=(p[y]-l[y])*n;break;case P.add:let x=o;if(x.bones)for(let y=0;y<d;y++)l[y]+=p[y]*n;else{let y=x.vertices;for(let v=0;v<d;v++)l[v]+=(p[v]-y[v])*n}}return}let m=J.search1(u,s),g=this.getCurvePercent(s,m),w=c[m],b=c[m+1];if(n==1)if(h==P.add){let p=o;if(p.bones)for(let x=0;x<d;x++){let y=w[x];l[x]+=y+(b[x]-y)*g}else{let x=p.vertices;for(let y=0;y<d;y++){let v=w[y];l[y]+=v+(b[y]-v)*g-x[y]}}}else for(let p=0;p<d;p++){let x=w[p];l[p]=x+(b[p]-x)*g}else switch(h){case P.setup:{let x=o;if(x.bones)for(let y=0;y<d;y++){let v=w[y];l[y]=(v+(b[y]-v)*g)*n}else{let y=x.vertices;for(let v=0;v<d;v++){let A=w[v],k=y[v];l[v]=k+(A+(b[v]-A)*g-k)*n}}break}case P.first:case P.replace:for(let x=0;x<d;x++){let y=w[x];l[x]+=(y+(b[x]-y)*g-l[x])*n}break;case P.add:let p=o;if(p.bones)for(let x=0;x<d;x++){let y=w[x];l[x]+=(y+(b[x]-y)*g)*n}else{let x=p.vertices;for(let y=0;y<d;y++){let v=w[y];l[y]+=(v+(b[y]-v)*g-x[y])*n}}}}}class Ht extends J{static propertyIds=[""+_.event];events;constructor(t){super(t,Ht.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,i,n,h,a){if(!i)return;let r=this.frames,o=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,i,n,h,a),e=-1;else if(e>=r[o-1])return;if(s<r[0])return;let l=0;if(e<r[0])l=0;else{l=J.search1(r,e)+1;let c=r[l];for(;l>0&&r[l-1]==c;)l--}for(;l<o&&s>=r[l];l++)i.push(this.events[l])}}class Xt extends J{static propertyIds=[""+_.drawOrder];drawOrders;constructor(t){super(t,Xt.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,i,n,h,a){if(a==nt.mixOut){h==P.setup&&E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(s<this.frames[0]){(h==P.setup||h==P.first)&&E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let r=J.search1(this.frames,s),o=this.drawOrders[r];if(!o)E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let l=t.drawOrder,c=t.slots;for(let d=0,u=o.length;d<u;d++)l[d]=c[o[d]]}}}class os extends Ct{constraintIndex=0;constructor(t,e,s){super(t,e,[_.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,n,h,a){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=h?1:0,this.frames[t+5]=a?1:0}apply(t,e,s,i,n,h,a){let r=t.ikConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case P.setup:r.mix=r.data.mix,r.softness=r.data.softness,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch;return;case P.first:r.mix+=(r.data.mix-r.mix)*n,r.softness+=(r.data.softness-r.softness)*n,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch}return}let l=0,c=0,d=J.search(o,s,6),u=this.curves[d/6];switch(u){case 0:let f=o[d];l=o[d+1],c=o[d+2];let m=(s-f)/(o[d+6]-f);l+=(o[d+6+1]-l)*m,c+=(o[d+6+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}h==P.setup?(r.mix=r.data.mix+(l-r.data.mix)*n,r.softness=r.data.softness+(c-r.data.softness)*n,a==nt.mixOut?(r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch):(r.bendDirection=o[d+3],r.compress=o[d+4]!=0,r.stretch=o[d+5]!=0)):(r.mix+=(l-r.mix)*n,r.softness+=(c-r.softness)*n,a==nt.mixIn&&(r.bendDirection=o[d+3],r.compress=o[d+4]!=0,r.stretch=o[d+5]!=0))}}class ls extends Ct{constraintIndex=0;constructor(t,e,s){super(t,e,[_.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,h,a,r){let o=this.frames;t*=7,o[t]=e,o[t+1]=s,o[t+2]=i,o[t+3]=n,o[t+4]=h,o[t+5]=a,o[t+6]=r}apply(t,e,s,i,n,h,a){let r=t.transformConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){let b=r.data;switch(h){case P.setup:r.mixRotate=b.mixRotate,r.mixX=b.mixX,r.mixY=b.mixY,r.mixScaleX=b.mixScaleX,r.mixScaleY=b.mixScaleY,r.mixShearY=b.mixShearY;return;case P.first:r.mixRotate+=(b.mixRotate-r.mixRotate)*n,r.mixX+=(b.mixX-r.mixX)*n,r.mixY+=(b.mixY-r.mixY)*n,r.mixScaleX+=(b.mixScaleX-r.mixScaleX)*n,r.mixScaleY+=(b.mixScaleY-r.mixScaleY)*n,r.mixShearY+=(b.mixShearY-r.mixShearY)*n}return}let l,c,d,u,f,m,g=J.search(o,s,7),w=this.curves[g/7];switch(w){case 0:let b=o[g];l=o[g+1],c=o[g+2],d=o[g+3],u=o[g+4],f=o[g+5],m=o[g+6];let p=(s-b)/(o[g+7]-b);l+=(o[g+7+1]-l)*p,c+=(o[g+7+2]-c)*p,d+=(o[g+7+3]-d)*p,u+=(o[g+7+4]-u)*p,f+=(o[g+7+5]-f)*p,m+=(o[g+7+6]-m)*p;break;case 1:l=o[g+1],c=o[g+2],d=o[g+3],u=o[g+4],f=o[g+5],m=o[g+6];break;default:l=this.getBezierValue(s,g,1,w-2),c=this.getBezierValue(s,g,2,w+18-2),d=this.getBezierValue(s,g,3,w+36-2),u=this.getBezierValue(s,g,4,w+54-2),f=this.getBezierValue(s,g,5,w+72-2),m=this.getBezierValue(s,g,6,w+90-2)}if(h==P.setup){let b=r.data;r.mixRotate=b.mixRotate+(l-b.mixRotate)*n,r.mixX=b.mixX+(c-b.mixX)*n,r.mixY=b.mixY+(d-b.mixY)*n,r.mixScaleX=b.mixScaleX+(u-b.mixScaleX)*n,r.mixScaleY=b.mixScaleY+(f-b.mixScaleY)*n,r.mixShearY=b.mixShearY+(m-b.mixShearY)*n}else r.mixRotate+=(l-r.mixRotate)*n,r.mixX+=(c-r.mixX)*n,r.mixY+=(d-r.mixY)*n,r.mixScaleX+=(u-r.mixScaleX)*n,r.mixScaleY+=(f-r.mixScaleY)*n,r.mixShearY+=(m-r.mixShearY)*n}}class hs extends xt{constraintIndex=0;constructor(t,e,s){super(t,e,_.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,i,n,h,a){let r=t.pathConstraints[this.constraintIndex];r.active&&(r.position=this.getAbsoluteValue(s,n,h,r.position,r.data.position))}}class cs extends xt{constraintIndex=0;constructor(t,e,s){super(t,e,_.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,i,n,h,a){let r=t.pathConstraints[this.constraintIndex];r.active&&(r.spacing=this.getAbsoluteValue(s,n,h,r.spacing,r.data.spacing))}}class ds extends Ct{constraintIndex=0;constructor(t,e,s){super(t,e,[_.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){let h=this.frames;t<<=2,h[t]=e,h[t+1]=s,h[t+2]=i,h[t+3]=n}apply(t,e,s,i,n,h,a){let r=t.pathConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case P.setup:r.mixRotate=r.data.mixRotate,r.mixX=r.data.mixX,r.mixY=r.data.mixY;return;case P.first:r.mixRotate+=(r.data.mixRotate-r.mixRotate)*n,r.mixX+=(r.data.mixX-r.mixX)*n,r.mixY+=(r.data.mixY-r.mixY)*n}return}let l,c,d,u=J.search(o,s,4),f=this.curves[u>>2];switch(f){case 0:let m=o[u];l=o[u+1],c=o[u+2],d=o[u+3];let g=(s-m)/(o[u+4]-m);l+=(o[u+4+1]-l)*g,c+=(o[u+4+2]-c)*g,d+=(o[u+4+3]-d)*g;break;case 1:l=o[u+1],c=o[u+2],d=o[u+3];break;default:l=this.getBezierValue(s,u,1,f-2),c=this.getBezierValue(s,u,2,f+18-2),d=this.getBezierValue(s,u,3,f+36-2)}if(h==P.setup){let m=r.data;r.mixRotate=m.mixRotate+(l-m.mixRotate)*n,r.mixX=m.mixX+(c-m.mixX)*n,r.mixY=m.mixY+(d-m.mixY)*n}else r.mixRotate+=(l-r.mixRotate)*n,r.mixX+=(c-r.mixX)*n,r.mixY+=(d-r.mixY)*n}}class Bt extends xt{constraintIndex=0;constructor(t,e,s,i){super(t,e,i+"|"+s),this.constraintIndex=s}apply(t,e,s,i,n,h,a){let r;if(this.constraintIndex==-1){const o=s>=this.frames[0]?this.getCurveValue(s):0;for(const l of t.physicsConstraints)l.active&&this.global(l.data)&&this.set(l,this.getAbsoluteValue2(s,n,h,this.get(l),this.setup(l),o))}else r=t.physicsConstraints[this.constraintIndex],r.active&&this.set(r,this.getAbsoluteValue(s,n,h,this.get(r),this.setup(r)))}}class fs extends Bt{constructor(t,e,s){super(t,e,s,_.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}}class us extends Bt{constructor(t,e,s){super(t,e,s,_.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}}class ms extends Bt{constructor(t,e,s){super(t,e,s,_.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}}class gs extends Bt{constructor(t,e,s){super(t,e,s,_.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 ps extends Bt{constructor(t,e,s){super(t,e,s,_.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}}class xs extends Bt{constructor(t,e,s){super(t,e,s,_.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}}class bs extends Bt{constructor(t,e,s){super(t,e,s,_.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}}class le extends J{static propertyIds=[_.physicsConstraintReset.toString()];constraintIndex;constructor(t,e){super(t,le.propertyIds),this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,i,n,h,a){let r;if(this.constraintIndex!=-1&&(r=t.physicsConstraints[this.constraintIndex],!r.active))return;const o=this.frames;if(e>s)this.apply(t,e,Number.MAX_VALUE,[],n,h,a),e=-1;else if(e>=o[o.length-1])return;if(!(s<o[0])&&(e<o[0]||s>=o[J.search1(o,e)+1]))if(r!=null)r.reset();else for(const l of t.physicsConstraints)l.active&&l.reset()}}class yt extends J{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,e,s){super(t,[_.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return yt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,i,n){let h=this.frames;t*=yt.ENTRIES,h[t]=e,h[t+yt.MODE]=s|i<<4,h[t+yt.DELAY]=n}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=r.attachment,l=this.attachment;if(o!=l&&(!(o instanceof pt)||o.timelineAttachment!=l))return;if(a==nt.mixOut){h==P.setup&&(r.sequenceIndex=-1);return}let c=this.frames;if(s<c[0]){(h==P.setup||h==P.first)&&(r.sequenceIndex=-1);return}let d=J.search(c,s,yt.ENTRIES),u=c[d],f=c[d+yt.MODE],m=c[d+yt.DELAY];if(!this.attachment.sequence)return;let g=f>>4,w=this.attachment.sequence.regions.length,b=qe[f&15];if(b!=et.hold)switch(g+=(s-u)/m+1e-5|0,b){case et.once:g=Math.min(w-1,g);break;case et.loop:g%=w;break;case et.pingpong:{let p=(w<<1)-2;g=p==0?0:g%p,g>=w&&(g=p-g);break}case et.onceReverse:g=Math.max(w-1-g,0);break;case et.loopReverse:g=w-1-g%w;break;case et.pingpongReverse:{let p=(w<<1)-2;g=p==0?0:(g+w-1)%p,g>=w&&(g=p-g)}}r.sequenceIndex=g}}class Ot{static _emptyAnimation=new ye("<empty>",[],0);static emptyAnimation(){return Ot._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Ks(this);propertyIDs=new We;animationsChanged=!1;trackEntryPool=new $t(()=>new Js);constructor(t){this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,i=e.length;s<i;s++){let n=e[s];if(!n)continue;n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast;let h=t*n.timeScale;if(n.delay>0){if(n.delay-=h,n.delay>0)continue;h=-n.delay,n.delay=0}let a=n.next;if(a){let r=n.trackLast-a.delay;if(r>=0){for(a.delay=0,a.trackTime+=n.timeScale==0?0:(r/n.timeScale+t)*a.timeScale,n.trackTime+=h,this.setCurrent(s,a,!0);a.mixingFrom;)a.mixTime+=t,a=a.mixingFrom;continue}}else if(n.trackLast>=n.trackEnd&&!n.mixingFrom){e[s]=null,this.queue.end(n),this.clearNext(n);continue}if(n.mixingFrom&&this.updateMixingFrom(n,t)){let r=n.mixingFrom;for(n.mixingFrom=null,r&&(r.mixingTo=null);r;)this.queue.end(r),r=r.mixingFrom}n.trackTime+=h}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let i=this.updateMixingFrom(s,e);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,t.nextTrackLast!=-1&&t.mixTime>=t.mixDuration?((s.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=s.mixingFrom,s.mixingFrom!=null&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),i):(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,i=!1;for(let d=0,u=s.length;d<u;d++){let f=s[d];if(!f||f.delay>0)continue;i=!0;let m=d==0?P.first:f.mixBlend,g=f.alpha;f.mixingFrom?g*=this.applyMixingFrom(f,t,m):f.trackTime>=f.trackEnd&&!f.next&&(g=0);let w=g>=f.alphaAttachmentThreshold,b=f.animationLast,p=f.getAnimationTime(),x=p,y=e;f.reverse&&(x=f.animation.duration-x,y=null);let v=f.animation.timelines,A=v.length;if(d==0&&g==1||m==P.add){d==0&&(w=!0);for(let k=0;k<A;k++){E.webkit602BugfixHelper(g,m);var n=v[k];n instanceof Dt?this.applyAttachmentTimeline(n,t,x,m,w):n.apply(t,b,x,y,g,m,nt.mixIn)}}else{let k=f.timelineMode,I=f.shortestRotation,Y=!I&&f.timelinesRotation.length!=A<<1;Y&&(f.timelinesRotation.length=A<<1);for(let T=0;T<A;T++){let R=v[T],X=k[T]==me?m:P.setup;!I&&R instanceof re?this.applyRotateTimeline(R,t,x,g,X,f.timelinesRotation,T<<1,Y):R instanceof Dt?this.applyAttachmentTimeline(R,t,x,m,w):(E.webkit602BugfixHelper(g,m),R.apply(t,b,x,y,g,X,nt.mixIn))}}this.queueEvents(f,p),e.length=0,f.nextAnimationLast=p,f.nextTrackLast=f.trackTime}for(var h=this.unkeyedState+Be,a=t.slots,r=0,o=t.slots.length;r<o;r++){var l=a[r];if(l.attachmentState==h){var c=l.data.attachmentName;l.setAttachment(c?t.getAttachment(l.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(t,e,s){let i=t.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,e,s);let n=0;t.mixDuration==0?(n=1,s==P.first&&(s=P.setup)):(n=t.mixTime/t.mixDuration,n>1&&(n=1),s!=P.first&&(s=i.mixBlend));let h=n<i.mixAttachmentThreshold,a=n<i.mixDrawOrderThreshold,r=i.animation.timelines,o=r.length,l=i.alpha*t.interruptAlpha,c=l*(1-n),d=i.animationLast,u=i.getAnimationTime(),f=u,m=null;if(i.reverse?f=i.animation.duration-f:n<i.eventThreshold&&(m=this.events),s==P.add)for(let g=0;g<o;g++)r[g].apply(e,d,f,m,c,s,nt.mixOut);else{let g=i.timelineMode,w=i.timelineHoldMix,b=i.shortestRotation,p=!b&&i.timelinesRotation.length!=o<<1;p&&(i.timelinesRotation.length=o<<1),i.totalAlpha=0;for(let x=0;x<o;x++){let y=r[x],v=nt.mixOut,A,k=0;switch(g[x]){case me:if(!a&&y instanceof Xt)continue;A=s,k=c;break;case Pe:A=P.setup,k=c;break;case Re:A=s,k=l;break;case ge:A=P.setup,k=l;break;default:A=P.setup;let I=w[x];k=l*Math.max(0,1-I.mixTime/I.mixDuration);break}i.totalAlpha+=k,!b&&y instanceof re?this.applyRotateTimeline(y,e,f,k,A,i.timelinesRotation,x<<1,p):y instanceof Dt?this.applyAttachmentTimeline(y,e,f,A,h&&k>=i.alphaAttachmentThreshold):(E.webkit602BugfixHelper(k,s),a&&y instanceof Xt&&A==P.setup&&(v=nt.mixIn),y.apply(e,d,f,m,k,A,v))}}return t.mixDuration>0&&this.queueEvents(i,u),this.events.length=0,i.nextAnimationLast=u,i.nextTrackLast=i.trackTime,n}applyAttachmentTimeline(t,e,s,i,n){var h=e.slots[t.slotIndex];h.bone.active&&(s<t.frames[0]?(i==P.setup||i==P.first)&&this.setAttachment(e,h,h.data.attachmentName,n):this.setAttachment(e,h,t.attachmentNames[J.search1(t.frames,s)],n),h.attachmentState<=this.unkeyedState&&(h.attachmentState=this.unkeyedState+Be))}setAttachment(t,e,s,i){e.setAttachment(s?t.getAttachment(e.data.index,s):null),i&&(e.attachmentState=this.unkeyedState+Zs)}applyRotateTimeline(t,e,s,i,n,h,a,r){if(r&&(h[a]=0),i==1){t.apply(e,0,s,null,1,n,nt.mixIn);return}let o=e.bones[t.boneIndex];if(!o.active)return;let l=t.frames,c=0,d=0;if(s<l[0])switch(n){case P.setup:o.rotation=o.data.rotation;default:return;case P.first:c=o.rotation,d=o.data.rotation}else c=n==P.setup?o.data.rotation:o.rotation,d=o.data.rotation+t.getCurveValue(s);let u=0,f=d-c;if(f-=Math.ceil(f/360-.5)*360,f==0)u=h[a];else{let m=0,g=0;r?(m=0,g=f):(m=h[a],g=h[a+1]);let w=m-m%360;u=f+w;let b=f>=0,p=m>=0;Math.abs(g)<=90&&B.signum(g)!=B.signum(f)&&(Math.abs(m-w)>180?(u+=360*B.signum(m),p=b):w!=0?u-=360*B.signum(m):p=b),p!=b&&(u+=360*B.signum(m)),h[a]=u}h[a+1]=f,o.rotation=c+u*i}queueEvents(t,e){let s=t.animationStart,i=t.animationEnd,n=i-s,h=t.trackLast%n,a=this.events,r=0,o=a.length;for(;r<o;r++){let c=a[r];if(c.time<h)break;c.time>i||this.queue.event(t,c)}let l=!1;if(t.loop)if(n==0)l=!0;else{const c=Math.floor(t.trackTime/n);l=c>0&&c>Math.floor(t.trackLast/n)}else l=e>=i&&t.animationLast<i;for(l&&this.queue.complete(t);r<o;r++){let c=a[r];c.time<s||this.queue.event(t,c)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++)this.clearTrack(e);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 i=s.mixingFrom;if(!i)break;this.queue.end(i),s.mixingFrom=null,s.mixingTo=null,s=i}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,s){let i=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,i&&(s&&this.queue.interrupt(i),e.mixingFrom=i,i.mixingTo=e,e.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(e.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let i=this.data.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,i,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let i=!0,n=this.expandToIndex(t);n&&(n.nextTrackLast==-1?(this.tracks[t]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,i=!1):this.clearNext(n));let h=this.trackEntry(t,e,s,n);return this.setCurrent(t,h,i),this.queue.drain(),h}addAnimation(t,e,s=!1,i=0){let n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,n,s,i)}addAnimationWith(t,e,s=!1,i=0){if(!e)throw new Error("animation cannot be null.");let n=this.expandToIndex(t);if(n)for(;n.next;)n=n.next;let h=this.trackEntry(t,e,s,n);return n?(n.next=h,h.previous=n,i<=0&&(i=Math.max(i+n.getTrackComplete()-h.mixDuration,0))):(this.setCurrent(t,h,!0),this.queue.drain(),i<0&&(i=0)),h.delay=i,h}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,Ot.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let i=this.addAnimationWith(t,Ot.emptyAnimation(),!1,s);return s<=0&&(i.delay=Math.max(i.delay+i.mixDuration-e,0)),i.mixDuration=e,i.trackEnd=e,i}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++){let n=this.tracks[s];n&&this.setEmptyAnimation(n.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(E.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,s,i){let n=this.trackEntryPool.obtain();return n.reset(),n.trackIndex=t,n.animation=e,n.loop=s,n.holdPrevious=!1,n.reverse=!1,n.shortestRotation=!1,n.eventThreshold=0,n.alphaAttachmentThreshold=0,n.mixAttachmentThreshold=0,n.mixDrawOrderThreshold=0,n.animationStart=0,n.animationEnd=e.duration,n.animationLast=-1,n.nextAnimationLast=-1,n.delay=0,n.trackTime=0,n.trackLast=-1,n.nextTrackLast=-1,n.trackEnd=Number.MAX_VALUE,n.timeScale=1,n.alpha=1,n.mixTime=0,n.mixDuration=i?this.data.getMix(i.animation,e):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=P.replace,n}clearNext(t){let e=t.next;for(;e;)this.queue.dispose(e),e=e.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let e=0,s=t.length;e<s;e++){let i=t[e];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do(!i.mixingTo||i.mixBlend!=P.add)&&this.computeHold(i),i=i.mixingTo;while(i)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,i=t.animation.timelines.length,n=t.timelineMode;n.length=i;let h=t.timelineHoldMix;h.length=0;let a=this.propertyIDs;if(e&&e.holdPrevious){for(let r=0;r<i;r++)n[r]=a.addAll(s[r].getPropertyIds())?ge:Re;return}t:for(let r=0;r<i;r++){let o=s[r],l=o.getPropertyIds();if(!a.addAll(l))n[r]=me;else if(!e||o instanceof Dt||o instanceof Xt||o instanceof Ht||!e.animation.hasTimeline(l))n[r]=Pe;else{for(let c=e.mixingTo;c;c=c.mixingTo)if(!c.animation.hasTimeline(l)){if(t.mixDuration>0){n[r]=Qs,h[r]=c;continue t}break}n[r]=ge}}}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 Js{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,e<=0&&(this.previous!=null?e=Math.max(e+this.previous.getTrackComplete()-t,0):e=0),this.delay=e}mixBlend=P.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 t==0?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(t!=0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}}class Ks{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(ot.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(ot.interrupt),this.objects.push(t)}end(t){this.objects.push(ot.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(ot.dispose),this.objects.push(t)}complete(t){this.objects.push(ot.complete),this.objects.push(t)}event(t,e){this.objects.push(ot.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 i=t[s],n=t[s+1];switch(i){case ot.start:n.listener&&n.listener.start&&n.listener.start(n);for(let a=0;a<e.length;a++){let r=e[a];r.start&&r.start(n)}break;case ot.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let a=0;a<e.length;a++){let r=e[a];r.interrupt&&r.interrupt(n)}break;case ot.end:n.listener&&n.listener.end&&n.listener.end(n);for(let a=0;a<e.length;a++){let r=e[a];r.end&&r.end(n)}case ot.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let a=0;a<e.length;a++){let r=e[a];r.dispose&&r.dispose(n)}this.animState.trackEntryPool.free(n);break;case ot.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let a=0;a<e.length;a++){let r=e[a];r.complete&&r.complete(n)}break;case ot.event:let h=t[s+++2];n.listener&&n.listener.event&&n.listener.event(n,h);for(let a=0;a<e.length;a++){let r=e[a];r.event&&r.event(n,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}}var ot;(function(C){C[C.start=0]="start",C[C.interrupt=1]="interrupt",C[C.end=2]="end",C[C.dispose=3]="dispose",C[C.complete=4]="complete",C[C.event=5]="event"})(ot||(ot={}));class dr{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}}const me=0,Pe=1,Re=2,ge=3,Qs=4,Be=1,Zs=2;class ti{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);let n=this.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);this.setMixWith(i,n,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let i=t.name+"."+e.name;this.animationToMixTime[i]=s}getMix(t,e){let s=t.name+"."+e.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}}class he extends pt{color=new V(1,1,1,1);constructor(t){super(t)}copy(){let t=new he(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class Yt extends pt{endSlot=null;color=new V(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new Yt(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class ws{_image;constructor(t){this._image=t}getImage(){return this._image}}var tt;(function(C){C[C.Nearest=9728]="Nearest",C[C.Linear=9729]="Linear",C[C.MipMap=9987]="MipMap",C[C.MipMapNearestNearest=9984]="MipMapNearestNearest",C[C.MipMapLinearNearest=9985]="MipMapLinearNearest",C[C.MipMapNearestLinear=9986]="MipMapNearestLinear",C[C.MipMapLinearLinear=9987]="MipMapLinearLinear"})(tt||(tt={}));var St;(function(C){C[C.MirroredRepeat=33648]="MirroredRepeat",C[C.ClampToEdge=33071]="ClampToEdge",C[C.Repeat=10497]="Repeat"})(St||(St={}));class ei{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0}class fr extends ws{setFilters(t,e){}setWraps(t,e){}dispose(){}}class be{pages=new Array;regions=new Array;constructor(t){let e=new si(t),s=new Array(4),i={};i.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},i.format=()=>{},i.filter=l=>{l.minFilter=E.enumValue(tt,s[1]),l.magFilter=E.enumValue(tt,s[2])},i.repeat=l=>{s[1].indexOf("x")!=-1&&(l.uWrap=St.Repeat),s[1].indexOf("y")!=-1&&(l.vWrap=St.Repeat)},i.pma=l=>{l.pma=s[1]=="true"};var n={};n.xy=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2])},n.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},n.bounds=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2]),l.width=parseInt(s[3]),l.height=parseInt(s[4])},n.offset=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2])},n.orig=l=>{l.originalWidth=parseInt(s[1]),l.originalHeight=parseInt(s[2])},n.offsets=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2]),l.originalWidth=parseInt(s[3]),l.originalHeight=parseInt(s[4])},n.rotate=l=>{let c=s[1];c=="true"?l.degrees=90:c!="false"&&(l.degrees=parseInt(c))},n.index=l=>{l.index=parseInt(s[1])};let h=e.readLine();for(;h&&h.trim().length==0;)h=e.readLine();for(;!(!h||h.trim().length==0||e.readEntry(s,h)==0);)h=e.readLine();let a=null,r=null,o=null;for(;h!==null;)if(h.trim().length==0)a=null,h=e.readLine();else if(a){let l=new ys(a,h);for(;;){let c=e.readEntry(s,h=e.readLine());if(c==0)break;let d=n[s[0]];if(d)d(l);else{r||(r=[]),o||(o=[]),r.push(s[0]);let u=[];for(let f=0;f<c;f++)u.push(parseInt(s[f+1]));o.push(u)}}l.originalWidth==0&&l.originalHeight==0&&(l.originalWidth=l.width,l.originalHeight=l.height),r&&r.length>0&&o&&o.length>0&&(l.names=r,l.values=o,r=null,o=null),l.u=l.x/a.width,l.v=l.y/a.height,l.degrees==90?(l.u2=(l.x+l.height)/a.width,l.v2=(l.y+l.width)/a.height):(l.u2=(l.x+l.width)/a.width,l.v2=(l.y+l.height)/a.height),this.regions.push(l)}else{for(a=new ii(h.trim());e.readEntry(s,h=e.readLine())!=0;){let l=i[s[0]];l&&l(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 si{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||(e=e.trim(),e.length==0))return 0;let s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let i=1,n=s+1;;i++){let h=e.indexOf(",",n);if(h==-1)return t[i]=e.substr(n).trim(),i;if(t[i]=e.substr(n,h-n).trim(),n=h+1,i==4)return 4}}}class ii{name;minFilter=tt.Nearest;magFilter=tt.Nearest;uWrap=St.ClampToEdge;vWrap=St.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 ys extends ei{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 ft extends pt{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new V(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new V(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=E.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,i=this.region.u,n=this.region.v,h=0,a=0;if(this.region instanceof ys){let r=this.region,o=r.page,l=o.width,c=o.height;switch(r.degrees){case 90:i-=(r.originalHeight-r.offsetY-r.height)/l,n-=(r.originalWidth-r.offsetX-r.width)/c,h=r.originalHeight/l,a=r.originalWidth/c;for(let d=0;d<s;d+=2)e[d]=i+t[d+1]*h,e[d+1]=n+(1-t[d])*a;return;case 180:i-=(r.originalWidth-r.offsetX-r.width)/l,n-=r.offsetY/c,h=r.originalWidth/l,a=r.originalHeight/c;for(let d=0;d<s;d+=2)e[d]=i+(1-t[d])*h,e[d+1]=n+(1-t[d+1])*a;return;case 270:i-=r.offsetY/l,n-=r.offsetX/c,h=r.originalHeight/l,a=r.originalWidth/c;for(let d=0;d<s;d+=2)e[d]=i+(1-t[d+1])*h,e[d+1]=n+t[d]*a;return}i-=r.offsetX/l,n-=(r.originalHeight-r.offsetY-r.height)/c,h=r.originalWidth/l,a=r.originalHeight/c}else this.region?(h=this.region.u2-i,a=this.region.v2-n):(i=n=0,h=a=1);for(let r=0;r<s;r+=2)e[r]=i+t[r]*h,e[r+1]=n+t[r+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 ft(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),E.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=this.uvs instanceof Float32Array?E.newFloatArray(this.uvs.length):new Array(this.uvs.length),E.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),E.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),E.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,i,n,h){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,i,n,h)}newLinkedMesh(){let t=new ft(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),t.region!=null&&t.updateRegion(),t}}class Rt extends pt{lengths=[];closed=!1;constantSpeed=!1;color=new V(1,1,1,1);constructor(t){super(t)}copy(){let t=new Rt(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),E.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class Ce extends pt{x=0;y=0;rotation=0;color=new V(.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*B.degRad,s=Math.cos(e),i=Math.sin(e),n=s*t.a+i*t.b,h=s*t.c+i*t.d;return B.atan2Deg(h,n)}copy(){let t=new Ce(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}class dt extends Ue{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new V(1,1,1,1);path;region=null;sequence=null;offset=E.newFloatArray(8);uvs=E.newFloatArray(8);tempColor=new V(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(t==null){e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=1,e[5]=1,e[6]=1,e[7]=0;return}let s=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*s,h=-this.height/2*this.scaleY+this.region.offsetY*i,a=n+this.region.width*s,r=h+this.region.height*i,o=this.rotation*B.degRad,l=Math.cos(o),c=Math.sin(o),d=this.x,u=this.y,f=n*l+d,m=n*c,g=h*l+u,w=h*c,b=a*l+d,p=a*c,x=r*l+u,y=r*c,v=this.offset;v[0]=f-w,v[1]=g+m,v[2]=f-y,v[3]=x+m,v[4]=b-y,v[5]=x+p,v[6]=b-w,v[7]=g+p,t.degrees==90?(e[0]=t.u2,e[1]=t.v2,e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,i){this.sequence!=null&&this.sequence.apply(t,this);let n=t.bone,h=this.offset,a=n.worldX,r=n.worldY,o=n.a,l=n.b,c=n.c,d=n.d,u=0,f=0;u=h[0],f=h[1],e[s]=u*o+f*l+a,e[s+1]=u*c+f*d+r,s+=i,u=h[2],f=h[3],e[s]=u*o+f*l+a,e[s+1]=u*c+f*d+r,s+=i,u=h[4],f=h[5],e[s]=u*o+f*l+a,e[s+1]=u*c+f*d+r,s+=i,u=h[6],f=h[7],e[s]=u*o+f*l+a,e[s+1]=u*c+f*d+r}copy(){let t=new dt(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,E.arrayCopy(this.uvs,0,t.uvs,0,8),E.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=this.sequence!=null?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 ri{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let i=s.regions;for(let n=0,h=i.length;n<h;n++){let a=s.getPath(e,n),r=this.atlas.findRegion(a);if(r==null)throw new Error("Region not found in atlas: "+a+" (sequence: "+t+")");i[n]=r}}newRegionAttachment(t,e,s,i){let n=new dt(e,s);if(i!=null)this.loadSequence(e,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");n.region=h}return n}newMeshAttachment(t,e,s,i){let n=new ft(e,s);if(i!=null)this.loadSequence(e,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");n.region=h}return n}newBoundingBoxAttachment(t,e){return new he(e)}newPathAttachment(t,e){return new Rt(e)}newPointAttachment(t,e){return new Ce(e)}newClippingAttachment(t,e){return new Yt(e)}}class vs{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=K.Normal;skinRequired=!1;color=new V;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}}var K;(function(C){C[C.Normal=0]="Normal",C[C.OnlyTranslation=1]="OnlyTranslation",C[C.NoRotationOrReflection=2]="NoRotationOrReflection",C[C.NoScale=3]="NoScale",C[C.NoScaleOrReflection=4]="NoScaleOrReflection"})(K||(K={}));class Ee{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=K.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,i,n,h,a){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=n,this.ashearX=h,this.ashearY=a;let r=this.parent;if(!r){let u=this.skeleton;const f=u.scaleX,m=u.scaleY,g=(s+h)*B.degRad,w=(s+90+a)*B.degRad;this.a=Math.cos(g)*i*f,this.b=Math.cos(w)*n*f,this.c=Math.sin(g)*i*m,this.d=Math.sin(w)*n*m,this.worldX=t*f+u.x,this.worldY=e*m+u.y;return}let o=r.a,l=r.b,c=r.c,d=r.d;switch(this.worldX=o*t+l*e+r.worldX,this.worldY=c*t+d*e+r.worldY,this.inherit){case K.Normal:{const u=(s+h)*B.degRad,f=(s+90+a)*B.degRad,m=Math.cos(u)*i,g=Math.cos(f)*n,w=Math.sin(u)*i,b=Math.sin(f)*n;this.a=o*m+l*w,this.b=o*g+l*b,this.c=c*m+d*w,this.d=c*g+d*b;return}case K.OnlyTranslation:{const u=(s+h)*B.degRad,f=(s+90+a)*B.degRad;this.a=Math.cos(u)*i,this.b=Math.cos(f)*n,this.c=Math.sin(u)*i,this.d=Math.sin(f)*n;break}case K.NoRotationOrReflection:{let u=1/this.skeleton.scaleX,f=1/this.skeleton.scaleY;o*=u,c*=f;let m=o*o+c*c,g=0;m>1e-4?(m=Math.abs(o*d*f-l*u*c)/m,l=c*m,d=o*m,g=Math.atan2(c,o)*B.radDeg):(o=0,c=0,g=90-Math.atan2(d,l)*B.radDeg);const w=(s+h-g)*B.degRad,b=(s+a-g+90)*B.degRad,p=Math.cos(w)*i,x=Math.cos(b)*n,y=Math.sin(w)*i,v=Math.sin(b)*n;this.a=o*p-l*y,this.b=o*x-l*v,this.c=c*p+d*y,this.d=c*x+d*v;break}case K.NoScale:case K.NoScaleOrReflection:{s*=B.degRad;const u=Math.cos(s),f=Math.sin(s);let m=(o*u+l*f)/this.skeleton.scaleX,g=(c*u+d*f)/this.skeleton.scaleY,w=Math.sqrt(m*m+g*g);w>1e-5&&(w=1/w),m*=w,g*=w,w=Math.sqrt(m*m+g*g),this.inherit==K.NoScale&&o*d-l*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(w=-w),s=Math.PI/2+Math.atan2(g,m);const b=Math.cos(s)*w,p=Math.sin(s)*w;h*=B.degRad,a=(90+a)*B.degRad;const x=Math.cos(h)*i,y=Math.cos(a)*n,v=Math.sin(h)*i,A=Math.sin(a)*n;this.a=m*x+b*v,this.b=m*y+b*A,this.c=g*x+p*v,this.d=g*y+p*A;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){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*B.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*B.radDeg;return}let e=t.a,s=t.b,i=t.c,n=t.d,h=1/(e*n-s*i),a=n*h,r=s*h,o=i*h,l=e*h,c=this.worldX-t.worldX,d=this.worldY-t.worldY;this.ax=c*a-d*r,this.ay=d*l-c*o;let u,f,m,g;if(this.inherit==K.OnlyTranslation)u=this.a,f=this.b,m=this.c,g=this.d;else{switch(this.inherit){case K.NoRotationOrReflection:{let y=Math.abs(e*n-s*i)/(e*e+i*i);s=-i*this.skeleton.scaleX*y/this.skeleton.scaleY,n=e*this.skeleton.scaleY*y/this.skeleton.scaleX,h=1/(e*n-s*i),a=n*h,r=s*h;break}case K.NoScale:case K.NoScaleOrReflection:let w=B.cosDeg(this.rotation),b=B.sinDeg(this.rotation);e=(e*w+s*b)/this.skeleton.scaleX,i=(i*w+n*b)/this.skeleton.scaleY;let p=Math.sqrt(e*e+i*i);p>1e-5&&(p=1/p),e*=p,i*=p,p=Math.sqrt(e*e+i*i),this.inherit==K.NoScale&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p);let x=B.PI/2+Math.atan2(i,e);s=Math.cos(x)*p,n=Math.sin(x)*p,h=1/(e*n-s*i),a=n*h,r=s*h,o=i*h,l=e*h}u=a*this.a-r*this.c,f=a*this.b-r*this.d,m=l*this.c-o*this.a,g=l*this.d-o*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(u*u+m*m),this.ascaleX>1e-4){let w=u*g-f*m;this.ascaleY=w/this.ascaleX,this.ashearY=-Math.atan2(u*f+m*g,w)*B.radDeg,this.arotation=Math.atan2(m,u)*B.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,f)*B.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*B.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*B.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,i=t.y-this.worldY;return t.x=s*this.d*e-i*this.b*e,t.y=i*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=B.sinDeg(t),s=B.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*B.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=B.sinDeg(t),s=B.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*B.radDeg}rotateWorld(t){t*=B.degRad;const e=Math.sin(t),s=Math.cos(t),i=this.a,n=this.b;this.a=s*i-e*this.c,this.b=s*n-e*this.d,this.c=e*i+s*this.c,this.d=e*n+s*this.d}}class ce{name;order;skinRequired;constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}class ur{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(t,e="",s=new ni,i=new Gt){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=i}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.cache.assets[e]=s,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise((e,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,n)=>{this.downloader.downloadBinary(t,h=>{this.success(e,t,h),i(h)},(h,a)=>{const r=`Couldn't load binary ${t}: status ${h}, ${a}`;this.error(s,t,r),n(r)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,i=>{this.success(e,t,i)},(i,n)=>{this.error(s,t,`Couldn't load text ${t}: status ${i}, ${n}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,n)=>{this.downloader.downloadJson(t,h=>{this.success(e,t,h),i(h)},(h,a)=>{const r=`Couldn't load JSON ${t}: status ${h}, ${a}`;this.error(s,t,r),n(r)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const i=this.cache.assetsLoaded[t],n=i!==void 0;return n&&(this.cache.assetsLoaded[t]=i.then(h=>(h=h instanceof Image||h instanceof ImageBitmap?this.textureLoader(h):h,this.success(e,t,h),h)).catch(h=>this.error(s,t,h))),n}loadTexture(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,n)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(r=>{if(r.ok)return r.blob();const o=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),n(o)}).then(r=>r?createImageBitmap(r,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(r=>{if(r){const o=this.createTexture(t,r);this.success(e,t,o),i(o)}});else{let r=new Image;r.crossOrigin="anonymous",r.onload=()=>{const o=this.createTexture(t,r);this.success(e,t,o),i(o)},r.onerror=()=>{const o=`Couldn't load image: ${t}`;this.error(s,t,o),n(o)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),r.src=t}}))}loadTextureAtlas(t,e=()=>{},s=()=>{},i){let n=t.lastIndexOf("/"),h=n>=0?t.substring(0,n+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((a,r)=>{this.downloader.downloadText(t,o=>{try{const l=this.createTextureAtlas(t,o);let c=l.pages.length,d=!1;for(let u of l.pages)this.loadTexture(i?i[u.name]:h+u.name,(f,m)=>{d||(u.setTexture(m),--c==0&&(this.success(e,t,l),a(l)))},(f,m)=>{if(!d){const g=`Couldn't load texture ${t} page image: ${f}`;this.error(s,t,g),r(g)}d=!0})}catch(l){const c=`Couldn't parse texture atlas ${t}: ${l.message}`;this.error(s,t,c),r(c)}},(o,l)=>{const c=`Couldn't load texture atlas ${t}: status ${o}, ${l}`;this.error(s,t,c),r(c)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{},i){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((n,h)=>{this.downloader.downloadText(t,a=>{try{const r=this.createTextureAtlas(t,a);this.success(e,t,r),n(r)}catch(r){const o=`Couldn't parse texture atlas ${t}: ${r.message}`;this.error(s,t,o),h(o)}},(a,r)=>{const o=`Couldn't load texture atlas ${t}: status ${a}, ${r}`;this.error(s,t,o),h(o)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(i,n)=>e(n),(i,n)=>s(n))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(i,n)=>e(n),(i,n)=>s(n))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(i,n)=>e(n),(i,n)=>s(n))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(i,n)=>e(n),(i,n)=>s(n))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(i,n)=>e(n),(i,n)=>s(n))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.cache.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?`
1
+ import{a2 as Ve,bq as Oe,br as Mt,ag as oe,bo as Qt,bz as Ye,bA as Fs,bB as Nt,bn as _e,bC as Xs,bD as Ps,bE as Fe,bF as Zt,bG as Rs,bH as Bs,bI as Es,bJ as Ls,bK as Ds,bL as Ns,bM as Vs,bN as Os,bO as _s,bP as Ws,bQ as Us,bx as qs,bR as zs,bm as te,bS as Gs,_ as se,bT as ue,bU as Xe,Z as ct,a0 as $s}from"./index-8A4JLNIp.js";if(typeof window<"u"&&window.PIXI){const C=window.require;window.require=t=>{if(C)return C(t);if(t.startsWith("@pixi/")||t.startsWith("pixi.js"))return window.PIXI}}class ar{array=new Array;add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}}class We{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}class V{r;g;b;a;static WHITE=new V(1,1,1,1);static RED=new V(1,0,0,1);static GREEN=new V(0,1,0,1);static BLUE=new V(0,0,1,1);static MAGENTA=new V(1,0,1,1);constructor(t=0,e=0,s=0,i=0){this.r=t,this.g=e,this.b=s,this.a=i}set(t,e,s,i){return this.r=t,this.g=e,this.b=s,this.a=i,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t=t.charAt(0)=="#"?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=t.length!=8?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,i){return this.r+=t,this.g+=e,this.b+=s,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,e){t.r=((e&4278190080)>>>24)/255,t.g=((e&16711680)>>>16)/255,t.b=((e&65280)>>>8)/255,t.a=(e&255)/255}static rgb888ToColor(t,e){t.r=((e&16711680)>>>16)/255,t.g=((e&65280)>>>8)/255,t.b=(e&255)/255}toRgb888(){const t=e=>("0"+(e*255).toString(16)).slice(-2);return+("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t,e=new V){return e.setFromString(t)}}class B{static PI=3.1415927;static PI2=B.PI*2;static invPI2=1/B.PI2;static radiansToDegrees=180/B.PI;static radDeg=B.radiansToDegrees;static degreesToRadians=B.PI/180;static degRad=B.degreesToRadians;static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*B.degRad)}static sinDeg(t){return Math.sin(t*B.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*B.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),.3333333333333333);return t<0?-e:e}static randomTriangular(t,e){return B.randomTriangularWith(t,e,(t+e)*.5)}static randomTriangularWith(t,e,s){let i=Math.random(),n=e-t;return i<=(s-t)/n?t+Math.sqrt(i*n*(s-t)):e-Math.sqrt((1-i)*n*(e-s))}static isPowerOfTwo(t){return t&&(t&t-1)===0}}class Hs{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class js extends Hs{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}}class or extends js{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}class E{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,e,s,i,n){for(let h=e,a=i;h<e+n;h++,a++)s[a]=t[h]}static arrayFill(t,e,s,i){for(let n=e;n<s;n++)t[n]=i}static setArraySize(t,e,s=0){let i=t.length;if(i==e)return t;if(t.length=e,i<e)for(let n=i;n<e;n++)t[n]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:E.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e;return s}static newFloatArray(t){if(E.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let e=new Array(t);for(let s=0;s<e.length;s++)e[s]=0;return e}}static newShortArray(t){if(E.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let e=new Array(t);for(let s=0;s<e.length;s++)e[s]=0;return e}}static toFloatArray(t){return E.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return E.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var i=0;i<t.length;i++)if(t[i]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}}class lr{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}}class $t{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 ie{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 t!=0&&(this.x/=t,this.y/=t),this}}class hr{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}}class cr{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}}class Ue{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}class pt extends Ue{static nextID=0;id=pt.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,e,s,i,n,h){s=n+(s>>1)*h;let a=t.bone.skeleton,r=t.deform,o=this.vertices,l=this.bones;if(!l){r.length>0&&(o=r);let f=t.bone,m=f.worldX,g=f.worldY,w=f.a,b=f.b,p=f.c,x=f.d;for(let y=e,v=n;v<s;y+=2,v+=h){let A=o[y],k=o[y+1];i[v]=A*w+k*b+m,i[v+1]=A*p+k*x+g}return}let c=0,d=0;for(let f=0;f<e;f+=2){let m=l[c];c+=m+1,d+=m}let u=a.bones;if(r.length==0)for(let f=n,m=d*3;f<s;f+=h){let g=0,w=0,b=l[c++];for(b+=c;c<b;c++,m+=3){let p=u[l[c]],x=o[m],y=o[m+1],v=o[m+2];g+=(x*p.a+y*p.b+p.worldX)*v,w+=(x*p.c+y*p.d+p.worldY)*v}i[f]=g,i[f+1]=w}else{let f=r;for(let m=n,g=d*3,w=d<<1;m<s;m+=h){let b=0,p=0,x=l[c++];for(x+=c;c<x;c++,g+=3,w+=2){let y=u[l[c]],v=o[g]+f[w],A=o[g+1]+f[w+1],k=o[g+2];b+=(v*y.a+A*y.b+y.worldX)*k,p+=(v*y.c+A*y.d+y.worldY)*k}i[m]=b,i[m+1]=p}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),E.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=E.newFloatArray(this.vertices.length),E.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}}class Vt{static _nextID=0;id=Vt.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new Vt(this.regions.length);return E.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;s==-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let i=this.regions[s];e.region!=i&&(e.region=i,e.updateRegion())}getPath(t,e){let s=t,i=(this.start+e).toString();for(let n=this.digits-i.length;n>0;n--)s+="0";return s+=i,s}static nextID(){return Vt._nextID++}}var et;(function(C){C[C.hold=0]="hold",C[C.once=1]="once",C[C.loop=2]="loop",C[C.pingpong=3]="pingpong",C[C.onceReverse=4]="onceReverse",C[C.loopReverse=5]="loopReverse",C[C.pingpongReverse=6]="pingpongReverse"})(et||(et={}));const qe=[et.hold,et.once,et.loop,et.pingpong,et.onceReverse,et.loopReverse,et.pingpongReverse];class ye{name;timelines=[];timelineIds=new We;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,n,h,a,r){if(!t)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));let o=this.timelines;for(let l=0,c=o.length;l<c;l++)o[l].apply(t,e,s,n,h,a,r)}}var P;(function(C){C[C.setup=0]="setup",C[C.first=1]="first",C[C.replace=2]="replace",C[C.add=3]="add"})(P||(P={}));var nt;(function(C){C[C.mixIn=0]="mixIn",C[C.mixOut=1]="mixOut"})(nt||(nt={}));const _={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 J{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=E.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){let i=t.length;for(let n=s;n<i;n+=s)if(t[n]>e)return n-s;return i-s}}class Ct extends J{curves;constructor(t,e,s){super(t,s),this.curves=E.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+t*18;if(this.curves.length>e){let s=E.newFloatArray(e);E.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,i,n,h,a,r,o,l,c){let d=this.curves,u=this.getFrameCount()+t*18;s==0&&(d[e]=2+u);let f=(i-h*2+r)*.03,m=(n-a*2+o)*.03,g=((h-r)*3-i+l)*.006,w=((a-o)*3-n+c)*.006,b=f*2+g,p=m*2+w,x=(h-i)*.3+f+g*.16666667,y=(a-n)*.3+m+w*.16666667,v=i+x,A=n+y;for(let k=u+18;u<k;u+=2)d[u]=v,d[u+1]=A,x+=b,y+=p,b+=g,p+=w,v+=x,A+=y}getBezierValue(t,e,s,i){let n=this.curves;if(n[i]>t){let o=this.frames[e],l=this.frames[e+s];return l+(t-o)/(n[i]-o)*(n[i+1]-l)}let h=i+18;for(i+=2;i<h;i+=2)if(n[i]>=t){let o=n[i-2],l=n[i-1];return l+(t-o)/(n[i]-o)*(n[i+1]-l)}e+=this.getFrameEntries();let a=n[h-2],r=n[h-1];return r+(t-a)/(this.frames[e]-a)*(this.frames[e+s]-r)}}class xt extends Ct{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 n=2;n<=s;n+=2)if(e[n]>t){s=n-2;break}let i=this.curves[s>>1];switch(i){case 0:let n=e[s],h=e[s+1];return h+(t-n)/(e[s+2]-n)*(e[s+2+1]-h);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}getRelativeValue(t,e,s,i,n){if(t<this.frames[0]){switch(s){case P.setup:return n;case P.first:return i+(n-i)*e}return i}let h=this.getCurveValue(t);switch(s){case P.setup:return n+h*e;case P.first:case P.replace:h+=n-i}return i+h*e}getAbsoluteValue(t,e,s,i,n){if(t<this.frames[0]){switch(s){case P.setup:return n;case P.first:return i+(n-i)*e}return i}let h=this.getCurveValue(t);return s==P.setup?n+(h-n)*e:i+(h-i)*e}getAbsoluteValue2(t,e,s,i,n,h){if(t<this.frames[0]){switch(s){case P.setup:return n;case P.first:return i+(n-i)*e}return i}return s==P.setup?n+(h-n)*e:i+(h-i)*e}getScaleValue(t,e,s,i,n,h){const a=this.frames;if(t<a[0]){switch(s){case P.setup:return h;case P.first:return n+(h-n)*e}return n}let r=this.getCurveValue(t)*h;if(e==1)return s==P.add?n+r-h:r;if(i==nt.mixOut)switch(s){case P.setup:return h+(Math.abs(r)*B.signum(h)-h)*e;case P.first:case P.replace:return n+(Math.abs(r)*B.signum(n)-n)*e}else{let o=0;switch(s){case P.setup:return o=Math.abs(h)*B.signum(r),o+(r-o)*e;case P.first:case P.replace:return o=Math.abs(n)*B.signum(r),o+(r-o)*e}}return n+(r-h)*e}}class ve extends Ct{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}}class re extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.rotation=this.getRelativeValue(s,n,h,r.rotation,r.data.rotation))}}class ze extends ve{boneIndex=0;constructor(t,e,s){super(t,e,_.x+"|"+s,_.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case P.setup:r.x=r.data.x,r.y=r.data.y;return;case P.first:r.x+=(r.data.x-r.x)*n,r.y+=(r.data.y-r.y)*n}return}let l=0,c=0,d=J.search(o,s,3),u=this.curves[d/3];switch(u){case 0:let f=o[d];l=o[d+1],c=o[d+2];let m=(s-f)/(o[d+3]-f);l+=(o[d+3+1]-l)*m,c+=(o[d+3+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(h){case P.setup:r.x=r.data.x+l*n,r.y=r.data.y+c*n;break;case P.first:case P.replace:r.x+=(r.data.x+l-r.x)*n,r.y+=(r.data.y+c-r.y)*n;break;case P.add:r.x+=l*n,r.y+=c*n}}}class Ge extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.x+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.x=this.getRelativeValue(s,n,h,r.x,r.data.x))}}class $e extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.y=this.getRelativeValue(s,n,h,r.y,r.data.y))}}class He extends ve{boneIndex=0;constructor(t,e,s){super(t,e,_.scaleX+"|"+s,_.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case P.setup:r.scaleX=r.data.scaleX,r.scaleY=r.data.scaleY;return;case P.first:r.scaleX+=(r.data.scaleX-r.scaleX)*n,r.scaleY+=(r.data.scaleY-r.scaleY)*n}return}let l,c,d=J.search(o,s,3),u=this.curves[d/3];switch(u){case 0:let f=o[d];l=o[d+1],c=o[d+2];let m=(s-f)/(o[d+3]-f);l+=(o[d+3+1]-l)*m,c+=(o[d+3+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}if(l*=r.data.scaleX,c*=r.data.scaleY,n==1)h==P.add?(r.scaleX+=l-r.data.scaleX,r.scaleY+=c-r.data.scaleY):(r.scaleX=l,r.scaleY=c);else{let f=0,m=0;if(a==nt.mixOut)switch(h){case P.setup:f=r.data.scaleX,m=r.data.scaleY,r.scaleX=f+(Math.abs(l)*B.signum(f)-f)*n,r.scaleY=m+(Math.abs(c)*B.signum(m)-m)*n;break;case P.first:case P.replace:f=r.scaleX,m=r.scaleY,r.scaleX=f+(Math.abs(l)*B.signum(f)-f)*n,r.scaleY=m+(Math.abs(c)*B.signum(m)-m)*n;break;case P.add:r.scaleX+=(l-r.data.scaleX)*n,r.scaleY+=(c-r.data.scaleY)*n}else switch(h){case P.setup:f=Math.abs(r.data.scaleX)*B.signum(l),m=Math.abs(r.data.scaleY)*B.signum(c),r.scaleX=f+(l-f)*n,r.scaleY=m+(c-m)*n;break;case P.first:case P.replace:f=Math.abs(r.scaleX)*B.signum(l),m=Math.abs(r.scaleY)*B.signum(c),r.scaleX=f+(l-f)*n,r.scaleY=m+(c-m)*n;break;case P.add:r.scaleX+=(l-r.data.scaleX)*n,r.scaleY+=(c-r.data.scaleY)*n}}}}class je extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.scaleX=this.getScaleValue(s,n,h,a,r.scaleX,r.data.scaleX))}}class Je extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.scaleY=this.getScaleValue(s,n,h,a,r.scaleY,r.data.scaleY))}}class Ke extends ve{boneIndex=0;constructor(t,e,s){super(t,e,_.shearX+"|"+s,_.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case P.setup:r.shearX=r.data.shearX,r.shearY=r.data.shearY;return;case P.first:r.shearX+=(r.data.shearX-r.shearX)*n,r.shearY+=(r.data.shearY-r.shearY)*n}return}let l=0,c=0,d=J.search(o,s,3),u=this.curves[d/3];switch(u){case 0:let f=o[d];l=o[d+1],c=o[d+2];let m=(s-f)/(o[d+3]-f);l+=(o[d+3+1]-l)*m,c+=(o[d+3+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(h){case P.setup:r.shearX=r.data.shearX+l*n,r.shearY=r.data.shearY+c*n;break;case P.first:case P.replace:r.shearX+=(r.data.shearX+l-r.shearX)*n,r.shearY+=(r.data.shearY+c-r.shearY)*n;break;case P.add:r.shearX+=l*n,r.shearY+=c*n}}}class Qe extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.shearX=this.getRelativeValue(s,n,h,r.shearX,r.data.shearX))}}class Ze extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.shearY=this.getRelativeValue(s,n,h,r.shearY,r.data.shearY))}}class ts extends J{boneIndex=0;constructor(t,e){super(t,[_.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,i,n,h,a){let r=t.bones[this.boneIndex];if(!r.active)return;if(a==nt.mixOut){h==P.setup&&(r.inherit=r.data.inherit);return}let o=this.frames;if(s<o[0]){(h==P.setup||h==P.first)&&(r.inherit=r.data.inherit);return}r.inherit=this.frames[J.search(o,s,2)+1]}}class es extends Ct{slotIndex=0;constructor(t,e,s){super(t,e,[_.rgb+"|"+s,_.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,n,h){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=h}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color;if(s<o[0]){let w=r.data.color;switch(h){case P.setup:l.setFromColor(w);return;case P.first:l.add((w.r-l.r)*n,(w.g-l.g)*n,(w.b-l.b)*n,(w.a-l.a)*n)}return}let c=0,d=0,u=0,f=0,m=J.search(o,s,5),g=this.curves[m/5];switch(g){case 0:let w=o[m];c=o[m+1],d=o[m+2],u=o[m+3],f=o[m+4];let b=(s-w)/(o[m+5]-w);c+=(o[m+5+1]-c)*b,d+=(o[m+5+2]-d)*b,u+=(o[m+5+3]-u)*b,f+=(o[m+5+4]-f)*b;break;case 1:c=o[m+1],d=o[m+2],u=o[m+3],f=o[m+4];break;default:c=this.getBezierValue(s,m,1,g-2),d=this.getBezierValue(s,m,2,g+18-2),u=this.getBezierValue(s,m,3,g+36-2),f=this.getBezierValue(s,m,4,g+54-2)}n==1?l.set(c,d,u,f):(h==P.setup&&l.setFromColor(r.data.color),l.add((c-l.r)*n,(d-l.g)*n,(u-l.b)*n,(f-l.a)*n))}}class ss extends Ct{slotIndex=0;constructor(t,e,s){super(t,e,[_.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color;if(s<o[0]){let g=r.data.color;switch(h){case P.setup:l.r=g.r,l.g=g.g,l.b=g.b;return;case P.first:l.r+=(g.r-l.r)*n,l.g+=(g.g-l.g)*n,l.b+=(g.b-l.b)*n}return}let c=0,d=0,u=0,f=J.search(o,s,4),m=this.curves[f>>2];switch(m){case 0:let g=o[f];c=o[f+1],d=o[f+2],u=o[f+3];let w=(s-g)/(o[f+4]-g);c+=(o[f+4+1]-c)*w,d+=(o[f+4+2]-d)*w,u+=(o[f+4+3]-u)*w;break;case 1:c=o[f+1],d=o[f+2],u=o[f+3];break;default:c=this.getBezierValue(s,f,1,m-2),d=this.getBezierValue(s,f,2,m+18-2),u=this.getBezierValue(s,f,3,m+36-2)}if(n==1)l.r=c,l.g=d,l.b=u;else{if(h==P.setup){let g=r.data.color;l.r=g.r,l.g=g.g,l.b=g.b}l.r+=(c-l.r)*n,l.g+=(d-l.g)*n,l.b+=(u-l.b)*n}}}class is extends xt{slotIndex=0;constructor(t,e,s){super(t,e,_.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=r.color;if(s<this.frames[0]){let c=r.data.color;switch(h){case P.setup:o.a=c.a;return;case P.first:o.a+=(c.a-o.a)*n}return}let l=this.getCurveValue(s);n==1?o.a=l:(h==P.setup&&(o.a=r.data.color.a),o.a+=(l-o.a)*n)}}class rs extends Ct{slotIndex=0;constructor(t,e,s){super(t,e,[_.rgb+"|"+s,_.alpha+"|"+s,_.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,n,h,a,r,o){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=h,this.frames[t+5]=a,this.frames[t+6]=r,this.frames[t+7]=o}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color,c=r.darkColor;if(s<o[0]){let y=r.data.color,v=r.data.darkColor;switch(h){case P.setup:l.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case P.first:l.add((y.r-l.r)*n,(y.g-l.g)*n,(y.b-l.b)*n,(y.a-l.a)*n),c.r+=(v.r-c.r)*n,c.g+=(v.g-c.g)*n,c.b+=(v.b-c.b)*n}return}let d=0,u=0,f=0,m=0,g=0,w=0,b=0,p=J.search(o,s,8),x=this.curves[p>>3];switch(x){case 0:let y=o[p];d=o[p+1],u=o[p+2],f=o[p+3],m=o[p+4],g=o[p+5],w=o[p+6],b=o[p+7];let v=(s-y)/(o[p+8]-y);d+=(o[p+8+1]-d)*v,u+=(o[p+8+2]-u)*v,f+=(o[p+8+3]-f)*v,m+=(o[p+8+4]-m)*v,g+=(o[p+8+5]-g)*v,w+=(o[p+8+6]-w)*v,b+=(o[p+8+7]-b)*v;break;case 1:d=o[p+1],u=o[p+2],f=o[p+3],m=o[p+4],g=o[p+5],w=o[p+6],b=o[p+7];break;default:d=this.getBezierValue(s,p,1,x-2),u=this.getBezierValue(s,p,2,x+18-2),f=this.getBezierValue(s,p,3,x+36-2),m=this.getBezierValue(s,p,4,x+54-2),g=this.getBezierValue(s,p,5,x+72-2),w=this.getBezierValue(s,p,6,x+90-2),b=this.getBezierValue(s,p,7,x+108-2)}if(n==1)l.set(d,u,f,m),c.r=g,c.g=w,c.b=b;else{if(h==P.setup){l.setFromColor(r.data.color);let y=r.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}l.add((d-l.r)*n,(u-l.g)*n,(f-l.b)*n,(m-l.a)*n),c.r+=(g-c.r)*n,c.g+=(w-c.g)*n,c.b+=(b-c.b)*n}}}class ns extends Ct{slotIndex=0;constructor(t,e,s){super(t,e,[_.rgb+"|"+s,_.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,h,a,r){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=h,this.frames[t+5]=a,this.frames[t+6]=r}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color,c=r.darkColor;if(s<o[0]){let x=r.data.color,y=r.data.darkColor;switch(h){case P.setup:l.r=x.r,l.g=x.g,l.b=x.b,c.r=y.r,c.g=y.g,c.b=y.b;return;case P.first:l.r+=(x.r-l.r)*n,l.g+=(x.g-l.g)*n,l.b+=(x.b-l.b)*n,c.r+=(y.r-c.r)*n,c.g+=(y.g-c.g)*n,c.b+=(y.b-c.b)*n}return}let d=0,u=0,f=0,m=0,g=0,w=0,b=J.search(o,s,7),p=this.curves[b/7];switch(p){case 0:let x=o[b];d=o[b+1],u=o[b+2],f=o[b+3],m=o[b+4],g=o[b+5],w=o[b+6];let y=(s-x)/(o[b+7]-x);d+=(o[b+7+1]-d)*y,u+=(o[b+7+2]-u)*y,f+=(o[b+7+3]-f)*y,m+=(o[b+7+4]-m)*y,g+=(o[b+7+5]-g)*y,w+=(o[b+7+6]-w)*y;break;case 1:d=o[b+1],u=o[b+2],f=o[b+3],m=o[b+4],g=o[b+5],w=o[b+6];break;default:d=this.getBezierValue(s,b,1,p-2),u=this.getBezierValue(s,b,2,p+18-2),f=this.getBezierValue(s,b,3,p+36-2),m=this.getBezierValue(s,b,4,p+54-2),g=this.getBezierValue(s,b,5,p+72-2),w=this.getBezierValue(s,b,6,p+90-2)}if(n==1)l.r=d,l.g=u,l.b=f,c.r=m,c.g=g,c.b=w;else{if(h==P.setup){let x=r.data.color,y=r.data.darkColor;l.r=x.r,l.g=x.g,l.b=x.b,c.r=y.r,c.g=y.g,c.b=y.b}l.r+=(d-l.r)*n,l.g+=(u-l.g)*n,l.b+=(f-l.b)*n,c.r+=(m-c.r)*n,c.g+=(g-c.g)*n,c.b+=(w-c.b)*n}}}class Dt extends J{slotIndex=0;attachmentNames;constructor(t,e){super(t,[_.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,i,n,h,a){let r=t.slots[this.slotIndex];if(r.bone.active){if(a==nt.mixOut){h==P.setup&&this.setAttachment(t,r,r.data.attachmentName);return}if(s<this.frames[0]){(h==P.setup||h==P.first)&&this.setAttachment(t,r,r.data.attachmentName);return}this.setAttachment(t,r,this.attachmentNames[J.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class as extends Ct{slotIndex=0;attachment;vertices;constructor(t,e,s,i){super(t,e,[_.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,n,h,a,r,o,l,c){let d=this.curves,u=this.getFrameCount()+t*18;s==0&&(d[e]=2+u);let f=(i-h*2+r)*.03,m=o*.03-a*.06,g=((h-r)*3-i+l)*.006,w=(a-o+.33333333)*.018,b=f*2+g,p=m*2+w,x=(h-i)*.3+f+g*.16666667,y=a*.3+m+w*.16666667,v=i+x,A=y;for(let k=u+18;u<k;u+=2)d[u]=v,d[u+1]=A,x+=b,y+=p,b+=g,p+=w,v+=x,A+=y}getCurvePercent(t,e){let s=this.curves,i=s[e];switch(i){case 0:let r=this.frames[e];return(t-r)/(this.frames[e+this.getFrameEntries()]-r);case 1:return 0}if(i-=2,s[i]>t){let r=this.frames[e];return s[i+1]*(t-r)/(s[i]-r)}let n=i+18;for(i+=2;i<n;i+=2)if(s[i]>=t){let r=s[i-2],o=s[i-1];return o+(t-r)/(s[i]-r)*(s[i+1]-o)}let h=s[n-2],a=s[n-1];return a+(1-a)*(t-h)/(this.frames[e+this.getFrameEntries()]-h)}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=r.getAttachment();if(!o||!(o instanceof pt)||o.timelineAttachment!=this.attachment)return;let l=r.deform;l.length==0&&(h=P.setup);let c=this.vertices,d=c[0].length,u=this.frames;if(s<u[0]){switch(h){case P.setup:l.length=0;return;case P.first:if(n==1){l.length=0;return}l.length=d;let p=o;if(p.bones){n=1-n;for(var f=0;f<d;f++)l[f]*=n}else{let x=p.vertices;for(var f=0;f<d;f++)l[f]+=(x[f]-l[f])*n}}return}if(l.length=d,s>=u[u.length-1]){let p=c[u.length-1];if(n==1)if(h==P.add){let x=o;if(x.bones)for(let y=0;y<d;y++)l[y]+=p[y];else{let y=x.vertices;for(let v=0;v<d;v++)l[v]+=p[v]-y[v]}}else E.arrayCopy(p,0,l,0,d);else switch(h){case P.setup:{let y=o;if(y.bones)for(let v=0;v<d;v++)l[v]=p[v]*n;else{let v=y.vertices;for(let A=0;A<d;A++){let k=v[A];l[A]=k+(p[A]-k)*n}}break}case P.first:case P.replace:for(let y=0;y<d;y++)l[y]+=(p[y]-l[y])*n;break;case P.add:let x=o;if(x.bones)for(let y=0;y<d;y++)l[y]+=p[y]*n;else{let y=x.vertices;for(let v=0;v<d;v++)l[v]+=(p[v]-y[v])*n}}return}let m=J.search1(u,s),g=this.getCurvePercent(s,m),w=c[m],b=c[m+1];if(n==1)if(h==P.add){let p=o;if(p.bones)for(let x=0;x<d;x++){let y=w[x];l[x]+=y+(b[x]-y)*g}else{let x=p.vertices;for(let y=0;y<d;y++){let v=w[y];l[y]+=v+(b[y]-v)*g-x[y]}}}else for(let p=0;p<d;p++){let x=w[p];l[p]=x+(b[p]-x)*g}else switch(h){case P.setup:{let x=o;if(x.bones)for(let y=0;y<d;y++){let v=w[y];l[y]=(v+(b[y]-v)*g)*n}else{let y=x.vertices;for(let v=0;v<d;v++){let A=w[v],k=y[v];l[v]=k+(A+(b[v]-A)*g-k)*n}}break}case P.first:case P.replace:for(let x=0;x<d;x++){let y=w[x];l[x]+=(y+(b[x]-y)*g-l[x])*n}break;case P.add:let p=o;if(p.bones)for(let x=0;x<d;x++){let y=w[x];l[x]+=(y+(b[x]-y)*g)*n}else{let x=p.vertices;for(let y=0;y<d;y++){let v=w[y];l[y]+=(v+(b[y]-v)*g-x[y])*n}}}}}class Ht extends J{static propertyIds=[""+_.event];events;constructor(t){super(t,Ht.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,i,n,h,a){if(!i)return;let r=this.frames,o=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,i,n,h,a),e=-1;else if(e>=r[o-1])return;if(s<r[0])return;let l=0;if(e<r[0])l=0;else{l=J.search1(r,e)+1;let c=r[l];for(;l>0&&r[l-1]==c;)l--}for(;l<o&&s>=r[l];l++)i.push(this.events[l])}}class Xt extends J{static propertyIds=[""+_.drawOrder];drawOrders;constructor(t){super(t,Xt.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,i,n,h,a){if(a==nt.mixOut){h==P.setup&&E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(s<this.frames[0]){(h==P.setup||h==P.first)&&E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let r=J.search1(this.frames,s),o=this.drawOrders[r];if(!o)E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let l=t.drawOrder,c=t.slots;for(let d=0,u=o.length;d<u;d++)l[d]=c[o[d]]}}}class os extends Ct{constraintIndex=0;constructor(t,e,s){super(t,e,[_.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,n,h,a){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=h?1:0,this.frames[t+5]=a?1:0}apply(t,e,s,i,n,h,a){let r=t.ikConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case P.setup:r.mix=r.data.mix,r.softness=r.data.softness,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch;return;case P.first:r.mix+=(r.data.mix-r.mix)*n,r.softness+=(r.data.softness-r.softness)*n,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch}return}let l=0,c=0,d=J.search(o,s,6),u=this.curves[d/6];switch(u){case 0:let f=o[d];l=o[d+1],c=o[d+2];let m=(s-f)/(o[d+6]-f);l+=(o[d+6+1]-l)*m,c+=(o[d+6+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}h==P.setup?(r.mix=r.data.mix+(l-r.data.mix)*n,r.softness=r.data.softness+(c-r.data.softness)*n,a==nt.mixOut?(r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch):(r.bendDirection=o[d+3],r.compress=o[d+4]!=0,r.stretch=o[d+5]!=0)):(r.mix+=(l-r.mix)*n,r.softness+=(c-r.softness)*n,a==nt.mixIn&&(r.bendDirection=o[d+3],r.compress=o[d+4]!=0,r.stretch=o[d+5]!=0))}}class ls extends Ct{constraintIndex=0;constructor(t,e,s){super(t,e,[_.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,h,a,r){let o=this.frames;t*=7,o[t]=e,o[t+1]=s,o[t+2]=i,o[t+3]=n,o[t+4]=h,o[t+5]=a,o[t+6]=r}apply(t,e,s,i,n,h,a){let r=t.transformConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){let b=r.data;switch(h){case P.setup:r.mixRotate=b.mixRotate,r.mixX=b.mixX,r.mixY=b.mixY,r.mixScaleX=b.mixScaleX,r.mixScaleY=b.mixScaleY,r.mixShearY=b.mixShearY;return;case P.first:r.mixRotate+=(b.mixRotate-r.mixRotate)*n,r.mixX+=(b.mixX-r.mixX)*n,r.mixY+=(b.mixY-r.mixY)*n,r.mixScaleX+=(b.mixScaleX-r.mixScaleX)*n,r.mixScaleY+=(b.mixScaleY-r.mixScaleY)*n,r.mixShearY+=(b.mixShearY-r.mixShearY)*n}return}let l,c,d,u,f,m,g=J.search(o,s,7),w=this.curves[g/7];switch(w){case 0:let b=o[g];l=o[g+1],c=o[g+2],d=o[g+3],u=o[g+4],f=o[g+5],m=o[g+6];let p=(s-b)/(o[g+7]-b);l+=(o[g+7+1]-l)*p,c+=(o[g+7+2]-c)*p,d+=(o[g+7+3]-d)*p,u+=(o[g+7+4]-u)*p,f+=(o[g+7+5]-f)*p,m+=(o[g+7+6]-m)*p;break;case 1:l=o[g+1],c=o[g+2],d=o[g+3],u=o[g+4],f=o[g+5],m=o[g+6];break;default:l=this.getBezierValue(s,g,1,w-2),c=this.getBezierValue(s,g,2,w+18-2),d=this.getBezierValue(s,g,3,w+36-2),u=this.getBezierValue(s,g,4,w+54-2),f=this.getBezierValue(s,g,5,w+72-2),m=this.getBezierValue(s,g,6,w+90-2)}if(h==P.setup){let b=r.data;r.mixRotate=b.mixRotate+(l-b.mixRotate)*n,r.mixX=b.mixX+(c-b.mixX)*n,r.mixY=b.mixY+(d-b.mixY)*n,r.mixScaleX=b.mixScaleX+(u-b.mixScaleX)*n,r.mixScaleY=b.mixScaleY+(f-b.mixScaleY)*n,r.mixShearY=b.mixShearY+(m-b.mixShearY)*n}else r.mixRotate+=(l-r.mixRotate)*n,r.mixX+=(c-r.mixX)*n,r.mixY+=(d-r.mixY)*n,r.mixScaleX+=(u-r.mixScaleX)*n,r.mixScaleY+=(f-r.mixScaleY)*n,r.mixShearY+=(m-r.mixShearY)*n}}class hs extends xt{constraintIndex=0;constructor(t,e,s){super(t,e,_.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,i,n,h,a){let r=t.pathConstraints[this.constraintIndex];r.active&&(r.position=this.getAbsoluteValue(s,n,h,r.position,r.data.position))}}class cs extends xt{constraintIndex=0;constructor(t,e,s){super(t,e,_.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,i,n,h,a){let r=t.pathConstraints[this.constraintIndex];r.active&&(r.spacing=this.getAbsoluteValue(s,n,h,r.spacing,r.data.spacing))}}class ds extends Ct{constraintIndex=0;constructor(t,e,s){super(t,e,[_.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){let h=this.frames;t<<=2,h[t]=e,h[t+1]=s,h[t+2]=i,h[t+3]=n}apply(t,e,s,i,n,h,a){let r=t.pathConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case P.setup:r.mixRotate=r.data.mixRotate,r.mixX=r.data.mixX,r.mixY=r.data.mixY;return;case P.first:r.mixRotate+=(r.data.mixRotate-r.mixRotate)*n,r.mixX+=(r.data.mixX-r.mixX)*n,r.mixY+=(r.data.mixY-r.mixY)*n}return}let l,c,d,u=J.search(o,s,4),f=this.curves[u>>2];switch(f){case 0:let m=o[u];l=o[u+1],c=o[u+2],d=o[u+3];let g=(s-m)/(o[u+4]-m);l+=(o[u+4+1]-l)*g,c+=(o[u+4+2]-c)*g,d+=(o[u+4+3]-d)*g;break;case 1:l=o[u+1],c=o[u+2],d=o[u+3];break;default:l=this.getBezierValue(s,u,1,f-2),c=this.getBezierValue(s,u,2,f+18-2),d=this.getBezierValue(s,u,3,f+36-2)}if(h==P.setup){let m=r.data;r.mixRotate=m.mixRotate+(l-m.mixRotate)*n,r.mixX=m.mixX+(c-m.mixX)*n,r.mixY=m.mixY+(d-m.mixY)*n}else r.mixRotate+=(l-r.mixRotate)*n,r.mixX+=(c-r.mixX)*n,r.mixY+=(d-r.mixY)*n}}class Bt extends xt{constraintIndex=0;constructor(t,e,s,i){super(t,e,i+"|"+s),this.constraintIndex=s}apply(t,e,s,i,n,h,a){let r;if(this.constraintIndex==-1){const o=s>=this.frames[0]?this.getCurveValue(s):0;for(const l of t.physicsConstraints)l.active&&this.global(l.data)&&this.set(l,this.getAbsoluteValue2(s,n,h,this.get(l),this.setup(l),o))}else r=t.physicsConstraints[this.constraintIndex],r.active&&this.set(r,this.getAbsoluteValue(s,n,h,this.get(r),this.setup(r)))}}class fs extends Bt{constructor(t,e,s){super(t,e,s,_.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}}class us extends Bt{constructor(t,e,s){super(t,e,s,_.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}}class ms extends Bt{constructor(t,e,s){super(t,e,s,_.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}}class gs extends Bt{constructor(t,e,s){super(t,e,s,_.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 ps extends Bt{constructor(t,e,s){super(t,e,s,_.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}}class xs extends Bt{constructor(t,e,s){super(t,e,s,_.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}}class bs extends Bt{constructor(t,e,s){super(t,e,s,_.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}}class le extends J{static propertyIds=[_.physicsConstraintReset.toString()];constraintIndex;constructor(t,e){super(t,le.propertyIds),this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,i,n,h,a){let r;if(this.constraintIndex!=-1&&(r=t.physicsConstraints[this.constraintIndex],!r.active))return;const o=this.frames;if(e>s)this.apply(t,e,Number.MAX_VALUE,[],n,h,a),e=-1;else if(e>=o[o.length-1])return;if(!(s<o[0])&&(e<o[0]||s>=o[J.search1(o,e)+1]))if(r!=null)r.reset();else for(const l of t.physicsConstraints)l.active&&l.reset()}}class yt extends J{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,e,s){super(t,[_.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return yt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,i,n){let h=this.frames;t*=yt.ENTRIES,h[t]=e,h[t+yt.MODE]=s|i<<4,h[t+yt.DELAY]=n}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=r.attachment,l=this.attachment;if(o!=l&&(!(o instanceof pt)||o.timelineAttachment!=l))return;if(a==nt.mixOut){h==P.setup&&(r.sequenceIndex=-1);return}let c=this.frames;if(s<c[0]){(h==P.setup||h==P.first)&&(r.sequenceIndex=-1);return}let d=J.search(c,s,yt.ENTRIES),u=c[d],f=c[d+yt.MODE],m=c[d+yt.DELAY];if(!this.attachment.sequence)return;let g=f>>4,w=this.attachment.sequence.regions.length,b=qe[f&15];if(b!=et.hold)switch(g+=(s-u)/m+1e-5|0,b){case et.once:g=Math.min(w-1,g);break;case et.loop:g%=w;break;case et.pingpong:{let p=(w<<1)-2;g=p==0?0:g%p,g>=w&&(g=p-g);break}case et.onceReverse:g=Math.max(w-1-g,0);break;case et.loopReverse:g=w-1-g%w;break;case et.pingpongReverse:{let p=(w<<1)-2;g=p==0?0:(g+w-1)%p,g>=w&&(g=p-g)}}r.sequenceIndex=g}}class Ot{static _emptyAnimation=new ye("<empty>",[],0);static emptyAnimation(){return Ot._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Ks(this);propertyIDs=new We;animationsChanged=!1;trackEntryPool=new $t(()=>new Js);constructor(t){this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,i=e.length;s<i;s++){let n=e[s];if(!n)continue;n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast;let h=t*n.timeScale;if(n.delay>0){if(n.delay-=h,n.delay>0)continue;h=-n.delay,n.delay=0}let a=n.next;if(a){let r=n.trackLast-a.delay;if(r>=0){for(a.delay=0,a.trackTime+=n.timeScale==0?0:(r/n.timeScale+t)*a.timeScale,n.trackTime+=h,this.setCurrent(s,a,!0);a.mixingFrom;)a.mixTime+=t,a=a.mixingFrom;continue}}else if(n.trackLast>=n.trackEnd&&!n.mixingFrom){e[s]=null,this.queue.end(n),this.clearNext(n);continue}if(n.mixingFrom&&this.updateMixingFrom(n,t)){let r=n.mixingFrom;for(n.mixingFrom=null,r&&(r.mixingTo=null);r;)this.queue.end(r),r=r.mixingFrom}n.trackTime+=h}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let i=this.updateMixingFrom(s,e);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,t.nextTrackLast!=-1&&t.mixTime>=t.mixDuration?((s.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=s.mixingFrom,s.mixingFrom!=null&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),i):(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,i=!1;for(let d=0,u=s.length;d<u;d++){let f=s[d];if(!f||f.delay>0)continue;i=!0;let m=d==0?P.first:f.mixBlend,g=f.alpha;f.mixingFrom?g*=this.applyMixingFrom(f,t,m):f.trackTime>=f.trackEnd&&!f.next&&(g=0);let w=g>=f.alphaAttachmentThreshold,b=f.animationLast,p=f.getAnimationTime(),x=p,y=e;f.reverse&&(x=f.animation.duration-x,y=null);let v=f.animation.timelines,A=v.length;if(d==0&&g==1||m==P.add){d==0&&(w=!0);for(let k=0;k<A;k++){E.webkit602BugfixHelper(g,m);var n=v[k];n instanceof Dt?this.applyAttachmentTimeline(n,t,x,m,w):n.apply(t,b,x,y,g,m,nt.mixIn)}}else{let k=f.timelineMode,I=f.shortestRotation,Y=!I&&f.timelinesRotation.length!=A<<1;Y&&(f.timelinesRotation.length=A<<1);for(let T=0;T<A;T++){let R=v[T],X=k[T]==me?m:P.setup;!I&&R instanceof re?this.applyRotateTimeline(R,t,x,g,X,f.timelinesRotation,T<<1,Y):R instanceof Dt?this.applyAttachmentTimeline(R,t,x,m,w):(E.webkit602BugfixHelper(g,m),R.apply(t,b,x,y,g,X,nt.mixIn))}}this.queueEvents(f,p),e.length=0,f.nextAnimationLast=p,f.nextTrackLast=f.trackTime}for(var h=this.unkeyedState+Be,a=t.slots,r=0,o=t.slots.length;r<o;r++){var l=a[r];if(l.attachmentState==h){var c=l.data.attachmentName;l.setAttachment(c?t.getAttachment(l.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(t,e,s){let i=t.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,e,s);let n=0;t.mixDuration==0?(n=1,s==P.first&&(s=P.setup)):(n=t.mixTime/t.mixDuration,n>1&&(n=1),s!=P.first&&(s=i.mixBlend));let h=n<i.mixAttachmentThreshold,a=n<i.mixDrawOrderThreshold,r=i.animation.timelines,o=r.length,l=i.alpha*t.interruptAlpha,c=l*(1-n),d=i.animationLast,u=i.getAnimationTime(),f=u,m=null;if(i.reverse?f=i.animation.duration-f:n<i.eventThreshold&&(m=this.events),s==P.add)for(let g=0;g<o;g++)r[g].apply(e,d,f,m,c,s,nt.mixOut);else{let g=i.timelineMode,w=i.timelineHoldMix,b=i.shortestRotation,p=!b&&i.timelinesRotation.length!=o<<1;p&&(i.timelinesRotation.length=o<<1),i.totalAlpha=0;for(let x=0;x<o;x++){let y=r[x],v=nt.mixOut,A,k=0;switch(g[x]){case me:if(!a&&y instanceof Xt)continue;A=s,k=c;break;case Pe:A=P.setup,k=c;break;case Re:A=s,k=l;break;case ge:A=P.setup,k=l;break;default:A=P.setup;let I=w[x];k=l*Math.max(0,1-I.mixTime/I.mixDuration);break}i.totalAlpha+=k,!b&&y instanceof re?this.applyRotateTimeline(y,e,f,k,A,i.timelinesRotation,x<<1,p):y instanceof Dt?this.applyAttachmentTimeline(y,e,f,A,h&&k>=i.alphaAttachmentThreshold):(E.webkit602BugfixHelper(k,s),a&&y instanceof Xt&&A==P.setup&&(v=nt.mixIn),y.apply(e,d,f,m,k,A,v))}}return t.mixDuration>0&&this.queueEvents(i,u),this.events.length=0,i.nextAnimationLast=u,i.nextTrackLast=i.trackTime,n}applyAttachmentTimeline(t,e,s,i,n){var h=e.slots[t.slotIndex];h.bone.active&&(s<t.frames[0]?(i==P.setup||i==P.first)&&this.setAttachment(e,h,h.data.attachmentName,n):this.setAttachment(e,h,t.attachmentNames[J.search1(t.frames,s)],n),h.attachmentState<=this.unkeyedState&&(h.attachmentState=this.unkeyedState+Be))}setAttachment(t,e,s,i){e.setAttachment(s?t.getAttachment(e.data.index,s):null),i&&(e.attachmentState=this.unkeyedState+Zs)}applyRotateTimeline(t,e,s,i,n,h,a,r){if(r&&(h[a]=0),i==1){t.apply(e,0,s,null,1,n,nt.mixIn);return}let o=e.bones[t.boneIndex];if(!o.active)return;let l=t.frames,c=0,d=0;if(s<l[0])switch(n){case P.setup:o.rotation=o.data.rotation;default:return;case P.first:c=o.rotation,d=o.data.rotation}else c=n==P.setup?o.data.rotation:o.rotation,d=o.data.rotation+t.getCurveValue(s);let u=0,f=d-c;if(f-=Math.ceil(f/360-.5)*360,f==0)u=h[a];else{let m=0,g=0;r?(m=0,g=f):(m=h[a],g=h[a+1]);let w=m-m%360;u=f+w;let b=f>=0,p=m>=0;Math.abs(g)<=90&&B.signum(g)!=B.signum(f)&&(Math.abs(m-w)>180?(u+=360*B.signum(m),p=b):w!=0?u-=360*B.signum(m):p=b),p!=b&&(u+=360*B.signum(m)),h[a]=u}h[a+1]=f,o.rotation=c+u*i}queueEvents(t,e){let s=t.animationStart,i=t.animationEnd,n=i-s,h=t.trackLast%n,a=this.events,r=0,o=a.length;for(;r<o;r++){let c=a[r];if(c.time<h)break;c.time>i||this.queue.event(t,c)}let l=!1;if(t.loop)if(n==0)l=!0;else{const c=Math.floor(t.trackTime/n);l=c>0&&c>Math.floor(t.trackLast/n)}else l=e>=i&&t.animationLast<i;for(l&&this.queue.complete(t);r<o;r++){let c=a[r];c.time<s||this.queue.event(t,c)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++)this.clearTrack(e);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 i=s.mixingFrom;if(!i)break;this.queue.end(i),s.mixingFrom=null,s.mixingTo=null,s=i}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,s){let i=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,i&&(s&&this.queue.interrupt(i),e.mixingFrom=i,i.mixingTo=e,e.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(e.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let i=this.data.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,i,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let i=!0,n=this.expandToIndex(t);n&&(n.nextTrackLast==-1?(this.tracks[t]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,i=!1):this.clearNext(n));let h=this.trackEntry(t,e,s,n);return this.setCurrent(t,h,i),this.queue.drain(),h}addAnimation(t,e,s=!1,i=0){let n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,n,s,i)}addAnimationWith(t,e,s=!1,i=0){if(!e)throw new Error("animation cannot be null.");let n=this.expandToIndex(t);if(n)for(;n.next;)n=n.next;let h=this.trackEntry(t,e,s,n);return n?(n.next=h,h.previous=n,i<=0&&(i=Math.max(i+n.getTrackComplete()-h.mixDuration,0))):(this.setCurrent(t,h,!0),this.queue.drain(),i<0&&(i=0)),h.delay=i,h}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,Ot.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let i=this.addAnimationWith(t,Ot.emptyAnimation(),!1,s);return s<=0&&(i.delay=Math.max(i.delay+i.mixDuration-e,0)),i.mixDuration=e,i.trackEnd=e,i}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++){let n=this.tracks[s];n&&this.setEmptyAnimation(n.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(E.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,s,i){let n=this.trackEntryPool.obtain();return n.reset(),n.trackIndex=t,n.animation=e,n.loop=s,n.holdPrevious=!1,n.reverse=!1,n.shortestRotation=!1,n.eventThreshold=0,n.alphaAttachmentThreshold=0,n.mixAttachmentThreshold=0,n.mixDrawOrderThreshold=0,n.animationStart=0,n.animationEnd=e.duration,n.animationLast=-1,n.nextAnimationLast=-1,n.delay=0,n.trackTime=0,n.trackLast=-1,n.nextTrackLast=-1,n.trackEnd=Number.MAX_VALUE,n.timeScale=1,n.alpha=1,n.mixTime=0,n.mixDuration=i?this.data.getMix(i.animation,e):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=P.replace,n}clearNext(t){let e=t.next;for(;e;)this.queue.dispose(e),e=e.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let e=0,s=t.length;e<s;e++){let i=t[e];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do(!i.mixingTo||i.mixBlend!=P.add)&&this.computeHold(i),i=i.mixingTo;while(i)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,i=t.animation.timelines.length,n=t.timelineMode;n.length=i;let h=t.timelineHoldMix;h.length=0;let a=this.propertyIDs;if(e&&e.holdPrevious){for(let r=0;r<i;r++)n[r]=a.addAll(s[r].getPropertyIds())?ge:Re;return}t:for(let r=0;r<i;r++){let o=s[r],l=o.getPropertyIds();if(!a.addAll(l))n[r]=me;else if(!e||o instanceof Dt||o instanceof Xt||o instanceof Ht||!e.animation.hasTimeline(l))n[r]=Pe;else{for(let c=e.mixingTo;c;c=c.mixingTo)if(!c.animation.hasTimeline(l)){if(t.mixDuration>0){n[r]=Qs,h[r]=c;continue t}break}n[r]=ge}}}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 Js{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,e<=0&&(this.previous!=null?e=Math.max(e+this.previous.getTrackComplete()-t,0):e=0),this.delay=e}mixBlend=P.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 t==0?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(t!=0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}}class Ks{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(ot.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(ot.interrupt),this.objects.push(t)}end(t){this.objects.push(ot.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(ot.dispose),this.objects.push(t)}complete(t){this.objects.push(ot.complete),this.objects.push(t)}event(t,e){this.objects.push(ot.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 i=t[s],n=t[s+1];switch(i){case ot.start:n.listener&&n.listener.start&&n.listener.start(n);for(let a=0;a<e.length;a++){let r=e[a];r.start&&r.start(n)}break;case ot.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let a=0;a<e.length;a++){let r=e[a];r.interrupt&&r.interrupt(n)}break;case ot.end:n.listener&&n.listener.end&&n.listener.end(n);for(let a=0;a<e.length;a++){let r=e[a];r.end&&r.end(n)}case ot.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let a=0;a<e.length;a++){let r=e[a];r.dispose&&r.dispose(n)}this.animState.trackEntryPool.free(n);break;case ot.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let a=0;a<e.length;a++){let r=e[a];r.complete&&r.complete(n)}break;case ot.event:let h=t[s+++2];n.listener&&n.listener.event&&n.listener.event(n,h);for(let a=0;a<e.length;a++){let r=e[a];r.event&&r.event(n,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}}var ot;(function(C){C[C.start=0]="start",C[C.interrupt=1]="interrupt",C[C.end=2]="end",C[C.dispose=3]="dispose",C[C.complete=4]="complete",C[C.event=5]="event"})(ot||(ot={}));class dr{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}}const me=0,Pe=1,Re=2,ge=3,Qs=4,Be=1,Zs=2;class ti{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);let n=this.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);this.setMixWith(i,n,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let i=t.name+"."+e.name;this.animationToMixTime[i]=s}getMix(t,e){let s=t.name+"."+e.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}}class he extends pt{color=new V(1,1,1,1);constructor(t){super(t)}copy(){let t=new he(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class Yt extends pt{endSlot=null;color=new V(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new Yt(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class ws{_image;constructor(t){this._image=t}getImage(){return this._image}}var tt;(function(C){C[C.Nearest=9728]="Nearest",C[C.Linear=9729]="Linear",C[C.MipMap=9987]="MipMap",C[C.MipMapNearestNearest=9984]="MipMapNearestNearest",C[C.MipMapLinearNearest=9985]="MipMapLinearNearest",C[C.MipMapNearestLinear=9986]="MipMapNearestLinear",C[C.MipMapLinearLinear=9987]="MipMapLinearLinear"})(tt||(tt={}));var St;(function(C){C[C.MirroredRepeat=33648]="MirroredRepeat",C[C.ClampToEdge=33071]="ClampToEdge",C[C.Repeat=10497]="Repeat"})(St||(St={}));class ei{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0}class fr extends ws{setFilters(t,e){}setWraps(t,e){}dispose(){}}class be{pages=new Array;regions=new Array;constructor(t){let e=new si(t),s=new Array(4),i={};i.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},i.format=()=>{},i.filter=l=>{l.minFilter=E.enumValue(tt,s[1]),l.magFilter=E.enumValue(tt,s[2])},i.repeat=l=>{s[1].indexOf("x")!=-1&&(l.uWrap=St.Repeat),s[1].indexOf("y")!=-1&&(l.vWrap=St.Repeat)},i.pma=l=>{l.pma=s[1]=="true"};var n={};n.xy=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2])},n.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},n.bounds=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2]),l.width=parseInt(s[3]),l.height=parseInt(s[4])},n.offset=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2])},n.orig=l=>{l.originalWidth=parseInt(s[1]),l.originalHeight=parseInt(s[2])},n.offsets=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2]),l.originalWidth=parseInt(s[3]),l.originalHeight=parseInt(s[4])},n.rotate=l=>{let c=s[1];c=="true"?l.degrees=90:c!="false"&&(l.degrees=parseInt(c))},n.index=l=>{l.index=parseInt(s[1])};let h=e.readLine();for(;h&&h.trim().length==0;)h=e.readLine();for(;!(!h||h.trim().length==0||e.readEntry(s,h)==0);)h=e.readLine();let a=null,r=null,o=null;for(;h!==null;)if(h.trim().length==0)a=null,h=e.readLine();else if(a){let l=new ys(a,h);for(;;){let c=e.readEntry(s,h=e.readLine());if(c==0)break;let d=n[s[0]];if(d)d(l);else{r||(r=[]),o||(o=[]),r.push(s[0]);let u=[];for(let f=0;f<c;f++)u.push(parseInt(s[f+1]));o.push(u)}}l.originalWidth==0&&l.originalHeight==0&&(l.originalWidth=l.width,l.originalHeight=l.height),r&&r.length>0&&o&&o.length>0&&(l.names=r,l.values=o,r=null,o=null),l.u=l.x/a.width,l.v=l.y/a.height,l.degrees==90?(l.u2=(l.x+l.height)/a.width,l.v2=(l.y+l.width)/a.height):(l.u2=(l.x+l.width)/a.width,l.v2=(l.y+l.height)/a.height),this.regions.push(l)}else{for(a=new ii(h.trim());e.readEntry(s,h=e.readLine())!=0;){let l=i[s[0]];l&&l(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 si{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||(e=e.trim(),e.length==0))return 0;let s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let i=1,n=s+1;;i++){let h=e.indexOf(",",n);if(h==-1)return t[i]=e.substr(n).trim(),i;if(t[i]=e.substr(n,h-n).trim(),n=h+1,i==4)return 4}}}class ii{name;minFilter=tt.Nearest;magFilter=tt.Nearest;uWrap=St.ClampToEdge;vWrap=St.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 ys extends ei{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 ft extends pt{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new V(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new V(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=E.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,i=this.region.u,n=this.region.v,h=0,a=0;if(this.region instanceof ys){let r=this.region,o=r.page,l=o.width,c=o.height;switch(r.degrees){case 90:i-=(r.originalHeight-r.offsetY-r.height)/l,n-=(r.originalWidth-r.offsetX-r.width)/c,h=r.originalHeight/l,a=r.originalWidth/c;for(let d=0;d<s;d+=2)e[d]=i+t[d+1]*h,e[d+1]=n+(1-t[d])*a;return;case 180:i-=(r.originalWidth-r.offsetX-r.width)/l,n-=r.offsetY/c,h=r.originalWidth/l,a=r.originalHeight/c;for(let d=0;d<s;d+=2)e[d]=i+(1-t[d])*h,e[d+1]=n+(1-t[d+1])*a;return;case 270:i-=r.offsetY/l,n-=r.offsetX/c,h=r.originalHeight/l,a=r.originalWidth/c;for(let d=0;d<s;d+=2)e[d]=i+(1-t[d+1])*h,e[d+1]=n+t[d]*a;return}i-=r.offsetX/l,n-=(r.originalHeight-r.offsetY-r.height)/c,h=r.originalWidth/l,a=r.originalHeight/c}else this.region?(h=this.region.u2-i,a=this.region.v2-n):(i=n=0,h=a=1);for(let r=0;r<s;r+=2)e[r]=i+t[r]*h,e[r+1]=n+t[r+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 ft(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),E.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=this.uvs instanceof Float32Array?E.newFloatArray(this.uvs.length):new Array(this.uvs.length),E.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),E.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),E.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,i,n,h){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,i,n,h)}newLinkedMesh(){let t=new ft(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),t.region!=null&&t.updateRegion(),t}}class Rt extends pt{lengths=[];closed=!1;constantSpeed=!1;color=new V(1,1,1,1);constructor(t){super(t)}copy(){let t=new Rt(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),E.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class Ce extends pt{x=0;y=0;rotation=0;color=new V(.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*B.degRad,s=Math.cos(e),i=Math.sin(e),n=s*t.a+i*t.b,h=s*t.c+i*t.d;return B.atan2Deg(h,n)}copy(){let t=new Ce(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}class dt extends Ue{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new V(1,1,1,1);path;region=null;sequence=null;offset=E.newFloatArray(8);uvs=E.newFloatArray(8);tempColor=new V(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(t==null){e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=1,e[5]=1,e[6]=1,e[7]=0;return}let s=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*s,h=-this.height/2*this.scaleY+this.region.offsetY*i,a=n+this.region.width*s,r=h+this.region.height*i,o=this.rotation*B.degRad,l=Math.cos(o),c=Math.sin(o),d=this.x,u=this.y,f=n*l+d,m=n*c,g=h*l+u,w=h*c,b=a*l+d,p=a*c,x=r*l+u,y=r*c,v=this.offset;v[0]=f-w,v[1]=g+m,v[2]=f-y,v[3]=x+m,v[4]=b-y,v[5]=x+p,v[6]=b-w,v[7]=g+p,t.degrees==90?(e[0]=t.u2,e[1]=t.v2,e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,i){this.sequence!=null&&this.sequence.apply(t,this);let n=t.bone,h=this.offset,a=n.worldX,r=n.worldY,o=n.a,l=n.b,c=n.c,d=n.d,u=0,f=0;u=h[0],f=h[1],e[s]=u*o+f*l+a,e[s+1]=u*c+f*d+r,s+=i,u=h[2],f=h[3],e[s]=u*o+f*l+a,e[s+1]=u*c+f*d+r,s+=i,u=h[4],f=h[5],e[s]=u*o+f*l+a,e[s+1]=u*c+f*d+r,s+=i,u=h[6],f=h[7],e[s]=u*o+f*l+a,e[s+1]=u*c+f*d+r}copy(){let t=new dt(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,E.arrayCopy(this.uvs,0,t.uvs,0,8),E.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=this.sequence!=null?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 ri{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let i=s.regions;for(let n=0,h=i.length;n<h;n++){let a=s.getPath(e,n),r=this.atlas.findRegion(a);if(r==null)throw new Error("Region not found in atlas: "+a+" (sequence: "+t+")");i[n]=r}}newRegionAttachment(t,e,s,i){let n=new dt(e,s);if(i!=null)this.loadSequence(e,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");n.region=h}return n}newMeshAttachment(t,e,s,i){let n=new ft(e,s);if(i!=null)this.loadSequence(e,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");n.region=h}return n}newBoundingBoxAttachment(t,e){return new he(e)}newPathAttachment(t,e){return new Rt(e)}newPointAttachment(t,e){return new Ce(e)}newClippingAttachment(t,e){return new Yt(e)}}class vs{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=K.Normal;skinRequired=!1;color=new V;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}}var K;(function(C){C[C.Normal=0]="Normal",C[C.OnlyTranslation=1]="OnlyTranslation",C[C.NoRotationOrReflection=2]="NoRotationOrReflection",C[C.NoScale=3]="NoScale",C[C.NoScaleOrReflection=4]="NoScaleOrReflection"})(K||(K={}));class Ee{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=K.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,i,n,h,a){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=n,this.ashearX=h,this.ashearY=a;let r=this.parent;if(!r){let u=this.skeleton;const f=u.scaleX,m=u.scaleY,g=(s+h)*B.degRad,w=(s+90+a)*B.degRad;this.a=Math.cos(g)*i*f,this.b=Math.cos(w)*n*f,this.c=Math.sin(g)*i*m,this.d=Math.sin(w)*n*m,this.worldX=t*f+u.x,this.worldY=e*m+u.y;return}let o=r.a,l=r.b,c=r.c,d=r.d;switch(this.worldX=o*t+l*e+r.worldX,this.worldY=c*t+d*e+r.worldY,this.inherit){case K.Normal:{const u=(s+h)*B.degRad,f=(s+90+a)*B.degRad,m=Math.cos(u)*i,g=Math.cos(f)*n,w=Math.sin(u)*i,b=Math.sin(f)*n;this.a=o*m+l*w,this.b=o*g+l*b,this.c=c*m+d*w,this.d=c*g+d*b;return}case K.OnlyTranslation:{const u=(s+h)*B.degRad,f=(s+90+a)*B.degRad;this.a=Math.cos(u)*i,this.b=Math.cos(f)*n,this.c=Math.sin(u)*i,this.d=Math.sin(f)*n;break}case K.NoRotationOrReflection:{let u=1/this.skeleton.scaleX,f=1/this.skeleton.scaleY;o*=u,c*=f;let m=o*o+c*c,g=0;m>1e-4?(m=Math.abs(o*d*f-l*u*c)/m,l=c*m,d=o*m,g=Math.atan2(c,o)*B.radDeg):(o=0,c=0,g=90-Math.atan2(d,l)*B.radDeg);const w=(s+h-g)*B.degRad,b=(s+a-g+90)*B.degRad,p=Math.cos(w)*i,x=Math.cos(b)*n,y=Math.sin(w)*i,v=Math.sin(b)*n;this.a=o*p-l*y,this.b=o*x-l*v,this.c=c*p+d*y,this.d=c*x+d*v;break}case K.NoScale:case K.NoScaleOrReflection:{s*=B.degRad;const u=Math.cos(s),f=Math.sin(s);let m=(o*u+l*f)/this.skeleton.scaleX,g=(c*u+d*f)/this.skeleton.scaleY,w=Math.sqrt(m*m+g*g);w>1e-5&&(w=1/w),m*=w,g*=w,w=Math.sqrt(m*m+g*g),this.inherit==K.NoScale&&o*d-l*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(w=-w),s=Math.PI/2+Math.atan2(g,m);const b=Math.cos(s)*w,p=Math.sin(s)*w;h*=B.degRad,a=(90+a)*B.degRad;const x=Math.cos(h)*i,y=Math.cos(a)*n,v=Math.sin(h)*i,A=Math.sin(a)*n;this.a=m*x+b*v,this.b=m*y+b*A,this.c=g*x+p*v,this.d=g*y+p*A;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){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*B.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*B.radDeg;return}let e=t.a,s=t.b,i=t.c,n=t.d,h=1/(e*n-s*i),a=n*h,r=s*h,o=i*h,l=e*h,c=this.worldX-t.worldX,d=this.worldY-t.worldY;this.ax=c*a-d*r,this.ay=d*l-c*o;let u,f,m,g;if(this.inherit==K.OnlyTranslation)u=this.a,f=this.b,m=this.c,g=this.d;else{switch(this.inherit){case K.NoRotationOrReflection:{let y=Math.abs(e*n-s*i)/(e*e+i*i);s=-i*this.skeleton.scaleX*y/this.skeleton.scaleY,n=e*this.skeleton.scaleY*y/this.skeleton.scaleX,h=1/(e*n-s*i),a=n*h,r=s*h;break}case K.NoScale:case K.NoScaleOrReflection:let w=B.cosDeg(this.rotation),b=B.sinDeg(this.rotation);e=(e*w+s*b)/this.skeleton.scaleX,i=(i*w+n*b)/this.skeleton.scaleY;let p=Math.sqrt(e*e+i*i);p>1e-5&&(p=1/p),e*=p,i*=p,p=Math.sqrt(e*e+i*i),this.inherit==K.NoScale&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p);let x=B.PI/2+Math.atan2(i,e);s=Math.cos(x)*p,n=Math.sin(x)*p,h=1/(e*n-s*i),a=n*h,r=s*h,o=i*h,l=e*h}u=a*this.a-r*this.c,f=a*this.b-r*this.d,m=l*this.c-o*this.a,g=l*this.d-o*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(u*u+m*m),this.ascaleX>1e-4){let w=u*g-f*m;this.ascaleY=w/this.ascaleX,this.ashearY=-Math.atan2(u*f+m*g,w)*B.radDeg,this.arotation=Math.atan2(m,u)*B.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,f)*B.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*B.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*B.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,i=t.y-this.worldY;return t.x=s*this.d*e-i*this.b*e,t.y=i*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=B.sinDeg(t),s=B.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*B.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=B.sinDeg(t),s=B.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*B.radDeg}rotateWorld(t){t*=B.degRad;const e=Math.sin(t),s=Math.cos(t),i=this.a,n=this.b;this.a=s*i-e*this.c,this.b=s*n-e*this.d,this.c=e*i+s*this.c,this.d=e*n+s*this.d}}class ce{name;order;skinRequired;constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}class ur{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(t,e="",s=new ni,i=new Gt){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=i}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.cache.assets[e]=s,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise((e,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,n)=>{this.downloader.downloadBinary(t,h=>{this.success(e,t,h),i(h)},(h,a)=>{const r=`Couldn't load binary ${t}: status ${h}, ${a}`;this.error(s,t,r),n(r)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,i=>{this.success(e,t,i)},(i,n)=>{this.error(s,t,`Couldn't load text ${t}: status ${i}, ${n}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,n)=>{this.downloader.downloadJson(t,h=>{this.success(e,t,h),i(h)},(h,a)=>{const r=`Couldn't load JSON ${t}: status ${h}, ${a}`;this.error(s,t,r),n(r)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const i=this.cache.assetsLoaded[t],n=i!==void 0;return n&&(this.cache.assetsLoaded[t]=i.then(h=>(h=h instanceof Image||h instanceof ImageBitmap?this.textureLoader(h):h,this.success(e,t,h),h)).catch(h=>this.error(s,t,h))),n}loadTexture(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,n)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(r=>{if(r.ok)return r.blob();const o=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),n(o)}).then(r=>r?createImageBitmap(r,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(r=>{if(r){const o=this.createTexture(t,r);this.success(e,t,o),i(o)}});else{let r=new Image;r.crossOrigin="anonymous",r.onload=()=>{const o=this.createTexture(t,r);this.success(e,t,o),i(o)},r.onerror=()=>{const o=`Couldn't load image: ${t}`;this.error(s,t,o),n(o)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),r.src=t}}))}loadTextureAtlas(t,e=()=>{},s=()=>{},i){let n=t.lastIndexOf("/"),h=n>=0?t.substring(0,n+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((a,r)=>{this.downloader.downloadText(t,o=>{try{const l=this.createTextureAtlas(t,o);let c=l.pages.length,d=!1;for(let u of l.pages)this.loadTexture(i?i[u.name]:h+u.name,(f,m)=>{d||(u.setTexture(m),--c==0&&(this.success(e,t,l),a(l)))},(f,m)=>{if(!d){const g=`Couldn't load texture ${t} page image: ${f}`;this.error(s,t,g),r(g)}d=!0})}catch(l){const c=`Couldn't parse texture atlas ${t}: ${l.message}`;this.error(s,t,c),r(c)}},(o,l)=>{const c=`Couldn't load texture atlas ${t}: status ${o}, ${l}`;this.error(s,t,c),r(c)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{},i){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((n,h)=>{this.downloader.downloadText(t,a=>{try{const r=this.createTextureAtlas(t,a);this.success(e,t,r),n(r)}catch(r){const o=`Couldn't parse texture atlas ${t}: ${r.message}`;this.error(s,t,o),h(o)}},(a,r)=>{const o=`Couldn't load texture atlas ${t}: status ${a}, ${r}`;this.error(s,t,o),h(o)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(i,n)=>e(n),(i,n)=>s(n))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(i,n)=>e(n),(i,n)=>s(n))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(i,n)=>e(n),(i,n)=>s(n))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(i,n)=>e(n),(i,n)=>s(n))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(i,n)=>e(n),(i,n)=>s(n))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.cache.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?`
2
2
  `+s:""))}remove(t){t=this.pathPrefix+t;let e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(let t in this.cache.assets){let e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){const e=this.cache.assets[t];if(e instanceof be){e.dispose();return}this.disposeAssetInternal(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(t){if(this.cache.assetsRefCount[t]>0&&--this.cache.assetsRefCount[t]===0)return this.remove(t)}createTextureAtlas(t,e){const s=new be(e);return s.dispose=()=>{if(!(this.cache.assetsRefCount[t]<=0)){this.disposeAssetInternal(t);for(const i of s.pages)i.texture?.dispose()}},s}createTexture(t,e){const s=this.textureLoader(e),i=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(t)&&i()},s}}class Gt{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const e=Gt.AVAILABLE_CACHES.get(t);if(e)return e;const s=new Gt;return Gt.AVAILABLE_CACHES.set(t,s),s}async addAsset(t,e){this.assetsLoaded[t]=Promise.resolve(e),this.assets[t]=await e}}class ni{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!=-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,i=new Uint8Array(s),n=0;n<s;n++)i[n]=e.charCodeAt(n);return i}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e==-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToString(i))}catch(a){this.finish(t,400,JSON.stringify(a))}return}let n=new XMLHttpRequest;n.overrideMimeType("text/html"),n.open("GET",i||t,!0);let h=()=>{this.finish(t,n.status,n.responseText)};n.onload=h,n.onerror=h,n.send()}downloadJson(t,e,s){this.downloadText(t,i=>{e(JSON.parse(i))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(i))}catch(a){this.finish(t,400,JSON.stringify(a))}return}let n=new XMLHttpRequest;n.open("GET",i||t,!0),n.responseType="arraybuffer";let h=()=>{this.finish(t,n.status,n.response)};n.onload=()=>{n.status==200||n.status==0?this.finish(t,200,new Uint8Array(n.response)):h()},n.onerror=h,n.send()}start(t,e,s){let i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,s)}}finish(t,e,s){let i=this.callbacks[t];delete this.callbacks[t];let n=e==200||e==0?[s]:[e,s];for(let h=n.length-1,a=i.length;h<a;h+=2)i[h].apply(null,n)}}class Cs{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 As{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}}class ai{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 i=0;i<t.bones.length;i++){let n=e.findBone(t.bones[i].name);if(!n)throw new Error(`Couldn't find bone ${t.bones[i].name}`);this.bones.push(n)}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(this.mix==0)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);break}}apply1(t,e,s,i,n,h,a){let r=t.parent;if(!r)throw new Error("IK bone must have parent.");let o=r.a,l=r.b,c=r.c,d=r.d,u=-t.ashearX-t.arotation,f=0,m=0;switch(t.inherit){case K.OnlyTranslation:f=(e-t.worldX)*B.signum(t.skeleton.scaleX),m=(s-t.worldY)*B.signum(t.skeleton.scaleY);break;case K.NoRotationOrReflection:let b=Math.abs(o*d-l*c)/Math.max(1e-4,o*o+c*c),p=o/t.skeleton.scaleX,x=c/t.skeleton.scaleY;l=-x*b*t.skeleton.scaleX,d=p*b*t.skeleton.scaleY,u+=Math.atan2(x,p)*B.radDeg;default:let y=e-r.worldX,v=s-r.worldY,A=o*d-l*c;Math.abs(A)<=1e-4?(f=0,m=0):(f=(y*d-v*l)/A-t.ax,m=(v*o-y*c)/A-t.ay)}u+=Math.atan2(m,f)*B.radDeg,t.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let g=t.ascaleX,w=t.ascaleY;if(i||n){switch(t.inherit){case K.NoScale:case K.NoScaleOrReflection:f=e-t.worldX,m=s-t.worldY}const b=t.data.length*g;if(b>1e-4){const p=f*f+m*m;if(i&&p<b*b||n&&p>b*b){const x=(Math.sqrt(p)/b-1)*a+1;g*=x,h&&(w*=x)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*a,g,w,t.ashearX,t.ashearY)}apply2(t,e,s,i,n,h,a,r,o){if(t.inherit!=K.Normal||e.inherit!=K.Normal)return;let l=t.ax,c=t.ay,d=t.ascaleX,u=t.ascaleY,f=d,m=u,g=e.ascaleX,w=0,b=0,p=0;d<0?(d=-d,w=180,p=-1):(w=0,p=1),u<0&&(u=-u,p=-p),g<0?(g=-g,b=180):b=0;let x=e.ax,y=0,v=0,A=0,k=t.a,I=t.b,Y=t.c,T=t.d,R=Math.abs(d-u)<=1e-4;!R||h?(y=0,v=k*x+t.worldX,A=Y*x+t.worldY):(y=e.ay,v=k*x+I*y+t.worldX,A=Y*x+T*y+t.worldY);let X=t.parent;if(!X)throw new Error("IK parent must itself have a parent.");k=X.a,I=X.b,Y=X.c,T=X.d;let M=k*T-I*Y,F=v-X.worldX,L=A-X.worldY;M=Math.abs(M)<=1e-4?0:1/M;let O=(F*T-L*I)*M-l,W=(L*k-F*Y)*M-c,N=Math.sqrt(O*O+W*W),G=e.data.length*g,H,j;if(N<1e-4){this.apply1(t,s,i,!1,h,!1,o),e.updateWorldTransformWith(x,y,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}F=s-X.worldX,L=i-X.worldY;let D=(F*T-L*I)*M-l,U=(L*k-F*Y)*M-c,q=D*D+U*U;if(r!=0){r*=d*(g+1)*.5;let Q=Math.sqrt(q),st=Q-N-G*d+r;if(st>0){let it=Math.min(1,st/(r*2))-1;it=(st-r*(1-it*it))/Q,D-=it*D,U-=it*U,q=D*D+U*U}}t:if(R){G*=d;let Q=(q-N*N-G*G)/(2*N*G);Q<-1?(Q=-1,j=Math.PI*n):Q>1?(Q=1,j=0,h&&(k=(Math.sqrt(q)/(N+G)-1)*o+1,f*=k,a&&(m*=k))):j=Math.acos(Q)*n,k=N+G*Q,I=G*Math.sin(j),H=Math.atan2(U*k-D*I,D*k+U*I)}else{k=d*G,I=u*G;let Q=k*k,st=I*I,it=Math.atan2(U,D);Y=st*N*N+Q*q-Q*st;let It=-2*st*N,Wt=st-Q;if(T=It*It-4*Wt*Y,T>=0){let Et=Math.sqrt(T);It<0&&(Et=-Et),Et=-(It+Et)*.5;let Ut=Et/Wt,Me=Y/Et,Kt=Math.abs(Ut)<Math.abs(Me)?Ut:Me;if(Ut=q-Kt*Kt,Ut>=0){L=Math.sqrt(Ut)*n,H=it-Math.atan2(L,Kt),j=Math.atan2(L/u,(Kt-N)/d);break t}}let ke=B.PI,jt=N-k,de=jt*jt,Se=0,Ie=0,Jt=N+k,fe=Jt*Jt,Te=0;Y=-k*N/(Q-st),Y>=-1&&Y<=1&&(Y=Math.acos(Y),F=k*Math.cos(Y)+N,L=I*Math.sin(Y),T=F*F+L*L,T<de&&(ke=Y,de=T,jt=F,Se=L),T>fe&&(Ie=Y,fe=T,Jt=F,Te=L)),q<=(de+fe)*.5?(H=it-Math.atan2(Se*n,jt),j=ke*n):(H=it-Math.atan2(Te*n,Jt),j=Ie*n)}let ht=Math.atan2(y,x)*p,at=t.arotation;H=(H-ht)*B.radDeg+w-at,H>180?H-=360:H<-180&&(H+=360),t.updateWorldTransformWith(l,c,at+H*o,f,m,0,0),at=e.arotation,j=((j+ht)*B.radDeg-e.ashearX)*p+b-at,j>180?j-=360:j<-180&&(j+=360),e.updateWorldTransformWith(x,y,at+j*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class ks extends ce{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 Ss extends ce{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=vt.Fixed;spacingMode=Z.Fixed;rotateMode=Pt.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}}var vt;(function(C){C[C.Fixed=0]="Fixed",C[C.Percent=1]="Percent"})(vt||(vt={}));var Z;(function(C){C[C.Length=0]="Length",C[C.Fixed=1]="Fixed",C[C.Percent=2]="Percent",C[C.Proportional=3]="Proportional"})(Z||(Z={}));var Pt;(function(C){C[C.Tangent=0]="Tangent",C[C.Chain=1]="Chain",C[C.ChainScale=2]="ChainScale"})(Pt||(Pt={}));class At{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 i=0,n=t.bones.length;i<n;i++){let h=e.findBone(t.bones[i].name);if(!h)throw new Error(`Couldn't find bone ${t.bones[i].name}.`);this.bones.push(h)}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 Rt))return;let s=this.mixRotate,i=this.mixX,n=this.mixY;if(s==0&&i==0&&n==0)return;let h=this.data,a=h.rotateMode==Pt.Tangent,r=h.rotateMode==Pt.ChainScale,o=this.bones,l=o.length,c=a?l:l+1,d=E.setArraySize(this.spaces,c),u=r?this.lengths=E.setArraySize(this.lengths,l):[],f=this.spacing;switch(h.spacingMode){case Z.Percent:if(r)for(let v=0,A=c-1;v<A;v++){let k=o[v],I=k.data.length,Y=I*k.a,T=I*k.c;u[v]=Math.sqrt(Y*Y+T*T)}E.arrayFill(d,1,c,f);break;case Z.Proportional:let x=0;for(let v=0,A=c-1;v<A;){let k=o[v],I=k.data.length;if(I<At.epsilon)r&&(u[v]=0),d[++v]=f;else{let Y=I*k.a,T=I*k.c,R=Math.sqrt(Y*Y+T*T);r&&(u[v]=R),d[++v]=R,x+=R}}if(x>0){x=c/x*f;for(let v=1;v<c;v++)d[v]*=x}break;default:let y=h.spacingMode==Z.Length;for(let v=0,A=c-1;v<A;){let k=o[v],I=k.data.length;if(I<At.epsilon)r&&(u[v]=0),d[++v]=f;else{let Y=I*k.a,T=I*k.c,R=Math.sqrt(Y*Y+T*T);r&&(u[v]=R),d[++v]=(y?I+f:f)*R/I}}}let m=this.computeWorldPositions(e,c,a),g=m[0],w=m[1],b=h.offsetRotation,p=!1;if(b==0)p=h.rotateMode==Pt.Chain;else{p=!1;let x=this.target.bone;b*=x.a*x.d-x.b*x.c>0?B.degRad:-B.degRad}for(let x=0,y=3;x<l;x++,y+=3){let v=o[x];v.worldX+=(g-v.worldX)*i,v.worldY+=(w-v.worldY)*n;let A=m[y],k=m[y+1],I=A-g,Y=k-w;if(r){let T=u[x];if(T!=0){let R=(Math.sqrt(I*I+Y*Y)/T-1)*s+1;v.a*=R,v.c*=R}}if(g=A,w=k,s>0){let T=v.a,R=v.b,X=v.c,M=v.d,F=0,L=0,O=0;if(a?F=m[y-1]:d[x+1]==0?F=m[y+2]:F=Math.atan2(Y,I),F-=Math.atan2(X,T),p){L=Math.cos(F),O=Math.sin(F);let W=v.data.length;g+=(W*(L*T-O*X)-I)*s,w+=(W*(O*T+L*X)-Y)*s}else F+=b;F>B.PI?F-=B.PI2:F<-B.PI&&(F+=B.PI2),F*=s,L=Math.cos(F),O=Math.sin(F),v.a=L*T-O*X,v.b=L*R-O*M,v.c=O*T+L*X,v.d=O*R+L*M}v.updateAppliedTransform()}}computeWorldPositions(t,e,s){let i=this.target,n=this.position,h=this.spaces,a=E.setArraySize(this.positions,e*3+2),r=this.world,o=t.closed,l=t.worldVerticesLength,c=l/6,d=At.NONE;if(!t.constantSpeed){let W=t.lengths;c-=o?1:2;let N=W[c];this.data.positionMode==vt.Percent&&(n*=N);let G;switch(this.data.spacingMode){case Z.Percent:G=N;break;case Z.Proportional:G=N/e;break;default:G=1}r=E.setArraySize(this.world,8);for(let H=0,j=0,D=0;H<e;H++,j+=3){let U=h[H]*G;n+=U;let q=n;if(o)q%=N,q<0&&(q+=N),D=0;else if(q<0){d!=At.BEFORE&&(d=At.BEFORE,t.computeWorldVertices(i,2,4,r,0,2)),this.addBeforePosition(q,r,0,a,j);continue}else if(q>N){d!=At.AFTER&&(d=At.AFTER,t.computeWorldVertices(i,l-6,4,r,0,2)),this.addAfterPosition(q-N,r,0,a,j);continue}for(;;D++){let ht=W[D];if(!(q>ht)){if(D==0)q/=ht;else{let at=W[D-1];q=(q-at)/(ht-at)}break}}D!=d&&(d=D,o&&D==c?(t.computeWorldVertices(i,l-4,4,r,0,2),t.computeWorldVertices(i,0,4,r,4,2)):t.computeWorldVertices(i,D*6+2,8,r,0,2)),this.addCurvePosition(q,r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],a,j,s||H>0&&U==0)}return a}o?(l+=2,r=E.setArraySize(this.world,l),t.computeWorldVertices(i,2,l-4,r,0,2),t.computeWorldVertices(i,0,2,r,l-4,2),r[l-2]=r[0],r[l-1]=r[1]):(c--,l-=4,r=E.setArraySize(this.world,l),t.computeWorldVertices(i,2,l,r,0,2));let u=E.setArraySize(this.curves,c),f=0,m=r[0],g=r[1],w=0,b=0,p=0,x=0,y=0,v=0,A=0,k=0,I=0,Y=0,T=0,R=0,X=0,M=0;for(let W=0,N=2;W<c;W++,N+=6)w=r[N],b=r[N+1],p=r[N+2],x=r[N+3],y=r[N+4],v=r[N+5],A=(m-w*2+p)*.1875,k=(g-b*2+x)*.1875,I=((w-p)*3-m+y)*.09375,Y=((b-x)*3-g+v)*.09375,T=A*2+I,R=k*2+Y,X=(w-m)*.75+A+I*.16666667,M=(b-g)*.75+k+Y*.16666667,f+=Math.sqrt(X*X+M*M),X+=T,M+=R,T+=I,R+=Y,f+=Math.sqrt(X*X+M*M),X+=T,M+=R,f+=Math.sqrt(X*X+M*M),X+=T+I,M+=R+Y,f+=Math.sqrt(X*X+M*M),u[W]=f,m=y,g=v;this.data.positionMode==vt.Percent&&(n*=f);let F;switch(this.data.spacingMode){case Z.Percent:F=f;break;case Z.Proportional:F=f/e;break;default:F=1}let L=this.segments,O=0;for(let W=0,N=0,G=0,H=0;W<e;W++,N+=3){let j=h[W]*F;n+=j;let D=n;if(o)D%=f,D<0&&(D+=f),G=0;else if(D<0){this.addBeforePosition(D,r,0,a,N);continue}else if(D>f){this.addAfterPosition(D-f,r,l-4,a,N);continue}for(;;G++){let U=u[G];if(!(D>U)){if(G==0)D/=U;else{let q=u[G-1];D=(D-q)/(U-q)}break}}if(G!=d){d=G;let U=G*6;for(m=r[U],g=r[U+1],w=r[U+2],b=r[U+3],p=r[U+4],x=r[U+5],y=r[U+6],v=r[U+7],A=(m-w*2+p)*.03,k=(g-b*2+x)*.03,I=((w-p)*3-m+y)*.006,Y=((b-x)*3-g+v)*.006,T=A*2+I,R=k*2+Y,X=(w-m)*.3+A+I*.16666667,M=(b-g)*.3+k+Y*.16666667,O=Math.sqrt(X*X+M*M),L[0]=O,U=1;U<8;U++)X+=T,M+=R,T+=I,R+=Y,O+=Math.sqrt(X*X+M*M),L[U]=O;X+=T,M+=R,O+=Math.sqrt(X*X+M*M),L[8]=O,X+=T+I,M+=R+Y,O+=Math.sqrt(X*X+M*M),L[9]=O,H=0}for(D*=O;;H++){let U=L[H];if(!(D>U)){if(H==0)D/=U;else{let q=L[H-1];D=H+(D-q)/(U-q)}break}}this.addCurvePosition(D*.1,m,g,w,b,p,x,y,v,a,N,s||W>0&&j==0)}return a}addBeforePosition(t,e,s,i,n){let h=e[s],a=e[s+1],r=e[s+2]-h,o=e[s+3]-a,l=Math.atan2(o,r);i[n]=h+t*Math.cos(l),i[n+1]=a+t*Math.sin(l),i[n+2]=l}addAfterPosition(t,e,s,i,n){let h=e[s+2],a=e[s+3],r=h-e[s],o=a-e[s+1],l=Math.atan2(o,r);i[n]=h+t*Math.cos(l),i[n+1]=a+t*Math.sin(l),i[n+2]=l}addCurvePosition(t,e,s,i,n,h,a,r,o,l,c,d){if(t==0||isNaN(t)){l[c]=e,l[c+1]=s,l[c+2]=Math.atan2(n-s,i-e);return}let u=t*t,f=u*t,m=1-t,g=m*m,w=g*m,b=m*t,p=b*3,x=m*p,y=p*t,v=e*w+i*x+h*y+r*f,A=s*w+n*x+a*y+o*f;l[c]=v,l[c+1]=A,d&&(t<.001?l[c+2]=Math.atan2(n-s,i-e):l[c+2]=Math.atan2(A-(s*g+n*b*2+a*u),v-(e*g+i*b*2+h*u)))}}class oi{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(e==0)return;const s=this.data.x>0,i=this.data.y>0,n=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,a=this.bone,r=a.data.length;switch(t){case gt.none:return;case gt.reset:this.reset();case gt.update:const o=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=o.time;const c=a.worldX,d=a.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let u=this.remaining,f=this.inertia,m=this.data.step,g=this.skeleton.data.referenceScale,w=-1,b=this.data.limit*l,p=b*Math.abs(o.scaleY);if(b*=Math.abs(o.scaleX),s||i){if(s){const x=(this.ux-c)*f;this.xOffset+=x>b?b:x<-b?-b:x,this.ux=c}if(i){const x=(this.uy-d)*f;this.yOffset+=x>p?p:x<-p?-p:x,this.uy=d}if(u>=m){w=Math.pow(this.damping,60*m);const x=this.massInverse*m,y=this.strength,v=this.wind*g*o.scaleX,A=this.gravity*g*o.scaleY;do s&&(this.xVelocity+=(v-this.xOffset*y)*x,this.xOffset+=this.xVelocity*m,this.xVelocity*=w),i&&(this.yVelocity-=(A+this.yOffset*y)*x,this.yOffset+=this.yVelocity*m,this.yVelocity*=w),u-=m;while(u>=m)}s&&(a.worldX+=this.xOffset*e*this.data.x),i&&(a.worldY+=this.yOffset*e*this.data.y)}if(n||h){let x=Math.atan2(a.c,a.a),y=0,v=0,A=0,k=this.cx-a.worldX,I=this.cy-a.worldY;if(k>b?k=b:k<-b&&(k=-b),I>p?I=p:I<-p&&(I=-p),n){A=(this.data.rotate+this.data.shearX)*e;let Y=Math.atan2(I+this.ty,k+this.tx)-x-this.rotateOffset*A;this.rotateOffset+=(Y-Math.ceil(Y*B.invPI2-.5)*B.PI2)*f,Y=this.rotateOffset*A+x,y=Math.cos(Y),v=Math.sin(Y),h&&(Y=r*a.getWorldScaleX(),Y>0&&(this.scaleOffset+=(k*y+I*v)*f/Y))}else{y=Math.cos(x),v=Math.sin(x);const Y=r*a.getWorldScaleX();Y>0&&(this.scaleOffset+=(k*y+I*v)*f/Y)}if(u=this.remaining,u>=m){w==-1&&(w=Math.pow(this.damping,60*m));const Y=this.massInverse*m,T=this.strength,R=this.wind,X=Ft.yDown?-this.gravity:this.gravity,M=r/g;for(;;)if(u-=m,h&&(this.scaleVelocity+=(R*y-X*v-this.scaleOffset*T)*Y,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=w),n){if(this.rotateVelocity-=((R*v+X*y)*M+this.rotateOffset*T)*Y,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=w,u<m)break;const F=this.rotateOffset*A+x;y=Math.cos(F),v=Math.sin(F)}else if(u<m)break}}this.remaining=u}this.cx=a.worldX,this.cy=a.worldY;break;case gt.pose:s&&(a.worldX+=this.xOffset*e*this.data.x),i&&(a.worldY+=this.yOffset*e*this.data.y)}if(n){let o=this.rotateOffset*e,l=0,c=0,d=0;if(this.data.shearX>0){let u=0;this.data.rotate>0&&(u=o*this.data.rotate,l=Math.sin(u),c=Math.cos(u),d=a.b,a.b=c*d-l*a.d,a.d=l*d+c*a.d),u+=o*this.data.shearX,l=Math.sin(u),c=Math.cos(u),d=a.a,a.a=c*d-l*a.c,a.c=l*d+c*a.c}else o*=this.data.rotate,l=Math.sin(o),c=Math.cos(o),d=a.a,a.a=c*d-l*a.c,a.c=l*d+c*a.c,d=a.b,a.b=c*d-l*a.d,a.d=l*d+c*a.d}if(h){const o=1+this.scaleOffset*e*this.data.scaleX;a.a*=o,a.c*=o}t!=gt.pose&&(this.tx=r*a.a,this.ty=r*a.c),a.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const i=s*B.degRad,n=Math.cos(i),h=Math.sin(i),a=this.cx-t,r=this.cy-e;this.translate(a*n-r*h-a,a*h+r*n-r)}}class li{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 V,this.darkColor=t.darkColor?new V:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof pt)||!(this.attachment instanceof pt)||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 hi{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new ie;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 i=0;i<t.bones.length;i++){let n=e.findBone(t.bones[i].name);if(!n)throw new Error(`Couldn't find bone ${t.bones[i].name}.`);this.bones.push(n)}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){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,a=e!=0||s!=0,r=this.target,o=r.a,l=r.b,c=r.c,d=r.d,u=o*d-l*c>0?B.degRad:-B.degRad,f=this.data.offsetRotation*u,m=this.data.offsetShearY*u,g=this.bones;for(let w=0,b=g.length;w<b;w++){let p=g[w];if(t!=0){let x=p.a,y=p.b,v=p.c,A=p.d,k=Math.atan2(c,o)-Math.atan2(v,x)+f;k>B.PI?k-=B.PI2:k<-B.PI&&(k+=B.PI2),k*=t;let I=Math.cos(k),Y=Math.sin(k);p.a=I*x-Y*v,p.b=I*y-Y*A,p.c=Y*x+I*v,p.d=Y*y+I*A}if(a){let x=this.temp;r.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),p.worldX+=(x.x-p.worldX)*e,p.worldY+=(x.y-p.worldY)*s}if(i!=0){let x=Math.sqrt(p.a*p.a+p.c*p.c);x!=0&&(x=(x+(Math.sqrt(o*o+c*c)-x+this.data.offsetScaleX)*i)/x),p.a*=x,p.c*=x}if(n!=0){let x=Math.sqrt(p.b*p.b+p.d*p.d);x!=0&&(x=(x+(Math.sqrt(l*l+d*d)-x+this.data.offsetScaleY)*n)/x),p.b*=x,p.d*=x}if(h>0){let x=p.b,y=p.d,v=Math.atan2(y,x),A=Math.atan2(d,l)-Math.atan2(c,o)-(v-Math.atan2(p.c,p.a));A>B.PI?A-=B.PI2:A<-B.PI&&(A+=B.PI2),A=v+(A+m)*h;let k=Math.sqrt(x*x+y*y);p.b=Math.cos(A)*k,p.d=Math.sin(A)*k}p.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,a=e!=0||s!=0,r=this.target,o=r.a,l=r.b,c=r.c,d=r.d,u=o*d-l*c>0?B.degRad:-B.degRad,f=this.data.offsetRotation*u,m=this.data.offsetShearY*u,g=this.bones;for(let w=0,b=g.length;w<b;w++){let p=g[w];if(t!=0){let x=p.a,y=p.b,v=p.c,A=p.d,k=Math.atan2(c,o)+f;k>B.PI?k-=B.PI2:k<-B.PI&&(k+=B.PI2),k*=t;let I=Math.cos(k),Y=Math.sin(k);p.a=I*x-Y*v,p.b=I*y-Y*A,p.c=Y*x+I*v,p.d=Y*y+I*A}if(a){let x=this.temp;r.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),p.worldX+=x.x*e,p.worldY+=x.y*s}if(i!=0){let x=(Math.sqrt(o*o+c*c)-1+this.data.offsetScaleX)*i+1;p.a*=x,p.c*=x}if(n!=0){let x=(Math.sqrt(l*l+d*d)-1+this.data.offsetScaleY)*n+1;p.b*=x,p.d*=x}if(h>0){let x=Math.atan2(d,l)-Math.atan2(c,o);x>B.PI?x-=B.PI2:x<-B.PI&&(x+=B.PI2);let y=p.b,v=p.d;x=Math.atan2(v,y)+(x-B.PI/2+m)*h;let A=Math.sqrt(y*y+v*v);p.b=Math.cos(x)*A,p.d=Math.sin(x)*A}p.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,a=this.target,r=this.bones;for(let o=0,l=r.length;o<l;o++){let c=r[o],d=c.arotation;t!=0&&(d+=(a.arotation-d+this.data.offsetRotation)*t);let u=c.ax,f=c.ay;u+=(a.ax-u+this.data.offsetX)*e,f+=(a.ay-f+this.data.offsetY)*s;let m=c.ascaleX,g=c.ascaleY;i!=0&&m!=0&&(m=(m+(a.ascaleX-m+this.data.offsetScaleX)*i)/m),n!=0&&g!=0&&(g=(g+(a.ascaleY-g+this.data.offsetScaleY)*n)/g);let w=c.ashearY;h!=0&&(w+=(a.ashearY-w+this.data.offsetShearY)*h),c.updateWorldTransformWith(u,f,d,m,g,c.ashearX,w)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,a=this.target,r=this.bones;for(let o=0,l=r.length;o<l;o++){let c=r[o],d=c.arotation+(a.arotation+this.data.offsetRotation)*t,u=c.ax+(a.ax+this.data.offsetX)*e,f=c.ay+(a.ay+this.data.offsetY)*s,m=c.ascaleX*((a.ascaleX-1+this.data.offsetScaleX)*i+1),g=c.ascaleY*((a.ascaleY-1+this.data.offsetScaleY)*n+1),w=c.ashearY+(a.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(u,f,d,m,g,c.ashearX,w)}}}class Ft{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 Ft.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=t.bones[e],i;if(!s.parent)i=new Ee(s,this,null);else{let n=this.bones[s.parent.index];i=new Ee(s,this,n),n.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let s=t.slots[e],i=this.bones[s.boneData.index],n=new li(s,i);this.slots.push(n),this.drawOrder.push(n)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let s=t.ikConstraints[e];this.ikConstraints.push(new ai(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new hi(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new At(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new oi(s,this))}this.color=new V(1,1,1,1),this.updateCache()}updateCache(){let t=this._updateCache;t.length=0;let e=this.bones;for(let d=0,u=e.length;d<u;d++){let f=e[d];f.sorted=f.data.skinRequired,f.active=!f.sorted}if(this.skin){let d=this.skin.bones;for(let u=0,f=this.skin.bones.length;u<f;u++){let m=this.bones[d[u].index];do m.sorted=!1,m.active=!0,m=m.parent;while(m)}}let s=this.ikConstraints,i=this.transformConstraints,n=this.pathConstraints,h=this.physicsConstraints,a=s.length,r=i.length,o=n.length,l=this.physicsConstraints.length,c=a+r+o+l;t:for(let d=0;d<c;d++){for(let u=0;u<a;u++){let f=s[u];if(f.data.order==d){this.sortIkConstraint(f);continue t}}for(let u=0;u<r;u++){let f=i[u];if(f.data.order==d){this.sortTransformConstraint(f);continue t}}for(let u=0;u<o;u++){let f=n[u];if(f.data.order==d){this.sortPathConstraint(f);continue t}}for(let u=0;u<l;u++){const f=h[u];if(f.data.order==d){this.sortPhysicsConstraint(f);continue t}}}for(let d=0,u=e.length;d<u;d++)this.sortBone(e[d])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&E.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,i=s[0];if(this.sortBone(i),s.length==1)this._updateCache.push(t),this.sortReset(i.children);else{let n=s[s.length-1];this.sortBone(n),this._updateCache.push(t),this.sortReset(i.children),n.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&E.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,i=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,i);for(let r=0,o=this.data.skins.length;r<o;r++)this.sortPathConstraintAttachment(this.data.skins[r],s,i);let n=e.getAttachment();n instanceof Rt&&this.sortPathConstraintAttachmentWith(n,i);let h=t.bones,a=h.length;for(let r=0;r<a;r++)this.sortBone(h[r]);this._updateCache.push(t);for(let r=0;r<a;r++)this.sortReset(h[r].children);for(let r=0;r<a;r++)h[r].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&E.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 i=0;i<s;i++){let n=e[i];this.sortBone(n.parent),this.sortBone(n)}else for(let i=0;i<s;i++)this.sortBone(e[i]);this._updateCache.push(t);for(let i=0;i<s;i++)this.sortReset(e[i].children);for(let i=0;i<s;i++)e[i].sorted=!0}sortPathConstraintAttachment(t,e,s){let i=t.attachments[e];if(i)for(let n in i)this.sortPathConstraintAttachmentWith(i[n],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof Rt))return;let s=t.bones;if(!s)this.sortBone(e);else{let i=this.bones;for(let n=0,h=s.length;n<h;){let a=s[n++];for(a+=n;n<a;)this.sortBone(i[s[n++]])}}}sortPhysicsConstraint(t){const e=t.bone;t.active=e.active&&(!t.data.skinRequired||this.skin!=null&&E.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||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 i=t[e];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(t){if(t==null)throw new Error("physics is undefined");let e=this.bones;for(let i=0,n=e.length;i<n;i++){let h=e[i];h.ax=h.x,h.ay=h.y,h.arotation=h.rotation,h.ascaleX=h.scaleX,h.ascaleY=h.scaleY,h.ashearX=h.shearX,h.ashearY=h.shearY}let s=this._updateCache;for(let i=0,n=s.length;i<n;i++)s[i].update(t)}updateWorldTransformWith(t,e){if(!e)throw new Error("parent cannot be null.");let s=this.bones;for(let g=1,w=s.length;g<w;g++){let b=s[g];b.ax=b.x,b.ay=b.y,b.arotation=b.rotation,b.ascaleX=b.scaleX,b.ascaleY=b.scaleY,b.ashearX=b.shearX,b.ashearY=b.shearY}let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let n=e.a,h=e.b,a=e.c,r=e.d;i.worldX=n*this.x+h*this.y+e.worldX,i.worldY=a*this.x+r*this.y+e.worldY;const o=(i.rotation+i.shearX)*B.degRad,l=(i.rotation+90+i.shearY)*B.degRad,c=Math.cos(o)*i.scaleX,d=Math.cos(l)*i.scaleY,u=Math.sin(o)*i.scaleX,f=Math.sin(l)*i.scaleY;i.a=(n*c+h*u)*this.scaleX,i.b=(n*d+h*f)*this.scaleX,i.c=(a*c+r*u)*this.scaleY,i.d=(a*d+r*f)*this.scaleY;let m=this._updateCache;for(let g=0,w=m.length;g<w;g++){let b=m[g];b!=i&&b.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;E.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,s=t.length;e<s;e++)t[e].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let n=e[s];if(n.data.name==t)return n}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let n=e[s];if(n.data.name==t)return n}return null}setSkinByName(t){let e=this.data.findSkin(t);if(!e)throw new Error("Skin not found: "+t);this.setSkin(e)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let e=this.slots;for(let s=0,i=e.length;s<i;s++){let n=e[s],h=n.data.attachmentName;if(h){let a=t.getAttachment(s,h);a&&n.setAttachment(a)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,e){let s=this.data.findSlot(t);if(!s)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(s.index,e)}getAttachment(t,e){if(!e)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(t,e);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,n=s.length;i<n;i++){let h=s[i];if(h.data.name==t){let a=null;if(e&&(a=this.getAttachment(i,e),!a))throw new Error("Attachment not found: "+e+", for slot: "+t);h.setAttachment(a);return}}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(t==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(e=>e.data.name==t)??null}getBoundsRect(t){let e=new ie,s=new ie;return this.getBounds(e,s,void 0,t),{x:e.x,y:e.y,width:s.x,height:s.y}}getBounds(t,e,s=new Array(2),i=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let n=this.drawOrder,h=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let l=0,c=n.length;l<c;l++){let d=n[l];if(!d.bone.active)continue;let u=0,f=null,m=null,g=d.getAttachment();if(g instanceof dt)u=8,f=E.setArraySize(s,u,0),g.computeWorldVertices(d,f,0,2),m=Ft.quadTriangles;else if(g instanceof ft){let w=g;u=w.worldVerticesLength,f=E.setArraySize(s,u,0),w.computeWorldVertices(d,0,u,f,0,2),m=w.triangles}else if(g instanceof Yt&&i!=null){i.clipStart(d,g);continue}if(f&&m){i!=null&&i.isClipping()&&(i.clipTriangles(f,m,m.length),f=i.clippedVertices,u=i.clippedVertices.length);for(let w=0,b=f.length;w<b;w+=2){let p=f[w],x=f[w+1];h=Math.min(h,p),a=Math.min(a,x),r=Math.max(r,p),o=Math.max(o,x)}}i?.clipEndWithSlot(d)}i?.clipEnd(),t.set(h,a),e.set(r-h,o-a)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let i=0,n=s.length;i<n;i++)s[i].translate(t,e)}physicsRotate(t,e,s){const i=this.physicsConstraints;for(let n=0,h=i.length;n<h;n++)i[n].rotate(t,e,s)}}var gt;(function(C){C[C.none=0]="none",C[C.reset=1]="reset",C[C.update=2]="update",C[C.pose=3]="pose"})(gt||(gt={}));class Is extends ce{_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 ne{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let n=e[s];if(n.name==t)return n}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let n=e[s];if(n.name==t)return n}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,i=e.length;s<i;s++){let n=e[s];if(n.name==t)return n}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,i=e.length;s<i;s++){let n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,i=e.length;s<i;s++){let n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}}class Le{slotIndex;name;attachment;constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class ae{name;attachments=new Array;bones=Array();constraints=new Array;color=new V(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let i=0;i<t.bones.length;i++){let n=t.bones[i],h=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==n){h=!0;break}h||this.bones.push(n)}for(let i=0;i<t.constraints.length;i++){let n=t.constraints[i],h=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==n){h=!0;break}h||this.constraints.push(n)}let e=t.getAttachments();for(let i=0;i<e.length;i++){var s=e[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let i=0;i<t.bones.length;i++){let n=t.bones[i],h=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==n){h=!0;break}h||this.bones.push(n)}for(let i=0;i<t.constraints.length;i++){let n=t.constraints[i],h=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==n){h=!0;break}h||this.constraints.push(n)}let e=t.getAttachments();for(let i=0;i<e.length;i++){var s=e[i];s.attachment&&(s.attachment instanceof ft?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let i in s){let n=s[i];n&&t.push(new Le(e,i,n))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let i in s){let n=s[i];n&&e.push(new Le(t,i,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){let n=t.slots[i],h=n.getAttachment();if(h&&s<e.attachments.length){let a=e.attachments[s];for(let r in a){let o=a[r];if(h==o){let l=this.getAttachment(s,r);l&&n.setAttachment(l);break}}}s++}}}class Ts{index=0;name;boneData;color=new V(1,1,1,1);darkColor=null;attachmentName=null;blendMode=Tt.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}}var Tt;(function(C){C[C.Normal=0]="Normal",C[C.Additive=1]="Additive",C[C.Multiply=2]="Multiply",C[C.Screen=3]="Screen"})(Tt||(Tt={}));class Ms extends ce{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 ci{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new ne;s.name="";let i=new di(t),n=i.readInt32(),h=i.readInt32();s.hash=h==0&&n==0?null:h.toString(16)+n.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*e;let a=i.readBoolean();a&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let r=0;r=i.readInt(!0);for(let l=0;l<r;l++){let c=i.readString();if(!c)throw new Error("String in string table must not be null.");i.strings.push(c)}r=i.readInt(!0);for(let l=0;l<r;l++){let c=i.readString();if(!c)throw new Error("Bone name must not be null.");let d=l==0?null:s.bones[i.readInt(!0)],u=new vs(l,c,d);u.rotation=i.readFloat(),u.x=i.readFloat()*e,u.y=i.readFloat()*e,u.scaleX=i.readFloat(),u.scaleY=i.readFloat(),u.shearX=i.readFloat(),u.shearY=i.readFloat(),u.length=i.readFloat()*e,u.inherit=i.readByte(),u.skinRequired=i.readBoolean(),a&&(V.rgba8888ToColor(u.color,i.readInt32()),u.icon=i.readString()??void 0,u.visible=i.readBoolean()),s.bones.push(u)}r=i.readInt(!0);for(let l=0;l<r;l++){let c=i.readString();if(!c)throw new Error("Slot name must not be null.");let d=s.bones[i.readInt(!0)],u=new Ts(l,c,d);V.rgba8888ToColor(u.color,i.readInt32());let f=i.readInt32();f!=-1&&V.rgb888ToColor(u.darkColor=new V,f),u.attachmentName=i.readStringRef(),u.blendMode=i.readInt(!0),a&&(u.visible=i.readBoolean()),s.slots.push(u)}r=i.readInt(!0);for(let l=0,c;l<r;l++){let d=i.readString();if(!d)throw new Error("IK constraint data name must not be null.");let u=new ks(d);u.order=i.readInt(!0),c=i.readInt(!0);for(let m=0;m<c;m++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.bones[i.readInt(!0)];let f=i.readByte();u.skinRequired=(f&1)!=0,u.bendDirection=(f&2)!=0?1:-1,u.compress=(f&4)!=0,u.stretch=(f&8)!=0,u.uniform=(f&16)!=0,(f&32)!=0&&(u.mix=(f&64)!=0?i.readFloat():1),(f&128)!=0&&(u.softness=i.readFloat()*e),s.ikConstraints.push(u)}r=i.readInt(!0);for(let l=0,c;l<r;l++){let d=i.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let u=new Ms(d);u.order=i.readInt(!0),c=i.readInt(!0);for(let m=0;m<c;m++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.bones[i.readInt(!0)];let f=i.readByte();u.skinRequired=(f&1)!=0,u.local=(f&2)!=0,u.relative=(f&4)!=0,(f&8)!=0&&(u.offsetRotation=i.readFloat()),(f&16)!=0&&(u.offsetX=i.readFloat()*e),(f&32)!=0&&(u.offsetY=i.readFloat()*e),(f&64)!=0&&(u.offsetScaleX=i.readFloat()),(f&128)!=0&&(u.offsetScaleY=i.readFloat()),f=i.readByte(),(f&1)!=0&&(u.offsetShearY=i.readFloat()),(f&2)!=0&&(u.mixRotate=i.readFloat()),(f&4)!=0&&(u.mixX=i.readFloat()),(f&8)!=0&&(u.mixY=i.readFloat()),(f&16)!=0&&(u.mixScaleX=i.readFloat()),(f&32)!=0&&(u.mixScaleY=i.readFloat()),(f&64)!=0&&(u.mixShearY=i.readFloat()),s.transformConstraints.push(u)}r=i.readInt(!0);for(let l=0,c;l<r;l++){let d=i.readString();if(!d)throw new Error("Path constraint data name must not be null.");let u=new Ss(d);u.order=i.readInt(!0),u.skinRequired=i.readBoolean(),c=i.readInt(!0);for(let m=0;m<c;m++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.slots[i.readInt(!0)];const f=i.readByte();u.positionMode=f&1,u.spacingMode=f>>1&3,u.rotateMode=f>>3&3,(f&128)!=0&&(u.offsetRotation=i.readFloat()),u.position=i.readFloat(),u.positionMode==vt.Fixed&&(u.position*=e),u.spacing=i.readFloat(),(u.spacingMode==Z.Length||u.spacingMode==Z.Fixed)&&(u.spacing*=e),u.mixRotate=i.readFloat(),u.mixX=i.readFloat(),u.mixY=i.readFloat(),s.pathConstraints.push(u)}r=i.readInt(!0);for(let l=0,c;l<r;l++){const d=i.readString();if(!d)throw new Error("Physics constraint data name must not be null.");const u=new Is(d);u.order=i.readInt(!0),u.bone=s.bones[i.readInt(!0)];let f=i.readByte();u.skinRequired=(f&1)!=0,(f&2)!=0&&(u.x=i.readFloat()),(f&4)!=0&&(u.y=i.readFloat()),(f&8)!=0&&(u.rotate=i.readFloat()),(f&16)!=0&&(u.scaleX=i.readFloat()),(f&32)!=0&&(u.shearX=i.readFloat()),u.limit=((f&64)!=0?i.readFloat():5e3)*e,u.step=1/i.readUnsignedByte(),u.inertia=i.readFloat(),u.strength=i.readFloat(),u.damping=i.readFloat(),u.massInverse=(f&128)!=0?i.readFloat():1,u.wind=i.readFloat(),u.gravity=i.readFloat(),f=i.readByte(),(f&1)!=0&&(u.inertiaGlobal=!0),(f&2)!=0&&(u.strengthGlobal=!0),(f&4)!=0&&(u.dampingGlobal=!0),(f&8)!=0&&(u.massGlobal=!0),(f&16)!=0&&(u.windGlobal=!0),(f&32)!=0&&(u.gravityGlobal=!0),(f&64)!=0&&(u.mixGlobal=!0),u.mix=(f&128)!=0?i.readFloat():1,s.physicsConstraints.push(u)}let o=this.readSkin(i,s,!0,a);o&&(s.defaultSkin=o,s.skins.push(o));{let l=s.skins.length;for(E.setArraySize(s.skins,r=l+i.readInt(!0));l<r;l++){let c=this.readSkin(i,s,!1,a);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[l]=c}}r=this.linkedMeshes.length;for(let l=0;l<r;l++){let c=this.linkedMeshes[l];const d=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let u=d.getAttachment(c.slotIndex,c.parent);if(!u)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?u:c.mesh,c.mesh.setParentMesh(u),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,r=i.readInt(!0);for(let l=0;l<r;l++){let c=i.readString();if(!c)throw new Error("Event data name must not be null");let d=new As(c);d.intValue=i.readInt(!1),d.floatValue=i.readFloat(),d.stringValue=i.readString(),d.audioPath=i.readString(),d.audioPath&&(d.volume=i.readFloat(),d.balance=i.readFloat()),s.events.push(d)}r=i.readInt(!0);for(let l=0;l<r;l++){let c=i.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,c,s))}return s}readSkin(t,e,s,i){let n=null,h=0;if(s){if(h=t.readInt(!0),h==0)return null;n=new ae("default")}else{let a=t.readString();if(!a)throw new Error("Skin name must not be null.");n=new ae(a),i&&V.rgba8888ToColor(n.color,t.readInt32()),n.bones.length=t.readInt(!0);for(let r=0,o=n.bones.length;r<o;r++)n.bones[r]=e.bones[t.readInt(!0)];for(let r=0,o=t.readInt(!0);r<o;r++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let r=0,o=t.readInt(!0);r<o;r++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let r=0,o=t.readInt(!0);r<o;r++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let r=0,o=t.readInt(!0);r<o;r++)n.constraints.push(e.physicsConstraints[t.readInt(!0)]);h=t.readInt(!0)}for(let a=0;a<h;a++){let r=t.readInt(!0);for(let o=0,l=t.readInt(!0);o<l;o++){let c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");let d=this.readAttachment(t,e,n,r,c,i);d&&n.setAttachment(r,c,d)}}return n}readAttachment(t,e,s,i,n,h){let a=this.scale,r=t.readByte();const o=(r&8)!=0?t.readStringRef():n;if(!o)throw new Error("Attachment name must not be null");switch(r&7){case kt.Region:{let l=(r&16)!=0?t.readStringRef():null;const c=(r&32)!=0?t.readInt32():4294967295,d=(r&64)!=0?this.readSequence(t):null;let u=(r&128)!=0?t.readFloat():0,f=t.readFloat(),m=t.readFloat(),g=t.readFloat(),w=t.readFloat(),b=t.readFloat(),p=t.readFloat();l||(l=o);let x=this.attachmentLoader.newRegionAttachment(s,o,l,d);return x?(x.path=l,x.x=f*a,x.y=m*a,x.scaleX=g,x.scaleY=w,x.rotation=u,x.width=b*a,x.height=p*a,V.rgba8888ToColor(x.color,c),x.sequence=d,d==null&&x.updateRegion(),x):null}case kt.BoundingBox:{let l=this.readVertices(t,(r&16)!=0),c=h?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,o);return d?(d.worldVerticesLength=l.length,d.vertices=l.vertices,d.bones=l.bones,h&&V.rgba8888ToColor(d.color,c),d):null}case kt.Mesh:{let l=(r&16)!=0?t.readStringRef():o;const c=(r&32)!=0?t.readInt32():4294967295,d=(r&64)!=0?this.readSequence(t):null,u=t.readInt(!0),f=this.readVertices(t,(r&128)!=0),m=this.readFloatArray(t,f.length,1),g=this.readShortArray(t,(f.length-u-2)*3);let w=[],b=0,p=0;h&&(w=this.readShortArray(t,t.readInt(!0)),b=t.readFloat(),p=t.readFloat()),l||(l=o);let x=this.attachmentLoader.newMeshAttachment(s,o,l,d);return x?(x.path=l,V.rgba8888ToColor(x.color,c),x.bones=f.bones,x.vertices=f.vertices,x.worldVerticesLength=f.length,x.triangles=g,x.regionUVs=m,d==null&&x.updateRegion(),x.hullLength=u<<1,x.sequence=d,h&&(x.edges=w,x.width=b*a,x.height=p*a),x):null}case kt.LinkedMesh:{const l=(r&16)!=0?t.readStringRef():o;if(l==null)throw new Error("Path of linked mesh must not be null");const c=(r&32)!=0?t.readInt32():4294967295,d=(r&64)!=0?this.readSequence(t):null,u=(r&128)!=0,f=t.readInt(!0),m=t.readStringRef();let g=0,w=0;h&&(g=t.readFloat(),w=t.readFloat());let b=this.attachmentLoader.newMeshAttachment(s,o,l,d);return b?(b.path=l,V.rgba8888ToColor(b.color,c),b.sequence=d,h&&(b.width=g*a,b.height=w*a),this.linkedMeshes.push(new fi(b,f,i,m,u)),b):null}case kt.Path:{const l=(r&16)!=0,c=(r&32)!=0,d=this.readVertices(t,(r&64)!=0),u=E.newArray(d.length/6,0);for(let g=0,w=u.length;g<w;g++)u[g]=t.readFloat()*a;const f=h?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,o);return m?(m.closed=l,m.constantSpeed=c,m.worldVerticesLength=d.length,m.vertices=d.vertices,m.bones=d.bones,m.lengths=u,h&&V.rgba8888ToColor(m.color,f),m):null}case kt.Point:{const l=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=h?t.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,o);return f?(f.x=c*a,f.y=d*a,f.rotation=l,h&&V.rgba8888ToColor(f.color,u),f):null}case kt.Clipping:{const l=t.readInt(!0),c=this.readVertices(t,(r&16)!=0);let d=h?t.readInt32():0,u=this.attachmentLoader.newClippingAttachment(s,o);return u?(u.endSlot=e.slots[l],u.worldVerticesLength=c.length,u.vertices=c.vertices,u.bones=c.bones,h&&V.rgba8888ToColor(u.color,d),u):null}}return null}readSequence(t){let e=new Vt(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,i=t.readInt(!0),n=new ui;if(n.length=i<<1,!e)return n.vertices=this.readFloatArray(t,n.length,s),n;let h=new Array,a=new Array;for(let r=0;r<i;r++){let o=t.readInt(!0);a.push(o);for(let l=0;l<o;l++)a.push(t.readInt(!0)),h.push(t.readFloat()*s),h.push(t.readFloat()*s),h.push(t.readFloat())}return n.vertices=E.toFloatArray(h),n.bones=a,n}readFloatArray(t,e,s){let i=new Array(e);if(s==1)for(let n=0;n<e;n++)i[n]=t.readFloat();else for(let n=0;n<e;n++)i[n]=t.readFloat()*s;return i}readShortArray(t,e){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let i=new Array,n=this.scale;for(let o=0,l=t.readInt(!0);o<l;o++){let c=t.readInt(!0);for(let d=0,u=t.readInt(!0);d<u;d++){let f=t.readByte(),m=t.readInt(!0),g=m-1;switch(f){case Si:{let w=new Dt(m,c);for(let b=0;b<m;b++)w.setFrame(b,t.readFloat(),t.readStringRef());i.push(w);break}case Ii:{let w=t.readInt(!0),b=new es(m,w,c),p=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let k=0,I=0;b.setFrame(k,p,x,y,v,A),k!=g;k++){let Y=t.readFloat(),T=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255;switch(t.readByte()){case bt:b.setStepped(k);break;case wt:z(t,b,I++,k,0,p,Y,x,T,1),z(t,b,I++,k,1,p,Y,y,R,1),z(t,b,I++,k,2,p,Y,v,X,1),z(t,b,I++,k,3,p,Y,A,M,1)}p=Y,x=T,y=R,v=X,A=M}i.push(b);break}case Ti:{let w=t.readInt(!0),b=new ss(m,w,c),p=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255;for(let A=0,k=0;b.setFrame(A,p,x,y,v),A!=g;A++){let I=t.readFloat(),Y=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255;switch(t.readByte()){case bt:b.setStepped(A);break;case wt:z(t,b,k++,A,0,p,I,x,Y,1),z(t,b,k++,A,1,p,I,y,T,1),z(t,b,k++,A,2,p,I,v,R,1)}p=I,x=Y,y=T,v=R}i.push(b);break}case Mi:{let w=t.readInt(!0),b=new rs(m,w,c),p=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255;for(let T=0,R=0;b.setFrame(T,p,x,y,v,A,k,I,Y),T!=g;T++){let X=t.readFloat(),M=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,W=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,G=t.readUnsignedByte()/255;switch(t.readByte()){case bt:b.setStepped(T);break;case wt:z(t,b,R++,T,0,p,X,x,M,1),z(t,b,R++,T,1,p,X,y,F,1),z(t,b,R++,T,2,p,X,v,L,1),z(t,b,R++,T,3,p,X,A,O,1),z(t,b,R++,T,4,p,X,k,W,1),z(t,b,R++,T,5,p,X,I,N,1),z(t,b,R++,T,6,p,X,Y,G,1)}p=X,x=M,y=F,v=L,A=O,k=W,I=N,Y=G}i.push(b);break}case Yi:{let w=t.readInt(!0),b=new ns(m,w,c),p=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let Y=0,T=0;b.setFrame(Y,p,x,y,v,A,k,I),Y!=g;Y++){let R=t.readFloat(),X=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,W=t.readUnsignedByte()/255;switch(t.readByte()){case bt:b.setStepped(Y);break;case wt:z(t,b,T++,Y,0,p,R,x,X,1),z(t,b,T++,Y,1,p,R,y,M,1),z(t,b,T++,Y,2,p,R,v,F,1),z(t,b,T++,Y,3,p,R,A,L,1),z(t,b,T++,Y,4,p,R,k,O,1),z(t,b,T++,Y,5,p,R,I,W,1)}p=R,x=X,y=M,v=F,A=L,k=O,I=W}i.push(b);break}case Fi:{let w=new is(m,t.readInt(!0),c),b=t.readFloat(),p=t.readUnsignedByte()/255;for(let x=0,y=0;w.setFrame(x,b,p),x!=g;x++){let v=t.readFloat(),A=t.readUnsignedByte()/255;switch(t.readByte()){case bt:w.setStepped(x);break;case wt:z(t,w,y++,x,0,b,v,p,A,1)}b=v,p=A}i.push(w)}}}}for(let o=0,l=t.readInt(!0);o<l;o++){let c=t.readInt(!0);for(let d=0,u=t.readInt(!0);d<u;d++){let f=t.readByte(),m=t.readInt(!0);if(f==ki){let w=new ts(m,c);for(let b=0;b<m;b++)w.setFrame(b,t.readFloat(),t.readByte());i.push(w);continue}let g=t.readInt(!0);switch(f){case mi:i.push(rt(t,new re(m,g,c),1));break;case gi:i.push(pe(t,new ze(m,g,c),n));break;case pi:i.push(rt(t,new Ge(m,g,c),n));break;case xi:i.push(rt(t,new $e(m,g,c),n));break;case bi:i.push(pe(t,new He(m,g,c),1));break;case wi:i.push(rt(t,new je(m,g,c),1));break;case yi:i.push(rt(t,new Je(m,g,c),1));break;case vi:i.push(pe(t,new Ke(m,g,c),1));break;case Ci:i.push(rt(t,new Qe(m,g,c),1));break;case Ai:i.push(rt(t,new Ze(m,g,c),1))}}}for(let o=0,l=t.readInt(!0);o<l;o++){let c=t.readInt(!0),d=t.readInt(!0),u=d-1,f=new os(d,t.readInt(!0),c),m=t.readByte(),g=t.readFloat(),w=(m&1)!=0?(m&2)!=0?t.readFloat():1:0,b=(m&4)!=0?t.readFloat()*n:0;for(let p=0,x=0;f.setFrame(p,g,w,b,(m&8)!=0?1:-1,(m&16)!=0,(m&32)!=0),p!=u;p++){m=t.readByte();const y=t.readFloat(),v=(m&1)!=0?(m&2)!=0?t.readFloat():1:0,A=(m&4)!=0?t.readFloat()*n:0;(m&64)!=0?f.setStepped(p):(m&128)!=0&&(z(t,f,x++,p,0,g,y,w,v,1),z(t,f,x++,p,1,g,y,b,A,n)),g=y,w=v,b=A}i.push(f)}for(let o=0,l=t.readInt(!0);o<l;o++){let c=t.readInt(!0),d=t.readInt(!0),u=d-1,f=new ls(d,t.readInt(!0),c),m=t.readFloat(),g=t.readFloat(),w=t.readFloat(),b=t.readFloat(),p=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let v=0,A=0;f.setFrame(v,m,g,w,b,p,x,y),v!=u;v++){let k=t.readFloat(),I=t.readFloat(),Y=t.readFloat(),T=t.readFloat(),R=t.readFloat(),X=t.readFloat(),M=t.readFloat();switch(t.readByte()){case bt:f.setStepped(v);break;case wt:z(t,f,A++,v,0,m,k,g,I,1),z(t,f,A++,v,1,m,k,w,Y,1),z(t,f,A++,v,2,m,k,b,T,1),z(t,f,A++,v,3,m,k,p,R,1),z(t,f,A++,v,4,m,k,x,X,1),z(t,f,A++,v,5,m,k,y,M,1)}m=k,g=I,w=Y,b=T,p=R,x=X,y=M}i.push(f)}for(let o=0,l=t.readInt(!0);o<l;o++){let c=t.readInt(!0),d=s.pathConstraints[c];for(let u=0,f=t.readInt(!0);u<f;u++){const m=t.readByte(),g=t.readInt(!0),w=t.readInt(!0);switch(m){case Ri:i.push(rt(t,new hs(g,w,c),d.positionMode==vt.Fixed?n:1));break;case Bi:i.push(rt(t,new cs(g,w,c),d.spacingMode==Z.Length||d.spacingMode==Z.Fixed?n:1));break;case Ei:let b=new ds(g,w,c),p=t.readFloat(),x=t.readFloat(),y=t.readFloat(),v=t.readFloat();for(let A=0,k=0,I=b.getFrameCount()-1;b.setFrame(A,p,x,y,v),A!=I;A++){let Y=t.readFloat(),T=t.readFloat(),R=t.readFloat(),X=t.readFloat();switch(t.readByte()){case bt:b.setStepped(A);break;case wt:z(t,b,k++,A,0,p,Y,x,T,1),z(t,b,k++,A,1,p,Y,y,R,1),z(t,b,k++,A,2,p,Y,v,X,1)}p=Y,x=T,y=R,v=X}i.push(b)}}}for(let o=0,l=t.readInt(!0);o<l;o++){const c=t.readInt(!0)-1;for(let d=0,u=t.readInt(!0);d<u;d++){const f=t.readByte(),m=t.readInt(!0);if(f==Ui){const w=new le(m,c);for(let b=0;b<m;b++)w.setFrame(b,t.readFloat());i.push(w);continue}const g=t.readInt(!0);switch(f){case Li:i.push(rt(t,new fs(m,g,c),1));break;case Di:i.push(rt(t,new us(m,g,c),1));break;case Ni:i.push(rt(t,new ms(m,g,c),1));break;case Vi:i.push(rt(t,new gs(m,g,c),1));break;case Oi:i.push(rt(t,new ps(m,g,c),1));break;case _i:i.push(rt(t,new xs(m,g,c),1));break;case Wi:i.push(rt(t,new bs(m,g,c),1))}}}for(let o=0,l=t.readInt(!0);o<l;o++){let c=s.skins[t.readInt(!0)];for(let d=0,u=t.readInt(!0);d<u;d++){let f=t.readInt(!0);for(let m=0,g=t.readInt(!0);m<g;m++){let w=t.readStringRef();if(!w)throw new Error("attachmentName must not be null.");let b=c.getAttachment(f,w),p=t.readByte(),x=t.readInt(!0),y=x-1;switch(p){case Xi:{let v=b,A=v.bones,k=v.vertices,I=A?k.length/3*2:k.length,Y=t.readInt(!0),T=new as(x,Y,f,v),R=t.readFloat();for(let X=0,M=0;;X++){let F,L=t.readInt(!0);if(L==0)F=A?E.newFloatArray(I):k;else{F=E.newFloatArray(I);let W=t.readInt(!0);if(L+=W,n==1)for(let N=W;N<L;N++)F[N]=t.readFloat();else for(let N=W;N<L;N++)F[N]=t.readFloat()*n;if(!A)for(let N=0,G=F.length;N<G;N++)F[N]+=k[N]}if(T.setFrame(X,R,F),X==y)break;let O=t.readFloat();switch(t.readByte()){case bt:T.setStepped(X);break;case wt:z(t,T,M++,X,0,R,O,0,1,1)}R=O}i.push(T);break}case Pi:{let v=new yt(x,f,b);for(let A=0;A<x;A++){let k=t.readFloat(),I=t.readInt32();v.setFrame(A,k,qe[I&15],I>>4,t.readFloat())}i.push(v);break}}}}}let h=t.readInt(!0);if(h>0){let o=new Xt(h),l=s.slots.length;for(let c=0;c<h;c++){let d=t.readFloat(),u=t.readInt(!0),f=E.newArray(l,0);for(let b=l-1;b>=0;b--)f[b]=-1;let m=E.newArray(l-u,0),g=0,w=0;for(let b=0;b<u;b++){let p=t.readInt(!0);for(;g!=p;)m[w++]=g++;f[g+t.readInt(!0)]=g++}for(;g<l;)m[w++]=g++;for(let b=l-1;b>=0;b--)f[b]==-1&&(f[b]=m[--w]);o.setFrame(c,d,f)}i.push(o)}let a=t.readInt(!0);if(a>0){let o=new Ht(a);for(let l=0;l<a;l++){let c=t.readFloat(),d=s.events[t.readInt(!0)],u=new Cs(c,d);u.intValue=t.readInt(!1),u.floatValue=t.readFloat(),u.stringValue=t.readString(),u.stringValue==null&&(u.stringValue=d.stringValue),u.data.audioPath&&(u.volume=t.readFloat(),u.balance=t.readFloat()),o.setFrame(l,u)}i.push(o)}let r=0;for(let o=0,l=i.length;o<l;o++)r=Math.max(r,i[o].getDuration());return new ye(e,i,r)}}class di{strings;index;buffer;constructor(t,e=new Array,s=0,i=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<7,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<14,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<21,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){let t=this.readInt(!0);return t==0?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 i=this.readUnsignedByte();switch(i>>4){case 12:case 13:e+=String.fromCharCode((i&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(i),s++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}}let fi=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,n){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}};class ui{bones;vertices;length;constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}}var kt;(function(C){C[C.Region=0]="Region",C[C.BoundingBox=1]="BoundingBox",C[C.Mesh=2]="Mesh",C[C.LinkedMesh=3]="LinkedMesh",C[C.Path=4]="Path",C[C.Point=5]="Point",C[C.Clipping=6]="Clipping"})(kt||(kt={}));function rt(C,t,e){let s=C.readFloat(),i=C.readFloat()*e;for(let n=0,h=0,a=t.getFrameCount()-1;t.setFrame(n,s,i),n!=a;n++){let r=C.readFloat(),o=C.readFloat()*e;switch(C.readByte()){case bt:t.setStepped(n);break;case wt:z(C,t,h++,n,0,s,r,i,o,e)}s=r,i=o}return t}function pe(C,t,e){let s=C.readFloat(),i=C.readFloat()*e,n=C.readFloat()*e;for(let h=0,a=0,r=t.getFrameCount()-1;t.setFrame(h,s,i,n),h!=r;h++){let o=C.readFloat(),l=C.readFloat()*e,c=C.readFloat()*e;switch(C.readByte()){case bt:t.setStepped(h);break;case wt:z(C,t,a++,h,0,s,o,i,l,e),z(C,t,a++,h,1,s,o,n,c,e)}s=o,i=l,n=c}return t}function z(C,t,e,s,i,n,h,a,r,o){t.setBezier(e,s,i,n,a,C.readFloat(),C.readFloat()*o,C.readFloat(),C.readFloat()*o,h,r)}const mi=0,gi=1,pi=2,xi=3,bi=4,wi=5,yi=6,vi=7,Ci=8,Ai=9,ki=10,Si=0,Ii=1,Ti=2,Mi=3,Yi=4,Fi=5,Xi=0,Pi=1,Ri=0,Bi=1,Ei=2,Li=0,Di=1,Ni=2,Vi=4,Oi=5,_i=6,Wi=7,Ui=8,bt=1,wt=2;class Ys{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new $t(()=>E.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,n=this.polygonPool,h=t.slots,a=h.length;s.length=0,n.freeAll(i),i.length=0;for(let r=0;r<a;r++){let o=h[r];if(!o.bone.active)continue;let l=o.getAttachment();if(l instanceof he){let c=l;s.push(c);let d=n.obtain();d.length!=c.worldVerticesLength&&(d=E.newFloatArray(c.worldVerticesLength)),i.push(d),c.computeWorldVertices(o,0,c.worldVerticesLength,d,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,n=this.polygons;for(let h=0,a=n.length;h<a;h++){let r=n[h],o=r;for(let l=0,c=r.length;l<c;l+=2){let d=o[l],u=o[l+1];t=Math.min(t,d),e=Math.min(e,u),s=Math.max(s,d),i=Math.max(i,u)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,i){let n=this.minX,h=this.minY,a=this.maxX,r=this.maxY;if(t<=n&&s<=n||e<=h&&i<=h||t>=a&&s>=a||e>=r&&i>=r)return!1;let o=(i-e)/(s-t),l=o*(n-t)+e;if(l>h&&l<r||(l=o*(a-t)+e,l>h&&l<r))return!0;let c=(h-e)/o+t;return c>n&&c<a||(c=(r-e)/o+t,c>n&&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 i=0,n=s.length;i<n;i++)if(this.containsPointPolygon(s[i],t,e))return this.boundingBoxes[i];return null}containsPointPolygon(t,e,s){let i=t,n=t.length,h=n-2,a=!1;for(let r=0;r<n;r+=2){let o=i[r+1],l=i[h+1];if(o<s&&l>=s||l<s&&o>=s){let c=i[r];c+(s-o)/(l-o)*(i[h]-c)<e&&(a=!a)}h=r}return a}intersectsSegment(t,e,s,i){let n=this.polygons;for(let h=0,a=n.length;h<a;h++)if(this.intersectsSegmentPolygon(n[h],t,e,s,i))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(t,e,s,i,n){let h=t,a=t.length,r=e-i,o=s-n,l=e*n-s*i,c=h[a-2],d=h[a-1];for(let u=0;u<a;u+=2){let f=h[u],m=h[u+1],g=c*m-d*f,w=c-f,b=d-m,p=r*b-o*w,x=(l*w-r*g)/p;if((x>=c&&x<=f||x>=f&&x<=c)&&(x>=e&&x<=i||x>=i&&x<=e)){let y=(l*b-o*g)/p;if((y>=d&&y<=m||y>=m&&y<=d)&&(y>=s&&y<=n||y>=n&&y<=s))return!0}c=f,d=m}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return e==-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}}class lt{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new $t(()=>new Array);polygonIndicesPool=new $t(()=>new Array);triangulate(t){let e=t,s=t.length>>1,i=this.indicesArray;i.length=0;for(let a=0;a<s;a++)i[a]=a;let n=this.isConcaveArray;n.length=0;for(let a=0,r=s;a<r;++a)n[a]=lt.isConcave(a,s,e,i);let h=this.triangles;for(h.length=0;s>3;){let a=s-1,r=0,o=1;for(;;){t:if(!n[r]){let d=i[a]<<1,u=i[r]<<1,f=i[o]<<1,m=e[d],g=e[d+1],w=e[u],b=e[u+1],p=e[f],x=e[f+1];for(let y=(o+1)%s;y!=a;y=(y+1)%s){if(!n[y])continue;let v=i[y]<<1,A=e[v],k=e[v+1];if(lt.positiveArea(p,x,m,g,A,k)&&lt.positiveArea(m,g,w,b,A,k)&&lt.positiveArea(w,b,p,x,A,k))break t}break}if(o==0){do{if(!n[r])break;r--}while(r>0);break}a=r,r=o,o=(o+1)%s}h.push(i[(s+r-1)%s]),h.push(i[r]),h.push(i[(r+1)%s]),i.splice(r,1),n.splice(r,1),s--;let l=(s+r-1)%s,c=r==s?0:r;n[l]=lt.isConcave(l,s,e,i),n[c]=lt.isConcave(c,s,e,i)}return s==3&&(h.push(i[2]),h.push(i[0]),h.push(i[1])),h}decompose(t,e){let s=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let n=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(n),n.length=0;let h=this.polygonIndicesPool.obtain();h.length=0;let a=this.polygonPool.obtain();a.length=0;let r=-1,o=0;for(let l=0,c=e.length;l<c;l+=3){let d=e[l]<<1,u=e[l+1]<<1,f=e[l+2]<<1,m=s[d],g=s[d+1],w=s[u],b=s[u+1],p=s[f],x=s[f+1],y=!1;if(r==d){let v=a.length-4,A=lt.winding(a[v],a[v+1],a[v+2],a[v+3],p,x),k=lt.winding(p,x,a[0],a[1],a[2],a[3]);A==o&&k==o&&(a.push(p),a.push(x),h.push(f),y=!0)}y||(a.length>0?(i.push(a),n.push(h)):(this.polygonPool.free(a),this.polygonIndicesPool.free(h)),a=this.polygonPool.obtain(),a.length=0,a.push(m),a.push(g),a.push(w),a.push(b),a.push(p),a.push(x),h=this.polygonIndicesPool.obtain(),h.length=0,h.push(d),h.push(u),h.push(f),o=lt.winding(m,g,w,b,p,x),r=d)}a.length>0&&(i.push(a),n.push(h));for(let l=0,c=i.length;l<c;l++){if(h=n[l],h.length==0)continue;let d=h[0],u=h[h.length-1];a=i[l];let f=a.length-4,m=a[f],g=a[f+1],w=a[f+2],b=a[f+3],p=a[0],x=a[1],y=a[2],v=a[3],A=lt.winding(m,g,w,b,p,x);for(let k=0;k<c;k++){if(k==l)continue;let I=n[k];if(I.length!=3)continue;let Y=I[0],T=I[1],R=I[2],X=i[k],M=X[X.length-2],F=X[X.length-1];if(Y!=d||T!=u)continue;let L=lt.winding(m,g,w,b,M,F),O=lt.winding(M,F,p,x,y,v);L==A&&O==A&&(X.length=0,I.length=0,a.push(M),a.push(F),h.push(R),m=w,g=b,w=M,b=F,k=0)}}for(let l=i.length-1;l>=0;l--)a=i[l],a.length==0&&(i.splice(l,1),this.polygonPool.free(a),h=n[l],n.splice(l,1),this.polygonIndicesPool.free(h));return i}static isConcave(t,e,s,i){let n=i[(e+t-1)%e]<<1,h=i[t]<<1,a=i[(t+1)%e]<<1;return!this.positiveArea(s[n],s[n+1],s[h],s[h+1],s[a],s[a+1])}static positiveArea(t,e,s,i,n,h){return t*(h-i)+s*(e-h)+n*(i-e)>=0}static winding(t,e,s,i,n,h){let a=s-t,r=i-e;return n*r-h*a+a*e-t*r>=0?1:-1}}class _t{triangulator=new lt;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,e){if(this.clipAttachment)return 0;this.clipAttachment=e;let s=e.worldVerticesLength,i=E.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,i,0,2);let n=this.clippingPolygon;_t.makeClockwise(n);let h=this.clippingPolygons=this.triangulator.decompose(n,this.triangulator.triangulate(n));for(let a=0,r=h.length;a<r;a++){let o=h[a];_t.makeClockwise(o),o.push(o[0]),o.push(o[1])}return h.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 this.clipAttachment!=null}clipTriangles(t,e,s,i,n,h,a,r){let o,l,c,d,u,f;typeof e=="number"?(o=s,l=i,c=n,d=h,u=a,f=r):(o=e,l=s,c=i,d=n,u=h,f=a),c&&d&&u&&typeof f=="boolean"?this.clipTrianglesRender(t,o,l,c,d,u,f):this.clipTrianglesNoRender(t,o,l)}clipTrianglesNoRender(t,e,s){let i=this.clipOutput,n=this.clippedVertices,h=this.clippedTriangles,a=this.clippingPolygons,r=a.length,o=0;n.length=0,h.length=0;for(let l=0;l<s;l+=3){let c=e[l]<<1,d=t[c],u=t[c+1];c=e[l+1]<<1;let f=t[c],m=t[c+1];c=e[l+2]<<1;let g=t[c],w=t[c+1];for(let b=0;b<r;b++){let p=n.length;if(this.clip(d,u,f,m,g,w,a[b],i)){let x=i.length;if(x==0)continue;let y=x>>1,v=this.clipOutput,A=E.setArraySize(n,p+y*2);for(let I=0;I<x;I+=2,p+=2){let Y=v[I],T=v[I+1];A[p]=Y,A[p+1]=T}p=h.length;let k=E.setArraySize(h,p+3*(y-2));y--;for(let I=1;I<y;I++,p+=3)k[p]=o,k[p+1]=o+I,k[p+2]=o+I+1;o+=y+1}else{let x=E.setArraySize(n,p+6);x[p]=d,x[p+1]=u,x[p+2]=f,x[p+3]=m,x[p+4]=g,x[p+5]=w,p=h.length;let y=E.setArraySize(h,p+3);y[p]=o,y[p+1]=o+1,y[p+2]=o+2,o+=3;break}}}}clipTrianglesRender(t,e,s,i,n,h,a){let r=this.clipOutput,o=this.clippedVertices,l=this.clippedTriangles,c=this.clippingPolygons,d=c.length,u=a?12:8,f=0;o.length=0,l.length=0;for(let m=0;m<s;m+=3){let g=e[m]<<1,w=t[g],b=t[g+1],p=i[g],x=i[g+1];g=e[m+1]<<1;let y=t[g],v=t[g+1],A=i[g],k=i[g+1];g=e[m+2]<<1;let I=t[g],Y=t[g+1],T=i[g],R=i[g+1];for(let X=0;X<d;X++){let M=o.length;if(this.clip(w,b,y,v,I,Y,c[X],r)){let F=r.length;if(F==0)continue;let L=v-Y,O=I-y,W=w-I,N=Y-b,G=1/(L*W+O*(b-Y)),H=F>>1,j=this.clipOutput,D=E.setArraySize(o,M+H*u);for(let q=0;q<F;q+=2,M+=u){let ht=j[q],at=j[q+1];D[M]=ht,D[M+1]=at,D[M+2]=n.r,D[M+3]=n.g,D[M+4]=n.b,D[M+5]=n.a;let Q=ht-I,st=at-Y,it=(L*Q+O*st)*G,It=(N*Q+W*st)*G,Wt=1-it-It;D[M+6]=p*it+A*It+T*Wt,D[M+7]=x*it+k*It+R*Wt,a&&(D[M+8]=h.r,D[M+9]=h.g,D[M+10]=h.b,D[M+11]=h.a)}M=l.length;let U=E.setArraySize(l,M+3*(H-2));H--;for(let q=1;q<H;q++,M+=3)U[M]=f,U[M+1]=f+q,U[M+2]=f+q+1;f+=H+1}else{let F=E.setArraySize(o,M+3*u);F[M]=w,F[M+1]=b,F[M+2]=n.r,F[M+3]=n.g,F[M+4]=n.b,F[M+5]=n.a,a?(F[M+6]=p,F[M+7]=x,F[M+8]=h.r,F[M+9]=h.g,F[M+10]=h.b,F[M+11]=h.a,F[M+12]=y,F[M+13]=v,F[M+14]=n.r,F[M+15]=n.g,F[M+16]=n.b,F[M+17]=n.a,F[M+18]=A,F[M+19]=k,F[M+20]=h.r,F[M+21]=h.g,F[M+22]=h.b,F[M+23]=h.a,F[M+24]=I,F[M+25]=Y,F[M+26]=n.r,F[M+27]=n.g,F[M+28]=n.b,F[M+29]=n.a,F[M+30]=T,F[M+31]=R,F[M+32]=h.r,F[M+33]=h.g,F[M+34]=h.b,F[M+35]=h.a):(F[M+6]=p,F[M+7]=x,F[M+8]=y,F[M+9]=v,F[M+10]=n.r,F[M+11]=n.g,F[M+12]=n.b,F[M+13]=n.a,F[M+14]=A,F[M+15]=k,F[M+16]=I,F[M+17]=Y,F[M+18]=n.r,F[M+19]=n.g,F[M+20]=n.b,F[M+21]=n.a,F[M+22]=T,F[M+23]=R),M=l.length;let L=E.setArraySize(l,M+3);L[M]=f,L[M+1]=f+1,L[M+2]=f+2,f+=3;break}}}}clipTrianglesUnpacked(t,e,s,i){let n=this.clipOutput,h=this.clippedVertices,a=this.clippedUVs,r=this.clippedTriangles,o=this.clippingPolygons,l=o.length,c=0;h.length=0,a.length=0,r.length=0;for(let d=0;d<s;d+=3){let u=e[d]<<1,f=t[u],m=t[u+1],g=i[u],w=i[u+1];u=e[d+1]<<1;let b=t[u],p=t[u+1],x=i[u],y=i[u+1];u=e[d+2]<<1;let v=t[u],A=t[u+1],k=i[u],I=i[u+1];for(let Y=0;Y<l;Y++){let T=h.length;if(this.clip(f,m,b,p,v,A,o[Y],n)){let R=n.length;if(R==0)continue;let X=p-A,M=v-b,F=f-v,L=A-m,O=1/(X*F+M*(m-A)),W=R>>1,N=this.clipOutput,G=E.setArraySize(h,T+W*2),H=E.setArraySize(a,T+W*2);for(let D=0;D<R;D+=2,T+=2){let U=N[D],q=N[D+1];G[T]=U,G[T+1]=q;let ht=U-v,at=q-A,Q=(X*ht+M*at)*O,st=(L*ht+F*at)*O,it=1-Q-st;H[T]=g*Q+x*st+k*it,H[T+1]=w*Q+y*st+I*it}T=r.length;let j=E.setArraySize(r,T+3*(W-2));W--;for(let D=1;D<W;D++,T+=3)j[T]=c,j[T+1]=c+D,j[T+2]=c+D+1;c+=W+1}else{let R=E.setArraySize(h,T+6);R[T]=f,R[T+1]=m,R[T+2]=b,R[T+3]=p,R[T+4]=v,R[T+5]=A;let X=E.setArraySize(a,T+6);X[T]=g,X[T+1]=w,X[T+2]=x,X[T+3]=y,X[T+4]=k,X[T+5]=I,T=r.length;let M=E.setArraySize(r,T+3);M[T]=c,M[T+1]=c+1,M[T+2]=c+2,c+=3;break}}}}clip(t,e,s,i,n,h,a,r){let o=r,l=!1,c;a.length%4>=2?(c=r,r=this.scratch):c=this.scratch,c.length=0,c.push(t),c.push(e),c.push(s),c.push(i),c.push(n),c.push(h),c.push(t),c.push(e),r.length=0;let d=a.length-4,u=a;for(let f=0;;f+=2){let m=u[f],g=u[f+1],w=m-u[f+2],b=g-u[f+3],p=r.length,x=c;for(let v=0,A=c.length-2;v<A;){let k=x[v],I=x[v+1];v+=2;let Y=x[v],T=x[v+1],R=b*(m-Y)>w*(g-T),X=b*(m-k)-w*(g-I);if(X>0){if(R){r.push(Y),r.push(T);continue}let M=Y-k,F=T-I,L=X/(M*b-F*w);if(L>=0&&L<=1)r.push(k+M*L),r.push(I+F*L);else{r.push(Y),r.push(T);continue}}else if(R){let M=Y-k,F=T-I,L=X/(M*b-F*w);if(L>=0&&L<=1)r.push(k+M*L),r.push(I+F*L),r.push(Y),r.push(T);else{r.push(Y),r.push(T);continue}}l=!0}if(p==r.length)return o.length=0,!0;if(r.push(r[0]),r.push(r[1]),f==d)break;let y=r;r=c,r.length=0,c=y}if(o!=r){o.length=0;for(let f=0,m=r.length-2;f<m;f++)o[f]=r[f]}else o.length=o.length-2;return l}static makeClockwise(t){let e=t,s=t.length,i=e[s-2]*e[1]-e[0]*e[s-1],n=0,h=0,a=0,r=0;for(let o=0,l=s-3;o<l;o+=2)n=e[o],h=e[o+1],a=e[o+2],r=e[o+3],i+=n*r-a*h;if(!(i<0))for(let o=0,l=s-2,c=s>>1;o<c;o+=2){let d=e[o],u=e[o+1],f=l-o;e[o]=e[f],e[o+1]=e[f+1],e[f]=d,e[f+1]=u}}}class qi{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new ne,i=typeof t=="string"?JSON.parse(t):t,n=i.skeleton;if(n&&(s.hash=n.hash,s.version=n.spine,s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.referenceScale=S(n,"referenceScale",100)*e,s.fps=n.fps,s.imagesPath=n.images??null,s.audioPath=n.audio??null),i.bones)for(let h=0;h<i.bones.length;h++){let a=i.bones[h],r=null,o=S(a,"parent",null);o&&(r=s.findBone(o));let l=new vs(s.bones.length,a.name,r);l.length=S(a,"length",0)*e,l.x=S(a,"x",0)*e,l.y=S(a,"y",0)*e,l.rotation=S(a,"rotation",0),l.scaleX=S(a,"scaleX",1),l.scaleY=S(a,"scaleY",1),l.shearX=S(a,"shearX",0),l.shearY=S(a,"shearY",0),l.inherit=E.enumValue(K,S(a,"inherit","Normal")),l.skinRequired=S(a,"skin",!1);let c=S(a,"color",null);c&&l.color.setFromString(c),s.bones.push(l)}if(i.slots)for(let h=0;h<i.slots.length;h++){let a=i.slots[h],r=a.name,o=s.findBone(a.bone);if(!o)throw new Error(`Couldn't find bone ${a.bone} for slot ${r}`);let l=new Ts(s.slots.length,r,o),c=S(a,"color",null);c&&l.color.setFromString(c);let d=S(a,"dark",null);d&&(l.darkColor=V.fromString(d)),l.attachmentName=S(a,"attachment",null),l.blendMode=E.enumValue(Tt,S(a,"blend","normal")),l.visible=S(a,"visible",!0),s.slots.push(l)}if(i.ik)for(let h=0;h<i.ik.length;h++){let a=i.ik[h],r=new ks(a.name);r.order=S(a,"order",0),r.skinRequired=S(a,"skin",!1);for(let l=0;l<a.bones.length;l++){let c=s.findBone(a.bones[l]);if(!c)throw new Error(`Couldn't find bone ${a.bones[l]} for IK constraint ${a.name}.`);r.bones.push(c)}let o=s.findBone(a.target);if(!o)throw new Error(`Couldn't find target bone ${a.target} for IK constraint ${a.name}.`);r.target=o,r.mix=S(a,"mix",1),r.softness=S(a,"softness",0)*e,r.bendDirection=S(a,"bendPositive",!0)?1:-1,r.compress=S(a,"compress",!1),r.stretch=S(a,"stretch",!1),r.uniform=S(a,"uniform",!1),s.ikConstraints.push(r)}if(i.transform)for(let h=0;h<i.transform.length;h++){let a=i.transform[h],r=new Ms(a.name);r.order=S(a,"order",0),r.skinRequired=S(a,"skin",!1);for(let c=0;c<a.bones.length;c++){let d=a.bones[c],u=s.findBone(d);if(!u)throw new Error(`Couldn't find bone ${d} for transform constraint ${a.name}.`);r.bones.push(u)}let o=a.target,l=s.findBone(o);if(!l)throw new Error(`Couldn't find target bone ${o} for transform constraint ${a.name}.`);r.target=l,r.local=S(a,"local",!1),r.relative=S(a,"relative",!1),r.offsetRotation=S(a,"rotation",0),r.offsetX=S(a,"x",0)*e,r.offsetY=S(a,"y",0)*e,r.offsetScaleX=S(a,"scaleX",0),r.offsetScaleY=S(a,"scaleY",0),r.offsetShearY=S(a,"shearY",0),r.mixRotate=S(a,"mixRotate",1),r.mixX=S(a,"mixX",1),r.mixY=S(a,"mixY",r.mixX),r.mixScaleX=S(a,"mixScaleX",1),r.mixScaleY=S(a,"mixScaleY",r.mixScaleX),r.mixShearY=S(a,"mixShearY",1),s.transformConstraints.push(r)}if(i.path)for(let h=0;h<i.path.length;h++){let a=i.path[h],r=new Ss(a.name);r.order=S(a,"order",0),r.skinRequired=S(a,"skin",!1);for(let c=0;c<a.bones.length;c++){let d=a.bones[c],u=s.findBone(d);if(!u)throw new Error(`Couldn't find bone ${d} for path constraint ${a.name}.`);r.bones.push(u)}let o=a.target,l=s.findSlot(o);if(!l)throw new Error(`Couldn't find target slot ${o} for path constraint ${a.name}.`);r.target=l,r.positionMode=E.enumValue(vt,S(a,"positionMode","Percent")),r.spacingMode=E.enumValue(Z,S(a,"spacingMode","Length")),r.rotateMode=E.enumValue(Pt,S(a,"rotateMode","Tangent")),r.offsetRotation=S(a,"rotation",0),r.position=S(a,"position",0),r.positionMode==vt.Fixed&&(r.position*=e),r.spacing=S(a,"spacing",0),(r.spacingMode==Z.Length||r.spacingMode==Z.Fixed)&&(r.spacing*=e),r.mixRotate=S(a,"mixRotate",1),r.mixX=S(a,"mixX",1),r.mixY=S(a,"mixY",r.mixX),s.pathConstraints.push(r)}if(i.physics)for(let h=0;h<i.physics.length;h++){const a=i.physics[h],r=new Is(a.name);r.order=S(a,"order",0),r.skinRequired=S(a,"skin",!1);const o=a.bone,l=s.findBone(o);if(l==null)throw new Error("Physics bone not found: "+o);r.bone=l,r.x=S(a,"x",0),r.y=S(a,"y",0),r.rotate=S(a,"rotate",0),r.scaleX=S(a,"scaleX",0),r.shearX=S(a,"shearX",0),r.limit=S(a,"limit",5e3)*e,r.step=1/S(a,"fps",60),r.inertia=S(a,"inertia",1),r.strength=S(a,"strength",100),r.damping=S(a,"damping",1),r.massInverse=1/S(a,"mass",1),r.wind=S(a,"wind",0),r.gravity=S(a,"gravity",0),r.mix=S(a,"mix",1),r.inertiaGlobal=S(a,"inertiaGlobal",!1),r.strengthGlobal=S(a,"strengthGlobal",!1),r.dampingGlobal=S(a,"dampingGlobal",!1),r.massGlobal=S(a,"massGlobal",!1),r.windGlobal=S(a,"windGlobal",!1),r.gravityGlobal=S(a,"gravityGlobal",!1),r.mixGlobal=S(a,"mixGlobal",!1),s.physicsConstraints.push(r)}if(i.skins)for(let h=0;h<i.skins.length;h++){let a=i.skins[h],r=new ae(a.name);if(a.bones)for(let o=0;o<a.bones.length;o++){let l=a.bones[o],c=s.findBone(l);if(!c)throw new Error(`Couldn't find bone ${l} for skin ${a.name}.`);r.bones.push(c)}if(a.ik)for(let o=0;o<a.ik.length;o++){let l=a.ik[o],c=s.findIkConstraint(l);if(!c)throw new Error(`Couldn't find IK constraint ${l} for skin ${a.name}.`);r.constraints.push(c)}if(a.transform)for(let o=0;o<a.transform.length;o++){let l=a.transform[o],c=s.findTransformConstraint(l);if(!c)throw new Error(`Couldn't find transform constraint ${l} for skin ${a.name}.`);r.constraints.push(c)}if(a.path)for(let o=0;o<a.path.length;o++){let l=a.path[o],c=s.findPathConstraint(l);if(!c)throw new Error(`Couldn't find path constraint ${l} for skin ${a.name}.`);r.constraints.push(c)}if(a.physics)for(let o=0;o<a.physics.length;o++){let l=a.physics[o],c=s.findPhysicsConstraint(l);if(!c)throw new Error(`Couldn't find physics constraint ${l} for skin ${a.name}.`);r.constraints.push(c)}for(let o in a.attachments){let l=s.findSlot(o);if(!l)throw new Error(`Couldn't find slot ${o} for skin ${a.name}.`);let c=a.attachments[o];for(let d in c){let u=this.readAttachment(c[d],r,l.index,d,s);u&&r.setAttachment(l.index,d,u)}}s.skins.push(r),r.name=="default"&&(s.defaultSkin=r)}for(let h=0,a=this.linkedMeshes.length;h<a;h++){let r=this.linkedMeshes[h],o=r.skin?s.findSkin(r.skin):s.defaultSkin;if(!o)throw new Error(`Skin not found: ${r.skin}`);let l=o.getAttachment(r.slotIndex,r.parent);if(!l)throw new Error(`Parent mesh not found: ${r.parent}`);r.mesh.timelineAttachment=r.inheritTimeline?l:r.mesh,r.mesh.setParentMesh(l),r.mesh.region!=null&&r.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let h in i.events){let a=i.events[h],r=new As(h);r.intValue=S(a,"int",0),r.floatValue=S(a,"float",0),r.stringValue=S(a,"string",""),r.audioPath=S(a,"audio",null),r.audioPath&&(r.volume=S(a,"volume",1),r.balance=S(a,"balance",0)),s.events.push(r)}if(i.animations)for(let h in i.animations){let a=i.animations[h];this.readAnimation(a,h,s)}return s}readAttachment(t,e,s,i,n){let h=this.scale;switch(i=S(t,"name",i),S(t,"type","region")){case"region":{let a=S(t,"path",i),r=this.readSequence(S(t,"sequence",null)),o=this.attachmentLoader.newRegionAttachment(e,i,a,r);if(!o)return null;o.path=a,o.x=S(t,"x",0)*h,o.y=S(t,"y",0)*h,o.scaleX=S(t,"scaleX",1),o.scaleY=S(t,"scaleY",1),o.rotation=S(t,"rotation",0),o.width=t.width*h,o.height=t.height*h,o.sequence=r;let l=S(t,"color",null);return l&&o.color.setFromString(l),o.region!=null&&o.updateRegion(),o}case"boundingbox":{let a=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!a)return null;this.readVertices(t,a,t.vertexCount<<1);let r=S(t,"color",null);return r&&a.color.setFromString(r),a}case"mesh":case"linkedmesh":{let a=S(t,"path",i),r=this.readSequence(S(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,i,a,r);if(!o)return null;o.path=a;let l=S(t,"color",null);l&&o.color.setFromString(l),o.width=S(t,"width",0)*h,o.height=S(t,"height",0)*h,o.sequence=r;let c=S(t,"parent",null);if(c)return this.linkedMeshes.push(new zi(o,S(t,"skin",null),s,c,S(t,"timelines",!0))),o;let d=t.uvs;return this.readVertices(t,o,d.length),o.triangles=t.triangles,o.regionUVs=d,o.region!=null&&o.updateRegion(),o.edges=S(t,"edges",null),o.hullLength=S(t,"hull",0)*2,o}case"path":{let a=this.attachmentLoader.newPathAttachment(e,i);if(!a)return null;a.closed=S(t,"closed",!1),a.constantSpeed=S(t,"constantSpeed",!0);let r=t.vertexCount;this.readVertices(t,a,r<<1);let o=E.newArray(r/3,0);for(let c=0;c<t.lengths.length;c++)o[c]=t.lengths[c]*h;a.lengths=o;let l=S(t,"color",null);return l&&a.color.setFromString(l),a}case"point":{let a=this.attachmentLoader.newPointAttachment(e,i);if(!a)return null;a.x=S(t,"x",0)*h,a.y=S(t,"y",0)*h,a.rotation=S(t,"rotation",0);let r=S(t,"color",null);return r&&a.color.setFromString(r),a}case"clipping":{let a=this.attachmentLoader.newClippingAttachment(e,i);if(!a)return null;let r=S(t,"end",null);r&&(a.endSlot=n.findSlot(r));let o=t.vertexCount;this.readVertices(t,a,o<<1);let l=S(t,"color",null);return l&&a.color.setFromString(l),a}}return null}readSequence(t){if(t==null)return null;let e=new Vt(S(t,"count",0));return e.start=S(t,"start",1),e.digits=S(t,"digits",0),e.setupIndex=S(t,"setup",0),e}readVertices(t,e,s){let i=this.scale;e.worldVerticesLength=s;let n=t.vertices;if(s==n.length){let r=E.toFloatArray(n);if(i!=1)for(let o=0,l=n.length;o<l;o++)r[o]*=i;e.vertices=r;return}let h=new Array,a=new Array;for(let r=0,o=n.length;r<o;){let l=n[r++];a.push(l);for(let c=r+l*4;r<c;r+=4)a.push(n[r]),h.push(n[r+1]*i),h.push(n[r+2]*i),h.push(n[r+3])}e.bones=a,e.vertices=E.toFloatArray(h)}readAnimation(t,e,s){let i=this.scale,n=new Array;if(t.slots)for(let a in t.slots){let r=t.slots[a],o=s.findSlot(a);if(!o)throw new Error("Slot not found: "+a);let l=o.index;for(let c in r){let d=r[c];if(!d)continue;let u=d.length;if(c=="attachment"){let f=new Dt(u,l);for(let m=0;m<u;m++){let g=d[m];f.setFrame(m,S(g,"time",0),S(g,"name",null))}n.push(f)}else if(c=="rgba"){let f=new es(u,u<<2,l),m=d[0],g=S(m,"time",0),w=V.fromString(m.color);for(let b=0,p=0;;b++){f.setFrame(b,g,w.r,w.g,w.b,w.a);let x=d[b+1];if(!x){f.shrink(p);break}let y=S(x,"time",0),v=V.fromString(x.color),A=m.curve;A&&(p=$(A,f,p,b,0,g,y,w.r,v.r,1),p=$(A,f,p,b,1,g,y,w.g,v.g,1),p=$(A,f,p,b,2,g,y,w.b,v.b,1),p=$(A,f,p,b,3,g,y,w.a,v.a,1)),g=y,w=v,m=x}n.push(f)}else if(c=="rgb"){let f=new ss(u,u*3,l),m=d[0],g=S(m,"time",0),w=V.fromString(m.color);for(let b=0,p=0;;b++){f.setFrame(b,g,w.r,w.g,w.b);let x=d[b+1];if(!x){f.shrink(p);break}let y=S(x,"time",0),v=V.fromString(x.color),A=m.curve;A&&(p=$(A,f,p,b,0,g,y,w.r,v.r,1),p=$(A,f,p,b,1,g,y,w.g,v.g,1),p=$(A,f,p,b,2,g,y,w.b,v.b,1)),g=y,w=v,m=x}n.push(f)}else if(c=="alpha")n.push(ut(d,new is(u,u,l),0,1));else if(c=="rgba2"){let f=new rs(u,u*7,l),m=d[0],g=S(m,"time",0),w=V.fromString(m.light),b=V.fromString(m.dark);for(let p=0,x=0;;p++){f.setFrame(p,g,w.r,w.g,w.b,w.a,b.r,b.g,b.b);let y=d[p+1];if(!y){f.shrink(x);break}let v=S(y,"time",0),A=V.fromString(y.light),k=V.fromString(y.dark),I=m.curve;I&&(x=$(I,f,x,p,0,g,v,w.r,A.r,1),x=$(I,f,x,p,1,g,v,w.g,A.g,1),x=$(I,f,x,p,2,g,v,w.b,A.b,1),x=$(I,f,x,p,3,g,v,w.a,A.a,1),x=$(I,f,x,p,4,g,v,b.r,k.r,1),x=$(I,f,x,p,5,g,v,b.g,k.g,1),x=$(I,f,x,p,6,g,v,b.b,k.b,1)),g=v,w=A,b=k,m=y}n.push(f)}else if(c=="rgb2"){let f=new ns(u,u*6,l),m=d[0],g=S(m,"time",0),w=V.fromString(m.light),b=V.fromString(m.dark);for(let p=0,x=0;;p++){f.setFrame(p,g,w.r,w.g,w.b,b.r,b.g,b.b);let y=d[p+1];if(!y){f.shrink(x);break}let v=S(y,"time",0),A=V.fromString(y.light),k=V.fromString(y.dark),I=m.curve;I&&(x=$(I,f,x,p,0,g,v,w.r,A.r,1),x=$(I,f,x,p,1,g,v,w.g,A.g,1),x=$(I,f,x,p,2,g,v,w.b,A.b,1),x=$(I,f,x,p,3,g,v,b.r,k.r,1),x=$(I,f,x,p,4,g,v,b.g,k.g,1),x=$(I,f,x,p,5,g,v,b.b,k.b,1)),g=v,w=A,b=k,m=y}n.push(f)}}}if(t.bones)for(let a in t.bones){let r=t.bones[a],o=s.findBone(a);if(!o)throw new Error("Bone not found: "+a);let l=o.index;for(let c in r){let d=r[c],u=d.length;if(u!=0){if(c==="rotate")n.push(ut(d,new re(u,u,l),0,1));else if(c==="translate"){let f=new ze(u,u<<1,l);n.push(xe(d,f,"x","y",0,i))}else if(c==="translatex"){let f=new Ge(u,u,l);n.push(ut(d,f,0,i))}else if(c==="translatey"){let f=new $e(u,u,l);n.push(ut(d,f,0,i))}else if(c==="scale"){let f=new He(u,u<<1,l);n.push(xe(d,f,"x","y",1,1))}else if(c==="scalex"){let f=new je(u,u,l);n.push(ut(d,f,1,1))}else if(c==="scaley"){let f=new Je(u,u,l);n.push(ut(d,f,1,1))}else if(c==="shear"){let f=new Ke(u,u<<1,l);n.push(xe(d,f,"x","y",0,1))}else if(c==="shearx"){let f=new Qe(u,u,l);n.push(ut(d,f,0,1))}else if(c==="sheary"){let f=new Ze(u,u,l);n.push(ut(d,f,0,1))}else if(c==="inherit"){let f=new ts(u,o.index);for(let m=0;m<d.length;m++){let g=d[m];f.setFrame(m,S(g,"time",0),E.enumValue(K,S(g,"inherit","Normal")))}n.push(f)}}}}if(t.ik)for(let a in t.ik){let r=t.ik[a],o=r[0];if(!o)continue;let l=s.findIkConstraint(a);if(!l)throw new Error("IK Constraint not found: "+a);let c=s.ikConstraints.indexOf(l),d=new os(r.length,r.length<<1,c),u=S(o,"time",0),f=S(o,"mix",1),m=S(o,"softness",0)*i;for(let g=0,w=0;;g++){d.setFrame(g,u,f,m,S(o,"bendPositive",!0)?1:-1,S(o,"compress",!1),S(o,"stretch",!1));let b=r[g+1];if(!b){d.shrink(w);break}let p=S(b,"time",0),x=S(b,"mix",1),y=S(b,"softness",0)*i,v=o.curve;v&&(w=$(v,d,w,g,0,u,p,f,x,1),w=$(v,d,w,g,1,u,p,m,y,i)),u=p,f=x,m=y,o=b}n.push(d)}if(t.transform)for(let a in t.transform){let r=t.transform[a],o=r[0];if(!o)continue;let l=s.findTransformConstraint(a);if(!l)throw new Error("Transform constraint not found: "+a);let c=s.transformConstraints.indexOf(l),d=new ls(r.length,r.length*6,c),u=S(o,"time",0),f=S(o,"mixRotate",1),m=S(o,"mixX",1),g=S(o,"mixY",m),w=S(o,"mixScaleX",1),b=S(o,"mixScaleY",w),p=S(o,"mixShearY",1);for(let x=0,y=0;;x++){d.setFrame(x,u,f,m,g,w,b,p);let v=r[x+1];if(!v){d.shrink(y);break}let A=S(v,"time",0),k=S(v,"mixRotate",1),I=S(v,"mixX",1),Y=S(v,"mixY",I),T=S(v,"mixScaleX",1),R=S(v,"mixScaleY",T),X=S(v,"mixShearY",1),M=o.curve;M&&(y=$(M,d,y,x,0,u,A,f,k,1),y=$(M,d,y,x,1,u,A,m,I,1),y=$(M,d,y,x,2,u,A,g,Y,1),y=$(M,d,y,x,3,u,A,w,T,1),y=$(M,d,y,x,4,u,A,b,R,1),y=$(M,d,y,x,5,u,A,p,X,1)),u=A,f=k,m=I,g=Y,w=T,b=R,w=T,o=v}n.push(d)}if(t.path)for(let a in t.path){let r=t.path[a],o=s.findPathConstraint(a);if(!o)throw new Error("Path constraint not found: "+a);let l=s.pathConstraints.indexOf(o);for(let c in r){let d=r[c],u=d[0];if(!u)continue;let f=d.length;if(c==="position"){let m=new hs(f,f,l);n.push(ut(d,m,0,o.positionMode==vt.Fixed?i:1))}else if(c==="spacing"){let m=new cs(f,f,l);n.push(ut(d,m,0,o.spacingMode==Z.Length||o.spacingMode==Z.Fixed?i:1))}else if(c==="mix"){let m=new ds(f,f*3,l),g=S(u,"time",0),w=S(u,"mixRotate",1),b=S(u,"mixX",1),p=S(u,"mixY",b);for(let x=0,y=0;;x++){m.setFrame(x,g,w,b,p);let v=d[x+1];if(!v){m.shrink(y);break}let A=S(v,"time",0),k=S(v,"mixRotate",1),I=S(v,"mixX",1),Y=S(v,"mixY",I),T=u.curve;T&&(y=$(T,m,y,x,0,g,A,w,k,1),y=$(T,m,y,x,1,g,A,b,I,1),y=$(T,m,y,x,2,g,A,p,Y,1)),g=A,w=k,b=I,p=Y,u=v}n.push(m)}}}if(t.physics)for(let a in t.physics){let r=t.physics[a],o=-1;if(a.length>0){let l=s.findPhysicsConstraint(a);if(!l)throw new Error("Physics constraint not found: "+a);o=s.physicsConstraints.indexOf(l)}for(let l in r){let c=r[l],d=c[0];if(!d)continue;let u=c.length;if(l=="reset"){const m=new le(u,o);for(let g=0;d!=null;d=c[g+1],g++)m.setFrame(g,S(d,"time",0));n.push(m);continue}let f;if(l=="inertia")f=new fs(u,u,o);else if(l=="strength")f=new us(u,u,o);else if(l=="damping")f=new ms(u,u,o);else if(l=="mass")f=new gs(u,u,o);else if(l=="wind")f=new ps(u,u,o);else if(l=="gravity")f=new xs(u,u,o);else if(l=="mix")f=new bs(u,u,o);else continue;n.push(ut(c,f,0,1))}}if(t.attachments)for(let a in t.attachments){let r=t.attachments[a],o=s.findSkin(a);if(!o)throw new Error("Skin not found: "+a);for(let l in r){let c=r[l],d=s.findSlot(l);if(!d)throw new Error("Slot not found: "+l);let u=d.index;for(let f in c){let m=c[f],g=o.getAttachment(u,f);for(let w in m){let b=m[w],p=b[0];if(p){if(w=="deform"){let x=g.bones,y=g.vertices,v=x?y.length/3*2:y.length,A=new as(b.length,b.length,u,g),k=S(p,"time",0);for(let I=0,Y=0;;I++){let T,R=S(p,"vertices",null);if(!R)T=x?E.newFloatArray(v):y;else{T=E.newFloatArray(v);let L=S(p,"offset",0);if(E.arrayCopy(R,0,T,L,R.length),i!=1)for(let O=L,W=O+R.length;O<W;O++)T[O]*=i;if(!x)for(let O=0;O<v;O++)T[O]+=y[O]}A.setFrame(I,k,T);let X=b[I+1];if(!X){A.shrink(Y);break}let M=S(X,"time",0),F=p.curve;F&&(Y=$(F,A,Y,I,0,k,M,0,1,1)),k=M,p=X}n.push(A)}else if(w=="sequence"){let x=new yt(b.length,u,g),y=0;for(let v=0;v<b.length;v++){let A=S(p,"delay",y),k=S(p,"time",0),I=et[S(p,"mode","hold")],Y=S(p,"index",0);x.setFrame(v,k,I,Y,A),y=A,p=b[v+1]}n.push(x)}}}}}}if(t.drawOrder){let a=new Xt(t.drawOrder.length),r=s.slots.length,o=0;for(let l=0;l<t.drawOrder.length;l++,o++){let c=t.drawOrder[l],d=null,u=S(c,"offsets",null);if(u){d=E.newArray(r,-1);let f=E.newArray(r-u.length,0),m=0,g=0;for(let w=0;w<u.length;w++){let b=u[w],p=s.findSlot(b.slot);if(!p)throw new Error("Slot not found: "+p);let x=p.index;for(;m!=x;)f[g++]=m++;d[m+b.offset]=m++}for(;m<r;)f[g++]=m++;for(let w=r-1;w>=0;w--)d[w]==-1&&(d[w]=f[--g])}a.setFrame(o,S(c,"time",0),d)}n.push(a)}if(t.events){let a=new Ht(t.events.length),r=0;for(let o=0;o<t.events.length;o++,r++){let l=t.events[o],c=s.findEvent(l.name);if(!c)throw new Error("Event not found: "+l.name);let d=new Cs(E.toSinglePrecision(S(l,"time",0)),c);d.intValue=S(l,"int",c.intValue),d.floatValue=S(l,"float",c.floatValue),d.stringValue=S(l,"string",c.stringValue),d.data.audioPath&&(d.volume=S(l,"volume",1),d.balance=S(l,"balance",0)),a.setFrame(r,d)}n.push(a)}let h=0;for(let a=0,r=n.length;a<r;a++)h=Math.max(h,n[a].getDuration());s.animations.push(new ye(e,n,h))}}class zi{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}}function ut(C,t,e,s){let i=C[0],n=S(i,"time",0),h=S(i,"value",e)*s,a=0;for(let r=0;;r++){t.setFrame(r,n,h);let o=C[r+1];if(!o)return t.shrink(a),t;let l=S(o,"time",0),c=S(o,"value",e)*s;i.curve&&(a=$(i.curve,t,a,r,0,n,l,h,c,s)),n=l,h=c,i=o}}function xe(C,t,e,s,i,n){let h=C[0],a=S(h,"time",0),r=S(h,e,i)*n,o=S(h,s,i)*n,l=0;for(let c=0;;c++){t.setFrame(c,a,r,o);let d=C[c+1];if(!d)return t.shrink(l),t;let u=S(d,"time",0),f=S(d,e,i)*n,m=S(d,s,i)*n,g=h.curve;g&&(l=$(g,t,l,c,0,a,u,r,f,n),l=$(g,t,l,c,1,a,u,o,m,n)),a=u,r=f,o=m,h=d}}function $(C,t,e,s,i,n,h,a,r,o){if(C=="stepped")return t.setStepped(s),e;let l=i<<2,c=C[l],d=C[l+1]*o,u=C[l+2],f=C[l+3]*o;return t.setBezier(e,s,i,n,a,c,d,u,f,h,r),e+1}function S(C,t,e){return C[t]!==void 0?C[t]:e}typeof Math.fround>"u"&&(Math.fround=(function(C){return function(t){return C[0]=t,C[0]}})(new Float32Array(1)));class mt extends ws{static textureMap=new Map;static from(t){return mt.textureMap.has(t)?mt.textureMap.get(t):new mt(t)}texture;constructor(t){super(t.resource),this.texture=Ve.from(t)}setFilters(t,e){const s=this.texture.source.style;s.minFilter=mt.toPixiTextureFilter(t),s.magFilter=mt.toPixiTextureFilter(e),this.texture.source.autoGenerateMipmaps=mt.toPixiMipMap(t),this.texture.source.updateMipmaps()}setWraps(t,e){const s=this.texture.source.style;s.addressModeU=mt.toPixiTextureWrap(t),s.addressModeV=mt.toPixiTextureWrap(e)}dispose(){this.texture.destroy()}static toPixiMipMap(t){switch(t){case tt.Nearest:case tt.Linear:return!1;case tt.MipMapNearestLinear:case tt.MipMapNearestNearest:case tt.MipMapLinearLinear:case tt.MipMapLinearNearest:return!0;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureFilter(t){switch(t){case tt.Nearest:case tt.MipMapNearestLinear:case tt.MipMapNearestNearest:return"nearest";case tt.Linear:case tt.MipMapLinearLinear:case tt.MipMapLinearNearest:return"linear";default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case St.ClampToEdge:return"clamp-to-edge";case St.MirroredRepeat:return"mirror-repeat";case St.Repeat:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case Tt.Normal:return"normal";case Tt.Additive:return"add";case Tt.Multiply:return"multiply";case Tt.Screen:return"screen";default:throw new Error(`Unknown blendMode: ${String(t)}`)}}}const qt="spineTextureAtlasLoader",Gi={extension:Mt.Asset,resolver:{test:C=>Nt(C,".atlas"),parse:C=>{const t=C.split(".");return{resolution:parseFloat(Xs.RETINA_PREFIX?.exec(C)?.[1]??"1"),format:t[t.length-2],src:C}}},loader:{id:qt,name:qt,extension:{type:Mt.LoadParser,priority:Oe.Normal,name:qt},test(C){return Nt(C,".atlas")},async load(C){return await(await _e.get().fetch(C)).text()},testParse(C,t){const e=Nt(t.src,".atlas"),s=typeof C=="string",i=t.parser===qt||t.loadParser===qt;return Promise.resolve((e||i)&&s)},unload(C){C.dispose()},async parse(C,t,e){const s=t.data||{};let i=Qt.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");const n=new be(C);if(s.images instanceof Ye||typeof s.images=="string"){const a=s.images;s.images={},s.images[n.pages[0].name]=a}const h=[];for(const a of n.pages){const r=a.name,o=s?.images?s.images[r]:void 0;if(o instanceof Ye)a.setTexture(mt.from(o));else{const l=o??Qt.normalize([...i.split(Qt.sep),r].join(Qt.sep)),c={src:Fs(l,t.src),data:{...s.imageMetadata,alphaMode:a.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"}},d=e.load(c).then(u=>{a.setTexture(mt.from(u.source))});h.push(d)}}return await Promise.all(h),n}}};oe.add(Gi);const zt="spineSkeletonLoader";function $i(C){return Object.prototype.hasOwnProperty.call(C,"bones")}function Hi(C){return C instanceof Uint8Array}const ji={extension:Mt.Asset,loader:{id:zt,name:zt,extension:{type:Mt.LoadParser,priority:Oe.Normal,name:zt},test(C){return Nt(C,".skel")},async load(C){const t=await _e.get().fetch(C);return new Uint8Array(await t.arrayBuffer())},testParse(C,t){const e=Nt(t.src,".json")&&$i(C),s=Nt(t.src,".skel")&&Hi(C),i=t.parser===zt||t.loadParser===zt;return Promise.resolve(e||s||i)}}};oe.add(ji);const Ji=new Float32Array(1),Ki=new Uint32Array(1);class Qi extends Ps{constructor(){const e=new Fe({data:Ji,label:"attribute-batch-buffer",usage:Zt.VERTEX|Zt.COPY_DST,shrinkToFit:!1}),s=new Fe({data:Ki,label:"index-batch-buffer",usage:Zt.INDEX|Zt.COPY_DST,shrinkToFit:!1}),i=28;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:i,offset:0},aUV:{buffer:e,format:"float32x2",stride:i,offset:8},aColor:{buffer:e,format:"unorm8x4",stride:i,offset:16},aDarkColor:{buffer:e,format:"unorm8x4",stride:i,offset:20},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:i,offset:24}},indexBuffer:s})}}const Zi={name:"color-bit",vertex:{header:`
3
3
  @in aDarkColor: vec4<f32>;
4
4
  @out vDarkColor: vec4<f32>;