@stanterprise/protobuf 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,2446 +1,8 @@
1
- // node_modules/@protobuf-ts/runtime/build/es2015/json-typings.js
2
- function typeofJsonValue(value) {
3
- let t = typeof value;
4
- if (t == "object") {
5
- if (Array.isArray(value))
6
- return "array";
7
- if (value === null)
8
- return "null";
9
- }
10
- return t;
11
- }
12
- function isJsonObject(value) {
13
- return value !== null && typeof value == "object" && !Array.isArray(value);
14
- }
15
-
16
- // node_modules/@protobuf-ts/runtime/build/es2015/base64.js
17
- var encTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
18
- var decTable = [];
19
- for (let i = 0; i < encTable.length; i++)
20
- decTable[encTable[i].charCodeAt(0)] = i;
21
- decTable["-".charCodeAt(0)] = encTable.indexOf("+");
22
- decTable["_".charCodeAt(0)] = encTable.indexOf("/");
23
- function base64decode(base64Str) {
24
- let es = base64Str.length * 3 / 4;
25
- if (base64Str[base64Str.length - 2] == "=")
26
- es -= 2;
27
- else if (base64Str[base64Str.length - 1] == "=")
28
- es -= 1;
29
- let bytes = new Uint8Array(es), bytePos = 0, groupPos = 0, b, p = 0;
30
- for (let i = 0; i < base64Str.length; i++) {
31
- b = decTable[base64Str.charCodeAt(i)];
32
- if (b === void 0) {
33
- switch (base64Str[i]) {
34
- case "=":
35
- groupPos = 0;
36
- // reset state when padding found
37
- case "\n":
38
- case "\r":
39
- case " ":
40
- case " ":
41
- continue;
42
- // skip white-space, and padding
43
- default:
44
- throw Error(`invalid base64 string.`);
45
- }
46
- }
47
- switch (groupPos) {
48
- case 0:
49
- p = b;
50
- groupPos = 1;
51
- break;
52
- case 1:
53
- bytes[bytePos++] = p << 2 | (b & 48) >> 4;
54
- p = b;
55
- groupPos = 2;
56
- break;
57
- case 2:
58
- bytes[bytePos++] = (p & 15) << 4 | (b & 60) >> 2;
59
- p = b;
60
- groupPos = 3;
61
- break;
62
- case 3:
63
- bytes[bytePos++] = (p & 3) << 6 | b;
64
- groupPos = 0;
65
- break;
66
- }
67
- }
68
- if (groupPos == 1)
69
- throw Error(`invalid base64 string.`);
70
- return bytes.subarray(0, bytePos);
71
- }
72
- function base64encode(bytes) {
73
- let base64 = "", groupPos = 0, b, p = 0;
74
- for (let i = 0; i < bytes.length; i++) {
75
- b = bytes[i];
76
- switch (groupPos) {
77
- case 0:
78
- base64 += encTable[b >> 2];
79
- p = (b & 3) << 4;
80
- groupPos = 1;
81
- break;
82
- case 1:
83
- base64 += encTable[p | b >> 4];
84
- p = (b & 15) << 2;
85
- groupPos = 2;
86
- break;
87
- case 2:
88
- base64 += encTable[p | b >> 6];
89
- base64 += encTable[b & 63];
90
- groupPos = 0;
91
- break;
92
- }
93
- }
94
- if (groupPos) {
95
- base64 += encTable[p];
96
- base64 += "=";
97
- if (groupPos == 1)
98
- base64 += "=";
99
- }
100
- return base64;
101
- }
102
-
103
- // node_modules/@protobuf-ts/runtime/build/es2015/binary-format-contract.js
104
- var UnknownFieldHandler;
105
- (function(UnknownFieldHandler2) {
106
- UnknownFieldHandler2.symbol = Symbol.for("protobuf-ts/unknown");
107
- UnknownFieldHandler2.onRead = (typeName, message, fieldNo, wireType, data) => {
108
- let container = is(message) ? message[UnknownFieldHandler2.symbol] : message[UnknownFieldHandler2.symbol] = [];
109
- container.push({ no: fieldNo, wireType, data });
110
- };
111
- UnknownFieldHandler2.onWrite = (typeName, message, writer) => {
112
- for (let { no, wireType, data } of UnknownFieldHandler2.list(message))
113
- writer.tag(no, wireType).raw(data);
114
- };
115
- UnknownFieldHandler2.list = (message, fieldNo) => {
116
- if (is(message)) {
117
- let all = message[UnknownFieldHandler2.symbol];
118
- return fieldNo ? all.filter((uf) => uf.no == fieldNo) : all;
119
- }
120
- return [];
121
- };
122
- UnknownFieldHandler2.last = (message, fieldNo) => UnknownFieldHandler2.list(message, fieldNo).slice(-1)[0];
123
- const is = (message) => message && Array.isArray(message[UnknownFieldHandler2.symbol]);
124
- })(UnknownFieldHandler || (UnknownFieldHandler = {}));
125
- var WireType;
126
- (function(WireType2) {
127
- WireType2[WireType2["Varint"] = 0] = "Varint";
128
- WireType2[WireType2["Bit64"] = 1] = "Bit64";
129
- WireType2[WireType2["LengthDelimited"] = 2] = "LengthDelimited";
130
- WireType2[WireType2["StartGroup"] = 3] = "StartGroup";
131
- WireType2[WireType2["EndGroup"] = 4] = "EndGroup";
132
- WireType2[WireType2["Bit32"] = 5] = "Bit32";
133
- })(WireType || (WireType = {}));
134
-
135
- // node_modules/@protobuf-ts/runtime/build/es2015/goog-varint.js
136
- function varint64read() {
137
- let lowBits = 0;
138
- let highBits = 0;
139
- for (let shift = 0; shift < 28; shift += 7) {
140
- let b = this.buf[this.pos++];
141
- lowBits |= (b & 127) << shift;
142
- if ((b & 128) == 0) {
143
- this.assertBounds();
144
- return [lowBits, highBits];
145
- }
146
- }
147
- let middleByte = this.buf[this.pos++];
148
- lowBits |= (middleByte & 15) << 28;
149
- highBits = (middleByte & 112) >> 4;
150
- if ((middleByte & 128) == 0) {
151
- this.assertBounds();
152
- return [lowBits, highBits];
153
- }
154
- for (let shift = 3; shift <= 31; shift += 7) {
155
- let b = this.buf[this.pos++];
156
- highBits |= (b & 127) << shift;
157
- if ((b & 128) == 0) {
158
- this.assertBounds();
159
- return [lowBits, highBits];
160
- }
161
- }
162
- throw new Error("invalid varint");
163
- }
164
- function varint64write(lo, hi, bytes) {
165
- for (let i = 0; i < 28; i = i + 7) {
166
- const shift = lo >>> i;
167
- const hasNext = !(shift >>> 7 == 0 && hi == 0);
168
- const byte = (hasNext ? shift | 128 : shift) & 255;
169
- bytes.push(byte);
170
- if (!hasNext) {
171
- return;
172
- }
173
- }
174
- const splitBits = lo >>> 28 & 15 | (hi & 7) << 4;
175
- const hasMoreBits = !(hi >> 3 == 0);
176
- bytes.push((hasMoreBits ? splitBits | 128 : splitBits) & 255);
177
- if (!hasMoreBits) {
178
- return;
179
- }
180
- for (let i = 3; i < 31; i = i + 7) {
181
- const shift = hi >>> i;
182
- const hasNext = !(shift >>> 7 == 0);
183
- const byte = (hasNext ? shift | 128 : shift) & 255;
184
- bytes.push(byte);
185
- if (!hasNext) {
186
- return;
187
- }
188
- }
189
- bytes.push(hi >>> 31 & 1);
190
- }
191
- var TWO_PWR_32_DBL = (1 << 16) * (1 << 16);
192
- function int64fromString(dec) {
193
- let minus = dec[0] == "-";
194
- if (minus)
195
- dec = dec.slice(1);
196
- const base = 1e6;
197
- let lowBits = 0;
198
- let highBits = 0;
199
- function add1e6digit(begin, end) {
200
- const digit1e6 = Number(dec.slice(begin, end));
201
- highBits *= base;
202
- lowBits = lowBits * base + digit1e6;
203
- if (lowBits >= TWO_PWR_32_DBL) {
204
- highBits = highBits + (lowBits / TWO_PWR_32_DBL | 0);
205
- lowBits = lowBits % TWO_PWR_32_DBL;
206
- }
207
- }
208
- add1e6digit(-24, -18);
209
- add1e6digit(-18, -12);
210
- add1e6digit(-12, -6);
211
- add1e6digit(-6);
212
- return [minus, lowBits, highBits];
213
- }
214
- function int64toString(bitsLow, bitsHigh) {
215
- if (bitsHigh >>> 0 <= 2097151) {
216
- return "" + (TWO_PWR_32_DBL * bitsHigh + (bitsLow >>> 0));
217
- }
218
- let low = bitsLow & 16777215;
219
- let mid = (bitsLow >>> 24 | bitsHigh << 8) >>> 0 & 16777215;
220
- let high = bitsHigh >> 16 & 65535;
221
- let digitA = low + mid * 6777216 + high * 6710656;
222
- let digitB = mid + high * 8147497;
223
- let digitC = high * 2;
224
- let base = 1e7;
225
- if (digitA >= base) {
226
- digitB += Math.floor(digitA / base);
227
- digitA %= base;
228
- }
229
- if (digitB >= base) {
230
- digitC += Math.floor(digitB / base);
231
- digitB %= base;
232
- }
233
- function decimalFrom1e7(digit1e7, needLeadingZeros) {
234
- let partial = digit1e7 ? String(digit1e7) : "";
235
- if (needLeadingZeros) {
236
- return "0000000".slice(partial.length) + partial;
237
- }
238
- return partial;
239
- }
240
- return decimalFrom1e7(
241
- digitC,
242
- /*needLeadingZeros=*/
243
- 0
244
- ) + decimalFrom1e7(
245
- digitB,
246
- /*needLeadingZeros=*/
247
- digitC
248
- ) + // If the final 1e7 digit didn't need leading zeros, we would have
249
- // returned via the trivial code path at the top.
250
- decimalFrom1e7(
251
- digitA,
252
- /*needLeadingZeros=*/
253
- 1
254
- );
255
- }
256
- function varint32write(value, bytes) {
257
- if (value >= 0) {
258
- while (value > 127) {
259
- bytes.push(value & 127 | 128);
260
- value = value >>> 7;
261
- }
262
- bytes.push(value);
263
- } else {
264
- for (let i = 0; i < 9; i++) {
265
- bytes.push(value & 127 | 128);
266
- value = value >> 7;
267
- }
268
- bytes.push(1);
269
- }
270
- }
271
- function varint32read() {
272
- let b = this.buf[this.pos++];
273
- let result = b & 127;
274
- if ((b & 128) == 0) {
275
- this.assertBounds();
276
- return result;
277
- }
278
- b = this.buf[this.pos++];
279
- result |= (b & 127) << 7;
280
- if ((b & 128) == 0) {
281
- this.assertBounds();
282
- return result;
283
- }
284
- b = this.buf[this.pos++];
285
- result |= (b & 127) << 14;
286
- if ((b & 128) == 0) {
287
- this.assertBounds();
288
- return result;
289
- }
290
- b = this.buf[this.pos++];
291
- result |= (b & 127) << 21;
292
- if ((b & 128) == 0) {
293
- this.assertBounds();
294
- return result;
295
- }
296
- b = this.buf[this.pos++];
297
- result |= (b & 15) << 28;
298
- for (let readBytes = 5; (b & 128) !== 0 && readBytes < 10; readBytes++)
299
- b = this.buf[this.pos++];
300
- if ((b & 128) != 0)
301
- throw new Error("invalid varint");
302
- this.assertBounds();
303
- return result >>> 0;
304
- }
305
-
306
- // node_modules/@protobuf-ts/runtime/build/es2015/pb-long.js
307
- var BI;
308
- function detectBi() {
309
- const dv = new DataView(new ArrayBuffer(8));
310
- const ok = globalThis.BigInt !== void 0 && typeof dv.getBigInt64 === "function" && typeof dv.getBigUint64 === "function" && typeof dv.setBigInt64 === "function" && typeof dv.setBigUint64 === "function";
311
- BI = ok ? {
312
- MIN: BigInt("-9223372036854775808"),
313
- MAX: BigInt("9223372036854775807"),
314
- UMIN: BigInt("0"),
315
- UMAX: BigInt("18446744073709551615"),
316
- C: BigInt,
317
- V: dv
318
- } : void 0;
319
- }
320
- detectBi();
321
- function assertBi(bi) {
322
- if (!bi)
323
- throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support");
324
- }
325
- var RE_DECIMAL_STR = /^-?[0-9]+$/;
326
- var TWO_PWR_32_DBL2 = 4294967296;
327
- var HALF_2_PWR_32 = 2147483648;
328
- var SharedPbLong = class {
329
- /**
330
- * Create a new instance with the given bits.
331
- */
332
- constructor(lo, hi) {
333
- this.lo = lo | 0;
334
- this.hi = hi | 0;
335
- }
336
- /**
337
- * Is this instance equal to 0?
338
- */
339
- isZero() {
340
- return this.lo == 0 && this.hi == 0;
341
- }
342
- /**
343
- * Convert to a native number.
344
- */
345
- toNumber() {
346
- let result = this.hi * TWO_PWR_32_DBL2 + (this.lo >>> 0);
347
- if (!Number.isSafeInteger(result))
348
- throw new Error("cannot convert to safe number");
349
- return result;
350
- }
351
- };
352
- var PbULong = class _PbULong extends SharedPbLong {
353
- /**
354
- * Create instance from a `string`, `number` or `bigint`.
355
- */
356
- static from(value) {
357
- if (BI)
358
- switch (typeof value) {
359
- case "string":
360
- if (value == "0")
361
- return this.ZERO;
362
- if (value == "")
363
- throw new Error("string is no integer");
364
- value = BI.C(value);
365
- case "number":
366
- if (value === 0)
367
- return this.ZERO;
368
- value = BI.C(value);
369
- case "bigint":
370
- if (!value)
371
- return this.ZERO;
372
- if (value < BI.UMIN)
373
- throw new Error("signed value for ulong");
374
- if (value > BI.UMAX)
375
- throw new Error("ulong too large");
376
- BI.V.setBigUint64(0, value, true);
377
- return new _PbULong(BI.V.getInt32(0, true), BI.V.getInt32(4, true));
378
- }
379
- else
380
- switch (typeof value) {
381
- case "string":
382
- if (value == "0")
383
- return this.ZERO;
384
- value = value.trim();
385
- if (!RE_DECIMAL_STR.test(value))
386
- throw new Error("string is no integer");
387
- let [minus, lo, hi] = int64fromString(value);
388
- if (minus)
389
- throw new Error("signed value for ulong");
390
- return new _PbULong(lo, hi);
391
- case "number":
392
- if (value == 0)
393
- return this.ZERO;
394
- if (!Number.isSafeInteger(value))
395
- throw new Error("number is no integer");
396
- if (value < 0)
397
- throw new Error("signed value for ulong");
398
- return new _PbULong(value, value / TWO_PWR_32_DBL2);
399
- }
400
- throw new Error("unknown value " + typeof value);
401
- }
402
- /**
403
- * Convert to decimal string.
404
- */
405
- toString() {
406
- return BI ? this.toBigInt().toString() : int64toString(this.lo, this.hi);
407
- }
408
- /**
409
- * Convert to native bigint.
410
- */
411
- toBigInt() {
412
- assertBi(BI);
413
- BI.V.setInt32(0, this.lo, true);
414
- BI.V.setInt32(4, this.hi, true);
415
- return BI.V.getBigUint64(0, true);
416
- }
417
- };
418
- PbULong.ZERO = new PbULong(0, 0);
419
- var PbLong = class _PbLong extends SharedPbLong {
420
- /**
421
- * Create instance from a `string`, `number` or `bigint`.
422
- */
423
- static from(value) {
424
- if (BI)
425
- switch (typeof value) {
426
- case "string":
427
- if (value == "0")
428
- return this.ZERO;
429
- if (value == "")
430
- throw new Error("string is no integer");
431
- value = BI.C(value);
432
- case "number":
433
- if (value === 0)
434
- return this.ZERO;
435
- value = BI.C(value);
436
- case "bigint":
437
- if (!value)
438
- return this.ZERO;
439
- if (value < BI.MIN)
440
- throw new Error("signed long too small");
441
- if (value > BI.MAX)
442
- throw new Error("signed long too large");
443
- BI.V.setBigInt64(0, value, true);
444
- return new _PbLong(BI.V.getInt32(0, true), BI.V.getInt32(4, true));
445
- }
446
- else
447
- switch (typeof value) {
448
- case "string":
449
- if (value == "0")
450
- return this.ZERO;
451
- value = value.trim();
452
- if (!RE_DECIMAL_STR.test(value))
453
- throw new Error("string is no integer");
454
- let [minus, lo, hi] = int64fromString(value);
455
- if (minus) {
456
- if (hi > HALF_2_PWR_32 || hi == HALF_2_PWR_32 && lo != 0)
457
- throw new Error("signed long too small");
458
- } else if (hi >= HALF_2_PWR_32)
459
- throw new Error("signed long too large");
460
- let pbl = new _PbLong(lo, hi);
461
- return minus ? pbl.negate() : pbl;
462
- case "number":
463
- if (value == 0)
464
- return this.ZERO;
465
- if (!Number.isSafeInteger(value))
466
- throw new Error("number is no integer");
467
- return value > 0 ? new _PbLong(value, value / TWO_PWR_32_DBL2) : new _PbLong(-value, -value / TWO_PWR_32_DBL2).negate();
468
- }
469
- throw new Error("unknown value " + typeof value);
470
- }
471
- /**
472
- * Do we have a minus sign?
473
- */
474
- isNegative() {
475
- return (this.hi & HALF_2_PWR_32) !== 0;
476
- }
477
- /**
478
- * Negate two's complement.
479
- * Invert all the bits and add one to the result.
480
- */
481
- negate() {
482
- let hi = ~this.hi, lo = this.lo;
483
- if (lo)
484
- lo = ~lo + 1;
485
- else
486
- hi += 1;
487
- return new _PbLong(lo, hi);
488
- }
489
- /**
490
- * Convert to decimal string.
491
- */
492
- toString() {
493
- if (BI)
494
- return this.toBigInt().toString();
495
- if (this.isNegative()) {
496
- let n = this.negate();
497
- return "-" + int64toString(n.lo, n.hi);
498
- }
499
- return int64toString(this.lo, this.hi);
500
- }
501
- /**
502
- * Convert to native bigint.
503
- */
504
- toBigInt() {
505
- assertBi(BI);
506
- BI.V.setInt32(0, this.lo, true);
507
- BI.V.setInt32(4, this.hi, true);
508
- return BI.V.getBigInt64(0, true);
509
- }
510
- };
511
- PbLong.ZERO = new PbLong(0, 0);
512
-
513
- // node_modules/@protobuf-ts/runtime/build/es2015/binary-reader.js
514
- var defaultsRead = {
515
- readUnknownField: true,
516
- readerFactory: (bytes) => new BinaryReader(bytes)
517
- };
518
- function binaryReadOptions(options) {
519
- return options ? Object.assign(Object.assign({}, defaultsRead), options) : defaultsRead;
520
- }
521
- var BinaryReader = class {
522
- constructor(buf, textDecoder) {
523
- this.varint64 = varint64read;
524
- this.uint32 = varint32read;
525
- this.buf = buf;
526
- this.len = buf.length;
527
- this.pos = 0;
528
- this.view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
529
- this.textDecoder = textDecoder !== null && textDecoder !== void 0 ? textDecoder : new TextDecoder("utf-8", {
530
- fatal: true,
531
- ignoreBOM: true
532
- });
533
- }
534
- /**
535
- * Reads a tag - field number and wire type.
536
- */
537
- tag() {
538
- let tag = this.uint32(), fieldNo = tag >>> 3, wireType = tag & 7;
539
- if (fieldNo <= 0 || wireType < 0 || wireType > 5)
540
- throw new Error("illegal tag: field no " + fieldNo + " wire type " + wireType);
541
- return [fieldNo, wireType];
542
- }
543
- /**
544
- * Skip one element on the wire and return the skipped data.
545
- * Supports WireType.StartGroup since v2.0.0-alpha.23.
546
- */
547
- skip(wireType) {
548
- let start = this.pos;
549
- switch (wireType) {
550
- case WireType.Varint:
551
- while (this.buf[this.pos++] & 128) {
552
- }
553
- break;
554
- case WireType.Bit64:
555
- this.pos += 4;
556
- case WireType.Bit32:
557
- this.pos += 4;
558
- break;
559
- case WireType.LengthDelimited:
560
- let len = this.uint32();
561
- this.pos += len;
562
- break;
563
- case WireType.StartGroup:
564
- let t;
565
- while ((t = this.tag()[1]) !== WireType.EndGroup) {
566
- this.skip(t);
567
- }
568
- break;
569
- default:
570
- throw new Error("cant skip wire type " + wireType);
571
- }
572
- this.assertBounds();
573
- return this.buf.subarray(start, this.pos);
574
- }
575
- /**
576
- * Throws error if position in byte array is out of range.
577
- */
578
- assertBounds() {
579
- if (this.pos > this.len)
580
- throw new RangeError("premature EOF");
581
- }
582
- /**
583
- * Read a `int32` field, a signed 32 bit varint.
584
- */
585
- int32() {
586
- return this.uint32() | 0;
587
- }
588
- /**
589
- * Read a `sint32` field, a signed, zigzag-encoded 32-bit varint.
590
- */
591
- sint32() {
592
- let zze = this.uint32();
593
- return zze >>> 1 ^ -(zze & 1);
594
- }
595
- /**
596
- * Read a `int64` field, a signed 64-bit varint.
597
- */
598
- int64() {
599
- return new PbLong(...this.varint64());
600
- }
601
- /**
602
- * Read a `uint64` field, an unsigned 64-bit varint.
603
- */
604
- uint64() {
605
- return new PbULong(...this.varint64());
606
- }
607
- /**
608
- * Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint.
609
- */
610
- sint64() {
611
- let [lo, hi] = this.varint64();
612
- let s = -(lo & 1);
613
- lo = (lo >>> 1 | (hi & 1) << 31) ^ s;
614
- hi = hi >>> 1 ^ s;
615
- return new PbLong(lo, hi);
616
- }
617
- /**
618
- * Read a `bool` field, a variant.
619
- */
620
- bool() {
621
- let [lo, hi] = this.varint64();
622
- return lo !== 0 || hi !== 0;
623
- }
624
- /**
625
- * Read a `fixed32` field, an unsigned, fixed-length 32-bit integer.
626
- */
627
- fixed32() {
628
- return this.view.getUint32((this.pos += 4) - 4, true);
629
- }
630
- /**
631
- * Read a `sfixed32` field, a signed, fixed-length 32-bit integer.
632
- */
633
- sfixed32() {
634
- return this.view.getInt32((this.pos += 4) - 4, true);
635
- }
636
- /**
637
- * Read a `fixed64` field, an unsigned, fixed-length 64 bit integer.
638
- */
639
- fixed64() {
640
- return new PbULong(this.sfixed32(), this.sfixed32());
641
- }
642
- /**
643
- * Read a `fixed64` field, a signed, fixed-length 64-bit integer.
644
- */
645
- sfixed64() {
646
- return new PbLong(this.sfixed32(), this.sfixed32());
647
- }
648
- /**
649
- * Read a `float` field, 32-bit floating point number.
650
- */
651
- float() {
652
- return this.view.getFloat32((this.pos += 4) - 4, true);
653
- }
654
- /**
655
- * Read a `double` field, a 64-bit floating point number.
656
- */
657
- double() {
658
- return this.view.getFloat64((this.pos += 8) - 8, true);
659
- }
660
- /**
661
- * Read a `bytes` field, length-delimited arbitrary data.
662
- */
663
- bytes() {
664
- let len = this.uint32();
665
- let start = this.pos;
666
- this.pos += len;
667
- this.assertBounds();
668
- return this.buf.subarray(start, start + len);
669
- }
670
- /**
671
- * Read a `string` field, length-delimited data converted to UTF-8 text.
672
- */
673
- string() {
674
- return this.textDecoder.decode(this.bytes());
675
- }
676
- };
677
-
678
- // node_modules/@protobuf-ts/runtime/build/es2015/assert.js
679
- function assert(condition, msg) {
680
- if (!condition) {
681
- throw new Error(msg);
682
- }
683
- }
684
- function assertNever(value, msg) {
685
- throw new Error(msg !== null && msg !== void 0 ? msg : "Unexpected object: " + value);
686
- }
687
- var FLOAT32_MAX = 34028234663852886e22;
688
- var FLOAT32_MIN = -34028234663852886e22;
689
- var UINT32_MAX = 4294967295;
690
- var INT32_MAX = 2147483647;
691
- var INT32_MIN = -2147483648;
692
- function assertInt32(arg) {
693
- if (typeof arg !== "number")
694
- throw new Error("invalid int 32: " + typeof arg);
695
- if (!Number.isInteger(arg) || arg > INT32_MAX || arg < INT32_MIN)
696
- throw new Error("invalid int 32: " + arg);
697
- }
698
- function assertUInt32(arg) {
699
- if (typeof arg !== "number")
700
- throw new Error("invalid uint 32: " + typeof arg);
701
- if (!Number.isInteger(arg) || arg > UINT32_MAX || arg < 0)
702
- throw new Error("invalid uint 32: " + arg);
703
- }
704
- function assertFloat32(arg) {
705
- if (typeof arg !== "number")
706
- throw new Error("invalid float 32: " + typeof arg);
707
- if (!Number.isFinite(arg))
708
- return;
709
- if (arg > FLOAT32_MAX || arg < FLOAT32_MIN)
710
- throw new Error("invalid float 32: " + arg);
711
- }
712
-
713
- // node_modules/@protobuf-ts/runtime/build/es2015/binary-writer.js
714
- var defaultsWrite = {
715
- writeUnknownFields: true,
716
- writerFactory: () => new BinaryWriter()
717
- };
718
- function binaryWriteOptions(options) {
719
- return options ? Object.assign(Object.assign({}, defaultsWrite), options) : defaultsWrite;
720
- }
721
- var BinaryWriter = class {
722
- constructor(textEncoder) {
723
- this.stack = [];
724
- this.textEncoder = textEncoder !== null && textEncoder !== void 0 ? textEncoder : new TextEncoder();
725
- this.chunks = [];
726
- this.buf = [];
727
- }
728
- /**
729
- * Return all bytes written and reset this writer.
730
- */
731
- finish() {
732
- this.chunks.push(new Uint8Array(this.buf));
733
- let len = 0;
734
- for (let i = 0; i < this.chunks.length; i++)
735
- len += this.chunks[i].length;
736
- let bytes = new Uint8Array(len);
737
- let offset = 0;
738
- for (let i = 0; i < this.chunks.length; i++) {
739
- bytes.set(this.chunks[i], offset);
740
- offset += this.chunks[i].length;
741
- }
742
- this.chunks = [];
743
- return bytes;
744
- }
745
- /**
746
- * Start a new fork for length-delimited data like a message
747
- * or a packed repeated field.
748
- *
749
- * Must be joined later with `join()`.
750
- */
751
- fork() {
752
- this.stack.push({ chunks: this.chunks, buf: this.buf });
753
- this.chunks = [];
754
- this.buf = [];
755
- return this;
756
- }
757
- /**
758
- * Join the last fork. Write its length and bytes, then
759
- * return to the previous state.
760
- */
761
- join() {
762
- let chunk = this.finish();
763
- let prev = this.stack.pop();
764
- if (!prev)
765
- throw new Error("invalid state, fork stack empty");
766
- this.chunks = prev.chunks;
767
- this.buf = prev.buf;
768
- this.uint32(chunk.byteLength);
769
- return this.raw(chunk);
770
- }
771
- /**
772
- * Writes a tag (field number and wire type).
773
- *
774
- * Equivalent to `uint32( (fieldNo << 3 | type) >>> 0 )`.
775
- *
776
- * Generated code should compute the tag ahead of time and call `uint32()`.
777
- */
778
- tag(fieldNo, type) {
779
- return this.uint32((fieldNo << 3 | type) >>> 0);
780
- }
781
- /**
782
- * Write a chunk of raw bytes.
783
- */
784
- raw(chunk) {
785
- if (this.buf.length) {
786
- this.chunks.push(new Uint8Array(this.buf));
787
- this.buf = [];
788
- }
789
- this.chunks.push(chunk);
790
- return this;
791
- }
792
- /**
793
- * Write a `uint32` value, an unsigned 32 bit varint.
794
- */
795
- uint32(value) {
796
- assertUInt32(value);
797
- while (value > 127) {
798
- this.buf.push(value & 127 | 128);
799
- value = value >>> 7;
800
- }
801
- this.buf.push(value);
802
- return this;
803
- }
804
- /**
805
- * Write a `int32` value, a signed 32 bit varint.
806
- */
807
- int32(value) {
808
- assertInt32(value);
809
- varint32write(value, this.buf);
810
- return this;
811
- }
812
- /**
813
- * Write a `bool` value, a variant.
814
- */
815
- bool(value) {
816
- this.buf.push(value ? 1 : 0);
817
- return this;
818
- }
819
- /**
820
- * Write a `bytes` value, length-delimited arbitrary data.
821
- */
822
- bytes(value) {
823
- this.uint32(value.byteLength);
824
- return this.raw(value);
825
- }
826
- /**
827
- * Write a `string` value, length-delimited data converted to UTF-8 text.
828
- */
829
- string(value) {
830
- let chunk = this.textEncoder.encode(value);
831
- this.uint32(chunk.byteLength);
832
- return this.raw(chunk);
833
- }
834
- /**
835
- * Write a `float` value, 32-bit floating point number.
836
- */
837
- float(value) {
838
- assertFloat32(value);
839
- let chunk = new Uint8Array(4);
840
- new DataView(chunk.buffer).setFloat32(0, value, true);
841
- return this.raw(chunk);
842
- }
843
- /**
844
- * Write a `double` value, a 64-bit floating point number.
845
- */
846
- double(value) {
847
- let chunk = new Uint8Array(8);
848
- new DataView(chunk.buffer).setFloat64(0, value, true);
849
- return this.raw(chunk);
850
- }
851
- /**
852
- * Write a `fixed32` value, an unsigned, fixed-length 32-bit integer.
853
- */
854
- fixed32(value) {
855
- assertUInt32(value);
856
- let chunk = new Uint8Array(4);
857
- new DataView(chunk.buffer).setUint32(0, value, true);
858
- return this.raw(chunk);
859
- }
860
- /**
861
- * Write a `sfixed32` value, a signed, fixed-length 32-bit integer.
862
- */
863
- sfixed32(value) {
864
- assertInt32(value);
865
- let chunk = new Uint8Array(4);
866
- new DataView(chunk.buffer).setInt32(0, value, true);
867
- return this.raw(chunk);
868
- }
869
- /**
870
- * Write a `sint32` value, a signed, zigzag-encoded 32-bit varint.
871
- */
872
- sint32(value) {
873
- assertInt32(value);
874
- value = (value << 1 ^ value >> 31) >>> 0;
875
- varint32write(value, this.buf);
876
- return this;
877
- }
878
- /**
879
- * Write a `fixed64` value, a signed, fixed-length 64-bit integer.
880
- */
881
- sfixed64(value) {
882
- let chunk = new Uint8Array(8);
883
- let view = new DataView(chunk.buffer);
884
- let long = PbLong.from(value);
885
- view.setInt32(0, long.lo, true);
886
- view.setInt32(4, long.hi, true);
887
- return this.raw(chunk);
888
- }
889
- /**
890
- * Write a `fixed64` value, an unsigned, fixed-length 64 bit integer.
891
- */
892
- fixed64(value) {
893
- let chunk = new Uint8Array(8);
894
- let view = new DataView(chunk.buffer);
895
- let long = PbULong.from(value);
896
- view.setInt32(0, long.lo, true);
897
- view.setInt32(4, long.hi, true);
898
- return this.raw(chunk);
899
- }
900
- /**
901
- * Write a `int64` value, a signed 64-bit varint.
902
- */
903
- int64(value) {
904
- let long = PbLong.from(value);
905
- varint64write(long.lo, long.hi, this.buf);
906
- return this;
907
- }
908
- /**
909
- * Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint.
910
- */
911
- sint64(value) {
912
- let long = PbLong.from(value), sign = long.hi >> 31, lo = long.lo << 1 ^ sign, hi = (long.hi << 1 | long.lo >>> 31) ^ sign;
913
- varint64write(lo, hi, this.buf);
914
- return this;
915
- }
916
- /**
917
- * Write a `uint64` value, an unsigned 64-bit varint.
918
- */
919
- uint64(value) {
920
- let long = PbULong.from(value);
921
- varint64write(long.lo, long.hi, this.buf);
922
- return this;
923
- }
924
- };
925
-
926
- // node_modules/@protobuf-ts/runtime/build/es2015/json-format-contract.js
927
- var defaultsWrite2 = {
928
- emitDefaultValues: false,
929
- enumAsInteger: false,
930
- useProtoFieldName: false,
931
- prettySpaces: 0
932
- };
933
- var defaultsRead2 = {
934
- ignoreUnknownFields: false
935
- };
936
- function jsonReadOptions(options) {
937
- return options ? Object.assign(Object.assign({}, defaultsRead2), options) : defaultsRead2;
938
- }
939
- function jsonWriteOptions(options) {
940
- return options ? Object.assign(Object.assign({}, defaultsWrite2), options) : defaultsWrite2;
941
- }
942
-
943
- // node_modules/@protobuf-ts/runtime/build/es2015/message-type-contract.js
944
- var MESSAGE_TYPE = Symbol.for("protobuf-ts/message-type");
945
-
946
- // node_modules/@protobuf-ts/runtime/build/es2015/lower-camel-case.js
947
- function lowerCamelCase(snakeCase) {
948
- let capNext = false;
949
- const sb = [];
950
- for (let i = 0; i < snakeCase.length; i++) {
951
- let next = snakeCase.charAt(i);
952
- if (next == "_") {
953
- capNext = true;
954
- } else if (/\d/.test(next)) {
955
- sb.push(next);
956
- capNext = true;
957
- } else if (capNext) {
958
- sb.push(next.toUpperCase());
959
- capNext = false;
960
- } else if (i == 0) {
961
- sb.push(next.toLowerCase());
962
- } else {
963
- sb.push(next);
964
- }
965
- }
966
- return sb.join("");
967
- }
968
-
969
- // node_modules/@protobuf-ts/runtime/build/es2015/reflection-info.js
970
- var ScalarType;
971
- (function(ScalarType2) {
972
- ScalarType2[ScalarType2["DOUBLE"] = 1] = "DOUBLE";
973
- ScalarType2[ScalarType2["FLOAT"] = 2] = "FLOAT";
974
- ScalarType2[ScalarType2["INT64"] = 3] = "INT64";
975
- ScalarType2[ScalarType2["UINT64"] = 4] = "UINT64";
976
- ScalarType2[ScalarType2["INT32"] = 5] = "INT32";
977
- ScalarType2[ScalarType2["FIXED64"] = 6] = "FIXED64";
978
- ScalarType2[ScalarType2["FIXED32"] = 7] = "FIXED32";
979
- ScalarType2[ScalarType2["BOOL"] = 8] = "BOOL";
980
- ScalarType2[ScalarType2["STRING"] = 9] = "STRING";
981
- ScalarType2[ScalarType2["BYTES"] = 12] = "BYTES";
982
- ScalarType2[ScalarType2["UINT32"] = 13] = "UINT32";
983
- ScalarType2[ScalarType2["SFIXED32"] = 15] = "SFIXED32";
984
- ScalarType2[ScalarType2["SFIXED64"] = 16] = "SFIXED64";
985
- ScalarType2[ScalarType2["SINT32"] = 17] = "SINT32";
986
- ScalarType2[ScalarType2["SINT64"] = 18] = "SINT64";
987
- })(ScalarType || (ScalarType = {}));
988
- var LongType;
989
- (function(LongType2) {
990
- LongType2[LongType2["BIGINT"] = 0] = "BIGINT";
991
- LongType2[LongType2["STRING"] = 1] = "STRING";
992
- LongType2[LongType2["NUMBER"] = 2] = "NUMBER";
993
- })(LongType || (LongType = {}));
994
- var RepeatType;
995
- (function(RepeatType2) {
996
- RepeatType2[RepeatType2["NO"] = 0] = "NO";
997
- RepeatType2[RepeatType2["PACKED"] = 1] = "PACKED";
998
- RepeatType2[RepeatType2["UNPACKED"] = 2] = "UNPACKED";
999
- })(RepeatType || (RepeatType = {}));
1000
- function normalizeFieldInfo(field) {
1001
- var _a, _b, _c, _d;
1002
- field.localName = (_a = field.localName) !== null && _a !== void 0 ? _a : lowerCamelCase(field.name);
1003
- field.jsonName = (_b = field.jsonName) !== null && _b !== void 0 ? _b : lowerCamelCase(field.name);
1004
- field.repeat = (_c = field.repeat) !== null && _c !== void 0 ? _c : RepeatType.NO;
1005
- field.opt = (_d = field.opt) !== null && _d !== void 0 ? _d : field.repeat ? false : field.oneof ? false : field.kind == "message";
1006
- return field;
1007
- }
1008
-
1009
- // node_modules/@protobuf-ts/runtime/build/es2015/oneof.js
1010
- function isOneofGroup(any) {
1011
- if (typeof any != "object" || any === null || !any.hasOwnProperty("oneofKind")) {
1012
- return false;
1013
- }
1014
- switch (typeof any.oneofKind) {
1015
- case "string":
1016
- if (any[any.oneofKind] === void 0)
1017
- return false;
1018
- return Object.keys(any).length == 2;
1019
- case "undefined":
1020
- return Object.keys(any).length == 1;
1021
- default:
1022
- return false;
1023
- }
1024
- }
1025
-
1026
- // node_modules/@protobuf-ts/runtime/build/es2015/reflection-type-check.js
1027
- var ReflectionTypeCheck = class {
1028
- constructor(info) {
1029
- var _a;
1030
- this.fields = (_a = info.fields) !== null && _a !== void 0 ? _a : [];
1031
- }
1032
- prepare() {
1033
- if (this.data)
1034
- return;
1035
- const req = [], known = [], oneofs = [];
1036
- for (let field of this.fields) {
1037
- if (field.oneof) {
1038
- if (!oneofs.includes(field.oneof)) {
1039
- oneofs.push(field.oneof);
1040
- req.push(field.oneof);
1041
- known.push(field.oneof);
1042
- }
1043
- } else {
1044
- known.push(field.localName);
1045
- switch (field.kind) {
1046
- case "scalar":
1047
- case "enum":
1048
- if (!field.opt || field.repeat)
1049
- req.push(field.localName);
1050
- break;
1051
- case "message":
1052
- if (field.repeat)
1053
- req.push(field.localName);
1054
- break;
1055
- case "map":
1056
- req.push(field.localName);
1057
- break;
1058
- }
1059
- }
1060
- }
1061
- this.data = { req, known, oneofs: Object.values(oneofs) };
1062
- }
1063
- /**
1064
- * Is the argument a valid message as specified by the
1065
- * reflection information?
1066
- *
1067
- * Checks all field types recursively. The `depth`
1068
- * specifies how deep into the structure the check will be.
1069
- *
1070
- * With a depth of 0, only the presence of fields
1071
- * is checked.
1072
- *
1073
- * With a depth of 1 or more, the field types are checked.
1074
- *
1075
- * With a depth of 2 or more, the members of map, repeated
1076
- * and message fields are checked.
1077
- *
1078
- * Message fields will be checked recursively with depth - 1.
1079
- *
1080
- * The number of map entries / repeated values being checked
1081
- * is < depth.
1082
- */
1083
- is(message, depth, allowExcessProperties = false) {
1084
- if (depth < 0)
1085
- return true;
1086
- if (message === null || message === void 0 || typeof message != "object")
1087
- return false;
1088
- this.prepare();
1089
- let keys = Object.keys(message), data = this.data;
1090
- if (keys.length < data.req.length || data.req.some((n) => !keys.includes(n)))
1091
- return false;
1092
- if (!allowExcessProperties) {
1093
- if (keys.some((k) => !data.known.includes(k)))
1094
- return false;
1095
- }
1096
- if (depth < 1) {
1097
- return true;
1098
- }
1099
- for (const name of data.oneofs) {
1100
- const group = message[name];
1101
- if (!isOneofGroup(group))
1102
- return false;
1103
- if (group.oneofKind === void 0)
1104
- continue;
1105
- const field = this.fields.find((f) => f.localName === group.oneofKind);
1106
- if (!field)
1107
- return false;
1108
- if (!this.field(group[group.oneofKind], field, allowExcessProperties, depth))
1109
- return false;
1110
- }
1111
- for (const field of this.fields) {
1112
- if (field.oneof !== void 0)
1113
- continue;
1114
- if (!this.field(message[field.localName], field, allowExcessProperties, depth))
1115
- return false;
1116
- }
1117
- return true;
1118
- }
1119
- field(arg, field, allowExcessProperties, depth) {
1120
- let repeated = field.repeat;
1121
- switch (field.kind) {
1122
- case "scalar":
1123
- if (arg === void 0)
1124
- return field.opt;
1125
- if (repeated)
1126
- return this.scalars(arg, field.T, depth, field.L);
1127
- return this.scalar(arg, field.T, field.L);
1128
- case "enum":
1129
- if (arg === void 0)
1130
- return field.opt;
1131
- if (repeated)
1132
- return this.scalars(arg, ScalarType.INT32, depth);
1133
- return this.scalar(arg, ScalarType.INT32);
1134
- case "message":
1135
- if (arg === void 0)
1136
- return true;
1137
- if (repeated)
1138
- return this.messages(arg, field.T(), allowExcessProperties, depth);
1139
- return this.message(arg, field.T(), allowExcessProperties, depth);
1140
- case "map":
1141
- if (typeof arg != "object" || arg === null)
1142
- return false;
1143
- if (depth < 2)
1144
- return true;
1145
- if (!this.mapKeys(arg, field.K, depth))
1146
- return false;
1147
- switch (field.V.kind) {
1148
- case "scalar":
1149
- return this.scalars(Object.values(arg), field.V.T, depth, field.V.L);
1150
- case "enum":
1151
- return this.scalars(Object.values(arg), ScalarType.INT32, depth);
1152
- case "message":
1153
- return this.messages(Object.values(arg), field.V.T(), allowExcessProperties, depth);
1154
- }
1155
- break;
1156
- }
1157
- return true;
1158
- }
1159
- message(arg, type, allowExcessProperties, depth) {
1160
- if (allowExcessProperties) {
1161
- return type.isAssignable(arg, depth);
1162
- }
1163
- return type.is(arg, depth);
1164
- }
1165
- messages(arg, type, allowExcessProperties, depth) {
1166
- if (!Array.isArray(arg))
1167
- return false;
1168
- if (depth < 2)
1169
- return true;
1170
- if (allowExcessProperties) {
1171
- for (let i = 0; i < arg.length && i < depth; i++)
1172
- if (!type.isAssignable(arg[i], depth - 1))
1173
- return false;
1174
- } else {
1175
- for (let i = 0; i < arg.length && i < depth; i++)
1176
- if (!type.is(arg[i], depth - 1))
1177
- return false;
1178
- }
1179
- return true;
1180
- }
1181
- scalar(arg, type, longType) {
1182
- let argType = typeof arg;
1183
- switch (type) {
1184
- case ScalarType.UINT64:
1185
- case ScalarType.FIXED64:
1186
- case ScalarType.INT64:
1187
- case ScalarType.SFIXED64:
1188
- case ScalarType.SINT64:
1189
- switch (longType) {
1190
- case LongType.BIGINT:
1191
- return argType == "bigint";
1192
- case LongType.NUMBER:
1193
- return argType == "number" && !isNaN(arg);
1194
- default:
1195
- return argType == "string";
1196
- }
1197
- case ScalarType.BOOL:
1198
- return argType == "boolean";
1199
- case ScalarType.STRING:
1200
- return argType == "string";
1201
- case ScalarType.BYTES:
1202
- return arg instanceof Uint8Array;
1203
- case ScalarType.DOUBLE:
1204
- case ScalarType.FLOAT:
1205
- return argType == "number" && !isNaN(arg);
1206
- default:
1207
- return argType == "number" && Number.isInteger(arg);
1208
- }
1209
- }
1210
- scalars(arg, type, depth, longType) {
1211
- if (!Array.isArray(arg))
1212
- return false;
1213
- if (depth < 2)
1214
- return true;
1215
- if (Array.isArray(arg)) {
1216
- for (let i = 0; i < arg.length && i < depth; i++)
1217
- if (!this.scalar(arg[i], type, longType))
1218
- return false;
1219
- }
1220
- return true;
1221
- }
1222
- mapKeys(map, type, depth) {
1223
- let keys = Object.keys(map);
1224
- switch (type) {
1225
- case ScalarType.INT32:
1226
- case ScalarType.FIXED32:
1227
- case ScalarType.SFIXED32:
1228
- case ScalarType.SINT32:
1229
- case ScalarType.UINT32:
1230
- return this.scalars(keys.slice(0, depth).map((k) => parseInt(k)), type, depth);
1231
- case ScalarType.BOOL:
1232
- return this.scalars(keys.slice(0, depth).map((k) => k == "true" ? true : k == "false" ? false : k), type, depth);
1233
- default:
1234
- return this.scalars(keys, type, depth, LongType.STRING);
1235
- }
1236
- }
1237
- };
1238
-
1239
- // node_modules/@protobuf-ts/runtime/build/es2015/reflection-long-convert.js
1240
- function reflectionLongConvert(long, type) {
1241
- switch (type) {
1242
- case LongType.BIGINT:
1243
- return long.toBigInt();
1244
- case LongType.NUMBER:
1245
- return long.toNumber();
1246
- default:
1247
- return long.toString();
1248
- }
1249
- }
1250
-
1251
- // node_modules/@protobuf-ts/runtime/build/es2015/reflection-json-reader.js
1252
- var ReflectionJsonReader = class {
1253
- constructor(info) {
1254
- this.info = info;
1255
- }
1256
- prepare() {
1257
- var _a;
1258
- if (this.fMap === void 0) {
1259
- this.fMap = {};
1260
- const fieldsInput = (_a = this.info.fields) !== null && _a !== void 0 ? _a : [];
1261
- for (const field of fieldsInput) {
1262
- this.fMap[field.name] = field;
1263
- this.fMap[field.jsonName] = field;
1264
- this.fMap[field.localName] = field;
1265
- }
1266
- }
1267
- }
1268
- // Cannot parse JSON <type of jsonValue> for <type name>#<fieldName>.
1269
- assert(condition, fieldName, jsonValue) {
1270
- if (!condition) {
1271
- let what = typeofJsonValue(jsonValue);
1272
- if (what == "number" || what == "boolean")
1273
- what = jsonValue.toString();
1274
- throw new Error(`Cannot parse JSON ${what} for ${this.info.typeName}#${fieldName}`);
1275
- }
1276
- }
1277
- /**
1278
- * Reads a message from canonical JSON format into the target message.
1279
- *
1280
- * Repeated fields are appended. Map entries are added, overwriting
1281
- * existing keys.
1282
- *
1283
- * If a message field is already present, it will be merged with the
1284
- * new data.
1285
- */
1286
- read(input, message, options) {
1287
- this.prepare();
1288
- const oneofsHandled = [];
1289
- for (const [jsonKey, jsonValue] of Object.entries(input)) {
1290
- const field = this.fMap[jsonKey];
1291
- if (!field) {
1292
- if (!options.ignoreUnknownFields)
1293
- throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${jsonKey}`);
1294
- continue;
1295
- }
1296
- const localName = field.localName;
1297
- let target;
1298
- if (field.oneof) {
1299
- if (jsonValue === null && (field.kind !== "enum" || field.T()[0] !== "google.protobuf.NullValue")) {
1300
- continue;
1301
- }
1302
- if (oneofsHandled.includes(field.oneof))
1303
- throw new Error(`Multiple members of the oneof group "${field.oneof}" of ${this.info.typeName} are present in JSON.`);
1304
- oneofsHandled.push(field.oneof);
1305
- target = message[field.oneof] = {
1306
- oneofKind: localName
1307
- };
1308
- } else {
1309
- target = message;
1310
- }
1311
- if (field.kind == "map") {
1312
- if (jsonValue === null) {
1313
- continue;
1314
- }
1315
- this.assert(isJsonObject(jsonValue), field.name, jsonValue);
1316
- const fieldObj = target[localName];
1317
- for (const [jsonObjKey, jsonObjValue] of Object.entries(jsonValue)) {
1318
- this.assert(jsonObjValue !== null, field.name + " map value", null);
1319
- let val;
1320
- switch (field.V.kind) {
1321
- case "message":
1322
- val = field.V.T().internalJsonRead(jsonObjValue, options);
1323
- break;
1324
- case "enum":
1325
- val = this.enum(field.V.T(), jsonObjValue, field.name, options.ignoreUnknownFields);
1326
- if (val === false)
1327
- continue;
1328
- break;
1329
- case "scalar":
1330
- val = this.scalar(jsonObjValue, field.V.T, field.V.L, field.name);
1331
- break;
1332
- }
1333
- this.assert(val !== void 0, field.name + " map value", jsonObjValue);
1334
- let key = jsonObjKey;
1335
- if (field.K == ScalarType.BOOL)
1336
- key = key == "true" ? true : key == "false" ? false : key;
1337
- key = this.scalar(key, field.K, LongType.STRING, field.name).toString();
1338
- fieldObj[key] = val;
1339
- }
1340
- } else if (field.repeat) {
1341
- if (jsonValue === null)
1342
- continue;
1343
- this.assert(Array.isArray(jsonValue), field.name, jsonValue);
1344
- const fieldArr = target[localName];
1345
- for (const jsonItem of jsonValue) {
1346
- this.assert(jsonItem !== null, field.name, null);
1347
- let val;
1348
- switch (field.kind) {
1349
- case "message":
1350
- val = field.T().internalJsonRead(jsonItem, options);
1351
- break;
1352
- case "enum":
1353
- val = this.enum(field.T(), jsonItem, field.name, options.ignoreUnknownFields);
1354
- if (val === false)
1355
- continue;
1356
- break;
1357
- case "scalar":
1358
- val = this.scalar(jsonItem, field.T, field.L, field.name);
1359
- break;
1360
- }
1361
- this.assert(val !== void 0, field.name, jsonValue);
1362
- fieldArr.push(val);
1363
- }
1364
- } else {
1365
- switch (field.kind) {
1366
- case "message":
1367
- if (jsonValue === null && field.T().typeName != "google.protobuf.Value") {
1368
- this.assert(field.oneof === void 0, field.name + " (oneof member)", null);
1369
- continue;
1370
- }
1371
- target[localName] = field.T().internalJsonRead(jsonValue, options, target[localName]);
1372
- break;
1373
- case "enum":
1374
- if (jsonValue === null)
1375
- continue;
1376
- let val = this.enum(field.T(), jsonValue, field.name, options.ignoreUnknownFields);
1377
- if (val === false)
1378
- continue;
1379
- target[localName] = val;
1380
- break;
1381
- case "scalar":
1382
- if (jsonValue === null)
1383
- continue;
1384
- target[localName] = this.scalar(jsonValue, field.T, field.L, field.name);
1385
- break;
1386
- }
1387
- }
1388
- }
1389
- }
1390
- /**
1391
- * Returns `false` for unrecognized string representations.
1392
- *
1393
- * google.protobuf.NullValue accepts only JSON `null` (or the old `"NULL_VALUE"`).
1394
- */
1395
- enum(type, json, fieldName, ignoreUnknownFields) {
1396
- if (type[0] == "google.protobuf.NullValue")
1397
- assert(json === null || json === "NULL_VALUE", `Unable to parse field ${this.info.typeName}#${fieldName}, enum ${type[0]} only accepts null.`);
1398
- if (json === null)
1399
- return 0;
1400
- switch (typeof json) {
1401
- case "number":
1402
- assert(Number.isInteger(json), `Unable to parse field ${this.info.typeName}#${fieldName}, enum can only be integral number, got ${json}.`);
1403
- return json;
1404
- case "string":
1405
- let localEnumName = json;
1406
- if (type[2] && json.substring(0, type[2].length) === type[2])
1407
- localEnumName = json.substring(type[2].length);
1408
- let enumNumber = type[1][localEnumName];
1409
- if (typeof enumNumber === "undefined" && ignoreUnknownFields) {
1410
- return false;
1411
- }
1412
- assert(typeof enumNumber == "number", `Unable to parse field ${this.info.typeName}#${fieldName}, enum ${type[0]} has no value for "${json}".`);
1413
- return enumNumber;
1414
- }
1415
- assert(false, `Unable to parse field ${this.info.typeName}#${fieldName}, cannot parse enum value from ${typeof json}".`);
1416
- }
1417
- scalar(json, type, longType, fieldName) {
1418
- let e;
1419
- try {
1420
- switch (type) {
1421
- // float, double: JSON value will be a number or one of the special string values "NaN", "Infinity", and "-Infinity".
1422
- // Either numbers or strings are accepted. Exponent notation is also accepted.
1423
- case ScalarType.DOUBLE:
1424
- case ScalarType.FLOAT:
1425
- if (json === null)
1426
- return 0;
1427
- if (json === "NaN")
1428
- return Number.NaN;
1429
- if (json === "Infinity")
1430
- return Number.POSITIVE_INFINITY;
1431
- if (json === "-Infinity")
1432
- return Number.NEGATIVE_INFINITY;
1433
- if (json === "") {
1434
- e = "empty string";
1435
- break;
1436
- }
1437
- if (typeof json == "string" && json.trim().length !== json.length) {
1438
- e = "extra whitespace";
1439
- break;
1440
- }
1441
- if (typeof json != "string" && typeof json != "number") {
1442
- break;
1443
- }
1444
- let float = Number(json);
1445
- if (Number.isNaN(float)) {
1446
- e = "not a number";
1447
- break;
1448
- }
1449
- if (!Number.isFinite(float)) {
1450
- e = "too large or small";
1451
- break;
1452
- }
1453
- if (type == ScalarType.FLOAT)
1454
- assertFloat32(float);
1455
- return float;
1456
- // int32, fixed32, uint32: JSON value will be a decimal number. Either numbers or strings are accepted.
1457
- case ScalarType.INT32:
1458
- case ScalarType.FIXED32:
1459
- case ScalarType.SFIXED32:
1460
- case ScalarType.SINT32:
1461
- case ScalarType.UINT32:
1462
- if (json === null)
1463
- return 0;
1464
- let int32;
1465
- if (typeof json == "number")
1466
- int32 = json;
1467
- else if (json === "")
1468
- e = "empty string";
1469
- else if (typeof json == "string") {
1470
- if (json.trim().length !== json.length)
1471
- e = "extra whitespace";
1472
- else
1473
- int32 = Number(json);
1474
- }
1475
- if (int32 === void 0)
1476
- break;
1477
- if (type == ScalarType.UINT32)
1478
- assertUInt32(int32);
1479
- else
1480
- assertInt32(int32);
1481
- return int32;
1482
- // int64, fixed64, uint64: JSON value will be a decimal string. Either numbers or strings are accepted.
1483
- case ScalarType.INT64:
1484
- case ScalarType.SFIXED64:
1485
- case ScalarType.SINT64:
1486
- if (json === null)
1487
- return reflectionLongConvert(PbLong.ZERO, longType);
1488
- if (typeof json != "number" && typeof json != "string")
1489
- break;
1490
- return reflectionLongConvert(PbLong.from(json), longType);
1491
- case ScalarType.FIXED64:
1492
- case ScalarType.UINT64:
1493
- if (json === null)
1494
- return reflectionLongConvert(PbULong.ZERO, longType);
1495
- if (typeof json != "number" && typeof json != "string")
1496
- break;
1497
- return reflectionLongConvert(PbULong.from(json), longType);
1498
- // bool:
1499
- case ScalarType.BOOL:
1500
- if (json === null)
1501
- return false;
1502
- if (typeof json !== "boolean")
1503
- break;
1504
- return json;
1505
- // string:
1506
- case ScalarType.STRING:
1507
- if (json === null)
1508
- return "";
1509
- if (typeof json !== "string") {
1510
- e = "extra whitespace";
1511
- break;
1512
- }
1513
- try {
1514
- encodeURIComponent(json);
1515
- } catch (e2) {
1516
- e2 = "invalid UTF8";
1517
- break;
1518
- }
1519
- return json;
1520
- // bytes: JSON value will be the data encoded as a string using standard base64 encoding with paddings.
1521
- // Either standard or URL-safe base64 encoding with/without paddings are accepted.
1522
- case ScalarType.BYTES:
1523
- if (json === null || json === "")
1524
- return new Uint8Array(0);
1525
- if (typeof json !== "string")
1526
- break;
1527
- return base64decode(json);
1528
- }
1529
- } catch (error) {
1530
- e = error.message;
1531
- }
1532
- this.assert(false, fieldName + (e ? " - " + e : ""), json);
1533
- }
1534
- };
1535
-
1536
- // node_modules/@protobuf-ts/runtime/build/es2015/reflection-json-writer.js
1537
- var ReflectionJsonWriter = class {
1538
- constructor(info) {
1539
- var _a;
1540
- this.fields = (_a = info.fields) !== null && _a !== void 0 ? _a : [];
1541
- }
1542
- /**
1543
- * Converts the message to a JSON object, based on the field descriptors.
1544
- */
1545
- write(message, options) {
1546
- const json = {}, source = message;
1547
- for (const field of this.fields) {
1548
- if (!field.oneof) {
1549
- let jsonValue2 = this.field(field, source[field.localName], options);
1550
- if (jsonValue2 !== void 0)
1551
- json[options.useProtoFieldName ? field.name : field.jsonName] = jsonValue2;
1552
- continue;
1553
- }
1554
- const group = source[field.oneof];
1555
- if (group.oneofKind !== field.localName)
1556
- continue;
1557
- const opt = field.kind == "scalar" || field.kind == "enum" ? Object.assign(Object.assign({}, options), { emitDefaultValues: true }) : options;
1558
- let jsonValue = this.field(field, group[field.localName], opt);
1559
- assert(jsonValue !== void 0);
1560
- json[options.useProtoFieldName ? field.name : field.jsonName] = jsonValue;
1561
- }
1562
- return json;
1563
- }
1564
- field(field, value, options) {
1565
- let jsonValue = void 0;
1566
- if (field.kind == "map") {
1567
- assert(typeof value == "object" && value !== null);
1568
- const jsonObj = {};
1569
- switch (field.V.kind) {
1570
- case "scalar":
1571
- for (const [entryKey, entryValue] of Object.entries(value)) {
1572
- const val = this.scalar(field.V.T, entryValue, field.name, false, true);
1573
- assert(val !== void 0);
1574
- jsonObj[entryKey.toString()] = val;
1575
- }
1576
- break;
1577
- case "message":
1578
- const messageType = field.V.T();
1579
- for (const [entryKey, entryValue] of Object.entries(value)) {
1580
- const val = this.message(messageType, entryValue, field.name, options);
1581
- assert(val !== void 0);
1582
- jsonObj[entryKey.toString()] = val;
1583
- }
1584
- break;
1585
- case "enum":
1586
- const enumInfo = field.V.T();
1587
- for (const [entryKey, entryValue] of Object.entries(value)) {
1588
- assert(entryValue === void 0 || typeof entryValue == "number");
1589
- const val = this.enum(enumInfo, entryValue, field.name, false, true, options.enumAsInteger);
1590
- assert(val !== void 0);
1591
- jsonObj[entryKey.toString()] = val;
1592
- }
1593
- break;
1594
- }
1595
- if (options.emitDefaultValues || Object.keys(jsonObj).length > 0)
1596
- jsonValue = jsonObj;
1597
- } else if (field.repeat) {
1598
- assert(Array.isArray(value));
1599
- const jsonArr = [];
1600
- switch (field.kind) {
1601
- case "scalar":
1602
- for (let i = 0; i < value.length; i++) {
1603
- const val = this.scalar(field.T, value[i], field.name, field.opt, true);
1604
- assert(val !== void 0);
1605
- jsonArr.push(val);
1606
- }
1607
- break;
1608
- case "enum":
1609
- const enumInfo = field.T();
1610
- for (let i = 0; i < value.length; i++) {
1611
- assert(value[i] === void 0 || typeof value[i] == "number");
1612
- const val = this.enum(enumInfo, value[i], field.name, field.opt, true, options.enumAsInteger);
1613
- assert(val !== void 0);
1614
- jsonArr.push(val);
1615
- }
1616
- break;
1617
- case "message":
1618
- const messageType = field.T();
1619
- for (let i = 0; i < value.length; i++) {
1620
- const val = this.message(messageType, value[i], field.name, options);
1621
- assert(val !== void 0);
1622
- jsonArr.push(val);
1623
- }
1624
- break;
1625
- }
1626
- if (options.emitDefaultValues || jsonArr.length > 0 || options.emitDefaultValues)
1627
- jsonValue = jsonArr;
1628
- } else {
1629
- switch (field.kind) {
1630
- case "scalar":
1631
- jsonValue = this.scalar(field.T, value, field.name, field.opt, options.emitDefaultValues);
1632
- break;
1633
- case "enum":
1634
- jsonValue = this.enum(field.T(), value, field.name, field.opt, options.emitDefaultValues, options.enumAsInteger);
1635
- break;
1636
- case "message":
1637
- jsonValue = this.message(field.T(), value, field.name, options);
1638
- break;
1639
- }
1640
- }
1641
- return jsonValue;
1642
- }
1643
- /**
1644
- * Returns `null` as the default for google.protobuf.NullValue.
1645
- */
1646
- enum(type, value, fieldName, optional, emitDefaultValues, enumAsInteger) {
1647
- if (type[0] == "google.protobuf.NullValue")
1648
- return !emitDefaultValues && !optional ? void 0 : null;
1649
- if (value === void 0) {
1650
- assert(optional);
1651
- return void 0;
1652
- }
1653
- if (value === 0 && !emitDefaultValues && !optional)
1654
- return void 0;
1655
- assert(typeof value == "number");
1656
- assert(Number.isInteger(value));
1657
- if (enumAsInteger || !type[1].hasOwnProperty(value))
1658
- return value;
1659
- if (type[2])
1660
- return type[2] + type[1][value];
1661
- return type[1][value];
1662
- }
1663
- message(type, value, fieldName, options) {
1664
- if (value === void 0)
1665
- return options.emitDefaultValues ? null : void 0;
1666
- return type.internalJsonWrite(value, options);
1667
- }
1668
- scalar(type, value, fieldName, optional, emitDefaultValues) {
1669
- if (value === void 0) {
1670
- assert(optional);
1671
- return void 0;
1672
- }
1673
- const ed = emitDefaultValues || optional;
1674
- switch (type) {
1675
- // int32, fixed32, uint32: JSON value will be a decimal number. Either numbers or strings are accepted.
1676
- case ScalarType.INT32:
1677
- case ScalarType.SFIXED32:
1678
- case ScalarType.SINT32:
1679
- if (value === 0)
1680
- return ed ? 0 : void 0;
1681
- assertInt32(value);
1682
- return value;
1683
- case ScalarType.FIXED32:
1684
- case ScalarType.UINT32:
1685
- if (value === 0)
1686
- return ed ? 0 : void 0;
1687
- assertUInt32(value);
1688
- return value;
1689
- // float, double: JSON value will be a number or one of the special string values "NaN", "Infinity", and "-Infinity".
1690
- // Either numbers or strings are accepted. Exponent notation is also accepted.
1691
- case ScalarType.FLOAT:
1692
- assertFloat32(value);
1693
- case ScalarType.DOUBLE:
1694
- if (value === 0)
1695
- return ed ? 0 : void 0;
1696
- assert(typeof value == "number");
1697
- if (Number.isNaN(value))
1698
- return "NaN";
1699
- if (value === Number.POSITIVE_INFINITY)
1700
- return "Infinity";
1701
- if (value === Number.NEGATIVE_INFINITY)
1702
- return "-Infinity";
1703
- return value;
1704
- // string:
1705
- case ScalarType.STRING:
1706
- if (value === "")
1707
- return ed ? "" : void 0;
1708
- assert(typeof value == "string");
1709
- return value;
1710
- // bool:
1711
- case ScalarType.BOOL:
1712
- if (value === false)
1713
- return ed ? false : void 0;
1714
- assert(typeof value == "boolean");
1715
- return value;
1716
- // JSON value will be a decimal string. Either numbers or strings are accepted.
1717
- case ScalarType.UINT64:
1718
- case ScalarType.FIXED64:
1719
- assert(typeof value == "number" || typeof value == "string" || typeof value == "bigint");
1720
- let ulong = PbULong.from(value);
1721
- if (ulong.isZero() && !ed)
1722
- return void 0;
1723
- return ulong.toString();
1724
- // JSON value will be a decimal string. Either numbers or strings are accepted.
1725
- case ScalarType.INT64:
1726
- case ScalarType.SFIXED64:
1727
- case ScalarType.SINT64:
1728
- assert(typeof value == "number" || typeof value == "string" || typeof value == "bigint");
1729
- let long = PbLong.from(value);
1730
- if (long.isZero() && !ed)
1731
- return void 0;
1732
- return long.toString();
1733
- // bytes: JSON value will be the data encoded as a string using standard base64 encoding with paddings.
1734
- // Either standard or URL-safe base64 encoding with/without paddings are accepted.
1735
- case ScalarType.BYTES:
1736
- assert(value instanceof Uint8Array);
1737
- if (!value.byteLength)
1738
- return ed ? "" : void 0;
1739
- return base64encode(value);
1740
- }
1741
- }
1742
- };
1743
-
1744
- // node_modules/@protobuf-ts/runtime/build/es2015/reflection-scalar-default.js
1745
- function reflectionScalarDefault(type, longType = LongType.STRING) {
1746
- switch (type) {
1747
- case ScalarType.BOOL:
1748
- return false;
1749
- case ScalarType.UINT64:
1750
- case ScalarType.FIXED64:
1751
- return reflectionLongConvert(PbULong.ZERO, longType);
1752
- case ScalarType.INT64:
1753
- case ScalarType.SFIXED64:
1754
- case ScalarType.SINT64:
1755
- return reflectionLongConvert(PbLong.ZERO, longType);
1756
- case ScalarType.DOUBLE:
1757
- case ScalarType.FLOAT:
1758
- return 0;
1759
- case ScalarType.BYTES:
1760
- return new Uint8Array(0);
1761
- case ScalarType.STRING:
1762
- return "";
1763
- default:
1764
- return 0;
1765
- }
1766
- }
1767
-
1768
- // node_modules/@protobuf-ts/runtime/build/es2015/reflection-binary-reader.js
1769
- var ReflectionBinaryReader = class {
1770
- constructor(info) {
1771
- this.info = info;
1772
- }
1773
- prepare() {
1774
- var _a;
1775
- if (!this.fieldNoToField) {
1776
- const fieldsInput = (_a = this.info.fields) !== null && _a !== void 0 ? _a : [];
1777
- this.fieldNoToField = new Map(fieldsInput.map((field) => [field.no, field]));
1778
- }
1779
- }
1780
- /**
1781
- * Reads a message from binary format into the target message.
1782
- *
1783
- * Repeated fields are appended. Map entries are added, overwriting
1784
- * existing keys.
1785
- *
1786
- * If a message field is already present, it will be merged with the
1787
- * new data.
1788
- */
1789
- read(reader, message, options, length) {
1790
- this.prepare();
1791
- const end = length === void 0 ? reader.len : reader.pos + length;
1792
- while (reader.pos < end) {
1793
- const [fieldNo, wireType] = reader.tag(), field = this.fieldNoToField.get(fieldNo);
1794
- if (!field) {
1795
- let u = options.readUnknownField;
1796
- if (u == "throw")
1797
- throw new Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.info.typeName}`);
1798
- let d = reader.skip(wireType);
1799
- if (u !== false)
1800
- (u === true ? UnknownFieldHandler.onRead : u)(this.info.typeName, message, fieldNo, wireType, d);
1801
- continue;
1802
- }
1803
- let target = message, repeated = field.repeat, localName = field.localName;
1804
- if (field.oneof) {
1805
- target = target[field.oneof];
1806
- if (target.oneofKind !== localName)
1807
- target = message[field.oneof] = {
1808
- oneofKind: localName
1809
- };
1810
- }
1811
- switch (field.kind) {
1812
- case "scalar":
1813
- case "enum":
1814
- let T = field.kind == "enum" ? ScalarType.INT32 : field.T;
1815
- let L = field.kind == "scalar" ? field.L : void 0;
1816
- if (repeated) {
1817
- let arr = target[localName];
1818
- if (wireType == WireType.LengthDelimited && T != ScalarType.STRING && T != ScalarType.BYTES) {
1819
- let e = reader.uint32() + reader.pos;
1820
- while (reader.pos < e)
1821
- arr.push(this.scalar(reader, T, L));
1822
- } else
1823
- arr.push(this.scalar(reader, T, L));
1824
- } else
1825
- target[localName] = this.scalar(reader, T, L);
1826
- break;
1827
- case "message":
1828
- if (repeated) {
1829
- let arr = target[localName];
1830
- let msg = field.T().internalBinaryRead(reader, reader.uint32(), options);
1831
- arr.push(msg);
1832
- } else
1833
- target[localName] = field.T().internalBinaryRead(reader, reader.uint32(), options, target[localName]);
1834
- break;
1835
- case "map":
1836
- let [mapKey, mapVal] = this.mapEntry(field, reader, options);
1837
- target[localName][mapKey] = mapVal;
1838
- break;
1839
- }
1840
- }
1841
- }
1842
- /**
1843
- * Read a map field, expecting key field = 1, value field = 2
1844
- */
1845
- mapEntry(field, reader, options) {
1846
- let length = reader.uint32();
1847
- let end = reader.pos + length;
1848
- let key = void 0;
1849
- let val = void 0;
1850
- while (reader.pos < end) {
1851
- let [fieldNo, wireType] = reader.tag();
1852
- switch (fieldNo) {
1853
- case 1:
1854
- if (field.K == ScalarType.BOOL)
1855
- key = reader.bool().toString();
1856
- else
1857
- key = this.scalar(reader, field.K, LongType.STRING);
1858
- break;
1859
- case 2:
1860
- switch (field.V.kind) {
1861
- case "scalar":
1862
- val = this.scalar(reader, field.V.T, field.V.L);
1863
- break;
1864
- case "enum":
1865
- val = reader.int32();
1866
- break;
1867
- case "message":
1868
- val = field.V.T().internalBinaryRead(reader, reader.uint32(), options);
1869
- break;
1870
- }
1871
- break;
1872
- default:
1873
- throw new Error(`Unknown field ${fieldNo} (wire type ${wireType}) in map entry for ${this.info.typeName}#${field.name}`);
1874
- }
1875
- }
1876
- if (key === void 0) {
1877
- let keyRaw = reflectionScalarDefault(field.K);
1878
- key = field.K == ScalarType.BOOL ? keyRaw.toString() : keyRaw;
1879
- }
1880
- if (val === void 0)
1881
- switch (field.V.kind) {
1882
- case "scalar":
1883
- val = reflectionScalarDefault(field.V.T, field.V.L);
1884
- break;
1885
- case "enum":
1886
- val = 0;
1887
- break;
1888
- case "message":
1889
- val = field.V.T().create();
1890
- break;
1891
- }
1892
- return [key, val];
1893
- }
1894
- scalar(reader, type, longType) {
1895
- switch (type) {
1896
- case ScalarType.INT32:
1897
- return reader.int32();
1898
- case ScalarType.STRING:
1899
- return reader.string();
1900
- case ScalarType.BOOL:
1901
- return reader.bool();
1902
- case ScalarType.DOUBLE:
1903
- return reader.double();
1904
- case ScalarType.FLOAT:
1905
- return reader.float();
1906
- case ScalarType.INT64:
1907
- return reflectionLongConvert(reader.int64(), longType);
1908
- case ScalarType.UINT64:
1909
- return reflectionLongConvert(reader.uint64(), longType);
1910
- case ScalarType.FIXED64:
1911
- return reflectionLongConvert(reader.fixed64(), longType);
1912
- case ScalarType.FIXED32:
1913
- return reader.fixed32();
1914
- case ScalarType.BYTES:
1915
- return reader.bytes();
1916
- case ScalarType.UINT32:
1917
- return reader.uint32();
1918
- case ScalarType.SFIXED32:
1919
- return reader.sfixed32();
1920
- case ScalarType.SFIXED64:
1921
- return reflectionLongConvert(reader.sfixed64(), longType);
1922
- case ScalarType.SINT32:
1923
- return reader.sint32();
1924
- case ScalarType.SINT64:
1925
- return reflectionLongConvert(reader.sint64(), longType);
1926
- }
1927
- }
1928
- };
1929
-
1930
- // node_modules/@protobuf-ts/runtime/build/es2015/reflection-binary-writer.js
1931
- var ReflectionBinaryWriter = class {
1932
- constructor(info) {
1933
- this.info = info;
1934
- }
1935
- prepare() {
1936
- if (!this.fields) {
1937
- const fieldsInput = this.info.fields ? this.info.fields.concat() : [];
1938
- this.fields = fieldsInput.sort((a, b) => a.no - b.no);
1939
- }
1940
- }
1941
- /**
1942
- * Writes the message to binary format.
1943
- */
1944
- write(message, writer, options) {
1945
- this.prepare();
1946
- for (const field of this.fields) {
1947
- let value, emitDefault, repeated = field.repeat, localName = field.localName;
1948
- if (field.oneof) {
1949
- const group = message[field.oneof];
1950
- if (group.oneofKind !== localName)
1951
- continue;
1952
- value = group[localName];
1953
- emitDefault = true;
1954
- } else {
1955
- value = message[localName];
1956
- emitDefault = false;
1957
- }
1958
- switch (field.kind) {
1959
- case "scalar":
1960
- case "enum":
1961
- let T = field.kind == "enum" ? ScalarType.INT32 : field.T;
1962
- if (repeated) {
1963
- assert(Array.isArray(value));
1964
- if (repeated == RepeatType.PACKED)
1965
- this.packed(writer, T, field.no, value);
1966
- else
1967
- for (const item of value)
1968
- this.scalar(writer, T, field.no, item, true);
1969
- } else if (value === void 0)
1970
- assert(field.opt);
1971
- else
1972
- this.scalar(writer, T, field.no, value, emitDefault || field.opt);
1973
- break;
1974
- case "message":
1975
- if (repeated) {
1976
- assert(Array.isArray(value));
1977
- for (const item of value)
1978
- this.message(writer, options, field.T(), field.no, item);
1979
- } else {
1980
- this.message(writer, options, field.T(), field.no, value);
1981
- }
1982
- break;
1983
- case "map":
1984
- assert(typeof value == "object" && value !== null);
1985
- for (const [key, val] of Object.entries(value))
1986
- this.mapEntry(writer, options, field, key, val);
1987
- break;
1988
- }
1989
- }
1990
- let u = options.writeUnknownFields;
1991
- if (u !== false)
1992
- (u === true ? UnknownFieldHandler.onWrite : u)(this.info.typeName, message, writer);
1993
- }
1994
- mapEntry(writer, options, field, key, value) {
1995
- writer.tag(field.no, WireType.LengthDelimited);
1996
- writer.fork();
1997
- let keyValue = key;
1998
- switch (field.K) {
1999
- case ScalarType.INT32:
2000
- case ScalarType.FIXED32:
2001
- case ScalarType.UINT32:
2002
- case ScalarType.SFIXED32:
2003
- case ScalarType.SINT32:
2004
- keyValue = Number.parseInt(key);
2005
- break;
2006
- case ScalarType.BOOL:
2007
- assert(key == "true" || key == "false");
2008
- keyValue = key == "true";
2009
- break;
2010
- }
2011
- this.scalar(writer, field.K, 1, keyValue, true);
2012
- switch (field.V.kind) {
2013
- case "scalar":
2014
- this.scalar(writer, field.V.T, 2, value, true);
2015
- break;
2016
- case "enum":
2017
- this.scalar(writer, ScalarType.INT32, 2, value, true);
2018
- break;
2019
- case "message":
2020
- this.message(writer, options, field.V.T(), 2, value);
2021
- break;
2022
- }
2023
- writer.join();
2024
- }
2025
- message(writer, options, handler, fieldNo, value) {
2026
- if (value === void 0)
2027
- return;
2028
- handler.internalBinaryWrite(value, writer.tag(fieldNo, WireType.LengthDelimited).fork(), options);
2029
- writer.join();
2030
- }
2031
- /**
2032
- * Write a single scalar value.
2033
- */
2034
- scalar(writer, type, fieldNo, value, emitDefault) {
2035
- let [wireType, method, isDefault] = this.scalarInfo(type, value);
2036
- if (!isDefault || emitDefault) {
2037
- writer.tag(fieldNo, wireType);
2038
- writer[method](value);
2039
- }
2040
- }
2041
- /**
2042
- * Write an array of scalar values in packed format.
2043
- */
2044
- packed(writer, type, fieldNo, value) {
2045
- if (!value.length)
2046
- return;
2047
- assert(type !== ScalarType.BYTES && type !== ScalarType.STRING);
2048
- writer.tag(fieldNo, WireType.LengthDelimited);
2049
- writer.fork();
2050
- let [, method] = this.scalarInfo(type);
2051
- for (let i = 0; i < value.length; i++)
2052
- writer[method](value[i]);
2053
- writer.join();
2054
- }
2055
- /**
2056
- * Get information for writing a scalar value.
2057
- *
2058
- * Returns tuple:
2059
- * [0]: appropriate WireType
2060
- * [1]: name of the appropriate method of IBinaryWriter
2061
- * [2]: whether the given value is a default value
2062
- *
2063
- * If argument `value` is omitted, [2] is always false.
2064
- */
2065
- scalarInfo(type, value) {
2066
- let t = WireType.Varint;
2067
- let m;
2068
- let i = value === void 0;
2069
- let d = value === 0;
2070
- switch (type) {
2071
- case ScalarType.INT32:
2072
- m = "int32";
2073
- break;
2074
- case ScalarType.STRING:
2075
- d = i || !value.length;
2076
- t = WireType.LengthDelimited;
2077
- m = "string";
2078
- break;
2079
- case ScalarType.BOOL:
2080
- d = value === false;
2081
- m = "bool";
2082
- break;
2083
- case ScalarType.UINT32:
2084
- m = "uint32";
2085
- break;
2086
- case ScalarType.DOUBLE:
2087
- t = WireType.Bit64;
2088
- m = "double";
2089
- break;
2090
- case ScalarType.FLOAT:
2091
- t = WireType.Bit32;
2092
- m = "float";
2093
- break;
2094
- case ScalarType.INT64:
2095
- d = i || PbLong.from(value).isZero();
2096
- m = "int64";
2097
- break;
2098
- case ScalarType.UINT64:
2099
- d = i || PbULong.from(value).isZero();
2100
- m = "uint64";
2101
- break;
2102
- case ScalarType.FIXED64:
2103
- d = i || PbULong.from(value).isZero();
2104
- t = WireType.Bit64;
2105
- m = "fixed64";
2106
- break;
2107
- case ScalarType.BYTES:
2108
- d = i || !value.byteLength;
2109
- t = WireType.LengthDelimited;
2110
- m = "bytes";
2111
- break;
2112
- case ScalarType.FIXED32:
2113
- t = WireType.Bit32;
2114
- m = "fixed32";
2115
- break;
2116
- case ScalarType.SFIXED32:
2117
- t = WireType.Bit32;
2118
- m = "sfixed32";
2119
- break;
2120
- case ScalarType.SFIXED64:
2121
- d = i || PbLong.from(value).isZero();
2122
- t = WireType.Bit64;
2123
- m = "sfixed64";
2124
- break;
2125
- case ScalarType.SINT32:
2126
- m = "sint32";
2127
- break;
2128
- case ScalarType.SINT64:
2129
- d = i || PbLong.from(value).isZero();
2130
- m = "sint64";
2131
- break;
2132
- }
2133
- return [t, m, i || d];
2134
- }
2135
- };
2136
-
2137
- // node_modules/@protobuf-ts/runtime/build/es2015/reflection-create.js
2138
- function reflectionCreate(type) {
2139
- const msg = type.messagePrototype ? Object.create(type.messagePrototype) : Object.defineProperty({}, MESSAGE_TYPE, { value: type });
2140
- for (let field of type.fields) {
2141
- let name = field.localName;
2142
- if (field.opt)
2143
- continue;
2144
- if (field.oneof)
2145
- msg[field.oneof] = { oneofKind: void 0 };
2146
- else if (field.repeat)
2147
- msg[name] = [];
2148
- else
2149
- switch (field.kind) {
2150
- case "scalar":
2151
- msg[name] = reflectionScalarDefault(field.T, field.L);
2152
- break;
2153
- case "enum":
2154
- msg[name] = 0;
2155
- break;
2156
- case "map":
2157
- msg[name] = {};
2158
- break;
2159
- }
2160
- }
2161
- return msg;
2162
- }
2163
-
2164
- // node_modules/@protobuf-ts/runtime/build/es2015/reflection-merge-partial.js
2165
- function reflectionMergePartial(info, target, source) {
2166
- let fieldValue, input = source, output;
2167
- for (let field of info.fields) {
2168
- let name = field.localName;
2169
- if (field.oneof) {
2170
- const group = input[field.oneof];
2171
- if ((group === null || group === void 0 ? void 0 : group.oneofKind) == void 0) {
2172
- continue;
2173
- }
2174
- fieldValue = group[name];
2175
- output = target[field.oneof];
2176
- output.oneofKind = group.oneofKind;
2177
- if (fieldValue == void 0) {
2178
- delete output[name];
2179
- continue;
2180
- }
2181
- } else {
2182
- fieldValue = input[name];
2183
- output = target;
2184
- if (fieldValue == void 0) {
2185
- continue;
2186
- }
2187
- }
2188
- if (field.repeat)
2189
- output[name].length = fieldValue.length;
2190
- switch (field.kind) {
2191
- case "scalar":
2192
- case "enum":
2193
- if (field.repeat)
2194
- for (let i = 0; i < fieldValue.length; i++)
2195
- output[name][i] = fieldValue[i];
2196
- else
2197
- output[name] = fieldValue;
2198
- break;
2199
- case "message":
2200
- let T = field.T();
2201
- if (field.repeat)
2202
- for (let i = 0; i < fieldValue.length; i++)
2203
- output[name][i] = T.create(fieldValue[i]);
2204
- else if (output[name] === void 0)
2205
- output[name] = T.create(fieldValue);
2206
- else
2207
- T.mergePartial(output[name], fieldValue);
2208
- break;
2209
- case "map":
2210
- switch (field.V.kind) {
2211
- case "scalar":
2212
- case "enum":
2213
- Object.assign(output[name], fieldValue);
2214
- break;
2215
- case "message":
2216
- let T2 = field.V.T();
2217
- for (let k of Object.keys(fieldValue))
2218
- output[name][k] = T2.create(fieldValue[k]);
2219
- break;
2220
- }
2221
- break;
2222
- }
2223
- }
2224
- }
2225
-
2226
- // node_modules/@protobuf-ts/runtime/build/es2015/reflection-equals.js
2227
- function reflectionEquals(info, a, b) {
2228
- if (a === b)
2229
- return true;
2230
- if (!a || !b)
2231
- return false;
2232
- for (let field of info.fields) {
2233
- let localName = field.localName;
2234
- let val_a = field.oneof ? a[field.oneof][localName] : a[localName];
2235
- let val_b = field.oneof ? b[field.oneof][localName] : b[localName];
2236
- switch (field.kind) {
2237
- case "enum":
2238
- case "scalar":
2239
- let t = field.kind == "enum" ? ScalarType.INT32 : field.T;
2240
- if (!(field.repeat ? repeatedPrimitiveEq(t, val_a, val_b) : primitiveEq(t, val_a, val_b)))
2241
- return false;
2242
- break;
2243
- case "map":
2244
- if (!(field.V.kind == "message" ? repeatedMsgEq(field.V.T(), objectValues(val_a), objectValues(val_b)) : repeatedPrimitiveEq(field.V.kind == "enum" ? ScalarType.INT32 : field.V.T, objectValues(val_a), objectValues(val_b))))
2245
- return false;
2246
- break;
2247
- case "message":
2248
- let T = field.T();
2249
- if (!(field.repeat ? repeatedMsgEq(T, val_a, val_b) : T.equals(val_a, val_b)))
2250
- return false;
2251
- break;
2252
- }
2253
- }
2254
- return true;
2255
- }
2256
- var objectValues = Object.values;
2257
- function primitiveEq(type, a, b) {
2258
- if (a === b)
2259
- return true;
2260
- if (type !== ScalarType.BYTES)
2261
- return false;
2262
- let ba = a;
2263
- let bb = b;
2264
- if (ba.length !== bb.length)
2265
- return false;
2266
- for (let i = 0; i < ba.length; i++)
2267
- if (ba[i] != bb[i])
2268
- return false;
2269
- return true;
2270
- }
2271
- function repeatedPrimitiveEq(type, a, b) {
2272
- if (a.length !== b.length)
2273
- return false;
2274
- for (let i = 0; i < a.length; i++)
2275
- if (!primitiveEq(type, a[i], b[i]))
2276
- return false;
2277
- return true;
2278
- }
2279
- function repeatedMsgEq(type, a, b) {
2280
- if (a.length !== b.length)
2281
- return false;
2282
- for (let i = 0; i < a.length; i++)
2283
- if (!type.equals(a[i], b[i]))
2284
- return false;
2285
- return true;
2286
- }
2287
-
2288
- // node_modules/@protobuf-ts/runtime/build/es2015/message-type.js
2289
- var baseDescriptors = Object.getOwnPropertyDescriptors(Object.getPrototypeOf({}));
2290
- var MessageType = class {
2291
- constructor(name, fields, options) {
2292
- this.defaultCheckDepth = 16;
2293
- this.typeName = name;
2294
- this.fields = fields.map(normalizeFieldInfo);
2295
- this.options = options !== null && options !== void 0 ? options : {};
2296
- this.messagePrototype = Object.create(null, Object.assign(Object.assign({}, baseDescriptors), { [MESSAGE_TYPE]: { value: this } }));
2297
- this.refTypeCheck = new ReflectionTypeCheck(this);
2298
- this.refJsonReader = new ReflectionJsonReader(this);
2299
- this.refJsonWriter = new ReflectionJsonWriter(this);
2300
- this.refBinReader = new ReflectionBinaryReader(this);
2301
- this.refBinWriter = new ReflectionBinaryWriter(this);
2302
- }
2303
- create(value) {
2304
- let message = reflectionCreate(this);
2305
- if (value !== void 0) {
2306
- reflectionMergePartial(this, message, value);
2307
- }
2308
- return message;
2309
- }
2310
- /**
2311
- * Clone the message.
2312
- *
2313
- * Unknown fields are discarded.
2314
- */
2315
- clone(message) {
2316
- let copy = this.create();
2317
- reflectionMergePartial(this, copy, message);
2318
- return copy;
2319
- }
2320
- /**
2321
- * Determines whether two message of the same type have the same field values.
2322
- * Checks for deep equality, traversing repeated fields, oneof groups, maps
2323
- * and messages recursively.
2324
- * Will also return true if both messages are `undefined`.
2325
- */
2326
- equals(a, b) {
2327
- return reflectionEquals(this, a, b);
2328
- }
2329
- /**
2330
- * Is the given value assignable to our message type
2331
- * and contains no [excess properties](https://www.typescriptlang.org/docs/handbook/interfaces.html#excess-property-checks)?
2332
- */
2333
- is(arg, depth = this.defaultCheckDepth) {
2334
- return this.refTypeCheck.is(arg, depth, false);
2335
- }
2336
- /**
2337
- * Is the given value assignable to our message type,
2338
- * regardless of [excess properties](https://www.typescriptlang.org/docs/handbook/interfaces.html#excess-property-checks)?
2339
- */
2340
- isAssignable(arg, depth = this.defaultCheckDepth) {
2341
- return this.refTypeCheck.is(arg, depth, true);
2342
- }
2343
- /**
2344
- * Copy partial data into the target message.
2345
- */
2346
- mergePartial(target, source) {
2347
- reflectionMergePartial(this, target, source);
2348
- }
2349
- /**
2350
- * Create a new message from binary format.
2351
- */
2352
- fromBinary(data, options) {
2353
- let opt = binaryReadOptions(options);
2354
- return this.internalBinaryRead(opt.readerFactory(data), data.byteLength, opt);
2355
- }
2356
- /**
2357
- * Read a new message from a JSON value.
2358
- */
2359
- fromJson(json, options) {
2360
- return this.internalJsonRead(json, jsonReadOptions(options));
2361
- }
2362
- /**
2363
- * Read a new message from a JSON string.
2364
- * This is equivalent to `T.fromJson(JSON.parse(json))`.
2365
- */
2366
- fromJsonString(json, options) {
2367
- let value = JSON.parse(json);
2368
- return this.fromJson(value, options);
2369
- }
2370
- /**
2371
- * Write the message to canonical JSON value.
2372
- */
2373
- toJson(message, options) {
2374
- return this.internalJsonWrite(message, jsonWriteOptions(options));
2375
- }
2376
- /**
2377
- * Convert the message to canonical JSON string.
2378
- * This is equivalent to `JSON.stringify(T.toJson(t))`
2379
- */
2380
- toJsonString(message, options) {
2381
- var _a;
2382
- let value = this.toJson(message, options);
2383
- return JSON.stringify(value, null, (_a = options === null || options === void 0 ? void 0 : options.prettySpaces) !== null && _a !== void 0 ? _a : 0);
2384
- }
2385
- /**
2386
- * Write the message to binary format.
2387
- */
2388
- toBinary(message, options) {
2389
- let opt = binaryWriteOptions(options);
2390
- return this.internalBinaryWrite(message, opt.writerFactory(), opt).finish();
2391
- }
2392
- /**
2393
- * This is an internal method. If you just want to read a message from
2394
- * JSON, use `fromJson()` or `fromJsonString()`.
2395
- *
2396
- * Reads JSON value and merges the fields into the target
2397
- * according to protobuf rules. If the target is omitted,
2398
- * a new instance is created first.
2399
- */
2400
- internalJsonRead(json, options, target) {
2401
- if (json !== null && typeof json == "object" && !Array.isArray(json)) {
2402
- let message = target !== null && target !== void 0 ? target : this.create();
2403
- this.refJsonReader.read(json, message, options);
2404
- return message;
2405
- }
2406
- throw new Error(`Unable to parse message ${this.typeName} from JSON ${typeofJsonValue(json)}.`);
2407
- }
2408
- /**
2409
- * This is an internal method. If you just want to write a message
2410
- * to JSON, use `toJson()` or `toJsonString().
2411
- *
2412
- * Writes JSON value and returns it.
2413
- */
2414
- internalJsonWrite(message, options) {
2415
- return this.refJsonWriter.write(message, options);
2416
- }
2417
- /**
2418
- * This is an internal method. If you just want to write a message
2419
- * in binary format, use `toBinary()`.
2420
- *
2421
- * Serializes the message in binary format and appends it to the given
2422
- * writer. Returns passed writer.
2423
- */
2424
- internalBinaryWrite(message, writer, options) {
2425
- this.refBinWriter.write(message, writer, options);
2426
- return writer;
2427
- }
2428
- /**
2429
- * This is an internal method. If you just want to read a message from
2430
- * binary data, use `fromBinary()`.
2431
- *
2432
- * Reads data from binary format and merges the fields into
2433
- * the target according to protobuf rules. If the target is
2434
- * omitted, a new instance is created first.
2435
- */
2436
- internalBinaryRead(reader, length, options, target) {
2437
- let message = target !== null && target !== void 0 ? target : this.create();
2438
- this.refBinReader.read(reader, message, options, length);
2439
- return message;
2440
- }
2441
- };
2442
-
2443
1
  // lib/common.ts
2
+ import { WireType } from "@protobuf-ts/runtime";
3
+ import { UnknownFieldHandler } from "@protobuf-ts/runtime";
4
+ import { reflectionMergePartial } from "@protobuf-ts/runtime";
5
+ import { MessageType } from "@protobuf-ts/runtime";
2444
6
  var TestStatus = /* @__PURE__ */ ((TestStatus2) => {
2445
7
  TestStatus2[TestStatus2["UNKNOWN"] = 0] = "UNKNOWN";
2446
8
  TestStatus2[TestStatus2["PASSED"] = 1] = "PASSED";
@@ -2485,7 +47,7 @@ var Attachment$Type = class extends MessageType {
2485
47
  return message;
2486
48
  }
2487
49
  internalBinaryRead(reader, length, options, target) {
2488
- let message = target != null ? target : this.create(), end = reader.pos + length;
50
+ let message = target ?? this.create(), end = reader.pos + length;
2489
51
  while (reader.pos < end) {
2490
52
  let [fieldNo, wireType] = reader.tag();
2491
53
  switch (fieldNo) {
@@ -2527,8 +89,20 @@ var Attachment$Type = class extends MessageType {
2527
89
  };
2528
90
  var Attachment = new Attachment$Type();
2529
91
 
92
+ // lib/events.ts
93
+ import { WireType as WireType3 } from "@protobuf-ts/runtime";
94
+ import { UnknownFieldHandler as UnknownFieldHandler3 } from "@protobuf-ts/runtime";
95
+ import { reflectionMergePartial as reflectionMergePartial3 } from "@protobuf-ts/runtime";
96
+ import { MessageType as MessageType3 } from "@protobuf-ts/runtime";
97
+
2530
98
  // lib/google/protobuf/timestamp.ts
2531
- var Timestamp$Type = class extends MessageType {
99
+ import { WireType as WireType2 } from "@protobuf-ts/runtime";
100
+ import { UnknownFieldHandler as UnknownFieldHandler2 } from "@protobuf-ts/runtime";
101
+ import { reflectionMergePartial as reflectionMergePartial2 } from "@protobuf-ts/runtime";
102
+ import { typeofJsonValue } from "@protobuf-ts/runtime";
103
+ import { PbLong } from "@protobuf-ts/runtime";
104
+ import { MessageType as MessageType2 } from "@protobuf-ts/runtime";
105
+ var Timestamp$Type = class extends MessageType2 {
2532
106
  constructor() {
2533
107
  super("google.protobuf.Timestamp", [
2534
108
  {
@@ -2623,11 +197,11 @@ var Timestamp$Type = class extends MessageType {
2623
197
  message.seconds = "0";
2624
198
  message.nanos = 0;
2625
199
  if (value !== void 0)
2626
- reflectionMergePartial(this, message, value);
200
+ reflectionMergePartial2(this, message, value);
2627
201
  return message;
2628
202
  }
2629
203
  internalBinaryRead(reader, length, options, target) {
2630
- let message = target != null ? target : this.create(), end = reader.pos + length;
204
+ let message = target ?? this.create(), end = reader.pos + length;
2631
205
  while (reader.pos < end) {
2632
206
  let [fieldNo, wireType] = reader.tag();
2633
207
  switch (fieldNo) {
@@ -2645,26 +219,26 @@ var Timestamp$Type = class extends MessageType {
2645
219
  throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
2646
220
  let d = reader.skip(wireType);
2647
221
  if (u !== false)
2648
- (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
222
+ (u === true ? UnknownFieldHandler2.onRead : u)(this.typeName, message, fieldNo, wireType, d);
2649
223
  }
2650
224
  }
2651
225
  return message;
2652
226
  }
2653
227
  internalBinaryWrite(message, writer, options) {
2654
228
  if (message.seconds !== "0")
2655
- writer.tag(1, WireType.Varint).int64(message.seconds);
229
+ writer.tag(1, WireType2.Varint).int64(message.seconds);
2656
230
  if (message.nanos !== 0)
2657
- writer.tag(2, WireType.Varint).int32(message.nanos);
231
+ writer.tag(2, WireType2.Varint).int32(message.nanos);
2658
232
  let u = options.writeUnknownFields;
2659
233
  if (u !== false)
2660
- (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
234
+ (u == true ? UnknownFieldHandler2.onWrite : u)(this.typeName, message, writer);
2661
235
  return writer;
2662
236
  }
2663
237
  };
2664
238
  var Timestamp = new Timestamp$Type();
2665
239
 
2666
240
  // lib/events.ts
2667
- var TestStartEvent$Type = class extends MessageType {
241
+ var TestStartEvent$Type = class extends MessageType3 {
2668
242
  constructor() {
2669
243
  super("testsystem.events.TestStartEvent", [
2670
244
  {
@@ -2695,11 +269,11 @@ var TestStartEvent$Type = class extends MessageType {
2695
269
  message.testName = "";
2696
270
  message.metadata = {};
2697
271
  if (value !== void 0)
2698
- reflectionMergePartial(this, message, value);
272
+ reflectionMergePartial3(this, message, value);
2699
273
  return message;
2700
274
  }
2701
275
  internalBinaryRead(reader, length, options, target) {
2702
- let message = target != null ? target : this.create(), end = reader.pos + length;
276
+ let message = target ?? this.create(), end = reader.pos + length;
2703
277
  while (reader.pos < end) {
2704
278
  let [fieldNo, wireType] = reader.tag();
2705
279
  switch (fieldNo) {
@@ -2725,7 +299,7 @@ var TestStartEvent$Type = class extends MessageType {
2725
299
  throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
2726
300
  let d = reader.skip(wireType);
2727
301
  if (u !== false)
2728
- (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
302
+ (u === true ? UnknownFieldHandler3.onRead : u)(this.typeName, message, fieldNo, wireType, d);
2729
303
  }
2730
304
  }
2731
305
  return message;
@@ -2745,25 +319,25 @@ var TestStartEvent$Type = class extends MessageType {
2745
319
  throw new globalThis.Error("unknown map entry field for testsystem.events.TestStartEvent.metadata");
2746
320
  }
2747
321
  }
2748
- map[key != null ? key : ""] = val != null ? val : "";
322
+ map[key ?? ""] = val ?? "";
2749
323
  }
2750
324
  internalBinaryWrite(message, writer, options) {
2751
325
  if (message.testId !== "")
2752
- writer.tag(1, WireType.LengthDelimited).string(message.testId);
326
+ writer.tag(1, WireType3.LengthDelimited).string(message.testId);
2753
327
  if (message.testName !== "")
2754
- writer.tag(2, WireType.LengthDelimited).string(message.testName);
328
+ writer.tag(2, WireType3.LengthDelimited).string(message.testName);
2755
329
  if (message.startTime)
2756
- Timestamp.internalBinaryWrite(message.startTime, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
330
+ Timestamp.internalBinaryWrite(message.startTime, writer.tag(3, WireType3.LengthDelimited).fork(), options).join();
2757
331
  for (let k of globalThis.Object.keys(message.metadata))
2758
- writer.tag(4, WireType.LengthDelimited).fork().tag(1, WireType.LengthDelimited).string(k).tag(2, WireType.LengthDelimited).string(message.metadata[k]).join();
332
+ writer.tag(4, WireType3.LengthDelimited).fork().tag(1, WireType3.LengthDelimited).string(k).tag(2, WireType3.LengthDelimited).string(message.metadata[k]).join();
2759
333
  let u = options.writeUnknownFields;
2760
334
  if (u !== false)
2761
- (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
335
+ (u == true ? UnknownFieldHandler3.onWrite : u)(this.typeName, message, writer);
2762
336
  return writer;
2763
337
  }
2764
338
  };
2765
339
  var TestStartEvent = new TestStartEvent$Type();
2766
- var TestFinishEvent$Type = class extends MessageType {
340
+ var TestFinishEvent$Type = class extends MessageType3 {
2767
341
  constructor() {
2768
342
  super("testsystem.events.TestFinishEvent", [
2769
343
  {
@@ -2800,11 +374,11 @@ var TestFinishEvent$Type = class extends MessageType {
2800
374
  message.errorMessage = "";
2801
375
  message.stackTrace = "";
2802
376
  if (value !== void 0)
2803
- reflectionMergePartial(this, message, value);
377
+ reflectionMergePartial3(this, message, value);
2804
378
  return message;
2805
379
  }
2806
380
  internalBinaryRead(reader, length, options, target) {
2807
- let message = target != null ? target : this.create(), end = reader.pos + length;
381
+ let message = target ?? this.create(), end = reader.pos + length;
2808
382
  while (reader.pos < end) {
2809
383
  let [fieldNo, wireType] = reader.tag();
2810
384
  switch (fieldNo) {
@@ -2838,32 +412,32 @@ var TestFinishEvent$Type = class extends MessageType {
2838
412
  throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
2839
413
  let d = reader.skip(wireType);
2840
414
  if (u !== false)
2841
- (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
415
+ (u === true ? UnknownFieldHandler3.onRead : u)(this.typeName, message, fieldNo, wireType, d);
2842
416
  }
2843
417
  }
2844
418
  return message;
2845
419
  }
2846
420
  internalBinaryWrite(message, writer, options) {
2847
421
  if (message.testId !== "")
2848
- writer.tag(1, WireType.LengthDelimited).string(message.testId);
422
+ writer.tag(1, WireType3.LengthDelimited).string(message.testId);
2849
423
  if (message.status !== 0)
2850
- writer.tag(2, WireType.Varint).int32(message.status);
424
+ writer.tag(2, WireType3.Varint).int32(message.status);
2851
425
  if (message.endTime)
2852
- Timestamp.internalBinaryWrite(message.endTime, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
426
+ Timestamp.internalBinaryWrite(message.endTime, writer.tag(3, WireType3.LengthDelimited).fork(), options).join();
2853
427
  for (let i = 0; i < message.attachments.length; i++)
2854
- Attachment.internalBinaryWrite(message.attachments[i], writer.tag(4, WireType.LengthDelimited).fork(), options).join();
428
+ Attachment.internalBinaryWrite(message.attachments[i], writer.tag(4, WireType3.LengthDelimited).fork(), options).join();
2855
429
  if (message.errorMessage !== "")
2856
- writer.tag(5, WireType.LengthDelimited).string(message.errorMessage);
430
+ writer.tag(5, WireType3.LengthDelimited).string(message.errorMessage);
2857
431
  if (message.stackTrace !== "")
2858
- writer.tag(6, WireType.LengthDelimited).string(message.stackTrace);
432
+ writer.tag(6, WireType3.LengthDelimited).string(message.stackTrace);
2859
433
  let u = options.writeUnknownFields;
2860
434
  if (u !== false)
2861
- (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
435
+ (u == true ? UnknownFieldHandler3.onWrite : u)(this.typeName, message, writer);
2862
436
  return writer;
2863
437
  }
2864
438
  };
2865
439
  var TestFinishEvent = new TestFinishEvent$Type();
2866
- var TestStep$Type = class extends MessageType {
440
+ var TestStep$Type = class extends MessageType3 {
2867
441
  constructor() {
2868
442
  super("testsystem.events.TestStep", [
2869
443
  {
@@ -2884,11 +458,11 @@ var TestStep$Type = class extends MessageType {
2884
458
  message.status = 0;
2885
459
  message.attachments = [];
2886
460
  if (value !== void 0)
2887
- reflectionMergePartial(this, message, value);
461
+ reflectionMergePartial3(this, message, value);
2888
462
  return message;
2889
463
  }
2890
464
  internalBinaryRead(reader, length, options, target) {
2891
- let message = target != null ? target : this.create(), end = reader.pos + length;
465
+ let message = target ?? this.create(), end = reader.pos + length;
2892
466
  while (reader.pos < end) {
2893
467
  let [fieldNo, wireType] = reader.tag();
2894
468
  switch (fieldNo) {
@@ -2914,28 +488,28 @@ var TestStep$Type = class extends MessageType {
2914
488
  throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
2915
489
  let d = reader.skip(wireType);
2916
490
  if (u !== false)
2917
- (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
491
+ (u === true ? UnknownFieldHandler3.onRead : u)(this.typeName, message, fieldNo, wireType, d);
2918
492
  }
2919
493
  }
2920
494
  return message;
2921
495
  }
2922
496
  internalBinaryWrite(message, writer, options) {
2923
497
  if (message.description !== "")
2924
- writer.tag(1, WireType.LengthDelimited).string(message.description);
498
+ writer.tag(1, WireType3.LengthDelimited).string(message.description);
2925
499
  if (message.timestamp)
2926
- Timestamp.internalBinaryWrite(message.timestamp, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
500
+ Timestamp.internalBinaryWrite(message.timestamp, writer.tag(2, WireType3.LengthDelimited).fork(), options).join();
2927
501
  if (message.status !== 0)
2928
- writer.tag(3, WireType.Varint).int32(message.status);
502
+ writer.tag(3, WireType3.Varint).int32(message.status);
2929
503
  for (let i = 0; i < message.attachments.length; i++)
2930
- Attachment.internalBinaryWrite(message.attachments[i], writer.tag(4, WireType.LengthDelimited).fork(), options).join();
504
+ Attachment.internalBinaryWrite(message.attachments[i], writer.tag(4, WireType3.LengthDelimited).fork(), options).join();
2931
505
  let u = options.writeUnknownFields;
2932
506
  if (u !== false)
2933
- (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
507
+ (u == true ? UnknownFieldHandler3.onWrite : u)(this.typeName, message, writer);
2934
508
  return writer;
2935
509
  }
2936
510
  };
2937
511
  var TestStep = new TestStep$Type();
2938
- var TestStepEvent$Type = class extends MessageType {
512
+ var TestStepEvent$Type = class extends MessageType3 {
2939
513
  constructor() {
2940
514
  super("testsystem.events.TestStepEvent", [
2941
515
  {
@@ -2953,11 +527,11 @@ var TestStepEvent$Type = class extends MessageType {
2953
527
  message.testId = "";
2954
528
  message.steps = [];
2955
529
  if (value !== void 0)
2956
- reflectionMergePartial(this, message, value);
530
+ reflectionMergePartial3(this, message, value);
2957
531
  return message;
2958
532
  }
2959
533
  internalBinaryRead(reader, length, options, target) {
2960
- let message = target != null ? target : this.create(), end = reader.pos + length;
534
+ let message = target ?? this.create(), end = reader.pos + length;
2961
535
  while (reader.pos < end) {
2962
536
  let [fieldNo, wireType] = reader.tag();
2963
537
  switch (fieldNo) {
@@ -2975,25 +549,26 @@ var TestStepEvent$Type = class extends MessageType {
2975
549
  throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
2976
550
  let d = reader.skip(wireType);
2977
551
  if (u !== false)
2978
- (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
552
+ (u === true ? UnknownFieldHandler3.onRead : u)(this.typeName, message, fieldNo, wireType, d);
2979
553
  }
2980
554
  }
2981
555
  return message;
2982
556
  }
2983
557
  internalBinaryWrite(message, writer, options) {
2984
558
  if (message.testId !== "")
2985
- writer.tag(1, WireType.LengthDelimited).string(message.testId);
559
+ writer.tag(1, WireType3.LengthDelimited).string(message.testId);
2986
560
  for (let i = 0; i < message.steps.length; i++)
2987
- TestStep.internalBinaryWrite(message.steps[i], writer.tag(2, WireType.LengthDelimited).fork(), options).join();
561
+ TestStep.internalBinaryWrite(message.steps[i], writer.tag(2, WireType3.LengthDelimited).fork(), options).join();
2988
562
  let u = options.writeUnknownFields;
2989
563
  if (u !== false)
2990
- (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
564
+ (u == true ? UnknownFieldHandler3.onWrite : u)(this.typeName, message, writer);
2991
565
  return writer;
2992
566
  }
2993
567
  };
2994
568
  var TestStepEvent = new TestStepEvent$Type();
2995
569
 
2996
570
  // node_modules/@protobuf-ts/runtime-rpc/build/es2015/reflection-info.js
571
+ import { lowerCamelCase } from "@protobuf-ts/runtime";
2997
572
  function normalizeMethodInfo(method, service) {
2998
573
  var _a, _b, _c;
2999
574
  let m = method;
@@ -3016,6 +591,7 @@ var ServiceType = class {
3016
591
  };
3017
592
 
3018
593
  // node_modules/@protobuf-ts/runtime-rpc/build/es2015/rpc-interceptor.js
594
+ import { assertNever } from "@protobuf-ts/runtime";
3019
595
  function stackIntercept(kind, transport, method, options, input) {
3020
596
  var _a, _b, _c, _d;
3021
597
  if (kind == "unary") {
@@ -3054,7 +630,11 @@ function stackIntercept(kind, transport, method, options, input) {
3054
630
  }
3055
631
 
3056
632
  // lib/observer.ts
3057
- var Ack$Type = class extends MessageType {
633
+ import { WireType as WireType4 } from "@protobuf-ts/runtime";
634
+ import { UnknownFieldHandler as UnknownFieldHandler4 } from "@protobuf-ts/runtime";
635
+ import { reflectionMergePartial as reflectionMergePartial4 } from "@protobuf-ts/runtime";
636
+ import { MessageType as MessageType4 } from "@protobuf-ts/runtime";
637
+ var Ack$Type = class extends MessageType4 {
3058
638
  constructor() {
3059
639
  super("testsystem.observer.Ack", [
3060
640
  {
@@ -3078,11 +658,11 @@ var Ack$Type = class extends MessageType {
3078
658
  message.success = false;
3079
659
  message.message = "";
3080
660
  if (value !== void 0)
3081
- reflectionMergePartial(this, message, value);
661
+ reflectionMergePartial4(this, message, value);
3082
662
  return message;
3083
663
  }
3084
664
  internalBinaryRead(reader, length, options, target) {
3085
- let message = target != null ? target : this.create(), end = reader.pos + length;
665
+ let message = target ?? this.create(), end = reader.pos + length;
3086
666
  while (reader.pos < end) {
3087
667
  let [fieldNo, wireType] = reader.tag();
3088
668
  switch (fieldNo) {
@@ -3100,19 +680,19 @@ var Ack$Type = class extends MessageType {
3100
680
  throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
3101
681
  let d = reader.skip(wireType);
3102
682
  if (u !== false)
3103
- (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
683
+ (u === true ? UnknownFieldHandler4.onRead : u)(this.typeName, message, fieldNo, wireType, d);
3104
684
  }
3105
685
  }
3106
686
  return message;
3107
687
  }
3108
688
  internalBinaryWrite(message, writer, options) {
3109
689
  if (message.success !== false)
3110
- writer.tag(1, WireType.Varint).bool(message.success);
690
+ writer.tag(1, WireType4.Varint).bool(message.success);
3111
691
  if (message.message !== "")
3112
- writer.tag(2, WireType.LengthDelimited).string(message.message);
692
+ writer.tag(2, WireType4.LengthDelimited).string(message.message);
3113
693
  let u = options.writeUnknownFields;
3114
694
  if (u !== false)
3115
- (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
695
+ (u == true ? UnknownFieldHandler4.onWrite : u)(this.typeName, message, writer);
3116
696
  return writer;
3117
697
  }
3118
698
  };
@@ -3162,7 +742,6 @@ export {
3162
742
  TestStartEvent,
3163
743
  TestStatus,
3164
744
  TestStep,
3165
- TestStepEvent,
3166
- Timestamp
745
+ TestStepEvent
3167
746
  };
3168
747
  //# sourceMappingURL=index.mjs.map