@thatopen/services 0.8.0 → 0.9.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.
Files changed (70) hide show
  1. package/README.md +62 -62
  2. package/dist/built-in/index.d.ts +66 -41
  3. package/dist/cli.js +31 -12
  4. package/dist/core/client.d.ts +6 -0
  5. package/dist/core/platform-client.d.ts +139 -0
  6. package/dist/core/platform-client.live.test.d.ts +1 -0
  7. package/dist/core/platform-client.notifications.test.d.ts +1 -0
  8. package/dist/index.cjs.js +2 -2
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.es.js +635 -445
  11. package/dist/types/notifications.d.ts +77 -0
  12. package/dist/vite-env.d.ts +1 -1
  13. package/docs/cli/create.md +29 -29
  14. package/docs/cli/local-server.md +38 -38
  15. package/docs/cli/login.md +32 -32
  16. package/docs/cli/publish.md +31 -31
  17. package/docs/cli/run.md +26 -26
  18. package/docs/cli/serve.md +43 -43
  19. package/docs/cli/swap.md +30 -30
  20. package/package.json +1 -1
  21. package/src/built-in/CDEManager/example.ts +214 -214
  22. package/src/built-in/CDEManager/examples/FileEditing/example.ts +226 -226
  23. package/src/built-in/CDEManager/examples/FileMoves/example.ts +186 -186
  24. package/src/built-in/CDEManager/examples/FileOperations/example.ts +295 -295
  25. package/src/built-in/CDEManager/examples/FileTransfers/example.ts +210 -210
  26. package/src/built-in/CDEManager/examples/FolderManagement/example.ts +230 -230
  27. package/src/built-in/CDEManager/examples/MetadataSchema/example.ts +230 -230
  28. package/src/built-in/CDEManager/examples/MetadataViews/example.ts +166 -166
  29. package/src/built-in/CDEManager/examples/ProjectConfig/example.ts +177 -177
  30. package/src/built-in/UIManager/src/app/example.ts +97 -97
  31. package/src/built-in/UIManager/src/app/examples/AppState/example.ts +140 -140
  32. package/src/built-in/UIManager/src/app/examples/Banner/example.ts +159 -159
  33. package/src/built-in/UIManager/src/app/examples/Contexts/example.ts +123 -123
  34. package/src/built-in/UIManager/src/app/examples/FileDrop/example.ts +124 -124
  35. package/src/built-in/UIManager/src/app/examples/FloatingLayout/example.ts +90 -90
  36. package/src/built-in/UIManager/src/app/examples/Modal/example.ts +163 -163
  37. package/src/built-in/UIManager/src/app/examples/Notifications/example.ts +133 -133
  38. package/src/built-in/UIManager/src/app/examples/ProjectFileStorage/example.ts +150 -150
  39. package/src/built-in/UIManager/src/app/examples/Sidebar/example.ts +102 -102
  40. package/src/built-in/UIManager/src/clashes-panel/example.ts +183 -183
  41. package/src/built-in/UIManager/src/git-history-panel/example.ts +70 -70
  42. package/src/built-in/UIManager/src/models-list/example.ts +122 -122
  43. package/src/built-in/UIManager/src/topics-panel/example.ts +170 -170
  44. package/src/built-in/index.ts +66 -41
  45. package/src/cli/templates/app/index.html +35 -35
  46. package/src/cli/templates/app/package.json +32 -32
  47. package/src/cli/templates/app/src/bim-components/CloudRunner/index.ts +95 -95
  48. package/src/cli/templates/app/src/bim-components/CloudRunner/src/index.ts +1 -1
  49. package/src/cli/templates/app/src/bim-components/CloudRunner/src/types.ts +5 -5
  50. package/src/cli/templates/app/src/bim-components/index.ts +1 -1
  51. package/src/cli/templates/app/src/globals.ts +1 -1
  52. package/src/cli/templates/app/src/ui-components/app-info-section/index.ts +26 -26
  53. package/src/cli/templates/app/src/ui-components/app-info-section/src/index.ts +1 -1
  54. package/src/cli/templates/app/src/ui-components/app-info-section/src/types.ts +15 -15
  55. package/src/cli/templates/app/src/ui-components/cloud-runner-section/index.ts +37 -37
  56. package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/index.ts +1 -1
  57. package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/types.ts +14 -14
  58. package/src/cli/templates/app/src/ui-components/index.ts +2 -2
  59. package/src/cli/templates/app/tsconfig.json +16 -16
  60. package/src/cli/templates/app/vite.config.js +57 -57
  61. package/src/cli/templates/cloud-component/README.md +205 -205
  62. package/src/cli/templates/cloud-component/_thatopen +5 -5
  63. package/src/cli/templates/cloud-component/declarations.json +4 -4
  64. package/src/cli/templates/cloud-component/package.json +21 -21
  65. package/src/cli/templates/cloud-component/src/main.ts +70 -70
  66. package/src/cli/templates/cloud-component/tsconfig.json +16 -16
  67. package/src/cli/templates/cloud-component/vite.config.js +46 -46
  68. package/src/cli/templates/shared/AGENTS.md +8 -8
  69. package/src/cli/templates/shared/CLAUDE.md +1 -1
  70. package/src/cli/templates/shared/_gitignore +5 -5
