@moqtap/codec 0.6.0 → 0.8.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.
Files changed (82) hide show
  1. package/README.md +28 -2
  2. package/dist/{chunk-CXFAQKL3.js → chunk-23KRITJ6.js} +1 -1
  3. package/dist/{chunk-JL3NEW3O.cjs → chunk-4XLYCT5Q.cjs} +90 -1
  4. package/dist/{chunk-DLSGOZ6P.js → chunk-5XZKO2U5.js} +34 -34
  5. package/dist/{chunk-62LYLROG.js → chunk-APTV6F72.js} +35 -35
  6. package/dist/{chunk-JB5VDJ2V.cjs → chunk-B56AG5HU.cjs} +37 -37
  7. package/dist/{chunk-JTRU76JN.cjs → chunk-BQHLUT37.cjs} +109 -111
  8. package/dist/{chunk-4HBKHNU2.cjs → chunk-CZNW3R5E.cjs} +37 -37
  9. package/dist/{chunk-OGZTQA24.cjs → chunk-EQAYMCXO.cjs} +64 -64
  10. package/dist/{chunk-HYI6LFMD.js → chunk-HEO2JG6C.js} +1 -1
  11. package/dist/{chunk-UP4XPH4J.js → chunk-I55J3KXD.js} +31 -31
  12. package/dist/{chunk-HZHSO7EW.cjs → chunk-IDV2JYJ6.cjs} +39 -39
  13. package/dist/{chunk-BAG6YWCP.cjs → chunk-IEJULBKB.cjs} +63 -63
  14. package/dist/{chunk-Y6KCSM3V.js → chunk-IJAF6PAY.js} +1 -1
  15. package/dist/{chunk-WMJVSBBE.cjs → chunk-J3ASFPCX.cjs} +57 -57
  16. package/dist/{chunk-Q5D6OW6Q.js → chunk-JJEN2VG5.js} +51 -53
  17. package/dist/{chunk-COWGGUL4.js → chunk-JKMYAUGY.js} +1 -1
  18. package/dist/{chunk-SIYYMFCC.cjs → chunk-KCH4BQXK.cjs} +37 -37
  19. package/dist/{chunk-VOU7PNHI.js → chunk-KLPWJU6W.js} +89 -0
  20. package/dist/{chunk-NZ7GYEMT.js → chunk-KNLPX3YA.js} +1 -1
  21. package/dist/{chunk-A33U4WVS.cjs → chunk-KTVN4P6J.cjs} +67 -67
  22. package/dist/{chunk-7KBAWOBA.js → chunk-KYVTM5VI.js} +1 -1
  23. package/dist/{chunk-RZ3UML47.js → chunk-MD2OA7SE.js} +1 -1
  24. package/dist/{chunk-MSG2FXJ2.cjs → chunk-MH7537FB.cjs} +68 -68
  25. package/dist/{chunk-SHMA4PBY.js → chunk-N2V7Z37J.js} +1 -1
  26. package/dist/{chunk-HO44OANK.cjs → chunk-QGIHC6BA.cjs} +36 -36
  27. package/dist/{chunk-PKEOQSSZ.cjs → chunk-RIIA4ALQ.cjs} +37 -37
  28. package/dist/{chunk-XZE5R57R.cjs → chunk-VZHL2U2N.cjs} +37 -37
  29. package/dist/{chunk-RW4UG7CN.js → chunk-XHAP2YST.js} +1 -1
  30. package/dist/{codec-B1snaM9L.d.cts → codec-BnamSx7L.d.cts} +1 -1
  31. package/dist/{codec-D49OofBr.d.ts → codec-CFhUGTu2.d.ts} +1 -1
  32. package/dist/draft07.cjs +4 -4
  33. package/dist/draft07.js +2 -2
  34. package/dist/draft08.cjs +3 -3
  35. package/dist/draft08.js +2 -2
  36. package/dist/draft09.cjs +3 -3
  37. package/dist/draft09.js +2 -2
  38. package/dist/draft10.cjs +3 -3
  39. package/dist/draft10.js +2 -2
  40. package/dist/draft11.cjs +3 -3
  41. package/dist/draft11.js +2 -2
  42. package/dist/draft12.cjs +3 -3
  43. package/dist/draft12.js +2 -2
  44. package/dist/draft13.cjs +3 -3
  45. package/dist/draft13.js +2 -2
  46. package/dist/draft14-session.d.cts +1 -1
  47. package/dist/draft14-session.d.ts +1 -1
  48. package/dist/draft14.cjs +3 -3
  49. package/dist/draft14.d.cts +3 -3
  50. package/dist/draft14.d.ts +3 -3
  51. package/dist/draft14.js +2 -2
  52. package/dist/draft15.cjs +3 -3
  53. package/dist/draft15.js +2 -2
  54. package/dist/draft16.cjs +3 -3
  55. package/dist/draft16.js +2 -2
  56. package/dist/draft17.cjs +3 -3
  57. package/dist/draft17.js +2 -2
  58. package/dist/draft18.cjs +3 -3
  59. package/dist/draft18.js +2 -2
  60. package/dist/draft19.cjs +3 -3
  61. package/dist/draft19.js +2 -2
  62. package/dist/index.cjs +81 -29
  63. package/dist/index.d.cts +73 -3
  64. package/dist/index.d.ts +73 -3
  65. package/dist/index.js +67 -15
  66. package/dist/session.d.cts +1 -1
  67. package/dist/session.d.ts +1 -1
  68. package/dist/{types-DjmrHp_s.d.cts → types-CVeKIk7A.d.cts} +29 -21
  69. package/dist/{types-DjmrHp_s.d.ts → types-CVeKIk7A.d.ts} +29 -21
  70. package/package.json +2 -2
  71. package/src/core/accessors.ts +120 -0
  72. package/src/core/buffer-reader.ts +74 -2
  73. package/src/core/buffer-writer.ts +56 -4
  74. package/src/drafts/draft14/codec.ts +50 -52
  75. package/src/drafts/draft14/types.ts +31 -23
  76. package/src/drafts/draft17/codec.ts +2 -2
  77. package/src/drafts/draft17/data-streams.ts +2 -2
  78. package/src/drafts/draft18/codec.ts +2 -2
  79. package/src/drafts/draft18/data-streams.ts +2 -2
  80. package/src/drafts/draft19/codec.ts +2 -2
  81. package/src/drafts/draft19/data-streams.ts +2 -2
  82. package/src/index.ts +8 -0
