@ifc-lite/viewer 1.19.0 → 1.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +15 -14
- package/.turbo/turbo-typecheck.log +1 -1
- package/CHANGELOG.md +8 -0
- package/dist/assets/basketViewActivator-CA2CTcVo.js +71 -0
- package/dist/assets/{bcf-DOG9_WPX.js → bcf-4K724hw0.js} +18 -18
- package/dist/assets/{exporters-BraHBeoi.js → exporters-xbXqEDlO.js} +53 -46
- package/dist/assets/ids-2WdONLlu.js +2033 -0
- package/dist/assets/index-BXeEKqJG.css +1 -0
- package/dist/assets/{index-BOi3BuUI.js → index-D8Epw-e7.js} +48072 -30928
- package/dist/assets/{native-bridge-CpBeOPQa.js → native-bridge-DKmx1z95.js} +2 -2
- package/dist/assets/{sandbox-Baez7n-t.js → sandbox-tccwm5Bo.js} +547 -529
- package/dist/assets/{server-client-BB6cMAXE.js → server-client-LoWPK1N2.js} +1 -1
- package/dist/assets/three-CDRZThFA.js +4057 -0
- package/dist/assets/{wasm-bridge-CAYCUHbE.js → wasm-bridge-BsJGgPMs.js} +1 -1
- package/dist/index.html +8 -7
- package/dist/samples/building-architecture.ifc +453 -0
- package/dist/samples/hello-wall.ifc +1054 -0
- package/dist/samples/infra-bridge.ifc +962 -0
- package/package.json +7 -2
- package/public/samples/building-architecture.ifc +453 -0
- package/public/samples/hello-wall.ifc +1054 -0
- package/public/samples/infra-bridge.ifc +962 -0
- package/src/App.tsx +37 -3
- package/src/components/mcp/HeroScene.tsx +876 -0
- package/src/components/mcp/McpLanding.tsx +1318 -0
- package/src/components/mcp/McpPlayground.tsx +524 -0
- package/src/components/mcp/PlaygroundChat.tsx +1097 -0
- package/src/components/mcp/PlaygroundViewer.tsx +815 -0
- package/src/components/mcp/README.md +171 -0
- package/src/components/mcp/data.ts +659 -0
- package/src/components/mcp/playground-dispatcher.ts +1649 -0
- package/src/components/mcp/playground-files.ts +107 -0
- package/src/components/mcp/playground-uploads.ts +122 -0
- package/src/components/mcp/types.ts +65 -0
- package/src/components/mcp/use-mcp-page.ts +109 -0
- package/src/components/viewer/MainToolbar.tsx +19 -0
- package/src/components/viewer/ViewportContainer.tsx +35 -4
- package/src/generated/mcp-catalog.json +82 -0
- package/vite.config.ts +6 -0
- package/dist/assets/basketViewActivator-RZy5c3Td.js +0 -1
- package/dist/assets/ids-DQ5jY0E8.js +0 -1
- package/dist/assets/index-0XpVr_S5.css +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import { P as _, Q as
|
|
3
|
-
import { g as Q } from "./bcf-
|
|
4
|
-
import { h as
|
|
5
|
-
let Mi,
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D8Epw-e7.js","assets/cesium-DUOzBlqv.js","assets/arrow-CZ5kQ26f.js","assets/cesium-ADbP7waU.css","assets/exporters-xbXqEDlO.js","assets/bcf-4K724hw0.js","assets/zip-DBEtpeu6.js","assets/drawing-2d-DoxKMqbO.js","assets/lens-CSASnhAL.js","assets/server-client-LoWPK1N2.js","assets/ids-2WdONLlu.js","assets/three-CDRZThFA.js","assets/index-BXeEKqJG.css","assets/browser-C5TFR7sH.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import { P as _, Q as qe, E as Ge, g as hn, e as pn, i as vt, n as Nt, _ as Re, __tla as __tla_0 } from "./exporters-xbXqEDlO.js";
|
|
3
|
+
import { g as Q } from "./bcf-4K724hw0.js";
|
|
4
|
+
import { h as ut, B as fn } from "./lens-CSASnhAL.js";
|
|
5
|
+
let Wi, Hi, Mi, Jt, gi, _i, Ki, Ji, Vi, zi, An, Qi, Xi, qi, Ui, ji, Gi, vn, Bi, Zi, er, Ts, tr, Yi, bi, Si, nr;
|
|
6
6
|
let __tla = Promise.all([
|
|
7
7
|
(()=>{
|
|
8
8
|
try {
|
|
@@ -16,13 +16,13 @@ let __tla = Promise.all([
|
|
|
16
16
|
function le(n, t, e) {
|
|
17
17
|
return `${n}:${t}:${e}`;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function Ne(n, t, e) {
|
|
20
20
|
return `${n}:${t}:${e}`;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function ht(n, t) {
|
|
23
23
|
return `${n}:attr:${t}`;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
Mi = class {
|
|
26
26
|
baseTable;
|
|
27
27
|
onDemandExtractor = null;
|
|
28
28
|
quantityExtractor = null;
|
|
@@ -291,7 +291,7 @@ let __tla = Promise.all([
|
|
|
291
291
|
s.add(o.name);
|
|
292
292
|
const a = [];
|
|
293
293
|
for (const c of o.quantities){
|
|
294
|
-
const l =
|
|
294
|
+
const l = Ne(t, o.name, c.name), u = this.quantityMutations.get(l);
|
|
295
295
|
if (u) {
|
|
296
296
|
if (u.operation === "DELETE") continue;
|
|
297
297
|
a.push({
|
|
@@ -312,7 +312,7 @@ let __tla = Promise.all([
|
|
|
312
312
|
const p = l.slice(c.length);
|
|
313
313
|
a.some((h)=>h.name === p) || a.push({
|
|
314
314
|
name: p,
|
|
315
|
-
type: u.quantityType ??
|
|
315
|
+
type: u.quantityType ?? qe.Count,
|
|
316
316
|
value: u.value ?? 0,
|
|
317
317
|
unit: u.unit
|
|
318
318
|
});
|
|
@@ -341,7 +341,7 @@ let __tla = Promise.all([
|
|
|
341
341
|
};
|
|
342
342
|
i.set(e, r);
|
|
343
343
|
for (const a of s){
|
|
344
|
-
const d =
|
|
344
|
+
const d = Ne(t, e, a.name);
|
|
345
345
|
this.setQuantityMutation(t, d, {
|
|
346
346
|
operation: "SET",
|
|
347
347
|
value: a.value,
|
|
@@ -360,8 +360,8 @@ let __tla = Promise.all([
|
|
|
360
360
|
};
|
|
361
361
|
return this.mutationHistory.push(o), o;
|
|
362
362
|
}
|
|
363
|
-
setQuantity(t, e, s, i, r =
|
|
364
|
-
const d =
|
|
363
|
+
setQuantity(t, e, s, i, r = qe.Count, o, a = !1) {
|
|
364
|
+
const d = Ne(t, e, s), l = this.getBaseQuantitiesForEntity(t).some((I)=>I.name === e), u = this.newQsets.get(t)?.has(e);
|
|
365
365
|
if (!l && !u) {
|
|
366
366
|
let I = this.newQsets.get(t);
|
|
367
367
|
I || (I = new Map, this.newQsets.set(t, I)), I.set(e, {
|
|
@@ -410,7 +410,7 @@ let __tla = Promise.all([
|
|
|
410
410
|
return a || this.mutationHistory.push(m), m;
|
|
411
411
|
}
|
|
412
412
|
setAttribute(t, e, s, i, r = !1) {
|
|
413
|
-
const o =
|
|
413
|
+
const o = ht(t, e);
|
|
414
414
|
this.attributeMutations.set(o, {
|
|
415
415
|
attribute: e,
|
|
416
416
|
value: s,
|
|
@@ -525,7 +525,7 @@ let __tla = Promise.all([
|
|
|
525
525
|
}
|
|
526
526
|
removeQuantityMutation(t, e, s) {
|
|
527
527
|
if (s) {
|
|
528
|
-
const i =
|
|
528
|
+
const i = Ne(t, e, s);
|
|
529
529
|
this.deleteQuantityMutation(t, i);
|
|
530
530
|
const r = this.newQsets.get(t);
|
|
531
531
|
if (r) {
|
|
@@ -544,7 +544,7 @@ let __tla = Promise.all([
|
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
removeAttributeMutation(t, e) {
|
|
547
|
-
const s =
|
|
547
|
+
const s = ht(t, e);
|
|
548
548
|
this.attributeMutations.delete(s);
|
|
549
549
|
}
|
|
550
550
|
getMutations() {
|
|
@@ -581,7 +581,7 @@ let __tla = Promise.all([
|
|
|
581
581
|
break;
|
|
582
582
|
case "CREATE_QUANTITY":
|
|
583
583
|
case "UPDATE_QUANTITY":
|
|
584
|
-
s.psetName && s.propName && s.newValue !== void 0 && this.setQuantity(s.entityId, s.psetName, s.propName, Number(s.newValue),
|
|
584
|
+
s.psetName && s.propName && s.newValue !== void 0 && this.setQuantity(s.entityId, s.psetName, s.propName, Number(s.newValue), qe.Count);
|
|
585
585
|
break;
|
|
586
586
|
case "UPDATE_POSITIONAL_ATTRIBUTE":
|
|
587
587
|
{
|
|
@@ -615,12 +615,12 @@ let __tla = Promise.all([
|
|
|
615
615
|
e.mutations && Array.isArray(e.mutations) && this.applyMutations(e.mutations);
|
|
616
616
|
}
|
|
617
617
|
};
|
|
618
|
-
const
|
|
619
|
-
let
|
|
620
|
-
function
|
|
621
|
-
|
|
618
|
+
const mn = -1;
|
|
619
|
+
let Xe = null;
|
|
620
|
+
function yn(n) {
|
|
621
|
+
Xe = n;
|
|
622
622
|
}
|
|
623
|
-
|
|
623
|
+
_i = class {
|
|
624
624
|
store;
|
|
625
625
|
view;
|
|
626
626
|
maxExistingId;
|
|
@@ -637,8 +637,8 @@ let __tla = Promise.all([
|
|
|
637
637
|
if (s.length === 0) throw new Error("StoreEditor.addEntity: type cannot be empty");
|
|
638
638
|
if (!/^[Ii][Ff][Cc][A-Za-z][A-Za-z0-9_]*$/.test(s)) throw new Error(`StoreEditor.addEntity: type "${t}" is not a recognizable IFC entity name (expected e.g. "IfcWall")`);
|
|
639
639
|
let i = s;
|
|
640
|
-
if (
|
|
641
|
-
const o =
|
|
640
|
+
if (Xe) {
|
|
641
|
+
const o = Xe(s);
|
|
642
642
|
if (!o) throw new Error(`StoreEditor.addEntity: type "${t}" is not in the IFC schema registry (typo? vendor extension?)`);
|
|
643
643
|
i = o;
|
|
644
644
|
}
|
|
@@ -647,7 +647,7 @@ let __tla = Promise.all([
|
|
|
647
647
|
return {
|
|
648
648
|
expressId: r.expressId,
|
|
649
649
|
type: r.type,
|
|
650
|
-
byteOffset:
|
|
650
|
+
byteOffset: mn,
|
|
651
651
|
byteLength: 0,
|
|
652
652
|
lineNumber: -1
|
|
653
653
|
};
|
|
@@ -673,7 +673,7 @@ let __tla = Promise.all([
|
|
|
673
673
|
return t;
|
|
674
674
|
}
|
|
675
675
|
};
|
|
676
|
-
|
|
676
|
+
Wi = class {
|
|
677
677
|
entities;
|
|
678
678
|
spatialHierarchy;
|
|
679
679
|
properties;
|
|
@@ -844,7 +844,7 @@ let __tla = Promise.all([
|
|
|
844
844
|
return this.expressIdIndex.get(t) ?? -1;
|
|
845
845
|
}
|
|
846
846
|
};
|
|
847
|
-
|
|
847
|
+
Hi = class {
|
|
848
848
|
entities;
|
|
849
849
|
mutationView;
|
|
850
850
|
strings;
|
|
@@ -1116,17 +1116,17 @@ let __tla = Promise.all([
|
|
|
1116
1116
|
function y(n) {
|
|
1117
1117
|
return n.replace(/\\/g, "\\\\").replace(/'/g, "''");
|
|
1118
1118
|
}
|
|
1119
|
-
function
|
|
1119
|
+
function In(n, t, e) {
|
|
1120
1120
|
return `#${n}=${t}(${e});`;
|
|
1121
1121
|
}
|
|
1122
1122
|
function S(n) {
|
|
1123
1123
|
const t = n.toString();
|
|
1124
1124
|
return t.includes("e") || t.includes("E") ? n.toFixed(10).replace(/0+$/, "0") : t.includes(".") ? t : t + ".";
|
|
1125
1125
|
}
|
|
1126
|
-
function
|
|
1126
|
+
function kt(n) {
|
|
1127
1127
|
return Math.sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]);
|
|
1128
1128
|
}
|
|
1129
|
-
const
|
|
1129
|
+
const pt = new Set([
|
|
1130
1130
|
"IFCBUILDING",
|
|
1131
1131
|
"IFCSITE",
|
|
1132
1132
|
"IFCBUILDINGSTOREY",
|
|
@@ -1137,7 +1137,7 @@ let __tla = Promise.all([
|
|
|
1137
1137
|
"IFCGROUP"
|
|
1138
1138
|
]);
|
|
1139
1139
|
function L(n) {
|
|
1140
|
-
const t =
|
|
1140
|
+
const t = kt(n);
|
|
1141
1141
|
if (t === 0) throw new Error("Cannot normalize zero-length vector (check that Start and End are not identical)");
|
|
1142
1142
|
return [
|
|
1143
1143
|
n[0] / t,
|
|
@@ -1158,13 +1158,13 @@ let __tla = Promise.all([
|
|
|
1158
1158
|
function Ee(n) {
|
|
1159
1159
|
return n == null || n === "" ? "$" : `.${n}.`;
|
|
1160
1160
|
}
|
|
1161
|
-
function
|
|
1161
|
+
function gn(n) {
|
|
1162
1162
|
return n == null ? "$" : n ? ".T." : ".F.";
|
|
1163
1163
|
}
|
|
1164
|
-
function
|
|
1164
|
+
function bn(n) {
|
|
1165
1165
|
return n == null || !Number.isFinite(n) ? "$" : S(n);
|
|
1166
1166
|
}
|
|
1167
|
-
class
|
|
1167
|
+
class He {
|
|
1168
1168
|
nextId = 1;
|
|
1169
1169
|
lines = [];
|
|
1170
1170
|
entities = [];
|
|
@@ -2023,13 +2023,13 @@ let __tla = Promise.all([
|
|
|
2023
2023
|
C(t.LateFinish),
|
|
2024
2024
|
C(t.FreeFloat),
|
|
2025
2025
|
C(t.TotalFloat),
|
|
2026
|
-
|
|
2026
|
+
gn(t.IsCritical),
|
|
2027
2027
|
C(t.StatusTime),
|
|
2028
2028
|
C(t.ActualDuration),
|
|
2029
2029
|
C(t.ActualStart),
|
|
2030
2030
|
C(t.ActualFinish),
|
|
2031
2031
|
C(t.RemainingTime),
|
|
2032
|
-
|
|
2032
|
+
bn(t.Completion)
|
|
2033
2033
|
];
|
|
2034
2034
|
return this.line(e, "IFCTASKTIME", s.join(",")), e;
|
|
2035
2035
|
}
|
|
@@ -2396,7 +2396,7 @@ ENDSEC;
|
|
|
2396
2396
|
]), d = this.addProductDefinitionShape([
|
|
2397
2397
|
a
|
|
2398
2398
|
]), c = this.id(), l = this.newGlobalId(), u = e.Name ?? e.IfcType, p = e.Description ? `'${y(e.Description)}'` : "$", h = e.ObjectType ? `'${y(e.ObjectType)}'` : "$", f = e.Tag ? `'${y(e.Tag)}'` : "$", m = e.IfcType.toUpperCase();
|
|
2399
|
-
if (
|
|
2399
|
+
if (pt.has(m)) this.line(c, e.IfcType, `'${l}',#${this.ownerHistoryId},'${y(u)}',${p},${h},#${s},#${d}`);
|
|
2400
2400
|
else {
|
|
2401
2401
|
const I = e.PredefinedType ? `.${e.PredefinedType}.` : ".NOTDEFINED.";
|
|
2402
2402
|
this.line(c, e.IfcType, `'${l}',#${this.ownerHistoryId},'${y(u)}',${p},${h},#${s},#${d},${f},${I}`);
|
|
@@ -2420,7 +2420,7 @@ ENDSEC;
|
|
|
2420
2420
|
0,
|
|
2421
2421
|
1
|
|
2422
2422
|
]);
|
|
2423
|
-
|
|
2423
|
+
kt(c) < 1e-6 && (c = fe(a, [
|
|
2424
2424
|
1,
|
|
2425
2425
|
0,
|
|
2426
2426
|
0
|
|
@@ -2434,7 +2434,7 @@ ENDSEC;
|
|
|
2434
2434
|
]), f = this.addProductDefinitionShape([
|
|
2435
2435
|
h
|
|
2436
2436
|
]), m = this.id(), I = this.newGlobalId(), g = e.Name ?? e.IfcType, w = e.Description ? `'${y(e.Description)}'` : "$", P = e.ObjectType ? `'${y(e.ObjectType)}'` : "$", N = e.Tag ? `'${y(e.Tag)}'` : "$", k = e.IfcType.toUpperCase();
|
|
2437
|
-
if (
|
|
2437
|
+
if (pt.has(k)) this.line(m, e.IfcType, `'${I}',#${this.ownerHistoryId},'${y(g)}',${w},${P},#${l},#${f}`);
|
|
2438
2438
|
else {
|
|
2439
2439
|
const D = e.PredefinedType ? `.${e.PredefinedType}.` : ".NOTDEFINED.";
|
|
2440
2440
|
this.line(m, e.IfcType, `'${I}',#${this.ownerHistoryId},'${y(g)}',${w},${P},#${l},#${f},${N},${D}`);
|
|
@@ -2535,7 +2535,7 @@ ENDSEC;
|
|
|
2535
2535
|
return this.nextId++;
|
|
2536
2536
|
}
|
|
2537
2537
|
line(t, e, s) {
|
|
2538
|
-
this.lines.push(
|
|
2538
|
+
this.lines.push(In(t, e, s));
|
|
2539
2539
|
}
|
|
2540
2540
|
getHostedWallInfo(t) {
|
|
2541
2541
|
const e = this.elementStoreys.get(t), s = this.wallPlacements.get(t), i = this.wallThicknesses.get(t);
|
|
@@ -2580,7 +2580,7 @@ ENDSEC;
|
|
|
2580
2580
|
return L(s);
|
|
2581
2581
|
}
|
|
2582
2582
|
}
|
|
2583
|
-
|
|
2583
|
+
Bi = function(n, t, e) {
|
|
2584
2584
|
const { ownerHistoryId: s, bodyContextId: i, storeyId: r, storeyPlacementId: o } = t, a = n.addEntity("IfcCartesianPoint", [
|
|
2585
2585
|
e.Position
|
|
2586
2586
|
]).expressId, d = n.addEntity("IfcAxis2Placement3D", [
|
|
@@ -2669,7 +2669,7 @@ ENDSEC;
|
|
|
2669
2669
|
relContainedId: k
|
|
2670
2670
|
};
|
|
2671
2671
|
};
|
|
2672
|
-
|
|
2672
|
+
Gi = function(n, t, e) {
|
|
2673
2673
|
const { ownerHistoryId: s, bodyContextId: i, storeyId: r, storeyPlacementId: o } = t;
|
|
2674
2674
|
if (e.Thickness <= 0 || e.Height <= 0) throw new Error("addWallToStore: Thickness and Height must be positive");
|
|
2675
2675
|
const a = e.End[0] - e.Start[0], d = e.End[1] - e.Start[1], c = e.End[2] - e.Start[2], l = Math.hypot(a, d);
|
|
@@ -2769,11 +2769,11 @@ ENDSEC;
|
|
|
2769
2769
|
relContainedId: W
|
|
2770
2770
|
};
|
|
2771
2771
|
};
|
|
2772
|
-
const
|
|
2773
|
-
function
|
|
2772
|
+
const ft = 1e-6;
|
|
2773
|
+
function Sn(n) {
|
|
2774
2774
|
return n.Profile === "polygon";
|
|
2775
2775
|
}
|
|
2776
|
-
function
|
|
2776
|
+
function En(n, t, e) {
|
|
2777
2777
|
const s = n.addEntity("IfcCartesianPoint", [
|
|
2778
2778
|
[
|
|
2779
2779
|
t / 2,
|
|
@@ -2791,9 +2791,9 @@ ENDSEC;
|
|
|
2791
2791
|
e
|
|
2792
2792
|
]).expressId;
|
|
2793
2793
|
}
|
|
2794
|
-
function
|
|
2794
|
+
function wn(n, t) {
|
|
2795
2795
|
if (t.length < 3) throw new Error("addSlabToStore: polygon OuterCurve needs at least 3 points");
|
|
2796
|
-
const e = t[0], s = t[t.length - 1], o = (Math.abs(e[0] - s[0]) <
|
|
2796
|
+
const e = t[0], s = t[t.length - 1], o = (Math.abs(e[0] - s[0]) < ft && Math.abs(e[1] - s[1]) < ft ? t : [
|
|
2797
2797
|
...t,
|
|
2798
2798
|
e
|
|
2799
2799
|
]).map((d)=>n.addEntity("IfcCartesianPoint", [
|
|
@@ -2807,8 +2807,8 @@ ENDSEC;
|
|
|
2807
2807
|
`#${a}`
|
|
2808
2808
|
]).expressId;
|
|
2809
2809
|
}
|
|
2810
|
-
|
|
2811
|
-
const { ownerHistoryId: s, bodyContextId: i, storeyId: r, storeyPlacementId: o } = t, a =
|
|
2810
|
+
ji = function(n, t, e) {
|
|
2811
|
+
const { ownerHistoryId: s, bodyContextId: i, storeyId: r, storeyPlacementId: o } = t, a = Sn(e), d = a ? e.Position ?? [
|
|
2812
2812
|
0,
|
|
2813
2813
|
0,
|
|
2814
2814
|
0
|
|
@@ -2824,7 +2824,7 @@ ENDSEC;
|
|
|
2824
2824
|
]).expressId, u = n.addEntity("IfcLocalPlacement", [
|
|
2825
2825
|
`#${o}`,
|
|
2826
2826
|
`#${l}`
|
|
2827
|
-
]).expressId, p = a ?
|
|
2827
|
+
]).expressId, p = a ? wn(n, e.OuterCurve) : En(n, e.Width, e.Depth), h = n.addEntity("IfcCartesianPoint", [
|
|
2828
2828
|
[
|
|
2829
2829
|
0,
|
|
2830
2830
|
0,
|
|
@@ -2889,7 +2889,7 @@ ENDSEC;
|
|
|
2889
2889
|
relContainedId: k
|
|
2890
2890
|
};
|
|
2891
2891
|
};
|
|
2892
|
-
function
|
|
2892
|
+
function Tn(n) {
|
|
2893
2893
|
const t = Math.abs(n[2]) < .9 ? [
|
|
2894
2894
|
0,
|
|
2895
2895
|
0,
|
|
@@ -2901,7 +2901,7 @@ ENDSEC;
|
|
|
2901
2901
|
];
|
|
2902
2902
|
return L(fe(t, n));
|
|
2903
2903
|
}
|
|
2904
|
-
|
|
2904
|
+
Ui = function(n, t, e) {
|
|
2905
2905
|
const { ownerHistoryId: s, bodyContextId: i, storeyId: r, storeyPlacementId: o } = t, a = e.End[0] - e.Start[0], d = e.End[1] - e.Start[1], c = e.End[2] - e.Start[2], l = Math.sqrt(a * a + d * d + c * c);
|
|
2906
2906
|
if (l <= 0) throw new Error("addBeamToStore: Start and End must be distinct points");
|
|
2907
2907
|
if (e.Width <= 0 || e.Height <= 0) throw new Error("addBeamToStore: Width and Height must be positive");
|
|
@@ -2909,7 +2909,7 @@ ENDSEC;
|
|
|
2909
2909
|
a,
|
|
2910
2910
|
d,
|
|
2911
2911
|
c
|
|
2912
|
-
]), p =
|
|
2912
|
+
]), p = Tn(u), h = n.addEntity("IfcCartesianPoint", [
|
|
2913
2913
|
e.Start
|
|
2914
2914
|
]).expressId, f = n.addEntity("IfcDirection", [
|
|
2915
2915
|
u
|
|
@@ -3001,7 +3001,7 @@ ENDSEC;
|
|
|
3001
3001
|
relContainedId: E
|
|
3002
3002
|
};
|
|
3003
3003
|
};
|
|
3004
|
-
const
|
|
3004
|
+
const mt = 1e-6;
|
|
3005
3005
|
function ye(n, t, e, s, i) {
|
|
3006
3006
|
const r = n.addEntity("IfcCartesianPoint", [
|
|
3007
3007
|
e
|
|
@@ -3037,9 +3037,9 @@ ENDSEC;
|
|
|
3037
3037
|
e
|
|
3038
3038
|
]).expressId;
|
|
3039
3039
|
}
|
|
3040
|
-
function
|
|
3040
|
+
function it(n, t) {
|
|
3041
3041
|
if (t.length < 3) throw new Error("emitPolygonProfile: outline needs at least 3 points");
|
|
3042
|
-
const e = t[0], s = t[t.length - 1], o = (Math.abs(e[0] - s[0]) <
|
|
3042
|
+
const e = t[0], s = t[t.length - 1], o = (Math.abs(e[0] - s[0]) < mt && Math.abs(e[1] - s[1]) < mt ? t : [
|
|
3043
3043
|
...t,
|
|
3044
3044
|
e
|
|
3045
3045
|
]).map((d)=>n.addEntity("IfcCartesianPoint", [
|
|
@@ -3101,7 +3101,7 @@ ENDSEC;
|
|
|
3101
3101
|
productShapeId: i
|
|
3102
3102
|
};
|
|
3103
3103
|
}
|
|
3104
|
-
function
|
|
3104
|
+
function De(n, t, e, s) {
|
|
3105
3105
|
return n.addEntity("IfcRelContainedInSpatialStructure", [
|
|
3106
3106
|
Q(),
|
|
3107
3107
|
`#${t}`,
|
|
@@ -3113,7 +3113,7 @@ ENDSEC;
|
|
|
3113
3113
|
`#${s}`
|
|
3114
3114
|
]).expressId;
|
|
3115
3115
|
}
|
|
3116
|
-
function
|
|
3116
|
+
function Ce(n, t, e, s, i) {
|
|
3117
3117
|
return [
|
|
3118
3118
|
Q(),
|
|
3119
3119
|
`#${n}`,
|
|
@@ -3125,7 +3125,7 @@ ENDSEC;
|
|
|
3125
3125
|
s.Tag ?? null
|
|
3126
3126
|
];
|
|
3127
3127
|
}
|
|
3128
|
-
const
|
|
3128
|
+
const $n = new Set([
|
|
3129
3129
|
"SINGLE_SWING_LEFT",
|
|
3130
3130
|
"SINGLE_SWING_RIGHT",
|
|
3131
3131
|
"DOUBLE_DOOR_SINGLE_SWING",
|
|
@@ -3147,16 +3147,16 @@ ENDSEC;
|
|
|
3147
3147
|
"USERDEFINED",
|
|
3148
3148
|
"NOTDEFINED"
|
|
3149
3149
|
]);
|
|
3150
|
-
|
|
3150
|
+
qi = function(n, t, e) {
|
|
3151
3151
|
if (e.Width <= 0 || e.Height <= 0) throw new Error("addDoorToStore: Width and Height must be positive");
|
|
3152
3152
|
const s = e.FrameThickness ?? .05;
|
|
3153
3153
|
if (s <= 0) throw new Error("addDoorToStore: FrameThickness must be positive");
|
|
3154
|
-
const i = ye(n, t.storeyPlacementId, e.Position), r = Ie(n, e.Width, s), o = ge(n, r, e.Height), { shapeRepId: a, productShapeId: d } = be(n, t.bodyContextId, o), c = (t.schema ?? "IFC4") === "IFC2X3", l =
|
|
3154
|
+
const i = ye(n, t.storeyPlacementId, e.Position), r = Ie(n, e.Width, s), o = ge(n, r, e.Height), { shapeRepId: a, productShapeId: d } = be(n, t.bodyContextId, o), c = (t.schema ?? "IFC4") === "IFC2X3", l = Ce(t.ownerHistoryId, i, d, e, "Door");
|
|
3155
3155
|
if (l.push(e.Height, e.Width), !c) {
|
|
3156
|
-
const h = e.OperationType ?? "SINGLE_SWING_LEFT", f =
|
|
3156
|
+
const h = e.OperationType ?? "SINGLE_SWING_LEFT", f = $n.has(h), m = f ? h : "USERDEFINED", I = m === "USERDEFINED" ? f ? e.UserDefinedOperationType ?? null : h : null;
|
|
3157
3157
|
l.push(`.${e.PredefinedType ?? "NOTDEFINED"}.`), l.push(`.${m}.`), l.push(I);
|
|
3158
3158
|
}
|
|
3159
|
-
const u = n.addEntity("IfcDoor", l).expressId, p =
|
|
3159
|
+
const u = n.addEntity("IfcDoor", l).expressId, p = De(n, t.ownerHistoryId, u, t.storeyId);
|
|
3160
3160
|
return {
|
|
3161
3161
|
doorId: u,
|
|
3162
3162
|
placementId: i,
|
|
@@ -3167,7 +3167,7 @@ ENDSEC;
|
|
|
3167
3167
|
relContainedId: p
|
|
3168
3168
|
};
|
|
3169
3169
|
};
|
|
3170
|
-
const
|
|
3170
|
+
const Pn = new Set([
|
|
3171
3171
|
"SINGLE_PANEL",
|
|
3172
3172
|
"DOUBLE_PANEL_VERTICAL",
|
|
3173
3173
|
"DOUBLE_PANEL_HORIZONTAL",
|
|
@@ -3180,16 +3180,16 @@ ENDSEC;
|
|
|
3180
3180
|
"USERDEFINED",
|
|
3181
3181
|
"NOTDEFINED"
|
|
3182
3182
|
]);
|
|
3183
|
-
|
|
3183
|
+
Qi = function(n, t, e) {
|
|
3184
3184
|
if (e.Width <= 0 || e.Height <= 0) throw new Error("addWindowToStore: Width and Height must be positive");
|
|
3185
3185
|
const s = e.FrameThickness ?? .05;
|
|
3186
3186
|
if (s <= 0) throw new Error("addWindowToStore: FrameThickness must be positive");
|
|
3187
|
-
const i = ye(n, t.storeyPlacementId, e.Position), r = Ie(n, e.Width, s), o = ge(n, r, e.Height), { shapeRepId: a, productShapeId: d } = be(n, t.bodyContextId, o), c = (t.schema ?? "IFC4") === "IFC2X3", l =
|
|
3187
|
+
const i = ye(n, t.storeyPlacementId, e.Position), r = Ie(n, e.Width, s), o = ge(n, r, e.Height), { shapeRepId: a, productShapeId: d } = be(n, t.bodyContextId, o), c = (t.schema ?? "IFC4") === "IFC2X3", l = Ce(t.ownerHistoryId, i, d, e, "Window");
|
|
3188
3188
|
if (l.push(e.Height, e.Width), !c) {
|
|
3189
|
-
const h = e.PartitioningType ?? "NOTDEFINED", f =
|
|
3189
|
+
const h = e.PartitioningType ?? "NOTDEFINED", f = Pn.has(h), m = f ? h : "USERDEFINED", I = m === "USERDEFINED" ? f ? e.UserDefinedPartitioningType ?? null : h : null;
|
|
3190
3190
|
l.push(`.${e.PredefinedType ?? "NOTDEFINED"}.`), l.push(`.${m}.`), l.push(I);
|
|
3191
3191
|
}
|
|
3192
|
-
const u = n.addEntity("IfcWindow", l).expressId, p =
|
|
3192
|
+
const u = n.addEntity("IfcWindow", l).expressId, p = De(n, t.ownerHistoryId, u, t.storeyId);
|
|
3193
3193
|
return {
|
|
3194
3194
|
windowId: u,
|
|
3195
3195
|
placementId: i,
|
|
@@ -3200,18 +3200,18 @@ ENDSEC;
|
|
|
3200
3200
|
relContainedId: p
|
|
3201
3201
|
};
|
|
3202
3202
|
};
|
|
3203
|
-
function
|
|
3203
|
+
function xn(n) {
|
|
3204
3204
|
return n.Profile === "polygon";
|
|
3205
3205
|
}
|
|
3206
|
-
|
|
3207
|
-
const s =
|
|
3206
|
+
An = function(n, t, e) {
|
|
3207
|
+
const s = xn(e), i = s ? e.Position ?? [
|
|
3208
3208
|
0,
|
|
3209
3209
|
0,
|
|
3210
3210
|
0
|
|
3211
3211
|
] : e.Position;
|
|
3212
3212
|
if (e.Height <= 0) throw new Error("addSpaceToStore: Height must be positive");
|
|
3213
3213
|
if (!s && (e.Width <= 0 || e.Depth <= 0)) throw new Error("addSpaceToStore: Width and Depth must be positive");
|
|
3214
|
-
const r = ye(n, t.storeyPlacementId, i), o = s ?
|
|
3214
|
+
const r = ye(n, t.storeyPlacementId, i), o = s ? it(n, e.OuterCurve) : Ie(n, e.Width, e.Depth, e.Width / 2, e.Depth / 2), a = ge(n, o, e.Height), { shapeRepId: d, productShapeId: c } = be(n, t.bodyContextId, a), l = [
|
|
3215
3215
|
Q(),
|
|
3216
3216
|
`#${t.ownerHistoryId}`,
|
|
3217
3217
|
e.Name ?? "Space",
|
|
@@ -3243,20 +3243,20 @@ ENDSEC;
|
|
|
3243
3243
|
relAggregatesId: p
|
|
3244
3244
|
};
|
|
3245
3245
|
};
|
|
3246
|
-
function
|
|
3246
|
+
function Rn(n) {
|
|
3247
3247
|
return n.Profile === "polygon";
|
|
3248
3248
|
}
|
|
3249
|
-
|
|
3250
|
-
const s =
|
|
3249
|
+
Vi = function(n, t, e) {
|
|
3250
|
+
const s = Rn(e), i = s ? e.Position ?? [
|
|
3251
3251
|
0,
|
|
3252
3252
|
0,
|
|
3253
3253
|
0
|
|
3254
3254
|
] : e.Position;
|
|
3255
3255
|
if (e.Thickness <= 0) throw new Error("addRoofToStore: Thickness must be positive");
|
|
3256
3256
|
if (!s && (e.Width <= 0 || e.Depth <= 0)) throw new Error("addRoofToStore: Width and Depth must be positive");
|
|
3257
|
-
const r = ye(n, t.storeyPlacementId, i), o = s ?
|
|
3257
|
+
const r = ye(n, t.storeyPlacementId, i), o = s ? it(n, e.OuterCurve) : Ie(n, e.Width, e.Depth, e.Width / 2, e.Depth / 2), a = ge(n, o, e.Thickness), { shapeRepId: d, productShapeId: c } = be(n, t.bodyContextId, a), l = Ce(t.ownerHistoryId, r, c, e, "Roof");
|
|
3258
3258
|
(t.schema ?? "IFC4") !== "IFC2X3" && l.push(".FLAT_ROOF.");
|
|
3259
|
-
const u = n.addEntity("IfcRoof", l).expressId, p =
|
|
3259
|
+
const u = n.addEntity("IfcRoof", l).expressId, p = De(n, t.ownerHistoryId, u, t.storeyId);
|
|
3260
3260
|
return {
|
|
3261
3261
|
roofId: u,
|
|
3262
3262
|
placementId: r,
|
|
@@ -3267,20 +3267,20 @@ ENDSEC;
|
|
|
3267
3267
|
relContainedId: p
|
|
3268
3268
|
};
|
|
3269
3269
|
};
|
|
3270
|
-
function
|
|
3270
|
+
function Dn(n) {
|
|
3271
3271
|
return n.Profile === "polygon";
|
|
3272
3272
|
}
|
|
3273
|
-
|
|
3274
|
-
const s =
|
|
3273
|
+
Ji = function(n, t, e) {
|
|
3274
|
+
const s = Dn(e), i = s ? e.Position ?? [
|
|
3275
3275
|
0,
|
|
3276
3276
|
0,
|
|
3277
3277
|
0
|
|
3278
3278
|
] : e.Position;
|
|
3279
3279
|
if (e.Thickness <= 0) throw new Error("addPlateToStore: Thickness must be positive");
|
|
3280
3280
|
if (!s && (e.Width <= 0 || e.Depth <= 0)) throw new Error("addPlateToStore: Width and Depth must be positive");
|
|
3281
|
-
const r = ye(n, t.storeyPlacementId, i), o = s ?
|
|
3281
|
+
const r = ye(n, t.storeyPlacementId, i), o = s ? it(n, e.OuterCurve) : Ie(n, e.Width, e.Depth, e.Width / 2, e.Depth / 2), a = ge(n, o, e.Thickness), { shapeRepId: d, productShapeId: c } = be(n, t.bodyContextId, a), l = Ce(t.ownerHistoryId, r, c, e, "Plate");
|
|
3282
3282
|
(t.schema ?? "IFC4") !== "IFC2X3" && l.push(`.${e.PredefinedType ?? "NOTDEFINED"}.`);
|
|
3283
|
-
const u = n.addEntity("IfcPlate", l).expressId, p =
|
|
3283
|
+
const u = n.addEntity("IfcPlate", l).expressId, p = De(n, t.ownerHistoryId, u, t.storeyId);
|
|
3284
3284
|
return {
|
|
3285
3285
|
plateId: u,
|
|
3286
3286
|
placementId: r,
|
|
@@ -3291,7 +3291,7 @@ ENDSEC;
|
|
|
3291
3291
|
relContainedId: p
|
|
3292
3292
|
};
|
|
3293
3293
|
};
|
|
3294
|
-
function
|
|
3294
|
+
function Cn(n) {
|
|
3295
3295
|
const t = Math.abs(n[2]) < .9 ? [
|
|
3296
3296
|
0,
|
|
3297
3297
|
0,
|
|
@@ -3303,7 +3303,7 @@ ENDSEC;
|
|
|
3303
3303
|
];
|
|
3304
3304
|
return L(fe(t, n));
|
|
3305
3305
|
}
|
|
3306
|
-
|
|
3306
|
+
Ki = function(n, t, e) {
|
|
3307
3307
|
const s = e.End[0] - e.Start[0], i = e.End[1] - e.Start[1], r = e.End[2] - e.Start[2], o = Math.sqrt(s * s + i * i + r * r);
|
|
3308
3308
|
if (o <= 0) throw new Error("addMemberToStore: Start and End must be distinct points");
|
|
3309
3309
|
if (e.Width <= 0 || e.Height <= 0) throw new Error("addMemberToStore: Width and Height must be positive");
|
|
@@ -3311,9 +3311,9 @@ ENDSEC;
|
|
|
3311
3311
|
s,
|
|
3312
3312
|
i,
|
|
3313
3313
|
r
|
|
3314
|
-
]), d =
|
|
3314
|
+
]), d = Cn(a), c = ye(n, t.storeyPlacementId, e.Start, a, d), l = Ie(n, e.Width, e.Height), u = ge(n, l, o), { shapeRepId: p, productShapeId: h } = be(n, t.bodyContextId, u), f = Ce(t.ownerHistoryId, c, h, e, "Member");
|
|
3315
3315
|
(t.schema ?? "IFC4") !== "IFC2X3" && f.push(`.${e.PredefinedType ?? "NOTDEFINED"}.`);
|
|
3316
|
-
const m = n.addEntity("IfcMember", f).expressId, I =
|
|
3316
|
+
const m = n.addEntity("IfcMember", f).expressId, I = De(n, t.ownerHistoryId, m, t.storeyId);
|
|
3317
3317
|
return {
|
|
3318
3318
|
memberId: m,
|
|
3319
3319
|
placementId: c,
|
|
@@ -3324,12 +3324,12 @@ ENDSEC;
|
|
|
3324
3324
|
relContainedId: I
|
|
3325
3325
|
};
|
|
3326
3326
|
};
|
|
3327
|
-
|
|
3328
|
-
const e =
|
|
3327
|
+
vn = function(n, t) {
|
|
3328
|
+
const e = Nn(n);
|
|
3329
3329
|
if (e === null) throw new Error("resolveSpatialAnchor: no IfcOwnerHistory found in store");
|
|
3330
|
-
const s =
|
|
3330
|
+
const s = kn(n);
|
|
3331
3331
|
if (s === null) throw new Error("resolveSpatialAnchor: no IfcGeometricRepresentationContext (or Body subcontext) found in store");
|
|
3332
|
-
const i =
|
|
3332
|
+
const i = Fn(n, t);
|
|
3333
3333
|
if (i === null) throw new Error(`resolveSpatialAnchor: storey #${t} has no resolvable IfcLocalPlacement`);
|
|
3334
3334
|
const r = n.schemaVersion ?? "IFC4";
|
|
3335
3335
|
return {
|
|
@@ -3340,13 +3340,13 @@ ENDSEC;
|
|
|
3340
3340
|
schema: r
|
|
3341
3341
|
};
|
|
3342
3342
|
};
|
|
3343
|
-
function
|
|
3343
|
+
function Nn(n) {
|
|
3344
3344
|
const t = n.entityIndex.byType.get("IFCOWNERHISTORY");
|
|
3345
3345
|
return t && t.length > 0 ? t[0] : null;
|
|
3346
3346
|
}
|
|
3347
|
-
function
|
|
3347
|
+
function kn(n) {
|
|
3348
3348
|
if (!n.source) return null;
|
|
3349
|
-
const t = new
|
|
3349
|
+
const t = new Ge(n.source), e = n.entityIndex.byType.get("IFCGEOMETRICREPRESENTATIONSUBCONTEXT") ?? [];
|
|
3350
3350
|
for (const i of e){
|
|
3351
3351
|
const r = n.entityIndex.byId.get(i);
|
|
3352
3352
|
if (!r) continue;
|
|
@@ -3362,16 +3362,16 @@ ENDSEC;
|
|
|
3362
3362
|
}
|
|
3363
3363
|
return s[0] ?? null;
|
|
3364
3364
|
}
|
|
3365
|
-
function
|
|
3365
|
+
function Fn(n, t) {
|
|
3366
3366
|
if (!n.source) return null;
|
|
3367
3367
|
const e = n.entityIndex.byId.get(t);
|
|
3368
3368
|
if (!e) return null;
|
|
3369
|
-
const i = new
|
|
3369
|
+
const i = new Ge(n.source).extractEntity(e);
|
|
3370
3370
|
if (!i) return null;
|
|
3371
|
-
const o =
|
|
3371
|
+
const o = hn(i.type).indexOf("ObjectPlacement"), a = o >= 0 ? o : 5, d = i.attributes?.[a];
|
|
3372
3372
|
return typeof d == "number" ? d : null;
|
|
3373
3373
|
}
|
|
3374
|
-
|
|
3374
|
+
zi = function(n, t, e = {}) {
|
|
3375
3375
|
if (t.attributes.length < 7) throw new Error(`duplicateInStore: source has ${t.attributes.length} attributes, need ≥7 for an IfcProduct`);
|
|
3376
3376
|
const s = e.offset ?? [
|
|
3377
3377
|
1,
|
|
@@ -3431,28 +3431,28 @@ ENDSEC;
|
|
|
3431
3431
|
associationRelIds: h
|
|
3432
3432
|
};
|
|
3433
3433
|
};
|
|
3434
|
-
const
|
|
3434
|
+
const On = [
|
|
3435
3435
|
"IFCRELDEFINESBYPROPERTIES",
|
|
3436
3436
|
"IFCRELDEFINESBYTYPE",
|
|
3437
3437
|
"IFCRELASSOCIATESMATERIAL",
|
|
3438
3438
|
"IFCRELASSOCIATESCLASSIFICATION",
|
|
3439
3439
|
"IFCRELASSOCIATESDOCUMENT"
|
|
3440
3440
|
];
|
|
3441
|
-
function
|
|
3441
|
+
function Ln(n) {
|
|
3442
3442
|
return n == null ? "$" : typeof n == "number" ? `#${n}` : typeof n == "string" ? n : "$";
|
|
3443
3443
|
}
|
|
3444
|
-
function
|
|
3445
|
-
const t =
|
|
3444
|
+
function yt(n) {
|
|
3445
|
+
const t = Ln(n);
|
|
3446
3446
|
return t === "$" ? null : t;
|
|
3447
3447
|
}
|
|
3448
3448
|
function ne(n) {
|
|
3449
3449
|
return typeof n == "number" ? n : null;
|
|
3450
3450
|
}
|
|
3451
|
-
|
|
3451
|
+
Yi = function(n, t) {
|
|
3452
3452
|
if (!n.source) throw new Error("resolveDuplicateSource: data store has no source bytes");
|
|
3453
3453
|
const e = n.entityIndex.byId.get(t);
|
|
3454
3454
|
if (!e) throw new Error(`resolveDuplicateSource: entity #${t} not found`);
|
|
3455
|
-
const s = new
|
|
3455
|
+
const s = new Ge(n.source), i = s.extractEntity(e);
|
|
3456
3456
|
if (!i) throw new Error(`resolveDuplicateSource: could not parse #${t}`);
|
|
3457
3457
|
const r = i.attributes, o = ne(r[1]), a = ne(r[5]), d = ne(r[6]);
|
|
3458
3458
|
if (a === null) throw new Error(`resolveDuplicateSource: #${t} has no ObjectPlacement — only IfcProduct can be duplicated`);
|
|
@@ -3466,7 +3466,7 @@ ENDSEC;
|
|
|
3466
3466
|
if (!h) throw new Error(`resolveDuplicateSource: axis placement #${p} missing`);
|
|
3467
3467
|
const f = s.extractEntity(h);
|
|
3468
3468
|
if (!f) throw new Error(`resolveDuplicateSource: could not parse axis #${p}`);
|
|
3469
|
-
const m = ne(f.attributes[0]), I =
|
|
3469
|
+
const m = ne(f.attributes[0]), I = yt(f.attributes[1]), g = yt(f.attributes[2]);
|
|
3470
3470
|
let w = [
|
|
3471
3471
|
0,
|
|
3472
3472
|
0,
|
|
@@ -3483,7 +3483,7 @@ ENDSEC;
|
|
|
3483
3483
|
]);
|
|
3484
3484
|
}
|
|
3485
3485
|
}
|
|
3486
|
-
const P = n.spatialHierarchy?.elementToStorey?.get(t) ?? null, N =
|
|
3486
|
+
const P = n.spatialHierarchy?.elementToStorey?.get(t) ?? null, N = Mn(n, s, t);
|
|
3487
3487
|
return {
|
|
3488
3488
|
type: n.entities.getTypeName(t) || i.type,
|
|
3489
3489
|
attributes: r,
|
|
@@ -3498,9 +3498,9 @@ ENDSEC;
|
|
|
3498
3498
|
associations: N
|
|
3499
3499
|
};
|
|
3500
3500
|
};
|
|
3501
|
-
function
|
|
3501
|
+
function Mn(n, t, e) {
|
|
3502
3502
|
const s = [];
|
|
3503
|
-
for (const i of
|
|
3503
|
+
for (const i of On){
|
|
3504
3504
|
const r = n.entityIndex.byType.get(i);
|
|
3505
3505
|
if (!(!r || r.length === 0)) for (const o of r){
|
|
3506
3506
|
const a = n.entityIndex.byId.get(o);
|
|
@@ -3529,9 +3529,9 @@ ENDSEC;
|
|
|
3529
3529
|
}
|
|
3530
3530
|
return s;
|
|
3531
3531
|
}
|
|
3532
|
-
const
|
|
3533
|
-
function
|
|
3534
|
-
const e = t.snapTolerance ??
|
|
3532
|
+
const _n = .05, Wn = .5, Ft = 1e-9;
|
|
3533
|
+
function Hn(n, t = {}) {
|
|
3534
|
+
const e = t.snapTolerance ?? _n, s = t.minArea ?? Wn, r = !!t.debug ? (...b)=>console.debug("[auto-space-detect]", ...b) : ()=>{}, o = {
|
|
3535
3535
|
inputSegments: n.length,
|
|
3536
3536
|
vertices: 0,
|
|
3537
3537
|
segmentsAfterSplit: 0,
|
|
@@ -3545,13 +3545,13 @@ ENDSEC;
|
|
|
3545
3545
|
spaces: [],
|
|
3546
3546
|
stats: o
|
|
3547
3547
|
};
|
|
3548
|
-
const a = [], d = Math.max(e,
|
|
3548
|
+
const a = [], d = Math.max(e, Ft), c = new Map, l = (b, E)=>`${b},${E}`, u = (b)=>{
|
|
3549
3549
|
const E = e * e, T = Math.floor(b[0] / d), x = Math.floor(b[1] / d);
|
|
3550
3550
|
for(let ee = -1; ee <= 1; ee++)for(let te = -1; te <= 1; te++){
|
|
3551
3551
|
const ie = c.get(l(T + ee, x + te));
|
|
3552
3552
|
if (ie) for (const Se of ie){
|
|
3553
|
-
const
|
|
3554
|
-
if (
|
|
3553
|
+
const ve = a[Se].pt[0] - b[0], lt = a[Se].pt[1] - b[1];
|
|
3554
|
+
if (ve * ve + lt * lt <= E) return Se;
|
|
3555
3555
|
}
|
|
3556
3556
|
}
|
|
3557
3557
|
const A = a.length;
|
|
@@ -3590,7 +3590,7 @@ ENDSEC;
|
|
|
3590
3590
|
for(let x = 0; x < h.length; x++){
|
|
3591
3591
|
const [A, O] = h[x];
|
|
3592
3592
|
if (A === E || O === E) continue;
|
|
3593
|
-
const B =
|
|
3593
|
+
const B = Bn(T, a[A].pt, a[O].pt);
|
|
3594
3594
|
if (!B) continue;
|
|
3595
3595
|
const ee = B.point[0] - T[0], te = B.point[1] - T[1];
|
|
3596
3596
|
if (!(ee * ee + te * te > f) && !(B.t < 1e-6 || B.t > 1 - 1e-6)) {
|
|
@@ -3633,13 +3633,13 @@ ENDSEC;
|
|
|
3633
3633
|
if (E === O || E === B || T === O || T === B) continue;
|
|
3634
3634
|
const ee = P[A];
|
|
3635
3635
|
if (x.maxX < ee.minX || ee.maxX < x.minX || x.maxY < ee.minY || ee.maxY < x.minY) continue;
|
|
3636
|
-
const te =
|
|
3636
|
+
const te = Gn(a[E].pt, a[T].pt, a[O].pt, a[B].pt);
|
|
3637
3637
|
if (!te) continue;
|
|
3638
|
-
const ie = u(te.point), Se = ie === E || ie === T,
|
|
3638
|
+
const ie = u(te.point), Se = ie === E || ie === T, ve = ie === O || ie === B;
|
|
3639
3639
|
Se || w[b].push({
|
|
3640
3640
|
t: te.t,
|
|
3641
3641
|
v: ie
|
|
3642
|
-
}),
|
|
3642
|
+
}), ve || w[A].push({
|
|
3643
3643
|
t: te.u,
|
|
3644
3644
|
v: ie
|
|
3645
3645
|
});
|
|
@@ -3758,7 +3758,7 @@ ENDSEC;
|
|
|
3758
3758
|
stats: o
|
|
3759
3759
|
};
|
|
3760
3760
|
}
|
|
3761
|
-
function
|
|
3761
|
+
function Bn(n, t, e) {
|
|
3762
3762
|
const s = e[0] - t[0], i = e[1] - t[1], r = s * s + i * i;
|
|
3763
3763
|
if (r < 1e-12) return null;
|
|
3764
3764
|
let o = ((n[0] - t[0]) * s + (n[1] - t[1]) * i) / r;
|
|
@@ -3770,9 +3770,9 @@ ENDSEC;
|
|
|
3770
3770
|
t: o
|
|
3771
3771
|
};
|
|
3772
3772
|
}
|
|
3773
|
-
function
|
|
3773
|
+
function Gn(n, t, e, s) {
|
|
3774
3774
|
const i = n[0], r = n[1], o = t[0], a = t[1], d = e[0], c = e[1], l = s[0], u = s[1], p = (i - o) * (c - u) - (r - a) * (d - l);
|
|
3775
|
-
if (Math.abs(p) <
|
|
3775
|
+
if (Math.abs(p) < Ft) return null;
|
|
3776
3776
|
const h = ((i - d) * (c - u) - (r - c) * (d - l)) / p, f = -((i - o) * (r - c) - (r - a) * (i - d)) / p, m = 1e-7;
|
|
3777
3777
|
return h < -m || h > 1 + m || f < -m || f > 1 + m || (h < m || h > 1 - m) && (f < m || f > 1 - m) ? null : {
|
|
3778
3778
|
point: [
|
|
@@ -3783,7 +3783,7 @@ ENDSEC;
|
|
|
3783
3783
|
u: f
|
|
3784
3784
|
};
|
|
3785
3785
|
}
|
|
3786
|
-
const
|
|
3786
|
+
const jn = new Set([
|
|
3787
3787
|
"ifcwall",
|
|
3788
3788
|
"ifcwallstandardcase",
|
|
3789
3789
|
"ifcwallelementedcase",
|
|
@@ -3792,12 +3792,12 @@ ENDSEC;
|
|
|
3792
3792
|
"ifcplate",
|
|
3793
3793
|
"ifcmember",
|
|
3794
3794
|
"ifcrailing"
|
|
3795
|
-
]),
|
|
3796
|
-
function
|
|
3795
|
+
]), rt = 1e-6;
|
|
3796
|
+
function Un(n, t, e, s = {}) {
|
|
3797
3797
|
const i = [], r = [], o = [], a = !!s.debug, d = a ? (...f)=>console.debug("[extract-walls]", ...f) : ()=>{};
|
|
3798
3798
|
let c = 1;
|
|
3799
3799
|
if (n.source) try {
|
|
3800
|
-
c =
|
|
3800
|
+
c = pn(n.source, n.entityIndex), (!Number.isFinite(c) || c <= 0) && (c = 1);
|
|
3801
3801
|
} catch {
|
|
3802
3802
|
c = 1;
|
|
3803
3803
|
}
|
|
@@ -3808,13 +3808,13 @@ ENDSEC;
|
|
|
3808
3808
|
considered: 0,
|
|
3809
3809
|
lengthUnitScale: c
|
|
3810
3810
|
};
|
|
3811
|
-
const l = new Set(
|
|
3811
|
+
const l = new Set(jn);
|
|
3812
3812
|
if (s.extraDividerTypes) for (const f of s.extraDividerTypes)l.add(f.toLowerCase());
|
|
3813
|
-
const u = new
|
|
3813
|
+
const u = new Ge(n.source), p = Vn(n, u, t, l, d);
|
|
3814
3814
|
d(`storey #${t}: ${p.length} contained divider element(s)`);
|
|
3815
3815
|
for (const f of p){
|
|
3816
|
-
const m =
|
|
3817
|
-
m.segment ? (i.push(
|
|
3816
|
+
const m = Jn(n, u, f, d);
|
|
3817
|
+
m.segment ? (i.push(qn(m.segment, c)), r.push(f)) : o.push({
|
|
3818
3818
|
wallId: f,
|
|
3819
3819
|
reason: m.reason ?? "no-axis-or-rect-profile"
|
|
3820
3820
|
});
|
|
@@ -3824,7 +3824,7 @@ ENDSEC;
|
|
|
3824
3824
|
for (const f of e.getNewEntities()){
|
|
3825
3825
|
if (!l.has(f.type.toLowerCase())) continue;
|
|
3826
3826
|
h++;
|
|
3827
|
-
const m =
|
|
3827
|
+
const m = Kn(n, u, e, f, d);
|
|
3828
3828
|
m.segment ? (i.push(m.segment), r.push(f.expressId)) : o.push({
|
|
3829
3829
|
wallId: f.expressId,
|
|
3830
3830
|
reason: m.reason ?? "no-axis-or-rect-profile"
|
|
@@ -3844,7 +3844,7 @@ ENDSEC;
|
|
|
3844
3844
|
lengthUnitScale: c
|
|
3845
3845
|
};
|
|
3846
3846
|
}
|
|
3847
|
-
function
|
|
3847
|
+
function qn(n, t) {
|
|
3848
3848
|
return t === 1 ? n : {
|
|
3849
3849
|
a: [
|
|
3850
3850
|
n.a[0] * t,
|
|
@@ -3856,16 +3856,16 @@ ENDSEC;
|
|
|
3856
3856
|
]
|
|
3857
3857
|
};
|
|
3858
3858
|
}
|
|
3859
|
-
function
|
|
3859
|
+
function Qn(n, t) {
|
|
3860
3860
|
return t.has(n.toLowerCase());
|
|
3861
3861
|
}
|
|
3862
|
-
function
|
|
3862
|
+
function Vn(n, t, e, s, i) {
|
|
3863
3863
|
const r = [], o = new Set;
|
|
3864
3864
|
if (!n.source) return r;
|
|
3865
|
-
const a =
|
|
3865
|
+
const a = It(n, t, "IFCRELAGGREGATES", 4, 5), d = It(n, t, "IFCRELCONTAINEDINSPATIALSTRUCTURE", 5, 4), c = (h)=>{
|
|
3866
3866
|
if (o.has(h)) return;
|
|
3867
3867
|
const f = n.entities.getTypeName(h);
|
|
3868
|
-
if (f &&
|
|
3868
|
+
if (f && Qn(f, s)) {
|
|
3869
3869
|
o.add(h), r.push(h);
|
|
3870
3870
|
return;
|
|
3871
3871
|
}
|
|
@@ -3887,7 +3887,7 @@ ENDSEC;
|
|
|
3887
3887
|
...s
|
|
3888
3888
|
].join(", ")}`), r;
|
|
3889
3889
|
}
|
|
3890
|
-
function
|
|
3890
|
+
function It(n, t, e, s, i) {
|
|
3891
3891
|
const r = new Map, o = n.entityIndex.byType.get(e);
|
|
3892
3892
|
if (!o) return r;
|
|
3893
3893
|
for (const a of o){
|
|
@@ -3905,7 +3905,7 @@ ENDSEC;
|
|
|
3905
3905
|
}
|
|
3906
3906
|
return r;
|
|
3907
3907
|
}
|
|
3908
|
-
function
|
|
3908
|
+
function Jn(n, t, e, s) {
|
|
3909
3909
|
const i = n.entityIndex.byId.get(e);
|
|
3910
3910
|
if (!i) return s(`wall #${e}: missing entity ref`), {
|
|
3911
3911
|
segment: null,
|
|
@@ -3923,9 +3923,9 @@ ENDSEC;
|
|
|
3923
3923
|
} : a === null ? {
|
|
3924
3924
|
segment: null,
|
|
3925
3925
|
reason: "no-representation"
|
|
3926
|
-
} :
|
|
3926
|
+
} : Ot(n, t, o, a, void 0, e, s);
|
|
3927
3927
|
}
|
|
3928
|
-
function
|
|
3928
|
+
function Kn(n, t, e, s, i) {
|
|
3929
3929
|
const r = H(s.attributes[5]), o = H(s.attributes[6]);
|
|
3930
3930
|
return r === null ? {
|
|
3931
3931
|
segment: null,
|
|
@@ -3933,35 +3933,35 @@ ENDSEC;
|
|
|
3933
3933
|
} : o === null ? {
|
|
3934
3934
|
segment: null,
|
|
3935
3935
|
reason: "no-representation"
|
|
3936
|
-
} :
|
|
3936
|
+
} : Ot(n, t, r, o, e, s.expressId, i);
|
|
3937
3937
|
}
|
|
3938
|
-
function
|
|
3939
|
-
const a =
|
|
3938
|
+
function Ot(n, t, e, s, i, r, o) {
|
|
3939
|
+
const a = zn(n, t, i, e);
|
|
3940
3940
|
if (!a) return o(`wall #${r}: placement chain not resolvable (placement=#${e})`), {
|
|
3941
3941
|
segment: null,
|
|
3942
3942
|
reason: "placement-not-resolvable"
|
|
3943
3943
|
};
|
|
3944
|
-
const d =
|
|
3944
|
+
const d = Yn(n, t, i, s);
|
|
3945
3945
|
if (d) {
|
|
3946
|
-
const l =
|
|
3947
|
-
return
|
|
3946
|
+
const l = bt(a, d[0]), u = bt(a, d[1]);
|
|
3947
|
+
return gt(l, u, r, o, "axis-rep");
|
|
3948
3948
|
}
|
|
3949
|
-
const c =
|
|
3950
|
-
if (c !== null && c >
|
|
3949
|
+
const c = Xn(n, t, i, s);
|
|
3950
|
+
if (c !== null && c > rt) {
|
|
3951
3951
|
const l = a.origin, u = [
|
|
3952
3952
|
a.origin[0] + a.axisX[0] * c,
|
|
3953
3953
|
a.origin[1] + a.axisX[1] * c
|
|
3954
3954
|
];
|
|
3955
|
-
return
|
|
3955
|
+
return gt(l, u, r, o, "rect-profile");
|
|
3956
3956
|
}
|
|
3957
3957
|
return o(`wall #${r}: no Axis representation and no IfcRectangleProfileDef body — skipping`), {
|
|
3958
3958
|
segment: null,
|
|
3959
3959
|
reason: "no-axis-or-rect-profile"
|
|
3960
3960
|
};
|
|
3961
3961
|
}
|
|
3962
|
-
function
|
|
3962
|
+
function gt(n, t, e, s, i) {
|
|
3963
3963
|
const r = t[0] - n[0], o = t[1] - n[1], a = Math.hypot(r, o);
|
|
3964
|
-
return a <
|
|
3964
|
+
return a < rt ? (s(`wall #${e}: degenerate axis length=${a.toExponential(2)} (source=${i})`), {
|
|
3965
3965
|
segment: null,
|
|
3966
3966
|
reason: "zero-length-axis"
|
|
3967
3967
|
}) : (s(`wall #${e}: axis (${n[0].toFixed(3)},${n[1].toFixed(3)})→(${t[0].toFixed(3)},${t[1].toFixed(3)}) len=${a.toFixed(3)} source=${i}`), {
|
|
@@ -3971,7 +3971,7 @@ ENDSEC;
|
|
|
3971
3971
|
}
|
|
3972
3972
|
});
|
|
3973
3973
|
}
|
|
3974
|
-
function
|
|
3974
|
+
function zn(n, t, e, s) {
|
|
3975
3975
|
const i = X(n, t, e, s);
|
|
3976
3976
|
if (!i) return null;
|
|
3977
3977
|
const r = H(i.attributes[1]);
|
|
@@ -3982,7 +3982,7 @@ ENDSEC;
|
|
|
3982
3982
|
if (a === null) return null;
|
|
3983
3983
|
const c = X(n, t, e, a);
|
|
3984
3984
|
if (!c) return null;
|
|
3985
|
-
const l =
|
|
3985
|
+
const l = Ze(c.attributes[0]);
|
|
3986
3986
|
if (!l) return null;
|
|
3987
3987
|
let u = [
|
|
3988
3988
|
1,
|
|
@@ -3991,10 +3991,10 @@ ENDSEC;
|
|
|
3991
3991
|
if (d !== null) {
|
|
3992
3992
|
const p = X(n, t, e, d);
|
|
3993
3993
|
if (p) {
|
|
3994
|
-
const h =
|
|
3994
|
+
const h = Ze(p.attributes[0]);
|
|
3995
3995
|
if (h) {
|
|
3996
3996
|
const f = Math.hypot(h[0], h[1]);
|
|
3997
|
-
f >
|
|
3997
|
+
f > rt && (u = [
|
|
3998
3998
|
h[0] / f,
|
|
3999
3999
|
h[1] / f
|
|
4000
4000
|
]);
|
|
@@ -4009,14 +4009,14 @@ ENDSEC;
|
|
|
4009
4009
|
axisX: u
|
|
4010
4010
|
};
|
|
4011
4011
|
}
|
|
4012
|
-
function
|
|
4012
|
+
function bt(n, t) {
|
|
4013
4013
|
const e = n.axisX[0], s = n.axisX[1], i = -s, r = e;
|
|
4014
4014
|
return [
|
|
4015
4015
|
n.origin[0] + e * t[0] + i * t[1],
|
|
4016
4016
|
n.origin[1] + s * t[0] + r * t[1]
|
|
4017
4017
|
];
|
|
4018
4018
|
}
|
|
4019
|
-
function
|
|
4019
|
+
function Yn(n, t, e, s) {
|
|
4020
4020
|
const i = X(n, t, e, s);
|
|
4021
4021
|
if (!i) return null;
|
|
4022
4022
|
const r = i.attributes[2];
|
|
@@ -4026,7 +4026,7 @@ ENDSEC;
|
|
|
4026
4026
|
if (a === null) continue;
|
|
4027
4027
|
const d = X(n, t, e, a);
|
|
4028
4028
|
if (!d) continue;
|
|
4029
|
-
const c =
|
|
4029
|
+
const c = es(d.attributes[1]);
|
|
4030
4030
|
if (!c || c.toLowerCase() !== "axis") continue;
|
|
4031
4031
|
const l = d.attributes[3];
|
|
4032
4032
|
if (Array.isArray(l)) for (const u of l){
|
|
@@ -4036,7 +4036,7 @@ ENDSEC;
|
|
|
4036
4036
|
if (!h || (n.entities.getTypeName(p) || h.type || "").toLowerCase() !== "ifcpolyline") continue;
|
|
4037
4037
|
const m = h.attributes[0];
|
|
4038
4038
|
if (!Array.isArray(m) || m.length < 2) continue;
|
|
4039
|
-
const I =
|
|
4039
|
+
const I = St(n, t, e, m[0]), g = St(n, t, e, m[m.length - 1]);
|
|
4040
4040
|
if (I && g) return [
|
|
4041
4041
|
I,
|
|
4042
4042
|
g
|
|
@@ -4045,18 +4045,18 @@ ENDSEC;
|
|
|
4045
4045
|
}
|
|
4046
4046
|
return null;
|
|
4047
4047
|
}
|
|
4048
|
-
function
|
|
4048
|
+
function St(n, t, e, s) {
|
|
4049
4049
|
const i = H(s);
|
|
4050
4050
|
if (i === null) return null;
|
|
4051
4051
|
const r = X(n, t, e, i);
|
|
4052
4052
|
if (!r) return null;
|
|
4053
|
-
const o =
|
|
4053
|
+
const o = Ze(r.attributes[0]);
|
|
4054
4054
|
return o ? [
|
|
4055
4055
|
o[0],
|
|
4056
4056
|
o[1]
|
|
4057
4057
|
] : null;
|
|
4058
4058
|
}
|
|
4059
|
-
function
|
|
4059
|
+
function Xn(n, t, e, s) {
|
|
4060
4060
|
const i = X(n, t, e, s);
|
|
4061
4061
|
if (!i) return null;
|
|
4062
4062
|
const r = i.attributes[2];
|
|
@@ -4075,14 +4075,14 @@ ENDSEC;
|
|
|
4075
4075
|
const h = H(p.attributes[0]);
|
|
4076
4076
|
if (h === null) continue;
|
|
4077
4077
|
const f = X(n, t, e, h);
|
|
4078
|
-
if (!f ||
|
|
4078
|
+
if (!f || Zn(n, f, h) !== "ifcrectangleprofiledef") continue;
|
|
4079
4079
|
const I = H(f.attributes[3]);
|
|
4080
4080
|
if (I !== null && I > 0) return I;
|
|
4081
4081
|
}
|
|
4082
4082
|
}
|
|
4083
4083
|
return null;
|
|
4084
4084
|
}
|
|
4085
|
-
function
|
|
4085
|
+
function Zn(n, t, e) {
|
|
4086
4086
|
const s = n.entities.getTypeName(e);
|
|
4087
4087
|
return ((s && s !== "Unknown" ? s : t.type) ?? "").toLowerCase();
|
|
4088
4088
|
}
|
|
@@ -4109,10 +4109,10 @@ ENDSEC;
|
|
|
4109
4109
|
}
|
|
4110
4110
|
return null;
|
|
4111
4111
|
}
|
|
4112
|
-
function
|
|
4112
|
+
function es(n) {
|
|
4113
4113
|
return typeof n == "string" ? n.startsWith("'") && n.endsWith("'") ? n.slice(1, -1) : n : null;
|
|
4114
4114
|
}
|
|
4115
|
-
function
|
|
4115
|
+
function Ze(n) {
|
|
4116
4116
|
if (!Array.isArray(n) || n.length < 2) return null;
|
|
4117
4117
|
const t = H(n[0]), e = H(n[1]), s = n.length >= 3 ? H(n[2]) : 0;
|
|
4118
4118
|
return t === null || e === null || s === null ? null : [
|
|
@@ -4121,17 +4121,17 @@ ENDSEC;
|
|
|
4121
4121
|
s
|
|
4122
4122
|
];
|
|
4123
4123
|
}
|
|
4124
|
-
|
|
4124
|
+
Xi = function(n, t, e, s = {}, i) {
|
|
4125
4125
|
const r = s.height ?? 3, o = s.namePattern ?? "Space {n}";
|
|
4126
4126
|
if (r <= 0) throw new Error("generateSpacesFromWalls: height must be positive");
|
|
4127
4127
|
const a = !!s.debug, d = a ? (...m)=>console.debug("[generate-spaces]", ...m) : ()=>{};
|
|
4128
4128
|
d(`storey #${e}: starting auto-space generation`);
|
|
4129
|
-
const c =
|
|
4129
|
+
const c = Un(t, e, i, {
|
|
4130
4130
|
debug: a,
|
|
4131
4131
|
extraDividerTypes: s.extraDividerTypes
|
|
4132
4132
|
});
|
|
4133
4133
|
d(`extracted ${c.segments.length} segments from ${c.considered} walls (${c.skipped.length} skipped); unitScale=${c.lengthUnitScale}`);
|
|
4134
|
-
const l =
|
|
4134
|
+
const l = Hn(c.segments, {
|
|
4135
4135
|
snapTolerance: s.snapTolerance ?? .1,
|
|
4136
4136
|
minArea: s.minArea ?? .5,
|
|
4137
4137
|
debug: a
|
|
@@ -4146,10 +4146,10 @@ ENDSEC;
|
|
|
4146
4146
|
detectionStats: l.stats,
|
|
4147
4147
|
emitted: h
|
|
4148
4148
|
};
|
|
4149
|
-
const f =
|
|
4149
|
+
const f = vn(t, e);
|
|
4150
4150
|
if (!f) throw new Error(`generateSpacesFromWalls: no resolvable spatial anchor for storey #${e}`);
|
|
4151
4151
|
return u.forEach((m, I)=>{
|
|
4152
|
-
const g = o.replace("{n}", String(I + 1)), w =
|
|
4152
|
+
const g = o.replace("{n}", String(I + 1)), w = An(n, f, {
|
|
4153
4153
|
Profile: "polygon",
|
|
4154
4154
|
OuterCurve: m.outline,
|
|
4155
4155
|
Height: r,
|
|
@@ -4196,7 +4196,7 @@ ENDSEC;
|
|
|
4196
4196
|
}
|
|
4197
4197
|
};
|
|
4198
4198
|
})();
|
|
4199
|
-
function
|
|
4199
|
+
function ts() {
|
|
4200
4200
|
return {
|
|
4201
4201
|
name: "model",
|
|
4202
4202
|
doc: "Model operations",
|
|
@@ -4269,7 +4269,7 @@ ENDSEC;
|
|
|
4269
4269
|
}
|
|
4270
4270
|
return typeof t.modelId == "string" && typeof t.expressId == "number" ? t : null;
|
|
4271
4271
|
}
|
|
4272
|
-
function
|
|
4272
|
+
function Et(n) {
|
|
4273
4273
|
return n.map((t)=>({
|
|
4274
4274
|
name: t.name,
|
|
4275
4275
|
Name: t.name,
|
|
@@ -4280,7 +4280,7 @@ ENDSEC;
|
|
|
4280
4280
|
Type: t.type
|
|
4281
4281
|
}));
|
|
4282
4282
|
}
|
|
4283
|
-
function
|
|
4283
|
+
function ns() {
|
|
4284
4284
|
return {
|
|
4285
4285
|
name: "query",
|
|
4286
4286
|
doc: "Query entities",
|
|
@@ -4374,7 +4374,7 @@ ENDSEC;
|
|
|
4374
4374
|
call: (n, t)=>{
|
|
4375
4375
|
const e = F(t[0]);
|
|
4376
4376
|
return e ? n.properties(e).map((s)=>{
|
|
4377
|
-
const i =
|
|
4377
|
+
const i = Et(s.properties);
|
|
4378
4378
|
return {
|
|
4379
4379
|
name: s.name,
|
|
4380
4380
|
Name: s.name,
|
|
@@ -4411,7 +4411,7 @@ ENDSEC;
|
|
|
4411
4411
|
call: (n, t)=>{
|
|
4412
4412
|
const e = F(t[0]);
|
|
4413
4413
|
return e ? n.quantities(e).map((s)=>{
|
|
4414
|
-
const i =
|
|
4414
|
+
const i = Et(s.quantities);
|
|
4415
4415
|
return {
|
|
4416
4416
|
name: s.name,
|
|
4417
4417
|
Name: s.name,
|
|
@@ -4834,7 +4834,7 @@ ENDSEC;
|
|
|
4834
4834
|
]
|
|
4835
4835
|
};
|
|
4836
4836
|
}
|
|
4837
|
-
function
|
|
4837
|
+
function ss() {
|
|
4838
4838
|
return {
|
|
4839
4839
|
name: "viewer",
|
|
4840
4840
|
doc: "Viewer control",
|
|
@@ -4969,7 +4969,7 @@ ENDSEC;
|
|
|
4969
4969
|
]
|
|
4970
4970
|
};
|
|
4971
4971
|
}
|
|
4972
|
-
function
|
|
4972
|
+
function is() {
|
|
4973
4973
|
return {
|
|
4974
4974
|
name: "mutate",
|
|
4975
4975
|
doc: "Property editing",
|
|
@@ -5068,7 +5068,7 @@ ENDSEC;
|
|
|
5068
5068
|
]
|
|
5069
5069
|
};
|
|
5070
5070
|
}
|
|
5071
|
-
function
|
|
5071
|
+
function rs() {
|
|
5072
5072
|
return {
|
|
5073
5073
|
name: "store",
|
|
5074
5074
|
doc: "Document-level edits — add, remove, and edit positional STEP arguments on entities of a parsed model",
|
|
@@ -5168,7 +5168,7 @@ ENDSEC;
|
|
|
5168
5168
|
re(e, "addColumn");
|
|
5169
5169
|
const s = t[2];
|
|
5170
5170
|
if (!s) throw new Error("bim.store.addColumn: params is required");
|
|
5171
|
-
return
|
|
5171
|
+
return Ae(s.Position, "addColumn"), Y(s, [
|
|
5172
5172
|
"Width",
|
|
5173
5173
|
"Depth",
|
|
5174
5174
|
"Height"
|
|
@@ -5200,7 +5200,7 @@ ENDSEC;
|
|
|
5200
5200
|
re(e, "addWall");
|
|
5201
5201
|
const s = t[2];
|
|
5202
5202
|
if (!s) throw new Error("bim.store.addWall: params is required");
|
|
5203
|
-
return
|
|
5203
|
+
return ke(s.Start, "addWall", "Start"), ke(s.End, "addWall", "End"), Y(s, [
|
|
5204
5204
|
"Thickness",
|
|
5205
5205
|
"Height"
|
|
5206
5206
|
], "addWall"), n.store.addWall(t[0], e, s);
|
|
@@ -5233,7 +5233,7 @@ ENDSEC;
|
|
|
5233
5233
|
if (!s) throw new Error("bim.store.addSlab: params is required");
|
|
5234
5234
|
return Y(s, [
|
|
5235
5235
|
"Thickness"
|
|
5236
|
-
], "addSlab"),
|
|
5236
|
+
], "addSlab"), Fe(s, "addSlab", [
|
|
5237
5237
|
"Width",
|
|
5238
5238
|
"Depth"
|
|
5239
5239
|
]), n.store.addSlab(t[0], e, s);
|
|
@@ -5297,7 +5297,7 @@ ENDSEC;
|
|
|
5297
5297
|
tsReturn: "{ modelId: string; expressId: number }",
|
|
5298
5298
|
call: (n, t)=>{
|
|
5299
5299
|
const e = re(t[1], "addDoor"), s = t[2];
|
|
5300
|
-
return
|
|
5300
|
+
return Ae(s?.Position, "addDoor"), Y(s, [
|
|
5301
5301
|
"Width",
|
|
5302
5302
|
"Height"
|
|
5303
5303
|
], "addDoor"), s.FrameThickness !== void 0 && Y(s, [
|
|
@@ -5327,7 +5327,7 @@ ENDSEC;
|
|
|
5327
5327
|
tsReturn: "{ modelId: string; expressId: number }",
|
|
5328
5328
|
call: (n, t)=>{
|
|
5329
5329
|
const e = re(t[1], "addWindow"), s = t[2];
|
|
5330
|
-
return
|
|
5330
|
+
return Ae(s?.Position, "addWindow"), Y(s, [
|
|
5331
5331
|
"Width",
|
|
5332
5332
|
"Height"
|
|
5333
5333
|
], "addWindow"), s.FrameThickness !== void 0 && Y(s, [
|
|
@@ -5360,7 +5360,7 @@ ENDSEC;
|
|
|
5360
5360
|
if (!s) throw new Error("bim.store.addSpace: params is required");
|
|
5361
5361
|
return Y(s, [
|
|
5362
5362
|
"Height"
|
|
5363
|
-
], "addSpace"),
|
|
5363
|
+
], "addSpace"), Fe(s, "addSpace", [
|
|
5364
5364
|
"Width",
|
|
5365
5365
|
"Depth"
|
|
5366
5366
|
]), n.store.addSpace(t[0], e, s);
|
|
@@ -5391,7 +5391,7 @@ ENDSEC;
|
|
|
5391
5391
|
if (!s) throw new Error("bim.store.addRoof: params is required");
|
|
5392
5392
|
return Y(s, [
|
|
5393
5393
|
"Thickness"
|
|
5394
|
-
], "addRoof"),
|
|
5394
|
+
], "addRoof"), Fe(s, "addRoof", [
|
|
5395
5395
|
"Width",
|
|
5396
5396
|
"Depth"
|
|
5397
5397
|
]), n.store.addRoof(t[0], e, s);
|
|
@@ -5422,7 +5422,7 @@ ENDSEC;
|
|
|
5422
5422
|
if (!s) throw new Error("bim.store.addPlate: params is required");
|
|
5423
5423
|
return Y(s, [
|
|
5424
5424
|
"Thickness"
|
|
5425
|
-
], "addPlate"),
|
|
5425
|
+
], "addPlate"), Fe(s, "addPlate", [
|
|
5426
5426
|
"Width",
|
|
5427
5427
|
"Depth"
|
|
5428
5428
|
]), n.store.addPlate(t[0], e, s);
|
|
@@ -5450,7 +5450,7 @@ ENDSEC;
|
|
|
5450
5450
|
tsReturn: "{ modelId: string; expressId: number }",
|
|
5451
5451
|
call: (n, t)=>{
|
|
5452
5452
|
const e = re(t[1], "addMember"), s = t[2];
|
|
5453
|
-
return
|
|
5453
|
+
return ke(s?.Start, "addMember", "Start"), ke(s?.End, "addMember", "End"), Y(s, [
|
|
5454
5454
|
"Width",
|
|
5455
5455
|
"Height"
|
|
5456
5456
|
], "addMember"), n.store.addMember(t[0], e, s);
|
|
@@ -5464,10 +5464,10 @@ ENDSEC;
|
|
|
5464
5464
|
if (!Number.isInteger(n) || n <= 0) throw new Error(`bim.store.${t}: storeyExpressId must be a positive integer, got ${n}`);
|
|
5465
5465
|
return n;
|
|
5466
5466
|
}
|
|
5467
|
-
function
|
|
5467
|
+
function Ae(n, t) {
|
|
5468
5468
|
if (!Array.isArray(n) || n.length !== 3 || !n.every((e)=>typeof e == "number" && Number.isFinite(e))) throw new Error(`bim.store.${t}: params.Position must be [x, y, z] of finite numbers`);
|
|
5469
5469
|
}
|
|
5470
|
-
function
|
|
5470
|
+
function ke(n, t, e) {
|
|
5471
5471
|
if (!Array.isArray(n) || n.length !== 3 || !n.every((s)=>typeof s == "number" && Number.isFinite(s))) throw new Error(`bim.store.${t}: params.${e} must be [x, y, z] of finite numbers`);
|
|
5472
5472
|
}
|
|
5473
5473
|
function Y(n, t, e) {
|
|
@@ -5477,14 +5477,14 @@ ENDSEC;
|
|
|
5477
5477
|
if (typeof r != "number" || !Number.isFinite(r) || r <= 0) throw new Error(`bim.store.${e}: params.${i} must be a finite number > 0, got ${r}`);
|
|
5478
5478
|
}
|
|
5479
5479
|
}
|
|
5480
|
-
function
|
|
5480
|
+
function Fe(n, t, e) {
|
|
5481
5481
|
if (n.Profile === "polygon") {
|
|
5482
5482
|
if (!Array.isArray(n.OuterCurve) || n.OuterCurve.length < 3) throw new Error(`bim.store.${t}: polygon OuterCurve needs at least 3 points`);
|
|
5483
5483
|
for (const s of n.OuterCurve)if (!Array.isArray(s) || s.length !== 2 || typeof s[0] != "number" || !Number.isFinite(s[0]) || typeof s[1] != "number" || !Number.isFinite(s[1])) throw new Error(`bim.store.${t}: each OuterCurve point must be [number, number] of finite values`);
|
|
5484
|
-
n.Position !== void 0 &&
|
|
5485
|
-
} else
|
|
5484
|
+
n.Position !== void 0 && Ae(n.Position, t);
|
|
5485
|
+
} else Ae(n.Position, t), Y(n, e, t);
|
|
5486
5486
|
}
|
|
5487
|
-
class
|
|
5487
|
+
class os {
|
|
5488
5488
|
constructor(t){
|
|
5489
5489
|
this.backend = t;
|
|
5490
5490
|
}
|
|
@@ -5505,7 +5505,7 @@ ENDSEC;
|
|
|
5505
5505
|
this.backend.model.loadIfc(t, e ?? "created.ifc");
|
|
5506
5506
|
}
|
|
5507
5507
|
}
|
|
5508
|
-
class
|
|
5508
|
+
class as {
|
|
5509
5509
|
descriptor = {};
|
|
5510
5510
|
backend;
|
|
5511
5511
|
constructor(t){
|
|
@@ -5554,12 +5554,12 @@ ENDSEC;
|
|
|
5554
5554
|
return this.backend.query.entities(this.descriptor).map((t)=>t.ref);
|
|
5555
5555
|
}
|
|
5556
5556
|
}
|
|
5557
|
-
class
|
|
5557
|
+
class ds {
|
|
5558
5558
|
constructor(t){
|
|
5559
5559
|
this.backend = t;
|
|
5560
5560
|
}
|
|
5561
5561
|
create() {
|
|
5562
|
-
return new
|
|
5562
|
+
return new as(this.backend);
|
|
5563
5563
|
}
|
|
5564
5564
|
entity(t) {
|
|
5565
5565
|
return this.backend.query.entityData(t);
|
|
@@ -5653,12 +5653,12 @@ ENDSEC;
|
|
|
5653
5653
|
return this.create().byType("IfcBuildingStorey").toArray();
|
|
5654
5654
|
}
|
|
5655
5655
|
}
|
|
5656
|
-
class
|
|
5656
|
+
class cs {
|
|
5657
5657
|
constructor(t){
|
|
5658
5658
|
this.backend = t;
|
|
5659
5659
|
}
|
|
5660
5660
|
colorize(t, e) {
|
|
5661
|
-
const s =
|
|
5661
|
+
const s = ut(e, 1);
|
|
5662
5662
|
this.backend.viewer.colorize(t, s);
|
|
5663
5663
|
}
|
|
5664
5664
|
colorizeRgba(t, e) {
|
|
@@ -5667,7 +5667,7 @@ ENDSEC;
|
|
|
5667
5667
|
colorizeAll(t) {
|
|
5668
5668
|
const e = t.map((s)=>({
|
|
5669
5669
|
refs: s.refs,
|
|
5670
|
-
color:
|
|
5670
|
+
color: ut(s.color, 1)
|
|
5671
5671
|
}));
|
|
5672
5672
|
this.backend.viewer.colorizeAll(e);
|
|
5673
5673
|
}
|
|
@@ -5719,7 +5719,7 @@ ENDSEC;
|
|
|
5719
5719
|
this.backend.viewer.setSection(null);
|
|
5720
5720
|
}
|
|
5721
5721
|
}
|
|
5722
|
-
class
|
|
5722
|
+
class ls {
|
|
5723
5723
|
constructor(t){
|
|
5724
5724
|
this.backend = t;
|
|
5725
5725
|
}
|
|
@@ -5747,15 +5747,15 @@ ENDSEC;
|
|
|
5747
5747
|
return this.backend.mutate.redo(t);
|
|
5748
5748
|
}
|
|
5749
5749
|
}
|
|
5750
|
-
class
|
|
5750
|
+
class us {
|
|
5751
5751
|
constructor(t){
|
|
5752
5752
|
this.backend = t;
|
|
5753
5753
|
}
|
|
5754
5754
|
addEntity(t, e) {
|
|
5755
5755
|
if (!e || typeof e.type != "string" || e.type.length === 0) throw new TypeError("addEntity: def.type must be a non-empty IFC type string");
|
|
5756
|
-
if (!
|
|
5756
|
+
if (!vt(e.type)) throw new TypeError(`addEntity: unknown IFC type '${e.type}'. Pass a canonical PascalCase name (e.g. 'IfcWall').`);
|
|
5757
5757
|
return this.backend.store.addEntity(t, {
|
|
5758
|
-
type:
|
|
5758
|
+
type: Nt(e.type),
|
|
5759
5759
|
attributes: e.attributes
|
|
5760
5760
|
});
|
|
5761
5761
|
}
|
|
@@ -5796,9 +5796,9 @@ ENDSEC;
|
|
|
5796
5796
|
return this.backend.store.addMember(t, e, s);
|
|
5797
5797
|
}
|
|
5798
5798
|
}
|
|
5799
|
-
class
|
|
5799
|
+
class hs {
|
|
5800
5800
|
presets() {
|
|
5801
|
-
return
|
|
5801
|
+
return fn;
|
|
5802
5802
|
}
|
|
5803
5803
|
create(t) {
|
|
5804
5804
|
return {
|
|
@@ -5807,7 +5807,7 @@ ENDSEC;
|
|
|
5807
5807
|
};
|
|
5808
5808
|
}
|
|
5809
5809
|
}
|
|
5810
|
-
class
|
|
5810
|
+
class ps {
|
|
5811
5811
|
constructor(t){
|
|
5812
5812
|
this.backend = t;
|
|
5813
5813
|
}
|
|
@@ -5945,7 +5945,7 @@ ENDSEC;
|
|
|
5945
5945
|
return m;
|
|
5946
5946
|
});
|
|
5947
5947
|
}
|
|
5948
|
-
class
|
|
5948
|
+
class fs {
|
|
5949
5949
|
async parse(t) {
|
|
5950
5950
|
return (await G()).parseIDS(t);
|
|
5951
5951
|
}
|
|
@@ -6021,7 +6021,7 @@ ENDSEC;
|
|
|
6021
6021
|
return m;
|
|
6022
6022
|
});
|
|
6023
6023
|
}
|
|
6024
|
-
class
|
|
6024
|
+
class ms {
|
|
6025
6025
|
async createProject(t) {
|
|
6026
6026
|
return (await v()).createBCFProject(t);
|
|
6027
6027
|
}
|
|
@@ -6123,7 +6123,7 @@ ENDSEC;
|
|
|
6123
6123
|
return m;
|
|
6124
6124
|
});
|
|
6125
6125
|
}
|
|
6126
|
-
class
|
|
6126
|
+
class ys {
|
|
6127
6127
|
async getPresets() {
|
|
6128
6128
|
return (await R()).BUILT_IN_PRESETS;
|
|
6129
6129
|
}
|
|
@@ -6225,7 +6225,7 @@ ENDSEC;
|
|
|
6225
6225
|
return m;
|
|
6226
6226
|
});
|
|
6227
6227
|
}
|
|
6228
|
-
class
|
|
6228
|
+
class Is {
|
|
6229
6229
|
async getPresets() {
|
|
6230
6230
|
return (await we()).LIST_PRESETS;
|
|
6231
6231
|
}
|
|
@@ -6253,7 +6253,7 @@ ENDSEC;
|
|
|
6253
6253
|
return (await we()).listResultToCSV(t);
|
|
6254
6254
|
}
|
|
6255
6255
|
}
|
|
6256
|
-
class
|
|
6256
|
+
class gs {
|
|
6257
6257
|
constructor(t){
|
|
6258
6258
|
this.backend = t;
|
|
6259
6259
|
}
|
|
@@ -6282,7 +6282,7 @@ ENDSEC;
|
|
|
6282
6282
|
return this.backend.spatial.queryBounds(t, i);
|
|
6283
6283
|
}
|
|
6284
6284
|
}
|
|
6285
|
-
class
|
|
6285
|
+
class bs {
|
|
6286
6286
|
constructor(t){
|
|
6287
6287
|
this.backend = t;
|
|
6288
6288
|
}
|
|
@@ -6299,16 +6299,16 @@ ENDSEC;
|
|
|
6299
6299
|
this.unsubscribers.clear();
|
|
6300
6300
|
}
|
|
6301
6301
|
}
|
|
6302
|
-
class
|
|
6302
|
+
class Ss {
|
|
6303
6303
|
backend;
|
|
6304
6304
|
constructor(t){
|
|
6305
6305
|
this.backend = t ?? null;
|
|
6306
6306
|
}
|
|
6307
6307
|
project(t) {
|
|
6308
|
-
return new
|
|
6308
|
+
return new He(t);
|
|
6309
6309
|
}
|
|
6310
6310
|
building(t) {
|
|
6311
|
-
const e = new
|
|
6311
|
+
const e = new He(t), s = e.addIfcBuildingStorey({
|
|
6312
6312
|
Name: t?.StoreyName ?? "Ground Floor",
|
|
6313
6313
|
Elevation: t?.StoreyElevation ?? 0
|
|
6314
6314
|
});
|
|
@@ -6322,27 +6322,43 @@ ENDSEC;
|
|
|
6322
6322
|
this.backend.export.download(t.content, e ?? "created.ifc", "application/x-step;charset=utf-8;");
|
|
6323
6323
|
}
|
|
6324
6324
|
}
|
|
6325
|
-
const
|
|
6326
|
-
function
|
|
6325
|
+
const Es = "https://identifier.buildingsmart.org/uri/buildingsmart/ifc/4.3";
|
|
6326
|
+
function wt(n, t, e) {
|
|
6327
6327
|
const s = n.get(t);
|
|
6328
6328
|
return s && Date.now() - s.ts < e ? s.data : (s && n.delete(t), null);
|
|
6329
6329
|
}
|
|
6330
|
-
function
|
|
6330
|
+
function Tt(n, t, e) {
|
|
6331
6331
|
n.set(t, {
|
|
6332
6332
|
data: e,
|
|
6333
6333
|
ts: Date.now()
|
|
6334
6334
|
});
|
|
6335
6335
|
}
|
|
6336
|
+
class Pe extends Error {
|
|
6337
|
+
status;
|
|
6338
|
+
statusText;
|
|
6339
|
+
url;
|
|
6340
|
+
retryAfterSeconds;
|
|
6341
|
+
constructor(t, e, s, i){
|
|
6342
|
+
super(`bSDD API ${t}: ${e}`), this.name = "BsddHttpError", this.status = t, this.statusText = e, this.url = s, this.retryAfterSeconds = i;
|
|
6343
|
+
}
|
|
6344
|
+
}
|
|
6345
|
+
function ws(n) {
|
|
6346
|
+
if (!n) return;
|
|
6347
|
+
const t = Number(n);
|
|
6348
|
+
if (Number.isFinite(t)) return Math.max(0, Math.ceil(t));
|
|
6349
|
+
const e = Date.parse(n);
|
|
6350
|
+
if (Number.isFinite(e)) return Math.max(0, Math.round((e - Date.now()) / 1e3));
|
|
6351
|
+
}
|
|
6336
6352
|
async function Te(n) {
|
|
6337
6353
|
const t = await fetch(n, {
|
|
6338
6354
|
headers: {
|
|
6339
6355
|
Accept: "application/json"
|
|
6340
6356
|
}
|
|
6341
6357
|
});
|
|
6342
|
-
if (!t.ok) throw new
|
|
6358
|
+
if (!t.ok) throw new Pe(t.status, t.statusText, n, ws(t.headers.get("retry-after")));
|
|
6343
6359
|
return t.json();
|
|
6344
6360
|
}
|
|
6345
|
-
function
|
|
6361
|
+
function Lt(n, t) {
|
|
6346
6362
|
return {
|
|
6347
6363
|
name: String(n.name ?? n.propertyCode ?? ""),
|
|
6348
6364
|
uri: String(n.propertyUri ?? n.uri ?? ""),
|
|
@@ -6358,7 +6374,7 @@ ENDSEC;
|
|
|
6358
6374
|
isIfcStandard: t
|
|
6359
6375
|
};
|
|
6360
6376
|
}
|
|
6361
|
-
function
|
|
6377
|
+
function $t(n, t) {
|
|
6362
6378
|
const e = n.classProperties;
|
|
6363
6379
|
return {
|
|
6364
6380
|
uri: String(n.uri ?? ""),
|
|
@@ -6367,10 +6383,10 @@ ENDSEC;
|
|
|
6367
6383
|
definition: n.definition ? String(n.definition) : null,
|
|
6368
6384
|
parentClassUri: n.parentClassReference ? String(n.parentClassReference.uri ?? "") : null,
|
|
6369
6385
|
relatedIfcEntityNames: n.relatedIfcEntityNames,
|
|
6370
|
-
classProperties: (e ?? []).map((s)=>
|
|
6386
|
+
classProperties: (e ?? []).map((s)=>Lt(s, t))
|
|
6371
6387
|
};
|
|
6372
6388
|
}
|
|
6373
|
-
class
|
|
6389
|
+
Ts = class {
|
|
6374
6390
|
apiBase;
|
|
6375
6391
|
cache = new Map;
|
|
6376
6392
|
cacheTtl;
|
|
@@ -6378,40 +6394,40 @@ ENDSEC;
|
|
|
6378
6394
|
this.apiBase = t?.apiBase ?? "https://api.bsdd.buildingsmart.org", this.cacheTtl = t?.cacheTtlMs ?? 10 * 60 * 1e3;
|
|
6379
6395
|
}
|
|
6380
6396
|
ifcClassUri(t) {
|
|
6381
|
-
return `${
|
|
6397
|
+
return `${Es}/class/${t}`;
|
|
6382
6398
|
}
|
|
6383
6399
|
ifcClassUrl(t) {
|
|
6384
6400
|
return `https://search.bsdd.buildingsmart.org/uri/buildingsmart/ifc/4.3/class/${t}`;
|
|
6385
6401
|
}
|
|
6386
6402
|
async fetchClassInfo(t) {
|
|
6387
|
-
const e = this.ifcClassUri(t), s =
|
|
6403
|
+
const e = this.ifcClassUri(t), s = wt(this.cache, e, this.cacheTtl);
|
|
6388
6404
|
if (s) return s;
|
|
6405
|
+
let i;
|
|
6389
6406
|
try {
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
if (
|
|
6393
|
-
|
|
6394
|
-
if (o) {
|
|
6395
|
-
const a = o.classProperties;
|
|
6396
|
-
a && a.length > 0 && (r = {
|
|
6397
|
-
...r,
|
|
6398
|
-
classProperties: a.map((d)=>Ot(d, !0))
|
|
6399
|
-
});
|
|
6400
|
-
}
|
|
6401
|
-
}
|
|
6402
|
-
return wt(this.cache, e, r), r;
|
|
6403
|
-
} catch {
|
|
6404
|
-
return null;
|
|
6407
|
+
i = await Te(`${this.apiBase}/api/Class/v1?Uri=${encodeURIComponent(e)}&IncludeClassProperties=true&IncludeClassRelations=true`);
|
|
6408
|
+
} catch (o) {
|
|
6409
|
+
if (o instanceof Pe && o.status === 404) return null;
|
|
6410
|
+
throw o;
|
|
6405
6411
|
}
|
|
6412
|
+
let r = $t(i, !0);
|
|
6413
|
+
if (r.classProperties.length === 0) try {
|
|
6414
|
+
const a = (await Te(`${this.apiBase}/api/Class/Properties/v1?ClassUri=${encodeURIComponent(e)}`)).classProperties;
|
|
6415
|
+
a && a.length > 0 && (r = {
|
|
6416
|
+
...r,
|
|
6417
|
+
classProperties: a.map((d)=>Lt(d, !0))
|
|
6418
|
+
});
|
|
6419
|
+
} catch {}
|
|
6420
|
+
return Tt(this.cache, e, r), r;
|
|
6406
6421
|
}
|
|
6407
6422
|
async fetchClassByUri(t) {
|
|
6408
|
-
const e =
|
|
6423
|
+
const e = wt(this.cache, t, this.cacheTtl);
|
|
6409
6424
|
if (e) return e;
|
|
6410
6425
|
try {
|
|
6411
|
-
const s = await Te(`${this.apiBase}/api/Class/v1?Uri=${encodeURIComponent(t)}&IncludeClassProperties=true`), i =
|
|
6412
|
-
return
|
|
6413
|
-
} catch
|
|
6414
|
-
return null;
|
|
6426
|
+
const s = await Te(`${this.apiBase}/api/Class/v1?Uri=${encodeURIComponent(t)}&IncludeClassProperties=true`), i = $t(s, !1);
|
|
6427
|
+
return Tt(this.cache, t, i), i;
|
|
6428
|
+
} catch (s) {
|
|
6429
|
+
if (s instanceof Pe && s.status === 404) return null;
|
|
6430
|
+
throw s;
|
|
6415
6431
|
}
|
|
6416
6432
|
}
|
|
6417
6433
|
async searchRelatedClasses(t) {
|
|
@@ -6423,8 +6439,9 @@ ENDSEC;
|
|
|
6423
6439
|
definition: s.definition ? String(s.definition) : null,
|
|
6424
6440
|
dictionaryUri: String(s.dictionaryUri ?? "")
|
|
6425
6441
|
}));
|
|
6426
|
-
} catch
|
|
6427
|
-
return [];
|
|
6442
|
+
} catch (e) {
|
|
6443
|
+
if (e instanceof Pe && e.status === 404) return [];
|
|
6444
|
+
throw e;
|
|
6428
6445
|
}
|
|
6429
6446
|
}
|
|
6430
6447
|
async search(t) {
|
|
@@ -6436,8 +6453,9 @@ ENDSEC;
|
|
|
6436
6453
|
definition: s.definition ? String(s.definition) : null,
|
|
6437
6454
|
dictionaryUri: String(s.dictionaryUri ?? "")
|
|
6438
6455
|
}));
|
|
6439
|
-
} catch
|
|
6440
|
-
return [];
|
|
6456
|
+
} catch (e) {
|
|
6457
|
+
if (e instanceof Pe && e.status === 404) return [];
|
|
6458
|
+
throw e;
|
|
6441
6459
|
}
|
|
6442
6460
|
}
|
|
6443
6461
|
async getPropertySets(t) {
|
|
@@ -6488,7 +6506,7 @@ ENDSEC;
|
|
|
6488
6506
|
oldestMs: this.cache.size > 0 ? Date.now() - t : 0
|
|
6489
6507
|
};
|
|
6490
6508
|
}
|
|
6491
|
-
}
|
|
6509
|
+
};
|
|
6492
6510
|
function z(n) {
|
|
6493
6511
|
return new Proxy(Object.create(null), {
|
|
6494
6512
|
get (t, e) {
|
|
@@ -6498,7 +6516,7 @@ ENDSEC;
|
|
|
6498
6516
|
}
|
|
6499
6517
|
});
|
|
6500
6518
|
}
|
|
6501
|
-
class
|
|
6519
|
+
class Mt {
|
|
6502
6520
|
constructor(t){
|
|
6503
6521
|
this.transport = t;
|
|
6504
6522
|
}
|
|
@@ -6526,10 +6544,10 @@ ENDSEC;
|
|
|
6526
6544
|
return m;
|
|
6527
6545
|
});
|
|
6528
6546
|
}
|
|
6529
|
-
function
|
|
6530
|
-
return !n || typeof n != "object" ? !1 : n._backend instanceof
|
|
6547
|
+
function $s(n) {
|
|
6548
|
+
return !n || typeof n != "object" ? !1 : n._backend instanceof Mt;
|
|
6531
6549
|
}
|
|
6532
|
-
class
|
|
6550
|
+
class Ps {
|
|
6533
6551
|
bimContext;
|
|
6534
6552
|
activeSandbox = null;
|
|
6535
6553
|
lifecycleQueue = Promise.resolve();
|
|
@@ -6537,7 +6555,7 @@ ENDSEC;
|
|
|
6537
6555
|
this.bimContext = t ?? null;
|
|
6538
6556
|
}
|
|
6539
6557
|
assertSupported() {
|
|
6540
|
-
if (
|
|
6558
|
+
if ($s(this.bimContext)) throw new Error("bim.sandbox is not supported for transport-backed contexts. Use a local backend context instead.");
|
|
6541
6559
|
}
|
|
6542
6560
|
runLifecycleOperation(t) {
|
|
6543
6561
|
const e = this.lifecycleQueue.then(t, t);
|
|
@@ -6584,7 +6602,7 @@ ENDSEC;
|
|
|
6584
6602
|
return (await ue()).NAMESPACE_SCHEMAS;
|
|
6585
6603
|
}
|
|
6586
6604
|
}
|
|
6587
|
-
class
|
|
6605
|
+
class xs {
|
|
6588
6606
|
constructor(t){
|
|
6589
6607
|
this.backend = t;
|
|
6590
6608
|
}
|
|
@@ -6601,7 +6619,7 @@ ENDSEC;
|
|
|
6601
6619
|
return this.backend.files.csvColumns(t);
|
|
6602
6620
|
}
|
|
6603
6621
|
}
|
|
6604
|
-
class
|
|
6622
|
+
class As {
|
|
6605
6623
|
constructor(t){
|
|
6606
6624
|
this.backend = t;
|
|
6607
6625
|
}
|
|
@@ -6618,7 +6636,7 @@ ENDSEC;
|
|
|
6618
6636
|
return this.backend.schedule.sequences(t);
|
|
6619
6637
|
}
|
|
6620
6638
|
}
|
|
6621
|
-
class
|
|
6639
|
+
class Rs {
|
|
6622
6640
|
model;
|
|
6623
6641
|
viewer;
|
|
6624
6642
|
mutate;
|
|
@@ -6641,9 +6659,9 @@ ENDSEC;
|
|
|
6641
6659
|
_boundOn;
|
|
6642
6660
|
constructor(t){
|
|
6643
6661
|
if (t.backend) this._backend = t.backend;
|
|
6644
|
-
else if (t.transport) this._backend = new
|
|
6662
|
+
else if (t.transport) this._backend = new Mt(t.transport);
|
|
6645
6663
|
else throw new Error("BimContext requires either a backend or transport");
|
|
6646
|
-
this.model = new
|
|
6664
|
+
this.model = new os(this._backend), this._queryNamespace = new ds(this._backend), this.viewer = new cs(this._backend), this.mutate = new ls(this._backend), this.store = new us(this._backend), this.lens = new hs, this.export = new ps(this._backend), this.ids = new fs, this.bcf = new ms, this.drawing = new ys, this.list = new Is, this.spatial = new gs(this._backend), this.events = new bs(this._backend), this.create = new Ss(this._backend), this.bsdd = new Ts, this.sandbox = new Ps(this), this.files = new xs(this._backend), this.schedule = new As(this._backend), this._boundOn = this.events.on.bind(this.events);
|
|
6647
6665
|
}
|
|
6648
6666
|
query() {
|
|
6649
6667
|
return this._queryNamespace.create();
|
|
@@ -6709,10 +6727,10 @@ ENDSEC;
|
|
|
6709
6727
|
return this._boundOn;
|
|
6710
6728
|
}
|
|
6711
6729
|
}
|
|
6712
|
-
|
|
6713
|
-
return new
|
|
6730
|
+
Zi = function(n) {
|
|
6731
|
+
return new Rs(n);
|
|
6714
6732
|
};
|
|
6715
|
-
function
|
|
6733
|
+
function Ds(n, t, e, s) {
|
|
6716
6734
|
const i = n;
|
|
6717
6735
|
if (!Object.prototype.hasOwnProperty.call(i, t)) throw new Error(`Unknown namespace '${t}'`);
|
|
6718
6736
|
const r = i[t];
|
|
@@ -6722,7 +6740,7 @@ ENDSEC;
|
|
|
6722
6740
|
if (typeof o != "function") throw new Error(`Unknown method '${t}.${e}'`);
|
|
6723
6741
|
return o.apply(r, s);
|
|
6724
6742
|
}
|
|
6725
|
-
|
|
6743
|
+
er = class {
|
|
6726
6744
|
backend;
|
|
6727
6745
|
channels = [];
|
|
6728
6746
|
ports = [];
|
|
@@ -6753,7 +6771,7 @@ ENDSEC;
|
|
|
6753
6771
|
}
|
|
6754
6772
|
dispatch(t) {
|
|
6755
6773
|
try {
|
|
6756
|
-
const e =
|
|
6774
|
+
const e = Ds(this.backend, t.namespace, t.method, t.args);
|
|
6757
6775
|
return {
|
|
6758
6776
|
id: t.id,
|
|
6759
6777
|
result: e
|
|
@@ -6795,7 +6813,7 @@ ENDSEC;
|
|
|
6795
6813
|
this.channels = [], this.ports = [], this.eventSubscriptions = [];
|
|
6796
6814
|
}
|
|
6797
6815
|
};
|
|
6798
|
-
|
|
6816
|
+
yn((n)=>vt(n) ? Nt(n) : "");
|
|
6799
6817
|
function de(n, t, e, s) {
|
|
6800
6818
|
return {
|
|
6801
6819
|
name: n,
|
|
@@ -6822,7 +6840,7 @@ ENDSEC;
|
|
|
6822
6840
|
llmSemantics: s
|
|
6823
6841
|
};
|
|
6824
6842
|
}
|
|
6825
|
-
const
|
|
6843
|
+
const Cs = [
|
|
6826
6844
|
"addIfcWorkSchedule",
|
|
6827
6845
|
"addIfcWorkPlan",
|
|
6828
6846
|
"addIfcTask",
|
|
@@ -6835,7 +6853,7 @@ ENDSEC;
|
|
|
6835
6853
|
"assignProductsToTask",
|
|
6836
6854
|
"nestTasks"
|
|
6837
6855
|
];
|
|
6838
|
-
function
|
|
6856
|
+
function vs() {
|
|
6839
6857
|
const n = [];
|
|
6840
6858
|
return n.push({
|
|
6841
6859
|
name: "addIfcWorkSchedule",
|
|
@@ -7020,12 +7038,12 @@ ENDSEC;
|
|
|
7020
7038
|
useWhen: "Ergonomic alias — delegates to addIfcRelNests."
|
|
7021
7039
|
})), n;
|
|
7022
7040
|
}
|
|
7023
|
-
const
|
|
7041
|
+
const Ns = new Set([
|
|
7024
7042
|
"constructor",
|
|
7025
7043
|
"toIfc",
|
|
7026
7044
|
"setColor",
|
|
7027
|
-
...
|
|
7028
|
-
]),
|
|
7045
|
+
...Cs
|
|
7046
|
+
]), ks = new Set([
|
|
7029
7047
|
"addIfcBuildingStorey",
|
|
7030
7048
|
"addIfcWall",
|
|
7031
7049
|
"addIfcSlab",
|
|
@@ -7073,19 +7091,19 @@ ENDSEC;
|
|
|
7073
7091
|
"assignProductsToTask",
|
|
7074
7092
|
"nestTasks",
|
|
7075
7093
|
"getWorldPlacementId"
|
|
7076
|
-
]),
|
|
7094
|
+
]), Fs = new Set([
|
|
7077
7095
|
"addIfcWallDoor",
|
|
7078
7096
|
"addIfcWallWindow",
|
|
7079
7097
|
"addIfcPropertySet",
|
|
7080
7098
|
"addIfcElementQuantity",
|
|
7081
7099
|
"addIfcMaterial"
|
|
7082
|
-
]),
|
|
7100
|
+
]), Os = new Set([
|
|
7083
7101
|
"createProfile"
|
|
7084
|
-
]),
|
|
7102
|
+
]), Ls = new Set([
|
|
7085
7103
|
"getWorldPlacementId"
|
|
7086
7104
|
]);
|
|
7087
|
-
function
|
|
7088
|
-
return
|
|
7105
|
+
function Ms(n, t) {
|
|
7106
|
+
return Ns.has(n) ? "special" : Ls.has(n) ? "no-args" : Os.has(n) ? "single-dump" : Fs.has(n) ? "element-params" : "storey-params";
|
|
7089
7107
|
}
|
|
7090
7108
|
function $e(n) {
|
|
7091
7109
|
return n === "addIfcMaterial" ? "Associate a material with an element via IfcRelAssociatesMaterial (deferred to toIfc). Returns nothing." : n === "addIfcBuildingStorey" ? "Add a building storey. Returns storey expressId." : n === "addIfcGableRoof" ? "Add a dual-pitch gable roof. `Slope` is in radians. Returns roof expressId." : n === "addIfcWallDoor" ? "Add a door hosted in a wall opening. Position is wall-local [alongWall, 0, baseHeight]. Returns door expressId." : n === "addIfcWallWindow" ? "Add a window hosted in a wall opening. Position is wall-local [alongWall, 0, sillHeight]. Returns window expressId." : n === "addElement" ? "Create ANY IFC type with a profile at a placement. Returns expressId." : n === "addAxisElement" ? "Create ANY IFC type extruded along a Start→End axis. Returns expressId." : n === "createProfile" ? "Create a profile from a ProfileDef union. Returns profile ID." : n === "getWorldPlacementId" ? "Get the world placement ID for use with addLocalPlacement." : n.startsWith("addIfc") ? `Add ${n.slice(3)}. Returns expressId.` : n.startsWith("add") ? `Add ${n.slice(3)}. Returns ID.` : `Call ${n} on the creator.`;
|
|
@@ -7711,7 +7729,7 @@ ENDSEC;
|
|
|
7711
7729
|
useWhen: "Create advanced axis-based IFC entities when no dedicated helper exists."
|
|
7712
7730
|
}
|
|
7713
7731
|
};
|
|
7714
|
-
function
|
|
7732
|
+
function _s() {
|
|
7715
7733
|
const n = [];
|
|
7716
7734
|
n.push({
|
|
7717
7735
|
name: "project",
|
|
@@ -7727,7 +7745,7 @@ ENDSEC;
|
|
|
7727
7745
|
],
|
|
7728
7746
|
tsReturn: "number",
|
|
7729
7747
|
call: (s, i, r)=>{
|
|
7730
|
-
const o = i[0] ?? {}, a = new
|
|
7748
|
+
const o = i[0] ?? {}, a = new He(o);
|
|
7731
7749
|
return U.registerForSession(r.sandboxSessionId, a);
|
|
7732
7750
|
},
|
|
7733
7751
|
returns: "value",
|
|
@@ -7773,10 +7791,10 @@ ENDSEC;
|
|
|
7773
7791
|
},
|
|
7774
7792
|
returns: "void",
|
|
7775
7793
|
llmSemantics: oe.setColor
|
|
7776
|
-
}), n.push(...
|
|
7777
|
-
const t =
|
|
7794
|
+
}), n.push(...vs());
|
|
7795
|
+
const t = He.prototype, e = Object.getOwnPropertyNames(t).filter((s)=>typeof t[s] == "function" && ks.has(s)).sort();
|
|
7778
7796
|
for (const s of e){
|
|
7779
|
-
const i =
|
|
7797
|
+
const i = Ms(s);
|
|
7780
7798
|
if (i !== "special") switch(i){
|
|
7781
7799
|
case "storey-params":
|
|
7782
7800
|
s === "addIfcBuildingStorey" ? n.push({
|
|
@@ -7871,7 +7889,7 @@ ENDSEC;
|
|
|
7871
7889
|
}
|
|
7872
7890
|
return n;
|
|
7873
7891
|
}
|
|
7874
|
-
function
|
|
7892
|
+
function Ws() {
|
|
7875
7893
|
return {
|
|
7876
7894
|
name: "files",
|
|
7877
7895
|
doc: "Uploaded file attachments",
|
|
@@ -7945,7 +7963,7 @@ ENDSEC;
|
|
|
7945
7963
|
]
|
|
7946
7964
|
};
|
|
7947
7965
|
}
|
|
7948
|
-
function
|
|
7966
|
+
function Hs() {
|
|
7949
7967
|
return {
|
|
7950
7968
|
name: "export",
|
|
7951
7969
|
doc: "Data export",
|
|
@@ -8042,7 +8060,7 @@ ENDSEC;
|
|
|
8042
8060
|
optional: s
|
|
8043
8061
|
};
|
|
8044
8062
|
}
|
|
8045
|
-
const
|
|
8063
|
+
const _t = [
|
|
8046
8064
|
$("ScheduleStart", "scheduleStart", "string"),
|
|
8047
8065
|
$("ScheduleFinish", "scheduleFinish", "string"),
|
|
8048
8066
|
$("ScheduleDuration", "scheduleDuration", "string"),
|
|
@@ -8060,7 +8078,7 @@ ENDSEC;
|
|
|
8060
8078
|
$("IsCritical", "isCritical", "boolean"),
|
|
8061
8079
|
$("Completion", "completion", "number"),
|
|
8062
8080
|
$("DurationType", "durationType", "'WORKTIME' | 'ELAPSEDTIME' | 'NOTDEFINED'")
|
|
8063
|
-
],
|
|
8081
|
+
], Wt = [
|
|
8064
8082
|
$("GlobalId", "globalId", "string", !1),
|
|
8065
8083
|
$("ExpressId", "expressId", "number", !1),
|
|
8066
8084
|
$("Name", "name", "string", !1),
|
|
@@ -8078,7 +8096,7 @@ ENDSEC;
|
|
|
8078
8096
|
$("AssignedProductExpressIds", "productExpressIds", "number[]", !1),
|
|
8079
8097
|
$("AssignedProductGlobalIds", "productGlobalIds", "string[]", !1),
|
|
8080
8098
|
$("ControllingScheduleGlobalIds", "controllingScheduleGlobalIds", "string[]", !1)
|
|
8081
|
-
],
|
|
8099
|
+
], Ht = [
|
|
8082
8100
|
$("GlobalId", "globalId", "string", !1),
|
|
8083
8101
|
$("ExpressId", "expressId", "number", !1),
|
|
8084
8102
|
$("Name", "name", "string", !1),
|
|
@@ -8092,7 +8110,7 @@ ENDSEC;
|
|
|
8092
8110
|
$("PredefinedType", "predefinedType", "string"),
|
|
8093
8111
|
$("Kind", "kind", "'WorkSchedule' | 'WorkPlan'", !1),
|
|
8094
8112
|
$("TaskGlobalIds", "taskGlobalIds", "string[]", !1)
|
|
8095
|
-
],
|
|
8113
|
+
], Bt = [
|
|
8096
8114
|
$("RelatingProcessGlobalId", "relatingTaskGlobalId", "string", !1),
|
|
8097
8115
|
$("RelatedProcessGlobalId", "relatedTaskGlobalId", "string", !1),
|
|
8098
8116
|
$("SequenceType", "sequenceType", "'START_START' | 'START_FINISH' | 'FINISH_START' | 'FINISH_FINISH' | 'USERDEFINED' | 'NOTDEFINED'", !1),
|
|
@@ -8100,40 +8118,40 @@ ENDSEC;
|
|
|
8100
8118
|
$("TimeLagSeconds", "timeLagSeconds", "number"),
|
|
8101
8119
|
$("TimeLagDuration", "timeLagDuration", "string")
|
|
8102
8120
|
];
|
|
8103
|
-
function
|
|
8121
|
+
function je(n, t = "") {
|
|
8104
8122
|
const e = n.map((s)=>`${s.pascalKey}${s.optional ? "?" : ""}: ${s.tsType}`);
|
|
8105
8123
|
return t && e.push(t), `{ ${e.join("; ")} }`;
|
|
8106
8124
|
}
|
|
8107
|
-
const
|
|
8108
|
-
function
|
|
8125
|
+
const Bs = je(_t), Gt = je(Wt, `TaskTime?: ${Bs}`), jt = je(Ht), Ut = je(Bt), Gs = `{ HasSchedule: boolean; WorkSchedules: Array<${jt}>; Tasks: Array<${Gt}>; Sequences: Array<${Ut}> }`;
|
|
8126
|
+
function Ue(n, t) {
|
|
8109
8127
|
const e = {};
|
|
8110
8128
|
for (const s of t)e[s.pascalKey] = n[s.camelKey];
|
|
8111
8129
|
return e;
|
|
8112
8130
|
}
|
|
8113
|
-
function
|
|
8114
|
-
if (n) return
|
|
8131
|
+
function js(n) {
|
|
8132
|
+
if (n) return Ue(n, _t);
|
|
8115
8133
|
}
|
|
8116
|
-
function
|
|
8134
|
+
function qt(n) {
|
|
8117
8135
|
return {
|
|
8118
|
-
...
|
|
8119
|
-
TaskTime:
|
|
8136
|
+
...Ue(n, Wt),
|
|
8137
|
+
TaskTime: js(n.taskTime)
|
|
8120
8138
|
};
|
|
8121
8139
|
}
|
|
8122
|
-
function qt(n) {
|
|
8123
|
-
return je(n, Wt);
|
|
8124
|
-
}
|
|
8125
8140
|
function Qt(n) {
|
|
8126
|
-
return
|
|
8141
|
+
return Ue(n, Ht);
|
|
8142
|
+
}
|
|
8143
|
+
function Vt(n) {
|
|
8144
|
+
return Ue(n, Bt);
|
|
8127
8145
|
}
|
|
8128
|
-
function
|
|
8146
|
+
function Us(n) {
|
|
8129
8147
|
return {
|
|
8130
8148
|
HasSchedule: n.hasSchedule,
|
|
8131
|
-
WorkSchedules: (n.workSchedules ?? []).map(
|
|
8132
|
-
Tasks: (n.tasks ?? []).map(
|
|
8133
|
-
Sequences: (n.sequences ?? []).map(
|
|
8149
|
+
WorkSchedules: (n.workSchedules ?? []).map(Qt),
|
|
8150
|
+
Tasks: (n.tasks ?? []).map(qt),
|
|
8151
|
+
Sequences: (n.sequences ?? []).map(Vt)
|
|
8134
8152
|
};
|
|
8135
8153
|
}
|
|
8136
|
-
function
|
|
8154
|
+
function qs() {
|
|
8137
8155
|
return {
|
|
8138
8156
|
name: "schedule",
|
|
8139
8157
|
doc: "4D / IFC construction schedule reader (IfcTask, IfcWorkSchedule, IfcRelSequence)",
|
|
@@ -8151,8 +8169,8 @@ ENDSEC;
|
|
|
8151
8169
|
tsParamTypes: [
|
|
8152
8170
|
"string | undefined"
|
|
8153
8171
|
],
|
|
8154
|
-
tsReturn:
|
|
8155
|
-
call: (n, t)=>
|
|
8172
|
+
tsReturn: Gs,
|
|
8173
|
+
call: (n, t)=>Us(n.schedule.data(t[0])),
|
|
8156
8174
|
returns: "value",
|
|
8157
8175
|
llmSemantics: {
|
|
8158
8176
|
taskTags: [
|
|
@@ -8173,8 +8191,8 @@ ENDSEC;
|
|
|
8173
8191
|
tsParamTypes: [
|
|
8174
8192
|
"string | undefined"
|
|
8175
8193
|
],
|
|
8176
|
-
tsReturn: `Array<${
|
|
8177
|
-
call: (n, t)=>(n.schedule.tasks(t[0]) ?? []).map(
|
|
8194
|
+
tsReturn: `Array<${Gt}>`,
|
|
8195
|
+
call: (n, t)=>(n.schedule.tasks(t[0]) ?? []).map(qt),
|
|
8178
8196
|
returns: "value",
|
|
8179
8197
|
llmSemantics: {
|
|
8180
8198
|
taskTags: [
|
|
@@ -8195,8 +8213,8 @@ ENDSEC;
|
|
|
8195
8213
|
tsParamTypes: [
|
|
8196
8214
|
"string | undefined"
|
|
8197
8215
|
],
|
|
8198
|
-
tsReturn: `Array<${
|
|
8199
|
-
call: (n, t)=>(n.schedule.workSchedules(t[0]) ?? []).map(
|
|
8216
|
+
tsReturn: `Array<${jt}>`,
|
|
8217
|
+
call: (n, t)=>(n.schedule.workSchedules(t[0]) ?? []).map(Qt),
|
|
8200
8218
|
returns: "value",
|
|
8201
8219
|
llmSemantics: {
|
|
8202
8220
|
taskTags: [
|
|
@@ -8217,8 +8235,8 @@ ENDSEC;
|
|
|
8217
8235
|
tsParamTypes: [
|
|
8218
8236
|
"string | undefined"
|
|
8219
8237
|
],
|
|
8220
|
-
tsReturn: `Array<${
|
|
8221
|
-
call: (n, t)=>(n.schedule.sequences(t[0]) ?? []).map(
|
|
8238
|
+
tsReturn: `Array<${Ut}>`,
|
|
8239
|
+
call: (n, t)=>(n.schedule.sequences(t[0]) ?? []).map(Vt),
|
|
8222
8240
|
returns: "value",
|
|
8223
8241
|
llmSemantics: {
|
|
8224
8242
|
taskTags: [
|
|
@@ -8230,12 +8248,12 @@ ENDSEC;
|
|
|
8230
8248
|
]
|
|
8231
8249
|
};
|
|
8232
8250
|
}
|
|
8233
|
-
|
|
8234
|
-
es(),
|
|
8251
|
+
Jt = [
|
|
8235
8252
|
ts(),
|
|
8236
8253
|
ns(),
|
|
8237
8254
|
ss(),
|
|
8238
8255
|
is(),
|
|
8256
|
+
rs(),
|
|
8239
8257
|
{
|
|
8240
8258
|
name: "lens",
|
|
8241
8259
|
doc: "Lens visualization",
|
|
@@ -8255,30 +8273,30 @@ ENDSEC;
|
|
|
8255
8273
|
name: "create",
|
|
8256
8274
|
doc: "IFC creation from scratch",
|
|
8257
8275
|
permission: "export",
|
|
8258
|
-
methods:
|
|
8276
|
+
methods: _s()
|
|
8259
8277
|
},
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8278
|
+
Ws(),
|
|
8279
|
+
qs(),
|
|
8280
|
+
Hs()
|
|
8263
8281
|
];
|
|
8264
|
-
function
|
|
8265
|
-
for (const r of
|
|
8282
|
+
function Qs(n, t, e, s, i) {
|
|
8283
|
+
for (const r of Jt)s[r.permission] && Vs(n, t, e, r, i);
|
|
8266
8284
|
}
|
|
8267
|
-
function
|
|
8285
|
+
function Vs(n, t, e, s, i) {
|
|
8268
8286
|
const r = n.newObject();
|
|
8269
8287
|
for (const o of s.methods){
|
|
8270
8288
|
const a = n.newFunction(o.name, (...d)=>{
|
|
8271
|
-
const c =
|
|
8272
|
-
return
|
|
8289
|
+
const c = Ks(n, d, o.args), l = o.call(e, c, i);
|
|
8290
|
+
return zs(n, l, o.returns);
|
|
8273
8291
|
});
|
|
8274
8292
|
n.setProp(r, o.name, a), a.dispose();
|
|
8275
8293
|
}
|
|
8276
8294
|
n.setProp(t, s.name, r), r.dispose();
|
|
8277
8295
|
}
|
|
8278
|
-
function
|
|
8296
|
+
function Js(n) {
|
|
8279
8297
|
U.removeSession(n.sandboxSessionId);
|
|
8280
8298
|
}
|
|
8281
|
-
function
|
|
8299
|
+
function Ks(n, t, e) {
|
|
8282
8300
|
const s = [];
|
|
8283
8301
|
for(let i = 0; i < e.length; i++)switch(e[i]){
|
|
8284
8302
|
case "string":
|
|
@@ -8319,26 +8337,26 @@ ENDSEC;
|
|
|
8319
8337
|
}
|
|
8320
8338
|
return s;
|
|
8321
8339
|
}
|
|
8322
|
-
function
|
|
8340
|
+
function zs(n, t, e) {
|
|
8323
8341
|
switch(e){
|
|
8324
8342
|
case "void":
|
|
8325
8343
|
return;
|
|
8326
8344
|
case "string":
|
|
8327
8345
|
return typeof t == "string" ? n.newString(t) : n.null;
|
|
8328
8346
|
case "value":
|
|
8329
|
-
return
|
|
8347
|
+
return Kt(n, t);
|
|
8330
8348
|
}
|
|
8331
8349
|
}
|
|
8332
|
-
const
|
|
8333
|
-
function
|
|
8334
|
-
return
|
|
8350
|
+
const Ys = 64;
|
|
8351
|
+
function Kt(n, t) {
|
|
8352
|
+
return et(n, t, 0, new WeakSet);
|
|
8335
8353
|
}
|
|
8336
|
-
function
|
|
8354
|
+
function et(n, t, e, s) {
|
|
8337
8355
|
if (t == null) return n.null;
|
|
8338
8356
|
if (typeof t == "string") return n.newString(t);
|
|
8339
8357
|
if (typeof t == "number") return n.newNumber(t);
|
|
8340
8358
|
if (typeof t == "boolean") return t ? n.true : n.false;
|
|
8341
|
-
if (e >=
|
|
8359
|
+
if (e >= Ys || typeof t != "object") return n.null;
|
|
8342
8360
|
const i = t;
|
|
8343
8361
|
if (s.has(i)) return n.null;
|
|
8344
8362
|
s.add(i);
|
|
@@ -8346,14 +8364,14 @@ ENDSEC;
|
|
|
8346
8364
|
if (Array.isArray(t)) {
|
|
8347
8365
|
const o = n.newArray();
|
|
8348
8366
|
for(let a = 0; a < t.length; a++){
|
|
8349
|
-
const d =
|
|
8367
|
+
const d = et(n, t[a], e + 1, s);
|
|
8350
8368
|
n.setProp(o, a, d), d.dispose();
|
|
8351
8369
|
}
|
|
8352
8370
|
return o;
|
|
8353
8371
|
}
|
|
8354
8372
|
const r = n.newObject();
|
|
8355
8373
|
for (const [o, a] of Object.entries(i)){
|
|
8356
|
-
const d =
|
|
8374
|
+
const d = et(n, a, e + 1, s);
|
|
8357
8375
|
n.setProp(r, o, d), d.dispose();
|
|
8358
8376
|
}
|
|
8359
8377
|
return r;
|
|
@@ -8368,7 +8386,7 @@ ENDSEC;
|
|
|
8368
8386
|
JS_EVAL_FLAG_STRIP: 16,
|
|
8369
8387
|
JS_EVAL_FLAG_COMPILE_ONLY: 32,
|
|
8370
8388
|
JS_EVAL_FLAG_BACKTRACE_BARRIER: 64
|
|
8371
|
-
},
|
|
8389
|
+
}, Pt = {
|
|
8372
8390
|
BaseObjects: 1,
|
|
8373
8391
|
Date: 2,
|
|
8374
8392
|
Eval: 4,
|
|
@@ -8385,7 +8403,7 @@ ENDSEC;
|
|
|
8385
8403
|
BigDecimal: 8192,
|
|
8386
8404
|
OperatorOverloading: 16384,
|
|
8387
8405
|
BignumExt: 32768
|
|
8388
|
-
},
|
|
8406
|
+
}, Qe = {
|
|
8389
8407
|
Pending: 0,
|
|
8390
8408
|
Fulfilled: 1,
|
|
8391
8409
|
Rejected: 2
|
|
@@ -8396,96 +8414,96 @@ ENDSEC;
|
|
|
8396
8414
|
JS_GPN_ENUM_ONLY: 16,
|
|
8397
8415
|
QTS_GPN_NUMBER_MASK: 64,
|
|
8398
8416
|
QTS_STANDARD_COMPLIANT_NUMBER: 128
|
|
8399
|
-
},
|
|
8417
|
+
}, Oe = {
|
|
8400
8418
|
IsStrictlyEqual: 0,
|
|
8401
8419
|
IsSameValue: 1,
|
|
8402
8420
|
IsSameValueZero: 2
|
|
8403
|
-
},
|
|
8404
|
-
for(var e in t)
|
|
8421
|
+
}, Xs = Object.defineProperty, Zs = (n, t)=>{
|
|
8422
|
+
for(var e in t)Xs(n, e, {
|
|
8405
8423
|
get: t[e],
|
|
8406
8424
|
enumerable: !0
|
|
8407
8425
|
});
|
|
8408
8426
|
};
|
|
8409
|
-
function
|
|
8410
|
-
var
|
|
8411
|
-
|
|
8412
|
-
QuickJSAsyncifyError: ()=>
|
|
8413
|
-
QuickJSAsyncifySuspended: ()=>
|
|
8414
|
-
QuickJSEmptyGetOwnPropertyNames: ()=>
|
|
8415
|
-
QuickJSEmscriptenModuleError: ()=>
|
|
8416
|
-
QuickJSMemoryLeakDetected: ()=>
|
|
8417
|
-
QuickJSNotImplemented: ()=>
|
|
8418
|
-
QuickJSPromisePending: ()=>
|
|
8419
|
-
QuickJSUnknownIntrinsic: ()=>
|
|
8420
|
-
QuickJSUnwrapError: ()=>
|
|
8421
|
-
QuickJSUseAfterFree: ()=>
|
|
8422
|
-
QuickJSWrongOwner: ()=>
|
|
8427
|
+
function Le(...n) {}
|
|
8428
|
+
var ei = {};
|
|
8429
|
+
Zs(ei, {
|
|
8430
|
+
QuickJSAsyncifyError: ()=>Xt,
|
|
8431
|
+
QuickJSAsyncifySuspended: ()=>Zt,
|
|
8432
|
+
QuickJSEmptyGetOwnPropertyNames: ()=>nn,
|
|
8433
|
+
QuickJSEmscriptenModuleError: ()=>ni,
|
|
8434
|
+
QuickJSMemoryLeakDetected: ()=>ti,
|
|
8435
|
+
QuickJSNotImplemented: ()=>Yt,
|
|
8436
|
+
QuickJSPromisePending: ()=>tn,
|
|
8437
|
+
QuickJSUnknownIntrinsic: ()=>en,
|
|
8438
|
+
QuickJSUnwrapError: ()=>tt,
|
|
8439
|
+
QuickJSUseAfterFree: ()=>nt,
|
|
8440
|
+
QuickJSWrongOwner: ()=>zt
|
|
8423
8441
|
});
|
|
8424
|
-
var
|
|
8442
|
+
var tt = class extends Error {
|
|
8425
8443
|
constructor(n, t){
|
|
8426
8444
|
let e = typeof n == "object" && n && "message" in n ? String(n.message) : String(n);
|
|
8427
8445
|
super(e), this.cause = n, this.context = t, this.name = "QuickJSUnwrapError";
|
|
8428
8446
|
}
|
|
8429
|
-
},
|
|
8447
|
+
}, zt = class extends Error {
|
|
8430
8448
|
constructor(){
|
|
8431
8449
|
super(...arguments), this.name = "QuickJSWrongOwner";
|
|
8432
8450
|
}
|
|
8433
|
-
},
|
|
8451
|
+
}, nt = class extends Error {
|
|
8434
8452
|
constructor(){
|
|
8435
8453
|
super(...arguments), this.name = "QuickJSUseAfterFree";
|
|
8436
8454
|
}
|
|
8437
|
-
},
|
|
8455
|
+
}, Yt = class extends Error {
|
|
8438
8456
|
constructor(){
|
|
8439
8457
|
super(...arguments), this.name = "QuickJSNotImplemented";
|
|
8440
8458
|
}
|
|
8441
|
-
},
|
|
8459
|
+
}, Xt = class extends Error {
|
|
8442
8460
|
constructor(){
|
|
8443
8461
|
super(...arguments), this.name = "QuickJSAsyncifyError";
|
|
8444
8462
|
}
|
|
8445
|
-
},
|
|
8463
|
+
}, Zt = class extends Error {
|
|
8446
8464
|
constructor(){
|
|
8447
8465
|
super(...arguments), this.name = "QuickJSAsyncifySuspended";
|
|
8448
8466
|
}
|
|
8449
|
-
},
|
|
8467
|
+
}, ti = class extends Error {
|
|
8450
8468
|
constructor(){
|
|
8451
8469
|
super(...arguments), this.name = "QuickJSMemoryLeakDetected";
|
|
8452
8470
|
}
|
|
8453
|
-
},
|
|
8471
|
+
}, ni = class extends Error {
|
|
8454
8472
|
constructor(){
|
|
8455
8473
|
super(...arguments), this.name = "QuickJSEmscriptenModuleError";
|
|
8456
8474
|
}
|
|
8457
|
-
},
|
|
8475
|
+
}, en = class extends TypeError {
|
|
8458
8476
|
constructor(){
|
|
8459
8477
|
super(...arguments), this.name = "QuickJSUnknownIntrinsic";
|
|
8460
8478
|
}
|
|
8461
|
-
},
|
|
8479
|
+
}, tn = class extends Error {
|
|
8462
8480
|
constructor(){
|
|
8463
8481
|
super(...arguments), this.name = "QuickJSPromisePending";
|
|
8464
8482
|
}
|
|
8465
|
-
},
|
|
8483
|
+
}, nn = class extends Error {
|
|
8466
8484
|
constructor(){
|
|
8467
8485
|
super(...arguments), this.name = "QuickJSEmptyGetOwnPropertyNames";
|
|
8468
8486
|
}
|
|
8469
8487
|
};
|
|
8470
|
-
function*
|
|
8488
|
+
function* sn(n) {
|
|
8471
8489
|
return yield n;
|
|
8472
8490
|
}
|
|
8473
|
-
function
|
|
8474
|
-
return
|
|
8491
|
+
function si(n) {
|
|
8492
|
+
return sn(at(n));
|
|
8475
8493
|
}
|
|
8476
|
-
var
|
|
8477
|
-
|
|
8478
|
-
function
|
|
8494
|
+
var ot = sn;
|
|
8495
|
+
ot.of = si;
|
|
8496
|
+
function xt(n, t) {
|
|
8479
8497
|
return (...e)=>{
|
|
8480
|
-
let s = t.call(n,
|
|
8481
|
-
return
|
|
8498
|
+
let s = t.call(n, ot, ...e);
|
|
8499
|
+
return at(s);
|
|
8482
8500
|
};
|
|
8483
8501
|
}
|
|
8484
|
-
function
|
|
8485
|
-
let e = t.call(n,
|
|
8486
|
-
return
|
|
8502
|
+
function ii(n, t) {
|
|
8503
|
+
let e = t.call(n, ot);
|
|
8504
|
+
return at(e);
|
|
8487
8505
|
}
|
|
8488
|
-
function
|
|
8506
|
+
function at(n) {
|
|
8489
8507
|
function t(e) {
|
|
8490
8508
|
return e.done ? e.value : e.value instanceof Promise ? e.value.then((s)=>t(n.next(s)), (s)=>t(n.throw(s))) : t(n.next(e.value));
|
|
8491
8509
|
}
|
|
@@ -8495,11 +8513,11 @@ ENDSEC;
|
|
|
8495
8513
|
[Symbol.dispose]() {
|
|
8496
8514
|
return this.dispose();
|
|
8497
8515
|
}
|
|
8498
|
-
},
|
|
8499
|
-
|
|
8516
|
+
}, st = Symbol.dispose ?? Symbol.for("Symbol.dispose"), At = ae.prototype;
|
|
8517
|
+
At[st] || (At[st] = function() {
|
|
8500
8518
|
return this.dispose();
|
|
8501
8519
|
});
|
|
8502
|
-
var q = class
|
|
8520
|
+
var q = class rn extends ae {
|
|
8503
8521
|
constructor(t, e, s, i){
|
|
8504
8522
|
super(), this._value = t, this.copier = e, this.disposer = s, this._owner = i, this._alive = !0, this._constructorStack = void 0;
|
|
8505
8523
|
}
|
|
@@ -8517,7 +8535,7 @@ ENDSEC;
|
|
|
8517
8535
|
}
|
|
8518
8536
|
dup() {
|
|
8519
8537
|
if (this.assertAlive(), !this.copier) throw new Error("Non-dupable lifetime");
|
|
8520
|
-
return new
|
|
8538
|
+
return new rn(this.copier(this._value), this.copier, this.disposer, this._owner);
|
|
8521
8539
|
}
|
|
8522
8540
|
consume(t) {
|
|
8523
8541
|
this.assertAlive();
|
|
@@ -8534,9 +8552,9 @@ ENDSEC;
|
|
|
8534
8552
|
this.assertAlive(), this.disposer && this.disposer(this._value), this._alive = !1;
|
|
8535
8553
|
}
|
|
8536
8554
|
assertAlive() {
|
|
8537
|
-
if (!this.alive) throw this._constructorStack ? new
|
|
8555
|
+
if (!this.alive) throw this._constructorStack ? new nt(`Lifetime not alive
|
|
8538
8556
|
${this._constructorStack}
|
|
8539
|
-
Lifetime used`) : new
|
|
8557
|
+
Lifetime used`) : new nt("Lifetime not alive");
|
|
8540
8558
|
}
|
|
8541
8559
|
}, ce = class extends q {
|
|
8542
8560
|
constructor(n, t){
|
|
@@ -8549,7 +8567,7 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
8549
8567
|
return this;
|
|
8550
8568
|
}
|
|
8551
8569
|
dispose() {}
|
|
8552
|
-
},
|
|
8570
|
+
}, Rt = class extends q {
|
|
8553
8571
|
constructor(n, t, e, s){
|
|
8554
8572
|
super(n, t, e, s);
|
|
8555
8573
|
}
|
|
@@ -8557,7 +8575,7 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
8557
8575
|
this._alive = !1;
|
|
8558
8576
|
}
|
|
8559
8577
|
};
|
|
8560
|
-
function
|
|
8578
|
+
function Ve(n, t) {
|
|
8561
8579
|
let e;
|
|
8562
8580
|
try {
|
|
8563
8581
|
n.dispose();
|
|
@@ -8571,40 +8589,40 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
8571
8589
|
}), t;
|
|
8572
8590
|
if (t || e) throw t || e;
|
|
8573
8591
|
}
|
|
8574
|
-
var se = class
|
|
8592
|
+
var se = class We extends ae {
|
|
8575
8593
|
constructor(){
|
|
8576
8594
|
super(...arguments), this._disposables = new q(new Set), this.manage = (t)=>(this._disposables.value.add(t), t);
|
|
8577
8595
|
}
|
|
8578
8596
|
static withScope(t) {
|
|
8579
|
-
let e = new
|
|
8597
|
+
let e = new We, s;
|
|
8580
8598
|
try {
|
|
8581
8599
|
return t(e);
|
|
8582
8600
|
} catch (i) {
|
|
8583
8601
|
throw s = i, i;
|
|
8584
8602
|
} finally{
|
|
8585
|
-
|
|
8603
|
+
Ve(e, s);
|
|
8586
8604
|
}
|
|
8587
8605
|
}
|
|
8588
8606
|
static withScopeMaybeAsync(t, e) {
|
|
8589
|
-
return
|
|
8590
|
-
let i = new
|
|
8607
|
+
return ii(void 0, function*(s) {
|
|
8608
|
+
let i = new We, r;
|
|
8591
8609
|
try {
|
|
8592
8610
|
return yield* s.of(e.call(t, s, i));
|
|
8593
8611
|
} catch (o) {
|
|
8594
8612
|
throw r = o, o;
|
|
8595
8613
|
} finally{
|
|
8596
|
-
|
|
8614
|
+
Ve(i, r);
|
|
8597
8615
|
}
|
|
8598
8616
|
});
|
|
8599
8617
|
}
|
|
8600
8618
|
static async withScopeAsync(t) {
|
|
8601
|
-
let e = new
|
|
8619
|
+
let e = new We, s;
|
|
8602
8620
|
try {
|
|
8603
8621
|
return await t(e);
|
|
8604
8622
|
} catch (i) {
|
|
8605
8623
|
throw s = i, i;
|
|
8606
8624
|
} finally{
|
|
8607
|
-
|
|
8625
|
+
Ve(e, s);
|
|
8608
8626
|
}
|
|
8609
8627
|
}
|
|
8610
8628
|
get alive() {
|
|
@@ -8616,7 +8634,7 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
8616
8634
|
this._disposables.dispose();
|
|
8617
8635
|
}
|
|
8618
8636
|
};
|
|
8619
|
-
function
|
|
8637
|
+
function ri(n) {
|
|
8620
8638
|
let t = n ? Array.from(n) : [];
|
|
8621
8639
|
function e() {
|
|
8622
8640
|
return t.forEach((i)=>i.alive ? i.dispose() : void 0);
|
|
@@ -8624,7 +8642,7 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
8624
8642
|
function s() {
|
|
8625
8643
|
return t.some((i)=>i.alive);
|
|
8626
8644
|
}
|
|
8627
|
-
return Object.defineProperty(t,
|
|
8645
|
+
return Object.defineProperty(t, st, {
|
|
8628
8646
|
configurable: !0,
|
|
8629
8647
|
enumerable: !1,
|
|
8630
8648
|
value: e
|
|
@@ -8638,28 +8656,28 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
8638
8656
|
get: s
|
|
8639
8657
|
}), t;
|
|
8640
8658
|
}
|
|
8641
|
-
function
|
|
8659
|
+
function Be(n) {
|
|
8642
8660
|
return !!(n && (typeof n == "object" || typeof n == "function") && "alive" in n && typeof n.alive == "boolean" && "dispose" in n && typeof n.dispose == "function");
|
|
8643
8661
|
}
|
|
8644
|
-
var
|
|
8662
|
+
var dt = class on extends ae {
|
|
8645
8663
|
static success(t) {
|
|
8646
|
-
return new
|
|
8664
|
+
return new oi(t);
|
|
8647
8665
|
}
|
|
8648
8666
|
static fail(t, e) {
|
|
8649
|
-
return new
|
|
8667
|
+
return new ai(t, e);
|
|
8650
8668
|
}
|
|
8651
8669
|
static is(t) {
|
|
8652
|
-
return t instanceof
|
|
8670
|
+
return t instanceof on;
|
|
8653
8671
|
}
|
|
8654
|
-
},
|
|
8672
|
+
}, oi = class extends dt {
|
|
8655
8673
|
constructor(n){
|
|
8656
8674
|
super(), this.value = n;
|
|
8657
8675
|
}
|
|
8658
8676
|
get alive() {
|
|
8659
|
-
return
|
|
8677
|
+
return Be(this.value) ? this.value.alive : !0;
|
|
8660
8678
|
}
|
|
8661
8679
|
dispose() {
|
|
8662
|
-
|
|
8680
|
+
Be(this.value) && this.value.dispose();
|
|
8663
8681
|
}
|
|
8664
8682
|
unwrap() {
|
|
8665
8683
|
return this.value;
|
|
@@ -8667,15 +8685,15 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
8667
8685
|
unwrapOr(n) {
|
|
8668
8686
|
return this.value;
|
|
8669
8687
|
}
|
|
8670
|
-
},
|
|
8688
|
+
}, ai = class extends dt {
|
|
8671
8689
|
constructor(n, t){
|
|
8672
8690
|
super(), this.error = n, this.onUnwrap = t;
|
|
8673
8691
|
}
|
|
8674
8692
|
get alive() {
|
|
8675
|
-
return
|
|
8693
|
+
return Be(this.error) ? this.error.alive : !0;
|
|
8676
8694
|
}
|
|
8677
8695
|
dispose() {
|
|
8678
|
-
|
|
8696
|
+
Be(this.error) && this.error.dispose();
|
|
8679
8697
|
}
|
|
8680
8698
|
unwrap() {
|
|
8681
8699
|
throw this.onUnwrap(this), this.error;
|
|
@@ -8683,7 +8701,7 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
8683
8701
|
unwrapOr(n) {
|
|
8684
8702
|
return n;
|
|
8685
8703
|
}
|
|
8686
|
-
}, me =
|
|
8704
|
+
}, me = dt, di = class extends ae {
|
|
8687
8705
|
constructor(n){
|
|
8688
8706
|
super(), this.resolve = (t)=>{
|
|
8689
8707
|
this.resolveHandle.alive && (this.context.unwrapResult(this.context.callFunction(this.resolveHandle, this.context.undefined, t || this.context.undefined)).dispose(), this.disposeResolvers(), this.onSettled());
|
|
@@ -8701,7 +8719,7 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
8701
8719
|
disposeResolvers() {
|
|
8702
8720
|
this.resolveHandle.alive && this.resolveHandle.dispose(), this.rejectHandle.alive && this.rejectHandle.dispose();
|
|
8703
8721
|
}
|
|
8704
|
-
},
|
|
8722
|
+
}, an = class {
|
|
8705
8723
|
constructor(n){
|
|
8706
8724
|
this.module = n;
|
|
8707
8725
|
}
|
|
@@ -8738,34 +8756,34 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
8738
8756
|
return this.module._free(n), t;
|
|
8739
8757
|
}
|
|
8740
8758
|
};
|
|
8741
|
-
function
|
|
8759
|
+
function ci(n) {
|
|
8742
8760
|
if (!n) return 0;
|
|
8743
8761
|
let t = 0;
|
|
8744
8762
|
for (let [e, s] of Object.entries(n)){
|
|
8745
|
-
if (!(e in
|
|
8746
|
-
s && (t |=
|
|
8763
|
+
if (!(e in Pt)) throw new en(e);
|
|
8764
|
+
s && (t |= Pt[e]);
|
|
8747
8765
|
}
|
|
8748
8766
|
return t;
|
|
8749
8767
|
}
|
|
8750
|
-
function
|
|
8768
|
+
function li(n) {
|
|
8751
8769
|
if (typeof n == "number") return n;
|
|
8752
8770
|
if (n === void 0) return 0;
|
|
8753
8771
|
let { type: t, strict: e, strip: s, compileOnly: i, backtraceBarrier: r } = n, o = 0;
|
|
8754
8772
|
return t === "global" && (o |= he.JS_EVAL_TYPE_GLOBAL), t === "module" && (o |= he.JS_EVAL_TYPE_MODULE), e && (o |= he.JS_EVAL_FLAG_STRICT), s && (o |= he.JS_EVAL_FLAG_STRIP), i && (o |= he.JS_EVAL_FLAG_COMPILE_ONLY), r && (o |= he.JS_EVAL_FLAG_BACKTRACE_BARRIER), o;
|
|
8755
8773
|
}
|
|
8756
|
-
function
|
|
8774
|
+
function ui(n) {
|
|
8757
8775
|
if (typeof n == "number") return n;
|
|
8758
8776
|
if (n === void 0) return 0;
|
|
8759
8777
|
let { strings: t, symbols: e, quickjsPrivate: s, onlyEnumerable: i, numbers: r, numbersAsStrings: o } = n, a = 0;
|
|
8760
8778
|
return t && (a |= pe.JS_GPN_STRING_MASK), e && (a |= pe.JS_GPN_SYMBOL_MASK), s && (a |= pe.JS_GPN_PRIVATE_MASK), i && (a |= pe.JS_GPN_ENUM_ONLY), r && (a |= pe.QTS_GPN_NUMBER_MASK), o && (a |= pe.QTS_STANDARD_COMPLIANT_NUMBER), a;
|
|
8761
8779
|
}
|
|
8762
|
-
function
|
|
8780
|
+
function hi(...n) {
|
|
8763
8781
|
let t = [];
|
|
8764
8782
|
for (let e of n)e !== void 0 && (t = t.concat(e));
|
|
8765
8783
|
return t;
|
|
8766
8784
|
}
|
|
8767
|
-
let
|
|
8768
|
-
|
|
8785
|
+
let pi, fi, mi, yi, Ii;
|
|
8786
|
+
pi = class extends ae {
|
|
8769
8787
|
constructor(n, t){
|
|
8770
8788
|
super(), this.handle = n, this.context = t, this._isDone = !1, this.owner = t.runtime;
|
|
8771
8789
|
}
|
|
@@ -8824,7 +8842,7 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
8824
8842
|
};
|
|
8825
8843
|
}
|
|
8826
8844
|
};
|
|
8827
|
-
|
|
8845
|
+
fi = class extends an {
|
|
8828
8846
|
constructor(n){
|
|
8829
8847
|
super(n.module), this.scope = new se, this.copyJSValue = (t)=>this.ffi.QTS_DupValuePointer(this.ctx.value, t), this.freeJSValue = (t)=>{
|
|
8830
8848
|
this.ffi.QTS_FreeValuePointer(this.ctx.value, t);
|
|
@@ -8853,7 +8871,7 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
8853
8871
|
return this.manage(this.heapValueHandle(n)), new ce(n, this.owner);
|
|
8854
8872
|
}
|
|
8855
8873
|
};
|
|
8856
|
-
|
|
8874
|
+
mi = class extends ae {
|
|
8857
8875
|
constructor(n){
|
|
8858
8876
|
super(), this._undefined = void 0, this._null = void 0, this._false = void 0, this._true = void 0, this._global = void 0, this._BigInt = void 0, this._Symbol = void 0, this._SymbolIterator = void 0, this._SymbolAsyncIterator = void 0, this.fnNextId = -32768, this.fnMaps = new Map, this.cToHostCallbacks = {
|
|
8859
8877
|
callFunction: (t, e, s, i, r)=>{
|
|
@@ -8861,10 +8879,10 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
8861
8879
|
let o = this.getFunction(r);
|
|
8862
8880
|
if (!o) throw new Error(`QuickJSContext had no callback with id ${r}`);
|
|
8863
8881
|
return se.withScopeMaybeAsync(this, function*(a, d) {
|
|
8864
|
-
let c = d.manage(new
|
|
8882
|
+
let c = d.manage(new Rt(e, this.memory.copyJSValue, this.memory.freeJSValue, this.runtime)), l = new Array(s);
|
|
8865
8883
|
for(let u = 0; u < s; u++){
|
|
8866
8884
|
let p = this.ffi.QTS_ArgvGetJSValueConstPointer(i, u);
|
|
8867
|
-
l[u] = d.manage(new
|
|
8885
|
+
l[u] = d.manage(new Rt(p, this.memory.copyJSValue, this.memory.freeJSValue, this.runtime));
|
|
8868
8886
|
}
|
|
8869
8887
|
try {
|
|
8870
8888
|
let u = yield* a(o.apply(c, l));
|
|
@@ -8879,7 +8897,7 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
8879
8897
|
}
|
|
8880
8898
|
});
|
|
8881
8899
|
}
|
|
8882
|
-
}, this.runtime = n.runtime, this.module = n.module, this.ffi = n.ffi, this.rt = n.rt, this.ctx = n.ctx, this.memory = new
|
|
8900
|
+
}, this.runtime = n.runtime, this.module = n.module, this.ffi = n.ffi, this.rt = n.rt, this.ctx = n.ctx, this.memory = new fi({
|
|
8883
8901
|
...n,
|
|
8884
8902
|
owner: this.runtime
|
|
8885
8903
|
}), n.callbacks.setContextCallbacks(this.ctx.value, this.cToHostCallbacks), this.dump = this.dump.bind(this), this.getString = this.getString.bind(this), this.getNumber = this.getNumber.bind(this), this.resolvePromise = this.resolvePromise.bind(this), this.uint32Out = this.memory.manage(this.memory.newTypedArray(Uint32Array, 1));
|
|
@@ -8957,7 +8975,7 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
8957
8975
|
newPromise(n) {
|
|
8958
8976
|
let t = se.withScope((e)=>{
|
|
8959
8977
|
let s = e.manage(this.memory.newMutablePointerArray(2)), i = this.ffi.QTS_NewPromiseCapability(this.ctx.value, s.value.ptr), r = this.memory.heapValueHandle(i), [o, a] = Array.from(s.value.typedArray).map((d)=>this.memory.heapValueHandle(d));
|
|
8960
|
-
return new
|
|
8978
|
+
return new di({
|
|
8961
8979
|
context: this,
|
|
8962
8980
|
promiseHandle: r,
|
|
8963
8981
|
resolveHandle: o,
|
|
@@ -9007,18 +9025,18 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
9007
9025
|
value: n,
|
|
9008
9026
|
notAPromise: !0
|
|
9009
9027
|
};
|
|
9010
|
-
if (t ===
|
|
9028
|
+
if (t === Qe.Pending) return {
|
|
9011
9029
|
type: "pending",
|
|
9012
9030
|
get error () {
|
|
9013
|
-
return new
|
|
9031
|
+
return new tn("Cannot unwrap a pending promise");
|
|
9014
9032
|
}
|
|
9015
9033
|
};
|
|
9016
9034
|
let e = this.ffi.QTS_PromiseResult(this.ctx.value, n.value), s = this.memory.heapValueHandle(e);
|
|
9017
|
-
if (t ===
|
|
9035
|
+
if (t === Qe.Fulfilled) return {
|
|
9018
9036
|
type: "fulfilled",
|
|
9019
9037
|
value: s
|
|
9020
9038
|
};
|
|
9021
|
-
if (t ===
|
|
9039
|
+
if (t === Qe.Rejected) return {
|
|
9022
9040
|
type: "rejected",
|
|
9023
9041
|
error: s
|
|
9024
9042
|
};
|
|
@@ -9041,21 +9059,21 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
9041
9059
|
});
|
|
9042
9060
|
});
|
|
9043
9061
|
}
|
|
9044
|
-
isEqual(n, t, e =
|
|
9062
|
+
isEqual(n, t, e = Oe.IsStrictlyEqual) {
|
|
9045
9063
|
if (n === t) return !0;
|
|
9046
9064
|
this.runtime.assertOwned(n), this.runtime.assertOwned(t);
|
|
9047
9065
|
let s = this.ffi.QTS_IsEqual(this.ctx.value, n.value, t.value, e);
|
|
9048
|
-
if (s === -1) throw new
|
|
9066
|
+
if (s === -1) throw new Yt("WASM variant does not expose equality");
|
|
9049
9067
|
return !!s;
|
|
9050
9068
|
}
|
|
9051
9069
|
eq(n, t) {
|
|
9052
|
-
return this.isEqual(n, t,
|
|
9070
|
+
return this.isEqual(n, t, Oe.IsStrictlyEqual);
|
|
9053
9071
|
}
|
|
9054
9072
|
sameValue(n, t) {
|
|
9055
|
-
return this.isEqual(n, t,
|
|
9073
|
+
return this.isEqual(n, t, Oe.IsSameValue);
|
|
9056
9074
|
}
|
|
9057
9075
|
sameValueZero(n, t) {
|
|
9058
|
-
return this.isEqual(n, t,
|
|
9076
|
+
return this.isEqual(n, t, Oe.IsSameValueZero);
|
|
9059
9077
|
}
|
|
9060
9078
|
getProp(n, t) {
|
|
9061
9079
|
this.runtime.assertOwned(n);
|
|
@@ -9070,20 +9088,20 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
9070
9088
|
numbersAsStrings: !0
|
|
9071
9089
|
}) {
|
|
9072
9090
|
this.runtime.assertOwned(n), n.value;
|
|
9073
|
-
let e =
|
|
9074
|
-
if (e === 0) throw new
|
|
9091
|
+
let e = ui(t);
|
|
9092
|
+
if (e === 0) throw new nn("No options set, will return an empty array");
|
|
9075
9093
|
return se.withScope((s)=>{
|
|
9076
9094
|
let i = s.manage(this.memory.newMutablePointerArray(1)), r = this.ffi.QTS_GetOwnPropertyNames(this.ctx.value, i.value.ptr, this.uint32Out.value.ptr, n.value, e);
|
|
9077
9095
|
if (r) return this.fail(this.memory.heapValueHandle(r));
|
|
9078
9096
|
let o = this.uint32Out.value.typedArray[0], a = i.value.typedArray[0], d = new Uint32Array(this.module.HEAP8.buffer, a, o), c = Array.from(d).map((l)=>this.memory.heapValueHandle(l));
|
|
9079
|
-
return this.ffi.QTS_FreeVoidPointer(this.ctx.value, a), this.success(
|
|
9097
|
+
return this.ffi.QTS_FreeVoidPointer(this.ctx.value, a), this.success(ri(c));
|
|
9080
9098
|
});
|
|
9081
9099
|
}
|
|
9082
9100
|
getIterator(n) {
|
|
9083
9101
|
let t = this._SymbolIterator ?? (this._SymbolIterator = this.memory.manage(this.getWellKnownSymbol("iterator")));
|
|
9084
9102
|
return se.withScope((e)=>{
|
|
9085
9103
|
let s = e.manage(this.getProp(n, t)), i = this.callFunction(s, n);
|
|
9086
|
-
return i.error ? i : this.success(new
|
|
9104
|
+
return i.error ? i : this.success(new pi(i.value, this));
|
|
9087
9105
|
});
|
|
9088
9106
|
}
|
|
9089
9107
|
setProp(n, t, e) {
|
|
@@ -9106,7 +9124,7 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
9106
9124
|
return this.getProp(n, t).consume((s)=>this.callFunction(s, n, e));
|
|
9107
9125
|
}
|
|
9108
9126
|
evalCode(n, t = "eval.js", e) {
|
|
9109
|
-
let s = e === void 0 ? 1 : 0, i =
|
|
9127
|
+
let s = e === void 0 ? 1 : 0, i = li(e), r = this.memory.newHeapCharPointer(n).consume((a)=>this.ffi.QTS_Eval(this.ctx.value, a.value.ptr, a.value.strlen, t, s, i)), o = this.ffi.QTS_ResolveException(this.ctx.value, r);
|
|
9110
9128
|
return o ? (this.ffi.QTS_FreeValuePointer(this.ctx.value, r), this.fail(this.memory.heapValueHandle(o))) : this.success(this.memory.heapValueHandle(r));
|
|
9111
9129
|
}
|
|
9112
9130
|
throw(n) {
|
|
@@ -9150,13 +9168,13 @@ Lifetime used`) : new tt("Lifetime not alive");
|
|
|
9150
9168
|
if (n.error) {
|
|
9151
9169
|
let t = "context" in n.error ? n.error.context : this, e = n.error.consume((s)=>this.dump(s));
|
|
9152
9170
|
if (e && typeof e == "object" && typeof e.message == "string") {
|
|
9153
|
-
let { message: s, name: i, stack: r, ...o } = e, a = new
|
|
9171
|
+
let { message: s, name: i, stack: r, ...o } = e, a = new tt(e, t);
|
|
9154
9172
|
typeof i == "string" && (a.name = e.name), a.message = s;
|
|
9155
9173
|
let d = a.stack;
|
|
9156
9174
|
throw typeof r == "string" && (a.stack = `${i}: ${s}
|
|
9157
9175
|
${e.stack}Host: ${d}`), Object.assign(a, o), a;
|
|
9158
9176
|
}
|
|
9159
|
-
throw new
|
|
9177
|
+
throw new tt(e);
|
|
9160
9178
|
}
|
|
9161
9179
|
return n.value;
|
|
9162
9180
|
}
|
|
@@ -9189,7 +9207,7 @@ ${e.stack}Host: ${d}`), Object.assign(a, o), a;
|
|
|
9189
9207
|
return me.fail(n, (t)=>this.unwrapResult(t));
|
|
9190
9208
|
}
|
|
9191
9209
|
};
|
|
9192
|
-
|
|
9210
|
+
yi = class extends ae {
|
|
9193
9211
|
constructor(n){
|
|
9194
9212
|
super(), this.scope = new se, this.contextMap = new Map, this._debugMode = !1, this.cToHostCallbacks = {
|
|
9195
9213
|
shouldInterrupt: (t)=>{
|
|
@@ -9198,7 +9216,7 @@ ${e.stack}Host: ${d}`), Object.assign(a, o), a;
|
|
|
9198
9216
|
if (!e) throw new Error("QuickJSContext had no interrupt handler");
|
|
9199
9217
|
return e(this) ? 1 : 0;
|
|
9200
9218
|
},
|
|
9201
|
-
loadModuleSource:
|
|
9219
|
+
loadModuleSource: xt(this, function*(t, e, s, i) {
|
|
9202
9220
|
let r = this.moduleLoader;
|
|
9203
9221
|
if (!r) throw new Error("Runtime has no module loader");
|
|
9204
9222
|
if (e !== this.rt.value) throw new Error("Runtime pointer mismatch");
|
|
@@ -9214,7 +9232,7 @@ ${e.stack}Host: ${d}`), Object.assign(a, o), a;
|
|
|
9214
9232
|
return this.debugLog("cToHostLoadModule: caught error", a), o.throw(a), 0;
|
|
9215
9233
|
}
|
|
9216
9234
|
}),
|
|
9217
|
-
normalizeModule:
|
|
9235
|
+
normalizeModule: xt(this, function*(t, e, s, i, r) {
|
|
9218
9236
|
let o = this.moduleNormalizer;
|
|
9219
9237
|
if (!o) throw new Error("Runtime has no module normalizer");
|
|
9220
9238
|
if (e !== this.rt.value) throw new Error("Runtime pointer mismatch");
|
|
@@ -9230,7 +9248,7 @@ ${e.stack}Host: ${d}`), Object.assign(a, o), a;
|
|
|
9230
9248
|
return this.debugLog("normalizeModule: caught error", d), a.throw(d), 0;
|
|
9231
9249
|
}
|
|
9232
9250
|
})
|
|
9233
|
-
}, n.ownedLifetimes?.forEach((t)=>this.scope.manage(t)), this.module = n.module, this.memory = new
|
|
9251
|
+
}, n.ownedLifetimes?.forEach((t)=>this.scope.manage(t)), this.module = n.module, this.memory = new an(this.module), this.ffi = n.ffi, this.rt = n.rt, this.callbacks = n.callbacks, this.scope.manage(this.rt), this.callbacks.setRuntimeCallbacks(this.rt.value, this.cToHostCallbacks), this.executePendingJobs = this.executePendingJobs.bind(this);
|
|
9234
9252
|
}
|
|
9235
9253
|
get alive() {
|
|
9236
9254
|
return this.scope.alive;
|
|
@@ -9239,9 +9257,9 @@ ${e.stack}Host: ${d}`), Object.assign(a, o), a;
|
|
|
9239
9257
|
return this.scope.dispose();
|
|
9240
9258
|
}
|
|
9241
9259
|
newContext(n = {}) {
|
|
9242
|
-
let t =
|
|
9260
|
+
let t = ci(n.intrinsics), e = new q(n.contextPointer || this.ffi.QTS_NewContext(this.rt.value, t), void 0, (i)=>{
|
|
9243
9261
|
this.contextMap.delete(i), this.callbacks.deleteContext(i), this.ffi.QTS_FreeContext(i);
|
|
9244
|
-
}), s = new
|
|
9262
|
+
}), s = new mi({
|
|
9245
9263
|
module: this.module,
|
|
9246
9264
|
ctx: e,
|
|
9247
9265
|
ffi: this.ffi,
|
|
@@ -9300,7 +9318,7 @@ ${e.stack}Host: ${d}`), Object.assign(a, o), a;
|
|
|
9300
9318
|
this.ffi.QTS_RuntimeSetMaxStackSize(this.rt.value, n);
|
|
9301
9319
|
}
|
|
9302
9320
|
assertOwned(n) {
|
|
9303
|
-
if (n.owner && n.owner.rt !== this.rt) throw new
|
|
9321
|
+
if (n.owner && n.owner.rt !== this.rt) throw new zt(`Handle is not owned by this runtime: ${n.owner.rt.value} != ${this.rt.value}`);
|
|
9304
9322
|
}
|
|
9305
9323
|
setDebugMode(n) {
|
|
9306
9324
|
this._debugMode = n, this.ffi.DEBUG && this.rt.alive && this.ffi.QTS_SetDebugLogEnabled(this.rt.value, n ? 1 : 0);
|
|
@@ -9318,14 +9336,14 @@ ${e.stack}Host: ${d}`), Object.assign(a, o), a;
|
|
|
9318
9336
|
return this.context || (this.context = this.scope.manage(this.newContext())), this.context;
|
|
9319
9337
|
}
|
|
9320
9338
|
};
|
|
9321
|
-
|
|
9339
|
+
Ii = class {
|
|
9322
9340
|
constructor(n){
|
|
9323
9341
|
this.callFunction = n.callFunction, this.shouldInterrupt = n.shouldInterrupt, this.loadModuleSource = n.loadModuleSource, this.normalizeModule = n.normalizeModule;
|
|
9324
9342
|
}
|
|
9325
9343
|
};
|
|
9326
|
-
|
|
9344
|
+
gi = class {
|
|
9327
9345
|
constructor(n){
|
|
9328
|
-
this.contextCallbacks = new Map, this.runtimeCallbacks = new Map, this.suspendedCount = 0, this.cToHostCallbacks = new
|
|
9346
|
+
this.contextCallbacks = new Map, this.runtimeCallbacks = new Map, this.suspendedCount = 0, this.cToHostCallbacks = new Ii({
|
|
9329
9347
|
callFunction: (t, e, s, i, r, o)=>this.handleAsyncify(t, ()=>{
|
|
9330
9348
|
try {
|
|
9331
9349
|
let a = this.contextCallbacks.get(e);
|
|
@@ -9385,15 +9403,15 @@ ${e.stack}Host: ${d}`), Object.assign(a, o), a;
|
|
|
9385
9403
|
try {
|
|
9386
9404
|
let i = t();
|
|
9387
9405
|
if (!(i instanceof Promise)) {
|
|
9388
|
-
|
|
9406
|
+
Le("asyncify.handleSleep: not suspending:", i), s(i);
|
|
9389
9407
|
return;
|
|
9390
9408
|
}
|
|
9391
|
-
if (this.suspended) throw new
|
|
9409
|
+
if (this.suspended) throw new Xt(`Already suspended at: ${this.suspended.stack}
|
|
9392
9410
|
Attempted to suspend at:`);
|
|
9393
|
-
this.suspended = new
|
|
9394
|
-
this.suspended = void 0,
|
|
9411
|
+
this.suspended = new Zt(`(${this.suspendedCount++})`), Le("asyncify.handleSleep: suspending:", this.suspended), i.then((r)=>{
|
|
9412
|
+
this.suspended = void 0, Le("asyncify.handleSleep: resolved:", r), s(r);
|
|
9395
9413
|
}, (r)=>{
|
|
9396
|
-
|
|
9414
|
+
Le("asyncify.handleSleep: rejected:", r), console.error("QuickJS: cannot handle error in suspended function", r), this.suspended = void 0;
|
|
9397
9415
|
});
|
|
9398
9416
|
} catch (i) {
|
|
9399
9417
|
throw this.suspended = void 0, i;
|
|
@@ -9404,38 +9422,38 @@ Attempted to suspend at:`);
|
|
|
9404
9422
|
return e;
|
|
9405
9423
|
}
|
|
9406
9424
|
};
|
|
9407
|
-
|
|
9425
|
+
bi = function(n, t) {
|
|
9408
9426
|
t.interruptHandler && n.setInterruptHandler(t.interruptHandler), t.maxStackSizeBytes !== void 0 && n.setMaxStackSize(t.maxStackSizeBytes), t.memoryLimitBytes !== void 0 && n.setMemoryLimit(t.memoryLimitBytes);
|
|
9409
9427
|
};
|
|
9410
|
-
|
|
9428
|
+
Si = function(n, t) {
|
|
9411
9429
|
t.moduleLoader && n.setModuleLoader(t.moduleLoader), t.shouldInterrupt && n.setInterruptHandler(t.shouldInterrupt), t.memoryLimitBytes !== void 0 && n.setMemoryLimit(t.memoryLimitBytes), t.maxStackSizeBytes !== void 0 && n.setMaxStackSize(t.maxStackSizeBytes);
|
|
9412
9430
|
};
|
|
9413
|
-
|
|
9431
|
+
tr = class {
|
|
9414
9432
|
constructor(n, t){
|
|
9415
|
-
this.module = n, this.ffi = t, this.callbacks = new
|
|
9433
|
+
this.module = n, this.ffi = t, this.callbacks = new gi(n);
|
|
9416
9434
|
}
|
|
9417
9435
|
newRuntime(n = {}) {
|
|
9418
9436
|
let t = new q(this.ffi.QTS_NewRuntime(), void 0, (s)=>{
|
|
9419
9437
|
this.callbacks.deleteRuntime(s), this.ffi.QTS_FreeRuntime(s);
|
|
9420
|
-
}), e = new
|
|
9438
|
+
}), e = new yi({
|
|
9421
9439
|
module: this.module,
|
|
9422
9440
|
callbacks: this.callbacks,
|
|
9423
9441
|
ffi: this.ffi,
|
|
9424
9442
|
rt: t
|
|
9425
9443
|
});
|
|
9426
|
-
return
|
|
9444
|
+
return bi(e, n), n.moduleLoader && e.setModuleLoader(n.moduleLoader), e;
|
|
9427
9445
|
}
|
|
9428
9446
|
newContext(n = {}) {
|
|
9429
9447
|
let t = this.newRuntime(), e = t.newContext({
|
|
9430
9448
|
...n,
|
|
9431
|
-
ownedLifetimes:
|
|
9449
|
+
ownedLifetimes: hi(t, n.ownedLifetimes)
|
|
9432
9450
|
});
|
|
9433
9451
|
return t.context = e, e;
|
|
9434
9452
|
}
|
|
9435
9453
|
evalCode(n, t = {}) {
|
|
9436
9454
|
return se.withScope((e)=>{
|
|
9437
9455
|
let s = e.manage(this.newContext());
|
|
9438
|
-
|
|
9456
|
+
Si(s.runtime, t);
|
|
9439
9457
|
let i = s.evalCode(n, "eval.js");
|
|
9440
9458
|
if (t.memoryLimitBytes !== void 0 && s.runtime.setMemoryLimit(-1), i.error) throw s.dump(e.manage(i.error));
|
|
9441
9459
|
return s.dump(e.manage(i.value));
|
|
@@ -9450,35 +9468,35 @@ Attempted to suspend at:`);
|
|
|
9450
9468
|
return this.ffi;
|
|
9451
9469
|
}
|
|
9452
9470
|
};
|
|
9453
|
-
async function
|
|
9454
|
-
let t =
|
|
9455
|
-
t.importModuleLoader().then(
|
|
9471
|
+
async function Ei(n) {
|
|
9472
|
+
let t = Je(await n), [e, s, { QuickJSWASMModule: i }] = await Promise.all([
|
|
9473
|
+
t.importModuleLoader().then(Je),
|
|
9456
9474
|
t.importFFI(),
|
|
9457
|
-
|
|
9475
|
+
Re(()=>import("./index-D8Epw-e7.js").then(async (m)=>{
|
|
9458
9476
|
await m.__tla;
|
|
9459
9477
|
return m;
|
|
9460
|
-
}).then((a)=>a.m), __vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).then(
|
|
9478
|
+
}).then((a)=>a.m), __vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(Je)
|
|
9461
9479
|
]), r = await e();
|
|
9462
9480
|
r.type = "sync";
|
|
9463
9481
|
let o = new s(r);
|
|
9464
9482
|
return new i(r, o);
|
|
9465
9483
|
}
|
|
9466
|
-
function
|
|
9484
|
+
function Je(n) {
|
|
9467
9485
|
return n && "default" in n && n.default ? n.default && "default" in n.default && n.default.default ? n.default.default : n.default : n;
|
|
9468
9486
|
}
|
|
9469
|
-
var
|
|
9487
|
+
var wi = {
|
|
9470
9488
|
type: "sync",
|
|
9471
|
-
importFFI: ()=>
|
|
9472
|
-
importModuleLoader: ()=>
|
|
9473
|
-
},
|
|
9474
|
-
async function
|
|
9475
|
-
return
|
|
9489
|
+
importFFI: ()=>Re(()=>import("./ffi-DlhRHxHv.js"), []).then((n)=>n.QuickJSFFI),
|
|
9490
|
+
importModuleLoader: ()=>Re(()=>import("./emscripten-module.browser-CY5t0Vfq.js"), []).then((n)=>n.default)
|
|
9491
|
+
}, Ti = wi;
|
|
9492
|
+
async function $i(n = Ti) {
|
|
9493
|
+
return Ei(n);
|
|
9476
9494
|
}
|
|
9477
|
-
var
|
|
9478
|
-
async function
|
|
9479
|
-
return
|
|
9495
|
+
var Ke;
|
|
9496
|
+
async function Pi() {
|
|
9497
|
+
return Ke ?? (Ke = $i().then((n)=>n)), await Ke;
|
|
9480
9498
|
}
|
|
9481
|
-
const
|
|
9499
|
+
const ct = {
|
|
9482
9500
|
model: !0,
|
|
9483
9501
|
query: !0,
|
|
9484
9502
|
viewer: !0,
|
|
@@ -9487,26 +9505,26 @@ Attempted to suspend at:`);
|
|
|
9487
9505
|
lens: !0,
|
|
9488
9506
|
export: !0,
|
|
9489
9507
|
files: !0
|
|
9490
|
-
},
|
|
9508
|
+
}, xe = {
|
|
9491
9509
|
memoryBytes: 64 * 1024 * 1024,
|
|
9492
9510
|
timeoutMs: 3e4,
|
|
9493
9511
|
maxStackBytes: 512 * 1024
|
|
9494
9512
|
};
|
|
9495
|
-
function
|
|
9513
|
+
function dn(n, t, e = {}, s) {
|
|
9496
9514
|
const i = {
|
|
9497
|
-
...
|
|
9515
|
+
...ct,
|
|
9498
9516
|
...e
|
|
9499
9517
|
}, r = [];
|
|
9500
|
-
|
|
9518
|
+
xi(n, r);
|
|
9501
9519
|
const o = n.newObject();
|
|
9502
|
-
return
|
|
9520
|
+
return Qs(n, o, t, i, s), n.setProp(n.global, "bim", o), o.dispose(), {
|
|
9503
9521
|
logs: r,
|
|
9504
9522
|
dispose: ()=>{
|
|
9505
|
-
|
|
9523
|
+
Js(s);
|
|
9506
9524
|
}
|
|
9507
9525
|
};
|
|
9508
9526
|
}
|
|
9509
|
-
function
|
|
9527
|
+
function xi(n, t) {
|
|
9510
9528
|
const e = n.newObject();
|
|
9511
9529
|
for (const s of [
|
|
9512
9530
|
"log",
|
|
@@ -9526,14 +9544,14 @@ Attempted to suspend at:`);
|
|
|
9526
9544
|
}
|
|
9527
9545
|
n.setProp(n.global, "console", e), e.dispose();
|
|
9528
9546
|
}
|
|
9529
|
-
let
|
|
9530
|
-
function
|
|
9531
|
-
return
|
|
9547
|
+
let ze = "esbuild", Me = !1, _e = null;
|
|
9548
|
+
function Ai() {
|
|
9549
|
+
return _e || (_e = (async ()=>{
|
|
9532
9550
|
try {
|
|
9533
|
-
const n = await
|
|
9551
|
+
const n = await Re(()=>import("./browser-C5TFR7sH.js").then((s)=>s.b), __vite__mapDeps([13,1,2,3])), t = n.default ?? n;
|
|
9534
9552
|
let e;
|
|
9535
9553
|
try {
|
|
9536
|
-
e = (await
|
|
9554
|
+
e = (await Re(()=>import("./esbuild-COv63sf-.js"), [])).default;
|
|
9537
9555
|
} catch {
|
|
9538
9556
|
e = "https://unpkg.com/esbuild-wasm@0.27.3/esbuild.wasm";
|
|
9539
9557
|
}
|
|
@@ -9544,34 +9562,34 @@ Attempted to suspend at:`);
|
|
|
9544
9562
|
} catch {
|
|
9545
9563
|
return null;
|
|
9546
9564
|
}
|
|
9547
|
-
})(),
|
|
9565
|
+
})(), _e);
|
|
9548
9566
|
}
|
|
9549
|
-
async function
|
|
9567
|
+
async function cn(n) {
|
|
9550
9568
|
let t;
|
|
9551
|
-
const e =
|
|
9569
|
+
const e = Ri(n);
|
|
9552
9570
|
try {
|
|
9553
|
-
const s = await
|
|
9571
|
+
const s = await Ai();
|
|
9554
9572
|
s ? (t = (await s.transform(n, {
|
|
9555
9573
|
loader: "ts",
|
|
9556
9574
|
target: "es2022"
|
|
9557
|
-
})).code,
|
|
9575
|
+
})).code, ze = "esbuild") : (t = e ? Dt(n) : n, ze = e ? "fallback-ts" : "fallback-js", Me || (Me = !0, console.warn("[ifc-lite/sandbox] esbuild unavailable, using fallback transpiler")));
|
|
9558
9576
|
} catch {
|
|
9559
|
-
t = e ?
|
|
9577
|
+
t = e ? Dt(n) : n, ze = e ? "fallback-ts" : "fallback-js", Me || (Me = !0, console.warn("[ifc-lite/sandbox] esbuild failed, using fallback transpiler"));
|
|
9560
9578
|
}
|
|
9561
|
-
return
|
|
9579
|
+
return Di(t);
|
|
9562
9580
|
}
|
|
9563
|
-
function
|
|
9581
|
+
function Ri(n) {
|
|
9564
9582
|
return /\binterface\s+\w+/.test(n) || /\btype\s+\w+\s*=/.test(n) || /\b(?:as)\s+[A-Za-z_]\w*(?:\[\])?/.test(n) || /\b(?:const|let|var)\s+\w+\s*:\s*[A-Za-z_]/.test(n) || /\b(?:async\s+)?(?:function\s+\w+\s*)?\([^()]*\b\w+\s*:\s*[A-Za-z_][\w<>,\s[\]|]*\)\s*(?::\s*[A-Za-z_][\w<>,\s[\]|]*)?\s*(?:=>|\{)/.test(n) || /\([^)]*:\s*(?:string|number|boolean|void|any|unknown|never|Record<|Array<|Map<|Set<)/.test(n) || /\)\s*:\s*[A-Za-z_][\w<>,\s[\]|]*\s*\{/.test(n) || /\w<\w+(?:\s*,\s*\w+)*>\s*\(/.test(n);
|
|
9565
9583
|
}
|
|
9566
|
-
function
|
|
9584
|
+
function Di(n) {
|
|
9567
9585
|
let t = n;
|
|
9568
9586
|
return t = t.replace(/^\s*import\s+(?:(?:\{[^}]*\}|\*\s+as\s+\w+|\w+)(?:\s*,\s*(?:\{[^}]*\}|\*\s+as\s+\w+|\w+))*\s+from\s+)?['"][^'"]*['"];?\s*$/gm, ""), t = t.replace(/^\s*export\s+(default\s+)?(const|let|var|function|class|async\s+function)\s/gm, "$2 "), t = t.replace(/^\s*export\s+default\s+/gm, ""), t = t.replace(/^\s*export\s+\{[^}]*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?\s*$/gm, ""), t;
|
|
9569
9587
|
}
|
|
9570
|
-
function
|
|
9588
|
+
function Dt(n) {
|
|
9571
9589
|
let t = n;
|
|
9572
|
-
return t = t.replace(/^\s*(?:export\s+)?interface\s+\w+[^{]*\{[^}]*\}/gm, ""), t = t.replace(/^\s*(?:export\s+)?type\s+\w+\s*=\s*[^;]+;/gm, ""), t =
|
|
9590
|
+
return t = t.replace(/^\s*(?:export\s+)?interface\s+\w+[^{]*\{[^}]*\}/gm, ""), t = t.replace(/^\s*(?:export\s+)?type\s+\w+\s*=\s*[^;]+;/gm, ""), t = Ci(t), t = t.replace(/([,(]\s*)(\w+)\s*:\s*(?:string|number|boolean|void|any|unknown|never|null|undefined|Record<[^>]+>|Array<[^>]+>|Map<[^>]+>|Set<[^>]+>|\[[^\]]*\](?:\[\])?|[A-Za-z_]\w*(?:\[\])?(?:\s*\|\s*(?:string|number|boolean|null|undefined|[A-Za-z_]\w*))*)\s*(?=[,)])/g, "$1$2"), t = t.replace(/\):\s*[^{]+\{/g, ") {"), t = t.replace(/(?<![{,]\s*\w+\s)\s+as\s+\w+(?:\[\])?/g, ""), t = t.replace(/<\w+(?:\s+extends\s+\w+)?>/g, ""), t;
|
|
9573
9591
|
}
|
|
9574
|
-
function
|
|
9592
|
+
function Ci(n) {
|
|
9575
9593
|
const t = n.split(`
|
|
9576
9594
|
`);
|
|
9577
9595
|
for(let e = 0; e < t.length; e++){
|
|
@@ -9594,23 +9612,23 @@ Attempted to suspend at:`);
|
|
|
9594
9612
|
return t.join(`
|
|
9595
9613
|
`);
|
|
9596
9614
|
}
|
|
9597
|
-
let
|
|
9598
|
-
function
|
|
9599
|
-
return
|
|
9615
|
+
let Ye = null, Ct = 1;
|
|
9616
|
+
function vi() {
|
|
9617
|
+
return Ye || (Ye = Pi()), Ye;
|
|
9600
9618
|
}
|
|
9601
|
-
function
|
|
9602
|
-
const n =
|
|
9603
|
-
return
|
|
9619
|
+
function Ni() {
|
|
9620
|
+
const n = Ct;
|
|
9621
|
+
return Ct += 1, `sandbox-${n}`;
|
|
9604
9622
|
}
|
|
9605
|
-
class
|
|
9623
|
+
class ln {
|
|
9606
9624
|
constructor(t, e = {}){
|
|
9607
9625
|
this.sdk = t, this.config = {
|
|
9608
9626
|
permissions: {
|
|
9609
|
-
...
|
|
9627
|
+
...ct,
|
|
9610
9628
|
...e.permissions
|
|
9611
9629
|
},
|
|
9612
9630
|
limits: {
|
|
9613
|
-
...
|
|
9631
|
+
...xe,
|
|
9614
9632
|
...e.limits
|
|
9615
9633
|
}
|
|
9616
9634
|
};
|
|
@@ -9621,13 +9639,13 @@ Attempted to suspend at:`);
|
|
|
9621
9639
|
config;
|
|
9622
9640
|
bridgeDispose = null;
|
|
9623
9641
|
evalStartTime = 0;
|
|
9624
|
-
sessionId =
|
|
9642
|
+
sessionId = Ni();
|
|
9625
9643
|
async init() {
|
|
9626
|
-
const t = await
|
|
9627
|
-
this.runtime = t.newRuntime(), this.runtime.setMemoryLimit(this.config.limits.memoryBytes ??
|
|
9628
|
-
const e = this.config.limits.timeoutMs ??
|
|
9644
|
+
const t = await vi();
|
|
9645
|
+
this.runtime = t.newRuntime(), this.runtime.setMemoryLimit(this.config.limits.memoryBytes ?? xe.memoryBytes), this.runtime.setMaxStackSize(this.config.limits.maxStackBytes ?? xe.maxStackBytes);
|
|
9646
|
+
const e = this.config.limits.timeoutMs ?? xe.timeoutMs;
|
|
9629
9647
|
this.runtime.setInterruptHandler(()=>this.evalStartTime > 0 && Date.now() - this.evalStartTime > e), this.vm = this.runtime.newContext();
|
|
9630
|
-
const { logs: s, dispose: i } =
|
|
9648
|
+
const { logs: s, dispose: i } = dn(this.vm, this.sdk, this.config.permissions, {
|
|
9631
9649
|
sandboxSessionId: this.sessionId
|
|
9632
9650
|
});
|
|
9633
9651
|
this.logs = s, this.bridgeDispose = i;
|
|
@@ -9636,11 +9654,11 @@ Attempted to suspend at:`);
|
|
|
9636
9654
|
if (!this.vm) throw new Error("Sandbox not initialized. Call init() first.");
|
|
9637
9655
|
this.logs.length = 0;
|
|
9638
9656
|
let s = t;
|
|
9639
|
-
e?.typescript !== !1 && (s = await
|
|
9657
|
+
e?.typescript !== !1 && (s = await cn(t)), this.evalStartTime = Date.now();
|
|
9640
9658
|
const i = this.vm.evalCode(s, e?.filename ?? "script.js"), r = Date.now() - this.evalStartTime;
|
|
9641
9659
|
if (this.evalStartTime = 0, i.error) {
|
|
9642
9660
|
const a = this.vm.dump(i.error);
|
|
9643
|
-
throw i.error.dispose(), new
|
|
9661
|
+
throw i.error.dispose(), new un(typeof a == "object" && a !== null && "message" in a ? String(a.message) : String(a), this.logs, r);
|
|
9644
9662
|
}
|
|
9645
9663
|
const o = this.vm.dump(i.value);
|
|
9646
9664
|
return i.value.dispose(), {
|
|
@@ -9655,28 +9673,28 @@ Attempted to suspend at:`);
|
|
|
9655
9673
|
this.bridgeDispose && (this.bridgeDispose(), this.bridgeDispose = null), this.vm && (this.vm.dispose(), this.vm = null), this.runtime && (this.runtime.dispose(), this.runtime = null);
|
|
9656
9674
|
}
|
|
9657
9675
|
}
|
|
9658
|
-
class
|
|
9676
|
+
class un extends Error {
|
|
9659
9677
|
constructor(t, e, s){
|
|
9660
9678
|
super(t), this.logs = e, this.durationMs = s, this.name = "ScriptError";
|
|
9661
9679
|
}
|
|
9662
9680
|
}
|
|
9663
|
-
async function
|
|
9664
|
-
const e = new
|
|
9681
|
+
async function ki(n, t) {
|
|
9682
|
+
const e = new ln(n, t);
|
|
9665
9683
|
return await e.init(), e;
|
|
9666
9684
|
}
|
|
9667
|
-
|
|
9685
|
+
nr = Object.freeze(Object.defineProperty({
|
|
9668
9686
|
__proto__: null,
|
|
9669
|
-
DEFAULT_LIMITS:
|
|
9670
|
-
DEFAULT_PERMISSIONS:
|
|
9671
|
-
NAMESPACE_SCHEMAS:
|
|
9672
|
-
Sandbox:
|
|
9673
|
-
ScriptError:
|
|
9674
|
-
buildBridge:
|
|
9675
|
-
createSandbox:
|
|
9676
|
-
marshalValue:
|
|
9677
|
-
transpileTypeScript:
|
|
9687
|
+
DEFAULT_LIMITS: xe,
|
|
9688
|
+
DEFAULT_PERMISSIONS: ct,
|
|
9689
|
+
NAMESPACE_SCHEMAS: Jt,
|
|
9690
|
+
Sandbox: ln,
|
|
9691
|
+
ScriptError: un,
|
|
9692
|
+
buildBridge: dn,
|
|
9693
|
+
createSandbox: ki,
|
|
9694
|
+
marshalValue: Kt,
|
|
9695
|
+
transpileTypeScript: cn
|
|
9678
9696
|
}, Symbol.toStringTag, {
|
|
9679
9697
|
value: "Module"
|
|
9680
9698
|
}));
|
|
9681
9699
|
});
|
|
9682
|
-
export {
|
|
9700
|
+
export { Wi as B, Hi as C, Mi as M, Jt as N, gi as Q, _i as S, Ki as a, Ji as b, Vi as c, zi as d, An as e, Qi as f, Xi as g, qi as h, Ui as i, ji as j, Gi as k, vn as l, Bi as m, Zi as n, er as o, Ts as p, tr as q, Yi as r, bi as s, Si as t, nr as u, __tla };
|