@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
@@ -1,14 +1,17 @@
1
1
  import { GraphFormatError, INVALID_INDEX } from "@graphty/graph-format";
2
- import { R as ROLE_TAKEN_CODE, C as COLUMN_RENAMED_CODE, l as DUPLICATE_ATTRIBUTE_CODE, d as UNKNOWN_ELEMENT_CODE, ax as EMPTY_COLUMN_DROPPED_CODE, a6 as PARENT_CYCLE_CODE, P as PRECISION_CODE, s as UNKNOWN_ENCODING_CODE, W as JSON_NONSTANDARD_NUMBER_CODE, t as ENCODING_FALLBACK_CODE, u as INVALID_ENCODING_CODE, v as INVALID_UTF8_CODE, O as OPTION_IGNORED_CODE, S as SINK_OPTION_CODE, H as HYPEREDGE_CODE, a1 as TOO_LARGE_CODE, f as DANGLING_REFERENCE_CODE, a2 as AMBIGUOUS_GRAPH_NAME_CODE, a3 as GRAPH_NOT_FOUND_CODE, i as MULTIPLE_GRAPHS_CODE, I as ID_MERGED_CODE, j as DUPLICATE_EDGE_ID_CODE, k as DUPLICATE_NODE_CODE, m as UNKNOWN_PARENT_CODE, Y as BAD_VALUE_CODE, n as MISSING_ENDPOINT_CODE, o as MISSING_ID_CODE, a8 as SYNTAX_CODE, E as EMPTY_INPUT_CODE, y as ELEMENT_ISSUE, z as INPUT_ISSUE, Z as ImportReportBuilder, p as plural, a as agree, ag as GRAPH_COLUMN_AS_METADATA_CODE, ah as TYPEDEF_NODES_CODE, ai as RELATION_ASSUMED_CODE, a9 as COLUMN_AS_PROPERTY_VALUE_CODE, aE as NONFINITE_AS_NULL_CODE, av as DIRECTION_DROPPED_CODE, af as NODE_ORDER_CODE, $ as formatF32, a0 as formatF64 } from "./format-BpQBx8MZ.js";
3
- import { c as capabilities, g as resolveImportOptions, ab as readText, j as reportSinkOptions, i as reportUnusedOptions, h as throwIfAborted, I as IdCoercer, l as DirectionResolver, w as weightFromValue, u as uniqueColumnName, f as chooseGraph, k as graphChosen, d as declareResolved, p as pairFolding, e as explicitWeights, L as LOSS, a as checkCapabilities, r as resolveExportOptions, ah as otherFormatDialect, ai as countMixedEdges } from "./export-BvqAXCKh.js";
2
+ import { R as ROLE_TAKEN_CODE, C as COLUMN_RENAMED_CODE, l as DUPLICATE_ATTRIBUTE_CODE, d as UNKNOWN_ELEMENT_CODE, az as EMPTY_COLUMN_DROPPED_CODE, a1 as PARENT_CYCLE_CODE, P as PRECISION_CODE, s as UNKNOWN_ENCODING_CODE, Z as JSON_NONSTANDARD_NUMBER_CODE, t as ENCODING_FALLBACK_CODE, u as INVALID_ENCODING_CODE, v as INVALID_UTF8_CODE, O as OPTION_IGNORED_CODE, S as SINK_OPTION_CODE, H as HYPEREDGE_CODE, V as TOO_LARGE_CODE, f as DANGLING_REFERENCE_CODE, W as AMBIGUOUS_GRAPH_NAME_CODE, Y as GRAPH_NOT_FOUND_CODE, i as MULTIPLE_GRAPHS_CODE, I as ID_MERGED_CODE, j as DUPLICATE_EDGE_ID_CODE, k as DUPLICATE_NODE_CODE, m as UNKNOWN_PARENT_CODE, T as BAD_VALUE_CODE, n as MISSING_ENDPOINT_CODE, o as MISSING_ID_CODE, Q as SYNTAX_CODE, E as EMPTY_INPUT_CODE, y as ELEMENT_ISSUE, z as INPUT_ISSUE, K as ImportReportBuilder, p as plural, a as agree, ae as GRAPH_COLUMN_AS_METADATA_CODE, af as TYPEDEF_NODES_CODE, ag as RELATION_ASSUMED_CODE, a8 as COLUMN_AS_PROPERTY_VALUE_CODE, aD as NONFINITE_AS_NULL_CODE, ax as DIRECTION_DROPPED_CODE, ad as NODE_ORDER_CODE } from "./report-CwMfYa9J.js";
3
+ import { D as DirectionResolver, p as pairFolding, f as formatF32, a as formatF64 } from "./format-BXiAb-1h.js";
4
+ import { c as capabilities, b as resolveImportOptions, f as reportSinkOptions, d as reportUnusedOptions, I as IdCoercer, w as weightFromValue, u as uniqueColumnName, g as chooseGraph, h as graphChosen, i as declareResolved, e as explicitWeights, L as LOSS, a as checkCapabilities, r as resolveExportOptions, P as otherFormatDialect, G as countMixedEdges } from "./export-Cha4dRFz.js";
4
5
  import { j as joinText, e as encodeChunks, i as indentUnit } from "./writer-DxjgHwSe.js";
