@busy-app/busy-lib 0.11.0 → 0.13.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.
@@ -0,0 +1,4025 @@
1
+ import { C as ConnectionStatus, A as AuthStatus, b as StateStreamErrorCode } from "./types.status-gCPe7MrJ.js";
2
+ var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, src = { exports: {} }, indexLight = { exports: {} }, indexMinimal = {}, minimal = {}, aspromise, hasRequiredAspromise;
3
+ function requireAspromise() {
4
+ if (hasRequiredAspromise) return aspromise;
5
+ hasRequiredAspromise = 1, aspromise = d;
6
+ function d(u, h) {
7
+ for (var c = new Array(arguments.length - 1), l = 0, n = 2, e = !0; n < arguments.length; )
8
+ c[l++] = arguments[n++];
9
+ return new Promise(function(i, t) {
10
+ c[l] = function(s) {
11
+ if (e)
12
+ if (e = !1, s)
13
+ t(s);
14
+ else {
15
+ for (var a = new Array(arguments.length - 1), o = 0; o < a.length; )
16
+ a[o++] = arguments[o];
17
+ i.apply(null, a);
18
+ }
19
+ };
20
+ try {
21
+ u.apply(h || null, c);
22
+ } catch (f) {
23
+ e && (e = !1, t(f));
24
+ }
25
+ });
26
+ }
27
+ return aspromise;
28
+ }
29
+ var base64 = {}, hasRequiredBase64;
30
+ function requireBase64() {
31
+ return hasRequiredBase64 || (hasRequiredBase64 = 1, function(d) {
32
+ var u = d;
33
+ u.length = function(r) {
34
+ var i = r.length;
35
+ if (!i)
36
+ return 0;
37
+ for (var t = 0; --i % 4 > 1 && r.charAt(i) === "="; )
38
+ ++t;
39
+ return Math.ceil(r.length * 3) / 4 - t;
40
+ };
41
+ for (var h = new Array(64), c = new Array(123), l = 0; l < 64; )
42
+ c[h[l] = l < 26 ? l + 65 : l < 52 ? l + 71 : l < 62 ? l - 4 : l - 59 | 43] = l++;
43
+ u.encode = function(r, i, t) {
44
+ for (var f = null, s = [], a = 0, o = 0, p; i < t; ) {
45
+ var y = r[i++];
46
+ switch (o) {
47
+ case 0:
48
+ s[a++] = h[y >> 2], p = (y & 3) << 4, o = 1;
49
+ break;
50
+ case 1:
51
+ s[a++] = h[p | y >> 4], p = (y & 15) << 2, o = 2;
52
+ break;
53
+ case 2:
54
+ s[a++] = h[p | y >> 6], s[a++] = h[y & 63], o = 0;
55
+ break;
56
+ }
57
+ a > 8191 && ((f || (f = [])).push(String.fromCharCode.apply(String, s)), a = 0);
58
+ }
59
+ return o && (s[a++] = h[p], s[a++] = 61, o === 1 && (s[a++] = 61)), f ? (a && f.push(String.fromCharCode.apply(String, s.slice(0, a))), f.join("")) : String.fromCharCode.apply(String, s.slice(0, a));
60
+ };
61
+ var n = "invalid encoding";
62
+ u.decode = function(r, i, t) {
63
+ for (var f = t, s = 0, a, o = 0; o < r.length; ) {
64
+ var p = r.charCodeAt(o++);
65
+ if (p === 61 && s > 1)
66
+ break;
67
+ if ((p = c[p]) === void 0)
68
+ throw Error(n);
69
+ switch (s) {
70
+ case 0:
71
+ a = p, s = 1;
72
+ break;
73
+ case 1:
74
+ i[t++] = a << 2 | (p & 48) >> 4, a = p, s = 2;
75
+ break;
76
+ case 2:
77
+ i[t++] = (a & 15) << 4 | (p & 60) >> 2, a = p, s = 3;
78
+ break;
79
+ case 3:
80
+ i[t++] = (a & 3) << 6 | p, s = 0;
81
+ break;
82
+ }
83
+ }
84
+ if (s === 1)
85
+ throw Error(n);
86
+ return t - f;
87
+ }, u.test = function(r) {
88
+ return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(r);
89
+ };
90
+ }(base64)), base64;
91
+ }
92
+ var eventemitter, hasRequiredEventemitter;
93
+ function requireEventemitter() {
94
+ if (hasRequiredEventemitter) return eventemitter;
95
+ hasRequiredEventemitter = 1, eventemitter = d;
96
+ function d() {
97
+ this._listeners = {};
98
+ }
99
+ return d.prototype.on = function(h, c, l) {
100
+ return (this._listeners[h] || (this._listeners[h] = [])).push({
101
+ fn: c,
102
+ ctx: l || this
103
+ }), this;
104
+ }, d.prototype.off = function(h, c) {
105
+ if (h === void 0)
106
+ this._listeners = {};
107
+ else if (c === void 0)
108
+ this._listeners[h] = [];
109
+ else
110
+ for (var l = this._listeners[h], n = 0; n < l.length; )
111
+ l[n].fn === c ? l.splice(n, 1) : ++n;
112
+ return this;
113
+ }, d.prototype.emit = function(h) {
114
+ var c = this._listeners[h];
115
+ if (c) {
116
+ for (var l = [], n = 1; n < arguments.length; )
117
+ l.push(arguments[n++]);
118
+ for (n = 0; n < c.length; )
119
+ c[n].fn.apply(c[n++].ctx, l);
120
+ }
121
+ return this;
122
+ }, eventemitter;
123
+ }
124
+ var float, hasRequiredFloat;
125
+ function requireFloat() {
126
+ if (hasRequiredFloat) return float;
127
+ hasRequiredFloat = 1, float = d(d);
128
+ function d(n) {
129
+ return typeof Float32Array < "u" ? function() {
130
+ var e = new Float32Array([-0]), r = new Uint8Array(e.buffer), i = r[3] === 128;
131
+ function t(o, p, y) {
132
+ e[0] = o, p[y] = r[0], p[y + 1] = r[1], p[y + 2] = r[2], p[y + 3] = r[3];
133
+ }
134
+ function f(o, p, y) {
135
+ e[0] = o, p[y] = r[3], p[y + 1] = r[2], p[y + 2] = r[1], p[y + 3] = r[0];
136
+ }
137
+ n.writeFloatLE = i ? t : f, n.writeFloatBE = i ? f : t;
138
+ function s(o, p) {
139
+ return r[0] = o[p], r[1] = o[p + 1], r[2] = o[p + 2], r[3] = o[p + 3], e[0];
140
+ }
141
+ function a(o, p) {
142
+ return r[3] = o[p], r[2] = o[p + 1], r[1] = o[p + 2], r[0] = o[p + 3], e[0];
143
+ }
144
+ n.readFloatLE = i ? s : a, n.readFloatBE = i ? a : s;
145
+ }() : function() {
146
+ function e(i, t, f, s) {
147
+ var a = t < 0 ? 1 : 0;
148
+ if (a && (t = -t), t === 0)
149
+ i(1 / t > 0 ? (
150
+ /* positive */
151
+ 0
152
+ ) : (
153
+ /* negative 0 */
154
+ 2147483648
155
+ ), f, s);
156
+ else if (isNaN(t))
157
+ i(2143289344, f, s);
158
+ else if (t > 34028234663852886e22)
159
+ i((a << 31 | 2139095040) >>> 0, f, s);
160
+ else if (t < 11754943508222875e-54)
161
+ i((a << 31 | Math.round(t / 1401298464324817e-60)) >>> 0, f, s);
162
+ else {
163
+ var o = Math.floor(Math.log(t) / Math.LN2), p = Math.round(t * Math.pow(2, -o) * 8388608) & 8388607;
164
+ i((a << 31 | o + 127 << 23 | p) >>> 0, f, s);
165
+ }
166
+ }
167
+ n.writeFloatLE = e.bind(null, u), n.writeFloatBE = e.bind(null, h);
168
+ function r(i, t, f) {
169
+ var s = i(t, f), a = (s >> 31) * 2 + 1, o = s >>> 23 & 255, p = s & 8388607;
170
+ return o === 255 ? p ? NaN : a * (1 / 0) : o === 0 ? a * 1401298464324817e-60 * p : a * Math.pow(2, o - 150) * (p + 8388608);
171
+ }
172
+ n.readFloatLE = r.bind(null, c), n.readFloatBE = r.bind(null, l);
173
+ }(), typeof Float64Array < "u" ? function() {
174
+ var e = new Float64Array([-0]), r = new Uint8Array(e.buffer), i = r[7] === 128;
175
+ function t(o, p, y) {
176
+ e[0] = o, p[y] = r[0], p[y + 1] = r[1], p[y + 2] = r[2], p[y + 3] = r[3], p[y + 4] = r[4], p[y + 5] = r[5], p[y + 6] = r[6], p[y + 7] = r[7];
177
+ }
178
+ function f(o, p, y) {
179
+ e[0] = o, p[y] = r[7], p[y + 1] = r[6], p[y + 2] = r[5], p[y + 3] = r[4], p[y + 4] = r[3], p[y + 5] = r[2], p[y + 6] = r[1], p[y + 7] = r[0];
180
+ }
181
+ n.writeDoubleLE = i ? t : f, n.writeDoubleBE = i ? f : t;
182
+ function s(o, p) {
183
+ return r[0] = o[p], r[1] = o[p + 1], r[2] = o[p + 2], r[3] = o[p + 3], r[4] = o[p + 4], r[5] = o[p + 5], r[6] = o[p + 6], r[7] = o[p + 7], e[0];
184
+ }
185
+ function a(o, p) {
186
+ return r[7] = o[p], r[6] = o[p + 1], r[5] = o[p + 2], r[4] = o[p + 3], r[3] = o[p + 4], r[2] = o[p + 5], r[1] = o[p + 6], r[0] = o[p + 7], e[0];
187
+ }
188
+ n.readDoubleLE = i ? s : a, n.readDoubleBE = i ? a : s;
189
+ }() : function() {
190
+ function e(i, t, f, s, a, o) {
191
+ var p = s < 0 ? 1 : 0;
192
+ if (p && (s = -s), s === 0)
193
+ i(0, a, o + t), i(1 / s > 0 ? (
194
+ /* positive */
195
+ 0
196
+ ) : (
197
+ /* negative 0 */
198
+ 2147483648
199
+ ), a, o + f);
200
+ else if (isNaN(s))
201
+ i(0, a, o + t), i(2146959360, a, o + f);
202
+ else if (s > 17976931348623157e292)
203
+ i(0, a, o + t), i((p << 31 | 2146435072) >>> 0, a, o + f);
204
+ else {
205
+ var y;
206
+ if (s < 22250738585072014e-324)
207
+ y = s / 5e-324, i(y >>> 0, a, o + t), i((p << 31 | y / 4294967296) >>> 0, a, o + f);
208
+ else {
209
+ var b = Math.floor(Math.log(s) / Math.LN2);
210
+ b === 1024 && (b = 1023), y = s * Math.pow(2, -b), i(y * 4503599627370496 >>> 0, a, o + t), i((p << 31 | b + 1023 << 20 | y * 1048576 & 1048575) >>> 0, a, o + f);
211
+ }
212
+ }
213
+ }
214
+ n.writeDoubleLE = e.bind(null, u, 0, 4), n.writeDoubleBE = e.bind(null, h, 4, 0);
215
+ function r(i, t, f, s, a) {
216
+ var o = i(s, a + t), p = i(s, a + f), y = (p >> 31) * 2 + 1, b = p >>> 20 & 2047, v = 4294967296 * (p & 1048575) + o;
217
+ return b === 2047 ? v ? NaN : y * (1 / 0) : b === 0 ? y * 5e-324 * v : y * Math.pow(2, b - 1075) * (v + 4503599627370496);
218
+ }
219
+ n.readDoubleLE = r.bind(null, c, 0, 4), n.readDoubleBE = r.bind(null, l, 4, 0);
220
+ }(), n;
221
+ }
222
+ function u(n, e, r) {
223
+ e[r] = n & 255, e[r + 1] = n >>> 8 & 255, e[r + 2] = n >>> 16 & 255, e[r + 3] = n >>> 24;
224
+ }
225
+ function h(n, e, r) {
226
+ e[r] = n >>> 24, e[r + 1] = n >>> 16 & 255, e[r + 2] = n >>> 8 & 255, e[r + 3] = n & 255;
227
+ }
228
+ function c(n, e) {
229
+ return (n[e] | n[e + 1] << 8 | n[e + 2] << 16 | n[e + 3] << 24) >>> 0;
230
+ }
231
+ function l(n, e) {
232
+ return (n[e] << 24 | n[e + 1] << 16 | n[e + 2] << 8 | n[e + 3]) >>> 0;
233
+ }
234
+ return float;
235
+ }
236
+ var inquire_1, hasRequiredInquire;
237
+ function requireInquire() {
238
+ if (hasRequiredInquire) return inquire_1;
239
+ hasRequiredInquire = 1, inquire_1 = inquire;
240
+ function inquire(moduleName) {
241
+ try {
242
+ var mod = eval("quire".replace(/^/, "re"))(moduleName);
243
+ if (mod && (mod.length || Object.keys(mod).length))
244
+ return mod;
245
+ } catch (d) {
246
+ }
247
+ return null;
248
+ }
249
+ return inquire_1;
250
+ }
251
+ var utf8 = {}, hasRequiredUtf8;
252
+ function requireUtf8() {
253
+ return hasRequiredUtf8 || (hasRequiredUtf8 = 1, function(d) {
254
+ var u = d;
255
+ u.length = function(c) {
256
+ for (var l = 0, n = 0, e = 0; e < c.length; ++e)
257
+ n = c.charCodeAt(e), n < 128 ? l += 1 : n < 2048 ? l += 2 : (n & 64512) === 55296 && (c.charCodeAt(e + 1) & 64512) === 56320 ? (++e, l += 4) : l += 3;
258
+ return l;
259
+ }, u.read = function(c, l, n) {
260
+ var e = n - l;
261
+ if (e < 1)
262
+ return "";
263
+ for (var r = null, i = [], t = 0, f; l < n; )
264
+ f = c[l++], f < 128 ? i[t++] = f : f > 191 && f < 224 ? i[t++] = (f & 31) << 6 | c[l++] & 63 : f > 239 && f < 365 ? (f = ((f & 7) << 18 | (c[l++] & 63) << 12 | (c[l++] & 63) << 6 | c[l++] & 63) - 65536, i[t++] = 55296 + (f >> 10), i[t++] = 56320 + (f & 1023)) : i[t++] = (f & 15) << 12 | (c[l++] & 63) << 6 | c[l++] & 63, t > 8191 && ((r || (r = [])).push(String.fromCharCode.apply(String, i)), t = 0);
265
+ return r ? (t && r.push(String.fromCharCode.apply(String, i.slice(0, t))), r.join("")) : String.fromCharCode.apply(String, i.slice(0, t));
266
+ }, u.write = function(c, l, n) {
267
+ for (var e = n, r, i, t = 0; t < c.length; ++t)
268
+ r = c.charCodeAt(t), r < 128 ? l[n++] = r : r < 2048 ? (l[n++] = r >> 6 | 192, l[n++] = r & 63 | 128) : (r & 64512) === 55296 && ((i = c.charCodeAt(t + 1)) & 64512) === 56320 ? (r = 65536 + ((r & 1023) << 10) + (i & 1023), ++t, l[n++] = r >> 18 | 240, l[n++] = r >> 12 & 63 | 128, l[n++] = r >> 6 & 63 | 128, l[n++] = r & 63 | 128) : (l[n++] = r >> 12 | 224, l[n++] = r >> 6 & 63 | 128, l[n++] = r & 63 | 128);
269
+ return n - e;
270
+ };
271
+ }(utf8)), utf8;
272
+ }
273
+ var pool_1, hasRequiredPool;
274
+ function requirePool() {
275
+ if (hasRequiredPool) return pool_1;
276
+ hasRequiredPool = 1, pool_1 = d;
277
+ function d(u, h, c) {
278
+ var l = c || 8192, n = l >>> 1, e = null, r = l;
279
+ return function(t) {
280
+ if (t < 1 || t > n)
281
+ return u(t);
282
+ r + t > l && (e = u(l), r = 0);
283
+ var f = h.call(e, r, r += t);
284
+ return r & 7 && (r = (r | 7) + 1), f;
285
+ };
286
+ }
287
+ return pool_1;
288
+ }
289
+ var longbits, hasRequiredLongbits;
290
+ function requireLongbits() {
291
+ if (hasRequiredLongbits) return longbits;
292
+ hasRequiredLongbits = 1, longbits = u;
293
+ var d = requireMinimal();
294
+ function u(n, e) {
295
+ this.lo = n >>> 0, this.hi = e >>> 0;
296
+ }
297
+ var h = u.zero = new u(0, 0);
298
+ h.toNumber = function() {
299
+ return 0;
300
+ }, h.zzEncode = h.zzDecode = function() {
301
+ return this;
302
+ }, h.length = function() {
303
+ return 1;
304
+ };
305
+ var c = u.zeroHash = "\0\0\0\0\0\0\0\0";
306
+ u.fromNumber = function(e) {
307
+ if (e === 0)
308
+ return h;
309
+ var r = e < 0;
310
+ r && (e = -e);
311
+ var i = e >>> 0, t = (e - i) / 4294967296 >>> 0;
312
+ return r && (t = ~t >>> 0, i = ~i >>> 0, ++i > 4294967295 && (i = 0, ++t > 4294967295 && (t = 0))), new u(i, t);
313
+ }, u.from = function(e) {
314
+ if (typeof e == "number")
315
+ return u.fromNumber(e);
316
+ if (d.isString(e))
317
+ if (d.Long)
318
+ e = d.Long.fromString(e);
319
+ else
320
+ return u.fromNumber(parseInt(e, 10));
321
+ return e.low || e.high ? new u(e.low >>> 0, e.high >>> 0) : h;
322
+ }, u.prototype.toNumber = function(e) {
323
+ if (!e && this.hi >>> 31) {
324
+ var r = ~this.lo + 1 >>> 0, i = ~this.hi >>> 0;
325
+ return r || (i = i + 1 >>> 0), -(r + i * 4294967296);
326
+ }
327
+ return this.lo + this.hi * 4294967296;
328
+ }, u.prototype.toLong = function(e) {
329
+ return d.Long ? new d.Long(this.lo | 0, this.hi | 0, !!e) : { low: this.lo | 0, high: this.hi | 0, unsigned: !!e };
330
+ };
331
+ var l = String.prototype.charCodeAt;
332
+ return u.fromHash = function(e) {
333
+ return e === c ? h : new u(
334
+ (l.call(e, 0) | l.call(e, 1) << 8 | l.call(e, 2) << 16 | l.call(e, 3) << 24) >>> 0,
335
+ (l.call(e, 4) | l.call(e, 5) << 8 | l.call(e, 6) << 16 | l.call(e, 7) << 24) >>> 0
336
+ );
337
+ }, u.prototype.toHash = function() {
338
+ return String.fromCharCode(
339
+ this.lo & 255,
340
+ this.lo >>> 8 & 255,
341
+ this.lo >>> 16 & 255,
342
+ this.lo >>> 24,
343
+ this.hi & 255,
344
+ this.hi >>> 8 & 255,
345
+ this.hi >>> 16 & 255,
346
+ this.hi >>> 24
347
+ );
348
+ }, u.prototype.zzEncode = function() {
349
+ var e = this.hi >> 31;
350
+ return this.hi = ((this.hi << 1 | this.lo >>> 31) ^ e) >>> 0, this.lo = (this.lo << 1 ^ e) >>> 0, this;
351
+ }, u.prototype.zzDecode = function() {
352
+ var e = -(this.lo & 1);
353
+ return this.lo = ((this.lo >>> 1 | this.hi << 31) ^ e) >>> 0, this.hi = (this.hi >>> 1 ^ e) >>> 0, this;
354
+ }, u.prototype.length = function() {
355
+ var e = this.lo, r = (this.lo >>> 28 | this.hi << 4) >>> 0, i = this.hi >>> 24;
356
+ return i === 0 ? r === 0 ? e < 16384 ? e < 128 ? 1 : 2 : e < 2097152 ? 3 : 4 : r < 16384 ? r < 128 ? 5 : 6 : r < 2097152 ? 7 : 8 : i < 128 ? 9 : 10;
357
+ }, longbits;
358
+ }
359
+ var hasRequiredMinimal;
360
+ function requireMinimal() {
361
+ return hasRequiredMinimal || (hasRequiredMinimal = 1, function(d) {
362
+ var u = d;
363
+ u.asPromise = requireAspromise(), u.base64 = requireBase64(), u.EventEmitter = requireEventemitter(), u.float = requireFloat(), u.inquire = requireInquire(), u.utf8 = requireUtf8(), u.pool = requirePool(), u.LongBits = requireLongbits(), u.isNode = !!(typeof commonjsGlobal < "u" && commonjsGlobal && commonjsGlobal.process && commonjsGlobal.process.versions && commonjsGlobal.process.versions.node), u.global = u.isNode && commonjsGlobal || typeof window < "u" && window || typeof self < "u" && self || minimal, u.emptyArray = Object.freeze ? Object.freeze([]) : (
364
+ /* istanbul ignore next */
365
+ []
366
+ ), u.emptyObject = Object.freeze ? Object.freeze({}) : (
367
+ /* istanbul ignore next */
368
+ {}
369
+ ), u.isInteger = Number.isInteger || /* istanbul ignore next */
370
+ function(n) {
371
+ return typeof n == "number" && isFinite(n) && Math.floor(n) === n;
372
+ }, u.isString = function(n) {
373
+ return typeof n == "string" || n instanceof String;
374
+ }, u.isObject = function(n) {
375
+ return n && typeof n == "object";
376
+ }, u.isset = /**
377
+ * Checks if a property on a message is considered to be present.
378
+ * @param {Object} obj Plain object or message instance
379
+ * @param {string} prop Property name
380
+ * @returns {boolean} `true` if considered to be present, otherwise `false`
381
+ */
382
+ u.isSet = function(n, e) {
383
+ var r = n[e];
384
+ return r != null && n.hasOwnProperty(e) ? typeof r != "object" || (Array.isArray(r) ? r.length : Object.keys(r).length) > 0 : !1;
385
+ }, u.Buffer = function() {
386
+ try {
387
+ var l = u.inquire("buffer").Buffer;
388
+ return l.prototype.utf8Write ? l : (
389
+ /* istanbul ignore next */
390
+ null
391
+ );
392
+ } catch {
393
+ return null;
394
+ }
395
+ }(), u._Buffer_from = null, u._Buffer_allocUnsafe = null, u.newBuffer = function(n) {
396
+ return typeof n == "number" ? u.Buffer ? u._Buffer_allocUnsafe(n) : new u.Array(n) : u.Buffer ? u._Buffer_from(n) : typeof Uint8Array > "u" ? n : new Uint8Array(n);
397
+ }, u.Array = typeof Uint8Array < "u" ? Uint8Array : Array, u.Long = /* istanbul ignore next */
398
+ u.global.dcodeIO && /* istanbul ignore next */
399
+ u.global.dcodeIO.Long || /* istanbul ignore next */
400
+ u.global.Long || u.inquire("long"), u.key2Re = /^true|false|0|1$/, u.key32Re = /^-?(?:0|[1-9][0-9]*)$/, u.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/, u.longToHash = function(n) {
401
+ return n ? u.LongBits.from(n).toHash() : u.LongBits.zeroHash;
402
+ }, u.longFromHash = function(n, e) {
403
+ var r = u.LongBits.fromHash(n);
404
+ return u.Long ? u.Long.fromBits(r.lo, r.hi, e) : r.toNumber(!!e);
405
+ };
406
+ function h(l, n, e) {
407
+ for (var r = Object.keys(n), i = 0; i < r.length; ++i)
408
+ (l[r[i]] === void 0 || !e) && (l[r[i]] = n[r[i]]);
409
+ return l;
410
+ }
411
+ u.merge = h, u.lcFirst = function(n) {
412
+ return n.charAt(0).toLowerCase() + n.substring(1);
413
+ };
414
+ function c(l) {
415
+ function n(e, r) {
416
+ if (!(this instanceof n))
417
+ return new n(e, r);
418
+ Object.defineProperty(this, "message", { get: function() {
419
+ return e;
420
+ } }), Error.captureStackTrace ? Error.captureStackTrace(this, n) : Object.defineProperty(this, "stack", { value: new Error().stack || "" }), r && h(this, r);
421
+ }
422
+ return n.prototype = Object.create(Error.prototype, {
423
+ constructor: {
424
+ value: n,
425
+ writable: !0,
426
+ enumerable: !1,
427
+ configurable: !0
428
+ },
429
+ name: {
430
+ get: function() {
431
+ return l;
432
+ },
433
+ set: void 0,
434
+ enumerable: !1,
435
+ // configurable: false would accurately preserve the behavior of
436
+ // the original, but I'm guessing that was not intentional.
437
+ // For an actual error subclass, this property would
438
+ // be configurable.
439
+ configurable: !0
440
+ },
441
+ toString: {
442
+ value: function() {
443
+ return this.name + ": " + this.message;
444
+ },
445
+ writable: !0,
446
+ enumerable: !1,
447
+ configurable: !0
448
+ }
449
+ }), n;
450
+ }
451
+ u.newError = c, u.ProtocolError = c("ProtocolError"), u.oneOfGetter = function(n) {
452
+ for (var e = {}, r = 0; r < n.length; ++r)
453
+ e[n[r]] = 1;
454
+ return function() {
455
+ for (var i = Object.keys(this), t = i.length - 1; t > -1; --t)
456
+ if (e[i[t]] === 1 && this[i[t]] !== void 0 && this[i[t]] !== null)
457
+ return i[t];
458
+ };
459
+ }, u.oneOfSetter = function(n) {
460
+ return function(e) {
461
+ for (var r = 0; r < n.length; ++r)
462
+ n[r] !== e && delete this[n[r]];
463
+ };
464
+ }, u.toJSONOptions = {
465
+ longs: String,
466
+ enums: String,
467
+ bytes: String,
468
+ json: !0
469
+ }, u._configure = function() {
470
+ var l = u.Buffer;
471
+ if (!l) {
472
+ u._Buffer_from = u._Buffer_allocUnsafe = null;
473
+ return;
474
+ }
475
+ u._Buffer_from = l.from !== Uint8Array.from && l.from || /* istanbul ignore next */
476
+ function(e, r) {
477
+ return new l(e, r);
478
+ }, u._Buffer_allocUnsafe = l.allocUnsafe || /* istanbul ignore next */
479
+ function(e) {
480
+ return new l(e);
481
+ };
482
+ };
483
+ }(minimal)), minimal;
484
+ }
485
+ var writer, hasRequiredWriter;
486
+ function requireWriter() {
487
+ if (hasRequiredWriter) return writer;
488
+ hasRequiredWriter = 1, writer = i;
489
+ var d = requireMinimal(), u, h = d.LongBits, c = d.base64, l = d.utf8;
490
+ function n(b, v, m) {
491
+ this.fn = b, this.len = v, this.next = void 0, this.val = m;
492
+ }
493
+ function e() {
494
+ }
495
+ function r(b) {
496
+ this.head = b.head, this.tail = b.tail, this.len = b.len, this.next = b.states;
497
+ }
498
+ function i() {
499
+ this.len = 0, this.head = new n(e, 0, 0), this.tail = this.head, this.states = null;
500
+ }
501
+ var t = function() {
502
+ return d.Buffer ? function() {
503
+ return (i.create = function() {
504
+ return new u();
505
+ })();
506
+ } : function() {
507
+ return new i();
508
+ };
509
+ };
510
+ i.create = t(), i.alloc = function(v) {
511
+ return new d.Array(v);
512
+ }, d.Array !== Array && (i.alloc = d.pool(i.alloc, d.Array.prototype.subarray)), i.prototype._push = function(v, m, _) {
513
+ return this.tail = this.tail.next = new n(v, m, _), this.len += m, this;
514
+ };
515
+ function f(b, v, m) {
516
+ v[m] = b & 255;
517
+ }
518
+ function s(b, v, m) {
519
+ for (; b > 127; )
520
+ v[m++] = b & 127 | 128, b >>>= 7;
521
+ v[m] = b;
522
+ }
523
+ function a(b, v) {
524
+ this.len = b, this.next = void 0, this.val = v;
525
+ }
526
+ a.prototype = Object.create(n.prototype), a.prototype.fn = s, i.prototype.uint32 = function(v) {
527
+ return this.len += (this.tail = this.tail.next = new a(
528
+ (v = v >>> 0) < 128 ? 1 : v < 16384 ? 2 : v < 2097152 ? 3 : v < 268435456 ? 4 : 5,
529
+ v
530
+ )).len, this;
531
+ }, i.prototype.int32 = function(v) {
532
+ return v < 0 ? this._push(o, 10, h.fromNumber(v)) : this.uint32(v);
533
+ }, i.prototype.sint32 = function(v) {
534
+ return this.uint32((v << 1 ^ v >> 31) >>> 0);
535
+ };
536
+ function o(b, v, m) {
537
+ for (; b.hi; )
538
+ v[m++] = b.lo & 127 | 128, b.lo = (b.lo >>> 7 | b.hi << 25) >>> 0, b.hi >>>= 7;
539
+ for (; b.lo > 127; )
540
+ v[m++] = b.lo & 127 | 128, b.lo = b.lo >>> 7;
541
+ v[m++] = b.lo;
542
+ }
543
+ i.prototype.uint64 = function(v) {
544
+ var m = h.from(v);
545
+ return this._push(o, m.length(), m);
546
+ }, i.prototype.int64 = i.prototype.uint64, i.prototype.sint64 = function(v) {
547
+ var m = h.from(v).zzEncode();
548
+ return this._push(o, m.length(), m);
549
+ }, i.prototype.bool = function(v) {
550
+ return this._push(f, 1, v ? 1 : 0);
551
+ };
552
+ function p(b, v, m) {
553
+ v[m] = b & 255, v[m + 1] = b >>> 8 & 255, v[m + 2] = b >>> 16 & 255, v[m + 3] = b >>> 24;
554
+ }
555
+ i.prototype.fixed32 = function(v) {
556
+ return this._push(p, 4, v >>> 0);
557
+ }, i.prototype.sfixed32 = i.prototype.fixed32, i.prototype.fixed64 = function(v) {
558
+ var m = h.from(v);
559
+ return this._push(p, 4, m.lo)._push(p, 4, m.hi);
560
+ }, i.prototype.sfixed64 = i.prototype.fixed64, i.prototype.float = function(v) {
561
+ return this._push(d.float.writeFloatLE, 4, v);
562
+ }, i.prototype.double = function(v) {
563
+ return this._push(d.float.writeDoubleLE, 8, v);
564
+ };
565
+ var y = d.Array.prototype.set ? function(v, m, _) {
566
+ m.set(v, _);
567
+ } : function(v, m, _) {
568
+ for (var R = 0; R < v.length; ++R)
569
+ m[_ + R] = v[R];
570
+ };
571
+ return i.prototype.bytes = function(v) {
572
+ var m = v.length >>> 0;
573
+ if (!m)
574
+ return this._push(f, 1, 0);
575
+ if (d.isString(v)) {
576
+ var _ = i.alloc(m = c.length(v));
577
+ c.decode(v, _, 0), v = _;
578
+ }
579
+ return this.uint32(m)._push(y, m, v);
580
+ }, i.prototype.string = function(v) {
581
+ var m = l.length(v);
582
+ return m ? this.uint32(m)._push(l.write, m, v) : this._push(f, 1, 0);
583
+ }, i.prototype.fork = function() {
584
+ return this.states = new r(this), this.head = this.tail = new n(e, 0, 0), this.len = 0, this;
585
+ }, i.prototype.reset = function() {
586
+ 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 n(e, 0, 0), this.len = 0), this;
587
+ }, i.prototype.ldelim = function() {
588
+ var v = this.head, m = this.tail, _ = this.len;
589
+ return this.reset().uint32(_), _ && (this.tail.next = v.next, this.tail = m, this.len += _), this;
590
+ }, i.prototype.finish = function() {
591
+ for (var v = this.head.next, m = this.constructor.alloc(this.len), _ = 0; v; )
592
+ v.fn(v.val, m, _), _ += v.len, v = v.next;
593
+ return m;
594
+ }, i._configure = function(b) {
595
+ u = b, i.create = t(), u._configure();
596
+ }, writer;
597
+ }
598
+ var writer_buffer, hasRequiredWriter_buffer;
599
+ function requireWriter_buffer() {
600
+ if (hasRequiredWriter_buffer) return writer_buffer;
601
+ hasRequiredWriter_buffer = 1, writer_buffer = h;
602
+ var d = requireWriter();
603
+ (h.prototype = Object.create(d.prototype)).constructor = h;
604
+ var u = requireMinimal();
605
+ function h() {
606
+ d.call(this);
607
+ }
608
+ h._configure = function() {
609
+ h.alloc = u._Buffer_allocUnsafe, h.writeBytesBuffer = u.Buffer && u.Buffer.prototype instanceof Uint8Array && u.Buffer.prototype.set.name === "set" ? function(n, e, r) {
610
+ e.set(n, r);
611
+ } : function(n, e, r) {
612
+ if (n.copy)
613
+ n.copy(e, r, 0, n.length);
614
+ else for (var i = 0; i < n.length; )
615
+ e[r++] = n[i++];
616
+ };
617
+ }, h.prototype.bytes = function(n) {
618
+ u.isString(n) && (n = u._Buffer_from(n, "base64"));
619
+ var e = n.length >>> 0;
620
+ return this.uint32(e), e && this._push(h.writeBytesBuffer, e, n), this;
621
+ };
622
+ function c(l, n, e) {
623
+ l.length < 40 ? u.utf8.write(l, n, e) : n.utf8Write ? n.utf8Write(l, e) : n.write(l, e);
624
+ }
625
+ return h.prototype.string = function(n) {
626
+ var e = u.Buffer.byteLength(n);
627
+ return this.uint32(e), e && this._push(c, e, n), this;
628
+ }, h._configure(), writer_buffer;
629
+ }
630
+ var reader, hasRequiredReader;
631
+ function requireReader() {
632
+ if (hasRequiredReader) return reader;
633
+ hasRequiredReader = 1, reader = n;
634
+ var d = requireMinimal(), u, h = d.LongBits, c = d.utf8;
635
+ function l(s, a) {
636
+ return RangeError("index out of range: " + s.pos + " + " + (a || 1) + " > " + s.len);
637
+ }
638
+ function n(s) {
639
+ this.buf = s, this.pos = 0, this.len = s.length;
640
+ }
641
+ var e = typeof Uint8Array < "u" ? function(a) {
642
+ if (a instanceof Uint8Array || Array.isArray(a))
643
+ return new n(a);
644
+ throw Error("illegal buffer");
645
+ } : function(a) {
646
+ if (Array.isArray(a))
647
+ return new n(a);
648
+ throw Error("illegal buffer");
649
+ }, r = function() {
650
+ return d.Buffer ? function(o) {
651
+ return (n.create = function(y) {
652
+ return d.Buffer.isBuffer(y) ? new u(y) : e(y);
653
+ })(o);
654
+ } : e;
655
+ };
656
+ n.create = r(), n.prototype._slice = d.Array.prototype.subarray || /* istanbul ignore next */
657
+ d.Array.prototype.slice, n.prototype.uint32 = /* @__PURE__ */ function() {
658
+ var a = 4294967295;
659
+ return function() {
660
+ if (a = (this.buf[this.pos] & 127) >>> 0, this.buf[this.pos++] < 128 || (a = (a | (this.buf[this.pos] & 127) << 7) >>> 0, this.buf[this.pos++] < 128) || (a = (a | (this.buf[this.pos] & 127) << 14) >>> 0, this.buf[this.pos++] < 128) || (a = (a | (this.buf[this.pos] & 127) << 21) >>> 0, this.buf[this.pos++] < 128) || (a = (a | (this.buf[this.pos] & 15) << 28) >>> 0, this.buf[this.pos++] < 128)) return a;
661
+ if ((this.pos += 5) > this.len)
662
+ throw this.pos = this.len, l(this, 10);
663
+ return a;
664
+ };
665
+ }(), n.prototype.int32 = function() {
666
+ return this.uint32() | 0;
667
+ }, n.prototype.sint32 = function() {
668
+ var a = this.uint32();
669
+ return a >>> 1 ^ -(a & 1) | 0;
670
+ };
671
+ function i() {
672
+ var s = new h(0, 0), a = 0;
673
+ if (this.len - this.pos > 4) {
674
+ for (; a < 4; ++a)
675
+ if (s.lo = (s.lo | (this.buf[this.pos] & 127) << a * 7) >>> 0, this.buf[this.pos++] < 128)
676
+ return s;
677
+ if (s.lo = (s.lo | (this.buf[this.pos] & 127) << 28) >>> 0, s.hi = (s.hi | (this.buf[this.pos] & 127) >> 4) >>> 0, this.buf[this.pos++] < 128)
678
+ return s;
679
+ a = 0;
680
+ } else {
681
+ for (; a < 3; ++a) {
682
+ if (this.pos >= this.len)
683
+ throw l(this);
684
+ if (s.lo = (s.lo | (this.buf[this.pos] & 127) << a * 7) >>> 0, this.buf[this.pos++] < 128)
685
+ return s;
686
+ }
687
+ return s.lo = (s.lo | (this.buf[this.pos++] & 127) << a * 7) >>> 0, s;
688
+ }
689
+ if (this.len - this.pos > 4) {
690
+ for (; a < 5; ++a)
691
+ if (s.hi = (s.hi | (this.buf[this.pos] & 127) << a * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
692
+ return s;
693
+ } else
694
+ for (; a < 5; ++a) {
695
+ if (this.pos >= this.len)
696
+ throw l(this);
697
+ if (s.hi = (s.hi | (this.buf[this.pos] & 127) << a * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
698
+ return s;
699
+ }
700
+ throw Error("invalid varint encoding");
701
+ }
702
+ n.prototype.bool = function() {
703
+ return this.uint32() !== 0;
704
+ };
705
+ function t(s, a) {
706
+ return (s[a - 4] | s[a - 3] << 8 | s[a - 2] << 16 | s[a - 1] << 24) >>> 0;
707
+ }
708
+ n.prototype.fixed32 = function() {
709
+ if (this.pos + 4 > this.len)
710
+ throw l(this, 4);
711
+ return t(this.buf, this.pos += 4);
712
+ }, n.prototype.sfixed32 = function() {
713
+ if (this.pos + 4 > this.len)
714
+ throw l(this, 4);
715
+ return t(this.buf, this.pos += 4) | 0;
716
+ };
717
+ function f() {
718
+ if (this.pos + 8 > this.len)
719
+ throw l(this, 8);
720
+ return new h(t(this.buf, this.pos += 4), t(this.buf, this.pos += 4));
721
+ }
722
+ return n.prototype.float = function() {
723
+ if (this.pos + 4 > this.len)
724
+ throw l(this, 4);
725
+ var a = d.float.readFloatLE(this.buf, this.pos);
726
+ return this.pos += 4, a;
727
+ }, n.prototype.double = function() {
728
+ if (this.pos + 8 > this.len)
729
+ throw l(this, 4);
730
+ var a = d.float.readDoubleLE(this.buf, this.pos);
731
+ return this.pos += 8, a;
732
+ }, n.prototype.bytes = function() {
733
+ var a = this.uint32(), o = this.pos, p = this.pos + a;
734
+ if (p > this.len)
735
+ throw l(this, a);
736
+ if (this.pos += a, Array.isArray(this.buf))
737
+ return this.buf.slice(o, p);
738
+ if (o === p) {
739
+ var y = d.Buffer;
740
+ return y ? y.alloc(0) : new this.buf.constructor(0);
741
+ }
742
+ return this._slice.call(this.buf, o, p);
743
+ }, n.prototype.string = function() {
744
+ var a = this.bytes();
745
+ return c.read(a, 0, a.length);
746
+ }, n.prototype.skip = function(a) {
747
+ if (typeof a == "number") {
748
+ if (this.pos + a > this.len)
749
+ throw l(this, a);
750
+ this.pos += a;
751
+ } else
752
+ do
753
+ if (this.pos >= this.len)
754
+ throw l(this);
755
+ while (this.buf[this.pos++] & 128);
756
+ return this;
757
+ }, n.prototype.skipType = function(s) {
758
+ switch (s) {
759
+ case 0:
760
+ this.skip();
761
+ break;
762
+ case 1:
763
+ this.skip(8);
764
+ break;
765
+ case 2:
766
+ this.skip(this.uint32());
767
+ break;
768
+ case 3:
769
+ for (; (s = this.uint32() & 7) !== 4; )
770
+ this.skipType(s);
771
+ break;
772
+ case 5:
773
+ this.skip(4);
774
+ break;
775
+ /* istanbul ignore next */
776
+ default:
777
+ throw Error("invalid wire type " + s + " at offset " + this.pos);
778
+ }
779
+ return this;
780
+ }, n._configure = function(s) {
781
+ u = s, n.create = r(), u._configure();
782
+ var a = d.Long ? "toLong" : (
783
+ /* istanbul ignore next */
784
+ "toNumber"
785
+ );
786
+ d.merge(n.prototype, {
787
+ int64: function() {
788
+ return i.call(this)[a](!1);
789
+ },
790
+ uint64: function() {
791
+ return i.call(this)[a](!0);
792
+ },
793
+ sint64: function() {
794
+ return i.call(this).zzDecode()[a](!1);
795
+ },
796
+ fixed64: function() {
797
+ return f.call(this)[a](!0);
798
+ },
799
+ sfixed64: function() {
800
+ return f.call(this)[a](!1);
801
+ }
802
+ });
803
+ }, reader;
804
+ }
805
+ var reader_buffer, hasRequiredReader_buffer;
806
+ function requireReader_buffer() {
807
+ if (hasRequiredReader_buffer) return reader_buffer;
808
+ hasRequiredReader_buffer = 1, reader_buffer = h;
809
+ var d = requireReader();
810
+ (h.prototype = Object.create(d.prototype)).constructor = h;
811
+ var u = requireMinimal();
812
+ function h(c) {
813
+ d.call(this, c);
814
+ }
815
+ return h._configure = function() {
816
+ u.Buffer && (h.prototype._slice = u.Buffer.prototype.slice);
817
+ }, h.prototype.string = function() {
818
+ var l = this.uint32();
819
+ return this.buf.utf8Slice ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + l, this.len)) : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + l, this.len));
820
+ }, h._configure(), reader_buffer;
821
+ }
822
+ var rpc = {}, service$1, hasRequiredService$1;
823
+ function requireService$1() {
824
+ if (hasRequiredService$1) return service$1;
825
+ hasRequiredService$1 = 1, service$1 = u;
826
+ var d = requireMinimal();
827
+ (u.prototype = Object.create(d.EventEmitter.prototype)).constructor = u;
828
+ function u(h, c, l) {
829
+ if (typeof h != "function")
830
+ throw TypeError("rpcImpl must be a function");
831
+ d.EventEmitter.call(this), this.rpcImpl = h, this.requestDelimited = !!c, this.responseDelimited = !!l;
832
+ }
833
+ return u.prototype.rpcCall = function h(c, l, n, e, r) {
834
+ if (!e)
835
+ throw TypeError("request must be specified");
836
+ var i = this;
837
+ if (!r)
838
+ return d.asPromise(h, i, c, l, n, e);
839
+ if (!i.rpcImpl) {
840
+ setTimeout(function() {
841
+ r(Error("already ended"));
842
+ }, 0);
843
+ return;
844
+ }
845
+ try {
846
+ return i.rpcImpl(
847
+ c,
848
+ l[i.requestDelimited ? "encodeDelimited" : "encode"](e).finish(),
849
+ function(f, s) {
850
+ if (f)
851
+ return i.emit("error", f, c), r(f);
852
+ if (s === null) {
853
+ i.end(
854
+ /* endedByRPC */
855
+ !0
856
+ );
857
+ return;
858
+ }
859
+ if (!(s instanceof n))
860
+ try {
861
+ s = n[i.responseDelimited ? "decodeDelimited" : "decode"](s);
862
+ } catch (a) {
863
+ return i.emit("error", a, c), r(a);
864
+ }
865
+ return i.emit("data", s, c), r(null, s);
866
+ }
867
+ );
868
+ } catch (t) {
869
+ i.emit("error", t, c), setTimeout(function() {
870
+ r(t);
871
+ }, 0);
872
+ return;
873
+ }
874
+ }, u.prototype.end = function(c) {
875
+ return this.rpcImpl && (c || this.rpcImpl(null, null, null), this.rpcImpl = null, this.emit("end").off()), this;
876
+ }, service$1;
877
+ }
878
+ var hasRequiredRpc;
879
+ function requireRpc() {
880
+ return hasRequiredRpc || (hasRequiredRpc = 1, function(d) {
881
+ var u = d;
882
+ u.Service = requireService$1();
883
+ }(rpc)), rpc;
884
+ }
885
+ var roots, hasRequiredRoots;
886
+ function requireRoots() {
887
+ return hasRequiredRoots || (hasRequiredRoots = 1, roots = {}), roots;
888
+ }
889
+ var hasRequiredIndexMinimal;
890
+ function requireIndexMinimal() {
891
+ return hasRequiredIndexMinimal || (hasRequiredIndexMinimal = 1, function(d) {
892
+ var u = d;
893
+ u.build = "minimal", u.Writer = requireWriter(), u.BufferWriter = requireWriter_buffer(), u.Reader = requireReader(), u.BufferReader = requireReader_buffer(), u.util = requireMinimal(), u.rpc = requireRpc(), u.roots = requireRoots(), u.configure = h;
894
+ function h() {
895
+ u.util._configure(), u.Writer._configure(u.BufferWriter), u.Reader._configure(u.BufferReader);
896
+ }
897
+ h();
898
+ }(indexMinimal)), indexMinimal;
899
+ }
900
+ var types = {}, util = { exports: {} }, codegen_1, hasRequiredCodegen;
901
+ function requireCodegen() {
902
+ if (hasRequiredCodegen) return codegen_1;
903
+ hasRequiredCodegen = 1, codegen_1 = d;
904
+ function d(u, h) {
905
+ typeof u == "string" && (h = u, u = void 0);
906
+ var c = [];
907
+ function l(e) {
908
+ if (typeof e != "string") {
909
+ var r = n();
910
+ if (d.verbose && console.log("codegen: " + r), r = "return " + r, e) {
911
+ for (var i = Object.keys(e), t = new Array(i.length + 1), f = new Array(i.length), s = 0; s < i.length; )
912
+ t[s] = i[s], f[s] = e[i[s++]];
913
+ return t[s] = r, Function.apply(null, t).apply(null, f);
914
+ }
915
+ return Function(r)();
916
+ }
917
+ for (var a = new Array(arguments.length - 1), o = 0; o < a.length; )
918
+ a[o] = arguments[++o];
919
+ if (o = 0, e = e.replace(/%([%dfijs])/g, function(y, b) {
920
+ var v = a[o++];
921
+ switch (b) {
922
+ case "d":
923
+ case "f":
924
+ return String(Number(v));
925
+ case "i":
926
+ return String(Math.floor(v));
927
+ case "j":
928
+ return JSON.stringify(v);
929
+ case "s":
930
+ return String(v);
931
+ }
932
+ return "%";
933
+ }), o !== a.length)
934
+ throw Error("parameter count mismatch");
935
+ return c.push(e), l;
936
+ }
937
+ function n(e) {
938
+ return "function " + (e || h || "") + "(" + (u && u.join(",") || "") + `){
939
+ ` + c.join(`
940
+ `) + `
941
+ }`;
942
+ }
943
+ return l.toString = n, l;
944
+ }
945
+ return d.verbose = !1, codegen_1;
946
+ }
947
+ var fetch_1, hasRequiredFetch;
948
+ function requireFetch() {
949
+ if (hasRequiredFetch) return fetch_1;
950
+ hasRequiredFetch = 1, fetch_1 = c;
951
+ var d = requireAspromise(), u = requireInquire(), h = u("fs");
952
+ function c(l, n, e) {
953
+ return typeof n == "function" ? (e = n, n = {}) : n || (n = {}), e ? !n.xhr && h && h.readFile ? h.readFile(l, function(i, t) {
954
+ return i && typeof XMLHttpRequest < "u" ? c.xhr(l, n, e) : i ? e(i) : e(null, n.binary ? t : t.toString("utf8"));
955
+ }) : c.xhr(l, n, e) : d(c, this, l, n);
956
+ }
957
+ return c.xhr = function(n, e, r) {
958
+ var i = new XMLHttpRequest();
959
+ i.onreadystatechange = function() {
960
+ if (i.readyState === 4) {
961
+ if (i.status !== 0 && i.status !== 200)
962
+ return r(Error("status " + i.status));
963
+ if (e.binary) {
964
+ var f = i.response;
965
+ if (!f) {
966
+ f = [];
967
+ for (var s = 0; s < i.responseText.length; ++s)
968
+ f.push(i.responseText.charCodeAt(s) & 255);
969
+ }
970
+ return r(null, typeof Uint8Array < "u" ? new Uint8Array(f) : f);
971
+ }
972
+ return r(null, i.responseText);
973
+ }
974
+ }, e.binary && ("overrideMimeType" in i && i.overrideMimeType("text/plain; charset=x-user-defined"), i.responseType = "arraybuffer"), i.open("GET", n), i.send();
975
+ }, fetch_1;
976
+ }
977
+ var path = {}, hasRequiredPath;
978
+ function requirePath() {
979
+ return hasRequiredPath || (hasRequiredPath = 1, function(d) {
980
+ var u = d, h = (
981
+ /**
982
+ * Tests if the specified path is absolute.
983
+ * @param {string} path Path to test
984
+ * @returns {boolean} `true` if path is absolute
985
+ */
986
+ u.isAbsolute = function(n) {
987
+ return /^(?:\/|\w+:)/.test(n);
988
+ }
989
+ ), c = (
990
+ /**
991
+ * Normalizes the specified path.
992
+ * @param {string} path Path to normalize
993
+ * @returns {string} Normalized path
994
+ */
995
+ u.normalize = function(n) {
996
+ n = n.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
997
+ var e = n.split("/"), r = h(n), i = "";
998
+ r && (i = e.shift() + "/");
999
+ for (var t = 0; t < e.length; )
1000
+ e[t] === ".." ? t > 0 && e[t - 1] !== ".." ? e.splice(--t, 2) : r ? e.splice(t, 1) : ++t : e[t] === "." ? e.splice(t, 1) : ++t;
1001
+ return i + e.join("/");
1002
+ }
1003
+ );
1004
+ u.resolve = function(n, e, r) {
1005
+ return r || (e = c(e)), h(e) ? e : (r || (n = c(n)), (n = n.replace(/(?:\/|^)[^/]+$/, "")).length ? c(n + "/" + e) : e);
1006
+ };
1007
+ }(path)), path;
1008
+ }
1009
+ var namespace, hasRequiredNamespace;
1010
+ function requireNamespace() {
1011
+ if (hasRequiredNamespace) return namespace;
1012
+ hasRequiredNamespace = 1, namespace = i;
1013
+ var d = requireObject();
1014
+ ((i.prototype = Object.create(d.prototype)).constructor = i).className = "Namespace";
1015
+ var u = requireField(), h = requireUtil(), c = requireOneof(), l, n, e;
1016
+ i.fromJSON = function(s, a) {
1017
+ return new i(s, a.options).addJSON(a.nested);
1018
+ };
1019
+ function r(f, s) {
1020
+ if (f && f.length) {
1021
+ for (var a = {}, o = 0; o < f.length; ++o)
1022
+ a[f[o].name] = f[o].toJSON(s);
1023
+ return a;
1024
+ }
1025
+ }
1026
+ i.arrayToJSON = r, i.isReservedId = function(s, a) {
1027
+ if (s) {
1028
+ for (var o = 0; o < s.length; ++o)
1029
+ if (typeof s[o] != "string" && s[o][0] <= a && s[o][1] > a)
1030
+ return !0;
1031
+ }
1032
+ return !1;
1033
+ }, i.isReservedName = function(s, a) {
1034
+ if (s) {
1035
+ for (var o = 0; o < s.length; ++o)
1036
+ if (s[o] === a)
1037
+ return !0;
1038
+ }
1039
+ return !1;
1040
+ };
1041
+ function i(f, s) {
1042
+ d.call(this, f, s), this.nested = void 0, this._nestedArray = null, this._lookupCache = {}, this._needsRecursiveFeatureResolution = !0, this._needsRecursiveResolve = !0;
1043
+ }
1044
+ function t(f) {
1045
+ f._nestedArray = null, f._lookupCache = {};
1046
+ for (var s = f; s = s.parent; )
1047
+ s._lookupCache = {};
1048
+ return f;
1049
+ }
1050
+ return Object.defineProperty(i.prototype, "nestedArray", {
1051
+ get: function() {
1052
+ return this._nestedArray || (this._nestedArray = h.toArray(this.nested));
1053
+ }
1054
+ }), i.prototype.toJSON = function(s) {
1055
+ return h.toObject([
1056
+ "options",
1057
+ this.options,
1058
+ "nested",
1059
+ r(this.nestedArray, s)
1060
+ ]);
1061
+ }, i.prototype.addJSON = function(s) {
1062
+ var a = this;
1063
+ if (s)
1064
+ for (var o = Object.keys(s), p = 0, y; p < o.length; ++p)
1065
+ y = s[o[p]], a.add(
1066
+ // most to least likely
1067
+ (y.fields !== void 0 ? l.fromJSON : y.values !== void 0 ? e.fromJSON : y.methods !== void 0 ? n.fromJSON : y.id !== void 0 ? u.fromJSON : i.fromJSON)(o[p], y)
1068
+ );
1069
+ return this;
1070
+ }, i.prototype.get = function(s) {
1071
+ return this.nested && this.nested[s] || null;
1072
+ }, i.prototype.getEnum = function(s) {
1073
+ if (this.nested && this.nested[s] instanceof e)
1074
+ return this.nested[s].values;
1075
+ throw Error("no such enum: " + s);
1076
+ }, i.prototype.add = function(s) {
1077
+ if (!(s instanceof u && s.extend !== void 0 || s instanceof l || s instanceof c || s instanceof e || s instanceof n || s instanceof i))
1078
+ throw TypeError("object must be a valid nested object");
1079
+ if (!this.nested)
1080
+ this.nested = {};
1081
+ else {
1082
+ var a = this.get(s.name);
1083
+ if (a)
1084
+ if (a instanceof i && s instanceof i && !(a instanceof l || a instanceof n)) {
1085
+ for (var o = a.nestedArray, p = 0; p < o.length; ++p)
1086
+ s.add(o[p]);
1087
+ this.remove(a), this.nested || (this.nested = {}), s.setOptions(a.options, !0);
1088
+ } else
1089
+ throw Error("duplicate name '" + s.name + "' in " + this);
1090
+ }
1091
+ this.nested[s.name] = s, this instanceof l || this instanceof n || this instanceof e || this instanceof u || s._edition || (s._edition = s._defaultEdition), this._needsRecursiveFeatureResolution = !0, this._needsRecursiveResolve = !0;
1092
+ for (var y = this; y = y.parent; )
1093
+ y._needsRecursiveFeatureResolution = !0, y._needsRecursiveResolve = !0;
1094
+ return s.onAdd(this), t(this);
1095
+ }, i.prototype.remove = function(s) {
1096
+ if (!(s instanceof d))
1097
+ throw TypeError("object must be a ReflectionObject");
1098
+ if (s.parent !== this)
1099
+ throw Error(s + " is not a member of " + this);
1100
+ return delete this.nested[s.name], Object.keys(this.nested).length || (this.nested = void 0), s.onRemove(this), t(this);
1101
+ }, i.prototype.define = function(s, a) {
1102
+ if (h.isString(s))
1103
+ s = s.split(".");
1104
+ else if (!Array.isArray(s))
1105
+ throw TypeError("illegal path");
1106
+ if (s && s.length && s[0] === "")
1107
+ throw Error("path must be relative");
1108
+ for (var o = this; s.length > 0; ) {
1109
+ var p = s.shift();
1110
+ if (o.nested && o.nested[p]) {
1111
+ if (o = o.nested[p], !(o instanceof i))
1112
+ throw Error("path conflicts with non-namespace objects");
1113
+ } else
1114
+ o.add(o = new i(p));
1115
+ }
1116
+ return a && o.addJSON(a), o;
1117
+ }, i.prototype.resolveAll = function() {
1118
+ if (!this._needsRecursiveResolve) return this;
1119
+ this._resolveFeaturesRecursive(this._edition);
1120
+ var s = this.nestedArray, a = 0;
1121
+ for (this.resolve(); a < s.length; )
1122
+ s[a] instanceof i ? s[a++].resolveAll() : s[a++].resolve();
1123
+ return this._needsRecursiveResolve = !1, this;
1124
+ }, i.prototype._resolveFeaturesRecursive = function(s) {
1125
+ return this._needsRecursiveFeatureResolution ? (this._needsRecursiveFeatureResolution = !1, s = this._edition || s, d.prototype._resolveFeaturesRecursive.call(this, s), this.nestedArray.forEach((a) => {
1126
+ a._resolveFeaturesRecursive(s);
1127
+ }), this) : this;
1128
+ }, i.prototype.lookup = function(s, a, o) {
1129
+ if (typeof a == "boolean" ? (o = a, a = void 0) : a && !Array.isArray(a) && (a = [a]), h.isString(s) && s.length) {
1130
+ if (s === ".")
1131
+ return this.root;
1132
+ s = s.split(".");
1133
+ } else if (!s.length)
1134
+ return this;
1135
+ var p = s.join(".");
1136
+ if (s[0] === "")
1137
+ return this.root.lookup(s.slice(1), a);
1138
+ var y = this.root._fullyQualifiedObjects && this.root._fullyQualifiedObjects["." + p];
1139
+ if (y && (!a || a.indexOf(y.constructor) > -1) || (y = this._lookupImpl(s, p), y && (!a || a.indexOf(y.constructor) > -1)))
1140
+ return y;
1141
+ if (o)
1142
+ return null;
1143
+ for (var b = this; b.parent; ) {
1144
+ if (y = b.parent._lookupImpl(s, p), y && (!a || a.indexOf(y.constructor) > -1))
1145
+ return y;
1146
+ b = b.parent;
1147
+ }
1148
+ return null;
1149
+ }, i.prototype._lookupImpl = function(s, a) {
1150
+ if (Object.prototype.hasOwnProperty.call(this._lookupCache, a))
1151
+ return this._lookupCache[a];
1152
+ var o = this.get(s[0]), p = null;
1153
+ if (o)
1154
+ s.length === 1 ? p = o : o instanceof i && (s = s.slice(1), p = o._lookupImpl(s, s.join(".")));
1155
+ else
1156
+ for (var y = 0; y < this.nestedArray.length; ++y)
1157
+ this._nestedArray[y] instanceof i && (o = this._nestedArray[y]._lookupImpl(s, a)) && (p = o);
1158
+ return this._lookupCache[a] = p, p;
1159
+ }, i.prototype.lookupType = function(s) {
1160
+ var a = this.lookup(s, [l]);
1161
+ if (!a)
1162
+ throw Error("no such type: " + s);
1163
+ return a;
1164
+ }, i.prototype.lookupEnum = function(s) {
1165
+ var a = this.lookup(s, [e]);
1166
+ if (!a)
1167
+ throw Error("no such Enum '" + s + "' in " + this);
1168
+ return a;
1169
+ }, i.prototype.lookupTypeOrEnum = function(s) {
1170
+ var a = this.lookup(s, [l, e]);
1171
+ if (!a)
1172
+ throw Error("no such Type or Enum '" + s + "' in " + this);
1173
+ return a;
1174
+ }, i.prototype.lookupService = function(s) {
1175
+ var a = this.lookup(s, [n]);
1176
+ if (!a)
1177
+ throw Error("no such Service '" + s + "' in " + this);
1178
+ return a;
1179
+ }, i._configure = function(f, s, a) {
1180
+ l = f, n = s, e = a;
1181
+ }, namespace;
1182
+ }
1183
+ var mapfield, hasRequiredMapfield;
1184
+ function requireMapfield() {
1185
+ if (hasRequiredMapfield) return mapfield;
1186
+ hasRequiredMapfield = 1, mapfield = c;
1187
+ var d = requireField();
1188
+ ((c.prototype = Object.create(d.prototype)).constructor = c).className = "MapField";
1189
+ var u = requireTypes(), h = requireUtil();
1190
+ function c(l, n, e, r, i, t) {
1191
+ if (d.call(this, l, n, r, void 0, void 0, i, t), !h.isString(e))
1192
+ throw TypeError("keyType must be a string");
1193
+ this.keyType = e, this.resolvedKeyType = null, this.map = !0;
1194
+ }
1195
+ return c.fromJSON = function(n, e) {
1196
+ return new c(n, e.id, e.keyType, e.type, e.options, e.comment);
1197
+ }, c.prototype.toJSON = function(n) {
1198
+ var e = n ? !!n.keepComments : !1;
1199
+ return h.toObject([
1200
+ "keyType",
1201
+ this.keyType,
1202
+ "type",
1203
+ this.type,
1204
+ "id",
1205
+ this.id,
1206
+ "extend",
1207
+ this.extend,
1208
+ "options",
1209
+ this.options,
1210
+ "comment",
1211
+ e ? this.comment : void 0
1212
+ ]);
1213
+ }, c.prototype.resolve = function() {
1214
+ if (this.resolved)
1215
+ return this;
1216
+ if (u.mapKey[this.keyType] === void 0)
1217
+ throw Error("invalid key type: " + this.keyType);
1218
+ return d.prototype.resolve.call(this);
1219
+ }, c.d = function(n, e, r) {
1220
+ return typeof r == "function" ? r = h.decorateType(r).name : r && typeof r == "object" && (r = h.decorateEnum(r).name), function(t, f) {
1221
+ h.decorateType(t.constructor).add(new c(f, n, e, r));
1222
+ };
1223
+ }, mapfield;
1224
+ }
1225
+ var method, hasRequiredMethod;
1226
+ function requireMethod() {
1227
+ if (hasRequiredMethod) return method;
1228
+ hasRequiredMethod = 1, method = h;
1229
+ var d = requireObject();
1230
+ ((h.prototype = Object.create(d.prototype)).constructor = h).className = "Method";
1231
+ var u = requireUtil();
1232
+ function h(c, l, n, e, r, i, t, f, s) {
1233
+ if (u.isObject(r) ? (t = r, r = i = void 0) : u.isObject(i) && (t = i, i = void 0), !(l === void 0 || u.isString(l)))
1234
+ throw TypeError("type must be a string");
1235
+ if (!u.isString(n))
1236
+ throw TypeError("requestType must be a string");
1237
+ if (!u.isString(e))
1238
+ throw TypeError("responseType must be a string");
1239
+ d.call(this, c, t), this.type = l || "rpc", this.requestType = n, this.requestStream = r ? !0 : void 0, this.responseType = e, this.responseStream = i ? !0 : void 0, this.resolvedRequestType = null, this.resolvedResponseType = null, this.comment = f, this.parsedOptions = s;
1240
+ }
1241
+ return h.fromJSON = function(l, n) {
1242
+ return new h(l, n.type, n.requestType, n.responseType, n.requestStream, n.responseStream, n.options, n.comment, n.parsedOptions);
1243
+ }, h.prototype.toJSON = function(l) {
1244
+ var n = l ? !!l.keepComments : !1;
1245
+ return u.toObject([
1246
+ "type",
1247
+ this.type !== "rpc" && /* istanbul ignore next */
1248
+ this.type || void 0,
1249
+ "requestType",
1250
+ this.requestType,
1251
+ "requestStream",
1252
+ this.requestStream,
1253
+ "responseType",
1254
+ this.responseType,
1255
+ "responseStream",
1256
+ this.responseStream,
1257
+ "options",
1258
+ this.options,
1259
+ "comment",
1260
+ n ? this.comment : void 0,
1261
+ "parsedOptions",
1262
+ this.parsedOptions
1263
+ ]);
1264
+ }, h.prototype.resolve = function() {
1265
+ return this.resolved ? this : (this.resolvedRequestType = this.parent.lookupType(this.requestType), this.resolvedResponseType = this.parent.lookupType(this.responseType), d.prototype.resolve.call(this));
1266
+ }, method;
1267
+ }
1268
+ var service, hasRequiredService;
1269
+ function requireService() {
1270
+ if (hasRequiredService) return service;
1271
+ hasRequiredService = 1, service = l;
1272
+ var d = requireNamespace();
1273
+ ((l.prototype = Object.create(d.prototype)).constructor = l).className = "Service";
1274
+ var u = requireMethod(), h = requireUtil(), c = requireRpc();
1275
+ function l(e, r) {
1276
+ d.call(this, e, r), this.methods = {}, this._methodsArray = null;
1277
+ }
1278
+ l.fromJSON = function(r, i) {
1279
+ var t = new l(r, i.options);
1280
+ if (i.methods)
1281
+ for (var f = Object.keys(i.methods), s = 0; s < f.length; ++s)
1282
+ t.add(u.fromJSON(f[s], i.methods[f[s]]));
1283
+ return i.nested && t.addJSON(i.nested), i.edition && (t._edition = i.edition), t.comment = i.comment, t._defaultEdition = "proto3", t;
1284
+ }, l.prototype.toJSON = function(r) {
1285
+ var i = d.prototype.toJSON.call(this, r), t = r ? !!r.keepComments : !1;
1286
+ return h.toObject([
1287
+ "edition",
1288
+ this._editionToJSON(),
1289
+ "options",
1290
+ i && i.options || void 0,
1291
+ "methods",
1292
+ d.arrayToJSON(this.methodsArray, r) || /* istanbul ignore next */
1293
+ {},
1294
+ "nested",
1295
+ i && i.nested || void 0,
1296
+ "comment",
1297
+ t ? this.comment : void 0
1298
+ ]);
1299
+ }, Object.defineProperty(l.prototype, "methodsArray", {
1300
+ get: function() {
1301
+ return this._methodsArray || (this._methodsArray = h.toArray(this.methods));
1302
+ }
1303
+ });
1304
+ function n(e) {
1305
+ return e._methodsArray = null, e;
1306
+ }
1307
+ return l.prototype.get = function(r) {
1308
+ return this.methods[r] || d.prototype.get.call(this, r);
1309
+ }, l.prototype.resolveAll = function() {
1310
+ if (!this._needsRecursiveResolve) return this;
1311
+ d.prototype.resolve.call(this);
1312
+ for (var r = this.methodsArray, i = 0; i < r.length; ++i)
1313
+ r[i].resolve();
1314
+ return this;
1315
+ }, l.prototype._resolveFeaturesRecursive = function(r) {
1316
+ return this._needsRecursiveFeatureResolution ? (r = this._edition || r, d.prototype._resolveFeaturesRecursive.call(this, r), this.methodsArray.forEach((i) => {
1317
+ i._resolveFeaturesRecursive(r);
1318
+ }), this) : this;
1319
+ }, l.prototype.add = function(r) {
1320
+ if (this.get(r.name))
1321
+ throw Error("duplicate name '" + r.name + "' in " + this);
1322
+ return r instanceof u ? (this.methods[r.name] = r, r.parent = this, n(this)) : d.prototype.add.call(this, r);
1323
+ }, l.prototype.remove = function(r) {
1324
+ if (r instanceof u) {
1325
+ if (this.methods[r.name] !== r)
1326
+ throw Error(r + " is not a member of " + this);
1327
+ return delete this.methods[r.name], r.parent = null, n(this);
1328
+ }
1329
+ return d.prototype.remove.call(this, r);
1330
+ }, l.prototype.create = function(r, i, t) {
1331
+ for (var f = new c.Service(r, i, t), s = 0, a; s < /* initializes */
1332
+ this.methodsArray.length; ++s) {
1333
+ var o = h.lcFirst((a = this._methodsArray[s]).resolve().name).replace(/[^$\w_]/g, "");
1334
+ f[o] = h.codegen(["r", "c"], h.isReserved(o) ? o + "_" : o)("return this.rpcCall(m,q,s,r,c)")({
1335
+ m: a,
1336
+ q: a.resolvedRequestType.ctor,
1337
+ s: a.resolvedResponseType.ctor
1338
+ });
1339
+ }
1340
+ return f;
1341
+ }, service;
1342
+ }
1343
+ var message, hasRequiredMessage;
1344
+ function requireMessage() {
1345
+ if (hasRequiredMessage) return message;
1346
+ hasRequiredMessage = 1, message = u;
1347
+ var d = requireMinimal();
1348
+ function u(h) {
1349
+ if (h)
1350
+ for (var c = Object.keys(h), l = 0; l < c.length; ++l) {
1351
+ var n = c[l];
1352
+ n !== "__proto__" && (this[n] = h[n]);
1353
+ }
1354
+ }
1355
+ return u.create = function(c) {
1356
+ return this.$type.create(c);
1357
+ }, u.encode = function(c, l) {
1358
+ return this.$type.encode(c, l);
1359
+ }, u.encodeDelimited = function(c, l) {
1360
+ return this.$type.encodeDelimited(c, l);
1361
+ }, u.decode = function(c) {
1362
+ return this.$type.decode(c);
1363
+ }, u.decodeDelimited = function(c) {
1364
+ return this.$type.decodeDelimited(c);
1365
+ }, u.verify = function(c) {
1366
+ return this.$type.verify(c);
1367
+ }, u.fromObject = function(c) {
1368
+ return this.$type.fromObject(c);
1369
+ }, u.toObject = function(c, l) {
1370
+ return this.$type.toObject(c, l);
1371
+ }, u.prototype.toJSON = function() {
1372
+ return this.$type.toObject(this, d.toJSONOptions);
1373
+ }, message;
1374
+ }
1375
+ var decoder_1, hasRequiredDecoder;
1376
+ function requireDecoder() {
1377
+ if (hasRequiredDecoder) return decoder_1;
1378
+ hasRequiredDecoder = 1, decoder_1 = l;
1379
+ var d = require_enum(), u = requireTypes(), h = requireUtil();
1380
+ function c(n) {
1381
+ return "missing required '" + n.name + "'";
1382
+ }
1383
+ function l(n) {
1384
+ for (var e = h.codegen(["r", "l", "e"], n.name + "$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor" + (n.fieldsArray.filter(function(a) {
1385
+ return a.map;
1386
+ }).length ? ",k,value" : ""))("while(r.pos<c){")("var t=r.uint32()")("if(t===e)")("break")("switch(t>>>3){"), r = 0; r < /* initializes */
1387
+ n.fieldsArray.length; ++r) {
1388
+ var i = n._fieldsArray[r].resolve(), t = i.resolvedType instanceof d ? "int32" : i.type, f = "m" + h.safeProp(i.name);
1389
+ e("case %i: {", i.id), i.map ? (e("if(%s===util.emptyObject)", f)("%s={}", f)("var c2 = r.uint32()+r.pos"), u.defaults[i.keyType] !== void 0 ? e("k=%j", u.defaults[i.keyType]) : e("k=null"), u.defaults[t] !== void 0 ? e("value=%j", u.defaults[t]) : e("value=null"), e("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break", i.keyType)("case 2:"), u.basic[t] === void 0 ? e("value=types[%i].decode(r,r.uint32())", r) : e("value=r.%s()", t), e("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"), u.long[i.keyType] !== void 0 ? e('%s[typeof k==="object"?util.longToHash(k):k]=value', f) : e("%s[k]=value", f)) : i.repeated ? (e("if(!(%s&&%s.length))", f, f)("%s=[]", f), u.packed[t] !== void 0 && e("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())", f, t)("}else"), u.basic[t] === void 0 ? e(i.delimited ? "%s.push(types[%i].decode(r,undefined,((t&~7)|4)))" : "%s.push(types[%i].decode(r,r.uint32()))", f, r) : e("%s.push(r.%s())", f, t)) : u.basic[t] === void 0 ? e(i.delimited ? "%s=types[%i].decode(r,undefined,((t&~7)|4))" : "%s=types[%i].decode(r,r.uint32())", f, r) : e("%s=r.%s()", f, t), e("break")("}");
1390
+ }
1391
+ for (e("default:")("r.skipType(t&7)")("break")("}")("}"), r = 0; r < n._fieldsArray.length; ++r) {
1392
+ var s = n._fieldsArray[r];
1393
+ s.required && e("if(!m.hasOwnProperty(%j))", s.name)("throw util.ProtocolError(%j,{instance:m})", c(s));
1394
+ }
1395
+ return e("return m");
1396
+ }
1397
+ return decoder_1;
1398
+ }
1399
+ var verifier_1, hasRequiredVerifier;
1400
+ function requireVerifier() {
1401
+ if (hasRequiredVerifier) return verifier_1;
1402
+ hasRequiredVerifier = 1, verifier_1 = n;
1403
+ var d = require_enum(), u = requireUtil();
1404
+ function h(e, r) {
1405
+ return e.name + ": " + r + (e.repeated && r !== "array" ? "[]" : e.map && r !== "object" ? "{k:" + e.keyType + "}" : "") + " expected";
1406
+ }
1407
+ function c(e, r, i, t) {
1408
+ if (r.resolvedType)
1409
+ if (r.resolvedType instanceof d) {
1410
+ e("switch(%s){", t)("default:")("return%j", h(r, "enum value"));
1411
+ for (var f = Object.keys(r.resolvedType.values), s = 0; s < f.length; ++s) e("case %i:", r.resolvedType.values[f[s]]);
1412
+ e("break")("}");
1413
+ } else
1414
+ e("{")("var e=types[%i].verify(%s);", i, t)("if(e)")("return%j+e", r.name + ".")("}");
1415
+ else
1416
+ switch (r.type) {
1417
+ case "int32":
1418
+ case "uint32":
1419
+ case "sint32":
1420
+ case "fixed32":
1421
+ case "sfixed32":
1422
+ e("if(!util.isInteger(%s))", t)("return%j", h(r, "integer"));
1423
+ break;
1424
+ case "int64":
1425
+ case "uint64":
1426
+ case "sint64":
1427
+ case "fixed64":
1428
+ case "sfixed64":
1429
+ e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))", t, t, t, t)("return%j", h(r, "integer|Long"));
1430
+ break;
1431
+ case "float":
1432
+ case "double":
1433
+ e('if(typeof %s!=="number")', t)("return%j", h(r, "number"));
1434
+ break;
1435
+ case "bool":
1436
+ e('if(typeof %s!=="boolean")', t)("return%j", h(r, "boolean"));
1437
+ break;
1438
+ case "string":
1439
+ e("if(!util.isString(%s))", t)("return%j", h(r, "string"));
1440
+ break;
1441
+ case "bytes":
1442
+ e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))', t, t, t)("return%j", h(r, "buffer"));
1443
+ break;
1444
+ }
1445
+ return e;
1446
+ }
1447
+ function l(e, r, i) {
1448
+ switch (r.keyType) {
1449
+ case "int32":
1450
+ case "uint32":
1451
+ case "sint32":
1452
+ case "fixed32":
1453
+ case "sfixed32":
1454
+ e("if(!util.key32Re.test(%s))", i)("return%j", h(r, "integer key"));
1455
+ break;
1456
+ case "int64":
1457
+ case "uint64":
1458
+ case "sint64":
1459
+ case "fixed64":
1460
+ case "sfixed64":
1461
+ e("if(!util.key64Re.test(%s))", i)("return%j", h(r, "integer|Long key"));
1462
+ break;
1463
+ case "bool":
1464
+ e("if(!util.key2Re.test(%s))", i)("return%j", h(r, "boolean key"));
1465
+ break;
1466
+ }
1467
+ return e;
1468
+ }
1469
+ function n(e) {
1470
+ var r = u.codegen(["m"], e.name + "$verify")('if(typeof m!=="object"||m===null)')("return%j", "object expected"), i = e.oneofsArray, t = {};
1471
+ i.length && r("var p={}");
1472
+ for (var f = 0; f < /* initializes */
1473
+ e.fieldsArray.length; ++f) {
1474
+ var s = e._fieldsArray[f].resolve(), a = "m" + u.safeProp(s.name);
1475
+ if (s.optional && r("if(%s!=null&&m.hasOwnProperty(%j)){", a, s.name), s.map)
1476
+ r("if(!util.isObject(%s))", a)("return%j", h(s, "object"))("var k=Object.keys(%s)", a)("for(var i=0;i<k.length;++i){"), l(r, s, "k[i]"), c(r, s, f, a + "[k[i]]")("}");
1477
+ else if (s.repeated)
1478
+ r("if(!Array.isArray(%s))", a)("return%j", h(s, "array"))("for(var i=0;i<%s.length;++i){", a), c(r, s, f, a + "[i]")("}");
1479
+ else {
1480
+ if (s.partOf) {
1481
+ var o = u.safeProp(s.partOf.name);
1482
+ t[s.partOf.name] === 1 && r("if(p%s===1)", o)("return%j", s.partOf.name + ": multiple values"), t[s.partOf.name] = 1, r("p%s=1", o);
1483
+ }
1484
+ c(r, s, f, a);
1485
+ }
1486
+ s.optional && r("}");
1487
+ }
1488
+ return r("return null");
1489
+ }
1490
+ return verifier_1;
1491
+ }
1492
+ var converter = {}, hasRequiredConverter;
1493
+ function requireConverter() {
1494
+ return hasRequiredConverter || (hasRequiredConverter = 1, function(d) {
1495
+ var u = d, h = require_enum(), c = requireUtil();
1496
+ function l(e, r, i, t) {
1497
+ var f = !1;
1498
+ if (r.resolvedType)
1499
+ if (r.resolvedType instanceof h) {
1500
+ e("switch(d%s){", t);
1501
+ for (var s = r.resolvedType.values, a = Object.keys(s), o = 0; o < a.length; ++o)
1502
+ s[a[o]] === r.typeDefault && !f && (e("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}', t, t, t), r.repeated || e("break"), f = !0), e("case%j:", a[o])("case %i:", s[a[o]])("m%s=%j", t, s[a[o]])("break");
1503
+ e("}");
1504
+ } else e('if(typeof d%s!=="object")', t)("throw TypeError(%j)", r.fullName + ": object expected")("m%s=types[%i].fromObject(d%s)", t, i, t);
1505
+ else {
1506
+ var p = !1;
1507
+ switch (r.type) {
1508
+ case "double":
1509
+ case "float":
1510
+ e("m%s=Number(d%s)", t, t);
1511
+ break;
1512
+ case "uint32":
1513
+ case "fixed32":
1514
+ e("m%s=d%s>>>0", t, t);
1515
+ break;
1516
+ case "int32":
1517
+ case "sint32":
1518
+ case "sfixed32":
1519
+ e("m%s=d%s|0", t, t);
1520
+ break;
1521
+ case "uint64":
1522
+ p = !0;
1523
+ // eslint-disable-next-line no-fallthrough
1524
+ case "int64":
1525
+ case "sint64":
1526
+ case "fixed64":
1527
+ case "sfixed64":
1528
+ e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j", t, t, p)('else if(typeof d%s==="string")', t)("m%s=parseInt(d%s,10)", t, t)('else if(typeof d%s==="number")', t)("m%s=d%s", t, t)('else if(typeof d%s==="object")', t)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)", t, t, t, p ? "true" : "");
1529
+ break;
1530
+ case "bytes":
1531
+ e('if(typeof d%s==="string")', t)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)", t, t, t)("else if(d%s.length >= 0)", t)("m%s=d%s", t, t);
1532
+ break;
1533
+ case "string":
1534
+ e("m%s=String(d%s)", t, t);
1535
+ break;
1536
+ case "bool":
1537
+ e("m%s=Boolean(d%s)", t, t);
1538
+ break;
1539
+ }
1540
+ }
1541
+ return e;
1542
+ }
1543
+ u.fromObject = function(r) {
1544
+ var i = r.fieldsArray, t = c.codegen(["d"], r.name + "$fromObject")("if(d instanceof this.ctor)")("return d");
1545
+ if (!i.length) return t("return new this.ctor");
1546
+ t("var m=new this.ctor");
1547
+ for (var f = 0; f < i.length; ++f) {
1548
+ var s = i[f].resolve(), a = c.safeProp(s.name);
1549
+ s.map ? (t("if(d%s){", a)('if(typeof d%s!=="object")', a)("throw TypeError(%j)", s.fullName + ": object expected")("m%s={}", a)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){", a), l(
1550
+ t,
1551
+ s,
1552
+ /* not sorted */
1553
+ f,
1554
+ a + "[ks[i]]"
1555
+ )("}")("}")) : s.repeated ? (t("if(d%s){", a)("if(!Array.isArray(d%s))", a)("throw TypeError(%j)", s.fullName + ": array expected")("m%s=[]", a)("for(var i=0;i<d%s.length;++i){", a), l(
1556
+ t,
1557
+ s,
1558
+ /* not sorted */
1559
+ f,
1560
+ a + "[i]"
1561
+ )("}")("}")) : (s.resolvedType instanceof h || t("if(d%s!=null){", a), l(
1562
+ t,
1563
+ s,
1564
+ /* not sorted */
1565
+ f,
1566
+ a
1567
+ ), s.resolvedType instanceof h || t("}"));
1568
+ }
1569
+ return t("return m");
1570
+ };
1571
+ function n(e, r, i, t) {
1572
+ if (r.resolvedType)
1573
+ r.resolvedType instanceof h ? e("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s", t, i, t, t, i, t, t) : e("d%s=types[%i].toObject(m%s,o)", t, i, t);
1574
+ else {
1575
+ var f = !1;
1576
+ switch (r.type) {
1577
+ case "double":
1578
+ case "float":
1579
+ e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s", t, t, t, t);
1580
+ break;
1581
+ case "uint64":
1582
+ f = !0;
1583
+ // eslint-disable-next-line no-fallthrough
1584
+ case "int64":
1585
+ case "sint64":
1586
+ case "fixed64":
1587
+ case "sfixed64":
1588
+ e('if(typeof m%s==="number")', t)("d%s=o.longs===String?String(m%s):m%s", t, t, t)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s", t, t, t, t, f ? "true" : "", t);
1589
+ break;
1590
+ case "bytes":
1591
+ e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s", t, t, t, t, t);
1592
+ break;
1593
+ default:
1594
+ e("d%s=m%s", t, t);
1595
+ break;
1596
+ }
1597
+ }
1598
+ return e;
1599
+ }
1600
+ u.toObject = function(r) {
1601
+ var i = r.fieldsArray.slice().sort(c.compareFieldsById);
1602
+ if (!i.length)
1603
+ return c.codegen()("return {}");
1604
+ for (var t = c.codegen(["m", "o"], r.name + "$toObject")("if(!o)")("o={}")("var d={}"), f = [], s = [], a = [], o = 0; o < i.length; ++o)
1605
+ i[o].partOf || (i[o].resolve().repeated ? f : i[o].map ? s : a).push(i[o]);
1606
+ if (f.length) {
1607
+ for (t("if(o.arrays||o.defaults){"), o = 0; o < f.length; ++o) t("d%s=[]", c.safeProp(f[o].name));
1608
+ t("}");
1609
+ }
1610
+ if (s.length) {
1611
+ for (t("if(o.objects||o.defaults){"), o = 0; o < s.length; ++o) t("d%s={}", c.safeProp(s[o].name));
1612
+ t("}");
1613
+ }
1614
+ if (a.length) {
1615
+ for (t("if(o.defaults){"), o = 0; o < a.length; ++o) {
1616
+ var p = a[o], y = c.safeProp(p.name);
1617
+ if (p.resolvedType instanceof h) t("d%s=o.enums===String?%j:%j", y, p.resolvedType.valuesById[p.typeDefault], p.typeDefault);
1618
+ else if (p.long) t("if(util.Long){")("var n=new util.Long(%i,%i,%j)", p.typeDefault.low, p.typeDefault.high, p.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n", y)("}else")("d%s=o.longs===String?%j:%i", y, p.typeDefault.toString(), p.typeDefault.toNumber());
1619
+ else if (p.bytes) {
1620
+ var b = "[" + Array.prototype.slice.call(p.typeDefault).join(",") + "]";
1621
+ t("if(o.bytes===String)d%s=%j", y, String.fromCharCode.apply(String, p.typeDefault))("else{")("d%s=%s", y, b)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)", y, y)("}");
1622
+ } else t("d%s=%j", y, p.typeDefault);
1623
+ }
1624
+ t("}");
1625
+ }
1626
+ var v = !1;
1627
+ for (o = 0; o < i.length; ++o) {
1628
+ var p = i[o], m = r._fieldsArray.indexOf(p), y = c.safeProp(p.name);
1629
+ p.map ? (v || (v = !0, t("var ks2")), t("if(m%s&&(ks2=Object.keys(m%s)).length){", y, y)("d%s={}", y)("for(var j=0;j<ks2.length;++j){"), n(
1630
+ t,
1631
+ p,
1632
+ /* sorted */
1633
+ m,
1634
+ y + "[ks2[j]]"
1635
+ )("}")) : p.repeated ? (t("if(m%s&&m%s.length){", y, y)("d%s=[]", y)("for(var j=0;j<m%s.length;++j){", y), n(
1636
+ t,
1637
+ p,
1638
+ /* sorted */
1639
+ m,
1640
+ y + "[j]"
1641
+ )("}")) : (t("if(m%s!=null&&m.hasOwnProperty(%j)){", y, p.name), n(
1642
+ t,
1643
+ p,
1644
+ /* sorted */
1645
+ m,
1646
+ y
1647
+ ), p.partOf && t("if(o.oneofs)")("d%s=%j", c.safeProp(p.partOf.name), p.name)), t("}");
1648
+ }
1649
+ return t("return d");
1650
+ };
1651
+ }(converter)), converter;
1652
+ }
1653
+ var wrappers = {}, hasRequiredWrappers;
1654
+ function requireWrappers() {
1655
+ return hasRequiredWrappers || (hasRequiredWrappers = 1, function(d) {
1656
+ var u = d, h = requireMessage();
1657
+ u[".google.protobuf.Any"] = {
1658
+ fromObject: function(c) {
1659
+ if (c && c["@type"]) {
1660
+ var l = c["@type"].substring(c["@type"].lastIndexOf("/") + 1), n = this.lookup(l);
1661
+ if (n) {
1662
+ var e = c["@type"].charAt(0) === "." ? c["@type"].slice(1) : c["@type"];
1663
+ return e.indexOf("/") === -1 && (e = "/" + e), this.create({
1664
+ type_url: e,
1665
+ value: n.encode(n.fromObject(c)).finish()
1666
+ });
1667
+ }
1668
+ }
1669
+ return this.fromObject(c);
1670
+ },
1671
+ toObject: function(c, l) {
1672
+ var n = "type.googleapis.com/", e = "", r = "";
1673
+ if (l && l.json && c.type_url && c.value) {
1674
+ r = c.type_url.substring(c.type_url.lastIndexOf("/") + 1), e = c.type_url.substring(0, c.type_url.lastIndexOf("/") + 1);
1675
+ var i = this.lookup(r);
1676
+ i && (c = i.decode(c.value));
1677
+ }
1678
+ if (!(c instanceof this.ctor) && c instanceof h) {
1679
+ var t = c.$type.toObject(c, l), f = c.$type.fullName[0] === "." ? c.$type.fullName.slice(1) : c.$type.fullName;
1680
+ return e === "" && (e = n), r = e + f, t["@type"] = r, t;
1681
+ }
1682
+ return this.toObject(c, l);
1683
+ }
1684
+ };
1685
+ }(wrappers)), wrappers;
1686
+ }
1687
+ var type, hasRequiredType;
1688
+ function requireType() {
1689
+ if (hasRequiredType) return type;
1690
+ hasRequiredType = 1, type = y;
1691
+ var d = requireNamespace();
1692
+ ((y.prototype = Object.create(d.prototype)).constructor = y).className = "Type";
1693
+ var u = require_enum(), h = requireOneof(), c = requireField(), l = requireMapfield(), n = requireService(), e = requireMessage(), r = requireReader(), i = requireWriter(), t = requireUtil(), f = requireEncoder(), s = requireDecoder(), a = requireVerifier(), o = requireConverter(), p = requireWrappers();
1694
+ function y(v, m) {
1695
+ v = v.replace(/\W/g, ""), d.call(this, v, m), this.fields = {}, this.oneofs = void 0, this.extensions = void 0, this.reserved = void 0, this.group = void 0, this._fieldsById = null, this._fieldsArray = null, this._oneofsArray = null, this._ctor = null;
1696
+ }
1697
+ Object.defineProperties(y.prototype, {
1698
+ /**
1699
+ * Message fields by id.
1700
+ * @name Type#fieldsById
1701
+ * @type {Object.<number,Field>}
1702
+ * @readonly
1703
+ */
1704
+ fieldsById: {
1705
+ get: function() {
1706
+ if (this._fieldsById)
1707
+ return this._fieldsById;
1708
+ this._fieldsById = {};
1709
+ for (var v = Object.keys(this.fields), m = 0; m < v.length; ++m) {
1710
+ var _ = this.fields[v[m]], R = _.id;
1711
+ if (this._fieldsById[R])
1712
+ throw Error("duplicate id " + R + " in " + this);
1713
+ this._fieldsById[R] = _;
1714
+ }
1715
+ return this._fieldsById;
1716
+ }
1717
+ },
1718
+ /**
1719
+ * Fields of this message as an array for iteration.
1720
+ * @name Type#fieldsArray
1721
+ * @type {Field[]}
1722
+ * @readonly
1723
+ */
1724
+ fieldsArray: {
1725
+ get: function() {
1726
+ return this._fieldsArray || (this._fieldsArray = t.toArray(this.fields));
1727
+ }
1728
+ },
1729
+ /**
1730
+ * Oneofs of this message as an array for iteration.
1731
+ * @name Type#oneofsArray
1732
+ * @type {OneOf[]}
1733
+ * @readonly
1734
+ */
1735
+ oneofsArray: {
1736
+ get: function() {
1737
+ return this._oneofsArray || (this._oneofsArray = t.toArray(this.oneofs));
1738
+ }
1739
+ },
1740
+ /**
1741
+ * The registered constructor, if any registered, otherwise a generic constructor.
1742
+ * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor.
1743
+ * @name Type#ctor
1744
+ * @type {Constructor<{}>}
1745
+ */
1746
+ ctor: {
1747
+ get: function() {
1748
+ return this._ctor || (this.ctor = y.generateConstructor(this)());
1749
+ },
1750
+ set: function(v) {
1751
+ var m = v.prototype;
1752
+ m instanceof e || ((v.prototype = new e()).constructor = v, t.merge(v.prototype, m)), v.$type = v.prototype.$type = this, t.merge(v, e, !0), this._ctor = v;
1753
+ for (var _ = 0; _ < /* initializes */
1754
+ this.fieldsArray.length; ++_)
1755
+ this._fieldsArray[_].resolve();
1756
+ var R = {};
1757
+ for (_ = 0; _ < /* initializes */
1758
+ this.oneofsArray.length; ++_)
1759
+ R[this._oneofsArray[_].resolve().name] = {
1760
+ get: t.oneOfGetter(this._oneofsArray[_].oneof),
1761
+ set: t.oneOfSetter(this._oneofsArray[_].oneof)
1762
+ };
1763
+ _ && Object.defineProperties(v.prototype, R);
1764
+ }
1765
+ }
1766
+ }), y.generateConstructor = function(m) {
1767
+ for (var _ = t.codegen(["p"], m.name), R = 0, k; R < m.fieldsArray.length; ++R)
1768
+ (k = m._fieldsArray[R]).map ? _("this%s={}", t.safeProp(k.name)) : k.repeated && _("this%s=[]", t.safeProp(k.name));
1769
+ return _("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]");
1770
+ };
1771
+ function b(v) {
1772
+ return v._fieldsById = v._fieldsArray = v._oneofsArray = null, delete v.encode, delete v.decode, delete v.verify, v;
1773
+ }
1774
+ return y.fromJSON = function(m, _) {
1775
+ var R = new y(m, _.options);
1776
+ R.extensions = _.extensions, R.reserved = _.reserved;
1777
+ for (var k = Object.keys(_.fields), C = 0; C < k.length; ++C)
1778
+ R.add(
1779
+ (typeof _.fields[k[C]].keyType < "u" ? l.fromJSON : c.fromJSON)(k[C], _.fields[k[C]])
1780
+ );
1781
+ if (_.oneofs)
1782
+ for (k = Object.keys(_.oneofs), C = 0; C < k.length; ++C)
1783
+ R.add(h.fromJSON(k[C], _.oneofs[k[C]]));
1784
+ if (_.nested)
1785
+ for (k = Object.keys(_.nested), C = 0; C < k.length; ++C) {
1786
+ var j = _.nested[k[C]];
1787
+ R.add(
1788
+ // most to least likely
1789
+ (j.id !== void 0 ? c.fromJSON : j.fields !== void 0 ? y.fromJSON : j.values !== void 0 ? u.fromJSON : j.methods !== void 0 ? n.fromJSON : d.fromJSON)(k[C], j)
1790
+ );
1791
+ }
1792
+ return _.extensions && _.extensions.length && (R.extensions = _.extensions), _.reserved && _.reserved.length && (R.reserved = _.reserved), _.group && (R.group = !0), _.comment && (R.comment = _.comment), _.edition && (R._edition = _.edition), R._defaultEdition = "proto3", R;
1793
+ }, y.prototype.toJSON = function(m) {
1794
+ var _ = d.prototype.toJSON.call(this, m), R = m ? !!m.keepComments : !1;
1795
+ return t.toObject([
1796
+ "edition",
1797
+ this._editionToJSON(),
1798
+ "options",
1799
+ _ && _.options || void 0,
1800
+ "oneofs",
1801
+ d.arrayToJSON(this.oneofsArray, m),
1802
+ "fields",
1803
+ d.arrayToJSON(this.fieldsArray.filter(function(k) {
1804
+ return !k.declaringField;
1805
+ }), m) || {},
1806
+ "extensions",
1807
+ this.extensions && this.extensions.length ? this.extensions : void 0,
1808
+ "reserved",
1809
+ this.reserved && this.reserved.length ? this.reserved : void 0,
1810
+ "group",
1811
+ this.group || void 0,
1812
+ "nested",
1813
+ _ && _.nested || void 0,
1814
+ "comment",
1815
+ R ? this.comment : void 0
1816
+ ]);
1817
+ }, y.prototype.resolveAll = function() {
1818
+ if (!this._needsRecursiveResolve) return this;
1819
+ d.prototype.resolveAll.call(this);
1820
+ var m = this.oneofsArray;
1821
+ for (R = 0; R < m.length; )
1822
+ m[R++].resolve();
1823
+ for (var _ = this.fieldsArray, R = 0; R < _.length; )
1824
+ _[R++].resolve();
1825
+ return this;
1826
+ }, y.prototype._resolveFeaturesRecursive = function(m) {
1827
+ return this._needsRecursiveFeatureResolution ? (m = this._edition || m, d.prototype._resolveFeaturesRecursive.call(this, m), this.oneofsArray.forEach((_) => {
1828
+ _._resolveFeatures(m);
1829
+ }), this.fieldsArray.forEach((_) => {
1830
+ _._resolveFeatures(m);
1831
+ }), this) : this;
1832
+ }, y.prototype.get = function(m) {
1833
+ return this.fields[m] || this.oneofs && this.oneofs[m] || this.nested && this.nested[m] || null;
1834
+ }, y.prototype.add = function(m) {
1835
+ if (this.get(m.name))
1836
+ throw Error("duplicate name '" + m.name + "' in " + this);
1837
+ if (m instanceof c && m.extend === void 0) {
1838
+ if (this._fieldsById ? (
1839
+ /* istanbul ignore next */
1840
+ this._fieldsById[m.id]
1841
+ ) : this.fieldsById[m.id])
1842
+ throw Error("duplicate id " + m.id + " in " + this);
1843
+ if (this.isReservedId(m.id))
1844
+ throw Error("id " + m.id + " is reserved in " + this);
1845
+ if (this.isReservedName(m.name))
1846
+ throw Error("name '" + m.name + "' is reserved in " + this);
1847
+ return m.parent && m.parent.remove(m), this.fields[m.name] = m, m.message = this, m.onAdd(this), b(this);
1848
+ }
1849
+ return m instanceof h ? (this.oneofs || (this.oneofs = {}), this.oneofs[m.name] = m, m.onAdd(this), b(this)) : d.prototype.add.call(this, m);
1850
+ }, y.prototype.remove = function(m) {
1851
+ if (m instanceof c && m.extend === void 0) {
1852
+ if (!this.fields || this.fields[m.name] !== m)
1853
+ throw Error(m + " is not a member of " + this);
1854
+ return delete this.fields[m.name], m.parent = null, m.onRemove(this), b(this);
1855
+ }
1856
+ if (m instanceof h) {
1857
+ if (!this.oneofs || this.oneofs[m.name] !== m)
1858
+ throw Error(m + " is not a member of " + this);
1859
+ return delete this.oneofs[m.name], m.parent = null, m.onRemove(this), b(this);
1860
+ }
1861
+ return d.prototype.remove.call(this, m);
1862
+ }, y.prototype.isReservedId = function(m) {
1863
+ return d.isReservedId(this.reserved, m);
1864
+ }, y.prototype.isReservedName = function(m) {
1865
+ return d.isReservedName(this.reserved, m);
1866
+ }, y.prototype.create = function(m) {
1867
+ return new this.ctor(m);
1868
+ }, y.prototype.setup = function() {
1869
+ for (var m = this.fullName, _ = [], R = 0; R < /* initializes */
1870
+ this.fieldsArray.length; ++R)
1871
+ _.push(this._fieldsArray[R].resolve().resolvedType);
1872
+ this.encode = f(this)({
1873
+ Writer: i,
1874
+ types: _,
1875
+ util: t
1876
+ }), this.decode = s(this)({
1877
+ Reader: r,
1878
+ types: _,
1879
+ util: t
1880
+ }), this.verify = a(this)({
1881
+ types: _,
1882
+ util: t
1883
+ }), this.fromObject = o.fromObject(this)({
1884
+ types: _,
1885
+ util: t
1886
+ }), this.toObject = o.toObject(this)({
1887
+ types: _,
1888
+ util: t
1889
+ });
1890
+ var k = p[m];
1891
+ if (k) {
1892
+ var C = Object.create(this);
1893
+ C.fromObject = this.fromObject, this.fromObject = k.fromObject.bind(C), C.toObject = this.toObject, this.toObject = k.toObject.bind(C);
1894
+ }
1895
+ return this;
1896
+ }, y.prototype.encode = function(m, _) {
1897
+ return this.setup().encode(m, _);
1898
+ }, y.prototype.encodeDelimited = function(m, _) {
1899
+ return this.encode(m, _ && _.len ? _.fork() : _).ldelim();
1900
+ }, y.prototype.decode = function(m, _) {
1901
+ return this.setup().decode(m, _);
1902
+ }, y.prototype.decodeDelimited = function(m) {
1903
+ return m instanceof r || (m = r.create(m)), this.decode(m, m.uint32());
1904
+ }, y.prototype.verify = function(m) {
1905
+ return this.setup().verify(m);
1906
+ }, y.prototype.fromObject = function(m) {
1907
+ return this.setup().fromObject(m);
1908
+ }, y.prototype.toObject = function(m, _) {
1909
+ return this.setup().toObject(m, _);
1910
+ }, y.d = function(m) {
1911
+ return function(R) {
1912
+ t.decorateType(R, m);
1913
+ };
1914
+ }, type;
1915
+ }
1916
+ var root$1, hasRequiredRoot;
1917
+ function requireRoot() {
1918
+ if (hasRequiredRoot) return root$1;
1919
+ hasRequiredRoot = 1, root$1 = i;
1920
+ var d = requireNamespace();
1921
+ ((i.prototype = Object.create(d.prototype)).constructor = i).className = "Root";
1922
+ var u = requireField(), h = require_enum(), c = requireOneof(), l = requireUtil(), n, e, r;
1923
+ function i(a) {
1924
+ d.call(this, "", a), this.deferred = [], this.files = [], this._edition = "proto2", this._fullyQualifiedObjects = {};
1925
+ }
1926
+ i.fromJSON = function(o, p) {
1927
+ return p || (p = new i()), o.options && p.setOptions(o.options), p.addJSON(o.nested).resolveAll();
1928
+ }, i.prototype.resolvePath = l.path.resolve, i.prototype.fetch = l.fetch;
1929
+ function t() {
1930
+ }
1931
+ i.prototype.load = function a(o, p, y) {
1932
+ typeof p == "function" && (y = p, p = void 0);
1933
+ var b = this;
1934
+ if (!y)
1935
+ return l.asPromise(a, b, o, p);
1936
+ var v = y === t;
1937
+ function m(P, D) {
1938
+ if (y) {
1939
+ if (v)
1940
+ throw P;
1941
+ D && D.resolveAll();
1942
+ var S = y;
1943
+ y = null, S(P, D);
1944
+ }
1945
+ }
1946
+ function _(P) {
1947
+ var D = P.lastIndexOf("google/protobuf/");
1948
+ if (D > -1) {
1949
+ var S = P.substring(D);
1950
+ if (S in r) return S;
1951
+ }
1952
+ return null;
1953
+ }
1954
+ function R(P, D) {
1955
+ try {
1956
+ if (l.isString(D) && D.charAt(0) === "{" && (D = JSON.parse(D)), !l.isString(D))
1957
+ b.setOptions(D.options).addJSON(D.nested);
1958
+ else {
1959
+ e.filename = P;
1960
+ var S = e(D, b, p), J, U = 0;
1961
+ if (S.imports)
1962
+ for (; U < S.imports.length; ++U)
1963
+ (J = _(S.imports[U]) || b.resolvePath(P, S.imports[U])) && k(J);
1964
+ if (S.weakImports)
1965
+ for (U = 0; U < S.weakImports.length; ++U)
1966
+ (J = _(S.weakImports[U]) || b.resolvePath(P, S.weakImports[U])) && k(J, !0);
1967
+ }
1968
+ } catch (T) {
1969
+ m(T);
1970
+ }
1971
+ !v && !C && m(null, b);
1972
+ }
1973
+ function k(P, D) {
1974
+ if (P = _(P) || P, !(b.files.indexOf(P) > -1)) {
1975
+ if (b.files.push(P), P in r) {
1976
+ v ? R(P, r[P]) : (++C, setTimeout(function() {
1977
+ --C, R(P, r[P]);
1978
+ }));
1979
+ return;
1980
+ }
1981
+ if (v) {
1982
+ var S;
1983
+ try {
1984
+ S = l.fs.readFileSync(P).toString("utf8");
1985
+ } catch (J) {
1986
+ D || m(J);
1987
+ return;
1988
+ }
1989
+ R(P, S);
1990
+ } else
1991
+ ++C, b.fetch(P, function(J, U) {
1992
+ if (--C, !!y) {
1993
+ if (J) {
1994
+ D ? C || m(null, b) : m(J);
1995
+ return;
1996
+ }
1997
+ R(P, U);
1998
+ }
1999
+ });
2000
+ }
2001
+ }
2002
+ var C = 0;
2003
+ l.isString(o) && (o = [o]);
2004
+ for (var j = 0, X; j < o.length; ++j)
2005
+ (X = b.resolvePath("", o[j])) && k(X);
2006
+ return v ? (b.resolveAll(), b) : (C || m(null, b), b);
2007
+ }, i.prototype.loadSync = function(o, p) {
2008
+ if (!l.isNode)
2009
+ throw Error("not supported");
2010
+ return this.load(o, p, t);
2011
+ }, i.prototype.resolveAll = function() {
2012
+ if (!this._needsRecursiveResolve) return this;
2013
+ if (this.deferred.length)
2014
+ throw Error("unresolvable extensions: " + this.deferred.map(function(o) {
2015
+ return "'extend " + o.extend + "' in " + o.parent.fullName;
2016
+ }).join(", "));
2017
+ return d.prototype.resolveAll.call(this);
2018
+ };
2019
+ var f = /^[A-Z]/;
2020
+ function s(a, o) {
2021
+ var p = o.parent.lookup(o.extend);
2022
+ if (p) {
2023
+ var y = new u(o.fullName, o.id, o.type, o.rule, void 0, o.options);
2024
+ return p.get(y.name) || (y.declaringField = o, o.extensionField = y, p.add(y)), !0;
2025
+ }
2026
+ return !1;
2027
+ }
2028
+ return i.prototype._handleAdd = function(o) {
2029
+ if (o instanceof u)
2030
+ /* an extension field (implies not part of a oneof) */
2031
+ o.extend !== void 0 && /* not already handled */
2032
+ !o.extensionField && (s(this, o) || this.deferred.push(o));
2033
+ else if (o instanceof h)
2034
+ f.test(o.name) && (o.parent[o.name] = o.values);
2035
+ else if (!(o instanceof c)) {
2036
+ if (o instanceof n)
2037
+ for (var p = 0; p < this.deferred.length; )
2038
+ s(this, this.deferred[p]) ? this.deferred.splice(p, 1) : ++p;
2039
+ for (var y = 0; y < /* initializes */
2040
+ o.nestedArray.length; ++y)
2041
+ this._handleAdd(o._nestedArray[y]);
2042
+ f.test(o.name) && (o.parent[o.name] = o);
2043
+ }
2044
+ (o instanceof n || o instanceof h || o instanceof u) && (this._fullyQualifiedObjects[o.fullName] = o);
2045
+ }, i.prototype._handleRemove = function(o) {
2046
+ if (o instanceof u) {
2047
+ if (
2048
+ /* an extension field */
2049
+ o.extend !== void 0
2050
+ )
2051
+ if (
2052
+ /* already handled */
2053
+ o.extensionField
2054
+ )
2055
+ o.extensionField.parent.remove(o.extensionField), o.extensionField = null;
2056
+ else {
2057
+ var p = this.deferred.indexOf(o);
2058
+ p > -1 && this.deferred.splice(p, 1);
2059
+ }
2060
+ } else if (o instanceof h)
2061
+ f.test(o.name) && delete o.parent[o.name];
2062
+ else if (o instanceof d) {
2063
+ for (var y = 0; y < /* initializes */
2064
+ o.nestedArray.length; ++y)
2065
+ this._handleRemove(o._nestedArray[y]);
2066
+ f.test(o.name) && delete o.parent[o.name];
2067
+ }
2068
+ delete this._fullyQualifiedObjects[o.fullName];
2069
+ }, i._configure = function(a, o, p) {
2070
+ n = a, e = o, r = p;
2071
+ }, root$1;
2072
+ }
2073
+ var hasRequiredUtil;
2074
+ function requireUtil() {
2075
+ if (hasRequiredUtil) return util.exports;
2076
+ hasRequiredUtil = 1;
2077
+ var d = util.exports = requireMinimal(), u = requireRoots(), h, c;
2078
+ d.codegen = requireCodegen(), d.fetch = requireFetch(), d.path = requirePath(), d.fs = d.inquire("fs"), d.toArray = function(t) {
2079
+ if (t) {
2080
+ for (var f = Object.keys(t), s = new Array(f.length), a = 0; a < f.length; )
2081
+ s[a] = t[f[a++]];
2082
+ return s;
2083
+ }
2084
+ return [];
2085
+ }, d.toObject = function(t) {
2086
+ for (var f = {}, s = 0; s < t.length; ) {
2087
+ var a = t[s++], o = t[s++];
2088
+ o !== void 0 && (f[a] = o);
2089
+ }
2090
+ return f;
2091
+ };
2092
+ var l = /\\/g, n = /"/g;
2093
+ d.isReserved = function(t) {
2094
+ return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(t);
2095
+ }, d.safeProp = function(t) {
2096
+ return !/^[$\w_]+$/.test(t) || d.isReserved(t) ? '["' + t.replace(l, "\\\\").replace(n, '\\"') + '"]' : "." + t;
2097
+ }, d.ucFirst = function(t) {
2098
+ return t.charAt(0).toUpperCase() + t.substring(1);
2099
+ };
2100
+ var e = /_([a-z])/g;
2101
+ d.camelCase = function(t) {
2102
+ return t.substring(0, 1) + t.substring(1).replace(e, function(f, s) {
2103
+ return s.toUpperCase();
2104
+ });
2105
+ }, d.compareFieldsById = function(t, f) {
2106
+ return t.id - f.id;
2107
+ }, d.decorateType = function(t, f) {
2108
+ if (t.$type)
2109
+ return f && t.$type.name !== f && (d.decorateRoot.remove(t.$type), t.$type.name = f, d.decorateRoot.add(t.$type)), t.$type;
2110
+ h || (h = requireType());
2111
+ var s = new h(f || t.name);
2112
+ return d.decorateRoot.add(s), s.ctor = t, Object.defineProperty(t, "$type", { value: s, enumerable: !1 }), Object.defineProperty(t.prototype, "$type", { value: s, enumerable: !1 }), s;
2113
+ };
2114
+ var r = 0;
2115
+ return d.decorateEnum = function(t) {
2116
+ if (t.$type)
2117
+ return t.$type;
2118
+ c || (c = require_enum());
2119
+ var f = new c("Enum" + r++, t);
2120
+ return d.decorateRoot.add(f), Object.defineProperty(t, "$type", { value: f, enumerable: !1 }), f;
2121
+ }, d.setProperty = function(t, f, s, a) {
2122
+ function o(p, y, b) {
2123
+ var v = y.shift();
2124
+ if (v === "__proto__" || v === "prototype")
2125
+ return p;
2126
+ if (y.length > 0)
2127
+ p[v] = o(p[v] || {}, y, b);
2128
+ else {
2129
+ var m = p[v];
2130
+ if (m && a)
2131
+ return p;
2132
+ m && (b = [].concat(m).concat(b)), p[v] = b;
2133
+ }
2134
+ return p;
2135
+ }
2136
+ if (typeof t != "object")
2137
+ throw TypeError("dst must be an object");
2138
+ if (!f)
2139
+ throw TypeError("path must be specified");
2140
+ return f = f.split("."), o(t, f, s);
2141
+ }, Object.defineProperty(d, "decorateRoot", {
2142
+ get: function() {
2143
+ return u.decorated || (u.decorated = new (requireRoot())());
2144
+ }
2145
+ }), util.exports;
2146
+ }
2147
+ var hasRequiredTypes;
2148
+ function requireTypes() {
2149
+ return hasRequiredTypes || (hasRequiredTypes = 1, function(d) {
2150
+ var u = d, h = requireUtil(), c = [
2151
+ "double",
2152
+ // 0
2153
+ "float",
2154
+ // 1
2155
+ "int32",
2156
+ // 2
2157
+ "uint32",
2158
+ // 3
2159
+ "sint32",
2160
+ // 4
2161
+ "fixed32",
2162
+ // 5
2163
+ "sfixed32",
2164
+ // 6
2165
+ "int64",
2166
+ // 7
2167
+ "uint64",
2168
+ // 8
2169
+ "sint64",
2170
+ // 9
2171
+ "fixed64",
2172
+ // 10
2173
+ "sfixed64",
2174
+ // 11
2175
+ "bool",
2176
+ // 12
2177
+ "string",
2178
+ // 13
2179
+ "bytes"
2180
+ // 14
2181
+ ];
2182
+ function l(n, e) {
2183
+ var r = 0, i = {};
2184
+ for (e |= 0; r < n.length; ) i[c[r + e]] = n[r++];
2185
+ return i;
2186
+ }
2187
+ u.basic = l([
2188
+ /* double */
2189
+ 1,
2190
+ /* float */
2191
+ 5,
2192
+ /* int32 */
2193
+ 0,
2194
+ /* uint32 */
2195
+ 0,
2196
+ /* sint32 */
2197
+ 0,
2198
+ /* fixed32 */
2199
+ 5,
2200
+ /* sfixed32 */
2201
+ 5,
2202
+ /* int64 */
2203
+ 0,
2204
+ /* uint64 */
2205
+ 0,
2206
+ /* sint64 */
2207
+ 0,
2208
+ /* fixed64 */
2209
+ 1,
2210
+ /* sfixed64 */
2211
+ 1,
2212
+ /* bool */
2213
+ 0,
2214
+ /* string */
2215
+ 2,
2216
+ /* bytes */
2217
+ 2
2218
+ ]), u.defaults = l([
2219
+ /* double */
2220
+ 0,
2221
+ /* float */
2222
+ 0,
2223
+ /* int32 */
2224
+ 0,
2225
+ /* uint32 */
2226
+ 0,
2227
+ /* sint32 */
2228
+ 0,
2229
+ /* fixed32 */
2230
+ 0,
2231
+ /* sfixed32 */
2232
+ 0,
2233
+ /* int64 */
2234
+ 0,
2235
+ /* uint64 */
2236
+ 0,
2237
+ /* sint64 */
2238
+ 0,
2239
+ /* fixed64 */
2240
+ 0,
2241
+ /* sfixed64 */
2242
+ 0,
2243
+ /* bool */
2244
+ !1,
2245
+ /* string */
2246
+ "",
2247
+ /* bytes */
2248
+ h.emptyArray,
2249
+ /* message */
2250
+ null
2251
+ ]), u.long = l([
2252
+ /* int64 */
2253
+ 0,
2254
+ /* uint64 */
2255
+ 0,
2256
+ /* sint64 */
2257
+ 0,
2258
+ /* fixed64 */
2259
+ 1,
2260
+ /* sfixed64 */
2261
+ 1
2262
+ ], 7), u.mapKey = l([
2263
+ /* int32 */
2264
+ 0,
2265
+ /* uint32 */
2266
+ 0,
2267
+ /* sint32 */
2268
+ 0,
2269
+ /* fixed32 */
2270
+ 5,
2271
+ /* sfixed32 */
2272
+ 5,
2273
+ /* int64 */
2274
+ 0,
2275
+ /* uint64 */
2276
+ 0,
2277
+ /* sint64 */
2278
+ 0,
2279
+ /* fixed64 */
2280
+ 1,
2281
+ /* sfixed64 */
2282
+ 1,
2283
+ /* bool */
2284
+ 0,
2285
+ /* string */
2286
+ 2
2287
+ ], 2), u.packed = l([
2288
+ /* double */
2289
+ 1,
2290
+ /* float */
2291
+ 5,
2292
+ /* int32 */
2293
+ 0,
2294
+ /* uint32 */
2295
+ 0,
2296
+ /* sint32 */
2297
+ 0,
2298
+ /* fixed32 */
2299
+ 5,
2300
+ /* sfixed32 */
2301
+ 5,
2302
+ /* int64 */
2303
+ 0,
2304
+ /* uint64 */
2305
+ 0,
2306
+ /* sint64 */
2307
+ 0,
2308
+ /* fixed64 */
2309
+ 1,
2310
+ /* sfixed64 */
2311
+ 1,
2312
+ /* bool */
2313
+ 0
2314
+ ]);
2315
+ }(types)), types;
2316
+ }
2317
+ var field, hasRequiredField;
2318
+ function requireField() {
2319
+ if (hasRequiredField) return field;
2320
+ hasRequiredField = 1, field = e;
2321
+ var d = requireObject();
2322
+ ((e.prototype = Object.create(d.prototype)).constructor = e).className = "Field";
2323
+ var u = require_enum(), h = requireTypes(), c = requireUtil(), l, n = /^required|optional|repeated$/;
2324
+ e.fromJSON = function(i, t) {
2325
+ var f = new e(i, t.id, t.type, t.rule, t.extend, t.options, t.comment);
2326
+ return t.edition && (f._edition = t.edition), f._defaultEdition = "proto3", f;
2327
+ };
2328
+ function e(r, i, t, f, s, a, o) {
2329
+ if (c.isObject(f) ? (o = s, a = f, f = s = void 0) : c.isObject(s) && (o = a, a = s, s = void 0), d.call(this, r, a), !c.isInteger(i) || i < 0)
2330
+ throw TypeError("id must be a non-negative integer");
2331
+ if (!c.isString(t))
2332
+ throw TypeError("type must be a string");
2333
+ if (f !== void 0 && !n.test(f = f.toString().toLowerCase()))
2334
+ throw TypeError("rule must be a string rule");
2335
+ if (s !== void 0 && !c.isString(s))
2336
+ throw TypeError("extend must be a string");
2337
+ f === "proto3_optional" && (f = "optional"), this.rule = f && f !== "optional" ? f : void 0, this.type = t, this.id = i, this.extend = s || void 0, this.repeated = f === "repeated", this.map = !1, this.message = null, this.partOf = null, this.typeDefault = null, this.defaultValue = null, this.long = c.Long ? h.long[t] !== void 0 : (
2338
+ /* istanbul ignore next */
2339
+ !1
2340
+ ), this.bytes = t === "bytes", this.resolvedType = null, this.extensionField = null, this.declaringField = null, this.comment = o;
2341
+ }
2342
+ return Object.defineProperty(e.prototype, "required", {
2343
+ get: function() {
2344
+ return this._features.field_presence === "LEGACY_REQUIRED";
2345
+ }
2346
+ }), Object.defineProperty(e.prototype, "optional", {
2347
+ get: function() {
2348
+ return !this.required;
2349
+ }
2350
+ }), Object.defineProperty(e.prototype, "delimited", {
2351
+ get: function() {
2352
+ return this.resolvedType instanceof l && this._features.message_encoding === "DELIMITED";
2353
+ }
2354
+ }), Object.defineProperty(e.prototype, "packed", {
2355
+ get: function() {
2356
+ return this._features.repeated_field_encoding === "PACKED";
2357
+ }
2358
+ }), Object.defineProperty(e.prototype, "hasPresence", {
2359
+ get: function() {
2360
+ return this.repeated || this.map ? !1 : this.partOf || // oneofs
2361
+ this.declaringField || this.extensionField || // extensions
2362
+ this._features.field_presence !== "IMPLICIT";
2363
+ }
2364
+ }), e.prototype.setOption = function(i, t, f) {
2365
+ return d.prototype.setOption.call(this, i, t, f);
2366
+ }, e.prototype.toJSON = function(i) {
2367
+ var t = i ? !!i.keepComments : !1;
2368
+ return c.toObject([
2369
+ "edition",
2370
+ this._editionToJSON(),
2371
+ "rule",
2372
+ this.rule !== "optional" && this.rule || void 0,
2373
+ "type",
2374
+ this.type,
2375
+ "id",
2376
+ this.id,
2377
+ "extend",
2378
+ this.extend,
2379
+ "options",
2380
+ this.options,
2381
+ "comment",
2382
+ t ? this.comment : void 0
2383
+ ]);
2384
+ }, e.prototype.resolve = function() {
2385
+ if (this.resolved)
2386
+ return this;
2387
+ if ((this.typeDefault = h.defaults[this.type]) === void 0 ? (this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type), this.resolvedType instanceof l ? this.typeDefault = null : this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]) : this.options && this.options.proto3_optional && (this.typeDefault = null), this.options && this.options.default != null && (this.typeDefault = this.options.default, this.resolvedType instanceof u && typeof this.typeDefault == "string" && (this.typeDefault = this.resolvedType.values[this.typeDefault])), this.options && (this.options.packed !== void 0 && this.resolvedType && !(this.resolvedType instanceof u) && delete this.options.packed, Object.keys(this.options).length || (this.options = void 0)), this.long)
2388
+ this.typeDefault = c.Long.fromNumber(this.typeDefault, this.type.charAt(0) === "u"), Object.freeze && Object.freeze(this.typeDefault);
2389
+ else if (this.bytes && typeof this.typeDefault == "string") {
2390
+ var i;
2391
+ c.base64.test(this.typeDefault) ? c.base64.decode(this.typeDefault, i = c.newBuffer(c.base64.length(this.typeDefault)), 0) : c.utf8.write(this.typeDefault, i = c.newBuffer(c.utf8.length(this.typeDefault)), 0), this.typeDefault = i;
2392
+ }
2393
+ return this.map ? this.defaultValue = c.emptyObject : this.repeated ? this.defaultValue = c.emptyArray : this.defaultValue = this.typeDefault, this.parent instanceof l && (this.parent.ctor.prototype[this.name] = this.defaultValue), d.prototype.resolve.call(this);
2394
+ }, e.prototype._inferLegacyProtoFeatures = function(i) {
2395
+ if (i !== "proto2" && i !== "proto3")
2396
+ return {};
2397
+ var t = {};
2398
+ if (this.rule === "required" && (t.field_presence = "LEGACY_REQUIRED"), this.parent && h.defaults[this.type] === void 0) {
2399
+ var f = this.parent.get(this.type.split(".").pop());
2400
+ f && f instanceof l && f.group && (t.message_encoding = "DELIMITED");
2401
+ }
2402
+ return this.getOption("packed") === !0 ? t.repeated_field_encoding = "PACKED" : this.getOption("packed") === !1 && (t.repeated_field_encoding = "EXPANDED"), t;
2403
+ }, e.prototype._resolveFeatures = function(i) {
2404
+ return d.prototype._resolveFeatures.call(this, this._edition || i);
2405
+ }, e.d = function(i, t, f, s) {
2406
+ return typeof t == "function" ? t = c.decorateType(t).name : t && typeof t == "object" && (t = c.decorateEnum(t).name), function(o, p) {
2407
+ c.decorateType(o.constructor).add(new e(p, i, t, f, { default: s }));
2408
+ };
2409
+ }, e._configure = function(i) {
2410
+ l = i;
2411
+ }, field;
2412
+ }
2413
+ var oneof, hasRequiredOneof;
2414
+ function requireOneof() {
2415
+ if (hasRequiredOneof) return oneof;
2416
+ hasRequiredOneof = 1, oneof = c;
2417
+ var d = requireObject();
2418
+ ((c.prototype = Object.create(d.prototype)).constructor = c).className = "OneOf";
2419
+ var u = requireField(), h = requireUtil();
2420
+ function c(n, e, r, i) {
2421
+ if (Array.isArray(e) || (r = e, e = void 0), d.call(this, n, r), !(e === void 0 || Array.isArray(e)))
2422
+ throw TypeError("fieldNames must be an Array");
2423
+ this.oneof = e || [], this.fieldsArray = [], this.comment = i;
2424
+ }
2425
+ c.fromJSON = function(e, r) {
2426
+ return new c(e, r.oneof, r.options, r.comment);
2427
+ }, c.prototype.toJSON = function(e) {
2428
+ var r = e ? !!e.keepComments : !1;
2429
+ return h.toObject([
2430
+ "options",
2431
+ this.options,
2432
+ "oneof",
2433
+ this.oneof,
2434
+ "comment",
2435
+ r ? this.comment : void 0
2436
+ ]);
2437
+ };
2438
+ function l(n) {
2439
+ if (n.parent)
2440
+ for (var e = 0; e < n.fieldsArray.length; ++e)
2441
+ n.fieldsArray[e].parent || n.parent.add(n.fieldsArray[e]);
2442
+ }
2443
+ return c.prototype.add = function(e) {
2444
+ if (!(e instanceof u))
2445
+ throw TypeError("field must be a Field");
2446
+ return e.parent && e.parent !== this.parent && e.parent.remove(e), this.oneof.push(e.name), this.fieldsArray.push(e), e.partOf = this, l(this), this;
2447
+ }, c.prototype.remove = function(e) {
2448
+ if (!(e instanceof u))
2449
+ throw TypeError("field must be a Field");
2450
+ var r = this.fieldsArray.indexOf(e);
2451
+ if (r < 0)
2452
+ throw Error(e + " is not a member of " + this);
2453
+ return this.fieldsArray.splice(r, 1), r = this.oneof.indexOf(e.name), r > -1 && this.oneof.splice(r, 1), e.partOf = null, this;
2454
+ }, c.prototype.onAdd = function(e) {
2455
+ d.prototype.onAdd.call(this, e);
2456
+ for (var r = this, i = 0; i < this.oneof.length; ++i) {
2457
+ var t = e.get(this.oneof[i]);
2458
+ t && !t.partOf && (t.partOf = r, r.fieldsArray.push(t));
2459
+ }
2460
+ l(this);
2461
+ }, c.prototype.onRemove = function(e) {
2462
+ for (var r = 0, i; r < this.fieldsArray.length; ++r)
2463
+ (i = this.fieldsArray[r]).parent && i.parent.remove(i);
2464
+ d.prototype.onRemove.call(this, e);
2465
+ }, Object.defineProperty(c.prototype, "isProto3Optional", {
2466
+ get: function() {
2467
+ if (this.fieldsArray == null || this.fieldsArray.length !== 1)
2468
+ return !1;
2469
+ var n = this.fieldsArray[0];
2470
+ return n.options != null && n.options.proto3_optional === !0;
2471
+ }
2472
+ }), c.d = function() {
2473
+ for (var e = new Array(arguments.length), r = 0; r < arguments.length; )
2474
+ e[r] = arguments[r++];
2475
+ return function(t, f) {
2476
+ h.decorateType(t.constructor).add(new c(f, e)), Object.defineProperty(t, f, {
2477
+ get: h.oneOfGetter(e),
2478
+ set: h.oneOfSetter(e)
2479
+ });
2480
+ };
2481
+ }, oneof;
2482
+ }
2483
+ var object, hasRequiredObject;
2484
+ function requireObject() {
2485
+ if (hasRequiredObject) return object;
2486
+ hasRequiredObject = 1, object = r, r.className = "ReflectionObject";
2487
+ const d = requireOneof();
2488
+ var u = requireUtil(), h, c = { enum_type: "OPEN", field_presence: "EXPLICIT", json_format: "ALLOW", message_encoding: "LENGTH_PREFIXED", repeated_field_encoding: "PACKED", utf8_validation: "VERIFY", enforce_naming_style: "STYLE2024", default_symbol_visibility: "EXPORT_TOP_LEVEL" }, l = { enum_type: "OPEN", field_presence: "EXPLICIT", json_format: "ALLOW", message_encoding: "LENGTH_PREFIXED", repeated_field_encoding: "PACKED", utf8_validation: "VERIFY", enforce_naming_style: "STYLE_LEGACY", default_symbol_visibility: "EXPORT_ALL" }, n = { enum_type: "CLOSED", field_presence: "EXPLICIT", json_format: "LEGACY_BEST_EFFORT", message_encoding: "LENGTH_PREFIXED", repeated_field_encoding: "EXPANDED", utf8_validation: "NONE", enforce_naming_style: "STYLE_LEGACY", default_symbol_visibility: "EXPORT_ALL" }, e = { enum_type: "OPEN", field_presence: "IMPLICIT", json_format: "ALLOW", message_encoding: "LENGTH_PREFIXED", repeated_field_encoding: "PACKED", utf8_validation: "VERIFY", enforce_naming_style: "STYLE_LEGACY", default_symbol_visibility: "EXPORT_ALL" };
2489
+ function r(i, t) {
2490
+ if (!u.isString(i))
2491
+ throw TypeError("name must be a string");
2492
+ if (t && !u.isObject(t))
2493
+ throw TypeError("options must be an object");
2494
+ this.options = t, this.parsedOptions = null, this.name = i, this._edition = null, this._defaultEdition = "proto2", this._features = {}, this._featuresResolved = !1, this.parent = null, this.resolved = !1, this.comment = null, this.filename = null;
2495
+ }
2496
+ return Object.defineProperties(r.prototype, {
2497
+ /**
2498
+ * Reference to the root namespace.
2499
+ * @name ReflectionObject#root
2500
+ * @type {Root}
2501
+ * @readonly
2502
+ */
2503
+ root: {
2504
+ get: function() {
2505
+ for (var i = this; i.parent !== null; )
2506
+ i = i.parent;
2507
+ return i;
2508
+ }
2509
+ },
2510
+ /**
2511
+ * Full name including leading dot.
2512
+ * @name ReflectionObject#fullName
2513
+ * @type {string}
2514
+ * @readonly
2515
+ */
2516
+ fullName: {
2517
+ get: function() {
2518
+ for (var i = [this.name], t = this.parent; t; )
2519
+ i.unshift(t.name), t = t.parent;
2520
+ return i.join(".");
2521
+ }
2522
+ }
2523
+ }), r.prototype.toJSON = /* istanbul ignore next */
2524
+ function() {
2525
+ throw Error();
2526
+ }, r.prototype.onAdd = function(t) {
2527
+ this.parent && this.parent !== t && this.parent.remove(this), this.parent = t, this.resolved = !1;
2528
+ var f = t.root;
2529
+ f instanceof h && f._handleAdd(this);
2530
+ }, r.prototype.onRemove = function(t) {
2531
+ var f = t.root;
2532
+ f instanceof h && f._handleRemove(this), this.parent = null, this.resolved = !1;
2533
+ }, r.prototype.resolve = function() {
2534
+ return this.resolved ? this : (this.root instanceof h && (this.resolved = !0), this);
2535
+ }, r.prototype._resolveFeaturesRecursive = function(t) {
2536
+ return this._resolveFeatures(this._edition || t);
2537
+ }, r.prototype._resolveFeatures = function(t) {
2538
+ if (!this._featuresResolved) {
2539
+ var f = {};
2540
+ if (!t)
2541
+ throw new Error("Unknown edition for " + this.fullName);
2542
+ var s = Object.assign(
2543
+ this.options ? Object.assign({}, this.options.features) : {},
2544
+ this._inferLegacyProtoFeatures(t)
2545
+ );
2546
+ if (this._edition) {
2547
+ if (t === "proto2")
2548
+ f = Object.assign({}, n);
2549
+ else if (t === "proto3")
2550
+ f = Object.assign({}, e);
2551
+ else if (t === "2023")
2552
+ f = Object.assign({}, l);
2553
+ else if (t === "2024")
2554
+ f = Object.assign({}, c);
2555
+ else
2556
+ throw new Error("Unknown edition: " + t);
2557
+ this._features = Object.assign(f, s || {}), this._featuresResolved = !0;
2558
+ return;
2559
+ }
2560
+ if (this.partOf instanceof d) {
2561
+ var a = Object.assign({}, this.partOf._features);
2562
+ this._features = Object.assign(a, s || {});
2563
+ } else if (!this.declaringField) if (this.parent) {
2564
+ var o = Object.assign({}, this.parent._features);
2565
+ this._features = Object.assign(o, s || {});
2566
+ } else
2567
+ throw new Error("Unable to find a parent for " + this.fullName);
2568
+ this.extensionField && (this.extensionField._features = this._features), this._featuresResolved = !0;
2569
+ }
2570
+ }, r.prototype._inferLegacyProtoFeatures = function() {
2571
+ return {};
2572
+ }, r.prototype.getOption = function(t) {
2573
+ if (this.options)
2574
+ return this.options[t];
2575
+ }, r.prototype.setOption = function(t, f, s) {
2576
+ return this.options || (this.options = {}), /^features\./.test(t) ? u.setProperty(this.options, t, f, s) : (!s || this.options[t] === void 0) && (this.getOption(t) !== f && (this.resolved = !1), this.options[t] = f), this;
2577
+ }, r.prototype.setParsedOption = function(t, f, s) {
2578
+ this.parsedOptions || (this.parsedOptions = []);
2579
+ var a = this.parsedOptions;
2580
+ if (s) {
2581
+ var o = a.find(function(b) {
2582
+ return Object.prototype.hasOwnProperty.call(b, t);
2583
+ });
2584
+ if (o) {
2585
+ var p = o[t];
2586
+ u.setProperty(p, s, f);
2587
+ } else
2588
+ o = {}, o[t] = u.setProperty({}, s, f), a.push(o);
2589
+ } else {
2590
+ var y = {};
2591
+ y[t] = f, a.push(y);
2592
+ }
2593
+ return this;
2594
+ }, r.prototype.setOptions = function(t, f) {
2595
+ if (t)
2596
+ for (var s = Object.keys(t), a = 0; a < s.length; ++a)
2597
+ this.setOption(s[a], t[s[a]], f);
2598
+ return this;
2599
+ }, r.prototype.toString = function() {
2600
+ var t = this.constructor.className, f = this.fullName;
2601
+ return f.length ? t + " " + f : t;
2602
+ }, r.prototype._editionToJSON = function() {
2603
+ if (!(!this._edition || this._edition === "proto3"))
2604
+ return this._edition;
2605
+ }, r._configure = function(i) {
2606
+ h = i;
2607
+ }, object;
2608
+ }
2609
+ var _enum, hasRequired_enum;
2610
+ function require_enum() {
2611
+ if (hasRequired_enum) return _enum;
2612
+ hasRequired_enum = 1, _enum = c;
2613
+ var d = requireObject();
2614
+ ((c.prototype = Object.create(d.prototype)).constructor = c).className = "Enum";
2615
+ var u = requireNamespace(), h = requireUtil();
2616
+ function c(l, n, e, r, i, t) {
2617
+ if (d.call(this, l, e), n && typeof n != "object")
2618
+ throw TypeError("values must be an object");
2619
+ if (this.valuesById = {}, this.values = Object.create(this.valuesById), this.comment = r, this.comments = i || {}, this.valuesOptions = t, this._valuesFeatures = {}, this.reserved = void 0, n)
2620
+ for (var f = Object.keys(n), s = 0; s < f.length; ++s)
2621
+ typeof n[f[s]] == "number" && (this.valuesById[this.values[f[s]] = n[f[s]]] = f[s]);
2622
+ }
2623
+ return c.prototype._resolveFeatures = function(n) {
2624
+ return n = this._edition || n, d.prototype._resolveFeatures.call(this, n), Object.keys(this.values).forEach((e) => {
2625
+ var r = Object.assign({}, this._features);
2626
+ this._valuesFeatures[e] = Object.assign(r, this.valuesOptions && this.valuesOptions[e] && this.valuesOptions[e].features);
2627
+ }), this;
2628
+ }, c.fromJSON = function(n, e) {
2629
+ var r = new c(n, e.values, e.options, e.comment, e.comments);
2630
+ return r.reserved = e.reserved, e.edition && (r._edition = e.edition), r._defaultEdition = "proto3", r;
2631
+ }, c.prototype.toJSON = function(n) {
2632
+ var e = n ? !!n.keepComments : !1;
2633
+ return h.toObject([
2634
+ "edition",
2635
+ this._editionToJSON(),
2636
+ "options",
2637
+ this.options,
2638
+ "valuesOptions",
2639
+ this.valuesOptions,
2640
+ "values",
2641
+ this.values,
2642
+ "reserved",
2643
+ this.reserved && this.reserved.length ? this.reserved : void 0,
2644
+ "comment",
2645
+ e ? this.comment : void 0,
2646
+ "comments",
2647
+ e ? this.comments : void 0
2648
+ ]);
2649
+ }, c.prototype.add = function(n, e, r, i) {
2650
+ if (!h.isString(n))
2651
+ throw TypeError("name must be a string");
2652
+ if (!h.isInteger(e))
2653
+ throw TypeError("id must be an integer");
2654
+ if (this.values[n] !== void 0)
2655
+ throw Error("duplicate name '" + n + "' in " + this);
2656
+ if (this.isReservedId(e))
2657
+ throw Error("id " + e + " is reserved in " + this);
2658
+ if (this.isReservedName(n))
2659
+ throw Error("name '" + n + "' is reserved in " + this);
2660
+ if (this.valuesById[e] !== void 0) {
2661
+ if (!(this.options && this.options.allow_alias))
2662
+ throw Error("duplicate id " + e + " in " + this);
2663
+ this.values[n] = e;
2664
+ } else
2665
+ this.valuesById[this.values[n] = e] = n;
2666
+ return i && (this.valuesOptions === void 0 && (this.valuesOptions = {}), this.valuesOptions[n] = i || null), this.comments[n] = r || null, this;
2667
+ }, c.prototype.remove = function(n) {
2668
+ if (!h.isString(n))
2669
+ throw TypeError("name must be a string");
2670
+ var e = this.values[n];
2671
+ if (e == null)
2672
+ throw Error("name '" + n + "' does not exist in " + this);
2673
+ return delete this.valuesById[e], delete this.values[n], delete this.comments[n], this.valuesOptions && delete this.valuesOptions[n], this;
2674
+ }, c.prototype.isReservedId = function(n) {
2675
+ return u.isReservedId(this.reserved, n);
2676
+ }, c.prototype.isReservedName = function(n) {
2677
+ return u.isReservedName(this.reserved, n);
2678
+ }, _enum;
2679
+ }
2680
+ var encoder_1, hasRequiredEncoder;
2681
+ function requireEncoder() {
2682
+ if (hasRequiredEncoder) return encoder_1;
2683
+ hasRequiredEncoder = 1, encoder_1 = l;
2684
+ var d = require_enum(), u = requireTypes(), h = requireUtil();
2685
+ function c(n, e, r, i) {
2686
+ return e.delimited ? n("types[%i].encode(%s,w.uint32(%i)).uint32(%i)", r, i, (e.id << 3 | 3) >>> 0, (e.id << 3 | 4) >>> 0) : n("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", r, i, (e.id << 3 | 2) >>> 0);
2687
+ }
2688
+ function l(n) {
2689
+ for (var e = h.codegen(["m", "w"], n.name + "$encode")("if(!w)")("w=Writer.create()"), r, i, t = (
2690
+ /* initializes */
2691
+ n.fieldsArray.slice().sort(h.compareFieldsById)
2692
+ ), r = 0; r < t.length; ++r) {
2693
+ var f = t[r].resolve(), s = n._fieldsArray.indexOf(f), a = f.resolvedType instanceof d ? "int32" : f.type, o = u.basic[a];
2694
+ i = "m" + h.safeProp(f.name), f.map ? (e("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", i, f.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){", i)("w.uint32(%i).fork().uint32(%i).%s(ks[i])", (f.id << 3 | 2) >>> 0, 8 | u.mapKey[f.keyType], f.keyType), o === void 0 ? e("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", s, i) : e(".uint32(%i).%s(%s[ks[i]]).ldelim()", 16 | o, a, i), e("}")("}")) : f.repeated ? (e("if(%s!=null&&%s.length){", i, i), f.packed && u.packed[a] !== void 0 ? e("w.uint32(%i).fork()", (f.id << 3 | 2) >>> 0)("for(var i=0;i<%s.length;++i)", i)("w.%s(%s[i])", a, i)("w.ldelim()") : (e("for(var i=0;i<%s.length;++i)", i), o === void 0 ? c(e, f, s, i + "[i]") : e("w.uint32(%i).%s(%s[i])", (f.id << 3 | o) >>> 0, a, i)), e("}")) : (f.optional && e("if(%s!=null&&Object.hasOwnProperty.call(m,%j))", i, f.name), o === void 0 ? c(e, f, s, i) : e("w.uint32(%i).%s(%s)", (f.id << 3 | o) >>> 0, a, i));
2695
+ }
2696
+ return e("return w");
2697
+ }
2698
+ return encoder_1;
2699
+ }
2700
+ var hasRequiredIndexLight;
2701
+ function requireIndexLight() {
2702
+ if (hasRequiredIndexLight) return indexLight.exports;
2703
+ hasRequiredIndexLight = 1;
2704
+ var d = indexLight.exports = requireIndexMinimal();
2705
+ d.build = "light";
2706
+ function u(c, l, n) {
2707
+ return typeof l == "function" ? (n = l, l = new d.Root()) : l || (l = new d.Root()), l.load(c, n);
2708
+ }
2709
+ d.load = u;
2710
+ function h(c, l) {
2711
+ return l || (l = new d.Root()), l.loadSync(c);
2712
+ }
2713
+ return d.loadSync = h, d.encoder = requireEncoder(), d.decoder = requireDecoder(), d.verifier = requireVerifier(), d.converter = requireConverter(), d.ReflectionObject = requireObject(), d.Namespace = requireNamespace(), d.Root = requireRoot(), d.Enum = require_enum(), d.Type = requireType(), d.Field = requireField(), d.OneOf = requireOneof(), d.MapField = requireMapfield(), d.Service = requireService(), d.Method = requireMethod(), d.Message = requireMessage(), d.wrappers = requireWrappers(), d.types = requireTypes(), d.util = requireUtil(), d.ReflectionObject._configure(d.Root), d.Namespace._configure(d.Type, d.Service, d.Enum), d.Root._configure(d.Type), d.Field._configure(d.Type), indexLight.exports;
2714
+ }
2715
+ var tokenize_1, hasRequiredTokenize;
2716
+ function requireTokenize() {
2717
+ if (hasRequiredTokenize) return tokenize_1;
2718
+ hasRequiredTokenize = 1, tokenize_1 = f;
2719
+ var d = /[\s{}=;:[\],'"()<>]/g, u = /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g, h = /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g, c = /^ *[*/]+ */, l = /^\s*\*?\/*/, n = /\n/g, e = /\s/, r = /\\(.?)/g, i = {
2720
+ 0: "\0",
2721
+ r: "\r",
2722
+ n: `
2723
+ `,
2724
+ t: " "
2725
+ };
2726
+ function t(s) {
2727
+ return s.replace(r, function(a, o) {
2728
+ switch (o) {
2729
+ case "\\":
2730
+ case "":
2731
+ return o;
2732
+ default:
2733
+ return i[o] || "";
2734
+ }
2735
+ });
2736
+ }
2737
+ f.unescape = t;
2738
+ function f(s, a) {
2739
+ s = s.toString();
2740
+ var o = 0, p = s.length, y = 1, b = 0, v = {}, m = [], _ = null;
2741
+ function R(I) {
2742
+ return Error("illegal " + I + " (line " + y + ")");
2743
+ }
2744
+ function k() {
2745
+ var I = _ === "'" ? h : u;
2746
+ I.lastIndex = o - 1;
2747
+ var x = I.exec(s);
2748
+ if (!x)
2749
+ throw R("string");
2750
+ return o = I.lastIndex, S(_), _ = null, t(x[1]);
2751
+ }
2752
+ function C(I) {
2753
+ return s.charAt(I);
2754
+ }
2755
+ function j(I, x, B) {
2756
+ var W = {
2757
+ type: s.charAt(I++),
2758
+ lineEmpty: !1,
2759
+ leading: B
2760
+ }, z;
2761
+ a ? z = 2 : z = 3;
2762
+ var F = I - z, $;
2763
+ do
2764
+ if (--F < 0 || ($ = s.charAt(F)) === `
2765
+ `) {
2766
+ W.lineEmpty = !0;
2767
+ break;
2768
+ }
2769
+ while ($ === " " || $ === " ");
2770
+ for (var K = s.substring(I, x).split(n), H = 0; H < K.length; ++H)
2771
+ K[H] = K[H].replace(a ? l : c, "").trim();
2772
+ W.text = K.join(`
2773
+ `).trim(), v[y] = W, b = y;
2774
+ }
2775
+ function X(I) {
2776
+ var x = P(I), B = s.substring(I, x), W = /^\s*\/\//.test(B);
2777
+ return W;
2778
+ }
2779
+ function P(I) {
2780
+ for (var x = I; x < p && C(x) !== `
2781
+ `; )
2782
+ x++;
2783
+ return x;
2784
+ }
2785
+ function D() {
2786
+ if (m.length > 0)
2787
+ return m.shift();
2788
+ if (_)
2789
+ return k();
2790
+ var I, x, B, W, z, F = o === 0;
2791
+ do {
2792
+ if (o === p)
2793
+ return null;
2794
+ for (I = !1; e.test(B = C(o)); )
2795
+ if (B === `
2796
+ ` && (F = !0, ++y), ++o === p)
2797
+ return null;
2798
+ if (C(o) === "/") {
2799
+ if (++o === p)
2800
+ throw R("comment");
2801
+ if (C(o) === "/")
2802
+ if (a) {
2803
+ if (W = o, z = !1, X(o - 1)) {
2804
+ z = !0;
2805
+ do
2806
+ if (o = P(o), o === p || (o++, !F))
2807
+ break;
2808
+ while (X(o));
2809
+ } else
2810
+ o = Math.min(p, P(o) + 1);
2811
+ z && (j(W, o, F), F = !0), y++, I = !0;
2812
+ } else {
2813
+ for (z = C(W = o + 1) === "/"; C(++o) !== `
2814
+ `; )
2815
+ if (o === p)
2816
+ return null;
2817
+ ++o, z && (j(W, o - 1, F), F = !0), ++y, I = !0;
2818
+ }
2819
+ else if ((B = C(o)) === "*") {
2820
+ W = o + 1, z = a || C(W) === "*";
2821
+ do {
2822
+ if (B === `
2823
+ ` && ++y, ++o === p)
2824
+ throw R("comment");
2825
+ x = B, B = C(o);
2826
+ } while (x !== "*" || B !== "/");
2827
+ ++o, z && (j(W, o - 2, F), F = !0), I = !0;
2828
+ } else
2829
+ return "/";
2830
+ }
2831
+ } while (I);
2832
+ var $ = o;
2833
+ d.lastIndex = 0;
2834
+ var K = d.test(C($++));
2835
+ if (!K)
2836
+ for (; $ < p && !d.test(C($)); )
2837
+ ++$;
2838
+ var H = s.substring(o, o = $);
2839
+ return (H === '"' || H === "'") && (_ = H), H;
2840
+ }
2841
+ function S(I) {
2842
+ m.push(I);
2843
+ }
2844
+ function J() {
2845
+ if (!m.length) {
2846
+ var I = D();
2847
+ if (I === null)
2848
+ return null;
2849
+ S(I);
2850
+ }
2851
+ return m[0];
2852
+ }
2853
+ function U(I, x) {
2854
+ var B = J(), W = B === I;
2855
+ if (W)
2856
+ return D(), !0;
2857
+ if (!x)
2858
+ throw R("token '" + B + "', '" + I + "' expected");
2859
+ return !1;
2860
+ }
2861
+ function T(I) {
2862
+ var x = null, B;
2863
+ return I === void 0 ? (B = v[y - 1], delete v[y - 1], B && (a || B.type === "*" || B.lineEmpty) && (x = B.leading ? B.text : null)) : (b < I && J(), B = v[I], delete v[I], B && !B.lineEmpty && (a || B.type === "/") && (x = B.leading ? null : B.text)), x;
2864
+ }
2865
+ return Object.defineProperty({
2866
+ next: D,
2867
+ peek: J,
2868
+ push: S,
2869
+ skip: U,
2870
+ cmnt: T
2871
+ }, "line", {
2872
+ get: function() {
2873
+ return y;
2874
+ }
2875
+ });
2876
+ }
2877
+ return tokenize_1;
2878
+ }
2879
+ var parse_1, hasRequiredParse;
2880
+ function requireParse() {
2881
+ if (hasRequiredParse) return parse_1;
2882
+ hasRequiredParse = 1, parse_1 = k, k.filename = null, k.defaults = { keepCase: !1 };
2883
+ var d = requireTokenize(), u = requireRoot(), h = requireType(), c = requireField(), l = requireMapfield(), n = requireOneof(), e = require_enum(), r = requireService(), i = requireMethod(), t = requireObject(), f = requireTypes(), s = requireUtil(), a = /^[1-9][0-9]*$/, o = /^-?[1-9][0-9]*$/, p = /^0[x][0-9a-fA-F]+$/, y = /^-?0[x][0-9a-fA-F]+$/, b = /^0[0-7]+$/, v = /^-?0[0-7]+$/, m = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/, _ = /^[a-zA-Z_][a-zA-Z_0-9]*$/, R = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;
2884
+ function k(C, j, X) {
2885
+ j instanceof u || (X = j, j = new u()), X || (X = k.defaults);
2886
+ var P = X.preferTrailingComment || !1, D = d(C, X.alternateCommentMode || !1), S = D.next, J = D.push, U = D.peek, T = D.skip, I = D.cmnt, x = !0, B, W, z, F = "proto2", $ = j, K = [], H = {}, ae = X.keepCase ? function(O) {
2887
+ return O;
2888
+ } : s.camelCase;
2889
+ function he() {
2890
+ K.forEach((O) => {
2891
+ O._edition = F, Object.keys(H).forEach((g) => {
2892
+ O.getOption(g) === void 0 && O.setOption(g, H[g], !0);
2893
+ });
2894
+ });
2895
+ }
2896
+ function q(O, g, E) {
2897
+ var w = k.filename;
2898
+ return E || (k.filename = null), Error("illegal " + (g || "token") + " '" + O + "' (" + (w ? w + ", " : "") + "line " + D.line + ")");
2899
+ }
2900
+ function ee() {
2901
+ var O = [], g;
2902
+ do {
2903
+ if ((g = S()) !== '"' && g !== "'")
2904
+ throw q(g);
2905
+ O.push(S()), T(g), g = U();
2906
+ } while (g === '"' || g === "'");
2907
+ return O.join("");
2908
+ }
2909
+ function ue(O) {
2910
+ var g = S();
2911
+ switch (g) {
2912
+ case "'":
2913
+ case '"':
2914
+ return J(g), ee();
2915
+ case "true":
2916
+ case "TRUE":
2917
+ return !0;
2918
+ case "false":
2919
+ case "FALSE":
2920
+ return !1;
2921
+ }
2922
+ try {
2923
+ return pe(
2924
+ g,
2925
+ /* insideTryCatch */
2926
+ !0
2927
+ );
2928
+ } catch {
2929
+ if (R.test(g))
2930
+ return g;
2931
+ throw q(g, "value");
2932
+ }
2933
+ }
2934
+ function re(O, g) {
2935
+ var E, w;
2936
+ do
2937
+ if (g && ((E = U()) === '"' || E === "'")) {
2938
+ var A = ee();
2939
+ if (O.push(A), F >= 2023)
2940
+ throw q(A, "id");
2941
+ } else
2942
+ try {
2943
+ O.push([w = te(S()), T("to", !0) ? te(S()) : w]);
2944
+ } catch (L) {
2945
+ if (g && R.test(E) && F >= 2023)
2946
+ O.push(E);
2947
+ else
2948
+ throw L;
2949
+ }
2950
+ while (T(",", !0));
2951
+ var N = { options: void 0 };
2952
+ N.setOption = function(L, G) {
2953
+ this.options === void 0 && (this.options = {}), this.options[L] = G;
2954
+ }, Z(
2955
+ N,
2956
+ function(G) {
2957
+ if (G === "option")
2958
+ Q(N, G), T(";");
2959
+ else
2960
+ throw q(G);
2961
+ },
2962
+ function() {
2963
+ se(N);
2964
+ }
2965
+ );
2966
+ }
2967
+ function pe(O, g) {
2968
+ var E = 1;
2969
+ switch (O.charAt(0) === "-" && (E = -1, O = O.substring(1)), O) {
2970
+ case "inf":
2971
+ case "INF":
2972
+ case "Inf":
2973
+ return E * (1 / 0);
2974
+ case "nan":
2975
+ case "NAN":
2976
+ case "Nan":
2977
+ case "NaN":
2978
+ return NaN;
2979
+ case "0":
2980
+ return 0;
2981
+ }
2982
+ if (a.test(O))
2983
+ return E * parseInt(O, 10);
2984
+ if (p.test(O))
2985
+ return E * parseInt(O, 16);
2986
+ if (b.test(O))
2987
+ return E * parseInt(O, 8);
2988
+ if (m.test(O))
2989
+ return E * parseFloat(O);
2990
+ throw q(O, "number", g);
2991
+ }
2992
+ function te(O, g) {
2993
+ switch (O) {
2994
+ case "max":
2995
+ case "MAX":
2996
+ case "Max":
2997
+ return 536870911;
2998
+ case "0":
2999
+ return 0;
3000
+ }
3001
+ if (!g && O.charAt(0) === "-")
3002
+ throw q(O, "id");
3003
+ if (o.test(O))
3004
+ return parseInt(O, 10);
3005
+ if (y.test(O))
3006
+ return parseInt(O, 16);
3007
+ if (v.test(O))
3008
+ return parseInt(O, 8);
3009
+ throw q(O, "id");
3010
+ }
3011
+ function ye() {
3012
+ if (B !== void 0)
3013
+ throw q("package");
3014
+ if (B = S(), !R.test(B))
3015
+ throw q(B, "name");
3016
+ $ = $.define(B), T(";");
3017
+ }
3018
+ function me() {
3019
+ var O = U(), g;
3020
+ switch (O) {
3021
+ case "option":
3022
+ if (F < "2024")
3023
+ throw q("option");
3024
+ S(), ee(), T(";");
3025
+ return;
3026
+ case "weak":
3027
+ g = z || (z = []), S();
3028
+ break;
3029
+ case "public":
3030
+ S();
3031
+ // eslint-disable-next-line no-fallthrough
3032
+ default:
3033
+ g = W || (W = []);
3034
+ break;
3035
+ }
3036
+ O = ee(), T(";"), g.push(O);
3037
+ }
3038
+ function ve() {
3039
+ if (T("="), F = ee(), F < 2023)
3040
+ throw q(F, "syntax");
3041
+ T(";");
3042
+ }
3043
+ function ge() {
3044
+ if (T("="), F = ee(), !["2023", "2024"].includes(F))
3045
+ throw q(F, "edition");
3046
+ T(";");
3047
+ }
3048
+ function ie(O, g) {
3049
+ switch (g) {
3050
+ case "option":
3051
+ return Q(O, g), T(";"), !0;
3052
+ case "message":
3053
+ return ne(O, g), !0;
3054
+ case "enum":
3055
+ return de(O, g), !0;
3056
+ case "export":
3057
+ case "local":
3058
+ return F < "2024" || (g = S(), g === "export" || g === "local") || g !== "message" && g !== "enum" ? !1 : ie(O, g);
3059
+ case "service":
3060
+ return we(O, g), !0;
3061
+ case "extend":
3062
+ return Se(O, g), !0;
3063
+ }
3064
+ return !1;
3065
+ }
3066
+ function Z(O, g, E) {
3067
+ var w = D.line;
3068
+ if (O && (typeof O.comment != "string" && (O.comment = I()), O.filename = k.filename), T("{", !0)) {
3069
+ for (var A; (A = S()) !== "}"; )
3070
+ g(A);
3071
+ T(";", !0);
3072
+ } else
3073
+ E && E(), T(";"), O && (typeof O.comment != "string" || P) && (O.comment = I(w) || O.comment);
3074
+ }
3075
+ function ne(O, g) {
3076
+ if (!_.test(g = S()))
3077
+ throw q(g, "type name");
3078
+ var E = new h(g);
3079
+ Z(E, function(A) {
3080
+ if (!ie(E, A))
3081
+ switch (A) {
3082
+ case "map":
3083
+ be(E);
3084
+ break;
3085
+ case "required":
3086
+ if (F !== "proto2")
3087
+ throw q(A);
3088
+ /* eslint-disable no-fallthrough */
3089
+ case "repeated":
3090
+ Y(E, A);
3091
+ break;
3092
+ case "optional":
3093
+ if (F === "proto3")
3094
+ Y(E, "proto3_optional");
3095
+ else {
3096
+ if (F !== "proto2")
3097
+ throw q(A);
3098
+ Y(E, "optional");
3099
+ }
3100
+ break;
3101
+ case "oneof":
3102
+ Oe(E, A);
3103
+ break;
3104
+ case "extensions":
3105
+ re(E.extensions || (E.extensions = []));
3106
+ break;
3107
+ case "reserved":
3108
+ re(E.reserved || (E.reserved = []), !0);
3109
+ break;
3110
+ default:
3111
+ if (F === "proto2" || !R.test(A))
3112
+ throw q(A);
3113
+ J(A), Y(E, "optional");
3114
+ break;
3115
+ }
3116
+ }), O.add(E), O === $ && K.push(E);
3117
+ }
3118
+ function Y(O, g, E) {
3119
+ var w = S();
3120
+ if (w === "group") {
3121
+ _e(O, g);
3122
+ return;
3123
+ }
3124
+ for (; w.endsWith(".") || U().startsWith("."); )
3125
+ w += S();
3126
+ if (!R.test(w))
3127
+ throw q(w, "type");
3128
+ var A = S();
3129
+ if (!_.test(A))
3130
+ throw q(A, "name");
3131
+ A = ae(A), T("=");
3132
+ var N = new c(A, te(S()), w, g, E);
3133
+ if (Z(N, function(M) {
3134
+ if (M === "option")
3135
+ Q(N, M), T(";");
3136
+ else
3137
+ throw q(M);
3138
+ }, function() {
3139
+ se(N);
3140
+ }), g === "proto3_optional") {
3141
+ var L = new n("_" + A);
3142
+ N.setOption("proto3_optional", !0), L.add(N), O.add(L);
3143
+ } else
3144
+ O.add(N);
3145
+ O === $ && K.push(N);
3146
+ }
3147
+ function _e(O, g) {
3148
+ if (F >= 2023)
3149
+ throw q("group");
3150
+ var E = S();
3151
+ if (!_.test(E))
3152
+ throw q(E, "name");
3153
+ var w = s.lcFirst(E);
3154
+ E === w && (E = s.ucFirst(E)), T("=");
3155
+ var A = te(S()), N = new h(E);
3156
+ N.group = !0;
3157
+ var L = new c(w, A, E, g);
3158
+ L.filename = k.filename, Z(N, function(M) {
3159
+ switch (M) {
3160
+ case "option":
3161
+ Q(N, M), T(";");
3162
+ break;
3163
+ case "required":
3164
+ case "repeated":
3165
+ Y(N, M);
3166
+ break;
3167
+ case "optional":
3168
+ F === "proto3" ? Y(N, "proto3_optional") : Y(N, "optional");
3169
+ break;
3170
+ case "message":
3171
+ ne(N, M);
3172
+ break;
3173
+ case "enum":
3174
+ de(N, M);
3175
+ break;
3176
+ case "reserved":
3177
+ re(N.reserved || (N.reserved = []), !0);
3178
+ break;
3179
+ case "export":
3180
+ case "local":
3181
+ if (F < "2024")
3182
+ throw q(M);
3183
+ switch (M = S(), M) {
3184
+ case "message":
3185
+ ne(N, M);
3186
+ break;
3187
+ case "enum":
3188
+ ne(N, M);
3189
+ break;
3190
+ default:
3191
+ throw q(M);
3192
+ }
3193
+ break;
3194
+ /* istanbul ignore next */
3195
+ default:
3196
+ throw q(M);
3197
+ }
3198
+ }), O.add(N).add(L);
3199
+ }
3200
+ function be(O) {
3201
+ T("<");
3202
+ var g = S();
3203
+ if (f.mapKey[g] === void 0)
3204
+ throw q(g, "type");
3205
+ T(",");
3206
+ var E = S();
3207
+ if (!R.test(E))
3208
+ throw q(E, "type");
3209
+ T(">");
3210
+ var w = S();
3211
+ if (!_.test(w))
3212
+ throw q(w, "name");
3213
+ T("=");
3214
+ var A = new l(ae(w), te(S()), g, E);
3215
+ Z(A, function(L) {
3216
+ if (L === "option")
3217
+ Q(A, L), T(";");
3218
+ else
3219
+ throw q(L);
3220
+ }, function() {
3221
+ se(A);
3222
+ }), O.add(A);
3223
+ }
3224
+ function Oe(O, g) {
3225
+ if (!_.test(g = S()))
3226
+ throw q(g, "name");
3227
+ var E = new n(ae(g));
3228
+ Z(E, function(A) {
3229
+ A === "option" ? (Q(E, A), T(";")) : (J(A), Y(E, "optional"));
3230
+ }), O.add(E);
3231
+ }
3232
+ function de(O, g) {
3233
+ if (!_.test(g = S()))
3234
+ throw q(g, "name");
3235
+ var E = new e(g);
3236
+ Z(E, function(A) {
3237
+ switch (A) {
3238
+ case "option":
3239
+ Q(E, A), T(";");
3240
+ break;
3241
+ case "reserved":
3242
+ re(E.reserved || (E.reserved = []), !0), E.reserved === void 0 && (E.reserved = []);
3243
+ break;
3244
+ default:
3245
+ Ee(E, A);
3246
+ }
3247
+ }), O.add(E), O === $ && K.push(E);
3248
+ }
3249
+ function Ee(O, g) {
3250
+ if (!_.test(g))
3251
+ throw q(g, "name");
3252
+ T("=");
3253
+ var E = te(S(), !0), w = {
3254
+ options: void 0
3255
+ };
3256
+ w.getOption = function(A) {
3257
+ return this.options[A];
3258
+ }, w.setOption = function(A, N) {
3259
+ t.prototype.setOption.call(w, A, N);
3260
+ }, w.setParsedOption = function() {
3261
+ }, Z(w, function(N) {
3262
+ if (N === "option")
3263
+ Q(w, N), T(";");
3264
+ else
3265
+ throw q(N);
3266
+ }, function() {
3267
+ se(w);
3268
+ }), O.add(g, E, w.comment, w.parsedOptions || w.options);
3269
+ }
3270
+ function Q(O, g) {
3271
+ var E, w, A = !0;
3272
+ for (g === "option" && (g = S()); g !== "="; ) {
3273
+ if (g === "(") {
3274
+ var N = S();
3275
+ T(")"), g = "(" + N + ")";
3276
+ }
3277
+ if (A) {
3278
+ if (A = !1, g.includes(".") && !g.includes("(")) {
3279
+ var L = g.split(".");
3280
+ E = L[0] + ".", g = L[1];
3281
+ continue;
3282
+ }
3283
+ E = g;
3284
+ } else
3285
+ w = w ? w += g : g;
3286
+ g = S();
3287
+ }
3288
+ var G = w ? E.concat(w) : E, M = ce(O, G);
3289
+ w = w && w[0] === "." ? w.slice(1) : w, E = E && E[E.length - 1] === "." ? E.slice(0, -1) : E, Re(O, E, M, w);
3290
+ }
3291
+ function ce(O, g) {
3292
+ if (T("{", !0)) {
3293
+ for (var E = {}; !T("}", !0); ) {
3294
+ if (!_.test(V = S()))
3295
+ throw q(V, "name");
3296
+ if (V === null)
3297
+ throw q(V, "end of input");
3298
+ var w, A = V;
3299
+ if (T(":", !0), U() === "{")
3300
+ w = ce(O, g + "." + V);
3301
+ else if (U() === "[") {
3302
+ w = [];
3303
+ var N;
3304
+ if (T("[", !0)) {
3305
+ do
3306
+ N = ue(), w.push(N);
3307
+ while (T(",", !0));
3308
+ T("]"), typeof N < "u" && fe(O, g + "." + V, N);
3309
+ }
3310
+ } else
3311
+ w = ue(), fe(O, g + "." + V, w);
3312
+ var L = E[A];
3313
+ L && (w = [].concat(L).concat(w)), E[A] = w, T(",", !0), T(";", !0);
3314
+ }
3315
+ return E;
3316
+ }
3317
+ var G = ue();
3318
+ return fe(O, g, G), G;
3319
+ }
3320
+ function fe(O, g, E) {
3321
+ if ($ === O && /^features\./.test(g)) {
3322
+ H[g] = E;
3323
+ return;
3324
+ }
3325
+ O.setOption && O.setOption(g, E);
3326
+ }
3327
+ function Re(O, g, E, w) {
3328
+ O.setParsedOption && O.setParsedOption(g, E, w);
3329
+ }
3330
+ function se(O) {
3331
+ if (T("[", !0)) {
3332
+ do
3333
+ Q(O, "option");
3334
+ while (T(",", !0));
3335
+ T("]");
3336
+ }
3337
+ return O;
3338
+ }
3339
+ function we(O, g) {
3340
+ if (!_.test(g = S()))
3341
+ throw q(g, "service name");
3342
+ var E = new r(g);
3343
+ Z(E, function(A) {
3344
+ if (!ie(E, A))
3345
+ if (A === "rpc")
3346
+ Ae(E, A);
3347
+ else
3348
+ throw q(A);
3349
+ }), O.add(E), O === $ && K.push(E);
3350
+ }
3351
+ function Ae(O, g) {
3352
+ var E = I(), w = g;
3353
+ if (!_.test(g = S()))
3354
+ throw q(g, "name");
3355
+ var A = g, N, L, G, M;
3356
+ if (T("("), T("stream", !0) && (L = !0), !R.test(g = S()) || (N = g, T(")"), T("returns"), T("("), T("stream", !0) && (M = !0), !R.test(g = S())))
3357
+ throw q(g);
3358
+ G = g, T(")");
3359
+ var oe = new i(A, w, N, G, L, M);
3360
+ oe.comment = E, Z(oe, function(le) {
3361
+ if (le === "option")
3362
+ Q(oe, le), T(";");
3363
+ else
3364
+ throw q(le);
3365
+ }), O.add(oe);
3366
+ }
3367
+ function Se(O, g) {
3368
+ if (!R.test(g = S()))
3369
+ throw q(g, "reference");
3370
+ var E = g;
3371
+ Z(null, function(A) {
3372
+ switch (A) {
3373
+ case "required":
3374
+ case "repeated":
3375
+ Y(O, A, E);
3376
+ break;
3377
+ case "optional":
3378
+ F === "proto3" ? Y(O, "proto3_optional", E) : Y(O, "optional", E);
3379
+ break;
3380
+ default:
3381
+ if (F === "proto2" || !R.test(A))
3382
+ throw q(A);
3383
+ J(A), Y(O, "optional", E);
3384
+ break;
3385
+ }
3386
+ });
3387
+ }
3388
+ for (var V; (V = S()) !== null; )
3389
+ switch (V) {
3390
+ case "package":
3391
+ if (!x)
3392
+ throw q(V);
3393
+ ye();
3394
+ break;
3395
+ case "import":
3396
+ if (!x)
3397
+ throw q(V);
3398
+ me();
3399
+ break;
3400
+ case "syntax":
3401
+ if (!x)
3402
+ throw q(V);
3403
+ ve();
3404
+ break;
3405
+ case "edition":
3406
+ if (!x)
3407
+ throw q(V);
3408
+ ge();
3409
+ break;
3410
+ case "option":
3411
+ Q($, V), T(";", !0);
3412
+ break;
3413
+ default:
3414
+ if (ie($, V)) {
3415
+ x = !1;
3416
+ continue;
3417
+ }
3418
+ throw q(V);
3419
+ }
3420
+ return he(), k.filename = null, {
3421
+ package: B,
3422
+ imports: W,
3423
+ weakImports: z,
3424
+ root: j
3425
+ };
3426
+ }
3427
+ return parse_1;
3428
+ }
3429
+ var common_1, hasRequiredCommon;
3430
+ function requireCommon() {
3431
+ if (hasRequiredCommon) return common_1;
3432
+ hasRequiredCommon = 1, common_1 = u;
3433
+ var d = /\/|\./;
3434
+ function u(c, l) {
3435
+ d.test(c) || (c = "google/protobuf/" + c + ".proto", l = { nested: { google: { nested: { protobuf: { nested: l } } } } }), u[c] = l;
3436
+ }
3437
+ u("any", {
3438
+ /**
3439
+ * Properties of a google.protobuf.Any message.
3440
+ * @interface IAny
3441
+ * @type {Object}
3442
+ * @property {string} [typeUrl]
3443
+ * @property {Uint8Array} [bytes]
3444
+ * @memberof common
3445
+ */
3446
+ Any: {
3447
+ fields: {
3448
+ type_url: {
3449
+ type: "string",
3450
+ id: 1
3451
+ },
3452
+ value: {
3453
+ type: "bytes",
3454
+ id: 2
3455
+ }
3456
+ }
3457
+ }
3458
+ });
3459
+ var h;
3460
+ return u("duration", {
3461
+ /**
3462
+ * Properties of a google.protobuf.Duration message.
3463
+ * @interface IDuration
3464
+ * @type {Object}
3465
+ * @property {number|Long} [seconds]
3466
+ * @property {number} [nanos]
3467
+ * @memberof common
3468
+ */
3469
+ Duration: h = {
3470
+ fields: {
3471
+ seconds: {
3472
+ type: "int64",
3473
+ id: 1
3474
+ },
3475
+ nanos: {
3476
+ type: "int32",
3477
+ id: 2
3478
+ }
3479
+ }
3480
+ }
3481
+ }), u("timestamp", {
3482
+ /**
3483
+ * Properties of a google.protobuf.Timestamp message.
3484
+ * @interface ITimestamp
3485
+ * @type {Object}
3486
+ * @property {number|Long} [seconds]
3487
+ * @property {number} [nanos]
3488
+ * @memberof common
3489
+ */
3490
+ Timestamp: h
3491
+ }), u("empty", {
3492
+ /**
3493
+ * Properties of a google.protobuf.Empty message.
3494
+ * @interface IEmpty
3495
+ * @memberof common
3496
+ */
3497
+ Empty: {
3498
+ fields: {}
3499
+ }
3500
+ }), u("struct", {
3501
+ /**
3502
+ * Properties of a google.protobuf.Struct message.
3503
+ * @interface IStruct
3504
+ * @type {Object}
3505
+ * @property {Object.<string,IValue>} [fields]
3506
+ * @memberof common
3507
+ */
3508
+ Struct: {
3509
+ fields: {
3510
+ fields: {
3511
+ keyType: "string",
3512
+ type: "Value",
3513
+ id: 1
3514
+ }
3515
+ }
3516
+ },
3517
+ /**
3518
+ * Properties of a google.protobuf.Value message.
3519
+ * @interface IValue
3520
+ * @type {Object}
3521
+ * @property {string} [kind]
3522
+ * @property {0} [nullValue]
3523
+ * @property {number} [numberValue]
3524
+ * @property {string} [stringValue]
3525
+ * @property {boolean} [boolValue]
3526
+ * @property {IStruct} [structValue]
3527
+ * @property {IListValue} [listValue]
3528
+ * @memberof common
3529
+ */
3530
+ Value: {
3531
+ oneofs: {
3532
+ kind: {
3533
+ oneof: [
3534
+ "nullValue",
3535
+ "numberValue",
3536
+ "stringValue",
3537
+ "boolValue",
3538
+ "structValue",
3539
+ "listValue"
3540
+ ]
3541
+ }
3542
+ },
3543
+ fields: {
3544
+ nullValue: {
3545
+ type: "NullValue",
3546
+ id: 1
3547
+ },
3548
+ numberValue: {
3549
+ type: "double",
3550
+ id: 2
3551
+ },
3552
+ stringValue: {
3553
+ type: "string",
3554
+ id: 3
3555
+ },
3556
+ boolValue: {
3557
+ type: "bool",
3558
+ id: 4
3559
+ },
3560
+ structValue: {
3561
+ type: "Struct",
3562
+ id: 5
3563
+ },
3564
+ listValue: {
3565
+ type: "ListValue",
3566
+ id: 6
3567
+ }
3568
+ }
3569
+ },
3570
+ NullValue: {
3571
+ values: {
3572
+ NULL_VALUE: 0
3573
+ }
3574
+ },
3575
+ /**
3576
+ * Properties of a google.protobuf.ListValue message.
3577
+ * @interface IListValue
3578
+ * @type {Object}
3579
+ * @property {Array.<IValue>} [values]
3580
+ * @memberof common
3581
+ */
3582
+ ListValue: {
3583
+ fields: {
3584
+ values: {
3585
+ rule: "repeated",
3586
+ type: "Value",
3587
+ id: 1
3588
+ }
3589
+ }
3590
+ }
3591
+ }), u("wrappers", {
3592
+ /**
3593
+ * Properties of a google.protobuf.DoubleValue message.
3594
+ * @interface IDoubleValue
3595
+ * @type {Object}
3596
+ * @property {number} [value]
3597
+ * @memberof common
3598
+ */
3599
+ DoubleValue: {
3600
+ fields: {
3601
+ value: {
3602
+ type: "double",
3603
+ id: 1
3604
+ }
3605
+ }
3606
+ },
3607
+ /**
3608
+ * Properties of a google.protobuf.FloatValue message.
3609
+ * @interface IFloatValue
3610
+ * @type {Object}
3611
+ * @property {number} [value]
3612
+ * @memberof common
3613
+ */
3614
+ FloatValue: {
3615
+ fields: {
3616
+ value: {
3617
+ type: "float",
3618
+ id: 1
3619
+ }
3620
+ }
3621
+ },
3622
+ /**
3623
+ * Properties of a google.protobuf.Int64Value message.
3624
+ * @interface IInt64Value
3625
+ * @type {Object}
3626
+ * @property {number|Long} [value]
3627
+ * @memberof common
3628
+ */
3629
+ Int64Value: {
3630
+ fields: {
3631
+ value: {
3632
+ type: "int64",
3633
+ id: 1
3634
+ }
3635
+ }
3636
+ },
3637
+ /**
3638
+ * Properties of a google.protobuf.UInt64Value message.
3639
+ * @interface IUInt64Value
3640
+ * @type {Object}
3641
+ * @property {number|Long} [value]
3642
+ * @memberof common
3643
+ */
3644
+ UInt64Value: {
3645
+ fields: {
3646
+ value: {
3647
+ type: "uint64",
3648
+ id: 1
3649
+ }
3650
+ }
3651
+ },
3652
+ /**
3653
+ * Properties of a google.protobuf.Int32Value message.
3654
+ * @interface IInt32Value
3655
+ * @type {Object}
3656
+ * @property {number} [value]
3657
+ * @memberof common
3658
+ */
3659
+ Int32Value: {
3660
+ fields: {
3661
+ value: {
3662
+ type: "int32",
3663
+ id: 1
3664
+ }
3665
+ }
3666
+ },
3667
+ /**
3668
+ * Properties of a google.protobuf.UInt32Value message.
3669
+ * @interface IUInt32Value
3670
+ * @type {Object}
3671
+ * @property {number} [value]
3672
+ * @memberof common
3673
+ */
3674
+ UInt32Value: {
3675
+ fields: {
3676
+ value: {
3677
+ type: "uint32",
3678
+ id: 1
3679
+ }
3680
+ }
3681
+ },
3682
+ /**
3683
+ * Properties of a google.protobuf.BoolValue message.
3684
+ * @interface IBoolValue
3685
+ * @type {Object}
3686
+ * @property {boolean} [value]
3687
+ * @memberof common
3688
+ */
3689
+ BoolValue: {
3690
+ fields: {
3691
+ value: {
3692
+ type: "bool",
3693
+ id: 1
3694
+ }
3695
+ }
3696
+ },
3697
+ /**
3698
+ * Properties of a google.protobuf.StringValue message.
3699
+ * @interface IStringValue
3700
+ * @type {Object}
3701
+ * @property {string} [value]
3702
+ * @memberof common
3703
+ */
3704
+ StringValue: {
3705
+ fields: {
3706
+ value: {
3707
+ type: "string",
3708
+ id: 1
3709
+ }
3710
+ }
3711
+ },
3712
+ /**
3713
+ * Properties of a google.protobuf.BytesValue message.
3714
+ * @interface IBytesValue
3715
+ * @type {Object}
3716
+ * @property {Uint8Array} [value]
3717
+ * @memberof common
3718
+ */
3719
+ BytesValue: {
3720
+ fields: {
3721
+ value: {
3722
+ type: "bytes",
3723
+ id: 1
3724
+ }
3725
+ }
3726
+ }
3727
+ }), u("field_mask", {
3728
+ /**
3729
+ * Properties of a google.protobuf.FieldMask message.
3730
+ * @interface IDoubleValue
3731
+ * @type {Object}
3732
+ * @property {number} [value]
3733
+ * @memberof common
3734
+ */
3735
+ FieldMask: {
3736
+ fields: {
3737
+ paths: {
3738
+ rule: "repeated",
3739
+ type: "string",
3740
+ id: 1
3741
+ }
3742
+ }
3743
+ }
3744
+ }), u.get = function(l) {
3745
+ return u[l] || null;
3746
+ }, common_1;
3747
+ }
3748
+ var hasRequiredSrc;
3749
+ function requireSrc() {
3750
+ if (hasRequiredSrc) return src.exports;
3751
+ hasRequiredSrc = 1;
3752
+ var d = src.exports = requireIndexLight();
3753
+ return d.build = "full", d.tokenize = requireTokenize(), d.parse = requireParse(), d.common = requireCommon(), d.Root._configure(d.Type, d.parse, d.common), src.exports;
3754
+ }
3755
+ var protobufjs, hasRequiredProtobufjs;
3756
+ function requireProtobufjs() {
3757
+ return hasRequiredProtobufjs || (hasRequiredProtobufjs = 1, protobufjs = requireSrc()), protobufjs;
3758
+ }
3759
+ var protobufjsExports = requireProtobufjs();
3760
+ const nested = { BSB_State: { nested: { StateUpdate: { oneofs: { state: { oneof: ["deviceName", "power", "brightness", "audioVolume", "wifi", "updateState", "updateCheck", "timezone", "matter", "frame", "input", "timer", "ble", "autoUpdateState"] } }, fields: { deviceName: { type: "BSB_State.DeviceName", id: 1 }, power: { type: "BSB_State.Power", id: 2 }, brightness: { type: "BSB_State.Brightness", id: 3 }, audioVolume: { type: "BSB_State.AudioVolume", id: 4 }, wifi: { type: "BSB_State.Wifi", id: 5 }, updateState: { type: "BSB_Update.UpdateState", id: 6 }, updateCheck: { type: "BSB_Update.CheckState", id: 7 }, timezone: { type: "BSB_State.Timezone", id: 8 }, matter: { type: "BSB_State.Matter", id: 9 }, frame: { type: "BSB_Frame.Frame", id: 10 }, input: { type: "BSB_Input.InputEvent", id: 11 }, timer: { type: "BSB_Timer.Timer", id: 12 }, ble: { type: "BSB_State.Ble.Ble", id: 13 }, autoUpdateState: { type: "BSB_Update.AutoUpdateState", id: 14 } } }, State: { oneofs: { _error: { oneof: ["error"] } }, fields: { timestamp: { type: "fixed64", id: 1 }, updates: { rule: "repeated", type: "StateUpdate", id: 2 }, error: { type: "BSB_Error.Error", id: 3, options: { proto3_optional: !0 } } } }, DeviceName: { fields: { name: { type: "string", id: 1 } } }, BrightnessAutomatic: { fields: {} }, BrightnessManual: { fields: { brightness: { type: "uint32", id: 1 } } }, Brightness: { oneofs: { setting: { oneof: ["automatic", "manual"] } }, fields: { automatic: { type: "BrightnessAutomatic", id: 1 }, manual: { type: "BrightnessManual", id: 2 }, actualBrightness: { type: "uint32", id: 3 } } }, BatteryStatus: { values: { DISCHARGING: 0, CHARGING: 1, CHARGED: 2 } }, UnknownPowerState: { fields: {} }, PowerState: { fields: { batteryStatus: { type: "BatteryStatus", id: 1 }, batteryChargePercent: { type: "uint32", id: 2 }, batteryVoltageMv: { type: "uint32", id: 3 }, batteryCurrentMa: { type: "sint32", id: 4 }, usbVoltageMv: { type: "uint32", id: 5 } } }, Power: { oneofs: { state: { oneof: ["unknown", "known"] } }, fields: { unknown: { type: "UnknownPowerState", id: 1 }, known: { type: "PowerState", id: 2 } } }, AudioVolume: { fields: { volume: { type: "uint32", id: 1 } } }, WifiConnectionStatus: { values: { CONNECTED: 0, CONNECTING: 1, DISCONNECTING: 2, RECONNECTING: 3 } }, WifiSecurity: { values: { UNKNOWN: 0, OPEN: 1, WPA: 2, WPA2: 3, WEP: 4, WPA_WPA2: 5, WPA3: 6, WPA2_WPA3: 7 } }, IpConfigurationMethod: { values: { DHCP: 0, STATIC: 1 } }, IpProtocol: { values: { IPV4: 0, IPV6: 1 } }, WifiStateUnknown: { fields: {} }, WifiStateDisconnected: { fields: {} }, WifiStateConnected: { fields: { status: { type: "WifiConnectionStatus", id: 1 }, ssid: { type: "string", id: 2 }, bssid: { type: "string", id: 3 }, channel: { type: "uint32", id: 4 }, rssi: { type: "sint32", id: 5 }, security: { type: "WifiSecurity", id: 6 } } }, IpAddress: { fields: { protocol: { type: "IpProtocol", id: 1 }, method: { type: "IpConfigurationMethod", id: 2 }, address: { type: "string", id: 3 }, gateway: { type: "string", id: 4 }, netmask: { type: "string", id: 5 } } }, Wifi: { oneofs: { wifiState: { oneof: ["unknown", "disconnected", "connected"] } }, fields: { unknown: { type: "WifiStateUnknown", id: 1 }, disconnected: { type: "WifiStateDisconnected", id: 2 }, connected: { type: "WifiStateConnected", id: 3 }, ipAddresses: { rule: "repeated", type: "IpAddress", id: 4 } } }, Timezone: { fields: { name: { type: "string", id: 1 }, offset: { type: "sint32", id: 2 }, abbr: { type: "string", id: 3 } } }, MatterCommissioningStatus: { values: { NEVER_STARTED: 0, STARTED: 1, COMPLETED_SUCCESSFULLY: 2, FAILED: 3 } }, MatterCommissioningState: { fields: { status: { type: "MatterCommissioningStatus", id: 1 }, timestamp: { type: "fixed64", id: 2 } } }, Matter: { fields: { fabricCount: { type: "uint32", id: 1 }, state: { type: "MatterCommissioningState", id: 2 } } }, Ble: { nested: { ServiceStatus: { values: { RESET: 0, INITIALIZATION: 1, READY: 2, ADVERTISING: 3, CONNECTABLE: 4, CONNECTED: 5, ERROR: 6 } }, Ble: { oneofs: { _remoteAddress: { oneof: ["remoteAddress"] } }, fields: { status: { type: "ServiceStatus", id: 1 }, remoteAddress: { type: "string", id: 2, options: { proto3_optional: !0 } } } } } } } }, BSB_Update: { nested: { UpdateEvent: { values: { SESSION_START: 0, SESSION_STOP: 1, ACTION_BEGIN: 2, ACTION_DONE: 3, DETAIL_CHANGE: 4, ACTION_PROGRESS: 5, EVENT_NONE: 6 } }, UpdateAction: { values: { DOWNLOAD: 0, SHA_VERIFICATION: 1, UNPACK: 2, INSTALLATION_PREPARE: 3, INSTALLATION_APPLY: 4, ACTION_NONE: 5 } }, UpdateStatus: { values: { OK: 0, BATTERY_LOW: 1, BUSY: 2, DOWNLOAD_FAILURE: 3, DOWNLOAD_ABORT: 4, SHA_MISMATCH: 5, UNPACK_CREATE_STAGING_DIRECTORY_FAILURE: 6, UNPACK_ARCHIVE_OPEN_FAILURE: 7, UNPACK_ARCHIVE_UNPACK_FAILURE: 8, INSTALLATION_PREPARE_MANIFEST_NOT_FOUND: 9, INSTALLATION_PREPARE_MANIFEST_INVALID: 10, INSTALLATION_PREPARE_SESSION_CONFIG_SETUP_FAILURE: 11, INSTALLATION_PREPARE_POINTER_SETUP_FAILURE: 12, UNKNOWN_FAILURE: 13 } }, CheckError: { values: { NOT_AVAILABLE: 0, FAILURE: 1, IDLE: 2 } }, UpdateAvailable: { fields: { version: { type: "string", id: 1 } } }, UpdateUnavailable: { fields: { reason: { type: "CheckError", id: 1 } } }, UpdateState: { fields: { event: { type: "UpdateEvent", id: 1 }, action: { type: "UpdateAction", id: 2 }, status: { type: "UpdateStatus", id: 3 } } }, CheckState: { oneofs: { status: { oneof: ["available", "unavailable"] } }, fields: { available: { type: "UpdateAvailable", id: 1 }, unavailable: { type: "UpdateUnavailable", id: 2 } } }, AutoUpdateInterval: { fields: { start: { type: "uint32", id: 1 }, end: { type: "uint32", id: 2 } } }, AutoUpdateState: { fields: { enabled: { type: "bool", id: 1 }, interval: { type: "AutoUpdateInterval", id: 2 } } } } }, BSB_Frame: { nested: { Encoding: { values: { PLAIN: 0, RUN_LENGTH: 1, DEFLATE: 2, DEFLATE_RUN_LENGTH: 3 } }, PixelFormat: { values: { RGB888: 0, L8: 1, L4: 2 } }, Screen: { values: { FRONT: 0, BACK: 1 } }, Frame: { fields: { screen: { type: "Screen", id: 1 }, width: { type: "uint32", id: 2 }, height: { type: "uint32", id: 3 }, encoding: { type: "Encoding", id: 4 }, pixelFormat: { type: "PixelFormat", id: 5 }, data: { type: "bytes", id: 6 } } } } }, BSB_Timer: { nested: { Timer: { fields: { json: { type: "BSB_Util.Json", id: 1 } } } } }, BSB_Util: { nested: { Compression: { values: { PLAIN: 0, GZIP: 1 } }, Json: { fields: { compression: { type: "Compression", id: 1 }, data: { type: "bytes", id: 2 } } } } }, BSB_Input: { nested: { Button: { values: { OK: 0, BACK: 1, START: 2 } }, ButtonAction: { values: { PRESS: 0, RELEASE: 1 } }, SwitchPosition: { values: { BUSY: 0, CUSTOM: 1, OFF: 2, APPS: 3, SETTINGS: 4 } }, ButtonEvent: { fields: { button: { type: "Button", id: 1 }, action: { type: "ButtonAction", id: 2 } } }, SwitchEvent: { fields: { position: { type: "SwitchPosition", id: 1 } } }, EncoderEvent: { fields: { delta: { type: "sint32", id: 1 } } }, InputEvent: { oneofs: { event: { oneof: ["buttonEvent", "switchEvent", "encoderEvent"] } }, fields: { buttonEvent: { type: "ButtonEvent", id: 1 }, switchEvent: { type: "SwitchEvent", id: 2 }, encoderEvent: { type: "EncoderEvent", id: 3 } } } } }, BSB_Error: { nested: { Cause: { values: { RESOURCE_LIMIT: 0 } }, Severity: { values: { FATAL: 0, ERROR: 1, WARNING: 2 } }, Error: { fields: { cause: { type: "Cause", id: 1 }, severity: { type: "Severity", id: 2 } } } } } }, bundle = {
3761
+ nested
3762
+ };
3763
+ function decompressRLE(d, u) {
3764
+ const h = [];
3765
+ for (let c = 0; c < d.length; ) {
3766
+ const l = d[c++];
3767
+ if (l === void 0) break;
3768
+ const n = l & 127;
3769
+ if (!n)
3770
+ continue;
3771
+ if (l & 128) {
3772
+ const r = n * u, i = d.subarray(c, c + r);
3773
+ for (let t = 0; t < i.length; t++)
3774
+ h.push(i[t]);
3775
+ c += r;
3776
+ continue;
3777
+ }
3778
+ const e = d.subarray(c, c + u);
3779
+ c += u;
3780
+ for (let r = 0; r < n; r++)
3781
+ for (let i = 0; i < u; i++)
3782
+ h.push(e[i]);
3783
+ }
3784
+ return new Uint8Array(h);
3785
+ }
3786
+ async function decompressDeflate(d) {
3787
+ if (typeof DecompressionStream > "u")
3788
+ throw new Error("DecompressionStream is not supported in this environment.");
3789
+ try {
3790
+ const u = new DecompressionStream("deflate"), h = u.writable.getWriter();
3791
+ h.write(d), h.close();
3792
+ const l = await new Response(u.readable).arrayBuffer();
3793
+ return new Uint8Array(l);
3794
+ } catch (u) {
3795
+ throw new Error(`Deflate decompression failed: ${u instanceof Error ? u.message : String(u)}`);
3796
+ }
3797
+ }
3798
+ function convertL4toRGBA(d, u, h) {
3799
+ const c = new Uint8ClampedArray(u * h * 4);
3800
+ let l = 0;
3801
+ for (let n = 0; n < d.length; n++) {
3802
+ const e = d[n], r = (e & 15) * 17, i = (e >> 4 & 15) * 17, t = [r, i];
3803
+ for (const f of t)
3804
+ if (l < u * h) {
3805
+ const s = l * 4;
3806
+ c[s] = f, c[s + 1] = f, c[s + 2] = f, c[s + 3] = 255, l++;
3807
+ }
3808
+ }
3809
+ return c;
3810
+ }
3811
+ function convertL8toRGBA(d, u, h) {
3812
+ const c = new Uint8ClampedArray(u * h * 4), l = Math.min(d.length, u * h);
3813
+ for (let n = 0; n < l; n++) {
3814
+ const e = d[n], r = n * 4;
3815
+ c[r] = e, c[r + 1] = e, c[r + 2] = e, c[r + 3] = 255;
3816
+ }
3817
+ return c;
3818
+ }
3819
+ function convertRGB888toRGBA(d, u, h) {
3820
+ const c = new Uint8ClampedArray(u * h * 4), l = u * h;
3821
+ for (let n = 0; n < l; n++) {
3822
+ const e = n * 3, r = n * 4;
3823
+ e + 2 < d.length && (c[r] = d[e + 2], c[r + 1] = d[e + 1], c[r + 2] = d[e], c[r + 3] = 255);
3824
+ }
3825
+ return c;
3826
+ }
3827
+ async function processFrame(d) {
3828
+ if (!d.data || !d.width || !d.height)
3829
+ return null;
3830
+ let u = d.data;
3831
+ const h = d.pixelFormat === 0 ? 3 : 1;
3832
+ switch (d.encoding) {
3833
+ case 1:
3834
+ u = decompressRLE(u, h);
3835
+ break;
3836
+ case 2:
3837
+ u = await decompressDeflate(u);
3838
+ break;
3839
+ case 3:
3840
+ u = await decompressDeflate(u), u = decompressRLE(u, h);
3841
+ break;
3842
+ }
3843
+ switch (d.pixelFormat) {
3844
+ case 2:
3845
+ return convertL4toRGBA(u, d.width, d.height);
3846
+ case 1:
3847
+ return convertL8toRGBA(u, d.width, d.height);
3848
+ case 0:
3849
+ return convertRGB888toRGBA(u, d.width, d.height);
3850
+ default:
3851
+ return new Uint8ClampedArray(d.width * d.height * 4);
3852
+ }
3853
+ }
3854
+ const root = protobufjsExports.Root.fromJSON(bundle), StateType = root.lookupType("BSB_State.State"), AUTH_CODE = 3e3, RECONNECT_CODES = /* @__PURE__ */ new Set([1001, 1006, 1012, 1013, 1014, 3008]), MAX_AUTH_ATTEMPTS = 5, MAX_RECONNECT_ATTEMPTS = 5;
3855
+ let socket = null, isBinaryMode = !0, currentMode = "local", currentToken, currentAddr = "", retryCount = 0, authRetryCount = 0, isAuthReported = !1, stabilityTimeout;
3856
+ const activePorts = /* @__PURE__ */ new Set(), subscriptions = /* @__PURE__ */ new Map();
3857
+ let processingQueue = Promise.resolve();
3858
+ function broadcast(d) {
3859
+ for (const u of activePorts)
3860
+ u.postMessage(d);
3861
+ }
3862
+ function sendAuth() {
3863
+ currentMode === "remote" && currentToken && (socket == null ? void 0 : socket.readyState) === WebSocket.OPEN && (broadcast({ type: "STATUS_UPDATE", auth: AuthStatus.AUTHENTICATING }), socket.send(JSON.stringify({ token: currentToken })));
3864
+ }
3865
+ function sendSubscriptions() {
3866
+ (socket == null ? void 0 : socket.readyState) === WebSocket.OPEN && currentMode === "remote" && subscriptions.size > 0 && socket.send(
3867
+ JSON.stringify({
3868
+ subscribe: Array.from(subscriptions.keys())
3869
+ })
3870
+ );
3871
+ }
3872
+ function stopAndCleanup() {
3873
+ socket && (socket.close(), socket = null), stabilityTimeout && (clearTimeout(stabilityTimeout), stabilityTimeout = void 0), subscriptions.clear(), activePorts.clear(), retryCount = 0, authRetryCount = 0, isAuthReported = !1;
3874
+ }
3875
+ function connect(d, u, h = !0, c = "local") {
3876
+ socket && socket.close(), broadcast({ type: "STATUS_UPDATE", connection: ConnectionStatus.CONNECTING }), currentAddr = d, isBinaryMode = h, currentMode = c, currentToken = u, isAuthReported = !1;
3877
+ const l = new URL(d);
3878
+ socket = new WebSocket(l.toString()), socket.binaryType = "arraybuffer", socket.onopen = () => {
3879
+ broadcast({ type: "CONNECTED" }), currentMode === "local" && (socket == null || socket.send(JSON.stringify({ enable: !0 }))), sendAuth(), stabilityTimeout && clearTimeout(stabilityTimeout), stabilityTimeout = setTimeout(() => {
3880
+ retryCount = 0, authRetryCount = 0, console.log("[Worker] Connection stable. All retry counters reset.");
3881
+ }, 5e3), currentMode === "remote" && subscriptions.size > 0 && sendSubscriptions(), currentMode === "local" && broadcast({ type: "STATUS_UPDATE", auth: AuthStatus.AUTHENTICATED });
3882
+ }, socket.onmessage = (n) => {
3883
+ processingQueue = processingQueue.then(async () => {
3884
+ try {
3885
+ let e = null, r = "", i;
3886
+ if (isBinaryMode)
3887
+ n.data instanceof ArrayBuffer && (e = new Uint8Array(n.data), r = e);
3888
+ else {
3889
+ const t = JSON.parse(n.data);
3890
+ i = t.bar_id || t.barId, r = n.data, t.state && (typeof t.state == "string" ? e = Uint8Array.from(atob(t.state), (f) => f.charCodeAt(0)) : e = new Uint8Array(t.state)), currentMode === "remote" && !isAuthReported && (isAuthReported = !0, broadcast({ type: "STATUS_UPDATE", auth: AuthStatus.AUTHENTICATED }));
3891
+ }
3892
+ if (r && broadcast({ type: "RAW_DATA", data: r }), e) {
3893
+ const t = StateType.decode(e), f = StateType.toObject(t, {
3894
+ longs: Number,
3895
+ bytes: Uint8Array,
3896
+ enums: Number,
3897
+ defaults: !0
3898
+ });
3899
+ if (f.error) {
3900
+ const { cause: s, severity: a } = f.error;
3901
+ if (s != null && a != null) {
3902
+ const o = root.lookupEnum("BSB_Error.Cause"), p = root.lookupEnum("BSB_Error.Severity"), y = o.valuesById[s] || "UNKNOWN", b = p.valuesById[a] || "UNKNOWN";
3903
+ if (broadcast({
3904
+ type: "ERROR",
3905
+ code: StateStreamErrorCode.DEVICE_ERROR,
3906
+ message: `Server reported ${b}: ${y}`,
3907
+ data: f.error
3908
+ }), a === p.values.FATAL || a === p.values.ERROR) {
3909
+ stopAndCleanup();
3910
+ return;
3911
+ }
3912
+ } else
3913
+ broadcast({
3914
+ type: "ERROR",
3915
+ code: StateStreamErrorCode.DEVICE_ERROR,
3916
+ message: "Server reported an unspecified application error",
3917
+ data: f.error
3918
+ });
3919
+ }
3920
+ if (f.updates)
3921
+ for (const s of f.updates) {
3922
+ const a = s.frame;
3923
+ if (a && a.data)
3924
+ try {
3925
+ const o = await processFrame(a);
3926
+ o && (a.data = o);
3927
+ } catch (o) {
3928
+ broadcast({
3929
+ type: "ERROR",
3930
+ code: StateStreamErrorCode.FRAME_PROCESS_ERROR,
3931
+ message: o instanceof Error ? o.message : String(o),
3932
+ data: a.data
3933
+ });
3934
+ }
3935
+ }
3936
+ broadcast(currentMode === "remote" && i ? {
3937
+ type: "DATA",
3938
+ data: { bar_id: i, state: f }
3939
+ } : { type: "DATA", data: f });
3940
+ }
3941
+ } catch (e) {
3942
+ broadcast({ type: "ERROR", code: StateStreamErrorCode.DECODE_ERROR, message: `Decode error: ${String(e)}` });
3943
+ }
3944
+ }).catch(console.error);
3945
+ }, socket.onerror = () => {
3946
+ broadcast({ type: "ERROR", code: StateStreamErrorCode.CONNECTION_FAILED, message: "WebSocket connection error" });
3947
+ }, socket.onclose = (n) => {
3948
+ if (console.log("[Worker] Socket closed:", n), stabilityTimeout && (clearTimeout(stabilityTimeout), stabilityTimeout = void 0), !socket || activePorts.size === 0) {
3949
+ console.log("[Worker] Connection closed or no active ports. No retries.");
3950
+ return;
3951
+ }
3952
+ if (n.code === AUTH_CODE && currentMode === "remote") {
3953
+ authRetryCount < MAX_AUTH_ATTEMPTS ? (authRetryCount++, console.warn(`[Worker] Auth failed (3000). Requesting new token... (Attempt ${authRetryCount}/${MAX_AUTH_ATTEMPTS})`), broadcast({ type: "TOKEN_EXPIRED" })) : (broadcast({ type: "STATUS_UPDATE", auth: AuthStatus.FAILED }), broadcast({
3954
+ type: "ERROR",
3955
+ code: StateStreamErrorCode.AUTH_FAILED,
3956
+ message: `Maximum authentication attempts (${MAX_AUTH_ATTEMPTS}) reached. Please log in again.`
3957
+ }));
3958
+ return;
3959
+ }
3960
+ if (currentMode === "remote" && RECONNECT_CODES.has(n.code)) {
3961
+ if (retryCount < MAX_RECONNECT_ATTEMPTS) {
3962
+ retryCount++;
3963
+ const e = Math.min(1e3 * retryCount, 5e3);
3964
+ console.log(`[Worker] Reconnecting (network code: ${n.code}) in ${e}ms... (Attempt ${retryCount}/${MAX_RECONNECT_ATTEMPTS})`), broadcast({ type: "STATUS_UPDATE", connection: ConnectionStatus.RECONNECTING }), setTimeout(() => {
3965
+ activePorts.size > 0 && socket && connect(currentAddr, currentToken, isBinaryMode, currentMode);
3966
+ }, e);
3967
+ } else
3968
+ broadcast({ type: "STATUS_UPDATE", connection: ConnectionStatus.DISCONNECTED }), broadcast({
3969
+ type: "ERROR",
3970
+ code: StateStreamErrorCode.RECONNECT_FAILED,
3971
+ message: `Maximum reconnection attempts (${MAX_RECONNECT_ATTEMPTS}) reached. Connection lost.`
3972
+ });
3973
+ return;
3974
+ }
3975
+ broadcast({ type: "DISCONNECTED" }), broadcast({
3976
+ type: "ERROR",
3977
+ code: StateStreamErrorCode.CONNECTION_LOST,
3978
+ message: `Stream closed with unexpected code: ${n.code}. Stopping stream.`
3979
+ });
3980
+ };
3981
+ }
3982
+ function handleCommand(d, u) {
3983
+ switch (d.type) {
3984
+ case "START":
3985
+ activePorts.add(u), socket && socket.readyState === WebSocket.OPEN && currentAddr === d.addr ? (u.postMessage({ type: "CONNECTED" }), u.postMessage({ type: "STATUS_UPDATE", auth: AuthStatus.AUTHENTICATED })) : connect(d.addr, d.token, d.isBinary, d.mode);
3986
+ break;
3987
+ case "STOP":
3988
+ activePorts.delete(u);
3989
+ for (const [e, r] of subscriptions.entries())
3990
+ r.delete(u), r.size === 0 && (subscriptions.delete(e), (socket == null ? void 0 : socket.readyState) === WebSocket.OPEN && currentMode === "remote" && socket.send(JSON.stringify({ unsubscribe: [e] })));
3991
+ u.postMessage({ type: "STATUS_UPDATE", connection: ConnectionStatus.DISCONNECTED }), activePorts.size === 0 && stopAndCleanup();
3992
+ break;
3993
+ case "UPDATE_TOKEN":
3994
+ const h = currentToken;
3995
+ if (currentToken = d.token, currentMode === "remote") {
3996
+ const e = socket && socket.readyState === WebSocket.OPEN;
3997
+ if (e && h === d.token)
3998
+ return;
3999
+ e ? sendAuth() : h !== d.token && currentAddr && activePorts.size > 0 && connect(currentAddr, currentToken, isBinaryMode, currentMode);
4000
+ }
4001
+ break;
4002
+ case "SUBSCRIBE":
4003
+ let c = subscriptions.get(d.guid);
4004
+ c || (c = /* @__PURE__ */ new Set(), subscriptions.set(d.guid, c));
4005
+ const l = c.size === 0;
4006
+ c.add(u), l && (socket == null ? void 0 : socket.readyState) === WebSocket.OPEN && currentMode === "remote" && socket.send(JSON.stringify({ subscribe: [d.guid] }));
4007
+ break;
4008
+ case "UNSUBSCRIBE":
4009
+ const n = subscriptions.get(d.guid);
4010
+ n && (n.delete(u), n.size === 0 && (subscriptions.delete(d.guid), (socket == null ? void 0 : socket.readyState) === WebSocket.OPEN && currentMode === "remote" && socket.send(JSON.stringify({ unsubscribe: [d.guid] }))));
4011
+ break;
4012
+ }
4013
+ }
4014
+ if ("SharedWorkerGlobalScope" in self) {
4015
+ const d = self;
4016
+ d.onconnect = (u) => {
4017
+ const h = u.ports[0];
4018
+ h && (h.onmessage = (c) => handleCommand(c.data, h), h.start());
4019
+ };
4020
+ } else {
4021
+ const d = self;
4022
+ d.onmessage = (u) => {
4023
+ handleCommand(u.data, d);
4024
+ };
4025
+ }