@nova-lab/core 1.0.0-dev.19 → 1.1.0-dev.229

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 (501) hide show
  1. package/README.md +1035 -10
  2. package/THIRD_PARTY_NOTICES.md +26 -0
  3. package/dist/2d/accessibility.d.ts +2 -0
  4. package/dist/2d/accessibility.js +171 -0
  5. package/dist/2d/commands.d.ts +2 -0
  6. package/dist/2d/commands.js +80 -0
  7. package/dist/2d/effects.d.ts +10 -0
  8. package/dist/2d/effects.js +566 -0
  9. package/dist/2d/ktx2.d.ts +5 -0
  10. package/dist/2d/ktx2.js +542 -0
  11. package/dist/2d/lighting.d.ts +3 -0
  12. package/dist/2d/lighting.js +495 -0
  13. package/dist/2d/lottie.d.ts +3 -0
  14. package/dist/2d/lottie.js +254 -0
  15. package/dist/2d/meshes.d.ts +4 -0
  16. package/dist/2d/meshes.js +451 -0
  17. package/dist/2d/primitives.d.ts +3 -0
  18. package/dist/2d/primitives.js +85 -0
  19. package/dist/2d/render-textures.d.ts +3 -0
  20. package/dist/2d/render-textures.js +539 -0
  21. package/dist/2d/svg/documents.d.ts +5 -0
  22. package/dist/2d/svg/documents.js +7 -0
  23. package/dist/2d/svg/renderer.d.ts +3 -0
  24. package/dist/2d/svg/renderer.js +222 -0
  25. package/dist/2d/svg.d.ts +3 -0
  26. package/dist/2d/svg.js +4 -0
  27. package/dist/2d/tools.d.ts +2 -0
  28. package/dist/2d/tools.js +100 -0
  29. package/dist/2d/video.d.ts +5 -0
  30. package/dist/2d/video.js +90 -0
  31. package/dist/2d.d.ts +2 -0
  32. package/dist/2d.js +220 -0
  33. package/dist/3d/animation.d.ts +8 -0
  34. package/dist/3d/animation.js +1396 -0
  35. package/dist/3d/area-lights.d.ts +2 -0
  36. package/dist/3d/area-lights.js +19 -0
  37. package/dist/3d/audio.d.ts +4 -0
  38. package/dist/3d/audio.js +500 -0
  39. package/dist/3d/character.d.ts +2 -0
  40. package/dist/3d/character.js +136 -0
  41. package/dist/3d/collision.d.ts +3 -0
  42. package/dist/3d/collision.js +387 -0
  43. package/dist/3d/commands.d.ts +2 -0
  44. package/dist/3d/commands.js +108 -0
  45. package/dist/3d/controls.d.ts +8 -0
  46. package/dist/3d/controls.js +1041 -0
  47. package/dist/3d/documents.d.ts +5 -0
  48. package/dist/3d/documents.js +227 -0
  49. package/dist/3d/effects.d.ts +5 -0
  50. package/dist/3d/effects.js +1986 -0
  51. package/dist/3d/export.d.ts +4 -0
  52. package/dist/3d/export.js +347 -0
  53. package/dist/3d/fbx.d.ts +2 -0
  54. package/dist/3d/fbx.js +784 -0
  55. package/dist/3d/gltf.d.ts +2 -0
  56. package/dist/3d/gltf.js +5 -0
  57. package/dist/3d/helpers.d.ts +5 -0
  58. package/dist/3d/helpers.js +191 -0
  59. package/dist/3d/ik.d.ts +9 -0
  60. package/dist/3d/ik.js +777 -0
  61. package/dist/3d/loaders.d.ts +17 -0
  62. package/dist/3d/loaders.js +1406 -0
  63. package/dist/3d/nodes.d.ts +8 -0
  64. package/dist/3d/nodes.js +49 -0
  65. package/dist/3d/particles.d.ts +5 -0
  66. package/dist/3d/particles.js +1574 -0
  67. package/dist/3d/physics/backend.d.ts +7 -0
  68. package/dist/3d/physics/backend.js +1 -0
  69. package/dist/3d/physics/rapier.d.ts +3 -0
  70. package/dist/3d/physics/rapier.js +765 -0
  71. package/dist/3d/physics.d.ts +5 -0
  72. package/dist/3d/physics.js +3346 -0
  73. package/dist/3d/splats.d.ts +7 -0
  74. package/dist/3d/splats.js +862 -0
  75. package/dist/3d/text.d.ts +5 -0
  76. package/dist/3d/text.js +1043 -0
  77. package/dist/3d/tiles.d.ts +24 -0
  78. package/dist/3d/tiles.js +1705 -0
  79. package/dist/3d/tools.d.ts +12 -0
  80. package/dist/3d/tools.js +338 -0
  81. package/dist/3d/usdz.d.ts +2 -0
  82. package/dist/3d/usdz.js +634 -0
  83. package/dist/3d/xr.d.ts +2 -0
  84. package/dist/3d/xr.js +202 -0
  85. package/dist/3d-B4jWF8Qb.js +5591 -0
  86. package/dist/3d.d.ts +40 -0
  87. package/dist/3d.js +44 -0
  88. package/dist/Capsule-BFVpZfvc.js +44 -0
  89. package/dist/Clip-CAN7t03k.js +204 -0
  90. package/dist/Color-vuv9UnoY.js +34 -0
  91. package/dist/DeformedMesh-CPi0P_vc.js +280 -0
  92. package/dist/Document-DCVEZSvM.js +415 -0
  93. package/dist/Errors-B2ekO9bZ.js +30 -0
  94. package/dist/Features-BsjmePtc.js +557 -0
  95. package/dist/GLTFResourceIO-CYJyCUTt.js +124 -0
  96. package/dist/GPUParticleState-CQlNpoDa.js +545 -0
  97. package/dist/Geometry-DytO490z.js +227 -0
  98. package/dist/Inflate-DWw0V-Up.js +42 -0
  99. package/dist/InstancedMesh-DPrgrw5z.js +527 -0
  100. package/dist/Limits-Bw5XQdFr.js +20 -0
  101. package/dist/LineHelper-Ad0z9uDi.js +131 -0
  102. package/dist/LoaderIO-BwrM84OM.js +114 -0
  103. package/dist/Material-BpfLPmK9.js +777 -0
  104. package/dist/Mesh-BaRxAAJq.js +209 -0
  105. package/dist/Node-QfgAE2_v.js +877 -0
  106. package/dist/NovaAssetRegistry-p2QlCwvT.js +1168 -0
  107. package/dist/NovaNode-CBZ-Ol-W.js +2016 -0
  108. package/dist/NovaRenderCommandWriter-CWQRa42y.js +1949 -0
  109. package/dist/NovaTextSelectionService-CipuujCT.js +18526 -0
  110. package/dist/NovaWebGLProgram-BO250QNF.js +97 -0
  111. package/dist/Options-CajE7LLJ.js +15 -0
  112. package/dist/PolygonMesh-D4PnnfIo.js +657 -0
  113. package/dist/Ready-BzyhRtjD.js +21 -0
  114. package/dist/Scene-CDfNgf9I.js +911 -0
  115. package/dist/Shader-b6_HDndT.js +48 -0
  116. package/dist/SplatShader-wJ6GJ3vo.js +130 -0
  117. package/dist/Texture-dTKMlTpK.js +267 -0
  118. package/dist/TextureLoader-CfDzdy2m.js +411 -0
  119. package/dist/Textures-CGL4Kf-8.js +651 -0
  120. package/dist/ToneMapping-D9IWvN0u.js +46 -0
  121. package/dist/WebGPURenderer-DjD0IxVC.js +4921 -0
  122. package/dist/ZipReader-C-MSEsSr.js +84 -0
  123. package/dist/core.js +218 -24024
  124. package/dist/domain/types/base.types.d.ts +18 -9
  125. package/dist/domain/types/component.types.d.ts +5 -5
  126. package/dist/domain/types/cursor.types.d.ts +1 -1
  127. package/dist/domain/types/diagnostics.types.d.ts +2 -0
  128. package/dist/domain/types/export.types.d.ts +2 -2
  129. package/dist/domain/types/hit-test.types.d.ts +1 -1
  130. package/dist/domain/types/motion.types.d.ts +2 -2
  131. package/dist/domain/types/renderer.types.d.ts +88 -4
  132. package/dist/domain/types/rendering/index.d.ts +29 -4
  133. package/dist/domain/types/sound.types.d.ts +1 -1
  134. package/dist/domain/types/theme.types.d.ts +1 -1
  135. package/dist/domain/utils/bounds.d.ts +1 -1
  136. package/dist/domain/utils/nova-text.d.ts +9 -0
  137. package/dist/domain/utils/schemaBounds.d.ts +2 -2
  138. package/dist/export-svg-document-ChaNXMaG.js +668 -0
  139. package/dist/features/3d/Errors.d.ts +57 -0
  140. package/dist/features/3d/Nova3DApp.d.ts +429 -0
  141. package/dist/features/3d/animation/Animator.d.ts +260 -0
  142. package/dist/features/3d/animation/Clip.d.ts +74 -0
  143. package/dist/features/3d/animation/Graph.d.ts +158 -0
  144. package/dist/features/3d/animation/Mask.d.ts +40 -0
  145. package/dist/features/3d/audio/Audio.d.ts +114 -0
  146. package/dist/features/3d/audio/Sound.d.ts +133 -0
  147. package/dist/features/3d/character/CharacterController.d.ts +61 -0
  148. package/dist/features/3d/collision/Capsule.d.ts +25 -0
  149. package/dist/features/3d/collision/Octree.d.ts +94 -0
  150. package/dist/features/3d/controls/CameraMotionControls.d.ts +154 -0
  151. package/dist/features/3d/controls/CameraOrientation.d.ts +47 -0
  152. package/dist/features/3d/controls/OrbitControls.d.ts +73 -0
  153. package/dist/features/3d/controls/PointerGesture.d.ts +25 -0
  154. package/dist/features/3d/controls/PointerLock.d.ts +36 -0
  155. package/dist/features/3d/controls/Snapping.d.ts +32 -0
  156. package/dist/features/3d/controls/TransformGizmo.d.ts +79 -0
  157. package/dist/features/3d/deformation/DeformationGPU.d.ts +52 -0
  158. package/dist/features/3d/deformation/DeformationShader.d.ts +2 -0
  159. package/dist/features/3d/deformation/DeformedMesh.d.ts +36 -0
  160. package/dist/features/3d/deformation/GeometryDeformation.d.ts +25 -0
  161. package/dist/features/3d/documents/Document.d.ts +59 -0
  162. package/dist/features/3d/documents/DocumentCommands.d.ts +45 -0
  163. package/dist/features/3d/documents/DocumentSchema.d.ts +18 -0
  164. package/dist/features/3d/documents/DocumentTransform.d.ts +4 -0
  165. package/dist/features/3d/documents/DocumentTypes.d.ts +182 -0
  166. package/dist/features/3d/documents/DocumentValidation.d.ts +18 -0
  167. package/dist/features/3d/documents/Projection.d.ts +65 -0
  168. package/dist/features/3d/effects/CubeLUT.d.ts +24 -0
  169. package/dist/features/3d/effects/Effects.d.ts +32 -0
  170. package/dist/features/3d/effects/EffectsGPU.d.ts +80 -0
  171. package/dist/features/3d/effects/EffectsPlan.d.ts +268 -0
  172. package/dist/features/3d/effects/EffectsShaders.d.ts +35 -0
  173. package/dist/features/3d/export/GLTFExporter.d.ts +49 -0
  174. package/dist/features/3d/export/ThreeMFExporter.d.ts +19 -0
  175. package/dist/features/3d/export/ZipWriter.d.ts +9 -0
  176. package/dist/features/3d/fbx/FBXLoader.d.ts +26 -0
  177. package/dist/features/3d/fbx/FBXParser.d.ts +35 -0
  178. package/dist/features/3d/fbx/FBXScene.d.ts +20 -0
  179. package/dist/features/3d/gltf/GLTFLoader.d.ts +16 -0
  180. package/dist/features/3d/gltf/GLTFTypes.d.ts +64 -0
  181. package/dist/features/3d/gltf/services/GLTFBinary.d.ts +21 -0
  182. package/dist/features/3d/gltf/services/GLTFGeometry.d.ts +14 -0
  183. package/dist/features/3d/gltf/services/GLTFResourceIO.d.ts +64 -0
  184. package/dist/features/3d/helpers/LineHelper.d.ts +51 -0
  185. package/dist/features/3d/helpers/StaticHelpers.d.ts +47 -0
  186. package/dist/features/3d/helpers/TrackedHelpers.d.ts +84 -0
  187. package/dist/features/3d/ik/ChainIK.d.ts +44 -0
  188. package/dist/features/3d/ik/IKChain.d.ts +92 -0
  189. package/dist/features/3d/ik/IKMath.d.ts +49 -0
  190. package/dist/features/3d/ik/IKSolver.d.ts +97 -0
  191. package/dist/features/3d/ik/LookAtIK.d.ts +58 -0
  192. package/dist/features/3d/ik/TwoBoneIK.d.ts +57 -0
  193. package/dist/features/3d/import/ImportAnimation.d.ts +20 -0
  194. package/dist/features/3d/import/ImportMath.d.ts +42 -0
  195. package/dist/features/3d/import/ImportedModel.d.ts +135 -0
  196. package/dist/features/3d/import/Inflate.d.ts +5 -0
  197. package/dist/features/3d/import/ModelAsset.d.ts +149 -0
  198. package/dist/features/3d/import/PolygonMesh.d.ts +54 -0
  199. package/dist/features/3d/lights/AreaLightTables.d.ts +8 -0
  200. package/dist/features/3d/lights/AreaLights.d.ts +11 -0
  201. package/dist/features/3d/loaders/EXRCompression.d.ts +13 -0
  202. package/dist/features/3d/loaders/EXRLoader.d.ts +39 -0
  203. package/dist/features/3d/loaders/HDRLoader.d.ts +26 -0
  204. package/dist/features/3d/loaders/Limits.d.ts +70 -0
  205. package/dist/features/3d/loaders/LoaderBuffers.d.ts +42 -0
  206. package/dist/features/3d/loaders/LoaderIO.d.ts +81 -0
  207. package/dist/features/3d/loaders/LoaderModel.d.ts +80 -0
  208. package/dist/features/3d/loaders/LoaderText.d.ts +27 -0
  209. package/dist/features/3d/loaders/MTLLoader.d.ts +105 -0
  210. package/dist/features/3d/loaders/OBJLoader.d.ts +70 -0
  211. package/dist/features/3d/loaders/PLYLoader.d.ts +47 -0
  212. package/dist/features/3d/loaders/STLLoader.d.ts +27 -0
  213. package/dist/features/3d/model/Camera.d.ts +33 -0
  214. package/dist/features/3d/model/Environment.d.ts +31 -0
  215. package/dist/features/3d/model/Geometry.d.ts +59 -0
  216. package/dist/features/3d/model/InstancedMesh.d.ts +134 -0
  217. package/dist/features/3d/model/LOD.d.ts +31 -0
  218. package/dist/features/3d/model/Light.d.ts +200 -0
  219. package/dist/features/3d/model/Material.d.ts +308 -0
  220. package/dist/features/3d/model/MaterialExtensions.d.ts +200 -0
  221. package/dist/features/3d/model/Mesh.d.ts +92 -0
  222. package/dist/features/3d/model/Node.d.ts +87 -0
  223. package/dist/features/3d/model/ReflectionProbe.d.ts +45 -0
  224. package/dist/features/3d/model/RenderTarget.d.ts +41 -0
  225. package/dist/features/3d/model/Scene.d.ts +173 -0
  226. package/dist/features/3d/model/Texture.d.ts +143 -0
  227. package/dist/features/3d/nodes/Nodes.d.ts +8 -0
  228. package/dist/features/3d/nodes/ShaderNode.d.ts +240 -0
  229. package/dist/features/3d/particles/GPUParticleSchedule.d.ts +67 -0
  230. package/dist/features/3d/particles/GPUParticleShaders.d.ts +19 -0
  231. package/dist/features/3d/particles/GPUParticleState.d.ts +106 -0
  232. package/dist/features/3d/particles/GPUParticleSystem.d.ts +192 -0
  233. package/dist/features/3d/particles/ParticleCurves.d.ts +34 -0
  234. package/dist/features/3d/particles/ParticleOptions.d.ts +78 -0
  235. package/dist/features/3d/particles/ParticleSystem.d.ts +368 -0
  236. package/dist/features/3d/physics/PhysicsBackend.d.ts +352 -0
  237. package/dist/features/3d/physics/PhysicsDebug.d.ts +24 -0
  238. package/dist/features/3d/physics/PhysicsWorld.d.ts +352 -0
  239. package/dist/features/3d/physics/basic/BasicCollision.d.ts +75 -0
  240. package/dist/features/3d/physics/basic/BasicPhysics.d.ts +24 -0
  241. package/dist/features/3d/physics/basic/BasicShapes.d.ts +103 -0
  242. package/dist/features/3d/physics/rapier/ContactBuffer.d.ts +32 -0
  243. package/dist/features/3d/physics/rapier/RapierBackend.d.ts +17 -0
  244. package/dist/features/3d/physics/rapier/RapierShapes.d.ts +4 -0
  245. package/dist/features/3d/physics/rapier/RapierWorld.d.ts +198 -0
  246. package/dist/features/3d/physics/rapier/Validation.d.ts +8 -0
  247. package/dist/features/3d/services/Background.d.ts +22 -0
  248. package/dist/features/3d/services/BasicShader.d.ts +55 -0
  249. package/dist/features/3d/services/ClusteredLights.d.ts +69 -0
  250. package/dist/features/3d/services/DrawOrder.d.ts +37 -0
  251. package/dist/features/3d/services/EffectsProcessor.d.ts +38 -0
  252. package/dist/features/3d/services/EnvironmentBRDF.d.ts +35 -0
  253. package/dist/features/3d/services/EnvironmentMaps.d.ts +55 -0
  254. package/dist/features/3d/services/FogShader.d.ts +6 -0
  255. package/dist/features/3d/services/Frustum.d.ts +7 -0
  256. package/dist/features/3d/services/GLState.d.ts +86 -0
  257. package/dist/features/3d/services/GPUPicker.d.ts +31 -0
  258. package/dist/features/3d/services/InstanceShader.d.ts +3 -0
  259. package/dist/features/3d/services/LineProgram.d.ts +32 -0
  260. package/dist/features/3d/services/PBRProgram.d.ts +115 -0
  261. package/dist/features/3d/services/Renderer.d.ts +50 -0
  262. package/dist/features/3d/services/Shader.d.ts +22 -0
  263. package/dist/features/3d/services/ShaderProgram.d.ts +38 -0
  264. package/dist/features/3d/services/ShadowMaps.d.ts +97 -0
  265. package/dist/features/3d/services/SpatialIndex.d.ts +16 -0
  266. package/dist/features/3d/services/TextureLoader.d.ts +40 -0
  267. package/dist/features/3d/services/TextureMipmaps.d.ts +42 -0
  268. package/dist/features/3d/services/ToneMapping.d.ts +12 -0
  269. package/dist/features/3d/services/WebGLRenderer.d.ts +261 -0
  270. package/dist/features/3d/splats/SplatData.d.ts +136 -0
  271. package/dist/features/3d/splats/SplatLoaders.d.ts +64 -0
  272. package/dist/features/3d/splats/SplatShader.d.ts +14 -0
  273. package/dist/features/3d/splats/SplatSort.d.ts +69 -0
  274. package/dist/features/3d/splats/Splats.d.ts +116 -0
  275. package/dist/features/3d/text/FontAtlas.d.ts +246 -0
  276. package/dist/features/3d/text/SDF.d.ts +28 -0
  277. package/dist/features/3d/text/Text.d.ts +179 -0
  278. package/dist/features/3d/text/TextLayout.d.ts +73 -0
  279. package/dist/features/3d/text/TextShader.d.ts +12 -0
  280. package/dist/features/3d/tiles/BoundingVolume.d.ts +43 -0
  281. package/dist/features/3d/tiles/Geodesy.d.ts +106 -0
  282. package/dist/features/3d/tiles/GlobeControls.d.ts +147 -0
  283. package/dist/features/3d/tiles/TileContent.d.ts +35 -0
  284. package/dist/features/3d/tiles/TileFormats.d.ts +77 -0
  285. package/dist/features/3d/tiles/Tiles3D.d.ts +236 -0
  286. package/dist/features/3d/tiles/Tileset.d.ts +81 -0
  287. package/dist/features/3d/tools/BatchedMesh.d.ts +74 -0
  288. package/dist/features/3d/tools/CanvasSurface.d.ts +81 -0
  289. package/dist/features/3d/tools/Color.d.ts +11 -0
  290. package/dist/features/3d/tools/MergeGeometries.d.ts +22 -0
  291. package/dist/features/3d/tools/Options.d.ts +15 -0
  292. package/dist/features/3d/tools/Polyhedra.d.ts +30 -0
  293. package/dist/features/3d/tools/PrimitiveBuffers.d.ts +42 -0
  294. package/dist/features/3d/tools/Primitives.d.ts +164 -0
  295. package/dist/features/3d/tools/Ready.d.ts +12 -0
  296. package/dist/features/3d/tools/SpatialMath.d.ts +57 -0
  297. package/dist/features/3d/tools/SphericalHarmonics.d.ts +9 -0
  298. package/dist/features/3d/tools/math/mat3.d.ts +7 -0
  299. package/dist/features/3d/tools/math/mat4.d.ts +19 -0
  300. package/dist/features/3d/tools/math/quat.d.ts +6 -0
  301. package/dist/features/3d/tools/math/vec3.d.ts +16 -0
  302. package/dist/features/3d/tools/math/vec4.d.ts +5 -0
  303. package/dist/features/3d/types.d.ts +359 -0
  304. package/dist/features/3d/usdz/USDAParser.d.ts +50 -0
  305. package/dist/features/3d/usdz/USDScene.d.ts +20 -0
  306. package/dist/features/3d/usdz/USDZLoader.d.ts +27 -0
  307. package/dist/features/3d/usdz/ZipReader.d.ts +16 -0
  308. package/dist/features/3d/webgpu/Backend.d.ts +40 -0
  309. package/dist/features/3d/webgpu/BasicShader.d.ts +10 -0
  310. package/dist/features/3d/webgpu/Constants.d.ts +32 -0
  311. package/dist/features/3d/webgpu/Deformation.d.ts +71 -0
  312. package/dist/features/3d/webgpu/Environment.d.ts +66 -0
  313. package/dist/features/3d/webgpu/Features.d.ts +68 -0
  314. package/dist/features/3d/webgpu/Layouts.d.ts +27 -0
  315. package/dist/features/3d/webgpu/Lines.d.ts +40 -0
  316. package/dist/features/3d/webgpu/LitExtras.d.ts +46 -0
  317. package/dist/features/3d/webgpu/LitFeatures.d.ts +41 -0
  318. package/dist/features/3d/webgpu/LitScene.d.ts +60 -0
  319. package/dist/features/3d/webgpu/LitShader.d.ts +68 -0
  320. package/dist/features/3d/webgpu/Particles.d.ts +114 -0
  321. package/dist/features/3d/webgpu/Picking.d.ts +59 -0
  322. package/dist/features/3d/webgpu/PipelineKey.d.ts +33 -0
  323. package/dist/features/3d/webgpu/Points.d.ts +41 -0
  324. package/dist/features/3d/webgpu/Probes.d.ts +45 -0
  325. package/dist/features/3d/webgpu/ShaderChunks.d.ts +18 -0
  326. package/dist/features/3d/webgpu/ShaderMaterial.d.ts +57 -0
  327. package/dist/features/3d/webgpu/ShaderMaterialSource.d.ts +5 -0
  328. package/dist/features/3d/webgpu/Shadows.d.ts +49 -0
  329. package/dist/features/3d/webgpu/Splats.d.ts +47 -0
  330. package/dist/features/3d/webgpu/Textures.d.ts +52 -0
  331. package/dist/features/3d/webgpu/Transmission.d.ts +30 -0
  332. package/dist/features/3d/webgpu/UniformLayout.d.ts +30 -0
  333. package/dist/features/3d/webgpu/UtilityShaders.d.ts +38 -0
  334. package/dist/features/3d/webgpu/WebGPURenderer.d.ts +327 -0
  335. package/dist/features/3d/webgpu/effects/EffectsShaders.d.ts +74 -0
  336. package/dist/features/3d/webgpu/effects/WebGPUEffects.d.ts +140 -0
  337. package/dist/features/3d/xr/XR.d.ts +100 -0
  338. package/dist/gltf-By-n0qEg.js +960 -0
  339. package/dist/index.d.ts +86 -81
  340. package/dist/model/document-actions/document-commands.d.ts +18 -0
  341. package/dist/model/documents/svg/create-svg-document-renderer.d.ts +32 -0
  342. package/dist/model/documents/svg/export-svg-document.d.ts +5 -0
  343. package/dist/model/documents/svg/import-svg-document.d.ts +6 -0
  344. package/dist/model/documents/svg/svg-document.types.d.ts +111 -0
  345. package/dist/model/documents/svg/svg-values.d.ts +16 -0
  346. package/dist/model/documents/svg/svg-xml.d.ts +18 -0
  347. package/dist/model/input/NovaInputProxy_Adapter.d.ts +2 -1
  348. package/dist/model/input/NovaInputValidationController.d.ts +1 -1
  349. package/dist/model/input/NovaTextInputController.d.ts +1 -1
  350. package/dist/model/input/NovaTextLayoutEngine.d.ts +2 -6
  351. package/dist/model/input/index.d.ts +7 -7
  352. package/dist/model/input/nova-input.types.d.ts +1 -1
  353. package/dist/model/lighting/LightingRenderer2D.d.ts +58 -0
  354. package/dist/model/lighting/NovaLighting2D.d.ts +56 -0
  355. package/dist/model/lighting/lighting-shaders.d.ts +3 -0
  356. package/dist/model/lighting/lighting-state.d.ts +27 -0
  357. package/dist/model/lighting/lighting.types.d.ts +107 -0
  358. package/dist/model/lottie/LottieNode.d.ts +4 -0
  359. package/dist/model/lottie/lottie.types.d.ts +83 -0
  360. package/dist/model/lottie/prepare-lottie.d.ts +3 -0
  361. package/dist/model/lottie/sample-position.d.ts +9 -0
  362. package/dist/model/motion/NovaMotionEngine.d.ts +3 -3
  363. package/dist/model/motion/nova-motion-easing.d.ts +1 -1
  364. package/dist/model/motion/nova-motion-interpolation.d.ts +1 -1
  365. package/dist/model/motion/nova-motion-presets.d.ts +2 -2
  366. package/dist/model/motion/nova-motion-timeline.d.ts +1 -1
  367. package/dist/model/platform/NovaCanvas.d.ts +7 -6
  368. package/dist/model/primitives/NovaPrimitiveUnsupportedError.d.ts +13 -0
  369. package/dist/model/primitives/definePrimitive.d.ts +5 -0
  370. package/dist/model/primitives/primitive.types.d.ts +28 -0
  371. package/dist/model/render/backends/canvas2d/NovaCanvas2DTargetManager.d.ts +3 -3
  372. package/dist/model/render/backends/canvas2d/NovaRenderer2D.d.ts +61 -15
  373. package/dist/model/render/backends/canvas2d/nova-canvas-blend.d.ts +5 -0
  374. package/dist/model/render/backends/nova-render-backend-factory.d.ts +6 -6
  375. package/dist/model/render/backends/nova-render-backend.d.ts +8 -2
  376. package/dist/model/render/backends/webgl/NovaRendererWebGL.d.ts +32 -11
  377. package/dist/model/render/backends/webgl/NovaStreamCacheIdleLedger.d.ts +12 -1
  378. package/dist/model/render/backends/webgl/NovaWebGLBatcher.d.ts +1 -1
  379. package/dist/model/render/backends/webgl/NovaWebGLCircleImagePass.d.ts +23 -0
  380. package/dist/model/render/backends/webgl/NovaWebGLCompositionPass.d.ts +9 -0
  381. package/dist/model/render/backends/webgl/NovaWebGLDevice.d.ts +3 -1
  382. package/dist/model/render/backends/webgl/NovaWebGLDiagnostics.d.ts +1 -1
  383. package/dist/model/render/backends/webgl/NovaWebGLFrameRenderer.d.ts +162 -53
  384. package/dist/model/render/backends/webgl/NovaWebGLPathClipPass.d.ts +13 -0
  385. package/dist/model/render/backends/webgl/NovaWebGLPathUnion.d.ts +23 -0
  386. package/dist/model/render/compiler/NovaRenderBuilder.d.ts +24 -10
  387. package/dist/model/render/compiler/NovaRenderCommandWriter.d.ts +10 -5
  388. package/dist/model/render/compiler/NovaRenderCompiler.d.ts +7 -6
  389. package/dist/model/render/compiler/NovaRenderFrameBuilder.d.ts +4 -3
  390. package/dist/model/render/effects/blur.d.ts +8 -0
  391. package/dist/model/render/effects/color-matrix.d.ts +8 -0
  392. package/dist/model/render/effects/drop-shadow.d.ts +18 -0
  393. package/dist/model/render/effects/nova-effect-registry.d.ts +66 -0
  394. package/dist/model/render/effects/nova-gaussian-kernel.d.ts +7 -0
  395. package/dist/model/render/effects/nova-gaussian-textures.d.ts +11 -0
  396. package/dist/model/render/effects/shader-effect.d.ts +64 -0
  397. package/dist/model/render/geometry/nova-alpha-mask.d.ts +5 -0
  398. package/dist/model/render/geometry/nova-composition.d.ts +9 -0
  399. package/dist/model/render/geometry/nova-node-clip.d.ts +17 -0
  400. package/dist/model/render/geometry/nova-path-geometry.d.ts +24 -0
  401. package/dist/model/render/geometry/nova-path-tessellation.d.ts +7 -0
  402. package/dist/model/render/geometry/nova-polygon-triangulation.d.ts +1 -1
  403. package/dist/model/render/graph/NovaRectBatchBuffer.d.ts +58 -0
  404. package/dist/model/render/graph/NovaRenderGraph.d.ts +40 -6
  405. package/dist/model/render/graph/NovaRenderHitIndex.d.ts +1 -1
  406. package/dist/model/render/graph/nova-auto-rect.d.ts +1 -1
  407. package/dist/model/render/graph/nova-linear-rect-repack.d.ts +4 -4
  408. package/dist/model/render/graph/nova-linear-rect-transition.d.ts +2 -2
  409. package/dist/model/render/graph/nova-render-culling.d.ts +2 -2
  410. package/dist/model/render/graph/nova-render-dirty-items.d.ts +1 -1
  411. package/dist/model/render/graph/nova-render-group.d.ts +1 -1
  412. package/dist/model/render/graph/nova-render-item.d.ts +2 -2
  413. package/dist/model/render/graph/nova-render-layer.d.ts +1 -1
  414. package/dist/model/render/graph/nova-render-payload-snapshot.d.ts +3 -1
  415. package/dist/model/render/graph/nova-render-program.d.ts +5 -3
  416. package/dist/model/render/graph/nova-render-sequence.d.ts +1 -1
  417. package/dist/model/render/graph/nova-render-stream.d.ts +2 -2
  418. package/dist/model/render/ktx2/BasisSession.d.ts +45 -0
  419. package/dist/model/render/ktx2/KTX2Container.d.ts +26 -0
  420. package/dist/model/render/ktx2/KTX2Loader.d.ts +55 -0
  421. package/dist/model/render/meshes/MeshNode.d.ts +13 -0
  422. package/dist/model/render/meshes/NovaMeshWebGLDevice.d.ts +27 -0
  423. package/dist/model/render/meshes/geometry.d.ts +7 -0
  424. package/dist/model/render/meshes/mesh.d.ts +3 -0
  425. package/dist/model/render/meshes/mesh.types.d.ts +116 -0
  426. package/dist/model/render/meshes/nova-mesh-registry.d.ts +55 -0
  427. package/dist/model/render/orchestration/NovaRenderOrchestrator.d.ts +25 -3
  428. package/dist/model/render/policy/nova-render-policy.d.ts +1 -1
  429. package/dist/model/render/resources/NovaGlyphAtlasManager.d.ts +2 -2
  430. package/dist/model/render/resources/NovaTextAtlasManager.d.ts +3 -3
  431. package/dist/model/render/resources/NovaTextLayoutEngine.d.ts +1 -1
  432. package/dist/model/render/resources/nova-bitmap-upload.d.ts +10 -0
  433. package/dist/model/render/schema/NovaRenderContext.d.ts +6 -4
  434. package/dist/model/render/schema/nova-style-compiler.d.ts +5 -2
  435. package/dist/model/render/targets/NovaNodeRenderTextureSource.d.ts +29 -0
  436. package/dist/model/render/targets/NovaRenderTargetManager.d.ts +1 -1
  437. package/dist/model/render/targets/NovaRenderTexture.d.ts +57 -0
  438. package/dist/model/render/targets/nova-render-target-refs.d.ts +5 -0
  439. package/dist/model/render/targets/nova-render-target-resource.d.ts +1 -1
  440. package/dist/model/render/targets/nova-render-texture-runtime.d.ts +71 -0
  441. package/dist/model/render/textures/nova-compressed-image.d.ts +20 -0
  442. package/dist/model/render/utils/nova-icon-rendering.d.ts +3 -1
  443. package/dist/model/render/utils/nova-image-geometry.d.ts +11 -0
  444. package/dist/model/render/utils/nova-markdown-layout.d.ts +19 -0
  445. package/dist/model/render/utils/nova-text-paint.d.ts +26 -0
  446. package/dist/model/render/utils/nova-wrapped-text-layout.d.ts +19 -0
  447. package/dist/model/runtime/app/Nova.d.ts +35 -35
  448. package/dist/model/runtime/app/NovaApp.d.ts +58 -30
  449. package/dist/model/runtime/app/NovaRaphRuntime.d.ts +2 -2
  450. package/dist/model/runtime/app/createNovaRaphRuntime.d.ts +3 -3
  451. package/dist/model/runtime/assets/NovaAssetRegistry.d.ts +89 -2
  452. package/dist/model/runtime/assets/NovaVideoTexture.d.ts +38 -0
  453. package/dist/model/runtime/assets/nova-render-texture-image-identity.d.ts +4 -0
  454. package/dist/model/runtime/commands/NovaCommandBus.d.ts +1 -1
  455. package/dist/model/runtime/components/NovaComponentNode.d.ts +6 -6
  456. package/dist/model/runtime/components/NovaComponentRegistry.d.ts +1 -1
  457. package/dist/model/runtime/components/NovaSchemaRegistry.d.ts +7 -6
  458. package/dist/model/runtime/components/nova-component-metadata.d.ts +1 -1
  459. package/dist/model/runtime/components/nova-component.decorator.d.ts +2 -2
  460. package/dist/model/runtime/components/nova-defined-component.d.ts +3 -3
  461. package/dist/model/runtime/context/nova-context.d.ts +1 -1
  462. package/dist/model/runtime/cursor/NovaCursorManager.d.ts +3 -3
  463. package/dist/model/runtime/diagnostics/NovaDiagnostics_Module.d.ts +3 -3
  464. package/dist/model/runtime/interaction/NovaEvents.d.ts +16 -6
  465. package/dist/model/runtime/interaction/NovaHitIndex.d.ts +1 -1
  466. package/dist/model/runtime/interaction/NovaSpatialIndex.d.ts +2 -2
  467. package/dist/model/runtime/scene/NovaScene.d.ts +3 -3
  468. package/dist/model/runtime/scene/nova-scene-components.d.ts +6 -6
  469. package/dist/model/runtime/state/nova-store-decorators.d.ts +1 -1
  470. package/dist/model/runtime/state/nova-store-runtime.d.ts +1 -1
  471. package/dist/model/runtime/state/nova-store-tracking.d.ts +7 -3
  472. package/dist/model/runtime/sync/NovaSyncScope.d.ts +11 -2
  473. package/dist/model/runtime/sync/nova-sync-context.d.ts +2 -2
  474. package/dist/model/runtime/sync/nova-sync-ports.d.ts +2 -2
  475. package/dist/model/runtime/sync/nova-sync.types.d.ts +15 -3
  476. package/dist/model/runtime/template/NovaTemplateRuntime.d.ts +6 -6
  477. package/dist/model/runtime/tree/NovaContainer.d.ts +4 -4
  478. package/dist/model/runtime/tree/NovaNode.d.ts +58 -18
  479. package/dist/model/runtime/tree/NovaRaphNode.d.ts +8 -2
  480. package/dist/model/runtime/tree/NovaSurface.d.ts +32 -10
  481. package/dist/model/runtime/tree/nova-node-capture-invalidation.d.ts +11 -0
  482. package/dist/model/semantic/NovaSemanticService.d.ts +1 -1
  483. package/dist/model/semantic/browser/createAccessibilityBridge.d.ts +29 -0
  484. package/dist/model/sound/NovaSoundEngine.d.ts +3 -2
  485. package/dist/model/text-selection/NovaTextSelectionService.d.ts +2 -2
  486. package/dist/model/text-selection/index.d.ts +2 -2
  487. package/dist/model/text-selection/nova-text-selection.types.d.ts +1 -1
  488. package/dist/model/theme/NovaGlobalThemeRegistry.d.ts +2 -2
  489. package/dist/model/theme/NovaThemeService.d.ts +5 -3
  490. package/dist/model/theme/createTokenTheme.d.ts +15 -0
  491. package/dist/model/tools/transform-tools.d.ts +43 -0
  492. package/dist/nodes--Ds4IS2h.js +621 -0
  493. package/dist/nova-color-parser-BCN_rFRN.js +250 -0
  494. package/dist/nova-compressed-image-CE2Ya9Xa.js +46 -0
  495. package/dist/nova-mesh-registry-B7Xz5mhU.js +24 -0
  496. package/dist/nova-render-texture-image-identity-DQ09XFKs.js +15 -0
  497. package/dist/nova-text-paint-CcntsRjI.js +48 -0
  498. package/dist/tokens.d.ts +2 -0
  499. package/dist/tokens.js +50 -0
  500. package/dist/vec4-BTNv1fUp.js +20 -0
  501. package/package.json +223 -4
