@thatopen/services 0.28.0 → 0.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,9 +1,9 @@
1
- var dn = Object.defineProperty;
1
+ var un = Object.defineProperty;
2
2
  var as = (n) => {
3
3
  throw TypeError(n);
4
4
  };
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);
5
+ var fn = (n, e, t) => e in n ? un(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
6
+ var B = (n, e, t) => fn(n, typeof e != "symbol" ? e + "" : e, t), Tt = (n, e, t) => e.has(n) || as("Cannot " + t);
7
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
8
  const ne = /* @__PURE__ */ Object.create(null);
9
9
  ne.open = "0";
@@ -17,7 +17,7 @@ const lt = /* @__PURE__ */ Object.create(null);
17
17
  Object.keys(ne).forEach((n) => {
18
18
  lt[ne[n]] = n;
19
19
  });
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) => {
20
+ const Ct = { type: "error", data: "parser error" }, Cs = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", $s = typeof ArrayBuffer == "function", xs = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n && n.buffer instanceof ArrayBuffer, Zt = ({ type: n, data: e }, t, s) => Cs && e instanceof Blob ? t ? s(e) : cs(e, s) : $s && (e instanceof ArrayBuffer || xs(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];
@@ -28,10 +28,10 @@ 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
30
  let _t;
31
- function fn(n, e) {
32
- if (Rs && n.data instanceof Blob)
31
+ function pn(n, e) {
32
+ if (Cs && n.data instanceof Blob)
33
33
  return n.data.arrayBuffer().then(hs).then(e);
34
- if (Cs && (n.data instanceof ArrayBuffer || $s(n.data)))
34
+ if ($s && (n.data instanceof ArrayBuffer || xs(n.data)))
35
35
  return e(hs(n.data));
36
36
  Zt(n, !1, (t) => {
37
37
  _t || (_t = new TextEncoder()), e(_t.encode(t));
@@ -40,36 +40,36 @@ function fn(n, e) {
40
40
  const ls = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Je = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
41
41
  for (let n = 0; n < ls.length; n++)
42
42
  Je[ls.charCodeAt(n)] = n;
43
- const pn = (n) => {
43
+ const mn = (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
46
  const d = new ArrayBuffer(e), c = new Uint8Array(d);
47
47
  for (s = 0; s < t; s += 4)
48
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
49
  return d;
50
- }, mn = typeof ArrayBuffer == "function", es = (n, e) => {
50
+ }, yn = typeof ArrayBuffer == "function", es = (n, e) => {
51
51
  if (typeof n != "string")
52
52
  return {
53
53
  type: "message",
54
- data: xs(n, e)
54
+ data: Ns(n, e)
55
55
  };
56
56
  const t = n.charAt(0);
57
57
  return t === "b" ? {
58
58
  type: "message",
59
- data: yn(n.substring(1), e)
59
+ data: gn(n.substring(1), e)
60
60
  } : lt[t] ? n.length > 1 ? {
61
61
  type: lt[t],
62
62
  data: n.substring(1)
63
63
  } : {
64
64
  type: lt[t]
65
65
  } : Ct;
66
- }, yn = (n, e) => {
67
- if (mn) {
68
- const t = pn(n);
69
- return xs(t, e);
66
+ }, gn = (n, e) => {
67
+ if (yn) {
68
+ const t = mn(n);
69
+ return Ns(t, e);
70
70
  } else
71
71
  return { base64: !0, data: n };
72
- }, xs = (n, e) => {
72
+ }, Ns = (n, e) => {
73
73
  switch (e) {
74
74
  case "blob":
75
75
  return n instanceof Blob ? n : new Blob([n]);
@@ -77,16 +77,16 @@ const pn = (n) => {
77
77
  default:
78
78
  return n instanceof ArrayBuffer ? n : n.buffer;
79
79
  }
80
- }, Ns = "", gn = (n, e) => {
80
+ }, Ps = "", wn = (n, e) => {
81
81
  const t = n.length, s = new Array(t);
82
82
  let r = 0;
83
83
  n.forEach((i, o) => {
84
84
  Zt(i, !1, (a) => {
85
- s[o] = a, ++r === t && e(s.join(Ns));
85
+ s[o] = a, ++r === t && e(s.join(Ps));
86
86
  });
87
87
  });
88
- }, wn = (n, e) => {
89
- const t = n.split(Ns), s = [];
88
+ }, bn = (n, e) => {
89
+ const t = n.split(Ps), s = [];
90
90
  for (let r = 0; r < t.length; r++) {
91
91
  const i = es(t[r], e);
92
92
  if (s.push(i), i.type === "error")
@@ -94,10 +94,10 @@ const pn = (n) => {
94
94
  }
95
95
  return s;
96
96
  };
97
- function bn() {
97
+ function vn() {
98
98
  return new TransformStream({
99
99
  transform(n, e) {
100
- fn(n, (t) => {
100
+ pn(n, (t) => {
101
101
  const s = t.length;
102
102
  let r;
103
103
  if (s < 126)
@@ -129,7 +129,7 @@ function ot(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 vn(n, e) {
132
+ function En(n, e) {
133
133
  It || (It = new TextDecoder());
134
134
  const t = [];
135
135
  let s = 0, r = -1, i = !1;
@@ -169,11 +169,11 @@ function vn(n, e) {
169
169
  }
170
170
  });
171
171
  }
172
- const Ps = 4;
172
+ const Bs = 4;
173
173
  function C(n) {
174
- if (n) return En(n);
174
+ if (n) return Tn(n);
175
175
  }
176
- function En(n) {
176
+ function Tn(n) {
177
177
  for (var e in C.prototype)
178
178
  n[e] = C.prototype[e];
179
179
  return n;
@@ -219,19 +219,19 @@ C.prototype.listeners = function(n) {
219
219
  C.prototype.hasListeners = function(n) {
220
220
  return !!this.listeners(n).length;
221
221
  };
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) {
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")(), _n = "arraybuffer";
223
+ function Fs(n, ...e) {
224
224
  return e.reduce((t, s) => (n.hasOwnProperty(s) && (t[s] = n[s]), t), {});
225
225
  }
226
- const _n = V.setTimeout, In = V.clearTimeout;
226
+ const In = V.setTimeout, Sn = V.clearTimeout;
227
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
- }
230
- const Sn = 1.33;
231
- function kn(n) {
232
- return typeof n == "string" ? On(n) : Math.ceil((n.byteLength || n.size) * Sn);
228
+ e.useNativeTimers ? (n.setTimeoutFn = In.bind(V), n.clearTimeoutFn = Sn.bind(V)) : (n.setTimeoutFn = V.setTimeout.bind(V), n.clearTimeoutFn = V.clearTimeout.bind(V));
233
229
  }
230
+ const kn = 1.33;
234
231
  function On(n) {
232
+ return typeof n == "string" ? An(n) : Math.ceil((n.byteLength || n.size) * kn);
233
+ }
234
+ function An(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);
@@ -240,13 +240,13 @@ function On(n) {
240
240
  function Ls() {
241
241
  return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
242
242
  }
243
- function An(n) {
243
+ function Rn(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 Rn(n) {
249
+ function Cn(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,7 +254,7 @@ function Rn(n) {
254
254
  }
255
255
  return e;
256
256
  }
257
- class Cn extends Error {
257
+ class $n extends Error {
258
258
  constructor(e, t, s) {
259
259
  super(e), this.description = t, this.context = s, this.type = "TransportError";
260
260
  }
@@ -279,7 +279,7 @@ class ts extends C {
279
279
  * @protected
280
280
  */
281
281
  onError(e, t, s) {
282
- return super.emitReserved("error", new Cn(e, t, s)), this;
282
+ return super.emitReserved("error", new $n(e, t, s)), this;
283
283
  }
284
284
  /**
285
285
  * Opens the transport.
@@ -353,11 +353,11 @@ class ts extends C {
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 = An(e);
356
+ const t = Rn(e);
357
357
  return t.length ? "?" + t : "";
358
358
  }
359
359
  }
360
- class $n extends ts {
360
+ class xn extends ts {
361
361
  constructor() {
362
362
  super(...arguments), this._polling = !1;
363
363
  }
@@ -413,7 +413,7 @@ class $n extends ts {
413
413
  return this.onClose({ description: "transport closed by the server" }), !1;
414
414
  this.onPacket(s);
415
415
  };
416
- wn(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
416
+ bn(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 $n extends ts {
433
433
  * @protected
434
434
  */
435
435
  write(e) {
436
- this.writable = !1, gn(e, (t) => {
436
+ this.writable = !1, wn(e, (t) => {
437
437
  this.doWrite(t, () => {
438
438
  this.writable = !0, this.emitReserved("drain");
439
439
  });
@@ -449,15 +449,15 @@ class $n extends ts {
449
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 Fs = !1;
452
+ let Ds = !1;
453
453
  try {
454
- Fs = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
454
+ Ds = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
455
455
  } catch {
456
456
  }
457
- const xn = Fs;
458
- function Nn() {
457
+ const Nn = Ds;
458
+ function Pn() {
459
459
  }
460
- class Pn extends $n {
460
+ class Bn extends xn {
461
461
  /**
462
462
  * XHR Polling constructor.
463
463
  *
@@ -516,7 +516,7 @@ class se extends C {
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 = Fs(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 {
@@ -570,7 +570,7 @@ class se extends C {
570
570
  */
571
571
  _cleanup(e) {
572
572
  if (!(typeof this._xhr > "u" || this._xhr === null)) {
573
- if (this._xhr.onreadystatechange = Nn, e)
573
+ if (this._xhr.onreadystatechange = Pn, e)
574
574
  try {
575
575
  this._xhr.abort();
576
576
  } catch {
@@ -610,26 +610,26 @@ function ds() {
610
610
  for (let n in se.requests)
611
611
  se.requests.hasOwnProperty(n) && se.requests[n].abort();
612
612
  }
613
- const Bn = function() {
614
- const n = Ds({
613
+ const Fn = function() {
614
+ const n = qs({
615
615
  xdomain: !1
616
616
  });
617
617
  return n && n.responseType !== null;
618
618
  }();
619
- class Ln extends Pn {
619
+ class Ln extends Bn {
620
620
  constructor(e) {
621
621
  super(e);
622
622
  const t = e && e.forceBase64;
623
- this.supportsBinary = Bn && !t;
623
+ this.supportsBinary = Fn && !t;
624
624
  }
625
625
  request(e = {}) {
626
- return Object.assign(e, { xd: this.xd }, this.opts), new se(Ds, this.uri(), e);
626
+ return Object.assign(e, { xd: this.xd }, this.opts), new se(qs, this.uri(), e);
627
627
  }
628
628
  }
629
- function Ds(n) {
629
+ function qs(n) {
630
630
  const e = n.xdomain;
631
631
  try {
632
- if (typeof XMLHttpRequest < "u" && (!e || xn))
632
+ if (typeof XMLHttpRequest < "u" && (!e || Nn))
633
633
  return new XMLHttpRequest();
634
634
  } catch {
635
635
  }
@@ -639,13 +639,13 @@ function Ds(n) {
639
639
  } catch {
640
640
  }
641
641
  }
642
- const qs = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
643
- class Fn extends ts {
642
+ const js = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
643
+ class Dn 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 = qs ? {} : 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 = js ? {} : Fs(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);
@@ -697,15 +697,15 @@ class Fn extends ts {
697
697
  }
698
698
  }
699
699
  const St = V.WebSocket || V.MozWebSocket;
700
- class Dn extends Fn {
700
+ class qn extends Dn {
701
701
  createSocket(e, t, s) {
702
- return qs ? new St(e, t, s) : t ? new St(e, t) : new St(e);
702
+ return js ? 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 qn extends ts {
708
+ class jn extends ts {
709
709
  get name() {
710
710
  return "webtransport";
711
711
  }
@@ -721,7 +721,7 @@ class qn extends ts {
721
721
  this.onError("webtransport error", e);
722
722
  }), this._transport.ready.then(() => {
723
723
  this._transport.createBidirectionalStream().then((e) => {
724
- const t = vn(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), r = bn();
724
+ const t = En(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), r = vn();
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 }) => {
@@ -751,11 +751,11 @@ class qn extends ts {
751
751
  (e = this._transport) === null || e === void 0 || e.close();
752
752
  }
753
753
  }
754
- const jn = {
755
- websocket: Dn,
756
- webtransport: qn,
754
+ const Un = {
755
+ websocket: qn,
756
+ webtransport: jn,
757
757
  polling: Ln
758
- }, Un = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, Mn = [
758
+ }, Mn = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, Vn = [
759
759
  "source",
760
760
  "protocol",
761
761
  "authority",
@@ -776,16 +776,16 @@ function $t(n) {
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 = Un.exec(n || ""), i = {}, o = 14;
779
+ let r = Mn.exec(n || ""), i = {}, o = 14;
780
780
  for (; o--; )
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;
781
+ i[Vn[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 = Hn(i, i.path), i.queryKey = Gn(i, i.query), i;
783
783
  }
784
- function Vn(n, e) {
784
+ function Hn(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 Hn(n, e) {
788
+ function Gn(n, e) {
789
789
  const t = {};
790
790
  return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(s, r, i) {
791
791
  r && (t[r] = i);
@@ -803,7 +803,7 @@ class ge extends C {
803
803
  * @param {Object} opts - options
804
804
  */
805
805
  constructor(e, t) {
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) {
806
+ if (super(), this.binaryType = _n, 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
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
809
  } else t.host && (t.hostname = $t(t.host).host);
@@ -824,7 +824,7 @@ class ge extends C {
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 = Rn(this.opts.query)), xt && (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 = Cn(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", {
@@ -841,7 +841,7 @@ class ge extends C {
841
841
  */
842
842
  createTransport(e) {
843
843
  const t = Object.assign({}, this.opts.query);
844
- t.EIO = Ps, t.transport = e, this.id && (t.sid = this.id);
844
+ t.EIO = Bs, 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,
@@ -959,7 +959,7 @@ class ge extends C {
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 += kn(r)), s > 0 && t > this._maxPayload)
962
+ if (r && (t += On(r)), s > 0 && t > this._maxPayload)
963
963
  return this.writeBuffer.slice(0, s);
964
964
  t += 2;
965
965
  }
@@ -1065,8 +1065,8 @@ class ge extends C {
1065
1065
  }
1066
1066
  }
1067
1067
  }
1068
- ge.protocol = Ps;
1069
- class Gn extends ge {
1068
+ ge.protocol = Bs;
1069
+ class Jn extends ge {
1070
1070
  constructor() {
1071
1071
  super(...arguments), this._upgrades = [];
1072
1072
  }
@@ -1138,21 +1138,21 @@ class Gn extends ge {
1138
1138
  return t;
1139
1139
  }
1140
1140
  }
1141
- let Jn = class extends Gn {
1141
+ let Wn = class extends Jn {
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) => jn[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) => Un[i]).filter((i) => !!i)), super(s ? r : e, r);
1145
1145
  }
1146
1146
  };
1147
- function Wn(n, e = "", t) {
1147
+ function Yn(n, e = "", t) {
1148
1148
  let s = n;
1149
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 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]";
1153
+ const zn = typeof ArrayBuffer == "function", Kn = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n.buffer instanceof ArrayBuffer, Us = Object.prototype.toString, Xn = typeof Blob == "function" || typeof Blob < "u" && Us.call(Blob) === "[object BlobConstructor]", Qn = typeof File == "function" || typeof File < "u" && Us.call(File) === "[object FileConstructor]";
1154
1154
  function ss(n) {
1155
- return Yn && (n instanceof ArrayBuffer || zn(n)) || Kn && n instanceof Blob || Xn && n instanceof File;
1155
+ return zn && (n instanceof ArrayBuffer || Kn(n)) || Xn && n instanceof Blob || Qn && n instanceof File;
1156
1156
  }
1157
1157
  function ut(n, e) {
1158
1158
  if (!n || typeof n != "object")
@@ -1172,7 +1172,7 @@ function ut(n, e) {
1172
1172
  return !0;
1173
1173
  return !1;
1174
1174
  }
1175
- function Qn(n) {
1175
+ function Zn(n) {
1176
1176
  const e = [], t = n.data, s = n;
1177
1177
  return s.data = Nt(t, e), s.attachments = e.length, { packet: s, buffers: e };
1178
1178
  }
@@ -1195,7 +1195,7 @@ function Nt(n, e) {
1195
1195
  }
1196
1196
  return n;
1197
1197
  }
1198
- function Zn(n, e) {
1198
+ function er(n, e) {
1199
1199
  return n.data = Pt(n.data, e), delete n.attachments, n;
1200
1200
  }
1201
1201
  function Pt(n, e) {
@@ -1213,7 +1213,7 @@ function Pt(n, e) {
1213
1213
  Object.prototype.hasOwnProperty.call(n, t) && (n[t] = Pt(n[t], e));
1214
1214
  return n;
1215
1215
  }
1216
- const er = [
1216
+ const tr = [
1217
1217
  "connect",
1218
1218
  // used on the client side
1219
1219
  "connect_error",
@@ -1231,7 +1231,7 @@ 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
1233
  })(v || (v = {}));
1234
- class tr {
1234
+ class sr {
1235
1235
  /**
1236
1236
  * Encoder constructor
1237
1237
  *
@@ -1267,7 +1267,7 @@ class tr {
1267
1267
  * a list of buffers.
1268
1268
  */
1269
1269
  encodeAsBinary(e) {
1270
- const t = Qn(e), s = this.encodeAsString(t.packet), r = t.buffers;
1270
+ const t = Zn(e), s = this.encodeAsString(t.packet), r = t.buffers;
1271
1271
  return r.unshift(s), r;
1272
1272
  }
1273
1273
  }
@@ -1293,7 +1293,7 @@ class ns extends C {
1293
1293
  throw new Error("got plaintext data when reconstructing a packet");
1294
1294
  t = this.decodeString(e);
1295
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);
1296
+ s || t.type === v.BINARY_ACK ? (t.type = s ? v.EVENT : v.ACK, this.reconstructor = new nr(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t);
1297
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));
@@ -1323,7 +1323,7 @@ class ns extends C {
1323
1323
  if (o != Number(o) || e.charAt(t) !== "-")
1324
1324
  throw new Error("Illegal attachments");
1325
1325
  const a = Number(o);
1326
- if (!nr(a) || a < 0)
1326
+ if (!rr(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");
@@ -1376,7 +1376,7 @@ class ns extends C {
1376
1376
  return typeof t == "string" || us(t);
1377
1377
  case v.EVENT:
1378
1378
  case v.BINARY_EVENT:
1379
- return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && er.indexOf(t[0]) === -1);
1379
+ return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && tr.indexOf(t[0]) === -1);
1380
1380
  case v.ACK:
1381
1381
  case v.BINARY_ACK:
1382
1382
  return Array.isArray(t);
@@ -1389,7 +1389,7 @@ class ns extends C {
1389
1389
  this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
1390
1390
  }
1391
1391
  }
1392
- class sr {
1392
+ class nr {
1393
1393
  constructor(e) {
1394
1394
  this.packet = e, this.buffers = [], this.reconPack = e;
1395
1395
  }
@@ -1403,7 +1403,7 @@ class sr {
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 = er(this.reconPack, this.buffers);
1407
1407
  return this.finishedReconstruction(), t;
1408
1408
  }
1409
1409
  return null;
@@ -1415,16 +1415,16 @@ class sr {
1415
1415
  this.reconPack = null, this.buffers = [];
1416
1416
  }
1417
1417
  }
1418
- const nr = Number.isInteger || function(n) {
1418
+ const rr = Number.isInteger || function(n) {
1419
1419
  return typeof n == "number" && isFinite(n) && Math.floor(n) === n;
1420
1420
  };
1421
1421
  function us(n) {
1422
1422
  return Object.prototype.toString.call(n) === "[object Object]";
1423
1423
  }
1424
- const rr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1424
+ const ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1425
1425
  __proto__: null,
1426
1426
  Decoder: ns,
1427
- Encoder: tr,
1427
+ Encoder: sr,
1428
1428
  get PacketType() {
1429
1429
  return v;
1430
1430
  }
@@ -1434,7 +1434,7 @@ function Y(n, e, t) {
1434
1434
  n.off(e, t);
1435
1435
  };
1436
1436
  }
1437
- const ir = Object.freeze({
1437
+ const or = Object.freeze({
1438
1438
  connect: 1,
1439
1439
  connect_error: 1,
1440
1440
  disconnect: 1,
@@ -1443,7 +1443,7 @@ const ir = Object.freeze({
1443
1443
  newListener: 1,
1444
1444
  removeListener: 1
1445
1445
  });
1446
- class Us extends C {
1446
+ class Ms extends C {
1447
1447
  /**
1448
1448
  * `Socket` constructor.
1449
1449
  */
@@ -1559,7 +1559,7 @@ class Us extends C {
1559
1559
  */
1560
1560
  emit(e, ...t) {
1561
1561
  var s, r, i;
1562
- if (ir.hasOwnProperty(e))
1562
+ if (or.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;
@@ -2035,10 +2035,10 @@ class Us extends C {
2035
2035
  }
2036
2036
  }
2037
2037
  }
2038
- function Fe(n) {
2038
+ function Le(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
- Fe.prototype.duration = function() {
2041
+ Le.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 @@ Fe.prototype.duration = function() {
2046
2046
  }
2047
2047
  return Math.min(n, this.max) | 0;
2048
2048
  };
2049
- Fe.prototype.reset = function() {
2049
+ Le.prototype.reset = function() {
2050
2050
  this.attempts = 0;
2051
2051
  };
2052
- Fe.prototype.setMin = function(n) {
2052
+ Le.prototype.setMin = function(n) {
2053
2053
  this.ms = n;
2054
2054
  };
2055
- Fe.prototype.setMax = function(n) {
2055
+ Le.prototype.setMax = function(n) {
2056
2056
  this.max = n;
2057
2057
  };
2058
- Fe.prototype.setJitter = function(n) {
2058
+ Le.prototype.setJitter = function(n) {
2059
2059
  this.jitter = n;
2060
2060
  };
2061
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, 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({
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 Le({
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 || rr;
2069
+ const r = t.parser || ir;
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,7 +2109,7 @@ class Bt extends C {
2109
2109
  open(e) {
2110
2110
  if (~this._readyState.indexOf("open"))
2111
2111
  return this;
2112
- this.engine = new Jn(this.uri, this.opts);
2112
+ this.engine = new Wn(this.uri, this.opts);
2113
2113
  const t = this.engine, s = this;
2114
2114
  this._readyState = "opening", this.skipReconnect = !1;
2115
2115
  const r = Y(t, "open", function() {
@@ -2199,7 +2199,7 @@ class Bt extends C {
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 Us(this, e, t), this.nsps[e] = s), s;
2202
+ return s ? this._autoConnect && !s.active && s.connect() : (s = new Ms(this, e, t), this.nsps[e] = s), s;
2203
2203
  }
2204
2204
  /**
2205
2205
  * Called upon a socket close.
@@ -2299,17 +2299,17 @@ class Bt extends C {
2299
2299
  const Ge = {};
2300
2300
  function Ke(n, e) {
2301
2301
  typeof n == "object" && (e = n, n = void 0), e = e || {};
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;
2302
+ const t = Yn(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
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
2306
  Object.assign(Ke, {
2307
2307
  Manager: Bt,
2308
- Socket: Us,
2308
+ Socket: Ms,
2309
2309
  io: Ke,
2310
2310
  connect: Ke
2311
2311
  });
2312
- const bt = "thatopen/document@1", fs = "document.json", or = [
2312
+ const bt = "thatopen/document@1", fs = "document.json", ar = [
2313
2313
  "pdf",
2314
2314
  "txt",
2315
2315
  "md",
@@ -2321,8 +2321,8 @@ const bt = "thatopen/document@1", fs = "document.json", or = [
2321
2321
  function at(n) {
2322
2322
  return String(n._id ?? n.id ?? "");
2323
2323
  }
2324
- var ke, Vs, Lt;
2325
- class Ms {
2324
+ var ke, Hs, Ft;
2325
+ class Vs {
2326
2326
  constructor(e, t) {
2327
2327
  S(this, ke);
2328
2328
  this.client = e, this.projectId = t;
@@ -2363,7 +2363,7 @@ class Ms {
2363
2363
  this.projectId
2364
2364
  ), l = at(a);
2365
2365
  await this.client.updateFile(e, { parentFolderId: l });
2366
- const d = [], c = await h(this, ke, Vs).call(this, s);
2366
+ const d = [], c = await h(this, ke, Hs).call(this, s);
2367
2367
  if (c)
2368
2368
  try {
2369
2369
  const A = await this.client.getFile(c);
@@ -2373,7 +2373,7 @@ class Ms {
2373
2373
  });
2374
2374
  } catch {
2375
2375
  }
2376
- ((t == null ? void 0 : t.selfView) ?? or.includes(i)) && d.push({ fileId: e, format: i });
2376
+ ((t == null ? void 0 : t.selfView) ?? ar.includes(i)) && d.push({ fileId: e, format: i });
2377
2377
  const T = {
2378
2378
  schema: bt,
2379
2379
  name: o,
@@ -2387,7 +2387,7 @@ class Ms {
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 h(this, ke, Lt).call(this, e);
2390
+ const t = await h(this, ke, Ft).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 Ms {
2397
2397
  } catch {
2398
2398
  return null;
2399
2399
  }
2400
- return ar(i);
2400
+ return cr(i);
2401
2401
  }
2402
2402
  /**
2403
2403
  * The first view whose format appears in `formats` — searched in the ORDER
@@ -2439,7 +2439,7 @@ class Ms {
2439
2439
  views: t.views ?? []
2440
2440
  }, r = new Blob([JSON.stringify(s)], {
2441
2441
  type: "application/json"
2442
- }), i = await h(this, ke, Lt).call(this, e);
2442
+ }), i = await h(this, ke, Ft).call(this, e);
2443
2443
  if (i) {
2444
2444
  await this.client.updateFile(i.id, {
2445
2445
  file: r,
@@ -2456,7 +2456,7 @@ class Ms {
2456
2456
  });
2457
2457
  }
2458
2458
  }
2459
- ke = new WeakSet(), Vs = async function(e) {
2459
+ ke = new WeakSet(), Hs = async function(e) {
2460
2460
  const t = [...e.versions ?? []].sort(
2461
2461
  (s, r) => String(r.createdAt ?? "").localeCompare(String(s.createdAt ?? ""))
2462
2462
  );
@@ -2469,7 +2469,7 @@ ke = new WeakSet(), Vs = async function(e) {
2469
2469
  if (typeof i == "string" && i) return i;
2470
2470
  } catch {
2471
2471
  }
2472
- }, Lt = async function(e) {
2472
+ }, Ft = async function(e) {
2473
2473
  const s = (await this.client.listFiles({ folderId: e })).find(
2474
2474
  (r) => String(r.name ?? "") === fs
2475
2475
  );
@@ -2481,7 +2481,7 @@ function ms(n, e) {
2481
2481
  const s = n.lastIndexOf(".");
2482
2482
  return s > 0 ? n.slice(s + 1).toLowerCase() : "";
2483
2483
  }
2484
- function ar(n) {
2484
+ function cr(n) {
2485
2485
  if (!n || typeof n != "object") return null;
2486
2486
  const e = n;
2487
2487
  if (e.schema !== bt || typeof e.name != "string") return null;
@@ -2502,15 +2502,21 @@ class ys extends Error {
2502
2502
  ), this.expectedGuid = e, this.actualGuid = t, this.name = "StaleHistoryError";
2503
2503
  }
2504
2504
  }
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) {
2505
+ const gs = "bimterop", Lt = "revitflow_history.json", Re = "revitflow_ops.json", ws = "revitflow/ops@1", Gs = "revitflow_model.frag", Js = "revitflow_", hr = "bimterop-locks-anchor", ct = () => `v-${Date.now()}`;
2506
+ function Ws(n, e) {
2507
2507
  return n.filter((t) => String(t.parentId ?? "") === e);
2508
2508
  }
2509
+ function bs(n) {
2510
+ const e = n == null ? void 0 : n.hiddenFileId;
2511
+ if (typeof e != "string" || !e)
2512
+ throw new Error("The hidden-file upload answered without a hiddenFileId.");
2513
+ return e;
2514
+ }
2509
2515
  function te(n) {
2510
2516
  return String(n._id ?? n.id ?? "");
2511
2517
  }
2512
2518
  var W, Xe, Dt;
2513
- class hr {
2519
+ class lr {
2514
2520
  constructor(e, t) {
2515
2521
  S(this, Xe);
2516
2522
  S(this, W);
@@ -2524,16 +2530,16 @@ class hr {
2524
2530
  parentFolderId: e,
2525
2531
  projectId: this.projectId
2526
2532
  }), s = [];
2527
- for (const r of Js(t, e)) {
2533
+ for (const r of Ws(t, e)) {
2528
2534
  const i = String(r.name ?? ""), o = i.indexOf("-");
2529
2535
  if (o <= 0) continue;
2530
2536
  const l = (await this.client.listFiles({
2531
2537
  folderId: te(r)
2532
2538
  })).map(
2533
2539
  (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;
2540
+ ), d = l.find((m) => m === Gs) ?? l.find(
2541
+ (m) => m.endsWith(".frag") && !m.startsWith(Js)
2542
+ ), c = l.includes(Lt) || l.includes(Re) || !!d;
2537
2543
  s.push({
2538
2544
  source: i.slice(0, o),
2539
2545
  docId: i.slice(o + 1),
@@ -2546,7 +2552,7 @@ class hr {
2546
2552
  }
2547
2553
  /** One document's history. `source` and `docId` as {@link docs} lists them. */
2548
2554
  doc(e, t) {
2549
- return new lr(this.client, this, e, t);
2555
+ return new dr(this.client, this, e, t);
2550
2556
  }
2551
2557
  /** @internal The `bimterop` folder id, resolved once. */
2552
2558
  async rootFolderId(e = !1) {
@@ -2571,8 +2577,8 @@ W = new WeakMap(), Xe = new WeakSet(), Dt = async function() {
2571
2577
  );
2572
2578
  return t && R(this, W, te(t)), u(this, W);
2573
2579
  };
2574
- var oe, p, ie, Ce, ee, qt, We, de, jt, ft, Ye, pt, Ut, Ws;
2575
- class lr {
2580
+ var oe, p, ie, Ce, ee, qt, We, de, jt, ft, Ye, pt, Ut, Ys;
2581
+ class dr {
2576
2582
  constructor(e, t, s, r) {
2577
2583
  S(this, p);
2578
2584
  S(this, oe);
@@ -2586,7 +2592,7 @@ class lr {
2586
2592
  */
2587
2593
  async timeline() {
2588
2594
  const e = await h(this, p, ft).call(this);
2589
- return Ys((e == null ? void 0 : e.commits) ?? []);
2595
+ return zs((e == null ? void 0 : e.commits) ?? []);
2590
2596
  }
2591
2597
  /** The head of the timeline, or null before the first sync. */
2592
2598
  async latest() {
@@ -2750,7 +2756,7 @@ class lr {
2750
2756
  * claims counts only for the earliest one, matching the plugins' rule.
2751
2757
  */
2752
2758
  async ownership() {
2753
- const e = await h(this, p, We).call(this, cr);
2759
+ const e = await h(this, p, We).call(this, hr);
2754
2760
  if (!e) return [];
2755
2761
  const t = await this.client.getHiddenFilesByParent(e.id), s = await Promise.all(
2756
2762
  t.map(async (o) => {
@@ -2792,7 +2798,7 @@ class lr {
2792
2798
  model: this.docId,
2793
2799
  commits: []
2794
2800
  };
2795
- const r = bs(s.commits);
2801
+ const r = vs(s.commits);
2796
2802
  if (e.expectedLatestGuid !== void 0 && (r == null ? void 0 : r.guid) !== e.expectedLatestGuid)
2797
2803
  throw new ys(e.expectedLatestGuid, r == null ? void 0 : r.guid);
2798
2804
  const i = {
@@ -2805,9 +2811,9 @@ class lr {
2805
2811
  ...e.userId ? { userId: e.userId } : {},
2806
2812
  ...(a = e.appliedOps) != null && a.length ? { appliedOps: e.appliedOps } : {},
2807
2813
  changes: e.changes,
2808
- counts: dr(e.changes)
2814
+ counts: ur(e.changes)
2809
2815
  };
2810
- if (e.model && (await h(this, p, Ws).call(this, t, e.model), i.full = !0), e.delta) {
2816
+ if (e.model && (await h(this, p, Ys).call(this, t, e.model), i.full = !0), e.delta) {
2811
2817
  const l = await h(this, p, de).call(this);
2812
2818
  if (!l)
2813
2819
  throw new Error(
@@ -2817,19 +2823,17 @@ class lr {
2817
2823
  e.delta,
2818
2824
  l.id
2819
2825
  );
2820
- i.deltaId = String(
2821
- d._id ?? d.id
2822
- );
2826
+ i.deltaId = bs(d);
2823
2827
  }
2824
2828
  const o = await h(this, p, ft).call(this);
2825
2829
  if (o) {
2826
2830
  s = o;
2827
- const l = bs(s.commits);
2831
+ const l = vs(s.commits);
2828
2832
  if (e.expectedLatestGuid !== void 0 && (l == null ? void 0 : l.guid) !== e.expectedLatestGuid)
2829
2833
  throw new ys(e.expectedLatestGuid, l == null ? void 0 : l.guid);
2830
2834
  l && !i.parents && (i.parents = [l.guid]);
2831
2835
  }
2832
- return s.commits.push(i), await h(this, p, pt).call(this, t, Ft, s), i;
2836
+ return s.commits.push(i), await h(this, p, pt).call(this, t, Lt, s), i;
2833
2837
  }
2834
2838
  // ─── Suggestions (change requests) ────────────────────────────────────────
2835
2839
  /** Every suggestion in the document's queue, pending or resolved. */
@@ -2864,9 +2868,7 @@ class lr {
2864
2868
  e.payload,
2865
2869
  a.id
2866
2870
  );
2867
- i.fragId = String(
2868
- l._id ?? l.id
2869
- );
2871
+ i.fragId = bs(l);
2870
2872
  }
2871
2873
  const o = await h(this, p, Ye).call(this) ?? s;
2872
2874
  return o.schema ?? (o.schema = ws), o.ops.push(i), await h(this, p, pt).call(this, t, Re, o), i;
@@ -2892,7 +2894,7 @@ class lr {
2892
2894
  }
2893
2895
  }
2894
2896
  oe = new WeakMap(), p = new WeakSet(), ie = function() {
2895
- return new Ms(this.client, this.project.projectId);
2897
+ return new Vs(this.client, this.project.projectId);
2896
2898
  }, Ce = function() {
2897
2899
  return `${this.source}-${this.docId}`;
2898
2900
  }, ee = async function(e) {
@@ -2905,7 +2907,7 @@ oe = new WeakMap(), p = new WeakSet(), ie = function() {
2905
2907
  const s = await this.client.listFolders({
2906
2908
  parentFolderId: t,
2907
2909
  projectId: this.project.projectId
2908
- }), r = Js(s, t).find(
2910
+ }), r = Ws(s, t).find(
2909
2911
  (o) => String(o.name ?? "") === u(this, p, Ce)
2910
2912
  );
2911
2913
  if (r)
@@ -2935,8 +2937,8 @@ oe = new WeakMap(), p = new WeakSet(), ie = function() {
2935
2937
  }, de = async function() {
2936
2938
  try {
2937
2939
  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)
2940
+ return e.find((t) => t.name === Gs) ?? e.find(
2941
+ (t) => t.name.endsWith(".frag") && !t.name.startsWith(Js)
2940
2942
  );
2941
2943
  } catch {
2942
2944
  return;
@@ -2948,7 +2950,7 @@ oe = new WeakMap(), p = new WeakSet(), ie = function() {
2948
2950
  if (r.trim())
2949
2951
  return JSON.parse(r);
2950
2952
  }, ft = function() {
2951
- return h(this, p, jt).call(this, Ft);
2953
+ return h(this, p, jt).call(this, Lt);
2952
2954
  }, Ye = function() {
2953
2955
  return h(this, p, jt).call(this, Re);
2954
2956
  }, pt = async function(e, t, s) {
@@ -2970,7 +2972,7 @@ oe = new WeakMap(), p = new WeakSet(), ie = function() {
2970
2972
  projectId: this.project.projectId
2971
2973
  }), o = i.item;
2972
2974
  return { id: te(o ?? i), name: t };
2973
- }, Ws = async function(e, t) {
2975
+ }, Ys = async function(e, t) {
2974
2976
  const s = await h(this, p, de).call(this);
2975
2977
  if (s)
2976
2978
  return await this.client.updateFile(s.id, {
@@ -2986,13 +2988,13 @@ oe = new WeakMap(), p = new WeakSet(), ie = function() {
2986
2988
  }), o = i.item;
2987
2989
  return { id: te(o ?? i), name: r };
2988
2990
  };
2989
- function dr(n) {
2991
+ function ur(n) {
2990
2992
  const e = { added: 0, modified: 0, removed: 0 };
2991
2993
  for (const t of n)
2992
2994
  t.type === "create" ? e.added++ : t.type === "delete" ? e.removed++ : e.modified++;
2993
2995
  return e;
2994
2996
  }
2995
- function Ys(n) {
2997
+ function zs(n) {
2996
2998
  var l;
2997
2999
  if (n.length <= 1)
2998
3000
  return n.forEach((d, c) => d.ordinal = c), [...n];
@@ -3019,8 +3021,8 @@ function Ys(n) {
3019
3021
  a.has(d.guid) || i.push(d);
3020
3022
  return i.forEach((d, c) => d.ordinal = c), i;
3021
3023
  }
3022
- function bs(n) {
3023
- const e = Ys(n);
3024
+ function vs(n) {
3025
+ const e = zs(n);
3024
3026
  return e[e.length - 1];
3025
3027
  }
3026
3028
  function Mt() {
@@ -3031,7 +3033,7 @@ function Mt() {
3031
3033
  });
3032
3034
  }
3033
3035
  var fe, Qe, Vt;
3034
- class ur {
3036
+ class fr {
3035
3037
  constructor(e) {
3036
3038
  S(this, Qe);
3037
3039
  S(this, fe, /* @__PURE__ */ new Map());
@@ -3123,8 +3125,8 @@ fe = new WeakMap(), Qe = new WeakSet(), Vt = async function(e, t) {
3123
3125
  });
3124
3126
  return { recipe: s, targetDoc: r, base: i, opId: o, result: a };
3125
3127
  };
3126
- const vs = 100;
3127
- function fr(n) {
3128
+ const Es = 100;
3129
+ function pr(n) {
3128
3130
  try {
3129
3131
  const e = JSON.parse(n);
3130
3132
  if (e && typeof e == "object") {
@@ -3139,14 +3141,14 @@ function fr(n) {
3139
3141
  }
3140
3142
  return {};
3141
3143
  }
3142
- function pr(n) {
3144
+ function mr(n) {
3143
3145
  if (!n || typeof n != "object") return;
3144
3146
  const e = n.retryAfter;
3145
3147
  return typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : void 0;
3146
3148
  }
3147
3149
  class rs extends Error {
3148
3150
  constructor(t, s, r, i) {
3149
- const o = fr(r);
3151
+ const o = pr(r);
3150
3152
  super(o.message ?? `${s || "Request failed"} (${t})`);
3151
3153
  B(this, "status");
3152
3154
  B(this, "code");
@@ -3157,11 +3159,11 @@ class rs extends Error {
3157
3159
  * from `details.retryAfter`. Only present on rate-limited (429) responses.
3158
3160
  */
3159
3161
  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);
3162
+ this.name = "RequestError", this.status = t, this.code = o.code, this.details = o.details, this.body = r, this.retryAfter = i ?? mr(o.details);
3161
3163
  }
3162
3164
  }
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) {
3165
+ const Z = "item/folder", b = "item", le = "processor", yr = "npm-registry", re = "hidden", kt = "FILE", Ot = "TOOL", At = "APP", gr = 500, Ts = 3e4, wr = 0.25, br = (n) => new Promise((e) => setTimeout(e, n));
3166
+ function vr(n) {
3165
3167
  var r, i;
3166
3168
  const e = (i = (r = n.headers) == null ? void 0 : r.get) == null ? void 0 : i.call(r, "Retry-After");
3167
3169
  if (!e) return;
@@ -3171,17 +3173,17 @@ function br(n) {
3171
3173
  if (!Number.isNaN(s))
3172
3174
  return Math.max(0, (s - Date.now()) / 1e3);
3173
3175
  }
3174
- function vr(n) {
3176
+ function Er(n) {
3175
3177
  return n instanceof rs ? n.status === 429 || n.status >= 500 : !0;
3176
3178
  }
3177
- function Er(n, e) {
3179
+ function Tr(n, e) {
3178
3180
  const t = Math.min(
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;
3181
+ gr * 2 ** e,
3182
+ Ts
3183
+ ), s = t * wr * Math.random(), r = n instanceof rs && n.retryAfter != null ? n.retryAfter * 1e3 : void 0;
3184
+ return r != null ? Math.min(r, Ts) + s : t + s;
3183
3185
  }
3184
- var f, Gt, w, ue, Ze, ze, mt, yt, Jt, Wt, zs;
3186
+ var f, Gt, w, ue, Ze, ze, mt, yt, Jt, Wt, Ks;
3185
3187
  const is = class is {
3186
3188
  /**
3187
3189
  * Creates a new EngineServicesClient instance.
@@ -3786,7 +3788,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
3786
3788
  * @returns The registry, scope, read-only token, and assembled `.npmrc`.
3787
3789
  */
3788
3790
  async getNpmCredentials() {
3789
- return await h(this, f, w).call(this, "GET", `${mr}/credentials`);
3791
+ return await h(this, f, w).call(this, "GET", `${yr}/credentials`);
3790
3792
  }
3791
3793
  // ─── Execution ───────────────────────────────────────────────────
3792
3794
  /**
@@ -3911,7 +3913,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
3911
3913
  * renderable views. See `src/core/documents.ts` for the model and schema.
3912
3914
  */
3913
3915
  documents(e) {
3914
- return new Ms(this, e);
3916
+ return new Vs(this, e);
3915
3917
  }
3916
3918
  /**
3917
3919
  * A project's history of connected documents (Revit models, AutoCAD
@@ -3920,14 +3922,14 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
3920
3922
  * or write it; the storage underneath is private and will move.
3921
3923
  */
3922
3924
  history(e) {
3923
- return new hr(this, e);
3925
+ return new lr(this, e);
3924
3926
  }
3925
3927
  /**
3926
3928
  * The recipe registry and runner: scripts that write change requests in a
3927
3929
  * native application's language. See `src/core/recipes.ts`.
3928
3930
  */
3929
3931
  get recipes() {
3930
- return u(this, Ze) ?? R(this, Ze, new ur(this)), u(this, Ze);
3932
+ return u(this, Ze) ?? R(this, Ze, new fr(this)), u(this, Ze);
3931
3933
  }
3932
3934
  // ─── Hidden Files ────────────────────────────────────────────────
3933
3935
  /**
@@ -4174,7 +4176,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
4174
4176
  f = new WeakSet(), Gt = function(e) {
4175
4177
  return `${this.apiUrl}/${e}`;
4176
4178
  }, 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 = {
4179
+ 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, Ks).call(this, i), T = await this.resolveAccessToken(), A = {
4178
4180
  ...m,
4179
4181
  ...this.useBearer ? {} : { accessToken: T }
4180
4182
  };
@@ -4197,16 +4199,16 @@ f = new WeakSet(), Gt = function(e) {
4197
4199
  _.status,
4198
4200
  _.statusText,
4199
4201
  E,
4200
- br(_)
4202
+ vr(_)
4201
4203
  );
4202
4204
  }
4203
4205
  return l === "blob" ? await _.blob() : _.json().then((E) => E).catch(() => {
4204
4206
  });
4205
4207
  } catch (_) {
4206
4208
  const E = a ?? this.retries;
4207
- if (E > 0 && vr(_)) {
4209
+ if (E > 0 && Er(_)) {
4208
4210
  const N = d ?? 0;
4209
- return await wr(Er(_, N)), await h(this, f, w).call(this, e, t, {
4211
+ return await br(Tr(_, N)), await h(this, f, w).call(this, e, t, {
4210
4212
  ...s,
4211
4213
  retries: E - 1,
4212
4214
  retryAttempt: N + 1
@@ -4231,8 +4233,8 @@ f = new WeakSet(), Gt = function(e) {
4231
4233
  }, Ze = new WeakMap(), ze = async function(e, t) {
4232
4234
  if (!e.length) return [];
4233
4235
  const s = [];
4234
- for (let i = 0; i < e.length; i += vs)
4235
- s.push(e.slice(i, i + vs));
4236
+ for (let i = 0; i < e.length; i += Es)
4237
+ s.push(e.slice(i, i + Es));
4236
4238
  return (await Promise.all(s.map(t))).flat();
4237
4239
  }, mt = async function(e, t) {
4238
4240
  const { versionTag: s, withDraft: r } = t || {};
@@ -4272,14 +4274,14 @@ f = new WeakSet(), Gt = function(e) {
4272
4274
  return await h(this, f, w).call(this, "GET", `${b}/${e}`, {
4273
4275
  query: { showVersions: s }
4274
4276
  });
4275
- }, zs = function(e) {
4277
+ }, Ks = function(e) {
4276
4278
  return e && Object.entries(e).filter(([, t]) => t !== void 0).reduce(
4277
4279
  (t, [s, r]) => (t[s] = r, t),
4278
4280
  {}
4279
4281
  );
4280
4282
  };
4281
4283
  let Ht = is;
4282
- function Tr() {
4284
+ function _r() {
4283
4285
  if (typeof window > "u" || window.parent === window)
4284
4286
  throw new Error(
4285
4287
  "client.channel only works inside a That Open app, which runs in an iframe of the platform."
@@ -4294,7 +4296,7 @@ function Tr() {
4294
4296
  }
4295
4297
  };
4296
4298
  }
4297
- const Yt = "channel:", _r = 1e4;
4299
+ const Yt = "channel:", Ir = 1e4;
4298
4300
  function gt(n) {
4299
4301
  try {
4300
4302
  n();
@@ -4302,10 +4304,10 @@ function gt(n) {
4302
4304
  console.error("[channel] a listener threw:", e);
4303
4305
  }
4304
4306
  }
4305
- var ae, U, M, xe, Ne, Pe, L, zt, Kt, $e;
4306
- class Ks {
4307
+ var ae, U, M, xe, Ne, Pe, F, zt, Kt, $e;
4308
+ class Xs {
4307
4309
  constructor(e, t) {
4308
- S(this, L);
4310
+ S(this, F);
4309
4311
  S(this, ae, !1);
4310
4312
  S(this, U, []);
4311
4313
  S(this, M, []);
@@ -4327,11 +4329,11 @@ class Ks {
4327
4329
  * refuses or does not answer in time. Joining twice is harmless.
4328
4330
  */
4329
4331
  join() {
4330
- return u(this, ae) ? Promise.resolve() : h(this, L, zt).call(this, "joined", this.controls.join);
4332
+ return u(this, ae) ? Promise.resolve() : h(this, F, zt).call(this, "joined", this.controls.join);
4331
4333
  }
4332
4334
  /** Leaves the room. Handlers stay registered, so `join()` resumes them. */
4333
4335
  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);
4336
+ return !u(this, ae) && !u(this, M).some((e) => e.want === "joined") ? Promise.resolve() : h(this, F, zt).call(this, "left", this.controls.leave);
4335
4337
  }
4336
4338
  /** Fires when `joined` or `peers` changes. Returns a function that stops it. */
4337
4339
  onChange(e) {
@@ -4345,24 +4347,24 @@ class Ks {
4345
4347
  }
4346
4348
  /** @internal */
4347
4349
  applyJoined() {
4348
- R(this, ae, !0), h(this, L, Kt).call(this, "joined"), h(this, L, $e).call(this);
4350
+ R(this, ae, !0), h(this, F, Kt).call(this, "joined"), h(this, F, $e).call(this);
4349
4351
  }
4350
4352
  /** @internal */
4351
4353
  applyLeft() {
4352
- R(this, ae, !1), R(this, U, []), h(this, L, Kt).call(this, "left"), h(this, L, $e).call(this);
4354
+ R(this, ae, !1), R(this, U, []), h(this, F, Kt).call(this, "left"), h(this, F, $e).call(this);
4353
4355
  }
4354
4356
  /** @internal */
4355
4357
  applyPeers(e) {
4356
- R(this, U, e), h(this, L, $e).call(this);
4358
+ R(this, U, e), h(this, F, $e).call(this);
4357
4359
  }
4358
4360
  /** @internal */
4359
4361
  applyPeerJoined(e) {
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));
4362
+ !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, F, $e).call(this));
4361
4363
  }
4362
4364
  /** @internal */
4363
4365
  applyPeerLeft(e) {
4364
4366
  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));
4367
+ t && (R(this, U, u(this, U).filter((s) => s.from !== e)), u(this, Pe).forEach((s) => gt(() => s(t))), h(this, F, $e).call(this));
4366
4368
  }
4367
4369
  /** @internal */
4368
4370
  failPending(e) {
@@ -4375,7 +4377,7 @@ class Ks {
4375
4377
  this.transport.post(e);
4376
4378
  }
4377
4379
  }
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) {
4380
+ ae = new WeakMap(), U = new WeakMap(), M = new WeakMap(), xe = new WeakMap(), Ne = new WeakMap(), Pe = new WeakMap(), F = new WeakSet(), zt = function(e, t) {
4379
4381
  return new Promise((s, r) => {
4380
4382
  const i = {
4381
4383
  want: e,
@@ -4387,7 +4389,7 @@ ae = new WeakMap(), U = new WeakMap(), M = new WeakMap(), xe = new WeakMap(), Ne
4387
4389
  `The platform did not confirm ${e === "joined" ? "joining" : "leaving"} in time.`
4388
4390
  )
4389
4391
  );
4390
- }, _r)
4392
+ }, Ir)
4391
4393
  };
4392
4394
  u(this, M).push(i), this.transport.post({ type: "APP_CHANNEL_CONTROL", ...t });
4393
4395
  });
@@ -4400,7 +4402,7 @@ ae = new WeakMap(), U = new WeakMap(), M = new WeakMap(), xe = new WeakMap(), Ne
4400
4402
  u(this, xe).forEach((e) => gt(e));
4401
4403
  };
4402
4404
  var Be;
4403
- class Ir extends Ks {
4405
+ class Sr extends Xs {
4404
4406
  /** @internal Use `client.channel.collab()`. */
4405
4407
  constructor(t) {
4406
4408
  super(t, {
@@ -4432,13 +4434,13 @@ class Ir extends Ks {
4432
4434
  async handle(t) {
4433
4435
  const s = u(this, Be).get(t.type);
4434
4436
  if (!(s != null && s.size)) return { handled: !1 };
4435
- const r = Xs(t);
4437
+ const r = Qs(t);
4436
4438
  return s.forEach((i) => gt(() => i(t.payload, r))), { handled: !0 };
4437
4439
  }
4438
4440
  }
4439
4441
  Be = new WeakMap();
4440
4442
  var pe;
4441
- class Sr extends Ks {
4443
+ class kr extends Xs {
4442
4444
  /** @internal Use `client.channel.external(kind)`. */
4443
4445
  constructor(t, s) {
4444
4446
  super(t, {
@@ -4476,7 +4478,7 @@ class Sr extends Ks {
4476
4478
  const s = u(this, pe).get(t.type);
4477
4479
  if (!s) return { handled: !1 };
4478
4480
  try {
4479
- return { handled: !0, value: await s(t.payload, Xs(t)) };
4481
+ return { handled: !0, value: await s(t.payload, Qs(t)) };
4480
4482
  } catch (r) {
4481
4483
  return {
4482
4484
  handled: !0,
@@ -4486,7 +4488,7 @@ class Sr extends Ks {
4486
4488
  }
4487
4489
  }
4488
4490
  pe = new WeakMap();
4489
- function Xs(n) {
4491
+ function Qs(n) {
4490
4492
  return {
4491
4493
  from: n.from,
4492
4494
  at: n.at,
@@ -4494,7 +4496,7 @@ function Xs(n) {
4494
4496
  kind: n.kind
4495
4497
  };
4496
4498
  }
4497
- function kr(n) {
4499
+ function Or(n) {
4498
4500
  const e = n;
4499
4501
  if ((e == null ? void 0 : e.type) !== "THATOPEN_CHANNEL_MESSAGE") return null;
4500
4502
  const t = e.message;
@@ -4508,8 +4510,8 @@ function kr(n) {
4508
4510
  kind: typeof t.kind == "string" ? t.kind : void 0
4509
4511
  };
4510
4512
  }
4511
- var Se, et, ce, me, ye, $, Xt, wt, Qs, Zs, en, Qt;
4512
- class Or {
4513
+ var Se, et, ce, me, ye, $, Xt, wt, Zs, en, tn, Qt;
4514
+ class Ar {
4513
4515
  constructor(e) {
4514
4516
  S(this, $);
4515
4517
  S(this, Se);
@@ -4517,11 +4519,11 @@ class Or {
4517
4519
  S(this, ce);
4518
4520
  S(this, me, /* @__PURE__ */ new Map());
4519
4521
  S(this, ye, /* @__PURE__ */ new Set());
4520
- R(this, Se, e), R(this, et, e.listen((t) => void h(this, $, Qs).call(this, t)));
4522
+ R(this, Se, e), R(this, et, e.listen((t) => void h(this, $, Zs).call(this, t)));
4521
4523
  }
4522
4524
  /** The collaboration room for this app. Always the same instance. */
4523
4525
  collab() {
4524
- return u(this, ce) ?? R(this, ce, new Ir(u(this, Se))), u(this, ce);
4526
+ return u(this, ce) ?? R(this, ce, new Sr(u(this, Se))), u(this, ce);
4525
4527
  }
4526
4528
  /**
4527
4529
  * The room for commands from this account's external tools of one `kind`
@@ -4531,7 +4533,7 @@ class Or {
4531
4533
  external(e) {
4532
4534
  const t = e ?? "";
4533
4535
  let s = u(this, me).get(t);
4534
- return s || (s = new Sr(u(this, Se), e), u(this, me).set(t, s)), s;
4536
+ return s || (s = new kr(u(this, Se), e), u(this, me).set(t, s)), s;
4535
4537
  }
4536
4538
  /** Stops listening. For tests and teardown; an app normally never calls it. */
4537
4539
  dispose() {
@@ -4544,16 +4546,16 @@ Se = new WeakMap(), et = new WeakMap(), ce = new WeakMap(), me = new WeakMap(),
4544
4546
  if (e === "collab") return u(this, ce);
4545
4547
  if (e === "external")
4546
4548
  return u(this, me).get(typeof t == "string" ? t : "");
4547
- }, Qs = async function(e) {
4548
- const t = kr(e);
4549
+ }, Zs = async function(e) {
4550
+ const t = Or(e);
4549
4551
  if (t) {
4550
4552
  if (t.type.startsWith(Yt)) {
4551
- h(this, $, Zs).call(this, t);
4553
+ h(this, $, en).call(this, t);
4552
4554
  return;
4553
4555
  }
4554
- await h(this, $, en).call(this, t);
4556
+ await h(this, $, tn).call(this, t);
4555
4557
  }
4556
- }, Zs = function(e) {
4558
+ }, en = function(e) {
4557
4559
  var s, r, i;
4558
4560
  const t = e.payload ?? {};
4559
4561
  switch (e.type) {
@@ -4582,7 +4584,7 @@ Se = new WeakMap(), et = new WeakMap(), ce = new WeakMap(), me = new WeakMap(),
4582
4584
  break;
4583
4585
  }
4584
4586
  }
4585
- }, en = async function(e) {
4587
+ }, tn = async function(e) {
4586
4588
  const t = h(this, $, Xt).call(this).filter((i) => i.accepts(e.scope, e.kind));
4587
4589
  let s = !1;
4588
4590
  for (const i of t) {
@@ -4604,7 +4606,7 @@ Se = new WeakMap(), et = new WeakMap(), ce = new WeakMap(), me = new WeakMap(),
4604
4606
  }));
4605
4607
  };
4606
4608
  const Ie = "project", Ae = "notifications";
4607
- var Le, tt;
4609
+ var Fe, tt;
4608
4610
  const os = class os extends Ht {
4609
4611
  /**
4610
4612
  * @param token - A bearer JWT, OR a function returning the current JWT
@@ -4616,12 +4618,12 @@ const os = class os extends Ht {
4616
4618
  */
4617
4619
  constructor(t, s, r) {
4618
4620
  super(typeof t == "string" ? t : "", s, { ...r, useBearer: !0 });
4619
- S(this, Le);
4621
+ S(this, Fe);
4620
4622
  S(this, tt);
4621
- typeof t == "function" && R(this, Le, t);
4623
+ typeof t == "function" && R(this, Fe, t);
4622
4624
  }
4623
4625
  async resolveAccessToken() {
4624
- return u(this, Le) ? await u(this, Le).call(this) : super.resolveAccessToken();
4626
+ return u(this, Fe) ? await u(this, Fe).call(this) : super.resolveAccessToken();
4625
4627
  }
4626
4628
  /**
4627
4629
  * Creates a client from the platform context injected into
@@ -4658,7 +4660,7 @@ const os = class os extends Ht {
4658
4660
  * ```
4659
4661
  */
4660
4662
  get channel() {
4661
- return u(this, tt) ?? R(this, tt, new Or(Tr())), u(this, tt);
4663
+ return u(this, tt) ?? R(this, tt, new Ar(_r())), u(this, tt);
4662
4664
  }
4663
4665
  // ─── Projects (JWT-only backend routes) ──────────────────────────
4664
4666
  /**
@@ -4906,11 +4908,11 @@ const os = class os extends Ht {
4906
4908
  ), () => r.disconnect();
4907
4909
  }
4908
4910
  };
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))
4911
+ Fe = new WeakMap(), tt = new WeakMap();
4912
+ let _s = os;
4913
+ async function sn(n) {
4914
+ const [e, t] = await Rr(), s = t.Model.getRootAsModel(
4915
+ new e.ByteBuffer(await Cr(n))
4914
4916
  );
4915
4917
  let r = {};
4916
4918
  try {
@@ -4945,7 +4947,7 @@ async function tn(n) {
4945
4947
  }
4946
4948
  return { metadata: r, items: o };
4947
4949
  }
4948
- async function Ar() {
4950
+ async function Rr() {
4949
4951
  try {
4950
4952
  return await Promise.all([
4951
4953
  import("flatbuffers"),
@@ -4957,12 +4959,12 @@ async function Ar() {
4957
4959
  );
4958
4960
  }
4959
4961
  }
4960
- async function Rr(n) {
4962
+ async function Cr(n) {
4961
4963
  const e = new Blob([n]).stream().pipeThrough(new DecompressionStream("deflate"));
4962
4964
  return new Uint8Array(await new Response(e).arrayBuffer());
4963
4965
  }
4964
- const Cr = "flow:", $r = "flow:op", xr = "flow:source", Nr = "revitflow/op@2", _s = "REVITFLOWCHANGE", Is = "REVITFLOWOPERATION";
4965
- class sn {
4966
+ const $r = "flow:", xr = "flow:op", Nr = "flow:source", Pr = "revitflow/op@2", Is = "REVITFLOWCHANGE", Ss = "REVITFLOWOPERATION";
4967
+ class nn {
4966
4968
  constructor(e) {
4967
4969
  B(this, "changes", []);
4968
4970
  this.target = e;
@@ -5030,7 +5032,7 @@ class sn {
5030
5032
  "An operation with no changes is not an operation. Add at least one."
5031
5033
  );
5032
5034
  const t = {
5033
- schema: Nr,
5035
+ schema: Pr,
5034
5036
  opId: e,
5035
5037
  // Through the getters, so the envelope and the queue entry cannot drift
5036
5038
  // into disagreeing about the same operation.
@@ -5042,8 +5044,8 @@ class sn {
5042
5044
  ...this.userId ? { userId: this.userId } : {},
5043
5045
  title: this.title,
5044
5046
  summary: this.summary
5045
- }, [s, r] = await Pr();
5046
- return Br(
5047
+ }, [s, r] = await Br();
5048
+ return Fr(
5047
5049
  this.flatbuffer(s, r, e, JSON.stringify(t))
5048
5050
  );
5049
5051
  }
@@ -5052,8 +5054,8 @@ class sn {
5052
5054
  pack(e, t) {
5053
5055
  const s = {};
5054
5056
  for (const [r, i] of Object.entries(e ?? {}))
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;
5057
+ r.startsWith($r) || (s[r] = String(i));
5058
+ return t.position && (s.Position = t.position.map(ks).join(",")), t.rotationDeg !== void 0 && (s.Rotation = ks(t.rotationDeg)), t.source && (s[Nr] = t.source), s;
5057
5059
  }
5058
5060
  requireId(e, t) {
5059
5061
  if (!e || !e.trim())
@@ -5083,7 +5085,7 @@ class sn {
5083
5085
  const je = o.endMeshes(c), Te = c.createString(r), Ue = /* @__PURE__ */ new Set(), Oe = [];
5084
5086
  for (const I of this.changes) {
5085
5087
  const D = [], _e = {
5086
- [$r]: I.op,
5088
+ [xr]: I.op,
5087
5089
  ...I.attrs
5088
5090
  };
5089
5091
  for (const [j, G] of Object.entries(_e)) {
@@ -5104,9 +5106,9 @@ class sn {
5104
5106
  c,
5105
5107
  [...Ue].map((I) => c.createString(I))
5106
5108
  ), Me = this.changes.map(
5107
- () => c.createString(_s)
5109
+ () => c.createString(Is)
5108
5110
  );
5109
- Me.push(c.createString(Is));
5111
+ Me.push(c.createString(Ss));
5110
5112
  const rt = a.createCategoriesVector(c, Me), Ve = [], He = [];
5111
5113
  this.changes.forEach((I, D) => {
5112
5114
  I.item && (Ve.push(c.createString(I.item)), He.push(T[D]));
@@ -5115,21 +5117,21 @@ class sn {
5115
5117
  (I, D) => l.createSpatialStructure(
5116
5118
  c,
5117
5119
  T[D],
5118
- c.createString(_s),
5120
+ c.createString(Is),
5119
5121
  0
5120
5122
  )
5121
5123
  ), P = l.createSpatialStructure(
5122
5124
  c,
5123
5125
  _,
5124
- c.createString(Is),
5126
+ c.createString(Ss),
5125
5127
  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
+ ), L = c.createString(s);
5129
+ 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, L), a.addSpatialStructure(c, P), a.addMaxLocalId(c, A);
5128
5130
  const he = a.endModel(c);
5129
5131
  return a.finishModelBuffer(c, he), c.asUint8Array();
5130
5132
  }
5131
5133
  }
5132
- async function Pr() {
5134
+ async function Br() {
5133
5135
  try {
5134
5136
  return await Promise.all([
5135
5137
  import("flatbuffers"),
@@ -5141,18 +5143,18 @@ async function Pr() {
5141
5143
  );
5142
5144
  }
5143
5145
  }
5144
- function Ss(n) {
5146
+ function ks(n) {
5145
5147
  return Number.isFinite(n) ? String(n) : "0";
5146
5148
  }
5147
- async function Br(n) {
5149
+ async function Fr(n) {
5148
5150
  const e = new Blob([n]).stream().pipeThrough(new CompressionStream("deflate"));
5149
5151
  return new Uint8Array(await new Response(e).arrayBuffer());
5150
5152
  }
5151
- const Lr = "Element", Fr = "Carried", nn = 1 / 0.3048;
5152
- function Dr(n) {
5153
+ const Lr = "Element", Dr = "Carried", rn = 1 / 0.3048;
5154
+ function qr(n) {
5153
5155
  const e = [];
5154
5156
  for (const t of n)
5155
- for (const s of [Lr, Fr]) {
5157
+ for (const s of [Lr, Dr]) {
5156
5158
  const r = t.attrs[s];
5157
5159
  if (r)
5158
5160
  try {
@@ -5180,7 +5182,7 @@ function ht(n, e) {
5180
5182
  return null;
5181
5183
  }
5182
5184
  }
5183
- function qr(n) {
5185
+ function jr(n) {
5184
5186
  const e = /* @__PURE__ */ new Map();
5185
5187
  for (const t of n) {
5186
5188
  if (t.kind !== "datum" || t.params.of !== "level") continue;
@@ -5189,7 +5191,7 @@ function qr(n) {
5189
5191
  }
5190
5192
  return e;
5191
5193
  }
5192
- function jr(n) {
5194
+ function Ur(n) {
5193
5195
  const e = /* @__PURE__ */ new Map();
5194
5196
  for (const t of n) {
5195
5197
  if (!t.kind.endsWith("Style")) continue;
@@ -5198,7 +5200,7 @@ function jr(n) {
5198
5200
  }
5199
5201
  return e;
5200
5202
  }
5201
- async function rn(n, e) {
5203
+ async function on(n, e) {
5202
5204
  const t = /* @__PURE__ */ new Map(), s = (await n.targetDoc.suggestions()).filter(
5203
5205
  (r) => {
5204
5206
  var i;
@@ -5207,7 +5209,7 @@ async function rn(n, e) {
5207
5209
  ).sort((r, i) => String(r.createdAt).localeCompare(String(i.createdAt)));
5208
5210
  for (const r of s)
5209
5211
  try {
5210
- const i = await n.targetDoc.suggestionPayload(r), { items: o } = await tn(
5212
+ const i = await n.targetDoc.suggestionPayload(r), { items: o } = await sn(
5211
5213
  new Uint8Array(await i.arrayBuffer())
5212
5214
  ), a = o.filter((d) => d.attrs["flow:op"]), l = r.affectedIds ?? [];
5213
5215
  for (let d = 0; d < a.length && d < l.length; d++) {
@@ -5218,31 +5220,31 @@ async function rn(n, e) {
5218
5220
  }
5219
5221
  return t;
5220
5222
  }
5221
- async function on(n, e) {
5223
+ async function an(n, e) {
5222
5224
  if (!(e != null && e.fileId)) throw new Error("Choose the model file to read.");
5223
5225
  const t = new Uint8Array(
5224
5226
  await (await n.client.downloadFile(e.fileId)).arrayBuffer()
5225
5227
  );
5226
- return { picked: e, contents: await tn(t) };
5228
+ return { picked: e, contents: await sn(t) };
5227
5229
  }
5228
5230
  const Rt = {
5229
5231
  levels: "-2000240",
5230
5232
  walls: "-2000011",
5231
5233
  floors: "-2000032"
5232
- }, ks = 180 / Math.PI;
5233
- function Os(n) {
5234
+ }, Os = 180 / Math.PI;
5235
+ function As(n) {
5234
5236
  if (typeof n != "string") return null;
5235
5237
  const e = n.indexOf(":");
5236
5238
  return e <= 0 || e === n.length - 1 ? null : { family: n.slice(0, e), type: n.slice(e + 1) };
5237
5239
  }
5238
5240
  const J = (n) => String(n);
5239
- function an(n) {
5241
+ function cn(n) {
5240
5242
  return async (e) => {
5241
5243
  var Oe, st, nt, Me, rt, Ve, He;
5242
- const { picked: t, contents: s } = await on(
5244
+ const { picked: t, contents: s } = await an(
5243
5245
  e,
5244
5246
  e.input
5245
- ), r = Dr(s.items);
5247
+ ), r = qr(s.items);
5246
5248
  if (r.length === 0)
5247
5249
  throw new Error(
5248
5250
  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.`
@@ -5252,12 +5254,12 @@ function an(n) {
5252
5254
  throw new Error(
5253
5255
  "Free-standing instances can only be proposed by their style names: turn trustStyleNames on."
5254
5256
  );
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({
5257
+ const d = jr(r), c = Ur(r), m = `recipe:${n}-to-revit`, T = await on(e, m), A = await e.targetDoc.latest(), _ = new nn({
5256
5258
  project: e.projectId,
5257
5259
  document: e.targetDoc.docId,
5258
5260
  baseCommit: (A == null ? void 0 : A.version) ?? 0,
5259
5261
  author: m
5260
- }), E = nn, N = (g) => `${t.fileId}:${g}`, we = /* @__PURE__ */ new Set();
5262
+ }), E = rn, N = (g) => `${t.fileId}:${g}`, we = /* @__PURE__ */ new Set();
5261
5263
  let H = 0;
5262
5264
  const z = (g, y, k) => (we.add(g), T.has(g) ? (H++, !1) : (_.add(y, { ...k, source: g }), !0)), De = (g) => {
5263
5265
  const y = typeof g == "string" ? c.get(g) : void 0, k = y == null ? void 0 : y.params.thickness;
@@ -5274,8 +5276,8 @@ function an(n) {
5274
5276
  let O = 0, q = 0;
5275
5277
  for (const g of r) {
5276
5278
  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
+ 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, L = d.get(String((y == null ? void 0 : y.level) ?? g.params.level ?? "")), he = g.params.lookRef;
5280
+ if (typeof he != "string" || typeof P != "number" || !L) {
5279
5281
  q++;
5280
5282
  continue;
5281
5283
  }
@@ -5288,8 +5290,8 @@ function an(n) {
5288
5290
  CategoryId: Rt.walls,
5289
5291
  Type: he,
5290
5292
  LocationLine: j,
5291
- Level: F.name,
5292
- BaseOffset: J((x - F.at) * E),
5293
+ Level: L.name,
5294
+ BaseOffset: J((x - L.at) * E),
5293
5295
  Height: J(P * E)
5294
5296
  }, Q = De(he);
5295
5297
  Q && (G["Type.Width"] = J(Q)), z(`${N(g.id)}#${D}`, G) && O++;
@@ -5298,7 +5300,7 @@ function an(n) {
5298
5300
  let X = 0, be = 0;
5299
5301
  for (const g of r) {
5300
5302
  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) => {
5303
+ 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, L = (j) => {
5302
5304
  if (!(j != null && j.length)) return null;
5303
5305
  const G = [];
5304
5306
  for (const Q of j) {
@@ -5306,14 +5308,14 @@ function an(n) {
5306
5308
  G.push(Q.from[0] * E, Q.from[1] * E, k * E);
5307
5309
  }
5308
5310
  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);
5311
+ }, he = L((Me = (nt = y == null ? void 0 : y.profile) == null ? void 0 : nt.outline) == null ? void 0 : Me.curves);
5310
5312
  if (typeof P != "string" || !x || !he) {
5311
5313
  be++;
5312
5314
  continue;
5313
5315
  }
5314
5316
  const I = [he];
5315
5317
  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);
5318
+ const G = L(j == null ? void 0 : j.curves);
5317
5319
  G && I.push(G);
5318
5320
  }
5319
5321
  const D = {
@@ -5329,23 +5331,23 @@ function an(n) {
5329
5331
  if (g.kind !== "member" || g.params.of !== "column") continue;
5330
5332
  const y = ht(g, "member"), k = y == null ? void 0 : y.start;
5331
5333
  if (!k || k.length !== 3) continue;
5332
- const x = o ? Os(g.params.lookRef) : null;
5334
+ const x = o ? As(g.params.lookRef) : null;
5333
5335
  if (o && !x || !x && !i) continue;
5334
5336
  const P = x ?? {
5335
5337
  family: i.family,
5336
5338
  type: i.type
5337
- }, F = d.get(String((y == null ? void 0 : y.level) ?? ""));
5339
+ }, L = d.get(String((y == null ? void 0 : y.level) ?? ""));
5338
5340
  z(
5339
5341
  N(g.id),
5340
5342
  {
5341
5343
  ...i && !x ? { CategoryId: i.categoryId } : {},
5342
5344
  Family: P.family,
5343
5345
  Type: P.type,
5344
- ...F ? { Level: F.name } : {}
5346
+ ...L ? { Level: L.name } : {}
5345
5347
  },
5346
5348
  {
5347
5349
  position: [k[0] * E, k[1] * E, k[2] * E],
5348
- rotationDeg: (Number((y == null ? void 0 : y.roll) ?? 0) || 0) * ks
5350
+ rotationDeg: (Number((y == null ? void 0 : y.roll) ?? 0) || 0) * Os
5349
5351
  }
5350
5352
  ) && ve++;
5351
5353
  }
@@ -5359,13 +5361,13 @@ function an(n) {
5359
5361
  if (!a) continue;
5360
5362
  const y = ht(g, "instance"), k = (Ve = y == null ? void 0 : y.placement) == null ? void 0 : Ve.at;
5361
5363
  if (!k || k.length !== 3) continue;
5362
- const x = Os(g.params.type);
5364
+ const x = As(g.params.type);
5363
5365
  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;
5366
+ const P = (He = y == null ? void 0 : y.placement) == null ? void 0 : He.right, L = P ? Math.atan2(P[1], P[0]) * Os : 0;
5365
5367
  z(
5366
5368
  N(g.id),
5367
5369
  { Family: x.family, Type: x.type },
5368
- { position: [k[0] * E, k[1] * E, k[2] * E], rotationDeg: F }
5370
+ { position: [k[0] * E, k[1] * E, k[2] * E], rotationDeg: L }
5369
5371
  ) && Ee++;
5370
5372
  }
5371
5373
  let je = 0;
@@ -5403,7 +5405,7 @@ function an(n) {
5403
5405
  };
5404
5406
  };
5405
5407
  }
5406
- const Ur = {
5408
+ const Mr = {
5407
5409
  type: "object",
5408
5410
  properties: {
5409
5411
  columnType: {
@@ -5433,7 +5435,7 @@ const Ur = {
5433
5435
  default: !0
5434
5436
  }
5435
5437
  }
5436
- }, Mr = [
5438
+ }, Vr = [
5437
5439
  { reads: "Levels (datums)", proposes: "The same level on the target, ensured by name" },
5438
5440
  { reads: "Wall runs, one per straight segment", proposes: "A native wall: curve, type (made from its width when missing), level, height" },
5439
5441
  { reads: "Slabs with their boundary", proposes: "A native floor from the profile, holes included" },
@@ -5441,7 +5443,7 @@ const Ur = {
5441
5443
  { reads: "Free-standing family instances (when turned on)", proposes: "A new instance of the same-named type, placed and turned" },
5442
5444
  { reads: "Things this recipe made whose record is gone", proposes: "That element removed" },
5443
5445
  { reads: "Hosted doors/windows, stairs, roofs, footings, curtain pieces", proposes: "Nothing yet - each waits on the applier or the converter growing" }
5444
- ], cn = `
5446
+ ], hn = `
5445
5447
  ## What it does
5446
5448
 
5447
5449
  It reads the platform's records out of a .frag and asks a Revit document for
@@ -5480,7 +5482,7 @@ Records are metres and radians, Z up; proposals are written in Revit's feet
5480
5482
  and degrees. Types are matched exactly by name; Revit refuses the whole
5481
5483
  request when a loadable type is missing (system types are created from their
5482
5484
  width instead).
5483
- `, hn = {
5485
+ `, ln = {
5484
5486
  name: "frag-to-revit",
5485
5487
  title: "Platform model to Revit",
5486
5488
  description: "Turns the platform records of a .frag - levels, walls, floors, columns, instances - into change requests for a Revit document.",
@@ -5488,12 +5490,12 @@ width instead).
5488
5490
  inputs: ["frag-model"],
5489
5491
  source: { kind: "project-file", extensions: ["frag"] },
5490
5492
  runtime: "browser",
5491
- settingsSchema: Ur,
5492
- rules: Mr,
5493
- doc: cn,
5494
- run: an("frag")
5495
- }, Vr = {
5496
- ...hn,
5493
+ settingsSchema: Mr,
5494
+ rules: Vr,
5495
+ doc: hn,
5496
+ run: cn("frag")
5497
+ }, Hr = {
5498
+ ...ln,
5497
5499
  name: "ifc-to-revit",
5498
5500
  title: "IFC to Revit",
5499
5501
  description: "Turns an IFC - through the frag the platform converted it into - into native Revit change requests: levels, walls, floors, columns, instances.",
@@ -5504,9 +5506,9 @@ width instead).
5504
5506
  It reads the .frag your IFC was PROCESSED into (the IFC document's view). A
5505
5507
  plain IFC import carries only IFC attributes and is refused by name - the
5506
5508
  editable converter is what gives an IFC real records.
5507
- ` + cn,
5508
- run: an("ifc")
5509
- }, Hr = {
5509
+ ` + hn,
5510
+ run: cn("ifc")
5511
+ }, Gr = {
5510
5512
  millimeters: 1e-3,
5511
5513
  millimetres: 1e-3,
5512
5514
  mm: 1e-3,
@@ -5520,13 +5522,13 @@ editable converter is what gives an IFC real records.
5520
5522
  in: 0.0254,
5521
5523
  feet: 0.3048,
5522
5524
  ft: 0.3048
5523
- }, ln = "rhino-to-revit", As = `recipe:${ln}`;
5524
- function Gr(n) {
5525
+ }, dn = "rhino-to-revit", Rs = `recipe:${dn}`;
5526
+ function Jr(n) {
5525
5527
  const e = (n.attrs.Position ?? "").split(",").map((t) => Number(t.trim()));
5526
5528
  return e.length !== 3 || e.some((t) => !Number.isFinite(t)) ? null : [e[0], e[1], e[2]];
5527
5529
  }
5528
- const Jr = {
5529
- name: ln,
5530
+ const Wr = {
5531
+ name: dn,
5530
5532
  title: "Rhino to Revit",
5531
5533
  description: "Turns the placed objects of a Rhino layer into change requests for Revit instances of a chosen type.",
5532
5534
  to: "revit",
@@ -5596,13 +5598,13 @@ point's height.
5596
5598
  `,
5597
5599
  async run(n) {
5598
5600
  var K;
5599
- const { picked: e, contents: t } = await on(
5601
+ const { picked: e, contents: t } = await an(
5600
5602
  n,
5601
5603
  n.input
5602
5604
  ), { layer: s, instanceType: r } = n.settings;
5603
5605
  if (!s || !r)
5604
5606
  throw new Error("Choose the layer and the Revit type.");
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;
5607
+ const i = (K = t.metadata) == null ? void 0 : K.data, o = i == null ? void 0 : i.units, a = typeof o == "string" ? Gr[o.trim().toLowerCase()] : void 0;
5606
5608
  if (!a)
5607
5609
  throw new Error(
5608
5610
  `"${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.`
@@ -5612,11 +5614,11 @@ point's height.
5612
5614
  throw new Error(
5613
5615
  `"${e.name}" declares its data as "${l}"; this recipe only converts Z up.`
5614
5616
  );
5615
- const d = a * nn, c = await rn(n, As), m = await n.targetDoc.latest(), T = new sn({
5617
+ const d = a * rn, c = await on(n, Rs), m = await n.targetDoc.latest(), T = new nn({
5616
5618
  project: n.projectId,
5617
5619
  document: n.targetDoc.docId,
5618
5620
  baseCommit: (m == null ? void 0 : m.version) ?? 0,
5619
- author: As
5621
+ author: Rs
5620
5622
  });
5621
5623
  let A = 0, _ = 0, E = 0;
5622
5624
  const N = /* @__PURE__ */ new Set(), we = [];
@@ -5626,7 +5628,7 @@ point's height.
5626
5628
  E++;
5627
5629
  continue;
5628
5630
  }
5629
- const q = Gr(O);
5631
+ const q = Jr(O);
5630
5632
  if (!q) continue;
5631
5633
  N.add(O.guid);
5632
5634
  const X = [
@@ -5670,56 +5672,56 @@ point's height.
5670
5672
  ]
5671
5673
  };
5672
5674
  }
5673
- }, Wr = [
5674
- Jr,
5675
- Vr,
5676
- hn
5675
+ }, Yr = [
5676
+ Wr,
5677
+ Hr,
5678
+ ln
5677
5679
  ];
5678
- function Kr(n) {
5679
- for (const e of Wr) n.recipes.register(e);
5680
+ function Xr(n) {
5681
+ for (const e of Yr) n.recipes.register(e);
5680
5682
  }
5681
- const Xr = {
5683
+ const Qr = {
5682
5684
  MAX_FIELDS: 200,
5683
5685
  MAX_KEY_LENGTH: 50,
5684
5686
  MAX_VALUE_LENGTH: 50
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" };
5687
+ }, Zr = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, ei = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, ti = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, si = { uuid: "d8f3a1c2-6b4e-4f9a-8c1d-2e7b5a9f3c60" }, ni = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" }, ri = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, ii = { uuid: "6f3a9c2e-8b1d-4e6a-9c3f-1d7b5a8e2c4f" }, oi = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, ai = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
5686
5688
  export {
5687
- Qr as CDEManager,
5688
- Or as ChannelClient,
5689
- Ks as ChannelRoom,
5690
- Zr as ClashesManager,
5691
- Ir as CollabRoom,
5689
+ Zr as CDEManager,
5690
+ Ar as ChannelClient,
5691
+ Xs as ChannelRoom,
5692
+ ei as ClashesManager,
5693
+ Sr as CollabRoom,
5692
5694
  fs as DOCUMENT_FILE,
5693
5695
  bt as DOCUMENT_SCHEMA,
5694
5696
  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,
5697
+ kr as ExternalRoom,
5698
+ ti as FileList,
5699
+ dr as FlowDoc,
5700
+ si as GISManager,
5701
+ ni as GitHistoryManager,
5702
+ ri as HelloWorld,
5703
+ Qr as METADATA_LIMITS,
5704
+ Pr as OP_SCHEMA,
5705
+ nn as OperationBuilder,
5706
+ _s as PlatformClient,
5707
+ Vs as ProjectDocuments,
5708
+ lr as ProjectHistory,
5709
+ ii as ProjectManager,
5710
+ fr as Recipes,
5709
5711
  rs as RequestError,
5710
- or as SELF_VIEWING_FORMATS,
5711
- vs as STORAGE_BATCH_MAX,
5712
+ ar as SELF_VIEWING_FORMATS,
5713
+ Es as STORAGE_BATCH_MAX,
5712
5714
  ys as StaleHistoryError,
5713
- ii as TopicsManager,
5714
- oi as UIManager,
5715
- Wr as builtinRecipes,
5716
- hn as fragToRevit,
5717
- Vr as ifcToRevit,
5715
+ oi as TopicsManager,
5716
+ ai as UIManager,
5717
+ Yr as builtinRecipes,
5718
+ ln as fragToRevit,
5719
+ Hr as ifcToRevit,
5718
5720
  Mt as mintGuid,
5719
- Ys as orderByGraph,
5720
- tn as readFrag,
5721
- Kr as registerBuiltinRecipes,
5722
- Jr as rhinoToRevit,
5723
- Tr as windowTransport
5721
+ zs as orderByGraph,
5722
+ sn as readFrag,
5723
+ Xr as registerBuiltinRecipes,
5724
+ Wr as rhinoToRevit,
5725
+ _r as windowTransport
5724
5726
  };
5725
5727
  //# sourceMappingURL=index.es.js.map