@ifc-lite/parser 5.2.0 → 6.2.1

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 (153) hide show
  1. package/dist/columnar-entity-preparation.d.ts +3 -0
  2. package/dist/columnar-entity-preparation.d.ts.map +1 -1
  3. package/dist/columnar-entity-preparation.js +101 -11
  4. package/dist/columnar-entity-preparation.js.map +1 -1
  5. package/dist/columnar-parser-indexes.d.ts +17 -1
  6. package/dist/columnar-parser-indexes.d.ts.map +1 -1
  7. package/dist/columnar-parser-indexes.js +31 -21
  8. package/dist/columnar-parser-indexes.js.map +1 -1
  9. package/dist/columnar-parser.d.ts +10 -1
  10. package/dist/columnar-parser.d.ts.map +1 -1
  11. package/dist/columnar-parser.js +14 -2
  12. package/dist/columnar-parser.js.map +1 -1
  13. package/dist/cost-extractor.d.ts +10 -0
  14. package/dist/cost-extractor.d.ts.map +1 -0
  15. package/dist/cost-extractor.js +369 -0
  16. package/dist/cost-extractor.js.map +1 -0
  17. package/dist/cost-schedule-2x3.d.ts +31 -0
  18. package/dist/cost-schedule-2x3.d.ts.map +1 -0
  19. package/dist/cost-schedule-2x3.js +75 -0
  20. package/dist/cost-schedule-2x3.js.map +1 -0
  21. package/dist/cost-types.d.ts +105 -0
  22. package/dist/cost-types.d.ts.map +1 -0
  23. package/dist/cost-types.js +5 -0
  24. package/dist/cost-types.js.map +1 -0
  25. package/dist/data-store-transport.d.ts +1 -0
  26. package/dist/data-store-transport.d.ts.map +1 -1
  27. package/dist/data-store-transport.js +5 -29
  28. package/dist/data-store-transport.js.map +1 -1
  29. package/dist/drop-census.d.ts +136 -0
  30. package/dist/drop-census.d.ts.map +1 -0
  31. package/dist/drop-census.js +53 -0
  32. package/dist/drop-census.js.map +1 -0
  33. package/dist/entity-scanner.d.ts.map +1 -1
  34. package/dist/entity-scanner.js +10 -5
  35. package/dist/entity-scanner.js.map +1 -1
  36. package/dist/generated/ifc2x3/schema-registry.d.ts +50 -0
  37. package/dist/generated/ifc2x3/schema-registry.d.ts.map +1 -0
  38. package/dist/generated/ifc2x3/schema-registry.js +50052 -0
  39. package/dist/generated/ifc2x3/schema-registry.js.map +1 -0
  40. package/dist/generated/ifc4x3/schema-registry.d.ts +50 -0
  41. package/dist/generated/ifc4x3/schema-registry.d.ts.map +1 -0
  42. package/dist/generated/ifc4x3/schema-registry.js +71299 -0
  43. package/dist/generated/ifc4x3/schema-registry.js.map +1 -0
  44. package/dist/generated/schema-registry-by-version.d.ts +61 -0
  45. package/dist/generated/schema-registry-by-version.d.ts.map +1 -0
  46. package/dist/generated/schema-registry-by-version.js +86 -0
  47. package/dist/generated/schema-registry-by-version.js.map +1 -0
  48. package/dist/georef-extractor.js +5 -5
  49. package/dist/georef-extractor.js.map +1 -1
  50. package/dist/group-assignment-factor.d.ts +13 -0
  51. package/dist/group-assignment-factor.d.ts.map +1 -0
  52. package/dist/group-assignment-factor.js +30 -0
  53. package/dist/group-assignment-factor.js.map +1 -0
  54. package/dist/ifczip.d.ts +7 -1
  55. package/dist/ifczip.d.ts.map +1 -1
  56. package/dist/ifczip.js +80 -14
  57. package/dist/ifczip.js.map +1 -1
  58. package/dist/index.d.ts +7 -2
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +13 -2
  61. package/dist/index.js.map +1 -1
  62. package/dist/on-demand-extractors.d.ts +1 -0
  63. package/dist/on-demand-extractors.d.ts.map +1 -1
  64. package/dist/on-demand-extractors.js +2 -1
  65. package/dist/on-demand-extractors.js.map +1 -1
  66. package/dist/property-value-parser.d.ts +10 -0
  67. package/dist/property-value-parser.d.ts.map +1 -1
  68. package/dist/property-value-parser.js +40 -1
  69. package/dist/property-value-parser.js.map +1 -1
  70. package/dist/scan-entities-balanced.d.ts.map +1 -1
  71. package/dist/scan-entities-balanced.js +11 -6
  72. package/dist/scan-entities-balanced.js.map +1 -1
  73. package/dist/scan-worker-lexing.d.ts +14 -0
  74. package/dist/scan-worker-lexing.d.ts.map +1 -0
  75. package/dist/scan-worker-lexing.js +106 -0
  76. package/dist/scan-worker-lexing.js.map +1 -0
  77. package/dist/scan-worker-source.d.ts +1 -1
  78. package/dist/scan-worker-source.d.ts.map +1 -1
  79. package/dist/scan-worker-source.js +64 -59
  80. package/dist/scan-worker-source.js.map +1 -1
  81. package/dist/schedule-extractor.d.ts +2 -80
  82. package/dist/schedule-extractor.d.ts.map +1 -1
  83. package/dist/schedule-extractor.js +100 -225
  84. package/dist/schedule-extractor.js.map +1 -1
  85. package/dist/schedule-serializer-builders.d.ts +28 -0
  86. package/dist/schedule-serializer-builders.d.ts.map +1 -0
  87. package/dist/schedule-serializer-builders.js +163 -0
  88. package/dist/schedule-serializer-builders.js.map +1 -0
  89. package/dist/schedule-serializer.d.ts +6 -0
  90. package/dist/schedule-serializer.d.ts.map +1 -1
  91. package/dist/schedule-serializer.js +26 -165
  92. package/dist/schedule-serializer.js.map +1 -1
  93. package/dist/schedule-types.d.ts +211 -0
  94. package/dist/schedule-types.d.ts.map +1 -0
  95. package/dist/schedule-types.js +221 -0
  96. package/dist/schedule-types.js.map +1 -0
  97. package/dist/spatial-hierarchy-ambiguity.d.ts +39 -0
  98. package/dist/spatial-hierarchy-ambiguity.d.ts.map +1 -0
  99. package/dist/spatial-hierarchy-ambiguity.js +25 -0
  100. package/dist/spatial-hierarchy-ambiguity.js.map +1 -0
  101. package/dist/spatial-hierarchy-attributes.d.ts +54 -0
  102. package/dist/spatial-hierarchy-attributes.d.ts.map +1 -0
  103. package/dist/spatial-hierarchy-attributes.js +145 -0
  104. package/dist/spatial-hierarchy-attributes.js.map +1 -0
  105. package/dist/spatial-hierarchy-builder.d.ts +0 -30
  106. package/dist/spatial-hierarchy-builder.d.ts.map +1 -1
  107. package/dist/spatial-hierarchy-builder.js +45 -167
  108. package/dist/spatial-hierarchy-builder.js.map +1 -1
  109. package/dist/spatial-hierarchy-canonical-parent.d.ts +52 -2
  110. package/dist/spatial-hierarchy-canonical-parent.d.ts.map +1 -1
  111. package/dist/spatial-hierarchy-canonical-parent.js +153 -4
  112. package/dist/spatial-hierarchy-canonical-parent.js.map +1 -1
  113. package/dist/step-lexing.d.ts +1 -1
  114. package/dist/step-lexing.d.ts.map +1 -1
  115. package/dist/step-lexing.js +1 -56
  116. package/dist/step-lexing.js.map +1 -1
  117. package/dist/step-record-boundary.d.ts +28 -0
  118. package/dist/step-record-boundary.d.ts.map +1 -0
  119. package/dist/step-record-boundary.js +133 -0
  120. package/dist/step-record-boundary.js.map +1 -0
  121. package/dist/step-record-boundary.vectors.d.ts +102 -0
  122. package/dist/step-record-boundary.vectors.d.ts.map +1 -0
  123. package/dist/step-record-boundary.vectors.js +131 -0
  124. package/dist/step-record-boundary.vectors.js.map +1 -0
  125. package/dist/structural-extractor.d.ts +9 -0
  126. package/dist/structural-extractor.d.ts.map +1 -0
  127. package/dist/structural-extractor.js +310 -0
  128. package/dist/structural-extractor.js.map +1 -0
  129. package/dist/structural-load-extractor.d.ts +147 -0
  130. package/dist/structural-load-extractor.d.ts.map +1 -0
  131. package/dist/structural-load-extractor.js +178 -0
  132. package/dist/structural-load-extractor.js.map +1 -0
  133. package/dist/structural-step-values.d.ts +51 -0
  134. package/dist/structural-step-values.d.ts.map +1 -0
  135. package/dist/structural-step-values.js +109 -0
  136. package/dist/structural-step-values.js.map +1 -0
  137. package/dist/structural-types.d.ts +145 -0
  138. package/dist/structural-types.d.ts.map +1 -0
  139. package/dist/structural-types.js +5 -0
  140. package/dist/structural-types.js.map +1 -0
  141. package/dist/tokenizer.d.ts +11 -5
  142. package/dist/tokenizer.d.ts.map +1 -1
  143. package/dist/tokenizer.js +78 -21
  144. package/dist/tokenizer.js.map +1 -1
  145. package/dist/wasm-init-retry.d.ts +6 -42
  146. package/dist/wasm-init-retry.d.ts.map +1 -1
  147. package/dist/wasm-init-retry.js +6 -99
  148. package/dist/wasm-init-retry.js.map +1 -1
  149. package/dist/wasm-panic-forward.d.ts +7 -63
  150. package/dist/wasm-panic-forward.d.ts.map +1 -1
  151. package/dist/wasm-panic-forward.js +7 -100
  152. package/dist/wasm-panic-forward.js.map +1 -1
  153. package/package.json +5 -4