package/dist/3d/ik.js ADDED
@@ -0,0 +1,777 @@
1
+ import { c as F, o as O } from "../Options-CajE7LLJ.js";
2
+ import { N as p } from "../Errors-B2ekO9bZ.js";
3
+ import { N as z } from "../Node-QfgAE2_v.js";
4
+ function y(s, t, n, e, i) {
5
+ for (let r = 0; r < i; r++)
6
+ s[t + r] = n[e + r];
7
+ }
8
+ function P(s, t, n) {
9
+ const e = Math.sqrt(s[t] * s[t] + s[t + 1] * s[t + 1] + s[t + 2] * s[t + 2]);
10
+ return e > n ? (s[t] /= e, s[t + 1] /= e, s[t + 2] /= e, !0) : !1;
11
+ }
12
+ function j(s, t, n, e, i) {
13
+ const r = s[t] * n[e] + s[t + 1] * n[e + 1] + s[t + 2] * n[e + 2];
14
+ return s[t] -= r * n[e], s[t + 1] -= r * n[e + 1], s[t + 2] -= r * n[e + 2], P(s, t, i);
15
+ }
16
+ function v(s, t, n, e, i, r) {
17
+ s[t] = n[e] - i[r], s[t + 1] = n[e + 1] - i[r + 1], s[t + 2] = n[e + 2] - i[r + 2];
18
+ }
19
+ function R(s, t, n, e, i, r) {
20
+ const a = n[e] - i[r], o = n[e + 1] - i[r + 1], h = n[e + 2] - i[r + 2];
21
+ s[t] = Math.sqrt(a * a + o * o + h * h);
22
+ }
23
+ function A(s, t, n, e, i, r) {
24
+ const a = n[e], o = n[e + 1], h = n[e + 2], c = i[r], l = i[r + 1], f = i[r + 2];
25
+ s[t] = o * f - h * l, s[t + 1] = h * c - a * f, s[t + 2] = a * l - o * c;
26
+ }
27
+ function B(s, t) {
28
+ s[t] = 0, s[t + 1] = 0, s[t + 2] = 0, s[t + 3] = 1;
29
+ }
30
+ function I(s, t, n, e, i, r) {
31
+ const a = n[e], o = n[e + 1], h = n[e + 2], c = n[e + 3], l = i[r], f = i[r + 1], _ = i[r + 2], w = i[r + 3];
32
+ s[t] = a * w + c * l + o * _ - h * f, s[t + 1] = o * w + c * f + h * l - a * _, s[t + 2] = h * w + c * _ + a * f - o * l, s[t + 3] = c * w - a * l - o * f - h * _;
33
+ }
34
+ function J(s, t, n, e, i, r) {
35
+ const a = -n[e], o = -n[e + 1], h = -n[e + 2], c = n[e + 3], l = i[r], f = i[r + 1], _ = i[r + 2], w = i[r + 3];
36
+ s[t] = a * w + c * l + o * _ - h * f, s[t + 1] = o * w + c * f + h * l - a * _, s[t + 2] = h * w + c * _ + a * f - o * l, s[t + 3] = c * w - a * l - o * f - h * _;
37
+ }
38
+ function st(s, t, n, e, i, r) {
39
+ const a = n[e], o = n[e + 1], h = n[e + 2], c = n[e + 3], l = -i[r], f = -i[r + 1], _ = -i[r + 2], w = i[r + 3];
40
+ s[t] = a * w + c * l + o * _ - h * f, s[t + 1] = o * w + c * f + h * l - a * _, s[t + 2] = h * w + c * _ + a * f - o * l, s[t + 3] = c * w - a * l - o * f - h * _;
41
+ }
42
+ function Y(s, t) {
43
+ const n = Math.sqrt(s[t] * s[t] + s[t + 1] * s[t + 1] + s[t + 2] * s[t + 2] + s[t + 3] * s[t + 3]);
44
+ if (n < 1e-300) {
45
+ B(s, t);
46
+ return;
47
+ }
48
+ s[t] /= n, s[t + 1] /= n, s[t + 2] /= n, s[t + 3] /= n;
49
+ }
50
+ function C(s, t, n, e, i, r) {
51
+ const a = n[e], o = n[e + 1], h = n[e + 2], c = n[e + 3], l = i[r], f = i[r + 1], _ = i[r + 2], w = 2 * (o * _ - h * f), d = 2 * (h * l - a * _), m = 2 * (a * f - o * l);
52
+ s[t] = l + c * w + o * m - h * d, s[t + 1] = f + c * d + h * w - a * m, s[t + 2] = _ + c * m + a * d - o * w;
53
+ }
54
+ function lt(s, t, n, e, i, r) {
55
+ const a = -n[e], o = -n[e + 1], h = -n[e + 2], c = n[e + 3], l = i[r], f = i[r + 1], _ = i[r + 2], w = 2 * (o * _ - h * f), d = 2 * (h * l - a * _), m = 2 * (a * f - o * l);
56
+ s[t] = l + c * w + o * m - h * d, s[t + 1] = f + c * d + h * w - a * m, s[t + 2] = _ + c * m + a * d - o * w;
57
+ }
58
+ function N(s, t, n, e) {
59
+ const i = n[e + 3] / 2, r = Math.sin(i), a = n[e], o = n[e + 1], h = n[e + 2];
60
+ s[t] = a * r, s[t + 1] = o * r, s[t + 2] = h * r, s[t + 3] = Math.cos(i);
61
+ }
62
+ function _t(s, t, n, e, i, r) {
63
+ const a = n[e], o = n[e + 1], h = n[e + 2], c = i[r], l = i[r + 1], f = i[r + 2], _ = Math.sqrt(a * a + o * o + h * h), w = Math.sqrt(c * c + l * l + f * f);
64
+ if (_ < 1e-12 || w < 1e-12)
65
+ return B(s, t), !1;
66
+ const d = (a * c + o * l + h * f) / (_ * w);
67
+ if (d < -0.999999) {
68
+ let m = 0, x = -h, g = o;
69
+ x * x + g * g < 1e-12 * _ * _ && (m = h, x = 0, g = -a);
70
+ const u = Math.sqrt(m * m + x * x + g * g);
71
+ return s[t] = m / u, s[t + 1] = x / u, s[t + 2] = g / u, s[t + 3] = 0, !0;
72
+ }
73
+ return s[t] = (o * f - h * l) / (_ * w), s[t + 1] = (h * c - a * f) / (_ * w), s[t + 2] = (a * l - o * c) / (_ * w), s[t + 3] = 1 + d, Y(s, t), !0;
74
+ }
75
+ function ft(s, t, n, e, i, r, a, o) {
76
+ const h = a[o], c = n[e], l = n[e + 1], f = n[e + 2], _ = n[e + 3];
77
+ let w = i[r], d = i[r + 1], m = i[r + 2], x = i[r + 3], g = c * w + l * d + f * m + _ * x;
78
+ g < 0 && (g = -g, w = -w, d = -d, m = -m, x = -x);
79
+ let u = 1 - h, M = h;
80
+ if (g < 0.9995) {
81
+ const S = Math.acos(g), H = Math.sin(S);
82
+ u = Math.sin((1 - h) * S) / H, M = Math.sin(h * S) / H;
83
+ }
84
+ s[t] = u * c + M * w, s[t + 1] = u * l + M * d, s[t + 2] = u * f + M * m, s[t + 3] = u * _ + M * x, Y(s, t);
85
+ }
86
+ function dt(s, t, n, e) {
87
+ const i = n[e], r = n[e + 1], a = n[e + 2], o = n[e + 3], h = n[e + 4], c = n[e + 5], l = n[e + 6], f = n[e + 7], _ = n[e + 8], w = i + h + _;
88
+ if (w > 0) {
89
+ const d = 0.5 / Math.sqrt(w + 1);
90
+ s[t + 3] = 0.25 / d, s[t] = (c - f) * d, s[t + 1] = (l - a) * d, s[t + 2] = (r - o) * d;
91
+ } else if (i > h && i > _) {
92
+ const d = 2 * Math.sqrt(1 + i - h - _);
93
+ s[t + 3] = (c - f) / d, s[t] = 0.25 * d, s[t + 1] = (o + r) / d, s[t + 2] = (l + a) / d;
94
+ } else if (h > _) {
95
+ const d = 2 * Math.sqrt(1 + h - i - _);
96
+ s[t + 3] = (l - a) / d, s[t] = (o + r) / d, s[t + 1] = 0.25 * d, s[t + 2] = (f + c) / d;
97
+ } else {
98
+ const d = 2 * Math.sqrt(1 + _ - i - h);
99
+ s[t + 3] = (r - o) / d, s[t] = (l + a) / d, s[t + 1] = (f + c) / d, s[t + 2] = 0.25 * d;
100
+ }
101
+ Y(s, t);
102
+ }
103
+ function wt(s, t, n, e) {
104
+ const i = n[e], r = n[e + 1], a = n[e + 2], o = n[e + 3], h = 1 - 2 * (r * r + a * a), c = 2 * (i * r - a * o), l = 2 * (i * a + r * o), f = 1 - 2 * (i * i + a * a), _ = 2 * (r * a - i * o), w = 2 * (r * a + i * o), d = 1 - 2 * (i * i + r * r);
105
+ s[t + 1] = Math.asin(Math.max(-1, Math.min(1, l))), Math.abs(l) < 0.9999999 ? (s[t] = Math.atan2(-_, d), s[t + 2] = Math.atan2(-c, h)) : (s[t] = Math.atan2(w, f), s[t + 2] = 0);
106
+ }
107
+ function mt(s, t, n, e) {
108
+ const i = n[e] / 2, r = n[e + 1] / 2, a = n[e + 2] / 2, o = Math.sin(i), h = Math.sin(r), c = Math.sin(a), l = Math.cos(i), f = Math.cos(r), _ = Math.cos(a);
109
+ s[t] = o * f * _ + l * h * c, s[t + 1] = l * h * _ - o * f * c, s[t + 2] = l * f * c + o * h * _, s[t + 3] = l * f * _ - o * h * c;
110
+ }
111
+ function pt(s, t, n, e, i, r) {
112
+ const a = n[e] * i[r] + n[e + 1] * i[r + 1] + n[e + 2] * i[r + 2];
113
+ let o = 2 * Math.atan2(a, n[e + 3]);
114
+ o > Math.PI ? o -= 2 * Math.PI : o <= -Math.PI && (o += 2 * Math.PI), s[t] = o;
115
+ }
116
+ const ut = { euler: /* @__PURE__ */ new Set(["type", "min", "max"]), cone: /* @__PURE__ */ new Set(["type", "swing", "twist", "axis"]), hinge: /* @__PURE__ */ new Set(["type", "axis", "min", "max"]) }, V = 0, G = 1, xt = 2, T = 3, D = 10, b = new Float64Array(D), U = new Float64Array(D);
117
+ function at(s, t, n) {
118
+ t[n] = 0, t[n + 1] = 0, t[n + 2] = 0, B(t, n + 3), t[n + 7] = 1, t[n + 8] = 1, t[n + 9] = 1;
119
+ let e = s;
120
+ for (; e instanceof z; ) {
121
+ e._readLocal(b, 0, !0);
122
+ const i = b[7] * t[n], r = b[8] * t[n + 1], a = b[9] * t[n + 2];
123
+ t[n] = i, t[n + 1] = r, t[n + 2] = a, C(t, n, b, 3, t, n), t[n] += b[0], t[n + 1] += b[1], t[n + 2] += b[2], I(t, n + 3, b, 3, t, n + 3), t[n + 7] *= b[7], t[n + 8] *= b[8], t[n + 9] *= b[9], e = e.parent;
124
+ }
125
+ }
126
+ function q(s, t) {
127
+ if (typeof s != "number" || !Number.isFinite(s))
128
+ throw new p("invalid-option", `[Nova3D] IK ${t} must be a finite number.`);
129
+ return s;
130
+ }
131
+ function K(s, t, n) {
132
+ if (!Array.isArray(s) && !ArrayBuffer.isView(s) || s.length !== t)
133
+ throw new p("invalid-option", `[Nova3D] IK ${n} must have ${t} components.`);
134
+ return Array.from(s, (e) => q(e, n));
135
+ }
136
+ function Q(s, t) {
137
+ const n = K(s, 3, t), e = Math.hypot(n[0], n[1], n[2]);
138
+ if (e < 1e-12)
139
+ throw new p("invalid-option", `[Nova3D] IK ${t} must be nonzero.`);
140
+ return n.map((i) => i / e);
141
+ }
142
+ class E {
143
+ path;
144
+ size;
145
+ jointCount;
146
+ /** Path index of each joint. */
147
+ jointPath;
148
+ enabled;
149
+ /** Read pose per path node: position 3, pre-IK rotation 4, scale 3. */
150
+ local;
151
+ /** Local rotation being solved per path node. */
152
+ rotation;
153
+ wp;
154
+ wq;
155
+ ws;
156
+ rest;
157
+ axis;
158
+ limitKind;
159
+ limit;
160
+ /** Blend weight used by `write`. */
161
+ weight = new Float64Array([1]);
162
+ _relative = new Float64Array(16);
163
+ _out = new Float64Array(4);
164
+ _vector = new Float64Array(3);
165
+ constructor(t, n) {
166
+ if (t.length === 0)
167
+ throw new p("invalid-option", "[Nova3D] IK chain needs at least one joint.");
168
+ for (const h of t)
169
+ if (!(h?.node instanceof z) || h.node.destroyed)
170
+ throw new p("invalid-option", "[Nova3D] IK joints must be live nodes.");
171
+ if (!(n instanceof z) || n.destroyed)
172
+ throw new p("invalid-option", "[Nova3D] IK effector must be a live node.");
173
+ const e = t[0].node, i = [];
174
+ let r = n;
175
+ for (; r instanceof z && (i.push(r), r !== e); )
176
+ r = r.parent;
177
+ if (i[i.length - 1] !== e)
178
+ throw new p("invalid-option", "[Nova3D] IK joints and effector must form one parent → child chain.");
179
+ const a = i.reverse();
180
+ this.path = Object.freeze(a), this.size = a.length, this.jointCount = t.length, this.jointPath = new Int32Array(t.length), this.enabled = new Uint8Array(t.length), this.rest = new Float64Array(t.length * 4), this.axis = new Float64Array(t.length * 3), this.limitKind = new Uint8Array(t.length), this.limit = new Float64Array(t.length * 6), this.local = new Float64Array(this.size * D), this.rotation = new Float64Array(this.size * 4), this.wp = new Float64Array((this.size + 1) * 3), this.wq = new Float64Array((this.size + 1) * 4), this.ws = new Float64Array((this.size + 1) * 3);
181
+ let o = -1;
182
+ for (let h = 0; h < t.length; h++) {
183
+ const c = a.indexOf(t[h].node);
184
+ if (c <= o)
185
+ throw new p("invalid-option", "[Nova3D] IK joints must be distinct ancestors listed from root to effector.");
186
+ o = c, this.jointPath[h] = c, this.enabled[h] = t[h].enabled === !1 ? 0 : 1;
187
+ const l = t[h].rest === void 0 ? t[h].node._baseTransform().quaternion : K(t[h].rest, 4, "rest"), f = Math.hypot(l[0], l[1], l[2], l[3]);
188
+ if (f < 1e-12)
189
+ throw new p("invalid-option", "[Nova3D] IK rest rotation must be nonzero.");
190
+ for (let _ = 0; _ < 4; _++)
191
+ this.rest[h * 4 + _] = l[_] / f;
192
+ this.setLimit(h, t[h].limit ?? null);
193
+ }
194
+ }
195
+ /** True while every path node is alive. */
196
+ alive() {
197
+ for (let t = 0; t < this.size; t++)
198
+ if (this.path[t].destroyed)
199
+ return !1;
200
+ return !0;
201
+ }
202
+ setLimit(t, n) {
203
+ const e = t * 6, i = t * 3, r = this.jointPath[t];
204
+ if (r + 1 < this.size) {
205
+ const o = this.path[r + 1]._baseTransform().position;
206
+ this.axis[i] = o[0], this.axis[i + 1] = o[1], this.axis[i + 2] = o[2];
207
+ } else
208
+ this.axis[i] = 0, this.axis[i + 1] = 0, this.axis[i + 2] = 1;
209
+ if (P(this.axis, i, 1e-12) || (this.axis[i + 1] = 1), n === null) {
210
+ this.limitKind[t] = V;
211
+ return;
212
+ }
213
+ const a = ut[n?.type];
214
+ if (a && F(n, a, `IK ${n.type} limit`), n?.type === "euler") {
215
+ const o = K(n.min, 3, "euler min"), h = K(n.max, 3, "euler max");
216
+ for (let c = 0; c < 3; c++) {
217
+ if (o[c] > h[c])
218
+ throw new p("invalid-option", "[Nova3D] IK euler min must not exceed max.");
219
+ this.limit[e + c] = o[c], this.limit[e + 3 + c] = h[c];
220
+ }
221
+ this.limitKind[t] = G;
222
+ return;
223
+ }
224
+ if (n?.type === "cone") {
225
+ const o = q(n.swing, "cone swing"), h = n.twist === void 0 ? [-Math.PI, Math.PI] : K(n.twist, 2, "cone twist");
226
+ if (o < 0 || o > Math.PI || h[0] > h[1])
227
+ throw new p("invalid-option", "[Nova3D] IK cone needs swing in [0, π] and twist min ≤ max.");
228
+ if (n.axis !== void 0) {
229
+ const c = Q(n.axis, "cone axis");
230
+ this.axis[i] = c[0], this.axis[i + 1] = c[1], this.axis[i + 2] = c[2];
231
+ }
232
+ this.limit[e] = o, this.limit[e + 1] = h[0], this.limit[e + 2] = h[1], this.limitKind[t] = xt;
233
+ return;
234
+ }
235
+ if (n?.type === "hinge") {
236
+ const o = Q(n.axis, "hinge axis"), h = n.min === void 0 ? -Math.PI : q(n.min, "hinge min"), c = n.max === void 0 ? Math.PI : q(n.max, "hinge max");
237
+ if (h > c)
238
+ throw new p("invalid-option", "[Nova3D] IK hinge min must not exceed max.");
239
+ this.axis[i] = o[0], this.axis[i + 1] = o[1], this.axis[i + 2] = o[2], this.limit[e] = h, this.limit[e + 1] = c, this.limitKind[t] = T;
240
+ return;
241
+ }
242
+ throw new p("invalid-option", "[Nova3D] IK limit type must be euler, cone or hinge.");
243
+ }
244
+ isHinge(t) {
245
+ return this.limitKind[t] === T;
246
+ }
247
+ /** Reads the pre-IK pose of the chain and its parent world, then runs forward kinematics. */
248
+ read() {
249
+ const t = this.path[0].parent;
250
+ at(t instanceof z ? t : null, U, 0), y(this.wp, 0, U, 0, 3), y(this.wq, 0, U, 3, 4), y(this.ws, 0, U, 7, 3);
251
+ let n = 0;
252
+ for (let e = 0; e < this.size; e++) {
253
+ const i = n < this.jointCount && this.jointPath[n] === e;
254
+ this.path[e]._readLocal(this.local, e * D, !i), i && n++, y(this.rotation, e * 4, this.local, e * D + 3, 4);
255
+ }
256
+ this.fk(0, this.size - 1);
257
+ }
258
+ /** Forward kinematics for path nodes `from`..`to` from the world slot before `from`. */
259
+ fk(t, n) {
260
+ const { wp: e, wq: i, ws: r, local: a, rotation: o } = this, h = this._vector;
261
+ for (let c = t; c <= n; c++) {
262
+ const l = c * 3, f = c * 4, _ = c * D;
263
+ h[0] = r[l] * a[_], h[1] = r[l + 1] * a[_ + 1], h[2] = r[l + 2] * a[_ + 2], C(h, 0, i, f, h, 0), e[l + 3] = e[l] + h[0], e[l + 4] = e[l + 1] + h[1], e[l + 5] = e[l + 2] + h[2], I(i, f + 4, i, f, o, f), r[l + 3] = r[l] * a[_ + 7], r[l + 4] = r[l + 1] * a[_ + 8], r[l + 5] = r[l + 2] * a[_ + 9];
264
+ }
265
+ }
266
+ /**
267
+ * Applies world rotation `r` to path node `index` (joint `joint`, -1 for none) about its
268
+ * pivot, applies the joint limit and refreshes its world rotation; descendants need `fk`.
269
+ */
270
+ rotateWorld(t, n, e, i) {
271
+ const { wq: r, rotation: a } = this, o = t * 4;
272
+ I(a, o, e, i, r, o + 4), J(a, o, r, o, a, o), Y(a, o), n >= 0 && this.constrain(n), I(r, o + 4, r, o, a, o);
273
+ }
274
+ /** Clamps the solving rotation of `joint` to its limit. */
275
+ constrain(t) {
276
+ const n = this.limitKind[t];
277
+ if (n === V)
278
+ return;
279
+ const e = this.jointPath[t] * 4, i = this._relative, r = this.rest, a = t * 4, o = t * 6, h = this.limit;
280
+ if (J(i, 0, r, a, this.rotation, e), n === G)
281
+ wt(i, 4, i, 0), i[4] = Math.min(Math.max(i[4], h[o]), h[o + 3]), i[5] = Math.min(Math.max(i[5], h[o + 1]), h[o + 4]), i[6] = Math.min(Math.max(i[6], h[o + 2]), h[o + 5]), mt(i, 0, i, 4);
282
+ else if (y(i, 12, this.axis, t * 3, 3), pt(i, 15, i, 0, i, 12), n === T)
283
+ i[15] = Math.min(Math.max(i[15], h[o]), h[o + 1]), N(i, 0, i, 12);
284
+ else {
285
+ if (N(i, 4, i, 12), st(i, 0, i, 0, i, 4), i[3] < 0 && (i[0] = -i[0], i[1] = -i[1], i[2] = -i[2], i[3] = -i[3]), 2 * Math.acos(Math.min(1, i[3])) > h[o]) {
286
+ const c = Math.sqrt(i[0] * i[0] + i[1] * i[1] + i[2] * i[2]);
287
+ c > 1e-12 && (i[8] = i[0] / c, i[9] = i[1] / c, i[10] = i[2] / c, i[11] = h[o], N(i, 0, i, 8));
288
+ }
289
+ i[15] = Math.min(Math.max(i[15], h[o + 1]), h[o + 2]), N(i, 4, i, 12), I(i, 0, i, 0, i, 4);
290
+ }
291
+ I(this.rotation, e, r, a, i, 0), Y(this.rotation, e);
292
+ }
293
+ /** Writes joint rotations blended from the pre-IK pose by `weight[0]`. */
294
+ write(t) {
295
+ const n = this._out, e = this.weight;
296
+ for (let i = 0; i < this.jointCount; i++) {
297
+ const r = this.jointPath[i];
298
+ if (this.enabled[i] === 0) {
299
+ this.path[r]._clearPoseRotation(t);
300
+ continue;
301
+ }
302
+ e[0] >= 1 ? y(n, 0, this.rotation, r * 4, 4) : ft(n, 0, this.local, r * D + 3, this.rotation, r * 4, e, 0), this.path[r]._setPoseRotation(t, n, 0);
303
+ }
304
+ }
305
+ claim(t) {
306
+ for (let n = 0; n < this.jointCount; n++) {
307
+ const e = this.path[this.jointPath[n]];
308
+ try {
309
+ e._claimPoseRotation(t);
310
+ } catch (i) {
311
+ for (let r = 0; r < n; r++)
312
+ this.path[this.jointPath[r]]._clearPoseRotation(t, !0);
313
+ throw i;
314
+ }
315
+ }
316
+ }
317
+ clear(t, n = !1) {
318
+ for (let e = 0; e < this.jointCount; e++)
319
+ this.path[this.jointPath[e]]._clearPoseRotation(t, n);
320
+ }
321
+ }
322
+ const W = { target: !0, weight: !0, enabled: !0, clock: !0 }, gt = /* @__PURE__ */ new Set(["node", "enabled", "limit", "rest"]), L = /* @__PURE__ */ new WeakMap();
323
+ class yt {
324
+ constructor(t) {
325
+ this._app = t;
326
+ }
327
+ solvers = [];
328
+ _release;
329
+ _run = () => {
330
+ const t = this.solvers;
331
+ for (let n = 0; n < t.length; n++) {
332
+ const e = t[n];
333
+ e._frame(), t[n] !== e && n--;
334
+ }
335
+ };
336
+ add(t) {
337
+ this.solvers.push(t), this._release ??= this._app._onPose(this._run);
338
+ }
339
+ remove(t) {
340
+ const n = this.solvers.indexOf(t);
341
+ n >= 0 && this.solvers.splice(n, 1), this.solvers.length === 0 && (this._release?.(), this._release = void 0, L.delete(this._app));
342
+ }
343
+ }
344
+ class $ {
345
+ /** @internal */
346
+ constructor(t, n, e) {
347
+ if (this._app = t, this._chain = n, !t || t.destroyed || !t._ownsScene(n.path[0].scene))
348
+ throw new p("owner", "[Nova3D] IK solver requires a live app that owns the joints' scene.");
349
+ const i = e.clock ?? "app";
350
+ if (i !== "app" && i !== "manual")
351
+ throw new p("invalid-option", "[Nova3D] IK clock must be app or manual.");
352
+ if (this._clock = i, this._targetNode = this._resolvePoint(e.target, this._target, "target"), this._weight = X(e.weight ?? 1), e.enabled !== void 0 && typeof e.enabled != "boolean")
353
+ throw new p("invalid-option", "[Nova3D] IK enabled must be boolean.");
354
+ this._enabled = e.enabled ?? !0;
355
+ }
356
+ /** @internal */
357
+ _target = new Float64Array(3);
358
+ /** @internal */
359
+ _point = new Float64Array(10);
360
+ _targetNode = null;
361
+ _weight = 1;
362
+ _enabled = !0;
363
+ /**
364
+ * Residual of the last solve, written by `_solve`.
365
+ * @internal
366
+ */
367
+ _result = new Float64Array([Number.NaN]);
368
+ _destroyed = !1;
369
+ _clock;
370
+ _cleanup = [];
371
+ get weight() {
372
+ return this._weight;
373
+ }
374
+ get enabled() {
375
+ return this._enabled;
376
+ }
377
+ /** 'app' solves every rendered frame; 'manual' only in `update()`. */
378
+ get clock() {
379
+ return this._clock;
380
+ }
381
+ get destroyed() {
382
+ return this._destroyed;
383
+ }
384
+ /** Distance (look-at: angle in radians) left after the last solve; NaN when skipped. */
385
+ get error() {
386
+ return this._result[0];
387
+ }
388
+ /** Joint nodes from root to tip. */
389
+ get joints() {
390
+ const t = [];
391
+ for (let n = 0; n < this._chain.jointCount; n++)
392
+ t.push(this._chain.path[this._chain.jointPath[n]]);
393
+ return t;
394
+ }
395
+ setWeight(t) {
396
+ this._assertUsable(), this._weight = X(t), this._changed();
397
+ }
398
+ setEnabled(t) {
399
+ if (this._assertUsable(), typeof t != "boolean")
400
+ throw new p("invalid-option", "[Nova3D] IK enabled must be boolean.");
401
+ this._enabled = t, t || this._chain.clear(this), this._changed();
402
+ }
403
+ setTarget(t) {
404
+ this._assertUsable(), this._targetNode = this._resolvePoint(t, this._target, "target"), this._changed();
405
+ }
406
+ /** Current target world position. */
407
+ getTarget() {
408
+ return this._assertUsable(), this._targetNode = this._readPoint(this._targetNode, this._target), [this._target[0], this._target[1], this._target[2]];
409
+ }
410
+ /**
411
+ * Solves now from the current animated pose and writes the blended rotations; the residual
412
+ * is in `error`. With the 'app' clock it runs by itself every rendered frame. IK has
413
+ * no time step, so it takes no `deltaTime`.
414
+ */
415
+ update() {
416
+ this._assertUsable(), this._run();
417
+ }
418
+ destroy() {
419
+ if (!this._destroyed) {
420
+ this._destroyed = !0, this._chain.clear(this, !0), L.get(this._app)?.remove(this);
421
+ for (const t of this._cleanup.splice(0))
422
+ t();
423
+ }
424
+ }
425
+ /** @internal */
426
+ _frame() {
427
+ if (!this._destroyed) {
428
+ if (this._app.destroyed || !this._chain.alive()) {
429
+ this.destroy();
430
+ return;
431
+ }
432
+ this._run();
433
+ }
434
+ }
435
+ /**
436
+ * Claims the joints and joins the frame phase; subclasses call it last.
437
+ * @internal
438
+ */
439
+ _activate() {
440
+ if (this._chain.claim(this), this._cleanup.push(this._app._own(() => this.destroy())), this._clock === "app") {
441
+ let t = L.get(this._app);
442
+ t || (t = new yt(this._app), L.set(this._app, t)), t.add(this);
443
+ }
444
+ this._changed();
445
+ }
446
+ /**
447
+ * Validates a point option; returns the node to follow or null for a fixed point.
448
+ * @internal
449
+ */
450
+ _resolvePoint(t, n, e) {
451
+ if (t instanceof z) {
452
+ if (t.destroyed || t.scene !== this._chain.path[0].scene)
453
+ throw new p("owner", `[Nova3D] IK ${e} node must be live and in the joints' scene.`);
454
+ return this._readPoint(t, n);
455
+ }
456
+ const i = K(t, 3, e);
457
+ return n[0] = i[0], n[1] = i[1], n[2] = i[2], null;
458
+ }
459
+ /**
460
+ * Refreshes a followed point; a destroyed node leaves its last position.
461
+ * @internal
462
+ */
463
+ _readPoint(t, n) {
464
+ return !t || t.destroyed ? null : (at(t, this._point, 0), n[0] = this._point[0], n[1] = this._point[1], n[2] = this._point[2], t);
465
+ }
466
+ /** @internal */
467
+ _assertUsable() {
468
+ if (this._destroyed || this._app.destroyed || !this._chain.alive())
469
+ throw new p("destroyed", "[Nova3D] IK solver is destroyed or its joints are no longer live.");
470
+ }
471
+ /**
472
+ * Requests a frame after a parameter change.
473
+ * @internal
474
+ */
475
+ _changed() {
476
+ this._chain.path[0].scene._invalidate();
477
+ }
478
+ _run() {
479
+ if (!this._enabled || this._weight === 0) {
480
+ this._chain.clear(this), this._result[0] = Number.NaN;
481
+ return;
482
+ }
483
+ this._targetNode = this._readPoint(this._targetNode, this._target), this._chain.read(), this._solve(), this._chain.weight[0] = this._weight, this._chain.write(this);
484
+ }
485
+ }
486
+ class rt extends $ {
487
+ /** @internal */
488
+ _iterations = 10;
489
+ /** @internal */
490
+ _tolerance = 1e-4;
491
+ /** @internal */
492
+ constructor(t, n, e) {
493
+ super(t, n, e), this._iterations = Z(e.iterations ?? 10), this._tolerance = tt(e.tolerance ?? 1e-4);
494
+ }
495
+ get iterations() {
496
+ return this._iterations;
497
+ }
498
+ get tolerance() {
499
+ return this._tolerance;
500
+ }
501
+ setIterations(t) {
502
+ this._assertUsable(), this._iterations = Z(t), this._changed();
503
+ }
504
+ setTolerance(t) {
505
+ this._assertUsable(), this._tolerance = tt(t), this._changed();
506
+ }
507
+ /** Enables or disables one joint (index from root); disabled joints keep the animated rotation. */
508
+ setJointEnabled(t, n) {
509
+ if (this._assertUsable(), this._jointIndex(t), typeof n != "boolean")
510
+ throw new p("invalid-option", "[Nova3D] IK joint enabled must be boolean.");
511
+ this._chain.enabled[t] = n ? 1 : 0, this._changed();
512
+ }
513
+ setJointLimit(t, n) {
514
+ this._assertUsable(), this._chain.setLimit(this._jointIndex(t), n), this._changed();
515
+ }
516
+ _jointIndex(t) {
517
+ if (!Number.isInteger(t) || t < 0 || t >= this._chain.jointCount)
518
+ throw new p("invalid-option", "[Nova3D] IK joint index is out of range.");
519
+ return t;
520
+ }
521
+ }
522
+ function ht(s) {
523
+ if (!Array.isArray(s))
524
+ throw new p("invalid-option", "[Nova3D] IK joints must be an array.");
525
+ return s.map((t) => t instanceof z ? { node: t } : (F(t, gt, "IK joint"), t));
526
+ }
527
+ function X(s) {
528
+ if (typeof s != "number" || !(s >= 0 && s <= 1))
529
+ throw new p("invalid-option", "[Nova3D] IK weight must be in [0, 1].");
530
+ return s;
531
+ }
532
+ function Z(s) {
533
+ if (!Number.isInteger(s) || s < 1 || s > 1e3)
534
+ throw new p("invalid-option", "[Nova3D] IK iterations must be an integer in [1, 1000].");
535
+ return s;
536
+ }
537
+ function tt(s) {
538
+ if (typeof s != "number" || !(s >= 0) || !Number.isFinite(s))
539
+ throw new p("invalid-option", "[Nova3D] IK tolerance must be a finite number ≥ 0.");
540
+ return s;
541
+ }
542
+ const ot = O({ ...W, joints: !0, effector: !0, iterations: !0, tolerance: !0 });
543
+ function ct(s, t, n, e) {
544
+ return s.isHinge(t) ? (C(e, 12, s.wq, (n + 1) * 4, s.axis, t * 3), !j(e, 0, e, 12, 1e-12) || !j(e, 4, e, 12, 1e-12) ? !1 : (A(e, 16, e, 0, e, 4), e[15] = Math.atan2(e[16] * e[12] + e[17] * e[13] + e[18] * e[14], e[0] * e[4] + e[1] * e[5] + e[2] * e[6]), N(e, 8, e, 12), !0)) : _t(e, 8, e, 0, e, 4);
545
+ }
546
+ class vt extends rt {
547
+ type = "ccd";
548
+ /** from 0, to 4, rotation 8, axis-angle 12, cross 16, previous world rotation 20, effector 24. */
549
+ _s = new Float64Array(28);
550
+ /** @internal */
551
+ constructor(t, n) {
552
+ super(t, new E(ht(n.joints), n.effector), n), this._activate();
553
+ }
554
+ /** @internal */
555
+ _solve() {
556
+ const t = this._chain, { wp: n, wq: e, jointPath: i, enabled: r } = t, a = this._s, o = this._target, h = t.size - 1, c = (h + 1) * 3, l = this._tolerance * this._tolerance;
557
+ y(a, 24, n, c, 3);
558
+ for (let f = 0; f < this._iterations && (v(a, 0, a, 24, o, 0), !(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] <= l)); f++) {
559
+ for (let _ = t.jointCount - 1; _ >= 0; _--) {
560
+ if (r[_] === 0)
561
+ continue;
562
+ const w = i[_], d = (w + 1) * 3;
563
+ if (v(a, 0, a, 24, n, d), v(a, 4, o, 0, n, d), !!ct(t, _, w, a)) {
564
+ y(a, 20, e, (w + 1) * 4, 4), t.rotateWorld(w, _, a, 8), st(a, 8, e, (w + 1) * 4, a, 20), v(a, 0, a, 24, n, d), C(a, 0, a, 8, a, 0);
565
+ for (let m = 0; m < 3; m++)
566
+ a[24 + m] = n[d + m] + a[m];
567
+ }
568
+ }
569
+ t.fk(0, h), y(a, 24, n, c, 3);
570
+ }
571
+ R(this._result, 0, n, c, o, 0);
572
+ }
573
+ }
574
+ class Mt extends rt {
575
+ type = "fabrik";
576
+ _s = new Float64Array(20);
577
+ _points;
578
+ _lengths;
579
+ /** @internal */
580
+ constructor(t, n) {
581
+ super(t, new E(ht(n.joints), n.effector), n), this._points = new Float64Array((this._chain.jointCount + 1) * 3), this._lengths = new Float64Array(this._chain.jointCount), this._activate();
582
+ }
583
+ /** @internal */
584
+ _solve() {
585
+ const t = this._chain, { wp: n, jointPath: e, enabled: i, jointCount: r } = t, a = this._s, o = this._target, h = this._points, c = this._lengths, l = t.size - 1, f = (l + 1) * 3, _ = this._tolerance * this._tolerance;
586
+ this._gather();
587
+ for (let w = 0; w < r; w++)
588
+ R(c, w, h, w * 3, h, w * 3 + 3);
589
+ for (let w = 0; w < this._iterations && (v(a, 0, n, f, o, 0), !(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] <= _)); w++) {
590
+ y(h, r * 3, o, 0, 3);
591
+ for (let d = r - 1; d >= 0; d--) {
592
+ const m = d * 3;
593
+ v(a, 0, h, m, h, m + 3);
594
+ const x = Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]);
595
+ if (x > 1e-12) {
596
+ const g = c[d] / x;
597
+ for (let u = 0; u < 3; u++)
598
+ h[m + u] = h[m + 3 + u] + a[u] * g;
599
+ }
600
+ }
601
+ for (let d = 0; d < r; d++) {
602
+ const m = e[d], x = d + 1 < r ? e[d + 1] : l;
603
+ if (t.fk(m + 1, x), i[d] === 1) {
604
+ const g = (m + 1) * 3;
605
+ v(a, 0, n, (x + 1) * 3, n, g), v(a, 4, h, d * 3 + 3, n, g), ct(t, d, m, a) && (t.rotateWorld(m, d, a, 8), t.fk(m + 1, x));
606
+ }
607
+ }
608
+ this._gather();
609
+ }
610
+ R(this._result, 0, n, f, o, 0);
611
+ }
612
+ /** Joint and effector world positions into `_points`. */
613
+ _gather() {
614
+ const t = this._chain;
615
+ for (let n = 0; n < t.jointCount; n++)
616
+ y(this._points, n * 3, t.wp, (t.jointPath[n] + 1) * 3, 3);
617
+ y(this._points, t.jointCount * 3, t.wp, t.size * 3, 3);
618
+ }
619
+ }
620
+ function Ft(s, t) {
621
+ return F(t, ot, "IK CCD"), new vt(s, t);
622
+ }
623
+ function kt(s, t) {
624
+ return F(t, ot, "IK FABRIK"), new Mt(s, t);
625
+ }
626
+ const bt = O({ minYaw: !0, maxYaw: !0, minPitch: !0, maxPitch: !0 }), Pt = O({ ...W, node: !0, forward: !0, up: !0, minYaw: !0, maxYaw: !0, minPitch: !0, maxPitch: !0, rest: !0 });
627
+ class It extends $ {
628
+ type = "look-at";
629
+ /** forward 0, up 3, right 6, frame 9, direction 13, yaw 17, pitch 21, axis-angle 25. */
630
+ _s = new Float64Array(29);
631
+ _minYaw = -Math.PI;
632
+ _maxYaw = Math.PI;
633
+ _minPitch = -Math.PI / 2;
634
+ _maxPitch = Math.PI / 2;
635
+ /** @internal */
636
+ constructor(t, n) {
637
+ super(t, new E([{ node: n.node, rest: n.rest }], n.node), n);
638
+ const e = this._s;
639
+ if (e.set(K(n.forward ?? [0, 0, 1], 3, "forward"), 0), e.set(K(n.up ?? [0, 1, 0], 3, "up"), 3), !P(e, 0, 1e-12))
640
+ throw new p("invalid-option", "[Nova3D] IK forward must be nonzero.");
641
+ if (!j(e, 3, e, 0, 1e-6))
642
+ throw new p("invalid-option", "[Nova3D] IK up must not be parallel to forward.");
643
+ A(e, 6, e, 3, e, 0), this._setLimits(n), this._activate();
644
+ }
645
+ get limits() {
646
+ return { minYaw: this._minYaw, maxYaw: this._maxYaw, minPitch: this._minPitch, maxPitch: this._maxPitch };
647
+ }
648
+ /** Changes the given yaw and pitch limits (radians); omitted ones keep their values. */
649
+ setLimits(t) {
650
+ F(t, bt, "IK look-at limits"), this._setLimits(t);
651
+ }
652
+ _setLimits(t) {
653
+ this._assertUsable();
654
+ const n = t.minYaw ?? this._minYaw, e = t.maxYaw ?? this._maxYaw, i = t.minPitch ?? this._minPitch, r = t.maxPitch ?? this._maxPitch;
655
+ for (const a of [n, e, i, r])
656
+ if (typeof a != "number" || !Number.isFinite(a))
657
+ throw new p("invalid-option", "[Nova3D] IK look-at limits must be finite.");
658
+ if (n > e || i > r || n < -Math.PI || e > Math.PI || i < -Math.PI / 2 || r > Math.PI / 2)
659
+ throw new p("invalid-option", "[Nova3D] IK look-at needs min ≤ max, yaw within ±π and pitch within ±π/2.");
660
+ this._minYaw = n, this._maxYaw = e, this._minPitch = i, this._maxPitch = r, this._changed();
661
+ }
662
+ /** @internal */
663
+ _solve() {
664
+ const t = this._chain, n = this._s;
665
+ if (I(n, 9, t.wq, 0, t.rest, 0), v(n, 13, this._target, 0, t.wp, 3), lt(n, 13, n, 9, n, 13), !P(n, 13, 1e-12)) {
666
+ y(t.rotation, 0, t.rest, 0, 4), this._result[0] = 0;
667
+ return;
668
+ }
669
+ const e = n[13] * n[6] + n[14] * n[7] + n[15] * n[8], i = n[13] * n[3] + n[14] * n[4] + n[15] * n[5], r = n[13] * n[0] + n[14] * n[1] + n[15] * n[2], a = Math.min(Math.max(Math.atan2(e, r), this._minYaw), this._maxYaw), o = Math.min(Math.max(Math.atan2(i, Math.sqrt(e * e + r * r)), this._minPitch), this._maxPitch);
670
+ y(n, 25, n, 3, 3), n[28] = a, N(n, 17, n, 25), y(n, 25, n, 6, 3), n[28] = -o, N(n, 21, n, 25), I(n, 17, n, 17, n, 21), I(t.rotation, 0, t.rest, 0, n, 17);
671
+ const h = Math.cos(o), c = Math.sin(a) * h * e + Math.sin(o) * i + Math.cos(a) * h * r;
672
+ this._result[0] = Math.acos(Math.min(Math.max(c, -1), 1));
673
+ }
674
+ }
675
+ function jt(s, t) {
676
+ return F(t, Pt, "IK look-at"), new It(s, t);
677
+ }
678
+ const Nt = O({ ...W, root: !0, mid: !0, tip: !0, pole: !0, poleAngle: !0, bendAxis: !0, maxReach: !0 }), k = 1e-9;
679
+ function et(s, t, n) {
680
+ if (j(s, t, s, n, 1e-7))
681
+ return;
682
+ const e = Math.abs(s[n]) < 0.9 ? 1 : 0;
683
+ s[t] = e, s[t + 1] = 1 - e, s[t + 2] = 0, j(s, t, s, n, 0);
684
+ }
685
+ class Kt extends $ {
686
+ type = "two-bone";
687
+ _pole = new Float64Array(3);
688
+ _poleNode = null;
689
+ _hasPole = !1;
690
+ _poleAngle = 0;
691
+ _maxReach = 1;
692
+ _bendAxis = new Float64Array(3);
693
+ /**
694
+ * ab 0, bc 3, at 6, u 9, n 12, v 15, x1 18, b1 21, tip 24, e0 27, e1 30, n0 33, b0 36,
695
+ * q 39, axis-angle 43, basis 47, upper length 56.
696
+ */
697
+ _s = new Float64Array(60);
698
+ /** @internal */
699
+ constructor(t, n) {
700
+ if (super(t, new E([{ node: n.root }, { node: n.mid }], n.tip), n), this._chain.jointPath[1] === this._chain.size - 1)
701
+ throw new p("invalid-option", "[Nova3D] Two-bone IK tip must be a descendant of mid.");
702
+ this._setPole(n.pole ?? null), this._poleAngle = nt(n.poleAngle ?? 0), this._maxReach = it(n.maxReach ?? 1);
703
+ const e = K(n.bendAxis ?? [0, 0, 1], 3, "bendAxis");
704
+ if (this._bendAxis.set(e), !P(this._bendAxis, 0, 1e-12))
705
+ throw new p("invalid-option", "[Nova3D] IK bendAxis must be nonzero.");
706
+ this._activate();
707
+ }
708
+ get poleAngle() {
709
+ return this._poleAngle;
710
+ }
711
+ get maxReach() {
712
+ return this._maxReach;
713
+ }
714
+ setPole(t) {
715
+ this._assertUsable(), this._setPole(t), this._changed();
716
+ }
717
+ setPoleAngle(t) {
718
+ this._assertUsable(), this._poleAngle = nt(t), this._changed();
719
+ }
720
+ setMaxReach(t) {
721
+ this._assertUsable(), this._maxReach = it(t), this._changed();
722
+ }
723
+ /** @internal */
724
+ _solve() {
725
+ const t = this._chain, n = t.wp, e = this._s, i = this._target, r = t.jointPath[1], a = t.size - 1, o = 3, h = (r + 1) * 3, c = (a + 1) * 3;
726
+ this._hasPole && (this._poleNode = this._readPoint(this._poleNode, this._pole)), v(e, 0, n, h, n, o), v(e, 3, n, c, n, h), v(e, 6, i, 0, n, o);
727
+ const l = Math.sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2]), f = Math.sqrt(e[3] * e[3] + e[4] * e[4] + e[5] * e[5]);
728
+ let _ = Math.sqrt(e[6] * e[6] + e[7] * e[7] + e[8] * e[8]);
729
+ if (l < k || f < k) {
730
+ R(this._result, 0, n, c, i, 0);
731
+ return;
732
+ }
733
+ P(e, 0, 0), P(e, 3, 0), _ > k ? (e[9] = e[6] / _, e[10] = e[7] / _, e[11] = e[8] / _) : (_ = 0, v(e, 9, n, c, n, o), P(e, 9, k) || y(e, 9, e, 0, 3)), A(e, 33, e, 0, e, 3), P(e, 33, k) || (C(e, 33, t.wq, (r + 1) * 4, this._bendAxis, 0), et(e, 33, 0));
734
+ let w = !1;
735
+ this._hasPole && (v(e, 15, this._pole, 0, n, o), w = j(e, 15, e, 9, 1e-7), w && A(e, 12, e, 15, e, 9)), w || (y(e, 12, e, 33, 3), et(e, 12, 9)), this._poleAngle !== 0 && (y(e, 43, e, 9, 3), e[46] = this._poleAngle, N(e, 39, e, 43), C(e, 12, e, 39, e, 12)), A(e, 15, e, 9, e, 12);
736
+ const d = this._maxReach * (l + f), m = Math.min(Math.max(_, Math.abs(l - f) + k), d), x = Math.min(Math.max((l * l + m * m - f * f) / (2 * l * m), -1), 1), g = Math.sqrt(1 - x * x);
737
+ for (let u = 0; u < 3; u++)
738
+ e[18 + u] = x * e[9 + u] + g * e[15 + u], e[24 + u] = n[o + u] + m * e[9 + u];
739
+ A(e, 36, e, 0, e, 33), A(e, 21, e, 18, e, 12);
740
+ for (let u = 0; u < 3; u++)
741
+ for (let M = 0; M < 3; M++)
742
+ e[47 + u * 3 + M] = e[18 + M] * e[u] + e[12 + M] * e[33 + u] + e[21 + M] * e[36 + u];
743
+ dt(e, 39, e, 47), t.rotateWorld(0, -1, e, 39), t.fk(1, a), v(e, 27, n, c, n, h), v(e, 30, e, 24, n, h), A(e, 36, e, 27, e, 30), y(e, 43, e, 12, 3), e[46] = Math.atan2(e[36] * e[12] + e[37] * e[13] + e[38] * e[14], e[27] * e[30] + e[28] * e[31] + e[29] * e[32]), N(e, 39, e, 43), t.rotateWorld(r, -1, e, 39), t.fk(r + 1, a), R(this._result, 0, n, c, i, 0);
744
+ }
745
+ _setPole(t) {
746
+ if (t === null) {
747
+ this._hasPole = !1, this._poleNode = null;
748
+ return;
749
+ }
750
+ this._poleNode = this._resolvePoint(t, this._pole, "pole"), this._hasPole = !0;
751
+ }
752
+ }
753
+ function Ct(s, t) {
754
+ return F(t, Nt, "IK two-bone"), new Kt(s, t);
755
+ }
756
+ function nt(s) {
757
+ if (typeof s != "number" || !Number.isFinite(s))
758
+ throw new p("invalid-option", "[Nova3D] IK poleAngle must be finite.");
759
+ return s;
760
+ }
761
+ function it(s) {
762
+ if (typeof s != "number" || !(s > 0 && s <= 1))
763
+ throw new p("invalid-option", "[Nova3D] IK maxReach must be in (0, 1].");
764
+ return s;
765
+ }
766
+ export {
767
+ vt as Nova3DCCDIK,
768
+ Mt as Nova3DFABRIK,
769
+ rt as Nova3DIKChainSolver,
770
+ $ as Nova3DIKSolver,
771
+ It as Nova3DLookAtIK,
772
+ Kt as Nova3DTwoBoneIK,
773
+ Ft as createCCDIK,
774
+ kt as createFABRIK,
775
+ jt as createLookAtIK,
776
+ Ct as createTwoBoneIK
777
+ };