@ifc-lite/export 2.9.3 → 3.0.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.
- package/dist/csv-cell.d.ts +101 -0
- package/dist/csv-cell.d.ts.map +1 -0
- package/dist/csv-cell.js +90 -0
- package/dist/csv-cell.js.map +1 -0
- package/dist/demesh-session.d.ts.map +1 -1
- package/dist/demesh-session.js +2 -1
- package/dist/demesh-session.js.map +1 -1
- package/dist/effective-index.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/lod1-generator.d.ts +0 -2
- package/dist/lod1-generator.d.ts.map +1 -1
- package/dist/lod1-generator.js +1 -1
- package/dist/lod1-generator.js.map +1 -1
- package/dist/merged-exporter.d.ts +3 -2
- package/dist/merged-exporter.d.ts.map +1 -1
- package/dist/merged-exporter.js +32 -44
- package/dist/merged-exporter.js.map +1 -1
- package/dist/parquet-exporter.js +2 -0
- package/dist/parquet-exporter.js.map +1 -1
- package/dist/reference-collector.d.ts +40 -17
- package/dist/reference-collector.d.ts.map +1 -1
- package/dist/reference-collector.js +89 -19
- package/dist/reference-collector.js.map +1 -1
- package/dist/schema-converter.d.ts.map +1 -1
- package/dist/schema-converter.js +27 -1
- package/dist/schema-converter.js.map +1 -1
- package/dist/source-ref-bounds.d.ts +16 -1
- package/dist/source-ref-bounds.d.ts.map +1 -1
- package/dist/source-ref-bounds.js +85 -0
- package/dist/source-ref-bounds.js.map +1 -1
- package/dist/step-attribute-mutations.d.ts +91 -0
- package/dist/step-attribute-mutations.d.ts.map +1 -0
- package/dist/step-attribute-mutations.js +302 -0
- package/dist/step-attribute-mutations.js.map +1 -0
- package/dist/step-collection.d.ts +55 -0
- package/dist/step-collection.d.ts.map +1 -0
- package/dist/step-collection.js +125 -0
- package/dist/step-collection.js.map +1 -0
- package/dist/step-export-contexts.d.ts +63 -0
- package/dist/step-export-contexts.d.ts.map +1 -0
- package/dist/step-export-contexts.js +51 -0
- package/dist/step-export-contexts.js.map +1 -0
- package/dist/step-export-types.d.ts +262 -0
- package/dist/step-export-types.d.ts.map +1 -0
- package/dist/step-export-types.js +22 -0
- package/dist/step-export-types.js.map +1 -0
- package/dist/step-exporter.d.ts +45 -398
- package/dist/step-exporter.d.ts.map +1 -1
- package/dist/step-exporter.js +145 -2033
- package/dist/step-exporter.js.map +1 -1
- package/dist/step-geometry-types.d.ts +19 -0
- package/dist/step-geometry-types.d.ts.map +1 -0
- package/dist/step-geometry-types.js +57 -0
- package/dist/step-geometry-types.js.map +1 -0
- package/dist/step-georeferencing.d.ts +58 -0
- package/dist/step-georeferencing.d.ts.map +1 -0
- package/dist/step-georeferencing.js +339 -0
- package/dist/step-georeferencing.js.map +1 -0
- package/dist/step-header.d.ts +43 -0
- package/dist/step-header.d.ts.map +1 -0
- package/dist/step-header.js +70 -0
- package/dist/step-header.js.map +1 -0
- package/dist/step-omission-predicates.d.ts +51 -0
- package/dist/step-omission-predicates.d.ts.map +1 -0
- package/dist/step-omission-predicates.js +268 -0
- package/dist/step-omission-predicates.js.map +1 -0
- package/dist/step-overlay-entities.d.ts +64 -0
- package/dist/step-overlay-entities.d.ts.map +1 -0
- package/dist/step-overlay-entities.js +119 -0
- package/dist/step-overlay-entities.js.map +1 -0
- package/dist/step-pass-builder.d.ts +44 -0
- package/dist/step-pass-builder.d.ts.map +1 -0
- package/dist/step-pass-builder.js +249 -0
- package/dist/step-pass-builder.js.map +1 -0
- package/dist/step-property-sets.d.ts +198 -0
- package/dist/step-property-sets.d.ts.map +1 -0
- package/dist/step-property-sets.js +842 -0
- package/dist/step-property-sets.js.map +1 -0
- package/dist/step-serialization.d.ts +16 -1
- package/dist/step-serialization.d.ts.map +1 -1
- package/dist/step-serialization.js +50 -3
- package/dist/step-serialization.js.map +1 -1
- package/dist/step-source-iteration.d.ts +95 -0
- package/dist/step-source-iteration.d.ts.map +1 -0
- package/dist/step-source-iteration.js +178 -0
- package/dist/step-source-iteration.js.map +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
import { escapeStepString, toStepReal } from './step-serialization.js';
|
|
5
|
+
/**
|
|
6
|
+
* Message for the one refusal `export()` can report, shared by the returned
|
|
7
|
+
* `stats.warnings` entry and the console line so the two cannot drift.
|
|
8
|
+
*/
|
|
9
|
+
const MAP_CONVERSION_WITHOUT_CONTEXT_WARNING = 'Cannot create IfcMapConversion: no IfcGeometricRepresentationContext is available to reference as SourceCRS. The IfcProjectedCRS is unaffected.';
|
|
10
|
+
/**
|
|
11
|
+
* Message for the refusal `export()` reports when a map conversion is
|
|
12
|
+
* requested but there is no IfcProjectedCRS to attach it to — none was
|
|
13
|
+
* requested and none exists in the file — distinct from
|
|
14
|
+
* {@link MAP_CONVERSION_WITHOUT_CONTEXT_WARNING}, which is worded for the
|
|
15
|
+
* case where an IfcProjectedCRS exists (or was written) but no context is
|
|
16
|
+
* available to reference.
|
|
17
|
+
*/
|
|
18
|
+
const MAP_CONVERSION_WITHOUT_CRS_WARNING = 'Cannot create IfcMapConversion: no IfcProjectedCRS was requested and none exists in the file to reference as TargetCRS. Nothing was written.';
|
|
19
|
+
/**
|
|
20
|
+
* Apply `options.georefMutations` to `pass`, in place.
|
|
21
|
+
*
|
|
22
|
+
* The caller owns the `options.applyMutations !== false && options.georefMutations`
|
|
23
|
+
* gate; reaching here means georeferencing edits were both requested and enabled.
|
|
24
|
+
*/
|
|
25
|
+
export function applyGeoreferencingMutations(pass, georefMutations, ctx) {
|
|
26
|
+
const gm = georefMutations;
|
|
27
|
+
// `effective.byType`, not the raw index: a source IfcProjectedCRS the
|
|
28
|
+
// session tombstoned is still in `dataStore.entityIndex`, so the modify
|
|
29
|
+
// branch below would queue attribute edits against an id the
|
|
30
|
+
// source-iteration pass then skips — the replacement georeferencing
|
|
31
|
+
// vanishes from the file with no error. `effective.byType` drops
|
|
32
|
+
// tombstones and adds overlay-created records, which the new-entities
|
|
33
|
+
// pass applies `modifiedAttributes` to, so both branches agree on which
|
|
34
|
+
// georeferencing entities exist (#2048).
|
|
35
|
+
const existingCrsIds = pass.effective.byType.get('IFCPROJECTEDCRS');
|
|
36
|
+
const existingMcIds = pass.effective.byType.get('IFCMAPCONVERSION');
|
|
37
|
+
// Modify existing IfcProjectedCRS
|
|
38
|
+
if (gm.projectedCRS && existingCrsIds?.length) {
|
|
39
|
+
const entityId = existingCrsIds[0];
|
|
40
|
+
if (!pass.modifiedAttributes.has(entityId)) {
|
|
41
|
+
pass.modifiedAttributes.set(entityId, new Map());
|
|
42
|
+
}
|
|
43
|
+
const attrMap = pass.modifiedAttributes.get(entityId);
|
|
44
|
+
const crs = gm.projectedCRS;
|
|
45
|
+
let changed = false;
|
|
46
|
+
if (crs.name !== undefined) {
|
|
47
|
+
attrMap.set('Name', String(crs.name));
|
|
48
|
+
changed = true;
|
|
49
|
+
}
|
|
50
|
+
if (crs.description !== undefined) {
|
|
51
|
+
attrMap.set('Description', String(crs.description));
|
|
52
|
+
changed = true;
|
|
53
|
+
}
|
|
54
|
+
if (crs.geodeticDatum !== undefined) {
|
|
55
|
+
attrMap.set('GeodeticDatum', String(crs.geodeticDatum));
|
|
56
|
+
changed = true;
|
|
57
|
+
}
|
|
58
|
+
if (crs.verticalDatum !== undefined) {
|
|
59
|
+
attrMap.set('VerticalDatum', String(crs.verticalDatum));
|
|
60
|
+
changed = true;
|
|
61
|
+
}
|
|
62
|
+
if (crs.mapProjection !== undefined) {
|
|
63
|
+
attrMap.set('MapProjection', String(crs.mapProjection));
|
|
64
|
+
changed = true;
|
|
65
|
+
}
|
|
66
|
+
if (crs.mapZone !== undefined) {
|
|
67
|
+
attrMap.set('MapZone', String(crs.mapZone));
|
|
68
|
+
changed = true;
|
|
69
|
+
}
|
|
70
|
+
if (crs.mapUnit !== undefined) {
|
|
71
|
+
const mapUnitRef = resolveMapUnitReference(String(crs.mapUnit), pass.newGeorefLines, pass.effective, ctx);
|
|
72
|
+
attrMap.set('MapUnit', `#${mapUnitRef}`);
|
|
73
|
+
changed = true;
|
|
74
|
+
}
|
|
75
|
+
if (changed) {
|
|
76
|
+
pass.modifiedEntities.add(entityId);
|
|
77
|
+
// Queued as attribute edits, which only the source-iteration pass
|
|
78
|
+
// writes — so under `deltaOnly` this nominates and settle decides.
|
|
79
|
+
// Recorded even when the host is already in `modifiedEntities`: that
|
|
80
|
+
// guard existed to stop a second COUNT, which the ledger now handles
|
|
81
|
+
// per entity, and suppressing the nomination would hide a dropped
|
|
82
|
+
// georeferencing edit behind an unrelated edit to the same record.
|
|
83
|
+
//
|
|
84
|
+
// `changed` above is INTENT — a field was supplied, not a field that
|
|
85
|
+
// differs from the one in the file. Writing `name: 'EPSG:2056'` over
|
|
86
|
+
// an IfcProjectedCRS already named `EPSG:2056` leaves the line
|
|
87
|
+
// byte-identical, so a full export waits for the rewrite exactly as
|
|
88
|
+
// the plain attribute site does (#2483).
|
|
89
|
+
if (pass.hasEmittableHostBytes(entityId)) {
|
|
90
|
+
pass.inPlaceNominees.georeferencing.add(entityId);
|
|
91
|
+
if (ctx.deltaOnly)
|
|
92
|
+
pass.modifications.nominate(entityId, 'georeferencing');
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// Modify existing IfcMapConversion
|
|
97
|
+
if (gm.mapConversion && existingMcIds?.length) {
|
|
98
|
+
const entityId = existingMcIds[0];
|
|
99
|
+
if (!pass.modifiedAttributes.has(entityId)) {
|
|
100
|
+
pass.modifiedAttributes.set(entityId, new Map());
|
|
101
|
+
}
|
|
102
|
+
const attrMap = pass.modifiedAttributes.get(entityId);
|
|
103
|
+
const mc = gm.mapConversion;
|
|
104
|
+
let changed = false;
|
|
105
|
+
if (mc.eastings !== undefined) {
|
|
106
|
+
attrMap.set('Eastings', String(mc.eastings));
|
|
107
|
+
changed = true;
|
|
108
|
+
}
|
|
109
|
+
if (mc.northings !== undefined) {
|
|
110
|
+
attrMap.set('Northings', String(mc.northings));
|
|
111
|
+
changed = true;
|
|
112
|
+
}
|
|
113
|
+
if (mc.orthogonalHeight !== undefined) {
|
|
114
|
+
attrMap.set('OrthogonalHeight', String(mc.orthogonalHeight));
|
|
115
|
+
changed = true;
|
|
116
|
+
}
|
|
117
|
+
if (mc.xAxisAbscissa !== undefined) {
|
|
118
|
+
attrMap.set('XAxisAbscissa', String(mc.xAxisAbscissa));
|
|
119
|
+
changed = true;
|
|
120
|
+
}
|
|
121
|
+
if (mc.xAxisOrdinate !== undefined) {
|
|
122
|
+
attrMap.set('XAxisOrdinate', String(mc.xAxisOrdinate));
|
|
123
|
+
changed = true;
|
|
124
|
+
}
|
|
125
|
+
if (mc.scale !== undefined) {
|
|
126
|
+
attrMap.set('Scale', String(mc.scale));
|
|
127
|
+
changed = true;
|
|
128
|
+
}
|
|
129
|
+
if (changed) {
|
|
130
|
+
pass.modifiedEntities.add(entityId);
|
|
131
|
+
// Same as the IfcProjectedCRS branch above, effect gate included.
|
|
132
|
+
if (pass.hasEmittableHostBytes(entityId)) {
|
|
133
|
+
pass.inPlaceNominees.georeferencing.add(entityId);
|
|
134
|
+
if (ctx.deltaOnly)
|
|
135
|
+
pass.modifications.nominate(entityId, 'georeferencing');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// CREATE new georef entities when file has none
|
|
140
|
+
if (gm.projectedCRS && !existingCrsIds?.length) {
|
|
141
|
+
const crs = gm.projectedCRS;
|
|
142
|
+
const crsId = ctx.allocateExpressId();
|
|
143
|
+
// IfcProjectedCRS(Name, Description, GeodeticDatum, VerticalDatum, MapProjection, MapZone, MapUnit)
|
|
144
|
+
const name = crs.name ? `'${escapeStepString(String(crs.name))}'` : '$';
|
|
145
|
+
const desc = crs.description ? `'${escapeStepString(String(crs.description))}'` : '$';
|
|
146
|
+
const datum = crs.geodeticDatum ? `'${escapeStepString(String(crs.geodeticDatum))}'` : '$';
|
|
147
|
+
const vDatum = crs.verticalDatum ? `'${escapeStepString(String(crs.verticalDatum))}'` : '$';
|
|
148
|
+
const proj = crs.mapProjection ? `'${escapeStepString(String(crs.mapProjection))}'` : '$';
|
|
149
|
+
const zone = crs.mapZone ? `'${escapeStepString(String(crs.mapZone))}'` : '$';
|
|
150
|
+
const mapUnitRef = crs.mapUnit
|
|
151
|
+
? `#${resolveMapUnitReference(String(crs.mapUnit), pass.newGeorefLines, pass.effective, ctx)}`
|
|
152
|
+
: '$';
|
|
153
|
+
pass.newGeorefLines.push(`#${crsId}=IFCPROJECTEDCRS(${name},${desc},${datum},${vDatum},${proj},${zone},${mapUnitRef});`);
|
|
154
|
+
pass.newEntityCount++;
|
|
155
|
+
// Find IfcGeometricRepresentationContext as SourceCRS for MapConversion
|
|
156
|
+
const contextId = findPreferredGeometricRepresentationContextId(pass.effective, ctx);
|
|
157
|
+
if (contextId) {
|
|
158
|
+
const mc = gm.mapConversion || {};
|
|
159
|
+
const mcId = ctx.allocateExpressId();
|
|
160
|
+
const eastings = toStepReal(Number(mc.eastings) || 0);
|
|
161
|
+
const northings = toStepReal(Number(mc.northings) || 0);
|
|
162
|
+
const height = toStepReal(Number(mc.orthogonalHeight) || 0);
|
|
163
|
+
const abscissa = mc.xAxisAbscissa !== undefined ? toStepReal(Number(mc.xAxisAbscissa)) : '$';
|
|
164
|
+
const ordinate = mc.xAxisOrdinate !== undefined ? toStepReal(Number(mc.xAxisOrdinate)) : '$';
|
|
165
|
+
const scale = mc.scale !== undefined ? toStepReal(Number(mc.scale)) : '$';
|
|
166
|
+
// IfcMapConversion(SourceCRS, TargetCRS, Eastings, Northings, OrthogonalHeight, XAxisAbscissa, XAxisOrdinate, Scale)
|
|
167
|
+
pass.newGeorefLines.push(`#${mcId}=IFCMAPCONVERSION(#${contextId},#${crsId},${eastings},${northings},${height},${abscissa},${ordinate},${scale});`);
|
|
168
|
+
pass.newEntityCount++;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
reportMapConversionRefused(pass.warnings);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
else if (gm.mapConversion && !existingMcIds?.length && existingCrsIds?.length) {
|
|
175
|
+
// CRS exists but no MapConversion — create just the conversion
|
|
176
|
+
const contextId = findPreferredGeometricRepresentationContextId(pass.effective, ctx);
|
|
177
|
+
if (contextId) {
|
|
178
|
+
const mc = gm.mapConversion;
|
|
179
|
+
const mcId = ctx.allocateExpressId();
|
|
180
|
+
const eastings = toStepReal(Number(mc.eastings) || 0);
|
|
181
|
+
const northings = toStepReal(Number(mc.northings) || 0);
|
|
182
|
+
const height = toStepReal(Number(mc.orthogonalHeight) || 0);
|
|
183
|
+
const abscissa = mc.xAxisAbscissa !== undefined ? toStepReal(Number(mc.xAxisAbscissa)) : '$';
|
|
184
|
+
const ordinate = mc.xAxisOrdinate !== undefined ? toStepReal(Number(mc.xAxisOrdinate)) : '$';
|
|
185
|
+
const scale = mc.scale !== undefined ? toStepReal(Number(mc.scale)) : '$';
|
|
186
|
+
pass.newGeorefLines.push(`#${mcId}=IFCMAPCONVERSION(#${contextId},#${existingCrsIds[0]},${eastings},${northings},${height},${abscissa},${ordinate},${scale});`);
|
|
187
|
+
pass.newEntityCount++;
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
reportMapConversionRefused(pass.warnings);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
else if (gm.mapConversion && !existingMcIds?.length && !existingCrsIds?.length) {
|
|
194
|
+
// A map conversion was requested, but there is no IfcProjectedCRS to
|
|
195
|
+
// reference as TargetCRS: none was requested (the first branch above
|
|
196
|
+
// didn't fire) and none exists in the file. Both CREATE branches are
|
|
197
|
+
// skipped, so nothing is attempted — report the refusal so the
|
|
198
|
+
// caller isn't left with an empty stats.warnings and no hint (#2105).
|
|
199
|
+
reportMapConversionRefusedNoCrs(pass.warnings);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
export function resolveMapUnitReference(unitName, newGeorefLines, effective, ctx) {
|
|
203
|
+
const normalized = normalizeMapUnitName(unitName);
|
|
204
|
+
const existing = findLengthUnitReference(normalized, effective, ctx);
|
|
205
|
+
if (existing !== null) {
|
|
206
|
+
return existing;
|
|
207
|
+
}
|
|
208
|
+
if (normalized === 'METRE') {
|
|
209
|
+
const unitId = ctx.allocateExpressId();
|
|
210
|
+
newGeorefLines.push(`#${unitId}=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.);`);
|
|
211
|
+
return unitId;
|
|
212
|
+
}
|
|
213
|
+
if (normalized === 'FOOT' || normalized === 'US SURVEY FOOT') {
|
|
214
|
+
const dimId = ctx.allocateExpressId();
|
|
215
|
+
const siUnitId = ctx.allocateExpressId();
|
|
216
|
+
const measureId = ctx.allocateExpressId();
|
|
217
|
+
const convUnitId = ctx.allocateExpressId();
|
|
218
|
+
const factor = normalized === 'US SURVEY FOOT' ? 1200 / 3937 : 0.3048;
|
|
219
|
+
const name = normalized === 'US SURVEY FOOT' ? 'US SURVEY FOOT' : 'FOOT';
|
|
220
|
+
newGeorefLines.push(`#${dimId}=IFCDIMENSIONALEXPONENTS(1,0,0,0,0,0,0);`);
|
|
221
|
+
newGeorefLines.push(`#${siUnitId}=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.);`);
|
|
222
|
+
newGeorefLines.push(`#${measureId}=IFCMEASUREWITHUNIT(IFCLENGTHMEASURE(${toStepReal(factor)}),#${siUnitId});`);
|
|
223
|
+
newGeorefLines.push(`#${convUnitId}=IFCCONVERSIONBASEDUNIT(#${dimId},.LENGTHUNIT.,'${name}',#${measureId});`);
|
|
224
|
+
return convUnitId;
|
|
225
|
+
}
|
|
226
|
+
const fallbackId = ctx.allocateExpressId();
|
|
227
|
+
newGeorefLines.push(`#${fallbackId}=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.);`);
|
|
228
|
+
return fallbackId;
|
|
229
|
+
}
|
|
230
|
+
export function normalizeMapUnitName(unitName) {
|
|
231
|
+
const normalized = unitName.trim().toUpperCase().replace(/\s+/g, ' ');
|
|
232
|
+
if (normalized.includes('US SURVEY FOOT'))
|
|
233
|
+
return 'US SURVEY FOOT';
|
|
234
|
+
if (normalized.includes('METER') || normalized.includes('METRE'))
|
|
235
|
+
return 'METRE';
|
|
236
|
+
if (normalized.includes('FOOT') || normalized.includes('FEET'))
|
|
237
|
+
return 'FOOT';
|
|
238
|
+
return normalized;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* `effective` filters the candidates the same way the georef reads above do:
|
|
242
|
+
* returning a tombstoned unit id hands the caller a `#id` for a line the
|
|
243
|
+
* export never writes. Returning null instead makes `resolveMapUnitReference`
|
|
244
|
+
* synthesise a fresh unit, which is the outcome a deleted unit deserves.
|
|
245
|
+
*/
|
|
246
|
+
export function findLengthUnitReference(preferredUnitName, effective, ctx) {
|
|
247
|
+
if (!ctx.entityExtractor)
|
|
248
|
+
return null;
|
|
249
|
+
// Only source records carry the bytes `extractEntity` reads, so an
|
|
250
|
+
// overlay-created project is skipped rather than shadowing the file's own.
|
|
251
|
+
const projectId = (effective.byType.get('IFCPROJECT') ?? []).find((id) => ctx.dataStore.entityIndex.byId.has(id));
|
|
252
|
+
const projectRef = projectId !== undefined ? ctx.dataStore.entityIndex.byId.get(projectId) : undefined;
|
|
253
|
+
const project = projectRef ? ctx.entityExtractor.extractEntity(projectRef) : null;
|
|
254
|
+
const unitAssignmentId = project?.attributes?.[8];
|
|
255
|
+
if (typeof unitAssignmentId !== 'number' || effective.isDeleted(unitAssignmentId))
|
|
256
|
+
return null;
|
|
257
|
+
const unitAssignmentRef = ctx.dataStore.entityIndex.byId.get(unitAssignmentId);
|
|
258
|
+
const unitAssignment = unitAssignmentRef ? ctx.entityExtractor.extractEntity(unitAssignmentRef) : null;
|
|
259
|
+
const units = unitAssignment?.attributes?.[0];
|
|
260
|
+
if (!Array.isArray(units))
|
|
261
|
+
return null;
|
|
262
|
+
for (const unitId of units) {
|
|
263
|
+
if (typeof unitId !== 'number' || effective.isDeleted(unitId))
|
|
264
|
+
continue;
|
|
265
|
+
const unitRef = ctx.dataStore.entityIndex.byId.get(unitId);
|
|
266
|
+
const unit = unitRef ? ctx.entityExtractor.extractEntity(unitRef) : null;
|
|
267
|
+
if (!unit)
|
|
268
|
+
continue;
|
|
269
|
+
const typeName = unit.type.toUpperCase();
|
|
270
|
+
const attrs = unit.attributes ?? [];
|
|
271
|
+
const unitType = typeof attrs[1] === 'string' ? attrs[1].replace(/\./g, '').toUpperCase() : '';
|
|
272
|
+
if (unitType !== 'LENGTHUNIT')
|
|
273
|
+
continue;
|
|
274
|
+
if (typeName === 'IFCSIUNIT') {
|
|
275
|
+
const prefix = typeof attrs[2] === 'string' ? attrs[2].replace(/\./g, '').toUpperCase() : '';
|
|
276
|
+
const name = typeof attrs[3] === 'string' ? attrs[3].replace(/\./g, '').toUpperCase() : '';
|
|
277
|
+
const combined = prefix ? `${prefix}${name}` : name;
|
|
278
|
+
if (preferredUnitName === 'METRE' && (combined === 'METRE' || combined === 'METER')) {
|
|
279
|
+
return unitId;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if (typeName === 'IFCCONVERSIONBASEDUNIT') {
|
|
283
|
+
const name = typeof attrs[2] === 'string' ? normalizeMapUnitName(attrs[2]) : '';
|
|
284
|
+
if (name === preferredUnitName) {
|
|
285
|
+
return unitId;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Record that a requested IfcMapConversion could not be written. Emitting it
|
|
293
|
+
* anyway would leave `SourceCRS` pointing at nothing, so the refusal is the
|
|
294
|
+
* correct output — but the file alone cannot express it, which is why it goes
|
|
295
|
+
* back to the caller in `stats.warnings` as well as to the console (#2067).
|
|
296
|
+
*/
|
|
297
|
+
function reportMapConversionRefused(warnings) {
|
|
298
|
+
warnings.push(MAP_CONVERSION_WITHOUT_CONTEXT_WARNING);
|
|
299
|
+
console.warn(`[StepExporter] ${MAP_CONVERSION_WITHOUT_CONTEXT_WARNING}`);
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Record that a requested IfcMapConversion could not be written because
|
|
303
|
+
* there is no IfcProjectedCRS to attach it to — a different refusal from
|
|
304
|
+
* {@link reportMapConversionRefused}: "no CRS to attach it to" rather than
|
|
305
|
+
* "no context to reference" (#2105).
|
|
306
|
+
*/
|
|
307
|
+
function reportMapConversionRefusedNoCrs(warnings) {
|
|
308
|
+
warnings.push(MAP_CONVERSION_WITHOUT_CRS_WARNING);
|
|
309
|
+
console.warn(`[StepExporter] ${MAP_CONVERSION_WITHOUT_CRS_WARNING}`);
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* `effective` again: the id returned here becomes the new IfcMapConversion's
|
|
313
|
+
* SourceCRS, so a tombstoned context would leave the created line pointing at
|
|
314
|
+
* a record the export skips — a dangling reference and an invalid file.
|
|
315
|
+
*/
|
|
316
|
+
function findPreferredGeometricRepresentationContextId(effective, ctx) {
|
|
317
|
+
if (!ctx.entityExtractor)
|
|
318
|
+
return null;
|
|
319
|
+
const contextIds = (effective.byType.get('IFCGEOMETRICREPRESENTATIONCONTEXT') ?? [])
|
|
320
|
+
.filter((id) => ctx.dataStore.entityIndex.byId.has(id));
|
|
321
|
+
let first3dContext = null;
|
|
322
|
+
for (const contextId of contextIds) {
|
|
323
|
+
const contextRef = ctx.dataStore.entityIndex.byId.get(contextId);
|
|
324
|
+
const context = contextRef ? ctx.entityExtractor.extractEntity(contextRef) : null;
|
|
325
|
+
if (!context)
|
|
326
|
+
continue;
|
|
327
|
+
const attrs = context.attributes ?? [];
|
|
328
|
+
const contextType = typeof attrs[1] === 'string' ? attrs[1].trim().toUpperCase() : '';
|
|
329
|
+
const dimension = typeof attrs[2] === 'number' ? attrs[2] : null;
|
|
330
|
+
if (dimension === 3 && first3dContext === null) {
|
|
331
|
+
first3dContext = contextId;
|
|
332
|
+
}
|
|
333
|
+
if (contextType === 'MODEL' && dimension === 3) {
|
|
334
|
+
return contextId;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return first3dContext ?? contextIds[0] ?? null;
|
|
338
|
+
}
|
|
339
|
+
//# sourceMappingURL=step-georeferencing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-georeferencing.js","sourceRoot":"","sources":["../src/step-georeferencing.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAwB/D,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGvE;;;GAGG;AACH,MAAM,sCAAsC,GAC1C,iJAAiJ,CAAC;AAEpJ;;;;;;;GAOG;AACH,MAAM,kCAAkC,GACtC,8IAA8I,CAAC;AAuBjJ;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAC1C,IAAgB,EAChB,eAAkE,EAClE,GAAkB;IAElB,MAAM,EAAE,GAAG,eAAe,CAAC;IAC3B,sEAAsE;IACtE,wEAAwE;IACxE,6DAA6D;IAC7D,oEAAoE;IACpE,iEAAiE;IACjE,sEAAsE;IACtE,wEAAwE;IACxE,yCAAyC;IACzC,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACpE,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAEpE,kCAAkC;IAClC,IAAI,EAAE,CAAC,YAAY,IAAI,cAAc,EAAE,MAAM,EAAE,CAAC;QAC9C,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3C,IAAI,CAAC,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U,GAAG,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACjE,MAAM,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAClF,IAAI,CAAC,OAAO;YAAE,SAAS;QAEvB,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;QACvC,MAAM,WAAW,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtF,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAEjE,IAAI,SAAS,KAAK,CAAC,IAAI,cAAc,KAAK,IAAI,EAAE,CAAC;YAC/C,cAAc,GAAG,SAAS,CAAC;QAC7B,CAAC;QAED,IAAI,WAAW,KAAK,OAAO,IAAI,SAAS,KAAK,CAAC,EAAE,CAAC;YAC/C,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,cAAc,IAAI,UAAU,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The header/assembly tail of `StepExporter.export()` (#2475, the last seam
|
|
3
|
+
* this issue names): building the FILE_DESCRIPTION/HEADER text and turning
|
|
4
|
+
* the finished `ExportPass.entities` into the returned `StepExportResult`.
|
|
5
|
+
*
|
|
6
|
+
* Both functions here are pure — neither reads `this.dataStore`,
|
|
7
|
+
* `this.mutationView`, nor any of `ExportPass`'s three adversarial-review
|
|
8
|
+
* predicates (`isOmittedFromOutput`, `mayNameOmittedRefs`,
|
|
9
|
+
* `hasAnyUnreadableSourceRef`). Those stay in `step-exporter.ts`: their last
|
|
10
|
+
* reader is `writeOverlayCreatedEntities`, several statements before this
|
|
11
|
+
* tail begins, and nothing here reads them back. That is the same test
|
|
12
|
+
* `step-collection.ts` applied when it left them in place (#2475 collection
|
|
13
|
+
* step) — moving them here would relocate a dependency, not remove one.
|
|
14
|
+
*
|
|
15
|
+
* `buildStepHeader` is `pass.buildHeader`'s body, unchanged: `export()`
|
|
16
|
+
* still builds the closure (it needs to close over the per-call `options`
|
|
17
|
+
* and the two call sites still read `pass.buildHeader`), but the closure
|
|
18
|
+
* now just forwards here instead of carrying the logic itself.
|
|
19
|
+
*
|
|
20
|
+
* `assembleExportResult` is the true final phase from the original
|
|
21
|
+
* decomposition table (settle the ledger, build the header, assemble): it is
|
|
22
|
+
* NOT used by the earlier `deltaOnly`-empty-export early return, which
|
|
23
|
+
* hand-builds its own (shorter) `StepExportResult` because it skips
|
|
24
|
+
* `assembleStepBytes` entirely — see the comment at that call site in
|
|
25
|
+
* `step-exporter.ts`.
|
|
26
|
+
*/
|
|
27
|
+
import type { IfcSourceHeader } from '@ifc-lite/parser';
|
|
28
|
+
import type { ExportPass, StepExportOptions, StepExportResult } from './step-exporter.js';
|
|
29
|
+
/**
|
|
30
|
+
* Build the STEP HEADER section text. `modifications` is read last, at each
|
|
31
|
+
* call site, once the real count is known — see the two callers in
|
|
32
|
+
* `step-exporter.ts` (the `deltaOnly`-empty early return, and
|
|
33
|
+
* {@link assembleExportResult} below) — so the provenance item it appends
|
|
34
|
+
* reflects what this export actually wrote, not a guess made at setup time.
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildStepHeader(options: StepExportOptions, sourceHeader: IfcSourceHeader | undefined, schemaToken: string, modifications: number): string;
|
|
37
|
+
/**
|
|
38
|
+
* Settle the delta ledger, build the header against the settled count, and
|
|
39
|
+
* assemble the finished bytes. The header is built last so its provenance
|
|
40
|
+
* item reflects the real count — see {@link buildStepHeader}.
|
|
41
|
+
*/
|
|
42
|
+
export declare function assembleExportResult(pass: ExportPass): StepExportResult;
|
|
43
|
+
//# sourceMappingURL=step-header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-header.d.ts","sourceRoot":"","sources":["../src/step-header.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE1F;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,iBAAiB,EAC1B,YAAY,EAAE,eAAe,GAAG,SAAS,EACzC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,GACpB,MAAM,CA+BR;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,GAAG,gBAAgB,CAwBvE"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
import { generateHeader } from '@ifc-lite/parser';
|
|
5
|
+
import { assembleStepBytes } from './step-file-assembly.js';
|
|
6
|
+
/**
|
|
7
|
+
* Build the STEP HEADER section text. `modifications` is read last, at each
|
|
8
|
+
* call site, once the real count is known — see the two callers in
|
|
9
|
+
* `step-exporter.ts` (the `deltaOnly`-empty early return, and
|
|
10
|
+
* {@link assembleExportResult} below) — so the provenance item it appends
|
|
11
|
+
* reflects what this export actually wrote, not a guess made at setup time.
|
|
12
|
+
*/
|
|
13
|
+
export function buildStepHeader(options, sourceHeader, schemaToken, modifications) {
|
|
14
|
+
// FILE_DESCRIPTION items: an explicit option wins, else the source items
|
|
15
|
+
// verbatim, else the generic default.
|
|
16
|
+
const description = options.description !== undefined
|
|
17
|
+
? [options.description]
|
|
18
|
+
: sourceHeader && sourceHeader.description.length > 0
|
|
19
|
+
? [...sourceHeader.description]
|
|
20
|
+
: ['Exported from ifc-lite'];
|
|
21
|
+
// Honest provenance: never claim untouched source output. Append (never
|
|
22
|
+
// overwrite) one item when ifc-lite actually changed the file.
|
|
23
|
+
if (modifications > 0) {
|
|
24
|
+
description.push(`Re-exported by ifc-lite, ${modifications} modification${modifications === 1 ? '' : 's'}`);
|
|
25
|
+
}
|
|
26
|
+
return generateHeader({
|
|
27
|
+
schema: schemaToken,
|
|
28
|
+
description,
|
|
29
|
+
implementationLevel: sourceHeader?.implementationLevel,
|
|
30
|
+
author: options.author ?? sourceHeader?.author,
|
|
31
|
+
organization: options.organization ?? sourceHeader?.organization,
|
|
32
|
+
// preprocessor_version = the tool that WROTE this file (ifc-lite);
|
|
33
|
+
// originating_system keeps the source authoring tool so it isn't erased.
|
|
34
|
+
preprocessorVersion: options.application ?? 'ifc-lite',
|
|
35
|
+
originatingSystem: sourceHeader?.originatingSystem,
|
|
36
|
+
authorization: sourceHeader?.authorization,
|
|
37
|
+
application: options.application ?? 'ifc-lite',
|
|
38
|
+
filename: options.filename ?? 'export.ifc',
|
|
39
|
+
timeStamp: options.timeStamp,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Settle the delta ledger, build the header against the settled count, and
|
|
44
|
+
* assemble the finished bytes. The header is built last so its provenance
|
|
45
|
+
* item reflects the real count — see {@link buildStepHeader}.
|
|
46
|
+
*/
|
|
47
|
+
export function assembleExportResult(pass) {
|
|
48
|
+
// Settle the count against what the passes above actually wrote, and say
|
|
49
|
+
// out loud every KIND of edit a delta could not carry, per host. Silence
|
|
50
|
+
// was the other half of #2462: `deltaOnly` skips the source-iteration pass,
|
|
51
|
+
// so an in-place edit to a source entity is not in the file and never was —
|
|
52
|
+
// the header merely used to claim otherwise.
|
|
53
|
+
const { modifiedEntityCount, warnings: deltaWarnings } = pass.modifications.settle();
|
|
54
|
+
pass.warnings.push(...deltaWarnings);
|
|
55
|
+
// Assemble final file as Uint8Array chunks to avoid V8 string length limit.
|
|
56
|
+
// The header is built last so its provenance item reflects the real count.
|
|
57
|
+
const header = pass.buildHeader(pass.newEntityCount + modifiedEntityCount);
|
|
58
|
+
const content = assembleStepBytes(header, pass.entities);
|
|
59
|
+
return {
|
|
60
|
+
content,
|
|
61
|
+
stats: {
|
|
62
|
+
entityCount: pass.entities.length,
|
|
63
|
+
newEntityCount: pass.newEntityCount,
|
|
64
|
+
modifiedEntityCount,
|
|
65
|
+
fileSize: content.byteLength,
|
|
66
|
+
warnings: pass.warnings,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=step-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-header.js","sourceRoot":"","sources":["../src/step-header.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA8B/D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,OAA0B,EAC1B,YAAyC,EACzC,WAAmB,EACnB,aAAqB;IAErB,yEAAyE;IACzE,sCAAsC;IACtC,MAAM,WAAW,GACf,OAAO,CAAC,WAAW,KAAK,SAAS;QAC/B,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;QACvB,CAAC,CAAC,YAAY,IAAI,YAAY,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC;YACnD,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,WAAW,CAAC;YAC/B,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC;IACnC,wEAAwE;IACxE,+DAA+D;IAC/D,IAAI,aAAa,GAAG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AO;QACL,OAAO;QACP,KAAK,EAAE;YACL,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM;YACjC,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,mBAAmB;YACnB,QAAQ,EAAE,OAAO,CAAC,UAAU;YAC5B,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which ids a STEP export may still NAME, once it has decided which ids it is
|
|
3
|
+
* writing.
|
|
4
|
+
*
|
|
5
|
+
* Split out of `step-exporter.ts` for #2475, verbatim apart from the two
|
|
6
|
+
* changes noted below. It runs immediately after `collectModifications` and
|
|
7
|
+
* before the output passes, and that position is not incidental: everything
|
|
8
|
+
* here reads what the collection phase produced -- `pass.modifiedEntities`,
|
|
9
|
+
* `pass.newGeorefLines`, `pass.allowedEntityIds`, `pass.overlayActive` -- and
|
|
10
|
+
* everything the output passes do with omitted references reads what this
|
|
11
|
+
* returns. Calling it earlier gives answers computed from an unpopulated pass.
|
|
12
|
+
*
|
|
13
|
+
* Why not in `step-collection.ts`: that module produces the values these
|
|
14
|
+
* predicates consume and never reads them back, so putting them there would
|
|
15
|
+
* relocate a dependency rather than remove one. That argument was always about
|
|
16
|
+
* `step-collection.ts` specifically, not about these predicates being welded
|
|
17
|
+
* to `export()`.
|
|
18
|
+
*
|
|
19
|
+
* TWO CHANGES FROM THE ORIGINAL, both forced by it becoming a function:
|
|
20
|
+
*
|
|
21
|
+
* 1. The deltaOnly empty short-circuit used to `return` out of `export()`.
|
|
22
|
+
* A free function cannot, so it returns a tagged `'short-circuit'` result
|
|
23
|
+
* the caller returns instead. That rewrite is safe by measurement, not by
|
|
24
|
+
* argument: disabling the branch entirely leaves the suite green and the
|
|
25
|
+
* emitted bytes and stats identical, because for a model with no edits the
|
|
26
|
+
* ordinary path arrives at the same place. See
|
|
27
|
+
* `delta-empty-shortcircuit.test.ts`, which pins the contract and says
|
|
28
|
+
* outright that it does not pin the branch.
|
|
29
|
+
* 2. `this.mutationView` arrives as a parameter.
|
|
30
|
+
*/
|
|
31
|
+
import type { MutablePropertyView } from '@ifc-lite/mutations';
|
|
32
|
+
import type { ExportPass, StepExportOptions, StepExportResult } from './step-export-types.js';
|
|
33
|
+
/**
|
|
34
|
+
* Either the export is already over, or here are the two things the output
|
|
35
|
+
* passes need from it.
|
|
36
|
+
*
|
|
37
|
+
* A tagged union rather than an optional field, so a caller cannot read
|
|
38
|
+
* `isOmittedFromOutput` off a short-circuited result and get `undefined`
|
|
39
|
+
* without the compiler saying so.
|
|
40
|
+
*/
|
|
41
|
+
export type OmissionEvaluation = {
|
|
42
|
+
readonly kind: 'short-circuit';
|
|
43
|
+
readonly result: StepExportResult;
|
|
44
|
+
} | {
|
|
45
|
+
readonly kind: 'continue';
|
|
46
|
+
readonly isOmittedFromOutput: (id: number) => boolean;
|
|
47
|
+
/** A boolean, not a predicate: the precondition both filter sites gate on. */
|
|
48
|
+
readonly mayNameOmittedRefs: boolean;
|
|
49
|
+
};
|
|
50
|
+
export declare function evaluateOmissionPredicates(pass: ExportPass, options: StepExportOptions, applyMutations: boolean, excludeGeometry: boolean, mutationView: MutablePropertyView | null): OmissionEvaluation;
|
|
51
|
+
//# sourceMappingURL=step-omission-predicates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-omission-predicates.d.ts","sourceRoot":"","sources":["../src/step-omission-predicates.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE9F;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAA;CAAE,GACrE;IACE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IACtD,8EAA8E;IAC9E,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;CACtC,CAAC;AAEN,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,iBAAiB,EAC1B,cAAc,EAAE,OAAO,EACvB,eAAe,EAAE,OAAO,EACxB,YAAY,EAAE,mBAAmB,GAAG,IAAI,GACvC,kBAAkB,CA+QpB"}
|