zelos-recad 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (402) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +73 -2
  3. package/THIRD_PARTY_NOTICES.md +27 -0
  4. package/UPSTREAM-LICENSE +21 -0
  5. package/assets/fonts/.gitattributes +4 -0
  6. package/assets/fonts/Liberation-LICENSE.txt +102 -0
  7. package/assets/fonts/LiberationMono-Bold.ttf +0 -0
  8. package/assets/fonts/LiberationMono-BoldItalic.ttf +0 -0
  9. package/assets/fonts/LiberationMono-Italic.ttf +0 -0
  10. package/assets/fonts/LiberationMono-Regular.ttf +0 -0
  11. package/assets/fonts/LiberationSans-Bold.ttf +0 -0
  12. package/assets/fonts/LiberationSans-BoldItalic.ttf +0 -0
  13. package/assets/fonts/LiberationSans-Italic.ttf +0 -0
  14. package/assets/fonts/LiberationSans-Regular.ttf +0 -0
  15. package/assets/fonts/LiberationSerif-Bold.ttf +0 -0
  16. package/assets/fonts/LiberationSerif-BoldItalic.ttf +0 -0
  17. package/assets/fonts/LiberationSerif-Italic.ttf +0 -0
  18. package/assets/fonts/LiberationSerif-Regular.ttf +0 -0
  19. package/assets/fonts/NotoSans-LICENSE.txt +92 -0
  20. package/assets/fonts/NotoSansSC-Bold.ttf +0 -0
  21. package/assets/fonts/NotoSansSC-Regular.ttf +0 -0
  22. package/assets/fonts/NotoSerif-LICENSE.txt +92 -0
  23. package/assets/fonts/NotoSerifSC-Regular.ttf +0 -0
  24. package/assets/fonts/README.md +25 -0
  25. package/assets/fonts/manifest.json +127 -0
  26. package/assets/fonts/sources.json +147 -0
  27. package/assets/fonts/substitutions.json +139 -0
  28. package/build-info.json +26 -0
  29. package/mcp/index.d.ts +3 -0
  30. package/mcp/index.js +20 -0
  31. package/package.json +140 -4
  32. package/protocol/src/bundle.d.ts +96 -0
  33. package/protocol/src/bundle.js +83 -0
  34. package/protocol/src/client.d.ts +3 -0
  35. package/protocol/src/client.js +6 -0
  36. package/protocol/src/contracts.d.ts +224 -0
  37. package/protocol/src/contracts.js +196 -0
  38. package/protocol/src/native-evidence.d.ts +166 -0
  39. package/protocol/src/native-evidence.js +93 -0
  40. package/protocol/src/resource-manifest.d.ts +24 -0
  41. package/protocol/src/resource-manifest.js +27 -0
  42. package/protocol/src/resource-path.d.ts +5 -0
  43. package/protocol/src/resource-path.js +44 -0
  44. package/requirements.txt +2 -0
  45. package/scripts/check_runtime.py +21 -0
  46. package/scripts/extract_font_face.py +16 -0
  47. package/scripts/finish_pdf.py +76 -0
  48. package/scripts/index_fonts.py +57 -0
  49. package/scripts/rasterize.py +38 -0
  50. package/service/app.d.ts +8 -0
  51. package/service/app.js +110 -0
  52. package/service/main.d.ts +2 -0
  53. package/service/main.js +4 -0
  54. package/service/options.d.ts +3 -0
  55. package/service/options.js +24 -0
  56. package/shared/build-identity.d.mts +6 -0
  57. package/shared/build-identity.mjs +63 -0
  58. package/shared/client.d.mts +20 -0
  59. package/shared/client.mjs +123 -0
  60. package/shared/command.d.mts +10 -0
  61. package/shared/command.mjs +74 -0
  62. package/shared/contracts/src/paths.d.ts +3 -0
  63. package/shared/contracts/src/paths.js +31 -0
  64. package/shared/mcp.d.mts +13 -0
  65. package/shared/mcp.mjs +232 -0
  66. package/shared/service-storage/src/capacity.d.ts +36 -0
  67. package/shared/service-storage/src/capacity.js +71 -0
  68. package/shared/service-storage/src/consumption.d.ts +15 -0
  69. package/shared/service-storage/src/consumption.js +27 -0
  70. package/shared/service-storage/src/documents.d.ts +43 -0
  71. package/shared/service-storage/src/documents.js +210 -0
  72. package/shared/service-storage/src/downloads.d.ts +10 -0
  73. package/shared/service-storage/src/downloads.js +58 -0
  74. package/shared/service-storage/src/files.d.ts +18 -0
  75. package/shared/service-storage/src/files.js +118 -0
  76. package/shared/service-storage/src/footprint.d.ts +14 -0
  77. package/shared/service-storage/src/footprint.js +72 -0
  78. package/shared/service-storage/src/process-temp.d.ts +22 -0
  79. package/shared/service-storage/src/process-temp.js +181 -0
  80. package/shared/service-storage/src/quota.d.ts +30 -0
  81. package/shared/service-storage/src/quota.js +166 -0
  82. package/shared/service-storage/src/retention.d.ts +38 -0
  83. package/shared/service-storage/src/retention.js +148 -0
  84. package/shared/service-storage/src/staging.d.ts +15 -0
  85. package/shared/service-storage/src/staging.js +116 -0
  86. package/source/README.md +3 -0
  87. package/source/mcp/index.ts +16 -0
  88. package/source/package.json +45 -0
  89. package/source/protocol/src/bundle.ts +96 -0
  90. package/source/protocol/src/client.ts +7 -0
  91. package/source/protocol/src/contracts.ts +219 -0
  92. package/source/protocol/src/native-evidence.ts +212 -0
  93. package/source/protocol/src/resource-manifest.ts +29 -0
  94. package/source/protocol/src/resource-path.ts +57 -0
  95. package/source/rebuild.mjs +31 -0
  96. package/source/service/app.ts +124 -0
  97. package/source/service/main.ts +4 -0
  98. package/source/service/options.ts +24 -0
  99. package/source/shared/build-identity.d.mts +6 -0
  100. package/source/shared/build-identity.mjs +63 -0
  101. package/source/shared/client.d.mts +20 -0
  102. package/source/shared/client.mjs +123 -0
  103. package/source/shared/command.d.mts +10 -0
  104. package/source/shared/command.mjs +74 -0
  105. package/source/shared/contracts/src/paths.ts +33 -0
  106. package/source/shared/mcp.d.mts +13 -0
  107. package/source/shared/mcp.mjs +232 -0
  108. package/source/shared/service-storage/src/capacity.ts +101 -0
  109. package/source/shared/service-storage/src/consumption.ts +45 -0
  110. package/source/shared/service-storage/src/documents.ts +262 -0
  111. package/source/shared/service-storage/src/downloads.ts +62 -0
  112. package/source/shared/service-storage/src/files.ts +135 -0
  113. package/source/shared/service-storage/src/footprint.ts +78 -0
  114. package/source/shared/service-storage/src/process-temp.ts +205 -0
  115. package/source/shared/service-storage/src/quota.ts +198 -0
  116. package/source/shared/service-storage/src/retention.ts +180 -0
  117. package/source/shared/service-storage/src/staging.ts +106 -0
  118. package/source/src/application-objects.ts +64 -0
  119. package/source/src/assets.ts +15 -0
  120. package/source/src/base-fonts.ts +144 -0
  121. package/source/src/binary-dxf.ts +119 -0
  122. package/source/src/block-array.ts +67 -0
  123. package/source/src/block-clip.ts +294 -0
  124. package/source/src/block-metadata.ts +278 -0
  125. package/source/src/build-info.ts +15 -0
  126. package/source/src/bundle.ts +2 -0
  127. package/source/src/cad-engine.ts +380 -0
  128. package/source/src/cad-options.ts +12 -0
  129. package/source/src/cli.ts +41 -0
  130. package/source/src/clip-bounds.ts +181 -0
  131. package/source/src/command.ts +31 -0
  132. package/source/src/constraints.ts +83 -0
  133. package/source/src/contracts.ts +2 -0
  134. package/source/src/conversion.ts +2 -0
  135. package/source/src/dwg-dictionaries.ts +31 -0
  136. package/source/src/dwg-fallback.ts +68 -0
  137. package/source/src/dwg-viewports.ts +61 -0
  138. package/source/src/dwg.ts +193 -0
  139. package/source/src/dxf-database.ts +168 -0
  140. package/source/src/dxf-export.ts +414 -0
  141. package/source/src/dxf.ts +441 -0
  142. package/source/src/embedded-mtext.ts +157 -0
  143. package/source/src/font-options.ts +6 -0
  144. package/source/src/full-arc-adapter.ts +43 -0
  145. package/source/src/index.ts +8 -0
  146. package/source/src/io.ts +34 -0
  147. package/source/src/layout-bounds.ts +64 -0
  148. package/source/src/layouts.ts +182 -0
  149. package/source/src/leader.ts +241 -0
  150. package/source/src/legacy-columns.ts +356 -0
  151. package/source/src/line-type.ts +196 -0
  152. package/source/src/native-circular-path.ts +17 -0
  153. package/source/src/native-evidence.ts +224 -0
  154. package/source/src/native-linear-path.ts +23 -0
  155. package/source/src/native-segmented-path.ts +29 -0
  156. package/source/src/plot-regions.ts +169 -0
  157. package/source/src/point-dictionaries.ts +65 -0
  158. package/source/src/print-plan.ts +181 -0
  159. package/source/src/print-style.ts +23 -0
  160. package/source/src/raster-image.ts +179 -0
  161. package/source/src/readback.ts +108 -0
  162. package/source/src/reader-adapters.ts +225 -0
  163. package/source/src/reader.ts +315 -0
  164. package/source/src/render-operation.ts +583 -0
  165. package/source/src/resource-loading.ts +74 -0
  166. package/source/src/resource-manifest.ts +2 -0
  167. package/source/src/resource-path.ts +2 -0
  168. package/source/src/runner.ts +295 -0
  169. package/source/src/runtime/documents.ts +34 -0
  170. package/source/src/runtime/font-catalog.ts +44 -0
  171. package/source/src/runtime/index.ts +260 -0
  172. package/source/src/runtime/jobs.ts +460 -0
  173. package/source/src/runtime/managed-worker.ts +37 -0
  174. package/source/src/runtime/readiness.ts +106 -0
  175. package/source/src/runtime/storage-policy.ts +39 -0
  176. package/source/src/runtime/storage.ts +9 -0
  177. package/source/src/runtime-paths.ts +19 -0
  178. package/source/src/scope.ts +146 -0
  179. package/source/src/setup.ts +53 -0
  180. package/source/src/source-scene.ts +422 -0
  181. package/source/src/text/AcPdfMTextParser.ts +277 -0
  182. package/source/src/text/AcPdfTextLayout.ts +606 -0
  183. package/source/src/text/affine-writer.ts +40 -0
  184. package/source/src/text/best-effort.ts +124 -0
  185. package/source/src/text/bigfont.ts +206 -0
  186. package/source/src/text/fallback.ts +201 -0
  187. package/source/src/text/fonts.ts +263 -0
  188. package/source/src/text/glyphs.ts +63 -0
  189. package/source/src/text/imports.ts +240 -0
  190. package/source/src/text/ink-bounds.ts +35 -0
  191. package/source/src/text/render.ts +248 -0
  192. package/source/src/text/scene-geometry.ts +92 -0
  193. package/source/src/text/shape-vm.ts +221 -0
  194. package/source/src/text/shape.ts +38 -0
  195. package/source/src/text/shx-module.d.ts +11 -0
  196. package/source/src/text/single-line-codes.ts +22 -0
  197. package/source/src/text/single-line.ts +260 -0
  198. package/source/src/text/source-fonts.ts +31 -0
  199. package/source/src/text/style.ts +8 -0
  200. package/source/src/text/styles.ts +21 -0
  201. package/source/src/text-columns.ts +114 -0
  202. package/source/src/text-mask.ts +182 -0
  203. package/source/src/vendor-object-data.ts +265 -0
  204. package/source/src/worker.ts +107 -0
  205. package/source/src/xref.ts +374 -0
  206. package/source/tsconfig.json +29 -0
  207. package/src/application-objects.d.ts +4 -0
  208. package/src/application-objects.js +56 -0
  209. package/src/assets.d.ts +9 -0
  210. package/src/assets.js +14 -0
  211. package/src/base-fonts.d.ts +38 -0
  212. package/src/base-fonts.js +118 -0
  213. package/src/binary-dxf.d.ts +6 -0
  214. package/src/binary-dxf.js +127 -0
  215. package/src/block-array.d.ts +10 -0
  216. package/src/block-array.js +53 -0
  217. package/src/block-clip.d.ts +42 -0
  218. package/src/block-clip.js +250 -0
  219. package/src/block-metadata.d.ts +39 -0
  220. package/src/block-metadata.js +228 -0
  221. package/src/build-info.d.ts +2 -0
  222. package/src/build-info.js +14 -0
  223. package/src/bundle.d.ts +1 -0
  224. package/src/bundle.js +2 -0
  225. package/src/cad-engine.d.ts +2 -0
  226. package/src/cad-engine.js +339 -0
  227. package/src/cad-options.d.ts +11 -0
  228. package/src/cad-options.js +1 -0
  229. package/src/cli.d.ts +2 -0
  230. package/src/cli.js +38 -0
  231. package/src/clip-bounds.d.ts +5 -0
  232. package/src/clip-bounds.js +179 -0
  233. package/src/command.d.ts +2 -0
  234. package/src/command.js +42 -0
  235. package/src/constraints.d.ts +3 -0
  236. package/src/constraints.js +69 -0
  237. package/src/contracts.d.ts +1 -0
  238. package/src/contracts.js +2 -0
  239. package/src/conversion.d.ts +2 -0
  240. package/src/conversion.js +2 -0
  241. package/src/dwg-dictionaries.d.ts +4 -0
  242. package/src/dwg-dictionaries.js +37 -0
  243. package/src/dwg-fallback.d.ts +47 -0
  244. package/src/dwg-fallback.js +38 -0
  245. package/src/dwg-viewports.d.ts +4 -0
  246. package/src/dwg-viewports.js +56 -0
  247. package/src/dwg.d.ts +27 -0
  248. package/src/dwg.js +192 -0
  249. package/src/dxf-database.d.ts +16 -0
  250. package/src/dxf-database.js +176 -0
  251. package/src/dxf-export.d.ts +98 -0
  252. package/src/dxf-export.js +391 -0
  253. package/src/dxf.d.ts +55 -0
  254. package/src/dxf.js +405 -0
  255. package/src/embedded-mtext.d.ts +7 -0
  256. package/src/embedded-mtext.js +155 -0
  257. package/src/font-options.d.ts +6 -0
  258. package/src/font-options.js +1 -0
  259. package/src/full-arc-adapter.d.ts +4 -0
  260. package/src/full-arc-adapter.js +41 -0
  261. package/src/index.d.ts +8 -0
  262. package/src/index.js +6 -0
  263. package/src/io.d.ts +5 -0
  264. package/src/io.js +23 -0
  265. package/src/layout-bounds.d.ts +10 -0
  266. package/src/layout-bounds.js +70 -0
  267. package/src/layouts.d.ts +112 -0
  268. package/src/layouts.js +145 -0
  269. package/src/leader.d.ts +10 -0
  270. package/src/leader.js +239 -0
  271. package/src/legacy-columns.d.ts +36 -0
  272. package/src/legacy-columns.js +302 -0
  273. package/src/line-type.d.ts +15 -0
  274. package/src/line-type.js +182 -0
  275. package/src/native-circular-path.d.ts +15 -0
  276. package/src/native-circular-path.js +21 -0
  277. package/src/native-evidence.d.ts +44 -0
  278. package/src/native-evidence.js +218 -0
  279. package/src/native-linear-path.d.ts +5 -0
  280. package/src/native-linear-path.js +31 -0
  281. package/src/native-segmented-path.d.ts +6 -0
  282. package/src/native-segmented-path.js +39 -0
  283. package/src/plot-regions.d.ts +100 -0
  284. package/src/plot-regions.js +167 -0
  285. package/src/point-dictionaries.d.ts +12 -0
  286. package/src/point-dictionaries.js +88 -0
  287. package/src/print-plan.d.ts +83 -0
  288. package/src/print-plan.js +171 -0
  289. package/src/print-style.d.ts +5 -0
  290. package/src/print-style.js +21 -0
  291. package/src/raster-image.d.ts +26 -0
  292. package/src/raster-image.js +134 -0
  293. package/src/readback.d.ts +70 -0
  294. package/src/readback.js +105 -0
  295. package/src/reader-adapters.d.ts +5 -0
  296. package/src/reader-adapters.js +219 -0
  297. package/src/reader.d.ts +105 -0
  298. package/src/reader.js +281 -0
  299. package/src/render-operation.d.ts +30 -0
  300. package/src/render-operation.js +480 -0
  301. package/src/resource-loading.d.ts +10 -0
  302. package/src/resource-loading.js +65 -0
  303. package/src/resource-manifest.d.ts +1 -0
  304. package/src/resource-manifest.js +2 -0
  305. package/src/resource-path.d.ts +1 -0
  306. package/src/resource-path.js +2 -0
  307. package/src/runner.d.ts +23 -0
  308. package/src/runner.js +255 -0
  309. package/src/runtime/documents.d.ts +12 -0
  310. package/src/runtime/documents.js +28 -0
  311. package/src/runtime/font-catalog.d.ts +2 -0
  312. package/src/runtime/font-catalog.js +37 -0
  313. package/src/runtime/index.d.ts +155 -0
  314. package/src/runtime/index.js +234 -0
  315. package/src/runtime/jobs.d.ts +103 -0
  316. package/src/runtime/jobs.js +395 -0
  317. package/src/runtime/managed-worker.d.ts +8 -0
  318. package/src/runtime/managed-worker.js +29 -0
  319. package/src/runtime/readiness.d.ts +4 -0
  320. package/src/runtime/readiness.js +106 -0
  321. package/src/runtime/storage-policy.d.ts +25 -0
  322. package/src/runtime/storage-policy.js +29 -0
  323. package/src/runtime/storage.d.ts +1 -0
  324. package/src/runtime/storage.js +1 -0
  325. package/src/runtime-paths.d.ts +3 -0
  326. package/src/runtime-paths.js +12 -0
  327. package/src/scope.d.ts +24 -0
  328. package/src/scope.js +137 -0
  329. package/src/setup.d.ts +4 -0
  330. package/src/setup.js +71 -0
  331. package/src/source-scene.d.ts +17 -0
  332. package/src/source-scene.js +400 -0
  333. package/src/text/AcPdfMTextParser.d.ts +61 -0
  334. package/src/text/AcPdfMTextParser.js +198 -0
  335. package/src/text/AcPdfTextLayout.d.ts +123 -0
  336. package/src/text/AcPdfTextLayout.js +446 -0
  337. package/src/text/affine-writer.d.ts +4 -0
  338. package/src/text/affine-writer.js +35 -0
  339. package/src/text/best-effort.d.ts +17 -0
  340. package/src/text/best-effort.js +119 -0
  341. package/src/text/bigfont.d.ts +19 -0
  342. package/src/text/bigfont.js +210 -0
  343. package/src/text/fallback.d.ts +9 -0
  344. package/src/text/fallback.js +186 -0
  345. package/src/text/fonts.d.ts +49 -0
  346. package/src/text/fonts.js +222 -0
  347. package/src/text/glyphs.d.ts +12 -0
  348. package/src/text/glyphs.js +53 -0
  349. package/src/text/imports.d.ts +55 -0
  350. package/src/text/imports.js +212 -0
  351. package/src/text/ink-bounds.d.ts +12 -0
  352. package/src/text/ink-bounds.js +32 -0
  353. package/src/text/render.d.ts +5 -0
  354. package/src/text/render.js +222 -0
  355. package/src/text/scene-geometry.d.ts +21 -0
  356. package/src/text/scene-geometry.js +70 -0
  357. package/src/text/shape-vm.d.ts +10 -0
  358. package/src/text/shape-vm.js +222 -0
  359. package/src/text/shape.d.ts +2 -0
  360. package/src/text/shape.js +30 -0
  361. package/src/text/single-line-codes.d.ts +8 -0
  362. package/src/text/single-line-codes.js +20 -0
  363. package/src/text/single-line.d.ts +4 -0
  364. package/src/text/single-line.js +228 -0
  365. package/src/text/source-fonts.d.ts +7 -0
  366. package/src/text/source-fonts.js +30 -0
  367. package/src/text/style.d.ts +6 -0
  368. package/src/text/style.js +3 -0
  369. package/src/text/styles.d.ts +3 -0
  370. package/src/text/styles.js +22 -0
  371. package/src/text-columns.d.ts +13 -0
  372. package/src/text-columns.js +93 -0
  373. package/src/text-mask.d.ts +7 -0
  374. package/src/text-mask.js +170 -0
  375. package/src/vendor-object-data.d.ts +19 -0
  376. package/src/vendor-object-data.js +241 -0
  377. package/src/worker.d.ts +1 -0
  378. package/src/worker.js +95 -0
  379. package/src/xref.d.ts +13 -0
  380. package/src/xref.js +319 -0
  381. package/vendor/libredwg/COPYING +674 -0
  382. package/vendor/libredwg/Dockerfile +26 -0
  383. package/vendor/libredwg/README.md +89 -0
  384. package/vendor/libredwg/application-objects.patch +100 -0
  385. package/vendor/libredwg/attrib-tail.patch +19 -0
  386. package/vendor/libredwg/build-local.sh +37 -0
  387. package/vendor/libredwg/constraint-group.patch +219 -0
  388. package/vendor/libredwg/constraint-r2004.patch +73 -0
  389. package/vendor/libredwg/dictionary-text.patch +52 -0
  390. package/vendor/libredwg/dxf-assoc.patch +7 -0
  391. package/vendor/libredwg/dxf-width.patch +44 -0
  392. package/vendor/libredwg/eed-binding.patch +147 -0
  393. package/vendor/libredwg/embedded-mtext.patch +178 -0
  394. package/vendor/libredwg/libredwg-web.js +2 -0
  395. package/vendor/libredwg/libredwg-web.wasm +0 -0
  396. package/vendor/libredwg/manifest.json +33 -0
  397. package/vendor/libredwg/mtext-mask.patch +36 -0
  398. package/vendor/libredwg/object-recovery.patch +105 -0
  399. package/vendor/libredwg/opaque-object-binding.patch +29 -0
  400. package/vendor/libredwg/rebuild.mjs +52 -0
  401. package/vendor/libredwg/source.tar.gz +0 -0
  402. package/vendor/libredwg/text-style.patch +64 -0