@@ -1,10 +1,10 @@
1
1
  import {
2
- BufferReader,
3
- BufferWriter,
4
2
  DecodeError,
3
+ MoqtBufferReader,
4
+ MoqtBufferWriter,
5
5
  bytesToHex,
6
6
  hexToBytes
7
- } from "./chunk-VOU7PNHI.js";
7
+ } from "./chunk-KLPWJU6W.js";
8
8
 
9
9
  // src/drafts/draft19/messages.ts
10
10
  var MSG_REQUEST_UPDATE = 0x02n;
@@ -110,7 +110,7 @@ function isValidSubgroupType(streamType) {
110
110
  return (streamType & 6) !== 6;
111
111
  }
112
112
  function encodeSubgroupStream(stream) {
113
- const w = new BufferWriter();
113
+ const w = new MoqtBufferWriter();
114
114
  const streamType = stream.headerType;
115
115
  w.writeUint8(streamType);
116
116
  const propertiesPresent = (streamType & 1) !== 0;
@@ -131,7 +131,7 @@ function encodeSubgroupStream(stream) {
131
131
  w.writeVarInt(delta);
132
132
  if (propertiesPresent) {
133
133
  if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
134
- const tmpW = new BufferWriter(32);
134
+ const tmpW = new MoqtBufferWriter(32);
135
135
  encodeObjectProperties(obj.objectProperties, tmpW);
136
136
  const raw = tmpW.finish();
137
137
  w.writeVarInt(BigInt(raw.byteLength));
@@ -151,7 +151,7 @@ function encodeSubgroupStream(stream) {
151
151
  return w.finish();
152
152
  }
153
153
  function encodeDatagram(dg) {
154
- const w = new BufferWriter();
154
+ const w = new MoqtBufferWriter();
155
155
  const dgType = dg.datagramType;
156
156
  w.writeUint8(dgType);
157
157
  w.writeVarInt(dg.trackAlias);
@@ -168,7 +168,7 @@ function encodeDatagram(dg) {
168
168
  }
169
169
  if (propertiesPresent) {
170
170
  if (dg.objectProperties && Object.keys(dg.objectProperties).length > 0) {
171
- const tmpW = new BufferWriter(32);
171
+ const tmpW = new MoqtBufferWriter(32);
172
172
  encodeObjectProperties(dg.objectProperties, tmpW);
173
173
  const raw = tmpW.finish();
174
174
  w.writeVarInt(BigInt(raw.byteLength));
@@ -185,7 +185,7 @@ function encodeDatagram(dg) {
185
185
  return w.finish();
186
186
  }
187
187
  function encodeFetchStream(stream) {
188
- const w = new BufferWriter();
188
+ const w = new MoqtBufferWriter();
189
189
  w.writeVarInt(FETCH_STREAM_TYPE);
190
190
  w.writeVarInt(stream.requestId);
191
191
  let prevGroupId = 0n;
@@ -207,7 +207,7 @@ function encodeFetchStream(stream) {
207
207
  if (flags & 16) w.writeUint8(obj.publisherPriority);
208
208
  if (flags & 32) {
209
209
  if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
210
- const tmpW = new BufferWriter(32);
210
+ const tmpW = new MoqtBufferWriter(32);
211
211
  encodeObjectProperties(obj.objectProperties, tmpW);
212
212
  const raw = tmpW.finish();
213
213
  w.writeVarInt(BigInt(raw.byteLength));
@@ -231,7 +231,7 @@ function encodeFetchStream(stream) {
231
231
  if (flags & 16) w.writeUint8(obj.publisherPriority);
232
232
  if (flags & 32) {
233
233
  if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
234
- const tmpW = new BufferWriter(32);
234
+ const tmpW = new MoqtBufferWriter(32);
235
235
  encodeObjectProperties(obj.objectProperties, tmpW);
236
236
  const raw = tmpW.finish();
237
237
  w.writeVarInt(BigInt(raw.byteLength));
@@ -254,7 +254,7 @@ function encodeFetchStream(stream) {
254
254
  }
255
255
  function decodeSubgroupStream(bytes) {
256
256
  try {
257
- const r = new BufferReader(bytes);
257
+ const r = new MoqtBufferReader(bytes);
258
258
  const streamType = r.readUint8();
259
259
  if (!isValidSubgroupType(streamType)) {
260
260
  return {
@@ -357,7 +357,7 @@ function decodeSubgroupStream(bytes) {
357
357
  }
358
358
  function decodeDatagram(bytes) {
359
359
  try {
360
- const r = new BufferReader(bytes);
360
+ const r = new MoqtBufferReader(bytes);
361
361
  const dgType = r.readUint8();
362
362
  const objectIdAbsent = (dgType & 4) !== 0;
363
363
  const endOfGroup = (dgType & 2) !== 0;
@@ -413,7 +413,7 @@ function decodeDatagram(bytes) {
413
413
  }
414
414
  function decodeFetchStream(bytes) {
415
415
  try {
416
- const r = new BufferReader(bytes);
416
+ const r = new MoqtBufferReader(bytes);
417
417
  const streamType = r.readVarInt();
418
418
  if (streamType !== FETCH_STREAM_TYPE) {
419
419
  return {
@@ -661,7 +661,7 @@ function createSubgroupStreamDecoder() {
661
661
  buffer = newBuffer;
662
662
  if (!headerEmitted) {
663
663
  try {
664
- const r = new BufferReader(buffer.subarray(offset));
664
+ const r = new MoqtBufferReader(buffer.subarray(offset));
665
665
  const streamType = r.readUint8();
666
666
  if (!isValidSubgroupType(streamType)) {
667
667
  controller.error(
@@ -706,7 +706,7 @@ function createSubgroupStreamDecoder() {
706
706
  }
707
707
  while (offset < buffer.length) {
708
708
  try {
709
- const r = new BufferReader(buffer.subarray(offset));
709
+ const r = new MoqtBufferReader(buffer.subarray(offset));
710
710
  const delta = r.readVarInt();
711
711
  let objectId;
712
712
  if (firstObject) {
@@ -766,7 +766,7 @@ function createFetchStreamDecoder() {
766
766
  buffer = newBuffer;
767
767
  if (!headerEmitted) {
768
768
  try {
769
- const r = new BufferReader(buffer.subarray(offset));
769
+ const r = new MoqtBufferReader(buffer.subarray(offset));
770
770
  const streamType = r.readVarInt();
771
771
  if (streamType !== FETCH_STREAM_TYPE) {
772
772
  controller.error(
@@ -792,7 +792,7 @@ function createFetchStreamDecoder() {
792
792
  }
793
793
  while (offset < buffer.length) {
794
794
  try {
795
- const r = new BufferReader(buffer.subarray(offset));
795
+ const r = new MoqtBufferReader(buffer.subarray(offset));
796
796
  const flags = Number(r.readVarInt());
797
797
  const objectIdPresent = (flags & 4) !== 0;
798
798
  const groupIdPresent = (flags & 8) !== 0;
@@ -941,7 +941,7 @@ function encodeSetupOptions(opts, writer) {
941
941
  entries.push({
942
942
  type: SETUP_OPT_AUTHORIZATION_TOKEN,
943
943
  encode: (w) => {
944
- const tmpW = new BufferWriter(64);
944
+ const tmpW = new MoqtBufferWriter(64);
945
945
  encodeAuthorizationToken(opts.authorization_token, tmpW);
946
946
  const raw = tmpW.finish();
947
947
  w.writeVarInt(BigInt(raw.byteLength));
@@ -995,7 +995,7 @@ function encodeSetupOptions(opts, writer) {
995
995
  encode: (w) => {
996
996
  if (id % 2n === 0n) {
997
997
  const raw = hexToBytes(u.raw_hex);
998
- const tmpReader = new BufferReader(raw);
998
+ const tmpReader = new MoqtBufferReader(raw);
999
999
  w.writeVarInt(tmpReader.readVarInt());
1000
1000
  } else {
1001
1001
  const raw = hexToBytes(u.raw_hex);
@@ -1031,7 +1031,7 @@ function decodeSetupOptions(reader, payloadEnd) {
1031
1031
  } else if (optType === SETUP_OPT_MAX_REQUEST_UPDATES) {
1032
1032
  result.max_request_updates = value;
1033
1033
  } else {
1034
- const tmpWriter = new BufferWriter(16);
1034
+ const tmpWriter = new MoqtBufferWriter(16);
1035
1035
  tmpWriter.writeVarInt(value);
1036
1036
  const raw = tmpWriter.finish();
1037
1037
  unknown.push({
@@ -1046,7 +1046,7 @@ function decodeSetupOptions(reader, payloadEnd) {
1046
1046
  if (optType === SETUP_OPT_PATH) {
1047
1047
  result.path = textDecoder.decode(bytes);
1048
1048
  } else if (optType === SETUP_OPT_AUTHORIZATION_TOKEN) {
1049
- result.authorization_token = decodeAuthorizationToken(new BufferReader(bytes));
1049
+ result.authorization_token = decodeAuthorizationToken(new MoqtBufferReader(bytes));
1050
1050
  } else if (optType === SETUP_OPT_AUTHORITY) {
1051
1051
  result.authority = textDecoder.decode(bytes);
1052
1052
  } else if (optType === SETUP_OPT_MOQT_IMPLEMENTATION) {
@@ -1131,7 +1131,7 @@ function encodeRangeFilter(filter, hasProperty, w) {
1131
1131
  w.writeVarInt(0n);
1132
1132
  return;
1133
1133
  }
1134
- const tmpW = new BufferWriter(32);
1134
+ const tmpW = new MoqtBufferWriter(32);
1135
1135
  tmpW.writeUint8(Number(filter.set_id ?? 0n));
1136
1136
  if (hasProperty) {
1137
1137
  tmpW.writeVarInt(filter.property_type ?? 0n);
@@ -1185,7 +1185,7 @@ function encodeParams(params, writer) {
1185
1185
  entries.push({
1186
1186
  type: PARAM_AUTHORIZATION_TOKEN,
1187
1187
  encode: (w) => {
1188
- const tmpW = new BufferWriter(64);
1188
+ const tmpW = new MoqtBufferWriter(64);
1189
1189
  encodeAuthorizationToken(params.authorization_token, tmpW);
1190
1190
  const raw = tmpW.finish();
1191
1191
  w.writeVarInt(BigInt(raw.byteLength));
@@ -1215,7 +1215,7 @@ function encodeParams(params, writer) {
1215
1215
  entries.push({
1216
1216
  type: PARAM_LARGEST_OBJECT,
1217
1217
  encode: (w) => {
1218
- const tmpW = new BufferWriter(16);
1218
+ const tmpW = new MoqtBufferWriter(16);
1219
1219
  tmpW.writeVarInt(params.largest_object.group);
1220
1220
  tmpW.writeVarInt(params.largest_object.object);
1221
1221
  const raw = tmpW.finish();
@@ -1247,7 +1247,7 @@ function encodeParams(params, writer) {
1247
1247
  type: PARAM_LOCATION_FILTER,
1248
1248
  encode: (w) => {
1249
1249
  const f = params.location_filter;
1250
- const tmpW = new BufferWriter(32);
1250
+ const tmpW = new MoqtBufferWriter(32);
1251
1251
  tmpW.writeVarInt(f.filter_type);
1252
1252
  if (f.filter_type === 3n || f.filter_type === 4n) {
1253
1253
  tmpW.writeVarInt(f.start_group);
@@ -1308,7 +1308,7 @@ function encodeParams(params, writer) {
1308
1308
  entries.push({
1309
1309
  type: PARAM_TRACK_NAMESPACE_PREFIX,
1310
1310
  encode: (w) => {
1311
- const tmpW = new BufferWriter(32);
1311
+ const tmpW = new MoqtBufferWriter(32);
1312
1312
  encodeNamespaceTuple(params.track_namespace_prefix, tmpW);
1313
1313
  const raw = tmpW.finish();
1314
1314
  w.writeVarInt(BigInt(raw.byteLength));
@@ -1351,7 +1351,7 @@ function decodeParams(reader) {
1351
1351
  } else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
1352
1352
  const length = Number(reader.readVarInt());
1353
1353
  const bytes = reader.readBytes(length);
1354
- result.authorization_token = decodeAuthorizationToken(new BufferReader(bytes));
1354
+ result.authorization_token = decodeAuthorizationToken(new MoqtBufferReader(bytes));
1355
1355
  } else if (paramType === PARAM_RENDEZVOUS_TIMEOUT) {
1356
1356
  result.rendezvous_timeout = reader.readVarInt();
1357
1357
  } else if (paramType === PARAM_SUBGROUP_DELIVERY_TIMEOUT) {
@@ -1404,11 +1404,11 @@ function decodeParams(reader) {
1404
1404
  } else if (paramType === PARAM_TRACK_NAMESPACE_PREFIX) {
1405
1405
  const length = Number(reader.readVarInt());
1406
1406
  const bytes = reader.readBytes(length);
1407
- result.track_namespace_prefix = decodeNamespaceTuple(new BufferReader(bytes));
1407
+ result.track_namespace_prefix = decodeNamespaceTuple(new MoqtBufferReader(bytes));
1408
1408
  } else {
1409
1409
  if (paramType % 2n === 0n) {
1410
1410
  const value = reader.readVarInt();
1411
- const tmpWriter = new BufferWriter(16);
1411
+ const tmpWriter = new MoqtBufferWriter(16);
1412
1412
  tmpWriter.writeVarInt(value);
1413
1413
  const raw = tmpWriter.finish();
1414
1414
  unknown.push({
@@ -1493,7 +1493,7 @@ function encodeTrackProperties(props, writer) {
1493
1493
  encode: (w) => {
1494
1494
  if (id % 2n === 0n) {
1495
1495
  const raw = hexToBytes(u.raw_hex);
1496
- const tmpReader = new BufferReader(raw);
1496
+ const tmpReader = new MoqtBufferReader(raw);
1497
1497
  w.writeVarInt(tmpReader.readVarInt());
1498
1498
  } else {
1499
1499
  const raw = hexToBytes(u.raw_hex);
@@ -1535,7 +1535,7 @@ function decodeTrackProperties(reader, payloadEnd) {
1535
1535
  } else if (propType === TPROP_DYNAMIC_GROUPS) {
1536
1536
  result.dynamic_groups = value;
1537
1537
  } else {
1538
- const tmpWriter = new BufferWriter(16);
1538
+ const tmpWriter = new MoqtBufferWriter(16);
1539
1539
  tmpWriter.writeVarInt(value);
1540
1540
  const raw = tmpWriter.finish();
1541
1541
  unknown.push({
@@ -1874,13 +1874,13 @@ function encodeMessage(message) {
1874
1874
  if (typeId === void 0) {
1875
1875
  throw new Error(`Unknown message type: ${message.type}`);
1876
1876
  }
1877
- const payloadWriter = new BufferWriter();
1877
+ const payloadWriter = new MoqtBufferWriter();
1878
1878
  encodePayload(message, payloadWriter);
1879
1879
  const payload = payloadWriter.finishView();
1880
1880
  if (payload.byteLength > 65535) {
1881
1881
  throw new Error(`Payload too large for 16-bit length: ${payload.byteLength}`);
1882
1882
  }
1883
- const writer = new BufferWriter(payload.byteLength + 16);
1883
+ const writer = new MoqtBufferWriter(payload.byteLength + 16);
1884
1884
  writer.writeVarInt(typeId);
1885
1885
  writer.writeUint8(payload.byteLength >> 8 & 255);
1886
1886
  writer.writeUint8(payload.byteLength & 255);
@@ -1933,13 +1933,13 @@ function encodePayload(msg, w) {
1933
1933
  }
1934
1934
  function decodeMessage(bytes) {
1935
1935
  try {
1936
- const reader = new BufferReader(bytes);
1936
+ const reader = new MoqtBufferReader(bytes);
1937
1937
  const typeId = reader.readVarInt();
1938
1938
  const lenHi = reader.readUint8();
1939
1939
  const lenLo = reader.readUint8();
1940
1940
  const payloadLength = lenHi << 8 | lenLo;
1941
1941
  const payloadBytes = reader.readBytes(payloadLength);
1942
- const payloadReader = new BufferReader(payloadBytes);
1942
+ const payloadReader = new MoqtBufferReader(payloadBytes);
1943
1943
  let message;
1944
1944
  if (typeId === MSG_SETUP) {
1945
1945
  message = decodeSetupPayload(payloadReader, payloadLength);
@@ -4,12 +4,12 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkJL3NEW3Ocjs = require('./chunk-JL3NEW3O.cjs');
7
+ var _chunk4XLYCT5Qcjs = require('./chunk-4XLYCT5Q.cjs');
8
8
 
9
9
  // src/drafts/draft12/data-streams.ts
10
10
  var FETCH_STREAM_TYPE = 0x05n;
11
11
  function encodeSubgroupStream(stream) {
12
- const w = new (0, _chunkJL3NEW3Ocjs.BufferWriter)();
12
+ const w = new (0, _chunk4XLYCT5Qcjs.BufferWriter)();
13
13
  const typeId = stream.streamTypeId;
14
14
  w.writeVarInt(BigInt(typeId));
15
15
  const extensionsPresent = (typeId & 1) !== 0;
@@ -34,7 +34,7 @@ function encodeSubgroupStream(stream) {
34
34
  return w.finish();
35
35
  }
36
36
  function encodeDatagram(dg) {
37
- const w = new (0, _chunkJL3NEW3Ocjs.BufferWriter)();
37
+ const w = new (0, _chunk4XLYCT5Qcjs.BufferWriter)();
38
38
  w.writeVarInt(BigInt(dg.streamTypeId));
39
39
  w.writeVarInt(dg.trackAlias);
40
40
  w.writeVarInt(dg.groupId);
@@ -55,7 +55,7 @@ function encodeDatagram(dg) {
55
55
  return w.finish();
56
56
  }
57
57
  function encodeFetchStream(stream) {
58
- const w = new (0, _chunkJL3NEW3Ocjs.BufferWriter)();
58
+ const w = new (0, _chunk4XLYCT5Qcjs.BufferWriter)();
59
59
  w.writeVarInt(FETCH_STREAM_TYPE);
60
60
  w.writeVarInt(stream.requestId);
61
61
  for (const obj of stream.objects) {
@@ -77,14 +77,14 @@ function encodeFetchStream(stream) {
77
77
  }
78
78
  function decodeSubgroupStream(bytes) {
79
79
  try {
80
- const r = new (0, _chunkJL3NEW3Ocjs.BufferReader)(bytes);
80
+ const r = new (0, _chunk4XLYCT5Qcjs.BufferReader)(bytes);
81
81
  const streamTypeId = Number(r.readVarInt());
82
82
  const validRange1 = streamTypeId >= 16 && streamTypeId <= 21;
83
83
  const validRange2 = streamTypeId >= 24 && streamTypeId <= 29;
84
84
  if (!validRange1 && !validRange2) {
85
85
  return {
86
86
  ok: false,
87
- error: new (0, _chunkJL3NEW3Ocjs.DecodeError)(
87
+ error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
88
88
  "CONSTRAINT_VIOLATION",
89
89
  `Expected subgroup type 0x10-0x15 or 0x18-0x1D, got 0x${streamTypeId.toString(16)}`,
90
90
  0
@@ -154,18 +154,18 @@ function decodeSubgroupStream(bytes) {
154
154
  bytesRead: r.offset
155
155
  };
156
156
  } catch (e) {
157
- if (e instanceof _chunkJL3NEW3Ocjs.DecodeError) return { ok: false, error: e };
157
+ if (e instanceof _chunk4XLYCT5Qcjs.DecodeError) return { ok: false, error: e };
158
158
  throw e;
159
159
  }
160
160
  }
161
161
  function decodeDatagram(bytes) {
162
162
  try {
163
- const r = new (0, _chunkJL3NEW3Ocjs.BufferReader)(bytes);
163
+ const r = new (0, _chunk4XLYCT5Qcjs.BufferReader)(bytes);
164
164
  const streamTypeId = Number(r.readVarInt());
165
165
  if (streamTypeId < 0 || streamTypeId > 3) {
166
166
  return {
167
167
  ok: false,
168
- error: new (0, _chunkJL3NEW3Ocjs.DecodeError)(
168
+ error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
169
169
  "CONSTRAINT_VIOLATION",
170
170
  `Expected datagram type 0x00-0x03, got 0x${streamTypeId.toString(16)}`,
171
171
  0
@@ -210,18 +210,18 @@ function decodeDatagram(bytes) {
210
210
  result.objectStatus = objectStatus;
211
211
  return { ok: true, value: result, bytesRead: r.offset };
212
212
  } catch (e) {
213
- if (e instanceof _chunkJL3NEW3Ocjs.DecodeError) return { ok: false, error: e };
213
+ if (e instanceof _chunk4XLYCT5Qcjs.DecodeError) return { ok: false, error: e };
214
214
  throw e;
215
215
  }
216
216
  }
217
217
  function decodeFetchStream(bytes) {
218
218
  try {
219
- const r = new (0, _chunkJL3NEW3Ocjs.BufferReader)(bytes);
219
+ const r = new (0, _chunk4XLYCT5Qcjs.BufferReader)(bytes);
220
220
  const streamType = r.readVarInt();
221
221
  if (streamType !== FETCH_STREAM_TYPE) {
222
222
  return {
223
223
  ok: false,
224
- error: new (0, _chunkJL3NEW3Ocjs.DecodeError)(
224
+ error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
225
225
  "CONSTRAINT_VIOLATION",
226
226
  `Expected fetch type 0x05, got 0x${streamType.toString(16)}`,
227
227
  0
@@ -273,7 +273,7 @@ function decodeFetchStream(bytes) {
273
273
  bytesRead: r.offset
274
274
  };
275
275
  } catch (e) {
276
- if (e instanceof _chunkJL3NEW3Ocjs.DecodeError) return { ok: false, error: e };
276
+ if (e instanceof _chunk4XLYCT5Qcjs.DecodeError) return { ok: false, error: e };
277
277
  throw e;
278
278
  }
279
279
  }
@@ -390,7 +390,7 @@ function encodeSetupParams(params, w) {
390
390
  if (params.authorization_token !== void 0) {
391
391
  w.writeVarInt(PARAM_AUTHORIZATION_TOKEN);
392
392
  const at = params.authorization_token;
393
- const tmpW = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(64);
393
+ const tmpW = new (0, _chunk4XLYCT5Qcjs.BufferWriter)(64);
394
394
  tmpW.writeVarInt(at.alias_type);
395
395
  tmpW.writeVarInt(at.token_type);
396
396
  tmpW.writeBytes(at.token_value);
@@ -403,11 +403,11 @@ function encodeSetupParams(params, w) {
403
403
  const id = BigInt(u.id);
404
404
  w.writeVarInt(id);
405
405
  if (id % 2n === 0n) {
406
- const raw = _chunkJL3NEW3Ocjs.hexToBytes.call(void 0, u.raw_hex);
407
- const tmpReader = new (0, _chunkJL3NEW3Ocjs.BufferReader)(raw);
406
+ const raw = _chunk4XLYCT5Qcjs.hexToBytes.call(void 0, u.raw_hex);
407
+ const tmpReader = new (0, _chunk4XLYCT5Qcjs.BufferReader)(raw);
408
408
  w.writeVarInt(tmpReader.readVarInt());
409
409
  } else {
410
- const raw = _chunkJL3NEW3Ocjs.hexToBytes.call(void 0, u.raw_hex);
410
+ const raw = _chunk4XLYCT5Qcjs.hexToBytes.call(void 0, u.raw_hex);
411
411
  w.writeVarInt(raw.byteLength);
412
412
  w.writeBytes(raw);
413
413
  }
@@ -425,13 +425,13 @@ function decodeSetupParams(r) {
425
425
  if (paramType === SETUP_PARAM_MAX_REQUEST_ID) {
426
426
  result.max_request_id = value;
427
427
  } else {
428
- const tmpW = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(16);
428
+ const tmpW = new (0, _chunk4XLYCT5Qcjs.BufferWriter)(16);
429
429
  tmpW.writeVarInt(value);
430
430
  const raw = tmpW.finish();
431
431
  unknown.push({
432
432
  id: `0x${paramType.toString(16)}`,
433
433
  length: raw.byteLength,
434
- raw_hex: _chunkJL3NEW3Ocjs.bytesToHex.call(void 0, raw)
434
+ raw_hex: _chunk4XLYCT5Qcjs.bytesToHex.call(void 0, raw)
435
435
  });
436
436
  }
437
437
  } else {
@@ -455,7 +455,7 @@ function decodeSetupParams(r) {
455
455
  unknown.push({
456
456
  id: `0x${paramType.toString(16)}`,
457
457
  length,
458
- raw_hex: _chunkJL3NEW3Ocjs.bytesToHex.call(void 0, bytes)
458
+ raw_hex: _chunk4XLYCT5Qcjs.bytesToHex.call(void 0, bytes)
459
459
  });
460
460
  }
461
461
  }
@@ -476,7 +476,7 @@ function encodeParams(params, w) {
476
476
  if (params.authorization_token !== void 0) {
477
477
  w.writeVarInt(PARAM_AUTHORIZATION_TOKEN);
478
478
  const at = params.authorization_token;
479
- const tmpW = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(64);
479
+ const tmpW = new (0, _chunk4XLYCT5Qcjs.BufferWriter)(64);
480
480
  tmpW.writeVarInt(at.alias_type);
481
481
  tmpW.writeVarInt(at.token_type);
482
482
  tmpW.writeBytes(at.token_value);
@@ -493,11 +493,11 @@ function encodeParams(params, w) {
493
493
  const id = BigInt(u.id);
494
494
  w.writeVarInt(id);
495
495
  if (id % 2n === 0n) {
496
- const raw = _chunkJL3NEW3Ocjs.hexToBytes.call(void 0, u.raw_hex);
497
- const tmpReader = new (0, _chunkJL3NEW3Ocjs.BufferReader)(raw);
496
+ const raw = _chunk4XLYCT5Qcjs.hexToBytes.call(void 0, u.raw_hex);
497
+ const tmpReader = new (0, _chunk4XLYCT5Qcjs.BufferReader)(raw);
498
498
  w.writeVarInt(tmpReader.readVarInt());
499
499
  } else {
500
- const raw = _chunkJL3NEW3Ocjs.hexToBytes.call(void 0, u.raw_hex);
500
+ const raw = _chunk4XLYCT5Qcjs.hexToBytes.call(void 0, u.raw_hex);
501
501
  w.writeVarInt(raw.byteLength);
502
502
  w.writeBytes(raw);
503
503
  }
@@ -517,13 +517,13 @@ function decodeParams(r) {
517
517
  } else if (paramType === PARAM_MAX_CACHE_DURATION) {
518
518
  result.max_cache_duration = value;
519
519
  } else {
520
- const tmpW = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(16);
520
+ const tmpW = new (0, _chunk4XLYCT5Qcjs.BufferWriter)(16);
521
521
  tmpW.writeVarInt(value);
522
522
  const raw = tmpW.finish();
523
523
  unknown.push({
524
524
  id: `0x${paramType.toString(16)}`,
525
525
  length: raw.byteLength,
526
- raw_hex: _chunkJL3NEW3Ocjs.bytesToHex.call(void 0, raw)
526
+ raw_hex: _chunk4XLYCT5Qcjs.bytesToHex.call(void 0, raw)
527
527
  });
528
528
  }
529
529
  } else {
@@ -544,7 +544,7 @@ function decodeParams(r) {
544
544
  unknown.push({
545
545
  id: `0x${paramType.toString(16)}`,
546
546
  length,
547
- raw_hex: _chunkJL3NEW3Ocjs.bytesToHex.call(void 0, bytes)
547
+ raw_hex: _chunk4XLYCT5Qcjs.bytesToHex.call(void 0, bytes)
548
548
  });
549
549
  }
550
550
  }
@@ -746,7 +746,7 @@ function encodeRequestsBlockedPayload(msg, w) {
746
746
  function decodeClientSetupPayload(r) {
747
747
  const numVersions = Number(r.readVarInt());
748
748
  if (numVersions === 0) {
749
- throw new (0, _chunkJL3NEW3Ocjs.DecodeError)("CONSTRAINT_VIOLATION", "supported_versions must not be empty", r.offset);
749
+ throw new (0, _chunk4XLYCT5Qcjs.DecodeError)("CONSTRAINT_VIOLATION", "supported_versions must not be empty", r.offset);
750
750
  }
751
751
  const supported_versions = [];
752
752
  for (let i = 0; i < numVersions; i++) supported_versions.push(r.readVarInt());
@@ -768,7 +768,7 @@ function decodeSubscribePayload(r) {
768
768
  const filter_type = r.readVarInt();
769
769
  const ft = Number(filter_type);
770
770
  if (ft < 1 || ft > 4) {
771
- throw new (0, _chunkJL3NEW3Ocjs.DecodeError)("CONSTRAINT_VIOLATION", `Invalid filter_type: ${ft}`, r.offset);
771
+ throw new (0, _chunk4XLYCT5Qcjs.DecodeError)("CONSTRAINT_VIOLATION", `Invalid filter_type: ${ft}`, r.offset);
772
772
  }
773
773
  let start_group;
774
774
  let start_object;
@@ -994,7 +994,7 @@ function decodeFetchPayload(r) {
994
994
  const fetch_type = r.readVarInt();
995
995
  const ft = Number(fetch_type);
996
996
  if (ft < 1 || ft > 3) {
997
- throw new (0, _chunkJL3NEW3Ocjs.DecodeError)("CONSTRAINT_VIOLATION", `Invalid fetch_type: ${ft}`, r.offset);
997
+ throw new (0, _chunk4XLYCT5Qcjs.DecodeError)("CONSTRAINT_VIOLATION", `Invalid fetch_type: ${ft}`, r.offset);
998
998
  }
999
999
  let standalone;
1000
1000
  let joining;
@@ -1129,10 +1129,10 @@ var payloadDecoders = /* @__PURE__ */ new Map([
1129
1129
  function encodeMessage(message) {
1130
1130
  const typeId = MESSAGE_ID_MAP.get(message.type);
1131
1131
  if (typeId === void 0) throw new Error(`Unknown message type: ${message.type}`);
1132
- const payloadWriter = new (0, _chunkJL3NEW3Ocjs.BufferWriter)();
1132
+ const payloadWriter = new (0, _chunk4XLYCT5Qcjs.BufferWriter)();
1133
1133
  encodePayload(message, payloadWriter);
1134
1134
  const payload = payloadWriter.finishView();
1135
- const writer = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(payload.byteLength + 16);
1135
+ const writer = new (0, _chunk4XLYCT5Qcjs.BufferWriter)(payload.byteLength + 16);
1136
1136
  writer.writeVarInt(typeId);
1137
1137
  if (payload.byteLength > 65535) {
1138
1138
  throw new Error(`Payload too large for 16-bit length: ${payload.byteLength}`);
@@ -1210,18 +1210,18 @@ function encodePayload(msg, w) {
1210
1210
  }
1211
1211
  function decodeMessage(bytes) {
1212
1212
  try {
1213
- const reader = new (0, _chunkJL3NEW3Ocjs.BufferReader)(bytes);
1213
+ const reader = new (0, _chunk4XLYCT5Qcjs.BufferReader)(bytes);
1214
1214
  const typeId = reader.readVarInt();
1215
1215
  const lenHi = reader.readUint8();
1216
1216
  const lenLo = reader.readUint8();
1217
1217
  const payloadLength = lenHi << 8 | lenLo;
1218
1218
  const payloadBytes = reader.readBytes(payloadLength);
1219
- const payloadReader = new (0, _chunkJL3NEW3Ocjs.BufferReader)(payloadBytes);
1219
+ const payloadReader = new (0, _chunk4XLYCT5Qcjs.BufferReader)(payloadBytes);
1220
1220
  const decoder = payloadDecoders.get(typeId);
1221
1221
  if (!decoder) {
1222
1222
  return {
1223
1223
  ok: false,
1224
- error: new (0, _chunkJL3NEW3Ocjs.DecodeError)(
1224
+ error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
1225
1225
  "UNKNOWN_MESSAGE_TYPE",
1226
1226
  `Unknown message type ID: 0x${typeId.toString(16)}`,
1227
1227
  0
@@ -1231,7 +1231,7 @@ function decodeMessage(bytes) {
1231
1231
  const message = decoder(payloadReader);
1232
1232
  return { ok: true, value: message, bytesRead: reader.offset };
1233
1233
  } catch (e) {
1234
- if (e instanceof _chunkJL3NEW3Ocjs.DecodeError) return { ok: false, error: e };
1234
+ if (e instanceof _chunk4XLYCT5Qcjs.DecodeError) return { ok: false, error: e };
1235
1235
  throw e;
1236
1236
  }
1237
1237
  }
@@ -1261,7 +1261,7 @@ function createStreamDecoder() {
1261
1261
  },
1262
1262
  flush(controller) {
1263
1263
  if (offset < buffer.length)
1264
- controller.error(new (0, _chunkJL3NEW3Ocjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
1264
+ controller.error(new (0, _chunk4XLYCT5Qcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
1265
1265
  }
1266
1266
  });
1267
1267
  }