@ifc-lite/create 3.2.0 → 4.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.
Files changed (149) hide show
  1. package/README.md +9 -0
  2. package/dist/in-store/auto-space-detect.d.ts +1 -1
  3. package/dist/in-store/auto-space-detect.js +1 -1
  4. package/dist/in-store/beam.d.ts +10 -1
  5. package/dist/in-store/beam.d.ts.map +1 -1
  6. package/dist/in-store/beam.js +14 -25
  7. package/dist/in-store/beam.js.map +1 -1
  8. package/dist/in-store/column.d.ts +10 -1
  9. package/dist/in-store/column.d.ts.map +1 -1
  10. package/dist/in-store/column.js +23 -22
  11. package/dist/in-store/column.js.map +1 -1
  12. package/dist/in-store/copy-frame.d.ts +52 -0
  13. package/dist/in-store/copy-frame.d.ts.map +1 -0
  14. package/dist/in-store/copy-frame.js +99 -0
  15. package/dist/in-store/copy-frame.js.map +1 -0
  16. package/dist/in-store/copy-product.d.ts +96 -0
  17. package/dist/in-store/copy-product.d.ts.map +1 -0
  18. package/dist/in-store/copy-product.js +318 -0
  19. package/dist/in-store/copy-product.js.map +1 -0
  20. package/dist/in-store/curtain-wall.d.ts +87 -0
  21. package/dist/in-store/curtain-wall.d.ts.map +1 -0
  22. package/dist/in-store/curtain-wall.js +237 -0
  23. package/dist/in-store/curtain-wall.js.map +1 -0
  24. package/dist/in-store/extract-grids.d.ts +46 -0
  25. package/dist/in-store/extract-grids.d.ts.map +1 -0
  26. package/dist/in-store/extract-grids.js +211 -0
  27. package/dist/in-store/extract-grids.js.map +1 -0
  28. package/dist/in-store/extract-walls.d.ts +12 -23
  29. package/dist/in-store/extract-walls.d.ts.map +1 -1
  30. package/dist/in-store/extract-walls.js +6 -69
  31. package/dist/in-store/extract-walls.js.map +1 -1
  32. package/dist/in-store/generate-spaces.d.ts +1 -1
  33. package/dist/in-store/grid.d.ts +118 -0
  34. package/dist/in-store/grid.d.ts.map +1 -0
  35. package/dist/in-store/grid.js +194 -0
  36. package/dist/in-store/grid.js.map +1 -0
  37. package/dist/in-store/host-geometry-frame.d.ts +44 -0
  38. package/dist/in-store/host-geometry-frame.d.ts.map +1 -0
  39. package/dist/in-store/host-geometry-frame.js +146 -0
  40. package/dist/in-store/host-geometry-frame.js.map +1 -0
  41. package/dist/in-store/hosted-element-edit.d.ts +29 -0
  42. package/dist/in-store/hosted-element-edit.d.ts.map +1 -0
  43. package/dist/in-store/hosted-element-edit.js +120 -0
  44. package/dist/in-store/hosted-element-edit.js.map +1 -0
  45. package/dist/in-store/hosted-element.d.ts +41 -0
  46. package/dist/in-store/hosted-element.d.ts.map +1 -0
  47. package/dist/in-store/hosted-element.js +124 -0
  48. package/dist/in-store/hosted-element.js.map +1 -0
  49. package/dist/in-store/hosted-fill-read.d.ts +56 -0
  50. package/dist/in-store/hosted-fill-read.d.ts.map +1 -0
  51. package/dist/in-store/hosted-fill-read.js +197 -0
  52. package/dist/in-store/hosted-fill-read.js.map +1 -0
  53. package/dist/in-store/hosted-global-id.d.ts +8 -0
  54. package/dist/in-store/hosted-global-id.d.ts.map +1 -0
  55. package/dist/in-store/hosted-global-id.js +53 -0
  56. package/dist/in-store/hosted-global-id.js.map +1 -0
  57. package/dist/in-store/hosted-placement-edit.d.ts +30 -0
  58. package/dist/in-store/hosted-placement-edit.d.ts.map +1 -0
  59. package/dist/in-store/hosted-placement-edit.js +123 -0
  60. package/dist/in-store/hosted-placement-edit.js.map +1 -0
  61. package/dist/in-store/hosted-scale-chain.d.ts +12 -0
  62. package/dist/in-store/hosted-scale-chain.d.ts.map +1 -0
  63. package/dist/in-store/hosted-scale-chain.js +74 -0
  64. package/dist/in-store/hosted-scale-chain.js.map +1 -0
  65. package/dist/in-store/hosted-shape-edit.d.ts +9 -0
  66. package/dist/in-store/hosted-shape-edit.d.ts.map +1 -0
  67. package/dist/in-store/hosted-shape-edit.js +79 -0
  68. package/dist/in-store/hosted-shape-edit.js.map +1 -0
  69. package/dist/in-store/index.d.ts +59 -0
  70. package/dist/in-store/index.d.ts.map +1 -0
  71. package/dist/in-store/index.js +64 -0
  72. package/dist/in-store/index.js.map +1 -0
  73. package/dist/in-store/member.d.ts +8 -2
  74. package/dist/in-store/member.d.ts.map +1 -1
  75. package/dist/in-store/member.js +12 -14
  76. package/dist/in-store/member.js.map +1 -1
  77. package/dist/in-store/placement-frame.d.ts +9 -4
  78. package/dist/in-store/placement-frame.d.ts.map +1 -1
  79. package/dist/in-store/placement-frame.js +20 -35
  80. package/dist/in-store/placement-frame.js.map +1 -1
  81. package/dist/in-store/profile.d.ts +141 -0
  82. package/dist/in-store/profile.d.ts.map +1 -0
  83. package/dist/in-store/profile.js +174 -0
  84. package/dist/in-store/profile.js.map +1 -0
  85. package/dist/in-store/railing.d.ts +65 -0
  86. package/dist/in-store/railing.d.ts.map +1 -0
  87. package/dist/in-store/railing.js +112 -0
  88. package/dist/in-store/railing.js.map +1 -0
  89. package/dist/in-store/rel-connects-path.d.ts +43 -0
  90. package/dist/in-store/rel-connects-path.d.ts.map +1 -0
  91. package/dist/in-store/rel-connects-path.js +65 -0
  92. package/dist/in-store/rel-connects-path.js.map +1 -0
  93. package/dist/in-store/resolve-host.d.ts +12 -1
  94. package/dist/in-store/resolve-host.d.ts.map +1 -1
  95. package/dist/in-store/resolve-host.js +169 -85
  96. package/dist/in-store/resolve-host.js.map +1 -1
  97. package/dist/in-store/resolve-source.d.ts.map +1 -1
  98. package/dist/in-store/resolve-source.js +39 -59
  99. package/dist/in-store/resolve-source.js.map +1 -1
  100. package/dist/in-store/schema-attributes.d.ts +5 -0
  101. package/dist/in-store/schema-attributes.d.ts.map +1 -1
  102. package/dist/in-store/schema-attributes.js +9 -2
  103. package/dist/in-store/schema-attributes.js.map +1 -1
  104. package/dist/in-store/space-footprints.d.ts +55 -0
  105. package/dist/in-store/space-footprints.d.ts.map +1 -0
  106. package/dist/in-store/space-footprints.js +260 -0
  107. package/dist/in-store/space-footprints.js.map +1 -0
  108. package/dist/in-store/space.d.ts.map +1 -1
  109. package/dist/in-store/space.js +15 -3
  110. package/dist/in-store/space.js.map +1 -1
  111. package/dist/in-store/spatial-children.d.ts +1 -1
  112. package/dist/in-store/spatial-children.js +1 -1
  113. package/dist/in-store/stair-edit.d.ts +24 -0
  114. package/dist/in-store/stair-edit.d.ts.map +1 -0
  115. package/dist/in-store/stair-edit.js +190 -0
  116. package/dist/in-store/stair-edit.js.map +1 -0
  117. package/dist/in-store/stair.d.ts +58 -0
  118. package/dist/in-store/stair.d.ts.map +1 -0
  119. package/dist/in-store/stair.js +156 -0
  120. package/dist/in-store/stair.js.map +1 -0
  121. package/dist/in-store/wall-join-apply.d.ts +74 -0
  122. package/dist/in-store/wall-join-apply.d.ts.map +1 -0
  123. package/dist/in-store/wall-join-apply.js +137 -0
  124. package/dist/in-store/wall-join-apply.js.map +1 -0
  125. package/dist/in-store/wall-join-edit.d.ts +70 -0
  126. package/dist/in-store/wall-join-edit.d.ts.map +1 -0
  127. package/dist/in-store/wall-join-edit.js +217 -0
  128. package/dist/in-store/wall-join-edit.js.map +1 -0
  129. package/dist/in-store/wall-join-read.d.ts +60 -0
  130. package/dist/in-store/wall-join-read.d.ts.map +1 -0
  131. package/dist/in-store/wall-join-read.js +230 -0
  132. package/dist/in-store/wall-join-read.js.map +1 -0
  133. package/dist/in-store/wall-join.d.ts +122 -0
  134. package/dist/in-store/wall-join.d.ts.map +1 -0
  135. package/dist/in-store/wall-join.js +231 -0
  136. package/dist/in-store/wall-join.js.map +1 -0
  137. package/dist/in-store/wall-opening-fit.d.ts +11 -0
  138. package/dist/in-store/wall-opening-fit.d.ts.map +1 -0
  139. package/dist/in-store/wall-opening-fit.js +27 -0
  140. package/dist/in-store/wall-opening-fit.js.map +1 -0
  141. package/dist/in-store/wall.d.ts +32 -0
  142. package/dist/in-store/wall.d.ts.map +1 -1
  143. package/dist/in-store/wall.js +77 -13
  144. package/dist/in-store/wall.js.map +1 -1
  145. package/dist/index.d.ts +1 -38
  146. package/dist/index.d.ts.map +1 -1
  147. package/dist/index.js +2 -40
  148. package/dist/index.js.map +1 -1
  149. package/package.json +6 -6
