@graphty/graph-io 0.3.46 → 0.3.48
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.
- package/dist/chunks/{approximations-wWjCRzKj.js → approximations-C2riR4NT.js} +2 -2
- package/dist/chunks/{approximations-wWjCRzKj.js.map → approximations-C2riR4NT.js.map} +1 -1
- package/dist/chunks/{block-DiGq58c3.js → block-Cu22ewuS.js} +92 -21
- package/dist/chunks/block-Cu22ewuS.js.map +1 -0
- package/dist/chunks/{choose--jM0yYCo.js → choose-Cdx6Enl2.js} +3 -3
- package/dist/chunks/{choose--jM0yYCo.js.map → choose-Cdx6Enl2.js.map} +1 -1
- package/dist/chunks/codes-CV_Bhcyi.js +153 -0
- package/dist/chunks/codes-CV_Bhcyi.js.map +1 -0
- package/dist/chunks/{constants-BKwqelYD.js → constants-D0LqcsLJ.js} +2 -2
- package/dist/chunks/{constants-BKwqelYD.js.map → constants-D0LqcsLJ.js.map} +1 -1
- package/dist/chunks/context-cgmmOxZ2.js +663 -0
- package/dist/chunks/context-cgmmOxZ2.js.map +1 -0
- package/dist/chunks/credentials-BiQsnMTb.js +347 -0
- package/dist/chunks/credentials-BiQsnMTb.js.map +1 -0
- package/dist/chunks/cx-export-BEeF6ymo.js +259 -0
- package/dist/chunks/cx-export-BEeF6ymo.js.map +1 -0
- package/dist/chunks/descriptor-BJ-W0Jd-.js +137 -0
- package/dist/chunks/descriptor-BJ-W0Jd-.js.map +1 -0
- package/dist/chunks/descriptor-C-YDhtsn.js +48 -0
- package/dist/chunks/descriptor-C-YDhtsn.js.map +1 -0
- package/dist/chunks/{emit-CwU8cUmG.js → emit-CD8xnY8s.js} +70 -10
- package/dist/chunks/emit-CD8xnY8s.js.map +1 -0
- package/dist/chunks/{escape-CgzxiYPg.js → escape-DH2Egt-l.js} +12 -12
- package/dist/chunks/{escape-CgzxiYPg.js.map → escape-DH2Egt-l.js.map} +1 -1
- package/dist/chunks/{export-BvqAXCKh.js → export-CZ7VRm4I.js} +53 -1443
- package/dist/chunks/export-CZ7VRm4I.js.map +1 -0
- package/dist/chunks/{exporter-DndFlGSa.js → exporter-BIdaoIgh.js} +7 -6
- package/dist/chunks/{exporter-DndFlGSa.js.map → exporter-BIdaoIgh.js.map} +1 -1
- package/dist/chunks/{exporter-CJgfhF-l.js → exporter-ChjL5fmP.js} +8 -7
- package/dist/chunks/{exporter-CJgfhF-l.js.map → exporter-ChjL5fmP.js.map} +1 -1
- package/dist/chunks/{exporter--Mk9gXCJ.js → exporter-Dcw7Ldtq.js} +6 -4
- package/dist/chunks/{exporter--Mk9gXCJ.js.map → exporter-Dcw7Ldtq.js.map} +1 -1
- package/dist/chunks/exporter-DtVU80Fa.js +1008 -0
- package/dist/chunks/exporter-DtVU80Fa.js.map +1 -0
- package/dist/chunks/{exporter-CrDWIyiq.js → exporter-bxxjOrDZ.js} +11 -9
- package/dist/chunks/{exporter-CrDWIyiq.js.map → exporter-bxxjOrDZ.js.map} +1 -1
- package/dist/chunks/format-BMS-1Nxb.js +64 -0
- package/dist/chunks/format-BMS-1Nxb.js.map +1 -0
- package/dist/chunks/{generic-Dq1ntt9q.js → generic-CP6YD34u.js} +4 -4
- package/dist/chunks/{generic-Dq1ntt9q.js.map → generic-CP6YD34u.js.map} +1 -1
- package/dist/chunks/{importer-DiZRmOQG.js → importer-B87_fmVx.js} +13 -17
- package/dist/chunks/importer-B87_fmVx.js.map +1 -0
- package/dist/chunks/{importer-BSvfrX_h.js → importer-Bji2MeWr.js} +18 -1014
- package/dist/chunks/importer-Bji2MeWr.js.map +1 -0
- package/dist/chunks/{importer-COTK9Tsl.js → importer-CB_zV5_L.js} +14 -11
- package/dist/chunks/importer-CB_zV5_L.js.map +1 -0
- package/dist/chunks/{importer-e6LGpqHB.js → importer-CVT-JyDE.js} +12 -9
- package/dist/chunks/importer-CVT-JyDE.js.map +1 -0
- package/dist/chunks/{importer-yh_aBCU6.js → importer-Cyy6UseH.js} +7 -6
- package/dist/chunks/{importer-yh_aBCU6.js.map → importer-Cyy6UseH.js.map} +1 -1
- package/dist/chunks/{importer-iFYPEKaJ.js → importer-DPZDN40-.js} +14 -10
- package/dist/chunks/{importer-iFYPEKaJ.js.map → importer-DPZDN40-.js.map} +1 -1
- package/dist/chunks/{importer-CMmeMWlC.js → importer-e3huMZbm.js} +8 -260
- package/dist/chunks/importer-e3huMZbm.js.map +1 -0
- package/dist/chunks/input-Ccg9I22A.js +1397 -0
- package/dist/chunks/input-Ccg9I22A.js.map +1 -0
- package/dist/chunks/{json-elements-DJZRZ6jd.js → json-elements-By172SVq.js} +4 -4
- package/dist/chunks/{json-elements-DJZRZ6jd.js.map → json-elements-By172SVq.js.map} +1 -1
- package/dist/chunks/{lexicon-CT69Kd87.js → lexicon-u2SI5xcx.js} +19 -5
- package/dist/chunks/lexicon-u2SI5xcx.js.map +1 -0
- package/dist/chunks/{ontology-export-G4MqRdux.js → ontology-export-BwgMyuF0.js} +4 -3
- package/dist/chunks/{ontology-export-G4MqRdux.js.map → ontology-export-BwgMyuF0.js.map} +1 -1
- package/dist/chunks/{records-CiaWZrFH.js → records-Cgvxz-Vx.js} +2 -2
- package/dist/chunks/{records-CiaWZrFH.js.map → records-Cgvxz-Vx.js.map} +1 -1
- package/dist/chunks/{format-BpQBx8MZ.js → report-CgdsL9Hb.js} +72 -129
- package/dist/chunks/report-CgdsL9Hb.js.map +1 -0
- package/dist/chunks/sigv4-LkAzsLAu.js +247 -0
- package/dist/chunks/sigv4-LkAzsLAu.js.map +1 -0
- package/dist/chunks/{styles-BQnsga7p.js → styles-CaABMoO1.js} +76 -43
- package/dist/chunks/styles-CaABMoO1.js.map +1 -0
- package/dist/chunks/{styles-D3fRphrO.js → styles-P_gmFAOi.js} +101 -21
- package/dist/chunks/styles-P_gmFAOi.js.map +1 -0
- package/dist/chunks/{styles-yed-BF5x3_Y5.js → styles-yed-Cs1nmrjn.js} +60 -20
- package/dist/chunks/styles-yed-Cs1nmrjn.js.map +1 -0
- package/dist/chunks/{text-CzJNFOS9.js → text-BuKQVMz2.js} +2 -2
- package/dist/chunks/{text-CzJNFOS9.js.map → text-BuKQVMz2.js.map} +1 -1
- package/dist/chunks/{writer-DMKvthQE.js → writer-DvHTl36J.js} +5 -4
- package/dist/chunks/writer-DvHTl36J.js.map +1 -0
- package/dist/csv.js +7 -5
- package/dist/csv.js.map +1 -1
- package/dist/cx.js +5 -4
- package/dist/cx.js.map +1 -1
- package/dist/cx2.js +2 -2
- package/dist/cys.js +1 -1
- package/dist/dot.js +2 -2
- package/dist/gexf.js +7 -5
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +16 -13
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +1181 -224
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +3 -3
- package/dist/json.js +1 -1
- package/dist/neo4j.js +6 -4
- package/dist/neo4j.js.map +1 -1
- package/dist/obo.js +1 -1
- package/dist/pajek.js +1 -1
- package/dist/sources-cypher.d.ts +1 -0
- package/dist/sources-cypher.js +1236 -0
- package/dist/sources-cypher.js.map +1 -0
- package/dist/sources-ndex.d.ts +1 -0
- package/dist/sources-ndex.js +278 -0
- package/dist/sources-ndex.js.map +1 -0
- package/dist/sources-rest.d.ts +1 -0
- package/dist/sources-rest.js +1367 -0
- package/dist/sources-rest.js.map +1 -0
- package/dist/src/common/report.d.ts +6 -3
- package/dist/src/common/report.d.ts.map +1 -1
- package/dist/src/common/report.js +15 -9
- package/dist/src/common/report.js.map +1 -1
- package/dist/src/formats/cx/styles.d.ts.map +1 -1
- package/dist/src/formats/cx/styles.js +1 -0
- package/dist/src/formats/cx/styles.js.map +1 -1
- package/dist/src/formats/dot/styles.d.ts.map +1 -1
- package/dist/src/formats/dot/styles.js +3 -1
- package/dist/src/formats/dot/styles.js.map +1 -1
- package/dist/src/formats/gexf/styles.d.ts +29 -12
- package/dist/src/formats/gexf/styles.d.ts.map +1 -1
- package/dist/src/formats/gexf/styles.js +160 -31
- package/dist/src/formats/gexf/styles.js.map +1 -1
- package/dist/src/formats/gml/styles.d.ts.map +1 -1
- package/dist/src/formats/gml/styles.js +5 -4
- package/dist/src/formats/gml/styles.js.map +1 -1
- package/dist/src/formats/graphml/styles-plain.d.ts.map +1 -1
- package/dist/src/formats/graphml/styles-plain.js +3 -3
- package/dist/src/formats/graphml/styles-plain.js.map +1 -1
- package/dist/src/formats/graphml/styles-yed.d.ts.map +1 -1
- package/dist/src/formats/graphml/styles-yed.js +89 -19
- package/dist/src/formats/graphml/styles-yed.js.map +1 -1
- package/dist/src/formats/pajek/styles.d.ts.map +1 -1
- package/dist/src/formats/pajek/styles.js +1 -0
- package/dist/src/formats/pajek/styles.js.map +1 -1
- package/dist/src/formats/xgmml/styles.d.ts.map +1 -1
- package/dist/src/formats/xgmml/styles.js +1 -0
- package/dist/src/formats/xgmml/styles.js.map +1 -1
- package/dist/src/index.d.ts +8 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/registry.d.ts +173 -1
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +196 -1
- package/dist/src/registry.js.map +1 -1
- package/dist/src/sources/builtins.d.ts +11 -0
- package/dist/src/sources/builtins.d.ts.map +1 -0
- package/dist/src/sources/builtins.js +47 -0
- package/dist/src/sources/builtins.js.map +1 -0
- package/dist/src/sources/codes.d.ts +230 -0
- package/dist/src/sources/codes.d.ts.map +1 -0
- package/dist/src/sources/codes.js +58 -0
- package/dist/src/sources/codes.js.map +1 -0
- package/dist/src/sources/context.d.ts +112 -0
- package/dist/src/sources/context.d.ts.map +1 -0
- package/dist/src/sources/context.js +739 -0
- package/dist/src/sources/context.js.map +1 -0
- package/dist/src/sources/credentials.d.ts +179 -0
- package/dist/src/sources/credentials.d.ts.map +1 -0
- package/dist/src/sources/credentials.js +301 -0
- package/dist/src/sources/credentials.js.map +1 -0
- package/dist/src/sources/cypher/descriptor.d.ts +21 -0
- package/dist/src/sources/cypher/descriptor.d.ts.map +1 -0
- package/dist/src/sources/cypher/descriptor.js +119 -0
- package/dist/src/sources/cypher/descriptor.js.map +1 -0
- package/dist/src/sources/cypher/flatten.d.ts +72 -0
- package/dist/src/sources/cypher/flatten.d.ts.map +1 -0
- package/dist/src/sources/cypher/flatten.js +279 -0
- package/dist/src/sources/cypher/flatten.js.map +1 -0
- package/dist/src/sources/cypher/index.d.ts +33 -0
- package/dist/src/sources/cypher/index.d.ts.map +1 -0
- package/dist/src/sources/cypher/index.js +405 -0
- package/dist/src/sources/cypher/index.js.map +1 -0
- package/dist/src/sources/cypher/params.d.ts +40 -0
- package/dist/src/sources/cypher/params.d.ts.map +1 -0
- package/dist/src/sources/cypher/params.js +6 -0
- package/dist/src/sources/cypher/params.js.map +1 -0
- package/dist/src/sources/cypher/profiles.d.ts +44 -0
- package/dist/src/sources/cypher/profiles.d.ts.map +1 -0
- package/dist/src/sources/cypher/profiles.js +61 -0
- package/dist/src/sources/cypher/profiles.js.map +1 -0
- package/dist/src/sources/cypher/query-builder.d.ts +106 -0
- package/dist/src/sources/cypher/query-builder.d.ts.map +1 -0
- package/dist/src/sources/cypher/query-builder.js +236 -0
- package/dist/src/sources/cypher/query-builder.js.map +1 -0
- package/dist/src/sources/cypher/transports/bolt.d.ts +21 -0
- package/dist/src/sources/cypher/transports/bolt.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/bolt.js +185 -0
- package/dist/src/sources/cypher/transports/bolt.js.map +1 -0
- package/dist/src/sources/cypher/transports/neptune-analytics.d.ts +15 -0
- package/dist/src/sources/cypher/transports/neptune-analytics.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/neptune-analytics.js +38 -0
- package/dist/src/sources/cypher/transports/neptune-analytics.js.map +1 -0
- package/dist/src/sources/cypher/transports/neptune-https.d.ts +31 -0
- package/dist/src/sources/cypher/transports/neptune-https.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/neptune-https.js +104 -0
- package/dist/src/sources/cypher/transports/neptune-https.js.map +1 -0
- package/dist/src/sources/cypher/transports/query-api.d.ts +14 -0
- package/dist/src/sources/cypher/transports/query-api.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/query-api.js +80 -0
- package/dist/src/sources/cypher/transports/query-api.js.map +1 -0
- package/dist/src/sources/cypher/transports/transport.d.ts +78 -0
- package/dist/src/sources/cypher/transports/transport.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/transport.js +77 -0
- package/dist/src/sources/cypher/transports/transport.js.map +1 -0
- package/dist/src/sources/cypher/types-map.d.ts +91 -0
- package/dist/src/sources/cypher/types-map.d.ts.map +1 -0
- package/dist/src/sources/cypher/types-map.js +306 -0
- package/dist/src/sources/cypher/types-map.js.map +1 -0
- package/dist/src/sources/define.d.ts +47 -0
- package/dist/src/sources/define.d.ts.map +1 -0
- package/dist/src/sources/define.js +173 -0
- package/dist/src/sources/define.js.map +1 -0
- package/dist/src/sources/fail.d.ts +33 -0
- package/dist/src/sources/fail.d.ts.map +1 -0
- package/dist/src/sources/fail.js +49 -0
- package/dist/src/sources/fail.js.map +1 -0
- package/dist/src/sources/ids.d.ts +64 -0
- package/dist/src/sources/ids.d.ts.map +1 -0
- package/dist/src/sources/ids.js +64 -0
- package/dist/src/sources/ids.js.map +1 -0
- package/dist/src/sources/ndex/client.d.ts +31 -0
- package/dist/src/sources/ndex/client.d.ts.map +1 -0
- package/dist/src/sources/ndex/client.js +90 -0
- package/dist/src/sources/ndex/client.js.map +1 -0
- package/dist/src/sources/ndex/descriptor.d.ts +10 -0
- package/dist/src/sources/ndex/descriptor.d.ts.map +1 -0
- package/dist/src/sources/ndex/descriptor.js +55 -0
- package/dist/src/sources/ndex/descriptor.js.map +1 -0
- package/dist/src/sources/ndex/expand.d.ts +20 -0
- package/dist/src/sources/ndex/expand.d.ts.map +1 -0
- package/dist/src/sources/ndex/expand.js +87 -0
- package/dist/src/sources/ndex/expand.js.map +1 -0
- package/dist/src/sources/ndex/index.d.ts +25 -0
- package/dist/src/sources/ndex/index.d.ts.map +1 -0
- package/dist/src/sources/ndex/index.js +191 -0
- package/dist/src/sources/ndex/index.js.map +1 -0
- package/dist/src/sources/ndex/params.d.ts +17 -0
- package/dist/src/sources/ndex/params.d.ts.map +1 -0
- package/dist/src/sources/ndex/params.js +6 -0
- package/dist/src/sources/ndex/params.js.map +1 -0
- package/dist/src/sources/ndex/share-url.d.ts +40 -0
- package/dist/src/sources/ndex/share-url.d.ts.map +1 -0
- package/dist/src/sources/ndex/share-url.js +64 -0
- package/dist/src/sources/ndex/share-url.js.map +1 -0
- package/dist/src/sources/params.d.ts +28 -0
- package/dist/src/sources/params.d.ts.map +1 -0
- package/dist/src/sources/params.js +6 -0
- package/dist/src/sources/params.js.map +1 -0
- package/dist/src/sources/registry.d.ts +118 -0
- package/dist/src/sources/registry.d.ts.map +1 -0
- package/dist/src/sources/registry.js +193 -0
- package/dist/src/sources/registry.js.map +1 -0
- package/dist/src/sources/rest/descriptor.d.ts +16 -0
- package/dist/src/sources/rest/descriptor.d.ts.map +1 -0
- package/dist/src/sources/rest/descriptor.js +71 -0
- package/dist/src/sources/rest/descriptor.js.map +1 -0
- package/dist/src/sources/rest/index.d.ts +14 -0
- package/dist/src/sources/rest/index.d.ts.map +1 -0
- package/dist/src/sources/rest/index.js +13 -0
- package/dist/src/sources/rest/index.js.map +1 -0
- package/dist/src/sources/rest/mapping.d.ts +30 -0
- package/dist/src/sources/rest/mapping.d.ts.map +1 -0
- package/dist/src/sources/rest/mapping.js +362 -0
- package/dist/src/sources/rest/mapping.js.map +1 -0
- package/dist/src/sources/rest/openalex.d.ts +27 -0
- package/dist/src/sources/rest/openalex.d.ts.map +1 -0
- package/dist/src/sources/rest/openalex.js +269 -0
- package/dist/src/sources/rest/openalex.js.map +1 -0
- package/dist/src/sources/rest/paging.d.ts +53 -0
- package/dist/src/sources/rest/paging.d.ts.map +1 -0
- package/dist/src/sources/rest/paging.js +138 -0
- package/dist/src/sources/rest/paging.js.map +1 -0
- package/dist/src/sources/rest/params.d.ts +216 -0
- package/dist/src/sources/rest/params.d.ts.map +1 -0
- package/dist/src/sources/rest/params.js +7 -0
- package/dist/src/sources/rest/params.js.map +1 -0
- package/dist/src/sources/rest/records.d.ts +41 -0
- package/dist/src/sources/rest/records.d.ts.map +1 -0
- package/dist/src/sources/rest/records.js +240 -0
- package/dist/src/sources/rest/records.js.map +1 -0
- package/dist/src/sources/rest/samples/deps-dev.d.ts +10 -0
- package/dist/src/sources/rest/samples/deps-dev.d.ts.map +1 -0
- package/dist/src/sources/rest/samples/deps-dev.js +47 -0
- package/dist/src/sources/rest/samples/deps-dev.js.map +1 -0
- package/dist/src/sources/rest/samples/string.d.ts +9 -0
- package/dist/src/sources/rest/samples/string.d.ts.map +1 -0
- package/dist/src/sources/rest/samples/string.js +42 -0
- package/dist/src/sources/rest/samples/string.js.map +1 -0
- package/dist/src/sources/rest/selectors.d.ts +41 -0
- package/dist/src/sources/rest/selectors.d.ts.map +1 -0
- package/dist/src/sources/rest/selectors.js +81 -0
- package/dist/src/sources/rest/selectors.js.map +1 -0
- package/dist/src/sources/rest/source.d.ts +67 -0
- package/dist/src/sources/rest/source.d.ts.map +1 -0
- package/dist/src/sources/rest/source.js +635 -0
- package/dist/src/sources/rest/source.js.map +1 -0
- package/dist/src/sources/rest/templates.d.ts +38 -0
- package/dist/src/sources/rest/templates.d.ts.map +1 -0
- package/dist/src/sources/rest/templates.js +125 -0
- package/dist/src/sources/rest/templates.js.map +1 -0
- package/dist/src/sources/run.d.ts +93 -0
- package/dist/src/sources/run.d.ts.map +1 -0
- package/dist/src/sources/run.js +673 -0
- package/dist/src/sources/run.js.map +1 -0
- package/dist/src/sources/sha256.d.ts +12 -0
- package/dist/src/sources/sha256.d.ts.map +1 -0
- package/dist/src/sources/sha256.js +95 -0
- package/dist/src/sources/sha256.js.map +1 -0
- package/dist/src/sources/sigv4.d.ts +24 -0
- package/dist/src/sources/sigv4.d.ts.map +1 -0
- package/dist/src/sources/sigv4.js +182 -0
- package/dist/src/sources/sigv4.js.map +1 -0
- package/dist/src/sources/testing.d.ts +96 -0
- package/dist/src/sources/testing.d.ts.map +1 -0
- package/dist/src/sources/testing.js +138 -0
- package/dist/src/sources/testing.js.map +1 -0
- package/dist/src/sources/types.d.ts +665 -0
- package/dist/src/sources/types.d.ts.map +1 -0
- package/dist/src/sources/types.js +10 -0
- package/dist/src/sources/types.js.map +1 -0
- package/dist/src/styles/canon/enums.d.ts.map +1 -1
- package/dist/src/styles/canon/enums.js +1 -0
- package/dist/src/styles/canon/enums.js.map +1 -1
- package/dist/src/styles/cyjs/cascade.d.ts.map +1 -1
- package/dist/src/styles/cyjs/cascade.js +68 -2
- package/dist/src/styles/cyjs/cascade.js.map +1 -1
- package/dist/src/styles/cyjs/defaults-table.d.ts.map +1 -1
- package/dist/src/styles/cyjs/defaults-table.js +2 -0
- package/dist/src/styles/cyjs/defaults-table.js.map +1 -1
- package/dist/src/styles/cyjs/emit.d.ts.map +1 -1
- package/dist/src/styles/cyjs/emit.js +18 -7
- package/dist/src/styles/cyjs/emit.js.map +1 -1
- package/dist/src/styles/cyjs/mappers.d.ts +4 -1
- package/dist/src/styles/cyjs/mappers.d.ts.map +1 -1
- package/dist/src/styles/cyjs/mappers.js +2 -0
- package/dist/src/styles/cyjs/mappers.js.map +1 -1
- package/dist/src/styles/cytoscape/emit.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/emit.js +59 -7
- package/dist/src/styles/cytoscape/emit.js.map +1 -1
- package/dist/src/styles/cytoscape/lexicon.d.ts +6 -0
- package/dist/src/styles/cytoscape/lexicon.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/lexicon.js +26 -2
- package/dist/src/styles/cytoscape/lexicon.js.map +1 -1
- package/dist/src/styles/cytoscape/resolve.d.ts +4 -1
- package/dist/src/styles/cytoscape/resolve.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/resolve.js +10 -6
- package/dist/src/styles/cytoscape/resolve.js.map +1 -1
- package/dist/src/styles/cytoscape/translate.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/translate.js +10 -10
- package/dist/src/styles/cytoscape/translate.js.map +1 -1
- package/dist/src/styles/defaults.d.ts +30 -0
- package/dist/src/styles/defaults.d.ts.map +1 -1
- package/dist/src/styles/defaults.js +45 -4
- package/dist/src/styles/defaults.js.map +1 -1
- package/dist/src/styles/io/block.d.ts.map +1 -1
- package/dist/src/styles/io/block.js +9 -0
- package/dist/src/styles/io/block.js.map +1 -1
- package/dist/src/styles/io/writer.d.ts.map +1 -1
- package/dist/src/styles/io/writer.js +7 -3
- package/dist/src/styles/io/writer.js.map +1 -1
- package/dist/src/styles/plan/resolve.d.ts +2 -1
- package/dist/src/styles/plan/resolve.d.ts.map +1 -1
- package/dist/src/styles/plan/resolve.js +13 -2
- package/dist/src/styles/plan/resolve.js.map +1 -1
- package/dist/src/styles/types.d.ts +19 -2
- package/dist/src/styles/types.d.ts.map +1 -1
- package/dist/src/styles/vocabulary.d.ts.map +1 -1
- package/dist/src/styles/vocabulary.js +15 -1
- package/dist/src/styles/vocabulary.js.map +1 -1
- package/dist/src/types.d.ts +19 -5
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/styles.js +11 -11
- package/dist/xgmml.js +3 -3
- package/docs/samples/people.json +6 -0
- package/package.json +29 -4
- package/src/common/report.ts +27 -7
- package/src/formats/cx/styles.ts +1 -0
- package/src/formats/dot/styles.ts +3 -1
- package/src/formats/gexf/styles.ts +185 -37
- package/src/formats/gml/styles.ts +5 -4
- package/src/formats/graphml/styles-plain.ts +3 -9
- package/src/formats/graphml/styles-yed.ts +93 -20
- package/src/formats/pajek/styles.ts +1 -0
- package/src/formats/xgmml/styles.ts +1 -0
- package/src/index.ts +90 -0
- package/src/registry.ts +326 -1
- package/src/sources/builtins.ts +56 -0
- package/src/sources/codes.ts +235 -0
- package/src/sources/context.ts +893 -0
- package/src/sources/credentials.ts +409 -0
- package/src/sources/cypher/descriptor.ts +125 -0
- package/src/sources/cypher/flatten.ts +323 -0
- package/src/sources/cypher/index.ts +498 -0
- package/src/sources/cypher/params.ts +41 -0
- package/src/sources/cypher/profiles.ts +78 -0
- package/src/sources/cypher/query-builder.ts +294 -0
- package/src/sources/cypher/transports/bolt.ts +228 -0
- package/src/sources/cypher/transports/neptune-analytics.ts +41 -0
- package/src/sources/cypher/transports/neptune-https.ts +122 -0
- package/src/sources/cypher/transports/query-api.ts +100 -0
- package/src/sources/cypher/transports/transport.ts +139 -0
- package/src/sources/cypher/types-map.ts +418 -0
- package/src/sources/define.ts +195 -0
- package/src/sources/fail.ts +70 -0
- package/src/sources/ids.ts +74 -0
- package/src/sources/ndex/client.ts +102 -0
- package/src/sources/ndex/descriptor.ts +64 -0
- package/src/sources/ndex/expand.ts +100 -0
- package/src/sources/ndex/index.ts +235 -0
- package/src/sources/ndex/params.ts +17 -0
- package/src/sources/ndex/share-url.ts +84 -0
- package/src/sources/params.ts +29 -0
- package/src/sources/registry.ts +325 -0
- package/src/sources/rest/descriptor.ts +74 -0
- package/src/sources/rest/index.ts +22 -0
- package/src/sources/rest/mapping.ts +401 -0
- package/src/sources/rest/openalex.ts +288 -0
- package/src/sources/rest/paging.ts +180 -0
- package/src/sources/rest/params.ts +243 -0
- package/src/sources/rest/records.ts +289 -0
- package/src/sources/rest/samples/deps-dev.ts +49 -0
- package/src/sources/rest/samples/string.ts +44 -0
- package/src/sources/rest/selectors.ts +91 -0
- package/src/sources/rest/source.ts +760 -0
- package/src/sources/rest/templates.ts +151 -0
- package/src/sources/run.ts +793 -0
- package/src/sources/sha256.ts +99 -0
- package/src/sources/sigv4.ts +207 -0
- package/src/sources/testing.ts +210 -0
- package/src/sources/types.ts +741 -0
- package/src/styles/canon/enums.ts +1 -0
- package/src/styles/cyjs/cascade.ts +81 -2
- package/src/styles/cyjs/defaults-table.ts +2 -0
- package/src/styles/cyjs/emit.ts +18 -7
- package/src/styles/cyjs/mappers.ts +6 -1
- package/src/styles/cytoscape/emit.ts +61 -7
- package/src/styles/cytoscape/lexicon.ts +28 -2
- package/src/styles/cytoscape/resolve.ts +22 -6
- package/src/styles/cytoscape/translate.ts +11 -11
- package/src/styles/defaults.ts +93 -4
- package/src/styles/io/block.ts +10 -0
- package/src/styles/io/writer.ts +8 -3
- package/src/styles/plan/resolve.ts +14 -2
- package/src/styles/types.ts +28 -2
- package/src/styles/vocabulary.ts +15 -1
- package/src/types.ts +19 -5
- package/dist/chunks/block-DiGq58c3.js.map +0 -1
- package/dist/chunks/emit-CwU8cUmG.js.map +0 -1
- package/dist/chunks/export-BvqAXCKh.js.map +0 -1
- package/dist/chunks/format-BpQBx8MZ.js.map +0 -1
- package/dist/chunks/importer-BSvfrX_h.js.map +0 -1
- package/dist/chunks/importer-CMmeMWlC.js.map +0 -1
- package/dist/chunks/importer-COTK9Tsl.js.map +0 -1
- package/dist/chunks/importer-DiZRmOQG.js.map +0 -1
- package/dist/chunks/importer-e6LGpqHB.js.map +0 -1
- package/dist/chunks/lexicon-CT69Kd87.js.map +0 -1
- package/dist/chunks/styles-BQnsga7p.js.map +0 -1
- package/dist/chunks/styles-D3fRphrO.js.map +0 -1
- package/dist/chunks/styles-yed-BF5x3_Y5.js.map +0 -1
- package/dist/chunks/writer-DMKvthQE.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lexicon-CT69Kd87.js","sources":["../../src/styles/cytoscape/lexicon.ts"],"sourcesContent":["/**\n * Cytoscape desktop's visual lexicon (CX, CX2, sessions, XGMML): which visual properties set each neutral\n * property, and how each value is read. Cytoscape states opacities two ways (`NODE_TRANSPARENCY` 0..255 in the\n * desktop and CX version 1, `NODE_BACKGROUND_OPACITY` 0..1 in CX2); both are read here.\n */\n\nimport { canonColor } from \"../canon/color.js\";\nimport { canonEnum } from \"../canon/enums.js\";\nimport { canonBoolean, canonNumber, canonOpacity, num6 } from \"../canon/number.js\";\nimport { type CanonSite, noteAt, scalarText } from \"../canon/site.js\";\nimport { canonText } from \"../canon/text.js\";\nimport { STYLE_ISSUE } from \"../codes.js\";\nimport type { StyleNotes } from \"../notes.js\";\nimport type { StyleTarget, StyleValue } from \"../types.js\";\nimport { isStyleValue } from \"../vocabulary.js\";\n\n/**\n * Reads one raw Cytoscape value as a neutral property's canonical value, noting a problem at the site.\n * @category Styles\n */\nexport type CytoscapeValueParser = (raw: unknown, site: CanonSite) => StyleValue | null;\n\n// A color; its alpha is dropped (Cytoscape keeps opacity in separate properties).\nconst color: CytoscapeValueParser = (raw, site) => canonColor(raw, \"cytoscape\", site)?.color ?? null;\n\n// Cytoscape desktop's 0..255 transparency.\nconst opacity255: CytoscapeValueParser = (raw, site) => {\n const v = canonNumber(raw, site);\n if (v === null) {\n return null;\n }\n if (v > 255) {\n noteAt(site, STYLE_ISSUE.BAD_VALUE, String(raw));\n return null;\n }\n return num6(Math.round(v) / 255);\n};\n\n// CX2's 0..1 opacity.\nconst opacity01: CytoscapeValueParser = (raw, site) => canonOpacity(raw, \"css\", site);\nconst length: CytoscapeValueParser = (raw, site) => canonNumber(raw, site);\nconst text: CytoscapeValueParser = (raw, site) => canonText(raw, site);\nconst bool: CytoscapeValueParser = (raw, site) => canonBoolean(raw, site);\n\n// CX2's `element` / `none`, or a boolean.\nconst visibility: CytoscapeValueParser = (raw, site) => {\n if (typeof raw === \"string\") {\n const t = raw.trim().toLowerCase();\n if (t === \"element\" || t === \"visible\") {\n return true;\n }\n if (t === \"none\" || t === \"hidden\") {\n return false;\n }\n }\n return canonBoolean(raw, site);\n};\n\n/** Cytoscape spellings the common shape table does not hold. */\nconst CY_SHAPES: ReadonlyMap<string, string> = new Map([[\"rounded_rectangle\", \"round-rectangle\"]]);\n\n/**\n * Cytoscape reads its enumeration names whatever their case, so a name it does not know is kept lowercase and\n * hyphenated, the form of the names it knows: `Bogus` and the `BOGUS` a writer spells it as read the same.\n * @param v - a canonical value\n * @returns the value, an `other:` one in that form\n */\nconst caseless = (v: StyleValue | null): StyleValue | null =>\n typeof v === \"string\" && v.startsWith(\"other:\") ? `other:${v.slice(6).toLowerCase().replaceAll(\"_\", \"-\")}` : v;\n\nconst shape: CytoscapeValueParser = (raw, site) => {\n const s = scalarText(raw, site);\n if (s === null) {\n return null;\n }\n return caseless(CY_SHAPES.get(s.trim().toLowerCase()) ?? canonEnum(\"shape\", s, \"cytoscape\", site));\n};\n\n/** Cytoscape's arrow names, desktop (`DELTA`) and CX2 (`triangle`), lowercase. */\nconst CY_ARROWS: ReadonlyMap<string, string> = new Map([\n [\"none\", \"none\"],\n [\"delta\", \"triangle\"],\n [\"arrow\", \"vee\"],\n [\"diamond\", \"diamond\"],\n [\"circle\", \"circle\"],\n [\"t\", \"tee\"],\n [\"half_top\", \"half\"],\n [\"half_bottom\", \"half\"],\n [\"square\", \"square\"],\n [\"delta_short_1\", \"triangle\"],\n [\"delta_short_2\", \"triangle\"],\n [\"arrow_short\", \"vee\"],\n [\"diamond_short_1\", \"diamond\"],\n [\"diamond_short_2\", \"diamond\"],\n [\"open_delta\", \"triangle-open\"],\n [\"open_circle\", \"circle-open\"],\n [\"open_diamond\", \"diamond-open\"],\n [\"open_square\", \"other:open-square\"],\n [\"cross_delta\", \"vee\"],\n [\"cross_open_delta\", \"triangle-open\"],\n [\"open_half_circle\", \"other:open-half-circle\"],\n [\"half_circle\", \"other:half-circle\"],\n [\"triangle\", \"triangle\"],\n [\"triangle-tee\", \"tee\"],\n [\"triangle-cross\", \"vee\"],\n [\"triangle-backcurve\", \"triangle\"],\n [\"tee\", \"tee\"],\n [\"vee\", \"vee\"],\n [\"open-circle\", \"circle-open\"],\n [\"open-triangle\", \"triangle-open\"],\n [\"open-diamond\", \"diamond-open\"],\n [\"open-square\", \"other:open-square\"],\n [\"open-delta\", \"triangle-open\"],\n [\"half-top\", \"half\"],\n [\"half-bottom\", \"half\"],\n]);\n\n/** Cytoscape 2.x numbered arrow codes. */\nconst LEGACY_ARROW: readonly string[] = [\n \"none\",\n \"delta\",\n \"delta\",\n \"delta\",\n \"arrow\",\n \"arrow\",\n \"arrow\",\n \"diamond\",\n \"diamond\",\n \"diamond\",\n \"circle\",\n \"circle\",\n \"circle\",\n \"t\",\n \"t\",\n \"t\",\n \"half_top\",\n \"half_bottom\",\n];\n\nconst arrow: CytoscapeValueParser = (raw, site) => {\n const s = scalarText(raw, site);\n if (s === null) {\n return null;\n }\n let key = s.trim().toLowerCase();\n if (/^\\d{1,2}$/.test(key)) {\n key = LEGACY_ARROW.at(Number(key)) ?? key;\n }\n return caseless(CY_ARROWS.get(key) ?? canonEnum(\"arrow\", s, \"cytoscape\", site));\n};\n\n/** Cytoscape's line types, lowercase. */\nconst CY_LINES: ReadonlyMap<string, string> = new Map([\n [\"solid\", \"solid\"],\n [\"dot\", \"dotted\"],\n [\"dots\", \"dotted\"],\n [\"equal_dash\", \"dashed\"],\n [\"long_dash\", \"dashed\"],\n [\"dash_dot\", \"dash-dot\"],\n [\"sinewave\", \"sinewave\"],\n [\"zigzag\", \"zigzag\"],\n [\"parallel_lines\", \"double\"],\n [\"marquee_dash\", \"dashed\"],\n [\"marquee_equal\", \"dashed\"],\n [\"marquee_dash_dot\", \"dash-dot\"],\n [\"backward_slash\", \"other:backward-slash\"],\n [\"forward_slash\", \"other:forward-slash\"],\n [\"vertical_slash\", \"other:vertical-slash\"],\n [\"separate_arrow\", \"other:separate-arrow\"],\n [\"contiguous_arrow\", \"other:contiguous-arrow\"],\n [\"double\", \"double\"],\n]);\n\n/**\n * A line type read for an edge line or a node border.\n * @param kind - which enumeration the value belongs to\n * @returns the parser\n */\nfunction lineOf(kind: \"lineStyle\" | \"borderStyle\"): CytoscapeValueParser {\n return (raw, site) => {\n const s = scalarText(raw, site);\n if (s === null) {\n return null;\n }\n const key = s.trim().toLowerCase();\n let v: string | null;\n if (/^line_\\d{1,3}$/.test(key)) {\n v = \"solid\";\n } else if (/^dashed_\\d{1,3}$/.test(key)) {\n v = \"dashed\";\n } else {\n v = CY_LINES.get(key) ?? canonEnum(kind, s, \"cytoscape\", site);\n }\n if (v === null || isStyleValue(\"node\", kind, v) || kind === \"lineStyle\") {\n return v;\n }\n // a line type a border does not have is kept as other:\n return `other:${key}`;\n };\n}\n\n/** The parts of a Cytoscape font face. */\ninterface FontFace {\n readonly family: string;\n readonly weight: \"normal\" | \"bold\";\n readonly italic: boolean;\n}\n\n/**\n * A font face: `SansSerif,plain,12`, `Dialog.bold,bold,12`, the legacy `SansSerif-0-12` (style bits 1 bold,\n * 2 italic) or CX2's `{ FONT_FAMILY, FONT_STYLE, FONT_WEIGHT }`, whose `FONT_NAME` (the font Cytoscape desktop\n * wrote it from, which its own import restores) wins over the CSS family when present.\n * @param raw - the value\n * @param site - where it was read\n * @returns the face, or null\n */\nfunction fontFace(raw: unknown, site: CanonSite): FontFace | null {\n if (raw !== null && typeof raw === \"object\" && !Array.isArray(raw)) {\n return cx2FontFace(raw as Record<string, unknown>, site);\n }\n const s = scalarText(raw, site);\n if (s === null) {\n return null;\n }\n const parts = s.split(\",\");\n if (parts.length >= 2) {\n const st = parts[1].trim().toLowerCase();\n return {\n family: parts[0].trim().replace(/\\.(?:bold|italic|plain|bolditalic)$/i, \"\"),\n weight: st.includes(\"bold\") ? \"bold\" : \"normal\",\n italic: st.includes(\"italic\"),\n };\n }\n return legacyFontFace(s) ?? { family: s.trim(), weight: \"normal\", italic: false };\n}\n\n/**\n * CX2's font face object.\n * @param o - the object\n * @param site - where it was read\n * @returns the face, or null without a family\n */\nfunction cx2FontFace(o: Record<string, unknown>, site: CanonSite): FontFace | null {\n const name = Object.hasOwn(o, \"FONT_NAME\") ? scalarText(o.FONT_NAME, site) : null;\n let family = Object.hasOwn(o, \"FONT_FAMILY\") ? scalarText(o.FONT_FAMILY, site) : null;\n if (name !== null && name.trim() !== \"\") {\n family = name.trim().replace(/\\.(?:bold|italic|plain|bolditalic)$/i, \"\");\n }\n if (family === null) {\n return null;\n }\n const weight = Object.hasOwn(o, \"FONT_WEIGHT\") ? String(o.FONT_WEIGHT) : \"\";\n const style = Object.hasOwn(o, \"FONT_STYLE\") ? String(o.FONT_STYLE) : \"\";\n return {\n family: family.trim(),\n weight: /bold/i.test(weight.slice(0, 32)) ? \"bold\" : \"normal\",\n italic: /italic/i.test(style.slice(0, 32)),\n };\n}\n\n/**\n * The legacy `Family-style-size` face: the last two dash parts are numbers, the style's bits 1 bold and 2 italic.\n * @param s - the value\n * @returns the face, or null when it is not one\n */\nfunction legacyFontFace(s: string): FontFace | null {\n const dash = s.split(\"-\");\n const numeric = (t: string | undefined): boolean => /^\\d+(?:\\.\\d+)?$/.test(t ?? \"\");\n if (dash.length < 3 || !numeric(dash.at(-1)) || !numeric(dash.at(-2))) {\n return null;\n }\n const bits = Math.trunc(Number(dash.at(-2)));\n let family = dash.slice(0, -2).join(\"-\");\n let bold = (bits & 1) !== 0;\n if (/-bold$/i.test(family)) {\n family = family.slice(0, -\"-bold\".length);\n bold = true;\n }\n return { family: family.replace(/\\.bold$/i, \"\"), weight: bold ? \"bold\" : \"normal\", italic: (bits & 2) !== 0 };\n}\n\n/** Java's logical font names, which Cytoscape desktop writes, as the CSS generic families they stand for. */\n/** The family a Java logical font name is read as (`Dialog` is drawn as a sans-serif font). */\nexport const JAVA_FONTS: ReadonlyMap<string, string> = new Map([\n [\"sansserif\", \"sans-serif\"],\n [\"dialog\", \"sans-serif\"],\n [\"default\", \"sans-serif\"],\n [\"dialoginput\", \"monospace\"],\n [\"monospaced\", \"monospace\"],\n [\"serif\", \"serif\"],\n]);\n\nconst fontFamily: CytoscapeValueParser = (raw, site) => {\n const family = fontFace(raw, site)?.family ?? null;\n return family === null ? null : (JAVA_FONTS.get(family.toLowerCase()) ?? family);\n};\nconst fontWeight: CytoscapeValueParser = (raw, site) => fontFace(raw, site)?.weight ?? null;\nconst fontItalic: CytoscapeValueParser = (raw, site) => fontFace(raw, site)?.italic ?? null;\n\n/** The node anchor of a desktop label position `C,C,c,0.00,0.00`. */\nconst ANCHOR: ReadonlyMap<string, string> = new Map([\n [\"C\", \"center\"],\n [\"N\", \"top\"],\n [\"S\", \"bottom\"],\n [\"E\", \"right\"],\n [\"W\", \"left\"],\n [\"NE\", \"top-right\"],\n [\"NW\", \"top-left\"],\n [\"SE\", \"bottom-right\"],\n [\"SW\", \"bottom-left\"],\n [\"NONE\", \"center\"],\n]);\n\n/** CX2's `HORIZONTAL_ANCHOR,VERTICAL_ANCHOR`, lowercase. */\nconst CX2_ANCHOR: ReadonlyMap<string, string> = new Map([\n [\"center,center\", \"center\"],\n [\"center,top\", \"top\"],\n [\"center,bottom\", \"bottom\"],\n [\"right,center\", \"right\"],\n [\"left,center\", \"left\"],\n [\"right,top\", \"top-right\"],\n [\"left,top\", \"top-left\"],\n [\"right,bottom\", \"bottom-right\"],\n [\"left,bottom\", \"bottom-left\"],\n]);\n\nconst labelPosition: CytoscapeValueParser = (raw, site) => {\n let key: string;\n let found: string | undefined;\n if (raw !== null && typeof raw === \"object\" && !Array.isArray(raw)) {\n const o = raw as Record<string, unknown>;\n const h = scalarText(Object.hasOwn(o, \"HORIZONTAL_ANCHOR\") ? o.HORIZONTAL_ANCHOR : \"center\", site);\n const v = scalarText(Object.hasOwn(o, \"VERTICAL_ANCHOR\") ? o.VERTICAL_ANCHOR : \"center\", site);\n if (h === null || v === null) {\n return null;\n }\n key = `${h.trim().toLowerCase()},${v.trim().toLowerCase()}`;\n found = CX2_ANCHOR.get(key);\n } else {\n const s = scalarText(raw, site);\n if (s === null) {\n return null;\n }\n key = s;\n found = ANCHOR.get(s.split(\",\")[0].trim().toUpperCase());\n }\n if (found === undefined) {\n noteAt(site, STYLE_ISSUE.UNKNOWN_VALUE, key);\n return null;\n }\n return found;\n};\n\n/**\n * The visual properties that set each neutral property, in the order Cytoscape prefers them: the first one a style\n * or any bypass mentions is the one read. Cytoscape draws a node's fill from `NODE_FILL_COLOR`; `NODE_PAINT` is its\n * parent and only counts when the child is absent everywhere.\n * @category Styles\n */\nexport const CYTOSCAPE_LEXICON: Readonly<\n Record<StyleTarget, ReadonlyMap<string, readonly (readonly [vp: string, parse: CytoscapeValueParser])[]>>\n> = Object.freeze({\n node: new Map<string, readonly (readonly [string, CytoscapeValueParser])[]>([\n [\n \"fill\",\n [\n [\"NODE_FILL_COLOR\", color],\n [\"NODE_BACKGROUND_COLOR\", color],\n [\"NODE_PAINT\", color],\n ],\n ],\n [\n \"fillOpacity\",\n [\n [\"NODE_TRANSPARENCY\", opacity255],\n [\"NODE_BACKGROUND_OPACITY\", opacity01],\n ],\n ],\n [\n \"borderColor\",\n [\n [\"NODE_BORDER_PAINT\", color],\n [\"NODE_BORDER_COLOR\", color],\n ],\n ],\n [\"borderWidth\", [[\"NODE_BORDER_WIDTH\", length]]],\n [\n \"borderStyle\",\n [\n [\"NODE_BORDER_STROKE\", lineOf(\"borderStyle\")],\n [\"NODE_BORDER_LINE_TYPE\", lineOf(\"borderStyle\")],\n [\"NODE_BORDER_STYLE\", lineOf(\"borderStyle\")],\n ],\n ],\n [\"shape\", [[\"NODE_SHAPE\", shape]]],\n [\"width\", [[\"NODE_WIDTH\", length]]],\n [\"height\", [[\"NODE_HEIGHT\", length]]],\n [\"label\", [[\"NODE_LABEL\", text]]],\n [\"labelColor\", [[\"NODE_LABEL_COLOR\", color]]],\n [\"labelSize\", [[\"NODE_LABEL_FONT_SIZE\", length]]],\n [\"labelFont\", [[\"NODE_LABEL_FONT_FACE\", fontFamily]]],\n [\"labelWeight\", [[\"NODE_LABEL_FONT_FACE\", fontWeight]]],\n [\"labelItalic\", [[\"NODE_LABEL_FONT_FACE\", fontItalic]]],\n [\"labelPosition\", [[\"NODE_LABEL_POSITION\", labelPosition]]],\n [\"tooltip\", [[\"NODE_TOOLTIP\", text]]],\n [\n \"visible\",\n [\n [\"NODE_VISIBLE\", bool],\n [\"NODE_VISIBILITY\", visibility],\n ],\n ],\n ]),\n edge: new Map<string, readonly (readonly [string, CytoscapeValueParser])[]>([\n [\n \"color\",\n [\n [\"EDGE_STROKE_UNSELECTED_PAINT\", color],\n [\"EDGE_LINE_COLOR\", color],\n [\"EDGE_UNSELECTED_PAINT\", color],\n [\"EDGE_PAINT\", color],\n ],\n ],\n [\n \"opacity\",\n [\n [\"EDGE_TRANSPARENCY\", opacity255],\n [\"EDGE_OPACITY\", opacity01],\n ],\n ],\n [\"width\", [[\"EDGE_WIDTH\", length]]],\n [\n \"lineStyle\",\n [\n [\"EDGE_LINE_TYPE\", lineOf(\"lineStyle\")],\n [\"EDGE_LINE_STYLE\", lineOf(\"lineStyle\")],\n ],\n ],\n [\"sourceArrow\", [[\"EDGE_SOURCE_ARROW_SHAPE\", arrow]]],\n [\"targetArrow\", [[\"EDGE_TARGET_ARROW_SHAPE\", arrow]]],\n [\n \"sourceArrowColor\",\n [\n [\"EDGE_SOURCE_ARROW_UNSELECTED_PAINT\", color],\n [\"EDGE_SOURCE_ARROW_COLOR\", color],\n ],\n ],\n [\n \"targetArrowColor\",\n [\n [\"EDGE_TARGET_ARROW_UNSELECTED_PAINT\", color],\n [\"EDGE_TARGET_ARROW_COLOR\", color],\n ],\n ],\n [\"curved\", [[\"EDGE_CURVED\", bool]]],\n [\"label\", [[\"EDGE_LABEL\", text]]],\n [\"labelColor\", [[\"EDGE_LABEL_COLOR\", color]]],\n [\"labelSize\", [[\"EDGE_LABEL_FONT_SIZE\", length]]],\n [\"labelFont\", [[\"EDGE_LABEL_FONT_FACE\", fontFamily]]],\n [\"labelWeight\", [[\"EDGE_LABEL_FONT_FACE\", fontWeight]]],\n [\"labelItalic\", [[\"EDGE_LABEL_FONT_FACE\", fontItalic]]],\n [\"tooltip\", [[\"EDGE_TOOLTIP\", text]]],\n [\n \"visible\",\n [\n [\"EDGE_VISIBLE\", bool],\n [\"EDGE_VISIBILITY\", visibility],\n ],\n ],\n ]),\n});\n\n/** A node's size when `nodeSizeLocked` makes `NODE_SIZE` drive width and height. */\nexport const NODE_SIZE_VP = \"NODE_SIZE\";\n\n/** The parser of node sizes, for `NODE_SIZE`. */\nexport const sizeParser: CytoscapeValueParser = length;\n\n/** The parser of colors, for the network background and `arrowColorMatchesEdge`. */\nexport const colorParser: CytoscapeValueParser = color;\n\n/** Every visual property the lexicon reads. */\nconst KNOWN_VPS: ReadonlySet<string> = new Set([\n NODE_SIZE_VP,\n ...Object.values(CYTOSCAPE_LEXICON).flatMap((byProp) =>\n Array.from(byProp.values()).flatMap((list) => list.map(([vp]) => vp)),\n ),\n]);\n\n/** Geometry, selection state and paint that is not a style: dropped without a note. */\nconst IGNORED_VP =\n /^(?:NODE|EDGE|NETWORK)_[XYZ]_LOCATION$|_SELECTED|SELECTION|^NETWORK_(?!BACKGROUND)|_DEPTH$|^COMPOUND_|EDGE_BEND|EDGE_CONTROL_POINTS|NODE_NESTED_NETWORK|_Z_ORDER$|EDGE_STACKING|_LABEL_WIDTH$|_HEIGHT$|_WIDTH$/;\n\n/**\n * Whether a visual property is one no neutral property carries and that is worth a note.\n * @param vp - the visual property\n * @returns true when it is neither read nor ignored\n */\nexport function isUncarriedVp(vp: string): boolean {\n return !KNOWN_VPS.has(vp) && !IGNORED_VP.test(vp);\n}\n\n/** Cytoscape's old identifiers (2.x XGMML graphics attributes and session properties), lowercase. */\nconst IDENTIFIERS: Readonly<Record<StyleTarget, ReadonlyMap<string, string>>> = {\n node: new Map([\n [\"fill\", \"NODE_FILL_COLOR\"],\n [\"w\", \"NODE_WIDTH\"],\n [\"h\", \"NODE_HEIGHT\"],\n [\"size\", \"NODE_SIZE\"],\n [\"type\", \"NODE_SHAPE\"],\n [\"outline\", \"NODE_BORDER_PAINT\"],\n [\"width\", \"NODE_BORDER_WIDTH\"],\n [\"borderlinetype\", \"NODE_BORDER_LINE_TYPE\"],\n [\"nodelabelfont\", \"NODE_LABEL_FONT_FACE\"],\n [\"nodetransparency\", \"NODE_TRANSPARENCY_01\"],\n [\"nodelabelposition\", \"NODE_LABEL_POSITION\"],\n [\"nodefillcolor\", \"NODE_FILL_COLOR\"],\n [\"nodesize\", \"NODE_SIZE\"],\n [\"nodewidth\", \"NODE_WIDTH\"],\n [\"nodehight\", \"NODE_HEIGHT\"],\n [\"nodeheight\", \"NODE_HEIGHT\"],\n [\"nodeopacity\", \"NODE_TRANSPARENCY\"],\n [\"nodebordercolor\", \"NODE_BORDER_PAINT\"],\n [\"nodelinewidth\", \"NODE_BORDER_WIDTH\"],\n [\"nodelinestyle\", \"NODE_BORDER_LINE_TYPE\"],\n [\"nodeshape\", \"NODE_SHAPE\"],\n [\"nodefont\", \"NODE_LABEL_FONT_FACE\"],\n [\"nodefontsize\", \"NODE_LABEL_FONT_SIZE\"],\n [\"nodelabel\", \"NODE_LABEL\"],\n [\"nodelabelcolor\", \"NODE_LABEL_COLOR\"],\n [\"nodetooltip\", \"NODE_TOOLTIP\"],\n ]),\n edge: new Map([\n [\"width\", \"EDGE_WIDTH\"],\n [\"fill\", \"EDGE_STROKE_UNSELECTED_PAINT\"],\n [\"edgelinetype\", \"EDGE_LINE_TYPE\"],\n [\"edgelabelfont\", \"EDGE_LABEL_FONT_FACE\"],\n [\"sourcearrowcolor\", \"EDGE_SOURCE_ARROW_UNSELECTED_PAINT\"],\n [\"targetarrowcolor\", \"EDGE_TARGET_ARROW_UNSELECTED_PAINT\"],\n [\"edgesourcearrowcolor\", \"EDGE_SOURCE_ARROW_UNSELECTED_PAINT\"],\n [\"edgetargetarrowcolor\", \"EDGE_TARGET_ARROW_UNSELECTED_PAINT\"],\n [\"edgelinewidth\", \"EDGE_WIDTH\"],\n [\"edgecolor\", \"EDGE_STROKE_UNSELECTED_PAINT\"],\n [\"edgelinestyle\", \"EDGE_LINE_TYPE\"],\n [\"edgeopacity\", \"EDGE_TRANSPARENCY\"],\n [\"sourcearrow\", \"EDGE_SOURCE_ARROW_SHAPE\"],\n [\"targetarrow\", \"EDGE_TARGET_ARROW_SHAPE\"],\n [\"edgesourcearrowshape\", \"EDGE_SOURCE_ARROW_SHAPE\"],\n [\"edgetargetarrowshape\", \"EDGE_TARGET_ARROW_SHAPE\"],\n [\"edgelabel\", \"EDGE_LABEL\"],\n [\"edgefont\", \"EDGE_LABEL_FONT_FACE\"],\n [\"edgelabelcolor\", \"EDGE_LABEL_COLOR\"],\n [\"edgefontsize\", \"EDGE_LABEL_FONT_SIZE\"],\n [\"edgetooltip\", \"EDGE_TOOLTIP\"],\n [\"curved\", \"EDGE_CURVED_LEGACY\"],\n [\"edgecurved\", \"EDGE_CURVED\"],\n [\"edgebend\", \"EDGE_BEND\"],\n ]),\n};\n\n/** Objects nested deeper than this inside one element's graphics are not read. */\nconst MAX_VP_DEPTH = 8;\nconst VP_NAME = /^[A-Z][A-Z_0-9]+$/;\n\n/**\n * One graphics key as a visual property: its name (`?<key>` for one with none) and its value, a legacy encoding\n * converted.\n * @param target - nodes or edges\n * @param k - the key\n * @param v - its value\n * @returns the name and the value\n */\nfunction visualProperty(target: StyleTarget, k: string, v: unknown): [string, unknown] {\n const name = VP_NAME.test(k) ? k : IDENTIFIERS[target].get(k.toLowerCase().replace(/^cy:/, \"\"));\n if (name === undefined) {\n return [`?${k}`, v];\n }\n if (name === \"NODE_TRANSPARENCY_01\") {\n let f = Number.NaN;\n if (typeof v === \"number\") {\n f = v;\n } else if (typeof v === \"string\") {\n f = Number(v.trim());\n }\n return [\"NODE_TRANSPARENCY\", Number.isFinite(f) ? Math.round(f * 255) : null];\n }\n if (name === \"EDGE_CURVED_LEGACY\") {\n return [\"EDGE_CURVED\", typeof v === \"string\" && v.toUpperCase() === \"CURVED_LINES\"];\n }\n return [name, v];\n}\n\n/**\n * Normalizes the keys of one object of an element's graphics; a nested object is pushed onto the stack.\n * @param target - nodes or edges\n * @param top - the object and its depth\n * @param stack - the objects still to walk\n * @param out - visual property name to raw value, added to\n * @returns how many nested objects were too deep to walk\n */\nfunction normalizeObject(\n target: StyleTarget,\n top: [Record<string, unknown>, number],\n stack: [Record<string, unknown>, number][],\n out: Map<string, unknown>,\n): number {\n const [obj, depth] = top;\n let deep = 0;\n for (const k of Object.keys(obj)) {\n const v = obj[k];\n if (k === \"lockedVisualProperties\" || v === null || v === undefined) {\n continue;\n }\n // a 2.x edgeBend of one handle is a record: kept whole, as its handles\n if (typeof v === \"object\" && !Array.isArray(v) && !/^[A-Z_0-9]+$/.test(k) && k.toLowerCase() !== \"edgebend\") {\n if (depth + 1 > MAX_VP_DEPTH) {\n deep++;\n } else {\n stack.push([v as Record<string, unknown>, depth + 1]);\n }\n continue;\n }\n const [name, value] = visualProperty(target, k, v);\n // visual-property-named keys come first in 3.x graphics and win\n if (!out.has(name)) {\n out.set(name, value);\n }\n }\n return deep;\n}\n\n/**\n * One element's raw visual properties, normalized: Cytoscape's old identifiers renamed to visual property names and\n * the legacy encodings converted (`nodeTransparency` 0..1 to `NODE_TRANSPARENCY` 0..255, `curved` to\n * `EDGE_CURVED`). Nested objects (`cytoscapeNodeGraphicsAttributes` and the like) are walked with an explicit stack\n * and a depth limit, never by recursion on the file's nesting. A key with no visual property name is kept as\n * `?<key>`, so a caller can note it.\n * @param target - nodes or edges\n * @param raw - the element's graphics object\n * @param notes - where a too-deep nesting is noted\n * @returns visual property name to raw value\n * @category Styles\n */\nexport function normalizeVisualProperties(target: StyleTarget, raw: unknown, notes?: StyleNotes): Map<string, unknown> {\n if (raw === null || typeof raw !== \"object\") {\n return new Map();\n }\n const out = new Map<string, unknown>();\n const stack: [Record<string, unknown>, number][] = [[raw as Record<string, unknown>, 0]];\n let deep = 0;\n for (let top = stack.pop(); top !== undefined; top = stack.pop()) {\n deep += normalizeObject(target, top, stack, out);\n }\n if (deep > 0) {\n notes?.add(STYLE_ISSUE.NESTING, target, \"graphics\", { sample: `deeper than ${MAX_VP_DEPTH}`, count: deep });\n }\n return out;\n}\n"],"names":[],"mappings":";AAuBA,MAAM,QAA8B,CAAC,KAAK,SAAS,WAAW,KAAK,aAAa,IAAI,GAAG,SAAS;AAGhG,MAAM,aAAmC,CAAC,KAAK,SAAS;AACpD,QAAM,IAAI,YAAY,KAAK,IAAI;AAC/B,MAAI,MAAM,MAAM;AACZ,WAAO;AAAA,EACX;AACA,MAAI,IAAI,KAAK;AACT,WAAO,MAA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gB,QAAQ,KAAK,OAAO,GAAG;AAAA,EACnD;AACA,MAAI,OAAO,GAAG;AACV,WAAO,IAAI,YAAY,SAAS,QAAQ,YAAY,EAAE,QAAQ,eAAe,YAAY,IAAI,OAAO,KAAA,CAAM;AAAA,EAC9G;AACA,SAAO;AACX;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles-BQnsga7p.js","sources":["../../src/styles/cytoscape/mappings.ts","../../src/styles/cytoscape/emit.ts","../../src/styles/cytoscape/resolve.ts","../../src/styles/cytoscape/translate.ts","../../src/formats/xgmml/constants.ts","../../src/formats/xgmml/styles.ts","../../src/formats/cx/styles.ts"],"sourcesContent":["/**\n * Cytoscape desktop's visual style model: per target the defaults, the one mapping per visual property and the\n * dependencies, read from CX version 1 (`cyVisualProperties`, mapping definitions as `COL=...,K=0=a` strings) and CX2\n * (`visualProperties`, `visualEditorProperties`). Every table keyed by file text is a `Map`.\n */\n\nimport { STYLE_ISSUE } from \"../codes.js\";\nimport type { StyleNotes } from \"../notes.js\";\nimport type { StyleTarget } from \"../types.js\";\n\n/**\n * One Cytoscape mapping, with the file's raw values (they are read per property when resolved or translated). A\n * discrete table's keys are typed by the attribute's type (numbers for `integer`, `long` and `double`, booleans for\n * `boolean`), so a key compares with a value the way Cytoscape compares them.\n * @category Styles\n */\nexport type CytoscapeMapping =\n | {\n /** The column's value is the visual property's value. */\n readonly kind: \"passthrough\";\n /** The column read. */\n readonly column: string;\n /** The attribute type the file states, or null. */\n readonly type: string | null;\n }\n | {\n /** A table from the column's value to a raw visual property value. */\n readonly kind: \"discrete\";\n /** The column read. */\n readonly column: string;\n /** The attribute type the file states, or null. */\n readonly type: string | null;\n /** `[key, raw value]` in the file's order. */\n readonly table: readonly (readonly [key: string | number | boolean, value: unknown])[];\n }\n | {\n /** Points between which Cytoscape interpolates. */\n readonly kind: \"continuous\";\n /** The column read. */\n readonly column: string;\n /** The attribute type the file states, or null. */\n readonly type: string | null;\n /** The points, in the file's order, with raw values. */\n readonly points: readonly CytoscapeContinuousPoint[];\n };\n\n/**\n * One point of a Cytoscape continuous mapping, with raw values: `below` just below `at`, `value` exactly at it,\n * `above` just above it.\n * @category Styles\n */\nexport interface CytoscapeContinuousPoint {\n /** The attribute value. */\n readonly at: number;\n /** The raw value just below `at`. */\n readonly below: unknown;\n /** The raw value exactly at `at`. */\n readonly value: unknown;\n /** The raw value just above `at`. */\n readonly above: unknown;\n}\n\n/**\n * The style of one target: defaults and mappings by visual property name, and the dependencies\n * (`nodeSizeLocked`, `arrowColorMatchesEdge`).\n * @category Styles\n */\nexport interface CytoscapeTargetStyle {\n /** Visual property name to raw default value. */\n readonly defaults: Map<string, unknown>;\n /** Visual property name to its mapping. */\n readonly mappings: Map<string, CytoscapeMapping>;\n /** Dependency name to whether it is on. */\n readonly dependencies: Map<string, boolean>;\n /**\n * Bypass names read as another visual property when the element has none of that one (CX2's `NODE_WIDTH` bypass\n * drives a locked node size).\n */\n readonly bypassAliases: Map<string, string>;\n}\n\n/**\n * A Cytoscape visual style: the network defaults and the style of nodes and edges.\n * @category Styles\n */\nexport interface CytoscapeStyle {\n /** The network's defaults (`NETWORK_BACKGROUND_PAINT`). */\n readonly network: {\n /** The network's default values by visual property name. */\n readonly defaults: Map<string, unknown>;\n };\n /** Node style. */\n readonly node: CytoscapeTargetStyle;\n /** Edge style. */\n readonly edge: CytoscapeTargetStyle;\n}\n\n/**\n * An empty style.\n * @returns a style with no defaults, mappings or dependencies\n * @category Styles\n */\nexport function emptyCytoscapeStyle(): CytoscapeStyle {\n const target = (): CytoscapeTargetStyle => ({\n defaults: new Map(),\n mappings: new Map(),\n dependencies: new Map(),\n bypassAliases: new Map(),\n });\n return { network: { defaults: new Map() }, node: target(), edge: target() };\n}\n\nconst NUMERIC_TYPES: ReadonlySet<string> = new Set([\"integer\", \"long\", \"double\", \"float\", \"int\", \"short\"]);\nconst DECIMAL = /^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?$/;\n\n/**\n * A discrete key typed by its attribute's type: a number for a numeric type, a boolean for `boolean`, else the key\n * as the file gives it. A list type (`list_of_integer`) types its items.\n * @param raw - the key as the file gives it\n * @param type - the attribute type, or null\n * @returns the typed key, or null when it is not a scalar\n * @category Styles\n */\nexport function typedKey(raw: unknown, type: string | null): string | number | boolean | null {\n if (typeof raw === \"number\") {\n return Number.isFinite(raw) ? raw : null;\n }\n if (typeof raw === \"boolean\") {\n return raw;\n }\n if (typeof raw !== \"string\") {\n return null;\n }\n const t = (type ?? \"\")\n .toLowerCase()\n .replace(/^list_of_/, \"\")\n .replace(/^java\\.lang\\./, \"\");\n if (NUMERIC_TYPES.has(t) && raw.length <= 64 && DECIMAL.test(raw.trim())) {\n return Number(raw.trim());\n }\n if (t === \"boolean\") {\n const b = raw.trim().toLowerCase();\n if (b === \"true\" || b === \"false\") {\n return b === \"true\";\n }\n }\n return raw;\n}\n\n/**\n * The tags of a CX version 1 mapping definition that are indexed.\n * @category Styles\n */\nexport type Cx1IndexedTag = \"K\" | \"V\" | \"L\" | \"E\" | \"G\" | \"OV\";\nconst INDEXED: ReadonlySet<string> = new Set<Cx1IndexedTag>([\"K\", \"V\", \"L\", \"E\", \"G\", \"OV\"]);\n\n/**\n * A parsed CX version 1 mapping definition.\n * @category Styles\n */\nexport interface Cx1Definition {\n /** The column (`COL=`), or null. */\n readonly column: string | null;\n /** The attribute type (`T=`), or null. */\n readonly type: string | null;\n /** Each indexed tag's entries by index: `K` keys, `V` values, `L`/`E`/`G` below/at/above, `OV` points. */\n readonly entries: ReadonlyMap<Cx1IndexedTag, ReadonlyMap<number, string>>;\n}\n\n/**\n * Splits a definition at single commas; `,,` is a literal comma.\n * @param def - the definition\n * @returns the tokens\n */\nfunction definitionTokens(def: string): string[] {\n const tokens: string[] = [];\n let parts: string[] = [];\n let start = 0;\n let i = def.indexOf(\",\");\n while (i >= 0) {\n parts.push(def.slice(start, i));\n if (def[i + 1] === \",\") {\n parts.push(\",\");\n i++;\n } else {\n tokens.push(parts.join(\"\"));\n parts = [];\n }\n start = i + 1;\n i = def.indexOf(\",\", start);\n }\n parts.push(def.slice(start));\n tokens.push(parts.join(\"\"));\n return tokens;\n}\n\n/**\n * One indexed entry of a definition: `TAG=index=value`.\n * @param t - the token\n * @returns the tag, the index and the value, or null when the token is no indexed entry\n */\nfunction indexedEntry(t: string): { tag: string; index: number; value: string } | null {\n const eq1 = t.indexOf(\"=\");\n const eq2 = eq1 < 0 ? -1 : t.indexOf(\"=\", eq1 + 1);\n const tag = t.slice(0, eq1);\n if (eq2 < 0 || !INDEXED.has(tag)) {\n return null;\n }\n const indexText = t.slice(eq1 + 1, eq2);\n return /^\\d{1,15}$/.test(indexText) ? { tag, index: Number(indexText), value: t.slice(eq2 + 1) } : null;\n}\n\n/**\n * Reads a CX version 1 mapping definition: `COL=a,T=string,K=0=x,V=0=y,...`, with `,,` a literal comma. Indexes are\n * collected into Maps and never used as array positions (`K=4294967294=a` is one entry, not four billion holes); an\n * index larger than the number of tokens is ignored and noted as `W_STYLE_BAD_MAPPING`.\n * @param def - the definition string\n * @param notes - where problems are noted\n * @param target - nodes or edges, for the note\n * @returns the definition\n * @category Styles\n */\nexport function parseCx1Definition(def: string, notes?: StyleNotes, target: StyleTarget | null = null): Cx1Definition {\n const tokens = definitionTokens(def);\n const entries = new Map<Cx1IndexedTag, Map<number, string>>();\n let column: string | null = null;\n let type: string | null = null;\n let beyond = 0;\n for (const t of tokens) {\n if (t.startsWith(\"COL=\")) {\n column = t.slice(4);\n continue;\n }\n if (t.startsWith(\"T=\")) {\n type = t.slice(2);\n continue;\n }\n const indexed = indexedEntry(t);\n if (indexed === null) {\n continue;\n }\n const { tag, index, value } = indexed;\n if (index > tokens.length) {\n beyond++;\n continue;\n }\n let byIndex = entries.get(tag as Cx1IndexedTag);\n if (byIndex === undefined) {\n byIndex = new Map();\n entries.set(tag as Cx1IndexedTag, byIndex);\n }\n byIndex.set(index, value);\n }\n if (beyond > 0) {\n notes?.add(STYLE_ISSUE.BAD_MAPPING, target, column ?? \"definition\", {\n sample: `${beyond} entries with an index beyond the definition`,\n count: beyond,\n });\n }\n return { column, type, entries };\n}\n\n/**\n * The indexes of a tag's entries, ascending.\n * @param d - the definition\n * @param tag - the tag\n * @returns the indexes\n */\nfunction indexesOf(d: Cx1Definition, tag: Cx1IndexedTag): number[] {\n return Array.from(d.entries.get(tag)?.keys() ?? []).sort((a, b) => a - b);\n}\n\n/**\n * A finite number from a number or decimal text.\n * @param v - the value\n * @returns the number, or null\n */\nfunction finiteOf(v: unknown): number | null {\n if (typeof v === \"number\") {\n return Number.isFinite(v) ? v : null;\n }\n if (typeof v === \"string\" && v.length <= 64 && DECIMAL.test(v.trim())) {\n return Number(v.trim());\n }\n return null;\n}\n\n/**\n * A CX version 1 mapping (`{ type: \"DISCRETE\", definition: \"COL=...\" }`) as a Cytoscape mapping.\n * @param m - the mapping object\n * @param notes - where problems are noted\n * @param target - nodes or edges, for notes\n * @returns the mapping, or null when it cannot be read\n * @category Styles\n */\nexport function mappingFromCx1(\n m: unknown,\n notes?: StyleNotes,\n target: StyleTarget | null = null,\n): CytoscapeMapping | null {\n if (m === null || typeof m !== \"object\" || typeof (m as { definition?: unknown }).definition !== \"string\") {\n return null;\n }\n const { type: kind, definition } = m as { type?: unknown; definition: string };\n const d = parseCx1Definition(definition, notes, target);\n if (d.column === null) {\n return null;\n }\n const at = (tag: Cx1IndexedTag, i: number): string | undefined => d.entries.get(tag)?.get(i);\n switch (String(kind).toUpperCase()) {\n case \"PASSTHROUGH\":\n return { kind: \"passthrough\", column: d.column, type: d.type };\n case \"DISCRETE\": {\n const table: [string | number | boolean, unknown][] = [];\n for (const i of indexesOf(d, \"K\")) {\n const key = typedKey(at(\"K\", i), d.type);\n const value = at(\"V\", i);\n if (key !== null && value !== undefined) {\n table.push([key, value]);\n }\n }\n return { kind: \"discrete\", column: d.column, type: d.type, table };\n }\n case \"CONTINUOUS\": {\n const points: CytoscapeContinuousPoint[] = [];\n for (const i of indexesOf(d, \"OV\")) {\n const x = finiteOf(at(\"OV\", i));\n if (x !== null) {\n points.push({ at: x, below: at(\"L\", i), value: at(\"E\", i), above: at(\"G\", i) });\n }\n }\n return { kind: \"continuous\", column: d.column, type: d.type, points };\n }\n default:\n return null;\n }\n}\n\n/**\n * A property of an object, read only when it is the object's own.\n * @param o - the object\n * @param k - the key\n * @returns the value, or undefined\n */\nfunction own(o: unknown, k: string): unknown {\n return o !== null && typeof o === \"object\" && Object.hasOwn(o, k) ? (o as Record<string, unknown>)[k] : undefined;\n}\n\n/** A continuous point being assembled from CX2 intervals. */\ninterface PointDraft {\n at: number;\n below?: unknown;\n value?: unknown;\n above?: unknown;\n}\n\n/**\n * A CX2 mapping (`{ type, definition: { attribute, map } }`) as a Cytoscape mapping. Continuous intervals\n * (`{ min, max, includeMin, includeMax, minVPValue, maxVPValue }`) become points: an interval's `minVPValue` is the\n * value just above its `min` (and at it when `includeMin`), its `maxVPValue` the value just below its `max` (and at\n * it when `includeMax` and the next interval does not include its `min`).\n * @param m - the mapping object\n * @returns the mapping, or null when it cannot be read\n * @category Styles\n */\nexport function mappingFromCx2(m: unknown): CytoscapeMapping | null {\n const def = own(m, \"definition\");\n const column = own(def, \"attribute\");\n if (typeof column !== \"string\") {\n return null;\n }\n const declared = own(def, \"type\");\n const type = typeof declared === \"string\" ? declared : null;\n const map = own(def, \"map\");\n const entries = Array.isArray(map) ? (map as unknown[]) : [];\n switch (String(own(m, \"type\")).toUpperCase()) {\n case \"PASSTHROUGH\":\n return { kind: \"passthrough\", column, type };\n case \"DISCRETE\": {\n const table: [string | number | boolean, unknown][] = [];\n for (const e of entries) {\n const key = typedKey(own(e, \"v\"), type);\n const value = own(e, \"vp\");\n if (key !== null && value !== undefined) {\n table.push([key, value]);\n }\n }\n return { kind: \"discrete\", column, type, table };\n }\n case \"CONTINUOUS\":\n return { kind: \"continuous\", column, type, points: cx2Points(entries) };\n default:\n return null;\n }\n}\n\n/**\n * The points of CX2's continuous intervals.\n * @param entries - the intervals\n * @returns the points, ascending\n */\nfunction cx2Points(entries: readonly unknown[]): CytoscapeContinuousPoint[] {\n const byAt = new Map<number, PointDraft>();\n const point = (x: number): PointDraft => {\n let p = byAt.get(x);\n if (p === undefined) {\n p = { at: x };\n byAt.set(x, p);\n }\n return p;\n };\n for (const iv of entries) {\n if (iv !== null && typeof iv === \"object\") {\n addInterval(iv, point);\n }\n }\n return Array.from(byAt.values())\n .sort((a, b) => a.at - b.at)\n .map((p): CytoscapeContinuousPoint => {\n const below = p.below ?? p.value ?? p.above;\n const above = p.above ?? p.value ?? below;\n return { at: p.at, below, value: p.value ?? below, above };\n });\n}\n\n/**\n * One CX2 interval into its points: its `minVPValue` is the value just above its `min` (and at it when\n * `includeMin`), its `maxVPValue` the value just below its `max` (and at it when `includeMax` and the next interval\n * does not include its `min`).\n * @param iv - the interval\n * @param point - the point at a position, made on first use\n */\nfunction addInterval(iv: object, point: (x: number) => PointDraft): void {\n const lo = finiteOf(own(iv, \"min\"));\n const hi = finiteOf(own(iv, \"max\"));\n const minValue = own(iv, \"minVPValue\") ?? own(iv, \"maxVPValue\");\n const maxValue = own(iv, \"maxVPValue\") ?? own(iv, \"minVPValue\");\n if (lo !== null) {\n const p = point(lo);\n p.above = minValue;\n if (own(iv, \"includeMin\") !== false) {\n p.value = minValue;\n }\n }\n if (hi !== null) {\n const p = point(hi);\n p.below = maxValue;\n if (own(iv, \"includeMax\") !== false && p.value === undefined) {\n p.value = maxValue;\n }\n }\n}\n\n/**\n * The element's own record of values, or an empty one.\n * @param x - the value\n * @returns the record\n */\nfunction record(x: unknown): Record<string, unknown> {\n return x !== null && typeof x === \"object\" && !Array.isArray(x) ? (x as Record<string, unknown>) : {};\n}\n\n/**\n * The style of a CX version 1 file from its `cyVisualProperties` aspect: the first view's `network`,\n * `nodes:default` and `edges:default` entries (defaults, mappings, dependencies). Other views are skipped with one\n * `W_STYLE_OTHER_VIEWS` note; a mapping that cannot be read is noted as `W_STYLE_BAD_MAPPING`.\n * @param entries - the aspect's entries\n * @param notes - where problems are noted\n * @returns the style\n * @category Styles\n */\nexport function cytoscapeStyleFromCx(entries: readonly unknown[], notes?: StyleNotes): CytoscapeStyle {\n const style = emptyCytoscapeStyle();\n const viewOf = (v: unknown): unknown => own(v, \"applies_to\") ?? own(v, \"view\") ?? null;\n const views: unknown[] = [];\n for (const v of entries) {\n if (/default|network/.test(String(own(v, \"properties_of\"))) && !views.includes(viewOf(v))) {\n views.push(viewOf(v));\n }\n }\n if (views.length > 1) {\n notes?.add(STYLE_ISSUE.OTHER_VIEWS, null, \"cyVisualProperties\", {\n sample: `${views.length - 1} more`,\n count: views.length - 1,\n });\n }\n for (const v of entries) {\n const target =\n v !== null && typeof v === \"object\" && viewOf(v) === views[0]\n ? CX_SECTIONS.get(String(own(v, \"properties_of\")))\n : undefined;\n if (target === undefined) {\n continue;\n }\n const props = record(own(v, \"properties\"));\n for (const k of Object.keys(props)) {\n style[target].defaults.set(k, props[k]);\n }\n if (target !== \"network\") {\n readCxMappings(style, target, v, notes);\n }\n }\n return style;\n}\n\n/** The style section each `properties_of` of a CX `cyVisualProperties` entry fills. */\nconst CX_SECTIONS: ReadonlyMap<string, StyleTarget | \"network\"> = new Map([\n [\"nodes:default\", \"node\"],\n [\"edges:default\", \"edge\"],\n [\"network\", \"network\"],\n]);\n\n/**\n * The mappings and dependencies of a CX `nodes:default` or `edges:default` entry, into the style.\n * @param style - the style, changed in place\n * @param target - nodes or edges\n * @param v - the entry\n * @param notes - where a mapping that cannot be read is noted\n */\nfunction readCxMappings(style: CytoscapeStyle, target: StyleTarget, v: unknown, notes: StyleNotes | undefined): void {\n const mappings = record(own(v, \"mappings\"));\n for (const vp of Object.keys(mappings)) {\n const m = mappingFromCx1(mappings[vp], notes, target);\n if (m === null) {\n notes?.add(STYLE_ISSUE.BAD_MAPPING, target, vp, { sample: mappings[vp] });\n } else {\n style[target].mappings.set(vp, m);\n }\n }\n const deps = record(own(v, \"dependencies\"));\n for (const d of Object.keys(deps)) {\n style[target].dependencies.set(d, String(deps[d]).toLowerCase() === \"true\");\n }\n}\n\n/**\n * The style of a CX2 file from its `visualProperties` and `visualEditorProperties` aspects (the first entry of\n * each). CX2 has no `NODE_SIZE`, so a locked node size follows `NODE_WIDTH` (its default, mapping and bypasses)\n * unless the file writes `NODE_SIZE` anyway.\n * @param visualProperties - the `visualProperties` aspect\n * @param visualEditorProperties - the `visualEditorProperties` aspect, or undefined\n * @param notes - where problems are noted\n * @returns the style\n * @category Styles\n */\nexport function cytoscapeStyleFromCx2(\n visualProperties: unknown,\n visualEditorProperties?: unknown,\n notes?: StyleNotes,\n): CytoscapeStyle {\n const style = emptyCytoscapeStyle();\n const first = (x: unknown): unknown => (Array.isArray(x) ? x[0] : x);\n const vp = record(first(visualProperties));\n const editor = record(own(record(first(visualEditorProperties)), \"properties\"));\n const defaults = record(own(vp, \"default\"));\n for (const target of [\"network\", \"node\", \"edge\"] as const) {\n const d = record(own(defaults, target));\n for (const k of Object.keys(d)) {\n style[target].defaults.set(k, d[k]);\n }\n }\n style.node.dependencies.set(\"nodeSizeLocked\", own(editor, \"nodeSizeLocked\") === true);\n style.edge.dependencies.set(\"arrowColorMatchesEdge\", own(editor, \"arrowColorMatchesEdge\") === true);\n for (const [target, key] of [\n [\"node\", \"nodeMapping\"],\n [\"edge\", \"edgeMapping\"],\n ] as const) {\n const mappings = record(own(vp, key));\n for (const name of Object.keys(mappings)) {\n const m = mappingFromCx2(mappings[name]);\n if (m === null) {\n notes?.add(STYLE_ISSUE.BAD_MAPPING, target, name, { sample: mappings[name] });\n } else {\n style[target].mappings.set(name, m);\n }\n }\n }\n lockedSizeFromWidth(style.node);\n return style;\n}\n\n/**\n * CX2 has no `NODE_SIZE`: a locked node size follows `NODE_WIDTH` (its default, mapping and bypasses) unless the\n * file writes `NODE_SIZE` anyway.\n * @param node - the node section, changed in place\n */\nfunction lockedSizeFromWidth(node: CytoscapeStyle[\"node\"]): void {\n if (\n node.dependencies.get(\"nodeSizeLocked\") !== true ||\n node.defaults.has(\"NODE_SIZE\") ||\n node.mappings.has(\"NODE_SIZE\")\n ) {\n return;\n }\n if (node.defaults.has(\"NODE_WIDTH\")) {\n node.defaults.set(\"NODE_SIZE\", node.defaults.get(\"NODE_WIDTH\"));\n }\n const width = node.mappings.get(\"NODE_WIDTH\");\n if (width !== undefined) {\n node.mappings.set(\"NODE_SIZE\", width);\n }\n node.bypassAliases.set(\"NODE_WIDTH\", \"NODE_SIZE\");\n}\n","/**\n * Neutral style rules back to a Cytoscape visual style, for the CX, CX2 and session writers: rules over every element\n * become defaults and mappings, everything Cytoscape cannot say as a rule (a rule over a group of elements, a second\n * mapping of one property, a value written per element) becomes per-element bypasses, so what Cytoscape draws is\n * what the rules give. Every value the style cannot hold is a coded note.\n */\n\nimport type { GraphSnapshot } from \"@graphty/graph-format\";\n\nimport { escapeXmlAttribute } from \"../../common/escape.js\";\nimport { num6 } from \"../canon/number.js\";\nimport { STYLE_ISSUE } from \"../codes.js\";\nimport { StyleNotes } from \"../notes.js\";\nimport { canonicalFor, degreeValues, refSource, resolveRules } from \"../plan/resolve.js\";\nimport type {\n ColumnRef,\n ContinuousPoint,\n ExtractedStyles,\n Mapping,\n Scalar,\n StyleRule,\n StyleTarget,\n StyleValue,\n} from \"../types.js\";\nimport { STYLE_PROPERTIES } from \"../vocabulary.js\";\nimport { JAVA_FONTS } from \"./lexicon.js\";\nimport {\n type CytoscapeContinuousPoint,\n type CytoscapeMapping,\n type CytoscapeStyle,\n emptyCytoscapeStyle,\n} from \"./mappings.js\";\n\n/**\n * The spelling a Cytoscape style is written in: `\"desktop\"` for CX version 1 and session files (text values,\n * `NODE_FILL_COLOR`, 0..255 transparency), `\"cx2\"` for CX2 (typed JSON values, `NODE_BACKGROUND_COLOR`, 0..1\n * opacity).\n * @category Styles\n */\nexport type CytoscapeDialect = \"desktop\" | \"cx2\";\n\n/**\n * Options of `emitCytoscapeStyle()`.\n * @category Styles\n */\nexport interface CytoscapeEmitOptions {\n /** The spelling to write. */\n readonly dialect: CytoscapeDialect;\n /** Where every loss is noted (`W_STYLE_NOT_WRITTEN`, `W_STYLE_APPROXIMATED`, `W_STYLE_LAYER_FLATTENED`). */\n readonly notes?: StyleNotes;\n /**\n * The name of the attribute column a mapping over a style column or a computed degree reads, which the writer\n * adds to the file; defaults to `graphty.style.<target>.<key>` (`<key>` is the style column's key or the degree's\n * name).\n */\n readonly columnName?: (target: StyleTarget, ref: ColumnRef) => string;\n}\n\n/**\n * A Cytoscape style made from neutral rules.\n * @category Styles\n */\nexport interface CytoscapeEmitted {\n /** The style: defaults, mappings and dependencies, values in the dialect's spelling. */\n readonly style: CytoscapeStyle;\n /** Each element's bypasses (visual property to value in the dialect's spelling), or null where it has none. */\n readonly bypasses: {\n /** Per node, by node index. */\n readonly node: (Map<string, unknown> | null)[];\n /** Per edge, by edge index. */\n readonly edge: (Map<string, unknown> | null)[];\n };\n /** Attribute columns the mappings read that the graph does not hold, by name, with each element's value. */\n readonly columns: {\n /** Node columns. */\n readonly node: Map<string, readonly (StyleValue | null)[]>;\n /** Edge columns. */\n readonly edge: Map<string, readonly (StyleValue | null)[]>;\n };\n}\n\n/** Writes one canonical value in a dialect's spelling; calls `approx` when the value is changed to fit. */\ntype Write = (v: StyleValue, approx: () => void) => unknown;\n\n/** A visual property and how a value is written into it. */\ninterface Writer {\n readonly vp: string;\n readonly write: Write;\n}\n\n/**\n * `#RRGGBB`.\n * @param v - a canonical color\n * @returns the color as Cytoscape writes it\n */\nconst colorOut: Write = (v) => String(v).toUpperCase();\n\n/**\n * A writer of an enumeration.\n * @param table - canonical value to the dialect's spelling\n * @param near - canonical value to the nearest spelling, for values the dialect does not have\n * @param upper - whether an `other:` value is written uppercase with underscores\n * @param cytoscape - the `other:` values (lowercase, hyphenated) that are Cytoscape's own names, written as they\n * are; any other `other:` value (another program's, such as Graphviz's `invtrapezium`) is no Cytoscape value and\n * is written as its nearest\n * @returns the writer\n */\nfunction enumOut(\n table: Readonly<Record<string, string>>,\n near: Readonly<Record<string, string>>,\n upper: boolean,\n cytoscape: ReadonlySet<string> = new Set(),\n): Write {\n return (v, approx) => {\n const s = String(v);\n if (Object.hasOwn(table, s)) {\n return table[s];\n }\n if (s.startsWith(\"other:\") && cytoscape.has(s.slice(\"other:\".length).toLowerCase().replaceAll(\"_\", \"-\"))) {\n const raw = s.slice(\"other:\".length);\n const out = upper ? raw.toUpperCase().replaceAll(\"-\", \"_\") : raw;\n if (out !== raw) {\n // read back in Cytoscape's spelling, which is another value\n approx();\n }\n return out;\n }\n approx();\n return Object.hasOwn(near, s) ? near[s] : Object.values(table)[0];\n };\n}\n\nconst DESKTOP_SHAPES = {\n ellipse: \"ELLIPSE\",\n rectangle: \"RECTANGLE\",\n \"round-rectangle\": \"ROUND_RECTANGLE\",\n triangle: \"TRIANGLE\",\n diamond: \"DIAMOND\",\n hexagon: \"HEXAGON\",\n octagon: \"OCTAGON\",\n parallelogram: \"PARALLELOGRAM\",\n vee: \"V\",\n};\nconst NEAR_SHAPES = {\n pentagon: \"hexagon\",\n star: \"octagon\",\n trapezoid: \"parallelogram\",\n none: \"ellipse\",\n // Graphviz shapes no canonical shape names\n \"other:invtrapezium\": \"parallelogram\",\n \"other:house\": \"hexagon\",\n \"other:invhouse\": \"hexagon\",\n};\nconst lower = (t: Readonly<Record<string, string>>): Record<string, string> =>\n Object.fromEntries(Object.entries(t).map(([k, v]) => [k, v === \"V\" ? \"vee\" : v.toLowerCase()]));\nconst nearIn = (t: Readonly<Record<string, string>>, near: Readonly<Record<string, string>>): Record<string, string> =>\n Object.fromEntries(Object.entries(near).map(([k, v]) => [k, t[v]]));\n\nconst DESKTOP_BORDERS = {\n solid: \"SOLID\",\n dashed: \"EQUAL_DASH\",\n dotted: \"DOT\",\n \"dash-dot\": \"DASH_DOT\",\n double: \"PARALLEL_LINES\",\n};\n// LONG_DASH is read as dashed (CX2 has no long dash), so long-dash is written as its nearest, EQUAL_DASH\nconst DESKTOP_LINES = { ...DESKTOP_BORDERS, zigzag: \"ZIGZAG\", sinewave: \"SINEWAVE\" };\nconst CX2_LINES = { solid: \"solid\", dashed: \"dashed\", dotted: \"dotted\", double: \"double\" };\nconst NEAR_LINES = { \"dash-dot\": \"dashed\", \"long-dash\": \"dashed\", zigzag: \"solid\", sinewave: \"solid\" };\n\nconst DESKTOP_ARROWS = {\n none: \"NONE\",\n triangle: \"DELTA\",\n vee: \"ARROW\",\n tee: \"T\",\n diamond: \"DIAMOND\",\n circle: \"CIRCLE\",\n square: \"SQUARE\",\n \"triangle-open\": \"OPEN_DELTA\",\n \"diamond-open\": \"OPEN_DIAMOND\",\n \"circle-open\": \"OPEN_CIRCLE\",\n half: \"HALF_TOP\",\n};\nconst CX2_ARROWS = {\n none: \"none\",\n triangle: \"triangle\",\n vee: \"vee\",\n tee: \"tee\",\n diamond: \"diamond\",\n circle: \"circle\",\n square: \"square\",\n \"triangle-open\": \"open-triangle\",\n \"diamond-open\": \"open-diamond\",\n \"circle-open\": \"open-circle\",\n half: \"half-top\",\n};\nconst NEAR_ARROWS = { crow: \"vee\", inverted: \"triangle\" };\n\n/** The Cytoscape arrow names no canonical arrow names, which Cytoscape's readers keep as `other:` values. */\nconst CY_OTHER_ARROWS: ReadonlySet<string> = new Set([\"open-square\", \"open-half-circle\", \"half-circle\"]);\n/** The Cytoscape line types no canonical line style names. */\nconst CY_OTHER_LINES: ReadonlySet<string> = new Set([\n \"backward-slash\",\n \"forward-slash\",\n \"vertical-slash\",\n \"separate-arrow\",\n \"contiguous-arrow\",\n]);\n/** The Cytoscape line types a border can take that no canonical border style names. */\nconst CY_OTHER_BORDERS: ReadonlySet<string> = new Set([...CY_OTHER_LINES, \"zigzag\", \"sinewave\"]);\n\n/** A label position: the node's anchor and the label's opposite anchor. */\nconst DESKTOP_POSITIONS = {\n center: \"C,C,c,0.00,0.00\",\n top: \"N,S,c,0.00,0.00\",\n bottom: \"S,N,c,0.00,0.00\",\n left: \"W,E,c,0.00,0.00\",\n right: \"E,W,c,0.00,0.00\",\n \"top-left\": \"NW,SE,c,0.00,0.00\",\n \"top-right\": \"NE,SW,c,0.00,0.00\",\n \"bottom-left\": \"SW,NE,c,0.00,0.00\",\n \"bottom-right\": \"SE,NW,c,0.00,0.00\",\n};\nconst CX2_ANCHORS: Readonly<Record<string, readonly [string, string]>> = {\n center: [\"center\", \"center\"],\n top: [\"center\", \"top\"],\n bottom: [\"center\", \"bottom\"],\n left: [\"left\", \"center\"],\n right: [\"right\", \"center\"],\n \"top-left\": [\"left\", \"top\"],\n \"top-right\": [\"right\", \"top\"],\n \"bottom-left\": [\"left\", \"bottom\"],\n \"bottom-right\": [\"right\", \"bottom\"],\n};\n\nconst desktopNumber: Write = String;\nconst cx2Number: Write = (v) => v;\nconst textOut: Write = String;\nconst desktopBool: Write = (v) => String(v === true);\nconst opacity255: Write = (v, approx) => {\n const b = Math.round(Number(v) * 255);\n if (num6(b / 255) !== v) {\n approx();\n }\n return String(b);\n};\n\n/** The writers of each dialect, per target and property. */\nconst WRITERS: Readonly<Record<CytoscapeDialect, Readonly<Record<StyleTarget, ReadonlyMap<string, Writer>>>>> = {\n desktop: {\n node: new Map<string, Writer>([\n [\"fill\", { vp: \"NODE_FILL_COLOR\", write: colorOut }],\n [\"fillOpacity\", { vp: \"NODE_TRANSPARENCY\", write: opacity255 }],\n [\"borderColor\", { vp: \"NODE_BORDER_PAINT\", write: colorOut }],\n [\"borderWidth\", { vp: \"NODE_BORDER_WIDTH\", write: desktopNumber }],\n [\n \"borderStyle\",\n {\n vp: \"NODE_BORDER_LINE_TYPE\",\n write: enumOut(DESKTOP_BORDERS, nearIn(DESKTOP_BORDERS, NEAR_LINES), true, CY_OTHER_BORDERS),\n },\n ],\n [\"shape\", { vp: \"NODE_SHAPE\", write: enumOut(DESKTOP_SHAPES, nearIn(DESKTOP_SHAPES, NEAR_SHAPES), true) }],\n [\"width\", { vp: \"NODE_WIDTH\", write: desktopNumber }],\n [\"height\", { vp: \"NODE_HEIGHT\", write: desktopNumber }],\n [\"label\", { vp: \"NODE_LABEL\", write: textOut }],\n [\"labelColor\", { vp: \"NODE_LABEL_COLOR\", write: colorOut }],\n [\"labelSize\", { vp: \"NODE_LABEL_FONT_SIZE\", write: desktopNumber }],\n [\"labelPosition\", { vp: \"NODE_LABEL_POSITION\", write: enumOut(DESKTOP_POSITIONS, {}, false) }],\n [\"tooltip\", { vp: \"NODE_TOOLTIP\", write: textOut }],\n [\"visible\", { vp: \"NODE_VISIBLE\", write: desktopBool }],\n ]),\n edge: new Map<string, Writer>([\n [\"color\", { vp: \"EDGE_STROKE_UNSELECTED_PAINT\", write: colorOut }],\n [\"opacity\", { vp: \"EDGE_TRANSPARENCY\", write: opacity255 }],\n [\"width\", { vp: \"EDGE_WIDTH\", write: desktopNumber }],\n [\n \"lineStyle\",\n {\n vp: \"EDGE_LINE_TYPE\",\n write: enumOut(DESKTOP_LINES, nearIn(DESKTOP_LINES, NEAR_LINES), true, CY_OTHER_LINES),\n },\n ],\n [\n \"sourceArrow\",\n {\n vp: \"EDGE_SOURCE_ARROW_SHAPE\",\n write: enumOut(DESKTOP_ARROWS, nearIn(DESKTOP_ARROWS, NEAR_ARROWS), true, CY_OTHER_ARROWS),\n },\n ],\n [\n \"targetArrow\",\n {\n vp: \"EDGE_TARGET_ARROW_SHAPE\",\n write: enumOut(DESKTOP_ARROWS, nearIn(DESKTOP_ARROWS, NEAR_ARROWS), true, CY_OTHER_ARROWS),\n },\n ],\n [\"sourceArrowColor\", { vp: \"EDGE_SOURCE_ARROW_UNSELECTED_PAINT\", write: colorOut }],\n [\"targetArrowColor\", { vp: \"EDGE_TARGET_ARROW_UNSELECTED_PAINT\", write: colorOut }],\n [\"curved\", { vp: \"EDGE_CURVED\", write: desktopBool }],\n [\"label\", { vp: \"EDGE_LABEL\", write: textOut }],\n [\"labelColor\", { vp: \"EDGE_LABEL_COLOR\", write: colorOut }],\n [\"labelSize\", { vp: \"EDGE_LABEL_FONT_SIZE\", write: desktopNumber }],\n [\"tooltip\", { vp: \"EDGE_TOOLTIP\", write: textOut }],\n [\"visible\", { vp: \"EDGE_VISIBLE\", write: desktopBool }],\n ]),\n },\n cx2: {\n node: new Map<string, Writer>([\n [\"fill\", { vp: \"NODE_BACKGROUND_COLOR\", write: colorOut }],\n [\"fillOpacity\", { vp: \"NODE_BACKGROUND_OPACITY\", write: cx2Number }],\n [\"borderColor\", { vp: \"NODE_BORDER_COLOR\", write: colorOut }],\n [\"borderWidth\", { vp: \"NODE_BORDER_WIDTH\", write: cx2Number }],\n [\n \"borderStyle\",\n {\n vp: \"NODE_BORDER_STYLE\",\n write: enumOut(CX2_LINES, nearIn(CX2_LINES, NEAR_LINES), false, CY_OTHER_BORDERS),\n },\n ],\n [\n \"shape\",\n {\n vp: \"NODE_SHAPE\",\n write: enumOut(lower(DESKTOP_SHAPES), nearIn(lower(DESKTOP_SHAPES), NEAR_SHAPES), false),\n },\n ],\n [\"width\", { vp: \"NODE_WIDTH\", write: cx2Number }],\n [\"height\", { vp: \"NODE_HEIGHT\", write: cx2Number }],\n [\"label\", { vp: \"NODE_LABEL\", write: textOut }],\n [\"labelColor\", { vp: \"NODE_LABEL_COLOR\", write: colorOut }],\n [\"labelSize\", { vp: \"NODE_LABEL_FONT_SIZE\", write: cx2Number }],\n [\"labelPosition\", { vp: \"NODE_LABEL_POSITION\", write: cx2Position }],\n [\"visible\", { vp: \"NODE_VISIBILITY\", write: (v) => (v === true ? \"element\" : \"none\") }],\n ]),\n edge: new Map<string, Writer>([\n [\"color\", { vp: \"EDGE_LINE_COLOR\", write: colorOut }],\n [\"opacity\", { vp: \"EDGE_OPACITY\", write: cx2Number }],\n [\"width\", { vp: \"EDGE_WIDTH\", write: cx2Number }],\n [\n \"lineStyle\",\n {\n vp: \"EDGE_LINE_STYLE\",\n write: enumOut(CX2_LINES, nearIn(CX2_LINES, NEAR_LINES), false, CY_OTHER_LINES),\n },\n ],\n [\n \"sourceArrow\",\n {\n vp: \"EDGE_SOURCE_ARROW_SHAPE\",\n write: enumOut(CX2_ARROWS, nearIn(CX2_ARROWS, NEAR_ARROWS), false, CY_OTHER_ARROWS),\n },\n ],\n [\n \"targetArrow\",\n {\n vp: \"EDGE_TARGET_ARROW_SHAPE\",\n write: enumOut(CX2_ARROWS, nearIn(CX2_ARROWS, NEAR_ARROWS), false, CY_OTHER_ARROWS),\n },\n ],\n [\"sourceArrowColor\", { vp: \"EDGE_SOURCE_ARROW_COLOR\", write: colorOut }],\n [\"targetArrowColor\", { vp: \"EDGE_TARGET_ARROW_COLOR\", write: colorOut }],\n [\"curved\", { vp: \"EDGE_CURVED\", write: (v) => v === true }],\n [\"label\", { vp: \"EDGE_LABEL\", write: textOut }],\n [\"labelColor\", { vp: \"EDGE_LABEL_COLOR\", write: colorOut }],\n [\"labelSize\", { vp: \"EDGE_LABEL_FONT_SIZE\", write: cx2Number }],\n [\"visible\", { vp: \"EDGE_VISIBILITY\", write: (v) => (v === true ? \"element\" : \"none\") }],\n ]),\n },\n};\n\n/**\n * CX2's label position object.\n * @param v - a canonical position\n * @returns the object\n */\nfunction cx2Position(v: StyleValue): unknown {\n const [h, vert] = Object.hasOwn(CX2_ANCHORS, String(v)) ? CX2_ANCHORS[String(v)] : [\"center\", \"center\"];\n return {\n HORIZONTAL_ALIGN: \"center\",\n VERTICAL_ALIGN: \"center\",\n HORIZONTAL_ANCHOR: h,\n VERTICAL_ANCHOR: vert,\n MARGIN_X: 0,\n MARGIN_Y: 0,\n JUSTIFICATION: \"center\",\n };\n}\n\n/** The font properties, written together into one font face. */\nconst FONT_PROPS = [\"labelFont\", \"labelWeight\", \"labelItalic\"] as const;\nconst FONT_VP: Readonly<Record<StyleTarget, string>> = { node: \"NODE_LABEL_FONT_FACE\", edge: \"EDGE_LABEL_FONT_FACE\" };\nconst CSS_TO_JAVA: Readonly<Record<string, string>> = {\n \"sans-serif\": \"SansSerif\",\n serif: \"Serif\",\n monospace: \"Monospaced\",\n};\n\n/**\n * A font face in a dialect's spelling.\n * @param dialect - the dialect\n * @param family - the family, or null\n * @param weight - the weight, or null\n * @param italic - whether italic, or null\n * @param approx - called when the family had to be shortened\n * @returns the face\n */\nfunction fontOut(\n dialect: CytoscapeDialect,\n family: StyleValue | null,\n weight: StyleValue | null,\n italic: StyleValue | null,\n approx: () => void,\n): unknown {\n const bold = weight === \"bold\";\n const it = italic === true;\n const fam = family === null ? \"sans-serif\" : String(family);\n if (dialect === \"cx2\") {\n if (fontReadsAs(fam) !== fam) {\n approx();\n }\n return { FONT_FAMILY: fam, FONT_STYLE: it ? \"italic\" : \"normal\", FONT_WEIGHT: bold ? \"bold\" : \"normal\" };\n }\n const first = fam.includes(\",\") ? fam.split(\",\")[0].trim() : fam;\n const java = Object.hasOwn(CSS_TO_JAVA, first) ? CSS_TO_JAVA[first] : first;\n if (fontReadsAs(java) !== fam) {\n approx();\n }\n return `${java},${javaFontStyle(bold, it)},12`;\n}\n\n/**\n * The style part of a Java font face.\n * @param bold - whether bold\n * @param italic - whether italic\n * @returns `plain`, `bold`, `italic` or `bolditalic`\n */\nfunction javaFontStyle(bold: boolean, italic: boolean): string {\n if (!bold && !italic) {\n return \"plain\";\n }\n return (bold ? \"bold\" : \"\") + (italic ? \"italic\" : \"\");\n}\n\n/**\n * The family a font face reads back as: the reader drops a face suffix (Dialog.plain is Dialog) and reads a Java\n * logical name as the family Cytoscape draws it with (Dialog as sans-serif).\n * @param name - the face\n * @returns the family\n */\nfunction fontReadsAs(name: string): string {\n const family = name.replace(/\\.(?:bold|italic|plain|bolditalic)$/i, \"\");\n return JAVA_FONTS.get(family.toLowerCase()) ?? family;\n}\n\n/**\n * The default name of the column a mapping over a non-data column reads.\n * @param target - nodes or edges\n * @param ref - the column\n * @returns the name\n */\nfunction defaultColumnName(target: StyleTarget, ref: ColumnRef): string {\n if (\"style\" in ref) {\n return `graphty.style.${target}.${ref.style}`;\n }\n return `graphty.style.${target}.${\"computed\" in ref ? ref.computed : (ref as { data: string }).data}`;\n}\n\n/** The kinds of value a Cytoscape passthrough reads the same way the neutral reading does. */\nconst PASSTHROUGH_SAFE: ReadonlySet<string> = new Set([\"color\", \"number\", \"text\", \"boolean\"]);\n\n/**\n * Turns neutral rules into a Cytoscape visual style. Rules over every element become defaults (a constant) and\n * mappings (one per visual property: the topmost wins); a passthrough of a value Cytoscape spells differently (an\n * opacity, a shape) becomes a discrete table over the values the graph holds. Every element whose value under the\n * rules differs from what that style gives gets a bypass, so Cytoscape draws exactly what the rules give; each rule\n * written that way is noted as `W_STYLE_LAYER_FLATTENED`. A property Cytoscape has no visual property for is noted as\n * `W_STYLE_NOT_WRITTEN`, a value changed to the nearest Cytoscape has as `W_STYLE_APPROXIMATED`.\n * @param extracted - the styles, for this graph\n * @param snapshot - the graph\n * @param options - the dialect, notes and column names\n * @returns the style, the bypasses and the columns the writer adds\n * @category Styles\n */\nexport function emitCytoscapeStyle(\n extracted: ExtractedStyles,\n snapshot: GraphSnapshot,\n options: CytoscapeEmitOptions,\n): CytoscapeEmitted {\n const notes = options.notes ?? new StyleNotes();\n const style = emptyCytoscapeStyle();\n const bypasses = {\n node: new Array<Map<string, unknown> | null>(snapshot.nodeCount).fill(null),\n edge: new Array<Map<string, unknown> | null>(snapshot.edgeCount).fill(null),\n };\n const columns = {\n node: new Map<string, readonly (StyleValue | null)[]>(),\n edge: new Map<string, readonly (StyleValue | null)[]>(),\n };\n for (const target of [\"node\", \"edge\"] as const) {\n emitTarget(targetEmit(target, extracted, snapshot, options, notes), style, bypasses[target], columns[target]);\n }\n const bg = extracted.styles.graph.background;\n if (bg !== undefined) {\n style.network.defaults.set(\n options.dialect === \"cx2\" ? \"NETWORK_BACKGROUND_COLOR\" : \"NETWORK_BACKGROUND_PAINT\",\n bg.toUpperCase(),\n );\n }\n return { style, bypasses, columns };\n}\n\n/** The neutral style one target's Cytoscape style gives, being built. */\ninterface Model {\n readonly set: Map<string, StyleValue>;\n readonly map: Map<string, Mapping>;\n readonly mappedBy: Map<string, string>;\n}\n\n/** What emitting one target reads. */\ninterface TargetEmit {\n readonly target: StyleTarget;\n readonly extracted: ExtractedStyles;\n readonly snapshot: GraphSnapshot;\n readonly options: CytoscapeEmitOptions;\n readonly notes: StyleNotes;\n /** The element count. */\n readonly n: number;\n readonly src: ReturnType<typeof refSource>;\n /** The target's rules. */\n readonly rules: readonly StyleRule[];\n /** Every element's value of each property the rules write. */\n readonly truth: ReadonlyMap<string, (StyleValue | null)[]>;\n /** The approximation note of a property. */\n readonly approx: (p: string) => () => void;\n /** The approximation note of a default, counted over the elements that draw it. */\n readonly approxDefault: (p: string, value: StyleValue) => () => void;\n}\n\n/**\n * What emitting one target reads, worked out once.\n * @param target - nodes or edges\n * @param extracted - the styles\n * @param snapshot - the graph\n * @param options - the options\n * @param notes - where losses are noted\n * @returns the target's emission\n */\nfunction targetEmit(\n target: StyleTarget,\n extracted: ExtractedStyles,\n snapshot: GraphSnapshot,\n options: CytoscapeEmitOptions,\n notes: StyleNotes,\n): TargetEmit {\n const n = target === \"node\" ? snapshot.nodeCount : snapshot.edgeCount;\n const src = refSource(target, n, extracted.columns[target], extracted.features[target], snapshot);\n const rules = extracted.styles.rules.filter((r) => r.target === target);\n const written = new Set(rules.flatMap((r) => [...Object.keys(r.set ?? {}), ...Object.keys(r.map ?? {})]));\n const truth = new Map(Array.from(written, (p) => [p, resolveRules(rules, target, p, src)] as const));\n return {\n target,\n extracted,\n snapshot,\n options,\n notes,\n n,\n src,\n rules,\n truth,\n approx: (p) => () => {\n notes.add(STYLE_ISSUE.APPROXIMATED, target, p);\n },\n // a default written as an approximation changes every element that draws it\n approxDefault: (p, value) => () => {\n const count = (truth.get(p) ?? []).filter((v) => v === value).length;\n notes.add(STYLE_ISSUE.APPROXIMATED, target, p, { count: Math.max(count, 1) });\n },\n };\n}\n\n/**\n * Emits one target.\n * @param e - the target's emission\n * @param style - the style being written\n * @param bypasses - the target's bypasses, filled in\n * @param columns - the target's added columns, filled in\n */\nfunction emitTarget(\n e: TargetEmit,\n style: CytoscapeStyle,\n bypasses: (Map<string, unknown> | null)[],\n columns: Map<string, readonly (StyleValue | null)[]>,\n): void {\n const { target, notes, truth } = e;\n const writers = WRITERS[e.options.dialect][target];\n for (const [p, values] of truth) {\n if (!writers.has(p) && !(FONT_PROPS as readonly string[]).includes(p)) {\n const count = values.filter((v) => v !== null).length;\n notes.add(STYLE_ISSUE.NOT_WRITTEN, target, p, { count: Math.max(count, 1) });\n }\n }\n\n // a rule written as per-element values is noted with the elements that carry one, once per property\n const counted = new Set<string>();\n const carrying = (p: string): number => {\n if (counted.has(p)) {\n return 0;\n }\n counted.add(p);\n return Math.max((truth.get(p) ?? []).filter((v) => v !== null).length, 1);\n };\n const model = buildModel(target, e.rules, writers, notes, carrying);\n const s = style[target];\n s.dependencies.set(target === \"node\" ? \"nodeSizeLocked\" : \"arrowColorMatchesEdge\", false);\n for (const [p, w] of writers) {\n if (truth.has(p)) {\n emitProperty(e, s, model, p, w, columns, carrying);\n }\n }\n addBypasses(e, model, writers, bypasses);\n emitFont(e, model, s, bypasses);\n}\n\n/**\n * Emits one property the rules write: its default, and its mapping, or the mapping noted as flattened when\n * Cytoscape cannot read the column it needs.\n * @param e - the target's emission\n * @param s - the target's style\n * @param model - the model; a mapping not written is removed\n * @param p - the property\n * @param w - its writer\n * @param columns - where added columns go\n * @param carrying - how many elements carry a value of a property, once\n */\nfunction emitProperty(\n e: TargetEmit,\n s: CytoscapeStyle[\"node\"],\n model: Model,\n p: string,\n w: Writer,\n columns: Map<string, readonly (StyleValue | null)[]>,\n carrying: (p: string) => number,\n): void {\n const set = model.set.get(p);\n if (set !== undefined) {\n s.defaults.set(w.vp, w.write(set, e.approxDefault(p, set)));\n }\n let m = model.map.get(p);\n if (m === undefined) {\n return;\n }\n if (e.options.dialect === \"cx2\" && m.kind === \"continuous\") {\n m = cx2Points(m, e.approx(p));\n model.map.set(p, m);\n }\n const cm = cytoscapeMapping(e, p, m, w, columns);\n if (cm === null) {\n e.notes.add(STYLE_ISSUE.LAYER_FLATTENED, e.target, p, { sample: model.mappedBy.get(p), count: carrying(p) });\n model.map.delete(p);\n } else {\n s.mappings.set(w.vp, cm);\n }\n}\n\n/**\n * A bypass for every element the written style draws differently from the rules.\n * @param e - the target's emission\n * @param model - the defaults and mappings written\n * @param writers - the dialect's writers\n * @param bypasses - the bypasses, filled in\n */\nfunction addBypasses(\n e: TargetEmit,\n model: Model,\n writers: ReadonlyMap<string, Writer>,\n bypasses: (Map<string, unknown> | null)[],\n): void {\n const { target } = e;\n const modelRules: StyleRule[] = [\n {\n id: \"defaults\",\n target,\n role: \"defaults\",\n origin: \"declared\",\n where: { all: true },\n set: Object.fromEntries(model.set),\n },\n {\n id: \"mappings\",\n target,\n role: \"mapping\",\n origin: \"declared\",\n where: { all: true },\n map: Object.fromEntries(model.map),\n },\n ];\n for (const [p, w] of writers) {\n const want = e.truth.get(p);\n if (want === undefined) {\n continue;\n }\n const drawn = resolveRules(modelRules, target, p, e.src);\n for (let i = 0; i < e.n; i++) {\n const v = want[i];\n if (v !== null && v !== drawn[i]) {\n bypasses[i] ??= new Map();\n bypasses[i]?.set(w.vp, w.write(v, e.approx(p)));\n }\n }\n }\n}\n\n/**\n * The defaults and mappings of one target: rules over every element, bottom to top. A constant over every element\n * hides everything beneath it; of two mappings of one property only the topmost is kept. Every rule that cannot be\n * kept whole is noted as `W_STYLE_LAYER_FLATTENED`.\n * @param target - nodes or edges\n * @param rules - the target's rules\n * @param writers - the dialect's writers\n * @param notes - where flattened rules are noted\n * @param carrying - how many elements carry a value of a property\n * @returns the model\n */\nfunction buildModel(\n target: StyleTarget,\n rules: readonly StyleRule[],\n writers: ReadonlyMap<string, Writer>,\n notes: StyleNotes,\n carrying: (p: string) => number,\n): Model {\n const model: Model = { set: new Map(), map: new Map(), mappedBy: new Map() };\n const flatten = (p: string, id: string): void => {\n notes.add(STYLE_ISSUE.LAYER_FLATTENED, target, p, { sample: id, count: carrying(p) });\n };\n const holds = (p: string): boolean => writers.has(p) || (FONT_PROPS as readonly string[]).includes(p);\n const applySet = (r: StyleRule, all: boolean): void => {\n for (const [p, v] of Object.entries(r.set ?? {})) {\n if (v === undefined || !holds(p)) {\n continue;\n }\n if (!all) {\n flatten(p, r.id);\n continue;\n }\n model.set.set(p, v);\n model.map.delete(p);\n model.mappedBy.delete(p);\n }\n };\n const applyMap = (r: StyleRule, all: boolean): void => {\n for (const [p, m] of Object.entries(r.map ?? {})) {\n if (m === undefined || !holds(p)) {\n continue;\n }\n if (!all || (FONT_PROPS as readonly string[]).includes(p)) {\n flatten(p, r.id);\n continue;\n }\n const below = model.mappedBy.get(p);\n if (below !== undefined) {\n flatten(p, below);\n }\n model.map.set(p, m);\n model.mappedBy.set(p, r.id);\n }\n };\n for (const r of rules) {\n const all = \"all\" in r.where && r.where.all;\n applySet(r, all);\n applyMap(r, all);\n }\n return model;\n}\n\n/**\n * One neutral mapping as a Cytoscape mapping.\n * @param e - the target's emission\n * @param p - the property\n * @param m - the mapping\n * @param w - the property's writer\n * @param columns - where added columns go\n * @returns the mapping, or null when Cytoscape cannot read the column it needs\n */\nfunction cytoscapeMapping(\n e: TargetEmit,\n p: string,\n m: Mapping,\n w: Writer,\n columns: Map<string, readonly (StyleValue | null)[]>,\n): CytoscapeMapping | null {\n const column = mappingColumn(e, m.by, columns);\n if (column === null) {\n return null;\n }\n const approx = e.approx(p);\n const write = (v: StyleValue): unknown => w.write(v, approx);\n if (m.kind === \"passthrough\") {\n return passthroughMapping(e, p, m.by, column, write);\n }\n if (m.kind === \"discrete\") {\n return {\n kind: \"discrete\",\n column,\n type: typeOf(m.table.map(([k]) => k)),\n table: m.table.map(([k, v]) => [k, write(v)]),\n };\n }\n if (m.kind === \"continuous\") {\n const points: CytoscapeContinuousPoint[] = m.points.map((pt: ContinuousPoint) => ({\n at: pt.at,\n below: write(pt.below),\n value: write(pt.value),\n above: write(pt.above),\n }));\n return { kind: \"continuous\", column, type: \"double\", points };\n }\n return null;\n}\n\n/**\n * The column a mapping reads, by its name in the file: a data column's own, else an added column of the style\n * column's or the degree's values.\n * @param e - the target's emission\n * @param ref - the column\n * @param columns - where added columns go\n * @returns the name, or null when the values cannot be written (a degree of an edge)\n */\nfunction mappingColumn(\n e: TargetEmit,\n ref: ColumnRef,\n columns: Map<string, readonly (StyleValue | null)[]>,\n): string | null {\n if (\"data\" in ref) {\n return ref.data;\n }\n const { target } = e;\n const column = (e.options.columnName ?? defaultColumnName)(target, ref);\n let values: readonly (StyleValue | null)[] | null = null;\n if (\"style\" in ref) {\n values = e.extracted.columns[target].get(ref.style) ?? null;\n } else if (\"computed\" in ref && target === \"node\") {\n values = degreeValues(e.snapshot, ref.computed);\n }\n if (values === null) {\n return null;\n }\n columns.set(column, values);\n return column;\n}\n\n/**\n * A passthrough as Cytoscape reads it: a passthrough where Cytoscape reads the values as the neutral reading does,\n * else a table over the values the graph holds, in Cytoscape's spelling.\n * @param e - the target's emission\n * @param p - the property\n * @param by - the column\n * @param column - its name in the file\n * @param write - a value in Cytoscape's spelling\n * @returns the mapping\n */\nfunction passthroughMapping(\n e: TargetEmit,\n p: string,\n by: ColumnRef,\n column: string,\n write: (v: StyleValue) => unknown,\n): CytoscapeMapping {\n const { target } = e;\n const kind = STYLE_PROPERTIES[target].get(p) ?? \"\";\n const cells = e.src.column(by) ?? [];\n if (PASSTHROUGH_SAFE.has(kind)) {\n return { kind: \"passthrough\", column, type: typeOf(Array.from(cells)) };\n }\n const read = \"style\" in by ? (v: unknown): StyleValue | null => (isScalar(v) ? v : null) : canonicalFor(target, p);\n const seen = new Map<Scalar, unknown>();\n for (let i = 0; i < cells.length; i++) {\n const raw = cells[i];\n const v = isScalar(raw) && !seen.has(raw) ? read(raw) : null;\n if (v !== null) {\n seen.set(raw as Scalar, write(v));\n }\n }\n const table = Array.from(seen);\n return { kind: \"discrete\", column, type: typeOf(table.map(([k]) => k)), table };\n}\n\n/**\n * A continuous mapping as CX2 holds it: CX2's intervals give the value exactly at a point only as the value just\n * below or just above it, so a third value becomes the one below (noted; the elements exactly at it get bypasses).\n * @param m - the mapping\n * @param approx - called when a point changes\n * @returns the mapping CX2 reads back\n */\nfunction cx2Points(m: Extract<Mapping, { kind: \"continuous\" }>, approx: () => void): Mapping {\n let changed = false;\n const points = m.points.map((pt) => {\n if (pt.value === pt.below || pt.value === pt.above) {\n return pt;\n }\n changed = true;\n return { ...pt, value: pt.below };\n });\n if (!changed) {\n return m;\n }\n approx();\n return { ...m, points };\n}\n\n/**\n * Whether a value is a scalar.\n * @param v - the value\n * @returns true for a string, a finite number or a boolean\n */\nfunction isScalar(v: unknown): v is Scalar {\n return typeof v === \"string\" || typeof v === \"boolean\" || (typeof v === \"number\" && Number.isFinite(v));\n}\n\n/**\n * Cytoscape's attribute type of a set of values: `integer`, `double`, `boolean` or `string`.\n * @param values - the values\n * @returns the type\n */\nfunction typeOf(values: readonly unknown[]): string {\n let numbers = 0;\n let integers = 0;\n let booleans = 0;\n let all = 0;\n for (const v of values) {\n if (v === null || v === undefined) {\n continue;\n }\n all++;\n if (typeof v === \"number\") {\n numbers++;\n if (Number.isInteger(v)) {\n integers++;\n }\n } else if (typeof v === \"boolean\") {\n booleans++;\n }\n }\n if (all > 0 && numbers === all) {\n return integers === all ? \"integer\" : \"double\";\n }\n if (all > 0 && booleans === all) {\n return \"boolean\";\n }\n return \"string\";\n}\n\n/**\n * The font face: a default from the constant font properties, and a bypass for every element whose family, weight\n * or italic differs from it.\n * @param e - the target's emission\n * @param model - the model\n * @param s - the target's style\n * @param bypasses - the bypasses\n */\nfunction emitFont(\n e: TargetEmit,\n model: Model,\n s: CytoscapeStyle[\"node\"],\n bypasses: (Map<string, unknown> | null)[],\n): void {\n const { target, truth, n, approx, approxDefault } = e;\n const { dialect } = e.options;\n if (!FONT_PROPS.some((p) => truth.has(p))) {\n return;\n }\n const [fd, wd, id] = FONT_PROPS.map((p) => model.set.get(p) ?? null);\n const vp = FONT_VP[target];\n if (fd !== null || wd !== null || id !== null) {\n s.defaults.set(\n vp,\n fontOut(dialect, fd, wd, id, fd === null ? approx(\"labelFont\") : approxDefault(\"labelFont\", fd)),\n );\n }\n const [ft, wt, it] = FONT_PROPS.map((p) => truth.get(p) ?? null);\n for (let i = 0; i < n; i++) {\n const f = ft?.[i] ?? null;\n const w = wt?.[i] ?? null;\n const t = it?.[i] ?? null;\n const differs = (f !== null && f !== fd) || (w !== null && w !== wd) || (t !== null && t !== id);\n if (differs) {\n bypasses[i] ??= new Map();\n bypasses[i]?.set(vp, fontOut(dialect, f ?? fd, w ?? wd, t ?? id, approx(\"labelFont\")));\n }\n }\n}\n\n// ------------------------------------------------------------------ the file forms\n\n/**\n * A raw value as text: `,` doubled inside a CX version 1 definition.\n * @param v - the value\n * @returns the text\n */\nfunction defText(v: unknown): string {\n return String(v).replaceAll(\",\", \",,\");\n}\n\n/**\n * A mapping as a CX version 1 definition string.\n * @param m - the mapping\n * @returns the definition\n * @category Styles\n */\nexport function cx1Definition(m: CytoscapeMapping): string {\n const parts = [`COL=${defText(m.column)}`, `T=${m.type ?? \"string\"}`];\n if (m.kind === \"discrete\") {\n m.table.forEach(([k, v], i) => {\n parts.push(`K=${i}=${defText(k)}`, `V=${i}=${defText(v)}`);\n });\n } else if (m.kind === \"continuous\") {\n m.points.forEach((p, i) => {\n parts.push(\n `L=${i}=${defText(p.below)}`,\n `E=${i}=${defText(p.value)}`,\n `G=${i}=${defText(p.above)}`,\n `OV=${i}=${p.at}`,\n );\n });\n }\n return parts.join(\",\");\n}\n\n/**\n * A record of a Map with text keys.\n * @param map - the map\n * @param value - how each value is written\n * @returns the record\n */\nfunction recordOf<V>(map: ReadonlyMap<string, V>, value: (v: V) => unknown): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const [k, v] of map) {\n Object.defineProperty(out, k, { value: value(v), enumerable: true, writable: true, configurable: true });\n }\n return out;\n}\n\n/**\n * A style (in the desktop dialect) as the default entries of a CX version 1 `cyVisualProperties` aspect: `network`,\n * `nodes:default` and `edges:default`, with every value as text and every mapping as a definition string. The\n * writer adds each element's bypasses as `nodes` / `edges` entries.\n * @param style - the style\n * @returns the entries\n * @category Styles\n */\nexport function cytoscapeCxAspect(style: CytoscapeStyle): Record<string, unknown>[] {\n const entry = (of: string, t: CytoscapeStyle[\"node\"]): Record<string, unknown> => ({\n properties_of: of,\n properties: recordOf(t.defaults, String),\n dependencies: recordOf(t.dependencies, String),\n mappings: recordOf(t.mappings, (m) => ({ type: m.kind.toUpperCase(), definition: cx1Definition(m) })),\n });\n return [\n { properties_of: \"network\", properties: recordOf(style.network.defaults, String) },\n entry(\"nodes:default\", style.node),\n entry(\"edges:default\", style.edge),\n ];\n}\n\n/**\n * A continuous mapping's points as CX2 intervals: below the first point, between each two, above the last. The\n * value exactly at a point is the interval that includes it.\n * @param points - the points\n * @returns the intervals\n */\nfunction cx2Intervals(points: readonly CytoscapeContinuousPoint[]): Record<string, unknown>[] {\n const same = (a: unknown, b: unknown): boolean => JSON.stringify(a) === JSON.stringify(b);\n const out: Record<string, unknown>[] = [];\n for (let i = 0; i <= points.length; i++) {\n const lo = points.at(i - 1);\n const hi = points.at(i);\n const iv: Record<string, unknown> = {};\n if (i > 0 && lo !== undefined) {\n iv.min = lo.at;\n iv.minVPValue = lo.above;\n iv.includeMin = same(lo.value, lo.above);\n }\n if (i < points.length && hi !== undefined) {\n iv.max = hi.at;\n iv.maxVPValue = hi.below;\n iv.includeMax = !same(hi.value, hi.above) && same(hi.value, hi.below);\n }\n out.push(iv);\n }\n return out;\n}\n\n/**\n * A style (in the CX2 dialect) as CX2's `visualProperties` and `visualEditorProperties` aspects. The writer adds the\n * bypasses as `nodeBypasses` / `edgeBypasses`.\n * @param style - the style\n * @returns the two aspects\n * @category Styles\n */\nexport function cytoscapeCx2Aspects(style: CytoscapeStyle): {\n /** The `visualProperties` aspect. */\n visualProperties: Record<string, unknown>[];\n /** The `visualEditorProperties` aspect. */\n visualEditorProperties: Record<string, unknown>[];\n} {\n const mapping = (m: CytoscapeMapping): Record<string, unknown> => {\n if (m.kind === \"passthrough\") {\n return { type: \"PASSTHROUGH\", definition: { attribute: m.column } };\n }\n if (m.kind === \"discrete\") {\n return {\n type: \"DISCRETE\",\n definition: { attribute: m.column, map: m.table.map(([v, vp]) => ({ v, vp })) },\n };\n }\n return { type: \"CONTINUOUS\", definition: { attribute: m.column, map: cx2Intervals(m.points) } };\n };\n const id = (v: unknown): unknown => v;\n return {\n visualProperties: [\n {\n default: {\n network: recordOf(style.network.defaults, id),\n node: recordOf(style.node.defaults, id),\n edge: recordOf(style.edge.defaults, id),\n },\n nodeMapping: recordOf(style.node.mappings, mapping),\n edgeMapping: recordOf(style.edge.mappings, mapping),\n },\n ],\n visualEditorProperties: [\n {\n properties: {\n nodeSizeLocked: style.node.dependencies.get(\"nodeSizeLocked\") === true,\n arrowColorMatchesEdge: style.edge.dependencies.get(\"arrowColorMatchesEdge\") === true,\n },\n },\n ],\n };\n}\n\n/**\n * An attribute pair.\n * @param name - the attribute\n * @param value - its value\n * @returns ` name=\"value\"`, escaped\n */\nfunction attr(name: string, value: unknown): string {\n return ` ${name}=\"${escapeXmlAttribute(String(value))}\"`;\n}\n\n/**\n * A style (in the desktop dialect) as one `<visualStyle>` element of a session's `session_vizmap.xml`.\n * @param style - the style\n * @param name - the style's name\n * @returns the element's XML\n * @category Styles\n */\nexport function cytoscapeVizmapXml(style: CytoscapeStyle, name: string): string {\n const lines = [`<visualStyle${attr(\"name\", name)}>`];\n const section = (tag: string, defaults: ReadonlyMap<string, unknown>, t?: CytoscapeStyle[\"node\"]): void => {\n lines.push(` <${tag}>`);\n for (const [dep, on] of t?.dependencies ?? []) {\n lines.push(` <dependency${attr(\"name\", dep)}${attr(\"value\", on)}/>`);\n }\n const vps = new Set([...defaults.keys(), ...(t?.mappings.keys() ?? [])]);\n for (const vp of vps) {\n const d = defaults.has(vp) ? attr(\"default\", defaults.get(vp)) : \"\";\n const m = t?.mappings.get(vp);\n if (m === undefined) {\n lines.push(` <visualProperty${attr(\"name\", vp)}${d}/>`);\n } else {\n lines.push(` <visualProperty${attr(\"name\", vp)}${d}>`, ...mappingXml(m), \" </visualProperty>\");\n }\n }\n lines.push(` </${tag}>`);\n };\n section(\"network\", style.network.defaults);\n section(\"node\", style.node.defaults, style.node);\n section(\"edge\", style.edge.defaults, style.edge);\n lines.push(\"</visualStyle>\");\n return lines.join(\"\\n\");\n}\n\n/**\n * A mapping as the lines of its `session_vizmap.xml` element.\n * @param m - the mapping\n * @returns the lines\n */\nfunction mappingXml(m: CytoscapeMapping): string[] {\n const head = `${attr(\"attributeName\", m.column)}${attr(\"attributeType\", m.kind === \"continuous\" ? \"float\" : (m.type ?? \"string\"))}`;\n if (m.kind === \"passthrough\") {\n return [` <passthroughMapping${head}/>`];\n }\n if (m.kind === \"discrete\") {\n return [\n ` <discreteMapping${head}>`,\n ...m.table.map(\n ([k, v]) => ` <discreteMappingEntry${attr(\"attributeValue\", k)}${attr(\"value\", v)}/>`,\n ),\n \" </discreteMapping>\",\n ];\n }\n return [\n ` <continuousMapping${head}>`,\n ...m.points.map(\n (p) =>\n ` <continuousMappingPoint${attr(\"attrValue\", p.at)}${attr(\"lesserValue\", p.below)}${attr(\"equalValue\", p.value)}${attr(\"greaterValue\", p.above)}/>`,\n ),\n \" </continuousMapping>\",\n ];\n}\n\n// ------------------------------------------------------------------ per-element values\n\n/**\n * The neutral properties a Cytoscape dialect holds per element: what a writer of resolved per-element values (XGMML\n * graphics, a session view's bypasses) can write.\n * @param target - nodes or edges\n * @param dialect - the spelling\n * @returns the properties\n */\nexport function cytoscapeWritableProperties(target: StyleTarget, dialect: CytoscapeDialect): string[] {\n return [...WRITERS[dialect][target].keys(), ...FONT_PROPS];\n}\n\n/**\n * One element's values as Cytoscape visual properties in a dialect's spelling, for a writer of per-element values.\n * The label font, weight and italic are written together as one font face.\n * @param target - nodes or edges\n * @param value - the element's value of a neutral property, or null\n * @param dialect - the spelling\n * @param approx - called with the property when a value is written as its nearest\n * @returns visual property name to raw value\n */\nexport function cytoscapeElementProperties(\n target: StyleTarget,\n value: (property: string) => StyleValue | null,\n dialect: CytoscapeDialect,\n approx: (property: string) => void,\n): Map<string, unknown> {\n const out = new Map<string, unknown>();\n for (const [p, w] of WRITERS[dialect][target]) {\n const v = value(p);\n if (v !== null) {\n out.set(\n w.vp,\n w.write(v, () => {\n approx(p);\n }),\n );\n }\n }\n const [f, wt, it] = FONT_PROPS.map((p) => value(p));\n if (f !== null || wt !== null || it !== null) {\n out.set(\n FONT_VP[target],\n fontOut(dialect, f, wt, it, () => {\n approx(\"labelFont\");\n }),\n );\n }\n return out;\n}\n","/**\n * Cytoscape's own resolution of a visual style, per element: a bypass over a mapping over a default, per visual\n * property, with the dependencies applied (`nodeSizeLocked` makes `NODE_SIZE` drive width and height,\n * `arrowColorMatchesEdge` makes the edge's paint drive the line and both arrows). Every pass is linear in the number\n * of elements plus the size of the style, and spends from the extraction's one budget.\n */\n\nimport type { CanonSite } from \"../canon/site.js\";\nimport { STYLE_ISSUE } from \"../codes.js\";\nimport { toolDefaults } from \"../defaults.js\";\nimport { StyleNotes } from \"../notes.js\";\nimport { discreteLookup, evalContinuous, numberOf } from \"../plan/resolve.js\";\nimport type {\n ContinuousPoint,\n Scalar,\n StyleColor,\n StyleColumn,\n StyleTarget,\n StyleTool,\n StyleValue,\n StyleWorkBudget,\n} from \"../types.js\";\nimport { isStyleValue } from \"../vocabulary.js\";\nimport {\n colorParser,\n CYTOSCAPE_LEXICON,\n type CytoscapeValueParser,\n isUncarriedVp,\n NODE_SIZE_VP,\n sizeParser,\n} from \"./lexicon.js\";\nimport {\n type CytoscapeContinuousPoint,\n type CytoscapeMapping,\n type CytoscapeStyle,\n type CytoscapeTargetStyle,\n emptyCytoscapeStyle,\n} from \"./mappings.js\";\n\n/**\n * One element's bypasses: visual property name to raw value; null or undefined when it has none.\n * @category Styles\n */\nexport type CytoscapeBypass = ReadonlyMap<string, unknown> | null | undefined;\n\n/**\n * The elements of one target a style is resolved over.\n * @category Styles\n */\nexport interface CytoscapeElements {\n /** How many elements there are. */\n readonly count: number;\n /**\n * An element's value of an attribute column (a list attribute as an array), or null.\n * @param column - the column's name\n * @param i - the element index\n * @returns the value\n */\n value(column: string, i: number): unknown;\n /** Each element's bypasses, by element index. */\n readonly bypasses?: readonly CytoscapeBypass[];\n}\n\n/**\n * Options of `resolveCytoscape()`.\n * @category Styles\n */\nexport interface CytoscapeResolveOptions {\n /** Where problems are noted. */\n readonly notes?: StyleNotes;\n /** The counted work budget. */\n readonly budget?: StyleWorkBudget;\n /**\n * Whose defaults fill what the style leaves unset: `\"cytoscape\"` (the desktop's default visual style, for CX,\n * CX2 and XGMML), `\"cytoscape-fallbacks\"` (the renderer's fallbacks, for sessions) or null for none, so an\n * element the style says nothing about is null. Defaults to null.\n */\n readonly defaults?: StyleTool | null;\n}\n\n/** Locked node sizes with no `NODE_SIZE` anywhere draw at Cytoscape's lexicon default. */\nconst NODE_SIZE_FALLBACK = 50;\n\n/** A visual property and the parser that reads it for one neutral property. */\ntype VpChoice = readonly [vp: string, parse: CytoscapeValueParser];\n\n/**\n * Which visual properties a style or its bypasses mention.\n * @param style - the target's style\n * @param bypasses - the elements' bypasses\n * @returns the names used anywhere, and those used by a bypass\n */\nexport function vpUsage(\n style: CytoscapeTargetStyle,\n bypasses: readonly CytoscapeBypass[],\n): { used: Set<string>; bypassed: Set<string> } {\n const bypassed = new Set<string>();\n for (const b of bypasses) {\n if (b) {\n for (const k of b.keys()) {\n bypassed.add(k);\n }\n }\n }\n for (const [from, to] of style.bypassAliases) {\n if (bypassed.has(from)) {\n bypassed.add(to);\n }\n }\n const used = new Set([...style.defaults.keys(), ...style.mappings.keys(), ...bypassed]);\n return { used, bypassed };\n}\n\n/**\n * Which visual property sets each neutral property: the first of its lexicon list the style or any bypass\n * mentions, with the dependencies applied.\n * @param target - nodes or edges\n * @param style - the target's style\n * @param used - the visual properties used anywhere\n * @returns property to its visual property and parser\n */\nexport function chooseVps(\n target: StyleTarget,\n style: CytoscapeTargetStyle,\n used: ReadonlySet<string>,\n): Map<string, VpChoice> {\n const chosen = new Map<string, VpChoice>();\n for (const [prop, list] of CYTOSCAPE_LEXICON[target]) {\n const hit = list.find(([vp]) => used.has(vp));\n if (hit !== undefined) {\n chosen.set(prop, hit);\n }\n }\n if (target === \"node\" && style.dependencies.get(\"nodeSizeLocked\") === true) {\n chosen.delete(\"width\");\n chosen.delete(\"height\");\n }\n if (target === \"edge\" && style.dependencies.get(\"arrowColorMatchesEdge\") === true) {\n if (used.has(\"EDGE_UNSELECTED_PAINT\")) {\n chosen.set(\"color\", [\"EDGE_UNSELECTED_PAINT\", colorParser]);\n }\n chosen.delete(\"sourceArrowColor\");\n chosen.delete(\"targetArrowColor\");\n }\n return chosen;\n}\n\n/**\n * A mapping with its values read for one property.\n * @category Styles\n */\nexport type ParsedMapping =\n | { readonly kind: \"passthrough\"; readonly column: string }\n | { readonly kind: \"discrete\"; readonly column: string; readonly table: readonly (readonly [Scalar, StyleValue])[] }\n | { readonly kind: \"continuous\"; readonly column: string; readonly points: readonly ContinuousPoint[] };\n\n/**\n * Reads a mapping's raw values with a property's parser: table entries and points whose values do not parse are\n * dropped (and noted), points are sorted, and of two points at the same value the later one wins.\n * @param m - the mapping\n * @param parse - the property's parser\n * @param site - where problems are noted\n * @returns the mapping with canonical values\n */\nexport function parseMapping(m: CytoscapeMapping, parse: CytoscapeValueParser, site: CanonSite): ParsedMapping {\n switch (m.kind) {\n case \"passthrough\":\n return { kind: \"passthrough\", column: m.column };\n case \"discrete\": {\n const table: [Scalar, StyleValue][] = [];\n for (const [k, raw] of m.table) {\n const v = parse(raw, site);\n if (v !== null) {\n table.push([k, v]);\n }\n }\n return { kind: \"discrete\", column: m.column, table };\n }\n default:\n return { kind: \"continuous\", column: m.column, points: parsePoints(m.points, parse, site) };\n }\n}\n\n/**\n * A continuous mapping's points with canonical values: points whose values do not parse are dropped (and noted),\n * points are sorted, and of two points at the same value the later one wins.\n * @param raw - the points\n * @param parse - the property's parser\n * @param site - where problems are noted\n * @returns the points\n */\nfunction parsePoints(\n raw: readonly CytoscapeContinuousPoint[],\n parse: CytoscapeValueParser,\n site: CanonSite,\n): ContinuousPoint[] {\n const parsed: ContinuousPoint[] = [];\n for (const p of raw) {\n const below = parse(p.below, site);\n const value = parse(p.value, site);\n const above = parse(p.above, site);\n if (below !== null && value !== null && above !== null) {\n parsed.push({ at: p.at, below, value, above });\n }\n }\n parsed.sort((a, b) => a.at - b.at);\n const points: ContinuousPoint[] = [];\n for (const p of parsed) {\n if (points.at(-1)?.at === p.at) {\n points[points.length - 1] = p;\n } else {\n points.push(p);\n }\n }\n return points;\n}\n\n/**\n * One mapping evaluated for one element's attribute value.\n * @param m - the parsed mapping\n * @param value - the element's value\n * @param parse - the property's parser, for a passthrough\n * @param site - where problems are noted\n * @returns the value, or null when the mapping gives none\n */\nfunction evalMapping(\n m: ParsedMapping,\n value: unknown,\n parse: CytoscapeValueParser,\n site: CanonSite,\n): StyleValue | null {\n if (value === null || value === undefined) {\n return null;\n }\n switch (m.kind) {\n case \"passthrough\":\n return Array.isArray(value) ? null : parse(value, site);\n case \"discrete\": {\n const j = discreteLookup(m.table)(value);\n return j < 0 ? null : m.table[j][1];\n }\n default:\n return evalContinuous(m.points, numberOf(value));\n }\n}\n\n/** The resolver of one target: reads one visual property for one element. */\ninterface Resolver {\n readonly bypass: (i: number, vp: string) => unknown;\n readonly one: (vp: string, parse: CytoscapeValueParser, property: string, i: number) => StyleValue | null;\n}\n\n/**\n * Builds the per-element reader of one target's style.\n * @param target - nodes or edges\n * @param style - the target's style\n * @param elements - the elements\n * @param notes - where problems are noted\n * @param budget - the work budget\n * @returns the reader\n */\nfunction resolver(\n target: StyleTarget,\n style: CytoscapeTargetStyle,\n elements: CytoscapeElements,\n notes: StyleNotes,\n budget: StyleWorkBudget | undefined,\n): Resolver {\n const bypasses = elements.bypasses ?? [];\n const parsed = new Map<string, ParsedMapping>();\n const ruleSite = (property: string): CanonSite => ({ notes, target, property, budget });\n const bypass = (i: number, vp: string): unknown => {\n const b = bypasses[i];\n if (!b) {\n return undefined;\n }\n const v = b.get(vp);\n if (v !== undefined && v !== null) {\n return v;\n }\n for (const [from, to] of style.bypassAliases) {\n if (to === vp && !b.has(to)) {\n return b.get(from);\n }\n }\n return undefined;\n };\n // a mapping parsed once per visual property and neutral property\n const mappingOf = (vp: string, parse: CytoscapeValueParser, property: string): ParsedMapping | undefined => {\n const raw = style.mappings.get(vp);\n if (raw === undefined) {\n return undefined;\n }\n const key = `${vp}\\u0000${property}`;\n let m = parsed.get(key);\n if (m === undefined) {\n const entries = raw.kind === \"discrete\" ? raw.table.length : 0;\n budget?.spend(target, 1 + entries + (raw.kind === \"continuous\" ? raw.points.length : 0));\n m = parseMapping(raw, parse, ruleSite(property));\n parsed.set(key, m);\n }\n return m;\n };\n const one = (vp: string, parse: CytoscapeValueParser, property: string, i: number): StyleValue | null => {\n const site: CanonSite = { notes, target, property, element: i, budget };\n const b = bypass(i, vp);\n const fromBypass = b === undefined || b === null ? null : parse(b, site);\n if (fromBypass !== null) {\n return fromBypass;\n }\n const m = mappingOf(vp, parse, property);\n const mapped = m === undefined ? null : evalMapping(m, elements.value(m.column, i), parse, site);\n if (mapped !== null) {\n return mapped;\n }\n return style.defaults.has(vp) ? parse(style.defaults.get(vp), ruleSite(property)) : null;\n };\n return { bypass, one };\n}\n\n/**\n * Every element's value per neutral property under a Cytoscape style, the way Cytoscape draws it: per visual\n * property a bypass, else the mapping's value, else the default; `nodeSizeLocked` and `arrowColorMatchesEdge`\n * applied. `EDGE_CURVED` only rounds an edge's bends, so an edge without bends is `curved: false`. Visual properties\n * no neutral property carries are noted as `W_STYLE_NOT_CARRIED`.\n * @param target - nodes or edges\n * @param style - the style\n * @param elements - the elements, their attribute values and their bypasses\n * @param options - notes, the budget and whose defaults fill what the style leaves unset\n * @returns per property, each element's value (null where nothing gives one)\n * @category Styles\n */\nexport function resolveCytoscape(\n target: StyleTarget,\n style: CytoscapeStyle,\n elements: CytoscapeElements,\n options: CytoscapeResolveOptions = {},\n): Partial<Record<string, StyleColumn>> {\n const notes = options.notes ?? new StyleNotes();\n const s = style[target];\n const n = elements.count;\n const { used, bypassed } = vpUsage(s, elements.bypasses ?? []);\n const chosen = chooseVps(target, s, used);\n const { one } = resolver(target, s, elements, notes, options.budget);\n const out: Partial<Record<string, StyleColumn>> = {};\n const column = (vp: string, parse: CytoscapeValueParser, property: string): (StyleValue | null)[] => {\n options.budget?.spend(target, n);\n const values = new Array<StyleValue | null>(n);\n for (let i = 0; i < n; i++) {\n values[i] = one(vp, parse, property, i);\n }\n return values;\n };\n for (const [prop, [vp, parse]] of chosen) {\n out[prop] = column(vp, parse, prop);\n }\n if (target === \"node\" && s.dependencies.get(\"nodeSizeLocked\") === true) {\n const size = column(NODE_SIZE_VP, sizeParser, \"width\").map((v) => v ?? NODE_SIZE_FALLBACK);\n out.width = size;\n out.height = size.slice();\n }\n if (target === \"edge\" && s.dependencies.get(\"arrowColorMatchesEdge\") === true && out.color !== undefined) {\n out.sourceArrowColor = out.color.slice();\n out.targetArrowColor = out.color.slice();\n }\n noteUncarried(target, s, used, bypassed, notes);\n fillToolDefaults(target, out, n, options.defaults ?? null);\n if (target === \"edge\") {\n straightenBendless(out, one);\n }\n return out;\n}\n\n/**\n * Marks straight every curved edge without bends: `EDGE_CURVED` only rounds the bends an edge has.\n * @param out - the values per property, changed in place\n * @param one - reads one visual property of one element\n */\nfunction straightenBendless(out: Partial<Record<string, StyleColumn>>, one: Resolver[\"one\"]): void {\n const { curved } = out;\n if (curved !== undefined) {\n out.curved = curved.map((c, i) => (c === true ? one(EDGE_BEND_VP, bendParser, \"curved\", i) === true : c));\n }\n}\n\n/** An edge's bend handles. */\nexport const EDGE_BEND_VP = \"EDGE_BEND\";\n\n/**\n * Whether an `EDGE_BEND` value holds any handle: Cytoscape writes an edge without bends as an empty string.\n * @param raw - the value\n * @returns true when the edge bends\n */\nexport const bendParser: CytoscapeValueParser = (raw) => {\n if (typeof raw === \"string\") {\n const text = raw.trim();\n return text !== \"\" && text !== '\"\"';\n }\n return Array.isArray(raw) ? raw.length > 0 : raw !== null && raw !== undefined && typeof raw === \"object\";\n};\n\n/** Default values that mean \"nothing drawn\": a VP left at one of these is not worth a note. */\nconst INERT_DEFAULT = /NullCustomGraphics|^255$|^0(?:\\.0+)?$|^$|^C,C,c,0\\.00,0\\.00$|^false$/;\n\n/**\n * Notes every visual property the style uses that no neutral property carries.\n * @param target - nodes or edges\n * @param s - the target's style\n * @param used - the visual properties used anywhere\n * @param bypassed - those used by a bypass\n * @param notes - where to note\n */\nfunction noteUncarried(\n target: StyleTarget,\n s: CytoscapeTargetStyle,\n used: ReadonlySet<string>,\n bypassed: ReadonlySet<string>,\n notes: StyleNotes,\n): void {\n for (const vp of used) {\n if (!isUncarriedVp(vp)) {\n continue;\n }\n const d = s.defaults.get(vp);\n const text = typeof d === \"string\" || typeof d === \"number\" || typeof d === \"boolean\" ? String(d) : \"\";\n if (INERT_DEFAULT.test(text.slice(0, 64)) && !s.mappings.has(vp) && !bypassed.has(vp)) {\n continue;\n }\n notes.add(STYLE_ISSUE.NOT_CARRIED, target, vp, { sample: text });\n }\n}\n\n/**\n * Fills what nothing gave with a tool's defaults.\n * @param target - nodes or edges\n * @param out - the values per property\n * @param n - the element count\n * @param tool - the tool, or null for none\n */\nfunction fillToolDefaults(\n target: StyleTarget,\n out: Partial<Record<string, StyleColumn>>,\n n: number,\n tool: StyleTool | null,\n): void {\n const d = tool === null ? null : toolDefaults(tool);\n if (d === null) {\n return;\n }\n for (const [prop, entry] of Object.entries(d[target]) as [string, { value: unknown } | undefined][]) {\n if (entry === undefined || !isStyleValue(target, prop, entry.value)) {\n continue;\n }\n const value = entry.value as StyleValue;\n const values = out[prop] === undefined ? new Array<StyleValue | null>(n).fill(null) : out[prop].slice();\n for (let i = 0; i < n; i++) {\n values[i] ??= value;\n }\n out[prop] = values;\n }\n}\n\n/**\n * The style's network background color (`NETWORK_BACKGROUND_PAINT`, CX2's `NETWORK_BACKGROUND_COLOR`).\n * @param style - the style\n * @param notes - where a bad value is noted\n * @returns the color, or null\n * @category Styles\n */\nexport function cytoscapeBackground(style: CytoscapeStyle, notes?: StyleNotes): StyleColor | null {\n const d = style.network.defaults;\n const raw = d.get(\"NETWORK_BACKGROUND_PAINT\") ?? d.get(\"NETWORK_BACKGROUND_COLOR\");\n if (raw === undefined) {\n return null;\n }\n const v = colorParser(raw, { notes: notes ?? new StyleNotes(), target: \"graph\", property: \"background\" });\n return typeof v === \"string\" ? (v as StyleColor) : null;\n}\n\n/**\n * Every element's values when each element carries its own resolved visual properties and no style (XGMML files\n * and Cytoscape 2.x sessions). Width and height are read from `NODE_SIZE` when no element states them; keys with no\n * visual property name (`?<key>` from `normalizeVisualProperties()`) are noted as `W_STYLE_NOT_CARRIED`.\n * @param target - nodes or edges\n * @param maps - each element's visual properties\n * @param options - notes, the budget and whose defaults fill what is unset\n * @returns per property, each element's value\n * @category Styles\n */\nexport function resolveCytoscapeBypasses(\n target: StyleTarget,\n maps: readonly CytoscapeBypass[],\n options: CytoscapeResolveOptions = {},\n): Partial<Record<string, StyleColumn>> {\n const notes = options.notes ?? new StyleNotes();\n const style = emptyCytoscapeStyle();\n const elements: CytoscapeElements = { count: maps.length, value: () => null, bypasses: maps };\n const out = resolveCytoscape(target, style, elements, { notes, budget: options.budget });\n if (target === \"node\" && out.width === undefined) {\n const size = maps.map((m) => {\n const raw = m?.get(NODE_SIZE_VP);\n return raw === undefined ? null : sizeParser(raw, { notes, target, property: \"width\" });\n });\n if (size.some((v) => v !== null)) {\n out.width = size;\n out.height = size.slice();\n }\n }\n for (const m of maps) {\n if (!m) {\n continue;\n }\n for (const [k, v] of m) {\n if (k.startsWith(\"?\")) {\n notes.add(STYLE_ISSUE.NOT_CARRIED, target, k.slice(1), { sample: v });\n }\n }\n }\n fillToolDefaults(target, out, maps.length, options.defaults ?? null);\n return out;\n}\n","/**\n * A Cytoscape visual style as neutral rules: the defaults as one rule, then one rule per mapped column and kind.\n * Cytoscape's precedence (a mapping over a default) becomes rule order. Bypasses are not rules: they are the\n * per-element exceptions the planner lays on top of these.\n */\n\nimport type { CanonSite } from \"../canon/site.js\";\nimport { StyleNotes } from \"../notes.js\";\nimport { canonicalFor } from \"../plan/resolve.js\";\nimport type { ColumnRef, Mapping, StyleColumn, StyleRule, StyleTarget, StyleValue, StyleWorkBudget } from \"../types.js\";\nimport { type CytoscapeValueParser, NODE_SIZE_VP, sizeParser } from \"./lexicon.js\";\nimport type { CytoscapeMapping, CytoscapeStyle } from \"./mappings.js\";\nimport {\n bendParser,\n chooseVps,\n type CytoscapeElements,\n EDGE_BEND_VP,\n type ParsedMapping,\n parseMapping,\n vpUsage,\n} from \"./resolve.js\";\n\n/**\n * Options of `cytoscapeRules()`.\n * @category Styles\n */\nexport interface CytoscapeTranslateOptions {\n /** Where problems are noted. */\n readonly notes?: StyleNotes;\n /** The counted work budget. */\n readonly budget?: StyleWorkBudget;\n /**\n * The column a mapping over a file column reads; defaults to `{ data: column }`. A writer's own tagged columns\n * map back to style columns here.\n */\n readonly columnRef?: (column: string) => ColumnRef;\n}\n\n/**\n * Neutral rules of a Cytoscape style, and the style columns they read.\n * @category Styles\n */\nexport interface CytoscapeRules {\n /** The rules, bottom to top. */\n readonly rules: StyleRule[];\n /**\n * Style columns by key: a passthrough whose file values Cytoscape reads differently from their plain reading\n * (a 0..255 transparency, `ROUND_RECTANGLE`) reads its values from `cytoscape.<property>` instead.\n */\n readonly columns: Map<string, StyleColumn>;\n}\n\n/** A rule being built from one column and mapping kind. */\ninterface MappingRule {\n readonly id: string;\n readonly map: Record<string, Mapping>;\n}\n\n/**\n * Translates one target's Cytoscape style into neutral rules: one `defaults` rule over every element, then one\n * `mapping` rule per mapped column and mapping kind (`node.discrete.Type`), with `nodeSizeLocked` and\n * `arrowColorMatchesEdge` applied. Discrete keys keep their attribute type.\n * @param target - nodes or edges\n * @param style - the style\n * @param elements - the elements (their bypasses decide which visual property a property is read from)\n * @param options - notes, the budget and how a file column is referenced\n * @returns the rules and the style columns they read\n * @category Styles\n */\nexport function cytoscapeRules(\n target: StyleTarget,\n style: CytoscapeStyle,\n elements: CytoscapeElements,\n options: CytoscapeTranslateOptions = {},\n): CytoscapeRules {\n const notes = options.notes ?? new StyleNotes();\n const refOf = options.columnRef ?? ((column: string): ColumnRef => ({ data: column }));\n const s = style[target];\n const { used } = vpUsage(s, elements.bypasses ?? []);\n const chosen = chooseVps(target, s, used);\n const site = (property: string): CanonSite => ({ notes, target, property, budget: options.budget });\n const locked = target === \"node\" && s.dependencies.get(\"nodeSizeLocked\") === true;\n const matched = target === \"edge\" && s.dependencies.get(\"arrowColorMatchesEdge\") === true;\n\n const set = defaultValues(s, chosen, site, { locked, matched });\n const columns = new Map<string, StyleColumn>();\n const byColumn = new Map<string, MappingRule>();\n const reading: MappingRead = { target, refOf, elements, columns, notes, budget: options.budget };\n const add = (props: readonly string[], raw: CytoscapeMapping, parse: CytoscapeValueParser): void => {\n const parsed = parseMapping(raw, parse, site(props[0]));\n const mapping = neutralMapping(parsed, props[0], parse, reading);\n const key = `${raw.kind}\\u0000${raw.column}`;\n let rule = byColumn.get(key);\n if (rule === undefined) {\n rule = { id: `${target}.${raw.kind}.${raw.column}`, map: {} };\n byColumn.set(key, rule);\n }\n for (const p of props) {\n rule.map[p] = mapping;\n }\n };\n for (const [prop, [vp, parse]] of chosen) {\n const raw = s.mappings.get(vp);\n if (raw !== undefined) {\n add(matched && prop === \"color\" ? [\"color\", \"sourceArrowColor\", \"targetArrowColor\"] : [prop], raw, parse);\n }\n }\n const size = locked ? s.mappings.get(NODE_SIZE_VP) : undefined;\n if (size !== undefined) {\n add([\"width\", \"height\"], size, sizeParser);\n }\n\n const rules: StyleRule[] = [];\n if (Object.keys(set).length > 0) {\n rules.push({\n id: `${target}.defaults`,\n target,\n role: \"defaults\",\n origin: \"declared\",\n where: { all: true },\n set,\n });\n }\n for (const r of byColumn.values()) {\n rules.push({ id: r.id, target, role: \"mapping\", origin: \"declared\", where: { all: true }, map: r.map });\n }\n return { rules, columns };\n}\n\n/**\n * The defaults rule's values: each chosen visual property's default, a locked node size as the width and height\n * (50 when unset), an edge color as both arrow colors when they match the edge, and `curved` only with default bends.\n * @param s - the target's style\n * @param chosen - the visual property and parser each neutral property is read from\n * @param site - where a value of a property is read\n * @param deps - the dependencies that apply\n * @param deps.locked - `nodeSizeLocked`\n * @param deps.matched - `arrowColorMatchesEdge`\n * @returns the values\n */\nfunction defaultValues(\n s: CytoscapeStyle[\"node\"],\n chosen: ReadonlyMap<string, readonly [string, CytoscapeValueParser]>,\n site: (property: string) => CanonSite,\n deps: { readonly locked: boolean; readonly matched: boolean },\n): Record<string, StyleValue> {\n const set: Record<string, StyleValue> = {};\n for (const [prop, [vp, parse]] of chosen) {\n const v = s.defaults.has(vp) ? parse(s.defaults.get(vp), site(prop)) : null;\n if (v !== null) {\n set[prop] = v;\n }\n }\n if (deps.locked) {\n const size = s.defaults.has(NODE_SIZE_VP) ? sizeParser(s.defaults.get(NODE_SIZE_VP), site(\"width\")) : null;\n set.width = size ?? 50;\n set.height = size ?? 50;\n }\n if (deps.matched && set.color !== undefined) {\n set.sourceArrowColor = set.color;\n set.targetArrowColor = set.color;\n }\n // EDGE_CURVED only rounds bends: with no default bends, the default edge is straight\n if (set.curved === true && bendParser(s.defaults.get(EDGE_BEND_VP), site(\"curved\")) !== true) {\n set.curved = false;\n }\n return set;\n}\n\n/** What turning one target's Cytoscape mappings into neutral ones reads. */\ninterface MappingRead {\n readonly target: StyleTarget;\n /** How a file column is referenced. */\n readonly refOf: (column: string) => ColumnRef;\n readonly elements: CytoscapeElements;\n /** Where a copied column is put. */\n readonly columns: Map<string, StyleColumn>;\n readonly notes: StyleNotes;\n readonly budget: StyleWorkBudget | undefined;\n}\n\n/**\n * A parsed Cytoscape mapping as a neutral mapping. A passthrough stays a passthrough over the file's column when\n * the planner's reading of every value equals Cytoscape's; otherwise Cytoscape's values are copied into the style\n * column `cytoscape.<property>`, which the passthrough reads.\n * @param m - the parsed mapping\n * @param property - the first property it sets\n * @param parse - Cytoscape's parser for the property\n * @param reading - the target, the elements and where copies go\n * @returns the neutral mapping\n */\nfunction neutralMapping(\n m: ParsedMapping,\n property: string,\n parse: CytoscapeValueParser,\n reading: MappingRead,\n): Mapping {\n const { target, elements, columns, notes, budget } = reading;\n const by = reading.refOf(m.column);\n if (m.kind === \"discrete\") {\n return { kind: \"discrete\", by, table: m.table };\n }\n if (m.kind === \"continuous\") {\n return { kind: \"continuous\", by, points: m.points };\n }\n const plain = \"style\" in by ? styleCell : canonicalFor(target, property);\n const n = elements.count;\n budget?.spend(target, n);\n const values = new Array<StyleValue | null>(n);\n let same = true;\n for (let i = 0; i < n; i++) {\n const raw = elements.value(m.column, i);\n const cy =\n raw === null || raw === undefined || Array.isArray(raw)\n ? null\n : parse(raw, { notes, target, property, element: i });\n values[i] = cy;\n if (same && cy !== (raw === null || raw === undefined || Array.isArray(raw) ? null : plain(raw))) {\n same = false;\n }\n }\n if (same) {\n return { kind: \"passthrough\", by };\n }\n const key = `cytoscape.${property}`;\n columns.set(key, values);\n return { kind: \"passthrough\", by: { style: key } };\n}\n\n/**\n * How the resolver reads a style column's cell: a scalar as it is.\n * @param raw - the cell\n * @returns the value, or null\n */\nfunction styleCell(raw: unknown): StyleValue | null {\n return typeof raw === \"string\" || typeof raw === \"number\" || typeof raw === \"boolean\" ? raw : null;\n}\n","/**\n * What the XGMML importer and exporter share: the namespaces, the format facts, the fixed column\n * names, the `meta.extra` key, and the issue and loss code tables.\n */\n\nimport {\n AMBIGUOUS_GRAPH_NAME_CODE,\n BAD_VALUE_CODE,\n COLUMN_RENAMED_CODE,\n COLUMN_RENAMED_LOSS_CODE,\n DANGLING_REFERENCE_CODE,\n DIRECTION_FORCED_CODE,\n DIRECTION_REFUSED_CODE,\n DUPLICATE_ATTRIBUTE_CODE,\n DUPLICATE_EDGE_ID_CODE,\n DUPLICATE_NODE_CODE,\n ELEMENT_ISSUE,\n EMPTY_INPUT_CODE,\n ENCODING_CONFLICT_CODE,\n ENCODING_FALLBACK_CODE,\n EQUATION_AS_TEXT_CODE,\n GRAPH_NOT_FOUND_CODE,\n ID_MERGED_CODE,\n ID_TEXT_TYPE_CODE,\n INPUT_ISSUE,\n INVALID_ENCODING_CODE,\n INVALID_UTF8_CODE,\n MISSING_ENDPOINT_CODE,\n MISSING_ID_CODE,\n MIXED_DIRECTION_CODE,\n MULTIPLE_GRAPHS_CODE,\n MUTUAL_EXPANDED_CODE,\n NO_GRAPH_CODE,\n OPTION_IGNORED_CODE,\n PARENT_CYCLE_CODE,\n PARENTS_DROPPED_CODE,\n PRECISION_CODE,\n ROLE_ASSUMED_CODE,\n ROLE_DROPPED_CODE,\n ROLE_TAKEN_CODE,\n SINK_OPTION_CODE,\n STORAGE_CLASS_CODE,\n STRAY_TEXT_CODE,\n TEMPORAL_DROPPED_CODE,\n TEMPORAL_TEXT_DROPPED_CODE,\n UNKNOWN_ATTR_TYPE_CODE,\n UNKNOWN_ELEMENT_CODE,\n UNKNOWN_ENCODING_CODE,\n UNKNOWN_PARENT_CODE,\n WEIGHT_KEY_CLASH_CODE,\n WIDENED_CODE,\n XML_ILLEGAL_CHAR_CODE,\n XML_NESTING_CODE,\n XML_SYNTAX_CODE,\n} from \"../../common/codes.js\";\n\n/**\n * The format name.\n * @category Plugin helpers\n */\nexport const FORMAT = \"xgmml\";\n\n/**\n * File extensions (never `.gr`, which DIMACS owns).\n * @category Plugin helpers\n */\nexport const EXTENSIONS: readonly string[] = Object.freeze([\".xgmml\", \".xml\"]);\n\n/**\n * MIME types: the draft's (appendix E) and Cytoscape's.\n * @category Plugin helpers\n */\nexport const MIME_TYPES: readonly string[] = Object.freeze([\"application/xgmml\", \"text/xgmml\", \"text/xgmml+xml\"]);\n\n/**\n * The XGMML namespace.\n * @category Plugin helpers\n */\nexport const XGMML_NAMESPACE = \"http://www.cs.rpi.edu/XGMML\";\n\n/**\n * Cytoscape's namespace, bound to the `cy` prefix.\n * @category Plugin helpers\n */\nexport const CY_NAMESPACE = \"http://www.cytoscape.org\";\n\n/**\n * The XLink namespace.\n * @category Plugin helpers\n */\nexport const XLINK_NAMESPACE = \"http://www.w3.org/1999/xlink\";\n\n/**\n * The `meta.extra` key the importer writes and the exporter reads.\n * @category Plugin helpers\n */\nexport const META_KEY = \"xgmml\";\n\n/**\n * The label column (role label) of node and edge `label` attributes.\n * @category Plugin helpers\n */\nexport const LABEL_COLUMN = \"label\";\n\n/**\n * The edge `id` column (role id, unique).\n * @category Plugin helpers\n */\nexport const EDGE_ID_COLUMN = \"id\";\n\n/**\n * The node position (f64 x3, role position, y up).\n * @category Plugin helpers\n */\nexport const POSITION_COLUMN = \"position\";\n\n/**\n * Cytoscape's stacking order (`NODE_Z_LOCATION`), kept out of the position.\n * @category Plugin helpers\n */\nexport const Z_COLUMN = \"z\";\n\n/**\n * The node, edge and graph json column of a `<graphics>` element's values as written.\n * @category Plugin helpers\n */\nexport const GRAPHICS_COLUMN = \"graphics\";\n\n/**\n * The containing group node (u32, role parent).\n * @category Plugin helpers\n */\nexport const PARENT_COLUMN = \"parent\";\n\n/**\n * Every containing group node of a node that is in several groups (list of u32, role parents).\n * @category Plugin helpers\n */\nexport const PARENTS_COLUMN = \"parents\";\n\n/**\n * The json node column of a group's nested graph id, label and atts.\n * @category Plugin helpers\n */\nexport const SUBGRAPH_COLUMN = \"xgmml.subgraph\";\n\n/**\n * The string node column naming the network a node's nested-network pointer points to.\n * @category Plugin helpers\n */\nexport const NESTED_NETWORK_COLUMN = \"cytoscape.nestedNetwork\";\n\n/**\n * The string node column of a nested-network pointer into another file (`file.xgmml#id`).\n * @category Plugin helpers\n */\nexport const NETWORK_POINTER_COLUMN = \"xgmml.networkPointer\";\n\n/**\n * The list node column of the root-level subgraphs a node belongs to, in a generic document.\n * @category Plugin helpers\n */\nexport const NETWORKS_COLUMN = \"xgmml.networks\";\n\n/**\n * The edge column of Cytoscape's interaction type.\n * @category Plugin helpers\n */\nexport const INTERACTION_COLUMN = \"interaction\";\n\n/**\n * The `origin.namespace` of the columns the importer derives from XGMML structure.\n * @category Plugin helpers\n */\nexport const XGMML_ORIGIN_NAMESPACE = \"xgmml\";\n\n/**\n * The `origin.namespace` of the columns that hold Cytoscape-only data (z, nested networks).\n * @category Plugin helpers\n */\nexport const CYTOSCAPE_ORIGIN_NAMESPACE = \"cytoscape\";\n\n/**\n * The issue codes the XGMML importer records, by name: the codes shared with\n * the other importers and the XGMML-specific ones. A key is the code without\n * its severity and format prefixes.\n * @category Built-in formats\n */\nexport const XGMML_ISSUE = Object.freeze({\n ...INPUT_ISSUE,\n ...ELEMENT_ISSUE,\n /** The input is not well-formed XML. The import stops. */\n XML_SYNTAX: XML_SYNTAX_CODE,\n /** Elements are nested more than 100,000 deep. The import stops. */\n XML_NESTING: XML_NESTING_CODE,\n /** The input is empty or whitespace only. The import stops. */\n EMPTY_INPUT: EMPTY_INPUT_CODE,\n /** The input is not valid UTF-8. The import stops. */\n INVALID_UTF8: INVALID_UTF8_CODE,\n /**\n * Some bytes are not valid in the encoding that was chosen (by a byte order mark, the file's declaration or the\n * `encoding` option). The import stops.\n */\n INVALID_ENCODING: INVALID_ENCODING_CODE,\n /** Undeclared non-UTF-8 bytes were read as windows-1252. */\n ENCODING_FALLBACK: ENCODING_FALLBACK_CODE,\n /** A declared encoding the platform cannot decode was ignored. */\n UNKNOWN_ENCODING: UNKNOWN_ENCODING_CODE,\n /** A declared encoding the byte order mark contradicts (the mark wins). */\n ENCODING_CONFLICT: ENCODING_CONFLICT_CODE,\n /**\n * The root element is not `<graph>` (it may be an XHTML page with a graph inside, or a GraphML file). The import\n * stops.\n */\n NO_GRAPH: NO_GRAPH_CODE,\n /**\n * The file is a Cytoscape session view (`cy:view=\"1\"`), which holds only view settings and no nodes or edges. The\n * import stops.\n */\n VIEW_DOCUMENT: \"E_XGMML_VIEW_DOCUMENT\",\n /** A node with neither an id nor a label; it is skipped with its subtree. */\n MISSING_ID: MISSING_ID_CODE,\n /** A node without an id; its label is used as the id. */\n ID_FROM_LABEL: \"W_XGMML_ID_FROM_LABEL\",\n /** A node or edge with both an id and an `xlink:href`; it is read as the reference. */\n ID_AND_HREF: \"W_XGMML_ID_AND_HREF\",\n /** An edge without a source or a target that no label alias resolves. */\n MISSING_ENDPOINT: MISSING_ENDPOINT_CODE,\n /** An edge endpoint that names no node (addMissingNodes false); the edge is skipped. */\n UNKNOWN_NODE: \"E_UNKNOWN_NODE\",\n /** Endpoints resolved through Cytoscape's `\"a (pp) b\"` label aliases; interactions filled from labels. */\n LABEL_ALIAS: \"W_XGMML_LABEL_ALIAS\",\n /** A node id declared twice; the declarations are merged. */\n DUPLICATE_NODE: DUPLICATE_NODE_CODE,\n /** An edge id used twice; the second edge is skipped. */\n DUPLICATE_EDGE_ID: DUPLICATE_EDGE_ID_CODE,\n /**\n * Cytoscape 2.x writes each edge of a group a second time, inside the group. The repeats are dropped, so every edge\n * is read once; nothing is lost.\n */\n GROUP_DUPLICATE_EDGE: \"W_XGMML_GROUP_DUPLICATE_EDGE\",\n /** A `directed` or `cy:directed` value other than 0 / 1. */\n BAD_DIRECTED: \"W_XGMML_BAD_DIRECTED\",\n /** A `documentVersion` that does not parse; the dialect is chosen from the content. */\n DOCUMENT_VERSION: \"W_XGMML_DOCUMENT_VERSION\",\n /** A root `<graph>` with neither the XGMML namespace nor an XGMML DOCTYPE. */\n NO_NAMESPACE: \"W_XGMML_NO_NAMESPACE\",\n /** A malformed `<att>`: a list with a value, a scalar with child atts, an att with no name. */\n BAD_ATT: \"W_XGMML_BAD_ATT\",\n /** A bare `&` read as `&` under repairBareAmpersands. */\n AMPERSAND_REPAIRED: \"W_XGMML_AMPERSAND_REPAIRED\",\n /** Two surrogate character references joined under pairSurrogateReferences. */\n SURROGATE_PAIRED: \"W_XGMML_SURROGATE_PAIRED\",\n /** An empty list whose element type nothing states; a list of strings is assumed. */\n EMPTY_LIST_TYPE: \"W_XGMML_EMPTY_LIST_TYPE\",\n /**\n * An attribute holds a structure a single column cannot (a list of records, a list of lists, a Cytoscape 2.x map\n * or XML from another tool). Its value is kept as a JSON value, which a save as XGMML writes back.\n */\n RECORD_LIST: \"W_XGMML_RECORD_LIST\",\n /** A pointer into another file (`file.xgmml#id`); kept as text. */\n CROSS_FILE_REFERENCE: \"W_XGMML_CROSS_FILE_REFERENCE\",\n /** A graph nested in an edge's att; there is no model for it. */\n EDGE_NESTED_GRAPH: \"W_XGMML_EDGE_NESTED_GRAPH\",\n /**\n * Some nodes or edges of a Cytoscape session belong to none of its networks (Cytoscape keeps group meta-edges and\n * the members of collapsed groups this way). They are not read; the message counts them.\n */\n ROOT_ONLY_ELEMENTS: \"W_XGMML_ROOT_ONLY_ELEMENTS\",\n /** A value that does not parse as its declared type; the cell is unset. */\n BAD_VALUE: BAD_VALUE_CODE,\n /**\n * An attribute's type was widened because a later value did not fit: an integer above 2^31 in an integer column,\n * or two declared types for one attribute.\n */\n WIDENED: WIDENED_CODE,\n /** An integer beyond 2^53 was stored as the nearest 64-bit float; pass `long: \"string\"` to keep every digit. */\n PRECISION: PRECISION_CODE,\n /** A reference (xlink:href, nested-network pointer) that names nothing. */\n DANGLING_REFERENCE: DANGLING_REFERENCE_CODE,\n /** The same attribute twice on one element; the later value wins. */\n DUPLICATE_ATTRIBUTE: DUPLICATE_ATTRIBUTE_CODE,\n /** A group membership naming no node. */\n UNKNOWN_PARENT: UNKNOWN_PARENT_CODE,\n /** A group membership that would close a parent cycle; that link is dropped. */\n PARENT_CYCLE: PARENT_CYCLE_CODE,\n /** A Cytoscape formula kept as its text. */\n EQUATION_AS_TEXT: EQUATION_AS_TEXT_CODE,\n /** An att type XGMML and Cytoscape do not define; kept as text. */\n UNKNOWN_ATTR_TYPE: UNKNOWN_ATTR_TYPE_CODE,\n /** An element XGMML does not define at that place; skipped with its subtree. */\n UNKNOWN_ELEMENT: UNKNOWN_ELEMENT_CODE,\n /** Character data where XGMML allows only elements, or inside an att. */\n STRAY_TEXT: STRAY_TEXT_CODE,\n /**\n * The file holds several graphs and only the first was read. It is not added when `graphIndex` or `graphName` chose the graph.\n * `importAllGraphs()` reads every one.\n */\n MULTIPLE_GRAPHS: MULTIPLE_GRAPHS_CODE,\n /** `graphIndex` or `graphName` matches no network in the session. The import stops. */\n GRAPH_NOT_FOUND: GRAPH_NOT_FOUND_CODE,\n /** `graphName` matches several networks in the session. The import stops. */\n AMBIGUOUS_GRAPH_NAME: AMBIGUOUS_GRAPH_NAME_CODE,\n /**\n * An attribute was renamed `<name>#<suffix>` because another attribute already has its name, for example\n * two attributes declared with the same name.\n */\n COLUMN_RENAMED: COLUMN_RENAMED_CODE,\n /**\n * You read into a graph builder that already has an id, label or position attribute, so this file's one is kept as\n * a plain attribute.\n */\n ROLE_TAKEN: ROLE_TAKEN_CODE,\n /** Two different id texts became the same number because `ids` is \"number\", so their nodes were merged. */\n ID_MERGED: ID_MERGED_CODE,\n /** You set an option this format does not use; it had no effect. The message names the option. */\n OPTION_IGNORED: OPTION_IGNORED_CODE,\n /**\n * You read into your own graph builder, which was created with a different `addMissingNodes`, `duplicateEdges`,\n * `selfLoops` or `weightDtype` than the option you passed; the builder's setting applies.\n */\n SINK_OPTION: SINK_OPTION_CODE,\n /**\n * You read into a graph builder whose direction is already set, or which already holds edges, so the file is read\n * with the builder's direction instead of its own.\n */\n DIRECTION_REFUSED: DIRECTION_REFUSED_CODE,\n /** Edges of the other direction were read with the direction `onMixedDirection` chose. */\n DIRECTION_FORCED: DIRECTION_FORCED_CODE,\n /**\n * The graph has both directed and undirected edges and `onMixedDirection` is \"error\". An import stops; a save to a\n * format that holds one direction per file fails with E_DIRECTED. Pass \"directed\" or \"undirected\" to read or write\n * it anyway.\n */\n MIXED_DIRECTION: MIXED_DIRECTION_CODE,\n});\n\n/**\n * Loss note codes of the XGMML exporter (check()): the XGMML ones and the shared ones its notes\n * can carry. The generic notes of `checkCapabilities()` (dtypes, components, temporal and visual\n * roles, extension tables) are those of `LOSS`.\n * @category Built-in formats\n */\nexport const XGMML_LOSS = Object.freeze({\n /** A json or nested-list column written as a string att. */\n JSON_AS_STRING: \"W_XGMML_JSON_AS_STRING\",\n /**\n * An attribute type Cytoscape does not have is written as a wider one (a 32-bit float as Double, a large unsigned\n * integer as Long, a byte as Integer, a dictionary as String).\n */\n WIDENED_TYPE: \"W_XGMML_WIDENED_TYPE\",\n /** A text value holds a character XML 1.0 forbids (most control characters); the save fails with E_COLUMN_TYPE. */\n XML_ILLEGAL_CHAR: XML_ILLEGAL_CHAR_CODE,\n /** A temporal column written as plain numbers. */\n TEMPORAL_DROPPED: TEMPORAL_DROPPED_CODE,\n /** A temporal text companion written as a plain string att. */\n TEMPORAL_TEXT_DROPPED: TEMPORAL_TEXT_DROPPED_CODE,\n /** An attribute with a role the format has no place for is written as a plain attribute; the role is lost. */\n ROLE_DROPPED: ROLE_DROPPED_CODE,\n /**\n * A `parents` attribute (several parents per node) is not written because the graph also has a `parent` attribute.\n */\n PARENTS_DROPPED: PARENTS_DROPPED_CODE,\n /** A mutual pair written as two directed edges. */\n MUTUAL_EXPANDED: MUTUAL_EXPANDED_CODE,\n /** Node ids whose text reads back as the other type. */\n ID_TEXT_TYPE: ID_TEXT_TYPE_CODE,\n /** Edge ids that are not text are written as text and read back as text. */\n EDGE_ID_TEXT: \"W_XGMML_EDGE_ID_TEXT\",\n /** Strings holding a literal backslash-n or backslash-t read back as newline / tab (Cytoscape's escapes). */\n BACKSLASH_ESCAPE: \"W_XGMML_BACKSLASH_ESCAPE\",\n /** A position that cannot be written as it is: another shape, a non-finite coordinate, a z read back in the z column. */\n POSITION: \"W_XGMML_POSITION\",\n /** Nodes whose parent chain never reaches a root are written at the top level. */\n PARENT_CYCLE: \"W_XGMML_PARENT_CYCLE\",\n /**\n * An attribute with a role (for example, the label) is written where the format keeps that role, and reads back under the\n * name the format's importer gives it.\n */\n COLUMN_NAME_CHANGED: COLUMN_RENAMED_LOSS_CODE,\n /**\n * An attribute without a role is written where the format keeps a role (for example, a `name` column as the label), and\n * reads back with that role.\n */\n ROLE_ASSUMED: ROLE_ASSUMED_CODE,\n /** An attribute named `weight` without the weight role reads back as the edge weight. */\n WEIGHT_KEY_CLASH: WEIGHT_KEY_CLASH_CODE,\n /**\n * A text attribute reads back as a dictionary attribute, or the reverse, because the importer chooses by how often\n * its values repeat. The values are the same.\n */\n STORAGE_CLASS_CHANGED: STORAGE_CLASS_CODE,\n /** Edge labels shaped `a (i) b` read back with an `interaction` column (Cytoscape's label alias). */\n INTERACTION_FROM_LABEL: \"W_XGMML_INTERACTION_FROM_LABEL\",\n});\n","/**\n * The styles of XGMML files and Cytoscape 2.x session networks: Cytoscape writes every element's RESOLVED visual\n * properties into its `<graphics>` (XML attributes in the old spelling, nested `<att>` elements named for the visual\n * property, and the locked ones under `lockedVisualProperties`), and no style. The reader turns those values into\n * the neutral vocabulary; the planner explains them. The writer does the reverse from what graphty draws.\n */\n\nimport type { GraphSnapshot } from \"@graphty/graph-format\";\n\nimport { STYLE_ISSUE } from \"../../styles/codes.js\";\nimport {\n type CytoscapeDialect,\n cytoscapeElementProperties,\n cytoscapeWritableProperties,\n} from \"../../styles/cytoscape/emit.js\";\nimport { normalizeVisualProperties } from \"../../styles/cytoscape/lexicon.js\";\nimport { emptyCytoscapeStyle } from \"../../styles/cytoscape/mappings.js\";\nimport { cytoscapeBackground, type CytoscapeBypass, resolveCytoscapeBypasses } from \"../../styles/cytoscape/resolve.js\";\nimport { blockStyles, parseStyleBlock, STYLE_BLOCK_NAME } from \"../../styles/io/block.js\";\nimport type { ExporterStyleInput } from \"../../styles/io/writer.js\";\nimport { StyleNotes } from \"../../styles/notes.js\";\nimport { styleFingerprint } from \"../../styles/plan/features.js\";\nimport { plainCell, resolveStyles } from \"../../styles/plan/resolve.js\";\nimport type {\n EdgeStyleProperty,\n GraphStyle,\n ImporterStyles,\n NodeStyleProperty,\n ReaderOutput,\n StyleColumn,\n StyleProperty,\n StyleReadContext,\n StyleTarget,\n StyleTool,\n StyleValue,\n StyleWriteCapabilities,\n} from \"../../styles/types.js\";\nimport type { LossNote } from \"../../types.js\";\nimport { lossOf } from \"../cx/styles.js\";\nimport { GRAPHICS_COLUMN, XGMML_ORIGIN_NAMESPACE } from \"./constants.js\";\n\ntype Table = GraphSnapshot[\"nodes\"];\n\n/**\n * The name of a table's graphics column: the json column the XGMML reader keeps `<graphics>` in.\n * @param table - the node, edge or graph table\n * @returns the column's name, or null\n */\nfunction graphicsColumnOf(table: Table): string | null {\n for (const col of table) {\n const { origin } = col.meta;\n if (col.dtype === \"json\" && origin?.type === \"graphics\" && origin.namespace === XGMML_ORIGIN_NAMESPACE) {\n return col.meta.name;\n }\n }\n return table.get(GRAPHICS_COLUMN)?.dtype === \"json\" ? GRAPHICS_COLUMN : null;\n}\n\n/**\n * Each element's visual properties from its graphics: the graphics values normalized to visual property names, the\n * locked ones (`lockedVisualProperties`, a session view's bypasses) on top.\n * @param table - the node or edge table\n * @param target - nodes or edges\n * @param n - the element count\n * @param notes - where too-deep nesting is noted\n * @returns per element, its visual properties (null without graphics)\n */\nexport function graphicsBypasses(table: Table, target: StyleTarget, n: number, notes: StyleNotes): CytoscapeBypass[] {\n const out = new Array<CytoscapeBypass>(n).fill(null);\n const name = graphicsColumnOf(table);\n if (name === null) {\n return out;\n }\n for (let i = 0; i < n; i++) {\n const g = plainCell(table.value(name, i));\n if (g === null || typeof g !== \"object\" || Array.isArray(g)) {\n continue;\n }\n const map = normalizeVisualProperties(target, g, notes);\n const locked = Object.hasOwn(g, \"lockedVisualProperties\")\n ? (g as Record<string, unknown>).lockedVisualProperties\n : undefined;\n if (locked !== null && typeof locked === \"object\") {\n for (const [k, v] of normalizeVisualProperties(target, locked, notes)) {\n map.set(k, v);\n }\n }\n out[i] = map.size > 0 ? map : null;\n }\n return out;\n}\n\n/** What the XGMML style reader is told by its caller. */\ninterface XgmmlStyleSettings {\n /** Whose defaults fill what the file leaves unset. */\n readonly tool: StyleTool;\n /** A bool column marking hidden elements (a Cytoscape 2.x session's hidden state), or null. */\n readonly hiddenColumn?: string | null;\n}\n\n/**\n * The styles of a graph whose elements carry Cytoscape's resolved visual properties in their graphics.\n * @param snapshot - the graph\n * @param context - the budget and cancel signal\n * @param settings - the tool and the hidden-state column\n * @returns the styles (canonical values, no declared rules)\n */\nexport function readXgmmlStyles(\n snapshot: GraphSnapshot,\n context: StyleReadContext,\n settings: XgmmlStyleSettings,\n): ImporterStyles {\n const notes = new StyleNotes();\n const out: Record<StyleTarget, ReaderOutput> = { node: { values: {} }, edge: { values: {} } };\n for (const target of [\"node\", \"edge\"] as const) {\n context.signal?.throwIfAborted();\n const table = target === \"node\" ? snapshot.nodes : snapshot.edges;\n const n = target === \"node\" ? snapshot.nodeCount : snapshot.edgeCount;\n const maps = graphicsBypasses(table, target, n, notes);\n const values = maps.some((m) => m !== null)\n ? resolveCytoscapeBypasses(target, maps, { notes, budget: context.budget })\n : {};\n hiddenToVisible(table, settings.hiddenColumn ?? null, n, values);\n exactFromBlock(snapshot, target, values);\n out[target] = { values: nonEmpty(values) };\n }\n return {\n canonical: true,\n dialect: \"cytoscape\",\n tool: settings.tool,\n units: \"px\",\n node: out.node,\n edge: out.edge,\n graph: graphStyleOf(snapshot, notes),\n notes: notes.list(),\n };\n}\n\n/**\n * The styles of an XGMML file: its elements' resolved values, with Cytoscape desktop's default style beneath.\n * @param snapshot - the graph\n * @param context - the budget and cancel signal\n * @returns the styles\n */\nexport function readXgmmlFileStyles(snapshot: GraphSnapshot, context: StyleReadContext): ImporterStyles {\n return readXgmmlStyles(snapshot, context, { tool: \"cytoscape\" });\n}\n\n/**\n * For a file graphty wrote: where an element's value is what the writer's nearest Cytoscape value of the\n * `graphty.styles` block's value reads back as (a font family list written as its first family, a shape Cytoscape\n * does not have), the block's exact value is the truth, so a re-import gives the same rules. A value that differs\n * from what graphty wrote (another program edited it) stays the truth.\n * @param snapshot - the graph\n * @param target - nodes or edges\n * @param values - the values per property, changed in place\n * @param dialect - the Cytoscape dialect the file's values are written in\n */\nexport function exactFromBlock(\n snapshot: GraphSnapshot,\n target: StyleTarget,\n values: Partial<Record<string, StyleColumn>>,\n dialect: CytoscapeDialect = \"desktop\",\n): void {\n const text = snapshot.graph.has(STYLE_BLOCK_NAME) ? plainCell(snapshot.graph.value(STYLE_BLOCK_NAME, 0)) : null;\n if (typeof text !== \"string\") {\n return;\n }\n const parsed = parseStyleBlock(text, styleFingerprint(snapshot));\n const ex = parsed.ok ? blockStyles(parsed.block, snapshot, \"xgmml\") : null;\n if (ex === null) {\n return;\n }\n const n = target === \"node\" ? snapshot.nodeCount : snapshot.edgeCount;\n const want = new Map<string, readonly (StyleValue | null)[]>();\n const exact = (property: string): readonly (StyleValue | null)[] => {\n let held = want.get(property);\n if (held === undefined) {\n held = resolveStyles(ex, target, property as StyleProperty, snapshot);\n want.set(property, held);\n }\n return held;\n };\n // What each element's exact values are written as, read back the way the file is read.\n const written = Array.from({ length: n }, (_v, i) =>\n cytoscapeElementProperties(\n target,\n (property) => exact(property)[i] ?? null,\n dialect,\n () => undefined,\n ),\n );\n const readBack = resolveCytoscapeBypasses(target, written, { notes: new StyleNotes() });\n for (const [property, native] of Object.entries(values)) {\n const back = readBack[property];\n if (native !== undefined && back !== undefined) {\n values[property] = withBlockValues(native, back, exact(property));\n }\n }\n}\n\n/**\n * A property's values with the block's exact value wherever the file's value is what the writer wrote for it.\n * @param native - the file's values\n * @param back - what the writer wrote for the block's values, read back\n * @param w - the block's values\n * @returns the values, the file's own array when none changes\n */\nfunction withBlockValues(\n native: StyleColumn,\n back: readonly (StyleValue | null)[],\n w: readonly (StyleValue | null)[],\n): StyleColumn {\n let changed: (StyleValue | null)[] | null = null;\n for (let i = 0; i < native.length; i++) {\n if (w[i] !== null && native[i] !== w[i] && native[i] === back[i]) {\n changed ??= [...native];\n changed[i] = w[i];\n }\n }\n return changed ?? native;\n}\n\n/**\n * Marks the elements a hidden-state column holds true as not visible.\n * @param table - the node or edge table\n * @param column - the bool column, or null\n * @param n - the element count\n * @param values - the values per property, changed in place\n */\nexport function hiddenToVisible(\n table: Table,\n column: string | null,\n n: number,\n values: Partial<Record<string, StyleColumn>>,\n): void {\n if (column === null || !table.has(column)) {\n return;\n }\n let visible: (StyleValue | null)[] | null = null;\n for (let i = 0; i < n; i++) {\n if (plainCell(table.value(column, i)) === true) {\n visible ??= values.visible === undefined ? new Array<StyleValue | null>(n).fill(null) : [...values.visible];\n visible[i] = false;\n }\n }\n if (visible !== null) {\n values.visible = visible;\n }\n}\n\n/**\n * The properties with at least one value.\n * @param values - per property, each element's value\n * @returns the same without all-null properties\n */\nexport function nonEmpty(values: Partial<Record<string, StyleColumn>>): Partial<Record<StyleProperty, StyleColumn>> {\n const out: Partial<Record<string, StyleColumn>> = {};\n for (const [p, col] of Object.entries(values)) {\n if (col?.some((v) => v !== null) === true) {\n out[p] = col;\n }\n }\n return out;\n}\n\n/**\n * The graph's background from its own graphics (`NETWORK_BACKGROUND_PAINT`).\n * @param snapshot - the graph\n * @param notes - where a bad value is noted\n * @returns the graph style\n */\nfunction graphStyleOf(snapshot: GraphSnapshot, notes: StyleNotes): GraphStyle {\n const name = graphicsColumnOf(snapshot.graph);\n const g = name === null ? null : plainCell(snapshot.graph.value(name, 0));\n if (g === null || typeof g !== \"object\") {\n return {};\n }\n const style = emptyCytoscapeStyle();\n for (const [k, v] of normalizeVisualProperties(\"node\", g, notes)) {\n if (k.startsWith(\"NETWORK_\")) {\n style.network.defaults.set(k, v);\n }\n }\n const background = cytoscapeBackground(style, notes);\n return background === null ? {} : { background };\n}\n\n// ------------------------------------------------------------------ writing\n\n/**\n * What the XGMML writer holds natively: every visual property Cytoscape keeps per element, and the graph's\n * background. The block and the tagged values go into graph and element `<att>`s.\n */\nexport const XGMML_STYLE_CAPABILITIES: StyleWriteCapabilities = Object.freeze({\n node: Object.freeze(cytoscapeWritableProperties(\"node\", \"desktop\") as NodeStyleProperty[]),\n edge: Object.freeze(cytoscapeWritableProperties(\"edge\", \"desktop\") as EdgeStyleProperty[]),\n graph: Object.freeze([\"background\"] as const),\n block: \"attributes\",\n});\n\n/** The visual properties Cytoscape also writes as `<graphics>` XML attributes, in its old spelling. */\nconst XML_ATTRIBUTES: Readonly<Record<StyleTarget, readonly (readonly [vp: string, attribute: string])[]>> = {\n node: [\n [\"NODE_SHAPE\", \"type\"],\n [\"NODE_HEIGHT\", \"h\"],\n [\"NODE_WIDTH\", \"w\"],\n [\"NODE_FILL_COLOR\", \"fill\"],\n [\"NODE_BORDER_WIDTH\", \"width\"],\n [\"NODE_BORDER_PAINT\", \"outline\"],\n ],\n edge: [\n [\"EDGE_WIDTH\", \"width\"],\n [\"EDGE_STROKE_UNSELECTED_PAINT\", \"fill\"],\n ],\n};\n\n/**\n * One element's graphics record for a file written with styles: what graphty draws as Cytoscape visual properties,\n * the six classic ones also as XML attributes (the importer reads both alike), over the kept graphics' visual\n * properties no neutral property carries (custom graphics, label widths) and edge bends.\n * @param target - nodes or edges\n * @param styles - the exporter's style input\n * @param i - the element index\n * @param kept - the element's kept graphics record, or null\n * @returns the record, or null when there is nothing to write\n */\nexport function styledGraphics(\n target: StyleTarget,\n styles: ExporterStyleInput,\n i: number,\n kept: Record<string, unknown> | null,\n): Record<string, unknown> | null {\n const vps = cytoscapeElementProperties(\n target,\n (p) => styles.picture(target, p as StyleProperty)[i] ?? null,\n \"desktop\",\n () => undefined,\n );\n const out: Record<string, unknown> = {};\n for (const [vp, attribute] of XML_ATTRIBUTES[target]) {\n if (vps.has(vp)) {\n out[attribute] = String(vps.get(vp));\n }\n }\n for (const [k, v] of Object.entries(kept ?? {})) {\n // a kept visual property the picture does not write, or the edge's bends; old-spelling and nested keys\n // would be read before the picture's values and contradict them\n if (k === \"Line\" || (/^[A-Z][A-Z_0-9]+$/.test(k) && !vps.has(k))) {\n out[k] = v;\n }\n }\n for (const [vp, v] of vps) {\n out[vp] = String(v);\n }\n return Object.keys(out).length === 0 ? null : out;\n}\n\n/**\n * What writing every element's graphics with styles loses: each value written as the nearest one Cytoscape allows,\n * counted per element.\n * @param styles - the exporter's style input\n * @param snapshot - the graph\n * @returns the loss notes\n */\nexport function styledGraphicsNotes(styles: ExporterStyleInput, snapshot: GraphSnapshot): LossNote[] {\n const notes = new StyleNotes();\n for (const target of [\"node\", \"edge\"] as const) {\n const n = target === \"node\" ? snapshot.nodeCount : snapshot.edgeCount;\n for (let i = 0; i < n; i++) {\n cytoscapeElementProperties(\n target,\n (p) => styles.picture(target, p as StyleProperty)[i] ?? null,\n \"desktop\",\n (p) => {\n notes.add(STYLE_ISSUE.APPROXIMATED, target, p, { element: i });\n },\n );\n }\n }\n return notes.list().map(lossOf);\n}\n\n/**\n * The graph's graphics record for a file written with styles: the kept record with the background replaced.\n * @param styles - the exporter's style input\n * @param kept - the kept graph graphics, or null\n * @returns the record, or null\n */\nexport function styledGraphGraphics(\n styles: ExporterStyleInput,\n kept: Record<string, unknown> | null,\n): Record<string, unknown> | null {\n const { background } = styles.rules.styles.graph;\n const out: Record<string, unknown> = { ...kept };\n if (background !== undefined) {\n out.NETWORK_BACKGROUND_PAINT = background.toUpperCase();\n }\n return Object.keys(out).length === 0 ? null : out;\n}\n","/**\n * The styles of CX version 1 and CX2 files. Both hold one Cytoscape visual style (defaults, mappings and\n * dependencies) and per-element bypasses. The readers resolve every element the way Cytoscape draws it (bypass over\n * mapping over default) and translate the style into neutral rules, with Cytoscape desktop's default style beneath\n * (Cytoscape starts every imported CX or CX2 style as a copy of it). The writers do the reverse: neutral rules\n * become Cytoscape defaults and mappings, everything else per-element bypasses, so Cytoscape draws what graphty\n * draws; the `graphty.styles` block is an aspect of its own and the style values its rules read are attributes.\n */\n\nimport type { GraphSnapshot } from \"@graphty/graph-format\";\n\nimport { STYLE_ISSUE } from \"../../styles/codes.js\";\nimport {\n type CytoscapeDialect,\n type CytoscapeEmitted,\n cytoscapeWritableProperties,\n emitCytoscapeStyle,\n} from \"../../styles/cytoscape/emit.js\";\nimport { type CytoscapeStyle, cytoscapeStyleFromCx } from \"../../styles/cytoscape/mappings.js\";\nimport {\n cytoscapeBackground,\n type CytoscapeBypass,\n type CytoscapeElements,\n resolveCytoscape,\n} from \"../../styles/cytoscape/resolve.js\";\nimport { cytoscapeRules } from \"../../styles/cytoscape/translate.js\";\nimport { STYLE_BLOCK_NAME } from \"../../styles/io/block.js\";\nimport type { ExporterStyleInput } from \"../../styles/io/writer.js\";\nimport { StyleNotes } from \"../../styles/notes.js\";\nimport { plainCell } from \"../../styles/plan/resolve.js\";\nimport type {\n EdgeStyleProperty,\n ImporterStyles,\n NodeStyleProperty,\n ReaderOutput,\n StyleColumn,\n StyleNote,\n StyleReadContext,\n StyleTarget,\n StyleWriteCapabilities,\n} from \"../../styles/types.js\";\nimport type { LossNote } from \"../../types.js\";\nimport { exactFromBlock, nonEmpty } from \"../xgmml/styles.js\";\n\ntype Table = GraphSnapshot[\"nodes\"];\n\n/**\n * The block text of a `graphty.styles` aspect (`[{ \"block\": \"<json>\" }]`, the aspect a CX or CX2 file graphty wrote\n * keeps its block in), or null when it holds none.\n * @param elements - the aspect's elements\n * @returns the text\n */\nexport function blockOfAspect(elements: readonly unknown[] | undefined): string | null {\n const first: unknown = elements?.[0];\n if (first === null || typeof first !== \"object\" || !Object.hasOwn(first, \"block\")) {\n return null;\n }\n const text = (first as { block: unknown }).block;\n return typeof text === \"string\" ? text : null;\n}\n\n/**\n * The `graphty.styles` aspect's elements for a block.\n * @param block - the block's text\n * @returns the elements\n */\nexport function blockAspect(block: string): Record<string, unknown>[] {\n return [{ block }];\n}\n\n/**\n * The `graphty.styles` block a snapshot carries as a graph attribute (an import of a file graphty wrote, or the one\n * graph-io adds for a styled export), or null.\n * @param snapshot - the graph\n * @returns the block's text\n */\nexport function snapshotBlock(snapshot: GraphSnapshot): string | null {\n const column = snapshot.graph.get(STYLE_BLOCK_NAME);\n const value = column?.isSet(0) ? column.value(0) : null;\n return typeof value === \"string\" ? value : null;\n}\n\n/** What a CX version 1 import keeps for its styles: the `cyVisualProperties` entries of the imported view. */\nexport interface CxStyleSource {\n /** The entries, in file order. */\n readonly entries: readonly unknown[];\n /** How many other views the file styles, whose entries were left out. */\n readonly otherViews?: number;\n}\n\n/** What a CX2 import keeps for its styles. */\nexport interface Cx2StyleSource {\n /** The `visualProperties` aspect. */\n readonly visualProperties: unknown;\n /** The `visualEditorProperties` aspect. */\n readonly visualEditorProperties: unknown;\n}\n\n/**\n * Each element's bypasses: the columns of an importer's bypass namespace, keyed by the visual property's own name.\n * @param table - the node or edge table\n * @param n - the element count\n * @param namespace - the bypass namespace\n * @returns per element, its bypasses, and the bypass columns' names\n */\nfunction bypassesOf(table: Table, n: number, namespace: string): { maps: CytoscapeBypass[]; names: string[] } {\n const columns = [...table].filter((c) => c.meta.origin?.namespace === namespace);\n const maps = new Array<CytoscapeBypass>(n).fill(null);\n for (let i = 0; i < n; i++) {\n let m: Map<string, unknown> | null = null;\n for (const c of columns) {\n const v = plainCell(c.isSet(i) ? c.value(i) : null);\n if (v !== null) {\n m ??= new Map();\n const id = c.meta.origin?.id;\n m.set(typeof id === \"string\" && id.length > 0 ? id : c.meta.name, v);\n }\n }\n maps[i] = m;\n }\n return { maps, names: columns.map((c) => c.meta.name) };\n}\n\n/**\n * The styles of a graph from its Cytoscape style and its bypass columns.\n * @param snapshot - the graph\n * @param context - the budget and cancel signal\n * @param style - the file's style\n * @param namespace - the importer's bypass namespace\n * @param notes - where problems are noted\n * @param dialect - the Cytoscape dialect the file is written in\n * @returns the styles\n */\nexport function readDeclaredStyles(\n snapshot: GraphSnapshot,\n context: StyleReadContext,\n style: CytoscapeStyle,\n namespace: string,\n notes: StyleNotes,\n dialect: CytoscapeDialect = \"desktop\",\n): ImporterStyles {\n const out: Record<StyleTarget, ReaderOutput> = { node: { values: {} }, edge: { values: {} } };\n const readFrom: Record<StyleTarget, string[]> = { node: [], edge: [] };\n for (const target of [\"node\", \"edge\"] as const) {\n context.signal?.throwIfAborted();\n const table = target === \"node\" ? snapshot.nodes : snapshot.edges;\n const n = target === \"node\" ? snapshot.nodeCount : snapshot.edgeCount;\n for (const m of style[target].mappings.values()) {\n if (!table.has(m.column)) {\n notes.add(STYLE_ISSUE.MAPPING_COLUMN_MISSING, target, m.column, { sample: m.kind });\n }\n }\n const { maps, names } = bypassesOf(table, n, namespace);\n readFrom[target] = names;\n const elements: CytoscapeElements = {\n count: n,\n value: (column, i) => (table.has(column) ? plainCell(table.value(column, i)) : null),\n bypasses: maps,\n };\n const values = resolveCytoscape(target, style, elements, { notes, budget: context.budget });\n // a file graphty wrote: a value its style writes as the nearest Cytoscape value is the block's\n exactFromBlock(snapshot, target, values, dialect);\n const { rules, columns } = cytoscapeRules(target, style, elements, { notes, budget: context.budget });\n out[target] = { values: nonEmpty(values), rules, columns };\n }\n const background = cytoscapeBackground(style, notes);\n return {\n canonical: true,\n dialect: \"cytoscape\",\n tool: \"cytoscape\",\n units: \"px\",\n node: out.node,\n edge: out.edge,\n graph: background === null ? {} : { background },\n notes: notes.list(),\n readFrom,\n };\n}\n\n/**\n * The styles of an imported CX version 1 network: the first view's `cyVisualProperties` (other views noted and\n * skipped), its bypasses, and Cytoscape desktop's default style beneath.\n * @param snapshot - the network\n * @param context - what the import kept, the budget and the cancel signal\n * @returns the styles\n */\nexport function readCxStyles(snapshot: GraphSnapshot, context: StyleReadContext): ImporterStyles {\n const notes = new StyleNotes();\n const kept = context.kept as CxStyleSource | undefined;\n const style = cytoscapeStyleFromCx(kept?.entries ?? [], notes);\n const otherViews = kept?.otherViews ?? 0;\n if (otherViews > 0) {\n notes.add(STYLE_ISSUE.OTHER_VIEWS, null, \"cyVisualProperties\", {\n sample: `${otherViews} more`,\n count: otherViews,\n });\n }\n return readDeclaredStyles(snapshot, context, style, \"cx.bypass\", notes);\n}\n\n/**\n * The neutral properties a Cytoscape dialect writes, and the graph's background, as writer capabilities.\n * @param dialect - the dialect\n * @returns the capabilities\n */\nexport function cytoscapeWriteCapabilities(dialect: CytoscapeDialect): StyleWriteCapabilities {\n return Object.freeze({\n node: Object.freeze(cytoscapeWritableProperties(\"node\", dialect) as NodeStyleProperty[]),\n edge: Object.freeze(cytoscapeWritableProperties(\"edge\", dialect) as EdgeStyleProperty[]),\n graph: Object.freeze([\"background\"] as const),\n // graph-io adds the block as a graph attribute (the writer moves it into an aspect of its own) and the style\n // values the rules read as element attributes\n block: \"attributes\",\n });\n}\n\n/** What the CX version 1 writer holds of a graph's styles. */\nexport const CX_STYLE_CAPABILITIES: StyleWriteCapabilities = cytoscapeWriteCapabilities(\"desktop\");\n\n/**\n * The dtype a column of written style values gets: numbers, booleans or text (a mixed column as text).\n * @param col - the values\n * @returns the dtype\n */\nfunction valuesDtype(col: StyleColumn): \"f64\" | \"bool\" | \"string\" {\n const kinds = new Set(col.filter((v) => v !== null).map((v) => typeof v));\n if (kinds.size === 1 && kinds.has(\"number\")) {\n return \"f64\";\n }\n return kinds.size === 1 && kinds.has(\"boolean\") ? \"bool\" : \"string\";\n}\n\n/** A CX or CX2 export with styles worked out. */\ninterface CytoscapeStyledExport {\n /** The graph to write: the columns the style's mappings read that the graph does not hold, added. */\n readonly snapshot: GraphSnapshot;\n /** The style, its bypasses (by element index) and the added columns. */\n readonly styled: CytoscapeEmitted;\n /** Every value written approximately or flattened into bypasses, as loss notes. */\n readonly notes: readonly LossNote[];\n}\n\n/**\n * A style note as a loss note.\n * @param n - the note\n * @returns the loss note\n */\nexport function lossOf(n: StyleNote): LossNote {\n return Object.freeze({\n code: n.code,\n message: n.message,\n column: null,\n count: n.params.count,\n style:\n n.params.target === null || n.params.property === null || n.params.target === \"graph\"\n ? undefined\n : Object.freeze({ target: n.params.target, property: n.params.property as never }),\n });\n}\n\n/**\n * Works out a CX or CX2 export with styles: the Cytoscape style of the rules, the bypasses that make Cytoscape draw\n * exactly what they give, and the snapshot with the columns its mappings read added.\n * @param snapshot - the graph handed to the exporter\n * @param input - the styles, or undefined when none are written\n * @param dialect - `\"desktop\"` for CX version 1, `\"cx2\"` for CX2\n * @returns the styled export, or null without styles\n */\nexport function cytoscapeStyledExport(\n snapshot: GraphSnapshot,\n input: ExporterStyleInput | undefined,\n dialect: CytoscapeDialect,\n): CytoscapeStyledExport | null {\n if (input === undefined) {\n return null;\n }\n const notes = new StyleNotes();\n const styled = emitCytoscapeStyle(input.rules, snapshot, { dialect, notes });\n return { snapshot: withMappedColumns(snapshot, styled), styled, notes: notes.list().map(lossOf) };\n}\n\n/**\n * The snapshot with the columns the emitted mappings read and it lacks added.\n * @param snapshot - the graph handed to the exporter\n * @param styled - the emitted style\n * @returns the snapshot itself when it lacks none\n */\nfunction withMappedColumns(snapshot: GraphSnapshot, styled: CytoscapeEmitted): GraphSnapshot {\n const missing = ([\"node\", \"edge\"] as const).flatMap((target) =>\n [...styled.columns[target]]\n .filter(([name]) => !(target === \"node\" ? snapshot.nodes : snapshot.edges).has(name))\n .map(([name, values]) => ({ target, name, values })),\n );\n if (missing.length === 0) {\n return snapshot;\n }\n const out = snapshot.withColumns();\n for (const { target, name, values } of missing) {\n const dtype = valuesDtype(values);\n const col = dtype === \"string\" ? values.map((v) => (v === null ? null : String(v))) : values;\n (target === \"node\" ? out.nodes : out.edges).set(name, col, { dtype });\n }\n return out;\n}\n"],"names":["cx2Points"],"mappings":";;;;AAsGO,SAAS,sBAAsC;AAClD,QAAM,SAAS,OAA6B;AAAA,IACxC,8BAAc,IAAA;AAAA,IACd,8BAAc,IAAA;AAAA,IACd,kCAAkB,IAAA;AAAA,IAClB,mCAAmB,IAAA;AAAA,EAAI;AAE3B,SAAO,EAAE,SAAS,EAAE,UAAU,oBAAI,IAAA,KAAS,MAAM,OAAA,GAAU,MAAM,SAAO;AAC5E;AAEA,MAAM,gBAAqC,oBAAI,IAAI,CAAC,WAAW,QAAQ,UAAU,SAAS,OAAO,OAAO,CAAC;AACzG,MAAM,UAAU;AAUT,SAAS,SAAS,KAAc,MAAuD;AAC1F,MAAI,OAAO,QAAQ,UAAU;AACzB,WAAO,OAAO,SAAS,GAAG,IAAI,MAAM;AAAA,EACxC;AACA,MAAI,OAAO,QAAQ,WAAW;AAC1B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