@graphty/graph-io 0.3.47 → 0.3.49

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 (770) hide show
  1. package/dist/chunks/{approximations-wWjCRzKj.js → approximations-Bzn3L-je.js} +2 -2
  2. package/dist/chunks/{approximations-wWjCRzKj.js.map → approximations-Bzn3L-je.js.map} +1 -1
  3. package/dist/chunks/bends-BGXjv_U4.js +129 -0
  4. package/dist/chunks/bends-BGXjv_U4.js.map +1 -0
  5. package/dist/chunks/{block-DiGq58c3.js → block-iptrlMBb.js} +947 -134
  6. package/dist/chunks/block-iptrlMBb.js.map +1 -0
  7. package/dist/chunks/choose-CczZJaX_.js +717 -0
  8. package/dist/chunks/choose-CczZJaX_.js.map +1 -0
  9. package/dist/chunks/codes-BE2xir2k.js +157 -0
  10. package/dist/chunks/codes-BE2xir2k.js.map +1 -0
  11. package/dist/chunks/{constants-BKwqelYD.js → constants-CKkYLPtt.js} +2 -2
  12. package/dist/chunks/{constants-BKwqelYD.js.map → constants-CKkYLPtt.js.map} +1 -1
  13. package/dist/chunks/context-C3p0RQxR.js +664 -0
  14. package/dist/chunks/context-C3p0RQxR.js.map +1 -0
  15. package/dist/chunks/{convert-BcQ8_jMo.js → convert-Ct2zelbQ.js} +7 -2
  16. package/dist/chunks/convert-Ct2zelbQ.js.map +1 -0
  17. package/dist/chunks/credentials-DXHx7nwR.js +349 -0
  18. package/dist/chunks/credentials-DXHx7nwR.js.map +1 -0
  19. package/dist/chunks/cx-export-Bt6NoqTQ.js +259 -0
  20. package/dist/chunks/cx-export-Bt6NoqTQ.js.map +1 -0
  21. package/dist/chunks/descriptor-B28U25x4.js +60 -0
  22. package/dist/chunks/descriptor-B28U25x4.js.map +1 -0
  23. package/dist/chunks/descriptor-C-YDhtsn.js +48 -0
  24. package/dist/chunks/descriptor-C-YDhtsn.js.map +1 -0
  25. package/dist/chunks/descriptor-DLA5kINx.js +142 -0
  26. package/dist/chunks/descriptor-DLA5kINx.js.map +1 -0
  27. package/dist/chunks/{emit-CwU8cUmG.js → emit-BwHQkZle.js} +1690 -103
  28. package/dist/chunks/emit-BwHQkZle.js.map +1 -0
  29. package/dist/chunks/{escape-CgzxiYPg.js → escape-CuCIzNMB.js} +12 -12
  30. package/dist/chunks/{escape-CgzxiYPg.js.map → escape-CuCIzNMB.js.map} +1 -1
  31. package/dist/chunks/{export-BvqAXCKh.js → export-Cha4dRFz.js} +48 -1780
  32. package/dist/chunks/export-Cha4dRFz.js.map +1 -0
  33. package/dist/chunks/{exporter--Mk9gXCJ.js → exporter-BP6otMO6.js} +6 -4
  34. package/dist/chunks/{exporter--Mk9gXCJ.js.map → exporter-BP6otMO6.js.map} +1 -1
  35. package/dist/chunks/{exporter-CrDWIyiq.js → exporter-D2CETOMK.js} +1222 -154
  36. package/dist/chunks/exporter-D2CETOMK.js.map +1 -0
  37. package/dist/chunks/{exporter-DndFlGSa.js → exporter-D9yMtocA.js} +7 -6
  38. package/dist/chunks/{exporter-DndFlGSa.js.map → exporter-D9yMtocA.js.map} +1 -1
  39. package/dist/chunks/exporter-_jrBTnos.js +1009 -0
  40. package/dist/chunks/exporter-_jrBTnos.js.map +1 -0
  41. package/dist/chunks/{exporter-CJgfhF-l.js → exporter-nDfxIK5D.js} +9 -7
  42. package/dist/chunks/{exporter-CJgfhF-l.js.map → exporter-nDfxIK5D.js.map} +1 -1
  43. package/dist/chunks/format-BXiAb-1h.js +408 -0
  44. package/dist/chunks/format-BXiAb-1h.js.map +1 -0
  45. package/dist/chunks/{generic-Dq1ntt9q.js → generic-ymWCETAJ.js} +387 -31
  46. package/dist/chunks/generic-ymWCETAJ.js.map +1 -0
  47. package/dist/chunks/{importer-CMmeMWlC.js → importer-B92x1xY5.js} +15 -263
  48. package/dist/chunks/importer-B92x1xY5.js.map +1 -0
  49. package/dist/chunks/{importer-DiZRmOQG.js → importer-CT9mJ1nn.js} +328 -90
  50. package/dist/chunks/importer-CT9mJ1nn.js.map +1 -0
  51. package/dist/chunks/{importer-COTK9Tsl.js → importer-DaLTjbds.js} +116 -1099
  52. package/dist/chunks/importer-DaLTjbds.js.map +1 -0
  53. package/dist/chunks/{importer-iFYPEKaJ.js → importer-GREKMdIf.js} +28 -16
  54. package/dist/chunks/importer-GREKMdIf.js.map +1 -0
  55. package/dist/chunks/{importer-BSvfrX_h.js → importer-PqaaKKnY.js} +23 -1016
  56. package/dist/chunks/importer-PqaaKKnY.js.map +1 -0
  57. package/dist/chunks/{importer-yh_aBCU6.js → importer-Vn5QvmmJ.js} +66 -12
  58. package/dist/chunks/importer-Vn5QvmmJ.js.map +1 -0
  59. package/dist/chunks/{importer-e6LGpqHB.js → importer-vRq4h3j5.js} +1470 -354
  60. package/dist/chunks/importer-vRq4h3j5.js.map +1 -0
  61. package/dist/chunks/input-CAxt_aV-.js +1397 -0
  62. package/dist/chunks/input-CAxt_aV-.js.map +1 -0
  63. package/dist/chunks/{json-elements-DJZRZ6jd.js → json-elements-Cq76WjnZ.js} +4 -4
  64. package/dist/chunks/{json-elements-DJZRZ6jd.js.map → json-elements-Cq76WjnZ.js.map} +1 -1
  65. package/dist/chunks/{lexicon-CT69Kd87.js → lexicon-Clf4QIyl.js} +299 -77
  66. package/dist/chunks/lexicon-Clf4QIyl.js.map +1 -0
  67. package/dist/chunks/{ontology-export-G4MqRdux.js → ontology-export-OMo91mb0.js} +4 -3
  68. package/dist/chunks/{ontology-export-G4MqRdux.js.map → ontology-export-OMo91mb0.js.map} +1 -1
  69. package/dist/chunks/{records-CiaWZrFH.js → records-NJiYvekn.js} +2 -2
  70. package/dist/chunks/{records-CiaWZrFH.js.map → records-NJiYvekn.js.map} +1 -1
  71. package/dist/chunks/{format-BpQBx8MZ.js → report-CwMfYa9J.js} +70 -127
  72. package/dist/chunks/report-CwMfYa9J.js.map +1 -0
  73. package/dist/chunks/round-trip-Zm3_ivgq.js +79 -0
  74. package/dist/chunks/round-trip-Zm3_ivgq.js.map +1 -0
  75. package/dist/chunks/sigv4-EokFic1V.js +247 -0
  76. package/dist/chunks/sigv4-EokFic1V.js.map +1 -0
  77. package/dist/chunks/{styles-BQnsga7p.js → styles-CCs214_3.js} +1300 -168
  78. package/dist/chunks/styles-CCs214_3.js.map +1 -0
  79. package/dist/chunks/styles-Cm62yyQX.js +2812 -0
  80. package/dist/chunks/styles-Cm62yyQX.js.map +1 -0
  81. package/dist/chunks/styles-DPQQIig4.js +1928 -0
  82. package/dist/chunks/styles-DPQQIig4.js.map +1 -0
  83. package/dist/chunks/styles-yed-UMFdNqze.js +1213 -0
  84. package/dist/chunks/styles-yed-UMFdNqze.js.map +1 -0
  85. package/dist/chunks/{text-CzJNFOS9.js → text-ystE2bYi.js} +2 -2
  86. package/dist/chunks/{text-CzJNFOS9.js.map → text-ystE2bYi.js.map} +1 -1
  87. package/dist/csv.js +7 -5
  88. package/dist/csv.js.map +1 -1
  89. package/dist/cx.js +5 -4
  90. package/dist/cx.js.map +1 -1
  91. package/dist/cx2.js +2 -2
  92. package/dist/cys.js +1 -1
  93. package/dist/dot.js +5 -4
  94. package/dist/dot.js.map +1 -1
  95. package/dist/gexf.js +42 -10
  96. package/dist/gexf.js.map +1 -1
  97. package/dist/gml.js +850 -193
  98. package/dist/gml.js.map +1 -1
  99. package/dist/graph-io.js +1189 -220
  100. package/dist/graph-io.js.map +1 -1
  101. package/dist/graphml.js +3 -3
  102. package/dist/json.js +3 -2
  103. package/dist/neo4j.js +6 -4
  104. package/dist/neo4j.js.map +1 -1
  105. package/dist/obo.js +1 -1
  106. package/dist/pajek.js +1 -1
  107. package/dist/positions.js +45 -3
  108. package/dist/positions.js.map +1 -1
  109. package/dist/sources-cypher.d.ts +1 -0
  110. package/dist/sources-cypher.js +1351 -0
  111. package/dist/sources-cypher.js.map +1 -0
  112. package/dist/sources-ndex.d.ts +1 -0
  113. package/dist/sources-ndex.js +278 -0
  114. package/dist/sources-ndex.js.map +1 -0
  115. package/dist/sources-rest.d.ts +1 -0
  116. package/dist/sources-rest.js +1377 -0
  117. package/dist/sources-rest.js.map +1 -0
  118. package/dist/sources-sparql.d.ts +1 -0
  119. package/dist/sources-sparql.js +405 -0
  120. package/dist/sources-sparql.js.map +1 -0
  121. package/dist/src/common/report.d.ts +6 -3
  122. package/dist/src/common/report.d.ts.map +1 -1
  123. package/dist/src/common/report.js +15 -9
  124. package/dist/src/common/report.js.map +1 -1
  125. package/dist/src/formats/cx/importer.d.ts.map +1 -1
  126. package/dist/src/formats/cx/importer.js +5 -1
  127. package/dist/src/formats/cx/importer.js.map +1 -1
  128. package/dist/src/formats/cx/styles.d.ts +24 -1
  129. package/dist/src/formats/cx/styles.d.ts.map +1 -1
  130. package/dist/src/formats/cx/styles.js +118 -11
  131. package/dist/src/formats/cx/styles.js.map +1 -1
  132. package/dist/src/formats/cx2/importer.d.ts.map +1 -1
  133. package/dist/src/formats/cx2/importer.js +1 -0
  134. package/dist/src/formats/cx2/importer.js.map +1 -1
  135. package/dist/src/formats/cx2/styles.d.ts.map +1 -1
  136. package/dist/src/formats/cx2/styles.js +3 -1
  137. package/dist/src/formats/cx2/styles.js.map +1 -1
  138. package/dist/src/formats/cys/importer.d.ts.map +1 -1
  139. package/dist/src/formats/cys/importer.js +1 -0
  140. package/dist/src/formats/cys/importer.js.map +1 -1
  141. package/dist/src/formats/cys/styles.d.ts +2 -0
  142. package/dist/src/formats/cys/styles.d.ts.map +1 -1
  143. package/dist/src/formats/cys/styles.js +15 -7
  144. package/dist/src/formats/cys/styles.js.map +1 -1
  145. package/dist/src/formats/dot/drawing.d.ts +98 -0
  146. package/dist/src/formats/dot/drawing.d.ts.map +1 -0
  147. package/dist/src/formats/dot/drawing.js +734 -0
  148. package/dist/src/formats/dot/drawing.js.map +1 -0
  149. package/dist/src/formats/dot/importer.d.ts.map +1 -1
  150. package/dist/src/formats/dot/importer.js +108 -31
  151. package/dist/src/formats/dot/importer.js.map +1 -1
  152. package/dist/src/formats/dot/label-places.d.ts +34 -0
  153. package/dist/src/formats/dot/label-places.d.ts.map +1 -0
  154. package/dist/src/formats/dot/label-places.js +179 -0
  155. package/dist/src/formats/dot/label-places.js.map +1 -0
  156. package/dist/src/formats/dot/record.d.ts +50 -0
  157. package/dist/src/formats/dot/record.d.ts.map +1 -0
  158. package/dist/src/formats/dot/record.js +275 -0
  159. package/dist/src/formats/dot/record.js.map +1 -0
  160. package/dist/src/formats/dot/styles.d.ts +62 -2
  161. package/dist/src/formats/dot/styles.d.ts.map +1 -1
  162. package/dist/src/formats/dot/styles.js +1457 -120
  163. package/dist/src/formats/dot/styles.js.map +1 -1
  164. package/dist/src/formats/gexf/dialog-metrics.d.ts +15 -0
  165. package/dist/src/formats/gexf/dialog-metrics.d.ts.map +1 -0
  166. package/dist/src/formats/gexf/dialog-metrics.js +59 -0
  167. package/dist/src/formats/gexf/dialog-metrics.js.map +1 -0
  168. package/dist/src/formats/gexf/importer.d.ts +7 -0
  169. package/dist/src/formats/gexf/importer.d.ts.map +1 -1
  170. package/dist/src/formats/gexf/importer.js +41 -5
  171. package/dist/src/formats/gexf/importer.js.map +1 -1
  172. package/dist/src/formats/gexf/preview.d.ts +77 -0
  173. package/dist/src/formats/gexf/preview.d.ts.map +1 -0
  174. package/dist/src/formats/gexf/preview.js +191 -0
  175. package/dist/src/formats/gexf/preview.js.map +1 -0
  176. package/dist/src/formats/gexf/schema.d.ts.map +1 -1
  177. package/dist/src/formats/gexf/schema.js +2 -1
  178. package/dist/src/formats/gexf/schema.js.map +1 -1
  179. package/dist/src/formats/gexf/styles.d.ts +60 -16
  180. package/dist/src/formats/gexf/styles.d.ts.map +1 -1
  181. package/dist/src/formats/gexf/styles.js +883 -131
  182. package/dist/src/formats/gexf/styles.js.map +1 -1
  183. package/dist/src/formats/gml/importer.d.ts +5 -2
  184. package/dist/src/formats/gml/importer.d.ts.map +1 -1
  185. package/dist/src/formats/gml/importer.js +258 -71
  186. package/dist/src/formats/gml/importer.js.map +1 -1
  187. package/dist/src/formats/gml/index.d.ts +1 -1
  188. package/dist/src/formats/gml/index.d.ts.map +1 -1
  189. package/dist/src/formats/gml/index.js +1 -1
  190. package/dist/src/formats/gml/index.js.map +1 -1
  191. package/dist/src/formats/gml/positions.d.ts +7 -0
  192. package/dist/src/formats/gml/positions.d.ts.map +1 -1
  193. package/dist/src/formats/gml/positions.js +29 -7
  194. package/dist/src/formats/gml/positions.js.map +1 -1
  195. package/dist/src/formats/gml/styles.d.ts.map +1 -1
  196. package/dist/src/formats/gml/styles.js +756 -103
  197. package/dist/src/formats/gml/styles.js.map +1 -1
  198. package/dist/src/formats/graphml/styles-plain.d.ts.map +1 -1
  199. package/dist/src/formats/graphml/styles-plain.js +8 -12
  200. package/dist/src/formats/graphml/styles-plain.js.map +1 -1
  201. package/dist/src/formats/graphml/styles-yed.d.ts +21 -15
  202. package/dist/src/formats/graphml/styles-yed.d.ts.map +1 -1
  203. package/dist/src/formats/graphml/styles-yed.js +749 -148
  204. package/dist/src/formats/graphml/styles-yed.js.map +1 -1
  205. package/dist/src/formats/graphml/styles-yfiles3.d.ts +1 -1
  206. package/dist/src/formats/graphml/styles-yfiles3.d.ts.map +1 -1
  207. package/dist/src/formats/graphml/styles-yfiles3.js +429 -64
  208. package/dist/src/formats/graphml/styles-yfiles3.js.map +1 -1
  209. package/dist/src/formats/graphml/yfiles.d.ts +3 -3
  210. package/dist/src/formats/graphml/yfiles.d.ts.map +1 -1
  211. package/dist/src/formats/graphml/yfiles.js +16 -6
  212. package/dist/src/formats/graphml/yfiles.js.map +1 -1
  213. package/dist/src/formats/json/dialect.d.ts +3 -2
  214. package/dist/src/formats/json/dialect.d.ts.map +1 -1
  215. package/dist/src/formats/json/dialect.js +39 -5
  216. package/dist/src/formats/json/dialect.js.map +1 -1
  217. package/dist/src/formats/json/importer.d.ts +13 -2
  218. package/dist/src/formats/json/importer.d.ts.map +1 -1
  219. package/dist/src/formats/json/importer.js +42 -6
  220. package/dist/src/formats/json/importer.js.map +1 -1
  221. package/dist/src/formats/json/index.d.ts +1 -1
  222. package/dist/src/formats/json/index.d.ts.map +1 -1
  223. package/dist/src/formats/json/index.js +1 -1
  224. package/dist/src/formats/json/index.js.map +1 -1
  225. package/dist/src/formats/json/positions.d.ts +5 -2
  226. package/dist/src/formats/json/positions.d.ts.map +1 -1
  227. package/dist/src/formats/json/positions.js +20 -4
  228. package/dist/src/formats/json/positions.js.map +1 -1
  229. package/dist/src/formats/json/styles.d.ts +12 -1
  230. package/dist/src/formats/json/styles.d.ts.map +1 -1
  231. package/dist/src/formats/json/styles.js +1755 -136
  232. package/dist/src/formats/json/styles.js.map +1 -1
  233. package/dist/src/formats/pajek/draw.d.ts +96 -0
  234. package/dist/src/formats/pajek/draw.d.ts.map +1 -0
  235. package/dist/src/formats/pajek/draw.js +372 -0
  236. package/dist/src/formats/pajek/draw.js.map +1 -0
  237. package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
  238. package/dist/src/formats/pajek/exporter.js +70 -51
  239. package/dist/src/formats/pajek/exporter.js.map +1 -1
  240. package/dist/src/formats/pajek/importer.d.ts +9 -0
  241. package/dist/src/formats/pajek/importer.d.ts.map +1 -1
  242. package/dist/src/formats/pajek/importer.js +233 -102
  243. package/dist/src/formats/pajek/importer.js.map +1 -1
  244. package/dist/src/formats/pajek/index.d.ts +1 -0
  245. package/dist/src/formats/pajek/index.d.ts.map +1 -1
  246. package/dist/src/formats/pajek/index.js.map +1 -1
  247. package/dist/src/formats/pajek/styles.d.ts +15 -7
  248. package/dist/src/formats/pajek/styles.d.ts.map +1 -1
  249. package/dist/src/formats/pajek/styles.js +1279 -114
  250. package/dist/src/formats/pajek/styles.js.map +1 -1
  251. package/dist/src/formats/pajek/syntax.d.ts +10 -1
  252. package/dist/src/formats/pajek/syntax.d.ts.map +1 -1
  253. package/dist/src/formats/pajek/syntax.js +26 -2
  254. package/dist/src/formats/pajek/syntax.js.map +1 -1
  255. package/dist/src/formats/xgmml/emit.d.ts +1 -0
  256. package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
  257. package/dist/src/formats/xgmml/emit.js +65 -5
  258. package/dist/src/formats/xgmml/emit.js.map +1 -1
  259. package/dist/src/formats/xgmml/styles.d.ts +23 -3
  260. package/dist/src/formats/xgmml/styles.d.ts.map +1 -1
  261. package/dist/src/formats/xgmml/styles.js +278 -60
  262. package/dist/src/formats/xgmml/styles.js.map +1 -1
  263. package/dist/src/index.d.ts +10 -2
  264. package/dist/src/index.d.ts.map +1 -1
  265. package/dist/src/index.js +11 -2
  266. package/dist/src/index.js.map +1 -1
  267. package/dist/src/positions/convert.d.ts.map +1 -1
  268. package/dist/src/positions/convert.js +11 -1
  269. package/dist/src/positions/convert.js.map +1 -1
  270. package/dist/src/positions/extract.d.ts.map +1 -1
  271. package/dist/src/positions/extract.js +53 -1
  272. package/dist/src/positions/extract.js.map +1 -1
  273. package/dist/src/positions/index.d.ts +1 -1
  274. package/dist/src/positions/index.d.ts.map +1 -1
  275. package/dist/src/positions/types.d.ts +59 -0
  276. package/dist/src/positions/types.d.ts.map +1 -1
  277. package/dist/src/registry.d.ts +173 -1
  278. package/dist/src/registry.d.ts.map +1 -1
  279. package/dist/src/registry.js +196 -1
  280. package/dist/src/registry.js.map +1 -1
  281. package/dist/src/sources/builtins.d.ts +11 -0
  282. package/dist/src/sources/builtins.d.ts.map +1 -0
  283. package/dist/src/sources/builtins.js +53 -0
  284. package/dist/src/sources/builtins.js.map +1 -0
  285. package/dist/src/sources/codes.d.ts +230 -0
  286. package/dist/src/sources/codes.d.ts.map +1 -0
  287. package/dist/src/sources/codes.js +58 -0
  288. package/dist/src/sources/codes.js.map +1 -0
  289. package/dist/src/sources/context.d.ts +112 -0
  290. package/dist/src/sources/context.d.ts.map +1 -0
  291. package/dist/src/sources/context.js +740 -0
  292. package/dist/src/sources/context.js.map +1 -0
  293. package/dist/src/sources/credentials.d.ts +179 -0
  294. package/dist/src/sources/credentials.d.ts.map +1 -0
  295. package/dist/src/sources/credentials.js +301 -0
  296. package/dist/src/sources/credentials.js.map +1 -0
  297. package/dist/src/sources/cypher/descriptor.d.ts +21 -0
  298. package/dist/src/sources/cypher/descriptor.d.ts.map +1 -0
  299. package/dist/src/sources/cypher/descriptor.js +124 -0
  300. package/dist/src/sources/cypher/descriptor.js.map +1 -0
  301. package/dist/src/sources/cypher/flatten.d.ts +72 -0
  302. package/dist/src/sources/cypher/flatten.d.ts.map +1 -0
  303. package/dist/src/sources/cypher/flatten.js +279 -0
  304. package/dist/src/sources/cypher/flatten.js.map +1 -0
  305. package/dist/src/sources/cypher/index.d.ts +33 -0
  306. package/dist/src/sources/cypher/index.d.ts.map +1 -0
  307. package/dist/src/sources/cypher/index.js +511 -0
  308. package/dist/src/sources/cypher/index.js.map +1 -0
  309. package/dist/src/sources/cypher/params.d.ts +40 -0
  310. package/dist/src/sources/cypher/params.d.ts.map +1 -0
  311. package/dist/src/sources/cypher/params.js +6 -0
  312. package/dist/src/sources/cypher/params.js.map +1 -0
  313. package/dist/src/sources/cypher/profiles.d.ts +44 -0
  314. package/dist/src/sources/cypher/profiles.d.ts.map +1 -0
  315. package/dist/src/sources/cypher/profiles.js +61 -0
  316. package/dist/src/sources/cypher/profiles.js.map +1 -0
  317. package/dist/src/sources/cypher/query-builder.d.ts +123 -0
  318. package/dist/src/sources/cypher/query-builder.d.ts.map +1 -0
  319. package/dist/src/sources/cypher/query-builder.js +267 -0
  320. package/dist/src/sources/cypher/query-builder.js.map +1 -0
  321. package/dist/src/sources/cypher/transports/bolt.d.ts +21 -0
  322. package/dist/src/sources/cypher/transports/bolt.d.ts.map +1 -0
  323. package/dist/src/sources/cypher/transports/bolt.js +185 -0
  324. package/dist/src/sources/cypher/transports/bolt.js.map +1 -0
  325. package/dist/src/sources/cypher/transports/neptune-analytics.d.ts +15 -0
  326. package/dist/src/sources/cypher/transports/neptune-analytics.d.ts.map +1 -0
  327. package/dist/src/sources/cypher/transports/neptune-analytics.js +38 -0
  328. package/dist/src/sources/cypher/transports/neptune-analytics.js.map +1 -0
  329. package/dist/src/sources/cypher/transports/neptune-https.d.ts +31 -0
  330. package/dist/src/sources/cypher/transports/neptune-https.d.ts.map +1 -0
  331. package/dist/src/sources/cypher/transports/neptune-https.js +104 -0
  332. package/dist/src/sources/cypher/transports/neptune-https.js.map +1 -0
  333. package/dist/src/sources/cypher/transports/query-api.d.ts +14 -0
  334. package/dist/src/sources/cypher/transports/query-api.d.ts.map +1 -0
  335. package/dist/src/sources/cypher/transports/query-api.js +80 -0
  336. package/dist/src/sources/cypher/transports/query-api.js.map +1 -0
  337. package/dist/src/sources/cypher/transports/transport.d.ts +78 -0
  338. package/dist/src/sources/cypher/transports/transport.d.ts.map +1 -0
  339. package/dist/src/sources/cypher/transports/transport.js +77 -0
  340. package/dist/src/sources/cypher/transports/transport.js.map +1 -0
  341. package/dist/src/sources/cypher/types-map.d.ts +91 -0
  342. package/dist/src/sources/cypher/types-map.d.ts.map +1 -0
  343. package/dist/src/sources/cypher/types-map.js +306 -0
  344. package/dist/src/sources/cypher/types-map.js.map +1 -0
  345. package/dist/src/sources/define.d.ts +47 -0
  346. package/dist/src/sources/define.d.ts.map +1 -0
  347. package/dist/src/sources/define.js +173 -0
  348. package/dist/src/sources/define.js.map +1 -0
  349. package/dist/src/sources/fail.d.ts +33 -0
  350. package/dist/src/sources/fail.d.ts.map +1 -0
  351. package/dist/src/sources/fail.js +49 -0
  352. package/dist/src/sources/fail.js.map +1 -0
  353. package/dist/src/sources/ids.d.ts +69 -0
  354. package/dist/src/sources/ids.d.ts.map +1 -0
  355. package/dist/src/sources/ids.js +69 -0
  356. package/dist/src/sources/ids.js.map +1 -0
  357. package/dist/src/sources/ndex/client.d.ts +31 -0
  358. package/dist/src/sources/ndex/client.d.ts.map +1 -0
  359. package/dist/src/sources/ndex/client.js +90 -0
  360. package/dist/src/sources/ndex/client.js.map +1 -0
  361. package/dist/src/sources/ndex/descriptor.d.ts +10 -0
  362. package/dist/src/sources/ndex/descriptor.d.ts.map +1 -0
  363. package/dist/src/sources/ndex/descriptor.js +55 -0
  364. package/dist/src/sources/ndex/descriptor.js.map +1 -0
  365. package/dist/src/sources/ndex/expand.d.ts +20 -0
  366. package/dist/src/sources/ndex/expand.d.ts.map +1 -0
  367. package/dist/src/sources/ndex/expand.js +87 -0
  368. package/dist/src/sources/ndex/expand.js.map +1 -0
  369. package/dist/src/sources/ndex/index.d.ts +25 -0
  370. package/dist/src/sources/ndex/index.d.ts.map +1 -0
  371. package/dist/src/sources/ndex/index.js +191 -0
  372. package/dist/src/sources/ndex/index.js.map +1 -0
  373. package/dist/src/sources/ndex/params.d.ts +17 -0
  374. package/dist/src/sources/ndex/params.d.ts.map +1 -0
  375. package/dist/src/sources/ndex/params.js +6 -0
  376. package/dist/src/sources/ndex/params.js.map +1 -0
  377. package/dist/src/sources/ndex/share-url.d.ts +40 -0
  378. package/dist/src/sources/ndex/share-url.d.ts.map +1 -0
  379. package/dist/src/sources/ndex/share-url.js +64 -0
  380. package/dist/src/sources/ndex/share-url.js.map +1 -0
  381. package/dist/src/sources/params.d.ts +31 -0
  382. package/dist/src/sources/params.d.ts.map +1 -0
  383. package/dist/src/sources/params.js +6 -0
  384. package/dist/src/sources/params.js.map +1 -0
  385. package/dist/src/sources/registry.d.ts +118 -0
  386. package/dist/src/sources/registry.d.ts.map +1 -0
  387. package/dist/src/sources/registry.js +193 -0
  388. package/dist/src/sources/registry.js.map +1 -0
  389. package/dist/src/sources/rest/descriptor.d.ts +16 -0
  390. package/dist/src/sources/rest/descriptor.d.ts.map +1 -0
  391. package/dist/src/sources/rest/descriptor.js +76 -0
  392. package/dist/src/sources/rest/descriptor.js.map +1 -0
  393. package/dist/src/sources/rest/index.d.ts +14 -0
  394. package/dist/src/sources/rest/index.d.ts.map +1 -0
  395. package/dist/src/sources/rest/index.js +13 -0
  396. package/dist/src/sources/rest/index.js.map +1 -0
  397. package/dist/src/sources/rest/mapping.d.ts +30 -0
  398. package/dist/src/sources/rest/mapping.d.ts.map +1 -0
  399. package/dist/src/sources/rest/mapping.js +362 -0
  400. package/dist/src/sources/rest/mapping.js.map +1 -0
  401. package/dist/src/sources/rest/openalex.d.ts +27 -0
  402. package/dist/src/sources/rest/openalex.d.ts.map +1 -0
  403. package/dist/src/sources/rest/openalex.js +269 -0
  404. package/dist/src/sources/rest/openalex.js.map +1 -0
  405. package/dist/src/sources/rest/paging.d.ts +53 -0
  406. package/dist/src/sources/rest/paging.d.ts.map +1 -0
  407. package/dist/src/sources/rest/paging.js +138 -0
  408. package/dist/src/sources/rest/paging.js.map +1 -0
  409. package/dist/src/sources/rest/params.d.ts +216 -0
  410. package/dist/src/sources/rest/params.d.ts.map +1 -0
  411. package/dist/src/sources/rest/params.js +7 -0
  412. package/dist/src/sources/rest/params.js.map +1 -0
  413. package/dist/src/sources/rest/records.d.ts +41 -0
  414. package/dist/src/sources/rest/records.d.ts.map +1 -0
  415. package/dist/src/sources/rest/records.js +240 -0
  416. package/dist/src/sources/rest/records.js.map +1 -0
  417. package/dist/src/sources/rest/samples/deps-dev.d.ts +10 -0
  418. package/dist/src/sources/rest/samples/deps-dev.d.ts.map +1 -0
  419. package/dist/src/sources/rest/samples/deps-dev.js +47 -0
  420. package/dist/src/sources/rest/samples/deps-dev.js.map +1 -0
  421. package/dist/src/sources/rest/samples/string.d.ts +9 -0
  422. package/dist/src/sources/rest/samples/string.d.ts.map +1 -0
  423. package/dist/src/sources/rest/samples/string.js +42 -0
  424. package/dist/src/sources/rest/samples/string.js.map +1 -0
  425. package/dist/src/sources/rest/selectors.d.ts +41 -0
  426. package/dist/src/sources/rest/selectors.d.ts.map +1 -0
  427. package/dist/src/sources/rest/selectors.js +81 -0
  428. package/dist/src/sources/rest/selectors.js.map +1 -0
  429. package/dist/src/sources/rest/source.d.ts +67 -0
  430. package/dist/src/sources/rest/source.d.ts.map +1 -0
  431. package/dist/src/sources/rest/source.js +650 -0
  432. package/dist/src/sources/rest/source.js.map +1 -0
  433. package/dist/src/sources/rest/templates.d.ts +38 -0
  434. package/dist/src/sources/rest/templates.d.ts.map +1 -0
  435. package/dist/src/sources/rest/templates.js +125 -0
  436. package/dist/src/sources/rest/templates.js.map +1 -0
  437. package/dist/src/sources/run.d.ts +93 -0
  438. package/dist/src/sources/run.d.ts.map +1 -0
  439. package/dist/src/sources/run.js +673 -0
  440. package/dist/src/sources/run.js.map +1 -0
  441. package/dist/src/sources/sha256.d.ts +12 -0
  442. package/dist/src/sources/sha256.d.ts.map +1 -0
  443. package/dist/src/sources/sha256.js +95 -0
  444. package/dist/src/sources/sha256.js.map +1 -0
  445. package/dist/src/sources/sigv4.d.ts +26 -0
  446. package/dist/src/sources/sigv4.d.ts.map +1 -0
  447. package/dist/src/sources/sigv4.js +184 -0
  448. package/dist/src/sources/sigv4.js.map +1 -0
  449. package/dist/src/sources/sparql/descriptor.d.ts +10 -0
  450. package/dist/src/sources/sparql/descriptor.d.ts.map +1 -0
  451. package/dist/src/sources/sparql/descriptor.js +64 -0
  452. package/dist/src/sources/sparql/descriptor.js.map +1 -0
  453. package/dist/src/sources/sparql/index.d.ts +28 -0
  454. package/dist/src/sources/sparql/index.d.ts.map +1 -0
  455. package/dist/src/sources/sparql/index.js +314 -0
  456. package/dist/src/sources/sparql/index.js.map +1 -0
  457. package/dist/src/sources/sparql/ntriples.d.ts +69 -0
  458. package/dist/src/sources/sparql/ntriples.d.ts.map +1 -0
  459. package/dist/src/sources/sparql/ntriples.js +180 -0
  460. package/dist/src/sources/sparql/ntriples.js.map +1 -0
  461. package/dist/src/sources/sparql/params.d.ts +27 -0
  462. package/dist/src/sources/sparql/params.d.ts.map +1 -0
  463. package/dist/src/sources/sparql/params.js +5 -0
  464. package/dist/src/sources/sparql/params.js.map +1 -0
  465. package/dist/src/sources/sparql/query.d.ts +72 -0
  466. package/dist/src/sources/sparql/query.d.ts.map +1 -0
  467. package/dist/src/sources/sparql/query.js +113 -0
  468. package/dist/src/sources/sparql/query.js.map +1 -0
  469. package/dist/src/sources/testing.d.ts +96 -0
  470. package/dist/src/sources/testing.d.ts.map +1 -0
  471. package/dist/src/sources/testing.js +138 -0
  472. package/dist/src/sources/testing.js.map +1 -0
  473. package/dist/src/sources/types.d.ts +696 -0
  474. package/dist/src/sources/types.d.ts.map +1 -0
  475. package/dist/src/sources/types.js +10 -0
  476. package/dist/src/sources/types.js.map +1 -0
  477. package/dist/src/styles/annotations.d.ts +61 -5
  478. package/dist/src/styles/annotations.d.ts.map +1 -1
  479. package/dist/src/styles/annotations.js +130 -22
  480. package/dist/src/styles/annotations.js.map +1 -1
  481. package/dist/src/styles/canon/bends.d.ts +46 -0
  482. package/dist/src/styles/canon/bends.d.ts.map +1 -1
  483. package/dist/src/styles/canon/bends.js +123 -0
  484. package/dist/src/styles/canon/bends.js.map +1 -1
  485. package/dist/src/styles/canon/color-tables.d.ts +6 -1
  486. package/dist/src/styles/canon/color-tables.d.ts.map +1 -1
  487. package/dist/src/styles/canon/color-tables.js +10 -4
  488. package/dist/src/styles/canon/color-tables.js.map +1 -1
  489. package/dist/src/styles/canon/color.d.ts +3 -1
  490. package/dist/src/styles/canon/color.d.ts.map +1 -1
  491. package/dist/src/styles/canon/color.js +103 -3
  492. package/dist/src/styles/canon/color.js.map +1 -1
  493. package/dist/src/styles/canon/enums.d.ts +2 -2
  494. package/dist/src/styles/canon/enums.d.ts.map +1 -1
  495. package/dist/src/styles/canon/enums.js +82 -7
  496. package/dist/src/styles/canon/enums.js.map +1 -1
  497. package/dist/src/styles/canon/graphviz.d.ts +12 -3
  498. package/dist/src/styles/canon/graphviz.d.ts.map +1 -1
  499. package/dist/src/styles/canon/graphviz.js +57 -9
  500. package/dist/src/styles/canon/graphviz.js.map +1 -1
  501. package/dist/src/styles/canon/number.d.ts +8 -0
  502. package/dist/src/styles/canon/number.d.ts.map +1 -1
  503. package/dist/src/styles/canon/number.js +18 -0
  504. package/dist/src/styles/canon/number.js.map +1 -1
  505. package/dist/src/styles/canon/text.d.ts +29 -2
  506. package/dist/src/styles/canon/text.d.ts.map +1 -1
  507. package/dist/src/styles/canon/text.js +156 -16
  508. package/dist/src/styles/canon/text.js.map +1 -1
  509. package/dist/src/styles/codes.d.ts +2 -0
  510. package/dist/src/styles/codes.d.ts.map +1 -1
  511. package/dist/src/styles/codes.js +2 -0
  512. package/dist/src/styles/codes.js.map +1 -1
  513. package/dist/src/styles/cyjs/cascade.d.ts.map +1 -1
  514. package/dist/src/styles/cyjs/cascade.js +1037 -35
  515. package/dist/src/styles/cyjs/cascade.js.map +1 -1
  516. package/dist/src/styles/cyjs/defaults-table.d.ts.map +1 -1
  517. package/dist/src/styles/cyjs/defaults-table.js +5 -0
  518. package/dist/src/styles/cyjs/defaults-table.js.map +1 -1
  519. package/dist/src/styles/cyjs/emit.d.ts.map +1 -1
  520. package/dist/src/styles/cyjs/emit.js +216 -12
  521. package/dist/src/styles/cyjs/emit.js.map +1 -1
  522. package/dist/src/styles/cyjs/face.d.ts +20 -0
  523. package/dist/src/styles/cyjs/face.d.ts.map +1 -0
  524. package/dist/src/styles/cyjs/face.js +332 -0
  525. package/dist/src/styles/cyjs/face.js.map +1 -0
  526. package/dist/src/styles/cyjs/mappers.d.ts +48 -2
  527. package/dist/src/styles/cyjs/mappers.d.ts.map +1 -1
  528. package/dist/src/styles/cyjs/mappers.js +463 -26
  529. package/dist/src/styles/cyjs/mappers.js.map +1 -1
  530. package/dist/src/styles/cyjs/routes.d.ts +53 -0
  531. package/dist/src/styles/cyjs/routes.d.ts.map +1 -0
  532. package/dist/src/styles/cyjs/routes.js +360 -0
  533. package/dist/src/styles/cyjs/routes.js.map +1 -0
  534. package/dist/src/styles/cytoscape/charts.d.ts +23 -0
  535. package/dist/src/styles/cytoscape/charts.d.ts.map +1 -0
  536. package/dist/src/styles/cytoscape/charts.js +560 -0
  537. package/dist/src/styles/cytoscape/charts.js.map +1 -0
  538. package/dist/src/styles/cytoscape/emit.d.ts.map +1 -1
  539. package/dist/src/styles/cytoscape/emit.js +204 -44
  540. package/dist/src/styles/cytoscape/emit.js.map +1 -1
  541. package/dist/src/styles/cytoscape/lexicon.d.ts +97 -3
  542. package/dist/src/styles/cytoscape/lexicon.d.ts.map +1 -1
  543. package/dist/src/styles/cytoscape/lexicon.js +413 -79
  544. package/dist/src/styles/cytoscape/lexicon.js.map +1 -1
  545. package/dist/src/styles/cytoscape/mappings.d.ts +30 -0
  546. package/dist/src/styles/cytoscape/mappings.d.ts.map +1 -1
  547. package/dist/src/styles/cytoscape/mappings.js +92 -0
  548. package/dist/src/styles/cytoscape/mappings.js.map +1 -1
  549. package/dist/src/styles/cytoscape/resolve.d.ts +46 -3
  550. package/dist/src/styles/cytoscape/resolve.d.ts.map +1 -1
  551. package/dist/src/styles/cytoscape/resolve.js +632 -22
  552. package/dist/src/styles/cytoscape/resolve.js.map +1 -1
  553. package/dist/src/styles/cytoscape/translate.d.ts.map +1 -1
  554. package/dist/src/styles/cytoscape/translate.js +10 -10
  555. package/dist/src/styles/cytoscape/translate.js.map +1 -1
  556. package/dist/src/styles/defaults.d.ts +50 -0
  557. package/dist/src/styles/defaults.d.ts.map +1 -1
  558. package/dist/src/styles/defaults.js +315 -37
  559. package/dist/src/styles/defaults.js.map +1 -1
  560. package/dist/src/styles/index.d.ts +4 -3
  561. package/dist/src/styles/index.d.ts.map +1 -1
  562. package/dist/src/styles/index.js +3 -2
  563. package/dist/src/styles/index.js.map +1 -1
  564. package/dist/src/styles/internal.d.ts +1 -0
  565. package/dist/src/styles/internal.d.ts.map +1 -1
  566. package/dist/src/styles/internal.js +1 -0
  567. package/dist/src/styles/internal.js.map +1 -1
  568. package/dist/src/styles/io/block.d.ts.map +1 -1
  569. package/dist/src/styles/io/block.js +9 -0
  570. package/dist/src/styles/io/block.js.map +1 -1
  571. package/dist/src/styles/io/generic.d.ts.map +1 -1
  572. package/dist/src/styles/io/generic.js +56 -16
  573. package/dist/src/styles/io/generic.js.map +1 -1
  574. package/dist/src/styles/io/round-trip.d.ts +56 -0
  575. package/dist/src/styles/io/round-trip.d.ts.map +1 -0
  576. package/dist/src/styles/io/round-trip.js +138 -0
  577. package/dist/src/styles/io/round-trip.js.map +1 -0
  578. package/dist/src/styles/io/writer.d.ts.map +1 -1
  579. package/dist/src/styles/io/writer.js +13 -4
  580. package/dist/src/styles/io/writer.js.map +1 -1
  581. package/dist/src/styles/notes.d.ts.map +1 -1
  582. package/dist/src/styles/notes.js +1 -0
  583. package/dist/src/styles/notes.js.map +1 -1
  584. package/dist/src/styles/plan/features.d.ts +1 -1
  585. package/dist/src/styles/plan/features.d.ts.map +1 -1
  586. package/dist/src/styles/plan/features.js +22 -2
  587. package/dist/src/styles/plan/features.js.map +1 -1
  588. package/dist/src/styles/plan/index.d.ts +1 -1
  589. package/dist/src/styles/plan/index.d.ts.map +1 -1
  590. package/dist/src/styles/plan/index.js +1 -1
  591. package/dist/src/styles/plan/index.js.map +1 -1
  592. package/dist/src/styles/plan/plan.d.ts.map +1 -1
  593. package/dist/src/styles/plan/plan.js +61 -4
  594. package/dist/src/styles/plan/plan.js.map +1 -1
  595. package/dist/src/styles/plan/resolve.d.ts +13 -1
  596. package/dist/src/styles/plan/resolve.d.ts.map +1 -1
  597. package/dist/src/styles/plan/resolve.js +53 -6
  598. package/dist/src/styles/plan/resolve.js.map +1 -1
  599. package/dist/src/styles/slots.d.ts +14 -0
  600. package/dist/src/styles/slots.d.ts.map +1 -0
  601. package/dist/src/styles/slots.js +20 -0
  602. package/dist/src/styles/slots.js.map +1 -0
  603. package/dist/src/styles/types.d.ts +638 -5
  604. package/dist/src/styles/types.d.ts.map +1 -1
  605. package/dist/src/styles/vocabulary.d.ts +3 -2
  606. package/dist/src/styles/vocabulary.d.ts.map +1 -1
  607. package/dist/src/styles/vocabulary.js +218 -1
  608. package/dist/src/styles/vocabulary.js.map +1 -1
  609. package/dist/src/types.d.ts +19 -5
  610. package/dist/src/types.d.ts.map +1 -1
  611. package/dist/src/types.js.map +1 -1
  612. package/dist/styles.js +29 -238
  613. package/dist/styles.js.map +1 -1
  614. package/dist/xgmml.js +3 -3
  615. package/docs/samples/people.json +6 -0
  616. package/package.json +53 -8
  617. package/src/common/report.ts +27 -7
  618. package/src/formats/cx/importer.ts +6 -1
  619. package/src/formats/cx/styles.ts +144 -9
  620. package/src/formats/cx2/importer.ts +1 -0
  621. package/src/formats/cx2/styles.ts +3 -1
  622. package/src/formats/cys/importer.ts +1 -0
  623. package/src/formats/cys/styles.ts +27 -5
  624. package/src/formats/dot/drawing.ts +799 -0
  625. package/src/formats/dot/importer.ts +120 -35
  626. package/src/formats/dot/label-places.ts +228 -0
  627. package/src/formats/dot/record.ts +336 -0
  628. package/src/formats/dot/styles.ts +1657 -154
  629. package/src/formats/gexf/dialog-metrics.ts +61 -0
  630. package/src/formats/gexf/importer.ts +50 -5
  631. package/src/formats/gexf/preview.ts +217 -0
  632. package/src/formats/gexf/schema.ts +2 -1
  633. package/src/formats/gexf/styles.ts +1144 -142
  634. package/src/formats/gml/importer.ts +291 -76
  635. package/src/formats/gml/index.ts +1 -1
  636. package/src/formats/gml/positions.ts +29 -7
  637. package/src/formats/gml/styles.ts +854 -111
  638. package/src/formats/graphml/styles-plain.ts +8 -23
  639. package/src/formats/graphml/styles-yed.ts +821 -159
  640. package/src/formats/graphml/styles-yfiles3.ts +485 -63
  641. package/src/formats/graphml/yfiles.ts +19 -6
  642. package/src/formats/json/dialect.ts +41 -5
  643. package/src/formats/json/importer.ts +59 -7
  644. package/src/formats/json/index.ts +1 -0
  645. package/src/formats/json/positions.ts +22 -5
  646. package/src/formats/json/styles.ts +2041 -185
  647. package/src/formats/pajek/draw.ts +458 -0
  648. package/src/formats/pajek/exporter.ts +81 -49
  649. package/src/formats/pajek/importer.ts +278 -103
  650. package/src/formats/pajek/index.ts +1 -0
  651. package/src/formats/pajek/styles.ts +1382 -133
  652. package/src/formats/pajek/syntax.ts +27 -2
  653. package/src/formats/xgmml/emit.ts +73 -5
  654. package/src/formats/xgmml/styles.ts +331 -71
  655. package/src/index.ts +94 -0
  656. package/src/positions/convert.ts +12 -1
  657. package/src/positions/extract.ts +55 -1
  658. package/src/positions/index.ts +1 -0
  659. package/src/positions/types.ts +60 -0
  660. package/src/registry.ts +326 -1
  661. package/src/sources/builtins.ts +63 -0
  662. package/src/sources/codes.ts +235 -0
  663. package/src/sources/context.ts +894 -0
  664. package/src/sources/credentials.ts +409 -0
  665. package/src/sources/cypher/descriptor.ts +131 -0
  666. package/src/sources/cypher/flatten.ts +323 -0
  667. package/src/sources/cypher/index.ts +628 -0
  668. package/src/sources/cypher/params.ts +41 -0
  669. package/src/sources/cypher/profiles.ts +78 -0
  670. package/src/sources/cypher/query-builder.ts +327 -0
  671. package/src/sources/cypher/transports/bolt.ts +228 -0
  672. package/src/sources/cypher/transports/neptune-analytics.ts +41 -0
  673. package/src/sources/cypher/transports/neptune-https.ts +122 -0
  674. package/src/sources/cypher/transports/query-api.ts +100 -0
  675. package/src/sources/cypher/transports/transport.ts +139 -0
  676. package/src/sources/cypher/types-map.ts +418 -0
  677. package/src/sources/define.ts +195 -0
  678. package/src/sources/fail.ts +70 -0
  679. package/src/sources/ids.ts +80 -0
  680. package/src/sources/ndex/client.ts +102 -0
  681. package/src/sources/ndex/descriptor.ts +64 -0
  682. package/src/sources/ndex/expand.ts +100 -0
  683. package/src/sources/ndex/index.ts +235 -0
  684. package/src/sources/ndex/params.ts +17 -0
  685. package/src/sources/ndex/share-url.ts +84 -0
  686. package/src/sources/params.ts +32 -0
  687. package/src/sources/registry.ts +325 -0
  688. package/src/sources/rest/descriptor.ts +79 -0
  689. package/src/sources/rest/index.ts +22 -0
  690. package/src/sources/rest/mapping.ts +401 -0
  691. package/src/sources/rest/openalex.ts +288 -0
  692. package/src/sources/rest/paging.ts +180 -0
  693. package/src/sources/rest/params.ts +243 -0
  694. package/src/sources/rest/records.ts +289 -0
  695. package/src/sources/rest/samples/deps-dev.ts +49 -0
  696. package/src/sources/rest/samples/string.ts +44 -0
  697. package/src/sources/rest/selectors.ts +91 -0
  698. package/src/sources/rest/source.ts +776 -0
  699. package/src/sources/rest/templates.ts +151 -0
  700. package/src/sources/run.ts +793 -0
  701. package/src/sources/sha256.ts +99 -0
  702. package/src/sources/sigv4.ts +209 -0
  703. package/src/sources/sparql/descriptor.ts +67 -0
  704. package/src/sources/sparql/index.ts +356 -0
  705. package/src/sources/sparql/ntriples.ts +219 -0
  706. package/src/sources/sparql/params.ts +28 -0
  707. package/src/sources/sparql/query.ts +162 -0
  708. package/src/sources/testing.ts +210 -0
  709. package/src/sources/types.ts +776 -0
  710. package/src/styles/annotations.ts +201 -27
  711. package/src/styles/canon/bends.ts +137 -0
  712. package/src/styles/canon/color-tables.ts +10 -4
  713. package/src/styles/canon/color.ts +105 -3
  714. package/src/styles/canon/enums.ts +99 -8
  715. package/src/styles/canon/graphviz.ts +71 -10
  716. package/src/styles/canon/number.ts +19 -0
  717. package/src/styles/canon/text.ts +187 -16
  718. package/src/styles/codes.ts +2 -0
  719. package/src/styles/cyjs/cascade.ts +1193 -38
  720. package/src/styles/cyjs/defaults-table.ts +5 -0
  721. package/src/styles/cyjs/emit.ts +247 -16
  722. package/src/styles/cyjs/face.ts +372 -0
  723. package/src/styles/cyjs/mappers.ts +498 -28
  724. package/src/styles/cyjs/routes.ts +432 -0
  725. package/src/styles/cytoscape/charts.ts +684 -0
  726. package/src/styles/cytoscape/emit.ts +220 -44
  727. package/src/styles/cytoscape/lexicon.ts +459 -80
  728. package/src/styles/cytoscape/mappings.ts +108 -0
  729. package/src/styles/cytoscape/resolve.ts +763 -23
  730. package/src/styles/cytoscape/translate.ts +11 -11
  731. package/src/styles/defaults.ts +436 -38
  732. package/src/styles/index.ts +5 -0
  733. package/src/styles/internal.ts +1 -0
  734. package/src/styles/io/block.ts +10 -0
  735. package/src/styles/io/generic.ts +79 -23
  736. package/src/styles/io/round-trip.ts +202 -0
  737. package/src/styles/io/writer.ts +14 -4
  738. package/src/styles/notes.ts +1 -0
  739. package/src/styles/plan/features.ts +23 -2
  740. package/src/styles/plan/index.ts +1 -1
  741. package/src/styles/plan/plan.ts +69 -5
  742. package/src/styles/plan/resolve.ts +61 -6
  743. package/src/styles/slots.ts +25 -0
  744. package/src/styles/types.ts +658 -4
  745. package/src/styles/vocabulary.ts +226 -3
  746. package/src/types.ts +19 -5
  747. package/dist/chunks/block-DiGq58c3.js.map +0 -1
  748. package/dist/chunks/choose--jM0yYCo.js +0 -57
  749. package/dist/chunks/choose--jM0yYCo.js.map +0 -1
  750. package/dist/chunks/convert-BcQ8_jMo.js.map +0 -1
  751. package/dist/chunks/emit-CwU8cUmG.js.map +0 -1
  752. package/dist/chunks/export-BvqAXCKh.js.map +0 -1
  753. package/dist/chunks/exporter-CrDWIyiq.js.map +0 -1
  754. package/dist/chunks/format-BpQBx8MZ.js.map +0 -1
  755. package/dist/chunks/generic-Dq1ntt9q.js.map +0 -1
  756. package/dist/chunks/importer-BSvfrX_h.js.map +0 -1
  757. package/dist/chunks/importer-CMmeMWlC.js.map +0 -1
  758. package/dist/chunks/importer-COTK9Tsl.js.map +0 -1
  759. package/dist/chunks/importer-DiZRmOQG.js.map +0 -1
  760. package/dist/chunks/importer-e6LGpqHB.js.map +0 -1
  761. package/dist/chunks/importer-iFYPEKaJ.js.map +0 -1
  762. package/dist/chunks/importer-yh_aBCU6.js.map +0 -1
  763. package/dist/chunks/lexicon-CT69Kd87.js.map +0 -1
  764. package/dist/chunks/styles-BQnsga7p.js.map +0 -1
  765. package/dist/chunks/styles-D3fRphrO.js +0 -690
  766. package/dist/chunks/styles-D3fRphrO.js.map +0 -1
  767. package/dist/chunks/styles-yed-BF5x3_Y5.js +0 -842
  768. package/dist/chunks/styles-yed-BF5x3_Y5.js.map +0 -1
  769. package/dist/chunks/writer-DMKvthQE.js +0 -448
  770. package/dist/chunks/writer-DMKvthQE.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export-Cha4dRFz.js","sources":["../../src/common/temporal.ts","../../src/common/declared-types.ts","../../src/common/lists.ts","../../src/common/attributes.ts","../../src/common/ids.ts","../../src/common/options.ts","../../src/common/weights.ts","../../src/common/export.ts"],"sourcesContent":["/**\n * Temporal values (design section 5.1): `date` / `dateTime` attributes, GEXF time bounds and Neo4j\n * temporal types become f64 epoch milliseconds (or the raw numeric time when the file's timeformat\n * is integer / double). When a value's canonical re-formatting would differ from the source text (a\n * UTC offset, fractional seconds beyond milliseconds, a date without a time in a dateTime column)\n * the importer also keeps the lexical form in a companion `<column>.text` column with role\n * `timeText`; the exporter emits the text when present and formats the number otherwise.\n *\n * Only ISO-8601 forms are parsed (XSD date / dateTime / time and Neo4j's literals), by a fixed\n * grammar rather than Date.parse, so two hosts agree on every value.\n */\n\nimport { type ColumnDecl, type ColumnRole, GraphFormatError } from \"@graphty/graph-format\";\n\n/**\n * The temporal kinds a declared type can map to; each fixes the parse grammar and the canonical text.\n * @category Plugin helpers\n */\nexport type TemporalKind = \"date\" | \"dateTime\" | \"localDateTime\" | \"time\" | \"localTime\";\n\n/**\n * The GEXF `timeformat` values (design section 5.9).\n * @public\n * @category Plugin helpers\n */\nexport type TimeFormat = \"integer\" | \"double\" | \"date\" | \"dateTime\";\n\n/**\n * A parsed temporal value: the number stored in the column and the source text when it must be kept.\n * @category Plugin helpers\n */\nexport interface TemporalValue {\n /** Epoch milliseconds (date, dateTime, localDateTime), milliseconds since midnight (time, localTime), or the raw number. */\n readonly value: number;\n /** The source text when formatTemporal(value) would not reproduce it; null otherwise. */\n readonly text: string | null;\n}\n\n/**\n * The role of a companion text column.\n * @category Plugin helpers\n */\nexport const TIME_TEXT_ROLE: ColumnRole = \"timeText\";\n\n/**\n * The suffix of a companion text column's name.\n * @category Plugin helpers\n */\nexport const TIME_TEXT_SUFFIX = \".text\";\n\nconst DATE_TIME =\n /^(-?\\d{4,})-(\\d{2})-(\\d{2})(?:[T ](\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d{1,9}))?)?)?(Z|z|[+-]\\d{2}(?::?\\d{2})?)?$/;\nconst TIME = /^(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d{1,9}))?)?(Z|z|[+-]\\d{2}(?::?\\d{2})?)?$/;\nconst NUMERIC = /^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][+-]?\\d+)?$/;\n\nconst MS_PER_MINUTE = 60_000;\nconst MS_PER_DAY = 86_400_000;\n\n/**\n * Parse an ISO-8601 temporal text of one kind.\n * @param text - the source text (already trimmed)\n * @param kind - the temporal kind\n * @returns the value and, when the canonical form differs, the source text; E_COLUMN_TYPE when the text is not of the kind\n * @category Plugin helpers\n */\nexport function parseTemporal(text: string, kind: TemporalKind): TemporalValue {\n let value: number;\n switch (kind) {\n case \"date\":\n case \"dateTime\":\n case \"localDateTime\":\n value = parseDateTime(text, kind);\n break;\n case \"time\":\n case \"localTime\":\n value = parseTime(text, kind);\n break;\n default: {\n const name: string = kind;\n throw new GraphFormatError(\"E_COLUMN_TYPE\", `unknown temporal kind ${name}`, { kind: name });\n }\n }\n const canonical = formatTemporal(value, kind);\n return { value, text: canonical === text ? null : text };\n}\n\n/**\n * Parse a GEXF time bound (`start`, `end`, `timestamp`, a spell or an attvalue time) under the\n * graph's timeformat: integer / double values are numbers as written; date / dateTime values are\n * ISO text; when the format is unknown (absent header) numeric text is a number and anything else\n * is tried as dateTime.\n * @param text - the source text\n * @param timeFormat - the graph's timeformat, or null when the file declares none\n * @returns the value and the source text when it must be kept\n * @category Plugin helpers\n */\nexport function parseTimeText(text: string, timeFormat: TimeFormat | null): TemporalValue {\n const trimmed = text.trim();\n switch (timeFormat) {\n case \"integer\":\n case \"double\":\n return parseNumericTime(trimmed);\n case \"date\":\n return parseTemporal(trimmed, \"date\");\n case \"dateTime\":\n return parseTemporal(trimmed, \"dateTime\");\n case null:\n return NUMERIC.test(trimmed) ? parseNumericTime(trimmed) : parseTemporal(trimmed, \"dateTime\");\n default: {\n const name: string = timeFormat;\n throw new GraphFormatError(\"E_COLUMN_TYPE\", `unknown timeformat ${name}`, { timeFormat: name });\n }\n }\n}\n\n/**\n * Format a temporal value in its canonical ISO-8601 form.\n * @param value - the number as stored\n * @param kind - the temporal kind\n * @returns the canonical text: `YYYY-MM-DD`, `YYYY-MM-DDTHH:MM:SS[.mmm]Z`, `YYYY-MM-DDTHH:MM:SS[.mmm]`,\n * `HH:MM:SS[.mmm]Z` or `HH:MM:SS[.mmm]`\n * @category Plugin helpers\n */\nexport function formatTemporal(value: number, kind: TemporalKind): string {\n switch (kind) {\n case \"date\": {\n const d = new Date(value);\n return `${year(d)}-${pad2(d.getUTCMonth() + 1)}-${pad2(d.getUTCDate())}`;\n }\n case \"dateTime\":\n case \"localDateTime\": {\n const d = new Date(value);\n const date = `${year(d)}-${pad2(d.getUTCMonth() + 1)}-${pad2(d.getUTCDate())}`;\n const time = clock(d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds());\n return kind === \"dateTime\" ? `${date}T${time}Z` : `${date}T${time}`;\n }\n case \"time\":\n case \"localTime\": {\n const ms = ((value % MS_PER_DAY) + MS_PER_DAY) % MS_PER_DAY;\n const h = Math.floor(ms / 3_600_000);\n const m = Math.floor((ms % 3_600_000) / MS_PER_MINUTE);\n const s = Math.floor((ms % MS_PER_MINUTE) / 1000);\n const text = clock(h, m, s, ms % 1000);\n return kind === \"time\" ? `${text}Z` : text;\n }\n default: {\n const name: string = kind;\n throw new GraphFormatError(\"E_COLUMN_TYPE\", `unknown temporal kind ${name}`, { kind: name });\n }\n }\n}\n\n/**\n * Format a GEXF time bound under the graph's timeformat: the number's shortest text for integer /\n * double, the canonical ISO form otherwise.\n * @param value - the value as stored\n * @param timeFormat - the graph's timeformat, or null for a file that declares none (double)\n * @returns the text\n * @category Plugin helpers\n */\nexport function formatTimeValue(value: number, timeFormat: TimeFormat | null): string {\n switch (timeFormat) {\n case \"date\":\n return formatTemporal(value, \"date\");\n case \"dateTime\":\n return formatTemporal(value, \"dateTime\");\n case \"integer\":\n case \"double\":\n case null:\n return String(value);\n default: {\n const name: string = timeFormat;\n throw new GraphFormatError(\"E_COLUMN_TYPE\", `unknown timeformat ${name}`, { timeFormat: name });\n }\n }\n}\n\n/**\n * The declaration of the companion text column of a temporal column (design section 5.1).\n * @param column - the temporal column's name\n * @returns a string column named `<column>.text` with role timeText and `extra.for` naming the column\n * @category Plugin helpers\n */\nexport function timeTextCompanion(column: string): ColumnDecl {\n return {\n name: column + TIME_TEXT_SUFFIX,\n dtype: \"string\",\n role: TIME_TEXT_ROLE,\n nullable: true,\n extra: { for: column },\n };\n}\n\n/**\n * Parse a numeric time bound.\n * @param text - the trimmed source text\n * @returns the number; the text is kept when String(value) differs from it\n */\nfunction parseNumericTime(text: string): TemporalValue {\n if (!NUMERIC.test(text)) {\n throw new GraphFormatError(\"E_COLUMN_TYPE\", `\"${text}\" is not a numeric time`, { value: text });\n }\n const value = Number(text);\n return { value, text: String(value) === text ? null : text };\n}\n\n/**\n * Parse a date or date-time text into epoch milliseconds.\n * @param text - the source text\n * @param kind - date (a time part is accepted and kept in the companion), dateTime or localDateTime\n * @returns epoch milliseconds\n */\nfunction parseDateTime(text: string, kind: \"date\" | \"dateTime\" | \"localDateTime\"): number {\n const m = DATE_TIME.exec(text);\n if (m === null) {\n throw new GraphFormatError(\"E_COLUMN_TYPE\", `\"${text}\" is not an ISO-8601 ${kind}`, { value: text, kind });\n }\n const y = Number(m[1]);\n const month = Number(m[2]);\n const day = Number(m[3]);\n const hour = m[4] === undefined ? 0 : Number(m[4]);\n const minute = m[5] === undefined ? 0 : Number(m[5]);\n const second = m[6] === undefined ? 0 : Number(m[6]);\n const ms = m[7] === undefined ? 0 : fractionMs(m[7]);\n if (month < 1 || month > 12 || day < 1 || day > 31 || hour > 24 || minute > 59 || second > 60) {\n throw new GraphFormatError(\"E_COLUMN_TYPE\", `\"${text}\" is out of range for a ${kind}`, { value: text, kind });\n }\n // Date.UTC maps years 0..99 to 1900..1999; the setters do not\n const d = new Date(0);\n d.setUTCFullYear(y, month - 1, day);\n d.setUTCHours(hour, minute, second, ms);\n if (d.getUTCDate() !== day && hour !== 24) {\n throw new GraphFormatError(\"E_COLUMN_TYPE\", `\"${text}\" is not a calendar date`, { value: text, kind });\n }\n const offset = m[8] === undefined ? 0 : offsetMinutes(m[8]);\n return d.getTime() - offset * MS_PER_MINUTE;\n}\n\n/**\n * Parse a time-of-day text into milliseconds since midnight (UTC for `time` with a zone).\n * @param text - the source text\n * @param kind - time or localTime\n * @returns milliseconds since midnight in 0..86400000\n */\nfunction parseTime(text: string, kind: \"time\" | \"localTime\"): number {\n const m = TIME.exec(text);\n if (m === null) {\n throw new GraphFormatError(\"E_COLUMN_TYPE\", `\"${text}\" is not an ISO-8601 ${kind}`, { value: text, kind });\n }\n const hour = Number(m[1]);\n const minute = Number(m[2]);\n const second = m[3] === undefined ? 0 : Number(m[3]);\n const ms = m[4] === undefined ? 0 : fractionMs(m[4]);\n if (hour > 24 || minute > 59 || second > 60) {\n throw new GraphFormatError(\"E_COLUMN_TYPE\", `\"${text}\" is out of range for a ${kind}`, { value: text, kind });\n }\n const local = ((hour * 60 + minute) * 60 + second) * 1000 + ms;\n const offset = m[5] === undefined ? 0 : offsetMinutes(m[5]);\n const utc = local - offset * MS_PER_MINUTE;\n return ((utc % MS_PER_DAY) + MS_PER_DAY) % MS_PER_DAY;\n}\n\n/**\n * Milliseconds of a fractional-second text (1 to 9 digits), truncated to whole milliseconds.\n * @param digits - the digits after the decimal point\n * @returns 0..999\n */\nfunction fractionMs(digits: string): number {\n return Math.floor(Number(`0.${digits}`) * 1000);\n}\n\n/**\n * The minutes of a zone designator.\n * @param zone - \"Z\", \"+HH:MM\", \"+HHMM\" or \"+HH\"\n * @returns signed minutes east of UTC\n */\nfunction offsetMinutes(zone: string): number {\n if (zone === \"Z\" || zone === \"z\") {\n return 0;\n }\n const sign = zone.startsWith(\"-\") ? -1 : 1;\n const digits = zone.slice(1).replace(\":\", \"\");\n const hours = Number(digits.slice(0, 2));\n const minutes = digits.length > 2 ? Number(digits.slice(2, 4)) : 0;\n return sign * (hours * 60 + minutes);\n}\n\n/**\n * Two-digit zero-padded text.\n * @param n - 0..99\n * @returns the text\n */\nfunction pad2(n: number): string {\n return n < 10 ? `0${n}` : String(n);\n}\n\n/**\n * The year of a UTC date as at least four digits (negative years keep their sign).\n * @param d - the date\n * @returns the text\n */\nfunction year(d: Date): string {\n const y = d.getUTCFullYear();\n const abs = String(Math.abs(y)).padStart(4, \"0\");\n return y < 0 ? `-${abs}` : abs;\n}\n\n/**\n * `HH:MM:SS` with `.mmm` appended when the milliseconds are not zero.\n * @param h - hours\n * @param m - minutes\n * @param s - seconds\n * @param ms - milliseconds\n * @returns the text\n */\nfunction clock(h: number, m: number, s: number, ms: number): string {\n const base = `${pad2(h)}:${pad2(m)}:${pad2(s)}`;\n return ms === 0 ? base : `${base}.${String(ms).padStart(3, \"0\")}`;\n}\n","/**\n * The declared-type table of design section 5.1: what the type text of a GEXF `<attribute>`, a\n * GraphML `<key>`, a GML value class or a Neo4j CSV header maps to, and how a value's text is\n * parsed once the column dtype is known.\n *\n * Declared types map exactly: `double` and `long` -> f64, `float` -> f32, `int` / `integer` /\n * `short` / `byte` -> i32, `boolean` -> bool, `string` / `anyURI` / `char` -> string, `bigdecimal`\n * / `biginteger` -> string, `date` / `dateTime` and the Neo4j temporal types -> f64 (epoch or\n * time-of-day milliseconds, design section 5.1), `list*` and `[]` -> list of the item type, GML\n * `record` and Neo4j `point` -> json. A declared `long` is stored as f64 with a precision flag\n * (values beyond 2^53 are a `precision` issue) unless the importer option `long: \"string\"` keeps the\n * whole column as text. Neo4j `duration` has no epoch and is kept as text. The declared type text is\n * recorded in `origin.type` in every case so the exporter can restore the declaration.\n */\n\nimport { type Dtype, GraphFormatError, type ScalarDtype } from \"@graphty/graph-format\";\n\nimport { withArticle } from \"./plural.js\";\nimport { parseTemporal, type TemporalKind } from \"./temporal.js\";\n\n/**\n * The formats whose declarations this table covers.\n * @category Plugin helpers\n */\nexport type DeclaringFormat = \"gexf\" | \"graphml\" | \"gml\" | \"neo4j\";\n\n/** How the text of one scalar value (or one list item) is parsed. */\ntype ValueKind =\n \"boolean\" | \"integer\" | \"long\" | \"float\" | \"double\" | \"string\" | \"temporal\" | \"duration\" | \"point\" | \"json\";\n\n/**\n * The resolved storage of a declared type.\n * @category Plugin helpers\n */\nexport interface DeclaredTypeSpec {\n /** The declared type text as given by the file (origin.type). */\n readonly declared: string;\n /** The column dtype. */\n readonly dtype: Dtype;\n /** The item dtype of a list column, null otherwise. */\n readonly itemDtype: ScalarDtype | null;\n /** How each scalar value or list item text is parsed. */\n readonly kind: ValueKind;\n /** Whether the column is a list. */\n readonly list: boolean;\n /** The temporal kind of a temporal value, null otherwise. */\n readonly temporal: TemporalKind | null;\n /** Whether values may exceed 2^53 (a long stored as f64), so the importer checks Number.isSafeInteger. */\n readonly precision: boolean;\n}\n\n/** A scalar entry of the table before the list flag and the long mode are applied. */\ninterface ScalarEntry {\n readonly dtype: ScalarDtype;\n readonly kind: ValueKind;\n readonly temporal?: TemporalKind;\n readonly precision?: boolean;\n}\n\nconst BOOLEAN: ScalarEntry = { dtype: \"bool\", kind: \"boolean\" };\nconst INTEGER: ScalarEntry = { dtype: \"i32\", kind: \"integer\" };\nconst LONG: ScalarEntry = { dtype: \"f64\", kind: \"long\", precision: true };\nconst FLOAT: ScalarEntry = { dtype: \"f32\", kind: \"float\" };\nconst DOUBLE: ScalarEntry = { dtype: \"f64\", kind: \"double\" };\nconst STRING: ScalarEntry = { dtype: \"string\", kind: \"string\" };\nconst DATE: ScalarEntry = { dtype: \"f64\", kind: \"temporal\", temporal: \"date\" };\nconst DATE_TIME: ScalarEntry = { dtype: \"f64\", kind: \"temporal\", temporal: \"dateTime\" };\nconst LOCAL_DATE_TIME: ScalarEntry = { dtype: \"f64\", kind: \"temporal\", temporal: \"localDateTime\" };\nconst TIME: ScalarEntry = { dtype: \"f64\", kind: \"temporal\", temporal: \"time\" };\nconst LOCAL_TIME: ScalarEntry = { dtype: \"f64\", kind: \"temporal\", temporal: \"localTime\" };\nconst DURATION: ScalarEntry = { dtype: \"string\", kind: \"duration\" };\nconst POINT: ScalarEntry = { dtype: \"json\", kind: \"point\" };\nconst RECORD: ScalarEntry = { dtype: \"json\", kind: \"json\" };\n\n/** GEXF 1.2 / 1.3 scalar types (the `list*` variants are derived). */\nconst GEXF_SCALARS: Readonly<Record<string, ScalarEntry>> = {\n integer: INTEGER,\n long: LONG,\n double: DOUBLE,\n float: FLOAT,\n boolean: BOOLEAN,\n string: STRING,\n anyuri: STRING,\n char: STRING,\n byte: INTEGER,\n short: INTEGER,\n bigdecimal: STRING,\n biginteger: STRING,\n date: DATE,\n datetime: DATE_TIME,\n};\n\n/** GraphML `attr.type` values. */\nconst GRAPHML_SCALARS: Readonly<Record<string, ScalarEntry>> = {\n boolean: BOOLEAN,\n int: INTEGER,\n long: LONG,\n float: FLOAT,\n double: DOUBLE,\n string: STRING,\n};\n\n/** GML value classes (per value in the file; the GML importer names them per column). */\nconst GML_SCALARS: Readonly<Record<string, ScalarEntry>> = {\n int: INTEGER,\n real: DOUBLE,\n string: STRING,\n record: RECORD,\n};\n\n/** Neo4j CSV header types and Cypher property type names. */\nconst NEO4J_SCALARS: Readonly<Record<string, ScalarEntry>> = {\n int: INTEGER,\n integer: LONG,\n long: LONG,\n float: FLOAT,\n double: DOUBLE,\n boolean: BOOLEAN,\n byte: INTEGER,\n short: INTEGER,\n char: STRING,\n string: STRING,\n point: POINT,\n date: DATE,\n localtime: LOCAL_TIME,\n time: TIME,\n localdatetime: LOCAL_DATE_TIME,\n datetime: DATE_TIME,\n duration: DURATION,\n};\n\nconst TABLES: Readonly<Record<DeclaringFormat, Readonly<Record<string, ScalarEntry>>>> = {\n gexf: GEXF_SCALARS,\n graphml: GRAPHML_SCALARS,\n gml: GML_SCALARS,\n neo4j: NEO4J_SCALARS,\n};\n\nconst INTEGER_TEXT = /^[+-]?\\d+$/;\nconst DECIMAL_TEXT = /^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][+-]?\\d+)?$/;\nconst I32_MIN = -2147483648;\nconst I32_MAX = 2147483647;\n\n/**\n * Resolve a declared type text of one format to its storage.\n * @param format - the declaring format\n * @param type - the type text as written (matched case-insensitively; GEXF `list*` and Neo4j `[]` denote lists)\n * @param long - how declared long / integer-64 columns are stored (the importer option)\n * @returns the spec, or null when the format does not define the type (the importer reports it and keeps the text)\n * @category Plugin helpers\n */\nexport function mapDeclaredType(\n format: DeclaringFormat,\n type: string,\n long: \"f64\" | \"string\",\n): DeclaredTypeSpec | null {\n const table = TABLES[format];\n let key = type.trim().toLowerCase();\n let list = false;\n if (format === \"gexf\" && key.startsWith(\"list\") && key.length > 4) {\n list = true;\n key = key.slice(4);\n } else if (format === \"neo4j\" && key.endsWith(\"[]\")) {\n list = true;\n key = key.slice(0, -2);\n } else if (format === \"gml\" && key === \"list\") {\n return {\n declared: type,\n dtype: \"list\",\n itemDtype: \"json\",\n kind: \"json\",\n list: true,\n temporal: null,\n precision: false,\n };\n }\n let entry = table[key];\n if (entry === undefined) {\n return null;\n }\n if (entry.kind === \"long\" && long === \"string\") {\n entry = STRING;\n }\n return {\n declared: type,\n dtype: list ? \"list\" : entry.dtype,\n itemDtype: list ? entry.dtype : null,\n kind: entry.kind,\n list,\n temporal: entry.temporal ?? null,\n precision: entry.precision ?? false,\n };\n}\n\n/**\n * The spec of an untyped attribute: a string column with the given (or absent) type text.\n * @param declared - the type text to record in origin.type, or null\n * @returns a string spec\n * @category Plugin helpers\n */\nexport function stringSpec(declared: string | null): DeclaredTypeSpec {\n return {\n declared: declared ?? \"\",\n dtype: \"string\",\n itemDtype: null,\n kind: \"string\",\n list: false,\n temporal: null,\n precision: false,\n };\n}\n\n/**\n * Parse the text of one scalar value (or list item) by its kind. Numeric and boolean kinds trim\n * surrounding whitespace (pretty-printed XML puts newlines around `<data>` text); string kinds keep\n * the text exactly.\n * @param text - the value text\n * @param kind - the value kind\n * @param temporal - the temporal kind when `kind` is \"temporal\"\n * @returns a boolean, a number, a string or (point / json) a JSON value; E_COLUMN_TYPE when the text is not of the kind\n * @category Plugin helpers\n */\nexport function parseScalarText(text: string, kind: ValueKind, temporal: TemporalKind | null = null): unknown {\n switch (kind) {\n case \"boolean\": {\n const value = parseBooleanText(text);\n if (value === null) {\n throw typeError(text, kind);\n }\n return value;\n }\n case \"integer\": {\n const trimmed = text.trim();\n if (!INTEGER_TEXT.test(trimmed)) {\n throw typeError(text, kind);\n }\n const value = Number(trimmed);\n if (value < I32_MIN || value > I32_MAX) {\n throw new GraphFormatError(\"E_COLUMN_TYPE\", `\"${trimmed}\" is outside the 32-bit integer range`, {\n value: trimmed,\n kind,\n });\n }\n return value;\n }\n case \"long\": {\n const trimmed = text.trim();\n if (!INTEGER_TEXT.test(trimmed)) {\n throw typeError(text, kind);\n }\n return Number(trimmed);\n }\n case \"float\":\n case \"double\":\n return parseDecimalText(text, kind);\n case \"string\":\n case \"duration\":\n return text;\n case \"temporal\": {\n if (temporal === null) {\n throw new GraphFormatError(\"E_COLUMN_TYPE\", \"a temporal value needs its temporal kind\", { kind });\n }\n return parseTemporal(text.trim(), temporal).value;\n }\n case \"point\":\n return parsePointText(text);\n case \"json\":\n return parseJsonText(text);\n default: {\n const name: string = kind;\n throw new GraphFormatError(\"E_COLUMN_TYPE\", `unknown value kind ${name}`, { kind: name });\n }\n }\n}\n\n/**\n * Parse a boolean text the way the formats write it: `true` / `false` in any case, or `1` / `0`.\n * @param text - the value text\n * @returns the boolean, or null when the text is neither\n * @category Plugin helpers\n */\nexport function parseBooleanText(text: string): boolean | null {\n switch (text.trim().toLowerCase()) {\n case \"true\":\n case \"1\":\n return true;\n case \"false\":\n case \"0\":\n return false;\n default:\n return null;\n }\n}\n\n/**\n * Parse a float / double text: a decimal or exponent literal, or the XSD / JSON spellings of the\n * non-finite values (`INF`, `-INF`, `Infinity`, `-Infinity`, `NaN`).\n * @param text - the value text\n * @param kind - float or double, for the error\n * @returns the number\n * @category Plugin helpers\n */\nexport function parseDecimalText(text: string, kind: ValueKind = \"double\"): number {\n const trimmed = text.trim();\n if (DECIMAL_TEXT.test(trimmed)) {\n return Number(trimmed);\n }\n switch (trimmed) {\n case \"INF\":\n case \"+INF\":\n case \"Infinity\":\n case \"+Infinity\":\n return Infinity;\n case \"-INF\":\n case \"-Infinity\":\n return -Infinity;\n case \"NaN\":\n return Number.NaN;\n default:\n throw typeError(text, kind);\n }\n}\n\n/**\n * Whether a number text is finite as written but too large for a double (`1e400`, a 400-digit\n * integer), so it parses as Infinity: a value the importer should report, unlike `INF`.\n * @param text - the value text\n * @returns true when the text overflows\n * @category Plugin helpers\n */\nexport function overflowsToInfinity(text: string): boolean {\n const trimmed = text.trim();\n return /^[+-]?[0-9.]/.test(trimmed) && Number(trimmed) === (trimmed.startsWith(\"-\") ? -Infinity : Infinity);\n}\n\n/**\n * Parse a Neo4j point literal `{x:1.0, y:2.0, crs:'cartesian'}` (also `latitude` / `longitude` /\n * `height` / `z` / `srid`) into a JSON object; a JSON object text is accepted as well.\n * @param text - the value text\n * @returns an object with numeric coordinates and string crs\n * @category Plugin helpers\n */\nexport function parsePointText(text: string): Readonly<Record<string, number | string>> {\n const trimmed = text.trim();\n if (!trimmed.startsWith(\"{\") || !trimmed.endsWith(\"}\")) {\n throw typeError(text, \"point\");\n }\n const out: Record<string, number | string> = {};\n const inner = trimmed.slice(1, -1).trim();\n if (inner.length === 0) {\n return out;\n }\n for (const part of inner.split(\",\")) {\n const colon = part.indexOf(\":\");\n if (colon < 0) {\n throw typeError(text, \"point\");\n }\n const key = part\n .slice(0, colon)\n .trim()\n .replaceAll(/(?:^[\"'])|(?:[\"']$)/g, \"\");\n const raw = part.slice(colon + 1).trim();\n if (key.length === 0) {\n throw typeError(text, \"point\");\n }\n if (DECIMAL_TEXT.test(raw)) {\n out[key] = Number(raw);\n } else if ((raw.startsWith(\"'\") && raw.endsWith(\"'\")) || (raw.startsWith('\"') && raw.endsWith('\"'))) {\n out[key] = raw.slice(1, -1);\n } else {\n throw typeError(text, \"point\");\n }\n }\n return out;\n}\n\n/**\n * Parse JSON text into a value.\n * @param text - the JSON text\n * @returns the parsed value\n */\nfunction parseJsonText(text: string): unknown {\n try {\n return JSON.parse(text) as unknown;\n } catch {\n throw typeError(text, \"json\");\n }\n}\n\n/**\n * The E_COLUMN_TYPE error of a text that is not of a kind.\n * @param text - the text\n * @param kind - the kind\n * @returns the error\n */\nfunction typeError(text: string, kind: ValueKind): GraphFormatError {\n const shown = text.length > 40 ? `${text.slice(0, 40)}...` : text;\n return new GraphFormatError(\"E_COLUMN_TYPE\", `\"${shown}\" is not ${withArticle(kind)}`, { value: text, kind });\n}\n","/**\n * List value syntaxes of the text formats (design section 5.1, research note 07 section 2.1):\n * GEXF 1.3 bracket lists `[1, 2, 3]` / `[foo, 'bar baz']`, GEXF 1.2 `liststring` values separated\n * by `|`, `,` or `;` (\"an unsafe type\"), Gephi and Neo4j `;`-separated arrays. The importer splits\n * the text into item texts with splitListText() and parses each item by the declared item type.\n */\n\nimport { GraphFormatError } from \"@graphty/graph-format\";\n\n/**\n * The list syntaxes an importer or exporter names.\n * @category Plugin helpers\n */\nexport type ListSyntax = \"gexf\" | \"brackets\" | \"pipe\" | \"comma\" | \"semicolon\";\n\n/**\n * Split a list value into its item texts.\n *\n * - \"gexf\": a bracketed text `[a, b]` is parsed with single or double quotes around items that\n * contain commas; otherwise the 1.2 rule applies: the text is split on `|` when it contains one,\n * else on `,` when it contains one, else on `;` when it contains one, else it is one item.\n * - \"brackets\": bracketed only; an unbracketed text is one item.\n * - \"pipe\" / \"comma\" / \"semicolon\": split on that separator.\n *\n * Items are trimmed; an empty text (or `[]`) is an empty list; an empty item between separators\n * is kept as an empty string.\n * @param text - the value text\n * @param syntax - the syntax\n * @returns the item texts\n * @category Plugin helpers\n */\nexport function splitListText(text: string, syntax: ListSyntax): string[] {\n const trimmed = text.trim();\n if (trimmed.length === 0) {\n return [];\n }\n switch (syntax) {\n case \"gexf\": {\n if (isBracketed(trimmed)) {\n return splitBracketed(trimmed);\n }\n const separator = firstSeparator(trimmed, [\"|\", \",\", \";\"]);\n return separator === null ? [trimmed] : splitOn(trimmed, separator);\n }\n case \"brackets\":\n return isBracketed(trimmed) ? splitBracketed(trimmed) : [trimmed];\n case \"pipe\":\n return splitOn(trimmed, \"|\");\n case \"comma\":\n return splitOn(trimmed, \",\");\n case \"semicolon\":\n return splitOn(trimmed, \";\");\n default: {\n const name: string = syntax;\n throw new GraphFormatError(\"E_UNSUPPORTED\", `unknown list syntax ${name}`, {\n option: \"listSyntax\",\n found: name,\n });\n }\n }\n}\n\n/**\n * Join item texts into a list value of one syntax, the inverse of splitListText() for the exporters.\n * Bracket syntaxes quote an item that contains a comma, a bracket or a quote (with double quotes,\n * a double quote inside doubled); separator syntaxes cannot escape and leave items as they are.\n * @param items - the item texts\n * @param syntax - the syntax; \"gexf\" writes the 1.3 bracket form\n * @returns the list text\n * @category Plugin helpers\n */\nexport function joinListText(items: readonly string[], syntax: ListSyntax): string {\n switch (syntax) {\n case \"gexf\":\n case \"brackets\":\n return `[${items.map(quoteBracketItem).join(\", \")}]`;\n case \"pipe\":\n return items.join(\"|\");\n case \"comma\":\n return items.join(\",\");\n case \"semicolon\":\n return items.join(\";\");\n default: {\n const name: string = syntax;\n throw new GraphFormatError(\"E_UNSUPPORTED\", `unknown list syntax ${name}`, {\n option: \"listSyntax\",\n found: name,\n });\n }\n }\n}\n\n/**\n * Whether a trimmed text is `[...]`.\n * @param text - the trimmed text\n * @returns true when bracketed\n */\nfunction isBracketed(text: string): boolean {\n return text.length >= 2 && text.startsWith(\"[\") && text.endsWith(\"]\");\n}\n\n/**\n * The first of several separators that occurs in a text.\n * @param text - the text\n * @param candidates - separators in priority order\n * @returns the first candidate found, or null\n */\nfunction firstSeparator(text: string, candidates: readonly string[]): string | null {\n for (const candidate of candidates) {\n if (text.includes(candidate)) {\n return candidate;\n }\n }\n return null;\n}\n\n/**\n * Split on a separator and trim every item.\n * @param text - the text\n * @param separator - the separator\n * @returns the trimmed items\n */\nfunction splitOn(text: string, separator: string): string[] {\n return text.split(separator).map((item) => item.trim());\n}\n\n/**\n * Parse the inside of a bracketed list: comma-separated items, each optionally wrapped in single\n * or double quotes (a doubled quote inside a quoted item is one quote).\n * @param text - the bracketed text\n * @returns the items\n */\nfunction splitBracketed(text: string): string[] {\n const inner = text.slice(1, -1);\n const items: string[] = [];\n const n = inner.length;\n if (inner.trim().length === 0) {\n return items;\n }\n let i = 0;\n for (;;) {\n while (i < n && isSpace(inner.charCodeAt(i))) {\n i++;\n }\n let item = \"\";\n if (i < n && (inner[i] === '\"' || inner[i] === \"'\")) {\n const quoted = readQuoted(inner, i);\n item = quoted.text;\n i = quoted.end;\n }\n // unquoted text, or text after a closing quote that is not a separator, runs to the next comma\n let end = inner.indexOf(\",\", i);\n if (end < 0) {\n end = n;\n }\n item += inner.slice(i, end).trim();\n items.push(item);\n i = end;\n if (i >= n) {\n return items;\n }\n i++;\n if (inner.slice(i).trim().length === 0) {\n items.push(\"\");\n return items;\n }\n }\n}\n\n/**\n * Read a quoted item of a bracketed list: a doubled quote inside it is one quote, and a missing\n * closing quote ends it at the end of the text.\n * @param inner - the inside of the brackets\n * @param open - the index of the opening quote\n * @returns the unquoted text and the index just past the closing quote\n */\nfunction readQuoted(inner: string, open: number): { text: string; end: number } {\n const quote = inner[open];\n const n = inner.length;\n let text = \"\";\n let i = open + 1;\n while (i < n) {\n if (inner[i] !== quote) {\n text += inner[i];\n i++;\n } else if (inner[i + 1] === quote) {\n text += quote;\n i += 2;\n } else {\n return { text, end: i + 1 };\n }\n }\n return { text, end: i };\n}\n\n/**\n * Whether a char code is ASCII whitespace.\n * @param c - the char code\n * @returns true for space, tab, CR, LF\n */\nfunction isSpace(c: number): boolean {\n return c === 32 || c === 9 || c === 13 || c === 10;\n}\n\n/**\n * Quote one item for a bracket list when it needs it.\n * @param item - the item text\n * @returns the item, quoted when it contains a comma, a bracket, a quote or surrounding whitespace\n */\nfunction quoteBracketItem(item: string): string {\n if (item.length === 0 || /[,[\\]\"']/.test(item) || item !== item.trim()) {\n return `\"${item.replaceAll('\"', '\"\"')}\"`;\n }\n return item;\n}\n","/**\n * Attribute declaration shared by the typed importers (design sections 5.1, 5.5 and 5.6): turn a\n * GEXF `<attribute>`, a GraphML `<key>` or a Neo4j header column into a ColumnDecl with the right\n * dtype, default, options and origin metadata; parse values (scalars and lists) by the declaration;\n * derive the deterministic `<name>#<origin.id>` name when a declared name collides; and the dict\n * heuristic of design section 5.4.\n *\n * Naming rule (design section 5.6): a column's name is the GEXF `title` / GraphML `attr.name`,\n * falling back to the attribute `id` when the title is absent; `origin.id` always keeps the source\n * id and `origin.title` the title when it differs from the resolved name.\n */\n\nimport {\n type ColumnDecl,\n type ColumnHandle,\n type ColumnRole,\n GraphFormatError,\n type GraphSink,\n INVALID_INDEX,\n} from \"@graphty/graph-format\";\n\nimport { type IssueCategory } from \"../types.js\";\nimport {\n BAD_DEFAULT_CODE,\n BAD_OPTIONS_CODE,\n COLUMN_RENAMED_CODE,\n ROLE_TAKEN_CODE,\n UNKNOWN_ATTR_TYPE_CODE,\n} from \"./codes.js\";\nimport {\n type DeclaredTypeSpec,\n type DeclaringFormat,\n mapDeclaredType,\n parseScalarText,\n stringSpec,\n} from \"./declared-types.js\";\nimport { type ListSyntax, splitListText } from \"./lists.js\";\nimport { type ImportReportBuilder, type IssueLocation } from \"./report.js\";\nimport { parseTemporal, type TemporalValue, timeTextCompanion } from \"./temporal.js\";\n\n/**\n * What an importer knows about a declared attribute.\n * @public\n * @category Plugin helpers\n */\nexport interface AttributeDeclarationInput {\n /** The declaring format. */\n readonly format: DeclaringFormat;\n /** The attribute id (GEXF `id`, GraphML key `id`, Neo4j header name); null when the format has none. */\n readonly id: string | null;\n /** The GEXF `title` / GraphML `attr.name`; null when absent (yFiles keys omit it). */\n readonly title: string | null;\n /** The declared type text; null for an untyped declaration (stored as string). */\n readonly type: string | null;\n /** The declaring namespace (\"viz\", \"yfiles\", \"neo4j\"), or null. */\n readonly namespace?: string | null | undefined;\n /** The `<default>` text, or null. */\n readonly defaultText?: string | null | undefined;\n /** The GEXF `<options>` text, or null. */\n readonly optionsText?: string | null | undefined;\n /** The list syntax of defaults, options and values; \"gexf\" by default. */\n readonly listSyntax?: ListSyntax | undefined;\n /** A role to give the column, or null. */\n readonly role?: ColumnRole | null | undefined;\n /** Whether the attribute is dynamic (GEXF mode=\"dynamic\"). */\n readonly dynamic?: boolean | undefined;\n /** The importer's `long` option. */\n readonly long: \"f64\" | \"string\";\n /** Whether a column name is already taken in the target table; drives the `#id` rename. */\n readonly taken?: ((name: string) => boolean) | undefined;\n}\n\n/**\n * A non-fatal problem with a declaration, for the importer to record as a warning.\n * @public\n * @category Plugin helpers\n */\nexport interface DeclarationIssue {\n /** The issue category. */\n readonly category: IssueCategory;\n /** The stable code. */\n readonly code: string;\n /** A plain-ASCII message. */\n readonly message: string;\n}\n\n/**\n * A declared attribute: the ColumnDecl to push, the spec to parse values with, and what to report.\n * @public\n * @category Plugin helpers\n */\nexport interface DeclaredAttribute {\n /** The declaration for declareNodeColumn / declareEdgeColumn. */\n readonly decl: ColumnDecl;\n /** How values are parsed. */\n readonly spec: DeclaredTypeSpec;\n /** The list syntax values are split with. */\n readonly listSyntax: ListSyntax;\n /** The companion text column of a temporal attribute (design section 5.1), or null. */\n readonly companion: ColumnDecl | null;\n /** Whether the name received the `#id` suffix. */\n readonly renamed: boolean;\n /** Problems the importer records as warnings (unknown type, unparsable default or options). */\n readonly issues: readonly DeclarationIssue[];\n}\n\n/**\n * The declared type is not one the format defines; the column is kept as string.\n * @category Issue and loss codes\n */\nexport const UNKNOWN_TYPE_CODE = UNKNOWN_ATTR_TYPE_CODE;\n/**\n * The column was renamed `<name>#<id>` because the name was taken.\n * @category Issue and loss codes\n */\nexport const RENAMED_CODE = COLUMN_RENAMED_CODE;\n\nexport { BAD_DEFAULT_CODE, BAD_OPTIONS_CODE, PRECISION_CODE, ROLE_TAKEN_CODE } from \"./codes.js\";\n\n/**\n * Rows sampled before the dict heuristic decides (design section 5.4).\n * @category Plugin helpers\n */\nexport const DICT_SAMPLE_ROWS = 1024;\n\n/**\n * Build the column declaration of a declared attribute.\n * @param input - what the file declares\n * @returns the declaration, the value spec and any warnings to record\n * @category Plugin helpers\n */\nexport function declareAttribute(input: AttributeDeclarationInput): DeclaredAttribute {\n const issues: DeclarationIssue[] = [];\n const listSyntax = input.listSyntax ?? \"gexf\";\n let spec = declaredSpec(input, issues);\n const { name, renamed } = resolveName(input);\n if (renamed) {\n issues.push({\n category: \"coercion\",\n code: RENAMED_CODE,\n message: `attribute \"${input.title ?? input.id ?? \"\"}\" renamed to \"${name}\": the name was taken`,\n });\n }\n const decl: ColumnDecl = {\n name,\n dtype: spec.dtype,\n nullable: true,\n origin: {\n format: input.format,\n id: input.id,\n title: input.title !== null && input.title !== name ? input.title : null,\n type: input.type,\n namespace: input.namespace ?? null,\n },\n };\n if (spec.list) {\n decl.itemDtype = spec.itemDtype ?? \"string\";\n }\n if (input.role !== undefined && input.role !== null) {\n decl.role = input.role;\n }\n if (input.dynamic === true) {\n decl.dynamic = true;\n }\n const optionsText = input.optionsText ?? null;\n if (optionsText !== null) {\n spec = declareOptions(decl, spec, optionsText, listSyntax, issues);\n }\n const defaultText = input.defaultText ?? null;\n if (defaultText !== null) {\n try {\n decl.default = parseDeclaredValue(defaultText, spec, listSyntax);\n } catch (err) {\n issues.push({\n category: \"validation-error\",\n code: BAD_DEFAULT_CODE,\n message: `default \"${defaultText}\" of attribute \"${name}\" does not parse as ${spec.declared}: ${messageOf(err)}`,\n });\n }\n }\n const companion = spec.temporal !== null && !spec.list ? timeTextCompanion(name) : null;\n return { decl, spec, listSyntax, companion, renamed, issues };\n}\n\n/**\n * The value spec of a declared type: string for no type, string with UNKNOWN_TYPE_CODE for a type\n * the format does not define.\n * @param input - what the file declares\n * @param issues - receives the unknown-type warning\n * @returns the spec\n */\nfunction declaredSpec(input: AttributeDeclarationInput, issues: DeclarationIssue[]): DeclaredTypeSpec {\n if (input.type === null) {\n return stringSpec(null);\n }\n const mapped = mapDeclaredType(input.format, input.type, input.long);\n if (mapped !== null) {\n return mapped;\n }\n issues.push({\n category: \"unsupported\",\n code: UNKNOWN_TYPE_CODE,\n message: `${input.format} type \"${input.type}\" is not supported; values kept as text`,\n });\n return stringSpec(input.type);\n}\n\n/**\n * Put the parsed options of an attribute on its declaration; a plain string attribute whose\n * options are all strings becomes a dict column.\n * @param decl - the declaration to complete\n * @param spec - the value spec\n * @param optionsText - the options text\n * @param listSyntax - the list syntax the options are split with\n * @param issues - receives BAD_OPTIONS_CODE when the options do not parse\n * @returns the spec, with dtype dict when the column became a dict\n */\nfunction declareOptions(\n decl: ColumnDecl,\n spec: DeclaredTypeSpec,\n optionsText: string,\n listSyntax: ListSyntax,\n issues: DeclarationIssue[],\n): DeclaredTypeSpec {\n try {\n const options = splitListText(optionsText, listSyntax).map((item) => parseItem(item, spec));\n decl.options = options;\n if (spec.dtype === \"string\" && !spec.list && options.every((o) => typeof o === \"string\")) {\n decl.dtype = \"dict\";\n return { ...spec, dtype: \"dict\" };\n }\n } catch (err) {\n issues.push({\n category: \"validation-error\",\n code: BAD_OPTIONS_CODE,\n message: `options \"${optionsText}\" of attribute \"${decl.name}\" do not parse as ${spec.declared}: ${messageOf(err)}`,\n });\n }\n return spec;\n}\n\n/**\n * Parse a value text by a declaration: a scalar, or a list split by the syntax with each item\n * parsed by the item kind.\n * @param text - the value text\n * @param spec - the declared type\n * @param listSyntax - the list syntax\n * @returns the value to push (a boolean, a number, a string, a JSON value or an array)\n * @category Plugin helpers\n */\nexport function parseDeclaredValue(text: string, spec: DeclaredTypeSpec, listSyntax: ListSyntax): unknown {\n if (spec.list) {\n return splitListText(text, listSyntax).map((item) => parseItem(item, spec));\n }\n return parseItem(text, spec);\n}\n\n/**\n * Parse a temporal value text by a declaration, keeping the source text when its canonical form\n * differs (for the companion column).\n * @param text - the value text\n * @param spec - a scalar temporal spec\n * @returns the value and the text to keep, or null text\n * @category Plugin helpers\n */\nexport function parseDeclaredTemporal(text: string, spec: DeclaredTypeSpec): TemporalValue {\n if (spec.temporal === null || spec.list) {\n throw new GraphFormatError(\"E_COLUMN_TYPE\", `\"${spec.declared}\" is not a scalar temporal type`, {\n declared: spec.declared,\n });\n }\n return parseTemporal(text.trim(), spec.temporal);\n}\n\nconst INTEGER_TEXT = /^[+-]?\\d+$/;\n\n/**\n * Whether a long value's text lost precision when parsed to f64 (design section 5.1: a value with\n * |v| > 2^53 is stored as the nearest f64 and recorded as a `precision` issue). Decided from the\n * text, since the parsed number alone cannot tell 2^53 from 2^53 + 1.\n * @param spec - the declared type\n * @param text - the value text (trimmed or not)\n * @returns true when the importer should record a `precision` issue\n * @category Plugin helpers\n */\nexport function losesPrecision(spec: DeclaredTypeSpec, text: string): boolean {\n if (!spec.precision) {\n return false;\n }\n const trimmed = text.trim();\n if (!INTEGER_TEXT.test(trimmed)) {\n return false;\n }\n const n = Number(trimmed);\n return !Number.isFinite(n) || BigInt(trimmed) !== BigInt(n);\n}\n\n/**\n * Declare a column on the sink for one domain.\n * @param sink - the sink\n * @param domain - node or edge\n * @param decl - the declaration\n * @returns the column handle\n * @category Plugin helpers\n */\nexport function declareOn(sink: GraphSink, domain: \"node\" | \"edge\", decl: ColumnDecl): ColumnHandle {\n return domain === \"node\" ? sink.declareNodeColumn(decl) : sink.declareEdgeColumn(decl);\n}\n\n/**\n * The outcome of declareResolved(): the handle and the declaration as it was applied.\n * @public\n * @category Plugin helpers\n */\nexport interface ResolvedDeclaration {\n /** The column handle. */\n readonly handle: ColumnHandle;\n /** The declaration as applied (its name and role may differ from the request). */\n readonly decl: ColumnDecl;\n /** Whether the column was renamed `<name>#<id>` (W_COLUMN_RENAMED recorded). */\n readonly renamed: boolean;\n /** Whether the role was dropped because the table already holds it (W_ROLE_TAKEN recorded). */\n readonly roleDropped: boolean;\n}\n\n/**\n * The column naming rule in one place, so every importer agrees: declare a column on\n * the sink and, when the sink already holds the name with another shape (an earlier import, a\n * caller's column), rename it `<name>#<origin.id>` (a counter when the source has no id) and\n * record W_COLUMN_RENAMED (coercion); when the table already holds the role, declare without the role and record W_ROLE_TAKEN (coercion). The\n * same shape under the same name returns the existing handle, as the sink does.\n * @param sink - the sink\n * @param domain - node or edge\n * @param decl - the wanted declaration\n * @param report - the report the coercion issues are recorded in\n * @param where - the line and element, when known\n * @returns the handle and the declaration as applied\n * @category Plugin helpers\n */\nexport function declareResolved(\n sink: GraphSink,\n domain: \"node\" | \"edge\",\n decl: ColumnDecl,\n report: ImportReportBuilder,\n where?: IssueLocation,\n): ResolvedDeclaration {\n let current = decl;\n let renamed = false;\n let roleDropped = false;\n for (;;) {\n try {\n return { handle: declareOn(sink, domain, current), decl: current, renamed, roleDropped };\n } catch (err) {\n if (!(err instanceof GraphFormatError)) {\n throw err;\n }\n if (err.code === \"E_COLUMN_EXISTS\" && !renamed) {\n current = renameColumn(sink, domain, current, report, where);\n renamed = true;\n continue;\n }\n if (err.code === \"E_DUPLICATE_ROLE\" && current.role !== undefined && !roleDropped) {\n current = dropRole(err, domain, current, current.role, report, where);\n roleDropped = true;\n continue;\n }\n throw err;\n }\n }\n}\n\n/**\n * The declaration under a name the sink does not hold yet, recording W_COLUMN_RENAMED.\n * @param sink - the sink\n * @param domain - node or edge\n * @param decl - the declaration whose name clashed\n * @param report - the report\n * @param where - the line and element, when known\n * @returns the renamed declaration\n */\nfunction renameColumn(\n sink: GraphSink,\n domain: \"node\" | \"edge\",\n decl: ColumnDecl,\n report: ImportReportBuilder,\n where: IssueLocation | undefined,\n): ColumnDecl {\n const taken = takenIn(sink, domain);\n const id = decl.origin?.id ?? null;\n const name = uniqueColumnName(decl.name, id, taken);\n report.warning(\n \"coercion\",\n COLUMN_RENAMED_CODE,\n `${domain} column \"${decl.name}\" renamed to \"${name}\": the sink already holds that name with another shape`,\n { ...where, element: where?.element ?? decl.name },\n );\n return { ...decl, name };\n}\n\n/**\n * The declaration without the role another column holds, recording W_ROLE_TAKEN.\n * @param err - the sink's E_DUPLICATE_ROLE error\n * @param domain - node or edge\n * @param decl - the declaration whose role clashed\n * @param role - its role\n * @param report - the report\n * @param where - the line and element, when known\n * @returns the declaration without its role\n */\nfunction dropRole(\n err: GraphFormatError,\n domain: \"node\" | \"edge\",\n decl: ColumnDecl,\n role: ColumnRole,\n report: ImportReportBuilder,\n where: IssueLocation | undefined,\n): ColumnDecl {\n const holder = typeof err.details.holder === \"string\" ? err.details.holder : \"another column\";\n report.warning(\n \"coercion\",\n ROLE_TAKEN_CODE,\n `${domain} column \"${decl.name}\" loses the ${role} role: \"${holder}\" already holds it`,\n { ...where, element: where?.element ?? decl.name },\n );\n const { role: _role, ...withoutRole } = decl;\n return withoutRole;\n}\n\n/**\n * Declare the companion text column of a temporal column. A table holds at\n * most one column per role, so when another companion already carries `timeText` this one is\n * declared without the role (reported once per table); exporters find every companion through\n * `extra.for`.\n * @param sink - the sink\n * @param domain - node or edge\n * @param companion - the declaration from declareAttribute()\n * @param report - the report the role loss is recorded in; when omitted the loss is silent\n * @returns the column handle\n * @category Plugin helpers\n */\nexport function declareCompanion(\n sink: GraphSink,\n domain: \"node\" | \"edge\",\n companion: ColumnDecl,\n report?: ImportReportBuilder,\n): ColumnHandle {\n try {\n return declareOn(sink, domain, companion);\n } catch (err) {\n if (err instanceof GraphFormatError && err.code === \"E_DUPLICATE_ROLE\") {\n report?.warnOnce(\n \"coercion\",\n ROLE_TAKEN_CODE,\n `${domain} column \"${companion.name}\" is declared without the timeText role: another companion holds it (exporters use extra.for)`,\n { element: companion.name },\n );\n const { role: _role, ...withoutRole } = companion;\n return declareOn(sink, domain, withoutRole);\n }\n throw err;\n }\n}\n\n/**\n * Whether a column name is taken in a sink's table, the usual `taken` callback.\n * @param sink - the sink\n * @param domain - node or edge\n * @returns a predicate over column names\n * @category Plugin helpers\n */\nexport function takenIn(sink: GraphSink, domain: \"node\" | \"edge\"): (name: string) => boolean {\n return (name: string): boolean =>\n (domain === \"node\" ? sink.nodeColumn(name) : sink.edgeColumn(name)) !== INVALID_INDEX;\n}\n\n/**\n * The deterministic name of a declared attribute whose preferred name is taken (design section\n * 5.6): `<name>#<origin.id>`, and `<name>#<origin.id>#2`, `#3`... should that be taken as well.\n * @param name - the preferred name\n * @param id - the source id (the attribute id or key id); null falls back to a counter\n * @param taken - whether a name is already used in the table\n * @returns a free name\n * @category Plugin helpers\n */\nexport function uniqueColumnName(name: string, id: string | null, taken: (name: string) => boolean): string {\n if (!taken(name)) {\n return name;\n }\n const base = id === null ? name : `${name}#${id}`;\n if (id !== null && !taken(base)) {\n return base;\n }\n for (let n = 2; ; n++) {\n const candidate = `${base}#${n}`;\n if (!taken(candidate)) {\n return candidate;\n }\n }\n}\n\n/**\n * The dict heuristic of design section 5.4 for an untyped string column: observe values until the\n * sample is full; the column is a dict when the distinct count stays below half the rows, a string\n * otherwise. The importer buffers the sampled values and declares the column on the decision.\n * @category Plugin helpers\n */\nexport class DictHeuristic {\n private readonly distinct = new Set<string>();\n\n private rowsSeen = 0;\n\n private readonly sampleRows: number;\n\n /**\n * Create a heuristic.\n * @param sampleRows - rows observed before deciding; DICT_SAMPLE_ROWS by default\n */\n constructor(sampleRows: number = DICT_SAMPLE_ROWS) {\n this.sampleRows = sampleRows;\n }\n\n /**\n * Rows observed so far.\n * @returns the count\n */\n get rows(): number {\n return this.rowsSeen;\n }\n\n /**\n * Distinct values observed so far.\n * @returns the count\n */\n get distinctCount(): number {\n return this.distinct.size;\n }\n\n /**\n * Whether the sample is full.\n * @returns true once sampleRows values were observed\n */\n get decided(): boolean {\n return this.rowsSeen >= this.sampleRows;\n }\n\n /**\n * Observe one value.\n * @param value - the value text\n * @returns true when this observation completed the sample\n */\n observe(value: string): boolean {\n this.rowsSeen++;\n if (this.distinct.size < this.rowsSeen) {\n this.distinct.add(value);\n }\n return this.rowsSeen === this.sampleRows;\n }\n\n /**\n * The dtype the sample suggests: dict when the distinct count is below rows / 2 (and at least\n * one row was seen), string otherwise. Valid before the sample is full (end of input).\n * @returns \"dict\" or \"string\"\n */\n decide(): \"dict\" | \"string\" {\n return this.rowsSeen > 0 && this.distinct.size * 2 < this.rowsSeen ? \"dict\" : \"string\";\n }\n}\n\n/**\n * The resolved name of a declaration and whether it was renamed.\n * @param input - the declaration input\n * @returns the name and the rename flag; E_COLUMN_TYPE when neither a title nor an id exists\n */\nfunction resolveName(input: AttributeDeclarationInput): { name: string; renamed: boolean } {\n const preferred = input.title !== null && input.title.length > 0 ? input.title : input.id;\n if (preferred === null || preferred.length === 0) {\n throw new GraphFormatError(\"E_COLUMN_TYPE\", \"an attribute declaration needs a title or an id\", {\n field: \"name\",\n format: input.format,\n });\n }\n if (input.taken === undefined) {\n return { name: preferred, renamed: false };\n }\n const name = uniqueColumnName(preferred, input.id, input.taken);\n return { name, renamed: name !== preferred };\n}\n\n/**\n * Parse one scalar value or list item by a spec.\n * @param text - the item text\n * @param spec - the declared type\n * @returns the parsed value\n */\nfunction parseItem(text: string, spec: DeclaredTypeSpec): unknown {\n return parseScalarText(text, spec.kind, spec.temporal);\n}\n\n/**\n * The message of a caught value.\n * @param err - the thrown value\n * @returns the message\n */\nfunction messageOf(err: unknown): string {\n return err instanceof Error ? err.message : String(err);\n}\n","/**\n * Id coercion (design section 4.1): the importer-side rule that turns a text cell or a JSON value\n * into a NodeId before it reaches the sink. The core never coerces.\n *\n * - \"keep\": typed values pass through; anything that is not a string or a number is E_INVALID_ID.\n * - \"canonical\": text becomes a number iff it is canonical integer text (`/^-?(0|[1-9][0-9]*)$/`\n * and a safe integer, excluding \"-0\" which would collide with \"0\"); every other text stays a\n * string. Injective on text, so `String(id)` on export reproduces the cell exactly: \"01\", \"1.0\"\n * and \"+1\" stay strings, \"1\" becomes 1. Typed values pass through as under \"keep\".\n * - \"string\": `String(v)` for strings, numbers, booleans, bigints and null; anything else is\n * E_INVALID_ID.\n * - \"number\": `Number(text)` for text (empty or whitespace-only text, NaN and non-finite results\n * are E_INVALID_ID); numbers pass through; anything else is E_INVALID_ID. This rule can merge\n * distinct cells (\"01\" and \"1\"); IdCoercer counts such merges so the importer can report them as\n * coercion issues.\n */\n\nimport { GraphFormatError, type IdCoercion, type NodeId } from \"@graphty/graph-format\";\n\nconst CANONICAL_INTEGER = /^-?(0|[1-9]\\d*)$/;\n\nexport { ID_MERGED_CODE } from \"./codes.js\";\n\n/**\n * The \"canonical\" rule on one text cell.\n * @param text - the cell text, exactly as read\n * @returns the number for canonical safe-integer text (never for \"-0\"), the text itself otherwise\n * @category Plugin helpers\n */\nexport function canonicalId(text: string): NodeId {\n if (text !== \"-0\" && CANONICAL_INTEGER.test(text)) {\n const n = Number(text);\n if (Number.isSafeInteger(n)) {\n return n;\n }\n }\n return text;\n}\n\n/**\n * Whether a text cell is canonical integer text under the \"canonical\" rule (a number after import).\n * @param text - the cell text\n * @returns true when canonicalId(text) returns a number\n * @category Plugin helpers\n */\nexport function isCanonicalIntegerText(text: string): boolean {\n return typeof canonicalId(text) === \"number\";\n}\n\n/**\n * Coerce a text cell under a rule.\n * @param text - the cell text, exactly as read\n * @param mode - the coercion rule\n * @returns the id; E_INVALID_ID when the rule rejects the text\n * @category Plugin helpers\n */\nexport function coerceIdText(text: string, mode: IdCoercion): NodeId {\n switch (mode) {\n case \"keep\":\n case \"string\":\n return text;\n case \"canonical\":\n return canonicalId(text);\n case \"number\": {\n if (text.trim().length === 0) {\n throw invalidId(text, \"empty text is not a number\");\n }\n const n = Number(text);\n if (!Number.isFinite(n)) {\n throw invalidId(text, \"not a finite number\");\n }\n return n;\n }\n default: {\n const name: string = mode;\n throw new GraphFormatError(\"E_UNSUPPORTED\", `unknown id coercion ${name}`, { option: \"ids\", found: name });\n }\n }\n}\n\n/**\n * Coerce a typed value (a JSON scalar, a record field) under a rule.\n * @param value - the value\n * @param mode - the coercion rule\n * @returns the id; E_INVALID_ID when the rule rejects the value\n * @category Plugin helpers\n */\nexport function coerceId(value: unknown, mode: IdCoercion): NodeId {\n if (typeof value === \"string\") {\n return coerceIdText(value, mode);\n }\n if (typeof value === \"number\") {\n if (!Number.isFinite(value)) {\n throw invalidId(value, \"not a finite number\");\n }\n return mode === \"string\" ? String(value) : value;\n }\n if (mode === \"string\" && (typeof value === \"boolean\" || typeof value === \"bigint\" || value === null)) {\n return String(value);\n }\n throw invalidId(value, `a ${value === null ? \"null\" : typeof value} is not an id under ids: \"${mode}\"`);\n}\n\n/**\n * The E_INVALID_ID error of a rejected value.\n * @param value - the rejected value\n * @param reason - why\n * @returns the error\n */\nfunction invalidId(value: unknown, reason: string): GraphFormatError {\n const shown = typeof value === \"string\" || typeof value === \"number\" ? value : typeof value;\n return new GraphFormatError(\"E_INVALID_ID\", `invalid node id ${JSON.stringify(shown)}: ${reason}`, {\n reason,\n value: typeof value === \"bigint\" ? value.toString() : value,\n });\n}\n\n/**\n * A stateful coercer for one import call: applies the rule and, under \"number\", detects merges\n * (two distinct texts mapping to one number) so the importer can report them as coercion issues.\n * @category Writing a format\n */\nexport class IdCoercer {\n /** The rule. */\n readonly mode: IdCoercion;\n\n /** Texts merged into an id another text already produced. */\n mergeCount = 0;\n\n /** The text that first produced each numeric id, kept only under \"number\". */\n private readonly firstText: Map<number, string> | null;\n\n /** The merge detected by the most recent text() call, or null. */\n lastMerge: {\n /** The number both texts became. */\n readonly id: number;\n /** The text just read. */\n readonly text: string;\n /** The first text that became the same number. */\n readonly previousText: string;\n } | null = null;\n\n /**\n * Create a coercer.\n * @param mode - the rule\n */\n constructor(mode: IdCoercion) {\n this.mode = mode;\n this.firstText = mode === \"number\" ? new Map() : null;\n }\n\n /**\n * Coerce a text cell, recording a merge under \"number\" when a different text already produced\n * the same number.\n * @param text - the cell text\n * @returns the id\n */\n text(text: string): NodeId {\n const id = coerceIdText(text, this.mode);\n this.lastMerge = null;\n if (this.firstText !== null && typeof id === \"number\") {\n const previous = this.firstText.get(id);\n if (previous === undefined) {\n this.firstText.set(id, text);\n } else if (previous !== text) {\n this.mergeCount++;\n this.lastMerge = { id, text, previousText: previous };\n }\n }\n return id;\n }\n\n /**\n * Coerce a typed value.\n * @param value - the value\n * @returns the id\n */\n value(value: unknown): NodeId {\n if (typeof value === \"string\") {\n return this.text(value);\n }\n this.lastMerge = null;\n return coerceId(value, this.mode);\n }\n}\n","/**\n * Option normalization for importers and exporters (design sections 8.4 and 8.5): every common\n * option resolved to its documented default, enum values checked (E_UNSUPPORTED, the core's\n * convention for an option outside its set), and the per-format defaults (`ids`, `defaultDirected`,\n * `weightFrom`, `addMissingNodes`) supplied by the importer that calls resolveImportOptions().\n */\n\nimport { type DuplicatePolicy, GraphFormatError, type GraphSink, type IdCoercion } from \"@graphty/graph-format\";\n\nimport { type CommonExportOptions, type CommonImportOptions, type GraphChoiceOptions } from \"../types.js\";\nimport {\n AMBIGUOUS_GRAPH_NAME_CODE,\n GRAPH_NOT_FOUND_CODE,\n NO_GRAPH_CODE,\n OPTION_IGNORED_CODE,\n SINK_OPTION_CODE,\n} from \"./codes.js\";\nimport { canonicalEncoding } from \"./input.js\";\nimport { plural } from \"./plural.js\";\nimport { type ImportReportBuilder } from \"./report.js\";\n\n/**\n * The defaults an importer supplies for the options whose default is per format.\n * @category Plugin helpers\n */\nexport interface ImportFormatDefaults {\n /** \"canonical\" for text-cell formats, \"keep\" for JSON. */\n readonly ids: IdCoercion;\n /** The direction assumed when the file declares none. */\n readonly defaultDirected: boolean;\n /** The attribute that becomes the weight (\"weight\", GML \"value\"), or null for an unweighted format. */\n readonly weightFrom: string | null;\n /** Whether edges may reference undeclared nodes; true unless the format says otherwise (GEXF: false). */\n readonly addMissingNodes?: boolean | undefined;\n}\n\n/**\n * CommonImportOptions with every field present.\n * @public\n * @category Plugin helpers\n */\nexport interface ResolvedImportOptions {\n /** The id coercion rule. */\n readonly ids: IdCoercion;\n /** Which field becomes the node id. */\n readonly nodeIdFrom: \"id\" | \"label\" | \"index\";\n /** Whether an edge may reference an undeclared node. */\n readonly addMissingNodes: boolean;\n /** The builder's duplicate-edge policy seed. */\n readonly duplicateEdges: DuplicatePolicy;\n /** The builder's self-loop policy seed. */\n readonly selfLoops: \"keep\" | \"drop\" | \"error\";\n /** The mixed-direction policy. */\n readonly onMixedDirection: \"expand\" | \"directed\" | \"undirected\" | \"error\";\n /** The direction assumed when the file declares none. */\n readonly defaultDirected: boolean;\n /** The weight attribute, or null for unweighted. */\n readonly weightFrom: string | null;\n /** The weight staging precision. */\n readonly weightDtype: \"f32\" | \"f64\";\n /** How declared long columns are stored. */\n readonly long: \"f64\" | \"string\";\n /** Whether mangled ids are restored. */\n readonly restoreMangledIds: boolean;\n /** The hyperedge policy. */\n readonly hyperedges: \"error\" | \"skip\" | \"star\" | \"clique\";\n /** Errors tolerated before aborting. */\n readonly errorLimit: number;\n /** The cancellation signal, or null. */\n readonly signal: AbortSignal | null;\n /** The progress callback, or null. */\n readonly onProgress: ((bytesDone: number, bytesTotal?: number) => void) | null;\n /** The caller's byte encoding (canonical name), or null to detect it. */\n readonly encoding: string | null;\n}\n\n/**\n * CommonExportOptions with every field present.\n * @category Plugin helpers\n */\nexport interface ResolvedExportOptions {\n /** \"error\" never renames a node; \"mangle\" rewrites and keeps the original. */\n readonly sanitizeIds: \"error\" | \"mangle\";\n /** What a format without mixed-direction support does with a mixed snapshot. */\n readonly onMixedDirection: \"error\" | \"directed\" | \"undirected\";\n}\n\nconst ID_COERCIONS: ReadonlySet<string> = new Set([\"keep\", \"canonical\", \"string\", \"number\"]);\nconst NODE_ID_SOURCES: ReadonlySet<string> = new Set([\"id\", \"label\", \"index\"]);\nconst DUPLICATE_POLICIES: ReadonlySet<string> = new Set([\"keep\", \"error\", \"first\", \"last\", \"sum\", \"min\", \"max\"]);\nconst SELF_LOOP_POLICIES: ReadonlySet<string> = new Set([\"keep\", \"drop\", \"error\"]);\nconst IMPORT_MIXED_POLICIES: ReadonlySet<string> = new Set([\"expand\", \"directed\", \"undirected\", \"error\"]);\nconst EXPORT_MIXED_POLICIES: ReadonlySet<string> = new Set([\"error\", \"directed\", \"undirected\"]);\nconst WEIGHT_DTYPES: ReadonlySet<string> = new Set([\"f32\", \"f64\"]);\nconst LONG_MODES: ReadonlySet<string> = new Set([\"f64\", \"string\"]);\nconst HYPEREDGE_POLICIES: ReadonlySet<string> = new Set([\"error\", \"skip\", \"star\", \"clique\"]);\nconst SANITIZE_MODES: ReadonlySet<string> = new Set([\"error\", \"mangle\"]);\n\n/**\n * The default error limit: errors tolerated before an import aborts.\n * @category Reports and errors\n */\nexport const DEFAULT_ERROR_LIMIT = 100;\n\nexport { SINK_OPTION_CODE } from \"./codes.js\";\n\n/** The builder-policy options a sink exposes read-only as `sink.options` (design section 8.4). */\nconst SINK_OPTION_NAMES = [\"addMissingNodes\", \"duplicateEdges\", \"selfLoops\", \"weightDtype\"] as const;\n\n/**\n * Report every builder-policy option the caller explicitly requested that the sink does not use,\n * one `W_SINK_OPTION` warning per option with the option name as\n * the element. Options left undefined are never reported: they are defaults, not requests. On the\n * registry's builder, which is seeded from the same options, nothing is ever reported.\n * @param sink - the sink the importer pushes into\n * @param options - the caller's raw options, possibly undefined\n * @param report - the report to record into\n * @param enforcesMissingNodes - true when the importer applies `addMissingNodes: false` itself (it\n * refuses unknown endpoints before the sink sees them), so that request is honored on any sink and\n * only `addMissingNodes: true` against a refusing sink is reported\n * @returns the number of warnings recorded\n * @category Writing a format\n */\nexport function reportSinkOptions(\n sink: GraphSink,\n options: CommonImportOptions | undefined,\n report: ImportReportBuilder,\n enforcesMissingNodes = false,\n): number {\n if (options === undefined) {\n return 0;\n }\n let recorded = 0;\n for (const name of SINK_OPTION_NAMES) {\n const wanted: unknown = options[name];\n const actual: unknown = sink.options[name];\n if (wanted === undefined || wanted === actual) {\n continue;\n }\n if (name === \"addMissingNodes\" && enforcesMissingNodes && wanted === false) {\n continue;\n }\n report.warning(\n \"coercion\",\n SINK_OPTION_CODE,\n `option ${name}: ${JSON.stringify(wanted)} requested but the sink uses ${JSON.stringify(actual)}; the sink's setting applies`,\n { element: name },\n );\n recorded++;\n }\n return recorded;\n}\n\n/** The common options a format may leave unused; `signal`, `onProgress` and `errorLimit` apply everywhere. */\nconst IGNORABLE_OPTION_NAMES = [\n \"ids\",\n \"nodeIdFrom\",\n \"addMissingNodes\",\n \"duplicateEdges\",\n \"selfLoops\",\n \"onMixedDirection\",\n \"defaultDirected\",\n \"weightFrom\",\n \"weightDtype\",\n \"long\",\n \"restoreMangledIds\",\n \"hyperedges\",\n] as const;\n\n/** The defaults that are the same in every format (the others, such as `defaultDirected`, differ by format). */\nconst FIXED_DEFAULTS: Readonly<Partial<Record<(typeof IGNORABLE_OPTION_NAMES)[number], unknown>>> = {\n nodeIdFrom: \"id\",\n duplicateEdges: \"keep\",\n selfLoops: \"keep\",\n onMixedDirection: \"expand\",\n weightDtype: \"f64\",\n long: \"f64\",\n restoreMangledIds: true,\n hyperedges: \"skip\",\n};\n\n/**\n * Report every common option the caller set to a non-default value that the format has no use\n * for: one\n * `W_OPTION_IGNORED` warning (category `unsupported`) per option, the option name as the element.\n * The builder-policy options are reportSinkOptions()'s and are skipped here.\n * @param options - the caller's raw options, possibly undefined\n * @param report - the report to record into\n * @param used - the common option names the importer reads\n * @returns the number of warnings recorded\n * @category Writing a format\n */\nexport function reportUnusedOptions(\n options: CommonImportOptions | undefined,\n report: ImportReportBuilder,\n used: ReadonlySet<keyof CommonImportOptions>,\n): number {\n if (options === undefined) {\n return 0;\n }\n let recorded = 0;\n for (const name of IGNORABLE_OPTION_NAMES) {\n if (used.has(name) || (SINK_OPTION_NAMES as readonly string[]).includes(name)) {\n continue;\n }\n const value: unknown = options[name];\n if (value === undefined || value === FIXED_DEFAULTS[name]) {\n // an option spelled out at its default changes nothing, whether or not the format reads it\n continue;\n }\n report.warning(\n \"unsupported\",\n OPTION_IGNORED_CODE,\n `option ${name}: ${JSON.stringify(value)} has no effect on the ${report.format} importer`,\n { element: name },\n );\n recorded++;\n }\n return recorded;\n}\n\n/**\n * Whether the caller chose a graph with `graphIndex` or `graphName`. An importer warns\n * W_MULTIPLE_GRAPHS about the graphs it skipped only when it read the first by default.\n * @param options - the caller's graphIndex / graphName\n * @returns true when either option is set\n * @category Writing a format\n */\nexport function graphChosen(options: GraphChoiceOptions | undefined): boolean {\n return options?.graphIndex !== undefined || options?.graphName !== undefined;\n}\n\n/**\n * The graphs of an input as an E_GRAPH_NOT_FOUND message lists them: their indexes and names, so the\n * caller can choose without a second call.\n * @param names - each graph's name, null for an unnamed graph\n * @returns the text to append, starting with \"; \"\n */\nfunction graphNamesText(names: readonly (string | null)[]): string {\n const shown = names.slice(0, 10).map((n, i) => `${i} ${n === null ? \"(unnamed)\" : JSON.stringify(n)}`);\n const more = names.length > shown.length ? `, and ${names.length - shown.length} more` : \"\";\n return `; the file holds ${shown.join(\", \")}${more}`;\n}\n\n/**\n * The graph an importer reads from an input that holds several: the one `graphIndex` or\n * `graphName` names, else the first. A choice that names no graph is E_GRAPH_NOT_FOUND, a name two\n * graphs share is E_AMBIGUOUS_GRAPH_NAME, and an input with no graph at all is E_NO_GRAPH, each\n * fatal (the report fails with ImportError).\n * @param names - each graph's name (null for an unnamed graph), in document order\n * @param options - the caller's graphIndex / graphName\n * @param report - the report a failure is recorded in\n * @returns the index of the graph to read; E_UNSUPPORTED for an option of the wrong type, or both\n * @category Writing a format\n */\nexport function chooseGraph(\n names: readonly (string | null)[],\n options: GraphChoiceOptions | undefined,\n report: ImportReportBuilder,\n): number {\n const { graphIndex, graphName } = options ?? {};\n if (\n graphIndex !== undefined &&\n (typeof graphIndex !== \"number\" || !Number.isInteger(graphIndex) || graphIndex < 0)\n ) {\n throw new GraphFormatError(\n \"E_UNSUPPORTED\",\n `option graphIndex: ${describe(graphIndex)} is not a non-negative integer`,\n {\n option: \"graphIndex\",\n found: graphIndex,\n },\n );\n }\n if (graphName !== undefined && typeof graphName !== \"string\") {\n throw new GraphFormatError(\"E_UNSUPPORTED\", `option graphName: ${describe(graphName)} is not a string`, {\n option: \"graphName\",\n found: graphName,\n });\n }\n if (graphIndex !== undefined && graphName !== undefined) {\n throw new GraphFormatError(\"E_UNSUPPORTED\", \"options graphIndex and graphName both choose a graph; pass one\", {\n option: \"graphName\",\n found: graphName,\n });\n }\n if (names.length === 0) {\n return report.fail(NO_GRAPH_CODE, \"the input holds no graph\");\n }\n if (graphName !== undefined) {\n const matches = names.flatMap((name, i) => (name === graphName ? [i] : []));\n if (matches.length > 1) {\n return report.fail(\n AMBIGUOUS_GRAPH_NAME_CODE,\n `graphName ${JSON.stringify(graphName)} names the graphs at indexes ${matches.join(\", \")}; pass graphIndex`,\n { element: graphName },\n );\n }\n if (matches.length === 0) {\n return report.fail(\n GRAPH_NOT_FOUND_CODE,\n `graphName ${JSON.stringify(graphName)} names none of the ${names.length} graph${plural(names.length)}${graphNamesText(names)}`,\n { element: graphName },\n { names: [...names] },\n );\n }\n return matches[0];\n }\n const index = graphIndex ?? 0;\n if (index >= names.length) {\n return report.fail(\n GRAPH_NOT_FOUND_CODE,\n `graphIndex ${index} is beyond the ${names.length} graph${plural(names.length)}${graphNamesText(names)}`,\n );\n }\n return index;\n}\n\n/**\n * Apply the documented defaults to an importer's common options and check every enum\n * value. Format-specific options in the same object are ignored here.\n * @param options - the caller's options, possibly undefined\n * @param defaults - the importer's per-format defaults\n * @returns the resolved options; E_UNSUPPORTED for a value outside its set\n * @category Writing a format\n */\nexport function resolveImportOptions(\n options: CommonImportOptions | undefined,\n defaults: ImportFormatDefaults,\n): ResolvedImportOptions {\n const o: CommonImportOptions = options ?? {};\n return Object.freeze({\n ids: enumOption(\"ids\", o.ids, defaults.ids, ID_COERCIONS),\n nodeIdFrom: enumOption(\"nodeIdFrom\", o.nodeIdFrom, \"id\", NODE_ID_SOURCES),\n addMissingNodes: booleanOption(\"addMissingNodes\", o.addMissingNodes, defaults.addMissingNodes ?? true),\n duplicateEdges: enumOption(\"duplicateEdges\", o.duplicateEdges, \"keep\", DUPLICATE_POLICIES),\n selfLoops: enumOption(\"selfLoops\", o.selfLoops, \"keep\", SELF_LOOP_POLICIES),\n onMixedDirection: enumOption(\"onMixedDirection\", o.onMixedDirection, \"expand\", IMPORT_MIXED_POLICIES),\n defaultDirected: booleanOption(\"defaultDirected\", o.defaultDirected, defaults.defaultDirected),\n weightFrom: weightFromOption(o.weightFrom, defaults.weightFrom),\n weightDtype: enumOption(\"weightDtype\", o.weightDtype, \"f64\", WEIGHT_DTYPES),\n long: enumOption(\"long\", o.long, \"f64\", LONG_MODES),\n restoreMangledIds: booleanOption(\"restoreMangledIds\", o.restoreMangledIds, true),\n hyperedges: enumOption(\"hyperedges\", o.hyperedges, \"skip\", HYPEREDGE_POLICIES),\n errorLimit: errorLimitOption(o.errorLimit),\n signal: signalOption(o.signal),\n onProgress: progressOption(o.onProgress),\n encoding: encodingOption(o.encoding),\n });\n}\n\n/**\n * Apply the documented defaults to an exporter's common options and check the enum values.\n * @param options - the caller's options, possibly undefined\n * @returns the resolved options; E_UNSUPPORTED for a value outside its set\n * @category Writing a format\n */\nexport function resolveExportOptions(options: CommonExportOptions | undefined): ResolvedExportOptions {\n const o: CommonExportOptions = options ?? {};\n return Object.freeze({\n sanitizeIds: enumOption(\"sanitizeIds\", o.sanitizeIds, \"error\", SANITIZE_MODES),\n onMixedDirection: enumOption(\"onMixedDirection\", o.onMixedDirection, \"error\", EXPORT_MIXED_POLICIES),\n });\n}\n\n/**\n * Resolve one enum-valued option.\n * @param name - the option name, for the error\n * @param value - the caller's value\n * @param fallback - the default\n * @param allowed - the accepted values\n * @returns the value or the default; E_UNSUPPORTED when outside the set\n */\nfunction enumOption<T extends string>(name: string, value: unknown, fallback: T, allowed: ReadonlySet<string>): T {\n if (value === undefined) {\n return fallback;\n }\n if (typeof value !== \"string\" || !allowed.has(value)) {\n throw new GraphFormatError(\n \"E_UNSUPPORTED\",\n `option ${name}: ${describe(value)} is not one of ${list(allowed)}`,\n {\n option: name,\n found: value,\n supported: [...allowed],\n },\n );\n }\n return value as T;\n}\n\n/**\n * Resolve one boolean option.\n * @param name - the option name, for the error\n * @param value - the caller's value\n * @param fallback - the default\n * @returns the value or the default; E_UNSUPPORTED when not a boolean\n */\nfunction booleanOption(name: string, value: unknown, fallback: boolean): boolean {\n if (value === undefined) {\n return fallback;\n }\n if (typeof value !== \"boolean\") {\n throw new GraphFormatError(\"E_UNSUPPORTED\", `option ${name}: ${describe(value)} is not a boolean`, {\n option: name,\n found: value,\n });\n }\n return value;\n}\n\n/**\n * Resolve the weightFrom option: a non-empty attribute name, null for unweighted, or the format default.\n * @param value - the caller's value\n * @param fallback - the format default\n * @returns the resolved value; E_UNSUPPORTED for anything else\n */\nfunction weightFromOption(value: unknown, fallback: string | null): string | null {\n if (value === undefined) {\n return fallback;\n }\n if (value === null || (typeof value === \"string\" && value.length > 0)) {\n return value;\n }\n throw new GraphFormatError(\n \"E_UNSUPPORTED\",\n `option weightFrom: ${describe(value)} is not an attribute name or null`,\n { option: \"weightFrom\", found: value },\n );\n}\n\n/**\n * Resolve the error limit: a non-negative integer or Infinity.\n * @param value - the caller's value\n * @returns the limit or the default\n */\nfunction errorLimitOption(value: unknown): number {\n if (value === undefined) {\n return DEFAULT_ERROR_LIMIT;\n }\n if (typeof value === \"number\" && value >= 0 && (Number.isInteger(value) || value === Infinity)) {\n return value;\n }\n throw new GraphFormatError(\n \"E_UNSUPPORTED\",\n `option errorLimit: ${describe(value)} is not a non-negative integer or Infinity`,\n { option: \"errorLimit\", found: value },\n );\n}\n\n/**\n * Resolve the signal option by duck type, so a signal from another realm is accepted.\n * @param value - the caller's value\n * @returns the signal or null\n */\nfunction signalOption(value: unknown): AbortSignal | null {\n if (value === undefined || value === null) {\n return null;\n }\n if (typeof value === \"object\" && typeof (value as { aborted?: unknown }).aborted === \"boolean\") {\n return value as AbortSignal;\n }\n throw new GraphFormatError(\"E_UNSUPPORTED\", `option signal: ${describe(value)} is not an AbortSignal`, {\n option: \"signal\",\n found: typeof value,\n });\n}\n\n/**\n * Resolve the progress callback option.\n * @param value - the caller's value\n * @returns the callback or null\n */\nfunction progressOption(value: unknown): ((bytesDone: number, bytesTotal?: number) => void) | null {\n if (value === undefined || value === null) {\n return null;\n }\n if (typeof value === \"function\") {\n return value as (bytesDone: number, bytesTotal?: number) => void;\n }\n throw new GraphFormatError(\"E_UNSUPPORTED\", `option onProgress: ${describe(value)} is not a function`, {\n option: \"onProgress\",\n found: typeof value,\n });\n}\n\n/**\n * Resolve the encoding option: a label the platform's TextDecoder knows.\n * @param value - the caller's value\n * @returns the canonical encoding name, or null for detection\n */\nfunction encodingOption(value: unknown): string | null {\n if (value === undefined || value === null) {\n return null;\n }\n const canonical = typeof value === \"string\" ? canonicalEncoding(value) : null;\n if (canonical === null) {\n throw new GraphFormatError(\n \"E_UNSUPPORTED\",\n `option encoding: ${describe(value)} is not an encoding this platform's TextDecoder knows`,\n { option: \"encoding\", found: value },\n );\n }\n return canonical;\n}\n\n/**\n * The options to pass to another importer that you hand text you already decoded with readText():\n * the caller's options without `encoding` and `onProgress`, which that text no longer needs. Without\n * this, the other importer would warn that `encoding` has no effect on text, and report progress a\n * second time.\n * @example\n * ```ts\n * const text = await readText(input, report, opts);\n * report.include(await csvImporter.import(text, sink, forDecodedText(options)));\n * ```\n * @param options - the caller's import options\n * @returns a copy without `encoding` and `onProgress`\n * @category Writing a format\n */\nexport function forDecodedText<O extends CommonImportOptions>(options: O | undefined): O {\n return { ...options, encoding: undefined, onProgress: undefined } as O;\n}\n\n/**\n * The dialect names of the built-in formats with a `dialect` save option. One options object shared between formats\n * can hold one format's dialect, and the other formats ignore it, as they ignore any option they do not have.\n */\nexport const FORMAT_DIALECTS: Readonly<Record<string, readonly string[]>> = Object.freeze({\n csv: Object.freeze([\"gephi\", \"generic\"]),\n json: Object.freeze([\"node-link\", \"d3\", \"jgf\", \"cytoscape\", \"graphology\", \"vis\", \"obographs\"]),\n});\n\n/**\n * Whether a `dialect` value names another format's dialect, which this format ignores rather than refuses.\n * @param format - this format\n * @param value - the caller's `dialect` option\n * @returns true for another built-in format's dialect name\n */\nexport function otherFormatDialect(format: string, value: unknown): boolean {\n return (\n typeof value === \"string\" &&\n Object.entries(FORMAT_DIALECTS).some(([f, names]) => f !== format && names.includes(value))\n );\n}\n\n/**\n * A short description of an option value for an error message.\n * @param value - the value\n * @returns the JSON text of a primitive, or the type name otherwise\n * @category Plugin helpers\n */\nexport function describe(value: unknown): string {\n switch (typeof value) {\n case \"string\":\n return JSON.stringify(value);\n case \"number\":\n case \"boolean\":\n return String(value);\n default:\n return value === null ? \"null\" : typeof value;\n }\n}\n\n/**\n * The accepted values of an enum option, for an error message.\n * @param allowed - the set\n * @returns the quoted values joined by commas\n */\nfunction list(allowed: ReadonlySet<string>): string {\n return [...allowed].map((v) => JSON.stringify(v)).join(\", \");\n}\n","/**\n * Weight resolution shared by every importer (design sections 3.7 and 8.4): which source field is\n * THE weight (`weightFrom`, per-format default, null = unweighted), how its text or JSON value\n * becomes the number passed to `addEdge`, and the E_INVALID_WEIGHT boundary.\n *\n * An edge whose weight field is absent or blank is pushed WITHOUT a weight argument, never with an\n * explicit 1: the builder's weightSet bitmap then records that the weight was defaulted, and the\n * exporter re-emits no weight for it (decision D-WSET). NaN and non-numeric text are\n * E_INVALID_WEIGHT before the sink is touched, so the importer records the issue and skips the edge\n * with the sink unchanged; Infinity and negative values are legal weights (design section 3.7).\n */\n\nimport { type Column, GraphFormatError, type GraphSnapshot } from \"@graphty/graph-format\";\n\nimport { PRECISION_CODE } from \"./codes.js\";\nimport { parseDecimalText } from \"./declared-types.js\";\nimport { formatF32, formatF64, formatInteger } from \"./format.js\";\nimport { type ImportReportBuilder } from \"./report.js\";\n\n/**\n * The weight of an edge added without one (design section 3.7).\n * @category Plugin helpers\n */\nexport const DEFAULT_WEIGHT = 1;\n\n/**\n * Whether a source field is the weight field under the resolved `weightFrom` option.\n * @param name - the field name (attribute title, CSV header, JSON key)\n * @param weightFrom - the resolved option; null means unweighted\n * @returns true when the field is THE weight\n * @category Plugin helpers\n */\nexport function isWeightField(name: string, weightFrom: string | null): boolean {\n return weightFrom !== null && name === weightFrom;\n}\n\n/**\n * The weight argument of addEdge from a text cell: undefined for a blank cell (the weight is\n * omitted), the number otherwise.\n * @param text - the cell text\n * @param report - the import report; when given, an integer beyond 2^53 that the nearest double\n * changes is reported once as W_PRECISION\n * @returns the weight, or undefined when blank; E_INVALID_WEIGHT for NaN or non-numeric text\n * @category Writing a format\n */\nexport function parseWeightText(text: string, report?: ImportReportBuilder): number | undefined {\n const trimmed = text.trim();\n if (trimmed.length === 0) {\n return undefined;\n }\n let value: number;\n try {\n value = parseDecimalText(trimmed);\n } catch (err) {\n throw invalidWeight(text, err);\n }\n if (Number.isNaN(value)) {\n throw invalidWeight(text, null);\n }\n if (report !== undefined) {\n reportWeightPrecision(trimmed, value, report);\n }\n return value;\n}\n\n/**\n * Report once (W_PRECISION) an integer weight beyond 2^53 that the nearest double changes, which\n * the weights and the exact `graphty.weight` column would otherwise hold silently.\n * @param text - the weight as written in the file\n * @param value - the number it was read as\n * @param report - the import report\n */\nexport function reportWeightPrecision(text: string, value: number, report: ImportReportBuilder): void {\n if (\n !Number.isSafeInteger(value) &&\n Number.isFinite(value) &&\n /^[+-]?\\d+$/.test(text) &&\n BigInt(text) !== BigInt(value)\n ) {\n report.warnOnce(\n \"precision\",\n PRECISION_CODE,\n `edge weights: integers beyond 2^53 are stored as the nearest double (first: ${text})`,\n undefined,\n `${PRECISION_CODE}:edge weight`,\n );\n }\n}\n\n/**\n * The weight argument of addEdge from a typed value (JSON, a record field): undefined for null /\n * undefined, the number for a finite or infinite number, the parsed number for numeric text.\n * @param value - the field value\n * @returns the weight, or undefined when absent; E_INVALID_WEIGHT for NaN, a boolean, an object or non-numeric text\n * @category Plugin helpers\n */\nexport function weightFromValue(value: unknown): number | undefined {\n if (value === undefined || value === null) {\n return undefined;\n }\n if (typeof value === \"number\") {\n if (Number.isNaN(value)) {\n throw invalidWeight(value, null);\n }\n return value;\n }\n if (typeof value === \"string\") {\n return parseWeightText(value);\n }\n throw invalidWeight(value, null);\n}\n\n/**\n * The E_INVALID_WEIGHT error of a rejected value.\n * @param value - the rejected value\n * @param cause - the parse error, or null\n * @returns the error\n */\nfunction invalidWeight(value: unknown, cause: unknown): GraphFormatError {\n let shown: string;\n switch (typeof value) {\n case \"string\":\n shown = JSON.stringify(value);\n break;\n case \"number\":\n shown = String(value);\n break;\n default:\n shown = typeof value;\n }\n return new GraphFormatError(\"E_INVALID_WEIGHT\", `invalid edge weight ${shown}`, {\n value: typeof value === \"object\" ? typeof value : value,\n cause: cause instanceof Error ? cause.message : null,\n });\n}\n\n// ============================================================ the exporter side\n\n/**\n * The explicit weights of a snapshot for exporters: the weight\n * role column when present (its validity says which edges had an explicit weight, its dtype how\n * the value is written), else `edgeList().weights` as f32 for every edge of a weighted snapshot;\n * nothing for an unweighted one. One implementation for every exporter.\n * @public\n * @category Plugin helpers\n */\nexport interface ExplicitWeights {\n /** Whether any edge can have an explicit weight (the snapshot is weighted). */\n readonly weighted: boolean;\n /** The dtype the values are read from: the shadow column's, or f32 for the arc array. */\n readonly dtype: \"f32\" | \"f64\";\n /**\n * Whether an edge's weight was explicit in the source.\n * @param e - the logical edge index\n * @returns true when the exporter must write it\n */\n isExplicit(e: number): boolean;\n /**\n * The weight value of an edge (meaningful when explicit).\n * @param e - the logical edge index\n * @returns the value\n */\n value(e: number): number;\n /**\n * The weight text of an edge: the shortest round-tripping decimal for its dtype, or the\n * integer digits when `integral` is requested and the value is an integer; null when the\n * weight was defaulted.\n * @param e - the logical edge index\n * @param integral - write an integral value without a decimal part (formats declaring an int weight)\n * @returns the text, or null\n */\n text(e: number, integral?: boolean): string | null;\n}\n\n/** A weight of -0 keeps its sign: every importer's weight grammar reads \"-0\" back as -0. */\nconst NEGATIVE_ZERO_TEXT = \"-0\";\n\n/** The dtypes a weight role column may have (an integer column declared by a caller included). */\nconst NUMERIC_DTYPES: ReadonlySet<string> = new Set([\"f32\", \"f64\", \"i32\", \"u32\", \"u8\"]);\n\n/**\n * The shortest round-tripping text of a weight by the shadow column's dtype.\n * @param dtype - the shadow column's dtype\n * @returns the formatter\n */\nfunction weightFormatter(dtype: string): (value: number) => string {\n switch (dtype) {\n case \"f32\":\n return formatF32;\n case \"f64\":\n return formatF64;\n default:\n return formatInteger;\n }\n}\n\n/**\n * Build the explicit-weight view of a snapshot.\n * @param snapshot - the snapshot\n * @returns the view\n * @category Writing a format\n */\nexport function explicitWeights(snapshot: GraphSnapshot): ExplicitWeights {\n const shadowColumn = snapshot.edges.byRole(\"weight\");\n const shadow: Column | null = shadowColumn !== null && NUMERIC_DTYPES.has(shadowColumn.dtype) ? shadowColumn : null;\n if (shadow !== null) {\n const dtype = shadow.dtype === \"f32\" ? \"f32\" : \"f64\";\n const format = weightFormatter(shadow.dtype);\n return {\n weighted: true,\n dtype,\n isExplicit: (e: number): boolean => shadow.isSet(e),\n value: (e: number): number => shadow.value(e) as number,\n text: (e: number, integral = false): string | null => {\n if (!shadow.isSet(e)) {\n return null;\n }\n const value = shadow.value(e) as number;\n if (Object.is(value, -0)) {\n return NEGATIVE_ZERO_TEXT;\n }\n return integral && Number.isInteger(value) ? formatInteger(value) : format(value);\n },\n };\n }\n const { weights } = snapshot.edgeList();\n if (weights === null || !snapshot.flags.weighted) {\n return {\n weighted: false,\n dtype: \"f32\",\n isExplicit: (): boolean => false,\n value: (): number => DEFAULT_WEIGHT,\n text: (): string | null => null,\n };\n }\n return {\n weighted: true,\n dtype: \"f32\",\n isExplicit: (): boolean => true,\n value: (e: number): number => weights[e],\n text: (e: number, integral = false): string => {\n const value = weights[e];\n if (Object.is(value, -0)) {\n return NEGATIVE_ZERO_TEXT;\n }\n return integral && Number.isInteger(value) ? formatInteger(value) : formatF32(value);\n },\n };\n}\n\n/**\n * The weight of every edge, in edge order (`weights[e]` is edge `e`'s weight), exactly as the file\n * wrote it, or null for a graph without weights. `snapshot.edgeList().weights` holds the same\n * weights as 32-bit floats, in which 0.1 reads back as 0.10000000149011612; this reads the exact\n * values the import also kept. An edge without a weight of its own has the weight 1.\n * @example\n * ```ts\n * const { snapshot } = await importGraph(\"source,target,weight\\na,b,0.1\\n\", { format: \"csv\" });\n * edgeWeights(snapshot); // Float64Array [ 0.1 ]\n * ```\n * @param snapshot - the graph\n * @returns one weight per edge, or null when the graph has no weights\n * @category Loading\n */\nexport function edgeWeights(snapshot: GraphSnapshot): Float64Array | null {\n const { weights } = snapshot.edgeList();\n if (weights === null) {\n return null;\n }\n const out = Float64Array.from(weights);\n const exact = snapshot.edges.byRole(\"weight\");\n if (exact !== null) {\n for (let e = 0; e < out.length; e++) {\n const v = exact.value(e);\n if (typeof v === \"number\") {\n out[e] = v;\n }\n }\n }\n return out;\n}\n","/**\n * The exporter-side machinery of design section 8.5: the ExportCapabilities table helper, the\n * generic check() that turns capability gaps into LossNotes with shared codes, and id sanitising\n * (`sanitizeIds: \"error\"` by default; an exporter never silently renames a node; \"mangle\" rewrites\n * the ids the format cannot hold and hands the exporter the originals to write into its\n * `graphty:originalId` attribute).\n *\n * Every exporter's check() calls checkCapabilities() first and appends its format-specific notes;\n * export() calls\n * sanitizeIds() before writing anything.\n */\n\nimport {\n type Column,\n type Dtype,\n GraphFormatError,\n type GraphSnapshot,\n type IdCoercion,\n INVALID_INDEX,\n type NodeId,\n} from \"@graphty/graph-format\";\n\nimport { type ExportCapabilities, type LossNote } from \"../types.js\";\nimport {\n COLUMN_DROPPED_CODE,\n COLUMN_RENAMED_LOSS_CODE,\n EMPTY_COLUMN_DROPPED_CODE,\n ID_TEXT_COLLISION_CODE,\n ID_TEXT_TYPE_CODE,\n INTEGRAL_F64_CODE,\n MIXED_DIRECTION_CODE,\n MUTUAL_AS_UNDIRECTED_CODE,\n MUTUAL_EXPANDED_CODE,\n NONFINITE_AS_NULL_CODE,\n OPTIONS_GAINED_CODE,\n PARENTS_DROPPED_CODE,\n ROLE_ASSUMED_CODE,\n ROLE_DROPPED_CODE,\n STORAGE_CLASS_CODE,\n TEMPORAL_DROPPED_CODE,\n TEMPORAL_TEXT_DROPPED_CODE,\n TEXT_INFERRED_CODE,\n WEIGHT_KEY_CLASH_CODE,\n WEIGHTS_DROPPED_CODE,\n XML_ILLEGAL_CHAR_CODE,\n} from \"./codes.js\";\nimport { coerceIdText } from \"./ids.js\";\nimport { type ResolvedExportOptions } from \"./options.js\";\nimport { agree, plural } from \"./plural.js\";\nimport { explicitWeights } from \"./weights.js\";\n\n/** The code of node ids the format cannot write under `sanitizeIds: \"error\"`. */\nconst ID_CHARSET_REFUSAL = \"E_ID_CHARSET\";\n\n/**\n * The shared LossNote codes of checkCapabilities().\n * @category Issue and loss codes\n */\nexport const LOSS = Object.freeze({\n /**\n * A node or edge attribute is not written: the format has no attributes, or none of this kind\n * (`CheckExtras.attributes` false).\n */\n COLUMN_DROPPED: COLUMN_DROPPED_CODE,\n /**\n * The graph has both directed and undirected edges, the format holds one direction per file, and\n * `onMixedDirection` is \"directed\" or \"undirected\": every edge is written with that direction.\n */\n MIXED_DIRECTION: \"W_MIXED_DIRECTION\",\n /**\n * The graph has both directed and undirected edges and `onMixedDirection` is \"error\". An import stops; a save to a\n * format that holds one direction per file fails with E_DIRECTED. Pass \"directed\" or \"undirected\" to read or write\n * it anyway.\n */\n MIXED_DIRECTION_ERROR: MIXED_DIRECTION_CODE,\n /** Parallel edges in a format without them. */\n MULTI_EDGES: \"W_MULTI_EDGES\",\n /** Self-loops in a format without them. */\n SELF_LOOPS: \"W_SELF_LOOPS\",\n /**\n * The format needs an id on every edge and the graph has none, so the file gets ids e0, e1, e2 and so on, which\n * read back as edge ids.\n */\n EDGE_IDS_GENERATED: \"W_EDGE_IDS_GENERATED\",\n /** The graph has edge ids and the format has no place for them, so they are not written. */\n EDGE_IDS_DROPPED: \"W_EDGE_IDS_DROPPED\",\n /** Ids outside the format's charset are rewritten (sanitizeIds \"mangle\"). */\n ID_MANGLED: \"W_ID_MANGLED\",\n /**\n * Node ids the format cannot write, under `sanitizeIds: \"error\"`; the save fails with E_INVALID_ID. Pass\n * `sanitizeIds: \"mangle\"` to rewrite them.\n */\n ID_CHARSET: ID_CHARSET_REFUSAL,\n /** The format numbers nodes 1..N; ids that are not their 1-based index are kept as labels only. */\n ID_RENUMBERED: \"W_ID_RENUMBERED\",\n /**\n * An attribute's type is one the format cannot store as it is (for example, a 32-bit float in a format that has only 64-bit\n * numbers), so it reads back with the nearest type the format has.\n */\n DTYPE: \"W_DTYPE_UNSUPPORTED\",\n /**\n * An attribute with several numbers per element (other than a position) is written as separate values or a list,\n * and does not read back as one attribute.\n */\n COMPONENTS: \"W_COMPONENTS_FLATTENED\",\n /** A list column in a format without lists. */\n LIST: \"W_LIST_UNSUPPORTED\",\n /** A json column in a format without nested values. */\n JSON: \"W_JSON_UNSUPPORTED\",\n /** A declared default in a format without defaults. */\n DEFAULT: \"W_DEFAULT_DROPPED\",\n /** Declared options in a format without enumerations. */\n OPTIONS: \"W_OPTIONS_DROPPED\",\n /** A parent / parents column in a format without containment. */\n HIERARCHY: \"W_HIERARCHY_DROPPED\",\n /** A start / end / timestamp column in a format without temporal support. */\n TEMPORAL: TEMPORAL_DROPPED_CODE,\n /** A `<column>.text` companion the format cannot carry. */\n TEMPORAL_TEXT: TEMPORAL_TEXT_DROPPED_CODE,\n /** An attribute with a role the format has no place for is written as a plain attribute; the role is lost. */\n ROLE: ROLE_DROPPED_CODE,\n /** A parents (multi-parent) column in a format with single containment only. */\n PARENTS: PARENTS_DROPPED_CODE,\n /** A mutual pair written as two directed edges without the mutual mark. */\n MUTUAL_EXPANDED: MUTUAL_EXPANDED_CODE,\n /** A mutual pair written as one undirected edge; the mark is lost and the pair reads back undirected. */\n MUTUAL_AS_UNDIRECTED: MUTUAL_AS_UNDIRECTED_CODE,\n /** Node ids whose written text reads back as the other type under the importer's id rule. */\n ID_TEXT_TYPE: ID_TEXT_TYPE_CODE,\n /**\n * Two node ids would be written as the same text (the number 5 and the text \"5\"); the save fails with\n * E_INVALID_ID.\n */\n ID_TEXT_COLLISION: ID_TEXT_COLLISION_CODE,\n /**\n * An attribute without the weight role is named like the attribute graph-io reads weights from (for example, `weight`), so\n * it reads back as the edge weight.\n */\n WEIGHT_KEY_CLASH: WEIGHT_KEY_CLASH_CODE,\n /**\n * An attribute without a role is written where the format keeps a role (for example, a `name` column as the label), and\n * reads back with that role.\n */\n ROLE_ASSUMED: ROLE_ASSUMED_CODE,\n /**\n * An attribute with a role (for example, the label) is written where the format keeps that role, and reads back under the\n * name the format's importer gives it.\n */\n COLUMN_NAME_CHANGED: COLUMN_RENAMED_LOSS_CODE,\n /** A declared column whose every row is unset vanishes through a format without declarations. */\n EMPTY_COLUMN: EMPTY_COLUMN_DROPPED_CODE,\n /**\n * A text attribute reads back as a dictionary attribute, or the reverse, because the importer chooses by how often\n * its values repeat. The values are the same.\n */\n STORAGE_CLASS: STORAGE_CLASS_CODE,\n /**\n * A number attribute whose values are all whole numbers reads back as integers, because the format does not record\n * the type.\n */\n INTEGRAL_F64: INTEGRAL_F64_CODE,\n /**\n * A text value that reads back as a number or a boolean, because the format does not record that it was text (the\n * text \"42\" reads back as the number 42).\n */\n TEXT_INFERRED: TEXT_INFERRED_CODE,\n /** A text value holds a character XML 1.0 forbids (most control characters); the save fails with E_COLUMN_TYPE. */\n XML_ILLEGAL_CHAR: XML_ILLEGAL_CHAR_CODE,\n /**\n * A text attribute stored as a dictionary, without a declared list of allowed values, reads back with its distinct\n * values as that list.\n */\n OPTIONS_GAINED: OPTIONS_GAINED_CODE,\n /** A spells column in a format without spells. */\n SPELLS: \"W_SPELLS_DROPPED\",\n /** Dynamic attribute values (extension tables) in a format without them. */\n DYNAMIC_VALUES: \"W_DYNAMIC_VALUES_DROPPED\",\n /** An open-interval column in a format without open intervals. */\n OPEN_INTERVAL: \"W_OPEN_INTERVAL\",\n /** Graph-level attributes in a format without them. */\n GRAPH_ATTRIBUTES: \"W_GRAPH_ATTRIBUTES_DROPPED\",\n /** A position column in a format without positions. */\n POSITIONS: \"W_POSITIONS_DROPPED\",\n /** Visual columns in a format without them. */\n VIZ: \"W_VIZ_DROPPED\",\n /** An extension table the format cannot carry. */\n EXTENSION_TABLE: \"W_EXTENSION_TABLE_DROPPED\",\n /** A NaN or infinite number the format cannot spell; not written (or written as null), it reads back unset. */\n NONFINITE_AS_NULL: NONFINITE_AS_NULL_CODE,\n /**\n * The graph has edge weights and the file does not keep them (the format has no weights, or an option turned them\n * off): every edge reads back with the default weight 1.\n */\n WEIGHTS_DROPPED: WEIGHTS_DROPPED_CODE,\n});\n\n/**\n * The error a save throws for the first `E_` note of a check() result, or null when there is none.\n * An exporter calls it before it writes anything, so every format refuses a save the same way: an\n * id note (E_ID_CHARSET, E_ID_TEXT_COLLISION) throws E_INVALID_ID, E_MIXED_DIRECTION throws\n * E_DIRECTED, E_XML_ILLEGAL_CHAR throws E_COLUMN_TYPE, and any other note E_UNSUPPORTED. Map your\n * own note codes onto these with `codes`. The error's `details.code` is the note's code.\n * @param notes - what check() returned\n * @param codes - the error code for each of your own note codes, such as\n * `{ E_PAIRS_BAD_ID: \"E_INVALID_ID\" }`\n * @returns the error to throw, or null\n * @category Writing a format\n */\nexport function refusedSave(\n notes: readonly LossNote[],\n codes: Readonly<Record<string, \"E_INVALID_ID\" | \"E_DIRECTED\" | \"E_COLUMN_TYPE\" | \"E_UNSUPPORTED\">> = {},\n): GraphFormatError | null {\n const note = notes.find((n) => n.code.startsWith(\"E_\"));\n if (note === undefined) {\n return null;\n }\n const code = codes[note.code] ?? REFUSAL_CODES[note.code] ?? \"E_UNSUPPORTED\";\n return new GraphFormatError(code, note.message, { code: note.code, column: note.column, count: note.count });\n}\n\n/** The error codes a refused save throws. */\ntype RefusalCode = \"E_INVALID_ID\" | \"E_DIRECTED\" | \"E_COLUMN_TYPE\" | \"E_UNSUPPORTED\";\n\n/** The error code a save throws for each shared refusal note. */\nconst REFUSAL_CODES: Readonly<Record<string, RefusalCode>> = {\n [ID_CHARSET_REFUSAL]: \"E_INVALID_ID\",\n [ID_TEXT_COLLISION_CODE]: \"E_INVALID_ID\",\n [MIXED_DIRECTION_CODE]: \"E_DIRECTED\",\n [XML_ILLEGAL_CHAR_CODE]: \"E_COLUMN_TYPE\",\n};\n\n/**\n * The capabilities of a format that keeps nothing beyond plain topology; the base every exporter overrides.\n * @category Plugin helpers\n */\nexport const NO_CAPABILITIES: ExportCapabilities = Object.freeze({\n mixedDirection: false,\n multiEdges: false,\n selfLoops: false,\n edgeIds: \"none\",\n idCharset: \"any\",\n dtypes: Object.freeze([]),\n components: false,\n lists: false,\n json: false,\n defaults: false,\n options: false,\n hierarchy: false,\n temporal: \"none\",\n graphAttributes: false,\n positions: false,\n viz: false,\n});\n\n/**\n * Build a capabilities table from the fields a format supports; every field left out is the\n * conservative NO_CAPABILITIES value, so an exporter states what it keeps and nothing is assumed.\n * @param supported - the fields the format supports\n * @returns a frozen table\n * @category Writing a format\n */\nexport function capabilities(supported: Partial<ExportCapabilities>): ExportCapabilities {\n return Object.freeze({ ...NO_CAPABILITIES, ...supported, dtypes: Object.freeze([...(supported.dtypes ?? [])]) });\n}\n\n/**\n * Format facts checkCapabilities() needs that the capabilities table does not carry.\n * @public\n * @category Writing a format\n */\nexport interface CheckExtras {\n /** Whether the format can write open intervals (GEXF 1.2 startopen / endopen); default false. */\n readonly openIntervals?: boolean | undefined;\n /**\n * Whether the format carries the `<column>.text` companion columns (the lexical\n * form of a temporal value); default false, and every companion is then reported as\n * W_TEMPORAL_TEXT_DROPPED.\n */\n readonly temporalText?: boolean | undefined;\n /**\n * The dtype the format's importer gives a position column; an f32 / f64 position of the other\n * dtype is reported as W_DTYPE_UNSUPPORTED because its values differ at the other precision.\n * Undefined skips the check.\n */\n readonly positionDtype?: Dtype | undefined;\n /**\n * The roles beyond the structural, position, viz, hierarchy and temporal ones that the format\n * has a slot for (`label`, `kind`, `labels`, `idSpace`, `sourcePort`, `targetPort`, ...); a\n * column with any other role is written as a plain attribute and reported as W_ROLE_DROPPED.\n * Defaults to none.\n */\n readonly roles?: ReadonlySet<string> | undefined;\n /**\n * Roles the format writes into a fixed slot whose importer reads them back under a fixed name;\n * a role column named otherwise is reported as W_COLUMN_NAME_CHANGED (role -> the name the\n * importer gives it). Defaults to none. `nodeRoleNames` and `edgeRoleNames` override it for one\n * kind, for a format whose slot exists for nodes only (or edges only).\n */\n readonly roleNames?: Readonly<Record<string, string>> | undefined;\n /** Like `roleNames`, for node columns only. */\n readonly nodeRoleNames?: Readonly<Record<string, string>> | undefined;\n /** Like `roleNames`, for edge columns only: `{}` for a format with no edge slot for any role. */\n readonly edgeRoleNames?: Readonly<Record<string, string>> | undefined;\n /**\n * False for a format that writes no node or edge attributes except the ones whose role is in\n * `roles`: every other attribute column is reported once as W_COLUMN_DROPPED, instead of the\n * type and role notes a written column gets. Default true. `nodeAttributes` and\n * `edgeAttributes` override it for one kind.\n */\n readonly attributes?: boolean | undefined;\n /** Like `attributes`, for node attributes only: false for a format that writes no node attributes. */\n readonly nodeAttributes?: boolean | undefined;\n /** Like `attributes`, for edge attributes only: false for a format that writes no edge attributes. */\n readonly edgeAttributes?: boolean | undefined;\n /**\n * Columns the format writes although it writes no other attributes: a column a format option\n * names, such as an edge label column. Keyed by `node` or `edge`. They get no W_COLUMN_DROPPED\n * note; the type notes of a written column still apply.\n */\n readonly writtenColumns?: Readonly<Partial<Record<\"node\" | \"edge\", readonly string[]>>> | undefined;\n /**\n * False for a format (or an option) that writes no edge weights: a weighted graph gets one\n * W_WEIGHTS_DROPPED note. Default true.\n */\n readonly weights?: boolean | undefined;\n /**\n * The tables the export writes, of \"node\", \"edge\" and \"graph\"; a gap in a table it does not\n * write is not a loss of this export and gets no note. Default all three. A CSV node table is\n * `[\"node\"]`, so its notes are about node ids and node columns only.\n */\n readonly tables?: readonly (\"node\" | \"edge\" | \"graph\")[] | undefined;\n /**\n * How the format's importer turns id text back into ids (\"canonical\" for most text formats), so\n * an id that comes back with another type (the text \"7\" as the number 7) is reported as\n * W_ID_TEXT_TYPE. Omit it when the format records each id's type.\n */\n readonly idsReadBack?: IdCoercion | undefined;\n /**\n * True for a format that writes a column with the role `color`, `size`, `shape` or `thickness` as a plain\n * attribute when it has no slot for it: its W_VIZ_DROPPED note then says the value is kept and the role is lost.\n * Default false: the note says the column cannot be written.\n *\n * Deprecated behavior, kept unchanged until the next major version: a writer that stores a role column as a plain\n * attribute (JSON, Neo4j CSV) keeps writing it that way. Styles reach a file through the style writer\n * (`ExportOptions.styles`); in the next major version role columns are written only into a format's style slots.\n */\n readonly vizAsAttributes?: boolean | undefined;\n}\n\n/**\n * The deprecated `ExportCapabilities.viz` fact, read only by the deprecated role-column notes below, which are what it\n * describes.\n */\ninterface RoleSlots {\n readonly viz: boolean;\n}\n\n/** The roles checkCapabilities() treats structurally rather than as attribute columns. */\nconst STRUCTURAL_ROLES: ReadonlySet<string> = new Set([\"directed\", \"pair\", \"mutual\", \"weight\", \"originalId\"]);\nconst VIZ_ROLES: ReadonlySet<string> = new Set([\"color\", \"size\", \"shape\", \"thickness\"]);\nconst TEMPORAL_ROLES: ReadonlySet<string> = new Set([\"start\", \"end\", \"timestamp\", \"timestamps\"]);\nconst HIERARCHY_ROLES: ReadonlySet<string> = new Set([\"parent\", \"parents\"]);\n\n/**\n * The generic pre-flight check: compare a snapshot with a format's capabilities\n * and return one LossNote per gap, with the shared codes of LOSS. Format-specific notes are the\n * exporter's to append.\n * @param snapshot - the snapshot about to be exported\n * @param caps - the exporter's capabilities\n * @param options - the resolved common export options\n * @param extras - format facts the capabilities table does not carry\n * @returns the notes, empty when the export is exact\n * @category Writing a format\n */\nexport function checkCapabilities(\n snapshot: GraphSnapshot,\n caps: ExportCapabilities,\n options: ResolvedExportOptions,\n extras: CheckExtras = {},\n): LossNote[] {\n const notes: LossNote[] = [];\n const note = (code: string, message: string, column: string | null = null, count: number | null = null): void => {\n notes.push(Object.freeze({ code, message, column, count }));\n };\n const tables = extras.tables ?? [\"node\", \"edge\", \"graph\"];\n const edges = tables.includes(\"edge\");\n\n if (edges) {\n checkEdgeStructure(snapshot, caps, options, note);\n }\n\n const unrepresentable = countUnrepresentableIds(snapshot, caps.idCharset);\n if (unrepresentable > 0) {\n if (caps.idCharset === \"dense-1-based\") {\n note(\n LOSS.ID_RENUMBERED,\n options.sanitizeIds === \"mangle\"\n ? `${unrepresentable} node id${plural(unrepresentable)} ${agree(unrepresentable, \"is\", \"are\")} not their 1-based index; nodes are numbered 1..N, the original ids are written too, and an import with restoreMangledIds: true reads them back as the ids; they are also the labels of nodes without a label value`\n : `${unrepresentable} node id${plural(unrepresentable)} ${agree(unrepresentable, \"is\", \"are\")} not their 1-based index; nodes are numbered 1..N and ids kept as labels of the nodes without a label value (a node with one loses its id)`,\n null,\n unrepresentable,\n );\n } else if (options.sanitizeIds === \"mangle\") {\n note(\n LOSS.ID_MANGLED,\n `${unrepresentable} node id${plural(unrepresentable)} ${charsetText(caps.idCharset, unrepresentable)}, so they are rewritten; the original ids are written too, and an import with restoreMangledIds: true reads them back`,\n null,\n unrepresentable,\n );\n } else {\n note(\n LOSS.ID_CHARSET,\n `${unrepresentable} node id${plural(unrepresentable)} ${charsetText(caps.idCharset, unrepresentable)}, so the save fails unless sanitizeIds is \"mangle\"`,\n null,\n unrepresentable,\n );\n }\n }\n\n if (extras.idsReadBack !== undefined) {\n let retyped = 0;\n for (let i = 0; i < snapshot.nodeCount; i++) {\n const id = snapshot.ids.idOf(i);\n if (coerceIdText(String(id), extras.idsReadBack) !== id) {\n retyped++;\n }\n }\n if (retyped > 0) {\n note(\n LOSS.ID_TEXT_TYPE,\n `${retyped} node id${plural(retyped)} ${agree(retyped, \"reads\", \"read\")} back with another type (a number as text, or text as a number)`,\n null,\n retyped,\n );\n }\n }\n\n if (edges) {\n checkWeights(snapshot, extras, note);\n }\n if (tables.includes(\"node\")) {\n checkColumns(snapshot.nodes, \"node\", caps, extras, note);\n }\n if (edges) {\n checkColumns(snapshot.edges, \"edge\", caps, extras, note);\n }\n const graphColumns = tables.includes(\"graph\") ? snapshot.graph.names() : [];\n if (graphColumns.length > 0) {\n if (caps.graphAttributes) {\n checkColumns(snapshot.graph, \"graph\", caps, extras, note);\n } else {\n notes.push(\n Object.freeze({\n code: LOSS.GRAPH_ATTRIBUTES,\n message: `${graphColumns.length} graph attribute${plural(graphColumns.length)} cannot be written`,\n column: null,\n count: graphColumns.length,\n columns: Object.freeze([...graphColumns]),\n }),\n );\n }\n }\n\n for (const [name, table] of snapshot.extensions) {\n // \"temporal:node:<column>\" is the node table's, \"temporal:edge:<column>\" the edge table's;\n // any other extension table is the graph's.\n const [, kind] = name.split(\":\");\n const owner = name.startsWith(\"temporal:\") && (kind === \"node\" || kind === \"edge\") ? kind : \"graph\";\n if (!tables.includes(owner)) {\n continue;\n }\n if (name.startsWith(\"temporal:\")) {\n if (caps.temporal !== \"dynamic-values\") {\n note(\n LOSS.DYNAMIC_VALUES,\n `dynamic values of \"${name}\" (${table.rowCount} row${plural(table.rowCount)}) cannot be written`,\n name,\n table.rowCount,\n );\n }\n } else {\n note(\n LOSS.EXTENSION_TABLE,\n `extension table \"${name}\" (${table.rowCount} row${plural(table.rowCount)}) cannot be written`,\n name,\n table.rowCount,\n );\n }\n }\n return notes;\n}\n\n/**\n * The edge-structure checks of checkCapabilities(): direction, parallel edges, self-loops and\n * edge ids. Skipped for an export that writes no edge table.\n * @param snapshot - the snapshot about to be exported\n * @param caps - the exporter's capabilities\n * @param options - the resolved common export options\n * @param note - the recorder\n */\nfunction checkEdgeStructure(\n snapshot: GraphSnapshot,\n caps: ExportCapabilities,\n options: ResolvedExportOptions,\n note: NoteFn,\n): void {\n // mixed direction (design section 3.6): an expanded snapshot carries the pair / directed roles\n const mixed = countMixedEdges(snapshot);\n if (mixed > 0 && !caps.mixedDirection) {\n if (options.onMixedDirection === \"error\") {\n note(\n LOSS.MIXED_DIRECTION_ERROR,\n `${mixed} undirected edge${plural(mixed)} in a directed graph, and the format holds one direction per file, so the save fails unless onMixedDirection is \"directed\" or \"undirected\"`,\n null,\n mixed,\n );\n } else {\n note(\n LOSS.MIXED_DIRECTION,\n `${mixed} undirected edge${plural(mixed)} in a directed graph ${agree(mixed, \"is\", \"are\")} written as ${options.onMixedDirection} (onMixedDirection), and the format holds one direction per file`,\n null,\n mixed,\n );\n }\n }\n\n if (snapshot.flags.multigraph && !caps.multiEdges) {\n const parallel = countParallelArcs(snapshot);\n note(\n LOSS.MULTI_EDGES,\n `${parallel} parallel edge${plural(parallel)}; the format has no parallel edges`,\n null,\n parallel,\n );\n }\n if (snapshot.selfLoopCount > 0 && !caps.selfLoops) {\n note(\n LOSS.SELF_LOOPS,\n `${snapshot.selfLoopCount} self-loop${plural(snapshot.selfLoopCount)}; the format has no self-loops`,\n null,\n snapshot.selfLoopCount,\n );\n }\n\n const edgeIds = snapshot.edges.byRole(\"id\");\n if (caps.edgeIds === \"required\" && edgeIds === null && snapshot.edgeCount > 0) {\n note(\n LOSS.EDGE_IDS_GENERATED,\n \"the format requires edge ids, and the graph has none; the edges are written with generated ids, which read back as a new edge id column\",\n null,\n snapshot.edgeCount,\n );\n } else if (caps.edgeIds === \"none\" && edgeIds !== null) {\n note(\n LOSS.EDGE_IDS_DROPPED,\n `edge id column \"${edgeIds.meta.name}\" cannot be written`,\n edgeIds.meta.name,\n snapshot.edgeCount,\n );\n }\n}\n\n/**\n * The ids a charset cannot hold, as a message phrase.\n * @param charset - the format's id charset\n * @param n - how many ids, for the verb\n * @returns the phrase\n */\nfunction charsetText(charset: ExportCapabilities[\"idCharset\"], n: number): string {\n const are = agree(n, \"is\", \"are\");\n switch (charset) {\n case \"nmtoken\":\n return `${are} not XML name tokens (letters, digits and . - _ : only; no spaces)`;\n case \"integer\":\n return `${are} not integers`;\n default:\n return `cannot be written as ${charset} ids`;\n }\n}\n\n/**\n * The role names of one kind (CheckExtras.nodeRoleNames / edgeRoleNames, else roleNames).\n * @param domain - \"node\", \"edge\" or \"graph\"\n * @param extras - format extras\n * @returns the role names, or undefined when the extras name none\n */\nfunction roleNamesOf(domain: string, extras: CheckExtras): Readonly<Record<string, string>> | undefined {\n if (domain === \"node\") {\n return extras.nodeRoleNames ?? extras.roleNames;\n }\n if (domain === \"edge\") {\n return extras.edgeRoleNames ?? extras.roleNames;\n }\n return extras.roleNames;\n}\n\n/**\n * Whether a format writes the attributes of one kind (CheckExtras.nodeAttributes / edgeAttributes, else attributes).\n * @param domain - \"node\", \"edge\" or \"graph\"\n * @param extras - format extras\n * @returns false when it writes none, undefined when the extras do not say\n */\nfunction writesAttributes(domain: string, extras: CheckExtras): boolean | undefined {\n if (domain === \"node\") {\n return extras.nodeAttributes ?? extras.attributes;\n }\n if (domain === \"edge\") {\n return extras.edgeAttributes ?? extras.attributes;\n }\n return extras.attributes;\n}\n\n/**\n * The note of a format (or an option) that writes no weights, for a weighted graph.\n * @param snapshot - the snapshot\n * @param extras - format extras\n * @param note - the recorder\n */\nfunction checkWeights(snapshot: GraphSnapshot, extras: CheckExtras, note: NoteFn): void {\n if (extras.weights === false && explicitWeights(snapshot).weighted) {\n note(\n LOSS.WEIGHTS_DROPPED,\n `the edge weights are not written; ${snapshot.edgeCount} edge${plural(snapshot.edgeCount)} ${agree(snapshot.edgeCount, \"reads\", \"read\")} back with weight 1`,\n null,\n snapshot.edgeCount,\n );\n }\n}\n\n/** A note-recording callback. */\ntype NoteFn = (code: string, message: string, column?: string | null, count?: number | null) => void;\n\n/** How messages name what a column of a role holds. */\nconst ROLE_WORDS: Readonly<Record<string, string>> = {\n label: \"labels\",\n weight: \"weights\",\n id: \"ids\",\n position: \"positions\",\n originalId: \"original ids\",\n};\n\n/** What the per-column checks of checkCapabilities() read besides the column. */\ninterface ColumnCheck {\n /** The domain, for messages. */\n readonly domain: string;\n /** The capabilities. */\n readonly caps: ExportCapabilities;\n /** Format extras. */\n readonly extras: CheckExtras;\n /** The recorder. */\n readonly note: NoteFn;\n}\n\n/**\n * How many values a column holds.\n * @param column - the column\n * @returns the count of set cells\n */\nfunction setCount(column: Column): number {\n return column.length - column.nullCount;\n}\n\n/**\n * The per-column checks of checkCapabilities().\n * @param table - the table\n * @param domain - the domain, for messages\n * @param caps - the capabilities\n * @param extras - format extras\n * @param note - the recorder\n */\nfunction checkColumns(\n table: Iterable<Column>,\n domain: string,\n caps: ExportCapabilities,\n extras: CheckExtras,\n note: NoteFn,\n): void {\n const check: ColumnCheck = { domain, caps, extras, note };\n for (const column of table) {\n checkColumn(column, check);\n }\n}\n\n/**\n * The checks of one column.\n * @param column - the column\n * @param check - what the checks read\n */\nfunction checkColumn(column: Column, check: ColumnCheck): void {\n const { name, role } = column.meta;\n if (role !== null && STRUCTURAL_ROLES.has(role)) {\n return;\n }\n const label = `${check.domain} column \"${name}\"`;\n noteRoleRenamed(column, label, check);\n if (check.domain === \"edge\" && role === \"id\") {\n return;\n }\n if (isDropped(column, check)) {\n check.note(LOSS.COLUMN_DROPPED, `${label} is not written`, name, setCount(column));\n return;\n }\n const slot = role === null ? undefined : ROLE_SLOT_CHECKS.find(([holds]) => holds(role));\n if (slot !== undefined) {\n slot[1](column, label, check);\n return;\n }\n checkAttribute(column, label, check);\n}\n\n/**\n * COLUMN_NAME_CHANGED for a role column the format writes under a fixed name of its own.\n * @param column - the column\n * @param label - the column's label for messages\n * @param check - what the checks read\n */\nfunction noteRoleRenamed(column: Column, label: string, check: ColumnCheck): void {\n const { name, role } = column.meta;\n const fixed = role === null ? undefined : roleNamesOf(check.domain, check.extras)?.[role];\n if (role !== null && fixed !== undefined && fixed !== name) {\n check.note(\n LOSS.COLUMN_NAME_CHANGED,\n `${label} (the ${ROLE_WORDS[role] ?? role}) is written as the format's own ${role} and reads back as \"${fixed}\"`,\n name,\n setCount(column),\n );\n }\n}\n\n/**\n * Whether a column is not written at all: the format writes no attributes of its domain, and the column is neither\n * named as written nor of a role the format keeps.\n * @param column - the column\n * @param check - what the checks read\n * @returns true when it is dropped\n */\nfunction isDropped(column: Column, check: ColumnCheck): boolean {\n const { name, role } = column.meta;\n const { domain, extras } = check;\n const named = extras.writtenColumns?.[domain as \"node\" | \"edge\"]?.includes(name) ?? false;\n const kept = role !== null && (extras.roles?.has(role) ?? false);\n return writesAttributes(domain, extras) === false && !named && !kept;\n}\n\n/** The check of a column whose role has a slot of its own, or none: the column is not checked as an attribute. */\ntype RoleSlotCheck = (column: Column, label: string, check: ColumnCheck) => void;\n\n// The roles with slots of their own, each with its check: a role found here is not checked as an attribute.\nconst ROLE_SLOT_CHECKS: readonly (readonly [(role: string) => boolean, RoleSlotCheck])[] = [\n [\n (role) => role === \"timeText\",\n (column, label, check) => {\n if (check.extras.temporalText !== true) {\n check.note(\n LOSS.TEMPORAL_TEXT,\n `${label} (the original text of a date or time column) cannot be written`,\n column.meta.name,\n setCount(column),\n );\n }\n },\n ],\n [(role) => role === \"position\", checkPosition],\n // Deprecated path (removed in the next major version): the role columns as the old way styles reached a\n // file. With styles, the style writer is the only path and the caller leaves the role columns out.\n [(role) => VIZ_ROLES.has(role), checkViz],\n [\n (role) => HIERARCHY_ROLES.has(role),\n (column, label, check) => {\n if (!check.caps.hierarchy) {\n const { name, role } = column.meta;\n check.note(LOSS.HIERARCHY, `${label} (${String(role)}) cannot be written`, name, setCount(column));\n }\n },\n ],\n [\n (role) => TEMPORAL_ROLES.has(role),\n (column, label, check) => {\n if (check.caps.temporal === \"none\") {\n const { name, role } = column.meta;\n check.note(LOSS.TEMPORAL, `${label} (${String(role)}) cannot be written`, name, setCount(column));\n }\n },\n ],\n [\n (role) => role === \"spells\",\n (column, label, check) => {\n if (check.caps.temporal !== \"spells\" && check.caps.temporal !== \"dynamic-values\") {\n check.note(LOSS.SPELLS, `${label} (spells) cannot be written`, column.meta.name, setCount(column));\n }\n },\n ],\n [\n // The open bits are written by the format's own temporal syntax when it has one; the\n // column's u8 storage is never an attribute dtype, so no dtype note either way.\n (role) => role === \"open\" || role === \"spellsOpen\",\n (column, label, check) => {\n if (check.extras.openIntervals !== true) {\n check.note(\n LOSS.OPEN_INTERVAL,\n `${label} (open intervals) cannot be written`,\n column.meta.name,\n setCount(column),\n );\n }\n },\n ],\n];\n\n/**\n * The checks of a position column.\n * @param column - the column\n * @param label - the column's label for messages\n * @param check - what the checks read\n */\nfunction checkPosition(column: Column, label: string, check: ColumnCheck): void {\n const { caps, extras, note } = check;\n const { meta } = column;\n if (!caps.positions) {\n note(LOSS.POSITIONS, `${label} (positions) cannot be written`, meta.name, setCount(column));\n } else if (extras.positionDtype !== undefined && meta.dtype !== extras.positionDtype) {\n note(\n LOSS.DTYPE,\n `${label} (positions) is ${meta.dtype}; the format reads positions back as ${extras.positionDtype}`,\n meta.name,\n setCount(column),\n );\n }\n}\n\n/**\n * The checks of a deprecated style role column (color, size, shape, thickness).\n * @param column - the column\n * @param label - the column's label for messages\n * @param check - what the checks read\n */\nfunction checkViz(column: Column, label: string, check: ColumnCheck): void {\n const { caps, extras, note } = check;\n if ((caps as RoleSlots).viz) {\n return;\n }\n const { name } = column.meta;\n const role = String(column.meta.role);\n note(\n LOSS.VIZ,\n extras.vizAsAttributes === true\n ? `${label} (${role}) is written as a plain attribute; the format has no ${role} slot and the role is lost on re-import`\n : `${label} (${role}) cannot be written`,\n name,\n setCount(column),\n );\n}\n\n/**\n * The checks of a column written as a plain attribute.\n * @param column - the column\n * @param label - the column's label for messages\n * @param check - what the checks read\n */\nfunction checkAttribute(column: Column, label: string, check: ColumnCheck): void {\n const { caps, extras, note } = check;\n const { meta } = column;\n const { name, role } = meta;\n if (role !== null && !(extras.roles?.has(role) ?? false)) {\n note(\n LOSS.ROLE,\n `${label} (${role}) is written as a plain attribute; the format has no ${role} slot and the role is lost`,\n name,\n setCount(column),\n );\n }\n if (meta.dynamic && caps.temporal !== \"dynamic-values\") {\n note(LOSS.DYNAMIC_VALUES, `${label} is dynamic; only its static value can be written`, name, null);\n }\n checkDtype(column, label, caps, note);\n if (meta.default !== undefined && !caps.defaults) {\n note(LOSS.DEFAULT, `${label} declares a default; the format has no defaults`, name, null);\n }\n if (meta.options !== null && !caps.options) {\n note(LOSS.OPTIONS, `${label} declares options; the format has no enumerations`, name, null);\n }\n}\n\n/**\n * The dtype checks of one attribute column: lists, nested values, scalar dtypes and strides\n * against the capability table.\n * @param column - the column\n * @param label - the column's label for messages\n * @param caps - the capabilities\n * @param note - the recorder\n */\nfunction checkDtype(column: Column, label: string, caps: ExportCapabilities, note: NoteFn): void {\n const { meta } = column;\n const { name } = meta;\n const set = column.length - column.nullCount;\n switch (meta.dtype) {\n case \"list\":\n if (!caps.lists) {\n note(LOSS.LIST, `${label} is a list; the format has no lists`, name, set);\n } else if (meta.itemDtype !== null && !caps.dtypes.includes(meta.itemDtype)) {\n note(\n LOSS.DTYPE,\n `${label} holds ${meta.itemDtype} items; the format cannot keep that dtype`,\n name,\n set,\n );\n } else if (meta.itemDtype === \"dict\") {\n // no format declares an enumeration for list items: they read back as strings\n note(LOSS.DTYPE, `${label} holds dict items; list items read back as string`, name, set);\n }\n break;\n case \"json\":\n if (!caps.json) {\n note(LOSS.JSON, `${label} holds nested values; the format has no nested values`, name, set);\n }\n break;\n default:\n if (!caps.dtypes.includes(meta.dtype)) {\n note(LOSS.DTYPE, `${label} is ${meta.dtype}; the format cannot keep that dtype`, name, set);\n }\n if (meta.components > 1 && !caps.components) {\n note(\n LOSS.COMPONENTS,\n `${label} has ${meta.components} components; the format has no strides`,\n name,\n set,\n );\n }\n break;\n }\n}\n\n/**\n * The number of source edges that were undirected in a directed snapshot (the halves of an\n * expanded pair count once; an expanded self-loop has no mirror and counts once).\n * @param snapshot - the snapshot\n * @returns the count; 0 for an undirected snapshot or one without the directed role\n * @category Plugin helpers\n */\nexport function countMixedEdges(snapshot: GraphSnapshot): number {\n if (!snapshot.directed) {\n return 0;\n }\n const directed = snapshot.edges.byRole(\"directed\");\n if (directed?.dtype !== \"bool\") {\n return 0;\n }\n const pair = snapshot.edges.byRole(\"pair\");\n let undirectedRows = 0;\n let paired = 0;\n for (let e = 0; e < snapshot.edgeCount; e++) {\n if (directed.isSet(e) && directed.value(e) === false) {\n undirectedRows++;\n if (pair !== null && pair.dtype === \"u32\" && pair.isSet(e) && pair.data[e] !== INVALID_INDEX) {\n paired++;\n }\n }\n }\n return paired / 2 + (undirectedRows - paired);\n}\n\n/**\n * The number of arcs that repeat the previous arc's target within a row (parallel edges), counted\n * over the forward CSR; an undirected parallel edge is counted in both rows.\n * @param snapshot - the snapshot\n * @returns the count\n * @category Plugin helpers\n */\nexport function countParallelArcs(snapshot: GraphSnapshot): number {\n const { rowPtr, colIdx, nodeCount } = snapshot;\n let count = 0;\n for (let u = 0; u < nodeCount; u++) {\n for (let a = rowPtr[u] + 1; a < rowPtr[u + 1]; a++) {\n if (colIdx[a] === colIdx[a - 1]) {\n count++;\n }\n }\n }\n return snapshot.directed ? count : Math.ceil(count / 2);\n}\n\n// ============================================================ id sanitising\n\n/**\n * The id charsets of ExportCapabilities.\n * @public\n * @category Plugin helpers\n */\nexport type IdCharset = ExportCapabilities[\"idCharset\"];\n\n/**\n * The ids to write for every node after sanitising.\n * @public\n * @category Writing a format\n */\nexport interface SanitizedIds {\n /** The charset applied. */\n readonly charset: IdCharset;\n /** How many ids differ from the snapshot's. */\n readonly changed: number;\n /**\n * The id to write for a node.\n * @param index - the node index\n * @returns the id as the format will read it back\n */\n idAt(index: number): NodeId;\n /**\n * Whether a node's written id differs from its original.\n * @param index - the node index\n * @returns true when the exporter must record the original\n */\n isChanged(index: number): boolean;\n /**\n * The original id of a node.\n * @param index - the node index\n * @returns the snapshot's id\n */\n originalAt(index: number): NodeId;\n}\n\n/** XML NameChar ranges (XML 1.0 fifth edition), as inclusive code point pairs. */\nconst NAME_CHAR_RANGES: readonly (readonly [number, number])[] = [\n [0x2d, 0x2e],\n [0x30, 0x3a],\n [0x41, 0x5a],\n [0x5f, 0x5f],\n [0x61, 0x7a],\n [0xb7, 0xb7],\n [0xc0, 0xd6],\n [0xd8, 0xf6],\n [0xf8, 0x37d],\n [0x37f, 0x1fff],\n [0x200c, 0x200d],\n [0x203f, 0x2040],\n [0x2070, 0x218f],\n [0x2c00, 0x2fef],\n [0x3001, 0xd7ff],\n [0xf900, 0xfdcf],\n [0xfdf0, 0xfffd],\n [0x10000, 0xeffff],\n];\n\n/**\n * Whether a code point is an XML NameChar.\n * @param cp - the code point\n * @returns true when it may appear in an NMTOKEN\n * @category Plugin helpers\n */\nexport function isNameChar(cp: number): boolean {\n for (const [lo, hi] of NAME_CHAR_RANGES) {\n if (cp < lo) {\n return false;\n }\n if (cp <= hi) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Whether a text is an XML NMTOKEN (one or more NameChars; GraphML node and edge ids).\n * @param text - the text\n * @returns true for a non-empty text of NameChars\n * @category Plugin helpers\n */\nexport function isNmtoken(text: string): boolean {\n if (text.length === 0) {\n return false;\n }\n for (const ch of text) {\n const cp = ch.codePointAt(0);\n if (cp === undefined || !isNameChar(cp)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Whether an id can be written unchanged under a charset.\n * @param id - the id\n * @param charset - the charset\n * @returns true when the id needs no rewriting (\"dense-1-based\" is never true: see sanitizeIds)\n * @category Plugin helpers\n */\nexport function isRepresentableId(id: NodeId, charset: IdCharset): boolean {\n switch (charset) {\n case \"any\":\n return true;\n case \"nmtoken\":\n return isNmtoken(String(id));\n case \"integer\":\n return typeof id === \"number\" && Number.isSafeInteger(id);\n case \"dense-1-based\":\n return false;\n default: {\n const name: string = charset;\n throw new GraphFormatError(\"E_UNSUPPORTED\", `unknown id charset ${name}`, { charset: name });\n }\n }\n}\n\n/**\n * How many node ids a charset cannot hold as they are (for check()); under \"dense-1-based\" the\n * ids that are not their own 1-based index.\n * @param snapshot - the snapshot\n * @param charset - the charset\n * @returns the count\n * @category Plugin helpers\n */\nexport function countUnrepresentableIds(snapshot: GraphSnapshot, charset: IdCharset): number {\n const { ids } = snapshot;\n if (charset === \"any\") {\n return 0;\n }\n if (charset === \"dense-1-based\") {\n if (ids.kind === \"identity\" && ids.offset === 1) {\n return 0;\n }\n let changed = 0;\n for (let i = 0; i < ids.size; i++) {\n if (ids.idOf(i) !== i + 1) {\n changed++;\n }\n }\n return changed;\n }\n let count = 0;\n for (let i = 0; i < ids.size; i++) {\n if (!isRepresentableId(ids.idOf(i), charset)) {\n count++;\n }\n }\n return count;\n}\n\n/**\n * Sanitise the node ids for a charset. Under \"error\" any id the charset\n * cannot hold is E_INVALID_ID (details.reason \"charset\") and nothing is written; under \"mangle\"\n * such ids are rewritten deterministically and uniquely: NMTOKEN by replacing every other\n * character with `_` (an empty result becomes `_`) and suffixing `_2`, `_3`... on collision;\n * integer by the smallest unused non-negative integers in index order. \"dense-1-based\" always\n * writes the 1-based index (Pajek numbers vertices; the exporter writes the original id as the\n * label), which is a renumbering rather than a mangling, so it never throws under \"error\"; under\n * \"mangle\" the exporter also writes the original id under its originalId attribute.\n * @param snapshot - the snapshot\n * @param charset - the charset\n * @param mode - the resolved sanitizeIds option\n * @returns the ids to write\n * @category Writing a format\n */\nexport function sanitizeIds(snapshot: GraphSnapshot, charset: IdCharset, mode: \"error\" | \"mangle\"): SanitizedIds {\n const { ids } = snapshot;\n const n = ids.size;\n if (charset === \"dense-1-based\") {\n const changed = countUnrepresentableIds(snapshot, charset);\n return {\n charset,\n changed,\n idAt: (i: number): NodeId => i + 1,\n isChanged: (i: number): boolean => ids.idOf(i) !== i + 1,\n originalAt: (i: number): NodeId => ids.idOf(i),\n };\n }\n const unchanged: SanitizedIds = {\n charset,\n changed: 0,\n idAt: (i: number): NodeId => ids.idOf(i),\n isChanged: (): boolean => false,\n originalAt: (i: number): NodeId => ids.idOf(i),\n };\n if (charset === \"any\") {\n return unchanged;\n }\n const bad: number[] = [];\n for (let i = 0; i < n; i++) {\n if (!isRepresentableId(ids.idOf(i), charset)) {\n bad.push(i);\n }\n }\n if (bad.length === 0) {\n return unchanged;\n }\n if (mode === \"error\") {\n const first = ids.idOf(bad[0]);\n throw new GraphFormatError(\n \"E_INVALID_ID\",\n `${bad.length} node id${plural(bad.length)} ${charsetText(charset, bad.length)} (first: ${JSON.stringify(first)} at index ${bad[0]}); pass sanitizeIds: \"mangle\" to rewrite them`,\n { reason: \"charset\", charset, count: bad.length, id: first, index: bad[0] },\n );\n }\n const written = new Map<number, NodeId>();\n if (charset === \"nmtoken\") {\n const used = new Set<string>();\n for (let i = 0; i < n; i++) {\n const id = ids.idOf(i);\n if (isRepresentableId(id, charset)) {\n used.add(String(id));\n }\n }\n for (const i of bad) {\n const base = mangleNmtoken(String(ids.idOf(i)));\n let candidate = base;\n for (let k = 2; used.has(candidate); k++) {\n candidate = `${base}_${k}`;\n }\n used.add(candidate);\n written.set(i, candidate);\n }\n } else {\n const used = new Set<number>();\n for (let i = 0; i < n; i++) {\n const id = ids.idOf(i);\n if (typeof id === \"number\" && Number.isSafeInteger(id)) {\n used.add(id);\n }\n }\n let next = 0;\n for (const i of bad) {\n while (used.has(next)) {\n next++;\n }\n used.add(next);\n written.set(i, next);\n next++;\n }\n }\n return {\n charset,\n changed: bad.length,\n idAt: (i: number): NodeId => written.get(i) ?? ids.idOf(i),\n isChanged: (i: number): boolean => written.has(i),\n originalAt: (i: number): NodeId => ids.idOf(i),\n };\n}\n\n/**\n * Rewrite a text as an NMTOKEN: every character that is not a NameChar becomes `_`.\n * @param text - the text\n * @returns a non-empty NMTOKEN\n * @category Plugin helpers\n */\nexport function mangleNmtoken(text: string): string {\n let out = \"\";\n for (const ch of text) {\n const cp = ch.codePointAt(0);\n out += cp !== undefined && isNameChar(cp) ? ch : \"_\";\n }\n return out.length === 0 ? \"_\" : out;\n}\n"],"names":["DATE_TIME","TIME","INTEGER_TEXT","list"],"mappings":";;;;AA0CO,MAAM,iBAA6B;AAMnC,MAAM,mBAAmB;AAEhC,MAAMA,cACF;AACJ,MAAMC,SAAO;AACb,MAAM,UAAU;AAEhB,MAAM,gBAAgB;AACtB,MAAM,aAAa;AASZ,SAAS,cAAc,MAAc,MAAmC;AAC3E,MAAI;AACJ,UAAQ,MAAA;AAAA,IACJ,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACD,cAAQ,cAAc,MAAM,IAAI;AAChC;AAAA,IACJ,KAAK;AAAA,IACL,KAAK;AACD,cAAQ,UAAU,MAAM,IAAI;AAC5B;AAAA,IACJ,SAAS;AACL,YAAM,OAAe;AACrB,YAAM,IAAI,iBAAiB,iBAAiB,yBAAyB,IAAI,IAAI,E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,MAAM;AACnB,UAAM,KAAK,GAAG,YAAY,CAAC;AAC3B,WAAO,OAAO,UAAa,WAAW,EAAE,IAAI,KAAK;AAAA,EACrD;AACA,SAAO,IAAI,WAAW,IAAI,MAAM;AACpC;"}
