@ifc-lite/viewer 1.25.1 → 1.25.2

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 (53) hide show
  1. package/.turbo/turbo-build.log +79 -84
  2. package/CHANGELOG.md +23 -0
  3. package/dist/assets/{basketViewActivator-Dkn92C04.js → basketViewActivator-CTgyKI3U.js} +6 -6
  4. package/dist/assets/{bcf-DP2AK1-_.js → bcf-7jQby1qi.js} +1 -1
  5. package/dist/assets/{deflate-BYqYwhkl.js → deflate-Cfp9t1Df.js} +1 -1
  6. package/dist/assets/exporters-DfSvJPi4.js +4660 -0
  7. package/dist/assets/geometry.worker-Cyn5BybV.js +1 -0
  8. package/dist/assets/{geotiff-By06vdeL.js → geotiff-xZoE8BkO.js} +10 -10
  9. package/dist/assets/{ids-DDkkb4mo.js → ids-Cu73hD0Y.js} +21 -21
  10. package/dist/assets/ifc-lite_bg-ksLBP5cA.wasm +0 -0
  11. package/dist/assets/{index-CqBdDOAZ.js → index-WSbA5iy6.js} +34803 -34679
  12. package/dist/assets/{jpeg-B4IBTphL.js → jpeg-DhwFEbqb.js} +1 -1
  13. package/dist/assets/{lerc-DQ3jI0Ke.js → lerc-Dz6BXOVb.js} +1 -1
  14. package/dist/assets/{lzw-CtdH775t.js → lzw-C9z0fG2o.js} +1 -1
  15. package/dist/assets/{native-bridge-DA8wxaN_.js → native-bridge-RvDmzO-2.js} +1 -1
  16. package/dist/assets/{packbits-DG3zn49C.js → packbits-jfwifz7C.js} +1 -1
  17. package/dist/assets/parser.worker-C594dWxH.js +182 -0
  18. package/dist/assets/raw-R2QfzPAR.js +1 -0
  19. package/dist/assets/{sandbox-D1pQT-5R.js → sandbox-DDSZ7rek.js} +2450 -2260
  20. package/dist/assets/{server-client-D9xO_8yX.js → server-client-Ctk8_Bof.js} +1 -1
  21. package/dist/assets/{webimage-_-qCDjkn.js → webimage-XFHVyVtC.js} +1 -1
  22. package/dist/assets/{zstd-DlfgC8gA.js → zstd-3q5qcl5V.js} +1 -1
  23. package/dist/index.html +6 -6
  24. package/package.json +22 -21
  25. package/src/App.tsx +4 -0
  26. package/src/components/viewer/CommandPalette.tsx +5 -1
  27. package/src/components/viewer/MainToolbar.tsx +41 -19
  28. package/src/components/viewer/Viewport.tsx +48 -3
  29. package/src/components/viewer/hierarchy/ifc-icons.ts +60 -0
  30. package/src/components/viewer/useGeometryStreaming.ts +113 -18
  31. package/src/hooks/ingest/resolveDataStoreOrAbort.test.ts +61 -0
  32. package/src/hooks/ingest/resolveDataStoreOrAbort.ts +28 -0
  33. package/src/hooks/ingest/viewerModelIngest.ts +55 -11
  34. package/src/hooks/useIfcCache.ts +44 -18
  35. package/src/hooks/useIfcLoader.ts +1 -23
  36. package/src/hooks/useSymbolicAnnotations.ts +170 -35
  37. package/src/store/constants.ts +19 -3
  38. package/src/store/index.ts +1 -0
  39. package/src/store/slices/visibilitySlice.ts +2 -1
  40. package/src/store/types.ts +9 -0
  41. package/src/utils/serverDataModel.test.ts +51 -1
  42. package/src/utils/serverDataModel.ts +2 -26
  43. package/vite.config.ts +0 -5
  44. package/dist/assets/exporters-CZe0D8N-.js +0 -5957
  45. package/dist/assets/geometry-controller.worker-pD49_fH6.js +0 -7
  46. package/dist/assets/geometry.worker-D4c-06r5.js +0 -1
  47. package/dist/assets/ifc-lite-DxGqDbjO.js +0 -7
  48. package/dist/assets/ifc-lite_bg-BNeu7R_V.wasm +0 -0
  49. package/dist/assets/ifc-lite_bg-DuxUZomW.wasm +0 -0
  50. package/dist/assets/parser.worker-BZZcO7DB.js +0 -182
  51. package/dist/assets/raw-DY7Y_acr.js +0 -1
  52. package/dist/assets/wasm-bridge-DMX8Acuf.js +0 -1
  53. package/dist/assets/workerHelpers-Crstj4Oa.js +0 -36
