omni-viewer-core 0.1.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 (387) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +80 -0
  3. package/THIRD_PARTY_NOTICES.md +49 -0
  4. package/dist/assets/audio-engine/audio_engine.mjs +2 -0
  5. package/dist/assets/audio-engine/audio_engine.wasm +0 -0
  6. package/dist/assets/pdfjs/pdf.worker.min.mjs +21 -0
  7. package/dist/host/index.d.ts +133 -0
  8. package/dist/host/index.js +10 -0
  9. package/dist/i18n/catalog.en.d.ts +1 -0
  10. package/dist/i18n/catalog.en.js +411 -0
  11. package/dist/i18n/catalog.ko.d.ts +1 -0
  12. package/dist/i18n/catalog.ko.js +68 -0
  13. package/dist/i18n/index.d.ts +18 -0
  14. package/dist/i18n/index.js +41 -0
  15. package/dist/licenses/emscripten.txt +101 -0
  16. package/dist/licenses/kissfft.txt +28 -0
  17. package/dist/licenses/pdfjs-dist.txt +177 -0
  18. package/dist/parsers/a2l/index.d.ts +1 -0
  19. package/dist/parsers/a2l/index.js +1 -0
  20. package/dist/parsers/archive/index.d.ts +22 -0
  21. package/dist/parsers/archive/index.js +46 -0
  22. package/dist/parsers/archive/model.d.ts +29 -0
  23. package/dist/parsers/archive/model.js +1 -0
  24. package/dist/parsers/archive/worker.d.ts +21 -0
  25. package/dist/parsers/archive/worker.js +1 -0
  26. package/dist/parsers/arxml/index.d.ts +1 -0
  27. package/dist/parsers/arxml/index.js +1 -0
  28. package/dist/parsers/asc/index.d.ts +1 -0
  29. package/dist/parsers/asc/index.js +1 -0
  30. package/dist/parsers/audio/index.d.ts +9 -0
  31. package/dist/parsers/audio/index.js +46 -0
  32. package/dist/parsers/automotive/index.d.ts +33 -0
  33. package/dist/parsers/automotive/index.js +973 -0
  34. package/dist/parsers/blf/index.d.ts +1 -0
  35. package/dist/parsers/blf/index.js +1 -0
  36. package/dist/parsers/csv/delimiter.d.ts +31 -0
  37. package/dist/parsers/csv/delimiter.js +151 -0
  38. package/dist/parsers/csv/index.d.ts +30 -0
  39. package/dist/parsers/csv/index.js +108 -0
  40. package/dist/parsers/csv/parseText.d.ts +20 -0
  41. package/dist/parsers/csv/parseText.js +108 -0
  42. package/dist/parsers/csv/sort.d.ts +26 -0
  43. package/dist/parsers/csv/sort.js +224 -0
  44. package/dist/parsers/csv/statistics.d.ts +49 -0
  45. package/dist/parsers/csv/statistics.js +150 -0
  46. package/dist/parsers/dbc/index.d.ts +56 -0
  47. package/dist/parsers/dbc/index.js +94 -0
  48. package/dist/parsers/doc-binary/index.d.ts +35 -0
  49. package/dist/parsers/doc-binary/index.js +267 -0
  50. package/dist/parsers/doc-binary/vscode-parser.d.ts +142 -0
  51. package/dist/parsers/doc-binary/vscode-parser.js +3747 -0
  52. package/dist/parsers/excel/index.d.ts +17 -0
  53. package/dist/parsers/excel/index.js +406 -0
  54. package/dist/parsers/excel/model.d.ts +80 -0
  55. package/dist/parsers/excel/model.js +48 -0
  56. package/dist/parsers/excel/serialize.d.ts +3 -0
  57. package/dist/parsers/excel/serialize.js +78 -0
  58. package/dist/parsers/hdf5/index.d.ts +75 -0
  59. package/dist/parsers/hdf5/index.js +658 -0
  60. package/dist/parsers/hdf5/node.d.ts +21 -0
  61. package/dist/parsers/hdf5/node.js +95 -0
  62. package/dist/parsers/json/index.d.ts +15 -0
  63. package/dist/parsers/json/index.js +102 -0
  64. package/dist/parsers/json/model.d.ts +42 -0
  65. package/dist/parsers/json/model.js +140 -0
  66. package/dist/parsers/json/parse.d.ts +22 -0
  67. package/dist/parsers/json/parse.js +279 -0
  68. package/dist/parsers/json/tokenizer.d.ts +17 -0
  69. package/dist/parsers/json/tokenizer.js +175 -0
  70. package/dist/parsers/jsonl/index.d.ts +14 -0
  71. package/dist/parsers/jsonl/index.js +18 -0
  72. package/dist/parsers/jsonl/model.d.ts +23 -0
  73. package/dist/parsers/jsonl/model.js +1 -0
  74. package/dist/parsers/jsonl/parse.d.ts +7 -0
  75. package/dist/parsers/jsonl/parse.js +34 -0
  76. package/dist/parsers/markdown/index.d.ts +37 -0
  77. package/dist/parsers/markdown/index.js +59 -0
  78. package/dist/parsers/mat/index.d.ts +31 -0
  79. package/dist/parsers/mat/index.js +426 -0
  80. package/dist/parsers/mermaid/index.d.ts +5 -0
  81. package/dist/parsers/mermaid/index.js +3 -0
  82. package/dist/parsers/mf4/index.d.ts +1 -0
  83. package/dist/parsers/mf4/index.js +1 -0
  84. package/dist/parsers/parquet/index.d.ts +21 -0
  85. package/dist/parsers/parquet/index.js +68 -0
  86. package/dist/parsers/pcap/index.d.ts +1 -0
  87. package/dist/parsers/pcap/index.js +1 -0
  88. package/dist/parsers/pcapng/index.d.ts +1 -0
  89. package/dist/parsers/pcapng/index.js +1 -0
  90. package/dist/parsers/plantuml/index.d.ts +5 -0
  91. package/dist/parsers/plantuml/index.js +4 -0
  92. package/dist/parsers/ppt-binary/index.d.ts +5 -0
  93. package/dist/parsers/ppt-binary/index.js +62 -0
  94. package/dist/parsers/ppt-binary/pptBinaryBuildContext.d.ts +12 -0
  95. package/dist/parsers/ppt-binary/pptBinaryBuildContext.js +40 -0
  96. package/dist/parsers/ppt-binary/pptBinaryContainer.d.ts +4 -0
  97. package/dist/parsers/ppt-binary/pptBinaryContainer.js +174 -0
  98. package/dist/parsers/ppt-binary/pptBinaryTypes.d.ts +125 -0
  99. package/dist/parsers/ppt-binary/pptBinaryTypes.js +1 -0
  100. package/dist/parsers/ppt-binary/pptSlideLayouts.d.ts +9 -0
  101. package/dist/parsers/ppt-binary/pptSlideLayouts.js +510 -0
  102. package/dist/parsers/ppt-binary/vscode-parser.d.ts +116 -0
  103. package/dist/parsers/ppt-binary/vscode-parser.js +2853 -0
  104. package/dist/parsers/ppt-binary/vscode.d.ts +4 -0
  105. package/dist/parsers/ppt-binary/vscode.js +12 -0
  106. package/dist/parsers/pptx/index.d.ts +15 -0
  107. package/dist/parsers/pptx/index.js +88 -0
  108. package/dist/parsers/pptx/vscode-parser.d.ts +167 -0
  109. package/dist/parsers/pptx/vscode-parser.js +1503 -0
  110. package/dist/parsers/pptx/vscode.d.ts +4 -0
  111. package/dist/parsers/pptx/vscode.js +18 -0
  112. package/dist/parsers/pptx/zip-reader.d.ts +3 -0
  113. package/dist/parsers/pptx/zip-reader.js +20 -0
  114. package/dist/parsers/proto/index.d.ts +90 -0
  115. package/dist/parsers/proto/index.js +197 -0
  116. package/dist/parsers/psd/index.d.ts +16 -0
  117. package/dist/parsers/psd/index.js +10 -0
  118. package/dist/parsers/shapefile/dbf.d.ts +23 -0
  119. package/dist/parsers/shapefile/dbf.js +112 -0
  120. package/dist/parsers/shapefile/index.d.ts +44 -0
  121. package/dist/parsers/shapefile/index.js +119 -0
  122. package/dist/parsers/shapefile/reproject.d.ts +10 -0
  123. package/dist/parsers/shapefile/reproject.js +41 -0
  124. package/dist/parsers/slide-model.d.ts +106 -0
  125. package/dist/parsers/slide-model.js +1 -0
  126. package/dist/parsers/toml/index.d.ts +15 -0
  127. package/dist/parsers/toml/index.js +18 -0
  128. package/dist/parsers/toml/model.d.ts +15 -0
  129. package/dist/parsers/toml/model.js +1 -0
  130. package/dist/parsers/toml/parse.d.ts +16 -0
  131. package/dist/parsers/toml/parse.js +266 -0
  132. package/dist/parsers/types.d.ts +103 -0
  133. package/dist/parsers/types.js +106 -0
  134. package/dist/parsers/video/index.d.ts +6 -0
  135. package/dist/parsers/video/index.js +2 -0
  136. package/dist/parsers/yaml/index.d.ts +16 -0
  137. package/dist/parsers/yaml/index.js +58 -0
  138. package/dist/parsers/yaml/model.d.ts +22 -0
  139. package/dist/parsers/yaml/model.js +1 -0
  140. package/dist/parsers/yaml/self-loading.d.ts +3 -0
  141. package/dist/parsers/yaml/self-loading.js +19 -0
  142. package/dist/parsers/zip-scan.d.ts +8 -0
  143. package/dist/parsers/zip-scan.js +80 -0
  144. package/dist/registry/container.d.ts +17 -0
  145. package/dist/registry/container.js +49 -0
  146. package/dist/registry/index.d.ts +133 -0
  147. package/dist/registry/index.js +348 -0
  148. package/dist/registry/probe.d.ts +3 -0
  149. package/dist/registry/probe.js +177 -0
  150. package/dist/registry/sniff.d.ts +17 -0
  151. package/dist/registry/sniff.js +57 -0
  152. package/dist/styles/archive.css +10 -0
  153. package/dist/styles/audio.css +66 -0
  154. package/dist/styles/automotive.css +1 -0
  155. package/dist/styles/csv.css +262 -0
  156. package/dist/styles/excel.css +212 -0
  157. package/dist/styles/fallback.css +48 -0
  158. package/dist/styles/hdf5.css +3 -0
  159. package/dist/styles/hwp.css +12 -0
  160. package/dist/styles/image.css +115 -0
  161. package/dist/styles/json.css +342 -0
  162. package/dist/styles/jsonl.css +1 -0
  163. package/dist/styles/markdown.css +10 -0
  164. package/dist/styles/mat.css +2 -0
  165. package/dist/styles/mermaid.css +1 -0
  166. package/dist/styles/parquet.css +2 -0
  167. package/dist/styles/pdf.css +551 -0
  168. package/dist/styles/plantuml.css +1 -0
  169. package/dist/styles/ppt.css +1 -0
  170. package/dist/styles/proto.css +2 -0
  171. package/dist/styles/psd.css +1 -0
  172. package/dist/styles/shapefile.css +25 -0
  173. package/dist/styles/toml.css +1 -0
  174. package/dist/styles/video.css +74 -0
  175. package/dist/styles/word.css +685 -0
  176. package/dist/styles/yaml.css +1 -0
  177. package/dist/viewers/a2l/index.d.ts +15 -0
  178. package/dist/viewers/a2l/index.js +5 -0
  179. package/dist/viewers/archive/archive-preview-decoder.d.ts +4 -0
  180. package/dist/viewers/archive/archive-preview-decoder.js +223 -0
  181. package/dist/viewers/archive/controller.d.ts +24 -0
  182. package/dist/viewers/archive/controller.js +18 -0
  183. package/dist/viewers/archive/index.d.ts +25 -0
  184. package/dist/viewers/archive/index.js +230 -0
  185. package/dist/viewers/archive/preview.d.ts +2 -0
  186. package/dist/viewers/archive/preview.js +2 -0
  187. package/dist/viewers/archive/styles.d.ts +1 -0
  188. package/dist/viewers/archive/styles.js +11 -0
  189. package/dist/viewers/arxml/index.d.ts +15 -0
  190. package/dist/viewers/arxml/index.js +5 -0
  191. package/dist/viewers/asc/index.d.ts +15 -0
  192. package/dist/viewers/asc/index.js +5 -0
  193. package/dist/viewers/audio/controller.d.ts +33 -0
  194. package/dist/viewers/audio/controller.js +49 -0
  195. package/dist/viewers/audio/engine.d.ts +44 -0
  196. package/dist/viewers/audio/engine.js +108 -0
  197. package/dist/viewers/audio/index.d.ts +92 -0
  198. package/dist/viewers/audio/index.js +448 -0
  199. package/dist/viewers/audio/self-loading.d.ts +7 -0
  200. package/dist/viewers/audio/self-loading.js +42 -0
  201. package/dist/viewers/audio/styles.d.ts +1 -0
  202. package/dist/viewers/audio/styles.js +73 -0
  203. package/dist/viewers/automotive/index.d.ts +8 -0
  204. package/dist/viewers/automotive/index.js +152 -0
  205. package/dist/viewers/automotive/styles.d.ts +1 -0
  206. package/dist/viewers/automotive/styles.js +1 -0
  207. package/dist/viewers/avro/index.d.ts +15 -0
  208. package/dist/viewers/avro/index.js +5 -0
  209. package/dist/viewers/bag/index.d.ts +15 -0
  210. package/dist/viewers/bag/index.js +5 -0
  211. package/dist/viewers/blf/index.d.ts +15 -0
  212. package/dist/viewers/blf/index.js +5 -0
  213. package/dist/viewers/csv/controller.d.ts +126 -0
  214. package/dist/viewers/csv/controller.js +598 -0
  215. package/dist/viewers/csv/index.d.ts +48 -0
  216. package/dist/viewers/csv/index.js +846 -0
  217. package/dist/viewers/csv/styles.d.ts +1 -0
  218. package/dist/viewers/csv/styles.js +267 -0
  219. package/dist/viewers/db3/index.d.ts +15 -0
  220. package/dist/viewers/db3/index.js +5 -0
  221. package/dist/viewers/dbc/index.d.ts +15 -0
  222. package/dist/viewers/dbc/index.js +5 -0
  223. package/dist/viewers/diagram.d.ts +14 -0
  224. package/dist/viewers/diagram.js +95 -0
  225. package/dist/viewers/excel/controller.d.ts +108 -0
  226. package/dist/viewers/excel/controller.js +548 -0
  227. package/dist/viewers/excel/grid.d.ts +28 -0
  228. package/dist/viewers/excel/grid.js +99 -0
  229. package/dist/viewers/excel/index.d.ts +37 -0
  230. package/dist/viewers/excel/index.js +620 -0
  231. package/dist/viewers/excel/self-loading.d.ts +6 -0
  232. package/dist/viewers/excel/self-loading.js +13 -0
  233. package/dist/viewers/excel/styles.d.ts +1 -0
  234. package/dist/viewers/excel/styles.js +216 -0
  235. package/dist/viewers/fallback/index.d.ts +17 -0
  236. package/dist/viewers/fallback/index.js +130 -0
  237. package/dist/viewers/fallback/styles.d.ts +1 -0
  238. package/dist/viewers/fallback/styles.js +49 -0
  239. package/dist/viewers/hdf5/index.d.ts +19 -0
  240. package/dist/viewers/hdf5/index.js +170 -0
  241. package/dist/viewers/hdf5/styles.d.ts +1 -0
  242. package/dist/viewers/hdf5/styles.js +4 -0
  243. package/dist/viewers/hwp/controller.d.ts +19 -0
  244. package/dist/viewers/hwp/controller.js +22 -0
  245. package/dist/viewers/hwp/index.d.ts +39 -0
  246. package/dist/viewers/hwp/index.js +271 -0
  247. package/dist/viewers/hwp/self-loading.d.ts +2 -0
  248. package/dist/viewers/hwp/self-loading.js +6 -0
  249. package/dist/viewers/hwp/styles.d.ts +1 -0
  250. package/dist/viewers/hwp/styles.js +13 -0
  251. package/dist/viewers/image/controller.d.ts +210 -0
  252. package/dist/viewers/image/controller.js +336 -0
  253. package/dist/viewers/image/decode.d.ts +54 -0
  254. package/dist/viewers/image/decode.js +150 -0
  255. package/dist/viewers/image/index.d.ts +38 -0
  256. package/dist/viewers/image/index.js +749 -0
  257. package/dist/viewers/image/limits.d.ts +18 -0
  258. package/dist/viewers/image/limits.js +20 -0
  259. package/dist/viewers/image/styles.d.ts +1 -0
  260. package/dist/viewers/image/styles.js +119 -0
  261. package/dist/viewers/json/controller.d.ts +89 -0
  262. package/dist/viewers/json/controller.js +411 -0
  263. package/dist/viewers/json/index.d.ts +25 -0
  264. package/dist/viewers/json/index.js +503 -0
  265. package/dist/viewers/json/styles.d.ts +1 -0
  266. package/dist/viewers/json/styles.js +346 -0
  267. package/dist/viewers/json/transforms.d.ts +27 -0
  268. package/dist/viewers/json/transforms.js +253 -0
  269. package/dist/viewers/jsonl/controller.d.ts +48 -0
  270. package/dist/viewers/jsonl/controller.js +136 -0
  271. package/dist/viewers/jsonl/index.d.ts +22 -0
  272. package/dist/viewers/jsonl/index.js +184 -0
  273. package/dist/viewers/jsonl/styles.d.ts +1 -0
  274. package/dist/viewers/jsonl/styles.js +1 -0
  275. package/dist/viewers/markdown/controller.d.ts +50 -0
  276. package/dist/viewers/markdown/controller.js +62 -0
  277. package/dist/viewers/markdown/index.d.ts +64 -0
  278. package/dist/viewers/markdown/index.js +425 -0
  279. package/dist/viewers/markdown/math.d.ts +21 -0
  280. package/dist/viewers/markdown/math.js +100 -0
  281. package/dist/viewers/markdown/self-loading.d.ts +5 -0
  282. package/dist/viewers/markdown/self-loading.js +48 -0
  283. package/dist/viewers/markdown/styles.d.ts +1 -0
  284. package/dist/viewers/markdown/styles.js +11 -0
  285. package/dist/viewers/mat/index.d.ts +19 -0
  286. package/dist/viewers/mat/index.js +113 -0
  287. package/dist/viewers/mat/styles.d.ts +1 -0
  288. package/dist/viewers/mat/styles.js +3 -0
  289. package/dist/viewers/media.d.ts +9 -0
  290. package/dist/viewers/media.js +77 -0
  291. package/dist/viewers/mermaid/index.d.ts +17 -0
  292. package/dist/viewers/mermaid/index.js +6 -0
  293. package/dist/viewers/mermaid/self-loading.d.ts +2 -0
  294. package/dist/viewers/mermaid/self-loading.js +2 -0
  295. package/dist/viewers/mf4/index.d.ts +15 -0
  296. package/dist/viewers/mf4/index.js +5 -0
  297. package/dist/viewers/parquet/controller.d.ts +37 -0
  298. package/dist/viewers/parquet/controller.js +26 -0
  299. package/dist/viewers/parquet/index.d.ts +23 -0
  300. package/dist/viewers/parquet/index.js +134 -0
  301. package/dist/viewers/parquet/styles.d.ts +1 -0
  302. package/dist/viewers/parquet/styles.js +3 -0
  303. package/dist/viewers/pcap/index.d.ts +15 -0
  304. package/dist/viewers/pcap/index.js +5 -0
  305. package/dist/viewers/pcapng/index.d.ts +15 -0
  306. package/dist/viewers/pcapng/index.js +5 -0
  307. package/dist/viewers/pdf/controller.d.ts +120 -0
  308. package/dist/viewers/pdf/controller.js +191 -0
  309. package/dist/viewers/pdf/editing.d.ts +26 -0
  310. package/dist/viewers/pdf/editing.js +265 -0
  311. package/dist/viewers/pdf/index.d.ts +88 -0
  312. package/dist/viewers/pdf/index.js +1400 -0
  313. package/dist/viewers/pdf/self-loading.d.ts +6 -0
  314. package/dist/viewers/pdf/self-loading.js +14 -0
  315. package/dist/viewers/pdf/styles.d.ts +1 -0
  316. package/dist/viewers/pdf/styles.js +555 -0
  317. package/dist/viewers/plantuml/index.d.ts +17 -0
  318. package/dist/viewers/plantuml/index.js +6 -0
  319. package/dist/viewers/plantuml/self-loading.d.ts +2 -0
  320. package/dist/viewers/plantuml/self-loading.js +2 -0
  321. package/dist/viewers/ppt/chart.d.ts +8 -0
  322. package/dist/viewers/ppt/chart.js +83 -0
  323. package/dist/viewers/ppt/controller.d.ts +34 -0
  324. package/dist/viewers/ppt/controller.js +27 -0
  325. package/dist/viewers/ppt/index.d.ts +33 -0
  326. package/dist/viewers/ppt/index.js +101 -0
  327. package/dist/viewers/ppt/render.d.ts +5 -0
  328. package/dist/viewers/ppt/render.js +144 -0
  329. package/dist/viewers/ppt/self-loading.d.ts +9 -0
  330. package/dist/viewers/ppt/self-loading.js +4 -0
  331. package/dist/viewers/ppt/styles.d.ts +1 -0
  332. package/dist/viewers/ppt/styles.js +1 -0
  333. package/dist/viewers/proto/index.d.ts +17 -0
  334. package/dist/viewers/proto/index.js +170 -0
  335. package/dist/viewers/proto/styles.d.ts +1 -0
  336. package/dist/viewers/proto/styles.js +2 -0
  337. package/dist/viewers/psd/index.d.ts +27 -0
  338. package/dist/viewers/psd/index.js +39 -0
  339. package/dist/viewers/psd/self-loading.d.ts +10 -0
  340. package/dist/viewers/psd/self-loading.js +20 -0
  341. package/dist/viewers/psd/styles.d.ts +1 -0
  342. package/dist/viewers/psd/styles.js +1 -0
  343. package/dist/viewers/reqif/index.d.ts +15 -0
  344. package/dist/viewers/reqif/index.js +5 -0
  345. package/dist/viewers/shapefile/index.d.ts +35 -0
  346. package/dist/viewers/shapefile/index.js +336 -0
  347. package/dist/viewers/shapefile/self-loading.d.ts +7 -0
  348. package/dist/viewers/shapefile/self-loading.js +32 -0
  349. package/dist/viewers/shapefile/styles.d.ts +1 -0
  350. package/dist/viewers/shapefile/styles.js +28 -0
  351. package/dist/viewers/stp/index.d.ts +15 -0
  352. package/dist/viewers/stp/index.js +5 -0
  353. package/dist/viewers/structured-styles.d.ts +1 -0
  354. package/dist/viewers/structured-styles.js +1 -0
  355. package/dist/viewers/structured.d.ts +36 -0
  356. package/dist/viewers/structured.js +138 -0
  357. package/dist/viewers/toml/controller.d.ts +38 -0
  358. package/dist/viewers/toml/controller.js +61 -0
  359. package/dist/viewers/toml/index.d.ts +18 -0
  360. package/dist/viewers/toml/index.js +34 -0
  361. package/dist/viewers/types.d.ts +36 -0
  362. package/dist/viewers/types.js +9 -0
  363. package/dist/viewers/video/controller.d.ts +29 -0
  364. package/dist/viewers/video/controller.js +54 -0
  365. package/dist/viewers/video/index.d.ts +18 -0
  366. package/dist/viewers/video/index.js +305 -0
  367. package/dist/viewers/video/styles.d.ts +1 -0
  368. package/dist/viewers/video/styles.js +79 -0
  369. package/dist/viewers/word/controller.d.ts +19 -0
  370. package/dist/viewers/word/controller.js +22 -0
  371. package/dist/viewers/word/docx-preprocess.d.ts +63 -0
  372. package/dist/viewers/word/docx-preprocess.js +136 -0
  373. package/dist/viewers/word/index.d.ts +32 -0
  374. package/dist/viewers/word/index.js +187 -0
  375. package/dist/viewers/word/normalize-docx.d.ts +2 -0
  376. package/dist/viewers/word/normalize-docx.js +50 -0
  377. package/dist/viewers/word/paginate.d.ts +1 -0
  378. package/dist/viewers/word/paginate.js +1035 -0
  379. package/dist/viewers/word/self-loading.d.ts +2 -0
  380. package/dist/viewers/word/self-loading.js +7 -0
  381. package/dist/viewers/word/styles.d.ts +1 -0
  382. package/dist/viewers/word/styles.js +686 -0
  383. package/dist/viewers/yaml/controller.d.ts +42 -0
  384. package/dist/viewers/yaml/controller.js +41 -0
  385. package/dist/viewers/yaml/index.d.ts +21 -0
  386. package/dist/viewers/yaml/index.js +20 -0
  387. package/package.json +375 -0