@@ -1,11 +1,11 @@
1
1
  /* This Source Code Form is subject to the terms of the Mozilla Public
2
2
  * License, v. 2.0. If a copy of the MPL was not distributed with this
3
3
  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
- import { IfcTypeEnum, RelationshipType, createLogger, isBuildingLikeSpatialType, isSpaceLikeSpatialType, isSpatialStructureType, isStoreyLikeSpatialType, IFC_BUILDING_STOREY_ELEVATION_INDEX, IFC_BUILDING_STOREY_PLACEMENT_INDEX, findStoreyByElevation, } from '@ifc-lite/data';
4
+ import { IfcTypeEnum, RelationshipType, isBuildingLikeSpatialType, isSpaceLikeSpatialType, isSpatialStructureType, isStoreyLikeSpatialType, findStoreyByElevation, spatialLookups, } from '@ifc-lite/data';
5
5
  import { EntityExtractor } from './entity-extractor.js';
6
- import { getAttributeNamesAcrossSchemas } from './ifc-schema.js';
7
- import { computeCanonicalParent } from './spatial-hierarchy-canonical-parent.js';
8
- const log = createLogger('SpatialHierarchy');
6
+ import { computeCanonicalParent, computeReachableSpatialNodes } from './spatial-hierarchy-canonical-parent.js';
7
+ import { extractLongName, extractElevation, extractPlacementElevation, } from './spatial-hierarchy-attributes.js';
8
+ import { computeAmbiguousStorey } from './spatial-hierarchy-ambiguity.js';
9
9
  export class SpatialHierarchyBuilder {
10
10
  /**
11
11
  * Fresh-parse build. Extracts storey elevations from the source buffer.
@@ -38,6 +38,7 @@ export class SpatialHierarchyBuilder {
38
38
  elementToContainer: new Map(),
39
39
  visited: new Set(),
40
40
  canonicalParent: computeCanonicalParent(entities, relationships),
41
+ reachableSpatialNodes: new Set(), // filled in below once IfcProject is known
41
42
  attrSource,
42
43
  attrExtractor: attrSource ? new EntityExtractor(attrSource.source) : undefined,
43
44
  };
@@ -49,6 +50,10 @@ export class SpatialHierarchyBuilder {
49
50
  }
50
51
  return undefined;
51
52
  }
53
+ // Which storeys buildNode will actually recurse into, computed up front
54
+ // so ContainsElements resolution below never depends on this node's own
55
+ // position in the traversal (#4310) - see computeReachableSpatialNodes.
56
+ ctx.reachableSpatialNodes = computeReachableSpatialNodes(projectIds[0], ctx.canonicalParent);
52
57
  const projectNode = this.buildNode(projectIds[0], ctx);
53
58
  if (ctx.byStorey.size === 0) {
54
59
  console.warn('[SpatialHierarchyBuilder] No storeys found in spatial hierarchy');
@@ -57,13 +62,6 @@ export class SpatialHierarchyBuilder {
57
62
  console.warn('[SpatialHierarchyBuilder] No buildings found in spatial hierarchy');
58
63
  }
59
64
  const { byStorey, byBuilding, bySite, bySpace, storeyElevations, elementToStorey, elementToContainer } = ctx;
60
- // Pre-build the element -> space lookup for O(1) getContainingSpace.
61
- const elementToSpace = new Map();
62
- for (const [spaceId, elementIds] of bySpace) {
63
- for (const elementId of elementIds) {
64
- elementToSpace.set(elementId, spaceId);
65
- }
66
- }
67
65
  return {
68
66
  project: projectNode,
69
67
  byStorey,
@@ -75,6 +73,7 @@ export class SpatialHierarchyBuilder {
75
73
  storeyHeights: new Map(),
76
74
  elementToStorey,
77
75
  elementToContainer,
76
+ ambiguousStorey: computeAmbiguousStorey(byStorey), // #4311
78
77
  getStoreyElements(storeyId) {
79
78
  return byStorey.get(storeyId) ?? [];
80
79
  },
@@ -84,29 +83,7 @@ export class SpatialHierarchyBuilder {
84
83
  // Z can never resolve to a different storey depending on entry path.
85
84
  return findStoreyByElevation(storeyElevations, z);
86
85
  },
87
- getContainingSpace(elementId) {
88
- return elementToSpace.get(elementId) ?? null;
89
- },
90
- getPath(elementId) {
91
- const path = [];
92
- const findPath = (node, targetId) => {
93
- path.push(node);
94
- // Match the node itself (so a promoted space/zone resolves) or one of
95
- // its contained elements.
96
- if (node.expressId === targetId || node.elements.includes(targetId)) {
97
- return true;
98
- }
99
- for (const child of node.children) {
100
- if (findPath(child, targetId)) {
101
- return true;
102
- }
103
- }
104
- path.pop();
105
- return false;
106
- };
107
- findPath(projectNode, elementId);
108
- return path;
109
- },
86
+ ...spatialLookups(projectNode, bySpace, elementToContainer),
110
87
  };
111
88
  }
112
89
  buildNode(expressId, ctx) {
@@ -118,17 +95,23 @@ export class SpatialHierarchyBuilder {
118
95
  // show both (issue #1634). It lives only in the raw record, so it needs the
119
96
  // source bytes; the source-less buildFromCache fallback leaves it undefined,
120
97
  // exactly like storey elevation.
121
- const rawLongName = this.extractLongName(expressId, ctx);
98
+ const rawLongName = extractLongName(expressId, ctx.attrSource, ctx.attrExtractor);
122
99
  // Fall back to LongName when Name is empty (common for IfcSpace). Left
123
100
  // empty, not a fabricated `Entity #<id>` — it flows into the export layer.
124
101
  const name = rawName || rawLongName || '';
125
102
  // Only keep LongName as a distinct descriptor when it adds something beyond
126
103
  // the primary label (never duplicate it into the secondary slot).
127
104
  const longName = rawLongName && rawLongName !== name ? rawLongName : undefined;
128
- // Guard against cyclic IfcRelAggregates chains (A aggregates B, B aggregates
129
- // A), which would otherwise recurse unbounded and overflow the stack. A
130
- // revisited node is returned as a leaf so the rest of the hierarchy still
131
- // builds.
105
+ // This is NOT what actually prevents unbounded recursion on a cyclic
106
+ // IfcRelAggregates chain (A aggregates B, B aggregates A) - it never
107
+ // fires today. Recursion here only ever follows a node's ONE canonical
108
+ // parent (computeCanonicalParent in spatial-hierarchy-canonical-parent.ts
109
+ // picks exactly one, and skips any candidate that would close a cycle
110
+ // back through the child, #4246), so a cycle can supply at most one
111
+ // recursion edge into any node - which structurally cannot loop. Kept as
112
+ // defence in depth in case that single-parent invariant is ever
113
+ // weakened; if it does fire, a revisited node is returned as a leaf so
114
+ // the rest of the hierarchy still builds.
132
115
  if (ctx.visited.has(expressId)) {
133
116
  return { expressId, type: typeEnum, name, longName, elevation: undefined, children: [], elements: [] };
134
117
  }
@@ -137,12 +120,12 @@ export class SpatialHierarchyBuilder {
137
120
  let elevation;
138
121
  if (typeEnum === IfcTypeEnum.IfcBuildingStorey && ctx.attrSource) {
139
122
  const { source, entityIndex, lengthUnitScale } = ctx.attrSource;
140
- let rawElevation = this.extractElevation(expressId, source, entityIndex);
123
+ let rawElevation = extractElevation(expressId, source, entityIndex);
141
124
  if (rawElevation === undefined) {
142
125
  // Elevation is optional and frequently null (Revit / ArchiCAD). Fall back
143
126
  // to the storey's Z from its ObjectPlacement so it still orders + lifts in
144
127
  // Exploded mode instead of collapsing to a single floor (#1289).
145
- rawElevation = this.extractPlacementElevation(expressId, source, entityIndex);
128
+ rawElevation = extractPlacementElevation(expressId, source, entityIndex);
146
129
  }
147
130
  if (rawElevation !== undefined) {
148
131
  elevation = rawElevation * lengthUnitScale;
@@ -205,6 +188,27 @@ export class SpatialHierarchyBuilder {
205
188
  }
206
189
  if (isStoreyLikeSpatialType(typeEnum)) {
207
190
  for (const elementId of containedElements) {
191
+ // First-declared wins on duplicate containment, matching containedIn()
192
+ // (#4248) - but only among storeys buildNode actually visits. A
193
+ // first-declared edge naming an unreachable storey (no path back to
194
+ // IfcProject, e.g. missing its own IfcRelAggregates edge) is not a
195
+ // real competing answer: buildNode never runs that storey's own
196
+ // branch, so nothing would ever claim the element there, and the
197
+ // element must not be dropped just because a later-declared but
198
+ // VIABLE storey lost a tie to a candidate that can't win (#4310).
199
+ // Only storey-like containers compete: a reachable IfcSpace edge
200
+ // declared first is not a storey answer, and letting it win here
201
+ // would leave the element with no elementToStorey entry at all
202
+ // (spaces never run this branch).
203
+ const containerEdges = relationships.inverse.getEdges(elementId, RelationshipType.ContainsElements);
204
+ const firstViableContainer = containerEdges.find((edge) => ctx.reachableSpatialNodes.has(edge.target) && isStoreyLikeSpatialType(entities.getTypeEnum(edge.target)));
205
+ // expressId is always reachable here (buildNode only runs on reachable
206
+ // nodes) and always has an edge to elementId (elementId came from THIS
207
+ // storey's own containedElements), so firstViableContainer is always
208
+ // defined - it can never fall through to the pre-#4310 "assign
209
+ // unconditionally" behavior by surprise.
210
+ if (firstViableContainer && firstViableContainer.target !== expressId)
211
+ continue; // a viable earlier-declared storey wins instead
208
212
  ctx.elementToStorey.set(elementId, expressId);
209
213
  // Propagate the storey assignment to aggregated descendants (e.g. an
210
214
  // IfcBuildingElementPart child of an IfcWall). Without this, parts have no
@@ -266,131 +270,5 @@ export class SpatialHierarchyBuilder {
266
270
  }
267
271
  return { expressId, type: typeEnum, name, longName, elevation, children: childNodes, elements: containedElements };
268
272
  }
269
- /**
270
- * Read an entity's LongName by schema attribute *name*. IfcSite / IfcBuilding /
271
- * IfcBuildingStorey / IfcSpace (and the IFC4.3 facility/infra containers)
272
- * declare LongName at index 7, but IfcProject carries it at a different slot,
273
- * so resolving by name (not a fixed index) stays correct across the IfcRoot
274
- * family. The lookup spans every bundled schema, so IFC4.3 leaves outside the
275
- * parser's IFC4 codegen pin resolve too. Returns the trimmed value, or
276
- * undefined when the type declares no LongName, it is empty, or no source
277
- * buffer is available (the buildFromCache path).
278
- */
279
- extractLongName(expressId, ctx) {
280
- if (!ctx.attrSource || !ctx.attrExtractor)
281
- return undefined;
282
- const ref = ctx.attrSource.entityIndex.byId.get(expressId);
283
- if (!ref)
284
- return undefined;
285
- try {
286
- const entity = ctx.attrExtractor.extractEntity(ref);
287
- if (!entity)
288
- return undefined;
289
- const idx = getAttributeNamesAcrossSchemas(entity.type).indexOf('LongName');
290
- if (idx < 0)
291
- return undefined;
292
- const raw = (entity.attributes || [])[idx];
293
- const value = typeof raw === 'string' ? raw.trim() : '';
294
- return value.length > 0 ? value : undefined;
295
- }
296
- catch (error) {
297
- log.caught('Failed to extract LongName', error, {
298
- operation: 'extractLongName',
299
- entityId: expressId,
300
- });
301
- return undefined;
302
- }
303
- }
304
- /**
305
- * Extract elevation from an IfcBuildingStorey. Elevation is attribute index 9
306
- * in both IFC2x3 and IFC4 (GlobalId, OwnerHistory, Name, Description,
307
- * ObjectType, ObjectPlacement, Representation, LongName, CompositionType,
308
- * Elevation).
309
- */
310
- extractElevation(expressId, source, entityIndex) {
311
- const ref = entityIndex.byId.get(expressId);
312
- if (!ref)
313
- return undefined;
314
- try {
315
- const extractor = new EntityExtractor(source);
316
- const entity = extractor.extractEntity(ref);
317
- if (!entity)
318
- return undefined;
319
- const attrs = entity.attributes || [];
320
- // Number from a raw value or a typed value like ['IFCLENGTHMEASURE', 3.0].
321
- const extractNumber = (val) => {
322
- if (typeof val === 'number')
323
- return val;
324
- if (Array.isArray(val) && val.length === 2 && typeof val[1] === 'number') {
325
- return val[1];
326
- }
327
- return undefined;
328
- };
329
- // Read ONLY the Elevation slot: a previous "scan every attribute for a
330
- // number < 10000" fallback wrongly treated reference attributes (parsed as
331
- // bare express-id numbers, e.g. OwnerHistory #3628 -> 3628) as elevations,
332
- // so a storey with a null Elevation got a garbage value instead of falling
333
- // through to the ObjectPlacement-Z fallback below (#1289).
334
- if (attrs.length > IFC_BUILDING_STOREY_ELEVATION_INDEX) {
335
- return extractNumber(attrs[IFC_BUILDING_STOREY_ELEVATION_INDEX]);
336
- }
337
- }
338
- catch (error) {
339
- log.caught('Failed to extract elevation', error, {
340
- operation: 'extractElevation',
341
- entityId: expressId,
342
- entityType: 'IfcBuildingStorey',
343
- });
344
- }
345
- return undefined;
346
- }
347
- /**
348
- * Resolve a storey's elevation from its ObjectPlacement, used as a fallback when
349
- * the Elevation attribute is null. Walks
350
- * IfcBuildingStorey.ObjectPlacement (IfcLocalPlacement)
351
- * -> RelativePlacement (IfcAxis2Placement3D)
352
- * -> Location (IfcCartesianPoint).Coordinates[2]
353
- * i.e. the storey's Z relative to its parent spatial container, which matches
354
- * the semantics of the Elevation attribute and avoids folding in any site-level
355
- * georeferencing Z. Returns the raw (unscaled) Z, or undefined when the chain
356
- * can't be resolved.
357
- */
358
- extractPlacementElevation(expressId, source, entityIndex) {
359
- try {
360
- const extractor = new EntityExtractor(source);
361
- const readAttrs = (id) => {
362
- const ref = entityIndex.byId.get(id);
363
- if (!ref)
364
- return undefined;
365
- return extractor.extractEntity(ref)?.attributes ?? undefined;
366
- };
367
- const placementId = readAttrs(expressId)?.[IFC_BUILDING_STOREY_PLACEMENT_INDEX];
368
- if (typeof placementId !== 'number')
369
- return undefined;
370
- // IfcLocalPlacement(PlacementRelTo, RelativePlacement) - RelativePlacement
371
- // (index 1) is the IfcAxis2Placement3D carrying this storey's own offset.
372
- const axisId = readAttrs(placementId)?.[1];
373
- if (typeof axisId !== 'number')
374
- return undefined;
375
- // IfcAxis2Placement3D(Location, Axis, RefDirection) - Location (index 0) is
376
- // an IfcCartesianPoint.
377
- const locationId = readAttrs(axisId)?.[0];
378
- if (typeof locationId !== 'number')
379
- return undefined;
380
- // IfcCartesianPoint.Coordinates (index 0) is a list [x, y, z].
381
- const coords = readAttrs(locationId)?.[0];
382
- if (Array.isArray(coords) && coords.length >= 3 && typeof coords[2] === 'number') {
383
- return coords[2];
384
- }
385
- }
386
- catch (error) {
387
- log.caught('Failed to extract placement elevation', error, {
388
- operation: 'extractPlacementElevation',
389
- entityId: expressId,
390
- entityType: 'IfcBuildingStorey',
391
- });
392
- }
393
- return undefined;
394
- }
395
273
  }