package/dist/index.es.js CHANGED
@@ -1,10 +1,10 @@
1
- var Me = Object.defineProperty;
2
- var we = (n) => {
1
+ var Ve = Object.defineProperty;
2
+ var _e = (n) => {
3
3
  throw TypeError(n);
4
4
  };
5
- var Ve = (n, e, t) => e in n ? Me(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
6
- var w = (n, e, t) => Ve(n, typeof e != "symbol" ? e + "" : e, t), j = (n, e, t) => e.has(n) || we("Cannot " + t);
7
- var Y = (n, e, t) => (j(n, e, "read from private field"), t ? t.call(n) : e.get(n)), K = (n, e, t) => e.has(n) ? we("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), _e = (n, e, t, s) => (j(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t), c = (n, e, t) => (j(n, e, "access private method"), t);
5
+ var He = (n, e, t) => e in n ? Ve(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
6
+ var w = (n, e, t) => He(n, typeof e != "symbol" ? e + "" : e, t), Y = (n, e, t) => e.has(n) || _e("Cannot " + t);
7
+ var K = (n, e, t) => (Y(n, e, "read from private field"), t ? t.call(n) : e.get(n)), W = (n, e, t) => e.has(n) ? _e("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), be = (n, e, t, s) => (Y(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t), c = (n, e, t) => (Y(n, e, "access private method"), t);
8
8
  const v = /* @__PURE__ */ Object.create(null);
9
9
  v.open = "0";
10
10
  v.close = "1";
@@ -13,11 +13,11 @@ v.pong = "3";
13
13
  v.message = "4";
14
14
  v.upgrade = "5";
15
15
  v.noop = "6";
16
- const U = /* @__PURE__ */ Object.create(null);
16
+ const F = /* @__PURE__ */ Object.create(null);
17
17
  Object.keys(v).forEach((n) => {
18
- U[v[n]] = n;
18
+ F[v[n]] = n;
19
19
  });
20
- const te = { type: "error", data: "parser error" }, Oe = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", Se = typeof ArrayBuffer == "function", Ce = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n && n.buffer instanceof ArrayBuffer, le = ({ type: n, data: e }, t, s) => Oe && e instanceof Blob ? t ? s(e) : be(e, s) : Se && (e instanceof ArrayBuffer || Ce(e)) ? t ? s(e) : be(new Blob([e]), s) : s(v[n] + (e || "")), be = (n, e) => {
20
+ const se = { type: "error", data: "parser error" }, Se = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", $e = typeof ArrayBuffer == "function", Ce = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n && n.buffer instanceof ArrayBuffer, fe = ({ type: n, data: e }, t, s) => Se && e instanceof Blob ? t ? s(e) : Te(e, s) : $e && (e instanceof ArrayBuffer || Ce(e)) ? t ? s(e) : Te(new Blob([e]), s) : s(v[n] + (e || "")), Te = (n, e) => {
21
21
  const t = new FileReader();
22
22
  return t.onload = function() {
23
23
  const s = t.result.split(",")[1];
@@ -27,49 +27,49 @@ const te = { type: "error", data: "parser error" }, Oe = typeof Blob == "functio
27
27
  function Ee(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 W;
31
- function He(n, e) {
32
- if (Oe && n.data instanceof Blob)
30
+ let z;
31
+ function Ge(n, e) {
32
+ if (Se && n.data instanceof Blob)
33
33
  return n.data.arrayBuffer().then(Ee).then(e);
34
- if (Se && (n.data instanceof ArrayBuffer || Ce(n.data)))
34
+ if ($e && (n.data instanceof ArrayBuffer || Ce(n.data)))
35
35
  return e(Ee(n.data));
36
- le(n, !1, (t) => {
37
- W || (W = new TextEncoder()), e(W.encode(t));
36
+ fe(n, !1, (t) => {
37
+ z || (z = new TextEncoder()), e(z.encode(t));
38
38
  });
39
39
  }
40
- const Te = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", P = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
41
- for (let n = 0; n < Te.length; n++)
42
- P[Te.charCodeAt(n)] = n;
43
- const Ge = (n) => {
44
- let e = n.length * 0.75, t = n.length, s, r = 0, i, o, h, l;
40
+ const ve = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", L = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
41
+ for (let n = 0; n < ve.length; n++)
42
+ L[ve.charCodeAt(n)] = n;
43
+ const je = (n) => {
44
+ let e = n.length * 0.75, t = n.length, s, i = 0, r, o, h, l;
45
45
  n[n.length - 1] === "=" && (e--, n[n.length - 2] === "=" && e--);
46
46
  const y = new ArrayBuffer(e), d = new Uint8Array(y);
47
47
  for (s = 0; s < t; s += 4)
48
- i = P[n.charCodeAt(s)], o = P[n.charCodeAt(s + 1)], h = P[n.charCodeAt(s + 2)], l = P[n.charCodeAt(s + 3)], d[r++] = i << 2 | o >> 4, d[r++] = (o & 15) << 4 | h >> 2, d[r++] = (h & 3) << 6 | l & 63;
48
+ r = L[n.charCodeAt(s)], o = L[n.charCodeAt(s + 1)], h = L[n.charCodeAt(s + 2)], l = L[n.charCodeAt(s + 3)], d[i++] = r << 2 | o >> 4, d[i++] = (o & 15) << 4 | h >> 2, d[i++] = (h & 3) << 6 | l & 63;
49
49
  return y;
50
- }, Je = typeof ArrayBuffer == "function", fe = (n, e) => {
50
+ }, Je = typeof ArrayBuffer == "function", pe = (n, e) => {
51
51
  if (typeof n != "string")
52
52
  return {
53
53
  type: "message",
54
- data: $e(n, e)
54
+ data: Re(n, e)
55
55
  };
56
56
  const t = n.charAt(0);
57
57
  return t === "b" ? {
58
58
  type: "message",
59
- data: je(n.substring(1), e)
60
- } : U[t] ? n.length > 1 ? {
61
- type: U[t],
59
+ data: Ye(n.substring(1), e)
60
+ } : F[t] ? n.length > 1 ? {
61
+ type: F[t],
62
62
  data: n.substring(1)
63
63
  } : {
64
- type: U[t]
65
- } : te;
66
- }, je = (n, e) => {
64
+ type: F[t]
65
+ } : se;
66
+ }, Ye = (n, e) => {
67
67
  if (Je) {
68
- const t = Ge(n);
69
- return $e(t, e);
68
+ const t = je(n);
69
+ return Re(t, e);
70
70
  } else
71
71
  return { base64: !0, data: n };
72
- }, $e = (n, e) => {
72
+ }, Re = (n, e) => {
73
73
  switch (e) {
74
74
  case "blob":
75
75
  return n instanceof Blob ? n : new Blob([n]);
@@ -77,103 +77,103 @@ const Ge = (n) => {
77
77
  default:
78
78
  return n instanceof ArrayBuffer ? n : n.buffer;
79
79
  }
80
- }, Re = "", Ye = (n, e) => {
80
+ }, Be = "", Ke = (n, e) => {
81
81
  const t = n.length, s = new Array(t);
82
- let r = 0;
83
- n.forEach((i, o) => {
84
- le(i, !1, (h) => {
85
- s[o] = h, ++r === t && e(s.join(Re));
82
+ let i = 0;
83
+ n.forEach((r, o) => {
84
+ fe(r, !1, (h) => {
85
+ s[o] = h, ++i === t && e(s.join(Be));
86
86
  });
87
87
  });
88
- }, Ke = (n, e) => {
89
- const t = n.split(Re), s = [];
90
- for (let r = 0; r < t.length; r++) {
91
- const i = fe(t[r], e);
92
- if (s.push(i), i.type === "error")
88
+ }, We = (n, e) => {
89
+ const t = n.split(Be), s = [];
90
+ for (let i = 0; i < t.length; i++) {
91
+ const r = pe(t[i], e);
92
+ if (s.push(r), r.type === "error")
93
93
  break;
94
94
  }
95
95
  return s;
96
96
  };
97
- function We() {
97
+ function ze() {
98
98
  return new TransformStream({
99
99
  transform(n, e) {
100
- He(n, (t) => {
100
+ Ge(n, (t) => {
101
101
  const s = t.length;
102
- let r;
102
+ let i;
103
103
  if (s < 126)
104
- r = new Uint8Array(1), new DataView(r.buffer).setUint8(0, s);
104
+ i = new Uint8Array(1), new DataView(i.buffer).setUint8(0, s);
105
105
  else if (s < 65536) {
106
- r = new Uint8Array(3);
107
- const i = new DataView(r.buffer);
108
- i.setUint8(0, 126), i.setUint16(1, s);
106
+ i = new Uint8Array(3);
107
+ const r = new DataView(i.buffer);
108
+ r.setUint8(0, 126), r.setUint16(1, s);
109
109
  } else {
110
- r = new Uint8Array(9);
111
- const i = new DataView(r.buffer);
112
- i.setUint8(0, 127), i.setBigUint64(1, BigInt(s));
110
+ i = new Uint8Array(9);
111
+ const r = new DataView(i.buffer);
112
+ r.setUint8(0, 127), r.setBigUint64(1, BigInt(s));
113
113
  }
114
- n.data && typeof n.data != "string" && (r[0] |= 128), e.enqueue(r), e.enqueue(t);
114
+ n.data && typeof n.data != "string" && (i[0] |= 128), e.enqueue(i), e.enqueue(t);
115
115
  });
116
116
  }
117
117
  });
118
118
  }
119
- let z;
120
- function L(n) {
119
+ let X;
120
+ function U(n) {
121
121
  return n.reduce((e, t) => e + t.length, 0);
122
122
  }
123
- function I(n, e) {
123
+ function D(n, e) {
124
124
  if (n[0].length === e)
125
125
  return n.shift();
126
126
  const t = new Uint8Array(e);
127
127
  let s = 0;
128
- for (let r = 0; r < e; r++)
129
- t[r] = n[0][s++], s === n[0].length && (n.shift(), s = 0);
128
+ for (let i = 0; i < e; i++)
129
+ t[i] = 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 ze(n, e) {
133
- z || (z = new TextDecoder());
132
+ function Xe(n, e) {
133
+ X || (X = new TextDecoder());
134
134
  const t = [];
135
- let s = 0, r = -1, i = !1;
135
+ let s = 0, i = -1, r = !1;
136
136
  return new TransformStream({
137
137
  transform(o, h) {
138
138
  for (t.push(o); ; ) {
139
139
  if (s === 0) {
140
- if (L(t) < 1)
140
+ if (U(t) < 1)
141
141
  break;
142
- const l = I(t, 1);
143
- i = (l[0] & 128) === 128, r = l[0] & 127, r < 126 ? s = 3 : r === 126 ? s = 1 : s = 2;
142
+ const l = D(t, 1);
143
+ r = (l[0] & 128) === 128, i = l[0] & 127, i < 126 ? s = 3 : i === 126 ? s = 1 : s = 2;
144
144
  } else if (s === 1) {
145
- if (L(t) < 2)
145
+ if (U(t) < 2)
146
146
  break;
147
- const l = I(t, 2);
148
- r = new DataView(l.buffer, l.byteOffset, l.length).getUint16(0), s = 3;
147
+ const l = D(t, 2);
148
+ i = new DataView(l.buffer, l.byteOffset, l.length).getUint16(0), s = 3;
149
149
  } else if (s === 2) {
150
- if (L(t) < 8)
150
+ if (U(t) < 8)
151
151
  break;
152
- const l = I(t, 8), y = new DataView(l.buffer, l.byteOffset, l.length), d = y.getUint32(0);
152
+ const l = D(t, 8), y = new DataView(l.buffer, l.byteOffset, l.length), d = y.getUint32(0);
153
153
  if (d > Math.pow(2, 21) - 1) {
154
- h.enqueue(te);
154
+ h.enqueue(se);
155
155
  break;
156
156
  }
157
- r = d * Math.pow(2, 32) + y.getUint32(4), s = 3;
157
+ i = d * Math.pow(2, 32) + y.getUint32(4), s = 3;
158
158
  } else {
159
- if (L(t) < r)
159
+ if (U(t) < i)
160
160
  break;
161
- const l = I(t, r);
162
- h.enqueue(fe(i ? l : z.decode(l), e)), s = 0;
161
+ const l = D(t, i);
162
+ h.enqueue(pe(r ? l : X.decode(l), e)), s = 0;
163
163
  }
164
- if (r === 0 || r > n) {
165
- h.enqueue(te);
164
+ if (i === 0 || i > n) {
165
+ h.enqueue(se);
166
166
  break;
167
167
  }
168
168
  }
169
169
  }
170
170
  });
171
171
  }
172
- const Be = 4;
172
+ const Ne = 4;
173
173
  function g(n) {
174
- if (n) return Xe(n);
174
+ if (n) return Qe(n);
175
175
  }
176
- function Xe(n) {
176
+ function Qe(n) {
177
177
  for (var e in g.prototype)
178
178
  n[e] = g.prototype[e];
179
179
  return n;
@@ -194,9 +194,9 @@ g.prototype.off = g.prototype.removeListener = g.prototype.removeAllListeners =
194
194
  if (!t) return this;
195
195
  if (arguments.length == 1)
196
196
  return delete this._callbacks["$" + n], this;
197
- for (var s, r = 0; r < t.length; r++)
198
- if (s = t[r], s === e || s.fn === e) {
199
- t.splice(r, 1);
197
+ for (var s, i = 0; i < t.length; i++)
198
+ if (s = t[i], s === e || s.fn === e) {
199
+ t.splice(i, 1);
200
200
  break;
201
201
  }
202
202
  return t.length === 0 && delete this._callbacks["$" + n], this;
@@ -207,7 +207,7 @@ g.prototype.emit = function(n) {
207
207
  e[s - 1] = arguments[s];
208
208
  if (t) {
209
209
  t = t.slice(0);
210
- for (var s = 0, r = t.length; s < r; ++s)
210
+ for (var s = 0, i = t.length; s < i; ++s)
211
211
  t[s].apply(this, e);
212
212
  }
213
213
  return this;
@@ -219,25 +219,25 @@ g.prototype.listeners = function(n) {
219
219
  g.prototype.hasListeners = function(n) {
220
220
  return !!this.listeners(n).length;
221
221
  };
222
- const G = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), _ = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Qe = "arraybuffer";
222
+ const j = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), _ = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Ze = "arraybuffer";
223
223
  function xe(n, ...e) {
224
224
  return e.reduce((t, s) => (n.hasOwnProperty(s) && (t[s] = n[s]), t), {});
225
225
  }
226
- const Ze = _.setTimeout, et = _.clearTimeout;
226
+ const et = _.setTimeout, tt = _.clearTimeout;
227
227
  function J(n, e) {
228
- e.useNativeTimers ? (n.setTimeoutFn = Ze.bind(_), n.clearTimeoutFn = et.bind(_)) : (n.setTimeoutFn = _.setTimeout.bind(_), n.clearTimeoutFn = _.clearTimeout.bind(_));
229
- }
230
- const tt = 1.33;
231
- function st(n) {
232
- return typeof n == "string" ? nt(n) : Math.ceil((n.byteLength || n.size) * tt);
228
+ e.useNativeTimers ? (n.setTimeoutFn = et.bind(_), n.clearTimeoutFn = tt.bind(_)) : (n.setTimeoutFn = _.setTimeout.bind(_), n.clearTimeoutFn = _.clearTimeout.bind(_));
233
229
  }
230
+ const st = 1.33;
234
231
  function nt(n) {
232
+ return typeof n == "string" ? it(n) : Math.ceil((n.byteLength || n.size) * st);
233
+ }
234
+ function it(n) {
235
235
  let e = 0, t = 0;
236
- for (let s = 0, r = n.length; s < r; s++)
236
+ for (let s = 0, i = n.length; s < i; 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 Ne() {
240
+ function Pe() {
241
241
  return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
242
242
  }
243
243
  function rt(n) {
@@ -246,20 +246,20 @@ function rt(n) {
246
246
  n.hasOwnProperty(t) && (e.length && (e += "&"), e += encodeURIComponent(t) + "=" + encodeURIComponent(n[t]));
247
247
  return e;
248
248
  }
249
- function it(n) {
249
+ function ot(n) {
250
250
  let e = {}, t = n.split("&");
251
- for (let s = 0, r = t.length; s < r; s++) {
252
- let i = t[s].split("=");
253
- e[decodeURIComponent(i[0])] = decodeURIComponent(i[1]);
251
+ for (let s = 0, i = t.length; s < i; s++) {
252
+ let r = t[s].split("=");
253
+ e[decodeURIComponent(r[0])] = decodeURIComponent(r[1]);
254
254
  }
255
255
  return e;
256
256
  }
257
- class ot extends Error {
257
+ class at 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 pe extends g {
262
+ class de extends g {
263
263
  /**
264
264
  * Transport abstract constructor.
265
265
  *
@@ -279,7 +279,7 @@ class pe extends g {
279
279
  * @protected
280
280
  */
281
281
  onError(e, t, s) {
282
- return super.emitReserved("error", new ot(e, t, s)), this;
282
+ return super.emitReserved("error", new at(e, t, s)), this;
283
283
  }
284
284
  /**
285
285
  * Opens the transport.
@@ -316,7 +316,7 @@ class pe extends g {
316
316
  * @protected
317
317
  */
318
318
  onData(e) {
319
- const t = fe(e, this.socket.binaryType);
319
+ const t = pe(e, this.socket.binaryType);
320
320
  this.onPacket(t);
321
321
  }
322
322
  /**
@@ -357,7 +357,7 @@ class pe extends g {
357
357
  return t.length ? "?" + t : "";
358
358
  }
359
359
  }
360
- class at extends pe {
360
+ class ct extends de {
361
361
  constructor() {
362
362
  super(...arguments), this._polling = !1;
363
363
  }
@@ -413,7 +413,7 @@ class at extends pe {
413
413
  return this.onClose({ description: "transport closed by the server" }), !1;
414
414
  this.onPacket(s);
415
415
  };
416
- Ke(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
416
+ We(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 at extends pe {
433
433
  * @protected
434
434
  */
435
435
  write(e) {
436
- this.writable = !1, Ye(e, (t) => {
436
+ this.writable = !1, Ke(e, (t) => {
437
437
  this.doWrite(t, () => {
438
438
  this.writable = !0, this.emitReserved("drain");
439
439
  });
@@ -446,18 +446,18 @@ class at extends pe {
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] = Ne()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
449
+ return this.opts.timestampRequests !== !1 && (t[this.opts.timestampParam] = Pe()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
450
450
  }
451
451
  }
452
- let Pe = !1;
452
+ let Ie = !1;
453
453
  try {
454
- Pe = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
454
+ Ie = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
455
455
  } catch {
456
456
  }
457
- const ct = Pe;
458
- function ht() {
457
+ const ht = Ie;
458
+ function ut() {
459
459
  }
460
- class ut extends at {
460
+ class lt extends ct {
461
461
  /**
462
462
  * XHR Polling constructor.
463
463
  *
@@ -474,8 +474,8 @@ class ut extends at {
474
474
  /**
475
475
  * Sends data.
476
476
  *
477
- * @param {String} data to send.
478
- * @param {Function} called upon flush.
477
+ * @param {String} data - data to send.
478
+ * @param {Function} fn - called upon flush.
479
479
  * @private
480
480
  */
481
481
  doWrite(e, t) {
@@ -483,8 +483,8 @@ class ut extends at {
483
483
  method: "POST",
484
484
  data: e
485
485
  });
486
- s.on("success", t), s.on("error", (r, i) => {
487
- this.onError("xhr post error", r, i);
486
+ s.on("success", t), s.on("error", (i, r) => {
487
+ this.onError("xhr post error", i, r);
488
488
  });
489
489
  }
490
490
  /**
@@ -499,7 +499,7 @@ class ut extends at {
499
499
  }), this.pollXhr = e;
500
500
  }
501
501
  }
502
- class T extends g {
502
+ class E extends g {
503
503
  /**
504
504
  * Request constructor
505
505
  *
@@ -524,8 +524,8 @@ class T extends g {
524
524
  try {
525
525
  if (this._opts.extraHeaders) {
526
526
  s.setDisableHeaderCheck && s.setDisableHeaderCheck(!0);
527
- for (let r in this._opts.extraHeaders)
528
- this._opts.extraHeaders.hasOwnProperty(r) && s.setRequestHeader(r, this._opts.extraHeaders[r]);
527
+ for (let i in this._opts.extraHeaders)
528
+ this._opts.extraHeaders.hasOwnProperty(i) && s.setRequestHeader(i, this._opts.extraHeaders[i]);
529
529
  }
530
530
  } catch {
531
531
  }
@@ -539,21 +539,21 @@ class T extends g {
539
539
  } catch {
540
540
  }
541
541
  (e = this._opts.cookieJar) === null || e === void 0 || e.addCookies(s), "withCredentials" in s && (s.withCredentials = this._opts.withCredentials), this._opts.requestTimeout && (s.timeout = this._opts.requestTimeout), s.onreadystatechange = () => {
542
- var r;
543
- s.readyState === 3 && ((r = this._opts.cookieJar) === null || r === void 0 || r.parseCookies(
542
+ var i;
543
+ s.readyState === 3 && ((i = this._opts.cookieJar) === null || i === void 0 || i.parseCookies(
544
544
  // @ts-ignore
545
545
  s.getResponseHeader("set-cookie")
546
546
  )), s.readyState === 4 && (s.status === 200 || s.status === 1223 ? this._onLoad() : this.setTimeoutFn(() => {
547
547
  this._onError(typeof s.status == "number" ? s.status : 0);
548
548
  }, 0));
549
549
  }, s.send(this._data);
550
- } catch (r) {
550
+ } catch (i) {
551
551
  this.setTimeoutFn(() => {
552
- this._onError(r);
552
+ this._onError(i);
553
553
  }, 0);
554
554
  return;
555
555
  }
556
- typeof document < "u" && (this._index = T.requestsCount++, T.requests[this._index] = this);
556
+ typeof document < "u" && (this._index = E.requestsCount++, E.requests[this._index] = this);
557
557
  }
558
558
  /**
559
559
  * Called upon error.
@@ -570,12 +570,12 @@ class T extends g {
570
570
  */
571
571
  _cleanup(e) {
572
572
  if (!(typeof this._xhr > "u" || this._xhr === null)) {
573
- if (this._xhr.onreadystatechange = ht, e)
573
+ if (this._xhr.onreadystatechange = ut, e)
574
574
  try {
575
575
  this._xhr.abort();
576
576
  } catch {
577
577
  }
578
- typeof document < "u" && delete T.requests[this._index], this._xhr = null;
578
+ typeof document < "u" && delete E.requests[this._index], this._xhr = null;
579
579
  }
580
580
  }
581
581
  /**
@@ -596,40 +596,40 @@ class T extends g {
596
596
  this._cleanup();
597
597
  }
598
598
  }
599
- T.requestsCount = 0;
600
- T.requests = {};
599
+ E.requestsCount = 0;
600
+ E.requests = {};
601
601
  if (typeof document < "u") {
602
602
  if (typeof attachEvent == "function")
603
- attachEvent("onunload", ve);
603
+ attachEvent("onunload", ke);
604
604
  else if (typeof addEventListener == "function") {
605
605
  const n = "onpagehide" in _ ? "pagehide" : "unload";
606
- addEventListener(n, ve, !1);
606
+ addEventListener(n, ke, !1);
607
607
  }
608
608
  }
609
- function ve() {
610
- for (let n in T.requests)
611
- T.requests.hasOwnProperty(n) && T.requests[n].abort();
609
+ function ke() {
610
+ for (let n in E.requests)
611
+ E.requests.hasOwnProperty(n) && E.requests[n].abort();
612
612
  }
613
- const lt = function() {
613
+ const ft = function() {
614
614
  const n = Le({
615
615
  xdomain: !1
616
616
  });
617
617
  return n && n.responseType !== null;
618
618
  }();
619
- class ft extends ut {
619
+ class pt extends lt {
620
620
  constructor(e) {
621
621
  super(e);
622
622
  const t = e && e.forceBase64;
623
- this.supportsBinary = lt && !t;
623
+ this.supportsBinary = ft && !t;
624
624
  }
625
625
  request(e = {}) {
626
- return Object.assign(e, { xd: this.xd }, this.opts), new T(Le, this.uri(), e);
626
+ return Object.assign(e, { xd: this.xd }, this.opts), new E(Le, this.uri(), e);
627
627
  }
628
628
  }
629
629
  function Le(n) {
630
630
  const e = n.xdomain;
631
631
  try {
632
- if (typeof XMLHttpRequest < "u" && (!e || ct))
632
+ if (typeof XMLHttpRequest < "u" && (!e || ht))
633
633
  return new XMLHttpRequest();
634
634
  } catch {
635
635
  }
@@ -639,18 +639,18 @@ function Le(n) {
639
639
  } catch {
640
640
  }
641
641
  }
642
- const Ie = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
643
- class pt extends pe {
642
+ const qe = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
643
+ class dt extends de {
644
644
  get name() {
645
645
  return "websocket";
646
646
  }
647
647
  doOpen() {
648
- const e = this.uri(), t = this.opts.protocols, s = Ie ? {} : xe(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 = qe ? {} : xe(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);
652
- } catch (r) {
653
- return this.emitReserved("error", r);
652
+ } catch (i) {
653
+ return this.emitReserved("error", i);
654
654
  }
655
655
  this.ws.binaryType = this.socket.binaryType, this.addEventListeners();
656
656
  }
@@ -670,13 +670,13 @@ class pt extends pe {
670
670
  write(e) {
671
671
  this.writable = !1;
672
672
  for (let t = 0; t < e.length; t++) {
673
- const s = e[t], r = t === e.length - 1;
674
- le(s, this.supportsBinary, (i) => {
673
+ const s = e[t], i = t === e.length - 1;
674
+ fe(s, this.supportsBinary, (r) => {
675
675
  try {
676
- this.doWrite(s, i);
676
+ this.doWrite(s, r);
677
677
  } catch {
678
678
  }
679
- r && G(() => {
679
+ i && j(() => {
680
680
  this.writable = !0, this.emitReserved("drain");
681
681
  }, this.setTimeoutFn);
682
682
  });
@@ -693,19 +693,19 @@ class pt extends pe {
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] = Ne()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
696
+ return this.opts.timestampRequests && (t[this.opts.timestampParam] = Pe()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
697
697
  }
698
698
  }
699
- const X = _.WebSocket || _.MozWebSocket;
700
- class dt extends pt {
699
+ const Q = _.WebSocket || _.MozWebSocket;
700
+ class yt extends dt {
701
701
  createSocket(e, t, s) {
702
- return Ie ? new X(e, t, s) : t ? new X(e, t) : new X(e);
702
+ return qe ? new Q(e, t, s) : t ? new Q(e, t) : new Q(e);
703
703
  }
704
704
  doWrite(e, t) {
705
705
  this.ws.send(t);
706
706
  }
707
707
  }
708
- class yt extends pe {
708
+ class mt extends de {
709
709
  get name() {
710
710
  return "webtransport";
711
711
  }
@@ -721,15 +721,15 @@ class yt extends pe {
721
721
  this.onError("webtransport error", e);
722
722
  }), this._transport.ready.then(() => {
723
723
  this._transport.createBidirectionalStream().then((e) => {
724
- const t = ze(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), r = We();
725
- r.readable.pipeTo(e.writable), this._writer = r.writable.getWriter();
726
- const i = () => {
724
+ const t = Xe(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), i = ze();
725
+ i.readable.pipeTo(e.writable), this._writer = i.writable.getWriter();
726
+ const r = () => {
727
727
  s.read().then(({ done: h, value: l }) => {
728
- h || (this.onPacket(l), i());
728
+ h || (this.onPacket(l), r());
729
729
  }).catch((h) => {
730
730
  });
731
731
  };
732
- i();
732
+ r();
733
733
  const o = { type: "open" };
734
734
  this.query.sid && (o.data = `{"sid":"${this.query.sid}"}`), this._writer.write(o).then(() => this.onOpen());
735
735
  });
@@ -738,9 +738,9 @@ class yt extends pe {
738
738
  write(e) {
739
739
  this.writable = !1;
740
740
  for (let t = 0; t < e.length; t++) {
741
- const s = e[t], r = t === e.length - 1;
741
+ const s = e[t], i = t === e.length - 1;
742
742
  this._writer.write(s).then(() => {
743
- r && G(() => {
743
+ i && j(() => {
744
744
  this.writable = !0, this.emitReserved("drain");
745
745
  }, this.setTimeoutFn);
746
746
  });
@@ -751,11 +751,11 @@ class yt extends pe {
751
751
  (e = this._transport) === null || e === void 0 || e.close();
752
752
  }
753
753
  }
754
- const mt = {
755
- websocket: dt,
756
- webtransport: yt,
757
- polling: ft
758
- }, gt = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, wt = [
754
+ const gt = {
755
+ websocket: yt,
756
+ webtransport: mt,
757
+ polling: pt
758
+ }, wt = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, _t = [
759
759
  "source",
760
760
  "protocol",
761
761
  "authority",
@@ -771,29 +771,29 @@ const mt = {
771
771
  "query",
772
772
  "anchor"
773
773
  ];
774
- function se(n) {
774
+ function ne(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 = gt.exec(n || ""), i = {}, o = 14;
779
+ let i = wt.exec(n || ""), r = {}, o = 14;
780
780
  for (; o--; )
781
- i[wt[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 = _t(i, i.path), i.queryKey = bt(i, i.query), i;
781
+ r[_t[o]] = i[o] || "";
782
+ return t != -1 && s != -1 && (r.source = e, r.host = r.host.substring(1, r.host.length - 1).replace(/;/g, ":"), r.authority = r.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), r.ipv6uri = !0), r.pathNames = bt(r, r.path), r.queryKey = Tt(r, r.query), r;
783
783
  }
784
- function _t(n, e) {
784
+ function bt(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 bt(n, e) {
788
+ function Tt(n, e) {
789
789
  const t = {};
790
- return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(s, r, i) {
791
- r && (t[r] = i);
790
+ return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(s, i, r) {
791
+ i && (t[i] = r);
792
792
  }), t;
793
793
  }
794
- const ne = typeof addEventListener == "function" && typeof removeEventListener == "function", D = [];
795
- ne && addEventListener("offline", () => {
796
- D.forEach((n) => n());
794
+ const ie = typeof addEventListener == "function" && typeof removeEventListener == "function", M = [];
795
+ ie && addEventListener("offline", () => {
796
+ M.forEach((n) => n());
797
797
  }, !1);
798
798
  class R extends g {
799
799
  /**
@@ -803,13 +803,13 @@ class R extends g {
803
803
  * @param {Object} opts - options
804
804
  */
805
805
  constructor(e, t) {
806
- if (super(), this.binaryType = Qe, 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 = se(e);
806
+ if (super(), this.binaryType = Ze, 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 = ne(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 = se(t.host).host);
809
+ } else t.host && (t.hostname = ne(t.host).host);
810
810
  J(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
- const r = s.prototype.name;
812
- this.transports.push(r), this._transportsByName[r] = s;
811
+ const i = s.prototype.name;
812
+ this.transports.push(i), this._transportsByName[i] = s;
813
813
  }), this.opts = Object.assign({
814
814
  path: "/engine.io",
815
815
  agent: !1,
@@ -824,13 +824,13 @@ class R extends g {
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 = it(this.opts.query)), ne && (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 = ot(this.opts.query)), ie && (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
- }, D.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open();
833
+ }, M.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 R extends g {
841
841
  */
842
842
  createTransport(e) {
843
843
  const t = Object.assign({}, this.opts.query);
844
- t.EIO = Be, t.transport = e, this.id && (t.sid = this.id);
844
+ t.EIO = Ne, 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,
@@ -958,8 +958,8 @@ class R extends g {
958
958
  return this.writeBuffer;
959
959
  let t = 1;
960
960
  for (let s = 0; s < this.writeBuffer.length; s++) {
961
- const r = this.writeBuffer[s].data;
962
- if (r && (t += st(r)), s > 0 && t > this._maxPayload)
961
+ const i = this.writeBuffer[s].data;
962
+ if (i && (t += nt(i)), s > 0 && t > this._maxPayload)
963
963
  return this.writeBuffer.slice(0, s);
964
964
  t += 2;
965
965
  }
@@ -979,7 +979,7 @@ class R extends g {
979
979
  if (!this._pingTimeoutTime)
980
980
  return !0;
981
981
  const e = Date.now() > this._pingTimeoutTime;
982
- return e && (this._pingTimeoutTime = 0, G(() => {
982
+ return e && (this._pingTimeoutTime = 0, j(() => {
983
983
  this._onClose("ping timeout");
984
984
  }, this.setTimeoutFn)), e;
985
985
  }
@@ -1008,22 +1008,22 @@ class R extends g {
1008
1008
  /**
1009
1009
  * Sends a packet.
1010
1010
  *
1011
- * @param {String} type: packet type.
1011
+ * @param {String} type - packet type.
1012
1012
  * @param {String} data.
1013
1013
  * @param {Object} options.
1014
1014
  * @param {Function} fn - callback function.
1015
1015
  * @private
1016
1016
  */
1017
- _sendPacket(e, t, s, r) {
1018
- if (typeof t == "function" && (r = t, t = void 0), typeof s == "function" && (r = s, s = null), this.readyState === "closing" || this.readyState === "closed")
1017
+ _sendPacket(e, t, s, i) {
1018
+ if (typeof t == "function" && (i = t, t = void 0), typeof s == "function" && (i = s, s = null), this.readyState === "closing" || this.readyState === "closed")
1019
1019
  return;
1020
1020
  s = s || {}, s.compress = s.compress !== !1;
1021
- const i = {
1021
+ const r = {
1022
1022
  type: e,
1023
1023
  data: t,
1024
1024
  options: s
1025
1025
  };
1026
- this.emitReserved("packetCreate", i), this.writeBuffer.push(i), r && this.once("flush", r), this.flush();
1026
+ this.emitReserved("packetCreate", r), this.writeBuffer.push(r), i && this.once("flush", i), this.flush();
1027
1027
  }
1028
1028
  /**
1029
1029
  * Closes the connection.
@@ -1057,15 +1057,15 @@ class R extends g {
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(), ne && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
1061
- const s = D.indexOf(this._offlineEventListener);
1062
- s !== -1 && D.splice(s, 1);
1060
+ if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), ie && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
1061
+ const s = M.indexOf(this._offlineEventListener);
1062
+ s !== -1 && M.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
- R.protocol = Be;
1068
+ R.protocol = Ne;
1069
1069
  class Et extends R {
1070
1070
  constructor() {
1071
1071
  super(...arguments), this._upgrades = [];
@@ -1084,7 +1084,7 @@ class Et extends R {
1084
1084
  _probe(e) {
1085
1085
  let t = this.createTransport(e), s = !1;
1086
1086
  R.priorWebsocketSuccess = !1;
1087
- const r = () => {
1087
+ const i = () => {
1088
1088
  s || (t.send([{ type: "ping", data: "probe" }]), t.once("packet", (m) => {
1089
1089
  if (!s)
1090
1090
  if (m.type === "pong" && m.data === "probe") {
@@ -1099,12 +1099,12 @@ class Et extends R {
1099
1099
  }
1100
1100
  }));
1101
1101
  };
1102
- function i() {
1102
+ function r() {
1103
1103
  s || (s = !0, d(), t.close(), t = null);
1104
1104
  }
1105
1105
  const o = (m) => {
1106
1106
  const k = new Error("probe error: " + m);
1107
- k.transport = t.name, i(), this.emitReserved("upgradeError", k);
1107
+ k.transport = t.name, r(), this.emitReserved("upgradeError", k);
1108
1108
  };
1109
1109
  function h() {
1110
1110
  o("transport closed");
@@ -1113,12 +1113,12 @@ class Et extends R {
1113
1113
  o("socket closed");
1114
1114
  }
1115
1115
  function y(m) {
1116
- t && m.name !== t.name && i();
1116
+ t && m.name !== t.name && r();
1117
1117
  }
1118
1118
  const d = () => {
1119
- t.removeListener("open", r), t.removeListener("error", o), t.removeListener("close", h), this.off("close", l), this.off("upgrading", y);
1119
+ t.removeListener("open", i), t.removeListener("error", o), t.removeListener("close", h), this.off("close", l), this.off("upgrading", y);
1120
1120
  };
1121
- t.once("open", r), t.once("error", o), t.once("close", h), this.once("close", l), this.once("upgrading", y), this._upgrades.indexOf("webtransport") !== -1 && e !== "webtransport" ? this.setTimeoutFn(() => {
1121
+ t.once("open", i), t.once("error", o), t.once("close", h), this.once("close", l), this.once("upgrading", y), this._upgrades.indexOf("webtransport") !== -1 && e !== "webtransport" ? this.setTimeoutFn(() => {
1122
1122
  s || t.open();
1123
1123
  }, 200) : t.open();
1124
1124
  }
@@ -1138,37 +1138,37 @@ class Et extends R {
1138
1138
  return t;
1139
1139
  }
1140
1140
  }
1141
- let Tt = class extends Et {
1141
+ let vt = class extends Et {
1142
1142
  constructor(e, t = {}) {
1143
- const s = typeof e == "object" ? e : t;
1144
- (!s.transports || s.transports && typeof s.transports[0] == "string") && (s.transports = (s.transports || ["polling", "websocket", "webtransport"]).map((r) => mt[r]).filter((r) => !!r)), super(e, s);
1143
+ const s = typeof e == "object", i = s ? { ...e } : { ...t };
1144
+ (!i.transports || i.transports && typeof i.transports[0] == "string") && (i.transports = (i.transports || ["polling", "websocket", "webtransport"]).map((r) => gt[r]).filter((r) => !!r)), super(s ? i : e, i);
1145
1145
  }
1146
1146
  };
1147
- function vt(n, e = "", t) {
1147
+ function kt(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 = se(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
- const i = s.host.indexOf(":") !== -1 ? "[" + s.host + "]" : s.host;
1151
- return s.id = s.protocol + "://" + i + ":" + s.port + e, s.href = s.protocol + "://" + i + (t && t.port === s.port ? "" : ":" + s.port), s;
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 = ne(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
+ const r = s.host.indexOf(":") !== -1 ? "[" + s.host + "]" : s.host;
1151
+ return s.id = s.protocol + "://" + r + ":" + s.port + e, s.href = s.protocol + "://" + r + (t && t.port === s.port ? "" : ":" + s.port), s;
1152
1152
  }
1153
- const kt = typeof ArrayBuffer == "function", At = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n.buffer instanceof ArrayBuffer, qe = Object.prototype.toString, Ot = typeof Blob == "function" || typeof Blob < "u" && qe.call(Blob) === "[object BlobConstructor]", St = typeof File == "function" || typeof File < "u" && qe.call(File) === "[object FileConstructor]";
1154
- function de(n) {
1155
- return kt && (n instanceof ArrayBuffer || At(n)) || Ot && n instanceof Blob || St && n instanceof File;
1153
+ const At = typeof ArrayBuffer == "function", Ot = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n.buffer instanceof ArrayBuffer, Ue = Object.prototype.toString, St = typeof Blob == "function" || typeof Blob < "u" && Ue.call(Blob) === "[object BlobConstructor]", $t = typeof File == "function" || typeof File < "u" && Ue.call(File) === "[object FileConstructor]";
1154
+ function ye(n) {
1155
+ return At && (n instanceof ArrayBuffer || Ot(n)) || St && n instanceof Blob || $t && n instanceof File;
1156
1156
  }
1157
- function F(n, e) {
1157
+ function V(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 (F(n[t]))
1162
+ if (V(n[t]))
1163
1163
  return !0;
1164
1164
  return !1;
1165
1165
  }
1166
- if (de(n))
1166
+ if (ye(n))
1167
1167
  return !0;
1168
1168
  if (n.toJSON && typeof n.toJSON == "function" && arguments.length === 1)
1169
- return F(n.toJSON(), !0);
1169
+ return V(n.toJSON(), !0);
1170
1170
  for (const t in n)
1171
- if (Object.prototype.hasOwnProperty.call(n, t) && F(n[t]))
1171
+ if (Object.prototype.hasOwnProperty.call(n, t) && V(n[t]))
1172
1172
  return !0;
1173
1173
  return !1;
1174
1174
  }
@@ -1179,7 +1179,7 @@ function Ct(n) {
1179
1179
  function re(n, e) {
1180
1180
  if (!n)
1181
1181
  return n;
1182
- if (de(n)) {
1182
+ if (ye(n)) {
1183
1183
  const t = { _placeholder: !0, num: e.length };
1184
1184
  return e.push(n), t;
1185
1185
  } else if (Array.isArray(n)) {
@@ -1195,10 +1195,10 @@ function re(n, e) {
1195
1195
  }
1196
1196
  return n;
1197
1197
  }
1198
- function $t(n, e) {
1199
- return n.data = ie(n.data, e), delete n.attachments, n;
1198
+ function Rt(n, e) {
1199
+ return n.data = oe(n.data, e), delete n.attachments, n;
1200
1200
  }
1201
- function ie(n, e) {
1201
+ function oe(n, e) {
1202
1202
  if (!n)
1203
1203
  return n;
1204
1204
  if (n && n._placeholder === !0) {
@@ -1207,13 +1207,13 @@ function ie(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] = ie(n[t], e);
1210
+ n[t] = oe(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] = ie(n[t], e));
1213
+ Object.prototype.hasOwnProperty.call(n, t) && (n[t] = oe(n[t], e));
1214
1214
  return n;
1215
1215
  }
1216
- const Rt = [
1216
+ const Bt = [
1217
1217
  "connect",
1218
1218
  // used on the client side
1219
1219
  "connect_error",
@@ -1231,7 +1231,7 @@ var p;
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
  })(p || (p = {}));
1234
- class Bt {
1234
+ class Nt {
1235
1235
  /**
1236
1236
  * Encoder constructor
1237
1237
  *
@@ -1247,7 +1247,7 @@ class Bt {
1247
1247
  * @param {Object} obj - packet object
1248
1248
  */
1249
1249
  encode(e) {
1250
- return (e.type === p.EVENT || e.type === p.ACK) && F(e) ? this.encodeAsBinary({
1250
+ return (e.type === p.EVENT || e.type === p.ACK) && V(e) ? this.encodeAsBinary({
1251
1251
  type: e.type === p.EVENT ? p.BINARY_EVENT : p.BINARY_ACK,
1252
1252
  nsp: e.nsp,
1253
1253
  data: e.data,
@@ -1267,18 +1267,19 @@ class Bt {
1267
1267
  * a list of buffers.
1268
1268
  */
1269
1269
  encodeAsBinary(e) {
1270
- const t = Ct(e), s = this.encodeAsString(t.packet), r = t.buffers;
1271
- return r.unshift(s), r;
1270
+ const t = Ct(e), s = this.encodeAsString(t.packet), i = t.buffers;
1271
+ return i.unshift(s), i;
1272
1272
  }
1273
1273
  }
1274
- class ye extends g {
1274
+ class me extends g {
1275
1275
  /**
1276
1276
  * Decoder constructor
1277
- *
1278
- * @param {function} reviver - custom reviver to pass down to JSON.stringify
1279
1277
  */
1280
1278
  constructor(e) {
1281
- super(), this.reviver = e;
1279
+ super(), this.opts = Object.assign({
1280
+ reviver: void 0,
1281
+ maxAttachments: 10
1282
+ }, typeof e == "function" ? { reviver: e } : e);
1282
1283
  }
1283
1284
  /**
1284
1285
  * Decodes an encoded packet string into packet JSON.
@@ -1293,7 +1294,7 @@ class ye extends g {
1293
1294
  t = this.decodeString(e);
1294
1295
  const s = t.type === p.BINARY_EVENT;
1295
1296
  s || t.type === p.BINARY_ACK ? (t.type = s ? p.EVENT : p.ACK, this.reconstructor = new xt(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t);
1296
- } else if (de(e) || e.base64)
1297
+ } else if (ye(e) || e.base64)
1297
1298
  if (this.reconstructor)
1298
1299
  t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t));
1299
1300
  else
@@ -1315,24 +1316,29 @@ class ye extends g {
1315
1316
  if (p[s.type] === void 0)
1316
1317
  throw new Error("unknown packet type " + s.type);
1317
1318
  if (s.type === p.BINARY_EVENT || s.type === p.BINARY_ACK) {
1318
- const i = t + 1;
1319
+ const r = t + 1;
1319
1320
  for (; e.charAt(++t) !== "-" && t != e.length; )
1320
1321
  ;
1321
- const o = e.substring(i, t);
1322
+ const o = e.substring(r, t);
1322
1323
  if (o != Number(o) || e.charAt(t) !== "-")
1323
1324
  throw new Error("Illegal attachments");
1324
- s.attachments = Number(o);
1325
+ const h = Number(o);
1326
+ if (!Pt(h) || h < 0)
1327
+ throw new Error("Illegal attachments");
1328
+ if (h > this.opts.maxAttachments)
1329
+ throw new Error("too many attachments");
1330
+ s.attachments = h;
1325
1331
  }
1326
1332
  if (e.charAt(t + 1) === "/") {
1327
- const i = t + 1;
1333
+ const r = t + 1;
1328
1334
  for (; ++t && !(e.charAt(t) === "," || t === e.length); )
1329
1335
  ;
1330
- s.nsp = e.substring(i, t);
1336
+ s.nsp = e.substring(r, t);
1331
1337
  } else
1332
1338
  s.nsp = "/";
1333
- const r = e.charAt(t + 1);
1334
- if (r !== "" && Number(r) == r) {
1335
- const i = t + 1;
1339
+ const i = e.charAt(t + 1);
1340
+ if (i !== "" && Number(i) == i) {
1341
+ const r = t + 1;
1336
1342
  for (; ++t; ) {
1337
1343
  const o = e.charAt(t);
1338
1344
  if (o == null || Number(o) != o) {
@@ -1342,12 +1348,12 @@ class ye extends g {
1342
1348
  if (t === e.length)
1343
1349
  break;
1344
1350
  }
1345
- s.id = Number(e.substring(i, t + 1));
1351
+ s.id = Number(e.substring(r, t + 1));
1346
1352
  }
1347
1353
  if (e.charAt(++t)) {
1348
- const i = this.tryParse(e.substr(t));
1349
- if (ye.isPayloadValid(s.type, i))
1350
- s.data = i;
1354
+ const r = this.tryParse(e.substr(t));
1355
+ if (me.isPayloadValid(s.type, r))
1356
+ s.data = r;
1351
1357
  else
1352
1358
  throw new Error("invalid payload");
1353
1359
  }
@@ -1355,7 +1361,7 @@ class ye extends g {
1355
1361
  }
1356
1362
  tryParse(e) {
1357
1363
  try {
1358
- return JSON.parse(e, this.reviver);
1364
+ return JSON.parse(e, this.opts.reviver);
1359
1365
  } catch {
1360
1366
  return !1;
1361
1367
  }
@@ -1363,14 +1369,14 @@ class ye extends g {
1363
1369
  static isPayloadValid(e, t) {
1364
1370
  switch (e) {
1365
1371
  case p.CONNECT:
1366
- return ke(t);
1372
+ return Ae(t);
1367
1373
  case p.DISCONNECT:
1368
1374
  return t === void 0;
1369
1375
  case p.CONNECT_ERROR:
1370
- return typeof t == "string" || ke(t);
1376
+ return typeof t == "string" || Ae(t);
1371
1377
  case p.EVENT:
1372
1378
  case p.BINARY_EVENT:
1373
- return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && Rt.indexOf(t[0]) === -1);
1379
+ return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && Bt.indexOf(t[0]) === -1);
1374
1380
  case p.ACK:
1375
1381
  case p.BINARY_ACK:
1376
1382
  return Array.isArray(t);
@@ -1397,7 +1403,7 @@ class xt {
1397
1403
  */
1398
1404
  takeBinaryData(e) {
1399
1405
  if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
1400
- const t = $t(this.reconPack, this.buffers);
1406
+ const t = Rt(this.reconPack, this.buffers);
1401
1407
  return this.finishedReconstruction(), t;
1402
1408
  }
1403
1409
  return null;
@@ -1409,13 +1415,16 @@ class xt {
1409
1415
  this.reconPack = null, this.buffers = [];
1410
1416
  }
1411
1417
  }
1412
- function ke(n) {
1418
+ const Pt = Number.isInteger || function(n) {
1419
+ return typeof n == "number" && isFinite(n) && Math.floor(n) === n;
1420
+ };
1421
+ function Ae(n) {
1413
1422
  return Object.prototype.toString.call(n) === "[object Object]";
1414
1423
  }
1415
- const Nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1424
+ const It = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1416
1425
  __proto__: null,
1417
- Decoder: ye,
1418
- Encoder: Bt,
1426
+ Decoder: me,
1427
+ Encoder: Nt,
1419
1428
  get PacketType() {
1420
1429
  return p;
1421
1430
  }
@@ -1425,7 +1434,7 @@ function b(n, e, t) {
1425
1434
  n.off(e, t);
1426
1435
  };
1427
1436
  }
1428
- const Pt = Object.freeze({
1437
+ const Lt = Object.freeze({
1429
1438
  connect: 1,
1430
1439
  connect_error: 1,
1431
1440
  disconnect: 1,
@@ -1434,7 +1443,7 @@ const Pt = Object.freeze({
1434
1443
  newListener: 1,
1435
1444
  removeListener: 1
1436
1445
  });
1437
- class Ue extends g {
1446
+ class De extends g {
1438
1447
  /**
1439
1448
  * `Socket` constructor.
1440
1449
  */
@@ -1549,8 +1558,8 @@ class Ue extends g {
1549
1558
  * @return self
1550
1559
  */
1551
1560
  emit(e, ...t) {
1552
- var s, r, i;
1553
- if (Pt.hasOwnProperty(e))
1561
+ var s, i, r;
1562
+ if (Lt.hasOwnProperty(e))
1554
1563
  throw new Error('"' + e.toString() + '" is a reserved event name');
1555
1564
  if (t.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
1556
1565
  return this._addToQueue(t), this;
@@ -1562,7 +1571,7 @@ class Ue extends g {
1562
1571
  const d = this.ids++, m = t.pop();
1563
1572
  this._registerAckCallback(d, m), o.id = d;
1564
1573
  }
1565
- const h = (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());
1574
+ const h = (i = (s = this.io.engine) === null || s === void 0 ? void 0 : s.transport) === null || i === void 0 ? void 0 : i.writable, l = this.connected && !(!((r = this.io.engine) === null || r === void 0) && r._hasPingExpired());
1566
1575
  return this.flags.volatile && !h || (l ? (this.notifyOutgoingListeners(o), this.packet(o)) : this.sendBuffer.push(o)), this.flags = {}, this;
1567
1576
  }
1568
1577
  /**
@@ -1570,18 +1579,18 @@ class Ue extends g {
1570
1579
  */
1571
1580
  _registerAckCallback(e, t) {
1572
1581
  var s;
1573
- const r = (s = this.flags.timeout) !== null && s !== void 0 ? s : this._opts.ackTimeout;
1574
- if (r === void 0) {
1582
+ const i = (s = this.flags.timeout) !== null && s !== void 0 ? s : this._opts.ackTimeout;
1583
+ if (i === void 0) {
1575
1584
  this.acks[e] = t;
1576
1585
  return;
1577
1586
  }
1578
- const i = this.io.setTimeoutFn(() => {
1587
+ const r = this.io.setTimeoutFn(() => {
1579
1588
  delete this.acks[e];
1580
1589
  for (let h = 0; h < this.sendBuffer.length; h++)
1581
1590
  this.sendBuffer[h].id === e && this.sendBuffer.splice(h, 1);
1582
1591
  t.call(this, new Error("operation has timed out"));
1583
- }, r), o = (...h) => {
1584
- this.io.clearTimeoutFn(i), t.apply(this, h);
1592
+ }, i), o = (...h) => {
1593
+ this.io.clearTimeoutFn(r), t.apply(this, h);
1585
1594
  };
1586
1595
  o.withError = !0, this.acks[e] = o;
1587
1596
  }
@@ -1602,9 +1611,9 @@ class Ue extends g {
1602
1611
  * @return a Promise that will be fulfilled when the server acknowledges the event
1603
1612
  */
1604
1613
  emitWithAck(e, ...t) {
1605
- return new Promise((s, r) => {
1606
- const i = (o, h) => o ? r(o) : s(h);
1607
- i.withError = !0, t.push(i), this.emit(e, ...t);
1614
+ return new Promise((s, i) => {
1615
+ const r = (o, h) => o ? i(o) : s(h);
1616
+ r.withError = !0, t.push(r), this.emit(e, ...t);
1608
1617
  });
1609
1618
  }
1610
1619
  /**
@@ -1622,7 +1631,7 @@ class Ue extends g {
1622
1631
  args: e,
1623
1632
  flags: Object.assign({ fromQueue: !0 }, this.flags)
1624
1633
  };
1625
- e.push((r, ...i) => (this._queue[0], r !== null ? s.tryCount > this._opts.retries && (this._queue.shift(), t && t(r)) : (this._queue.shift(), t && t(null, ...i)), s.pending = !1, this._drainQueue())), this._queue.push(s), this._drainQueue();
1634
+ e.push((i, ...r) => (this._queue[0], i !== null ? s.tryCount > this._opts.retries && (this._queue.shift(), t && t(i)) : (this._queue.shift(), t && t(null, ...r)), s.pending = !1, this._drainQueue())), this._queue.push(s), this._drainQueue();
1626
1635
  }
1627
1636
  /**
1628
1637
  * Send the first packet of the queue, and wait for an acknowledgement from the server.
@@ -1756,11 +1765,11 @@ class Ue extends g {
1756
1765
  ack(e) {
1757
1766
  const t = this;
1758
1767
  let s = !1;
1759
- return function(...r) {
1768
+ return function(...i) {
1760
1769
  s || (s = !0, t.packet({
1761
1770
  type: p.ACK,
1762
1771
  id: e,
1763
- data: r
1772
+ data: i
1764
1773
  }));
1765
1774
  };
1766
1775
  }
@@ -2026,10 +2035,10 @@ class Ue extends g {
2026
2035
  }
2027
2036
  }
2028
2037
  }
2029
- function x(n) {
2038
+ function P(n) {
2030
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;
2031
2040
  }
2032
- x.prototype.duration = function() {
2041
+ P.prototype.duration = function() {
2033
2042
  var n = this.ms * Math.pow(this.factor, this.attempts++);
2034
2043
  if (this.jitter) {
2035
2044
  var e = Math.random(), t = Math.floor(e * this.jitter * n);
@@ -2037,28 +2046,28 @@ x.prototype.duration = function() {
2037
2046
  }
2038
2047
  return Math.min(n, this.max) | 0;
2039
2048
  };
2040
- x.prototype.reset = function() {
2049
+ P.prototype.reset = function() {
2041
2050
  this.attempts = 0;
2042
2051
  };
2043
- x.prototype.setMin = function(n) {
2052
+ P.prototype.setMin = function(n) {
2044
2053
  this.ms = n;
2045
2054
  };
2046
- x.prototype.setMax = function(n) {
2055
+ P.prototype.setMax = function(n) {
2047
2056
  this.max = n;
2048
2057
  };
2049
- x.prototype.setJitter = function(n) {
2058
+ P.prototype.setJitter = function(n) {
2050
2059
  this.jitter = n;
2051
2060
  };
2052
- class oe extends g {
2061
+ class ae extends g {
2053
2062
  constructor(e, t) {
2054
2063
  var s;
2055
- 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, J(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 x({
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, J(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 P({
2056
2065
  min: this.reconnectionDelay(),
2057
2066
  max: this.reconnectionDelayMax(),
2058
2067
  jitter: this.randomizationFactor()
2059
2068
  }), this.timeout(t.timeout == null ? 2e4 : t.timeout), this._readyState = "closed", this.uri = e;
2060
- const r = t.parser || Nt;
2061
- this.encoder = new r.Encoder(), this.decoder = new r.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
2069
+ const i = t.parser || It;
2070
+ this.encoder = new i.Encoder(), this.decoder = new i.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
2062
2071
  }
2063
2072
  reconnection(e) {
2064
2073
  return arguments.length ? (this._reconnection = !!e, e || (this.skipReconnect = !0), this) : this._reconnection;
@@ -2100,23 +2109,23 @@ class oe extends g {
2100
2109
  open(e) {
2101
2110
  if (~this._readyState.indexOf("open"))
2102
2111
  return this;
2103
- this.engine = new Tt(this.uri, this.opts);
2112
+ this.engine = new vt(this.uri, this.opts);
2104
2113
  const t = this.engine, s = this;
2105
2114
  this._readyState = "opening", this.skipReconnect = !1;
2106
- const r = b(t, "open", function() {
2115
+ const i = b(t, "open", function() {
2107
2116
  s.onopen(), e && e();
2108
- }), i = (h) => {
2117
+ }), r = (h) => {
2109
2118
  this.cleanup(), this._readyState = "closed", this.emitReserved("error", h), e ? e(h) : this.maybeReconnectOnOpen();
2110
- }, o = b(t, "error", i);
2119
+ }, o = b(t, "error", r);
2111
2120
  if (this._timeout !== !1) {
2112
2121
  const h = this._timeout, l = this.setTimeoutFn(() => {
2113
- r(), i(new Error("timeout")), t.close();
2122
+ i(), r(new Error("timeout")), t.close();
2114
2123
  }, h);
2115
2124
  this.opts.autoUnref && l.unref(), this.subs.push(() => {
2116
2125
  this.clearTimeoutFn(l);
2117
2126
  });
2118
2127
  }
2119
- return this.subs.push(r), this.subs.push(o), this;
2128
+ return this.subs.push(i), this.subs.push(o), this;
2120
2129
  }
2121
2130
  /**
2122
2131
  * Alias for open()
@@ -2170,7 +2179,7 @@ class oe extends g {
2170
2179
  * @private
2171
2180
  */
2172
2181
  ondecoded(e) {
2173
- G(() => {
2182
+ j(() => {
2174
2183
  this.emitReserved("packet", e);
2175
2184
  }, this.setTimeoutFn);
2176
2185
  }
@@ -2190,7 +2199,7 @@ class oe extends g {
2190
2199
  */
2191
2200
  socket(e, t) {
2192
2201
  let s = this.nsps[e];
2193
- return s ? this._autoConnect && !s.active && s.connect() : (s = new Ue(this, e, t), this.nsps[e] = s), s;
2202
+ return s ? this._autoConnect && !s.active && s.connect() : (s = new De(this, e, t), this.nsps[e] = s), s;
2194
2203
  }
2195
2204
  /**
2196
2205
  * Called upon a socket close.
@@ -2268,8 +2277,8 @@ class oe extends g {
2268
2277
  const t = this.backoff.duration();
2269
2278
  this._reconnecting = !0;
2270
2279
  const s = this.setTimeoutFn(() => {
2271
- e.skipReconnect || (this.emitReserved("reconnect_attempt", e.backoff.attempts), !e.skipReconnect && e.open((r) => {
2272
- r ? (e._reconnecting = !1, e.reconnect(), this.emitReserved("reconnect_error", r)) : e.onreconnect();
2280
+ e.skipReconnect || (this.emitReserved("reconnect_attempt", e.backoff.attempts), !e.skipReconnect && e.open((i) => {
2281
+ i ? (e._reconnecting = !1, e.reconnect(), this.emitReserved("reconnect_error", i)) : e.onreconnect();
2273
2282
  }));
2274
2283
  }, t);
2275
2284
  this.opts.autoUnref && s.unref(), this.subs.push(() => {
@@ -2287,20 +2296,20 @@ class oe extends g {
2287
2296
  this._reconnecting = !1, this.backoff.reset(), this.emitReserved("reconnect", e);
2288
2297
  }
2289
2298
  }
2290
- const N = {};
2291
- function M(n, e) {
2299
+ const I = {};
2300
+ function q(n, e) {
2292
2301
  typeof n == "object" && (e = n, n = void 0), e = e || {};
2293
- const t = vt(n, e.path || "/socket.io"), s = t.source, r = t.id, i = t.path, o = N[r] && i in N[r].nsps, h = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
2302
+ const t = kt(n, e.path || "/socket.io"), s = t.source, i = t.id, r = t.path, o = I[i] && r in I[i].nsps, h = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
2294
2303
  let l;
2295
- return h ? l = new oe(s, e) : (N[r] || (N[r] = new oe(s, e)), l = N[r]), t.query && !e.query && (e.query = t.queryKey), l.socket(t.path, e);
2304
+ return h ? l = new ae(s, e) : (I[i] || (I[i] = new ae(s, e)), l = I[i]), t.query && !e.query && (e.query = t.queryKey), l.socket(t.path, e);
2296
2305
  }
2297
- Object.assign(M, {
2298
- Manager: oe,
2299
- Socket: Ue,
2300
- io: M,
2301
- connect: M
2306
+ Object.assign(q, {
2307
+ Manager: ae,
2308
+ Socket: De,
2309
+ io: q,
2310
+ connect: q
2302
2311
  });
2303
- function Lt(n) {
2312
+ function qt(n) {
2304
2313
  try {
2305
2314
  const e = JSON.parse(n);
2306
2315
  if (e && typeof e == "object") {
@@ -2315,20 +2324,20 @@ function Lt(n) {
2315
2324
  }
2316
2325
  return {};
2317
2326
  }
2318
- class It extends Error {
2319
- constructor(t, s, r) {
2320
- const i = Lt(r);
2321
- super(i.message ?? `${s || "Request failed"} (${t})`);
2327
+ class Ut extends Error {
2328
+ constructor(t, s, i) {
2329
+ const r = qt(i);
2330
+ super(r.message ?? `${s || "Request failed"} (${t})`);
2322
2331
  w(this, "status");
2323
2332
  w(this, "code");
2324
2333
  w(this, "details");
2325
2334
  w(this, "body");
2326
- this.name = "RequestError", this.status = t, this.code = i.code, this.details = i.details, this.body = r;
2335
+ this.name = "RequestError", this.status = t, this.code = r.code, this.details = r.details, this.body = i;
2327
2336
  }
2328
2337
  }
2329
- const E = "item/folder", f = "item", S = "processor", qt = "npm-registry", C = "hidden", Q = "FILE", Z = "TOOL", ee = "APP";
2330
- var a, ce, u, $, V, H, he, ue, De;
2331
- const me = class me {
2338
+ const T = "item/folder", f = "item", S = "processor", Dt = "npm-registry", $ = "hidden", Z = "FILE", ee = "TOOL", te = "APP";
2339
+ var a, he, u, C, H, G, ue, le, Fe;
2340
+ const ge = class ge {
2332
2341
  /**
2333
2342
  * Creates a new EngineServicesClient instance.
2334
2343
  * @param accessToken - API access token (obtained from the platform dashboard)
@@ -2337,7 +2346,7 @@ const me = class me {
2337
2346
  * @param props - Optional configuration (retry count, auth mode, etc.).
2338
2347
  */
2339
2348
  constructor(e, t, s) {
2340
- K(this, a);
2349
+ W(this, a);
2341
2350
  w(this, "apiUrl");
2342
2351
  w(this, "accessToken");
2343
2352
  w(this, "wsUrl");
@@ -2356,9 +2365,9 @@ const me = class me {
2356
2365
  * Populated automatically when using {@link fromPlatformContext}.
2357
2366
  */
2358
2367
  w(this, "context");
2359
- const { retries: r = 0, useBearer: i = !1, localServerUrl: o } = s || {};
2368
+ const { retries: i = 0, useBearer: r = !1, localServerUrl: o } = s || {};
2360
2369
  let h = t;
2361
- if (h.charAt(h.length - 1) === "/" && (h = h.slice(0, -1)), this.apiUrl = `${h}/api`, this.accessToken = e, this.wsUrl = `${h}?accessToken=${e}`, this.retries = r, this.useBearer = i, this.context = { appId: "", projectId: "", accessToken: e, apiUrl: t }, o) {
2370
+ if (h.charAt(h.length - 1) === "/" && (h = h.slice(0, -1)), this.apiUrl = `${h}/api`, this.accessToken = e, this.wsUrl = `${h}?accessToken=${e}`, this.retries = i, this.useBearer = r, this.context = { appId: "", projectId: "", accessToken: e, apiUrl: t }, o) {
2362
2371
  let l = o;
2363
2372
  l.charAt(l.length - 1) === "/" && (l = l.slice(0, -1)), this.localServerUrl = l;
2364
2373
  }
@@ -2380,7 +2389,7 @@ const me = class me {
2380
2389
  * ```
2381
2390
  */
2382
2391
  static fromPlatformContext(e) {
2383
- const t = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new me(t.accessToken, t.apiUrl, {
2392
+ const t = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new ge(t.accessToken, t.apiUrl, {
2384
2393
  ...e,
2385
2394
  useBearer: !0
2386
2395
  });
@@ -2432,6 +2441,14 @@ const me = class me {
2432
2441
  * the new token is picked up on every request — expired tokens no
2433
2442
  * longer stick around.
2434
2443
  */
2444
+ /**
2445
+ * Socket origin without namespace or query, for gateways other than the
2446
+ * execution one. `wsUrl` already carries a token that may be stale when a
2447
+ * provider is in play, so callers append their own.
2448
+ */
2449
+ get socketOrigin() {
2450
+ return this.wsUrl.split("?")[0];
2451
+ }
2435
2452
  async resolveAccessToken() {
2436
2453
  return this.accessToken;
2437
2454
  }
@@ -2451,12 +2468,12 @@ const me = class me {
2451
2468
  * @returns Array of file items.
2452
2469
  */
2453
2470
  async listFiles(e) {
2454
- const { folderId: t, archived: s, projectId: r } = e || {};
2455
- return t ? await c(this, a, u).call(this, "GET", `${E}/${t}/items`, { query: { itemType: Q, archived: s } }) : await c(this, a, u).call(this, "GET", `${f}`, {
2471
+ const { folderId: t, archived: s, projectId: i } = e || {};
2472
+ return t ? await c(this, a, u).call(this, "GET", `${T}/${t}/items`, { query: { itemType: Z, archived: s } }) : await c(this, a, u).call(this, "GET", `${f}`, {
2456
2473
  query: {
2457
- itemType: Q,
2474
+ itemType: Z,
2458
2475
  archived: s,
2459
- ...r && { projectId: r }
2476
+ ...i && { projectId: i }
2460
2477
  }
2461
2478
  });
2462
2479
  }
@@ -2467,7 +2484,7 @@ const me = class me {
2467
2484
  * @returns The file item, optionally with version history.
2468
2485
  */
2469
2486
  async getFile(e, t) {
2470
- return await c(this, a, ue).call(this, e, t);
2487
+ return await c(this, a, le).call(this, e, t);
2471
2488
  }
2472
2489
  /**
2473
2490
  * Uploads a new file.
@@ -2475,7 +2492,7 @@ const me = class me {
2475
2492
  * @returns The created item and its first version.
2476
2493
  */
2477
2494
  async createFile(e) {
2478
- return await c(this, a, H).call(this, e, Q);
2495
+ return await c(this, a, G).call(this, e, Z);
2479
2496
  }
2480
2497
  /**
2481
2498
  * Updates an existing file. Can rename, move to a different folder,
@@ -2485,7 +2502,7 @@ const me = class me {
2485
2502
  * @returns The updated item and/or the new version.
2486
2503
  */
2487
2504
  async updateFile(e, t) {
2488
- return await c(this, a, he).call(this, e, t);
2505
+ return await c(this, a, ue).call(this, e, t);
2489
2506
  }
2490
2507
  /**
2491
2508
  * Archives (soft-deletes) a file. Can be recovered with {@link recoverFile}.
@@ -2508,7 +2525,7 @@ const me = class me {
2508
2525
  * @returns A fetch Response containing the file data.
2509
2526
  */
2510
2527
  async downloadFile(e, t) {
2511
- return await c(this, a, V).call(this, e, t);
2528
+ return await c(this, a, H).call(this, e, t);
2512
2529
  }
2513
2530
  /**
2514
2531
  * Retrieves the free-JSON metadata for a specific file version.
@@ -2518,10 +2535,10 @@ const me = class me {
2518
2535
  * @param params - Optional flags such as `withDraft`.
2519
2536
  */
2520
2537
  async getFileVersionMetadata(e, t, s) {
2521
- const { withDraft: r } = s || {};
2538
+ const { withDraft: i } = s || {};
2522
2539
  return await c(this, a, u).call(this, "GET", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
2523
2540
  query: {
2524
- ...r && { withDraft: "true" }
2541
+ ...i && { withDraft: "true" }
2525
2542
  }
2526
2543
  });
2527
2544
  }
@@ -2552,12 +2569,12 @@ const me = class me {
2552
2569
  * @returns Array of folder items.
2553
2570
  */
2554
2571
  async listFolders(e) {
2555
- const { archived: t, parentFolderId: s, projectId: r } = e || {};
2556
- return await c(this, a, u).call(this, "GET", E, {
2572
+ const { archived: t, parentFolderId: s, projectId: i } = e || {};
2573
+ return await c(this, a, u).call(this, "GET", T, {
2557
2574
  query: {
2558
2575
  parentFolderId: s,
2559
2576
  archived: t,
2560
- ...r && { projectId: r }
2577
+ ...i && { projectId: i }
2561
2578
  }
2562
2579
  });
2563
2580
  }
@@ -2566,7 +2583,7 @@ const me = class me {
2566
2583
  * @param folderId - The folder's unique identifier.
2567
2584
  */
2568
2585
  async getFolder(e) {
2569
- return await c(this, a, u).call(this, "GET", `${E}/${e}`);
2586
+ return await c(this, a, u).call(this, "GET", `${T}/${e}`);
2570
2587
  }
2571
2588
  /**
2572
2589
  * Creates a new folder.
@@ -2575,7 +2592,7 @@ const me = class me {
2575
2592
  * @returns The created folder.
2576
2593
  */
2577
2594
  async createFolder(e, t, s) {
2578
- return await c(this, a, u).call(this, "POST", E, {
2595
+ return await c(this, a, u).call(this, "POST", T, {
2579
2596
  body: JSON.stringify({
2580
2597
  name: e,
2581
2598
  ...t && { parentId: t },
@@ -2592,7 +2609,7 @@ const me = class me {
2592
2609
  */
2593
2610
  async updateFolder(e, t) {
2594
2611
  const { name: s } = t;
2595
- return await c(this, a, u).call(this, "PUT", `${E}/${e}`, {
2612
+ return await c(this, a, u).call(this, "PUT", `${T}/${e}`, {
2596
2613
  body: JSON.stringify({ name: s }),
2597
2614
  contentType: "application/json"
2598
2615
  });
@@ -2602,14 +2619,14 @@ const me = class me {
2602
2619
  * @param folderId - The folder's unique identifier.
2603
2620
  */
2604
2621
  async archiveFolder(e) {
2605
- return await c(this, a, u).call(this, "DELETE", `${E}/${e}`);
2622
+ return await c(this, a, u).call(this, "DELETE", `${T}/${e}`);
2606
2623
  }
2607
2624
  /**
2608
2625
  * Recovers a previously archived folder.
2609
2626
  * @param folderId - The folder's unique identifier.
2610
2627
  */
2611
2628
  async recoverFolder(e) {
2612
- return await c(this, a, u).call(this, "PUT", `${E}/${e}/recover`);
2629
+ return await c(this, a, u).call(this, "PUT", `${T}/${e}/recover`);
2613
2630
  }
2614
2631
  /**
2615
2632
  * Downloads an entire folder as a ZIP archive.
@@ -2617,7 +2634,7 @@ const me = class me {
2617
2634
  * @returns A fetch Response containing the ZIP data.
2618
2635
  */
2619
2636
  async downloadFolder(e) {
2620
- return await c(this, a, $).call(this, `${E}/${e}/download`);
2637
+ return await c(this, a, C).call(this, `${T}/${e}/download`);
2621
2638
  }
2622
2639
  // ─── Components ──────────────────────────────────────────────────
2623
2640
  /**
@@ -2626,17 +2643,17 @@ const me = class me {
2626
2643
  * @returns Array of component items.
2627
2644
  */
2628
2645
  async listComponents(e) {
2629
- const { folderId: t, ShowVersions: s, projectId: r } = e || {};
2630
- return t ? await c(this, a, u).call(this, "GET", `${E}/${t}/items`, {
2646
+ const { folderId: t, ShowVersions: s, projectId: i } = e || {};
2647
+ return t ? await c(this, a, u).call(this, "GET", `${T}/${t}/items`, {
2631
2648
  query: {
2632
- itemType: Z,
2649
+ itemType: ee,
2633
2650
  ...s && { ShowVersions: s }
2634
2651
  }
2635
2652
  }) : await c(this, a, u).call(this, "GET", `${f}`, {
2636
2653
  query: {
2637
- itemType: Z,
2654
+ itemType: ee,
2638
2655
  ...s && { ShowVersions: s },
2639
- ...r && { projectId: r }
2656
+ ...i && { projectId: i }
2640
2657
  }
2641
2658
  });
2642
2659
  }
@@ -2646,7 +2663,7 @@ const me = class me {
2646
2663
  * @param props - Options such as whether to include versions.
2647
2664
  */
2648
2665
  async getComponent(e, t) {
2649
- return await c(this, a, ue).call(this, e, t);
2666
+ return await c(this, a, le).call(this, e, t);
2650
2667
  }
2651
2668
  /**
2652
2669
  * Creates a new component with the given file and version properties.
@@ -2655,7 +2672,7 @@ const me = class me {
2655
2672
  */
2656
2673
  async createComponent(e) {
2657
2674
  const { componentProps: t } = e;
2658
- return await c(this, a, H).call(this, e, Z, t);
2675
+ return await c(this, a, G).call(this, e, ee, t);
2659
2676
  }
2660
2677
  /**
2661
2678
  * Updates an existing component. Can rename, move, and/or upload a new version.
@@ -2665,7 +2682,7 @@ const me = class me {
2665
2682
  */
2666
2683
  async updateComponent(e, t) {
2667
2684
  const { componentProps: s } = t;
2668
- return await c(this, a, he).call(this, e, t, s);
2685
+ return await c(this, a, ue).call(this, e, t, s);
2669
2686
  }
2670
2687
  /**
2671
2688
  * Downloads a component's full ZIP file. Returns the raw fetch Response.
@@ -2674,7 +2691,7 @@ const me = class me {
2674
2691
  * @returns A fetch Response containing the ZIP data.
2675
2692
  */
2676
2693
  async downloadComponent(e, t) {
2677
- return await c(this, a, V).call(this, e, t);
2694
+ return await c(this, a, H).call(this, e, t);
2678
2695
  }
2679
2696
  /**
2680
2697
  * Downloads only the JavaScript bundle from a component's ZIP.
@@ -2684,11 +2701,11 @@ const me = class me {
2684
2701
  * @returns A fetch Response containing the bundle JavaScript text.
2685
2702
  */
2686
2703
  async downloadComponentBundle(e, t) {
2687
- const { versionTag: s, withDraft: r } = t || {};
2688
- return await c(this, a, $).call(this, `${f}/${e}/download/bundle`, {
2704
+ const { versionTag: s, withDraft: i } = t || {};
2705
+ return await c(this, a, C).call(this, `${f}/${e}/download/bundle`, {
2689
2706
  query: {
2690
2707
  ...s && { versionTag: s },
2691
- ...r && { withDraft: r }
2708
+ ...i && { withDraft: i }
2692
2709
  }
2693
2710
  });
2694
2711
  }
@@ -2713,7 +2730,7 @@ const me = class me {
2713
2730
  * @returns The component's JavaScript source code as a string.
2714
2731
  */
2715
2732
  async getBuiltInComponent(e) {
2716
- return await (await c(this, a, $).call(this, `built-in/${e}/bundle`)).text();
2733
+ return await (await c(this, a, C).call(this, `built-in/${e}/bundle`)).text();
2717
2734
  }
2718
2735
  /**
2719
2736
  * Fetches a built-in component bundle, evaluates it, and registers it
@@ -2742,7 +2759,7 @@ const me = class me {
2742
2759
  * ```
2743
2760
  */
2744
2761
  async initBuiltInComponent(e, t, s) {
2745
- const r = await this.getBuiltInComponent(e.uuid), i = s ?? this.builtInGlobals ?? (typeof window < "u" ? window.ThatOpenCompany : {}) ?? {}, o = Object.keys(i), h = o.map((m) => i[m]), y = new Function(...o, `${r}
2762
+ const i = await this.getBuiltInComponent(e.uuid), r = s ?? this.builtInGlobals ?? (typeof window < "u" ? window.ThatOpenCompany : {}) ?? {}, o = Object.keys(r), h = o.map((m) => r[m]), y = new Function(...o, `${i}
2746
2763
  return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2747
2764
  t.get(d);
2748
2765
  }
@@ -2787,12 +2804,12 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2787
2804
  */
2788
2805
  async setup(e, ...t) {
2789
2806
  var o, h;
2790
- const s = e.OBC, r = e.BUI;
2807
+ const s = e.OBC, i = e.BUI;
2791
2808
  if (!(s != null && s.Components))
2792
2809
  throw new Error("globals.OBC must include Components");
2793
- if (!(r != null && r.Manager)) throw new Error("globals.BUI must include Manager");
2794
- const i = new s.Components();
2795
- return r.Manager.init(), this.setBuiltInGlobals(e), await this.initBuiltInComponents(i, ...t), i.init(), (h = (o = this.context.appEventOrchestrator) == null ? void 0 : o.appLoaded) == null || h.call(o), { components: i };
2810
+ if (!(i != null && i.Manager)) throw new Error("globals.BUI must include Manager");
2811
+ const r = new s.Components();
2812
+ return i.Manager.init(), this.setBuiltInGlobals(e), await this.initBuiltInComponents(r, ...t), r.init(), (h = (o = this.context.appEventOrchestrator) == null ? void 0 : o.appLoaded) == null || h.call(o), { components: r };
2796
2813
  }
2797
2814
  /**
2798
2815
  * Reports an error to the platform via the {@link AppEventOrchestrator.appError} callback.
@@ -2800,8 +2817,8 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2800
2817
  * @param data - Arbitrary error data to send to the platform.
2801
2818
  */
2802
2819
  throwError(e, t) {
2803
- var s, r;
2804
- (r = (s = this.context.appEventOrchestrator) == null ? void 0 : s.appError) == null || r.call(s, e, t);
2820
+ var s, i;
2821
+ (i = (s = this.context.appEventOrchestrator) == null ? void 0 : s.appError) == null || i.call(s, e, t);
2805
2822
  }
2806
2823
  // ─── Apps ────────────────────────────────────────────────────────
2807
2824
  /**
@@ -2810,17 +2827,17 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2810
2827
  * @returns Array of app items.
2811
2828
  */
2812
2829
  async listApps(e) {
2813
- const { folderId: t, ShowVersions: s, projectId: r } = e || {};
2814
- return t ? await c(this, a, u).call(this, "GET", `${E}/${t}/items`, {
2830
+ const { folderId: t, ShowVersions: s, projectId: i } = e || {};
2831
+ return t ? await c(this, a, u).call(this, "GET", `${T}/${t}/items`, {
2815
2832
  query: {
2816
- itemType: ee,
2833
+ itemType: te,
2817
2834
  ...s && { ShowVersions: s }
2818
2835
  }
2819
2836
  }) : await c(this, a, u).call(this, "GET", `${f}`, {
2820
2837
  query: {
2821
- itemType: ee,
2838
+ itemType: te,
2822
2839
  ...s && { ShowVersions: s },
2823
- ...r && { projectId: r }
2840
+ ...i && { projectId: i }
2824
2841
  }
2825
2842
  });
2826
2843
  }
@@ -2831,7 +2848,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2831
2848
  */
2832
2849
  async createApp(e) {
2833
2850
  const { appProps: t } = e;
2834
- return await c(this, a, H).call(this, e, ee, t);
2851
+ return await c(this, a, G).call(this, e, te, t);
2835
2852
  }
2836
2853
  /**
2837
2854
  * Downloads an app's full ZIP file. Returns the raw fetch Response.
@@ -2840,7 +2857,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2840
2857
  * @returns A fetch Response containing the ZIP data.
2841
2858
  */
2842
2859
  async downloadApp(e, t) {
2843
- return await c(this, a, V).call(this, e, t);
2860
+ return await c(this, a, H).call(this, e, t);
2844
2861
  }
2845
2862
  /**
2846
2863
  * Downloads only the JavaScript bundle from an app's ZIP.
@@ -2850,11 +2867,11 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2850
2867
  * @returns A fetch Response containing the bundle JavaScript text.
2851
2868
  */
2852
2869
  async downloadAppBundle(e, t) {
2853
- const { versionTag: s, withDraft: r } = t || {};
2854
- return await c(this, a, $).call(this, `${f}/${e}/download/bundle`, {
2870
+ const { versionTag: s, withDraft: i } = t || {};
2871
+ return await c(this, a, C).call(this, `${f}/${e}/download/bundle`, {
2855
2872
  query: {
2856
2873
  ...s && { versionTag: s },
2857
- ...r && { withDraft: r }
2874
+ ...i && { withDraft: i }
2858
2875
  }
2859
2876
  });
2860
2877
  }
@@ -2875,7 +2892,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2875
2892
  * @returns The registry, scope, read-only token, and assembled `.npmrc`.
2876
2893
  */
2877
2894
  async getNpmCredentials() {
2878
- return await c(this, a, u).call(this, "GET", `${qt}/credentials`);
2895
+ return await c(this, a, u).call(this, "GET", `${Dt}/credentials`);
2879
2896
  }
2880
2897
  // ─── Execution ───────────────────────────────────────────────────
2881
2898
  /**
@@ -2894,16 +2911,16 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2894
2911
  */
2895
2912
  async executeComponent(e, t, s) {
2896
2913
  if (this.localServerUrl) {
2897
- const r = `${this.localServerUrl}/api/${S}/${e}/execute`, i = await fetch(r, {
2914
+ const i = `${this.localServerUrl}/api/${S}/${e}/execute`, r = await fetch(i, {
2898
2915
  method: "POST",
2899
2916
  headers: { "Content-Type": "application/json" },
2900
2917
  body: JSON.stringify(t)
2901
2918
  });
2902
- if (!i.ok) {
2903
- const o = await i.text().catch(() => "");
2904
- throw new Error(`Local server request failed: ${i.status} - ${o}`);
2919
+ if (!r.ok) {
2920
+ const o = await r.text().catch(() => "");
2921
+ throw new Error(`Local server request failed: ${r.status} - ${o}`);
2905
2922
  }
2906
- return await i.json();
2923
+ return await r.json();
2907
2924
  }
2908
2925
  return await c(this, a, u).call(this, "POST", `${S}/${e}/execute`, {
2909
2926
  body: JSON.stringify(t),
@@ -2919,8 +2936,8 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2919
2936
  if (this.localServerUrl) {
2920
2937
  const t = `${this.localServerUrl}/api/${S}/progress/${e}/abort`, s = await fetch(t, { method: "POST" });
2921
2938
  if (!s.ok) {
2922
- const r = await s.text().catch(() => "");
2923
- throw new Error(`Local server request failed: ${s.status} - ${r}`);
2939
+ const i = await s.text().catch(() => "");
2940
+ throw new Error(`Local server request failed: ${s.status} - ${i}`);
2924
2941
  }
2925
2942
  return await s.json();
2926
2943
  }
@@ -2941,14 +2958,14 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2941
2958
  */
2942
2959
  async listExecutions(e, t) {
2943
2960
  if (this.localServerUrl) {
2944
- const s = t ? `?projectId=${encodeURIComponent(t)}` : "", r = `${this.localServerUrl}/api/${S}/${e}/progress${s}`, i = await fetch(r);
2945
- if (!i.ok) {
2946
- const o = await i.text().catch(() => "");
2961
+ const s = t ? `?projectId=${encodeURIComponent(t)}` : "", i = `${this.localServerUrl}/api/${S}/${e}/progress${s}`, r = await fetch(i);
2962
+ if (!r.ok) {
2963
+ const o = await r.text().catch(() => "");
2947
2964
  throw new Error(
2948
- `Local server request failed: ${i.status} - ${o}`
2965
+ `Local server request failed: ${r.status} - ${o}`
2949
2966
  );
2950
2967
  }
2951
- return await i.json();
2968
+ return await r.json();
2952
2969
  }
2953
2970
  return await c(this, a, u).call(this, "GET", `${S}/${e}/progress`, { query: { ...t && { projectId: t } } });
2954
2971
  }
@@ -2961,8 +2978,8 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2961
2978
  if (this.localServerUrl) {
2962
2979
  const t = `${this.localServerUrl}/api/${S}/progress/${e}`, s = await fetch(t);
2963
2980
  if (!s.ok) {
2964
- const r = await s.text().catch(() => "");
2965
- throw new Error(`Local server request failed: ${s.status} - ${r}`);
2981
+ const i = await s.text().catch(() => "");
2982
+ throw new Error(`Local server request failed: ${s.status} - ${i}`);
2966
2983
  }
2967
2984
  return await s.json();
2968
2985
  }
@@ -2975,15 +2992,15 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2975
2992
  * @param onUpdateCallback - Callback invoked on each progress/result event.
2976
2993
  */
2977
2994
  async onExecutionProgress(e, t) {
2978
- const s = this.localServerUrl ? `${this.localServerUrl}?accessToken=${this.accessToken}` : this.wsUrl, r = await M(s, {
2995
+ const s = this.localServerUrl ? `${this.localServerUrl}?accessToken=${this.accessToken}` : this.wsUrl, i = await q(s, {
2979
2996
  ...this.localServerUrl && { transports: ["websocket"] }
2980
2997
  });
2981
- r.on("connect", function() {
2982
- r.emit("executionSubscription", JSON.stringify({ executionId: e })), r.on("execution", (i) => {
2983
- t(i);
2998
+ i.on("connect", function() {
2999
+ i.emit("executionSubscription", JSON.stringify({ executionId: e })), i.on("execution", (r) => {
3000
+ t(r);
2984
3001
  });
2985
- }), r.on("connect_error", function(i) {
2986
- console.log(i);
3002
+ }), i.on("connect_error", function(r) {
3003
+ console.log(r);
2987
3004
  });
2988
3005
  }
2989
3006
  // ─── Hidden Files ────────────────────────────────────────────────
@@ -2995,7 +3012,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2995
3012
  */
2996
3013
  async createHiddenFile(e, t) {
2997
3014
  const s = new FormData();
2998
- return s.append("file", e), s.append("parentItemId", t), await c(this, a, u).call(this, "POST", `${f}/${C}`, {
3015
+ return s.append("file", e), s.append("parentItemId", t), await c(this, a, u).call(this, "POST", `${f}/${$}`, {
2999
3016
  body: s
3000
3017
  });
3001
3018
  }
@@ -3009,9 +3026,9 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3009
3026
  */
3010
3027
  async createHiddenFilesBatch(e, t) {
3011
3028
  const s = new FormData();
3012
- for (const r of e)
3013
- s.append("files", r);
3014
- return s.append("parentItemId", t), await c(this, a, u).call(this, "POST", `${f}/${C}/batch`, {
3029
+ for (const i of e)
3030
+ s.append("files", i);
3031
+ return s.append("parentItemId", t), await c(this, a, u).call(this, "POST", `${f}/${$}/batch`, {
3015
3032
  body: s
3016
3033
  });
3017
3034
  }
@@ -3020,21 +3037,21 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3020
3037
  * @param hiddenId - The hidden file's unique identifier.
3021
3038
  */
3022
3039
  async deleteHiddenFile(e) {
3023
- return await c(this, a, u).call(this, "DELETE", `${f}/${C}/${e}`);
3040
+ return await c(this, a, u).call(this, "DELETE", `${f}/${$}/${e}`);
3024
3041
  }
3025
3042
  /**
3026
3043
  * Gets metadata for a hidden file.
3027
3044
  * @param hiddenId - The hidden file's unique identifier.
3028
3045
  */
3029
3046
  async getHiddenFile(e) {
3030
- return await c(this, a, u).call(this, "GET", `${f}/${C}/${e}`);
3047
+ return await c(this, a, u).call(this, "GET", `${f}/${$}/${e}`);
3031
3048
  }
3032
3049
  /**
3033
3050
  * Downloads a hidden file's content. Returns the raw fetch Response.
3034
3051
  * @param hiddenId - The hidden file's unique identifier.
3035
3052
  */
3036
3053
  async downloadHiddenFile(e) {
3037
- return await c(this, a, $).call(this, `${f}/${C}/${e}/download`);
3054
+ return await c(this, a, C).call(this, `${f}/${$}/${e}/download`);
3038
3055
  }
3039
3056
  /**
3040
3057
  * Mints a short-lived presigned URL for a hidden file so the browser can
@@ -3054,7 +3071,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3054
3071
  * an ISO timestamp when it stops working.
3055
3072
  */
3056
3073
  async getHiddenFileSignedUrl(e, t) {
3057
- return await c(this, a, u).call(this, "GET", `${f}/${C}/${e}/signed-url`, { ...t != null && { query: { expiresIn: t } } });
3074
+ return await c(this, a, u).call(this, "GET", `${f}/${$}/${e}/signed-url`, { ...t != null && { query: { expiresIn: t } } });
3058
3075
  }
3059
3076
  /**
3060
3077
  * Lists all hidden files attached to a parent item.
@@ -3062,14 +3079,14 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3062
3079
  * @returns Array of hidden file entities.
3063
3080
  */
3064
3081
  async getHiddenFilesByParent(e) {
3065
- return await c(this, a, u).call(this, "GET", `${f}/${e}/${C}`);
3082
+ return await c(this, a, u).call(this, "GET", `${f}/${e}/${$}`);
3066
3083
  }
3067
3084
  /**
3068
3085
  * Deletes all hidden files attached to a parent item.
3069
3086
  * @param parentFileId - The parent item's unique identifier.
3070
3087
  */
3071
3088
  async deleteHiddenFilesByParent(e) {
3072
- return await c(this, a, u).call(this, "DELETE", `${f}/${e}/${C}`);
3089
+ return await c(this, a, u).call(this, "DELETE", `${f}/${e}/${$}`);
3073
3090
  }
3074
3091
  // ─── Icons ───────────────────────────────────────────────────────
3075
3092
  /**
@@ -3089,7 +3106,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3089
3106
  * @returns The raw Response (use `.blob()`, `.arrayBuffer()`, or pipe the body).
3090
3107
  */
3091
3108
  async getItemIcon(e) {
3092
- return await c(this, a, $).call(this, `${f}/${e}/icon`);
3109
+ return await c(this, a, C).call(this, `${f}/${e}/icon`);
3093
3110
  }
3094
3111
  /**
3095
3112
  * Removes the icon from an item.
@@ -3122,9 +3139,9 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3122
3139
  * @param metadata - Optional free-JSON metadata to store on the new version.
3123
3140
  * @returns The created version.
3124
3141
  */
3125
- async createVersion(e, t, s, r, i) {
3142
+ async createVersion(e, t, s, i, r) {
3126
3143
  const o = new FormData();
3127
- 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, a, u).call(this, "POST", `${f}/${e}/version`, { body: o });
3144
+ return o.append("file", t), o.append("versionTag", s), i && o.append("extraProps", JSON.stringify(i)), r && o.append("metadata", JSON.stringify(r)), await c(this, a, u).call(this, "POST", `${f}/${e}/version`, { body: o });
3128
3145
  }
3129
3146
  /**
3130
3147
  * Lists versions of an item. Pass `archived: true` to fetch only archived
@@ -3167,10 +3184,10 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3167
3184
  return await c(this, a, u).call(this, "DELETE", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}`);
3168
3185
  }
3169
3186
  };
3170
- a = new WeakSet(), ce = function(e) {
3187
+ a = new WeakSet(), he = function(e) {
3171
3188
  return `${this.apiUrl}/${e}`;
3172
3189
  }, u = async function(e, t, s) {
3173
- const { body: r, query: i, contentType: o, retries: h, responseType: l } = s || {}, y = c(this, a, ce).call(this, t), d = c(this, a, De).call(this, i), m = await this.resolveAccessToken(), k = {
3190
+ const { body: i, query: r, contentType: o, retries: h, responseType: l } = s || {}, y = c(this, a, he).call(this, t), d = c(this, a, Fe).call(this, r), m = await this.resolveAccessToken(), k = {
3174
3191
  ...d,
3175
3192
  ...this.useBearer ? {} : { accessToken: m }
3176
3193
  };
@@ -3184,12 +3201,12 @@ a = new WeakSet(), ce = function(e) {
3184
3201
  ...o && { "Content-Type": o },
3185
3202
  ...this.useBearer && { Authorization: `Bearer ${m}` }
3186
3203
  },
3187
- ...r && { body: r }
3204
+ ...i && { body: i }
3188
3205
  }
3189
3206
  );
3190
3207
  if (!A.ok) {
3191
- const O = await A.text().then((Fe) => Fe).catch(() => "");
3192
- throw new It(
3208
+ const O = await A.text().then((Me) => Me).catch(() => "");
3209
+ throw new Ut(
3193
3210
  A.status,
3194
3211
  A.statusText,
3195
3212
  O
@@ -3206,45 +3223,45 @@ a = new WeakSet(), ce = function(e) {
3206
3223
  });
3207
3224
  throw A;
3208
3225
  }
3209
- }, $ = async function(e, t) {
3210
- const { query: s } = t || {}, r = c(this, a, ce).call(this, e), i = await this.resolveAccessToken(), o = {
3226
+ }, C = async function(e, t) {
3227
+ const { query: s } = t || {}, i = c(this, a, he).call(this, e), r = await this.resolveAccessToken(), o = {
3211
3228
  ...s,
3212
- ...this.useBearer ? {} : { accessToken: i }
3229
+ ...this.useBearer ? {} : { accessToken: r }
3213
3230
  };
3214
3231
  return await fetch(
3215
- r + "?" + new URLSearchParams(o).toString(),
3232
+ i + "?" + new URLSearchParams(o).toString(),
3216
3233
  {
3217
3234
  method: "GET",
3218
3235
  ...this.useBearer && {
3219
- headers: { Authorization: `Bearer ${i}` }
3236
+ headers: { Authorization: `Bearer ${r}` }
3220
3237
  }
3221
3238
  }
3222
3239
  );
3223
- }, V = async function(e, t) {
3224
- const { versionTag: s, withDraft: r } = t || {};
3225
- return await c(this, a, $).call(this, `${f}/${e}/download`, {
3240
+ }, H = async function(e, t) {
3241
+ const { versionTag: s, withDraft: i } = t || {};
3242
+ return await c(this, a, C).call(this, `${f}/${e}/download`, {
3226
3243
  query: {
3227
3244
  ...s && { versionTag: s },
3228
- ...r && { withDraft: r }
3245
+ ...i && { withDraft: i }
3229
3246
  }
3230
3247
  });
3231
- }, H = async function(e, t, s) {
3232
- const { name: r, versionTag: i, parentFolderId: o, projectId: h, file: l, metadata: y } = e, d = new FormData();
3233
- return d.append("file", l), d.append("name", r), d.append("versionTag", i), d.append("itemType", t), o && d.append("folderId", o), h && d.append("projectId", h), s && d.append("extraProps", JSON.stringify(s)), y && d.append("metadata", JSON.stringify(y)), await c(this, a, u).call(this, "POST", f, {
3248
+ }, G = async function(e, t, s) {
3249
+ const { name: i, versionTag: r, parentFolderId: o, projectId: h, file: l, metadata: y } = e, d = new FormData();
3250
+ return d.append("file", l), d.append("name", i), d.append("versionTag", r), d.append("itemType", t), o && d.append("folderId", o), h && d.append("projectId", h), s && d.append("extraProps", JSON.stringify(s)), y && d.append("metadata", JSON.stringify(y)), await c(this, a, u).call(this, "POST", f, {
3234
3251
  body: d
3235
3252
  });
3236
- }, he = async function(e, t, s) {
3237
- const { name: r, versionTag: i, parentFolderId: o, file: h, metadata: l } = t;
3253
+ }, ue = async function(e, t, s) {
3254
+ const { name: i, versionTag: r, parentFolderId: o, file: h, metadata: l } = t;
3238
3255
  let y, d;
3239
3256
  if (h) {
3240
3257
  const m = new FormData();
3241
- m.append("file", h), i && m.append("versionTag", i), s && m.append("extraProps", JSON.stringify(s)), l && m.append("metadata", JSON.stringify(l)), d = await c(this, a, u).call(this, "POST", `${f}/${e}/version`, {
3258
+ m.append("file", h), r && m.append("versionTag", r), s && m.append("extraProps", JSON.stringify(s)), l && m.append("metadata", JSON.stringify(l)), d = await c(this, a, u).call(this, "POST", `${f}/${e}/version`, {
3242
3259
  body: m
3243
3260
  });
3244
3261
  }
3245
- if (r || o) {
3262
+ if (i || o) {
3246
3263
  const m = {
3247
- ...r && { name: r },
3264
+ ...i && { name: i },
3248
3265
  ...o && { folderId: o }
3249
3266
  }, k = JSON.stringify(m);
3250
3267
  y = await c(this, a, u).call(this, "PUT", `${f}/${e}`, {
@@ -3253,21 +3270,21 @@ a = new WeakSet(), ce = function(e) {
3253
3270
  });
3254
3271
  }
3255
3272
  return { item: y, version: d };
3256
- }, ue = async function(e, t) {
3273
+ }, le = async function(e, t) {
3257
3274
  const { showVersions: s = !1 } = t || {};
3258
3275
  return await c(this, a, u).call(this, "GET", `${f}/${e}`, {
3259
3276
  query: { showVersions: s }
3260
3277
  });
3261
- }, De = function(e) {
3278
+ }, Fe = function(e) {
3262
3279
  return e && Object.entries(e).filter(([, t]) => t !== void 0).reduce(
3263
- (t, [s, r]) => (t[s] = r, t),
3280
+ (t, [s, i]) => (t[s] = i, t),
3264
3281
  {}
3265
3282
  );
3266
3283
  };
3267
- let ae = me;
3268
- const q = "project";
3269
- var B;
3270
- const ge = class ge extends ae {
3284
+ let ce = ge;
3285
+ const B = "project", N = "notifications";
3286
+ var x;
3287
+ const we = class we extends ce {
3271
3288
  /**
3272
3289
  * @param token - A bearer JWT, OR a function returning the current JWT
3273
3290
  * (sync or async). When a function is passed, it's invoked before every
@@ -3276,13 +3293,13 @@ const ge = class ge extends ae {
3276
3293
  * @param props - Optional client configuration. `useBearer` is forced to
3277
3294
  * `true` and cannot be overridden.
3278
3295
  */
3279
- constructor(t, s, r) {
3280
- super(typeof t == "string" ? t : "", s, { ...r, useBearer: !0 });
3281
- K(this, B);
3282
- typeof t == "function" && _e(this, B, t);
3296
+ constructor(t, s, i) {
3297
+ super(typeof t == "string" ? t : "", s, { ...i, useBearer: !0 });
3298
+ W(this, x);
3299
+ typeof t == "function" && be(this, x, t);
3283
3300
  }
3284
3301
  async resolveAccessToken() {
3285
- return Y(this, B) ? await Y(this, B).call(this) : super.resolveAccessToken();
3302
+ return K(this, x) ? await K(this, x).call(this) : super.resolveAccessToken();
3286
3303
  }
3287
3304
  /**
3288
3305
  * Creates a client from the platform context injected into
@@ -3291,8 +3308,8 @@ const ge = class ge extends ae {
3291
3308
  * carries a fresh JWT on every navigation.
3292
3309
  */
3293
3310
  static fromPlatformContext(t) {
3294
- const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, r = new ge(s.accessToken, s.apiUrl, t);
3295
- return r.context = s, r;
3311
+ const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, i = new we(s.accessToken, s.apiUrl, t);
3312
+ return i.context = s, i;
3296
3313
  }
3297
3314
  // ─── Projects (JWT-only backend routes) ──────────────────────────
3298
3315
  /**
@@ -3300,7 +3317,7 @@ const ge = class ge extends ae {
3300
3317
  * `GET /project/:id` is guarded by `AccountActiveGuard + ProjectAccessGuard`.
3301
3318
  */
3302
3319
  async getProject(t) {
3303
- return await this.request("GET", `${q}/${t}`);
3320
+ return await this.request("GET", `${B}/${t}`);
3304
3321
  }
3305
3322
  /**
3306
3323
  * Gets the full project data (users, roles, files, folders) for a project.
@@ -3309,7 +3326,7 @@ const ge = class ge extends ae {
3309
3326
  async getProjectData(t) {
3310
3327
  return await this.request(
3311
3328
  "GET",
3312
- `${q}/${t}/data`
3329
+ `${B}/${t}/data`
3313
3330
  );
3314
3331
  }
3315
3332
  // ─── Account ──────────────────────────────────────────────────────
@@ -3334,7 +3351,7 @@ const ge = class ge extends ae {
3334
3351
  async checkPermission(t) {
3335
3352
  return await this.request(
3336
3353
  "GET",
3337
- `${q}/permissions/check`,
3354
+ `${B}/permissions/check`,
3338
3355
  { query: t }
3339
3356
  );
3340
3357
  }
@@ -3343,29 +3360,202 @@ const ge = class ge extends ae {
3343
3360
  * single round-trip; results come back in the same order as `checks`.
3344
3361
  */
3345
3362
  async checkPermissionBatch(t) {
3346
- return (await this.request("POST", `${q}/permissions/check/batch`, {
3363
+ return (await this.request("POST", `${B}/permissions/check/batch`, {
3347
3364
  body: JSON.stringify({ checks: t }),
3348
3365
  contentType: "application/json"
3349
3366
  })).results;
3350
3367
  }
3368
+ // ─── Notifications ────────────────────────────────────────────────
3369
+ /**
3370
+ * Lists the signed-in user's notifications, newest first.
3371
+ *
3372
+ * Scoped to whoever the bearer token belongs to — an app cannot read
3373
+ * anyone else's. Muted notifications are included: muting silences the
3374
+ * badge and the delivery channels, it does not hide the record.
3375
+ *
3376
+ * Paginate by passing the previous response's `nextCursor` back in; it is
3377
+ * opaque, so do not build one by hand. A null `nextCursor` means the last
3378
+ * page.
3379
+ *
3380
+ * @example Walk every page:
3381
+ * ```ts
3382
+ * let cursor: string | undefined;
3383
+ * do {
3384
+ * const page = await client.getNotifications({ cursor });
3385
+ * render(page.items);
3386
+ * cursor = page.nextCursor ?? undefined;
3387
+ * } while (cursor);
3388
+ * ```
3389
+ */
3390
+ async getNotifications(t) {
3391
+ return await this.request("GET", N, {
3392
+ query: {
3393
+ ...(t == null ? void 0 : t.cursor) !== void 0 && { cursor: t.cursor },
3394
+ ...(t == null ? void 0 : t.limit) !== void 0 && { limit: String(t.limit) }
3395
+ }
3396
+ });
3397
+ }
3398
+ /**
3399
+ * Number of unread notifications, excluding muted ones. This is the bell
3400
+ * badge count, so it is cheap to poll.
3401
+ */
3402
+ async getUnreadNotificationCount() {
3403
+ return (await this.request(
3404
+ "GET",
3405
+ `${N}/unread-count`
3406
+ )).count;
3407
+ }
3408
+ /**
3409
+ * Marks specific notifications as read. Ids the caller does not own are
3410
+ * ignored rather than rejected, so `updated` can be lower than the number
3411
+ * passed in.
3412
+ */
3413
+ async markNotificationsRead(t) {
3414
+ return await this.request(
3415
+ "POST",
3416
+ `${N}/mark-read`,
3417
+ {
3418
+ body: JSON.stringify({ ids: t }),
3419
+ contentType: "application/json"
3420
+ }
3421
+ );
3422
+ }
3423
+ /** Marks every unread notification as read in one call. */
3424
+ async markAllNotificationsRead() {
3425
+ return await this.request(
3426
+ "POST",
3427
+ `${N}/mark-all-read`
3428
+ );
3429
+ }
3430
+ /**
3431
+ * The automations this user has subscribed to. Nobody is subscribed by
3432
+ * default, so an empty list is the normal state.
3433
+ */
3434
+ async getNotificationSubscriptions() {
3435
+ return await this.request(
3436
+ "GET",
3437
+ `${N}/subscriptions`
3438
+ );
3439
+ }
3440
+ /**
3441
+ * Removes this user's subscription to one automation.
3442
+ *
3443
+ * Unlike subscribing, which happens through the project routes, this works
3444
+ * for any automation the user is subscribed to and keeps working after the
3445
+ * automation itself is gone — opting out must never be the thing that
3446
+ * fails.
3447
+ */
3448
+ async unsubscribeFromAutomation(t) {
3449
+ return await this.request(
3450
+ "DELETE",
3451
+ `${N}/subscriptions/${t}`
3452
+ );
3453
+ }
3454
+ /**
3455
+ * Subscribes the signed-in user to one project automation's runs.
3456
+ *
3457
+ * Nobody is subscribed by default, so this is what makes an automation
3458
+ * produce notifications for this user at all. Subscribing again is
3459
+ * harmless: it updates the existing subscription rather than duplicating.
3460
+ *
3461
+ * Read-level access to the project is enough. Someone who can see an
3462
+ * automation can follow it without being able to change it.
3463
+ *
3464
+ * @example Follow only the failures, and email me about them:
3465
+ * ```ts
3466
+ * await client.subscribeToAutomation(projectId, hookId, {
3467
+ * filter: 'failures',
3468
+ * channels: { email: true },
3469
+ * });
3470
+ * ```
3471
+ */
3472
+ async subscribeToAutomation(t, s, i) {
3473
+ return await this.request(
3474
+ "POST",
3475
+ `${B}/${t}/events/hooks/${s}/subscription`,
3476
+ {
3477
+ body: JSON.stringify(i ?? {}),
3478
+ contentType: "application/json"
3479
+ }
3480
+ );
3481
+ }
3482
+ /**
3483
+ * Changes an existing subscription. Only the fields passed are touched, so
3484
+ * sending `channels` alone leaves the filter as it was.
3485
+ *
3486
+ * Throws if the user is not subscribed; use {@link subscribeToAutomation}
3487
+ * to create one.
3488
+ */
3489
+ async updateAutomationSubscription(t, s, i) {
3490
+ return await this.request(
3491
+ "PATCH",
3492
+ `${B}/${t}/events/hooks/${s}/subscription`,
3493
+ {
3494
+ body: JSON.stringify(i),
3495
+ contentType: "application/json"
3496
+ }
3497
+ );
3498
+ }
3499
+ /**
3500
+ * Listens for this user's notifications in real time.
3501
+ *
3502
+ * Unlike {@link EngineServicesClient.onExecutionProgress}, which follows one
3503
+ * execution and closes when it ends, this stays connected for the session:
3504
+ * the server puts the socket in a room for the signed-in account and pushes
3505
+ * anything addressed to them.
3506
+ *
3507
+ * The events carry ids rather than the notifications themselves, so treat
3508
+ * them as a signal to refresh. That keeps a burst cheap and means the
3509
+ * server is never the source of a stale render.
3510
+ *
3511
+ * Requires a user JWT. An API access token is rejected by the gateway,
3512
+ * because it identifies a token rather than a person.
3513
+ *
3514
+ * @returns a function that disconnects. Call it on unmount.
3515
+ *
3516
+ * @example
3517
+ * ```ts
3518
+ * const stop = await client.onNotification((event) => {
3519
+ * if (event.type === 'created') refreshBell();
3520
+ * });
3521
+ * // later
3522
+ * stop();
3523
+ * ```
3524
+ */
3525
+ async onNotification(t) {
3526
+ const s = await this.resolveAccessToken(), i = q(
3527
+ `${this.socketOrigin}/notifications?accessToken=${encodeURIComponent(s)}`,
3528
+ { transports: ["websocket"] }
3529
+ );
3530
+ return i.on(
3531
+ "notification.created",
3532
+ (r) => t({ type: "created", id: r == null ? void 0 : r.id })
3533
+ ), i.on(
3534
+ "notification.read",
3535
+ (r) => t({ type: "read", id: r == null ? void 0 : r.id })
3536
+ ), i.on(
3537
+ "notifications.allRead",
3538
+ (r) => t({ type: "allRead", batch: r == null ? void 0 : r.batch })
3539
+ ), () => i.disconnect();
3540
+ }
3351
3541
  };
3352
- B = new WeakMap();
3353
- let Ae = ge;
3354
- const Ft = {
3542
+ x = new WeakMap();
3543
+ let Oe = we;
3544
+ const Vt = {
3355
3545
  MAX_FIELDS: 200,
3356
3546
  MAX_KEY_LENGTH: 50,
3357
3547
  MAX_VALUE_LENGTH: 50
3358
- }, Mt = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, Vt = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, Ht = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, Gt = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" }, Jt = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, jt = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, Yt = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
3548
+ }, Ht = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, Gt = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, jt = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, Jt = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" }, Yt = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, Kt = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, Wt = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
3359
3549
  export {
3360
- Mt as CDEManager,
3361
- Vt as ClashesManager,
3362
- ae as EngineServicesClient,
3363
- Ht as FileList,
3364
- Gt as GitHistoryManager,
3365
- Jt as HelloWorld,
3366
- Ft as METADATA_LIMITS,
3367
- Ae as PlatformClient,
3368
- It as RequestError,
3369
- jt as TopicsManager,
3370
- Yt as UIManager
3550
+ Ht as CDEManager,
3551
+ Gt as ClashesManager,
3552
+ ce as EngineServicesClient,
3553
+ jt as FileList,
3554
+ Jt as GitHistoryManager,
3555
+ Yt as HelloWorld,
3556
+ Vt as METADATA_LIMITS,
3557
+ Oe as PlatformClient,
3558
+ Ut as RequestError,
3559
+ Kt as TopicsManager,
3560
+ Wt as UIManager
3371
3561
  };