@graphty/graph-io 0.2.4 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/README.md +29 -7
  2. package/dist/chunks/{escape-DyI8JofU.js → escape-CKied3Ri.js} +16 -10
  3. package/dist/chunks/escape-CKied3Ri.js.map +1 -0
  4. package/dist/chunks/{importer-DbnGYr3_.js → importer-C6QcIRIb.js} +129 -39
  5. package/dist/chunks/importer-C6QcIRIb.js.map +1 -0
  6. package/dist/chunks/{importer-CpCpfbxr.js → importer-D5pAsweZ.js} +136 -31
  7. package/dist/chunks/importer-D5pAsweZ.js.map +1 -0
  8. package/dist/chunks/{importer-GozH8DkN.js → importer-DbMrAR_w.js} +10 -4
  9. package/dist/chunks/importer-DbMrAR_w.js.map +1 -0
  10. package/dist/chunks/{importer-CQnJuWJw.js → importer-DkzjTvHc.js} +82 -40
  11. package/dist/chunks/importer-DkzjTvHc.js.map +1 -0
  12. package/dist/chunks/{records-CGpxszm1.js → records-BKSMowhR.js} +3 -3
  13. package/dist/chunks/{records-CGpxszm1.js.map → records-BKSMowhR.js.map} +1 -1
  14. package/dist/chunks/{text-CajMdVFy.js → text-Dr0Ifpag.js} +2 -2
  15. package/dist/chunks/{text-CajMdVFy.js.map → text-Dr0Ifpag.js.map} +1 -1
  16. package/dist/chunks/{writer-DxSKC7TL.js → writer-BdMak4_J.js} +341 -112
  17. package/dist/chunks/writer-BdMak4_J.js.map +1 -0
  18. package/dist/csv.js +24 -6
  19. package/dist/csv.js.map +1 -1
  20. package/dist/dot.js +1 -1
  21. package/dist/gexf.js +42 -10
  22. package/dist/gexf.js.map +1 -1
  23. package/dist/gml.js +69 -25
  24. package/dist/gml.js.map +1 -1
  25. package/dist/graph-io.js +186 -129
  26. package/dist/graph-io.js.map +1 -1
  27. package/dist/graphml.js +1 -1
  28. package/dist/json.js +1 -1
  29. package/dist/neo4j.js +10 -4
  30. package/dist/neo4j.js.map +1 -1
  31. package/dist/pajek.js +1 -1
  32. package/dist/src/common/codes.d.ts +6 -0
  33. package/dist/src/common/codes.d.ts.map +1 -1
  34. package/dist/src/common/codes.js +6 -0
  35. package/dist/src/common/codes.js.map +1 -1
  36. package/dist/src/common/escape.d.ts +5 -4
  37. package/dist/src/common/escape.d.ts.map +1 -1
  38. package/dist/src/common/escape.js +6 -5
  39. package/dist/src/common/escape.js.map +1 -1
  40. package/dist/src/common/format.d.ts +3 -3
  41. package/dist/src/common/format.js +5 -5
  42. package/dist/src/common/format.js.map +1 -1
  43. package/dist/src/common/input.d.ts +24 -6
  44. package/dist/src/common/input.d.ts.map +1 -1
  45. package/dist/src/common/input.js +259 -23
  46. package/dist/src/common/input.js.map +1 -1
  47. package/dist/src/common/options.d.ts +2 -0
  48. package/dist/src/common/options.d.ts.map +1 -1
  49. package/dist/src/common/options.js +17 -0
  50. package/dist/src/common/options.js.map +1 -1
  51. package/dist/src/common/text.js +4 -4
  52. package/dist/src/common/text.js.map +1 -1
  53. package/dist/src/common/weights.d.ts.map +1 -1
  54. package/dist/src/common/weights.js +8 -0
  55. package/dist/src/common/weights.js.map +1 -1
  56. package/dist/src/common/xml.d.ts +7 -0
  57. package/dist/src/common/xml.d.ts.map +1 -1
  58. package/dist/src/common/xml.js +12 -0
  59. package/dist/src/common/xml.js.map +1 -1
  60. package/dist/src/formats/csv/exporter.d.ts +5 -1
  61. package/dist/src/formats/csv/exporter.d.ts.map +1 -1
  62. package/dist/src/formats/csv/exporter.js +8 -1
  63. package/dist/src/formats/csv/exporter.js.map +1 -1
  64. package/dist/src/formats/csv/importer.d.ts.map +1 -1
  65. package/dist/src/formats/csv/importer.js +1 -0
  66. package/dist/src/formats/csv/importer.js.map +1 -1
  67. package/dist/src/formats/csv/index.d.ts +6 -0
  68. package/dist/src/formats/csv/index.d.ts.map +1 -1
  69. package/dist/src/formats/csv/index.js +7 -1
  70. package/dist/src/formats/csv/index.js.map +1 -1
  71. package/dist/src/formats/csv/records.js +1 -1
  72. package/dist/src/formats/csv/records.js.map +1 -1
  73. package/dist/src/formats/dot/exporter.d.ts +1 -1
  74. package/dist/src/formats/dot/exporter.d.ts.map +1 -1
  75. package/dist/src/formats/dot/exporter.js +3 -3
  76. package/dist/src/formats/dot/exporter.js.map +1 -1
  77. package/dist/src/formats/dot/importer.d.ts +6 -0
  78. package/dist/src/formats/dot/importer.d.ts.map +1 -1
  79. package/dist/src/formats/dot/importer.js +151 -24
  80. package/dist/src/formats/dot/importer.js.map +1 -1
  81. package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
  82. package/dist/src/formats/gexf/exporter.js +32 -7
  83. package/dist/src/formats/gexf/exporter.js.map +1 -1
  84. package/dist/src/formats/gexf/importer.d.ts.map +1 -1
  85. package/dist/src/formats/gexf/importer.js +2 -2
  86. package/dist/src/formats/gexf/importer.js.map +1 -1
  87. package/dist/src/formats/gexf/index.d.ts +6 -0
  88. package/dist/src/formats/gexf/index.d.ts.map +1 -1
  89. package/dist/src/formats/gexf/index.js +7 -1
  90. package/dist/src/formats/gexf/index.js.map +1 -1
  91. package/dist/src/formats/gml/importer.d.ts +2 -2
  92. package/dist/src/formats/gml/importer.d.ts.map +1 -1
  93. package/dist/src/formats/gml/importer.js +66 -25
  94. package/dist/src/formats/gml/importer.js.map +1 -1
  95. package/dist/src/formats/gml/index.d.ts +7 -1
  96. package/dist/src/formats/gml/index.d.ts.map +1 -1
  97. package/dist/src/formats/gml/index.js +8 -2
  98. package/dist/src/formats/gml/index.js.map +1 -1
  99. package/dist/src/formats/graphml/constants.d.ts +6 -0
  100. package/dist/src/formats/graphml/constants.d.ts.map +1 -1
  101. package/dist/src/formats/graphml/constants.js +7 -1
  102. package/dist/src/formats/graphml/constants.js.map +1 -1
  103. package/dist/src/formats/graphml/importer.d.ts.map +1 -1
  104. package/dist/src/formats/graphml/importer.js +2 -2
  105. package/dist/src/formats/graphml/importer.js.map +1 -1
  106. package/dist/src/formats/json/exporter.d.ts.map +1 -1
  107. package/dist/src/formats/json/exporter.js +14 -5
  108. package/dist/src/formats/json/exporter.js.map +1 -1
  109. package/dist/src/formats/json/importer.d.ts +8 -0
  110. package/dist/src/formats/json/importer.d.ts.map +1 -1
  111. package/dist/src/formats/json/importer.js +84 -37
  112. package/dist/src/formats/json/importer.js.map +1 -1
  113. package/dist/src/formats/neo4j/importer.js +1 -1
  114. package/dist/src/formats/neo4j/importer.js.map +1 -1
  115. package/dist/src/formats/neo4j/index.d.ts +6 -0
  116. package/dist/src/formats/neo4j/index.d.ts.map +1 -1
  117. package/dist/src/formats/neo4j/index.js +7 -1
  118. package/dist/src/formats/neo4j/index.js.map +1 -1
  119. package/dist/src/formats/pajek/exporter.d.ts +2 -0
  120. package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
  121. package/dist/src/formats/pajek/exporter.js +13 -2
  122. package/dist/src/formats/pajek/exporter.js.map +1 -1
  123. package/dist/src/formats/pajek/importer.d.ts +8 -2
  124. package/dist/src/formats/pajek/importer.d.ts.map +1 -1
  125. package/dist/src/formats/pajek/importer.js +122 -26
  126. package/dist/src/formats/pajek/importer.js.map +1 -1
  127. package/dist/src/index.d.ts +1 -1
  128. package/dist/src/index.d.ts.map +1 -1
  129. package/dist/src/index.js +1 -1
  130. package/dist/src/index.js.map +1 -1
  131. package/dist/src/registry.d.ts +26 -0
  132. package/dist/src/registry.d.ts.map +1 -1
  133. package/dist/src/registry.js +101 -35
  134. package/dist/src/registry.js.map +1 -1
  135. package/dist/src/sniff.d.ts +1 -1
  136. package/dist/src/sniff.d.ts.map +1 -1
  137. package/dist/src/sniff.js +6 -1
  138. package/dist/src/sniff.js.map +1 -1
  139. package/dist/src/types.d.ts +22 -3
  140. package/dist/src/types.d.ts.map +1 -1
  141. package/dist/src/types.js.map +1 -1
  142. package/package.json +4 -3
  143. package/src/common/codes.ts +9 -0
  144. package/src/common/escape.ts +6 -5
  145. package/src/common/format.ts +5 -5
  146. package/src/common/input.ts +293 -22
  147. package/src/common/options.ts +24 -0
  148. package/src/common/text.ts +4 -4
  149. package/src/common/weights.ts +9 -0
  150. package/src/common/xml.ts +14 -0
  151. package/src/formats/csv/exporter.ts +12 -1
  152. package/src/formats/csv/importer.ts +1 -0
  153. package/src/formats/csv/index.ts +9 -0
  154. package/src/formats/csv/records.ts +1 -1
  155. package/src/formats/dot/exporter.ts +3 -3
  156. package/src/formats/dot/importer.ts +172 -32
  157. package/src/formats/gexf/exporter.ts +38 -7
  158. package/src/formats/gexf/importer.ts +12 -2
  159. package/src/formats/gexf/index.ts +9 -0
  160. package/src/formats/gml/importer.ts +75 -22
  161. package/src/formats/gml/index.ts +10 -1
  162. package/src/formats/graphml/constants.ts +9 -0
  163. package/src/formats/graphml/importer.ts +9 -2
  164. package/src/formats/json/exporter.ts +14 -5
  165. package/src/formats/json/importer.ts +104 -36
  166. package/src/formats/neo4j/importer.ts +1 -1
  167. package/src/formats/neo4j/index.ts +9 -0
  168. package/src/formats/pajek/exporter.ts +19 -2
  169. package/src/formats/pajek/importer.ts +145 -28
  170. package/src/index.ts +1 -0
  171. package/src/registry.ts +131 -40
  172. package/src/sniff.ts +6 -1
  173. package/src/types.ts +26 -3
  174. package/dist/chunks/escape-DyI8JofU.js.map +0 -1
  175. package/dist/chunks/importer-CQnJuWJw.js.map +0 -1
  176. package/dist/chunks/importer-CpCpfbxr.js.map +0 -1
  177. package/dist/chunks/importer-DbnGYr3_.js.map +0 -1
  178. package/dist/chunks/importer-GozH8DkN.js.map +0 -1
  179. package/dist/chunks/writer-DxSKC7TL.js.map +0 -1
  180. package/dist/tsconfig.build.tsbuildinfo +0 -1