@@ -0,0 +1,4660 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/native-bridge-RvDmzO-2.js","assets/sandbox-DDSZ7rek.js","assets/lens-PYsLu_MA.js"])))=>i.map(i=>d[i]);
2
+ import { K as Ge, _ as $e, aF as st, a3 as Ve, a4 as ze, j as tt, k as Ct, aI as Me, E as ke, ad as ee, ah as Ye, ae as We, aB as je, O as He, i as ne, h as Xe, __tla as __tla_0 } from "./sandbox-DDSZ7rek.js";
3
+ let rs, is, Le, as, qn, Pe, ss, In, cs, ie, os, ns;
4
+ let __tla = Promise.all([
5
+ (()=>{
6
+ try {
7
+ return __tla_0;
8
+ } catch {}
9
+ })()
10
+ ]).then(async ()=>{
11
+ let c;
12
+ function P(r) {
13
+ St === rt.length && rt.push(rt.length + 1);
14
+ const t = St;
15
+ return St = rt[t], rt[t] = r, t;
16
+ }
17
+ function qe(r) {
18
+ if (kt == 1) throw new Error("out of js stack");
19
+ return rt[--kt] = r, kt;
20
+ }
21
+ const de = typeof FinalizationRegistry > "u" ? {
22
+ register: ()=>{},
23
+ unregister: ()=>{}
24
+ } : new FinalizationRegistry((r)=>r.dtor(r.a, r.b));
25
+ function Qe(r) {
26
+ r < 132 || (rt[r] = St, St = r);
27
+ }
28
+ function se(r, t) {
29
+ return r = r >>> 0, Ke().subarray(r / 4, r / 4 + t);
30
+ }
31
+ function Je(r, t) {
32
+ return r = r >>> 0, Ze().subarray(r / 8, r / 8 + t);
33
+ }
34
+ function xe(r, t) {
35
+ return r = r >>> 0, Be().subarray(r / 4, r / 4 + t);
36
+ }
37
+ let It = null;
38
+ function A() {
39
+ return (It === null || It.buffer.detached === !0 || It.buffer.detached === void 0 && It.buffer !== c.memory.buffer) && (It = new DataView(c.memory.buffer)), It;
40
+ }
41
+ let Tt = null;
42
+ function Ke() {
43
+ return (Tt === null || Tt.byteLength === 0) && (Tt = new Float32Array(c.memory.buffer)), Tt;
44
+ }
45
+ let wt = null;
46
+ function Ze() {
47
+ return (wt === null || wt.byteLength === 0) && (wt = new Float64Array(c.memory.buffer)), wt;
48
+ }
49
+ function J(r, t) {
50
+ return r = r >>> 0, nn(r, t);
51
+ }
52
+ let Ft = null;
53
+ function Be() {
54
+ return (Ft === null || Ft.byteLength === 0) && (Ft = new Uint32Array(c.memory.buffer)), Ft;
55
+ }
56
+ let Rt = null;
57
+ function Nt() {
58
+ return (Rt === null || Rt.byteLength === 0) && (Rt = new Uint8Array(c.memory.buffer)), Rt;
59
+ }
60
+ function k(r) {
61
+ return rt[r];
62
+ }
63
+ function Xt(r, t) {
64
+ try {
65
+ return r.apply(this, t);
66
+ } catch (e) {
67
+ c.__wbindgen_export(P(e));
68
+ }
69
+ }
70
+ let rt = new Array(128).fill(void 0);
71
+ rt.push(void 0, null, !0, !1);
72
+ let St = rt.length;
73
+ function $t(r) {
74
+ return r == null;
75
+ }
76
+ function tn(r, t, e, n) {
77
+ const s = {
78
+ a: r,
79
+ b: t,
80
+ cnt: 1,
81
+ dtor: e
82
+ }, i = (...o)=>{
83
+ s.cnt++;
84
+ const a = s.a;
85
+ s.a = 0;
86
+ try {
87
+ return n(a, s.b, ...o);
88
+ } finally{
89
+ s.a = a, i._wbg_cb_unref();
90
+ }
91
+ };
92
+ return i._wbg_cb_unref = ()=>{
93
+ --s.cnt === 0 && (s.dtor(s.a, s.b), s.a = 0, de.unregister(s));
94
+ }, de.register(i, s, s), i;
95
+ }
96
+ function ft(r, t) {
97
+ const e = t(r.length * 4, 4) >>> 0;
98
+ return Be().set(r, e / 4), Y = r.length, e;
99
+ }
100
+ function pt(r, t) {
101
+ const e = t(r.length * 1, 1) >>> 0;
102
+ return Nt().set(r, e / 1), Y = r.length, e;
103
+ }
104
+ function gt(r, t, e) {
105
+ if (e === void 0) {
106
+ const a = At.encode(r), l = t(a.length, 1) >>> 0;
107
+ return Nt().subarray(l, l + a.length).set(a), Y = a.length, l;
108
+ }
109
+ let n = r.length, s = t(n, 1) >>> 0;
110
+ const i = Nt();
111
+ let o = 0;
112
+ for(; o < n; o++){
113
+ const a = r.charCodeAt(o);
114
+ if (a > 127) break;
115
+ i[s + o] = a;
116
+ }
117
+ if (o !== n) {
118
+ o !== 0 && (r = r.slice(o)), s = e(s, n, n = o + r.length * 3, 1) >>> 0;
119
+ const a = Nt().subarray(s + o, s + n), l = At.encodeInto(r, a);
120
+ o += l.written, s = e(s, n, o, 1) >>> 0;
121
+ }
122
+ return Y = o, s;
123
+ }
124
+ let kt = 128;
125
+ function W(r) {
126
+ const t = k(r);
127
+ return Qe(r), t;
128
+ }
129
+ let Yt = new TextDecoder("utf-8", {
130
+ ignoreBOM: !0,
131
+ fatal: !0
132
+ });
133
+ Yt.decode();
134
+ const en = 2146435072;
135
+ let qt = 0;
136
+ function nn(r, t) {
137
+ return qt += t, qt >= en && (Yt = new TextDecoder("utf-8", {
138
+ ignoreBOM: !0,
139
+ fatal: !0
140
+ }), Yt.decode(), qt = t), Yt.decode(Nt().subarray(r, r + t));
141
+ }
142
+ const At = new TextEncoder;
143
+ "encodeInto" in At || (At.encodeInto = function(r, t) {
144
+ const e = At.encode(r);
145
+ return t.set(e), {
146
+ read: r.length,
147
+ written: e.length
148
+ };
149
+ });
150
+ let Y = 0;
151
+ function sn(r, t, e) {
152
+ c.__wasm_bindgen_func_elem_1685(r, t, P(e));
153
+ }
154
+ function rn(r, t, e, n) {
155
+ c.__wasm_bindgen_func_elem_1832(r, t, P(e), P(n));
156
+ }
157
+ const fe = typeof FinalizationRegistry > "u" ? {
158
+ register: ()=>{},
159
+ unregister: ()=>{}
160
+ } : new FinalizationRegistry((r)=>c.__wbg_ifcapi_free(r >>> 0, 1)), ue = typeof FinalizationRegistry > "u" ? {
161
+ register: ()=>{},
162
+ unregister: ()=>{}
163
+ } : new FinalizationRegistry((r)=>c.__wbg_meshcollection_free(r >>> 0, 1)), he = typeof FinalizationRegistry > "u" ? {
164
+ register: ()=>{},
165
+ unregister: ()=>{}
166
+ } : new FinalizationRegistry((r)=>c.__wbg_meshdatajs_free(r >>> 0, 1)), pe = typeof FinalizationRegistry > "u" ? {
167
+ register: ()=>{},
168
+ unregister: ()=>{}
169
+ } : new FinalizationRegistry((r)=>c.__wbg_profilecollection_free(r >>> 0, 1)), Ie = typeof FinalizationRegistry > "u" ? {
170
+ register: ()=>{},
171
+ unregister: ()=>{}
172
+ } : new FinalizationRegistry((r)=>c.__wbg_profileentryjs_free(r >>> 0, 1)), ge = typeof FinalizationRegistry > "u" ? {
173
+ register: ()=>{},
174
+ unregister: ()=>{}
175
+ } : new FinalizationRegistry((r)=>c.__wbg_symboliccircle_free(r >>> 0, 1)), _e = typeof FinalizationRegistry > "u" ? {
176
+ register: ()=>{},
177
+ unregister: ()=>{}
178
+ } : new FinalizationRegistry((r)=>c.__wbg_symbolicfillarea_free(r >>> 0, 1)), ye = typeof FinalizationRegistry > "u" ? {
179
+ register: ()=>{},
180
+ unregister: ()=>{}
181
+ } : new FinalizationRegistry((r)=>c.__wbg_symbolicpolyline_free(r >>> 0, 1)), Ee = typeof FinalizationRegistry > "u" ? {
182
+ register: ()=>{},
183
+ unregister: ()=>{}
184
+ } : new FinalizationRegistry((r)=>c.__wbg_symbolicrepresentationcollection_free(r >>> 0, 1)), me = typeof FinalizationRegistry > "u" ? {
185
+ register: ()=>{},
186
+ unregister: ()=>{}
187
+ } : new FinalizationRegistry((r)=>c.__wbg_symbolictext_free(r >>> 0, 1));
188
+ ie = class {
189
+ __destroy_into_raw() {
190
+ const t = this.__wbg_ptr;
191
+ return this.__wbg_ptr = 0, fe.unregister(this), t;
192
+ }
193
+ free() {
194
+ const t = this.__destroy_into_raw();
195
+ c.__wbg_ifcapi_free(t, 0);
196
+ }
197
+ buildPrePassFast(t) {
198
+ const e = pt(t, c.__wbindgen_export3), n = Y, s = c.ifcapi_buildPrePassFast(this.__wbg_ptr, e, n);
199
+ return W(s);
200
+ }
201
+ buildPrePassOnce(t) {
202
+ const e = pt(t, c.__wbindgen_export3), n = Y, s = c.ifcapi_buildPrePassOnce(this.__wbg_ptr, e, n);
203
+ return W(s);
204
+ }
205
+ processGeometryBatch(t, e, n, s, i, o, a, l, d, u, f, p) {
206
+ const _ = pt(t, c.__wbindgen_export3), h = Y, y = ft(e, c.__wbindgen_export3), m = Y, b = ft(l, c.__wbindgen_export3), w = Y, v = ft(d, c.__wbindgen_export3), L = Y, j = ft(u, c.__wbindgen_export3), O = Y, U = ft(f, c.__wbindgen_export3), C = Y, N = pt(p, c.__wbindgen_export3), F = Y, E = c.ifcapi_processGeometryBatch(this.__wbg_ptr, _, h, y, m, n, s, i, o, a, b, w, v, L, j, O, U, C, N, F);
207
+ return Ot.__wrap(E);
208
+ }
209
+ buildPrePassStreaming(t, e, n) {
210
+ try {
211
+ const a = c.__wbindgen_add_to_stack_pointer(-16), l = pt(t, c.__wbindgen_export3), d = Y;
212
+ c.ifcapi_buildPrePassStreaming(a, this.__wbg_ptr, l, d, qe(e), n);
213
+ var s = A().getInt32(a + 0, !0), i = A().getInt32(a + 4, !0), o = A().getInt32(a + 8, !0);
214
+ if (o) throw W(i);
215
+ return W(s);
216
+ } finally{
217
+ c.__wbindgen_add_to_stack_pointer(16), rt[kt++] = void 0;
218
+ }
219
+ }
220
+ extractProfiles(t, e) {
221
+ const n = gt(t, c.__wbindgen_export3, c.__wbindgen_export4), s = Y, i = c.ifcapi_extractProfiles(this.__wbg_ptr, n, s, e);
222
+ return Mt.__wrap(i);
223
+ }
224
+ getMemory() {
225
+ const t = c.ifcapi_getMemory(this.__wbg_ptr);
226
+ return W(t);
227
+ }
228
+ setEntityIndex(t, e, n) {
229
+ const s = ft(t, c.__wbindgen_export3), i = Y, o = ft(e, c.__wbindgen_export3), a = Y, l = ft(n, c.__wbindgen_export3), d = Y;
230
+ c.ifcapi_setEntityIndex(this.__wbg_ptr, s, i, o, a, l, d);
231
+ }
232
+ setMergeLayers(t) {
233
+ c.ifcapi_setMergeLayers(this.__wbg_ptr, t);
234
+ }
235
+ clearPrePassCache() {
236
+ c.ifcapi_clearPrePassCache(this.__wbg_ptr);
237
+ }
238
+ constructor(){
239
+ const t = c.ifcapi_new();
240
+ return this.__wbg_ptr = t >>> 0, fe.register(this, this.__wbg_ptr, this), this;
241
+ }
242
+ get version() {
243
+ let t, e;
244
+ try {
245
+ const i = c.__wbindgen_add_to_stack_pointer(-16);
246
+ c.ifcapi_version(i, this.__wbg_ptr);
247
+ var n = A().getInt32(i + 0, !0), s = A().getInt32(i + 4, !0);
248
+ return t = n, e = s, J(n, s);
249
+ } finally{
250
+ c.__wbindgen_add_to_stack_pointer(16), c.__wbindgen_export2(t, e, 1);
251
+ }
252
+ }
253
+ get is_ready() {
254
+ return c.ifcapi_is_ready(this.__wbg_ptr) !== 0;
255
+ }
256
+ parseStreaming(t, e) {
257
+ const n = gt(t, c.__wbindgen_export3, c.__wbindgen_export4), s = Y, i = c.ifcapi_parseStreaming(this.__wbg_ptr, n, s, P(e));
258
+ return W(i);
259
+ }
260
+ scanEntitiesFast(t) {
261
+ const e = gt(t, c.__wbindgen_export3, c.__wbindgen_export4), n = Y, s = c.ifcapi_scanEntitiesFast(this.__wbg_ptr, e, n);
262
+ return W(s);
263
+ }
264
+ scanEntitiesFastBytes(t) {
265
+ const e = pt(t, c.__wbindgen_export3), n = Y, s = c.ifcapi_scanEntitiesFastBytes(this.__wbg_ptr, e, n);
266
+ return W(s);
267
+ }
268
+ scanGeometryEntitiesFast(t) {
269
+ const e = gt(t, c.__wbindgen_export3, c.__wbindgen_export4), n = Y, s = c.ifcapi_scanGeometryEntitiesFast(this.__wbg_ptr, e, n);
270
+ return W(s);
271
+ }
272
+ scanRelevantEntitiesFastBytes(t) {
273
+ const e = pt(t, c.__wbindgen_export3), n = Y, s = c.ifcapi_scanRelevantEntitiesFastBytes(this.__wbg_ptr, e, n);
274
+ return W(s);
275
+ }
276
+ parse(t) {
277
+ const e = gt(t, c.__wbindgen_export3, c.__wbindgen_export4), n = Y, s = c.ifcapi_parse(this.__wbg_ptr, e, n);
278
+ return W(s);
279
+ }
280
+ parseSymbolicRepresentations(t) {
281
+ const e = gt(t, c.__wbindgen_export3, c.__wbindgen_export4), n = Y, s = c.ifcapi_parseSymbolicRepresentations(this.__wbg_ptr, e, n);
282
+ return Dt.__wrap(s);
283
+ }
284
+ };
285
+ Symbol.dispose && (ie.prototype[Symbol.dispose] = ie.prototype.free);
286
+ class Ot {
287
+ static __wrap(t) {
288
+ t = t >>> 0;
289
+ const e = Object.create(Ot.prototype);
290
+ return e.__wbg_ptr = t, ue.register(e, e.__wbg_ptr, e), e;
291
+ }
292
+ __destroy_into_raw() {
293
+ const t = this.__wbg_ptr;
294
+ return this.__wbg_ptr = 0, ue.unregister(this), t;
295
+ }
296
+ free() {
297
+ const t = this.__destroy_into_raw();
298
+ c.__wbg_meshcollection_free(t, 0);
299
+ }
300
+ get rtcOffsetX() {
301
+ return c.meshcollection_rtcOffsetX(this.__wbg_ptr);
302
+ }
303
+ get rtcOffsetY() {
304
+ return c.meshcollection_rtcOffsetY(this.__wbg_ptr);
305
+ }
306
+ get rtcOffsetZ() {
307
+ return c.meshcollection_rtcOffsetZ(this.__wbg_ptr);
308
+ }
309
+ hasRtcOffset() {
310
+ return c.meshcollection_hasRtcOffset(this.__wbg_ptr) !== 0;
311
+ }
312
+ localToWorld(t, e, n) {
313
+ try {
314
+ const a = c.__wbindgen_add_to_stack_pointer(-16);
315
+ c.meshcollection_localToWorld(a, this.__wbg_ptr, t, e, n);
316
+ var s = A().getInt32(a + 0, !0), i = A().getInt32(a + 4, !0), o = Je(s, i).slice();
317
+ return c.__wbindgen_export2(s, i * 8, 8), o;
318
+ } finally{
319
+ c.__wbindgen_add_to_stack_pointer(16);
320
+ }
321
+ }
322
+ get totalVertices() {
323
+ return c.meshcollection_totalVertices(this.__wbg_ptr) >>> 0;
324
+ }
325
+ get totalTriangles() {
326
+ return c.meshcollection_totalTriangles(this.__wbg_ptr) >>> 0;
327
+ }
328
+ get buildingRotation() {
329
+ try {
330
+ const n = c.__wbindgen_add_to_stack_pointer(-16);
331
+ c.meshcollection_buildingRotation(n, this.__wbg_ptr);
332
+ var t = A().getInt32(n + 0, !0), e = A().getFloat64(n + 8, !0);
333
+ return t === 0 ? void 0 : e;
334
+ } finally{
335
+ c.__wbindgen_add_to_stack_pointer(16);
336
+ }
337
+ }
338
+ get(t) {
339
+ const e = c.meshcollection_get(this.__wbg_ptr, t);
340
+ return e === 0 ? void 0 : Lt.__wrap(e);
341
+ }
342
+ get length() {
343
+ return c.meshcollection_length(this.__wbg_ptr) >>> 0;
344
+ }
345
+ }
346
+ Symbol.dispose && (Ot.prototype[Symbol.dispose] = Ot.prototype.free);
347
+ class Lt {
348
+ static __wrap(t) {
349
+ t = t >>> 0;
350
+ const e = Object.create(Lt.prototype);
351
+ return e.__wbg_ptr = t, he.register(e, e.__wbg_ptr, e), e;
352
+ }
353
+ __destroy_into_raw() {
354
+ const t = this.__wbg_ptr;
355
+ return this.__wbg_ptr = 0, he.unregister(this), t;
356
+ }
357
+ free() {
358
+ const t = this.__destroy_into_raw();
359
+ c.__wbg_meshdatajs_free(t, 0);
360
+ }
361
+ get expressId() {
362
+ return c.meshdatajs_expressId(this.__wbg_ptr) >>> 0;
363
+ }
364
+ get vertexCount() {
365
+ return c.meshdatajs_vertexCount(this.__wbg_ptr) >>> 0;
366
+ }
367
+ get shadingColor() {
368
+ try {
369
+ const n = c.__wbindgen_add_to_stack_pointer(-16);
370
+ c.meshdatajs_shadingColor(n, this.__wbg_ptr);
371
+ var t = A().getInt32(n + 0, !0), e = A().getInt32(n + 4, !0);
372
+ let s;
373
+ return t !== 0 && (s = se(t, e).slice(), c.__wbindgen_export2(t, e * 4, 4)), s;
374
+ } finally{
375
+ c.__wbindgen_add_to_stack_pointer(16);
376
+ }
377
+ }
378
+ get triangleCount() {
379
+ return c.meshdatajs_triangleCount(this.__wbg_ptr) >>> 0;
380
+ }
381
+ get color() {
382
+ try {
383
+ const s = c.__wbindgen_add_to_stack_pointer(-16);
384
+ c.meshdatajs_color(s, this.__wbg_ptr);
385
+ var t = A().getInt32(s + 0, !0), e = A().getInt32(s + 4, !0), n = se(t, e).slice();
386
+ return c.__wbindgen_export2(t, e * 4, 4), n;
387
+ } finally{
388
+ c.__wbindgen_add_to_stack_pointer(16);
389
+ }
390
+ }
391
+ get indices() {
392
+ const t = c.meshdatajs_indices(this.__wbg_ptr);
393
+ return W(t);
394
+ }
395
+ get normals() {
396
+ const t = c.meshdatajs_normals(this.__wbg_ptr);
397
+ return W(t);
398
+ }
399
+ get ifcType() {
400
+ let t, e;
401
+ try {
402
+ const i = c.__wbindgen_add_to_stack_pointer(-16);
403
+ c.meshdatajs_ifcType(i, this.__wbg_ptr);
404
+ var n = A().getInt32(i + 0, !0), s = A().getInt32(i + 4, !0);
405
+ return t = n, e = s, J(n, s);
406
+ } finally{
407
+ c.__wbindgen_add_to_stack_pointer(16), c.__wbindgen_export2(t, e, 1);
408
+ }
409
+ }
410
+ get positions() {
411
+ const t = c.meshdatajs_positions(this.__wbg_ptr);
412
+ return W(t);
413
+ }
414
+ }
415
+ Symbol.dispose && (Lt.prototype[Symbol.dispose] = Lt.prototype.free);
416
+ class Mt {
417
+ static __wrap(t) {
418
+ t = t >>> 0;
419
+ const e = Object.create(Mt.prototype);
420
+ return e.__wbg_ptr = t, pe.register(e, e.__wbg_ptr, e), e;
421
+ }
422
+ __destroy_into_raw() {
423
+ const t = this.__wbg_ptr;
424
+ return this.__wbg_ptr = 0, pe.unregister(this), t;
425
+ }
426
+ free() {
427
+ const t = this.__destroy_into_raw();
428
+ c.__wbg_profilecollection_free(t, 0);
429
+ }
430
+ get(t) {
431
+ const e = c.profilecollection_get(this.__wbg_ptr, t);
432
+ return e === 0 ? void 0 : xt.__wrap(e);
433
+ }
434
+ get length() {
435
+ return c.profilecollection_length(this.__wbg_ptr) >>> 0;
436
+ }
437
+ }
438
+ Symbol.dispose && (Mt.prototype[Symbol.dispose] = Mt.prototype.free);
439
+ class xt {
440
+ static __wrap(t) {
441
+ t = t >>> 0;
442
+ const e = Object.create(xt.prototype);
443
+ return e.__wbg_ptr = t, Ie.register(e, e.__wbg_ptr, e), e;
444
+ }
445
+ __destroy_into_raw() {
446
+ const t = this.__wbg_ptr;
447
+ return this.__wbg_ptr = 0, Ie.unregister(this), t;
448
+ }
449
+ free() {
450
+ const t = this.__destroy_into_raw();
451
+ c.__wbg_profileentryjs_free(t, 0);
452
+ }
453
+ get expressId() {
454
+ return c.profileentryjs_expressId(this.__wbg_ptr) >>> 0;
455
+ }
456
+ get holeCounts() {
457
+ const t = c.profileentryjs_holeCounts(this.__wbg_ptr);
458
+ return W(t);
459
+ }
460
+ get holePoints() {
461
+ const t = c.profileentryjs_holePoints(this.__wbg_ptr);
462
+ return W(t);
463
+ }
464
+ get modelIndex() {
465
+ return c.profileentryjs_modelIndex(this.__wbg_ptr) >>> 0;
466
+ }
467
+ get outerPoints() {
468
+ const t = c.profileentryjs_outerPoints(this.__wbg_ptr);
469
+ return W(t);
470
+ }
471
+ get extrusionDir() {
472
+ const t = c.profileentryjs_extrusionDir(this.__wbg_ptr);
473
+ return W(t);
474
+ }
475
+ get extrusionDepth() {
476
+ return c.profileentryjs_extrusionDepth(this.__wbg_ptr);
477
+ }
478
+ get ifcType() {
479
+ let t, e;
480
+ try {
481
+ const i = c.__wbindgen_add_to_stack_pointer(-16);
482
+ c.profileentryjs_ifcType(i, this.__wbg_ptr);
483
+ var n = A().getInt32(i + 0, !0), s = A().getInt32(i + 4, !0);
484
+ return t = n, e = s, J(n, s);
485
+ } finally{
486
+ c.__wbindgen_add_to_stack_pointer(16), c.__wbindgen_export2(t, e, 1);
487
+ }
488
+ }
489
+ get transform() {
490
+ const t = c.profileentryjs_transform(this.__wbg_ptr);
491
+ return W(t);
492
+ }
493
+ }
494
+ Symbol.dispose && (xt.prototype[Symbol.dispose] = xt.prototype.free);
495
+ class Bt {
496
+ static __wrap(t) {
497
+ t = t >>> 0;
498
+ const e = Object.create(Bt.prototype);
499
+ return e.__wbg_ptr = t, ge.register(e, e.__wbg_ptr, e), e;
500
+ }
501
+ __destroy_into_raw() {
502
+ const t = this.__wbg_ptr;
503
+ return this.__wbg_ptr = 0, ge.unregister(this), t;
504
+ }
505
+ free() {
506
+ const t = this.__destroy_into_raw();
507
+ c.__wbg_symboliccircle_free(t, 0);
508
+ }
509
+ get expressId() {
510
+ return c.symboliccircle_expressId(this.__wbg_ptr) >>> 0;
511
+ }
512
+ get startAngle() {
513
+ return c.symboliccircle_startAngle(this.__wbg_ptr);
514
+ }
515
+ get isFullCircle() {
516
+ return c.symboliccircle_isFullCircle(this.__wbg_ptr) !== 0;
517
+ }
518
+ get repIdentifier() {
519
+ let t, e;
520
+ try {
521
+ const i = c.__wbindgen_add_to_stack_pointer(-16);
522
+ c.symboliccircle_repIdentifier(i, this.__wbg_ptr);
523
+ var n = A().getInt32(i + 0, !0), s = A().getInt32(i + 4, !0);
524
+ return t = n, e = s, J(n, s);
525
+ } finally{
526
+ c.__wbindgen_add_to_stack_pointer(16), c.__wbindgen_export2(t, e, 1);
527
+ }
528
+ }
529
+ get radius() {
530
+ return c.symboliccircle_radius(this.__wbg_ptr);
531
+ }
532
+ get worldY() {
533
+ return c.symboliccircle_worldY(this.__wbg_ptr);
534
+ }
535
+ get centerX() {
536
+ return c.symboliccircle_centerX(this.__wbg_ptr);
537
+ }
538
+ get centerY() {
539
+ return c.symboliccircle_centerY(this.__wbg_ptr);
540
+ }
541
+ get ifcType() {
542
+ let t, e;
543
+ try {
544
+ const i = c.__wbindgen_add_to_stack_pointer(-16);
545
+ c.symboliccircle_ifcType(i, this.__wbg_ptr);
546
+ var n = A().getInt32(i + 0, !0), s = A().getInt32(i + 4, !0);
547
+ return t = n, e = s, J(n, s);
548
+ } finally{
549
+ c.__wbindgen_add_to_stack_pointer(16), c.__wbindgen_export2(t, e, 1);
550
+ }
551
+ }
552
+ get endAngle() {
553
+ return c.symboliccircle_endAngle(this.__wbg_ptr);
554
+ }
555
+ }
556
+ Symbol.dispose && (Bt.prototype[Symbol.dispose] = Bt.prototype.free);
557
+ class Pt {
558
+ static __wrap(t) {
559
+ t = t >>> 0;
560
+ const e = Object.create(Pt.prototype);
561
+ return e.__wbg_ptr = t, _e.register(e, e.__wbg_ptr, e), e;
562
+ }
563
+ __destroy_into_raw() {
564
+ const t = this.__wbg_ptr;
565
+ return this.__wbg_ptr = 0, _e.unregister(this), t;
566
+ }
567
+ free() {
568
+ const t = this.__destroy_into_raw();
569
+ c.__wbg_symbolicfillarea_free(t, 0);
570
+ }
571
+ get expressId() {
572
+ return c.profileentryjs_expressId(this.__wbg_ptr) >>> 0;
573
+ }
574
+ get holeCount() {
575
+ return c.symbolicfillarea_holeCount(this.__wbg_ptr) >>> 0;
576
+ }
577
+ get hatchAngle() {
578
+ return c.symbolicfillarea_hatchAngle(this.__wbg_ptr);
579
+ }
580
+ get pointCount() {
581
+ return c.symbolicfillarea_pointCount(this.__wbg_ptr) >>> 0;
582
+ }
583
+ get hasHatching() {
584
+ return c.symbolicfillarea_hasHatching(this.__wbg_ptr) !== 0;
585
+ }
586
+ get hatchSpacing() {
587
+ return c.symbolicfillarea_hatchSpacing(this.__wbg_ptr);
588
+ }
589
+ get holesOffsets() {
590
+ const t = c.symbolicfillarea_holesOffsets(this.__wbg_ptr);
591
+ return W(t);
592
+ }
593
+ get repIdentifier() {
594
+ let t, e;
595
+ try {
596
+ const i = c.__wbindgen_add_to_stack_pointer(-16);
597
+ c.symbolicfillarea_repIdentifier(i, this.__wbg_ptr);
598
+ var n = A().getInt32(i + 0, !0), s = A().getInt32(i + 4, !0);
599
+ return t = n, e = s, J(n, s);
600
+ } finally{
601
+ c.__wbindgen_add_to_stack_pointer(16), c.__wbindgen_export2(t, e, 1);
602
+ }
603
+ }
604
+ get hatchLineWidth() {
605
+ return c.symbolicfillarea_hatchLineWidth(this.__wbg_ptr);
606
+ }
607
+ get hatchAngleSecondary() {
608
+ return c.symbolicfillarea_hatchAngleSecondary(this.__wbg_ptr);
609
+ }
610
+ get fillA() {
611
+ return c.symbolicfillarea_fillA(this.__wbg_ptr);
612
+ }
613
+ get fillB() {
614
+ return c.symbolicfillarea_fillB(this.__wbg_ptr);
615
+ }
616
+ get fillG() {
617
+ return c.symbolicfillarea_fillG(this.__wbg_ptr);
618
+ }
619
+ get fillR() {
620
+ return c.symbolicfillarea_fillR(this.__wbg_ptr);
621
+ }
622
+ get points() {
623
+ const t = c.symbolicfillarea_points(this.__wbg_ptr);
624
+ return W(t);
625
+ }
626
+ get worldY() {
627
+ return c.symbolicfillarea_worldY(this.__wbg_ptr);
628
+ }
629
+ get ifcType() {
630
+ let t, e;
631
+ try {
632
+ const i = c.__wbindgen_add_to_stack_pointer(-16);
633
+ c.symbolicfillarea_ifcType(i, this.__wbg_ptr);
634
+ var n = A().getInt32(i + 0, !0), s = A().getInt32(i + 4, !0);
635
+ return t = n, e = s, J(n, s);
636
+ } finally{
637
+ c.__wbindgen_add_to_stack_pointer(16), c.__wbindgen_export2(t, e, 1);
638
+ }
639
+ }
640
+ }
641
+ Symbol.dispose && (Pt.prototype[Symbol.dispose] = Pt.prototype.free);
642
+ class Ut {
643
+ static __wrap(t) {
644
+ t = t >>> 0;
645
+ const e = Object.create(Ut.prototype);
646
+ return e.__wbg_ptr = t, ye.register(e, e.__wbg_ptr, e), e;
647
+ }
648
+ __destroy_into_raw() {
649
+ const t = this.__wbg_ptr;
650
+ return this.__wbg_ptr = 0, ye.unregister(this), t;
651
+ }
652
+ free() {
653
+ const t = this.__destroy_into_raw();
654
+ c.__wbg_symbolicpolyline_free(t, 0);
655
+ }
656
+ get expressId() {
657
+ return c.symbolicpolyline_expressId(this.__wbg_ptr) >>> 0;
658
+ }
659
+ get pointCount() {
660
+ return c.symbolicfillarea_pointCount(this.__wbg_ptr) >>> 0;
661
+ }
662
+ get repIdentifier() {
663
+ let t, e;
664
+ try {
665
+ const i = c.__wbindgen_add_to_stack_pointer(-16);
666
+ c.symbolicpolyline_repIdentifier(i, this.__wbg_ptr);
667
+ var n = A().getInt32(i + 0, !0), s = A().getInt32(i + 4, !0);
668
+ return t = n, e = s, J(n, s);
669
+ } finally{
670
+ c.__wbindgen_add_to_stack_pointer(16), c.__wbindgen_export2(t, e, 1);
671
+ }
672
+ }
673
+ get points() {
674
+ const t = c.symbolicpolyline_points(this.__wbg_ptr);
675
+ return W(t);
676
+ }
677
+ get worldY() {
678
+ return c.symboliccircle_worldY(this.__wbg_ptr);
679
+ }
680
+ get ifcType() {
681
+ let t, e;
682
+ try {
683
+ const i = c.__wbindgen_add_to_stack_pointer(-16);
684
+ c.symbolicpolyline_ifcType(i, this.__wbg_ptr);
685
+ var n = A().getInt32(i + 0, !0), s = A().getInt32(i + 4, !0);
686
+ return t = n, e = s, J(n, s);
687
+ } finally{
688
+ c.__wbindgen_add_to_stack_pointer(16), c.__wbindgen_export2(t, e, 1);
689
+ }
690
+ }
691
+ get isClosed() {
692
+ return c.symbolicpolyline_isClosed(this.__wbg_ptr) !== 0;
693
+ }
694
+ }
695
+ Symbol.dispose && (Ut.prototype[Symbol.dispose] = Ut.prototype.free);
696
+ class Dt {
697
+ static __wrap(t) {
698
+ t = t >>> 0;
699
+ const e = Object.create(Dt.prototype);
700
+ return e.__wbg_ptr = t, Ee.register(e, e.__wbg_ptr, e), e;
701
+ }
702
+ __destroy_into_raw() {
703
+ const t = this.__wbg_ptr;
704
+ return this.__wbg_ptr = 0, Ee.unregister(this), t;
705
+ }
706
+ free() {
707
+ const t = this.__destroy_into_raw();
708
+ c.__wbg_symbolicrepresentationcollection_free(t, 0);
709
+ }
710
+ get fillCount() {
711
+ return c.symbolicrepresentationcollection_fillCount(this.__wbg_ptr) >>> 0;
712
+ }
713
+ getCircle(t) {
714
+ const e = c.symbolicrepresentationcollection_getCircle(this.__wbg_ptr, t);
715
+ return e === 0 ? void 0 : Bt.__wrap(e);
716
+ }
717
+ get textCount() {
718
+ return c.symbolicrepresentationcollection_textCount(this.__wbg_ptr) >>> 0;
719
+ }
720
+ get totalCount() {
721
+ return c.symbolicrepresentationcollection_totalCount(this.__wbg_ptr) >>> 0;
722
+ }
723
+ get circleCount() {
724
+ return c.symbolicrepresentationcollection_circleCount(this.__wbg_ptr) >>> 0;
725
+ }
726
+ getPolyline(t) {
727
+ const e = c.symbolicrepresentationcollection_getPolyline(this.__wbg_ptr, t);
728
+ return e === 0 ? void 0 : Ut.__wrap(e);
729
+ }
730
+ get polylineCount() {
731
+ return c.symbolicrepresentationcollection_polylineCount(this.__wbg_ptr) >>> 0;
732
+ }
733
+ getExpressIds() {
734
+ try {
735
+ const s = c.__wbindgen_add_to_stack_pointer(-16);
736
+ c.symbolicrepresentationcollection_getExpressIds(s, this.__wbg_ptr);
737
+ var t = A().getInt32(s + 0, !0), e = A().getInt32(s + 4, !0), n = xe(t, e).slice();
738
+ return c.__wbindgen_export2(t, e * 4, 4), n;
739
+ } finally{
740
+ c.__wbindgen_add_to_stack_pointer(16);
741
+ }
742
+ }
743
+ getFill(t) {
744
+ const e = c.symbolicrepresentationcollection_getFill(this.__wbg_ptr, t);
745
+ return e === 0 ? void 0 : Pt.__wrap(e);
746
+ }
747
+ getText(t) {
748
+ const e = c.symbolicrepresentationcollection_getText(this.__wbg_ptr, t);
749
+ return e === 0 ? void 0 : vt.__wrap(e);
750
+ }
751
+ get isEmpty() {
752
+ return c.symbolicrepresentationcollection_isEmpty(this.__wbg_ptr) !== 0;
753
+ }
754
+ }
755
+ Symbol.dispose && (Dt.prototype[Symbol.dispose] = Dt.prototype.free);
756
+ class vt {
757
+ static __wrap(t) {
758
+ t = t >>> 0;
759
+ const e = Object.create(vt.prototype);
760
+ return e.__wbg_ptr = t, me.register(e, e.__wbg_ptr, e), e;
761
+ }
762
+ __destroy_into_raw() {
763
+ const t = this.__wbg_ptr;
764
+ return this.__wbg_ptr = 0, me.unregister(this), t;
765
+ }
766
+ free() {
767
+ const t = this.__destroy_into_raw();
768
+ c.__wbg_symbolictext_free(t, 0);
769
+ }
770
+ get expressId() {
771
+ return c.profileentryjs_expressId(this.__wbg_ptr) >>> 0;
772
+ }
773
+ get repIdentifier() {
774
+ let t, e;
775
+ try {
776
+ const i = c.__wbindgen_add_to_stack_pointer(-16);
777
+ c.symbolictext_repIdentifier(i, this.__wbg_ptr);
778
+ var n = A().getInt32(i + 0, !0), s = A().getInt32(i + 4, !0);
779
+ return t = n, e = s, J(n, s);
780
+ } finally{
781
+ c.__wbindgen_add_to_stack_pointer(16), c.__wbindgen_export2(t, e, 1);
782
+ }
783
+ }
784
+ get x() {
785
+ return c.symbolicfillarea_fillR(this.__wbg_ptr);
786
+ }
787
+ get y() {
788
+ return c.symbolicfillarea_fillG(this.__wbg_ptr);
789
+ }
790
+ get dirX() {
791
+ return c.symbolicfillarea_fillB(this.__wbg_ptr);
792
+ }
793
+ get dirY() {
794
+ return c.symbolicfillarea_fillA(this.__wbg_ptr);
795
+ }
796
+ get height() {
797
+ return c.symbolicfillarea_hatchSpacing(this.__wbg_ptr);
798
+ }
799
+ get colorA() {
800
+ return c.symbolictext_colorA(this.__wbg_ptr);
801
+ }
802
+ get colorB() {
803
+ return c.symbolicfillarea_worldY(this.__wbg_ptr);
804
+ }
805
+ get colorG() {
806
+ return c.symbolicfillarea_hatchLineWidth(this.__wbg_ptr);
807
+ }
808
+ get colorR() {
809
+ return c.symbolicfillarea_hatchAngleSecondary(this.__wbg_ptr);
810
+ }
811
+ get content() {
812
+ let t, e;
813
+ try {
814
+ const i = c.__wbindgen_add_to_stack_pointer(-16);
815
+ c.symbolictext_content(i, this.__wbg_ptr);
816
+ var n = A().getInt32(i + 0, !0), s = A().getInt32(i + 4, !0);
817
+ return t = n, e = s, J(n, s);
818
+ } finally{
819
+ c.__wbindgen_add_to_stack_pointer(16), c.__wbindgen_export2(t, e, 1);
820
+ }
821
+ }
822
+ get worldY() {
823
+ return c.symbolicfillarea_hatchAngle(this.__wbg_ptr);
824
+ }
825
+ get ifcType() {
826
+ let t, e;
827
+ try {
828
+ const i = c.__wbindgen_add_to_stack_pointer(-16);
829
+ c.symbolictext_ifcType(i, this.__wbg_ptr);
830
+ var n = A().getInt32(i + 0, !0), s = A().getInt32(i + 4, !0);
831
+ return t = n, e = s, J(n, s);
832
+ } finally{
833
+ c.__wbindgen_add_to_stack_pointer(16), c.__wbindgen_export2(t, e, 1);
834
+ }
835
+ }
836
+ get alignment() {
837
+ let t, e;
838
+ try {
839
+ const i = c.__wbindgen_add_to_stack_pointer(-16);
840
+ c.symbolictext_alignment(i, this.__wbg_ptr);
841
+ var n = A().getInt32(i + 0, !0), s = A().getInt32(i + 4, !0);
842
+ return t = n, e = s, J(n, s);
843
+ } finally{
844
+ c.__wbindgen_add_to_stack_pointer(16), c.__wbindgen_export2(t, e, 1);
845
+ }
846
+ }
847
+ get targetPx() {
848
+ return c.symbolictext_targetPx(this.__wbg_ptr);
849
+ }
850
+ }
851
+ Symbol.dispose && (vt.prototype[Symbol.dispose] = vt.prototype.free);
852
+ const on = new Set([
853
+ "basic",
854
+ "cors",
855
+ "default"
856
+ ]);
857
+ async function an(r, t) {
858
+ if (typeof Response == "function" && r instanceof Response) {
859
+ if (typeof WebAssembly.instantiateStreaming == "function") try {
860
+ return await WebAssembly.instantiateStreaming(r, t);
861
+ } catch (n) {
862
+ if (r.ok && on.has(r.type) && r.headers.get("Content-Type") !== "application/wasm") console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", n);
863
+ else throw n;
864
+ }
865
+ const e = await r.arrayBuffer();
866
+ return await WebAssembly.instantiate(e, t);
867
+ } else {
868
+ const e = await WebAssembly.instantiate(r, t);
869
+ return e instanceof WebAssembly.Instance ? {
870
+ instance: e,
871
+ module: r
872
+ } : e;
873
+ }
874
+ }
875
+ function cn() {
876
+ const r = {};
877
+ return r.wbg = {}, r.wbg.__wbg_Error_52673b7de5a0ca89 = function(t, e) {
878
+ const n = Error(J(t, e));
879
+ return P(n);
880
+ }, r.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(t) {
881
+ return typeof k(t) == "function";
882
+ }, r.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(t) {
883
+ return k(t) === void 0;
884
+ }, r.wbg.__wbg___wbindgen_memory_a342e963fbcabd68 = function() {
885
+ const t = c.memory;
886
+ return P(t);
887
+ }, r.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(t, e) {
888
+ throw new Error(J(t, e));
889
+ }, r.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(t) {
890
+ k(t)._wbg_cb_unref();
891
+ }, r.wbg.__wbg_call_3020136f7a2d6e44 = function() {
892
+ return Xt(function(t, e, n) {
893
+ const s = k(t).call(k(e), k(n));
894
+ return P(s);
895
+ }, arguments);
896
+ }, r.wbg.__wbg_call_abb4ff46ce38be40 = function() {
897
+ return Xt(function(t, e) {
898
+ const n = k(t).call(k(e));
899
+ return P(n);
900
+ }, arguments);
901
+ }, r.wbg.__wbg_error_7534b8e9a36f1ab4 = function(t, e) {
902
+ let n, s;
903
+ try {
904
+ n = t, s = e, console.error(J(t, e));
905
+ } finally{
906
+ c.__wbindgen_export2(n, s, 1);
907
+ }
908
+ }, r.wbg.__wbg_info_ce6bcc489c22f6f0 = function(t) {
909
+ console.info(k(t));
910
+ }, r.wbg.__wbg_new_1ba21ce319a06297 = function() {
911
+ const t = new Object;
912
+ return P(t);
913
+ }, r.wbg.__wbg_new_25f239778d6112b9 = function() {
914
+ const t = new Array;
915
+ return P(t);
916
+ }, r.wbg.__wbg_new_8a6f238a6ece86ea = function() {
917
+ const t = new Error;
918
+ return P(t);
919
+ }, r.wbg.__wbg_new_ff12d2b041fb48f1 = function(t, e) {
920
+ try {
921
+ var n = {
922
+ a: t,
923
+ b: e
924
+ }, s = (o, a)=>{
925
+ const l = n.a;
926
+ n.a = 0;
927
+ try {
928
+ return rn(l, n.b, o, a);
929
+ } finally{
930
+ n.a = l;
931
+ }
932
+ };
933
+ const i = new Promise(s);
934
+ return P(i);
935
+ } finally{
936
+ n.a = n.b = 0;
937
+ }
938
+ }, r.wbg.__wbg_new_from_slice_41e2764a343e3cb1 = function(t, e) {
939
+ const n = new Float32Array(se(t, e));
940
+ return P(n);
941
+ }, r.wbg.__wbg_new_from_slice_db0691b69e9d3891 = function(t, e) {
942
+ const n = new Uint32Array(xe(t, e));
943
+ return P(n);
944
+ }, r.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(t, e) {
945
+ const n = new Function(J(t, e));
946
+ return P(n);
947
+ }, r.wbg.__wbg_new_with_length_202b3db94ba5fc86 = function(t) {
948
+ const e = new Uint32Array(t >>> 0);
949
+ return P(e);
950
+ }, r.wbg.__wbg_new_with_length_806b9e5b8290af7c = function(t) {
951
+ const e = new Float64Array(t >>> 0);
952
+ return P(e);
953
+ }, r.wbg.__wbg_new_with_length_aa5eaf41d35235e5 = function(t) {
954
+ const e = new Uint8Array(t >>> 0);
955
+ return P(e);
956
+ }, r.wbg.__wbg_queueMicrotask_9b549dfce8865860 = function(t) {
957
+ const e = k(t).queueMicrotask;
958
+ return P(e);
959
+ }, r.wbg.__wbg_queueMicrotask_fca69f5bfad613a5 = function(t) {
960
+ queueMicrotask(k(t));
961
+ }, r.wbg.__wbg_resolve_fd5bfbaa4ce36e1e = function(t) {
962
+ const e = Promise.resolve(k(t));
963
+ return P(e);
964
+ }, r.wbg.__wbg_set_3f1d0b984ed272ed = function(t, e, n) {
965
+ k(t)[W(e)] = W(n);
966
+ }, r.wbg.__wbg_set_781438a03c0c3c81 = function() {
967
+ return Xt(function(t, e, n) {
968
+ return Reflect.set(k(t), k(e), k(n));
969
+ }, arguments);
970
+ }, r.wbg.__wbg_set_7df433eea03a5c14 = function(t, e, n) {
971
+ k(t)[e >>> 0] = W(n);
972
+ }, r.wbg.__wbg_set_index_021489b2916af13e = function(t, e, n) {
973
+ k(t)[e >>> 0] = n;
974
+ }, r.wbg.__wbg_set_index_04c4b93e64d08a52 = function(t, e, n) {
975
+ k(t)[e >>> 0] = n;
976
+ }, r.wbg.__wbg_set_index_42abe35f117e614e = function(t, e, n) {
977
+ k(t)[e >>> 0] = n >>> 0;
978
+ }, r.wbg.__wbg_stack_0ed75d68575b0f3c = function(t, e) {
979
+ const n = k(e).stack, s = gt(n, c.__wbindgen_export3, c.__wbindgen_export4), i = Y;
980
+ A().setInt32(t + 4, i, !0), A().setInt32(t + 0, s, !0);
981
+ }, r.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
982
+ const t = typeof global > "u" ? null : global;
983
+ return $t(t) ? 0 : P(t);
984
+ }, r.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
985
+ const t = typeof globalThis > "u" ? null : globalThis;
986
+ return $t(t) ? 0 : P(t);
987
+ }, r.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
988
+ const t = typeof self > "u" ? null : self;
989
+ return $t(t) ? 0 : P(t);
990
+ }, r.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
991
+ const t = typeof window > "u" ? null : window;
992
+ return $t(t) ? 0 : P(t);
993
+ }, r.wbg.__wbg_then_4f95312d68691235 = function(t, e) {
994
+ const n = k(t).then(k(e));
995
+ return P(n);
996
+ }, r.wbg.__wbg_warn_6e567d0d926ff881 = function(t) {
997
+ console.warn(k(t));
998
+ }, r.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(t, e) {
999
+ const n = J(t, e);
1000
+ return P(n);
1001
+ }, r.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(t) {
1002
+ const e = BigInt.asUintN(64, t);
1003
+ return P(e);
1004
+ }, r.wbg.__wbindgen_cast_89b0435615caf0ab = function(t, e) {
1005
+ const n = tn(t, e, c.__wasm_bindgen_func_elem_1684, sn);
1006
+ return P(n);
1007
+ }, r.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(t) {
1008
+ return P(t);
1009
+ }, r.wbg.__wbindgen_object_clone_ref = function(t) {
1010
+ const e = k(t);
1011
+ return P(e);
1012
+ }, r.wbg.__wbindgen_object_drop_ref = function(t) {
1013
+ W(t);
1014
+ }, r;
1015
+ }
1016
+ function ln(r, t) {
1017
+ return c = r.exports, Pe.__wbindgen_wasm_module = t, It = null, Tt = null, wt = null, Ft = null, Rt = null, c.__wbindgen_start(), c;
1018
+ }
1019
+ Pe = async function(r) {
1020
+ if (c !== void 0) return c;
1021
+ typeof r < "u" && (Object.getPrototypeOf(r) === Object.prototype ? { module_or_path: r } = r : console.warn("using deprecated parameters for the initialization function; pass a single object instead")), typeof r > "u" && (r = new URL("/assets/ifc-lite_bg-ksLBP5cA.wasm", import.meta.url));
1022
+ const t = cn();
1023
+ (typeof r == "string" || typeof Request == "function" && r instanceof Request || typeof URL == "function" && r instanceof URL) && (r = fetch(r));
1024
+ const { instance: e, module: n } = await an(await r, t);
1025
+ return ln(e, n);
1026
+ };
1027
+ const ct = Ge("Geometry"), dn = "IFC-Lite WASM cannot recover from a fatal runtime error within the same document lifetime. Reload the page or recreate the worker process before calling init() again.";
1028
+ let Qt = null;
1029
+ class fn {
1030
+ ifcApi = null;
1031
+ initialized = !1;
1032
+ mergeLayers = !1;
1033
+ isWasmRuntimeError(t) {
1034
+ return t instanceof WebAssembly.RuntimeError;
1035
+ }
1036
+ markFatalWasmRuntimeError() {
1037
+ Qt = new Error(dn), this.reset();
1038
+ }
1039
+ async init() {
1040
+ if (!this.initialized) {
1041
+ if (Qt) throw Qt;
1042
+ try {
1043
+ await Pe(), ct.debug("Geometry processing: single-threaded WASM (N-worker pool handles parallelism)"), this.ifcApi = new ie, this.applyMergeLayers(), this.initialized = !0, ct.info("WASM geometry engine initialized");
1044
+ } catch (t) {
1045
+ throw ct.error("Failed to initialize WASM geometry engine", t, {
1046
+ operation: "init"
1047
+ }), this.isWasmRuntimeError(t) ? this.markFatalWasmRuntimeError() : this.reset(), t;
1048
+ }
1049
+ }
1050
+ }
1051
+ reset() {
1052
+ this.initialized = !1, this.ifcApi = null;
1053
+ }
1054
+ parseSymbolicRepresentations(t) {
1055
+ if (!this.ifcApi) throw new Error("IFC-Lite not initialized. Call init() first.");
1056
+ try {
1057
+ const e = this.ifcApi.parseSymbolicRepresentations(t);
1058
+ return ct.debug(`Parsed ${e.totalCount} symbolic items (${e.polylineCount} polylines, ${e.circleCount} circles)`, {
1059
+ operation: "parseSymbolicRepresentations"
1060
+ }), e;
1061
+ } catch (e) {
1062
+ throw ct.error("Failed to parse symbolic representations", e, {
1063
+ operation: "parseSymbolicRepresentations",
1064
+ data: {
1065
+ contentLength: t.length
1066
+ }
1067
+ }), this.isWasmRuntimeError(e) && this.markFatalWasmRuntimeError(), e;
1068
+ }
1069
+ }
1070
+ extractProfiles(t, e = 0) {
1071
+ if (!this.ifcApi) throw new Error("IFC-Lite not initialized. Call init() first.");
1072
+ try {
1073
+ const n = this.ifcApi.extractProfiles(t, e);
1074
+ return ct.debug(`Extracted ${n.length} profiles`, {
1075
+ operation: "extractProfiles"
1076
+ }), n;
1077
+ } catch (n) {
1078
+ throw ct.error("Failed to extract profiles", n, {
1079
+ operation: "extractProfiles",
1080
+ data: {
1081
+ contentLength: t.length
1082
+ }
1083
+ }), this.isWasmRuntimeError(n) && this.markFatalWasmRuntimeError(), n;
1084
+ }
1085
+ }
1086
+ getApi() {
1087
+ if (!this.ifcApi) throw new Error("IFC-Lite not initialized. Call init() first.");
1088
+ return this.ifcApi;
1089
+ }
1090
+ isInitialized() {
1091
+ return this.initialized;
1092
+ }
1093
+ getVersion() {
1094
+ return this.ifcApi?.version ?? "unknown";
1095
+ }
1096
+ setMergeLayers(t) {
1097
+ this.mergeLayers = t, this.ifcApi && this.applyMergeLayers();
1098
+ }
1099
+ getMergeLayers() {
1100
+ return this.mergeLayers;
1101
+ }
1102
+ applyMergeLayers() {
1103
+ if (!this.ifcApi) return;
1104
+ const t = this.ifcApi;
1105
+ if (typeof t.setMergeLayers != "function") {
1106
+ ct.warn("setMergeLayers not present on WASM API — flag tracked but suppression is a no-op until WASM is rebuilt", {
1107
+ operation: "setMergeLayers",
1108
+ data: {
1109
+ requested: this.mergeLayers
1110
+ }
1111
+ });
1112
+ return;
1113
+ }
1114
+ t.setMergeLayers(this.mergeLayers), ct.debug(`mergeLayers=${this.mergeLayers}`, {
1115
+ operation: "setMergeLayers"
1116
+ });
1117
+ }
1118
+ }
1119
+ function Ue() {
1120
+ return typeof window < "u" && "__TAURI_INTERNALS__" in window;
1121
+ }
1122
+ async function un() {
1123
+ if (Ue()) {
1124
+ const { NativeBridge: r } = await $e(async ()=>{
1125
+ const { NativeBridge: t } = await import("./native-bridge-RvDmzO-2.js").then(async (m)=>{
1126
+ await m.__tla;
1127
+ return m;
1128
+ });
1129
+ return {
1130
+ NativeBridge: t
1131
+ };
1132
+ }, __vite__mapDeps([0,1,2]));
1133
+ return new r;
1134
+ }
1135
+ throw new Error("createPlatformBridge() is native-only; the browser uses the WASM GeometryProcessor path directly.");
1136
+ }
1137
+ class hn {
1138
+ buildInterleavedBuffer(t) {
1139
+ const e = t.positions.length / 3, n = new Float32Array(e * 6);
1140
+ for(let s = 0; s < e; s++){
1141
+ const i = s * 6, o = s * 3, a = s * 3;
1142
+ n[i] = t.positions[o], n[i + 1] = t.positions[o + 1], n[i + 2] = t.positions[o + 2], n[i + 3] = t.normals[a], n[i + 4] = t.normals[a + 1], n[i + 5] = t.normals[a + 2];
1143
+ }
1144
+ return n;
1145
+ }
1146
+ processMeshes(t) {
1147
+ let e = 0, n = 0;
1148
+ for (const s of t)e += s.indices.length / 3, n += s.positions.length / 3;
1149
+ return {
1150
+ meshes: t,
1151
+ totalTriangles: e,
1152
+ totalVertices: n
1153
+ };
1154
+ }
1155
+ }
1156
+ class pn {
1157
+ originShift = {
1158
+ x: 0,
1159
+ y: 0,
1160
+ z: 0
1161
+ };
1162
+ THRESHOLD = 1e4;
1163
+ MAX_REASONABLE_COORD = 1e7;
1164
+ accumulatedBounds = null;
1165
+ shiftCalculated = !1;
1166
+ wasmRtcDetected = !1;
1167
+ NORMAL_COORD_THRESHOLD = 1e4;
1168
+ activeThreshold = 1e7;
1169
+ isReasonableValue(t) {
1170
+ return Number.isFinite(t) && Math.abs(t) < this.MAX_REASONABLE_COORD;
1171
+ }
1172
+ calculateBounds(t, e) {
1173
+ if (this.wasmRtcDetected && this.shiftCalculated) return this.calculateBoundsFast(t);
1174
+ const n = {
1175
+ min: {
1176
+ x: 1 / 0,
1177
+ y: 1 / 0,
1178
+ z: 1 / 0
1179
+ },
1180
+ max: {
1181
+ x: -1 / 0,
1182
+ y: -1 / 0,
1183
+ z: -1 / 0
1184
+ }
1185
+ }, s = e ?? this.MAX_REASONABLE_COORD;
1186
+ for (const i of t){
1187
+ const o = i.positions;
1188
+ for(let a = 0; a < o.length; a += 3){
1189
+ const l = o[a], d = o[a + 1], u = o[a + 2];
1190
+ Number.isFinite(l) && Number.isFinite(d) && Number.isFinite(u) && Math.abs(l) < s && Math.abs(d) < s && Math.abs(u) < s && (n.min.x = Math.min(n.min.x, l), n.min.y = Math.min(n.min.y, d), n.min.z = Math.min(n.min.z, u), n.max.x = Math.max(n.max.x, l), n.max.y = Math.max(n.max.y, d), n.max.z = Math.max(n.max.z, u));
1191
+ }
1192
+ }
1193
+ return n;
1194
+ }
1195
+ calculateBoundsFast(t) {
1196
+ let e = 1 / 0, n = 1 / 0, s = 1 / 0, i = -1 / 0, o = -1 / 0, a = -1 / 0;
1197
+ for (const l of t){
1198
+ const d = l.positions, u = d.length;
1199
+ if (u < 3) continue;
1200
+ const f = d[0], p = d[1], _ = d[2];
1201
+ if (f < e && (e = f), p < n && (n = p), _ < s && (s = _), f > i && (i = f), p > o && (o = p), _ > a && (a = _), u >= 6) {
1202
+ const h = d[u - 3], y = d[u - 2], m = d[u - 1];
1203
+ h < e && (e = h), y < n && (n = y), m < s && (s = m), h > i && (i = h), y > o && (o = y), m > a && (a = m);
1204
+ }
1205
+ }
1206
+ return {
1207
+ min: {
1208
+ x: e,
1209
+ y: n,
1210
+ z: s
1211
+ },
1212
+ max: {
1213
+ x: i,
1214
+ y: o,
1215
+ z: a
1216
+ }
1217
+ };
1218
+ }
1219
+ needsShift(t) {
1220
+ return Math.max(Math.abs(t.min.x), Math.abs(t.max.x), Math.abs(t.min.y), Math.abs(t.max.y), Math.abs(t.min.z), Math.abs(t.max.z)) > this.THRESHOLD;
1221
+ }
1222
+ calculateCentroid(t) {
1223
+ return {
1224
+ x: (t.min.x + t.max.x) / 2,
1225
+ y: (t.min.y + t.max.y) / 2,
1226
+ z: (t.min.z + t.max.z) / 2
1227
+ };
1228
+ }
1229
+ shiftPositions(t, e, n) {
1230
+ const s = n ?? this.MAX_REASONABLE_COORD;
1231
+ for(let i = 0; i < t.length; i += 3){
1232
+ const o = t[i], a = t[i + 1], l = t[i + 2];
1233
+ Number.isFinite(o) && Number.isFinite(a) && Number.isFinite(l) && Math.abs(o) < s && Math.abs(a) < s && Math.abs(l) < s ? (t[i] = o - e.x, t[i + 1] = a - e.y, t[i + 2] = l - e.z) : (t[i] = 0, t[i + 1] = 0, t[i + 2] = 0);
1234
+ }
1235
+ }
1236
+ shiftBounds(t, e) {
1237
+ return {
1238
+ min: {
1239
+ x: t.min.x - e.x,
1240
+ y: t.min.y - e.y,
1241
+ z: t.min.z - e.z
1242
+ },
1243
+ max: {
1244
+ x: t.max.x - e.x,
1245
+ y: t.max.y - e.y,
1246
+ z: t.max.z - e.z
1247
+ }
1248
+ };
1249
+ }
1250
+ processMeshes(t) {
1251
+ const e = {
1252
+ originShift: {
1253
+ x: 0,
1254
+ y: 0,
1255
+ z: 0
1256
+ },
1257
+ originalBounds: {
1258
+ min: {
1259
+ x: 0,
1260
+ y: 0,
1261
+ z: 0
1262
+ },
1263
+ max: {
1264
+ x: 0,
1265
+ y: 0,
1266
+ z: 0
1267
+ }
1268
+ },
1269
+ shiftedBounds: {
1270
+ min: {
1271
+ x: 0,
1272
+ y: 0,
1273
+ z: 0
1274
+ },
1275
+ max: {
1276
+ x: 0,
1277
+ y: 0,
1278
+ z: 0
1279
+ }
1280
+ },
1281
+ hasLargeCoordinates: !1
1282
+ };
1283
+ if (t.length === 0) return e;
1284
+ const n = this.calculateBounds(t);
1285
+ if (!(n.min.x !== 1 / 0 && n.max.x !== -1 / 0)) return console.warn("[CoordinateHandler] No valid coordinates found in geometry"), e;
1286
+ if (n.max.x - n.min.x, n.max.y - n.min.y, n.max.z - n.min.z, !this.needsShift(n)) {
1287
+ const l = {
1288
+ x: 0,
1289
+ y: 0,
1290
+ z: 0
1291
+ };
1292
+ for (const d of t)this.shiftPositions(d.positions, l);
1293
+ return {
1294
+ originShift: l,
1295
+ originalBounds: n,
1296
+ shiftedBounds: n,
1297
+ hasLargeCoordinates: !1
1298
+ };
1299
+ }
1300
+ const o = this.calculateCentroid(n);
1301
+ this.originShift = o;
1302
+ for (const l of t)this.shiftPositions(l.positions, o);
1303
+ const a = this.shiftBounds(n, o);
1304
+ return {
1305
+ originShift: o,
1306
+ originalBounds: n,
1307
+ shiftedBounds: a,
1308
+ hasLargeCoordinates: !0
1309
+ };
1310
+ }
1311
+ toWorldCoordinates(t) {
1312
+ return {
1313
+ x: t.x + this.originShift.x,
1314
+ y: t.y + this.originShift.y,
1315
+ z: t.z + this.originShift.z
1316
+ };
1317
+ }
1318
+ toLocalCoordinates(t) {
1319
+ return {
1320
+ x: t.x - this.originShift.x,
1321
+ y: t.y - this.originShift.y,
1322
+ z: t.z - this.originShift.z
1323
+ };
1324
+ }
1325
+ getOriginShift() {
1326
+ return {
1327
+ ...this.originShift
1328
+ };
1329
+ }
1330
+ processMeshesIncremental(t) {
1331
+ this.activeThreshold = this.wasmRtcDetected ? this.NORMAL_COORD_THRESHOLD : this.MAX_REASONABLE_COORD;
1332
+ const e = this.calculateBounds(t, this.activeThreshold);
1333
+ if (this.accumulatedBounds === null ? this.accumulatedBounds = e : (this.accumulatedBounds.min.x = Math.min(this.accumulatedBounds.min.x, e.min.x), this.accumulatedBounds.min.y = Math.min(this.accumulatedBounds.min.y, e.min.y), this.accumulatedBounds.min.z = Math.min(this.accumulatedBounds.min.z, e.min.z), this.accumulatedBounds.max.x = Math.max(this.accumulatedBounds.max.x, e.max.x), this.accumulatedBounds.max.y = Math.max(this.accumulatedBounds.max.y, e.max.y), this.accumulatedBounds.max.z = Math.max(this.accumulatedBounds.max.z, e.max.z)), !this.shiftCalculated && this.accumulatedBounds) {
1334
+ if (this.accumulatedBounds.min.x !== 1 / 0 && this.accumulatedBounds.max.x !== -1 / 0) {
1335
+ const s = {
1336
+ x: this.accumulatedBounds.max.x - this.accumulatedBounds.min.x,
1337
+ y: this.accumulatedBounds.max.y - this.accumulatedBounds.min.y,
1338
+ z: this.accumulatedBounds.max.z - this.accumulatedBounds.min.z
1339
+ }, i = Math.max(s.x, s.y, s.z), o = this.calculateCentroid(this.accumulatedBounds), a = Math.sqrt(o.x ** 2 + o.y ** 2 + o.z ** 2);
1340
+ let l = 0, d = 0;
1341
+ const u = this.THRESHOLD;
1342
+ for (const _ of t){
1343
+ const h = _.positions;
1344
+ if (h.length >= 3) {
1345
+ const y = Math.abs(h[0]), m = Math.abs(h[1]), b = Math.abs(h[2]);
1346
+ Math.max(y, m, b) < u ? l++ : d++;
1347
+ }
1348
+ }
1349
+ const f = l + d, p = f > 0 && l / f > .5;
1350
+ p && (this.wasmRtcDetected = !0, this.accumulatedBounds = this.calculateBounds(t, this.NORMAL_COORD_THRESHOLD)), (a > this.THRESHOLD || i > this.THRESHOLD) && !p && (this.originShift = o);
1351
+ }
1352
+ this.shiftCalculated = !0;
1353
+ }
1354
+ if (this.originShift.x !== 0 || this.originShift.y !== 0 || this.originShift.z !== 0) for (const n of t)this.shiftPositions(n.positions, this.originShift, this.activeThreshold);
1355
+ }
1356
+ processTrustedMeshesIncremental(t) {
1357
+ const e = this.calculateBoundsFast(t);
1358
+ e.min.x !== 1 / 0 && e.max.x !== -1 / 0 && (this.accumulatedBounds === null ? this.accumulatedBounds = e : (this.accumulatedBounds.min.x = Math.min(this.accumulatedBounds.min.x, e.min.x), this.accumulatedBounds.min.y = Math.min(this.accumulatedBounds.min.y, e.min.y), this.accumulatedBounds.min.z = Math.min(this.accumulatedBounds.min.z, e.min.z), this.accumulatedBounds.max.x = Math.max(this.accumulatedBounds.max.x, e.max.x), this.accumulatedBounds.max.y = Math.max(this.accumulatedBounds.max.y, e.max.y), this.accumulatedBounds.max.z = Math.max(this.accumulatedBounds.max.z, e.max.z)), this.originShift = {
1359
+ x: 0,
1360
+ y: 0,
1361
+ z: 0
1362
+ }, this.wasmRtcDetected = !0, this.shiftCalculated = !0, this.activeThreshold = this.NORMAL_COORD_THRESHOLD);
1363
+ }
1364
+ getCurrentCoordinateInfo() {
1365
+ if (!this.accumulatedBounds || !(this.accumulatedBounds.min.x !== 1 / 0 && this.accumulatedBounds.max.x !== -1 / 0)) return null;
1366
+ const e = this.shiftBounds(this.accumulatedBounds, this.originShift), n = this.originShift.x !== 0 || this.originShift.y !== 0 || this.originShift.z !== 0;
1367
+ return {
1368
+ originShift: {
1369
+ ...this.originShift
1370
+ },
1371
+ originalBounds: {
1372
+ ...this.accumulatedBounds
1373
+ },
1374
+ shiftedBounds: e,
1375
+ hasLargeCoordinates: n
1376
+ };
1377
+ }
1378
+ getFinalCoordinateInfo() {
1379
+ const t = this.getCurrentCoordinateInfo();
1380
+ return t || {
1381
+ originShift: {
1382
+ x: 0,
1383
+ y: 0,
1384
+ z: 0
1385
+ },
1386
+ originalBounds: {
1387
+ min: {
1388
+ x: 0,
1389
+ y: 0,
1390
+ z: 0
1391
+ },
1392
+ max: {
1393
+ x: 0,
1394
+ y: 0,
1395
+ z: 0
1396
+ }
1397
+ },
1398
+ shiftedBounds: {
1399
+ min: {
1400
+ x: 0,
1401
+ y: 0,
1402
+ z: 0
1403
+ },
1404
+ max: {
1405
+ x: 0,
1406
+ y: 0,
1407
+ z: 0
1408
+ }
1409
+ },
1410
+ hasLargeCoordinates: !1
1411
+ };
1412
+ }
1413
+ reset() {
1414
+ this.accumulatedBounds = null, this.shiftCalculated = !1, this.originShift = {
1415
+ x: 0,
1416
+ y: 0,
1417
+ z: 0
1418
+ }, this.wasmRtcDetected = !1, this.activeThreshold = this.MAX_REASONABLE_COORD;
1419
+ }
1420
+ }
1421
+ In = ((r)=>(r.Fast = "fast", r.Balanced = "balanced", r.High = "high", r))(In || {});
1422
+ function gn(r) {
1423
+ const t = Math.max(0, r.fileSizeMB), e = Math.max(1, Math.floor(r.cores)), n = Math.max(1, r.deviceMemoryGB), s = e >= 10 ? Math.max(n, 16) : n, i = Math.max(0, Math.floor(r.totalJobs)), o = Math.max(1, Math.floor(r.minWorkers ?? 1)), a = Math.max(o, Math.floor(r.maxWorkers ?? 8));
1424
+ if (i === 0) return {
1425
+ count: 0,
1426
+ reason: "jobs"
1427
+ };
1428
+ let l;
1429
+ e >= 16 && s >= 16 ? l = Math.min(a, Math.floor(e / 2)) : e >= 12 && s >= 8 ? l = t > 512 ? 4 : 5 : e >= 10 && s >= 8 ? l = t > 512 ? 3 : 4 : e >= 8 && s >= 8 ? l = t > 512 ? 2 : 3 : l = Math.max(1, Math.min(2, Math.floor(e / 2)));
1430
+ const d = s * 1024, u = Math.max(1024, d * .25), f = t * 2.5, p = Math.max(64, t * 1.5), _ = d - u - f, h = _ > 0 ? Math.max(1, Math.floor(_ / p)) : 1, y = [
1431
+ {
1432
+ value: l,
1433
+ reason: "cores"
1434
+ },
1435
+ {
1436
+ value: h,
1437
+ reason: "memory"
1438
+ },
1439
+ {
1440
+ value: i,
1441
+ reason: "jobs"
1442
+ },
1443
+ {
1444
+ value: a,
1445
+ reason: "max"
1446
+ }
1447
+ ];
1448
+ let m = y[0];
1449
+ for(let b = 1; b < y.length; b++)y[b].value < m.value && (m = y[b]);
1450
+ return m.value < o ? {
1451
+ count: o,
1452
+ reason: "min"
1453
+ } : {
1454
+ count: m.value,
1455
+ reason: m.reason
1456
+ };
1457
+ }
1458
+ function _n(r) {
1459
+ return gn(r).count;
1460
+ }
1461
+ const yn = 3e4, En = 15e3, mn = 15e3, Cn = 5e3, bn = 60, Tn = 30, wn = 30, Fn = 15;
1462
+ ns = function(r) {
1463
+ const t = r.desktopStableWasm === !0, e = Math.max(0, Math.floor(r.batchCount)), n = Math.max(0, r.fileSizeMB), s = e > 0 ? t ? Cn : mn : t ? En : yn, i = e > 0 ? t ? Fn : wn : t ? Tn : bn;
1464
+ return Math.max(s, Math.round(s + n * i));
1465
+ };
1466
+ function Rn(r, t) {
1467
+ if (typeof t == "number") return t;
1468
+ const e = t.fileSizeMB ? t.fileSizeMB : r.length / (1024 * 1024);
1469
+ return e < 10 ? 100 : e < 50 ? 200 : e < 100 ? 300 : e < 300 ? 500 : e < 500 ? 1500 : 3e3;
1470
+ }
1471
+ function Ce(r) {
1472
+ const t = [];
1473
+ try {
1474
+ for(let e = 0; e < r.length; e++){
1475
+ const n = r.get(e);
1476
+ if (n) try {
1477
+ const s = n.shadingColor, i = s && s.length === 4 ? [
1478
+ s[0],
1479
+ s[1],
1480
+ s[2],
1481
+ s[3]
1482
+ ] : void 0;
1483
+ t.push({
1484
+ expressId: n.expressId,
1485
+ ifcType: n.ifcType,
1486
+ positions: n.positions,
1487
+ normals: n.normals,
1488
+ indices: n.indices,
1489
+ color: [
1490
+ n.color[0],
1491
+ n.color[1],
1492
+ n.color[2],
1493
+ n.color[3]
1494
+ ],
1495
+ ...i ? {
1496
+ shadingColor: i
1497
+ } : {}
1498
+ });
1499
+ } finally{
1500
+ n.free();
1501
+ }
1502
+ }
1503
+ } finally{
1504
+ r.free();
1505
+ }
1506
+ return t;
1507
+ }
1508
+ function Vt(r, t) {
1509
+ return t !== void 0 ? {
1510
+ ...r,
1511
+ buildingRotation: t
1512
+ } : r;
1513
+ }
1514
+ const Nn = 8, Sn = 32768, An = 4, On = 8192, Ln = 10;
1515
+ function be() {
1516
+ const r = globalThis.scheduler;
1517
+ return typeof r?.yield == "function" ? r.yield() : new Promise((t)=>{
1518
+ globalThis.setTimeout(t, 0);
1519
+ });
1520
+ }
1521
+ function Te(r, t, e) {
1522
+ if (t.type === "colorUpdate") {
1523
+ const i = r[r.length - 1];
1524
+ if (i?.type === "colorUpdate") {
1525
+ for (const [o, a] of t.updates)i.updates.set(o, a);
1526
+ return;
1527
+ }
1528
+ r.push(t);
1529
+ return;
1530
+ }
1531
+ const n = r[r.length - 1];
1532
+ if (n?.type === "batch" && (r.length >= Nn || e.queuedMeshes >= Sn)) {
1533
+ for(let i = 0; i < t.meshes.length; i++)n.meshes.push(t.meshes[i]);
1534
+ n.nativeTelemetry = t.nativeTelemetry, e.coalescedBatchCount += 1;
1535
+ } else r.push(t);
1536
+ e.queuedMeshes += t.meshes.length;
1537
+ }
1538
+ async function* we(r, t, e, n) {
1539
+ e.reset(), yield {
1540
+ type: "start",
1541
+ totalEstimate: t
1542
+ }, await be(), yield {
1543
+ type: "model-open",
1544
+ modelID: 0
1545
+ };
1546
+ const s = [], i = {
1547
+ queuedMeshes: 0,
1548
+ coalescedBatchCount: 0
1549
+ };
1550
+ let o = null, a = !1, l = null, d, u = 0;
1551
+ const f = ()=>{
1552
+ o && (o(), o = null);
1553
+ }, p = r({
1554
+ onBatch: (h)=>{
1555
+ Te(s, {
1556
+ type: "batch",
1557
+ meshes: h.meshes,
1558
+ nativeTelemetry: h.nativeTelemetry
1559
+ }, i), f();
1560
+ },
1561
+ onColorUpdate: (h)=>{
1562
+ Te(s, {
1563
+ type: "colorUpdate",
1564
+ updates: new Map(h)
1565
+ }, i), f();
1566
+ },
1567
+ onComplete: (h)=>{
1568
+ n(h), d = h.totalMeshes, a = !0, f();
1569
+ },
1570
+ onError: (h)=>{
1571
+ l = h, a = !0, f();
1572
+ }
1573
+ });
1574
+ for(; !a || s.length > 0;){
1575
+ let h = 0, y = 0, m = performance.now();
1576
+ for(; s.length > 0;){
1577
+ const b = s.shift();
1578
+ if (b.type === "colorUpdate") {
1579
+ yield {
1580
+ type: "colorUpdate",
1581
+ updates: b.updates
1582
+ };
1583
+ continue;
1584
+ }
1585
+ i.queuedMeshes = Math.max(0, i.queuedMeshes - b.meshes.length), e.processTrustedMeshesIncremental(b.meshes), u += b.meshes.length;
1586
+ const w = e.getCurrentCoordinateInfo();
1587
+ yield {
1588
+ type: "batch",
1589
+ meshes: b.meshes,
1590
+ totalSoFar: u,
1591
+ coordinateInfo: w || void 0,
1592
+ nativeTelemetry: b.nativeTelemetry
1593
+ }, h += 1, y += b.meshes.length, s.length > 0 && (h >= An || y >= On || performance.now() - m >= Ln) && (await be(), h = 0, y = 0, m = performance.now());
1594
+ }
1595
+ if (l) throw l;
1596
+ a || await new Promise((b)=>{
1597
+ o = b;
1598
+ });
1599
+ }
1600
+ await p, i.coalescedBatchCount > 0 && console.info(`[GeometryProcessor] Coalesced ${i.coalescedBatchCount} native batches while JS drained the queue`);
1601
+ const _ = e.getFinalCoordinateInfo();
1602
+ yield {
1603
+ type: "complete",
1604
+ totalMeshes: d ?? u,
1605
+ coordinateInfo: _
1606
+ };
1607
+ }
1608
+ async function* Mn(r, t, e, n, s) {
1609
+ t.reset(), yield {
1610
+ type: "start",
1611
+ totalEstimate: r.length / 1e3
1612
+ }, yield {
1613
+ type: "model-open",
1614
+ modelID: 0
1615
+ };
1616
+ let i;
1617
+ const o = r.buffer;
1618
+ n && n.byteLength === r.byteLength ? i = n : typeof SharedArrayBuffer < "u" && o instanceof SharedArrayBuffer && r.byteOffset === 0 && r.byteLength === o.byteLength ? i = o : (i = new SharedArrayBuffer(r.byteLength), new Uint8Array(i).set(r));
1619
+ const a = ()=>new Worker(new URL("/assets/geometry.worker-Cyn5BybV.js", import.meta.url), {
1620
+ type: "module"
1621
+ }), l = ()=>new Worker(new URL("/assets/geometry.worker-Cyn5BybV.js", import.meta.url), {
1622
+ type: "module"
1623
+ }), d = [];
1624
+ let u = null;
1625
+ const f = ()=>{
1626
+ u && (u(), u = null);
1627
+ };
1628
+ let p = null, _ = 0, h = !1, y = null, m = null, b = 0, w = 0, v = !1, L = !1;
1629
+ const j = [];
1630
+ let O = !1, U = !1;
1631
+ const C = [], N = (M, X)=>{
1632
+ M.onmessage = (B)=>{
1633
+ const x = B.data;
1634
+ if (x.type === "ready") {
1635
+ console.log(`[stream] worker[${X}] WASM ready @ ${Q()}ms`);
1636
+ return;
1637
+ }
1638
+ if (x.type === "memory") {
1639
+ d.push({
1640
+ type: "workerMemory",
1641
+ workerIndex: X,
1642
+ wasmHeapBytes: x.wasmHeapBytes,
1643
+ meshBytes: x.meshBytes
1644
+ }), f();
1645
+ return;
1646
+ }
1647
+ if (x.type === "batch") {
1648
+ C[X] === void 0 && (C[X] = Q(), console.log(`[stream] worker[${X}] first batch @ ${Q()}ms (${x.meshes?.length ?? 0} meshes)`));
1649
+ const q = x.meshes.map((D)=>({
1650
+ expressId: D.expressId,
1651
+ ifcType: D.ifcType,
1652
+ positions: D.positions instanceof Float32Array ? D.positions : new Float32Array(D.positions),
1653
+ normals: D.normals instanceof Float32Array ? D.normals : new Float32Array(D.normals),
1654
+ indices: D.indices instanceof Uint32Array ? D.indices : new Uint32Array(D.indices),
1655
+ color: D.color
1656
+ }));
1657
+ if (q.length > 0) {
1658
+ w += q.length, t.processMeshesIncremental(q);
1659
+ const D = t.getCurrentCoordinateInfo();
1660
+ d.push({
1661
+ type: "batch",
1662
+ meshes: q,
1663
+ totalSoFar: w,
1664
+ coordinateInfo: D || void 0
1665
+ }), f();
1666
+ }
1667
+ return;
1668
+ }
1669
+ if (x.type === "complete") {
1670
+ b++, M.terminate(), f();
1671
+ return;
1672
+ }
1673
+ if (x.type === "error") {
1674
+ m = new Error(`Geometry worker error: ${x.message}`), b++, M.terminate(), f();
1675
+ return;
1676
+ }
1677
+ }, M.onerror = (B)=>{
1678
+ m = new Error(`Geometry worker failed: ${B.message}`), b++, M.terminate(), f();
1679
+ };
1680
+ }, F = typeof navigator < "u" ? navigator.hardwareConcurrency ?? 2 : 2, E = typeof navigator < "u" ? navigator.deviceMemory ?? 8 : 8, g = r.byteLength / (1024 * 1024), T = Math.max(1, Math.ceil(g * 100)), I = _n({
1681
+ fileSizeMB: g,
1682
+ cores: F,
1683
+ deviceMemoryGB: E,
1684
+ totalJobs: T
1685
+ }), R = [];
1686
+ for(let M = 0; M < I; M++){
1687
+ const X = a();
1688
+ R.push(X), N(X, M);
1689
+ const B = s?.wasmUrls?.wasm;
1690
+ X.postMessage({
1691
+ type: "init",
1692
+ ...B ? {
1693
+ wasmUrl: B
1694
+ } : {}
1695
+ }), X.postMessage({
1696
+ type: "set-merge-layers",
1697
+ enabled: s?.mergeLayers === !0
1698
+ });
1699
+ }
1700
+ const S = ()=>{
1701
+ if (!v) {
1702
+ v = !0;
1703
+ for (const M of R)try {
1704
+ M.postMessage({
1705
+ type: "stream-end"
1706
+ });
1707
+ } catch {}
1708
+ }
1709
+ }, G = ()=>{
1710
+ if (L || !p) return;
1711
+ L = !0;
1712
+ const M = e != null, X = M ? e.x : p.rtcOffset[0], B = M ? e.y : p.rtcOffset[1], x = M ? e.z : p.rtcOffset[2], q = M ? !0 : p.needsShift;
1713
+ d.push({
1714
+ type: "rtcOffset",
1715
+ rtcOffset: {
1716
+ x: X,
1717
+ y: B,
1718
+ z: x
1719
+ },
1720
+ hasRtc: q
1721
+ }), f();
1722
+ const D = new Uint32Array(0), nt = new Uint8Array(0);
1723
+ for (const ht of R)ht.postMessage({
1724
+ type: "stream-start",
1725
+ sharedBuffer: i,
1726
+ unitScale: p.unitScale,
1727
+ rtcX: X,
1728
+ rtcY: B,
1729
+ rtcZ: x,
1730
+ needsShift: q,
1731
+ voidKeys: D,
1732
+ voidCounts: D,
1733
+ voidValues: D,
1734
+ styleIds: D,
1735
+ styleColors: nt
1736
+ });
1737
+ };
1738
+ function $(M) {
1739
+ if (R.length === 0 || M.length === 0) return;
1740
+ const X = Math.floor(M.length / 3);
1741
+ if (X === 0) return;
1742
+ const B = Math.ceil(X / R.length);
1743
+ try {
1744
+ for(let x = 0; x < R.length; x++){
1745
+ const q = x * B * 3, D = Math.min(q + B * 3, M.length);
1746
+ if (q >= D) continue;
1747
+ const nt = M.slice(q, D);
1748
+ R[x].postMessage({
1749
+ type: "stream-chunk",
1750
+ jobsFlat: nt
1751
+ }, [
1752
+ nt.buffer
1753
+ ]);
1754
+ }
1755
+ } catch (x) {
1756
+ m = new Error(`Failed to dispatch jobs chunk: ${x instanceof Error ? x.message : String(x)}`), f();
1757
+ }
1758
+ }
1759
+ const V = (M)=>{
1760
+ if (!L || !O || !U) {
1761
+ j.push(M);
1762
+ return;
1763
+ }
1764
+ $(M);
1765
+ }, H = ()=>{
1766
+ if (!(!L || !O || !U)) for(; j.length > 0;)$(j.shift());
1767
+ }, z = performance.now(), Q = ()=>Math.round(performance.now() - z);
1768
+ console.log(`[stream] processParallel start, fileSizeMB=${g.toFixed(1)} workerCount=${I}`);
1769
+ const K = l();
1770
+ s?.wasmUrls?.wasm && K.postMessage({
1771
+ type: "init",
1772
+ wasmUrl: s.wasmUrls.wasm
1773
+ });
1774
+ let ot = 0, ut = 0, it = -1;
1775
+ K.onmessage = (M)=>{
1776
+ const X = M.data;
1777
+ if (X.type === "prepass-progress") {
1778
+ d.push({
1779
+ type: "progress",
1780
+ phase: "prepass"
1781
+ }), f();
1782
+ return;
1783
+ }
1784
+ if (X.type === "prepass-stream") {
1785
+ const B = X.event;
1786
+ if (B.type === "meta") p = {
1787
+ unitScale: B.unitScale,
1788
+ rtcOffset: B.rtcOffset,
1789
+ needsShift: B.needsShift,
1790
+ buildingRotation: B.buildingRotation ?? null
1791
+ }, console.log(`[stream] meta @ ${Q()}ms unitScale=${p.unitScale} rtc=[${p.rtcOffset[0].toFixed(0)},${p.rtcOffset[1].toFixed(0)},${p.rtcOffset[2].toFixed(0)}]`), G(), f();
1792
+ else if (B.type === "jobs") {
1793
+ const x = B.jobs, q = Math.floor(x.length / 3);
1794
+ ot++, ut += q, it < 0 && (it = Q(), console.log(`[stream] first jobs chunk @ ${it}ms (${q} jobs)`)), (ot % 10 === 1 || q < 1e3) && console.log(`[stream] chunk #${ot} @ ${Q()}ms (+${q} jobs, total ${ut})`), V(x);
1795
+ } else if (B.type === "styles") {
1796
+ const x = B.styleIds, q = B.styleColors, D = B.voidKeys, nt = B.voidCounts, ht = B.voidValues;
1797
+ console.log(`[stream] styles @ ${Q()}ms (${x.length} styled, ${D.length} void hosts), draining ${j.length} queued chunks`);
1798
+ for (const Ht of R)try {
1799
+ const dt = x.slice(), yt = q.slice(), Et = D.slice(), mt = nt.slice(), Gt = ht.slice();
1800
+ Ht.postMessage({
1801
+ type: "set-styles",
1802
+ styleIds: dt,
1803
+ styleColors: yt,
1804
+ voidKeys: Et,
1805
+ voidCounts: mt,
1806
+ voidValues: Gt
1807
+ }, [
1808
+ dt.buffer,
1809
+ yt.buffer,
1810
+ Et.buffer,
1811
+ mt.buffer,
1812
+ Gt.buffer
1813
+ ]);
1814
+ } catch (dt) {
1815
+ console.warn("[stream] set-styles dispatch failed:", dt);
1816
+ }
1817
+ O = !0, H();
1818
+ } else if (B.type === "entity-index") {
1819
+ const x = B.ids, q = B.starts, D = B.lengths;
1820
+ if (console.log(`[stream] entity-index @ ${Q()}ms (${x.length} entries)`), typeof SharedArrayBuffer < "u") {
1821
+ const nt = x.byteLength, ht = q.byteLength, Ht = D.byteLength, dt = new SharedArrayBuffer(nt), yt = new SharedArrayBuffer(ht), Et = new SharedArrayBuffer(Ht);
1822
+ new Uint32Array(dt).set(x), new Uint32Array(yt).set(q), new Uint32Array(Et).set(D);
1823
+ for (const mt of R)try {
1824
+ mt.postMessage({
1825
+ type: "set-entity-index",
1826
+ ids: new Uint32Array(dt),
1827
+ starts: new Uint32Array(yt),
1828
+ lengths: new Uint32Array(Et)
1829
+ });
1830
+ } catch (Gt) {
1831
+ console.warn("[stream] set-entity-index dispatch failed:", Gt);
1832
+ }
1833
+ if (s?.onEntityIndex) try {
1834
+ s.onEntityIndex(new Uint32Array(dt), new Uint32Array(yt), new Uint32Array(Et));
1835
+ } catch (mt) {
1836
+ console.warn("[stream] onEntityIndex callback failed:", mt);
1837
+ }
1838
+ } else {
1839
+ for (const nt of R)try {
1840
+ nt.postMessage({
1841
+ type: "set-entity-index",
1842
+ ids: x.slice(),
1843
+ starts: q.slice(),
1844
+ lengths: D.slice()
1845
+ });
1846
+ } catch (ht) {
1847
+ console.warn("[stream] set-entity-index dispatch failed:", ht);
1848
+ }
1849
+ if (s?.onEntityIndex) try {
1850
+ s.onEntityIndex(x.slice(), q.slice(), D.slice());
1851
+ } catch (nt) {
1852
+ console.warn("[stream] onEntityIndex callback failed:", nt);
1853
+ }
1854
+ }
1855
+ U = !0, H();
1856
+ } else B.type === "complete" && (_ = B.totalJobs, console.log(`[stream] prepass complete @ ${Q()}ms totalJobs=${_} chunks=${ot}`), at || (at = !0, lt()));
1857
+ return;
1858
+ }
1859
+ if (X.type === "error") {
1860
+ y = new Error(X.message), h = !0, K.terminate(), f();
1861
+ return;
1862
+ }
1863
+ }, K.onerror = (M)=>{
1864
+ y = new Error(`Pre-pass worker failed: ${M.message}`), h = !0, K.terminate(), f();
1865
+ };
1866
+ const lt = ()=>{
1867
+ h = !0, L && S(), K.terminate(), f();
1868
+ };
1869
+ K.postMessage({
1870
+ type: "prepass-streaming",
1871
+ sharedBuffer: i,
1872
+ chunkSize: 5e4
1873
+ });
1874
+ let at = !1;
1875
+ for(;;){
1876
+ for(; d.length > 0;)yield d.shift();
1877
+ if (m) {
1878
+ for (const M of R)try {
1879
+ M.terminate();
1880
+ } catch {}
1881
+ try {
1882
+ K.terminate();
1883
+ } catch {}
1884
+ throw m;
1885
+ }
1886
+ if (y) {
1887
+ for (const M of R)try {
1888
+ M.terminate();
1889
+ } catch {}
1890
+ throw y;
1891
+ }
1892
+ if (h && !L && _ === 0) {
1893
+ for (const X of R)try {
1894
+ X.terminate();
1895
+ } catch {}
1896
+ yield {
1897
+ type: "complete",
1898
+ totalMeshes: 0,
1899
+ coordinateInfo: t.getFinalCoordinateInfo()
1900
+ };
1901
+ return;
1902
+ }
1903
+ if (h && L && b >= R.length && d.length === 0) break;
1904
+ await new Promise((M)=>{
1905
+ u = M;
1906
+ });
1907
+ }
1908
+ const _t = t.getFinalCoordinateInfo();
1909
+ yield {
1910
+ type: "complete",
1911
+ totalMeshes: w,
1912
+ coordinateInfo: _t
1913
+ };
1914
+ }
1915
+ let bt = null;
1916
+ function xn(r) {
1917
+ if (bt) throw new Error(`GeometryProcessor ${r} cannot start while ${bt} is still running. Wait for the active stream to finish, or cancel it before starting another geometry operation.`);
1918
+ return bt = r, ()=>{
1919
+ bt === r && (bt = null);
1920
+ };
1921
+ }
1922
+ ss = class {
1923
+ static largeFileByteStreamingThreshold = 256 * 1024 * 1024;
1924
+ bridge = null;
1925
+ platformBridge = null;
1926
+ bufferBuilder;
1927
+ coordinateHandler;
1928
+ isNative = !1;
1929
+ lastNativeStats = null;
1930
+ mergeLayers;
1931
+ constructor(t = {}){
1932
+ this.bufferBuilder = new hn, this.coordinateHandler = new pn, this.isNative = t.preferNative !== !1 && Ue(), this.mergeLayers = t.mergeLayers === !0, t.quality, this.isNative || (this.bridge = new fn, this.bridge.setMergeLayers(this.mergeLayers));
1933
+ }
1934
+ async init() {
1935
+ this.isNative ? (this.platformBridge = await un(), await this.platformBridge.init(), console.log("[GeometryProcessor] Native bridge initialized")) : this.bridge && await this.bridge.init();
1936
+ }
1937
+ async process(t, e) {
1938
+ let n;
1939
+ if (this.isNative && this.platformBridge) console.time("[GeometryProcessor] native-processing"), n = (await this.platformBridge.processGeometry(t)).meshes, console.timeEnd("[GeometryProcessor] native-processing");
1940
+ else {
1941
+ this.bridge?.isInitialized() || await this.init();
1942
+ const a = await this.collectMeshesMainThread(t);
1943
+ n = a.meshes;
1944
+ const l = this.coordinateHandler.processMeshes(n), d = a.buildingRotation, u = {
1945
+ ...l,
1946
+ buildingRotation: d
1947
+ }, f = this.bufferBuilder.processMeshes(n);
1948
+ return {
1949
+ meshes: f.meshes,
1950
+ totalTriangles: f.totalTriangles,
1951
+ totalVertices: f.totalVertices,
1952
+ coordinateInfo: u
1953
+ };
1954
+ }
1955
+ const s = this.coordinateHandler.processMeshes(n), i = this.bufferBuilder.processMeshes(n);
1956
+ return {
1957
+ meshes: i.meshes,
1958
+ totalTriangles: i.totalTriangles,
1959
+ totalVertices: i.totalVertices,
1960
+ coordinateInfo: s
1961
+ };
1962
+ }
1963
+ async processPath(t) {
1964
+ if (!this.isNative) throw new Error("Path-based geometry processing is only available in native desktop builds");
1965
+ if (this.platformBridge || await this.init(), !this.platformBridge?.processGeometryPath) throw new Error("Native platform bridge does not support file-path geometry processing");
1966
+ const e = await this.platformBridge.processGeometryPath(t), n = this.coordinateHandler.processMeshes(e.meshes);
1967
+ return {
1968
+ meshes: e.meshes,
1969
+ totalTriangles: e.totalTriangles,
1970
+ totalVertices: e.totalVertices,
1971
+ coordinateInfo: n
1972
+ };
1973
+ }
1974
+ collectMeshesViaPrePass(t) {
1975
+ if (!this.bridge) throw new Error("WASM bridge not initialized");
1976
+ const e = this.bridge.getApi(), n = e.buildPrePassOnce(t);
1977
+ try {
1978
+ const s = [], i = n.totalJobs ?? 0;
1979
+ if (n.jobs && i > 0) {
1980
+ const o = e.processGeometryBatch(t, n.jobs, n.unitScale, n.rtcOffset?.[0] ?? 0, n.rtcOffset?.[1] ?? 0, n.rtcOffset?.[2] ?? 0, n.needsShift, n.voidKeys, n.voidCounts, n.voidValues, n.styleIds, n.styleColors);
1981
+ s.push(...Ce(o));
1982
+ }
1983
+ return {
1984
+ meshes: s,
1985
+ buildingRotation: n.buildingRotation ?? void 0
1986
+ };
1987
+ } finally{
1988
+ e.clearPrePassCache?.();
1989
+ }
1990
+ }
1991
+ async collectMeshesMainThread(t, e) {
1992
+ return this.collectMeshesViaPrePass(t);
1993
+ }
1994
+ async *processStreamingBytes(t, e) {
1995
+ if (!this.bridge) throw new Error("WASM bridge not initialized");
1996
+ const n = this.bridge.getApi(), s = n.buildPrePassOnce(t);
1997
+ try {
1998
+ yield {
1999
+ type: "model-open",
2000
+ modelID: 0
2001
+ }, s.rtcOffset && (yield {
2002
+ type: "rtcOffset",
2003
+ rtcOffset: {
2004
+ x: s.rtcOffset[0] ?? 0,
2005
+ y: s.rtcOffset[1] ?? 0,
2006
+ z: s.rtcOffset[2] ?? 0
2007
+ },
2008
+ hasRtc: !!s.needsShift
2009
+ });
2010
+ const i = s.buildingRotation ?? void 0;
2011
+ if (!s.jobs || s.totalJobs === 0) {
2012
+ yield {
2013
+ type: "complete",
2014
+ totalMeshes: 0,
2015
+ coordinateInfo: Vt(this.coordinateHandler.getFinalCoordinateInfo(), i)
2016
+ };
2017
+ return;
2018
+ }
2019
+ const o = Rn(t, e), l = Math.max(o, Math.ceil(s.totalJobs / 30));
2020
+ let d = 0;
2021
+ for(let f = 0; f < s.totalJobs; f += l){
2022
+ const p = Math.min(f + l, s.totalJobs), _ = s.jobs.slice(f * 3, p * 3), h = n.processGeometryBatch(t, _, s.unitScale, s.rtcOffset?.[0] ?? 0, s.rtcOffset?.[1] ?? 0, s.rtcOffset?.[2] ?? 0, s.needsShift, s.voidKeys, s.voidCounts, s.voidValues, s.styleIds, s.styleColors), y = Ce(h);
2023
+ if (y.length === 0) {
2024
+ await new Promise((w)=>setTimeout(w, 0));
2025
+ continue;
2026
+ }
2027
+ this.coordinateHandler.processMeshesIncremental(y), d += y.length;
2028
+ const m = this.coordinateHandler.getCurrentCoordinateInfo(), b = m ? Vt(m, i) : null;
2029
+ yield {
2030
+ type: "batch",
2031
+ meshes: y,
2032
+ totalSoFar: d,
2033
+ coordinateInfo: b || void 0
2034
+ }, await new Promise((w)=>setTimeout(w, 0));
2035
+ }
2036
+ const u = Vt(this.coordinateHandler.getFinalCoordinateInfo(), i);
2037
+ yield {
2038
+ type: "complete",
2039
+ totalMeshes: d,
2040
+ coordinateInfo: u
2041
+ };
2042
+ } finally{
2043
+ n.clearPrePassCache?.();
2044
+ }
2045
+ }
2046
+ async *processStreaming(t, e, n = 25, s) {
2047
+ const i = this.isNative ? null : xn("processStreaming");
2048
+ try {
2049
+ yield* this.processStreamingUnlocked(t, e, n, s);
2050
+ } finally{
2051
+ i?.();
2052
+ }
2053
+ }
2054
+ async *processStreamingUnlocked(t, e, n = 25, s) {
2055
+ if (this.isNative ? this.platformBridge || await this.init() : this.bridge?.isInitialized() || await this.init(), this.coordinateHandler.reset(), yield {
2056
+ type: "start",
2057
+ totalEstimate: t.length / 1e3
2058
+ }, await new Promise((i)=>setTimeout(i, 0)), this.isNative && this.platformBridge) {
2059
+ yield {
2060
+ type: "model-open",
2061
+ modelID: 0
2062
+ }, console.time("[GeometryProcessor] native-streaming");
2063
+ const i = [];
2064
+ let o = null, a = !1, l = null, d, u = 0;
2065
+ const f = ()=>{
2066
+ o && (o(), o = null);
2067
+ }, p = this.platformBridge.processGeometryStreaming(t, {
2068
+ onBatch: (h)=>{
2069
+ i.push({
2070
+ type: "batch",
2071
+ meshes: h.meshes,
2072
+ nativeTelemetry: h.nativeTelemetry
2073
+ }), f();
2074
+ },
2075
+ onColorUpdate: (h)=>{
2076
+ i.push({
2077
+ type: "colorUpdate",
2078
+ updates: new Map(h)
2079
+ }), f();
2080
+ },
2081
+ onComplete: (h)=>{
2082
+ this.lastNativeStats = h, d = h.totalMeshes, a = !0, f();
2083
+ },
2084
+ onError: (h)=>{
2085
+ l = h, a = !0, f();
2086
+ }
2087
+ });
2088
+ for(; !a || i.length > 0;){
2089
+ for(; i.length > 0;){
2090
+ const h = i.shift();
2091
+ if (h.type === "colorUpdate") {
2092
+ yield {
2093
+ type: "colorUpdate",
2094
+ updates: h.updates
2095
+ };
2096
+ continue;
2097
+ }
2098
+ this.coordinateHandler.processMeshesIncremental(h.meshes), u += h.meshes.length;
2099
+ const y = this.coordinateHandler.getCurrentCoordinateInfo();
2100
+ yield {
2101
+ type: "batch",
2102
+ meshes: h.meshes,
2103
+ totalSoFar: u,
2104
+ coordinateInfo: y || void 0,
2105
+ nativeTelemetry: h.nativeTelemetry
2106
+ };
2107
+ }
2108
+ if (l) throw l;
2109
+ a || await new Promise((h)=>{
2110
+ o = h;
2111
+ });
2112
+ }
2113
+ await p;
2114
+ const _ = this.coordinateHandler.getFinalCoordinateInfo();
2115
+ yield {
2116
+ type: "complete",
2117
+ totalMeshes: d ?? u,
2118
+ coordinateInfo: _
2119
+ }, console.timeEnd("[GeometryProcessor] native-streaming");
2120
+ } else {
2121
+ if (!this.bridge) throw new Error("WASM bridge not initialized");
2122
+ yield* this.processStreamingBytes(t, n);
2123
+ }
2124
+ }
2125
+ async *processStreamingPath(t, e = 0, n) {
2126
+ if (!this.isNative) throw new Error("File-path geometry streaming is only available in native desktop builds");
2127
+ if (this.platformBridge || await this.init(), !this.platformBridge?.processGeometryStreamingPath) throw new Error("Native platform bridge does not support file-path streaming");
2128
+ yield* we((s)=>this.platformBridge.processGeometryStreamingPath(t, s, n), e > 0 ? e / 1e3 : 0, this.coordinateHandler, (s)=>{
2129
+ this.lastNativeStats = s;
2130
+ });
2131
+ }
2132
+ async *processStreamingCache(t) {
2133
+ if (!this.isNative) throw new Error("Native cached geometry streaming is only available in native desktop builds");
2134
+ if (this.platformBridge || await this.init(), !this.platformBridge?.processGeometryStreamingCache) throw new Error("Native platform bridge does not support cached geometry streaming");
2135
+ yield* we((e)=>this.platformBridge.processGeometryStreamingCache(t, e), 0, this.coordinateHandler, (e)=>{
2136
+ this.lastNativeStats = e;
2137
+ });
2138
+ }
2139
+ async *processParallel(t, e, n, s, i) {
2140
+ this.bridge?.isInitialized() || await this.init(), yield* Mn(t, this.coordinateHandler, e, n, {
2141
+ onEntityIndex: s,
2142
+ mergeLayers: this.mergeLayers,
2143
+ wasmUrls: i
2144
+ });
2145
+ }
2146
+ async *processAdaptive(t, e = {}) {
2147
+ const n = e.sizeThreshold ?? 2097152, s = e.batchSize ?? 25;
2148
+ if (this.isNative ? this.platformBridge || await this.init() : this.bridge?.isInitialized() || await this.init(), this.coordinateHandler.reset(), t.length < n) {
2149
+ yield {
2150
+ type: "start",
2151
+ totalEstimate: t.length / 1e3
2152
+ }, yield {
2153
+ type: "model-open",
2154
+ modelID: 0
2155
+ };
2156
+ let i, o;
2157
+ if (this.isNative && this.platformBridge) console.time("[GeometryProcessor] native-adaptive-sync"), i = (await this.platformBridge.processGeometry(t)).meshes, console.timeEnd("[GeometryProcessor] native-adaptive-sync");
2158
+ else {
2159
+ const l = this.collectMeshesViaPrePass(t);
2160
+ i = l.meshes, o = l.buildingRotation;
2161
+ }
2162
+ this.coordinateHandler.processMeshesIncremental(i);
2163
+ const a = Vt(this.coordinateHandler.getFinalCoordinateInfo(), o);
2164
+ yield {
2165
+ type: "batch",
2166
+ meshes: i,
2167
+ totalSoFar: i.length,
2168
+ coordinateInfo: a || void 0
2169
+ }, yield {
2170
+ type: "complete",
2171
+ totalMeshes: i.length,
2172
+ coordinateInfo: a
2173
+ };
2174
+ } else typeof SharedArrayBuffer < "u" && typeof Worker < "u" && typeof navigator < "u" && (navigator.hardwareConcurrency ?? 1) > 1 ? yield* this.processParallel(t, e.sharedRtcOffset, e.existingSab, e.onEntityIndex, e.wasmUrls) : yield* this.processStreaming(t, e.entityIndex, s, e.sharedRtcOffset);
2175
+ }
2176
+ getApi() {
2177
+ return !this.bridge || !this.bridge.isInitialized() ? null : this.bridge.getApi();
2178
+ }
2179
+ getLastNativeStats() {
2180
+ return this.lastNativeStats;
2181
+ }
2182
+ parseSymbolicRepresentations(t) {
2183
+ if (!this.bridge || !this.bridge.isInitialized()) return null;
2184
+ const e = st(t);
2185
+ return this.bridge.parseSymbolicRepresentations(e);
2186
+ }
2187
+ extractProfiles(t, e = 0) {
2188
+ if (!this.bridge || !this.bridge.isInitialized()) return null;
2189
+ const n = st(t);
2190
+ return this.bridge.extractProfiles(n, e);
2191
+ }
2192
+ dispose() {}
2193
+ };
2194
+ is = class {
2195
+ geometryResult;
2196
+ constructor(t){
2197
+ this.geometryResult = t;
2198
+ }
2199
+ exportGLB(t = {}) {
2200
+ const e = this.buildGLTF(t);
2201
+ return this.packGLB(e.json, e.buffers);
2202
+ }
2203
+ exportGLTF(t = {}) {
2204
+ const e = this.buildGLTF(t);
2205
+ return {
2206
+ json: JSON.stringify(e.json, null, 2),
2207
+ bin: this.combineBuffers(e.buffers)
2208
+ };
2209
+ }
2210
+ buildGLTF(t) {
2211
+ const e = this.geometryResult.meshes, n = t.colorSource ?? "rendering", s = t.visibleOnly === !0, i = t.hiddenEntityIds ?? null, o = t.isolatedEntityIds ?? null, a = o !== null && o.size > 0, l = t.hiddenIfcTypes ?? null, d = (I)=>s ? !(l && I.ifcType && l.has(I.ifcType) || a && !o.has(I.expressId) || i && i.has(I.expressId)) : !0, u = (I)=>n === "shading" ? I.shadingColor ?? I.color : I.color, f = {
2212
+ asset: {
2213
+ version: "2.0",
2214
+ generator: "IFC-Lite"
2215
+ },
2216
+ scene: 0,
2217
+ scenes: [
2218
+ {
2219
+ nodes: []
2220
+ }
2221
+ ],
2222
+ nodes: [],
2223
+ meshes: [],
2224
+ accessors: [],
2225
+ bufferViews: [],
2226
+ buffers: [
2227
+ {
2228
+ byteLength: 0
2229
+ }
2230
+ ]
2231
+ };
2232
+ t.includeMetadata && (f.asset.extras = {
2233
+ meshCount: e.length,
2234
+ vertexCount: this.geometryResult.totalVertices,
2235
+ triangleCount: this.geometryResult.totalTriangles
2236
+ });
2237
+ const p = new Map, _ = [];
2238
+ function h(I) {
2239
+ const R = `${Math.round(I[0] * 100)},${Math.round(I[1] * 100)},${Math.round(I[2] * 100)},${Math.round(I[3] * 100)}`, S = p.get(R);
2240
+ if (S !== void 0) return S;
2241
+ const G = _.length;
2242
+ return _.push({
2243
+ pbrMetallicRoughness: {
2244
+ baseColorFactor: [
2245
+ I[0],
2246
+ I[1],
2247
+ I[2],
2248
+ I[3]
2249
+ ],
2250
+ metallicFactor: 0,
2251
+ roughnessFactor: 1
2252
+ },
2253
+ extensions: {
2254
+ KHR_materials_unlit: {}
2255
+ },
2256
+ ...I[3] < 1 ? {
2257
+ alphaMode: "BLEND"
2258
+ } : {}
2259
+ }), p.set(R, G), G;
2260
+ }
2261
+ const y = [];
2262
+ let m = 0, b = 0, w = 0;
2263
+ for(let I = 0; I < e.length; I++){
2264
+ const R = e[I];
2265
+ if (!d(R)) continue;
2266
+ const S = R.positions, G = R.normals, $ = R.indices;
2267
+ if (!S.length || !G.length || !$.length || S.length % 3 !== 0 || G.length % 3 !== 0 || S.length !== G.length) continue;
2268
+ let V = S[0], H = S[1], z = S[2], Q = S[0], K = S[1], ot = S[2];
2269
+ for(let it = 3; it < S.length; it += 3){
2270
+ const lt = S[it], at = S[it + 1], _t = S[it + 2];
2271
+ lt < V && (V = lt), lt > Q && (Q = lt), at < H && (H = at), at > K && (K = at), _t < z && (z = _t), _t > ot && (ot = _t);
2272
+ }
2273
+ const ut = u(R);
2274
+ y.push({
2275
+ meshIndex: I,
2276
+ posCount: S.length,
2277
+ normCount: G.length,
2278
+ idxCount: $.length,
2279
+ posByteOffset: m * 4,
2280
+ normByteOffset: b * 4,
2281
+ idxByteOffset: w * 4,
2282
+ bounds: {
2283
+ min: [
2284
+ V,
2285
+ H,
2286
+ z
2287
+ ],
2288
+ max: [
2289
+ Q,
2290
+ K,
2291
+ ot
2292
+ ]
2293
+ },
2294
+ materialIdx: ut ? h(ut) : void 0
2295
+ }), m += S.length, b += G.length, w += $.length;
2296
+ }
2297
+ if (m === 0 || b === 0 || w === 0) throw new Error("Cannot export GLB: no valid geometry data found");
2298
+ const v = new Float32Array(m), L = new Float32Array(b), j = new Uint32Array(w);
2299
+ let O = 0, U = 0, C = 0;
2300
+ const N = [];
2301
+ for (const I of y){
2302
+ const R = e[I.meshIndex];
2303
+ v.set(R.positions, O), L.set(R.normals, U), j.set(R.indices, C), O += I.posCount, U += I.normCount, C += I.idxCount;
2304
+ const S = f.accessors.length;
2305
+ f.accessors.push({
2306
+ bufferView: 0,
2307
+ byteOffset: I.posByteOffset,
2308
+ componentType: 5126,
2309
+ count: I.posCount / 3,
2310
+ type: "VEC3",
2311
+ min: I.bounds.min,
2312
+ max: I.bounds.max
2313
+ });
2314
+ const G = f.accessors.length;
2315
+ f.accessors.push({
2316
+ bufferView: 1,
2317
+ byteOffset: I.normByteOffset,
2318
+ componentType: 5126,
2319
+ count: I.normCount / 3,
2320
+ type: "VEC3"
2321
+ });
2322
+ const $ = f.accessors.length;
2323
+ f.accessors.push({
2324
+ bufferView: 2,
2325
+ byteOffset: I.idxByteOffset,
2326
+ componentType: 5125,
2327
+ count: I.idxCount,
2328
+ type: "SCALAR"
2329
+ });
2330
+ const V = f.meshes.length;
2331
+ f.meshes.push({
2332
+ primitives: [
2333
+ {
2334
+ attributes: {
2335
+ POSITION: S,
2336
+ NORMAL: G
2337
+ },
2338
+ indices: $,
2339
+ ...I.materialIdx !== void 0 ? {
2340
+ material: I.materialIdx
2341
+ } : {}
2342
+ }
2343
+ ]
2344
+ });
2345
+ const H = f.nodes.length, z = {
2346
+ mesh: V
2347
+ };
2348
+ t.includeMetadata && R.expressId !== void 0 && (z.extras = R.modelIndex !== void 0 ? {
2349
+ expressId: R.expressId,
2350
+ modelIndex: R.modelIndex
2351
+ } : {
2352
+ expressId: R.expressId
2353
+ }), f.nodes.push(z), N.push(H);
2354
+ }
2355
+ f.scenes[0].nodes = N, _.length > 0 && (f.materials = _, f.extensionsUsed = [
2356
+ "KHR_materials_unlit"
2357
+ ]);
2358
+ const F = v.buffer, E = L.buffer, g = j.buffer, T = F.byteLength + E.byteLength + g.byteLength;
2359
+ f.bufferViews.push({
2360
+ buffer: 0,
2361
+ byteOffset: 0,
2362
+ byteLength: F.byteLength,
2363
+ byteStride: 12,
2364
+ target: 34962
2365
+ }), f.bufferViews.push({
2366
+ buffer: 0,
2367
+ byteOffset: F.byteLength,
2368
+ byteLength: E.byteLength,
2369
+ byteStride: 12,
2370
+ target: 34962
2371
+ }), f.bufferViews.push({
2372
+ buffer: 0,
2373
+ byteOffset: F.byteLength + E.byteLength,
2374
+ byteLength: g.byteLength,
2375
+ target: 34963
2376
+ }), f.buffers[0].byteLength = T;
2377
+ for (const I of f.accessors){
2378
+ const R = f.bufferViews[I.bufferView];
2379
+ if (!R) throw new Error(`Accessor references invalid bufferView ${I.bufferView}`);
2380
+ let S = 0;
2381
+ if (I.componentType === 5126) S = 4;
2382
+ else if (I.componentType === 5125) S = 4;
2383
+ else if (I.componentType === 5123) S = 2;
2384
+ else if (I.componentType === 5120) S = 1;
2385
+ else throw new Error(`Unsupported component type: ${I.componentType}`);
2386
+ let G = 1;
2387
+ if (I.type === "VEC3") G = 3;
2388
+ else if (I.type === "VEC2") G = 2;
2389
+ else if (I.type === "SCALAR") G = 1;
2390
+ else throw new Error(`Unsupported accessor type: ${I.type}`);
2391
+ const $ = I.count * G * S, V = (I.byteOffset || 0) + $;
2392
+ if (V > R.byteLength) throw new Error(`Accessor exceeds bufferView bounds: accessor byteOffset=${I.byteOffset || 0}, length=${$}, bufferView byteLength=${R.byteLength}, end=${V}`);
2393
+ }
2394
+ return {
2395
+ json: f,
2396
+ buffers: [
2397
+ new Uint8Array(F),
2398
+ new Uint8Array(E),
2399
+ new Uint8Array(g)
2400
+ ]
2401
+ };
2402
+ }
2403
+ combineBuffers(t) {
2404
+ const e = t.reduce((i, o)=>i + o.byteLength, 0), n = new Uint8Array(e);
2405
+ let s = 0;
2406
+ for (const i of t)n.set(i, s), s += i.byteLength;
2407
+ return n;
2408
+ }
2409
+ packGLB(t, e) {
2410
+ const n = JSON.stringify(t), s = new TextEncoder().encode(n), i = (4 - s.byteLength % 4) % 4, o = s.byteLength + i, a = this.combineBuffers(e), l = (4 - a.byteLength % 4) % 4, d = a.byteLength + l, u = 20 + o + 8 + d, f = new ArrayBuffer(u), p = new DataView(f), _ = new Uint8Array(f);
2411
+ let h = 0;
2412
+ p.setUint32(h, 1179937895, !0), h += 4, p.setUint32(h, 2, !0), h += 4, p.setUint32(h, u, !0), h += 4, p.setUint32(h, o, !0), h += 4, p.setUint32(h, 1313821514, !0), h += 4, _.set(s, h), h += s.byteLength;
2413
+ for(let y = 0; y < i; y++)_[h++] = 32;
2414
+ return p.setUint32(h, d, !0), h += 4, p.setUint32(h, 5130562, !0), h += 4, _.set(a, h), new Uint8Array(f);
2415
+ }
2416
+ };
2417
+ rs = class {
2418
+ store;
2419
+ constructor(t){
2420
+ this.store = t;
2421
+ }
2422
+ getPropertiesForEntity(t) {
2423
+ return this.store.onDemandPropertyMap && this.store.source?.length > 0 ? Ve(this.store, t) : this.store.properties?.getForEntity(t) ?? [];
2424
+ }
2425
+ getQuantitiesForEntity(t) {
2426
+ return this.store.onDemandQuantityMap && this.store.source?.length > 0 ? ze(this.store, t) : this.store.quantities?.getForEntity(t) ?? [];
2427
+ }
2428
+ exportEntities(t, e = {}) {
2429
+ const n = e.delimiter ?? ",", s = e.includeProperties ?? !1, i = e.flattenProperties ?? !1, o = [
2430
+ "expressId",
2431
+ "globalId",
2432
+ "name",
2433
+ "type",
2434
+ "description",
2435
+ "objectType",
2436
+ "hasGeometry"
2437
+ ], a = new Map;
2438
+ if (s && i) {
2439
+ const u = t ?? this.getAllEntityIds();
2440
+ for (const f of u){
2441
+ const p = this.getPropertiesForEntity(f);
2442
+ for (const _ of p){
2443
+ a.has(_.name) || a.set(_.name, new Set);
2444
+ for (const h of _.properties)a.get(_.name).add(h.name);
2445
+ }
2446
+ }
2447
+ for (const [f, p] of a)for (const _ of p)o.push(`${f}_${_}`);
2448
+ }
2449
+ const l = [
2450
+ this.joinRow(o.map((u)=>this.escapeValue(u)), n)
2451
+ ], d = t ?? this.getAllEntityIds();
2452
+ for (const u of d){
2453
+ const f = [
2454
+ this.escapeValue(u),
2455
+ this.escapeValue(this.store.entities.getGlobalId(u) || ""),
2456
+ this.escapeValue(this.store.entities.getName(u) || ""),
2457
+ this.escapeValue(this.store.entities.getTypeName(u) || ""),
2458
+ this.escapeValue(this.store.entities.getDescription(u) || ""),
2459
+ this.escapeValue(this.store.entities.getObjectType(u) || ""),
2460
+ this.escapeValue(this.store.entities.hasGeometry(u) ? "true" : "false")
2461
+ ];
2462
+ if (s && i) {
2463
+ const p = this.getPropertiesForEntity(u), _ = new Map;
2464
+ for (const h of p){
2465
+ const y = new Map;
2466
+ for (const m of h.properties)y.set(m.name, m.value);
2467
+ _.set(h.name, y);
2468
+ }
2469
+ for (const [h, y] of a)for (const m of y){
2470
+ const b = _.get(h)?.get(m) ?? "";
2471
+ f.push(this.escapeValue(b));
2472
+ }
2473
+ }
2474
+ l.push(this.joinRow(f, n));
2475
+ }
2476
+ return l.join(`
2477
+ `);
2478
+ }
2479
+ exportProperties(t, e = {}) {
2480
+ const n = e.delimiter ?? ",", s = [
2481
+ "entityId",
2482
+ "globalId",
2483
+ "entityName",
2484
+ "entityType",
2485
+ "psetName",
2486
+ "propName",
2487
+ "value",
2488
+ "type"
2489
+ ], i = [
2490
+ this.joinRow(s.map((a)=>this.escapeValue(a)), n)
2491
+ ], o = t ?? this.getAllEntityIds();
2492
+ for (const a of o){
2493
+ const l = this.getPropertiesForEntity(a);
2494
+ if (!l || l.length === 0) continue;
2495
+ const d = this.store.entities.getGlobalId(a) || "", u = this.store.entities.getName(a) || "", f = this.store.entities.getTypeName(a) || "";
2496
+ for (const p of l)if (!(!p.properties || p.properties.length === 0)) for (const _ of p.properties){
2497
+ const h = [
2498
+ this.escapeValue(a),
2499
+ this.escapeValue(d),
2500
+ this.escapeValue(u),
2501
+ this.escapeValue(f),
2502
+ this.escapeValue(p.name || ""),
2503
+ this.escapeValue(_.name || ""),
2504
+ this.escapeValue(_.value),
2505
+ this.escapeValue(_.type ?? "")
2506
+ ];
2507
+ i.push(this.joinRow(h, n));
2508
+ }
2509
+ }
2510
+ return i.join(`
2511
+ `);
2512
+ }
2513
+ exportQuantities(t, e = {}) {
2514
+ const n = e.delimiter ?? ",", s = [
2515
+ "entityId",
2516
+ "globalId",
2517
+ "entityName",
2518
+ "entityType",
2519
+ "qsetName",
2520
+ "quantityName",
2521
+ "value",
2522
+ "type"
2523
+ ], o = [
2524
+ this.joinRow(s.map((l)=>this.escapeValue(l)), n)
2525
+ ], a = t ?? this.getAllEntityIds();
2526
+ for (const l of a){
2527
+ const d = this.getQuantitiesForEntity(l);
2528
+ if (!d || d.length === 0) continue;
2529
+ const u = this.store.entities.getGlobalId(l) || "", f = this.store.entities.getName(l) || "", p = this.store.entities.getTypeName(l) || "";
2530
+ for (const _ of d)if (!(!_.quantities || _.quantities.length === 0)) for (const h of _.quantities){
2531
+ const y = [
2532
+ this.escapeValue(l),
2533
+ this.escapeValue(u),
2534
+ this.escapeValue(f),
2535
+ this.escapeValue(p),
2536
+ this.escapeValue(_.name || ""),
2537
+ this.escapeValue(h.name || ""),
2538
+ this.escapeValue(h.value),
2539
+ this.escapeValue(h.type ?? "")
2540
+ ];
2541
+ o.push(this.joinRow(y, n));
2542
+ }
2543
+ }
2544
+ return o.join(`
2545
+ `);
2546
+ }
2547
+ exportSpatialHierarchy(t = {}) {
2548
+ const e = t.delimiter ?? ",", n = [
2549
+ "expressId",
2550
+ "globalId",
2551
+ "name",
2552
+ "type",
2553
+ "parentId",
2554
+ "level"
2555
+ ], s = [
2556
+ this.joinRow(n.map((a)=>this.escapeValue(a)), e)
2557
+ ], i = this.store.spatialHierarchy;
2558
+ if (!i?.project) return s[0];
2559
+ const o = (a, l, d)=>{
2560
+ const u = [
2561
+ this.escapeValue(a.expressId),
2562
+ this.escapeValue(this.store.entities.getGlobalId(a.expressId) || ""),
2563
+ this.escapeValue(a.name || ""),
2564
+ this.escapeValue(this.store.entities.getTypeName(a.expressId) || ""),
2565
+ this.escapeValue(l ?? ""),
2566
+ this.escapeValue(d)
2567
+ ];
2568
+ if (s.push(this.joinRow(u, e)), a.children) for (const f of a.children)o(f, a.expressId, d + 1);
2569
+ };
2570
+ return o(i.project, null, 0), s.join(`
2571
+ `);
2572
+ }
2573
+ getAllEntityIds() {
2574
+ const t = [], e = this.store.entities?.count ?? 0;
2575
+ for(let n = 0; n < e; n++)t.push(this.store.entities.expressId[n]);
2576
+ return t;
2577
+ }
2578
+ escapeValue(t) {
2579
+ if (t == null) return "";
2580
+ const e = String(t);
2581
+ return e.includes(",") || e.includes('"') || e.includes(`
2582
+ `) || e.includes("\r") ? `"${e.replace(/"/g, '""')}"` : e;
2583
+ }
2584
+ joinRow(t, e) {
2585
+ return t.join(e);
2586
+ }
2587
+ };
2588
+ const Bn = 35, zt = 48, Fe = 57, Pn = new Set([
2589
+ "IFCOWNERHISTORY",
2590
+ "IFCAPPLICATION",
2591
+ "IFCPERSON",
2592
+ "IFCORGANIZATION",
2593
+ "IFCPERSONANDORGANIZATION",
2594
+ "IFCUNITASSIGNMENT",
2595
+ "IFCSIUNIT",
2596
+ "IFCDERIVEDUNIT",
2597
+ "IFCDERIVEDUNITELEMENT",
2598
+ "IFCCONVERSIONBASEDUNIT",
2599
+ "IFCMEASUREWITHUNIT",
2600
+ "IFCDIMENSIONALEXPONENTS",
2601
+ "IFCMONETARYUNIT",
2602
+ "IFCGEOMETRICREPRESENTATIONCONTEXT",
2603
+ "IFCGEOMETRICREPRESENTATIONSUBCONTEXT"
2604
+ ]), Un = new Set([
2605
+ "IFCPROJECT",
2606
+ "IFCSITE",
2607
+ "IFCBUILDING",
2608
+ "IFCBUILDINGSTOREY",
2609
+ "IFCBRIDGE",
2610
+ "IFCBRIDGEPART",
2611
+ "IFCFACILITY",
2612
+ "IFCFACILITYPART",
2613
+ "IFCFACILITYPARTCOMMON",
2614
+ "IFCMARINEFACILITY",
2615
+ "IFCMARINEPART",
2616
+ "IFCRAILWAY",
2617
+ "IFCRAILWAYPART",
2618
+ "IFCROAD",
2619
+ "IFCROADPART",
2620
+ "IFCSPATIALELEMENT",
2621
+ "IFCSPATIALSTRUCTUREELEMENT",
2622
+ "IFCSPATIALZONE",
2623
+ "IFCEXTERNALSPATIALELEMENT",
2624
+ "IFCEXTERNALSPATIALSTRUCTUREELEMENT"
2625
+ ]), Dn = new Set([
2626
+ "IFCBEAM",
2627
+ "IFCBEAMSTANDARDCASE",
2628
+ "IFCBUILDINGELEMENT",
2629
+ "IFCBUILDINGELEMENTPART",
2630
+ "IFCBUILDINGELEMENTPROXY",
2631
+ "IFCBUILTELEMENT",
2632
+ "IFCCHIMNEY",
2633
+ "IFCCOLUMN",
2634
+ "IFCCOLUMNSTANDARDCASE",
2635
+ "IFCCOVERING",
2636
+ "IFCCURTAINWALL",
2637
+ "IFCDEEPFOUNDATION",
2638
+ "IFCDOOR",
2639
+ "IFCDOORSTANDARDCASE",
2640
+ "IFCFOOTING",
2641
+ "IFCMEMBER",
2642
+ "IFCMEMBERSTANDARDCASE",
2643
+ "IFCPILE",
2644
+ "IFCPLATE",
2645
+ "IFCPLATESTANDARDCASE",
2646
+ "IFCRAILING",
2647
+ "IFCRAMP",
2648
+ "IFCRAMPFLIGHT",
2649
+ "IFCROOF",
2650
+ "IFCSHADINGDEVICE",
2651
+ "IFCSLAB",
2652
+ "IFCSLABELEMENTEDCASE",
2653
+ "IFCSLABSTANDARDCASE",
2654
+ "IFCSTAIR",
2655
+ "IFCSTAIRFLIGHT",
2656
+ "IFCWALL",
2657
+ "IFCWALLELEMENTEDCASE",
2658
+ "IFCWALLSTANDARDCASE",
2659
+ "IFCWINDOW",
2660
+ "IFCWINDOWSTANDARDCASE",
2661
+ "IFCDISTRIBUTIONELEMENT",
2662
+ "IFCDISTRIBUTIONCONTROLELEMENT",
2663
+ "IFCDISTRIBUTIONFLOWELEMENT",
2664
+ "IFCDISTRIBUTIONCHAMBERELEMENT",
2665
+ "IFCDISTRIBUTIONPORT",
2666
+ "IFCDISTRIBUTIONBOARD",
2667
+ "IFCACTUATOR",
2668
+ "IFCALARM",
2669
+ "IFCCONTROLLER",
2670
+ "IFCFLOWINSTRUMENT",
2671
+ "IFCPROTECTIVEDEVICETRIPPINGUNIT",
2672
+ "IFCSENSOR",
2673
+ "IFCUNITARYCONTROLELEMENT",
2674
+ "IFCAIRTERMINALBOX",
2675
+ "IFCDAMPER",
2676
+ "IFCELECTRICDISTRIBUTIONBOARD",
2677
+ "IFCELECTRICTIMECONTROL",
2678
+ "IFCFLOWCONTROLLER",
2679
+ "IFCFLOWMETER",
2680
+ "IFCPROTECTIVEDEVICE",
2681
+ "IFCSWITCHINGDEVICE",
2682
+ "IFCVALVE",
2683
+ "IFCCABLECARRIERFITTING",
2684
+ "IFCCABLEFITTING",
2685
+ "IFCDUCTFITTING",
2686
+ "IFCFLOWFITTING",
2687
+ "IFCJUNCTIONBOX",
2688
+ "IFCPIPEFITTING",
2689
+ "IFCCOMPRESSOR",
2690
+ "IFCFAN",
2691
+ "IFCFLOWMOVINGDEVICE",
2692
+ "IFCPUMP",
2693
+ "IFCCABLECARRIERSEGMENT",
2694
+ "IFCCABLESEGMENT",
2695
+ "IFCCONVEYORSEGMENT",
2696
+ "IFCDUCTSEGMENT",
2697
+ "IFCFLOWSEGMENT",
2698
+ "IFCPIPESEGMENT",
2699
+ "IFCELECTRICFLOWSTORAGEDEVICE",
2700
+ "IFCFLOWSTORAGEDEVICE",
2701
+ "IFCTANK",
2702
+ "IFCAIRTERMINAL",
2703
+ "IFCAUDIOVISUALAPPLIANCE",
2704
+ "IFCCOMMUNICATIONSAPPLIANCE",
2705
+ "IFCELECTRICAPPLIANCE",
2706
+ "IFCFIRESUPPRESSIONTERMINAL",
2707
+ "IFCFLOWTERMINAL",
2708
+ "IFCLAMP",
2709
+ "IFCLIGHTFIXTURE",
2710
+ "IFCLIQUIDTERMINAL",
2711
+ "IFCMEDICALDEVICE",
2712
+ "IFCMOBILETELECOMMUNICATIONSAPPLIANCE",
2713
+ "IFCOUTLET",
2714
+ "IFCSANITARYTERMINAL",
2715
+ "IFCSPACEHEATER",
2716
+ "IFCSTACKTERMINAL",
2717
+ "IFCWASTETERMINAL",
2718
+ "IFCDUCTSILENCER",
2719
+ "IFCELECTRICFLOWTREATMENTDEVICE",
2720
+ "IFCFILTER",
2721
+ "IFCFLOWTREATMENTDEVICE",
2722
+ "IFCINTERCEPTOR",
2723
+ "IFCAIRTOAIRHEATRECOVERY",
2724
+ "IFCBOILER",
2725
+ "IFCBURNER",
2726
+ "IFCCHILLER",
2727
+ "IFCCOIL",
2728
+ "IFCCONDENSER",
2729
+ "IFCCOOLEDBEAM",
2730
+ "IFCCOOLINGTOWER",
2731
+ "IFCELECTRICGENERATOR",
2732
+ "IFCELECTRICMOTOR",
2733
+ "IFCENERGYCONVERSIONDEVICE",
2734
+ "IFCENGINE",
2735
+ "IFCEVAPORATIVECOOLER",
2736
+ "IFCEVAPORATOR",
2737
+ "IFCHEATEXCHANGER",
2738
+ "IFCHUMIDIFIER",
2739
+ "IFCMOTORCONNECTION",
2740
+ "IFCSOLARDEVICE",
2741
+ "IFCTRANSFORMER",
2742
+ "IFCTUBEBUNDLE",
2743
+ "IFCUNITARYEQUIPMENT",
2744
+ "IFCELEMENT",
2745
+ "IFCELEMENTASSEMBLY",
2746
+ "IFCELEMENTCOMPONENT",
2747
+ "IFCFASTENER",
2748
+ "IFCMECHANICALFASTENER",
2749
+ "IFCDISCRETEACCESSORY",
2750
+ "IFCVIBRATIONDAMPER",
2751
+ "IFCVIBRATIONISOLATOR",
2752
+ "IFCIMPACTPROTECTIONDEVICE",
2753
+ "IFCFEATUREELEMENT",
2754
+ "IFCFEATUREELEMENTADDITION",
2755
+ "IFCFEATUREELEMENTSUBTRACTION",
2756
+ "IFCOPENINGELEMENT",
2757
+ "IFCOPENINGSTANDARDCASE",
2758
+ "IFCPROJECTIONELEMENT",
2759
+ "IFCSURFACEFEATURE",
2760
+ "IFCVOIDINGFEATURE",
2761
+ "IFCFURNISHINGELEMENT",
2762
+ "IFCFURNITURE",
2763
+ "IFCSYSTEMFURNITUREELEMENT",
2764
+ "IFCGEOGRAPHICELEMENT",
2765
+ "IFCCIVILELEMENT",
2766
+ "IFCTRANSPORTELEMENT",
2767
+ "IFCTRANSPORTATIONDEVICE",
2768
+ "IFCVEHICLE",
2769
+ "IFCREINFORCINGELEMENT",
2770
+ "IFCREINFORCINGBAR",
2771
+ "IFCREINFORCINGMESH",
2772
+ "IFCTENDON",
2773
+ "IFCTENDONANCHOR",
2774
+ "IFCTENDONCONDUIT",
2775
+ "IFCBEARING",
2776
+ "IFCCAISSONFOUNDATION",
2777
+ "IFCCOURSE",
2778
+ "IFCEARTHWORKSCUT",
2779
+ "IFCEARTHWORKSELEMENT",
2780
+ "IFCEARTHWORKSFILL",
2781
+ "IFCKERB",
2782
+ "IFCMOORINGDEVICE",
2783
+ "IFCNAVIGATIONELEMENT",
2784
+ "IFCPAVEMENT",
2785
+ "IFCRAIL",
2786
+ "IFCREINFORCEDSOIL",
2787
+ "IFCSIGN",
2788
+ "IFCSIGNAL",
2789
+ "IFCTRACKELEMENT",
2790
+ "IFCALIGNMENT",
2791
+ "IFCALIGNMENTCANT",
2792
+ "IFCALIGNMENTHORIZONTAL",
2793
+ "IFCALIGNMENTSEGMENT",
2794
+ "IFCALIGNMENTVERTICAL",
2795
+ "IFCLINEARELEMENT",
2796
+ "IFCLINEARPOSITIONINGELEMENT",
2797
+ "IFCPOSITIONINGELEMENT",
2798
+ "IFCREFERENT",
2799
+ "IFCBOREHOLE",
2800
+ "IFCGEOMODEL",
2801
+ "IFCGEOSLICE",
2802
+ "IFCGEOTECHNICALASSEMBLY",
2803
+ "IFCGEOTECHNICALELEMENT",
2804
+ "IFCGEOTECHNICALSTRATUM",
2805
+ "IFCANNOTATION",
2806
+ "IFCGRID",
2807
+ "IFCPORT",
2808
+ "IFCPROXY",
2809
+ "IFCSPACE",
2810
+ "IFCVIRTUALELEMENT",
2811
+ "IFCSTRUCTURALACTION",
2812
+ "IFCSTRUCTURALACTIVITY",
2813
+ "IFCSTRUCTURALCONNECTION",
2814
+ "IFCSTRUCTURALCURVEACTION",
2815
+ "IFCSTRUCTURALCURVECONNECTION",
2816
+ "IFCSTRUCTURALCURVEMEMBER",
2817
+ "IFCSTRUCTURALCURVEMEMBERVARYING",
2818
+ "IFCSTRUCTURALCURVEREACTION",
2819
+ "IFCSTRUCTURALITEM",
2820
+ "IFCSTRUCTURALLINEARACTION",
2821
+ "IFCSTRUCTURALMEMBER",
2822
+ "IFCSTRUCTURALPLANARACTION",
2823
+ "IFCSTRUCTURALPOINTACTION",
2824
+ "IFCSTRUCTURALPOINTCONNECTION",
2825
+ "IFCSTRUCTURALPOINTREACTION",
2826
+ "IFCSTRUCTURALREACTION",
2827
+ "IFCSTRUCTURALSURFACEACTION",
2828
+ "IFCSTRUCTURALSURFACECONNECTION",
2829
+ "IFCSTRUCTURALSURFACEMEMBER",
2830
+ "IFCSTRUCTURALSURFACEMEMBERVARYING",
2831
+ "IFCSTRUCTURALSURFACEREACTION"
2832
+ ]);
2833
+ function Wt(r, t, e, n) {
2834
+ const s = t + e;
2835
+ let i = t;
2836
+ for(; i < s;)if (r[i] === Bn) {
2837
+ if (i++, i < s && r[i] >= zt && r[i] <= Fe) {
2838
+ let o = r[i] - zt;
2839
+ for(i++; i < s && r[i] >= zt && r[i] <= Fe;)o = o * 10 + (r[i] - zt), i++;
2840
+ n.push(o);
2841
+ }
2842
+ } else i++;
2843
+ }
2844
+ function re(r, t, e, n) {
2845
+ const s = new Set, i = [];
2846
+ for (const a of r)e.has(a) && !s.has(a) && (s.add(a), i.push(a));
2847
+ const o = [];
2848
+ for(; i.length > 0;){
2849
+ const a = i.pop(), l = e.get(a);
2850
+ if (l) {
2851
+ o.length = 0, Wt(t, l.byteOffset, l.byteLength, o);
2852
+ for(let d = 0; d < o.length; d++){
2853
+ const u = o[d];
2854
+ if (!s.has(u) && e.has(u)) {
2855
+ if (n && n.has(u)) continue;
2856
+ s.add(u), i.push(u);
2857
+ }
2858
+ }
2859
+ }
2860
+ }
2861
+ return s;
2862
+ }
2863
+ function oe(r, t, e) {
2864
+ const n = new Set, s = new Set;
2865
+ for (const [i, o] of r.entityIndex.byId){
2866
+ const a = o.type.toUpperCase();
2867
+ if (Pn.has(a)) {
2868
+ n.add(i);
2869
+ continue;
2870
+ }
2871
+ if (Un.has(a)) {
2872
+ n.add(i);
2873
+ continue;
2874
+ }
2875
+ if (a.startsWith("IFCREL")) {
2876
+ n.add(i);
2877
+ continue;
2878
+ }
2879
+ if (Dn.has(a)) {
2880
+ const l = t.has(i), d = e !== null && !e.has(i);
2881
+ l || d ? s.add(i) : n.add(i);
2882
+ continue;
2883
+ }
2884
+ if (t.has(i)) {
2885
+ s.add(i);
2886
+ continue;
2887
+ }
2888
+ if (e !== null && e.has(i)) {
2889
+ n.add(i);
2890
+ continue;
2891
+ }
2892
+ }
2893
+ return vn(r, n, s), {
2894
+ roots: n,
2895
+ hiddenProductIds: s
2896
+ };
2897
+ }
2898
+ function vn(r, t, e) {
2899
+ const n = r.source;
2900
+ if (!n) return;
2901
+ const s = r.entityIndex.byType.get("IFCRELVOIDSELEMENT") ?? [];
2902
+ if (s.length === 0) return;
2903
+ const i = [];
2904
+ for (const o of s){
2905
+ const a = r.entityIndex.byId.get(o);
2906
+ if (!a) continue;
2907
+ let l = a.byteOffset;
2908
+ const d = a.byteOffset + a.byteLength;
2909
+ for(; l < d && n[l] !== 40;)l++;
2910
+ if (l >= d || (i.length = 0, Wt(n, l, d - l, i), i.length < 2)) continue;
2911
+ const u = i[i.length - 2], f = i[i.length - 1];
2912
+ e.has(u) && (e.add(f), t.delete(o), t.delete(f));
2913
+ }
2914
+ }
2915
+ function ae(r, t, e) {
2916
+ const n = [], s = [], i = e.byType.get("IFCSTYLEDITEM") ?? [], o = e.byType.get("IFCSTYLEDREPRESENTATION") ?? [];
2917
+ for (const a of [
2918
+ i,
2919
+ o
2920
+ ])for (const l of a){
2921
+ if (r.has(l)) continue;
2922
+ const d = e.byId.get(l);
2923
+ if (!d) continue;
2924
+ s.length = 0, Wt(t, d.byteOffset, d.byteLength, s);
2925
+ let u = !1;
2926
+ for(let f = 0; f < s.length; f++)if (r.has(s[f])) {
2927
+ u = !0;
2928
+ break;
2929
+ }
2930
+ u && (r.add(l), n.push(l));
2931
+ }
2932
+ for(; n.length > 0;){
2933
+ const a = n.pop(), l = e.byId.get(a);
2934
+ if (l) {
2935
+ s.length = 0, Wt(t, l.byteOffset, l.byteLength, s);
2936
+ for(let d = 0; d < s.length; d++){
2937
+ const u = s[d];
2938
+ !r.has(u) && e.byId.has(u) && (r.add(u), n.push(u));
2939
+ }
2940
+ }
2941
+ }
2942
+ }
2943
+ const Re = new Map([
2944
+ [
2945
+ "IFCELECTRICDISTRIBUTIONPOINT",
2946
+ "IFCELECTRICDISTRIBUTIONBOARD"
2947
+ ],
2948
+ [
2949
+ "IFCGASTERMINALTYPE",
2950
+ "IFCBURNERTYPE"
2951
+ ],
2952
+ [
2953
+ "IFCEQUIPMENTELEMENT",
2954
+ "IFCBUILDINGELEMENTPROXY"
2955
+ ]
2956
+ ]), Ne = new Map([
2957
+ [
2958
+ "IFCELECTRICDISTRIBUTIONBOARD",
2959
+ "IFCELECTRICDISTRIBUTIONPOINT"
2960
+ ],
2961
+ [
2962
+ "IFCBURNERTYPE",
2963
+ "IFCGASTERMINALTYPE"
2964
+ ],
2965
+ [
2966
+ "IFCCHIMNEY",
2967
+ "IFCBUILDINGELEMENTPROXY"
2968
+ ],
2969
+ [
2970
+ "IFCSHADINGDEVICE",
2971
+ "IFCBUILDINGELEMENTPROXY"
2972
+ ],
2973
+ [
2974
+ "IFCCIVILELEMENT",
2975
+ "IFCBUILDINGELEMENTPROXY"
2976
+ ],
2977
+ [
2978
+ "IFCGEOGRAPHICELEMENT",
2979
+ "IFCBUILDINGELEMENTPROXY"
2980
+ ],
2981
+ [
2982
+ "IFCBEARING",
2983
+ "IFCBUILDINGELEMENTPROXY"
2984
+ ],
2985
+ [
2986
+ "IFCDEEPFOUNDATION",
2987
+ "IFCFOOTING"
2988
+ ],
2989
+ [
2990
+ "IFCCOURSE",
2991
+ "IFCBUILDINGELEMENTPROXY"
2992
+ ],
2993
+ [
2994
+ "IFCPAVEMENT",
2995
+ "IFCSLAB"
2996
+ ],
2997
+ [
2998
+ "IFCKERB",
2999
+ "IFCBUILDINGELEMENTPROXY"
3000
+ ],
3001
+ [
3002
+ "IFCFACILITY",
3003
+ "IFCBUILDING"
3004
+ ],
3005
+ [
3006
+ "IFCFACILITYPART",
3007
+ "IFCBUILDINGSTOREY"
3008
+ ],
3009
+ [
3010
+ "IFCFACILITYPARTCOMMON",
3011
+ "IFCBUILDINGSTOREY"
3012
+ ],
3013
+ [
3014
+ "IFCBRIDGE",
3015
+ "IFCBUILDING"
3016
+ ],
3017
+ [
3018
+ "IFCBRIDGEPART",
3019
+ "IFCBUILDINGSTOREY"
3020
+ ],
3021
+ [
3022
+ "IFCROAD",
3023
+ "IFCBUILDING"
3024
+ ],
3025
+ [
3026
+ "IFCROADPART",
3027
+ "IFCBUILDINGSTOREY"
3028
+ ],
3029
+ [
3030
+ "IFCRAILWAY",
3031
+ "IFCBUILDING"
3032
+ ],
3033
+ [
3034
+ "IFCRAILWAYPART",
3035
+ "IFCBUILDINGSTOREY"
3036
+ ],
3037
+ [
3038
+ "IFCMARINEFACILITY",
3039
+ "IFCBUILDING"
3040
+ ],
3041
+ [
3042
+ "IFCMARINEPART",
3043
+ "IFCBUILDINGSTOREY"
3044
+ ],
3045
+ [
3046
+ "IFCBUILTELEMENT",
3047
+ "IFCBUILDINGELEMENTPROXY"
3048
+ ]
3049
+ ]), Jt = new Map([]), Kt = new Map([
3050
+ [
3051
+ "IFCFACILITY",
3052
+ "IFCBUILDING"
3053
+ ],
3054
+ [
3055
+ "IFCFACILITYPART",
3056
+ "IFCBUILDINGSTOREY"
3057
+ ],
3058
+ [
3059
+ "IFCFACILITYPARTCOMMON",
3060
+ "IFCBUILDINGSTOREY"
3061
+ ],
3062
+ [
3063
+ "IFCBRIDGE",
3064
+ "IFCBUILDING"
3065
+ ],
3066
+ [
3067
+ "IFCBRIDGEPART",
3068
+ "IFCBUILDINGSTOREY"
3069
+ ],
3070
+ [
3071
+ "IFCROAD",
3072
+ "IFCBUILDING"
3073
+ ],
3074
+ [
3075
+ "IFCROADPART",
3076
+ "IFCBUILDINGSTOREY"
3077
+ ],
3078
+ [
3079
+ "IFCRAILWAY",
3080
+ "IFCBUILDING"
3081
+ ],
3082
+ [
3083
+ "IFCRAILWAYPART",
3084
+ "IFCBUILDINGSTOREY"
3085
+ ],
3086
+ [
3087
+ "IFCMARINEFACILITY",
3088
+ "IFCBUILDING"
3089
+ ],
3090
+ [
3091
+ "IFCMARINEPART",
3092
+ "IFCBUILDINGSTOREY"
3093
+ ],
3094
+ [
3095
+ "IFCBUILTELEMENT",
3096
+ "IFCBUILDINGELEMENTPROXY"
3097
+ ],
3098
+ [
3099
+ "IFCEARTHWORKSCUT",
3100
+ "IFCBUILDINGELEMENTPROXY"
3101
+ ],
3102
+ [
3103
+ "IFCEARTHWORKSELEMENT",
3104
+ "IFCBUILDINGELEMENTPROXY"
3105
+ ],
3106
+ [
3107
+ "IFCEARTHWORKSFILL",
3108
+ "IFCBUILDINGELEMENTPROXY"
3109
+ ],
3110
+ [
3111
+ "IFCCAISSONFOUNDATION",
3112
+ "IFCFOOTING"
3113
+ ],
3114
+ [
3115
+ "IFCNAVIGATIONELEMENT",
3116
+ "IFCBUILDINGELEMENTPROXY"
3117
+ ],
3118
+ [
3119
+ "IFCMOORINGDEVICE",
3120
+ "IFCBUILDINGELEMENTPROXY"
3121
+ ],
3122
+ [
3123
+ "IFCPAVEMENT",
3124
+ "IFCSLAB"
3125
+ ],
3126
+ [
3127
+ "IFCRAIL",
3128
+ "IFCBUILDINGELEMENTPROXY"
3129
+ ],
3130
+ [
3131
+ "IFCREINFORCEDSOIL",
3132
+ "IFCBUILDINGELEMENTPROXY"
3133
+ ],
3134
+ [
3135
+ "IFCSIGN",
3136
+ "IFCBUILDINGELEMENTPROXY"
3137
+ ],
3138
+ [
3139
+ "IFCSIGNAL",
3140
+ "IFCBUILDINGELEMENTPROXY"
3141
+ ],
3142
+ [
3143
+ "IFCTRACKELEMENT",
3144
+ "IFCBUILDINGELEMENTPROXY"
3145
+ ],
3146
+ [
3147
+ "IFCKERB",
3148
+ "IFCBUILDINGELEMENTPROXY"
3149
+ ],
3150
+ [
3151
+ "IFCCOURSE",
3152
+ "IFCBUILDINGELEMENTPROXY"
3153
+ ],
3154
+ [
3155
+ "IFCLINEARPOSITIONINGELEMENT",
3156
+ "IFCPROXY"
3157
+ ],
3158
+ [
3159
+ "IFCPOSITIONINGELEMENT",
3160
+ "IFCPROXY"
3161
+ ],
3162
+ [
3163
+ "IFCREFERENT",
3164
+ "IFCPROXY"
3165
+ ],
3166
+ [
3167
+ "IFCALIGNMENT",
3168
+ "IFCPROXY"
3169
+ ],
3170
+ [
3171
+ "IFCLINEARELEMENT",
3172
+ "IFCPROXY"
3173
+ ],
3174
+ [
3175
+ "IFCCONVEYORSEGMENT",
3176
+ "IFCFLOWSEGMENT"
3177
+ ],
3178
+ [
3179
+ "IFCLIQUIDTERMINAL",
3180
+ "IFCFLOWTERMINAL"
3181
+ ],
3182
+ [
3183
+ "IFCMOBILETELECOMMUNICATIONSAPPLIANCE",
3184
+ "IFCCOMMUNICATIONSAPPLIANCE"
3185
+ ],
3186
+ [
3187
+ "IFCDISTRIBUTIONBOARD",
3188
+ "IFCELECTRICDISTRIBUTIONBOARD"
3189
+ ],
3190
+ [
3191
+ "IFCELECTRICFLOWTREATMENTDEVICE",
3192
+ "IFCFLOWTREATMENTDEVICE"
3193
+ ]
3194
+ ]), Gn = new Map([
3195
+ [
3196
+ "IFCWALL",
3197
+ 8
3198
+ ],
3199
+ [
3200
+ "IFCBEAM",
3201
+ 8
3202
+ ],
3203
+ [
3204
+ "IFCCOLUMN",
3205
+ 8
3206
+ ],
3207
+ [
3208
+ "IFCROOF",
3209
+ 9
3210
+ ],
3211
+ [
3212
+ "IFCSTAIR",
3213
+ 9
3214
+ ],
3215
+ [
3216
+ "IFCRAMP",
3217
+ 9
3218
+ ],
3219
+ [
3220
+ "IFCRAILING",
3221
+ 9
3222
+ ],
3223
+ [
3224
+ "IFCMEMBER",
3225
+ 8
3226
+ ],
3227
+ [
3228
+ "IFCPLATE",
3229
+ 8
3230
+ ],
3231
+ [
3232
+ "IFCFOOTING",
3233
+ 9
3234
+ ],
3235
+ [
3236
+ "IFCPILE",
3237
+ 11
3238
+ ],
3239
+ [
3240
+ "IFCCOVERING",
3241
+ 9
3242
+ ],
3243
+ [
3244
+ "IFCOPENINGELEMENT",
3245
+ 8
3246
+ ],
3247
+ [
3248
+ "IFCDOOR",
3249
+ 10
3250
+ ],
3251
+ [
3252
+ "IFCWINDOW",
3253
+ 10
3254
+ ],
3255
+ [
3256
+ "IFCFURNISHINGELEMENT",
3257
+ 8
3258
+ ],
3259
+ [
3260
+ "IFCBUILDINGELEMENTPROXY",
3261
+ 9
3262
+ ],
3263
+ [
3264
+ "IFCCURTAINWALL",
3265
+ 8
3266
+ ],
3267
+ [
3268
+ "IFCFLOWSEGMENT",
3269
+ 8
3270
+ ],
3271
+ [
3272
+ "IFCFLOWTERMINAL",
3273
+ 8
3274
+ ],
3275
+ [
3276
+ "IFCFLOWCONTROLLER",
3277
+ 8
3278
+ ],
3279
+ [
3280
+ "IFCFLOWFITTING",
3281
+ 8
3282
+ ],
3283
+ [
3284
+ "IFCFLOWMOVINGDEVICE",
3285
+ 8
3286
+ ],
3287
+ [
3288
+ "IFCFLOWSTORAGEDEVICE",
3289
+ 8
3290
+ ],
3291
+ [
3292
+ "IFCFLOWTREATMENTDEVICE",
3293
+ 8
3294
+ ],
3295
+ [
3296
+ "IFCENERGYCONVERSIONDEVICE",
3297
+ 8
3298
+ ],
3299
+ [
3300
+ "IFCDISTRIBUTIONELEMENT",
3301
+ 8
3302
+ ],
3303
+ [
3304
+ "IFCDISTRIBUTIONFLOWELEMENT",
3305
+ 8
3306
+ ],
3307
+ [
3308
+ "IFCDISTRIBUTIONCONTROLELEMENT",
3309
+ 8
3310
+ ],
3311
+ [
3312
+ "IFCDISTRIBUTIONCHAMBERELEMENT",
3313
+ 8
3314
+ ]
3315
+ ]);
3316
+ function De(r, t, e) {
3317
+ if (t === e) return r;
3318
+ const n = r.toUpperCase();
3319
+ return $n(t, e)?.get(n) ?? n;
3320
+ }
3321
+ function $n(r, t) {
3322
+ return r === "IFC2X3" && t === "IFC4" ? Re : r === "IFC4" && t === "IFC2X3" ? Ne : r === "IFC4" && t === "IFC4X3" ? Jt : r === "IFC4X3" && t === "IFC4" ? Kt : r === "IFC5" && t === "IFC4X3" || r === "IFC4X3" && t === "IFC5" ? null : r === "IFC5" && t === "IFC4" ? Kt : r === "IFC4" && t === "IFC5" ? Jt : r === "IFC2X3" && (t === "IFC4X3" || t === "IFC5") ? Se(Re, Jt) : (r === "IFC4X3" || r === "IFC5") && t === "IFC2X3" ? Se(Kt, Ne) : null;
3323
+ }
3324
+ function Se(r, t) {
3325
+ const e = new Map;
3326
+ for (const [n, s] of r)e.set(n, t.get(s) ?? s);
3327
+ for (const [n, s] of t)e.has(n) || e.set(n, s);
3328
+ return e;
3329
+ }
3330
+ function jt(r, t, e) {
3331
+ if (t === e) return r;
3332
+ const n = r.match(/^(#\d+=)(\w+)\((.*)?\);?\s*$/);
3333
+ if (!n) return r;
3334
+ const s = n[1], i = n[2].toUpperCase(), o = n[3] ?? "", a = De(i, t, e);
3335
+ if (Vn(a, e)) return `${s}IFCPROXY('${Yn()}',$,'${i}',$,$,$,$,.NOTDEFINED.,$);`;
3336
+ let l = o;
3337
+ if (e === "IFC2X3") {
3338
+ const d = Gn.get(a);
3339
+ d !== void 0 && (l = zn(o, d));
3340
+ }
3341
+ return `${s}${a}(${l});`;
3342
+ }
3343
+ function Vn(r, t) {
3344
+ return t === "IFC4X3" || t === "IFC5" ? !1 : new Set([
3345
+ "IFCALIGNMENTCANT",
3346
+ "IFCALIGNMENTHORIZONTAL",
3347
+ "IFCALIGNMENTVERTICAL",
3348
+ "IFCALIGNMENTSEGMENT"
3349
+ ]).has(r);
3350
+ }
3351
+ function zn(r, t) {
3352
+ if (!r.trim()) return r;
3353
+ const e = [];
3354
+ let n = 0, s = !1, i = "";
3355
+ for(let o = 0; o < r.length; o++){
3356
+ const a = r[o];
3357
+ if (a === "'" && !s) s = !0, i += a;
3358
+ else if (a === "'" && s) {
3359
+ if (o + 1 < r.length && r[o + 1] === "'") {
3360
+ i += "''", o++;
3361
+ continue;
3362
+ }
3363
+ s = !1, i += a;
3364
+ } else if (s) i += a;
3365
+ else if (a === "(") n++, i += a;
3366
+ else if (a === ")") n--, i += a;
3367
+ else if (a === "," && n === 0) {
3368
+ if (e.push(i), i = "", e.length >= t) return e.join(",");
3369
+ } else i += a;
3370
+ }
3371
+ return e.push(i), e.length > t ? e.slice(0, t).join(",") : e.join(",");
3372
+ }
3373
+ function ce(r, t) {
3374
+ return r !== t;
3375
+ }
3376
+ let kn = 0;
3377
+ function Yn() {
3378
+ const r = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_$", t = kn++;
3379
+ let e = "PROXY_", n = t;
3380
+ for(let s = 0; s < 16; s++)e += r[n % 64], n = Math.floor(n / 64) + s;
3381
+ return e;
3382
+ }
3383
+ function et(r) {
3384
+ return r.replace(/\\/g, "\\\\").replace(/'/g, "''");
3385
+ }
3386
+ function Z(r) {
3387
+ if (!Number.isFinite(r)) return "0.";
3388
+ const t = r.toString();
3389
+ return t.includes(".") ? t : t + ".";
3390
+ }
3391
+ function Wn(r) {
3392
+ switch(r){
3393
+ case Ct.Length:
3394
+ return "IFCQUANTITYLENGTH";
3395
+ case Ct.Area:
3396
+ return "IFCQUANTITYAREA";
3397
+ case Ct.Volume:
3398
+ return "IFCQUANTITYVOLUME";
3399
+ case Ct.Count:
3400
+ return "IFCQUANTITYCOUNT";
3401
+ case Ct.Weight:
3402
+ return "IFCQUANTITYWEIGHT";
3403
+ case Ct.Time:
3404
+ return "IFCQUANTITYTIME";
3405
+ default:
3406
+ return "IFCQUANTITYCOUNT";
3407
+ }
3408
+ }
3409
+ function ve(r, t) {
3410
+ if (r == null) return "$";
3411
+ switch(t){
3412
+ case tt.String:
3413
+ case tt.Label:
3414
+ case tt.Text:
3415
+ return `IFCLABEL('${et(String(r))}')`;
3416
+ case tt.Identifier:
3417
+ return `IFCIDENTIFIER('${et(String(r))}')`;
3418
+ case tt.Real:
3419
+ {
3420
+ const e = Number(r);
3421
+ return Number.isFinite(e) ? `IFCREAL(${e.toString().includes(".") ? e : e + "."})` : "$";
3422
+ }
3423
+ case tt.Integer:
3424
+ return `IFCINTEGER(${Math.round(Number(r))})`;
3425
+ case tt.Boolean:
3426
+ case tt.Logical:
3427
+ return r === !0 ? "IFCBOOLEAN(.T.)" : r === !1 ? "IFCBOOLEAN(.F.)" : "IFCLOGICAL(.U.)";
3428
+ case tt.Enum:
3429
+ return `.${String(r).toUpperCase()}.`;
3430
+ case tt.List:
3431
+ return Array.isArray(r) ? `(${r.map((n)=>ve(n, tt.String)).join(",")})` : "$";
3432
+ default:
3433
+ return `IFCLABEL('${et(String(r))}')`;
3434
+ }
3435
+ }
3436
+ function jn(r, t) {
3437
+ const e = r.trim(), n = t.trim();
3438
+ if (r === "") return "$";
3439
+ if (e === "$" || e === "*" || /^#\d+$/.test(e)) return e;
3440
+ if (/^\.[A-Z0-9_]+\.$/i.test(n) || /^\.[A-Z0-9_]+\.$/i.test(e)) return `.${e.replace(/^\./, "").replace(/\.$/, "").toUpperCase()}.`;
3441
+ if (/^(?:\.T\.|\.F\.|\.U\.)$/i.test(n)) {
3442
+ const s = e.toLowerCase();
3443
+ return s === "true" || s === ".t." ? ".T." : s === "false" || s === ".f." ? ".F." : ".U.";
3444
+ }
3445
+ if (/^-?\d+(?:\.\d+)?(?:E[+-]?\d+)?$/i.test(e) && /^-?\d/.test(n)) {
3446
+ const s = Number(e);
3447
+ return Number.isFinite(s) ? n.includes(".") || /E/i.test(n) ? Z(s) : String(s) : "$";
3448
+ }
3449
+ return Me(r);
3450
+ }
3451
+ function le(r) {
3452
+ if (r == null) return "$";
3453
+ if (typeof r == "boolean") return r ? ".T." : ".F.";
3454
+ if (typeof r == "number") return Number.isFinite(r) ? Number.isInteger(r) ? String(r) : Z(r) : "$";
3455
+ if (Array.isArray(r)) return `(${r.map(le).join(",")})`;
3456
+ const t = String(r).trim();
3457
+ return t === "$" || t === "*" || /^#\d+$/.test(t) ? t : /^\.[A-Z0-9_]+\.$/i.test(t) ? t.toUpperCase() : `'${et(String(r))}'`;
3458
+ }
3459
+ function Hn(r) {
3460
+ return r.map(le).join(",");
3461
+ }
3462
+ function Ae(r) {
3463
+ const t = [];
3464
+ let e = "", n = 0, s = !1;
3465
+ for(let i = 0; i < r.length; i++){
3466
+ const o = r[i];
3467
+ if (e += o, s) {
3468
+ o === "'" && (r[i + 1] === "'" ? (e += r[i + 1], i++) : s = !1);
3469
+ continue;
3470
+ }
3471
+ if (o === "'") {
3472
+ s = !0;
3473
+ continue;
3474
+ }
3475
+ if (o === "(") {
3476
+ n++;
3477
+ continue;
3478
+ }
3479
+ if (o === ")") {
3480
+ n--;
3481
+ continue;
3482
+ }
3483
+ o === "," && n === 0 && (t.push(e.slice(0, -1).trim()), e = "");
3484
+ }
3485
+ return e.trim() && t.push(e.trim()), t;
3486
+ }
3487
+ function Xn(r) {
3488
+ const t = [];
3489
+ let e = "", n = 0, s = !1;
3490
+ for(let i = 0; i < r.length; i++){
3491
+ const o = r[i];
3492
+ if (o === "'") {
3493
+ if (e += o, s && i + 1 < r.length && r[i + 1] === "'") {
3494
+ e += r[i + 1], i++;
3495
+ continue;
3496
+ }
3497
+ s = !s;
3498
+ continue;
3499
+ }
3500
+ if (!s) {
3501
+ if (o === "(") n++;
3502
+ else if (o === ")") n--;
3503
+ else if (o === "," && n === 0) {
3504
+ t.push(e), e = "";
3505
+ continue;
3506
+ }
3507
+ }
3508
+ e += o;
3509
+ }
3510
+ return t.push(e), t;
3511
+ }
3512
+ qn = class {
3513
+ dataStore;
3514
+ mutationView;
3515
+ nextExpressId;
3516
+ entityExtractor;
3517
+ constructor(t, e){
3518
+ this.dataStore = t, this.mutationView = e || null;
3519
+ const n = this.findMaxExpressId(), s = typeof e?.peekNextExpressId == "function" ? e.peekNextExpressId() - 1 : 0;
3520
+ this.nextExpressId = Math.max(n, s) + 1, this.entityExtractor = t.source ? new ke(t.source) : null;
3521
+ }
3522
+ export(t) {
3523
+ const e = [];
3524
+ let n = 0, s = 0;
3525
+ const i = t.schema || this.dataStore.schemaVersion || "IFC4", o = this.dataStore.schemaVersion || "IFC4", a = ce(o, i);
3526
+ if (i === "IFC2X3" && t.applyMutations !== !1 && t.georefMutations && (Object.keys(t.georefMutations.projectedCRS ?? {}).length > 0 || Object.keys(t.georefMutations.mapConversion ?? {}).length > 0)) throw new Error("Georeferencing creation and editing requires IFC4 or newer. IFC2X3 does not support IfcProjectedCRS or IfcMapConversion.");
3527
+ const l = ee({
3528
+ schema: i,
3529
+ description: t.description || "Exported from ifc-lite",
3530
+ author: t.author || "",
3531
+ organization: t.organization || "",
3532
+ application: t.application || "ifc-lite",
3533
+ filename: t.filename || "export.ifc"
3534
+ }), d = new Set, u = new Map, f = new Map, p = [], _ = [], h = new Map, y = new Map, m = new Set, b = new Map, w = new Set, v = new Set;
3535
+ if (this.mutationView && t.applyMutations !== !1) {
3536
+ const C = this.mutationView.getMutations(), N = new Map, F = new Map;
3537
+ for (const g of C){
3538
+ if (g.type === "UPDATE_ATTRIBUTE" && g.attributeName) {
3539
+ d.add(g.entityId), f.has(g.entityId) || f.set(g.entityId, new Map), f.get(g.entityId).set(g.attributeName, g.newValue == null ? "" : String(g.newValue));
3540
+ continue;
3541
+ }
3542
+ if (!g.psetName) continue;
3543
+ const I = g.type === "CREATE_QUANTITY" || g.type === "UPDATE_QUANTITY" || g.type === "DELETE_QUANTITY" ? F : N;
3544
+ I.has(g.entityId) || I.set(g.entityId, new Set), I.get(g.entityId).add(g.psetName);
3545
+ }
3546
+ const E = this.buildRelDefinesByPropertiesIndex();
3547
+ for (const [g, T] of N){
3548
+ d.add(g), u.set(g, T), s++;
3549
+ const R = this.mutationView.getForEntity(g).filter(($)=>T.has($.name)), S = new Set;
3550
+ R.length > 0 && p.push({
3551
+ entityId: g,
3552
+ psets: R
3553
+ });
3554
+ const G = E.get(g);
3555
+ if (G) for (const { relId: $, psetId: V } of G){
3556
+ const H = this.getPropertySetName(V);
3557
+ if (H && S.add(H), H && T.has(H)) {
3558
+ v.add($), w.add(V);
3559
+ const z = this.getPropertyIdsInSet(V);
3560
+ for (const Q of z)w.add(Q);
3561
+ }
3562
+ }
3563
+ if (this.isTypeEntity(g)) {
3564
+ const $ = this.getTypeOwnedHasPropertySetIds(g), V = new Set;
3565
+ for (const H of $){
3566
+ const z = this.getPropertySetName(H);
3567
+ if (!z || !T.has(z)) continue;
3568
+ V.add(z), w.add(H);
3569
+ const Q = this.getPropertyIdsInSet(H);
3570
+ for (const K of Q)w.add(K);
3571
+ }
3572
+ for (const H of T)S.has(H) || V.add(H);
3573
+ V.size > 0 && (h.set(g, V), y.set(g, $), m.add(g));
3574
+ }
3575
+ }
3576
+ t.includeQuantities === !1 && F.clear();
3577
+ for (const [g, T] of F){
3578
+ d.add(g), u.has(g) || s++;
3579
+ const R = this.mutationView.getQuantitiesForEntity(g).filter((G)=>T.has(G.name));
3580
+ R.length > 0 && _.push({
3581
+ entityId: g,
3582
+ qsets: R
3583
+ });
3584
+ const S = E.get(g);
3585
+ if (S) for (const { relId: G, psetId: $ } of S){
3586
+ const V = this.getElementQuantityName($);
3587
+ if (V && T.has(V)) {
3588
+ v.add(G), w.add($);
3589
+ const H = this.getPropertyIdsInSet($);
3590
+ for (const z of H)w.add(z);
3591
+ }
3592
+ }
3593
+ }
3594
+ for (const [g] of f)!N.has(g) && !F.has(g) && s++;
3595
+ }
3596
+ const L = [];
3597
+ if (t.applyMutations !== !1 && t.georefMutations) {
3598
+ const C = t.georefMutations, N = this.dataStore.entityIndex.byType.get("IFCPROJECTEDCRS"), F = this.dataStore.entityIndex.byType.get("IFCMAPCONVERSION");
3599
+ if (C.projectedCRS && N?.length) {
3600
+ const E = N[0];
3601
+ f.has(E) || f.set(E, new Map);
3602
+ const g = f.get(E), T = C.projectedCRS;
3603
+ let I = !1;
3604
+ if (T.name !== void 0 && (g.set("Name", String(T.name)), I = !0), T.description !== void 0 && (g.set("Description", String(T.description)), I = !0), T.geodeticDatum !== void 0 && (g.set("GeodeticDatum", String(T.geodeticDatum)), I = !0), T.verticalDatum !== void 0 && (g.set("VerticalDatum", String(T.verticalDatum)), I = !0), T.mapProjection !== void 0 && (g.set("MapProjection", String(T.mapProjection)), I = !0), T.mapZone !== void 0 && (g.set("MapZone", String(T.mapZone)), I = !0), T.mapUnit !== void 0) {
3605
+ const R = this.resolveMapUnitReference(String(T.mapUnit), L);
3606
+ g.set("MapUnit", `#${R}`), I = !0;
3607
+ }
3608
+ I && !d.has(E) && (d.add(E), s++);
3609
+ }
3610
+ if (C.mapConversion && F?.length) {
3611
+ const E = F[0];
3612
+ f.has(E) || f.set(E, new Map);
3613
+ const g = f.get(E), T = C.mapConversion;
3614
+ let I = !1;
3615
+ T.eastings !== void 0 && (g.set("Eastings", String(T.eastings)), I = !0), T.northings !== void 0 && (g.set("Northings", String(T.northings)), I = !0), T.orthogonalHeight !== void 0 && (g.set("OrthogonalHeight", String(T.orthogonalHeight)), I = !0), T.xAxisAbscissa !== void 0 && (g.set("XAxisAbscissa", String(T.xAxisAbscissa)), I = !0), T.xAxisOrdinate !== void 0 && (g.set("XAxisOrdinate", String(T.xAxisOrdinate)), I = !0), T.scale !== void 0 && (g.set("Scale", String(T.scale)), I = !0), I && !d.has(E) && (d.add(E), s++);
3616
+ }
3617
+ if (C.projectedCRS && !N?.length) {
3618
+ const E = C.projectedCRS, g = this.nextExpressId++, T = E.name ? `'${et(String(E.name))}'` : "$", I = E.description ? `'${et(String(E.description))}'` : "$", R = E.geodeticDatum ? `'${et(String(E.geodeticDatum))}'` : "$", S = E.verticalDatum ? `'${et(String(E.verticalDatum))}'` : "$", G = E.mapProjection ? `'${et(String(E.mapProjection))}'` : "$", $ = E.mapZone ? `'${et(String(E.mapZone))}'` : "$", V = E.mapUnit ? `#${this.resolveMapUnitReference(String(E.mapUnit), L)}` : "$";
3619
+ L.push(`#${g}=IFCPROJECTEDCRS(${T},${I},${R},${S},${G},${$},${V});`), n++;
3620
+ const H = this.findPreferredGeometricRepresentationContextId();
3621
+ if (H) {
3622
+ const z = C.mapConversion || {}, Q = this.nextExpressId++, K = Z(Number(z.eastings) || 0), ot = Z(Number(z.northings) || 0), ut = Z(Number(z.orthogonalHeight) || 0), it = z.xAxisAbscissa !== void 0 ? Z(Number(z.xAxisAbscissa)) : "$", lt = z.xAxisOrdinate !== void 0 ? Z(Number(z.xAxisOrdinate)) : "$", at = z.scale !== void 0 ? Z(Number(z.scale)) : "$";
3623
+ L.push(`#${Q}=IFCMAPCONVERSION(#${H},#${g},${K},${ot},${ut},${it},${lt},${at});`), n++;
3624
+ } else console.warn("[StepExporter] Cannot create IfcMapConversion: no IfcGeometricRepresentationContext found in source file");
3625
+ } else if (C.mapConversion && !F?.length && N?.length) {
3626
+ const E = this.findPreferredGeometricRepresentationContextId();
3627
+ if (E) {
3628
+ const g = C.mapConversion, T = this.nextExpressId++, I = Z(Number(g.eastings) || 0), R = Z(Number(g.northings) || 0), S = Z(Number(g.orthogonalHeight) || 0), G = g.xAxisAbscissa !== void 0 ? Z(Number(g.xAxisAbscissa)) : "$", $ = g.xAxisOrdinate !== void 0 ? Z(Number(g.xAxisOrdinate)) : "$", V = g.scale !== void 0 ? Z(Number(g.scale)) : "$";
3629
+ L.push(`#${T}=IFCMAPCONVERSION(#${E},#${N[0]},${I},${R},${S},${G},${$},${V});`), n++;
3630
+ } else console.warn("[StepExporter] Cannot create IfcMapConversion: no IfcGeometricRepresentationContext found in source file");
3631
+ }
3632
+ }
3633
+ const j = this.mutationView && t.applyMutations !== !1 && typeof this.mutationView.getNewEntities == "function" ? this.mutationView.getNewEntities().length : 0;
3634
+ if (t.deltaOnly && d.size === 0 && j === 0 && L.length === 0) {
3635
+ const C = new TextEncoder().encode(l + `DATA;
3636
+ ENDSEC;
3637
+ END-ISO-10303-21;
3638
+ `);
3639
+ return {
3640
+ content: C,
3641
+ stats: {
3642
+ entityCount: 0,
3643
+ newEntityCount: 0,
3644
+ modifiedEntityCount: 0,
3645
+ fileSize: C.byteLength
3646
+ }
3647
+ };
3648
+ }
3649
+ let O = null;
3650
+ if (t.visibleOnly && this.dataStore.source) {
3651
+ const { roots: C, hiddenProductIds: N } = oe(this.dataStore, t.hiddenEntityIds ?? new Set, t.isolatedEntityIds ?? null);
3652
+ O = re(C, this.dataStore.source, this.dataStore.entityIndex.byId, N), ae(O, this.dataStore.source, this.dataStore.entityIndex);
3653
+ }
3654
+ if (!t.deltaOnly && this.dataStore.source) {
3655
+ const C = this.dataStore.source, N = !!this.mutationView && t.applyMutations !== !1;
3656
+ for (const [F, E] of this.dataStore.entityIndex.byId){
3657
+ if (N && typeof this.mutationView.isDeleted == "function" && this.mutationView.isDeleted(F) || E.byteLength === 0 || E.byteOffset < 0 || O !== null && !O.has(F) || w.has(F) || v.has(F) || m.has(F)) continue;
3658
+ const g = E.type.toUpperCase();
3659
+ if (t.includeGeometry === !1 && this.isGeometryEntity(g)) continue;
3660
+ const T = st(C, E.byteOffset, E.byteOffset + E.byteLength);
3661
+ let I = f.has(F) ? this.applyAttributeMutations(T, g, f.get(F)) : T;
3662
+ const R = N && typeof this.mutationView.getPositionalMutationsForEntity == "function" ? this.mutationView.getPositionalMutationsForEntity(F) : null;
3663
+ if (R && R.size > 0 && (I = this.applyPositionalMutations(I, R), d.has(F) || (d.add(F), s++)), a) {
3664
+ const S = jt(I, o, i);
3665
+ S !== null && e.push(S);
3666
+ } else e.push(I);
3667
+ }
3668
+ }
3669
+ for (const { entityId: C, psets: N } of p){
3670
+ const F = this.generatePropertySetEntities(C, N, h.get(C));
3671
+ e.push(...F.lines), n += F.count;
3672
+ const E = h.get(C);
3673
+ if (E && E.size > 0) {
3674
+ const g = this.rewriteTypeEntityHasPropertySets(C, y.get(C) ?? [], E, F.generatedTypeOwnedPsetIds);
3675
+ g && b.set(C, g);
3676
+ }
3677
+ }
3678
+ for (const [C, N] of h){
3679
+ if (b.has(C)) continue;
3680
+ const F = this.rewriteTypeEntityHasPropertySets(C, y.get(C) ?? [], N, new Map);
3681
+ F && b.set(C, F);
3682
+ }
3683
+ for (const { entityId: C, qsets: N } of _){
3684
+ const F = this.generateQuantitySetEntities(C, N);
3685
+ e.push(...F.lines), n += F.count;
3686
+ }
3687
+ for (const C of b.values())e.push(C);
3688
+ for (const C of L)e.push(C);
3689
+ if (this.mutationView && t.applyMutations !== !1 && typeof this.mutationView.getNewEntities == "function") for (const C of this.mutationView.getNewEntities()){
3690
+ const N = C.type.toUpperCase();
3691
+ if (t.includeGeometry === !1 && this.isGeometryEntity(N) || O !== null && !O.has(C.expressId)) continue;
3692
+ const F = `#${C.expressId}=${N}(${Hn(C.attributes)});`;
3693
+ if (a) {
3694
+ const E = jt(F, o, i);
3695
+ E !== null && (e.push(E), n++);
3696
+ } else e.push(F), n++;
3697
+ }
3698
+ const U = Qn(l, e);
3699
+ return {
3700
+ content: U,
3701
+ stats: {
3702
+ entityCount: e.length,
3703
+ newEntityCount: n,
3704
+ modifiedEntityCount: s,
3705
+ fileSize: U.byteLength
3706
+ }
3707
+ };
3708
+ }
3709
+ async exportAsync(t) {
3710
+ const e = t.onProgress, n = this.dataStore.entityIndex.byId.size;
3711
+ e && e({
3712
+ phase: "preparing",
3713
+ percent: 0,
3714
+ entitiesProcessed: 0,
3715
+ entitiesTotal: n
3716
+ }), await new Promise((i)=>setTimeout(i, 0)), e && e({
3717
+ phase: "entities",
3718
+ percent: .1,
3719
+ entitiesProcessed: 0,
3720
+ entitiesTotal: n
3721
+ }), await new Promise((i)=>setTimeout(i, 0));
3722
+ const s = this.export(t);
3723
+ return e && e({
3724
+ phase: "assembling",
3725
+ percent: .95,
3726
+ entitiesProcessed: n,
3727
+ entitiesTotal: n
3728
+ }), await new Promise((i)=>setTimeout(i, 0)), s;
3729
+ }
3730
+ exportPropertiesOnly(t) {
3731
+ return this.export({
3732
+ ...t,
3733
+ includeGeometry: !1,
3734
+ deltaOnly: !0
3735
+ });
3736
+ }
3737
+ generatePropertySetEntities(t, e, n) {
3738
+ const s = [];
3739
+ let i = 0;
3740
+ const o = new Map;
3741
+ for (const a of e){
3742
+ const l = [];
3743
+ for (const _ of a.properties){
3744
+ const h = this.nextExpressId++;
3745
+ i++;
3746
+ const y = ve(_.value, _.type), m = _.unit ? this.findUnitId(_.unit) : null, b = m !== null ? je(m) : null, w = `#${h}=IFCPROPERTYSINGLEVALUE('${et(_.name)}',$,${y},${b ? Me(b) : "$"});`;
3747
+ s.push(w), l.push(h);
3748
+ }
3749
+ const d = this.nextExpressId++;
3750
+ i++;
3751
+ const u = l.map((_)=>`#${_}`).join(","), f = this.generateGlobalId(), p = `#${d}=IFCPROPERTYSET('${f}',$,'${et(a.name)}',$,(${u}));`;
3752
+ if (s.push(p), n?.has(a.name)) o.set(a.name, d);
3753
+ else {
3754
+ const _ = this.nextExpressId++;
3755
+ i++;
3756
+ const h = this.generateGlobalId(), y = `#${_}=IFCRELDEFINESBYPROPERTIES('${h}',$,$,$,(#${t}),#${d});`;
3757
+ s.push(y);
3758
+ }
3759
+ }
3760
+ return {
3761
+ lines: s,
3762
+ count: i,
3763
+ generatedTypeOwnedPsetIds: o
3764
+ };
3765
+ }
3766
+ generateQuantitySetEntities(t, e) {
3767
+ const n = [];
3768
+ let s = 0;
3769
+ for (const i of e){
3770
+ const o = [];
3771
+ for (const h of i.quantities){
3772
+ const y = this.nextExpressId++;
3773
+ s++;
3774
+ const m = Wn(h.type), b = Z(h.value), w = `#${y}=${m}('${et(h.name)}',$,$,${b},$);`;
3775
+ n.push(w), o.push(y);
3776
+ }
3777
+ const a = this.nextExpressId++;
3778
+ s++;
3779
+ const l = o.map((h)=>`#${h}`).join(","), d = this.generateGlobalId(), u = `#${a}=IFCELEMENTQUANTITY('${d}',$,'${et(i.name)}',$,$,(${l}));`;
3780
+ n.push(u);
3781
+ const f = this.nextExpressId++;
3782
+ s++;
3783
+ const p = this.generateGlobalId(), _ = `#${f}=IFCRELDEFINESBYPROPERTIES('${p}',$,$,$,(#${t}),#${a});`;
3784
+ n.push(_);
3785
+ }
3786
+ return {
3787
+ lines: n,
3788
+ count: s
3789
+ };
3790
+ }
3791
+ applyAttributeMutations(t, e, n) {
3792
+ const s = t.indexOf("("), i = t.lastIndexOf(");");
3793
+ if (s < 0 || i < s) return t;
3794
+ const o = Ye(e);
3795
+ if (o.length === 0) return t;
3796
+ const a = Ae(t.slice(s + 1, i));
3797
+ let l = !1;
3798
+ for (const [d, u] of n){
3799
+ const f = o.indexOf(d);
3800
+ f < 0 || f >= a.length || (a[f] = jn(u, a[f]), l = !0);
3801
+ }
3802
+ return l ? `${t.slice(0, s + 1)}${a.join(",")}${t.slice(i)}` : t;
3803
+ }
3804
+ applyPositionalMutations(t, e) {
3805
+ const n = t.indexOf("("), s = t.lastIndexOf(");");
3806
+ if (n < 0 || s < n) return t;
3807
+ const i = Ae(t.slice(n + 1, s));
3808
+ let o = !1;
3809
+ for (const [a, l] of e)a < 0 || a >= i.length || (i[a] = le(l), o = !0);
3810
+ return o ? `${t.slice(0, n + 1)}${i.join(",")}${t.slice(s)}` : t;
3811
+ }
3812
+ resolveMapUnitReference(t, e) {
3813
+ const n = this.normalizeMapUnitName(t), s = this.findLengthUnitReference(n);
3814
+ if (s !== null) return s;
3815
+ if (n === "METRE") {
3816
+ const o = this.nextExpressId++;
3817
+ return e.push(`#${o}=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.);`), o;
3818
+ }
3819
+ if (n === "FOOT" || n === "US SURVEY FOOT") {
3820
+ const o = this.nextExpressId++, a = this.nextExpressId++, l = this.nextExpressId++, d = this.nextExpressId++, u = n === "US SURVEY FOOT" ? 1200 / 3937 : .3048, f = n === "US SURVEY FOOT" ? "US SURVEY FOOT" : "FOOT";
3821
+ return e.push(`#${o}=IFCDIMENSIONALEXPONENTS(1,0,0,0,0,0,0);`), e.push(`#${a}=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.);`), e.push(`#${l}=IFCMEASUREWITHUNIT(IFCLENGTHMEASURE(${Z(u)}),#${a});`), e.push(`#${d}=IFCCONVERSIONBASEDUNIT(#${o},.LENGTHUNIT.,'${f}',#${l});`), d;
3822
+ }
3823
+ const i = this.nextExpressId++;
3824
+ return e.push(`#${i}=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.);`), i;
3825
+ }
3826
+ normalizeMapUnitName(t) {
3827
+ const e = t.trim().toUpperCase().replace(/\s+/g, " ");
3828
+ return e.includes("US SURVEY FOOT") ? "US SURVEY FOOT" : e.includes("METER") || e.includes("METRE") ? "METRE" : e.includes("FOOT") || e.includes("FEET") ? "FOOT" : e;
3829
+ }
3830
+ findLengthUnitReference(t) {
3831
+ if (!this.entityExtractor) return null;
3832
+ const e = this.dataStore.entityIndex.byType.get("IFCPROJECT") ?? [], n = e[0] ? this.dataStore.entityIndex.byId.get(e[0]) : void 0, i = (n ? this.entityExtractor.extractEntity(n) : null)?.attributes?.[8];
3833
+ if (typeof i != "number") return null;
3834
+ const o = this.dataStore.entityIndex.byId.get(i), l = (o ? this.entityExtractor.extractEntity(o) : null)?.attributes?.[0];
3835
+ if (!Array.isArray(l)) return null;
3836
+ for (const d of l){
3837
+ if (typeof d != "number") continue;
3838
+ const u = this.dataStore.entityIndex.byId.get(d), f = u ? this.entityExtractor.extractEntity(u) : null;
3839
+ if (!f) continue;
3840
+ const p = f.type.toUpperCase(), _ = f.attributes ?? [];
3841
+ if ((typeof _[1] == "string" ? _[1].replace(/\./g, "").toUpperCase() : "") === "LENGTHUNIT") {
3842
+ if (p === "IFCSIUNIT") {
3843
+ const y = typeof _[2] == "string" ? _[2].replace(/\./g, "").toUpperCase() : "", m = typeof _[3] == "string" ? _[3].replace(/\./g, "").toUpperCase() : "", b = y ? `${y}${m}` : m;
3844
+ if (t === "METRE" && (b === "METRE" || b === "METER")) return d;
3845
+ }
3846
+ if (p === "IFCCONVERSIONBASEDUNIT" && (typeof _[2] == "string" ? this.normalizeMapUnitName(_[2]) : "") === t) return d;
3847
+ }
3848
+ }
3849
+ return null;
3850
+ }
3851
+ findPreferredGeometricRepresentationContextId() {
3852
+ if (!this.entityExtractor) return null;
3853
+ const t = this.dataStore.entityIndex.byType.get("IFCGEOMETRICREPRESENTATIONCONTEXT") ?? [];
3854
+ let e = null;
3855
+ for (const n of t){
3856
+ const s = this.dataStore.entityIndex.byId.get(n), i = s ? this.entityExtractor.extractEntity(s) : null;
3857
+ if (!i) continue;
3858
+ const o = i.attributes ?? [], a = typeof o[1] == "string" ? o[1].trim().toUpperCase() : "", l = typeof o[2] == "number" ? o[2] : null;
3859
+ if (l === 3 && e === null && (e = n), a === "MODEL" && l === 3) return n;
3860
+ }
3861
+ return e ?? t[0] ?? null;
3862
+ }
3863
+ generateGlobalId() {
3864
+ return We();
3865
+ }
3866
+ findMaxExpressId() {
3867
+ let t = 0;
3868
+ for (const [e] of this.dataStore.entityIndex.byId)e > t && (t = e);
3869
+ return t;
3870
+ }
3871
+ findUnitId(t) {
3872
+ return this.findLengthUnitReference(this.normalizeMapUnitName(t));
3873
+ }
3874
+ isGeometryEntity(t) {
3875
+ return new Set([
3876
+ "IFCCARTESIANPOINT",
3877
+ "IFCDIRECTION",
3878
+ "IFCAXIS2PLACEMENT2D",
3879
+ "IFCAXIS2PLACEMENT3D",
3880
+ "IFCLOCALPLACEMENT",
3881
+ "IFCSHAPEREPRESENTATION",
3882
+ "IFCPRODUCTDEFINITIONSHAPE",
3883
+ "IFCGEOMETRICREPRESENTATIONCONTEXT",
3884
+ "IFCGEOMETRICREPRESENTATIONSUBCONTEXT",
3885
+ "IFCEXTRUDEDAREASOLID",
3886
+ "IFCFACETEDBREP",
3887
+ "IFCPOLYLOOP",
3888
+ "IFCFACE",
3889
+ "IFCFACEOUTERBOUND",
3890
+ "IFCCLOSEDSHELL",
3891
+ "IFCRECTANGLEPROFILEDEF",
3892
+ "IFCCIRCLEPROFILEDEF",
3893
+ "IFCARBITRARYCLOSEDPROFILEDEF",
3894
+ "IFCPOLYLINE",
3895
+ "IFCTRIMMEDCURVE",
3896
+ "IFCBSPLINECURVE",
3897
+ "IFCBSPLINESURFACE",
3898
+ "IFCTRIANGULATEDFACESET",
3899
+ "IFCPOLYGONALFACE",
3900
+ "IFCINDEXEDPOLYGONALFACE",
3901
+ "IFCPOLYGONALFACESET",
3902
+ "IFCSTYLEDITEM",
3903
+ "IFCPRESENTATIONSTYLEASSIGNMENT",
3904
+ "IFCSURFACESTYLE",
3905
+ "IFCSURFACESTYLERENDERING",
3906
+ "IFCCOLOURRGB"
3907
+ ]).has(t);
3908
+ }
3909
+ buildRelDefinesByPropertiesIndex() {
3910
+ const t = new Map;
3911
+ for (const [e, n] of this.dataStore.entityIndex.byId){
3912
+ if (n.type.toUpperCase() !== "IFCRELDEFINESBYPROPERTIES") continue;
3913
+ const s = this.getRelatedPropertySet(e);
3914
+ if (s) for (const i of this.getRelatedEntities(e)){
3915
+ let o = t.get(i);
3916
+ o || (o = [], t.set(i, o)), o.push({
3917
+ relId: e,
3918
+ psetId: s
3919
+ });
3920
+ }
3921
+ }
3922
+ return t;
3923
+ }
3924
+ getRelatedEntities(t) {
3925
+ const e = this.dataStore.entityIndex.byId.get(t);
3926
+ if (!e || !this.dataStore.source) return [];
3927
+ const s = st(this.dataStore.source, e.byteOffset, e.byteOffset + e.byteLength).match(/\(([^)]+)\)\s*,\s*#(\d+)\s*\)\s*;/);
3928
+ if (!s) return [];
3929
+ const i = s[1], o = [], a = i.matchAll(/#(\d+)/g);
3930
+ for (const l of a)o.push(parseInt(l[1], 10));
3931
+ return o;
3932
+ }
3933
+ getRelatedPropertySet(t) {
3934
+ const e = this.dataStore.entityIndex.byId.get(t);
3935
+ if (!e || !this.dataStore.source) return null;
3936
+ const s = st(this.dataStore.source, e.byteOffset, e.byteOffset + e.byteLength).match(/,\s*#(\d+)\s*\)\s*;$/);
3937
+ return s ? parseInt(s[1], 10) : null;
3938
+ }
3939
+ getPropertySetName(t) {
3940
+ const e = this.dataStore.entityIndex.byId.get(t);
3941
+ if (!e || !this.dataStore.source) return null;
3942
+ const s = st(this.dataStore.source, e.byteOffset, e.byteOffset + e.byteLength).match(/IFCPROPERTYSET\s*\([^,]*,[^,]*,'([^']*)'/i);
3943
+ return s ? s[1] : null;
3944
+ }
3945
+ getElementQuantityName(t) {
3946
+ const e = this.dataStore.entityIndex.byId.get(t);
3947
+ if (!e || !this.dataStore.source) return null;
3948
+ const s = st(this.dataStore.source, e.byteOffset, e.byteOffset + e.byteLength).match(/IFCELEMENTQUANTITY\s*\([^,]*,[^,]*,'([^']*)'/i);
3949
+ return s ? s[1] : null;
3950
+ }
3951
+ getPropertyIdsInSet(t) {
3952
+ const e = this.dataStore.entityIndex.byId.get(t);
3953
+ if (!e || !this.dataStore.source) return [];
3954
+ const s = st(this.dataStore.source, e.byteOffset, e.byteOffset + e.byteLength).match(/\(\s*(#[^)]+)\s*\)\s*\)\s*;$/);
3955
+ if (!s) return [];
3956
+ const i = s[1], o = [], a = i.matchAll(/#(\d+)/g);
3957
+ for (const l of a)o.push(parseInt(l[1], 10));
3958
+ return o;
3959
+ }
3960
+ isTypeEntity(t) {
3961
+ return this.dataStore.entityIndex.byId.get(t)?.type.toUpperCase().endsWith("TYPE") ?? !1;
3962
+ }
3963
+ getTypeOwnedHasPropertySetIds(t) {
3964
+ if (!this.entityExtractor) return [];
3965
+ const e = this.dataStore.entityIndex.byId.get(t);
3966
+ if (!e) return [];
3967
+ const s = this.entityExtractor.extractEntity(e)?.attributes?.[5];
3968
+ return Array.isArray(s) ? s.filter((i)=>typeof i == "number") : [];
3969
+ }
3970
+ rewriteTypeEntityHasPropertySets(t, e, n, s) {
3971
+ const i = [], o = new Set;
3972
+ for (const l of e){
3973
+ const d = this.getPropertySetName(l);
3974
+ if (d && n.has(d)) {
3975
+ const u = s.get(d);
3976
+ u !== void 0 && (i.push(u), o.add(d));
3977
+ continue;
3978
+ }
3979
+ i.push(l);
3980
+ }
3981
+ for (const [l, d] of s)o.has(l) || i.push(d);
3982
+ const a = i.length > 0 ? `(${i.map((l)=>`#${l}`).join(",")})` : "$";
3983
+ return this.replaceEntityAttribute(t, 5, a);
3984
+ }
3985
+ replaceEntityAttribute(t, e, n) {
3986
+ const s = this.dataStore.entityIndex.byId.get(t);
3987
+ if (!s || !this.dataStore.source) return null;
3988
+ const o = st(this.dataStore.source, s.byteOffset, s.byteOffset + s.byteLength).match(/^(#\d+\s*=\s*\w+\()([\s\S]*)(\)\s*;)\s*$/);
3989
+ if (!o) return null;
3990
+ const [, a, l, d] = o, u = Xn(l);
3991
+ return e >= u.length ? null : (u[e] = n, `${a}${u.join(",")}${d}`);
3992
+ }
3993
+ };
3994
+ os = function(r, t) {
3995
+ const n = new qn(r).export({
3996
+ schema: "IFC4",
3997
+ ...t
3998
+ });
3999
+ return new TextDecoder().decode(n.content);
4000
+ };
4001
+ function Qn(r, t) {
4002
+ const e = new TextEncoder, n = e.encode(`${r}DATA;
4003
+ `), s = e.encode(`ENDSEC;
4004
+ END-ISO-10303-21;
4005
+ `), i = e.encode(`
4006
+ `);
4007
+ let o = n.byteLength + s.byteLength;
4008
+ const a = new Array(t.length);
4009
+ for(let u = 0; u < t.length; u++)a[u] = e.encode(t[u]), o += a[u].byteLength + i.byteLength;
4010
+ const l = new Uint8Array(o);
4011
+ let d = 0;
4012
+ l.set(n, d), d += n.byteLength;
4013
+ for(let u = 0; u < a.length; u++)l.set(a[u], d), d += a[u].byteLength, l.set(i, d), d += i.byteLength;
4014
+ return l.set(s, d), l;
4015
+ }
4016
+ const Jn = /#(\d+)/g, Kn = new Set([
4017
+ "IFCUNITASSIGNMENT",
4018
+ "IFCGEOMETRICREPRESENTATIONCONTEXT",
4019
+ "IFCGEOMETRICREPRESENTATIONSUBCONTEXT"
4020
+ ]);
4021
+ as = class {
4022
+ models;
4023
+ constructor(t){
4024
+ if (t.length === 0) throw new Error("MergedExporter requires at least one model");
4025
+ this.models = t;
4026
+ }
4027
+ export(t) {
4028
+ const e = t.onProgress, n = t.schema || "IFC4", s = ee({
4029
+ schema: n,
4030
+ description: t.description || `Merged export of ${this.models.length} models from ifc-lite`,
4031
+ author: t.author || "",
4032
+ organization: t.organization || "",
4033
+ application: t.application || "ifc-lite",
4034
+ filename: t.filename || "merged.ifc"
4035
+ }), i = [];
4036
+ let o = 1;
4037
+ const a = new Map;
4038
+ for (const y of this.models){
4039
+ a.set(y.id, o - 1);
4040
+ let m = 0;
4041
+ for (const [b] of y.dataStore.entityIndex.byId)b > m && (m = b);
4042
+ o += m;
4043
+ }
4044
+ const l = this.models[0], d = a.get(l.id), u = this.findInfrastructureEntities(l.dataStore), f = this.findEntitiesByType(l.dataStore, "IFCPROJECT"), p = this.buildSpatialLookup(l.dataStore);
4045
+ let _ = !0;
4046
+ for (const y of this.models){
4047
+ const m = a.get(y.id), b = y.dataStore.source;
4048
+ if (!b || b.length === 0) continue;
4049
+ let w = null;
4050
+ if (t.visibleOnly) {
4051
+ const j = t.hiddenEntityIdsByModel?.get(y.id) ?? new Set, O = t.isolatedEntityIdsByModel?.get(y.id) ?? null, { roots: U, hiddenProductIds: C } = oe(y.dataStore, j, O);
4052
+ w = re(U, b, y.dataStore.entityIndex.byId, C), ae(w, b, y.dataStore.entityIndex);
4053
+ }
4054
+ const v = new Map, L = new Set;
4055
+ if (!_) {
4056
+ const j = this.findEntitiesByType(y.dataStore, "IFCPROJECT");
4057
+ if (f.length > 0) for (const U of j)v.set(U, f[0] + d), L.add(U);
4058
+ const O = this.findInfrastructureEntities(y.dataStore);
4059
+ for (const [U, C] of u){
4060
+ const N = O.get(U);
4061
+ N && C.length > 0 && N.length > 0 && (v.set(N[0], C[0] + d), L.add(N[0]));
4062
+ }
4063
+ this.unifySpatialEntities(y.dataStore, p, d, v, L), this.skipRedundantRelAggregates(y.dataStore, v, L);
4064
+ }
4065
+ for (const [j, O] of y.dataStore.entityIndex.byId){
4066
+ if (w !== null && !w.has(j) || L.has(j)) continue;
4067
+ const U = st(b, O.byteOffset, O.byteOffset + O.byteLength);
4068
+ let C;
4069
+ m === 0 && v.size === 0 ? C = U : C = this.remapEntityText(U, m, v);
4070
+ const N = y.dataStore.schemaVersion || "IFC4";
4071
+ if (ce(N, n)) {
4072
+ const F = jt(C, N, n);
4073
+ F !== null && i.push(F);
4074
+ } else i.push(C);
4075
+ }
4076
+ _ = !1;
4077
+ }
4078
+ e && e({
4079
+ phase: "assembling",
4080
+ percent: .9,
4081
+ entitiesProcessed: i.length,
4082
+ entitiesTotal: i.length
4083
+ });
4084
+ const h = Oe(s, i);
4085
+ return {
4086
+ content: h,
4087
+ stats: {
4088
+ modelCount: this.models.length,
4089
+ totalEntityCount: i.length,
4090
+ fileSize: h.byteLength
4091
+ }
4092
+ };
4093
+ }
4094
+ async exportAsync(t) {
4095
+ const e = t.onProgress, n = t.schema || "IFC4", s = ee({
4096
+ schema: n,
4097
+ description: t.description || `Merged export of ${this.models.length} models from ifc-lite`,
4098
+ author: t.author || "",
4099
+ organization: t.organization || "",
4100
+ application: t.application || "ifc-lite",
4101
+ filename: t.filename || "merged.ifc"
4102
+ }), i = [];
4103
+ let o = 0;
4104
+ for (const w of this.models)o += w.dataStore.entityIndex.byId.size;
4105
+ let a = 1;
4106
+ const l = new Map;
4107
+ for (const w of this.models){
4108
+ l.set(w.id, a - 1);
4109
+ let v = 0;
4110
+ for (const [L] of w.dataStore.entityIndex.byId)L > v && (v = L);
4111
+ a += v;
4112
+ }
4113
+ const d = this.models[0], u = l.get(d.id), f = this.findInfrastructureEntities(d.dataStore), p = this.findEntitiesByType(d.dataStore, "IFCPROJECT"), _ = this.buildSpatialLookup(d.dataStore);
4114
+ let h = !0, y = 0;
4115
+ const m = 2e3;
4116
+ e && e({
4117
+ phase: "preparing",
4118
+ percent: 0,
4119
+ entitiesProcessed: 0,
4120
+ entitiesTotal: o
4121
+ });
4122
+ for (const w of this.models){
4123
+ const v = l.get(w.id), L = w.dataStore.source;
4124
+ if (!L || L.length === 0) continue;
4125
+ e && e({
4126
+ phase: "entities",
4127
+ percent: o > 0 ? y / o * .85 : 0,
4128
+ entitiesProcessed: y,
4129
+ entitiesTotal: o,
4130
+ currentModel: w.name
4131
+ });
4132
+ let j = null;
4133
+ if (t.visibleOnly) {
4134
+ const N = t.hiddenEntityIdsByModel?.get(w.id) ?? new Set, F = t.isolatedEntityIdsByModel?.get(w.id) ?? null, { roots: E, hiddenProductIds: g } = oe(w.dataStore, N, F);
4135
+ j = re(E, L, w.dataStore.entityIndex.byId, g), ae(j, L, w.dataStore.entityIndex);
4136
+ }
4137
+ const O = new Map, U = new Set;
4138
+ if (!h) {
4139
+ const N = this.findEntitiesByType(w.dataStore, "IFCPROJECT");
4140
+ if (p.length > 0) for (const E of N)O.set(E, p[0] + u), U.add(E);
4141
+ const F = this.findInfrastructureEntities(w.dataStore);
4142
+ for (const [E, g] of f){
4143
+ const T = F.get(E);
4144
+ T && g.length > 0 && T.length > 0 && (O.set(T[0], g[0] + u), U.add(T[0]));
4145
+ }
4146
+ this.unifySpatialEntities(w.dataStore, _, u, O, U), this.skipRedundantRelAggregates(w.dataStore, O, U);
4147
+ }
4148
+ let C = 0;
4149
+ for (const [N, F] of w.dataStore.entityIndex.byId){
4150
+ if (j !== null && !j.has(N) || U.has(N)) continue;
4151
+ const E = st(L, F.byteOffset, F.byteOffset + F.byteLength);
4152
+ let g;
4153
+ v === 0 && O.size === 0 ? g = E : g = this.remapEntityText(E, v, O);
4154
+ const T = w.dataStore.schemaVersion || "IFC4";
4155
+ if (ce(T, n)) {
4156
+ const I = jt(g, T, n);
4157
+ I !== null && i.push(I);
4158
+ } else i.push(g);
4159
+ C++, y++, C % m === 0 && (e && e({
4160
+ phase: "entities",
4161
+ percent: o > 0 ? y / o * .85 : 0,
4162
+ entitiesProcessed: y,
4163
+ entitiesTotal: o,
4164
+ currentModel: w.name
4165
+ }), await new Promise((I)=>setTimeout(I, 0)));
4166
+ }
4167
+ h = !1;
4168
+ }
4169
+ e && e({
4170
+ phase: "assembling",
4171
+ percent: .9,
4172
+ entitiesProcessed: o,
4173
+ entitiesTotal: o
4174
+ }), await new Promise((w)=>setTimeout(w, 0));
4175
+ const b = Oe(s, i);
4176
+ return e && e({
4177
+ phase: "assembling",
4178
+ percent: 1,
4179
+ entitiesProcessed: o,
4180
+ entitiesTotal: o
4181
+ }), {
4182
+ content: b,
4183
+ stats: {
4184
+ modelCount: this.models.length,
4185
+ totalEntityCount: i.length,
4186
+ fileSize: b.byteLength
4187
+ }
4188
+ };
4189
+ }
4190
+ remapEntityText(t, e, n) {
4191
+ return t.replace(Jn, (s, i)=>{
4192
+ const o = parseInt(i, 10), a = n.get(o);
4193
+ return a !== void 0 ? `#${a}` : `#${o + e}`;
4194
+ });
4195
+ }
4196
+ findInfrastructureEntities(t) {
4197
+ const e = new Map;
4198
+ for (const n of Kn){
4199
+ const s = t.entityIndex.byType.get(n) ?? [];
4200
+ s.length > 0 && e.set(n, [
4201
+ ...s
4202
+ ]);
4203
+ }
4204
+ return e;
4205
+ }
4206
+ findEntitiesByType(t, e) {
4207
+ return t.entityIndex.byType.get(e) ?? [];
4208
+ }
4209
+ buildSpatialLookup(t) {
4210
+ const e = {
4211
+ sitesByName: new Map,
4212
+ buildingsByName: new Map,
4213
+ storeysByName: new Map,
4214
+ storeysByElevation: [],
4215
+ siteIds: [],
4216
+ buildingIds: []
4217
+ };
4218
+ for (const n of this.findEntitiesByType(t, "IFCSITE")){
4219
+ e.siteIds.push(n);
4220
+ const s = this.extractEntityName(n, t);
4221
+ s && e.sitesByName.set(s.toLowerCase(), n);
4222
+ }
4223
+ for (const n of this.findEntitiesByType(t, "IFCBUILDING")){
4224
+ e.buildingIds.push(n);
4225
+ const s = this.extractEntityName(n, t);
4226
+ s && e.buildingsByName.set(s.toLowerCase(), n);
4227
+ }
4228
+ for (const n of this.findEntitiesByType(t, "IFCBUILDINGSTOREY")){
4229
+ const s = this.extractEntityName(n, t);
4230
+ s && e.storeysByName.set(s.toLowerCase(), n);
4231
+ const i = this.extractStoreyElevation(n, t);
4232
+ i !== void 0 && e.storeysByElevation.push({
4233
+ expressId: n,
4234
+ elevation: i
4235
+ });
4236
+ }
4237
+ return e;
4238
+ }
4239
+ unifySpatialEntities(t, e, n, s, i) {
4240
+ const o = this.findEntitiesByType(t, "IFCSITE");
4241
+ for (const d of o){
4242
+ const u = this.extractEntityName(d, t);
4243
+ let f;
4244
+ u && (f = e.sitesByName.get(u.toLowerCase())), f === void 0 && o.length === 1 && e.siteIds.length === 1 && (f = e.siteIds[0]), f !== void 0 && (s.set(d, f + n), i.add(d));
4245
+ }
4246
+ const a = this.findEntitiesByType(t, "IFCBUILDING");
4247
+ for (const d of a){
4248
+ const u = this.extractEntityName(d, t);
4249
+ let f;
4250
+ u && (f = e.buildingsByName.get(u.toLowerCase())), f === void 0 && a.length === 1 && e.buildingIds.length === 1 && (f = e.buildingIds[0]), f !== void 0 && (s.set(d, f + n), i.add(d));
4251
+ }
4252
+ const l = new Set;
4253
+ for (const d of this.findEntitiesByType(t, "IFCBUILDINGSTOREY")){
4254
+ const u = this.extractEntityName(d, t);
4255
+ let f;
4256
+ if (u) {
4257
+ const p = e.storeysByName.get(u.toLowerCase());
4258
+ p !== void 0 && !l.has(p) && (f = p);
4259
+ }
4260
+ if (f === void 0) {
4261
+ const p = this.extractStoreyElevation(d, t);
4262
+ if (p !== void 0) for (const _ of e.storeysByElevation){
4263
+ if (l.has(_.expressId)) continue;
4264
+ const h = Math.max(.5, Math.abs(_.elevation) * .01);
4265
+ if (Math.abs(p - _.elevation) <= h) {
4266
+ f = _.expressId;
4267
+ break;
4268
+ }
4269
+ }
4270
+ }
4271
+ f !== void 0 && (l.add(f), s.set(d, f + n), i.add(d));
4272
+ }
4273
+ }
4274
+ skipRedundantRelAggregates(t, e, n) {
4275
+ for (const s of this.findEntitiesByType(t, "IFCRELAGGREGATES")){
4276
+ const i = this.extractStepAttribute(s, t, 4);
4277
+ if (!i) continue;
4278
+ const o = i.match(/^#(\d+)$/);
4279
+ if (!o || !e.has(parseInt(o[1], 10))) continue;
4280
+ const a = this.extractStepAttribute(s, t, 5);
4281
+ if (!a) continue;
4282
+ const l = [], d = /#(\d+)/g;
4283
+ let u;
4284
+ for(; (u = d.exec(a)) !== null;)l.push(parseInt(u[1], 10));
4285
+ l.length !== 0 && l.every((f)=>e.has(f)) && n.add(s);
4286
+ }
4287
+ }
4288
+ extractEntityName(t, e) {
4289
+ const n = this.extractStepAttribute(t, e, 2);
4290
+ if (!n || n === "$") return null;
4291
+ if (n.startsWith("'") && n.endsWith("'")) {
4292
+ const s = n.slice(1, -1).replace(/''/g, "'");
4293
+ return He(s);
4294
+ }
4295
+ return null;
4296
+ }
4297
+ extractStoreyElevation(t, e) {
4298
+ const n = this.extractStepAttribute(t, e, 9);
4299
+ if (!n || n === "$") return;
4300
+ const s = n.match(/^[A-Z_]+\(([^)]+)\)$/i), i = s ? s[1] : n, o = parseFloat(i);
4301
+ return isNaN(o) ? void 0 : o;
4302
+ }
4303
+ extractStepAttribute(t, e, n) {
4304
+ const s = e.source;
4305
+ if (!s) return null;
4306
+ const i = e.entityIndex.byId.get(t);
4307
+ if (!i) return null;
4308
+ const o = st(s, i.byteOffset, i.byteOffset + i.byteLength), a = o.indexOf("(");
4309
+ if (a === -1) return null;
4310
+ let l = 0, d = 0, u = a + 1, f = !1;
4311
+ for(let p = a + 1; p < o.length; p++){
4312
+ const _ = o[p];
4313
+ if (_ === "'" && !f) f = !0;
4314
+ else if (_ === "'" && f) {
4315
+ if (p + 1 < o.length && o[p + 1] === "'") {
4316
+ p++;
4317
+ continue;
4318
+ }
4319
+ f = !1;
4320
+ } else if (!f) {
4321
+ if (_ === "(") l++;
4322
+ else if (_ === ")") {
4323
+ if (l === 0) return d === n ? o.substring(u, p).trim() : null;
4324
+ l--;
4325
+ } else if (_ === "," && l === 0) {
4326
+ if (d === n) return o.substring(u, p).trim();
4327
+ d++, u = p + 1;
4328
+ }
4329
+ }
4330
+ }
4331
+ return null;
4332
+ }
4333
+ };
4334
+ function Oe(r, t) {
4335
+ const e = new TextEncoder, n = e.encode(`${r}DATA;
4336
+ `), s = e.encode(`ENDSEC;
4337
+ END-ISO-10303-21;
4338
+ `), i = e.encode(`
4339
+ `);
4340
+ let o = n.byteLength + s.byteLength;
4341
+ const a = new Array(t.length);
4342
+ for(let u = 0; u < t.length; u++)a[u] = e.encode(t[u]), o += a[u].byteLength + i.byteLength;
4343
+ const l = new Uint8Array(o);
4344
+ let d = 0;
4345
+ l.set(n, d), d += n.byteLength;
4346
+ for(let u = 0; u < a.length; u++)l.set(a[u], d), d += a[u].byteLength, l.set(i, d), d += i.byteLength;
4347
+ return l.set(s, d), l;
4348
+ }
4349
+ let Zt;
4350
+ Zt = {
4351
+ IFC_CORE: "https://ifcx.dev/@standards.buildingsmart.org/ifc/core/ifc@v5a.ifcx",
4352
+ IFC_PROP: "https://ifcx.dev/@standards.buildingsmart.org/ifc/core/prop@v5a.ifcx",
4353
+ USD: "https://ifcx.dev/@openusd.org/usd@v1.ifcx"
4354
+ };
4355
+ Le = new Set([
4356
+ "UsageType",
4357
+ "TypeName",
4358
+ "IsExternal",
4359
+ "RefElevation",
4360
+ "ElevationOfRefHeight",
4361
+ "ElevationOfTerrain",
4362
+ "NumberOfStoreys",
4363
+ "Height",
4364
+ "Width",
4365
+ "Length",
4366
+ "Depth",
4367
+ "Volume",
4368
+ "NetVolume",
4369
+ "NetArea",
4370
+ "NetSideArea",
4371
+ "CrossSectionArea",
4372
+ "Station"
4373
+ ]);
4374
+ cs = class {
4375
+ dataStore;
4376
+ mutationView;
4377
+ geometryResult;
4378
+ idOffset;
4379
+ childNames = new Map;
4380
+ spatialNodeNames = new Map;
4381
+ spatialChildIds = new Map;
4382
+ entityUuids = new Map;
4383
+ constructor(t, e, n, s){
4384
+ this.dataStore = t, this.geometryResult = e ?? null, this.mutationView = n ?? null, this.idOffset = s ?? 0;
4385
+ }
4386
+ export(t = {}) {
4387
+ const e = this.dataStore.schemaVersion || "IFC4";
4388
+ this.buildEntityMaps();
4389
+ const n = this.buildMeshLookup(t), s = this.buildVisibleSet(t), i = t.onlyTreeEntities !== !1 ? this.buildTreeEntitySet() : null, o = [];
4390
+ let a = 0, l = 0;
4391
+ const { entities: d, strings: u } = this.dataStore;
4392
+ let f = null;
4393
+ for(let y = 0; y < d.count; y++){
4394
+ const m = d.expressId[y];
4395
+ if (s && !s.has(m) || i && !i.has(m)) continue;
4396
+ const b = d.typeEnum[y], w = ne(b) || "IfcElement", v = De(w.toUpperCase(), e, "IFC5"), L = ts(v);
4397
+ L === "IfcProject" && (f = m);
4398
+ const j = this.entityUuids.get(m) || te(m), O = {};
4399
+ O["bsi::ifc::class"] = {
4400
+ code: L,
4401
+ uri: `https://identifier.buildingsmart.org/uri/buildingsmart/ifc/5/class/${L}`
4402
+ };
4403
+ const U = u.get(d.name[y]) || this.spatialNodeNames.get(m);
4404
+ U && (O["bsi::ifc::prop::Name"] = U);
4405
+ const C = u.get(d.description[y]);
4406
+ if (C && (O["bsi::ifc::prop::Description"] = C), t.includeProperties !== !1) {
4407
+ const E = this.getPropertiesForEntity(m, t);
4408
+ for (const [g, T] of Object.entries(E))O[g] = T, a++;
4409
+ }
4410
+ const N = {
4411
+ path: j
4412
+ }, F = this.getChildrenForEntity(m);
4413
+ if (Object.keys(F).length > 0 && (N.children = F), t.includeGeometry !== !1) {
4414
+ const E = n.get(m);
4415
+ if (E && E.length > 0) {
4416
+ const g = this.convertToUsdMesh(E);
4417
+ O["usd::usdgeom::mesh"] = g;
4418
+ const [T, I, R, S] = E[0].color;
4419
+ O["bsi::ifc::presentation::diffuseColor"] = [
4420
+ T,
4421
+ I,
4422
+ R
4423
+ ], S < 1 && (O["bsi::ifc::presentation::opacity"] = S), l++;
4424
+ }
4425
+ }
4426
+ Object.keys(O).length > 0 && (N.attributes = O), o.push(N);
4427
+ }
4428
+ if (f !== null) {
4429
+ const y = this.entityUuids.get(f);
4430
+ if (y) {
4431
+ const m = this.childNames.get(f) || u.get(d.name[this.findEntityIndex(f)]) || "Project", b = te(0);
4432
+ o.unshift({
4433
+ path: b,
4434
+ children: {
4435
+ [m]: y
4436
+ },
4437
+ attributes: {}
4438
+ });
4439
+ }
4440
+ }
4441
+ const p = Zn(o), _ = {
4442
+ header: {
4443
+ id: `ifcx_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
4444
+ ifcxVersion: "ifcx_alpha",
4445
+ dataVersion: t.dataVersion || "1.0.0",
4446
+ author: t.author || "ifc-lite",
4447
+ timestamp: new Date().toISOString()
4448
+ },
4449
+ imports: p,
4450
+ schemas: {},
4451
+ data: o
4452
+ }, h = t.prettyPrint !== !1 ? JSON.stringify(_, null, 2) : JSON.stringify(_);
4453
+ return {
4454
+ content: h,
4455
+ stats: {
4456
+ nodeCount: o.length,
4457
+ propertyCount: a,
4458
+ meshCount: l,
4459
+ fileSize: new TextEncoder().encode(h).length
4460
+ }
4461
+ };
4462
+ }
4463
+ findEntityIndex(t) {
4464
+ const { entities: e } = this.dataStore;
4465
+ for(let n = 0; n < e.count; n++)if (e.expressId[n] === t) return n;
4466
+ return 0;
4467
+ }
4468
+ buildEntityMaps() {
4469
+ const { spatialHierarchy: t, entities: e, strings: n } = this.dataStore;
4470
+ this.entityUuids.clear();
4471
+ for(let l = 0; l < e.count; l++){
4472
+ const d = e.expressId[l], u = n.get(e.globalId[l]);
4473
+ this.entityUuids.set(d, u || te(d));
4474
+ }
4475
+ const s = new Map, i = (l, d)=>{
4476
+ if (d) for (const u of d)s.set(u, l);
4477
+ };
4478
+ if (this.spatialChildIds.clear(), this.spatialNodeNames.clear(), t?.project) {
4479
+ const l = (d)=>{
4480
+ d.name && this.spatialNodeNames.set(d.expressId, d.name);
4481
+ const u = [];
4482
+ for (const f of d.children)s.set(f.expressId, d.expressId), u.push(f.expressId), l(f);
4483
+ this.spatialChildIds.set(d.expressId, u);
4484
+ };
4485
+ l(t.project);
4486
+ }
4487
+ if (t) {
4488
+ for (const l of [
4489
+ t.bySite,
4490
+ t.byBuilding,
4491
+ t.byStorey,
4492
+ t.bySpace
4493
+ ])if (l) for (const [d, u] of l)i(d, u);
4494
+ }
4495
+ const o = new Map;
4496
+ for(let l = 0; l < e.count; l++){
4497
+ const d = e.expressId[l];
4498
+ let u = n.get(e.name[l]) || "";
4499
+ if (u || (u = this.spatialNodeNames.get(d) || ""), !u) {
4500
+ const f = ne(e.typeEnum[l]);
4501
+ f !== "Unknown" && (u = f);
4502
+ }
4503
+ o.set(d, u);
4504
+ }
4505
+ const a = new Map;
4506
+ for (const [l, d] of s)a.has(d) || a.set(d, []), a.get(d).push(l);
4507
+ for(let l = 0; l < e.count; l++){
4508
+ const d = e.expressId[l];
4509
+ s.has(d) || (a.has(void 0) || a.set(void 0, []), a.get(void 0).push(d));
4510
+ }
4511
+ this.childNames.clear();
4512
+ for (const [, l] of a){
4513
+ const d = new Map;
4514
+ for (const u of l){
4515
+ const p = (o.get(u) || `e${u}`).replace(/[/\\]/g, "_").replace(/\s+/g, "_");
4516
+ d.set(p, (d.get(p) || 0) + 1);
4517
+ }
4518
+ for (const u of l){
4519
+ const p = (o.get(u) || `e${u}`).replace(/[/\\]/g, "_").replace(/\s+/g, "_");
4520
+ this.childNames.set(u, d.get(p) > 1 ? `${p}_${u}` : p);
4521
+ }
4522
+ }
4523
+ }
4524
+ getPropertiesForEntity(t, e) {
4525
+ const n = {};
4526
+ if (this.mutationView && e.applyMutations !== !1) {
4527
+ const s = this.mutationView.getForEntity(t);
4528
+ for (const i of s)for (const o of i.properties){
4529
+ if (e.onlyKnownProperties !== !1 && !Le.has(o.name)) continue;
4530
+ const a = `bsi::ifc::prop::${o.name}`;
4531
+ n[a] = this.convertPropertyValue(o.value, o.type);
4532
+ }
4533
+ } else if (this.dataStore.properties) {
4534
+ const s = this.dataStore.properties.getForEntity(t);
4535
+ for (const i of s)for (const o of i.properties){
4536
+ if (e.onlyKnownProperties !== !1 && !Le.has(o.name)) continue;
4537
+ const a = `bsi::ifc::prop::${o.name}`;
4538
+ n[a] = this.convertPropertyValue(o.value, o.type);
4539
+ }
4540
+ }
4541
+ return n;
4542
+ }
4543
+ convertPropertyValue(t, e) {
4544
+ if (t == null) return null;
4545
+ switch(e){
4546
+ case tt.Real:
4547
+ return Number(t);
4548
+ case tt.Integer:
4549
+ return Math.round(Number(t));
4550
+ case tt.Boolean:
4551
+ case tt.Logical:
4552
+ return !!t;
4553
+ default:
4554
+ return t;
4555
+ }
4556
+ }
4557
+ getChildrenForEntity(t) {
4558
+ const e = {}, n = (o)=>{
4559
+ const a = this.entityUuids.get(o);
4560
+ if (!a) return;
4561
+ const l = this.childNames.get(o) || `e${o}`;
4562
+ e[l] = a;
4563
+ }, s = this.spatialChildIds.get(t);
4564
+ if (s) for (const o of s)n(o);
4565
+ const { spatialHierarchy: i } = this.dataStore;
4566
+ if (i) {
4567
+ const o = [
4568
+ i.bySite?.get(t),
4569
+ i.byBuilding?.get(t),
4570
+ i.byStorey?.get(t),
4571
+ i.bySpace?.get(t)
4572
+ ];
4573
+ for (const a of o)if (a) for (const l of a)n(l);
4574
+ }
4575
+ return e;
4576
+ }
4577
+ buildMeshLookup(t) {
4578
+ const e = new Map;
4579
+ if (!this.geometryResult || t.includeGeometry === !1) return e;
4580
+ for (const n of this.geometryResult.meshes){
4581
+ const s = n.expressId - this.idOffset, i = s > 0 ? s : n.expressId;
4582
+ e.has(i) || e.set(i, []), e.get(i).push(n);
4583
+ }
4584
+ return e;
4585
+ }
4586
+ convertToUsdMesh(t) {
4587
+ const e = [], n = [];
4588
+ let s = 0;
4589
+ for (const i of t){
4590
+ for(let o = 0; o < i.positions.length; o += 3){
4591
+ const a = i.positions[o], l = i.positions[o + 1], d = i.positions[o + 2];
4592
+ e.push([
4593
+ a,
4594
+ -d,
4595
+ l
4596
+ ]);
4597
+ }
4598
+ for(let o = 0; o < i.indices.length; o += 3)n.push(i.indices[o] + s, i.indices[o + 1] + s, i.indices[o + 2] + s);
4599
+ s += i.positions.length / 3;
4600
+ }
4601
+ return {
4602
+ points: e,
4603
+ faceVertexIndices: n
4604
+ };
4605
+ }
4606
+ buildTreeEntitySet() {
4607
+ const t = new Set, { spatialHierarchy: e } = this.dataStore;
4608
+ if (e?.project) {
4609
+ const n = (s)=>{
4610
+ t.add(s.expressId);
4611
+ for (const i of s.children)n(i);
4612
+ };
4613
+ n(e.project);
4614
+ }
4615
+ if (e) {
4616
+ for (const n of [
4617
+ e.bySite,
4618
+ e.byBuilding,
4619
+ e.byStorey,
4620
+ e.bySpace
4621
+ ])if (n) for (const s of n.values())for (const i of s)t.add(i);
4622
+ }
4623
+ return t;
4624
+ }
4625
+ buildVisibleSet(t) {
4626
+ if (!t.visibleOnly) return null;
4627
+ const e = t.hiddenEntityIds ?? new Set, n = t.isolatedEntityIds ?? null, s = new Set, { entities: i } = this.dataStore;
4628
+ for(let o = 0; o < i.count; o++){
4629
+ const a = i.expressId[o];
4630
+ n ? n.has(a) && s.add(a) : e.has(a) || s.add(a);
4631
+ }
4632
+ return s;
4633
+ }
4634
+ };
4635
+ function Zn(r) {
4636
+ let t = !1, e = !1, n = !1;
4637
+ for (const i of r)if (i.attributes) {
4638
+ for (const o of Object.keys(i.attributes))if (!t && (o === "bsi::ifc::class" || o.startsWith("bsi::ifc::presentation::") || o === "bsi::ifc::material" || o === "bsi::ifc::spaceBoundary") && (t = !0), !e && o.startsWith("bsi::ifc::prop::") && (e = !0), !n && o.startsWith("usd::") && (n = !0), t && e && n) break;
4639
+ if (t && e && n) break;
4640
+ }
4641
+ const s = [];
4642
+ return t && s.push({
4643
+ uri: Zt.IFC_CORE
4644
+ }), e && s.push({
4645
+ uri: Zt.IFC_PROP
4646
+ }), n && s.push({
4647
+ uri: Zt.USD
4648
+ }), s;
4649
+ }
4650
+ function te(r) {
4651
+ return `00000000-0000-4000-8000-${r.toString(16).padStart(12, "0")}`;
4652
+ }
4653
+ function ts(r) {
4654
+ const t = Xe(r), e = ne(t);
4655
+ if (e !== "Unknown") return e;
4656
+ const n = r.toLowerCase();
4657
+ return n.startsWith("ifc") ? "Ifc" + n.charAt(3).toUpperCase() + n.slice(4) : r;
4658
+ }
4659
+ });
4660
+ export { rs as C, is as G, Le as I, as as M, qn as S, Pe as _, ss as a, In as b, cs as c, ie as d, os as e, ns as g, __tla };