sshclient-wasm 0.1.3 → 0.1.5

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.
@@ -0,0 +1,1935 @@
1
+ class WebSocketTransport {
2
+ constructor(t, n, l) {
3
+ this.ws = null, this.callbacks = {}, this.id = t, this.url = n, this.protocols = l;
4
+ }
5
+ async connect() {
6
+ return new Promise((t, n) => {
7
+ try {
8
+ this.ws = new WebSocket(this.url, this.protocols), this.ws.binaryType = "arraybuffer", this.ws.onopen = () => {
9
+ t();
10
+ }, this.ws.onerror = (l) => {
11
+ const r = new Error("WebSocket error");
12
+ this.onError && this.onError(r), n(r);
13
+ }, this.ws.onmessage = (l) => {
14
+ if (l.data instanceof ArrayBuffer) {
15
+ const r = new Uint8Array(l.data);
16
+ this.onData && this.onData(r);
17
+ }
18
+ }, this.ws.onclose = () => {
19
+ this.onClose && this.onClose();
20
+ };
21
+ } catch (l) {
22
+ n(l);
23
+ }
24
+ });
25
+ }
26
+ async disconnect() {
27
+ this.ws && (this.ws.close(), this.ws = null);
28
+ }
29
+ async send(t) {
30
+ if (!this.ws || this.ws.readyState !== WebSocket.OPEN)
31
+ throw new Error("WebSocket is not connected");
32
+ this.ws.send(t.buffer);
33
+ }
34
+ setCallbacks(t) {
35
+ this.callbacks = t;
36
+ }
37
+ }
38
+ class CustomTransport {
39
+ constructor(t, n, l, r) {
40
+ this.isConnected = !1, this.id = t, this.connectImpl = n, this.disconnectImpl = l, this.sendImpl = r;
41
+ }
42
+ async connect() {
43
+ this.connectImpl && await this.connectImpl(), this.isConnected = !0;
44
+ }
45
+ async disconnect() {
46
+ this.disconnectImpl && await this.disconnectImpl(), this.isConnected = !1, this.onClose && this.onClose();
47
+ }
48
+ async send(t) {
49
+ if (!this.isConnected)
50
+ throw new Error("Transport is not connected");
51
+ this.sendImpl && await this.sendImpl(t);
52
+ }
53
+ // Method to inject received data
54
+ injectData(t) {
55
+ this.onData && this.onData(t);
56
+ }
57
+ }
58
+ class TransportManager {
59
+ constructor() {
60
+ this.transports = /* @__PURE__ */ new Map();
61
+ }
62
+ static getInstance() {
63
+ return TransportManager.instance || (TransportManager.instance = new TransportManager()), TransportManager.instance;
64
+ }
65
+ setWasmInstance(t) {
66
+ this.wasmInstance = t;
67
+ }
68
+ async createTransport(t) {
69
+ if (!this.wasmInstance)
70
+ throw new Error("WASM instance not set");
71
+ console.log("Creating transport with ID:", t.id), console.log("WASM instance available:", !!this.wasmInstance), console.log(
72
+ "WASM createTransport function:",
73
+ typeof this.wasmInstance.createTransport
74
+ );
75
+ const n = {
76
+ onWrite: (l) => {
77
+ t.send(l).catch((r) => {
78
+ t.onError && t.onError(r);
79
+ });
80
+ },
81
+ onClose: () => {
82
+ t.disconnect().catch(console.error);
83
+ }
84
+ };
85
+ try {
86
+ const l = this.wasmInstance.createTransport(t.id, n);
87
+ console.log("WASM createTransport result:", l);
88
+ } catch (l) {
89
+ throw console.error("Error calling WASM createTransport:", l), l;
90
+ }
91
+ t.onData = (l) => {
92
+ this.wasmInstance.injectTransportData(t.id, l);
93
+ }, this.transports.set(t.id, t);
94
+ }
95
+ async closeTransport(t) {
96
+ const n = this.transports.get(t);
97
+ n && (await n.disconnect(), this.wasmInstance && this.wasmInstance.closeTransport(t), this.transports.delete(t));
98
+ }
99
+ getTransport(t) {
100
+ return this.transports.get(t);
101
+ }
102
+ }
103
+ var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, indexMinimal = {}, minimal$1 = {}, aspromise = asPromise;
104
+ function asPromise(o, t) {
105
+ for (var n = new Array(arguments.length - 1), l = 0, r = 2, a = !0; r < arguments.length; )
106
+ n[l++] = arguments[r++];
107
+ return new Promise(function(i, s) {
108
+ n[l] = function(u) {
109
+ if (a)
110
+ if (a = !1, u)
111
+ s(u);
112
+ else {
113
+ for (var f = new Array(arguments.length - 1), d = 0; d < f.length; )
114
+ f[d++] = arguments[d];
115
+ i.apply(null, f);
116
+ }
117
+ };
118
+ try {
119
+ o.apply(t || null, n);
120
+ } catch (c) {
121
+ a && (a = !1, s(c));
122
+ }
123
+ });
124
+ }
125
+ var base64$1 = {};
126
+ (function(o) {
127
+ var t = o;
128
+ t.length = function(i) {
129
+ var s = i.length;
130
+ if (!s)
131
+ return 0;
132
+ for (var c = 0; --s % 4 > 1 && i.charAt(s) === "="; )
133
+ ++c;
134
+ return Math.ceil(i.length * 3) / 4 - c;
135
+ };
136
+ for (var n = new Array(64), l = new Array(123), r = 0; r < 64; )
137
+ l[n[r] = r < 26 ? r + 65 : r < 52 ? r + 71 : r < 62 ? r - 4 : r - 59 | 43] = r++;
138
+ t.encode = function(i, s, c) {
139
+ for (var u = null, f = [], d = 0, p = 0, h; s < c; ) {
140
+ var y = i[s++];
141
+ switch (p) {
142
+ case 0:
143
+ f[d++] = n[y >> 2], h = (y & 3) << 4, p = 1;
144
+ break;
145
+ case 1:
146
+ f[d++] = n[h | y >> 4], h = (y & 15) << 2, p = 2;
147
+ break;
148
+ case 2:
149
+ f[d++] = n[h | y >> 6], f[d++] = n[y & 63], p = 0;
150
+ break;
151
+ }
152
+ d > 8191 && ((u || (u = [])).push(String.fromCharCode.apply(String, f)), d = 0);
153
+ }
154
+ return p && (f[d++] = n[h], f[d++] = 61, p === 1 && (f[d++] = 61)), u ? (d && u.push(String.fromCharCode.apply(String, f.slice(0, d))), u.join("")) : String.fromCharCode.apply(String, f.slice(0, d));
155
+ };
156
+ var a = "invalid encoding";
157
+ t.decode = function(i, s, c) {
158
+ for (var u = c, f = 0, d, p = 0; p < i.length; ) {
159
+ var h = i.charCodeAt(p++);
160
+ if (h === 61 && f > 1)
161
+ break;
162
+ if ((h = l[h]) === void 0)
163
+ throw Error(a);
164
+ switch (f) {
165
+ case 0:
166
+ d = h, f = 1;
167
+ break;
168
+ case 1:
169
+ s[c++] = d << 2 | (h & 48) >> 4, d = h, f = 2;
170
+ break;
171
+ case 2:
172
+ s[c++] = (d & 15) << 4 | (h & 60) >> 2, d = h, f = 3;
173
+ break;
174
+ case 3:
175
+ s[c++] = (d & 3) << 6 | h, f = 0;
176
+ break;
177
+ }
178
+ }
179
+ if (f === 1)
180
+ throw Error(a);
181
+ return c - u;
182
+ }, t.test = function(i) {
183
+ return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(i);
184
+ };
185
+ })(base64$1);
186
+ var eventemitter = EventEmitter;
187
+ function EventEmitter() {
188
+ this._listeners = {};
189
+ }
190
+ EventEmitter.prototype.on = function(t, n, l) {
191
+ return (this._listeners[t] || (this._listeners[t] = [])).push({
192
+ fn: n,
193
+ ctx: l || this
194
+ }), this;
195
+ };
196
+ EventEmitter.prototype.off = function(t, n) {
197
+ if (t === void 0)
198
+ this._listeners = {};
199
+ else if (n === void 0)
200
+ this._listeners[t] = [];
201
+ else
202
+ for (var l = this._listeners[t], r = 0; r < l.length; )
203
+ l[r].fn === n ? l.splice(r, 1) : ++r;
204
+ return this;
205
+ };
206
+ EventEmitter.prototype.emit = function(t) {
207
+ var n = this._listeners[t];
208
+ if (n) {
209
+ for (var l = [], r = 1; r < arguments.length; )
210
+ l.push(arguments[r++]);
211
+ for (r = 0; r < n.length; )
212
+ n[r].fn.apply(n[r++].ctx, l);
213
+ }
214
+ return this;
215
+ };
216
+ var float = factory(factory);
217
+ function factory(o) {
218
+ return typeof Float32Array < "u" ? (function() {
219
+ var t = new Float32Array([-0]), n = new Uint8Array(t.buffer), l = n[3] === 128;
220
+ function r(s, c, u) {
221
+ t[0] = s, c[u] = n[0], c[u + 1] = n[1], c[u + 2] = n[2], c[u + 3] = n[3];
222
+ }
223
+ function a(s, c, u) {
224
+ t[0] = s, c[u] = n[3], c[u + 1] = n[2], c[u + 2] = n[1], c[u + 3] = n[0];
225
+ }
226
+ o.writeFloatLE = l ? r : a, o.writeFloatBE = l ? a : r;
227
+ function e(s, c) {
228
+ return n[0] = s[c], n[1] = s[c + 1], n[2] = s[c + 2], n[3] = s[c + 3], t[0];
229
+ }
230
+ function i(s, c) {
231
+ return n[3] = s[c], n[2] = s[c + 1], n[1] = s[c + 2], n[0] = s[c + 3], t[0];
232
+ }
233
+ o.readFloatLE = l ? e : i, o.readFloatBE = l ? i : e;
234
+ })() : (function() {
235
+ function t(l, r, a, e) {
236
+ var i = r < 0 ? 1 : 0;
237
+ if (i && (r = -r), r === 0)
238
+ l(1 / r > 0 ? (
239
+ /* positive */
240
+ 0
241
+ ) : (
242
+ /* negative 0 */
243
+ 2147483648
244
+ ), a, e);
245
+ else if (isNaN(r))
246
+ l(2143289344, a, e);
247
+ else if (r > 34028234663852886e22)
248
+ l((i << 31 | 2139095040) >>> 0, a, e);
249
+ else if (r < 11754943508222875e-54)
250
+ l((i << 31 | Math.round(r / 1401298464324817e-60)) >>> 0, a, e);
251
+ else {
252
+ var s = Math.floor(Math.log(r) / Math.LN2), c = Math.round(r * Math.pow(2, -s) * 8388608) & 8388607;
253
+ l((i << 31 | s + 127 << 23 | c) >>> 0, a, e);
254
+ }
255
+ }
256
+ o.writeFloatLE = t.bind(null, writeUintLE), o.writeFloatBE = t.bind(null, writeUintBE);
257
+ function n(l, r, a) {
258
+ var e = l(r, a), i = (e >> 31) * 2 + 1, s = e >>> 23 & 255, c = e & 8388607;
259
+ return s === 255 ? c ? NaN : i * (1 / 0) : s === 0 ? i * 1401298464324817e-60 * c : i * Math.pow(2, s - 150) * (c + 8388608);
260
+ }
261
+ o.readFloatLE = n.bind(null, readUintLE), o.readFloatBE = n.bind(null, readUintBE);
262
+ })(), typeof Float64Array < "u" ? (function() {
263
+ var t = new Float64Array([-0]), n = new Uint8Array(t.buffer), l = n[7] === 128;
264
+ function r(s, c, u) {
265
+ t[0] = s, c[u] = n[0], c[u + 1] = n[1], c[u + 2] = n[2], c[u + 3] = n[3], c[u + 4] = n[4], c[u + 5] = n[5], c[u + 6] = n[6], c[u + 7] = n[7];
266
+ }
267
+ function a(s, c, u) {
268
+ t[0] = s, c[u] = n[7], c[u + 1] = n[6], c[u + 2] = n[5], c[u + 3] = n[4], c[u + 4] = n[3], c[u + 5] = n[2], c[u + 6] = n[1], c[u + 7] = n[0];
269
+ }
270
+ o.writeDoubleLE = l ? r : a, o.writeDoubleBE = l ? a : r;
271
+ function e(s, c) {
272
+ return n[0] = s[c], n[1] = s[c + 1], n[2] = s[c + 2], n[3] = s[c + 3], n[4] = s[c + 4], n[5] = s[c + 5], n[6] = s[c + 6], n[7] = s[c + 7], t[0];
273
+ }
274
+ function i(s, c) {
275
+ return n[7] = s[c], n[6] = s[c + 1], n[5] = s[c + 2], n[4] = s[c + 3], n[3] = s[c + 4], n[2] = s[c + 5], n[1] = s[c + 6], n[0] = s[c + 7], t[0];
276
+ }
277
+ o.readDoubleLE = l ? e : i, o.readDoubleBE = l ? i : e;
278
+ })() : (function() {
279
+ function t(l, r, a, e, i, s) {
280
+ var c = e < 0 ? 1 : 0;
281
+ if (c && (e = -e), e === 0)
282
+ l(0, i, s + r), l(1 / e > 0 ? (
283
+ /* positive */
284
+ 0
285
+ ) : (
286
+ /* negative 0 */
287
+ 2147483648
288
+ ), i, s + a);
289
+ else if (isNaN(e))
290
+ l(0, i, s + r), l(2146959360, i, s + a);
291
+ else if (e > 17976931348623157e292)
292
+ l(0, i, s + r), l((c << 31 | 2146435072) >>> 0, i, s + a);
293
+ else {
294
+ var u;
295
+ if (e < 22250738585072014e-324)
296
+ u = e / 5e-324, l(u >>> 0, i, s + r), l((c << 31 | u / 4294967296) >>> 0, i, s + a);
297
+ else {
298
+ var f = Math.floor(Math.log(e) / Math.LN2);
299
+ f === 1024 && (f = 1023), u = e * Math.pow(2, -f), l(u * 4503599627370496 >>> 0, i, s + r), l((c << 31 | f + 1023 << 20 | u * 1048576 & 1048575) >>> 0, i, s + a);
300
+ }
301
+ }
302
+ }
303
+ o.writeDoubleLE = t.bind(null, writeUintLE, 0, 4), o.writeDoubleBE = t.bind(null, writeUintBE, 4, 0);
304
+ function n(l, r, a, e, i) {
305
+ var s = l(e, i + r), c = l(e, i + a), u = (c >> 31) * 2 + 1, f = c >>> 20 & 2047, d = 4294967296 * (c & 1048575) + s;
306
+ return f === 2047 ? d ? NaN : u * (1 / 0) : f === 0 ? u * 5e-324 * d : u * Math.pow(2, f - 1075) * (d + 4503599627370496);
307
+ }
308
+ o.readDoubleLE = n.bind(null, readUintLE, 0, 4), o.readDoubleBE = n.bind(null, readUintBE, 4, 0);
309
+ })(), o;
310
+ }
311
+ function writeUintLE(o, t, n) {
312
+ t[n] = o & 255, t[n + 1] = o >>> 8 & 255, t[n + 2] = o >>> 16 & 255, t[n + 3] = o >>> 24;
313
+ }
314
+ function writeUintBE(o, t, n) {
315
+ t[n] = o >>> 24, t[n + 1] = o >>> 16 & 255, t[n + 2] = o >>> 8 & 255, t[n + 3] = o & 255;
316
+ }
317
+ function readUintLE(o, t) {
318
+ return (o[t] | o[t + 1] << 8 | o[t + 2] << 16 | o[t + 3] << 24) >>> 0;
319
+ }
320
+ function readUintBE(o, t) {
321
+ return (o[t] << 24 | o[t + 1] << 16 | o[t + 2] << 8 | o[t + 3]) >>> 0;
322
+ }
323
+ var inquire_1 = inquire;
324
+ function inquire(moduleName) {
325
+ try {
326
+ var mod = eval("quire".replace(/^/, "re"))(moduleName);
327
+ if (mod && (mod.length || Object.keys(mod).length))
328
+ return mod;
329
+ } catch (o) {
330
+ }
331
+ return null;
332
+ }
333
+ var utf8$2 = {};
334
+ (function(o) {
335
+ var t = o;
336
+ t.length = function(l) {
337
+ for (var r = 0, a = 0, e = 0; e < l.length; ++e)
338
+ a = l.charCodeAt(e), a < 128 ? r += 1 : a < 2048 ? r += 2 : (a & 64512) === 55296 && (l.charCodeAt(e + 1) & 64512) === 56320 ? (++e, r += 4) : r += 3;
339
+ return r;
340
+ }, t.read = function(l, r, a) {
341
+ var e = a - r;
342
+ if (e < 1)
343
+ return "";
344
+ for (var i = null, s = [], c = 0, u; r < a; )
345
+ u = l[r++], u < 128 ? s[c++] = u : u > 191 && u < 224 ? s[c++] = (u & 31) << 6 | l[r++] & 63 : u > 239 && u < 365 ? (u = ((u & 7) << 18 | (l[r++] & 63) << 12 | (l[r++] & 63) << 6 | l[r++] & 63) - 65536, s[c++] = 55296 + (u >> 10), s[c++] = 56320 + (u & 1023)) : s[c++] = (u & 15) << 12 | (l[r++] & 63) << 6 | l[r++] & 63, c > 8191 && ((i || (i = [])).push(String.fromCharCode.apply(String, s)), c = 0);
346
+ return i ? (c && i.push(String.fromCharCode.apply(String, s.slice(0, c))), i.join("")) : String.fromCharCode.apply(String, s.slice(0, c));
347
+ }, t.write = function(l, r, a) {
348
+ for (var e = a, i, s, c = 0; c < l.length; ++c)
349
+ i = l.charCodeAt(c), i < 128 ? r[a++] = i : i < 2048 ? (r[a++] = i >> 6 | 192, r[a++] = i & 63 | 128) : (i & 64512) === 55296 && ((s = l.charCodeAt(c + 1)) & 64512) === 56320 ? (i = 65536 + ((i & 1023) << 10) + (s & 1023), ++c, r[a++] = i >> 18 | 240, r[a++] = i >> 12 & 63 | 128, r[a++] = i >> 6 & 63 | 128, r[a++] = i & 63 | 128) : (r[a++] = i >> 12 | 224, r[a++] = i >> 6 & 63 | 128, r[a++] = i & 63 | 128);
350
+ return a - e;
351
+ };
352
+ })(utf8$2);
353
+ var pool_1 = pool;
354
+ function pool(o, t, n) {
355
+ var l = n || 8192, r = l >>> 1, a = null, e = l;
356
+ return function(s) {
357
+ if (s < 1 || s > r)
358
+ return o(s);
359
+ e + s > l && (a = o(l), e = 0);
360
+ var c = t.call(a, e, e += s);
361
+ return e & 7 && (e = (e | 7) + 1), c;
362
+ };
363
+ }
364
+ var longbits, hasRequiredLongbits;
365
+ function requireLongbits() {
366
+ if (hasRequiredLongbits) return longbits;
367
+ hasRequiredLongbits = 1, longbits = t;
368
+ var o = requireMinimal();
369
+ function t(a, e) {
370
+ this.lo = a >>> 0, this.hi = e >>> 0;
371
+ }
372
+ var n = t.zero = new t(0, 0);
373
+ n.toNumber = function() {
374
+ return 0;
375
+ }, n.zzEncode = n.zzDecode = function() {
376
+ return this;
377
+ }, n.length = function() {
378
+ return 1;
379
+ };
380
+ var l = t.zeroHash = "\0\0\0\0\0\0\0\0";
381
+ t.fromNumber = function(e) {
382
+ if (e === 0)
383
+ return n;
384
+ var i = e < 0;
385
+ i && (e = -e);
386
+ var s = e >>> 0, c = (e - s) / 4294967296 >>> 0;
387
+ return i && (c = ~c >>> 0, s = ~s >>> 0, ++s > 4294967295 && (s = 0, ++c > 4294967295 && (c = 0))), new t(s, c);
388
+ }, t.from = function(e) {
389
+ if (typeof e == "number")
390
+ return t.fromNumber(e);
391
+ if (o.isString(e))
392
+ if (o.Long)
393
+ e = o.Long.fromString(e);
394
+ else
395
+ return t.fromNumber(parseInt(e, 10));
396
+ return e.low || e.high ? new t(e.low >>> 0, e.high >>> 0) : n;
397
+ }, t.prototype.toNumber = function(e) {
398
+ if (!e && this.hi >>> 31) {
399
+ var i = ~this.lo + 1 >>> 0, s = ~this.hi >>> 0;
400
+ return i || (s = s + 1 >>> 0), -(i + s * 4294967296);
401
+ }
402
+ return this.lo + this.hi * 4294967296;
403
+ }, t.prototype.toLong = function(e) {
404
+ return o.Long ? new o.Long(this.lo | 0, this.hi | 0, !!e) : { low: this.lo | 0, high: this.hi | 0, unsigned: !!e };
405
+ };
406
+ var r = String.prototype.charCodeAt;
407
+ return t.fromHash = function(e) {
408
+ return e === l ? n : new t(
409
+ (r.call(e, 0) | r.call(e, 1) << 8 | r.call(e, 2) << 16 | r.call(e, 3) << 24) >>> 0,
410
+ (r.call(e, 4) | r.call(e, 5) << 8 | r.call(e, 6) << 16 | r.call(e, 7) << 24) >>> 0
411
+ );
412
+ }, t.prototype.toHash = function() {
413
+ return String.fromCharCode(
414
+ this.lo & 255,
415
+ this.lo >>> 8 & 255,
416
+ this.lo >>> 16 & 255,
417
+ this.lo >>> 24,
418
+ this.hi & 255,
419
+ this.hi >>> 8 & 255,
420
+ this.hi >>> 16 & 255,
421
+ this.hi >>> 24
422
+ );
423
+ }, t.prototype.zzEncode = function() {
424
+ var e = this.hi >> 31;
425
+ return this.hi = ((this.hi << 1 | this.lo >>> 31) ^ e) >>> 0, this.lo = (this.lo << 1 ^ e) >>> 0, this;
426
+ }, t.prototype.zzDecode = function() {
427
+ var e = -(this.lo & 1);
428
+ return this.lo = ((this.lo >>> 1 | this.hi << 31) ^ e) >>> 0, this.hi = (this.hi >>> 1 ^ e) >>> 0, this;
429
+ }, t.prototype.length = function() {
430
+ var e = this.lo, i = (this.lo >>> 28 | this.hi << 4) >>> 0, s = this.hi >>> 24;
431
+ return s === 0 ? i === 0 ? e < 16384 ? e < 128 ? 1 : 2 : e < 2097152 ? 3 : 4 : i < 16384 ? i < 128 ? 5 : 6 : i < 2097152 ? 7 : 8 : s < 128 ? 9 : 10;
432
+ }, longbits;
433
+ }
434
+ var hasRequiredMinimal;
435
+ function requireMinimal() {
436
+ return hasRequiredMinimal || (hasRequiredMinimal = 1, (function(o) {
437
+ var t = o;
438
+ t.asPromise = aspromise, t.base64 = base64$1, t.EventEmitter = eventemitter, t.float = float, t.inquire = inquire_1, t.utf8 = utf8$2, t.pool = pool_1, t.LongBits = requireLongbits(), t.isNode = !!(typeof commonjsGlobal < "u" && commonjsGlobal && commonjsGlobal.process && commonjsGlobal.process.versions && commonjsGlobal.process.versions.node), t.global = t.isNode && commonjsGlobal || typeof window < "u" && window || typeof self < "u" && self || commonjsGlobal, t.emptyArray = Object.freeze ? Object.freeze([]) : (
439
+ /* istanbul ignore next */
440
+ []
441
+ ), t.emptyObject = Object.freeze ? Object.freeze({}) : (
442
+ /* istanbul ignore next */
443
+ {}
444
+ ), t.isInteger = Number.isInteger || /* istanbul ignore next */
445
+ function(a) {
446
+ return typeof a == "number" && isFinite(a) && Math.floor(a) === a;
447
+ }, t.isString = function(a) {
448
+ return typeof a == "string" || a instanceof String;
449
+ }, t.isObject = function(a) {
450
+ return a && typeof a == "object";
451
+ }, t.isset = /**
452
+ * Checks if a property on a message is considered to be present.
453
+ * @param {Object} obj Plain object or message instance
454
+ * @param {string} prop Property name
455
+ * @returns {boolean} `true` if considered to be present, otherwise `false`
456
+ */
457
+ t.isSet = function(a, e) {
458
+ var i = a[e];
459
+ return i != null && a.hasOwnProperty(e) ? typeof i != "object" || (Array.isArray(i) ? i.length : Object.keys(i).length) > 0 : !1;
460
+ }, t.Buffer = (function() {
461
+ try {
462
+ var r = t.inquire("buffer").Buffer;
463
+ return r.prototype.utf8Write ? r : (
464
+ /* istanbul ignore next */
465
+ null
466
+ );
467
+ } catch {
468
+ return null;
469
+ }
470
+ })(), t._Buffer_from = null, t._Buffer_allocUnsafe = null, t.newBuffer = function(a) {
471
+ return typeof a == "number" ? t.Buffer ? t._Buffer_allocUnsafe(a) : new t.Array(a) : t.Buffer ? t._Buffer_from(a) : typeof Uint8Array > "u" ? a : new Uint8Array(a);
472
+ }, t.Array = typeof Uint8Array < "u" ? Uint8Array : Array, t.Long = /* istanbul ignore next */
473
+ t.global.dcodeIO && /* istanbul ignore next */
474
+ t.global.dcodeIO.Long || /* istanbul ignore next */
475
+ t.global.Long || t.inquire("long"), t.key2Re = /^true|false|0|1$/, t.key32Re = /^-?(?:0|[1-9][0-9]*)$/, t.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/, t.longToHash = function(a) {
476
+ return a ? t.LongBits.from(a).toHash() : t.LongBits.zeroHash;
477
+ }, t.longFromHash = function(a, e) {
478
+ var i = t.LongBits.fromHash(a);
479
+ return t.Long ? t.Long.fromBits(i.lo, i.hi, e) : i.toNumber(!!e);
480
+ };
481
+ function n(r, a, e) {
482
+ for (var i = Object.keys(a), s = 0; s < i.length; ++s)
483
+ (r[i[s]] === void 0 || !e) && (r[i[s]] = a[i[s]]);
484
+ return r;
485
+ }
486
+ t.merge = n, t.lcFirst = function(a) {
487
+ return a.charAt(0).toLowerCase() + a.substring(1);
488
+ };
489
+ function l(r) {
490
+ function a(e, i) {
491
+ if (!(this instanceof a))
492
+ return new a(e, i);
493
+ Object.defineProperty(this, "message", { get: function() {
494
+ return e;
495
+ } }), Error.captureStackTrace ? Error.captureStackTrace(this, a) : Object.defineProperty(this, "stack", { value: new Error().stack || "" }), i && n(this, i);
496
+ }
497
+ return a.prototype = Object.create(Error.prototype, {
498
+ constructor: {
499
+ value: a,
500
+ writable: !0,
501
+ enumerable: !1,
502
+ configurable: !0
503
+ },
504
+ name: {
505
+ get: function() {
506
+ return r;
507
+ },
508
+ set: void 0,
509
+ enumerable: !1,
510
+ // configurable: false would accurately preserve the behavior of
511
+ // the original, but I'm guessing that was not intentional.
512
+ // For an actual error subclass, this property would
513
+ // be configurable.
514
+ configurable: !0
515
+ },
516
+ toString: {
517
+ value: function() {
518
+ return this.name + ": " + this.message;
519
+ },
520
+ writable: !0,
521
+ enumerable: !1,
522
+ configurable: !0
523
+ }
524
+ }), a;
525
+ }
526
+ t.newError = l, t.ProtocolError = l("ProtocolError"), t.oneOfGetter = function(a) {
527
+ for (var e = {}, i = 0; i < a.length; ++i)
528
+ e[a[i]] = 1;
529
+ return function() {
530
+ for (var s = Object.keys(this), c = s.length - 1; c > -1; --c)
531
+ if (e[s[c]] === 1 && this[s[c]] !== void 0 && this[s[c]] !== null)
532
+ return s[c];
533
+ };
534
+ }, t.oneOfSetter = function(a) {
535
+ return function(e) {
536
+ for (var i = 0; i < a.length; ++i)
537
+ a[i] !== e && delete this[a[i]];
538
+ };
539
+ }, t.toJSONOptions = {
540
+ longs: String,
541
+ enums: String,
542
+ bytes: String,
543
+ json: !0
544
+ }, t._configure = function() {
545
+ var r = t.Buffer;
546
+ if (!r) {
547
+ t._Buffer_from = t._Buffer_allocUnsafe = null;
548
+ return;
549
+ }
550
+ t._Buffer_from = r.from !== Uint8Array.from && r.from || /* istanbul ignore next */
551
+ function(e, i) {
552
+ return new r(e, i);
553
+ }, t._Buffer_allocUnsafe = r.allocUnsafe || /* istanbul ignore next */
554
+ function(e) {
555
+ return new r(e);
556
+ };
557
+ };
558
+ })(minimal$1)), minimal$1;
559
+ }
560
+ var writer = Writer$1, util$4 = requireMinimal(), BufferWriter$1, LongBits$1 = util$4.LongBits, base64 = util$4.base64, utf8$1 = util$4.utf8;
561
+ function Op(o, t, n) {
562
+ this.fn = o, this.len = t, this.next = void 0, this.val = n;
563
+ }
564
+ function noop() {
565
+ }
566
+ function State(o) {
567
+ this.head = o.head, this.tail = o.tail, this.len = o.len, this.next = o.states;
568
+ }
569
+ function Writer$1() {
570
+ this.len = 0, this.head = new Op(noop, 0, 0), this.tail = this.head, this.states = null;
571
+ }
572
+ var create$1 = function o() {
573
+ return util$4.Buffer ? function() {
574
+ return (Writer$1.create = function() {
575
+ return new BufferWriter$1();
576
+ })();
577
+ } : function() {
578
+ return new Writer$1();
579
+ };
580
+ };
581
+ Writer$1.create = create$1();
582
+ Writer$1.alloc = function o(t) {
583
+ return new util$4.Array(t);
584
+ };
585
+ util$4.Array !== Array && (Writer$1.alloc = util$4.pool(Writer$1.alloc, util$4.Array.prototype.subarray));
586
+ Writer$1.prototype._push = function o(t, n, l) {
587
+ return this.tail = this.tail.next = new Op(t, n, l), this.len += n, this;
588
+ };
589
+ function writeByte(o, t, n) {
590
+ t[n] = o & 255;
591
+ }
592
+ function writeVarint32(o, t, n) {
593
+ for (; o > 127; )
594
+ t[n++] = o & 127 | 128, o >>>= 7;
595
+ t[n] = o;
596
+ }
597
+ function VarintOp(o, t) {
598
+ this.len = o, this.next = void 0, this.val = t;
599
+ }
600
+ VarintOp.prototype = Object.create(Op.prototype);
601
+ VarintOp.prototype.fn = writeVarint32;
602
+ Writer$1.prototype.uint32 = function o(t) {
603
+ return this.len += (this.tail = this.tail.next = new VarintOp(
604
+ (t = t >>> 0) < 128 ? 1 : t < 16384 ? 2 : t < 2097152 ? 3 : t < 268435456 ? 4 : 5,
605
+ t
606
+ )).len, this;
607
+ };
608
+ Writer$1.prototype.int32 = function o(t) {
609
+ return t < 0 ? this._push(writeVarint64, 10, LongBits$1.fromNumber(t)) : this.uint32(t);
610
+ };
611
+ Writer$1.prototype.sint32 = function o(t) {
612
+ return this.uint32((t << 1 ^ t >> 31) >>> 0);
613
+ };
614
+ function writeVarint64(o, t, n) {
615
+ for (; o.hi; )
616
+ t[n++] = o.lo & 127 | 128, o.lo = (o.lo >>> 7 | o.hi << 25) >>> 0, o.hi >>>= 7;
617
+ for (; o.lo > 127; )
618
+ t[n++] = o.lo & 127 | 128, o.lo = o.lo >>> 7;
619
+ t[n++] = o.lo;
620
+ }
621
+ Writer$1.prototype.uint64 = function o(t) {
622
+ var n = LongBits$1.from(t);
623
+ return this._push(writeVarint64, n.length(), n);
624
+ };
625
+ Writer$1.prototype.int64 = Writer$1.prototype.uint64;
626
+ Writer$1.prototype.sint64 = function o(t) {
627
+ var n = LongBits$1.from(t).zzEncode();
628
+ return this._push(writeVarint64, n.length(), n);
629
+ };
630
+ Writer$1.prototype.bool = function o(t) {
631
+ return this._push(writeByte, 1, t ? 1 : 0);
632
+ };
633
+ function writeFixed32(o, t, n) {
634
+ t[n] = o & 255, t[n + 1] = o >>> 8 & 255, t[n + 2] = o >>> 16 & 255, t[n + 3] = o >>> 24;
635
+ }
636
+ Writer$1.prototype.fixed32 = function o(t) {
637
+ return this._push(writeFixed32, 4, t >>> 0);
638
+ };
639
+ Writer$1.prototype.sfixed32 = Writer$1.prototype.fixed32;
640
+ Writer$1.prototype.fixed64 = function o(t) {
641
+ var n = LongBits$1.from(t);
642
+ return this._push(writeFixed32, 4, n.lo)._push(writeFixed32, 4, n.hi);
643
+ };
644
+ Writer$1.prototype.sfixed64 = Writer$1.prototype.fixed64;
645
+ Writer$1.prototype.float = function o(t) {
646
+ return this._push(util$4.float.writeFloatLE, 4, t);
647
+ };
648
+ Writer$1.prototype.double = function o(t) {
649
+ return this._push(util$4.float.writeDoubleLE, 8, t);
650
+ };
651
+ var writeBytes = util$4.Array.prototype.set ? function o(t, n, l) {
652
+ n.set(t, l);
653
+ } : function o(t, n, l) {
654
+ for (var r = 0; r < t.length; ++r)
655
+ n[l + r] = t[r];
656
+ };
657
+ Writer$1.prototype.bytes = function o(t) {
658
+ var n = t.length >>> 0;
659
+ if (!n)
660
+ return this._push(writeByte, 1, 0);
661
+ if (util$4.isString(t)) {
662
+ var l = Writer$1.alloc(n = base64.length(t));
663
+ base64.decode(t, l, 0), t = l;
664
+ }
665
+ return this.uint32(n)._push(writeBytes, n, t);
666
+ };
667
+ Writer$1.prototype.string = function o(t) {
668
+ var n = utf8$1.length(t);
669
+ return n ? this.uint32(n)._push(utf8$1.write, n, t) : this._push(writeByte, 1, 0);
670
+ };
671
+ Writer$1.prototype.fork = function o() {
672
+ return this.states = new State(this), this.head = this.tail = new Op(noop, 0, 0), this.len = 0, this;
673
+ };
674
+ Writer$1.prototype.reset = function o() {
675
+ return this.states ? (this.head = this.states.head, this.tail = this.states.tail, this.len = this.states.len, this.states = this.states.next) : (this.head = this.tail = new Op(noop, 0, 0), this.len = 0), this;
676
+ };
677
+ Writer$1.prototype.ldelim = function o() {
678
+ var t = this.head, n = this.tail, l = this.len;
679
+ return this.reset().uint32(l), l && (this.tail.next = t.next, this.tail = n, this.len += l), this;
680
+ };
681
+ Writer$1.prototype.finish = function o() {
682
+ for (var t = this.head.next, n = this.constructor.alloc(this.len), l = 0; t; )
683
+ t.fn(t.val, n, l), l += t.len, t = t.next;
684
+ return n;
685
+ };
686
+ Writer$1._configure = function(o) {
687
+ BufferWriter$1 = o, Writer$1.create = create$1(), BufferWriter$1._configure();
688
+ };
689
+ var writer_buffer = BufferWriter, Writer = writer;
690
+ (BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;
691
+ var util$3 = requireMinimal();
692
+ function BufferWriter() {
693
+ Writer.call(this);
694
+ }
695
+ BufferWriter._configure = function() {
696
+ BufferWriter.alloc = util$3._Buffer_allocUnsafe, BufferWriter.writeBytesBuffer = util$3.Buffer && util$3.Buffer.prototype instanceof Uint8Array && util$3.Buffer.prototype.set.name === "set" ? function(t, n, l) {
697
+ n.set(t, l);
698
+ } : function(t, n, l) {
699
+ if (t.copy)
700
+ t.copy(n, l, 0, t.length);
701
+ else for (var r = 0; r < t.length; )
702
+ n[l++] = t[r++];
703
+ };
704
+ };
705
+ BufferWriter.prototype.bytes = function o(t) {
706
+ util$3.isString(t) && (t = util$3._Buffer_from(t, "base64"));
707
+ var n = t.length >>> 0;
708
+ return this.uint32(n), n && this._push(BufferWriter.writeBytesBuffer, n, t), this;
709
+ };
710
+ function writeStringBuffer(o, t, n) {
711
+ o.length < 40 ? util$3.utf8.write(o, t, n) : t.utf8Write ? t.utf8Write(o, n) : t.write(o, n);
712
+ }
713
+ BufferWriter.prototype.string = function o(t) {
714
+ var n = util$3.Buffer.byteLength(t);
715
+ return this.uint32(n), n && this._push(writeStringBuffer, n, t), this;
716
+ };
717
+ BufferWriter._configure();
718
+ var reader = Reader$1, util$2 = requireMinimal(), BufferReader$1, LongBits = util$2.LongBits, utf8 = util$2.utf8;
719
+ function indexOutOfRange(o, t) {
720
+ return RangeError("index out of range: " + o.pos + " + " + (t || 1) + " > " + o.len);
721
+ }
722
+ function Reader$1(o) {
723
+ this.buf = o, this.pos = 0, this.len = o.length;
724
+ }
725
+ var create_array = typeof Uint8Array < "u" ? function o(t) {
726
+ if (t instanceof Uint8Array || Array.isArray(t))
727
+ return new Reader$1(t);
728
+ throw Error("illegal buffer");
729
+ } : function o(t) {
730
+ if (Array.isArray(t))
731
+ return new Reader$1(t);
732
+ throw Error("illegal buffer");
733
+ }, create = function o() {
734
+ return util$2.Buffer ? function(n) {
735
+ return (Reader$1.create = function(r) {
736
+ return util$2.Buffer.isBuffer(r) ? new BufferReader$1(r) : create_array(r);
737
+ })(n);
738
+ } : create_array;
739
+ };
740
+ Reader$1.create = create();
741
+ Reader$1.prototype._slice = util$2.Array.prototype.subarray || /* istanbul ignore next */
742
+ util$2.Array.prototype.slice;
743
+ Reader$1.prototype.uint32 = /* @__PURE__ */ (function o() {
744
+ var t = 4294967295;
745
+ return function() {
746
+ if (t = (this.buf[this.pos] & 127) >>> 0, this.buf[this.pos++] < 128 || (t = (t | (this.buf[this.pos] & 127) << 7) >>> 0, this.buf[this.pos++] < 128) || (t = (t | (this.buf[this.pos] & 127) << 14) >>> 0, this.buf[this.pos++] < 128) || (t = (t | (this.buf[this.pos] & 127) << 21) >>> 0, this.buf[this.pos++] < 128) || (t = (t | (this.buf[this.pos] & 15) << 28) >>> 0, this.buf[this.pos++] < 128)) return t;
747
+ if ((this.pos += 5) > this.len)
748
+ throw this.pos = this.len, indexOutOfRange(this, 10);
749
+ return t;
750
+ };
751
+ })();
752
+ Reader$1.prototype.int32 = function o() {
753
+ return this.uint32() | 0;
754
+ };
755
+ Reader$1.prototype.sint32 = function o() {
756
+ var t = this.uint32();
757
+ return t >>> 1 ^ -(t & 1) | 0;
758
+ };
759
+ function readLongVarint() {
760
+ var o = new LongBits(0, 0), t = 0;
761
+ if (this.len - this.pos > 4) {
762
+ for (; t < 4; ++t)
763
+ if (o.lo = (o.lo | (this.buf[this.pos] & 127) << t * 7) >>> 0, this.buf[this.pos++] < 128)
764
+ return o;
765
+ if (o.lo = (o.lo | (this.buf[this.pos] & 127) << 28) >>> 0, o.hi = (o.hi | (this.buf[this.pos] & 127) >> 4) >>> 0, this.buf[this.pos++] < 128)
766
+ return o;
767
+ t = 0;
768
+ } else {
769
+ for (; t < 3; ++t) {
770
+ if (this.pos >= this.len)
771
+ throw indexOutOfRange(this);
772
+ if (o.lo = (o.lo | (this.buf[this.pos] & 127) << t * 7) >>> 0, this.buf[this.pos++] < 128)
773
+ return o;
774
+ }
775
+ return o.lo = (o.lo | (this.buf[this.pos++] & 127) << t * 7) >>> 0, o;
776
+ }
777
+ if (this.len - this.pos > 4) {
778
+ for (; t < 5; ++t)
779
+ if (o.hi = (o.hi | (this.buf[this.pos] & 127) << t * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
780
+ return o;
781
+ } else
782
+ for (; t < 5; ++t) {
783
+ if (this.pos >= this.len)
784
+ throw indexOutOfRange(this);
785
+ if (o.hi = (o.hi | (this.buf[this.pos] & 127) << t * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
786
+ return o;
787
+ }
788
+ throw Error("invalid varint encoding");
789
+ }
790
+ Reader$1.prototype.bool = function o() {
791
+ return this.uint32() !== 0;
792
+ };
793
+ function readFixed32_end(o, t) {
794
+ return (o[t - 4] | o[t - 3] << 8 | o[t - 2] << 16 | o[t - 1] << 24) >>> 0;
795
+ }
796
+ Reader$1.prototype.fixed32 = function o() {
797
+ if (this.pos + 4 > this.len)
798
+ throw indexOutOfRange(this, 4);
799
+ return readFixed32_end(this.buf, this.pos += 4);
800
+ };
801
+ Reader$1.prototype.sfixed32 = function o() {
802
+ if (this.pos + 4 > this.len)
803
+ throw indexOutOfRange(this, 4);
804
+ return readFixed32_end(this.buf, this.pos += 4) | 0;
805
+ };
806
+ function readFixed64() {
807
+ if (this.pos + 8 > this.len)
808
+ throw indexOutOfRange(this, 8);
809
+ return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));
810
+ }
811
+ Reader$1.prototype.float = function o() {
812
+ if (this.pos + 4 > this.len)
813
+ throw indexOutOfRange(this, 4);
814
+ var t = util$2.float.readFloatLE(this.buf, this.pos);
815
+ return this.pos += 4, t;
816
+ };
817
+ Reader$1.prototype.double = function o() {
818
+ if (this.pos + 8 > this.len)
819
+ throw indexOutOfRange(this, 4);
820
+ var t = util$2.float.readDoubleLE(this.buf, this.pos);
821
+ return this.pos += 8, t;
822
+ };
823
+ Reader$1.prototype.bytes = function o() {
824
+ var t = this.uint32(), n = this.pos, l = this.pos + t;
825
+ if (l > this.len)
826
+ throw indexOutOfRange(this, t);
827
+ if (this.pos += t, Array.isArray(this.buf))
828
+ return this.buf.slice(n, l);
829
+ if (n === l) {
830
+ var r = util$2.Buffer;
831
+ return r ? r.alloc(0) : new this.buf.constructor(0);
832
+ }
833
+ return this._slice.call(this.buf, n, l);
834
+ };
835
+ Reader$1.prototype.string = function o() {
836
+ var t = this.bytes();
837
+ return utf8.read(t, 0, t.length);
838
+ };
839
+ Reader$1.prototype.skip = function o(t) {
840
+ if (typeof t == "number") {
841
+ if (this.pos + t > this.len)
842
+ throw indexOutOfRange(this, t);
843
+ this.pos += t;
844
+ } else
845
+ do
846
+ if (this.pos >= this.len)
847
+ throw indexOutOfRange(this);
848
+ while (this.buf[this.pos++] & 128);
849
+ return this;
850
+ };
851
+ Reader$1.prototype.skipType = function(o) {
852
+ switch (o) {
853
+ case 0:
854
+ this.skip();
855
+ break;
856
+ case 1:
857
+ this.skip(8);
858
+ break;
859
+ case 2:
860
+ this.skip(this.uint32());
861
+ break;
862
+ case 3:
863
+ for (; (o = this.uint32() & 7) !== 4; )
864
+ this.skipType(o);
865
+ break;
866
+ case 5:
867
+ this.skip(4);
868
+ break;
869
+ /* istanbul ignore next */
870
+ default:
871
+ throw Error("invalid wire type " + o + " at offset " + this.pos);
872
+ }
873
+ return this;
874
+ };
875
+ Reader$1._configure = function(o) {
876
+ BufferReader$1 = o, Reader$1.create = create(), BufferReader$1._configure();
877
+ var t = util$2.Long ? "toLong" : (
878
+ /* istanbul ignore next */
879
+ "toNumber"
880
+ );
881
+ util$2.merge(Reader$1.prototype, {
882
+ int64: function() {
883
+ return readLongVarint.call(this)[t](!1);
884
+ },
885
+ uint64: function() {
886
+ return readLongVarint.call(this)[t](!0);
887
+ },
888
+ sint64: function() {
889
+ return readLongVarint.call(this).zzDecode()[t](!1);
890
+ },
891
+ fixed64: function() {
892
+ return readFixed64.call(this)[t](!0);
893
+ },
894
+ sfixed64: function() {
895
+ return readFixed64.call(this)[t](!1);
896
+ }
897
+ });
898
+ };
899
+ var reader_buffer = BufferReader, Reader = reader;
900
+ (BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;
901
+ var util$1 = requireMinimal();
902
+ function BufferReader(o) {
903
+ Reader.call(this, o);
904
+ }
905
+ BufferReader._configure = function() {
906
+ util$1.Buffer && (BufferReader.prototype._slice = util$1.Buffer.prototype.slice);
907
+ };
908
+ BufferReader.prototype.string = function o() {
909
+ var t = this.uint32();
910
+ return this.buf.utf8Slice ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + t, this.len)) : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + t, this.len));
911
+ };
912
+ BufferReader._configure();
913
+ var rpc = {}, service = Service, util = requireMinimal();
914
+ (Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;
915
+ function Service(o, t, n) {
916
+ if (typeof o != "function")
917
+ throw TypeError("rpcImpl must be a function");
918
+ util.EventEmitter.call(this), this.rpcImpl = o, this.requestDelimited = !!t, this.responseDelimited = !!n;
919
+ }
920
+ Service.prototype.rpcCall = function o(t, n, l, r, a) {
921
+ if (!r)
922
+ throw TypeError("request must be specified");
923
+ var e = this;
924
+ if (!a)
925
+ return util.asPromise(o, e, t, n, l, r);
926
+ if (!e.rpcImpl) {
927
+ setTimeout(function() {
928
+ a(Error("already ended"));
929
+ }, 0);
930
+ return;
931
+ }
932
+ try {
933
+ return e.rpcImpl(
934
+ t,
935
+ n[e.requestDelimited ? "encodeDelimited" : "encode"](r).finish(),
936
+ function(s, c) {
937
+ if (s)
938
+ return e.emit("error", s, t), a(s);
939
+ if (c === null) {
940
+ e.end(
941
+ /* endedByRPC */
942
+ !0
943
+ );
944
+ return;
945
+ }
946
+ if (!(c instanceof l))
947
+ try {
948
+ c = l[e.responseDelimited ? "decodeDelimited" : "decode"](c);
949
+ } catch (u) {
950
+ return e.emit("error", u, t), a(u);
951
+ }
952
+ return e.emit("data", c, t), a(null, c);
953
+ }
954
+ );
955
+ } catch (i) {
956
+ e.emit("error", i, t), setTimeout(function() {
957
+ a(i);
958
+ }, 0);
959
+ return;
960
+ }
961
+ };
962
+ Service.prototype.end = function o(t) {
963
+ return this.rpcImpl && (t || this.rpcImpl(null, null, null), this.rpcImpl = null, this.emit("end").off()), this;
964
+ };
965
+ (function(o) {
966
+ var t = o;
967
+ t.Service = service;
968
+ })(rpc);
969
+ var roots = {};
970
+ (function(o) {
971
+ var t = o;
972
+ t.build = "minimal", t.Writer = writer, t.BufferWriter = writer_buffer, t.Reader = reader, t.BufferReader = reader_buffer, t.util = requireMinimal(), t.rpc = rpc, t.roots = roots, t.configure = n;
973
+ function n() {
974
+ t.util._configure(), t.Writer._configure(t.BufferWriter), t.Reader._configure(t.BufferReader);
975
+ }
976
+ n();
977
+ })(indexMinimal);
978
+ var minimal = indexMinimal;
979
+ const $Reader = minimal.Reader, $Writer = minimal.Writer, $util = minimal.util, $root = minimal.roots.default || (minimal.roots.default = {}), com = $root.com = (() => {
980
+ const o = {};
981
+ return o.amazonaws = (function() {
982
+ const t = {};
983
+ return t.iot = (function() {
984
+ const n = {};
985
+ return n.securedtunneling = (function() {
986
+ const l = {};
987
+ return l.ProtocolV1Message = (function() {
988
+ function r(a) {
989
+ if (a)
990
+ for (let e = Object.keys(a), i = 0; i < e.length; ++i)
991
+ a[e[i]] != null && (this[e[i]] = a[e[i]]);
992
+ }
993
+ return r.prototype.type = 0, r.prototype.streamId = 0, r.prototype.ignorable = !1, r.prototype.payload = $util.newBuffer([]), r.create = function(e) {
994
+ return new r(e);
995
+ }, r.encode = function(e, i) {
996
+ return i || (i = $Writer.create()), e.type != null && Object.hasOwnProperty.call(e, "type") && i.uint32(
997
+ /* id 1, wireType 0 =*/
998
+ 8
999
+ ).int32(e.type), e.streamId != null && Object.hasOwnProperty.call(e, "streamId") && i.uint32(
1000
+ /* id 2, wireType 0 =*/
1001
+ 16
1002
+ ).int32(e.streamId), e.ignorable != null && Object.hasOwnProperty.call(e, "ignorable") && i.uint32(
1003
+ /* id 3, wireType 0 =*/
1004
+ 24
1005
+ ).bool(e.ignorable), e.payload != null && Object.hasOwnProperty.call(e, "payload") && i.uint32(
1006
+ /* id 4, wireType 2 =*/
1007
+ 34
1008
+ ).bytes(e.payload), i;
1009
+ }, r.encodeDelimited = function(e, i) {
1010
+ return this.encode(e, i).ldelim();
1011
+ }, r.decode = function(e, i, s) {
1012
+ e instanceof $Reader || (e = $Reader.create(e));
1013
+ let c = i === void 0 ? e.len : e.pos + i, u = new $root.com.amazonaws.iot.securedtunneling.ProtocolV1Message();
1014
+ for (; e.pos < c; ) {
1015
+ let f = e.uint32();
1016
+ if (f === s)
1017
+ break;
1018
+ switch (f >>> 3) {
1019
+ case 1: {
1020
+ u.type = e.int32();
1021
+ break;
1022
+ }
1023
+ case 2: {
1024
+ u.streamId = e.int32();
1025
+ break;
1026
+ }
1027
+ case 3: {
1028
+ u.ignorable = e.bool();
1029
+ break;
1030
+ }
1031
+ case 4: {
1032
+ u.payload = e.bytes();
1033
+ break;
1034
+ }
1035
+ default:
1036
+ e.skipType(f & 7);
1037
+ break;
1038
+ }
1039
+ }
1040
+ return u;
1041
+ }, r.decodeDelimited = function(e) {
1042
+ return e instanceof $Reader || (e = new $Reader(e)), this.decode(e, e.uint32());
1043
+ }, r.verify = function(e) {
1044
+ if (typeof e != "object" || e === null)
1045
+ return "object expected";
1046
+ if (e.type != null && e.hasOwnProperty("type"))
1047
+ switch (e.type) {
1048
+ default:
1049
+ return "type: enum value expected";
1050
+ case 0:
1051
+ case 1:
1052
+ case 2:
1053
+ case 3:
1054
+ break;
1055
+ }
1056
+ return e.streamId != null && e.hasOwnProperty("streamId") && !$util.isInteger(e.streamId) ? "streamId: integer expected" : e.ignorable != null && e.hasOwnProperty("ignorable") && typeof e.ignorable != "boolean" ? "ignorable: boolean expected" : e.payload != null && e.hasOwnProperty("payload") && !(e.payload && typeof e.payload.length == "number" || $util.isString(e.payload)) ? "payload: buffer expected" : null;
1057
+ }, r.fromObject = function(e) {
1058
+ if (e instanceof $root.com.amazonaws.iot.securedtunneling.ProtocolV1Message)
1059
+ return e;
1060
+ let i = new $root.com.amazonaws.iot.securedtunneling.ProtocolV1Message();
1061
+ switch (e.type) {
1062
+ default:
1063
+ if (typeof e.type == "number") {
1064
+ i.type = e.type;
1065
+ break;
1066
+ }
1067
+ break;
1068
+ case "UNKNOWN":
1069
+ case 0:
1070
+ i.type = 0;
1071
+ break;
1072
+ case "DATA":
1073
+ case 1:
1074
+ i.type = 1;
1075
+ break;
1076
+ case "STREAM_START":
1077
+ case 2:
1078
+ i.type = 2;
1079
+ break;
1080
+ case "STREAM_END":
1081
+ case 3:
1082
+ i.type = 3;
1083
+ break;
1084
+ }
1085
+ return e.streamId != null && (i.streamId = e.streamId | 0), e.ignorable != null && (i.ignorable = !!e.ignorable), e.payload != null && (typeof e.payload == "string" ? $util.base64.decode(e.payload, i.payload = $util.newBuffer($util.base64.length(e.payload)), 0) : e.payload.length >= 0 && (i.payload = e.payload)), i;
1086
+ }, r.toObject = function(e, i) {
1087
+ i || (i = {});
1088
+ let s = {};
1089
+ return i.defaults && (s.type = i.enums === String ? "UNKNOWN" : 0, s.streamId = 0, s.ignorable = !1, i.bytes === String ? s.payload = "" : (s.payload = [], i.bytes !== Array && (s.payload = $util.newBuffer(s.payload)))), e.type != null && e.hasOwnProperty("type") && (s.type = i.enums === String ? $root.com.amazonaws.iot.securedtunneling.ProtocolV1Message.Type[e.type] === void 0 ? e.type : $root.com.amazonaws.iot.securedtunneling.ProtocolV1Message.Type[e.type] : e.type), e.streamId != null && e.hasOwnProperty("streamId") && (s.streamId = e.streamId), e.ignorable != null && e.hasOwnProperty("ignorable") && (s.ignorable = e.ignorable), e.payload != null && e.hasOwnProperty("payload") && (s.payload = i.bytes === String ? $util.base64.encode(e.payload, 0, e.payload.length) : i.bytes === Array ? Array.prototype.slice.call(e.payload) : e.payload), s;
1090
+ }, r.prototype.toJSON = function() {
1091
+ return this.constructor.toObject(this, minimal.util.toJSONOptions);
1092
+ }, r.getTypeUrl = function(e) {
1093
+ return e === void 0 && (e = "type.googleapis.com"), e + "/com.amazonaws.iot.securedtunneling.ProtocolV1Message";
1094
+ }, r.Type = (function() {
1095
+ const a = {}, e = Object.create(a);
1096
+ return e[a[0] = "UNKNOWN"] = 0, e[a[1] = "DATA"] = 1, e[a[2] = "STREAM_START"] = 2, e[a[3] = "STREAM_END"] = 3, e;
1097
+ })(), r;
1098
+ })(), l.ProtocolV2Message = (function() {
1099
+ function r(a) {
1100
+ if (this.availableServiceIds = [], a)
1101
+ for (let e = Object.keys(a), i = 0; i < e.length; ++i)
1102
+ a[e[i]] != null && (this[e[i]] = a[e[i]]);
1103
+ }
1104
+ return r.prototype.type = 0, r.prototype.streamId = 0, r.prototype.ignorable = !1, r.prototype.payload = $util.newBuffer([]), r.prototype.serviceId = "", r.prototype.availableServiceIds = $util.emptyArray, r.create = function(e) {
1105
+ return new r(e);
1106
+ }, r.encode = function(e, i) {
1107
+ if (i || (i = $Writer.create()), e.type != null && Object.hasOwnProperty.call(e, "type") && i.uint32(
1108
+ /* id 1, wireType 0 =*/
1109
+ 8
1110
+ ).int32(e.type), e.streamId != null && Object.hasOwnProperty.call(e, "streamId") && i.uint32(
1111
+ /* id 2, wireType 0 =*/
1112
+ 16
1113
+ ).int32(e.streamId), e.ignorable != null && Object.hasOwnProperty.call(e, "ignorable") && i.uint32(
1114
+ /* id 3, wireType 0 =*/
1115
+ 24
1116
+ ).bool(e.ignorable), e.payload != null && Object.hasOwnProperty.call(e, "payload") && i.uint32(
1117
+ /* id 4, wireType 2 =*/
1118
+ 34
1119
+ ).bytes(e.payload), e.serviceId != null && Object.hasOwnProperty.call(e, "serviceId") && i.uint32(
1120
+ /* id 5, wireType 2 =*/
1121
+ 42
1122
+ ).string(e.serviceId), e.availableServiceIds != null && e.availableServiceIds.length)
1123
+ for (let s = 0; s < e.availableServiceIds.length; ++s)
1124
+ i.uint32(
1125
+ /* id 6, wireType 2 =*/
1126
+ 50
1127
+ ).string(e.availableServiceIds[s]);
1128
+ return i;
1129
+ }, r.encodeDelimited = function(e, i) {
1130
+ return this.encode(e, i).ldelim();
1131
+ }, r.decode = function(e, i, s) {
1132
+ e instanceof $Reader || (e = $Reader.create(e));
1133
+ let c = i === void 0 ? e.len : e.pos + i, u = new $root.com.amazonaws.iot.securedtunneling.ProtocolV2Message();
1134
+ for (; e.pos < c; ) {
1135
+ let f = e.uint32();
1136
+ if (f === s)
1137
+ break;
1138
+ switch (f >>> 3) {
1139
+ case 1: {
1140
+ u.type = e.int32();
1141
+ break;
1142
+ }
1143
+ case 2: {
1144
+ u.streamId = e.int32();
1145
+ break;
1146
+ }
1147
+ case 3: {
1148
+ u.ignorable = e.bool();
1149
+ break;
1150
+ }
1151
+ case 4: {
1152
+ u.payload = e.bytes();
1153
+ break;
1154
+ }
1155
+ case 5: {
1156
+ u.serviceId = e.string();
1157
+ break;
1158
+ }
1159
+ case 6: {
1160
+ u.availableServiceIds && u.availableServiceIds.length || (u.availableServiceIds = []), u.availableServiceIds.push(e.string());
1161
+ break;
1162
+ }
1163
+ default:
1164
+ e.skipType(f & 7);
1165
+ break;
1166
+ }
1167
+ }
1168
+ return u;
1169
+ }, r.decodeDelimited = function(e) {
1170
+ return e instanceof $Reader || (e = new $Reader(e)), this.decode(e, e.uint32());
1171
+ }, r.verify = function(e) {
1172
+ if (typeof e != "object" || e === null)
1173
+ return "object expected";
1174
+ if (e.type != null && e.hasOwnProperty("type"))
1175
+ switch (e.type) {
1176
+ default:
1177
+ return "type: enum value expected";
1178
+ case 0:
1179
+ case 1:
1180
+ case 2:
1181
+ case 3:
1182
+ case 4:
1183
+ case 5:
1184
+ break;
1185
+ }
1186
+ if (e.streamId != null && e.hasOwnProperty("streamId") && !$util.isInteger(e.streamId))
1187
+ return "streamId: integer expected";
1188
+ if (e.ignorable != null && e.hasOwnProperty("ignorable") && typeof e.ignorable != "boolean")
1189
+ return "ignorable: boolean expected";
1190
+ if (e.payload != null && e.hasOwnProperty("payload") && !(e.payload && typeof e.payload.length == "number" || $util.isString(e.payload)))
1191
+ return "payload: buffer expected";
1192
+ if (e.serviceId != null && e.hasOwnProperty("serviceId") && !$util.isString(e.serviceId))
1193
+ return "serviceId: string expected";
1194
+ if (e.availableServiceIds != null && e.hasOwnProperty("availableServiceIds")) {
1195
+ if (!Array.isArray(e.availableServiceIds))
1196
+ return "availableServiceIds: array expected";
1197
+ for (let i = 0; i < e.availableServiceIds.length; ++i)
1198
+ if (!$util.isString(e.availableServiceIds[i]))
1199
+ return "availableServiceIds: string[] expected";
1200
+ }
1201
+ return null;
1202
+ }, r.fromObject = function(e) {
1203
+ if (e instanceof $root.com.amazonaws.iot.securedtunneling.ProtocolV2Message)
1204
+ return e;
1205
+ let i = new $root.com.amazonaws.iot.securedtunneling.ProtocolV2Message();
1206
+ switch (e.type) {
1207
+ default:
1208
+ if (typeof e.type == "number") {
1209
+ i.type = e.type;
1210
+ break;
1211
+ }
1212
+ break;
1213
+ case "UNKNOWN":
1214
+ case 0:
1215
+ i.type = 0;
1216
+ break;
1217
+ case "DATA":
1218
+ case 1:
1219
+ i.type = 1;
1220
+ break;
1221
+ case "STREAM_START":
1222
+ case 2:
1223
+ i.type = 2;
1224
+ break;
1225
+ case "STREAM_RESET":
1226
+ case 3:
1227
+ i.type = 3;
1228
+ break;
1229
+ case "SESSION_RESET":
1230
+ case 4:
1231
+ i.type = 4;
1232
+ break;
1233
+ case "SERVICE_IDS":
1234
+ case 5:
1235
+ i.type = 5;
1236
+ break;
1237
+ }
1238
+ if (e.streamId != null && (i.streamId = e.streamId | 0), e.ignorable != null && (i.ignorable = !!e.ignorable), e.payload != null && (typeof e.payload == "string" ? $util.base64.decode(e.payload, i.payload = $util.newBuffer($util.base64.length(e.payload)), 0) : e.payload.length >= 0 && (i.payload = e.payload)), e.serviceId != null && (i.serviceId = String(e.serviceId)), e.availableServiceIds) {
1239
+ if (!Array.isArray(e.availableServiceIds))
1240
+ throw TypeError(".com.amazonaws.iot.securedtunneling.ProtocolV2Message.availableServiceIds: array expected");
1241
+ i.availableServiceIds = [];
1242
+ for (let s = 0; s < e.availableServiceIds.length; ++s)
1243
+ i.availableServiceIds[s] = String(e.availableServiceIds[s]);
1244
+ }
1245
+ return i;
1246
+ }, r.toObject = function(e, i) {
1247
+ i || (i = {});
1248
+ let s = {};
1249
+ if ((i.arrays || i.defaults) && (s.availableServiceIds = []), i.defaults && (s.type = i.enums === String ? "UNKNOWN" : 0, s.streamId = 0, s.ignorable = !1, i.bytes === String ? s.payload = "" : (s.payload = [], i.bytes !== Array && (s.payload = $util.newBuffer(s.payload))), s.serviceId = ""), e.type != null && e.hasOwnProperty("type") && (s.type = i.enums === String ? $root.com.amazonaws.iot.securedtunneling.ProtocolV2Message.Type[e.type] === void 0 ? e.type : $root.com.amazonaws.iot.securedtunneling.ProtocolV2Message.Type[e.type] : e.type), e.streamId != null && e.hasOwnProperty("streamId") && (s.streamId = e.streamId), e.ignorable != null && e.hasOwnProperty("ignorable") && (s.ignorable = e.ignorable), e.payload != null && e.hasOwnProperty("payload") && (s.payload = i.bytes === String ? $util.base64.encode(e.payload, 0, e.payload.length) : i.bytes === Array ? Array.prototype.slice.call(e.payload) : e.payload), e.serviceId != null && e.hasOwnProperty("serviceId") && (s.serviceId = e.serviceId), e.availableServiceIds && e.availableServiceIds.length) {
1250
+ s.availableServiceIds = [];
1251
+ for (let c = 0; c < e.availableServiceIds.length; ++c)
1252
+ s.availableServiceIds[c] = e.availableServiceIds[c];
1253
+ }
1254
+ return s;
1255
+ }, r.prototype.toJSON = function() {
1256
+ return this.constructor.toObject(this, minimal.util.toJSONOptions);
1257
+ }, r.getTypeUrl = function(e) {
1258
+ return e === void 0 && (e = "type.googleapis.com"), e + "/com.amazonaws.iot.securedtunneling.ProtocolV2Message";
1259
+ }, r.Type = (function() {
1260
+ const a = {}, e = Object.create(a);
1261
+ return e[a[0] = "UNKNOWN"] = 0, e[a[1] = "DATA"] = 1, e[a[2] = "STREAM_START"] = 2, e[a[3] = "STREAM_RESET"] = 3, e[a[4] = "SESSION_RESET"] = 4, e[a[5] = "SERVICE_IDS"] = 5, e;
1262
+ })(), r;
1263
+ })(), l.ProtocolV3Message = (function() {
1264
+ function r(a) {
1265
+ if (this.availableServiceIds = [], a)
1266
+ for (let e = Object.keys(a), i = 0; i < e.length; ++i)
1267
+ a[e[i]] != null && (this[e[i]] = a[e[i]]);
1268
+ }
1269
+ return r.prototype.type = 0, r.prototype.streamId = 0, r.prototype.ignorable = !1, r.prototype.payload = $util.newBuffer([]), r.prototype.serviceId = "", r.prototype.availableServiceIds = $util.emptyArray, r.prototype.connectionId = 0, r.create = function(e) {
1270
+ return new r(e);
1271
+ }, r.encode = function(e, i) {
1272
+ if (i || (i = $Writer.create()), e.type != null && Object.hasOwnProperty.call(e, "type") && i.uint32(
1273
+ /* id 1, wireType 0 =*/
1274
+ 8
1275
+ ).int32(e.type), e.streamId != null && Object.hasOwnProperty.call(e, "streamId") && i.uint32(
1276
+ /* id 2, wireType 0 =*/
1277
+ 16
1278
+ ).int32(e.streamId), e.ignorable != null && Object.hasOwnProperty.call(e, "ignorable") && i.uint32(
1279
+ /* id 3, wireType 0 =*/
1280
+ 24
1281
+ ).bool(e.ignorable), e.payload != null && Object.hasOwnProperty.call(e, "payload") && i.uint32(
1282
+ /* id 4, wireType 2 =*/
1283
+ 34
1284
+ ).bytes(e.payload), e.serviceId != null && Object.hasOwnProperty.call(e, "serviceId") && i.uint32(
1285
+ /* id 5, wireType 2 =*/
1286
+ 42
1287
+ ).string(e.serviceId), e.availableServiceIds != null && e.availableServiceIds.length)
1288
+ for (let s = 0; s < e.availableServiceIds.length; ++s)
1289
+ i.uint32(
1290
+ /* id 6, wireType 2 =*/
1291
+ 50
1292
+ ).string(e.availableServiceIds[s]);
1293
+ return e.connectionId != null && Object.hasOwnProperty.call(e, "connectionId") && i.uint32(
1294
+ /* id 7, wireType 0 =*/
1295
+ 56
1296
+ ).uint32(e.connectionId), i;
1297
+ }, r.encodeDelimited = function(e, i) {
1298
+ return this.encode(e, i).ldelim();
1299
+ }, r.decode = function(e, i, s) {
1300
+ e instanceof $Reader || (e = $Reader.create(e));
1301
+ let c = i === void 0 ? e.len : e.pos + i, u = new $root.com.amazonaws.iot.securedtunneling.ProtocolV3Message();
1302
+ for (; e.pos < c; ) {
1303
+ let f = e.uint32();
1304
+ if (f === s)
1305
+ break;
1306
+ switch (f >>> 3) {
1307
+ case 1: {
1308
+ u.type = e.int32();
1309
+ break;
1310
+ }
1311
+ case 2: {
1312
+ u.streamId = e.int32();
1313
+ break;
1314
+ }
1315
+ case 3: {
1316
+ u.ignorable = e.bool();
1317
+ break;
1318
+ }
1319
+ case 4: {
1320
+ u.payload = e.bytes();
1321
+ break;
1322
+ }
1323
+ case 5: {
1324
+ u.serviceId = e.string();
1325
+ break;
1326
+ }
1327
+ case 6: {
1328
+ u.availableServiceIds && u.availableServiceIds.length || (u.availableServiceIds = []), u.availableServiceIds.push(e.string());
1329
+ break;
1330
+ }
1331
+ case 7: {
1332
+ u.connectionId = e.uint32();
1333
+ break;
1334
+ }
1335
+ default:
1336
+ e.skipType(f & 7);
1337
+ break;
1338
+ }
1339
+ }
1340
+ return u;
1341
+ }, r.decodeDelimited = function(e) {
1342
+ return e instanceof $Reader || (e = new $Reader(e)), this.decode(e, e.uint32());
1343
+ }, r.verify = function(e) {
1344
+ if (typeof e != "object" || e === null)
1345
+ return "object expected";
1346
+ if (e.type != null && e.hasOwnProperty("type"))
1347
+ switch (e.type) {
1348
+ default:
1349
+ return "type: enum value expected";
1350
+ case 0:
1351
+ case 1:
1352
+ case 2:
1353
+ case 3:
1354
+ case 4:
1355
+ case 5:
1356
+ case 6:
1357
+ case 7:
1358
+ break;
1359
+ }
1360
+ if (e.streamId != null && e.hasOwnProperty("streamId") && !$util.isInteger(e.streamId))
1361
+ return "streamId: integer expected";
1362
+ if (e.ignorable != null && e.hasOwnProperty("ignorable") && typeof e.ignorable != "boolean")
1363
+ return "ignorable: boolean expected";
1364
+ if (e.payload != null && e.hasOwnProperty("payload") && !(e.payload && typeof e.payload.length == "number" || $util.isString(e.payload)))
1365
+ return "payload: buffer expected";
1366
+ if (e.serviceId != null && e.hasOwnProperty("serviceId") && !$util.isString(e.serviceId))
1367
+ return "serviceId: string expected";
1368
+ if (e.availableServiceIds != null && e.hasOwnProperty("availableServiceIds")) {
1369
+ if (!Array.isArray(e.availableServiceIds))
1370
+ return "availableServiceIds: array expected";
1371
+ for (let i = 0; i < e.availableServiceIds.length; ++i)
1372
+ if (!$util.isString(e.availableServiceIds[i]))
1373
+ return "availableServiceIds: string[] expected";
1374
+ }
1375
+ return e.connectionId != null && e.hasOwnProperty("connectionId") && !$util.isInteger(e.connectionId) ? "connectionId: integer expected" : null;
1376
+ }, r.fromObject = function(e) {
1377
+ if (e instanceof $root.com.amazonaws.iot.securedtunneling.ProtocolV3Message)
1378
+ return e;
1379
+ let i = new $root.com.amazonaws.iot.securedtunneling.ProtocolV3Message();
1380
+ switch (e.type) {
1381
+ default:
1382
+ if (typeof e.type == "number") {
1383
+ i.type = e.type;
1384
+ break;
1385
+ }
1386
+ break;
1387
+ case "UNKNOWN":
1388
+ case 0:
1389
+ i.type = 0;
1390
+ break;
1391
+ case "DATA":
1392
+ case 1:
1393
+ i.type = 1;
1394
+ break;
1395
+ case "STREAM_START":
1396
+ case 2:
1397
+ i.type = 2;
1398
+ break;
1399
+ case "STREAM_RESET":
1400
+ case 3:
1401
+ i.type = 3;
1402
+ break;
1403
+ case "SESSION_RESET":
1404
+ case 4:
1405
+ i.type = 4;
1406
+ break;
1407
+ case "SERVICE_IDS":
1408
+ case 5:
1409
+ i.type = 5;
1410
+ break;
1411
+ case "CONNECTION_START":
1412
+ case 6:
1413
+ i.type = 6;
1414
+ break;
1415
+ case "CONNECTION_RESET":
1416
+ case 7:
1417
+ i.type = 7;
1418
+ break;
1419
+ }
1420
+ if (e.streamId != null && (i.streamId = e.streamId | 0), e.ignorable != null && (i.ignorable = !!e.ignorable), e.payload != null && (typeof e.payload == "string" ? $util.base64.decode(e.payload, i.payload = $util.newBuffer($util.base64.length(e.payload)), 0) : e.payload.length >= 0 && (i.payload = e.payload)), e.serviceId != null && (i.serviceId = String(e.serviceId)), e.availableServiceIds) {
1421
+ if (!Array.isArray(e.availableServiceIds))
1422
+ throw TypeError(".com.amazonaws.iot.securedtunneling.ProtocolV3Message.availableServiceIds: array expected");
1423
+ i.availableServiceIds = [];
1424
+ for (let s = 0; s < e.availableServiceIds.length; ++s)
1425
+ i.availableServiceIds[s] = String(e.availableServiceIds[s]);
1426
+ }
1427
+ return e.connectionId != null && (i.connectionId = e.connectionId >>> 0), i;
1428
+ }, r.toObject = function(e, i) {
1429
+ i || (i = {});
1430
+ let s = {};
1431
+ if ((i.arrays || i.defaults) && (s.availableServiceIds = []), i.defaults && (s.type = i.enums === String ? "UNKNOWN" : 0, s.streamId = 0, s.ignorable = !1, i.bytes === String ? s.payload = "" : (s.payload = [], i.bytes !== Array && (s.payload = $util.newBuffer(s.payload))), s.serviceId = "", s.connectionId = 0), e.type != null && e.hasOwnProperty("type") && (s.type = i.enums === String ? $root.com.amazonaws.iot.securedtunneling.ProtocolV3Message.Type[e.type] === void 0 ? e.type : $root.com.amazonaws.iot.securedtunneling.ProtocolV3Message.Type[e.type] : e.type), e.streamId != null && e.hasOwnProperty("streamId") && (s.streamId = e.streamId), e.ignorable != null && e.hasOwnProperty("ignorable") && (s.ignorable = e.ignorable), e.payload != null && e.hasOwnProperty("payload") && (s.payload = i.bytes === String ? $util.base64.encode(e.payload, 0, e.payload.length) : i.bytes === Array ? Array.prototype.slice.call(e.payload) : e.payload), e.serviceId != null && e.hasOwnProperty("serviceId") && (s.serviceId = e.serviceId), e.availableServiceIds && e.availableServiceIds.length) {
1432
+ s.availableServiceIds = [];
1433
+ for (let c = 0; c < e.availableServiceIds.length; ++c)
1434
+ s.availableServiceIds[c] = e.availableServiceIds[c];
1435
+ }
1436
+ return e.connectionId != null && e.hasOwnProperty("connectionId") && (s.connectionId = e.connectionId), s;
1437
+ }, r.prototype.toJSON = function() {
1438
+ return this.constructor.toObject(this, minimal.util.toJSONOptions);
1439
+ }, r.getTypeUrl = function(e) {
1440
+ return e === void 0 && (e = "type.googleapis.com"), e + "/com.amazonaws.iot.securedtunneling.ProtocolV3Message";
1441
+ }, r.Type = (function() {
1442
+ const a = {}, e = Object.create(a);
1443
+ return e[a[0] = "UNKNOWN"] = 0, e[a[1] = "DATA"] = 1, e[a[2] = "STREAM_START"] = 2, e[a[3] = "STREAM_RESET"] = 3, e[a[4] = "SESSION_RESET"] = 4, e[a[5] = "SERVICE_IDS"] = 5, e[a[6] = "CONNECTION_START"] = 6, e[a[7] = "CONNECTION_RESET"] = 7, e;
1444
+ })(), r;
1445
+ })(), l;
1446
+ })(), n;
1447
+ })(), t;
1448
+ })(), o;
1449
+ })(), ProtocolV1Message = com.amazonaws.iot.securedtunneling.ProtocolV1Message, ProtocolV2Message = com.amazonaws.iot.securedtunneling.ProtocolV2Message, ProtocolV3Message = com.amazonaws.iot.securedtunneling.ProtocolV3Message, TunnelMessageType = {
1450
+ UNKNOWN: 0,
1451
+ DATA: 1,
1452
+ STREAM_START: 2,
1453
+ STREAM_RESET: 3,
1454
+ SESSION_RESET: 4,
1455
+ SERVICE_IDS: 5,
1456
+ CONNECTION_START: 6,
1457
+ CONNECTION_RESET: 7
1458
+ };
1459
+ class SecureTunnelTransport {
1460
+ constructor(t, n) {
1461
+ switch (this.ws = null, this.streamId = 1, this.connectionId = 1, this.isConnected = !1, this.tunnelReady = !1, this.messageQueue = [], this.receiveBuffer = new Uint8Array(0), this.id = t, this.config = {
1462
+ protocol: "V2",
1463
+ ...n
1464
+ }, this.config.protocol) {
1465
+ case "V1":
1466
+ this.messageClass = ProtocolV1Message;
1467
+ break;
1468
+ case "V2":
1469
+ this.messageClass = ProtocolV2Message;
1470
+ break;
1471
+ case "V3":
1472
+ this.messageClass = ProtocolV3Message;
1473
+ break;
1474
+ default:
1475
+ this.messageClass = ProtocolV2Message;
1476
+ }
1477
+ }
1478
+ /**
1479
+ * Connect to AWS IoT Secure Tunnel WebSocket endpoint
1480
+ */
1481
+ async connect() {
1482
+ const t = this.buildWebSocketUrl(), r = `aws.iot.securetunneling-${(this.config.protocol || "V2").replace("V", "")}.0`;
1483
+ return console.log(`Connecting with WebSocket subprotocol: ${r}`), new Promise((a, e) => {
1484
+ try {
1485
+ this.ws = new WebSocket(t, r), this.ws.binaryType = "arraybuffer", this.ws.onopen = () => {
1486
+ console.log("AWS IoT Secure Tunnel WebSocket connected"), this.isConnected = !0, this.config.clientMode === "destination" ? this.config.serviceId && (console.log(
1487
+ "Sending SERVICE_IDS message with serviceId:",
1488
+ this.config.serviceId
1489
+ ), this.sendControlMessage(TunnelMessageType.SERVICE_IDS, {
1490
+ availableServiceIds: [this.config.serviceId]
1491
+ })) : (console.log(
1492
+ "Source mode: Sending STREAM_START with streamId:",
1493
+ this.streamId
1494
+ ), this.sendControlMessage(TunnelMessageType.STREAM_START, {
1495
+ streamId: this.streamId,
1496
+ serviceId: this.config.serviceId
1497
+ })), console.log("Waiting for tunnel handshake to complete..."), a();
1498
+ }, this.ws.onerror = (i) => {
1499
+ const s = new Error(
1500
+ "WebSocket error connecting to AWS IoT Secure Tunnel"
1501
+ );
1502
+ this.onError && this.onError(s), e(s);
1503
+ }, this.ws.onmessage = (i) => {
1504
+ i.data instanceof ArrayBuffer && this.handleIncomingData(new Uint8Array(i.data));
1505
+ }, this.ws.onclose = (i) => {
1506
+ console.log("AWS IoT Secure Tunnel WebSocket closed", {
1507
+ code: i.code,
1508
+ reason: i.reason,
1509
+ wasClean: i.wasClean
1510
+ }), this.isConnected = !1, this.tunnelReady = !1, this.onClose && this.onClose();
1511
+ };
1512
+ } catch (i) {
1513
+ e(i);
1514
+ }
1515
+ });
1516
+ }
1517
+ /**
1518
+ * Disconnect from the tunnel
1519
+ */
1520
+ async disconnect() {
1521
+ this.ws && (this.sendControlMessage(TunnelMessageType.STREAM_RESET, {
1522
+ streamId: this.streamId
1523
+ }), this.ws.close(), this.ws = null), this.isConnected = !1, this.tunnelReady = !1;
1524
+ }
1525
+ /**
1526
+ * Send data through the tunnel
1527
+ */
1528
+ async send(t) {
1529
+ if (!this.isConnected || !this.ws || !this.tunnelReady) {
1530
+ console.log(
1531
+ "Queueing message, tunnel not ready. Connected:",
1532
+ this.isConnected,
1533
+ "Ready:",
1534
+ this.tunnelReady
1535
+ ), this.messageQueue.push(t);
1536
+ return;
1537
+ }
1538
+ this.sendDataFrame(t);
1539
+ }
1540
+ /**
1541
+ * Process queued messages once tunnel is ready
1542
+ */
1543
+ processQueuedMessages() {
1544
+ for (console.log(`Processing ${this.messageQueue.length} queued messages`); this.messageQueue.length > 0; ) {
1545
+ const t = this.messageQueue.shift();
1546
+ t && this.sendDataFrame(t);
1547
+ }
1548
+ }
1549
+ /**
1550
+ * Build the WebSocket URL for AWS IoT Secure Tunneling
1551
+ */
1552
+ buildWebSocketUrl() {
1553
+ const t = `wss://data.tunneling.iot.${this.config.region}.amazonaws.com/tunnel`;
1554
+ if (!this.config.accessToken)
1555
+ throw console.error("AWS IoT Secure Tunnel: Access token is missing or empty"), new Error(
1556
+ "Access token is required for AWS IoT Secure Tunnel connection"
1557
+ );
1558
+ const n = encodeURIComponent(this.config.accessToken), l = `${t}?local-proxy-mode=${this.config.clientMode}&access-token=${n}`;
1559
+ return console.log("AWS IoT Secure Tunnel URL:", l.substring(0, 100) + "..."), console.log("Protocol version:", this.config.protocol || "V2"), l;
1560
+ }
1561
+ /**
1562
+ * Send a control message through the tunnel
1563
+ */
1564
+ sendControlMessage(t, n = {}) {
1565
+ const l = {
1566
+ type: t,
1567
+ ...n
1568
+ };
1569
+ console.log("Sending control message:", {
1570
+ type: this.getMessageTypeName(t),
1571
+ ...n
1572
+ });
1573
+ const r = this.encodeMessage(l);
1574
+ console.log(
1575
+ "Encoded message bytes:",
1576
+ Array.from(r).map((a) => a.toString(16).padStart(2, "0")).join(" ")
1577
+ ), this.sendFrame(r);
1578
+ }
1579
+ /**
1580
+ * Send a data frame through the tunnel
1581
+ */
1582
+ sendDataFrame(t) {
1583
+ for (let l = 0; l < t.length; l += 64512) {
1584
+ const r = t.slice(l, Math.min(l + 64512, t.length)), a = {
1585
+ type: TunnelMessageType.DATA,
1586
+ streamId: this.streamId,
1587
+ payload: r
1588
+ };
1589
+ this.config.serviceId && this.config.protocol !== "V1" && (a.serviceId = this.config.serviceId), this.config.protocol === "V3" && (a.connectionId = this.connectionId), console.log("Sending DATA message with:", {
1590
+ type: "DATA",
1591
+ streamId: this.streamId,
1592
+ serviceId: this.config.serviceId,
1593
+ connectionId: this.config.protocol === "V3" ? this.connectionId : void 0,
1594
+ payloadSize: r.length
1595
+ });
1596
+ const e = this.encodeMessage(a);
1597
+ this.sendFrame(e);
1598
+ }
1599
+ }
1600
+ /**
1601
+ * Send a frame with length prefix
1602
+ */
1603
+ sendFrame(t) {
1604
+ if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
1605
+ console.warn("Cannot send frame: WebSocket not open");
1606
+ return;
1607
+ }
1608
+ const n = new Uint8Array(2 + t.length);
1609
+ new DataView(n.buffer).setUint16(0, t.length, !1), n.set(t, 2), console.log(
1610
+ "Sending frame with length:",
1611
+ t.length,
1612
+ "Total frame size:",
1613
+ n.length
1614
+ ), console.log(
1615
+ "Frame bytes (first 20):",
1616
+ Array.from(n.slice(0, Math.min(20, n.length))).map((r) => r.toString(16).padStart(2, "0")).join(" ")
1617
+ ), this.ws.send(n.buffer);
1618
+ }
1619
+ /**
1620
+ * Handle incoming WebSocket data
1621
+ */
1622
+ handleIncomingData(t) {
1623
+ const n = new Uint8Array(this.receiveBuffer.length + t.length);
1624
+ for (n.set(this.receiveBuffer), n.set(t, this.receiveBuffer.length), this.receiveBuffer = n; this.receiveBuffer.length >= 2; ) {
1625
+ const r = new DataView(
1626
+ this.receiveBuffer.buffer,
1627
+ this.receiveBuffer.byteOffset
1628
+ ).getUint16(0, !1);
1629
+ if (this.receiveBuffer.length < 2 + r)
1630
+ break;
1631
+ const a = this.receiveBuffer.slice(2, 2 + r);
1632
+ this.receiveBuffer = this.receiveBuffer.slice(2 + r), console.log(
1633
+ "Received frame bytes:",
1634
+ Array.from(a).map((e) => e.toString(16).padStart(2, "0")).join(" ")
1635
+ );
1636
+ try {
1637
+ const e = this.decodeMessage(a);
1638
+ this.handleMessage(e);
1639
+ } catch (e) {
1640
+ console.error("Error decoding message:", e), this.onError && this.onError(e);
1641
+ }
1642
+ }
1643
+ }
1644
+ /**
1645
+ * Handle a decoded tunnel message
1646
+ */
1647
+ handleMessage(t) {
1648
+ var n;
1649
+ switch (console.log("Received message:", {
1650
+ type: this.getMessageTypeName(t.type),
1651
+ streamId: t.streamId,
1652
+ connectionId: t.connectionId,
1653
+ serviceId: t.serviceId,
1654
+ availableServiceIds: t.availableServiceIds,
1655
+ payloadSize: (n = t.payload) == null ? void 0 : n.length
1656
+ }), t.type) {
1657
+ case TunnelMessageType.DATA:
1658
+ t.payload && this.onData && this.onData(t.payload);
1659
+ break;
1660
+ case TunnelMessageType.STREAM_START:
1661
+ console.log("Stream started:", t.streamId), this.config.clientMode === "destination" && t.streamId !== void 0 && t.streamId !== null && (this.streamId = t.streamId, console.log("Destination mode: Updated streamId to", this.streamId), this.tunnelReady = !0, this.processQueuedMessages());
1662
+ break;
1663
+ case TunnelMessageType.STREAM_RESET:
1664
+ console.log("Stream reset:", t.streamId), this.onClose && this.onClose();
1665
+ break;
1666
+ case TunnelMessageType.SESSION_RESET:
1667
+ console.log("Session reset"), this.disconnect();
1668
+ break;
1669
+ case TunnelMessageType.SERVICE_IDS:
1670
+ console.log("Available service IDs:", t.availableServiceIds), this.config.clientMode === "source" && (console.log("Source mode: Tunnel ready after receiving SERVICE_IDS"), this.tunnelReady = !0, this.processQueuedMessages());
1671
+ break;
1672
+ case TunnelMessageType.CONNECTION_START:
1673
+ console.log("Connection started:", t.connectionId);
1674
+ break;
1675
+ case TunnelMessageType.CONNECTION_RESET:
1676
+ console.log("Connection reset:", t.connectionId);
1677
+ break;
1678
+ }
1679
+ }
1680
+ /**
1681
+ * Encode a message using protobufjs
1682
+ */
1683
+ encodeMessage(t) {
1684
+ const n = this.messageClass.create(t);
1685
+ return this.messageClass.encode(n).finish();
1686
+ }
1687
+ /**
1688
+ * Decode a message using protobufjs
1689
+ */
1690
+ decodeMessage(t) {
1691
+ return this.messageClass.decode(t);
1692
+ }
1693
+ /**
1694
+ * Get message type name for logging
1695
+ */
1696
+ getMessageTypeName(t) {
1697
+ return {
1698
+ 0: "UNKNOWN",
1699
+ 1: "DATA",
1700
+ 2: "STREAM_START",
1701
+ 3: this.config.protocol === "V1" ? "STREAM_END" : "STREAM_RESET",
1702
+ 4: "SESSION_RESET",
1703
+ 5: "SERVICE_IDS",
1704
+ 6: "CONNECTION_START",
1705
+ 7: "CONNECTION_RESET"
1706
+ }[t] || `UNKNOWN_${t}`;
1707
+ }
1708
+ }
1709
+ function detectFramework() {
1710
+ return typeof window > "u" ? "generic" : window.__NEXT_DATA__ || window.next ? "nextjs" : window.__vite_plugin_react_preamble_installed__ ? "vite" : window.__webpack_require__ ? "webpack" : "generic";
1711
+ }
1712
+ function getAssetPaths(o) {
1713
+ const t = detectFramework(), n = o.publicDir || "/";
1714
+ if (o.wasmPath && o.wasmExecPath)
1715
+ return {
1716
+ wasmPath: o.wasmPath,
1717
+ wasmExecPath: o.wasmExecPath
1718
+ };
1719
+ switch (t) {
1720
+ case "nextjs":
1721
+ return {
1722
+ wasmPath: o.wasmPath || `${n}sshclient.wasm`,
1723
+ wasmExecPath: o.wasmExecPath || `${n}wasm_exec.js`
1724
+ };
1725
+ case "vite":
1726
+ return {
1727
+ wasmPath: o.wasmPath || `${n}sshclient.wasm`,
1728
+ wasmExecPath: o.wasmExecPath || `${n}wasm_exec.js`
1729
+ };
1730
+ default:
1731
+ return {
1732
+ wasmPath: o.wasmPath || `${n}sshclient.wasm`,
1733
+ wasmExecPath: o.wasmExecPath || `${n}wasm_exec.js`
1734
+ };
1735
+ }
1736
+ }
1737
+ async function loadWasmExecutor(o, t = 1e4) {
1738
+ if (!(typeof window > "u") && !window.Go)
1739
+ return new Promise((n, l) => {
1740
+ const r = document.createElement("script");
1741
+ r.src = o, r.onload = () => n(), r.onerror = () => l(new Error(`Failed to load wasm_exec.js from ${o}`));
1742
+ const a = setTimeout(() => {
1743
+ l(new Error(`Timeout loading wasm_exec.js from ${o}`));
1744
+ }, t);
1745
+ r.onload = () => {
1746
+ clearTimeout(a), n();
1747
+ }, document.head.appendChild(r);
1748
+ });
1749
+ }
1750
+ async function testAssetAvailability(o, t) {
1751
+ const n = async (a) => {
1752
+ try {
1753
+ return (await fetch(a, { method: "HEAD" })).ok;
1754
+ } catch {
1755
+ return !1;
1756
+ }
1757
+ }, [l, r] = await Promise.all([
1758
+ n(o),
1759
+ n(t)
1760
+ ]);
1761
+ return { wasmAvailable: l, wasmExecAvailable: r };
1762
+ }
1763
+ const w = class w {
1764
+ static async initialize(t = {}) {
1765
+ var l;
1766
+ if (this.initialized)
1767
+ return;
1768
+ const n = typeof t == "string" ? { wasmPath: t, autoDetect: !1 } : { autoDetect: !0, cacheBusting: !0, timeout: 1e4, ...t };
1769
+ try {
1770
+ const { wasmPath: r, wasmExecPath: a } = getAssetPaths(n);
1771
+ if (n.autoDetect) {
1772
+ const { wasmAvailable: d, wasmExecAvailable: p } = await testAssetAvailability(r, a);
1773
+ if (!d)
1774
+ throw new Error(`WASM file not found at ${r}. Please ensure sshclient.wasm is in your public directory.`);
1775
+ if (!p)
1776
+ throw new Error(`wasm_exec.js not found at ${a}. Please ensure wasm_exec.js is in your public directory.`);
1777
+ }
1778
+ if (await loadWasmExecutor(a, n.timeout), typeof window.Go > "u")
1779
+ throw new Error(
1780
+ `Go runtime not loaded. Failed to load wasm_exec.js from ${a}.`
1781
+ );
1782
+ const e = new window.Go();
1783
+ let i = r;
1784
+ if (n.cacheBusting) {
1785
+ const d = `?v=${Date.now()}&t=${(/* @__PURE__ */ new Date()).getTime()}`;
1786
+ i += d;
1787
+ }
1788
+ const s = n.cacheBusting ? {
1789
+ cache: "no-cache",
1790
+ headers: {
1791
+ "Cache-Control": "no-cache",
1792
+ Pragma: "no-cache"
1793
+ }
1794
+ } : {}, c = await fetch(i, s);
1795
+ if (!c.ok)
1796
+ throw new Error(`Failed to fetch WASM file: ${c.status} ${c.statusText}`);
1797
+ const u = await c.arrayBuffer(), f = await WebAssembly.instantiate(u, e.importObject);
1798
+ if (e.run(f.instance), await new Promise((d) => setTimeout(d, 100)), this.wasmInstance = window.SSHClient, !this.wasmInstance)
1799
+ throw new Error(
1800
+ "Failed to initialize WASM module - SSHClient not found on window. The WASM module may not have loaded correctly."
1801
+ );
1802
+ this.transportManager.setWasmInstance(this.wasmInstance), this.initialized = !0, typeof process < "u" && ((l = process.env) == null ? void 0 : l.NODE_ENV) === "development" && (console.log("SSHClient WASM initialized successfully"), this.wasmInstance.version && console.log(`Version: ${this.wasmInstance.version()}`));
1803
+ } catch (r) {
1804
+ throw this.initialized = !1, r instanceof Error ? new Error(`SSHClient initialization failed: ${r.message}`) : new Error("SSHClient initialization failed with unknown error");
1805
+ }
1806
+ }
1807
+ static async connect(t, n, l) {
1808
+ if (!this.initialized)
1809
+ throw new Error("SSHClient not initialized. Call initialize() first.");
1810
+ await this.transportManager.createTransport(n), await n.connect();
1811
+ const r = l ? {
1812
+ onPacketSend: (e, i) => {
1813
+ l.onPacketSend && l.onPacketSend(e, i);
1814
+ },
1815
+ onPacketReceive: (e, i) => {
1816
+ l.onPacketReceive && l.onPacketReceive(e, i);
1817
+ },
1818
+ onStateChange: l.onStateChange
1819
+ } : void 0, a = await this.wasmInstance.connect(
1820
+ t,
1821
+ n.id,
1822
+ r
1823
+ );
1824
+ return {
1825
+ sessionId: a.sessionId,
1826
+ send: async (e) => {
1827
+ await a.send(e);
1828
+ },
1829
+ disconnect: async () => {
1830
+ await a.disconnect(), await this.transportManager.closeTransport(n.id);
1831
+ },
1832
+ resizeTerminal: async (e, i) => {
1833
+ await a.resizeTerminal(e, i);
1834
+ }
1835
+ };
1836
+ }
1837
+ static async disconnect(t) {
1838
+ if (!this.initialized)
1839
+ throw new Error("SSHClient not initialized");
1840
+ await this.wasmInstance.disconnect(t);
1841
+ }
1842
+ static async send(t, n) {
1843
+ if (!this.initialized)
1844
+ throw new Error("SSHClient not initialized");
1845
+ await this.wasmInstance.send(t, n);
1846
+ }
1847
+ static getVersion() {
1848
+ if (!this.initialized)
1849
+ throw new Error("SSHClient not initialized");
1850
+ return this.wasmInstance.version();
1851
+ }
1852
+ };
1853
+ w.initialized = !1, w.transportManager = TransportManager.getInstance();
1854
+ let SSHClient = w;
1855
+ class PacketTransformer {
1856
+ static toProtobuf(t, n) {
1857
+ return t;
1858
+ }
1859
+ static fromProtobuf(t, n) {
1860
+ return t;
1861
+ }
1862
+ static toBase64(t) {
1863
+ return btoa(String.fromCharCode(...t));
1864
+ }
1865
+ static fromBase64(t) {
1866
+ const n = atob(t), l = new Uint8Array(n.length);
1867
+ for (let r = 0; r < n.length; r++)
1868
+ l[r] = n.charCodeAt(r);
1869
+ return l;
1870
+ }
1871
+ }
1872
+ const SSHClientHelpers = {
1873
+ /**
1874
+ * Get recommended asset paths for the detected framework
1875
+ */
1876
+ getAssetPaths: (o = "/") => getAssetPaths({ publicDir: o }),
1877
+ /**
1878
+ * Detect the current framework
1879
+ */
1880
+ detectFramework,
1881
+ /**
1882
+ * Test if WASM assets are available at the given paths
1883
+ */
1884
+ testAssetAvailability,
1885
+ /**
1886
+ * Next.js specific initialization helper
1887
+ */
1888
+ initializeForNextJS: async (o = {}) => SSHClient.initialize({
1889
+ publicDir: "/",
1890
+ autoDetect: !0,
1891
+ cacheBusting: process.env.NODE_ENV === "development",
1892
+ ...o
1893
+ }),
1894
+ /**
1895
+ * Vite specific initialization helper
1896
+ */
1897
+ initializeForVite: async (o = {}) => {
1898
+ var n, l, r;
1899
+ let t = !1;
1900
+ try {
1901
+ t = ((r = (l = (n = globalThis.import) == null ? void 0 : n.meta) == null ? void 0 : l.env) == null ? void 0 : r.DEV) === !0;
1902
+ } catch {
1903
+ t = !1;
1904
+ }
1905
+ return SSHClient.initialize({
1906
+ publicDir: "/",
1907
+ autoDetect: !0,
1908
+ cacheBusting: t,
1909
+ ...o
1910
+ });
1911
+ },
1912
+ /**
1913
+ * Generic initialization with sensible defaults
1914
+ */
1915
+ initializeWithDefaults: async (o = {}) => {
1916
+ const t = {
1917
+ autoDetect: !0,
1918
+ cacheBusting: !0,
1919
+ timeout: 1e4,
1920
+ publicDir: "/"
1921
+ };
1922
+ return SSHClient.initialize({ ...t, ...o });
1923
+ }
1924
+ };
1925
+ export {
1926
+ CustomTransport,
1927
+ PacketTransformer,
1928
+ SSHClient,
1929
+ SSHClientHelpers,
1930
+ SecureTunnelTransport,
1931
+ TunnelMessageType,
1932
+ WebSocketTransport,
1933
+ SSHClient as default
1934
+ };
1935
+ //# sourceMappingURL=index.esm.js.map