@bldrs-ai/conway 1.389.1221 → 1.394.1504

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 (382) hide show
  1. package/README.md +36 -22
  2. package/compiled/Dist/ConwayGeomWasmNode.js +0 -0
  3. package/compiled/Dist/ConwayGeomWasmNodeMT.js +0 -0
  4. package/compiled/Dist/ConwayGeomWasmWeb.js +0 -0
  5. package/compiled/Dist/ConwayGeomWasmWebMT.js +1 -1
  6. package/compiled/Dist/ConwayGeomWasmWebMT.wasm +0 -0
  7. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmNode.js +0 -0
  8. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmNodeMT.js +0 -0
  9. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmWeb.js +0 -0
  10. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmWebMT.js +1 -1
  11. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmWebMT.wasm +0 -0
  12. package/compiled/dependencies/conway-geom/interface/conway_geometry.d.ts +19 -0
  13. package/compiled/dependencies/conway-geom/interface/conway_geometry.d.ts.map +1 -1
  14. package/compiled/dependencies/conway-geom/interface/conway_geometry.js +17 -0
  15. package/compiled/dependencies/conway-geom/interface/parameters/surface_object.d.ts +6 -0
  16. package/compiled/dependencies/conway-geom/interface/parameters/surface_object.d.ts.map +1 -1
  17. package/compiled/examples/browser-bundled.cjs +1569 -51
  18. package/compiled/examples/cli-bundled.cjs +2790 -436
  19. package/compiled/examples/cli-step-bundled.cjs +1904 -229
  20. package/compiled/examples/validator-bundled.cjs +1569 -51
  21. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_curve.gen.d.ts +2 -2
  22. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_curve.gen.d.ts.map +1 -1
  23. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_curve.gen.js +2 -2
  24. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_surface.gen.d.ts +3 -3
  25. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_surface.gen.d.ts.map +1 -1
  26. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/b_spline_surface.gen.js +3 -3
  27. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/composite_curve.gen.d.ts +1 -1
  28. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/composite_curve.gen.d.ts.map +1 -1
  29. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/composite_curve.gen.js +1 -1
  30. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_2d.gen.d.ts +1 -1
  31. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_2d.gen.d.ts.map +1 -1
  32. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_2d.gen.js +1 -1
  33. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_3d.gen.d.ts +1 -1
  34. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_3d.gen.d.ts.map +1 -1
  35. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_curve_3d.gen.js +1 -1
  36. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_surface.gen.d.ts +1 -1
  37. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_surface.gen.d.ts.map +1 -1
  38. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/offset_surface.gen.js +1 -1
  39. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/presentation_style_assignment.gen.d.ts.map +1 -1
  40. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/presentation_style_assignment.gen.js +2 -2
  41. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/schema_ap214.gen.js +11 -11
  42. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/shape_aspect.gen.d.ts +1 -1
  43. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/shape_aspect.gen.d.ts.map +1 -1
  44. package/compiled/src/AP214E3_2010/AP214E3_2010_gen/shape_aspect.gen.js +1 -1
  45. package/compiled/src/AP214E3_2010/ap214_command_line_main.js +7 -3
  46. package/compiled/src/AP214E3_2010/ap214_geometry_extraction.d.ts +181 -7
  47. package/compiled/src/AP214E3_2010/ap214_geometry_extraction.d.ts.map +1 -1
  48. package/compiled/src/AP214E3_2010/ap214_geometry_extraction.js +906 -137
  49. package/compiled/src/AP214E3_2010/ap214_geometry_extraction.test.js +10 -2
  50. package/compiled/src/AP214E3_2010/ap214_logical_attribute.test.d.ts +2 -0
  51. package/compiled/src/AP214E3_2010/ap214_logical_attribute.test.d.ts.map +1 -0
  52. package/compiled/src/AP214E3_2010/ap214_logical_attribute.test.js +114 -0
  53. package/compiled/src/AP214E3_2010/ap214_model_geometry.d.ts +6 -0
  54. package/compiled/src/AP214E3_2010/ap214_model_geometry.d.ts.map +1 -1
  55. package/compiled/src/AP214E3_2010/ap214_model_geometry.js +9 -0
  56. package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.d.ts +2 -0
  57. package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.d.ts.map +1 -0
  58. package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.js +233 -0
  59. package/compiled/src/AP214E3_2010/ap214_sphere_vertex_loop.test.d.ts +2 -0
  60. package/compiled/src/AP214E3_2010/ap214_sphere_vertex_loop.test.d.ts.map +1 -0
  61. package/compiled/src/AP214E3_2010/ap214_sphere_vertex_loop.test.js +147 -0
  62. package/compiled/src/AP214E3_2010/ap214_step_model.d.ts +2 -1
  63. package/compiled/src/AP214E3_2010/ap214_step_model.d.ts.map +1 -1
  64. package/compiled/src/AP214E3_2010/ap214_step_model.js +1 -1
  65. package/compiled/src/AP214E3_2010/ap214_typed_select_enum.test.d.ts +2 -0
  66. package/compiled/src/AP214E3_2010/ap214_typed_select_enum.test.d.ts.map +1 -0
  67. package/compiled/src/AP214E3_2010/ap214_typed_select_enum.test.js +65 -0
  68. package/compiled/src/AP214E3_2010/ap214_unit_scale.test.d.ts +2 -0
  69. package/compiled/src/AP214E3_2010/ap214_unit_scale.test.d.ts.map +1 -0
  70. package/compiled/src/AP214E3_2010/ap214_unit_scale.test.js +111 -0
  71. package/compiled/src/compat/web-ifc/ap214_streamed_open.test.d.ts +2 -0
  72. package/compiled/src/compat/web-ifc/ap214_streamed_open.test.d.ts.map +1 -0
  73. package/compiled/src/compat/web-ifc/ap214_streamed_open.test.js +190 -0
  74. package/compiled/src/compat/web-ifc/coordination_export_order.test.d.ts +2 -0
  75. package/compiled/src/compat/web-ifc/coordination_export_order.test.d.ts.map +1 -0
  76. package/compiled/src/compat/web-ifc/coordination_export_order.test.js +110 -0
  77. package/compiled/src/compat/web-ifc/coordination_f64.d.ts +165 -0
  78. package/compiled/src/compat/web-ifc/coordination_f64.d.ts.map +1 -0
  79. package/compiled/src/compat/web-ifc/coordination_f64.js +286 -0
  80. package/compiled/src/compat/web-ifc/coordination_f64.test.d.ts +2 -0
  81. package/compiled/src/compat/web-ifc/coordination_f64.test.d.ts.map +1 -0
  82. package/compiled/src/compat/web-ifc/coordination_f64.test.js +225 -0
  83. package/compiled/src/compat/web-ifc/ifc_api.d.ts +154 -0
  84. package/compiled/src/compat/web-ifc/ifc_api.d.ts.map +1 -1
  85. package/compiled/src/compat/web-ifc/ifc_api.js +211 -3
  86. package/compiled/src/compat/web-ifc/ifc_api_deferred_open.test.d.ts +2 -0
  87. package/compiled/src/compat/web-ifc/ifc_api_deferred_open.test.d.ts.map +1 -0
  88. package/compiled/src/compat/web-ifc/ifc_api_deferred_open.test.js +288 -0
  89. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough.d.ts +39 -0
  90. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough.d.ts.map +1 -1
  91. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough_factory.d.ts +30 -0
  92. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough_factory.d.ts.map +1 -1
  93. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough_factory.js +83 -0
  94. package/compiled/src/compat/web-ifc/ifc_api_preview_channel.test.d.ts +2 -0
  95. package/compiled/src/compat/web-ifc/ifc_api_preview_channel.test.d.ts.map +1 -0
  96. package/compiled/src/compat/web-ifc/ifc_api_preview_channel.test.js +383 -0
  97. package/compiled/src/compat/web-ifc/ifc_api_preview_coordination.test.d.ts +2 -0
  98. package/compiled/src/compat/web-ifc/ifc_api_preview_coordination.test.d.ts.map +1 -0
  99. package/compiled/src/compat/web-ifc/ifc_api_preview_coordination.test.js +124 -0
  100. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.d.ts +132 -0
  101. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.d.ts.map +1 -1
  102. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.js +488 -92
  103. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts +268 -0
  104. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts.map +1 -1
  105. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.js +996 -149
  106. package/compiled/src/compat/web-ifc/ifc_api_streamed_open.test.d.ts +2 -0
  107. package/compiled/src/compat/web-ifc/ifc_api_streamed_open.test.d.ts.map +1 -0
  108. package/compiled/src/compat/web-ifc/ifc_api_streamed_open.test.js +129 -0
  109. package/compiled/src/compat/web-ifc/spatial_imposter.d.ts +134 -0
  110. package/compiled/src/compat/web-ifc/spatial_imposter.d.ts.map +1 -0
  111. package/compiled/src/compat/web-ifc/spatial_imposter.js +933 -0
  112. package/compiled/src/compat/web-ifc/spatial_imposter.test.d.ts +2 -0
  113. package/compiled/src/compat/web-ifc/spatial_imposter.test.d.ts.map +1 -0
  114. package/compiled/src/compat/web-ifc/spatial_imposter.test.js +467 -0
  115. package/compiled/src/compat/web-ifc/store_preview_channel.d.ts +187 -0
  116. package/compiled/src/compat/web-ifc/store_preview_channel.d.ts.map +1 -0
  117. package/compiled/src/compat/web-ifc/store_preview_channel.js +524 -0
  118. package/compiled/src/compat/web-ifc/store_preview_channel.test.d.ts +2 -0
  119. package/compiled/src/compat/web-ifc/store_preview_channel.test.d.ts.map +1 -0
  120. package/compiled/src/compat/web-ifc/store_preview_channel.test.js +234 -0
  121. package/compiled/src/compat/web-ifc/streamed_preview_channel.d.ts +306 -0
  122. package/compiled/src/compat/web-ifc/streamed_preview_channel.d.ts.map +1 -0
  123. package/compiled/src/compat/web-ifc/streamed_preview_channel.js +580 -0
  124. package/compiled/src/compat/web-ifc/web_wasm_directory.test.d.ts +2 -0
  125. package/compiled/src/compat/web-ifc/web_wasm_directory.test.d.ts.map +1 -0
  126. package/compiled/src/compat/web-ifc/web_wasm_directory.test.js +22 -0
  127. package/compiled/src/core/composed_model_skeleton.d.ts +63 -0
  128. package/compiled/src/core/composed_model_skeleton.d.ts.map +1 -0
  129. package/compiled/src/core/composed_model_skeleton.js +66 -0
  130. package/compiled/src/core/composed_model_skeleton.test.d.ts +2 -0
  131. package/compiled/src/core/composed_model_skeleton.test.d.ts.map +1 -0
  132. package/compiled/src/core/composed_model_skeleton.test.js +69 -0
  133. package/compiled/src/core/demand_geometry_queue.d.ts +147 -0
  134. package/compiled/src/core/demand_geometry_queue.d.ts.map +1 -0
  135. package/compiled/src/core/demand_geometry_queue.js +223 -0
  136. package/compiled/src/core/demand_geometry_queue.test.d.ts +2 -0
  137. package/compiled/src/core/demand_geometry_queue.test.d.ts.map +1 -0
  138. package/compiled/src/core/demand_geometry_queue.test.js +133 -0
  139. package/compiled/src/core/demand_residency_pump.d.ts +93 -0
  140. package/compiled/src/core/demand_residency_pump.d.ts.map +1 -0
  141. package/compiled/src/core/demand_residency_pump.js +120 -0
  142. package/compiled/src/core/demand_residency_pump.test.d.ts +2 -0
  143. package/compiled/src/core/demand_residency_pump.test.d.ts.map +1 -0
  144. package/compiled/src/core/demand_residency_pump.test.js +148 -0
  145. package/compiled/src/core/geometry_tile_bindings.d.ts +110 -0
  146. package/compiled/src/core/geometry_tile_bindings.d.ts.map +1 -0
  147. package/compiled/src/core/geometry_tile_bindings.js +76 -0
  148. package/compiled/src/core/geometry_tile_bindings.test.d.ts +2 -0
  149. package/compiled/src/core/geometry_tile_bindings.test.d.ts.map +1 -0
  150. package/compiled/src/core/geometry_tile_bindings.test.js +211 -0
  151. package/compiled/src/core/geometry_tile_pool.d.ts +99 -0
  152. package/compiled/src/core/geometry_tile_pool.d.ts.map +1 -0
  153. package/compiled/src/core/geometry_tile_pool.js +104 -0
  154. package/compiled/src/core/geometry_tile_pool.test.d.ts +2 -0
  155. package/compiled/src/core/geometry_tile_pool.test.d.ts.map +1 -0
  156. package/compiled/src/core/geometry_tile_pool.test.js +180 -0
  157. package/compiled/src/core/mem/chunked_pool.d.ts +116 -0
  158. package/compiled/src/core/mem/chunked_pool.d.ts.map +1 -0
  159. package/compiled/src/core/mem/chunked_pool.js +149 -0
  160. package/compiled/src/core/mem/chunked_pool.test.d.ts +2 -0
  161. package/compiled/src/core/mem/chunked_pool.test.d.ts.map +1 -0
  162. package/compiled/src/core/mem/chunked_pool.test.js +63 -0
  163. package/compiled/src/core/mem/shared_asset_pool.d.ts +82 -0
  164. package/compiled/src/core/mem/shared_asset_pool.d.ts.map +1 -0
  165. package/compiled/src/core/mem/shared_asset_pool.js +113 -0
  166. package/compiled/src/core/mem/shared_asset_pool.test.d.ts +2 -0
  167. package/compiled/src/core/mem/shared_asset_pool.test.d.ts.map +1 -0
  168. package/compiled/src/core/mem/shared_asset_pool.test.js +49 -0
  169. package/compiled/src/core/model_registry.d.ts +87 -0
  170. package/compiled/src/core/model_registry.d.ts.map +1 -0
  171. package/compiled/src/core/model_registry.js +101 -0
  172. package/compiled/src/core/model_registry.test.d.ts +2 -0
  173. package/compiled/src/core/model_registry.test.d.ts.map +1 -0
  174. package/compiled/src/core/model_registry.test.js +60 -0
  175. package/compiled/src/core/model_uri.d.ts +57 -0
  176. package/compiled/src/core/model_uri.d.ts.map +1 -0
  177. package/compiled/src/core/model_uri.js +101 -0
  178. package/compiled/src/core/model_uri.test.d.ts +2 -0
  179. package/compiled/src/core/model_uri.test.d.ts.map +1 -0
  180. package/compiled/src/core/model_uri.test.js +49 -0
  181. package/compiled/src/core/progress.d.ts +16 -2
  182. package/compiled/src/core/progress.d.ts.map +1 -1
  183. package/compiled/src/core/progress.js +31 -5
  184. package/compiled/src/core/progress.test.js +11 -2
  185. package/compiled/src/core/progress_log.d.ts +1 -0
  186. package/compiled/src/core/progress_log.d.ts.map +1 -1
  187. package/compiled/src/core/progress_log.js +7 -2
  188. package/compiled/src/core/progress_log.test.js +21 -0
  189. package/compiled/src/core/shared_byte_budget.d.ts +60 -0
  190. package/compiled/src/core/shared_byte_budget.d.ts.map +1 -0
  191. package/compiled/src/core/shared_byte_budget.js +85 -0
  192. package/compiled/src/core/shared_byte_budget.test.d.ts +2 -0
  193. package/compiled/src/core/shared_byte_budget.test.d.ts.map +1 -0
  194. package/compiled/src/core/shared_byte_budget.test.js +55 -0
  195. package/compiled/src/core/wasm_heap.d.ts +208 -0
  196. package/compiled/src/core/wasm_heap.d.ts.map +1 -0
  197. package/compiled/src/core/wasm_heap.js +417 -0
  198. package/compiled/src/core/wasm_heap.test.d.ts +2 -0
  199. package/compiled/src/core/wasm_heap.test.d.ts.map +1 -0
  200. package/compiled/src/core/wasm_heap.test.js +546 -0
  201. package/compiled/src/demand/index.d.ts +23 -0
  202. package/compiled/src/demand/index.d.ts.map +1 -0
  203. package/compiled/src/demand/index.js +22 -0
  204. package/compiled/src/ifc/ifc4_gen/IfcLogical.gen.d.ts +1 -1
  205. package/compiled/src/ifc/ifc4_gen/IfcLogical.gen.d.ts.map +1 -1
  206. package/compiled/src/ifc/ifc4_gen/IfcLogical.gen.js +1 -1
  207. package/compiled/src/ifc/ifc4_gen/IfcPresentationStyleAssignment.gen.d.ts.map +1 -1
  208. package/compiled/src/ifc/ifc4_gen/IfcPresentationStyleAssignment.gen.js +2 -2
  209. package/compiled/src/ifc/ifc4_gen/IfcRelInterferesElements.gen.d.ts +1 -1
  210. package/compiled/src/ifc/ifc4_gen/IfcRelInterferesElements.gen.d.ts.map +1 -1
  211. package/compiled/src/ifc/ifc4_gen/IfcRelInterferesElements.gen.js +1 -1
  212. package/compiled/src/ifc/ifc4_gen/schema_ifc.gen.js +2 -2
  213. package/compiled/src/ifc/ifc_demand_extraction.test.d.ts +2 -0
  214. package/compiled/src/ifc/ifc_demand_extraction.test.d.ts.map +1 -0
  215. package/compiled/src/ifc/ifc_demand_extraction.test.js +251 -0
  216. package/compiled/src/ifc/ifc_geometry_extraction.d.ts +367 -6
  217. package/compiled/src/ifc/ifc_geometry_extraction.d.ts.map +1 -1
  218. package/compiled/src/ifc/ifc_geometry_extraction.js +1322 -389
  219. package/compiled/src/ifc/ifc_grid_placement.test.d.ts +2 -0
  220. package/compiled/src/ifc/ifc_grid_placement.test.d.ts.map +1 -0
  221. package/compiled/src/ifc/ifc_grid_placement.test.js +261 -0
  222. package/compiled/src/ifc/ifc_model_geometry.d.ts +12 -0
  223. package/compiled/src/ifc/ifc_model_geometry.d.ts.map +1 -1
  224. package/compiled/src/ifc/ifc_model_geometry.js +15 -0
  225. package/compiled/src/ifc/ifc_regression_batch_main.js +210 -12
  226. package/compiled/src/ifc/ifc_spatial_skeleton.d.ts +145 -0
  227. package/compiled/src/ifc/ifc_spatial_skeleton.d.ts.map +1 -0
  228. package/compiled/src/ifc/ifc_spatial_skeleton.js +266 -0
  229. package/compiled/src/ifc/ifc_spatial_skeleton.test.d.ts +2 -0
  230. package/compiled/src/ifc/ifc_spatial_skeleton.test.d.ts.map +1 -0
  231. package/compiled/src/ifc/ifc_spatial_skeleton.test.js +199 -0
  232. package/compiled/src/ifc/ifc_step_model.d.ts +6 -2
  233. package/compiled/src/ifc/ifc_step_model.d.ts.map +1 -1
  234. package/compiled/src/ifc/ifc_step_model.js +6 -4
  235. package/compiled/src/ifc/ifc_step_parser.d.ts +58 -0
  236. package/compiled/src/ifc/ifc_step_parser.d.ts.map +1 -1
  237. package/compiled/src/ifc/ifc_step_parser.js +64 -0
  238. package/compiled/src/ifc/ifc_stream_model.test.d.ts +2 -0
  239. package/compiled/src/ifc/ifc_stream_model.test.d.ts.map +1 -0
  240. package/compiled/src/ifc/ifc_stream_model.test.js +70 -0
  241. package/compiled/src/ifc/ifc_stream_open.d.ts +131 -0
  242. package/compiled/src/ifc/ifc_stream_open.d.ts.map +1 -0
  243. package/compiled/src/ifc/ifc_stream_open.js +116 -0
  244. package/compiled/src/ifc/ifc_stream_open.test.d.ts +2 -0
  245. package/compiled/src/ifc/ifc_stream_open.test.d.ts.map +1 -0
  246. package/compiled/src/ifc/ifc_stream_open.test.js +230 -0
  247. package/compiled/src/ifc/ifc_tile_extractor.d.ts +84 -0
  248. package/compiled/src/ifc/ifc_tile_extractor.d.ts.map +1 -0
  249. package/compiled/src/ifc/ifc_tile_extractor.js +134 -0
  250. package/compiled/src/ifc/ifc_tile_extractor.test.d.ts +2 -0
  251. package/compiled/src/ifc/ifc_tile_extractor.test.d.ts.map +1 -0
  252. package/compiled/src/ifc/ifc_tile_extractor.test.js +118 -0
  253. package/compiled/src/ifc/ifc_typed_select_enum.test.d.ts +2 -0
  254. package/compiled/src/ifc/ifc_typed_select_enum.test.d.ts.map +1 -0
  255. package/compiled/src/ifc/ifc_typed_select_enum.test.js +60 -0
  256. package/compiled/src/index.d.ts +21 -1
  257. package/compiled/src/index.d.ts.map +1 -1
  258. package/compiled/src/index.js +28 -1
  259. package/compiled/src/logging/logger.d.ts +16 -2
  260. package/compiled/src/logging/logger.d.ts.map +1 -1
  261. package/compiled/src/logging/logger.js +34 -7
  262. package/compiled/src/logging/logger.test.js +30 -0
  263. package/compiled/src/mem/index.d.ts +17 -0
  264. package/compiled/src/mem/index.d.ts.map +1 -0
  265. package/compiled/src/mem/index.js +16 -0
  266. package/compiled/src/namespace_surface.test.d.ts +2 -0
  267. package/compiled/src/namespace_surface.test.d.ts.map +1 -0
  268. package/compiled/src/namespace_surface.test.js +43 -0
  269. package/compiled/src/parsing/parsing_buffer.d.ts +23 -0
  270. package/compiled/src/parsing/parsing_buffer.d.ts.map +1 -1
  271. package/compiled/src/parsing/parsing_buffer.js +31 -0
  272. package/compiled/src/scripts/model_report_displacement.test.d.ts +2 -0
  273. package/compiled/src/scripts/model_report_displacement.test.d.ts.map +1 -0
  274. package/compiled/src/scripts/model_report_displacement.test.js +104 -0
  275. package/compiled/src/scripts/render_glb_paths.test.d.ts +2 -0
  276. package/compiled/src/scripts/render_glb_paths.test.d.ts.map +1 -0
  277. package/compiled/src/scripts/render_glb_paths.test.js +115 -0
  278. package/compiled/src/step/indexing/step_type_indexer.d.ts +20 -0
  279. package/compiled/src/step/indexing/step_type_indexer.d.ts.map +1 -1
  280. package/compiled/src/step/indexing/step_type_indexer.js +67 -0
  281. package/compiled/src/step/parsing/byte_source.d.ts +153 -0
  282. package/compiled/src/step/parsing/byte_source.d.ts.map +1 -0
  283. package/compiled/src/step/parsing/byte_source.js +106 -0
  284. package/compiled/src/step/parsing/byte_source.test.d.ts +2 -0
  285. package/compiled/src/step/parsing/byte_source.test.d.ts.map +1 -0
  286. package/compiled/src/step/parsing/byte_source.test.js +47 -0
  287. package/compiled/src/step/parsing/byte_source_node.d.ts +41 -0
  288. package/compiled/src/step/parsing/byte_source_node.d.ts.map +1 -0
  289. package/compiled/src/step/parsing/byte_source_node.js +54 -0
  290. package/compiled/src/step/parsing/columnar_index.d.ts +103 -0
  291. package/compiled/src/step/parsing/columnar_index.d.ts.map +1 -0
  292. package/compiled/src/step/parsing/columnar_index.js +224 -0
  293. package/compiled/src/step/parsing/columnar_index.test.d.ts +2 -0
  294. package/compiled/src/step/parsing/columnar_index.test.d.ts.map +1 -0
  295. package/compiled/src/step/parsing/columnar_index.test.js +155 -0
  296. package/compiled/src/step/parsing/cross_reference_registry.d.ts +95 -0
  297. package/compiled/src/step/parsing/cross_reference_registry.d.ts.map +1 -0
  298. package/compiled/src/step/parsing/cross_reference_registry.js +91 -0
  299. package/compiled/src/step/parsing/cross_reference_registry.test.d.ts +2 -0
  300. package/compiled/src/step/parsing/cross_reference_registry.test.d.ts.map +1 -0
  301. package/compiled/src/step/parsing/cross_reference_registry.test.js +66 -0
  302. package/compiled/src/step/parsing/decode_utf8.d.ts +15 -0
  303. package/compiled/src/step/parsing/decode_utf8.d.ts.map +1 -1
  304. package/compiled/src/step/parsing/decode_utf8.js +28 -0
  305. package/compiled/src/step/parsing/express_ref_scan.d.ts +20 -0
  306. package/compiled/src/step/parsing/express_ref_scan.d.ts.map +1 -0
  307. package/compiled/src/step/parsing/express_ref_scan.js +91 -0
  308. package/compiled/src/step/parsing/express_ref_scan.test.d.ts +2 -0
  309. package/compiled/src/step/parsing/express_ref_scan.test.d.ts.map +1 -0
  310. package/compiled/src/step/parsing/express_ref_scan.test.js +28 -0
  311. package/compiled/src/step/parsing/index_sidecar.d.ts +81 -0
  312. package/compiled/src/step/parsing/index_sidecar.d.ts.map +1 -0
  313. package/compiled/src/step/parsing/index_sidecar.js +283 -0
  314. package/compiled/src/step/parsing/index_sidecar.test.d.ts +2 -0
  315. package/compiled/src/step/parsing/index_sidecar.test.d.ts.map +1 -0
  316. package/compiled/src/step/parsing/index_sidecar.test.js +122 -0
  317. package/compiled/src/step/parsing/inf_recovery_index.test.d.ts +2 -0
  318. package/compiled/src/step/parsing/inf_recovery_index.test.d.ts.map +1 -0
  319. package/compiled/src/step/parsing/inf_recovery_index.test.js +108 -0
  320. package/compiled/src/step/parsing/prefix_type_index.d.ts +124 -0
  321. package/compiled/src/step/parsing/prefix_type_index.d.ts.map +1 -0
  322. package/compiled/src/step/parsing/prefix_type_index.js +207 -0
  323. package/compiled/src/step/parsing/prefix_type_index.test.d.ts +2 -0
  324. package/compiled/src/step/parsing/prefix_type_index.test.d.ts.map +1 -0
  325. package/compiled/src/step/parsing/prefix_type_index.test.js +298 -0
  326. package/compiled/src/step/parsing/range_byte_source.d.ts +69 -0
  327. package/compiled/src/step/parsing/range_byte_source.d.ts.map +1 -0
  328. package/compiled/src/step/parsing/range_byte_source.js +78 -0
  329. package/compiled/src/step/parsing/range_byte_source.test.d.ts +2 -0
  330. package/compiled/src/step/parsing/range_byte_source.test.d.ts.map +1 -0
  331. package/compiled/src/step/parsing/range_byte_source.test.js +70 -0
  332. package/compiled/src/step/parsing/record_event.d.ts +23 -0
  333. package/compiled/src/step/parsing/record_event.d.ts.map +1 -0
  334. package/compiled/src/step/parsing/record_event.js +1 -0
  335. package/compiled/src/step/parsing/record_field_cursor.d.ts +94 -0
  336. package/compiled/src/step/parsing/record_field_cursor.d.ts.map +1 -0
  337. package/compiled/src/step/parsing/record_field_cursor.js +189 -0
  338. package/compiled/src/step/parsing/step_deserialization_functions.d.ts +29 -0
  339. package/compiled/src/step/parsing/step_deserialization_functions.d.ts.map +1 -1
  340. package/compiled/src/step/parsing/step_deserialization_functions.js +45 -0
  341. package/compiled/src/step/parsing/step_deserialization_functions.test.js +59 -1
  342. package/compiled/src/step/parsing/step_parser.d.ts +66 -1
  343. package/compiled/src/step/parsing/step_parser.d.ts.map +1 -1
  344. package/compiled/src/step/parsing/step_parser.js +164 -10
  345. package/compiled/src/step/parsing/step_string_parser.js +8 -8
  346. package/compiled/src/step/parsing/streaming_index_builder.d.ts +141 -0
  347. package/compiled/src/step/parsing/streaming_index_builder.d.ts.map +1 -0
  348. package/compiled/src/step/parsing/streaming_index_builder.js +280 -0
  349. package/compiled/src/step/parsing/streaming_index_builder.test.d.ts +2 -0
  350. package/compiled/src/step/parsing/streaming_index_builder.test.d.ts.map +1 -0
  351. package/compiled/src/step/parsing/streaming_index_builder.test.js +107 -0
  352. package/compiled/src/step/parsing/streaming_index_builder_async.test.d.ts +2 -0
  353. package/compiled/src/step/parsing/streaming_index_builder_async.test.d.ts.map +1 -0
  354. package/compiled/src/step/parsing/streaming_index_builder_async.test.js +109 -0
  355. package/compiled/src/step/parsing/streaming_record_dispatcher.d.ts +71 -0
  356. package/compiled/src/step/parsing/streaming_record_dispatcher.d.ts.map +1 -0
  357. package/compiled/src/step/parsing/streaming_record_dispatcher.js +88 -0
  358. package/compiled/src/step/parsing/streaming_record_dispatcher.test.d.ts +2 -0
  359. package/compiled/src/step/parsing/streaming_record_dispatcher.test.d.ts.map +1 -0
  360. package/compiled/src/step/parsing/streaming_record_dispatcher.test.js +66 -0
  361. package/compiled/src/step/parsing/uint32_sink.d.ts +72 -0
  362. package/compiled/src/step/parsing/uint32_sink.d.ts.map +1 -0
  363. package/compiled/src/step/parsing/uint32_sink.js +180 -0
  364. package/compiled/src/step/parsing/uint32_sink.test.d.ts +2 -0
  365. package/compiled/src/step/parsing/uint32_sink.test.d.ts.map +1 -0
  366. package/compiled/src/step/parsing/uint32_sink.test.js +199 -0
  367. package/compiled/src/step/step_buffer_provider.d.ts +48 -3
  368. package/compiled/src/step/step_buffer_provider.d.ts.map +1 -1
  369. package/compiled/src/step/step_buffer_provider.js +60 -11
  370. package/compiled/src/step/step_buffer_provider.test.js +14 -0
  371. package/compiled/src/step/step_entity_base.d.ts +65 -3
  372. package/compiled/src/step/step_entity_base.d.ts.map +1 -1
  373. package/compiled/src/step/step_entity_base.js +135 -3
  374. package/compiled/src/step/step_model_base.d.ts +221 -8
  375. package/compiled/src/step/step_model_base.d.ts.map +1 -1
  376. package/compiled/src/step/step_model_base.js +542 -7
  377. package/compiled/src/stream/index.d.ts +34 -0
  378. package/compiled/src/stream/index.d.ts.map +1 -0
  379. package/compiled/src/stream/index.js +32 -0
  380. package/compiled/src/version/version.js +1 -1
  381. package/compiled/tsconfig.tsbuildinfo +1 -1
  382. package/package.json +16 -1