@@ -0,0 +1,224 @@
1
+ // CSV column sort. Ported from omni-viewer-chrome `templates/csv/js/csvSort.ts`
2
+ // with the engine/locale-dependent pieces replaced by deterministic
3
+ // equivalents (DESIGN.md §3-① determinism rule, ADR 41):
4
+ //
5
+ // - `Date.parse(...)` (implementation-defined for non-ISO input) is replaced
6
+ // by an explicit ISO-shape parser (`parseDateKey`) that computes the epoch
7
+ // via Date.UTC. Values that don't match the supported shapes make the
8
+ // column non-date.
9
+ // - `localeCompare(..., { numeric: true })` (ICU-dependent collation) is
10
+ // replaced by a code-point natural compare with digit-run chunking.
11
+ // - `toLocaleLowerCase()` is replaced by `toLowerCase()` (Unicode default
12
+ // case conversion — locale-independent per spec).
13
+ //
14
+ // Sort semantics preserved from the original:
15
+ // - Three-state cycle per column: asc -> desc -> none.
16
+ // - Stable: equal pairs keep original order.
17
+ // - Empty ("", whitespace) values sort to the bottom for both directions.
18
+ // - Column-level type detection (number / date / text) so one mixed cell
19
+ // can't flip the ordering rule mid-sort.
20
+ /** Cycle asc -> desc -> none; switching column restarts at asc. */
21
+ export function nextSortState(current, columnIndex) {
22
+ if (current.columnIndex !== columnIndex) {
23
+ return { columnIndex, direction: 'asc' };
24
+ }
25
+ if (current.direction === 'asc') {
26
+ return { columnIndex, direction: 'desc' };
27
+ }
28
+ if (current.direction === 'desc') {
29
+ return { columnIndex: null, direction: null };
30
+ }
31
+ return { columnIndex, direction: 'asc' };
32
+ }
33
+ // Supported deterministic date shapes:
34
+ // YYYY-MM-DD / YYYY/MM/DD, optionally followed by [T or space]
35
+ // hh:mm[:ss[.SSS]] and an optional timezone (Z or ±hh[:]mm).
36
+ // Timezone-less values are interpreted as UTC — deterministic and
37
+ // order-consistent within a column.
38
+ const DATE_RE = /^(\d{4})[-/](\d{2})[-/](\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?)?(Z|[+-]\d{2}:?\d{2})?$/;
39
+ /** Parse a supported date shape to epoch millis; null when not date-shaped. */
40
+ export function parseDateKey(value) {
41
+ const m = DATE_RE.exec(value);
42
+ if (!m)
43
+ return null;
44
+ const year = Number(m[1]);
45
+ const month = Number(m[2]);
46
+ const day = Number(m[3]);
47
+ if (month < 1 || month > 12 || day < 1 || day > 31)
48
+ return null;
49
+ // Date.UTC silently normalizes overflow (2024-02-31 -> Mar 2). Round-trip
50
+ // the calendar date so nonexistent dates stay text, not date keys.
51
+ const calendar = new Date(Date.UTC(year, month - 1, day));
52
+ if (calendar.getUTCFullYear() !== year ||
53
+ calendar.getUTCMonth() !== month - 1 ||
54
+ calendar.getUTCDate() !== day) {
55
+ return null;
56
+ }
57
+ const hour = m[4] !== undefined ? Number(m[4]) : 0;
58
+ const minute = m[5] !== undefined ? Number(m[5]) : 0;
59
+ const second = m[6] !== undefined ? Number(m[6]) : 0;
60
+ const millis = m[7] !== undefined ? Number(m[7].padEnd(3, '0')) : 0;
61
+ if (hour > 23 || minute > 59 || second > 59)
62
+ return null;
63
+ let epoch = Date.UTC(year, month - 1, day, hour, minute, second, millis);
64
+ const tz = m[8];
65
+ if (tz && tz !== 'Z') {
66
+ const sign = tz[0] === '-' ? -1 : 1;
67
+ const digits = tz.slice(1).replace(':', '');
68
+ const offsetHours = Number(digits.slice(0, 2));
69
+ const offsetMins = Number(digits.slice(2, 4));
70
+ // Real-world offsets span -12:00..+14:00; reject syntactic garbage
71
+ // like +99:99 so it stays text instead of poisoning date detection.
72
+ if (offsetMins > 59 || offsetHours > 14 || (offsetHours === 14 && offsetMins > 0)) {
73
+ return null;
74
+ }
75
+ epoch -= sign * (offsetHours * 60 + offsetMins) * 60_000;
76
+ }
77
+ return epoch;
78
+ }
79
+ /**
80
+ * Detect the type of a column from its values. Empty strings are ignored —
81
+ * they sort separately at the end.
82
+ */
83
+ export function detectColumnType(values) {
84
+ let nonEmpty = 0;
85
+ let allNumeric = true;
86
+ let allDate = true;
87
+ for (const raw of values) {
88
+ const v = (raw ?? '').trim();
89
+ if (!v)
90
+ continue;
91
+ nonEmpty++;
92
+ if (allNumeric && !Number.isFinite(Number(v))) {
93
+ allNumeric = false;
94
+ }
95
+ if (allDate && parseDateKey(v) === null) {
96
+ allDate = false;
97
+ }
98
+ if (!allNumeric && !allDate)
99
+ break;
100
+ }
101
+ if (nonEmpty === 0)
102
+ return 'text';
103
+ if (allNumeric)
104
+ return 'number';
105
+ if (allDate)
106
+ return 'date';
107
+ return 'text';
108
+ }
109
+ /**
110
+ * Deterministic natural compare: splits both strings into digit / non-digit
111
+ * runs; digit runs compare numerically ("10" > "9"), other runs compare by
112
+ * code point over the Unicode-default lowercased form.
113
+ */
114
+ export function naturalCompare(a, b) {
115
+ const la = a.toLowerCase();
116
+ const lb = b.toLowerCase();
117
+ let i = 0;
118
+ let j = 0;
119
+ while (i < la.length && j < lb.length) {
120
+ const ca = la.charCodeAt(i);
121
+ const cb = lb.charCodeAt(j);
122
+ const aDigit = ca >= 48 && ca <= 57;
123
+ const bDigit = cb >= 48 && cb <= 57;
124
+ if (aDigit && bDigit) {
125
+ let ia = i;
126
+ while (ia < la.length && isDigitCode(la.charCodeAt(ia)))
127
+ ia++;
128
+ let jb = j;
129
+ while (jb < lb.length && isDigitCode(lb.charCodeAt(jb)))
130
+ jb++;
131
+ // Compare digit runs numerically via zero-trimmed length + lexical.
132
+ const ra = trimLeadingZeros(la.slice(i, ia));
133
+ const rb = trimLeadingZeros(lb.slice(j, jb));
134
+ if (ra.length !== rb.length)
135
+ return ra.length - rb.length;
136
+ if (ra !== rb)
137
+ return ra < rb ? -1 : 1;
138
+ i = ia;
139
+ j = jb;
140
+ continue;
141
+ }
142
+ if (ca !== cb)
143
+ return ca - cb;
144
+ i++;
145
+ j++;
146
+ }
147
+ if (la.length !== lb.length)
148
+ return la.length - i - (lb.length - j);
149
+ // Equal ignoring case: fall back to raw code-point compare for stability.
150
+ if (a < b)
151
+ return -1;
152
+ if (a > b)
153
+ return 1;
154
+ return 0;
155
+ }
156
+ function isDigitCode(code) {
157
+ return code >= 48 && code <= 57;
158
+ }
159
+ function trimLeadingZeros(s) {
160
+ let k = 0;
161
+ while (k < s.length - 1 && s[k] === '0')
162
+ k++;
163
+ return s.slice(k);
164
+ }
165
+ function normalize(raw, type) {
166
+ const v = (raw ?? '').trim();
167
+ if (!v)
168
+ return { isEmpty: true, key: '' };
169
+ if (type === 'number') {
170
+ const n = Number(v);
171
+ return Number.isFinite(n) ? { isEmpty: false, key: n } : { isEmpty: false, key: v };
172
+ }
173
+ if (type === 'date') {
174
+ const ms = parseDateKey(v);
175
+ return ms !== null ? { isEmpty: false, key: ms } : { isEmpty: false, key: v };
176
+ }
177
+ return { isEmpty: false, key: v };
178
+ }
179
+ function compareNormalized(a, b) {
180
+ if (a.isEmpty && b.isEmpty)
181
+ return 0;
182
+ if (a.isEmpty)
183
+ return 1;
184
+ if (b.isEmpty)
185
+ return -1;
186
+ if (typeof a.key === 'number' && typeof b.key === 'number') {
187
+ if (a.key < b.key)
188
+ return -1;
189
+ if (a.key > b.key)
190
+ return 1;
191
+ return 0;
192
+ }
193
+ return naturalCompare(String(a.key), String(b.key));
194
+ }
195
+ /**
196
+ * Produce a sorted copy of `rowIndices` according to `state`. Stable; never
197
+ * mutates the input; empties end up at the bottom in both directions.
198
+ */
199
+ export function applySort(rowIndices, state, getCell, columnType) {
200
+ if (state.columnIndex === null || !state.direction) {
201
+ return [...rowIndices];
202
+ }
203
+ const { columnIndex, direction } = state;
204
+ const dir = direction === 'asc' ? 1 : -1;
205
+ const type = columnType ?? detectColumnType(rowIndices.map((i) => getCell(i, columnIndex)));
206
+ const decorated = rowIndices.map((rowIndex, position) => ({
207
+ rowIndex,
208
+ position,
209
+ norm: normalize(getCell(rowIndex, columnIndex), type)
210
+ }));
211
+ decorated.sort((a, b) => {
212
+ if (a.norm.isEmpty || b.norm.isEmpty) {
213
+ const cmp = compareNormalized(a.norm, b.norm);
214
+ if (cmp !== 0)
215
+ return cmp;
216
+ return a.position - b.position;
217
+ }
218
+ const cmp = compareNormalized(a.norm, b.norm);
219
+ if (cmp !== 0)
220
+ return cmp * dir;
221
+ return a.position - b.position;
222
+ });
223
+ return decorated.map((d) => d.rowIndex);
224
+ }
@@ -0,0 +1,49 @@
1
+ export interface NumericStats {
2
+ count: number;
3
+ mean: number;
4
+ min: number;
5
+ max: number;
6
+ }
7
+ export interface ColumnStats {
8
+ header: string;
9
+ columnIndex: number;
10
+ total: number;
11
+ count: number;
12
+ nullCount: number;
13
+ /** nullCount / total in [0, 1]; 0 when total === 0. */
14
+ nullPercent: number;
15
+ /** Populated only when the column qualifies as numeric. */
16
+ numeric: NumericStats | null;
17
+ }
18
+ export declare function isNullCell(value: string | undefined | null): boolean;
19
+ export declare function parseNumericCell(value: string | undefined | null): number | null;
20
+ export declare function isNumericColumn(values: ReadonlyArray<string | undefined | null>): boolean;
21
+ export declare function computeStatistics(rows: ReadonlyArray<ReadonlyArray<string | undefined | null>>, headers: ReadonlyArray<string>): ColumnStats[];
22
+ /**
23
+ * Serialize rows (and optional header record) to normalized CSV
24
+ * (docs/viewers/csv.md §6 file export): RFC-4180 quoting — a cell is quoted
25
+ * only when it contains the delimiter, a quote, or a line break; `"` doubles
26
+ * to `""`. LF row separators, no BOM. Original quoting style is not preserved.
27
+ */
28
+ export declare function serializeRowsToCsv(rows: ReadonlyArray<ReadonlyArray<string | undefined | null>>, headers: ReadonlyArray<string> | undefined, delimiter: string): string;
29
+ /** RFC-4180-style escaping for a TSV cell (quote when tab/CR/LF/`"` present). */
30
+ export declare function escapeTsvCell(value: string | undefined | null): string;
31
+ /** Serialize rows (and optional header record) to TSV with LF separators. */
32
+ export declare function serializeRowsToTsv(rows: ReadonlyArray<ReadonlyArray<string | undefined | null>>, headers?: ReadonlyArray<string>): string;
33
+ /**
34
+ * Canonical JSON export envelope (docs/viewers/csv.md §6). Headers live in an
35
+ * array, not object keys, so duplicate and empty headers survive verbatim —
36
+ * header-keyed object arrays (and suffix-uniquified variants) are not
37
+ * provided (2026-07-11 decision).
38
+ */
39
+ export declare const CSV_EXPORT_FORMAT = "omni-viewer/csv-export@1";
40
+ export interface CsvExportMetadata {
41
+ scope: 'current-page' | 'loaded-results' | 'full-results';
42
+ sourceRowsLoaded: number;
43
+ sourceFullyScanned: boolean;
44
+ }
45
+ export declare function serializeRowsToJson(rows: ReadonlyArray<ReadonlyArray<string>>, headers: ReadonlyArray<string>, metadata: CsvExportMetadata): string;
46
+ /** Stats-panel number formatting: max 4 fraction digits, no trailing zeros. */
47
+ export declare function formatStatNumber(value: number): string;
48
+ /** Format a 0..1 fraction as a percentage with up to one decimal place. */
49
+ export declare function formatPercent(fraction: number): string;
@@ -0,0 +1,150 @@
1
+ // CSV statistics + TSV/JSON serialization helpers. Ported unchanged (already
2
+ // pure and deterministic) from omni-viewer-chrome
3
+ // `templates/csv/js/csvStatistics.ts`.
4
+ export function isNullCell(value) {
5
+ if (value === undefined || value === null)
6
+ return true;
7
+ return value.trim().length === 0;
8
+ }
9
+ export function parseNumericCell(value) {
10
+ if (isNullCell(value))
11
+ return null;
12
+ const n = Number(value.trim());
13
+ return Number.isFinite(n) ? n : null;
14
+ }
15
+ export function isNumericColumn(values) {
16
+ let nonEmpty = 0;
17
+ for (const v of values) {
18
+ if (isNullCell(v))
19
+ continue;
20
+ nonEmpty++;
21
+ if (parseNumericCell(v) === null)
22
+ return false;
23
+ }
24
+ return nonEmpty > 0;
25
+ }
26
+ export function computeStatistics(rows, headers) {
27
+ const total = rows.length;
28
+ const out = [];
29
+ for (let col = 0; col < headers.length; col++) {
30
+ const header = headers[col] ?? '';
31
+ let nullCount = 0;
32
+ let count = 0;
33
+ const numericValues = [];
34
+ let allNonEmptyNumeric = true;
35
+ for (let r = 0; r < total; r++) {
36
+ const rowArr = rows[r];
37
+ const cell = rowArr ? rowArr[col] : undefined;
38
+ if (isNullCell(cell)) {
39
+ nullCount++;
40
+ continue;
41
+ }
42
+ count++;
43
+ const n = parseNumericCell(cell);
44
+ if (n === null) {
45
+ allNonEmptyNumeric = false;
46
+ }
47
+ else {
48
+ numericValues.push(n);
49
+ }
50
+ }
51
+ const nullPercent = total === 0 ? 0 : nullCount / total;
52
+ let numeric = null;
53
+ if (allNonEmptyNumeric && numericValues.length > 0) {
54
+ let min = numericValues[0];
55
+ let max = numericValues[0];
56
+ let sum = 0;
57
+ for (const v of numericValues) {
58
+ if (v < min)
59
+ min = v;
60
+ if (v > max)
61
+ max = v;
62
+ sum += v;
63
+ }
64
+ numeric = {
65
+ count: numericValues.length,
66
+ mean: sum / numericValues.length,
67
+ min,
68
+ max
69
+ };
70
+ }
71
+ out.push({ header, columnIndex: col, total, count, nullCount, nullPercent, numeric });
72
+ }
73
+ return out;
74
+ }
75
+ /**
76
+ * Serialize rows (and optional header record) to normalized CSV
77
+ * (docs/viewers/csv.md §6 file export): RFC-4180 quoting — a cell is quoted
78
+ * only when it contains the delimiter, a quote, or a line break; `"` doubles
79
+ * to `""`. LF row separators, no BOM. Original quoting style is not preserved.
80
+ */
81
+ export function serializeRowsToCsv(rows, headers, delimiter) {
82
+ const escapeCell = (value) => {
83
+ const v = value == null ? '' : String(value);
84
+ if (v.length === 0)
85
+ return '';
86
+ if (!v.includes(delimiter) && !/[\r\n"]/.test(v))
87
+ return v;
88
+ return '"' + v.replace(/"/g, '""') + '"';
89
+ };
90
+ const lines = [];
91
+ if (headers && headers.length > 0) {
92
+ lines.push(headers.map(escapeCell).join(delimiter));
93
+ }
94
+ for (const row of rows) {
95
+ lines.push(row.map(escapeCell).join(delimiter));
96
+ }
97
+ return lines.join('\n');
98
+ }
99
+ /** RFC-4180-style escaping for a TSV cell (quote when tab/CR/LF/`"` present). */
100
+ export function escapeTsvCell(value) {
101
+ const v = value == null ? '' : String(value);
102
+ if (v.length === 0)
103
+ return '';
104
+ if (!/[\t\r\n"]/.test(v))
105
+ return v;
106
+ return '"' + v.replace(/"/g, '""') + '"';
107
+ }
108
+ /** Serialize rows (and optional header record) to TSV with LF separators. */
109
+ export function serializeRowsToTsv(rows, headers) {
110
+ const lines = [];
111
+ if (headers && headers.length > 0) {
112
+ lines.push(headers.map(escapeTsvCell).join('\t'));
113
+ }
114
+ for (const row of rows) {
115
+ lines.push(row.map(escapeTsvCell).join('\t'));
116
+ }
117
+ return lines.join('\n');
118
+ }
119
+ /**
120
+ * Canonical JSON export envelope (docs/viewers/csv.md §6). Headers live in an
121
+ * array, not object keys, so duplicate and empty headers survive verbatim —
122
+ * header-keyed object arrays (and suffix-uniquified variants) are not
123
+ * provided (2026-07-11 decision).
124
+ */
125
+ export const CSV_EXPORT_FORMAT = 'omni-viewer/csv-export@1';
126
+ export function serializeRowsToJson(rows, headers, metadata) {
127
+ return JSON.stringify({
128
+ format: CSV_EXPORT_FORMAT,
129
+ headers: [...headers],
130
+ rows: rows.map((row) => [...row]),
131
+ metadata
132
+ }, null, 2);
133
+ }
134
+ /** Stats-panel number formatting: max 4 fraction digits, no trailing zeros. */
135
+ export function formatStatNumber(value) {
136
+ if (!Number.isFinite(value))
137
+ return '—';
138
+ if (Number.isInteger(value))
139
+ return String(value);
140
+ return value.toFixed(4).replace(/\.?0+$/, '');
141
+ }
142
+ /** Format a 0..1 fraction as a percentage with up to one decimal place. */
143
+ export function formatPercent(fraction) {
144
+ if (!Number.isFinite(fraction))
145
+ return '—';
146
+ const pct = fraction * 100;
147
+ if (Number.isInteger(pct))
148
+ return `${pct}%`;
149
+ return `${pct.toFixed(1).replace(/\.0$/, '')}%`;
150
+ }
@@ -0,0 +1,56 @@
1
+ export interface DbcSignalValue {
2
+ value: number;
3
+ label: string;
4
+ }
5
+ export interface DbcSignal {
6
+ name: string;
7
+ multiplexer: string | null;
8
+ startBit: number;
9
+ length: number;
10
+ byteOrder: 'little_endian' | 'big_endian';
11
+ valueType: 'unsigned' | 'signed';
12
+ factor: number;
13
+ offset: number;
14
+ minimum: number;
15
+ maximum: number;
16
+ unit: string;
17
+ receivers: string[];
18
+ comment: string | null;
19
+ values: DbcSignalValue[];
20
+ line: number;
21
+ }
22
+ export interface DbcMessage {
23
+ /** Actual 11-bit or 29-bit CAN identifier, without DBC's bit-31 flag. */
24
+ id: number;
25
+ /** Decimal identifier exactly as encoded in the BO_ declaration. */
26
+ encodedId: number;
27
+ idHex: string;
28
+ isExtended: boolean;
29
+ name: string;
30
+ dlc: number;
31
+ transmitter: string;
32
+ comment: string | null;
33
+ signals: DbcSignal[];
34
+ line: number;
35
+ }
36
+ export interface DbcViewerModel {
37
+ version: string;
38
+ busConfiguration: string | null;
39
+ nodes: string[];
40
+ messages: DbcMessage[];
41
+ warnings: string[];
42
+ stats: {
43
+ messageCount: number;
44
+ signalCount: number;
45
+ nodeCount: number;
46
+ extendedMessageCount: number;
47
+ maxDlc: number;
48
+ };
49
+ }
50
+ export interface DbcParseOptions {
51
+ maxBytes?: number;
52
+ maxMessages?: number;
53
+ maxSignals?: number;
54
+ signal?: AbortSignal;
55
+ }
56
+ export declare function parseDbc(input: string | Uint8Array, options?: DbcParseOptions): DbcViewerModel;
@@ -0,0 +1,94 @@
1
+ const DEFAULT_MAX_BYTES = 8 * 1024 * 1024;
2
+ export function parseDbc(input, options = {}) {
3
+ if (options.signal?.aborted)
4
+ throw new Error('aborted');
5
+ const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
6
+ const bytes = typeof input === 'string' ? new TextEncoder().encode(input) : input;
7
+ const truncated = bytes.byteLength > maxBytes;
8
+ const source = new TextDecoder().decode(bytes.subarray(0, maxBytes));
9
+ const maxMessages = options.maxMessages ?? 2_000;
10
+ const maxSignals = options.maxSignals ?? 20_000;
11
+ const model = { version: '', busConfiguration: null, nodes: [], messages: [], warnings: [], stats: { messageCount: 0, signalCount: 0, nodeCount: 0, extendedMessageCount: 0, maxDlc: 0 } };
12
+ const byId = new Map();
13
+ let current;
14
+ let totalMessages = 0;
15
+ let totalSignals = 0;
16
+ for (const [index, line] of source.split(/\r?\n/).entries()) {
17
+ if (options.signal?.aborted)
18
+ throw new Error('aborted');
19
+ const text = line.trim();
20
+ if (!text)
21
+ continue;
22
+ if (text.startsWith('VERSION')) {
23
+ model.version = unquote(text.replace(/^VERSION\s*/, ''));
24
+ continue;
25
+ }
26
+ if (text.startsWith('BS_:')) {
27
+ model.busConfiguration = text.slice(4).trim() || null;
28
+ continue;
29
+ }
30
+ if (text.startsWith('BU_:')) {
31
+ model.nodes = text.slice(4).trim().split(/\s+/).filter(Boolean).slice(0, 10_000);
32
+ continue;
33
+ }
34
+ const message = /^BO_\s+(\d+)\s+([A-Za-z_][\w.]*)\s*:\s*(\d+)\s+(\S+)/.exec(text);
35
+ if (message?.[1] && message[2] && message[3] && message[4]) {
36
+ totalMessages++;
37
+ const encodedId = Number(message[1]);
38
+ const isExtended = (encodedId & 0x80000000) !== 0;
39
+ const id = isExtended ? encodedId & 0x1fffffff : encodedId;
40
+ current = { id, encodedId, idHex: `0x${id.toString(16).toUpperCase()}`, isExtended, name: message[2], dlc: Number(message[3]), transmitter: message[4], comment: null, signals: [], line: index + 1 };
41
+ // DBC comments and value declarations address messages using the
42
+ // encoded BO_ identifier, including the extended-frame flag.
43
+ byId.set(encodedId, current);
44
+ if (model.messages.length < maxMessages)
45
+ model.messages.push(current);
46
+ continue;
47
+ }
48
+ const signal = /^SG_\s+([A-Za-z_][\w.]*)\s*(M|m\d+)?\s*:\s*(\d+)\|(\d+)@([01])([+-])\s+\(([-+.\deE]+),([-+.\deE]+)\)\s+\[([-+.\deE]+)\|([-+.\deE]+)\]\s+"([^"]*)"\s*(.*)$/.exec(text);
49
+ if (signal?.[1]) {
50
+ totalSignals++;
51
+ if (!current) {
52
+ model.warnings.push(`Line ${index + 1}: signal appears before any message.`);
53
+ continue;
54
+ }
55
+ if (totalSignals <= maxSignals && model.messages.includes(current))
56
+ current.signals.push({ name: signal[1], multiplexer: signal[2] ?? null, startBit: Number(signal[3]), length: Number(signal[4]), byteOrder: signal[5] === '1' ? 'little_endian' : 'big_endian', valueType: signal[6] === '+' ? 'unsigned' : 'signed', factor: Number(signal[7]), offset: Number(signal[8]), minimum: Number(signal[9]), maximum: Number(signal[10]), unit: signal[11] ?? '', receivers: (signal[12] ?? '').split(',').map(x => x.trim()).filter(Boolean), comment: null, values: [], line: index + 1 });
57
+ continue;
58
+ }
59
+ let comment = /^CM_\s+BO_\s+(\d+)\s+"((?:[^"\\]|\\.)*)"\s*;/.exec(text);
60
+ if (comment?.[1]) {
61
+ const target = byId.get(Number(comment[1]));
62
+ if (target)
63
+ target.comment = unescapeDbc(comment[2] ?? '');
64
+ continue;
65
+ }
66
+ comment = /^CM_\s+SG_\s+(\d+)\s+([A-Za-z_][\w.]*)\s+"((?:[^"\\]|\\.)*)"\s*;/.exec(text);
67
+ if (comment?.[1]) {
68
+ const target = byId.get(Number(comment[1]))?.signals.find(x => x.name === comment[2]);
69
+ if (target)
70
+ target.comment = unescapeDbc(comment[3] ?? '');
71
+ continue;
72
+ }
73
+ const values = /^VAL_\s+(\d+)\s+([A-Za-z_][\w.]*)\s+(.+);$/.exec(text);
74
+ if (values?.[1]) {
75
+ const target = byId.get(Number(values[1]))?.signals.find(x => x.name === values[2]);
76
+ if (!target)
77
+ continue;
78
+ for (const match of (values[3] ?? '').matchAll(/(-?\d+)\s+"((?:[^"\\]|\\.)*)"/g))
79
+ target.values.push({ value: Number(match[1]), label: unescapeDbc(match[2] ?? '') });
80
+ }
81
+ }
82
+ model.stats = { messageCount: totalMessages, signalCount: totalSignals, nodeCount: model.nodes.length, extendedMessageCount: model.messages.filter(x => x.isExtended).length, maxDlc: model.messages.reduce((n, x) => Math.max(n, x.dlc), 0) };
83
+ if (truncated)
84
+ model.warnings.push(`DBC scan is limited to ${maxBytes.toLocaleString()} bytes.`);
85
+ if (totalMessages > model.messages.length)
86
+ model.warnings.push(`Message preview is limited to ${maxMessages.toLocaleString()} entries.`);
87
+ if (totalSignals > maxSignals)
88
+ model.warnings.push(`Signal preview is limited to ${maxSignals.toLocaleString()} entries.`);
89
+ if (totalMessages === 0)
90
+ model.warnings.push('No DBC BO_ messages were found.');
91
+ return model;
92
+ }
93
+ function unquote(value) { return value.trim().replace(/^"|"$/g, ''); }
94
+ function unescapeDbc(value) { return value.replace(/\\"/g, '"').replace(/\\n/g, '\n').replace(/\\r/g, '\r').replace(/\\\\/g, '\\'); }
@@ -0,0 +1,35 @@
1
+ import type { ParseOutcome } from '../types.js';
2
+ export { DocBinaryParser } from './vscode-parser.js';
3
+ export interface DocTextRun {
4
+ text: string;
5
+ bold?: boolean;
6
+ italic?: boolean;
7
+ underline?: boolean;
8
+ }
9
+ export interface DocParagraph {
10
+ kind: 'paragraph';
11
+ text: string;
12
+ runs: DocTextRun[];
13
+ pageBreakBefore?: boolean;
14
+ }
15
+ export interface DocTable {
16
+ kind: 'table';
17
+ rows: string[][];
18
+ }
19
+ export interface DocImage {
20
+ kind: 'image';
21
+ mimeType: string;
22
+ data: Uint8Array;
23
+ alt: string;
24
+ }
25
+ export type DocBlock = DocParagraph | DocTable | DocImage;
26
+ export interface DocSection {
27
+ blocks: DocBlock[];
28
+ header?: string;
29
+ footer?: string;
30
+ }
31
+ export interface DocBinaryDocument {
32
+ sections: DocSection[];
33
+ text: string;
34
+ }
35
+ export declare function parseDocBinary(input: Uint8Array): ParseOutcome<DocBinaryDocument>;