package/README.md CHANGED
@@ -75,8 +75,27 @@ for await (const chunk of csvExporter.export(snapshot, { dialect: "gephi" })) {
75
75
  ```
76
76
 
77
77
  Inputs may be a `string`, a `Uint8Array`, a `ReadableStream<Uint8Array>` (a `File.stream()`, a fetch
78
- body) or an async iterable of text or byte chunks. Bytes are decoded as UTF-8 with `fatal: true`, so
79
- an invalid sequence is a `parse-error`, never a silent U+FFFD.
78
+ body) or an async iterable of text or byte chunks. Bytes are decoded by one shared layer, whatever
79
+ the format. The encoding is, in order: the `encoding` option (any WHATWG label, such as
80
+ `"windows-1252"` or `"utf-16le"`); a byte order mark (UTF-8, UTF-16LE, UTF-16BE); the encoding the
81
+ file declares (the XML prolog of GEXF and GraphML, DOT's `charset` attribute); else UTF-8. Decoding
82
+ is strict, never a silent U+FFFD. Undeclared bytes that are not UTF-8 are read as windows-1252 with
83
+ the warning `W_ENCODING_FALLBACK` (Excel, Pajek and older tools write it); invalid UTF-8 after valid
84
+ non-ASCII UTF-8, or binary data, is the `parse-error` `E_INVALID_UTF8`.
85
+
86
+ Some files hold several graphs: a DOT file with several `graph { }` blocks, a Pajek project (`.paj`)
87
+ with several networks, a GML file with several `graph [ ]` blocks, a JGF document with a `graphs`
88
+ array. `importGraph()` (and each importer's `import()`) reads the first and records the warning
89
+ `W_MULTIPLE_GRAPHS`, which says how many it skipped. `importAllGraphs()` (and `importer.importAll()`
90
+ where a format can hold several) returns every graph, each frozen on its own:
91
+
92
+ ```ts
93
+ import { importAllGraphs } from "@graphty/graph-io";
94
+
95
+ for (const { snapshot, report } of await importAllGraphs(bytes, { filename: "project.paj" })) {
96
+ console.log(snapshot.meta.name, snapshot.nodeCount, report.warningCount);
97
+ }
98
+ ```
80
99
 
81
100
  ### Common import options
82
101
 
@@ -95,6 +114,7 @@ an invalid sequence is a `parse-error`, never a silent U+FFFD.
95
114
  | `hyperedges` | `"skip"` | GraphML / JGF hyperedges: `"error"`, `"skip"` with a report entry, `"star"` or `"clique"`. |
96
115
  | `errorLimit` | `100` | Recoverable errors tolerated before the importer throws `ImportError` with the partial report. |
97
116
  | `signal`, `onProgress` | | Cancellation (rejects with the signal's reason) and byte progress (`bytesTotal` known for in-memory input). |
117
+ | `encoding` | detected | The encoding of byte input; overrides the byte order mark and the file's declaration. Ignored for text input. |
98
118
 
99
119
  On a caller's builder the builder-policy options (`addMissingNodes`, `duplicateEdges`, `selfLoops`,
100
120
  `weightDtype`) are read from the sink; an explicit request the sink does not honour is reported once
@@ -169,7 +189,7 @@ losses and format rules, in addition to the table:
169
189
  - **DOT**: a Graphviz-faithful parser (grammar violations are fatal, as in Graphviz); clusters are
170
190
  container nodes with the `parent` role; ports are kept; HTML strings keep their brackets; `pos`
171
191
  maps to the position role. Mixed direction is folded per `onMixedDirection`; a text with a
172
- backslash before a quote or at its end cannot be written (`E_DOT_TRAILING_BACKSLASH`: Graphviz's
192
+ backslash before a quote or a line break, or at its end, cannot be written (`E_DOT_TRAILING_BACKSLASH`: Graphviz's
173
193
  scanner consumes backslash pairs, so such a text has no quoted spelling).
174
194
  - **Pajek**: `*Vertices N` bounds the id space (ids 1..N; a 0-based file is detected and reported;
175
195
  a count the sink cannot reserve is fatal); `*Arcs` / `*Edges` sections give per-section
@@ -240,17 +260,19 @@ Issue categories are `parse-error`, `missing-value`, `validation-error`, `unsupp
240
260
  (`GEXF_ISSUE`, `GRAPHML_ISSUE`, `GML_ISSUE`, `DOT_ISSUE`, `PAJEK_ISSUE`, `CSV_ISSUE`,
241
261
  `JSON_ISSUE`, `NEO4J_ISSUE`) and shared across formats (`SINK_OPTION_CODE`, `ID_MERGED_CODE`,
242
262
  `DIRECTION_REFUSED_CODE`, `DIRECTION_FORCED_CODE`, `RENAMED_CODE`, `PRECISION_CODE`,
243
- `INVALID_UTF8_CODE`, `PARSE_ERROR_CODE`). The builder throws on the first hard error; the importer
263
+ `INVALID_UTF8_CODE`, `INVALID_ENCODING_CODE`, `ENCODING_FALLBACK_CODE`, `UNKNOWN_ENCODING_CODE`,
264
+ `PARSE_ERROR_CODE`). The builder throws on the first hard error; the importer
244
265
  catches it per element, records an issue, skips the element and continues until `errorLimit`, then
245
266
  throws `ImportError` (`code === "E_IMPORT"`) carrying the partial report. An input that cannot be
246
- read at all (invalid UTF-8, malformed XML, no recognisable format) is an `ImportError` at once.
267
+ read at all (bytes invalid in the chosen encoding, malformed XML, no recognisable format) is an
268
+ `ImportError` at once.
247
269
 
248
270
  ## Writing a plugin
249
271
 
250
272
  `GraphImporter` and `GraphExporter` (design section 12.4) are plain objects; the helpers every
251
273
  built-in format is built on are exported for third-party plugins: `ImportReportBuilder` (issues,
252
- error limit, `warnOnce`, `ImportError`), `textChunks` / `readText` / `LineReader` (streaming UTF-8
253
- input with cancellation and progress), `tokenizeXml` / `XmlTokenizer` (the streaming XML tokenizer
274
+ error limit, `warnOnce`, `ImportError`), `textChunks` / `readText` / `LineReader` (streaming
275
+ input decoded by the shared encoding rules, with cancellation and progress), `tokenizeXml` / `XmlTokenizer` (the streaming XML tokenizer
254
276
  behind GEXF and GraphML), `resolveImportOptions` / `resolveExportOptions` / `reportSinkOptions` /
255
277
  `reportUnusedOptions`, `DirectionResolver` (the mixed-direction rules of section 8.4) and