396
274
  //# sourceMappingURL=spatial-hierarchy-builder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"spatial-hierarchy-builder.js","sourceRoot":"","sources":["../src/spatial-hierarchy-builder.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAc/D,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,mCAAmC,EACnC,mCAAmC,EACnC,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAEjF,MAAM,GAAG,GAAG,YAAY,CAAC,kBAAkB,CAAC,CAAC;AA+B7C,MAAM,OAAO,uBAAuB;IAClC;;;;;OAKG;IACH,KAAK,CACH,QAAqB,EACrB,aAAgC,EAChC,QAAq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O,SAAS,CAAC;IACnB,CAAC;CACF"}
1
+ {"version":3,"file":"spatial-hierarchy-builder.js","sourceRoot":"","sources":["../src/spatial-hierarchy-builder.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAc/D,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AAC/G,OAAO,EAEL,eAAe,EACf,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAyB1E,MAAM,OAAO,uBAAuB;IAClC;;;;;OAKG;IACH,KAAK,CACH,QAAqB,EACrB,aAAgC,EAChC,QAAqB,EACrB,MAAmC,EACnC,WAAwE,EACxE,kBAA0B,GAAG;QAE7B,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,EAAE,IAAI,CAAC,CAAC;QACzG,kEAAkE;QAClE,OAAO,SAA6B,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,cAAc,CACZ,QAAqB,EACrB,aAAgC;QAEhC,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAClE,CAAC;IAEO,QAAQ,CACd,QAAqB,EACrB,aAAgC,EAChC,UAAuC,EACvC,gBAAyB;QAEzB,MAAM,GAAG,GAAiB;YACxB,QAAQ;YACR,aAAa;YACb,QAAQ,EAAE,IAAI,GAAG,EAAE;YACnB,UAAU,EAAE,IAAI,GAAG,EAAE;YACrB,MAAM,EA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,GAAG,CAAC,GAAG,CAAC;4BAAE,SAAS;wBAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;wBACd,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;4BACrC,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;wBAC7C,CAAC;wBACD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;oBAClB,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IACrH,CAAC;CACF"}
@@ -3,6 +3,27 @@
3
3
  * under the module-size budget, #4095).
4
4
  */
5
5
  import type { EntityTable, RelationshipGraph } from '@ifc-lite/data';
6
+ /**
7
+ * Is `candidateParent` reachable from `childId` by walking forward
8
+ * `IfcRelAggregates` edges (i.e. is `childId` an ANCESTOR of `candidateParent`
9
+ * in the raw, unresolved aggregation graph)? Used only to disqualify a tied
10
+ * candidate parent that would close a cycle back through the child itself -
11
+ * see the doc comment on `computeCanonicalParent` for why that specific shape
12
+ * needs a check at all. Bounded to `childId`'s own (raw) aggregation
13
+ * subtree, so it only costs anything on an already-malformed file where a
14
+ * child has more than one candidate Aggregates parent - the common case
15
+ * (one candidate) never calls this.
16
+ */
17
+ /**
18
+ * Upper bound on aggregate-graph node visits spent on back-edge cycle checks
19
+ * for one file. The check only runs for children named by MORE THAN ONE
20
+ * IfcRelAggregates (already malformed), and costs one descendant walk per
21
+ * such child - O(V+E) each - so a crafted file with thousands of contested
22
+ * children could otherwise burn O(C·(V+E)). Past the budget the resolver
23
+ * falls back to plain first-declared-wins (the pre-#4285 behaviour) and says
24
+ * so once, instead of stalling the parse.
25
+ */
26
+ export declare const CYCLE_CHECK_VISIT_BUDGET = 2000000;
6
27
  /**
7
28
  * Resolve each spatial-structure entity's ONE canonical parent, globally,
8
29
  * before any recursion starts - so the result cannot depend on traversal
@@ -21,7 +42,19 @@ import type { EntityTable, RelationshipGraph } from '@ifc-lite/data';
21
42
  * sort is stable per key (`relationship-graph.ts`) - it scatters edges
22
43
  * for the same child in the order they were appended, never
23
44
  * reordering by id. So `edges[0]` for a given child is the
24
- * first-declared parent edge; no id comparison is needed or correct.
45
+ * first-declared parent edge; no id comparison is needed or correct -
46
+ * EXCEPT that a candidate closing a cycle back through the child is
47
+ * skipped first (see `aggregatedDescendants`, #4246): a mutual or
48
+ * longer aggregation back-edge cannot win a tie against a candidate that
49
+ * doesn't orphan the child's own subtree from itself. Each time that
50
+ * happens, a warning is logged (always-visible, like the existing
51
+ * "No storeys/buildings found" warnings below) naming the child and the
52
+ * disqualified candidate - the only signal a caller gets that a
53
+ * malformed back-edge was found and repaired, short of building a
54
+ * dedicated report (out of scope here; see the #4208 semantic drop
55
+ * census for that shape of reporting - a different layer: per-STEP-class
56
+ * scan/retain counts collected during columnar categorization, not a
57
+ * graph-repair event like this one).
25
58
  * 2. Only when a child has NO aggregates edge at all does a containment edge
26
59
  * (IfcRelContainedInSpatialStructure targeting a spatial-structure type -
27
60
  * the Revit Family/Dynamo `IfcSpace`/`IfcSpatialZone` pattern, #1075)
@@ -32,5 +65,22 @@ import type { EntityTable, RelationshipGraph } from '@ifc-lite/data';
32
65
  * names the child drops the edge instead of adding an empty-stub duplicate
33
66
  * (#4095).
34
67
  */
35
- export declare function computeCanonicalParent(entities: EntityTable, relationships: RelationshipGraph): Map<number, number>;
68
+ export declare function computeCanonicalParent(entities: EntityTable, relationships: RelationshipGraph, options?: {
69
+ cycleCheckVisitBudget?: number;
70
+ }): Map<number, number>;
71
+ /**
72
+ * Which spatial-structure nodes will `SpatialHierarchyBuilder.buildNode`
73
+ * actually visit, starting from `projectId`? Mirrors `addSpatialChild`
74
+ * exactly: a node is visited iff it is `projectId` itself, or its
75
+ * `canonicalParent` entry points to an already-visited node - the same
76
+ * check `addSpatialChild` makes before recursing (`canonicalParent.get
77
+ * (childId) === expressId`). Computed as one forward walk over
78
+ * `canonicalParent` (childId -> parentId) up front, so a storey's
79
+ * reachability never depends on where in the traversal it happens to sit
80
+ * (#4310): a node named only by an unreachable storey - one with no path
81
+ * back to `projectId`, e.g. a malformed file where a storey has no
82
+ * `IfcRelAggregates` edge at all - is never in this set, exactly as
83
+ * `buildNode` would never recurse into it.
84
+ */
85
+ export declare function computeReachableSpatialNodes(projectId: number, canonicalParent: Map<number, number>): Set<number>;
36
86
  //# sourceMappingURL=spatial-hierarchy-canonical-parent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"spatial-hierarchy-canonical-parent.d.ts","sourceRoot":"","sources":["../src/spatial-hierarchy-canonical-parent.ts"],"names":[],"mappings":"AAIA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,iBAAiB,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAmCnH"}
1
+ {"version":3,"file":"spatial-hierarchy-canonical-parent.d.ts","sourceRoot":"","sources":["../src/spatial-hierarchy-canonical-parent.ts"],"names":[],"mappings":"AAIA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAKrE;;;;;;;;;;GAUG;AACH;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,UAAY,CAAC;AA4BlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,WAAW,EACrB,aAAa,EAAE,iBAAiB,EAChC,OAAO,GAAE;IAAE,qBAAqB,CAAC,EAAE,MAAM,CAAA;CAAO,GAC/C,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CA6FrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC,GAAG,CAAC,MAAM,CAAC,CAsBb"}
@@ -1,7 +1,51 @@
1
1
  /* This Source Code Form is subject to the terms of the Mozilla Public
2
2
  * License, v. 2.0. If a copy of the MPL was not distributed with this
3
3
  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
- import { IfcTypeEnum, RelationshipType, isSpatialStructureType } from '@ifc-lite/data';
4
+ import { IfcTypeEnum, RelationshipType, createLogger, isSpatialStructureType } from '@ifc-lite/data';
5
+ const log = createLogger('SpatialHierarchy');
6
+ /**
7
+ * Is `candidateParent` reachable from `childId` by walking forward
8
+ * `IfcRelAggregates` edges (i.e. is `childId` an ANCESTOR of `candidateParent`
9
+ * in the raw, unresolved aggregation graph)? Used only to disqualify a tied
10
+ * candidate parent that would close a cycle back through the child itself -
11
+ * see the doc comment on `computeCanonicalParent` for why that specific shape
12
+ * needs a check at all. Bounded to `childId`'s own (raw) aggregation
13
+ * subtree, so it only costs anything on an already-malformed file where a
14
+ * child has more than one candidate Aggregates parent - the common case
15
+ * (one candidate) never calls this.
16
+ */
17
+ /**
18
+ * Upper bound on aggregate-graph node visits spent on back-edge cycle checks
19
+ * for one file. The check only runs for children named by MORE THAN ONE
20
+ * IfcRelAggregates (already malformed), and costs one descendant walk per
21
+ * such child - O(V+E) each - so a crafted file with thousands of contested
22
+ * children could otherwise burn O(C·(V+E)). Past the budget the resolver
23
+ * falls back to plain first-declared-wins (the pre-#4285 behaviour) and says
24
+ * so once, instead of stalling the parse.
25
+ */
26
+ export const CYCLE_CHECK_VISIT_BUDGET = 2_000_000;
27
+ /**
28
+ * Aggregated descendants of `childId` (transitive, forward `Aggregates`),
29
+ * charged against `budget`. Returns null when the budget ran out mid-walk
30
+ * (the partial set must not be used - a missing descendant reads as "no
31
+ * cycle", which is the wrong side to err on).
32
+ */
33
+ function aggregatedDescendants(childId, relationships, budget) {
34
+ const visited = new Set([childId]);
35
+ const stack = [childId];
36
+ while (stack.length > 0) {
37
+ const current = stack.pop();
38
+ for (const kid of relationships.getRelated(current, RelationshipType.Aggregates, 'forward')) {
39
+ if (--budget.visits < 0)
40
+ return null;
41
+ if (!visited.has(kid)) {
42
+ visited.add(kid);
43
+ stack.push(kid);
44
+ }
45
+ }
46
+ }
47
+ return visited;
48
+ }
5
49
  /**
6
50
  * Resolve each spatial-structure entity's ONE canonical parent, globally,
7
51
  * before any recursion starts - so the result cannot depend on traversal
@@ -20,7 +64,19 @@ import { IfcTypeEnum, RelationshipType, isSpatialStructureType } from '@ifc-lite
20
64
  * sort is stable per key (`relationship-graph.ts`) - it scatters edges
21
65
  * for the same child in the order they were appended, never
22
66
  * reordering by id. So `edges[0]` for a given child is the
23
- * first-declared parent edge; no id comparison is needed or correct.
67
+ * first-declared parent edge; no id comparison is needed or correct -
68
+ * EXCEPT that a candidate closing a cycle back through the child is
69
+ * skipped first (see `aggregatedDescendants`, #4246): a mutual or
70
+ * longer aggregation back-edge cannot win a tie against a candidate that
71
+ * doesn't orphan the child's own subtree from itself. Each time that
72
+ * happens, a warning is logged (always-visible, like the existing
73
+ * "No storeys/buildings found" warnings below) naming the child and the
74
+ * disqualified candidate - the only signal a caller gets that a
75
+ * malformed back-edge was found and repaired, short of building a
76
+ * dedicated report (out of scope here; see the #4208 semantic drop
77
+ * census for that shape of reporting - a different layer: per-STEP-class
78
+ * scan/retain counts collected during columnar categorization, not a
79
+ * graph-repair event like this one).
24
80
  * 2. Only when a child has NO aggregates edge at all does a containment edge
25
81
  * (IfcRelContainedInSpatialStructure targeting a spatial-structure type -
26
82
  * the Revit Family/Dynamo `IfcSpace`/`IfcSpatialZone` pattern, #1075)
@@ -31,8 +87,11 @@ import { IfcTypeEnum, RelationshipType, isSpatialStructureType } from '@ifc-lite
31
87
  * names the child drops the edge instead of adding an empty-stub duplicate
32
88
  * (#4095).
33
89
  */
34
- export function computeCanonicalParent(entities, relationships) {
90
+ export function computeCanonicalParent(entities, relationships, options = {}) {
35
91
  const canonicalParent = new Map();
92
+ const visitBudget = options.cycleCheckVisitBudget ?? CYCLE_CHECK_VISIT_BUDGET;
93
+ const cycleBudget = { visits: visitBudget };
94
+ let cycleBudgetExhausted = false;
36
95
  const claimFirstDeclaredParent = (predicate, relType) => {
37
96
  for (const childId of relationships.inverse.offsets.keys()) {
38
97
  if (canonicalParent.has(childId) || !predicate(childId))
@@ -45,7 +104,60 @@ export function computeCanonicalParent(entities, relationships) {
45
104
  // order here. This mirrors apps/server's `canonical_parent`
46
105
  // (`spatial.rs`), which does `entry(...).or_insert(...)` while
47
106
  // iterating relationships in file-scan order: first occurrence wins.
48
- const winner = edges[0];
107
+ let winner = edges[0];
108
+ if (relType === RelationshipType.Aggregates && edges.length > 1) {
109
+ // A child named as the target of more than one IfcRelAggregates is
110
+ // already a malformed file, but one shape needs a special rule: a
111
+ // BACK-EDGE, where a candidate parent P is itself a (possibly
112
+ // indirect) AGGREGATED DESCENDANT of this very child - i.e. taking P
113
+ // as childId's parent would close a cycle back through childId. That
114
+ // is the STEP-authoring-tool mistake of declaring an aggregation
115
+ // pair in both directions (#4246, the direct 2-node case; the same
116
+ // shape generalizes to a longer A->B->C->A chain). If the back-edge
117
+ // is declared before the real parent edge, plain first-declared-wins
118
+ // picks P as childId's canonical parent; P's own resolution (walking
119
+ // the SAME cycle) then independently lands back on a node inside the
120
+ // cycle too, so the whole cycle points at itself and none of it is
121
+ // reachable from IfcProject - orphaning whatever real subtree hung
122
+ // off any node in the cycle.
123
+ //
124
+ // Skip any candidate edge that closes a cycle through childId and
125
+ // take the first REMAINING candidate, still by declaration order -
126
+ // this changes nothing when a child has only one candidate (the
127
+ // overwhelmingly common case) or when none of its candidates close a
128
+ // cycle (the genuine multiple-real-parents case, #4095, which this
129
+ // loop never even sees more than one Aggregates edge for - #4095's
130
+ // contested child has exactly one Aggregates edge naming it; its
131
+ // OTHER "parent" only contains it). If EVERY candidate closes a
132
+ // cycle (a more degenerate file than anything observed), fall
133
+ // through to plain first-declared so the child is never left
134
+ // without a parent.
135
+ //
136
+ // One descendant walk per contested child (not per candidate), under a
137
+ // file-wide visit budget - see CYCLE_CHECK_VISIT_BUDGET.
138
+ const descendants = cycleBudgetExhausted ? null : aggregatedDescendants(childId, relationships, cycleBudget);
139
+ if (descendants === null) {
140
+ if (!cycleBudgetExhausted) {
141
+ cycleBudgetExhausted = true;
142
+ log.warn(`Aggregation back-edge cycle checks stopped after ${visitBudget} graph visits; ` +
143
+ 'remaining multi-parent children resolve to their first-declared IfcRelAggregates edge');
144
+ }
145
+ }
146
+ else {
147
+ const rejected = [];
148
+ const nonCyclic = edges.find((edge) => {
149
+ const cyclic = descendants.has(edge.target);
150
+ if (cyclic)
151
+ rejected.push(edge.target);
152
+ return !cyclic;
153
+ });
154
+ if (nonCyclic && nonCyclic !== winner) {
155
+ log.warn(`Ignored ${rejected.length} aggregation back-edge cycle(s): #${childId} kept parent #${nonCyclic.target}, ` +
156
+ `not ${rejected.map((id) => `#${id}`).join(', ')} (each would have closed a cycle back through #${childId})`);
157
+ winner = nonCyclic;
158
+ }
159
+ }
160
+ }
49
161
  // Inverse edges flip source/target, so `target` here is the original
50
162
  // relationship's `relating_id` (the parent).
51
163
  canonicalParent.set(childId, winner.target);
@@ -60,4 +172,41 @@ export function computeCanonicalParent(entities, relationships) {
60
172
  }, RelationshipType.ContainsElements);
61
173
  return canonicalParent;
62
174
  }
175
+ /**
176
+ * Which spatial-structure nodes will `SpatialHierarchyBuilder.buildNode`
177
+ * actually visit, starting from `projectId`? Mirrors `addSpatialChild`
178
+ * exactly: a node is visited iff it is `projectId` itself, or its
179
+ * `canonicalParent` entry points to an already-visited node - the same
180
+ * check `addSpatialChild` makes before recursing (`canonicalParent.get
181
+ * (childId) === expressId`). Computed as one forward walk over
182
+ * `canonicalParent` (childId -> parentId) up front, so a storey's
183
+ * reachability never depends on where in the traversal it happens to sit
184
+ * (#4310): a node named only by an unreachable storey - one with no path
185
+ * back to `projectId`, e.g. a malformed file where a storey has no
186
+ * `IfcRelAggregates` edge at all - is never in this set, exactly as
187
+ * `buildNode` would never recurse into it.
188
+ */
189
+ export function computeReachableSpatialNodes(projectId, canonicalParent) {
190
+ const childrenOf = new Map();
191
+ for (const [childId, parentId] of canonicalParent) {
192
+ let siblings = childrenOf.get(parentId);
193
+ if (!siblings) {
194
+ siblings = [];
195
+ childrenOf.set(parentId, siblings);
196
+ }
197
+ siblings.push(childId);
198
+ }
199
+ const reachable = new Set([projectId]);
200
+ const stack = [projectId];
201
+ while (stack.length > 0) {
202
+ const current = stack.pop();
203
+ for (const childId of childrenOf.get(current) ?? []) {
204
+ if (reachable.has(childId))
205
+ continue; // also guards a canonicalParent cycle from looping forever
206
+ reachable.add(childId);
207
+ stack.push(childId);
208
+ }
209
+ }
210
+ return reachable;
211
+ }
63
212
  //# sourceMappingURL=spatial-hierarchy-canonical-parent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"spatial-hierarchy-canonical-parent.js","sourceRoot":"","sources":["../src/spatial-hierarchy-canonical-parent.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAQ/D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAEvF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAAqB,EAAE,aAAgC;IAC5F,MAAM,eAAe,GAAG,IAAI,GAAG,EAAkB,CAAC;IAElD,MAAM,wBAAwB,GAAG,CAC/B,SAAuC,EACvC,OAAyB,EACnB,EAAE;QACR,KAAK,MAAM,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;YAC3D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CAAC,EACD,gBAAgB,CAAC,gBAAgB,CAClC,CAAC;IAEF,OAAO,eAAe,CAAC;AACzB,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,4BAA4B,CAC1C,SAAiB,EACjB,eAAoC;IAEpC,MAAM,UAAU,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC/C,KAAK,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,eAAe,EAAE,CAAC;QAClD,IAAI,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,QAAQ,GAAG,EAAE,CAAC;YACd,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACrC,CAAC;QACD,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,GAAG,CAAS,CAAC,SAAS,CAAC,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAa,CAAC,SAAS,CAAC,CAAC;IACpC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,EAAY,CAAC;QACtC,KAAK,MAAM,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;YACpD,IAAI,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC;gBAAE,SAAS,CAAC,2DAA2D;YACjG,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACvB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -8,9 +8,9 @@ export interface Skip {
8
8
  }
9
9
  export declare function skipLexical(buf: Uint8Array, pos: number, len: number): Skip;
10
10
  export declare function opensLiteralOrComment(buf: Uint8Array, pos: number, len: number): boolean;
11
+ export declare function isSpaceByte(b: number): boolean;
11
12
  export declare function skipTrivia(buf: Uint8Array, pos: number, len: number): Skip;
12
13
  export declare function countNewlines(buf: Uint8Array, from: number, to: number): number;
13
- export declare function findEntityLength(buf: Uint8Array, pos: number, startOffset: number): number;
14
14
  /**
15
15
  * A scan of one decoded string.
16
16
  *