@@ -1,18 +1,37 @@
1
1
  import { ConwayGeometry, } from "../../index.js";
2
2
  import * as glmatrix from "gl-matrix";
3
+ import { LARGE_COORDINATE_BUDGET_M, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, composeTransformF64, deriveCoordinationF64 } from "./coordination_f64.js";
3
4
  import Logger from "../../logging/logger.js";
4
5
  import ParsingBuffer from "../../parsing/parsing_buffer.js";
5
6
  import { ExtractResult } from "../../index.js";
6
7
  import { ParseResult } from "../../index.js";
7
8
  import Memory from "../../memory/memory.js";
8
9
  import { CanonicalMeshType } from "../../index.js";
10
+ import AP214StepModel from "../../AP214E3_2010/ap214_step_model.js";
9
11
  import { AP214GeometryExtraction } from "../../AP214E3_2010/ap214_geometry_extraction.js";
10
12
  import AP214StepParser from "../../AP214E3_2010/ap214_step_parser.js";
11
13
  import { AP214Properties } from "./ap214_properties.js";
12
14
  import { EntityTypesAP214Count } from "../../AP214E3_2010/AP214E3_2010_gen/entity_types_ap214.gen.js";
13
15
  import { ProgressTracker } from "../../core/progress.js";
14
16
  import { formatModelLine } from "../../core/progress_log.js";
