@graphty/graph-io 0.3.48 → 0.3.50

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 (600) hide show
  1. package/dist/chunks/{approximations-C2riR4NT.js → approximations-BRXsll0T.js} +2 -2
  2. package/dist/chunks/{approximations-C2riR4NT.js.map → approximations-BRXsll0T.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-Cu22ewuS.js → block-yl0f_qLO.js} +931 -164
  6. package/dist/chunks/block-yl0f_qLO.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-CV_Bhcyi.js → codes-BE2xir2k.js} +6 -2
  10. package/dist/chunks/codes-BE2xir2k.js.map +1 -0
  11. package/dist/chunks/{constants-D0LqcsLJ.js → constants-CKkYLPtt.js} +2 -2
  12. package/dist/chunks/{constants-D0LqcsLJ.js.map → constants-CKkYLPtt.js.map} +1 -1
  13. package/dist/chunks/{context-cgmmOxZ2.js → context-DizmppHy.js} +5 -4
  14. package/dist/chunks/{context-cgmmOxZ2.js.map → context-DizmppHy.js.map} +1 -1
  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-BiQsnMTb.js → credentials-CmvJXYeH.js} +67 -16
  18. package/dist/chunks/credentials-CmvJXYeH.js.map +1 -0
  19. package/dist/chunks/{cx-export-BEeF6ymo.js → cx-export-Bt6NoqTQ.js} +3 -3
  20. package/dist/chunks/{cx-export-BEeF6ymo.js.map → cx-export-Bt6NoqTQ.js.map} +1 -1
  21. package/dist/chunks/descriptor-B28U25x4.js +60 -0
  22. package/dist/chunks/descriptor-B28U25x4.js.map +1 -0
  23. package/dist/chunks/{descriptor-BJ-W0Jd-.js → descriptor-Dhez_Cew.js} +11 -2
  24. package/dist/chunks/descriptor-Dhez_Cew.js.map +1 -0
  25. package/dist/chunks/{emit-CD8xnY8s.js → emit-7Jkpg0yd.js} +1788 -133
  26. package/dist/chunks/emit-7Jkpg0yd.js.map +1 -0
  27. package/dist/chunks/{escape-DH2Egt-l.js → escape-CuCIzNMB.js} +8 -8
  28. package/dist/chunks/{escape-DH2Egt-l.js.map → escape-CuCIzNMB.js.map} +1 -1
  29. package/dist/chunks/{export-CZ7VRm4I.js → export-Cha4dRFz.js} +45 -387
  30. package/dist/chunks/export-Cha4dRFz.js.map +1 -0
  31. package/dist/chunks/{exporter-ChjL5fmP.js → exporter-1Ajud15J.js} +9 -8
  32. package/dist/chunks/{exporter-ChjL5fmP.js.map → exporter-1Ajud15J.js.map} +1 -1
  33. package/dist/chunks/{exporter-BIdaoIgh.js → exporter-B6yvL3wy.js} +7 -7
  34. package/dist/chunks/{exporter-BIdaoIgh.js.map → exporter-B6yvL3wy.js.map} +1 -1
  35. package/dist/chunks/{exporter-Dcw7Ldtq.js → exporter-BP6otMO6.js} +6 -6
  36. package/dist/chunks/{exporter-Dcw7Ldtq.js.map → exporter-BP6otMO6.js.map} +1 -1
  37. package/dist/chunks/{exporter-DtVU80Fa.js → exporter-CA5q8ROP.js} +9 -8
  38. package/dist/chunks/{exporter-DtVU80Fa.js.map → exporter-CA5q8ROP.js.map} +1 -1
  39. package/dist/chunks/{exporter-bxxjOrDZ.js → exporter-CQQZFJ2v.js} +1284 -156
  40. package/dist/chunks/exporter-CQQZFJ2v.js.map +1 -0
  41. package/dist/chunks/format-BXiAb-1h.js +408 -0
  42. package/dist/chunks/format-BXiAb-1h.js.map +1 -0
  43. package/dist/chunks/{generic-CP6YD34u.js → generic-Dc21MAdg.js} +387 -31
  44. package/dist/chunks/generic-Dc21MAdg.js.map +1 -0
  45. package/dist/chunks/{importer-B87_fmVx.js → importer-C6NVpCXp.js} +327 -84
  46. package/dist/chunks/importer-C6NVpCXp.js.map +1 -0
  47. package/dist/chunks/{importer-DPZDN40-.js → importer-CKFe4q54.js} +25 -17
  48. package/dist/chunks/importer-CKFe4q54.js.map +1 -0
  49. package/dist/chunks/{importer-Bji2MeWr.js → importer-CKbUbsJA.js} +13 -10
  50. package/dist/chunks/{importer-Bji2MeWr.js.map → importer-CKbUbsJA.js.map} +1 -1
  51. package/dist/chunks/{importer-CB_zV5_L.js → importer-ClCsdgTJ.js} +208 -1104
  52. package/dist/chunks/importer-ClCsdgTJ.js.map +1 -0
  53. package/dist/chunks/{importer-e3huMZbm.js → importer-CyVZTrf0.js} +14 -10
  54. package/dist/chunks/importer-CyVZTrf0.js.map +1 -0
  55. package/dist/chunks/{importer-CVT-JyDE.js → importer-DgG4v1Ms.js} +1537 -355
  56. package/dist/chunks/importer-DgG4v1Ms.js.map +1 -0
  57. package/dist/chunks/{importer-Cyy6UseH.js → importer-asFUrIsj.js} +66 -13
  58. package/dist/chunks/importer-asFUrIsj.js.map +1 -0
  59. package/dist/chunks/{input-Ccg9I22A.js → input-CAxt_aV-.js} +4 -4
  60. package/dist/chunks/{input-Ccg9I22A.js.map → input-CAxt_aV-.js.map} +1 -1
  61. package/dist/chunks/{json-elements-By172SVq.js → json-elements-Cq76WjnZ.js} +4 -4
  62. package/dist/chunks/{json-elements-By172SVq.js.map → json-elements-Cq76WjnZ.js.map} +1 -1
  63. package/dist/chunks/{lexicon-u2SI5xcx.js → lexicon-IVRq2Uoo.js} +282 -74
  64. package/dist/chunks/lexicon-IVRq2Uoo.js.map +1 -0
  65. package/dist/chunks/{ontology-export-BwgMyuF0.js → ontology-export-OMo91mb0.js} +4 -4
  66. package/dist/chunks/{ontology-export-BwgMyuF0.js.map → ontology-export-OMo91mb0.js.map} +1 -1
  67. package/dist/chunks/{records-Cgvxz-Vx.js → records-NJiYvekn.js} +2 -2
  68. package/dist/chunks/{records-Cgvxz-Vx.js.map → records-NJiYvekn.js.map} +1 -1
  69. package/dist/chunks/{report-CgdsL9Hb.js → report-CwMfYa9J.js} +23 -23
  70. package/dist/chunks/{report-CgdsL9Hb.js.map → report-CwMfYa9J.js.map} +1 -1
  71. package/dist/chunks/round-trip-Cy3_SHRZ.js +79 -0
  72. package/dist/chunks/round-trip-Cy3_SHRZ.js.map +1 -0
  73. package/dist/chunks/{sigv4-LkAzsLAu.js → sigv4-BXwVbza3.js} +5 -5
  74. package/dist/chunks/sigv4-BXwVbza3.js.map +1 -0
  75. package/dist/chunks/{styles-CaABMoO1.js → styles-CAVmBLgp.js} +1237 -138
  76. package/dist/chunks/styles-CAVmBLgp.js.map +1 -0
  77. package/dist/chunks/styles-CPczw1Jz.js +1928 -0
  78. package/dist/chunks/styles-CPczw1Jz.js.map +1 -0
  79. package/dist/chunks/styles-boK6Ln54.js +2847 -0
  80. package/dist/chunks/styles-boK6Ln54.js.map +1 -0
  81. package/dist/chunks/{styles-yed-Cs1nmrjn.js → styles-yed-XeFBQ6VS.js} +506 -175
  82. package/dist/chunks/styles-yed-XeFBQ6VS.js.map +1 -0
  83. package/dist/chunks/{text-BuKQVMz2.js → text-ystE2bYi.js} +2 -2
  84. package/dist/chunks/{text-BuKQVMz2.js.map → text-ystE2bYi.js.map} +1 -1
  85. package/dist/csv.js +7 -7
  86. package/dist/cx.js +2 -2
  87. package/dist/cx2.js +2 -2
  88. package/dist/cys.js +1 -1
  89. package/dist/dot.js +8 -4
  90. package/dist/dot.js.map +1 -1
  91. package/dist/gexf.js +42 -12
  92. package/dist/gexf.js.map +1 -1
  93. package/dist/gml.js +848 -194
  94. package/dist/gml.js.map +1 -1
  95. package/dist/graph-io.js +230 -193
  96. package/dist/graph-io.js.map +1 -1
  97. package/dist/graphml.js +3 -3
  98. package/dist/json.js +3 -2
  99. package/dist/neo4j.js +6 -6
  100. package/dist/obo.js +1 -1
  101. package/dist/pajek.js +1 -1
  102. package/dist/positions.js +45 -3
  103. package/dist/positions.js.map +1 -1
  104. package/dist/sources-cypher.js +141 -23
  105. package/dist/sources-cypher.js.map +1 -1
  106. package/dist/sources-ndex.js +2 -2
  107. package/dist/sources-rest.js +32 -6
  108. package/dist/sources-rest.js.map +1 -1
  109. package/dist/sources-sparql.d.ts +1 -0
  110. package/dist/sources-sparql.js +439 -0
  111. package/dist/sources-sparql.js.map +1 -0
  112. package/dist/src/formats/cx/importer.d.ts.map +1 -1
  113. package/dist/src/formats/cx/importer.js +5 -1
  114. package/dist/src/formats/cx/importer.js.map +1 -1
  115. package/dist/src/formats/cx/styles.d.ts +24 -1
  116. package/dist/src/formats/cx/styles.d.ts.map +1 -1
  117. package/dist/src/formats/cx/styles.js +117 -11
  118. package/dist/src/formats/cx/styles.js.map +1 -1
  119. package/dist/src/formats/cx2/importer.d.ts.map +1 -1
  120. package/dist/src/formats/cx2/importer.js +1 -0
  121. package/dist/src/formats/cx2/importer.js.map +1 -1
  122. package/dist/src/formats/cx2/styles.d.ts.map +1 -1
  123. package/dist/src/formats/cx2/styles.js +3 -1
  124. package/dist/src/formats/cx2/styles.js.map +1 -1
  125. package/dist/src/formats/cys/importer.d.ts.map +1 -1
  126. package/dist/src/formats/cys/importer.js +1 -0
  127. package/dist/src/formats/cys/importer.js.map +1 -1
  128. package/dist/src/formats/cys/styles.d.ts +2 -0
  129. package/dist/src/formats/cys/styles.d.ts.map +1 -1
  130. package/dist/src/formats/cys/styles.js +15 -7
  131. package/dist/src/formats/cys/styles.js.map +1 -1
  132. package/dist/src/formats/dot/drawing.d.ts +98 -0
  133. package/dist/src/formats/dot/drawing.d.ts.map +1 -0
  134. package/dist/src/formats/dot/drawing.js +734 -0
  135. package/dist/src/formats/dot/drawing.js.map +1 -0
  136. package/dist/src/formats/dot/exporter.d.ts.map +1 -1
  137. package/dist/src/formats/dot/exporter.js +34 -2
  138. package/dist/src/formats/dot/exporter.js.map +1 -1
  139. package/dist/src/formats/dot/importer.d.ts +6 -1
  140. package/dist/src/formats/dot/importer.d.ts.map +1 -1
  141. package/dist/src/formats/dot/importer.js +170 -33
  142. package/dist/src/formats/dot/importer.js.map +1 -1
  143. package/dist/src/formats/dot/index.d.ts +3 -1
  144. package/dist/src/formats/dot/index.d.ts.map +1 -1
  145. package/dist/src/formats/dot/index.js +2 -1
  146. package/dist/src/formats/dot/index.js.map +1 -1
  147. package/dist/src/formats/dot/label-places.d.ts +41 -0
  148. package/dist/src/formats/dot/label-places.d.ts.map +1 -0
  149. package/dist/src/formats/dot/label-places.js +185 -0
  150. package/dist/src/formats/dot/label-places.js.map +1 -0
  151. package/dist/src/formats/dot/names.d.ts +13 -0
  152. package/dist/src/formats/dot/names.d.ts.map +1 -1
  153. package/dist/src/formats/dot/names.js +13 -0
  154. package/dist/src/formats/dot/names.js.map +1 -1
  155. package/dist/src/formats/dot/record.d.ts +50 -0
  156. package/dist/src/formats/dot/record.d.ts.map +1 -0
  157. package/dist/src/formats/dot/record.js +275 -0
  158. package/dist/src/formats/dot/record.js.map +1 -0
  159. package/dist/src/formats/dot/styles.d.ts +72 -2
  160. package/dist/src/formats/dot/styles.d.ts.map +1 -1
  161. package/dist/src/formats/dot/styles.js +1500 -119
  162. package/dist/src/formats/dot/styles.js.map +1 -1
  163. package/dist/src/formats/gexf/dialog-metrics.d.ts +15 -0
  164. package/dist/src/formats/gexf/dialog-metrics.d.ts.map +1 -0
  165. package/dist/src/formats/gexf/dialog-metrics.js +59 -0
  166. package/dist/src/formats/gexf/dialog-metrics.js.map +1 -0
  167. package/dist/src/formats/gexf/importer.d.ts +7 -0
  168. package/dist/src/formats/gexf/importer.d.ts.map +1 -1
  169. package/dist/src/formats/gexf/importer.js +41 -5
  170. package/dist/src/formats/gexf/importer.js.map +1 -1
  171. package/dist/src/formats/gexf/preview.d.ts +77 -0
  172. package/dist/src/formats/gexf/preview.d.ts.map +1 -0
  173. package/dist/src/formats/gexf/preview.js +191 -0
  174. package/dist/src/formats/gexf/preview.js.map +1 -0
  175. package/dist/src/formats/gexf/schema.d.ts.map +1 -1
  176. package/dist/src/formats/gexf/schema.js +2 -1
  177. package/dist/src/formats/gexf/schema.js.map +1 -1
  178. package/dist/src/formats/gexf/styles.d.ts +58 -31
  179. package/dist/src/formats/gexf/styles.d.ts.map +1 -1
  180. package/dist/src/formats/gexf/styles.js +848 -225
  181. package/dist/src/formats/gexf/styles.js.map +1 -1
  182. package/dist/src/formats/gml/importer.d.ts +5 -2
  183. package/dist/src/formats/gml/importer.d.ts.map +1 -1
  184. package/dist/src/formats/gml/importer.js +258 -71
  185. package/dist/src/formats/gml/importer.js.map +1 -1
  186. package/dist/src/formats/gml/index.d.ts +1 -1
  187. package/dist/src/formats/gml/index.d.ts.map +1 -1
  188. package/dist/src/formats/gml/index.js +1 -1
  189. package/dist/src/formats/gml/index.js.map +1 -1
  190. package/dist/src/formats/gml/positions.d.ts +7 -0
  191. package/dist/src/formats/gml/positions.d.ts.map +1 -1
  192. package/dist/src/formats/gml/positions.js +29 -7
  193. package/dist/src/formats/gml/positions.js.map +1 -1
  194. package/dist/src/formats/gml/styles.d.ts.map +1 -1
  195. package/dist/src/formats/gml/styles.js +754 -102
  196. package/dist/src/formats/gml/styles.js.map +1 -1
  197. package/dist/src/formats/graphml/styles-plain.d.ts.map +1 -1
  198. package/dist/src/formats/graphml/styles-plain.js +6 -10
  199. package/dist/src/formats/graphml/styles-plain.js.map +1 -1
  200. package/dist/src/formats/graphml/styles-yed.d.ts +21 -15
  201. package/dist/src/formats/graphml/styles-yed.d.ts.map +1 -1
  202. package/dist/src/formats/graphml/styles-yed.js +695 -164
  203. package/dist/src/formats/graphml/styles-yed.js.map +1 -1
  204. package/dist/src/formats/graphml/styles-yfiles3.d.ts +1 -1
  205. package/dist/src/formats/graphml/styles-yfiles3.d.ts.map +1 -1
  206. package/dist/src/formats/graphml/styles-yfiles3.js +431 -64
  207. package/dist/src/formats/graphml/styles-yfiles3.js.map +1 -1
  208. package/dist/src/formats/graphml/yfiles.d.ts +3 -3
  209. package/dist/src/formats/graphml/yfiles.d.ts.map +1 -1
  210. package/dist/src/formats/graphml/yfiles.js +16 -6
  211. package/dist/src/formats/graphml/yfiles.js.map +1 -1
  212. package/dist/src/formats/json/dialect.d.ts +3 -2
  213. package/dist/src/formats/json/dialect.d.ts.map +1 -1
  214. package/dist/src/formats/json/dialect.js +39 -5
  215. package/dist/src/formats/json/dialect.js.map +1 -1
  216. package/dist/src/formats/json/importer.d.ts +13 -2
  217. package/dist/src/formats/json/importer.d.ts.map +1 -1
  218. package/dist/src/formats/json/importer.js +42 -6
  219. package/dist/src/formats/json/importer.js.map +1 -1
  220. package/dist/src/formats/json/index.d.ts +1 -1
  221. package/dist/src/formats/json/index.d.ts.map +1 -1
  222. package/dist/src/formats/json/index.js +1 -1
  223. package/dist/src/formats/json/index.js.map +1 -1
  224. package/dist/src/formats/json/positions.d.ts +5 -2
  225. package/dist/src/formats/json/positions.d.ts.map +1 -1
  226. package/dist/src/formats/json/positions.js +20 -4
  227. package/dist/src/formats/json/positions.js.map +1 -1
  228. package/dist/src/formats/json/styles.d.ts +12 -1
  229. package/dist/src/formats/json/styles.d.ts.map +1 -1
  230. package/dist/src/formats/json/styles.js +1843 -136
  231. package/dist/src/formats/json/styles.js.map +1 -1
  232. package/dist/src/formats/pajek/draw.d.ts +104 -0
  233. package/dist/src/formats/pajek/draw.d.ts.map +1 -0
  234. package/dist/src/formats/pajek/draw.js +382 -0
  235. package/dist/src/formats/pajek/draw.js.map +1 -0
  236. package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
  237. package/dist/src/formats/pajek/exporter.js +70 -51
  238. package/dist/src/formats/pajek/exporter.js.map +1 -1
  239. package/dist/src/formats/pajek/importer.d.ts +9 -0
  240. package/dist/src/formats/pajek/importer.d.ts.map +1 -1
  241. package/dist/src/formats/pajek/importer.js +233 -102
  242. package/dist/src/formats/pajek/importer.js.map +1 -1
  243. package/dist/src/formats/pajek/index.d.ts +1 -0
  244. package/dist/src/formats/pajek/index.d.ts.map +1 -1
  245. package/dist/src/formats/pajek/index.js.map +1 -1
  246. package/dist/src/formats/pajek/styles.d.ts +15 -7
  247. package/dist/src/formats/pajek/styles.d.ts.map +1 -1
  248. package/dist/src/formats/pajek/styles.js +1395 -114
  249. package/dist/src/formats/pajek/styles.js.map +1 -1
  250. package/dist/src/formats/pajek/syntax.d.ts +10 -1
  251. package/dist/src/formats/pajek/syntax.d.ts.map +1 -1
  252. package/dist/src/formats/pajek/syntax.js +26 -2
  253. package/dist/src/formats/pajek/syntax.js.map +1 -1
  254. package/dist/src/formats/xgmml/emit.d.ts +1 -0
  255. package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
  256. package/dist/src/formats/xgmml/emit.js +65 -5
  257. package/dist/src/formats/xgmml/emit.js.map +1 -1
  258. package/dist/src/formats/xgmml/styles.d.ts +23 -3
  259. package/dist/src/formats/xgmml/styles.d.ts.map +1 -1
  260. package/dist/src/formats/xgmml/styles.js +277 -60
  261. package/dist/src/formats/xgmml/styles.js.map +1 -1
  262. package/dist/src/index.d.ts +6 -5
  263. package/dist/src/index.d.ts.map +1 -1
  264. package/dist/src/index.js +6 -5
  265. package/dist/src/index.js.map +1 -1
  266. package/dist/src/positions/convert.d.ts.map +1 -1
  267. package/dist/src/positions/convert.js +11 -1
  268. package/dist/src/positions/convert.js.map +1 -1
  269. package/dist/src/positions/extract.d.ts.map +1 -1
  270. package/dist/src/positions/extract.js +53 -1
  271. package/dist/src/positions/extract.js.map +1 -1
  272. package/dist/src/positions/index.d.ts +1 -1
  273. package/dist/src/positions/index.d.ts.map +1 -1
  274. package/dist/src/positions/types.d.ts +59 -0
  275. package/dist/src/positions/types.d.ts.map +1 -1
  276. package/dist/src/sources/builtins.d.ts +1 -1
  277. package/dist/src/sources/builtins.d.ts.map +1 -1
  278. package/dist/src/sources/builtins.js +8 -2
  279. package/dist/src/sources/builtins.js.map +1 -1
  280. package/dist/src/sources/context.d.ts.map +1 -1
  281. package/dist/src/sources/context.js +1 -0
  282. package/dist/src/sources/context.js.map +1 -1
  283. package/dist/src/sources/credentials.d.ts +50 -1
  284. package/dist/src/sources/credentials.d.ts.map +1 -1
  285. package/dist/src/sources/credentials.js +69 -0
  286. package/dist/src/sources/credentials.js.map +1 -1
  287. package/dist/src/sources/cypher/descriptor.d.ts.map +1 -1
  288. package/dist/src/sources/cypher/descriptor.js +5 -0
  289. package/dist/src/sources/cypher/descriptor.js.map +1 -1
  290. package/dist/src/sources/cypher/index.d.ts.map +1 -1
  291. package/dist/src/sources/cypher/index.js +125 -18
  292. package/dist/src/sources/cypher/index.js.map +1 -1
  293. package/dist/src/sources/cypher/params.d.ts +1 -1
  294. package/dist/src/sources/cypher/params.d.ts.map +1 -1
  295. package/dist/src/sources/cypher/query-builder.d.ts +17 -0
  296. package/dist/src/sources/cypher/query-builder.d.ts.map +1 -1
  297. package/dist/src/sources/cypher/query-builder.js +31 -0
  298. package/dist/src/sources/cypher/query-builder.js.map +1 -1
  299. package/dist/src/sources/ids.d.ts +5 -0
  300. package/dist/src/sources/ids.d.ts.map +1 -1
  301. package/dist/src/sources/ids.js +5 -0
  302. package/dist/src/sources/ids.js.map +1 -1
  303. package/dist/src/sources/params.d.ts +3 -0
  304. package/dist/src/sources/params.d.ts.map +1 -1
  305. package/dist/src/sources/rest/descriptor.d.ts.map +1 -1
  306. package/dist/src/sources/rest/descriptor.js +9 -0
  307. package/dist/src/sources/rest/descriptor.js.map +1 -1
  308. package/dist/src/sources/rest/openalex.d.ts +4 -2
  309. package/dist/src/sources/rest/openalex.d.ts.map +1 -1
  310. package/dist/src/sources/rest/openalex.js +4 -2
  311. package/dist/src/sources/rest/openalex.js.map +1 -1
  312. package/dist/src/sources/rest/source.d.ts.map +1 -1
  313. package/dist/src/sources/rest/source.js +38 -0
  314. package/dist/src/sources/rest/source.js.map +1 -1
  315. package/dist/src/sources/run.d.ts +2 -0
  316. package/dist/src/sources/run.d.ts.map +1 -1
  317. package/dist/src/sources/run.js +30 -3
  318. package/dist/src/sources/run.js.map +1 -1
  319. package/dist/src/sources/sigv4.d.ts +5 -3
  320. package/dist/src/sources/sigv4.d.ts.map +1 -1
  321. package/dist/src/sources/sigv4.js +6 -4
  322. package/dist/src/sources/sigv4.js.map +1 -1
  323. package/dist/src/sources/sparql/descriptor.d.ts +10 -0
  324. package/dist/src/sources/sparql/descriptor.d.ts.map +1 -0
  325. package/dist/src/sources/sparql/descriptor.js +64 -0
  326. package/dist/src/sources/sparql/descriptor.js.map +1 -0
  327. package/dist/src/sources/sparql/index.d.ts +28 -0
  328. package/dist/src/sources/sparql/index.d.ts.map +1 -0
  329. package/dist/src/sources/sparql/index.js +327 -0
  330. package/dist/src/sources/sparql/index.js.map +1 -0
  331. package/dist/src/sources/sparql/ntriples.d.ts +69 -0
  332. package/dist/src/sources/sparql/ntriples.d.ts.map +1 -0
  333. package/dist/src/sources/sparql/ntriples.js +180 -0
  334. package/dist/src/sources/sparql/ntriples.js.map +1 -0
  335. package/dist/src/sources/sparql/params.d.ts +27 -0
  336. package/dist/src/sources/sparql/params.d.ts.map +1 -0
  337. package/dist/src/sources/sparql/params.js +5 -0
  338. package/dist/src/sources/sparql/params.js.map +1 -0
  339. package/dist/src/sources/sparql/query.d.ts +73 -0
  340. package/dist/src/sources/sparql/query.d.ts.map +1 -0
  341. package/dist/src/sources/sparql/query.js +164 -0
  342. package/dist/src/sources/sparql/query.js.map +1 -0
  343. package/dist/src/sources/types.d.ts +60 -0
  344. package/dist/src/sources/types.d.ts.map +1 -1
  345. package/dist/src/styles/annotations.d.ts +61 -5
  346. package/dist/src/styles/annotations.d.ts.map +1 -1
  347. package/dist/src/styles/annotations.js +130 -22
  348. package/dist/src/styles/annotations.js.map +1 -1
  349. package/dist/src/styles/canon/bends.d.ts +46 -0
  350. package/dist/src/styles/canon/bends.d.ts.map +1 -1
  351. package/dist/src/styles/canon/bends.js +123 -0
  352. package/dist/src/styles/canon/bends.js.map +1 -1
  353. package/dist/src/styles/canon/color-tables.d.ts +6 -1
  354. package/dist/src/styles/canon/color-tables.d.ts.map +1 -1
  355. package/dist/src/styles/canon/color-tables.js +10 -4
  356. package/dist/src/styles/canon/color-tables.js.map +1 -1
  357. package/dist/src/styles/canon/color.d.ts +3 -1
  358. package/dist/src/styles/canon/color.d.ts.map +1 -1
  359. package/dist/src/styles/canon/color.js +103 -3
  360. package/dist/src/styles/canon/color.js.map +1 -1
  361. package/dist/src/styles/canon/enums.d.ts +2 -2
  362. package/dist/src/styles/canon/enums.d.ts.map +1 -1
  363. package/dist/src/styles/canon/enums.js +89 -7
  364. package/dist/src/styles/canon/enums.js.map +1 -1
  365. package/dist/src/styles/canon/graphviz.d.ts +12 -3
  366. package/dist/src/styles/canon/graphviz.d.ts.map +1 -1
  367. package/dist/src/styles/canon/graphviz.js +57 -9
  368. package/dist/src/styles/canon/graphviz.js.map +1 -1
  369. package/dist/src/styles/canon/number.d.ts +8 -0
  370. package/dist/src/styles/canon/number.d.ts.map +1 -1
  371. package/dist/src/styles/canon/number.js +18 -0
  372. package/dist/src/styles/canon/number.js.map +1 -1
  373. package/dist/src/styles/canon/text.d.ts +29 -2
  374. package/dist/src/styles/canon/text.d.ts.map +1 -1
  375. package/dist/src/styles/canon/text.js +156 -16
  376. package/dist/src/styles/canon/text.js.map +1 -1
  377. package/dist/src/styles/codes.d.ts +2 -0
  378. package/dist/src/styles/codes.d.ts.map +1 -1
  379. package/dist/src/styles/codes.js +2 -0
  380. package/dist/src/styles/codes.js.map +1 -1
  381. package/dist/src/styles/cyjs/cascade.d.ts.map +1 -1
  382. package/dist/src/styles/cyjs/cascade.js +1139 -79
  383. package/dist/src/styles/cyjs/cascade.js.map +1 -1
  384. package/dist/src/styles/cyjs/defaults-table.d.ts.map +1 -1
  385. package/dist/src/styles/cyjs/defaults-table.js +4 -0
  386. package/dist/src/styles/cyjs/defaults-table.js.map +1 -1
  387. package/dist/src/styles/cyjs/emit.d.ts.map +1 -1
  388. package/dist/src/styles/cyjs/emit.js +232 -10
  389. package/dist/src/styles/cyjs/emit.js.map +1 -1
  390. package/dist/src/styles/cyjs/face.d.ts +20 -0
  391. package/dist/src/styles/cyjs/face.d.ts.map +1 -0
  392. package/dist/src/styles/cyjs/face.js +332 -0
  393. package/dist/src/styles/cyjs/face.js.map +1 -0
  394. package/dist/src/styles/cyjs/mappers.d.ts +44 -1
  395. package/dist/src/styles/cyjs/mappers.d.ts.map +1 -1
  396. package/dist/src/styles/cyjs/mappers.js +475 -26
  397. package/dist/src/styles/cyjs/mappers.js.map +1 -1
  398. package/dist/src/styles/cyjs/routes.d.ts +53 -0
  399. package/dist/src/styles/cyjs/routes.d.ts.map +1 -0
  400. package/dist/src/styles/cyjs/routes.js +360 -0
  401. package/dist/src/styles/cyjs/routes.js.map +1 -0
  402. package/dist/src/styles/cytoscape/charts.d.ts +23 -0
  403. package/dist/src/styles/cytoscape/charts.d.ts.map +1 -0
  404. package/dist/src/styles/cytoscape/charts.js +560 -0
  405. package/dist/src/styles/cytoscape/charts.js.map +1 -0
  406. package/dist/src/styles/cytoscape/emit.d.ts.map +1 -1
  407. package/dist/src/styles/cytoscape/emit.js +156 -48
  408. package/dist/src/styles/cytoscape/emit.js.map +1 -1
  409. package/dist/src/styles/cytoscape/lexicon.d.ts +91 -3
  410. package/dist/src/styles/cytoscape/lexicon.d.ts.map +1 -1
  411. package/dist/src/styles/cytoscape/lexicon.js +387 -77
  412. package/dist/src/styles/cytoscape/lexicon.js.map +1 -1
  413. package/dist/src/styles/cytoscape/mappings.d.ts +30 -0
  414. package/dist/src/styles/cytoscape/mappings.d.ts.map +1 -1
  415. package/dist/src/styles/cytoscape/mappings.js +92 -0
  416. package/dist/src/styles/cytoscape/mappings.js.map +1 -1
  417. package/dist/src/styles/cytoscape/resolve.d.ts +42 -2
  418. package/dist/src/styles/cytoscape/resolve.d.ts.map +1 -1
  419. package/dist/src/styles/cytoscape/resolve.js +623 -17
  420. package/dist/src/styles/cytoscape/resolve.js.map +1 -1
  421. package/dist/src/styles/defaults.d.ts +46 -26
  422. package/dist/src/styles/defaults.d.ts.map +1 -1
  423. package/dist/src/styles/defaults.js +308 -71
  424. package/dist/src/styles/defaults.js.map +1 -1
  425. package/dist/src/styles/index.d.ts +4 -3
  426. package/dist/src/styles/index.d.ts.map +1 -1
  427. package/dist/src/styles/index.js +3 -2
  428. package/dist/src/styles/index.js.map +1 -1
  429. package/dist/src/styles/internal.d.ts +1 -0
  430. package/dist/src/styles/internal.d.ts.map +1 -1
  431. package/dist/src/styles/internal.js +1 -0
  432. package/dist/src/styles/internal.js.map +1 -1
  433. package/dist/src/styles/io/generic.d.ts.map +1 -1
  434. package/dist/src/styles/io/generic.js +56 -16
  435. package/dist/src/styles/io/generic.js.map +1 -1
  436. package/dist/src/styles/io/round-trip.d.ts +56 -0
  437. package/dist/src/styles/io/round-trip.d.ts.map +1 -0
  438. package/dist/src/styles/io/round-trip.js +138 -0
  439. package/dist/src/styles/io/round-trip.js.map +1 -0
  440. package/dist/src/styles/io/writer.d.ts.map +1 -1
  441. package/dist/src/styles/io/writer.js +6 -1
  442. package/dist/src/styles/io/writer.js.map +1 -1
  443. package/dist/src/styles/notes.d.ts.map +1 -1
  444. package/dist/src/styles/notes.js +1 -0
  445. package/dist/src/styles/notes.js.map +1 -1
  446. package/dist/src/styles/plan/features.d.ts +1 -1
  447. package/dist/src/styles/plan/features.d.ts.map +1 -1
  448. package/dist/src/styles/plan/features.js +22 -2
  449. package/dist/src/styles/plan/features.js.map +1 -1
  450. package/dist/src/styles/plan/index.d.ts +1 -1
  451. package/dist/src/styles/plan/index.d.ts.map +1 -1
  452. package/dist/src/styles/plan/index.js +1 -1
  453. package/dist/src/styles/plan/index.js.map +1 -1
  454. package/dist/src/styles/plan/plan.d.ts.map +1 -1
  455. package/dist/src/styles/plan/plan.js +61 -4
  456. package/dist/src/styles/plan/plan.js.map +1 -1
  457. package/dist/src/styles/plan/resolve.d.ts +11 -0
  458. package/dist/src/styles/plan/resolve.d.ts.map +1 -1
  459. package/dist/src/styles/plan/resolve.js +40 -4
  460. package/dist/src/styles/plan/resolve.js.map +1 -1
  461. package/dist/src/styles/slots.d.ts +14 -0
  462. package/dist/src/styles/slots.d.ts.map +1 -0
  463. package/dist/src/styles/slots.js +20 -0
  464. package/dist/src/styles/slots.js.map +1 -0
  465. package/dist/src/styles/types.d.ts +687 -6
  466. package/dist/src/styles/types.d.ts.map +1 -1
  467. package/dist/src/styles/vocabulary.d.ts +3 -2
  468. package/dist/src/styles/vocabulary.d.ts.map +1 -1
  469. package/dist/src/styles/vocabulary.js +224 -0
  470. package/dist/src/styles/vocabulary.js.map +1 -1
  471. package/dist/styles.js +30 -239
  472. package/dist/styles.js.map +1 -1
  473. package/dist/xgmml.js +3 -3
  474. package/package.json +27 -7
  475. package/src/formats/cx/importer.ts +6 -1
  476. package/src/formats/cx/styles.ts +143 -9
  477. package/src/formats/cx2/importer.ts +1 -0
  478. package/src/formats/cx2/styles.ts +3 -1
  479. package/src/formats/cys/importer.ts +1 -0
  480. package/src/formats/cys/styles.ts +27 -5
  481. package/src/formats/dot/drawing.ts +799 -0
  482. package/src/formats/dot/exporter.ts +37 -1
  483. package/src/formats/dot/importer.ts +192 -36
  484. package/src/formats/dot/index.ts +3 -1
  485. package/src/formats/dot/label-places.ts +241 -0
  486. package/src/formats/dot/names.ts +15 -0
  487. package/src/formats/dot/record.ts +336 -0
  488. package/src/formats/dot/styles.ts +1702 -149
  489. package/src/formats/gexf/dialog-metrics.ts +61 -0
  490. package/src/formats/gexf/importer.ts +50 -5
  491. package/src/formats/gexf/preview.ts +217 -0
  492. package/src/formats/gexf/schema.ts +2 -1
  493. package/src/formats/gexf/styles.ts +1099 -245
  494. package/src/formats/gml/importer.ts +291 -76
  495. package/src/formats/gml/index.ts +1 -1
  496. package/src/formats/gml/positions.ts +29 -7
  497. package/src/formats/gml/styles.ts +852 -110
  498. package/src/formats/graphml/styles-plain.ts +6 -15
  499. package/src/formats/graphml/styles-yed.ts +765 -176
  500. package/src/formats/graphml/styles-yfiles3.ts +487 -63
  501. package/src/formats/graphml/yfiles.ts +19 -6
  502. package/src/formats/json/dialect.ts +41 -5
  503. package/src/formats/json/importer.ts +59 -7
  504. package/src/formats/json/index.ts +1 -0
  505. package/src/formats/json/positions.ts +22 -5
  506. package/src/formats/json/styles.ts +2123 -171
  507. package/src/formats/pajek/draw.ts +469 -0
  508. package/src/formats/pajek/exporter.ts +81 -49
  509. package/src/formats/pajek/importer.ts +278 -103
  510. package/src/formats/pajek/index.ts +1 -0
  511. package/src/formats/pajek/styles.ts +1506 -133
  512. package/src/formats/pajek/syntax.ts +27 -2
  513. package/src/formats/xgmml/emit.ts +73 -5
  514. package/src/formats/xgmml/styles.ts +330 -71
  515. package/src/index.ts +12 -1
  516. package/src/positions/convert.ts +12 -1
  517. package/src/positions/extract.ts +55 -1
  518. package/src/positions/index.ts +1 -0
  519. package/src/positions/types.ts +60 -0
  520. package/src/sources/builtins.ts +8 -1
  521. package/src/sources/context.ts +1 -0
  522. package/src/sources/credentials.ts +90 -1
  523. package/src/sources/cypher/descriptor.ts +7 -1
  524. package/src/sources/cypher/index.ts +149 -18
  525. package/src/sources/cypher/params.ts +1 -1
  526. package/src/sources/cypher/query-builder.ts +33 -0
  527. package/src/sources/ids.ts +6 -0
  528. package/src/sources/params.ts +3 -0
  529. package/src/sources/rest/descriptor.ts +9 -0
  530. package/src/sources/rest/openalex.ts +4 -2
  531. package/src/sources/rest/source.ts +41 -0
  532. package/src/sources/run.ts +35 -3
  533. package/src/sources/sigv4.ts +6 -4
  534. package/src/sources/sparql/descriptor.ts +67 -0
  535. package/src/sources/sparql/index.ts +371 -0
  536. package/src/sources/sparql/ntriples.ts +219 -0
  537. package/src/sources/sparql/params.ts +28 -0
  538. package/src/sources/sparql/query.ts +216 -0
  539. package/src/sources/types.ts +68 -0
  540. package/src/styles/annotations.ts +201 -27
  541. package/src/styles/canon/bends.ts +137 -0
  542. package/src/styles/canon/color-tables.ts +10 -4
  543. package/src/styles/canon/color.ts +105 -3
  544. package/src/styles/canon/enums.ts +107 -8
  545. package/src/styles/canon/graphviz.ts +71 -10
  546. package/src/styles/canon/number.ts +19 -0
  547. package/src/styles/canon/text.ts +187 -16
  548. package/src/styles/codes.ts +2 -0
  549. package/src/styles/cyjs/cascade.ts +1303 -84
  550. package/src/styles/cyjs/defaults-table.ts +4 -0
  551. package/src/styles/cyjs/emit.ts +268 -14
  552. package/src/styles/cyjs/face.ts +372 -0
  553. package/src/styles/cyjs/mappers.ts +506 -27
  554. package/src/styles/cyjs/routes.ts +432 -0
  555. package/src/styles/cytoscape/charts.ts +684 -0
  556. package/src/styles/cytoscape/emit.ts +170 -48
  557. package/src/styles/cytoscape/lexicon.ts +431 -78
  558. package/src/styles/cytoscape/mappings.ts +108 -0
  559. package/src/styles/cytoscape/resolve.ts +741 -17
  560. package/src/styles/defaults.ts +417 -108
  561. package/src/styles/index.ts +5 -0
  562. package/src/styles/internal.ts +1 -0
  563. package/src/styles/io/generic.ts +79 -23
  564. package/src/styles/io/round-trip.ts +202 -0
  565. package/src/styles/io/writer.ts +6 -1
  566. package/src/styles/notes.ts +1 -0
  567. package/src/styles/plan/features.ts +23 -2
  568. package/src/styles/plan/index.ts +1 -1
  569. package/src/styles/plan/plan.ts +69 -5
  570. package/src/styles/plan/resolve.ts +47 -4
  571. package/src/styles/slots.ts +25 -0
  572. package/src/styles/types.ts +698 -5
  573. package/src/styles/vocabulary.ts +232 -2
  574. package/dist/chunks/block-Cu22ewuS.js.map +0 -1
  575. package/dist/chunks/choose-Cdx6Enl2.js +0 -57
  576. package/dist/chunks/choose-Cdx6Enl2.js.map +0 -1
  577. package/dist/chunks/codes-CV_Bhcyi.js.map +0 -1
  578. package/dist/chunks/convert-BcQ8_jMo.js.map +0 -1
  579. package/dist/chunks/credentials-BiQsnMTb.js.map +0 -1
  580. package/dist/chunks/descriptor-BJ-W0Jd-.js.map +0 -1
  581. package/dist/chunks/emit-CD8xnY8s.js.map +0 -1
  582. package/dist/chunks/export-CZ7VRm4I.js.map +0 -1
  583. package/dist/chunks/exporter-bxxjOrDZ.js.map +0 -1
  584. package/dist/chunks/format-BMS-1Nxb.js +0 -64
  585. package/dist/chunks/format-BMS-1Nxb.js.map +0 -1
  586. package/dist/chunks/generic-CP6YD34u.js.map +0 -1
  587. package/dist/chunks/importer-B87_fmVx.js.map +0 -1
  588. package/dist/chunks/importer-CB_zV5_L.js.map +0 -1
  589. package/dist/chunks/importer-CVT-JyDE.js.map +0 -1
  590. package/dist/chunks/importer-Cyy6UseH.js.map +0 -1
  591. package/dist/chunks/importer-DPZDN40-.js.map +0 -1
  592. package/dist/chunks/importer-e3huMZbm.js.map +0 -1
  593. package/dist/chunks/lexicon-u2SI5xcx.js.map +0 -1
  594. package/dist/chunks/sigv4-LkAzsLAu.js.map +0 -1
  595. package/dist/chunks/styles-CaABMoO1.js.map +0 -1
  596. package/dist/chunks/styles-P_gmFAOi.js +0 -770
  597. package/dist/chunks/styles-P_gmFAOi.js.map +0 -1
  598. package/dist/chunks/styles-yed-Cs1nmrjn.js.map +0 -1
  599. package/dist/chunks/writer-DvHTl36J.js +0 -449
  600. package/dist/chunks/writer-DvHTl36J.js.map +0 -1
