@bare-ts/lib 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,1112 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+
29
+ // src/index.ts
30
+ var src_exports = {};
31
+ __export(src_exports, {
32
+ BareError: () => BareError,
33
+ ByteCursor: () => ByteCursor,
34
+ Config: () => Config,
35
+ decodeBool: () => decodeBool,
36
+ decodeData: () => decodeData,
37
+ decodeF32: () => decodeF32,
38
+ decodeF32Array: () => decodeF32Array,
39
+ decodeF32FixedArray: () => decodeF32FixedArray,
40
+ decodeF64: () => decodeF64,
41
+ decodeF64Array: () => decodeF64Array,
42
+ decodeF64FixedArray: () => decodeF64FixedArray,
43
+ decodeFixedData: () => decodeFixedData,
44
+ decodeI16: () => decodeI16,
45
+ decodeI16Array: () => decodeI16Array,
46
+ decodeI16FixedArray: () => decodeI16FixedArray,
47
+ decodeI32: () => decodeI32,
48
+ decodeI32Array: () => decodeI32Array,
49
+ decodeI32FixedArray: () => decodeI32FixedArray,
50
+ decodeI64: () => decodeI64,
51
+ decodeI64Array: () => decodeI64Array,
52
+ decodeI64FixedArray: () => decodeI64FixedArray,
53
+ decodeI64Safe: () => decodeI64Safe,
54
+ decodeI8: () => decodeI8,
55
+ decodeI8Array: () => decodeI8Array,
56
+ decodeI8FixedArray: () => decodeI8FixedArray,
57
+ decodeInt: () => decodeInt,
58
+ decodeIntSafe: () => decodeIntSafe,
59
+ decodeString: () => decodeString,
60
+ decodeU16: () => decodeU16,
61
+ decodeU16Array: () => decodeU16Array,
62
+ decodeU16FixedArray: () => decodeU16FixedArray,
63
+ decodeU32: () => decodeU32,
64
+ decodeU32Array: () => decodeU32Array,
65
+ decodeU32FixedArray: () => decodeU32FixedArray,
66
+ decodeU64: () => decodeU64,
67
+ decodeU64Array: () => decodeU64Array,
68
+ decodeU64FixedArray: () => decodeU64FixedArray,
69
+ decodeU64Safe: () => decodeU64Safe,
70
+ decodeU8: () => decodeU8,
71
+ decodeU8Array: () => decodeU8Array,
72
+ decodeU8ClampedArray: () => decodeU8ClampedArray,
73
+ decodeU8ClampedFixedArray: () => decodeU8ClampedFixedArray,
74
+ decodeU8FixedArray: () => decodeU8FixedArray,
75
+ decodeUint: () => decodeUint,
76
+ decodeUintSafe: () => decodeUintSafe,
77
+ decodeVoid: () => decodeVoid,
78
+ encodeBool: () => encodeBool,
79
+ encodeData: () => encodeData,
80
+ encodeF32: () => encodeF32,
81
+ encodeF32Array: () => encodeF32Array,
82
+ encodeF32FixedArray: () => encodeF32FixedArray,
83
+ encodeF64: () => encodeF64,
84
+ encodeF64Array: () => encodeF64Array,
85
+ encodeF64FixedArray: () => encodeF64FixedArray,
86
+ encodeFixedData: () => encodeFixedData,
87
+ encodeI16: () => encodeI16,
88
+ encodeI16Array: () => encodeI16Array,
89
+ encodeI16FixedArray: () => encodeI16FixedArray,
90
+ encodeI32: () => encodeI32,
91
+ encodeI32Array: () => encodeI32Array,
92
+ encodeI32FixedArray: () => encodeI32FixedArray,
93
+ encodeI64: () => encodeI64,
94
+ encodeI64Array: () => encodeI64Array,
95
+ encodeI64FixedArray: () => encodeI64FixedArray,
96
+ encodeI64Safe: () => encodeI64Safe,
97
+ encodeI8: () => encodeI8,
98
+ encodeI8Array: () => encodeI8Array,
99
+ encodeI8FixedArray: () => encodeI8FixedArray,
100
+ encodeInt: () => encodeInt,
101
+ encodeIntSafe: () => encodeIntSafe,
102
+ encodeString: () => encodeString,
103
+ encodeU16: () => encodeU16,
104
+ encodeU16Array: () => encodeU16Array,
105
+ encodeU16FixedArray: () => encodeU16FixedArray,
106
+ encodeU32: () => encodeU32,
107
+ encodeU32Array: () => encodeU32Array,
108
+ encodeU32FixedArray: () => encodeU32FixedArray,
109
+ encodeU64: () => encodeU64,
110
+ encodeU64Array: () => encodeU64Array,
111
+ encodeU64FixedArray: () => encodeU64FixedArray,
112
+ encodeU64Safe: () => encodeU64Safe,
113
+ encodeU8: () => encodeU8,
114
+ encodeU8Array: () => encodeU8Array,
115
+ encodeU8ClampedArray: () => encodeU8ClampedArray,
116
+ encodeU8ClampedFixedArray: () => encodeU8ClampedFixedArray,
117
+ encodeU8FixedArray: () => encodeU8FixedArray,
118
+ encodeUint: () => encodeUint,
119
+ encodeUintSafe: () => encodeUintSafe,
120
+ encodeVoid: () => encodeVoid
121
+ });
122
+
123
+ // src/codec/u8-array.ts
124
+ var import_assert4 = __toESM(require("assert"), 1);
125
+
126
+ // src/codec/primitive.ts
127
+ var import_assert3 = __toESM(require("assert"), 1);
128
+
129
+ // src/core/bare-error.ts
130
+ var BareError = class extends Error {
131
+ constructor(offset, issue, opts) {
132
+ super(`(byte:${offset}) ${issue}`);
133
+ this.name = "BareError";
134
+ this.issue = issue;
135
+ this.offset = offset;
136
+ this.cause = opts == null ? void 0 : opts.cause;
137
+ }
138
+ };
139
+
140
+ // src/core/config.ts
141
+ var import_assert = __toESM(require("assert"), 1);
142
+
143
+ // src/util/validator.ts
144
+ function isI8(val) {
145
+ return val === val << 24 >> 24;
146
+ }
147
+ function isI16(val) {
148
+ return val === val << 16 >> 16;
149
+ }
150
+ function isI32(val) {
151
+ return val === (val | 0);
152
+ }
153
+ function isI64(val) {
154
+ return val === BigInt.asIntN(64, val);
155
+ }
156
+ function isSafeU64(val) {
157
+ return Number.isSafeInteger(val) && val >= 0;
158
+ }
159
+ function isU8(val) {
160
+ return val === (val & 255);
161
+ }
162
+ function isU16(val) {
163
+ return val === (val & 65535);
164
+ }
165
+ function isU32(val) {
166
+ return val === val >>> 0;
167
+ }
168
+ function isU64(val) {
169
+ return val === BigInt.asUintN(64, val);
170
+ }
171
+
172
+ // src/core/config.ts
173
+ var TOO_LARGE_NUMBER = "too large number";
174
+ var initialBufferLength = 1024;
175
+ var maxBufferLength = 1024 * 1024 * 32;
176
+ var textDecoderThreshold = 256;
177
+ var textEncoderThreshold = 256;
178
+ function Config(part) {
179
+ const config = Object.assign({
180
+ initialBufferLength,
181
+ maxBufferLength,
182
+ textDecoderThreshold,
183
+ textEncoderThreshold
184
+ }, part);
185
+ (0, import_assert.default)(isU32(config.initialBufferLength), TOO_LARGE_NUMBER);
186
+ (0, import_assert.default)(isU32(config.maxBufferLength), TOO_LARGE_NUMBER);
187
+ (0, import_assert.default)(isU32(config.textDecoderThreshold), TOO_LARGE_NUMBER);
188
+ (0, import_assert.default)(isU32(config.textEncoderThreshold), TOO_LARGE_NUMBER);
189
+ (0, import_assert.default)(config.initialBufferLength <= config.maxBufferLength, "initialBufferLength must be lower than or equal to maxBufferLength");
190
+ return config;
191
+ }
192
+
193
+ // src/core/byte-cursor.ts
194
+ var import_assert2 = __toESM(require("assert"), 1);
195
+ var TOO_LARGE_BUFFER = "too large buffer";
196
+ var ByteCursor = class {
197
+ constructor(bytes, config) {
198
+ this.config = config;
199
+ this.offset = 0;
200
+ this.view = bytes instanceof Uint8Array ? new DataView(bytes.buffer, bytes.byteOffset, bytes.length) : new DataView(bytes);
201
+ if (this.view.byteLength > config.maxBufferLength) {
202
+ throw new BareError(0, TOO_LARGE_BUFFER);
203
+ }
204
+ }
205
+ check(min) {
206
+ if (this.offset + min > this.view.byteLength) {
207
+ throw new BareError(this.offset, "missing bytes");
208
+ }
209
+ }
210
+ reserve(min) {
211
+ const { config, offset, view } = this;
212
+ if (offset + min > view.byteLength) {
213
+ const bytes = new Uint8Array(view.buffer);
214
+ const minExtraLength = min + offset - view.byteLength;
215
+ (0, import_assert2.default)(bytes.length === view.byteOffset + view.byteLength, "un-growable buffer");
216
+ (0, import_assert2.default)(bytes.length + minExtraLength <= config.maxBufferLength, TOO_LARGE_BUFFER);
217
+ const newLen = Math.min(bytes.length + Math.max(minExtraLength, bytes.length), config.maxBufferLength);
218
+ const newBytes = new Uint8Array(newLen);
219
+ newBytes.set(bytes);
220
+ this.view = new DataView(newBytes.buffer, view.byteOffset);
221
+ }
222
+ }
223
+ read(len) {
224
+ this.check(len);
225
+ const bufferOffset = this.view.byteOffset + this.offset;
226
+ this.offset += len;
227
+ return new Uint8Array(this.view.buffer, bufferOffset, len);
228
+ }
229
+ write(bytes) {
230
+ const len = bytes.length;
231
+ if (len !== 0) {
232
+ this.reserve(len);
233
+ const writableArea = new Uint8Array(this.view.buffer, this.offset, len);
234
+ writableArea.set(bytes);
235
+ this.offset += len;
236
+ }
237
+ }
238
+ };
239
+
240
+ // src/codec/primitive.ts
241
+ var NAN_NOT_ALLOWED = "NaN is not allowed";
242
+ var NON_CANONICAL_REPRESENTATION = "must be canonical";
243
+ var TOO_LARGE_NUMBER2 = "too large number";
244
+ function decodeBool(bc) {
245
+ const val = decodeU8(bc);
246
+ if (val > 1) {
247
+ bc.offset--;
248
+ throw new BareError(bc.offset, "a bool must be equal to 0 or 1");
249
+ }
250
+ return val !== 0;
251
+ }
252
+ function encodeBool(bc, x) {
253
+ encodeU8(bc, x ? 1 : 0);
254
+ }
255
+ function decodeF32(bc) {
256
+ bc.check(4);
257
+ const result = bc.view.getFloat32(bc.offset, true);
258
+ if (Number.isNaN(result)) {
259
+ throw new BareError(bc.offset, NAN_NOT_ALLOWED);
260
+ }
261
+ bc.offset += 4;
262
+ return result;
263
+ }
264
+ function encodeF32(bc, x) {
265
+ (0, import_assert3.default)(!Number.isNaN(x), NAN_NOT_ALLOWED);
266
+ bc.reserve(4);
267
+ bc.view.setFloat32(bc.offset, x, true);
268
+ (0, import_assert3.default)(Math.abs(bc.view.getFloat32(bc.offset, true) - x) <= Number.EPSILON, TOO_LARGE_NUMBER2);
269
+ bc.offset += 4;
270
+ }
271
+ function decodeF64(bc) {
272
+ bc.check(8);
273
+ const result = bc.view.getFloat64(bc.offset, true);
274
+ if (Number.isNaN(result)) {
275
+ throw new BareError(bc.offset, NAN_NOT_ALLOWED);
276
+ }
277
+ bc.offset += 8;
278
+ return result;
279
+ }
280
+ function encodeF64(bc, x) {
281
+ (0, import_assert3.default)(!Number.isNaN(x), NAN_NOT_ALLOWED);
282
+ bc.reserve(8);
283
+ bc.view.setFloat64(bc.offset, x, true);
284
+ bc.offset += 8;
285
+ }
286
+ function decodeI8(bc) {
287
+ bc.check(1);
288
+ return bc.view.getInt8(bc.offset++);
289
+ }
290
+ function encodeI8(bc, x) {
291
+ (0, import_assert3.default)(isI8(x), TOO_LARGE_NUMBER2);
292
+ bc.reserve(1);
293
+ bc.view.setInt8(bc.offset++, x);
294
+ }
295
+ function decodeI16(bc) {
296
+ bc.check(2);
297
+ const result = bc.view.getInt16(bc.offset, true);
298
+ bc.offset += 2;
299
+ return result;
300
+ }
301
+ function encodeI16(bc, x) {
302
+ (0, import_assert3.default)(isI16(x), TOO_LARGE_NUMBER2);
303
+ bc.reserve(2);
304
+ bc.view.setInt16(bc.offset, x, true);
305
+ bc.offset += 2;
306
+ }
307
+ function decodeI32(bc) {
308
+ bc.check(4);
309
+ const result = bc.view.getInt32(bc.offset, true);
310
+ bc.offset += 4;
311
+ return result;
312
+ }
313
+ function encodeI32(bc, x) {
314
+ (0, import_assert3.default)(isI32(x), TOO_LARGE_NUMBER2);
315
+ bc.reserve(4);
316
+ bc.view.setInt32(bc.offset, x, true);
317
+ bc.offset += 4;
318
+ }
319
+ function decodeI64(bc) {
320
+ bc.check(8);
321
+ const result = bc.view.getBigInt64(bc.offset, true);
322
+ bc.offset += 8;
323
+ return result;
324
+ }
325
+ function encodeI64(bc, x) {
326
+ (0, import_assert3.default)(isI64(x), TOO_LARGE_NUMBER2);
327
+ bc.reserve(8);
328
+ bc.view.setBigInt64(bc.offset, x, true);
329
+ bc.offset += 8;
330
+ }
331
+ function decodeI64Safe(bc) {
332
+ const result = decodeU32(bc) + decodeI32(bc) * 4294967296;
333
+ if (!Number.isSafeInteger(result)) {
334
+ bc.offset -= 8;
335
+ throw new BareError(bc.offset, TOO_LARGE_NUMBER2);
336
+ }
337
+ return result;
338
+ }
339
+ function encodeI64Safe(bc, x) {
340
+ (0, import_assert3.default)(Number.isSafeInteger(x), TOO_LARGE_NUMBER2);
341
+ const lowest32 = x >>> 0;
342
+ encodeU32(bc, lowest32);
343
+ let highest32 = x / 4294967296 | 0;
344
+ if (x < 0) {
345
+ highest32 = ~Math.abs(highest32) >>> 0;
346
+ if (lowest32 === 0) {
347
+ highest32++;
348
+ }
349
+ }
350
+ encodeU32(bc, highest32);
351
+ }
352
+ function decodeInt(bc) {
353
+ const zigZag = decodeUint(bc);
354
+ return zigZag >> BigInt(1) ^ -(zigZag & BigInt(1));
355
+ }
356
+ function encodeInt(bc, x) {
357
+ (0, import_assert3.default)(isI64(x), TOO_LARGE_NUMBER2);
358
+ const zigZag = x >> BigInt(63) ^ x << BigInt(1);
359
+ encodeUint(bc, zigZag);
360
+ }
361
+ var INT_SAFE_MAX_BYTE_COUNT = 8;
362
+ function decodeIntSafe(bc) {
363
+ const firstByte = decodeU8(bc);
364
+ let result = (firstByte & 127) >> 1;
365
+ if (firstByte >= 128) {
366
+ let shiftMul = 64;
367
+ let byteCount = 1;
368
+ let byte;
369
+ do {
370
+ byte = decodeU8(bc);
371
+ result += (byte & 127) * shiftMul;
372
+ shiftMul *= 128;
373
+ byteCount++;
374
+ } while (byte >= 128 && byteCount < INT_SAFE_MAX_BYTE_COUNT);
375
+ if (byte === 0) {
376
+ bc.offset -= byteCount - 1;
377
+ throw new BareError(bc.offset, "must be canonical");
378
+ }
379
+ if (byteCount === INT_SAFE_MAX_BYTE_COUNT && (byte > 31 || firstByte === 255)) {
380
+ bc.offset -= byteCount - 1;
381
+ throw new BareError(bc.offset, TOO_LARGE_NUMBER2);
382
+ }
383
+ }
384
+ const isNeg = (firstByte & 1) === 1;
385
+ if (isNeg) {
386
+ result = -result - 1;
387
+ }
388
+ return result;
389
+ }
390
+ function encodeIntSafe(bc, x) {
391
+ (0, import_assert3.default)(Number.isSafeInteger(x), TOO_LARGE_NUMBER2);
392
+ const sign = x < 0 ? 1 : 0;
393
+ if (x < 0) {
394
+ x = -(x + 1);
395
+ }
396
+ const firstByte = (x & 63) << 1 | sign;
397
+ x = Math.floor(x / 64);
398
+ if (x > 0) {
399
+ encodeU8(bc, 128 | firstByte);
400
+ encodeUintSafe(bc, x);
401
+ } else {
402
+ encodeU8(bc, firstByte);
403
+ }
404
+ }
405
+ function decodeU8(bc) {
406
+ bc.check(1);
407
+ return bc.view.getUint8(bc.offset++);
408
+ }
409
+ function encodeU8(bc, x) {
410
+ (0, import_assert3.default)(isU8(x), TOO_LARGE_NUMBER2);
411
+ bc.reserve(1);
412
+ bc.view.setUint8(bc.offset++, x);
413
+ }
414
+ function decodeU16(bc) {
415
+ bc.check(2);
416
+ const result = bc.view.getUint16(bc.offset, true);
417
+ bc.offset += 2;
418
+ return result;
419
+ }
420
+ function encodeU16(bc, x) {
421
+ (0, import_assert3.default)(isU16(x), TOO_LARGE_NUMBER2);
422
+ bc.reserve(2);
423
+ bc.view.setUint16(bc.offset, x, true);
424
+ bc.offset += 2;
425
+ }
426
+ function decodeU32(bc) {
427
+ bc.check(4);
428
+ const result = bc.view.getUint32(bc.offset, true);
429
+ bc.offset += 4;
430
+ return result;
431
+ }
432
+ function encodeU32(bc, x) {
433
+ (0, import_assert3.default)(isU32(x), TOO_LARGE_NUMBER2);
434
+ bc.reserve(4);
435
+ bc.view.setUint32(bc.offset, x, true);
436
+ bc.offset += 4;
437
+ }
438
+ function decodeU64(bc) {
439
+ bc.check(8);
440
+ const result = bc.view.getBigUint64(bc.offset, true);
441
+ bc.offset += 8;
442
+ return result;
443
+ }
444
+ function encodeU64(bc, x) {
445
+ (0, import_assert3.default)(isU64(x), TOO_LARGE_NUMBER2);
446
+ bc.reserve(8);
447
+ bc.view.setBigUint64(bc.offset, x, true);
448
+ bc.offset += 8;
449
+ }
450
+ function decodeU64Safe(bc) {
451
+ const result = decodeU32(bc) + decodeU32(bc) * 4294967296;
452
+ if (!isSafeU64(result)) {
453
+ bc.offset -= 8;
454
+ throw new BareError(bc.offset, TOO_LARGE_NUMBER2);
455
+ }
456
+ return result;
457
+ }
458
+ function encodeU64Safe(bc, x) {
459
+ (0, import_assert3.default)(isSafeU64(x), TOO_LARGE_NUMBER2);
460
+ encodeU32(bc, x >>> 0);
461
+ encodeU32(bc, x / 4294967296 >>> 0);
462
+ }
463
+ var UINT_MAX_BYTE_COUNT = 10;
464
+ function decodeUint(bc) {
465
+ let byteCount = 0;
466
+ let byte;
467
+ let low = 0;
468
+ let shiftMul = 1;
469
+ do {
470
+ byte = decodeU8(bc);
471
+ low += (byte & 127) * shiftMul;
472
+ shiftMul *= 128;
473
+ byteCount++;
474
+ } while (byte >= 128 && byteCount < 7);
475
+ let height = 0;
476
+ shiftMul = 1;
477
+ while (byte >= 128 && byteCount < UINT_MAX_BYTE_COUNT) {
478
+ byte = decodeU8(bc);
479
+ height += (byte & 127) * shiftMul;
480
+ shiftMul *= 128;
481
+ byteCount++;
482
+ }
483
+ if (byteCount !== 1 && byte === 0 || byteCount === UINT_MAX_BYTE_COUNT && byte > 1) {
484
+ bc.offset -= byteCount;
485
+ throw new BareError(bc.offset, NON_CANONICAL_REPRESENTATION);
486
+ }
487
+ return BigInt(low) + (BigInt(height) << BigInt(7 * 7));
488
+ }
489
+ function encodeUint(bc, x) {
490
+ (0, import_assert3.default)(isU64(x), TOO_LARGE_NUMBER2);
491
+ let tmp = Number(BigInt.asUintN(7 * 7, x));
492
+ let rest = Number(x >> BigInt(7 * 7));
493
+ let byteCount = 0;
494
+ while (tmp >= 128 || rest !== 0) {
495
+ encodeU8(bc, 128 | tmp & 127);
496
+ tmp = Math.floor(tmp / 128);
497
+ byteCount++;
498
+ if (byteCount === 7) {
499
+ tmp = rest;
500
+ rest = 0;
501
+ }
502
+ }
503
+ encodeU8(bc, tmp);
504
+ }
505
+ var UINT_SAFE_MAX_BYTE_COUNT = 8;
506
+ function decodeUintSafe(bc) {
507
+ let result = 0;
508
+ let shiftMul = 1;
509
+ let byteCount = 0;
510
+ let byte;
511
+ do {
512
+ byte = decodeU8(bc);
513
+ result += (byte & 127) * shiftMul;
514
+ shiftMul *= 128;
515
+ byteCount++;
516
+ } while (byte >= 128 && byteCount < UINT_SAFE_MAX_BYTE_COUNT);
517
+ if (byteCount !== 1 && byte === 0) {
518
+ bc.offset -= byteCount - 1;
519
+ throw new BareError(bc.offset - byteCount + 1, NON_CANONICAL_REPRESENTATION);
520
+ }
521
+ if (byteCount === UINT_SAFE_MAX_BYTE_COUNT && byte > 15) {
522
+ bc.offset -= byteCount - 1;
523
+ throw new BareError(bc.offset, TOO_LARGE_NUMBER2);
524
+ }
525
+ return result;
526
+ }
527
+ function encodeUintSafe(bc, x) {
528
+ (0, import_assert3.default)(isSafeU64(x), TOO_LARGE_NUMBER2);
529
+ while (x >= 128) {
530
+ encodeU8(bc, 128 | x & 127);
531
+ x = Math.floor(x / 128);
532
+ }
533
+ encodeU8(bc, x);
534
+ }
535
+ function decodeVoid(_dc) {
536
+ return void 0;
537
+ }
538
+ function encodeVoid(_dc, _x) {
539
+ }
540
+
541
+ // src/codec/u8-array.ts
542
+ function decodeU8Array(bc) {
543
+ const len = decodeUintSafe(bc);
544
+ return bc.read(len).slice();
545
+ }
546
+ function encodeU8Array(bc, x) {
547
+ encodeUintSafe(bc, x.length);
548
+ bc.write(x);
549
+ }
550
+ function decodeU8FixedArray(bc, len) {
551
+ return bc.read(len).slice();
552
+ }
553
+ function encodeU8FixedArray(bc, x, len) {
554
+ (0, import_assert4.default)(x.length === len);
555
+ bc.write(x);
556
+ }
557
+
558
+ // src/codec/data.ts
559
+ function decodeData(bc) {
560
+ return decodeU8Array(bc).buffer;
561
+ }
562
+ function encodeData(bc, x) {
563
+ encodeU8Array(bc, new Uint8Array(x));
564
+ }
565
+ function decodeFixedData(bc, len) {
566
+ return decodeU8FixedArray(bc, len).buffer;
567
+ }
568
+ function encodeFixedData(bc, x, len) {
569
+ encodeU8FixedArray(bc, new Uint8Array(x), len);
570
+ }
571
+
572
+ // src/codec/float-array.ts
573
+ var import_assert5 = __toESM(require("assert"), 1);
574
+
575
+ // src/util/util.ts
576
+ var IS_LITTLE_ENDIAN_PLATFORM = new DataView(Uint16Array.of(1).buffer).getUint8(0) === 1;
577
+
578
+ // src/codec/float-array.ts
579
+ var NAN_NOT_ALLOWED2 = "NaN is not allowed";
580
+ var decodeF32FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? decodeF32FixedArrayLE : decodeF32FixedArrayBE;
581
+ function decodeF32FixedArrayLE(bc, len) {
582
+ const byteLen = len * 4;
583
+ const result = new Float32Array(decodeFixedData(bc, byteLen));
584
+ if (result.some(Number.isNaN)) {
585
+ throw new BareError(bc.offset, NAN_NOT_ALLOWED2);
586
+ }
587
+ return result;
588
+ }
589
+ function decodeF32FixedArrayBE(bc, len) {
590
+ bc.check(len * 4);
591
+ const result = new Float32Array(len);
592
+ for (let i = 0; i < len; i++)
593
+ result[i] = decodeF32(bc);
594
+ return result;
595
+ }
596
+ var encodeF32FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? encodeF32FixedArrayLE : encodeF32FixedArrayBE;
597
+ function encodeF32FixedArrayLE(bc, x, len) {
598
+ (0, import_assert5.default)(x.length === len);
599
+ (0, import_assert5.default)(!x.every(Number.isNaN), NAN_NOT_ALLOWED2);
600
+ bc.write(new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
601
+ }
602
+ function encodeF32FixedArrayBE(bc, val, len) {
603
+ (0, import_assert5.default)(val.length === len);
604
+ bc.reserve(val.length * 4);
605
+ for (let i = 0; i < val.length; i++)
606
+ encodeF32(bc, val[i]);
607
+ }
608
+ function decodeF32Array(bc) {
609
+ return decodeF32FixedArray(bc, decodeUintSafe(bc));
610
+ }
611
+ function encodeF32Array(bc, x) {
612
+ encodeUintSafe(bc, x.length);
613
+ if (x.length !== 0) {
614
+ encodeF32FixedArray(bc, x, x.length);
615
+ }
616
+ }
617
+ var decodeF64FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? decodeF64FixedArrayLE : decodeF64FixedArrayBE;
618
+ function decodeF64FixedArrayLE(bc, len) {
619
+ const byteLen = len * 8;
620
+ const result = new Float64Array(decodeFixedData(bc, byteLen));
621
+ if (result.some(Number.isNaN)) {
622
+ throw new BareError(bc.offset, NAN_NOT_ALLOWED2);
623
+ }
624
+ return result;
625
+ }
626
+ function decodeF64FixedArrayBE(bc, len) {
627
+ bc.check(len * 8);
628
+ const result = new Float64Array(len);
629
+ for (let i = 0; i < len; i++)
630
+ result[i] = decodeF64(bc);
631
+ return result;
632
+ }
633
+ var encodeF64FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? encodeF64FixedArrayLE : encodeF64FixedArrayBE;
634
+ function encodeF64FixedArrayLE(bc, x, len) {
635
+ (0, import_assert5.default)(x.length === len);
636
+ (0, import_assert5.default)(!x.every(Number.isNaN), NAN_NOT_ALLOWED2);
637
+ bc.write(new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
638
+ }
639
+ function encodeF64FixedArrayBE(bc, x, len) {
640
+ (0, import_assert5.default)(x.length === len);
641
+ bc.reserve(x.length * 8);
642
+ for (let i = 0; i < x.length; i++)
643
+ encodeF64(bc, x[i]);
644
+ }
645
+ function decodeF64Array(bc) {
646
+ return decodeF64FixedArray(bc, decodeUintSafe(bc));
647
+ }
648
+ function encodeF64Array(bc, x) {
649
+ encodeUintSafe(bc, x.length);
650
+ if (x.length !== 0) {
651
+ encodeF64FixedArray(bc, x, x.length);
652
+ }
653
+ }
654
+
655
+ // src/codec/i16-array.ts
656
+ var import_assert6 = __toESM(require("assert"), 1);
657
+ var I16_BYTE_COUNT = 2;
658
+ var decodeI16FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? decodeI16FixedArrayLE : decodeI16FixedArrayBE;
659
+ function decodeI16Array(bc) {
660
+ return decodeI16FixedArray(bc, decodeUintSafe(bc));
661
+ }
662
+ function decodeI16FixedArrayLE(bc, len) {
663
+ const byteCount = len * I16_BYTE_COUNT;
664
+ return new Int16Array(decodeFixedData(bc, byteCount));
665
+ }
666
+ function decodeI16FixedArrayBE(bc, len) {
667
+ bc.check(len * I16_BYTE_COUNT);
668
+ const result = new Int16Array(len);
669
+ for (let i = 0; i < len; i++)
670
+ result[i] = decodeI16(bc);
671
+ return result;
672
+ }
673
+ var encodeI16FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? encodeI16FixedArrayLE : encodeI16FixedArrayBE;
674
+ function encodeI16Array(bc, x) {
675
+ encodeUintSafe(bc, x.length);
676
+ if (x.length !== 0) {
677
+ encodeI16FixedArray(bc, x, x.length);
678
+ }
679
+ }
680
+ function encodeI16FixedArrayLE(bc, x, len) {
681
+ (0, import_assert6.default)(x.length === len);
682
+ bc.write(new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
683
+ }
684
+ function encodeI16FixedArrayBE(bc, x, len) {
685
+ (0, import_assert6.default)(x.length === len);
686
+ bc.reserve(x.length * I16_BYTE_COUNT);
687
+ for (let i = 0; i < x.length; i++)
688
+ encodeI16(bc, x[i]);
689
+ }
690
+
691
+ // src/codec/i32-array.ts
692
+ var import_assert7 = __toESM(require("assert"), 1);
693
+ var I32_BYTE_COUNT = 4;
694
+ var decodeI32FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? decodeI32FixedArrayLE : decodeI32FixedArrayBE;
695
+ function decodeI32Array(bc) {
696
+ return decodeI32FixedArray(bc, decodeUintSafe(bc));
697
+ }
698
+ function decodeI32FixedArrayLE(bc, len) {
699
+ const byteCount = len * I32_BYTE_COUNT;
700
+ return new Int32Array(decodeFixedData(bc, byteCount));
701
+ }
702
+ function decodeI32FixedArrayBE(bc, len) {
703
+ bc.check(len * I32_BYTE_COUNT);
704
+ const result = new Int32Array(len);
705
+ for (let i = 0; i < len; i++)
706
+ result[i] = decodeI32(bc);
707
+ return result;
708
+ }
709
+ var encodeI32FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? encodeI32FixedArrayLE : encodeI32FixedArrayBE;
710
+ function encodeI32Array(bc, x) {
711
+ encodeUintSafe(bc, x.length);
712
+ if (x.length !== 0) {
713
+ encodeI32FixedArray(bc, x, x.length);
714
+ }
715
+ }
716
+ function encodeI32FixedArrayLE(bc, x, len) {
717
+ (0, import_assert7.default)(x.length === len);
718
+ bc.write(new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
719
+ }
720
+ function encodeI32FixedArrayBE(bc, x, len) {
721
+ (0, import_assert7.default)(x.length === len);
722
+ bc.reserve(x.length * I32_BYTE_COUNT);
723
+ for (let i = 0; i < x.length; i++)
724
+ encodeI32(bc, x[i]);
725
+ }
726
+
727
+ // src/codec/i64-array.ts
728
+ var import_assert8 = __toESM(require("assert"), 1);
729
+ var I64_BYTE_COUNT = 8;
730
+ var decodeI64FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? decodeI64FixedArrayLE : decodeI64FixedArrayBE;
731
+ function decodeI64Array(bc) {
732
+ return decodeI64FixedArray(bc, decodeUintSafe(bc));
733
+ }
734
+ function decodeI64FixedArrayLE(bc, len) {
735
+ const byteCount = len * I64_BYTE_COUNT;
736
+ return new BigInt64Array(decodeFixedData(bc, byteCount));
737
+ }
738
+ function decodeI64FixedArrayBE(bc, len) {
739
+ bc.check(len * I64_BYTE_COUNT);
740
+ const result = new BigInt64Array(len);
741
+ for (let i = 0; i < len; i++)
742
+ result[i] = decodeI64(bc);
743
+ return result;
744
+ }
745
+ var encodeI64FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? encodeI64FixedArrayLE : encodeI64FixedArrayBE;
746
+ function encodeI64Array(bc, x) {
747
+ encodeUintSafe(bc, x.length);
748
+ if (x.length !== 0) {
749
+ encodeI64FixedArray(bc, x, x.length);
750
+ }
751
+ }
752
+ function encodeI64FixedArrayLE(bc, x, len) {
753
+ (0, import_assert8.default)(x.length === len);
754
+ bc.write(new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
755
+ }
756
+ function encodeI64FixedArrayBE(bc, x, len) {
757
+ (0, import_assert8.default)(x.length === len);
758
+ bc.reserve(x.length * I64_BYTE_COUNT);
759
+ for (let i = 0; i < x.length; i++)
760
+ encodeI64(bc, x[i]);
761
+ }
762
+
763
+ // src/codec/i8-array.ts
764
+ function decodeI8Array(bc) {
765
+ return decodeI8FixedArray(bc, decodeUintSafe(bc));
766
+ }
767
+ function encodeI8Array(bc, x) {
768
+ encodeUintSafe(bc, x.length);
769
+ encodeI8FixedArray(bc, x, x.length);
770
+ }
771
+ function decodeI8FixedArray(bc, len) {
772
+ return new Int8Array(decodeFixedData(bc, len));
773
+ }
774
+ function encodeI8FixedArray(bc, x, len) {
775
+ encodeU8FixedArray(bc, new Uint8Array(x.buffer, x.byteOffset, x.byteLength), len);
776
+ }
777
+
778
+ // src/codec/string.ts
779
+ function decodeString(bc) {
780
+ const strBytesLen = decodeUintSafe(bc);
781
+ const strBytes = bc.read(strBytesLen);
782
+ try {
783
+ return strBytesLen < bc.config.textDecoderThreshold ? decodeUtf8Js(strBytes) : UTF8_DECODER.decode(strBytes);
784
+ } catch (cause) {
785
+ throw new BareError(bc.offset - strBytesLen, "invalid UTF-8 string", {
786
+ cause
787
+ });
788
+ }
789
+ }
790
+ function encodeString(bc, x) {
791
+ if (x.length < bc.config.textEncoderThreshold) {
792
+ const byteLen = utf8ByteLength(x);
793
+ encodeUintSafe(bc, byteLen);
794
+ bc.reserve(byteLen);
795
+ encodeUtf8Js(bc, x);
796
+ } else {
797
+ const strBytes = UTF8_ENCODER.encode(x);
798
+ encodeUintSafe(bc, strBytes.length);
799
+ bc.write(strBytes);
800
+ }
801
+ }
802
+ function decodeUtf8Js(bytes) {
803
+ const bytesLen = bytes.length;
804
+ let result = "";
805
+ let i = 0;
806
+ while (i < bytesLen) {
807
+ let codePoint = bytes[i++] | 0;
808
+ switch (Math.clz32(~codePoint << 24)) {
809
+ case 0:
810
+ break;
811
+ case 2: {
812
+ if (i < bytesLen) {
813
+ codePoint = (codePoint & 31) << 6 | bytes[i] & 63;
814
+ }
815
+ if (codePoint >> 7 === 0 || bytes[i] >> 6 !== 2) {
816
+ throw TypeError("Decoding failed");
817
+ }
818
+ i += 1;
819
+ break;
820
+ }
821
+ case 3: {
822
+ if (i + 1 < bytesLen) {
823
+ codePoint = (codePoint & 15) << 12 | (bytes[i] & 63) << 6 | bytes[i + 1] & 63;
824
+ }
825
+ if (codePoint >> 11 === 0 || bytes[i] >> 6 !== 2 || bytes[i + 1] >> 6 !== 2 || codePoint >> 11 === 27) {
826
+ throw TypeError("Decoding failed");
827
+ }
828
+ i += 2;
829
+ break;
830
+ }
831
+ case 4: {
832
+ if (i + 2 < bytesLen) {
833
+ codePoint = (codePoint & 7) << 18 | (bytes[i] & 63) << 12 | (bytes[i + 1] & 63) << 6 | bytes[i + 2] & 63;
834
+ }
835
+ if (codePoint >> 16 === 0 || codePoint > 1114111 || bytes[i] >> 6 !== 2 || bytes[i + 1] >> 6 !== 2 || bytes[i + 2] >> 6 !== 2) {
836
+ throw TypeError("Decoding failed");
837
+ }
838
+ i += 3;
839
+ break;
840
+ }
841
+ default:
842
+ throw TypeError("Decoding failed");
843
+ }
844
+ result += String.fromCodePoint(codePoint);
845
+ }
846
+ return result;
847
+ }
848
+ function encodeUtf8Js(bc, s) {
849
+ const sLen = s.length;
850
+ let offset = bc.offset;
851
+ const view = bc.view;
852
+ let i = 0;
853
+ while (i < sLen) {
854
+ const codePoint = s.codePointAt(i++);
855
+ if (codePoint < 128) {
856
+ view.setUint8(offset++, codePoint);
857
+ } else if (codePoint < 2048) {
858
+ view.setUint8(offset++, 192 | codePoint >> 6);
859
+ view.setUint8(offset++, 128 | codePoint & 63);
860
+ } else if (codePoint < 65536) {
861
+ view.setUint8(offset++, 224 | codePoint >> 12);
862
+ view.setUint8(offset++, 128 | codePoint >> 6 & 63);
863
+ view.setUint8(offset++, 128 | codePoint & 63);
864
+ } else {
865
+ view.setUint8(offset++, 240 | codePoint >> 18);
866
+ view.setUint8(offset++, 128 | codePoint >> 12 & 63);
867
+ view.setUint8(offset++, 128 | codePoint >> 6 & 63);
868
+ view.setUint8(offset++, 128 | codePoint & 63);
869
+ i++;
870
+ }
871
+ }
872
+ bc.offset = offset;
873
+ }
874
+ function utf8ByteLength(s) {
875
+ const sLen = s.length;
876
+ let result = 0;
877
+ let i = 0;
878
+ while (i < sLen) {
879
+ const codePoint = s.codePointAt(i);
880
+ i++;
881
+ if (codePoint < 128) {
882
+ result++;
883
+ } else if (codePoint < 2048) {
884
+ result += 2;
885
+ } else if (codePoint < 65536) {
886
+ result += 3;
887
+ } else {
888
+ result += 4;
889
+ i++;
890
+ }
891
+ }
892
+ return result;
893
+ }
894
+ var UTF8_DECODER = new TextDecoder("utf-8", { fatal: true });
895
+ var UTF8_ENCODER = new TextEncoder();
896
+
897
+ // src/codec/u16-array.ts
898
+ var import_assert9 = __toESM(require("assert"), 1);
899
+ var U16_BYTE_COUNT = 2;
900
+ var decodeU16FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? decodeU16FixedArrayLE : decodeU16FixedArrayBE;
901
+ function decodeU16Array(bc) {
902
+ return decodeU16FixedArray(bc, decodeUintSafe(bc));
903
+ }
904
+ function decodeU16FixedArrayLE(bc, len) {
905
+ const byteCount = len * U16_BYTE_COUNT;
906
+ return new Uint16Array(decodeFixedData(bc, byteCount));
907
+ }
908
+ function decodeU16FixedArrayBE(bc, len) {
909
+ bc.check(len * U16_BYTE_COUNT);
910
+ const result = new Uint16Array(len);
911
+ for (let i = 0; i < len; i++)
912
+ result[i] = decodeU16(bc);
913
+ return result;
914
+ }
915
+ var encodeU16FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? encodeU16FixedArrayLE : encodeU16FixedArrayBE;
916
+ function encodeU16Array(bc, x) {
917
+ encodeUintSafe(bc, x.length);
918
+ if (x.length !== 0) {
919
+ encodeU16FixedArray(bc, x, x.length);
920
+ }
921
+ }
922
+ function encodeU16FixedArrayLE(bc, x, len) {
923
+ (0, import_assert9.default)(x.length === len);
924
+ bc.write(new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
925
+ }
926
+ function encodeU16FixedArrayBE(bc, x, len) {
927
+ (0, import_assert9.default)(x.length === len);
928
+ bc.reserve(x.length * U16_BYTE_COUNT);
929
+ for (let i = 0; i < x.length; i++)
930
+ encodeU16(bc, x[i]);
931
+ }
932
+
933
+ // src/codec/u32-array.ts
934
+ var import_assert10 = __toESM(require("assert"), 1);
935
+ var U32_BYTE_COUNT = 4;
936
+ var decodeU32FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? decodeU32FixedArrayLE : decodeU32FixedArrayBE;
937
+ function decodeU32Array(bc) {
938
+ return decodeU32FixedArray(bc, decodeUintSafe(bc));
939
+ }
940
+ function decodeU32FixedArrayLE(bc, len) {
941
+ const byteCount = len * U32_BYTE_COUNT;
942
+ return new Uint32Array(decodeFixedData(bc, byteCount));
943
+ }
944
+ function decodeU32FixedArrayBE(bc, len) {
945
+ bc.check(len * U32_BYTE_COUNT);
946
+ const result = new Uint32Array(len);
947
+ for (let i = 0; i < len; i++)
948
+ result[i] = decodeU32(bc);
949
+ return result;
950
+ }
951
+ var encodeU32FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? encodeU32FixedArrayLE : encodeU32FixedArrayBE;
952
+ function encodeU32Array(bc, x) {
953
+ encodeUintSafe(bc, x.length);
954
+ if (x.length !== 0) {
955
+ encodeU32FixedArray(bc, x, x.length);
956
+ }
957
+ }
958
+ function encodeU32FixedArrayLE(bc, x, len) {
959
+ (0, import_assert10.default)(x.length === len);
960
+ bc.write(new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
961
+ }
962
+ function encodeU32FixedArrayBE(bc, x, len) {
963
+ (0, import_assert10.default)(x.length === len);
964
+ bc.reserve(x.length * U32_BYTE_COUNT);
965
+ for (let i = 0; i < x.length; i++)
966
+ encodeU32(bc, x[i]);
967
+ }
968
+
969
+ // src/codec/u64-array.ts
970
+ var import_assert11 = __toESM(require("assert"), 1);
971
+ var U64_BYTE_COUNT = 8;
972
+ var decodeU64FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? decodeU64FixedArrayLE : decodeU64FixedArrayBE;
973
+ function decodeU64Array(bc) {
974
+ return decodeU64FixedArray(bc, decodeUintSafe(bc));
975
+ }
976
+ function decodeU64FixedArrayLE(bc, len) {
977
+ const byteCount = len * U64_BYTE_COUNT;
978
+ return new BigUint64Array(decodeFixedData(bc, byteCount));
979
+ }
980
+ function decodeU64FixedArrayBE(bc, len) {
981
+ bc.check(len * U64_BYTE_COUNT);
982
+ const result = new BigUint64Array(len);
983
+ for (let i = 0; i < len; i++)
984
+ result[i] = decodeU64(bc);
985
+ return result;
986
+ }
987
+ var encodeU64FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? encodeU64FixedArrayLE : encodeU64FixedArrayBE;
988
+ function encodeU64Array(bc, x) {
989
+ encodeUintSafe(bc, x.length);
990
+ if (x.length !== 0) {
991
+ encodeU64FixedArray(bc, x, x.length);
992
+ }
993
+ }
994
+ function encodeU64FixedArrayLE(bc, x, len) {
995
+ (0, import_assert11.default)(x.length === len);
996
+ bc.write(new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
997
+ }
998
+ function encodeU64FixedArrayBE(bc, x, len) {
999
+ (0, import_assert11.default)(x.length === len);
1000
+ bc.reserve(x.length * U64_BYTE_COUNT);
1001
+ for (let i = 0; i < x.length; i++)
1002
+ encodeU64(bc, x[i]);
1003
+ }
1004
+
1005
+ // src/codec/u8-clamped-array.ts
1006
+ function decodeU8ClampedArray(bc) {
1007
+ return decodeU8ClampedFixedArray(bc, decodeUintSafe(bc));
1008
+ }
1009
+ function encodeU8ClampedArray(bc, x) {
1010
+ encodeUintSafe(bc, x.length);
1011
+ encodeU8ClampedFixedArray(bc, x, x.length);
1012
+ }
1013
+ function decodeU8ClampedFixedArray(bc, len) {
1014
+ return new Uint8ClampedArray(decodeFixedData(bc, len));
1015
+ }
1016
+ function encodeU8ClampedFixedArray(bc, x, len) {
1017
+ encodeU8FixedArray(bc, new Uint8Array(x.buffer, x.byteOffset, x.byteLength), len);
1018
+ }
1019
+ module.exports = __toCommonJS(src_exports);
1020
+ // Annotate the CommonJS export names for ESM import in node:
1021
+ 0 && (module.exports = {
1022
+ BareError,
1023
+ ByteCursor,
1024
+ Config,
1025
+ decodeBool,
1026
+ decodeData,
1027
+ decodeF32,
1028
+ decodeF32Array,
1029
+ decodeF32FixedArray,
1030
+ decodeF64,
1031
+ decodeF64Array,
1032
+ decodeF64FixedArray,
1033
+ decodeFixedData,
1034
+ decodeI16,
1035
+ decodeI16Array,
1036
+ decodeI16FixedArray,
1037
+ decodeI32,
1038
+ decodeI32Array,
1039
+ decodeI32FixedArray,
1040
+ decodeI64,
1041
+ decodeI64Array,
1042
+ decodeI64FixedArray,
1043
+ decodeI64Safe,
1044
+ decodeI8,
1045
+ decodeI8Array,
1046
+ decodeI8FixedArray,
1047
+ decodeInt,
1048
+ decodeIntSafe,
1049
+ decodeString,
1050
+ decodeU16,
1051
+ decodeU16Array,
1052
+ decodeU16FixedArray,
1053
+ decodeU32,
1054
+ decodeU32Array,
1055
+ decodeU32FixedArray,
1056
+ decodeU64,
1057
+ decodeU64Array,
1058
+ decodeU64FixedArray,
1059
+ decodeU64Safe,
1060
+ decodeU8,
1061
+ decodeU8Array,
1062
+ decodeU8ClampedArray,
1063
+ decodeU8ClampedFixedArray,
1064
+ decodeU8FixedArray,
1065
+ decodeUint,
1066
+ decodeUintSafe,
1067
+ decodeVoid,
1068
+ encodeBool,
1069
+ encodeData,
1070
+ encodeF32,
1071
+ encodeF32Array,
1072
+ encodeF32FixedArray,
1073
+ encodeF64,
1074
+ encodeF64Array,
1075
+ encodeF64FixedArray,
1076
+ encodeFixedData,
1077
+ encodeI16,
1078
+ encodeI16Array,
1079
+ encodeI16FixedArray,
1080
+ encodeI32,
1081
+ encodeI32Array,
1082
+ encodeI32FixedArray,
1083
+ encodeI64,
1084
+ encodeI64Array,
1085
+ encodeI64FixedArray,
1086
+ encodeI64Safe,
1087
+ encodeI8,
1088
+ encodeI8Array,
1089
+ encodeI8FixedArray,
1090
+ encodeInt,
1091
+ encodeIntSafe,
1092
+ encodeString,
1093
+ encodeU16,
1094
+ encodeU16Array,
1095
+ encodeU16FixedArray,
1096
+ encodeU32,
1097
+ encodeU32Array,
1098
+ encodeU32FixedArray,
1099
+ encodeU64,
1100
+ encodeU64Array,
1101
+ encodeU64FixedArray,
1102
+ encodeU64Safe,
1103
+ encodeU8,
1104
+ encodeU8Array,
1105
+ encodeU8ClampedArray,
1106
+ encodeU8ClampedFixedArray,
1107
+ encodeU8FixedArray,
1108
+ encodeUint,
1109
+ encodeUintSafe,
1110
+ encodeVoid
1111
+ });
1112
+ //# sourceMappingURL=index.cjs.map