@0dotxyz/p0-ts-sdk 2.2.0-beta.1 → 2.2.0-beta.2

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/vendor.cjs CHANGED
@@ -11,6 +11,7 @@ var anchor = require('@coral-xyz/anchor');
11
11
  var borsh = require('@coral-xyz/borsh');
12
12
  var Decimal3 = require('decimal.js');
13
13
  var WebSocket = require('ws');
14
+ var msgpack = require('@msgpack/msgpack');
14
15
 
15
16
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
16
17
 
@@ -29164,1438 +29165,6 @@ function makeUpdateJupLendRate({ lendingState }) {
29164
29165
  lendingState.rewardsRateModel
29165
29166
  );
29166
29167
  }
29167
-
29168
- // node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/utils/utf8.mjs
29169
- function utf8Count(str) {
29170
- const strLength = str.length;
29171
- let byteLength = 0;
29172
- let pos = 0;
29173
- while (pos < strLength) {
29174
- let value = str.charCodeAt(pos++);
29175
- if ((value & 4294967168) === 0) {
29176
- byteLength++;
29177
- continue;
29178
- } else if ((value & 4294965248) === 0) {
29179
- byteLength += 2;
29180
- } else {
29181
- if (value >= 55296 && value <= 56319) {
29182
- if (pos < strLength) {
29183
- const extra = str.charCodeAt(pos);
29184
- if ((extra & 64512) === 56320) {
29185
- ++pos;
29186
- value = ((value & 1023) << 10) + (extra & 1023) + 65536;
29187
- }
29188
- }
29189
- }
29190
- if ((value & 4294901760) === 0) {
29191
- byteLength += 3;
29192
- } else {
29193
- byteLength += 4;
29194
- }
29195
- }
29196
- }
29197
- return byteLength;
29198
- }
29199
- function utf8EncodeJs(str, output, outputOffset) {
29200
- const strLength = str.length;
29201
- let offset = outputOffset;
29202
- let pos = 0;
29203
- while (pos < strLength) {
29204
- let value = str.charCodeAt(pos++);
29205
- if ((value & 4294967168) === 0) {
29206
- output[offset++] = value;
29207
- continue;
29208
- } else if ((value & 4294965248) === 0) {
29209
- output[offset++] = value >> 6 & 31 | 192;
29210
- } else {
29211
- if (value >= 55296 && value <= 56319) {
29212
- if (pos < strLength) {
29213
- const extra = str.charCodeAt(pos);
29214
- if ((extra & 64512) === 56320) {
29215
- ++pos;
29216
- value = ((value & 1023) << 10) + (extra & 1023) + 65536;
29217
- }
29218
- }
29219
- }
29220
- if ((value & 4294901760) === 0) {
29221
- output[offset++] = value >> 12 & 15 | 224;
29222
- output[offset++] = value >> 6 & 63 | 128;
29223
- } else {
29224
- output[offset++] = value >> 18 & 7 | 240;
29225
- output[offset++] = value >> 12 & 63 | 128;
29226
- output[offset++] = value >> 6 & 63 | 128;
29227
- }
29228
- }
29229
- output[offset++] = value & 63 | 128;
29230
- }
29231
- }
29232
- var sharedTextEncoder = new TextEncoder();
29233
- var TEXT_ENCODER_THRESHOLD = 50;
29234
- function utf8EncodeTE(str, output, outputOffset) {
29235
- sharedTextEncoder.encodeInto(str, output.subarray(outputOffset));
29236
- }
29237
- function utf8Encode(str, output, outputOffset) {
29238
- if (str.length > TEXT_ENCODER_THRESHOLD) {
29239
- utf8EncodeTE(str, output, outputOffset);
29240
- } else {
29241
- utf8EncodeJs(str, output, outputOffset);
29242
- }
29243
- }
29244
- var CHUNK_SIZE = 4096;
29245
- function utf8DecodeJs(bytes, inputOffset, byteLength) {
29246
- let offset = inputOffset;
29247
- const end = offset + byteLength;
29248
- const units = [];
29249
- let result = "";
29250
- while (offset < end) {
29251
- const byte1 = bytes[offset++];
29252
- if ((byte1 & 128) === 0) {
29253
- units.push(byte1);
29254
- } else if ((byte1 & 224) === 192) {
29255
- const byte2 = bytes[offset++] & 63;
29256
- units.push((byte1 & 31) << 6 | byte2);
29257
- } else if ((byte1 & 240) === 224) {
29258
- const byte2 = bytes[offset++] & 63;
29259
- const byte3 = bytes[offset++] & 63;
29260
- units.push((byte1 & 31) << 12 | byte2 << 6 | byte3);
29261
- } else if ((byte1 & 248) === 240) {
29262
- const byte2 = bytes[offset++] & 63;
29263
- const byte3 = bytes[offset++] & 63;
29264
- const byte4 = bytes[offset++] & 63;
29265
- let unit = (byte1 & 7) << 18 | byte2 << 12 | byte3 << 6 | byte4;
29266
- if (unit > 65535) {
29267
- unit -= 65536;
29268
- units.push(unit >>> 10 & 1023 | 55296);
29269
- unit = 56320 | unit & 1023;
29270
- }
29271
- units.push(unit);
29272
- } else {
29273
- units.push(byte1);
29274
- }
29275
- if (units.length >= CHUNK_SIZE) {
29276
- result += String.fromCharCode(...units);
29277
- units.length = 0;
29278
- }
29279
- }
29280
- if (units.length > 0) {
29281
- result += String.fromCharCode(...units);
29282
- }
29283
- return result;
29284
- }
29285
- var sharedTextDecoder = new TextDecoder();
29286
- var TEXT_DECODER_THRESHOLD = 200;
29287
- function utf8DecodeTD(bytes, inputOffset, byteLength) {
29288
- const stringBytes = bytes.subarray(inputOffset, inputOffset + byteLength);
29289
- return sharedTextDecoder.decode(stringBytes);
29290
- }
29291
- function utf8Decode(bytes, inputOffset, byteLength) {
29292
- if (byteLength > TEXT_DECODER_THRESHOLD) {
29293
- return utf8DecodeTD(bytes, inputOffset, byteLength);
29294
- } else {
29295
- return utf8DecodeJs(bytes, inputOffset, byteLength);
29296
- }
29297
- }
29298
-
29299
- // node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/ExtData.mjs
29300
- var ExtData = class {
29301
- type;
29302
- data;
29303
- constructor(type, data) {
29304
- this.type = type;
29305
- this.data = data;
29306
- }
29307
- };
29308
-
29309
- // node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/DecodeError.mjs
29310
- var DecodeError = class _DecodeError extends Error {
29311
- constructor(message) {
29312
- super(message);
29313
- const proto = Object.create(_DecodeError.prototype);
29314
- Object.setPrototypeOf(this, proto);
29315
- Object.defineProperty(this, "name", {
29316
- configurable: true,
29317
- enumerable: false,
29318
- value: _DecodeError.name
29319
- });
29320
- }
29321
- };
29322
-
29323
- // node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/utils/int.mjs
29324
- var UINT32_MAX = 4294967295;
29325
- function setUint64(view, offset, value) {
29326
- const high = value / 4294967296;
29327
- const low = value;
29328
- view.setUint32(offset, high);
29329
- view.setUint32(offset + 4, low);
29330
- }
29331
- function setInt64(view, offset, value) {
29332
- const high = Math.floor(value / 4294967296);
29333
- const low = value;
29334
- view.setUint32(offset, high);
29335
- view.setUint32(offset + 4, low);
29336
- }
29337
- function getInt64(view, offset) {
29338
- const high = view.getInt32(offset);
29339
- const low = view.getUint32(offset + 4);
29340
- return high * 4294967296 + low;
29341
- }
29342
- function getUint64(view, offset) {
29343
- const high = view.getUint32(offset);
29344
- const low = view.getUint32(offset + 4);
29345
- return high * 4294967296 + low;
29346
- }
29347
-
29348
- // node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/timestamp.mjs
29349
- var EXT_TIMESTAMP = -1;
29350
- var TIMESTAMP32_MAX_SEC = 4294967296 - 1;
29351
- var TIMESTAMP64_MAX_SEC = 17179869184 - 1;
29352
- function encodeTimeSpecToTimestamp({ sec, nsec }) {
29353
- if (sec >= 0 && nsec >= 0 && sec <= TIMESTAMP64_MAX_SEC) {
29354
- if (nsec === 0 && sec <= TIMESTAMP32_MAX_SEC) {
29355
- const rv = new Uint8Array(4);
29356
- const view = new DataView(rv.buffer);
29357
- view.setUint32(0, sec);
29358
- return rv;
29359
- } else {
29360
- const secHigh = sec / 4294967296;
29361
- const secLow = sec & 4294967295;
29362
- const rv = new Uint8Array(8);
29363
- const view = new DataView(rv.buffer);
29364
- view.setUint32(0, nsec << 2 | secHigh & 3);
29365
- view.setUint32(4, secLow);
29366
- return rv;
29367
- }
29368
- } else {
29369
- const rv = new Uint8Array(12);
29370
- const view = new DataView(rv.buffer);
29371
- view.setUint32(0, nsec);
29372
- setInt64(view, 4, sec);
29373
- return rv;
29374
- }
29375
- }
29376
- function encodeDateToTimeSpec(date) {
29377
- const msec = date.getTime();
29378
- const sec = Math.floor(msec / 1e3);
29379
- const nsec = (msec - sec * 1e3) * 1e6;
29380
- const nsecInSec = Math.floor(nsec / 1e9);
29381
- return {
29382
- sec: sec + nsecInSec,
29383
- nsec: nsec - nsecInSec * 1e9
29384
- };
29385
- }
29386
- function encodeTimestampExtension(object) {
29387
- if (object instanceof Date) {
29388
- const timeSpec = encodeDateToTimeSpec(object);
29389
- return encodeTimeSpecToTimestamp(timeSpec);
29390
- } else {
29391
- return null;
29392
- }
29393
- }
29394
- function decodeTimestampToTimeSpec(data) {
29395
- const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
29396
- switch (data.byteLength) {
29397
- case 4: {
29398
- const sec = view.getUint32(0);
29399
- const nsec = 0;
29400
- return { sec, nsec };
29401
- }
29402
- case 8: {
29403
- const nsec30AndSecHigh2 = view.getUint32(0);
29404
- const secLow32 = view.getUint32(4);
29405
- const sec = (nsec30AndSecHigh2 & 3) * 4294967296 + secLow32;
29406
- const nsec = nsec30AndSecHigh2 >>> 2;
29407
- return { sec, nsec };
29408
- }
29409
- case 12: {
29410
- const sec = getInt64(view, 4);
29411
- const nsec = view.getUint32(0);
29412
- return { sec, nsec };
29413
- }
29414
- default:
29415
- throw new DecodeError(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${data.length}`);
29416
- }
29417
- }
29418
- function decodeTimestampExtension(data) {
29419
- const timeSpec = decodeTimestampToTimeSpec(data);
29420
- return new Date(timeSpec.sec * 1e3 + timeSpec.nsec / 1e6);
29421
- }
29422
- var timestampExtension = {
29423
- type: EXT_TIMESTAMP,
29424
- encode: encodeTimestampExtension,
29425
- decode: decodeTimestampExtension
29426
- };
29427
-
29428
- // node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/ExtensionCodec.mjs
29429
- var ExtensionCodec = class _ExtensionCodec {
29430
- static defaultCodec = new _ExtensionCodec();
29431
- // ensures ExtensionCodecType<X> matches ExtensionCodec<X>
29432
- // this will make type errors a lot more clear
29433
- // eslint-disable-next-line @typescript-eslint/naming-convention
29434
- __brand;
29435
- // built-in extensions
29436
- builtInEncoders = [];
29437
- builtInDecoders = [];
29438
- // custom extensions
29439
- encoders = [];
29440
- decoders = [];
29441
- constructor() {
29442
- this.register(timestampExtension);
29443
- }
29444
- register({ type, encode, decode }) {
29445
- if (type >= 0) {
29446
- this.encoders[type] = encode;
29447
- this.decoders[type] = decode;
29448
- } else {
29449
- const index = -1 - type;
29450
- this.builtInEncoders[index] = encode;
29451
- this.builtInDecoders[index] = decode;
29452
- }
29453
- }
29454
- tryToEncode(object, context) {
29455
- for (let i = 0; i < this.builtInEncoders.length; i++) {
29456
- const encodeExt = this.builtInEncoders[i];
29457
- if (encodeExt != null) {
29458
- const data = encodeExt(object, context);
29459
- if (data != null) {
29460
- const type = -1 - i;
29461
- return new ExtData(type, data);
29462
- }
29463
- }
29464
- }
29465
- for (let i = 0; i < this.encoders.length; i++) {
29466
- const encodeExt = this.encoders[i];
29467
- if (encodeExt != null) {
29468
- const data = encodeExt(object, context);
29469
- if (data != null) {
29470
- const type = i;
29471
- return new ExtData(type, data);
29472
- }
29473
- }
29474
- }
29475
- if (object instanceof ExtData) {
29476
- return object;
29477
- }
29478
- return null;
29479
- }
29480
- decode(data, type, context) {
29481
- const decodeExt = type < 0 ? this.builtInDecoders[-1 - type] : this.decoders[type];
29482
- if (decodeExt) {
29483
- return decodeExt(data, type, context);
29484
- } else {
29485
- return new ExtData(type, data);
29486
- }
29487
- }
29488
- };
29489
-
29490
- // node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/utils/typedArrays.mjs
29491
- function isArrayBufferLike(buffer) {
29492
- return buffer instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && buffer instanceof SharedArrayBuffer;
29493
- }
29494
- function ensureUint8Array(buffer) {
29495
- if (buffer instanceof Uint8Array) {
29496
- return buffer;
29497
- } else if (ArrayBuffer.isView(buffer)) {
29498
- return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
29499
- } else if (isArrayBufferLike(buffer)) {
29500
- return new Uint8Array(buffer);
29501
- } else {
29502
- return Uint8Array.from(buffer);
29503
- }
29504
- }
29505
-
29506
- // node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/Encoder.mjs
29507
- var DEFAULT_MAX_DEPTH = 100;
29508
- var DEFAULT_INITIAL_BUFFER_SIZE = 2048;
29509
- var Encoder = class _Encoder {
29510
- extensionCodec;
29511
- context;
29512
- useBigInt64;
29513
- maxDepth;
29514
- initialBufferSize;
29515
- sortKeys;
29516
- forceFloat32;
29517
- ignoreUndefined;
29518
- forceIntegerToFloat;
29519
- pos;
29520
- view;
29521
- bytes;
29522
- entered = false;
29523
- constructor(options) {
29524
- this.extensionCodec = options?.extensionCodec ?? ExtensionCodec.defaultCodec;
29525
- this.context = options?.context;
29526
- this.useBigInt64 = options?.useBigInt64 ?? false;
29527
- this.maxDepth = options?.maxDepth ?? DEFAULT_MAX_DEPTH;
29528
- this.initialBufferSize = options?.initialBufferSize ?? DEFAULT_INITIAL_BUFFER_SIZE;
29529
- this.sortKeys = options?.sortKeys ?? false;
29530
- this.forceFloat32 = options?.forceFloat32 ?? false;
29531
- this.ignoreUndefined = options?.ignoreUndefined ?? false;
29532
- this.forceIntegerToFloat = options?.forceIntegerToFloat ?? false;
29533
- this.pos = 0;
29534
- this.view = new DataView(new ArrayBuffer(this.initialBufferSize));
29535
- this.bytes = new Uint8Array(this.view.buffer);
29536
- }
29537
- clone() {
29538
- return new _Encoder({
29539
- extensionCodec: this.extensionCodec,
29540
- context: this.context,
29541
- useBigInt64: this.useBigInt64,
29542
- maxDepth: this.maxDepth,
29543
- initialBufferSize: this.initialBufferSize,
29544
- sortKeys: this.sortKeys,
29545
- forceFloat32: this.forceFloat32,
29546
- ignoreUndefined: this.ignoreUndefined,
29547
- forceIntegerToFloat: this.forceIntegerToFloat
29548
- });
29549
- }
29550
- reinitializeState() {
29551
- this.pos = 0;
29552
- }
29553
- /**
29554
- * This is almost equivalent to {@link Encoder#encode}, but it returns an reference of the encoder's internal buffer and thus much faster than {@link Encoder#encode}.
29555
- *
29556
- * @returns Encodes the object and returns a shared reference the encoder's internal buffer.
29557
- */
29558
- encodeSharedRef(object) {
29559
- if (this.entered) {
29560
- const instance = this.clone();
29561
- return instance.encodeSharedRef(object);
29562
- }
29563
- try {
29564
- this.entered = true;
29565
- this.reinitializeState();
29566
- this.doEncode(object, 1);
29567
- return this.bytes.subarray(0, this.pos);
29568
- } finally {
29569
- this.entered = false;
29570
- }
29571
- }
29572
- /**
29573
- * @returns Encodes the object and returns a copy of the encoder's internal buffer.
29574
- */
29575
- encode(object) {
29576
- if (this.entered) {
29577
- const instance = this.clone();
29578
- return instance.encode(object);
29579
- }
29580
- try {
29581
- this.entered = true;
29582
- this.reinitializeState();
29583
- this.doEncode(object, 1);
29584
- return this.bytes.slice(0, this.pos);
29585
- } finally {
29586
- this.entered = false;
29587
- }
29588
- }
29589
- doEncode(object, depth) {
29590
- if (depth > this.maxDepth) {
29591
- throw new Error(`Too deep objects in depth ${depth}`);
29592
- }
29593
- if (object == null) {
29594
- this.encodeNil();
29595
- } else if (typeof object === "boolean") {
29596
- this.encodeBoolean(object);
29597
- } else if (typeof object === "number") {
29598
- if (!this.forceIntegerToFloat) {
29599
- this.encodeNumber(object);
29600
- } else {
29601
- this.encodeNumberAsFloat(object);
29602
- }
29603
- } else if (typeof object === "string") {
29604
- this.encodeString(object);
29605
- } else if (this.useBigInt64 && typeof object === "bigint") {
29606
- this.encodeBigInt64(object);
29607
- } else {
29608
- this.encodeObject(object, depth);
29609
- }
29610
- }
29611
- ensureBufferSizeToWrite(sizeToWrite) {
29612
- const requiredSize = this.pos + sizeToWrite;
29613
- if (this.view.byteLength < requiredSize) {
29614
- this.resizeBuffer(requiredSize * 2);
29615
- }
29616
- }
29617
- resizeBuffer(newSize) {
29618
- const newBuffer = new ArrayBuffer(newSize);
29619
- const newBytes = new Uint8Array(newBuffer);
29620
- const newView = new DataView(newBuffer);
29621
- newBytes.set(this.bytes);
29622
- this.view = newView;
29623
- this.bytes = newBytes;
29624
- }
29625
- encodeNil() {
29626
- this.writeU8(192);
29627
- }
29628
- encodeBoolean(object) {
29629
- if (object === false) {
29630
- this.writeU8(194);
29631
- } else {
29632
- this.writeU8(195);
29633
- }
29634
- }
29635
- encodeNumber(object) {
29636
- if (!this.forceIntegerToFloat && Number.isSafeInteger(object)) {
29637
- if (object >= 0) {
29638
- if (object < 128) {
29639
- this.writeU8(object);
29640
- } else if (object < 256) {
29641
- this.writeU8(204);
29642
- this.writeU8(object);
29643
- } else if (object < 65536) {
29644
- this.writeU8(205);
29645
- this.writeU16(object);
29646
- } else if (object < 4294967296) {
29647
- this.writeU8(206);
29648
- this.writeU32(object);
29649
- } else if (!this.useBigInt64) {
29650
- this.writeU8(207);
29651
- this.writeU64(object);
29652
- } else {
29653
- this.encodeNumberAsFloat(object);
29654
- }
29655
- } else {
29656
- if (object >= -32) {
29657
- this.writeU8(224 | object + 32);
29658
- } else if (object >= -128) {
29659
- this.writeU8(208);
29660
- this.writeI8(object);
29661
- } else if (object >= -32768) {
29662
- this.writeU8(209);
29663
- this.writeI16(object);
29664
- } else if (object >= -2147483648) {
29665
- this.writeU8(210);
29666
- this.writeI32(object);
29667
- } else if (!this.useBigInt64) {
29668
- this.writeU8(211);
29669
- this.writeI64(object);
29670
- } else {
29671
- this.encodeNumberAsFloat(object);
29672
- }
29673
- }
29674
- } else {
29675
- this.encodeNumberAsFloat(object);
29676
- }
29677
- }
29678
- encodeNumberAsFloat(object) {
29679
- if (this.forceFloat32) {
29680
- this.writeU8(202);
29681
- this.writeF32(object);
29682
- } else {
29683
- this.writeU8(203);
29684
- this.writeF64(object);
29685
- }
29686
- }
29687
- encodeBigInt64(object) {
29688
- if (object >= BigInt(0)) {
29689
- this.writeU8(207);
29690
- this.writeBigUint64(object);
29691
- } else {
29692
- this.writeU8(211);
29693
- this.writeBigInt64(object);
29694
- }
29695
- }
29696
- writeStringHeader(byteLength) {
29697
- if (byteLength < 32) {
29698
- this.writeU8(160 + byteLength);
29699
- } else if (byteLength < 256) {
29700
- this.writeU8(217);
29701
- this.writeU8(byteLength);
29702
- } else if (byteLength < 65536) {
29703
- this.writeU8(218);
29704
- this.writeU16(byteLength);
29705
- } else if (byteLength < 4294967296) {
29706
- this.writeU8(219);
29707
- this.writeU32(byteLength);
29708
- } else {
29709
- throw new Error(`Too long string: ${byteLength} bytes in UTF-8`);
29710
- }
29711
- }
29712
- encodeString(object) {
29713
- const maxHeaderSize = 1 + 4;
29714
- const byteLength = utf8Count(object);
29715
- this.ensureBufferSizeToWrite(maxHeaderSize + byteLength);
29716
- this.writeStringHeader(byteLength);
29717
- utf8Encode(object, this.bytes, this.pos);
29718
- this.pos += byteLength;
29719
- }
29720
- encodeObject(object, depth) {
29721
- const ext = this.extensionCodec.tryToEncode(object, this.context);
29722
- if (ext != null) {
29723
- this.encodeExtension(ext);
29724
- } else if (Array.isArray(object)) {
29725
- this.encodeArray(object, depth);
29726
- } else if (ArrayBuffer.isView(object)) {
29727
- this.encodeBinary(object);
29728
- } else if (typeof object === "object") {
29729
- this.encodeMap(object, depth);
29730
- } else {
29731
- throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(object)}`);
29732
- }
29733
- }
29734
- encodeBinary(object) {
29735
- const size = object.byteLength;
29736
- if (size < 256) {
29737
- this.writeU8(196);
29738
- this.writeU8(size);
29739
- } else if (size < 65536) {
29740
- this.writeU8(197);
29741
- this.writeU16(size);
29742
- } else if (size < 4294967296) {
29743
- this.writeU8(198);
29744
- this.writeU32(size);
29745
- } else {
29746
- throw new Error(`Too large binary: ${size}`);
29747
- }
29748
- const bytes = ensureUint8Array(object);
29749
- this.writeU8a(bytes);
29750
- }
29751
- encodeArray(object, depth) {
29752
- const size = object.length;
29753
- if (size < 16) {
29754
- this.writeU8(144 + size);
29755
- } else if (size < 65536) {
29756
- this.writeU8(220);
29757
- this.writeU16(size);
29758
- } else if (size < 4294967296) {
29759
- this.writeU8(221);
29760
- this.writeU32(size);
29761
- } else {
29762
- throw new Error(`Too large array: ${size}`);
29763
- }
29764
- for (const item of object) {
29765
- this.doEncode(item, depth + 1);
29766
- }
29767
- }
29768
- countWithoutUndefined(object, keys) {
29769
- let count = 0;
29770
- for (const key of keys) {
29771
- if (object[key] !== void 0) {
29772
- count++;
29773
- }
29774
- }
29775
- return count;
29776
- }
29777
- encodeMap(object, depth) {
29778
- const keys = Object.keys(object);
29779
- if (this.sortKeys) {
29780
- keys.sort();
29781
- }
29782
- const size = this.ignoreUndefined ? this.countWithoutUndefined(object, keys) : keys.length;
29783
- if (size < 16) {
29784
- this.writeU8(128 + size);
29785
- } else if (size < 65536) {
29786
- this.writeU8(222);
29787
- this.writeU16(size);
29788
- } else if (size < 4294967296) {
29789
- this.writeU8(223);
29790
- this.writeU32(size);
29791
- } else {
29792
- throw new Error(`Too large map object: ${size}`);
29793
- }
29794
- for (const key of keys) {
29795
- const value = object[key];
29796
- if (!(this.ignoreUndefined && value === void 0)) {
29797
- this.encodeString(key);
29798
- this.doEncode(value, depth + 1);
29799
- }
29800
- }
29801
- }
29802
- encodeExtension(ext) {
29803
- if (typeof ext.data === "function") {
29804
- const data = ext.data(this.pos + 6);
29805
- const size2 = data.length;
29806
- if (size2 >= 4294967296) {
29807
- throw new Error(`Too large extension object: ${size2}`);
29808
- }
29809
- this.writeU8(201);
29810
- this.writeU32(size2);
29811
- this.writeI8(ext.type);
29812
- this.writeU8a(data);
29813
- return;
29814
- }
29815
- const size = ext.data.length;
29816
- if (size === 1) {
29817
- this.writeU8(212);
29818
- } else if (size === 2) {
29819
- this.writeU8(213);
29820
- } else if (size === 4) {
29821
- this.writeU8(214);
29822
- } else if (size === 8) {
29823
- this.writeU8(215);
29824
- } else if (size === 16) {
29825
- this.writeU8(216);
29826
- } else if (size < 256) {
29827
- this.writeU8(199);
29828
- this.writeU8(size);
29829
- } else if (size < 65536) {
29830
- this.writeU8(200);
29831
- this.writeU16(size);
29832
- } else if (size < 4294967296) {
29833
- this.writeU8(201);
29834
- this.writeU32(size);
29835
- } else {
29836
- throw new Error(`Too large extension object: ${size}`);
29837
- }
29838
- this.writeI8(ext.type);
29839
- this.writeU8a(ext.data);
29840
- }
29841
- writeU8(value) {
29842
- this.ensureBufferSizeToWrite(1);
29843
- this.view.setUint8(this.pos, value);
29844
- this.pos++;
29845
- }
29846
- writeU8a(values) {
29847
- const size = values.length;
29848
- this.ensureBufferSizeToWrite(size);
29849
- this.bytes.set(values, this.pos);
29850
- this.pos += size;
29851
- }
29852
- writeI8(value) {
29853
- this.ensureBufferSizeToWrite(1);
29854
- this.view.setInt8(this.pos, value);
29855
- this.pos++;
29856
- }
29857
- writeU16(value) {
29858
- this.ensureBufferSizeToWrite(2);
29859
- this.view.setUint16(this.pos, value);
29860
- this.pos += 2;
29861
- }
29862
- writeI16(value) {
29863
- this.ensureBufferSizeToWrite(2);
29864
- this.view.setInt16(this.pos, value);
29865
- this.pos += 2;
29866
- }
29867
- writeU32(value) {
29868
- this.ensureBufferSizeToWrite(4);
29869
- this.view.setUint32(this.pos, value);
29870
- this.pos += 4;
29871
- }
29872
- writeI32(value) {
29873
- this.ensureBufferSizeToWrite(4);
29874
- this.view.setInt32(this.pos, value);
29875
- this.pos += 4;
29876
- }
29877
- writeF32(value) {
29878
- this.ensureBufferSizeToWrite(4);
29879
- this.view.setFloat32(this.pos, value);
29880
- this.pos += 4;
29881
- }
29882
- writeF64(value) {
29883
- this.ensureBufferSizeToWrite(8);
29884
- this.view.setFloat64(this.pos, value);
29885
- this.pos += 8;
29886
- }
29887
- writeU64(value) {
29888
- this.ensureBufferSizeToWrite(8);
29889
- setUint64(this.view, this.pos, value);
29890
- this.pos += 8;
29891
- }
29892
- writeI64(value) {
29893
- this.ensureBufferSizeToWrite(8);
29894
- setInt64(this.view, this.pos, value);
29895
- this.pos += 8;
29896
- }
29897
- writeBigUint64(value) {
29898
- this.ensureBufferSizeToWrite(8);
29899
- this.view.setBigUint64(this.pos, value);
29900
- this.pos += 8;
29901
- }
29902
- writeBigInt64(value) {
29903
- this.ensureBufferSizeToWrite(8);
29904
- this.view.setBigInt64(this.pos, value);
29905
- this.pos += 8;
29906
- }
29907
- };
29908
-
29909
- // node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/utils/prettyByte.mjs
29910
- function prettyByte(byte) {
29911
- return `${byte < 0 ? "-" : ""}0x${Math.abs(byte).toString(16).padStart(2, "0")}`;
29912
- }
29913
-
29914
- // node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/CachedKeyDecoder.mjs
29915
- var DEFAULT_MAX_KEY_LENGTH = 16;
29916
- var DEFAULT_MAX_LENGTH_PER_KEY = 16;
29917
- var CachedKeyDecoder = class {
29918
- hit = 0;
29919
- miss = 0;
29920
- caches;
29921
- maxKeyLength;
29922
- maxLengthPerKey;
29923
- constructor(maxKeyLength = DEFAULT_MAX_KEY_LENGTH, maxLengthPerKey = DEFAULT_MAX_LENGTH_PER_KEY) {
29924
- this.maxKeyLength = maxKeyLength;
29925
- this.maxLengthPerKey = maxLengthPerKey;
29926
- this.caches = [];
29927
- for (let i = 0; i < this.maxKeyLength; i++) {
29928
- this.caches.push([]);
29929
- }
29930
- }
29931
- canBeCached(byteLength) {
29932
- return byteLength > 0 && byteLength <= this.maxKeyLength;
29933
- }
29934
- find(bytes, inputOffset, byteLength) {
29935
- const records = this.caches[byteLength - 1];
29936
- FIND_CHUNK: for (const record of records) {
29937
- const recordBytes = record.bytes;
29938
- for (let j = 0; j < byteLength; j++) {
29939
- if (recordBytes[j] !== bytes[inputOffset + j]) {
29940
- continue FIND_CHUNK;
29941
- }
29942
- }
29943
- return record.str;
29944
- }
29945
- return null;
29946
- }
29947
- store(bytes, value) {
29948
- const records = this.caches[bytes.length - 1];
29949
- const record = { bytes, str: value };
29950
- if (records.length >= this.maxLengthPerKey) {
29951
- records[Math.random() * records.length | 0] = record;
29952
- } else {
29953
- records.push(record);
29954
- }
29955
- }
29956
- decode(bytes, inputOffset, byteLength) {
29957
- const cachedValue = this.find(bytes, inputOffset, byteLength);
29958
- if (cachedValue != null) {
29959
- this.hit++;
29960
- return cachedValue;
29961
- }
29962
- this.miss++;
29963
- const str = utf8DecodeJs(bytes, inputOffset, byteLength);
29964
- const slicedCopyOfBytes = Uint8Array.prototype.slice.call(bytes, inputOffset, inputOffset + byteLength);
29965
- this.store(slicedCopyOfBytes, str);
29966
- return str;
29967
- }
29968
- };
29969
-
29970
- // node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/Decoder.mjs
29971
- var STATE_ARRAY = "array";
29972
- var STATE_MAP_KEY = "map_key";
29973
- var STATE_MAP_VALUE = "map_value";
29974
- var mapKeyConverter = (key) => {
29975
- if (typeof key === "string" || typeof key === "number") {
29976
- return key;
29977
- }
29978
- throw new DecodeError("The type of key must be string or number but " + typeof key);
29979
- };
29980
- var StackPool = class {
29981
- stack = [];
29982
- stackHeadPosition = -1;
29983
- get length() {
29984
- return this.stackHeadPosition + 1;
29985
- }
29986
- top() {
29987
- return this.stack[this.stackHeadPosition];
29988
- }
29989
- pushArrayState(size) {
29990
- const state = this.getUninitializedStateFromPool();
29991
- state.type = STATE_ARRAY;
29992
- state.position = 0;
29993
- state.size = size;
29994
- state.array = new Array(size);
29995
- }
29996
- pushMapState(size) {
29997
- const state = this.getUninitializedStateFromPool();
29998
- state.type = STATE_MAP_KEY;
29999
- state.readCount = 0;
30000
- state.size = size;
30001
- state.map = {};
30002
- }
30003
- getUninitializedStateFromPool() {
30004
- this.stackHeadPosition++;
30005
- if (this.stackHeadPosition === this.stack.length) {
30006
- const partialState = {
30007
- type: void 0,
30008
- size: 0,
30009
- array: void 0,
30010
- position: 0,
30011
- readCount: 0,
30012
- map: void 0,
30013
- key: null
30014
- };
30015
- this.stack.push(partialState);
30016
- }
30017
- return this.stack[this.stackHeadPosition];
30018
- }
30019
- release(state) {
30020
- const topStackState = this.stack[this.stackHeadPosition];
30021
- if (topStackState !== state) {
30022
- throw new Error("Invalid stack state. Released state is not on top of the stack.");
30023
- }
30024
- if (state.type === STATE_ARRAY) {
30025
- const partialState = state;
30026
- partialState.size = 0;
30027
- partialState.array = void 0;
30028
- partialState.position = 0;
30029
- partialState.type = void 0;
30030
- }
30031
- if (state.type === STATE_MAP_KEY || state.type === STATE_MAP_VALUE) {
30032
- const partialState = state;
30033
- partialState.size = 0;
30034
- partialState.map = void 0;
30035
- partialState.readCount = 0;
30036
- partialState.type = void 0;
30037
- }
30038
- this.stackHeadPosition--;
30039
- }
30040
- reset() {
30041
- this.stack.length = 0;
30042
- this.stackHeadPosition = -1;
30043
- }
30044
- };
30045
- var HEAD_BYTE_REQUIRED = -1;
30046
- var EMPTY_VIEW = new DataView(new ArrayBuffer(0));
30047
- var EMPTY_BYTES = new Uint8Array(EMPTY_VIEW.buffer);
30048
- try {
30049
- EMPTY_VIEW.getInt8(0);
30050
- } catch (e) {
30051
- if (!(e instanceof RangeError)) {
30052
- throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access");
30053
- }
30054
- }
30055
- var MORE_DATA = new RangeError("Insufficient data");
30056
- var sharedCachedKeyDecoder = new CachedKeyDecoder();
30057
- var Decoder = class _Decoder {
30058
- extensionCodec;
30059
- context;
30060
- useBigInt64;
30061
- rawStrings;
30062
- maxStrLength;
30063
- maxBinLength;
30064
- maxArrayLength;
30065
- maxMapLength;
30066
- maxExtLength;
30067
- keyDecoder;
30068
- mapKeyConverter;
30069
- totalPos = 0;
30070
- pos = 0;
30071
- view = EMPTY_VIEW;
30072
- bytes = EMPTY_BYTES;
30073
- headByte = HEAD_BYTE_REQUIRED;
30074
- stack = new StackPool();
30075
- entered = false;
30076
- constructor(options) {
30077
- this.extensionCodec = options?.extensionCodec ?? ExtensionCodec.defaultCodec;
30078
- this.context = options?.context;
30079
- this.useBigInt64 = options?.useBigInt64 ?? false;
30080
- this.rawStrings = options?.rawStrings ?? false;
30081
- this.maxStrLength = options?.maxStrLength ?? UINT32_MAX;
30082
- this.maxBinLength = options?.maxBinLength ?? UINT32_MAX;
30083
- this.maxArrayLength = options?.maxArrayLength ?? UINT32_MAX;
30084
- this.maxMapLength = options?.maxMapLength ?? UINT32_MAX;
30085
- this.maxExtLength = options?.maxExtLength ?? UINT32_MAX;
30086
- this.keyDecoder = options?.keyDecoder !== void 0 ? options.keyDecoder : sharedCachedKeyDecoder;
30087
- this.mapKeyConverter = options?.mapKeyConverter ?? mapKeyConverter;
30088
- }
30089
- clone() {
30090
- return new _Decoder({
30091
- extensionCodec: this.extensionCodec,
30092
- context: this.context,
30093
- useBigInt64: this.useBigInt64,
30094
- rawStrings: this.rawStrings,
30095
- maxStrLength: this.maxStrLength,
30096
- maxBinLength: this.maxBinLength,
30097
- maxArrayLength: this.maxArrayLength,
30098
- maxMapLength: this.maxMapLength,
30099
- maxExtLength: this.maxExtLength,
30100
- keyDecoder: this.keyDecoder
30101
- });
30102
- }
30103
- reinitializeState() {
30104
- this.totalPos = 0;
30105
- this.headByte = HEAD_BYTE_REQUIRED;
30106
- this.stack.reset();
30107
- }
30108
- setBuffer(buffer) {
30109
- const bytes = ensureUint8Array(buffer);
30110
- this.bytes = bytes;
30111
- this.view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
30112
- this.pos = 0;
30113
- }
30114
- appendBuffer(buffer) {
30115
- if (this.headByte === HEAD_BYTE_REQUIRED && !this.hasRemaining(1)) {
30116
- this.setBuffer(buffer);
30117
- } else {
30118
- const remainingData = this.bytes.subarray(this.pos);
30119
- const newData = ensureUint8Array(buffer);
30120
- const newBuffer = new Uint8Array(remainingData.length + newData.length);
30121
- newBuffer.set(remainingData);
30122
- newBuffer.set(newData, remainingData.length);
30123
- this.setBuffer(newBuffer);
30124
- }
30125
- }
30126
- hasRemaining(size) {
30127
- return this.view.byteLength - this.pos >= size;
30128
- }
30129
- createExtraByteError(posToShow) {
30130
- const { view, pos } = this;
30131
- return new RangeError(`Extra ${view.byteLength - pos} of ${view.byteLength} byte(s) found at buffer[${posToShow}]`);
30132
- }
30133
- /**
30134
- * @throws {@link DecodeError}
30135
- * @throws {@link RangeError}
30136
- */
30137
- decode(buffer) {
30138
- if (this.entered) {
30139
- const instance = this.clone();
30140
- return instance.decode(buffer);
30141
- }
30142
- try {
30143
- this.entered = true;
30144
- this.reinitializeState();
30145
- this.setBuffer(buffer);
30146
- const object = this.doDecodeSync();
30147
- if (this.hasRemaining(1)) {
30148
- throw this.createExtraByteError(this.pos);
30149
- }
30150
- return object;
30151
- } finally {
30152
- this.entered = false;
30153
- }
30154
- }
30155
- *decodeMulti(buffer) {
30156
- if (this.entered) {
30157
- const instance = this.clone();
30158
- yield* instance.decodeMulti(buffer);
30159
- return;
30160
- }
30161
- try {
30162
- this.entered = true;
30163
- this.reinitializeState();
30164
- this.setBuffer(buffer);
30165
- while (this.hasRemaining(1)) {
30166
- yield this.doDecodeSync();
30167
- }
30168
- } finally {
30169
- this.entered = false;
30170
- }
30171
- }
30172
- async decodeAsync(stream) {
30173
- if (this.entered) {
30174
- const instance = this.clone();
30175
- return instance.decodeAsync(stream);
30176
- }
30177
- try {
30178
- this.entered = true;
30179
- let decoded = false;
30180
- let object;
30181
- for await (const buffer of stream) {
30182
- if (decoded) {
30183
- this.entered = false;
30184
- throw this.createExtraByteError(this.totalPos);
30185
- }
30186
- this.appendBuffer(buffer);
30187
- try {
30188
- object = this.doDecodeSync();
30189
- decoded = true;
30190
- } catch (e) {
30191
- if (!(e instanceof RangeError)) {
30192
- throw e;
30193
- }
30194
- }
30195
- this.totalPos += this.pos;
30196
- }
30197
- if (decoded) {
30198
- if (this.hasRemaining(1)) {
30199
- throw this.createExtraByteError(this.totalPos);
30200
- }
30201
- return object;
30202
- }
30203
- const { headByte, pos, totalPos } = this;
30204
- throw new RangeError(`Insufficient data in parsing ${prettyByte(headByte)} at ${totalPos} (${pos} in the current buffer)`);
30205
- } finally {
30206
- this.entered = false;
30207
- }
30208
- }
30209
- decodeArrayStream(stream) {
30210
- return this.decodeMultiAsync(stream, true);
30211
- }
30212
- decodeStream(stream) {
30213
- return this.decodeMultiAsync(stream, false);
30214
- }
30215
- async *decodeMultiAsync(stream, isArray) {
30216
- if (this.entered) {
30217
- const instance = this.clone();
30218
- yield* instance.decodeMultiAsync(stream, isArray);
30219
- return;
30220
- }
30221
- try {
30222
- this.entered = true;
30223
- let isArrayHeaderRequired = isArray;
30224
- let arrayItemsLeft = -1;
30225
- for await (const buffer of stream) {
30226
- if (isArray && arrayItemsLeft === 0) {
30227
- throw this.createExtraByteError(this.totalPos);
30228
- }
30229
- this.appendBuffer(buffer);
30230
- if (isArrayHeaderRequired) {
30231
- arrayItemsLeft = this.readArraySize();
30232
- isArrayHeaderRequired = false;
30233
- this.complete();
30234
- }
30235
- try {
30236
- while (true) {
30237
- yield this.doDecodeSync();
30238
- if (--arrayItemsLeft === 0) {
30239
- break;
30240
- }
30241
- }
30242
- } catch (e) {
30243
- if (!(e instanceof RangeError)) {
30244
- throw e;
30245
- }
30246
- }
30247
- this.totalPos += this.pos;
30248
- }
30249
- } finally {
30250
- this.entered = false;
30251
- }
30252
- }
30253
- doDecodeSync() {
30254
- DECODE: while (true) {
30255
- const headByte = this.readHeadByte();
30256
- let object;
30257
- if (headByte >= 224) {
30258
- object = headByte - 256;
30259
- } else if (headByte < 192) {
30260
- if (headByte < 128) {
30261
- object = headByte;
30262
- } else if (headByte < 144) {
30263
- const size = headByte - 128;
30264
- if (size !== 0) {
30265
- this.pushMapState(size);
30266
- this.complete();
30267
- continue DECODE;
30268
- } else {
30269
- object = {};
30270
- }
30271
- } else if (headByte < 160) {
30272
- const size = headByte - 144;
30273
- if (size !== 0) {
30274
- this.pushArrayState(size);
30275
- this.complete();
30276
- continue DECODE;
30277
- } else {
30278
- object = [];
30279
- }
30280
- } else {
30281
- const byteLength = headByte - 160;
30282
- object = this.decodeString(byteLength, 0);
30283
- }
30284
- } else if (headByte === 192) {
30285
- object = null;
30286
- } else if (headByte === 194) {
30287
- object = false;
30288
- } else if (headByte === 195) {
30289
- object = true;
30290
- } else if (headByte === 202) {
30291
- object = this.readF32();
30292
- } else if (headByte === 203) {
30293
- object = this.readF64();
30294
- } else if (headByte === 204) {
30295
- object = this.readU8();
30296
- } else if (headByte === 205) {
30297
- object = this.readU16();
30298
- } else if (headByte === 206) {
30299
- object = this.readU32();
30300
- } else if (headByte === 207) {
30301
- if (this.useBigInt64) {
30302
- object = this.readU64AsBigInt();
30303
- } else {
30304
- object = this.readU64();
30305
- }
30306
- } else if (headByte === 208) {
30307
- object = this.readI8();
30308
- } else if (headByte === 209) {
30309
- object = this.readI16();
30310
- } else if (headByte === 210) {
30311
- object = this.readI32();
30312
- } else if (headByte === 211) {
30313
- if (this.useBigInt64) {
30314
- object = this.readI64AsBigInt();
30315
- } else {
30316
- object = this.readI64();
30317
- }
30318
- } else if (headByte === 217) {
30319
- const byteLength = this.lookU8();
30320
- object = this.decodeString(byteLength, 1);
30321
- } else if (headByte === 218) {
30322
- const byteLength = this.lookU16();
30323
- object = this.decodeString(byteLength, 2);
30324
- } else if (headByte === 219) {
30325
- const byteLength = this.lookU32();
30326
- object = this.decodeString(byteLength, 4);
30327
- } else if (headByte === 220) {
30328
- const size = this.readU16();
30329
- if (size !== 0) {
30330
- this.pushArrayState(size);
30331
- this.complete();
30332
- continue DECODE;
30333
- } else {
30334
- object = [];
30335
- }
30336
- } else if (headByte === 221) {
30337
- const size = this.readU32();
30338
- if (size !== 0) {
30339
- this.pushArrayState(size);
30340
- this.complete();
30341
- continue DECODE;
30342
- } else {
30343
- object = [];
30344
- }
30345
- } else if (headByte === 222) {
30346
- const size = this.readU16();
30347
- if (size !== 0) {
30348
- this.pushMapState(size);
30349
- this.complete();
30350
- continue DECODE;
30351
- } else {
30352
- object = {};
30353
- }
30354
- } else if (headByte === 223) {
30355
- const size = this.readU32();
30356
- if (size !== 0) {
30357
- this.pushMapState(size);
30358
- this.complete();
30359
- continue DECODE;
30360
- } else {
30361
- object = {};
30362
- }
30363
- } else if (headByte === 196) {
30364
- const size = this.lookU8();
30365
- object = this.decodeBinary(size, 1);
30366
- } else if (headByte === 197) {
30367
- const size = this.lookU16();
30368
- object = this.decodeBinary(size, 2);
30369
- } else if (headByte === 198) {
30370
- const size = this.lookU32();
30371
- object = this.decodeBinary(size, 4);
30372
- } else if (headByte === 212) {
30373
- object = this.decodeExtension(1, 0);
30374
- } else if (headByte === 213) {
30375
- object = this.decodeExtension(2, 0);
30376
- } else if (headByte === 214) {
30377
- object = this.decodeExtension(4, 0);
30378
- } else if (headByte === 215) {
30379
- object = this.decodeExtension(8, 0);
30380
- } else if (headByte === 216) {
30381
- object = this.decodeExtension(16, 0);
30382
- } else if (headByte === 199) {
30383
- const size = this.lookU8();
30384
- object = this.decodeExtension(size, 1);
30385
- } else if (headByte === 200) {
30386
- const size = this.lookU16();
30387
- object = this.decodeExtension(size, 2);
30388
- } else if (headByte === 201) {
30389
- const size = this.lookU32();
30390
- object = this.decodeExtension(size, 4);
30391
- } else {
30392
- throw new DecodeError(`Unrecognized type byte: ${prettyByte(headByte)}`);
30393
- }
30394
- this.complete();
30395
- const stack = this.stack;
30396
- while (stack.length > 0) {
30397
- const state = stack.top();
30398
- if (state.type === STATE_ARRAY) {
30399
- state.array[state.position] = object;
30400
- state.position++;
30401
- if (state.position === state.size) {
30402
- object = state.array;
30403
- stack.release(state);
30404
- } else {
30405
- continue DECODE;
30406
- }
30407
- } else if (state.type === STATE_MAP_KEY) {
30408
- if (object === "__proto__") {
30409
- throw new DecodeError("The key __proto__ is not allowed");
30410
- }
30411
- state.key = this.mapKeyConverter(object);
30412
- state.type = STATE_MAP_VALUE;
30413
- continue DECODE;
30414
- } else {
30415
- state.map[state.key] = object;
30416
- state.readCount++;
30417
- if (state.readCount === state.size) {
30418
- object = state.map;
30419
- stack.release(state);
30420
- } else {
30421
- state.key = null;
30422
- state.type = STATE_MAP_KEY;
30423
- continue DECODE;
30424
- }
30425
- }
30426
- }
30427
- return object;
30428
- }
30429
- }
30430
- readHeadByte() {
30431
- if (this.headByte === HEAD_BYTE_REQUIRED) {
30432
- this.headByte = this.readU8();
30433
- }
30434
- return this.headByte;
30435
- }
30436
- complete() {
30437
- this.headByte = HEAD_BYTE_REQUIRED;
30438
- }
30439
- readArraySize() {
30440
- const headByte = this.readHeadByte();
30441
- switch (headByte) {
30442
- case 220:
30443
- return this.readU16();
30444
- case 221:
30445
- return this.readU32();
30446
- default: {
30447
- if (headByte < 160) {
30448
- return headByte - 144;
30449
- } else {
30450
- throw new DecodeError(`Unrecognized array type byte: ${prettyByte(headByte)}`);
30451
- }
30452
- }
30453
- }
30454
- }
30455
- pushMapState(size) {
30456
- if (size > this.maxMapLength) {
30457
- throw new DecodeError(`Max length exceeded: map length (${size}) > maxMapLengthLength (${this.maxMapLength})`);
30458
- }
30459
- this.stack.pushMapState(size);
30460
- }
30461
- pushArrayState(size) {
30462
- if (size > this.maxArrayLength) {
30463
- throw new DecodeError(`Max length exceeded: array length (${size}) > maxArrayLength (${this.maxArrayLength})`);
30464
- }
30465
- this.stack.pushArrayState(size);
30466
- }
30467
- decodeString(byteLength, headerOffset) {
30468
- if (!this.rawStrings || this.stateIsMapKey()) {
30469
- return this.decodeUtf8String(byteLength, headerOffset);
30470
- }
30471
- return this.decodeBinary(byteLength, headerOffset);
30472
- }
30473
- /**
30474
- * @throws {@link RangeError}
30475
- */
30476
- decodeUtf8String(byteLength, headerOffset) {
30477
- if (byteLength > this.maxStrLength) {
30478
- throw new DecodeError(`Max length exceeded: UTF-8 byte length (${byteLength}) > maxStrLength (${this.maxStrLength})`);
30479
- }
30480
- if (this.bytes.byteLength < this.pos + headerOffset + byteLength) {
30481
- throw MORE_DATA;
30482
- }
30483
- const offset = this.pos + headerOffset;
30484
- let object;
30485
- if (this.stateIsMapKey() && this.keyDecoder?.canBeCached(byteLength)) {
30486
- object = this.keyDecoder.decode(this.bytes, offset, byteLength);
30487
- } else {
30488
- object = utf8Decode(this.bytes, offset, byteLength);
30489
- }
30490
- this.pos += headerOffset + byteLength;
30491
- return object;
30492
- }
30493
- stateIsMapKey() {
30494
- if (this.stack.length > 0) {
30495
- const state = this.stack.top();
30496
- return state.type === STATE_MAP_KEY;
30497
- }
30498
- return false;
30499
- }
30500
- /**
30501
- * @throws {@link RangeError}
30502
- */
30503
- decodeBinary(byteLength, headOffset) {
30504
- if (byteLength > this.maxBinLength) {
30505
- throw new DecodeError(`Max length exceeded: bin length (${byteLength}) > maxBinLength (${this.maxBinLength})`);
30506
- }
30507
- if (!this.hasRemaining(byteLength + headOffset)) {
30508
- throw MORE_DATA;
30509
- }
30510
- const offset = this.pos + headOffset;
30511
- const object = this.bytes.subarray(offset, offset + byteLength);
30512
- this.pos += headOffset + byteLength;
30513
- return object;
30514
- }
30515
- decodeExtension(size, headOffset) {
30516
- if (size > this.maxExtLength) {
30517
- throw new DecodeError(`Max length exceeded: ext length (${size}) > maxExtLength (${this.maxExtLength})`);
30518
- }
30519
- const extType = this.view.getInt8(this.pos + headOffset);
30520
- const data = this.decodeBinary(
30521
- size,
30522
- headOffset + 1
30523
- /* extType */
30524
- );
30525
- return this.extensionCodec.decode(data, extType, this.context);
30526
- }
30527
- lookU8() {
30528
- return this.view.getUint8(this.pos);
30529
- }
30530
- lookU16() {
30531
- return this.view.getUint16(this.pos);
30532
- }
30533
- lookU32() {
30534
- return this.view.getUint32(this.pos);
30535
- }
30536
- readU8() {
30537
- const value = this.view.getUint8(this.pos);
30538
- this.pos++;
30539
- return value;
30540
- }
30541
- readI8() {
30542
- const value = this.view.getInt8(this.pos);
30543
- this.pos++;
30544
- return value;
30545
- }
30546
- readU16() {
30547
- const value = this.view.getUint16(this.pos);
30548
- this.pos += 2;
30549
- return value;
30550
- }
30551
- readI16() {
30552
- const value = this.view.getInt16(this.pos);
30553
- this.pos += 2;
30554
- return value;
30555
- }
30556
- readU32() {
30557
- const value = this.view.getUint32(this.pos);
30558
- this.pos += 4;
30559
- return value;
30560
- }
30561
- readI32() {
30562
- const value = this.view.getInt32(this.pos);
30563
- this.pos += 4;
30564
- return value;
30565
- }
30566
- readU64() {
30567
- const value = getUint64(this.view, this.pos);
30568
- this.pos += 8;
30569
- return value;
30570
- }
30571
- readI64() {
30572
- const value = getInt64(this.view, this.pos);
30573
- this.pos += 8;
30574
- return value;
30575
- }
30576
- readU64AsBigInt() {
30577
- const value = this.view.getBigUint64(this.pos);
30578
- this.pos += 8;
30579
- return value;
30580
- }
30581
- readI64AsBigInt() {
30582
- const value = this.view.getBigInt64(this.pos);
30583
- this.pos += 8;
30584
- return value;
30585
- }
30586
- readF32() {
30587
- const value = this.view.getFloat32(this.pos);
30588
- this.pos += 4;
30589
- return value;
30590
- }
30591
- readF64() {
30592
- const value = this.view.getFloat64(this.pos);
30593
- this.pos += 8;
30594
- return value;
30595
- }
30596
- };
30597
-
30598
- // src/vendor/titan/client.ts
30599
29168
  var SUBPROTOCOL = "v1.api.titan.ag";
30600
29169
  var UINT64_MAX = (1n << 64n) - 1n;
30601
29170
  function toBigInt(value) {
@@ -30648,8 +29217,8 @@ var StreamError = class _StreamError extends Error {
30648
29217
  this.errorMessage = message;
30649
29218
  }
30650
29219
  };
30651
- var encoder = new Encoder({ useBigInt64: true });
30652
- var decoder = new Decoder({ useBigInt64: true });
29220
+ var encoder = new msgpack.Encoder({ useBigInt64: true });
29221
+ var decoder = new msgpack.Decoder({ useBigInt64: true });
30653
29222
  var V1Client = class _V1Client {
30654
29223
  socket;
30655
29224
  nextId = 0;