17
+ import { wasmHeapView, } from "../../core/wasm_heap.js";
15
18
  import { extractModelInfo } from "../../loaders/loading_utilities.js";
19
+ import { BufferByteSource } from "../../step/parsing/byte_source.js";
20
+ import { ColumnarIndexSink } from "../../step/parsing/columnar_index.js";
21
+ import { buildIndexStreamingAsync, } from "../../step/parsing/streaming_index_builder.js";
22
+ import { ap214PreviewAdapter, StreamedPreviewChannel, } from "./streamed_preview_channel.js";
23
+ /* Moving-window size for the streamed columnar parse (matches the IFC
24
+ * proxy; the window bounds parse-time scratch, not the source buffer,
25
+ * which the model keeps resident here). */
26
+ // eslint-disable-next-line no-magic-numbers
27
+ const STREAMED_PARSE_POOL_BYTES = 1024 * 1024;
28
+ // Units drained per call when a whole-model consumer (streamAllMeshes)
29
+ // finishes a deferred model synchronously.
30
+ const DEFERRED_DRAIN_BATCH_AP214 = 256;
31
+ // Divisor mapping consumer batch sizes (tuned for IFC's per-product
32
+ // granularity) onto AP214's chunkier per-part units — see
33
+ // extractGeometryBatch.
34
+ const AP214_UNITS_PER_PRODUCT_BATCH = 16;
16
35
  /**
17
36
  */