256
278
  `pairFolding` (its inverse for exporters), `IdCoercer`, `parseTextCell` and `TextCellWriter` (the
@@ -1,5 +1,5 @@
1
1
  import { GraphFormatError } from "@graphty/graph-format";
2
- import { aF as isNameChar, a6 as XML_ILLEGAL_CHAR_CODE } from "./writer-DxSKC7TL.js";
2
+ import { aI as isNameChar, a9 as XML_ILLEGAL_CHAR_CODE } from "./writer-BdMak4_J.js";
3
3
  class XmlSyntaxError extends Error {
4
4
  /**
5
5
  * Create the error.
@@ -113,6 +113,11 @@ function countIllegalRows(column) {
113
113
  }
114
114
  return bad;
115
115
  }
116
+ const XML_DECLARED_ENCODING = /^<\?xml\s[^>]*?\bencoding\s*=\s*["']([A-Za-z][A-Za-z0-9._-]*)["']/;
117
+ function xmlDeclaredEncoding(head) {
118
+ const match = XML_DECLARED_ENCODING.exec(head);
119
+ return match === null ? null : match[1];
120
+ }
116
121
  function isXmlName(text) {
117
122
  if (text.length === 0) {
118
123
  return false;
@@ -884,7 +889,7 @@ function isDotIdentifier(text) {
884
889
  return true;
885
890
  }
886
891
  function isWritableDotText(text) {
887
- return !text.endsWith("\\") && !text.includes('\\"');
892
+ return !text.endsWith("\\") && !text.includes('\\"') && !/\\[\r\n]/.test(text);
888
893
  }
889
894
  function quoteDotId(text) {
890
895
  if (isBareDotId(text)) {
@@ -921,18 +926,19 @@ export {
921
926
  XmlTokenizer as a,
922
927
  quoteDotId as b,
923
928
  isWritableDotText as c,
924
- isWhitespace as d,
925
- escapeXmlText as e,
926
- escapeXmlAttribute as f,
927
- decodeGmlString as g,
929
+ xmlDeclaredEncoding as d,
930
+ isWhitespace as e,
931
+ escapeXmlText as f,
932
+ escapeXmlAttribute as g,
928
933
  hasIllegalXmlChar as h,
929
934
  isPajekLabel as i,
930
- quoteGmlString as j,
931
- isXmlName as k,
935
+ decodeGmlString as j,
936
+ quoteGmlString as k,
932
937
  localName as l,
933
- quoteCsvCell as m,
938
+ isXmlName as m,
939
+ quoteCsvCell as n,
934
940
  quotePajekLabel as q,
935
941
  tokenizeXml as t,
936
942
  xmlIllegalTextNotes as x
937
943
  };
938
- //# sourceMappingURL=escape-DyI8JofU.js.map
944
+ //# sourceMappingURL=escape-CKied3Ri.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escape-CKied3Ri.js","sources":["../../src/common/xml.ts","../../src/common/escape.ts"],"sourcesContent":["/**\n * The streaming XML tokenizer shared by the GEXF and GraphML importers (design sections 8.2 and\n * 8.4): SAX-style start / end / text events over the text chunks of the common reader, so both\n * importers run in one pass with bounded memory and every issue carries a line number.\n *\n * Cost model: every character of the input is scanned once. A token that spans many chunks (a\n * long attribute value, comment, CDATA section or name) resumes where the previous chunk left off\n * instead of re-reading the token from its `<`, and line numbers are counted from a cached next\n * line-break position, so a document without line breaks costs the same as one with them.\n *\n * What it handles: the XML declaration and processing instructions (skipped), comments (skipped),\n * CDATA sections (text), a DOCTYPE with an internal subset (skipped; entity declarations are not\n * expanded, so an unknown entity reference is a syntax error), the five predefined entities and\n * numeric character references (decimal and hexadecimal) in text and attribute values, attribute\n * value whitespace normalisation, end-of-line normalisation (CR LF and lone CR become LF), and\n * well-formedness: matching end tags, one root element, no text outside it, no duplicate\n * attributes, no unterminated markup at the end of the input. Namespaces are not resolved; element\n * and attribute names are reported as written (with their prefix).\n *\n * Why not fast-xml-parser: its XMLParser accepts mismatched and unclosed tags without error, does\n * not decode numeric character references unless the deprecated `htmlEntities` option is set, and\n * its validator (`XMLValidator`, the `parse(xml, true)` overload) and `XMLBuilder` are deprecated in\n * 5.x, which the root lint's `no-deprecated` rule forbids using; so the malformed corpus could not\n * be rejected and attribute values written by the common `escapeXmlAttribute` (`&#10;`) could not\n * be read back.\n */\n\nimport { type Column, type GraphSnapshot } from \"@graphty/graph-format\";\n\nimport { type LossNote } from \"../types.js\";\nimport { XML_ILLEGAL_CHAR_CODE } from \"./codes.js\";\nimport { isNameChar } from \"./export.js\";\n\n/** The events of the tokenizer; every callback is synchronous. */\nexport interface XmlHandler {\n /**\n * An element starts (a self-closing element produces start then end).\n * @param name - the element name as written, prefix included\n * @param attrs - the attributes, entities decoded, in document order\n * @param line - the 1-based line of the `<`\n */\n start(name: string, attrs: ReadonlyMap<string, string>, line: number): void;\n /**\n * An element ends.\n * @param name - the element name\n * @param line - the 1-based line of the end tag (or of the self-closing start tag)\n */\n end(name: string, line: number): void;\n /**\n * Character data between two tags (entities decoded, CDATA included), one call per run;\n * whitespace-only runs are delivered too.\n * @param text - the text\n * @param line - the 1-based line where the run starts\n */\n text(text: string, line: number): void;\n}\n\n/** A well-formedness or syntax error, with the line it was found on. */\nexport class XmlSyntaxError extends Error {\n /** The 1-based line. */\n readonly line: number;\n\n /**\n * Create the error.\n * @param message - a plain-ASCII message\n * @param line - the 1-based line\n */\n constructor(message: string, line: number) {\n super(message);\n this.name = \"XmlSyntaxError\";\n this.line = line;\n }\n}\n\nconst NAMED_ENTITIES: Readonly<Record<string, string>> = {\n lt: \"<\",\n gt: \">\",\n amp: \"&\",\n quot: '\"',\n apos: \"'\",\n};\n\nconst LT = 60;\nconst GT = 62;\nconst SLASH = 47;\nconst EQUALS = 61;\nconst QUOTE = 34;\nconst APOS = 39;\nconst OPEN_BRACKET = 91;\nconst CLOSE_BRACKET = 93;\nconst BANG = 33;\nconst DASH = 45;\n\n/** The longest entity reference held back at a chunk boundary (`&#x10FFFF;` is 10 characters). */\nconst MAX_ENTITY_LENGTH = 16;\n\n/** Markup shorter than this (`<![CDATA[` is 9 characters) cannot be classified yet. */\nconst MIN_DECIDABLE_MARKUP = 9;\n\n/**\n * Whether a char code is XML whitespace (space, tab, LF, CR).\n * @param c - the char code\n * @returns true for whitespace\n */\nfunction isSpace(c: number): boolean {\n return c === 32 || c === 9 || c === 10 || c === 13;\n}\n\n/**\n * Whether a code point may start an XML Name: a NameChar that is not a digit, `-`, `.`, U+00B7,\n * a combining character (U+0300..U+036F) or U+203F / U+2040.\n * @param cp - the code point\n * @returns true for a NameStartChar\n */\nfunction isNameStart(cp: number): boolean {\n if (!isNameChar(cp)) {\n return false;\n }\n if ((cp >= 0x30 && cp <= 0x39) || cp === 0x2d || cp === 0x2e || cp === 0xb7) {\n return false;\n }\n return !(cp >= 0x300 && cp <= 0x36f) && cp !== 0x203f && cp !== 0x2040;\n}\n\n/** ASCII code -> whether it is a NameStartChar / NameChar, for the fast path of readName(). */\nconst ASCII_NAME_START = new Uint8Array(128);\nconst ASCII_NAME_CHAR = new Uint8Array(128);\nfor (let c = 0; c < 128; c++) {\n ASCII_NAME_START[c] = isNameStart(c) ? 1 : 0;\n ASCII_NAME_CHAR[c] = isNameChar(c) ? 1 : 0;\n}\n\n/**\n * Characters XML 1.0 forbids in a document (the Char production): C0 controls other than tab, LF\n * and CR, U+FFFE / U+FFFF, and lone surrogates (the `u` flag makes the surrogate class match only\n * an unpaired one). Built from char codes so no control character appears in the source.\n */\nconst ILLEGAL_CHAR = new RegExp(\n `[${String.fromCharCode(0)}-${String.fromCharCode(8)}${String.fromCharCode(11)}${String.fromCharCode(12)}` +\n `${String.fromCharCode(14)}-${String.fromCharCode(31)}\\\\uFFFE\\\\uFFFF\\\\uD800-\\\\uDFFF]`,\n \"u\",\n);\n\n/**\n * Whether a text holds a character XML 1.0 forbids (see ILLEGAL_CHAR); such a character cannot be\n * written even as a character reference, so a conforming parser rejects the whole document.\n * @param text - the text\n * @returns true when the text cannot appear in an XML 1.0 document\n */\nexport function hasIllegalXmlChar(text: string): boolean {\n return ILLEGAL_CHAR.test(text);\n}\n\n/**\n * The loss notes of the texts a snapshot holds that no XML 1.0 document can carry (see\n * hasIllegalXmlChar): one E_XML_ILLEGAL_CHAR note per column (node, edge and graph string / dict /\n * list-of-text columns) and one for the ids, each counting the affected rows; export() throws on\n * the first such text. Shared by the GEXF and GraphML exporters' check().\n * @param snapshot - the snapshot\n * @returns the notes, empty when every text is writable\n */\nexport function xmlIllegalTextNotes(snapshot: GraphSnapshot): LossNote[] {\n const notes: LossNote[] = [];\n let ids = 0;\n for (let i = 0; i < snapshot.nodeCount; i++) {\n const id = snapshot.ids.idOf(i);\n if (typeof id === \"string\" && hasIllegalXmlChar(id)) {\n ids++;\n }\n }\n if (ids > 0) {\n notes.push(\n Object.freeze({\n code: XML_ILLEGAL_CHAR_CODE,\n message: `${ids} node id(s) hold a character XML 1.0 cannot carry; export() will throw`,\n column: null,\n count: ids,\n }),\n );\n }\n for (const [domain, table] of [\n [\"node\", snapshot.nodes],\n [\"edge\", snapshot.edges],\n [\"graph\", snapshot.graph],\n ] as const) {\n for (const column of table) {\n const bad = countIllegalRows(column);\n if (bad > 0) {\n notes.push(\n Object.freeze({\n code: XML_ILLEGAL_CHAR_CODE,\n message: `${domain} column \"${column.meta.name}\": ${bad} value(s) hold a character XML 1.0 cannot carry; export() will throw`,\n column: column.meta.name,\n count: bad,\n }),\n );\n }\n }\n }\n return notes;\n}\n\n/**\n * How many set rows of a text column hold an XML-illegal character.\n * @param column - the column\n * @returns the count; 0 for a non-text column\n */\nfunction countIllegalRows(column: Column): number {\n let bad = 0;\n if (column.dtype === \"string\" || column.dtype === \"dict\") {\n for (let r = 0; r < column.length; r++) {\n if (column.isSet(r) && hasIllegalXmlChar(column.value(r) as string)) {\n bad++;\n }\n }\n } else if (column.dtype === \"list\" && (column.meta.itemDtype === \"string\" || column.meta.itemDtype === \"dict\")) {\n for (let r = 0; r < column.length; r++) {\n if (\n column.isSet(r) &&\n column.sliceOf(r).some((item) => typeof item === \"string\" && hasIllegalXmlChar(item))\n ) {\n bad++;\n }\n }\n }\n return bad;\n}\n\n/** The encoding pseudo-attribute of an XML declaration at the very start of a document. */\nconst XML_DECLARED_ENCODING = /^<\\?xml\\s[^>]*?\\bencoding\\s*=\\s*[\"']([A-Za-z][A-Za-z0-9._-]*)[\"']/;\n\n/**\n * The encoding an XML document declares in its prolog (`<?xml version=\"1.0\" encoding=\"...\"?>`),\n * for the shared byte decoder (common/input.ts).\n * @param head - the start of the document, decoded as windows-1252\n * @returns the declared label, or null when there is no declaration or it names no encoding\n */\nexport function xmlDeclaredEncoding(head: string): string | null {\n const match = XML_DECLARED_ENCODING.exec(head);\n return match === null ? null : match[1];\n}\n\n/**\n * Whether a text is an XML Name.\n * @param text - the text\n * @returns true for a well-formed name\n */\nexport function isXmlName(text: string): boolean {\n if (text.length === 0) {\n return false;\n }\n let first = true;\n for (const ch of text) {\n const cp = ch.codePointAt(0);\n if (cp === undefined || (first ? !isNameStart(cp) : !isNameChar(cp))) {\n return false;\n }\n first = false;\n }\n return true;\n}\n\n/**\n * Whether a code point is a legal XML 1.0 character.\n * @param cp - the code point\n * @returns true when a character reference may produce it\n */\nfunction isXmlChar(cp: number): boolean {\n return (\n cp === 0x9 ||\n cp === 0xa ||\n cp === 0xd ||\n (cp >= 0x20 && cp <= 0xd7ff) ||\n (cp >= 0xe000 && cp <= 0xfffd) ||\n (cp >= 0x10000 && cp <= 0x10ffff)\n );\n}\n\n/**\n * Decode the predefined entities and character references of a text.\n * @param raw - the text as written\n * @param line - the line, for errors\n * @returns the decoded text\n */\nexport function decodeEntities(raw: string, line: number): string {\n let amp = raw.indexOf(\"&\");\n if (amp < 0) {\n return raw;\n }\n let out = \"\";\n let start = 0;\n while (amp >= 0) {\n out += raw.slice(start, amp);\n const semi = raw.indexOf(\";\", amp + 1);\n if (semi < 0) {\n throw new XmlSyntaxError(\"unterminated entity reference\", line);\n }\n const name = raw.slice(amp + 1, semi);\n if (name.startsWith(\"#\")) {\n const hex = name.startsWith(\"#x\") || name.startsWith(\"#X\");\n const digits = name.slice(hex ? 2 : 1);\n const ok = hex ? /^[0-9a-fA-F]{1,6}$/.test(digits) : /^[0-9]{1,7}$/.test(digits);\n const cp = ok ? Number.parseInt(digits, hex ? 16 : 10) : -1;\n if (cp < 0 || !isXmlChar(cp)) {\n throw new XmlSyntaxError(`invalid character reference &${name};`, line);\n }\n out += String.fromCodePoint(cp);\n } else {\n const value = NAMED_ENTITIES[name];\n if (value === undefined) {\n throw new XmlSyntaxError(`unknown entity &${name};`, line);\n }\n out += value;\n }\n start = semi + 1;\n amp = raw.indexOf(\"&\", start);\n }\n return out + raw.slice(start);\n}\n\n/**\n * Whether a text is whitespace only.\n * @param text - the text\n * @returns true when every character is XML whitespace (also for an empty text)\n */\nexport function isWhitespace(text: string): boolean {\n for (let i = 0; i < text.length; i++) {\n if (!isSpace(text.charCodeAt(i))) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * The local part of a possibly prefixed XML name.\n * @param name - the name as written\n * @returns the text after the last colon, or the name itself\n */\nexport function localName(name: string): string {\n const colon = name.lastIndexOf(\":\");\n return colon < 0 ? name : name.slice(colon + 1);\n}\n\n/**\n * Tokenize XML text arriving in chunks and deliver events to a handler. Throws XmlSyntaxError on\n * malformed input; any error the handler throws propagates unchanged.\n * @param chunks - the text (already UTF-8 decoded, BOM removed)\n * @param handler - the event sink\n */\nexport async function tokenizeXml(chunks: AsyncIterable<string>, handler: XmlHandler): Promise<void> {\n const tokenizer = new XmlTokenizer(handler);\n for await (const chunk of chunks) {\n tokenizer.push(chunk);\n }\n tokenizer.finish();\n}\n\n/** The result of parsing one start tag out of the buffer. */\ninterface StartTag {\n /** The element name. */\n readonly name: string;\n /** The attributes. */\n readonly attrs: Map<string, string>;\n /** Whether the tag ends with `/>`. */\n readonly selfClosing: boolean;\n /** The buffer index one past the `>`. */\n readonly end: number;\n}\n\n/** The kinds of markup whose end may lie in a later chunk. */\ntype PendingKind = \"decl\" | \"comment\" | \"cdata\" | \"pi\" | \"endtag\" | \"doctype\" | \"starttag\";\n\n/** The terminator of each fixed-terminator markup kind. */\nconst TERMINATORS: Readonly<Partial<Record<PendingKind, string>>> = {\n comment: \"-->\",\n cdata: \"]]>\",\n pi: \"?>\",\n endtag: \">\",\n};\n\n/**\n * An incomplete piece of markup at the end of the input so far: its text pieces (never joined\n * until the end is found, so a token spanning many chunks costs its length once) and the state\n * the terminator scan is in. `tail` holds the last characters of the pieces a fixed terminator\n * could straddle; `quote` is the open quote character (0 outside a value) of a start tag or a\n * DOCTYPE; `depth`, `comment` and `run` track a DOCTYPE's internal subset.\n */\ninterface Pending {\n kind: PendingKind;\n readonly pieces: string[];\n tail: string;\n quote: number;\n depth: number;\n comment: boolean;\n run: number;\n}\n\n/**\n * The tokenizer state: the unconsumed tail of the input, the current line, the open element\n * stack and the text run being accumulated. `push()` chunks, then `finish()`.\n */\nexport class XmlTokenizer {\n private readonly handler: XmlHandler;\n\n /** Unconsumed input that is not part of a pending token: at most a held-back entity or the last chunk. */\n private buffer = \"\";\n\n /** The markup whose end has not arrived yet, or null. */\n private pending: Pending | null = null;\n\n /** The line number at the start of `buffer` (or of the pending markup). */\n private line = 1;\n\n /**\n * The index of the next line break in `buffer` at or after the last counted position: -2\n * when not yet searched for the current buffer, -1 when the buffer holds no further break.\n */\n private nextBreak = -2;\n\n /** A CR held back from the end of the previous chunk (it may be the first half of CR LF). */\n private pendingCr = false;\n\n /** Whether the input has ended (an incomplete token is then an error, not a wait). */\n private final = false;\n\n /** The text run being accumulated (entities decoded), and the line it started on. */\n private text = \"\";\n\n private textLine = 1;\n\n private readonly stack: string[] = [];\n\n private rootSeen = false;\n\n private rootClosed = false;\n\n /**\n * Create a tokenizer.\n * @param handler - the event sink\n */\n constructor(handler: XmlHandler) {\n this.handler = handler;\n }\n\n /**\n * Feed one chunk and emit every complete token in it.\n * @param chunk - the text\n */\n push(chunk: string): void {\n let text = chunk;\n if (this.pendingCr) {\n text = `\\r${text}`;\n this.pendingCr = false;\n }\n if (text.endsWith(\"\\r\")) {\n this.pendingCr = true;\n text = text.slice(0, -1);\n }\n if (text.includes(\"\\r\")) {\n text = text.replace(/\\r\\n?/g, \"\\n\");\n }\n this.feed(text);\n }\n\n /** Signal the end of the input: flush the last text run and check well-formedness. */\n finish(): void {\n this.final = true;\n if (this.pendingCr) {\n this.pendingCr = false;\n this.feed(\"\\n\");\n } else {\n this.feed(\"\");\n }\n if (this.pending !== null || this.buffer.length > 0) {\n throw new XmlSyntaxError(\"unexpected end of input inside markup\", this.line);\n }\n this.flushText();\n if (this.stack.length > 0) {\n throw new XmlSyntaxError(`unclosed element <${this.stack[this.stack.length - 1]}>`, this.line);\n }\n if (!this.rootSeen) {\n throw new XmlSyntaxError(\"no root element\", this.line);\n }\n }\n\n /**\n * Append normalised text: continue a pending token's terminator scan over the new text alone,\n * and once the token is complete (or when none is pending) scan the buffer for tokens.\n * @param text - the text, line breaks normalised\n */\n private feed(text: string): void {\n const { pending } = this;\n if (pending === null) {\n this.buffer = this.buffer.length === 0 ? text : this.buffer + text;\n this.nextBreak = -2;\n this.scan();\n return;\n }\n if (pending.kind === \"decl\") {\n // fewer than MIN_DECIDABLE_MARKUP characters of markup: the kind is decided once enough arrived\n this.pending = null;\n this.buffer = pending.pieces.join(\"\") + text;\n this.nextBreak = -2;\n this.scan();\n return;\n }\n const end = this.scanPending(pending, text);\n if (end < 0) {\n if (text.length > 0) {\n pending.pieces.push(text);\n }\n if (this.final) {\n throw new XmlSyntaxError(\"unexpected end of input inside markup\", this.line);\n }\n return;\n }\n this.pending = null;\n pending.pieces.push(text.slice(0, end));\n this.buffer = pending.pieces.join(\"\") + text.slice(end);\n this.nextBreak = -2;\n this.scan();\n }\n\n /**\n * Continue the terminator scan of a pending token over new text.\n * @param pending - the pending token\n * @param text - the new text\n * @returns the index in `text` one past the token's end, or -1 when it does not end there\n */\n private scanPending(pending: Pending, text: string): number {\n switch (pending.kind) {\n case \"starttag\":\n return this.scanStartTag(pending, text, 0);\n case \"doctype\":\n return this.scanDoctype(pending, text, 0);\n case \"decl\":\n return -1;\n default: {\n const terminator = TERMINATORS[pending.kind] ?? \">\";\n const probe = pending.tail + text;\n const at = probe.indexOf(terminator);\n if (at < 0) {\n pending.tail = probe.slice(Math.max(0, probe.length - (terminator.length - 1)));\n return -1;\n }\n return at + terminator.length - pending.tail.length;\n }\n }\n }\n\n /**\n * Scan text for the `>` that ends a start tag, skipping quoted attribute values (the quote\n * state survives between calls).\n * @param pending - the pending token\n * @param text - the text\n * @param from - where to start\n * @returns the index one past the `>`, or -1\n */\n private scanStartTag(pending: Pending, text: string, from: number): number {\n let { quote } = pending;\n const n = text.length;\n let i = from;\n while (i < n) {\n if (quote !== 0) {\n // inside an attribute value: jump to its closing quote\n const close = text.indexOf(String.fromCharCode(quote), i);\n if (close < 0) {\n break;\n }\n quote = 0;\n i = close + 1;\n continue;\n }\n const c = text.charCodeAt(i);\n if (c === QUOTE || c === APOS) {\n quote = c;\n } else if (c === GT) {\n pending.quote = 0;\n return i + 1;\n }\n i++;\n }\n pending.quote = quote;\n return -1;\n }\n\n /**\n * Scan text for the `>` that ends a DOCTYPE declaration, skipping a bracketed internal subset,\n * quoted literals and comments inside the subset. A character state machine, so the state\n * (`depth`, `quote`, `comment`, and `run`, the progress through a `<!--` or the dashes before\n * a `-->`) survives between calls and nothing is re-read.\n * @param pending - the pending token\n * @param text - the text\n * @param from - where to start\n * @returns the index one past the `>`, or -1\n */\n private scanDoctype(pending: Pending, text: string, from: number): number {\n let { quote, depth, comment, run } = pending;\n for (let i = from; i < text.length; i++) {\n const c = text.charCodeAt(i);\n if (comment) {\n if (c === DASH) {\n run++;\n } else if (c === GT && run >= 2) {\n comment = false;\n run = 0;\n } else {\n run = 0;\n }\n continue;\n }\n if (quote !== 0) {\n if (c === quote) {\n quote = 0;\n }\n continue;\n }\n if (depth > 0) {\n if (run === 1 && c === BANG) {\n run = 2;\n continue;\n }\n if (run === 2 && c === DASH) {\n run = 3;\n continue;\n }\n if (run === 3 && c === DASH) {\n comment = true;\n run = 0;\n continue;\n }\n run = 0;\n if (c === LT) {\n run = 1;\n continue;\n }\n }\n if (c === QUOTE || c === APOS) {\n quote = c;\n } else if (c === OPEN_BRACKET) {\n depth++;\n } else if (c === CLOSE_BRACKET) {\n depth--;\n } else if (c === GT && depth <= 0) {\n pending.quote = 0;\n pending.depth = 0;\n pending.comment = false;\n pending.run = 0;\n return i + 1;\n }\n }\n pending.quote = quote;\n pending.depth = depth;\n pending.comment = comment;\n pending.run = run;\n return -1;\n }\n\n /**\n * Consume every complete token at the front of the buffer; an incomplete token at its end\n * becomes the pending token (its text moved out of the buffer), a possibly split entity\n * reference is held back in the buffer.\n */\n private scan(): void {\n const { buffer } = this;\n const { length } = buffer;\n let pos = 0;\n let incomplete = false;\n for (;;) {\n const lt = buffer.indexOf(\"<\", pos);\n if (lt < 0) {\n let end = length;\n if (!this.final) {\n // an entity reference may be split across chunks: hold back from its \"&\"\n const amp = buffer.lastIndexOf(\"&\");\n if (amp >= pos && amp >= length - MAX_ENTITY_LENGTH && buffer.indexOf(\";\", amp) < 0) {\n end = amp;\n }\n }\n this.takeText(pos, end);\n pos = end;\n break;\n }\n if (lt > pos) {\n this.takeText(pos, lt);\n pos = lt;\n }\n const next = this.consumeMarkup(pos);\n if (next < 0) {\n incomplete = true;\n break;\n }\n pos = next;\n }\n if (incomplete) {\n this.pending = this.startPending(buffer, pos);\n this.buffer = \"\";\n } else {\n this.buffer = pos === 0 ? buffer : buffer.slice(pos);\n }\n this.nextBreak = -2;\n }\n\n /**\n * Turn the incomplete markup at `pos` into a pending token, running the terminator scan over\n * the part already in the buffer so later chunks are scanned alone.\n * @param buffer - the buffer\n * @param pos - the index of the `<`\n * @returns the pending token\n */\n private startPending(buffer: string, pos: number): Pending {\n const piece = pos === 0 ? buffer : buffer.slice(pos);\n const pending: Pending = {\n kind: \"starttag\",\n pieces: [piece],\n tail: \"\",\n quote: 0,\n depth: 0,\n comment: false,\n run: 0,\n };\n if (piece.length < MIN_DECIDABLE_MARKUP) {\n // too short to tell a comment from a start tag: wait for more before choosing a scan\n pending.kind = \"decl\";\n return pending;\n }\n if (piece.startsWith(\"<!--\")) {\n pending.kind = \"comment\";\n } else if (piece.startsWith(\"<![CDATA[\")) {\n pending.kind = \"cdata\";\n } else if (piece.startsWith(\"<!DOCTYPE\")) {\n pending.kind = \"doctype\";\n } else if (piece.startsWith(\"<!\")) {\n pending.kind = \"decl\";\n return pending;\n } else if (piece.startsWith(\"<?\")) {\n pending.kind = \"pi\";\n } else if (piece.startsWith(\"</\")) {\n pending.kind = \"endtag\";\n }\n // the part in the buffer holds no terminator (consumeMarkup said so); record the scan state\n switch (pending.kind) {\n case \"starttag\":\n this.scanStartTag(pending, piece, 1);\n break;\n case \"doctype\":\n this.scanDoctype(pending, piece, 9);\n break;\n default: {\n const terminator = TERMINATORS[pending.kind] ?? \">\";\n pending.tail = piece.slice(Math.max(0, piece.length - (terminator.length - 1)));\n break;\n }\n }\n return pending;\n }\n\n /**\n * Consume the markup starting at `pos` (a `<`).\n * @param pos - the index of the `<`\n * @returns the index after the markup, or -1 when the buffer ends before the markup does\n */\n private consumeMarkup(pos: number): number {\n const { buffer } = this;\n if (buffer.startsWith(\"<!\", pos)) {\n if (buffer.length - pos < MIN_DECIDABLE_MARKUP && !this.final) {\n // \"<![CDATA[\" is 9 characters; wait until the kind of declaration is decidable\n return -1;\n }\n if (buffer.startsWith(\"<!--\", pos)) {\n const end = buffer.indexOf(\"-->\", pos + 4);\n if (end < 0) {\n return -1;\n }\n this.advanceLine(pos, end + 3);\n return end + 3;\n }\n if (buffer.startsWith(\"<![CDATA[\", pos)) {\n const end = buffer.indexOf(\"]]>\", pos + 9);\n if (end < 0) {\n return -1;\n }\n if (this.text.length === 0) {\n this.textLine = this.line;\n }\n const cdata = buffer.slice(pos + 9, end);\n if (hasIllegalXmlChar(cdata)) {\n throw new XmlSyntaxError(\"a character XML 1.0 forbids appears in a CDATA section\", this.line);\n }\n this.text += cdata;\n this.advanceLine(pos, end + 3);\n return end + 3;\n }\n if (!buffer.startsWith(\"<!DOCTYPE\", pos)) {\n throw new XmlSyntaxError(\"unexpected markup declaration\", this.line);\n }\n const state: Pending = {\n kind: \"doctype\",\n pieces: [],\n tail: \"\",\n quote: 0,\n depth: 0,\n comment: false,\n run: 0,\n };\n const end = this.scanDoctype(state, buffer, pos + 9);\n if (end < 0) {\n return -1;\n }\n this.advanceLine(pos, end);\n return end;\n }\n if (buffer.startsWith(\"<?\", pos)) {\n const end = buffer.indexOf(\"?>\", pos + 2);\n if (end < 0) {\n return -1;\n }\n this.advanceLine(pos, end + 2);\n return end + 2;\n }\n if (buffer.startsWith(\"</\", pos)) {\n const end = buffer.indexOf(\">\", pos + 2);\n if (end < 0) {\n return -1;\n }\n const name = buffer.slice(pos + 2, end).trim();\n if (!isXmlName(name)) {\n throw new XmlSyntaxError(`malformed end tag </${name}>`, this.line);\n }\n this.flushText();\n this.endElement(name);\n this.advanceLine(pos, end + 1);\n return end + 1;\n }\n const tag = this.parseStartTag(pos);\n if (tag === null) {\n return -1;\n }\n this.flushText();\n this.startElement(tag.name, tag.attrs);\n if (tag.selfClosing) {\n this.endElement(tag.name);\n }\n this.advanceLine(pos, tag.end);\n return tag.end;\n }\n\n /**\n * Parse a start tag at `pos`.\n * @param pos - the index of the `<`\n * @returns the tag, or null when the buffer ends inside it\n */\n private parseStartTag(pos: number): StartTag | null {\n const { buffer } = this;\n const { length } = buffer;\n let i = pos + 1;\n const nameEnd = this.readName(i);\n if (nameEnd < 0) {\n return null;\n }\n if (nameEnd === i) {\n throw new XmlSyntaxError(\"expected an element name after <\", this.line);\n }\n const name = buffer.slice(i, nameEnd);\n i = nameEnd;\n const attrs = new Map<string, string>();\n for (;;) {\n while (i < length && isSpace(buffer.charCodeAt(i))) {\n i++;\n }\n if (i >= length) {\n return null;\n }\n const c = buffer.charCodeAt(i);\n if (c === GT) {\n return { name, attrs, selfClosing: false, end: i + 1 };\n }\n if (c === SLASH) {\n if (i + 1 >= length) {\n return null;\n }\n if (buffer.charCodeAt(i + 1) !== GT) {\n throw new XmlSyntaxError(`unexpected \"/\" in <${name}>`, this.line);\n }\n return { name, attrs, selfClosing: true, end: i + 2 };\n }\n const attrEnd = this.readName(i);\n if (attrEnd < 0) {\n return null;\n }\n if (attrEnd === i) {\n throw new XmlSyntaxError(`malformed attribute in <${name}>`, this.line);\n }\n const attrName = buffer.slice(i, attrEnd);\n i = attrEnd;\n while (i < length && isSpace(buffer.charCodeAt(i))) {\n i++;\n }\n if (i >= length) {\n return null;\n }\n if (buffer.charCodeAt(i) !== EQUALS) {\n throw new XmlSyntaxError(`attribute ${attrName} of <${name}> has no value`, this.line);\n }\n i++;\n while (i < length && isSpace(buffer.charCodeAt(i))) {\n i++;\n }\n if (i >= length) {\n return null;\n }\n const quote = buffer.charCodeAt(i);\n if (quote !== QUOTE && quote !== APOS) {\n throw new XmlSyntaxError(`attribute ${attrName} of <${name}> is not quoted`, this.line);\n }\n const close = buffer.indexOf(quote === QUOTE ? '\"' : \"'\", i + 1);\n if (close < 0) {\n return null;\n }\n if (attrs.has(attrName)) {\n throw new XmlSyntaxError(`duplicate attribute ${attrName} in <${name}>`, this.line);\n }\n const raw = buffer.slice(i + 1, close);\n if (hasIllegalXmlChar(raw)) {\n throw new XmlSyntaxError(\n `a character XML 1.0 forbids appears in attribute ${attrName} of <${name}>`,\n this.line,\n );\n }\n attrs.set(attrName, decodeEntities(normalizeAttributeValue(raw), this.line));\n i = close + 1;\n }\n }\n\n /**\n * The end of the XML Name starting at `i` (an ASCII table for the common case, the code point\n * classes beyond it).\n * @param i - the start index\n * @returns the index after the name; `i` when no name starts there; -1 when the name may\n * continue past the end of the buffer\n */\n private readName(i: number): number {\n const { buffer } = this;\n const { length } = buffer;\n let j = i;\n while (j < length) {\n const c = buffer.charCodeAt(j);\n if (c < 0x80) {\n if ((j === i ? ASCII_NAME_START[c] : ASCII_NAME_CHAR[c]) === 0) {\n break;\n }\n j++;\n continue;\n }\n const cp = buffer.codePointAt(j);\n if (cp === undefined || (j === i ? !isNameStart(cp) : !isNameChar(cp))) {\n break;\n }\n j += cp > 0xffff ? 2 : 1;\n }\n return j >= length && !this.final ? -1 : j;\n }\n\n /**\n * Move text from the buffer into the current run.\n * @param start - the start index\n * @param end - the end index (exclusive)\n */\n private takeText(start: number, end: number): void {\n if (end <= start) {\n return;\n }\n if (this.text.length === 0) {\n this.textLine = this.line;\n }\n const raw = this.buffer.slice(start, end);\n if (hasIllegalXmlChar(raw)) {\n throw new XmlSyntaxError(\"a character XML 1.0 forbids appears in character data\", this.line);\n }\n this.text += decodeEntities(raw, this.line);\n this.advanceLine(start, end);\n }\n\n /**\n * Count the newlines of a consumed range. Ranges are consumed in order, so the next line break\n * is searched for once per buffer and re-searched only after it was passed; a buffer without\n * a further break is searched once and remembered as such.\n * @param start - the start index\n * @param end - the end index (exclusive)\n */\n private advanceLine(start: number, end: number): void {\n let i = this.nextBreak;\n if (i === -1) {\n return;\n }\n if (i === -2 || i < start) {\n i = this.buffer.indexOf(\"\\n\", start);\n }\n while (i >= 0 && i < end) {\n this.line++;\n i = this.buffer.indexOf(\"\\n\", i + 1);\n }\n this.nextBreak = i;\n }\n\n /** Deliver the accumulated text run, if any. */\n private flushText(): void {\n if (this.text.length === 0) {\n return;\n }\n const { text } = this;\n this.text = \"\";\n if (this.stack.length === 0) {\n if (!isWhitespace(text)) {\n throw new XmlSyntaxError(\"text outside the root element\", this.textLine);\n }\n return;\n }\n this.handler.text(text, this.textLine);\n }\n\n /**\n * Open an element.\n * @param name - the element name\n * @param attrs - its attributes\n */\n private startElement(name: string, attrs: Map<string, string>): void {\n if (this.stack.length === 0) {\n if (this.rootClosed) {\n throw new XmlSyntaxError(`a second root element <${name}> follows the document element`, this.line);\n }\n this.rootSeen = true;\n }\n this.stack.push(name);\n this.handler.start(name, attrs, this.line);\n }\n\n /**\n * Close an element, checking that it matches the innermost open one.\n * @param name - the element name\n */\n private endElement(name: string): void {\n const open = this.stack.length > 0 ? this.stack[this.stack.length - 1] : null;\n if (open === null) {\n throw new XmlSyntaxError(`unexpected end tag </${name}>`, this.line);\n }\n if (open !== name) {\n throw new XmlSyntaxError(`end tag </${name}> does not match <${open}>`, this.line);\n }\n this.stack.pop();\n if (this.stack.length === 0) {\n this.rootClosed = true;\n }\n this.handler.end(name, this.line);\n }\n}\n\n/**\n * Attribute value normalisation (XML 1.0 section 3.3.3): a literal tab or line break becomes a\n * space; a character reference to one is kept, which is why this runs before entity decoding.\n * @param raw - the value between the quotes\n * @returns the normalised value\n */\nfunction normalizeAttributeValue(raw: string): string {\n return raw.includes(\"\\n\") || raw.includes(\"\\t\") ? raw.replace(/[\\n\\t]/g, \" \") : raw;\n}\n","/**\n * Id, label and value escaping for the text formats (design section 8.5), one function per\n * syntax, with the inverse where the importer needs it: XML attribute and element text (GEXF,\n * GraphML), GML quoted strings (`\"` and `&` and non-ASCII as `&#NN;` character entities, the\n * NetworkX convention), DOT ids (bare when the grammar allows, quoted with `\\\"` otherwise), RFC\n * 4180 CSV cells and Pajek labels.\n */\n\nimport { GraphFormatError } from \"@graphty/graph-format\";\n\nimport { hasIllegalXmlChar } from \"./xml.js\";\n\nconst XML_TEXT_SPECIAL = /[&<>\\r]/g;\nconst XML_ATTR_SPECIAL = /[&<>\"\\t\\n\\r]/g;\nconst XML_REPLACEMENTS: Readonly<Record<string, string>> = {\n \"&\": \"&amp;\",\n \"<\": \"&lt;\",\n \">\": \"&gt;\",\n '\"': \"&quot;\",\n \"\\t\": \"&#9;\",\n \"\\n\": \"&#10;\",\n \"\\r\": \"&#13;\",\n};\n\n/**\n * Escape text for an XML element body: `&`, `<`, `>` and a carriage return (which XML\n * end-of-line handling would turn into a line feed on every read) as character references. A\n * character XML 1.0 forbids (a C0 control other than tab / LF / CR, U+FFFE, U+FFFF, a lone\n * surrogate) has no XML spelling at all and is E_COLUMN_TYPE; the exporters' check() counts them.\n * @param text - the text\n * @returns the escaped text\n */\nexport function escapeXmlText(text: string): string {\n if (hasIllegalXmlChar(text)) {\n throw illegalXml(text);\n }\n return text.replace(XML_TEXT_SPECIAL, (c) => XML_REPLACEMENTS[c]);\n}\n\n/**\n * Escape text for a double-quoted XML attribute value: `&`, `<`, `>`, `\"` and the whitespace\n * characters attribute normalisation would fold; a character XML 1.0 forbids is E_COLUMN_TYPE.\n * @param text - the text\n * @returns the escaped text\n */\nexport function escapeXmlAttribute(text: string): string {\n if (hasIllegalXmlChar(text)) {\n throw illegalXml(text);\n }\n return text.replace(XML_ATTR_SPECIAL, (c) => XML_REPLACEMENTS[c]);\n}\n\n/**\n * The error of a text no XML 1.0 document can carry.\n * @param text - the text\n * @returns the error\n */\nfunction illegalXml(text: string): GraphFormatError {\n return new GraphFormatError(\"E_COLUMN_TYPE\", \"the text holds a character XML 1.0 cannot carry\", {\n reason: \"xml illegal char\",\n length: text.length,\n });\n}\n\nconst GML_SPECIAL = /[\"&]|[^ -~]/gu;\n\n/**\n * Quote a GML string value: double quotes around the text with `\"`, `&` and every character\n * outside printable ASCII written as `&#NN;` (NetworkX's writer convention, which its reader and\n * Gephi's decode).\n * A lone surrogate cannot be written and is E_COLUMN_TYPE.\n * @param text - the text\n * @returns the quoted GML string\n */\nexport function quoteGmlString(text: string): string {\n const escaped = text.replace(GML_SPECIAL, (c) => {\n const code = c.codePointAt(0);\n if (code === undefined) {\n return c;\n }\n if (code >= 0xd800 && code <= 0xdfff) {\n throw new GraphFormatError(\"E_COLUMN_TYPE\", \"a lone surrogate cannot be written as a GML string\", {\n reason: \"lone surrogate\",\n });\n }\n return `&#${code};`;\n });\n return `\"${escaped}\"`;\n}\n\nconst GML_ENTITY = /&(#[0-9]+|#x[0-9a-fA-F]+|amp|quot|lt|gt|apos);/g;\nconst GML_NAMED: Readonly<Record<string, string>> = { amp: \"&\", quot: '\"', lt: \"<\", gt: \">\", apos: \"'\" };\n\n/**\n * Decode the character entities of a GML string body (the inverse of quoteGmlString on the text\n * between the quotes). An unknown entity is left as written.\n * @param body - the text between the quotes\n * @returns the decoded text\n */\nexport function decodeGmlString(body: string): string {\n return body.replace(GML_ENTITY, (whole, entity: string) => {\n if (entity.startsWith(\"#x\")) {\n return String.fromCodePoint(Number.parseInt(entity.slice(2), 16));\n }\n if (entity.startsWith(\"#\")) {\n return String.fromCodePoint(Number.parseInt(entity.slice(1), 10));\n }\n return GML_NAMED[entity] ?? whole;\n });\n}\n\nconst DOT_NUMERAL = /^-?(\\.[0-9]+|[0-9]+(\\.[0-9]*)?)$/;\nconst DOT_KEYWORDS: ReadonlySet<string> = new Set([\"node\", \"edge\", \"graph\", \"digraph\", \"subgraph\", \"strict\"]);\n\n/**\n * Whether a text is a DOT ID that needs no quotes: an alphanumeric identifier not starting with\n * a digit, or a numeral, and not a keyword (case-insensitive).\n * @param text - the text\n * @returns true when the text can be written bare\n */\nexport function isBareDotId(text: string): boolean {\n if (DOT_KEYWORDS.has(text.toLowerCase())) {\n return false;\n }\n return isDotIdentifier(text) || DOT_NUMERAL.test(text);\n}\n\n/**\n * Whether a text is a DOT identifier: a letter, underscore or any character of code 128 and\n * above, followed by letters, digits, underscores or such characters.\n * @param text - the text\n * @returns true for a bare identifier\n */\nfunction isDotIdentifier(text: string): boolean {\n if (text.length === 0) {\n return false;\n }\n for (let i = 0; i < text.length; i++) {\n const c = text.charCodeAt(i);\n const letter = (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || c === 95 || c >= 128;\n const digit = c >= 48 && c <= 57;\n if (!letter && (i === 0 || !digit)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Whether a text can be written as a DOT ID at all. Graphviz's scanner consumes a backslash pair\n * `\\\\` as one unit, `\\\"` as an escaped quote and a backslash before a line break as a line\n * continuation (both removed), left to right, so a backslash that precedes a double quote or a\n * line break, or ends the text, cannot be written: the written `\\\\\"` reads as a pair and a closing\n * quote, a backslash before a line break vanishes with the break, and a trailing backslash escapes\n * the closing quote. Every other text is writable; quoteDotId() writes it.\n * @param text - the id, name or value text\n * @returns true when quoteDotId(text) reads back as `text`\n */\nexport function isWritableDotText(text: string): boolean {\n return !text.endsWith(\"\\\\\") && !text.includes('\\\\\"') && !/\\\\[\\r\\n]/.test(text);\n}\n\n/**\n * Write a DOT ID: bare when the grammar allows, otherwise double-quoted with `\"` escaped as `\\\"`.\n * In DOT quoted strings the dyad `\\\"` is the only escape; every other character, a backslash and\n * a raw line break included, is kept as written, so nothing else is rewritten. A text ending in a\n * backslash has no DOT spelling (isWritableDotText); the caller refuses it before writing.\n * @param text - the id or label text\n * @returns the DOT ID\n */\nexport function quoteDotId(text: string): string {\n if (isBareDotId(text)) {\n return text;\n }\n return `\"${text.replace(/\"/g, '\\\\\"')}\"`;\n}\n\n/**\n * Write a set CSV cell per RFC 4180: quoted with `\"` doubled when the text contains the\n * delimiter, a quote, a CR or LF, or leading / trailing whitespace; bare otherwise. The empty\n * string is written as the quoted empty cell `\"\"`, so the importers can tell a set empty string\n * (and an empty-string node id, legal under design section 4.1) from an unset cell, which every\n * exporter writes as nothing between the delimiters.\n * @param text - the cell text of a set cell\n * @param delimiter - the field delimiter (default \",\")\n * @returns the cell as written\n */\nexport function quoteCsvCell(text: string, delimiter = \",\"): string {\n if (text.length === 0) {\n return '\"\"';\n }\n if (\n !text.includes(delimiter) &&\n !text.includes('\"') &&\n !text.includes(\"\\n\") &&\n !text.includes(\"\\r\") &&\n text === text.trim()\n ) {\n return text;\n }\n return `\"${text.replace(/\"/g, '\"\"')}\"`;\n}\n\n/**\n * Whether a text can be a Pajek label: Pajek has no escape mechanism inside its double-quoted\n * labels, so a text containing a double quote, a CR or an LF cannot be written.\n * @param text - the label text\n * @returns true when quotePajekLabel() can write it\n */\nexport function isPajekLabel(text: string): boolean {\n return !text.includes('\"') && !text.includes(\"\\n\") && !text.includes(\"\\r\");\n}\n\n/**\n * Write a Pajek label: bare when it is a single run of non-space, non-quote characters, otherwise\n * double-quoted. E_UNSUPPORTED (reason \"pajek label\") for a text isPajekLabel() rejects; the\n * exporter's check() counts those.\n * @param text - the label text\n * @returns the label as written\n */\nexport function quotePajekLabel(text: string): string {\n if (!isPajekLabel(text)) {\n throw new GraphFormatError(\"E_UNSUPPORTED\", \"a Pajek label cannot contain a double quote or a line break\", {\n reason: \"pajek label\",\n value: text,\n });\n }\n if (text.length > 0 && !/[\\s\"]/.test(text)) {\n return text;\n }\n return `\"${text}\"`;\n}\n"],"names":["end"],"mappings":";;AA0DO,MAAM,uBAAuB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAStC,YAAY,SAAiB,MAAc;AACvC,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EAChB;AACJ;AAEA,MAAM,iBAAmD;AAAA,EACrD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,MAAM;AAAA,EACN,MAAM;AACV;AAEA,MAAM,KAAK;AACX,MAAM,KAAK;AACX,MAAM,QAAQ;AACd,MAAM,SAAS;AACf,MAAM,QAAQ;AACd,MAAM,OAAO;AACb,MAAM,eAAe;AACrB,MAAM,gBAAgB;AACtB,MAAM,OAAO;AACb,MAAM,OAAO;AAGb,MAAM,oBAAoB;AAG1B,MAAM,uBAAuB;AAO7B,SAAS,QAAQ,GAAoB;AACjC,SAAO,MAAM,MAAM,MAAM,KAAK,MAAM,MAAM,MAAM;AACpD;AAQA,SAAS,YAAY,IAAqB;AACtC,MAAI,CAAC,WAAW,EAAE,GAAG;AACjB,WAAO;AAAA,EACX;AACA,MAAK,MAAM,MAAQ,MAAM,MAAS,OAAO,MAAQ,OAAO,MAAQ,OAAO,KAAM;AACzE,WAAO;AAAA,EACX;AACA,SAAO,EAAE,MAAM,OAAS,MAAM,QAAU,OAAO,QAAU,OAAO;AACpE;AAGA,MAAM,mBAA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IAAI;AACjF;AAUO,SAAS,WAAW,MAAsB;AAC7C,MAAI,YAAY,IAAI,GAAG;AACnB,WAAO;AAAA,EACX;AACA,SAAO,IAAI,KAAK,QAAQ,MAAM,KAAK,CAAC;AACxC;AAYO,SAAS,aAAa,MAAc,YAAY,KAAa;AAChE,MAAI,KAAK,WAAW,GAAG;AACnB,WAAO;AAAA,EACX;AACA,MACI,CAAC,KAAK,SAAS,SAAS,KACxB,CAAC,KAAK,SAAS,GAAG,KAClB,CAAC,KAAK,SAAS,IAAI,KACnB,CAAC,KAAK,SAAS,IAAI,KACnB,SAAS,KAAK,QAChB;AACE,WAAO;AAAA,EACX;AACA,SAAO,IAAI,KAAK,QAAQ,MAAM,IAAI,CAAC;AACvC;AAQO,SAAS,aAAa,MAAuB;AAChD,SAAO,CAAC,KAAK,SAAS,GAAG,KAAK,CAAC,KAAK,SAAS,IAAI,KAAK,CAAC,KAAK,SAAS,IAAI;AAC7E;AASO,SAAS,gBAAgB,MAAsB;AAClD,MAAI,CAAC,aAAa,IAAI,GAAG;AACrB,UAAM,IAAI,iBAAiB,iBAAiB,+DAA+D;AAAA,MACvG,QAAQ;AAAA,MACR,OAAO;AAAA,IAAA,CACV;AAAA,EACL;AACA,MAAI,KAAK,SAAS,KAAK,CAAC,QAAQ,KAAK,IAAI,GAAG;AACxC,WAAO;AAAA,EACX;AACA,SAAO,IAAI,IAAI;AACnB;"}
@@ -1,8 +1,8 @@
1
1
  import { GraphFormatError, INVALID_INDEX } from "@graphty/graph-format";