@@ -0,0 +1,1928 @@
1
+ import { T as TIME_TEXT_ROLE, J as TIME_TEXT_SUFFIX, e as explicitWeights } from "./export-Cha4dRFz.js";
2
+ import { S as STYLE_BLOCK_NAME, h as StyleNotes, p as plainCell, f as canonText, d as canonColor, c as canonNumber, a as canonEnum } from "./block-yl0f_qLO.js";
3
+ import { S as StyleApproximations } from "./approximations-BRXsll0T.js";
4
+ import { t as takeFromBlock } from "./round-trip-Cy3_SHRZ.js";
5
+ const GEXF_FORMAT = "gexf";
6
+ const GEXF_NAMESPACES = {
7
+ "1.2": { gexf: "http://www.gexf.net/1.2draft", viz: "http://www.gexf.net/1.2draft/viz" },
8
+ "1.3": { gexf: "http://gexf.net/1.3", viz: "http://gexf.net/1.3/viz" }
9
+ };
10
+ const TIME_FORMATS = /* @__PURE__ */ new Set(["integer", "double", "date", "dateTime"]);
11
+ const GRAPH_MODES = /* @__PURE__ */ new Set(["static", "dynamic", "slice"]);
12
+ const TIME_REPRESENTATIONS = /* @__PURE__ */ new Set(["interval", "timestamp"]);
13
+ const VIZ_NAMESPACE = "viz";
14
+ const XML_ORIGIN = { format: GEXF_FORMAT };
15
+ const VIZ_ORIGIN = { format: GEXF_FORMAT, namespace: VIZ_NAMESPACE };
16
+ const NODE_COLUMNS = Object.freeze({
17
+ label: "label",
18
+ parent: "parent",
19
+ parents: "parents",
20
+ start: "start",
21
+ end: "end",
22
+ timestamp: "timestamp",
23
+ spells: "spells",
24
+ spellsOpen: "spells.open",
25
+ timestamps: "timestamps",
26
+ open: "open",
27
+ position: "position",
28
+ color: "color",
29
+ size: "size",
30
+ shape: "shape",
31
+ shapeUri: "shape.uri"
32
+ });
33
+ const EDGE_COLUMNS = Object.freeze({
34
+ id: "id",
35
+ label: "label",
36
+ kind: "kind",
37
+ start: "start",
38
+ end: "end",
39
+ timestamp: "timestamp",
40
+ spells: "spells",
41
+ spellsOpen: "spells.open",
42
+ timestamps: "timestamps",
43
+ open: "open",
44
+ color: "color",
45
+ thickness: "thickness",
46
+ shape: "shape"
47
+ });
48
+ const RESERVED_NODE_NAMES = /* @__PURE__ */ new Set([
49
+ ...Object.values(NODE_COLUMNS),
50
+ NODE_COLUMNS.start + TIME_TEXT_SUFFIX,
51
+ NODE_COLUMNS.end + TIME_TEXT_SUFFIX,
52
+ NODE_COLUMNS.timestamp + TIME_TEXT_SUFFIX
53
+ ]);
54
+ const RESERVED_EDGE_NAMES = /* @__PURE__ */ new Set([
55
+ ...Object.values(EDGE_COLUMNS),
56
+ EDGE_COLUMNS.start + TIME_TEXT_SUFFIX,
57
+ EDGE_COLUMNS.end + TIME_TEXT_SUFFIX,
58
+ EDGE_COLUMNS.timestamp + TIME_TEXT_SUFFIX
59
+ ]);
60
+ const NODE_DECLS = {
61
+ label: { name: NODE_COLUMNS.label, dtype: "string", role: "label", nullable: true, origin: XML_ORIGIN },
62
+ parent: {
63
+ name: NODE_COLUMNS.parent,
64
+ dtype: "u32",
65
+ role: "parent",
66
+ refersTo: "node",
67
+ nullable: true,
68
+ origin: XML_ORIGIN
69
+ },
70
+ parents: {
71
+ name: NODE_COLUMNS.parents,
72
+ dtype: "list",
73
+ itemDtype: "u32",
74
+ role: "parents",
75
+ refersTo: "node",
76
+ nullable: true,
77
+ origin: XML_ORIGIN
78
+ },
79
+ start: { name: NODE_COLUMNS.start, dtype: "f64", role: "start", nullable: true, origin: XML_ORIGIN },
80
+ end: { name: NODE_COLUMNS.end, dtype: "f64", role: "end", nullable: true, origin: XML_ORIGIN },
81
+ timestamp: { name: NODE_COLUMNS.timestamp, dtype: "f64", role: "timestamp", nullable: true, origin: XML_ORIGIN },
82
+ spells: {
83
+ name: NODE_COLUMNS.spells,
84
+ dtype: "list",
85
+ itemDtype: "f64",
86
+ itemComponents: 2,
87
+ role: "spells",
88
+ nullable: true,
89
+ origin: XML_ORIGIN
90
+ },
91
+ timestamps: {
92
+ name: NODE_COLUMNS.timestamps,
93
+ dtype: "list",
94
+ itemDtype: "f64",
95
+ role: "timestamps",
96
+ nullable: true,
97
+ origin: XML_ORIGIN
98
+ },
99
+ open: { name: NODE_COLUMNS.open, dtype: "u8", role: "open", nullable: true, origin: XML_ORIGIN },
100
+ spellsOpen: {
101
+ name: NODE_COLUMNS.spellsOpen,
102
+ dtype: "list",
103
+ itemDtype: "u8",
104
+ role: "spellsOpen",
105
+ nullable: true,
106
+ origin: XML_ORIGIN
107
+ },
108
+ position: {
109
+ name: NODE_COLUMNS.position,
110
+ dtype: "f64",
111
+ components: 3,
112
+ role: "position",
113
+ mutable: true,
114
+ nullable: true,
115
+ origin: VIZ_ORIGIN,
116
+ // Gephi puts a node with no viz:position at the origin (gexf-specimen-node-sizes-opacity: position-none)
117
+ extra: { units: "file", originUnplaced: true }
118
+ },
119
+ color: {
120
+ name: NODE_COLUMNS.color,
121
+ dtype: "f32",
122
+ components: 4,
123
+ role: "color",
124
+ nullable: true,
125
+ origin: VIZ_ORIGIN
126
+ },
127
+ size: { name: NODE_COLUMNS.size, dtype: "f32", role: "size", nullable: true, origin: VIZ_ORIGIN },
128
+ shape: { name: NODE_COLUMNS.shape, dtype: "dict", role: "shape", nullable: true, origin: VIZ_ORIGIN },
129
+ shapeUri: { name: NODE_COLUMNS.shapeUri, dtype: "string", nullable: true, origin: VIZ_ORIGIN }
130
+ };
131
+ const EDGE_DECLS = {
132
+ id: { name: EDGE_COLUMNS.id, dtype: "string", role: "id", unique: true, nullable: true, origin: XML_ORIGIN },
133
+ label: { name: EDGE_COLUMNS.label, dtype: "string", role: "label", nullable: true, origin: XML_ORIGIN },
134
+ kind: { name: EDGE_COLUMNS.kind, dtype: "dict", role: "kind", nullable: true, origin: XML_ORIGIN },
135
+ start: { name: EDGE_COLUMNS.start, dtype: "f64", role: "start", nullable: true, origin: XML_ORIGIN },
136
+ end: { name: EDGE_COLUMNS.end, dtype: "f64", role: "end", nullable: true, origin: XML_ORIGIN },
137
+ timestamp: { name: EDGE_COLUMNS.timestamp, dtype: "f64", role: "timestamp", nullable: true, origin: XML_ORIGIN },
138
+ spells: {
139
+ name: EDGE_COLUMNS.spells,
140
+ dtype: "list",
141
+ itemDtype: "f64",
142
+ itemComponents: 2,
143
+ role: "spells",
144
+ nullable: true,
145
+ origin: XML_ORIGIN
146
+ },
147
+ timestamps: {
148
+ name: EDGE_COLUMNS.timestamps,
149
+ dtype: "list",
150
+ itemDtype: "f64",
151
+ role: "timestamps",
152
+ nullable: true,
153
+ origin: XML_ORIGIN
154
+ },
155
+ open: { name: EDGE_COLUMNS.open, dtype: "u8", role: "open", nullable: true, origin: XML_ORIGIN },
156
+ spellsOpen: {
157
+ name: EDGE_COLUMNS.spellsOpen,
158
+ dtype: "list",
159
+ itemDtype: "u8",
160
+ role: "spellsOpen",
161
+ nullable: true,
162
+ origin: XML_ORIGIN
163
+ },
164
+ color: {
165
+ name: EDGE_COLUMNS.color,
166
+ dtype: "f32",
167
+ components: 4,
168
+ role: "color",
169
+ nullable: true,
170
+ origin: VIZ_ORIGIN
171
+ },
172
+ thickness: { name: EDGE_COLUMNS.thickness, dtype: "f32", role: "thickness", nullable: true, origin: VIZ_ORIGIN },
173
+ shape: { name: EDGE_COLUMNS.shape, dtype: "dict", role: "shape", nullable: true, origin: VIZ_ORIGIN }
174
+ };
175
+ const OPEN_START = 1;
176
+ const OPEN_END = 2;
177
+ const TEMPORAL_TABLE_PREFIX = "temporal:";
178
+ const TEMPORAL_COLUMNS = Object.freeze({
179
+ element: "element",
180
+ start: "start",
181
+ end: "end",
182
+ value: "value",
183
+ open: "open",
184
+ startText: `start${TIME_TEXT_SUFFIX}`,
185
+ endText: `end${TIME_TEXT_SUFFIX}`,
186
+ valueText: `value${TIME_TEXT_SUFFIX}`
187
+ });
188
+ function temporalTableName(domain, column) {
189
+ return `${TEMPORAL_TABLE_PREFIX}${domain}:${column}`;
190
+ }
191
+ function parseTemporalTableName(name) {
192
+ if (!name.startsWith(TEMPORAL_TABLE_PREFIX)) {
193
+ return null;
194
+ }
195
+ const rest = name.slice(TEMPORAL_TABLE_PREFIX.length);
196
+ const colon = rest.indexOf(":");
197
+ if (colon < 0) {
198
+ return null;
199
+ }
200
+ const domain = rest.slice(0, colon);
201
+ if (domain !== "node" && domain !== "edge") {
202
+ return null;
203
+ }
204
+ return { domain, column: rest.slice(colon + 1) };
205
+ }
206
+ function temporalTableDecls(domain, value, temporalValue) {
207
+ const decls = [
208
+ { name: TEMPORAL_COLUMNS.element, dtype: "u32", refersTo: domain, nullable: false },
209
+ { name: TEMPORAL_COLUMNS.start, dtype: "f64", role: "start", nullable: true },
210
+ { name: TEMPORAL_COLUMNS.end, dtype: "f64", role: "end", nullable: true },
211
+ { name: TEMPORAL_COLUMNS.value, ...value, nullable: true },
212
+ {
213
+ name: TEMPORAL_COLUMNS.startText,
214
+ dtype: "string",
215
+ role: TIME_TEXT_ROLE,
216
+ nullable: true,
217
+ extra: { for: TEMPORAL_COLUMNS.start }
218
+ },
219
+ { name: TEMPORAL_COLUMNS.endText, dtype: "string", nullable: true, extra: { for: TEMPORAL_COLUMNS.end } },
220
+ { name: TEMPORAL_COLUMNS.open, dtype: "u8", role: "open", nullable: true }
221
+ ];
222
+ if (temporalValue) {
223
+ decls.push({
224
+ name: TEMPORAL_COLUMNS.valueText,
225
+ dtype: "string",
226
+ nullable: true,
227
+ extra: { for: TEMPORAL_COLUMNS.value }
228
+ });
229
+ }
230
+ return decls;
231
+ }
232
+ const TYPES_1_2 = /* @__PURE__ */ new Set(["integer", "long", "double", "float", "boolean", "string", "anyURI"]);
233
+ const TYPES_1_3 = /* @__PURE__ */ new Set([
234
+ ...TYPES_1_2,
235
+ "bigdecimal",
236
+ "biginteger",
237
+ "byte",
238
+ "char",
239
+ "short",
240
+ "date",
241
+ "dateTime"
242
+ ]);
243
+ function isScalarType(type, version) {
244
+ return (version === "1.2" ? TYPES_1_2 : TYPES_1_3).has(type);
245
+ }
246
+ function isListType(type, version) {
247
+ return type.startsWith("list") && type.length > 4 && isScalarType(type.slice(4), "1.3");
248
+ }
249
+ function canonicalScalarType(dtype) {
250
+ switch (dtype) {
251
+ case "bool":
252
+ return "boolean";
253
+ case "i32":
254
+ case "u8":
255
+ return "integer";
256
+ case "u32":
257
+ return "long";
258
+ case "f32":
259
+ return "float";
260
+ case "f64":
261
+ return "double";
262
+ case "dict":
263
+ case "string":
264
+ case "json":
265
+ case "list":
266
+ return "string";
267
+ default: {
268
+ const name = dtype;
269
+ return name;
270
+ }
271
+ }
272
+ }
273
+ const ASCII = [
274
+ 318,
275
+ 401,
276
+ 460,
277
+ 838,
278
+ 636,
279
+ 950,
280
+ 780,
281
+ 275,
282
+ 390,
283
+ 390,
284
+ 500,
285
+ 838,
286
+ 318,
287
+ 361,
288
+ 318,
289
+ 337,
290
+ 636,
291
+ 636,
292
+ 636,
293
+ 636,
294
+ 636,
295
+ 636,
296
+ 636,
297
+ 636,
298
+ 636,
299
+ 636,
300
+ 337,
301
+ 337,
302
+ 838,
303
+ 838,
304
+ 838,
305
+ 531,
306
+ 1e3,
307
+ 684,
308
+ 686,
309
+ 698,
310
+ 770,
311
+ 632,
312
+ 575,
313
+ 775,
314
+ 752,
315
+ 295,
316
+ 295,
317
+ 656,
318
+ 557,
319
+ 863,
320
+ 748,
321
+ 787,
322
+ 603,
323
+ 787,
324
+ 695,
325
+ 635,
326
+ 611,
327
+ 732,
328
+ 684,
329
+ 989,
330
+ 685,
331
+ 611,
332
+ 685,
333
+ 390,
334
+ 337,
335
+ 390,
336
+ 838,
337
+ 500,
338
+ 500,
339
+ 613,
340
+ 635,
341
+ 550,
342
+ 635,
343
+ 615,
344
+ 352,
345
+ 635,
346
+ 634,
347
+ 278,
348
+ 278,
349
+ 579,
350
+ 278,
351
+ 974,
352
+ 634,
353
+ 612,
354
+ 635,
355
+ 635,
356
+ 411,
357
+ 521,
358
+ 392,
359
+ 634,
360
+ 592,
361
+ 818,
362
+ 592,
363
+ 592,
364
+ 525,
365
+ 636,
366
+ 337,
367
+ 636,
368
+ 838
369
+ ];
370
+ const LATIN = [
371
+ 318,
372
+ 401,
373
+ 636,
374
+ 636,
375
+ 636,
376
+ 636,
377
+ 337,
378
+ 500,
379
+ 500,
380
+ 1e3,
381
+ 471,
382
+ 612,
383
+ 838,
384
+ 361,
385
+ 1e3,
386
+ 500,
387
+ 500,
388
+ 838,
389
+ 401,
390
+ 401,
391
+ 500,
392
+ 636,
393
+ 636,
394
+ 318,
395
+ 500,
396
+ 401,
397
+ 471,
398
+ 612,
399
+ 969,
400
+ 969,
401
+ 969,
402
+ 531,
403
+ 684,
404
+ 684,
405
+ 684,
406
+ 684,
407
+ 684,
408
+ 684,
409
+ 974,
410
+ 698,
411
+ 632,
412
+ 632,
413
+ 632,
414
+ 632,
415
+ 295,
416
+ 295,
417
+ 295,
418
+ 295,
419
+ 775,
420
+ 748,
421
+ 787,
422
+ 787,
423
+ 787,
424
+ 787,
425
+ 787,
426
+ 838,
427
+ 787,
428
+ 732,
429
+ 732,
430
+ 732,
431
+ 732,
432
+ 611,
433
+ 605,
434
+ 630,
435
+ 613,
436
+ 613,
437
+ 613,
438
+ 613,
439
+ 613,
440
+ 613,
441
+ 982,
442
+ 550,
443
+ 615,
444
+ 615,
445
+ 615,
446
+ 615,
447
+ 278,
448
+ 278,
449
+ 278,
450
+ 278,
451
+ 612,
452
+ 634,
453
+ 612,
454
+ 612,
455
+ 612,
456
+ 612,
457
+ 612,
458
+ 838,
459
+ 612,
460
+ 634,
461
+ 634,
462
+ 634,
463
+ 634,
464
+ 592,
465
+ 635,
466
+ 592,
467
+ 684,
468
+ 613,
469
+ 684,
470
+ 613,
471
+ 684,
472
+ 613,
473
+ 698,
474
+ 550,
475
+ 698,
476
+ 550,
477
+ 698,
478
+ 550,
479
+ 698,
480
+ 550,
481
+ 770,
482
+ 635,
483
+ 775,
484
+ 635,
485
+ 632,
486
+ 615,
487
+ 632,
488
+ 615,
489
+ 632,
490
+ 615,
491
+ 632,
492
+ 615,
493
+ 632,
494
+ 615,
495
+ 775,
496
+ 635,
497
+ 775,
498
+ 635,
499
+ 775,
500
+ 635,
501
+ 775,
502
+ 635,
503
+ 752,
504
+ 634,
505
+ 916,
506
+ 695,
507
+ 295,
508
+ 278,
509
+ 295,
510
+ 278,
511
+ 295,
512
+ 278,
513
+ 295,
514
+ 278,
515
+ 295,
516
+ 278,
517
+ 590,
518
+ 556,
519
+ 295,
520
+ 278,
521
+ 656,
522
+ 579,
523
+ 579,
524
+ 557,
525
+ 278,
526
+ 557,
527
+ 278,
528
+ 557,
529
+ 375,
530
+ 557,
531
+ 342,
532
+ 562,
533
+ 284,
534
+ 748,
535
+ 634,
536
+ 748,
537
+ 634,
538
+ 748,
539
+ 634,
540
+ 813,
541
+ 748,
542
+ 634,
543
+ 787,
544
+ 612,
545
+ 787,
546
+ 612,
547
+ 787,
548
+ 612,
549
+ 1070,
550
+ 1023,
551
+ 695,
552
+ 411,
553
+ 695,
554
+ 411,
555
+ 695,
556
+ 411,
557
+ 635,
558
+ 521,
559
+ 635,
560
+ 521,
561
+ 635,
562
+ 521,
563
+ 635,
564
+ 521,
565
+ 611,
566
+ 392,
567
+ 611,
568
+ 392,
569
+ 611,
570
+ 392,
571
+ 732,
572
+ 634,
573
+ 732,
574
+ 634,
575
+ 732,
576
+ 634,
577
+ 732,
578
+ 634,
579
+ 732,
580
+ 634,
581
+ 732,
582
+ 634,
583
+ 989,
584
+ 818,
585
+ 611,
586
+ 592,
587
+ 611,
588
+ 685,
589
+ 525,
590
+ 685,
591
+ 525,
592
+ 685,
593
+ 525,
594
+ 352,
595
+ 635,
596
+ 735,
597
+ 686,
598
+ 635,
599
+ 686,
600
+ 635,
601
+ 703,
602
+ 698,
603
+ 550,
604
+ 775,
605
+ 819,
606
+ 686,
607
+ 635,
608
+ 612,
609
+ 632,
610
+ 787,
611
+ 614,
612
+ 575,
613
+ 352,
614
+ 775,
615
+ 687,
616
+ 984,
617
+ 354,
618
+ 295,
619
+ 746,
620
+ 579,
621
+ 278,
622
+ 592,
623
+ 974,
624
+ 748,
625
+ 634,
626
+ 787,
627
+ 913,
628
+ 612,
629
+ 949,
630
+ 759,
631
+ 652,
632
+ 635,
633
+ 695,
634
+ 635,
635
+ 521,
636
+ 632,
637
+ 336,
638
+ 392,
639
+ 611,
640
+ 392,
641
+ 611,
642
+ 858,
643
+ 634,
644
+ 764,
645
+ 721,
646
+ 744,
647
+ 730,
648
+ 685,
649
+ 525,
650
+ 666,
651
+ 666,
652
+ 578,
653
+ 525,
654
+ 636,
655
+ 666,
656
+ 578,
657
+ 510,
658
+ 635,
659
+ 295,
660
+ 492,
661
+ 459,
662
+ 295,
663
+ 1422,
664
+ 1299,
665
+ 1154,
666
+ 835,
667
+ 787,
668
+ 457,
669
+ 931,
670
+ 924,
671
+ 797,
672
+ 684,
673
+ 613,
674
+ 295,
675
+ 278,
676
+ 787,
677
+ 612,
678
+ 732,
679
+ 634,
680
+ 732,
681
+ 634,
682
+ 732,
683
+ 634,
684
+ 732,
685
+ 634,
686
+ 732,
687
+ 634,
688
+ 615,
689
+ 684,
690
+ 613,
691
+ 684,
692
+ 613,
693
+ 974,
694
+ 982,
695
+ 775,
696
+ 635,
697
+ 775,
698
+ 635,
699
+ 656,
700
+ 579,
701
+ 787,
702
+ 612,
703
+ 787,
704
+ 612,
705
+ 666,
706
+ 578,
707
+ 278,
708
+ 1422,
709
+ 1299,
710
+ 1154,
711
+ 775,
712
+ 635,
713
+ 1113,
714
+ 682,
715
+ 748,
716
+ 634,
717
+ 684,
718
+ 613,
719
+ 974,
720
+ 982,
721
+ 787,
722
+ 612,
723
+ 684,
724
+ 613,
725
+ 684,
726
+ 613,
727
+ 632,
728
+ 615,
729
+ 632,
730
+ 615,
731
+ 295,
732
+ 278,
733
+ 295,
734
+ 278,
735
+ 787,
736
+ 612,
737
+ 787,
738
+ 612,
739
+ 695,
740
+ 411,
741
+ 695,
742
+ 411,
743
+ 732,
744
+ 634,
745
+ 732,
746
+ 634,
747
+ 635,
748
+ 521,
749
+ 611,
750
+ 392,
751
+ 627,
752
+ 521,
753
+ 752,
754
+ 634,
755
+ 735,
756
+ 838,
757
+ 698,
758
+ 610,
759
+ 685,
760
+ 525,
761
+ 684,
762
+ 613,
763
+ 632,
764
+ 615,
765
+ 787,
766
+ 612,
767
+ 787,
768
+ 612,
769
+ 787,
770
+ 612,
771
+ 787,
772
+ 612,
773
+ 611,
774
+ 592,
775
+ 475,
776
+ 843,
777
+ 477,
778
+ 278,
779
+ 998,
780
+ 998,
781
+ 684,
782
+ 698,
783
+ 550,
784
+ 557,
785
+ 611,
786
+ 521,
787
+ 525,
788
+ 603,
789
+ 479,
790
+ 686,
791
+ 732,
792
+ 684,
793
+ 632,
794
+ 615,
795
+ 295,
796
+ 278,
797
+ 781,
798
+ 635,
799
+ 695,
800
+ 411,
801
+ 611,
802
+ 592
803
+ ];
804
+ const DIALOG_LINE_HEIGHT = 1.1640625;
805
+ function dialogWidth(text) {
806
+ let sum = 0;
807
+ for (const ch of text) {
808
+ const c = ch.codePointAt(0) ?? 0;
809
+ if (c >= 32 && c < 127) {
810
+ sum += ASCII[c - 32];
811
+ } else {
812
+ sum += c >= 160 && c < 592 ? LATIN[c - 160] : 1e3;
813
+ }
814
+ }
815
+ return sum / 1e3;
816
+ }
817
+ const GEPHI_PREVIEW = Object.freeze({
818
+ "edge.show": "true",
819
+ "edge.thickness": "1.0",
820
+ "edge.use-weight": "true",
821
+ "edge.rescale-weight": "false",
822
+ "edge.rescale-weight.min": "0.4",
823
+ "edge.rescale-weight.max": "8.0",
824
+ "edge.color": "mixed",
825
+ "edge.opacity": "100.0",
826
+ "edge.curved": "true",
827
+ "arrow.size": "3.0",
828
+ "node.border.fixed": "false",
829
+ "node.border.width": "1.0",
830
+ "node.border.color": "darker",
831
+ "node.opacity": "100.0",
832
+ "node.per.node.opacity": "false",
833
+ "node.label.show": "true",
834
+ "node.label.customFont": "false",
835
+ "node.label.font": "Dialog,plain,12",
836
+ "node.label.proportinalSize": "true",
837
+ "node.label.color": "#000000",
838
+ "node.label.shorten": "false",
839
+ "node.label.avoidOverlap": "true",
840
+ "node.label.overlapGridSize": "10",
841
+ "node.label.scale": "1.0",
842
+ "node.label.max-char": "30",
843
+ "node.label.outline.size": "0.0",
844
+ "node.label.outline.color": "#ffffff",
845
+ "node.label.outline.opacity": "80.0",
846
+ "node.label.box": "false",
847
+ "node.label.box.color": "parent",
848
+ "node.label.box.opacity": "100.0",
849
+ "edge.label.show": "false",
850
+ "edge.label.customFont": "false",
851
+ "edge.label.font": "Dialog,plain,10",
852
+ "edge.label.color": "original",
853
+ "edge.label.shorten": "false",
854
+ "edge.label.max-char": "30",
855
+ "edge.label.outline.size": "0.0",
856
+ "edge.label.outline.color": "#ffffff",
857
+ "edge.label.outline.opacity": "80.0"
858
+ });
859
+ class GephiPreview {
860
+ /**
861
+ * The settings: Gephi's defaults under the ones given.
862
+ * @param given - the settings given, by Gephi's property names
863
+ */
864
+ constructor(given = {}) {
865
+ this.values = { ...GEPHI_PREVIEW, ...given };
866
+ }
867
+ /**
868
+ * A setting's text, trimmed and lower case.
869
+ * @param name - the property
870
+ * @returns the text
871
+ */
872
+ text(name) {
873
+ return (this.values[name] ?? "").trim().toLowerCase();
874
+ }
875
+ /**
876
+ * A boolean setting.
877
+ * @param name - the property
878
+ * @returns its value
879
+ */
880
+ on(name) {
881
+ return this.text(name) === "true";
882
+ }
883
+ /**
884
+ * A number setting; Gephi's default where the text is not a number.
885
+ * @param name - the property
886
+ * @returns its value
887
+ */
888
+ num(name) {
889
+ const v = Number(this.text(name));
890
+ return Number.isFinite(v) ? v : Number(GEPHI_PREVIEW[name] ?? 0);
891
+ }
892
+ /**
893
+ * The font of node or edge labels: the given font when `<target>.label.customFont` is on, else Gephi's.
894
+ * @param target - "node" or "edge"
895
+ * @returns the font
896
+ */
897
+ font(target) {
898
+ const name = `${target}.label.font`;
899
+ const raw = this.on(`${target}.label.customFont`) ? this.values[name] ?? "" : GEPHI_PREVIEW[name] ?? "";
900
+ const [family = "Dialog", style = "plain", size = ""] = raw.split(",").map((s2) => s2.trim());
901
+ const s = style.toLowerCase();
902
+ const pt = Number(size);
903
+ const fallback = target === "node" ? 12 : 10;
904
+ return {
905
+ family,
906
+ bold: s.includes("bold"),
907
+ italic: s.includes("italic"),
908
+ size: Number.isFinite(pt) && pt > 0 ? pt : fallback
909
+ };
910
+ }
911
+ }
912
+ function shortened(label, max) {
913
+ return label.length >= max + 3 ? `${label.slice(0, max)}...` : label;
914
+ }
915
+ function dependantColor(mode, parent) {
916
+ switch (mode) {
917
+ case "darker":
918
+ return parent.slice(0, 3).map((v) => Math.floor(v / 2));
919
+ case "lighter":
920
+ return parent.slice(0, 3).map((v) => Math.min(255, Math.floor(v * 1.5)));
921
+ case "parent":
922
+ case "original":
923
+ return parent.slice(0, 3);
924
+ default: {
925
+ const m = /^#([0-9a-f]{6})$/.exec(mode);
926
+ if (m === null) {
927
+ return null;
928
+ }
929
+ const n = Number.parseInt(m[1], 16);
930
+ return [n >> 16 & 255, n >> 8 & 255, n & 255];
931
+ }
932
+ }
933
+ }
934
+ function drawnLabels(labels, preview, target, kept = false) {
935
+ if (labels === void 0 || !preview.on(`${target}.label.show`)) {
936
+ return void 0;
937
+ }
938
+ const max = preview.on(`${target}.label.shorten`) ? preview.num(`${target}.label.max-char`) : Infinity;
939
+ const drawn = (l) => kept ? l : l.replaceAll(/[\r\n]/g, "");
940
+ return labels.map((l) => typeof l === "string" ? drawn(shortened(l, max)) : l);
941
+ }
942
+ function edgeThickness(weights, drawn, preview) {
943
+ const thickness = preview.num("edge.thickness");
944
+ if (!preview.on("edge.use-weight")) {
945
+ return weights.map(() => thickness);
946
+ }
947
+ if (!preview.on("edge.rescale-weight")) {
948
+ return weights.map((w) => w * thickness);
949
+ }
950
+ let lo = Infinity;
951
+ let hi = -Infinity;
952
+ weights.forEach((w, e) => {
953
+ if (drawn[e]) {
954
+ lo = Math.min(lo, w);
955
+ hi = Math.max(hi, w);
956
+ }
957
+ });
958
+ const min = preview.num("edge.rescale-weight.min");
959
+ const max = preview.num("edge.rescale-weight.max");
960
+ return weights.map((w) => (hi > lo ? min + (w - lo) / (hi - lo) * (max - min) : min) * thickness);
961
+ }
962
+ const LABEL_COLUMN = NODE_COLUMNS.label;
963
+ const GRAPHTY_XML_NAMESPACE = "https://graphty.app/ns/gexf";
964
+ const GEXF_STYLE_CAPABILITIES = Object.freeze({
965
+ tool: "gephi",
966
+ node: Object.freeze(["label", "fill", "fillOpacity", "width", "height", "shape", "image"]),
967
+ edge: Object.freeze(["color", "opacity", "width", "lineStyle"]),
968
+ block: "native"
969
+ });
970
+ const GEPHI_NODE_FILL = "#000000";
971
+ const DIRECTED_KEY = "directed";
972
+ const AVOID_OVERLAP_KEY = "label-avoid-overlap";
973
+ const HIDDEN_KEY = "gephi-hidden";
974
+ const MIXED_COLOR_KEY = "end-colors";
975
+ const WEIGHT_WIDTH = ["width", "weight-width"];
976
+ const GEPHI_NODE_WIDTH = 20;
977
+ const SELF_LOOP_THICKNESS = 1.3;
978
+ const NODE_SHAPES = /* @__PURE__ */ new Map([
979
+ ["ellipse", "disc"],
980
+ ["rectangle", "square"],
981
+ ["triangle", "triangle"],
982
+ ["diamond", "diamond"]
983
+ ]);
984
+ const NEAREST_NODE_SHAPES = /* @__PURE__ */ new Map([
985
+ ["round-rectangle", "square"],
986
+ ["vee", "triangle"]
987
+ ]);
988
+ const EDGE_SHAPES = /* @__PURE__ */ new Set(["solid", "dotted", "dashed", "double"]);
989
+ function gexfNodeShape(shape) {
990
+ const exact = NODE_SHAPES.get(shape);
991
+ return exact === void 0 ? { value: NEAREST_NODE_SHAPES.get(shape) ?? "disc", exact: false } : { value: exact, exact: true };
992
+ }
993
+ function gexfEdgeShape(line) {
994
+ if (EDGE_SHAPES.has(line)) {
995
+ return { value: line, exact: true };
996
+ }
997
+ return { value: line === "dash-dot" || line === "long-dash" ? "dashed" : "solid", exact: false };
998
+ }
999
+ const VIZ_COLUMNS = {
1000
+ node: ["color", "size", "shape", "shape.uri"],
1001
+ edge: ["color", "thickness", "shape"]
1002
+ };
1003
+ function canonVizColor(hex) {
1004
+ const m = /^([+-]?)(?:(0x|0X|#)([0-9a-fA-F]+)|(0[0-7]+)|(\d+))$/.exec(hex.trim());
1005
+ if (m === null) {
1006
+ return null;
1007
+ }
1008
+ const [, sign, , hexDigits, octal, decimal] = m;
1009
+ let v;
1010
+ if (hexDigits !== void 0) {
1011
+ v = Number.parseInt(hexDigits, 16);
1012
+ } else if (octal !== void 0) {
1013
+ v = Number.parseInt(octal, 8);
1014
+ } else {
1015
+ v = Number.parseInt(decimal, 10);
1016
+ }
1017
+ if (sign === "-") {
1018
+ v = -v;
1019
+ }
1020
+ if (v < -2147483648 || v > 2147483647) {
1021
+ return null;
1022
+ }
1023
+ const n = v & 16777215;
1024
+ return [n >> 16 & 255, n >> 8 & 255, n & 255, 1];
1025
+ }
1026
+ function vizColumn(snapshot, target, name) {
1027
+ const col = (target === "node" ? snapshot.nodes : snapshot.edges).get(name);
1028
+ return col !== null && col.meta.origin?.namespace === VIZ_NAMESPACE ? name : null;
1029
+ }
1030
+ function vizValues(snapshot, target, notes, context) {
1031
+ const table = target === "node" ? snapshot.nodes : snapshot.edges;
1032
+ const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
1033
+ const out = {};
1034
+ const viz = {
1035
+ table,
1036
+ target,
1037
+ column: (p) => out[p] ??= new Array(n).fill(null),
1038
+ site: (i, property) => ({ notes, target, property, element: i, budget: context.budget })
1039
+ };
1040
+ const color = vizColumn(snapshot, target, "color");
1041
+ const size = vizColumn(snapshot, target, target === "node" ? "size" : "thickness");
1042
+ const shape = vizColumn(snapshot, target, "shape");
1043
+ const uri = target === "node" ? vizColumn(snapshot, target, "shape.uri") : null;
1044
+ const label = target === "node" ? table.byRole("label") : null;
1045
+ for (let i = 0; i < n; i++) {
1046
+ if (label !== null) {
1047
+ readLabel(viz, label, i);
1048
+ }
1049
+ if (color !== null) {
1050
+ readVizColor(viz, color, i);
1051
+ }
1052
+ if (size !== null) {
1053
+ readVizSize(viz, size, i);
1054
+ }
1055
+ if (shape !== null && readVizShape(viz, shape, i) && uri !== null) {
1056
+ readVizImage(viz, uri, i);
1057
+ }
1058
+ }
1059
+ return out;
1060
+ }
1061
+ function readLabel(viz, label, i) {
1062
+ const text = canonText(plainCell(label.value(i)), viz.site(i, "label"));
1063
+ if (text !== null) {
1064
+ viz.column("label")[i] = text;
1065
+ }
1066
+ }
1067
+ function readVizImage(viz, uri, i) {
1068
+ const v = plainCell(viz.table.value(uri, i));
1069
+ if (typeof v === "string" && v.length > 0) {
1070
+ viz.column("image")[i] = v;
1071
+ }
1072
+ }
1073
+ function readVizColor(viz, color, i) {
1074
+ const v = plainCell(viz.table.value(color, i));
1075
+ if (!Array.isArray(v)) {
1076
+ return;
1077
+ }
1078
+ const [fill, opacity] = viz.target === "node" ? ["fill", "fillOpacity"] : ["color", "opacity"];
1079
+ const [r, g, b, a = 1] = v;
1080
+ const c = canonColor({ r: r * 255, g: g * 255, b: b * 255, a }, "gexf", viz.site(i, fill));
1081
+ if (c !== null) {
1082
+ viz.column(fill)[i] = c.color;
1083
+ if (c.alpha < 1) {
1084
+ viz.column(opacity)[i] = c.alpha;
1085
+ }
1086
+ }
1087
+ }
1088
+ function readVizSize(viz, size, i) {
1089
+ const v = canonNumber(plainCell(viz.table.value(size, i)), viz.site(i, "width"));
1090
+ if (v !== null && !(v === 0 && viz.target === "node")) {
1091
+ if (viz.target === "node") {
1092
+ viz.column("width")[i] = 2 * v;
1093
+ viz.column("height")[i] = 2 * v;
1094
+ } else {
1095
+ viz.column("width")[i] = v;
1096
+ }
1097
+ }
1098
+ }
1099
+ function readVizShape(viz, shape, i) {
1100
+ const raw = plainCell(viz.table.value(shape, i));
1101
+ if (raw === null) {
1102
+ return false;
1103
+ }
1104
+ const kind = viz.target === "node" ? "shape" : "lineStyle";
1105
+ viz.column(kind)[i] = canonEnum(kind, raw, "gexf", viz.site(i, kind));
1106
+ return typeof raw === "string" && raw.toLowerCase() === "image";
1107
+ }
1108
+ function gephiEdges(snapshot, gexf) {
1109
+ const n = snapshot.edgeCount;
1110
+ const first = firstHalf(snapshot);
1111
+ if (!gexf) {
1112
+ return otherFormatEdges(snapshot);
1113
+ }
1114
+ const header = gexfDefaultEdgeType(snapshot);
1115
+ const dirCol = snapshot.edges.byRole("directed");
1116
+ const mutualCol = snapshot.edges.byRole("mutual");
1117
+ const kindCol = snapshot.edges.byRole("kind");
1118
+ const weightOf = gephiWeight(snapshot);
1119
+ const out = {
1120
+ directed: new Array(n).fill(false),
1121
+ hidden: new Array(n).fill(false),
1122
+ weight: new Array(n).fill(1)
1123
+ };
1124
+ const leaders = /* @__PURE__ */ new Map();
1125
+ const drawnLeaders = [];
1126
+ const ownDirection = gexfOwnDirection(header, dirCol, mutualCol);
1127
+ for (let e = 0; e < n; e++) {
1128
+ const f = first(e);
1129
+ if (f !== e) {
1130
+ continue;
1131
+ }
1132
+ const { ownUndirected, mismatched } = ownDirection(f);
1133
+ if (mismatched) {
1134
+ out.hidden[f] = true;
1135
+ continue;
1136
+ }
1137
+ const s = snapshot.edgeSource(f);
1138
+ const t = snapshot.edgeTarget(f);
1139
+ const directed = header !== "undirected" && s !== t && !ownUndirected;
1140
+ out.directed[f] = directed;
1141
+ const kind = kindCol?.isSet(f) === true ? String(kindCol.value(f)) : "";
1142
+ const key = `${kind}\0${gephiEndsKey(s, t, directed)}`;
1143
+ const leader = leaders.get(key);
1144
+ if (leader === void 0) {
1145
+ leaders.set(key, f);
1146
+ drawnLeaders.push(f);
1147
+ out.weight[f] = weightOf(f);
1148
+ } else {
1149
+ out.weight[leader] += weightOf(f);
1150
+ out.hidden[f] = true;
1151
+ }
1152
+ }
1153
+ const smallest = drawnLeaders.reduce((m, f) => Math.min(m, out.weight[f]), Infinity);
1154
+ const shift = smallest <= 0 ? 1 - smallest : 0;
1155
+ for (let e = 0; e < n; e++) {
1156
+ const f = first(e);
1157
+ out.directed[e] = out.directed[f];
1158
+ out.hidden[e] = out.hidden[f];
1159
+ out.weight[e] = out.weight[f] + shift;
1160
+ }
1161
+ return out;
1162
+ }
1163
+ function gephiEndsKey(s, t, directed) {
1164
+ return directed ? `${String(s)}>${String(t)}` : `${String(Math.min(s, t))}-${String(Math.max(s, t))}`;
1165
+ }
1166
+ function gexfOwnDirection(header, dirCol, mutualCol) {
1167
+ const verdict = (ownUndirected, ownDirected) => ({
1168
+ ownUndirected,
1169
+ mismatched: header === "directed" && ownUndirected || header === "undirected" && ownDirected
1170
+ });
1171
+ return (f) => {
1172
+ if (dirCol === null) {
1173
+ return verdict(header === "undirected", header !== "undirected");
1174
+ }
1175
+ const mutual = mutualCol?.value(f) === true;
1176
+ return verdict(dirCol.value(f) === false && !mutual, dirCol.value(f) === true && !mutual);
1177
+ };
1178
+ }
1179
+ function otherFormatEdges(snapshot) {
1180
+ const first = firstHalf(snapshot);
1181
+ const weightOf = gephiWeight(snapshot);
1182
+ const directed = new Array(snapshot.edgeCount).fill(snapshot.directed);
1183
+ const col = snapshot.directed ? snapshot.edges.byRole("directed") : null;
1184
+ const weight = [];
1185
+ for (let e = 0; e < snapshot.edgeCount; e++) {
1186
+ if (col !== null) {
1187
+ directed[e] = plainCell(col.value(e)) !== false;
1188
+ }
1189
+ const w = weightOf(first(e));
1190
+ weight.push(w > 0 ? w : 1);
1191
+ }
1192
+ return { directed, hidden: directed.map(() => false), weight };
1193
+ }
1194
+ function gexfDefaultEdgeType(snapshot) {
1195
+ const written = snapshot.meta.extra.gexf?.defaultedgetype;
1196
+ return typeof written === "string" ? written.trim().toLowerCase() : null;
1197
+ }
1198
+ function gephiWeight(snapshot) {
1199
+ const isWeight = (v) => typeof v === "string" && v.toLowerCase() === "weight";
1200
+ const dynamic = snapshot.edges.names().map((name) => snapshot.edges.get(name)).find(
1201
+ (c) => c !== null && c.meta.dynamic && [c.meta.name, c.meta.origin?.id, c.meta.origin?.title].some(isWeight)
1202
+ );
1203
+ const table = dynamic === void 0 || dynamic === null ? void 0 : snapshot.extensions.get(temporalTableName("edge", dynamic.meta.name));
1204
+ if (table !== void 0) {
1205
+ const element = table.get(TEMPORAL_COLUMNS.element);
1206
+ const start = table.get(TEMPORAL_COLUMNS.start);
1207
+ const value = table.get(TEMPORAL_COLUMNS.value);
1208
+ const earliest = /* @__PURE__ */ new Map();
1209
+ for (let row = 0; element !== null && value !== null && row < table.rowCount; row++) {
1210
+ const e = element.value(row);
1211
+ const at = start?.isSet(row) === true ? start.value(row) : -Infinity;
1212
+ const v = Number(value.value(row));
1213
+ const seen = earliest.get(e);
1214
+ if (Number.isFinite(v) && (seen === void 0 || at < seen.start)) {
1215
+ earliest.set(e, { start: at, value: v });
1216
+ }
1217
+ }
1218
+ return (e) => earliest.get(e)?.value ?? 0;
1219
+ }
1220
+ const weights = explicitWeights(snapshot);
1221
+ return (e) => {
1222
+ const w = Number(weights.text(e) ?? 1);
1223
+ return Number.isFinite(w) ? w : 1;
1224
+ };
1225
+ }
1226
+ function nodeChannels(fill, opacity) {
1227
+ const n = Number.parseInt((typeof fill === "string" ? fill : GEPHI_NODE_FILL).slice(1), 16);
1228
+ const a = typeof opacity === "number" ? Math.round(opacity * 255) : 255;
1229
+ return [n >> 16 & 255, n >> 8 & 255, n & 255, a];
1230
+ }
1231
+ function hexOf(c) {
1232
+ return `#${c.slice(0, 3).map((v) => v.toString(16).padStart(2, "0")).join("")}`;
1233
+ }
1234
+ function perElementDefault(out, target, pair, column, reason) {
1235
+ const [property, key] = pair;
1236
+ const elements = column.filter((v) => v !== null).length;
1237
+ if (elements === 0) {
1238
+ return;
1239
+ }
1240
+ out.columns.set(key, column);
1241
+ out.rules.push({
1242
+ id: `${target}.tool.${key}`,
1243
+ target,
1244
+ role: "passthrough",
1245
+ origin: "tool",
1246
+ where: { has: { style: key } },
1247
+ map: { [property]: { kind: "passthrough", by: { style: key } } },
1248
+ facts: { elements, reason }
1249
+ });
1250
+ }
1251
+ function everyElement(out, target, id, set) {
1252
+ if (Object.keys(set).length > 0) {
1253
+ out.rules.push({
1254
+ id: `${target}.tool.${id}`,
1255
+ target,
1256
+ role: "group",
1257
+ origin: "tool",
1258
+ where: { all: true },
1259
+ set
1260
+ });
1261
+ }
1262
+ }
1263
+ function gephiRules(snapshot, nodes, edges, budget, gexf) {
1264
+ const preview = gexf?.preview ?? new GephiPreview();
1265
+ const node = { rules: [], columns: /* @__PURE__ */ new Map() };
1266
+ const edge = { rules: [], columns: /* @__PURE__ */ new Map() };
1267
+ budget.spend("node", snapshot.nodeCount);
1268
+ budget.spend("edge", snapshot.edgeCount);
1269
+ const channels = Array.from(
1270
+ { length: snapshot.nodeCount },
1271
+ (_, i) => nodeChannels(nodes.fill?.[i], nodes.fillOpacity?.[i])
1272
+ );
1273
+ const labelSizes = nodeRules(node, snapshot, channels, nodes, preview);
1274
+ edgeRules(edge, snapshot, channels, nodes, edges, gexf, preview);
1275
+ nodeLabelRules(node, channels, labelSizes, preview, gexf?.overlapSettled === true);
1276
+ labelBox(node, channels, nodes, preview);
1277
+ return { node, edge };
1278
+ }
1279
+ function nodeWidth(nodes, i) {
1280
+ const w = nodes.width?.[i];
1281
+ return typeof w === "number" ? w : GEPHI_NODE_WIDTH;
1282
+ }
1283
+ function nodeRules(node, snapshot, channels, nodes, preview) {
1284
+ const nodeIndices = Array.from({ length: snapshot.nodeCount }, (_, i) => i);
1285
+ const perNode = preview.on("node.per.node.opacity");
1286
+ const alpha = channels.map((c) => (perNode ? c[3] : 255) / 255 * (preview.num("node.opacity") / 100));
1287
+ const translucent = alpha.map((a) => a < 1 ? a : null);
1288
+ perElementDefault(node, "node", ["fillOpacity", "preview-opacity"], translucent, "NODE_OPACITY");
1289
+ perElementDefault(node, "node", ["borderOpacity", "preview-border-opacity"], translucent, "NODE_OPACITY");
1290
+ const borderMode = preview.text("node.border.color");
1291
+ perElementDefault(
1292
+ node,
1293
+ "node",
1294
+ ["borderColor", "border-shade"],
1295
+ channels.map((c) => hexOf(dependantColor(borderMode, c) ?? c.map((v) => Math.floor(v / 2)))),
1296
+ "NODE_FILL_SHADE"
1297
+ );
1298
+ const fixed = preview.on("node.border.fixed") ? preview.num("node.border.width") : null;
1299
+ perElementDefault(
1300
+ node,
1301
+ "node",
1302
+ ["borderWidth", "size-border"],
1303
+ nodeIndices.map((i) => {
1304
+ return fixed === null ? 0.08 * nodeWidth(nodes, i) : Math.min(fixed, nodeWidth(nodes, i) / 2);
1305
+ }),
1306
+ "NODE_SIZE"
1307
+ );
1308
+ const font = preview.font("node");
1309
+ const labelSizes = nodeIndices.map(
1310
+ (i) => preview.on("node.label.proportinalSize") ? Math.max(1, Math.round(font.size / 40 * nodeWidth(nodes, i))) : font.size
1311
+ );
1312
+ perElementDefault(node, "node", ["labelSize", "size-label"], labelSizes, "NODE_SIZE");
1313
+ return labelSizes;
1314
+ }
1315
+ function nodeLabelRules(node, channels, sizes, preview, settled) {
1316
+ const color = preview.text("node.label.color");
1317
+ if (color !== "#000000" && color !== "original") {
1318
+ perElementDefault(
1319
+ node,
1320
+ "node",
1321
+ ["labelColor", "preview-label-color"],
1322
+ channels.map((c) => hexOf(dependantColor(color, c) ?? [0, 0, 0])),
1323
+ "NODE_LABEL_COLOR"
1324
+ );
1325
+ }
1326
+ labelOutline(node, "node", channels, sizes, preview);
1327
+ const font = preview.font("node");
1328
+ everyElement(node, "node", "preview-label", fontValues(font, preview.on("node.label.customFont")));
1329
+ if (preview.on("node.label.avoidOverlap") && !settled) {
1330
+ node.columns.set(
1331
+ AVOID_OVERLAP_KEY,
1332
+ sizes.map(() => true)
1333
+ );
1334
+ node.rules.push({
1335
+ id: "node.tool.label-avoid-overlap",
1336
+ target: "node",
1337
+ role: "group",
1338
+ origin: "tool",
1339
+ where: { has: { style: AVOID_OVERLAP_KEY } },
1340
+ set: { labelAvoidOverlap: true }
1341
+ });
1342
+ }
1343
+ }
1344
+ function gephiAlpha(percent) {
1345
+ return Math.floor(Math.min(Math.max(percent, 0), 100) / 100 * 255 + 1e-9) / 255;
1346
+ }
1347
+ function labelBox(node, channels, nodes, preview) {
1348
+ if (!preview.on("node.label.box")) {
1349
+ return;
1350
+ }
1351
+ const mode = preview.text("node.label.box.color");
1352
+ perElementDefault(
1353
+ node,
1354
+ "node",
1355
+ ["labelBorderColor", "preview-box-color"],
1356
+ channels.map((c) => hexOf(dependantColor(mode, c) ?? c)),
1357
+ "LABEL_BOX"
1358
+ );
1359
+ perElementDefault(
1360
+ node,
1361
+ "node",
1362
+ ["labelBorderWidth", "preview-box-width"],
1363
+ channels.map((_, i) => 0.04 * nodeWidth(nodes, i)),
1364
+ "LABEL_BOX"
1365
+ );
1366
+ everyElement(node, "node", "preview-box", {
1367
+ labelBorderOpacity: gephiAlpha(preview.num("node.label.box.opacity")),
1368
+ labelPadding: 0,
1369
+ labelLineHeight: 1
1370
+ });
1371
+ }
1372
+ function fontValues(font, custom) {
1373
+ if (!custom) {
1374
+ return {};
1375
+ }
1376
+ return {
1377
+ labelFont: font.family,
1378
+ ...font.bold ? { labelWeight: "bold" } : {},
1379
+ ...font.italic ? { labelItalic: true } : {}
1380
+ };
1381
+ }
1382
+ function labelOutline(out, target, colors, sizes, preview) {
1383
+ const size = preview.num(`${target}.label.outline.size`);
1384
+ if (size <= 0) {
1385
+ return;
1386
+ }
1387
+ const mode = preview.text(`${target}.label.outline.color`);
1388
+ perElementDefault(
1389
+ out,
1390
+ target,
1391
+ ["labelOutlineWidth", "preview-outline-width"],
1392
+ sizes.map((s) => size / 32 * s),
1393
+ "LABEL_OUTLINE"
1394
+ );
1395
+ perElementDefault(
1396
+ out,
1397
+ target,
1398
+ ["labelOutlineColor", "preview-outline-color"],
1399
+ colors.map((c) => hexOf(dependantColor(mode, c) ?? [255, 255, 255])),
1400
+ "LABEL_OUTLINE"
1401
+ );
1402
+ everyElement(out, target, "preview-outline", {
1403
+ labelOutlineOpacity: gephiAlpha(preview.num(`${target}.label.outline.opacity`))
1404
+ });
1405
+ }
1406
+ function gephiOverlapHidden(snapshot, labels, widths, preview) {
1407
+ const centers = gephiCenters(snapshot);
1408
+ if (centers.includes(null)) {
1409
+ return null;
1410
+ }
1411
+ const f = Math.fround;
1412
+ const grid = preview.num("node.label.overlapGridSize");
1413
+ const proportional = preview.on("node.label.proportinalSize");
1414
+ const base = f(preview.font("node").size * preview.num("node.label.scale"));
1415
+ const nodeSizes = centers.map((_, i) => {
1416
+ const w = widths?.[i];
1417
+ return f((typeof w === "number" ? w : GEPHI_NODE_WIDTH) / 2);
1418
+ });
1419
+ const sizes = nodeSizes.map(
1420
+ (nodeSize) => proportional ? f(f(base * nodeSize) * f(0.05)) : f(base * f(1 + f(nodeSize * f(1e-5))))
1421
+ );
1422
+ const items = sizes.map((_, i) => i).sort((a, b) => nodeSizes[b] - nodeSizes[a]);
1423
+ const cached = /* @__PURE__ */ new Map();
1424
+ items.forEach((i) => cached.set(Math.round(sizes[i]), sizes[i]));
1425
+ const at = centers.map((c) => [c?.[0] ?? 0, -(c?.[1] ?? 0)]);
1426
+ let [loX, loY, hiX, hiY] = [Infinity, Infinity, -Infinity, -Infinity];
1427
+ for (const [x, y] of at) {
1428
+ [loX, loY, hiX, hiY] = [Math.min(loX, x), Math.min(loY, y), Math.max(hiX, x), Math.max(hiY, y)];
1429
+ }
1430
+ const [minX, minY] = [loX - grid, loY - grid];
1431
+ const cols = Math.ceil((hiX + grid - minX) / grid);
1432
+ const rows = Math.ceil((hiY + grid - minY) / grid);
1433
+ const taken = /* @__PURE__ */ new Set();
1434
+ const hidden = labels.map(() => false);
1435
+ const order = [...items].sort((a, b) => sizes[b] - sizes[a]);
1436
+ for (const i of order) {
1437
+ const label = labels[i];
1438
+ if (typeof label !== "string" || label.trim() === "") {
1439
+ continue;
1440
+ }
1441
+ const size = cached.get(Math.round(sizes[i])) ?? sizes[i];
1442
+ const half = [dialogWidth(label) * size / 2, DIALOG_LINE_HEIGHT * size / 2];
1443
+ const cells = gridCells(
1444
+ { min: [minX, minY], size: grid, cols, rows },
1445
+ [at[i][0] - half[0], at[i][1] - half[1]],
1446
+ [at[i][0] + half[0], at[i][1] + half[1]]
1447
+ );
1448
+ if (cells.some((k) => taken.has(k))) {
1449
+ hidden[i] = true;
1450
+ } else {
1451
+ cells.forEach((k) => taken.add(k));
1452
+ }
1453
+ }
1454
+ return hidden;
1455
+ }
1456
+ function gridCells(grid, lo, hi) {
1457
+ const cell = (v, axis) => Math.min((axis === 0 ? grid.cols : grid.rows) - 1, Math.max(0, Math.trunc((v - grid.min[axis]) / grid.size)));
1458
+ const cells = [];
1459
+ for (let r = cell(lo[1], 1); r <= cell(hi[1], 1); r++) {
1460
+ for (let c = cell(lo[0], 0); c <= cell(hi[0], 0); c++) {
1461
+ cells.push(r * grid.cols + c);
1462
+ }
1463
+ }
1464
+ return cells;
1465
+ }
1466
+ const GEPHI_ARC_CURVENESS = 1.2;
1467
+ function gephiCenters(snapshot) {
1468
+ const position = snapshot.nodes.byRole("position");
1469
+ return Array.from({ length: snapshot.nodeCount }, (_, i) => {
1470
+ const v = position?.isSet(i) === true ? position.value(i) : null;
1471
+ return v === null ? null : [v[0] || 0, v[1] || 0];
1472
+ });
1473
+ }
1474
+ function swallowedEdges(snapshot, nodes, directed, thickness, preview) {
1475
+ const centers = gephiCenters(snapshot);
1476
+ const edgeRadius = preview.num("edge.radius");
1477
+ const arrowSize = preview.num("arrow.size");
1478
+ const arc = 2 * Math.asin(Math.min(1, GEPHI_ARC_CURVENESS / 2));
1479
+ return Array.from({ length: snapshot.edgeCount }, (_, e) => {
1480
+ const [a, b] = [snapshot.edgeSource(e), snapshot.edgeTarget(e)];
1481
+ const [pa, pb] = [centers[a], centers[b]];
1482
+ if (a === b || pa === null || pb === null) {
1483
+ return null;
1484
+ }
1485
+ const d = Math.hypot(pb[0] - pa[0], pb[1] - pa[1]);
1486
+ if (d === 0) {
1487
+ return "all";
1488
+ }
1489
+ const r = d / GEPHI_ARC_CURVENESS;
1490
+ const cut = (c) => c >= r * arc ? Infinity : 2 * Math.atan2(c / 2, Math.sqrt(r * r - c / 2 * (c / 2)));
1491
+ const source = edgeRadius + nodeWidth(nodes, a) / 2;
1492
+ const target = edgeRadius + nodeWidth(nodes, b) / 2 + (directed[e] ? arrowSize * thickness[e] : 0);
1493
+ return cut(source) + cut(target) >= arc ? "line" : null;
1494
+ });
1495
+ }
1496
+ const SELF_LOOP_STEPS = 96;
1497
+ function selfLoopBends(snapshot, thickness, hidden) {
1498
+ const sizes = vizColumn(snapshot, "node", "size");
1499
+ const sizeOf = (n) => {
1500
+ const v = sizes === null ? null : Number(plainCell(snapshot.nodes.value(sizes, n)));
1501
+ return v !== null && Number.isFinite(v) && v > 0 ? v : GEPHI_NODE_WIDTH / 2;
1502
+ };
1503
+ const fraction = (v) => String(Math.round(v * 1e4) / 1e4);
1504
+ return Array.from({ length: snapshot.edgeCount }, (_, e) => {
1505
+ const n = snapshot.edgeSource(e);
1506
+ if (n !== snapshot.edgeTarget(e) || hidden[e]) {
1507
+ return null;
1508
+ }
1509
+ const size = sizeOf(n);
1510
+ const r = (0.5 * size + 0.33 * SELF_LOOP_THICKNESS * thickness[e]) / size;
1511
+ const points = [];
1512
+ for (let k = 0; k <= SELF_LOOP_STEPS; k++) {
1513
+ const a = 5 * Math.PI / 4 - 2 * Math.PI * k / SELF_LOOP_STEPS;
1514
+ points.push(`${fraction(r + r * Math.cos(a))},${fraction(r + r * Math.sin(a))}`);
1515
+ }
1516
+ return points.join(" ");
1517
+ });
1518
+ }
1519
+ function edgeRules(edge, snapshot, channels, nodes, edges, gexf, preview) {
1520
+ const drawn = gephiEdges(snapshot, gexf !== void 0);
1521
+ const arrowSize = preview.num("arrow.size");
1522
+ if (drawn.directed.some(Boolean) && arrowSize > 0) {
1523
+ edge.columns.set(
1524
+ DIRECTED_KEY,
1525
+ drawn.directed.map((d) => d ? true : null)
1526
+ );
1527
+ edge.rules.push({
1528
+ id: "edge.tool.arrow",
1529
+ target: "edge",
1530
+ role: "group",
1531
+ origin: "tool",
1532
+ where: { has: { style: DIRECTED_KEY } },
1533
+ set: { targetArrow: "triangle", ...arrowSize === 3 ? {} : { arrowSize: arrowSize / 3 } }
1534
+ });
1535
+ }
1536
+ const hidden = preview.on("edge.show") ? drawn.hidden : drawn.hidden.map(() => true);
1537
+ const thickness = edgeThickness(
1538
+ drawn.weight,
1539
+ hidden.map((h) => !h),
1540
+ preview
1541
+ );
1542
+ perElementDefault(
1543
+ edge,
1544
+ "edge",
1545
+ WEIGHT_WIDTH,
1546
+ // Gephi's self-loop is 1.3 times as thick (measured: weight 1 draws 1.3, 3.25 draws 4.225)
1547
+ withoutOwn(
1548
+ edges.width,
1549
+ snapshot.edgeCount,
1550
+ (e) => snapshot.edgeSource(e) === snapshot.edgeTarget(e) ? SELF_LOOP_THICKNESS * thickness[e] : thickness[e]
1551
+ ),
1552
+ "EDGE_WEIGHT"
1553
+ );
1554
+ perElementDefault(edge, "edge", ["bends", "self-loop"], selfLoopBends(snapshot, thickness, hidden), "NODE_SIZE");
1555
+ const swallowed = preview.on("edge.curved") ? swallowedEdges(snapshot, nodes, drawn.directed, thickness, preview) : hidden.map(() => null);
1556
+ hidden.forEach((h, e) => {
1557
+ const arrow = drawn.directed[e] && arrowSize > 0 && swallowed[e] === "line";
1558
+ hidden[e] = h || swallowed[e] !== null && !arrow;
1559
+ });
1560
+ if (hidden.some(Boolean)) {
1561
+ edge.columns.set(
1562
+ HIDDEN_KEY,
1563
+ hidden.map((h) => h ? true : null)
1564
+ );
1565
+ edge.rules.push({
1566
+ id: "edge.tool.gephi-hidden",
1567
+ target: "edge",
1568
+ role: "group",
1569
+ origin: "tool",
1570
+ where: { has: { style: HIDDEN_KEY } },
1571
+ set: { visible: false }
1572
+ });
1573
+ }
1574
+ const colors = edgeColors(snapshot, channels, gexf, preview);
1575
+ perElementDefault(
1576
+ edge,
1577
+ "edge",
1578
+ ["color", MIXED_COLOR_KEY],
1579
+ withoutOwn(edges.color, snapshot.edgeCount, (e) => hexOf(colors[e])),
1580
+ "END_NODE_COLORS"
1581
+ );
1582
+ perElementDefault(
1583
+ edge,
1584
+ "edge",
1585
+ ["opacity", "end-opacity"],
1586
+ withoutOwn(edges.color, snapshot.edgeCount, (e) => colors[e][3] / 255).map((v, e) => {
1587
+ if (swallowed[e] !== null && !hidden[e]) {
1588
+ return 0;
1589
+ }
1590
+ return v === 1 ? null : v;
1591
+ }),
1592
+ "END_NODE_COLORS"
1593
+ );
1594
+ everyElement(edge, "edge", "preview-curve", preview.on("edge.curved") ? {} : { curved: false });
1595
+ const nodeGap = preview.num("edge.radius");
1596
+ everyElement(edge, "edge", "preview-radius", nodeGap > 0 ? { nodeGap } : {});
1597
+ edgeLabelRules(edge, colors, gexf, preview);
1598
+ }
1599
+ function edgeColors(snapshot, channels, gexf, preview) {
1600
+ const mode = preview.text("edge.color");
1601
+ const factor = preview.num("edge.opacity") / 100;
1602
+ const own = (e) => {
1603
+ const c = gexf?.original?.color?.[e];
1604
+ const a = gexf?.original?.opacity?.[e];
1605
+ return nodeChannels(typeof c === "string" ? c : GEPHI_NODE_FILL, typeof a === "number" ? a : null);
1606
+ };
1607
+ const custom = dependantColor(mode, [0, 0, 0]);
1608
+ return Array.from({ length: snapshot.edgeCount }, (_, e) => {
1609
+ const s = channels[snapshot.edgeSource(e)];
1610
+ const t = channels[snapshot.edgeTarget(e)];
1611
+ let c;
1612
+ if (mode === "source") {
1613
+ c = [...s];
1614
+ } else if (mode === "target") {
1615
+ c = [...t];
1616
+ } else if (mode === "original") {
1617
+ c = own(e);
1618
+ } else if (mode.startsWith("#") && custom !== null) {
1619
+ c = [...custom, 255];
1620
+ } else {
1621
+ c = s.map((v, k) => Math.floor((v + t[k]) / 2));
1622
+ }
1623
+ return factor === 1 ? c : [c[0], c[1], c[2], c[3] * factor];
1624
+ });
1625
+ }
1626
+ function edgeLabelRules(edge, colors, gexf, preview) {
1627
+ if (gexf?.edgeLabels === void 0 || !preview.on("edge.label.show")) {
1628
+ return;
1629
+ }
1630
+ const font = preview.font("edge");
1631
+ const color = preview.text("edge.label.color");
1632
+ if (color !== "original") {
1633
+ perElementDefault(
1634
+ edge,
1635
+ "edge",
1636
+ ["labelColor", "preview-label-color"],
1637
+ colors.map((c) => hexOf(dependantColor(color, c) ?? [0, 0, 0])),
1638
+ "EDGE_LABEL_COLOR"
1639
+ );
1640
+ }
1641
+ labelOutline(
1642
+ edge,
1643
+ "edge",
1644
+ colors,
1645
+ colors.map(() => font.size),
1646
+ preview
1647
+ );
1648
+ everyElement(edge, "edge", "preview-label", {
1649
+ labelSize: font.size,
1650
+ labelPosition: "center",
1651
+ ...fontValues(font, preview.on("edge.label.customFont"))
1652
+ });
1653
+ }
1654
+ function gephiMix(a, b) {
1655
+ const x = Number.parseInt(a.slice(1), 16);
1656
+ const y = Number.parseInt(b.slice(1), 16);
1657
+ let out = 0;
1658
+ for (const shift of [16, 8, 0]) {
1659
+ out |= Math.floor(((x >> shift & 255) + (y >> shift & 255)) / 2) << shift;
1660
+ }
1661
+ return `#${out.toString(16).padStart(6, "0")}`;
1662
+ }
1663
+ function firstHalf(snapshot) {
1664
+ const pair = snapshot.edges.byRole("pair");
1665
+ return (e) => pair?.isSet(e) === true ? Math.min(e, pair.value(e)) : e;
1666
+ }
1667
+ function withoutOwn(own, count, value) {
1668
+ const out = new Array(count).fill(null);
1669
+ for (let e = 0; e < count; e++) {
1670
+ if (own?.[e] === null || own === void 0) {
1671
+ out[e] = value(e);
1672
+ }
1673
+ }
1674
+ return out;
1675
+ }
1676
+ function gexfStyles(snapshot, context) {
1677
+ const notes = new StyleNotes();
1678
+ const node = vizValues(snapshot, "node", notes, context);
1679
+ const edge = vizValues(snapshot, "edge", notes, context);
1680
+ const { block, preview } = keptOf(context.kept);
1681
+ const nodeOpacity = node.fillOpacity;
1682
+ const original = { color: edge.color, opacity: edge.opacity };
1683
+ if (block === null) {
1684
+ withoutUndrawn(node, edge);
1685
+ } else {
1686
+ exactFromBlock(snapshot, block, node, edge);
1687
+ }
1688
+ const labels = drawnLabels(node.label, preview, "node", block !== null);
1689
+ const overlapHidden = block === null && labels !== void 0 && preview.on("node.label.avoidOverlap") ? gephiOverlapHidden(snapshot, labels, node.width, preview) : null;
1690
+ overlapHidden?.forEach((hide, i) => {
1691
+ if (hide && labels !== void 0) {
1692
+ labels[i] = null;
1693
+ }
1694
+ });
1695
+ if (labels === void 0) {
1696
+ delete node.label;
1697
+ } else {
1698
+ node.label = labels;
1699
+ }
1700
+ const edgeLabels = drawnLabels(edgeLabelValues(snapshot), preview, "edge", block !== null);
1701
+ if (edgeLabels !== void 0) {
1702
+ edge.label = edgeLabels;
1703
+ }
1704
+ const rules = gephiRules(
1705
+ snapshot,
1706
+ { fill: node.fill, fillOpacity: nodeOpacity, width: node.width },
1707
+ { color: edge.color, width: edge.width },
1708
+ context.budget,
1709
+ { preview, original, edgeLabels, overlapSettled: overlapHidden !== null }
1710
+ );
1711
+ return {
1712
+ canonical: true,
1713
+ dialect: "gexf",
1714
+ tool: "gephi",
1715
+ units: "relative",
1716
+ node: { values: node, ...rules.node },
1717
+ edge: { values: edge, ...rules.edge },
1718
+ notes: notes.list(),
1719
+ opacityInColor: true,
1720
+ block,
1721
+ readFrom: {
1722
+ node: VIZ_COLUMNS.node.filter((name) => vizColumn(snapshot, "node", name) !== null),
1723
+ edge: VIZ_COLUMNS.edge.filter((name) => vizColumn(snapshot, "edge", name) !== null)
1724
+ }
1725
+ };
1726
+ }
1727
+ function keptOf(kept) {
1728
+ if (typeof kept === "string") {
1729
+ return { block: kept, preview: new GephiPreview() };
1730
+ }
1731
+ if (typeof kept === "object" && kept !== null) {
1732
+ const { block, gephiPreview } = kept;
1733
+ return { block: typeof block === "string" ? block : null, preview: new GephiPreview(gephiPreview) };
1734
+ }
1735
+ return { block: null, preview: new GephiPreview() };
1736
+ }
1737
+ function edgeLabelValues(snapshot) {
1738
+ const col = snapshot.edges.byRole("label");
1739
+ if (col === null) {
1740
+ return void 0;
1741
+ }
1742
+ return Array.from({ length: snapshot.edgeCount }, (_, e) => {
1743
+ const v = plainCell(col.value(e));
1744
+ return typeof v === "string" && v.length > 0 ? v : null;
1745
+ });
1746
+ }
1747
+ function withoutUndrawn(node, edge) {
1748
+ delete node.shape;
1749
+ delete node.image;
1750
+ delete node.fillOpacity;
1751
+ delete edge.color;
1752
+ delete edge.opacity;
1753
+ delete edge.width;
1754
+ delete edge.lineStyle;
1755
+ }
1756
+ function exactFromBlock(snapshot, text, node, edge) {
1757
+ const shapeRead = /* @__PURE__ */ new Map([
1758
+ ["disc", "ellipse"],
1759
+ ["square", "rectangle"]
1760
+ ]);
1761
+ const size = (want) => {
1762
+ const w = want("width");
1763
+ const h = want("height");
1764
+ return typeof w === "number" && typeof h === "number" ? Math.max(w, h) : w ?? h;
1765
+ };
1766
+ const written = {
1767
+ shape: (want) => {
1768
+ const { value } = gexfNodeShape(String(want("shape")));
1769
+ return shapeRead.get(value) ?? value;
1770
+ },
1771
+ width: size,
1772
+ height: size,
1773
+ lineStyle: (want) => gexfEdgeShape(String(want("lineStyle"))).value
1774
+ };
1775
+ takeFromBlock(snapshot, text, "gexf", (target) => ({
1776
+ values: target === "node" ? node : edge,
1777
+ properties: target === "node" ? ["shape", "width", "height"] : ["lineStyle"],
1778
+ readBack: (_i, want) => (property) => written[property](want),
1779
+ // a size is written from the width and the height together: one the block leaves unset reads back too
1780
+ take: (property, wanted, native) => native !== null && (wanted !== null || property === "width" || property === "height")
1781
+ }));
1782
+ }
1783
+ function tagDtype(col) {
1784
+ const kinds = new Set(col.filter((v) => v !== null).map((v) => typeof v));
1785
+ if (kinds.size === 1 && kinds.has("number")) {
1786
+ return "f64";
1787
+ }
1788
+ return kinds.size === 1 && kinds.has("boolean") ? "bool" : "string";
1789
+ }
1790
+ function gexfStyledExport(snapshot, input) {
1791
+ if (input === void 0) {
1792
+ return null;
1793
+ }
1794
+ const p = (target, property) => input.picture(target, property);
1795
+ const fill = p("node", "fill");
1796
+ const fillOpacity = p("node", "fillOpacity");
1797
+ const image = p("node", "image");
1798
+ const color = p("edge", "color");
1799
+ const opacity = p("edge", "opacity");
1800
+ const thickness = p("edge", "width");
1801
+ const height = p("node", "height");
1802
+ const approximated = new StyleApproximations();
1803
+ const nodeShapes = p("node", "shape").map((s, i) => gexfShapeOf(s, typeof image[i] === "string", approximated));
1804
+ const nodeSizes = p("node", "width").map((w, i) => gexfSizeOf(w, height[i], approximated));
1805
+ const edgeShapes = p("edge", "lineStyle").map((s) => gexfLineOf(s, approximated));
1806
+ return {
1807
+ snapshot: withTagColumns(snapshot, input),
1808
+ blockElement: `<graphty:styles xmlns:graphty="${GRAPHTY_XML_NAMESPACE}" name="${STYLE_BLOCK_NAME}">${escapeXml(input.block)}</graphty:styles>`,
1809
+ notes: approximated.notes("GEXF"),
1810
+ node(i, indent) {
1811
+ const size = nodeSizes[i];
1812
+ const s = nodeShapes[i];
1813
+ return colorElement(fill[i], fillOpacity[i], indent) + (size === null ? "" : `${indent}<viz:size value="${String(size / 2)}"/>
1814
+ `) + shapeElement(s, s === "image" ? String(image[i]) : null, indent);
1815
+ },
1816
+ edge(e, indent) {
1817
+ const w = thickness[e];
1818
+ const c = color[e];
1819
+ const end = (i) => String(fill[i] ?? GEPHI_NODE_FILL);
1820
+ const mixed = typeof c === "string" && c === gephiMix(end(snapshot.edgeSource(e)), end(snapshot.edgeTarget(e)));
1821
+ return (mixed && (opacity[e] ?? 1) === 1 ? "" : colorElement(c, opacity[e], indent)) + (typeof w === "number" ? `${indent}<viz:thickness value="${String(w)}"/>
1822
+ ` : "") + shapeElement(edgeShapes[e], null, indent);
1823
+ }
1824
+ };
1825
+ }
1826
+ function withTagColumns(snapshot, input) {
1827
+ const out = snapshot.withColumns();
1828
+ for (const target of ["node", "edge"]) {
1829
+ const table = target === "node" ? out.nodes : out.edges;
1830
+ for (const name of VIZ_COLUMNS[target]) {
1831
+ if (table.get(name)?.meta.origin?.namespace === VIZ_NAMESPACE) {
1832
+ table.remove(name);
1833
+ }
1834
+ }
1835
+ for (const [name, col] of input.tags[target]) {
1836
+ const dtype = tagDtype(col);
1837
+ table.set(name, dtype === "string" ? col.map((v) => v === null ? null : String(v)) : col, { dtype });
1838
+ }
1839
+ }
1840
+ const label = input.picture("node", "label").map((v) => typeof v === "string" ? v : null);
1841
+ out.nodes.set(LABEL_COLUMN, label, { dtype: "string", role: "label" }, { replaceRole: true });
1842
+ return out;
1843
+ }
1844
+ function gexfShapeOf(s, pictured, approximated) {
1845
+ if (pictured) {
1846
+ if (typeof s === "string" && s !== "other:image") {
1847
+ approximated.add("node", "shape", s);
1848
+ }
1849
+ return "image";
1850
+ }
1851
+ if (typeof s !== "string") {
1852
+ return null;
1853
+ }
1854
+ const g = gexfNodeShape(s);
1855
+ if (!g.exact) {
1856
+ approximated.add("node", "shape", s);
1857
+ }
1858
+ return g.value;
1859
+ }
1860
+ function gexfLineOf(s, approximated) {
1861
+ if (typeof s !== "string") {
1862
+ return null;
1863
+ }
1864
+ const g = gexfEdgeShape(s);
1865
+ if (!g.exact) {
1866
+ approximated.add("edge", "lineStyle", s);
1867
+ }
1868
+ return g.value;
1869
+ }
1870
+ function gexfSizeOf(w, h, approximated) {
1871
+ if (typeof w === "number" && typeof h === "number" && w !== h) {
1872
+ approximated.add("node", w > h ? "height" : "width", `${String(w)} x ${String(h)}`);
1873
+ return Math.max(w, h);
1874
+ }
1875
+ if (typeof w === "number") {
1876
+ return w;
1877
+ }
1878
+ return typeof h === "number" ? h : null;
1879
+ }
1880
+ function colorElement(hex, alpha, indent) {
1881
+ if (typeof hex !== "string") {
1882
+ return "";
1883
+ }
1884
+ const n = Number.parseInt(hex.slice(1), 16);
1885
+ const a = typeof alpha === "number" && alpha !== 1 ? ` a="${String(alpha)}"` : "";
1886
+ return `${indent}<viz:color r="${String(n >> 16 & 255)}" g="${String(n >> 8 & 255)}" b="${String(n & 255)}"${a}/>
1887
+ `;
1888
+ }
1889
+ function shapeElement(shape, uri, indent) {
1890
+ if (shape === null) {
1891
+ return "";
1892
+ }
1893
+ return uri === null ? `${indent}<viz:shape value="${shape}"/>
1894
+ ` : `${indent}<viz:shape value="${shape}" uri="${escapeXml(uri)}"/>
1895
+ `;
1896
+ }
1897
+ function escapeXml(text) {
1898
+ return text.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
1899
+ }
1900
+ export {
1901
+ EDGE_DECLS as E,
1902
+ GEXF_FORMAT as G,
1903
+ NODE_DECLS as N,
1904
+ OPEN_START as O,
1905
+ RESERVED_NODE_NAMES as R,
1906
+ TIME_FORMATS as T,
1907
+ VIZ_NAMESPACE as V,
1908
+ GRAPHTY_XML_NAMESPACE as a,
1909
+ GRAPH_MODES as b,
1910
+ TIME_REPRESENTATIONS as c,
1911
+ temporalTableDecls as d,
1912
+ canonVizColor as e,
1913
+ OPEN_END as f,
1914
+ gexfStyles as g,
1915
+ RESERVED_EDGE_NAMES as h,
1916
+ gexfStyledExport as i,
1917
+ GEXF_STYLE_CAPABILITIES as j,
1918
+ GEXF_NAMESPACES as k,
1919
+ TEMPORAL_COLUMNS as l,
1920
+ NODE_COLUMNS as m,
1921
+ isListType as n,
1922
+ canonicalScalarType as o,
1923
+ parseTemporalTableName as p,
1924
+ isScalarType as q,
1925
+ gephiRules as r,
1926
+ temporalTableName as t
1927
+ };
1928
+ //# sourceMappingURL=styles-CPczw1Jz.js.map