@@ -1,8 +1,10 @@
1
1
  import { GraphFormatError, INVALID_INDEX } from "@graphty/graph-format";
2
- import { S as SINK_OPTION_CODE, O as OPTION_IGNORED_CODE, R as ROLE_TAKEN_CODE, I as ID_MERGED_CODE, f as DANGLING_REFERENCE_CODE, d as UNKNOWN_ELEMENT_CODE, l as DUPLICATE_ATTRIBUTE_CODE, k as DUPLICATE_NODE_CODE, Y as BAD_VALUE_CODE, o as MISSING_ID_CODE, s as UNKNOWN_ENCODING_CODE, t as ENCODING_FALLBACK_CODE, u as INVALID_ENCODING_CODE, v as INVALID_UTF8_CODE, E as EMPTY_INPUT_CODE, y as ELEMENT_ISSUE, z as INPUT_ISSUE, Z as ImportReportBuilder, p as plural, a as agree, aa as ROLE_ASSUMED_CODE, af as NODE_ORDER_CODE, ag as GRAPH_COLUMN_AS_METADATA_CODE, ah as TYPEDEF_NODES_CODE, ai as RELATION_ASSUMED_CODE, a9 as COLUMN_AS_PROPERTY_VALUE_CODE, ab as formatNumber } from "./format-BpQBx8MZ.js";
3
- import { R as RENAMED_CODE, g as resolveImportOptions, j as reportSinkOptions, i as reportUnusedOptions, h as throwIfAborted, d as declareResolved, I as IdCoercer, l as DirectionResolver, P as LineReader, c as capabilities, L as LOSS, r as resolveExportOptions, p as pairFolding, e as explicitWeights } from "./export-BvqAXCKh.js";
4
- import { S as SYNONYM_SCOPES, O as OBO_NODE_COLUMNS, o as oboColumnDecl, P as PLACEHOLDER_COLUMN, f as framelessNodes, m as movedNodes, s as slotColumn, c as capabilityNotes, e as emptyColumnNotes, a as cellOf, F as FRAME_KINDS$1, U as UNWRITTEN_ROLES, n as notePropertyColumn, b as fitsVocabulary, i as isQualifierRecord, t as textOf } from "./ontology-export-G4MqRdux.js";
2
+ import { S as SINK_OPTION_CODE, O as OPTION_IGNORED_CODE, R as ROLE_TAKEN_CODE, I as ID_MERGED_CODE, f as DANGLING_REFERENCE_CODE, d as UNKNOWN_ELEMENT_CODE, l as DUPLICATE_ATTRIBUTE_CODE, k as DUPLICATE_NODE_CODE, T as BAD_VALUE_CODE, o as MISSING_ID_CODE, s as UNKNOWN_ENCODING_CODE, t as ENCODING_FALLBACK_CODE, u as INVALID_ENCODING_CODE, v as INVALID_UTF8_CODE, E as EMPTY_INPUT_CODE, y as ELEMENT_ISSUE, z as INPUT_ISSUE, K as ImportReportBuilder, p as plural, a as agree, a9 as ROLE_ASSUMED_CODE, ad as NODE_ORDER_CODE, ae as GRAPH_COLUMN_AS_METADATA_CODE, af as TYPEDEF_NODES_CODE, ag as RELATION_ASSUMED_CODE, a8 as COLUMN_AS_PROPERTY_VALUE_CODE } from "./report-CwMfYa9J.js";
3
+ import { D as DirectionResolver, p as pairFolding, b as formatNumber } from "./format-BXiAb-1h.js";
4
+ import { R as RENAMED_CODE, b as resolveImportOptions, f as reportSinkOptions, d as reportUnusedOptions, i as declareResolved, I as IdCoercer, c as capabilities, L as LOSS, r as resolveExportOptions, e as explicitWeights } from "./export-Cha4dRFz.js";
5
+ import { S as SYNONYM_SCOPES, O as OBO_NODE_COLUMNS, o as oboColumnDecl, P as PLACEHOLDER_COLUMN, f as framelessNodes, m as movedNodes, s as slotColumn, c as capabilityNotes, e as emptyColumnNotes, a as cellOf, F as FRAME_KINDS$1, U as UNWRITTEN_ROLES, n as notePropertyColumn, b as fitsVocabulary, i as isQualifierRecord, t as textOf } from "./ontology-export-OMo91mb0.js";
5
6
  import { j as joinText, e as encodeChunks } from "./writer-DxjgHwSe.js";
7
+ import { b as throwIfAborted, L as LineReader } from "./input-CAxt_aV-.js";
6
8
  const ESCAPES = Object.freeze({
7
9
  n: "\n",
8
10
  t: " ",
@@ -3491,4 +3493,4 @@ export {
3491
3493
  oboImporter as c,
3492
3494
  oboExporter as o
3493
3495
  };
3494
- //# sourceMappingURL=exporter--Mk9gXCJ.js.map
3496
+ //# sourceMappingURL=exporter-BP6otMO6.js.map