@thatopen/services 0.9.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,75 +1,75 @@
1
- var Ve = Object.defineProperty;
2
- var _e = (n) => {
1
+ var Ye = Object.defineProperty;
2
+ var Ee = (n) => {
3
3
  throw TypeError(n);
4
4
  };
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
- const v = /* @__PURE__ */ Object.create(null);
9
- v.open = "0";
10
- v.close = "1";
11
- v.ping = "2";
12
- v.pong = "3";
13
- v.message = "4";
14
- v.upgrade = "5";
15
- v.noop = "6";
16
- const F = /* @__PURE__ */ Object.create(null);
17
- Object.keys(v).forEach((n) => {
18
- F[v[n]] = n;
5
+ var Ke = (n, e, t) => e in n ? Ye(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
6
+ var w = (n, e, t) => Ke(n, typeof e != "symbol" ? e + "" : e, t), W = (n, e, t) => e.has(n) || Ee("Cannot " + t);
7
+ var X = (n, e, t) => (W(n, e, "read from private field"), t ? t.call(n) : e.get(n)), z = (n, e, t) => e.has(n) ? Ee("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), ve = (n, e, t, s) => (W(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t), c = (n, e, t) => (W(n, e, "access private method"), t);
8
+ const A = /* @__PURE__ */ Object.create(null);
9
+ A.open = "0";
10
+ A.close = "1";
11
+ A.ping = "2";
12
+ A.pong = "3";
13
+ A.message = "4";
14
+ A.upgrade = "5";
15
+ A.noop = "6";
16
+ const V = /* @__PURE__ */ Object.create(null);
17
+ Object.keys(A).forEach((n) => {
18
+ V[A[n]] = n;
19
19
  });
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) => {
20
+ const re = { type: "error", data: "parser error" }, Ne = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", xe = typeof ArrayBuffer == "function", Pe = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n && n.buffer instanceof ArrayBuffer, de = ({ type: n, data: e }, t, s) => Ne && e instanceof Blob ? t ? s(e) : ke(e, s) : xe && (e instanceof ArrayBuffer || Pe(e)) ? t ? s(e) : ke(new Blob([e]), s) : s(A[n] + (e || "")), ke = (n, e) => {
21
21
  const t = new FileReader();
22
22
  return t.onload = function() {
23
23
  const s = t.result.split(",")[1];
24
24
  e("b" + (s || ""));
25
25
  }, t.readAsDataURL(n);
26
26
  };
27
- function Ee(n) {
27
+ function Ae(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 z;
31
- function Ge(n, e) {
32
- if (Se && n.data instanceof Blob)
33
- return n.data.arrayBuffer().then(Ee).then(e);
34
- if ($e && (n.data instanceof ArrayBuffer || Ce(n.data)))
35
- return e(Ee(n.data));
36
- fe(n, !1, (t) => {
37
- z || (z = new TextEncoder()), e(z.encode(t));
30
+ let Q;
31
+ function We(n, e) {
32
+ if (Ne && n.data instanceof Blob)
33
+ return n.data.arrayBuffer().then(Ae).then(e);
34
+ if (xe && (n.data instanceof ArrayBuffer || Pe(n.data)))
35
+ return e(Ae(n.data));
36
+ de(n, !1, (t) => {
37
+ Q || (Q = new TextEncoder()), e(Q.encode(t));
38
38
  });
39
39
  }
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;
40
+ const Oe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", L = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
41
+ for (let n = 0; n < Oe.length; n++)
42
+ L[Oe.charCodeAt(n)] = n;
43
+ const Xe = (n) => {
44
+ let e = n.length * 0.75, t = n.length, s, r = 0, i, 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
- 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;
48
+ i = L[n.charCodeAt(s)], o = L[n.charCodeAt(s + 1)], h = L[n.charCodeAt(s + 2)], l = L[n.charCodeAt(s + 3)], d[r++] = i << 2 | o >> 4, d[r++] = (o & 15) << 4 | h >> 2, d[r++] = (h & 3) << 6 | l & 63;
49
49
  return y;
50
- }, Je = typeof ArrayBuffer == "function", pe = (n, e) => {
50
+ }, ze = typeof ArrayBuffer == "function", ye = (n, e) => {
51
51
  if (typeof n != "string")
52
52
  return {
53
53
  type: "message",
54
- data: Re(n, e)
54
+ data: Ie(n, e)
55
55
  };
56
56
  const t = n.charAt(0);
57
57
  return t === "b" ? {
58
58
  type: "message",
59
- data: Ye(n.substring(1), e)
60
- } : F[t] ? n.length > 1 ? {
61
- type: F[t],
59
+ data: Qe(n.substring(1), e)
60
+ } : V[t] ? n.length > 1 ? {
61
+ type: V[t],
62
62
  data: n.substring(1)
63
63
  } : {
64
- type: F[t]
65
- } : se;
66
- }, Ye = (n, e) => {
67
- if (Je) {
68
- const t = je(n);
69
- return Re(t, e);
64
+ type: V[t]
65
+ } : re;
66
+ }, Qe = (n, e) => {
67
+ if (ze) {
68
+ const t = Xe(n);
69
+ return Ie(t, e);
70
70
  } else
71
71
  return { base64: !0, data: n };
72
- }, Re = (n, e) => {
72
+ }, Ie = (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 je = (n) => {
77
77
  default:
78
78
  return n instanceof ArrayBuffer ? n : n.buffer;
79
79
  }
80
- }, Be = "", Ke = (n, e) => {
80
+ }, Le = "", Ze = (n, e) => {
81
81
  const t = n.length, s = new Array(t);
82
- let i = 0;
83
- n.forEach((r, o) => {
84
- fe(r, !1, (h) => {
85
- s[o] = h, ++i === t && e(s.join(Be));
82
+ let r = 0;
83
+ n.forEach((i, o) => {
84
+ de(i, !1, (h) => {
85
+ s[o] = h, ++r === t && e(s.join(Le));
86
86
  });
87
87
  });
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")
88
+ }, et = (n, e) => {
89
+ const t = n.split(Le), s = [];
90
+ for (let r = 0; r < t.length; r++) {
91
+ const i = ye(t[r], e);
92
+ if (s.push(i), i.type === "error")
93
93
  break;
94
94
  }
95
95
  return s;
96
96
  };
97
- function ze() {
97
+ function tt() {
98
98
  return new TransformStream({
99
99
  transform(n, e) {
100
- Ge(n, (t) => {
100
+ We(n, (t) => {
101
101
  const s = t.length;
102
- let i;
102
+ let r;
103
103
  if (s < 126)
104
- i = new Uint8Array(1), new DataView(i.buffer).setUint8(0, s);
104
+ r = new Uint8Array(1), new DataView(r.buffer).setUint8(0, s);
105
105
  else if (s < 65536) {
106
- i = new Uint8Array(3);
107
- const r = new DataView(i.buffer);
108
- r.setUint8(0, 126), r.setUint16(1, s);
106
+ r = new Uint8Array(3);
107
+ const i = new DataView(r.buffer);
108
+ i.setUint8(0, 126), i.setUint16(1, s);
109
109
  } else {
110
- i = new Uint8Array(9);
111
- const r = new DataView(i.buffer);
112
- r.setUint8(0, 127), r.setBigUint64(1, BigInt(s));
110
+ r = new Uint8Array(9);
111
+ const i = new DataView(r.buffer);
112
+ i.setUint8(0, 127), i.setBigUint64(1, BigInt(s));
113
113
  }
114
- n.data && typeof n.data != "string" && (i[0] |= 128), e.enqueue(i), e.enqueue(t);
114
+ n.data && typeof n.data != "string" && (r[0] |= 128), e.enqueue(r), e.enqueue(t);
115
115
  });
116
116
  }
117
117
  });
118
118
  }
119
- let X;
120
- function U(n) {
119
+ let Z;
120
+ function F(n) {
121
121
  return n.reduce((e, t) => e + t.length, 0);
122
122
  }
123
- function D(n, e) {
123
+ function M(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 i = 0; i < e; i++)
129
- t[i] = n[0][s++], s === n[0].length && (n.shift(), s = 0);
128
+ for (let r = 0; r < e; r++)
129
+ t[r] = n[0][s++], s === n[0].length && (n.shift(), s = 0);
130
130
  return n.length && s < n[0].length && (n[0] = n[0].slice(s)), t;
131
131
  }
132
- function Xe(n, e) {
133
- X || (X = new TextDecoder());
132
+ function st(n, e) {
133
+ Z || (Z = new TextDecoder());
134
134
  const t = [];
135
- let s = 0, i = -1, r = !1;
135
+ let s = 0, r = -1, i = !1;
136
136
  return new TransformStream({
137
137
  transform(o, h) {
138
138
  for (t.push(o); ; ) {
139
139
  if (s === 0) {
140
- if (U(t) < 1)
140
+ if (F(t) < 1)
141
141
  break;
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;
142
+ const l = M(t, 1);
143
+ i = (l[0] & 128) === 128, r = l[0] & 127, r < 126 ? s = 3 : r === 126 ? s = 1 : s = 2;
144
144
  } else if (s === 1) {
145
- if (U(t) < 2)
145
+ if (F(t) < 2)
146
146
  break;
147
- const l = D(t, 2);
148
- i = new DataView(l.buffer, l.byteOffset, l.length).getUint16(0), s = 3;
147
+ const l = M(t, 2);
148
+ r = new DataView(l.buffer, l.byteOffset, l.length).getUint16(0), s = 3;
149
149
  } else if (s === 2) {
150
- if (U(t) < 8)
150
+ if (F(t) < 8)
151
151
  break;
152
- const l = D(t, 8), y = new DataView(l.buffer, l.byteOffset, l.length), d = y.getUint32(0);
152
+ const l = M(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(se);
154
+ h.enqueue(re);
155
155
  break;
156
156
  }
157
- i = d * Math.pow(2, 32) + y.getUint32(4), s = 3;
157
+ r = d * Math.pow(2, 32) + y.getUint32(4), s = 3;
158
158
  } else {
159
- if (U(t) < i)
159
+ if (F(t) < r)
160
160
  break;
161
- const l = D(t, i);
162
- h.enqueue(pe(r ? l : X.decode(l), e)), s = 0;
161
+ const l = M(t, r);
162
+ h.enqueue(ye(i ? l : Z.decode(l), e)), s = 0;
163
163
  }
164
- if (i === 0 || i > n) {
165
- h.enqueue(se);
164
+ if (r === 0 || r > n) {
165
+ h.enqueue(re);
166
166
  break;
167
167
  }
168
168
  }
169
169
  }
170
170
  });
171
171
  }
172
- const Ne = 4;
172
+ const qe = 4;
173
173
  function g(n) {
174
- if (n) return Qe(n);
174
+ if (n) return nt(n);
175
175
  }
176
- function Qe(n) {
176
+ function nt(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, i = 0; i < t.length; i++)
198
- if (s = t[i], s === e || s.fn === e) {
199
- t.splice(i, 1);
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);
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, i = t.length; s < i; ++s)
210
+ for (var s = 0, r = t.length; s < r; ++s)
211
211
  t[s].apply(this, e);
212
212
  }
213
213
  return this;
@@ -219,47 +219,47 @@ g.prototype.listeners = function(n) {
219
219
  g.prototype.hasListeners = function(n) {
220
220
  return !!this.listeners(n).length;
221
221
  };
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
- function xe(n, ...e) {
222
+ const Y = 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")(), rt = "arraybuffer";
223
+ function Ue(n, ...e) {
224
224
  return e.reduce((t, s) => (n.hasOwnProperty(s) && (t[s] = n[s]), t), {});
225
225
  }
226
- const et = _.setTimeout, tt = _.clearTimeout;
227
- function J(n, e) {
228
- e.useNativeTimers ? (n.setTimeoutFn = et.bind(_), n.clearTimeoutFn = tt.bind(_)) : (n.setTimeoutFn = _.setTimeout.bind(_), n.clearTimeoutFn = _.clearTimeout.bind(_));
226
+ const it = _.setTimeout, ot = _.clearTimeout;
227
+ function K(n, e) {
228
+ e.useNativeTimers ? (n.setTimeoutFn = it.bind(_), n.clearTimeoutFn = ot.bind(_)) : (n.setTimeoutFn = _.setTimeout.bind(_), n.clearTimeoutFn = _.clearTimeout.bind(_));
229
229
  }
230
- const st = 1.33;
231
- function nt(n) {
232
- return typeof n == "string" ? it(n) : Math.ceil((n.byteLength || n.size) * st);
230
+ const at = 1.33;
231
+ function ct(n) {
232
+ return typeof n == "string" ? ht(n) : Math.ceil((n.byteLength || n.size) * at);
233
233
  }
234
- function it(n) {
234
+ function ht(n) {
235
235
  let e = 0, t = 0;
236
- for (let s = 0, i = n.length; s < i; s++)
236
+ for (let s = 0, r = n.length; s < r; s++)
237
237
  e = n.charCodeAt(s), e < 128 ? t += 1 : e < 2048 ? t += 2 : e < 55296 || e >= 57344 ? t += 3 : (s++, t += 4);
238
238
  return t;
239
239
  }
240
- function Pe() {
240
+ function De() {
241
241
  return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
242
242
  }
243
- function rt(n) {
243
+ function ut(n) {
244
244
  let e = "";
245
245
  for (let t in n)
246
246
  n.hasOwnProperty(t) && (e.length && (e += "&"), e += encodeURIComponent(t) + "=" + encodeURIComponent(n[t]));
247
247
  return e;
248
248
  }
249
- function ot(n) {
249
+ function lt(n) {
250
250
  let e = {}, t = n.split("&");
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]);
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]);
254
254
  }
255
255
  return e;
256
256
  }
257
- class at extends Error {
257
+ class ft 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 de extends g {
262
+ class me extends g {
263
263
  /**
264
264
  * Transport abstract constructor.
265
265
  *
@@ -267,7 +267,7 @@ class de extends g {
267
267
  * @protected
268
268
  */
269
269
  constructor(e) {
270
- super(), this.writable = !1, J(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
270
+ super(), this.writable = !1, K(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
271
271
  }
272
272
  /**
273
273
  * Emits an error.
@@ -279,7 +279,7 @@ class de extends g {
279
279
  * @protected
280
280
  */
281
281
  onError(e, t, s) {
282
- return super.emitReserved("error", new at(e, t, s)), this;
282
+ return super.emitReserved("error", new ft(e, t, s)), this;
283
283
  }
284
284
  /**
285
285
  * Opens the transport.
@@ -316,7 +316,7 @@ class de extends g {
316
316
  * @protected
317
317
  */
318
318
  onData(e) {
319
- const t = pe(e, this.socket.binaryType);
319
+ const t = ye(e, this.socket.binaryType);
320
320
  this.onPacket(t);
321
321
  }
322
322
  /**
@@ -353,11 +353,11 @@ class de extends g {
353
353
  return this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
354
354
  }
355
355
  _query(e) {
356
- const t = rt(e);
356
+ const t = ut(e);
357
357
  return t.length ? "?" + t : "";
358
358
  }
359
359
  }
360
- class ct extends de {
360
+ class pt extends me {
361
361
  constructor() {
362
362
  super(...arguments), this._polling = !1;
363
363
  }
@@ -413,7 +413,7 @@ class ct extends de {
413
413
  return this.onClose({ description: "transport closed by the server" }), !1;
414
414
  this.onPacket(s);
415
415
  };
416
- We(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
416
+ et(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 ct extends de {
433
433
  * @protected
434
434
  */
435
435
  write(e) {
436
- this.writable = !1, Ke(e, (t) => {
436
+ this.writable = !1, Ze(e, (t) => {
437
437
  this.doWrite(t, () => {
438
438
  this.writable = !0, this.emitReserved("drain");
439
439
  });
@@ -446,18 +446,18 @@ class ct extends de {
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] = Pe()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
449
+ return this.opts.timestampRequests !== !1 && (t[this.opts.timestampParam] = De()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
450
450
  }
451
451
  }
452
- let Ie = !1;
452
+ let Fe = !1;
453
453
  try {
454
- Ie = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
454
+ Fe = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
455
455
  } catch {
456
456
  }
457
- const ht = Ie;
458
- function ut() {
457
+ const dt = Fe;
458
+ function yt() {
459
459
  }
460
- class lt extends ct {
460
+ class mt extends pt {
461
461
  /**
462
462
  * XHR Polling constructor.
463
463
  *
@@ -483,8 +483,8 @@ class lt extends ct {
483
483
  method: "POST",
484
484
  data: e
485
485
  });
486
- s.on("success", t), s.on("error", (i, r) => {
487
- this.onError("xhr post error", i, r);
486
+ s.on("success", t), s.on("error", (r, i) => {
487
+ this.onError("xhr post error", r, i);
488
488
  });
489
489
  }
490
490
  /**
@@ -499,7 +499,7 @@ class lt extends ct {
499
499
  }), this.pollXhr = e;
500
500
  }
501
501
  }
502
- class E extends g {
502
+ class k extends g {
503
503
  /**
504
504
  * Request constructor
505
505
  *
@@ -507,7 +507,7 @@ class E extends g {
507
507
  * @package
508
508
  */
509
509
  constructor(e, t, s) {
510
- super(), this.createRequest = e, J(this, s), this._opts = s, this._method = s.method || "GET", this._uri = t, this._data = s.data !== void 0 ? s.data : null, this._create();
510
+ super(), this.createRequest = e, K(this, s), this._opts = s, this._method = s.method || "GET", this._uri = t, this._data = s.data !== void 0 ? s.data : null, this._create();
511
511
  }
512
512
  /**
513
513
  * Creates the XHR object and sends the request.
@@ -516,7 +516,7 @@ class E extends g {
516
516
  */
517
517
  _create() {
518
518
  var e;
519
- const t = xe(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
519
+ const t = Ue(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
520
520
  t.xdomain = !!this._opts.xd;
521
521
  const s = this._xhr = this.createRequest(t);
522
522
  try {
@@ -524,8 +524,8 @@ class E extends g {
524
524
  try {
525
525
  if (this._opts.extraHeaders) {
526
526
  s.setDisableHeaderCheck && s.setDisableHeaderCheck(!0);
527
- for (let i in this._opts.extraHeaders)
528
- this._opts.extraHeaders.hasOwnProperty(i) && s.setRequestHeader(i, this._opts.extraHeaders[i]);
527
+ for (let r in this._opts.extraHeaders)
528
+ this._opts.extraHeaders.hasOwnProperty(r) && s.setRequestHeader(r, this._opts.extraHeaders[r]);
529
529
  }
530
530
  } catch {
531
531
  }
@@ -539,21 +539,21 @@ class E 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 i;
543
- s.readyState === 3 && ((i = this._opts.cookieJar) === null || i === void 0 || i.parseCookies(
542
+ var r;
543
+ s.readyState === 3 && ((r = this._opts.cookieJar) === null || r === void 0 || r.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 (i) {
550
+ } catch (r) {
551
551
  this.setTimeoutFn(() => {
552
- this._onError(i);
552
+ this._onError(r);
553
553
  }, 0);
554
554
  return;
555
555
  }
556
- typeof document < "u" && (this._index = E.requestsCount++, E.requests[this._index] = this);
556
+ typeof document < "u" && (this._index = k.requestsCount++, k.requests[this._index] = this);
557
557
  }
558
558
  /**
559
559
  * Called upon error.
@@ -570,12 +570,12 @@ class E extends g {
570
570
  */
571
571
  _cleanup(e) {
572
572
  if (!(typeof this._xhr > "u" || this._xhr === null)) {
573
- if (this._xhr.onreadystatechange = ut, e)
573
+ if (this._xhr.onreadystatechange = yt, e)
574
574
  try {
575
575
  this._xhr.abort();
576
576
  } catch {
577
577
  }
578
- typeof document < "u" && delete E.requests[this._index], this._xhr = null;
578
+ typeof document < "u" && delete k.requests[this._index], this._xhr = null;
579
579
  }
580
580
  }
581
581
  /**
@@ -596,40 +596,40 @@ class E extends g {
596
596
  this._cleanup();
597
597
  }
598
598
  }
599
- E.requestsCount = 0;
600
- E.requests = {};
599
+ k.requestsCount = 0;
600
+ k.requests = {};
601
601
  if (typeof document < "u") {
602
602
  if (typeof attachEvent == "function")
603
- attachEvent("onunload", ke);
603
+ attachEvent("onunload", Se);
604
604
  else if (typeof addEventListener == "function") {
605
605
  const n = "onpagehide" in _ ? "pagehide" : "unload";
606
- addEventListener(n, ke, !1);
606
+ addEventListener(n, Se, !1);
607
607
  }
608
608
  }
609
- function ke() {
610
- for (let n in E.requests)
611
- E.requests.hasOwnProperty(n) && E.requests[n].abort();
609
+ function Se() {
610
+ for (let n in k.requests)
611
+ k.requests.hasOwnProperty(n) && k.requests[n].abort();
612
612
  }
613
- const ft = function() {
614
- const n = Le({
613
+ const gt = function() {
614
+ const n = Me({
615
615
  xdomain: !1
616
616
  });
617
617
  return n && n.responseType !== null;
618
618
  }();
619
- class pt extends lt {
619
+ class wt extends mt {
620
620
  constructor(e) {
621
621
  super(e);
622
622
  const t = e && e.forceBase64;
623
- this.supportsBinary = ft && !t;
623
+ this.supportsBinary = gt && !t;
624
624
  }
625
625
  request(e = {}) {
626
- return Object.assign(e, { xd: this.xd }, this.opts), new E(Le, this.uri(), e);
626
+ return Object.assign(e, { xd: this.xd }, this.opts), new k(Me, this.uri(), e);
627
627
  }
628
628
  }
629
- function Le(n) {
629
+ function Me(n) {
630
630
  const e = n.xdomain;
631
631
  try {
632
- if (typeof XMLHttpRequest < "u" && (!e || ht))
632
+ if (typeof XMLHttpRequest < "u" && (!e || dt))
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 qe = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
643
- class dt extends de {
642
+ const Ve = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
643
+ class _t extends me {
644
644
  get name() {
645
645
  return "websocket";
646
646
  }
647
647
  doOpen() {
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");
648
+ const e = this.uri(), t = this.opts.protocols, s = Ve ? {} : Ue(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 (i) {
653
- return this.emitReserved("error", i);
652
+ } catch (r) {
653
+ return this.emitReserved("error", r);
654
654
  }
655
655
  this.ws.binaryType = this.socket.binaryType, this.addEventListeners();
656
656
  }
@@ -670,13 +670,13 @@ class dt extends de {
670
670
  write(e) {
671
671
  this.writable = !1;
672
672
  for (let t = 0; t < e.length; t++) {
673
- const s = e[t], i = t === e.length - 1;
674
- fe(s, this.supportsBinary, (r) => {
673
+ const s = e[t], r = t === e.length - 1;
674
+ de(s, this.supportsBinary, (i) => {
675
675
  try {
676
- this.doWrite(s, r);
676
+ this.doWrite(s, i);
677
677
  } catch {
678
678
  }
679
- i && j(() => {
679
+ r && Y(() => {
680
680
  this.writable = !0, this.emitReserved("drain");
681
681
  }, this.setTimeoutFn);
682
682
  });
@@ -693,19 +693,19 @@ class dt extends de {
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] = Pe()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
696
+ return this.opts.timestampRequests && (t[this.opts.timestampParam] = De()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
697
697
  }
698
698
  }
699
- const Q = _.WebSocket || _.MozWebSocket;
700
- class yt extends dt {
699
+ const ee = _.WebSocket || _.MozWebSocket;
700
+ class bt extends _t {
701
701
  createSocket(e, t, s) {
702
- return qe ? new Q(e, t, s) : t ? new Q(e, t) : new Q(e);
702
+ return Ve ? new ee(e, t, s) : t ? new ee(e, t) : new ee(e);
703
703
  }
704
704
  doWrite(e, t) {
705
705
  this.ws.send(t);
706
706
  }
707
707
  }
708
- class mt extends de {
708
+ class Tt extends me {
709
709
  get name() {
710
710
  return "webtransport";
711
711
  }
@@ -721,15 +721,15 @@ class mt extends de {
721
721
  this.onError("webtransport error", e);
722
722
  }), this._transport.ready.then(() => {
723
723
  this._transport.createBidirectionalStream().then((e) => {
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 = () => {
724
+ const t = st(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), r = tt();
725
+ r.readable.pipeTo(e.writable), this._writer = r.writable.getWriter();
726
+ const i = () => {
727
727
  s.read().then(({ done: h, value: l }) => {
728
- h || (this.onPacket(l), r());
728
+ h || (this.onPacket(l), i());
729
729
  }).catch((h) => {
730
730
  });
731
731
  };
732
- r();
732
+ i();
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 mt extends de {
738
738
  write(e) {
739
739
  this.writable = !1;
740
740
  for (let t = 0; t < e.length; t++) {
741
- const s = e[t], i = t === e.length - 1;
741
+ const s = e[t], r = t === e.length - 1;
742
742
  this._writer.write(s).then(() => {
743
- i && j(() => {
743
+ r && Y(() => {
744
744
  this.writable = !0, this.emitReserved("drain");
745
745
  }, this.setTimeoutFn);
746
746
  });
@@ -751,11 +751,11 @@ class mt extends de {
751
751
  (e = this._transport) === null || e === void 0 || e.close();
752
752
  }
753
753
  }
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 = [
754
+ const Et = {
755
+ websocket: bt,
756
+ webtransport: Tt,
757
+ polling: wt
758
+ }, vt = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, kt = [
759
759
  "source",
760
760
  "protocol",
761
761
  "authority",
@@ -771,29 +771,29 @@ const gt = {
771
771
  "query",
772
772
  "anchor"
773
773
  ];
774
- function ne(n) {
774
+ function ie(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 i = wt.exec(n || ""), r = {}, o = 14;
779
+ let r = vt.exec(n || ""), i = {}, o = 14;
780
780
  for (; o--; )
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;
781
+ i[kt[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 = At(i, i.path), i.queryKey = Ot(i, i.query), i;
783
783
  }
784
- function bt(n, e) {
784
+ function At(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 Tt(n, e) {
788
+ function Ot(n, e) {
789
789
  const t = {};
790
- return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(s, i, r) {
791
- i && (t[i] = r);
790
+ return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(s, r, i) {
791
+ r && (t[r] = i);
792
792
  }), t;
793
793
  }
794
- const ie = typeof addEventListener == "function" && typeof removeEventListener == "function", M = [];
795
- ie && addEventListener("offline", () => {
796
- M.forEach((n) => n());
794
+ const oe = typeof addEventListener == "function" && typeof removeEventListener == "function", H = [];
795
+ oe && addEventListener("offline", () => {
796
+ H.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 = 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);
806
+ if (super(), this.binaryType = rt, 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 = ie(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 = ne(t.host).host);
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 i = s.prototype.name;
812
- this.transports.push(i), this._transportsByName[i] = s;
809
+ } else t.host && (t.hostname = ie(t.host).host);
810
+ K(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;
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 = ot(this.opts.query)), ie && (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 = lt(this.opts.query)), oe && (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
- }, M.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open();
833
+ }, H.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 = Ne, t.transport = e, this.id && (t.sid = this.id);
844
+ t.EIO = qe, 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 i = this.writeBuffer[s].data;
962
- if (i && (t += nt(i)), s > 0 && t > this._maxPayload)
961
+ const r = this.writeBuffer[s].data;
962
+ if (r && (t += ct(r)), s > 0 && t > this._maxPayload)
963
963
  return this.writeBuffer.slice(0, s);
964
964
  t += 2;
965
965
  }
@@ -979,7 +979,7 @@ class 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, j(() => {
982
+ return e && (this._pingTimeoutTime = 0, Y(() => {
983
983
  this._onClose("ping timeout");
984
984
  }, this.setTimeoutFn)), e;
985
985
  }
@@ -1014,16 +1014,16 @@ class R extends g {
1014
1014
  * @param {Function} fn - callback function.
1015
1015
  * @private
1016
1016
  */
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")
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")
1019
1019
  return;
1020
1020
  s = s || {}, s.compress = s.compress !== !1;
1021
- const r = {
1021
+ const i = {
1022
1022
  type: e,
1023
1023
  data: t,
1024
1024
  options: s
1025
1025
  };
1026
- this.emitReserved("packetCreate", r), this.writeBuffer.push(r), i && this.once("flush", i), this.flush();
1026
+ this.emitReserved("packetCreate", i), this.writeBuffer.push(i), r && this.once("flush", r), this.flush();
1027
1027
  }
1028
1028
  /**
1029
1029
  * Closes the connection.
@@ -1057,16 +1057,16 @@ 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(), ie && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
1061
- const s = M.indexOf(this._offlineEventListener);
1062
- s !== -1 && M.splice(s, 1);
1060
+ if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), oe && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
1061
+ const s = H.indexOf(this._offlineEventListener);
1062
+ s !== -1 && H.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 = Ne;
1069
- class Et extends R {
1068
+ R.protocol = qe;
1069
+ class St extends R {
1070
1070
  constructor() {
1071
1071
  super(...arguments), this._upgrades = [];
1072
1072
  }
@@ -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 i = () => {
1087
+ const r = () => {
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") {
@@ -1094,17 +1094,17 @@ class Et extends R {
1094
1094
  s || this.readyState !== "closed" && (d(), this.setTransport(t), t.send([{ type: "upgrade" }]), this.emitReserved("upgrade", t), t = null, this.upgrading = !1, this.flush());
1095
1095
  });
1096
1096
  } else {
1097
- const k = new Error("probe error");
1098
- k.transport = t.name, this.emitReserved("upgradeError", k);
1097
+ const E = new Error("probe error");
1098
+ E.transport = t.name, this.emitReserved("upgradeError", E);
1099
1099
  }
1100
1100
  }));
1101
1101
  };
1102
- function r() {
1102
+ function i() {
1103
1103
  s || (s = !0, d(), t.close(), t = null);
1104
1104
  }
1105
1105
  const o = (m) => {
1106
- const k = new Error("probe error: " + m);
1107
- k.transport = t.name, r(), this.emitReserved("upgradeError", k);
1106
+ const E = new Error("probe error: " + m);
1107
+ E.transport = t.name, i(), this.emitReserved("upgradeError", E);
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 && r();
1116
+ t && m.name !== t.name && i();
1117
1117
  }
1118
1118
  const d = () => {
1119
- t.removeListener("open", i), t.removeListener("error", o), t.removeListener("close", h), this.off("close", l), this.off("upgrading", y);
1119
+ t.removeListener("open", r), t.removeListener("error", o), t.removeListener("close", h), this.off("close", l), this.off("upgrading", y);
1120
1120
  };
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(() => {
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(() => {
1122
1122
  s || t.open();
1123
1123
  }, 200) : t.open();
1124
1124
  }
@@ -1138,67 +1138,67 @@ class Et extends R {
1138
1138
  return t;
1139
1139
  }
1140
1140
  }
1141
- let vt = class extends Et {
1141
+ let $t = class extends St {
1142
1142
  constructor(e, t = {}) {
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);
1143
+ const s = typeof e == "object", r = s ? { ...e } : { ...t };
1144
+ (!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || ["polling", "websocket", "webtransport"]).map((i) => Et[i]).filter((i) => !!i)), super(s ? r : e, r);
1145
1145
  }
1146
1146
  };
1147
- function kt(n, e = "", t) {
1147
+ function Rt(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 = 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;
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 = ie(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;
1152
1152
  }
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;
1153
+ const Ct = typeof ArrayBuffer == "function", Bt = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n.buffer instanceof ArrayBuffer, He = Object.prototype.toString, Nt = typeof Blob == "function" || typeof Blob < "u" && He.call(Blob) === "[object BlobConstructor]", xt = typeof File == "function" || typeof File < "u" && He.call(File) === "[object FileConstructor]";
1154
+ function ge(n) {
1155
+ return Ct && (n instanceof ArrayBuffer || Bt(n)) || Nt && n instanceof Blob || xt && n instanceof File;
1156
1156
  }
1157
- function V(n, e) {
1157
+ function j(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 (V(n[t]))
1162
+ if (j(n[t]))
1163
1163
  return !0;
1164
1164
  return !1;
1165
1165
  }
1166
- if (ye(n))
1166
+ if (ge(n))
1167
1167
  return !0;
1168
1168
  if (n.toJSON && typeof n.toJSON == "function" && arguments.length === 1)
1169
- return V(n.toJSON(), !0);
1169
+ return j(n.toJSON(), !0);
1170
1170
  for (const t in n)
1171
- if (Object.prototype.hasOwnProperty.call(n, t) && V(n[t]))
1171
+ if (Object.prototype.hasOwnProperty.call(n, t) && j(n[t]))
1172
1172
  return !0;
1173
1173
  return !1;
1174
1174
  }
1175
- function Ct(n) {
1175
+ function Pt(n) {
1176
1176
  const e = [], t = n.data, s = n;
1177
- return s.data = re(t, e), s.attachments = e.length, { packet: s, buffers: e };
1177
+ return s.data = ae(t, e), s.attachments = e.length, { packet: s, buffers: e };
1178
1178
  }
1179
- function re(n, e) {
1179
+ function ae(n, e) {
1180
1180
  if (!n)
1181
1181
  return n;
1182
- if (ye(n)) {
1182
+ if (ge(n)) {
1183
1183
  const t = { _placeholder: !0, num: e.length };
1184
1184
  return e.push(n), t;
1185
1185
  } else if (Array.isArray(n)) {
1186
1186
  const t = new Array(n.length);
1187
1187
  for (let s = 0; s < n.length; s++)
1188
- t[s] = re(n[s], e);
1188
+ t[s] = ae(n[s], e);
1189
1189
  return t;
1190
1190
  } else if (typeof n == "object" && !(n instanceof Date)) {
1191
1191
  const t = {};
1192
1192
  for (const s in n)
1193
- Object.prototype.hasOwnProperty.call(n, s) && (t[s] = re(n[s], e));
1193
+ Object.prototype.hasOwnProperty.call(n, s) && (t[s] = ae(n[s], e));
1194
1194
  return t;
1195
1195
  }
1196
1196
  return n;
1197
1197
  }
1198
- function Rt(n, e) {
1199
- return n.data = oe(n.data, e), delete n.attachments, n;
1198
+ function It(n, e) {
1199
+ return n.data = ce(n.data, e), delete n.attachments, n;
1200
1200
  }
1201
- function oe(n, e) {
1201
+ function ce(n, e) {
1202
1202
  if (!n)
1203
1203
  return n;
1204
1204
  if (n && n._placeholder === !0) {
@@ -1207,13 +1207,13 @@ function oe(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] = oe(n[t], e);
1210
+ n[t] = ce(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] = oe(n[t], e));
1213
+ Object.prototype.hasOwnProperty.call(n, t) && (n[t] = ce(n[t], e));
1214
1214
  return n;
1215
1215
  }
1216
- const Bt = [
1216
+ const Lt = [
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 Nt {
1234
+ class qt {
1235
1235
  /**
1236
1236
  * Encoder constructor
1237
1237
  *
@@ -1247,7 +1247,7 @@ class Nt {
1247
1247
  * @param {Object} obj - packet object
1248
1248
  */
1249
1249
  encode(e) {
1250
- return (e.type === p.EVENT || e.type === p.ACK) && V(e) ? this.encodeAsBinary({
1250
+ return (e.type === p.EVENT || e.type === p.ACK) && j(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,11 +1267,11 @@ class Nt {
1267
1267
  * a list of buffers.
1268
1268
  */
1269
1269
  encodeAsBinary(e) {
1270
- const t = Ct(e), s = this.encodeAsString(t.packet), i = t.buffers;
1271
- return i.unshift(s), i;
1270
+ const t = Pt(e), s = this.encodeAsString(t.packet), r = t.buffers;
1271
+ return r.unshift(s), r;
1272
1272
  }
1273
1273
  }
1274
- class me extends g {
1274
+ class we extends g {
1275
1275
  /**
1276
1276
  * Decoder constructor
1277
1277
  */
@@ -1293,8 +1293,8 @@ class me extends g {
1293
1293
  throw new Error("got plaintext data when reconstructing a packet");
1294
1294
  t = this.decodeString(e);
1295
1295
  const s = t.type === p.BINARY_EVENT;
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);
1297
- } else if (ye(e) || e.base64)
1296
+ s || t.type === p.BINARY_ACK ? (t.type = s ? p.EVENT : p.ACK, this.reconstructor = new Ut(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t);
1297
+ } else if (ge(e) || e.base64)
1298
1298
  if (this.reconstructor)
1299
1299
  t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t));
1300
1300
  else
@@ -1316,29 +1316,29 @@ class me extends g {
1316
1316
  if (p[s.type] === void 0)
1317
1317
  throw new Error("unknown packet type " + s.type);
1318
1318
  if (s.type === p.BINARY_EVENT || s.type === p.BINARY_ACK) {
1319
- const r = t + 1;
1319
+ const i = t + 1;
1320
1320
  for (; e.charAt(++t) !== "-" && t != e.length; )
1321
1321
  ;
1322
- const o = e.substring(r, t);
1322
+ const o = e.substring(i, t);
1323
1323
  if (o != Number(o) || e.charAt(t) !== "-")
1324
1324
  throw new Error("Illegal attachments");
1325
1325
  const h = Number(o);
1326
- if (!Pt(h) || h < 0)
1326
+ if (!Dt(h) || h < 0)
1327
1327
  throw new Error("Illegal attachments");
1328
1328
  if (h > this.opts.maxAttachments)
1329
1329
  throw new Error("too many attachments");
1330
1330
  s.attachments = h;
1331
1331
  }
1332
1332
  if (e.charAt(t + 1) === "/") {
1333
- const r = t + 1;
1333
+ const i = t + 1;
1334
1334
  for (; ++t && !(e.charAt(t) === "," || t === e.length); )
1335
1335
  ;
1336
- s.nsp = e.substring(r, t);
1336
+ s.nsp = e.substring(i, t);
1337
1337
  } else
1338
1338
  s.nsp = "/";
1339
- const i = e.charAt(t + 1);
1340
- if (i !== "" && Number(i) == i) {
1341
- const r = t + 1;
1339
+ const r = e.charAt(t + 1);
1340
+ if (r !== "" && Number(r) == r) {
1341
+ const i = t + 1;
1342
1342
  for (; ++t; ) {
1343
1343
  const o = e.charAt(t);
1344
1344
  if (o == null || Number(o) != o) {
@@ -1348,12 +1348,12 @@ class me extends g {
1348
1348
  if (t === e.length)
1349
1349
  break;
1350
1350
  }
1351
- s.id = Number(e.substring(r, t + 1));
1351
+ s.id = Number(e.substring(i, t + 1));
1352
1352
  }
1353
1353
  if (e.charAt(++t)) {
1354
- const r = this.tryParse(e.substr(t));
1355
- if (me.isPayloadValid(s.type, r))
1356
- s.data = r;
1354
+ const i = this.tryParse(e.substr(t));
1355
+ if (we.isPayloadValid(s.type, i))
1356
+ s.data = i;
1357
1357
  else
1358
1358
  throw new Error("invalid payload");
1359
1359
  }
@@ -1369,14 +1369,14 @@ class me extends g {
1369
1369
  static isPayloadValid(e, t) {
1370
1370
  switch (e) {
1371
1371
  case p.CONNECT:
1372
- return Ae(t);
1372
+ return $e(t);
1373
1373
  case p.DISCONNECT:
1374
1374
  return t === void 0;
1375
1375
  case p.CONNECT_ERROR:
1376
- return typeof t == "string" || Ae(t);
1376
+ return typeof t == "string" || $e(t);
1377
1377
  case p.EVENT:
1378
1378
  case p.BINARY_EVENT:
1379
- return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && Bt.indexOf(t[0]) === -1);
1379
+ return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && Lt.indexOf(t[0]) === -1);
1380
1380
  case p.ACK:
1381
1381
  case p.BINARY_ACK:
1382
1382
  return Array.isArray(t);
@@ -1389,7 +1389,7 @@ class me extends g {
1389
1389
  this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
1390
1390
  }
1391
1391
  }
1392
- class xt {
1392
+ class Ut {
1393
1393
  constructor(e) {
1394
1394
  this.packet = e, this.buffers = [], this.reconPack = e;
1395
1395
  }
@@ -1403,7 +1403,7 @@ class xt {
1403
1403
  */
1404
1404
  takeBinaryData(e) {
1405
1405
  if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
1406
- const t = Rt(this.reconPack, this.buffers);
1406
+ const t = It(this.reconPack, this.buffers);
1407
1407
  return this.finishedReconstruction(), t;
1408
1408
  }
1409
1409
  return null;
@@ -1415,26 +1415,26 @@ class xt {
1415
1415
  this.reconPack = null, this.buffers = [];
1416
1416
  }
1417
1417
  }
1418
- const Pt = Number.isInteger || function(n) {
1418
+ const Dt = Number.isInteger || function(n) {
1419
1419
  return typeof n == "number" && isFinite(n) && Math.floor(n) === n;
1420
1420
  };
1421
- function Ae(n) {
1421
+ function $e(n) {
1422
1422
  return Object.prototype.toString.call(n) === "[object Object]";
1423
1423
  }
1424
- const It = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1424
+ const Ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1425
1425
  __proto__: null,
1426
- Decoder: me,
1427
- Encoder: Nt,
1426
+ Decoder: we,
1427
+ Encoder: qt,
1428
1428
  get PacketType() {
1429
1429
  return p;
1430
1430
  }
1431
1431
  }, Symbol.toStringTag, { value: "Module" }));
1432
- function b(n, e, t) {
1432
+ function T(n, e, t) {
1433
1433
  return n.on(e, t), function() {
1434
1434
  n.off(e, t);
1435
1435
  };
1436
1436
  }
1437
- const Lt = Object.freeze({
1437
+ const Mt = Object.freeze({
1438
1438
  connect: 1,
1439
1439
  connect_error: 1,
1440
1440
  disconnect: 1,
@@ -1443,7 +1443,7 @@ const Lt = Object.freeze({
1443
1443
  newListener: 1,
1444
1444
  removeListener: 1
1445
1445
  });
1446
- class De extends g {
1446
+ class je extends g {
1447
1447
  /**
1448
1448
  * `Socket` constructor.
1449
1449
  */
@@ -1477,10 +1477,10 @@ class De extends g {
1477
1477
  return;
1478
1478
  const e = this.io;
1479
1479
  this.subs = [
1480
- b(e, "open", this.onopen.bind(this)),
1481
- b(e, "packet", this.onpacket.bind(this)),
1482
- b(e, "error", this.onerror.bind(this)),
1483
- b(e, "close", this.onclose.bind(this))
1480
+ T(e, "open", this.onopen.bind(this)),
1481
+ T(e, "packet", this.onpacket.bind(this)),
1482
+ T(e, "error", this.onerror.bind(this)),
1483
+ T(e, "close", this.onclose.bind(this))
1484
1484
  ];
1485
1485
  }
1486
1486
  /**
@@ -1558,8 +1558,8 @@ class De extends g {
1558
1558
  * @return self
1559
1559
  */
1560
1560
  emit(e, ...t) {
1561
- var s, i, r;
1562
- if (Lt.hasOwnProperty(e))
1561
+ var s, r, i;
1562
+ if (Mt.hasOwnProperty(e))
1563
1563
  throw new Error('"' + e.toString() + '" is a reserved event name');
1564
1564
  if (t.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
1565
1565
  return this._addToQueue(t), this;
@@ -1571,7 +1571,7 @@ class De extends g {
1571
1571
  const d = this.ids++, m = t.pop();
1572
1572
  this._registerAckCallback(d, m), o.id = d;
1573
1573
  }
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());
1574
+ 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());
1575
1575
  return this.flags.volatile && !h || (l ? (this.notifyOutgoingListeners(o), this.packet(o)) : this.sendBuffer.push(o)), this.flags = {}, this;
1576
1576
  }
1577
1577
  /**
@@ -1579,18 +1579,18 @@ class De extends g {
1579
1579
  */
1580
1580
  _registerAckCallback(e, t) {
1581
1581
  var s;
1582
- const i = (s = this.flags.timeout) !== null && s !== void 0 ? s : this._opts.ackTimeout;
1583
- if (i === void 0) {
1582
+ const r = (s = this.flags.timeout) !== null && s !== void 0 ? s : this._opts.ackTimeout;
1583
+ if (r === void 0) {
1584
1584
  this.acks[e] = t;
1585
1585
  return;
1586
1586
  }
1587
- const r = this.io.setTimeoutFn(() => {
1587
+ const i = this.io.setTimeoutFn(() => {
1588
1588
  delete this.acks[e];
1589
1589
  for (let h = 0; h < this.sendBuffer.length; h++)
1590
1590
  this.sendBuffer[h].id === e && this.sendBuffer.splice(h, 1);
1591
1591
  t.call(this, new Error("operation has timed out"));
1592
- }, i), o = (...h) => {
1593
- this.io.clearTimeoutFn(r), t.apply(this, h);
1592
+ }, r), o = (...h) => {
1593
+ this.io.clearTimeoutFn(i), t.apply(this, h);
1594
1594
  };
1595
1595
  o.withError = !0, this.acks[e] = o;
1596
1596
  }
@@ -1611,9 +1611,9 @@ class De extends g {
1611
1611
  * @return a Promise that will be fulfilled when the server acknowledges the event
1612
1612
  */
1613
1613
  emitWithAck(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);
1614
+ return new Promise((s, r) => {
1615
+ const i = (o, h) => o ? r(o) : s(h);
1616
+ i.withError = !0, t.push(i), this.emit(e, ...t);
1617
1617
  });
1618
1618
  }
1619
1619
  /**
@@ -1631,7 +1631,7 @@ class De extends g {
1631
1631
  args: e,
1632
1632
  flags: Object.assign({ fromQueue: !0 }, this.flags)
1633
1633
  };
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();
1634
+ 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();
1635
1635
  }
1636
1636
  /**
1637
1637
  * Send the first packet of the queue, and wait for an acknowledgement from the server.
@@ -1765,11 +1765,11 @@ class De extends g {
1765
1765
  ack(e) {
1766
1766
  const t = this;
1767
1767
  let s = !1;
1768
- return function(...i) {
1768
+ return function(...r) {
1769
1769
  s || (s = !0, t.packet({
1770
1770
  type: p.ACK,
1771
1771
  id: e,
1772
- data: i
1772
+ data: r
1773
1773
  }));
1774
1774
  };
1775
1775
  }
@@ -2058,16 +2058,16 @@ P.prototype.setMax = function(n) {
2058
2058
  P.prototype.setJitter = function(n) {
2059
2059
  this.jitter = n;
2060
2060
  };
2061
- class ae extends g {
2061
+ class he extends g {
2062
2062
  constructor(e, t) {
2063
2063
  var s;
2064
- super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t, 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({
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, K(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({
2065
2065
  min: this.reconnectionDelay(),
2066
2066
  max: this.reconnectionDelayMax(),
2067
2067
  jitter: this.randomizationFactor()
2068
2068
  }), this.timeout(t.timeout == null ? 2e4 : t.timeout), this._readyState = "closed", this.uri = e;
2069
- const i = t.parser || It;
2070
- this.encoder = new i.Encoder(), this.decoder = new i.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
2069
+ const r = t.parser || Ft;
2070
+ this.encoder = new r.Encoder(), this.decoder = new r.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
2071
2071
  }
2072
2072
  reconnection(e) {
2073
2073
  return arguments.length ? (this._reconnection = !!e, e || (this.skipReconnect = !0), this) : this._reconnection;
@@ -2109,23 +2109,23 @@ class ae extends g {
2109
2109
  open(e) {
2110
2110
  if (~this._readyState.indexOf("open"))
2111
2111
  return this;
2112
- this.engine = new vt(this.uri, this.opts);
2112
+ this.engine = new $t(this.uri, this.opts);
2113
2113
  const t = this.engine, s = this;
2114
2114
  this._readyState = "opening", this.skipReconnect = !1;
2115
- const i = b(t, "open", function() {
2115
+ const r = T(t, "open", function() {
2116
2116
  s.onopen(), e && e();
2117
- }), r = (h) => {
2117
+ }), i = (h) => {
2118
2118
  this.cleanup(), this._readyState = "closed", this.emitReserved("error", h), e ? e(h) : this.maybeReconnectOnOpen();
2119
- }, o = b(t, "error", r);
2119
+ }, o = T(t, "error", i);
2120
2120
  if (this._timeout !== !1) {
2121
2121
  const h = this._timeout, l = this.setTimeoutFn(() => {
2122
- i(), r(new Error("timeout")), t.close();
2122
+ r(), i(new Error("timeout")), t.close();
2123
2123
  }, h);
2124
2124
  this.opts.autoUnref && l.unref(), this.subs.push(() => {
2125
2125
  this.clearTimeoutFn(l);
2126
2126
  });
2127
2127
  }
2128
- return this.subs.push(i), this.subs.push(o), this;
2128
+ return this.subs.push(r), this.subs.push(o), this;
2129
2129
  }
2130
2130
  /**
2131
2131
  * Alias for open()
@@ -2145,12 +2145,12 @@ class ae extends g {
2145
2145
  this.cleanup(), this._readyState = "open", this.emitReserved("open");
2146
2146
  const e = this.engine;
2147
2147
  this.subs.push(
2148
- b(e, "ping", this.onping.bind(this)),
2149
- b(e, "data", this.ondata.bind(this)),
2150
- b(e, "error", this.onerror.bind(this)),
2151
- b(e, "close", this.onclose.bind(this)),
2148
+ T(e, "ping", this.onping.bind(this)),
2149
+ T(e, "data", this.ondata.bind(this)),
2150
+ T(e, "error", this.onerror.bind(this)),
2151
+ T(e, "close", this.onclose.bind(this)),
2152
2152
  // @ts-ignore
2153
- b(this.decoder, "decoded", this.ondecoded.bind(this))
2153
+ T(this.decoder, "decoded", this.ondecoded.bind(this))
2154
2154
  );
2155
2155
  }
2156
2156
  /**
@@ -2179,7 +2179,7 @@ class ae extends g {
2179
2179
  * @private
2180
2180
  */
2181
2181
  ondecoded(e) {
2182
- j(() => {
2182
+ Y(() => {
2183
2183
  this.emitReserved("packet", e);
2184
2184
  }, this.setTimeoutFn);
2185
2185
  }
@@ -2199,7 +2199,7 @@ class ae extends g {
2199
2199
  */
2200
2200
  socket(e, t) {
2201
2201
  let s = this.nsps[e];
2202
- return s ? this._autoConnect && !s.active && s.connect() : (s = new De(this, e, t), this.nsps[e] = s), s;
2202
+ return s ? this._autoConnect && !s.active && s.connect() : (s = new je(this, e, t), this.nsps[e] = s), s;
2203
2203
  }
2204
2204
  /**
2205
2205
  * Called upon a socket close.
@@ -2277,8 +2277,8 @@ class ae extends g {
2277
2277
  const t = this.backoff.duration();
2278
2278
  this._reconnecting = !0;
2279
2279
  const s = this.setTimeoutFn(() => {
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();
2280
+ e.skipReconnect || (this.emitReserved("reconnect_attempt", e.backoff.attempts), !e.skipReconnect && e.open((r) => {
2281
+ r ? (e._reconnecting = !1, e.reconnect(), this.emitReserved("reconnect_error", r)) : e.onreconnect();
2282
2282
  }));
2283
2283
  }, t);
2284
2284
  this.opts.autoUnref && s.unref(), this.subs.push(() => {
@@ -2297,19 +2297,20 @@ class ae extends g {
2297
2297
  }
2298
2298
  }
2299
2299
  const I = {};
2300
- function q(n, e) {
2300
+ function U(n, e) {
2301
2301
  typeof n == "object" && (e = n, n = void 0), e = e || {};
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;
2302
+ const t = Rt(n, e.path || "/socket.io"), s = t.source, r = t.id, i = t.path, o = I[r] && i in I[r].nsps, h = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
2303
2303
  let l;
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);
2304
+ return h ? l = new he(s, e) : (I[r] || (I[r] = new he(s, e)), l = I[r]), t.query && !e.query && (e.query = t.queryKey), l.socket(t.path, e);
2305
2305
  }
2306
- Object.assign(q, {
2307
- Manager: ae,
2308
- Socket: De,
2309
- io: q,
2310
- connect: q
2306
+ Object.assign(U, {
2307
+ Manager: he,
2308
+ Socket: je,
2309
+ io: U,
2310
+ connect: U
2311
2311
  });
2312
- function qt(n) {
2312
+ const Re = 100;
2313
+ function Vt(n) {
2313
2314
  try {
2314
2315
  const e = JSON.parse(n);
2315
2316
  if (e && typeof e == "object") {
@@ -2324,20 +2325,50 @@ function qt(n) {
2324
2325
  }
2325
2326
  return {};
2326
2327
  }
2327
- class Ut extends Error {
2328
- constructor(t, s, i) {
2329
- const r = qt(i);
2330
- super(r.message ?? `${s || "Request failed"} (${t})`);
2328
+ function Ht(n) {
2329
+ if (!n || typeof n != "object") return;
2330
+ const e = n.retryAfter;
2331
+ return typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : void 0;
2332
+ }
2333
+ class _e extends Error {
2334
+ constructor(t, s, r, i) {
2335
+ const o = Vt(r);
2336
+ super(o.message ?? `${s || "Request failed"} (${t})`);
2331
2337
  w(this, "status");
2332
2338
  w(this, "code");
2333
2339
  w(this, "details");
2334
2340
  w(this, "body");
2335
- this.name = "RequestError", this.status = t, this.code = r.code, this.details = r.details, this.body = i;
2341
+ /**
2342
+ * Seconds to wait before retrying, taken from the `Retry-After` header or
2343
+ * from `details.retryAfter`. Only present on rate-limited (429) responses.
2344
+ */
2345
+ w(this, "retryAfter");
2346
+ this.name = "RequestError", this.status = t, this.code = o.code, this.details = o.details, this.body = r, this.retryAfter = i ?? Ht(o.details);
2336
2347
  }
2337
2348
  }
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 {
2349
+ const v = "item/folder", f = "item", S = "processor", jt = "npm-registry", O = "hidden", te = "FILE", se = "TOOL", ne = "APP", Gt = 500, Ce = 3e4, Jt = 0.25, Yt = (n) => new Promise((e) => setTimeout(e, n));
2350
+ function Kt(n) {
2351
+ var r, i;
2352
+ const e = (i = (r = n.headers) == null ? void 0 : r.get) == null ? void 0 : i.call(r, "Retry-After");
2353
+ if (!e) return;
2354
+ const t = Number(e);
2355
+ if (Number.isFinite(t)) return Math.max(0, t);
2356
+ const s = Date.parse(e);
2357
+ if (!Number.isNaN(s))
2358
+ return Math.max(0, (s - Date.now()) / 1e3);
2359
+ }
2360
+ function Wt(n) {
2361
+ return n instanceof _e ? n.status === 429 || n.status >= 500 : !0;
2362
+ }
2363
+ function Xt(n, e) {
2364
+ const t = Math.min(
2365
+ Gt * 2 ** e,
2366
+ Ce
2367
+ ), s = t * Jt * Math.random(), r = n instanceof _e && n.retryAfter != null ? n.retryAfter * 1e3 : void 0;
2368
+ return r != null ? Math.min(r, Ce) + s : t + s;
2369
+ }
2370
+ var a, le, u, $, q, G, J, fe, pe, Ge;
2371
+ const be = class be {
2341
2372
  /**
2342
2373
  * Creates a new EngineServicesClient instance.
2343
2374
  * @param accessToken - API access token (obtained from the platform dashboard)
@@ -2346,7 +2377,7 @@ const ge = class ge {
2346
2377
  * @param props - Optional configuration (retry count, auth mode, etc.).
2347
2378
  */
2348
2379
  constructor(e, t, s) {
2349
- W(this, a);
2380
+ z(this, a);
2350
2381
  w(this, "apiUrl");
2351
2382
  w(this, "accessToken");
2352
2383
  w(this, "wsUrl");
@@ -2365,9 +2396,9 @@ const ge = class ge {
2365
2396
  * Populated automatically when using {@link fromPlatformContext}.
2366
2397
  */
2367
2398
  w(this, "context");
2368
- const { retries: i = 0, useBearer: r = !1, localServerUrl: o } = s || {};
2399
+ const { retries: r = 0, useBearer: i = !1, localServerUrl: o } = s || {};
2369
2400
  let h = t;
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) {
2401
+ 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) {
2371
2402
  let l = o;
2372
2403
  l.charAt(l.length - 1) === "/" && (l = l.slice(0, -1)), this.localServerUrl = l;
2373
2404
  }
@@ -2389,14 +2420,16 @@ const ge = class ge {
2389
2420
  * ```
2390
2421
  */
2391
2422
  static fromPlatformContext(e) {
2392
- const t = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new ge(t.accessToken, t.apiUrl, {
2423
+ const t = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new be(t.accessToken, t.apiUrl, {
2393
2424
  ...e,
2394
2425
  useBearer: !0
2395
2426
  });
2396
2427
  return s.context = t, s;
2397
2428
  }
2398
2429
  /**
2399
- * Sets the number of automatic retries for failed requests.
2430
+ * Sets the number of automatic retries for failed requests. Retries use
2431
+ * exponential backoff with jitter and honour `Retry-After`; only network
2432
+ * failures, 429s and 5xx are retried.
2400
2433
  * @param retries - Number of retries (0 = no retries).
2401
2434
  */
2402
2435
  setRetries(e) {
@@ -2468,12 +2501,12 @@ const ge = class ge {
2468
2501
  * @returns Array of file items.
2469
2502
  */
2470
2503
  async listFiles(e) {
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}`, {
2504
+ const { folderId: t, archived: s, projectId: r } = e || {};
2505
+ return t ? await c(this, a, u).call(this, "GET", `${v}/${t}/items`, { query: { itemType: te, archived: s } }) : await c(this, a, u).call(this, "GET", `${f}`, {
2473
2506
  query: {
2474
- itemType: Z,
2507
+ itemType: te,
2475
2508
  archived: s,
2476
- ...i && { projectId: i }
2509
+ ...r && { projectId: r }
2477
2510
  }
2478
2511
  });
2479
2512
  }
@@ -2484,7 +2517,7 @@ const ge = class ge {
2484
2517
  * @returns The file item, optionally with version history.
2485
2518
  */
2486
2519
  async getFile(e, t) {
2487
- return await c(this, a, le).call(this, e, t);
2520
+ return await c(this, a, pe).call(this, e, t);
2488
2521
  }
2489
2522
  /**
2490
2523
  * Uploads a new file.
@@ -2492,7 +2525,7 @@ const ge = class ge {
2492
2525
  * @returns The created item and its first version.
2493
2526
  */
2494
2527
  async createFile(e) {
2495
- return await c(this, a, G).call(this, e, Z);
2528
+ return await c(this, a, J).call(this, e, te);
2496
2529
  }
2497
2530
  /**
2498
2531
  * Updates an existing file. Can rename, move to a different folder,
@@ -2502,7 +2535,7 @@ const ge = class ge {
2502
2535
  * @returns The updated item and/or the new version.
2503
2536
  */
2504
2537
  async updateFile(e, t) {
2505
- return await c(this, a, ue).call(this, e, t);
2538
+ return await c(this, a, fe).call(this, e, t);
2506
2539
  }
2507
2540
  /**
2508
2541
  * Archives (soft-deletes) a file. Can be recovered with {@link recoverFile}.
@@ -2525,7 +2558,7 @@ const ge = class ge {
2525
2558
  * @returns A fetch Response containing the file data.
2526
2559
  */
2527
2560
  async downloadFile(e, t) {
2528
- return await c(this, a, H).call(this, e, t);
2561
+ return await c(this, a, G).call(this, e, t);
2529
2562
  }
2530
2563
  /**
2531
2564
  * Retrieves the free-JSON metadata for a specific file version.
@@ -2535,10 +2568,10 @@ const ge = class ge {
2535
2568
  * @param params - Optional flags such as `withDraft`.
2536
2569
  */
2537
2570
  async getFileVersionMetadata(e, t, s) {
2538
- const { withDraft: i } = s || {};
2571
+ const { withDraft: r } = s || {};
2539
2572
  return await c(this, a, u).call(this, "GET", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
2540
2573
  query: {
2541
- ...i && { withDraft: "true" }
2574
+ ...r && { withDraft: "true" }
2542
2575
  }
2543
2576
  });
2544
2577
  }
@@ -2562,6 +2595,29 @@ const ge = class ge {
2562
2595
  async deleteFileVersionMetadata(e, t) {
2563
2596
  return await c(this, a, u).call(this, "DELETE", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`);
2564
2597
  }
2598
+ /**
2599
+ * Batch variant of {@link getFileVersionMetadata}. Reads the metadata of
2600
+ * many (file, version) pairs in one request instead of one request per pair,
2601
+ * which is what a file list needs when it hydrates a whole page at once.
2602
+ *
2603
+ * Inputs longer than {@link STORAGE_BATCH_MAX} are split into several
2604
+ * requests automatically. Entries come back in the order they were asked
2605
+ * for; a pair the caller cannot read carries an `error` instead of
2606
+ * `metadata`, so one bad id does not lose the whole page.
2607
+ *
2608
+ * @param entries - The `{ itemId, versionTag }` pairs to read.
2609
+ * @param params - Optional flags such as `withDraft`.
2610
+ */
2611
+ async getFileVersionMetadataBatch(e, t) {
2612
+ const { withDraft: s } = t || {};
2613
+ return await c(this, a, q).call(this, e, async (r) => (await c(this, a, u).call(this, "POST", `${f}/batch/version-metadata`, {
2614
+ body: JSON.stringify({
2615
+ entries: r,
2616
+ ...s !== void 0 && { withDraft: s }
2617
+ }),
2618
+ contentType: "application/json"
2619
+ })).results);
2620
+ }
2565
2621
  // ─── Folders ─────────────────────────────────────────────────────
2566
2622
  /**
2567
2623
  * Lists all folders accessible by the current token.
@@ -2569,12 +2625,12 @@ const ge = class ge {
2569
2625
  * @returns Array of folder items.
2570
2626
  */
2571
2627
  async listFolders(e) {
2572
- const { archived: t, parentFolderId: s, projectId: i } = e || {};
2573
- return await c(this, a, u).call(this, "GET", T, {
2628
+ const { archived: t, parentFolderId: s, projectId: r } = e || {};
2629
+ return await c(this, a, u).call(this, "GET", v, {
2574
2630
  query: {
2575
2631
  parentFolderId: s,
2576
2632
  archived: t,
2577
- ...i && { projectId: i }
2633
+ ...r && { projectId: r }
2578
2634
  }
2579
2635
  });
2580
2636
  }
@@ -2583,7 +2639,26 @@ const ge = class ge {
2583
2639
  * @param folderId - The folder's unique identifier.
2584
2640
  */
2585
2641
  async getFolder(e) {
2586
- return await c(this, a, u).call(this, "GET", `${T}/${e}`);
2642
+ return await c(this, a, u).call(this, "GET", `${v}/${e}`);
2643
+ }
2644
+ /**
2645
+ * Batch variant of {@link getFolder}. Resolves a known set of folder ids in
2646
+ * one request — for example the parents behind a file list's breadcrumbs.
2647
+ *
2648
+ * Reach for {@link listFolders} instead when the whole (project) tree is
2649
+ * wanted; this is for the case where the ids are already known.
2650
+ *
2651
+ * Inputs longer than {@link STORAGE_BATCH_MAX} are split into several
2652
+ * requests automatically. A folder the caller cannot read carries an
2653
+ * `error` instead of `folder`.
2654
+ *
2655
+ * @param folderIds - The folder ids to resolve.
2656
+ */
2657
+ async getFoldersBatch(e) {
2658
+ return await c(this, a, q).call(this, e, async (t) => (await c(this, a, u).call(this, "POST", `${f}/batch/folders`, {
2659
+ body: JSON.stringify({ folderIds: t }),
2660
+ contentType: "application/json"
2661
+ })).results);
2587
2662
  }
2588
2663
  /**
2589
2664
  * Creates a new folder.
@@ -2592,7 +2667,7 @@ const ge = class ge {
2592
2667
  * @returns The created folder.
2593
2668
  */
2594
2669
  async createFolder(e, t, s) {
2595
- return await c(this, a, u).call(this, "POST", T, {
2670
+ return await c(this, a, u).call(this, "POST", v, {
2596
2671
  body: JSON.stringify({
2597
2672
  name: e,
2598
2673
  ...t && { parentId: t },
@@ -2609,7 +2684,7 @@ const ge = class ge {
2609
2684
  */
2610
2685
  async updateFolder(e, t) {
2611
2686
  const { name: s } = t;
2612
- return await c(this, a, u).call(this, "PUT", `${T}/${e}`, {
2687
+ return await c(this, a, u).call(this, "PUT", `${v}/${e}`, {
2613
2688
  body: JSON.stringify({ name: s }),
2614
2689
  contentType: "application/json"
2615
2690
  });
@@ -2619,14 +2694,14 @@ const ge = class ge {
2619
2694
  * @param folderId - The folder's unique identifier.
2620
2695
  */
2621
2696
  async archiveFolder(e) {
2622
- return await c(this, a, u).call(this, "DELETE", `${T}/${e}`);
2697
+ return await c(this, a, u).call(this, "DELETE", `${v}/${e}`);
2623
2698
  }
2624
2699
  /**
2625
2700
  * Recovers a previously archived folder.
2626
2701
  * @param folderId - The folder's unique identifier.
2627
2702
  */
2628
2703
  async recoverFolder(e) {
2629
- return await c(this, a, u).call(this, "PUT", `${T}/${e}/recover`);
2704
+ return await c(this, a, u).call(this, "PUT", `${v}/${e}/recover`);
2630
2705
  }
2631
2706
  /**
2632
2707
  * Downloads an entire folder as a ZIP archive.
@@ -2634,7 +2709,7 @@ const ge = class ge {
2634
2709
  * @returns A fetch Response containing the ZIP data.
2635
2710
  */
2636
2711
  async downloadFolder(e) {
2637
- return await c(this, a, C).call(this, `${T}/${e}/download`);
2712
+ return await c(this, a, $).call(this, `${v}/${e}/download`);
2638
2713
  }
2639
2714
  // ─── Components ──────────────────────────────────────────────────
2640
2715
  /**
@@ -2643,17 +2718,17 @@ const ge = class ge {
2643
2718
  * @returns Array of component items.
2644
2719
  */
2645
2720
  async listComponents(e) {
2646
- const { folderId: t, ShowVersions: s, projectId: i } = e || {};
2647
- return t ? await c(this, a, u).call(this, "GET", `${T}/${t}/items`, {
2721
+ const { folderId: t, ShowVersions: s, projectId: r } = e || {};
2722
+ return t ? await c(this, a, u).call(this, "GET", `${v}/${t}/items`, {
2648
2723
  query: {
2649
- itemType: ee,
2724
+ itemType: se,
2650
2725
  ...s && { ShowVersions: s }
2651
2726
  }
2652
2727
  }) : await c(this, a, u).call(this, "GET", `${f}`, {
2653
2728
  query: {
2654
- itemType: ee,
2729
+ itemType: se,
2655
2730
  ...s && { ShowVersions: s },
2656
- ...i && { projectId: i }
2731
+ ...r && { projectId: r }
2657
2732
  }
2658
2733
  });
2659
2734
  }
@@ -2663,7 +2738,7 @@ const ge = class ge {
2663
2738
  * @param props - Options such as whether to include versions.
2664
2739
  */
2665
2740
  async getComponent(e, t) {
2666
- return await c(this, a, le).call(this, e, t);
2741
+ return await c(this, a, pe).call(this, e, t);
2667
2742
  }
2668
2743
  /**
2669
2744
  * Creates a new component with the given file and version properties.
@@ -2672,7 +2747,7 @@ const ge = class ge {
2672
2747
  */
2673
2748
  async createComponent(e) {
2674
2749
  const { componentProps: t } = e;
2675
- return await c(this, a, G).call(this, e, ee, t);
2750
+ return await c(this, a, J).call(this, e, se, t);
2676
2751
  }
2677
2752
  /**
2678
2753
  * Updates an existing component. Can rename, move, and/or upload a new version.
@@ -2682,7 +2757,7 @@ const ge = class ge {
2682
2757
  */
2683
2758
  async updateComponent(e, t) {
2684
2759
  const { componentProps: s } = t;
2685
- return await c(this, a, ue).call(this, e, t, s);
2760
+ return await c(this, a, fe).call(this, e, t, s);
2686
2761
  }
2687
2762
  /**
2688
2763
  * Downloads a component's full ZIP file. Returns the raw fetch Response.
@@ -2691,7 +2766,7 @@ const ge = class ge {
2691
2766
  * @returns A fetch Response containing the ZIP data.
2692
2767
  */
2693
2768
  async downloadComponent(e, t) {
2694
- return await c(this, a, H).call(this, e, t);
2769
+ return await c(this, a, G).call(this, e, t);
2695
2770
  }
2696
2771
  /**
2697
2772
  * Downloads only the JavaScript bundle from a component's ZIP.
@@ -2701,11 +2776,11 @@ const ge = class ge {
2701
2776
  * @returns A fetch Response containing the bundle JavaScript text.
2702
2777
  */
2703
2778
  async downloadComponentBundle(e, t) {
2704
- const { versionTag: s, withDraft: i } = t || {};
2705
- return await c(this, a, C).call(this, `${f}/${e}/download/bundle`, {
2779
+ const { versionTag: s, withDraft: r } = t || {};
2780
+ return await c(this, a, $).call(this, `${f}/${e}/download/bundle`, {
2706
2781
  query: {
2707
2782
  ...s && { versionTag: s },
2708
- ...i && { withDraft: i }
2783
+ ...r && { withDraft: r }
2709
2784
  }
2710
2785
  });
2711
2786
  }
@@ -2730,7 +2805,7 @@ const ge = class ge {
2730
2805
  * @returns The component's JavaScript source code as a string.
2731
2806
  */
2732
2807
  async getBuiltInComponent(e) {
2733
- return await (await c(this, a, C).call(this, `built-in/${e}/bundle`)).text();
2808
+ return await (await c(this, a, $).call(this, `built-in/${e}/bundle`)).text();
2734
2809
  }
2735
2810
  /**
2736
2811
  * Fetches a built-in component bundle, evaluates it, and registers it
@@ -2759,7 +2834,7 @@ const ge = class ge {
2759
2834
  * ```
2760
2835
  */
2761
2836
  async initBuiltInComponent(e, t, s) {
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}
2837
+ 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}
2763
2838
  return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2764
2839
  t.get(d);
2765
2840
  }
@@ -2804,12 +2879,12 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2804
2879
  */
2805
2880
  async setup(e, ...t) {
2806
2881
  var o, h;
2807
- const s = e.OBC, i = e.BUI;
2882
+ const s = e.OBC, r = e.BUI;
2808
2883
  if (!(s != null && s.Components))
2809
2884
  throw new Error("globals.OBC must include Components");
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 };
2885
+ if (!(r != null && r.Manager)) throw new Error("globals.BUI must include Manager");
2886
+ const i = new s.Components();
2887
+ 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 };
2813
2888
  }
2814
2889
  /**
2815
2890
  * Reports an error to the platform via the {@link AppEventOrchestrator.appError} callback.
@@ -2817,8 +2892,8 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2817
2892
  * @param data - Arbitrary error data to send to the platform.
2818
2893
  */
2819
2894
  throwError(e, t) {
2820
- var s, i;
2821
- (i = (s = this.context.appEventOrchestrator) == null ? void 0 : s.appError) == null || i.call(s, e, t);
2895
+ var s, r;
2896
+ (r = (s = this.context.appEventOrchestrator) == null ? void 0 : s.appError) == null || r.call(s, e, t);
2822
2897
  }
2823
2898
  // ─── Apps ────────────────────────────────────────────────────────
2824
2899
  /**
@@ -2827,17 +2902,17 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2827
2902
  * @returns Array of app items.
2828
2903
  */
2829
2904
  async listApps(e) {
2830
- const { folderId: t, ShowVersions: s, projectId: i } = e || {};
2831
- return t ? await c(this, a, u).call(this, "GET", `${T}/${t}/items`, {
2905
+ const { folderId: t, ShowVersions: s, projectId: r } = e || {};
2906
+ return t ? await c(this, a, u).call(this, "GET", `${v}/${t}/items`, {
2832
2907
  query: {
2833
- itemType: te,
2908
+ itemType: ne,
2834
2909
  ...s && { ShowVersions: s }
2835
2910
  }
2836
2911
  }) : await c(this, a, u).call(this, "GET", `${f}`, {
2837
2912
  query: {
2838
- itemType: te,
2913
+ itemType: ne,
2839
2914
  ...s && { ShowVersions: s },
2840
- ...i && { projectId: i }
2915
+ ...r && { projectId: r }
2841
2916
  }
2842
2917
  });
2843
2918
  }
@@ -2848,7 +2923,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2848
2923
  */
2849
2924
  async createApp(e) {
2850
2925
  const { appProps: t } = e;
2851
- return await c(this, a, G).call(this, e, te, t);
2926
+ return await c(this, a, J).call(this, e, ne, t);
2852
2927
  }
2853
2928
  /**
2854
2929
  * Downloads an app's full ZIP file. Returns the raw fetch Response.
@@ -2857,7 +2932,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2857
2932
  * @returns A fetch Response containing the ZIP data.
2858
2933
  */
2859
2934
  async downloadApp(e, t) {
2860
- return await c(this, a, H).call(this, e, t);
2935
+ return await c(this, a, G).call(this, e, t);
2861
2936
  }
2862
2937
  /**
2863
2938
  * Downloads only the JavaScript bundle from an app's ZIP.
@@ -2867,11 +2942,11 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2867
2942
  * @returns A fetch Response containing the bundle JavaScript text.
2868
2943
  */
2869
2944
  async downloadAppBundle(e, t) {
2870
- const { versionTag: s, withDraft: i } = t || {};
2871
- return await c(this, a, C).call(this, `${f}/${e}/download/bundle`, {
2945
+ const { versionTag: s, withDraft: r } = t || {};
2946
+ return await c(this, a, $).call(this, `${f}/${e}/download/bundle`, {
2872
2947
  query: {
2873
2948
  ...s && { versionTag: s },
2874
- ...i && { withDraft: i }
2949
+ ...r && { withDraft: r }
2875
2950
  }
2876
2951
  });
2877
2952
  }
@@ -2892,7 +2967,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2892
2967
  * @returns The registry, scope, read-only token, and assembled `.npmrc`.
2893
2968
  */
2894
2969
  async getNpmCredentials() {
2895
- return await c(this, a, u).call(this, "GET", `${Dt}/credentials`);
2970
+ return await c(this, a, u).call(this, "GET", `${jt}/credentials`);
2896
2971
  }
2897
2972
  // ─── Execution ───────────────────────────────────────────────────
2898
2973
  /**
@@ -2911,16 +2986,18 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2911
2986
  */
2912
2987
  async executeComponent(e, t, s) {
2913
2988
  if (this.localServerUrl) {
2914
- const i = `${this.localServerUrl}/api/${S}/${e}/execute`, r = await fetch(i, {
2989
+ const r = `${this.localServerUrl}/api/${S}/${e}/execute`, i = await fetch(r, {
2915
2990
  method: "POST",
2916
2991
  headers: { "Content-Type": "application/json" },
2917
2992
  body: JSON.stringify(t)
2918
2993
  });
2919
- if (!r.ok) {
2920
- const o = await r.text().catch(() => "");
2921
- throw new Error(`Local server request failed: ${r.status} - ${o}`);
2994
+ if (!i.ok) {
2995
+ const o = await i.text().catch(() => "");
2996
+ throw new Error(
2997
+ `Local server request failed: ${i.status} - ${o}`
2998
+ );
2922
2999
  }
2923
- return await r.json();
3000
+ return await i.json();
2924
3001
  }
2925
3002
  return await c(this, a, u).call(this, "POST", `${S}/${e}/execute`, {
2926
3003
  body: JSON.stringify(t),
@@ -2936,8 +3013,10 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2936
3013
  if (this.localServerUrl) {
2937
3014
  const t = `${this.localServerUrl}/api/${S}/progress/${e}/abort`, s = await fetch(t, { method: "POST" });
2938
3015
  if (!s.ok) {
2939
- const i = await s.text().catch(() => "");
2940
- throw new Error(`Local server request failed: ${s.status} - ${i}`);
3016
+ const r = await s.text().catch(() => "");
3017
+ throw new Error(
3018
+ `Local server request failed: ${s.status} - ${r}`
3019
+ );
2941
3020
  }
2942
3021
  return await s.json();
2943
3022
  }
@@ -2958,14 +3037,14 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2958
3037
  */
2959
3038
  async listExecutions(e, t) {
2960
3039
  if (this.localServerUrl) {
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(() => "");
3040
+ const s = t ? `?projectId=${encodeURIComponent(t)}` : "", r = `${this.localServerUrl}/api/${S}/${e}/progress${s}`, i = await fetch(r);
3041
+ if (!i.ok) {
3042
+ const o = await i.text().catch(() => "");
2964
3043
  throw new Error(
2965
- `Local server request failed: ${r.status} - ${o}`
3044
+ `Local server request failed: ${i.status} - ${o}`
2966
3045
  );
2967
3046
  }
2968
- return await r.json();
3047
+ return await i.json();
2969
3048
  }
2970
3049
  return await c(this, a, u).call(this, "GET", `${S}/${e}/progress`, { query: { ...t && { projectId: t } } });
2971
3050
  }
@@ -2978,8 +3057,10 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2978
3057
  if (this.localServerUrl) {
2979
3058
  const t = `${this.localServerUrl}/api/${S}/progress/${e}`, s = await fetch(t);
2980
3059
  if (!s.ok) {
2981
- const i = await s.text().catch(() => "");
2982
- throw new Error(`Local server request failed: ${s.status} - ${i}`);
3060
+ const r = await s.text().catch(() => "");
3061
+ throw new Error(
3062
+ `Local server request failed: ${s.status} - ${r}`
3063
+ );
2983
3064
  }
2984
3065
  return await s.json();
2985
3066
  }
@@ -2992,15 +3073,15 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2992
3073
  * @param onUpdateCallback - Callback invoked on each progress/result event.
2993
3074
  */
2994
3075
  async onExecutionProgress(e, t) {
2995
- const s = this.localServerUrl ? `${this.localServerUrl}?accessToken=${this.accessToken}` : this.wsUrl, i = await q(s, {
3076
+ const s = this.localServerUrl ? `${this.localServerUrl}?accessToken=${this.accessToken}` : this.wsUrl, r = await U(s, {
2996
3077
  ...this.localServerUrl && { transports: ["websocket"] }
2997
3078
  });
2998
- i.on("connect", function() {
2999
- i.emit("executionSubscription", JSON.stringify({ executionId: e })), i.on("execution", (r) => {
3000
- t(r);
3079
+ r.on("connect", function() {
3080
+ r.emit("executionSubscription", JSON.stringify({ executionId: e })), r.on("execution", (i) => {
3081
+ t(i);
3001
3082
  });
3002
- }), i.on("connect_error", function(r) {
3003
- console.log(r);
3083
+ }), r.on("connect_error", function(i) {
3084
+ console.log(i);
3004
3085
  });
3005
3086
  }
3006
3087
  // ─── Hidden Files ────────────────────────────────────────────────
@@ -3012,7 +3093,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3012
3093
  */
3013
3094
  async createHiddenFile(e, t) {
3014
3095
  const s = new FormData();
3015
- return s.append("file", e), s.append("parentItemId", t), await c(this, a, u).call(this, "POST", `${f}/${$}`, {
3096
+ return s.append("file", e), s.append("parentItemId", t), await c(this, a, u).call(this, "POST", `${f}/${O}`, {
3016
3097
  body: s
3017
3098
  });
3018
3099
  }
@@ -3026,9 +3107,9 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3026
3107
  */
3027
3108
  async createHiddenFilesBatch(e, t) {
3028
3109
  const s = new FormData();
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`, {
3110
+ for (const r of e)
3111
+ s.append("files", r);
3112
+ return s.append("parentItemId", t), await c(this, a, u).call(this, "POST", `${f}/${O}/batch`, {
3032
3113
  body: s
3033
3114
  });
3034
3115
  }
@@ -3037,21 +3118,21 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3037
3118
  * @param hiddenId - The hidden file's unique identifier.
3038
3119
  */
3039
3120
  async deleteHiddenFile(e) {
3040
- return await c(this, a, u).call(this, "DELETE", `${f}/${$}/${e}`);
3121
+ return await c(this, a, u).call(this, "DELETE", `${f}/${O}/${e}`);
3041
3122
  }
3042
3123
  /**
3043
3124
  * Gets metadata for a hidden file.
3044
3125
  * @param hiddenId - The hidden file's unique identifier.
3045
3126
  */
3046
3127
  async getHiddenFile(e) {
3047
- return await c(this, a, u).call(this, "GET", `${f}/${$}/${e}`);
3128
+ return await c(this, a, u).call(this, "GET", `${f}/${O}/${e}`);
3048
3129
  }
3049
3130
  /**
3050
3131
  * Downloads a hidden file's content. Returns the raw fetch Response.
3051
3132
  * @param hiddenId - The hidden file's unique identifier.
3052
3133
  */
3053
3134
  async downloadHiddenFile(e) {
3054
- return await c(this, a, C).call(this, `${f}/${$}/${e}/download`);
3135
+ return await c(this, a, $).call(this, `${f}/${O}/${e}/download`);
3055
3136
  }
3056
3137
  /**
3057
3138
  * Mints a short-lived presigned URL for a hidden file so the browser can
@@ -3071,7 +3152,34 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3071
3152
  * an ISO timestamp when it stops working.
3072
3153
  */
3073
3154
  async getHiddenFileSignedUrl(e, t) {
3074
- return await c(this, a, u).call(this, "GET", `${f}/${$}/${e}/signed-url`, { ...t != null && { query: { expiresIn: t } } });
3155
+ return await c(this, a, u).call(this, "GET", `${f}/${O}/${e}/signed-url`, { ...t != null && { query: { expiresIn: t } } });
3156
+ }
3157
+ /**
3158
+ * Batch variant of {@link getHiddenFileSignedUrl}. Mints presigned URLs for
3159
+ * many hidden files in one request.
3160
+ *
3161
+ * This is the right call for tile-based viewers (splats, point clouds),
3162
+ * which mint a URL per piece as the camera moves. One request here replaces
3163
+ * up to {@link STORAGE_BATCH_MAX} single calls, which keeps a busy session
3164
+ * well under the per-endpoint rate limit.
3165
+ *
3166
+ * Inputs longer than {@link STORAGE_BATCH_MAX} are split into several
3167
+ * requests automatically. Entries come back in request order; a file that
3168
+ * is gone or not accessible carries an `error` instead of a `url`, so the
3169
+ * remaining tiles still load. Re-call to re-mint as `expiresAt` approaches.
3170
+ *
3171
+ * @param hiddenIds - The hidden files to sign.
3172
+ * @param expiresIn - Desired URL lifetime in seconds (60–3600). Defaults to
3173
+ * 900 (15 min) server-side; values are clamped to that range.
3174
+ */
3175
+ async getHiddenFileSignedUrlsBatch(e, t) {
3176
+ return await c(this, a, q).call(this, e, async (s) => (await c(this, a, u).call(this, "POST", `${f}/${O}/signed-url/batch`, {
3177
+ body: JSON.stringify({
3178
+ hiddenFileIds: s,
3179
+ ...t != null && { expiresIn: t }
3180
+ }),
3181
+ contentType: "application/json"
3182
+ })).results);
3075
3183
  }
3076
3184
  /**
3077
3185
  * Lists all hidden files attached to a parent item.
@@ -3079,14 +3187,14 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3079
3187
  * @returns Array of hidden file entities.
3080
3188
  */
3081
3189
  async getHiddenFilesByParent(e) {
3082
- return await c(this, a, u).call(this, "GET", `${f}/${e}/${$}`);
3190
+ return await c(this, a, u).call(this, "GET", `${f}/${e}/${O}`);
3083
3191
  }
3084
3192
  /**
3085
3193
  * Deletes all hidden files attached to a parent item.
3086
3194
  * @param parentFileId - The parent item's unique identifier.
3087
3195
  */
3088
3196
  async deleteHiddenFilesByParent(e) {
3089
- return await c(this, a, u).call(this, "DELETE", `${f}/${e}/${$}`);
3197
+ return await c(this, a, u).call(this, "DELETE", `${f}/${e}/${O}`);
3090
3198
  }
3091
3199
  // ─── Icons ───────────────────────────────────────────────────────
3092
3200
  /**
@@ -3098,7 +3206,9 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3098
3206
  */
3099
3207
  async uploadItemIcon(e, t) {
3100
3208
  const s = new FormData();
3101
- return s.append("icon", t), await c(this, a, u).call(this, "PUT", `${f}/${e}/icon`, { body: s });
3209
+ return s.append("icon", t), await c(this, a, u).call(this, "PUT", `${f}/${e}/icon`, {
3210
+ body: s
3211
+ });
3102
3212
  }
3103
3213
  /**
3104
3214
  * Downloads the icon for an item as a binary stream.
@@ -3106,7 +3216,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3106
3216
  * @returns The raw Response (use `.blob()`, `.arrayBuffer()`, or pipe the body).
3107
3217
  */
3108
3218
  async getItemIcon(e) {
3109
- return await c(this, a, C).call(this, `${f}/${e}/icon`);
3219
+ return await c(this, a, $).call(this, `${f}/${e}/icon`);
3110
3220
  }
3111
3221
  /**
3112
3222
  * Removes the icon from an item.
@@ -3139,9 +3249,9 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3139
3249
  * @param metadata - Optional free-JSON metadata to store on the new version.
3140
3250
  * @returns The created version.
3141
3251
  */
3142
- async createVersion(e, t, s, i, r) {
3252
+ async createVersion(e, t, s, r, i) {
3143
3253
  const o = new FormData();
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 });
3254
+ 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 });
3145
3255
  }
3146
3256
  /**
3147
3257
  * Lists versions of an item. Pass `archived: true` to fetch only archived
@@ -3153,6 +3263,31 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3153
3263
  async listVersions(e, t = {}) {
3154
3264
  return await c(this, a, u).call(this, "GET", `${f}/${encodeURIComponent(e)}/versions`, { query: t });
3155
3265
  }
3266
+ /**
3267
+ * Batch variant of {@link listVersions}. Lists the versions of many items in
3268
+ * one request, which is what a file panel needs to render a whole page.
3269
+ *
3270
+ * The returned versions are the full records, metadata included, so a list
3271
+ * that only needs version metadata does not need
3272
+ * {@link getFileVersionMetadataBatch} on top.
3273
+ *
3274
+ * Inputs longer than {@link STORAGE_BATCH_MAX} are split into several
3275
+ * requests automatically. An item the caller cannot read carries an `error`
3276
+ * instead of `versions`.
3277
+ *
3278
+ * @param itemIds - The items whose versions to list.
3279
+ * @param params - Optional `{ archived }` filter, applied to every item.
3280
+ */
3281
+ async listVersionsBatch(e, t = {}) {
3282
+ const { archived: s } = t;
3283
+ return await c(this, a, q).call(this, e, async (r) => (await c(this, a, u).call(this, "POST", `${f}/batch/versions`, {
3284
+ body: JSON.stringify({
3285
+ itemIds: r,
3286
+ ...s !== void 0 && { archived: s }
3287
+ }),
3288
+ contentType: "application/json"
3289
+ })).results);
3290
+ }
3156
3291
  /**
3157
3292
  * Archives a version of an item. Archived versions remain available via
3158
3293
  * `listVersions({ archived: true })` and can be recovered or permanently
@@ -3184,107 +3319,117 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3184
3319
  return await c(this, a, u).call(this, "DELETE", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}`);
3185
3320
  }
3186
3321
  };
3187
- a = new WeakSet(), he = function(e) {
3322
+ a = new WeakSet(), le = function(e) {
3188
3323
  return `${this.apiUrl}/${e}`;
3189
3324
  }, u = async function(e, t, s) {
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 = {
3191
- ...d,
3192
- ...this.useBearer ? {} : { accessToken: m }
3325
+ const { body: r, query: i, contentType: o, retries: h, responseType: l, retryAttempt: y } = s || {}, d = c(this, a, le).call(this, t), m = c(this, a, Ge).call(this, i), E = await this.resolveAccessToken(), Je = {
3326
+ ...m,
3327
+ ...this.useBearer ? {} : { accessToken: E }
3193
3328
  };
3194
3329
  try {
3195
- const A = await fetch(
3196
- y + "?" + new URLSearchParams(k).toString(),
3330
+ const b = await fetch(
3331
+ d + "?" + new URLSearchParams(Je).toString(),
3197
3332
  {
3198
3333
  method: e,
3199
3334
  headers: {
3200
3335
  Accept: "application/json",
3201
3336
  ...o && { "Content-Type": o },
3202
- ...this.useBearer && { Authorization: `Bearer ${m}` }
3337
+ ...this.useBearer && { Authorization: `Bearer ${E}` }
3203
3338
  },
3204
- ...i && { body: i }
3339
+ ...r && { body: r }
3205
3340
  }
3206
3341
  );
3207
- if (!A.ok) {
3208
- const O = await A.text().then((Me) => Me).catch(() => "");
3209
- throw new Ut(
3210
- A.status,
3211
- A.statusText,
3212
- O
3342
+ if (!b.ok) {
3343
+ const C = await b.text().then((D) => D).catch(() => "");
3344
+ throw new _e(
3345
+ b.status,
3346
+ b.statusText,
3347
+ C,
3348
+ Kt(b)
3213
3349
  );
3214
3350
  }
3215
- return l === "blob" ? await A.blob() : A.json().then((O) => O).catch(() => {
3351
+ return l === "blob" ? await b.blob() : b.json().then((C) => C).catch(() => {
3216
3352
  });
3217
- } catch (A) {
3218
- let O = h ?? this.retries;
3219
- if (O)
3220
- return O = O - 1, await c(this, a, u).call(this, e, t, {
3353
+ } catch (b) {
3354
+ const C = h ?? this.retries;
3355
+ if (C > 0 && Wt(b)) {
3356
+ const D = y ?? 0;
3357
+ return await Yt(Xt(b, D)), await c(this, a, u).call(this, e, t, {
3221
3358
  ...s,
3222
- retries: O
3359
+ retries: C - 1,
3360
+ retryAttempt: D + 1
3223
3361
  });
3224
- throw A;
3362
+ }
3363
+ throw b;
3225
3364
  }
3226
- }, C = async function(e, t) {
3227
- const { query: s } = t || {}, i = c(this, a, he).call(this, e), r = await this.resolveAccessToken(), o = {
3365
+ }, $ = async function(e, t) {
3366
+ const { query: s } = t || {}, r = c(this, a, le).call(this, e), i = await this.resolveAccessToken(), o = {
3228
3367
  ...s,
3229
- ...this.useBearer ? {} : { accessToken: r }
3368
+ ...this.useBearer ? {} : { accessToken: i }
3230
3369
  };
3231
3370
  return await fetch(
3232
- i + "?" + new URLSearchParams(o).toString(),
3371
+ r + "?" + new URLSearchParams(o).toString(),
3233
3372
  {
3234
3373
  method: "GET",
3235
3374
  ...this.useBearer && {
3236
- headers: { Authorization: `Bearer ${r}` }
3375
+ headers: { Authorization: `Bearer ${i}` }
3237
3376
  }
3238
3377
  }
3239
3378
  );
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`, {
3379
+ }, q = async function(e, t) {
3380
+ if (!e.length) return [];
3381
+ const s = [];
3382
+ for (let i = 0; i < e.length; i += Re)
3383
+ s.push(e.slice(i, i + Re));
3384
+ return (await Promise.all(s.map(t))).flat();
3385
+ }, G = async function(e, t) {
3386
+ const { versionTag: s, withDraft: r } = t || {};
3387
+ return await c(this, a, $).call(this, `${f}/${e}/download`, {
3243
3388
  query: {
3244
3389
  ...s && { versionTag: s },
3245
- ...i && { withDraft: i }
3390
+ ...r && { withDraft: r }
3246
3391
  }
3247
3392
  });
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, {
3393
+ }, J = async function(e, t, s) {
3394
+ const { name: r, versionTag: i, parentFolderId: o, projectId: h, file: l, metadata: y } = e, d = new FormData();
3395
+ 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, {
3251
3396
  body: d
3252
3397
  });
3253
- }, ue = async function(e, t, s) {
3254
- const { name: i, versionTag: r, parentFolderId: o, file: h, metadata: l } = t;
3398
+ }, fe = async function(e, t, s) {
3399
+ const { name: r, versionTag: i, parentFolderId: o, file: h, metadata: l } = t;
3255
3400
  let y, d;
3256
3401
  if (h) {
3257
3402
  const m = new FormData();
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`, {
3403
+ 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`, {
3259
3404
  body: m
3260
3405
  });
3261
3406
  }
3262
- if (i || o) {
3407
+ if (r || o) {
3263
3408
  const m = {
3264
- ...i && { name: i },
3409
+ ...r && { name: r },
3265
3410
  ...o && { folderId: o }
3266
- }, k = JSON.stringify(m);
3411
+ }, E = JSON.stringify(m);
3267
3412
  y = await c(this, a, u).call(this, "PUT", `${f}/${e}`, {
3268
- body: k,
3413
+ body: E,
3269
3414
  contentType: "application/json"
3270
3415
  });
3271
3416
  }
3272
3417
  return { item: y, version: d };
3273
- }, le = async function(e, t) {
3418
+ }, pe = async function(e, t) {
3274
3419
  const { showVersions: s = !1 } = t || {};
3275
3420
  return await c(this, a, u).call(this, "GET", `${f}/${e}`, {
3276
3421
  query: { showVersions: s }
3277
3422
  });
3278
- }, Fe = function(e) {
3423
+ }, Ge = function(e) {
3279
3424
  return e && Object.entries(e).filter(([, t]) => t !== void 0).reduce(
3280
- (t, [s, i]) => (t[s] = i, t),
3425
+ (t, [s, r]) => (t[s] = r, t),
3281
3426
  {}
3282
3427
  );
3283
3428
  };
3284
- let ce = ge;
3429
+ let ue = be;
3285
3430
  const B = "project", N = "notifications";
3286
3431
  var x;
3287
- const we = class we extends ce {
3432
+ const Te = class Te extends ue {
3288
3433
  /**
3289
3434
  * @param token - A bearer JWT, OR a function returning the current JWT
3290
3435
  * (sync or async). When a function is passed, it's invoked before every
@@ -3293,13 +3438,13 @@ const we = class we extends ce {
3293
3438
  * @param props - Optional client configuration. `useBearer` is forced to
3294
3439
  * `true` and cannot be overridden.
3295
3440
  */
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);
3441
+ constructor(t, s, r) {
3442
+ super(typeof t == "string" ? t : "", s, { ...r, useBearer: !0 });
3443
+ z(this, x);
3444
+ typeof t == "function" && ve(this, x, t);
3300
3445
  }
3301
3446
  async resolveAccessToken() {
3302
- return K(this, x) ? await K(this, x).call(this) : super.resolveAccessToken();
3447
+ return X(this, x) ? await X(this, x).call(this) : super.resolveAccessToken();
3303
3448
  }
3304
3449
  /**
3305
3450
  * Creates a client from the platform context injected into
@@ -3308,8 +3453,8 @@ const we = class we extends ce {
3308
3453
  * carries a fresh JWT on every navigation.
3309
3454
  */
3310
3455
  static fromPlatformContext(t) {
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;
3456
+ const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, r = new Te(s.accessToken, s.apiUrl, t);
3457
+ return r.context = s, r;
3313
3458
  }
3314
3459
  // ─── Projects (JWT-only backend routes) ──────────────────────────
3315
3460
  /**
@@ -3469,12 +3614,12 @@ const we = class we extends ce {
3469
3614
  * });
3470
3615
  * ```
3471
3616
  */
3472
- async subscribeToAutomation(t, s, i) {
3617
+ async subscribeToAutomation(t, s, r) {
3473
3618
  return await this.request(
3474
3619
  "POST",
3475
3620
  `${B}/${t}/events/hooks/${s}/subscription`,
3476
3621
  {
3477
- body: JSON.stringify(i ?? {}),
3622
+ body: JSON.stringify(r ?? {}),
3478
3623
  contentType: "application/json"
3479
3624
  }
3480
3625
  );
@@ -3486,12 +3631,12 @@ const we = class we extends ce {
3486
3631
  * Throws if the user is not subscribed; use {@link subscribeToAutomation}
3487
3632
  * to create one.
3488
3633
  */
3489
- async updateAutomationSubscription(t, s, i) {
3634
+ async updateAutomationSubscription(t, s, r) {
3490
3635
  return await this.request(
3491
3636
  "PATCH",
3492
3637
  `${B}/${t}/events/hooks/${s}/subscription`,
3493
3638
  {
3494
- body: JSON.stringify(i),
3639
+ body: JSON.stringify(r),
3495
3640
  contentType: "application/json"
3496
3641
  }
3497
3642
  );
@@ -3523,39 +3668,40 @@ const we = class we extends ce {
3523
3668
  * ```
3524
3669
  */
3525
3670
  async onNotification(t) {
3526
- const s = await this.resolveAccessToken(), i = q(
3671
+ const s = await this.resolveAccessToken(), r = U(
3527
3672
  `${this.socketOrigin}/notifications?accessToken=${encodeURIComponent(s)}`,
3528
3673
  { transports: ["websocket"] }
3529
3674
  );
3530
- return i.on(
3675
+ return r.on(
3531
3676
  "notification.created",
3532
- (r) => t({ type: "created", id: r == null ? void 0 : r.id })
3533
- ), i.on(
3677
+ (i) => t({ type: "created", id: i == null ? void 0 : i.id })
3678
+ ), r.on(
3534
3679
  "notification.read",
3535
- (r) => t({ type: "read", id: r == null ? void 0 : r.id })
3536
- ), i.on(
3680
+ (i) => t({ type: "read", id: i == null ? void 0 : i.id })
3681
+ ), r.on(
3537
3682
  "notifications.allRead",
3538
- (r) => t({ type: "allRead", batch: r == null ? void 0 : r.batch })
3539
- ), () => i.disconnect();
3683
+ (i) => t({ type: "allRead", batch: i == null ? void 0 : i.batch })
3684
+ ), () => r.disconnect();
3540
3685
  }
3541
3686
  };
3542
3687
  x = new WeakMap();
3543
- let Oe = we;
3544
- const Vt = {
3688
+ let Be = Te;
3689
+ const Zt = {
3545
3690
  MAX_FIELDS: 200,
3546
3691
  MAX_KEY_LENGTH: 50,
3547
3692
  MAX_VALUE_LENGTH: 50
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" };
3693
+ }, es = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, ts = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, ss = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, ns = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" }, rs = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, is = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, os = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
3549
3694
  export {
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
3695
+ es as CDEManager,
3696
+ ts as ClashesManager,
3697
+ ue as EngineServicesClient,
3698
+ ss as FileList,
3699
+ ns as GitHistoryManager,
3700
+ rs as HelloWorld,
3701
+ Zt as METADATA_LIMITS,
3702
+ Be as PlatformClient,
3703
+ _e as RequestError,
3704
+ Re as STORAGE_BATCH_MAX,
3705
+ is as TopicsManager,
3706
+ os as UIManager
3561
3707
  };