@@ -0,0 +1,179 @@
1
+ import { CadError } from "./contracts.js";
2
+ const cross = (a, b) => a.x * b.y - a.y * b.x;
3
+ const sub = (a, b) => ({ x: a.x - b.x, y: a.y - b.y });
4
+ const at = (a, b, t) => ({ x: a.x + (b.x - a.x) * t, y: a.y + (b.y - a.y) * t });
5
+ function parameters(a, b, c, d) {
6
+ const u = sub(b, a), v = sub(d, c), w = sub(c, a), det = cross(u, v);
7
+ if (Math.abs(det) < 1e-12) {
8
+ if (Math.abs(cross(w, u)) > 1e-9)
9
+ return [];
10
+ const length = u.x * u.x + u.y * u.y;
11
+ return length
12
+ ? [c, d]
13
+ .map((p) => ((p.x - a.x) * u.x + (p.y - a.y) * u.y) / length)
14
+ .filter((t) => t >= 0 && t <= 1)
15
+ : [];
16
+ }
17
+ const t = cross(w, v) / det, s = cross(w, u) / det;
18
+ return t >= -1e-10 && t <= 1 + 1e-10 && s >= -1e-10 && s <= 1 + 1e-10
19
+ ? [Math.max(0, Math.min(1, t))]
20
+ : [];
21
+ }
22
+ function contains(p, polygon) {
23
+ let inside = false;
24
+ for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
25
+ const a = polygon[j], b = polygon[i];
26
+ if (Math.abs(cross(sub(p, a), sub(b, a))) < 1e-9 &&
27
+ p.x >= Math.min(a.x, b.x) - 1e-9 &&
28
+ p.x <= Math.max(a.x, b.x) + 1e-9 &&
29
+ p.y >= Math.min(a.y, b.y) - 1e-9 &&
30
+ p.y <= Math.max(a.y, b.y) + 1e-9)
31
+ return true;
32
+ if (a.y > p.y !== b.y > p.y && p.x < ((b.x - a.x) * (p.y - a.y)) / (b.y - a.y) + a.x)
33
+ inside = !inside;
34
+ }
35
+ return inside;
36
+ }
37
+ const edges = (points) => points.map((p, i) => [p, points[(i + 1) % points.length]]);
38
+ /** Extents after all ancestor block clips. Text and other specialized operations
39
+ * keep their resource-aware bounds, but only for that drawable, so they cannot
40
+ * restore invisible siblings to the result. PDF paths are never rewritten. */
41
+ export function clippedVectorBounds(root, textInk) {
42
+ const bounds = { min: { x: Infinity, y: Infinity }, max: { x: -Infinity, y: -Infinity } };
43
+ let complete = true, work = 0;
44
+ const add = (p) => {
45
+ bounds.min.x = Math.min(bounds.min.x, p.x);
46
+ bounds.min.y = Math.min(bounds.min.y, p.y);
47
+ bounds.max.x = Math.max(bounds.max.x, p.x);
48
+ bounds.max.y = Math.max(bounds.max.y, p.y);
49
+ };
50
+ const step = () => {
51
+ if (++work > 5_000_000)
52
+ throw new CadError('BLOCK_CLIP_LIMIT', '裁剪边界测量复杂度超限');
53
+ };
54
+ const visit = (node, parent, clips) => {
55
+ if (!complete || !node.visible)
56
+ return;
57
+ if (node.clipBox && !node.userData?.xdtraceViewport) {
58
+ complete = false;
59
+ return;
60
+ }
61
+ const matrix = node._matrix ? parent?.clone().multiply(node._matrix) || node._matrix : parent;
62
+ const map = (p) => {
63
+ const m = matrix?.elements;
64
+ return m ? { x: m[0] * p.x + m[4] * p.y + m[12], y: m[1] * p.x + m[5] * p.y + m[13] } : p;
65
+ };
66
+ if (node.userData?.xdtraceBlockClip)
67
+ clips = [...clips, node.userData.xdtraceBlockClip.map(map)];
68
+ if (node.clipBox && node.userData?.xdtraceViewport) {
69
+ const { min, max } = node.clipBox;
70
+ clips = [...clips, [min, { x: max.x, y: min.y }, max, { x: min.x, y: max.y }].map(map)];
71
+ }
72
+ const within = (p) => clips.every((poly) => contains(p, poly));
73
+ const clipEdges = clips.flatMap(edges);
74
+ const segment = (a, b, accept = (_p) => true) => {
75
+ const ts = [0, 1];
76
+ for (const [c, d] of clipEdges) {
77
+ step();
78
+ ts.push(...parameters(a, b, c, d));
79
+ }
80
+ ts.sort((a, b) => a - b);
81
+ for (let i = 1; i < ts.length; i++) {
82
+ const p = at(a, b, (ts[i - 1] + ts[i]) / 2);
83
+ if (within(p) && accept(p)) {
84
+ add(at(a, b, ts[i - 1]));
85
+ add(at(a, b, ts[i]));
86
+ }
87
+ }
88
+ };
89
+ const area = (loops) => {
90
+ const fillEdges = loops.flatMap(edges);
91
+ // Extrema of polygon intersection are original vertices or edge intersections.
92
+ for (const [a, b] of fillEdges)
93
+ segment(a, b);
94
+ for (const [a, b] of clipEdges) {
95
+ const ts = [0, 1];
96
+ for (const [c, d] of fillEdges) {
97
+ step();
98
+ ts.push(...parameters(a, b, c, d));
99
+ }
100
+ ts.sort((a, b) => a - b);
101
+ for (let i = 1; i < ts.length; i++) {
102
+ const p = at(a, b, (ts[i - 1] + ts[i]) / 2);
103
+ if (loops.filter((loop) => contains(p, loop)).length % 2)
104
+ segment(at(a, b, ts[i - 1]), at(a, b, ts[i]));
105
+ }
106
+ }
107
+ };
108
+ let measuredFallback = false;
109
+ for (const op of node._ops) {
110
+ if (op.kind === 'text' && textInk)
111
+ for (const loop of textInk(op)) {
112
+ // Same quantization guard as unclipped glyph ink. Intersect the guard
113
+ // with the authored clip, never restore an unrelated cached root box.
114
+ const guard = Math.abs(op.size) * 0.001;
115
+ const x1 = Math.min(...loop.map((p) => p.x)) - guard, y1 = Math.min(...loop.map((p) => p.y)) - guard;
116
+ const x2 = Math.max(...loop.map((p) => p.x)) + guard, y2 = Math.max(...loop.map((p) => p.y)) + guard;
117
+ area([
118
+ [
119
+ { x: x1, y: y1 },
120
+ { x: x2, y: y1 },
121
+ { x: x2, y: y2 },
122
+ { x: x1, y: y2 },
123
+ ].map(map),
124
+ ]);
125
+ }
126
+ else if (op.kind === 'stroke') {
127
+ const ps = op.points.map(map);
128
+ for (let i = 1; i < ps.length; i++)
129
+ segment(ps[i - 1], ps[i]);
130
+ if (op.closed && ps.length > 2)
131
+ segment(ps.at(-1), ps[0]);
132
+ }
133
+ else if (op.kind === 'fill' || op.kind === 'gradient') {
134
+ area(op.loops.map((p) => p.map(map)));
135
+ }
136
+ else if (op.kind === 'circle') {
137
+ // Conservative affine circle bounds, limited to this operation.
138
+ area([
139
+ [
140
+ { x: op.x - op.r, y: op.y - op.r },
141
+ { x: op.x + op.r, y: op.y - op.r },
142
+ { x: op.x + op.r, y: op.y + op.r },
143
+ { x: op.x - op.r, y: op.y + op.r },
144
+ ].map(map),
145
+ ]);
146
+ }
147
+ else if (op.kind === 'image') {
148
+ // Keep the affine quadrilateral, not a repeatedly transformed AABB.
149
+ // Alpha and IMAGE's own clip remain conservative within this quad.
150
+ area([
151
+ [
152
+ { x: op.x, y: op.y },
153
+ { x: op.x + op.width, y: op.y },
154
+ { x: op.x + op.width, y: op.y + op.height },
155
+ { x: op.x, y: op.y + op.height },
156
+ ].map(map),
157
+ ]);
158
+ }
159
+ else if (!measuredFallback) {
160
+ const { min, max } = node.box;
161
+ if (![min.x, min.y, max.x, max.y].every(Number.isFinite) ||
162
+ min.x > max.x ||
163
+ min.y > max.y) {
164
+ // An unknown operation must never silently disappear from extents.
165
+ complete = false;
166
+ break;
167
+ }
168
+ // AcPdfEntity.applyMatrix recursively transforms descendant boxes.
169
+ // This resource-aware box is already in drawing coordinates.
170
+ area([[min, { x: max.x, y: min.y }, max, { x: min.x, y: max.y }]]);
171
+ measuredFallback = true;
172
+ }
173
+ }
174
+ for (let i = 0; i < node.childCount; i++)
175
+ visit(node.childAt(i), matrix, clips);
176
+ };
177
+ visit(root, undefined, []);
178
+ return complete ? bounds : root.box;
179
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/src/command.js ADDED
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env node
2
+ import { runDocumentCommand } from '../shared/command.mjs';
3
+ import { startRecadMcp } from "../mcp/index.js";
4
+ import { createRecadApp } from "../service/app.js";
5
+ import { recadOptions } from "../service/options.js";
6
+ import { createRecadRuntime } from "./runtime/index.js";
7
+ import { prepareRecadRuntime } from "./setup.js";
8
+ import { mkdir } from 'node:fs/promises';
9
+ await runDocumentCommand({
10
+ engine: 'recad', defaultPorts: { serve: 18771, mcp: 18773 }, startMcp: startRecadMcp,
11
+ async serve(options) {
12
+ if (!['127.0.0.1', 'localhost', '::1'].includes(options.host) && !options.token)
13
+ throw new Error('Set RECAD_TOKEN for external listening');
14
+ const app = createRecadApp({ ...await recadOptions(options), token: options.token });
15
+ try {
16
+ const address = await app.listen({ host: options.host, port: options.port });
17
+ return { address, close: () => app.close() };
18
+ }
19
+ catch (error) {
20
+ await app.close();
21
+ throw error;
22
+ }
23
+ },
24
+ async doctor(options) {
25
+ const config = await recadOptions(options, false);
26
+ await mkdir(config.data, { recursive: true });
27
+ const runtime = createRecadRuntime(config);
28
+ try {
29
+ return await runtime.readiness();
30
+ }
31
+ finally {
32
+ await runtime.close();
33
+ }
34
+ },
35
+ setup: prepareRecadRuntime,
36
+ async run(values) {
37
+ const prepared = await prepareRecadRuntime({ python: values.python });
38
+ process.env.RECAD_PYTHON = prepared.python;
39
+ process.argv.splice(2, 1);
40
+ await import("./cli.js");
41
+ },
42
+ });
@@ -0,0 +1,3 @@
1
+ /** These graphs describe the saved entities. We retain and check the graph;
2
+ * changing parameters or solving constraints is outside the printing API. */
3
+ export declare function captureConstraintGroups(module: any, pointer: number, sourceSha256: string, allowSavedPending?: boolean): any[];
@@ -0,0 +1,69 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { CadError } from "./contracts.js";
3
+ /** These graphs describe the saved entities. We retain and check the graph;
4
+ * changing parameters or solving constraints is outside the printing API. */
5
+ export function captureConstraintGroups(module, pointer, sourceSha256, allowSavedPending = false) {
6
+ const groups = module.xdtrace_constraint_groups(pointer);
7
+ const fail = (handle, reason) => {
8
+ throw new CadError('DWG_CONSTRAINT', '二维约束组未通过完整性核验:' + reason, { handle });
9
+ };
10
+ return groups.map((group) => {
11
+ const handle = group.handle;
12
+ if (group.version !== 2 ||
13
+ !(group.geometryStatus === 0 || (allowSavedPending && group.geometryStatus === 1)))
14
+ fail(handle, '版本尚未验证或约束需要重新计算');
15
+ if (!group.owner || group.owner !== group.owningNetwork || group.actionBody !== '0')
16
+ fail(handle, '约束组归属或动作体不受支持');
17
+ if (!Array.isArray(group.nodes) || group.nodes.length > 100000)
18
+ fail(handle, '节点数量无效');
19
+ const nodes = new Map(group.nodes.map((node) => [node.id, node]));
20
+ if (nodes.size !== group.nodes.length)
21
+ fail(handle, '节点编号重复');
22
+ const actions = new Set(group.actions.map((action) => action.handle));
23
+ if (actions.size !== group.actions.length ||
24
+ group.actions.some((a) => a.handle === '0' || a.type !== 'ASSOCGEOMDEPENDENCY'))
25
+ fail(handle, '几何依赖缺失或类型无效');
26
+ for (const node of group.nodes) {
27
+ if (!Number.isInteger(node.id) || node.id <= 0 || node.id >= group.maxNodeId)
28
+ fail(handle, '节点编号超出范围');
29
+ if (new Set(node.connections).size !== node.connections.length ||
30
+ node.connections.some((id) => !nodes.get(id)?.connections.includes(node.id)))
31
+ fail(handle, '连接缺失、重复或不对称');
32
+ if (node.type === 'AcConstrainedImplicitPoint') {
33
+ if (node.dependency !== '0' ||
34
+ node.geometryNodeId !== 0 ||
35
+ node.pointIndex !== -1 ||
36
+ ![0, 1, 2].includes(node.pointType) ||
37
+ nodes.get(node.curveId)?.type !== 'AcConstrainedBoundedLine')
38
+ fail(handle, '隐式点引用或类型不受支持');
39
+ }
40
+ else if (node.type === 'AcConstrainedBoundedLine') {
41
+ if (!actions.has(node.dependency) || node.geometryNodeId !== 0 || node.ray)
42
+ fail(handle, '线段依赖或类型不受支持');
43
+ for (const value of [node.point, node.direction, node.start, node.end])
44
+ if (!Array.isArray(value) || value.length !== 3 || !value.every(Number.isFinite))
45
+ fail(handle, '线段坐标无效');
46
+ }
47
+ else if (![
48
+ 'AcPointCurveConstraint',
49
+ 'AcPointCoincidenceConstraint',
50
+ 'AcMidPointConstraint',
51
+ ].includes(node.type) ||
52
+ node.ownerId !== 0)
53
+ fail(handle, '节点类型或复合约束不受支持');
54
+ }
55
+ if (!Number.isInteger(group.rawBitCount) ||
56
+ group.rawBitCount <= 0 ||
57
+ !/^[a-f0-9]+$/.test(group.rawHex) ||
58
+ group.rawHex.length !== Math.ceil(group.rawBitCount / 8) * 2)
59
+ fail(handle, '原始约束数据未完整保留');
60
+ return {
61
+ ...group,
62
+ sourceSha256,
63
+ evaluation: 'saved-geometry',
64
+ solverExecuted: false,
65
+ requiresEvaluation: group.geometryStatus !== 0,
66
+ rawSha256: createHash('sha256').update(Buffer.from(group.rawHex, 'hex')).digest('hex'),
67
+ };
68
+ });
69
+ }
@@ -0,0 +1 @@
1
+ export * from 'zelos-recad/protocol';
@@ -0,0 +1,2 @@
1
+ // Compatibility entry point; the protocol package owns the shared implementation.
2
+ export * from 'zelos-recad/protocol';
@@ -0,0 +1,2 @@
1
+ /** Existing native DXF candidate generation shared by local application adapters. */
2
+ export { createNativeDxfCandidate } from './dxf-export.js';
@@ -0,0 +1,2 @@
1
+ /** Existing native DXF candidate generation shared by local application adapters. */
2
+ export { createNativeDxfCandidate } from "./dxf-export.js";
@@ -0,0 +1,4 @@
1
+ /** Bootstrap dictionary handles are synthetic. Align them with the source
2
+ * named dictionary before upstream imports dynamic metadata: otherwise source
3
+ * NOD handle B is mistaken for the bootstrap GROUP dictionary B. */
4
+ export declare function alignDwgDictionaries(model: any, db: any): void;
@@ -0,0 +1,37 @@
1
+ /** Bootstrap dictionary handles are synthetic. Align them with the source
2
+ * named dictionary before upstream imports dynamic metadata: otherwise source
3
+ * NOD handle B is mistaken for the bootstrap GROUP dictionary B. */
4
+ export function alignDwgDictionaries(model, db) {
5
+ const dictionaries = model.objects.DICTIONARY;
6
+ const roots = dictionaries.filter((d) => !d.ownerHandle || d.ownerHandle === '0');
7
+ if (roots.length !== 1)
8
+ return;
9
+ const root = roots[0];
10
+ let max = 0;
11
+ const scan = (value) => {
12
+ if (!value || typeof value !== 'object' || ArrayBuffer.isView(value))
13
+ return;
14
+ if (typeof value.handle === 'string')
15
+ max = Math.max(max, parseInt(value.handle, 16) || 0);
16
+ for (const child of Object.values(value))
17
+ if (typeof child === 'object')
18
+ scan(child);
19
+ };
20
+ scan(model);
21
+ db.updateMaxHandle(max.toString(16).toUpperCase());
22
+ const names = {
23
+ group: 'ACAD_GROUP',
24
+ layout: 'ACAD_LAYOUT',
25
+ imageDefinition: 'ACAD_IMAGE_DICT',
26
+ mleaderStyle: 'ACAD_MLEADERSTYLE',
27
+ mlineStyle: 'ACAD_MLINESTYLE',
28
+ };
29
+ for (const dictionary of Object.values(db.objects))
30
+ db.releaseObjectHandle(dictionary);
31
+ for (const [key, dictionary] of Object.entries(db.objects)) {
32
+ dictionary.objectId =
33
+ key === 'dictionary' ? root.handle : root.entries[names[key]] || db.generateHandle();
34
+ dictionary.ownerId = key === 'dictionary' ? '0' : root.handle;
35
+ db.commitObjectHandle(dictionary);
36
+ }
37
+ }
@@ -0,0 +1,47 @@
1
+ export declare const fallbackArtifacts: string[];
2
+ export declare const drawingArtifacts: string[];
3
+ export declare const isDrawingArtifact: (name: string) => boolean;
4
+ export interface ArtifactReceipt {
5
+ name: string;
6
+ sha256: string;
7
+ bytes: number;
8
+ }
9
+ export interface FallbackReceipt {
10
+ format: 'XDTrace.DwgFallback';
11
+ version: 1;
12
+ sourceSha256: string;
13
+ operation: string;
14
+ status: 'skipped' | 'converting' | 'reading' | 'used' | 'failed' | 'cancelled';
15
+ category: string;
16
+ directError: {
17
+ code: string;
18
+ message: string;
19
+ detail?: unknown;
20
+ };
21
+ error?: {
22
+ code: string;
23
+ message: string;
24
+ detail?: unknown;
25
+ };
26
+ processedSourceSha256?: string;
27
+ decoderRevision?: string;
28
+ constraintGroupCount?: number;
29
+ pendingConstraintGroups?: number;
30
+ solverExecuted: false;
31
+ independentAudit: 'pending';
32
+ semanticReadback: 'pending';
33
+ startedAt: string;
34
+ endedAt?: string;
35
+ artifacts: ArtifactReceipt[];
36
+ }
37
+ export declare function cadErrorRecord(error: unknown): {
38
+ code: string;
39
+ message: string;
40
+ detail: unknown;
41
+ };
42
+ /** Only source-format/import failures warrant a new representation. Native
43
+ * integrity checks still run from scratch in the conversion worker. */
44
+ export declare function classifyDwgFailure(code: string, detail?: any): {
45
+ eligible: boolean;
46
+ category: string;
47
+ };
@@ -0,0 +1,38 @@
1
+ export const fallbackArtifacts = ['dwg-fallback.json', 'dxf-conversion.json', 'fallback.dxf'];
2
+ export const drawingArtifacts = [
3
+ 'drawing.pdf',
4
+ 'drawing.png',
5
+ 'print-plan.json',
6
+ 'readback.json',
7
+ 'scene.json',
8
+ 'font-resources.json',
9
+ ];
10
+ export const isDrawingArtifact = (name) => drawingArtifacts.includes(name) || /^font-[a-f0-9]{64}\.(ttf|otf|shx)$/.test(name);
11
+ export function cadErrorRecord(error) {
12
+ const e = error;
13
+ return {
14
+ code: e?.code || 'WORKER_FAILED',
15
+ message: e?.message || String(error),
16
+ detail: e?.detail,
17
+ };
18
+ }
19
+ /** Only source-format/import failures warrant a new representation. Native
20
+ * integrity checks still run from scratch in the conversion worker. */
21
+ export function classifyDwgFailure(code, detail) {
22
+ if (['DWG_CONVERT', 'DWG_MODEL_READ'].includes(code))
23
+ return { eligible: true, category: 'dwg-model-import' };
24
+ if (['BLOCK_EXTENSION', 'UNSUPPORTED_ENTITIES'].includes(code))
25
+ return { eligible: true, category: 'dwg-model-compatibility' };
26
+ if (code === 'DWG_DECODE') {
27
+ const flags = detail?.flags;
28
+ const eligible = Array.isArray(flags) &&
29
+ flags.length > 0 &&
30
+ flags.every((f) => ['NOTYETSUPPORTED', 'UNHANDLEDCLASS', 'INVALIDTYPE'].includes(f));
31
+ return { eligible, category: eligible ? 'dwg-unsupported-class' : 'dwg-integrity' };
32
+ }
33
+ if (['CANCELLED', 'TIMEOUT'].includes(code))
34
+ return { eligible: false, category: 'execution-control' };
35
+ if (/^(RESOURCE|FONT|IMAGE|XREF|PRINT_|STORAGE|INPUT_)/.test(code))
36
+ return { eligible: false, category: 'input-resource-or-print' };
37
+ return { eligible: false, category: 'integrity-or-unclassified' };
38
+ }
@@ -0,0 +1,4 @@
1
+ /** DWG R2000+ does not store DXF 68/69. Preserve native flags and geometry
2
+ * before the pinned converter discards them and synthesizes global numbers. */
3
+ export declare function captureDwgViewports(model: any, lib: any, pointer: number): Map<string, any>;
4
+ export declare function restoreDwgViewports(db: any, values: Map<string, any>): void;
@@ -0,0 +1,56 @@
1
+ import { CadError } from "./contracts.js";
2
+ /** DWG R2000+ does not store DXF 68/69. Preserve native flags and geometry
3
+ * before the pinned converter discards them and synthesizes global numbers. */
4
+ export function captureDwgViewports(model, lib, pointer) {
5
+ const values = new Map();
6
+ for (const e of [
7
+ ...model.entities,
8
+ ...model.tables.BLOCK_RECORD.entries.flatMap((b) => b.entities),
9
+ ]) {
10
+ if (e.type !== 'VIEWPORT')
11
+ continue;
12
+ const tio = lib.dwg_object_to_entity_tio(lib.dwg_resolve_handle(pointer, BigInt('0x' + e.handle)));
13
+ const read = (name) => lib.dwg_dynapi_entity_data(tio, name);
14
+ const count = read('num_frozen_layers');
15
+ if (!Number.isInteger(count) || count < 0 || count > 100000)
16
+ throw new CadError('VIEWPORT_LAYERS', '视口冻结图层数量无效', { handle: e.handle, count });
17
+ const refs = count ? lib.dwg_ptr_to_object_ref_ptr_array(read('frozen_layers'), count) : [];
18
+ const frozenLayerIds = refs.map((r) => lib.dwg_ref_get_id(r));
19
+ if (frozenLayerIds.some((id) => !id))
20
+ throw new CadError('VIEWPORT_LAYERS', '视口冻结图层引用缺失', { handle: e.handle });
21
+ const selfView = Math.abs(e.viewportCenter.x - e.displayCenter.x) < 1e-9 &&
22
+ Math.abs(e.viewportCenter.y - e.displayCenter.y) < 1e-9 &&
23
+ Math.abs(e.height - e.viewHeight) < 1e-9 &&
24
+ Math.abs(e.targetPoint.x) + Math.abs(e.targetPoint.y) + Math.abs(e.targetPoint.z) < 1e-9 &&
25
+ Math.abs(e.viewTwistAngle) < 1e-9;
26
+ values.set(String(e.handle).toUpperCase(), {
27
+ viewDirection: e.viewDirection,
28
+ statusBitFlags: e.statusBitFlags,
29
+ renderMode: e.renderMode,
30
+ shadePlotMode: e.shadePlotMode,
31
+ frozenLayerIds,
32
+ clippingBoundaryId: lib.dwg_ref_get_id(read('clip_boundary')) || '',
33
+ // A self-looking viewport may be a paper system view or a coincident
34
+ // model view. Preserve it as an explicit review case instead of omitting it.
35
+ xdtraceRole: e.statusBitFlags & 131072 ? 'inactive' : selfView ? 'needs-review' : 'model-view',
36
+ xdtraceRoleBasis: 'DWG native flags/geometry; DXF viewport numbers are unsaved',
37
+ });
38
+ }
39
+ return values;
40
+ }
41
+ export function restoreDwgViewports(db, values) {
42
+ for (const [handle, fields] of values) {
43
+ const entity = db.getObjectById(handle);
44
+ if (!entity || entity.dxfTypeName !== 'VIEWPORT')
45
+ throw new CadError('VIEWPORT_SOURCE', 'DWG 视口在模型转换后缺失', { handle });
46
+ Object.assign(entity, fields);
47
+ }
48
+ for (const block of db.tables.blockTable.newIterator()) {
49
+ const layout = db.getObjectById(block.layoutId);
50
+ if (layout)
51
+ layout.xdtraceAuthoredPrint = {
52
+ state: 'unavailable',
53
+ reason: 'DWG 转换器尚未提供原始打印设置;本次打印计划保存独立选定范围、单位及变换',
54
+ };
55
+ }
56
+ }
package/src/dwg.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ /** Native errors are a bitmask, not a single opaque numeric status. */
2
+ export declare function dwgErrorFlags(code: number): string[];
3
+ /** Keep the upstream JS model/converter API; replace only the pinned C/WASM
4
+ * decoder with our reproducible, verified patches. No installed CAD is involved. */
5
+ export declare function createDwgDecoder(): Promise<{
6
+ lib: any;
7
+ manifest: any;
8
+ module: any;
9
+ }>;
10
+ /** dwg_read_data discards the native status. Read it explicitly: partially
11
+ * decoded data must never be certified as a successful input. Caller frees it. */
12
+ export declare function readDwgBytes(lib: any, bytes: ArrayBuffer, module?: any, recover?: boolean): {
13
+ data: number;
14
+ error: number;
15
+ originalError?: number;
16
+ issues?: any[];
17
+ };
18
+ /** Pinned JS converter already has INSERT array fields but never dispatches
19
+ * TYPE_MINSERT. Reuse that path without ever casting the different native
20
+ * MINSERT struct to INSERT (their attribute pointers have different offsets). */
21
+ export declare function convertDwgWithArrays(lib: any, pointer: number, quarantined?: any[]): any;
22
+ /** R14 and earlier have no layer plotflag field. The decoder's zero-filled
23
+ * slot is not an authored no-plot decision; that flag was introduced in R2000. */
24
+ export declare function normalizeDwgLayerPlotFlags(model: any, version: string): void;
25
+ /** The pinned JS converter exposes DWG lineweight enum indices, whereas the
26
+ * data model expects DXF hundredths of a millimetre (and negative sentinels). */
27
+ export declare function normalizeDwgLineweights(model: any): void;