2
2
  import { c as childrenCsr } from "./children-CL3Cy0ez.js";
3
- import { L as LOSS, au as joinText, ah as encodeChunks, aB as resolveExportOptions, aa as checkCapabilities, a9 as capabilities, aG as countMixedEdges, ai as explicitWeights, aw as pairFolding, aD as sanitizeIds, ak as formatF32, al as formatF64, aj as formatDecimal, an as formatInteger, a8 as canonicalId, x as MIXED_DIRECTION_CODE, g as DIRECTION_FORCED_CODE, h as DIRECTION_REFUSED_CODE, W as SINK_OPTION_CODE, n as ID_MERGED_CODE, J as OPTION_IGNORED_CODE, C as COLUMN_RENAMED_CODE, V as ROLE_TAKEN_CODE, y as MULTIPLE_GRAPHS_CODE, r as INVALID_UTF8_CODE, m as EMPTY_INPUT_CODE, Z as SYNTAX_CODE, aC as resolveImportOptions, I as ImportReportBuilder, aA as reportUnusedOptions, az as reportSinkOptions, ay as readText, a as throwIfAborted, s as IdCoercer, l as DirectionResolver, ax as parseWeightText, af as declareResolved } from "./writer-DxSKC7TL.js";
4
- import { b as quoteDotId, c as isWritableDotText } from "./escape-DyI8JofU.js";
5
- import { i as inferTextDtype, W as WIDENING_UNSUPPORTED_CODE, p as parseTextCell, T as TextCellWriter } from "./text-CajMdVFy.js";
3
+ import { L as LOSS, ax as joinText, ak as encodeChunks, aE as resolveExportOptions, ad as checkCapabilities, ac as capabilities, aJ as countMixedEdges, al as explicitWeights, az as pairFolding, aG as sanitizeIds, an as formatF32, ao as formatF64, am as formatDecimal, aq as formatInteger, ab as canonicalId, z as MIXED_DIRECTION_CODE, g as DIRECTION_FORCED_CODE, h as DIRECTION_REFUSED_CODE, Y as SINK_OPTION_CODE, o as ID_MERGED_CODE, P as OPTION_IGNORED_CODE, C as COLUMN_RENAMED_CODE, X as ROLE_TAKEN_CODE, A as MULTIPLE_GRAPHS_CODE, a5 as UNKNOWN_ENCODING_CODE, n as ENCODING_FALLBACK_CODE, s as INVALID_ENCODING_CODE, u as INVALID_UTF8_CODE, m as EMPTY_INPUT_CODE, $ as SYNTAX_CODE, aF as resolveImportOptions, I as ImportReportBuilder, aD as reportUnusedOptions, aB as readText, aC as reportSinkOptions, a as throwIfAborted, v as IdCoercer, l as DirectionResolver, aA as parseWeightText, ai as declareResolved } from "./writer-BdMak4_J.js";
4
+ import { b as quoteDotId, c as isWritableDotText } from "./escape-CKied3Ri.js";
5
+ import { i as inferTextDtype, W as WIDENING_UNSUPPORTED_CODE, p as parseTextCell, T as TextCellWriter } from "./text-Dr0Ifpag.js";
6
6
  const DOT_FORMAT = "dot";
