@thatopen/services 0.26.1 → 0.28.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/index.es.js CHANGED
@@ -1,75 +1,75 @@
1
- var cn = Object.defineProperty;
2
- var Gt = (n) => {
1
+ var dn = Object.defineProperty;
2
+ var as = (n) => {
3
3
  throw TypeError(n);
4
4
  };
5
- var hn = (n, e, t) => e in n ? cn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
6
- var N = (n, e, t) => hn(n, typeof e != "symbol" ? e + "" : e, t), st = (n, e, t) => e.has(n) || Gt("Cannot " + t);
7
- var f = (n, e, t) => (st(n, e, "read from private field"), t ? t.call(n) : e.get(n)), _ = (n, e, t) => e.has(n) ? Gt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), k = (n, e, t, s) => (st(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t), c = (n, e, t) => (st(n, e, "access private method"), t);
8
- const W = /* @__PURE__ */ Object.create(null);
9
- W.open = "0";
10
- W.close = "1";
11
- W.ping = "2";
12
- W.pong = "3";
13
- W.message = "4";
14
- W.upgrade = "5";
15
- W.noop = "6";
16
- const Me = /* @__PURE__ */ Object.create(null);
17
- Object.keys(W).forEach((n) => {
18
- Me[W[n]] = n;
5
+ var un = (n, e, t) => e in n ? dn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
6
+ var B = (n, e, t) => un(n, typeof e != "symbol" ? e + "" : e, t), Tt = (n, e, t) => e.has(n) || as("Cannot " + t);
7
+ var u = (n, e, t) => (Tt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), S = (n, e, t) => e.has(n) ? as("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), R = (n, e, t, s) => (Tt(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t), h = (n, e, t) => (Tt(n, e, "access private method"), t);
8
+ const ne = /* @__PURE__ */ Object.create(null);
9
+ ne.open = "0";
10
+ ne.close = "1";
11
+ ne.ping = "2";
12
+ ne.pong = "3";
13
+ ne.message = "4";
14
+ ne.upgrade = "5";
15
+ ne.noop = "6";
16
+ const lt = /* @__PURE__ */ Object.create(null);
17
+ Object.keys(ne).forEach((n) => {
18
+ lt[ne[n]] = n;
19
19
  });
20
- const ht = { type: "error", data: "parser error" }, fs = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", ps = typeof ArrayBuffer == "function", ms = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n && n.buffer instanceof ArrayBuffer, xt = ({ type: n, data: e }, t, s) => fs && e instanceof Blob ? t ? s(e) : Ht(e, s) : ps && (e instanceof ArrayBuffer || ms(e)) ? t ? s(e) : Ht(new Blob([e]), s) : s(W[n] + (e || "")), Ht = (n, e) => {
20
+ const Ct = { type: "error", data: "parser error" }, Rs = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", Cs = typeof ArrayBuffer == "function", $s = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n && n.buffer instanceof ArrayBuffer, Zt = ({ type: n, data: e }, t, s) => Rs && e instanceof Blob ? t ? s(e) : cs(e, s) : Cs && (e instanceof ArrayBuffer || $s(e)) ? t ? s(e) : cs(new Blob([e]), s) : s(ne[n] + (e || "")), cs = (n, e) => {
21
21
  const t = new FileReader();
22
22
  return t.onload = function() {
23
23
  const s = t.result.split(",")[1];
24
24
  e("b" + (s || ""));
25
25
  }, t.readAsDataURL(n);
26
26
  };
27
- function Jt(n) {
27
+ function hs(n) {
28
28
  return n instanceof Uint8Array ? n : n instanceof ArrayBuffer ? new Uint8Array(n) : new Uint8Array(n.buffer, n.byteOffset, n.byteLength);
29
29
  }
30
- let nt;
31
- function ln(n, e) {
32
- if (fs && n.data instanceof Blob)
33
- return n.data.arrayBuffer().then(Jt).then(e);
34
- if (ps && (n.data instanceof ArrayBuffer || ms(n.data)))
35
- return e(Jt(n.data));
36
- xt(n, !1, (t) => {
37
- nt || (nt = new TextEncoder()), e(nt.encode(t));
30
+ let _t;
31
+ function fn(n, e) {
32
+ if (Rs && n.data instanceof Blob)
33
+ return n.data.arrayBuffer().then(hs).then(e);
34
+ if (Cs && (n.data instanceof ArrayBuffer || $s(n.data)))
35
+ return e(hs(n.data));
36
+ Zt(n, !1, (t) => {
37
+ _t || (_t = new TextEncoder()), e(_t.encode(t));
38
38
  });
39
39
  }
40
- const Wt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ae = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
41
- for (let n = 0; n < Wt.length; n++)
42
- Ae[Wt.charCodeAt(n)] = n;
43
- const dn = (n) => {
40
+ const ls = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Je = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
41
+ for (let n = 0; n < ls.length; n++)
42
+ Je[ls.charCodeAt(n)] = n;
43
+ const pn = (n) => {
44
44
  let e = n.length * 0.75, t = n.length, s, r = 0, i, o, a, l;
45
45
  n[n.length - 1] === "=" && (e--, n[n.length - 2] === "=" && e--);
46
- const u = new ArrayBuffer(e), h = new Uint8Array(u);
46
+ const d = new ArrayBuffer(e), c = new Uint8Array(d);
47
47
  for (s = 0; s < t; s += 4)
48
- i = Ae[n.charCodeAt(s)], o = Ae[n.charCodeAt(s + 1)], a = Ae[n.charCodeAt(s + 2)], l = Ae[n.charCodeAt(s + 3)], h[r++] = i << 2 | o >> 4, h[r++] = (o & 15) << 4 | a >> 2, h[r++] = (a & 3) << 6 | l & 63;
49
- return u;
50
- }, un = typeof ArrayBuffer == "function", Nt = (n, e) => {
48
+ i = Je[n.charCodeAt(s)], o = Je[n.charCodeAt(s + 1)], a = Je[n.charCodeAt(s + 2)], l = Je[n.charCodeAt(s + 3)], c[r++] = i << 2 | o >> 4, c[r++] = (o & 15) << 4 | a >> 2, c[r++] = (a & 3) << 6 | l & 63;
49
+ return d;
50
+ }, mn = typeof ArrayBuffer == "function", es = (n, e) => {
51
51
  if (typeof n != "string")
52
52
  return {
53
53
  type: "message",
54
- data: ys(n, e)
54
+ data: xs(n, e)
55
55
  };
56
56
  const t = n.charAt(0);
57
57
  return t === "b" ? {
58
58
  type: "message",
59
- data: fn(n.substring(1), e)
60
- } : Me[t] ? n.length > 1 ? {
61
- type: Me[t],
59
+ data: yn(n.substring(1), e)
60
+ } : lt[t] ? n.length > 1 ? {
61
+ type: lt[t],
62
62
  data: n.substring(1)
63
63
  } : {
64
- type: Me[t]
65
- } : ht;
66
- }, fn = (n, e) => {
67
- if (un) {
68
- const t = dn(n);
69
- return ys(t, e);
64
+ type: lt[t]
65
+ } : Ct;
66
+ }, yn = (n, e) => {
67
+ if (mn) {
68
+ const t = pn(n);
69
+ return xs(t, e);
70
70
  } else
71
71
  return { base64: !0, data: n };
72
- }, ys = (n, e) => {
72
+ }, xs = (n, e) => {
73
73
  switch (e) {
74
74
  case "blob":
75
75
  return n instanceof Blob ? n : new Blob([n]);
@@ -77,27 +77,27 @@ const dn = (n) => {
77
77
  default:
78
78
  return n instanceof ArrayBuffer ? n : n.buffer;
79
79
  }
80
- }, gs = "", pn = (n, e) => {
80
+ }, Ns = "", gn = (n, e) => {
81
81
  const t = n.length, s = new Array(t);
82
82
  let r = 0;
83
83
  n.forEach((i, o) => {
84
- xt(i, !1, (a) => {
85
- s[o] = a, ++r === t && e(s.join(gs));
84
+ Zt(i, !1, (a) => {
85
+ s[o] = a, ++r === t && e(s.join(Ns));
86
86
  });
87
87
  });
88
- }, mn = (n, e) => {
89
- const t = n.split(gs), s = [];
88
+ }, wn = (n, e) => {
89
+ const t = n.split(Ns), s = [];
90
90
  for (let r = 0; r < t.length; r++) {
91
- const i = Nt(t[r], e);
91
+ const i = es(t[r], e);
92
92
  if (s.push(i), i.type === "error")
93
93
  break;
94
94
  }
95
95
  return s;
96
96
  };
97
- function yn() {
97
+ function bn() {
98
98
  return new TransformStream({
99
99
  transform(n, e) {
100
- ln(n, (t) => {
100
+ fn(n, (t) => {
101
101
  const s = t.length;
102
102
  let r;
103
103
  if (s < 126)
@@ -116,11 +116,11 @@ function yn() {
116
116
  }
117
117
  });
118
118
  }
119
- let rt;
120
- function qe(n) {
119
+ let It;
120
+ function it(n) {
121
121
  return n.reduce((e, t) => e + t.length, 0);
122
122
  }
123
- function je(n, e) {
123
+ function ot(n, e) {
124
124
  if (n[0].length === e)
125
125
  return n.shift();
126
126
  const t = new Uint8Array(e);
@@ -129,65 +129,65 @@ function je(n, e) {
129
129
  t[r] = n[0][s++], s === n[0].length && (n.shift(), s = 0);
130
130
  return n.length && s < n[0].length && (n[0] = n[0].slice(s)), t;
131
131
  }
132
- function gn(n, e) {
133
- rt || (rt = new TextDecoder());
132
+ function vn(n, e) {
133
+ It || (It = new TextDecoder());
134
134
  const t = [];
135
135
  let s = 0, r = -1, i = !1;
136
136
  return new TransformStream({
137
137
  transform(o, a) {
138
138
  for (t.push(o); ; ) {
139
139
  if (s === 0) {
140
- if (qe(t) < 1)
140
+ if (it(t) < 1)
141
141
  break;
142
- const l = je(t, 1);
142
+ const l = ot(t, 1);
143
143
  i = (l[0] & 128) === 128, r = l[0] & 127, r < 126 ? s = 3 : r === 126 ? s = 1 : s = 2;
144
144
  } else if (s === 1) {
145
- if (qe(t) < 2)
145
+ if (it(t) < 2)
146
146
  break;
147
- const l = je(t, 2);
147
+ const l = ot(t, 2);
148
148
  r = new DataView(l.buffer, l.byteOffset, l.length).getUint16(0), s = 3;
149
149
  } else if (s === 2) {
150
- if (qe(t) < 8)
150
+ if (it(t) < 8)
151
151
  break;
152
- const l = je(t, 8), u = new DataView(l.buffer, l.byteOffset, l.length), h = u.getUint32(0);
153
- if (h > Math.pow(2, 21) - 1) {
154
- a.enqueue(ht);
152
+ const l = ot(t, 8), d = new DataView(l.buffer, l.byteOffset, l.length), c = d.getUint32(0);
153
+ if (c > Math.pow(2, 21) - 1) {
154
+ a.enqueue(Ct);
155
155
  break;
156
156
  }
157
- r = h * Math.pow(2, 32) + u.getUint32(4), s = 3;
157
+ r = c * Math.pow(2, 32) + d.getUint32(4), s = 3;
158
158
  } else {
159
- if (qe(t) < r)
159
+ if (it(t) < r)
160
160
  break;
161
- const l = je(t, r);
162
- a.enqueue(Nt(i ? l : rt.decode(l), e)), s = 0;
161
+ const l = ot(t, r);
162
+ a.enqueue(es(i ? l : It.decode(l), e)), s = 0;
163
163
  }
164
164
  if (r === 0 || r > n) {
165
- a.enqueue(ht);
165
+ a.enqueue(Ct);
166
166
  break;
167
167
  }
168
168
  }
169
169
  }
170
170
  });
171
171
  }
172
- const ws = 4;
173
- function O(n) {
174
- if (n) return wn(n);
172
+ const Ps = 4;
173
+ function C(n) {
174
+ if (n) return En(n);
175
175
  }
176
- function wn(n) {
177
- for (var e in O.prototype)
178
- n[e] = O.prototype[e];
176
+ function En(n) {
177
+ for (var e in C.prototype)
178
+ n[e] = C.prototype[e];
179
179
  return n;
180
180
  }
181
- O.prototype.on = O.prototype.addEventListener = function(n, e) {
181
+ C.prototype.on = C.prototype.addEventListener = function(n, e) {
182
182
  return this._callbacks = this._callbacks || {}, (this._callbacks["$" + n] = this._callbacks["$" + n] || []).push(e), this;
183
183
  };
184
- O.prototype.once = function(n, e) {
184
+ C.prototype.once = function(n, e) {
185
185
  function t() {
186
186
  this.off(n, t), e.apply(this, arguments);
187
187
  }
188
188
  return t.fn = e, this.on(n, t), this;
189
189
  };
190
- O.prototype.off = O.prototype.removeListener = O.prototype.removeAllListeners = O.prototype.removeEventListener = function(n, e) {
190
+ C.prototype.off = C.prototype.removeListener = C.prototype.removeAllListeners = C.prototype.removeEventListener = function(n, e) {
191
191
  if (this._callbacks = this._callbacks || {}, arguments.length == 0)
192
192
  return this._callbacks = {}, this;
193
193
  var t = this._callbacks["$" + n];
@@ -201,7 +201,7 @@ O.prototype.off = O.prototype.removeListener = O.prototype.removeAllListeners =
201
201
  }
202
202
  return t.length === 0 && delete this._callbacks["$" + n], this;
203
203
  };
204
- O.prototype.emit = function(n) {
204
+ C.prototype.emit = function(n) {
205
205
  this._callbacks = this._callbacks || {};
206
206
  for (var e = new Array(arguments.length - 1), t = this._callbacks["$" + n], s = 1; s < arguments.length; s++)
207
207
  e[s - 1] = arguments[s];
@@ -212,41 +212,41 @@ O.prototype.emit = function(n) {
212
212
  }
213
213
  return this;
214
214
  };
215
- O.prototype.emitReserved = O.prototype.emit;
216
- O.prototype.listeners = function(n) {
215
+ C.prototype.emitReserved = C.prototype.emit;
216
+ C.prototype.listeners = function(n) {
217
217
  return this._callbacks = this._callbacks || {}, this._callbacks["$" + n] || [];
218
218
  };
219
- O.prototype.hasListeners = function(n) {
219
+ C.prototype.hasListeners = function(n) {
220
220
  return !!this.listeners(n).length;
221
221
  };
222
- const Qe = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), q = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), bn = "arraybuffer";
223
- function bs(n, ...e) {
222
+ const vt = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), V = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Tn = "arraybuffer";
223
+ function Bs(n, ...e) {
224
224
  return e.reduce((t, s) => (n.hasOwnProperty(s) && (t[s] = n[s]), t), {});
225
225
  }
226
- const vn = q.setTimeout, En = q.clearTimeout;
227
- function Ze(n, e) {
228
- e.useNativeTimers ? (n.setTimeoutFn = vn.bind(q), n.clearTimeoutFn = En.bind(q)) : (n.setTimeoutFn = q.setTimeout.bind(q), n.clearTimeoutFn = q.clearTimeout.bind(q));
226
+ const _n = V.setTimeout, In = V.clearTimeout;
227
+ function Et(n, e) {
228
+ e.useNativeTimers ? (n.setTimeoutFn = _n.bind(V), n.clearTimeoutFn = In.bind(V)) : (n.setTimeoutFn = V.setTimeout.bind(V), n.clearTimeoutFn = V.clearTimeout.bind(V));
229
229
  }
230
- const _n = 1.33;
231
- function Tn(n) {
232
- return typeof n == "string" ? In(n) : Math.ceil((n.byteLength || n.size) * _n);
230
+ const Sn = 1.33;
231
+ function kn(n) {
232
+ return typeof n == "string" ? On(n) : Math.ceil((n.byteLength || n.size) * Sn);
233
233
  }
234
- function In(n) {
234
+ function On(n) {
235
235
  let e = 0, t = 0;
236
236
  for (let s = 0, r = n.length; s < r; s++)
237
237
  e = n.charCodeAt(s), e < 128 ? t += 1 : e < 2048 ? t += 2 : e < 55296 || e >= 57344 ? t += 3 : (s++, t += 4);
238
238
  return t;
239
239
  }
240
- function vs() {
240
+ function Ls() {
241
241
  return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
242
242
  }
243
- function Sn(n) {
243
+ function An(n) {
244
244
  let e = "";
245
245
  for (let t in n)
246
246
  n.hasOwnProperty(t) && (e.length && (e += "&"), e += encodeURIComponent(t) + "=" + encodeURIComponent(n[t]));
247
247
  return e;
248
248
  }
249
- function kn(n) {
249
+ function Rn(n) {
250
250
  let e = {}, t = n.split("&");
251
251
  for (let s = 0, r = t.length; s < r; s++) {
252
252
  let i = t[s].split("=");
@@ -254,12 +254,12 @@ function kn(n) {
254
254
  }
255
255
  return e;
256
256
  }
257
- class On extends Error {
257
+ class Cn extends Error {
258
258
  constructor(e, t, s) {
259
259
  super(e), this.description = t, this.context = s, this.type = "TransportError";
260
260
  }
261
261
  }
262
- class Pt extends O {
262
+ class ts extends C {
263
263
  /**
264
264
  * Transport abstract constructor.
265
265
  *
@@ -267,7 +267,7 @@ class Pt extends O {
267
267
  * @protected
268
268
  */
269
269
  constructor(e) {
270
- super(), this.writable = !1, Ze(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
270
+ super(), this.writable = !1, Et(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
271
271
  }
272
272
  /**
273
273
  * Emits an error.
@@ -279,7 +279,7 @@ class Pt extends O {
279
279
  * @protected
280
280
  */
281
281
  onError(e, t, s) {
282
- return super.emitReserved("error", new On(e, t, s)), this;
282
+ return super.emitReserved("error", new Cn(e, t, s)), this;
283
283
  }
284
284
  /**
285
285
  * Opens the transport.
@@ -316,7 +316,7 @@ class Pt extends O {
316
316
  * @protected
317
317
  */
318
318
  onData(e) {
319
- const t = Nt(e, this.socket.binaryType);
319
+ const t = es(e, this.socket.binaryType);
320
320
  this.onPacket(t);
321
321
  }
322
322
  /**
@@ -353,11 +353,11 @@ class Pt extends O {
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(e) {
356
- const t = Sn(e);
356
+ const t = An(e);
357
357
  return t.length ? "?" + t : "";
358
358
  }
359
359
  }
360
- class An extends Pt {
360
+ class $n extends ts {
361
361
  constructor() {
362
362
  super(...arguments), this._polling = !1;
363
363
  }
@@ -413,7 +413,7 @@ class An extends Pt {
413
413
  return this.onClose({ description: "transport closed by the server" }), !1;
414
414
  this.onPacket(s);
415
415
  };
416
- mn(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
416
+ wn(e, this.socket.binaryType).forEach(t), 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 An extends Pt {
433
433
  * @protected
434
434
  */
435
435
  write(e) {
436
- this.writable = !1, pn(e, (t) => {
436
+ this.writable = !1, gn(e, (t) => {
437
437
  this.doWrite(t, () => {
438
438
  this.writable = !0, this.emitReserved("drain");
439
439
  });
@@ -446,18 +446,18 @@ class An extends Pt {
446
446
  */
447
447
  uri() {
448
448
  const e = this.opts.secure ? "https" : "http", t = this.query || {};
449
- return this.opts.timestampRequests !== !1 && (t[this.opts.timestampParam] = vs()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
449
+ return this.opts.timestampRequests !== !1 && (t[this.opts.timestampParam] = Ls()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
450
450
  }
451
451
  }
452
- let Es = !1;
452
+ let Fs = !1;
453
453
  try {
454
- Es = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
454
+ Fs = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
455
455
  } catch {
456
456
  }
457
- const Rn = Es;
458
- function Cn() {
457
+ const xn = Fs;
458
+ function Nn() {
459
459
  }
460
- class $n extends An {
460
+ class Pn extends $n {
461
461
  /**
462
462
  * XHR Polling constructor.
463
463
  *
@@ -499,7 +499,7 @@ class $n extends An {
499
499
  }), this.pollXhr = e;
500
500
  }
501
501
  }
502
- class J extends O {
502
+ class se extends C {
503
503
  /**
504
504
  * Request constructor
505
505
  *
@@ -507,7 +507,7 @@ class J extends O {
507
507
  * @package
508
508
  */
509
509
  constructor(e, t, s) {
510
- super(), this.createRequest = e, Ze(this, s), this._opts = s, this._method = s.method || "GET", this._uri = t, this._data = s.data !== void 0 ? s.data : null, this._create();
510
+ super(), this.createRequest = e, Et(this, s), this._opts = s, this._method = s.method || "GET", this._uri = t, this._data = s.data !== void 0 ? s.data : null, this._create();
511
511
  }
512
512
  /**
513
513
  * Creates the XHR object and sends the request.
@@ -516,7 +516,7 @@ class J extends O {
516
516
  */
517
517
  _create() {
518
518
  var e;
519
- const t = bs(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
519
+ const t = Bs(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
520
520
  t.xdomain = !!this._opts.xd;
521
521
  const s = this._xhr = this.createRequest(t);
522
522
  try {
@@ -553,7 +553,7 @@ class J extends O {
553
553
  }, 0);
554
554
  return;
555
555
  }
556
- typeof document < "u" && (this._index = J.requestsCount++, J.requests[this._index] = this);
556
+ typeof document < "u" && (this._index = se.requestsCount++, se.requests[this._index] = this);
557
557
  }
558
558
  /**
559
559
  * Called upon error.
@@ -570,12 +570,12 @@ class J extends O {
570
570
  */
571
571
  _cleanup(e) {
572
572
  if (!(typeof this._xhr > "u" || this._xhr === null)) {
573
- if (this._xhr.onreadystatechange = Cn, e)
573
+ if (this._xhr.onreadystatechange = Nn, e)
574
574
  try {
575
575
  this._xhr.abort();
576
576
  } catch {
577
577
  }
578
- typeof document < "u" && delete J.requests[this._index], this._xhr = null;
578
+ typeof document < "u" && delete se.requests[this._index], this._xhr = null;
579
579
  }
580
580
  }
581
581
  /**
@@ -596,56 +596,56 @@ class J extends O {
596
596
  this._cleanup();
597
597
  }
598
598
  }
599
- J.requestsCount = 0;
600
- J.requests = {};
599
+ se.requestsCount = 0;
600
+ se.requests = {};
601
601
  if (typeof document < "u") {
602
602
  if (typeof attachEvent == "function")
603
- attachEvent("onunload", Yt);
603
+ attachEvent("onunload", ds);
604
604
  else if (typeof addEventListener == "function") {
605
- const n = "onpagehide" in q ? "pagehide" : "unload";
606
- addEventListener(n, Yt, !1);
605
+ const n = "onpagehide" in V ? "pagehide" : "unload";
606
+ addEventListener(n, ds, !1);
607
607
  }
608
608
  }
609
- function Yt() {
610
- for (let n in J.requests)
611
- J.requests.hasOwnProperty(n) && J.requests[n].abort();
609
+ function ds() {
610
+ for (let n in se.requests)
611
+ se.requests.hasOwnProperty(n) && se.requests[n].abort();
612
612
  }
613
- const xn = function() {
614
- const n = _s({
613
+ const Bn = function() {
614
+ const n = Ds({
615
615
  xdomain: !1
616
616
  });
617
617
  return n && n.responseType !== null;
618
618
  }();
619
- class Nn extends $n {
619
+ class Ln extends Pn {
620
620
  constructor(e) {
621
621
  super(e);
622
622
  const t = e && e.forceBase64;
623
- this.supportsBinary = xn && !t;
623
+ this.supportsBinary = Bn && !t;
624
624
  }
625
625
  request(e = {}) {
626
- return Object.assign(e, { xd: this.xd }, this.opts), new J(_s, this.uri(), e);
626
+ return Object.assign(e, { xd: this.xd }, this.opts), new se(Ds, this.uri(), e);
627
627
  }
628
628
  }
629
- function _s(n) {
629
+ function Ds(n) {
630
630
  const e = n.xdomain;
631
631
  try {
632
- if (typeof XMLHttpRequest < "u" && (!e || Rn))
632
+ if (typeof XMLHttpRequest < "u" && (!e || xn))
633
633
  return new XMLHttpRequest();
634
634
  } catch {
635
635
  }
636
636
  if (!e)
637
637
  try {
638
- return new q[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
638
+ return new V[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
639
639
  } catch {
640
640
  }
641
641
  }
642
- const Ts = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
643
- class Pn extends Pt {
642
+ const qs = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
643
+ class Fn extends ts {
644
644
  get name() {
645
645
  return "websocket";
646
646
  }
647
647
  doOpen() {
648
- const e = this.uri(), t = this.opts.protocols, s = Ts ? {} : bs(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
648
+ const e = this.uri(), t = this.opts.protocols, s = qs ? {} : Bs(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
649
649
  this.opts.extraHeaders && (s.headers = this.opts.extraHeaders);
650
650
  try {
651
651
  this.ws = this.createSocket(e, t, s);
@@ -671,12 +671,12 @@ class Pn extends Pt {
671
671
  this.writable = !1;
672
672
  for (let t = 0; t < e.length; t++) {
673
673
  const s = e[t], r = t === e.length - 1;
674
- xt(s, this.supportsBinary, (i) => {
674
+ Zt(s, this.supportsBinary, (i) => {
675
675
  try {
676
676
  this.doWrite(s, i);
677
677
  } catch {
678
678
  }
679
- r && Qe(() => {
679
+ r && vt(() => {
680
680
  this.writable = !0, this.emitReserved("drain");
681
681
  }, this.setTimeoutFn);
682
682
  });
@@ -693,19 +693,19 @@ class Pn extends Pt {
693
693
  */
694
694
  uri() {
695
695
  const e = this.opts.secure ? "wss" : "ws", t = this.query || {};
696
- return this.opts.timestampRequests && (t[this.opts.timestampParam] = vs()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
696
+ return this.opts.timestampRequests && (t[this.opts.timestampParam] = Ls()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
697
697
  }
698
698
  }
699
- const it = q.WebSocket || q.MozWebSocket;
700
- class Bn extends Pn {
699
+ const St = V.WebSocket || V.MozWebSocket;
700
+ class Dn extends Fn {
701
701
  createSocket(e, t, s) {
702
- return Ts ? new it(e, t, s) : t ? new it(e, t) : new it(e);
702
+ return qs ? new St(e, t, s) : t ? new St(e, t) : new St(e);
703
703
  }
704
704
  doWrite(e, t) {
705
705
  this.ws.send(t);
706
706
  }
707
707
  }
708
- class Fn extends Pt {
708
+ class qn extends ts {
709
709
  get name() {
710
710
  return "webtransport";
711
711
  }
@@ -721,7 +721,7 @@ class Fn extends Pt {
721
721
  this.onError("webtransport error", e);
722
722
  }), this._transport.ready.then(() => {
723
723
  this._transport.createBidirectionalStream().then((e) => {
724
- const t = gn(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), r = yn();
724
+ const t = vn(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), r = bn();
725
725
  r.readable.pipeTo(e.writable), this._writer = r.writable.getWriter();
726
726
  const i = () => {
727
727
  s.read().then(({ done: a, value: l }) => {
@@ -740,7 +740,7 @@ class Fn extends Pt {
740
740
  for (let t = 0; t < e.length; t++) {
741
741
  const s = e[t], r = t === e.length - 1;
742
742
  this._writer.write(s).then(() => {
743
- r && Qe(() => {
743
+ r && vt(() => {
744
744
  this.writable = !0, this.emitReserved("drain");
745
745
  }, this.setTimeoutFn);
746
746
  });
@@ -751,11 +751,11 @@ class Fn extends Pt {
751
751
  (e = this._transport) === null || e === void 0 || e.close();
752
752
  }
753
753
  }
754
- const Ln = {
755
- websocket: Bn,
756
- webtransport: Fn,
757
- polling: Nn
758
- }, qn = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, jn = [
754
+ const jn = {
755
+ websocket: Dn,
756
+ webtransport: qn,
757
+ polling: Ln
758
+ }, Un = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, Mn = [
759
759
  "source",
760
760
  "protocol",
761
761
  "authority",
@@ -771,31 +771,31 @@ const Ln = {
771
771
  "query",
772
772
  "anchor"
773
773
  ];
774
- function lt(n) {
774
+ function $t(n) {
775
775
  if (n.length > 8e3)
776
776
  throw "URI too long";
777
777
  const e = n, t = n.indexOf("["), s = n.indexOf("]");
778
778
  t != -1 && s != -1 && (n = n.substring(0, t) + n.substring(t, s).replace(/:/g, ";") + n.substring(s, n.length));
779
- let r = qn.exec(n || ""), i = {}, o = 14;
779
+ let r = Un.exec(n || ""), i = {}, o = 14;
780
780
  for (; o--; )
781
- i[jn[o]] = r[o] || "";
782
- return t != -1 && s != -1 && (i.source = e, 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 = Dn(i, i.path), i.queryKey = Un(i, i.query), i;
781
+ i[Mn[o]] = r[o] || "";
782
+ return t != -1 && s != -1 && (i.source = e, 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 = Vn(i, i.path), i.queryKey = Hn(i, i.query), i;
783
783
  }
784
- function Dn(n, e) {
784
+ function Vn(n, e) {
785
785
  const t = /\/{2,9}/g, s = e.replace(t, "/").split("/");
786
786
  return (e.slice(0, 1) == "/" || e.length === 0) && s.splice(0, 1), e.slice(-1) == "/" && s.splice(s.length - 1, 1), s;
787
787
  }
788
- function Un(n, e) {
788
+ function Hn(n, e) {
789
789
  const t = {};
790
790
  return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(s, r, i) {
791
791
  r && (t[r] = i);
792
792
  }), t;
793
793
  }
794
- const dt = typeof addEventListener == "function" && typeof removeEventListener == "function", Ve = [];
795
- dt && addEventListener("offline", () => {
796
- Ve.forEach((n) => n());
794
+ const xt = typeof addEventListener == "function" && typeof removeEventListener == "function", dt = [];
795
+ xt && addEventListener("offline", () => {
796
+ dt.forEach((n) => n());
797
797
  }, !1);
798
- class he extends O {
798
+ class ge extends C {
799
799
  /**
800
800
  * Socket constructor.
801
801
  *
@@ -803,11 +803,11 @@ class he extends O {
803
803
  * @param {Object} opts - options
804
804
  */
805
805
  constructor(e, t) {
806
- if (super(), this.binaryType = bn, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, e && typeof e == "object" && (t = e, e = null), e) {
807
- const s = lt(e);
806
+ if (super(), this.binaryType = Tn, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, e && typeof e == "object" && (t = e, e = null), e) {
807
+ const s = $t(e);
808
808
  t.hostname = s.host, t.secure = s.protocol === "https" || s.protocol === "wss", t.port = s.port, s.query && (t.query = s.query);
809
- } else t.host && (t.hostname = lt(t.host).host);
810
- Ze(this, t), this.secure = t.secure != null ? t.secure : typeof location < "u" && location.protocol === "https:", t.hostname && !t.port && (t.port = this.secure ? "443" : "80"), this.hostname = t.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = t.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, t.transports.forEach((s) => {
809
+ } else t.host && (t.hostname = $t(t.host).host);
810
+ Et(this, t), this.secure = t.secure != null ? t.secure : typeof location < "u" && location.protocol === "https:", t.hostname && !t.port && (t.port = this.secure ? "443" : "80"), this.hostname = t.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = t.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, t.transports.forEach((s) => {
811
811
  const r = s.prototype.name;
812
812
  this.transports.push(r), this._transportsByName[r] = s;
813
813
  }), this.opts = Object.assign({
@@ -824,13 +824,13 @@ class he extends O {
824
824
  },
825
825
  transportOptions: {},
826
826
  closeOnBeforeunload: !1
827
- }, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = kn(this.opts.query)), dt && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
827
+ }, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = Rn(this.opts.query)), xt && (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
- }, Ve.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open();
833
+ }, dt.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 he extends O {
841
841
  */
842
842
  createTransport(e) {
843
843
  const t = Object.assign({}, this.opts.query);
844
- t.EIO = ws, t.transport = e, this.id && (t.sid = this.id);
844
+ t.EIO = Ps, t.transport = e, this.id && (t.sid = this.id);
845
845
  const s = Object.assign({}, this.opts, {
846
846
  query: t,
847
847
  socket: this,
@@ -863,7 +863,7 @@ class he extends O {
863
863
  }, 0);
864
864
  return;
865
865
  }
866
- const e = this.opts.rememberUpgrade && he.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1 ? "websocket" : this.transports[0];
866
+ const e = this.opts.rememberUpgrade && ge.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1 ? "websocket" : this.transports[0];
867
867
  this.readyState = "opening";
868
868
  const t = this.createTransport(e);
869
869
  t.open(), this.setTransport(t);
@@ -882,7 +882,7 @@ class he extends O {
882
882
  * @private
883
883
  */
884
884
  onOpen() {
885
- this.readyState = "open", he.priorWebsocketSuccess = this.transport.name === "websocket", this.emitReserved("open"), this.flush();
885
+ this.readyState = "open", ge.priorWebsocketSuccess = this.transport.name === "websocket", this.emitReserved("open"), this.flush();
886
886
  }
887
887
  /**
888
888
  * Handles a packet.
@@ -959,7 +959,7 @@ class he extends O {
959
959
  let t = 1;
960
960
  for (let s = 0; s < this.writeBuffer.length; s++) {
961
961
  const r = this.writeBuffer[s].data;
962
- if (r && (t += Tn(r)), s > 0 && t > this._maxPayload)
962
+ if (r && (t += kn(r)), s > 0 && t > this._maxPayload)
963
963
  return this.writeBuffer.slice(0, s);
964
964
  t += 2;
965
965
  }
@@ -979,7 +979,7 @@ class he extends O {
979
979
  if (!this._pingTimeoutTime)
980
980
  return !0;
981
981
  const e = Date.now() > this._pingTimeoutTime;
982
- return e && (this._pingTimeoutTime = 0, Qe(() => {
982
+ return e && (this._pingTimeoutTime = 0, vt(() => {
983
983
  this._onClose("ping timeout");
984
984
  }, this.setTimeoutFn)), e;
985
985
  }
@@ -1046,7 +1046,7 @@ class he extends O {
1046
1046
  * @private
1047
1047
  */
1048
1048
  _onError(e) {
1049
- if (he.priorWebsocketSuccess = !1, this.opts.tryAllTransports && this.transports.length > 1 && this.readyState === "opening")
1049
+ if (ge.priorWebsocketSuccess = !1, this.opts.tryAllTransports && this.transports.length > 1 && this.readyState === "opening")
1050
1050
  return this.transports.shift(), this._open();
1051
1051
  this.emitReserved("error", e), this._onClose("transport error", e);
1052
1052
  }
@@ -1057,16 +1057,16 @@ class he extends O {
1057
1057
  */
1058
1058
  _onClose(e, t) {
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(), dt && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
1061
- const s = Ve.indexOf(this._offlineEventListener);
1062
- s !== -1 && Ve.splice(s, 1);
1060
+ if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), xt && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
1061
+ const s = dt.indexOf(this._offlineEventListener);
1062
+ s !== -1 && dt.splice(s, 1);
1063
1063
  }
1064
1064
  this.readyState = "closed", this.id = null, this.emitReserved("close", e, t), this.writeBuffer = [], this._prevBufferLen = 0;
1065
1065
  }
1066
1066
  }
1067
1067
  }
1068
- he.protocol = ws;
1069
- class Mn extends he {
1068
+ ge.protocol = Ps;
1069
+ class Gn extends ge {
1070
1070
  constructor() {
1071
1071
  super(...arguments), this._upgrades = [];
1072
1072
  }
@@ -1083,28 +1083,28 @@ class Mn extends he {
1083
1083
  */
1084
1084
  _probe(e) {
1085
1085
  let t = this.createTransport(e), s = !1;
1086
- he.priorWebsocketSuccess = !1;
1086
+ ge.priorWebsocketSuccess = !1;
1087
1087
  const r = () => {
1088
- s || (t.send([{ type: "ping", data: "probe" }]), t.once("packet", (y) => {
1088
+ s || (t.send([{ type: "ping", data: "probe" }]), t.once("packet", (m) => {
1089
1089
  if (!s)
1090
- if (y.type === "pong" && y.data === "probe") {
1090
+ if (m.type === "pong" && m.data === "probe") {
1091
1091
  if (this.upgrading = !0, this.emitReserved("upgrading", t), !t)
1092
1092
  return;
1093
- he.priorWebsocketSuccess = t.name === "websocket", this.transport.pause(() => {
1094
- s || this.readyState !== "closed" && (h(), this.setTransport(t), t.send([{ type: "upgrade" }]), this.emitReserved("upgrade", t), t = null, this.upgrading = !1, this.flush());
1093
+ ge.priorWebsocketSuccess = t.name === "websocket", this.transport.pause(() => {
1094
+ s || this.readyState !== "closed" && (c(), this.setTransport(t), t.send([{ type: "upgrade" }]), this.emitReserved("upgrade", t), t = null, this.upgrading = !1, this.flush());
1095
1095
  });
1096
1096
  } else {
1097
- const w = new Error("probe error");
1098
- w.transport = t.name, this.emitReserved("upgradeError", w);
1097
+ const T = new Error("probe error");
1098
+ T.transport = t.name, this.emitReserved("upgradeError", T);
1099
1099
  }
1100
1100
  }));
1101
1101
  };
1102
1102
  function i() {
1103
- s || (s = !0, h(), t.close(), t = null);
1103
+ s || (s = !0, c(), t.close(), t = null);
1104
1104
  }
1105
- const o = (y) => {
1106
- const w = new Error("probe error: " + y);
1107
- w.transport = t.name, i(), this.emitReserved("upgradeError", w);
1105
+ const o = (m) => {
1106
+ const T = new Error("probe error: " + m);
1107
+ T.transport = t.name, i(), this.emitReserved("upgradeError", T);
1108
1108
  };
1109
1109
  function a() {
1110
1110
  o("transport closed");
@@ -1112,13 +1112,13 @@ class Mn extends he {
1112
1112
  function l() {
1113
1113
  o("socket closed");
1114
1114
  }
1115
- function u(y) {
1116
- t && y.name !== t.name && i();
1115
+ function d(m) {
1116
+ t && m.name !== t.name && i();
1117
1117
  }
1118
- const h = () => {
1119
- t.removeListener("open", r), t.removeListener("error", o), t.removeListener("close", a), this.off("close", l), this.off("upgrading", u);
1118
+ const c = () => {
1119
+ t.removeListener("open", r), t.removeListener("error", o), t.removeListener("close", a), this.off("close", l), this.off("upgrading", d);
1120
1120
  };
1121
- t.once("open", r), t.once("error", o), t.once("close", a), this.once("close", l), this.once("upgrading", u), this._upgrades.indexOf("webtransport") !== -1 && e !== "webtransport" ? this.setTimeoutFn(() => {
1121
+ t.once("open", r), t.once("error", o), t.once("close", a), this.once("close", l), this.once("upgrading", d), this._upgrades.indexOf("webtransport") !== -1 && e !== "webtransport" ? this.setTimeoutFn(() => {
1122
1122
  s || t.open();
1123
1123
  }, 200) : t.open();
1124
1124
  }
@@ -1138,67 +1138,67 @@ class Mn extends he {
1138
1138
  return t;
1139
1139
  }
1140
1140
  }
1141
- let Vn = class extends Mn {
1141
+ let Jn = class extends Gn {
1142
1142
  constructor(e, t = {}) {
1143
1143
  const s = typeof e == "object", r = s ? { ...e } : { ...t };
1144
- (!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || ["polling", "websocket", "webtransport"]).map((i) => Ln[i]).filter((i) => !!i)), super(s ? r : e, r);
1144
+ (!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || ["polling", "websocket", "webtransport"]).map((i) => jn[i]).filter((i) => !!i)), super(s ? r : e, r);
1145
1145
  }
1146
1146
  };
1147
- function Gn(n, e = "", t) {
1147
+ function Wn(n, e = "", t) {
1148
1148
  let s = n;
1149
- t = t || typeof location < "u" && location, n == null && (n = t.protocol + "//" + t.host), typeof n == "string" && (n.charAt(0) === "/" && (n.charAt(1) === "/" ? n = t.protocol + n : n = t.host + n), /^(https?|wss?):\/\//.test(n) || (typeof t < "u" ? n = t.protocol + "//" + n : n = "https://" + n), s = lt(n)), s.port || (/^(http|ws)$/.test(s.protocol) ? s.port = "80" : /^(http|ws)s$/.test(s.protocol) && (s.port = "443")), s.path = s.path || "/";
1149
+ t = t || typeof location < "u" && location, n == null && (n = t.protocol + "//" + t.host), typeof n == "string" && (n.charAt(0) === "/" && (n.charAt(1) === "/" ? n = t.protocol + n : n = t.host + n), /^(https?|wss?):\/\//.test(n) || (typeof t < "u" ? n = t.protocol + "//" + n : n = "https://" + n), s = $t(n)), s.port || (/^(http|ws)$/.test(s.protocol) ? s.port = "80" : /^(http|ws)s$/.test(s.protocol) && (s.port = "443")), s.path = s.path || "/";
1150
1150
  const i = s.host.indexOf(":") !== -1 ? "[" + s.host + "]" : s.host;
1151
1151
  return s.id = s.protocol + "://" + i + ":" + s.port + e, s.href = s.protocol + "://" + i + (t && t.port === s.port ? "" : ":" + s.port), s;
1152
1152
  }
1153
- const Hn = typeof ArrayBuffer == "function", Jn = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n.buffer instanceof ArrayBuffer, Is = Object.prototype.toString, Wn = typeof Blob == "function" || typeof Blob < "u" && Is.call(Blob) === "[object BlobConstructor]", Yn = typeof File == "function" || typeof File < "u" && Is.call(File) === "[object FileConstructor]";
1154
- function Bt(n) {
1155
- return Hn && (n instanceof ArrayBuffer || Jn(n)) || Wn && n instanceof Blob || Yn && n instanceof File;
1153
+ const Yn = typeof ArrayBuffer == "function", zn = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n.buffer instanceof ArrayBuffer, js = Object.prototype.toString, Kn = typeof Blob == "function" || typeof Blob < "u" && js.call(Blob) === "[object BlobConstructor]", Xn = typeof File == "function" || typeof File < "u" && js.call(File) === "[object FileConstructor]";
1154
+ function ss(n) {
1155
+ return Yn && (n instanceof ArrayBuffer || zn(n)) || Kn && n instanceof Blob || Xn && n instanceof File;
1156
1156
  }
1157
- function Ge(n, e) {
1157
+ function ut(n, e) {
1158
1158
  if (!n || typeof n != "object")
1159
1159
  return !1;
1160
1160
  if (Array.isArray(n)) {
1161
1161
  for (let t = 0, s = n.length; t < s; t++)
1162
- if (Ge(n[t]))
1162
+ if (ut(n[t]))
1163
1163
  return !0;
1164
1164
  return !1;
1165
1165
  }
1166
- if (Bt(n))
1166
+ if (ss(n))
1167
1167
  return !0;
1168
1168
  if (n.toJSON && typeof n.toJSON == "function" && arguments.length === 1)
1169
- return Ge(n.toJSON(), !0);
1169
+ return ut(n.toJSON(), !0);
1170
1170
  for (const t in n)
1171
- if (Object.prototype.hasOwnProperty.call(n, t) && Ge(n[t]))
1171
+ if (Object.prototype.hasOwnProperty.call(n, t) && ut(n[t]))
1172
1172
  return !0;
1173
1173
  return !1;
1174
1174
  }
1175
- function Kn(n) {
1175
+ function Qn(n) {
1176
1176
  const e = [], t = n.data, s = n;
1177
- return s.data = ut(t, e), s.attachments = e.length, { packet: s, buffers: e };
1177
+ return s.data = Nt(t, e), s.attachments = e.length, { packet: s, buffers: e };
1178
1178
  }
1179
- function ut(n, e) {
1179
+ function Nt(n, e) {
1180
1180
  if (!n)
1181
1181
  return n;
1182
- if (Bt(n)) {
1182
+ if (ss(n)) {
1183
1183
  const t = { _placeholder: !0, num: e.length };
1184
1184
  return e.push(n), t;
1185
1185
  } else if (Array.isArray(n)) {
1186
1186
  const t = new Array(n.length);
1187
1187
  for (let s = 0; s < n.length; s++)
1188
- t[s] = ut(n[s], e);
1188
+ t[s] = Nt(n[s], e);
1189
1189
  return t;
1190
1190
  } else if (typeof n == "object" && !(n instanceof Date)) {
1191
1191
  const t = {};
1192
1192
  for (const s in n)
1193
- Object.prototype.hasOwnProperty.call(n, s) && (t[s] = ut(n[s], e));
1193
+ Object.prototype.hasOwnProperty.call(n, s) && (t[s] = Nt(n[s], e));
1194
1194
  return t;
1195
1195
  }
1196
1196
  return n;
1197
1197
  }
1198
- function zn(n, e) {
1199
- return n.data = ft(n.data, e), delete n.attachments, n;
1198
+ function Zn(n, e) {
1199
+ return n.data = Pt(n.data, e), delete n.attachments, n;
1200
1200
  }
1201
- function ft(n, e) {
1201
+ function Pt(n, e) {
1202
1202
  if (!n)
1203
1203
  return n;
1204
1204
  if (n && n._placeholder === !0) {
@@ -1207,13 +1207,13 @@ function ft(n, e) {
1207
1207
  throw new Error("illegal attachments");
1208
1208
  } else if (Array.isArray(n))
1209
1209
  for (let t = 0; t < n.length; t++)
1210
- n[t] = ft(n[t], e);
1210
+ n[t] = Pt(n[t], e);
1211
1211
  else if (typeof n == "object")
1212
1212
  for (const t in n)
1213
- Object.prototype.hasOwnProperty.call(n, t) && (n[t] = ft(n[t], e));
1213
+ Object.prototype.hasOwnProperty.call(n, t) && (n[t] = Pt(n[t], e));
1214
1214
  return n;
1215
1215
  }
1216
- const Xn = [
1216
+ const er = [
1217
1217
  "connect",
1218
1218
  // used on the client side
1219
1219
  "connect_error",
@@ -1227,11 +1227,11 @@ const Xn = [
1227
1227
  "removeListener"
1228
1228
  // used by the Node.js EventEmitter
1229
1229
  ];
1230
- var b;
1230
+ var v;
1231
1231
  (function(n) {
1232
1232
  n[n.CONNECT = 0] = "CONNECT", n[n.DISCONNECT = 1] = "DISCONNECT", n[n.EVENT = 2] = "EVENT", n[n.ACK = 3] = "ACK", n[n.CONNECT_ERROR = 4] = "CONNECT_ERROR", n[n.BINARY_EVENT = 5] = "BINARY_EVENT", n[n.BINARY_ACK = 6] = "BINARY_ACK";
1233
- })(b || (b = {}));
1234
- class Qn {
1233
+ })(v || (v = {}));
1234
+ class tr {
1235
1235
  /**
1236
1236
  * Encoder constructor
1237
1237
  *
@@ -1247,8 +1247,8 @@ class Qn {
1247
1247
  * @param {Object} obj - packet object
1248
1248
  */
1249
1249
  encode(e) {
1250
- return (e.type === b.EVENT || e.type === b.ACK) && Ge(e) ? this.encodeAsBinary({
1251
- type: e.type === b.EVENT ? b.BINARY_EVENT : b.BINARY_ACK,
1250
+ return (e.type === v.EVENT || e.type === v.ACK) && ut(e) ? this.encodeAsBinary({
1251
+ type: e.type === v.EVENT ? v.BINARY_EVENT : v.BINARY_ACK,
1252
1252
  nsp: e.nsp,
1253
1253
  data: e.data,
1254
1254
  id: e.id
@@ -1259,7 +1259,7 @@ class Qn {
1259
1259
  */
1260
1260
  encodeAsString(e) {
1261
1261
  let t = "" + e.type;
1262
- return (e.type === b.BINARY_EVENT || e.type === b.BINARY_ACK) && (t += e.attachments + "-"), e.nsp && e.nsp !== "/" && (t += e.nsp + ","), e.id != null && (t += e.id), e.data != null && (t += JSON.stringify(e.data, this.replacer)), t;
1262
+ return (e.type === v.BINARY_EVENT || e.type === v.BINARY_ACK) && (t += e.attachments + "-"), e.nsp && e.nsp !== "/" && (t += e.nsp + ","), e.id != null && (t += e.id), e.data != null && (t += JSON.stringify(e.data, this.replacer)), t;
1263
1263
  }
1264
1264
  /**
1265
1265
  * Encode packet as 'buffer sequence' by removing blobs, and
@@ -1267,11 +1267,11 @@ class Qn {
1267
1267
  * a list of buffers.
1268
1268
  */
1269
1269
  encodeAsBinary(e) {
1270
- const t = Kn(e), s = this.encodeAsString(t.packet), r = t.buffers;
1270
+ const t = Qn(e), s = this.encodeAsString(t.packet), r = t.buffers;
1271
1271
  return r.unshift(s), r;
1272
1272
  }
1273
1273
  }
1274
- class Ft extends O {
1274
+ class ns extends C {
1275
1275
  /**
1276
1276
  * Decoder constructor
1277
1277
  */
@@ -1292,9 +1292,9 @@ class Ft extends O {
1292
1292
  if (this.reconstructor)
1293
1293
  throw new Error("got plaintext data when reconstructing a packet");
1294
1294
  t = this.decodeString(e);
1295
- const s = t.type === b.BINARY_EVENT;
1296
- s || t.type === b.BINARY_ACK ? (t.type = s ? b.EVENT : b.ACK, this.reconstructor = new Zn(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t);
1297
- } else if (Bt(e) || e.base64)
1295
+ const s = t.type === v.BINARY_EVENT;
1296
+ s || t.type === v.BINARY_ACK ? (t.type = s ? v.EVENT : v.ACK, this.reconstructor = new sr(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t);
1297
+ } else if (ss(e) || e.base64)
1298
1298
  if (this.reconstructor)
1299
1299
  t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t));
1300
1300
  else
@@ -1313,9 +1313,9 @@ class Ft extends O {
1313
1313
  const s = {
1314
1314
  type: Number(e.charAt(0))
1315
1315
  };
1316
- if (b[s.type] === void 0)
1316
+ if (v[s.type] === void 0)
1317
1317
  throw new Error("unknown packet type " + s.type);
1318
- if (s.type === b.BINARY_EVENT || s.type === b.BINARY_ACK) {
1318
+ if (s.type === v.BINARY_EVENT || s.type === v.BINARY_ACK) {
1319
1319
  const i = t + 1;
1320
1320
  for (; e.charAt(++t) !== "-" && t != e.length; )
1321
1321
  ;
@@ -1323,7 +1323,7 @@ class Ft extends O {
1323
1323
  if (o != Number(o) || e.charAt(t) !== "-")
1324
1324
  throw new Error("Illegal attachments");
1325
1325
  const a = Number(o);
1326
- if (!er(a) || a < 0)
1326
+ if (!nr(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 Ft extends O {
1352
1352
  }
1353
1353
  if (e.charAt(++t)) {
1354
1354
  const i = this.tryParse(e.substr(t));
1355
- if (Ft.isPayloadValid(s.type, i))
1355
+ if (ns.isPayloadValid(s.type, i))
1356
1356
  s.data = i;
1357
1357
  else
1358
1358
  throw new Error("invalid payload");
@@ -1368,17 +1368,17 @@ class Ft extends O {
1368
1368
  }
1369
1369
  static isPayloadValid(e, t) {
1370
1370
  switch (e) {
1371
- case b.CONNECT:
1372
- return Kt(t);
1373
- case b.DISCONNECT:
1371
+ case v.CONNECT:
1372
+ return us(t);
1373
+ case v.DISCONNECT:
1374
1374
  return t === void 0;
1375
- case b.CONNECT_ERROR:
1376
- return typeof t == "string" || Kt(t);
1377
- case b.EVENT:
1378
- case b.BINARY_EVENT:
1379
- return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && Xn.indexOf(t[0]) === -1);
1380
- case b.ACK:
1381
- case b.BINARY_ACK:
1375
+ case v.CONNECT_ERROR:
1376
+ return typeof t == "string" || us(t);
1377
+ case v.EVENT:
1378
+ case v.BINARY_EVENT:
1379
+ return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && er.indexOf(t[0]) === -1);
1380
+ case v.ACK:
1381
+ case v.BINARY_ACK:
1382
1382
  return Array.isArray(t);
1383
1383
  }
1384
1384
  }
@@ -1389,7 +1389,7 @@ class Ft extends O {
1389
1389
  this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
1390
1390
  }
1391
1391
  }
1392
- class Zn {
1392
+ class sr {
1393
1393
  constructor(e) {
1394
1394
  this.packet = e, this.buffers = [], this.reconPack = e;
1395
1395
  }
@@ -1403,7 +1403,7 @@ class Zn {
1403
1403
  */
1404
1404
  takeBinaryData(e) {
1405
1405
  if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
1406
- const t = zn(this.reconPack, this.buffers);
1406
+ const t = Zn(this.reconPack, this.buffers);
1407
1407
  return this.finishedReconstruction(), t;
1408
1408
  }
1409
1409
  return null;
@@ -1415,26 +1415,26 @@ class Zn {
1415
1415
  this.reconPack = null, this.buffers = [];
1416
1416
  }
1417
1417
  }
1418
- const er = Number.isInteger || function(n) {
1418
+ const nr = Number.isInteger || function(n) {
1419
1419
  return typeof n == "number" && isFinite(n) && Math.floor(n) === n;
1420
1420
  };
1421
- function Kt(n) {
1421
+ function us(n) {
1422
1422
  return Object.prototype.toString.call(n) === "[object Object]";
1423
1423
  }
1424
- const tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1424
+ const rr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1425
1425
  __proto__: null,
1426
- Decoder: Ft,
1427
- Encoder: Qn,
1426
+ Decoder: ns,
1427
+ Encoder: tr,
1428
1428
  get PacketType() {
1429
- return b;
1429
+ return v;
1430
1430
  }
1431
1431
  }, Symbol.toStringTag, { value: "Module" }));
1432
- function V(n, e, t) {
1432
+ function Y(n, e, t) {
1433
1433
  return n.on(e, t), function() {
1434
1434
  n.off(e, t);
1435
1435
  };
1436
1436
  }
1437
- const sr = Object.freeze({
1437
+ const ir = Object.freeze({
1438
1438
  connect: 1,
1439
1439
  connect_error: 1,
1440
1440
  disconnect: 1,
@@ -1443,7 +1443,7 @@ const sr = Object.freeze({
1443
1443
  newListener: 1,
1444
1444
  removeListener: 1
1445
1445
  });
1446
- class Ss extends O {
1446
+ class Us extends C {
1447
1447
  /**
1448
1448
  * `Socket` constructor.
1449
1449
  */
@@ -1477,10 +1477,10 @@ class Ss extends O {
1477
1477
  return;
1478
1478
  const e = this.io;
1479
1479
  this.subs = [
1480
- V(e, "open", this.onopen.bind(this)),
1481
- V(e, "packet", this.onpacket.bind(this)),
1482
- V(e, "error", this.onerror.bind(this)),
1483
- V(e, "close", this.onclose.bind(this))
1480
+ Y(e, "open", this.onopen.bind(this)),
1481
+ Y(e, "packet", this.onpacket.bind(this)),
1482
+ Y(e, "error", this.onerror.bind(this)),
1483
+ Y(e, "close", this.onclose.bind(this))
1484
1484
  ];
1485
1485
  }
1486
1486
  /**
@@ -1559,17 +1559,17 @@ class Ss extends O {
1559
1559
  */
1560
1560
  emit(e, ...t) {
1561
1561
  var s, r, i;
1562
- if (sr.hasOwnProperty(e))
1562
+ if (ir.hasOwnProperty(e))
1563
1563
  throw new Error('"' + e.toString() + '" is a reserved event name');
1564
1564
  if (t.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
1565
1565
  return this._addToQueue(t), this;
1566
1566
  const o = {
1567
- type: b.EVENT,
1567
+ type: v.EVENT,
1568
1568
  data: t
1569
1569
  };
1570
1570
  if (o.options = {}, o.options.compress = this.flags.compress !== !1, typeof t[t.length - 1] == "function") {
1571
- const h = this.ids++, y = t.pop();
1572
- this._registerAckCallback(h, y), o.id = h;
1571
+ const c = this.ids++, m = t.pop();
1572
+ this._registerAckCallback(c, m), o.id = c;
1573
1573
  }
1574
1574
  const a = (r = (s = this.io.engine) === null || s === void 0 ? void 0 : s.transport) === null || r === void 0 ? void 0 : r.writable, l = this.connected && !(!((i = this.io.engine) === null || i === void 0) && i._hasPingExpired());
1575
1575
  return this.flags.volatile && !a || (l ? (this.notifyOutgoingListeners(o), this.packet(o)) : this.sendBuffer.push(o)), this.flags = {}, this;
@@ -1672,7 +1672,7 @@ class Ss extends O {
1672
1672
  */
1673
1673
  _sendConnectPacket(e) {
1674
1674
  this.packet({
1675
- type: b.CONNECT,
1675
+ type: v.CONNECT,
1676
1676
  data: this._pid ? Object.assign({ pid: this._pid, offset: this._lastOffset }, e) : e
1677
1677
  });
1678
1678
  }
@@ -1718,21 +1718,21 @@ class Ss extends O {
1718
1718
  onpacket(e) {
1719
1719
  if (e.nsp === this.nsp)
1720
1720
  switch (e.type) {
1721
- case b.CONNECT:
1721
+ case v.CONNECT:
1722
1722
  e.data && e.data.sid ? this.onconnect(e.data.sid, e.data.pid) : this.emitReserved("connect_error", new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));
1723
1723
  break;
1724
- case b.EVENT:
1725
- case b.BINARY_EVENT:
1724
+ case v.EVENT:
1725
+ case v.BINARY_EVENT:
1726
1726
  this.onevent(e);
1727
1727
  break;
1728
- case b.ACK:
1729
- case b.BINARY_ACK:
1728
+ case v.ACK:
1729
+ case v.BINARY_ACK:
1730
1730
  this.onack(e);
1731
1731
  break;
1732
- case b.DISCONNECT:
1732
+ case v.DISCONNECT:
1733
1733
  this.ondisconnect();
1734
1734
  break;
1735
- case b.CONNECT_ERROR:
1735
+ case v.CONNECT_ERROR:
1736
1736
  this.destroy();
1737
1737
  const s = new Error(e.data.message);
1738
1738
  s.data = e.data.data, this.emitReserved("connect_error", s);
@@ -1767,7 +1767,7 @@ class Ss extends O {
1767
1767
  let s = !1;
1768
1768
  return function(...r) {
1769
1769
  s || (s = !0, t.packet({
1770
- type: b.ACK,
1770
+ type: v.ACK,
1771
1771
  id: e,
1772
1772
  data: r
1773
1773
  }));
@@ -1836,7 +1836,7 @@ class Ss extends O {
1836
1836
  * @return self
1837
1837
  */
1838
1838
  disconnect() {
1839
- return this.connected && this.packet({ type: b.DISCONNECT }), this.destroy(), this.connected && this.onclose("io client disconnect"), this;
1839
+ return this.connected && this.packet({ type: v.DISCONNECT }), this.destroy(), this.connected && this.onclose("io client disconnect"), this;
1840
1840
  }
1841
1841
  /**
1842
1842
  * Alias for {@link disconnect()}.
@@ -2035,10 +2035,10 @@ class Ss extends O {
2035
2035
  }
2036
2036
  }
2037
2037
  }
2038
- function ke(n) {
2038
+ function Fe(n) {
2039
2039
  n = n || {}, this.ms = n.min || 100, this.max = n.max || 1e4, this.factor = n.factor || 2, this.jitter = n.jitter > 0 && n.jitter <= 1 ? n.jitter : 0, this.attempts = 0;
2040
2040
  }
2041
- ke.prototype.duration = function() {
2041
+ Fe.prototype.duration = function() {
2042
2042
  var n = this.ms * Math.pow(this.factor, this.attempts++);
2043
2043
  if (this.jitter) {
2044
2044
  var e = Math.random(), t = Math.floor(e * this.jitter * n);
@@ -2046,27 +2046,27 @@ ke.prototype.duration = function() {
2046
2046
  }
2047
2047
  return Math.min(n, this.max) | 0;
2048
2048
  };
2049
- ke.prototype.reset = function() {
2049
+ Fe.prototype.reset = function() {
2050
2050
  this.attempts = 0;
2051
2051
  };
2052
- ke.prototype.setMin = function(n) {
2052
+ Fe.prototype.setMin = function(n) {
2053
2053
  this.ms = n;
2054
2054
  };
2055
- ke.prototype.setMax = function(n) {
2055
+ Fe.prototype.setMax = function(n) {
2056
2056
  this.max = n;
2057
2057
  };
2058
- ke.prototype.setJitter = function(n) {
2058
+ Fe.prototype.setJitter = function(n) {
2059
2059
  this.jitter = n;
2060
2060
  };
2061
- class pt extends O {
2061
+ class Bt extends C {
2062
2062
  constructor(e, t) {
2063
2063
  var s;
2064
- super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t, Ze(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || 1 / 0), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor((s = t.randomizationFactor) !== null && s !== void 0 ? s : 0.5), this.backoff = new ke({
2064
+ super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t, Et(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || 1 / 0), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor((s = t.randomizationFactor) !== null && s !== void 0 ? s : 0.5), this.backoff = new Fe({
2065
2065
  min: this.reconnectionDelay(),
2066
2066
  max: this.reconnectionDelayMax(),
2067
2067
  jitter: this.randomizationFactor()
2068
2068
  }), this.timeout(t.timeout == null ? 2e4 : t.timeout), this._readyState = "closed", this.uri = e;
2069
- const r = t.parser || tr;
2069
+ const r = t.parser || rr;
2070
2070
  this.encoder = new r.Encoder(), this.decoder = new r.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
2071
2071
  }
2072
2072
  reconnection(e) {
@@ -2109,14 +2109,14 @@ class pt extends O {
2109
2109
  open(e) {
2110
2110
  if (~this._readyState.indexOf("open"))
2111
2111
  return this;
2112
- this.engine = new Vn(this.uri, this.opts);
2112
+ this.engine = new Jn(this.uri, this.opts);
2113
2113
  const t = this.engine, s = this;
2114
2114
  this._readyState = "opening", this.skipReconnect = !1;
2115
- const r = V(t, "open", function() {
2115
+ const r = Y(t, "open", function() {
2116
2116
  s.onopen(), e && e();
2117
2117
  }), i = (a) => {
2118
2118
  this.cleanup(), this._readyState = "closed", this.emitReserved("error", a), e ? e(a) : this.maybeReconnectOnOpen();
2119
- }, o = V(t, "error", i);
2119
+ }, o = Y(t, "error", i);
2120
2120
  if (this._timeout !== !1) {
2121
2121
  const a = this._timeout, l = this.setTimeoutFn(() => {
2122
2122
  r(), i(new Error("timeout")), t.close();
@@ -2145,12 +2145,12 @@ class pt extends O {
2145
2145
  this.cleanup(), this._readyState = "open", this.emitReserved("open");
2146
2146
  const e = this.engine;
2147
2147
  this.subs.push(
2148
- V(e, "ping", this.onping.bind(this)),
2149
- V(e, "data", this.ondata.bind(this)),
2150
- V(e, "error", this.onerror.bind(this)),
2151
- V(e, "close", this.onclose.bind(this)),
2148
+ Y(e, "ping", this.onping.bind(this)),
2149
+ Y(e, "data", this.ondata.bind(this)),
2150
+ Y(e, "error", this.onerror.bind(this)),
2151
+ Y(e, "close", this.onclose.bind(this)),
2152
2152
  // @ts-ignore
2153
- V(this.decoder, "decoded", this.ondecoded.bind(this))
2153
+ Y(this.decoder, "decoded", this.ondecoded.bind(this))
2154
2154
  );
2155
2155
  }
2156
2156
  /**
@@ -2179,7 +2179,7 @@ class pt extends O {
2179
2179
  * @private
2180
2180
  */
2181
2181
  ondecoded(e) {
2182
- Qe(() => {
2182
+ vt(() => {
2183
2183
  this.emitReserved("packet", e);
2184
2184
  }, this.setTimeoutFn);
2185
2185
  }
@@ -2199,7 +2199,7 @@ class pt extends O {
2199
2199
  */
2200
2200
  socket(e, t) {
2201
2201
  let s = this.nsps[e];
2202
- return s ? this._autoConnect && !s.active && s.connect() : (s = new Ss(this, e, t), this.nsps[e] = s), s;
2202
+ return s ? this._autoConnect && !s.active && s.connect() : (s = new Us(this, e, t), this.nsps[e] = s), s;
2203
2203
  }
2204
2204
  /**
2205
2205
  * Called upon a socket close.
@@ -2296,20 +2296,20 @@ class pt extends O {
2296
2296
  this._reconnecting = !1, this.backoff.reset(), this.emitReserved("reconnect", e);
2297
2297
  }
2298
2298
  }
2299
- const Oe = {};
2300
- function xe(n, e) {
2299
+ const Ge = {};
2300
+ function Ke(n, e) {
2301
2301
  typeof n == "object" && (e = n, n = void 0), e = e || {};
2302
- const t = Gn(n, e.path || "/socket.io"), s = t.source, r = t.id, i = t.path, o = Oe[r] && i in Oe[r].nsps, a = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
2302
+ const t = Wn(n, e.path || "/socket.io"), s = t.source, r = t.id, i = t.path, o = Ge[r] && i in Ge[r].nsps, a = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
2303
2303
  let l;
2304
- return a ? l = new pt(s, e) : (Oe[r] || (Oe[r] = new pt(s, e)), l = Oe[r]), t.query && !e.query && (e.query = t.queryKey), l.socket(t.path, e);
2304
+ return a ? l = new Bt(s, e) : (Ge[r] || (Ge[r] = new Bt(s, e)), l = Ge[r]), t.query && !e.query && (e.query = t.queryKey), l.socket(t.path, e);
2305
2305
  }
2306
- Object.assign(xe, {
2307
- Manager: pt,
2308
- Socket: Ss,
2309
- io: xe,
2310
- connect: xe
2306
+ Object.assign(Ke, {
2307
+ Manager: Bt,
2308
+ Socket: Us,
2309
+ io: Ke,
2310
+ connect: Ke
2311
2311
  });
2312
- const Xe = "thatopen/document@1", zt = "document.json", nr = [
2312
+ const bt = "thatopen/document@1", fs = "document.json", or = [
2313
2313
  "pdf",
2314
2314
  "txt",
2315
2315
  "md",
@@ -2317,14 +2317,14 @@ const Xe = "thatopen/document@1", zt = "document.json", nr = [
2317
2317
  "csv",
2318
2318
  "tsv",
2319
2319
  "frag"
2320
- ], Xt = () => `v-${Date.now()}`;
2321
- function De(n) {
2320
+ ], ps = () => `v-${Date.now()}`;
2321
+ function at(n) {
2322
2322
  return String(n._id ?? n.id ?? "");
2323
2323
  }
2324
- var fe, Os, mt;
2325
- class ks {
2324
+ var ke, Vs, Lt;
2325
+ class Ms {
2326
2326
  constructor(e, t) {
2327
- _(this, fe);
2327
+ S(this, ke);
2328
2328
  this.client = e, this.projectId = t;
2329
2329
  }
2330
2330
  /**
@@ -2339,7 +2339,7 @@ class ks {
2339
2339
  });
2340
2340
  return (await Promise.all(
2341
2341
  e.map(async (s) => {
2342
- const r = De(s), i = await this.descriptor(r);
2342
+ const r = at(s), i = await this.descriptor(r);
2343
2343
  return i ? { folderId: r, descriptor: i } : null;
2344
2344
  })
2345
2345
  )).filter((s) => s !== null);
@@ -2357,37 +2357,37 @@ class ks {
2357
2357
  * document is born ready to visualize and the link concept retires.
2358
2358
  */
2359
2359
  async fromFile(e, t) {
2360
- const s = await this.client.getFile(e), r = String(s.name ?? ""), i = Qt(r, s.fileExtension), o = (t == null ? void 0 : t.name) ?? r.replace(/\.[^.]+$/, "") ?? r, a = await this.client.createFolder(
2360
+ const s = await this.client.getFile(e), r = String(s.name ?? ""), i = ms(r, s.fileExtension), o = (t == null ? void 0 : t.name) ?? r.replace(/\.[^.]+$/, "") ?? r, a = await this.client.createFolder(
2361
2361
  o,
2362
2362
  s.folderId ? String(s.folderId) : void 0,
2363
2363
  this.projectId
2364
- ), l = De(a);
2364
+ ), l = at(a);
2365
2365
  await this.client.updateFile(e, { parentFolderId: l });
2366
- const u = [], h = await c(this, fe, Os).call(this, s);
2367
- if (h)
2366
+ const d = [], c = await h(this, ke, Vs).call(this, s);
2367
+ if (c)
2368
2368
  try {
2369
- const I = await this.client.getFile(h);
2370
- await this.client.updateFile(h, { parentFolderId: l }), u.push({
2371
- fileId: h,
2372
- format: Qt(String(I.name ?? ""), I.fileExtension)
2369
+ const A = await this.client.getFile(c);
2370
+ await this.client.updateFile(c, { parentFolderId: l }), d.push({
2371
+ fileId: c,
2372
+ format: ms(String(A.name ?? ""), A.fileExtension)
2373
2373
  });
2374
2374
  } catch {
2375
2375
  }
2376
- ((t == null ? void 0 : t.selfView) ?? nr.includes(i)) && u.push({ fileId: e, format: i });
2377
- const w = {
2378
- schema: Xe,
2376
+ ((t == null ? void 0 : t.selfView) ?? or.includes(i)) && d.push({ fileId: e, format: i });
2377
+ const T = {
2378
+ schema: bt,
2379
2379
  name: o,
2380
2380
  native: { fileId: e, format: i },
2381
- views: u
2381
+ views: d
2382
2382
  };
2383
- return await this.setDescriptor(l, w), { folderId: l, descriptor: w };
2383
+ return await this.setDescriptor(l, T), { folderId: l, descriptor: T };
2384
2384
  }
2385
2385
  /**
2386
2386
  * The document's descriptor, read and validated, or null when the folder
2387
2387
  * has none yet (an old folder, or a plain folder that is not a document).
2388
2388
  */
2389
2389
  async descriptor(e) {
2390
- const t = await c(this, fe, mt).call(this, e);
2390
+ const t = await h(this, ke, Lt).call(this, e);
2391
2391
  if (!t) return null;
2392
2392
  const r = await (await this.client.downloadFile(t.id)).text();
2393
2393
  if (!r.trim()) return null;
@@ -2397,7 +2397,7 @@ class ks {
2397
2397
  } catch {
2398
2398
  return null;
2399
2399
  }
2400
- return rr(i);
2400
+ return ar(i);
2401
2401
  }
2402
2402
  /**
2403
2403
  * The first view whose format appears in `formats` — searched in the ORDER
@@ -2435,147 +2435,147 @@ class ks {
2435
2435
  async setDescriptor(e, t) {
2436
2436
  const s = {
2437
2437
  ...t,
2438
- schema: Xe,
2438
+ schema: bt,
2439
2439
  views: t.views ?? []
2440
2440
  }, r = new Blob([JSON.stringify(s)], {
2441
2441
  type: "application/json"
2442
- }), i = await c(this, fe, mt).call(this, e);
2442
+ }), i = await h(this, ke, Lt).call(this, e);
2443
2443
  if (i) {
2444
2444
  await this.client.updateFile(i.id, {
2445
2445
  file: r,
2446
- versionTag: Xt()
2446
+ versionTag: ps()
2447
2447
  });
2448
2448
  return;
2449
2449
  }
2450
2450
  await this.client.createFile({
2451
2451
  file: r,
2452
- name: zt,
2453
- versionTag: Xt(),
2452
+ name: fs,
2453
+ versionTag: ps(),
2454
2454
  parentFolderId: e,
2455
2455
  projectId: this.projectId
2456
2456
  });
2457
2457
  }
2458
2458
  }
2459
- fe = new WeakSet(), Os = async function(e) {
2459
+ ke = new WeakSet(), Vs = async function(e) {
2460
2460
  const t = [...e.versions ?? []].sort(
2461
2461
  (s, r) => String(r.createdAt ?? "").localeCompare(String(s.createdAt ?? ""))
2462
2462
  );
2463
2463
  for (const s of t)
2464
2464
  try {
2465
2465
  const r = await this.client.getFileVersionMetadata(
2466
- De(e),
2466
+ at(e),
2467
2467
  s.tag
2468
2468
  ), i = r == null ? void 0 : r.derivedFileId;
2469
2469
  if (typeof i == "string" && i) return i;
2470
2470
  } catch {
2471
2471
  }
2472
- }, mt = async function(e) {
2472
+ }, Lt = async function(e) {
2473
2473
  const s = (await this.client.listFiles({ folderId: e })).find(
2474
- (r) => String(r.name ?? "") === zt
2474
+ (r) => String(r.name ?? "") === fs
2475
2475
  );
2476
- return s ? { id: De(s) } : void 0;
2476
+ return s ? { id: at(s) } : void 0;
2477
2477
  };
2478
- function Qt(n, e) {
2478
+ function ms(n, e) {
2479
2479
  const t = (e ?? "").replace(/^\./, "").toLowerCase();
2480
2480
  if (t) return t;
2481
2481
  const s = n.lastIndexOf(".");
2482
2482
  return s > 0 ? n.slice(s + 1).toLowerCase() : "";
2483
2483
  }
2484
- function rr(n) {
2484
+ function ar(n) {
2485
2485
  if (!n || typeof n != "object") return null;
2486
2486
  const e = n;
2487
- if (e.schema !== Xe || typeof e.name != "string") return null;
2487
+ if (e.schema !== bt || typeof e.name != "string") return null;
2488
2488
  const t = Array.isArray(e.views) ? e.views.filter(
2489
2489
  (i) => !!i && typeof i == "object" && typeof i.fileId == "string" && typeof i.format == "string"
2490
2490
  ) : [], s = e.native, r = !!s && typeof s == "object" && typeof s.fileId == "string" && typeof s.format == "string";
2491
2491
  return {
2492
- schema: Xe,
2492
+ schema: bt,
2493
2493
  name: e.name,
2494
2494
  ...r ? { native: { fileId: s.fileId, format: s.format } } : {},
2495
2495
  views: t
2496
2496
  };
2497
2497
  }
2498
- class Zt extends Error {
2498
+ class ys extends Error {
2499
2499
  constructor(e, t) {
2500
2500
  super(
2501
2501
  `The document history advanced while this version was being prepared: expected head ${e}, found ${t ?? "none"}. Read the timeline again and rebuild on the new head.`
2502
2502
  ), this.expectedGuid = e, this.actualGuid = t, this.name = "StaleHistoryError";
2503
2503
  }
2504
2504
  }
2505
- const es = "bimterop", yt = "revitflow_history.json", ye = "revitflow_ops.json", ts = "revitflow/ops@1", As = "revitflow_model.frag", Rs = "revitflow_", ir = "bimterop-locks-anchor", Ue = () => `v-${Date.now()}`;
2506
- function Cs(n, e) {
2505
+ const gs = "bimterop", Ft = "revitflow_history.json", Re = "revitflow_ops.json", ws = "revitflow/ops@1", Hs = "revitflow_model.frag", Gs = "revitflow_", cr = "bimterop-locks-anchor", ct = () => `v-${Date.now()}`;
2506
+ function Js(n, e) {
2507
2507
  return n.filter((t) => String(t.parentId ?? "") === e);
2508
2508
  }
2509
- function H(n) {
2509
+ function te(n) {
2510
2510
  return String(n._id ?? n.id ?? "");
2511
2511
  }
2512
- var M, Ne, gt;
2513
- class or {
2512
+ var W, Xe, Dt;
2513
+ class hr {
2514
2514
  constructor(e, t) {
2515
- _(this, Ne);
2516
- _(this, M);
2515
+ S(this, Xe);
2516
+ S(this, W);
2517
2517
  this.client = e, this.projectId = t;
2518
2518
  }
2519
2519
  /** The project's connected documents. */
2520
2520
  async docs() {
2521
- const e = await c(this, Ne, gt).call(this);
2521
+ const e = await h(this, Xe, Dt).call(this);
2522
2522
  if (!e) return [];
2523
2523
  const t = await this.client.listFolders({
2524
2524
  parentFolderId: e,
2525
2525
  projectId: this.projectId
2526
2526
  }), s = [];
2527
- for (const r of Cs(t, e)) {
2527
+ for (const r of Js(t, e)) {
2528
2528
  const i = String(r.name ?? ""), o = i.indexOf("-");
2529
2529
  if (o <= 0) continue;
2530
2530
  const l = (await this.client.listFiles({
2531
- folderId: H(r)
2531
+ folderId: te(r)
2532
2532
  })).map(
2533
- (y) => String(y.name ?? "")
2534
- ), u = l.find((y) => y === As) ?? l.find(
2535
- (y) => y.endsWith(".frag") && !y.startsWith(Rs)
2536
- ), h = l.includes(yt) || l.includes(ye) || !!u;
2533
+ (m) => String(m.name ?? "")
2534
+ ), d = l.find((m) => m === Hs) ?? l.find(
2535
+ (m) => m.endsWith(".frag") && !m.startsWith(Gs)
2536
+ ), c = l.includes(Ft) || l.includes(Re) || !!d;
2537
2537
  s.push({
2538
2538
  source: i.slice(0, o),
2539
2539
  docId: i.slice(o + 1),
2540
- folderId: H(r),
2541
- modelName: u,
2542
- ...h ? {} : { empty: !0 }
2540
+ folderId: te(r),
2541
+ modelName: d,
2542
+ ...c ? {} : { empty: !0 }
2543
2543
  });
2544
2544
  }
2545
2545
  return s;
2546
2546
  }
2547
2547
  /** One document's history. `source` and `docId` as {@link docs} lists them. */
2548
2548
  doc(e, t) {
2549
- return new ar(this.client, this, e, t);
2549
+ return new lr(this.client, this, e, t);
2550
2550
  }
2551
2551
  /** @internal The `bimterop` folder id, resolved once. */
2552
2552
  async rootFolderId(e = !1) {
2553
- if (f(this, M)) return f(this, M);
2554
- const t = await c(this, Ne, gt).call(this);
2553
+ if (u(this, W)) return u(this, W);
2554
+ const t = await h(this, Xe, Dt).call(this);
2555
2555
  if (t) return t;
2556
2556
  if (!e) return;
2557
2557
  const s = await this.client.createFolder(
2558
- es,
2558
+ gs,
2559
2559
  void 0,
2560
2560
  this.projectId
2561
2561
  );
2562
- return k(this, M, H(s)), f(this, M);
2562
+ return R(this, W, te(s)), u(this, W);
2563
2563
  }
2564
2564
  }
2565
- M = new WeakMap(), Ne = new WeakSet(), gt = async function() {
2566
- if (f(this, M)) return f(this, M);
2565
+ W = new WeakMap(), Xe = new WeakSet(), Dt = async function() {
2566
+ if (u(this, W)) return u(this, W);
2567
2567
  const t = (await this.client.listFolders({
2568
2568
  projectId: this.projectId
2569
2569
  })).find(
2570
- (s) => String(s.name ?? "") === es && !s.parentId
2570
+ (s) => String(s.name ?? "") === gs && !s.parentId
2571
2571
  );
2572
- return t && k(this, M, H(t)), f(this, M);
2572
+ return t && R(this, W, te(t)), u(this, W);
2573
2573
  };
2574
- var X, p, ge, we, z, wt, Re, be, bt, He, Ce, Je, vt, $s;
2575
- class ar {
2574
+ var oe, p, ie, Ce, ee, qt, We, de, jt, ft, Ye, pt, Ut, Ws;
2575
+ class lr {
2576
2576
  constructor(e, t, s, r) {
2577
- _(this, p);
2578
- _(this, X);
2577
+ S(this, p);
2578
+ S(this, oe);
2579
2579
  this.client = e, this.project = t, this.source = s, this.docId = r;
2580
2580
  }
2581
2581
  // ─── Reading ───────────────────────────────────────────────────────────────
@@ -2585,8 +2585,8 @@ class ar {
2585
2585
  * Each version gets its `ordinal` filled in.
2586
2586
  */
2587
2587
  async timeline() {
2588
- const e = await c(this, p, He).call(this);
2589
- return xs((e == null ? void 0 : e.commits) ?? []);
2588
+ const e = await h(this, p, ft).call(this);
2589
+ return Ys((e == null ? void 0 : e.commits) ?? []);
2590
2590
  }
2591
2591
  /** The head of the timeline, or null before the first sync. */
2592
2592
  async latest() {
@@ -2604,18 +2604,80 @@ class ar {
2604
2604
  );
2605
2605
  return await (await this.client.downloadHiddenFile(e.deltaId)).blob();
2606
2606
  }
2607
- /** The visible model .frag as last fully exported. */
2607
+ /**
2608
+ * The visible model .frag AS LAST FULLY EXPORTED — the first commit, or the
2609
+ * last explicit publish. Ordinary syncs only add hidden deltas, so this is
2610
+ * NOT necessarily the head: anything computed on it (a clash run) is as of
2611
+ * the last `full: true` version. For the model at a specific version, read
2612
+ * {@link modelParts} and compose.
2613
+ */
2608
2614
  async model() {
2609
- const e = await c(this, p, be).call(this);
2615
+ const e = await h(this, p, de).call(this);
2610
2616
  if (!e)
2611
2617
  throw new Error(
2612
2618
  `Document ${this.source}-${this.docId} has no model file yet.`
2613
2619
  );
2614
2620
  return await (await this.client.downloadFile(e.id)).blob();
2615
2621
  }
2622
+ /**
2623
+ * The ordered recipe for the model AT a version: the baseline full export
2624
+ * at-or-before it, then one step per later version up to it — each step's
2625
+ * delta .frag (absent on geometry-less versions) and the element uniqueIds
2626
+ * it removed. The consumer composes with its geometry engine: load the
2627
+ * baseline, then per step replace elements by uniqueId from the delta and
2628
+ * drop the removed. Composing is NOT done here: writing a merged .frag
2629
+ * takes the fragments engine, which this package deliberately does not
2630
+ * carry.
2631
+ *
2632
+ * UniqueIds are the native application's own stable element ids (a Revit
2633
+ * UniqueId survives syncs, machines and full exports), which is what makes
2634
+ * replace-by-uniqueId the whole composition rule.
2635
+ *
2636
+ * When the baseline is NEWER than the asked version (somebody published
2637
+ * after it), the visible file no longer shows that moment: `baseline`
2638
+ * then carries the older version's `storageVersion` when the history
2639
+ * recorded one, so the consumer can download that stored file version
2640
+ * instead of the current one.
2641
+ */
2642
+ async modelParts(e) {
2643
+ const t = await this.timeline();
2644
+ if (t.length === 0)
2645
+ throw new Error(
2646
+ `Document ${this.source}-${this.docId} has no history yet.`
2647
+ );
2648
+ const s = e == null ? void 0 : e.at, r = s ? t.findIndex((c) => c.guid === s) : t.length - 1;
2649
+ if (r < 0)
2650
+ throw new Error(`No version ${s} in this document's timeline.`);
2651
+ let i = 0;
2652
+ for (let c = r; c >= 0; c--)
2653
+ if (t[c].full) {
2654
+ i = c;
2655
+ break;
2656
+ }
2657
+ const o = await h(this, p, de).call(this);
2658
+ if (!o)
2659
+ throw new Error(
2660
+ `Document ${this.source}-${this.docId} has no model file yet.`
2661
+ );
2662
+ const a = t[i], l = t.slice(r + 1).some((c) => c.full), d = t.slice(i + 1, r + 1).map((c) => ({
2663
+ guid: c.guid,
2664
+ ...c.deltaId ? { deltaId: c.deltaId } : {},
2665
+ removedUniqueIds: c.changes.filter((m) => m.type === "delete").map((m) => m.uniqueId)
2666
+ }));
2667
+ return {
2668
+ baseline: {
2669
+ fileId: o.id,
2670
+ guid: a.guid,
2671
+ current: !l,
2672
+ ...a.version !== void 0 ? { storageVersion: a.version } : {}
2673
+ },
2674
+ steps: d,
2675
+ at: t[r].guid
2676
+ };
2677
+ }
2616
2678
  /** The document folder's item id — the id the CDE knows this document by. */
2617
2679
  async folderId() {
2618
- return await c(this, p, z).call(this, !1);
2680
+ return await h(this, p, ee).call(this, !1);
2619
2681
  }
2620
2682
  // ─── The document descriptor ───────────────────────────────────────────────
2621
2683
  /**
@@ -2623,7 +2685,7 @@ class ar {
2623
2685
  * not carry one yet — an old folder from before descriptors existed.
2624
2686
  */
2625
2687
  async descriptor() {
2626
- return await f(this, p, ge).descriptor(await c(this, p, z).call(this, !1));
2688
+ return await u(this, p, ie).descriptor(await h(this, p, ee).call(this, !1));
2627
2689
  }
2628
2690
  /**
2629
2691
  * The first view whose format appears in `formats`, searched in the order
@@ -2631,7 +2693,7 @@ class ar {
2631
2693
  * model .frag on a descriptor-less folder, so old documents keep viewing.
2632
2694
  */
2633
2695
  async view(e) {
2634
- const t = await c(this, p, z).call(this, !1), s = await f(this, p, ge).descriptor(t);
2696
+ const t = await h(this, p, ee).call(this, !1), s = await u(this, p, ie).descriptor(t);
2635
2697
  if (s) {
2636
2698
  for (const i of e) {
2637
2699
  const o = s.views.find((a) => a.format === i);
@@ -2640,7 +2702,7 @@ class ar {
2640
2702
  return null;
2641
2703
  }
2642
2704
  if (!e.includes("frag")) return null;
2643
- const r = await c(this, p, be).call(this);
2705
+ const r = await h(this, p, de).call(this);
2644
2706
  return r ? { fileId: r.id, format: "frag" } : null;
2645
2707
  }
2646
2708
  /**
@@ -2649,17 +2711,36 @@ class ar {
2649
2711
  * One view per format: a same-format view is replaced, not accumulated.
2650
2712
  */
2651
2713
  async addView(e) {
2652
- const t = await c(this, p, z).call(this, !0);
2653
- if (await f(this, p, ge).descriptor(t)) {
2654
- await f(this, p, ge).addView(t, e);
2714
+ const t = await h(this, p, ee).call(this, !0);
2715
+ if (await u(this, p, ie).descriptor(t)) {
2716
+ await u(this, p, ie).addView(t, e);
2655
2717
  return;
2656
2718
  }
2657
- const r = await c(this, p, be).call(this);
2658
- await f(this, p, ge).setDescriptor(t, {
2659
- name: (r == null ? void 0 : r.name.replace(/\.frag$/, "")) ?? f(this, p, we),
2719
+ const r = await h(this, p, de).call(this);
2720
+ await u(this, p, ie).setDescriptor(t, {
2721
+ name: (r == null ? void 0 : r.name.replace(/\.frag$/, "")) ?? u(this, p, Ce),
2660
2722
  views: [e]
2661
2723
  });
2662
2724
  }
2725
+ /**
2726
+ * Makes sure the folder carries a descriptor, WRITING one when it predates
2727
+ * them: the visible model .frag becomes the 'frag' view. The explicit form
2728
+ * of what {@link addView} does implicitly — reads like `descriptor()` never
2729
+ * write, so migrating an old folder is this deliberate call. Returns the
2730
+ * descriptor either way, or null when there is nothing to describe yet (no
2731
+ * model file).
2732
+ */
2733
+ async ensureDescriptor() {
2734
+ const e = await h(this, p, ee).call(this, !1), t = await u(this, p, ie).descriptor(e);
2735
+ if (t) return t;
2736
+ const s = await h(this, p, de).call(this);
2737
+ if (!s) return null;
2738
+ const r = {
2739
+ name: s.name.replace(/\.frag$/, ""),
2740
+ views: [{ fileId: s.id, format: "frag" }]
2741
+ };
2742
+ return await u(this, p, ie).setDescriptor(e, r), await u(this, p, ie).descriptor(e);
2743
+ }
2663
2744
  // ─── Ownership (element locks) ─────────────────────────────────────────────
2664
2745
  /**
2665
2746
  * Who currently holds which elements, read from the lock registry the
@@ -2669,15 +2750,15 @@ class ar {
2669
2750
  * claims counts only for the earliest one, matching the plugins' rule.
2670
2751
  */
2671
2752
  async ownership() {
2672
- const e = await c(this, p, Re).call(this, ir);
2753
+ const e = await h(this, p, We).call(this, cr);
2673
2754
  if (!e) return [];
2674
2755
  const t = await this.client.getHiddenFilesByParent(e.id), s = await Promise.all(
2675
2756
  t.map(async (o) => {
2676
2757
  try {
2677
- const a = H(o), l = await this.client.downloadHiddenFile(a), u = JSON.parse(await l.text());
2678
- return !u || typeof u != "object" || !("revitflowlock" in u) || !Array.isArray(u.keys) ? null : {
2679
- owner: String(u.user ?? ""),
2680
- keys: u.keys.filter((h) => typeof h == "string")
2758
+ const a = te(o), l = await this.client.downloadHiddenFile(a), d = JSON.parse(await l.text());
2759
+ return !d || typeof d != "object" || !("revitflowlock" in d) || !Array.isArray(d.keys) ? null : {
2760
+ owner: String(d.user ?? ""),
2761
+ keys: d.keys.filter((c) => typeof c == "string")
2681
2762
  };
2682
2763
  } catch {
2683
2764
  return null;
@@ -2706,16 +2787,16 @@ class ar {
2706
2787
  */
2707
2788
  async sync(e) {
2708
2789
  var a;
2709
- const t = await c(this, p, z).call(this, !0);
2710
- let s = await c(this, p, He).call(this) ?? {
2790
+ const t = await h(this, p, ee).call(this, !0);
2791
+ let s = await h(this, p, ft).call(this) ?? {
2711
2792
  model: this.docId,
2712
2793
  commits: []
2713
2794
  };
2714
- const r = ss(s.commits);
2795
+ const r = bs(s.commits);
2715
2796
  if (e.expectedLatestGuid !== void 0 && (r == null ? void 0 : r.guid) !== e.expectedLatestGuid)
2716
- throw new Zt(e.expectedLatestGuid, r == null ? void 0 : r.guid);
2797
+ throw new ys(e.expectedLatestGuid, r == null ? void 0 : r.guid);
2717
2798
  const i = {
2718
- guid: Et(),
2799
+ guid: Mt(),
2719
2800
  ...r ? { parents: [r.guid] } : {},
2720
2801
  author: e.author,
2721
2802
  source: e.source,
@@ -2724,36 +2805,36 @@ class ar {
2724
2805
  ...e.userId ? { userId: e.userId } : {},
2725
2806
  ...(a = e.appliedOps) != null && a.length ? { appliedOps: e.appliedOps } : {},
2726
2807
  changes: e.changes,
2727
- counts: cr(e.changes)
2808
+ counts: dr(e.changes)
2728
2809
  };
2729
- if (e.model && (await c(this, p, $s).call(this, t, e.model), i.full = !0), e.delta) {
2730
- const l = await c(this, p, be).call(this);
2810
+ if (e.model && (await h(this, p, Ws).call(this, t, e.model), i.full = !0), e.delta) {
2811
+ const l = await h(this, p, de).call(this);
2731
2812
  if (!l)
2732
2813
  throw new Error(
2733
2814
  "A delta needs the model file to hang from: sync a full model first."
2734
2815
  );
2735
- const u = await this.client.createHiddenFile(
2816
+ const d = await this.client.createHiddenFile(
2736
2817
  e.delta,
2737
2818
  l.id
2738
2819
  );
2739
2820
  i.deltaId = String(
2740
- u._id ?? u.id
2821
+ d._id ?? d.id
2741
2822
  );
2742
2823
  }
2743
- const o = await c(this, p, He).call(this);
2824
+ const o = await h(this, p, ft).call(this);
2744
2825
  if (o) {
2745
2826
  s = o;
2746
- const l = ss(s.commits);
2827
+ const l = bs(s.commits);
2747
2828
  if (e.expectedLatestGuid !== void 0 && (l == null ? void 0 : l.guid) !== e.expectedLatestGuid)
2748
- throw new Zt(e.expectedLatestGuid, l == null ? void 0 : l.guid);
2829
+ throw new ys(e.expectedLatestGuid, l == null ? void 0 : l.guid);
2749
2830
  l && !i.parents && (i.parents = [l.guid]);
2750
2831
  }
2751
- return s.commits.push(i), await c(this, p, Je).call(this, t, yt, s), i;
2832
+ return s.commits.push(i), await h(this, p, pt).call(this, t, Ft, s), i;
2752
2833
  }
2753
2834
  // ─── Suggestions (change requests) ────────────────────────────────────────
2754
2835
  /** Every suggestion in the document's queue, pending or resolved. */
2755
2836
  async suggestions() {
2756
- const e = await c(this, p, Ce).call(this);
2837
+ const e = await h(this, p, Ye).call(this);
2757
2838
  return (e == null ? void 0 : e.ops) ?? [];
2758
2839
  }
2759
2840
  /** The suggestions still waiting for the owner, oldest first. */
@@ -2765,8 +2846,8 @@ class ar {
2765
2846
  * uploaded as a hidden file under the suggestions index.
2766
2847
  */
2767
2848
  async suggest(e) {
2768
- const t = await c(this, p, z).call(this, !0), s = await c(this, p, Ce).call(this) ?? { schema: ts, ops: [] }, r = await c(this, p, Re).call(this, ye), i = {
2769
- opId: e.opId ?? Et(),
2849
+ const t = await h(this, p, ee).call(this, !0), s = await h(this, p, Ye).call(this) ?? { schema: ws, ops: [] }, r = await h(this, p, We).call(this, Re), i = {
2850
+ opId: e.opId ?? Mt(),
2770
2851
  to: e.to ?? this.source,
2771
2852
  title: e.title,
2772
2853
  verb: e.verb,
@@ -2779,7 +2860,7 @@ class ar {
2779
2860
  ...e.baseCommitGuid ? { baseCommitGuid: e.baseCommitGuid } : {}
2780
2861
  };
2781
2862
  if (e.payload) {
2782
- const a = r ?? await c(this, p, vt).call(this, t, ye, s), l = await this.client.createHiddenFile(
2863
+ const a = r ?? await h(this, p, Ut).call(this, t, Re, s), l = await this.client.createHiddenFile(
2783
2864
  e.payload,
2784
2865
  a.id
2785
2866
  );
@@ -2787,8 +2868,8 @@ class ar {
2787
2868
  l._id ?? l.id
2788
2869
  );
2789
2870
  }
2790
- const o = await c(this, p, Ce).call(this) ?? s;
2791
- return o.schema ?? (o.schema = ts), o.ops.push(i), await c(this, p, Je).call(this, t, ye, o), i;
2871
+ const o = await h(this, p, Ye).call(this) ?? s;
2872
+ return o.schema ?? (o.schema = ws), o.ops.push(i), await h(this, p, pt).call(this, t, Re, o), i;
2792
2873
  }
2793
2874
  /** A suggestion's .frag payload. */
2794
2875
  async suggestionPayload(e) {
@@ -2802,20 +2883,20 @@ class ar {
2802
2883
  * use it for `discarded`.
2803
2884
  */
2804
2885
  async resolveSuggestion(e, t) {
2805
- const s = await c(this, p, z).call(this, !1);
2886
+ const s = await h(this, p, ee).call(this, !1);
2806
2887
  if (!s) throw new Error("This document has no suggestion queue.");
2807
- const r = await c(this, p, Ce).call(this), i = r == null ? void 0 : r.ops.find((o) => o.opId === e);
2888
+ const r = await h(this, p, Ye).call(this), i = r == null ? void 0 : r.ops.find((o) => o.opId === e);
2808
2889
  if (!r || !i)
2809
2890
  throw new Error(`No suggestion ${e} in this document's queue.`);
2810
- return Object.assign(i, t), await c(this, p, Je).call(this, s, ye, r), i;
2891
+ return Object.assign(i, t), await h(this, p, pt).call(this, s, Re, r), i;
2811
2892
  }
2812
2893
  }
2813
- X = new WeakMap(), p = new WeakSet(), ge = function() {
2814
- return new ks(this.client, this.project.projectId);
2815
- }, we = function() {
2894
+ oe = new WeakMap(), p = new WeakSet(), ie = function() {
2895
+ return new Ms(this.client, this.project.projectId);
2896
+ }, Ce = function() {
2816
2897
  return `${this.source}-${this.docId}`;
2817
- }, z = async function(e) {
2818
- if (f(this, X)) return f(this, X);
2898
+ }, ee = async function(e) {
2899
+ if (u(this, oe)) return u(this, oe);
2819
2900
  const t = await this.project.rootFolderId(e);
2820
2901
  if (!t)
2821
2902
  throw new Error(
@@ -2824,153 +2905,153 @@ X = new WeakMap(), p = new WeakSet(), ge = function() {
2824
2905
  const s = await this.client.listFolders({
2825
2906
  parentFolderId: t,
2826
2907
  projectId: this.project.projectId
2827
- }), r = Cs(s, t).find(
2828
- (o) => String(o.name ?? "") === f(this, p, we)
2908
+ }), r = Js(s, t).find(
2909
+ (o) => String(o.name ?? "") === u(this, p, Ce)
2829
2910
  );
2830
2911
  if (r)
2831
- return k(this, X, H(r)), f(this, X);
2912
+ return R(this, oe, te(r)), u(this, oe);
2832
2913
  if (!e)
2833
2914
  throw new Error(
2834
- `Document ${f(this, p, we)} does not exist in this project.`
2915
+ `Document ${u(this, p, Ce)} does not exist in this project.`
2835
2916
  );
2836
2917
  const i = await this.client.createFolder(
2837
- f(this, p, we),
2918
+ u(this, p, Ce),
2838
2919
  t,
2839
2920
  this.project.projectId
2840
2921
  );
2841
- return k(this, X, H(i)), f(this, X);
2842
- }, wt = async function() {
2843
- const e = await c(this, p, z).call(this, !1);
2922
+ return R(this, oe, te(i)), u(this, oe);
2923
+ }, qt = async function() {
2924
+ const e = await h(this, p, ee).call(this, !1);
2844
2925
  return (await this.client.listFiles({ folderId: e })).map((s) => ({
2845
- id: H(s),
2926
+ id: te(s),
2846
2927
  name: String(s.name ?? "")
2847
2928
  }));
2848
- }, Re = async function(e) {
2929
+ }, We = async function(e) {
2849
2930
  try {
2850
- return (await c(this, p, wt).call(this)).find((t) => t.name === e);
2931
+ return (await h(this, p, qt).call(this)).find((t) => t.name === e);
2851
2932
  } catch {
2852
2933
  return;
2853
2934
  }
2854
- }, be = async function() {
2935
+ }, de = async function() {
2855
2936
  try {
2856
- const e = await c(this, p, wt).call(this);
2857
- return e.find((t) => t.name === As) ?? e.find(
2858
- (t) => t.name.endsWith(".frag") && !t.name.startsWith(Rs)
2937
+ const e = await h(this, p, qt).call(this);
2938
+ return e.find((t) => t.name === Hs) ?? e.find(
2939
+ (t) => t.name.endsWith(".frag") && !t.name.startsWith(Gs)
2859
2940
  );
2860
2941
  } catch {
2861
2942
  return;
2862
2943
  }
2863
- }, bt = async function(e) {
2864
- const t = await c(this, p, Re).call(this, e);
2944
+ }, jt = async function(e) {
2945
+ const t = await h(this, p, We).call(this, e);
2865
2946
  if (!t) return;
2866
2947
  const r = await (await this.client.downloadFile(t.id)).text();
2867
2948
  if (r.trim())
2868
2949
  return JSON.parse(r);
2869
- }, He = function() {
2870
- return c(this, p, bt).call(this, yt);
2871
- }, Ce = function() {
2872
- return c(this, p, bt).call(this, ye);
2873
- }, Je = async function(e, t, s) {
2950
+ }, ft = function() {
2951
+ return h(this, p, jt).call(this, Ft);
2952
+ }, Ye = function() {
2953
+ return h(this, p, jt).call(this, Re);
2954
+ }, pt = async function(e, t, s) {
2874
2955
  const r = new Blob([JSON.stringify(s)], {
2875
2956
  type: "application/json"
2876
- }), i = await c(this, p, Re).call(this, t);
2957
+ }), i = await h(this, p, We).call(this, t);
2877
2958
  return i ? (await this.client.updateFile(i.id, {
2878
2959
  file: r,
2879
- versionTag: Ue()
2880
- }), i) : await c(this, p, vt).call(this, e, t, s);
2881
- }, vt = async function(e, t, s) {
2960
+ versionTag: ct()
2961
+ }), i) : await h(this, p, Ut).call(this, e, t, s);
2962
+ }, Ut = async function(e, t, s) {
2882
2963
  const r = new Blob([JSON.stringify(s)], {
2883
2964
  type: "application/json"
2884
2965
  }), i = await this.client.createFile({
2885
2966
  file: r,
2886
2967
  name: t,
2887
- versionTag: Ue(),
2968
+ versionTag: ct(),
2888
2969
  parentFolderId: e,
2889
2970
  projectId: this.project.projectId
2890
2971
  }), o = i.item;
2891
- return { id: H(o ?? i), name: t };
2892
- }, $s = async function(e, t) {
2893
- const s = await c(this, p, be).call(this);
2972
+ return { id: te(o ?? i), name: t };
2973
+ }, Ws = async function(e, t) {
2974
+ const s = await h(this, p, de).call(this);
2894
2975
  if (s)
2895
2976
  return await this.client.updateFile(s.id, {
2896
2977
  file: t,
2897
- versionTag: Ue()
2978
+ versionTag: ct()
2898
2979
  }), s;
2899
- const r = `${f(this, p, we)}.frag`, i = await this.client.createFile({
2980
+ const r = `${u(this, p, Ce)}.frag`, i = await this.client.createFile({
2900
2981
  file: t,
2901
2982
  name: r,
2902
- versionTag: Ue(),
2983
+ versionTag: ct(),
2903
2984
  parentFolderId: e,
2904
2985
  projectId: this.project.projectId
2905
2986
  }), o = i.item;
2906
- return { id: H(o ?? i), name: r };
2987
+ return { id: te(o ?? i), name: r };
2907
2988
  };
2908
- function cr(n) {
2989
+ function dr(n) {
2909
2990
  const e = { added: 0, modified: 0, removed: 0 };
2910
2991
  for (const t of n)
2911
2992
  t.type === "create" ? e.added++ : t.type === "delete" ? e.removed++ : e.modified++;
2912
2993
  return e;
2913
2994
  }
2914
- function xs(n) {
2995
+ function Ys(n) {
2915
2996
  var l;
2916
2997
  if (n.length <= 1)
2917
- return n.forEach((u, h) => u.ordinal = h), [...n];
2918
- const e = new Map(n.map((u) => [u.guid, u])), t = /* @__PURE__ */ new Map(), s = [];
2919
- for (const u of n) {
2920
- const h = (l = u.parents) == null ? void 0 : l[0];
2921
- if (h && e.has(h)) {
2922
- const y = t.get(h) ?? [];
2923
- y.push(u), t.set(h, y);
2998
+ return n.forEach((d, c) => d.ordinal = c), [...n];
2999
+ const e = new Map(n.map((d) => [d.guid, d])), t = /* @__PURE__ */ new Map(), s = [];
3000
+ for (const d of n) {
3001
+ const c = (l = d.parents) == null ? void 0 : l[0];
3002
+ if (c && e.has(c)) {
3003
+ const m = t.get(c) ?? [];
3004
+ m.push(d), t.set(c, m);
2924
3005
  } else
2925
- s.push(u);
3006
+ s.push(d);
2926
3007
  }
2927
- const r = (u, h) => String(u.timestamp).localeCompare(String(h.timestamp));
3008
+ const r = (d, c) => String(d.timestamp).localeCompare(String(c.timestamp));
2928
3009
  s.sort(r);
2929
3010
  const i = [], o = [...s].reverse(), a = /* @__PURE__ */ new Set();
2930
3011
  for (; o.length; ) {
2931
- const u = o.pop();
2932
- if (a.has(u.guid)) continue;
2933
- a.add(u.guid), i.push(u);
2934
- const h = (t.get(u.guid) ?? []).sort(r);
2935
- for (let y = h.length - 1; y >= 0; y--) o.push(h[y]);
2936
- }
2937
- for (const u of n)
2938
- a.has(u.guid) || i.push(u);
2939
- return i.forEach((u, h) => u.ordinal = h), i;
3012
+ const d = o.pop();
3013
+ if (a.has(d.guid)) continue;
3014
+ a.add(d.guid), i.push(d);
3015
+ const c = (t.get(d.guid) ?? []).sort(r);
3016
+ for (let m = c.length - 1; m >= 0; m--) o.push(c[m]);
3017
+ }
3018
+ for (const d of n)
3019
+ a.has(d.guid) || i.push(d);
3020
+ return i.forEach((d, c) => d.ordinal = c), i;
2940
3021
  }
2941
- function ss(n) {
2942
- const e = xs(n);
3022
+ function bs(n) {
3023
+ const e = Ys(n);
2943
3024
  return e[e.length - 1];
2944
3025
  }
2945
- function Et() {
3026
+ function Mt() {
2946
3027
  const n = globalThis.crypto;
2947
3028
  return n != null && n.randomUUID ? n.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
2948
3029
  const t = Math.random() * 16 | 0;
2949
3030
  return (e === "x" ? t : t & 3 | 8).toString(16);
2950
3031
  });
2951
3032
  }
2952
- var ie, Pe, _t;
2953
- class hr {
3033
+ var fe, Qe, Vt;
3034
+ class ur {
2954
3035
  constructor(e) {
2955
- _(this, Pe);
2956
- _(this, ie, /* @__PURE__ */ new Map());
3036
+ S(this, Qe);
3037
+ S(this, fe, /* @__PURE__ */ new Map());
2957
3038
  this.client = e;
2958
3039
  }
2959
3040
  /** Registers a recipe. One per name; a second with the same name throws. */
2960
3041
  register(e) {
2961
- if (f(this, ie).has(e.name))
3042
+ if (u(this, fe).has(e.name))
2962
3043
  throw new Error(`A recipe named "${e.name}" is already registered.`);
2963
- f(this, ie).set(e.name, e);
3044
+ u(this, fe).set(e.name, e);
2964
3045
  }
2965
3046
  /** The registered recipes, optionally filtered by target application. */
2966
3047
  list(e) {
2967
- return [...f(this, ie).values()].filter(
3048
+ return [...u(this, fe).values()].filter(
2968
3049
  (s) => (!(e != null && e.to) || s.to === e.to) && (!(e != null && e.input) || s.inputs.includes(e.input))
2969
3050
  );
2970
3051
  }
2971
3052
  /** A registered recipe by name, or undefined. */
2972
3053
  get(e) {
2973
- return f(this, ie).get(e);
3054
+ return u(this, fe).get(e);
2974
3055
  }
2975
3056
  /**
2976
3057
  * Runs a recipe WITHOUT queueing anything: the dry pass. Returns a
@@ -2979,7 +3060,7 @@ class hr {
2979
3060
  * included, with no second run. Discard it and the plan never happened.
2980
3061
  */
2981
3062
  async plan(e, t) {
2982
- const { base: s, opId: r, result: i } = await c(this, Pe, _t).call(this, e, t);
3063
+ const { base: s, opId: r, result: i } = await h(this, Qe, Vt).call(this, e, t);
2983
3064
  return {
2984
3065
  opId: r,
2985
3066
  projectId: t.projectId,
@@ -3012,7 +3093,7 @@ class hr {
3012
3093
  * to show the tallies before queueing.
3013
3094
  */
3014
3095
  async run(e, t) {
3015
- const { targetDoc: s, base: r, opId: i, result: o } = await c(this, Pe, _t).call(this, e, t);
3096
+ const { targetDoc: s, base: r, opId: i, result: o } = await h(this, Qe, Vt).call(this, e, t);
3016
3097
  return { suggestion: await s.suggest({
3017
3098
  opId: i,
3018
3099
  title: o.title,
@@ -3025,14 +3106,14 @@ class hr {
3025
3106
  }), result: o };
3026
3107
  }
3027
3108
  }
3028
- ie = new WeakMap(), Pe = new WeakSet(), _t = async function(e, t) {
3029
- const s = f(this, ie).get(e);
3109
+ fe = new WeakMap(), Qe = new WeakSet(), Vt = async function(e, t) {
3110
+ const s = u(this, fe).get(e);
3030
3111
  if (!s) throw new Error(`No recipe named "${e}" is registered.`);
3031
3112
  if (s.to !== t.target.source)
3032
3113
  throw new Error(
3033
3114
  `Recipe "${e}" writes ${s.to}, but the target document belongs to ${t.target.source}.`
3034
3115
  );
3035
- const r = this.client.history(t.projectId).doc(t.target.source, t.target.docId), i = await r.latest(), o = Et(), a = await s.run({
3116
+ const r = this.client.history(t.projectId).doc(t.target.source, t.target.docId), i = await r.latest(), o = Mt(), a = await s.run({
3036
3117
  client: this.client,
3037
3118
  projectId: t.projectId,
3038
3119
  targetDoc: r,
@@ -3042,8 +3123,8 @@ ie = new WeakMap(), Pe = new WeakSet(), _t = async function(e, t) {
3042
3123
  });
3043
3124
  return { recipe: s, targetDoc: r, base: i, opId: o, result: a };
3044
3125
  };
3045
- const ns = 100;
3046
- function lr(n) {
3126
+ const vs = 100;
3127
+ function fr(n) {
3047
3128
  try {
3048
3129
  const e = JSON.parse(n);
3049
3130
  if (e && typeof e == "object") {
@@ -3058,29 +3139,29 @@ function lr(n) {
3058
3139
  }
3059
3140
  return {};
3060
3141
  }
3061
- function dr(n) {
3142
+ function pr(n) {
3062
3143
  if (!n || typeof n != "object") return;
3063
3144
  const e = n.retryAfter;
3064
3145
  return typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : void 0;
3065
3146
  }
3066
- class Lt extends Error {
3147
+ class rs extends Error {
3067
3148
  constructor(t, s, r, i) {
3068
- const o = lr(r);
3149
+ const o = fr(r);
3069
3150
  super(o.message ?? `${s || "Request failed"} (${t})`);
3070
- N(this, "status");
3071
- N(this, "code");
3072
- N(this, "details");
3073
- N(this, "body");
3151
+ B(this, "status");
3152
+ B(this, "code");
3153
+ B(this, "details");
3154
+ B(this, "body");
3074
3155
  /**
3075
3156
  * Seconds to wait before retrying, taken from the `Retry-After` header or
3076
3157
  * from `details.retryAfter`. Only present on rate-limited (429) responses.
3077
3158
  */
3078
- N(this, "retryAfter");
3079
- this.name = "RequestError", this.status = t, this.code = o.code, this.details = o.details, this.body = r, this.retryAfter = i ?? dr(o.details);
3159
+ B(this, "retryAfter");
3160
+ this.name = "RequestError", this.status = t, this.code = o.code, this.details = o.details, this.body = r, this.retryAfter = i ?? pr(o.details);
3080
3161
  }
3081
3162
  }
3082
- const G = "item/folder", g = "item", ne = "processor", ur = "npm-registry", K = "hidden", ot = "FILE", at = "TOOL", ct = "APP", fr = 500, rs = 3e4, pr = 0.25, mr = (n) => new Promise((e) => setTimeout(e, n));
3083
- function yr(n) {
3163
+ const Z = "item/folder", b = "item", le = "processor", mr = "npm-registry", re = "hidden", kt = "FILE", Ot = "TOOL", At = "APP", yr = 500, Es = 3e4, gr = 0.25, wr = (n) => new Promise((e) => setTimeout(e, n));
3164
+ function br(n) {
3084
3165
  var r, i;
3085
3166
  const e = (i = (r = n.headers) == null ? void 0 : r.get) == null ? void 0 : i.call(r, "Retry-After");
3086
3167
  if (!e) return;
@@ -3090,18 +3171,18 @@ function yr(n) {
3090
3171
  if (!Number.isNaN(s))
3091
3172
  return Math.max(0, (s - Date.now()) / 1e3);
3092
3173
  }
3093
- function gr(n) {
3094
- return n instanceof Lt ? n.status === 429 || n.status >= 500 : !0;
3174
+ function vr(n) {
3175
+ return n instanceof rs ? n.status === 429 || n.status >= 500 : !0;
3095
3176
  }
3096
- function wr(n, e) {
3177
+ function Er(n, e) {
3097
3178
  const t = Math.min(
3098
- fr * 2 ** e,
3099
- rs
3100
- ), s = t * pr * Math.random(), r = n instanceof Lt && n.retryAfter != null ? n.retryAfter * 1e3 : void 0;
3101
- return r != null ? Math.min(r, rs) + s : t + s;
3179
+ yr * 2 ** e,
3180
+ Es
3181
+ ), s = t * gr * Math.random(), r = n instanceof rs && n.retryAfter != null ? n.retryAfter * 1e3 : void 0;
3182
+ return r != null ? Math.min(r, Es) + s : t + s;
3102
3183
  }
3103
- var d, It, m, re, Be, $e, We, Ye, St, kt, Ns;
3104
- const qt = class qt {
3184
+ var f, Gt, w, ue, Ze, ze, mt, yt, Jt, Wt, zs;
3185
+ const is = class is {
3105
3186
  /**
3106
3187
  * Creates a new EngineServicesClient instance.
3107
3188
  * @param accessToken - API access token (obtained from the platform dashboard)
@@ -3110,26 +3191,26 @@ const qt = class qt {
3110
3191
  * @param props - Optional configuration (retry count, auth mode, etc.).
3111
3192
  */
3112
3193
  constructor(e, t, s) {
3113
- _(this, d);
3114
- N(this, "apiUrl");
3115
- N(this, "accessToken");
3116
- N(this, "wsUrl");
3117
- N(this, "retries");
3118
- N(this, "useBearer");
3119
- N(this, "builtInGlobals", null);
3194
+ S(this, f);
3195
+ B(this, "apiUrl");
3196
+ B(this, "accessToken");
3197
+ B(this, "wsUrl");
3198
+ B(this, "retries");
3199
+ B(this, "useBearer");
3200
+ B(this, "builtInGlobals", null);
3120
3201
  /**
3121
3202
  * URL of a local execution server (e.g. `http://localhost:4001`).
3122
3203
  * When set, execution methods are routed to this server instead of the cloud API.
3123
3204
  * Set to `null` to disable local routing and use the cloud API.
3124
3205
  */
3125
- N(this, "localServerUrl", null);
3206
+ B(this, "localServerUrl", null);
3126
3207
  /**
3127
3208
  * The platform context this client was created with.
3128
3209
  * Contains `appId`, `projectId`, `accessToken`, and `apiUrl`.
3129
3210
  * Populated automatically when using {@link fromPlatformContext}.
3130
3211
  */
3131
- N(this, "context");
3132
- _(this, Be);
3212
+ B(this, "context");
3213
+ S(this, Ze);
3133
3214
  const { retries: r = 0, useBearer: i = !1, localServerUrl: o } = s || {};
3134
3215
  let a = t;
3135
3216
  if (a.charAt(a.length - 1) === "/" && (a = a.slice(0, -1)), this.apiUrl = `${a}/api`, this.accessToken = e, this.wsUrl = a, this.retries = r, this.useBearer = i, this.context = { appId: "", projectId: "", accessToken: e, apiUrl: t }, o) {
@@ -3154,7 +3235,7 @@ const qt = class qt {
3154
3235
  * ```
3155
3236
  */
3156
3237
  static fromPlatformContext(e) {
3157
- const t = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new qt(t.accessToken, t.apiUrl, {
3238
+ const t = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new is(t.accessToken, t.apiUrl, {
3158
3239
  ...e,
3159
3240
  useBearer: !0
3160
3241
  });
@@ -3230,7 +3311,7 @@ const qt = class qt {
3230
3311
  * cleaning logic is applied identically.
3231
3312
  */
3232
3313
  async request(e, t, s) {
3233
- return c(this, d, m).call(this, e, t, s);
3314
+ return h(this, f, w).call(this, e, t, s);
3234
3315
  }
3235
3316
  // ─── Files ───────────────────────────────────────────────────────
3236
3317
  /**
@@ -3240,9 +3321,9 @@ const qt = class qt {
3240
3321
  */
3241
3322
  async listFiles(e) {
3242
3323
  const { folderId: t, archived: s, projectId: r } = e || {};
3243
- return t ? await c(this, d, m).call(this, "GET", `${G}/${t}/items`, { query: { itemType: ot, archived: s } }) : await c(this, d, m).call(this, "GET", `${g}`, {
3324
+ return t ? await h(this, f, w).call(this, "GET", `${Z}/${t}/items`, { query: { itemType: kt, archived: s } }) : await h(this, f, w).call(this, "GET", `${b}`, {
3244
3325
  query: {
3245
- itemType: ot,
3326
+ itemType: kt,
3246
3327
  archived: s,
3247
3328
  ...r && { projectId: r }
3248
3329
  }
@@ -3255,7 +3336,7 @@ const qt = class qt {
3255
3336
  * @returns The file item, optionally with version history.
3256
3337
  */
3257
3338
  async getFile(e, t) {
3258
- return await c(this, d, kt).call(this, e, t);
3339
+ return await h(this, f, Wt).call(this, e, t);
3259
3340
  }
3260
3341
  /**
3261
3342
  * Uploads a new file.
@@ -3263,7 +3344,7 @@ const qt = class qt {
3263
3344
  * @returns The created item and its first version.
3264
3345
  */
3265
3346
  async createFile(e) {
3266
- return await c(this, d, Ye).call(this, e, ot);
3347
+ return await h(this, f, yt).call(this, e, kt);
3267
3348
  }
3268
3349
  /**
3269
3350
  * Updates an existing file. Can rename, move to a different folder,
@@ -3273,21 +3354,21 @@ const qt = class qt {
3273
3354
  * @returns The updated item and/or the new version.
3274
3355
  */
3275
3356
  async updateFile(e, t) {
3276
- return await c(this, d, St).call(this, e, t);
3357
+ return await h(this, f, Jt).call(this, e, t);
3277
3358
  }
3278
3359
  /**
3279
3360
  * Archives (soft-deletes) a file. Can be recovered with {@link recoverFile}.
3280
3361
  * @param fileId - The file's unique identifier.
3281
3362
  */
3282
3363
  async archiveFile(e) {
3283
- return await c(this, d, m).call(this, "DELETE", `${g}/${e}`);
3364
+ return await h(this, f, w).call(this, "DELETE", `${b}/${e}`);
3284
3365
  }
3285
3366
  /**
3286
3367
  * Recovers a previously archived file.
3287
3368
  * @param fileId - The file's unique identifier.
3288
3369
  */
3289
3370
  async recoverFile(e) {
3290
- return await c(this, d, m).call(this, "PUT", `${g}/${e}/recover`);
3371
+ return await h(this, f, w).call(this, "PUT", `${b}/${e}/recover`);
3291
3372
  }
3292
3373
  /**
3293
3374
  * Downloads a file's content. Returns the raw fetch Response.
@@ -3296,7 +3377,7 @@ const qt = class qt {
3296
3377
  * @returns A fetch Response containing the file data.
3297
3378
  */
3298
3379
  async downloadFile(e, t) {
3299
- return await c(this, d, We).call(this, e, t);
3380
+ return await h(this, f, mt).call(this, e, t);
3300
3381
  }
3301
3382
  /**
3302
3383
  * Retrieves the free-JSON metadata for a specific file version.
@@ -3307,7 +3388,7 @@ const qt = class qt {
3307
3388
  */
3308
3389
  async getFileVersionMetadata(e, t, s) {
3309
3390
  const { withDraft: r } = s || {};
3310
- return await c(this, d, m).call(this, "GET", `${g}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
3391
+ return await h(this, f, w).call(this, "GET", `${b}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
3311
3392
  query: {
3312
3393
  ...r && { withDraft: "true" }
3313
3394
  }
@@ -3320,7 +3401,7 @@ const qt = class qt {
3320
3401
  * @param metadata - Free-JSON object (max 200 fields, 50-char keys/values).
3321
3402
  */
3322
3403
  async updateFileVersionMetadata(e, t, s) {
3323
- return await c(this, d, m).call(this, "PUT", `${g}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
3404
+ return await h(this, f, w).call(this, "PUT", `${b}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
3324
3405
  body: JSON.stringify({ metadata: s }),
3325
3406
  contentType: "application/json"
3326
3407
  });
@@ -3331,7 +3412,7 @@ const qt = class qt {
3331
3412
  * @param versionTag - The version tag.
3332
3413
  */
3333
3414
  async deleteFileVersionMetadata(e, t) {
3334
- return await c(this, d, m).call(this, "DELETE", `${g}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`);
3415
+ return await h(this, f, w).call(this, "DELETE", `${b}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`);
3335
3416
  }
3336
3417
  /**
3337
3418
  * Batch variant of {@link getFileVersionMetadata}. Reads the metadata of
@@ -3348,7 +3429,7 @@ const qt = class qt {
3348
3429
  */
3349
3430
  async getFileVersionMetadataBatch(e, t) {
3350
3431
  const { withDraft: s } = t || {};
3351
- return await c(this, d, $e).call(this, e, async (r) => (await c(this, d, m).call(this, "POST", `${g}/batch/version-metadata`, {
3432
+ return await h(this, f, ze).call(this, e, async (r) => (await h(this, f, w).call(this, "POST", `${b}/batch/version-metadata`, {
3352
3433
  body: JSON.stringify({
3353
3434
  entries: r,
3354
3435
  ...s !== void 0 && { withDraft: s }
@@ -3364,7 +3445,7 @@ const qt = class qt {
3364
3445
  */
3365
3446
  async listFolders(e) {
3366
3447
  const { archived: t, parentFolderId: s, projectId: r } = e || {};
3367
- return await c(this, d, m).call(this, "GET", G, {
3448
+ return await h(this, f, w).call(this, "GET", Z, {
3368
3449
  query: {
3369
3450
  parentFolderId: s,
3370
3451
  archived: t,
@@ -3377,7 +3458,7 @@ const qt = class qt {
3377
3458
  * @param folderId - The folder's unique identifier.
3378
3459
  */
3379
3460
  async getFolder(e) {
3380
- return await c(this, d, m).call(this, "GET", `${G}/${e}`);
3461
+ return await h(this, f, w).call(this, "GET", `${Z}/${e}`);
3381
3462
  }
3382
3463
  /**
3383
3464
  * Batch variant of {@link getFolder}. Resolves a known set of folder ids in
@@ -3393,7 +3474,7 @@ const qt = class qt {
3393
3474
  * @param folderIds - The folder ids to resolve.
3394
3475
  */
3395
3476
  async getFoldersBatch(e) {
3396
- return await c(this, d, $e).call(this, e, async (t) => (await c(this, d, m).call(this, "POST", `${g}/batch/folders`, {
3477
+ return await h(this, f, ze).call(this, e, async (t) => (await h(this, f, w).call(this, "POST", `${b}/batch/folders`, {
3397
3478
  body: JSON.stringify({ folderIds: t }),
3398
3479
  contentType: "application/json"
3399
3480
  })).results);
@@ -3405,7 +3486,7 @@ const qt = class qt {
3405
3486
  * @returns The created folder.
3406
3487
  */
3407
3488
  async createFolder(e, t, s) {
3408
- return await c(this, d, m).call(this, "POST", G, {
3489
+ return await h(this, f, w).call(this, "POST", Z, {
3409
3490
  body: JSON.stringify({
3410
3491
  name: e,
3411
3492
  ...t && { parentId: t },
@@ -3422,7 +3503,7 @@ const qt = class qt {
3422
3503
  */
3423
3504
  async updateFolder(e, t) {
3424
3505
  const { name: s } = t;
3425
- return await c(this, d, m).call(this, "PUT", `${G}/${e}`, {
3506
+ return await h(this, f, w).call(this, "PUT", `${Z}/${e}`, {
3426
3507
  body: JSON.stringify({ name: s }),
3427
3508
  contentType: "application/json"
3428
3509
  });
@@ -3432,14 +3513,14 @@ const qt = class qt {
3432
3513
  * @param folderId - The folder's unique identifier.
3433
3514
  */
3434
3515
  async archiveFolder(e) {
3435
- return await c(this, d, m).call(this, "DELETE", `${G}/${e}`);
3516
+ return await h(this, f, w).call(this, "DELETE", `${Z}/${e}`);
3436
3517
  }
3437
3518
  /**
3438
3519
  * Recovers a previously archived folder.
3439
3520
  * @param folderId - The folder's unique identifier.
3440
3521
  */
3441
3522
  async recoverFolder(e) {
3442
- return await c(this, d, m).call(this, "PUT", `${G}/${e}/recover`);
3523
+ return await h(this, f, w).call(this, "PUT", `${Z}/${e}/recover`);
3443
3524
  }
3444
3525
  /**
3445
3526
  * Downloads an entire folder as a ZIP archive.
@@ -3447,7 +3528,7 @@ const qt = class qt {
3447
3528
  * @returns A fetch Response containing the ZIP data.
3448
3529
  */
3449
3530
  async downloadFolder(e) {
3450
- return await c(this, d, re).call(this, `${G}/${e}/download`);
3531
+ return await h(this, f, ue).call(this, `${Z}/${e}/download`);
3451
3532
  }
3452
3533
  // ─── Components ──────────────────────────────────────────────────
3453
3534
  /**
@@ -3457,14 +3538,14 @@ const qt = class qt {
3457
3538
  */
3458
3539
  async listComponents(e) {
3459
3540
  const { folderId: t, ShowVersions: s, projectId: r } = e || {};
3460
- return t ? await c(this, d, m).call(this, "GET", `${G}/${t}/items`, {
3541
+ return t ? await h(this, f, w).call(this, "GET", `${Z}/${t}/items`, {
3461
3542
  query: {
3462
- itemType: at,
3543
+ itemType: Ot,
3463
3544
  ...s && { ShowVersions: s }
3464
3545
  }
3465
- }) : await c(this, d, m).call(this, "GET", `${g}`, {
3546
+ }) : await h(this, f, w).call(this, "GET", `${b}`, {
3466
3547
  query: {
3467
- itemType: at,
3548
+ itemType: Ot,
3468
3549
  ...s && { ShowVersions: s },
3469
3550
  ...r && { projectId: r }
3470
3551
  }
@@ -3476,7 +3557,7 @@ const qt = class qt {
3476
3557
  * @param props - Options such as whether to include versions.
3477
3558
  */
3478
3559
  async getComponent(e, t) {
3479
- return await c(this, d, kt).call(this, e, t);
3560
+ return await h(this, f, Wt).call(this, e, t);
3480
3561
  }
3481
3562
  /**
3482
3563
  * Creates a new component with the given file and version properties.
@@ -3485,7 +3566,7 @@ const qt = class qt {
3485
3566
  */
3486
3567
  async createComponent(e) {
3487
3568
  const { componentProps: t } = e;
3488
- return await c(this, d, Ye).call(this, e, at, t);
3569
+ return await h(this, f, yt).call(this, e, Ot, t);
3489
3570
  }
3490
3571
  /**
3491
3572
  * Updates an existing component. Can rename, move, and/or upload a new version.
@@ -3495,7 +3576,7 @@ const qt = class qt {
3495
3576
  */
3496
3577
  async updateComponent(e, t) {
3497
3578
  const { componentProps: s } = t;
3498
- return await c(this, d, St).call(this, e, t, s);
3579
+ return await h(this, f, Jt).call(this, e, t, s);
3499
3580
  }
3500
3581
  /**
3501
3582
  * Downloads a component's full ZIP file. Returns the raw fetch Response.
@@ -3504,7 +3585,7 @@ const qt = class qt {
3504
3585
  * @returns A fetch Response containing the ZIP data.
3505
3586
  */
3506
3587
  async downloadComponent(e, t) {
3507
- return await c(this, d, We).call(this, e, t);
3588
+ return await h(this, f, mt).call(this, e, t);
3508
3589
  }
3509
3590
  /**
3510
3591
  * Downloads only the JavaScript bundle from a component's ZIP.
@@ -3515,7 +3596,7 @@ const qt = class qt {
3515
3596
  */
3516
3597
  async downloadComponentBundle(e, t) {
3517
3598
  const { versionTag: s, withDraft: r } = t || {};
3518
- return await c(this, d, re).call(this, `${g}/${e}/download/bundle`, {
3599
+ return await h(this, f, ue).call(this, `${b}/${e}/download/bundle`, {
3519
3600
  query: {
3520
3601
  ...s && { versionTag: s },
3521
3602
  ...r && { withDraft: r }
@@ -3527,14 +3608,14 @@ const qt = class qt {
3527
3608
  * @param componentId - The component's unique identifier.
3528
3609
  */
3529
3610
  async archiveComponent(e) {
3530
- return await c(this, d, m).call(this, "DELETE", `${g}/${e}`);
3611
+ return await h(this, f, w).call(this, "DELETE", `${b}/${e}`);
3531
3612
  }
3532
3613
  /**
3533
3614
  * Recovers a previously archived component.
3534
3615
  * @param componentId - The component's unique identifier.
3535
3616
  */
3536
3617
  async recoverComponent(e) {
3537
- return await c(this, d, m).call(this, "PUT", `${g}/${e}/recover`);
3618
+ return await h(this, f, w).call(this, "PUT", `${b}/${e}/recover`);
3538
3619
  }
3539
3620
  // ─── Built-in Components ─────────────────────────────────────────
3540
3621
  /**
@@ -3543,7 +3624,7 @@ const qt = class qt {
3543
3624
  * @returns The component's JavaScript source code as a string.
3544
3625
  */
3545
3626
  async getBuiltInComponent(e) {
3546
- return await (await c(this, d, re).call(this, `built-in/${e}/bundle`)).text();
3627
+ return await (await h(this, f, ue).call(this, `built-in/${e}/bundle`)).text();
3547
3628
  }
3548
3629
  /**
3549
3630
  * Fetches a built-in component bundle, evaluates it, and registers it
@@ -3572,9 +3653,9 @@ const qt = class qt {
3572
3653
  * ```
3573
3654
  */
3574
3655
  async initBuiltInComponent(e, t, s) {
3575
- const r = await this.getBuiltInComponent(e.uuid), i = s ?? this.builtInGlobals ?? (typeof window < "u" ? window.ThatOpenCompany : {}) ?? {}, o = Object.keys(i), a = o.map((y) => i[y]), u = new Function(...o, `${r}
3576
- return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3577
- t.get(h);
3656
+ const r = await this.getBuiltInComponent(e.uuid), i = s ?? this.builtInGlobals ?? (typeof window < "u" ? window.ThatOpenCompany : {}) ?? {}, o = Object.keys(i), a = o.map((m) => i[m]), d = new Function(...o, `${r}
3657
+ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
3658
+ t.get(c);
3578
3659
  }
3579
3660
  /**
3580
3661
  * Loads multiple built-in components in parallel.
@@ -3641,14 +3722,14 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3641
3722
  */
3642
3723
  async listApps(e) {
3643
3724
  const { folderId: t, ShowVersions: s, projectId: r } = e || {};
3644
- return t ? await c(this, d, m).call(this, "GET", `${G}/${t}/items`, {
3725
+ return t ? await h(this, f, w).call(this, "GET", `${Z}/${t}/items`, {
3645
3726
  query: {
3646
- itemType: ct,
3727
+ itemType: At,
3647
3728
  ...s && { ShowVersions: s }
3648
3729
  }
3649
- }) : await c(this, d, m).call(this, "GET", `${g}`, {
3730
+ }) : await h(this, f, w).call(this, "GET", `${b}`, {
3650
3731
  query: {
3651
- itemType: ct,
3732
+ itemType: At,
3652
3733
  ...s && { ShowVersions: s },
3653
3734
  ...r && { projectId: r }
3654
3735
  }
@@ -3661,7 +3742,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3661
3742
  */
3662
3743
  async createApp(e) {
3663
3744
  const { appProps: t } = e;
3664
- return await c(this, d, Ye).call(this, e, ct, t);
3745
+ return await h(this, f, yt).call(this, e, At, t);
3665
3746
  }
3666
3747
  /**
3667
3748
  * Downloads an app's full ZIP file. Returns the raw fetch Response.
@@ -3670,7 +3751,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3670
3751
  * @returns A fetch Response containing the ZIP data.
3671
3752
  */
3672
3753
  async downloadApp(e, t) {
3673
- return await c(this, d, We).call(this, e, t);
3754
+ return await h(this, f, mt).call(this, e, t);
3674
3755
  }
3675
3756
  /**
3676
3757
  * Downloads only the JavaScript bundle from an app's ZIP.
@@ -3681,7 +3762,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3681
3762
  */
3682
3763
  async downloadAppBundle(e, t) {
3683
3764
  const { versionTag: s, withDraft: r } = t || {};
3684
- return await c(this, d, re).call(this, `${g}/${e}/download/bundle`, {
3765
+ return await h(this, f, ue).call(this, `${b}/${e}/download/bundle`, {
3685
3766
  query: {
3686
3767
  ...s && { versionTag: s },
3687
3768
  ...r && { withDraft: r }
@@ -3693,7 +3774,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3693
3774
  * @param appId - The app's unique identifier.
3694
3775
  */
3695
3776
  async archiveApp(e) {
3696
- return await c(this, d, m).call(this, "DELETE", `${g}/${e}`);
3777
+ return await h(this, f, w).call(this, "DELETE", `${b}/${e}`);
3697
3778
  }
3698
3779
  // ─── NPM Registry ────────────────────────────────────────────────
3699
3780
  /**
@@ -3705,7 +3786,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3705
3786
  * @returns The registry, scope, read-only token, and assembled `.npmrc`.
3706
3787
  */
3707
3788
  async getNpmCredentials() {
3708
- return await c(this, d, m).call(this, "GET", `${ur}/credentials`);
3789
+ return await h(this, f, w).call(this, "GET", `${mr}/credentials`);
3709
3790
  }
3710
3791
  // ─── Execution ───────────────────────────────────────────────────
3711
3792
  /**
@@ -3724,7 +3805,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3724
3805
  */
3725
3806
  async executeComponent(e, t, s) {
3726
3807
  if (this.localServerUrl) {
3727
- const r = `${this.localServerUrl}/api/${ne}/${e}/execute`, i = await fetch(r, {
3808
+ const r = `${this.localServerUrl}/api/${le}/${e}/execute`, i = await fetch(r, {
3728
3809
  method: "POST",
3729
3810
  headers: { "Content-Type": "application/json" },
3730
3811
  body: JSON.stringify(t)
@@ -3737,7 +3818,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3737
3818
  }
3738
3819
  return await i.json();
3739
3820
  }
3740
- return await c(this, d, m).call(this, "POST", `${ne}/${e}/execute`, {
3821
+ return await h(this, f, w).call(this, "POST", `${le}/${e}/execute`, {
3741
3822
  body: JSON.stringify(t),
3742
3823
  query: { ...s && { versionTag: s } },
3743
3824
  contentType: "application/json"
@@ -3749,7 +3830,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3749
3830
  */
3750
3831
  async abortExecution(e) {
3751
3832
  if (this.localServerUrl) {
3752
- const t = `${this.localServerUrl}/api/${ne}/progress/${e}/abort`, s = await fetch(t, { method: "POST" });
3833
+ const t = `${this.localServerUrl}/api/${le}/progress/${e}/abort`, s = await fetch(t, { method: "POST" });
3753
3834
  if (!s.ok) {
3754
3835
  const r = await s.text().catch(() => "");
3755
3836
  throw new Error(
@@ -3758,7 +3839,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3758
3839
  }
3759
3840
  return await s.json();
3760
3841
  }
3761
- return await c(this, d, m).call(this, "POST", `${ne}/progress/${e}/abort`);
3842
+ return await h(this, f, w).call(this, "POST", `${le}/progress/${e}/abort`);
3762
3843
  }
3763
3844
  /**
3764
3845
  * Lists all executions for a given component.
@@ -3775,7 +3856,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3775
3856
  */
3776
3857
  async listExecutions(e, t) {
3777
3858
  if (this.localServerUrl) {
3778
- const s = t ? `?projectId=${encodeURIComponent(t)}` : "", r = `${this.localServerUrl}/api/${ne}/${e}/progress${s}`, i = await fetch(r);
3859
+ const s = t ? `?projectId=${encodeURIComponent(t)}` : "", r = `${this.localServerUrl}/api/${le}/${e}/progress${s}`, i = await fetch(r);
3779
3860
  if (!i.ok) {
3780
3861
  const o = await i.text().catch(() => "");
3781
3862
  throw new Error(
@@ -3784,7 +3865,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3784
3865
  }
3785
3866
  return await i.json();
3786
3867
  }
3787
- return await c(this, d, m).call(this, "GET", `${ne}/${e}/progress`, { query: { ...t && { projectId: t } } });
3868
+ return await h(this, f, w).call(this, "GET", `${le}/${e}/progress`, { query: { ...t && { projectId: t } } });
3788
3869
  }
3789
3870
  /**
3790
3871
  * Gets details of a specific execution, including its messages.
@@ -3793,7 +3874,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3793
3874
  */
3794
3875
  async getExecution(e) {
3795
3876
  if (this.localServerUrl) {
3796
- const t = `${this.localServerUrl}/api/${ne}/progress/${e}`, s = await fetch(t);
3877
+ const t = `${this.localServerUrl}/api/${le}/progress/${e}`, s = await fetch(t);
3797
3878
  if (!s.ok) {
3798
3879
  const r = await s.text().catch(() => "");
3799
3880
  throw new Error(
@@ -3802,7 +3883,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3802
3883
  }
3803
3884
  return await s.json();
3804
3885
  }
3805
- return await c(this, d, m).call(this, "GET", `${ne}/progress/${e}`);
3886
+ return await h(this, f, w).call(this, "GET", `${le}/progress/${e}`);
3806
3887
  }
3807
3888
  /**
3808
3889
  * Subscribes to real-time execution progress via WebSocket.
@@ -3811,7 +3892,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3811
3892
  * @param onUpdateCallback - Callback invoked on each progress/result event.
3812
3893
  */
3813
3894
  async onExecutionProgress(e, t) {
3814
- const s = this.localServerUrl ?? this.wsUrl, r = await xe(s, {
3895
+ const s = this.localServerUrl ?? this.wsUrl, r = await Ke(s, {
3815
3896
  auth: { accessToken: this.accessToken },
3816
3897
  transports: ["websocket"]
3817
3898
  });
@@ -3830,7 +3911,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3830
3911
  * renderable views. See `src/core/documents.ts` for the model and schema.
3831
3912
  */
3832
3913
  documents(e) {
3833
- return new ks(this, e);
3914
+ return new Ms(this, e);
3834
3915
  }
3835
3916
  /**
3836
3917
  * A project's history of connected documents (Revit models, AutoCAD
@@ -3839,14 +3920,14 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3839
3920
  * or write it; the storage underneath is private and will move.
3840
3921
  */
3841
3922
  history(e) {
3842
- return new or(this, e);
3923
+ return new hr(this, e);
3843
3924
  }
3844
3925
  /**
3845
3926
  * The recipe registry and runner: scripts that write change requests in a
3846
3927
  * native application's language. See `src/core/recipes.ts`.
3847
3928
  */
3848
3929
  get recipes() {
3849
- return f(this, Be) ?? k(this, Be, new hr(this)), f(this, Be);
3930
+ return u(this, Ze) ?? R(this, Ze, new ur(this)), u(this, Ze);
3850
3931
  }
3851
3932
  // ─── Hidden Files ────────────────────────────────────────────────
3852
3933
  /**
@@ -3860,7 +3941,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3860
3941
  */
3861
3942
  async createHiddenFile(e, t, s) {
3862
3943
  const r = new FormData();
3863
- return r.append("file", e), r.append("parentItemId", t), s != null && r.append("tag", s), await c(this, d, m).call(this, "POST", `${g}/${K}`, {
3944
+ return r.append("file", e), r.append("parentItemId", t), s != null && r.append("tag", s), await h(this, f, w).call(this, "POST", `${b}/${re}`, {
3864
3945
  body: r
3865
3946
  });
3866
3947
  }
@@ -3878,7 +3959,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3878
3959
  const r = new FormData();
3879
3960
  for (const i of e)
3880
3961
  r.append("files", i);
3881
- return r.append("parentItemId", t), s != null && r.append("tag", s), await c(this, d, m).call(this, "POST", `${g}/${K}/batch`, {
3962
+ return r.append("parentItemId", t), s != null && r.append("tag", s), await h(this, f, w).call(this, "POST", `${b}/${re}/batch`, {
3882
3963
  body: r
3883
3964
  });
3884
3965
  }
@@ -3887,21 +3968,21 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3887
3968
  * @param hiddenId - The hidden file's unique identifier.
3888
3969
  */
3889
3970
  async deleteHiddenFile(e) {
3890
- return await c(this, d, m).call(this, "DELETE", `${g}/${K}/${e}`);
3971
+ return await h(this, f, w).call(this, "DELETE", `${b}/${re}/${e}`);
3891
3972
  }
3892
3973
  /**
3893
3974
  * Gets metadata for a hidden file.
3894
3975
  * @param hiddenId - The hidden file's unique identifier.
3895
3976
  */
3896
3977
  async getHiddenFile(e) {
3897
- return await c(this, d, m).call(this, "GET", `${g}/${K}/${e}`);
3978
+ return await h(this, f, w).call(this, "GET", `${b}/${re}/${e}`);
3898
3979
  }
3899
3980
  /**
3900
3981
  * Downloads a hidden file's content. Returns the raw fetch Response.
3901
3982
  * @param hiddenId - The hidden file's unique identifier.
3902
3983
  */
3903
3984
  async downloadHiddenFile(e) {
3904
- return await c(this, d, re).call(this, `${g}/${K}/${e}/download`);
3985
+ return await h(this, f, ue).call(this, `${b}/${re}/${e}/download`);
3905
3986
  }
3906
3987
  /**
3907
3988
  * Mints a short-lived presigned URL for a hidden file so the browser can
@@ -3921,7 +4002,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3921
4002
  * an ISO timestamp when it stops working.
3922
4003
  */
3923
4004
  async getHiddenFileSignedUrl(e, t) {
3924
- return await c(this, d, m).call(this, "GET", `${g}/${K}/${e}/signed-url`, { ...t != null && { query: { expiresIn: t } } });
4005
+ return await h(this, f, w).call(this, "GET", `${b}/${re}/${e}/signed-url`, { ...t != null && { query: { expiresIn: t } } });
3925
4006
  }
3926
4007
  /**
3927
4008
  * Batch variant of {@link getHiddenFileSignedUrl}. Mints presigned URLs for
@@ -3942,7 +4023,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3942
4023
  * 900 (15 min) server-side; values are clamped to that range.
3943
4024
  */
3944
4025
  async getHiddenFileSignedUrlsBatch(e, t) {
3945
- return await c(this, d, $e).call(this, e, async (s) => (await c(this, d, m).call(this, "POST", `${g}/${K}/signed-url/batch`, {
4026
+ return await h(this, f, ze).call(this, e, async (s) => (await h(this, f, w).call(this, "POST", `${b}/${re}/signed-url/batch`, {
3946
4027
  body: JSON.stringify({
3947
4028
  hiddenFileIds: s,
3948
4029
  ...t != null && { expiresIn: t }
@@ -3958,14 +4039,14 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3958
4039
  * @returns Array of hidden file entities.
3959
4040
  */
3960
4041
  async getHiddenFilesByParent(e, t) {
3961
- return await c(this, d, m).call(this, "GET", `${g}/${e}/${K}`, { ...t != null && { query: { tag: t } } });
4042
+ return await h(this, f, w).call(this, "GET", `${b}/${e}/${re}`, { ...t != null && { query: { tag: t } } });
3962
4043
  }
3963
4044
  /**
3964
4045
  * Deletes all hidden files attached to a parent item.
3965
4046
  * @param parentFileId - The parent item's unique identifier.
3966
4047
  */
3967
4048
  async deleteHiddenFilesByParent(e) {
3968
- return await c(this, d, m).call(this, "DELETE", `${g}/${e}/${K}`);
4049
+ return await h(this, f, w).call(this, "DELETE", `${b}/${e}/${re}`);
3969
4050
  }
3970
4051
  // ─── Icons ───────────────────────────────────────────────────────
3971
4052
  /**
@@ -3977,7 +4058,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3977
4058
  */
3978
4059
  async uploadItemIcon(e, t) {
3979
4060
  const s = new FormData();
3980
- return s.append("icon", t), await c(this, d, m).call(this, "PUT", `${g}/${e}/icon`, {
4061
+ return s.append("icon", t), await h(this, f, w).call(this, "PUT", `${b}/${e}/icon`, {
3981
4062
  body: s
3982
4063
  });
3983
4064
  }
@@ -3987,7 +4068,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3987
4068
  * @returns The raw Response (use `.blob()`, `.arrayBuffer()`, or pipe the body).
3988
4069
  */
3989
4070
  async getItemIcon(e) {
3990
- return await c(this, d, re).call(this, `${g}/${e}/icon`);
4071
+ return await h(this, f, ue).call(this, `${b}/${e}/icon`);
3991
4072
  }
3992
4073
  /**
3993
4074
  * Removes the icon from an item.
@@ -3995,7 +4076,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3995
4076
  * @returns The updated item with icon fields removed.
3996
4077
  */
3997
4078
  async removeItemIcon(e) {
3998
- return await c(this, d, m).call(this, "DELETE", `${g}/${e}/icon`);
4079
+ return await h(this, f, w).call(this, "DELETE", `${b}/${e}/icon`);
3999
4080
  }
4000
4081
  // ─── General Item Operations ─────────────────────────────────────
4001
4082
  /**
@@ -4005,7 +4086,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
4005
4086
  * @returns The updated item.
4006
4087
  */
4007
4088
  async updateItem(e, t) {
4008
- return await c(this, d, m).call(this, "PUT", `${g}/${e}`, {
4089
+ return await h(this, f, w).call(this, "PUT", `${b}/${e}`, {
4009
4090
  body: JSON.stringify(t),
4010
4091
  contentType: "application/json"
4011
4092
  });
@@ -4022,7 +4103,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
4022
4103
  */
4023
4104
  async createVersion(e, t, s, r, i) {
4024
4105
  const o = new FormData();
4025
- return o.append("file", t), o.append("versionTag", s), r && o.append("extraProps", JSON.stringify(r)), i && o.append("metadata", JSON.stringify(i)), await c(this, d, m).call(this, "POST", `${g}/${e}/version`, { body: o });
4106
+ return o.append("file", t), o.append("versionTag", s), r && o.append("extraProps", JSON.stringify(r)), i && o.append("metadata", JSON.stringify(i)), await h(this, f, w).call(this, "POST", `${b}/${e}/version`, { body: o });
4026
4107
  }
4027
4108
  /**
4028
4109
  * Lists versions of an item. Pass `archived: true` to fetch only archived
@@ -4032,7 +4113,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
4032
4113
  * @returns Array of versions, sorted by creation date descending.
4033
4114
  */
4034
4115
  async listVersions(e, t = {}) {
4035
- return await c(this, d, m).call(this, "GET", `${g}/${encodeURIComponent(e)}/versions`, { query: t });
4116
+ return await h(this, f, w).call(this, "GET", `${b}/${encodeURIComponent(e)}/versions`, { query: t });
4036
4117
  }
4037
4118
  /**
4038
4119
  * Batch variant of {@link listVersions}. Lists the versions of many items in
@@ -4051,7 +4132,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
4051
4132
  */
4052
4133
  async listVersionsBatch(e, t = {}) {
4053
4134
  const { archived: s } = t;
4054
- return await c(this, d, $e).call(this, e, async (r) => (await c(this, d, m).call(this, "POST", `${g}/batch/versions`, {
4135
+ return await h(this, f, ze).call(this, e, async (r) => (await h(this, f, w).call(this, "POST", `${b}/batch/versions`, {
4055
4136
  body: JSON.stringify({
4056
4137
  itemIds: r,
4057
4138
  ...s !== void 0 && { archived: s }
@@ -4069,7 +4150,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
4069
4150
  * @returns The archived version.
4070
4151
  */
4071
4152
  async archiveVersion(e, t) {
4072
- return await c(this, d, m).call(this, "PUT", `${g}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/archive`);
4153
+ return await h(this, f, w).call(this, "PUT", `${b}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/archive`);
4073
4154
  }
4074
4155
  /**
4075
4156
  * Recovers a previously archived version, restoring it to the active list.
@@ -4078,7 +4159,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
4078
4159
  * @returns The recovered version.
4079
4160
  */
4080
4161
  async recoverVersion(e, t) {
4081
- return await c(this, d, m).call(this, "PUT", `${g}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/recover`);
4162
+ return await h(this, f, w).call(this, "PUT", `${b}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/recover`);
4082
4163
  }
4083
4164
  /**
4084
4165
  * Permanently deletes a version, including its file in object storage.
@@ -4087,54 +4168,54 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
4087
4168
  * @param versionTag - The version's tag (e.g. "v2").
4088
4169
  */
4089
4170
  async deleteVersion(e, t) {
4090
- return await c(this, d, m).call(this, "DELETE", `${g}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}`);
4171
+ return await h(this, f, w).call(this, "DELETE", `${b}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}`);
4091
4172
  }
4092
4173
  };
4093
- d = new WeakSet(), It = function(e) {
4174
+ f = new WeakSet(), Gt = function(e) {
4094
4175
  return `${this.apiUrl}/${e}`;
4095
- }, m = async function(e, t, s) {
4096
- const { body: r, query: i, contentType: o, retries: a, responseType: l, retryAttempt: u } = s || {}, h = c(this, d, It).call(this, t), y = c(this, d, Ns).call(this, i), w = await this.resolveAccessToken(), I = {
4097
- ...y,
4098
- ...this.useBearer ? {} : { accessToken: w }
4176
+ }, w = async function(e, t, s) {
4177
+ const { body: r, query: i, contentType: o, retries: a, responseType: l, retryAttempt: d } = s || {}, c = h(this, f, Gt).call(this, t), m = h(this, f, zs).call(this, i), T = await this.resolveAccessToken(), A = {
4178
+ ...m,
4179
+ ...this.useBearer ? {} : { accessToken: T }
4099
4180
  };
4100
4181
  try {
4101
- const T = await fetch(
4102
- h + "?" + new URLSearchParams(I).toString(),
4182
+ const _ = await fetch(
4183
+ c + "?" + new URLSearchParams(A).toString(),
4103
4184
  {
4104
4185
  method: e,
4105
4186
  headers: {
4106
4187
  Accept: "application/json",
4107
4188
  ...o && { "Content-Type": o },
4108
- ...this.useBearer && { Authorization: `Bearer ${w}` }
4189
+ ...this.useBearer && { Authorization: `Bearer ${T}` }
4109
4190
  },
4110
4191
  ...r && { body: r }
4111
4192
  }
4112
4193
  );
4113
- if (!T.ok) {
4114
- const S = await T.text().then((x) => x).catch(() => "");
4115
- throw new Lt(
4116
- T.status,
4117
- T.statusText,
4118
- S,
4119
- yr(T)
4194
+ if (!_.ok) {
4195
+ const E = await _.text().then((N) => N).catch(() => "");
4196
+ throw new rs(
4197
+ _.status,
4198
+ _.statusText,
4199
+ E,
4200
+ br(_)
4120
4201
  );
4121
4202
  }
4122
- return l === "blob" ? await T.blob() : T.json().then((S) => S).catch(() => {
4203
+ return l === "blob" ? await _.blob() : _.json().then((E) => E).catch(() => {
4123
4204
  });
4124
- } catch (T) {
4125
- const S = a ?? this.retries;
4126
- if (S > 0 && gr(T)) {
4127
- const x = u ?? 0;
4128
- return await mr(wr(T, x)), await c(this, d, m).call(this, e, t, {
4205
+ } catch (_) {
4206
+ const E = a ?? this.retries;
4207
+ if (E > 0 && vr(_)) {
4208
+ const N = d ?? 0;
4209
+ return await wr(Er(_, N)), await h(this, f, w).call(this, e, t, {
4129
4210
  ...s,
4130
- retries: S - 1,
4131
- retryAttempt: x + 1
4211
+ retries: E - 1,
4212
+ retryAttempt: N + 1
4132
4213
  });
4133
4214
  }
4134
- throw T;
4215
+ throw _;
4135
4216
  }
4136
- }, re = async function(e, t) {
4137
- const { query: s } = t || {}, r = c(this, d, It).call(this, e), i = await this.resolveAccessToken(), o = {
4217
+ }, ue = async function(e, t) {
4218
+ const { query: s } = t || {}, r = h(this, f, Gt).call(this, e), i = await this.resolveAccessToken(), o = {
4138
4219
  ...s,
4139
4220
  ...this.useBearer ? {} : { accessToken: i }
4140
4221
  };
@@ -4147,58 +4228,58 @@ d = new WeakSet(), It = function(e) {
4147
4228
  }
4148
4229
  }
4149
4230
  );
4150
- }, Be = new WeakMap(), $e = async function(e, t) {
4231
+ }, Ze = new WeakMap(), ze = async function(e, t) {
4151
4232
  if (!e.length) return [];
4152
4233
  const s = [];
4153
- for (let i = 0; i < e.length; i += ns)
4154
- s.push(e.slice(i, i + ns));
4234
+ for (let i = 0; i < e.length; i += vs)
4235
+ s.push(e.slice(i, i + vs));
4155
4236
  return (await Promise.all(s.map(t))).flat();
4156
- }, We = async function(e, t) {
4237
+ }, mt = async function(e, t) {
4157
4238
  const { versionTag: s, withDraft: r } = t || {};
4158
- return await c(this, d, re).call(this, `${g}/${e}/download`, {
4239
+ return await h(this, f, ue).call(this, `${b}/${e}/download`, {
4159
4240
  query: {
4160
4241
  ...s && { versionTag: s },
4161
4242
  ...r && { withDraft: r }
4162
4243
  }
4163
4244
  });
4164
- }, Ye = async function(e, t, s) {
4165
- const { name: r, versionTag: i, parentFolderId: o, projectId: a, file: l, metadata: u } = e, h = new FormData();
4166
- return h.append("file", l), h.append("name", r), h.append("versionTag", i), h.append("itemType", t), o && h.append("folderId", o), a && h.append("projectId", a), s && h.append("extraProps", JSON.stringify(s)), u && h.append("metadata", JSON.stringify(u)), await c(this, d, m).call(this, "POST", g, {
4167
- body: h
4245
+ }, yt = async function(e, t, s) {
4246
+ const { name: r, versionTag: i, parentFolderId: o, projectId: a, file: l, metadata: d } = e, c = new FormData();
4247
+ return c.append("file", l), c.append("name", r), c.append("versionTag", i), c.append("itemType", t), o && c.append("folderId", o), a && c.append("projectId", a), s && c.append("extraProps", JSON.stringify(s)), d && c.append("metadata", JSON.stringify(d)), await h(this, f, w).call(this, "POST", b, {
4248
+ body: c
4168
4249
  });
4169
- }, St = async function(e, t, s) {
4250
+ }, Jt = async function(e, t, s) {
4170
4251
  const { name: r, versionTag: i, parentFolderId: o, file: a, metadata: l } = t;
4171
- let u, h;
4252
+ let d, c;
4172
4253
  if (a) {
4173
- const y = new FormData();
4174
- y.append("file", a), i && y.append("versionTag", i), s && y.append("extraProps", JSON.stringify(s)), l && y.append("metadata", JSON.stringify(l)), h = await c(this, d, m).call(this, "POST", `${g}/${e}/version`, {
4175
- body: y
4254
+ const m = new FormData();
4255
+ m.append("file", a), i && m.append("versionTag", i), s && m.append("extraProps", JSON.stringify(s)), l && m.append("metadata", JSON.stringify(l)), c = await h(this, f, w).call(this, "POST", `${b}/${e}/version`, {
4256
+ body: m
4176
4257
  });
4177
4258
  }
4178
4259
  if (r || o) {
4179
- const y = {
4260
+ const m = {
4180
4261
  ...r && { name: r },
4181
4262
  ...o && { folderId: o }
4182
- }, w = JSON.stringify(y);
4183
- u = await c(this, d, m).call(this, "PUT", `${g}/${e}`, {
4184
- body: w,
4263
+ }, T = JSON.stringify(m);
4264
+ d = await h(this, f, w).call(this, "PUT", `${b}/${e}`, {
4265
+ body: T,
4185
4266
  contentType: "application/json"
4186
4267
  });
4187
4268
  }
4188
- return { item: u, version: h };
4189
- }, kt = async function(e, t) {
4269
+ return { item: d, version: c };
4270
+ }, Wt = async function(e, t) {
4190
4271
  const { showVersions: s = !1 } = t || {};
4191
- return await c(this, d, m).call(this, "GET", `${g}/${e}`, {
4272
+ return await h(this, f, w).call(this, "GET", `${b}/${e}`, {
4192
4273
  query: { showVersions: s }
4193
4274
  });
4194
- }, Ns = function(e) {
4275
+ }, zs = function(e) {
4195
4276
  return e && Object.entries(e).filter(([, t]) => t !== void 0).reduce(
4196
4277
  (t, [s, r]) => (t[s] = r, t),
4197
4278
  {}
4198
4279
  );
4199
4280
  };
4200
- let Tt = qt;
4201
- function br() {
4281
+ let Ht = is;
4282
+ function Tr() {
4202
4283
  if (typeof window > "u" || window.parent === window)
4203
4284
  throw new Error(
4204
4285
  "client.channel only works inside a That Open app, which runs in an iframe of the platform."
@@ -4213,80 +4294,80 @@ function br() {
4213
4294
  }
4214
4295
  };
4215
4296
  }
4216
- const Ot = "channel:", vr = 1e4;
4217
- function Ke(n) {
4297
+ const Yt = "channel:", _r = 1e4;
4298
+ function gt(n) {
4218
4299
  try {
4219
4300
  n();
4220
4301
  } catch (e) {
4221
4302
  console.error("[channel] a listener threw:", e);
4222
4303
  }
4223
4304
  }
4224
- var Q, F, L, Ee, _e, Te, P, At, Rt, ve;
4225
- class Ps {
4305
+ var ae, U, M, xe, Ne, Pe, L, zt, Kt, $e;
4306
+ class Ks {
4226
4307
  constructor(e, t) {
4227
- _(this, P);
4228
- _(this, Q, !1);
4229
- _(this, F, []);
4230
- _(this, L, []);
4231
- _(this, Ee, /* @__PURE__ */ new Set());
4232
- _(this, _e, /* @__PURE__ */ new Set());
4233
- _(this, Te, /* @__PURE__ */ new Set());
4308
+ S(this, L);
4309
+ S(this, ae, !1);
4310
+ S(this, U, []);
4311
+ S(this, M, []);
4312
+ S(this, xe, /* @__PURE__ */ new Set());
4313
+ S(this, Ne, /* @__PURE__ */ new Set());
4314
+ S(this, Pe, /* @__PURE__ */ new Set());
4234
4315
  this.transport = e, this.controls = t;
4235
4316
  }
4236
4317
  /** Whether the platform has confirmed this tab is in the room. */
4237
4318
  get joined() {
4238
- return f(this, Q);
4319
+ return u(this, ae);
4239
4320
  }
4240
4321
  /** Who else is in the room right now, as the platform last reported. */
4241
4322
  get peers() {
4242
- return f(this, F);
4323
+ return u(this, U);
4243
4324
  }
4244
4325
  /**
4245
4326
  * Enters the room. Resolves when the platform confirms; rejects if it
4246
4327
  * refuses or does not answer in time. Joining twice is harmless.
4247
4328
  */
4248
4329
  join() {
4249
- return f(this, Q) ? Promise.resolve() : c(this, P, At).call(this, "joined", this.controls.join);
4330
+ return u(this, ae) ? Promise.resolve() : h(this, L, zt).call(this, "joined", this.controls.join);
4250
4331
  }
4251
4332
  /** Leaves the room. Handlers stay registered, so `join()` resumes them. */
4252
4333
  leave() {
4253
- return !f(this, Q) && !f(this, L).some((e) => e.want === "joined") ? Promise.resolve() : c(this, P, At).call(this, "left", this.controls.leave);
4334
+ return !u(this, ae) && !u(this, M).some((e) => e.want === "joined") ? Promise.resolve() : h(this, L, zt).call(this, "left", this.controls.leave);
4254
4335
  }
4255
4336
  /** Fires when `joined` or `peers` changes. Returns a function that stops it. */
4256
4337
  onChange(e) {
4257
- return f(this, Ee).add(e), () => void f(this, Ee).delete(e);
4338
+ return u(this, xe).add(e), () => void u(this, xe).delete(e);
4258
4339
  }
4259
4340
  onPeerJoined(e) {
4260
- return f(this, _e).add(e), () => void f(this, _e).delete(e);
4341
+ return u(this, Ne).add(e), () => void u(this, Ne).delete(e);
4261
4342
  }
4262
4343
  onPeerLeft(e) {
4263
- return f(this, Te).add(e), () => void f(this, Te).delete(e);
4344
+ return u(this, Pe).add(e), () => void u(this, Pe).delete(e);
4264
4345
  }
4265
4346
  /** @internal */
4266
4347
  applyJoined() {
4267
- k(this, Q, !0), c(this, P, Rt).call(this, "joined"), c(this, P, ve).call(this);
4348
+ R(this, ae, !0), h(this, L, Kt).call(this, "joined"), h(this, L, $e).call(this);
4268
4349
  }
4269
4350
  /** @internal */
4270
4351
  applyLeft() {
4271
- k(this, Q, !1), k(this, F, []), c(this, P, Rt).call(this, "left"), c(this, P, ve).call(this);
4352
+ R(this, ae, !1), R(this, U, []), h(this, L, Kt).call(this, "left"), h(this, L, $e).call(this);
4272
4353
  }
4273
4354
  /** @internal */
4274
4355
  applyPeers(e) {
4275
- k(this, F, e), c(this, P, ve).call(this);
4356
+ R(this, U, e), h(this, L, $e).call(this);
4276
4357
  }
4277
4358
  /** @internal */
4278
4359
  applyPeerJoined(e) {
4279
- !f(this, Q) || f(this, F).some((t) => t.from === e.from) || (k(this, F, [...f(this, F), e]), f(this, _e).forEach((t) => Ke(() => t(e))), c(this, P, ve).call(this));
4360
+ !u(this, ae) || u(this, U).some((t) => t.from === e.from) || (R(this, U, [...u(this, U), e]), u(this, Ne).forEach((t) => gt(() => t(e))), h(this, L, $e).call(this));
4280
4361
  }
4281
4362
  /** @internal */
4282
4363
  applyPeerLeft(e) {
4283
- const t = f(this, F).find((s) => s.from === e);
4284
- t && (k(this, F, f(this, F).filter((s) => s.from !== e)), f(this, Te).forEach((s) => Ke(() => s(t))), c(this, P, ve).call(this));
4364
+ const t = u(this, U).find((s) => s.from === e);
4365
+ t && (R(this, U, u(this, U).filter((s) => s.from !== e)), u(this, Pe).forEach((s) => gt(() => s(t))), h(this, L, $e).call(this));
4285
4366
  }
4286
4367
  /** @internal */
4287
4368
  failPending(e) {
4288
- const t = f(this, L);
4289
- return k(this, L, []), t.forEach((s) => {
4369
+ const t = u(this, M);
4370
+ return R(this, M, []), t.forEach((s) => {
4290
4371
  clearTimeout(s.timer), s.reject(e);
4291
4372
  }), t.length > 0;
4292
4373
  }
@@ -4294,77 +4375,77 @@ class Ps {
4294
4375
  this.transport.post(e);
4295
4376
  }
4296
4377
  }
4297
- Q = new WeakMap(), F = new WeakMap(), L = new WeakMap(), Ee = new WeakMap(), _e = new WeakMap(), Te = new WeakMap(), P = new WeakSet(), At = function(e, t) {
4378
+ ae = new WeakMap(), U = new WeakMap(), M = new WeakMap(), xe = new WeakMap(), Ne = new WeakMap(), Pe = new WeakMap(), L = new WeakSet(), zt = function(e, t) {
4298
4379
  return new Promise((s, r) => {
4299
4380
  const i = {
4300
4381
  want: e,
4301
4382
  resolve: s,
4302
4383
  reject: r,
4303
4384
  timer: setTimeout(() => {
4304
- k(this, L, f(this, L).filter((o) => o !== i)), r(
4385
+ R(this, M, u(this, M).filter((o) => o !== i)), r(
4305
4386
  new Error(
4306
4387
  `The platform did not confirm ${e === "joined" ? "joining" : "leaving"} in time.`
4307
4388
  )
4308
4389
  );
4309
- }, vr)
4390
+ }, _r)
4310
4391
  };
4311
- f(this, L).push(i), this.transport.post({ type: "APP_CHANNEL_CONTROL", ...t });
4392
+ u(this, M).push(i), this.transport.post({ type: "APP_CHANNEL_CONTROL", ...t });
4312
4393
  });
4313
- }, Rt = function(e) {
4314
- const t = f(this, L).filter((s) => s.want === e);
4315
- k(this, L, f(this, L).filter((s) => s.want !== e)), t.forEach((s) => {
4394
+ }, Kt = function(e) {
4395
+ const t = u(this, M).filter((s) => s.want === e);
4396
+ R(this, M, u(this, M).filter((s) => s.want !== e)), t.forEach((s) => {
4316
4397
  clearTimeout(s.timer), s.resolve();
4317
4398
  });
4318
- }, ve = function() {
4319
- f(this, Ee).forEach((e) => Ke(e));
4399
+ }, $e = function() {
4400
+ u(this, xe).forEach((e) => gt(e));
4320
4401
  };
4321
- var Ie;
4322
- class Er extends Ps {
4402
+ var Be;
4403
+ class Ir extends Ks {
4323
4404
  /** @internal Use `client.channel.collab()`. */
4324
4405
  constructor(t) {
4325
4406
  super(t, {
4326
4407
  join: { action: "joinCollab" },
4327
4408
  leave: { action: "leaveCollab" }
4328
4409
  });
4329
- _(this, Ie, /* @__PURE__ */ new Map());
4410
+ S(this, Be, /* @__PURE__ */ new Map());
4330
4411
  }
4331
4412
  /**
4332
4413
  * Listens for an event other tabs send. Any number of listeners per event.
4333
4414
  * @returns a function that removes the listener.
4334
4415
  */
4335
4416
  on(t, s) {
4336
- const r = f(this, Ie).get(t) ?? /* @__PURE__ */ new Set();
4337
- return r.add(s), f(this, Ie).set(t, r), () => void r.delete(s);
4417
+ const r = u(this, Be).get(t) ?? /* @__PURE__ */ new Set();
4418
+ return r.add(s), u(this, Be).set(t, r), () => void r.delete(s);
4338
4419
  }
4339
4420
  /**
4340
4421
  * Sends an event to the other tabs in the room. Does nothing while this tab
4341
4422
  * is not in it, matching what the platform does with a message from outside.
4342
4423
  */
4343
4424
  send(t, s) {
4344
- if (t.startsWith(Ot))
4345
- throw new Error(`Message types starting with '${Ot}' are reserved.`);
4425
+ if (t.startsWith(Yt))
4426
+ throw new Error(`Message types starting with '${Yt}' are reserved.`);
4346
4427
  this.joined && this.post({ type: "APP_CHANNEL_PUBLISH", message: { type: t, payload: s } });
4347
4428
  }
4348
4429
  accepts(t) {
4349
4430
  return t === void 0 || t === "collab";
4350
4431
  }
4351
4432
  async handle(t) {
4352
- const s = f(this, Ie).get(t.type);
4433
+ const s = u(this, Be).get(t.type);
4353
4434
  if (!(s != null && s.size)) return { handled: !1 };
4354
- const r = Bs(t);
4355
- return s.forEach((i) => Ke(() => i(t.payload, r))), { handled: !0 };
4435
+ const r = Xs(t);
4436
+ return s.forEach((i) => gt(() => i(t.payload, r))), { handled: !0 };
4356
4437
  }
4357
4438
  }
4358
- Ie = new WeakMap();
4359
- var oe;
4360
- class _r extends Ps {
4439
+ Be = new WeakMap();
4440
+ var pe;
4441
+ class Sr extends Ks {
4361
4442
  /** @internal Use `client.channel.external(kind)`. */
4362
4443
  constructor(t, s) {
4363
4444
  super(t, {
4364
4445
  join: { action: "joinExternal", kind: s },
4365
4446
  leave: { action: "leaveExternal", kind: s }
4366
4447
  });
4367
- _(this, oe, /* @__PURE__ */ new Map());
4448
+ S(this, pe, /* @__PURE__ */ new Map());
4368
4449
  this.kind = s;
4369
4450
  }
4370
4451
  /**
@@ -4378,24 +4459,24 @@ class _r extends Ps {
4378
4459
  * @returns a function that removes the handler.
4379
4460
  */
4380
4461
  on(t, s) {
4381
- if (f(this, oe).has(t))
4462
+ if (u(this, pe).has(t))
4382
4463
  throw new Error(
4383
4464
  `"${t}" already has a handler in this room. Remove it first.`
4384
4465
  );
4385
- return f(this, oe).set(t, s), () => void f(this, oe).delete(t);
4466
+ return u(this, pe).set(t, s), () => void u(this, pe).delete(t);
4386
4467
  }
4387
4468
  accepts(t, s) {
4388
4469
  return t !== void 0 && t !== "external" ? !1 : this.kind === void 0 || t === void 0 || this.kind === s;
4389
4470
  }
4390
4471
  /** @internal Whether this room has any handler at all. */
4391
4472
  get hasHandlers() {
4392
- return f(this, oe).size > 0;
4473
+ return u(this, pe).size > 0;
4393
4474
  }
4394
4475
  async handle(t) {
4395
- const s = f(this, oe).get(t.type);
4476
+ const s = u(this, pe).get(t.type);
4396
4477
  if (!s) return { handled: !1 };
4397
4478
  try {
4398
- return { handled: !0, value: await s(t.payload, Bs(t)) };
4479
+ return { handled: !0, value: await s(t.payload, Xs(t)) };
4399
4480
  } catch (r) {
4400
4481
  return {
4401
4482
  handled: !0,
@@ -4404,8 +4485,8 @@ class _r extends Ps {
4404
4485
  }
4405
4486
  }
4406
4487
  }
4407
- oe = new WeakMap();
4408
- function Bs(n) {
4488
+ pe = new WeakMap();
4489
+ function Xs(n) {
4409
4490
  return {
4410
4491
  from: n.from,
4411
4492
  at: n.at,
@@ -4413,7 +4494,7 @@ function Bs(n) {
4413
4494
  kind: n.kind
4414
4495
  };
4415
4496
  }
4416
- function Tr(n) {
4497
+ function kr(n) {
4417
4498
  const e = n;
4418
4499
  if ((e == null ? void 0 : e.type) !== "THATOPEN_CHANNEL_MESSAGE") return null;
4419
4500
  const t = e.message;
@@ -4427,20 +4508,20 @@ function Tr(n) {
4427
4508
  kind: typeof t.kind == "string" ? t.kind : void 0
4428
4509
  };
4429
4510
  }
4430
- var ue, Fe, Z, ae, ce, R, Ct, ze, Fs, Ls, qs, $t;
4431
- class Ir {
4511
+ var Se, et, ce, me, ye, $, Xt, wt, Qs, Zs, en, Qt;
4512
+ class Or {
4432
4513
  constructor(e) {
4433
- _(this, R);
4434
- _(this, ue);
4435
- _(this, Fe);
4436
- _(this, Z);
4437
- _(this, ae, /* @__PURE__ */ new Map());
4438
- _(this, ce, /* @__PURE__ */ new Set());
4439
- k(this, ue, e), k(this, Fe, e.listen((t) => void c(this, R, Fs).call(this, t)));
4514
+ S(this, $);
4515
+ S(this, Se);
4516
+ S(this, et);
4517
+ S(this, ce);
4518
+ S(this, me, /* @__PURE__ */ new Map());
4519
+ S(this, ye, /* @__PURE__ */ new Set());
4520
+ R(this, Se, e), R(this, et, e.listen((t) => void h(this, $, Qs).call(this, t)));
4440
4521
  }
4441
4522
  /** The collaboration room for this app. Always the same instance. */
4442
4523
  collab() {
4443
- return f(this, Z) ?? k(this, Z, new Er(f(this, ue))), f(this, Z);
4524
+ return u(this, ce) ?? R(this, ce, new Ir(u(this, Se))), u(this, ce);
4444
4525
  }
4445
4526
  /**
4446
4527
  * The room for commands from this account's external tools of one `kind`
@@ -4449,46 +4530,46 @@ class Ir {
4449
4530
  */
4450
4531
  external(e) {
4451
4532
  const t = e ?? "";
4452
- let s = f(this, ae).get(t);
4453
- return s || (s = new _r(f(this, ue), e), f(this, ae).set(t, s)), s;
4533
+ let s = u(this, me).get(t);
4534
+ return s || (s = new Sr(u(this, Se), e), u(this, me).set(t, s)), s;
4454
4535
  }
4455
4536
  /** Stops listening. For tests and teardown; an app normally never calls it. */
4456
4537
  dispose() {
4457
- f(this, Fe).call(this);
4538
+ u(this, et).call(this);
4458
4539
  }
4459
4540
  }
4460
- ue = new WeakMap(), Fe = new WeakMap(), Z = new WeakMap(), ae = new WeakMap(), ce = new WeakMap(), R = new WeakSet(), Ct = function() {
4461
- return [...f(this, Z) ? [f(this, Z)] : [], ...f(this, ae).values()];
4462
- }, ze = function(e, t) {
4463
- if (e === "collab") return f(this, Z);
4541
+ Se = new WeakMap(), et = new WeakMap(), ce = new WeakMap(), me = new WeakMap(), ye = new WeakMap(), $ = new WeakSet(), Xt = function() {
4542
+ return [...u(this, ce) ? [u(this, ce)] : [], ...u(this, me).values()];
4543
+ }, wt = function(e, t) {
4544
+ if (e === "collab") return u(this, ce);
4464
4545
  if (e === "external")
4465
- return f(this, ae).get(typeof t == "string" ? t : "");
4466
- }, Fs = async function(e) {
4467
- const t = Tr(e);
4546
+ return u(this, me).get(typeof t == "string" ? t : "");
4547
+ }, Qs = async function(e) {
4548
+ const t = kr(e);
4468
4549
  if (t) {
4469
- if (t.type.startsWith(Ot)) {
4470
- c(this, R, Ls).call(this, t);
4550
+ if (t.type.startsWith(Yt)) {
4551
+ h(this, $, Zs).call(this, t);
4471
4552
  return;
4472
4553
  }
4473
- await c(this, R, qs).call(this, t);
4554
+ await h(this, $, en).call(this, t);
4474
4555
  }
4475
- }, Ls = function(e) {
4556
+ }, Zs = function(e) {
4476
4557
  var s, r, i;
4477
4558
  const t = e.payload ?? {};
4478
4559
  switch (e.type) {
4479
4560
  case "channel:joined":
4480
- (s = c(this, R, ze).call(this, t.scope, t.kind)) == null || s.applyJoined();
4561
+ (s = h(this, $, wt).call(this, t.scope, t.kind)) == null || s.applyJoined();
4481
4562
  break;
4482
4563
  case "channel:left":
4483
- (r = c(this, R, ze).call(this, t.scope, t.kind)) == null || r.applyLeft();
4564
+ (r = h(this, $, wt).call(this, t.scope, t.kind)) == null || r.applyLeft();
4484
4565
  break;
4485
4566
  case "channel:peers":
4486
- (i = c(this, R, ze).call(this, t.scope, t.kind)) == null || i.applyPeers(t.peers ?? []);
4567
+ (i = h(this, $, wt).call(this, t.scope, t.kind)) == null || i.applyPeers(t.peers ?? []);
4487
4568
  break;
4488
4569
  case "channel:peer-joined":
4489
4570
  case "channel:peer-left": {
4490
4571
  if (!t.from) break;
4491
- const o = t.scope === "collab" ? [f(this, Z)] : [...f(this, ae).values()].filter(
4572
+ const o = t.scope === "collab" ? [u(this, ce)] : [...u(this, me).values()].filter(
4492
4573
  (a) => a.accepts("external", t.kind)
4493
4574
  );
4494
4575
  for (const a of o)
@@ -4497,23 +4578,23 @@ ue = new WeakMap(), Fe = new WeakMap(), Z = new WeakMap(), ae = new WeakMap(), c
4497
4578
  }
4498
4579
  case "channel:error": {
4499
4580
  const o = new Error(String(e.payload));
4500
- c(this, R, Ct).call(this).map((l) => l.failPending(o)).some(Boolean) || console.error("[channel] error:", e.payload);
4581
+ h(this, $, Xt).call(this).map((l) => l.failPending(o)).some(Boolean) || console.error("[channel] error:", e.payload);
4501
4582
  break;
4502
4583
  }
4503
4584
  }
4504
- }, qs = async function(e) {
4505
- const t = c(this, R, Ct).call(this).filter((i) => i.accepts(e.scope, e.kind));
4585
+ }, en = async function(e) {
4586
+ const t = h(this, $, Xt).call(this).filter((i) => i.accepts(e.scope, e.kind));
4506
4587
  let s = !1;
4507
4588
  for (const i of t) {
4508
4589
  const o = await i.handle(e);
4509
- o.handled && (s = !0, e.requestId && c(this, R, $t).call(this, e.requestId, o));
4590
+ o.handled && (s = !0, e.requestId && h(this, $, Qt).call(this, e.requestId, o));
4510
4591
  }
4511
- e.requestId && e.scope === "external" && t.length > 0 && !s && c(this, R, $t).call(this, e.requestId, {
4592
+ e.requestId && e.scope === "external" && t.length > 0 && !s && h(this, $, Qt).call(this, e.requestId, {
4512
4593
  handled: !0,
4513
4594
  error: `No handler for "${e.type}".`
4514
4595
  });
4515
- }, $t = function(e, t) {
4516
- f(this, ce).has(e) || (f(this, ce).add(e), f(this, ce).size > 500 && f(this, ce).delete(f(this, ce).values().next().value), f(this, ue).post({
4596
+ }, Qt = function(e, t) {
4597
+ u(this, ye).has(e) || (u(this, ye).add(e), u(this, ye).size > 500 && u(this, ye).delete(u(this, ye).values().next().value), u(this, Se).post({
4517
4598
  type: "APP_CHANNEL_PUBLISH",
4518
4599
  message: {
4519
4600
  type: t.error === void 0 ? "reply" : "reply-error",
@@ -4522,9 +4603,9 @@ ue = new WeakMap(), Fe = new WeakMap(), Z = new WeakMap(), ae = new WeakMap(), c
4522
4603
  }
4523
4604
  }));
4524
4605
  };
4525
- const de = "project", me = "notifications";
4526
- var Se, Le;
4527
- const jt = class jt extends Tt {
4606
+ const Ie = "project", Ae = "notifications";
4607
+ var Le, tt;
4608
+ const os = class os extends Ht {
4528
4609
  /**
4529
4610
  * @param token - A bearer JWT, OR a function returning the current JWT
4530
4611
  * (sync or async). When a function is passed, it's invoked before every
@@ -4535,12 +4616,12 @@ const jt = class jt extends Tt {
4535
4616
  */
4536
4617
  constructor(t, s, r) {
4537
4618
  super(typeof t == "string" ? t : "", s, { ...r, useBearer: !0 });
4538
- _(this, Se);
4539
- _(this, Le);
4540
- typeof t == "function" && k(this, Se, t);
4619
+ S(this, Le);
4620
+ S(this, tt);
4621
+ typeof t == "function" && R(this, Le, t);
4541
4622
  }
4542
4623
  async resolveAccessToken() {
4543
- return f(this, Se) ? await f(this, Se).call(this) : super.resolveAccessToken();
4624
+ return u(this, Le) ? await u(this, Le).call(this) : super.resolveAccessToken();
4544
4625
  }
4545
4626
  /**
4546
4627
  * Creates a client from the platform context injected into
@@ -4549,7 +4630,7 @@ const jt = class jt extends Tt {
4549
4630
  * carries a fresh JWT on every navigation.
4550
4631
  */
4551
4632
  static fromPlatformContext(t) {
4552
- const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, r = new jt(s.accessToken, s.apiUrl, t);
4633
+ const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, r = new os(s.accessToken, s.apiUrl, t);
4553
4634
  return r.context = s, r;
4554
4635
  }
4555
4636
  /**
@@ -4577,7 +4658,7 @@ const jt = class jt extends Tt {
4577
4658
  * ```
4578
4659
  */
4579
4660
  get channel() {
4580
- return f(this, Le) ?? k(this, Le, new Ir(br())), f(this, Le);
4661
+ return u(this, tt) ?? R(this, tt, new Or(Tr())), u(this, tt);
4581
4662
  }
4582
4663
  // ─── Projects (JWT-only backend routes) ──────────────────────────
4583
4664
  /**
@@ -4596,14 +4677,14 @@ const jt = class jt extends Tt {
4596
4677
  * ```
4597
4678
  */
4598
4679
  async listProjects() {
4599
- return await this.request("GET", de);
4680
+ return await this.request("GET", Ie);
4600
4681
  }
4601
4682
  /**
4602
4683
  * Gets a project by ID. JWT-only — lives here because
4603
4684
  * `GET /project/:id` is guarded by `AccountActiveGuard + ProjectAccessGuard`.
4604
4685
  */
4605
4686
  async getProject(t) {
4606
- return await this.request("GET", `${de}/${t}`);
4687
+ return await this.request("GET", `${Ie}/${t}`);
4607
4688
  }
4608
4689
  /**
4609
4690
  * Gets the full project data (users, roles, files, folders) for a project.
@@ -4612,7 +4693,7 @@ const jt = class jt extends Tt {
4612
4693
  async getProjectData(t) {
4613
4694
  return await this.request(
4614
4695
  "GET",
4615
- `${de}/${t}/data`
4696
+ `${Ie}/${t}/data`
4616
4697
  );
4617
4698
  }
4618
4699
  // ─── Account ──────────────────────────────────────────────────────
@@ -4637,7 +4718,7 @@ const jt = class jt extends Tt {
4637
4718
  async checkPermission(t) {
4638
4719
  return await this.request(
4639
4720
  "GET",
4640
- `${de}/permissions/check`,
4721
+ `${Ie}/permissions/check`,
4641
4722
  { query: t }
4642
4723
  );
4643
4724
  }
@@ -4646,7 +4727,7 @@ const jt = class jt extends Tt {
4646
4727
  * single round-trip; results come back in the same order as `checks`.
4647
4728
  */
4648
4729
  async checkPermissionBatch(t) {
4649
- return (await this.request("POST", `${de}/permissions/check/batch`, {
4730
+ return (await this.request("POST", `${Ie}/permissions/check/batch`, {
4650
4731
  body: JSON.stringify({ checks: t }),
4651
4732
  contentType: "application/json"
4652
4733
  })).results;
@@ -4674,7 +4755,7 @@ const jt = class jt extends Tt {
4674
4755
  * ```
4675
4756
  */
4676
4757
  async getNotifications(t) {
4677
- return await this.request("GET", me, {
4758
+ return await this.request("GET", Ae, {
4678
4759
  query: {
4679
4760
  ...(t == null ? void 0 : t.cursor) !== void 0 && { cursor: t.cursor },
4680
4761
  ...(t == null ? void 0 : t.limit) !== void 0 && { limit: String(t.limit) }
@@ -4688,7 +4769,7 @@ const jt = class jt extends Tt {
4688
4769
  async getUnreadNotificationCount() {
4689
4770
  return (await this.request(
4690
4771
  "GET",
4691
- `${me}/unread-count`
4772
+ `${Ae}/unread-count`
4692
4773
  )).count;
4693
4774
  }
4694
4775
  /**
@@ -4699,7 +4780,7 @@ const jt = class jt extends Tt {
4699
4780
  async markNotificationsRead(t) {
4700
4781
  return await this.request(
4701
4782
  "POST",
4702
- `${me}/mark-read`,
4783
+ `${Ae}/mark-read`,
4703
4784
  {
4704
4785
  body: JSON.stringify({ ids: t }),
4705
4786
  contentType: "application/json"
@@ -4710,7 +4791,7 @@ const jt = class jt extends Tt {
4710
4791
  async markAllNotificationsRead() {
4711
4792
  return await this.request(
4712
4793
  "POST",
4713
- `${me}/mark-all-read`
4794
+ `${Ae}/mark-all-read`
4714
4795
  );
4715
4796
  }
4716
4797
  /**
@@ -4720,7 +4801,7 @@ const jt = class jt extends Tt {
4720
4801
  async getNotificationSubscriptions() {
4721
4802
  return await this.request(
4722
4803
  "GET",
4723
- `${me}/subscriptions`
4804
+ `${Ae}/subscriptions`
4724
4805
  );
4725
4806
  }
4726
4807
  /**
@@ -4734,7 +4815,7 @@ const jt = class jt extends Tt {
4734
4815
  async unsubscribeFromAutomation(t) {
4735
4816
  return await this.request(
4736
4817
  "DELETE",
4737
- `${me}/subscriptions/${t}`
4818
+ `${Ae}/subscriptions/${t}`
4738
4819
  );
4739
4820
  }
4740
4821
  /**
@@ -4758,7 +4839,7 @@ const jt = class jt extends Tt {
4758
4839
  async subscribeToAutomation(t, s, r) {
4759
4840
  return await this.request(
4760
4841
  "POST",
4761
- `${de}/${t}/events/hooks/${s}/subscription`,
4842
+ `${Ie}/${t}/events/hooks/${s}/subscription`,
4762
4843
  {
4763
4844
  body: JSON.stringify(r ?? {}),
4764
4845
  contentType: "application/json"
@@ -4775,7 +4856,7 @@ const jt = class jt extends Tt {
4775
4856
  async updateAutomationSubscription(t, s, r) {
4776
4857
  return await this.request(
4777
4858
  "PATCH",
4778
- `${de}/${t}/events/hooks/${s}/subscription`,
4859
+ `${Ie}/${t}/events/hooks/${s}/subscription`,
4779
4860
  {
4780
4861
  body: JSON.stringify(r),
4781
4862
  contentType: "application/json"
@@ -4809,7 +4890,7 @@ const jt = class jt extends Tt {
4809
4890
  * ```
4810
4891
  */
4811
4892
  async onNotification(t) {
4812
- const s = await this.resolveAccessToken(), r = xe(`${this.socketOrigin}/notifications`, {
4893
+ const s = await this.resolveAccessToken(), r = Ke(`${this.socketOrigin}/notifications`, {
4813
4894
  auth: { accessToken: s },
4814
4895
  transports: ["websocket"]
4815
4896
  });
@@ -4825,11 +4906,11 @@ const jt = class jt extends Tt {
4825
4906
  ), () => r.disconnect();
4826
4907
  }
4827
4908
  };
4828
- Se = new WeakMap(), Le = new WeakMap();
4829
- let is = jt;
4830
- async function js(n) {
4831
- const [e, t] = await Sr(), s = t.Model.getRootAsModel(
4832
- new e.ByteBuffer(await kr(n))
4909
+ Le = new WeakMap(), tt = new WeakMap();
4910
+ let Ts = os;
4911
+ async function tn(n) {
4912
+ const [e, t] = await Ar(), s = t.Model.getRootAsModel(
4913
+ new e.ByteBuffer(await Rr(n))
4833
4914
  );
4834
4915
  let r = {};
4835
4916
  try {
@@ -4838,20 +4919,20 @@ async function js(n) {
4838
4919
  }
4839
4920
  const i = /* @__PURE__ */ new Map();
4840
4921
  for (let a = 0; a < s.guidsLength(); a++) {
4841
- const l = s.guidsItems(a), u = s.guids(a);
4842
- l !== null && u && i.set(l, u);
4922
+ const l = s.guidsItems(a), d = s.guids(a);
4923
+ l !== null && d && i.set(l, d);
4843
4924
  }
4844
4925
  const o = [];
4845
4926
  for (let a = 0; a < s.attributesLength(); a++) {
4846
4927
  const l = s.localIds(a);
4847
4928
  if (l === null) continue;
4848
- const u = {}, h = s.attributes(a);
4849
- for (let y = 0; y < ((h == null ? void 0 : h.dataLength()) ?? 0); y++) {
4850
- const w = h.data(y);
4851
- if (w)
4929
+ const d = {}, c = s.attributes(a);
4930
+ for (let m = 0; m < ((c == null ? void 0 : c.dataLength()) ?? 0); m++) {
4931
+ const T = c.data(m);
4932
+ if (T)
4852
4933
  try {
4853
- const [I, T] = JSON.parse(w);
4854
- u[I] = T;
4934
+ const [A, _] = JSON.parse(T);
4935
+ d[A] = _;
4855
4936
  } catch {
4856
4937
  }
4857
4938
  }
@@ -4859,12 +4940,12 @@ async function js(n) {
4859
4940
  localId: l,
4860
4941
  guid: i.get(l) ?? null,
4861
4942
  category: s.categories(a) ?? null,
4862
- attrs: u
4943
+ attrs: d
4863
4944
  });
4864
4945
  }
4865
4946
  return { metadata: r, items: o };
4866
4947
  }
4867
- async function Sr() {
4948
+ async function Ar() {
4868
4949
  try {
4869
4950
  return await Promise.all([
4870
4951
  import("flatbuffers"),
@@ -4876,14 +4957,14 @@ async function Sr() {
4876
4957
  );
4877
4958
  }
4878
4959
  }
4879
- async function kr(n) {
4960
+ async function Rr(n) {
4880
4961
  const e = new Blob([n]).stream().pipeThrough(new DecompressionStream("deflate"));
4881
4962
  return new Uint8Array(await new Response(e).arrayBuffer());
4882
4963
  }
4883
- const Or = "flow:", Ar = "flow:op", Rr = "flow:source", Cr = "revitflow/op@2", os = "REVITFLOWCHANGE", as = "REVITFLOWOPERATION";
4884
- class Ds {
4964
+ const Cr = "flow:", $r = "flow:op", xr = "flow:source", Nr = "revitflow/op@2", _s = "REVITFLOWCHANGE", Is = "REVITFLOWOPERATION";
4965
+ class sn {
4885
4966
  constructor(e) {
4886
- N(this, "changes", []);
4967
+ B(this, "changes", []);
4887
4968
  this.target = e;
4888
4969
  }
4889
4970
  /** How many changes are queued. An operation with none is refused by `build`. */
@@ -4949,7 +5030,7 @@ class Ds {
4949
5030
  "An operation with no changes is not an operation. Add at least one."
4950
5031
  );
4951
5032
  const t = {
4952
- schema: Cr,
5033
+ schema: Nr,
4953
5034
  opId: e,
4954
5035
  // Through the getters, so the envelope and the queue entry cannot drift
4955
5036
  // into disagreeing about the same operation.
@@ -4961,8 +5042,8 @@ class Ds {
4961
5042
  ...this.userId ? { userId: this.userId } : {},
4962
5043
  title: this.title,
4963
5044
  summary: this.summary
4964
- }, [s, r] = await $r();
4965
- return xr(
5045
+ }, [s, r] = await Pr();
5046
+ return Br(
4966
5047
  this.flatbuffer(s, r, e, JSON.stringify(t))
4967
5048
  );
4968
5049
  }
@@ -4971,8 +5052,8 @@ class Ds {
4971
5052
  pack(e, t) {
4972
5053
  const s = {};
4973
5054
  for (const [r, i] of Object.entries(e ?? {}))
4974
- r.startsWith(Or) || (s[r] = String(i));
4975
- return t.position && (s.Position = t.position.map(cs).join(",")), t.rotationDeg !== void 0 && (s.Rotation = cs(t.rotationDeg)), t.source && (s[Rr] = t.source), s;
5055
+ r.startsWith(Cr) || (s[r] = String(i));
5056
+ return t.position && (s.Position = t.position.map(Ss).join(",")), t.rotationDeg !== void 0 && (s.Rotation = Ss(t.rotationDeg)), t.source && (s[xr] = t.source), s;
4976
5057
  }
4977
5058
  requireId(e, t) {
4978
5059
  if (!e || !e.trim())
@@ -4994,61 +5075,61 @@ class Ds {
4994
5075
  * and rejects a falsy one.
4995
5076
  */
4996
5077
  flatbuffer(e, t, s, r) {
4997
- const { Attribute: i, Meshes: o, Model: a, SpatialStructure: l, Transform: u } = t, h = new e.Builder(1024), y = this.changes.length, w = new Uint32Array(y);
4998
- let I = 1;
4999
- for (let C = 0; C < y; C++) w[C] = I++;
5000
- const T = I++, S = (C) => (C(h, 0), h.endVector()), x = o.createShellsVector(h, []), ee = o.createCircleExtrusionsVector(h, []), j = S(o.startSamplesVector), le = S(o.startRepresentationsVector), te = S(o.startMaterialsVector), pe = S(o.startLocalTransformsVector), A = S(o.startGlobalTransformsVector), D = o.createMeshesItemsVector(h, []), E = o.createMaterialIdsVector(h, []), v = o.createRepresentationIdsVector(h, []), $ = o.createSampleIdsVector(h, []), U = o.createLocalTransformIdsVector(h, []), B = o.createGlobalTransformIdsVector(h, []);
5001
- o.startMeshes(h), o.addCoordinates(h, u.createTransform(h, 0, 0, 0, 1, 0, 0, 0, 1, 0)), o.addGlobalTransforms(h, A), o.addShells(h, x), o.addRepresentations(h, le), o.addSamples(h, j), o.addLocalTransforms(h, pe), o.addMaterials(h, te), o.addCircleExtrusions(h, ee), o.addMeshesItems(h, D), o.addRepresentationIds(h, v), o.addSampleIds(h, $), o.addMaterialIds(h, E), o.addLocalTransformIds(h, U), o.addGlobalTransformIds(h, B);
5002
- const Y = o.endMeshes(h), Ws = h.createString(r), et = /* @__PURE__ */ new Set(), tt = [];
5003
- for (const C of this.changes) {
5004
- const se = [], rn = {
5005
- [Ar]: C.op,
5006
- ...C.attrs
5078
+ const { Attribute: i, Meshes: o, Model: a, SpatialStructure: l, Transform: d } = t, c = new e.Builder(1024), m = this.changes.length, T = new Uint32Array(m);
5079
+ let A = 1;
5080
+ for (let I = 0; I < m; I++) T[I] = A++;
5081
+ const _ = A++, E = (I) => (I(c, 0), c.endVector()), N = o.createShellsVector(c, []), we = o.createCircleExtrusionsVector(c, []), H = E(o.startSamplesVector), z = E(o.startRepresentationsVector), De = E(o.startMaterialsVector), K = E(o.startLocalTransformsVector), O = E(o.startGlobalTransformsVector), q = o.createMeshesItemsVector(c, []), X = o.createMaterialIdsVector(c, []), be = o.createRepresentationIdsVector(c, []), ve = o.createSampleIdsVector(c, []), Ee = o.createLocalTransformIdsVector(c, []), qe = o.createGlobalTransformIdsVector(c, []);
5082
+ o.startMeshes(c), o.addCoordinates(c, d.createTransform(c, 0, 0, 0, 1, 0, 0, 0, 1, 0)), o.addGlobalTransforms(c, O), o.addShells(c, N), o.addRepresentations(c, z), o.addSamples(c, H), o.addLocalTransforms(c, K), o.addMaterials(c, De), o.addCircleExtrusions(c, we), o.addMeshesItems(c, q), o.addRepresentationIds(c, be), o.addSampleIds(c, ve), o.addMaterialIds(c, X), o.addLocalTransformIds(c, Ee), o.addGlobalTransformIds(c, qe);
5083
+ const je = o.endMeshes(c), Te = c.createString(r), Ue = /* @__PURE__ */ new Set(), Oe = [];
5084
+ for (const I of this.changes) {
5085
+ const D = [], _e = {
5086
+ [$r]: I.op,
5087
+ ...I.attrs
5007
5088
  };
5008
- for (const [on, an] of Object.entries(rn)) {
5009
- const Vt = JSON.stringify([on, an, "IFCTEXT"]);
5010
- et.add(Vt), se.push(h.createString(Vt));
5089
+ for (const [j, G] of Object.entries(_e)) {
5090
+ const Q = JSON.stringify([j, G, "IFCTEXT"]);
5091
+ Ue.add(Q), D.push(c.createString(Q));
5011
5092
  }
5012
- tt.push(
5013
- i.createAttribute(h, i.createDataVector(h, se))
5093
+ Oe.push(
5094
+ i.createAttribute(c, i.createDataVector(c, D))
5014
5095
  );
5015
5096
  }
5016
5097
  {
5017
- const C = JSON.stringify(["Name", s, "IFCLABEL"]);
5018
- et.add(C);
5019
- const se = i.createDataVector(h, [h.createString(C)]);
5020
- tt.push(i.createAttribute(h, se));
5098
+ const I = JSON.stringify(["Name", s, "IFCLABEL"]);
5099
+ Ue.add(I);
5100
+ const D = i.createDataVector(c, [c.createString(I)]);
5101
+ Oe.push(i.createAttribute(c, D));
5021
5102
  }
5022
- const Ys = a.createAttributesVector(h, tt), Ks = a.createUniqueAttributesVector(
5023
- h,
5024
- [...et].map((C) => h.createString(C))
5025
- ), Dt = this.changes.map(
5026
- () => h.createString(os)
5103
+ const st = a.createAttributesVector(c, Oe), nt = a.createUniqueAttributesVector(
5104
+ c,
5105
+ [...Ue].map((I) => c.createString(I))
5106
+ ), Me = this.changes.map(
5107
+ () => c.createString(_s)
5027
5108
  );
5028
- Dt.push(h.createString(as));
5029
- const zs = a.createCategoriesVector(h, Dt), Ut = [], Mt = [];
5030
- this.changes.forEach((C, se) => {
5031
- C.item && (Ut.push(h.createString(C.item)), Mt.push(w[se]));
5109
+ Me.push(c.createString(Is));
5110
+ const rt = a.createCategoriesVector(c, Me), Ve = [], He = [];
5111
+ this.changes.forEach((I, D) => {
5112
+ I.item && (Ve.push(c.createString(I.item)), He.push(T[D]));
5032
5113
  });
5033
- const Xs = a.createGuidsVector(h, Ut), Qs = a.createGuidsItemsVector(h, Mt), Zs = a.createLocalIdsVector(h, [...w, T]), en = this.changes.map(
5034
- (C, se) => l.createSpatialStructure(
5035
- h,
5036
- w[se],
5037
- h.createString(os),
5114
+ const g = a.createGuidsVector(c, Ve), y = a.createGuidsItemsVector(c, He), k = a.createLocalIdsVector(c, [...T, _]), x = this.changes.map(
5115
+ (I, D) => l.createSpatialStructure(
5116
+ c,
5117
+ T[D],
5118
+ c.createString(_s),
5038
5119
  0
5039
5120
  )
5040
- ), tn = l.createSpatialStructure(
5041
- h,
5042
- T,
5043
- h.createString(as),
5044
- l.createChildrenVector(h, en)
5045
- ), sn = h.createString(s);
5046
- a.startModel(h), a.addMeshes(h, Y), a.addMetadata(h, Ws), a.addAttributes(h, Ys), a.addUniqueAttributes(h, Ks), a.addLocalIds(h, Zs), a.addCategories(h, zs), a.addGuidsItems(h, Qs), a.addGuids(h, Xs), a.addGuid(h, sn), a.addSpatialStructure(h, tn), a.addMaxLocalId(h, I);
5047
- const nn = a.endModel(h);
5048
- return a.finishModelBuffer(h, nn), h.asUint8Array();
5121
+ ), P = l.createSpatialStructure(
5122
+ c,
5123
+ _,
5124
+ c.createString(Is),
5125
+ l.createChildrenVector(c, x)
5126
+ ), F = c.createString(s);
5127
+ a.startModel(c), a.addMeshes(c, je), a.addMetadata(c, Te), a.addAttributes(c, st), a.addUniqueAttributes(c, nt), a.addLocalIds(c, k), a.addCategories(c, rt), a.addGuidsItems(c, y), a.addGuids(c, g), a.addGuid(c, F), a.addSpatialStructure(c, P), a.addMaxLocalId(c, A);
5128
+ const he = a.endModel(c);
5129
+ return a.finishModelBuffer(c, he), c.asUint8Array();
5049
5130
  }
5050
5131
  }
5051
- async function $r() {
5132
+ async function Pr() {
5052
5133
  try {
5053
5134
  return await Promise.all([
5054
5135
  import("flatbuffers"),
@@ -5060,18 +5141,18 @@ async function $r() {
5060
5141
  );
5061
5142
  }
5062
5143
  }
5063
- function cs(n) {
5144
+ function Ss(n) {
5064
5145
  return Number.isFinite(n) ? String(n) : "0";
5065
5146
  }
5066
- async function xr(n) {
5147
+ async function Br(n) {
5067
5148
  const e = new Blob([n]).stream().pipeThrough(new CompressionStream("deflate"));
5068
5149
  return new Uint8Array(await new Response(e).arrayBuffer());
5069
5150
  }
5070
- const Nr = "Element", Pr = "Carried", Us = 1 / 0.3048;
5071
- function Br(n) {
5151
+ const Lr = "Element", Fr = "Carried", nn = 1 / 0.3048;
5152
+ function Dr(n) {
5072
5153
  const e = [];
5073
5154
  for (const t of n)
5074
- for (const s of [Nr, Pr]) {
5155
+ for (const s of [Lr, Fr]) {
5075
5156
  const r = t.attrs[s];
5076
5157
  if (r)
5077
5158
  try {
@@ -5090,7 +5171,7 @@ function Br(n) {
5090
5171
  }
5091
5172
  return e;
5092
5173
  }
5093
- function hs(n, e) {
5174
+ function ht(n, e) {
5094
5175
  const t = n.params[e];
5095
5176
  if (typeof t != "string") return null;
5096
5177
  try {
@@ -5099,16 +5180,25 @@ function hs(n, e) {
5099
5180
  return null;
5100
5181
  }
5101
5182
  }
5102
- function Fr(n) {
5183
+ function qr(n) {
5103
5184
  const e = /* @__PURE__ */ new Map();
5104
5185
  for (const t of n) {
5105
5186
  if (t.kind !== "datum" || t.params.of !== "level") continue;
5106
- const s = t.params.named;
5107
- typeof s == "string" && e.set(t.id, s);
5187
+ const s = t.params.named, r = t.params.at;
5188
+ typeof s == "string" && typeof r == "number" && e.set(t.id, { name: s, at: r });
5108
5189
  }
5109
5190
  return e;
5110
5191
  }
5111
- async function Ms(n, e) {
5192
+ function jr(n) {
5193
+ const e = /* @__PURE__ */ new Map();
5194
+ for (const t of n) {
5195
+ if (!t.kind.endsWith("Style")) continue;
5196
+ const s = t.params.name;
5197
+ typeof s == "string" && e.set(s, t);
5198
+ }
5199
+ return e;
5200
+ }
5201
+ async function rn(n, e) {
5112
5202
  const t = /* @__PURE__ */ new Map(), s = (await n.targetDoc.suggestions()).filter(
5113
5203
  (r) => {
5114
5204
  var i;
@@ -5117,129 +5207,203 @@ async function Ms(n, e) {
5117
5207
  ).sort((r, i) => String(r.createdAt).localeCompare(String(i.createdAt)));
5118
5208
  for (const r of s)
5119
5209
  try {
5120
- const i = await n.targetDoc.suggestionPayload(r), { items: o } = await js(
5210
+ const i = await n.targetDoc.suggestionPayload(r), { items: o } = await tn(
5121
5211
  new Uint8Array(await i.arrayBuffer())
5122
- ), a = o.filter((u) => u.attrs["flow:op"]), l = r.affectedIds ?? [];
5123
- for (let u = 0; u < a.length && u < l.length; u++) {
5124
- const h = a[u].attrs["flow:source"];
5125
- h && (a[u].attrs["flow:op"] === "remove" ? t.delete(h) : t.set(h, l[u]));
5212
+ ), a = o.filter((d) => d.attrs["flow:op"]), l = r.affectedIds ?? [];
5213
+ for (let d = 0; d < a.length && d < l.length; d++) {
5214
+ const c = a[d].attrs["flow:source"];
5215
+ c && (a[d].attrs["flow:op"] === "remove" ? t.delete(c) : t.set(c, l[d]));
5126
5216
  }
5127
5217
  } catch {
5128
5218
  }
5129
5219
  return t;
5130
5220
  }
5131
- async function Vs(n, e) {
5221
+ async function on(n, e) {
5132
5222
  if (!(e != null && e.fileId)) throw new Error("Choose the model file to read.");
5133
5223
  const t = new Uint8Array(
5134
5224
  await (await n.client.downloadFile(e.fileId)).arrayBuffer()
5135
5225
  );
5136
- return { picked: e, contents: await js(t) };
5226
+ return { picked: e, contents: await tn(t) };
5137
5227
  }
5138
- const ls = 180 / Math.PI;
5139
- function ds(n) {
5228
+ const Rt = {
5229
+ levels: "-2000240",
5230
+ walls: "-2000011",
5231
+ floors: "-2000032"
5232
+ }, ks = 180 / Math.PI;
5233
+ function Os(n) {
5140
5234
  if (typeof n != "string") return null;
5141
5235
  const e = n.indexOf(":");
5142
5236
  return e <= 0 || e === n.length - 1 ? null : { family: n.slice(0, e), type: n.slice(e + 1) };
5143
5237
  }
5144
- function Gs(n) {
5238
+ const J = (n) => String(n);
5239
+ function an(n) {
5145
5240
  return async (e) => {
5146
- var A, D;
5147
- const { picked: t, contents: s } = await Vs(
5241
+ var Oe, st, nt, Me, rt, Ve, He;
5242
+ const { picked: t, contents: s } = await on(
5148
5243
  e,
5149
5244
  e.input
5150
- ), r = Br(s.items);
5245
+ ), r = Dr(s.items);
5151
5246
  if (r.length === 0)
5152
5247
  throw new Error(
5153
5248
  n === "ifc" ? `"${t.name}" carries no platform records: it was imported without the editable converter. Process the IFC with the editable converter first; a plain import only has IFC attributes, and guessing geometry is not this recipe.` : `"${t.name}" carries no platform records, so there is nothing semantic to convert.`
5154
5249
  );
5155
- const { columnType: i, trustStyleNames: o, includeInstances: a } = e.settings;
5156
- if (!i && !o)
5157
- throw new Error(
5158
- "Choose the Revit column type, or trust the model style names."
5159
- );
5250
+ const { columnType: i, trustStyleNames: o, includeInstances: a } = e.settings, l = e.settings.createLevels !== !1;
5160
5251
  if (a && !o)
5161
5252
  throw new Error(
5162
5253
  "Free-standing instances can only be proposed by their style names: turn trustStyleNames on."
5163
5254
  );
5164
- const l = Fr(r), u = `recipe:${n}-to-revit`, h = await Ms(e, u), y = await e.targetDoc.latest(), w = new Ds({
5255
+ const d = qr(r), c = jr(r), m = `recipe:${n}-to-revit`, T = await rn(e, m), A = await e.targetDoc.latest(), _ = new sn({
5165
5256
  project: e.projectId,
5166
5257
  document: e.targetDoc.docId,
5167
- baseCommit: (y == null ? void 0 : y.version) ?? 0,
5168
- author: u
5169
- }), I = Us, T = (E) => `${t.fileId}:${E.id}`;
5170
- let S = 0, x = 0, ee = 0;
5171
- const j = /* @__PURE__ */ new Set(), le = (E, v, $, U) => {
5172
- const B = T(E);
5173
- j.add(B);
5174
- const Y = h.get(B);
5175
- Y ? w.set(Y, {}, { position: $, rotationDeg: U, source: B }) : w.add(v, { position: $, rotationDeg: U, source: B });
5258
+ baseCommit: (A == null ? void 0 : A.version) ?? 0,
5259
+ author: m
5260
+ }), E = nn, N = (g) => `${t.fileId}:${g}`, we = /* @__PURE__ */ new Set();
5261
+ let H = 0;
5262
+ const z = (g, y, k) => (we.add(g), T.has(g) ? (H++, !1) : (_.add(y, { ...k, source: g }), !0)), De = (g) => {
5263
+ const y = typeof g == "string" ? c.get(g) : void 0, k = y == null ? void 0 : y.params.thickness;
5264
+ return typeof k == "number" && k > 0 ? k * E : void 0;
5176
5265
  };
5177
- for (const E of r) {
5178
- if (E.kind === "member" && E.params.of === "column") {
5179
- const v = hs(E, "member"), $ = v == null ? void 0 : v.start;
5180
- if (!$ || $.length !== 3) continue;
5181
- const U = o ? ds(E.params.lookRef) : null;
5182
- if (o && !U) continue;
5183
- const B = U ?? {
5184
- family: i.family,
5185
- type: i.type
5186
- }, Y = l.get(String((v == null ? void 0 : v.level) ?? ""));
5187
- le(
5188
- E,
5189
- {
5190
- ...i && !o ? { CategoryId: i.categoryId } : {},
5191
- Family: B.family,
5192
- Type: B.type,
5193
- ...Y ? { Level: Y } : {}
5194
- },
5195
- [$[0] * I, $[1] * I, $[2] * I],
5196
- (Number((v == null ? void 0 : v.roll) ?? 0) || 0) * ls
5197
- ), S++;
5266
+ let K = 0;
5267
+ if (l)
5268
+ for (const [g, y] of d)
5269
+ z(N(g), {
5270
+ CategoryId: Rt.levels,
5271
+ Name: y.name,
5272
+ Elevation: J(y.at * E)
5273
+ }), K++;
5274
+ let O = 0, q = 0;
5275
+ for (const g of r) {
5276
+ if (g.kind !== "run" || g.params.of !== "wall") continue;
5277
+ const y = ht(g, "run"), k = ((st = (Oe = y == null ? void 0 : y.run) == null ? void 0 : Oe.line) == null ? void 0 : st.curves) ?? [], x = typeof (y == null ? void 0 : y.base) == "number" ? y.base : 0, P = y == null ? void 0 : y.height, F = d.get(String((y == null ? void 0 : y.level) ?? g.params.level ?? "")), he = g.params.lookRef;
5278
+ if (typeof he != "string" || typeof P != "number" || !F) {
5279
+ q++;
5280
+ continue;
5281
+ }
5282
+ k.forEach((I, D) => {
5283
+ if (I.kind !== "segment" || !I.from || !I.to) {
5284
+ q++;
5285
+ return;
5286
+ }
5287
+ const _e = x * E, j = `${J(I.from[0] * E)},${J(I.from[1] * E)},${J(_e)};${J(I.to[0] * E)},${J(I.to[1] * E)},${J(_e)}`, G = {
5288
+ CategoryId: Rt.walls,
5289
+ Type: he,
5290
+ LocationLine: j,
5291
+ Level: F.name,
5292
+ BaseOffset: J((x - F.at) * E),
5293
+ Height: J(P * E)
5294
+ }, Q = De(he);
5295
+ Q && (G["Type.Width"] = J(Q)), z(`${N(g.id)}#${D}`, G) && O++;
5296
+ });
5297
+ }
5298
+ let X = 0, be = 0;
5299
+ for (const g of r) {
5300
+ if (g.kind !== "extrusion" || g.params.of !== "slab") continue;
5301
+ const y = ht(g, "extrusion"), k = typeof g.params.base == "number" ? g.params.base : 0, x = d.get(String((y == null ? void 0 : y.level) ?? g.params.level ?? "")), P = g.params.lookRef, F = (j) => {
5302
+ if (!(j != null && j.length)) return null;
5303
+ const G = [];
5304
+ for (const Q of j) {
5305
+ if (Q.kind !== "segment" || !Q.from) return null;
5306
+ G.push(Q.from[0] * E, Q.from[1] * E, k * E);
5307
+ }
5308
+ return G.length >= 9 ? G : null;
5309
+ }, he = F((Me = (nt = y == null ? void 0 : y.profile) == null ? void 0 : nt.outline) == null ? void 0 : Me.curves);
5310
+ if (typeof P != "string" || !x || !he) {
5311
+ be++;
5198
5312
  continue;
5199
5313
  }
5200
- if (a && E.kind === "familyInstance" && !E.params.host) {
5201
- const v = hs(E, "instance"), $ = (A = v == null ? void 0 : v.placement) == null ? void 0 : A.at;
5202
- if (!$ || $.length !== 3 || v != null && v.host) continue;
5203
- const U = ds(E.params.type);
5204
- if (!U) continue;
5205
- const B = (D = v == null ? void 0 : v.placement) == null ? void 0 : D.right, Y = B ? Math.atan2(B[1], B[0]) * ls : 0;
5206
- le(
5207
- E,
5208
- { Family: U.family, Type: U.type },
5209
- [$[0] * I, $[1] * I, $[2] * I],
5210
- Y
5211
- ), x++;
5314
+ const I = [he];
5315
+ for (const j of ((rt = y == null ? void 0 : y.profile) == null ? void 0 : rt.holes) ?? []) {
5316
+ const G = F(j == null ? void 0 : j.curves);
5317
+ G && I.push(G);
5318
+ }
5319
+ const D = {
5320
+ CategoryId: Rt.floors,
5321
+ Type: P,
5322
+ Profile: JSON.stringify(I),
5323
+ Level: x.name
5324
+ }, _e = De(P);
5325
+ _e && (D["Type.Width"] = J(_e)), z(N(g.id), D) && X++;
5326
+ }
5327
+ let ve = 0;
5328
+ for (const g of r) {
5329
+ if (g.kind !== "member" || g.params.of !== "column") continue;
5330
+ const y = ht(g, "member"), k = y == null ? void 0 : y.start;
5331
+ if (!k || k.length !== 3) continue;
5332
+ const x = o ? Os(g.params.lookRef) : null;
5333
+ if (o && !x || !x && !i) continue;
5334
+ const P = x ?? {
5335
+ family: i.family,
5336
+ type: i.type
5337
+ }, F = d.get(String((y == null ? void 0 : y.level) ?? ""));
5338
+ z(
5339
+ N(g.id),
5340
+ {
5341
+ ...i && !x ? { CategoryId: i.categoryId } : {},
5342
+ Family: P.family,
5343
+ Type: P.type,
5344
+ ...F ? { Level: F.name } : {}
5345
+ },
5346
+ {
5347
+ position: [k[0] * E, k[1] * E, k[2] * E],
5348
+ rotationDeg: (Number((y == null ? void 0 : y.roll) ?? 0) || 0) * ks
5349
+ }
5350
+ ) && ve++;
5351
+ }
5352
+ let Ee = 0, qe = 0;
5353
+ for (const g of r) {
5354
+ if (g.kind !== "familyInstance") continue;
5355
+ if (g.params.host) {
5356
+ qe++;
5212
5357
  continue;
5213
5358
  }
5214
- (E.kind === "run" || E.kind === "extrusion" || E.kind === "stair" || E.kind === "footing" || E.kind === "ramp") && ee++;
5359
+ if (!a) continue;
5360
+ const y = ht(g, "instance"), k = (Ve = y == null ? void 0 : y.placement) == null ? void 0 : Ve.at;
5361
+ if (!k || k.length !== 3) continue;
5362
+ const x = Os(g.params.type);
5363
+ if (!x) continue;
5364
+ const P = (He = y == null ? void 0 : y.placement) == null ? void 0 : He.right, F = P ? Math.atan2(P[1], P[0]) * ks : 0;
5365
+ z(
5366
+ N(g.id),
5367
+ { Family: x.family, Type: x.type },
5368
+ { position: [k[0] * E, k[1] * E, k[2] * E], rotationDeg: F }
5369
+ ) && Ee++;
5215
5370
  }
5216
- let te = 0;
5217
- for (const [E, v] of h)
5218
- !E.startsWith(`${t.fileId}:`) || j.has(E) || (w.remove(v), te++);
5219
- if (w.length === 0)
5371
+ let je = 0;
5372
+ for (const g of r)
5373
+ (g.kind === "stair" || g.kind === "footing" || g.kind === "ramp" || g.kind === "extrusion" && g.params.of !== "slab" || g.kind === "run" && g.params.of !== "wall") && je++;
5374
+ let Te = 0;
5375
+ for (const [g, y] of T)
5376
+ !g.startsWith(`${t.fileId}:`) || we.has(g) || (_.remove(y), Te++);
5377
+ if (_.length === 0)
5220
5378
  throw new Error(
5221
- `Nothing the Revit applier can do yet: "${t.name}" has ${ee} element(s) with a body (walls, slabs, stairs...) and no column or free-standing instance. Those arrive as the applier grows.`
5379
+ `Nothing new to ask for: "${t.name}" holds ${H} element(s) this recipe already made, ${qe + je} waiting on the applier, and nothing is left to remove.`
5222
5380
  );
5223
- const pe = [
5224
- S ? `${S} column(s)` : "",
5225
- x ? `${x} instance(s)` : "",
5226
- te ? `${te} gone` : ""
5381
+ const Ue = [
5382
+ K ? `${K} level(s)` : "",
5383
+ O ? `${O} wall(s)` : "",
5384
+ X ? `${X} floor(s)` : "",
5385
+ ve ? `${ve} column(s)` : "",
5386
+ Ee ? `${Ee} instance(s)` : "",
5387
+ Te ? `${Te} gone` : ""
5227
5388
  ].filter(Boolean);
5228
5389
  return {
5229
- title: `${n === "ifc" ? "IFC" : "Model"} to Revit: ${pe.join(", ")}`,
5230
- verb: w.summary,
5231
- targets: w.length,
5232
- payload: new Blob([await w.build(e.opId)]),
5390
+ title: `${n === "ifc" ? "IFC" : "Model"} to Revit: ${Ue.join(", ")}`,
5391
+ verb: _.summary,
5392
+ targets: _.length,
5393
+ payload: new Blob([await _.build(e.opId)]),
5233
5394
  ruleTallies: [
5234
- { read: S, proposed: S },
5235
- { read: x, proposed: x },
5236
- { read: te, proposed: te },
5237
- { read: ee, proposed: 0 }
5395
+ { read: d.size, proposed: K },
5396
+ { read: O + q, proposed: O },
5397
+ { read: X + be, proposed: X },
5398
+ { read: ve, proposed: ve },
5399
+ { read: Ee, proposed: Ee },
5400
+ { read: Te, proposed: Te },
5401
+ { read: qe + je, proposed: 0 }
5238
5402
  ]
5239
5403
  };
5240
5404
  };
5241
5405
  }
5242
- const Lr = {
5406
+ const Ur = {
5243
5407
  type: "object",
5244
5408
  properties: {
5245
5409
  columnType: {
@@ -5262,96 +5426,87 @@ const Lr = {
5262
5426
  type: "boolean",
5263
5427
  title: "Also propose free-standing instances (needs style names)",
5264
5428
  default: !1
5429
+ },
5430
+ createLevels: {
5431
+ type: "boolean",
5432
+ title: "Carry the model's levels (ensured by name)",
5433
+ default: !0
5265
5434
  }
5266
5435
  }
5267
- }, qr = [
5268
- {
5269
- reads: "Column records (members) with no proposal yet",
5270
- proposes: "A new Revit column at each, on its level"
5271
- },
5272
- {
5273
- reads: "Free-standing family instances (when turned on)",
5274
- proposes: "A new instance of the same-named type, placed and turned"
5275
- },
5276
- {
5277
- reads: "Things this recipe made whose record is gone",
5278
- proposes: "That element removed"
5279
- },
5280
- {
5281
- reads: "Walls, slabs, stairs and every element with a body",
5282
- proposes: "Nothing yet - waits on the Revit applier growing"
5283
- }
5284
- ], Hs = {
5285
- name: "frag-to-revit",
5286
- title: "Platform model to Revit",
5287
- description: "Turns the platform records of a .frag into change requests for a Revit document.",
5288
- to: "revit",
5289
- inputs: ["frag-model"],
5290
- source: { kind: "project-file", extensions: ["frag"] },
5291
- runtime: "browser",
5292
- settingsSchema: Lr,
5293
- rules: qr,
5294
- doc: `
5436
+ }, Mr = [
5437
+ { reads: "Levels (datums)", proposes: "The same level on the target, ensured by name" },
5438
+ { reads: "Wall runs, one per straight segment", proposes: "A native wall: curve, type (made from its width when missing), level, height" },
5439
+ { reads: "Slabs with their boundary", proposes: "A native floor from the profile, holes included" },
5440
+ { reads: "Column records (members)", proposes: "A Revit column at each, on its level" },
5441
+ { reads: "Free-standing family instances (when turned on)", proposes: "A new instance of the same-named type, placed and turned" },
5442
+ { reads: "Things this recipe made whose record is gone", proposes: "That element removed" },
5443
+ { reads: "Hosted doors/windows, stairs, roofs, footings, curtain pieces", proposes: "Nothing yet - each waits on the applier or the converter growing" }
5444
+ ], cn = `
5295
5445
  ## What it does
5296
5446
 
5297
- It reads a .frag made or edited on the platform and asks a Revit document for
5298
- the elements its records describe. Nothing changes in Revit until the owner of
5299
- that document accepts the request there.
5447
+ It reads the platform's records out of a .frag and asks a Revit document for
5448
+ the building they describe - levels, walls, floors, columns and (opting in)
5449
+ free-standing instances, in one operation, levels first. Nothing changes in
5450
+ Revit until the owner of that document accepts the request there, and the
5451
+ applier materialises everything NATIVELY: real walls on real levels, never
5452
+ imported meshes.
5300
5453
 
5301
- ## What it can ask for today
5454
+ ## What it carries per thing
5302
5455
 
5303
- The Revit applier creates point-placed family instances and edits or removes
5304
- by id. So columns and (optionally) free-standing instances become proposals;
5305
- walls, slabs and stairs are counted and reported, and start proposing the day
5306
- the applier learns native creation for them.
5456
+ Walls: the location line per straight segment, the type by its exact name
5457
+ (with its width, so a missing type is created by duplication), the level by
5458
+ name, base offset and height. Floors: the boundary loops, holes included.
5459
+ Columns and instances: point, rotation, level, type. Levels: name and
5460
+ elevation - ENSURED, so a level the target already has is simply used.
5307
5461
 
5308
5462
  ## It reconciles, it does not push
5309
5463
 
5310
- Run it again after the model changed and it asks only for the difference. It
5311
- can only ever ask to remove what it asked for itself; elements a person made
5312
- in Revit are invisible to it. What it made is read back from its own applied
5313
- requests - it keeps nothing of its own.
5464
+ Run it again and it asks only for the difference: new records become new
5465
+ proposals, and a record that is gone asks for its element to be removed. What
5466
+ it already made is left alone (changing an existing wall through a proposal
5467
+ is the next step, not this one). It can only ever remove what it asked for
5468
+ itself; elements a person made in Revit are invisible to it. It keeps nothing
5469
+ of its own - what it made is read back from its own applied requests.
5470
+
5471
+ ## What still waits
5472
+
5473
+ Hosted doors and windows (the converter does not record their category and
5474
+ family yet), stairs, roofs, footings and curtain walls (the applier does not
5475
+ create them yet). They are read and counted, and their rule row says so.
5314
5476
 
5315
5477
  ## Units and axes
5316
5478
 
5317
- Records are metres, Z up; proposals are written in Revit's feet. Types are
5318
- matched exactly by name; Revit refuses the whole request when one is missing.
5319
- `,
5320
- run: Gs("frag")
5321
- }, jr = {
5322
- ...Hs,
5479
+ Records are metres and radians, Z up; proposals are written in Revit's feet
5480
+ and degrees. Types are matched exactly by name; Revit refuses the whole
5481
+ request when a loadable type is missing (system types are created from their
5482
+ width instead).
5483
+ `, hn = {
5484
+ name: "frag-to-revit",
5485
+ title: "Platform model to Revit",
5486
+ description: "Turns the platform records of a .frag - levels, walls, floors, columns, instances - into change requests for a Revit document.",
5487
+ to: "revit",
5488
+ inputs: ["frag-model"],
5489
+ source: { kind: "project-file", extensions: ["frag"] },
5490
+ runtime: "browser",
5491
+ settingsSchema: Ur,
5492
+ rules: Mr,
5493
+ doc: cn,
5494
+ run: an("frag")
5495
+ }, Vr = {
5496
+ ...hn,
5323
5497
  name: "ifc-to-revit",
5324
5498
  title: "IFC to Revit",
5325
- description: "Turns an IFC - through the frag the platform converted it into - into change requests for a Revit document.",
5499
+ description: "Turns an IFC - through the frag the platform converted it into - into native Revit change requests: levels, walls, floors, columns, instances.",
5326
5500
  inputs: ["ifc-model"],
5327
5501
  doc: `
5328
- ## What it does
5329
-
5330
- It reads the .frag your IFC was PROCESSED into (the IFC document's view) and
5331
- asks a Revit document for the elements its records describe. Point it at that
5332
- frag: a plain IFC import carries only IFC attributes and is refused by name -
5333
- the editable converter is what gives an IFC real records.
5334
-
5335
- ## What it can ask for today
5336
-
5337
- The Revit applier creates point-placed family instances and edits or removes
5338
- by id. So columns and (optionally) free-standing instances become proposals;
5339
- walls, slabs and stairs are counted and reported, and start proposing the day
5340
- the applier learns native creation for them.
5341
-
5342
- ## It reconciles, it does not push
5343
-
5344
- Run it again after a reconversion and it asks only for the difference. It can
5345
- only ever ask to remove what it asked for itself. What it made is read back
5346
- from its own applied requests - it keeps nothing of its own.
5502
+ ## Point it at the converted frag
5347
5503
 
5348
- ## Units and axes
5349
-
5350
- Records are metres, Z up; proposals are written in Revit's feet. Types are
5351
- matched exactly by name; Revit refuses the whole request when one is missing.
5352
- `,
5353
- run: Gs("ifc")
5354
- }, Dr = {
5504
+ It reads the .frag your IFC was PROCESSED into (the IFC document's view). A
5505
+ plain IFC import carries only IFC attributes and is refused by name - the
5506
+ editable converter is what gives an IFC real records.
5507
+ ` + cn,
5508
+ run: an("ifc")
5509
+ }, Hr = {
5355
5510
  millimeters: 1e-3,
5356
5511
  millimetres: 1e-3,
5357
5512
  mm: 1e-3,
@@ -5365,13 +5520,13 @@ matched exactly by name; Revit refuses the whole request when one is missing.
5365
5520
  in: 0.0254,
5366
5521
  feet: 0.3048,
5367
5522
  ft: 0.3048
5368
- }, Js = "rhino-to-revit", us = `recipe:${Js}`;
5369
- function Ur(n) {
5523
+ }, ln = "rhino-to-revit", As = `recipe:${ln}`;
5524
+ function Gr(n) {
5370
5525
  const e = (n.attrs.Position ?? "").split(",").map((t) => Number(t.trim()));
5371
5526
  return e.length !== 3 || e.some((t) => !Number.isFinite(t)) ? null : [e[0], e[1], e[2]];
5372
5527
  }
5373
- const Mr = {
5374
- name: Js,
5528
+ const Jr = {
5529
+ name: ln,
5375
5530
  title: "Rhino to Revit",
5376
5531
  description: "Turns the placed objects of a Rhino layer into change requests for Revit instances of a chosen type.",
5377
5532
  to: "revit",
@@ -5440,14 +5595,14 @@ at or below the point. For a level-based family the level wins over the
5440
5595
  point's height.
5441
5596
  `,
5442
5597
  async run(n) {
5443
- var pe;
5444
- const { picked: e, contents: t } = await Vs(
5598
+ var K;
5599
+ const { picked: e, contents: t } = await on(
5445
5600
  n,
5446
5601
  n.input
5447
5602
  ), { layer: s, instanceType: r } = n.settings;
5448
5603
  if (!s || !r)
5449
5604
  throw new Error("Choose the layer and the Revit type.");
5450
- const i = (pe = t.metadata) == null ? void 0 : pe.data, o = i == null ? void 0 : i.units, a = typeof o == "string" ? Dr[o.trim().toLowerCase()] : void 0;
5605
+ const i = (K = t.metadata) == null ? void 0 : K.data, o = i == null ? void 0 : i.units, a = typeof o == "string" ? Hr[o.trim().toLowerCase()] : void 0;
5451
5606
  if (!a)
5452
5607
  throw new Error(
5453
5608
  `"${e.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.`
@@ -5457,114 +5612,114 @@ point's height.
5457
5612
  throw new Error(
5458
5613
  `"${e.name}" declares its data as "${l}"; this recipe only converts Z up.`
5459
5614
  );
5460
- const u = a * Us, h = await Ms(n, us), y = await n.targetDoc.latest(), w = new Ds({
5615
+ const d = a * nn, c = await rn(n, As), m = await n.targetDoc.latest(), T = new sn({
5461
5616
  project: n.projectId,
5462
5617
  document: n.targetDoc.docId,
5463
- baseCommit: (y == null ? void 0 : y.version) ?? 0,
5464
- author: us
5618
+ baseCommit: (m == null ? void 0 : m.version) ?? 0,
5619
+ author: As
5465
5620
  });
5466
- let I = 0, T = 0, S = 0;
5467
- const x = /* @__PURE__ */ new Set(), ee = [];
5468
- for (const A of t.items) {
5469
- if (!A.guid || Object.keys(A.attrs).length === 0) continue;
5470
- if ((A.attrs.Layer ?? "") !== s) {
5471
- S++;
5621
+ let A = 0, _ = 0, E = 0;
5622
+ const N = /* @__PURE__ */ new Set(), we = [];
5623
+ for (const O of t.items) {
5624
+ if (!O.guid || Object.keys(O.attrs).length === 0) continue;
5625
+ if ((O.attrs.Layer ?? "") !== s) {
5626
+ E++;
5472
5627
  continue;
5473
5628
  }
5474
- const D = Ur(A);
5475
- if (!D) continue;
5476
- x.add(A.guid);
5477
- const E = [
5478
- D[0] * u,
5479
- D[1] * u,
5480
- D[2] * u
5481
- ], v = h.get(A.guid);
5482
- v ? ee.push({ instance: v, object: A.guid, position: E }) : (w.add(
5629
+ const q = Gr(O);
5630
+ if (!q) continue;
5631
+ N.add(O.guid);
5632
+ const X = [
5633
+ q[0] * d,
5634
+ q[1] * d,
5635
+ q[2] * d
5636
+ ], be = c.get(O.guid);
5637
+ be ? we.push({ instance: be, object: O.guid, position: X }) : (T.add(
5483
5638
  {
5484
5639
  CategoryId: r.categoryId,
5485
5640
  Family: r.family,
5486
5641
  Type: r.type
5487
5642
  },
5488
- { position: E, source: A.guid }
5489
- ), I++);
5643
+ { position: X, source: O.guid }
5644
+ ), A++);
5490
5645
  }
5491
- for (const A of ee)
5492
- w.set(A.instance, {}, { position: A.position, source: A.object }), T++;
5493
- let j = 0;
5494
- for (const [A, D] of h)
5495
- x.has(A) || (w.remove(D), j++);
5496
- const le = I + T + j;
5497
- if (le === 0)
5646
+ for (const O of we)
5647
+ T.set(O.instance, {}, { position: O.position, source: O.object }), _++;
5648
+ let H = 0;
5649
+ for (const [O, q] of c)
5650
+ N.has(O) || (T.remove(q), H++);
5651
+ const z = A + _ + H;
5652
+ if (z === 0)
5498
5653
  throw new Error(
5499
5654
  `Nothing to ask for: layer "${s}" of "${e.name}" has no placed object, and nothing of this recipe is left to remove.`
5500
5655
  );
5501
5656
  return {
5502
5657
  title: `From Rhino: ${[
5503
- I ? `${I} new` : "",
5504
- T ? `${T} moved` : "",
5505
- j ? `${j} gone` : ""
5658
+ A ? `${A} new` : "",
5659
+ _ ? `${_} moved` : "",
5660
+ H ? `${H} gone` : ""
5506
5661
  ].filter(Boolean).join(", ")}`,
5507
- verb: w.summary,
5508
- targets: le,
5509
- payload: new Blob([await w.build(n.opId)]),
5662
+ verb: T.summary,
5663
+ targets: z,
5664
+ payload: new Blob([await T.build(n.opId)]),
5510
5665
  ruleTallies: [
5511
- { read: I, proposed: I },
5512
- { read: T, proposed: T },
5513
- { read: j, proposed: j },
5514
- { read: S, proposed: 0 }
5666
+ { read: A, proposed: A },
5667
+ { read: _, proposed: _ },
5668
+ { read: H, proposed: H },
5669
+ { read: E, proposed: 0 }
5515
5670
  ]
5516
5671
  };
5517
5672
  }
5518
- }, Vr = [
5519
- Mr,
5520
- jr,
5521
- Hs
5673
+ }, Wr = [
5674
+ Jr,
5675
+ Vr,
5676
+ hn
5522
5677
  ];
5523
- function Jr(n) {
5524
- for (const e of Vr) n.recipes.register(e);
5678
+ function Kr(n) {
5679
+ for (const e of Wr) n.recipes.register(e);
5525
5680
  }
5526
- const Wr = {
5681
+ const Xr = {
5527
5682
  MAX_FIELDS: 200,
5528
5683
  MAX_KEY_LENGTH: 50,
5529
5684
  MAX_VALUE_LENGTH: 50
5530
- }, Yr = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, Kr = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, zr = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, Xr = { uuid: "d8f3a1c2-6b4e-4f9a-8c1d-2e7b5a9f3c60" }, Qr = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" }, Zr = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, ei = { uuid: "6f3a9c2e-8b1d-4e6a-9c3f-1d7b5a8e2c4f" }, ti = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, si = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
5685
+ }, Qr = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, Zr = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, ei = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, ti = { uuid: "d8f3a1c2-6b4e-4f9a-8c1d-2e7b5a9f3c60" }, si = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" }, ni = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, ri = { uuid: "6f3a9c2e-8b1d-4e6a-9c3f-1d7b5a8e2c4f" }, ii = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, oi = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
5531
5686
  export {
5532
- Yr as CDEManager,
5533
- Ir as ChannelClient,
5534
- Ps as ChannelRoom,
5535
- Kr as ClashesManager,
5536
- Er as CollabRoom,
5537
- zt as DOCUMENT_FILE,
5538
- Xe as DOCUMENT_SCHEMA,
5539
- Tt as EngineServicesClient,
5540
- _r as ExternalRoom,
5541
- zr as FileList,
5542
- ar as FlowDoc,
5543
- Xr as GISManager,
5544
- Qr as GitHistoryManager,
5545
- Zr as HelloWorld,
5546
- Wr as METADATA_LIMITS,
5547
- Cr as OP_SCHEMA,
5548
- Ds as OperationBuilder,
5549
- is as PlatformClient,
5550
- ks as ProjectDocuments,
5551
- or as ProjectHistory,
5552
- ei as ProjectManager,
5553
- hr as Recipes,
5554
- Lt as RequestError,
5555
- nr as SELF_VIEWING_FORMATS,
5556
- ns as STORAGE_BATCH_MAX,
5557
- Zt as StaleHistoryError,
5558
- ti as TopicsManager,
5559
- si as UIManager,
5560
- Vr as builtinRecipes,
5561
- Hs as fragToRevit,
5562
- jr as ifcToRevit,
5563
- Et as mintGuid,
5564
- xs as orderByGraph,
5565
- js as readFrag,
5566
- Jr as registerBuiltinRecipes,
5567
- Mr as rhinoToRevit,
5568
- br as windowTransport
5687
+ Qr as CDEManager,
5688
+ Or as ChannelClient,
5689
+ Ks as ChannelRoom,
5690
+ Zr as ClashesManager,
5691
+ Ir as CollabRoom,
5692
+ fs as DOCUMENT_FILE,
5693
+ bt as DOCUMENT_SCHEMA,
5694
+ Ht as EngineServicesClient,
5695
+ Sr as ExternalRoom,
5696
+ ei as FileList,
5697
+ lr as FlowDoc,
5698
+ ti as GISManager,
5699
+ si as GitHistoryManager,
5700
+ ni as HelloWorld,
5701
+ Xr as METADATA_LIMITS,
5702
+ Nr as OP_SCHEMA,
5703
+ sn as OperationBuilder,
5704
+ Ts as PlatformClient,
5705
+ Ms as ProjectDocuments,
5706
+ hr as ProjectHistory,
5707
+ ri as ProjectManager,
5708
+ ur as Recipes,
5709
+ rs as RequestError,
5710
+ or as SELF_VIEWING_FORMATS,
5711
+ vs as STORAGE_BATCH_MAX,
5712
+ ys as StaleHistoryError,
5713
+ ii as TopicsManager,
5714
+ oi as UIManager,
5715
+ Wr as builtinRecipes,
5716
+ hn as fragToRevit,
5717
+ Vr as ifcToRevit,
5718
+ Mt as mintGuid,
5719
+ Ys as orderByGraph,
5720
+ tn as readFrag,
5721
+ Kr as registerBuiltinRecipes,
5722
+ Jr as rhinoToRevit,
5723
+ Tr as windowTransport
5569
5724
  };
5570
5725
  //# sourceMappingURL=index.es.js.map