@moqtap/codec 0.10.0 → 0.11.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 (213) hide show
  1. package/CHANGELOG.md +147 -0
  2. package/dist/auth-redaction-DsdLq4Qs.d.cts +102 -0
  3. package/dist/auth-redaction-DsdLq4Qs.d.ts +102 -0
  4. package/dist/{chunk-RYKQXBG6.cjs → chunk-27K5BUAG.cjs} +481 -517
  5. package/dist/{chunk-WCPENYNE.js → chunk-3RNQMGKA.js} +359 -390
  6. package/dist/{chunk-TSUZ6GJV.js → chunk-5AWIXOLB.js} +438 -469
  7. package/dist/{chunk-4XLYCT5Q.cjs → chunk-5IMHJIAZ.cjs} +52 -2
  8. package/dist/{chunk-KTNERCTZ.cjs → chunk-5JGZCKJO.cjs} +488 -518
  9. package/dist/{chunk-WCTMPDUX.cjs → chunk-73K4OSAN.cjs} +401 -432
  10. package/dist/{chunk-N2V7Z37J.js → chunk-7VQKRGRD.js} +19 -3
  11. package/dist/{chunk-BIBMDTU5.cjs → chunk-A3UCQOIB.cjs} +486 -517
  12. package/dist/{chunk-K2B3OVFK.js → chunk-A7PDMVXM.js} +24 -3
  13. package/dist/{chunk-VZHL2U2N.cjs → chunk-A7VQO6YC.cjs} +54 -38
  14. package/dist/{chunk-AQ445VV7.cjs → chunk-ACQHZLRZ.cjs} +66 -46
  15. package/dist/{chunk-L5DRACXS.js → chunk-BBICOMW6.js} +25 -3
  16. package/dist/{chunk-T4VWPKDG.cjs → chunk-BNIUVOCJ.cjs} +529 -599
  17. package/dist/{chunk-UKKDOOUO.cjs → chunk-CNC6ANS4.cjs} +58 -37
  18. package/dist/{chunk-OZRK73NQ.js → chunk-FDLQSWHK.js} +433 -469
  19. package/dist/{chunk-IJAF6PAY.js → chunk-FFNOE4UR.js} +19 -3
  20. package/dist/{chunk-CZNW3R5E.cjs → chunk-GMENT63T.cjs} +54 -38
  21. package/dist/{chunk-XCRCAUGI.cjs → chunk-HM7BLRVP.cjs} +291 -297
  22. package/dist/{chunk-XHAP2YST.js → chunk-HZONHFNO.js} +19 -3
  23. package/dist/{chunk-SDJTSMOW.cjs → chunk-ILYABWDK.cjs} +60 -38
  24. package/dist/{chunk-IDV2JYJ6.cjs → chunk-KRSFTZVO.cjs} +56 -40
  25. package/dist/{chunk-RIIA4ALQ.cjs → chunk-KSPH6KMH.cjs} +54 -38
  26. package/dist/{chunk-OUNN4IQB.cjs → chunk-KTY4LAUV.cjs} +482 -497
  27. package/dist/{chunk-RZTLQAKF.js → chunk-OJNLJT5D.js} +0 -1
  28. package/dist/{chunk-FT3HDNIB.js → chunk-PJK2ZS3I.js} +467 -537
  29. package/dist/{chunk-G53WYUXL.js → chunk-PSMZKHOC.js} +441 -456
  30. package/dist/{chunk-7RE6KSIY.cjs → chunk-Q5JQGHWY.cjs} +0 -1
  31. package/dist/{chunk-BX2N7TZM.js → chunk-SQTUQY5E.js} +31 -11
  32. package/dist/{chunk-CF5DDD3Q.js → chunk-WCRLAKDW.js} +239 -245
  33. package/dist/{chunk-KYVTM5VI.js → chunk-WL2YUEXH.js} +19 -3
  34. package/dist/{chunk-KGDVC4O6.js → chunk-YCNIVZS7.js} +439 -469
  35. package/dist/{chunk-KLPWJU6W.js → chunk-YRZQVNZO.js} +50 -0
  36. package/dist/{codec-CFWu5KVT.d.cts → codec-76xzrLTL.d.cts} +21 -2
  37. package/dist/{codec-gl4_QEva.d.ts → codec-8p40WdLg.d.ts} +20 -1
  38. package/dist/{codec-Dl_QIXMz.d.ts → codec-BN2Bu0KI.d.ts} +20 -1
  39. package/dist/{codec-Bux_Q40X.d.ts → codec-Bb6GKTrv.d.ts} +21 -2
  40. package/dist/{codec-EvybrBuY.d.cts → codec-BgpfHoAd.d.cts} +20 -1
  41. package/dist/{codec-alVA27Uc.d.ts → codec-BkheTXO7.d.ts} +20 -1
  42. package/dist/{codec-Czejcmxr.d.cts → codec-BwVDkokh.d.cts} +21 -2
  43. package/dist/{codec-BrTi4K7r.d.cts → codec-C5s1eBJX.d.cts} +21 -2
  44. package/dist/codec-CM5yd6n3.d.ts +38 -0
  45. package/dist/{codec-CWnf8mn_.d.cts → codec-Cb8HC3XV.d.cts} +21 -2
  46. package/dist/codec-Clu_skx8.d.cts +38 -0
  47. package/dist/{codec-DzkdW4kO.d.cts → codec-CpOpemR8.d.cts} +20 -1
  48. package/dist/{codec-CXCjya_G.d.cts → codec-Cshdl9Tt.d.cts} +20 -1
  49. package/dist/{codec-f7vxeVIS.d.cts → codec-DELe00w_.d.cts} +21 -2
  50. package/dist/{codec-DNmiG2e0.d.cts → codec-DHzKAUCa.d.cts} +20 -1
  51. package/dist/{codec--CVeqGQv.d.ts → codec-DdVBtvx7.d.ts} +20 -1
  52. package/dist/{codec-CBdOIfMY.d.ts → codec-DlxGuYMv.d.ts} +21 -2
  53. package/dist/{codec-BNy5syCU.d.ts → codec-DxtgPxJS.d.ts} +20 -1
  54. package/dist/{codec-guzqtfMk.d.cts → codec-GAY4lybi.d.cts} +20 -1
  55. package/dist/{codec-Cfo_z5ET.d.cts → codec-I8u2pfS4.d.cts} +20 -1
  56. package/dist/{codec-BxQTybUX.d.cts → codec-XLrnreeu.d.cts} +21 -2
  57. package/dist/{codec-DOmAmFkI.d.ts → codec-c0YEwwWn.d.ts} +20 -1
  58. package/dist/{codec-DaXjRrOV.d.ts → codec-ejDu-va6.d.ts} +21 -2
  59. package/dist/{codec-C3mdsGx3.d.ts → codec-kaBUzdpV.d.ts} +21 -2
  60. package/dist/{codec-CwZ6OCPP.d.ts → codec-mVYqkIUF.d.ts} +21 -2
  61. package/dist/{codec-08ZOr5wI.d.ts → codec-qSbO5nOa.d.ts} +21 -2
  62. package/dist/{codec-Cm3D261p.d.ts → codec-yYKGOipj.d.ts} +20 -1
  63. package/dist/{codec-Bd60SGKH.d.cts → codec-zfzg9uiy.d.cts} +20 -1
  64. package/dist/draft07.cjs +48 -4
  65. package/dist/draft07.d.cts +42 -2
  66. package/dist/draft07.d.ts +42 -2
  67. package/dist/draft07.js +49 -5
  68. package/dist/draft08.cjs +76 -3
  69. package/dist/draft08.d.cts +70 -2
  70. package/dist/draft08.d.ts +70 -2
  71. package/dist/draft08.js +77 -4
  72. package/dist/draft09.cjs +76 -3
  73. package/dist/draft09.d.cts +70 -2
  74. package/dist/draft09.d.ts +70 -2
  75. package/dist/draft09.js +77 -4
  76. package/dist/draft10.cjs +76 -3
  77. package/dist/draft10.d.cts +70 -2
  78. package/dist/draft10.d.ts +70 -2
  79. package/dist/draft10.js +77 -4
  80. package/dist/draft11.cjs +104 -3
  81. package/dist/draft11.d.cts +98 -2
  82. package/dist/draft11.d.ts +98 -2
  83. package/dist/draft11.js +105 -4
  84. package/dist/draft12.cjs +113 -3
  85. package/dist/draft12.d.cts +107 -2
  86. package/dist/draft12.d.ts +107 -2
  87. package/dist/draft12.js +114 -4
  88. package/dist/draft13.cjs +105 -3
  89. package/dist/draft13.d.cts +99 -2
  90. package/dist/draft13.d.ts +99 -2
  91. package/dist/draft13.js +106 -4
  92. package/dist/draft14.cjs +107 -3
  93. package/dist/draft14.d.cts +101 -28
  94. package/dist/draft14.d.ts +101 -28
  95. package/dist/draft14.js +108 -4
  96. package/dist/draft15-session.d.cts +1 -1
  97. package/dist/draft15-session.d.ts +1 -1
  98. package/dist/draft15.cjs +69 -3
  99. package/dist/draft15.d.cts +65 -22
  100. package/dist/draft15.d.ts +65 -22
  101. package/dist/draft15.js +70 -4
  102. package/dist/draft16-session.cjs +2 -2
  103. package/dist/draft16-session.d.cts +1 -1
  104. package/dist/draft16-session.d.ts +1 -1
  105. package/dist/draft16-session.js +1 -1
  106. package/dist/draft16.cjs +76 -8
  107. package/dist/draft16.d.cts +67 -13
  108. package/dist/draft16.d.ts +67 -13
  109. package/dist/draft16.js +73 -5
  110. package/dist/draft17-session.d.cts +1 -1
  111. package/dist/draft17-session.d.ts +1 -1
  112. package/dist/draft17.cjs +77 -3
  113. package/dist/draft17.d.cts +73 -4
  114. package/dist/draft17.d.ts +73 -4
  115. package/dist/draft17.js +78 -4
  116. package/dist/draft18-session.d.cts +1 -1
  117. package/dist/draft18-session.d.ts +1 -1
  118. package/dist/draft18.cjs +8 -3
  119. package/dist/draft18.d.cts +4 -3
  120. package/dist/draft18.d.ts +4 -3
  121. package/dist/draft18.js +9 -4
  122. package/dist/draft19-session.d.cts +1 -1
  123. package/dist/draft19-session.d.ts +1 -1
  124. package/dist/draft19.cjs +11 -4
  125. package/dist/draft19.d.cts +4 -3
  126. package/dist/draft19.d.ts +4 -3
  127. package/dist/draft19.js +12 -5
  128. package/dist/draft20-session.d.cts +1 -1
  129. package/dist/draft20-session.d.ts +1 -1
  130. package/dist/draft20.cjs +8 -3
  131. package/dist/draft20.d.cts +4 -3
  132. package/dist/draft20.d.ts +4 -3
  133. package/dist/draft20.js +9 -4
  134. package/dist/index.cjs +30 -30
  135. package/dist/index.d.cts +21 -20
  136. package/dist/index.d.ts +21 -20
  137. package/dist/index.js +15 -15
  138. package/dist/session.cjs +2 -2
  139. package/dist/session.d.cts +6 -6
  140. package/dist/session.d.ts +6 -6
  141. package/dist/session.js +1 -1
  142. package/dist/{types-C1rxh-id.d.cts → types-Btp416jt.d.cts} +8 -0
  143. package/dist/{types-C1rxh-id.d.ts → types-Btp416jt.d.ts} +8 -0
  144. package/dist/{types-CZTzbIzQ.d.cts → types-BxTL1NXw.d.cts} +7 -0
  145. package/dist/{types-CZTzbIzQ.d.ts → types-BxTL1NXw.d.ts} +7 -0
  146. package/dist/{types-pShrs3fN.d.cts → types-CuibHYcf.d.cts} +7 -0
  147. package/dist/{types-pShrs3fN.d.ts → types-CuibHYcf.d.ts} +7 -0
  148. package/dist/{types-CY-QWxd-.d.cts → types-CwN7AEoL.d.cts} +13 -1
  149. package/dist/{types-CY-QWxd-.d.ts → types-CwN7AEoL.d.ts} +13 -1
  150. package/dist/{types-D4bmW8rY.d.cts → types-DAnalt5K.d.cts} +7 -0
  151. package/dist/{types-D4bmW8rY.d.ts → types-DAnalt5K.d.ts} +7 -0
  152. package/dist/{types-Bg86GGVZ.d.cts → types-DxXNP32l.d.cts} +8 -0
  153. package/dist/{types-Bg86GGVZ.d.ts → types-DxXNP32l.d.ts} +8 -0
  154. package/package.json +3 -3
  155. package/src/core/auth-redaction.ts +192 -0
  156. package/src/drafts/draft07/codec.ts +40 -0
  157. package/src/drafts/draft07/error-codes.ts +44 -0
  158. package/src/drafts/draft07/index.ts +15 -0
  159. package/src/drafts/draft08/codec.ts +40 -0
  160. package/src/drafts/draft08/error-codes.ts +76 -0
  161. package/src/drafts/draft08/index.ts +21 -0
  162. package/src/drafts/draft09/codec.ts +40 -0
  163. package/src/drafts/draft09/error-codes.ts +76 -0
  164. package/src/drafts/draft09/index.ts +21 -0
  165. package/src/drafts/draft10/codec.ts +40 -0
  166. package/src/drafts/draft10/error-codes.ts +76 -0
  167. package/src/drafts/draft10/index.ts +21 -0
  168. package/src/drafts/draft11/codec.ts +60 -0
  169. package/src/drafts/draft11/error-codes.ts +106 -0
  170. package/src/drafts/draft11/index.ts +23 -0
  171. package/src/drafts/draft12/codec.ts +61 -0
  172. package/src/drafts/draft12/error-codes.ts +116 -0
  173. package/src/drafts/draft12/index.ts +25 -0
  174. package/src/drafts/draft13/codec.ts +69 -11
  175. package/src/drafts/draft13/error-codes.ts +107 -0
  176. package/src/drafts/draft13/index.ts +23 -0
  177. package/src/drafts/draft13/types.ts +1 -1
  178. package/src/drafts/draft14/codec.ts +65 -4
  179. package/src/drafts/draft14/data-streams.ts +331 -259
  180. package/src/drafts/draft14/error-codes.ts +109 -0
  181. package/src/drafts/draft14/index.ts +23 -0
  182. package/src/drafts/draft15/codec.ts +65 -8
  183. package/src/drafts/draft15/data-streams.ts +489 -444
  184. package/src/drafts/draft15/error-codes.ts +66 -0
  185. package/src/drafts/draft15/index.ts +15 -0
  186. package/src/drafts/draft15/types.ts +7 -0
  187. package/src/drafts/draft16/codec.ts +146 -52
  188. package/src/drafts/draft16/data-streams.ts +513 -442
  189. package/src/drafts/draft16/error-codes.ts +68 -0
  190. package/src/drafts/draft16/index.ts +15 -0
  191. package/src/drafts/draft16/messages.ts +4 -4
  192. package/src/drafts/draft16/session-fsm.ts +0 -1
  193. package/src/drafts/draft16/types.ts +22 -8
  194. package/src/drafts/draft17/codec.ts +73 -12
  195. package/src/drafts/draft17/data-streams.ts +567 -488
  196. package/src/drafts/draft17/index.ts +15 -0
  197. package/src/drafts/draft17/types.ts +7 -0
  198. package/src/drafts/draft18/codec.ts +66 -9
  199. package/src/drafts/draft18/data-streams.ts +570 -482
  200. package/src/drafts/draft18/index.ts +3 -0
  201. package/src/drafts/draft18/types.ts +16 -8
  202. package/src/drafts/draft19/codec.ts +70 -10
  203. package/src/drafts/draft19/data-streams.ts +570 -482
  204. package/src/drafts/draft19/error-codes.ts +3 -1
  205. package/src/drafts/draft19/index.ts +3 -0
  206. package/src/drafts/draft19/messages.ts +3 -1
  207. package/src/drafts/draft19/types.ts +22 -11
  208. package/src/drafts/draft20/codec.ts +90 -23
  209. package/src/drafts/draft20/data-streams.ts +610 -563
  210. package/src/drafts/draft20/index.ts +3 -0
  211. package/src/drafts/draft20/types.ts +14 -2
  212. package/dist/codec-BJ7BHuiZ.d.ts +0 -18
  213. package/dist/codec-C6Mx4bwz.d.cts +0 -18