@@ -0,0 +1,190 @@
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 { AnchorEntityReader } from './resolve-anchor.js';
5
+ import { axis3d, contextDimension, pointOf, refId } from './host-geometry-frame.js';
6
+ import { safeLengthUnitScale } from './length-unit-scale.js';
7
+ import { toNativeLength } from './anchor.js';
8
+ import { assertStairParams, emitStairFlightBody, stairFlightOutline } from './stair.js';
9
+ const close = (a, b) => Math.abs(a - b) <= 1e-7 * Math.max(1, Math.abs(a), Math.abs(b));
10
+ const vectorIs = (a, b) => a.every((v, i) => close(v, b[i]));
11
+ const ref = (id) => `#${id}`;
12
+ // schemaAttributes emits explicit REAL wrappers; parsed source is numeric.
13
+ function number(value) {
14
+ const raw = typeof value === 'object' && value !== null && 'real' in value ? value.real : value;
15
+ return typeof raw === 'number' && Number.isFinite(raw) ? raw : null;
16
+ }
17
+ function read(store, reader, id) {
18
+ if (!['IFC2X3', 'IFC4', 'IFC4X3'].includes(store.schemaVersion ?? 'IFC4'))
19
+ return null;
20
+ const selected = reader.entity(id);
21
+ if (!selected || !['IFCSTAIR', 'IFCSTAIRFLIGHT'].includes(selected.type.toUpperCase()))
22
+ return null;
23
+ const parents = [];
24
+ const aggregateCounts = new Map();
25
+ for (const relId of reader.ids('IFCRELAGGREGATES')) {
26
+ const rel = reader.entity(relId);
27
+ const parentId = rel ? refId(rel.attributes[4]) : null;
28
+ const members = rel?.attributes[5];
29
+ if (parentId !== null)
30
+ aggregateCounts.set(parentId, (aggregateCounts.get(parentId) ?? 0) + 1);
31
+ if (!Array.isArray(members))
32
+ continue;
33
+ if (parentId !== id && !members.some(v => refId(v) === id))
34
+ continue;
35
+ if (members.length !== 1 || parentId === null)
36
+ return null;
37
+ const flightId = refId(members[0]);
38
+ if (flightId === null || reader.entity(parentId)?.type.toUpperCase() !== 'IFCSTAIR'
39
+ || reader.entity(flightId)?.type.toUpperCase() !== 'IFCSTAIRFLIGHT')
40
+ return null;
41
+ parents.push({ stairId: parentId, flightId });
42
+ }
43
+ if (parents.length !== 1)
44
+ return null;
45
+ const { stairId, flightId } = parents[0];
46
+ if (aggregateCounts.get(stairId) !== 1)
47
+ return null;
48
+ const stair = reader.entity(stairId), flight = reader.entity(flightId);
49
+ // The parent must have no competing body; both placements must be rigid.
50
+ if (stair.attributes[6] !== null && stair.attributes[6] !== undefined)
51
+ return null;
52
+ for (const product of [stair, flight]) {
53
+ const placementId = refId(product.attributes[5]);
54
+ const placement = placementId === null ? null : reader.entity(placementId);
55
+ const axisId = placement ? refId(placement.attributes[1]) : null;
56
+ if (placement?.type.toUpperCase() !== 'IFCLOCALPLACEMENT' || axisId === null || !axis3d(reader, axisId))
57
+ return null;
58
+ }
59
+ const flightPlacement = reader.entity(refId(flight.attributes[5]));
60
+ if (refId(flightPlacement.attributes[0]) !== refId(stair.attributes[5]))
61
+ return null;
62
+ const attribute = (name) => flight.attributes[flight.names.indexOf(name)];
63
+ const n = number(attribute(store.schemaVersion === 'IFC2X3' ? 'NumberOfRiser' : 'NumberOfRisers'));
64
+ const r = number(attribute('RiserHeight')), t = number(attribute('TreadLength'));
65
+ if (typeof n !== 'number' || !Number.isInteger(n) || n < 1 || n > 4998 || attribute('NumberOfTreads') !== n
66
+ || typeof r !== 'number' || !Number.isFinite(r) || r <= 0
67
+ || typeof t !== 'number' || !Number.isFinite(t) || t <= 0)
68
+ return null;
69
+ const shapeId = refId(flight.attributes[6]), shape = shapeId === null ? null : reader.entity(shapeId);
70
+ const reps = shape?.attributes[2];
71
+ if (shape?.type.toUpperCase() !== 'IFCPRODUCTDEFINITIONSHAPE' || !Array.isArray(reps) || reps.length !== 1)
72
+ return null;
73
+ const repId = refId(reps[0]), rep = repId === null ? null : reader.entity(repId);
74
+ const contextId = rep ? refId(rep.attributes[0]) : null;
75
+ const items = rep?.attributes[3];
76
+ if (rep?.type.toUpperCase() !== 'IFCSHAPEREPRESENTATION' || rep.attributes[1] !== 'Body'
77
+ || rep.attributes[2] !== 'SweptSolid' || contextId === null || contextDimension(reader, contextId) !== 3
78
+ || !Array.isArray(items) || items.length !== 1)
79
+ return null;
80
+ const solidId = refId(items[0]), solid = solidId === null ? null : reader.entity(solidId);
81
+ if (solid?.type.toUpperCase() !== 'IFCEXTRUDEDAREASOLID')
82
+ return null;
83
+ const width = number(solid.attributes[3]);
84
+ if (typeof width !== 'number' || !Number.isFinite(width) || width <= 0)
85
+ return null;
86
+ const frame = axis3d(reader, solid.attributes[1]);
87
+ const extrusion = pointOf(reader, solid.attributes[2], 'IFCDIRECTION');
88
+ if (!frame || !vectorIs(frame.o, [0, width, 0]) || !vectorIs(frame.x, [1, 0, 0])
89
+ || !vectorIs(frame.y, [0, 0, 1]) || !vectorIs(frame.z, [0, -1, 0])
90
+ || !extrusion || !vectorIs(extrusion, [0, 0, 1]))
91
+ return null;
92
+ const profileId = refId(solid.attributes[0]), profile = profileId === null ? null : reader.entity(profileId);
93
+ if (profile?.type.toUpperCase() !== 'IFCARBITRARYCLOSEDPROFILEDEF' || profile.attributes[0] !== '.AREA.'
94
+ || (profile.attributes[1] !== null && profile.attributes[1] !== undefined && typeof profile.attributes[1] !== 'string'))
95
+ return null;
96
+ const curveId = refId(profile.attributes[2]), curve = curveId === null ? null : reader.entity(curveId);
97
+ const refs = curve?.attributes[0];
98
+ if (curve?.type.toUpperCase() !== 'IFCPOLYLINE' || !Array.isArray(refs)
99
+ || (refs.length !== 2 * n + 3 && refs.length !== 2 * n + 4))
100
+ return null;
101
+ const points = refs.map(v => pointOf(reader, v, 'IFCCARTESIANPOINT', 2));
102
+ if (points.some(p => p === null))
103
+ return null;
104
+ const p = points;
105
+ // Only the exact builder outline is editable. The pitch underside encodes
106
+ // waist thickness geometrically; optional native stair attributes do not.
107
+ const waist = refs.length === 2 * n + 4 ? (n * r - p[1][1]) * t / Math.hypot(r, t) : undefined;
108
+ if (waist !== undefined && (!Number.isFinite(waist) || waist <= 0))
109
+ return null;
110
+ const outline = stairFlightOutline(n, r, t, waist);
111
+ const closed = [...outline, outline[0]];
112
+ if (p.length !== closed.length || p.some((v, i) => !close(v[0], closed[i][0]) || !close(v[1], closed[i][1])))
113
+ return null;
114
+ const scale = safeLengthUnitScale(store.source, store.entityIndex, 'readStairDimensions');
115
+ if (scale === null)
116
+ return null;
117
+ const dimensions = {
118
+ stairId, flightId, NumberOfRisers: n, Width: width * scale,
119
+ RiserHeight: r * scale, TreadLength: t * scale,
120
+ ...(waist === undefined ? {} : { WaistThickness: waist * scale }),
121
+ };
122
+ return { dimensions, scale, flight, shape, rep, solidId: solidId, profileId: profileId, profile };
123
+ }
124
+ /** Parent and flight resolve to the same strict, single-flight dimensions. */
125
+ export function readStairDimensions(store, id, view) {
126
+ return read(store, new AnchorEntityReader(store, view), id)?.dimensions ?? null;
127
+ }
128
+ /** Rebuild only the occurrence's canonical stepped body. Placements, the
129
+ * first-riser foot, identities, type/style leaves and source bodies stay held.
130
+ * RiserHeight changes the total rise; TreadLength changes the total run.
131
+ * Atomic refusal for unsupported graphs or dimensions, including late errors. */
132
+ export function editStairDimensionsInStore(store, editor, id, patch) {
133
+ return editor.runAtomic(draft => {
134
+ const reader = new AnchorEntityReader(store, draft.getMutationView());
135
+ const current = read(store, reader, id);
136
+ if (!current)
137
+ throw new Error(`The stair #${id} is not a supported single stepped flight`);
138
+ const fields = ['Width', 'RiserHeight', 'TreadLength', 'WaistThickness'];
139
+ for (const [name, value] of Object.entries(patch)) {
140
+ if (!fields.some(field => field === name))
141
+ throw new Error(`Unsupported stair dimension ${name}`);
142
+ if (value !== undefined && (typeof value !== 'number' || !Number.isFinite(value) || value <= 0)) {
143
+ throw new Error(`${name} must be a finite positive number`);
144
+ }
145
+ }
146
+ const next = { ...current.dimensions };
147
+ for (const field of fields)
148
+ if (patch[field] !== undefined)
149
+ next[field] = patch[field];
150
+ assertStairParams({ ...next, Position: [0, 0, 0] }, 'editStairDimensionsInStore');
151
+ const native = (metres) => toNativeLength({ lengthUnitScale: current.scale }, metres);
152
+ const body = emitStairFlightBody(draft, next.NumberOfRisers, native(next.RiserHeight), native(next.TreadLength), native(next.Width), next.WaistThickness === undefined ? undefined : native(next.WaistThickness));
153
+ // Clone style attachments, retaining their shared style leaves; never
154
+ // repoint an attachment that may also style a different occurrence.
155
+ for (const styleId of reader.ids('IFCSTYLEDITEM')) {
156
+ const style = reader.entity(styleId);
157
+ const item = refId(style.attributes[0]);
158
+ const target = item === current.solidId ? body.solidId : item === current.profileId ? body.profileId : null;
159
+ if (target === null)
160
+ continue;
161
+ const styles = style.attributes[1];
162
+ if (!Array.isArray(styles) || styles.length === 0 || styles.some(v => refId(v) === null))
163
+ throw new Error('Unreadable stair style attachment');
164
+ const name = style.attributes[2];
165
+ if (name !== null && name !== undefined && typeof name !== 'string')
166
+ throw new Error('Unreadable stair style name');
167
+ draft.addEntity('IfcStyledItem', [ref(target), styles.map(v => ref(refId(v))), name ?? null]);
168
+ }
169
+ draft.setPositionalAttribute(body.profileId, 1, current.profile.attributes[1]);
170
+ const rep = draft.addEntity('IfcShapeRepresentation', [
171
+ ref(refId(current.rep.attributes[0])), current.rep.attributes[1],
172
+ current.rep.attributes[2], [ref(body.solidId)],
173
+ ]).expressId;
174
+ const labels = current.shape.attributes.slice(0, 2).map(v => {
175
+ if (v !== null && v !== undefined && typeof v !== 'string')
176
+ throw new Error('Unreadable stair shape label');
177
+ return v ?? null;
178
+ });
179
+ const shape = draft.addEntity('IfcProductDefinitionShape', [...labels, [ref(rep)]]).expressId;
180
+ draft.setPositionalAttribute(next.flightId, 6, ref(shape));
181
+ for (const name of ['RiserHeight', 'TreadLength']) {
182
+ draft.setPositionalAttribute(next.flightId, current.flight.names.indexOf(name), { real: native(next[name]) });
183
+ }
184
+ const updated = readStairDimensions(store, next.flightId, draft.getMutationView());
185
+ if (!updated)
186
+ throw new Error('The stair edit cannot reproduce its validated flight; all writes were rolled back');
187
+ return updated;
188
+ });
189
+ }
190
+ //# sourceMappingURL=stair-edit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stair-edit.js","sourceRoot":"","sources":["../../src/in-store/stair-edit.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAM/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,KAAK,EAAa,MAAM,0BAA0B,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAgBxF,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACxG,MAAM,QAAQ,GAAG,CAAC,CAAO,EAAE,CAAO,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzE,MAAM,GAAG,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;AACrC,2EAA2E;AAC3E,SAAS,MAAM,CAAC,KAAc;IAC5B,MAAM,GAAG,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CA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AAC,CAAC;QACH,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,2BAA2B,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC9F,KAAK,CAAC,sBAAsB,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QAC3D,KAAK,MAAM,IAAI,IAAI,CAAC,aAAa,EAAE,aAAa,CAAU,EAAE,CAAC;YAC3D,KAAK,CAAC,sBAAsB,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;QAChH,CAAC;QACD,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,eAAe,EAAE,CAAC,CAAC;QACnF,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,mFAAmF,CAAC,CAAC;QACnH,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,58 @@
1
+ import type { StoreEditor } from '@ifc-lite/mutations';
2
+ import { type SpatialAnchor } from './anchor.js';
3
+ export interface StairInStoreParams {
4
+ /** Foot of the first riser, storey-local (metres). */
5
+ Position: [number, number, number];
6
+ /** Run direction in the XY plane, radians (0 = +X). Default 0. */
7
+ Direction?: number;
8
+ /** Number of risers (a positive integer). */
9
+ NumberOfRisers: number;
10
+ /** Riser height (metres). */
11
+ RiserHeight: number;
12
+ /** Tread length / going (metres). */
13
+ TreadLength: number;
14
+ /** Clear width across the run (metres). */
15
+ Width: number;
16
+ /**
17
+ * Waist thickness measured perpendicular to the pitch line (metres). When
18
+ * set the flight's underside follows the pitch; omitted, the flight is solid
19
+ * down to its base. Must leave material under the top tread.
20
+ */
21
+ WaistThickness?: number;
22
+ /** IfcStair PredefinedType / ShapeType. Default `STRAIGHT_RUN_STAIR`. */
23
+ PredefinedType?: string;
24
+ Name?: string;
25
+ Description?: string;
26
+ ObjectType?: string;
27
+ Tag?: string;
28
+ /** Explicit GlobalId for the IfcStair (22-char IFC GUID); generated when omitted. */
29
+ GlobalId?: string;
30
+ /** Explicit GlobalId for the IfcStairFlight; generated when omitted. */
31
+ FlightGlobalId?: string;
32
+ }
33
+ export interface StairBuildResult {
34
+ stairId: number;
35
+ flightId: number;
36
+ placementId: number;
37
+ flightPlacementId: number;
38
+ profileId: number;
39
+ solidId: number;
40
+ shapeRepId: number;
41
+ productShapeId: number;
42
+ relAggregatesId: number;
43
+ relContainedId: number;
44
+ }
45
+ /**
46
+ * The flight's side outline in (run, rise) coordinates, native units: the
47
+ * stepped top, then the underside. Counter-clockwise.
48
+ */
49
+ export declare function stairFlightOutline(risers: number, riser: number, tread: number, waist?: number): Array<[number, number]>;
50
+ /** Package-private validation shared by creation and occurrence edits. */
51
+ export declare function assertStairParams(params: StairInStoreParams, op: string): void;
52
+ export declare function addStairToStore(editor: StoreEditor, anchor: SpatialAnchor, params: StairInStoreParams): StairBuildResult;
53
+ /** The canonical stepped solid, in native units; package-private. */
54
+ export declare function emitStairFlightBody(editor: StoreEditor, risers: number, riser: number, tread: number, width: number, waist?: number): {
55
+ profileId: number;
56
+ solidId: number;
57
+ };
58
+ //# sourceMappingURL=stair.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stair.d.ts","sourceRoot":"","sources":["../../src/in-store/stair.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAkC,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAcjF,MAAM,WAAW,kBAAkB;IACjC,sDAAsD;IACtD,QAAQ,EAAE,CAAC,MAAM,E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MAAM,GAAG,IAAI,CAmB9E;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,kBAAkB,GACzB,gBAAgB,CAoFlB;AAED,qEAAqE;AACrE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;;;EAgBnI"}
@@ -0,0 +1,156 @@
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
+ /**
5
+ * Anchored builder for a straight-run stair (#6232): an IfcStair contained in
6
+ * the storey, aggregating one IfcStairFlight that carries the body.
7
+ *
8
+ * Same footprint as `IfcCreator.addIfcStair` (`Position` is the foot of the
9
+ * first riser, the run goes along local +X rotated by `Direction`, the width
10
+ * spans local +Y, step i covers x in [i·T, (i+1)·T] and rises to (i+1)·R), but
11
+ * the body is one extruded stepped profile instead of one box per riser: a
12
+ * single IfcArbitraryClosedProfileDef in the stair's XZ plane, extruded across
13
+ * the width. With `WaistThickness` the underside follows the pitch line (a
14
+ * cast-in-place flight); without it the flight is solid down to its base, the
15
+ * volume IfcCreator's stacked treads enclose.
16
+ *
17
+ * The IfcStair itself has no representation: its geometry is its flight's,
18
+ * which is how IFC4 decomposes a stair (IfcRelAggregates, stair -> flight).
19
+ * The flight's placement is relative to the stair's, so moving the stair
20
+ * moves the flight.
21
+ *
22
+ * Schema gating (D2): attributes are laid out from the target schema's
23
+ * registry, so IFC2X3 gets `IfcStair.ShapeType` and
24
+ * `IfcStairFlight.NumberOfRiser` (its spelling) with no flight PredefinedType,
25
+ * IFC4/IFC4X3 get `PredefinedType`s, and IFC5 is refused.
26
+ */
27
+ import { generateIfcGuid } from '@ifc-lite/encoding';
28
+ import { assertFinitePoint3 } from '../ifc-creator-math.js';
29
+ import { toNativeLength, toNativePoint3 } from './anchor.js';
30
+ import { assertPositiveFinite, emitBodyRepresentation, emitLocalPlacement, emitPolygonProfile, emitRelContainedInSpatialStructure, ownerHistoryRef, productGuid, } from './_emit-helpers.js';
31
+ import { schemaAttributes, schemaRegistry } from './schema-attributes.js';
32
+ /**
33
+ * The flight's side outline in (run, rise) coordinates, native units: the
34
+ * stepped top, then the underside. Counter-clockwise.
35
+ */
36
+ export function stairFlightOutline(risers, riser, tread, waist) {
37
+ const top = [[0, 0]];
38
+ for (let i = 0; i < risers; i++) {
39
+ top.push([i * tread, (i + 1) * riser], [(i + 1) * tread, (i + 1) * riser]);
40
+ }
41
+ const run = risers * tread;
42
+ const rise = risers * riser;
43
+ if (waist === undefined) {
44
+ // Solid to the base: down the back, along the floor.
45
+ return [...top, [run, 0]].reverse();
46
+ }
47
+ // Underside parallel to the pitch line z = x·R/T, `waist` below it
48
+ // (perpendicular), i.e. a vertical drop of waist / cos(pitch).
49
+ const drop = waist * Math.hypot(riser, tread) / tread;
50
+ const foot = drop * tread / riser; // where the underside meets the floor
51
+ const underside = [[run, rise - drop], [foot, 0]];
52
+ return [...top, ...underside].reverse();
53
+ }
54
+ /** Package-private validation shared by creation and occurrence edits. */
55
+ export function assertStairParams(params, op) {
56
+ assertFinitePoint3({ Position: params.Position }, op);
57
+ if (!Number.isInteger(params.NumberOfRisers) || params.NumberOfRisers < 1) {
58
+ throw new Error(`${op}: NumberOfRisers must be a positive integer`);
59
+ }
60
+ assertPositiveFinite([params.RiserHeight, params.TreadLength, params.Width], `${op}: RiserHeight, TreadLength and Width must be finite positive numbers`);
61
+ if (params.Direction !== undefined && !Number.isFinite(params.Direction)) {
62
+ throw new Error(`${op}: Direction must be a finite number (radians)`);
63
+ }
64
+ if (params.WaistThickness !== undefined) {
65
+ assertPositiveFinite([params.WaistThickness], `${op}: WaistThickness must be a finite positive number`);
66
+ const drop = params.WaistThickness * Math.hypot(params.RiserHeight, params.TreadLength) / params.TreadLength;
67
+ if (drop >= params.NumberOfRisers * params.RiserHeight) {
68
+ throw new Error(`${op}: WaistThickness is too thick for a flight of this height`);
69
+ }
70
+ }
71
+ }
72
+ export function addStairToStore(editor, anchor, params) {
73
+ const op = 'addStairToStore';
74
+ assertStairParams(params, op);
75
+ const registry = schemaRegistry(anchor.schema, op);
76
+ const isIfc2x3 = registry.name.toUpperCase() === 'IFC2X3';
77
+ const shapeType = params.PredefinedType ?? 'STRAIGHT_RUN_STAIR';
78
+ const stairGuid = productGuid(params, anchor.guidRandom);
79
+ const flightGuid = productGuid({ GlobalId: params.FlightGlobalId }, anchor.guidRandom);
80
+ const stairValues = (placement) => ({
81
+ GlobalId: stairGuid,
82
+ OwnerHistory: ownerHistoryRef(anchor.ownerHistoryId),
83
+ Name: params.Name ?? 'Stair',
84
+ Description: params.Description,
85
+ ObjectType: params.ObjectType,
86
+ ObjectPlacement: placement,
87
+ Tag: params.Tag,
88
+ [isIfc2x3 ? 'ShapeType' : 'PredefinedType']: shapeType,
89
+ });
90
+ // Lay the stair record out once before the first emit, so a bad
91
+ // PredefinedType or a missing IFC2X3 OwnerHistory refuses cleanly.
92
+ schemaAttributes(registry, 'IfcStair', stairValues(null), op);
93
+ const riser = toNativeLength(anchor, params.RiserHeight);
94
+ const tread = toNativeLength(anchor, params.TreadLength);
95
+ const width = toNativeLength(anchor, params.Width);
96
+ const waist = params.WaistThickness === undefined ? undefined : toNativeLength(anchor, params.WaistThickness);
97
+ const direction = params.Direction ?? 0;
98
+ // Stair placement: at Position, local X along the run. Written with
99
+ // explicit axes so the stair can be turned later (rotateEntity edits the
100
+ // RefDirection).
101
+ const placementId = emitLocalPlacement(editor, anchor.storeyPlacementId, toNativePoint3(anchor, params.Position), [0, 0, 1], [Math.cos(direction), Math.sin(direction), 0]);
102
+ const flightPlacementId = emitLocalPlacement(editor, placementId, [0, 0, 0]);
103
+ const { profileId, solidId } = emitStairFlightBody(editor, params.NumberOfRisers, riser, tread, width, waist);
104
+ const { shapeRepId, productShapeId } = emitBodyRepresentation(editor, anchor.bodyContextId, solidId);
105
+ const stairId = editor.addEntity('IfcStair', schemaAttributes(registry, 'IfcStair', stairValues(`#${placementId}`), op)).expressId;
106
+ const flightId = editor.addEntity('IfcStairFlight', schemaAttributes(registry, 'IfcStairFlight', {
107
+ GlobalId: flightGuid,
108
+ OwnerHistory: ownerHistoryRef(anchor.ownerHistoryId),
109
+ Name: `${params.Name ?? 'Stair'} Flight`,
110
+ ObjectPlacement: `#${flightPlacementId}`,
111
+ Representation: `#${productShapeId}`,
112
+ [isIfc2x3 ? 'NumberOfRiser' : 'NumberOfRisers']: params.NumberOfRisers,
113
+ NumberOfTreads: params.NumberOfRisers,
114
+ RiserHeight: riser,
115
+ TreadLength: tread,
116
+ ...(isIfc2x3 ? {} : { PredefinedType: 'STRAIGHT' }),
117
+ }, op)).expressId;
118
+ const relAggregatesId = editor.addEntity('IfcRelAggregates', schemaAttributes(registry, 'IfcRelAggregates', {
119
+ GlobalId: generateIfcGuid(anchor.guidRandom),
120
+ OwnerHistory: ownerHistoryRef(anchor.ownerHistoryId),
121
+ RelatingObject: `#${stairId}`,
122
+ RelatedObjects: [`#${flightId}`],
123
+ }, op)).expressId;
124
+ const relContainedId = emitRelContainedInSpatialStructure(editor, anchor.ownerHistoryId, stairId, anchor.storeyId, anchor.guidRandom);
125
+ return {
126
+ stairId,
127
+ flightId,
128
+ placementId,
129
+ flightPlacementId,
130
+ profileId,
131
+ solidId,
132
+ shapeRepId,
133
+ productShapeId,
134
+ relAggregatesId,
135
+ relContainedId,
136
+ };
137
+ }
138
+ /** The canonical stepped solid, in native units; package-private. */
139
+ export function emitStairFlightBody(editor, risers, riser, tread, width, waist) {
140
+ // The stepped side outline lies in the solid's XY plane. The solid's frame
141
+ // maps profile X -> stair +X (run) and profile Y -> stair +Z (rise) with
142
+ // extrusion along -Y, from y = width, so the flight spans y in [0, width].
143
+ const profileId = emitPolygonProfile(editor, stairFlightOutline(risers, riser, tread, waist));
144
+ const solidOrigin = editor.addEntity('IfcCartesianPoint', [[0, width, 0]]).expressId;
145
+ const solidAxis = editor.addEntity('IfcDirection', [[0, -1, 0]]).expressId;
146
+ const solidRef = editor.addEntity('IfcDirection', [[1, 0, 0]]).expressId;
147
+ const solidPosition = editor.addEntity('IfcAxis2Placement3D', [
148
+ `#${solidOrigin}`, `#${solidAxis}`, `#${solidRef}`,
149
+ ]).expressId;
150
+ const extrusion = editor.addEntity('IfcDirection', [[0, 0, 1]]).expressId;
151
+ const solidId = editor.addEntity('IfcExtrudedAreaSolid', [
152
+ `#${profileId}`, `#${solidPosition}`, `#${extrusion}`, width,
153
+ ]).expressId;
154
+ return { profileId, solidId };
155
+ }
156
+ //# sourceMappingURL=stair.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stair.js","sourceRoot":"","sources":["../../src/in-store/stair.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAC;AACjF,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,kCAAkC,EAClC,eAAe,EACf,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAgD1E;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAc,EACd,KAAa,EACb,KAAa,EACb,KAAc;IAEd,MAAM,GAAG,GAA4B,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EA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IAC9F,MAAM,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACrF,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3E,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACzE,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,qBAAqB,EAAE;QAC5D,IAAI,WAAW,EAAE,EAAE,IAAI,SAAS,EAAE,EAAE,IAAI,QAAQ,EAAE;KACnD,CAAC,CAAC,SAAS,CAAC;IACb,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1E,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,sBAAsB,EAAE;QACvD,IAAI,SAAS,EAAE,EAAE,IAAI,aAAa,EAAE,EAAE,IAAI,SAAS,EAAE,EAAE,KAAK;KAC7D,CAAC,CAAC,SAAS,CAAC;IACb,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAChC,CAAC"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Apply a wall join (`computeWallJoin`) to two walls in the store: rewrite each
3
+ * joined wall's body profile and `Axis` representation, and write the
4
+ * `IfcRelConnectsPathElements` between them (#6232 D1).
5
+ *
6
+ * The wall's ObjectPlacement is left where it is. A join only moves an axis end
7
+ * along the axis, so the wall frame (origin, +X along the axis) stays valid,
8
+ * and openings placed relative to the wall keep their position. The new body
9
+ * and axis are written in that frame, offset by where the new Start sits in it.
10
+ * That is why a target carries `origin`: the plan point of the placement
11
+ * origin, which is the wall's Start until a join moves Start.
12
+ *
13
+ * Only the entities the wall owns are replaced: a new profile goes into the
14
+ * existing IfcExtrudedAreaSolid.SweptArea, a new Axis representation replaces
15
+ * the old one in IfcProductDefinitionShape.Representations. The old profile and
16
+ * axis are removed when this session created them (overlay entities), and left
17
+ * to the exporter otherwise.
18
+ *
19
+ * Pure: writes through the editor only.
20
+ */
21
+ import type { StoreEditor } from '@ifc-lite/mutations';
22
+ import type { SpatialAnchor } from './anchor.js';
23
+ import { type WallBuildResult, type WallInStoreParams } from './wall.js';
24
+ import { type PlanPoint, type WallJoin, type WallJoinOptions, type WallJoinWall } from './wall-join.js';
25
+ /** A wall in the store, with the ids a join rewrites and its current plan shape. */
26
+ export interface WallJoinTarget {
27
+ wallId: number;
28
+ /** IfcExtrudedAreaSolid of the Body; its SweptArea is replaced. */
29
+ solidId: number;
30
+ /** The profile the solid sweeps now. */
31
+ profileId: number;
32
+ /** IfcProductDefinitionShape of the wall. */
33
+ productShapeId: number;
34
+ /** Its current Representations, in order. */
35
+ representationIds: readonly number[];
36
+ /** The current `Axis` representation, when the wall has one (it is replaced, else a new one is appended). */
37
+ axisRepId: number | null;
38
+ /** Plan point (metres) of the wall's placement origin; the placement's +X runs along the axis. */
39
+ origin: PlanPoint;
40
+ /** The wall's current plan shape, metres. */
41
+ wall: WallJoinWall;
42
+ }
43
+ export interface WallJoinApplyResult {
44
+ join: WallJoin;
45
+ /** The IfcRelConnectsPathElements written. */
46
+ relId: number;
47
+ /** The walls after the join, ready to take part in a next join. */
48
+ a: WallJoinTarget;
49
+ b: WallJoinTarget;
50
+ }
51
+ export interface WallJoinApplyOptions extends WallJoinOptions {
52
+ /** Layer priorities for the relationship, by wall. Default empty. */
53
+ priorities?: {
54
+ a?: readonly number[];
55
+ b?: readonly number[];
56
+ };
57
+ /** Name for the IfcRelConnectsPathElements. */
58
+ Name?: string;
59
+ }
60
+ export type JoinAnchor = Pick<SpatialAnchor, 'ownerHistoryId' | 'axisContextId' | 'schema' | 'lengthUnitScale' | 'guidRandom'>;
61
+ /** The join target for a wall `addWallToStore` just built from `params`. */
62
+ export declare function wallJoinTargetFromBuild(build: WallBuildResult, params: WallInStoreParams): WallJoinTarget;
63
+ /**
64
+ * Join walls `a` and `b` in the store. See `computeWallJoin` for the geometry
65
+ * and `options`. Refuses IFC5 / IFCX anchors; IFC2X3, IFC4 and IFC4X3 are
66
+ * written by their own attribute layouts.
67
+ */
68
+ export declare function applyWallJoinToStore(editor: StoreEditor, anchor: JoinAnchor, a: WallJoinTarget, b: WallJoinTarget, options?: WallJoinApplyOptions): WallJoinApplyResult;
69
+ /**
70
+ * Give `target` the body and `Axis` of `wall`, written in the frame of the
71
+ * placement at `target.origin` (`wall`'s axis runs along that frame's +X).
72
+ */
73
+ export declare function rewriteWall(editor: StoreEditor, anchor: JoinAnchor, target: WallJoinTarget, wall: WallJoinWall): WallJoinTarget;
74
+ //# sourceMappingURL=wall-join-apply.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wall-join-apply.d.ts","sourceRoot":"","sources":["../../src/in-store/wall-join-apply.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,EAA2E,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAClJ,OAAO,EAAmB,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEzH,oFAAoF;AACpF,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;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