5
- import { S as STYLE_BLOCK_NAME, C as toolDefaults, t as StyleNotes, u as parseStyleBlock, s as styleFingerprint, a as STYLE_ISSUE, p as plainCell, m as canonBoolean, o as canonText, h as canonNumber, v as blockStyles, g as canonColor, l as canonEnum, j as canonOpacity, r as resolveStyles } from "./block-DiGq58c3.js";
6
- import { t as trimTrailingZeros } from "./text-CzJNFOS9.js";
7
- import { d as OBOGRAPHS_PREDICATE_TAGS, g as compactOboIri, o as oboColumnDecl, P as PLACEHOLDER_COLUMN, h as synonymScopeOf, O as OBO_NODE_COLUMNS, c as capabilityNotes, s as slotColumn, e as emptyColumnNotes, j as OBO_PURL, f as framelessNodes, m as movedNodes, U as UNWRITTEN_ROLES, n as notePropertyColumn, a as cellOf, v as valuesOf$1, k as OBO_IN_OWL, b as fitsVocabulary, t as textOf, S as SYNONYM_SCOPES } from "./ontology-export-G4MqRdux.js";
8
- import { M as MAYBE_UNSAFE_INTEGER, g as MAYBE_INEXACT_EXPONENT, j as rewriteNumbers, l as findDuplicateKeys, m as keysInTextOrder } from "./json-elements-DJZRZ6jd.js";
9
- import { c as cytoscapeJsStyles, C as CYTOSCAPE_IMPORT_KEY, t as toCytoscapeStylesheet, a as cyjsHoldsExactly, b as CYJS_EDGE_PROPERTIES, d as CYJS_NODE_PROPERTIES } from "./emit-CwU8cUmG.js";
10
- import { S as StyleApproximations } from "./approximations-wWjCRzKj.js";
11
- import { f as flipY } from "./convert-BcQ8_jMo.js";
6
+ import { S as STYLE_BLOCK_NAME, y as toolDefaults, h as StyleNotes, m as parseStyleBlock, o as styleFingerprint, b as STYLE_ISSUE, p as plainCell, k as canonBoolean, f as canonText, c as canonNumber, d as canonColor, a as canonEnum, j as canonOpacity } from "./block-iptrlMBb.js";
7
+ import { t as trimTrailingZeros } from "./text-ystE2bYi.js";
8
+ import { d as OBOGRAPHS_PREDICATE_TAGS, g as compactOboIri, o as oboColumnDecl, P as PLACEHOLDER_COLUMN, h as synonymScopeOf, O as OBO_NODE_COLUMNS, c as capabilityNotes, s as slotColumn, e as emptyColumnNotes, j as OBO_PURL, f as framelessNodes, m as movedNodes, U as UNWRITTEN_ROLES, n as notePropertyColumn, a as cellOf, v as valuesOf$1, k as OBO_IN_OWL, b as fitsVocabulary, t as textOf, S as SYNONYM_SCOPES } from "./ontology-export-OMo91mb0.js";
9
+ import { r as readText, b as throwIfAborted } from "./input-CAxt_aV-.js";
10
+ import { M as MAYBE_UNSAFE_INTEGER, g as MAYBE_INEXACT_EXPONENT, j as rewriteNumbers, l as findDuplicateKeys, m as keysInTextOrder } from "./json-elements-Cq76WjnZ.js";
11
+ import { c as cytoscapeJsStyles, C as CYTOSCAPE_IMPORT_KEY, t as toCytoscapeStylesheet, a as cyjsHoldsExactly, b as CYJS_EDGE_PROPERTIES, d as CYJS_NODE_PROPERTIES } from "./emit-BwHQkZle.js";
12
+ import { S as StyleApproximations } from "./approximations-Bzn3L-je.js";
13
+ import { t as takeFromBlock } from "./round-trip-Zm3_ivgq.js";
14
+ import { f as flipY } from "./convert-Ct2zelbQ.js";
12
15
  const JSON_DIALECTS = Object.freeze([
13
16
  "node-link",
14
17
  "d3",
@@ -83,15 +86,37 @@ function sniffEdgeListDialect(root) {
83
86
  if (record !== void 0) {
84
87
  return record;
85
88
  }
89
+ if (!networkx && firstEdge === null && isVisOptions(root.options)) {
90
+ return "vis";
91
+ }
86
92
  const bare = !hasKey(root, "directed") && !hasKey(root, "multigraph") && !hasKey(root, "graph");
87
93
  return bare && hasKey(root, "links") ? "d3" : "node-link";
88
94
  }
95
+ const VIS_OPTION_GROUPS = [
96
+ "nodes",
97
+ "edges",
98
+ "groups",
99
+ "physics",
100
+ "layout",
101
+ "interaction",
102
+ "manipulation",
103
+ "configure",
104
+ "autoResize",
105
+ "clickToUse",
106
+ "locale",
107
+ "locales",
108
+ "height",
109
+ "width"
110
+ ];
111
+ function isVisOptions(options) {
112
+ return isJsonObject(options) && VIS_OPTION_GROUPS.some((k) => hasKey(options, k));
113
+ }
89
114
  function sniffRecordDialect(firstNode, firstEdge) {
90
115
  if (firstNode !== null && hasKey(firstNode, "key") && !hasKey(firstNode, "id")) {
91
116
  return "graphology";
92
117
  }
93
118
  if (firstEdge === null) {
94
- return void 0;
119
+ return firstNode !== null && hasKey(firstNode, "id") && isJsonObject(firstNode.attributes) ? "graphology" : void 0;
95
120
  }
96
121
  if (!hasKey(firstEdge, "from")) {
97
122
  return hasKey(firstEdge, "undirected") || isJsonObject(firstEdge.attributes) ? "graphology" : void 0;
@@ -249,8 +274,8 @@ function exponentIfUnsafe(text) {
249
274
  }
250
275
  const [, sign, digits] = match;
251
276
  const mantissa = trimTrailingZeros(digits);
252
- const fraction = mantissa.length > 1 ? `.${mantissa.slice(1)}` : "";
253
- return `${sign}${mantissa[0]}${fraction}e+${digits.length - 1}`;
277
+ const fraction2 = mantissa.length > 1 ? `.${mantissa.slice(1)}` : "";
278
+ return `${sign}${mantissa[0]}${fraction2}e+${digits.length - 1}`;
254
279
  }
255
280
  const GRAPH_FORMATS = Object.freeze([
256
281
  "json",
@@ -570,10 +595,11 @@ function clamp(value) {
570
595
  }
571
596
  return Math.min(value, 1);
572
597
  }
598
+ const SIGMA_FIT = { padding: 30 };
573
599
  const Y_DOWN_MARKERS = ["vx", "vy", "fx", "fy", "index", "physics"];
574
600
  function jsonPositions(snapshot) {
575
601
  if (snapshot.nodes.byRole("position") !== null) {
576
- return null;
602
+ return jsonShapeOf(snapshot)?.dialect === "cytoscape" ? { containersFollowChildren: true } : null;
577
603
  }
578
604
  const x = numeric(snapshot.nodes.get("x"));
579
605
  const y = numeric(snapshot.nodes.get("y"));
@@ -581,19 +607,23 @@ function jsonPositions(snapshot) {
581
607
  return null;
582
608
  }
583
609
  const z = numeric(snapshot.nodes.get("z"));
584
- const down = z === null && Y_DOWN_MARKERS.some((name) => snapshot.nodes.get(name) !== null);
610
+ const dialect = jsonShapeOf(snapshot)?.dialect;
611
+ const markers = dialect !== "graphology" && Y_DOWN_MARKERS.some((name) => snapshot.nodes.get(name) !== null);
612
+ const down = z === null && (dialect === "vis" || markers);
585
613
  return {
586
614
  x: x.meta.name,
587
615
  y: y.meta.name,
588
616
  ...z === null ? {} : { z: z.meta.name },
589
617
  yAxis: down ? "down" : "up",
590
- units: down ? "px" : "file"
618
+ units: down ? "px" : "file",
619
+ ...dialect === "graphology" ? { viewerFit: SIGMA_FIT } : {}
591
620
  };
592
621
  }
593
622
  function numeric(column) {
594
623
  const numericDtypes = ["f64", "f32", "i32", "u32", "u8"];
595
624
  return column !== null && column.meta.components === 1 && numericDtypes.includes(column.dtype) ? column : null;
596
625
  }
626
+ const SIGMA_DEFAULT_SETTINGS = { renderEdgeLabels: false, edgeLabelAnchors: "nodeLabels" };
597
627
  const TARGETS = ["node", "edge"];
598
628
  function jsonStyles(snapshot, context) {
599
629
  const src = context.kept;
@@ -734,14 +764,17 @@ function graphologyStyles(snapshot, src, context) {
734
764
  const notes = new StyleNotes();
735
765
  const out = { node: {}, edge: {} };
736
766
  const readFrom = { node: [], edge: [] };
767
+ const edgeLabel = sigmaEdgeLabels(snapshot, src.sigma ?? SIGMA_DEFAULT_SETTINGS);
737
768
  for (const target of TARGETS) {
738
769
  const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
739
770
  const { values, put } = valuesOf(n);
740
771
  const keys = {
741
772
  color: cells(snapshot, target, "color"),
742
773
  size: cells(snapshot, target, "size"),
743
- label: cells(snapshot, target, "label"),
744
- hidden: cells(snapshot, target, "hidden")
774
+ // sigma 4's default styles bind nothing else: it draws an element marked `hidden: true` (sigma 3's key)
775
+ // or `visibility: "hidden"` (its own display-data name) like any other (specimen sheets
776
+ // graphology-specimen-node-sizes-opacity, -edges-lines)
777
+ label: cells(snapshot, target, "label")
745
778
  };
746
779
  readFrom[target].push(...Object.entries(keys).flatMap(([name, c]) => c === null ? [] : [name]));
747
780
  for (let i = 0; i < n; i++) {
@@ -752,7 +785,7 @@ function graphologyStyles(snapshot, src, context) {
752
785
  element: i,
753
786
  budget: context.budget
754
787
  });
755
- readSigmaRow(keys, target, i, put, site);
788
+ readSigmaRow(keys, target, target === "node" || edgeLabel(i), i, put, site);
756
789
  }
757
790
  out[target] = values;
758
791
  }
@@ -769,31 +802,50 @@ function graphologyStyles(snapshot, src, context) {
769
802
  readFrom
770
803
  };
771
804
  }
772
- function readSigmaRow(keys, target, i, put, site) {
773
- const { color, size, label, hidden } = keys;
805
+ function sigmaEdgeLabels(snapshot, settings) {
806
+ if (!settings.renderEdgeLabels) {
807
+ return () => false;
808
+ }
809
+ if (settings.edgeLabelAnchors === "allNodes") {
810
+ return () => true;
811
+ }
812
+ const label = cells(snapshot, "node", "label");
813
+ const shows = (node) => {
814
+ const text = label?.(node);
815
+ return typeof text === "string" ? text !== "" : text !== null && text !== void 0;
816
+ };
817
+ return (i) => shows(snapshot.edgeSource(i)) && shows(snapshot.edgeTarget(i));
818
+ }
819
+ function readSigmaRow(keys, target, labeled, i, put, site) {
820
+ const { color, size, label } = keys;
774
821
  if (color !== null) {
775
822
  const [fill, opacity] = target === "node" ? ["fill", "fillOpacity"] : ["color", "opacity"];
776
823
  putColor(put, fill, opacity, i, color(i), site(fill));
777
824
  }
778
825
  if (size !== null) {
779
- const v = canonNumber(size(i), site("width"));
780
- put("width", i, v);
781
- if (target === "node") {
782
- put("height", i, v);
783
- }
826
+ putSigmaSize(put, target, i, size(i), site);
784
827
  }
785
- if (label !== null) {
786
- put("label", i, canonText(label(i), site("label")));
828
+ if (label !== null && labeled) {
829
+ const text = canonText(label(i), site("label"));
830
+ put("label", i, text === null ? null : text.replaceAll(/[\t\n\f\r]/g, " "));
787
831
  }
788
- if (hidden !== null && canonBoolean(hidden(i), site("visible")) === true) {
789
- put("visible", i, false);
832
+ }
833
+ function putSigmaSize(put, target, i, raw, site) {
834
+ if (target === "node") {
835
+ const v = Number(raw) < 0 ? 0 : canonNumber(raw, site("width"));
836
+ const d = v === null ? null : v * 2;
837
+ put("width", i, d);
838
+ put("height", i, d);
839
+ } else {
840
+ const w = canonNumber(raw, site("width"));
841
+ put("width", i, w === null ? null : w / 2);
790
842
  }
791
843
  }
792
844
  function putColor(put, property, opacity, i, raw, site) {
793
- if (raw === null || raw === void 0 || raw === "") {
845
+ if (raw === null || raw === void 0) {
794
846
  return;
795
847
  }
796
- const c = canonColor(raw, "css", site);
848
+ const c = canonColor(raw, "graphology", site);
797
849
  if (c === null) {
798
850
  return;
799
851
  }
@@ -817,48 +869,27 @@ function blockText(snapshot, src) {
817
869
  return typeof v === "string" ? v : null;
818
870
  }
819
871
  function exactFromBlock(snapshot, text, values, written, holdsExactly) {
820
- if (text === null) {
821
- return;
822
- }
823
- const parsed = parseStyleBlock(text, styleFingerprint(snapshot));
824
- const ex = parsed.ok ? blockStyles(parsed.block, snapshot, "json") : null;
825
- if (ex === null) {
826
- return;
827
- }
828
- for (const target of TARGETS) {
872
+ takeFromBlock(snapshot, text, "json", (target, block, ex) => {
829
873
  const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
830
- const cache = /* @__PURE__ */ new Map();
831
- const resolved = (p) => {
832
- let r = cache.get(p);
833
- if (r === void 0) {
834
- r = resolveStyles(ex, target, p, snapshot);
835
- cache.set(p, r);
836
- }
837
- return r;
838
- };
839
874
  if (holdsExactly !== void 0) {
840
875
  const properties = new Set(
841
876
  ex.styles.rules.filter((r) => r.target === target).flatMap((r) => [...Object.keys(r.set ?? {}), ...Object.keys(r.map ?? {})])
842
877
  );
843
878
  for (const property of properties) {
844
879
  const held = (w) => holdsExactly(target, property, w);
845
- takeUnheld(values[target], property, resolved(property), n, held);
880
+ takeUnheld(values[target], property, block(target, property), n, held);
846
881
  }
847
882
  }
848
- for (const [property, write2] of Object.entries(written[target] ?? {})) {
849
- takeWritten(values[target], property, n, resolved, write2, snapshot);
850
- }
851
- }
852
- }
853
- function takeWritten(column, property, n, resolved, write2, snapshot) {
854
- const want = resolved(property);
855
- for (let i = 0; i < n; i++) {
856
- const w = want[i];
857
- const native = column[property]?.[i] ?? null;
858
- if (native !== w && native !== null && native === write2((p) => resolved(p)[i], i, snapshot)) {
859
- setValue(column, property, n, i, w);
860
- }
861
- }
883
+ const writes = written[target] ?? {};
884
+ return {
885
+ values: values[target],
886
+ properties: Object.keys(writes),
887
+ // a native value the writer made from the block's other values (vis.js's one size for a width) is the
888
+ // block's own value, none included
889
+ readBack: (i, want) => (property) => writes[property](want, i, snapshot),
890
+ take: (_property, _wanted, native) => native !== null
891
+ };
892
+ });
862
893
  }
863
894
  function takeUnheld(values, property, want, n, held) {
864
895
  for (let i = 0; i < n; i++) {
@@ -886,6 +917,15 @@ const VIS_SIZED = /* @__PURE__ */ new Set([
886
917
  "square",
887
918
  "icon"
888
919
  ]);
920
+ const VIS_LABEL_FIT = /* @__PURE__ */ new Map([
921
+ ["box", { square: false, ellipse: false }],
922
+ ["text", { square: false, ellipse: false }],
923
+ ["circle", { square: true, ellipse: false }],
924
+ ["database", { square: true, ellipse: false }],
925
+ ["ellipse", { square: false, ellipse: true }]
926
+ ]);
927
+ const VIS_MARGIN = 5;
928
+ const VIS_FONT_SIZE = 14;
889
929
  const VIS_GROUP_PALETTE = [
890
930
  ["#2B7CE9", "#97C2FC"],
891
931
  ["#FFA500", "#FFFF00"],
@@ -908,6 +948,8 @@ const VIS_GROUP_PALETTE = [
908
948
  ["#C2FABC", "#74D66A"],
909
949
  ["#EE0000", "#990000"]
910
950
  ];
951
+ const VIS_NODE_FILL = "#97C2FC";
952
+ const VIS_NODE_BORDER = "#2B7CE9";
911
953
  const VIS_EDGE_COLOR = "#848484";
912
954
  function visParseColor(text) {
913
955
  let hex = text;
@@ -976,7 +1018,14 @@ function visLayer(o, target) {
976
1018
  set("hidden", o.hidden);
977
1019
  set("label", o.label);
978
1020
  set("title", o.title);
1021
+ set("wrapWidth", isJsonObject(o.widthConstraint) ? o.widthConstraint.maximum : o.widthConstraint);
1022
+ if (isJsonObject(o.scaling)) {
1023
+ set("scalingLabel", o.scaling.label);
1024
+ }
979
1025
  visFontLayer(o.font, set);
1026
+ if (target === "edge" && o.font !== void 0 && o.font !== null) {
1027
+ set("fontText", typeof o.font === "string");
1028
+ }
980
1029
  return layer;
981
1030
  }
982
1031
  function visNodeLayer(o, set) {
@@ -991,8 +1040,104 @@ function visNodeLayer(o, set) {
991
1040
  }
992
1041
  set("shape", o.shape);
993
1042
  set("size", o.size);
1043
+ set("value", o.value);
1044
+ if (isJsonObject(o.scaling)) {
1045
+ set("scalingMin", o.scaling.min);
1046
+ set("scalingMax", o.scaling.max);
1047
+ }
994
1048
  set("borderWidth", o.borderWidth);
995
1049
  set("opacity", o.opacity);
1050
+ set("margin", o.margin);
1051
+ set("widthMin", isJsonObject(o.widthConstraint) ? o.widthConstraint.minimum : o.widthConstraint);
1052
+ set("heightMin", isJsonObject(o.heightConstraint) ? o.heightConstraint.minimum : o.heightConstraint);
1053
+ set("valign", isJsonObject(o.heightConstraint) ? o.heightConstraint.valign : void 0);
1054
+ set("image", isJsonObject(o.image) ? o.image.unselected : o.image);
1055
+ set("brokenImage", o.brokenImage);
1056
+ set("imagePadding", o.imagePadding);
1057
+ if (isJsonObject(o.icon)) {
1058
+ set("iconCode", o.icon.code);
1059
+ set("iconFace", o.icon.face);
1060
+ set("iconSize", o.icon.size);
1061
+ set("iconColor", o.icon.color);
1062
+ set("iconWeight", o.icon.weight);
1063
+ }
1064
+ if (isJsonObject(o.shapeProperties)) {
1065
+ set("useImageSize", o.shapeProperties.useImageSize);
1066
+ set("useBorderWithImage", o.shapeProperties.useBorderWithImage);
1067
+ set("interpolation", o.shapeProperties.interpolation);
1068
+ set("coordinateOrigin", o.shapeProperties.coordinateOrigin);
1069
+ set("borderDashes", o.shapeProperties.borderDashes);
1070
+ set("borderRadius", o.shapeProperties.borderRadius);
1071
+ }
1072
+ }
1073
+ function visImage(layer, shape, box) {
1074
+ const text = (v) => typeof v === "string" && v !== "" ? v : null;
1075
+ const [own, broken] = [text(layer.image), text(layer.brokenImage)];
1076
+ const src = own ?? broken;
1077
+ if (shape !== "image" && shape !== "circularImage" || src === null) {
1078
+ return {};
1079
+ }
1080
+ const circular = shape === "circularImage";
1081
+ const row = {
1082
+ image: src,
1083
+ ...own !== null && broken !== null ? { imageFallback: broken } : {},
1084
+ imageFit: layer.useImageSize === true ? "none" : "cover",
1085
+ imageClip: circular ? "node" : "none",
1086
+ shape: "ellipse"
1087
+ };
1088
+ if (!circular) {
1089
+ row.shape = layer.useBorderWithImage === true ? "rectangle" : "none";
1090
+ }
1091
+ if (layer.interpolation === false) {
1092
+ row.imageSmoothing = false;
1093
+ }
1094
+ const opacity = typeof layer.opacity === "number" && layer.opacity >= 0 && layer.opacity < 1 ? layer.opacity : null;
1095
+ if (opacity !== null) {
1096
+ row.imageOpacity = opacity;
1097
+ }
1098
+ visImagePlace(row, layer, box);
1099
+ return row;
1100
+ }
1101
+ function visImagePlace(row, layer, box) {
1102
+ const pad = visImagePadding(layer.imagePadding);
1103
+ if (pad !== null && layer.useImageSize !== true) {
1104
+ row.imageFit = "none";
1105
+ row.imageWidth = Math.max(0, box.width - pad.left - pad.right);
1106
+ row.imageHeight = Math.max(0, box.height - pad.top - pad.bottom);
1107
+ row.imageOffsetX = (pad.left - pad.right) / 2;
1108
+ row.imageOffsetY = (pad.top - pad.bottom) / 2;
1109
+ }
1110
+ if (layer.coordinateOrigin === "top-left" && row.shape === "none") {
1111
+ row.imageOffsetX = box.width / 2 + (typeof row.imageOffsetX === "number" ? row.imageOffsetX : 0);
1112
+ row.imageOffsetY = box.height / 2 + (typeof row.imageOffsetY === "number" ? row.imageOffsetY : 0);
1113
+ }
1114
+ }
1115
+ function visIcon(layer, site) {
1116
+ const code = typeof layer.iconCode === "string" && layer.iconCode !== "" ? layer.iconCode : null;
1117
+ if (code === null) {
1118
+ return {};
1119
+ }
1120
+ const size = typeof layer.iconSize === "number" && layer.iconSize >= 0 ? layer.iconSize : 50;
1121
+ const color = typeof layer.iconColor === "string" ? canonColor(layer.iconColor, "vis", site) : null;
1122
+ const weight = layer.iconWeight;
1123
+ const bold = weight === "bold" || weight === "bolder" || typeof weight === "number" && weight >= 600;
1124
+ return {
1125
+ glyph: code,
1126
+ glyphFont: typeof layer.iconFace === "string" && layer.iconFace !== "" ? layer.iconFace : "FontAwesome",
1127
+ glyphSize: size,
1128
+ glyphColor: color?.color ?? "#2b7ce9",
1129
+ glyphWeight: bold ? "bold" : "normal"
1130
+ };
1131
+ }
1132
+ function visImagePadding(raw) {
1133
+ const side = (v) => typeof v === "number" && Number.isFinite(v) && v > 0 ? v : 0;
1134
+ let pad = null;
1135
+ if (typeof raw === "number") {
1136
+ pad = { top: side(raw), right: side(raw), bottom: side(raw), left: side(raw) };
1137
+ } else if (isJsonObject(raw)) {
1138
+ pad = { top: side(raw.top), right: side(raw.right), bottom: side(raw.bottom), left: side(raw.left) };
1139
+ }
1140
+ return pad === null || pad.top + pad.right + pad.bottom + pad.left === 0 ? null : pad;
996
1141
  }
997
1142
  function visEdgeLayer(o, set) {
998
1143
  const { color } = o;
@@ -1006,14 +1151,34 @@ function visEdgeLayer(o, set) {
1006
1151
  set("inherit", own ? false : color.inherit);
1007
1152
  }
1008
1153
  set("width", o.width);
1154
+ set("value", o.value);
1155
+ if (isJsonObject(o.scaling)) {
1156
+ set("scalingMin", o.scaling.min);
1157
+ set("scalingMax", o.scaling.max);
1158
+ }
1009
1159
  set("dashes", o.dashes);
1010
1160
  set("arrows", o.arrows);
1161
+ set("background", o.background);
1162
+ set("smooth", o.smooth);
1163
+ set("selfReference", o.selfReference);
1164
+ set("selfReferenceSize", o.selfReferenceSize);
1165
+ set("physics", o.physics);
1011
1166
  }
1012
1167
  function visFontLayer(font, set) {
1013
1168
  if (isJsonObject(font)) {
1169
+ set("fontMulti", font.multi);
1170
+ set("fontStrokeWidth", font.strokeWidth);
1171
+ set("fontStrokeColor", font.strokeColor);
1172
+ set("fontBackground", font.background);
1173
+ set("fontAlign", font.align);
1014
1174
  set("fontColor", font.color);
1015
1175
  set("fontSize", font.size);
1016
1176
  set("fontFace", font.face);
1177
+ set("fontVadjust", font.vadjust);
1178
+ const mods = ["bold", "ital", "boldital", "mono"].filter((m) => font[m] !== void 0 && font[m] !== null);
1179
+ if (mods.length > 0) {
1180
+ set("fontMods", Object.fromEntries(mods.map((m) => [m, font[m]])));
1181
+ }
1017
1182
  } else if (typeof font === "string") {
1018
1183
  const m = /^\s*(\d+(?:\.\d+)?)(?:px)?\s+(\S+)(?:\s+(\S+))?/.exec(font.slice(0, 256));
1019
1184
  if (m !== null) {
@@ -1044,44 +1209,328 @@ function visValues(layer, target, site, sized) {
1044
1209
  };
1045
1210
  if (target === "node") {
1046
1211
  color("fill", "fillOpacity", layer.fill);
1047
- color("borderColor", null, layer.border);
1212
+ color("borderColor", "borderOpacity", layer.border);
1048
1213
  visNodeValues(layer, sized, put, site);
1049
1214
  } else {
1050
1215
  color("color", "opacity", layer.edgeColor);
1051
1216
  visEdgeValues(layer, put, site);
1217
+ visEdgeBackground(layer, put, color);
1052
1218
  }
1053
1219
  if (layer.hidden !== void 0 && canonBoolean(layer.hidden, site("visible")) === true) {
1054
1220
  put("visible", false);
1055
1221
  }
1056
- if (layer.label !== void 0) {
1057
- put("label", canonText(layer.label, site("label")));
1222
+ visLabelValues(layer, target, put, color, site);
1223
+ return out;
1224
+ }
1225
+ function visEdgeBackground(layer, put, color) {
1226
+ if (!isJsonObject(layer.background)) {
1227
+ return;
1058
1228
  }
1059
- if (layer.title !== void 0) {
1060
- put("tooltip", canonText(layer.title, site("tooltip")));
1229
+ const bg = layer.background;
1230
+ const straight = layer.smooth === false || isJsonObject(layer.smooth) && layer.smooth.enabled === false;
1231
+ color("outlineColor", "outlineOpacity", bg.color);
1232
+ if (bg.enabled !== void 0) {
1233
+ const size = typeof bg.size === "number" ? bg.size : 10;
1234
+ const width = typeof layer.width === "number" ? layer.width : 1;
1235
+ put("outlineWidth", bg.enabled === true && !straight ? Math.max(0, size - width) : 0);
1061
1236
  }
1062
- color("labelColor", null, layer.fontColor);
1237
+ const band = visBandStyle(bg, false);
1238
+ if (band !== null) {
1239
+ put("outlineStyle", band);
1240
+ }
1241
+ }
1242
+ function visLabelValues(layer, target, put, color, site) {
1063
1243
  if (layer.fontSize !== void 0) {
1064
1244
  put("labelSize", canonNumber(layer.fontSize, site("labelSize")));
1065
1245
  }
1066
1246
  if (layer.fontFace !== void 0) {
1067
1247
  put("labelFont", canonText(layer.fontFace, site("labelFont")));
1068
1248
  }
1069
- return out;
1249
+ if (layer.label !== void 0) {
1250
+ visLabelText(layer, target, put, site);
1251
+ }
1252
+ if (typeof layer.wrapWidth === "number" && Number.isFinite(layer.wrapWidth) && layer.wrapWidth > 0) {
1253
+ put("labelWrapWidth", layer.wrapWidth);
1254
+ put("labelWrapSpaceCount", 3);
1255
+ }
1256
+ if (layer.title !== void 0) {
1257
+ put("tooltip", canonText(layer.title, site("tooltip")));
1258
+ }
1259
+ const threshold = isJsonObject(layer.scalingLabel) ? layer.scalingLabel.drawThreshold : void 0;
1260
+ if (typeof threshold === "number" && Number.isFinite(threshold)) {
1261
+ put("labelMinScreenSize", Math.max(0, threshold - 1));
1262
+ }
1263
+ visLabelLook(layer, target, put, color, site);
1264
+ }
1265
+ function visLabelText(layer, target, put, site) {
1266
+ const text = target === "edge" && layer.fontText === true ? "" : canonText(layer.label, site("label"));
1267
+ const marked = typeof text === "string" ? visMarkup(text, layer.fontMulti) : null;
1268
+ put("label", marked?.text ?? text);
1269
+ if (marked !== null) {
1270
+ const runs = visRuns(marked.runs, layer, site("labelRuns"));
1271
+ put("labelRuns", runs);
1272
+ if (runs !== null) {
1273
+ put("labelRunAlign", visRunAlign(layer, target));
1274
+ }
1275
+ }
1276
+ for (const [p, v] of Object.entries(VIS_MOD_VALUES[marked?.mod ?? "normal"] ?? {})) {
1277
+ put(p, v);
1278
+ }
1279
+ }
1280
+ function visLabelLook(layer, target, put, color, site) {
1281
+ color("labelColor", null, layer.fontColor);
1282
+ color("labelBackground", null, layer.fontBackground === "none" ? void 0 : layer.fontBackground);
1283
+ if (typeof layer.fontBackground === "string" && layer.fontBackground !== "none") {
1284
+ put("labelPadding", 0);
1285
+ put("labelLineHeight", 1);
1286
+ }
1287
+ const stroked = typeof layer.fontStrokeWidth === "number" && layer.fontStrokeWidth > 0;
1288
+ color("labelOutlineColor", null, layer.fontStrokeColor ?? (stroked ? "#ffffff" : void 0));
1289
+ if (layer.fontStrokeWidth !== void 0) {
1290
+ put("labelOutlineWidth", canonNumber(layer.fontStrokeWidth, site("labelOutlineWidth")));
1291
+ }
1292
+ if (target === "edge" && typeof layer.fontAlign === "string") {
1293
+ put("labelPosition", layer.fontAlign === "top" || layer.fontAlign === "bottom" ? layer.fontAlign : "center");
1294
+ } else if (target === "node" && typeof layer.fontAlign === "string") {
1295
+ put("labelTextAlign", { center: "center", right: "right" }[layer.fontAlign] ?? "left");
1296
+ }
1297
+ if (typeof layer.fontVadjust === "number" && Number.isFinite(layer.fontVadjust) && layer.fontVadjust !== 0) {
1298
+ put("labelOffsetY", layer.fontVadjust);
1299
+ }
1300
+ }
1301
+ const VIS_MOD_VALUES = {
1302
+ bold: { labelWeight: "bold" },
1303
+ ital: { labelItalic: true },
1304
+ boldital: { labelWeight: "bold", labelItalic: true },
1305
+ mono: { labelFont: "monospace" }
1306
+ };
1307
+ function visTakesOpacity(color) {
1308
+ if (color === void 0) {
1309
+ return true;
1310
+ }
1311
+ return typeof color === "string" && !color.includes("rgba") && (color.includes("rgb") || /^#?(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.test(color.trim()));
1312
+ }
1313
+ function visBandStyle(bg, round) {
1314
+ if (bg.dashes === void 0 || bg.dashes === false) {
1315
+ return null;
1316
+ }
1317
+ return visDashStyle(bg.dashes === true ? [5, 5] : bg.dashes, typeof bg.size === "number" ? bg.size : 10, round);
1318
+ }
1319
+ function visDashStyle(dashes, width, round) {
1320
+ if (!Array.isArray(dashes)) {
1321
+ return dashes === false ? "solid" : "dashed";
1322
+ }
1323
+ const lengths = dashes.filter((d) => typeof d === "number" && Number.isFinite(d));
1324
+ const pairs = lengths.length % 2 === 1 ? [...lengths, ...lengths] : lengths;
1325
+ const grow = round ? width : 0;
1326
+ const on = pairs.filter((_d, i) => i % 2 === 0).map((d) => Math.max(0, d) + grow);
1327
+ const off = pairs.filter((_d, i) => i % 2 === 1).map((d) => Math.max(0, d - grow));
1328
+ const sum = (xs) => xs.reduce((a, b) => a + b, 0);
1329
+ if (on.length === 0 || sum(off) < 0.1 * (sum(on) + sum(off))) {
1330
+ return "solid";
1331
+ }
1332
+ if (on.every((d) => d <= 1.5 * Math.max(1, width))) {
1333
+ return "dotted";
1334
+ }
1335
+ return Math.max(...on) >= 2 * Math.min(...on) ? "dash-dot" : "dashed";
1336
+ }
1337
+ function visMarkup(text, multi) {
1338
+ const system = VIS_MARKUP_SYSTEM.get(multi);
1339
+ if (system === void 0) {
1340
+ return null;
1341
+ }
1342
+ const state = { bold: false, ital: false, mono: false };
1343
+ const runs = [];
1344
+ const source = text.slice(0, 4096);
1345
+ let i = 0;
1346
+ while (i < source.length) {
1347
+ const tagged = visMarkTag(source, i, system, state);
1348
+ if (tagged > 0) {
1349
+ i += tagged;
1350
+ continue;
1351
+ }
1352
+ const [ch, next] = visMarkChar(source, i, system);
1353
+ runs.push({ text: ch, mod: visMarkMod(state) });
1354
+ i = next;
1355
+ }
1356
+ const mods = new Set(runs.filter((r) => /\S/.test(r.text)).map((r) => r.mod));
1357
+ const only = mods.size === 1 ? [...mods][0] : null;
1358
+ const merged = [];
1359
+ for (const r of runs) {
1360
+ const last = merged.at(-1);
1361
+ if (last?.mod === r.mod) {
1362
+ last.text += r.text;
1363
+ } else {
1364
+ merged.push({ ...r });
1365
+ }
1366
+ }
1367
+ return { text: runs.map((r) => r.text).join(""), mod: only === "normal" ? null : only, runs: merged };
1368
+ }
1369
+ const VIS_MOD_DEFAULTS = {
1370
+ bold: { mod: "bold" },
1371
+ ital: { mod: "italic" },
1372
+ boldital: { mod: "bold italic" },
1373
+ mono: { mod: "", face: "monospace", size: 15, vadjust: 2 }
1374
+ };
1375
+ function visRuns(runs, layer, site) {
1376
+ const own = {
1377
+ face: typeof layer.fontFace === "string" ? layer.fontFace : "arial",
1378
+ size: typeof layer.fontSize === "number" ? layer.fontSize : VIS_FONT_SIZE,
1379
+ color: typeof layer.fontColor === "string" ? layer.fontColor : null,
1380
+ vadjust: typeof layer.fontVadjust === "number" && Number.isFinite(layer.fontVadjust) ? layer.fontVadjust : 0
1381
+ };
1382
+ const mods = isJsonObject(layer.fontMods) ? layer.fontMods : {};
1383
+ let differs = false;
1384
+ const out = runs.map((r) => {
1385
+ const run = { text: r.text };
1386
+ const base = VIS_MOD_DEFAULTS[r.mod];
1387
+ if (base === void 0) {
1388
+ return run;
1389
+ }
1390
+ const given = visModOptions(mods[r.mod]);
1391
+ const modText = typeof given.mod === "string" ? given.mod : base.mod;
1392
+ const face = typeof given.face === "string" ? given.face : base.face ?? own.face;
1393
+ const size = typeof given.size === "number" ? given.size : base.size ?? own.size;
1394
+ const vadjust = typeof given.vadjust === "number" ? given.vadjust : base.vadjust ?? own.vadjust;
1395
+ const color = typeof given.color === "string" ? canonColor(given.color, "vis", site)?.color : null;
1396
+ if (modText.includes("bold")) {
1397
+ run.weight = "bold";
1398
+ }
1399
+ if (modText.includes("italic")) {
1400
+ run.italic = true;
1401
+ }
1402
+ if (face !== null && face !== own.face) {
1403
+ run.font = face;
1404
+ }
1405
+ if (size !== own.size) {
1406
+ run.size = size;
1407
+ }
1408
+ if (Number.isFinite(vadjust) && vadjust !== own.vadjust) {
1409
+ run.shift = vadjust - own.vadjust;
1410
+ }
1411
+ if (typeof color === "string") {
1412
+ run.color = color;
1413
+ }
1414
+ differs ||= Object.keys(run).length > 1;
1415
+ return run;
1416
+ });
1417
+ return differs ? JSON.stringify(out) : null;
1418
+ }
1419
+ function visRunAlign(layer, target) {
1420
+ if (target === "edge") {
1421
+ return { top: "baseline", bottom: "hanging" }[String(layer.fontAlign)] ?? "middle";
1422
+ }
1423
+ const shape = typeof layer.shape === "string" ? layer.shape : "ellipse";
1424
+ return VIS_SIZED.has(shape) ? "hanging" : "middle";
1425
+ }
1426
+ function visBelowGap(size) {
1427
+ return 2 + size / 6;
1428
+ }
1429
+ function visRunsDrop(runs, size) {
1430
+ let parsed;
1431
+ try {
1432
+ parsed = JSON.parse(runs);
1433
+ } catch {
1434
+ return 0;
1435
+ }
1436
+ if (!Array.isArray(parsed)) {
1437
+ return 0;
1438
+ }
1439
+ const lines = [size];
1440
+ for (const run of parsed) {
1441
+ const runSize = typeof run.size === "number" ? run.size : size;
1442
+ (typeof run.text === "string" ? run.text : "").split("\n").forEach((piece, i) => {
1443
+ if (i > 0) {
1444
+ lines.push(size);
1445
+ }
1446
+ if (piece !== "") {
1447
+ lines[lines.length - 1] = Math.max(lines.at(-1) ?? size, runSize);
1448
+ }
1449
+ });
1450
+ }
1451
+ return lines.reduce((sum, h) => sum + h - size, 0) / 2;
1452
+ }
1453
+ function visModOptions(raw) {
1454
+ if (isJsonObject(raw)) {
1455
+ return raw;
1456
+ }
1457
+ if (typeof raw === "string") {
1458
+ const m = /^\s*(\d+(?:\.\d+)?)(?:px)?\s+(\S+)(?:\s+(\S+))?/.exec(raw.slice(0, 256));
1459
+ if (m !== null) {
1460
+ return { size: Number(m[1]), face: m[2], ...m[3] === void 0 ? {} : { color: m[3] } };
1461
+ }
1462
+ }
1463
+ return {};
1464
+ }
1465
+ const VIS_MARKUP_SYSTEM = /* @__PURE__ */ new Map([
1466
+ [true, "html"],
1467
+ ["html", "html"],
1468
+ ["markdown", "md"],
1469
+ ["md", "md"]
1470
+ ]);
1471
+ const VIS_MARKS = {
1472
+ html: { "<b>": "bold", "</b>": "bold", "<i>": "ital", "</i>": "ital", "<code>": "mono", "</code>": "mono" },
1473
+ md: { "*": "bold", _: "ital", "`": "mono" }
1474
+ };
1475
+ function visMarkTag(source, i, system, state) {
1476
+ const marks = VIS_MARKS[system];
1477
+ const tag = Object.keys(marks).find((m) => source.startsWith(m, i));
1478
+ if (tag === void 0) {
1479
+ return 0;
1480
+ }
1481
+ const key = marks[tag];
1482
+ const toggles = system === "html" ? state[key] === tag.startsWith("</") : state[key] || i === 0 || /\s/.test(source[i - 1]);
1483
+ if (!toggles) {
1484
+ return 0;
1485
+ }
1486
+ state[key] = !state[key];
1487
+ return tag.length;
1488
+ }
1489
+ function visMarkChar(source, i, system) {
1490
+ if (system === "md") {
1491
+ return source[i] === "\\" && i + 1 < source.length ? [source[i + 1], i + 2] : [source[i], i + 1];
1492
+ }
1493
+ const entity = [
1494
+ ["&lt;", "<"],
1495
+ ["&amp;", "&"]
1496
+ ].find(([e]) => source.startsWith(e, i));
1497
+ return entity === void 0 ? [source[i], i + 1] : [entity[1], i + entity[0].length];
1498
+ }
1499
+ function visMarkMod(state) {
1500
+ if (state.mono) {
1501
+ return "mono";
1502
+ }
1503
+ if (state.bold) {
1504
+ return state.ital ? "boldital" : "bold";
1505
+ }
1506
+ return state.ital ? "ital" : "normal";
1070
1507
  }
1071
1508
  function visNodeValues(layer, sized, put, site) {
1072
1509
  if (layer.shape !== void 0) {
1073
1510
  put("shape", canonEnum("shape", layer.shape, "vis", site("shape")));
1511
+ if (typeof layer.shape === "string") {
1512
+ put("labelPosition", VIS_SIZED.has(layer.shape) ? "bottom" : "center");
1513
+ }
1074
1514
  }
1075
1515
  if (sized && layer.size !== void 0) {
1076
1516
  const v = canonNumber(layer.size, site("width"));
1077
- put("width", v);
1078
- put("height", v);
1517
+ put("width", v === null ? null : 2 * v);
1518
+ put("height", v === null ? null : 2 * v);
1079
1519
  }
1080
1520
  if (layer.borderWidth !== void 0) {
1081
1521
  put("borderWidth", canonNumber(layer.borderWidth, site("borderWidth")));
1082
1522
  }
1523
+ visNodeOpacityAndDashes(layer, put, site);
1524
+ }
1525
+ function visNodeOpacityAndDashes(layer, put, site) {
1083
1526
  if (layer.opacity !== void 0) {
1084
- put("opacity", canonOpacity(layer.opacity, "vis", site("opacity")));
1527
+ const opacity = canonOpacity(layer.opacity, "vis", site("opacity"));
1528
+ put("opacity", visTakesOpacity(layer.fill) ? opacity : null);
1529
+ put("borderOpacity", visTakesOpacity(layer.border) ? opacity : null);
1530
+ }
1531
+ if (layer.borderDashes !== void 0) {
1532
+ const width = typeof layer.borderWidth === "number" ? layer.borderWidth : 1;
1533
+ put("borderStyle", visDashStyle(layer.borderDashes === true ? [5, 15] : layer.borderDashes, width, false));
1085
1534
  }
1086
1535
  }
1087
1536
  function visEdgeValues(layer, put, site) {
@@ -1092,18 +1541,52 @@ function visEdgeValues(layer, put, site) {
1092
1541
  put("width", canonNumber(layer.width, site("width")));
1093
1542
  }
1094
1543
  if (layer.dashes !== void 0) {
1095
- put("lineStyle", layer.dashes === false || layer.dashes === "false" ? "solid" : "dashed");
1544
+ const width = typeof layer.width === "number" ? layer.width : 1;
1545
+ const dashes = layer.dashes === true ? [5, 5] : layer.dashes;
1546
+ put("lineStyle", layer.dashes === "false" ? "solid" : visDashStyle(dashes, width, true));
1096
1547
  }
1097
1548
  if (layer.arrows !== void 0) {
1098
- const [to, from] = visArrows(layer.arrows, site);
1549
+ const [to, from, middle] = visArrows(layer.arrows, site);
1099
1550
  put("targetArrow", to);
1100
1551
  put("sourceArrow", from);
1552
+ put("midTargetArrow", middle);
1553
+ const scaled = (name) => {
1554
+ const a = isJsonObject(layer.arrows) ? layer.arrows[name] : void 0;
1555
+ return isJsonObject(a) ? a.scaleFactor : void 0;
1556
+ };
1557
+ const scale = scaled("to") ?? scaled("from") ?? scaled("middle");
1558
+ if (scale !== void 0) {
1559
+ put("arrowSize", canonNumber(scale, site("arrowSize")));
1560
+ }
1561
+ visArrowImages(layer.arrows, put, site);
1562
+ }
1563
+ }
1564
+ function visArrowImages(arrows, put, site) {
1565
+ if (!isJsonObject(arrows)) {
1566
+ return;
1567
+ }
1568
+ for (const [name, property] of [
1569
+ ["to", "targetArrow"],
1570
+ ["from", "sourceArrow"],
1571
+ ["middle", "midTargetArrow"]
1572
+ ]) {
1573
+ const a = arrows[name];
1574
+ if (!isJsonObject(a) || a.type !== "image" || typeof a.src !== "string" || a.src === "") {
1575
+ continue;
1576
+ }
1577
+ put(`${property}Image`, a.src);
1578
+ if (a.imageWidth !== void 0) {
1579
+ put(`${property}ImageWidth`, canonNumber(a.imageWidth, site(`${property}ImageWidth`)));
1580
+ }
1581
+ if (a.imageHeight !== void 0) {
1582
+ put(`${property}ImageHeight`, canonNumber(a.imageHeight, site(`${property}ImageHeight`)));
1583
+ }
1101
1584
  }
1102
1585
  }
1103
1586
  function visArrows(arrows, site) {
1104
- const end = (name, property) => {
1587
+ const end = (name, property, absent = "none") => {
1105
1588
  if (typeof arrows === "string") {
1106
- return new RegExp(String.raw`\b${name}\b`).test(arrows.slice(0, 256)) ? "triangle" : "none";
1589
+ return new RegExp(String.raw`\b${name}\b`).test(arrows.slice(0, 256)) ? "triangle" : absent;
1107
1590
  }
1108
1591
  if (!isJsonObject(arrows)) {
1109
1592
  return null;
@@ -1112,12 +1595,15 @@ function visArrows(arrows, site) {
1112
1595
  if (a === true) {
1113
1596
  return "triangle";
1114
1597
  }
1598
+ if (a === void 0) {
1599
+ return absent;
1600
+ }
1115
1601
  if (!isJsonObject(a) || a.enabled === false) {
1116
1602
  return "none";
1117
1603
  }
1118
1604
  return canonEnum("arrow", a.type ?? "arrow", "vis", site(property));
1119
1605
  };
1120
- return [end("to", "targetArrow"), end("from", "sourceArrow")];
1606
+ return [end("to", "targetArrow"), end("from", "sourceArrow"), end("middle", "midTargetArrow", null)];
1121
1607
  }
1122
1608
  function visStyles(snapshot, src, context) {
1123
1609
  const notes = new StyleNotes();
@@ -1135,13 +1621,17 @@ function visStyles(snapshot, src, context) {
1135
1621
  const { groupLayers, paletteRows } = visGroupLayers(n, groupOf, visGroupDefs(src, options));
1136
1622
  context.budget.spend("node", n);
1137
1623
  const node = valuesOf(n);
1138
- const records = nodeRecords(snapshot);
1139
- const rawShape = (layer) => typeof layer.shape === "string" ? layer.shape : null;
1624
+ const shapes = [];
1625
+ const rawRecords = elementRaw(snapshot, "node");
1626
+ const range = visNodeValueRange(n, groupOf, rawRecords, groupLayers, nodeDefaults);
1627
+ const ownGroup = visOwnGroup(groupLayers, visGroupDefs(src, options));
1140
1628
  for (let i = 0; i < n; i++) {
1141
1629
  const g = groupOf(i);
1142
- const own = records(i);
1143
- const group = g === null ? {} : groupLayers.get(g) ?? {};
1144
- const shape = rawShape(own) ?? rawShape(group) ?? rawShape(nodeDefaults) ?? "ellipse";
1630
+ const raw = rawRecords(i);
1631
+ const own = visLayer(raw, "node");
1632
+ const group = g === null ? {} : ownGroup(g, raw);
1633
+ const shape = visShapeOf(own) ?? visShapeOf(group) ?? visShapeOf(nodeDefaults) ?? "ellipse";
1634
+ shapes.push(shape);
1145
1635
  const site = (property) => ({
1146
1636
  notes,
1147
1637
  target: "node",
@@ -1149,8 +1639,8 @@ function visStyles(snapshot, src, context) {
1149
1639
  element: i,
1150
1640
  budget: context.budget
1151
1641
  });
1152
- const merged = { ...nodeDefaults, ...group, ...own };
1153
- for (const [p, v] of Object.entries(visValues(merged, "node", site, VIS_SIZED.has(shape)))) {
1642
+ const merged = visMergedNode(nodeDefaults, group, own, g !== null && raw.color !== void 0);
1643
+ for (const [p, v] of Object.entries(visNodeRow(merged, shape, range, site))) {
1154
1644
  node.put(p, i, v);
1155
1645
  }
1156
1646
  }
@@ -1158,26 +1648,13 @@ function visStyles(snapshot, src, context) {
1158
1648
  if (Object.keys(declaredNode).length > 0) {
1159
1649
  nodeRules.push(rule("node.vis.defaults", "node", "defaults", "declared", { all: true }, declaredNode));
1160
1650
  }
1161
- let k = 0;
1162
- for (const [g, layer] of groupLayers) {
1163
- const set = paletteRows.get(g) ?? visValues(layer, "node", ruleSite("node"), true);
1164
- if (Object.keys(set).length === 0) {
1165
- continue;
1166
- }
1167
- const key = `group.${String(k)}`;
1168
- nodeColumns.set(
1169
- key,
1170
- Array.from({ length: n }, (_v, i) => groupOf(i) === g ? true : null)
1171
- );
1172
- const origin = paletteRows.has(g) ? "tool" : "declared";
1173
- const r = rule(`node.vis.group.${String(k++)}`, "node", "group", origin, { has: { style: key } }, set);
1174
- nodeRules.push({ ...r, facts: { names: [[key, g]] } });
1175
- }
1651
+ visGroupRules(n, groupOf, groupLayers, paletteRows, ruleSite("node"), nodeRules, nodeColumns);
1176
1652
  const toolNode = toolDefaults("vis-network")?.node;
1177
1653
  const borderOf = (i) => node.values.borderColor?.[i] ?? toolNode?.borderColor?.value ?? "#2b7ce9";
1178
- const edge = visEdges(snapshot, visLayer(options.edges, "edge"), borderOf, notes, context);
1654
+ const geometry = visGeometry(snapshot, node.values, shapes);
1655
+ const edge = visEdges(snapshot, visLayer(options.edges, "edge"), borderOf, geometry, notes, context);
1179
1656
  const values = { node: node.values, edge: edge.values };
1180
- exactFromBlock(snapshot, src.block, values, VIS_WRITTEN);
1657
+ exactFromBlock(snapshot, src.block, values, visWritten(snapshot, values.edge));
1181
1658
  return {
1182
1659
  canonical: true,
1183
1660
  dialect: "vis",
@@ -1194,6 +1671,202 @@ function visStyles(snapshot, src, context) {
1194
1671
  }
1195
1672
  };
1196
1673
  }
1674
+ function visShapeOf(layer) {
1675
+ return typeof layer.shape === "string" ? layer.shape : null;
1676
+ }
1677
+ function visNodeValueRange(n, groupOf, rawRecords, groupLayers, nodeDefaults) {
1678
+ return visValueRange(n, (i) => {
1679
+ const g = groupOf(i);
1680
+ const own = visLayer(rawRecords(i), "node").value;
1681
+ const value = own ?? (g === null ? void 0 : groupLayers.get(g)?.value) ?? nodeDefaults.value;
1682
+ return typeof value === "number" && Number.isFinite(value) ? value : null;
1683
+ });
1684
+ }
1685
+ function visMergedNode(nodeDefaults, group, own, ownColorInGroup) {
1686
+ const merged = { ...nodeDefaults, ...group, ...own };
1687
+ if (ownColorInGroup) {
1688
+ merged.fill ??= VIS_NODE_FILL;
1689
+ merged.border ??= VIS_NODE_BORDER;
1690
+ }
1691
+ return merged;
1692
+ }
1693
+ function visNodeRow(merged, shape, range, site) {
1694
+ const sized = VIS_SIZED.has(shape);
1695
+ const row = visValues(merged, "node", site, sized);
1696
+ const shaped = sized ? visSizedShape(merged, shape, visRadius(merged, range, site), site) : visFitShape(merged, shape);
1697
+ if (sized && merged.label !== void 0) {
1698
+ const size = visLabelScaled(merged, range) ?? (typeof merged.fontSize === "number" ? merged.fontSize : VIS_FONT_SIZE);
1699
+ const drop = typeof row.labelRuns === "string" ? visRunsDrop(row.labelRuns, size) : 0;
1700
+ const below = typeof row.labelOffsetY === "number" ? row.labelOffsetY : 0;
1701
+ row.labelOffsetY = below + drop + visBelowGap(size);
1702
+ }
1703
+ for (const p of ["labelOffsetX", "labelOffsetY"]) {
1704
+ const [a, b] = [row[p], shaped[p]];
1705
+ if (typeof a === "number" && typeof b === "number") {
1706
+ shaped[p] = a + b;
1707
+ }
1708
+ }
1709
+ Object.assign(row, shaped);
1710
+ const labelSize = visLabelScaled(merged, range);
1711
+ if (labelSize !== null) {
1712
+ row.labelSize = labelSize;
1713
+ }
1714
+ return row;
1715
+ }
1716
+ function visGroupRules(n, groupOf, groupLayers, paletteRows, site, rules, columns) {
1717
+ let k = 0;
1718
+ for (const [g, layer] of groupLayers) {
1719
+ const set = paletteRows.get(g) ?? visValues(layer, "node", site, true);
1720
+ if (Object.keys(set).length === 0) {
1721
+ continue;
1722
+ }
1723
+ const key = `group.${String(k)}`;
1724
+ columns.set(
1725
+ key,
1726
+ Array.from({ length: n }, (_v, i) => groupOf(i) === g ? true : null)
1727
+ );
1728
+ const origin = paletteRows.has(g) ? "tool" : "declared";
1729
+ const r = rule(`node.vis.group.${String(k++)}`, "node", "group", origin, { has: { style: key } }, set);
1730
+ rules.push({ ...r, facts: { names: [[key, g]] } });
1731
+ }
1732
+ }
1733
+ function visSizedShape(merged, shape, radius, site) {
1734
+ const row = { width: 2 * radius, height: 2 * radius };
1735
+ if (shape === "hexagon") {
1736
+ row.height = Math.sqrt(3) * radius;
1737
+ row.labelOffsetY = (2 - Math.sqrt(3)) * radius / 2;
1738
+ }
1739
+ Object.assign(row, visImage(merged, shape, { width: 2 * radius, height: 2 * radius }));
1740
+ if (shape === "icon") {
1741
+ Object.assign(row, { shape: "none" }, visIcon(merged, site("glyphColor")));
1742
+ }
1743
+ if (shape === "triangleDown") {
1744
+ row.shape = "polygon";
1745
+ row.shapePoints = "-1,1 0,-1 1,1";
1746
+ }
1747
+ return row;
1748
+ }
1749
+ function visFitShape(merged, shape) {
1750
+ const row = visLabelFit(merged, shape);
1751
+ if (merged.margin === 0 && (shape === "box" || shape === "circle" || shape === "database")) {
1752
+ row.visible = false;
1753
+ }
1754
+ if (merged.valign === "top" || merged.valign === "bottom") {
1755
+ row.labelPosition = `inside-${merged.valign}`;
1756
+ } else if (shape === "database") {
1757
+ const m = merged.margin;
1758
+ const top = isJsonObject(m) ? m.top : m;
1759
+ row.labelPosition = "inside-top";
1760
+ row.labelOffsetY = typeof top === "number" && Number.isFinite(top) && top >= 0 ? top : VIS_MARGIN;
1761
+ }
1762
+ if (shape === "box" && typeof merged.borderRadius === "number" && Number.isFinite(merged.borderRadius)) {
1763
+ row.cornerRadius = Math.max(0, merged.borderRadius);
1764
+ }
1765
+ return row;
1766
+ }
1767
+ function visLabelFit(layer, shape) {
1768
+ const fit = VIS_LABEL_FIT.get(shape);
1769
+ if (fit === void 0) {
1770
+ return {};
1771
+ }
1772
+ const length = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 ? v : null;
1773
+ const fontSize = length(layer.fontSize) ?? VIS_FONT_SIZE;
1774
+ const lines = typeof layer.label === "string" ? Math.max(1, layer.label.split("\n").length) : 1;
1775
+ const minW = length(layer.widthMin) ?? 0;
1776
+ const minH = length(layer.heightMin) ?? 0;
1777
+ let padX;
1778
+ let padY;
1779
+ let offset = {};
1780
+ if (fit.ellipse) {
1781
+ padX = Math.max(lines * fontSize, minH) / 2;
1782
+ padY = padX;
1783
+ } else {
1784
+ ({ padX, padY, offset } = visMarginPads(layer.margin, fit.square));
1785
+ }
1786
+ const empty = typeof layer.label !== "string" || layer.label === "";
1787
+ const [boxW, boxH] = empty ? [Math.max(minW, 14), Math.max(minH, 14)] : [minW, minH];
1788
+ if (empty && fit.ellipse) {
1789
+ padX = boxH / 2;
1790
+ padY = padX;
1791
+ }
1792
+ const row = {
1793
+ ...offset,
1794
+ labelFit: "bounds",
1795
+ labelPaddingX: padX,
1796
+ labelPaddingY: padY,
1797
+ width: boxW > 0 ? boxW + 2 * padX : 0,
1798
+ height: boxH > 0 ? boxH + 2 * padY : 0
1799
+ };
1800
+ if (fit.square) {
1801
+ row.labelFitSquare = true;
1802
+ }
1803
+ return row;
1804
+ }
1805
+ function visMarginPads(m, square) {
1806
+ const length = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 ? v : null;
1807
+ const side = (key) => (isJsonObject(m) ? length(m[key]) : length(m)) ?? VIS_MARGIN;
1808
+ const offset = {};
1809
+ if (!square && side("left") !== side("right")) {
1810
+ offset.labelOffsetX = (side("left") - side("right")) / 2;
1811
+ }
1812
+ if (!square && side("top") !== side("bottom")) {
1813
+ offset.labelOffsetY = (side("top") - side("bottom")) / 2;
1814
+ }
1815
+ return { padX: (side("left") + side("right")) / 2, padY: (side("top") + side("bottom")) / 2, offset };
1816
+ }
1817
+ function visLabelScaled(layer, range) {
1818
+ const value = finiteValue(layer.value);
1819
+ const label = layer.scalingLabel;
1820
+ if (value === null || range === null || !isJsonObject(label) || label.enabled !== true) {
1821
+ return null;
1822
+ }
1823
+ const min = typeof label.min === "number" ? label.min : 14;
1824
+ const max = typeof label.max === "number" ? label.max : 30;
1825
+ return visScaled(value, range, min, max);
1826
+ }
1827
+ const VIS_SIZE = 25;
1828
+ const VIS_SCALING = [10, 30];
1829
+ function visValueRange(n, valueOf) {
1830
+ let min = Infinity;
1831
+ let max = -Infinity;
1832
+ for (let i = 0; i < n; i++) {
1833
+ const v = valueOf(i);
1834
+ if (v !== null) {
1835
+ min = Math.min(min, v);
1836
+ max = Math.max(max, v);
1837
+ }
1838
+ }
1839
+ return min <= max ? [min, max] : null;
1840
+ }
1841
+ const finiteValue = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
1842
+ function visScaled(value, range, min, max) {
1843
+ const [lo, hi] = range;
1844
+ const scale = hi === lo ? 0.5 : Math.max(0, (value - lo) / (hi - lo));
1845
+ return min + scale * (max - min);
1846
+ }
1847
+ const VIS_EDGE_SCALING = [1, 15];
1848
+ function visEdgeWidth(layer, defaults, range, site) {
1849
+ if (range === null) {
1850
+ return {};
1851
+ }
1852
+ const value = finiteValue(layer.value);
1853
+ if (value !== null) {
1854
+ const min = typeof layer.scalingMin === "number" ? layer.scalingMin : VIS_EDGE_SCALING[0];
1855
+ const max = typeof layer.scalingMax === "number" ? layer.scalingMax : VIS_EDGE_SCALING[1];
1856
+ return { width: visScaled(value, range, min, max) };
1857
+ }
1858
+ return { width: (defaults.width === void 0 ? null : canonNumber(defaults.width, site("width"))) ?? 1 };
1859
+ }
1860
+ function visRadius(layer, range, site) {
1861
+ const value = finiteValue(layer.value);
1862
+ if (value !== null && range !== null) {
1863
+ const min = typeof layer.scalingMin === "number" ? layer.scalingMin : VIS_SCALING[0];
1864
+ const max = typeof layer.scalingMax === "number" ? layer.scalingMax : VIS_SCALING[1];
1865
+ return visScaled(value, range, min, max);
1866
+ }
1867
+ const size = layer.size === void 0 ? null : canonNumber(layer.size, site("width"));
1868
+ return size ?? VIS_SIZE;
1869
+ }
1197
1870
  function visGroupDefs(src, options) {
1198
1871
  if (isJsonObject(options.groups)) {
1199
1872
  return options.groups;
@@ -1219,15 +1892,38 @@ function visGroupLayers(n, groupOf, groupDefs) {
1219
1892
  }
1220
1893
  return { groupLayers, paletteRows };
1221
1894
  }
1222
- function visEdges(snapshot, edgeDefaults, borderOf, notes, context) {
1895
+ function visOwnGroup(groupLayers, groupDefs) {
1896
+ const cache = /* @__PURE__ */ new Map();
1897
+ return (g, own) => {
1898
+ const whole = groupLayers.get(g) ?? {};
1899
+ const def = Object.hasOwn(groupDefs, g) ? groupDefs[g] : null;
1900
+ const skip = Object.keys(own).filter(
1901
+ (k) => k !== "font" && (isJsonObject(def) ? Object.hasOwn(def, k) : k === "color")
1902
+ );
1903
+ if (skip.length === 0) {
1904
+ return whole;
1905
+ }
1906
+ const key = `${g}\0${skip.join("\0")}`;
1907
+ let layer = cache.get(key);
1908
+ if (layer === void 0) {
1909
+ layer = isJsonObject(def) ? visLayer(Object.fromEntries(Object.entries(def).filter(([k]) => !skip.includes(k))), "node") : {};
1910
+ cache.set(key, layer);
1911
+ }
1912
+ return layer;
1913
+ };
1914
+ }
1915
+ function visEdges(snapshot, edgeDefaults, borderOf, geometry, notes, context) {
1223
1916
  const m = snapshot.edgeCount;
1224
1917
  const edge = valuesOf(m);
1225
1918
  const edgeRecords = elementRecords(snapshot, "edge");
1226
1919
  const inherited = new Array(m).fill(null);
1227
1920
  let inheriting = 0;
1921
+ const range = visValueRange(m, (e) => finiteValue({ ...edgeDefaults, ...edgeRecords(e) }.value));
1922
+ let roundCaps = false;
1228
1923
  for (let e = 0; e < m; e++) {
1229
1924
  const own = edgeRecords(e);
1230
- const merged = { ...edgeDefaults, ...own };
1925
+ const bridged = own.dashes === void 0 && Array.isArray(edgeDefaults.dashes) ? { dashes: true } : {};
1926
+ const merged = { ...edgeDefaults, ...own, ...bridged };
1231
1927
  const site = (property) => ({
1232
1928
  notes,
1233
1929
  target: "edge",
@@ -1235,24 +1931,49 @@ function visEdges(snapshot, edgeDefaults, borderOf, notes, context) {
1235
1931
  element: e,
1236
1932
  budget: context.budget
1237
1933
  });
1238
- const vals = visValues(merged, "edge", site, true);
1934
+ const [s, t] = [snapshot.edgeSource(e), snapshot.edgeTarget(e)];
1935
+ const vals = {
1936
+ ...visValues(merged, "edge", site, true),
1937
+ ...visEdgeWidth(merged, edgeDefaults, range, site),
1938
+ ...visRoute(edgeDefaults, own, s, t, geometry),
1939
+ ...visEdgeLabel(merged, range, geometry.at(s), geometry.at(t))
1940
+ };
1941
+ roundCaps ||= merged.hidden !== true && ![void 0, false, "false"].includes(merged.dashes);
1942
+ const band = roundCaps && isJsonObject(merged.background) ? visBandStyle(merged.background, true) : null;
1943
+ if (band !== null) {
1944
+ vals.outlineStyle = band;
1945
+ }
1946
+ const from = visEdgeInherit(vals, own.inherit ?? edgeDefaults.inherit ?? "from", borderOf, s, t);
1239
1947
  for (const [p, v] of Object.entries(vals)) {
1240
1948
  edge.put(p, e, v);
1241
1949
  }
1242
- const inherit = own.inherit ?? edgeDefaults.inherit ?? "from";
1243
- if (inherit === false || inherit === "false") {
1244
- if (vals.color === void 0) {
1245
- edge.put("color", e, VIS_EDGE_COLOR);
1246
- }
1247
- continue;
1248
- }
1249
- if (inherit === "both") {
1250
- notes.add(STYLE_ISSUE.GRADIENT, "edge", "color", { sample: "inherit both", element: e });
1950
+ if (from !== null) {
1951
+ inherited[e] = from;
1952
+ inheriting++;
1251
1953
  }
1252
- inherited[e] = borderOf(inherit === "to" ? snapshot.edgeTarget(e) : snapshot.edgeSource(e));
1253
- inheriting++;
1254
1954
  }
1255
1955
  context.budget.spend("edge", m);
1956
+ const { rules, columns } = visEdgeRules(edgeDefaults, notes, inherited, inheriting);
1957
+ return { values: edge.values, rules, columns };
1958
+ }
1959
+ function visEdgeInherit(vals, inherit, borderOf, s, t) {
1960
+ const inherits = inherit !== false && inherit !== "false";
1961
+ if (inherits) {
1962
+ delete vals.color;
1963
+ }
1964
+ if (inherit === "both") {
1965
+ vals.gradientKind = "linear";
1966
+ vals.gradientColors = `${String(borderOf(s))} ${String(borderOf(t))}`;
1967
+ }
1968
+ if (!inherits) {
1969
+ if (vals.color === void 0) {
1970
+ vals.color = VIS_EDGE_COLOR;
1971
+ }
1972
+ return null;
1973
+ }
1974
+ return borderOf(inherit === "to" ? t : s);
1975
+ }
1976
+ function visEdgeRules(edgeDefaults, notes, inherited, inheriting) {
1256
1977
  const edgeRules = [];
1257
1978
  const edgeColumns = /* @__PURE__ */ new Map();
1258
1979
  const declaredEdge = visValues(edgeDefaults, "edge", (property) => ({ notes, target: "edge", property }), true);
@@ -1271,16 +1992,273 @@ function visEdges(snapshot, edgeDefaults, borderOf, notes, context) {
1271
1992
  facts: { elements: inheriting, reason: "SOURCE_NODE_COLOR" }
1272
1993
  });
1273
1994
  }
1274
- return { values: edge.values, rules: edgeRules, columns: edgeColumns };
1995
+ return { rules: edgeRules, columns: edgeColumns };
1996
+ }
1997
+ function visGeometry(snapshot, nodeValues, shapes) {
1998
+ const whole = (v) => {
1999
+ if (typeof v === "string") {
2000
+ return Number.parseInt(v, 10);
2001
+ }
2002
+ return typeof v === "number" && Number.isFinite(v) ? Math.trunc(v) : Number.NaN;
2003
+ };
2004
+ const [xs, ys] = [cells(snapshot, "node", "x"), cells(snapshot, "node", "y")];
2005
+ const num = (v) => typeof v === "number" && v > 0 ? v : null;
2006
+ return {
2007
+ at: (i) => {
2008
+ const p = [whole(xs?.(i)), whole(ys?.(i))];
2009
+ return Number.isNaN(p[0]) || Number.isNaN(p[1]) ? null : p;
2010
+ },
2011
+ box: (i) => {
2012
+ const [w, h] = [num(nodeValues.width?.[i]), num(nodeValues.height?.[i])];
2013
+ const bw = nodeValues.borderWidth?.[i];
2014
+ return w === null || h === null ? null : [w / 2, h / 2, typeof bw === "number" ? bw : 1, shapes[i]];
2015
+ }
2016
+ };
2017
+ }
2018
+ function visSmooth(...layers) {
2019
+ const s = { enabled: true, type: "dynamic", roundness: 0.5, forceDirection: "none" };
2020
+ for (const l of layers) {
2021
+ if (typeof l === "boolean") {
2022
+ s.enabled = l;
2023
+ } else if (isJsonObject(l)) {
2024
+ s.enabled = typeof l.enabled === "boolean" ? l.enabled : s.enabled;
2025
+ s.type = typeof l.type === "string" ? l.type : s.type;
2026
+ s.roundness = typeof l.roundness === "number" && Number.isFinite(l.roundness) ? l.roundness : s.roundness;
2027
+ s.forceDirection = l.forceDirection ?? s.forceDirection;
2028
+ }
2029
+ }
2030
+ return s;
2031
+ }
2032
+ function visEdgeLabel(merged, range, a, b) {
2033
+ const row = {};
2034
+ const size = visLabelScaled(merged, range);
2035
+ if (size !== null) {
2036
+ row.labelSize = size;
2037
+ }
2038
+ const turn = visLabelTurn(merged.fontAlign, a, b);
2039
+ if (turn !== null) {
2040
+ row.labelRotation = turn;
2041
+ }
2042
+ return row;
2043
+ }
2044
+ function visLabelTurn(align, a, b) {
2045
+ if (typeof align !== "string" || align === "horizontal" || a === null || b === null) {
2046
+ return null;
2047
+ }
2048
+ const [dx, dy] = [a[0] - b[0], a[1] - b[1]];
2049
+ let angle = Math.atan2(dy, dx);
2050
+ if (angle < -1 && dx < 0 || angle > 0 && dx < 0) {
2051
+ angle += Math.PI;
2052
+ }
2053
+ const degrees = Math.round(angle * 180 / Math.PI * 1e4) / 1e4;
2054
+ return degrees < 0 ? degrees + 360 : degrees;
2055
+ }
2056
+ function visStaticVia(from, to, smooth) {
2057
+ const f = smooth.roundness;
2058
+ const [fx, fy] = from;
2059
+ const [tx, ty] = to;
2060
+ const dx = Math.abs(fx - tx);
2061
+ const dy = Math.abs(fy - ty);
2062
+ const step = f * Math.max(dx, dy);
2063
+ const sx = step * (Math.sign(tx - fx) || 1);
2064
+ const sy = step * (Math.sign(ty - fy) || -1);
2065
+ const backX = (1 - f) * dx * (Math.sign(fx - tx) || 1);
2066
+ const backY = (1 - f) * dy * (Math.sign(fy - ty) || 1);
2067
+ switch (smooth.type) {
2068
+ case "discrete":
2069
+ return visDiscreteVia(from, [fx + sx, fy + sy], dx, dy, f);
2070
+ case "diagonalCross":
2071
+ return [fx + sx, fy + sy];
2072
+ case "straightCross":
2073
+ return dx <= dy ? [tx, ty + backY] : [tx + backX, ty];
2074
+ case "horizontal":
2075
+ return [tx + backX, fy];
2076
+ case "vertical":
2077
+ return [fx, ty + backY];
2078
+ case "curvedCW":
2079
+ return visCurvedVia(from, to, f, f * 0.5 + 0.5);
2080
+ case "curvedCCW":
2081
+ return visCurvedVia(from, to, f, -f * 0.5 + 0.5);
2082
+ default:
2083
+ return dx <= dy ? [fx + Math.sign(sx) * Math.min(step, dx), fy + sy] : [fx + sx, fy + Math.sign(sy) * Math.min(step, dy)];
2084
+ }
2085
+ }
2086
+ function visDiscreteVia(from, diagonal, dx, dy, f) {
2087
+ if (dx <= dy) {
2088
+ return [dx < f * dy ? from[0] : diagonal[0], diagonal[1]];
2089
+ }
2090
+ return [diagonal[0], dy < f * dx ? from[1] : diagonal[1]];
2091
+ }
2092
+ function visCurvedVia(from, to, f, turn) {
2093
+ const ex = to[0] - from[0];
2094
+ const ey = from[1] - to[1];
2095
+ const r = (f * 0.5 + 0.5) * Math.hypot(ex, ey);
2096
+ const angle = (Math.atan2(ey, ex) + turn * Math.PI) % (2 * Math.PI);
2097
+ return [from[0] + r * Math.sin(angle), from[1] + r * Math.cos(angle)];
2098
+ }
2099
+ function visCubicVia(from, to, smooth) {
2100
+ const [dx, dy] = [from[0] - to[0], from[1] - to[1]];
2101
+ const r = smooth.roundness;
2102
+ const force = smooth.forceDirection;
2103
+ const across = (Math.abs(dx) > Math.abs(dy) || force === true || force === "horizontal") && force !== "vertical";
2104
+ return across ? [
2105
+ [from[0] - r * dx, from[1]],
2106
+ [to[0] + r * dx, to[1]]
2107
+ ] : [
2108
+ [from[0], from[1] - r * dy],
2109
+ [to[0], to[1] + r * dy]
2110
+ ];
2111
+ }
2112
+ function alongAcross(a, b, p) {
2113
+ const [dx, dy] = [b[0] - a[0], b[1] - a[1]];
2114
+ const [qx, qy] = [p[0] - a[0], p[1] - a[1]];
2115
+ const l2 = dx * dx + dy * dy;
2116
+ return `${fraction((qx * dx + qy * dy) / l2)},${fraction((dy * qx - dx * qy) / l2)}`;
2117
+ }
2118
+ const fraction = (v) => String(Math.round(v * 1e4) / 1e4 || 0);
2119
+ function visRoute(defaults, own, s, t, g) {
2120
+ if (s === t) {
2121
+ return visLoop(defaults, own, g.box(s));
2122
+ }
2123
+ const smooth = visSmooth(defaults.smooth, own.smooth);
2124
+ const [a, b] = [g.at(s), g.at(t)];
2125
+ if (!smooth.enabled || smooth.type === "dynamic" || a === null || b === null || a[0] === b[0] && a[1] === b[1]) {
2126
+ return {};
2127
+ }
2128
+ const controls = smooth.type === "cubicBezier" ? visCubicVia(a, b, smooth) : [visStaticVia(a, b, smooth)];
2129
+ return { curved: true, bendCurve: "bezier", bends: controls.map((p) => alongAcross(a, b, p)).join(" ") };
2130
+ }
2131
+ function visLoop(defaults, own, box) {
2132
+ if (box === null) {
2133
+ return {};
2134
+ }
2135
+ const field = (layer, key) => isJsonObject(layer.selfReference) ? layer.selfReference[key] : void 0;
2136
+ const pick = (...vs) => vs.find((v) => typeof v === "number" && Number.isFinite(v)) ?? null;
2137
+ const radius = pick(field(own, "size"), own.selfReferenceSize, field(defaults, "size"), defaults.selfReferenceSize) ?? 20;
2138
+ const angle = pick(field(own, "angle"), field(defaults, "angle")) ?? Math.PI / 4;
2139
+ const [hw, hh] = box;
2140
+ const reach = visToBorder(box, angle);
2141
+ const [cx, cy] = [Math.cos(angle) * reach, Math.sin(angle) * reach];
2142
+ const behind = [field(own, "renderBehindTheNode"), field(defaults, "renderBehindTheNode")].find(
2143
+ (v) => typeof v === "boolean"
2144
+ );
2145
+ if (behind === false) {
2146
+ return visFrontArc(cx, cy, radius, angle, box);
2147
+ }
2148
+ const round = box[3] === "dot" || box[3] === "circle" || box[3] === "circularImage";
2149
+ if (reach + (round ? hw : Math.hypot(hw, hh)) < radius) {
2150
+ return visRing(cx, cy, radius, angle, box);
2151
+ }
2152
+ const corners = [];
2153
+ for (let k = 0; k <= 4; k++) {
2154
+ const a = angle + Math.PI + k % 4 * Math.PI / 2;
2155
+ const [x, y] = [cx + Math.SQRT2 * radius * Math.cos(a), cy + Math.SQRT2 * radius * Math.sin(a)];
2156
+ corners.push(`${fraction(x / hw)},${fraction(y / hh)}`);
2157
+ }
2158
+ return { curved: true, bendCurve: "midpoints", bends: corners.join(" ") };
2159
+ }
2160
+ const VIS_RING_STEPS = 96;
2161
+ function visRing(cx, cy, radius, angle, box) {
2162
+ const [hw, hh] = box;
2163
+ const points = [];
2164
+ for (let k = 0; k <= VIS_RING_STEPS; k++) {
2165
+ const a = angle + Math.PI + 2 * Math.PI * (k % VIS_RING_STEPS) / VIS_RING_STEPS;
2166
+ points.push(`${fraction((cx + radius * Math.cos(a)) / hw)},${fraction((cy + radius * Math.sin(a)) / hh)}`);
2167
+ }
2168
+ return { curved: false, bends: points.join(" ") };
2169
+ }
2170
+ function visFrontArc(cx, cy, radius, angle, box) {
2171
+ const [x, y] = [cx, -cy];
2172
+ const search = (direction) => {
2173
+ let [low, high] = [angle, angle + Math.PI];
2174
+ let pos = [x, y];
2175
+ for (let iteration = 0; low <= high && iteration < 10; iteration++) {
2176
+ const middle = (low + high) * 0.5;
2177
+ const turn = middle * 2 * Math.PI;
2178
+ pos = [x + radius * Math.cos(turn), y - radius * Math.sin(turn)];
2179
+ const difference = visToBorder(box, Math.atan2(-pos[1], -pos[0])) - Math.hypot(pos[0], pos[1]);
2180
+ if (Math.abs(difference) < 0.05) {
2181
+ break;
2182
+ }
2183
+ if (difference > 0 === direction > 0) {
2184
+ low = middle;
2185
+ } else {
2186
+ high = middle;
2187
+ }
2188
+ }
2189
+ return pos;
2190
+ };
2191
+ const [from, to] = [search(-1), search(1)];
2192
+ const start = Math.atan2(from[1] - y, from[0] - x);
2193
+ let end = Math.atan2(to[1] - y, to[0] - x);
2194
+ if (end < start) {
2195
+ end += 2 * Math.PI;
2196
+ }
2197
+ const [hw, hh] = box;
2198
+ const steps = Math.max(2, Math.ceil((end - start) / (2 * Math.PI) * VIS_RING_STEPS));
2199
+ const points = [];
2200
+ for (let k = 0; k <= steps; k++) {
2201
+ const a = start + (end - start) * k / steps;
2202
+ points.push(`${fraction((x + radius * Math.cos(a)) / hw)},${fraction(-(y + radius * Math.sin(a)) / hh)}`);
2203
+ }
2204
+ return { curved: false, bends: points.join(" ") };
2205
+ }
2206
+ function visToBorder(box, angle) {
2207
+ const [hw, hh, bw, shape] = box;
2208
+ if (shape === "dot" || shape === "circle" || shape === "circularImage") {
2209
+ return hw;
2210
+ }
2211
+ if (shape === "ellipse") {
2212
+ return hw * hh / Math.hypot(Math.sin(angle) * hw, Math.cos(angle) * hh);
2213
+ }
2214
+ return Math.min(Math.abs(hw / Math.cos(angle)), Math.abs(hh / Math.sin(angle))) + bw;
1275
2215
  }
1276
2216
  const VIS_KEYS = {
1277
- node: ["color", "shape", "size", "borderWidth", "opacity", "hidden", "label", "title", "font"],
1278
- edge: ["color", "width", "dashes", "arrows", "hidden", "label", "title", "font"]
2217
+ node: [
2218
+ "color",
2219
+ "shape",
2220
+ "size",
2221
+ "value",
2222
+ "scaling",
2223
+ "borderWidth",
2224
+ "opacity",
2225
+ "hidden",
2226
+ "label",
2227
+ "title",
2228
+ "font",
2229
+ "margin",
2230
+ "widthConstraint",
2231
+ "heightConstraint",
2232
+ "image",
2233
+ "brokenImage",
2234
+ "imagePadding",
2235
+ "icon",
2236
+ "shapeProperties"
2237
+ ],
2238
+ edge: [
2239
+ "color",
2240
+ "width",
2241
+ "value",
2242
+ "scaling",
2243
+ "dashes",
2244
+ "arrows",
2245
+ "hidden",
2246
+ "label",
2247
+ "title",
2248
+ "font",
2249
+ "background",
2250
+ "smooth",
2251
+ "selfReference",
2252
+ "selfReferenceSize",
2253
+ "physics",
2254
+ "widthConstraint"
2255
+ ]
1279
2256
  };
1280
- function nodeRecords(snapshot) {
1281
- return elementRecords(snapshot, "node");
1282
- }
1283
2257
  function elementRecords(snapshot, target) {
2258
+ const raw = elementRaw(snapshot, target);
2259
+ return (i) => visLayer(raw(i), target);
2260
+ }
2261
+ function elementRaw(snapshot, target) {
1284
2262
  const readers = VIS_KEYS[target].map((name) => [name, cells(snapshot, target, name)]).filter((x) => x[1] !== null);
1285
2263
  return (i) => {
1286
2264
  const record = {};
@@ -1290,7 +2268,7 @@ function elementRecords(snapshot, target) {
1290
2268
  record[name] = v;
1291
2269
  }
1292
2270
  }
1293
- return visLayer(record, target);
2271
+ return record;
1294
2272
  };
1295
2273
  }
1296
2274
  function rule(id, target, role, origin, where, set) {
@@ -1353,10 +2331,44 @@ const visSize = (want) => {
1353
2331
  const shape = typeof s === "string" ? visShape(s)[0] : "ellipse";
1354
2332
  return VIS_SIZED.has(shape) ? oneSize(want) : null;
1355
2333
  };
2334
+ const visShapeBack = (want) => {
2335
+ const s = want("shape");
2336
+ return typeof s === "string" ? visShape(s)[0] : "ellipse";
2337
+ };
2338
+ const visShapeFactBack = (property) => (want) => {
2339
+ const shape = visShapeBack(want);
2340
+ const size = visSize(want);
2341
+ if (shape === "hexagon" && typeof size === "number") {
2342
+ return property === "height" ? Math.sqrt(3) * size / 2 : (2 - Math.sqrt(3)) * size / 4;
2343
+ }
2344
+ return property === "labelOffsetY" && shape === "database" ? VIS_MARGIN : null;
2345
+ };
2346
+ const visFitBack = (property) => (want) => {
2347
+ const s = want("shape");
2348
+ const shape = typeof s === "string" ? visShape(s)[0] : "ellipse";
2349
+ return visLabelFit({ fontSize: want("labelSize"), label: want("label") }, shape)[property] ?? null;
2350
+ };
2351
+ function visWritten(snapshot, edgeValues) {
2352
+ const loop = (property) => (want, i) => snapshot.edgeSource(i) === snapshot.edgeTarget(i) ? edgeValues[property]?.[i] ?? null : want(property);
2353
+ return {
2354
+ node: VIS_WRITTEN.node,
2355
+ edge: { ...VIS_WRITTEN.edge, bends: loop("bends"), bendCurve: loop("bendCurve"), curved: loop("curved") }
2356
+ };
2357
+ }
1356
2358
  const VIS_WRITTEN = {
1357
2359
  node: {
1358
- width: visSize,
1359
- height: visSize,
2360
+ width: (want) => visSize(want) ?? visFitBack("width")(want),
2361
+ height: (want) => visShapeFactBack("height")(want) ?? visSize(want) ?? visFitBack("height")(want),
2362
+ labelOffsetY: visShapeFactBack("labelOffsetY"),
2363
+ labelFit: visFitBack("labelFit"),
2364
+ labelPaddingX: visFitBack("labelPaddingX"),
2365
+ labelPaddingY: visFitBack("labelPaddingY"),
2366
+ labelFitSquare: visFitBack("labelFitSquare"),
2367
+ // the writer writes hex colors, whose alpha vis-network's node opacity replaces, the border's too
2368
+ borderOpacity: (want) => {
2369
+ const opacity = want("opacity");
2370
+ return typeof opacity === "number" ? opacity : want("borderOpacity");
2371
+ },
1360
2372
  shape: (want) => {
1361
2373
  const s = want("shape");
1362
2374
  if (typeof s !== "string") {
@@ -1364,6 +2376,17 @@ const VIS_WRITTEN = {
1364
2376
  }
1365
2377
  const site = { notes: new StyleNotes(), target: "node", property: "shape" };
1366
2378
  return canonEnum("shape", visShape(s)[0], "vis", site);
2379
+ },
2380
+ labelPosition: (want) => {
2381
+ const s = want("shape");
2382
+ if (typeof s !== "string") {
2383
+ return null;
2384
+ }
2385
+ const shape = visShape(s)[0];
2386
+ if (shape === "database") {
2387
+ return "inside-top";
2388
+ }
2389
+ return VIS_SIZED.has(shape) ? "bottom" : "center";
1367
2390
  }
1368
2391
  },
1369
2392
  edge: {
@@ -1372,7 +2395,11 @@ const VIS_WRITTEN = {
1372
2395
  if (s === null) {
1373
2396
  return null;
1374
2397
  }
1375
- return s === "solid" ? "solid" : "dashed";
2398
+ if (s === "solid") {
2399
+ return "solid";
2400
+ }
2401
+ const width = want("width");
2402
+ return visDashStyle([5, 5], typeof width === "number" ? width : 1, true);
1376
2403
  },
1377
2404
  targetArrow: (want) => arrowBack(want("targetArrow")),
1378
2405
  sourceArrow: (want) => arrowBack(want("sourceArrow"))
@@ -1404,8 +2431,8 @@ const NATIVE = {
1404
2431
  edge: cyjsProperties(CYJS_EDGE_PROPERTIES, ["curved", "labelItalic", "visible"])
1405
2432
  },
1406
2433
  graphology: {
1407
- node: ["fill", "fillOpacity", "width", "height", "label", "visible"],
1408
- edge: ["color", "opacity", "width", "label", "visible"]
2434
+ node: ["fill", "fillOpacity", "width", "height", "label"],
2435
+ edge: ["color", "opacity", "width", "label"]
1409
2436
  },
1410
2437
  vis: {
1411
2438
  node: [
@@ -1795,18 +2822,27 @@ function writeGraphology$1(out, input, approximated, replaced) {
1795
2822
  writeKey(
1796
2823
  table,
1797
2824
  "size",
1798
- target === "node" ? nodeSizes(p("node", "width"), p("node", "height"), approximated) : p("edge", "width"),
2825
+ target === "node" ? nodeSizes(p("node", "width"), p("node", "height"), approximated).map(
2826
+ (d) => d === null ? null : d / 2
2827
+ ) : (
2828
+ // sigma draws an edge half as wide as its size (readSigmaRow)
2829
+ p("edge", "width").map((w) => typeof w === "number" ? w * 2 : w)
2830
+ ),
1799
2831
  replaced
1800
2832
  );
1801
2833
  writeKey(table, "label", p(target, "label"), replaced);
1802
- writeKey(
1803
- table,
1804
- "hidden",
1805
- p(target, "visible").map((v) => v === false ? true : null),
1806
- replaced
1807
- );
1808
2834
  }
1809
2835
  }
2836
+ function keepScaled(table, sizes, replaced) {
2837
+ const value = table.get("value");
2838
+ if (value === null) {
2839
+ return;
2840
+ }
2841
+ const scaling = sizes.map(
2842
+ (v, i) => typeof v !== "number" || typeof plainCell(value.value(i)) !== "number" ? null : { min: v, max: v }
2843
+ );
2844
+ writeKey(table, "scaling", scaling, replaced);
2845
+ }
1810
2846
  function writeVis$1(out, input, approximated, replaced) {
1811
2847
  const p = (target, property) => input.picture(target, property);
1812
2848
  const font = (target) => {
@@ -1859,7 +2895,8 @@ function writeVis$1(out, input, approximated, replaced) {
1859
2895
  );
1860
2896
  const sizes = nodeSizes(p("node", "width"), p("node", "height"), approximated);
1861
2897
  const shapes = p("node", "shape").map((s, i) => {
1862
- const [shape, exact] = typeof s === "string" ? visShape(s) : [null, true];
2898
+ const [written, exact] = typeof s === "string" ? visShape(s) : [null, true];
2899
+ const shape = written === "dot" && s === "ellipse" && sizes[i] === null ? "ellipse" : written;
1863
2900
  if (!exact) {
1864
2901
  approximated.add("node", "shape", s);
1865
2902
  }
@@ -1869,7 +2906,9 @@ function writeVis$1(out, input, approximated, replaced) {
1869
2906
  return shape;
1870
2907
  });
1871
2908
  writeKey(out.nodes, "shape", shapes, replaced);
1872
- writeKey(out.nodes, "size", sizes, replaced);
2909
+ const radii = sizes.map((d) => d === null ? null : d / 2);
2910
+ writeKey(out.nodes, "size", radii, replaced);
2911
+ keepScaled(out.nodes, radii, replaced);
1873
2912
  writeKey(out.nodes, "borderWidth", p("node", "borderWidth"), replaced);
1874
2913
  writeKey(out.nodes, "opacity", p("node", "opacity"), replaced);
1875
2914
  label(out.nodes, "node");
@@ -1890,7 +2929,9 @@ function writeVis$1(out, input, approximated, replaced) {
1890
2929
  }),
1891
2930
  replaced
1892
2931
  );
1893
- writeKey(out.edges, "width", p("edge", "width"), replaced);
2932
+ const widths = p("edge", "width");
2933
+ writeKey(out.edges, "width", widths, replaced);
2934
+ keepScaled(out.edges, widths, replaced);
1894
2935
  writeKey(
1895
2936
  out.edges,
1896
2937
  "dashes",
@@ -2098,6 +3139,8 @@ const GRAPHOLOGY_NODE_KEYS = /* @__PURE__ */ new Set(["key", "attributes"]);
2098
3139
  const GRAPHOLOGY_EDGE_KEYS = /* @__PURE__ */ new Set(["key", "source", "target", "attributes", "undirected"]);
2099
3140
  const GEPHI_NODE_KEYS = /* @__PURE__ */ new Set(["id", "attributes"]);
2100
3141
  const GEPHI_EDGE_KEYS = /* @__PURE__ */ new Set([...GRAPHOLOGY_EDGE_KEYS, "id"]);
3142
+ const GEPHI_NODE_DISPLAY_KEYS = /* @__PURE__ */ new Set(["label", "x", "y", "size", "color"]);
3143
+ const GEPHI_EDGE_DISPLAY_KEYS = /* @__PURE__ */ new Set(["label", "size", "color"]);
2101
3144
  const VIS_SOURCE_KEYS = Object.freeze(["from"]);
2102
3145
  const VIS_TARGET_KEYS = Object.freeze(["to"]);
2103
3146
  const PATH_DIALECTS = /* @__PURE__ */ new Set([
@@ -2145,9 +3188,26 @@ function resolveJsonOptions(options) {
2145
3188
  oboIds,
2146
3189
  typedefs,
2147
3190
  nodesPath,
2148
- edgesPath
3191
+ edgesPath,
3192
+ sigma: sigmaSettingsOption(o.sigmaSettings)
2149
3193
  };
2150
3194
  }
3195
+ function sigmaSettingsOption(value) {
3196
+ if (value === void 0) {
3197
+ return SIGMA_DEFAULT_SETTINGS;
3198
+ }
3199
+ if (!isJsonObject(value)) {
3200
+ throw unsupportedOption("sigmaSettings", value, ["an object of sigma.js settings"]);
3201
+ }
3202
+ const { renderEdgeLabels = false, edgeLabelAnchors = "nodeLabels" } = value;
3203
+ if (typeof renderEdgeLabels !== "boolean") {
3204
+ throw unsupportedOption("sigmaSettings.renderEdgeLabels", renderEdgeLabels, ["true", "false"]);
3205
+ }
3206
+ if (edgeLabelAnchors !== "nodeLabels" && edgeLabelAnchors !== "allNodes") {
3207
+ throw unsupportedOption("sigmaSettings.edgeLabelAnchors", edgeLabelAnchors, ["nodeLabels", "allNodes"]);
3208
+ }
3209
+ return { renderEdgeLabels, edgeLabelAnchors };
3210
+ }
2151
3211
  function pathOption(name, value) {
2152
3212
  if (value === void 0) {
2153
3213
  return null;
@@ -2776,15 +3836,17 @@ class ImportContext {
2776
3836
  * @param structural - the element keys that are not attributes
2777
3837
  * @param element - the element name for issues
2778
3838
  * @param how - `weightFrom`: the weight key to skip in the dict; `plain`: write the element-level keys under their
2779
- * own names, not with the `#element` suffix
3839
+ * own names, not with the `#element` suffix; `dataKeys`: the dict keys written with the `#data` suffix
2780
3840
  * @param how.weightFrom - the weight key to skip in the dict, or null (the default)
2781
3841
  * @param how.plain - write the element-level keys under their own names (default false)
3842
+ * @param how.dataKeys - the dict keys that name an element-level key, written as `<key>#data` (default none)
2782
3843
  */
2783
3844
  writeNested(writer, row, record, dict, structural, element, how = {}) {
2784
- const { weightFrom = null, plain = false } = how;
3845
+ const { weightFrom = null, plain = false, dataKeys } = how;
2785
3846
  for (const key of Object.keys(dict)) {
2786
3847
  if (key !== weightFrom) {
2787
- writer.write(row, key, dict[key], SUFFIX.data, element);
3848
+ const name = dataKeys?.has(key) === true ? `${key}${SUFFIX.data}` : key;
3849
+ writer.write(row, name, dict[key], SUFFIX.data, element);
2788
3850
  }
2789
3851
  }
2790
3852
  for (const key of Object.keys(record)) {
@@ -3774,7 +4836,7 @@ function importGraphology(ctx, root) {
3774
4836
  ctx.writeGraphDict(root.attributes, "attributes");
3775
4837
  const firstNode = nodes.find((n) => isJsonObject(n));
3776
4838
  const gephi = isJsonObject(firstNode) && !hasKey(firstNode, "key") && hasKey(firstNode, "id");
3777
- ctx.styleSource = { dialect: "graphology", block: blockOf(root), gephi };
4839
+ ctx.styleSource = { dialect: "graphology", block: blockOf(root), gephi, sigma: ctx.json.sigma };
3778
4840
  ctx.reportNodeIdFrom("graphology", "the node key");
3779
4841
  ctx.sink.reserve(nodes.length, edges.length);
3780
4842
  importGraphologyNodes(ctx, nodes, gephi);
@@ -3886,7 +4948,8 @@ function pushGraphologyEdge(ctx, record, element, ids, declared, violations) {
3886
4948
  ctx.setEdgeId(ids, edge, idValue);
3887
4949
  ctx.writeNested(ctx.edges, edge, record, attributes, gephi ? GEPHI_EDGE_KEYS : GRAPHOLOGY_EDGE_KEYS, element, {
3888
4950
  weightFrom: ctx.options.weightFrom,
3889
- plain: gephi
4951
+ plain: gephi,
4952
+ dataKeys: gephi ? GEPHI_EDGE_DISPLAY_KEYS : void 0
3890
4953
  });
3891
4954
  if (declared.allowSelfLoops === false && u === v) {
3892
4955
  violations.selfLoops++;
@@ -3931,7 +4994,10 @@ function pushNestedNode(ctx, id, record, dictKey, structural, element, plain = f
3931
4994
  { element }
3932
4995
  );
3933
4996
  }
3934
- ctx.writeNested(ctx.nodes, index, record, isJsonObject(dict) ? dict : {}, structural, element, { plain });
4997
+ ctx.writeNested(ctx.nodes, index, record, isJsonObject(dict) ? dict : {}, structural, element, {
4998
+ plain,
4999
+ dataKeys: plain ? GEPHI_NODE_DISPLAY_KEYS : void 0
5000
+ });
3935
5001
  } catch (err) {
3936
5002
  ctx.report.recordError(err, { element: String(id) });
3937
5003
  }
@@ -3949,7 +5015,7 @@ function importJgf(ctx, root) {
3949
5015
  `graph.nodes must be an object keyed by id or an array, found ${describe(nodesRaw)}`
3950
5016
  );
3951
5017
  }
3952
- const nodeRecords2 = Array.isArray(nodesRaw) ? nodesRaw : Object.values(nodesRaw ?? {});
5018
+ const nodeRecords = Array.isArray(nodesRaw) ? nodesRaw : Object.values(nodesRaw ?? {});
3953
5019
  const directed = jgfDirected(ctx, graph, edges);
3954
5020
  ctx.setHeader(directed);
3955
5021
  ctx.writeGraphDict(graph.metadata, "graph.metadata");
@@ -3960,18 +5026,18 @@ function importJgf(ctx, root) {
3960
5026
  };
3961
5027
  const label = typeof graph.label === "string" ? graph.label : null;
3962
5028
  ctx.reportNodeIdFrom("jgf", "the node keys");
3963
- ctx.sink.reserve(nodeRecords2.length, edges.length);
5029
+ ctx.sink.reserve(nodeRecords.length, edges.length);
3964
5030
  const labelColumn = ctx.nodes.declareIf(
3965
5031
  { name: "label", dtype: "string", role: "label", nullable: true },
3966
- anyHas(nodeRecords2, "label")
5032
+ anyHas(nodeRecords, "label")
3967
5033
  );
3968
5034
  if (isJsonObject(nodesRaw)) {
3969
5035
  for (const key of jgfNodeKeys(ctx, root, graph, nodesRaw)) {
3970
5036
  pushJgfKeyedNode(ctx, key, nodesRaw[key], labelColumn);
3971
5037
  }
3972
5038
  } else {
3973
- for (let i = 0; i < nodeRecords2.length; i++) {
3974
- pushJgfListedNode(ctx, nodeRecords2[i], labelColumn, `nodes[${i}]`);
5039
+ for (let i = 0; i < nodeRecords.length; i++) {
5040
+ pushJgfListedNode(ctx, nodeRecords[i], labelColumn, `nodes[${i}]`);
3975
5041
  }
3976
5042
  }
3977
5043
  throwIfAborted(ctx.options.signal);
@@ -4698,6 +5764,7 @@ const jsonImporter = Object.freeze({
4698
5764
  "nodeIdKey",
4699
5765
  "nodesPath",
4700
5766
  "oboIds",
5767
+ "sigmaSettings",
4701
5768
  "sourceKey",
4702
5769
  "targetKey",
4703
5770
  "typedefs"
@@ -7558,10 +8625,11 @@ export {
7558
8625
  jsonShapeOf as f,
7559
8626
  extensionOf as g,
7560
8627
  headBytes as h,
7561
- sniffJsonDialectHead as i,
8628
+ sniffFormat as i,
7562
8629
  jsonCapabilities as j,
8630
+ sniffJsonDialectHead as k,
7563
8631
  normalizeMimeType as n,
7564
8632
  rankFormats as r,
7565
- sniffFormat as s
8633
+ sniffJsonDialect as s
7566
8634
  };
7567
- //# sourceMappingURL=exporter-CrDWIyiq.js.map
8635
+ //# sourceMappingURL=exporter-D2CETOMK.js.map