@thatopen/services 0.32.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +65 -3
- package/dist/cli.js.map +1 -1
- package/dist/core/client.d.ts +16 -0
- package/dist/core/documents.d.ts +5 -0
- package/dist/index.cjs.js +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +948 -907
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Si = Object.defineProperty;
|
|
2
|
+
var Zs = (s) => {
|
|
3
3
|
throw TypeError(s);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var Rt = (s, t, e) =>
|
|
7
|
-
var g = (s, t, e) => (
|
|
5
|
+
var _i = (s, t, e) => t in s ? Si(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
6
|
+
var Rt = (s, t, e) => _i(s, typeof t != "symbol" ? t + "" : t, e), Mn = (s, t, e) => t.has(s) || Zs("Cannot " + e);
|
|
7
|
+
var g = (s, t, e) => (Mn(s, t, "read from private field"), e ? e.call(s) : t.get(s)), K = (s, t, e) => t.has(s) ? Zs("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, e), it = (s, t, e, n) => (Mn(s, t, "write to private field"), n ? n.call(s, e) : t.set(s, e), e), p = (s, t, e) => (Mn(s, t, "access private method"), e);
|
|
8
8
|
const ne = /* @__PURE__ */ Object.create(null);
|
|
9
9
|
ne.open = "0";
|
|
10
10
|
ne.close = "1";
|
|
@@ -13,63 +13,63 @@ ne.pong = "3";
|
|
|
13
13
|
ne.message = "4";
|
|
14
14
|
ne.upgrade = "5";
|
|
15
15
|
ne.noop = "6";
|
|
16
|
-
const
|
|
16
|
+
const yn = /* @__PURE__ */ Object.create(null);
|
|
17
17
|
Object.keys(ne).forEach((s) => {
|
|
18
|
-
|
|
18
|
+
yn[ne[s]] = s;
|
|
19
19
|
});
|
|
20
|
-
const
|
|
20
|
+
const Gn = { type: "error", data: "parser error" }, Or = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", $r = typeof ArrayBuffer == "function", xr = (s) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(s) : s && s.buffer instanceof ArrayBuffer, ps = ({ type: s, data: t }, e, n) => Or && t instanceof Blob ? e ? n(t) : tr(t, n) : $r && (t instanceof ArrayBuffer || xr(t)) ? e ? n(t) : tr(new Blob([t]), n) : n(ne[s] + (t || "")), tr = (s, t) => {
|
|
21
21
|
const e = new FileReader();
|
|
22
22
|
return e.onload = function() {
|
|
23
23
|
const n = e.result.split(",")[1];
|
|
24
24
|
t("b" + (n || ""));
|
|
25
25
|
}, e.readAsDataURL(s);
|
|
26
26
|
};
|
|
27
|
-
function
|
|
27
|
+
function er(s) {
|
|
28
28
|
return s instanceof Uint8Array ? s : s instanceof ArrayBuffer ? new Uint8Array(s) : new Uint8Array(s.buffer, s.byteOffset, s.byteLength);
|
|
29
29
|
}
|
|
30
|
-
let
|
|
31
|
-
function
|
|
32
|
-
if (
|
|
33
|
-
return s.data.arrayBuffer().then(
|
|
34
|
-
if (
|
|
35
|
-
return t(
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
let Fn;
|
|
31
|
+
function Ai(s, t) {
|
|
32
|
+
if (Or && s.data instanceof Blob)
|
|
33
|
+
return s.data.arrayBuffer().then(er).then(t);
|
|
34
|
+
if ($r && (s.data instanceof ArrayBuffer || xr(s.data)))
|
|
35
|
+
return t(er(s.data));
|
|
36
|
+
ps(s, !1, (e) => {
|
|
37
|
+
Fn || (Fn = new TextEncoder()), t(Fn.encode(e));
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
const
|
|
41
|
-
for (let s = 0; s <
|
|
42
|
-
|
|
43
|
-
const
|
|
40
|
+
const nr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ke = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
|
|
41
|
+
for (let s = 0; s < nr.length; s++)
|
|
42
|
+
Ke[nr.charCodeAt(s)] = s;
|
|
43
|
+
const Oi = (s) => {
|
|
44
44
|
let t = s.length * 0.75, e = s.length, n, r = 0, i, o, a, l;
|
|
45
45
|
s[s.length - 1] === "=" && (t--, s[s.length - 2] === "=" && t--);
|
|
46
46
|
const d = new ArrayBuffer(t), c = new Uint8Array(d);
|
|
47
47
|
for (n = 0; n < e; n += 4)
|
|
48
|
-
i =
|
|
48
|
+
i = Ke[s.charCodeAt(n)], o = Ke[s.charCodeAt(n + 1)], a = Ke[s.charCodeAt(n + 2)], l = Ke[s.charCodeAt(n + 3)], c[r++] = i << 2 | o >> 4, c[r++] = (o & 15) << 4 | a >> 2, c[r++] = (a & 3) << 6 | l & 63;
|
|
49
49
|
return d;
|
|
50
|
-
},
|
|
50
|
+
}, $i = typeof ArrayBuffer == "function", ms = (s, t) => {
|
|
51
51
|
if (typeof s != "string")
|
|
52
52
|
return {
|
|
53
53
|
type: "message",
|
|
54
|
-
data:
|
|
54
|
+
data: kr(s, t)
|
|
55
55
|
};
|
|
56
56
|
const e = s.charAt(0);
|
|
57
57
|
return e === "b" ? {
|
|
58
58
|
type: "message",
|
|
59
|
-
data:
|
|
60
|
-
} :
|
|
61
|
-
type:
|
|
59
|
+
data: xi(s.substring(1), t)
|
|
60
|
+
} : yn[e] ? s.length > 1 ? {
|
|
61
|
+
type: yn[e],
|
|
62
62
|
data: s.substring(1)
|
|
63
63
|
} : {
|
|
64
|
-
type:
|
|
65
|
-
} :
|
|
66
|
-
},
|
|
67
|
-
if (
|
|
68
|
-
const e =
|
|
69
|
-
return
|
|
64
|
+
type: yn[e]
|
|
65
|
+
} : Gn;
|
|
66
|
+
}, xi = (s, t) => {
|
|
67
|
+
if ($i) {
|
|
68
|
+
const e = Oi(s);
|
|
69
|
+
return kr(e, t);
|
|
70
70
|
} else
|
|
71
71
|
return { base64: !0, data: s };
|
|
72
|
-
},
|
|
72
|
+
}, kr = (s, t) => {
|
|
73
73
|
switch (t) {
|
|
74
74
|
case "blob":
|
|
75
75
|
return s instanceof Blob ? s : new Blob([s]);
|
|
@@ -77,27 +77,27 @@ const Ei = (s) => {
|
|
|
77
77
|
default:
|
|
78
78
|
return s instanceof ArrayBuffer ? s : s.buffer;
|
|
79
79
|
}
|
|
80
|
-
},
|
|
80
|
+
}, Cr = "", ki = (s, t) => {
|
|
81
81
|
const e = s.length, n = new Array(e);
|
|
82
82
|
let r = 0;
|
|
83
83
|
s.forEach((i, o) => {
|
|
84
|
-
|
|
85
|
-
n[o] = a, ++r === e && t(n.join(
|
|
84
|
+
ps(i, !1, (a) => {
|
|
85
|
+
n[o] = a, ++r === e && t(n.join(Cr));
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
|
-
},
|
|
89
|
-
const e = s.split(
|
|
88
|
+
}, Ci = (s, t) => {
|
|
89
|
+
const e = s.split(Cr), n = [];
|
|
90
90
|
for (let r = 0; r < e.length; r++) {
|
|
91
|
-
const i =
|
|
91
|
+
const i = ms(e[r], t);
|
|
92
92
|
if (n.push(i), i.type === "error")
|
|
93
93
|
break;
|
|
94
94
|
}
|
|
95
95
|
return n;
|
|
96
96
|
};
|
|
97
|
-
function
|
|
97
|
+
function Ri() {
|
|
98
98
|
return new TransformStream({
|
|
99
99
|
transform(s, t) {
|
|
100
|
-
|
|
100
|
+
Ai(s, (e) => {
|
|
101
101
|
const n = e.length;
|
|
102
102
|
let r;
|
|
103
103
|
if (n < 126)
|
|
@@ -116,11 +116,11 @@ function Oi() {
|
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
let
|
|
120
|
-
function
|
|
119
|
+
let Ln;
|
|
120
|
+
function pn(s) {
|
|
121
121
|
return s.reduce((t, e) => t + e.length, 0);
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function mn(s, t) {
|
|
124
124
|
if (s[0].length === t)
|
|
125
125
|
return s.shift();
|
|
126
126
|
const e = new Uint8Array(t);
|
|
@@ -129,51 +129,51 @@ function pn(s, t) {
|
|
|
129
129
|
e[r] = s[0][n++], n === s[0].length && (s.shift(), n = 0);
|
|
130
130
|
return s.length && n < s[0].length && (s[0] = s[0].slice(n)), e;
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
|
|
132
|
+
function Ni(s, t) {
|
|
133
|
+
Ln || (Ln = new TextDecoder());
|
|
134
134
|
const e = [];
|
|
135
135
|
let n = 0, r = -1, i = !1;
|
|
136
136
|
return new TransformStream({
|
|
137
137
|
transform(o, a) {
|
|
138
138
|
for (e.push(o); ; ) {
|
|
139
139
|
if (n === 0) {
|
|
140
|
-
if (
|
|
140
|
+
if (pn(e) < 1)
|
|
141
141
|
break;
|
|
142
|
-
const l =
|
|
142
|
+
const l = mn(e, 1);
|
|
143
143
|
i = (l[0] & 128) === 128, r = l[0] & 127, r < 126 ? n = 3 : r === 126 ? n = 1 : n = 2;
|
|
144
144
|
} else if (n === 1) {
|
|
145
|
-
if (
|
|
145
|
+
if (pn(e) < 2)
|
|
146
146
|
break;
|
|
147
|
-
const l =
|
|
147
|
+
const l = mn(e, 2);
|
|
148
148
|
r = new DataView(l.buffer, l.byteOffset, l.length).getUint16(0), n = 3;
|
|
149
149
|
} else if (n === 2) {
|
|
150
|
-
if (
|
|
150
|
+
if (pn(e) < 8)
|
|
151
151
|
break;
|
|
152
|
-
const l =
|
|
152
|
+
const l = mn(e, 8), d = new DataView(l.buffer, l.byteOffset, l.length), c = d.getUint32(0);
|
|
153
153
|
if (c > Math.pow(2, 21) - 1) {
|
|
154
|
-
a.enqueue(
|
|
154
|
+
a.enqueue(Gn);
|
|
155
155
|
break;
|
|
156
156
|
}
|
|
157
157
|
r = c * Math.pow(2, 32) + d.getUint32(4), n = 3;
|
|
158
158
|
} else {
|
|
159
|
-
if (
|
|
159
|
+
if (pn(e) < r)
|
|
160
160
|
break;
|
|
161
|
-
const l =
|
|
162
|
-
a.enqueue(
|
|
161
|
+
const l = mn(e, r);
|
|
162
|
+
a.enqueue(ms(i ? l : Ln.decode(l), t)), n = 0;
|
|
163
163
|
}
|
|
164
164
|
if (r === 0 || r > s) {
|
|
165
|
-
a.enqueue(
|
|
165
|
+
a.enqueue(Gn);
|
|
166
166
|
break;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
const
|
|
172
|
+
const Rr = 4;
|
|
173
173
|
function _t(s) {
|
|
174
|
-
if (s) return
|
|
174
|
+
if (s) return Mi(s);
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function Mi(s) {
|
|
177
177
|
for (var t in _t.prototype)
|
|
178
178
|
s[t] = _t.prototype[t];
|
|
179
179
|
return s;
|
|
@@ -219,34 +219,34 @@ _t.prototype.listeners = function(s) {
|
|
|
219
219
|
_t.prototype.hasListeners = function(s) {
|
|
220
220
|
return !!this.listeners(s).length;
|
|
221
221
|
};
|
|
222
|
-
const
|
|
223
|
-
function
|
|
222
|
+
const kn = typeof Promise == "function" && typeof Promise.resolve == "function" ? (t) => Promise.resolve().then(t) : (t, e) => e(t, 0), qt = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Fi = "arraybuffer";
|
|
223
|
+
function Nr(s, ...t) {
|
|
224
224
|
return t.reduce((e, n) => (s.hasOwnProperty(n) && (e[n] = s[n]), e), {});
|
|
225
225
|
}
|
|
226
|
-
const
|
|
227
|
-
function
|
|
228
|
-
t.useNativeTimers ? (s.setTimeoutFn =
|
|
226
|
+
const Li = qt.setTimeout, Pi = qt.clearTimeout;
|
|
227
|
+
function Cn(s, t) {
|
|
228
|
+
t.useNativeTimers ? (s.setTimeoutFn = Li.bind(qt), s.clearTimeoutFn = Pi.bind(qt)) : (s.setTimeoutFn = qt.setTimeout.bind(qt), s.clearTimeoutFn = qt.clearTimeout.bind(qt));
|
|
229
229
|
}
|
|
230
|
-
const
|
|
231
|
-
function
|
|
232
|
-
return typeof s == "string" ?
|
|
230
|
+
const Bi = 1.33;
|
|
231
|
+
function ji(s) {
|
|
232
|
+
return typeof s == "string" ? Di(s) : Math.ceil((s.byteLength || s.size) * Bi);
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function Di(s) {
|
|
235
235
|
let t = 0, e = 0;
|
|
236
236
|
for (let n = 0, r = s.length; n < r; n++)
|
|
237
237
|
t = s.charCodeAt(n), t < 128 ? e += 1 : t < 2048 ? e += 2 : t < 55296 || t >= 57344 ? e += 3 : (n++, e += 4);
|
|
238
238
|
return e;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function Mr() {
|
|
241
241
|
return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function Ui(s) {
|
|
244
244
|
let t = "";
|
|
245
245
|
for (let e in s)
|
|
246
246
|
s.hasOwnProperty(e) && (t.length && (t += "&"), t += encodeURIComponent(e) + "=" + encodeURIComponent(s[e]));
|
|
247
247
|
return t;
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function qi(s) {
|
|
250
250
|
let t = {}, e = s.split("&");
|
|
251
251
|
for (let n = 0, r = e.length; n < r; n++) {
|
|
252
252
|
let i = e[n].split("=");
|
|
@@ -254,12 +254,12 @@ function Pi(s) {
|
|
|
254
254
|
}
|
|
255
255
|
return t;
|
|
256
256
|
}
|
|
257
|
-
class
|
|
257
|
+
class Vi extends Error {
|
|
258
258
|
constructor(t, e, n) {
|
|
259
259
|
super(t), this.description = e, this.context = n, this.type = "TransportError";
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
class
|
|
262
|
+
class gs extends _t {
|
|
263
263
|
/**
|
|
264
264
|
* Transport abstract constructor.
|
|
265
265
|
*
|
|
@@ -267,7 +267,7 @@ class ps extends _t {
|
|
|
267
267
|
* @protected
|
|
268
268
|
*/
|
|
269
269
|
constructor(t) {
|
|
270
|
-
super(), this.writable = !1,
|
|
270
|
+
super(), this.writable = !1, Cn(this, t), this.opts = t, this.query = t.query, this.socket = t.socket, this.supportsBinary = !t.forceBase64;
|
|
271
271
|
}
|
|
272
272
|
/**
|
|
273
273
|
* Emits an error.
|
|
@@ -279,7 +279,7 @@ class ps extends _t {
|
|
|
279
279
|
* @protected
|
|
280
280
|
*/
|
|
281
281
|
onError(t, e, n) {
|
|
282
|
-
return super.emitReserved("error", new
|
|
282
|
+
return super.emitReserved("error", new Vi(t, e, n)), this;
|
|
283
283
|
}
|
|
284
284
|
/**
|
|
285
285
|
* Opens the transport.
|
|
@@ -316,7 +316,7 @@ class ps extends _t {
|
|
|
316
316
|
* @protected
|
|
317
317
|
*/
|
|
318
318
|
onData(t) {
|
|
319
|
-
const e =
|
|
319
|
+
const e = ms(t, this.socket.binaryType);
|
|
320
320
|
this.onPacket(e);
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
@@ -353,11 +353,11 @@ class ps extends _t {
|
|
|
353
353
|
return this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
|
|
354
354
|
}
|
|
355
355
|
_query(t) {
|
|
356
|
-
const e =
|
|
356
|
+
const e = Ui(t);
|
|
357
357
|
return e.length ? "?" + e : "";
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
class
|
|
360
|
+
class Gi extends gs {
|
|
361
361
|
constructor() {
|
|
362
362
|
super(...arguments), this._polling = !1;
|
|
363
363
|
}
|
|
@@ -413,7 +413,7 @@ class ji extends ps {
|
|
|
413
413
|
return this.onClose({ description: "transport closed by the server" }), !1;
|
|
414
414
|
this.onPacket(n);
|
|
415
415
|
};
|
|
416
|
-
|
|
416
|
+
Ci(t, this.socket.binaryType).forEach(e), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
|
|
417
417
|
}
|
|
418
418
|
/**
|
|
419
419
|
* For polling, send a close packet.
|
|
@@ -433,7 +433,7 @@ class ji extends ps {
|
|
|
433
433
|
* @protected
|
|
434
434
|
*/
|
|
435
435
|
write(t) {
|
|
436
|
-
this.writable = !1,
|
|
436
|
+
this.writable = !1, ki(t, (e) => {
|
|
437
437
|
this.doWrite(e, () => {
|
|
438
438
|
this.writable = !0, this.emitReserved("drain");
|
|
439
439
|
});
|
|
@@ -446,18 +446,18 @@ class ji extends ps {
|
|
|
446
446
|
*/
|
|
447
447
|
uri() {
|
|
448
448
|
const t = this.opts.secure ? "https" : "http", e = this.query || {};
|
|
449
|
-
return this.opts.timestampRequests !== !1 && (e[this.opts.timestampParam] =
|
|
449
|
+
return this.opts.timestampRequests !== !1 && (e[this.opts.timestampParam] = Mr()), !this.supportsBinary && !e.sid && (e.b64 = 1), this.createUri(t, e);
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
-
let
|
|
452
|
+
let Fr = !1;
|
|
453
453
|
try {
|
|
454
|
-
|
|
454
|
+
Fr = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
|
|
455
455
|
} catch {
|
|
456
456
|
}
|
|
457
|
-
const
|
|
458
|
-
function
|
|
457
|
+
const Hi = Fr;
|
|
458
|
+
function Ji() {
|
|
459
459
|
}
|
|
460
|
-
class
|
|
460
|
+
class Wi extends Gi {
|
|
461
461
|
/**
|
|
462
462
|
* XHR Polling constructor.
|
|
463
463
|
*
|
|
@@ -507,7 +507,7 @@ class ee extends _t {
|
|
|
507
507
|
* @package
|
|
508
508
|
*/
|
|
509
509
|
constructor(t, e, n) {
|
|
510
|
-
super(), this.createRequest = t,
|
|
510
|
+
super(), this.createRequest = t, Cn(this, n), this._opts = n, this._method = n.method || "GET", this._uri = e, this._data = n.data !== void 0 ? n.data : null, this._create();
|
|
511
511
|
}
|
|
512
512
|
/**
|
|
513
513
|
* Creates the XHR object and sends the request.
|
|
@@ -516,7 +516,7 @@ class ee extends _t {
|
|
|
516
516
|
*/
|
|
517
517
|
_create() {
|
|
518
518
|
var t;
|
|
519
|
-
const e =
|
|
519
|
+
const e = Nr(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
|
|
520
520
|
e.xdomain = !!this._opts.xd;
|
|
521
521
|
const n = this._xhr = this.createRequest(e);
|
|
522
522
|
try {
|
|
@@ -570,7 +570,7 @@ class ee extends _t {
|
|
|
570
570
|
*/
|
|
571
571
|
_cleanup(t) {
|
|
572
572
|
if (!(typeof this._xhr > "u" || this._xhr === null)) {
|
|
573
|
-
if (this._xhr.onreadystatechange =
|
|
573
|
+
if (this._xhr.onreadystatechange = Ji, t)
|
|
574
574
|
try {
|
|
575
575
|
this._xhr.abort();
|
|
576
576
|
} catch {
|
|
@@ -600,36 +600,36 @@ ee.requestsCount = 0;
|
|
|
600
600
|
ee.requests = {};
|
|
601
601
|
if (typeof document < "u") {
|
|
602
602
|
if (typeof attachEvent == "function")
|
|
603
|
-
attachEvent("onunload",
|
|
603
|
+
attachEvent("onunload", sr);
|
|
604
604
|
else if (typeof addEventListener == "function") {
|
|
605
605
|
const s = "onpagehide" in qt ? "pagehide" : "unload";
|
|
606
|
-
addEventListener(s,
|
|
606
|
+
addEventListener(s, sr, !1);
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
|
-
function
|
|
609
|
+
function sr() {
|
|
610
610
|
for (let s in ee.requests)
|
|
611
611
|
ee.requests.hasOwnProperty(s) && ee.requests[s].abort();
|
|
612
612
|
}
|
|
613
|
-
const
|
|
614
|
-
const s =
|
|
613
|
+
const zi = function() {
|
|
614
|
+
const s = Lr({
|
|
615
615
|
xdomain: !1
|
|
616
616
|
});
|
|
617
617
|
return s && s.responseType !== null;
|
|
618
618
|
}();
|
|
619
|
-
class
|
|
619
|
+
class Yi extends Wi {
|
|
620
620
|
constructor(t) {
|
|
621
621
|
super(t);
|
|
622
622
|
const e = t && t.forceBase64;
|
|
623
|
-
this.supportsBinary =
|
|
623
|
+
this.supportsBinary = zi && !e;
|
|
624
624
|
}
|
|
625
625
|
request(t = {}) {
|
|
626
|
-
return Object.assign(t, { xd: this.xd }, this.opts), new ee(
|
|
626
|
+
return Object.assign(t, { xd: this.xd }, this.opts), new ee(Lr, this.uri(), t);
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
|
-
function
|
|
629
|
+
function Lr(s) {
|
|
630
630
|
const t = s.xdomain;
|
|
631
631
|
try {
|
|
632
|
-
if (typeof XMLHttpRequest < "u" && (!t ||
|
|
632
|
+
if (typeof XMLHttpRequest < "u" && (!t || Hi))
|
|
633
633
|
return new XMLHttpRequest();
|
|
634
634
|
} catch {
|
|
635
635
|
}
|
|
@@ -639,13 +639,13 @@ function Nr(s) {
|
|
|
639
639
|
} catch {
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
|
-
const
|
|
643
|
-
class
|
|
642
|
+
const Pr = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
|
|
643
|
+
class Ki extends gs {
|
|
644
644
|
get name() {
|
|
645
645
|
return "websocket";
|
|
646
646
|
}
|
|
647
647
|
doOpen() {
|
|
648
|
-
const t = this.uri(), e = this.opts.protocols, n =
|
|
648
|
+
const t = this.uri(), e = this.opts.protocols, n = Pr ? {} : Nr(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
|
|
649
649
|
this.opts.extraHeaders && (n.headers = this.opts.extraHeaders);
|
|
650
650
|
try {
|
|
651
651
|
this.ws = this.createSocket(t, e, n);
|
|
@@ -671,12 +671,12 @@ class Hi extends ps {
|
|
|
671
671
|
this.writable = !1;
|
|
672
672
|
for (let e = 0; e < t.length; e++) {
|
|
673
673
|
const n = t[e], r = e === t.length - 1;
|
|
674
|
-
|
|
674
|
+
ps(n, this.supportsBinary, (i) => {
|
|
675
675
|
try {
|
|
676
676
|
this.doWrite(n, i);
|
|
677
677
|
} catch {
|
|
678
678
|
}
|
|
679
|
-
r &&
|
|
679
|
+
r && kn(() => {
|
|
680
680
|
this.writable = !0, this.emitReserved("drain");
|
|
681
681
|
}, this.setTimeoutFn);
|
|
682
682
|
});
|
|
@@ -693,19 +693,19 @@ class Hi extends ps {
|
|
|
693
693
|
*/
|
|
694
694
|
uri() {
|
|
695
695
|
const t = this.opts.secure ? "wss" : "ws", e = this.query || {};
|
|
696
|
-
return this.opts.timestampRequests && (e[this.opts.timestampParam] =
|
|
696
|
+
return this.opts.timestampRequests && (e[this.opts.timestampParam] = Mr()), this.supportsBinary || (e.b64 = 1), this.createUri(t, e);
|
|
697
697
|
}
|
|
698
698
|
}
|
|
699
|
-
const
|
|
700
|
-
class
|
|
699
|
+
const Pn = qt.WebSocket || qt.MozWebSocket;
|
|
700
|
+
class Xi extends Ki {
|
|
701
701
|
createSocket(t, e, n) {
|
|
702
|
-
return
|
|
702
|
+
return Pr ? new Pn(t, e, n) : e ? new Pn(t, e) : new Pn(t);
|
|
703
703
|
}
|
|
704
704
|
doWrite(t, e) {
|
|
705
705
|
this.ws.send(e);
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
|
-
class
|
|
708
|
+
class Qi extends gs {
|
|
709
709
|
get name() {
|
|
710
710
|
return "webtransport";
|
|
711
711
|
}
|
|
@@ -721,7 +721,7 @@ class Wi extends ps {
|
|
|
721
721
|
this.onError("webtransport error", t);
|
|
722
722
|
}), this._transport.ready.then(() => {
|
|
723
723
|
this._transport.createBidirectionalStream().then((t) => {
|
|
724
|
-
const e =
|
|
724
|
+
const e = Ni(Number.MAX_SAFE_INTEGER, this.socket.binaryType), n = t.readable.pipeThrough(e).getReader(), r = Ri();
|
|
725
725
|
r.readable.pipeTo(t.writable), this._writer = r.writable.getWriter();
|
|
726
726
|
const i = () => {
|
|
727
727
|
n.read().then(({ done: a, value: l }) => {
|
|
@@ -740,7 +740,7 @@ class Wi extends ps {
|
|
|
740
740
|
for (let e = 0; e < t.length; e++) {
|
|
741
741
|
const n = t[e], r = e === t.length - 1;
|
|
742
742
|
this._writer.write(n).then(() => {
|
|
743
|
-
r &&
|
|
743
|
+
r && kn(() => {
|
|
744
744
|
this.writable = !0, this.emitReserved("drain");
|
|
745
745
|
}, this.setTimeoutFn);
|
|
746
746
|
});
|
|
@@ -751,11 +751,11 @@ class Wi extends ps {
|
|
|
751
751
|
(t = this._transport) === null || t === void 0 || t.close();
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
|
-
const
|
|
755
|
-
websocket:
|
|
756
|
-
webtransport:
|
|
757
|
-
polling:
|
|
758
|
-
},
|
|
754
|
+
const Zi = {
|
|
755
|
+
websocket: Xi,
|
|
756
|
+
webtransport: Qi,
|
|
757
|
+
polling: Yi
|
|
758
|
+
}, to = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, eo = [
|
|
759
759
|
"source",
|
|
760
760
|
"protocol",
|
|
761
761
|
"authority",
|
|
@@ -771,29 +771,29 @@ const zi = {
|
|
|
771
771
|
"query",
|
|
772
772
|
"anchor"
|
|
773
773
|
];
|
|
774
|
-
function
|
|
774
|
+
function Hn(s) {
|
|
775
775
|
if (s.length > 8e3)
|
|
776
776
|
throw "URI too long";
|
|
777
777
|
const t = s, e = s.indexOf("["), n = s.indexOf("]");
|
|
778
778
|
e != -1 && n != -1 && (s = s.substring(0, e) + s.substring(e, n).replace(/:/g, ";") + s.substring(n, s.length));
|
|
779
|
-
let r =
|
|
779
|
+
let r = to.exec(s || ""), i = {}, o = 14;
|
|
780
780
|
for (; o--; )
|
|
781
|
-
i[
|
|
782
|
-
return e != -1 && n != -1 && (i.source = t, i.host = i.host.substring(1, i.host.length - 1).replace(/;/g, ":"), i.authority = i.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), i.ipv6uri = !0), i.pathNames =
|
|
781
|
+
i[eo[o]] = r[o] || "";
|
|
782
|
+
return e != -1 && n != -1 && (i.source = t, i.host = i.host.substring(1, i.host.length - 1).replace(/;/g, ":"), i.authority = i.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), i.ipv6uri = !0), i.pathNames = no(i, i.path), i.queryKey = so(i, i.query), i;
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function no(s, t) {
|
|
785
785
|
const e = /\/{2,9}/g, n = t.replace(e, "/").split("/");
|
|
786
786
|
return (t.slice(0, 1) == "/" || t.length === 0) && n.splice(0, 1), t.slice(-1) == "/" && n.splice(n.length - 1, 1), n;
|
|
787
787
|
}
|
|
788
|
-
function
|
|
788
|
+
function so(s, t) {
|
|
789
789
|
const e = {};
|
|
790
790
|
return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(n, r, i) {
|
|
791
791
|
r && (e[r] = i);
|
|
792
792
|
}), e;
|
|
793
793
|
}
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
|
|
794
|
+
const Jn = typeof addEventListener == "function" && typeof removeEventListener == "function", wn = [];
|
|
795
|
+
Jn && addEventListener("offline", () => {
|
|
796
|
+
wn.forEach((s) => s());
|
|
797
797
|
}, !1);
|
|
798
798
|
class Se extends _t {
|
|
799
799
|
/**
|
|
@@ -803,11 +803,11 @@ class Se extends _t {
|
|
|
803
803
|
* @param {Object} opts - options
|
|
804
804
|
*/
|
|
805
805
|
constructor(t, e) {
|
|
806
|
-
if (super(), this.binaryType =
|
|
807
|
-
const n =
|
|
806
|
+
if (super(), this.binaryType = Fi, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, t && typeof t == "object" && (e = t, t = null), t) {
|
|
807
|
+
const n = Hn(t);
|
|
808
808
|
e.hostname = n.host, e.secure = n.protocol === "https" || n.protocol === "wss", e.port = n.port, n.query && (e.query = n.query);
|
|
809
|
-
} else e.host && (e.hostname =
|
|
810
|
-
|
|
809
|
+
} else e.host && (e.hostname = Hn(e.host).host);
|
|
810
|
+
Cn(this, e), this.secure = e.secure != null ? e.secure : typeof location < "u" && location.protocol === "https:", e.hostname && !e.port && (e.port = this.secure ? "443" : "80"), this.hostname = e.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = e.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, e.transports.forEach((n) => {
|
|
811
811
|
const r = n.prototype.name;
|
|
812
812
|
this.transports.push(r), this._transportsByName[r] = n;
|
|
813
813
|
}), this.opts = Object.assign({
|
|
@@ -824,13 +824,13 @@ class Se extends _t {
|
|
|
824
824
|
},
|
|
825
825
|
transportOptions: {},
|
|
826
826
|
closeOnBeforeunload: !1
|
|
827
|
-
}, e), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query =
|
|
827
|
+
}, e), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = qi(this.opts.query)), Jn && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
|
|
828
828
|
this.transport && (this.transport.removeAllListeners(), this.transport.close());
|
|
829
829
|
}, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
|
|
830
830
|
this._onClose("transport close", {
|
|
831
831
|
description: "network connection lost"
|
|
832
832
|
});
|
|
833
|
-
},
|
|
833
|
+
}, wn.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open();
|
|
834
834
|
}
|
|
835
835
|
/**
|
|
836
836
|
* Creates transport of the given type.
|
|
@@ -841,7 +841,7 @@ class Se extends _t {
|
|
|
841
841
|
*/
|
|
842
842
|
createTransport(t) {
|
|
843
843
|
const e = Object.assign({}, this.opts.query);
|
|
844
|
-
e.EIO =
|
|
844
|
+
e.EIO = Rr, e.transport = t, this.id && (e.sid = this.id);
|
|
845
845
|
const n = Object.assign({}, this.opts, {
|
|
846
846
|
query: e,
|
|
847
847
|
socket: this,
|
|
@@ -959,7 +959,7 @@ class Se extends _t {
|
|
|
959
959
|
let e = 1;
|
|
960
960
|
for (let n = 0; n < this.writeBuffer.length; n++) {
|
|
961
961
|
const r = this.writeBuffer[n].data;
|
|
962
|
-
if (r && (e +=
|
|
962
|
+
if (r && (e += ji(r)), n > 0 && e > this._maxPayload)
|
|
963
963
|
return this.writeBuffer.slice(0, n);
|
|
964
964
|
e += 2;
|
|
965
965
|
}
|
|
@@ -979,7 +979,7 @@ class Se extends _t {
|
|
|
979
979
|
if (!this._pingTimeoutTime)
|
|
980
980
|
return !0;
|
|
981
981
|
const t = Date.now() > this._pingTimeoutTime;
|
|
982
|
-
return t && (this._pingTimeoutTime = 0,
|
|
982
|
+
return t && (this._pingTimeoutTime = 0, kn(() => {
|
|
983
983
|
this._onClose("ping timeout");
|
|
984
984
|
}, this.setTimeoutFn)), t;
|
|
985
985
|
}
|
|
@@ -1057,16 +1057,16 @@ class Se extends _t {
|
|
|
1057
1057
|
*/
|
|
1058
1058
|
_onClose(t, e) {
|
|
1059
1059
|
if (this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing") {
|
|
1060
|
-
if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(),
|
|
1061
|
-
const n =
|
|
1062
|
-
n !== -1 &&
|
|
1060
|
+
if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), Jn && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
|
|
1061
|
+
const n = wn.indexOf(this._offlineEventListener);
|
|
1062
|
+
n !== -1 && wn.splice(n, 1);
|
|
1063
1063
|
}
|
|
1064
1064
|
this.readyState = "closed", this.id = null, this.emitReserved("close", t, e), this.writeBuffer = [], this._prevBufferLen = 0;
|
|
1065
1065
|
}
|
|
1066
1066
|
}
|
|
1067
1067
|
}
|
|
1068
|
-
Se.protocol =
|
|
1069
|
-
class
|
|
1068
|
+
Se.protocol = Rr;
|
|
1069
|
+
class ro extends Se {
|
|
1070
1070
|
constructor() {
|
|
1071
1071
|
super(...arguments), this._upgrades = [];
|
|
1072
1072
|
}
|
|
@@ -1138,67 +1138,67 @@ class Zi extends Se {
|
|
|
1138
1138
|
return e;
|
|
1139
1139
|
}
|
|
1140
1140
|
}
|
|
1141
|
-
let
|
|
1141
|
+
let io = class extends ro {
|
|
1142
1142
|
constructor(t, e = {}) {
|
|
1143
1143
|
const n = typeof t == "object", r = n ? { ...t } : { ...e };
|
|
1144
|
-
(!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || ["polling", "websocket", "webtransport"]).map((i) =>
|
|
1144
|
+
(!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || ["polling", "websocket", "webtransport"]).map((i) => Zi[i]).filter((i) => !!i)), super(n ? r : t, r);
|
|
1145
1145
|
}
|
|
1146
1146
|
};
|
|
1147
|
-
function
|
|
1147
|
+
function oo(s, t = "", e) {
|
|
1148
1148
|
let n = s;
|
|
1149
|
-
e = e || typeof location < "u" && location, s == null && (s = e.protocol + "//" + e.host), typeof s == "string" && (s.charAt(0) === "/" && (s.charAt(1) === "/" ? s = e.protocol + s : s = e.host + s), /^(https?|wss?):\/\//.test(s) || (typeof e < "u" ? s = e.protocol + "//" + s : s = "https://" + s), n =
|
|
1149
|
+
e = e || typeof location < "u" && location, s == null && (s = e.protocol + "//" + e.host), typeof s == "string" && (s.charAt(0) === "/" && (s.charAt(1) === "/" ? s = e.protocol + s : s = e.host + s), /^(https?|wss?):\/\//.test(s) || (typeof e < "u" ? s = e.protocol + "//" + s : s = "https://" + s), n = Hn(s)), n.port || (/^(http|ws)$/.test(n.protocol) ? n.port = "80" : /^(http|ws)s$/.test(n.protocol) && (n.port = "443")), n.path = n.path || "/";
|
|
1150
1150
|
const i = n.host.indexOf(":") !== -1 ? "[" + n.host + "]" : n.host;
|
|
1151
1151
|
return n.id = n.protocol + "://" + i + ":" + n.port + t, n.href = n.protocol + "://" + i + (e && e.port === n.port ? "" : ":" + n.port), n;
|
|
1152
1152
|
}
|
|
1153
|
-
const
|
|
1154
|
-
function
|
|
1155
|
-
return
|
|
1153
|
+
const ao = typeof ArrayBuffer == "function", co = (s) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(s) : s.buffer instanceof ArrayBuffer, Br = Object.prototype.toString, lo = typeof Blob == "function" || typeof Blob < "u" && Br.call(Blob) === "[object BlobConstructor]", ho = typeof File == "function" || typeof File < "u" && Br.call(File) === "[object FileConstructor]";
|
|
1154
|
+
function ys(s) {
|
|
1155
|
+
return ao && (s instanceof ArrayBuffer || co(s)) || lo && s instanceof Blob || ho && s instanceof File;
|
|
1156
1156
|
}
|
|
1157
|
-
function
|
|
1157
|
+
function vn(s, t) {
|
|
1158
1158
|
if (!s || typeof s != "object")
|
|
1159
1159
|
return !1;
|
|
1160
1160
|
if (Array.isArray(s)) {
|
|
1161
1161
|
for (let e = 0, n = s.length; e < n; e++)
|
|
1162
|
-
if (
|
|
1162
|
+
if (vn(s[e]))
|
|
1163
1163
|
return !0;
|
|
1164
1164
|
return !1;
|
|
1165
1165
|
}
|
|
1166
|
-
if (
|
|
1166
|
+
if (ys(s))
|
|
1167
1167
|
return !0;
|
|
1168
1168
|
if (s.toJSON && typeof s.toJSON == "function" && arguments.length === 1)
|
|
1169
|
-
return
|
|
1169
|
+
return vn(s.toJSON(), !0);
|
|
1170
1170
|
for (const e in s)
|
|
1171
|
-
if (Object.prototype.hasOwnProperty.call(s, e) &&
|
|
1171
|
+
if (Object.prototype.hasOwnProperty.call(s, e) && vn(s[e]))
|
|
1172
1172
|
return !0;
|
|
1173
1173
|
return !1;
|
|
1174
1174
|
}
|
|
1175
|
-
function
|
|
1175
|
+
function fo(s) {
|
|
1176
1176
|
const t = [], e = s.data, n = s;
|
|
1177
|
-
return n.data =
|
|
1177
|
+
return n.data = Wn(e, t), n.attachments = t.length, { packet: n, buffers: t };
|
|
1178
1178
|
}
|
|
1179
|
-
function
|
|
1179
|
+
function Wn(s, t) {
|
|
1180
1180
|
if (!s)
|
|
1181
1181
|
return s;
|
|
1182
|
-
if (
|
|
1182
|
+
if (ys(s)) {
|
|
1183
1183
|
const e = { _placeholder: !0, num: t.length };
|
|
1184
1184
|
return t.push(s), e;
|
|
1185
1185
|
} else if (Array.isArray(s)) {
|
|
1186
1186
|
const e = new Array(s.length);
|
|
1187
1187
|
for (let n = 0; n < s.length; n++)
|
|
1188
|
-
e[n] =
|
|
1188
|
+
e[n] = Wn(s[n], t);
|
|
1189
1189
|
return e;
|
|
1190
1190
|
} else if (typeof s == "object" && !(s instanceof Date)) {
|
|
1191
1191
|
const e = {};
|
|
1192
1192
|
for (const n in s)
|
|
1193
|
-
Object.prototype.hasOwnProperty.call(s, n) && (e[n] =
|
|
1193
|
+
Object.prototype.hasOwnProperty.call(s, n) && (e[n] = Wn(s[n], t));
|
|
1194
1194
|
return e;
|
|
1195
1195
|
}
|
|
1196
1196
|
return s;
|
|
1197
1197
|
}
|
|
1198
|
-
function
|
|
1199
|
-
return s.data =
|
|
1198
|
+
function uo(s, t) {
|
|
1199
|
+
return s.data = zn(s.data, t), delete s.attachments, s;
|
|
1200
1200
|
}
|
|
1201
|
-
function
|
|
1201
|
+
function zn(s, t) {
|
|
1202
1202
|
if (!s)
|
|
1203
1203
|
return s;
|
|
1204
1204
|
if (s && s._placeholder === !0) {
|
|
@@ -1207,13 +1207,13 @@ function Wn(s, t) {
|
|
|
1207
1207
|
throw new Error("illegal attachments");
|
|
1208
1208
|
} else if (Array.isArray(s))
|
|
1209
1209
|
for (let e = 0; e < s.length; e++)
|
|
1210
|
-
s[e] =
|
|
1210
|
+
s[e] = zn(s[e], t);
|
|
1211
1211
|
else if (typeof s == "object")
|
|
1212
1212
|
for (const e in s)
|
|
1213
|
-
Object.prototype.hasOwnProperty.call(s, e) && (s[e] =
|
|
1213
|
+
Object.prototype.hasOwnProperty.call(s, e) && (s[e] = zn(s[e], t));
|
|
1214
1214
|
return s;
|
|
1215
1215
|
}
|
|
1216
|
-
const
|
|
1216
|
+
const po = [
|
|
1217
1217
|
"connect",
|
|
1218
1218
|
// used on the client side
|
|
1219
1219
|
"connect_error",
|
|
@@ -1231,7 +1231,7 @@ var X;
|
|
|
1231
1231
|
(function(s) {
|
|
1232
1232
|
s[s.CONNECT = 0] = "CONNECT", s[s.DISCONNECT = 1] = "DISCONNECT", s[s.EVENT = 2] = "EVENT", s[s.ACK = 3] = "ACK", s[s.CONNECT_ERROR = 4] = "CONNECT_ERROR", s[s.BINARY_EVENT = 5] = "BINARY_EVENT", s[s.BINARY_ACK = 6] = "BINARY_ACK";
|
|
1233
1233
|
})(X || (X = {}));
|
|
1234
|
-
class
|
|
1234
|
+
class mo {
|
|
1235
1235
|
/**
|
|
1236
1236
|
* Encoder constructor
|
|
1237
1237
|
*
|
|
@@ -1247,7 +1247,7 @@ class lo {
|
|
|
1247
1247
|
* @param {Object} obj - packet object
|
|
1248
1248
|
*/
|
|
1249
1249
|
encode(t) {
|
|
1250
|
-
return (t.type === X.EVENT || t.type === X.ACK) &&
|
|
1250
|
+
return (t.type === X.EVENT || t.type === X.ACK) && vn(t) ? this.encodeAsBinary({
|
|
1251
1251
|
type: t.type === X.EVENT ? X.BINARY_EVENT : X.BINARY_ACK,
|
|
1252
1252
|
nsp: t.nsp,
|
|
1253
1253
|
data: t.data,
|
|
@@ -1267,11 +1267,11 @@ class lo {
|
|
|
1267
1267
|
* a list of buffers.
|
|
1268
1268
|
*/
|
|
1269
1269
|
encodeAsBinary(t) {
|
|
1270
|
-
const e =
|
|
1270
|
+
const e = fo(t), n = this.encodeAsString(e.packet), r = e.buffers;
|
|
1271
1271
|
return r.unshift(n), r;
|
|
1272
1272
|
}
|
|
1273
1273
|
}
|
|
1274
|
-
class
|
|
1274
|
+
class ws extends _t {
|
|
1275
1275
|
/**
|
|
1276
1276
|
* Decoder constructor
|
|
1277
1277
|
*/
|
|
@@ -1293,8 +1293,8 @@ class gs extends _t {
|
|
|
1293
1293
|
throw new Error("got plaintext data when reconstructing a packet");
|
|
1294
1294
|
e = this.decodeString(t);
|
|
1295
1295
|
const n = e.type === X.BINARY_EVENT;
|
|
1296
|
-
n || e.type === X.BINARY_ACK ? (e.type = n ? X.EVENT : X.ACK, this.reconstructor = new
|
|
1297
|
-
} else if (
|
|
1296
|
+
n || e.type === X.BINARY_ACK ? (e.type = n ? X.EVENT : X.ACK, this.reconstructor = new go(e), e.attachments === 0 && super.emitReserved("decoded", e)) : super.emitReserved("decoded", e);
|
|
1297
|
+
} else if (ys(t) || t.base64)
|
|
1298
1298
|
if (this.reconstructor)
|
|
1299
1299
|
e = this.reconstructor.takeBinaryData(t), e && (this.reconstructor = null, super.emitReserved("decoded", e));
|
|
1300
1300
|
else
|
|
@@ -1323,7 +1323,7 @@ class gs extends _t {
|
|
|
1323
1323
|
if (o != Number(o) || t.charAt(e) !== "-")
|
|
1324
1324
|
throw new Error("Illegal attachments");
|
|
1325
1325
|
const a = Number(o);
|
|
1326
|
-
if (!
|
|
1326
|
+
if (!yo(a) || a < 0)
|
|
1327
1327
|
throw new Error("Illegal attachments");
|
|
1328
1328
|
if (a > this.opts.maxAttachments)
|
|
1329
1329
|
throw new Error("too many attachments");
|
|
@@ -1352,7 +1352,7 @@ class gs extends _t {
|
|
|
1352
1352
|
}
|
|
1353
1353
|
if (t.charAt(++e)) {
|
|
1354
1354
|
const i = this.tryParse(t.substr(e));
|
|
1355
|
-
if (
|
|
1355
|
+
if (ws.isPayloadValid(n.type, i))
|
|
1356
1356
|
n.data = i;
|
|
1357
1357
|
else
|
|
1358
1358
|
throw new Error("invalid payload");
|
|
@@ -1369,14 +1369,14 @@ class gs extends _t {
|
|
|
1369
1369
|
static isPayloadValid(t, e) {
|
|
1370
1370
|
switch (t) {
|
|
1371
1371
|
case X.CONNECT:
|
|
1372
|
-
return
|
|
1372
|
+
return rr(e);
|
|
1373
1373
|
case X.DISCONNECT:
|
|
1374
1374
|
return e === void 0;
|
|
1375
1375
|
case X.CONNECT_ERROR:
|
|
1376
|
-
return typeof e == "string" ||
|
|
1376
|
+
return typeof e == "string" || rr(e);
|
|
1377
1377
|
case X.EVENT:
|
|
1378
1378
|
case X.BINARY_EVENT:
|
|
1379
|
-
return Array.isArray(e) && (typeof e[0] == "number" || typeof e[0] == "string" &&
|
|
1379
|
+
return Array.isArray(e) && (typeof e[0] == "number" || typeof e[0] == "string" && po.indexOf(e[0]) === -1);
|
|
1380
1380
|
case X.ACK:
|
|
1381
1381
|
case X.BINARY_ACK:
|
|
1382
1382
|
return Array.isArray(e);
|
|
@@ -1389,7 +1389,7 @@ class gs extends _t {
|
|
|
1389
1389
|
this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
|
|
1390
1390
|
}
|
|
1391
1391
|
}
|
|
1392
|
-
class
|
|
1392
|
+
class go {
|
|
1393
1393
|
constructor(t) {
|
|
1394
1394
|
this.packet = t, this.buffers = [], this.reconPack = t;
|
|
1395
1395
|
}
|
|
@@ -1403,7 +1403,7 @@ class ho {
|
|
|
1403
1403
|
*/
|
|
1404
1404
|
takeBinaryData(t) {
|
|
1405
1405
|
if (this.buffers.push(t), this.buffers.length === this.reconPack.attachments) {
|
|
1406
|
-
const e =
|
|
1406
|
+
const e = uo(this.reconPack, this.buffers);
|
|
1407
1407
|
return this.finishedReconstruction(), e;
|
|
1408
1408
|
}
|
|
1409
1409
|
return null;
|
|
@@ -1415,16 +1415,16 @@ class ho {
|
|
|
1415
1415
|
this.reconPack = null, this.buffers = [];
|
|
1416
1416
|
}
|
|
1417
1417
|
}
|
|
1418
|
-
const
|
|
1418
|
+
const yo = Number.isInteger || function(s) {
|
|
1419
1419
|
return typeof s == "number" && isFinite(s) && Math.floor(s) === s;
|
|
1420
1420
|
};
|
|
1421
|
-
function
|
|
1421
|
+
function rr(s) {
|
|
1422
1422
|
return Object.prototype.toString.call(s) === "[object Object]";
|
|
1423
1423
|
}
|
|
1424
|
-
const
|
|
1424
|
+
const wo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1425
1425
|
__proto__: null,
|
|
1426
|
-
Decoder:
|
|
1427
|
-
Encoder:
|
|
1426
|
+
Decoder: ws,
|
|
1427
|
+
Encoder: mo,
|
|
1428
1428
|
get PacketType() {
|
|
1429
1429
|
return X;
|
|
1430
1430
|
}
|
|
@@ -1434,7 +1434,7 @@ function zt(s, t, e) {
|
|
|
1434
1434
|
s.off(t, e);
|
|
1435
1435
|
};
|
|
1436
1436
|
}
|
|
1437
|
-
const
|
|
1437
|
+
const vo = Object.freeze({
|
|
1438
1438
|
connect: 1,
|
|
1439
1439
|
connect_error: 1,
|
|
1440
1440
|
disconnect: 1,
|
|
@@ -1443,7 +1443,7 @@ const po = Object.freeze({
|
|
|
1443
1443
|
newListener: 1,
|
|
1444
1444
|
removeListener: 1
|
|
1445
1445
|
});
|
|
1446
|
-
class
|
|
1446
|
+
class jr extends _t {
|
|
1447
1447
|
/**
|
|
1448
1448
|
* `Socket` constructor.
|
|
1449
1449
|
*/
|
|
@@ -1559,7 +1559,7 @@ class Lr extends _t {
|
|
|
1559
1559
|
*/
|
|
1560
1560
|
emit(t, ...e) {
|
|
1561
1561
|
var n, r, i;
|
|
1562
|
-
if (
|
|
1562
|
+
if (vo.hasOwnProperty(t))
|
|
1563
1563
|
throw new Error('"' + t.toString() + '" is a reserved event name');
|
|
1564
1564
|
if (e.unshift(t), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
|
|
1565
1565
|
return this._addToQueue(e), this;
|
|
@@ -2035,10 +2035,10 @@ class Lr extends _t {
|
|
|
2035
2035
|
}
|
|
2036
2036
|
}
|
|
2037
2037
|
}
|
|
2038
|
-
function
|
|
2038
|
+
function Ue(s) {
|
|
2039
2039
|
s = s || {}, this.ms = s.min || 100, this.max = s.max || 1e4, this.factor = s.factor || 2, this.jitter = s.jitter > 0 && s.jitter <= 1 ? s.jitter : 0, this.attempts = 0;
|
|
2040
2040
|
}
|
|
2041
|
-
|
|
2041
|
+
Ue.prototype.duration = function() {
|
|
2042
2042
|
var s = this.ms * Math.pow(this.factor, this.attempts++);
|
|
2043
2043
|
if (this.jitter) {
|
|
2044
2044
|
var t = Math.random(), e = Math.floor(t * this.jitter * s);
|
|
@@ -2046,27 +2046,27 @@ De.prototype.duration = function() {
|
|
|
2046
2046
|
}
|
|
2047
2047
|
return Math.min(s, this.max) | 0;
|
|
2048
2048
|
};
|
|
2049
|
-
|
|
2049
|
+
Ue.prototype.reset = function() {
|
|
2050
2050
|
this.attempts = 0;
|
|
2051
2051
|
};
|
|
2052
|
-
|
|
2052
|
+
Ue.prototype.setMin = function(s) {
|
|
2053
2053
|
this.ms = s;
|
|
2054
2054
|
};
|
|
2055
|
-
|
|
2055
|
+
Ue.prototype.setMax = function(s) {
|
|
2056
2056
|
this.max = s;
|
|
2057
2057
|
};
|
|
2058
|
-
|
|
2058
|
+
Ue.prototype.setJitter = function(s) {
|
|
2059
2059
|
this.jitter = s;
|
|
2060
2060
|
};
|
|
2061
|
-
class
|
|
2061
|
+
class Yn extends _t {
|
|
2062
2062
|
constructor(t, e) {
|
|
2063
2063
|
var n;
|
|
2064
|
-
super(), this.nsps = {}, this.subs = [], t && typeof t == "object" && (e = t, t = void 0), e = e || {}, e.path = e.path || "/socket.io", this.opts = e,
|
|
2064
|
+
super(), this.nsps = {}, this.subs = [], t && typeof t == "object" && (e = t, t = void 0), e = e || {}, e.path = e.path || "/socket.io", this.opts = e, Cn(this, e), this.reconnection(e.reconnection !== !1), this.reconnectionAttempts(e.reconnectionAttempts || 1 / 0), this.reconnectionDelay(e.reconnectionDelay || 1e3), this.reconnectionDelayMax(e.reconnectionDelayMax || 5e3), this.randomizationFactor((n = e.randomizationFactor) !== null && n !== void 0 ? n : 0.5), this.backoff = new Ue({
|
|
2065
2065
|
min: this.reconnectionDelay(),
|
|
2066
2066
|
max: this.reconnectionDelayMax(),
|
|
2067
2067
|
jitter: this.randomizationFactor()
|
|
2068
2068
|
}), this.timeout(e.timeout == null ? 2e4 : e.timeout), this._readyState = "closed", this.uri = t;
|
|
2069
|
-
const r = e.parser ||
|
|
2069
|
+
const r = e.parser || wo;
|
|
2070
2070
|
this.encoder = new r.Encoder(), this.decoder = new r.Decoder(), this._autoConnect = e.autoConnect !== !1, this._autoConnect && this.open();
|
|
2071
2071
|
}
|
|
2072
2072
|
reconnection(t) {
|
|
@@ -2109,7 +2109,7 @@ class zn extends _t {
|
|
|
2109
2109
|
open(t) {
|
|
2110
2110
|
if (~this._readyState.indexOf("open"))
|
|
2111
2111
|
return this;
|
|
2112
|
-
this.engine = new
|
|
2112
|
+
this.engine = new io(this.uri, this.opts);
|
|
2113
2113
|
const e = this.engine, n = this;
|
|
2114
2114
|
this._readyState = "opening", this.skipReconnect = !1;
|
|
2115
2115
|
const r = zt(e, "open", function() {
|
|
@@ -2179,7 +2179,7 @@ class zn extends _t {
|
|
|
2179
2179
|
* @private
|
|
2180
2180
|
*/
|
|
2181
2181
|
ondecoded(t) {
|
|
2182
|
-
|
|
2182
|
+
kn(() => {
|
|
2183
2183
|
this.emitReserved("packet", t);
|
|
2184
2184
|
}, this.setTimeoutFn);
|
|
2185
2185
|
}
|
|
@@ -2199,7 +2199,7 @@ class zn extends _t {
|
|
|
2199
2199
|
*/
|
|
2200
2200
|
socket(t, e) {
|
|
2201
2201
|
let n = this.nsps[t];
|
|
2202
|
-
return n ? this._autoConnect && !n.active && n.connect() : (n = new
|
|
2202
|
+
return n ? this._autoConnect && !n.active && n.connect() : (n = new jr(this, t, e), this.nsps[t] = n), n;
|
|
2203
2203
|
}
|
|
2204
2204
|
/**
|
|
2205
2205
|
* Called upon a socket close.
|
|
@@ -2296,31 +2296,31 @@ class zn extends _t {
|
|
|
2296
2296
|
this._reconnecting = !1, this.backoff.reset(), this.emitReserved("reconnect", t);
|
|
2297
2297
|
}
|
|
2298
2298
|
}
|
|
2299
|
-
const
|
|
2300
|
-
function
|
|
2299
|
+
const He = {};
|
|
2300
|
+
function tn(s, t) {
|
|
2301
2301
|
typeof s == "object" && (t = s, s = void 0), t = t || {};
|
|
2302
|
-
const e =
|
|
2302
|
+
const e = oo(s, t.path || "/socket.io"), n = e.source, r = e.id, i = e.path, o = He[r] && i in He[r].nsps, a = t.forceNew || t["force new connection"] || t.multiplex === !1 || o;
|
|
2303
2303
|
let l;
|
|
2304
|
-
return a ? l = new
|
|
2304
|
+
return a ? l = new Yn(n, t) : (He[r] || (He[r] = new Yn(n, t)), l = He[r]), e.query && !t.query && (t.query = e.queryKey), l.socket(e.path, t);
|
|
2305
2305
|
}
|
|
2306
|
-
Object.assign(
|
|
2307
|
-
Manager:
|
|
2308
|
-
Socket:
|
|
2309
|
-
io:
|
|
2310
|
-
connect:
|
|
2306
|
+
Object.assign(tn, {
|
|
2307
|
+
Manager: Yn,
|
|
2308
|
+
Socket: jr,
|
|
2309
|
+
io: tn,
|
|
2310
|
+
connect: tn
|
|
2311
2311
|
});
|
|
2312
|
-
class
|
|
2312
|
+
class ir extends Error {
|
|
2313
2313
|
constructor(t, e) {
|
|
2314
2314
|
super(
|
|
2315
2315
|
`The document history advanced while this version was being prepared: expected head ${t}, found ${e ?? "none"}. Read the timeline again and rebuild on the new head.`
|
|
2316
2316
|
), this.expectedGuid = t, this.actualGuid = e, this.name = "StaleHistoryError";
|
|
2317
2317
|
}
|
|
2318
2318
|
}
|
|
2319
|
-
const
|
|
2320
|
-
function
|
|
2319
|
+
const or = "bimterop", Kn = "revitflow_history.json", Dr = "revitflow_model.frag", Ur = "revitflow_", bo = "bimterop-locks-anchor", Je = /* @__PURE__ */ new Map();
|
|
2320
|
+
function To(s, t) {
|
|
2321
2321
|
return s.filter((e) => String(e.parentId ?? "") === t);
|
|
2322
2322
|
}
|
|
2323
|
-
function
|
|
2323
|
+
function Eo(s) {
|
|
2324
2324
|
const t = s == null ? void 0 : s.hiddenFileId;
|
|
2325
2325
|
if (typeof t != "string" || !t)
|
|
2326
2326
|
throw new Error("The hidden-file upload answered without a hiddenFileId.");
|
|
@@ -2329,19 +2329,19 @@ function yo(s) {
|
|
|
2329
2329
|
function Zt(s) {
|
|
2330
2330
|
return String(s._id ?? s.id ?? "");
|
|
2331
2331
|
}
|
|
2332
|
-
var Wt, Ae, oe,
|
|
2333
|
-
class
|
|
2332
|
+
var Wt, Ae, oe, sn, rn, Xn;
|
|
2333
|
+
class qr {
|
|
2334
2334
|
constructor(t, e) {
|
|
2335
|
-
K(this,
|
|
2335
|
+
K(this, rn);
|
|
2336
2336
|
K(this, Wt);
|
|
2337
2337
|
K(this, Ae, /* @__PURE__ */ new Map());
|
|
2338
2338
|
K(this, oe);
|
|
2339
|
-
K(this,
|
|
2339
|
+
K(this, sn, 0);
|
|
2340
2340
|
this.client = t, this.projectId = e;
|
|
2341
2341
|
}
|
|
2342
2342
|
/** The project's connected documents. */
|
|
2343
2343
|
async docs() {
|
|
2344
|
-
const t = await p(this,
|
|
2344
|
+
const t = await p(this, rn, Xn).call(this);
|
|
2345
2345
|
if (!t) return [];
|
|
2346
2346
|
const e = await this.childFolders(t, !0), n = [];
|
|
2347
2347
|
for (const r of e) {
|
|
@@ -2352,9 +2352,9 @@ class jr {
|
|
|
2352
2352
|
folderId: Zt(r)
|
|
2353
2353
|
})).map(
|
|
2354
2354
|
(m) => String(m.name ?? "")
|
|
2355
|
-
), d = l.find((m) => m ===
|
|
2356
|
-
(m) => m.endsWith(".frag") && !m.startsWith(
|
|
2357
|
-
), c = l.includes(
|
|
2355
|
+
), d = l.find((m) => m === Dr) ?? l.find(
|
|
2356
|
+
(m) => m.endsWith(".frag") && !m.startsWith(Ur)
|
|
2357
|
+
), c = l.includes(Kn) || !!d;
|
|
2358
2358
|
n.push({
|
|
2359
2359
|
source: i.slice(0, o),
|
|
2360
2360
|
docId: i.slice(o + 1),
|
|
@@ -2373,7 +2373,7 @@ class jr {
|
|
|
2373
2373
|
doc(t, e) {
|
|
2374
2374
|
const n = `${t}-${e}`;
|
|
2375
2375
|
let r = g(this, Ae).get(n);
|
|
2376
|
-
return r || (r = new
|
|
2376
|
+
return r || (r = new ar(this.client, this, t, e), g(this, Ae).set(n, r)), r;
|
|
2377
2377
|
}
|
|
2378
2378
|
/**
|
|
2379
2379
|
* The history of a document of the platform's own (a folder with its `document.json`, made from
|
|
@@ -2383,7 +2383,7 @@ class jr {
|
|
|
2383
2383
|
document(t) {
|
|
2384
2384
|
const e = `platform-${t}`;
|
|
2385
2385
|
let n = g(this, Ae).get(e);
|
|
2386
|
-
return n || (n = new
|
|
2386
|
+
return n || (n = new ar(this.client, this, "platform", t, t), g(this, Ae).set(e, n)), n;
|
|
2387
2387
|
}
|
|
2388
2388
|
/**
|
|
2389
2389
|
* @internal The documents' folders (the root's children), listed ONCE and
|
|
@@ -2394,7 +2394,7 @@ class jr {
|
|
|
2394
2394
|
* folder is made, or when asked `fresh`.
|
|
2395
2395
|
*/
|
|
2396
2396
|
async childFolders(t, e = !1) {
|
|
2397
|
-
return (e || !g(this, oe) || Date.now() - g(this,
|
|
2397
|
+
return (e || !g(this, oe) || Date.now() - g(this, sn) > 3e4) && (it(this, sn, Date.now()), it(this, oe, this.client.listFolders({ parentFolderId: t, projectId: this.projectId }).then((n) => To(n, t))), g(this, oe).catch(() => {
|
|
2398
2398
|
it(this, oe, void 0);
|
|
2399
2399
|
})), g(this, oe);
|
|
2400
2400
|
}
|
|
@@ -2405,33 +2405,33 @@ class jr {
|
|
|
2405
2405
|
/** @internal The `bimterop` folder id, resolved once. */
|
|
2406
2406
|
async rootFolderId(t = !1) {
|
|
2407
2407
|
if (g(this, Wt)) return g(this, Wt);
|
|
2408
|
-
const e = await p(this,
|
|
2408
|
+
const e = await p(this, rn, Xn).call(this);
|
|
2409
2409
|
if (e) return e;
|
|
2410
2410
|
if (!t) return;
|
|
2411
2411
|
const n = await this.client.createFolder(
|
|
2412
|
-
|
|
2412
|
+
or,
|
|
2413
2413
|
void 0,
|
|
2414
2414
|
this.projectId
|
|
2415
2415
|
);
|
|
2416
2416
|
return it(this, Wt, Zt(n)), g(this, Wt);
|
|
2417
2417
|
}
|
|
2418
2418
|
}
|
|
2419
|
-
Wt = new WeakMap(), Ae = new WeakMap(), oe = new WeakMap(),
|
|
2419
|
+
Wt = new WeakMap(), Ae = new WeakMap(), oe = new WeakMap(), sn = new WeakMap(), rn = new WeakSet(), Xn = async function() {
|
|
2420
2420
|
if (g(this, Wt)) return g(this, Wt);
|
|
2421
2421
|
const e = (await this.client.listFolders({
|
|
2422
2422
|
projectId: this.projectId
|
|
2423
2423
|
})).find(
|
|
2424
|
-
(n) => String(n.name ?? "") ===
|
|
2424
|
+
(n) => String(n.name ?? "") === or && !n.parentId
|
|
2425
2425
|
);
|
|
2426
2426
|
return e && it(this, Wt, Zt(e)), g(this, Wt);
|
|
2427
2427
|
};
|
|
2428
|
-
var Xt, N, ie,
|
|
2429
|
-
class
|
|
2428
|
+
var Xt, N, ie, Re, ye, Qt, on, Qn, bn, we, Vr, Gr, Tn, Hr, Jr, Wr;
|
|
2429
|
+
class ar {
|
|
2430
2430
|
constructor(t, e, n, r, i) {
|
|
2431
2431
|
K(this, N);
|
|
2432
2432
|
K(this, Xt);
|
|
2433
2433
|
K(this, Qt);
|
|
2434
|
-
K(this,
|
|
2434
|
+
K(this, on, 0);
|
|
2435
2435
|
this.client = t, this.project = e, this.source = n, this.docId = r, it(this, Xt, i);
|
|
2436
2436
|
}
|
|
2437
2437
|
// ─── Reading ───────────────────────────────────────────────────────────────
|
|
@@ -2441,8 +2441,8 @@ class ir {
|
|
|
2441
2441
|
* Each version gets its `ordinal` filled in.
|
|
2442
2442
|
*/
|
|
2443
2443
|
async timeline() {
|
|
2444
|
-
const t = await p(this, N,
|
|
2445
|
-
return
|
|
2444
|
+
const t = await p(this, N, Tn).call(this);
|
|
2445
|
+
return zr((t == null ? void 0 : t.commits) ?? []);
|
|
2446
2446
|
}
|
|
2447
2447
|
/** The head of the timeline, or null before the first sync. */
|
|
2448
2448
|
async latest() {
|
|
@@ -2577,7 +2577,7 @@ class ir {
|
|
|
2577
2577
|
}
|
|
2578
2578
|
const r = await p(this, N, we).call(this);
|
|
2579
2579
|
await g(this, N, ie).setDescriptor(e, {
|
|
2580
|
-
name: (r == null ? void 0 : r.name.replace(/\.frag$/, "")) ?? g(this, N,
|
|
2580
|
+
name: (r == null ? void 0 : r.name.replace(/\.frag$/, "")) ?? g(this, N, Re),
|
|
2581
2581
|
views: [t]
|
|
2582
2582
|
});
|
|
2583
2583
|
}
|
|
@@ -2609,7 +2609,7 @@ class ir {
|
|
|
2609
2609
|
* claims counts only for the earliest one, matching the plugins' rule.
|
|
2610
2610
|
*/
|
|
2611
2611
|
async ownership() {
|
|
2612
|
-
const t = await p(this, N,
|
|
2612
|
+
const t = await p(this, N, bn).call(this, bo);
|
|
2613
2613
|
if (!t) return [];
|
|
2614
2614
|
const e = await this.client.getHiddenFilesByParent(t.id), n = await Promise.all(
|
|
2615
2615
|
e.map(async (o) => {
|
|
@@ -2647,15 +2647,15 @@ class ir {
|
|
|
2647
2647
|
async sync(t) {
|
|
2648
2648
|
var a;
|
|
2649
2649
|
const e = await p(this, N, ye).call(this, !0);
|
|
2650
|
-
let n = await p(this, N,
|
|
2650
|
+
let n = await p(this, N, Tn).call(this) ?? {
|
|
2651
2651
|
model: this.docId,
|
|
2652
2652
|
commits: []
|
|
2653
2653
|
};
|
|
2654
|
-
const r =
|
|
2654
|
+
const r = cr(n.commits);
|
|
2655
2655
|
if (t.expectedLatestGuid !== void 0 && (r == null ? void 0 : r.guid) !== t.expectedLatestGuid)
|
|
2656
|
-
throw new
|
|
2656
|
+
throw new ir(t.expectedLatestGuid, r == null ? void 0 : r.guid);
|
|
2657
2657
|
const i = {
|
|
2658
|
-
guid:
|
|
2658
|
+
guid: Yr(),
|
|
2659
2659
|
...r ? { parents: [r.guid] } : {},
|
|
2660
2660
|
author: t.author,
|
|
2661
2661
|
source: t.source,
|
|
@@ -2667,9 +2667,9 @@ class ir {
|
|
|
2667
2667
|
...t.origin ? { origin: t.origin } : {},
|
|
2668
2668
|
...(a = t.origins) != null && a.length ? { origins: t.origins } : {},
|
|
2669
2669
|
changes: t.changes,
|
|
2670
|
-
counts:
|
|
2670
|
+
counts: Io(t.changes)
|
|
2671
2671
|
};
|
|
2672
|
-
if (t.model && (await p(this, N,
|
|
2672
|
+
if (t.model && (await p(this, N, Wr).call(this, e, t.model), i.full = !0), t.delta) {
|
|
2673
2673
|
const l = await p(this, N, we).call(this);
|
|
2674
2674
|
if (!l)
|
|
2675
2675
|
throw new Error(
|
|
@@ -2679,22 +2679,22 @@ class ir {
|
|
|
2679
2679
|
t.delta,
|
|
2680
2680
|
l.id
|
|
2681
2681
|
);
|
|
2682
|
-
i.deltaId =
|
|
2682
|
+
i.deltaId = Eo(d);
|
|
2683
2683
|
}
|
|
2684
|
-
const o = await p(this, N,
|
|
2684
|
+
const o = await p(this, N, Tn).call(this);
|
|
2685
2685
|
if (o) {
|
|
2686
2686
|
n = o;
|
|
2687
|
-
const l =
|
|
2687
|
+
const l = cr(n.commits);
|
|
2688
2688
|
if (t.expectedLatestGuid !== void 0 && (l == null ? void 0 : l.guid) !== t.expectedLatestGuid)
|
|
2689
|
-
throw new
|
|
2689
|
+
throw new ir(t.expectedLatestGuid, l == null ? void 0 : l.guid);
|
|
2690
2690
|
l && !i.parents && (i.parents = [l.guid]);
|
|
2691
2691
|
}
|
|
2692
|
-
return n.commits.push(i), await p(this, N,
|
|
2692
|
+
return n.commits.push(i), await p(this, N, Hr).call(this, e, Kn, n), i;
|
|
2693
2693
|
}
|
|
2694
2694
|
}
|
|
2695
2695
|
Xt = new WeakMap(), N = new WeakSet(), ie = function() {
|
|
2696
|
-
return new
|
|
2697
|
-
},
|
|
2696
|
+
return new Xr(this.client, this.project.projectId);
|
|
2697
|
+
}, Re = function() {
|
|
2698
2698
|
return `${this.source}-${this.docId}`;
|
|
2699
2699
|
}, ye = async function(t) {
|
|
2700
2700
|
if (g(this, Xt)) return g(this, Xt);
|
|
@@ -2703,66 +2703,75 @@ Xt = new WeakMap(), N = new WeakSet(), ie = function() {
|
|
|
2703
2703
|
throw new Error(
|
|
2704
2704
|
`Project ${this.project.projectId} has no connected documents yet.`
|
|
2705
2705
|
);
|
|
2706
|
-
const n = (o) => o.find((a) => String(a.name ?? "") === g(this, N,
|
|
2706
|
+
const n = (o) => o.find((a) => String(a.name ?? "") === g(this, N, Re)), r = n(await this.project.childFolders(e)) ?? n(await this.project.childFolders(e, !0));
|
|
2707
2707
|
if (r)
|
|
2708
2708
|
return it(this, Xt, Zt(r)), g(this, Xt);
|
|
2709
2709
|
if (!t)
|
|
2710
2710
|
throw new Error(
|
|
2711
|
-
`Document ${g(this, N,
|
|
2711
|
+
`Document ${g(this, N, Re)} does not exist in this project.`
|
|
2712
2712
|
);
|
|
2713
2713
|
const i = await this.client.createFolder(
|
|
2714
|
-
g(this, N,
|
|
2714
|
+
g(this, N, Re),
|
|
2715
2715
|
e,
|
|
2716
2716
|
this.project.projectId
|
|
2717
2717
|
);
|
|
2718
2718
|
return this.project.forgetFolders(), it(this, Xt, Zt(i)), g(this, Xt);
|
|
2719
|
-
}, Qt = new WeakMap(),
|
|
2720
|
-
return (!g(this, Qt) || Date.now() - g(this,
|
|
2719
|
+
}, Qt = new WeakMap(), on = new WeakMap(), Qn = async function() {
|
|
2720
|
+
return (!g(this, Qt) || Date.now() - g(this, on) > 5e3) && (it(this, on, Date.now()), it(this, Qt, (async () => {
|
|
2721
2721
|
const t = await p(this, N, ye).call(this, !1);
|
|
2722
2722
|
return (await this.client.listFiles({ projectId: this.project.projectId })).filter((n) => {
|
|
2723
2723
|
const r = n;
|
|
2724
2724
|
return String(r.folderId ?? r.parentFolderId ?? "") === t;
|
|
2725
2725
|
}).map((n) => ({
|
|
2726
2726
|
id: Zt(n),
|
|
2727
|
-
name: String(n.name ?? "")
|
|
2727
|
+
name: String(n.name ?? ""),
|
|
2728
|
+
stamp: Zn(n)
|
|
2728
2729
|
}));
|
|
2729
2730
|
})()), g(this, Qt).catch(() => {
|
|
2730
2731
|
it(this, Qt, void 0);
|
|
2731
2732
|
})), g(this, Qt);
|
|
2732
|
-
},
|
|
2733
|
+
}, bn = async function(t) {
|
|
2733
2734
|
try {
|
|
2734
|
-
return (await p(this, N,
|
|
2735
|
+
return (await p(this, N, Qn).call(this)).find((e) => e.name === t);
|
|
2735
2736
|
} catch {
|
|
2736
2737
|
return;
|
|
2737
2738
|
}
|
|
2738
2739
|
}, we = async function() {
|
|
2739
2740
|
try {
|
|
2740
|
-
const t = await p(this, N,
|
|
2741
|
-
return t.find((e) => e.name ===
|
|
2742
|
-
(e) => e.name.endsWith(".frag") && !e.name.startsWith(
|
|
2741
|
+
const t = await p(this, N, Qn).call(this);
|
|
2742
|
+
return t.find((e) => e.name === Dr) ?? t.find(
|
|
2743
|
+
(e) => e.name.endsWith(".frag") && !e.name.startsWith(Ur)
|
|
2743
2744
|
);
|
|
2744
2745
|
} catch {
|
|
2745
2746
|
return;
|
|
2746
2747
|
}
|
|
2747
|
-
},
|
|
2748
|
-
const e = await p(this, N,
|
|
2748
|
+
}, Vr = async function(t) {
|
|
2749
|
+
const e = await p(this, N, bn).call(this, t);
|
|
2749
2750
|
if (!e) return;
|
|
2750
|
-
const n =
|
|
2751
|
-
if (
|
|
2751
|
+
const n = e.stamp ? Je.get(e.id) : void 0;
|
|
2752
|
+
if (n && n.stamp === e.stamp) return structuredClone(await n.value);
|
|
2753
|
+
const r = p(this, N, Gr).call(this, e, t);
|
|
2754
|
+
return e.stamp && (Je.set(e.id, { stamp: e.stamp, value: r }), r.catch(() => {
|
|
2755
|
+
var i;
|
|
2756
|
+
((i = Je.get(e.id)) == null ? void 0 : i.value) === r && Je.delete(e.id);
|
|
2757
|
+
})), structuredClone(await r);
|
|
2758
|
+
}, Gr = async function(t, e) {
|
|
2759
|
+
const n = await this.client.downloadFile(t.id);
|
|
2760
|
+
if (!n.ok) throw new Error(`Reading ${e} answered ${n.status}`);
|
|
2752
2761
|
const r = await n.text();
|
|
2753
2762
|
if (r.trim())
|
|
2754
2763
|
return JSON.parse(r);
|
|
2755
|
-
},
|
|
2756
|
-
return p(this, N,
|
|
2757
|
-
},
|
|
2764
|
+
}, Tn = function() {
|
|
2765
|
+
return p(this, N, Vr).call(this, Kn);
|
|
2766
|
+
}, Hr = async function(t, e, n) {
|
|
2758
2767
|
const r = new Blob([JSON.stringify(n)], {
|
|
2759
2768
|
type: "application/json"
|
|
2760
|
-
}), i = await p(this, N,
|
|
2761
|
-
return i ? (await this.client.updateFile(i.id, {
|
|
2769
|
+
}), i = await p(this, N, bn).call(this, e);
|
|
2770
|
+
return i ? (Je.delete(i.id), await this.client.updateFile(i.id, {
|
|
2762
2771
|
file: r,
|
|
2763
2772
|
versionTag: await this.client.nextVersionTag(i.id)
|
|
2764
|
-
}), i) : await p(this, N,
|
|
2765
|
-
},
|
|
2773
|
+
}), i) : await p(this, N, Jr).call(this, t, e, n);
|
|
2774
|
+
}, Jr = async function(t, e, n) {
|
|
2766
2775
|
const r = new Blob([JSON.stringify(n)], {
|
|
2767
2776
|
type: "application/json"
|
|
2768
2777
|
}), i = await this.client.createFile({
|
|
@@ -2775,14 +2784,14 @@ Xt = new WeakMap(), N = new WeakSet(), ie = function() {
|
|
|
2775
2784
|
it(this, Qt, void 0);
|
|
2776
2785
|
const o = i.item;
|
|
2777
2786
|
return { id: Zt(o ?? i), name: e };
|
|
2778
|
-
},
|
|
2787
|
+
}, Wr = async function(t, e) {
|
|
2779
2788
|
const n = await p(this, N, we).call(this);
|
|
2780
2789
|
if (n)
|
|
2781
2790
|
return await this.client.updateFile(n.id, {
|
|
2782
2791
|
file: e,
|
|
2783
2792
|
versionTag: await this.client.nextVersionTag(n.id)
|
|
2784
2793
|
}), n;
|
|
2785
|
-
const r = `${g(this, N,
|
|
2794
|
+
const r = `${g(this, N, Re)}.frag`, i = await this.client.createFile({
|
|
2786
2795
|
file: e,
|
|
2787
2796
|
name: r,
|
|
2788
2797
|
versionTag: "v1",
|
|
@@ -2793,13 +2802,13 @@ Xt = new WeakMap(), N = new WeakSet(), ie = function() {
|
|
|
2793
2802
|
const o = i.item;
|
|
2794
2803
|
return { id: Zt(o ?? i), name: r };
|
|
2795
2804
|
};
|
|
2796
|
-
function
|
|
2805
|
+
function Io(s) {
|
|
2797
2806
|
const t = { added: 0, modified: 0, removed: 0 };
|
|
2798
2807
|
for (const e of s)
|
|
2799
2808
|
e.type === "create" ? t.added++ : e.type === "delete" ? t.removed++ : t.modified++;
|
|
2800
2809
|
return t;
|
|
2801
2810
|
}
|
|
2802
|
-
function
|
|
2811
|
+
function zr(s) {
|
|
2803
2812
|
var l;
|
|
2804
2813
|
if (s.length <= 1)
|
|
2805
2814
|
return s.forEach((d, c) => d.ordinal = c), [...s];
|
|
@@ -2826,18 +2835,18 @@ function Gr(s) {
|
|
|
2826
2835
|
a.has(d.guid) || i.push(d);
|
|
2827
2836
|
return i.forEach((d, c) => d.ordinal = c), i;
|
|
2828
2837
|
}
|
|
2829
|
-
function
|
|
2830
|
-
const t =
|
|
2838
|
+
function cr(s) {
|
|
2839
|
+
const t = zr(s);
|
|
2831
2840
|
return t[t.length - 1];
|
|
2832
2841
|
}
|
|
2833
|
-
function
|
|
2842
|
+
function Yr() {
|
|
2834
2843
|
const s = globalThis.crypto;
|
|
2835
2844
|
return s != null && s.randomUUID ? s.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => {
|
|
2836
2845
|
const e = Math.random() * 16 | 0;
|
|
2837
2846
|
return (t === "x" ? e : e & 3 | 8).toString(16);
|
|
2838
2847
|
});
|
|
2839
2848
|
}
|
|
2840
|
-
const
|
|
2849
|
+
const Kr = {
|
|
2841
2850
|
bim: { label: "BIM model", icon: "tabler:building" },
|
|
2842
2851
|
drawings: { label: "Drawings", icon: "tabler:layout-board" },
|
|
2843
2852
|
reality: { label: "Reality capture", icon: "tabler:3d-cube-sphere" },
|
|
@@ -2846,7 +2855,7 @@ const Jr = {
|
|
|
2846
2855
|
// as a plan set is («Coordination set», Antonio 22-10).
|
|
2847
2856
|
coordination: { label: "Coordination set", icon: "tabler:messages" },
|
|
2848
2857
|
generic: { label: "Generic", icon: "tabler:file" }
|
|
2849
|
-
},
|
|
2858
|
+
}, So = {
|
|
2850
2859
|
rvt: "bim",
|
|
2851
2860
|
rfa: "bim",
|
|
2852
2861
|
ifc: "bim",
|
|
@@ -2868,21 +2877,21 @@ const Jr = {
|
|
|
2868
2877
|
bcf: "coordination",
|
|
2869
2878
|
bcfzip: "coordination"
|
|
2870
2879
|
};
|
|
2871
|
-
function
|
|
2880
|
+
function lr(s) {
|
|
2872
2881
|
var e;
|
|
2873
|
-
if (s.type && s.type in
|
|
2882
|
+
if (s.type && s.type in Kr)
|
|
2874
2883
|
return s.type;
|
|
2875
2884
|
const t = [
|
|
2876
2885
|
(e = s.native) == null ? void 0 : e.format,
|
|
2877
2886
|
...s.views.map((n) => n.format)
|
|
2878
2887
|
];
|
|
2879
2888
|
for (const n of t) {
|
|
2880
|
-
const r = n ?
|
|
2889
|
+
const r = n ? So[n.toLowerCase()] : void 0;
|
|
2881
2890
|
if (r) return r;
|
|
2882
2891
|
}
|
|
2883
2892
|
return "generic";
|
|
2884
2893
|
}
|
|
2885
|
-
const
|
|
2894
|
+
const xn = "thatopen/document@1", Bn = "document.json", _o = [
|
|
2886
2895
|
"pdf",
|
|
2887
2896
|
"txt",
|
|
2888
2897
|
"md",
|
|
@@ -2894,14 +2903,16 @@ const $n = "thatopen/document@1", Pn = "document.json", bo = [
|
|
|
2894
2903
|
function se(s) {
|
|
2895
2904
|
return String(s._id ?? s.id ?? "");
|
|
2896
2905
|
}
|
|
2897
|
-
const
|
|
2906
|
+
const ke = /* @__PURE__ */ new Map();
|
|
2907
|
+
let hr = !1;
|
|
2908
|
+
const Zn = (s) => {
|
|
2898
2909
|
const t = s, e = [...t.versions ?? []].sort((r, i) => String(i.createdAt ?? "").localeCompare(String(r.createdAt ?? "")))[0], n = (e == null ? void 0 : e.tag) ?? t.versionTag;
|
|
2899
2910
|
return n == null ? void 0 : String(n);
|
|
2900
2911
|
};
|
|
2901
|
-
var
|
|
2902
|
-
class
|
|
2912
|
+
var Ot, Qr, Zr, ts, ti, ei, ni, En;
|
|
2913
|
+
class Xr {
|
|
2903
2914
|
constructor(t, e) {
|
|
2904
|
-
K(this,
|
|
2915
|
+
K(this, Ot);
|
|
2905
2916
|
this.client = t, this.projectId = e;
|
|
2906
2917
|
}
|
|
2907
2918
|
/**
|
|
@@ -2913,8 +2924,8 @@ class Wr {
|
|
|
2913
2924
|
* folder, fetched in parallel — the storage offers nothing cheaper yet.
|
|
2914
2925
|
*/
|
|
2915
2926
|
async list(t) {
|
|
2916
|
-
const e = await p(this,
|
|
2917
|
-
return n != null && n.length ? e.filter((r) => n.includes(
|
|
2927
|
+
const e = await p(this, Ot, Qr).call(this), n = t == null ? void 0 : t.types;
|
|
2928
|
+
return n != null && n.length ? e.filter((r) => n.includes(lr(r.descriptor))) : e;
|
|
2918
2929
|
}
|
|
2919
2930
|
/**
|
|
2920
2931
|
* Converts a loose file into a document: creates the document folder next
|
|
@@ -2929,30 +2940,30 @@ class Wr {
|
|
|
2929
2940
|
* document is born ready to visualize and the link concept retires.
|
|
2930
2941
|
*/
|
|
2931
2942
|
async fromFile(t, e) {
|
|
2932
|
-
const n = await this.client.getFile(t), r = String(n.name ?? ""), i =
|
|
2943
|
+
const n = await this.client.getFile(t), r = String(n.name ?? ""), i = jn(r, n.fileExtension), o = (e == null ? void 0 : e.name) ?? r.replace(/\.[^.]+$/, "") ?? r, a = await this.client.createFolder(
|
|
2933
2944
|
o,
|
|
2934
2945
|
n.folderId ? String(n.folderId) : void 0,
|
|
2935
2946
|
this.projectId
|
|
2936
2947
|
), l = se(a);
|
|
2937
2948
|
await this.client.updateFile(t, { parentFolderId: l });
|
|
2938
|
-
const d = [], c = await p(this,
|
|
2949
|
+
const d = [], c = await p(this, Ot, ei).call(this, n);
|
|
2939
2950
|
if (c)
|
|
2940
2951
|
try {
|
|
2941
2952
|
const v = await this.client.getFile(c);
|
|
2942
2953
|
await this.client.updateFile(c, { parentFolderId: l }), d.push({
|
|
2943
2954
|
fileId: c,
|
|
2944
|
-
format:
|
|
2955
|
+
format: jn(String(v.name ?? ""), v.fileExtension)
|
|
2945
2956
|
});
|
|
2946
2957
|
} catch {
|
|
2947
2958
|
}
|
|
2948
|
-
((e == null ? void 0 : e.selfView) ??
|
|
2959
|
+
((e == null ? void 0 : e.selfView) ?? _o.includes(i)) && d.push({ fileId: t, format: i });
|
|
2949
2960
|
const w = {
|
|
2950
|
-
schema:
|
|
2961
|
+
schema: xn,
|
|
2951
2962
|
name: o,
|
|
2952
2963
|
native: { fileId: t, format: i },
|
|
2953
2964
|
views: d
|
|
2954
2965
|
};
|
|
2955
|
-
return w.type = (e == null ? void 0 : e.type) ??
|
|
2966
|
+
return w.type = (e == null ? void 0 : e.type) ?? lr(w), await this.setDescriptor(l, w), await this.recordUpload(l, { fileId: t, name: r, format: i }, (e == null ? void 0 : e.author) ?? String(n.createdBy ?? "")), { folderId: l, descriptor: w };
|
|
2956
2967
|
}
|
|
2957
2968
|
/**
|
|
2958
2969
|
* Writes the step «uploaded to the platform» in a document's history: the first step of a
|
|
@@ -2960,13 +2971,13 @@ class Wr {
|
|
|
2960
2971
|
* file uploaded later. `author` is who uploaded it (a name, or the platform user id).
|
|
2961
2972
|
*/
|
|
2962
2973
|
async recordUpload(t, e, n) {
|
|
2963
|
-
const r = new
|
|
2974
|
+
const r = new qr(this.client, this.projectId).document(t), i = (await r.timeline()).length === 0;
|
|
2964
2975
|
await r.sync({
|
|
2965
2976
|
author: n || "unknown",
|
|
2966
2977
|
source: "platform",
|
|
2967
2978
|
kind: "upload",
|
|
2968
2979
|
message: i ? "Uploaded to the platform" : "New version uploaded",
|
|
2969
|
-
file: { ...e, format: e.format ??
|
|
2980
|
+
file: { ...e, format: e.format ?? jn(e.name, void 0) },
|
|
2970
2981
|
changes: []
|
|
2971
2982
|
});
|
|
2972
2983
|
}
|
|
@@ -2975,8 +2986,8 @@ class Wr {
|
|
|
2975
2986
|
* has none yet (an old folder, or a plain folder that is not a document).
|
|
2976
2987
|
*/
|
|
2977
2988
|
async descriptor(t) {
|
|
2978
|
-
const e = await p(this,
|
|
2979
|
-
return e ? p(this,
|
|
2989
|
+
const e = await p(this, Ot, En).call(this, t);
|
|
2990
|
+
return e ? p(this, Ot, ts).call(this, e.id, e.stamp) : null;
|
|
2980
2991
|
}
|
|
2981
2992
|
/**
|
|
2982
2993
|
* The first view whose format appears in `formats` — searched in the ORDER
|
|
@@ -3023,13 +3034,13 @@ class Wr {
|
|
|
3023
3034
|
async setDescriptor(t, e) {
|
|
3024
3035
|
const n = {
|
|
3025
3036
|
...e,
|
|
3026
|
-
schema:
|
|
3037
|
+
schema: xn,
|
|
3027
3038
|
views: e.views ?? []
|
|
3028
3039
|
}, r = new Blob([JSON.stringify(n)], {
|
|
3029
3040
|
type: "application/json"
|
|
3030
|
-
}), i = await p(this,
|
|
3041
|
+
}), i = await p(this, Ot, En).call(this, t);
|
|
3031
3042
|
if (i) {
|
|
3032
|
-
|
|
3043
|
+
ke.delete(i.id), await this.client.updateFile(i.id, {
|
|
3033
3044
|
file: r,
|
|
3034
3045
|
versionTag: await this.client.nextVersionTag(i.id)
|
|
3035
3046
|
});
|
|
@@ -3037,7 +3048,7 @@ class Wr {
|
|
|
3037
3048
|
}
|
|
3038
3049
|
await this.client.createFile({
|
|
3039
3050
|
file: r,
|
|
3040
|
-
name:
|
|
3051
|
+
name: Bn,
|
|
3041
3052
|
versionTag: "v1",
|
|
3042
3053
|
parentFolderId: t,
|
|
3043
3054
|
projectId: this.projectId
|
|
@@ -3049,35 +3060,54 @@ class Wr {
|
|
|
3049
3060
|
* history and never shows in the CDE. See {@link DocumentDrafts}.
|
|
3050
3061
|
*/
|
|
3051
3062
|
drafts(t) {
|
|
3052
|
-
return new
|
|
3063
|
+
return new Ao(this.client, () => p(this, Ot, En).call(this, t));
|
|
3053
3064
|
}
|
|
3054
3065
|
}
|
|
3055
|
-
|
|
3056
|
-
const
|
|
3057
|
-
|
|
3066
|
+
Ot = new WeakSet(), Qr = async function() {
|
|
3067
|
+
const t = await p(this, Ot, Zr).call(this);
|
|
3068
|
+
if (t) return t;
|
|
3069
|
+
const n = (await this.client.listFiles({ projectId: this.projectId })).filter(
|
|
3070
|
+
(i) => String(i.name ?? "") === Bn
|
|
3058
3071
|
);
|
|
3059
3072
|
return (await Promise.all(
|
|
3060
|
-
|
|
3061
|
-
const
|
|
3062
|
-
if (!
|
|
3063
|
-
const
|
|
3064
|
-
return
|
|
3073
|
+
n.map(async (i) => {
|
|
3074
|
+
const o = i, a = String(o.folderId ?? o.parentFolderId ?? "");
|
|
3075
|
+
if (!a) return null;
|
|
3076
|
+
const l = await p(this, Ot, ts).call(this, se(i), Zn(i));
|
|
3077
|
+
return l ? { folderId: a, descriptor: l } : null;
|
|
3065
3078
|
})
|
|
3066
|
-
)).filter((
|
|
3079
|
+
)).filter((i) => i !== null);
|
|
3080
|
+
}, Zr = async function() {
|
|
3081
|
+
if (hr) return null;
|
|
3082
|
+
let t;
|
|
3083
|
+
try {
|
|
3084
|
+
t = await this.client.listDocumentDescriptors(this.projectId);
|
|
3085
|
+
} catch (n) {
|
|
3086
|
+
const r = n.status;
|
|
3087
|
+
if (r === 404 || r === 400 || r === 405)
|
|
3088
|
+
return hr = !0, null;
|
|
3089
|
+
throw n;
|
|
3090
|
+
}
|
|
3091
|
+
const e = [];
|
|
3092
|
+
for (const n of (t == null ? void 0 : t.documents) ?? []) {
|
|
3093
|
+
const r = fr(n.descriptor);
|
|
3094
|
+
!r || !n.folderId || (n.fileId && n.versionTag && ke.set(n.fileId, { stamp: n.versionTag, value: Promise.resolve(r) }), e.push({ folderId: String(n.folderId), descriptor: r }));
|
|
3095
|
+
}
|
|
3096
|
+
return e;
|
|
3067
3097
|
}, /**
|
|
3068
3098
|
* 🔴 EACH DESCRIPTOR READ ONCE A VERSION (Antonio 23-10: the calls «siempre lo mínimo posible»): kept by its file and
|
|
3069
3099
|
* the moment its listing says it last changed, for every list and panel of the page (the Coordinator's start read
|
|
3070
3100
|
* the same 16 four times). Written here, it is forgotten.
|
|
3071
3101
|
*/
|
|
3072
|
-
|
|
3073
|
-
const n = e ?
|
|
3102
|
+
ts = function(t, e) {
|
|
3103
|
+
const n = e ? ke.get(t) : void 0;
|
|
3074
3104
|
if (n && n.stamp === e) return n.value;
|
|
3075
|
-
const r = p(this,
|
|
3076
|
-
return e && (
|
|
3105
|
+
const r = p(this, Ot, ti).call(this, t);
|
|
3106
|
+
return e && (ke.set(t, { stamp: e, value: r }), r.catch(() => {
|
|
3077
3107
|
var i;
|
|
3078
|
-
((i =
|
|
3108
|
+
((i = ke.get(t)) == null ? void 0 : i.value) === r && ke.delete(t);
|
|
3079
3109
|
})), r;
|
|
3080
|
-
},
|
|
3110
|
+
}, ti = async function(t) {
|
|
3081
3111
|
const e = await this.client.downloadFile(t);
|
|
3082
3112
|
if (!e.ok) throw new Error(`Reading a document's descriptor answered ${e.status}`);
|
|
3083
3113
|
const n = await e.text();
|
|
@@ -3088,22 +3118,22 @@ Qn = function(t, e) {
|
|
|
3088
3118
|
} catch {
|
|
3089
3119
|
return null;
|
|
3090
3120
|
}
|
|
3091
|
-
return
|
|
3092
|
-
},
|
|
3121
|
+
return fr(r);
|
|
3122
|
+
}, ei = async function(t) {
|
|
3093
3123
|
let e = t.versions ?? [], n;
|
|
3094
3124
|
if (e.length === 0) {
|
|
3095
3125
|
n = await this.client.listFiles({ projectId: this.projectId }).catch(() => []);
|
|
3096
3126
|
const a = n.find((l) => se(l) === se(t));
|
|
3097
3127
|
e = (a == null ? void 0 : a.versions) ?? [];
|
|
3098
3128
|
}
|
|
3099
|
-
const r = await p(this,
|
|
3129
|
+
const r = await p(this, Ot, ni).call(this, t, e);
|
|
3100
3130
|
if (r) return r;
|
|
3101
3131
|
const i = String(t.name ?? "").replace(/\.[^.]+$/, "").toLowerCase();
|
|
3102
3132
|
if (!i) return;
|
|
3103
3133
|
n ?? (n = await this.client.listFiles({ projectId: this.projectId }).catch(() => []));
|
|
3104
3134
|
const o = n.find((a) => String(a.name ?? "").toLowerCase() === `${i}.frag` && !a.archived && se(a) !== se(t));
|
|
3105
3135
|
return o ? se(o) : void 0;
|
|
3106
|
-
},
|
|
3136
|
+
}, ni = async function(t, e) {
|
|
3107
3137
|
const n = [...e].sort(
|
|
3108
3138
|
(r, i) => String(i.createdAt ?? "").localeCompare(String(r.createdAt ?? ""))
|
|
3109
3139
|
);
|
|
@@ -3116,18 +3146,18 @@ Qn = function(t, e) {
|
|
|
3116
3146
|
if (typeof o == "string" && o) return o;
|
|
3117
3147
|
} catch {
|
|
3118
3148
|
}
|
|
3119
|
-
},
|
|
3149
|
+
}, En = async function(t) {
|
|
3120
3150
|
const n = (await this.client.listFiles({ projectId: this.projectId })).filter((r) => {
|
|
3121
3151
|
const i = r;
|
|
3122
3152
|
return String(i.folderId ?? i.parentFolderId ?? "") === t;
|
|
3123
3153
|
}).find(
|
|
3124
|
-
(r) => String(r.name ?? "") ===
|
|
3154
|
+
(r) => String(r.name ?? "") === Bn
|
|
3125
3155
|
);
|
|
3126
|
-
return n ? { id: se(n), stamp:
|
|
3156
|
+
return n ? { id: se(n), stamp: Zn(n) } : void 0;
|
|
3127
3157
|
};
|
|
3128
|
-
const
|
|
3129
|
-
var te,
|
|
3130
|
-
class
|
|
3158
|
+
const es = "draft:", Ne = "TODRAFT1";
|
|
3159
|
+
var te, Xe, ns;
|
|
3160
|
+
class Ao {
|
|
3131
3161
|
constructor(t, e) {
|
|
3132
3162
|
K(this, te);
|
|
3133
3163
|
this.client = t, this.holder = e;
|
|
@@ -3137,7 +3167,7 @@ class To {
|
|
|
3137
3167
|
const t = await this.holder();
|
|
3138
3168
|
if (!t) return [];
|
|
3139
3169
|
const e = /* @__PURE__ */ new Map();
|
|
3140
|
-
for (const n of await p(this, te,
|
|
3170
|
+
for (const n of await p(this, te, Xe).call(this, t.id)) {
|
|
3141
3171
|
const r = e.get(n.userId);
|
|
3142
3172
|
(!r || n.savedAt > r.savedAt) && e.set(n.userId, { userId: n.userId, savedAt: n.savedAt });
|
|
3143
3173
|
}
|
|
@@ -3150,9 +3180,9 @@ class To {
|
|
|
3150
3180
|
async get(t) {
|
|
3151
3181
|
const e = await this.holder();
|
|
3152
3182
|
if (!e) return null;
|
|
3153
|
-
const r = (await p(this, te,
|
|
3183
|
+
const r = (await p(this, te, Xe).call(this, e.id)).filter((l) => !(t != null && t.userId) || l.userId === t.userId).sort((l, d) => +d.savedAt - +l.savedAt)[0];
|
|
3154
3184
|
if (!r) return null;
|
|
3155
|
-
const i = await this.client.downloadHiddenFile(r.hiddenId), { meta: o, blob: a } = await
|
|
3185
|
+
const i = await this.client.downloadHiddenFile(r.hiddenId), { meta: o, blob: a } = await xo(await i.blob());
|
|
3156
3186
|
return { userId: r.userId, savedAt: r.savedAt, meta: o, blob: a };
|
|
3157
3187
|
}
|
|
3158
3188
|
/**
|
|
@@ -3164,57 +3194,57 @@ class To {
|
|
|
3164
3194
|
const n = await this.holder();
|
|
3165
3195
|
if (!n)
|
|
3166
3196
|
throw new Error("This folder is not a document (no document.json): drafts need one.");
|
|
3167
|
-
const r =
|
|
3168
|
-
await
|
|
3197
|
+
const r = Oo(e.userId), i = (await p(this, te, Xe).call(this, n.id)).filter((l) => l.userId === e.userId), a = (await this.client.createHiddenFile(
|
|
3198
|
+
await $o(t, e.meta ?? {}),
|
|
3169
3199
|
n.id,
|
|
3170
3200
|
r
|
|
3171
3201
|
)).hiddenFileId;
|
|
3172
3202
|
if (!a) throw new Error("The draft upload answered without a hiddenFileId.");
|
|
3173
|
-
return await p(this, te,
|
|
3203
|
+
return await p(this, te, ns).call(this, i.map((l) => l.hiddenId)), { userId: e.userId, savedAt: dr(a) };
|
|
3174
3204
|
}
|
|
3175
3205
|
/** Deletes every draft of this user (on an explicit save, typically). */
|
|
3176
3206
|
async delete(t) {
|
|
3177
3207
|
const e = await this.holder();
|
|
3178
3208
|
if (!e) return;
|
|
3179
|
-
const n = (await p(this, te,
|
|
3180
|
-
await p(this, te,
|
|
3209
|
+
const n = (await p(this, te, Xe).call(this, e.id)).filter((r) => r.userId === t.userId);
|
|
3210
|
+
await p(this, te, ns).call(this, n.map((r) => r.hiddenId));
|
|
3181
3211
|
}
|
|
3182
3212
|
}
|
|
3183
|
-
te = new WeakSet(),
|
|
3184
|
-
return (await this.client.getHiddenFilesByParent(t)).filter((n) => typeof n.tag == "string" && n.tag.startsWith(
|
|
3213
|
+
te = new WeakSet(), Xe = async function(t) {
|
|
3214
|
+
return (await this.client.getHiddenFilesByParent(t)).filter((n) => typeof n.tag == "string" && n.tag.startsWith(es)).map((n) => {
|
|
3185
3215
|
const r = String(n._id);
|
|
3186
3216
|
return {
|
|
3187
3217
|
hiddenId: r,
|
|
3188
|
-
userId: n.tag.slice(
|
|
3189
|
-
savedAt:
|
|
3218
|
+
userId: n.tag.slice(es.length),
|
|
3219
|
+
savedAt: dr(r)
|
|
3190
3220
|
};
|
|
3191
3221
|
});
|
|
3192
|
-
},
|
|
3222
|
+
}, ns = async function(t) {
|
|
3193
3223
|
for (const e of t)
|
|
3194
3224
|
try {
|
|
3195
3225
|
await this.client.deleteHiddenFile(e);
|
|
3196
3226
|
} catch {
|
|
3197
3227
|
}
|
|
3198
3228
|
};
|
|
3199
|
-
function
|
|
3200
|
-
const t = `${
|
|
3229
|
+
function Oo(s) {
|
|
3230
|
+
const t = `${es}${s}`;
|
|
3201
3231
|
if (!/^[A-Za-z0-9][A-Za-z0-9:._-]{0,49}$/.test(t))
|
|
3202
3232
|
throw new Error(`A draft cannot be tagged for user "${s}": ids must be letters, digits or :._- and short.`);
|
|
3203
3233
|
return t;
|
|
3204
3234
|
}
|
|
3205
|
-
function
|
|
3235
|
+
function dr(s) {
|
|
3206
3236
|
const t = parseInt(s.slice(0, 8), 16);
|
|
3207
3237
|
return new Date(Number.isFinite(t) ? t * 1e3 : 0);
|
|
3208
3238
|
}
|
|
3209
|
-
async function
|
|
3239
|
+
async function $o(s, t) {
|
|
3210
3240
|
const e = new TextEncoder().encode(JSON.stringify(t)), n = new Uint8Array(4);
|
|
3211
|
-
return new DataView(n.buffer).setUint32(0, e.length, !0), new Blob([new TextEncoder().encode(
|
|
3241
|
+
return new DataView(n.buffer).setUint32(0, e.length, !0), new Blob([new TextEncoder().encode(Ne), n, e, s]);
|
|
3212
3242
|
}
|
|
3213
|
-
async function
|
|
3214
|
-
const t = new Uint8Array(await s.slice(0,
|
|
3215
|
-
if (new TextDecoder().decode(t.slice(0,
|
|
3243
|
+
async function xo(s) {
|
|
3244
|
+
const t = new Uint8Array(await s.slice(0, Ne.length + 4).arrayBuffer());
|
|
3245
|
+
if (new TextDecoder().decode(t.slice(0, Ne.length)) !== Ne)
|
|
3216
3246
|
return { meta: {}, blob: s };
|
|
3217
|
-
const e = new DataView(t.buffer).getUint32(
|
|
3247
|
+
const e = new DataView(t.buffer).getUint32(Ne.length, !0), n = Ne.length + 4, r = await s.slice(n, n + e).text();
|
|
3218
3248
|
let i = {};
|
|
3219
3249
|
try {
|
|
3220
3250
|
i = JSON.parse(r);
|
|
@@ -3222,29 +3252,29 @@ async function So(s) {
|
|
|
3222
3252
|
}
|
|
3223
3253
|
return { meta: i, blob: s.slice(n + e) };
|
|
3224
3254
|
}
|
|
3225
|
-
function
|
|
3255
|
+
function jn(s, t) {
|
|
3226
3256
|
const e = (t ?? "").replace(/^\./, "").toLowerCase();
|
|
3227
3257
|
if (e) return e;
|
|
3228
3258
|
const n = s.lastIndexOf(".");
|
|
3229
3259
|
return n > 0 ? s.slice(n + 1).toLowerCase() : "";
|
|
3230
3260
|
}
|
|
3231
|
-
function
|
|
3261
|
+
function fr(s) {
|
|
3232
3262
|
if (!s || typeof s != "object") return null;
|
|
3233
3263
|
const t = s;
|
|
3234
|
-
if (t.schema !==
|
|
3264
|
+
if (t.schema !== xn || typeof t.name != "string") return null;
|
|
3235
3265
|
const e = Array.isArray(t.views) ? t.views.filter(
|
|
3236
3266
|
(o) => !!o && typeof o == "object" && typeof o.fileId == "string" && typeof o.format == "string"
|
|
3237
|
-
) : [], n = t.native, r = !!n && typeof n == "object" && typeof n.fileId == "string" && typeof n.format == "string", i = typeof t.type == "string" && t.type in
|
|
3267
|
+
) : [], n = t.native, r = !!n && typeof n == "object" && typeof n.fileId == "string" && typeof n.format == "string", i = typeof t.type == "string" && t.type in Kr ? t.type : void 0;
|
|
3238
3268
|
return {
|
|
3239
|
-
schema:
|
|
3269
|
+
schema: xn,
|
|
3240
3270
|
name: t.name,
|
|
3241
3271
|
...i ? { type: i } : {},
|
|
3242
3272
|
...r ? { native: { fileId: n.fileId, format: n.format } } : {},
|
|
3243
3273
|
views: e
|
|
3244
3274
|
};
|
|
3245
3275
|
}
|
|
3246
|
-
const
|
|
3247
|
-
class
|
|
3276
|
+
const ko = "flow:", Co = "flow:op", Ro = "flow:source", No = "flow:host", si = "revitflow/op@2", ur = "REVITFLOWCHANGE", pr = "REVITFLOWOPERATION";
|
|
3277
|
+
class vs {
|
|
3248
3278
|
constructor(t) {
|
|
3249
3279
|
Rt(this, "changes", []);
|
|
3250
3280
|
this.target = t;
|
|
@@ -3312,7 +3342,7 @@ class ys {
|
|
|
3312
3342
|
"An operation with no changes is not an operation. Add at least one."
|
|
3313
3343
|
);
|
|
3314
3344
|
const e = {
|
|
3315
|
-
schema:
|
|
3345
|
+
schema: si,
|
|
3316
3346
|
opId: t,
|
|
3317
3347
|
// Through the getters, so the envelope and the queue entry cannot drift
|
|
3318
3348
|
// into disagreeing about the same operation.
|
|
@@ -3324,8 +3354,8 @@ class ys {
|
|
|
3324
3354
|
...this.userId ? { userId: this.userId } : {},
|
|
3325
3355
|
title: this.title,
|
|
3326
3356
|
summary: this.summary
|
|
3327
|
-
}, [n, r] = await
|
|
3328
|
-
return
|
|
3357
|
+
}, [n, r] = await Mo();
|
|
3358
|
+
return Fo(
|
|
3329
3359
|
this.flatbuffer(n, r, t, JSON.stringify(e))
|
|
3330
3360
|
);
|
|
3331
3361
|
}
|
|
@@ -3334,8 +3364,8 @@ class ys {
|
|
|
3334
3364
|
pack(t, e) {
|
|
3335
3365
|
const n = {};
|
|
3336
3366
|
for (const [r, i] of Object.entries(t ?? {}))
|
|
3337
|
-
r.startsWith(
|
|
3338
|
-
return e.position && (n.Position = e.position.map(
|
|
3367
|
+
r.startsWith(ko) || (n[r] = String(i));
|
|
3368
|
+
return e.position && (n.Position = e.position.map(mr).join(",")), e.rotationDeg !== void 0 && (n.Rotation = mr(e.rotationDeg)), e.source && (n[Ro] = e.source), e.host && (n[No] = e.host), n;
|
|
3339
3369
|
}
|
|
3340
3370
|
requireId(t, e) {
|
|
3341
3371
|
if (!t || !t.trim())
|
|
@@ -3360,16 +3390,16 @@ class ys {
|
|
|
3360
3390
|
const { Attribute: i, Meshes: o, Model: a, SpatialStructure: l, Transform: d } = e, c = new t.Builder(1024), m = this.changes.length, w = new Uint32Array(m);
|
|
3361
3391
|
let v = 1;
|
|
3362
3392
|
for (let et = 0; et < m; et++) w[et] = v++;
|
|
3363
|
-
const I = v++, _ = (et) => (et(c, 0), c.endVector()), L = o.createShellsVector(c, []), $ = o.createCircleExtrusionsVector(c, []), O = _(o.startSamplesVector), u = _(o.startRepresentationsVector), x = _(o.startMaterialsVector), E = _(o.startLocalTransformsVector),
|
|
3364
|
-
o.startMeshes(c), o.addCoordinates(c, d.createTransform(c, 0, 0, 0, 1, 0, 0, 0, 1, 0)), o.addGlobalTransforms(c,
|
|
3393
|
+
const I = v++, _ = (et) => (et(c, 0), c.endVector()), L = o.createShellsVector(c, []), $ = o.createCircleExtrusionsVector(c, []), O = _(o.startSamplesVector), u = _(o.startRepresentationsVector), x = _(o.startMaterialsVector), E = _(o.startLocalTransformsVector), F = _(o.startGlobalTransformsVector), z = o.createMeshesItemsVector(c, []), ut = o.createMaterialIdsVector(c, []), wt = o.createRepresentationIdsVector(c, []), $t = o.createSampleIdsVector(c, []), Vt = o.createLocalTransformIdsVector(c, []), Nt = o.createGlobalTransformIdsVector(c, []);
|
|
3394
|
+
o.startMeshes(c), o.addCoordinates(c, d.createTransform(c, 0, 0, 0, 1, 0, 0, 0, 1, 0)), o.addGlobalTransforms(c, F), o.addShells(c, L), o.addRepresentations(c, u), o.addSamples(c, O), o.addLocalTransforms(c, E), o.addMaterials(c, x), o.addCircleExtrusions(c, $), o.addMeshesItems(c, z), o.addRepresentationIds(c, wt), o.addSampleIds(c, $t), o.addMaterialIds(c, ut), o.addLocalTransformIds(c, Vt), o.addGlobalTransformIds(c, Nt);
|
|
3365
3395
|
const he = o.endMeshes(c), Yt = c.createString(r), It = /* @__PURE__ */ new Set(), Gt = [];
|
|
3366
3396
|
for (const et of this.changes) {
|
|
3367
3397
|
const At = [], Ht = {
|
|
3368
|
-
[
|
|
3398
|
+
[Co]: et.op,
|
|
3369
3399
|
...et.attrs
|
|
3370
3400
|
};
|
|
3371
|
-
for (const [de,
|
|
3372
|
-
const xe = JSON.stringify([de,
|
|
3401
|
+
for (const [de, qe] of Object.entries(Ht)) {
|
|
3402
|
+
const xe = JSON.stringify([de, qe, "IFCTEXT"]);
|
|
3373
3403
|
It.add(xe), At.push(c.createString(xe));
|
|
3374
3404
|
}
|
|
3375
3405
|
Gt.push(
|
|
@@ -3386,9 +3416,9 @@ class ys {
|
|
|
3386
3416
|
c,
|
|
3387
3417
|
[...It].map((et) => c.createString(et))
|
|
3388
3418
|
), q = this.changes.map(
|
|
3389
|
-
() => c.createString(
|
|
3419
|
+
() => c.createString(ur)
|
|
3390
3420
|
);
|
|
3391
|
-
q.push(c.createString(
|
|
3421
|
+
q.push(c.createString(pr));
|
|
3392
3422
|
const Z = a.createCategoriesVector(c, q), k = [], Tt = [];
|
|
3393
3423
|
this.changes.forEach((et, At) => {
|
|
3394
3424
|
et.item && (k.push(c.createString(et.item)), Tt.push(w[At]));
|
|
@@ -3397,13 +3427,13 @@ class ys {
|
|
|
3397
3427
|
(et, At) => l.createSpatialStructure(
|
|
3398
3428
|
c,
|
|
3399
3429
|
w[At],
|
|
3400
|
-
c.createString(
|
|
3430
|
+
c.createString(ur),
|
|
3401
3431
|
0
|
|
3402
3432
|
)
|
|
3403
3433
|
), Pt = l.createSpatialStructure(
|
|
3404
3434
|
c,
|
|
3405
3435
|
I,
|
|
3406
|
-
c.createString(
|
|
3436
|
+
c.createString(pr),
|
|
3407
3437
|
l.createChildrenVector(c, Ft)
|
|
3408
3438
|
), st = c.createString(n);
|
|
3409
3439
|
a.startModel(c), a.addMeshes(c, he), a.addMetadata(c, Yt), a.addAttributes(c, Mt), a.addUniqueAttributes(c, $e), a.addLocalIds(c, jt), a.addCategories(c, Z), a.addGuidsItems(c, pt), a.addGuids(c, Et), a.addGuid(c, st), a.addSpatialStructure(c, Pt), a.addMaxLocalId(c, v);
|
|
@@ -3411,7 +3441,7 @@ class ys {
|
|
|
3411
3441
|
return a.finishModelBuffer(c, rt), c.asUint8Array();
|
|
3412
3442
|
}
|
|
3413
3443
|
}
|
|
3414
|
-
async function
|
|
3444
|
+
async function Mo() {
|
|
3415
3445
|
try {
|
|
3416
3446
|
return await Promise.all([
|
|
3417
3447
|
import("flatbuffers"),
|
|
@@ -3423,16 +3453,16 @@ async function ko() {
|
|
|
3423
3453
|
);
|
|
3424
3454
|
}
|
|
3425
3455
|
}
|
|
3426
|
-
function
|
|
3456
|
+
function mr(s) {
|
|
3427
3457
|
return Number.isFinite(s) ? String(s) : "0";
|
|
3428
3458
|
}
|
|
3429
|
-
async function
|
|
3459
|
+
async function Fo(s) {
|
|
3430
3460
|
const t = new Blob([s]).stream().pipeThrough(new CompressionStream("deflate"));
|
|
3431
3461
|
return new Uint8Array(await new Response(t).arrayBuffer());
|
|
3432
3462
|
}
|
|
3433
|
-
async function
|
|
3434
|
-
const [t, e] = await
|
|
3435
|
-
new t.ByteBuffer(await
|
|
3463
|
+
async function bs(s) {
|
|
3464
|
+
const [t, e] = await Lo(), n = e.Model.getRootAsModel(
|
|
3465
|
+
new t.ByteBuffer(await Po(s))
|
|
3436
3466
|
);
|
|
3437
3467
|
let r = {};
|
|
3438
3468
|
try {
|
|
@@ -3467,7 +3497,7 @@ async function ws(s) {
|
|
|
3467
3497
|
}
|
|
3468
3498
|
return { metadata: r, items: o };
|
|
3469
3499
|
}
|
|
3470
|
-
async function
|
|
3500
|
+
async function Lo() {
|
|
3471
3501
|
try {
|
|
3472
3502
|
return await Promise.all([
|
|
3473
3503
|
import("flatbuffers"),
|
|
@@ -3479,15 +3509,15 @@ async function Ro() {
|
|
|
3479
3509
|
);
|
|
3480
3510
|
}
|
|
3481
3511
|
}
|
|
3482
|
-
async function
|
|
3512
|
+
async function Po(s) {
|
|
3483
3513
|
const t = new Blob([s]).stream().pipeThrough(new DecompressionStream("deflate"));
|
|
3484
3514
|
return new Uint8Array(await new Response(t).arrayBuffer());
|
|
3485
3515
|
}
|
|
3486
|
-
const
|
|
3487
|
-
function
|
|
3516
|
+
const ri = "Element", ii = "Carried", Fe = 1 / 0.3048;
|
|
3517
|
+
function oi(s) {
|
|
3488
3518
|
const t = [];
|
|
3489
3519
|
for (const e of s)
|
|
3490
|
-
for (const n of [
|
|
3520
|
+
for (const n of [ri, ii]) {
|
|
3491
3521
|
const r = e.attrs[n];
|
|
3492
3522
|
if (r)
|
|
3493
3523
|
try {
|
|
@@ -3515,12 +3545,12 @@ function Bt(s, t) {
|
|
|
3515
3545
|
return null;
|
|
3516
3546
|
}
|
|
3517
3547
|
}
|
|
3518
|
-
function
|
|
3548
|
+
function Bo(s) {
|
|
3519
3549
|
const t = /* @__PURE__ */ new Map();
|
|
3520
|
-
for (const [e, n] of
|
|
3550
|
+
for (const [e, n] of Ts(s)) t.set(e, n.name);
|
|
3521
3551
|
return t;
|
|
3522
3552
|
}
|
|
3523
|
-
function
|
|
3553
|
+
function Ts(s) {
|
|
3524
3554
|
const t = /* @__PURE__ */ new Map();
|
|
3525
3555
|
for (const e of s) {
|
|
3526
3556
|
if (e.kind !== "datum" || e.params.of !== "level") continue;
|
|
@@ -3529,7 +3559,7 @@ function vs(s) {
|
|
|
3529
3559
|
}
|
|
3530
3560
|
return t;
|
|
3531
3561
|
}
|
|
3532
|
-
function
|
|
3562
|
+
function ai(s) {
|
|
3533
3563
|
const t = /* @__PURE__ */ new Map();
|
|
3534
3564
|
for (const e of s) {
|
|
3535
3565
|
if (!e.kind.endsWith("Style")) continue;
|
|
@@ -3538,20 +3568,20 @@ function ni(s) {
|
|
|
3538
3568
|
}
|
|
3539
3569
|
return t;
|
|
3540
3570
|
}
|
|
3541
|
-
function
|
|
3571
|
+
function Es(s, t) {
|
|
3542
3572
|
const e = /* @__PURE__ */ new Map();
|
|
3543
3573
|
for (const [n, r] of s.made)
|
|
3544
3574
|
e.set(n, r.id), r.print && (t == null || t.set(n, r.print));
|
|
3545
3575
|
return e;
|
|
3546
3576
|
}
|
|
3547
|
-
function
|
|
3577
|
+
function ci(s) {
|
|
3548
3578
|
const t = (r) => Array.isArray(r) ? r.map(t) : r && typeof r == "object" ? Object.fromEntries(Object.keys(r).sort().map((i) => [i, t(r[i])])) : r, e = JSON.stringify(t(s));
|
|
3549
3579
|
let n = 2166136261;
|
|
3550
3580
|
for (let r = 0; r < e.length; r++)
|
|
3551
3581
|
n ^= e.charCodeAt(r), n = Math.imul(n, 16777619);
|
|
3552
3582
|
return (n >>> 0).toString(36);
|
|
3553
3583
|
}
|
|
3554
|
-
async function
|
|
3584
|
+
async function Is(s, t) {
|
|
3555
3585
|
var o, a;
|
|
3556
3586
|
if (!(t != null && t.fileId)) throw new Error("Choose the model file to read.");
|
|
3557
3587
|
s.progress(`Downloading ${t.name}`);
|
|
@@ -3567,17 +3597,17 @@ async function Ts(s, t) {
|
|
|
3567
3597
|
const l = s.client.recipes.importerFor(n);
|
|
3568
3598
|
if (!l)
|
|
3569
3599
|
throw new Error(`This app cannot read .${n} files: it provides no importer for them.`);
|
|
3570
|
-
n === "ifc" && (r =
|
|
3600
|
+
n === "ifc" && (r = li(e));
|
|
3571
3601
|
const d = s.client.recipes.shapesFor(n);
|
|
3572
3602
|
d && (s.progress(`Reading the shapes of ${t.name}`), i = await d(e, t.name)), s.progress(`Reading ${t.name}`), e = await l(e, t.name);
|
|
3573
3603
|
}
|
|
3574
|
-
return { picked: t, contents: await
|
|
3604
|
+
return { picked: t, contents: await bs(e), site: r, shapes: i };
|
|
3575
3605
|
}
|
|
3576
|
-
function
|
|
3577
|
-
var
|
|
3606
|
+
function li(s) {
|
|
3607
|
+
var F;
|
|
3578
3608
|
const t = new TextDecoder("latin1").decode(s), e = (z) => new RegExp(`^${z}=\\s*([A-Z0-9_]+)\\((.*)\\);\\s*$`, "m").exec(t), n = (z) => [...z.matchAll(/#\d+|\$/g)].map((ut) => ut[0]), r = (z) => [...z.matchAll(/-?\d+(?:\.\d*)?(?:E[-+]?\d+)?/gi)].map((ut) => Number(ut[0])), i = /^(#\d+)=\s*IFCSITE\((.*)\);\s*$/m.exec(t);
|
|
3579
3609
|
if (!i) return null;
|
|
3580
|
-
const o = (
|
|
3610
|
+
const o = (F = i[2].split(",")[5]) == null ? void 0 : F.trim();
|
|
3581
3611
|
if (!(o != null && o.startsWith("#"))) return null;
|
|
3582
3612
|
const a = e(o);
|
|
3583
3613
|
if ((a == null ? void 0 : a[1]) !== "IFCLOCALPLACEMENT") return null;
|
|
@@ -3597,77 +3627,77 @@ function ri(s) {
|
|
|
3597
3627
|
const u = /IFCSIUNIT\([^)]*\.LENGTHUNIT\.\s*,\s*(\.([A-Z]+)\.|\$)\s*,\s*\.METRE\./i.exec(t), x = { MILLI: 1e-3, CENTI: 0.01, DECI: 0.1, KILO: 1e3 }, E = u ? u[2] ? x[u[2].toUpperCase()] ?? 1 : 1 : /IFCCONVERSIONBASEDUNIT\([^)]*\.LENGTHUNIT\.[^)]*'FOOT'/i.test(t) ? 0.3048 : 1;
|
|
3598
3628
|
return { east: I * E, north: _ * E, elevation: L * E, angleDeg: $ };
|
|
3599
3629
|
}
|
|
3600
|
-
const
|
|
3601
|
-
OperationBuilder:
|
|
3602
|
-
OP_SCHEMA:
|
|
3603
|
-
readFrag:
|
|
3604
|
-
readPickedFrag:
|
|
3605
|
-
recordsOf:
|
|
3630
|
+
const hi = "thatopen/recipe@1", gr = "__project_data", yr = "recipes", jo = (s) => `${s}.recipe.json`, Do = {
|
|
3631
|
+
OperationBuilder: vs,
|
|
3632
|
+
OP_SCHEMA: si,
|
|
3633
|
+
readFrag: bs,
|
|
3634
|
+
readPickedFrag: Is,
|
|
3635
|
+
recordsOf: oi,
|
|
3606
3636
|
innerJson: Bt,
|
|
3607
|
-
levelsOf:
|
|
3608
|
-
levelNames:
|
|
3609
|
-
stylesOf:
|
|
3610
|
-
printOf:
|
|
3611
|
-
siteLocationOf:
|
|
3612
|
-
whatItMadeBefore:
|
|
3613
|
-
ELEMENT_FIELD:
|
|
3614
|
-
CARRIED_FIELD:
|
|
3615
|
-
FEET_PER_METRE:
|
|
3616
|
-
},
|
|
3617
|
-
async function
|
|
3637
|
+
levelsOf: Ts,
|
|
3638
|
+
levelNames: Bo,
|
|
3639
|
+
stylesOf: ai,
|
|
3640
|
+
printOf: ci,
|
|
3641
|
+
siteLocationOf: li,
|
|
3642
|
+
whatItMadeBefore: Es,
|
|
3643
|
+
ELEMENT_FIELD: ri,
|
|
3644
|
+
CARRIED_FIELD: ii,
|
|
3645
|
+
FEET_PER_METRE: Fe
|
|
3646
|
+
}, Uo = /^[a-z0-9][a-z0-9-]{1,62}$/;
|
|
3647
|
+
async function di(s, t, e) {
|
|
3618
3648
|
const n = (d) => [...d].sort((c, m) => String(c._id).localeCompare(String(m._id)))[0], r = await s.listFolders({ projectId: t, archived: !1 });
|
|
3619
|
-
let i = n(r.filter((d) => d.name ===
|
|
3649
|
+
let i = n(r.filter((d) => d.name === gr && !d.parentId));
|
|
3620
3650
|
if (!i) {
|
|
3621
3651
|
if (!e) return null;
|
|
3622
|
-
i = await s.createFolder(
|
|
3652
|
+
i = await s.createFolder(gr, void 0, t);
|
|
3623
3653
|
}
|
|
3624
3654
|
const o = String(i._id), a = await s.listFolders({ parentFolderId: o, projectId: t, archived: !1 });
|
|
3625
|
-
let l = n(a.filter((d) => d.name ===
|
|
3655
|
+
let l = n(a.filter((d) => d.name === yr && String(d.parentId) === o));
|
|
3626
3656
|
if (!l) {
|
|
3627
3657
|
if (!e) return null;
|
|
3628
|
-
l = await s.createFolder(
|
|
3658
|
+
l = await s.createFolder(yr, o, t);
|
|
3629
3659
|
}
|
|
3630
3660
|
return String(l._id);
|
|
3631
3661
|
}
|
|
3632
|
-
const
|
|
3662
|
+
const qo = (s) => String(s._id ?? s.id ?? ""), Vo = (s) => String(s.tag ?? s.versionTag ?? ""), ss = (s) => {
|
|
3633
3663
|
var t;
|
|
3634
3664
|
return Number(((t = /(\d+)/.exec(s)) == null ? void 0 : t[1]) ?? -1);
|
|
3635
3665
|
};
|
|
3636
|
-
async function
|
|
3637
|
-
const e = await
|
|
3666
|
+
async function We(s, t) {
|
|
3667
|
+
const e = await di(s, t, !1);
|
|
3638
3668
|
if (!e) return /* @__PURE__ */ new Map();
|
|
3639
3669
|
const n = await s.listFiles({ folderId: e }), r = /* @__PURE__ */ new Map();
|
|
3640
3670
|
for (const i of n) {
|
|
3641
3671
|
const o = String(i.name ?? "");
|
|
3642
|
-
o.endsWith(".recipe.json") && r.set(o.slice(0, -12), { id:
|
|
3672
|
+
o.endsWith(".recipe.json") && r.set(o.slice(0, -12), { id: qo(i) });
|
|
3643
3673
|
}
|
|
3644
3674
|
return r;
|
|
3645
3675
|
}
|
|
3646
|
-
async function
|
|
3676
|
+
async function gn(s, t, e) {
|
|
3647
3677
|
var i;
|
|
3648
3678
|
const n = await s.downloadFile(t, e ? { versionTag: e } : void 0), r = JSON.parse(await n.text());
|
|
3649
|
-
if ((r == null ? void 0 : r.schema) !==
|
|
3679
|
+
if ((r == null ? void 0 : r.schema) !== hi || !((i = r.manifest) != null && i.name) || typeof r.code != "string")
|
|
3650
3680
|
throw new Error(`This is not a recipe this library can read (${String(r == null ? void 0 : r.schema)}).`);
|
|
3651
3681
|
return r;
|
|
3652
3682
|
}
|
|
3653
|
-
async function
|
|
3654
|
-
return (await s.listVersions(t)).map((n) => ({ tag:
|
|
3683
|
+
async function ze(s, t) {
|
|
3684
|
+
return (await s.listVersions(t)).map((n) => ({ tag: Vo(n), createdAt: String(n.createdAt ?? "") })).filter((n) => n.tag).sort((n, r) => ss(n.tag) - ss(r.tag));
|
|
3655
3685
|
}
|
|
3656
|
-
var
|
|
3657
|
-
class
|
|
3686
|
+
var an;
|
|
3687
|
+
class Go {
|
|
3658
3688
|
constructor(t, e) {
|
|
3659
3689
|
/** Compiled code, by file id and version: a version never changes, so it is compiled once. */
|
|
3660
|
-
K(this,
|
|
3690
|
+
K(this, an, /* @__PURE__ */ new Map());
|
|
3661
3691
|
this.client = t, this.builtinNames = e;
|
|
3662
3692
|
}
|
|
3663
3693
|
/** The project's recipes, each its latest version. */
|
|
3664
3694
|
async list(t) {
|
|
3665
|
-
const e = await
|
|
3695
|
+
const e = await We(this.client, t);
|
|
3666
3696
|
return (await Promise.all(
|
|
3667
3697
|
[...e.entries()].map(async ([, { id: r }]) => {
|
|
3668
3698
|
var i;
|
|
3669
3699
|
try {
|
|
3670
|
-
const o = await
|
|
3700
|
+
const o = await ze(this.client, r), a = (i = o[o.length - 1]) == null ? void 0 : i.tag, l = await gn(this.client, r, a);
|
|
3671
3701
|
return {
|
|
3672
3702
|
manifest: l.manifest,
|
|
3673
3703
|
origin: "project",
|
|
@@ -3683,13 +3713,13 @@ class Do {
|
|
|
3683
3713
|
}
|
|
3684
3714
|
/** Every saved version of a project recipe, oldest first. */
|
|
3685
3715
|
async versions(t, e) {
|
|
3686
|
-
const n = (await
|
|
3716
|
+
const n = (await We(this.client, t)).get(e);
|
|
3687
3717
|
if (!n) throw new Error(`The project has no recipe named "${e}".`);
|
|
3688
|
-
const r = await
|
|
3718
|
+
const r = await ze(this.client, n.id);
|
|
3689
3719
|
return await Promise.all(
|
|
3690
3720
|
r.map(async ({ tag: i, createdAt: o }) => {
|
|
3691
3721
|
try {
|
|
3692
|
-
const a = await
|
|
3722
|
+
const a = await gn(this.client, n.id, i);
|
|
3693
3723
|
return { version: i, author: a.author, note: a.note, savedAt: a.savedAt ?? o };
|
|
3694
3724
|
} catch {
|
|
3695
3725
|
return { version: i, savedAt: o };
|
|
@@ -3700,11 +3730,11 @@ class Do {
|
|
|
3700
3730
|
/** A project recipe's file as saved: its manifest and its code (the latest version unless one is named). */
|
|
3701
3731
|
async source(t, e, n) {
|
|
3702
3732
|
var o;
|
|
3703
|
-
const r = (await
|
|
3733
|
+
const r = (await We(this.client, t)).get(e);
|
|
3704
3734
|
if (!r) throw new Error(`The project has no recipe named "${e}".`);
|
|
3705
|
-
const i = n ?? ((o = (await
|
|
3735
|
+
const i = n ?? ((o = (await ze(this.client, r.id)).pop()) == null ? void 0 : o.tag);
|
|
3706
3736
|
if (!i) throw new Error(`The recipe "${e}" has no saved version.`);
|
|
3707
|
-
return { ...await
|
|
3737
|
+
return { ...await gn(this.client, r.id, i), version: i };
|
|
3708
3738
|
}
|
|
3709
3739
|
/**
|
|
3710
3740
|
* Saves a recipe in the project: a new file the first time, a new version after. Checked before it is
|
|
@@ -3713,29 +3743,29 @@ class Do {
|
|
|
3713
3743
|
*/
|
|
3714
3744
|
async save(t, e, n) {
|
|
3715
3745
|
const { manifest: r, code: i } = e;
|
|
3716
|
-
if (!
|
|
3746
|
+
if (!Uo.test((r == null ? void 0 : r.name) ?? ""))
|
|
3717
3747
|
throw new Error('A recipe name is lower case letters, digits and dashes, 2 to 63 of them: "walls-from-ifc".');
|
|
3718
3748
|
if (this.builtinNames().has(r.name))
|
|
3719
3749
|
throw new Error(`"${r.name}" is a built-in recipe. Give yours a name of its own.`);
|
|
3720
3750
|
if (!r.to || !r.description || !Array.isArray(r.inputs))
|
|
3721
3751
|
throw new Error("A recipe says what it writes (`to`), what it does (`description`) and what it reads (`inputs`).");
|
|
3722
|
-
await
|
|
3752
|
+
await wr(r, i);
|
|
3723
3753
|
const o = {
|
|
3724
|
-
schema:
|
|
3754
|
+
schema: hi,
|
|
3725
3755
|
manifest: r,
|
|
3726
3756
|
code: i,
|
|
3727
3757
|
author: n.author,
|
|
3728
3758
|
...n.note ? { note: n.note } : {},
|
|
3729
3759
|
savedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3730
|
-
}, a = new Blob([JSON.stringify(o, null, 2)], { type: "application/json" }), l = (await
|
|
3760
|
+
}, a = new Blob([JSON.stringify(o, null, 2)], { type: "application/json" }), l = (await We(this.client, t)).get(r.name);
|
|
3731
3761
|
if (l) {
|
|
3732
|
-
const c = await
|
|
3762
|
+
const c = await ze(this.client, l.id), m = `v${Math.max(0, ...c.map((w) => ss(w.tag))) + 1}`;
|
|
3733
3763
|
return await this.client.createVersion(l.id, a, m), m;
|
|
3734
3764
|
}
|
|
3735
|
-
const d = await
|
|
3765
|
+
const d = await di(this.client, t, !0);
|
|
3736
3766
|
return await this.client.createFile({
|
|
3737
3767
|
file: a,
|
|
3738
|
-
name:
|
|
3768
|
+
name: jo(r.name),
|
|
3739
3769
|
versionTag: "v1",
|
|
3740
3770
|
projectId: t,
|
|
3741
3771
|
parentFolderId: d
|
|
@@ -3744,40 +3774,40 @@ class Do {
|
|
|
3744
3774
|
/** A project recipe, ready to run: the latest version unless one is named. */
|
|
3745
3775
|
async load(t, e, n) {
|
|
3746
3776
|
var l;
|
|
3747
|
-
const r = (await
|
|
3777
|
+
const r = (await We(this.client, t)).get(e);
|
|
3748
3778
|
if (!r) throw new Error(`The project has no recipe named "${e}".`);
|
|
3749
|
-
const i = n ?? ((l = (await
|
|
3779
|
+
const i = n ?? ((l = (await ze(this.client, r.id)).pop()) == null ? void 0 : l.tag);
|
|
3750
3780
|
if (!i) throw new Error(`The recipe "${e}" has no saved version.`);
|
|
3751
3781
|
const o = `${r.id}@${i}`;
|
|
3752
|
-
let a = g(this,
|
|
3782
|
+
let a = g(this, an).get(o);
|
|
3753
3783
|
if (!a) {
|
|
3754
|
-
const d = await
|
|
3755
|
-
a = await
|
|
3784
|
+
const d = await gn(this.client, r.id, i);
|
|
3785
|
+
a = await wr(d.manifest, d.code), g(this, an).set(o, a);
|
|
3756
3786
|
}
|
|
3757
3787
|
return { recipe: a, version: i };
|
|
3758
3788
|
}
|
|
3759
3789
|
}
|
|
3760
|
-
|
|
3761
|
-
async function
|
|
3790
|
+
an = new WeakMap();
|
|
3791
|
+
async function wr(s, t) {
|
|
3762
3792
|
var r;
|
|
3763
3793
|
let e;
|
|
3764
3794
|
try {
|
|
3765
|
-
e = await import(`data:text/javascript;base64,${
|
|
3795
|
+
e = await import(`data:text/javascript;base64,${Ho(t)}`);
|
|
3766
3796
|
} catch (i) {
|
|
3767
3797
|
throw new Error(`The recipe's code does not load: ${i instanceof Error ? i.message : String(i)}`);
|
|
3768
3798
|
}
|
|
3769
3799
|
const n = e.run ?? ((r = e.default) == null ? void 0 : r.run);
|
|
3770
3800
|
if (typeof n != "function") throw new Error("The recipe's code exports no `run(context)` function.");
|
|
3771
|
-
return { ...s, run: (i) => n({ ...i, kit:
|
|
3801
|
+
return { ...s, run: (i) => n({ ...i, kit: Do }) };
|
|
3772
3802
|
}
|
|
3773
|
-
function
|
|
3803
|
+
function Ho(s) {
|
|
3774
3804
|
const t = new TextEncoder().encode(s);
|
|
3775
3805
|
let e = "";
|
|
3776
3806
|
for (let n = 0; n < t.length; n += 32768) e += String.fromCharCode(...t.subarray(n, n + 32768));
|
|
3777
3807
|
return btoa(e);
|
|
3778
3808
|
}
|
|
3779
|
-
async function
|
|
3780
|
-
const t = s instanceof Uint8Array ? s : new Uint8Array(await s.arrayBuffer()), { items: e, metadata: n } = await
|
|
3809
|
+
async function Fa(s) {
|
|
3810
|
+
const t = s instanceof Uint8Array ? s : new Uint8Array(await s.arrayBuffer()), { items: e, metadata: n } = await bs(t), r = e.filter((i) => i.attrs["flow:op"]).map((i) => {
|
|
3781
3811
|
const o = {};
|
|
3782
3812
|
for (const [a, l] of Object.entries(i.attrs)) a.startsWith("flow:") || (o[a] = l);
|
|
3783
3813
|
return {
|
|
@@ -3789,20 +3819,20 @@ async function $a(s) {
|
|
|
3789
3819
|
});
|
|
3790
3820
|
return { envelope: n ?? {}, changes: r };
|
|
3791
3821
|
}
|
|
3792
|
-
class
|
|
3822
|
+
class fi extends Error {
|
|
3793
3823
|
constructor(t) {
|
|
3794
3824
|
super(t), this.name = "UpToDate";
|
|
3795
3825
|
}
|
|
3796
3826
|
}
|
|
3797
|
-
var ae,
|
|
3798
|
-
class
|
|
3827
|
+
var ae, cn, ln;
|
|
3828
|
+
class Jo {
|
|
3799
3829
|
constructor(t) {
|
|
3800
3830
|
K(this, ae, /* @__PURE__ */ new Map());
|
|
3801
|
-
K(this, an, /* @__PURE__ */ new Map());
|
|
3802
3831
|
K(this, cn, /* @__PURE__ */ new Map());
|
|
3832
|
+
K(this, ln, /* @__PURE__ */ new Map());
|
|
3803
3833
|
/** The project's own recipes: list, save, versions, load (see project-recipes.ts). */
|
|
3804
3834
|
Rt(this, "project");
|
|
3805
|
-
this.client = t, this.project = new
|
|
3835
|
+
this.client = t, this.project = new Go(t, () => new Set(g(this, ae).keys()));
|
|
3806
3836
|
}
|
|
3807
3837
|
/**
|
|
3808
3838
|
* Says how this host turns files of one extension ('ifc') into records, so a
|
|
@@ -3811,19 +3841,19 @@ class qo {
|
|
|
3811
3841
|
* that has it provides it.
|
|
3812
3842
|
*/
|
|
3813
3843
|
provideImporter(t, e) {
|
|
3814
|
-
g(this,
|
|
3844
|
+
g(this, cn).set(t.toLowerCase(), e);
|
|
3815
3845
|
}
|
|
3816
3846
|
/** Says how this host reads a file's shapes (its geometry, per element and per type), for recipes that make families. */
|
|
3817
3847
|
provideShapes(t, e) {
|
|
3818
|
-
g(this,
|
|
3848
|
+
g(this, ln).set(t.toLowerCase(), e);
|
|
3819
3849
|
}
|
|
3820
3850
|
/** The shapes reader provided for an extension, or undefined. */
|
|
3821
3851
|
shapesFor(t) {
|
|
3822
|
-
return g(this,
|
|
3852
|
+
return g(this, ln).get(t.toLowerCase());
|
|
3823
3853
|
}
|
|
3824
3854
|
/** The importer provided for an extension, or undefined. */
|
|
3825
3855
|
importerFor(t) {
|
|
3826
|
-
return g(this,
|
|
3856
|
+
return g(this, cn).get(t.toLowerCase());
|
|
3827
3857
|
}
|
|
3828
3858
|
/** Registers a recipe. One per name; a second with the same name throws. */
|
|
3829
3859
|
register(t) {
|
|
@@ -3869,7 +3899,7 @@ class qo {
|
|
|
3869
3899
|
if ((r == null ? void 0 : r.kind) !== "project-file") return [];
|
|
3870
3900
|
const i = (r.extensions ?? []).map((d) => d.toLowerCase()), a = (await this.client.documents(e).list()).filter(
|
|
3871
3901
|
(d) => d.descriptor.native && (i.length === 0 || i.includes(d.descriptor.native.format.toLowerCase()))
|
|
3872
|
-
), l = await
|
|
3902
|
+
), l = await Wo(
|
|
3873
3903
|
this.client,
|
|
3874
3904
|
a.map((d) => d.descriptor.native.fileId)
|
|
3875
3905
|
);
|
|
@@ -3900,7 +3930,7 @@ class qo {
|
|
|
3900
3930
|
projectId: e.projectId,
|
|
3901
3931
|
target: e.target,
|
|
3902
3932
|
made: e.made ?? /* @__PURE__ */ new Map(),
|
|
3903
|
-
opId: e.opId ??
|
|
3933
|
+
opId: e.opId ?? Yr(),
|
|
3904
3934
|
input: e.input,
|
|
3905
3935
|
settings: e.settings ?? {},
|
|
3906
3936
|
progress: e.progress ?? (() => {
|
|
@@ -3908,8 +3938,8 @@ class qo {
|
|
|
3908
3938
|
});
|
|
3909
3939
|
}
|
|
3910
3940
|
}
|
|
3911
|
-
ae = new WeakMap(),
|
|
3912
|
-
async function
|
|
3941
|
+
ae = new WeakMap(), cn = new WeakMap(), ln = new WeakMap();
|
|
3942
|
+
async function Wo(s, t) {
|
|
3913
3943
|
const e = /* @__PURE__ */ new Map();
|
|
3914
3944
|
if (t.length === 0) return e;
|
|
3915
3945
|
const n = (i) => {
|
|
@@ -3932,8 +3962,8 @@ async function Vo(s, t) {
|
|
|
3932
3962
|
})
|
|
3933
3963
|
), e;
|
|
3934
3964
|
}
|
|
3935
|
-
const
|
|
3936
|
-
function
|
|
3965
|
+
const vr = 100;
|
|
3966
|
+
function zo(s) {
|
|
3937
3967
|
try {
|
|
3938
3968
|
const t = JSON.parse(s);
|
|
3939
3969
|
if (t && typeof t == "object") {
|
|
@@ -3948,14 +3978,14 @@ function Go(s) {
|
|
|
3948
3978
|
}
|
|
3949
3979
|
return {};
|
|
3950
3980
|
}
|
|
3951
|
-
function
|
|
3981
|
+
function Yo(s) {
|
|
3952
3982
|
if (!s || typeof s != "object") return;
|
|
3953
3983
|
const t = s.retryAfter;
|
|
3954
3984
|
return typeof t == "number" && Number.isFinite(t) && t >= 0 ? t : void 0;
|
|
3955
3985
|
}
|
|
3956
|
-
class
|
|
3986
|
+
class Ss extends Error {
|
|
3957
3987
|
constructor(e, n, r, i) {
|
|
3958
|
-
const o =
|
|
3988
|
+
const o = zo(r);
|
|
3959
3989
|
super(o.message ?? `${n || "Request failed"} (${e})`);
|
|
3960
3990
|
Rt(this, "status");
|
|
3961
3991
|
Rt(this, "code");
|
|
@@ -3966,11 +3996,11 @@ class Es extends Error {
|
|
|
3966
3996
|
* from `details.retryAfter`. Only present on rate-limited (429) responses.
|
|
3967
3997
|
*/
|
|
3968
3998
|
Rt(this, "retryAfter");
|
|
3969
|
-
this.name = "RequestError", this.status = e, this.code = o.code, this.details = o.details, this.body = r, this.retryAfter = i ??
|
|
3999
|
+
this.name = "RequestError", this.status = e, this.code = o.code, this.details = o.details, this.body = r, this.retryAfter = i ?? Yo(o.details);
|
|
3970
4000
|
}
|
|
3971
4001
|
}
|
|
3972
|
-
const Kt = "item/folder",
|
|
3973
|
-
function
|
|
4002
|
+
const Kt = "item/folder", H = "item", pe = "processor", Ko = "npm-registry", re = "hidden", Dn = "FILE", Un = "TOOL", qn = "APP", Xo = 500, br = 3e4, Qo = 2e3, Zo = 15e3, ta = (s) => /^\/?project\/permissions\/check/.test(s), ea = (s) => /^\/?(item\/folder\/?$|item\/?$|item\/folder\/[^/]+\/items\/?$|project\/[^/]+\/data\/?$)/.test(s), Ye = /* @__PURE__ */ new Map(), na = 0.25, sa = (s) => new Promise((t) => setTimeout(t, s));
|
|
4003
|
+
function ra(s) {
|
|
3974
4004
|
var r, i;
|
|
3975
4005
|
const t = (i = (r = s.headers) == null ? void 0 : r.get) == null ? void 0 : i.call(r, "Retry-After");
|
|
3976
4006
|
if (!t) return;
|
|
@@ -3980,18 +4010,18 @@ function Xo(s) {
|
|
|
3980
4010
|
if (!Number.isNaN(n))
|
|
3981
4011
|
return Math.max(0, (n - Date.now()) / 1e3);
|
|
3982
4012
|
}
|
|
3983
|
-
function
|
|
3984
|
-
return s instanceof
|
|
4013
|
+
function ia(s) {
|
|
4014
|
+
return s instanceof Ss ? s.status === 429 || s.status >= 500 : !0;
|
|
3985
4015
|
}
|
|
3986
|
-
function
|
|
4016
|
+
function oa(s, t) {
|
|
3987
4017
|
const e = Math.min(
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
), n = e *
|
|
3991
|
-
return r != null ? Math.min(r,
|
|
4018
|
+
Xo * 2 ** t,
|
|
4019
|
+
br
|
|
4020
|
+
), n = e * na * Math.random(), r = s instanceof Ss && s.retryAfter != null ? s.retryAfter * 1e3 : void 0;
|
|
4021
|
+
return r != null ? Math.min(r, br) + n : e + n;
|
|
3992
4022
|
}
|
|
3993
|
-
var T,
|
|
3994
|
-
const
|
|
4023
|
+
var T, In, M, is, ve, hn, Qe, Sn, _n, os, as, cs;
|
|
4024
|
+
const _s = class _s {
|
|
3995
4025
|
/**
|
|
3996
4026
|
* Creates a new EngineServicesClient instance.
|
|
3997
4027
|
* @param accessToken - API access token (obtained from the platform dashboard)
|
|
@@ -4019,7 +4049,7 @@ const Is = class Is {
|
|
|
4019
4049
|
* Populated automatically when using {@link fromPlatformContext}.
|
|
4020
4050
|
*/
|
|
4021
4051
|
Rt(this, "context");
|
|
4022
|
-
K(this,
|
|
4052
|
+
K(this, hn);
|
|
4023
4053
|
const { retries: r = 0, useBearer: i = !1, localServerUrl: o } = n || {};
|
|
4024
4054
|
let a = e;
|
|
4025
4055
|
if (a.charAt(a.length - 1) === "/" && (a = a.slice(0, -1)), this.apiUrl = `${a}/api`, this.accessToken = t, this.wsUrl = a, this.retries = r, this.useBearer = i, this.context = { appId: "", projectId: "", accessToken: t, apiUrl: e }, o) {
|
|
@@ -4044,7 +4074,7 @@ const Is = class Is {
|
|
|
4044
4074
|
* ```
|
|
4045
4075
|
*/
|
|
4046
4076
|
static fromPlatformContext(t) {
|
|
4047
|
-
const e = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, n = new
|
|
4077
|
+
const e = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, n = new _s(e.accessToken, e.apiUrl, {
|
|
4048
4078
|
...t,
|
|
4049
4079
|
useBearer: !0
|
|
4050
4080
|
});
|
|
@@ -4120,7 +4150,7 @@ const Is = class Is {
|
|
|
4120
4150
|
* cleaning logic is applied identically.
|
|
4121
4151
|
*/
|
|
4122
4152
|
async request(t, e, n) {
|
|
4123
|
-
return p(this, T,
|
|
4153
|
+
return p(this, T, M).call(this, t, e, n);
|
|
4124
4154
|
}
|
|
4125
4155
|
// ─── Files ───────────────────────────────────────────────────────
|
|
4126
4156
|
/**
|
|
@@ -4130,14 +4160,24 @@ const Is = class Is {
|
|
|
4130
4160
|
*/
|
|
4131
4161
|
async listFiles(t) {
|
|
4132
4162
|
const { folderId: e, archived: n, projectId: r } = t || {};
|
|
4133
|
-
return e ? await p(this, T,
|
|
4163
|
+
return e ? await p(this, T, M).call(this, "GET", `${Kt}/${e}/items`, { query: { itemType: Dn, archived: n } }) : await p(this, T, M).call(this, "GET", `${H}`, {
|
|
4134
4164
|
query: {
|
|
4135
|
-
itemType:
|
|
4165
|
+
itemType: Dn,
|
|
4136
4166
|
archived: n,
|
|
4137
4167
|
...r && { projectId: r }
|
|
4138
4168
|
}
|
|
4139
4169
|
});
|
|
4140
4170
|
}
|
|
4171
|
+
/**
|
|
4172
|
+
* Every document descriptor of a project in one request, read by the
|
|
4173
|
+
* platform (`GET /item/documents`). Throws a {@link RequestError} like any
|
|
4174
|
+
* request; a platform from before the route answers 404 (or 400, taking
|
|
4175
|
+
* `documents` for an item id), which `documents.list()` reads as "ask one
|
|
4176
|
+
* by one".
|
|
4177
|
+
*/
|
|
4178
|
+
async listDocumentDescriptors(t) {
|
|
4179
|
+
return await p(this, T, M).call(this, "GET", `${H}/documents`, { query: { projectId: t } });
|
|
4180
|
+
}
|
|
4141
4181
|
/**
|
|
4142
4182
|
* Gets a single file by ID, optionally including version history.
|
|
4143
4183
|
* @param fileId - The file's unique identifier.
|
|
@@ -4145,7 +4185,7 @@ const Is = class Is {
|
|
|
4145
4185
|
* @returns The file item, optionally with version history.
|
|
4146
4186
|
*/
|
|
4147
4187
|
async getFile(t, e) {
|
|
4148
|
-
return await p(this, T,
|
|
4188
|
+
return await p(this, T, as).call(this, t, e);
|
|
4149
4189
|
}
|
|
4150
4190
|
/**
|
|
4151
4191
|
* Uploads a new file.
|
|
@@ -4153,7 +4193,7 @@ const Is = class Is {
|
|
|
4153
4193
|
* @returns The created item and its first version.
|
|
4154
4194
|
*/
|
|
4155
4195
|
async createFile(t) {
|
|
4156
|
-
return await p(this, T,
|
|
4196
|
+
return await p(this, T, _n).call(this, t, Dn);
|
|
4157
4197
|
}
|
|
4158
4198
|
/**
|
|
4159
4199
|
* Updates an existing file. Can rename, move to a different folder,
|
|
@@ -4163,21 +4203,21 @@ const Is = class Is {
|
|
|
4163
4203
|
* @returns The updated item and/or the new version.
|
|
4164
4204
|
*/
|
|
4165
4205
|
async updateFile(t, e) {
|
|
4166
|
-
return await p(this, T,
|
|
4206
|
+
return await p(this, T, os).call(this, t, e);
|
|
4167
4207
|
}
|
|
4168
4208
|
/**
|
|
4169
4209
|
* Archives (soft-deletes) a file. Can be recovered with {@link recoverFile}.
|
|
4170
4210
|
* @param fileId - The file's unique identifier.
|
|
4171
4211
|
*/
|
|
4172
4212
|
async archiveFile(t) {
|
|
4173
|
-
return await p(this, T,
|
|
4213
|
+
return await p(this, T, M).call(this, "DELETE", `${H}/${t}`);
|
|
4174
4214
|
}
|
|
4175
4215
|
/**
|
|
4176
4216
|
* Recovers a previously archived file.
|
|
4177
4217
|
* @param fileId - The file's unique identifier.
|
|
4178
4218
|
*/
|
|
4179
4219
|
async recoverFile(t) {
|
|
4180
|
-
return await p(this, T,
|
|
4220
|
+
return await p(this, T, M).call(this, "PUT", `${H}/${t}/recover`);
|
|
4181
4221
|
}
|
|
4182
4222
|
/**
|
|
4183
4223
|
* Downloads a file's content. Returns the raw fetch Response.
|
|
@@ -4186,7 +4226,7 @@ const Is = class Is {
|
|
|
4186
4226
|
* @returns A fetch Response containing the file data.
|
|
4187
4227
|
*/
|
|
4188
4228
|
async downloadFile(t, e) {
|
|
4189
|
-
return await p(this, T,
|
|
4229
|
+
return await p(this, T, Sn).call(this, t, e);
|
|
4190
4230
|
}
|
|
4191
4231
|
/**
|
|
4192
4232
|
* Retrieves the free-JSON metadata for a specific file version.
|
|
@@ -4197,7 +4237,7 @@ const Is = class Is {
|
|
|
4197
4237
|
*/
|
|
4198
4238
|
async getFileVersionMetadata(t, e, n) {
|
|
4199
4239
|
const { withDraft: r } = n || {};
|
|
4200
|
-
return await p(this, T,
|
|
4240
|
+
return await p(this, T, M).call(this, "GET", `${H}/${encodeURIComponent(t)}/version/${encodeURIComponent(e)}/metadata`, {
|
|
4201
4241
|
query: {
|
|
4202
4242
|
...r && { withDraft: "true" }
|
|
4203
4243
|
}
|
|
@@ -4210,7 +4250,7 @@ const Is = class Is {
|
|
|
4210
4250
|
* @param metadata - Free-JSON object (max 200 fields, 50-char keys/values).
|
|
4211
4251
|
*/
|
|
4212
4252
|
async updateFileVersionMetadata(t, e, n) {
|
|
4213
|
-
return await p(this, T,
|
|
4253
|
+
return await p(this, T, M).call(this, "PUT", `${H}/${encodeURIComponent(t)}/version/${encodeURIComponent(e)}/metadata`, {
|
|
4214
4254
|
body: JSON.stringify({ metadata: n }),
|
|
4215
4255
|
contentType: "application/json"
|
|
4216
4256
|
});
|
|
@@ -4221,7 +4261,7 @@ const Is = class Is {
|
|
|
4221
4261
|
* @param versionTag - The version tag.
|
|
4222
4262
|
*/
|
|
4223
4263
|
async deleteFileVersionMetadata(t, e) {
|
|
4224
|
-
return await p(this, T,
|
|
4264
|
+
return await p(this, T, M).call(this, "DELETE", `${H}/${encodeURIComponent(t)}/version/${encodeURIComponent(e)}/metadata`);
|
|
4225
4265
|
}
|
|
4226
4266
|
/**
|
|
4227
4267
|
* Batch variant of {@link getFileVersionMetadata}. Reads the metadata of
|
|
@@ -4238,7 +4278,7 @@ const Is = class Is {
|
|
|
4238
4278
|
*/
|
|
4239
4279
|
async getFileVersionMetadataBatch(t, e) {
|
|
4240
4280
|
const { withDraft: n } = e || {};
|
|
4241
|
-
return await p(this, T,
|
|
4281
|
+
return await p(this, T, Qe).call(this, t, async (r) => (await p(this, T, M).call(this, "POST", `${H}/batch/version-metadata`, {
|
|
4242
4282
|
body: JSON.stringify({
|
|
4243
4283
|
entries: r,
|
|
4244
4284
|
...n !== void 0 && { withDraft: n }
|
|
@@ -4254,7 +4294,7 @@ const Is = class Is {
|
|
|
4254
4294
|
*/
|
|
4255
4295
|
async listFolders(t) {
|
|
4256
4296
|
const { archived: e, parentFolderId: n, projectId: r } = t || {};
|
|
4257
|
-
return await p(this, T,
|
|
4297
|
+
return await p(this, T, M).call(this, "GET", Kt, {
|
|
4258
4298
|
query: {
|
|
4259
4299
|
parentFolderId: n,
|
|
4260
4300
|
archived: e,
|
|
@@ -4267,7 +4307,7 @@ const Is = class Is {
|
|
|
4267
4307
|
* @param folderId - The folder's unique identifier.
|
|
4268
4308
|
*/
|
|
4269
4309
|
async getFolder(t) {
|
|
4270
|
-
return await p(this, T,
|
|
4310
|
+
return await p(this, T, M).call(this, "GET", `${Kt}/${t}`);
|
|
4271
4311
|
}
|
|
4272
4312
|
/**
|
|
4273
4313
|
* Batch variant of {@link getFolder}. Resolves a known set of folder ids in
|
|
@@ -4283,7 +4323,7 @@ const Is = class Is {
|
|
|
4283
4323
|
* @param folderIds - The folder ids to resolve.
|
|
4284
4324
|
*/
|
|
4285
4325
|
async getFoldersBatch(t) {
|
|
4286
|
-
return await p(this, T,
|
|
4326
|
+
return await p(this, T, Qe).call(this, t, async (e) => (await p(this, T, M).call(this, "POST", `${H}/batch/folders`, {
|
|
4287
4327
|
body: JSON.stringify({ folderIds: e }),
|
|
4288
4328
|
contentType: "application/json"
|
|
4289
4329
|
})).results);
|
|
@@ -4295,7 +4335,7 @@ const Is = class Is {
|
|
|
4295
4335
|
* @returns The created folder.
|
|
4296
4336
|
*/
|
|
4297
4337
|
async createFolder(t, e, n) {
|
|
4298
|
-
return await p(this, T,
|
|
4338
|
+
return await p(this, T, M).call(this, "POST", Kt, {
|
|
4299
4339
|
body: JSON.stringify({
|
|
4300
4340
|
name: t,
|
|
4301
4341
|
...e && { parentId: e },
|
|
@@ -4312,7 +4352,7 @@ const Is = class Is {
|
|
|
4312
4352
|
*/
|
|
4313
4353
|
async updateFolder(t, e) {
|
|
4314
4354
|
const { name: n } = e;
|
|
4315
|
-
return await p(this, T,
|
|
4355
|
+
return await p(this, T, M).call(this, "PUT", `${Kt}/${t}`, {
|
|
4316
4356
|
body: JSON.stringify({ name: n }),
|
|
4317
4357
|
contentType: "application/json"
|
|
4318
4358
|
});
|
|
@@ -4322,14 +4362,14 @@ const Is = class Is {
|
|
|
4322
4362
|
* @param folderId - The folder's unique identifier.
|
|
4323
4363
|
*/
|
|
4324
4364
|
async archiveFolder(t) {
|
|
4325
|
-
return await p(this, T,
|
|
4365
|
+
return await p(this, T, M).call(this, "DELETE", `${Kt}/${t}`);
|
|
4326
4366
|
}
|
|
4327
4367
|
/**
|
|
4328
4368
|
* Recovers a previously archived folder.
|
|
4329
4369
|
* @param folderId - The folder's unique identifier.
|
|
4330
4370
|
*/
|
|
4331
4371
|
async recoverFolder(t) {
|
|
4332
|
-
return await p(this, T,
|
|
4372
|
+
return await p(this, T, M).call(this, "PUT", `${Kt}/${t}/recover`);
|
|
4333
4373
|
}
|
|
4334
4374
|
/**
|
|
4335
4375
|
* Downloads an entire folder as a ZIP archive.
|
|
@@ -4347,14 +4387,14 @@ const Is = class Is {
|
|
|
4347
4387
|
*/
|
|
4348
4388
|
async listComponents(t) {
|
|
4349
4389
|
const { folderId: e, ShowVersions: n, projectId: r } = t || {};
|
|
4350
|
-
return e ? await p(this, T,
|
|
4390
|
+
return e ? await p(this, T, M).call(this, "GET", `${Kt}/${e}/items`, {
|
|
4351
4391
|
query: {
|
|
4352
|
-
itemType:
|
|
4392
|
+
itemType: Un,
|
|
4353
4393
|
...n && { ShowVersions: n }
|
|
4354
4394
|
}
|
|
4355
|
-
}) : await p(this, T,
|
|
4395
|
+
}) : await p(this, T, M).call(this, "GET", `${H}`, {
|
|
4356
4396
|
query: {
|
|
4357
|
-
itemType:
|
|
4397
|
+
itemType: Un,
|
|
4358
4398
|
...n && { ShowVersions: n },
|
|
4359
4399
|
...r && { projectId: r }
|
|
4360
4400
|
}
|
|
@@ -4366,7 +4406,7 @@ const Is = class Is {
|
|
|
4366
4406
|
* @param props - Options such as whether to include versions.
|
|
4367
4407
|
*/
|
|
4368
4408
|
async getComponent(t, e) {
|
|
4369
|
-
return await p(this, T,
|
|
4409
|
+
return await p(this, T, as).call(this, t, e);
|
|
4370
4410
|
}
|
|
4371
4411
|
/**
|
|
4372
4412
|
* Creates a new component with the given file and version properties.
|
|
@@ -4375,7 +4415,7 @@ const Is = class Is {
|
|
|
4375
4415
|
*/
|
|
4376
4416
|
async createComponent(t) {
|
|
4377
4417
|
const { componentProps: e } = t;
|
|
4378
|
-
return await p(this, T,
|
|
4418
|
+
return await p(this, T, _n).call(this, t, Un, e);
|
|
4379
4419
|
}
|
|
4380
4420
|
/**
|
|
4381
4421
|
* Updates an existing component. Can rename, move, and/or upload a new version.
|
|
@@ -4385,7 +4425,7 @@ const Is = class Is {
|
|
|
4385
4425
|
*/
|
|
4386
4426
|
async updateComponent(t, e) {
|
|
4387
4427
|
const { componentProps: n } = e;
|
|
4388
|
-
return await p(this, T,
|
|
4428
|
+
return await p(this, T, os).call(this, t, e, n);
|
|
4389
4429
|
}
|
|
4390
4430
|
/**
|
|
4391
4431
|
* Downloads a component's full ZIP file. Returns the raw fetch Response.
|
|
@@ -4394,7 +4434,7 @@ const Is = class Is {
|
|
|
4394
4434
|
* @returns A fetch Response containing the ZIP data.
|
|
4395
4435
|
*/
|
|
4396
4436
|
async downloadComponent(t, e) {
|
|
4397
|
-
return await p(this, T,
|
|
4437
|
+
return await p(this, T, Sn).call(this, t, e);
|
|
4398
4438
|
}
|
|
4399
4439
|
/**
|
|
4400
4440
|
* Downloads only the JavaScript bundle from a component's ZIP.
|
|
@@ -4405,7 +4445,7 @@ const Is = class Is {
|
|
|
4405
4445
|
*/
|
|
4406
4446
|
async downloadComponentBundle(t, e) {
|
|
4407
4447
|
const { versionTag: n, withDraft: r } = e || {};
|
|
4408
|
-
return await p(this, T, ve).call(this, `${
|
|
4448
|
+
return await p(this, T, ve).call(this, `${H}/${t}/download/bundle`, {
|
|
4409
4449
|
query: {
|
|
4410
4450
|
...n && { versionTag: n },
|
|
4411
4451
|
...r && { withDraft: r }
|
|
@@ -4417,14 +4457,14 @@ const Is = class Is {
|
|
|
4417
4457
|
* @param componentId - The component's unique identifier.
|
|
4418
4458
|
*/
|
|
4419
4459
|
async archiveComponent(t) {
|
|
4420
|
-
return await p(this, T,
|
|
4460
|
+
return await p(this, T, M).call(this, "DELETE", `${H}/${t}`);
|
|
4421
4461
|
}
|
|
4422
4462
|
/**
|
|
4423
4463
|
* Recovers a previously archived component.
|
|
4424
4464
|
* @param componentId - The component's unique identifier.
|
|
4425
4465
|
*/
|
|
4426
4466
|
async recoverComponent(t) {
|
|
4427
|
-
return await p(this, T,
|
|
4467
|
+
return await p(this, T, M).call(this, "PUT", `${H}/${t}/recover`);
|
|
4428
4468
|
}
|
|
4429
4469
|
// ─── Built-in Components ─────────────────────────────────────────
|
|
4430
4470
|
/**
|
|
@@ -4531,14 +4571,14 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4531
4571
|
*/
|
|
4532
4572
|
async listApps(t) {
|
|
4533
4573
|
const { folderId: e, ShowVersions: n, projectId: r } = t || {};
|
|
4534
|
-
return e ? await p(this, T,
|
|
4574
|
+
return e ? await p(this, T, M).call(this, "GET", `${Kt}/${e}/items`, {
|
|
4535
4575
|
query: {
|
|
4536
|
-
itemType:
|
|
4576
|
+
itemType: qn,
|
|
4537
4577
|
...n && { ShowVersions: n }
|
|
4538
4578
|
}
|
|
4539
|
-
}) : await p(this, T,
|
|
4579
|
+
}) : await p(this, T, M).call(this, "GET", `${H}`, {
|
|
4540
4580
|
query: {
|
|
4541
|
-
itemType:
|
|
4581
|
+
itemType: qn,
|
|
4542
4582
|
...n && { ShowVersions: n },
|
|
4543
4583
|
...r && { projectId: r }
|
|
4544
4584
|
}
|
|
@@ -4551,7 +4591,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4551
4591
|
*/
|
|
4552
4592
|
async createApp(t) {
|
|
4553
4593
|
const { appProps: e } = t;
|
|
4554
|
-
return await p(this, T,
|
|
4594
|
+
return await p(this, T, _n).call(this, t, qn, e);
|
|
4555
4595
|
}
|
|
4556
4596
|
/**
|
|
4557
4597
|
* Downloads an app's full ZIP file. Returns the raw fetch Response.
|
|
@@ -4560,7 +4600,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4560
4600
|
* @returns A fetch Response containing the ZIP data.
|
|
4561
4601
|
*/
|
|
4562
4602
|
async downloadApp(t, e) {
|
|
4563
|
-
return await p(this, T,
|
|
4603
|
+
return await p(this, T, Sn).call(this, t, e);
|
|
4564
4604
|
}
|
|
4565
4605
|
/**
|
|
4566
4606
|
* Downloads only the JavaScript bundle from an app's ZIP.
|
|
@@ -4571,7 +4611,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4571
4611
|
*/
|
|
4572
4612
|
async downloadAppBundle(t, e) {
|
|
4573
4613
|
const { versionTag: n, withDraft: r } = e || {};
|
|
4574
|
-
return await p(this, T, ve).call(this, `${
|
|
4614
|
+
return await p(this, T, ve).call(this, `${H}/${t}/download/bundle`, {
|
|
4575
4615
|
query: {
|
|
4576
4616
|
...n && { versionTag: n },
|
|
4577
4617
|
...r && { withDraft: r }
|
|
@@ -4583,7 +4623,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4583
4623
|
* @param appId - The app's unique identifier.
|
|
4584
4624
|
*/
|
|
4585
4625
|
async archiveApp(t) {
|
|
4586
|
-
return await p(this, T,
|
|
4626
|
+
return await p(this, T, M).call(this, "DELETE", `${H}/${t}`);
|
|
4587
4627
|
}
|
|
4588
4628
|
// ─── NPM Registry ────────────────────────────────────────────────
|
|
4589
4629
|
/**
|
|
@@ -4595,7 +4635,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4595
4635
|
* @returns The registry, scope, read-only token, and assembled `.npmrc`.
|
|
4596
4636
|
*/
|
|
4597
4637
|
async getNpmCredentials() {
|
|
4598
|
-
return await p(this, T,
|
|
4638
|
+
return await p(this, T, M).call(this, "GET", `${Ko}/credentials`);
|
|
4599
4639
|
}
|
|
4600
4640
|
// ─── Execution ───────────────────────────────────────────────────
|
|
4601
4641
|
/**
|
|
@@ -4627,7 +4667,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4627
4667
|
}
|
|
4628
4668
|
return await i.json();
|
|
4629
4669
|
}
|
|
4630
|
-
return await p(this, T,
|
|
4670
|
+
return await p(this, T, M).call(this, "POST", `${pe}/${t}/execute`, {
|
|
4631
4671
|
body: JSON.stringify(e),
|
|
4632
4672
|
query: { ...n && { versionTag: n } },
|
|
4633
4673
|
contentType: "application/json"
|
|
@@ -4648,7 +4688,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4648
4688
|
}
|
|
4649
4689
|
return await n.json();
|
|
4650
4690
|
}
|
|
4651
|
-
return await p(this, T,
|
|
4691
|
+
return await p(this, T, M).call(this, "POST", `${pe}/progress/${t}/abort`);
|
|
4652
4692
|
}
|
|
4653
4693
|
/**
|
|
4654
4694
|
* Lists all executions for a given component.
|
|
@@ -4674,7 +4714,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4674
4714
|
}
|
|
4675
4715
|
return await i.json();
|
|
4676
4716
|
}
|
|
4677
|
-
return await p(this, T,
|
|
4717
|
+
return await p(this, T, M).call(this, "GET", `${pe}/${t}/progress`, { query: { ...e && { projectId: e } } });
|
|
4678
4718
|
}
|
|
4679
4719
|
/**
|
|
4680
4720
|
* Gets details of a specific execution, including its messages.
|
|
@@ -4692,7 +4732,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4692
4732
|
}
|
|
4693
4733
|
return await n.json();
|
|
4694
4734
|
}
|
|
4695
|
-
return await p(this, T,
|
|
4735
|
+
return await p(this, T, M).call(this, "GET", `${pe}/progress/${t}`);
|
|
4696
4736
|
}
|
|
4697
4737
|
/**
|
|
4698
4738
|
* Subscribes to real-time execution progress via WebSocket.
|
|
@@ -4701,7 +4741,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4701
4741
|
* @param onUpdateCallback - Callback invoked on each progress/result event.
|
|
4702
4742
|
*/
|
|
4703
4743
|
async onExecutionProgress(t, e) {
|
|
4704
|
-
const n = this.localServerUrl ?? this.wsUrl, r = await
|
|
4744
|
+
const n = this.localServerUrl ?? this.wsUrl, r = await tn(n, {
|
|
4705
4745
|
auth: { accessToken: this.accessToken },
|
|
4706
4746
|
transports: ["websocket"]
|
|
4707
4747
|
});
|
|
@@ -4720,7 +4760,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4720
4760
|
* renderable views. See `src/core/documents.ts` for the model and schema.
|
|
4721
4761
|
*/
|
|
4722
4762
|
documents(t) {
|
|
4723
|
-
return new
|
|
4763
|
+
return new Xr(this, t);
|
|
4724
4764
|
}
|
|
4725
4765
|
/**
|
|
4726
4766
|
* A project's history of connected documents (Revit models, AutoCAD
|
|
@@ -4729,14 +4769,14 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4729
4769
|
* or write it; the storage underneath is private and will move.
|
|
4730
4770
|
*/
|
|
4731
4771
|
history(t) {
|
|
4732
|
-
return new
|
|
4772
|
+
return new qr(this, t);
|
|
4733
4773
|
}
|
|
4734
4774
|
/**
|
|
4735
4775
|
* The recipe registry and runner: scripts that write change requests in a
|
|
4736
4776
|
* native application's language. See `src/core/recipes.ts`.
|
|
4737
4777
|
*/
|
|
4738
4778
|
get recipes() {
|
|
4739
|
-
return g(this,
|
|
4779
|
+
return g(this, hn) ?? it(this, hn, new Jo(this)), g(this, hn);
|
|
4740
4780
|
}
|
|
4741
4781
|
// ─── Hidden Files ────────────────────────────────────────────────
|
|
4742
4782
|
/**
|
|
@@ -4750,7 +4790,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4750
4790
|
*/
|
|
4751
4791
|
async createHiddenFile(t, e, n) {
|
|
4752
4792
|
const r = new FormData();
|
|
4753
|
-
return r.append("file", t), r.append("parentItemId", e), n != null && r.append("tag", n), await p(this, T,
|
|
4793
|
+
return r.append("file", t), r.append("parentItemId", e), n != null && r.append("tag", n), await p(this, T, M).call(this, "POST", `${H}/${re}`, {
|
|
4754
4794
|
body: r
|
|
4755
4795
|
});
|
|
4756
4796
|
}
|
|
@@ -4768,7 +4808,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4768
4808
|
const r = new FormData();
|
|
4769
4809
|
for (const i of t)
|
|
4770
4810
|
r.append("files", i);
|
|
4771
|
-
return r.append("parentItemId", e), n != null && r.append("tag", n), await p(this, T,
|
|
4811
|
+
return r.append("parentItemId", e), n != null && r.append("tag", n), await p(this, T, M).call(this, "POST", `${H}/${re}/batch`, {
|
|
4772
4812
|
body: r
|
|
4773
4813
|
});
|
|
4774
4814
|
}
|
|
@@ -4777,21 +4817,21 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4777
4817
|
* @param hiddenId - The hidden file's unique identifier.
|
|
4778
4818
|
*/
|
|
4779
4819
|
async deleteHiddenFile(t) {
|
|
4780
|
-
return await p(this, T,
|
|
4820
|
+
return await p(this, T, M).call(this, "DELETE", `${H}/${re}/${t}`);
|
|
4781
4821
|
}
|
|
4782
4822
|
/**
|
|
4783
4823
|
* Gets metadata for a hidden file.
|
|
4784
4824
|
* @param hiddenId - The hidden file's unique identifier.
|
|
4785
4825
|
*/
|
|
4786
4826
|
async getHiddenFile(t) {
|
|
4787
|
-
return await p(this, T,
|
|
4827
|
+
return await p(this, T, M).call(this, "GET", `${H}/${re}/${t}`);
|
|
4788
4828
|
}
|
|
4789
4829
|
/**
|
|
4790
4830
|
* Downloads a hidden file's content. Returns the raw fetch Response.
|
|
4791
4831
|
* @param hiddenId - The hidden file's unique identifier.
|
|
4792
4832
|
*/
|
|
4793
4833
|
async downloadHiddenFile(t) {
|
|
4794
|
-
return await p(this, T, ve).call(this, `${
|
|
4834
|
+
return await p(this, T, ve).call(this, `${H}/${re}/${t}/download`);
|
|
4795
4835
|
}
|
|
4796
4836
|
/**
|
|
4797
4837
|
* Mints a short-lived presigned URL for a hidden file so the browser can
|
|
@@ -4811,7 +4851,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4811
4851
|
* an ISO timestamp when it stops working.
|
|
4812
4852
|
*/
|
|
4813
4853
|
async getHiddenFileSignedUrl(t, e) {
|
|
4814
|
-
return await p(this, T,
|
|
4854
|
+
return await p(this, T, M).call(this, "GET", `${H}/${re}/${t}/signed-url`, { ...e != null && { query: { expiresIn: e } } });
|
|
4815
4855
|
}
|
|
4816
4856
|
/**
|
|
4817
4857
|
* Batch variant of {@link getHiddenFileSignedUrl}. Mints presigned URLs for
|
|
@@ -4832,7 +4872,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4832
4872
|
* 900 (15 min) server-side; values are clamped to that range.
|
|
4833
4873
|
*/
|
|
4834
4874
|
async getHiddenFileSignedUrlsBatch(t, e) {
|
|
4835
|
-
return await p(this, T,
|
|
4875
|
+
return await p(this, T, Qe).call(this, t, async (n) => (await p(this, T, M).call(this, "POST", `${H}/${re}/signed-url/batch`, {
|
|
4836
4876
|
body: JSON.stringify({
|
|
4837
4877
|
hiddenFileIds: n,
|
|
4838
4878
|
...e != null && { expiresIn: e }
|
|
@@ -4848,14 +4888,14 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4848
4888
|
* @returns Array of hidden file entities.
|
|
4849
4889
|
*/
|
|
4850
4890
|
async getHiddenFilesByParent(t, e) {
|
|
4851
|
-
return await p(this, T,
|
|
4891
|
+
return await p(this, T, M).call(this, "GET", `${H}/${t}/${re}`, { ...e != null && { query: { tag: e } } });
|
|
4852
4892
|
}
|
|
4853
4893
|
/**
|
|
4854
4894
|
* Deletes all hidden files attached to a parent item.
|
|
4855
4895
|
* @param parentFileId - The parent item's unique identifier.
|
|
4856
4896
|
*/
|
|
4857
4897
|
async deleteHiddenFilesByParent(t) {
|
|
4858
|
-
return await p(this, T,
|
|
4898
|
+
return await p(this, T, M).call(this, "DELETE", `${H}/${t}/${re}`);
|
|
4859
4899
|
}
|
|
4860
4900
|
// ─── Icons ───────────────────────────────────────────────────────
|
|
4861
4901
|
/**
|
|
@@ -4867,7 +4907,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4867
4907
|
*/
|
|
4868
4908
|
async uploadItemIcon(t, e) {
|
|
4869
4909
|
const n = new FormData();
|
|
4870
|
-
return n.append("icon", e), await p(this, T,
|
|
4910
|
+
return n.append("icon", e), await p(this, T, M).call(this, "PUT", `${H}/${t}/icon`, {
|
|
4871
4911
|
body: n
|
|
4872
4912
|
});
|
|
4873
4913
|
}
|
|
@@ -4877,7 +4917,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4877
4917
|
* @returns The raw Response (use `.blob()`, `.arrayBuffer()`, or pipe the body).
|
|
4878
4918
|
*/
|
|
4879
4919
|
async getItemIcon(t) {
|
|
4880
|
-
return await p(this, T, ve).call(this, `${
|
|
4920
|
+
return await p(this, T, ve).call(this, `${H}/${t}/icon`);
|
|
4881
4921
|
}
|
|
4882
4922
|
/**
|
|
4883
4923
|
* Removes the icon from an item.
|
|
@@ -4885,7 +4925,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4885
4925
|
* @returns The updated item with icon fields removed.
|
|
4886
4926
|
*/
|
|
4887
4927
|
async removeItemIcon(t) {
|
|
4888
|
-
return await p(this, T,
|
|
4928
|
+
return await p(this, T, M).call(this, "DELETE", `${H}/${t}/icon`);
|
|
4889
4929
|
}
|
|
4890
4930
|
// ─── General Item Operations ─────────────────────────────────────
|
|
4891
4931
|
/**
|
|
@@ -4895,7 +4935,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4895
4935
|
* @returns The updated item.
|
|
4896
4936
|
*/
|
|
4897
4937
|
async updateItem(t, e) {
|
|
4898
|
-
return await p(this, T,
|
|
4938
|
+
return await p(this, T, M).call(this, "PUT", `${H}/${t}`, {
|
|
4899
4939
|
body: JSON.stringify(e),
|
|
4900
4940
|
contentType: "application/json"
|
|
4901
4941
|
});
|
|
@@ -4912,7 +4952,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4912
4952
|
*/
|
|
4913
4953
|
async createVersion(t, e, n, r, i) {
|
|
4914
4954
|
const o = new FormData();
|
|
4915
|
-
return o.append("file", e), o.append("versionTag", n), r && o.append("extraProps", JSON.stringify(r)), i && o.append("metadata", JSON.stringify(i)), await p(this, T,
|
|
4955
|
+
return o.append("file", e), o.append("versionTag", n), r && o.append("extraProps", JSON.stringify(r)), i && o.append("metadata", JSON.stringify(i)), await p(this, T, M).call(this, "POST", `${H}/${t}/version`, { body: o });
|
|
4916
4956
|
}
|
|
4917
4957
|
/**
|
|
4918
4958
|
* Lists versions of an item. Pass `archived: true` to fetch only archived
|
|
@@ -4943,7 +4983,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4943
4983
|
return `v${Math.max(n, e.length) + 1}`;
|
|
4944
4984
|
}
|
|
4945
4985
|
async listVersions(t, e = {}) {
|
|
4946
|
-
return await p(this, T,
|
|
4986
|
+
return await p(this, T, M).call(this, "GET", `${H}/${encodeURIComponent(t)}/versions`, { query: e });
|
|
4947
4987
|
}
|
|
4948
4988
|
/**
|
|
4949
4989
|
* Batch variant of {@link listVersions}. Lists the versions of many items in
|
|
@@ -4962,7 +5002,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4962
5002
|
*/
|
|
4963
5003
|
async listVersionsBatch(t, e = {}) {
|
|
4964
5004
|
const { archived: n } = e;
|
|
4965
|
-
return await p(this, T,
|
|
5005
|
+
return await p(this, T, Qe).call(this, t, async (r) => (await p(this, T, M).call(this, "POST", `${H}/batch/versions`, {
|
|
4966
5006
|
body: JSON.stringify({
|
|
4967
5007
|
itemIds: r,
|
|
4968
5008
|
...n !== void 0 && { archived: n }
|
|
@@ -4980,7 +5020,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4980
5020
|
* @returns The archived version.
|
|
4981
5021
|
*/
|
|
4982
5022
|
async archiveVersion(t, e) {
|
|
4983
|
-
return await p(this, T,
|
|
5023
|
+
return await p(this, T, M).call(this, "PUT", `${H}/${encodeURIComponent(t)}/version/${encodeURIComponent(e)}/archive`);
|
|
4984
5024
|
}
|
|
4985
5025
|
/**
|
|
4986
5026
|
* Recovers a previously archived version, restoring it to the active list.
|
|
@@ -4989,7 +5029,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4989
5029
|
* @returns The recovered version.
|
|
4990
5030
|
*/
|
|
4991
5031
|
async recoverVersion(t, e) {
|
|
4992
|
-
return await p(this, T,
|
|
5032
|
+
return await p(this, T, M).call(this, "PUT", `${H}/${encodeURIComponent(t)}/version/${encodeURIComponent(e)}/recover`);
|
|
4993
5033
|
}
|
|
4994
5034
|
/**
|
|
4995
5035
|
* Permanently deletes a version, including its file in object storage.
|
|
@@ -4998,29 +5038,29 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
|
4998
5038
|
* @param versionTag - The version's tag (e.g. "v2").
|
|
4999
5039
|
*/
|
|
5000
5040
|
async deleteVersion(t, e) {
|
|
5001
|
-
return await p(this, T,
|
|
5041
|
+
return await p(this, T, M).call(this, "DELETE", `${H}/${encodeURIComponent(t)}/version/${encodeURIComponent(e)}`);
|
|
5002
5042
|
}
|
|
5003
5043
|
};
|
|
5004
|
-
T = new WeakSet(),
|
|
5044
|
+
T = new WeakSet(), In = function(t) {
|
|
5005
5045
|
return `${this.apiUrl}/${t}`;
|
|
5006
|
-
},
|
|
5046
|
+
}, M = async function(t, e, n) {
|
|
5007
5047
|
if (t === "GET" && (n == null ? void 0 : n.responseType) !== "blob" && !(n != null && n.retryAttempt)) {
|
|
5008
|
-
const r = `${p(this, T,
|
|
5009
|
-
if (o && (o.pending || i - o.at <
|
|
5048
|
+
const r = `${p(this, T, In).call(this, e)}?${new URLSearchParams(p(this, T, cs).call(this, n == null ? void 0 : n.query)).toString()}`, i = Date.now(), o = Ye.get(r);
|
|
5049
|
+
if (o && (o.pending || i - o.at < (ea(e) ? Zo : Qo)))
|
|
5010
5050
|
return o.answer.then((l) => l === void 0 ? l : structuredClone(l));
|
|
5011
|
-
const a = { at: i, pending: !0, answer: p(this, T,
|
|
5012
|
-
return
|
|
5051
|
+
const a = { at: i, pending: !0, answer: p(this, T, is).call(this, t, e, n) };
|
|
5052
|
+
return Ye.set(r, a), a.answer.then(
|
|
5013
5053
|
() => {
|
|
5014
5054
|
a.pending = !1, a.at = Date.now();
|
|
5015
5055
|
},
|
|
5016
5056
|
() => {
|
|
5017
|
-
|
|
5057
|
+
Ye.get(r) === a && Ye.delete(r);
|
|
5018
5058
|
}
|
|
5019
5059
|
), a.answer.then((l) => l === void 0 ? l : structuredClone(l));
|
|
5020
5060
|
}
|
|
5021
|
-
return t !== "GET" &&
|
|
5022
|
-
},
|
|
5023
|
-
const { body: r, query: i, contentType: o, retries: a, responseType: l, retryAttempt: d } = n || {}, c = p(this, T,
|
|
5061
|
+
return t !== "GET" && !ta(e) && Ye.clear(), p(this, T, is).call(this, t, e, n);
|
|
5062
|
+
}, is = async function(t, e, n) {
|
|
5063
|
+
const { body: r, query: i, contentType: o, retries: a, responseType: l, retryAttempt: d } = n || {}, c = p(this, T, In).call(this, e), m = p(this, T, cs).call(this, i), w = await this.resolveAccessToken(), v = {
|
|
5024
5064
|
...m,
|
|
5025
5065
|
...this.useBearer ? {} : { accessToken: w }
|
|
5026
5066
|
};
|
|
@@ -5039,20 +5079,20 @@ T = new WeakSet(), En = function(t) {
|
|
|
5039
5079
|
);
|
|
5040
5080
|
if (!I.ok) {
|
|
5041
5081
|
const _ = await I.text().then((L) => L).catch(() => "");
|
|
5042
|
-
throw new
|
|
5082
|
+
throw new Ss(
|
|
5043
5083
|
I.status,
|
|
5044
5084
|
I.statusText,
|
|
5045
5085
|
_,
|
|
5046
|
-
|
|
5086
|
+
ra(I)
|
|
5047
5087
|
);
|
|
5048
5088
|
}
|
|
5049
5089
|
return l === "blob" ? await I.blob() : I.json().then((_) => _).catch(() => {
|
|
5050
5090
|
});
|
|
5051
5091
|
} catch (I) {
|
|
5052
5092
|
const _ = a ?? this.retries;
|
|
5053
|
-
if (_ > 0 &&
|
|
5093
|
+
if (_ > 0 && ia(I)) {
|
|
5054
5094
|
const L = d ?? 0;
|
|
5055
|
-
return await
|
|
5095
|
+
return await sa(oa(I, L)), await p(this, T, M).call(this, t, e, {
|
|
5056
5096
|
...n,
|
|
5057
5097
|
retries: _ - 1,
|
|
5058
5098
|
retryAttempt: L + 1
|
|
@@ -5061,7 +5101,7 @@ T = new WeakSet(), En = function(t) {
|
|
|
5061
5101
|
throw I;
|
|
5062
5102
|
}
|
|
5063
5103
|
}, ve = async function(t, e) {
|
|
5064
|
-
const { query: n } = e || {}, r = p(this, T,
|
|
5104
|
+
const { query: n } = e || {}, r = p(this, T, In).call(this, t), i = await this.resolveAccessToken(), o = {
|
|
5065
5105
|
...n,
|
|
5066
5106
|
...this.useBearer ? {} : { accessToken: i }
|
|
5067
5107
|
};
|
|
@@ -5074,14 +5114,14 @@ T = new WeakSet(), En = function(t) {
|
|
|
5074
5114
|
}
|
|
5075
5115
|
}
|
|
5076
5116
|
);
|
|
5077
|
-
},
|
|
5117
|
+
}, hn = new WeakMap(), Qe = async function(t, e) {
|
|
5078
5118
|
if (!t.length) return [];
|
|
5079
5119
|
const n = [];
|
|
5080
|
-
for (let i = 0; i < t.length; i +=
|
|
5081
|
-
n.push(t.slice(i, i +
|
|
5120
|
+
for (let i = 0; i < t.length; i += vr)
|
|
5121
|
+
n.push(t.slice(i, i + vr));
|
|
5082
5122
|
return (await Promise.all(n.map(e))).flat();
|
|
5083
|
-
},
|
|
5084
|
-
const { versionTag: n, withDraft: r } = e || {}, i = await p(this, T, ve).call(this, `${
|
|
5123
|
+
}, Sn = async function(t, e) {
|
|
5124
|
+
const { versionTag: n, withDraft: r } = e || {}, i = await p(this, T, ve).call(this, `${H}/${t}/download`, {
|
|
5085
5125
|
query: {
|
|
5086
5126
|
...n && { versionTag: n },
|
|
5087
5127
|
...r && { withDraft: r }
|
|
@@ -5090,17 +5130,17 @@ T = new WeakSet(), En = function(t) {
|
|
|
5090
5130
|
if (i.status === 429 || i.status >= 500)
|
|
5091
5131
|
throw new Error(`Downloading ${t} answered ${i.status}${i.status === 429 ? " (rate limited)" : ""}`);
|
|
5092
5132
|
return i;
|
|
5093
|
-
},
|
|
5133
|
+
}, _n = async function(t, e, n) {
|
|
5094
5134
|
const { name: r, versionTag: i, parentFolderId: o, projectId: a, file: l, metadata: d } = t, c = new FormData();
|
|
5095
|
-
return c.append("file", l), c.append("name", r), c.append("versionTag", i), c.append("itemType", e), o && c.append("folderId", o), a && c.append("projectId", a), n && c.append("extraProps", JSON.stringify(n)), d && c.append("metadata", JSON.stringify(d)), await p(this, T,
|
|
5135
|
+
return c.append("file", l), c.append("name", r), c.append("versionTag", i), c.append("itemType", e), o && c.append("folderId", o), a && c.append("projectId", a), n && c.append("extraProps", JSON.stringify(n)), d && c.append("metadata", JSON.stringify(d)), await p(this, T, M).call(this, "POST", H, {
|
|
5096
5136
|
body: c
|
|
5097
5137
|
});
|
|
5098
|
-
},
|
|
5138
|
+
}, os = async function(t, e, n) {
|
|
5099
5139
|
const { name: r, versionTag: i, parentFolderId: o, file: a, metadata: l } = e;
|
|
5100
5140
|
let d, c;
|
|
5101
5141
|
if (a) {
|
|
5102
5142
|
const m = new FormData();
|
|
5103
|
-
m.append("file", a), i && m.append("versionTag", i), n && m.append("extraProps", JSON.stringify(n)), l && m.append("metadata", JSON.stringify(l)), c = await p(this, T,
|
|
5143
|
+
m.append("file", a), i && m.append("versionTag", i), n && m.append("extraProps", JSON.stringify(n)), l && m.append("metadata", JSON.stringify(l)), c = await p(this, T, M).call(this, "POST", `${H}/${t}/version`, {
|
|
5104
5144
|
body: m
|
|
5105
5145
|
});
|
|
5106
5146
|
}
|
|
@@ -5109,25 +5149,25 @@ T = new WeakSet(), En = function(t) {
|
|
|
5109
5149
|
...r && { name: r },
|
|
5110
5150
|
...o && { folderId: o }
|
|
5111
5151
|
}, w = JSON.stringify(m);
|
|
5112
|
-
d = await p(this, T,
|
|
5152
|
+
d = await p(this, T, M).call(this, "PUT", `${H}/${t}`, {
|
|
5113
5153
|
body: w,
|
|
5114
5154
|
contentType: "application/json"
|
|
5115
5155
|
});
|
|
5116
5156
|
}
|
|
5117
5157
|
return { item: d, version: c };
|
|
5118
|
-
},
|
|
5158
|
+
}, as = async function(t, e) {
|
|
5119
5159
|
const { showVersions: n = !1 } = e || {};
|
|
5120
|
-
return await p(this, T,
|
|
5160
|
+
return await p(this, T, M).call(this, "GET", `${H}/${t}`, {
|
|
5121
5161
|
query: { showVersions: n }
|
|
5122
5162
|
});
|
|
5123
|
-
},
|
|
5163
|
+
}, cs = function(t) {
|
|
5124
5164
|
return t && Object.entries(t).filter(([, e]) => e !== void 0).reduce(
|
|
5125
5165
|
(e, [n, r]) => (e[n] = r, e),
|
|
5126
5166
|
{}
|
|
5127
5167
|
);
|
|
5128
5168
|
};
|
|
5129
|
-
let
|
|
5130
|
-
function
|
|
5169
|
+
let rs = _s;
|
|
5170
|
+
function aa() {
|
|
5131
5171
|
if (typeof window > "u" || window.parent === window)
|
|
5132
5172
|
throw new Error(
|
|
5133
5173
|
"client.channel only works inside a That Open app, which runs in an iframe of the platform."
|
|
@@ -5142,24 +5182,24 @@ function ta() {
|
|
|
5142
5182
|
}
|
|
5143
5183
|
};
|
|
5144
5184
|
}
|
|
5145
|
-
const
|
|
5146
|
-
function
|
|
5185
|
+
const ls = "channel:", ca = 1e4;
|
|
5186
|
+
function An(s) {
|
|
5147
5187
|
try {
|
|
5148
5188
|
s();
|
|
5149
5189
|
} catch (t) {
|
|
5150
5190
|
console.error("[channel] a listener threw:", t);
|
|
5151
5191
|
}
|
|
5152
5192
|
}
|
|
5153
|
-
var ce, Dt, Ut,
|
|
5154
|
-
class
|
|
5193
|
+
var ce, Dt, Ut, Le, Pe, Be, Lt, hs, ds, Me;
|
|
5194
|
+
class ui {
|
|
5155
5195
|
constructor(t, e) {
|
|
5156
5196
|
K(this, Lt);
|
|
5157
5197
|
K(this, ce, !1);
|
|
5158
5198
|
K(this, Dt, []);
|
|
5159
5199
|
K(this, Ut, []);
|
|
5160
|
-
K(this, Fe, /* @__PURE__ */ new Set());
|
|
5161
5200
|
K(this, Le, /* @__PURE__ */ new Set());
|
|
5162
5201
|
K(this, Pe, /* @__PURE__ */ new Set());
|
|
5202
|
+
K(this, Be, /* @__PURE__ */ new Set());
|
|
5163
5203
|
this.transport = t, this.controls = e;
|
|
5164
5204
|
}
|
|
5165
5205
|
/** Whether the platform has confirmed this tab is in the room. */
|
|
@@ -5175,42 +5215,42 @@ class ci {
|
|
|
5175
5215
|
* refuses or does not answer in time. Joining twice is harmless.
|
|
5176
5216
|
*/
|
|
5177
5217
|
join() {
|
|
5178
|
-
return g(this, ce) ? Promise.resolve() : p(this, Lt,
|
|
5218
|
+
return g(this, ce) ? Promise.resolve() : p(this, Lt, hs).call(this, "joined", this.controls.join);
|
|
5179
5219
|
}
|
|
5180
5220
|
/** Leaves the room. Handlers stay registered, so `join()` resumes them. */
|
|
5181
5221
|
leave() {
|
|
5182
|
-
return !g(this, ce) && !g(this, Ut).some((t) => t.want === "joined") ? Promise.resolve() : p(this, Lt,
|
|
5222
|
+
return !g(this, ce) && !g(this, Ut).some((t) => t.want === "joined") ? Promise.resolve() : p(this, Lt, hs).call(this, "left", this.controls.leave);
|
|
5183
5223
|
}
|
|
5184
5224
|
/** Fires when `joined` or `peers` changes. Returns a function that stops it. */
|
|
5185
5225
|
onChange(t) {
|
|
5186
|
-
return g(this,
|
|
5226
|
+
return g(this, Le).add(t), () => void g(this, Le).delete(t);
|
|
5187
5227
|
}
|
|
5188
5228
|
onPeerJoined(t) {
|
|
5189
|
-
return g(this,
|
|
5229
|
+
return g(this, Pe).add(t), () => void g(this, Pe).delete(t);
|
|
5190
5230
|
}
|
|
5191
5231
|
onPeerLeft(t) {
|
|
5192
|
-
return g(this,
|
|
5232
|
+
return g(this, Be).add(t), () => void g(this, Be).delete(t);
|
|
5193
5233
|
}
|
|
5194
5234
|
/** @internal */
|
|
5195
5235
|
applyJoined() {
|
|
5196
|
-
it(this, ce, !0), p(this, Lt,
|
|
5236
|
+
it(this, ce, !0), p(this, Lt, ds).call(this, "joined"), p(this, Lt, Me).call(this);
|
|
5197
5237
|
}
|
|
5198
5238
|
/** @internal */
|
|
5199
5239
|
applyLeft() {
|
|
5200
|
-
it(this, ce, !1), it(this, Dt, []), p(this, Lt,
|
|
5240
|
+
it(this, ce, !1), it(this, Dt, []), p(this, Lt, ds).call(this, "left"), p(this, Lt, Me).call(this);
|
|
5201
5241
|
}
|
|
5202
5242
|
/** @internal */
|
|
5203
5243
|
applyPeers(t) {
|
|
5204
|
-
it(this, Dt, t), p(this, Lt,
|
|
5244
|
+
it(this, Dt, t), p(this, Lt, Me).call(this);
|
|
5205
5245
|
}
|
|
5206
5246
|
/** @internal */
|
|
5207
5247
|
applyPeerJoined(t) {
|
|
5208
|
-
!g(this, ce) || g(this, Dt).some((e) => e.from === t.from) || (it(this, Dt, [...g(this, Dt), t]), g(this,
|
|
5248
|
+
!g(this, ce) || g(this, Dt).some((e) => e.from === t.from) || (it(this, Dt, [...g(this, Dt), t]), g(this, Pe).forEach((e) => An(() => e(t))), p(this, Lt, Me).call(this));
|
|
5209
5249
|
}
|
|
5210
5250
|
/** @internal */
|
|
5211
5251
|
applyPeerLeft(t) {
|
|
5212
5252
|
const e = g(this, Dt).find((n) => n.from === t);
|
|
5213
|
-
e && (it(this, Dt, g(this, Dt).filter((n) => n.from !== t)), g(this,
|
|
5253
|
+
e && (it(this, Dt, g(this, Dt).filter((n) => n.from !== t)), g(this, Be).forEach((n) => An(() => n(e))), p(this, Lt, Me).call(this));
|
|
5214
5254
|
}
|
|
5215
5255
|
/** @internal */
|
|
5216
5256
|
failPending(t) {
|
|
@@ -5223,7 +5263,7 @@ class ci {
|
|
|
5223
5263
|
this.transport.post(t);
|
|
5224
5264
|
}
|
|
5225
5265
|
}
|
|
5226
|
-
ce = new WeakMap(), Dt = new WeakMap(), Ut = new WeakMap(),
|
|
5266
|
+
ce = new WeakMap(), Dt = new WeakMap(), Ut = new WeakMap(), Le = new WeakMap(), Pe = new WeakMap(), Be = new WeakMap(), Lt = new WeakSet(), hs = function(t, e) {
|
|
5227
5267
|
return new Promise((n, r) => {
|
|
5228
5268
|
const i = {
|
|
5229
5269
|
want: t,
|
|
@@ -5235,58 +5275,58 @@ ce = new WeakMap(), Dt = new WeakMap(), Ut = new WeakMap(), Fe = new WeakMap(),
|
|
|
5235
5275
|
`The platform did not confirm ${t === "joined" ? "joining" : "leaving"} in time.`
|
|
5236
5276
|
)
|
|
5237
5277
|
);
|
|
5238
|
-
},
|
|
5278
|
+
}, ca)
|
|
5239
5279
|
};
|
|
5240
5280
|
g(this, Ut).push(i), this.transport.post({ type: "APP_CHANNEL_CONTROL", ...e });
|
|
5241
5281
|
});
|
|
5242
|
-
},
|
|
5282
|
+
}, ds = function(t) {
|
|
5243
5283
|
const e = g(this, Ut).filter((n) => n.want === t);
|
|
5244
5284
|
it(this, Ut, g(this, Ut).filter((n) => n.want !== t)), e.forEach((n) => {
|
|
5245
5285
|
clearTimeout(n.timer), n.resolve();
|
|
5246
5286
|
});
|
|
5247
|
-
},
|
|
5248
|
-
g(this,
|
|
5287
|
+
}, Me = function() {
|
|
5288
|
+
g(this, Le).forEach((t) => An(t));
|
|
5249
5289
|
};
|
|
5250
|
-
var
|
|
5251
|
-
class
|
|
5290
|
+
var je;
|
|
5291
|
+
class la extends ui {
|
|
5252
5292
|
/** @internal Use `client.channel.collab()`. */
|
|
5253
5293
|
constructor(e) {
|
|
5254
5294
|
super(e, {
|
|
5255
5295
|
join: { action: "joinCollab" },
|
|
5256
5296
|
leave: { action: "leaveCollab" }
|
|
5257
5297
|
});
|
|
5258
|
-
K(this,
|
|
5298
|
+
K(this, je, /* @__PURE__ */ new Map());
|
|
5259
5299
|
}
|
|
5260
5300
|
/**
|
|
5261
5301
|
* Listens for an event other tabs send. Any number of listeners per event.
|
|
5262
5302
|
* @returns a function that removes the listener.
|
|
5263
5303
|
*/
|
|
5264
5304
|
on(e, n) {
|
|
5265
|
-
const r = g(this,
|
|
5266
|
-
return r.add(n), g(this,
|
|
5305
|
+
const r = g(this, je).get(e) ?? /* @__PURE__ */ new Set();
|
|
5306
|
+
return r.add(n), g(this, je).set(e, r), () => void r.delete(n);
|
|
5267
5307
|
}
|
|
5268
5308
|
/**
|
|
5269
5309
|
* Sends an event to the other tabs in the room. Does nothing while this tab
|
|
5270
5310
|
* is not in it, matching what the platform does with a message from outside.
|
|
5271
5311
|
*/
|
|
5272
5312
|
send(e, n) {
|
|
5273
|
-
if (e.startsWith(
|
|
5274
|
-
throw new Error(`Message types starting with '${
|
|
5313
|
+
if (e.startsWith(ls))
|
|
5314
|
+
throw new Error(`Message types starting with '${ls}' are reserved.`);
|
|
5275
5315
|
this.joined && this.post({ type: "APP_CHANNEL_PUBLISH", message: { type: e, payload: n } });
|
|
5276
5316
|
}
|
|
5277
5317
|
accepts(e) {
|
|
5278
5318
|
return e === void 0 || e === "collab";
|
|
5279
5319
|
}
|
|
5280
5320
|
async handle(e) {
|
|
5281
|
-
const n = g(this,
|
|
5321
|
+
const n = g(this, je).get(e.type);
|
|
5282
5322
|
if (!(n != null && n.size)) return { handled: !1 };
|
|
5283
|
-
const r =
|
|
5284
|
-
return n.forEach((i) =>
|
|
5323
|
+
const r = pi(e);
|
|
5324
|
+
return n.forEach((i) => An(() => i(e.payload, r))), { handled: !0 };
|
|
5285
5325
|
}
|
|
5286
5326
|
}
|
|
5287
|
-
|
|
5327
|
+
je = new WeakMap();
|
|
5288
5328
|
var Te;
|
|
5289
|
-
class
|
|
5329
|
+
class ha extends ui {
|
|
5290
5330
|
/** @internal Use `client.channel.external(kind)`. */
|
|
5291
5331
|
constructor(e, n) {
|
|
5292
5332
|
super(e, {
|
|
@@ -5324,7 +5364,7 @@ class sa extends ci {
|
|
|
5324
5364
|
const n = g(this, Te).get(e.type);
|
|
5325
5365
|
if (!n) return { handled: !1 };
|
|
5326
5366
|
try {
|
|
5327
|
-
return { handled: !0, value: await n(e.payload,
|
|
5367
|
+
return { handled: !0, value: await n(e.payload, pi(e)) };
|
|
5328
5368
|
} catch (r) {
|
|
5329
5369
|
return {
|
|
5330
5370
|
handled: !0,
|
|
@@ -5334,7 +5374,7 @@ class sa extends ci {
|
|
|
5334
5374
|
}
|
|
5335
5375
|
}
|
|
5336
5376
|
Te = new WeakMap();
|
|
5337
|
-
function
|
|
5377
|
+
function pi(s) {
|
|
5338
5378
|
return {
|
|
5339
5379
|
from: s.from,
|
|
5340
5380
|
at: s.at,
|
|
@@ -5342,7 +5382,7 @@ function li(s) {
|
|
|
5342
5382
|
kind: s.kind
|
|
5343
5383
|
};
|
|
5344
5384
|
}
|
|
5345
|
-
function
|
|
5385
|
+
function da(s) {
|
|
5346
5386
|
const t = s;
|
|
5347
5387
|
if ((t == null ? void 0 : t.type) !== "THATOPEN_CHANNEL_MESSAGE") return null;
|
|
5348
5388
|
const e = t.message;
|
|
@@ -5356,20 +5396,20 @@ function ra(s) {
|
|
|
5356
5396
|
kind: typeof e.kind == "string" ? e.kind : void 0
|
|
5357
5397
|
};
|
|
5358
5398
|
}
|
|
5359
|
-
var Oe,
|
|
5360
|
-
class
|
|
5399
|
+
var Oe, dn, le, Ee, Ie, xt, fs, On, mi, gi, yi, us;
|
|
5400
|
+
class fa {
|
|
5361
5401
|
constructor(t) {
|
|
5362
|
-
K(this,
|
|
5402
|
+
K(this, xt);
|
|
5363
5403
|
K(this, Oe);
|
|
5364
|
-
K(this,
|
|
5404
|
+
K(this, dn);
|
|
5365
5405
|
K(this, le);
|
|
5366
5406
|
K(this, Ee, /* @__PURE__ */ new Map());
|
|
5367
5407
|
K(this, Ie, /* @__PURE__ */ new Set());
|
|
5368
|
-
it(this, Oe, t), it(this,
|
|
5408
|
+
it(this, Oe, t), it(this, dn, t.listen((e) => void p(this, xt, mi).call(this, e)));
|
|
5369
5409
|
}
|
|
5370
5410
|
/** The collaboration room for this app. Always the same instance. */
|
|
5371
5411
|
collab() {
|
|
5372
|
-
return g(this, le) ?? it(this, le, new
|
|
5412
|
+
return g(this, le) ?? it(this, le, new la(g(this, Oe))), g(this, le);
|
|
5373
5413
|
}
|
|
5374
5414
|
/**
|
|
5375
5415
|
* The room for commands from this account's external tools of one `kind`
|
|
@@ -5379,40 +5419,40 @@ class ia {
|
|
|
5379
5419
|
external(t) {
|
|
5380
5420
|
const e = t ?? "";
|
|
5381
5421
|
let n = g(this, Ee).get(e);
|
|
5382
|
-
return n || (n = new
|
|
5422
|
+
return n || (n = new ha(g(this, Oe), t), g(this, Ee).set(e, n)), n;
|
|
5383
5423
|
}
|
|
5384
5424
|
/** Stops listening. For tests and teardown; an app normally never calls it. */
|
|
5385
5425
|
dispose() {
|
|
5386
|
-
g(this,
|
|
5426
|
+
g(this, dn).call(this);
|
|
5387
5427
|
}
|
|
5388
5428
|
}
|
|
5389
|
-
Oe = new WeakMap(),
|
|
5429
|
+
Oe = new WeakMap(), dn = new WeakMap(), le = new WeakMap(), Ee = new WeakMap(), Ie = new WeakMap(), xt = new WeakSet(), fs = function() {
|
|
5390
5430
|
return [...g(this, le) ? [g(this, le)] : [], ...g(this, Ee).values()];
|
|
5391
|
-
},
|
|
5431
|
+
}, On = function(t, e) {
|
|
5392
5432
|
if (t === "collab") return g(this, le);
|
|
5393
5433
|
if (t === "external")
|
|
5394
5434
|
return g(this, Ee).get(typeof e == "string" ? e : "");
|
|
5395
|
-
},
|
|
5396
|
-
const e =
|
|
5435
|
+
}, mi = async function(t) {
|
|
5436
|
+
const e = da(t);
|
|
5397
5437
|
if (e) {
|
|
5398
|
-
if (e.type.startsWith(
|
|
5399
|
-
p(this,
|
|
5438
|
+
if (e.type.startsWith(ls)) {
|
|
5439
|
+
p(this, xt, gi).call(this, e);
|
|
5400
5440
|
return;
|
|
5401
5441
|
}
|
|
5402
|
-
await p(this,
|
|
5442
|
+
await p(this, xt, yi).call(this, e);
|
|
5403
5443
|
}
|
|
5404
|
-
},
|
|
5444
|
+
}, gi = function(t) {
|
|
5405
5445
|
var n, r, i;
|
|
5406
5446
|
const e = t.payload ?? {};
|
|
5407
5447
|
switch (t.type) {
|
|
5408
5448
|
case "channel:joined":
|
|
5409
|
-
(n = p(this,
|
|
5449
|
+
(n = p(this, xt, On).call(this, e.scope, e.kind)) == null || n.applyJoined();
|
|
5410
5450
|
break;
|
|
5411
5451
|
case "channel:left":
|
|
5412
|
-
(r = p(this,
|
|
5452
|
+
(r = p(this, xt, On).call(this, e.scope, e.kind)) == null || r.applyLeft();
|
|
5413
5453
|
break;
|
|
5414
5454
|
case "channel:peers":
|
|
5415
|
-
(i = p(this,
|
|
5455
|
+
(i = p(this, xt, On).call(this, e.scope, e.kind)) == null || i.applyPeers(e.peers ?? []);
|
|
5416
5456
|
break;
|
|
5417
5457
|
case "channel:peer-joined":
|
|
5418
5458
|
case "channel:peer-left": {
|
|
@@ -5426,22 +5466,22 @@ Oe = new WeakMap(), hn = new WeakMap(), le = new WeakMap(), Ee = new WeakMap(),
|
|
|
5426
5466
|
}
|
|
5427
5467
|
case "channel:error": {
|
|
5428
5468
|
const o = new Error(String(t.payload));
|
|
5429
|
-
p(this,
|
|
5469
|
+
p(this, xt, fs).call(this).map((l) => l.failPending(o)).some(Boolean) || console.error("[channel] error:", t.payload);
|
|
5430
5470
|
break;
|
|
5431
5471
|
}
|
|
5432
5472
|
}
|
|
5433
|
-
},
|
|
5434
|
-
const e = p(this,
|
|
5473
|
+
}, yi = async function(t) {
|
|
5474
|
+
const e = p(this, xt, fs).call(this).filter((i) => i.accepts(t.scope, t.kind));
|
|
5435
5475
|
let n = !1;
|
|
5436
5476
|
for (const i of e) {
|
|
5437
5477
|
const o = await i.handle(t);
|
|
5438
|
-
o.handled && (n = !0, t.requestId && p(this,
|
|
5478
|
+
o.handled && (n = !0, t.requestId && p(this, xt, us).call(this, t.requestId, o));
|
|
5439
5479
|
}
|
|
5440
|
-
t.requestId && t.scope === "external" && e.length > 0 && !n && p(this,
|
|
5480
|
+
t.requestId && t.scope === "external" && e.length > 0 && !n && p(this, xt, us).call(this, t.requestId, {
|
|
5441
5481
|
handled: !0,
|
|
5442
5482
|
error: `No handler for "${t.type}".`
|
|
5443
5483
|
});
|
|
5444
|
-
},
|
|
5484
|
+
}, us = function(t, e) {
|
|
5445
5485
|
g(this, Ie).has(t) || (g(this, Ie).add(t), g(this, Ie).size > 500 && g(this, Ie).delete(g(this, Ie).values().next().value), g(this, Oe).post({
|
|
5446
5486
|
type: "APP_CHANNEL_PUBLISH",
|
|
5447
5487
|
message: {
|
|
@@ -5451,9 +5491,9 @@ Oe = new WeakMap(), hn = new WeakMap(), le = new WeakMap(), Ee = new WeakMap(),
|
|
|
5451
5491
|
}
|
|
5452
5492
|
}));
|
|
5453
5493
|
};
|
|
5454
|
-
const _e = "project",
|
|
5455
|
-
var
|
|
5456
|
-
const
|
|
5494
|
+
const _e = "project", Ce = "notifications";
|
|
5495
|
+
var De, fn;
|
|
5496
|
+
const As = class As extends rs {
|
|
5457
5497
|
/**
|
|
5458
5498
|
* @param token - A bearer JWT, OR a function returning the current JWT
|
|
5459
5499
|
* (sync or async). When a function is passed, it's invoked before every
|
|
@@ -5464,12 +5504,12 @@ const Ss = class Ss extends ns {
|
|
|
5464
5504
|
*/
|
|
5465
5505
|
constructor(e, n, r) {
|
|
5466
5506
|
super(typeof e == "string" ? e : "", n, { ...r, useBearer: !0 });
|
|
5467
|
-
K(this,
|
|
5468
|
-
K(this,
|
|
5469
|
-
typeof e == "function" && it(this,
|
|
5507
|
+
K(this, De);
|
|
5508
|
+
K(this, fn);
|
|
5509
|
+
typeof e == "function" && it(this, De, e);
|
|
5470
5510
|
}
|
|
5471
5511
|
async resolveAccessToken() {
|
|
5472
|
-
return g(this,
|
|
5512
|
+
return g(this, De) ? await g(this, De).call(this) : super.resolveAccessToken();
|
|
5473
5513
|
}
|
|
5474
5514
|
/**
|
|
5475
5515
|
* Creates a client from the platform context injected into
|
|
@@ -5478,7 +5518,7 @@ const Ss = class Ss extends ns {
|
|
|
5478
5518
|
* carries a fresh JWT on every navigation.
|
|
5479
5519
|
*/
|
|
5480
5520
|
static fromPlatformContext(e) {
|
|
5481
|
-
const n = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, r = new
|
|
5521
|
+
const n = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, r = new As(n.accessToken, n.apiUrl, e);
|
|
5482
5522
|
return r.context = n, r;
|
|
5483
5523
|
}
|
|
5484
5524
|
/**
|
|
@@ -5506,7 +5546,7 @@ const Ss = class Ss extends ns {
|
|
|
5506
5546
|
* ```
|
|
5507
5547
|
*/
|
|
5508
5548
|
get channel() {
|
|
5509
|
-
return g(this,
|
|
5549
|
+
return g(this, fn) ?? it(this, fn, new fa(aa())), g(this, fn);
|
|
5510
5550
|
}
|
|
5511
5551
|
// ─── Projects (JWT-only backend routes) ──────────────────────────
|
|
5512
5552
|
/**
|
|
@@ -5603,7 +5643,7 @@ const Ss = class Ss extends ns {
|
|
|
5603
5643
|
* ```
|
|
5604
5644
|
*/
|
|
5605
5645
|
async getNotifications(e) {
|
|
5606
|
-
return await this.request("GET",
|
|
5646
|
+
return await this.request("GET", Ce, {
|
|
5607
5647
|
query: {
|
|
5608
5648
|
...(e == null ? void 0 : e.cursor) !== void 0 && { cursor: e.cursor },
|
|
5609
5649
|
...(e == null ? void 0 : e.limit) !== void 0 && { limit: String(e.limit) }
|
|
@@ -5617,7 +5657,7 @@ const Ss = class Ss extends ns {
|
|
|
5617
5657
|
async getUnreadNotificationCount() {
|
|
5618
5658
|
return (await this.request(
|
|
5619
5659
|
"GET",
|
|
5620
|
-
`${
|
|
5660
|
+
`${Ce}/unread-count`
|
|
5621
5661
|
)).count;
|
|
5622
5662
|
}
|
|
5623
5663
|
/**
|
|
@@ -5628,7 +5668,7 @@ const Ss = class Ss extends ns {
|
|
|
5628
5668
|
async markNotificationsRead(e) {
|
|
5629
5669
|
return await this.request(
|
|
5630
5670
|
"POST",
|
|
5631
|
-
`${
|
|
5671
|
+
`${Ce}/mark-read`,
|
|
5632
5672
|
{
|
|
5633
5673
|
body: JSON.stringify({ ids: e }),
|
|
5634
5674
|
contentType: "application/json"
|
|
@@ -5639,7 +5679,7 @@ const Ss = class Ss extends ns {
|
|
|
5639
5679
|
async markAllNotificationsRead() {
|
|
5640
5680
|
return await this.request(
|
|
5641
5681
|
"POST",
|
|
5642
|
-
`${
|
|
5682
|
+
`${Ce}/mark-all-read`
|
|
5643
5683
|
);
|
|
5644
5684
|
}
|
|
5645
5685
|
/**
|
|
@@ -5649,7 +5689,7 @@ const Ss = class Ss extends ns {
|
|
|
5649
5689
|
async getNotificationSubscriptions() {
|
|
5650
5690
|
return await this.request(
|
|
5651
5691
|
"GET",
|
|
5652
|
-
`${
|
|
5692
|
+
`${Ce}/subscriptions`
|
|
5653
5693
|
);
|
|
5654
5694
|
}
|
|
5655
5695
|
/**
|
|
@@ -5663,7 +5703,7 @@ const Ss = class Ss extends ns {
|
|
|
5663
5703
|
async unsubscribeFromAutomation(e) {
|
|
5664
5704
|
return await this.request(
|
|
5665
5705
|
"DELETE",
|
|
5666
|
-
`${
|
|
5706
|
+
`${Ce}/subscriptions/${e}`
|
|
5667
5707
|
);
|
|
5668
5708
|
}
|
|
5669
5709
|
/**
|
|
@@ -5738,7 +5778,7 @@ const Ss = class Ss extends ns {
|
|
|
5738
5778
|
* ```
|
|
5739
5779
|
*/
|
|
5740
5780
|
async onNotification(e) {
|
|
5741
|
-
const n = await this.resolveAccessToken(), r =
|
|
5781
|
+
const n = await this.resolveAccessToken(), r = tn(`${this.socketOrigin}/notifications`, {
|
|
5742
5782
|
auth: { accessToken: n },
|
|
5743
5783
|
transports: ["websocket"]
|
|
5744
5784
|
});
|
|
@@ -5754,9 +5794,9 @@ const Ss = class Ss extends ns {
|
|
|
5754
5794
|
), () => r.disconnect();
|
|
5755
5795
|
}
|
|
5756
5796
|
};
|
|
5757
|
-
|
|
5758
|
-
let
|
|
5759
|
-
const me = 1 / 0.3048,
|
|
5797
|
+
De = new WeakMap(), fn = new WeakMap();
|
|
5798
|
+
let Tr = As;
|
|
5799
|
+
const me = 1 / 0.3048, ua = {
|
|
5760
5800
|
IFCDOOR: "OST_Doors",
|
|
5761
5801
|
IFCWINDOW: "OST_Windows",
|
|
5762
5802
|
IFCFURNITURE: "OST_Furniture",
|
|
@@ -5771,13 +5811,13 @@ const me = 1 / 0.3048, oa = {
|
|
|
5771
5811
|
IFCELECTRICAPPLIANCE: "OST_ElectricalEquipment",
|
|
5772
5812
|
IFCELECTRICDISTRIBUTIONBOARD: "OST_ElectricalEquipment",
|
|
5773
5813
|
IFCUNITARYEQUIPMENT: "OST_MechanicalEquipment"
|
|
5774
|
-
},
|
|
5814
|
+
}, pa = "OST_GenericModel", ma = /* @__PURE__ */ new Set(["IFCSPACE", "IFCOPENINGELEMENT", "IFCSITE", "IFCANNOTATION", "IFCGRID", "IFCVIRTUALELEMENT", "IFCBUILDING", "IFCBUILDINGSTOREY"]), be = (s, t) => Math.round(s / t) * t, ga = (s) => ({
|
|
5775
5815
|
x: [s[0], s[1], s[2]],
|
|
5776
5816
|
y: [s[4], s[5], s[6]],
|
|
5777
5817
|
z: [s[8], s[9], s[10]],
|
|
5778
5818
|
t: [s[12], s[13], s[14]]
|
|
5779
|
-
}),
|
|
5780
|
-
function
|
|
5819
|
+
}), en = (s, t) => s[0] * t[0] + s[1] * t[1] + s[2] * t[2], Vn = (s) => Math.sqrt(en(s, s)), $n = (s, t) => [s[1] * t[2] - s[2] * t[1], s[2] * t[0] - s[0] * t[2], s[0] * t[1] - s[1] * t[0]];
|
|
5820
|
+
function ya(s, t, e) {
|
|
5781
5821
|
const n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map();
|
|
5782
5822
|
for (const l of t) {
|
|
5783
5823
|
const d = l.split(":")[1];
|
|
@@ -5785,11 +5825,11 @@ function ha(s, t, e) {
|
|
|
5785
5825
|
}
|
|
5786
5826
|
const i = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), a = [];
|
|
5787
5827
|
for (const l of s.elements.values()) {
|
|
5788
|
-
if (n.has(l.gid) ||
|
|
5789
|
-
const c = /^IFCCOLUMN$/i.test(l.ifcClass) && /structural|estructural|结构柱|tragend|tragwerk/i.test(`${l.typeName ?? ""} ${l.objectType ?? ""} ${l.name ?? ""}`) ? "OST_StructuralColumns" :
|
|
5828
|
+
if (n.has(l.gid) || ma.has(l.ifcClass.toUpperCase()) || l.parent && n.has(l.parent) && !/^IFC(DOOR|WINDOW)$/i.test(l.ifcClass) || l.pieces.length === 0) continue;
|
|
5829
|
+
const c = /^IFCCOLUMN$/i.test(l.ifcClass) && /structural|estructural|结构柱|tragend|tragwerk/i.test(`${l.typeName ?? ""} ${l.objectType ?? ""} ${l.name ?? ""}`) ? "OST_StructuralColumns" : ua[l.ifcClass.toUpperCase()] ?? pa, m = ga(l.pieces[0].matrix), w = Vn(m.x), v = Vn(m.y), I = Vn(m.z), _ = m.z.map((q) => q / (I || 1)), L = Math.abs(_[2] - 1) < 1e-6 && en($n(m.x, m.y), m.z) > 0 && Math.abs(w - v) < 1e-6 && Math.abs(w - I) < 1e-6, $ = en($n(m.x, m.y), m.z) > 0 && Math.abs(w - v) < 1e-6 && Math.abs(w - I) < 1e-6, O = [m.x, m.y, m.z].map((q) => q.map((Z) => Z / (w || 1))), u = $ && !L && O.some((q) => Math.abs(Math.abs(q[2]) - 1) < 1e-6) ? O.find((q) => Math.abs(q[2]) < 1e-6) : void 0, x = L ? Math.atan2(m.x[1], m.x[0]) : u ? Math.atan2(u[1], u[0]) : 0, E = Math.cos(-x), F = Math.sin(-x), z = [m.t[0], m.t[1], m.t[2]], ut = /COLUMN/i.test(c), wt = (q) => {
|
|
5790
5830
|
const Z = q[0] - z[0], k = q[1] - z[1];
|
|
5791
|
-
return [E * Z -
|
|
5792
|
-
},
|
|
5831
|
+
return [E * Z - F * k, F * Z + E * k, q[2] - z[2]];
|
|
5832
|
+
}, $t = [], Vt = [c];
|
|
5793
5833
|
for (const q of l.pieces) {
|
|
5794
5834
|
const Z = s.geometries.get(q.geometry);
|
|
5795
5835
|
if (!Z) continue;
|
|
@@ -5798,23 +5838,23 @@ function ha(s, t, e) {
|
|
|
5798
5838
|
const rt = Z.verts[st], et = Z.verts[st + 1], At = Z.verts[st + 2], Ht = [k[0] * rt + k[4] * et + k[8] * At + k[12], k[1] * rt + k[5] * et + k[9] * At + k[13], k[2] * rt + k[6] * et + k[10] * At + k[14]], de = wt(Ht);
|
|
5799
5839
|
Tt.push(be(de[0] * me, 1e-5), be(de[1] * me, 1e-5), be(de[2] * me, 1e-5));
|
|
5800
5840
|
}
|
|
5801
|
-
const Et =
|
|
5841
|
+
const Et = en($n([k[0], k[1], k[2]], [k[4], k[5], k[6]]), [k[8], k[9], k[10]]) < 0, pt = [];
|
|
5802
5842
|
for (let st = 0; st + 2 < Z.tris.length; st += 3)
|
|
5803
5843
|
Et ? pt.push(Z.tris[st], Z.tris[st + 2], Z.tris[st + 1]) : pt.push(Z.tris[st], Z.tris[st + 1], Z.tris[st + 2]);
|
|
5804
|
-
pt.length &&
|
|
5805
|
-
const jt = wt([k[12], k[13], k[14]]), Ft = [E * k[0] -
|
|
5844
|
+
pt.length && $t.push({ v: Tt, t: pt });
|
|
5845
|
+
const jt = wt([k[12], k[13], k[14]]), Ft = [E * k[0] - F * k[1], F * k[0] + E * k[1], k[2]], Pt = [E * k[4] - F * k[5], F * k[4] + E * k[5], k[6]];
|
|
5806
5846
|
Vt.push(`${q.geometry}@${[...jt, ...Ft, ...Pt].map((st) => be(st, 1e-4).toFixed(4)).join(",")}`);
|
|
5807
5847
|
}
|
|
5808
|
-
if (
|
|
5809
|
-
const Nt = !l.host &&
|
|
5848
|
+
if ($t.length === 0) continue;
|
|
5849
|
+
const Nt = !l.host && $t.length === 1 ? ba($t[0]) : null;
|
|
5810
5850
|
if (Nt) {
|
|
5811
|
-
const q =
|
|
5851
|
+
const q = va(Nt), Z = q.key, k = `prism|${c}|${q.axis}|${Z}`;
|
|
5812
5852
|
let Tt = i.get(k);
|
|
5813
5853
|
if (!Tt) {
|
|
5814
|
-
const et =
|
|
5854
|
+
const et = Er(l.typeName ?? l.objectType ?? l.name ?? l.ifcClass), At = (o.get(et) ?? 0) + 1;
|
|
5815
5855
|
o.set(et, At);
|
|
5816
5856
|
const Ht = At === 1 ? et : `${et} (${At})`;
|
|
5817
|
-
Tt = { family: Ht, type: Ht, first: !0, key:
|
|
5857
|
+
Tt = { family: Ht, type: Ht, first: !0, key: Ir(k) }, i.set(k, Tt);
|
|
5818
5858
|
}
|
|
5819
5859
|
const Et = { ShapeCategory: c, Family: Tt.family, Type: Tt.type, ShapeKey: Tt.key, PrismLength: String(be(Nt.length, 1e-5)), ...ut ? { ColumnFree: "1" } : {} };
|
|
5820
5860
|
Tt.first && (Et.Prism = JSON.stringify({ axis: q.axis, loops: q.loops }), Tt.first = !1);
|
|
@@ -5826,13 +5866,13 @@ function ha(s, t, e) {
|
|
|
5826
5866
|
a.push({ key: `${e}:${l.gid}:shape`, attrs: Et, at: rt, rotationDeg: (x + q.turn) * 180 / Math.PI });
|
|
5827
5867
|
continue;
|
|
5828
5868
|
}
|
|
5829
|
-
const he = `${c}|${
|
|
5869
|
+
const he = `${c}|${$t.map((q) => `${q.v.map((Z) => Math.round(Z * 304.8 / 2)).join(",")}/${q.t.join(",")}`).join("|")}`, Yt = Vt.join("|");
|
|
5830
5870
|
let It = i.get(Yt) ?? i.get(he);
|
|
5831
5871
|
if (It && (i.set(Yt, It), i.set(he, It)), !It) {
|
|
5832
|
-
const q =
|
|
5872
|
+
const q = Er(l.typeName ?? l.objectType ?? l.name ?? l.ifcClass), Z = (o.get(q) ?? 0) + 1;
|
|
5833
5873
|
o.set(q, Z);
|
|
5834
5874
|
const k = Z === 1 ? q : `${q} (${Z})`;
|
|
5835
|
-
It = { family: k, type: k, first: !0, key:
|
|
5875
|
+
It = { family: k, type: k, first: !0, key: Ir(he) }, i.set(he, It), i.set(Yt, It);
|
|
5836
5876
|
}
|
|
5837
5877
|
const Gt = {
|
|
5838
5878
|
ShapeCategory: c,
|
|
@@ -5841,7 +5881,7 @@ function ha(s, t, e) {
|
|
|
5841
5881
|
ShapeKey: It.key,
|
|
5842
5882
|
...ut ? { ColumnFree: "1" } : {}
|
|
5843
5883
|
};
|
|
5844
|
-
It.first && (Gt.Shape = JSON.stringify({ pieces:
|
|
5884
|
+
It.first && (Gt.Shape = JSON.stringify({ pieces: $t }), It.first = !1);
|
|
5845
5885
|
const Mt = l.host ? r.get(l.host) : void 0, $e = l.opening ? s.elements.get(l.opening) : void 0;
|
|
5846
5886
|
if (Mt && $e) {
|
|
5847
5887
|
const q = [1 / 0, 1 / 0, 1 / 0], Z = [-1 / 0, -1 / 0, -1 / 0];
|
|
@@ -5867,16 +5907,16 @@ function ha(s, t, e) {
|
|
|
5867
5907
|
}
|
|
5868
5908
|
return a;
|
|
5869
5909
|
}
|
|
5870
|
-
function
|
|
5910
|
+
function Er(s) {
|
|
5871
5911
|
return (s.replace(/[\\:{}[\]|;<>?`~]/g, "-").replace(/\s+/g, " ").trim() || "Shape").slice(0, 120);
|
|
5872
5912
|
}
|
|
5873
|
-
function
|
|
5913
|
+
function Ir(s) {
|
|
5874
5914
|
let t = 2166136261;
|
|
5875
5915
|
for (let e = 0; e < s.length; e++)
|
|
5876
5916
|
t ^= s.charCodeAt(e), t = Math.imul(t, 16777619);
|
|
5877
5917
|
return (t >>> 0).toString(36);
|
|
5878
5918
|
}
|
|
5879
|
-
function
|
|
5919
|
+
function wa(s, t, e) {
|
|
5880
5920
|
const n = /* @__PURE__ */ new Map();
|
|
5881
5921
|
for (const i of t) {
|
|
5882
5922
|
const [, o, a] = i.split(":");
|
|
@@ -5887,10 +5927,10 @@ function da(s, t, e) {
|
|
|
5887
5927
|
if (i.ifcClass.toUpperCase() !== "IFCOPENINGELEMENT" || !i.host) continue;
|
|
5888
5928
|
const o = n.get(i.host);
|
|
5889
5929
|
if (o)
|
|
5890
|
-
for (const a of
|
|
5930
|
+
for (const a of Ia(s, i.gid)) {
|
|
5891
5931
|
const l = a.pts;
|
|
5892
5932
|
if (l.length < 4) continue;
|
|
5893
|
-
const d =
|
|
5933
|
+
const d = Ea(nn(s, i.host));
|
|
5894
5934
|
if (!d) continue;
|
|
5895
5935
|
const c = l.map((I) => (I[0] - d.a[0]) * d.u[0] + (I[1] - d.a[1]) * d.u[1]), m = l.map((I) => -(I[0] - d.a[0]) * d.u[1] + (I[1] - d.a[1]) * d.u[0]), w = (I) => Math.max(...I) - Math.min(...I), v = w(c) * w(m) * w(l.map((I) => I[2]));
|
|
5896
5936
|
!(v > 0) || Math.abs(a.volume) < 0.75 * v || r.push({ key: `${e}:${i.gid}:opening${a.index === 0 && a.of === 1 ? "" : `#${a.index}`}`, host: o, box: l.flat() });
|
|
@@ -5898,7 +5938,7 @@ function da(s, t, e) {
|
|
|
5898
5938
|
}
|
|
5899
5939
|
return r;
|
|
5900
5940
|
}
|
|
5901
|
-
function
|
|
5941
|
+
function va(s) {
|
|
5902
5942
|
const t = s.loops.flat(), e = [t.reduce((w, v) => w + v[0], 0) / t.length, t.reduce((w, v) => w + v[1], 0) / t.length], n = s.loops.map((w) => {
|
|
5903
5943
|
const v = w.map(([O, u]) => [O - e[0], u - e[1]]), I = v.map(([O, u]) => Math.hypot(O, u)), _ = I.reduce((O, u) => O + u, 0) / I.length;
|
|
5904
5944
|
if (v.length < 8 || _ <= 0 || I.some((O) => Math.abs(O - _) > 0.02 * _)) return v;
|
|
@@ -5920,13 +5960,13 @@ function fa(s) {
|
|
|
5920
5960
|
if (a === 1 && (a = 0, l = Math.PI / 2, d = n.map((w) => w.map(([v, I]) => [-I, v]))), a === 2) {
|
|
5921
5961
|
let w = 0, v = 0, I = 0;
|
|
5922
5962
|
const _ = n.flat();
|
|
5923
|
-
for (const [E,
|
|
5924
|
-
w += E * E, v +=
|
|
5963
|
+
for (const [E, F] of _)
|
|
5964
|
+
w += E * E, v += F * F, I += E * F;
|
|
5925
5965
|
const L = /* @__PURE__ */ new Set(), $ = 0.5 * Math.atan2(2 * I, w - v);
|
|
5926
5966
|
for (let E = 0; E < 4; E++) L.add($ + E * Math.PI / 2);
|
|
5927
|
-
const O = _.map(([E,
|
|
5967
|
+
const O = _.map(([E, F]) => Math.hypot(E, F)), u = Math.max(...O), x = _.filter((E, F) => O[F] > u - 3e-3);
|
|
5928
5968
|
if (Math.abs(w - v) < 1e-3 * (w + v) || x.length > 4)
|
|
5929
|
-
for (const [E,
|
|
5969
|
+
for (const [E, F] of x.slice(0, 64)) L.add(Math.atan2(F, E));
|
|
5930
5970
|
for (const E of L) o.push({ loops: i(n, E), turn: E, flipped: !1 });
|
|
5931
5971
|
} else
|
|
5932
5972
|
o.push({ loops: d, turn: 0, flipped: !1 }), o.push({ loops: d.map((w) => w.map(([v, I]) => [-v, I]).reverse()), turn: Math.PI, flipped: !0 });
|
|
@@ -5937,7 +5977,7 @@ function fa(s) {
|
|
|
5937
5977
|
}
|
|
5938
5978
|
return { axis: a, loops: c.loops, key: m, centre: e, turn: l + c.turn, flipped: c.flipped };
|
|
5939
5979
|
}
|
|
5940
|
-
function
|
|
5980
|
+
function ba(s) {
|
|
5941
5981
|
const e = s.v.length / 3;
|
|
5942
5982
|
if (e < 6) return null;
|
|
5943
5983
|
const n = [0, 1, 2].map((r) => {
|
|
@@ -5967,12 +6007,12 @@ function ua(s) {
|
|
|
5967
6007
|
}, v = /* @__PURE__ */ new Map(), I = [];
|
|
5968
6008
|
for (let u = 0; u + 2 < s.t.length; u += 3) {
|
|
5969
6009
|
const x = [s.t[u], s.t[u + 1], s.t[u + 2]];
|
|
5970
|
-
if (!x.every((
|
|
6010
|
+
if (!x.every((F) => Math.abs(s.v[F * 3 + r] - i) <= 1e-3)) continue;
|
|
5971
6011
|
const E = x.map(w);
|
|
5972
6012
|
if (!(E[0] === E[1] || E[1] === E[2] || E[0] === E[2])) {
|
|
5973
6013
|
I.push(E);
|
|
5974
|
-
for (let
|
|
5975
|
-
const z = E[
|
|
6014
|
+
for (let F = 0; F < 3; F++) {
|
|
6015
|
+
const z = E[F], ut = E[(F + 1) % 3], wt = z < ut ? `${z},${ut}` : `${ut},${z}`;
|
|
5976
6016
|
v.set(wt, (v.get(wt) ?? 0) + 1);
|
|
5977
6017
|
}
|
|
5978
6018
|
}
|
|
@@ -5980,24 +6020,24 @@ function ua(s) {
|
|
|
5980
6020
|
if (I.length === 0) continue;
|
|
5981
6021
|
const _ = /* @__PURE__ */ new Map();
|
|
5982
6022
|
for (const u of I) for (let x = 0; x < 3; x++) {
|
|
5983
|
-
const E = u[x],
|
|
5984
|
-
v.get(E <
|
|
6023
|
+
const E = u[x], F = u[(x + 1) % 3];
|
|
6024
|
+
v.get(E < F ? `${E},${F}` : `${F},${E}`) === 1 && _.set(E, [..._.get(E) ?? [], F]);
|
|
5985
6025
|
}
|
|
5986
6026
|
if ([..._.values()].some((u) => u.length !== 1)) continue;
|
|
5987
6027
|
const L = [], $ = new Set(_.keys());
|
|
5988
6028
|
for (; $.size; ) {
|
|
5989
6029
|
const u = $.values().next().value, x = [];
|
|
5990
|
-
let E = u,
|
|
6030
|
+
let E = u, F = 0;
|
|
5991
6031
|
do
|
|
5992
6032
|
x.push(m[E]), $.delete(E), E = _.get(E)[0];
|
|
5993
|
-
while (E !== u &&
|
|
6033
|
+
while (E !== u && F++ < 1e5 && _.has(E));
|
|
5994
6034
|
if (E !== u || x.length < 3) {
|
|
5995
6035
|
L.length = 0;
|
|
5996
6036
|
break;
|
|
5997
6037
|
}
|
|
5998
6038
|
const z = x.filter((ut, wt) => {
|
|
5999
|
-
const
|
|
6000
|
-
return Math.abs((ut[0] -
|
|
6039
|
+
const $t = x[(wt - 1 + x.length) % x.length], Vt = x[(wt + 1) % x.length];
|
|
6040
|
+
return Math.abs((ut[0] - $t[0]) * (Vt[1] - $t[1]) - (ut[1] - $t[1]) * (Vt[0] - $t[0])) > 1e-7;
|
|
6001
6041
|
});
|
|
6002
6042
|
L.push(z.map(([ut, wt]) => [be(ut, 1e-5), be(wt, 1e-5)]));
|
|
6003
6043
|
}
|
|
@@ -6009,7 +6049,7 @@ function ua(s) {
|
|
|
6009
6049
|
}
|
|
6010
6050
|
return null;
|
|
6011
6051
|
}
|
|
6012
|
-
function
|
|
6052
|
+
function Ta(s, t) {
|
|
6013
6053
|
const e = [];
|
|
6014
6054
|
for (const n of s.elements.values()) {
|
|
6015
6055
|
if (n.ifcClass.toUpperCase() !== "IFCSPACE") continue;
|
|
@@ -6046,7 +6086,7 @@ function pa(s, t) {
|
|
|
6046
6086
|
}
|
|
6047
6087
|
return e;
|
|
6048
6088
|
}
|
|
6049
|
-
function
|
|
6089
|
+
function Ea(s) {
|
|
6050
6090
|
if (s.length < 2) return;
|
|
6051
6091
|
let t = s[0], e = s[0], n = 0;
|
|
6052
6092
|
for (const r of s) {
|
|
@@ -6061,7 +6101,7 @@ function ma(s) {
|
|
|
6061
6101
|
if (!(n < 0.1))
|
|
6062
6102
|
return { a: t, u: [(e[0] - t[0]) / n, (e[1] - t[1]) / n] };
|
|
6063
6103
|
}
|
|
6064
|
-
function
|
|
6104
|
+
function Ia(s, t) {
|
|
6065
6105
|
const e = s.elements.get(t);
|
|
6066
6106
|
if (!e) return [];
|
|
6067
6107
|
const n = [], r = [], i = /* @__PURE__ */ new Map();
|
|
@@ -6091,12 +6131,12 @@ function ga(s, t) {
|
|
|
6091
6131
|
let w = l.get(m);
|
|
6092
6132
|
w || (w = { pts: /* @__PURE__ */ new Set(), volume: 0 }, l.set(m, w));
|
|
6093
6133
|
const [v, I, _] = [n[r[c]], n[r[c + 1]], n[r[c + 2]]];
|
|
6094
|
-
w.volume +=
|
|
6134
|
+
w.volume += en(v, $n(I, _)) / 6, w.pts.add(r[c]), w.pts.add(r[c + 1]), w.pts.add(r[c + 2]);
|
|
6095
6135
|
}
|
|
6096
6136
|
const d = [...l.values()];
|
|
6097
6137
|
return d.map((c, m) => ({ pts: [...c.pts].map((w) => n[w]), volume: c.volume, index: m, of: d.length }));
|
|
6098
6138
|
}
|
|
6099
|
-
function
|
|
6139
|
+
function nn(s, t, e) {
|
|
6100
6140
|
const n = s.elements.get(t), r = [];
|
|
6101
6141
|
if (!n) return r;
|
|
6102
6142
|
for (const i of n.pieces) {
|
|
@@ -6110,8 +6150,8 @@ function en(s, t, e) {
|
|
|
6110
6150
|
}
|
|
6111
6151
|
return r;
|
|
6112
6152
|
}
|
|
6113
|
-
function
|
|
6114
|
-
const n =
|
|
6153
|
+
function Sa(s, t, e) {
|
|
6154
|
+
const n = nn(s, t);
|
|
6115
6155
|
if (n.length < 4 || e.length === 0) return;
|
|
6116
6156
|
let r = n[0], i = n[0], o = 0;
|
|
6117
6157
|
for (const $ of n) {
|
|
@@ -6129,12 +6169,12 @@ function ya(s, t, e) {
|
|
|
6129
6169
|
const I = (r[0] + i[0]) / 2, _ = (r[1] + i[1]) / 2;
|
|
6130
6170
|
let L;
|
|
6131
6171
|
for (const $ of e) {
|
|
6132
|
-
const O =
|
|
6172
|
+
const O = nn(s, $.gid);
|
|
6133
6173
|
if (O.length === 0) continue;
|
|
6134
6174
|
const u = O.map((z) => z[0]), x = O.map((z) => z[1]), E = O.map((z) => z[2]);
|
|
6135
6175
|
if (I < Math.min(...u) - 0.2 || I > Math.max(...u) + 0.2 || _ < Math.min(...x) - 0.2 || _ > Math.max(...x) + 0.2) continue;
|
|
6136
|
-
const
|
|
6137
|
-
|
|
6176
|
+
const F = Math.min(...E) - c;
|
|
6177
|
+
F > 1.5 || Math.max(...E) < c - 0.05 || (!L || Math.abs(F) < Math.abs(L.gap)) && (L = { id: $.id, gap: F });
|
|
6138
6178
|
}
|
|
6139
6179
|
return L == null ? void 0 : L.id;
|
|
6140
6180
|
}
|
|
@@ -6147,7 +6187,7 @@ const ge = {
|
|
|
6147
6187
|
structuralFoundations: "-2001300",
|
|
6148
6188
|
stairs: "-2000120"
|
|
6149
6189
|
};
|
|
6150
|
-
function
|
|
6190
|
+
function Ze(s) {
|
|
6151
6191
|
const t = s.item.attrs.Name;
|
|
6152
6192
|
if (typeof t != "string") return null;
|
|
6153
6193
|
const e = t.indexOf(":"), n = t.lastIndexOf(":");
|
|
@@ -6155,26 +6195,26 @@ function Qe(s) {
|
|
|
6155
6195
|
const r = t.slice(e + 1, n).trim();
|
|
6156
6196
|
return r ? { family: t.slice(0, e).trim(), type: r } : null;
|
|
6157
6197
|
}
|
|
6158
|
-
function
|
|
6159
|
-
const t =
|
|
6198
|
+
function Sr(s) {
|
|
6199
|
+
const t = Ze(s), e = s.item.attrs.PredefinedType;
|
|
6160
6200
|
return t ? /escalera|stair|landing|descansillo/i.test(t.family) || e === "LANDING" || /plataforma|^pad\b|building pad/i.test(t.family) ? "other" : /cubierta|roof/i.test(t.family) || e === "ROOF" ? "roof" : /cimentaci|foundation/i.test(t.family) || e === "BASESLAB" ? "foundation" : "floor" : "floor";
|
|
6161
6201
|
}
|
|
6162
|
-
const
|
|
6163
|
-
function
|
|
6202
|
+
const _r = 180 / Math.PI;
|
|
6203
|
+
function Ar(s) {
|
|
6164
6204
|
if (typeof s != "string") return null;
|
|
6165
6205
|
const t = s.indexOf(":");
|
|
6166
6206
|
return t <= 0 || t === s.length - 1 ? null : { family: s.slice(0, t), type: s.slice(t + 1) };
|
|
6167
6207
|
}
|
|
6168
6208
|
const ft = (s) => String(s);
|
|
6169
|
-
function
|
|
6209
|
+
function wi(s) {
|
|
6170
6210
|
return async (t) => {
|
|
6171
|
-
var
|
|
6172
|
-
const { picked: e, contents: n, site: r, shapes: i } = await
|
|
6211
|
+
var $s, xs, ks, Cs, Rs, Ns, Ms, Fs, Ls, Ps, Bs, js, Ds, Us, qs, Vs, Gs, Hs, Js, Ws, zs;
|
|
6212
|
+
const { picked: e, contents: n, site: r, shapes: i } = await Is(
|
|
6173
6213
|
t,
|
|
6174
6214
|
t.input
|
|
6175
|
-
), o =
|
|
6215
|
+
), o = oi(n.items), a = /CoordinateBase:\s*(Coordenadas compartidas|Shared Coordinates|Shared)/i.test(
|
|
6176
6216
|
JSON.stringify(n.metadata ?? {})
|
|
6177
|
-
), l = a && r ? [r.east *
|
|
6217
|
+
), l = a && r ? [r.east * Fe, r.north * Fe, r.elevation * Fe, r.angleDeg].map((h) => h.toFixed(6)).join(",") : void 0;
|
|
6178
6218
|
if (o.length === 0)
|
|
6179
6219
|
throw new Error(
|
|
6180
6220
|
s === "ifc" ? `Nothing in "${e.name}" could be read as a building element (walls, floors, levels...).` : `"${e.name}" carries no platform records, so there is nothing semantic to convert.`
|
|
@@ -6184,14 +6224,14 @@ function ui(s) {
|
|
|
6184
6224
|
throw new Error(
|
|
6185
6225
|
"Free-standing instances can only be made by their style names: turn trustStyleNames on."
|
|
6186
6226
|
);
|
|
6187
|
-
const v =
|
|
6227
|
+
const v = Ts(o), I = ai(o), _ = `recipe:${s}-to-revit`, L = /* @__PURE__ */ new Map(), $ = Es(t, L);
|
|
6188
6228
|
t.progress("Writing the changes for Revit");
|
|
6189
|
-
const O = new
|
|
6229
|
+
const O = new vs({
|
|
6190
6230
|
project: t.projectId,
|
|
6191
6231
|
document: t.target.docId ?? "",
|
|
6192
6232
|
baseCommit: t.target.version ?? 0,
|
|
6193
6233
|
author: _
|
|
6194
|
-
}), u =
|
|
6234
|
+
}), u = Fe, x = /* @__PURE__ */ new Map();
|
|
6195
6235
|
{
|
|
6196
6236
|
const h = /* @__PURE__ */ new Map();
|
|
6197
6237
|
for (const f of o) {
|
|
@@ -6201,30 +6241,30 @@ function ui(s) {
|
|
|
6201
6241
|
h.set(b, C + 1), x.set(f.id, `${e.fileId}:${b}${C ? `:${C}` : ""}`);
|
|
6202
6242
|
}
|
|
6203
6243
|
}
|
|
6204
|
-
const E = (h) => x.get(h) ?? `${e.fileId}:${h}`,
|
|
6244
|
+
const E = (h) => x.get(h) ?? `${e.fileId}:${h}`, F = /* @__PURE__ */ new Set();
|
|
6205
6245
|
let z = 0, ut = 0;
|
|
6206
6246
|
const wt = (h, f, y) => {
|
|
6207
|
-
|
|
6208
|
-
const b = a ? { ...f, Frame: "shared", ...l ? { SharedAt: l } : {} } : f, C =
|
|
6247
|
+
F.add(h);
|
|
6248
|
+
const b = a ? { ...f, Frame: "shared", ...l ? { SharedAt: l } : {} } : f, C = ci({ attrs: b, placement: y ?? {} }), S = $.get(h);
|
|
6209
6249
|
if (S) {
|
|
6210
6250
|
const R = L.get(h);
|
|
6211
6251
|
return !R || R === C ? (z++, !1) : (O.remove(S), O.add({ ...b, "flow:print": C }, { ...y, source: h }), ut++, !1);
|
|
6212
6252
|
}
|
|
6213
6253
|
return O.add({ ...b, "flow:print": C }, { ...y, source: h }), !0;
|
|
6214
|
-
},
|
|
6254
|
+
}, $t = (h) => {
|
|
6215
6255
|
const f = typeof h == "string" ? I.get(h) : void 0, y = f == null ? void 0 : f.params.thickness;
|
|
6216
6256
|
return typeof y == "number" && y > 0 ? y * u : void 0;
|
|
6217
6257
|
}, Vt = (h) => {
|
|
6218
6258
|
var D, at;
|
|
6219
|
-
const f = Bt(h, "extrusion"), y = v.get(String((f == null ? void 0 : f.level) ?? h.params.level ?? "")), b = f == null ? void 0 : f.slopes, C = ((at = (D = f == null ? void 0 : f.profile) == null ? void 0 : D.outline) == null ? void 0 : at.curves) ?? [], S = Array.isArray(b) ? b.map((
|
|
6259
|
+
const f = Bt(h, "extrusion"), y = v.get(String((f == null ? void 0 : f.level) ?? h.params.level ?? "")), b = f == null ? void 0 : f.slopes, C = ((at = (D = f == null ? void 0 : f.profile) == null ? void 0 : D.outline) == null ? void 0 : at.curves) ?? [], S = Array.isArray(b) ? b.map((J) => typeof J == "number") : [], R = S.indexOf(!0);
|
|
6220
6260
|
if (h.params.of !== "roof" || !y || C.length !== 4 || S.filter(Boolean).length !== 2 || R < 0 || R > 1 || !S[R + 2]) return null;
|
|
6221
6261
|
const [A, j] = [C[R], C[R + 2]], nt = A.from, ht = A.to, Y = Math.hypot(ht[0] - nt[0], ht[1] - nt[1]), St = [(ht[0] - nt[0]) / Y, (ht[1] - nt[1]) / Y];
|
|
6222
6262
|
let U = [-St[1], St[0]];
|
|
6223
6263
|
const ot = (j.from[0] - nt[0]) * U[0] + (j.from[1] - nt[1]) * U[1];
|
|
6224
6264
|
ot < 0 && (U = [-U[0], -U[1]]);
|
|
6225
|
-
const yt = Math.abs(ot), [P, G] = [b[R], b[R + 2]], lt = y.at + (typeof h.params.base == "number" ? h.params.base : 0),
|
|
6226
|
-
return { A: nt, u: St, n: U, L: Y, W: yt, si: P, sj: G, ridge: mt, top: lt, ti: tt, tj: vt, zAt: (
|
|
6227
|
-
const V = (
|
|
6265
|
+
const yt = Math.abs(ot), [P, G] = [b[R], b[R + 2]], lt = y.at + (typeof h.params.base == "number" ? h.params.base : 0), kt = (f == null ? void 0 : f.eaves) ?? [], [tt, vt] = [lt + (Number(kt[R]) || 0), lt + (Number(kt[R + 2]) || 0)], mt = (vt - tt + G * yt) / (P + G);
|
|
6266
|
+
return { A: nt, u: St, n: U, L: Y, W: yt, si: P, sj: G, ridge: mt, top: lt, ti: tt, tj: vt, zAt: (J, B) => {
|
|
6267
|
+
const V = (J - nt[0]) * U[0] + (B - nt[1]) * U[1];
|
|
6228
6268
|
return Math.min(tt + P * V, vt + G * (yt - V));
|
|
6229
6269
|
} };
|
|
6230
6270
|
}, Nt = new Map(o.filter((h) => h.kind === "extrusion" && h.params.of === "roof").map((h) => [h.id, h])), he = [...Nt.values()].filter((h) => h.item.guid).map((h) => ({ id: h.id, gid: h.item.guid }));
|
|
@@ -6240,12 +6280,12 @@ function ui(s) {
|
|
|
6240
6280
|
const Mt = [];
|
|
6241
6281
|
for (const h of o) {
|
|
6242
6282
|
if (h.kind !== "run" || h.params.of !== "wall") continue;
|
|
6243
|
-
const f = Bt(h, "run"), y = ((
|
|
6283
|
+
const f = Bt(h, "run"), y = ((xs = ($s = f == null ? void 0 : f.run) == null ? void 0 : $s.line) == null ? void 0 : xs.curves) ?? [], b = h.params.lookRef, C = v.get(String((f == null ? void 0 : f.level) ?? h.params.level ?? ""));
|
|
6244
6284
|
if (typeof b != "string" || typeof (f == null ? void 0 : f.height) != "number" || !C) {
|
|
6245
6285
|
Gt++;
|
|
6246
6286
|
continue;
|
|
6247
6287
|
}
|
|
6248
|
-
const S = (
|
|
6288
|
+
const S = ($t(b) ?? 0) / u, R = y.filter((A) => A.kind === "segment" && A.from && A.to);
|
|
6249
6289
|
Gt += y.length - R.length, R.forEach(
|
|
6250
6290
|
(A, j) => Mt.push({
|
|
6251
6291
|
record: h,
|
|
@@ -6295,18 +6335,18 @@ function ui(s) {
|
|
|
6295
6335
|
let { from: A, to: j } = Tt.get(h);
|
|
6296
6336
|
const nt = /* @__PURE__ */ new Set();
|
|
6297
6337
|
if (i && f.item.guid && Mt.filter((D) => D.record === f).length === 1 ? i.elements.get(f.item.guid) : void 0) {
|
|
6298
|
-
const D =
|
|
6338
|
+
const D = nn(i, f.item.guid), at = Math.hypot(j[0] - A[0], j[1] - A[1]);
|
|
6299
6339
|
if (D.length >= 4 && at > 0.05) {
|
|
6300
|
-
const
|
|
6340
|
+
const J = [(j[0] - A[0]) / at, (j[1] - A[1]) / at], B = D.map((bt) => (bt[0] - A[0]) * J[0] + (bt[1] - A[1]) * J[1]), V = Math.min(...B), ct = Math.max(...B), dt = D.map((bt) => -(bt[0] - A[0]) * J[1] + (bt[1] - A[1]) * J[0]), Ct = Math.max(...dt) - Math.min(...dt), Q = (bt) => {
|
|
6301
6341
|
const Jt = dt.filter((fe, ue) => Math.abs(B[ue] - bt) < 2e-3);
|
|
6302
|
-
return Jt.length >= 2 && Math.max(...Jt) - Math.min(...Jt) > 0.9 *
|
|
6303
|
-
},
|
|
6304
|
-
Q(V) && (A = [
|
|
6342
|
+
return Jt.length >= 2 && Math.max(...Jt) - Math.min(...Jt) > 0.9 * Ct;
|
|
6343
|
+
}, W = A;
|
|
6344
|
+
Q(V) && (A = [W[0] + J[0] * V, W[1] + J[1] * V], nt.add("start")), Q(ct) && (j = [W[0] + J[0] * ct, W[1] + J[1] * ct], nt.add("end"));
|
|
6305
6345
|
}
|
|
6306
6346
|
}
|
|
6307
6347
|
const Y = (S.at + b) * u, St = `${ft(A[0] * u)},${ft(A[1] * u)},${ft(Y)};${ft(j[0] * u)},${ft(j[1] * u)},${ft(Y)}`, U = {
|
|
6308
6348
|
CategoryId: ge.walls,
|
|
6309
|
-
Type: ((
|
|
6349
|
+
Type: ((ks = Ze(f)) == null ? void 0 : ks.type) ?? R,
|
|
6310
6350
|
LocationLine: St,
|
|
6311
6351
|
Level: S.name,
|
|
6312
6352
|
BaseOffset: ft(b * u),
|
|
@@ -6319,37 +6359,37 @@ function ui(s) {
|
|
|
6319
6359
|
P && (U.TopLevel = P.name, U.TopOffset = ft((S.at + b + C - P.at) * u));
|
|
6320
6360
|
const G = y.profile;
|
|
6321
6361
|
if (Array.isArray(G) && G.length >= 3 && h.i === 0 && !Mt.some((D) => D !== h && D.record === f)) {
|
|
6322
|
-
const D = Math.hypot(h.to[0] - h.from[0], h.to[1] - h.from[1]), at = [(h.to[0] - h.from[0]) / D, (h.to[1] - h.from[1]) / D],
|
|
6323
|
-
G.forEach(([ct, dt],
|
|
6324
|
-
const Q = Math.abs(ct) < 1e-6,
|
|
6362
|
+
const D = Math.hypot(h.to[0] - h.from[0], h.to[1] - h.from[1]), at = [(h.to[0] - h.from[0]) / D, (h.to[1] - h.from[1]) / D], J = [], B = -((A[0] - h.from[0]) * at[0] + (A[1] - h.from[1]) * at[1]), V = (j[0] - h.to[0]) * at[0] + (j[1] - h.to[1]) * at[1];
|
|
6363
|
+
G.forEach(([ct, dt], Ct) => {
|
|
6364
|
+
const Q = Math.abs(ct) < 1e-6, W = Math.abs(ct - D) < 1e-6;
|
|
6325
6365
|
let bt = ct, Jt = dt;
|
|
6326
|
-
if (Q ||
|
|
6366
|
+
if (Q || W) {
|
|
6327
6367
|
bt = Q ? -B : D + V;
|
|
6328
|
-
const ue = [G[(
|
|
6368
|
+
const ue = [G[(Ct - 1 + G.length) % G.length], G[(Ct + 1) % G.length]].find(([Ge]) => Math.abs(Ge - ct) > 1e-6);
|
|
6329
6369
|
ue && (Jt = dt + (ue[1] - dt) / (ue[0] - ct) * (bt - ct));
|
|
6330
6370
|
}
|
|
6331
6371
|
const fe = [h.from[0] + bt * at[0], h.from[1] + bt * at[1]];
|
|
6332
|
-
|
|
6333
|
-
}), U.Profile = JSON.stringify([
|
|
6372
|
+
J.push(fe[0] * u, fe[1] * u, (S.at + b + Jt) * u);
|
|
6373
|
+
}), U.Profile = JSON.stringify([J]), delete U.TopLevel, delete U.TopOffset;
|
|
6334
6374
|
}
|
|
6335
|
-
const lt = f.params.topAttachedTo,
|
|
6375
|
+
const lt = f.params.topAttachedTo, kt = f.params.topAttachedAt === "top" || y.topAttachedAt === "top", tt = typeof lt == "string" && kt && !U.Profile && Nt.has(lt) ? Vt(Nt.get(lt)) : null;
|
|
6336
6376
|
if (tt) {
|
|
6337
|
-
const D = Math.hypot(j[0] - A[0], j[1] - A[1]), at = (Q) => [A[0] + (j[0] - A[0]) * Q / D, A[1] + (j[1] - A[1]) * Q / D],
|
|
6338
|
-
(
|
|
6339
|
-
const ct = S.at + b, dt = [],
|
|
6377
|
+
const D = Math.hypot(j[0] - A[0], j[1] - A[1]), at = (Q) => [A[0] + (j[0] - A[0]) * Q / D, A[1] + (j[1] - A[1]) * Q / D], J = (A[0] - tt.A[0]) * tt.n[0] + (A[1] - tt.A[1]) * tt.n[1], B = (j[0] - tt.A[0]) * tt.n[0] + (j[1] - tt.A[1]) * tt.n[1], V = [0, D];
|
|
6378
|
+
(J - tt.ridge) * (B - tt.ridge) < 0 && V.splice(1, 0, (tt.ridge - J) / (B - J) * D);
|
|
6379
|
+
const ct = S.at + b, dt = [], Ct = (Q, W) => {
|
|
6340
6380
|
const bt = at(Q);
|
|
6341
|
-
dt.push(bt[0] * u, bt[1] * u,
|
|
6381
|
+
dt.push(bt[0] * u, bt[1] * u, W * u);
|
|
6342
6382
|
};
|
|
6343
|
-
|
|
6383
|
+
Ct(0, ct), Ct(D, ct);
|
|
6344
6384
|
for (const Q of [...V].reverse()) {
|
|
6345
|
-
const
|
|
6346
|
-
|
|
6385
|
+
const W = at(Q);
|
|
6386
|
+
Ct(Q, tt.zAt(W[0], W[1]));
|
|
6347
6387
|
}
|
|
6348
6388
|
U.Profile = JSON.stringify([dt]), delete U.TopLevel, delete U.TopOffset;
|
|
6349
6389
|
}
|
|
6350
|
-
const vt = typeof lt == "string" ? lt : i && f.item.guid ?
|
|
6390
|
+
const vt = typeof lt == "string" ? lt : i && f.item.guid ? Sa(i, f.item.guid, he) : void 0;
|
|
6351
6391
|
vt && !U.Profile && (U.AttachTop = E(vt));
|
|
6352
|
-
const mt =
|
|
6392
|
+
const mt = $t(R);
|
|
6353
6393
|
mt && (U["Type.Width"] = ft(mt));
|
|
6354
6394
|
const gt = f.item.guid ? i == null ? void 0 : i.elements.get(f.item.guid) : void 0;
|
|
6355
6395
|
gt != null && gt.layers && gt.layers.length > 1 && (U["Type.Layers"] = JSON.stringify([...gt.layers].reverse().map((D) => [+ft(D.thickness * u), D.material ?? "", D.function ?? ""])), gt.layersFlipped && (U.FlipLayers = "1")), wt(`${E(f.id)}#${h.i}`, U) && It++;
|
|
@@ -6364,19 +6404,19 @@ function ui(s) {
|
|
|
6364
6404
|
for (const h of o) {
|
|
6365
6405
|
if (h.kind !== "run" || h.params.of !== "curtainWall") continue;
|
|
6366
6406
|
jt++;
|
|
6367
|
-
const f = Bt(h, "run"), y = (
|
|
6407
|
+
const f = Bt(h, "run"), y = (Ns = (Rs = (Cs = f == null ? void 0 : f.run) == null ? void 0 : Cs.line) == null ? void 0 : Rs.curves) == null ? void 0 : Ns[0], b = v.get(String((f == null ? void 0 : f.level) ?? h.params.level ?? "")), C = h.params.lookRef, S = typeof C == "string" ? (Ms = I.get(C)) == null ? void 0 : Ms.params : void 0;
|
|
6368
6408
|
if (!(y != null && y.from) || !y.to || typeof (f == null ? void 0 : f.height) != "number" || !b || !S) continue;
|
|
6369
|
-
const R = (mt) => typeof mt == "number" ? mt : Number(mt) || 0, A = R(S.uprightWidth) / 2, j = R(S.horizontalWidth) / 2, nt = Math.hypot(y.to[0] - y.from[0], y.to[1] - y.from[1]), ht = [(y.to[0] - y.from[0]) / nt, (y.to[1] - y.from[1]) / nt], Y = [y.from[0] - ht[0] * A, y.from[1] - ht[1] * A], St = [y.to[0] + ht[0] * A, y.to[1] + ht[1] * A], U = (typeof f.base == "number" ? f.base : 0) - j, ot = f.height + 2 * j, yt = (b.at + U) * u, P = ((
|
|
6409
|
+
const R = (mt) => typeof mt == "number" ? mt : Number(mt) || 0, A = R(S.uprightWidth) / 2, j = R(S.horizontalWidth) / 2, nt = Math.hypot(y.to[0] - y.from[0], y.to[1] - y.from[1]), ht = [(y.to[0] - y.from[0]) / nt, (y.to[1] - y.from[1]) / nt], Y = [y.from[0] - ht[0] * A, y.from[1] - ht[1] * A], St = [y.to[0] + ht[0] * A, y.to[1] + ht[1] * A], U = (typeof f.base == "number" ? f.base : 0) - j, ot = f.height + 2 * j, yt = (b.at + U) * u, P = ((Fs = f.lines) == null ? void 0 : Fs.along) ?? Et(nt, R(S.alongSpacing), S.alongJustify), G = ((Ls = f.lines) == null ? void 0 : Ls.up) ?? Et(f.height, R(S.upSpacing), S.upJustify), lt = (f.omitted ?? []).flatMap((mt) => {
|
|
6370
6410
|
const gt = /^(horizontal|vertical)@(-?[\d.]+):(-?[\d.]+)$/.exec(mt);
|
|
6371
6411
|
if (!gt) return [];
|
|
6372
|
-
const D = gt[1] === "horizontal", at = Number(gt[2]) / 1e3 + (D ? j : A),
|
|
6373
|
-
return [{ horizontal: D, at: at * u, from:
|
|
6374
|
-
}),
|
|
6412
|
+
const D = gt[1] === "horizontal", at = Number(gt[2]) / 1e3 + (D ? j : A), J = Number(gt[3]) / 1e3 + (D ? A : j);
|
|
6413
|
+
return [{ horizontal: D, at: at * u, from: J * u }];
|
|
6414
|
+
}), kt = (f.omitted ?? []).flatMap((mt) => {
|
|
6375
6415
|
const gt = /^panel@(-?[\d.]+),(-?[\d.]+)$/.exec(mt);
|
|
6376
6416
|
return gt ? [{ along: (Number(gt[1]) / 1e3 + A) * u, up: (Number(gt[2]) / 1e3 + j) * u }] : [];
|
|
6377
6417
|
}), tt = {
|
|
6378
6418
|
CategoryId: ge.walls,
|
|
6379
|
-
Type: ((
|
|
6419
|
+
Type: ((Ps = Ze(h)) == null ? void 0 : Ps.type) ?? String(C),
|
|
6380
6420
|
LocationLine: `${ft(Y[0] * u)},${ft(Y[1] * u)},${ft(yt)};${ft(St[0] * u)},${ft(St[1] * u)},${ft(yt)}`,
|
|
6381
6421
|
Level: b.name,
|
|
6382
6422
|
BaseOffset: ft(U * u),
|
|
@@ -6385,7 +6425,7 @@ function ui(s) {
|
|
|
6385
6425
|
along: P.map((mt) => (mt + A) * u),
|
|
6386
6426
|
up: G.map((mt) => (mt + j) * u),
|
|
6387
6427
|
omit: lt,
|
|
6388
|
-
empty:
|
|
6428
|
+
empty: kt,
|
|
6389
6429
|
mullion: { width: R(S.uprightWidth) * u, depth: R(S.depth) * u },
|
|
6390
6430
|
// The glass off the bars' middle: the converter counts it toward the wall's inside,
|
|
6391
6431
|
// Revit's panel offset toward its outside (measured: racbasic's glass 0.032 m off,
|
|
@@ -6398,17 +6438,17 @@ function ui(s) {
|
|
|
6398
6438
|
const dt = vt[(ct + 1) % vt.length];
|
|
6399
6439
|
return B + V[0] * dt[1] - dt[0] * V[1];
|
|
6400
6440
|
}, 0) > 0 ? 1 : -1, D = vt.length, at = vt.map((B, V) => {
|
|
6401
|
-
const ct = vt[(V - 1 + D) % D], dt = vt[(V + 1) % D],
|
|
6402
|
-
const
|
|
6403
|
-
return { p: [fe[0] +
|
|
6404
|
-
}, Q =
|
|
6405
|
-
if (Math.abs(bt) < 1e-12) return [
|
|
6406
|
-
const Jt = ((
|
|
6441
|
+
const ct = vt[(V - 1 + D) % D], dt = vt[(V + 1) % D], Ct = (fe, ue) => {
|
|
6442
|
+
const Ge = ue[0] - fe[0], Nn = ue[1] - fe[1], Ys = Math.hypot(Ge, Nn) || 1, Ks = gt * Nn / Ys, Xs = -gt * Ge / Ys, Qs = Math.abs(Ks) > Math.abs(Xs) ? A : j;
|
|
6443
|
+
return { p: [fe[0] + Ks * Qs, fe[1] + Xs * Qs], d: [Ge, Nn] };
|
|
6444
|
+
}, Q = Ct(ct, B), W = Ct(B, dt), bt = Q.d[0] * W.d[1] - Q.d[1] * W.d[0];
|
|
6445
|
+
if (Math.abs(bt) < 1e-12) return [W.p[0], W.p[1]];
|
|
6446
|
+
const Jt = ((W.p[0] - Q.p[0]) * W.d[1] - (W.p[1] - Q.p[1]) * W.d[0]) / bt;
|
|
6407
6447
|
return [Q.p[0] + Jt * Q.d[0], Q.p[1] + Jt * Q.d[1]];
|
|
6408
|
-
}),
|
|
6448
|
+
}), J = [];
|
|
6409
6449
|
for (const [B, V] of at)
|
|
6410
|
-
|
|
6411
|
-
tt.Profile = JSON.stringify([
|
|
6450
|
+
J.push((y.from[0] + ht[0] * B) * u, (y.from[1] + ht[1] * B) * u, (b.at + U + j + V) * u);
|
|
6451
|
+
tt.Profile = JSON.stringify([J]);
|
|
6412
6452
|
}
|
|
6413
6453
|
wt(E(h.id), tt) && pt++;
|
|
6414
6454
|
}
|
|
@@ -6416,7 +6456,7 @@ function ui(s) {
|
|
|
6416
6456
|
for (const h of o) {
|
|
6417
6457
|
if (h.kind !== "stair" || h.params.of !== "stair") continue;
|
|
6418
6458
|
Pt++;
|
|
6419
|
-
const f = Bt(h, "stair"), y = h.params.lookRef, b = typeof y == "string" ? (
|
|
6459
|
+
const f = Bt(h, "stair"), y = h.params.lookRef, b = typeof y == "string" ? (Bs = I.get(y)) == null ? void 0 : Bs.params : void 0, C = v.get(String((f == null ? void 0 : f.level) ?? h.params.level ?? ""));
|
|
6420
6460
|
if (!(f != null && f.start) || !f.end || !(Number(f.rise) > 0) || !C || !b) continue;
|
|
6421
6461
|
const S = (P) => typeof P == "number" ? P : Number(P) || 0, R = Number(f.rise), A = Math.max(1, Math.ceil(R / S(b.maxRiser) - 1e-6)), j = S(b.tread), nt = (P) => [P[0] * u, P[1] * u], ht = {
|
|
6422
6462
|
family: String(y).split(":")[0],
|
|
@@ -6438,10 +6478,10 @@ function ui(s) {
|
|
|
6438
6478
|
}
|
|
6439
6479
|
}, Y = f.sketch;
|
|
6440
6480
|
if (Y != null && Y.boundary && Y.boundary.length >= 4 && Y.risers && Y.risers.length >= 2) {
|
|
6441
|
-
const P = Y.boundary, G = Y.risers[Y.risers.length - 1], lt = (B) => [(B[0][0] + B[1][0]) / 2, (B[0][1] + B[1][1]) / 2],
|
|
6481
|
+
const P = Y.boundary, G = Y.risers[Y.risers.length - 1], lt = (B) => [(B[0][0] + B[1][0]) / 2, (B[0][1] + B[1][1]) / 2], kt = lt(G);
|
|
6442
6482
|
let tt = 1, vt = 1 / 0;
|
|
6443
6483
|
for (let B = 1; B < P.length; B++) {
|
|
6444
|
-
const V = lt([P[B], P[(B + 1) % P.length]]), ct = Math.abs(Math.hypot(V[0] -
|
|
6484
|
+
const V = lt([P[B], P[(B + 1) % P.length]]), ct = Math.abs(Math.hypot(V[0] - kt[0], V[1] - kt[1]) - j);
|
|
6445
6485
|
ct < vt && (vt = ct, tt = B);
|
|
6446
6486
|
}
|
|
6447
6487
|
const mt = (B, V) => {
|
|
@@ -6452,34 +6492,34 @@ function ui(s) {
|
|
|
6452
6492
|
nt(P[tt]), nt(P[(tt + 1) % P.length]);
|
|
6453
6493
|
const at = D.map(([B, V]) => [(B[0] + V[0]) / 2, (B[1] + V[1]) / 2]);
|
|
6454
6494
|
ht.sketch = { boundary: gt, risers: D, path: at };
|
|
6455
|
-
let
|
|
6495
|
+
let J = 1 / 0;
|
|
6456
6496
|
for (let B = 0; B + 1 < Y.risers.length; B++) {
|
|
6457
|
-
const [V, ct] = Y.risers[B], [dt,
|
|
6458
|
-
Math.abs((Q[0] *
|
|
6497
|
+
const [V, ct] = Y.risers[B], [dt, Ct] = Y.risers[B + 1], Q = [ct[0] - V[0], ct[1] - V[1]], W = [Ct[0] - dt[0], Ct[1] - dt[1]], bt = Math.hypot(Q[0], Q[1]), Jt = Math.hypot(W[0], W[1]);
|
|
6498
|
+
Math.abs((Q[0] * W[1] - Q[1] * W[0]) / (bt * Jt)) > 1e-3 || (J = Math.min(J, Math.abs(((dt[0] - V[0]) * Q[1] - (dt[1] - V[1]) * Q[0]) / bt)));
|
|
6459
6499
|
}
|
|
6460
|
-
Number.isFinite(
|
|
6500
|
+
Number.isFinite(J) && (ht.tread = J * u, ht.sizes.minTread = J * u);
|
|
6461
6501
|
} else
|
|
6462
6502
|
ht.path = [nt([f.start[0], f.start[1]]), nt([f.end[0], f.end[1]])];
|
|
6463
6503
|
const St = String(h.item.attrs.Name ?? ""), U = St.replace(/ Run \d+$/, ""), ot = [];
|
|
6464
6504
|
for (const P of o) {
|
|
6465
6505
|
if (P.kind !== "extrusion" || U === St || !new RegExp(`^${U.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")} Landing \\d+$`).test(String(P.item.attrs.Name ?? ""))) continue;
|
|
6466
|
-
const G = Bt(P, "extrusion"), lt = G == null ? void 0 : G.on,
|
|
6467
|
-
if (!(lt != null && lt.origin) || !lt.u || !lt.v || Math.abs(lt.v[2] ?? 0) < 0.99 || !
|
|
6468
|
-
const [mt, gt] = [Math.min(...
|
|
6506
|
+
const G = Bt(P, "extrusion"), lt = G == null ? void 0 : G.on, kt = (((Ds = (js = G == null ? void 0 : G.profile) == null ? void 0 : js.outline) == null ? void 0 : Ds.curves) ?? []).flatMap((W) => W.from ? [W.from] : []), tt = $t(P.params.lookRef), vt = v.get(String((G == null ? void 0 : G.level) ?? P.params.level ?? ""));
|
|
6507
|
+
if (!(lt != null && lt.origin) || !lt.u || !lt.v || Math.abs(lt.v[2] ?? 0) < 0.99 || !kt.length || !tt || !vt) continue;
|
|
6508
|
+
const [mt, gt] = [Math.min(...kt.map((W) => W[0])), Math.max(...kt.map((W) => W[0]))], [D, at] = [Math.min(...kt.map((W) => W[1])), Math.max(...kt.map((W) => W[1]))], J = lt.origin, B = lt.u;
|
|
6469
6509
|
let V = [B[1], -B[0]];
|
|
6470
6510
|
const ct = [(f.start[0] + f.end[0]) / 2, (f.start[1] + f.end[1]) / 2];
|
|
6471
|
-
(ct[0] -
|
|
6472
|
-
const
|
|
6511
|
+
(ct[0] - J[0]) * V[0] + (ct[1] - J[1]) * V[1] < 0 && (V = [-V[0], -V[1]]);
|
|
6512
|
+
const Ct = tt / u, Q = (W, bt) => [(J[0] + B[0] * W + V[0] * bt) * u, (J[1] + B[1] * W + V[1] * bt) * u];
|
|
6473
6513
|
ot.push({
|
|
6474
|
-
outline: [Q(mt, 0), Q(gt, 0), Q(gt,
|
|
6475
|
-
top: (vt.at + S(P.params.base) +
|
|
6514
|
+
outline: [Q(mt, 0), Q(gt, 0), Q(gt, Ct), Q(mt, Ct)],
|
|
6515
|
+
top: (vt.at + S(P.params.base) + J[2] + at) * u,
|
|
6476
6516
|
thickness: (at - D) * u
|
|
6477
6517
|
});
|
|
6478
6518
|
}
|
|
6479
6519
|
ot.length && (ht.landings = ot);
|
|
6480
6520
|
const yt = {
|
|
6481
6521
|
CategoryId: ge.stairs,
|
|
6482
|
-
Type: ((
|
|
6522
|
+
Type: ((Us = Ze(h)) == null ? void 0 : Us.type) ?? String(y),
|
|
6483
6523
|
Level: C.name,
|
|
6484
6524
|
Stairs: JSON.stringify(ht)
|
|
6485
6525
|
};
|
|
@@ -6489,7 +6529,7 @@ function ui(s) {
|
|
|
6489
6529
|
for (const h of o) {
|
|
6490
6530
|
const f = h.params.of;
|
|
6491
6531
|
if (h.kind !== "extrusion" || f !== "slab" && f !== "roof" && f !== "covering") continue;
|
|
6492
|
-
const y = f === "covering" ? "ceiling" : f === "roof" ? "roof" :
|
|
6532
|
+
const y = f === "covering" ? "ceiling" : f === "roof" ? "roof" : Sr(h);
|
|
6493
6533
|
if (y === "other") continue;
|
|
6494
6534
|
st[y]++;
|
|
6495
6535
|
const b = Bt(h, "extrusion"), C = typeof h.params.base == "number" ? h.params.base : 0, S = v.get(String((b == null ? void 0 : b.level) ?? h.params.level ?? "")), R = h.params.lookRef, A = (U) => {
|
|
@@ -6500,10 +6540,10 @@ function ui(s) {
|
|
|
6500
6540
|
ot.push(yt.from[0] * u, yt.from[1] * u, C * u);
|
|
6501
6541
|
}
|
|
6502
6542
|
return ot.length >= 9 ? ot : null;
|
|
6503
|
-
}, j = A((
|
|
6543
|
+
}, j = A((Vs = (qs = b == null ? void 0 : b.profile) == null ? void 0 : qs.outline) == null ? void 0 : Vs.curves);
|
|
6504
6544
|
if (typeof R != "string" || !S || !j) continue;
|
|
6505
6545
|
const nt = [j], ht = y === "roof" ? Vt(h) : null;
|
|
6506
|
-
for (const U of ((
|
|
6546
|
+
for (const U of ((Gs = b == null ? void 0 : b.profile) == null ? void 0 : Gs.holes) ?? []) {
|
|
6507
6547
|
const ot = A(U == null ? void 0 : U.curves);
|
|
6508
6548
|
if (ot && ht)
|
|
6509
6549
|
for (let yt = 0; yt + 2 < ot.length; yt += 3) ot[yt + 2] = ht.zAt(ot[yt] / u, ot[yt + 1] / u) * u;
|
|
@@ -6511,13 +6551,13 @@ function ui(s) {
|
|
|
6511
6551
|
}
|
|
6512
6552
|
const Y = {
|
|
6513
6553
|
CategoryId: y === "roof" ? ge.roofs : y === "ceiling" ? ge.ceilings : y === "foundation" ? ge.structuralFoundations : ge.floors,
|
|
6514
|
-
Type: ((
|
|
6554
|
+
Type: ((Hs = Ze(h)) == null ? void 0 : Hs.type) ?? R,
|
|
6515
6555
|
Profile: JSON.stringify(nt),
|
|
6516
6556
|
Level: S.name
|
|
6517
|
-
}, St =
|
|
6557
|
+
}, St = $t(R);
|
|
6518
6558
|
if (St && (Y["Type.Width"] = ft(St)), y === "roof" || y === "ceiling") {
|
|
6519
6559
|
Y.BaseOffset = ft(C * u);
|
|
6520
|
-
const U = Number(h.params.drop ?? ((
|
|
6560
|
+
const U = Number(h.params.drop ?? ((Js = b == null ? void 0 : b.said) == null ? void 0 : Js.drop));
|
|
6521
6561
|
if (y === "ceiling" && Number.isFinite(U) && St) {
|
|
6522
6562
|
const P = [...v.values()].filter((G) => G.at > S.at + 1e-6).sort((G, lt) => G.at - lt.at)[0];
|
|
6523
6563
|
P && (Y.BaseOffset = ft((P.at - U - St / u - S.at) * u));
|
|
@@ -6530,9 +6570,9 @@ function ui(s) {
|
|
|
6530
6570
|
}
|
|
6531
6571
|
const yt = y === "roof" ? Vt(h) : null;
|
|
6532
6572
|
if (yt) {
|
|
6533
|
-
const { A: P, n: G, u: lt, W:
|
|
6573
|
+
const { A: P, n: G, u: lt, W: kt, ridge: tt, si: vt, ti: mt, tj: gt, L: D } = yt, at = (J, B) => [(P[0] + G[0] * J) * u, (P[1] + G[1] * J) * u, B * u];
|
|
6534
6574
|
Y.Extrusion = JSON.stringify({
|
|
6535
|
-
profile: [at(0, mt), at(tt, mt + vt * tt), at(
|
|
6575
|
+
profile: [at(0, mt), at(tt, mt + vt * tt), at(kt, gt)],
|
|
6536
6576
|
along: [lt[0], lt[1]],
|
|
6537
6577
|
length: D * u
|
|
6538
6578
|
}), delete Y.Slopes;
|
|
@@ -6546,7 +6586,7 @@ function ui(s) {
|
|
|
6546
6586
|
At++;
|
|
6547
6587
|
const f = Bt(h, "member"), y = f == null ? void 0 : f.start;
|
|
6548
6588
|
if (!y || y.length !== 3) continue;
|
|
6549
|
-
const b = c ?
|
|
6589
|
+
const b = c ? Ar(h.params.lookRef) : null;
|
|
6550
6590
|
if (c && !b || !b && !d) continue;
|
|
6551
6591
|
const C = b ?? {
|
|
6552
6592
|
family: d.family,
|
|
@@ -6562,23 +6602,23 @@ function ui(s) {
|
|
|
6562
6602
|
},
|
|
6563
6603
|
{
|
|
6564
6604
|
position: [y[0] * u, y[1] * u, y[2] * u],
|
|
6565
|
-
rotationDeg: (Number((f == null ? void 0 : f.roll) ?? 0) || 0) *
|
|
6605
|
+
rotationDeg: (Number((f == null ? void 0 : f.roll) ?? 0) || 0) * _r
|
|
6566
6606
|
}
|
|
6567
6607
|
) && et++;
|
|
6568
6608
|
}
|
|
6569
|
-
let Ht = 0, de = 0,
|
|
6609
|
+
let Ht = 0, de = 0, qe = 0;
|
|
6570
6610
|
for (const h of o) {
|
|
6571
6611
|
if (h.kind !== "familyInstance") continue;
|
|
6572
6612
|
if (h.params.host) {
|
|
6573
|
-
|
|
6613
|
+
qe++;
|
|
6574
6614
|
continue;
|
|
6575
6615
|
}
|
|
6576
6616
|
if (de++, !m) continue;
|
|
6577
|
-
const f = Bt(h, "instance"), y = (
|
|
6617
|
+
const f = Bt(h, "instance"), y = (Ws = f == null ? void 0 : f.placement) == null ? void 0 : Ws.at;
|
|
6578
6618
|
if (!y || y.length !== 3) continue;
|
|
6579
|
-
const b =
|
|
6619
|
+
const b = Ar(h.params.type);
|
|
6580
6620
|
if (!b) continue;
|
|
6581
|
-
const C = (
|
|
6621
|
+
const C = (zs = f == null ? void 0 : f.placement) == null ? void 0 : zs.right, S = C ? Math.atan2(C[1], C[0]) * _r : 0;
|
|
6582
6622
|
wt(
|
|
6583
6623
|
E(h.id),
|
|
6584
6624
|
{ Family: b.family, Type: b.type },
|
|
@@ -6593,7 +6633,7 @@ function ui(s) {
|
|
|
6593
6633
|
if (!b || !i.elements.has(b)) continue;
|
|
6594
6634
|
const C = Bt(y.record, "run"), S = v.get(String((C == null ? void 0 : C.level) ?? y.record.params.level ?? ""));
|
|
6595
6635
|
if (!C || !S) continue;
|
|
6596
|
-
const R =
|
|
6636
|
+
const R = nn(i, b);
|
|
6597
6637
|
if (!R.length) continue;
|
|
6598
6638
|
let A = 1 / 0;
|
|
6599
6639
|
for (const j of R) A = Math.min(A, j[2]);
|
|
@@ -6602,34 +6642,34 @@ function ui(s) {
|
|
|
6602
6642
|
h.sort((y, b) => y - b);
|
|
6603
6643
|
const f = h.length ? h[Math.floor(h.length / 2)] : 0;
|
|
6604
6644
|
return Math.abs(f) > 0.5 ? f : 0;
|
|
6605
|
-
})(),
|
|
6606
|
-
let
|
|
6607
|
-
for (const h of
|
|
6645
|
+
})(), Os = i ? ya(i, F, e.fileId) : [];
|
|
6646
|
+
let un = 0;
|
|
6647
|
+
for (const h of Os)
|
|
6608
6648
|
wt(h.key, h.attrs, {
|
|
6609
6649
|
position: [h.at[0] * u, h.at[1] * u, (h.at[2] - xe) * u],
|
|
6610
6650
|
rotationDeg: h.rotationDeg,
|
|
6611
6651
|
...h.host ? { host: h.host } : {}
|
|
6612
|
-
}) &&
|
|
6652
|
+
}) && un++;
|
|
6613
6653
|
if (i)
|
|
6614
|
-
for (const h of
|
|
6654
|
+
for (const h of wa(i, F, e.fileId))
|
|
6615
6655
|
wt(h.key, { WallOpening: h.box.map((f, y) => ft((y % 3 === 2 ? f - xe : f) * u)).join(",") }, { host: h.host });
|
|
6616
6656
|
if (i)
|
|
6617
|
-
for (const h of
|
|
6657
|
+
for (const h of Ta(i, e.fileId))
|
|
6618
6658
|
wt(h.key, { Room: "1", Name: h.name, Number: h.number, Height: ft(h.height * u) }, { position: [h.at[0] * u, h.at[1] * u, (h.at[2] - xe) * u] });
|
|
6619
|
-
let
|
|
6620
|
-
const
|
|
6659
|
+
let Rn = 0;
|
|
6660
|
+
const Ei = /* @__PURE__ */ new Set(["slab", "roof", "covering"]);
|
|
6621
6661
|
for (const h of o) {
|
|
6622
6662
|
const f = h.params.of;
|
|
6623
|
-
(h.kind === "footing" || h.kind === "ramp" || h.kind === "stair" && f !== "stair" || h.kind === "extrusion" && !
|
|
6663
|
+
(h.kind === "footing" || h.kind === "ramp" || h.kind === "stair" && f !== "stair" || h.kind === "extrusion" && !Ei.has(String(f)) || h.kind === "extrusion" && f === "slab" && Sr(h) === "other" && !/ Landing \d+$/.test(String(h.item.attrs.Name ?? "")) || h.kind === "run" && f !== "wall" && f !== "curtainWall") && Rn++;
|
|
6624
6664
|
}
|
|
6625
|
-
let
|
|
6665
|
+
let Ve = 0;
|
|
6626
6666
|
for (const [h, f] of $)
|
|
6627
|
-
!h.startsWith(`${e.fileId}:`) ||
|
|
6667
|
+
!h.startsWith(`${e.fileId}:`) || F.has(h) || (O.remove(f), Ve++);
|
|
6628
6668
|
if (O.length === 0)
|
|
6629
|
-
throw new
|
|
6630
|
-
`Up to date: "${e.name}" holds ${z} element(s) this recipe already made, ${
|
|
6669
|
+
throw new fi(
|
|
6670
|
+
`Up to date: "${e.name}" holds ${z} element(s) this recipe already made, ${qe + Rn} waiting on the applier, and nothing is left to remove.`
|
|
6631
6671
|
);
|
|
6632
|
-
const
|
|
6672
|
+
const Ii = [
|
|
6633
6673
|
Yt ? `${Yt} level(s)` : "",
|
|
6634
6674
|
It ? `${It} wall(s)` : "",
|
|
6635
6675
|
pt ? `${pt} curtain wall(s)` : "",
|
|
@@ -6640,12 +6680,12 @@ function ui(s) {
|
|
|
6640
6680
|
Ft ? `${Ft} stair(s)` : "",
|
|
6641
6681
|
et ? `${et} column(s)` : "",
|
|
6642
6682
|
Ht ? `${Ht} instance(s)` : "",
|
|
6643
|
-
|
|
6683
|
+
un ? `${un} family instance(s)` : "",
|
|
6644
6684
|
ut ? `${ut} changed` : "",
|
|
6645
|
-
|
|
6685
|
+
Ve ? `${Ve} gone` : ""
|
|
6646
6686
|
].filter(Boolean);
|
|
6647
6687
|
return {
|
|
6648
|
-
title: `${s === "ifc" ? "IFC" : "Model"} to Revit: ${
|
|
6688
|
+
title: `${s === "ifc" ? "IFC" : "Model"} to Revit: ${Ii.join(", ")}`,
|
|
6649
6689
|
verb: O.summary,
|
|
6650
6690
|
targets: O.length,
|
|
6651
6691
|
payload: new Blob([await O.build(t.opId)]),
|
|
@@ -6661,14 +6701,14 @@ function ui(s) {
|
|
|
6661
6701
|
{ read: Pt, written: Ft },
|
|
6662
6702
|
{ read: At, written: et },
|
|
6663
6703
|
{ read: de, written: Ht },
|
|
6664
|
-
{ read:
|
|
6665
|
-
{ read:
|
|
6666
|
-
{ read:
|
|
6704
|
+
{ read: Os.length, written: un },
|
|
6705
|
+
{ read: Ve, written: Ve },
|
|
6706
|
+
{ read: qe + Rn, written: 0 }
|
|
6667
6707
|
]
|
|
6668
6708
|
};
|
|
6669
6709
|
};
|
|
6670
6710
|
}
|
|
6671
|
-
const
|
|
6711
|
+
const _a = {
|
|
6672
6712
|
type: "object",
|
|
6673
6713
|
properties: {
|
|
6674
6714
|
columnType: {
|
|
@@ -6698,7 +6738,7 @@ const wa = {
|
|
|
6698
6738
|
default: !0
|
|
6699
6739
|
}
|
|
6700
6740
|
}
|
|
6701
|
-
},
|
|
6741
|
+
}, Aa = [
|
|
6702
6742
|
{ reads: "Levels (datums)", writes: "The same level in Revit, ensured by name" },
|
|
6703
6743
|
{ reads: "Wall runs, one per straight segment", writes: "A native wall: line, type (made from its width when missing), level, height, joins; its edited profile or its top on a roof" },
|
|
6704
6744
|
{ reads: "Curtain wall runs", writes: "Revit's curtain wall: its grid lines, mullions and panels" },
|
|
@@ -6711,7 +6751,7 @@ const wa = {
|
|
|
6711
6751
|
{ reads: "Everything else with a body: doors, windows, furniture, fixtures, proxies, columns, railings", writes: "A family made from the file's own shape, one per shape, placed where the file has it (doors and windows in their wall)" },
|
|
6712
6752
|
{ reads: "Things this recipe made whose record is gone", writes: "That element removed" },
|
|
6713
6753
|
{ reads: "Hosted doors/windows, footings, ramps, other bodies", writes: "Nothing yet - read and counted" }
|
|
6714
|
-
],
|
|
6754
|
+
], vi = `
|
|
6715
6755
|
## How to use it
|
|
6716
6756
|
|
|
6717
6757
|
In Revit, with the That Open plugin: **That Open > Select recipe**, pick this
|
|
@@ -6759,19 +6799,19 @@ are read and counted, and their rule row says so.
|
|
|
6759
6799
|
Records are metres and radians, Z up; Revit gets feet and degrees. Types are
|
|
6760
6800
|
matched exactly by name; Revit refuses the whole apply when a loadable type is
|
|
6761
6801
|
missing (system types are created from their width instead).
|
|
6762
|
-
`,
|
|
6802
|
+
`, bi = {
|
|
6763
6803
|
name: "frag-to-revit",
|
|
6764
6804
|
title: "Platform model to Revit",
|
|
6765
6805
|
description: "Builds in Revit the platform records of a .frag: levels, walls, curtain walls, floors, roofs, ceilings, stairs, columns, instances.",
|
|
6766
6806
|
to: "revit",
|
|
6767
6807
|
inputs: ["frag-model"],
|
|
6768
6808
|
source: { kind: "project-file", extensions: ["frag"] },
|
|
6769
|
-
settingsSchema:
|
|
6770
|
-
rules:
|
|
6771
|
-
doc:
|
|
6772
|
-
run:
|
|
6773
|
-
},
|
|
6774
|
-
...
|
|
6809
|
+
settingsSchema: _a,
|
|
6810
|
+
rules: Aa,
|
|
6811
|
+
doc: vi,
|
|
6812
|
+
run: wi("frag")
|
|
6813
|
+
}, Oa = {
|
|
6814
|
+
...bi,
|
|
6775
6815
|
name: "ifc-to-revit",
|
|
6776
6816
|
title: "IFC to Revit",
|
|
6777
6817
|
description: "Builds an IFC of the project in Revit as native elements: levels, walls, floors, roofs, stairs, curtain walls, columns, instances.",
|
|
@@ -6783,9 +6823,9 @@ missing (system types are created from their width instead).
|
|
|
6783
6823
|
It reads the IFC file itself, the version uploaded last. Its first step
|
|
6784
6824
|
converts it into the platform's records - what each element is, not only its
|
|
6785
6825
|
shape - and Revit gets those. Nothing has to be prepared before.
|
|
6786
|
-
` +
|
|
6787
|
-
run:
|
|
6788
|
-
},
|
|
6826
|
+
` + vi,
|
|
6827
|
+
run: wi("ifc")
|
|
6828
|
+
}, $a = {
|
|
6789
6829
|
millimeters: 1e-3,
|
|
6790
6830
|
millimetres: 1e-3,
|
|
6791
6831
|
mm: 1e-3,
|
|
@@ -6799,13 +6839,13 @@ shape - and Revit gets those. Nothing has to be prepared before.
|
|
|
6799
6839
|
in: 0.0254,
|
|
6800
6840
|
feet: 0.3048,
|
|
6801
6841
|
ft: 0.3048
|
|
6802
|
-
},
|
|
6803
|
-
function
|
|
6842
|
+
}, Ti = "rhino-to-revit", xa = `recipe:${Ti}`;
|
|
6843
|
+
function ka(s) {
|
|
6804
6844
|
const t = (s.attrs.Position ?? "").split(",").map((e) => Number(e.trim()));
|
|
6805
6845
|
return t.length !== 3 || t.some((e) => !Number.isFinite(e)) ? null : [t[0], t[1], t[2]];
|
|
6806
6846
|
}
|
|
6807
|
-
const
|
|
6808
|
-
name:
|
|
6847
|
+
const Ca = {
|
|
6848
|
+
name: Ti,
|
|
6809
6849
|
title: "Rhino to Revit",
|
|
6810
6850
|
description: "Places in Revit an instance of a chosen type at each placed object of a Rhino layer.",
|
|
6811
6851
|
to: "revit",
|
|
@@ -6872,13 +6912,13 @@ point's height.
|
|
|
6872
6912
|
`,
|
|
6873
6913
|
async run(s) {
|
|
6874
6914
|
var x;
|
|
6875
|
-
const { picked: t, contents: e } = await
|
|
6915
|
+
const { picked: t, contents: e } = await Is(
|
|
6876
6916
|
s,
|
|
6877
6917
|
s.input
|
|
6878
6918
|
), { layer: n, instanceType: r } = s.settings;
|
|
6879
6919
|
if (!n || !r)
|
|
6880
6920
|
throw new Error("Choose the layer and the Revit type.");
|
|
6881
|
-
const i = (x = e.metadata) == null ? void 0 : x.data, o = i == null ? void 0 : i.units, a = typeof o == "string" ?
|
|
6921
|
+
const i = (x = e.metadata) == null ? void 0 : x.data, o = i == null ? void 0 : i.units, a = typeof o == "string" ? $a[o.trim().toLowerCase()] : void 0;
|
|
6882
6922
|
if (!a)
|
|
6883
6923
|
throw new Error(
|
|
6884
6924
|
`"${t.name}" does not say what units its data is in${o ? ` ("${String(o)}" is not one this recipe knows)` : ""}, so nothing can be converted from it.`
|
|
@@ -6888,11 +6928,11 @@ point's height.
|
|
|
6888
6928
|
throw new Error(
|
|
6889
6929
|
`"${t.name}" declares its data as "${l}"; this recipe only converts Z up.`
|
|
6890
6930
|
);
|
|
6891
|
-
const d = a *
|
|
6931
|
+
const d = a * Fe, c = Es(s), m = new vs({
|
|
6892
6932
|
project: s.projectId,
|
|
6893
6933
|
document: s.target.docId ?? "",
|
|
6894
6934
|
baseCommit: s.target.version ?? 0,
|
|
6895
|
-
author:
|
|
6935
|
+
author: xa
|
|
6896
6936
|
});
|
|
6897
6937
|
let w = 0, v = 0, I = 0;
|
|
6898
6938
|
const _ = /* @__PURE__ */ new Set(), L = [];
|
|
@@ -6902,13 +6942,13 @@ point's height.
|
|
|
6902
6942
|
I++;
|
|
6903
6943
|
continue;
|
|
6904
6944
|
}
|
|
6905
|
-
const
|
|
6906
|
-
if (!
|
|
6945
|
+
const F = ka(E);
|
|
6946
|
+
if (!F) continue;
|
|
6907
6947
|
_.add(E.guid);
|
|
6908
6948
|
const z = [
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6949
|
+
F[0] * d,
|
|
6950
|
+
F[1] * d,
|
|
6951
|
+
F[2] * d
|
|
6912
6952
|
], ut = c.get(E.guid);
|
|
6913
6953
|
ut ? L.push({ instance: ut, object: E.guid, position: z }) : (m.add(
|
|
6914
6954
|
{
|
|
@@ -6922,11 +6962,11 @@ point's height.
|
|
|
6922
6962
|
for (const E of L)
|
|
6923
6963
|
m.set(E.instance, {}, { position: E.position, source: E.object }), v++;
|
|
6924
6964
|
let $ = 0;
|
|
6925
|
-
for (const [E,
|
|
6926
|
-
_.has(E) || (m.remove(
|
|
6965
|
+
for (const [E, F] of c)
|
|
6966
|
+
_.has(E) || (m.remove(F), $++);
|
|
6927
6967
|
const O = w + v + $;
|
|
6928
6968
|
if (O === 0)
|
|
6929
|
-
throw new
|
|
6969
|
+
throw new fi(
|
|
6930
6970
|
`Nothing to write: layer "${n}" of "${t.name}" has no placed object, and nothing of this recipe is left to remove.`
|
|
6931
6971
|
);
|
|
6932
6972
|
return {
|
|
@@ -6946,67 +6986,68 @@ point's height.
|
|
|
6946
6986
|
]
|
|
6947
6987
|
};
|
|
6948
6988
|
}
|
|
6949
|
-
},
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6989
|
+
}, Ra = [
|
|
6990
|
+
Ca,
|
|
6991
|
+
Oa,
|
|
6992
|
+
bi
|
|
6953
6993
|
];
|
|
6954
|
-
function
|
|
6955
|
-
for (const t of
|
|
6994
|
+
function La(s) {
|
|
6995
|
+
for (const t of Ra) s.recipes.register(t);
|
|
6956
6996
|
}
|
|
6957
|
-
const
|
|
6997
|
+
const Pa = {
|
|
6958
6998
|
MAX_FIELDS: 200,
|
|
6959
6999
|
MAX_KEY_LENGTH: 50,
|
|
6960
7000
|
MAX_VALUE_LENGTH: 50
|
|
6961
|
-
},
|
|
7001
|
+
}, Ba = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, ja = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, Da = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, Ua = { uuid: "d8f3a1c2-6b4e-4f9a-8c1d-2e7b5a9f3c60" }, qa = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" }, Va = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, Ga = { uuid: "6f3a9c2e-8b1d-4e6a-9c3f-1d7b5a8e2c4f" }, Ha = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, Ja = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
|
|
6962
7002
|
export {
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7003
|
+
Ba as CDEManager,
|
|
7004
|
+
fa as ChannelClient,
|
|
7005
|
+
ui as ChannelRoom,
|
|
7006
|
+
ja as ClashesManager,
|
|
7007
|
+
la as CollabRoom,
|
|
7008
|
+
Bn as DOCUMENT_FILE,
|
|
7009
|
+
xn as DOCUMENT_SCHEMA,
|
|
7010
|
+
Kr as DOCUMENT_TYPES,
|
|
7011
|
+
Ao as DocumentDrafts,
|
|
7012
|
+
rs as EngineServicesClient,
|
|
7013
|
+
ha as ExternalRoom,
|
|
7014
|
+
Da as FileList,
|
|
7015
|
+
ar as FlowDoc,
|
|
7016
|
+
Ua as GISManager,
|
|
7017
|
+
qa as GitHistoryManager,
|
|
7018
|
+
Va as HelloWorld,
|
|
7019
|
+
Pa as METADATA_LIMITS,
|
|
7020
|
+
si as OP_SCHEMA,
|
|
7021
|
+
vs as OperationBuilder,
|
|
7022
|
+
hi as PROJECT_RECIPE_SCHEMA,
|
|
7023
|
+
Tr as PlatformClient,
|
|
7024
|
+
Xr as ProjectDocuments,
|
|
7025
|
+
qr as ProjectHistory,
|
|
7026
|
+
Ga as ProjectManager,
|
|
7027
|
+
Go as ProjectRecipes,
|
|
7028
|
+
Uo as RECIPE_NAME,
|
|
7029
|
+
Do as RecipeKit,
|
|
7030
|
+
Jo as Recipes,
|
|
7031
|
+
Ss as RequestError,
|
|
7032
|
+
_o as SELF_VIEWING_FORMATS,
|
|
7033
|
+
vr as STORAGE_BATCH_MAX,
|
|
7034
|
+
ir as StaleHistoryError,
|
|
7035
|
+
Ha as TopicsManager,
|
|
7036
|
+
Ja as UIManager,
|
|
7037
|
+
fi as UpToDate,
|
|
7038
|
+
Ra as builtinRecipes,
|
|
7039
|
+
wr as compileRecipe,
|
|
7040
|
+
Fa as describeChanges,
|
|
7041
|
+
lr as documentTypeOf,
|
|
7042
|
+
bi as fragToRevit,
|
|
7043
|
+
Oa as ifcToRevit,
|
|
7044
|
+
Wo as latestVersions,
|
|
7045
|
+
Yr as mintGuid,
|
|
7046
|
+
zr as orderByGraph,
|
|
7047
|
+
bs as readFrag,
|
|
7048
|
+
La as registerBuiltinRecipes,
|
|
7049
|
+
Ca as rhinoToRevit,
|
|
7050
|
+
Zn as stampOf,
|
|
7051
|
+
aa as windowTransport
|
|
7011
7052
|
};
|
|
7012
7053
|
//# sourceMappingURL=index.es.js.map
|