@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
@@ -0,0 +1,668 @@
1
+ import { toSvgPathData as T, definePath as R, getStrokeOutline as lt } from "@typedworks/geometry";
2
+ import { parseSvgPathData as L } from "@typedworks/geometry/svg";
3
+ class s extends Error {
4
+ code;
5
+ location;
6
+ constructor(r, i, n = "svg") {
7
+ super(`[Nova SVG] ${i} (${n})`), this.name = "NovaSvgError", this.code = r, this.location = n;
8
+ }
9
+ }
10
+ const Y = Object.freeze([1, 0, 0, 1, 0, 0]), A = "[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?", ct = new RegExp(`^${A}$`, "i"), ft = new RegExp(`^(${A})(?:px)?$`, "i");
11
+ function $(t, r, i = !1) {
12
+ const n = (i ? ft : ct).exec(t.trim()), e = n ? Number(i ? n[1] : n[0]) : Number.NaN;
13
+ if (!Number.isFinite(e))
14
+ throw new s("invalid-value", `Expected a finite ${i ? "user-unit/px length" : "number"}: ${t}`, r);
15
+ return e;
16
+ }
17
+ function U(t, r) {
18
+ const i = new RegExp(A, "iy"), n = [];
19
+ let e = 0;
20
+ for (; e < t.length; ) {
21
+ const o = e;
22
+ for (; /\s/.test(t[e] ?? "") && e < t.length; )
23
+ e += 1;
24
+ if (t[e] === ",") {
25
+ if (!n.length)
26
+ throw new s("invalid-value", "Unexpected comma", r);
27
+ for (e += 1; /\s/.test(t[e] ?? "") && e < t.length; )
28
+ e += 1;
29
+ if (e === t.length)
30
+ throw new s("invalid-value", "Trailing comma", r);
31
+ }
32
+ if (e === t.length)
33
+ break;
34
+ if (e === o && n.length)
35
+ throw new s("invalid-value", "Expected number separator", r);
36
+ i.lastIndex = e;
37
+ const a = i.exec(t);
38
+ if (!a)
39
+ throw new s("invalid-value", "Invalid number list", r);
40
+ n.push($(a[0], r)), e = i.lastIndex;
41
+ }
42
+ return n;
43
+ }
44
+ function V(t, r) {
45
+ const [i, n, e, o, a, c] = t, [l, d, f, p, h, b] = r, y = [i * l + e * d, n * l + o * d, i * f + e * p, n * f + o * p, i * h + e * b + a, n * h + o * b + c];
46
+ if (y.some((m) => !Number.isFinite(m)))
47
+ throw new s("invalid-value", "Transform exceeds the finite range");
48
+ return y;
49
+ }
50
+ function C(t, r) {
51
+ let i = Y, n = t.trim();
52
+ for (; n; ) {
53
+ const e = /^(matrix|translate|scale|rotate|skewX|skewY)\s*\(([^()]*)\)/.exec(n);
54
+ if (!e)
55
+ throw new s("invalid-value", "Unsupported or malformed transform", r);
56
+ const o = U(e[2], r), [a = 0, c = 0, l = 0] = o, d = a * Math.PI / 180;
57
+ let f;
58
+ switch (e[1]) {
59
+ case "matrix":
60
+ if (o.length !== 6)
61
+ throw new s("invalid-value", "matrix requires six numbers", r);
62
+ f = o;
63
+ break;
64
+ case "translate":
65
+ if (o.length < 1 || o.length > 2)
66
+ throw new s("invalid-value", "translate requires one or two numbers", r);
67
+ f = [1, 0, 0, 1, a, c];
68
+ break;
69
+ case "scale":
70
+ if (o.length < 1 || o.length > 2)
71
+ throw new s("invalid-value", "scale requires one or two numbers", r);
72
+ f = [a, 0, 0, o.length === 1 ? a : c, 0, 0];
73
+ break;
74
+ case "rotate": {
75
+ if (o.length !== 1 && o.length !== 3)
76
+ throw new s("invalid-value", "rotate requires one or three numbers", r);
77
+ const p = Math.cos(d), h = Math.sin(d);
78
+ f = [p, h, -h, p, c - p * c + h * l, l - h * c - p * l];
79
+ break;
80
+ }
81
+ default:
82
+ if (o.length !== 1 || Math.abs(a % 180) === 90)
83
+ throw new s("invalid-value", "Invalid skew angle", r);
84
+ f = e[1] === "skewX" ? [1, 0, Math.tan(d), 1, 0, 0] : [1, Math.tan(d), 0, 1, 0, 0];
85
+ }
86
+ if (i = V(i, f), n = n.slice(e[0].length).trimStart(), n.startsWith(",") && (n = n.slice(1).trimStart(), !n))
87
+ throw new s("invalid-value", "Trailing transform separator", r);
88
+ }
89
+ return Object.freeze(i);
90
+ }
91
+ function Z(t, r) {
92
+ const i = t.trim().replace(/\s+/g, " ");
93
+ if (i === "none")
94
+ return "none";
95
+ const n = /^(x(?:Min|Mid|Max)Y(?:Min|Mid|Max))(?: (meet|slice))?$/.exec(i);
96
+ if (!n)
97
+ throw new s("unsupported", "Unsupported preserveAspectRatio", r);
98
+ return `${n[1]} ${n[2] ?? "meet"}`;
99
+ }
100
+ function bt(t, r, i, n) {
101
+ const [e, o, a, c] = t, l = r / a, d = i / c;
102
+ if (n === "none")
103
+ return [l, 0, 0, d, -e * l, -o * d];
104
+ const f = n.endsWith("slice") ? Math.max(l, d) : Math.min(l, d), p = (r - a * f) * (n.startsWith("xMin") ? 0 : n.startsWith("xMid") ? 0.5 : 1), h = (i - c * f) * (n.includes("YMin") ? 0 : n.includes("YMid") ? 0.5 : 1);
105
+ return [f, 0, 0, f, p - e * f, h - o * f];
106
+ }
107
+ function E(t, r) {
108
+ const i = t.trim().toLowerCase(), n = { black: "#000000", white: "#ffffff", red: "#ff0000", green: "#008000", blue: "#0000ff", transparent: "#00000000" };
109
+ if (Object.hasOwn(n, i))
110
+ return n[i];
111
+ if (/^#[\da-f]{3,4}$/.test(i))
112
+ return `#${Array.from(i.slice(1), (o) => o + o).join("")}`;
113
+ if (/^#[\da-f]{6}(?:[\da-f]{2})?$/.test(i))
114
+ return i;
115
+ const e = /^(rgb|rgba)\(([^()]*)\)$/.exec(i);
116
+ if (e) {
117
+ const o = e[2].split(",").map((a) => a.trim());
118
+ if (o.length === (e[1] === "rgba" ? 4 : 3) && o.every((a) => new RegExp(`^${A}%?$`, "i").test(a)))
119
+ return `#${o.map((c, l) => {
120
+ const d = c.endsWith("%"), f = $(d ? c.slice(0, -1) : c, r);
121
+ return Math.round(Math.max(0, Math.min(255, d ? f / 100 * 255 : f * (l === 3 ? 255 : 1))));
122
+ }).map((c) => c.toString(16).padStart(2, "0")).join("")}`;
123
+ }
124
+ throw new s("unsupported", `Unsupported solid sRGB color: ${t}`, r);
125
+ }
126
+ function dt(t = {}) {
127
+ const r = { maxSourceLength: 2097152, maxElements: 1e4, maxDepth: 128, maxPathCommands: 1e5 }, i = { ...r, ...t };
128
+ for (const n of Object.keys(i))
129
+ if (!(n in r) || !Number.isSafeInteger(i[n]) || i[n] < 1)
130
+ throw new s("invalid-value", `Invalid limit ${n}`);
131
+ return i;
132
+ }
133
+ function pt(t, r) {
134
+ if (typeof t != "string")
135
+ throw new s("invalid-value", "SVG source must be a string");
136
+ if (t.length > r.maxSourceLength)
137
+ throw new s("budget", "Source length budget exceeded");
138
+ q(t);
139
+ const i = [];
140
+ let n, e = t.charCodeAt(0) === 65279 ? 1 : 0, o = 0, a = !1;
141
+ const c = /[A-Z_][\w.:-]*/iy, l = () => {
142
+ for (; /[\t\n\r ]/.test(t[e] ?? "") && e < t.length; )
143
+ e += 1;
144
+ }, d = () => {
145
+ c.lastIndex = e;
146
+ const f = c.exec(t);
147
+ if (!f)
148
+ throw new s("syntax", "Expected XML name", `offset ${e}`);
149
+ return e = c.lastIndex, f[0];
150
+ };
151
+ for (; e < t.length; ) {
152
+ if (t[e] !== "<") {
153
+ const m = t.indexOf("<", e), u = B(t.slice(e, m < 0 ? t.length : m));
154
+ if (i.length)
155
+ i[i.length - 1].children.push(u);
156
+ else if (u.trim())
157
+ throw new s("syntax", "Text outside root element", `offset ${e}`);
158
+ e = m < 0 ? t.length : m;
159
+ continue;
160
+ }
161
+ if (t.startsWith("<!--", e)) {
162
+ const m = t.indexOf("-->", e + 4);
163
+ if (m < 0 || t.slice(e + 4, m).includes("--"))
164
+ throw new s("syntax", "Invalid XML comment");
165
+ e = m + 3;
166
+ continue;
167
+ }
168
+ if (t.startsWith("<?xml ", e)) {
169
+ const m = t.indexOf("?>", e);
170
+ if (n || a || m < 0 || !/^<\?xml\s+version=(?:"1\.0"|'1\.0')(?:\s+encoding=(?:"UTF-8"|'UTF-8'))?(?:\s+standalone=(?:"(?:yes|no)"|'(?:yes|no)'))?\s*\?>$/i.test(t.slice(e, m + 2)))
171
+ throw new s("syntax", "Invalid or misplaced XML declaration");
172
+ a = !0, e = m + 2;
173
+ continue;
174
+ }
175
+ if (t.startsWith("<!", e) || t.startsWith("<?", e))
176
+ throw new s("unsupported", "DTD, entities, CDATA and processing instructions are not supported", `offset ${e}`);
177
+ if (t.startsWith("</", e)) {
178
+ e += 2;
179
+ const m = d();
180
+ if (l(), t[e++] !== ">" || i.pop()?.name !== m)
181
+ throw new s("syntax", "Mismatched closing element", m);
182
+ continue;
183
+ }
184
+ const f = e++, p = d(), h = /* @__PURE__ */ Object.create(null);
185
+ for (; ; ) {
186
+ const m = e;
187
+ if (l(), t[e] === "/" || t[e] === ">")
188
+ break;
189
+ if (m === e)
190
+ throw new s("syntax", "Attributes require whitespace", `offset ${e}`);
191
+ const u = d();
192
+ if (Object.hasOwn(h, u))
193
+ throw new s("syntax", "Duplicate attribute", u);
194
+ if (l(), t[e++] !== "=")
195
+ throw new s("syntax", "Expected attribute assignment", u);
196
+ l();
197
+ const M = t[e++];
198
+ if (M !== '"' && M !== "'")
199
+ throw new s("syntax", "Attribute values must be quoted", u);
200
+ const j = t.indexOf(M, e);
201
+ if (j < 0 || t.slice(e, j).includes("<"))
202
+ throw new s("syntax", "Invalid attribute value", u);
203
+ h[u] = B(t.slice(e, j).replace(/[\t\n\r]/g, " ")), e = j + 1;
204
+ }
205
+ const b = t[e] === "/";
206
+ if (b && (e += 1), t[e++] !== ">")
207
+ throw new s("syntax", "Expected element end", p);
208
+ if (++o > r.maxElements)
209
+ throw new s("budget", "Element budget exceeded");
210
+ if (i.length + 1 > r.maxDepth)
211
+ throw new s("budget", "XML depth budget exceeded");
212
+ const y = { name: p, attributes: h, children: [], location: `${p}@${f}` };
213
+ if (i.length)
214
+ i[i.length - 1].children.push(y);
215
+ else {
216
+ if (n)
217
+ throw new s("syntax", "Multiple root elements");
218
+ n = y;
219
+ }
220
+ b || i.push(y);
221
+ }
222
+ if (!n || i.length)
223
+ throw new s("syntax", "Missing or unclosed root element");
224
+ return n;
225
+ }
226
+ function q(t) {
227
+ for (const r of t) {
228
+ const i = r.codePointAt(0);
229
+ if (!(i === 9 || i === 10 || i === 13 || i >= 32 && i <= 55295 || i >= 57344 && i <= 65533 || i >= 65536 && i <= 1114111))
230
+ throw new s("syntax", "Invalid XML character");
231
+ }
232
+ }
233
+ function ht(t) {
234
+ return q(t), t.replace(/[&<>"']/g, (r) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&apos;" })[r]);
235
+ }
236
+ function B(t) {
237
+ const r = t.replace(/&([^;]*);/g, (i, n) => {
238
+ const e = { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'" };
239
+ if (Object.hasOwn(e, n))
240
+ return e[n];
241
+ if (/^#(?:\d+|x[0-9a-f]+)$/i.test(n)) {
242
+ const o = Number.parseInt(n.slice(n[1]?.toLowerCase() === "x" ? 2 : 1), n[1]?.toLowerCase() === "x" ? 16 : 10);
243
+ if (o > 1114111)
244
+ throw new s("syntax", "Invalid numeric entity");
245
+ const a = String.fromCodePoint(o);
246
+ return q(a), a;
247
+ }
248
+ throw new s("unsupported", `Unknown XML entity &${n};`);
249
+ });
250
+ if (/&(?![^&;]*;)/.test(t))
251
+ throw new s("syntax", "Unterminated XML entity");
252
+ return r;
253
+ }
254
+ const X = /* @__PURE__ */ new Set(["color", "fill", "fill-opacity", "fill-rule", "stroke", "stroke-opacity", "stroke-width", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-dasharray", "stroke-dashoffset", "vector-effect", "clip-rule", "clip-path", "opacity", "display", "visibility", "font-family", "font-size", "font-weight", "font-style", "text-anchor", "dominant-baseline", "direction"]), ut = /* @__PURE__ */ new Set(["opacity", "display", "clip-path", "vector-effect"]), _ = { color: "#000000", fill: "#000000", "fill-opacity": "1", "fill-rule": "nonzero", stroke: "none", "stroke-opacity": "1", "stroke-width": "1", "stroke-linecap": "butt", "stroke-linejoin": "miter", "stroke-miterlimit": "4", "stroke-dasharray": "none", "stroke-dashoffset": "0", "clip-rule": "nonzero", visibility: "visible", "font-family": "sans-serif", "font-size": "16", "font-weight": "normal", "font-style": "normal", "text-anchor": "start", "dominant-baseline": "alphabetic", direction: "ltr", "xml:space": "default" }, H = /* @__PURE__ */ new Set(["path", "rect", "circle", "ellipse", "line", "polyline", "polygon"]);
255
+ function J(t, r = {}) {
256
+ const i = dt(r), n = pt(t, i);
257
+ if (n.name !== "svg")
258
+ throw new s("unsupported", "Root must be an unprefixed svg element", n.location);
259
+ const e = { limits: i, clips: /* @__PURE__ */ Object.create(null), ids: /* @__PURE__ */ new Set(), pathCommands: 0 };
260
+ nt(n, e);
261
+ const a = O(n, _, ["xmlns", "xmlns:xlink", "version", "width", "height", "viewBox", "preserveAspectRatio", "overflow"]), c = n.attributes.xmlns;
262
+ if (c !== void 0 && c !== "http://www.w3.org/2000/svg")
263
+ throw new s("unsupported", "Invalid SVG namespace", n.location);
264
+ if (n.attributes["xmlns:xlink"] !== void 0 && n.attributes["xmlns:xlink"] !== "http://www.w3.org/1999/xlink")
265
+ throw new s("unsupported", "Invalid xlink namespace", n.location);
266
+ if (n.attributes.version !== void 0 && n.attributes.version !== "1.1" && n.attributes.version !== "2.0")
267
+ throw new s("unsupported", "Unsupported SVG version", n.location);
268
+ const l = n.attributes.viewBox === void 0 ? void 0 : U(n.attributes.viewBox, n.location);
269
+ if (l && (l.length !== 4 || l[2] <= 0 || l[3] <= 0))
270
+ throw new s("invalid-value", "viewBox requires four numbers with positive size", n.location);
271
+ const d = F(n.attributes.width, l?.[2], n.location), f = F(n.attributes.height, l?.[3], n.location), p = Z(n.attributes.preserveAspectRatio ?? "xMidYMid meet", n.location), h = v(n.attributes.overflow ?? "hidden", ["hidden", "visible"], n.location);
272
+ let b, y;
273
+ for (const u of P(n))
274
+ if (u.name === "defs")
275
+ wt(u, a, e);
276
+ else if (u.name === "title" || u.name === "desc") {
277
+ if (Object.keys(u.attributes).length || u.children.some((j) => typeof j != "string"))
278
+ throw new s("unsupported", "Metadata requires plain text without attributes", u.location);
279
+ const M = u.children.join("");
280
+ if (u.name === "title") {
281
+ if (b !== void 0)
282
+ throw new s("unsupported", "Multiple titles", u.location);
283
+ b = M;
284
+ } else {
285
+ if (y !== void 0)
286
+ throw new s("unsupported", "Multiple descriptions", u.location);
287
+ y = M;
288
+ }
289
+ }
290
+ const m = {
291
+ ...S(n, a, !0),
292
+ type: "group",
293
+ children: P(n).filter((u) => !["defs", "title", "desc"].includes(u.name)).map((u) => Q(u, a, e))
294
+ };
295
+ return rt(m, e), K({ format: "nova-svg", version: 1, width: d, height: f, viewBox: l ?? [0, 0, d, f], aspectRatio: p, overflow: h, ...b === void 0 ? {} : { title: b }, ...y === void 0 ? {} : { description: y }, root: m, clips: e.clips });
296
+ }
297
+ function K(t) {
298
+ if (t && typeof t == "object" && !Object.isFrozen(t)) {
299
+ for (const r of Object.values(t))
300
+ K(r);
301
+ Object.freeze(t);
302
+ }
303
+ return t;
304
+ }
305
+ function Q(t, r, i) {
306
+ if (t.name === "g") {
307
+ const n = O(t, r);
308
+ return { ...S(t, n, !0), type: "group", children: P(t).map((e) => Q(e, n, i)) };
309
+ }
310
+ if (H.has(t.name)) {
311
+ const n = O(t, r, tt(t.name)), e = et(t, i);
312
+ return { ...S(t, n), type: "path", d: t.name === "path" ? (t.attributes.d ?? "").trim() : T(e), paint: W(n, t.location) };
313
+ }
314
+ if (t.name === "text") {
315
+ const n = O(t, r, ["x", "y", "dx", "dy"]);
316
+ if (t.children.some((f) => typeof f != "string"))
317
+ throw new s("unsupported", "Text supports a single run; tspan/textPath are unsupported", t.location);
318
+ let e = t.children.join("");
319
+ const o = v(n["xml:space"], ["default", "preserve"], t.location);
320
+ if (e = e.replace(/[\t\n\r]/g, " "), o === "default" && (e = e.replace(/ +/g, " ").trim()), n.direction !== "ltr")
321
+ throw new s("unsupported", "Explicit RTL/bidi direction requires a text adapter", t.location);
322
+ const a = v(n["font-weight"], ["normal", "bold", "100", "200", "300", "400", "500", "600", "700", "800", "900"], t.location), c = $(n["font-size"], t.location, !0);
323
+ if (c <= 0)
324
+ throw new s("invalid-value", "font-size must be positive", t.location);
325
+ const l = n["font-family"];
326
+ if (!l.trim() || l.length > 512 || /[;{}\\]/.test(l))
327
+ throw new s("unsupported", "Unsupported font family", t.location);
328
+ const d = v(n["dominant-baseline"] === "auto" ? "alphabetic" : n["dominant-baseline"], ["alphabetic", "text-before-edge"], t.location);
329
+ return { ...S(t, n), type: "text", text: e, x: k(t, "x") + k(t, "dx"), y: k(t, "y") + k(t, "dy"), family: l, size: c, weight: a, style: v(n["font-style"], ["normal", "italic"], t.location), anchor: v(n["text-anchor"], ["start", "middle", "end"], t.location), baseline: d, paint: W(n, t.location) };
330
+ }
331
+ if (t.name === "image") {
332
+ const n = O(t, r, ["x", "y", "width", "height", "href", "xlink:href", "preserveAspectRatio"]);
333
+ it(t);
334
+ const e = t.attributes.href ?? t.attributes["xlink:href"];
335
+ if (t.attributes.href && t.attributes["xlink:href"] && t.attributes.href !== t.attributes["xlink:href"])
336
+ throw new s("invalid-value", "Conflicting image href attributes", t.location);
337
+ mt(e, t.location);
338
+ const o = k(t, "width"), a = k(t, "height");
339
+ if (o < 0 || a < 0)
340
+ throw new s("invalid-value", "Negative image size", t.location);
341
+ return { ...S(t, n), type: "image", href: e, x: k(t, "x"), y: k(t, "y"), width: o, height: a, aspectRatio: Z(t.attributes.preserveAspectRatio ?? "xMidYMid meet", t.location) };
342
+ }
343
+ throw new s("unsupported", `Unsupported element ${t.name}`, t.location);
344
+ }
345
+ function S(t, r, i = !1) {
346
+ const n = v(r.display ?? "inline", ["inline", "none"], t.location), e = v(r.visibility, ["visible", "hidden"], t.location), o = r["clip-path"], a = o && o !== "none" ? /^url\(\s*#([A-Z_][\w.:-]*)\s*\)$/i.exec(o)?.[1] : void 0;
347
+ if (o && o !== "none" && !a)
348
+ throw new s("unsupported", "Only local clip-path references are supported", t.location);
349
+ return { ...t.attributes.id === void 0 ? {} : { id: t.attributes.id }, transform: t.attributes.transform === void 0 ? Y : C(t.attributes.transform, t.location), opacity: N(r.opacity ?? "1", t.location), visible: n === "inline" && (i || e === "visible"), ...a === void 0 ? {} : { clip: a } };
350
+ }
351
+ function W(t, r) {
352
+ const i = E(t.color, r), n = t.fill === "none" ? null : E(t.fill === "currentColor" ? i : t.fill, r), e = t.stroke === "none" ? null : E(t.stroke === "currentColor" ? i : t.stroke, r), o = $(t["stroke-width"], r, !0), a = $(t["stroke-miterlimit"], r), c = t["stroke-dasharray"] === "none" ? [] : U(t["stroke-dasharray"], r);
353
+ if (o < 0 || a < 1 || c.some((d) => d < 0))
354
+ throw new s("invalid-value", "Invalid stroke dimensions", r);
355
+ if (t["stroke-dasharray"] !== "none" && !c.length)
356
+ throw new s("invalid-value", "Empty dash array", r);
357
+ const l = v(t["vector-effect"] ?? "none", ["none", "non-scaling-stroke"], r);
358
+ return { fill: n, fillOpacity: N(t["fill-opacity"], r), fillRule: v(t["fill-rule"], ["nonzero", "evenodd"], r), stroke: e === null ? null : { color: e, opacity: N(t["stroke-opacity"], r), width: o, units: l === "none" ? "world" : "screen", cap: v(t["stroke-linecap"], ["butt", "round", "square"], r), join: v(t["stroke-linejoin"], ["miter", "round", "bevel"], r), miterLimit: a, dash: c, dashOffset: $(t["stroke-dashoffset"], r, !0) } };
359
+ }
360
+ function wt(t, r, i) {
361
+ const n = O(t, r);
362
+ if (t.attributes.transform || n.opacity !== void 0 || n["clip-path"] !== void 0 || n.display !== void 0)
363
+ throw new s("unsupported", "Rendering properties on defs are unsupported", t.location);
364
+ for (const e of P(t)) {
365
+ if (e.name !== "clipPath")
366
+ throw new s("unsupported", `Unsupported definition ${e.name}`, e.location);
367
+ const o = O(e, n, ["clipPathUnits"]), a = e.attributes.id;
368
+ if (!a)
369
+ throw new s("reference", "clipPath requires id", e.location);
370
+ if (e.attributes.clipPathUnits !== void 0 && e.attributes.clipPathUnits !== "userSpaceOnUse")
371
+ throw new s("unsupported", "Only userSpaceOnUse clipPath is supported", e.location);
372
+ if (o.opacity !== void 0 || o["clip-path"] !== void 0 || o.display !== void 0)
373
+ throw new s("unsupported", "Unsupported clipPath presentation", e.location);
374
+ const c = P(e);
375
+ if (c.length !== 1 || !H.has(c[0].name))
376
+ throw new s("unsupported", "clipPath requires one geometry element", e.location);
377
+ const l = c[0], d = O(l, o, tt(l.name));
378
+ if (d["clip-path"] !== void 0 || d.display !== void 0 || d.visibility !== "visible")
379
+ throw new s("unsupported", "Nested/hidden clip geometry is unsupported", l.location);
380
+ const f = V(C(e.attributes.transform ?? "", e.location), C(l.attributes.transform ?? "", l.location)), p = et(l, i);
381
+ i.clips[a] = { d: l.name === "path" ? (l.attributes.d ?? "").trim() : T(p), transform: f, fillRule: v(d["clip-rule"], ["nonzero", "evenodd"], l.location) };
382
+ }
383
+ }
384
+ function O(t, r, i = []) {
385
+ const n = /* @__PURE__ */ Object.create(null);
386
+ for (const [o, a] of Object.entries(r))
387
+ ut.has(o) || (n[o] = a);
388
+ const e = /* @__PURE__ */ Object.create(null);
389
+ for (const [o, a] of Object.entries(t.attributes))
390
+ if (X.has(o) || o === "xml:space")
391
+ e[o] = a;
392
+ else if (!["id", "transform", "style", ...i].includes(o))
393
+ throw new s("unsupported", `Unsupported attribute ${o}`, t.location);
394
+ if (t.attributes.style !== void 0)
395
+ for (const o of t.attributes.style.split(";")) {
396
+ if (!o.trim())
397
+ continue;
398
+ const a = o.indexOf(":"), c = o.slice(0, a).trim(), l = o.slice(a + 1).trim();
399
+ if (a < 0 || !X.has(c) || !l || /!important|[{}]/i.test(l))
400
+ throw new s("unsupported", "Unsupported inline style declaration", t.location);
401
+ e[c] = l;
402
+ }
403
+ for (const [o, a] of Object.entries(e))
404
+ n[o] = a === "inherit" ? r[o] ?? (o === "opacity" ? "1" : o === "display" ? "inline" : o === "clip-path" || o === "vector-effect" ? "none" : _[o]) : a;
405
+ return n;
406
+ }
407
+ function tt(t) {
408
+ switch (t) {
409
+ case "path":
410
+ return ["d"];
411
+ case "rect":
412
+ return ["x", "y", "width", "height", "rx", "ry"];
413
+ case "circle":
414
+ return ["cx", "cy", "r"];
415
+ case "ellipse":
416
+ return ["cx", "cy", "rx", "ry"];
417
+ case "line":
418
+ return ["x1", "y1", "x2", "y2"];
419
+ default:
420
+ return ["points"];
421
+ }
422
+ }
423
+ function et(t, r) {
424
+ it(t);
425
+ const i = (e) => k(t, e);
426
+ let n;
427
+ if (t.name === "path")
428
+ try {
429
+ n = L(t.attributes.d ?? "", { maxCommands: Math.max(1, r.limits.maxPathCommands - r.pathCommands) });
430
+ } catch (e) {
431
+ throw new s(e instanceof RangeError ? "budget" : "invalid-value", e instanceof Error ? e.message : String(e), t.location);
432
+ }
433
+ else if (t.name === "rect") {
434
+ const [e, o, a, c] = [i("x"), i("y"), i("width"), i("height")], l = t.attributes.rx === void 0 ? i("ry") : i("rx"), d = t.attributes.ry === void 0 ? l : i("ry");
435
+ if ([a, c, l, d].some((h) => h < 0))
436
+ throw new s("invalid-value", "Negative rectangle size/radius", t.location);
437
+ const f = l && d ? Math.min(a / 2, l) : 0, p = l && d ? Math.min(c / 2, d) : 0;
438
+ n = R((h) => {
439
+ !a || !c || (h.moveTo(e + f, o).lineTo(e + a - f, o), f && p && h.ellipse(e + a - f, o + p, f, p, 0, -Math.PI / 2, 0), h.lineTo(e + a, o + c - p), f && p && h.ellipse(e + a - f, o + c - p, f, p, 0, 0, Math.PI / 2), h.lineTo(e + f, o + c), f && p && h.ellipse(e + f, o + c - p, f, p, 0, Math.PI / 2, Math.PI), h.lineTo(e, o + p), f && p && h.ellipse(e + f, o + p, f, p, 0, Math.PI, Math.PI * 1.5), h.closePath());
440
+ });
441
+ } else if (t.name === "circle" || t.name === "ellipse") {
442
+ const e = t.name === "circle" ? i("r") : i("rx"), o = t.name === "circle" ? e : i("ry");
443
+ if (e < 0 || o < 0)
444
+ throw new s("invalid-value", "Negative ellipse radius", t.location);
445
+ n = R((a) => {
446
+ e && o && a.ellipse(i("cx"), i("cy"), e, o, 0, 0, Math.PI * 2).closePath();
447
+ });
448
+ } else if (t.name === "line")
449
+ n = R((e) => e.moveTo(i("x1"), i("y1")).lineTo(i("x2"), i("y2")));
450
+ else {
451
+ const e = U(t.attributes.points ?? "", t.location);
452
+ if (e.length % 2)
453
+ throw new s("invalid-value", "Points require coordinate pairs", t.location);
454
+ n = R((o) => {
455
+ for (let a = 0; a < e.length; a += 2)
456
+ a === 0 ? o.moveTo(e[a], e[a + 1]) : o.lineTo(e[a], e[a + 1]);
457
+ t.name === "polygon" && o.closePath();
458
+ });
459
+ }
460
+ if (r.pathCommands += n.commands.length, r.pathCommands > r.limits.maxPathCommands)
461
+ throw new s("budget", "Document path command budget exceeded", t.location);
462
+ return n;
463
+ }
464
+ function P(t) {
465
+ if (t.children.some((r) => typeof r == "string" && r.trim()))
466
+ throw new s("unsupported", "Text is only supported inside text/title/desc", t.location);
467
+ return t.children.filter((r) => typeof r != "string");
468
+ }
469
+ function it(t) {
470
+ if (t.children.some((r) => typeof r != "string" || r.trim()))
471
+ throw new s("unsupported", "Geometry/image children are unsupported", t.location);
472
+ }
473
+ function k(t, r) {
474
+ return $(t.attributes[r] ?? "0", t.location, !0);
475
+ }
476
+ function F(t, r, i) {
477
+ const n = t === void 0 ? r : $(t, i, !0);
478
+ if (n === void 0 || n <= 0)
479
+ throw new s("invalid-value", "Root requires positive width/height or viewBox", i);
480
+ return n;
481
+ }
482
+ function N(t, r) {
483
+ const i = t.endsWith("%") ? $(t.slice(0, -1), r) / 100 : $(t, r);
484
+ return Math.max(0, Math.min(1, i));
485
+ }
486
+ function v(t, r, i) {
487
+ if (!r.includes(t))
488
+ throw new s("unsupported", `Unsupported value ${t}`, i);
489
+ return t;
490
+ }
491
+ function nt(t, r) {
492
+ const i = t.attributes.id;
493
+ if (i !== void 0) {
494
+ if (!/^[A-Z_][\w.:-]*$/i.test(i) || r.ids.has(i))
495
+ throw new s("reference", "Invalid or duplicate id", t.location);
496
+ r.ids.add(i);
497
+ }
498
+ for (const n of t.children)
499
+ typeof n != "string" && nt(n, r);
500
+ }
501
+ function rt(t, r) {
502
+ if (t.clip && !Object.hasOwn(r.clips, t.clip))
503
+ throw new s("reference", `Unresolved clip ${t.clip}`, t.id);
504
+ if (t.type === "group")
505
+ for (const i of t.children)
506
+ rt(i, r);
507
+ }
508
+ function mt(t, r) {
509
+ if (typeof t != "string" || !t || Array.from(t).some((i) => i.charCodeAt(0) <= 32 || i === "<" || i === ">") || !/^(?:https?:\/\/|data:image\/(?:png|jpeg|webp|gif);base64,[A-Z\da-z+/]+=*$|(?:\.\.?\/)?[\w@~.-][\w@~./?&=%+#:-]*$)/.test(t))
510
+ throw new s("unsupported", "Image href must be a raster data URL or an explicit inert resource URL", r);
511
+ if (/^[A-Z][\w+.-]*:/i.test(t) && !/^(?:https?:\/\/|data:image\/(?:png|jpeg|webp|gif);base64,)/i.test(t))
512
+ throw new s("unsupported", "Unsupported image URL scheme", r);
513
+ }
514
+ function gt(t, r = {}) {
515
+ if (x(r, ["strokeMode", "tolerance"], "options"), r.strokeMode !== void 0 && r.strokeMode !== "native" && r.strokeMode !== "outline")
516
+ throw new s("invalid-value", "strokeMode must be native or outline", "options.strokeMode");
517
+ const i = r.tolerance === void 0 ? 0.25 : r.tolerance;
518
+ if (typeof i != "number" || !Number.isFinite(i) || i <= 0)
519
+ throw new s("invalid-value", "tolerance must be finite and positive", "options.tolerance");
520
+ const n = G(t);
521
+ return r.strokeMode === "outline" ? G(t, { tolerance: i, commands: 0 }) : n;
522
+ }
523
+ function G(t, r) {
524
+ if (x(t, ["format", "version", "width", "height", "viewBox", "aspectRatio", "overflow", "title", "description", "root", "clips"], "document"), t.format !== "nova-svg" || t.version !== 1)
525
+ throw new s("unsupported", "Unsupported document format/version");
526
+ if (!Array.isArray(t.viewBox) || t.viewBox.length !== 4)
527
+ throw new s("invalid-value", "Invalid viewBox");
528
+ z(t.viewBox, "viewBox"), x(t.clips, Object.keys(t.clips ?? {}), "clips");
529
+ const i = Object.entries(t.clips).map(([a, c]) => (x(c, ["d", "transform", "fillRule"], `clip ${a}`), r && D(c.d, r, `clips.${a}.d`), `<clipPath id="${w(a)}" clipPathUnits="userSpaceOnUse" transform="${at(c.transform)}"><path d="${w(c.d)}" clip-rule="${w(c.fillRule)}"/></clipPath>`)).join("");
530
+ if (t.root?.type !== "group")
531
+ throw new s("invalid-value", "Document root must be a group");
532
+ const n = ot(t.root, /* @__PURE__ */ new Set(), { count: 0 }, 0, !0, r), e = `${t.title === void 0 ? "" : `<title>${w(t.title)}</title>`}${t.description === void 0 ? "" : `<desc>${w(t.description)}</desc>`}`, o = `<svg xmlns="http://www.w3.org/2000/svg" width="${g(t.width)}" height="${g(t.height)}" viewBox="${t.viewBox.map(g).join(" ")}" preserveAspectRatio="${w(t.aspectRatio)}" overflow="${w(t.overflow)}"${st(t.root)}>${e}${i ? `<defs>${i}</defs>` : ""}${n}</svg>`;
533
+ return J(o), o;
534
+ }
535
+ function $t(t) {
536
+ return J(gt(t));
537
+ }
538
+ function ot(t, r, i, n, e = !1, o, a = "root") {
539
+ if (!t || typeof t != "object" || r.has(t) || n > 128)
540
+ throw new s("invalid-value", "Invalid/cyclic document tree");
541
+ if (x(t, ["id", "type", "transform", "opacity", "visible", "clip", "children", "d", "paint", "text", "x", "y", "family", "size", "weight", "style", "anchor", "baseline", "href", "width", "height", "aspectRatio"], "node"), r.add(t), ++i.count > 1e4)
542
+ throw new s("budget", "Document element budget exceeded");
543
+ try {
544
+ const c = ["id", "type", "transform", "opacity", "visible", "clip"], l = st(t);
545
+ if (t.type === "group") {
546
+ if (x(t, [...c, "children"], "group"), !Array.isArray(t.children))
547
+ throw new s("invalid-value", "Invalid group children");
548
+ z(t.children, "children");
549
+ const d = t.children.map((f, p) => ot(f, r, i, n + 1, !1, o, `${a}.children[${p}]`)).join("");
550
+ return e ? d : `<g${l}>${d}</g>`;
551
+ }
552
+ if (t.type === "path") {
553
+ if (x(t, [...c, "d", "paint"], "path"), o) {
554
+ if (t.paint.stroke !== null)
555
+ return vt(t, l, o, i, a);
556
+ D(t.d, o, `${a}.d`);
557
+ }
558
+ return `<path${l} d="${w(t.d)}"${I(t.paint)}/>`;
559
+ }
560
+ if (t.type === "text") {
561
+ if (x(t, [...c, "text", "x", "y", "family", "size", "weight", "style", "anchor", "baseline", "paint"], "text"), o && t.paint.stroke !== null)
562
+ throw new s("unsupported", "Outline export does not support stroked text", `${a}.paint.stroke`);
563
+ if (typeof t.text != "string" || /[\t\n\r]/.test(t.text))
564
+ throw new s("unsupported", "Document text requires a normalized single line");
565
+ return `<text${l} x="${g(t.x)}" y="${g(t.y)}" font-family="${w(t.family)}" font-size="${g(t.size)}" font-weight="${w(t.weight)}" font-style="${w(t.style)}" text-anchor="${w(t.anchor)}" dominant-baseline="${w(t.baseline)}" xml:space="preserve"${I(t.paint)}>${w(t.text)}</text>`;
566
+ }
567
+ if (t.type === "image")
568
+ return x(t, [...c, "href", "x", "y", "width", "height", "aspectRatio"], "image"), `<image${l} x="${g(t.x)}" y="${g(t.y)}" width="${g(t.width)}" height="${g(t.height)}" href="${w(t.href)}" preserveAspectRatio="${w(t.aspectRatio)}"/>`;
569
+ throw new s("unsupported", "Unsupported document node");
570
+ } finally {
571
+ r.delete(t);
572
+ }
573
+ }
574
+ function D(t, r, i) {
575
+ const n = L(t, { maxCommands: 1e5 });
576
+ if (r.commands += n.commands.length, r.commands > 1e5)
577
+ throw new s("budget", "Outline export path command budget exceeded", i);
578
+ }
579
+ function vt(t, r, i, n, e) {
580
+ const o = t.paint.stroke;
581
+ if (o.units !== "world")
582
+ throw new s("unsupported", "Outline export requires a world stroke", `${e}.paint.stroke.units`);
583
+ if (n.count += t.paint.fill === null ? 1 : 2, n.count > 1e4)
584
+ throw new s("budget", "Outline export element budget exceeded", e);
585
+ const a = t.paint.fill === null ? "" : `<path d="${w(t.d)}"${I({ ...t.paint, stroke: null })}/>`;
586
+ a && D(t.d, i, `${e}.d`);
587
+ let c;
588
+ try {
589
+ const d = L(t.d, { maxCommands: 1e5 }), f = lt(d, {
590
+ width: o.width,
591
+ lineCap: o.cap,
592
+ lineJoin: o.join,
593
+ miterLimit: o.miterLimit,
594
+ dashPattern: o.dash,
595
+ dashOffset: o.dashOffset
596
+ }, { tolerance: i.tolerance, maxSegments: Math.max(1, Math.min(65536, 1e5 - i.commands)) });
597
+ if (i.commands += f.commands.length, i.commands > 1e5)
598
+ throw new s("budget", "Outline export path command budget exceeded", e);
599
+ c = T(f);
600
+ } catch (d) {
601
+ throw d instanceof RangeError ? new s(/budget/i.test(d.message) ? "budget" : "invalid-value", d.message, `${e}.paint.stroke`) : d;
602
+ }
603
+ const l = { fill: o.color, fillOpacity: o.opacity, fillRule: "nonzero", stroke: null };
604
+ return `<g${r}>${a}<path d="${w(c)}"${I(l)}/></g>`;
605
+ }
606
+ function st(t) {
607
+ if (typeof t.visible != "boolean")
608
+ throw new s("invalid-value", "visible must be boolean");
609
+ if (t.opacity < 0 || t.opacity > 1)
610
+ throw new s("invalid-value", "opacity must be in 0..1");
611
+ return `${t.id === void 0 ? "" : ` id="${w(t.id)}"`} transform="${at(t.transform)}" opacity="${g(t.opacity)}"${t.visible ? "" : ' display="none"'}${t.clip === void 0 ? "" : ` clip-path="url(#${w(t.clip)})"`}`;
612
+ }
613
+ function I(t) {
614
+ if (x(t, ["fill", "fillOpacity", "fillRule", "stroke"], "paint"), t.fill !== null && typeof t.fill != "string")
615
+ throw new s("invalid-value", "Invalid fill");
616
+ if (t.fillOpacity < 0 || t.fillOpacity > 1)
617
+ throw new s("invalid-value", "fillOpacity must be in 0..1");
618
+ let r = ` fill="${t.fill === null ? "none" : w(t.fill)}" fill-opacity="${g(t.fillOpacity)}" fill-rule="${w(t.fillRule)}"`;
619
+ const i = t.stroke;
620
+ if (i === null)
621
+ return `${r} stroke="none"`;
622
+ if (x(i, ["color", "opacity", "width", "units", "cap", "join", "miterLimit", "dash", "dashOffset"], "stroke"), !Array.isArray(i.dash) || !["world", "screen"].includes(i.units) || i.opacity < 0 || i.opacity > 1)
623
+ throw new s("invalid-value", "Invalid stroke");
624
+ return z(i.dash, "dash"), r += ` stroke="${w(i.color)}" stroke-opacity="${g(i.opacity)}" stroke-width="${g(i.width)}" stroke-linecap="${w(i.cap)}" stroke-linejoin="${w(i.join)}" stroke-miterlimit="${g(i.miterLimit)}" stroke-dasharray="${i.dash.length ? i.dash.map(g).join(" ") : "none"}" stroke-dashoffset="${g(i.dashOffset)}" vector-effect="${i.units === "screen" ? "non-scaling-stroke" : "none"}"`, r;
625
+ }
626
+ function x(t, r, i) {
627
+ if (!t || typeof t != "object" || Object.getPrototypeOf(t) !== Object.prototype && Object.getPrototypeOf(t) !== null)
628
+ throw new s("invalid-value", "Expected plain document data", i);
629
+ if (Object.getOwnPropertySymbols(t).length)
630
+ throw new s("unsupported", "Symbol fields are not document data", i);
631
+ for (const [n, e] of Object.entries(Object.getOwnPropertyDescriptors(t)))
632
+ if (!r.includes(n) || !Object.hasOwn(e, "value"))
633
+ throw new s("unsupported", `Unsupported document field ${n}`, i);
634
+ }
635
+ function at(t) {
636
+ if (!Array.isArray(t) || t.length !== 6)
637
+ throw new s("invalid-value", "Transform requires six numbers");
638
+ return z(t, "transform"), `matrix(${t.map(g).join(" ")})`;
639
+ }
640
+ function z(t, r) {
641
+ if (Object.getPrototypeOf(t) !== Array.prototype || Object.getOwnPropertySymbols(t).length)
642
+ throw new s("unsupported", "Expected plain document array without symbol fields", r);
643
+ const i = Object.getOwnPropertyDescriptors(t);
644
+ for (const [n, e] of Object.entries(i))
645
+ if (n !== "length" && (!/^\d+$/.test(n) || Number(n) >= t.length) || !Object.hasOwn(e, "value"))
646
+ throw new s("unsupported", "Expected plain dense document array", r);
647
+ if (Object.keys(i).length !== t.length + 1)
648
+ throw new s("invalid-value", "Sparse document arrays are unsupported", r);
649
+ }
650
+ function g(t) {
651
+ if (typeof t != "number" || !Number.isFinite(t))
652
+ throw new s("invalid-value", "Expected finite document number");
653
+ return String(t);
654
+ }
655
+ function w(t) {
656
+ if (typeof t != "string")
657
+ throw new s("invalid-value", "Expected document string");
658
+ return ht(t);
659
+ }
660
+ export {
661
+ s as N,
662
+ Y as S,
663
+ gt as e,
664
+ J as i,
665
+ V as m,
666
+ $t as r,
667
+ bt as s
668
+ };