18
37
  export class IfcApiProxyAP214 {
@@ -81,6 +100,20 @@ export class IfcApiProxyAP214 {
81
100
  this.wasmModule = wasmModule;
82
101
  this.settings = settings;
83
102
  this.fs = undefined;
103
+ /** Was this model opened without extraction (DEFER_GEOMETRY)? */
104
+ this.deferredMode_ = false;
105
+ /** True once beginPhase('geometry') has fired for this deferred pump. */
106
+ this.geometryPhaseStarted_ = false;
107
+ /** Has finishDemandExtraction run (deferred models, once)? */
108
+ this.demandFinished_ = false;
109
+ /**
110
+ * Deferred capture watermarks: entity localID -> how many of its
111
+ * placed instances (scene-walk order) have been captured — mirrors
112
+ * the IFC proxy's delta capture; see its demandCapturedCounts_ note.
113
+ */
114
+ this.demandCapturedCounts_ = new Map();
115
+ /** Unvalidated adopted preview frame — see the IFC proxy twin. */
116
+ this.demandCoordinationFromPreview_ = false;
84
117
  this._isCoordinated = false;
85
118
  this.linearScalingFactor = 1;
86
119
  this.identity = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
@@ -93,12 +126,18 @@ export class IfcApiProxyAP214 {
93
126
  * Contains all the logic and methods regarding properties, psets, qsets, etc.
94
127
  */
95
128
  this.properties = new AP214Properties(this);
129
+ /** Native geometry freed (releaseGeometry) — scene walks would touch
130
+ * freed objects, so mesh serving degrades to the accumulated maps. */
131
+ this.released_ = false;
96
132
  // The cooperative path (createAsync) parses/extracts before construction
97
133
  // so it can await mid-load; the classic OpenModel path does it here,
98
134
  // synchronously. Both share the tail below (mesh vectors, statistics).
99
135
  const loadState = precomputed ??
100
136
  IfcApiProxyAP214.parseAndExtract(modelID, data, new ConwayGeometry(wasmModule), settings);
101
137
  this.conwaywasm = loadState.conwaywasm;
138
+ this.conwayGeometry_ = loadState.conwayGeometry;
139
+ this.deferredMode_ = loadState.deferred === true;
140
+ this.progressTracker_ = loadState.tracker;
102
141
  const statistics = Logger.getStatistics(modelID);
103
142
  const { allTimeStart, stepHeader, model, scene, conwayGeometry, geometryTimeInMs: executionTimeInMs, } = loadState;
104
143
  // get linear scaling factor
@@ -174,6 +213,17 @@ export class IfcApiProxyAP214 {
174
213
  ];
175
214
  // save settings
176
215
  this.settings = settings;
216
+ // Deferred opens whose preview channel already established the
217
+ // coordination frame: adopt it so the durable capture places
218
+ // exactly where the preview did (internal only — see
219
+ // demandCoordination_).
220
+ if (this.deferredMode_ && loadState.previewCoordinationMatrix !== void 0) {
221
+ this.demandCoordination_ = loadState.previewCoordinationMatrix;
222
+ this._isCoordinated = true;
223
+ // Adopted, not derived — validated against the durable walk's
224
+ // first geometry (see the IFC proxy's demandCoordinationFromPreview_).
225
+ this.demandCoordinationFromPreview_ = true;
226
+ }
177
227
  let FILE_NAME = stepHeader.headers.get("FILE_NAME");
178
228
  if (FILE_NAME !== void 0) {
179
229
  // strip start / end parenthesis
@@ -220,6 +270,152 @@ export class IfcApiProxyAP214 {
220
270
  const loadState = await IfcApiProxyAP214.parseAndExtractAsync(modelID, data, new ConwayGeometry(wasmModule), settings);
221
271
  return new IfcApiProxyAP214(modelID, data, wasmModule, settings, loadState);
222
272
  }
273
+ /**
274
+ * Streamed columnar construction (conway extension, used by
275
+ * OpenModelStreamed): the data parse runs through the streaming
276
+ * columnar indexer over a moving window instead of the per-record
277
+ * object parse, so the index is columnar from birth — the AP214 twin
278
+ * of IfcApiProxyIfc.createStreamed (STEP demand parity phase 1).
279
+ * Geometry extraction stays the classic whole-model thunk-tree walk;
280
+ * the deferred pump and preview channel follow in later phases.
281
+ * Throws when the streamed parse is anything but COMPLETE — the
282
+ * factory falls back to the classic open.
283
+ *
284
+ * @param modelID The model ID being opened.
285
+ * @param data The STEP data buffer.
286
+ * @param wasmModule The wasm module.
287
+ * @param settings Loader settings (ON_PROGRESS / ON_MODEL_INFO honored).
288
+ * @return {Promise<IfcApiProxyAP214>} The constructed proxy.
289
+ */
290
+ static async createStreamed(modelID, data, wasmModule, settings) {
291
+ const loadState = await IfcApiProxyAP214.parseColumnarAndExtractAsync(modelID, data, new ConwayGeometry(wasmModule), settings);
292
+ return new IfcApiProxyAP214(modelID, data, wasmModule, settings, loadState);
293
+ }
294
+ /**
295
+ * Deferred streamed construction (STEP demand parity phase 2): the
296
+ * streamed columnar parse runs, the assembly tree is prepared, but NO
297
+ * geometry units execute — the batch pump (extractGeometryBatch)
298
+ * extracts them progressively afterwards. The AP214 twin of
299
+ * IfcApiProxyIfc.createDeferred.
300
+ *
301
+ * @param modelID The model ID being opened.
302
+ * @param data The STEP data buffer.
303
+ * @param wasmModule The wasm module.
304
+ * @param settings Loader settings (ON_PROGRESS / ON_MODEL_INFO honored).
305
+ * @return {Promise<IfcApiProxyAP214>} The constructed proxy.
306
+ */
307
+ static async createDeferred(modelID, data, wasmModule, settings) {
308
+ const loadState = await IfcApiProxyAP214.parseColumnarAndExtractAsync(modelID, data, new ConwayGeometry(wasmModule), settings, true);
309
+ return new IfcApiProxyAP214(modelID, data, wasmModule, settings, loadState);
310
+ }
311
+ /**
312
+ * Streamed twin of parseAndExtractAsync: cooperative columnar index
313
+ * build (periodic event-loop yields, absolute byte-cursor progress),
314
+ * then the model adopts the columns directly — no per-record object
315
+ * phase. Mirrors IfcApiProxyIfc.parseColumnarAndExtractAsync minus
316
+ * the deferred branch.
317
+ *
318
+ * @param modelID The model ID being opened.
319
+ * @param data The STEP data buffer.
320
+ * @param conwaywasm The conway geometry wasm wrapper.
321
+ * @param settings Loader settings (ON_PROGRESS / ON_MODEL_INFO honored).
322
+ * @return {Promise<Ap214ProxyLoadState>} Everything the constructor tail needs.
323
+ */
324
+ static async parseColumnarAndExtractAsync(modelID, data, conwaywasm, settings, deferGeometry = false) {
325
+ const tracker = IfcApiProxyAP214.makeTracker(settings);
326
+ const allTimeStart = Date.now();
327
+ const parser = AP214StepParser.Instance;
328
+ const bufferInput = new ParsingBuffer(data);
329
+ tracker?.beginPhase("headerParse", "bytes", data.length);
330
+ // Header parsed standalone first so the model line fires before the
331
+ // full parse (the columnar build re-reads the tiny header
332
+ // internally; the cost is negligible).
333
+ const [stepHeader, result0] = parser.parseHeader(bufferInput);
334
+ Logger.createStatistics(modelID);
335
+ const statistics = Logger.getStatistics(modelID);
336
+ IfcApiProxyAP214.reportHeaderParseResult(result0, bufferInput, modelID);
337
+ const modelInfo = extractModelInfo(stepHeader, data.length);
338
+ Logger.info(formatModelLine(modelInfo));
339
+ settings?.ON_MODEL_INFO?.(modelInfo);
340
+ tracker?.beginPhase("dataParse", "bytes", data.length);
341
+ const parseTick = tracker !== void 0 ?
342
+ (cursorBytes) => tracker.update(cursorBytes) : void 0;
343
+ const parseStartTime = Date.now();
344
+ const sink = new ColumnarIndexSink();
345
+ // Parse-time preview channel (slice A2, STEP demand parity phase
346
+ // 3): ticks between the cooperative parse's yields, emitting
347
+ // preview payloads from throwaway prefix extractions.
348
+ const previewChannel = deferGeometry && settings?.ON_PREVIEW_MESH !== void 0 ?
349
+ new StreamedPreviewChannel(data, conwaywasm, sink, ap214PreviewAdapter(), settings.COORDINATE_TO_ORIGIN === true, settings.ON_PREVIEW_MESH) : void 0;
350
+ previewChannel?.start();
351
+ // Channel ticks ride the parse's own progress callback (see
352
+ // maybeTickInline) — timer ticks alone starve under the parse's
353
+ // scheduler-priority yields in browsers.
354
+ const parseProgress = previewChannel !== void 0 ?
355
+ (cursorBytes) => {
356
+ parseTick?.(cursorBytes);
357
+ previewChannel.maybeTickInline();
358
+ } : parseTick;
359
+ let result;
360
+ try {
361
+ ({ result } = await buildIndexStreamingAsync(new BufferByteSource(data), parser, STREAMED_PARSE_POOL_BYTES, void 0, sink, parseProgress));
362
+ }
363
+ finally {
364
+ previewChannel?.stop();
365
+ }
366
+ const columns = sink.finalize();
367
+ const parseEndTime = Date.now();
368
+ tracker?.endPhase(data.length);
369
+ if (result !== ParseResult.COMPLETE) {
370
+ Logger.warning(`[OpenModelStreamed]: streamed parse result ${result}`);
371
+ statistics?.setLoadStatus("PARSE_FAIL");
372
+ throw new Error("Streamed parse did not complete");
373
+ }
374
+ const model = new AP214StepModel(data, columns);
375
+ statistics?.setParseTime(parseEndTime - parseStartTime);
376
+ const conwayGeometry = new AP214GeometryExtraction(conwaywasm, model);
377
+ // Deferred mode (createDeferred): build the assembly tree and the
378
+ // ordered unit list but execute nothing — the batch pump populates
379
+ // the scene progressively. `scene` is the same object the deferred
380
+ // capture walks, so meshes appear to consumers as units extract.
381
+ if (deferGeometry) {
382
+ conwayGeometry.prepareDemandExtraction();
383
+ return {
384
+ conwaywasm,
385
+ deferred: true,
386
+ previewCoordinationMatrix: previewChannel?.coordinationMatrix,
387
+ allTimeStart,
388
+ stepHeader,
389
+ model,
390
+ scene: conwayGeometry.scene,
391
+ conwayGeometry,
392
+ geometryTimeInMs: 0,
393
+ tracker,
394
+ };
395
+ }
396
+ // Heartbeat only: the AP214 thunk-tree extraction has no flat
397
+ // product loop to tick from yet.
398
+ tracker?.beginPhase("geometry", "products");
399
+ const startTime = Date.now();
400
+ const [extractionResult, scene] = conwayGeometry.extractAP214GeometryData();
401
+ const endTime = Date.now();
402
+ tracker?.endPhase();
403
+ if (extractionResult !== ExtractResult.COMPLETE) {
404
+ Logger.error("[OpenModelStreamed]: Error extracting geometry, exiting...");
405
+ statistics?.setLoadStatus("FAIL");
406
+ throw new Error("Couldn't extract model");
407
+ }
408
+ statistics?.setGeometryTypeCounts(conwayGeometry.geometryTypeCounts);
409
+ return {
410
+ conwaywasm,
411
+ allTimeStart,
412
+ stepHeader,
413
+ model,
414
+ scene,
415
+ conwayGeometry,
416
+ geometryTimeInMs: endTime - startTime,
417
+ };
418
+ }
223
419
  /**
224
420
  * Log + record the header parse result on the model statistics.
225
421
  *
@@ -662,6 +858,16 @@ export class IfcApiProxyAP214 {
662
858
  const coordinationMatrix = this.model[5];
663
859
  return Array.from(coordinationMatrix);
664
860
  }
861
+ /**
862
+ * The coordination frame actually applied to emitted placements —
863
+ * the derived (or validated adopted) recenter, identity when no
864
+ * recenter ran. See ifc_api_model_passthrough.getAppliedCoordination.
865
+ *
866
+ * @return {Array<number>} column-major mat4
867
+ */
868
+ getAppliedCoordination() {
869
+ return [...(this.demandCoordination_ ?? this.identity)];
870
+ }
665
871
  /**
666
872
  *
667
873
  * @param ptr
@@ -688,8 +894,15 @@ export class IfcApiProxyAP214 {
688
894
  * @return {Float32Array | Uint32Array}
689
895
  */
690
896
  getSubArray(heap, startPtr, sizeBytes) {
691
- // eslint-disable-next-line no-magic-numbers, no-mixed-operators
692
- return heap.subarray(startPtr / 4, startPtr / 4 + sizeBytes).slice(0);
897
+ // `heap` stays in the signature because web-ifc's API puts it there, but
898
+ // it is now read only for its element type. The view itself is rebuilt
899
+ // over the module's CURRENT heap buffer: a caller-held HEAPF32/HEAPU32 can
900
+ // be bound to a pre-growth buffer on the MT build, and subarray() on such
901
+ // a view clamps the window silently and returns short data rather than
902
+ // failing (#485, and see core/wasm_heap.ts).
903
+ const arrayType = heap.constructor;
904
+ // slice(0) as before, so the result outlives the next call into wasm.
905
+ return wasmHeapView(this.wasmModule, arrayType, startPtr, sizeBytes).slice(0);
693
906
  }
694
907
  /**
695
908
  * Closes a model and frees all related memory
@@ -704,7 +917,254 @@ export class IfcApiProxyAP214 {
704
917
  * @param modelID
705
918
  * @param meshCallback
706
919
  */
920
+ /**
921
+ * Free this model's native geometry (conway extension) — the AP214
922
+ * twin of the IFC proxy's releaseGeometry; see its note.
923
+ *
924
+ * @return {boolean} True when geometry was released.
925
+ */
926
+ releaseGeometry() {
927
+ if (this.deferredMode_ && !this.demandFinished_ &&
928
+ this.conwayGeometry_.demandUnitCursor < this.conwayGeometry_.demandUnitCount) {
929
+ Logger.warning("[ReleaseModelGeometry]: deferred pump not drained \u2014 not releasing");
930
+ return false;
931
+ }
932
+ const model = this.model[0];
933
+ const localIDs = [];
934
+ for (const mesh of model.geometry) {
935
+ localIDs.push(mesh.localID);
936
+ }
937
+ for (const localID of localIDs) {
938
+ try {
939
+ model.geometry.delete(localID);
940
+ }
941
+ catch {
942
+ // Never let a free break a loaded model.
943
+ }
944
+ }
945
+ this.model[3].clear();
946
+ this.released_ = true;
947
+ return true;
948
+ }
949
+ /**
950
+ * Deferred-mode unit pump (STEP demand parity phase 2; conway
951
+ * extension consumed through ExtractGeometryBatch): execute the next
952
+ * `batchSize` assembly-tree units and emit THIS BATCH's meshes as
953
+ * per-entity DELTA FlatMeshes — the AP214 twin of the IFC proxy's
954
+ * pump, same delta contract. On a fully-extracted model this is a
955
+ * no-op returning remaining 0.
956
+ *
957
+ * @param batchSize Max units to execute this call (min 1).
958
+ * @param meshCallback Receives each newly-captured delta mesh.
959
+ * @return {object} `{extracted, remaining}` — units executed this
960
+ * call and units still pending.
961
+ */
962
+ extractGeometryBatch(batchSize, meshCallback) {
963
+ if (!this.deferredMode_) {
964
+ return { extracted: 0, remaining: 0 };
965
+ }
966
+ const extraction = this.conwayGeometry_;
967
+ // Consumers tune batchSize for IFC's fine-grained products (Share
968
+ // pumps 64); AP214 units are whole parts/subassemblies — orders of
969
+ // magnitude chunkier (Arty: ~57 units for ~12s of geometry). Scale
970
+ // the requested batch down so STEP loads stay progressive without
971
+ // any consumer knowing the schema.
972
+ const units = Math.max(1, Math.floor(batchSize / AP214_UNITS_PER_PRODUCT_BATCH));
973
+ if (this.progressTracker_ !== void 0 && !this.geometryPhaseStarted_) {
974
+ this.progressTracker_.beginPhase("geometry", "products", extraction.demandUnitCount);
975
+ this.geometryPhaseStarted_ = true;
976
+ }
977
+ const extracted = extraction.extractDemandUnitBatch(units);
978
+ const remaining = extraction.demandUnitCount - extraction.demandUnitCursor;
979
+ if (this.progressTracker_ !== void 0) {
980
+ if (remaining === 0) {
981
+ this.progressTracker_.endPhase(extraction.demandUnitCount);
982
+ }
983
+ else {
984
+ this.progressTracker_.update(extraction.demandUnitCursor);
985
+ }
986
+ }
987
+ if (remaining === 0 && !this.demandFinished_) {
988
+ this.demandFinished_ = true;
989
+ extraction.finishDemandExtraction();
990
+ }
991
+ if (meshCallback !== void 0) {
992
+ this.streamNewMeshes_(meshCallback);
993
+ }
994
+ return { extracted, remaining };
995
+ }
996
+ /**
997
+ * Walk the scene and emit every not-yet-captured placed instance as
998
+ * per-entity DELTA FlatMeshes — the incremental core of
999
+ * streamAllMeshes with identical placed-geometry math (bare
1000
+ * coordination x nativeTransform composition, occurrence paths),
1001
+ * processed in walk order exactly once per instance. The shared
1002
+ * meshMap accumulates each entity's FULL vector so getFlatMesh stays
1003
+ * whole-model correct; the derived coordination matrix is remembered
1004
+ * across calls (demandCoordination_) without leaking through
1005
+ * getCoordinationMatrix (classic identity contract).
1006
+ *
1007
+ * @param meshCallback Receives one delta FlatMesh per entity that
1008
+ * gained instances this call.
1009
+ */
1010
+ streamNewMeshes_(meshCallback) {
1011
+ // Released models: the scene's natives are freed — nothing new can
1012
+ // exist to capture, and walking would touch freed objects.
1013
+ if (this.released_) {
1014
+ return;
1015
+ }
1016
+ const [model, scene, meshMap, geometryMaterialTransformMap] = this.model;
1017
+ let coordinationMatrix = this.demandCoordination_ ?? glmatrix.mat4.create();
1018
+ const seenThisPass = new Map();
1019
+ const deltas = new Map();
1020
+ const deltaExpressIDs = new Map();
1021
+ // eslint-disable-next-line no-unused-vars
1022
+ for (const [_, nativeTransform, geometry, material, entity, occurrencePath] of scene.walkWithOccurrence()) {
1023
+ if (entity?.localID === void 0 || entity.expressID === void 0) {
1024
+ continue;
1025
+ }
1026
+ const walkIndex = seenThisPass.get(entity.localID) ?? 0;
1027
+ seenThisPass.set(entity.localID, walkIndex + 1);
1028
+ if (walkIndex < (this.demandCapturedCounts_.get(entity.localID) ?? 0)) {
1029
+ continue;
1030
+ }
1031
+ this.demandCapturedCounts_.set(entity.localID, walkIndex + 1);
1032
+ if (geometry.type !== CanonicalMeshType.BUFFER_GEOMETRY || geometry.temporary) {
1033
+ continue;
1034
+ }
1035
+ const material_ = material ?? {
1036
+ name: "",
1037
+ // eslint-disable-next-line no-magic-numbers
1038
+ baseColor: [0.8, 0.8, 0.8, 1],
1039
+ // eslint-disable-next-line no-magic-numbers
1040
+ legacyColor: [0.8, 0.8, 0.8, 1],
1041
+ doubleSided: true,
1042
+ blend: 0,
1043
+ };
1044
+ const validatePreviewFrame = this.demandCoordinationFromPreview_ &&
1045
+ this.settings?.COORDINATE_TO_ORIGIN === true;
1046
+ let nativePt;
1047
+ if ((!this._isCoordinated || validatePreviewFrame) &&
1048
+ this.settings?.COORDINATE_TO_ORIGIN) {
1049
+ nativePt = geometry.geometry.getPoint(0);
1050
+ }
1051
+ const expressID = model.getElementByLocalID(geometry.localID)?.expressID;
1052
+ // Full-precision float64 placement straight from the wasm boundary
1053
+ // (glm::dmat4) — never truncated through a gl-matrix Float32Array;
1054
+ // the recentre math runs in double precision (see coordination_f64).
1055
+ const geometryTransform = nativeTransform?.getValues();
1056
+ if (!this._isCoordinated && this.settings?.COORDINATE_TO_ORIGIN) {
1057
+ const derived = deriveCoordinationF64(geometryTransform, nativePt, this.NormalizeMat, this.linearScalingFactor);
1058
+ coordinationMatrix = derived;
1059
+ this.demandCoordination_ = derived;
1060
+ this._isCoordinated = true;
1061
+ }
1062
+ else if (validatePreviewFrame) {
1063
+ // One-shot adopted-frame validation — see the IFC proxy twin
1064
+ // (Share#1634). Bare composition here: AP214 has no per-leaf
1065
+ // recenter (issue #308).
1066
+ this.demandCoordinationFromPreview_ = false;
1067
+ const probe = composeTransformF64(coordinationMatrix, geometryTransform);
1068
+ const magnitude = Math.max(Math.abs(probe[TRANSLATION_X]), Math.abs(probe[TRANSLATION_Y]), Math.abs(probe[TRANSLATION_Z]));
1069
+ if (magnitude > LARGE_COORDINATE_BUDGET_M) {
1070
+ const derived = deriveCoordinationF64(geometryTransform, nativePt, this.NormalizeMat, this.linearScalingFactor);
1071
+ coordinationMatrix = derived;
1072
+ this.demandCoordination_ = derived;
1073
+ Logger.info(`[deferred] preview coordination frame rejected (first durable ` +
1074
+ `placement at ${Math.round(magnitude)}m); re-derived from the durable anchor`);
1075
+ }
1076
+ }
1077
+ // Bare composition — no per-leaf recenter (issue #308: AP214
1078
+ // instances share one geometry buffer), matching streamAllMeshes.
1079
+ const newTransformArr = composeTransformF64(coordinationMatrix, geometryTransform);
1080
+ geometryMaterialTransformMap.set(expressID, [geometry.geometry, material_, newTransformArr]);
1081
+ const color = {
1082
+ x: material_.legacyColor[0],
1083
+ y: material_.legacyColor[1],
1084
+ z: material_.legacyColor[2],
1085
+ w: material_.legacyColor[3],
1086
+ };
1087
+ const placed = {
1088
+ color,
1089
+ geometryExpressID: expressID,
1090
+ flatTransformation: newTransformArr,
1091
+ occurrencePath,
1092
+ };
1093
+ let mesh = meshMap.get(entity.localID);
1094
+ if (mesh === void 0) {
1095
+ const placedArray = new Array();
1096
+ const placedVector = {
1097
+ get: (index) => placedArray[index] ?? placed,
1098
+ size: () => placedArray.length,
1099
+ push: (parameter) => {
1100
+ placedArray.push(parameter);
1101
+ },
1102
+ };
1103
+ const flatMesh = {
1104
+ geometries: placedVector,
1105
+ expressID: entity.expressID,
1106
+ };
1107
+ mesh = [placedVector, flatMesh];
1108
+ meshMap.set(entity.localID, mesh);
1109
+ }
1110
+ mesh[0].push(placed);
1111
+ mesh[1].geometries = mesh[0];
1112
+ let delta = deltas.get(entity.localID);
1113
+ if (delta === void 0) {
1114
+ delta = [];
1115
+ deltas.set(entity.localID, delta);
1116
+ deltaExpressIDs.set(entity.localID, entity.expressID);
1117
+ }
1118
+ delta.push(placed);
1119
+ }
1120
+ const vectorFlatMesh = this.model[4];
1121
+ for (const [localID, placedList] of deltas) {
1122
+ const placedVector = {
1123
+ get: (index) => placedList[index] ?? placedList[0],
1124
+ size: () => placedList.length,
1125
+ push: (parameter) => {
1126
+ placedList.push(parameter);
1127
+ },
1128
+ };
1129
+ const deltaMesh = {
1130
+ geometries: placedVector,
1131
+ expressID: deltaExpressIDs.get(localID),
1132
+ };
1133
+ vectorFlatMesh.push(deltaMesh);
1134
+ meshCallback(deltaMesh);
1135
+ }
1136
+ }
1137
+ /**
1138
+ *
1139
+ * @param meshCallback
1140
+ */
707
1141
  streamAllMeshes(meshCallback) {
1142
+ // Released models: the natives behind the scene are freed — serve
1143
+ // the accumulated per-entity meshes instead of re-walking.
1144
+ if (this.released_ && !this.deferredMode_) {
1145
+ const [, , meshMap, , vectorFlatMesh] = this.model;
1146
+ meshMap.forEach((mesh) => {
1147
+ vectorFlatMesh.push(mesh[1]);
1148
+ meshCallback(mesh[1]);
1149
+ });
1150
+ return;
1151
+ }
1152
+ // Deferred models: pump any remainder to completion and serve the
1153
+ // accumulated full per-entity meshes — re-running the classic walk
1154
+ // would push every instance a second time (mirrors the IFC proxy).
1155
+ if (this.deferredMode_) {
1156
+ const noCallback = void 0;
1157
+ while (this.extractGeometryBatch(DEFERRED_DRAIN_BATCH_AP214, noCallback).remaining > 0) {
1158
+ // draining
1159
+ }
1160
+ this.streamNewMeshes_(() => { });
1161
+ const [, , meshMap, , vectorFlatMesh] = this.model;
1162
+ meshMap.forEach((mesh) => {
1163
+ vectorFlatMesh.push(mesh[1]);
1164
+ meshCallback(mesh[1]);
1165
+ });
1166
+ return;
1167
+ }
708
1168
  const [model, scene, meshMap, geometryMaterialTransformMap, vectorFlatMesh] = this.model;
709
1169
  let coordinationMatrix = this.model[5];
710
1170
  // eslint-disable-next-line no-unused-vars
@@ -731,57 +1191,24 @@ export class IfcApiProxyAP214 {
731
1191
  }
732
1192
  // create PlacedGeometry
733
1193
  const expressID = model.getElementByLocalID(geometry.localID)?.expressID;
1194
+ // Full-precision float64 placement straight from the wasm boundary
1195
+ // (glm::dmat4) — never truncated through a gl-matrix Float32Array;
1196
+ // the recentre math runs in double precision (see coordination_f64).
734
1197
  const geometryTransform = nativeTransform?.getValues();
735
- let newMatrix;
736
- if (geometryTransform !== void 0) {
737
- newMatrix = glmatrix.mat4.fromValues(geometryTransform[0], geometryTransform[1], geometryTransform[2], geometryTransform[3], geometryTransform[4], geometryTransform[5], geometryTransform[6], geometryTransform[7], geometryTransform[8], geometryTransform[9], geometryTransform[10], geometryTransform[11], geometryTransform[12], geometryTransform[13], geometryTransform[14], geometryTransform[15]);
738
- }
739
- else {
740
- // set to identity if no transform found
741
- newMatrix = glmatrix.mat4.create();
742
- }
743
1198
  if (!this._isCoordinated && this.settings?.COORDINATE_TO_ORIGIN) {
744
- // coordinate the geometry to the origin
745
- const pt = [nativePt.x, nativePt.y, nativePt.z];
746
- // Transform the point by the matrix.
747
- const transformedPt = glmatrix.vec4.create();
748
- glmatrix.vec4.transformMat4(transformedPt, [pt[0], pt[1], pt[2], 1], newMatrix);
749
- // Create the translation matrix.
750
- coordinationMatrix = glmatrix.mat4.create();
751
- glmatrix.mat4.fromTranslation(coordinationMatrix, [-transformedPt[0], -transformedPt[1], -transformedPt[2]]);
752
- const scaleMatrix = glmatrix.mat4.create();
753
- // Create a 3D vector for scaling factors
754
- const scaleVec = glmatrix.vec3.fromValues(this.linearScalingFactor, this.linearScalingFactor, this.linearScalingFactor);
755
- // Scale the matrix
756
- glmatrix.mat4.scale(scaleMatrix, scaleMatrix, scaleVec);
757
- glmatrix.mat4.multiply(coordinationMatrix, this.NormalizeMat, coordinationMatrix);
758
- glmatrix.mat4.multiply(coordinationMatrix, scaleMatrix, coordinationMatrix);
1199
+ coordinationMatrix = deriveCoordinationF64(geometryTransform, nativePt, this.NormalizeMat, this.linearScalingFactor);
759
1200
  this._isCoordinated = true;
760
1201
  }
761
- // extract color
762
- const newTransform = glmatrix.mat4.create();
763
- // Create a 4x4 identity matrix
764
- const scaleMatrix = glmatrix.mat4.create();
765
- // Create a 3D vector for scaling factors
766
- const scaleVec = glmatrix.vec3.fromValues(this.linearScalingFactor, this.linearScalingFactor, this.linearScalingFactor);
767
- // Scale the matrix
768
- glmatrix.mat4.scale(scaleMatrix, scaleMatrix, scaleVec);
769
1202
  // Compose the world transform from the engine's scene transform
770
- // (newMatrix = nativeTransform). Geometry vertices stay in their
771
- // source-unit local space; nativeTransform maps them to metre world
772
- // space — the same bare composition the native consumer
773
- // geometry_aggregator uses. The per-leaf geometry.normalize() recenter
774
- // was removed: AP214 instances/mapped-items share one geometry buffer,
775
- // so normalize() mutated it once and later instances lost their offset
776
- // and collapsed toward the origin (issue #308 "port cluster"). The
777
- // global coordinationMatrix still carries Y-up + COORDINATE_TO_ORIGIN.
778
- if (newMatrix !== void 0) {
779
- glmatrix.mat4.multiply(newTransform, coordinationMatrix, newMatrix);
780
- }
781
- else {
782
- glmatrix.mat4.copy(newTransform, coordinationMatrix);
783
- }
784
- const newTransformArr = Array.from(newTransform);
1203
+ // (nativeTransform). Geometry vertices stay in their source-unit local
1204
+ // space; nativeTransform maps them to metre world space — the same
1205
+ // bare composition the native consumer geometry_aggregator uses. The
1206
+ // per-leaf geometry.normalize() recenter was removed: AP214
1207
+ // instances/mapped-items share one geometry buffer, so normalize()
1208
+ // mutated it once and later instances lost their offset and collapsed
1209
+ // toward the origin (issue #308 "port cluster"). The global
1210
+ // coordinationMatrix still carries Y-up + COORDINATE_TO_ORIGIN.
1211
+ const newTransformArr = composeTransformF64(coordinationMatrix, geometryTransform);
785
1212
  geometryMaterialTransformMap.set(expressID, [geometry.geometry, material_, newTransformArr]);
786
1213
  if (entity?.localID !== void 0) {
787
1214
  if (entity?.expressID !== void 0) {
@@ -894,56 +1321,25 @@ export class IfcApiProxyAP214 {
894
1321
  }
895
1322
  // create PlacedGeometry
896
1323
  const expressID = model.getElementByLocalID(geometry.localID)?.expressID;
1324
+ // Full-precision float64 placement straight from the wasm boundary
1325
+ // (glm::dmat4) — never truncated through a gl-matrix Float32Array;
1326
+ // the recentre math runs in double precision (see coordination_f64).
897
1327
  const geometryTransform = nativeTransform?.getValues();
898
- let newMatrix;
899
- if (geometryTransform !== void 0) {
900
- newMatrix = glmatrix.mat4.fromValues(geometryTransform[0], geometryTransform[1], geometryTransform[2], geometryTransform[3], geometryTransform[4], geometryTransform[5], geometryTransform[6], geometryTransform[7], geometryTransform[8], geometryTransform[9], geometryTransform[10], geometryTransform[11], geometryTransform[12], geometryTransform[13], geometryTransform[14], geometryTransform[15]);
901
- }
902
1328
  if (!this._isCoordinated && this.settings?.COORDINATE_TO_ORIGIN) {
903
- // coordinate the geometry to the origin
904
- // Assuming geom.GetPoint(0) returns a glm::dvec3, i.e., a 3D vector.
905
- // In TypeScript, you can represent it as number[] or Float64Array.
906
1329
  Logger.info("Setting up coordinationMatrix");
907
- const pt = [nativePt.x, nativePt.y, nativePt.z];
908
- // Transform the point by the matrix.
909
- const transformedPt = glmatrix.vec4.create();
910
- glmatrix.vec4.transformMat4(transformedPt, [pt[0], pt[1], pt[2], 1], newMatrix);
911
- // Create the translation matrix.
912
- coordinationMatrix = glmatrix.mat4.create();
913
- glmatrix.mat4.fromTranslation(coordinationMatrix, [-transformedPt[0], -transformedPt[1], -transformedPt[2]]);
914
- const scaleMatrix = glmatrix.mat4.create();
915
- // Create a 3D vector for scaling factors
916
- const scaleVec = glmatrix.vec3.fromValues(this.linearScalingFactor, this.linearScalingFactor, this.linearScalingFactor);
917
- // Scale the matrix
918
- glmatrix.mat4.scale(scaleMatrix, scaleMatrix, scaleVec);
919
- glmatrix.mat4.multiply(coordinationMatrix, this.NormalizeMat, coordinationMatrix);
920
- glmatrix.mat4.multiply(coordinationMatrix, scaleMatrix, coordinationMatrix);
1330
+ coordinationMatrix = deriveCoordinationF64(geometryTransform, nativePt, this.NormalizeMat, this.linearScalingFactor);
921
1331
  this._isCoordinated = true;
922
1332
  }
923
- // extract color
924
- const newTransform = glmatrix.mat4.create();
925
- // Create a 4x4 identity matrix
926
- const scaleMatrix = glmatrix.mat4.create();
927
- // Create a 3D vector for scaling factors
928
- const scaleVec = glmatrix.vec3.fromValues(this.linearScalingFactor, this.linearScalingFactor, this.linearScalingFactor);
929
- // Scale the matrix
930
- glmatrix.mat4.scale(scaleMatrix, scaleMatrix, scaleVec);
931
1333
  // Compose the world transform from the engine's scene transform
932
- // (newMatrix = nativeTransform). Geometry vertices stay in their
933
- // source-unit local space; nativeTransform maps them to metre world
934
- // space — the same bare composition the native consumer
935
- // geometry_aggregator uses. The per-leaf geometry.normalize() recenter
936
- // was removed: AP214 instances/mapped-items share one geometry buffer,
937
- // so normalize() mutated it once and later instances lost their offset
938
- // and collapsed toward the origin (issue #308 "port cluster"). The
939
- // global coordinationMatrix still carries Y-up + COORDINATE_TO_ORIGIN.
940
- if (newMatrix !== void 0) {
941
- glmatrix.mat4.multiply(newTransform, coordinationMatrix, newMatrix);
942
- }
943
- else {
944
- glmatrix.mat4.copy(newTransform, coordinationMatrix);
945
- }
946
- const newTransformArr = Array.from(newTransform);
1334
+ // (nativeTransform). Geometry vertices stay in their source-unit local
1335
+ // space; nativeTransform maps them to metre world space — the same
1336
+ // bare composition the native consumer geometry_aggregator uses. The
1337
+ // per-leaf geometry.normalize() recenter was removed: AP214
1338
+ // instances/mapped-items share one geometry buffer, so normalize()
1339
+ // mutated it once and later instances lost their offset and collapsed
1340
+ // toward the origin (issue #308 "port cluster"). The global
1341
+ // coordinationMatrix still carries Y-up + COORDINATE_TO_ORIGIN.
1342
+ const newTransformArr = composeTransformF64(coordinationMatrix, geometryTransform);
947
1343
  geometryMaterialTransformMap.set(expressID, [geometry.geometry, material_, newTransformArr]);
948
1344
  if (entity?.localID !== void 0) {
949
1345
  if (entity?.expressID !== void 0) {