@@ -1,10 +1,13 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
2
2
 
3
3
 
4
4
 
5
5
 
6
6
 
7
- var _chunk4XLYCT5Qcjs = require('./chunk-4XLYCT5Q.cjs');
7
+
8
+
9
+
10
+ var _chunk5IMHJIAZcjs = require('./chunk-5IMHJIAZ.cjs');
8
11
 
9
12
  // src/drafts/draft20/messages.ts
10
13
  var MSG_REQUEST_UPDATE = 0x02n;
@@ -147,7 +150,7 @@ function datagramTypeFlagsError(typeFlags) {
147
150
  var OBJECT_STATUS_NORMAL = 0n;
148
151
  var MAX_U64 = 0xffffffffffffffffn;
149
152
  function encodeSubgroupStream(stream) {
150
- const w = new (0, _chunk4XLYCT5Qcjs.MoqtBufferWriter)();
153
+ const w = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)();
151
154
  const streamType = stream.headerType;
152
155
  w.writeVarInt(BigInt(streamType));
153
156
  const propertiesPresent = (streamType & 1) !== 0;
@@ -168,7 +171,7 @@ function encodeSubgroupStream(stream) {
168
171
  w.writeVarInt(delta);
169
172
  if (propertiesPresent) {
170
173
  if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
171
- const tmpW = new (0, _chunk4XLYCT5Qcjs.MoqtBufferWriter)(32);
174
+ const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(32);
172
175
  encodeObjectProperties(obj.objectProperties, tmpW);
173
176
  const raw = tmpW.finish();
174
177
  w.writeVarInt(BigInt(raw.byteLength));
@@ -188,7 +191,7 @@ function encodeSubgroupStream(stream) {
188
191
  return w.finish();
189
192
  }
190
193
  function encodeDatagram(dg) {
191
- const w = new (0, _chunk4XLYCT5Qcjs.MoqtBufferWriter)();
194
+ const w = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)();
192
195
  const dgType = dg.datagramType;
193
196
  w.writeVarInt(BigInt(dgType));
194
197
  w.writeVarInt(dg.trackAlias);
@@ -205,7 +208,7 @@ function encodeDatagram(dg) {
205
208
  }
206
209
  if (propertiesPresent) {
207
210
  if (dg.objectProperties && Object.keys(dg.objectProperties).length > 0) {
208
- const tmpW = new (0, _chunk4XLYCT5Qcjs.MoqtBufferWriter)(32);
211
+ const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(32);
209
212
  encodeObjectProperties(dg.objectProperties, tmpW);
210
213
  const raw = tmpW.finish();
211
214
  w.writeVarInt(BigInt(raw.byteLength));
@@ -222,7 +225,7 @@ function encodeDatagram(dg) {
222
225
  return w.finish();
223
226
  }
224
227
  function encodeFetchStream(stream) {
225
- const w = new (0, _chunk4XLYCT5Qcjs.MoqtBufferWriter)();
228
+ const w = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)();
226
229
  w.writeVarInt(FETCH_STREAM_TYPE);
227
230
  w.writeVarInt(stream.requestId);
228
231
  let prevGroupId = 0n;
@@ -245,7 +248,7 @@ function encodeFetchStream(stream) {
245
248
  if (flags & 16) w.writeUint8(obj.publisherPriority);
246
249
  if (flags & 32) {
247
250
  if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
248
- const tmpW = new (0, _chunk4XLYCT5Qcjs.MoqtBufferWriter)(32);
251
+ const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(32);
249
252
  encodeObjectProperties(obj.objectProperties, tmpW);
250
253
  const raw = tmpW.finish();
251
254
  w.writeVarInt(BigInt(raw.byteLength));
@@ -269,7 +272,7 @@ function encodeFetchStream(stream) {
269
272
  if (flags & 16) w.writeUint8(obj.publisherPriority);
270
273
  if (flags & 32) {
271
274
  if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
272
- const tmpW = new (0, _chunk4XLYCT5Qcjs.MoqtBufferWriter)(32);
275
+ const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(32);
273
276
  encodeObjectProperties(obj.objectProperties, tmpW);
274
277
  const raw = tmpW.finish();
275
278
  w.writeVarInt(BigInt(raw.byteLength));
@@ -298,116 +301,128 @@ function resolveObjectId(groupIdPresent, delta, prevObjectId) {
298
301
  function resolveGroupId(first, delta, prevGroupId, offset) {
299
302
  const groupId = first ? delta : prevGroupId + delta + 1n;
300
303
  if (groupId > MAX_U64) {
301
- throw new (0, _chunk4XLYCT5Qcjs.DecodeError)("CONSTRAINT_VIOLATION", "computed Group ID exceeds 2^64 - 1", offset);
304
+ throw new (0, _chunk5IMHJIAZcjs.DecodeError)("CONSTRAINT_VIOLATION", "computed Group ID exceeds 2^64 - 1", offset);
302
305
  }
303
306
  return groupId;
304
307
  }
308
+ function readSubgroupHeader(r) {
309
+ const typeFlags = r.readVarInt();
310
+ const flagsError = subgroupTypeFlagsError(typeFlags);
311
+ if (flagsError !== null) {
312
+ throw new (0, _chunk5IMHJIAZcjs.DecodeError)("CONSTRAINT_VIOLATION", flagsError, 0);
313
+ }
314
+ const streamType = Number(typeFlags);
315
+ const propertiesPresent = (streamType & 1) !== 0;
316
+ const subgroupMode = (streamType & 6) >> 1;
317
+ const hasSubgroupField = subgroupMode === 2;
318
+ const subgroupIsFirstObjId = subgroupMode === 1;
319
+ const endOfGroup = (streamType & 8) !== 0;
320
+ const hasPriority = (streamType & 32) === 0;
321
+ const firstObjectFlag = (streamType & 64) !== 0;
322
+ const trackAlias = r.readVarInt();
323
+ const groupId = r.readVarInt();
324
+ let subgroupId = 0n;
325
+ if (hasSubgroupField) {
326
+ subgroupId = r.readVarInt();
327
+ }
328
+ let publisherPriority = 128;
329
+ if (hasPriority) {
330
+ publisherPriority = r.readUint8();
331
+ }
332
+ return {
333
+ streamType,
334
+ propertiesPresent,
335
+ subgroupIsFirstObjId,
336
+ endOfGroup,
337
+ firstObjectFlag,
338
+ trackAlias,
339
+ groupId,
340
+ subgroupId,
341
+ publisherPriority
342
+ };
343
+ }
344
+ function readSubgroupObject(r, propertiesPresent, isFirst, prevObjectId, base) {
345
+ const byteOffset = base + r.offset;
346
+ const delta = r.readVarInt();
347
+ const objectId = isFirst ? delta : prevObjectId + 1n + delta;
348
+ const extensionData = new Uint8Array(0);
349
+ let objectProperties;
350
+ if (propertiesPresent) {
351
+ const propsLen = Number(r.readVarInt());
352
+ if (propsLen > 0) {
353
+ objectProperties = decodeObjectProperties(r, propsLen);
354
+ }
355
+ }
356
+ const payloadLength = Number(r.readVarInt());
357
+ let payload;
358
+ let status;
359
+ let payloadByteOffset;
360
+ if (payloadLength === 0) {
361
+ status = r.readVarInt();
362
+ payloadByteOffset = base + r.offset;
363
+ payload = new Uint8Array(0);
364
+ } else {
365
+ payloadByteOffset = base + r.offset;
366
+ payload = r.readBytesView(payloadLength);
367
+ }
368
+ const obj = {
369
+ type: "object",
370
+ byteOffset,
371
+ payloadByteOffset,
372
+ objectId,
373
+ objectIdDelta: delta,
374
+ payloadLength,
375
+ payload,
376
+ extensionData
377
+ };
378
+ if (status !== void 0) obj.status = status;
379
+ if (objectProperties !== void 0)
380
+ obj.objectProperties = objectProperties;
381
+ return obj;
382
+ }
305
383
  function decodeSubgroupStream(bytes) {
306
384
  try {
307
- const r = new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(bytes);
308
- const typeFlags = r.readVarInt();
309
- const flagsError = subgroupTypeFlagsError(typeFlags);
310
- if (flagsError !== null) {
311
- return { ok: false, error: new (0, _chunk4XLYCT5Qcjs.DecodeError)("CONSTRAINT_VIOLATION", flagsError, 0) };
312
- }
313
- const streamType = Number(typeFlags);
314
- const propertiesPresent = (streamType & 1) !== 0;
315
- const subgroupMode = (streamType & 6) >> 1;
316
- const hasSubgroupField = subgroupMode === 2;
317
- const subgroupIsFirstObjId = subgroupMode === 1;
318
- const endOfGroup = (streamType & 8) !== 0;
319
- const hasPriority = (streamType & 32) === 0;
320
- const firstObject = (streamType & 64) !== 0;
321
- const trackAlias = r.readVarInt();
322
- const groupId = r.readVarInt();
323
- let subgroupId = 0n;
324
- if (hasSubgroupField) {
325
- subgroupId = r.readVarInt();
326
- }
327
- let publisherPriority = 128;
328
- if (hasPriority) {
329
- publisherPriority = r.readUint8();
330
- }
385
+ const r = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes);
386
+ const h = readSubgroupHeader(r);
331
387
  const objects = [];
332
388
  let prevObjectId = -1n;
333
389
  let isFirst = true;
390
+ let subgroupId = h.subgroupId;
334
391
  while (r.remaining > 0) {
335
- const byteOffset = r.offset;
336
- const delta = r.readVarInt();
337
- let objectId;
338
- if (isFirst) {
339
- objectId = delta;
340
- if (subgroupIsFirstObjId) {
341
- subgroupId = objectId;
342
- }
343
- isFirst = false;
344
- } else {
345
- objectId = prevObjectId + 1n + delta;
346
- }
347
- const extensionData = new Uint8Array(0);
348
- let objectProperties;
349
- if (propertiesPresent) {
350
- const propsLen = Number(r.readVarInt());
351
- if (propsLen > 0) {
352
- objectProperties = decodeObjectProperties(r, propsLen);
353
- }
354
- }
355
- const payloadLength = Number(r.readVarInt());
356
- let payload;
357
- let status;
358
- let payloadByteOffset;
359
- if (payloadLength === 0) {
360
- status = r.readVarInt();
361
- payloadByteOffset = r.offset;
362
- payload = new Uint8Array(0);
363
- } else {
364
- payloadByteOffset = r.offset;
365
- payload = r.readBytesView(payloadLength);
366
- }
367
- const obj = {
368
- type: "object",
369
- byteOffset,
370
- payloadByteOffset,
371
- objectId,
372
- objectIdDelta: delta,
373
- payloadLength,
374
- payload,
375
- extensionData
376
- };
377
- if (status !== void 0) obj.status = status;
378
- if (objectProperties !== void 0)
379
- obj.objectProperties = objectProperties;
392
+ const obj = readSubgroupObject(r, h.propertiesPresent, isFirst, prevObjectId, 0);
393
+ if (isFirst && h.subgroupIsFirstObjId) subgroupId = obj.objectId;
394
+ isFirst = false;
380
395
  objects.push(obj);
381
- prevObjectId = objectId;
396
+ prevObjectId = obj.objectId;
382
397
  }
383
398
  const result = {
384
399
  type: "subgroup",
385
- headerType: streamType,
386
- trackAlias,
387
- groupId,
400
+ headerType: h.streamType,
401
+ trackAlias: h.trackAlias,
402
+ groupId: h.groupId,
388
403
  subgroupId,
389
- publisherPriority,
390
- objects
404
+ publisherPriority: h.publisherPriority,
405
+ objects,
406
+ ...h.endOfGroup ? { endOfGroup: true } : {},
407
+ ...h.firstObjectFlag ? { firstObject: true } : {}
391
408
  };
392
- if (endOfGroup) result.endOfGroup = true;
393
- if (firstObject) result.firstObject = true;
394
409
  return {
395
410
  ok: true,
396
411
  value: result,
397
412
  bytesRead: r.offset
398
413
  };
399
414
  } catch (e) {
400
- if (e instanceof _chunk4XLYCT5Qcjs.DecodeError) return { ok: false, error: e };
415
+ if (e instanceof _chunk5IMHJIAZcjs.DecodeError) return { ok: false, error: e };
401
416
  throw e;
402
417
  }
403
418
  }
404
419
  function decodeDatagram(bytes) {
405
420
  try {
406
- const r = new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(bytes);
421
+ const r = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes);
407
422
  const typeFlags = r.readVarInt();
408
423
  const flagsError = datagramTypeFlagsError(typeFlags);
409
424
  if (flagsError !== null) {
410
- return { ok: false, error: new (0, _chunk4XLYCT5Qcjs.DecodeError)("CONSTRAINT_VIOLATION", flagsError, 0) };
425
+ return { ok: false, error: new (0, _chunk5IMHJIAZcjs.DecodeError)("CONSTRAINT_VIOLATION", flagsError, 0) };
411
426
  }
412
427
  const dgType = Number(typeFlags);
413
428
  const objectIdAbsent = (dgType & 4) !== 0;
@@ -431,7 +446,7 @@ function decodeDatagram(bytes) {
431
446
  if (propsLen === 0) {
432
447
  return {
433
448
  ok: false,
434
- error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
449
+ error: new (0, _chunk5IMHJIAZcjs.DecodeError)(
435
450
  "CONSTRAINT_VIOLATION",
436
451
  "a datagram with the PROPERTIES bit set must carry a non-empty Properties structure",
437
452
  r.offset
@@ -447,7 +462,7 @@ function decodeDatagram(bytes) {
447
462
  if (propertiesPresent && objectStatus !== OBJECT_STATUS_NORMAL) {
448
463
  return {
449
464
  ok: false,
450
- error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
465
+ error: new (0, _chunk5IMHJIAZcjs.DecodeError)(
451
466
  "CONSTRAINT_VIOLATION",
452
467
  `only a Normal (0x0) Object may carry Properties, got status 0x${objectStatus.toString(16)}`,
453
468
  r.offset
@@ -457,7 +472,7 @@ function decodeDatagram(bytes) {
457
472
  if (r.remaining > 0) {
458
473
  return {
459
474
  ok: false,
460
- error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
475
+ error: new (0, _chunk5IMHJIAZcjs.DecodeError)(
461
476
  "CONSTRAINT_VIOLATION",
462
477
  `a status datagram must not carry a payload (${r.remaining} trailing byte(s))`,
463
478
  r.offset
@@ -486,18 +501,207 @@ function decodeDatagram(bytes) {
486
501
  result.objectProperties = objectProperties;
487
502
  return { ok: true, value: result, bytesRead: r.offset };
488
503
  } catch (e) {
489
- if (e instanceof _chunk4XLYCT5Qcjs.DecodeError) return { ok: false, error: e };
504
+ if (e instanceof _chunk5IMHJIAZcjs.DecodeError) return { ok: false, error: e };
490
505
  throw e;
491
506
  }
492
507
  }
508
+ function newFetchObjectState() {
509
+ return { prevGroupId: 0n, prevSubgroupId: 0n, prevObjectId: 0n, prevPriority: 128, first: true };
510
+ }
511
+ function readFetchObject(r, base, st) {
512
+ const byteOffset = base + r.offset;
513
+ const flags = Number(r.readVarInt());
514
+ let groupId = st.prevGroupId;
515
+ let subgroupId = st.prevSubgroupId;
516
+ let objectId = st.prevObjectId + 1n;
517
+ let payloadLength;
518
+ let payload;
519
+ let payloadByteOffset;
520
+ const extensionData = new Uint8Array(0);
521
+ if (flags >= 128) {
522
+ if (!FETCH_END_OF_RANGE_MARKERS.has(flags)) {
523
+ throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
524
+ "CONSTRAINT_VIOLATION",
525
+ `0x${flags.toString(16)} is neither a flag combination below 128 nor one of the three End of Range markers`,
526
+ r.offset
527
+ );
528
+ }
529
+ const groupDelta2 = r.readVarInt();
530
+ groupId = resolveGroupId(st.first, groupDelta2, st.prevGroupId, r.offset);
531
+ const objectDelta2 = r.readVarInt();
532
+ objectId = objectDelta2;
533
+ payloadLength = Number(r.readVarInt());
534
+ payloadByteOffset = base + r.offset;
535
+ payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
536
+ const marker = {
537
+ type: "object",
538
+ byteOffset,
539
+ payloadByteOffset,
540
+ serializationFlags: flags,
541
+ groupId,
542
+ groupIdDelta: groupDelta2,
543
+ // A marker has no Subgroup ID or Priority of its own — Section
544
+ // 11.4.4.2 says neither field is present. The interface requires
545
+ // both, so they carry the last actual Object's values, which is also
546
+ // what a following Object that references "the prior Object" gets.
547
+ subgroupId: st.prevSubgroupId,
548
+ objectId,
549
+ objectIdDelta: objectDelta2,
550
+ publisherPriority: st.prevPriority,
551
+ payloadLength,
552
+ payload,
553
+ extensionData
554
+ };
555
+ st.prevGroupId = groupId;
556
+ st.prevObjectId = objectId;
557
+ st.first = false;
558
+ return marker;
559
+ }
560
+ if (flags & 64) {
561
+ const objectIdPresent2 = (flags & 4) !== 0;
562
+ const groupIdPresent2 = (flags & 8) !== 0;
563
+ const priorityPresent2 = (flags & 16) !== 0;
564
+ const propsPresent2 = (flags & 32) !== 0;
565
+ let groupDelta2;
566
+ if (groupIdPresent2) {
567
+ groupDelta2 = r.readVarInt();
568
+ groupId = resolveGroupId(st.first, groupDelta2, st.prevGroupId, r.offset);
569
+ }
570
+ let objectDelta2;
571
+ if (objectIdPresent2) {
572
+ objectDelta2 = r.readVarInt();
573
+ objectId = resolveObjectId(groupIdPresent2, objectDelta2, st.prevObjectId);
574
+ }
575
+ if (objectId > MAX_U64) {
576
+ throw new (0, _chunk5IMHJIAZcjs.DecodeError)("CONSTRAINT_VIOLATION", "computed Object ID exceeds 2^64 - 1", r.offset);
577
+ }
578
+ if (priorityPresent2) {
579
+ st.prevPriority = r.readUint8();
580
+ }
581
+ let objectProperties2;
582
+ if (propsPresent2) {
583
+ const propsLen = Number(r.readVarInt());
584
+ if (propsLen > 0) {
585
+ objectProperties2 = decodeObjectProperties(r, propsLen);
586
+ }
587
+ }
588
+ payloadLength = Number(r.readVarInt());
589
+ payloadByteOffset = base + r.offset;
590
+ payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
591
+ const obj2 = {
592
+ type: "object",
593
+ byteOffset,
594
+ payloadByteOffset,
595
+ serializationFlags: flags,
596
+ groupId,
597
+ subgroupId: 0n,
598
+ objectId,
599
+ publisherPriority: st.prevPriority,
600
+ payloadLength,
601
+ payload,
602
+ extensionData
603
+ };
604
+ if (groupDelta2 !== void 0)
605
+ obj2.groupIdDelta = groupDelta2;
606
+ if (objectDelta2 !== void 0)
607
+ obj2.objectIdDelta = objectDelta2;
608
+ if (objectProperties2)
609
+ obj2.objectProperties = objectProperties2;
610
+ st.prevGroupId = groupId;
611
+ st.prevObjectId = objectId;
612
+ st.first = false;
613
+ return obj2;
614
+ }
615
+ const subgroupEncoding = flags & 3;
616
+ const objectIdPresent = (flags & 4) !== 0;
617
+ const groupIdPresent = (flags & 8) !== 0;
618
+ const priorityPresent = (flags & 16) !== 0;
619
+ const propsPresent = (flags & 32) !== 0;
620
+ let groupDelta;
621
+ if (groupIdPresent) {
622
+ groupDelta = r.readVarInt();
623
+ groupId = resolveGroupId(st.first, groupDelta, st.prevGroupId, r.offset);
624
+ } else if (st.first) {
625
+ throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
626
+ "CONSTRAINT_VIOLATION",
627
+ "First fetch object must include groupId",
628
+ r.offset
629
+ );
630
+ }
631
+ if (subgroupEncoding === 0) {
632
+ subgroupId = 0n;
633
+ } else if (subgroupEncoding === 1 || subgroupEncoding === 2) {
634
+ if (st.first) {
635
+ throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
636
+ "CONSTRAINT_VIOLATION",
637
+ "First fetch object cannot reference prior subgroupId",
638
+ r.offset
639
+ );
640
+ }
641
+ subgroupId = subgroupEncoding === 1 ? st.prevSubgroupId : st.prevSubgroupId + 1n;
642
+ } else {
643
+ subgroupId = r.readVarInt();
644
+ }
645
+ let objectDelta;
646
+ if (objectIdPresent) {
647
+ objectDelta = r.readVarInt();
648
+ objectId = resolveObjectId(groupIdPresent, objectDelta, st.prevObjectId);
649
+ } else if (st.first) {
650
+ throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
651
+ "CONSTRAINT_VIOLATION",
652
+ "First fetch object must include objectId",
653
+ r.offset
654
+ );
655
+ }
656
+ if (objectId > MAX_U64) {
657
+ throw new (0, _chunk5IMHJIAZcjs.DecodeError)("CONSTRAINT_VIOLATION", "computed Object ID exceeds 2^64 - 1", r.offset);
658
+ }
659
+ if (priorityPresent) {
660
+ st.prevPriority = r.readUint8();
661
+ }
662
+ let objectProperties;
663
+ if (propsPresent) {
664
+ const propsLen = Number(r.readVarInt());
665
+ if (propsLen > 0) {
666
+ objectProperties = decodeObjectProperties(r, propsLen);
667
+ }
668
+ }
669
+ payloadLength = Number(r.readVarInt());
670
+ payloadByteOffset = base + r.offset;
671
+ payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
672
+ const obj = {
673
+ type: "object",
674
+ byteOffset,
675
+ payloadByteOffset,
676
+ serializationFlags: flags,
677
+ groupId,
678
+ subgroupId,
679
+ objectId,
680
+ publisherPriority: st.prevPriority,
681
+ payloadLength,
682
+ payload,
683
+ extensionData
684
+ };
685
+ if (groupDelta !== void 0)
686
+ obj.groupIdDelta = groupDelta;
687
+ if (objectDelta !== void 0)
688
+ obj.objectIdDelta = objectDelta;
689
+ if (objectProperties)
690
+ obj.objectProperties = objectProperties;
691
+ st.prevGroupId = groupId;
692
+ st.prevSubgroupId = subgroupId;
693
+ st.prevObjectId = objectId;
694
+ st.first = false;
695
+ return obj;
696
+ }
493
697
  function decodeFetchStream(bytes) {
494
698
  try {
495
- const r = new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(bytes);
699
+ const r = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes);
496
700
  const streamType = r.readVarInt();
497
701
  if (streamType !== FETCH_STREAM_TYPE) {
498
702
  return {
499
703
  ok: false,
500
- error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
704
+ error: new (0, _chunk5IMHJIAZcjs.DecodeError)(
501
705
  "CONSTRAINT_VIOLATION",
502
706
  `Expected fetch stream type 0x05, got 0x${streamType.toString(16)}`,
503
707
  0
@@ -506,224 +710,9 @@ function decodeFetchStream(bytes) {
506
710
  }
507
711
  const requestId = r.readVarInt();
508
712
  const objects = [];
509
- let prevGroupId = 0n;
510
- let prevSubgroupId = 0n;
511
- let prevObjectId = 0n;
512
- let prevPriority = 128;
513
- let first = true;
713
+ const st = newFetchObjectState();
514
714
  while (r.remaining > 0) {
515
- const byteOffset = r.offset;
516
- const flags = Number(r.readVarInt());
517
- let groupId = prevGroupId;
518
- let subgroupId = prevSubgroupId;
519
- let objectId = prevObjectId + 1n;
520
- let payloadLength;
521
- let payload;
522
- let payloadByteOffset;
523
- const extensionData = new Uint8Array(0);
524
- if (flags >= 128) {
525
- if (!FETCH_END_OF_RANGE_MARKERS.has(flags)) {
526
- return {
527
- ok: false,
528
- error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
529
- "CONSTRAINT_VIOLATION",
530
- `0x${flags.toString(16)} is neither a flag combination below 128 nor one of the three End of Range markers`,
531
- r.offset
532
- )
533
- };
534
- }
535
- const groupDelta2 = r.readVarInt();
536
- groupId = resolveGroupId(first, groupDelta2, prevGroupId, r.offset);
537
- const objectDelta2 = r.readVarInt();
538
- objectId = objectDelta2;
539
- payloadLength = Number(r.readVarInt());
540
- payloadByteOffset = r.offset;
541
- payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
542
- const marker = {
543
- type: "object",
544
- byteOffset,
545
- payloadByteOffset,
546
- serializationFlags: flags,
547
- groupId,
548
- groupIdDelta: groupDelta2,
549
- // A marker has no Subgroup ID or Priority of its own — Section
550
- // 11.4.4.2 says neither field is present. The interface requires
551
- // both, so they carry the last actual Object's values, which is also
552
- // what a following Object that references "the prior Object" gets.
553
- subgroupId: prevSubgroupId,
554
- objectId,
555
- objectIdDelta: objectDelta2,
556
- publisherPriority: prevPriority,
557
- payloadLength,
558
- payload,
559
- extensionData
560
- };
561
- objects.push(marker);
562
- prevGroupId = groupId;
563
- prevObjectId = objectId;
564
- first = false;
565
- continue;
566
- }
567
- if (flags & 64) {
568
- const objectIdPresent2 = (flags & 4) !== 0;
569
- const groupIdPresent2 = (flags & 8) !== 0;
570
- const priorityPresent2 = (flags & 16) !== 0;
571
- const propsPresent2 = (flags & 32) !== 0;
572
- let groupDelta2;
573
- if (groupIdPresent2) {
574
- groupDelta2 = r.readVarInt();
575
- groupId = resolveGroupId(first, groupDelta2, prevGroupId, r.offset);
576
- }
577
- let objectDelta2;
578
- if (objectIdPresent2) {
579
- objectDelta2 = r.readVarInt();
580
- objectId = resolveObjectId(groupIdPresent2, objectDelta2, prevObjectId);
581
- }
582
- if (objectId > MAX_U64) {
583
- return {
584
- ok: false,
585
- error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
586
- "CONSTRAINT_VIOLATION",
587
- "computed Object ID exceeds 2^64 - 1",
588
- r.offset
589
- )
590
- };
591
- }
592
- if (priorityPresent2) {
593
- prevPriority = r.readUint8();
594
- }
595
- let objectProperties2;
596
- if (propsPresent2) {
597
- const propsLen = Number(r.readVarInt());
598
- if (propsLen > 0) {
599
- objectProperties2 = decodeObjectProperties(r, propsLen);
600
- }
601
- }
602
- payloadLength = Number(r.readVarInt());
603
- payloadByteOffset = r.offset;
604
- payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
605
- const obj2 = {
606
- type: "object",
607
- byteOffset,
608
- payloadByteOffset,
609
- serializationFlags: flags,
610
- groupId,
611
- subgroupId: 0n,
612
- objectId,
613
- publisherPriority: prevPriority,
614
- payloadLength,
615
- payload,
616
- extensionData
617
- };
618
- if (groupDelta2 !== void 0)
619
- obj2.groupIdDelta = groupDelta2;
620
- if (objectDelta2 !== void 0)
621
- obj2.objectIdDelta = objectDelta2;
622
- if (objectProperties2)
623
- obj2.objectProperties = objectProperties2;
624
- objects.push(obj2);
625
- prevGroupId = groupId;
626
- prevObjectId = objectId;
627
- first = false;
628
- continue;
629
- }
630
- const subgroupEncoding = flags & 3;
631
- const objectIdPresent = (flags & 4) !== 0;
632
- const groupIdPresent = (flags & 8) !== 0;
633
- const priorityPresent = (flags & 16) !== 0;
634
- const propsPresent = (flags & 32) !== 0;
635
- let groupDelta;
636
- if (groupIdPresent) {
637
- groupDelta = r.readVarInt();
638
- groupId = resolveGroupId(first, groupDelta, prevGroupId, r.offset);
639
- } else if (first) {
640
- return {
641
- ok: false,
642
- error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
643
- "CONSTRAINT_VIOLATION",
644
- "First fetch object must include groupId",
645
- r.offset
646
- )
647
- };
648
- }
649
- if (subgroupEncoding === 0) {
650
- subgroupId = 0n;
651
- } else if (subgroupEncoding === 1 || subgroupEncoding === 2) {
652
- if (first) {
653
- return {
654
- ok: false,
655
- error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
656
- "CONSTRAINT_VIOLATION",
657
- "First fetch object cannot reference prior subgroupId",
658
- r.offset
659
- )
660
- };
661
- }
662
- subgroupId = subgroupEncoding === 1 ? prevSubgroupId : prevSubgroupId + 1n;
663
- } else {
664
- subgroupId = r.readVarInt();
665
- }
666
- let objectDelta;
667
- if (objectIdPresent) {
668
- objectDelta = r.readVarInt();
669
- objectId = resolveObjectId(groupIdPresent, objectDelta, prevObjectId);
670
- } else if (first) {
671
- return {
672
- ok: false,
673
- error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
674
- "CONSTRAINT_VIOLATION",
675
- "First fetch object must include objectId",
676
- r.offset
677
- )
678
- };
679
- }
680
- if (objectId > MAX_U64) {
681
- return {
682
- ok: false,
683
- error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
684
- "CONSTRAINT_VIOLATION",
685
- "computed Object ID exceeds 2^64 - 1",
686
- r.offset
687
- )
688
- };
689
- }
690
- if (priorityPresent) {
691
- prevPriority = r.readUint8();
692
- }
693
- let objectProperties;
694
- if (propsPresent) {
695
- const propsLen = Number(r.readVarInt());
696
- if (propsLen > 0) {
697
- objectProperties = decodeObjectProperties(r, propsLen);
698
- }
699
- }
700
- payloadLength = Number(r.readVarInt());
701
- payloadByteOffset = r.offset;
702
- payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
703
- const obj = {
704
- type: "object",
705
- byteOffset,
706
- payloadByteOffset,
707
- serializationFlags: flags,
708
- groupId,
709
- subgroupId,
710
- objectId,
711
- publisherPriority: prevPriority,
712
- payloadLength,
713
- payload,
714
- extensionData
715
- };
716
- if (groupDelta !== void 0)
717
- obj.groupIdDelta = groupDelta;
718
- if (objectDelta !== void 0)
719
- obj.objectIdDelta = objectDelta;
720
- if (objectProperties)
721
- obj.objectProperties = objectProperties;
722
- objects.push(obj);
723
- prevGroupId = groupId;
724
- prevSubgroupId = subgroupId;
725
- prevObjectId = objectId;
726
- first = false;
715
+ objects.push(readFetchObject(r, 0, st));
727
716
  }
728
717
  return {
729
718
  ok: true,
@@ -731,7 +720,7 @@ function decodeFetchStream(bytes) {
731
720
  bytesRead: r.offset
732
721
  };
733
722
  } catch (e) {
734
- if (e instanceof _chunk4XLYCT5Qcjs.DecodeError) return { ok: false, error: e };
723
+ if (e instanceof _chunk5IMHJIAZcjs.DecodeError) return { ok: false, error: e };
735
724
  throw e;
736
725
  }
737
726
  }
@@ -749,132 +738,125 @@ function decodeDataStream(streamType, bytes) {
749
738
  }
750
739
  }
751
740
  }
741
+ var StreamBuffer = (_class = class {constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this); }
742
+ __init() {this.buf = new Uint8Array(0)}
743
+ /** Bytes written into `buf`. */
744
+ __init2() {this.len = 0}
745
+ /** Consumed prefix of `buf`; `base + offset` is the position in the stream. */
746
+ __init3() {this.offset = 0}
747
+ /** Absolute position of `buf[0]` within the stream. */
748
+ __init4() {this.base = 0}
749
+ get unread() {
750
+ return this.len - this.offset;
751
+ }
752
+ append(chunk) {
753
+ if (this.len + chunk.length > this.buf.length) {
754
+ const live = this.len - this.offset;
755
+ const needed = live + chunk.length;
756
+ let cap = Math.max(4096, this.buf.length);
757
+ while (cap < needed * 2) cap *= 2;
758
+ const next = new Uint8Array(cap);
759
+ next.set(this.buf.subarray(this.offset, this.len), 0);
760
+ this.buf = next;
761
+ this.base += this.offset;
762
+ this.len = live;
763
+ this.offset = 0;
764
+ }
765
+ this.buf.set(chunk, this.len);
766
+ this.len += chunk.length;
767
+ }
768
+ /**
769
+ * The written bytes, for a reader positioned at `offset`. Bounded by `len`
770
+ * rather than by capacity, so `BufferReader.remaining` counts real bytes and
771
+ * not the spare room after them.
772
+ */
773
+ written() {
774
+ return this.buf.subarray(0, this.len);
775
+ }
776
+ }, _class);
752
777
  function createSubgroupStreamDecoder() {
753
- let buffer = new Uint8Array(0);
754
- let offset = 0;
778
+ const b = new StreamBuffer();
779
+ let header = null;
755
780
  let headerEmitted = false;
756
781
  let prevObjectId = -1n;
757
- let firstObject = true;
758
- let _propertiesPresent = false;
782
+ let isFirst = true;
783
+ function emitHeader(controller, h, subgroupId) {
784
+ controller.enqueue({
785
+ type: "subgroup_header",
786
+ headerType: h.streamType,
787
+ trackAlias: h.trackAlias,
788
+ groupId: h.groupId,
789
+ subgroupId,
790
+ publisherPriority: h.publisherPriority,
791
+ ...h.endOfGroup ? { endOfGroup: true } : {},
792
+ ...h.firstObjectFlag ? { firstObject: true } : {}
793
+ });
794
+ headerEmitted = true;
795
+ }
759
796
  return new TransformStream({
760
797
  transform(chunk, controller) {
761
- if (offset > 0) {
762
- buffer = buffer.subarray(offset);
763
- offset = 0;
764
- }
765
- const newBuffer = new Uint8Array(buffer.length + chunk.length);
766
- newBuffer.set(buffer, 0);
767
- newBuffer.set(chunk, buffer.length);
768
- buffer = newBuffer;
769
- if (!headerEmitted) {
798
+ b.append(chunk);
799
+ const view = b.written();
800
+ if (header === null) {
770
801
  try {
771
- const r = new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(buffer.subarray(offset));
772
- const typeFlags = r.readVarInt();
773
- const flagsError = subgroupTypeFlagsError(typeFlags);
774
- if (flagsError !== null) {
775
- controller.error(new (0, _chunk4XLYCT5Qcjs.DecodeError)("CONSTRAINT_VIOLATION", flagsError, 0));
776
- return;
777
- }
778
- const streamType = Number(typeFlags);
779
- _propertiesPresent = (streamType & 1) !== 0;
780
- const subgroupMode = (streamType & 6) >> 1;
781
- const hasSubgroupField = subgroupMode === 2;
782
- const hasPriority = (streamType & 32) === 0;
783
- const trackAlias = r.readVarInt();
784
- const groupId = r.readVarInt();
785
- let subgroupId = 0n;
786
- if (hasSubgroupField) {
787
- subgroupId = r.readVarInt();
788
- }
789
- let publisherPriority = 128;
790
- if (hasPriority) {
791
- publisherPriority = r.readUint8();
792
- }
793
- controller.enqueue({
794
- type: "subgroup_header",
795
- trackAlias,
796
- groupId,
797
- subgroupId,
798
- publisherPriority
799
- });
800
- headerEmitted = true;
801
- offset += r.offset;
802
+ const hr = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(view, b.offset);
803
+ header = readSubgroupHeader(hr);
804
+ b.offset = hr.offset;
802
805
  } catch (e) {
803
- if (e instanceof _chunk4XLYCT5Qcjs.DecodeError && e.code === "UNEXPECTED_END") {
806
+ if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
804
807
  return;
805
808
  }
806
809
  controller.error(e);
807
810
  return;
808
811
  }
812
+ if (!header.subgroupIsFirstObjId) emitHeader(controller, header, header.subgroupId);
809
813
  }
810
- while (offset < buffer.length) {
814
+ const h = header;
815
+ if (h === null) return;
816
+ const r = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(view, b.offset);
817
+ while (r.remaining > 0) {
818
+ const start = r.offset;
819
+ let obj;
811
820
  try {
812
- const r = new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(buffer.subarray(offset));
813
- const delta = r.readVarInt();
814
- let objectId;
815
- if (firstObject) {
816
- objectId = delta;
817
- firstObject = false;
818
- } else {
819
- objectId = prevObjectId + 1n + delta;
820
- }
821
- let extensionData = new Uint8Array(0);
822
- if (_propertiesPresent) {
823
- const extLen = Number(r.readVarInt());
824
- extensionData = extLen > 0 ? r.readBytesView(extLen) : new Uint8Array(0);
825
- }
826
- const payloadLength = Number(r.readVarInt());
827
- const payloadByteOffset = r.offset;
828
- const payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
829
- controller.enqueue({
830
- type: "object",
831
- objectId,
832
- objectIdDelta: delta,
833
- payloadLength,
834
- payload,
835
- extensionData,
836
- byteOffset: 0,
837
- payloadByteOffset
838
- });
839
- offset += r.offset;
840
- prevObjectId = objectId;
821
+ obj = readSubgroupObject(r, h.propertiesPresent, isFirst, prevObjectId, b.base);
841
822
  } catch (e) {
842
- if (e instanceof _chunk4XLYCT5Qcjs.DecodeError && e.code === "UNEXPECTED_END") {
843
- break;
823
+ if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
824
+ b.offset = start;
825
+ return;
844
826
  }
845
827
  controller.error(e);
846
828
  return;
847
829
  }
830
+ if (!headerEmitted) emitHeader(controller, h, obj.objectId);
831
+ isFirst = false;
832
+ b.offset = r.offset;
833
+ prevObjectId = obj.objectId;
834
+ controller.enqueue(obj);
848
835
  }
849
836
  },
850
837
  flush(controller) {
851
- if (offset < buffer.length) {
852
- controller.error(new (0, _chunk4XLYCT5Qcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
838
+ if (header !== null && !headerEmitted) emitHeader(controller, header, 0n);
839
+ if (b.unread > 0) {
840
+ controller.error(new (0, _chunk5IMHJIAZcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
853
841
  }
854
842
  }
855
843
  });
856
844
  }
857
845
  function createFetchStreamDecoder() {
858
- let buffer = new Uint8Array(0);
859
- let offset = 0;
846
+ const b = new StreamBuffer();
860
847
  let headerEmitted = false;
848
+ const st = newFetchObjectState();
861
849
  return new TransformStream({
862
850
  transform(chunk, controller) {
863
- if (offset > 0) {
864
- buffer = buffer.subarray(offset);
865
- offset = 0;
866
- }
867
- const newBuffer = new Uint8Array(buffer.length + chunk.length);
868
- newBuffer.set(buffer, 0);
869
- newBuffer.set(chunk, buffer.length);
870
- buffer = newBuffer;
851
+ b.append(chunk);
852
+ const view = b.written();
871
853
  if (!headerEmitted) {
872
854
  try {
873
- const r = new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(buffer.subarray(offset));
874
- const streamType = r.readVarInt();
855
+ const r2 = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(view, b.offset);
856
+ const streamType = r2.readVarInt();
875
857
  if (streamType !== FETCH_STREAM_TYPE) {
876
858
  controller.error(
877
- new (0, _chunk4XLYCT5Qcjs.DecodeError)(
859
+ new (0, _chunk5IMHJIAZcjs.DecodeError)(
878
860
  "CONSTRAINT_VIOLATION",
879
861
  `Expected fetch stream type 0x05, got 0x${streamType.toString(16)}`,
880
862
  0
@@ -882,149 +864,96 @@ function createFetchStreamDecoder() {
882
864
  );
883
865
  return;
884
866
  }
885
- const requestId = r.readVarInt();
867
+ const requestId = r2.readVarInt();
886
868
  controller.enqueue({ type: "fetch_header", requestId });
887
869
  headerEmitted = true;
888
- offset += r.offset;
870
+ b.offset = r2.offset;
889
871
  } catch (e) {
890
- if (e instanceof _chunk4XLYCT5Qcjs.DecodeError && e.code === "UNEXPECTED_END") {
872
+ if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
891
873
  return;
892
874
  }
893
875
  controller.error(e);
894
876
  return;
895
877
  }
896
878
  }
897
- while (offset < buffer.length) {
879
+ const r = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(view, b.offset);
880
+ while (r.remaining > 0) {
881
+ const start = r.offset;
882
+ let obj;
898
883
  try {
899
- const r = new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(buffer.subarray(offset));
900
- const flags = Number(r.readVarInt());
901
- if (flags >= 128) {
902
- if (!FETCH_END_OF_RANGE_MARKERS.has(flags)) {
903
- controller.error(
904
- new (0, _chunk4XLYCT5Qcjs.DecodeError)(
905
- "CONSTRAINT_VIOLATION",
906
- `0x${flags.toString(16)} is neither a flag combination below 128 nor one of the three End of Range markers`,
907
- 0
908
- )
909
- );
910
- return;
911
- }
912
- r.readVarInt();
913
- const objectDelta = r.readVarInt();
914
- const markerPayloadLength = Number(r.readVarInt());
915
- const markerPayloadByteOffset = r.offset;
916
- controller.enqueue({
917
- type: "object",
918
- objectId: objectDelta,
919
- objectIdDelta: objectDelta,
920
- payloadLength: markerPayloadLength,
921
- payload: new Uint8Array(0),
922
- extensionData: new Uint8Array(0),
923
- byteOffset: 0,
924
- payloadByteOffset: markerPayloadByteOffset
925
- });
926
- offset += r.offset;
927
- continue;
928
- }
929
- const objectIdPresent = (flags & 4) !== 0;
930
- const groupIdPresent = (flags & 8) !== 0;
931
- const priorityPresent = (flags & 16) !== 0;
932
- const extensionsPresent = (flags & 32) !== 0;
933
- const subgroupEncoding = flags & 3;
934
- const datagramMode = (flags & 64) !== 0;
935
- if (groupIdPresent) r.readVarInt();
936
- if (!datagramMode && subgroupEncoding === 3) r.readVarInt();
937
- let objectId = 0n;
938
- let objectIdDelta;
939
- if (objectIdPresent) {
940
- objectIdDelta = r.readVarInt();
941
- objectId = objectIdDelta;
942
- }
943
- if (priorityPresent) r.readUint8();
944
- let extensionData = new Uint8Array(0);
945
- if (extensionsPresent) {
946
- const extLen = Number(r.readVarInt());
947
- extensionData = extLen > 0 ? r.readBytesView(extLen) : new Uint8Array(0);
948
- }
949
- const payloadLength = Number(r.readVarInt());
950
- const payloadByteOffset = r.offset;
951
- const payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
952
- const event = {
953
- type: "object",
954
- objectId,
955
- payloadLength,
956
- payload,
957
- extensionData,
958
- byteOffset: 0,
959
- payloadByteOffset
960
- };
961
- if (objectIdDelta !== void 0)
962
- event.objectIdDelta = objectIdDelta;
963
- controller.enqueue(event);
964
- offset += r.offset;
884
+ obj = readFetchObject(r, b.base, st);
965
885
  } catch (e) {
966
- if (e instanceof _chunk4XLYCT5Qcjs.DecodeError && e.code === "UNEXPECTED_END") {
967
- break;
886
+ if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
887
+ b.offset = start;
888
+ return;
968
889
  }
969
890
  controller.error(e);
970
891
  return;
971
892
  }
893
+ b.offset = r.offset;
894
+ controller.enqueue(obj);
972
895
  }
973
896
  },
974
897
  flush(controller) {
975
- if (offset < buffer.length) {
976
- controller.error(new (0, _chunk4XLYCT5Qcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
898
+ if (b.unread > 0) {
899
+ controller.error(new (0, _chunk5IMHJIAZcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
977
900
  }
978
901
  }
979
902
  });
980
903
  }
981
904
  function createDataStreamDecoder() {
982
- let buffer = new Uint8Array(0);
983
- let offset = 0;
984
- let inner = null;
985
- return new TransformStream({
986
- transform(chunk, controller) {
987
- if (offset > 0) {
988
- buffer = buffer.subarray(offset);
989
- offset = 0;
990
- }
991
- const newBuffer = new Uint8Array(buffer.length + chunk.length);
992
- newBuffer.set(buffer, 0);
993
- newBuffer.set(chunk, buffer.length);
994
- buffer = newBuffer;
995
- if (inner === null) {
996
- if (offset >= buffer.length) return;
997
- const firstByte = buffer[offset];
998
- if (isValidSubgroupType(firstByte)) {
999
- const decoder = createSubgroupStreamDecoder();
1000
- inner = decoder;
1001
- } else if (firstByte === 5) {
1002
- const decoder = createFetchStreamDecoder();
1003
- inner = decoder;
1004
- } else {
1005
- controller.error(
1006
- new (0, _chunk4XLYCT5Qcjs.DecodeError)(
1007
- "CONSTRAINT_VIOLATION",
1008
- `Unknown data stream type: 0x${firstByte.toString(16)}`,
1009
- 0
1010
- )
1011
- );
1012
- return;
905
+ let writer = null;
906
+ let pump = Promise.resolve();
907
+ let broken = false;
908
+ function attach(inner, controller) {
909
+ writer = inner.writable.getWriter();
910
+ const reader = inner.readable.getReader();
911
+ pump = (async () => {
912
+ try {
913
+ for (; ; ) {
914
+ const { done, value } = await reader.read();
915
+ if (done) break;
916
+ controller.enqueue(value);
917
+ }
918
+ } catch (e) {
919
+ if (!broken) {
920
+ broken = true;
921
+ controller.error(e);
1013
922
  }
1014
923
  }
1015
- },
1016
- flush(controller) {
1017
- if (offset >= buffer.length) return;
1018
- const view = buffer.subarray(offset);
1019
- const firstByte = view[0];
1020
- let result;
924
+ })();
925
+ }
926
+ async function feed(bytes) {
927
+ if (writer === null || broken || bytes.length === 0) return;
928
+ try {
929
+ await writer.write(bytes);
930
+ } catch (e2) {
931
+ broken = true;
932
+ }
933
+ }
934
+ return new TransformStream({
935
+ async transform(chunk, controller) {
936
+ if (broken) return;
937
+ if (writer !== null) {
938
+ await feed(chunk);
939
+ return;
940
+ }
941
+ if (chunk.length === 0) return;
942
+ const firstByte = chunk[0];
1021
943
  if (isValidSubgroupType(firstByte)) {
1022
- result = decodeSubgroupStream(view);
944
+ attach(
945
+ createSubgroupStreamDecoder(),
946
+ controller
947
+ );
1023
948
  } else if (firstByte === 5) {
1024
- result = decodeFetchStream(view);
949
+ attach(
950
+ createFetchStreamDecoder(),
951
+ controller
952
+ );
1025
953
  } else {
954
+ broken = true;
1026
955
  controller.error(
1027
- new (0, _chunk4XLYCT5Qcjs.DecodeError)(
956
+ new (0, _chunk5IMHJIAZcjs.DecodeError)(
1028
957
  "CONSTRAINT_VIOLATION",
1029
958
  `Unknown data stream type: 0x${firstByte.toString(16)}`,
1030
959
  0
@@ -1032,31 +961,15 @@ function createDataStreamDecoder() {
1032
961
  );
1033
962
  return;
1034
963
  }
1035
- if (!result.ok) {
1036
- controller.error(result.error);
1037
- return;
1038
- }
1039
- const stream = result.value;
1040
- if (stream.type === "subgroup") {
1041
- controller.enqueue({
1042
- type: "subgroup_header",
1043
- trackAlias: stream.trackAlias,
1044
- groupId: stream.groupId,
1045
- subgroupId: stream.subgroupId,
1046
- publisherPriority: stream.publisherPriority
1047
- });
1048
- for (const obj of stream.objects) {
1049
- controller.enqueue(obj);
1050
- }
1051
- } else if (stream.type === "fetch") {
1052
- controller.enqueue({
1053
- type: "fetch_header",
1054
- requestId: stream.requestId
1055
- });
1056
- for (const obj of stream.objects) {
1057
- controller.enqueue(obj);
1058
- }
964
+ await feed(chunk);
965
+ },
966
+ async flush() {
967
+ if (writer === null) return;
968
+ try {
969
+ await writer.close();
970
+ } catch (e3) {
1059
971
  }
972
+ await pump;
1060
973
  }
1061
974
  });
1062
975
  }
@@ -1083,7 +996,7 @@ function encodeSetupOptions(opts, writer) {
1083
996
  entries.push({
1084
997
  type: SETUP_OPT_AUTHORIZATION_TOKEN,
1085
998
  encode: (w) => {
1086
- const tmpW = new (0, _chunk4XLYCT5Qcjs.MoqtBufferWriter)(64);
999
+ const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(64);
1087
1000
  encodeAuthorizationToken(token, tmpW);
1088
1001
  const raw = tmpW.finish();
1089
1002
  w.writeVarInt(BigInt(raw.byteLength));
@@ -1136,11 +1049,11 @@ function encodeSetupOptions(opts, writer) {
1136
1049
  type: id,
1137
1050
  encode: (w) => {
1138
1051
  if (id % 2n === 0n) {
1139
- const raw = _chunk4XLYCT5Qcjs.hexToBytes.call(void 0, u.raw_hex);
1140
- const tmpReader = new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(raw);
1052
+ const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
1053
+ const tmpReader = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(raw);
1141
1054
  w.writeVarInt(tmpReader.readVarInt());
1142
1055
  } else {
1143
- const raw = _chunk4XLYCT5Qcjs.hexToBytes.call(void 0, u.raw_hex);
1056
+ const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
1144
1057
  w.writeVarInt(BigInt(raw.byteLength));
1145
1058
  w.writeBytes(raw);
1146
1059
  }
@@ -1173,13 +1086,13 @@ function decodeSetupOptions(reader, payloadEnd) {
1173
1086
  } else if (optType === SETUP_OPT_MAX_REQUEST_UPDATES) {
1174
1087
  result.max_request_updates = value;
1175
1088
  } else {
1176
- const tmpWriter = new (0, _chunk4XLYCT5Qcjs.MoqtBufferWriter)(16);
1089
+ const tmpWriter = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(16);
1177
1090
  tmpWriter.writeVarInt(value);
1178
1091
  const raw = tmpWriter.finish();
1179
1092
  unknown.push({
1180
1093
  id: `0x${optType.toString(16)}`,
1181
1094
  length: raw.byteLength,
1182
- raw_hex: _chunk4XLYCT5Qcjs.bytesToHex.call(void 0, raw)
1095
+ raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, raw)
1183
1096
  });
1184
1097
  }
1185
1098
  } else {
@@ -1188,10 +1101,9 @@ function decodeSetupOptions(reader, payloadEnd) {
1188
1101
  if (optType === SETUP_OPT_PATH) {
1189
1102
  result.path = textDecoder.decode(bytes);
1190
1103
  } else if (optType === SETUP_OPT_AUTHORIZATION_TOKEN) {
1191
- result.authorization_token = [
1192
- ..._nullishCoalesce(result.authorization_token, () => ( [])),
1193
- decodeAuthorizationToken(new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(bytes))
1194
- ];
1104
+ const token = decodeAuthorizationToken(new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes));
1105
+ noteAuthTokenValue(reader.offset - length, length, token);
1106
+ result.authorization_token = [..._nullishCoalesce(result.authorization_token, () => ( [])), token];
1195
1107
  } else if (optType === SETUP_OPT_AUTHORITY) {
1196
1108
  result.authority = textDecoder.decode(bytes);
1197
1109
  } else if (optType === SETUP_OPT_MOQT_IMPLEMENTATION) {
@@ -1200,7 +1112,7 @@ function decodeSetupOptions(reader, payloadEnd) {
1200
1112
  unknown.push({
1201
1113
  id: `0x${optType.toString(16)}`,
1202
1114
  length,
1203
- raw_hex: _chunk4XLYCT5Qcjs.bytesToHex.call(void 0, bytes)
1115
+ raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, bytes)
1204
1116
  });
1205
1117
  }
1206
1118
  }
@@ -1220,6 +1132,11 @@ function encodeAuthorizationToken(token, w) {
1220
1132
  w.writeBytes(tv);
1221
1133
  }
1222
1134
  }
1135
+ function noteAuthTokenValue(valueStart, valueLength, token) {
1136
+ const value = token.token_value;
1137
+ if (value === void 0 || value.byteLength === 0) return;
1138
+ _chunk5IMHJIAZcjs.recordAuthValueSpan.call(void 0, valueStart + valueLength - value.byteLength, value.byteLength);
1139
+ }
1223
1140
  function decodeAuthorizationToken(r) {
1224
1141
  const alias_type = r.readVarInt();
1225
1142
  const aliasType = Number(alias_type);
@@ -1279,7 +1196,7 @@ function encodeRangeFilter(filter, hasProperty, w) {
1279
1196
  w.writeVarInt(0n);
1280
1197
  return;
1281
1198
  }
1282
- const tmpW = new (0, _chunk4XLYCT5Qcjs.MoqtBufferWriter)(32);
1199
+ const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(32);
1283
1200
  tmpW.writeUint8(Number(_nullishCoalesce(filter.set_id, () => ( 0n))));
1284
1201
  if (hasProperty) {
1285
1202
  tmpW.writeVarInt(_nullishCoalesce(filter.property_type, () => ( 0n)));
@@ -1326,7 +1243,7 @@ function encodeLocationFilter(f, w) {
1326
1243
  w.writeVarInt(0n);
1327
1244
  return;
1328
1245
  }
1329
- const tmpW = new (0, _chunk4XLYCT5Qcjs.MoqtBufferWriter)(48);
1246
+ const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(48);
1330
1247
  if (f.start_group !== void 0) tmpW.writeVarInt(f.start_group);
1331
1248
  if (f.start_object !== void 0) tmpW.writeVarInt(f.start_object);
1332
1249
  if (f.end_group_delta !== void 0) tmpW.writeVarInt(f.end_group_delta);
@@ -1341,14 +1258,14 @@ function decodeLocationFilter(reader) {
1341
1258
  if (length === 0) {
1342
1259
  return { removed: true };
1343
1260
  }
1344
- const r = new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(valueBytes);
1261
+ const r = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(valueBytes);
1345
1262
  const fields = [];
1346
1263
  while (r.remaining > 0) {
1347
1264
  let value;
1348
1265
  try {
1349
1266
  value = r.readVarInt();
1350
- } catch (e2) {
1351
- throw new (0, _chunk4XLYCT5Qcjs.DecodeError)(
1267
+ } catch (e4) {
1268
+ throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
1352
1269
  "CONSTRAINT_VIOLATION",
1353
1270
  "a LOCATION_FILTER field must not extend past the parameter's Length",
1354
1271
  reader.offset
@@ -1356,7 +1273,7 @@ function decodeLocationFilter(reader) {
1356
1273
  }
1357
1274
  fields.push(value);
1358
1275
  if (fields.length > 4) {
1359
- throw new (0, _chunk4XLYCT5Qcjs.DecodeError)(
1276
+ throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
1360
1277
  "CONSTRAINT_VIOLATION",
1361
1278
  "a LOCATION_FILTER value may hold at most four vi64 fields",
1362
1279
  reader.offset
@@ -1370,7 +1287,7 @@ function decodeLocationFilter(reader) {
1370
1287
  if (fields.length >= 4) filter.end_object = fields[3];
1371
1288
  if (filter.start_group !== void 0 && filter.end_group_delta !== void 0) {
1372
1289
  if (filter.start_group + filter.end_group_delta > MAX_U642) {
1373
- throw new (0, _chunk4XLYCT5Qcjs.DecodeError)(
1290
+ throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
1374
1291
  "CONSTRAINT_VIOLATION",
1375
1292
  "StartGroup + EndGroupDelta exceeds 2^64 - 1",
1376
1293
  reader.offset
@@ -1402,24 +1319,24 @@ var PARAMETER_SCOPE = /* @__PURE__ */ new Map([
1402
1319
  [PARAM_SUBGROUP_DELIVERY_TIMEOUT, /* @__PURE__ */ new Set(["subscribe", "publish", "request_update"])],
1403
1320
  // 0x08 EXPIRES (10.2.16) — the one parameter that still names PUBLISH_OK.
1404
1321
  [PARAM_EXPIRES, /* @__PURE__ */ new Set(["subscribe_ok", "publish", "request_ok"])],
1405
- // 0x09 LARGEST_OBJECT (10.2.17) — gained PUBLISH_STATE_NOTIFY in draft-20.
1322
+ // 0x09 LARGEST_OBJECT (10.2.17) — PUBLISH_STATE_NOTIFY here; draft-19 (10.2.16) omits it.
1406
1323
  [
1407
1324
  PARAM_LARGEST_OBJECT,
1408
1325
  /* @__PURE__ */ new Set(["subscribe_ok", "publish", "request_ok", "publish_state_notify"])
1409
1326
  ],
1410
1327
  // 0x0A FILL_TIMEOUT (10.2.5) — FETCH, or nested inside FILL_PARAMETERS.
1411
1328
  [PARAM_FILL_TIMEOUT, /* @__PURE__ */ new Set(["fetch", FILL_SCOPE])],
1412
- // 0x10 FORWARD (10.2.18) — lost PUBLISH_OK, gained PUBLISH_STATE_NOTIFY.
1329
+ // 0x10 FORWARD (10.2.18) — PUBLISH_STATE_NOTIFY here where draft-19 (10.2.17) lists PUBLISH_OK.
1413
1330
  [
1414
1331
  PARAM_FORWARD,
1415
1332
  /* @__PURE__ */ new Set(["subscribe", "request_update", "publish", "subscribe_tracks", "publish_state_notify"])
1416
1333
  ],
1417
- // 0x20 SUBSCRIBER_PRIORITY (10.2.7) — lost PUBLISH_OK, gained PUBLISH.
1334
+ // 0x20 SUBSCRIBER_PRIORITY (10.2.7) — PUBLISH here where draft-19 lists PUBLISH_OK.
1418
1335
  [
1419
1336
  PARAM_SUBSCRIBER_PRIORITY,
1420
1337
  /* @__PURE__ */ new Set(["subscribe", "publish", "fetch", "request_update", FILL_SCOPE])
1421
1338
  ],
1422
- // 0x21 LOCATION_FILTER (10.2.9) — lost PUBLISH_OK, gained PUBLISH and PUBLISH_STATE_NOTIFY.
1339
+ // 0x21 LOCATION_FILTER (10.2.9) — PUBLISH and PUBLISH_STATE_NOTIFY here where draft-19 lists PUBLISH_OK.
1423
1340
  [
1424
1341
  PARAM_LOCATION_FILTER,
1425
1342
  /* @__PURE__ */ new Set([
@@ -1431,12 +1348,12 @@ var PARAMETER_SCOPE = /* @__PURE__ */ new Map([
1431
1348
  FILL_SCOPE
1432
1349
  ])
1433
1350
  ],
1434
- // 0x22 GROUP_ORDER (10.2.8) — gained PUBLISH and FILL_PARAMETERS nesting.
1351
+ // 0x22 GROUP_ORDER (10.2.8) — PUBLISH and FILL_PARAMETERS nesting here; draft-19 has neither.
1435
1352
  [PARAM_GROUP_ORDER, /* @__PURE__ */ new Set(["subscribe", "publish", "subscribe_tracks", "fetch", FILL_SCOPE])],
1436
1353
  // 0x23 FILL_PARAMETERS (10.2.15) — NEW. Subscriptions only, and never nested
1437
1354
  // in itself: a FETCH already is a fetch, so it has nothing to fill.
1438
1355
  [PARAM_FILL_PARAMETERS, /* @__PURE__ */ new Set(["subscribe", "request_update"])],
1439
- // 0x25-0x28 range filters (5.1.4) — lost PUBLISH_OK, gained FILL_PARAMETERS nesting.
1356
+ // 0x25-0x28 range filters (5.1.4) — permitted inside FILL_PARAMETERS (Table 6).
1440
1357
  [
1441
1358
  PARAM_SUBGROUP_FILTER,
1442
1359
  /* @__PURE__ */ new Set(["fetch", "subscribe", "subscribe_tracks", "request_update", FILL_SCOPE])
@@ -1453,11 +1370,11 @@ var PARAMETER_SCOPE = /* @__PURE__ */ new Map([
1453
1370
  PARAM_OBJECT_PROPERTY_FILTER,
1454
1371
  /* @__PURE__ */ new Set(["fetch", "subscribe", "subscribe_tracks", "request_update", FILL_SCOPE])
1455
1372
  ],
1456
- // 0x29 TRACK_PROPERTY_FILTER (10.2.14) — lost PUBLISH_OK; NOT permitted
1457
- // inside FILL_PARAMETERS. A relay forwarding a downstream FILL_PARAMETERS
1458
- // upstream has to strip it rather than trip this rule.
1373
+ // 0x29 TRACK_PROPERTY_FILTER (10.2.14) — NOT permitted inside
1374
+ // FILL_PARAMETERS: Table 6 omits it. A relay forwarding a downstream
1375
+ // FILL_PARAMETERS upstream has to strip it rather than trip this rule.
1459
1376
  [PARAM_TRACK_PROPERTY_FILTER, /* @__PURE__ */ new Set(["subscribe_tracks", "request_update"])],
1460
- // 0x32 NEW_GROUP_REQUEST (10.2.19) — lost PUBLISH_OK.
1377
+ // 0x32 NEW_GROUP_REQUEST (10.2.19) — draft-19 (10.2.18) also lists PUBLISH_OK.
1461
1378
  [PARAM_NEW_GROUP_REQUEST, /* @__PURE__ */ new Set(["subscribe", "request_update"])],
1462
1379
  // 0x34 TRACK_NAMESPACE_PREFIX (10.2.20) — REQUEST_UPDATE for a namespace subscription.
1463
1380
  [PARAM_TRACK_NAMESPACE_PREFIX, /* @__PURE__ */ new Set(["request_update"])],
@@ -1476,7 +1393,7 @@ function encodeParams(params, writer) {
1476
1393
  entries.push({
1477
1394
  type: PARAM_AUTHORIZATION_TOKEN,
1478
1395
  encode: (w) => {
1479
- const tmpW = new (0, _chunk4XLYCT5Qcjs.MoqtBufferWriter)(64);
1396
+ const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(64);
1480
1397
  encodeAuthorizationToken(token, tmpW);
1481
1398
  const raw = tmpW.finish();
1482
1399
  w.writeVarInt(BigInt(raw.byteLength));
@@ -1549,7 +1466,7 @@ function encodeParams(params, writer) {
1549
1466
  entries.push({
1550
1467
  type: PARAM_FILL_PARAMETERS,
1551
1468
  encode: (w) => {
1552
- const tmpW = new (0, _chunk4XLYCT5Qcjs.MoqtBufferWriter)(64);
1469
+ const tmpW = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(64);
1553
1470
  encodeParams(params.fill_parameters, tmpW);
1554
1471
  const raw = tmpW.finish();
1555
1472
  w.writeVarInt(BigInt(raw.byteLength));
@@ -1617,7 +1534,7 @@ function encodeParams(params, writer) {
1617
1534
  entries.push({
1618
1535
  type: id,
1619
1536
  encode: (w) => {
1620
- const raw = _chunk4XLYCT5Qcjs.hexToBytes.call(void 0, u.raw_hex);
1537
+ const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
1621
1538
  w.writeBytes(raw);
1622
1539
  }
1623
1540
  });
@@ -1642,7 +1559,7 @@ function decodeParams(reader, messageType) {
1642
1559
  prevType = paramType;
1643
1560
  const scope = PARAMETER_SCOPE.get(paramType);
1644
1561
  if (scope !== void 0 && !scope.has(messageType)) {
1645
- throw new (0, _chunk4XLYCT5Qcjs.DecodeError)(
1562
+ throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
1646
1563
  "CONSTRAINT_VIOLATION",
1647
1564
  `Message Parameter 0x${paramType.toString(16)} may not appear in ${messageType}`,
1648
1565
  reader.offset
@@ -1653,10 +1570,9 @@ function decodeParams(reader, messageType) {
1653
1570
  } else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
1654
1571
  const length = Number(reader.readVarInt());
1655
1572
  const bytes = reader.readBytes(length);
1656
- result.authorization_token = [
1657
- ..._nullishCoalesce(result.authorization_token, () => ( [])),
1658
- decodeAuthorizationToken(new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(bytes))
1659
- ];
1573
+ const token = decodeAuthorizationToken(new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes));
1574
+ noteAuthTokenValue(reader.offset - length, length, token);
1575
+ result.authorization_token = [..._nullishCoalesce(result.authorization_token, () => ( [])), token];
1660
1576
  } else if (paramType === PARAM_RENDEZVOUS_TIMEOUT) {
1661
1577
  result.rendezvous_timeout = reader.readVarInt();
1662
1578
  } else if (paramType === PARAM_SUBGROUP_DELIVERY_TIMEOUT) {
@@ -1702,7 +1618,7 @@ function decodeParams(reader, messageType) {
1702
1618
  } else if (paramType === PARAM_INCLUDE_PROPERTIES) {
1703
1619
  const value = BigInt(reader.readUint8());
1704
1620
  if (value !== 0n && value !== 1n) {
1705
- throw new (0, _chunk4XLYCT5Qcjs.DecodeError)(
1621
+ throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
1706
1622
  "CONSTRAINT_VIOLATION",
1707
1623
  `INCLUDE_PROPERTIES accepts only 0 or 1, got ${value}`,
1708
1624
  reader.offset
@@ -1710,7 +1626,7 @@ function decodeParams(reader, messageType) {
1710
1626
  }
1711
1627
  result.include_properties = value;
1712
1628
  } else {
1713
- throw new (0, _chunk4XLYCT5Qcjs.DecodeError)(
1629
+ throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
1714
1630
  "INVALID_PARAMETER",
1715
1631
  `Unknown Message Parameter type 0x${paramType.toString(16)}`,
1716
1632
  reader.offset
@@ -1722,10 +1638,10 @@ function decodeParams(reader, messageType) {
1722
1638
  function decodeFillParameters(reader) {
1723
1639
  const length = Number(reader.readVarInt());
1724
1640
  const valueBytes = reader.readBytes(length);
1725
- const nested = new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(valueBytes);
1726
- const params = decodeParams(nested, FILL_SCOPE);
1641
+ const nested = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(valueBytes);
1642
+ const params = _chunk5IMHJIAZcjs.withoutAuthValueSpans.call(void 0, () => decodeParams(nested, FILL_SCOPE));
1727
1643
  if (nested.remaining > 0) {
1728
- throw new (0, _chunk4XLYCT5Qcjs.DecodeError)(
1644
+ throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
1729
1645
  "CONSTRAINT_VIOLATION",
1730
1646
  `FILL_PARAMETERS has ${nested.remaining} trailing byte(s) after its parameter block`,
1731
1647
  reader.offset
@@ -1795,11 +1711,11 @@ function encodeTrackProperties(props, writer) {
1795
1711
  type: id,
1796
1712
  encode: (w) => {
1797
1713
  if (id % 2n === 0n) {
1798
- const raw = _chunk4XLYCT5Qcjs.hexToBytes.call(void 0, u.raw_hex);
1799
- const tmpReader = new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(raw);
1714
+ const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
1715
+ const tmpReader = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(raw);
1800
1716
  w.writeVarInt(tmpReader.readVarInt());
1801
1717
  } else {
1802
- const raw = _chunk4XLYCT5Qcjs.hexToBytes.call(void 0, u.raw_hex);
1718
+ const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
1803
1719
  w.writeVarInt(BigInt(raw.byteLength));
1804
1720
  w.writeBytes(raw);
1805
1721
  }
@@ -1838,13 +1754,13 @@ function decodeTrackProperties(reader, payloadEnd) {
1838
1754
  } else if (propType === TPROP_DYNAMIC_GROUPS) {
1839
1755
  result.dynamic_groups = value;
1840
1756
  } else {
1841
- const tmpWriter = new (0, _chunk4XLYCT5Qcjs.MoqtBufferWriter)(16);
1757
+ const tmpWriter = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(16);
1842
1758
  tmpWriter.writeVarInt(value);
1843
1759
  const raw = tmpWriter.finish();
1844
1760
  unknown.push({
1845
1761
  id: `0x${propType.toString(16)}`,
1846
1762
  length: raw.byteLength,
1847
- raw_hex: _chunk4XLYCT5Qcjs.bytesToHex.call(void 0, raw)
1763
+ raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, raw)
1848
1764
  });
1849
1765
  }
1850
1766
  } else {
@@ -1856,7 +1772,7 @@ function decodeTrackProperties(reader, payloadEnd) {
1856
1772
  unknown.push({
1857
1773
  id: `0x${propType.toString(16)}`,
1858
1774
  length,
1859
- raw_hex: _chunk4XLYCT5Qcjs.bytesToHex.call(void 0, bytes)
1775
+ raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, bytes)
1860
1776
  });
1861
1777
  }
1862
1778
  }
@@ -2147,13 +2063,13 @@ function encodeMessage(message) {
2147
2063
  if (typeId === void 0) {
2148
2064
  throw new Error(`Unknown message type: ${message.type}`);
2149
2065
  }
2150
- const payloadWriter = new (0, _chunk4XLYCT5Qcjs.MoqtBufferWriter)();
2066
+ const payloadWriter = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)();
2151
2067
  encodePayload(message, payloadWriter);
2152
2068
  const payload = payloadWriter.finishView();
2153
2069
  if (payload.byteLength > 65535) {
2154
2070
  throw new Error(`Payload too large for 16-bit length: ${payload.byteLength}`);
2155
2071
  }
2156
- const writer = new (0, _chunk4XLYCT5Qcjs.MoqtBufferWriter)(payload.byteLength + 16);
2072
+ const writer = new (0, _chunk5IMHJIAZcjs.MoqtBufferWriter)(payload.byteLength + 16);
2157
2073
  writer.writeVarInt(typeId);
2158
2074
  writer.writeUint8(payload.byteLength >> 8 & 255);
2159
2075
  writer.writeUint8(payload.byteLength & 255);
@@ -2208,13 +2124,13 @@ function encodePayload(msg, w) {
2208
2124
  }
2209
2125
  function decodeMessage(bytes) {
2210
2126
  try {
2211
- const reader = new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(bytes);
2127
+ const reader = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes);
2212
2128
  const typeId = reader.readVarInt();
2213
2129
  const lenHi = reader.readUint8();
2214
2130
  const lenLo = reader.readUint8();
2215
2131
  const payloadLength = lenHi << 8 | lenLo;
2216
2132
  const payloadBytes = reader.readBytes(payloadLength);
2217
- const payloadReader = new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(payloadBytes);
2133
+ const payloadReader = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(payloadBytes);
2218
2134
  let message;
2219
2135
  if (typeId === MSG_SETUP) {
2220
2136
  message = decodeSetupPayload(payloadReader, payloadLength);
@@ -2257,7 +2173,7 @@ function decodeMessage(bytes) {
2257
2173
  } else {
2258
2174
  return {
2259
2175
  ok: false,
2260
- error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
2176
+ error: new (0, _chunk5IMHJIAZcjs.DecodeError)(
2261
2177
  "UNKNOWN_MESSAGE_TYPE",
2262
2178
  `Unknown message type ID: 0x${typeId.toString(16)}`,
2263
2179
  0
@@ -2266,7 +2182,7 @@ function decodeMessage(bytes) {
2266
2182
  }
2267
2183
  return { ok: true, value: message, bytesRead: reader.offset };
2268
2184
  } catch (e) {
2269
- if (e instanceof _chunk4XLYCT5Qcjs.DecodeError) {
2185
+ if (e instanceof _chunk5IMHJIAZcjs.DecodeError) {
2270
2186
  return { ok: false, error: e };
2271
2187
  }
2272
2188
  throw e;
@@ -2301,7 +2217,7 @@ function createStreamDecoder() {
2301
2217
  flush(controller) {
2302
2218
  if (offset < buffer.length) {
2303
2219
  controller.error(
2304
- new (0, _chunk4XLYCT5Qcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete message data", 0)
2220
+ new (0, _chunk5IMHJIAZcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete message data", 0)
2305
2221
  );
2306
2222
  }
2307
2223
  }
@@ -2325,6 +2241,20 @@ function createDraft20Codec() {
2325
2241
  createDataStreamDecoder
2326
2242
  };
2327
2243
  }
2244
+ function redactAuthTokens(bytes) {
2245
+ let payloadStart;
2246
+ try {
2247
+ const probe = new (0, _chunk5IMHJIAZcjs.MoqtBufferReader)(bytes);
2248
+ probe.readVarInt();
2249
+ probe.readUint8();
2250
+ probe.readUint8();
2251
+ payloadStart = probe.offset;
2252
+ } catch (e5) {
2253
+ return { bytes, redacted: 0, incomplete: false, decoded: false };
2254
+ }
2255
+ return _chunk5IMHJIAZcjs.redactWith.call(void 0, bytes, payloadStart, () => decodeMessage(bytes).ok);
2256
+ }
2257
+
2328
2258
 
2329
2259
 
2330
2260
 
@@ -2371,4 +2301,4 @@ function createDraft20Codec() {
2371
2301
 
2372
2302
 
2373
2303
 
2374
- exports.MSG_REQUEST_UPDATE = MSG_REQUEST_UPDATE; exports.MSG_SUBSCRIBE = MSG_SUBSCRIBE; exports.MSG_SUBSCRIBE_OK = MSG_SUBSCRIBE_OK; exports.MSG_REQUEST_ERROR = MSG_REQUEST_ERROR; exports.MSG_PUBLISH_NAMESPACE = MSG_PUBLISH_NAMESPACE; exports.MSG_REQUEST_OK = MSG_REQUEST_OK; exports.MSG_NAMESPACE = MSG_NAMESPACE; exports.MSG_PUBLISH_DONE = MSG_PUBLISH_DONE; exports.MSG_TRACK_STATUS = MSG_TRACK_STATUS; exports.MSG_NAMESPACE_DONE = MSG_NAMESPACE_DONE; exports.MSG_PUBLISH_SKIPPED = MSG_PUBLISH_SKIPPED; exports.MSG_GOAWAY = MSG_GOAWAY; exports.MSG_FETCH = MSG_FETCH; exports.MSG_FETCH_OK = MSG_FETCH_OK; exports.MSG_PUBLISH = MSG_PUBLISH; exports.MSG_PUBLISH_STATE_NOTIFY = MSG_PUBLISH_STATE_NOTIFY; exports.MSG_PUBLISH_OK = MSG_PUBLISH_OK; exports.MSG_SUBSCRIBE_NAMESPACE = MSG_SUBSCRIBE_NAMESPACE; exports.MSG_SUBSCRIBE_TRACKS = MSG_SUBSCRIBE_TRACKS; exports.MSG_SETUP = MSG_SETUP; exports.SETUP_OPT_PATH = SETUP_OPT_PATH; exports.SETUP_OPT_AUTHORIZATION_TOKEN = SETUP_OPT_AUTHORIZATION_TOKEN; exports.SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE = SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE; exports.SETUP_OPT_AUTHORITY = SETUP_OPT_AUTHORITY; exports.SETUP_OPT_MAX_FILTER_RANGES = SETUP_OPT_MAX_FILTER_RANGES; exports.SETUP_OPT_MOQT_IMPLEMENTATION = SETUP_OPT_MOQT_IMPLEMENTATION; exports.SETUP_OPT_MAX_REQUEST_UPDATES = SETUP_OPT_MAX_REQUEST_UPDATES; exports.MESSAGE_TYPE_MAP = MESSAGE_TYPE_MAP; exports.MESSAGE_ID_MAP = MESSAGE_ID_MAP; exports.encodeSubgroupStream = encodeSubgroupStream; exports.encodeDatagram = encodeDatagram; exports.encodeFetchStream = encodeFetchStream; exports.decodeSubgroupStream = decodeSubgroupStream; exports.decodeDatagram = decodeDatagram; exports.decodeFetchStream = decodeFetchStream; exports.decodeDataStream = decodeDataStream; exports.createSubgroupStreamDecoder = createSubgroupStreamDecoder; exports.createFetchStreamDecoder = createFetchStreamDecoder; exports.createDataStreamDecoder = createDataStreamDecoder; exports.UNKNOWN_STREAM_COUNT = UNKNOWN_STREAM_COUNT; exports.encodeMessage = encodeMessage; exports.decodeMessage = decodeMessage; exports.createStreamDecoder = createStreamDecoder; exports.createDraft20Codec = createDraft20Codec;
2304
+ exports.MSG_REQUEST_UPDATE = MSG_REQUEST_UPDATE; exports.MSG_SUBSCRIBE = MSG_SUBSCRIBE; exports.MSG_SUBSCRIBE_OK = MSG_SUBSCRIBE_OK; exports.MSG_REQUEST_ERROR = MSG_REQUEST_ERROR; exports.MSG_PUBLISH_NAMESPACE = MSG_PUBLISH_NAMESPACE; exports.MSG_REQUEST_OK = MSG_REQUEST_OK; exports.MSG_NAMESPACE = MSG_NAMESPACE; exports.MSG_PUBLISH_DONE = MSG_PUBLISH_DONE; exports.MSG_TRACK_STATUS = MSG_TRACK_STATUS; exports.MSG_NAMESPACE_DONE = MSG_NAMESPACE_DONE; exports.MSG_PUBLISH_SKIPPED = MSG_PUBLISH_SKIPPED; exports.MSG_GOAWAY = MSG_GOAWAY; exports.MSG_FETCH = MSG_FETCH; exports.MSG_FETCH_OK = MSG_FETCH_OK; exports.MSG_PUBLISH = MSG_PUBLISH; exports.MSG_PUBLISH_STATE_NOTIFY = MSG_PUBLISH_STATE_NOTIFY; exports.MSG_PUBLISH_OK = MSG_PUBLISH_OK; exports.MSG_SUBSCRIBE_NAMESPACE = MSG_SUBSCRIBE_NAMESPACE; exports.MSG_SUBSCRIBE_TRACKS = MSG_SUBSCRIBE_TRACKS; exports.MSG_SETUP = MSG_SETUP; exports.SETUP_OPT_PATH = SETUP_OPT_PATH; exports.SETUP_OPT_AUTHORIZATION_TOKEN = SETUP_OPT_AUTHORIZATION_TOKEN; exports.SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE = SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE; exports.SETUP_OPT_AUTHORITY = SETUP_OPT_AUTHORITY; exports.SETUP_OPT_MAX_FILTER_RANGES = SETUP_OPT_MAX_FILTER_RANGES; exports.SETUP_OPT_MOQT_IMPLEMENTATION = SETUP_OPT_MOQT_IMPLEMENTATION; exports.SETUP_OPT_MAX_REQUEST_UPDATES = SETUP_OPT_MAX_REQUEST_UPDATES; exports.MESSAGE_TYPE_MAP = MESSAGE_TYPE_MAP; exports.MESSAGE_ID_MAP = MESSAGE_ID_MAP; exports.encodeSubgroupStream = encodeSubgroupStream; exports.encodeDatagram = encodeDatagram; exports.encodeFetchStream = encodeFetchStream; exports.decodeSubgroupStream = decodeSubgroupStream; exports.decodeDatagram = decodeDatagram; exports.decodeFetchStream = decodeFetchStream; exports.decodeDataStream = decodeDataStream; exports.createSubgroupStreamDecoder = createSubgroupStreamDecoder; exports.createFetchStreamDecoder = createFetchStreamDecoder; exports.createDataStreamDecoder = createDataStreamDecoder; exports.UNKNOWN_STREAM_COUNT = UNKNOWN_STREAM_COUNT; exports.encodeMessage = encodeMessage; exports.decodeMessage = decodeMessage; exports.createStreamDecoder = createStreamDecoder; exports.createDraft20Codec = createDraft20Codec; exports.redactAuthTokens = redactAuthTokens;