7
7
  const DOT_ORIGIN = Object.freeze({ format: DOT_FORMAT });
8
8
  const CLUSTER_COLUMN = "graphty.cluster";
@@ -15,7 +15,7 @@ const KEY_ATTRIBUTE = "key";
15
15
  const PIN_ATTRIBUTE = "pin";
16
16
  const DOT_META_KEY = "dot";
17
17
  const DOT_LOSS = Object.freeze({
18
- /** An id, name or text with a backslash before a quote or at its end cannot be written as a DOT quoted string; export() throws. */
18
+ /** An id, name or text with a backslash before a quote or a line break, or at its end, cannot be written as a DOT quoted string; export() throws. */
19
19
  TRAILING_BACKSLASH: "E_DOT_TRAILING_BACKSLASH",
20
20
  /** A non-finite f32 / f64 cell has no numeric DOT spelling and reads back as text. */
21
21
  NON_FINITE: "W_DOT_NON_FINITE",
@@ -301,7 +301,7 @@ class ExportPlan {
301
301
  if (unwritable > 0) {
302
302
  note(
303
303
  DOT_LOSS.TRAILING_BACKSLASH,
304
- `${unwritable} id(s), name(s) or text value(s) hold a backslash before a quote or at the end, which a DOT quoted string cannot carry; export() will throw`,
304
+ `${unwritable} id(s), name(s) or text value(s) hold a backslash before a quote or a line break, or at the end, which a DOT quoted string cannot carry; export() will throw`,
305
305
  null,
306
306
  unwritable
307
307
  );
@@ -420,7 +420,7 @@ class ExportPlan {
420
420
  if (first !== null) {
421
421
  throw new GraphFormatError(
422
422
  first.kind === "id" ? "E_INVALID_ID" : "E_COLUMN_TYPE",
423
- `${first.kind} ${JSON.stringify(first.text)} ends in a backslash, which a DOT quoted string cannot carry`,
423
+ `${first.kind} ${JSON.stringify(first.text)} holds a backslash before a quote or a line break, or at its end, which a DOT quoted string cannot carry`,
424
424
  { reason: "trailing backslash", kind: first.kind, value: first.text }
425
425
  );
426
426
  }
@@ -1112,6 +1112,12 @@ const DOT_ISSUE = Object.freeze({
1112
1112
  EMPTY_INPUT: EMPTY_INPUT_CODE,
1113
1113
  /** The input holds invalid UTF-8 (fatal). */
1114
1114
  INVALID_UTF8: INVALID_UTF8_CODE,
1115
+ /** Invalid bytes in the encoding a BOM, a declaration or the encoding option chose (fatal). */
1116
+ INVALID_ENCODING: INVALID_ENCODING_CODE,
1117
+ /** Bytes that are not UTF-8 and declare no encoding were read as windows-1252. */
1118
+ ENCODING_FALLBACK: ENCODING_FALLBACK_CODE,
1119
+ /** A declared encoding the platform cannot decode was ignored. */
1120
+ UNKNOWN_ENCODING: UNKNOWN_ENCODING_CODE,
1115
1121
  /** Subgraphs or braces nested deeper than the parser's limit; fatal. */
1116
1122
  NESTING: "E_DOT_NESTING",
1117
1123
  /** An edge operator contradicting the graph keyword (warning under "operator" / "header"). */
@@ -1210,20 +1216,117 @@ const dotImporter = Object.freeze({
1210
1216
  const report = new ImportReportBuilder(DOT_FORMAT, resolved.errorLimit);
1211
1217
  reportUnusedOptions(options, report, USED_OPTIONS);
1212
1218
  reportSinkOptions(sink, options, report);
1213
- const text = await readText(input, report, resolved);
1214
- const parser = new DotParser(text, sink, report, resolved, mismatch);
1215
- try {
1216
- parser.parse();
1217
- } catch (err) {
1218
- if (err instanceof DotSyntaxError) {
1219
- report.fail(SYNTAX_CODE, err.message, { line: err.line }, { line: err.line });
1220
- }
1221
- throw err;
1219
+ const text = await readText(input, report, { ...resolved, declaredEncoding: dotCharset });
1220
+ const reports = { current: report };
1221
+ const lexer = dotLexer(text, reports);
1222
+ const first = guard(report, () => lexer.next());
1223
+ const trailing = parseGraph(new DotParser(lexer, sink, report, resolved, mismatch), report, first);
1224
+ if (trailing.kind !== "eof") {
1225
+ const skipped = guard(report, () => countGraphs(lexer, trailing));
1226
+ report.warning(
1227
+ "unsupported",
1228
+ MULTIPLE_GRAPHS_CODE,
1229
+ `the input holds ${skipped} more graph(s) after the first; import() reads the first, importAll() reads every one`,
1230
+ { line: trailing.line }
1231
+ );
1222
1232
  }
1223
1233
  throwIfAborted(resolved.signal);
1224
1234
  return report.finish();
1235
+ },
1236
+ /**
1237
+ * Read every graph of a DOT file (Graphviz renders each one), each into its own sink.
1238
+ * @param input - the text, bytes or stream
1239
+ * @param sinkFor - the sink of the graph with this index, called before its first push
1240
+ * @param options - format-specific and common options
1241
+ * @returns one report per graph; ImportError (E_IMPORT) on a syntax error anywhere
1242
+ */
1243
+ async importAll(input, sinkFor, options) {
1244
+ const resolved = resolveImportOptions(options, {
1245
+ ids: "canonical",
1246
+ defaultDirected: true,
1247
+ weightFrom: "weight"
1248
+ });
1249
+ const mismatch = mismatchOption(options?.mismatchedEdgeOperator);
1250
+ const first = new ImportReportBuilder(DOT_FORMAT, resolved.errorLimit);
1251
+ reportUnusedOptions(options, first, USED_OPTIONS);
1252
+ const text = await readText(input, first, { ...resolved, declaredEncoding: dotCharset });
1253
+ const reports = { current: first };
1254
+ const lexer = dotLexer(text, reports);
1255
+ const done = [];
1256
+ let token = guard(first, () => lexer.next());
1257
+ do {
1258
+ const report = done.length === 0 ? first : new ImportReportBuilder(DOT_FORMAT, resolved.errorLimit);
1259
+ reports.current = report;
1260
+ const sink = sinkFor(done.length);
1261
+ reportSinkOptions(sink, options, report);
1262
+ token = parseGraph(new DotParser(lexer, sink, report, resolved, mismatch), report, token);
1263
+ throwIfAborted(resolved.signal);
1264
+ done.push(report.finish());
1265
+ } while (token.kind !== "eof");
1266
+ return done;
1225
1267
  }
1226
1268
  });
1269
+ function dotLexer(text, reports) {
1270
+ return new DotTokenizer(text, (numeral, line) => {
1271
+ reports.current.warning(
1272
+ "validation-error",
1273
+ DOT_ISSUE.NUMERAL_AMBIGUITY,
1274
+ `badly delimited number ${JSON.stringify(numeral)} splits into two tokens (Graphviz warns the same)`,
1275
+ { line, element: numeral }
1276
+ );
1277
+ });
1278
+ }
1279
+ function guard(report, step) {
1280
+ try {
1281
+ return step();
1282
+ } catch (err) {
1283
+ if (err instanceof DotSyntaxError) {
1284
+ report.fail(SYNTAX_CODE, err.message, { line: err.line }, { line: err.line });
1285
+ }
1286
+ throw err;
1287
+ }
1288
+ }
1289
+ function parseGraph(parser, report, first) {
1290
+ return guard(report, () => parser.parse(first));
1291
+ }
1292
+ function countGraphs(lexer, first) {
1293
+ let count = 0;
1294
+ let token = first;
1295
+ while (token.kind !== "eof") {
1296
+ if (isKeyword(token, "strict")) {
1297
+ token = lexer.next();
1298
+ }
1299
+ if (!isKeyword(token, "graph") && !isKeyword(token, "digraph")) {
1300
+ throw new DotSyntaxError(`expected "graph" or "digraph", found ${describeToken(token)}`, token.line);
1301
+ }
1302
+ token = lexer.next();
1303
+ if (token.kind === "id") {
1304
+ token = lexer.next();
1305
+ }
1306
+ if (!isPunct(token, "{")) {
1307
+ throw new DotSyntaxError(`expected "{" after the graph header, found ${describeToken(token)}`, token.line);
1308
+ }
1309
+ for (let depth = 1; depth > 0; ) {
1310
+ token = lexer.next();
1311
+ if (token.kind === "eof") {
1312
+ throw new DotSyntaxError('missing "}" at the end of a graph', token.line);
1313
+ }
1314
+ if (isPunct(token, "{")) {
1315
+ depth++;
1316
+ } else if (isPunct(token, "}")) {
1317
+ depth--;
1318
+ }
1319
+ }
1320
+ count++;
1321
+ token = lexer.next();
1322
+ }
1323
+ return count;
1324
+ }
1325
+ const DOT_CHARSET = /\bcharset\s*=\s*"?([A-Za-z][A-Za-z0-9._-]*)/i;
1326
+ function dotCharset(head) {
1327
+ const match = DOT_CHARSET.exec(head);
1328
+ return match === null ? null : match[1].replace(/^(latin|big)-/i, "$1");
1329
+ }
1227
1330
  function mismatchOption(value) {
1228
1331
  if (value === void 0) {
1229
1332
  return "operator";
@@ -1280,14 +1383,14 @@ function isClusterName(name) {
1280
1383
  }
1281
1384
  class DotParser {
1282
1385
  /**
1283
- * Create a parser over one document.
1284
- * @param text - the DOT text
1386
+ * Create a parser for one graph of a document.
1387
+ * @param lexer - the document's tokenizer, positioned at the graph
1285
1388
  * @param sink - the sink
1286
1389
  * @param report - the report
1287
1390
  * @param options - the resolved common options
1288
1391
  * @param mismatch - the resolved mismatchedEdgeOperator option
1289
1392
  */
1290
- constructor(text, sink, report, options, mismatch) {
1393
+ constructor(lexer, sink, report, options, mismatch) {
1291
1394
  this.directed = true;
1292
1395
  this.strict = false;
1293
1396
  this.statements = 0;
@@ -1308,14 +1411,7 @@ class DotParser {
1308
1411
  this.depth = 0;
1309
1412
  this.nodeWriters = /* @__PURE__ */ new Map();
1310
1413
  this.edgeWriters = /* @__PURE__ */ new Map();
1311
- this.lexer = new DotTokenizer(text, (numeral, line) => {
1312
- report.warning(
1313
- "validation-error",
1314
- DOT_ISSUE.NUMERAL_AMBIGUITY,
1315
- `badly delimited number ${JSON.stringify(numeral)} splits into two tokens (Graphviz warns the same)`,
1316
- { line, element: numeral }
1317
- );
1318
- });
1414
+ this.lexer = lexer;
1319
1415
  this.sink = sink;
1320
1416
  this.report = report;
1321
1417
  this.options = options;
@@ -1324,11 +1420,13 @@ class DotParser {
1324
1420
  this.resolver = new DirectionResolver(sink, report, options.onMixedDirection);
1325
1421
  }
1326
1422
  /**
1327
- * Parse the whole document: `[strict] (graph | digraph) [ID] { stmt_list }`.
1423
+ * Parse one graph: `[strict] (graph | digraph) [ID] { stmt_list }`.
1424
+ * @param first - the graph's first token (already read from the tokenizer)
1425
+ * @returns the token after the closing brace (eof when the document ends there)
1328
1426
  */
1329
- parse() {
1427
+ parse(first) {
1330
1428
  const { lexer } = this;
1331
- let token = lexer.next();
1429
+ let token = first;
1332
1430
  if (token.kind === "eof") {
1333
1431
  this.report.fail(EMPTY_INPUT_CODE, "the input holds no graph (empty or only comments)", {
1334
1432
  line: token.line
@@ -1363,15 +1461,7 @@ class DotParser {
1363
1461
  });
1364
1462
  const root = this.newScope(null, headerLine, true, null);
1365
1463
  this.statementList(root);
1366
- const trailing = lexer.next();
1367
- if (trailing.kind !== "eof") {
1368
- this.report.warning(
1369
- "unsupported",
1370
- MULTIPLE_GRAPHS_CODE,
1371
- `content after the closing brace of the graph (${describeToken(trailing)}) was not read; one graph per input`,
1372
- { line: trailing.line }
1373
- );
1374
- }
1464
+ return lexer.next();
1375
1465
  }
1376
1466
  /**
1377
1467
  * Create a scope.
@@ -2339,4 +2429,4 @@ export {
2339
2429
  dotImporter as b,
2340
2430
  dotExporter as d
2341
2431
  };
2342
- //# sourceMappingURL=importer-DbnGYr3_.js.map
2432
+ //# sourceMappingURL=importer-C6QcIRIb.js.map