@moqtap/codec 0.2.3 → 0.4.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 (313) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +100 -99
  3. package/dist/{chunk-RZHAPEXO.js → chunk-2A57DRXV.js} +36 -10
  4. package/dist/{chunk-73MWUKSJ.js → chunk-2UTVXWFF.js} +190 -102
  5. package/dist/{chunk-JTVCOMBI.cjs → chunk-3XKO6PCR.cjs} +290 -183
  6. package/dist/{chunk-ACQ4CUJP.cjs → chunk-4BDEU3D4.cjs} +237 -158
  7. package/dist/{chunk-4N4INRE7.cjs → chunk-4HBKHNU2.cjs} +144 -110
  8. package/dist/{chunk-2ZT6CVSE.js → chunk-4IVZZOY3.js} +269 -162
  9. package/dist/{chunk-GLBQDG4L.cjs → chunk-5O764MBD.cjs} +508 -117
  10. package/dist/chunk-7KBAWOBA.js +1212 -0
  11. package/dist/{chunk-JSQM2MG3.js → chunk-7QOPNSDF.js} +44 -12
  12. package/dist/{chunk-SYHW3FLI.cjs → chunk-7RE6KSIY.cjs} +28 -8
  13. package/dist/{chunk-YG5KJESI.js → chunk-AY6IAHUM.js} +28 -8
  14. package/dist/{chunk-EFM5T7OM.js → chunk-BLQDWOSG.js} +36 -10
  15. package/dist/{chunk-UYXTY6ZQ.cjs → chunk-E65QKRSN.cjs} +20 -12
  16. package/dist/{chunk-BISI45MN.cjs → chunk-EAHE3IOG.cjs} +44 -12
  17. package/dist/{chunk-PZBPH2D7.js → chunk-GCBFHZW6.js} +216 -137
  18. package/dist/{chunk-GXEW4COZ.cjs → chunk-H5NSL4MO.cjs} +36 -10
  19. package/dist/chunk-HZHSO7EW.cjs +1212 -0
  20. package/dist/{chunk-KZCYQ7ED.cjs → chunk-IILNSDEQ.cjs} +69 -41
  21. package/dist/{chunk-4XYGE53S.cjs → chunk-J3XCPBW3.cjs} +36 -10
  22. package/dist/{chunk-6AEHWULA.cjs → chunk-JKOEJZ5B.cjs} +28 -8
  23. package/dist/{chunk-RUPCJTC3.cjs → chunk-JL3NEW3O.cjs} +23 -1
  24. package/dist/{chunk-G7GI7LJA.js → chunk-LORZMJJB.js} +36 -10
  25. package/dist/{chunk-DUBCL3WF.cjs → chunk-LV5C6MEC.cjs} +36 -10
  26. package/dist/{chunk-ENURAVHI.cjs → chunk-MYXAD5JC.cjs} +44 -12
  27. package/dist/{chunk-FXZ2MYKJ.js → chunk-MZ7HUCGJ.js} +20 -12
  28. package/dist/{chunk-S74DWJE2.cjs → chunk-OKG2HT25.cjs} +277 -88
  29. package/dist/{chunk-BGWGVINJ.cjs → chunk-PKEOQSSZ.cjs} +144 -110
  30. package/dist/{chunk-2GODRVT5.js → chunk-Q46ZURKX.js} +325 -48
  31. package/dist/{chunk-UR6JKS56.js → chunk-Q7IGWV3P.js} +41 -9
  32. package/dist/{chunk-XSNX2IUJ.js → chunk-RW4UG7CN.js} +121 -87
  33. package/dist/{chunk-DWK5ZQZ4.js → chunk-RZTLQAKF.js} +28 -8
  34. package/dist/{chunk-UNS34PTA.cjs → chunk-S6IPIN66.cjs} +44 -12
  35. package/dist/{chunk-YIG2C3LF.cjs → chunk-SDWRXXOO.cjs} +214 -126
  36. package/dist/{chunk-CEH7ESNC.js → chunk-SHMA4PBY.js} +121 -87
  37. package/dist/{chunk-MC7W6PMI.js → chunk-U3ZVLT5L.js} +483 -135
  38. package/dist/{chunk-VJUUZ4W2.cjs → chunk-UJU63EFY.cjs} +374 -97
  39. package/dist/{chunk-7L43FE6P.js → chunk-VOU7PNHI.js} +23 -1
  40. package/dist/{chunk-E6E3NQYU.js → chunk-WRHGCVYN.js} +44 -12
  41. package/dist/{chunk-FPISPJ5N.cjs → chunk-XNWYLVGU.cjs} +529 -181
  42. package/dist/{chunk-U3IPZYPX.js → chunk-XS77RBY7.js} +228 -39
  43. package/dist/{chunk-JGG7CMSZ.cjs → chunk-XZE5R57R.cjs} +144 -110
  44. package/dist/{chunk-77MNXX3M.js → chunk-Y6KCSM3V.js} +121 -87
  45. package/dist/{chunk-TLYNOOQP.cjs → chunk-YTPZZI2M.cjs} +41 -9
  46. package/dist/{chunk-7DUBLRXC.js → chunk-YWRCSQBA.js} +44 -12
  47. package/dist/{chunk-MRJWLGYH.js → chunk-Z3VKP3PJ.js} +69 -41
  48. package/dist/{chunk-E6P74GDT.js → chunk-Z6U26IRI.js} +464 -73
  49. package/dist/{codec-FvGCxIhr.d.ts → codec-25u4_1HS.d.ts} +4 -4
  50. package/dist/{codec-DRcsBCsb.d.ts → codec-3Ppy_5Gd.d.ts} +4 -4
  51. package/dist/{codec-BdVMRMOI.d.ts → codec-BB0U8MF2.d.cts} +4 -4
  52. package/dist/{codec-B2cH-f5V.d.cts → codec-BHHfBTnV.d.ts} +4 -4
  53. package/dist/{codec-B5K73Bdj.d.ts → codec-BN6jk0Td.d.cts} +4 -4
  54. package/dist/{codec-R8GrCPt2.d.ts → codec-BU0gaSZm.d.ts} +4 -4
  55. package/dist/{codec-Bq-tLtfP.d.ts → codec-C-Yk2RNa.d.ts} +4 -4
  56. package/dist/codec-CFWQY9Lj.d.cts +18 -0
  57. package/dist/{codec-CPlK3Pi5.d.ts → codec-COy4uuPO.d.cts} +4 -4
  58. package/dist/codec-CewFCsEy.d.ts +18 -0
  59. package/dist/{codec-KXHvXZVb.d.cts → codec-Ck7ZwFF1.d.cts} +4 -4
  60. package/dist/{codec-DZhZSIii.d.cts → codec-D2QVSH9D.d.ts} +4 -4
  61. package/dist/{codec-BwFgpeQu.d.ts → codec-DDUBJGn0.d.cts} +4 -4
  62. package/dist/{codec-BFeliJFc.d.ts → codec-DNfml-se.d.ts} +4 -4
  63. package/dist/{codec-C4n1PS09.d.cts → codec-DoOGjjDq.d.cts} +4 -4
  64. package/dist/{codec-Bap882Fh.d.cts → codec-J7ekOSMc.d.ts} +4 -4
  65. package/dist/{codec-SKBeHQk7.d.ts → codec-R9TJCq-E.d.cts} +4 -4
  66. package/dist/{codec-DNUIgLqc.d.cts → codec-ZwV-Njt6.d.ts} +4 -4
  67. package/dist/{codec-HgBgHkFI.d.cts → codec-j819z_hL.d.cts} +4 -4
  68. package/dist/{codec-DY4QH364.d.cts → codec-w8z2j_uo.d.cts} +4 -4
  69. package/dist/{codec-CPvPq0sb.d.cts → codec-wtt6WF1K.d.ts} +4 -4
  70. package/dist/{codec-BUMjz0J4.d.cts → codec-z6_2PSzi.d.cts} +4 -4
  71. package/dist/{draft7-session.cjs → draft07-session.cjs} +2 -2
  72. package/dist/draft07-session.d.cts +8 -0
  73. package/dist/draft07-session.d.ts +8 -0
  74. package/dist/{draft7-session.js → draft07-session.js} +1 -1
  75. package/dist/draft07.cjs +129 -0
  76. package/dist/draft07.d.cts +67 -0
  77. package/dist/draft07.d.ts +67 -0
  78. package/dist/draft07.js +129 -0
  79. package/dist/draft08-session.cjs +6 -0
  80. package/dist/draft08-session.d.cts +8 -0
  81. package/dist/draft08-session.d.ts +8 -0
  82. package/dist/{draft8-session.js → draft08-session.js} +1 -1
  83. package/dist/draft08.cjs +119 -0
  84. package/dist/{draft8.d.cts → draft08.d.cts} +15 -13
  85. package/dist/{draft8.d.ts → draft08.d.ts} +15 -13
  86. package/dist/{draft8.js → draft08.js} +7 -4
  87. package/dist/draft09-session.cjs +6 -0
  88. package/dist/draft09-session.d.cts +8 -0
  89. package/dist/draft09-session.d.ts +8 -0
  90. package/dist/{draft9-session.js → draft09-session.js} +1 -1
  91. package/dist/draft09.cjs +119 -0
  92. package/dist/{draft9.d.cts → draft09.d.cts} +15 -13
  93. package/dist/{draft9.d.ts → draft09.d.ts} +15 -13
  94. package/dist/{draft9.js → draft09.js} +7 -4
  95. package/dist/draft10-session.cjs +2 -2
  96. package/dist/draft10-session.d.cts +6 -6
  97. package/dist/draft10-session.d.ts +6 -6
  98. package/dist/draft10-session.js +1 -1
  99. package/dist/draft10.cjs +8 -5
  100. package/dist/draft10.d.cts +14 -12
  101. package/dist/draft10.d.ts +14 -12
  102. package/dist/draft10.js +16 -13
  103. package/dist/draft11-session.cjs +2 -2
  104. package/dist/draft11-session.d.cts +6 -6
  105. package/dist/draft11-session.d.ts +6 -6
  106. package/dist/draft11-session.js +1 -1
  107. package/dist/draft11.cjs +8 -5
  108. package/dist/draft11.d.cts +14 -12
  109. package/dist/draft11.d.ts +14 -12
  110. package/dist/draft11.js +16 -13
  111. package/dist/draft12-session.cjs +2 -2
  112. package/dist/draft12-session.d.cts +6 -6
  113. package/dist/draft12-session.d.ts +6 -6
  114. package/dist/draft12-session.js +1 -1
  115. package/dist/draft12.cjs +8 -5
  116. package/dist/draft12.d.cts +16 -14
  117. package/dist/draft12.d.ts +16 -14
  118. package/dist/draft12.js +16 -13
  119. package/dist/draft13-session.cjs +2 -2
  120. package/dist/draft13-session.d.cts +6 -6
  121. package/dist/draft13-session.d.ts +6 -6
  122. package/dist/draft13-session.js +1 -1
  123. package/dist/draft13.cjs +8 -5
  124. package/dist/draft13.d.cts +16 -14
  125. package/dist/draft13.d.ts +16 -14
  126. package/dist/draft13.js +16 -13
  127. package/dist/draft14-session.cjs +2 -2
  128. package/dist/draft14-session.d.cts +6 -6
  129. package/dist/draft14-session.d.ts +6 -6
  130. package/dist/draft14-session.js +1 -1
  131. package/dist/draft14.cjs +14 -5
  132. package/dist/draft14.d.cts +14 -12
  133. package/dist/draft14.d.ts +14 -12
  134. package/dist/draft14.js +13 -4
  135. package/dist/draft15-session.cjs +2 -2
  136. package/dist/draft15-session.d.cts +6 -6
  137. package/dist/draft15-session.d.ts +6 -6
  138. package/dist/draft15-session.js +1 -1
  139. package/dist/draft15.cjs +8 -5
  140. package/dist/draft15.d.cts +14 -12
  141. package/dist/draft15.d.ts +14 -12
  142. package/dist/draft15.js +16 -13
  143. package/dist/draft16-session.cjs +2 -2
  144. package/dist/draft16-session.d.cts +6 -6
  145. package/dist/draft16-session.d.ts +6 -6
  146. package/dist/draft16-session.js +1 -1
  147. package/dist/draft16.cjs +8 -5
  148. package/dist/draft16.d.cts +14 -12
  149. package/dist/draft16.d.ts +14 -12
  150. package/dist/draft16.js +16 -13
  151. package/dist/draft17-session.cjs +2 -2
  152. package/dist/draft17-session.d.cts +7 -7
  153. package/dist/draft17-session.d.ts +7 -7
  154. package/dist/draft17-session.js +1 -1
  155. package/dist/draft17.cjs +8 -5
  156. package/dist/draft17.d.cts +11 -9
  157. package/dist/draft17.d.ts +11 -9
  158. package/dist/draft17.js +16 -13
  159. package/dist/index.cjs +52 -74
  160. package/dist/index.d.cts +41 -60
  161. package/dist/index.d.ts +41 -60
  162. package/dist/index.js +40 -62
  163. package/dist/{session-types-CJIFbTPd.d.ts → session-types-C7UONex5.d.cts} +28 -27
  164. package/dist/{session-types-Cbq8IGCP.d.cts → session-types-X-IYEGoG.d.ts} +28 -27
  165. package/dist/session.cjs +46 -13
  166. package/dist/session.d.cts +29 -11
  167. package/dist/session.d.ts +29 -11
  168. package/dist/session.js +46 -13
  169. package/dist/{types-DxSFvL2b.d.cts → types--Q7_DcvP.d.cts} +43 -39
  170. package/dist/{types-DxSFvL2b.d.ts → types--Q7_DcvP.d.ts} +43 -39
  171. package/dist/{types-B0FT5Qs2.d.cts → types-0IWbU9Z_.d.cts} +36 -36
  172. package/dist/{types-B0FT5Qs2.d.ts → types-0IWbU9Z_.d.ts} +36 -36
  173. package/dist/{types-gQsr0AAA.d.cts → types-B3g5G9KP.d.cts} +36 -36
  174. package/dist/{types-gQsr0AAA.d.ts → types-B3g5G9KP.d.ts} +36 -36
  175. package/dist/{types-Pme7sua0.d.cts → types-BFpFNM_m.d.cts} +57 -32
  176. package/dist/{types-Pme7sua0.d.ts → types-BFpFNM_m.d.ts} +57 -32
  177. package/dist/{types-8gUGeMgs.d.cts → types-Br7fm2mf.d.cts} +48 -26
  178. package/dist/{types-8gUGeMgs.d.ts → types-Br7fm2mf.d.ts} +48 -26
  179. package/dist/{types-BeAVNU-F.d.cts → types-C2qKTRR_.d.cts} +50 -45
  180. package/dist/{types-BeAVNU-F.d.ts → types-C2qKTRR_.d.ts} +50 -45
  181. package/dist/{types-DKpsfD3i.d.cts → types-DEaypVsD.d.cts} +115 -55
  182. package/dist/{types-DKpsfD3i.d.ts → types-DEaypVsD.d.ts} +115 -55
  183. package/dist/types-Dl4IaAHR.d.cts +282 -0
  184. package/dist/types-Dl4IaAHR.d.ts +282 -0
  185. package/dist/{types-CDa7F5ct.d.cts → types-DrQpTW1G.d.cts} +58 -50
  186. package/dist/{types-CDa7F5ct.d.ts → types-DrQpTW1G.d.ts} +58 -50
  187. package/dist/types-DuIO7cWK.d.cts +25 -0
  188. package/dist/types-DuIO7cWK.d.ts +25 -0
  189. package/dist/{types-B9A2g05r.d.cts → types-DuxfOYiO.d.cts} +47 -31
  190. package/dist/{types-B9A2g05r.d.ts → types-DuxfOYiO.d.ts} +47 -31
  191. package/dist/{types-D1dI_oTX.d.cts → types-jV1yDDBA.d.cts} +36 -36
  192. package/dist/{types-D1dI_oTX.d.ts → types-jV1yDDBA.d.ts} +36 -36
  193. package/package.json +192 -192
  194. package/src/core/buffer-reader.ts +130 -130
  195. package/src/core/buffer-writer.ts +100 -100
  196. package/src/core/errors.ts +1 -1
  197. package/src/core/hex.ts +21 -21
  198. package/src/core/session-types.ts +61 -59
  199. package/src/core/types.ts +18 -361
  200. package/src/drafts/draft07/codec.ts +1058 -938
  201. package/src/drafts/draft07/data-streams.ts +240 -240
  202. package/src/drafts/draft07/index.ts +124 -89
  203. package/src/drafts/draft07/messages.ts +76 -42
  204. package/src/drafts/draft07/rules.ts +107 -101
  205. package/src/drafts/draft07/session-fsm.ts +315 -287
  206. package/src/drafts/draft07/session.ts +8 -6
  207. package/src/drafts/draft07/types.ts +406 -72
  208. package/src/drafts/draft07/varint.ts +51 -51
  209. package/src/drafts/draft08/codec.ts +985 -953
  210. package/src/drafts/draft08/data-streams.ts +363 -359
  211. package/src/drafts/draft08/index.ts +10 -9
  212. package/src/drafts/draft08/messages.ts +59 -59
  213. package/src/drafts/draft08/rules.ts +73 -73
  214. package/src/drafts/draft08/session-fsm.ts +335 -303
  215. package/src/drafts/draft08/session.ts +6 -7
  216. package/src/drafts/draft08/types.ts +380 -384
  217. package/src/drafts/draft09/codec.ts +977 -945
  218. package/src/drafts/draft09/data-streams.ts +336 -332
  219. package/src/drafts/draft09/index.ts +10 -9
  220. package/src/drafts/draft09/messages.ts +59 -59
  221. package/src/drafts/draft09/rules.ts +73 -73
  222. package/src/drafts/draft09/session-fsm.ts +335 -303
  223. package/src/drafts/draft09/session.ts +6 -7
  224. package/src/drafts/draft09/types.ts +380 -384
  225. package/src/drafts/draft10/codec.ts +977 -945
  226. package/src/drafts/draft10/data-streams.ts +336 -332
  227. package/src/drafts/draft10/index.ts +10 -9
  228. package/src/drafts/draft10/messages.ts +59 -59
  229. package/src/drafts/draft10/rules.ts +73 -73
  230. package/src/drafts/draft10/session-fsm.ts +335 -303
  231. package/src/drafts/draft10/session.ts +6 -7
  232. package/src/drafts/draft10/types.ts +380 -384
  233. package/src/drafts/draft11/codec.ts +1054 -988
  234. package/src/drafts/draft11/data-streams.ts +316 -269
  235. package/src/drafts/draft11/index.ts +10 -9
  236. package/src/drafts/draft11/messages.ts +60 -59
  237. package/src/drafts/draft11/rules.ts +73 -73
  238. package/src/drafts/draft11/session-fsm.ts +359 -333
  239. package/src/drafts/draft11/session.ts +6 -7
  240. package/src/drafts/draft11/types.ts +385 -381
  241. package/src/drafts/draft12/codec.ts +1178 -1122
  242. package/src/drafts/draft12/data-streams.ts +324 -275
  243. package/src/drafts/draft12/index.ts +10 -9
  244. package/src/drafts/draft12/messages.ts +67 -66
  245. package/src/drafts/draft12/rules.ts +79 -79
  246. package/src/drafts/draft12/session-fsm.ts +384 -358
  247. package/src/drafts/draft12/session.ts +6 -7
  248. package/src/drafts/draft12/types.ts +424 -419
  249. package/src/drafts/draft13/codec.ts +1296 -1206
  250. package/src/drafts/draft13/data-streams.ts +326 -275
  251. package/src/drafts/draft13/index.ts +10 -9
  252. package/src/drafts/draft13/messages.ts +73 -68
  253. package/src/drafts/draft13/rules.ts +81 -81
  254. package/src/drafts/draft13/session-fsm.ts +392 -366
  255. package/src/drafts/draft13/session.ts +6 -7
  256. package/src/drafts/draft13/types.ts +447 -438
  257. package/src/drafts/draft14/codec.ts +1347 -1043
  258. package/src/drafts/draft14/data-streams.ts +831 -813
  259. package/src/drafts/draft14/index.ts +17 -9
  260. package/src/drafts/draft14/messages.ts +65 -65
  261. package/src/drafts/draft14/rules.ts +81 -81
  262. package/src/drafts/draft14/session-fsm.ts +415 -405
  263. package/src/drafts/draft14/session.ts +6 -7
  264. package/src/drafts/draft14/types.ts +451 -381
  265. package/src/drafts/draft15/codec.ts +1138 -978
  266. package/src/drafts/draft15/data-streams.ts +842 -794
  267. package/src/drafts/draft15/index.ts +10 -9
  268. package/src/drafts/draft15/messages.ts +54 -53
  269. package/src/drafts/draft15/rules.ts +67 -67
  270. package/src/drafts/draft15/session-fsm.ts +319 -299
  271. package/src/drafts/draft15/session.ts +6 -7
  272. package/src/drafts/draft15/types.ts +357 -339
  273. package/src/drafts/draft16/codec.ts +1242 -966
  274. package/src/drafts/draft16/data-streams.ts +835 -789
  275. package/src/drafts/draft16/index.ts +10 -9
  276. package/src/drafts/draft16/messages.ts +56 -55
  277. package/src/drafts/draft16/rules.ts +69 -69
  278. package/src/drafts/draft16/session-fsm.ts +319 -299
  279. package/src/drafts/draft16/session.ts +6 -7
  280. package/src/drafts/draft16/types.ts +386 -357
  281. package/src/drafts/draft17/codec.ts +1209 -971
  282. package/src/drafts/draft17/data-streams.ts +969 -758
  283. package/src/drafts/draft17/index.ts +9 -7
  284. package/src/drafts/draft17/messages.ts +43 -42
  285. package/src/drafts/draft17/rules.ts +58 -58
  286. package/src/drafts/draft17/session-fsm.ts +248 -216
  287. package/src/drafts/draft17/session.ts +5 -5
  288. package/src/drafts/draft17/types.ts +337 -313
  289. package/src/index.ts +85 -274
  290. package/src/session.ts +63 -25
  291. package/dist/chunk-FZDIEHQL.cjs +0 -1042
  292. package/dist/chunk-HDWJ2GDE.js +0 -24
  293. package/dist/chunk-KNDYS3DK.cjs +0 -24
  294. package/dist/chunk-N2KBF5Q2.js +0 -1042
  295. package/dist/draft7-session.d.cts +0 -7
  296. package/dist/draft7-session.d.ts +0 -7
  297. package/dist/draft7.cjs +0 -72
  298. package/dist/draft7.d.cts +0 -148
  299. package/dist/draft7.d.ts +0 -148
  300. package/dist/draft7.js +0 -72
  301. package/dist/draft8-session.cjs +0 -6
  302. package/dist/draft8-session.d.cts +0 -8
  303. package/dist/draft8-session.d.ts +0 -8
  304. package/dist/draft8.cjs +0 -116
  305. package/dist/draft9-session.cjs +0 -6
  306. package/dist/draft9-session.d.cts +0 -8
  307. package/dist/draft9-session.d.ts +0 -8
  308. package/dist/draft9.cjs +0 -116
  309. package/dist/types-QNXoxC9Y.d.cts +0 -236
  310. package/dist/types-QNXoxC9Y.d.ts +0 -236
  311. package/src/drafts/draft07/announce-fsm.ts +0 -2
  312. package/src/drafts/draft07/parameters.ts +0 -12
  313. package/src/drafts/draft07/subscription-fsm.ts +0 -3
@@ -1,12 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
3
 
4
- var _chunkKNDYS3DKcjs = require('./chunk-KNDYS3DK.cjs');
5
4
 
6
5
 
7
6
 
8
-
9
- var _chunkRUPCJTC3cjs = require('./chunk-RUPCJTC3.cjs');
7
+ var _chunkJL3NEW3Ocjs = require('./chunk-JL3NEW3O.cjs');
10
8
 
11
9
  // src/drafts/draft17/messages.ts
12
10
  var MSG_REQUEST_UPDATE = 0x02n;
@@ -28,6 +26,7 @@ var MSG_PUBLISH = 0x1dn;
28
26
  var MSG_PUBLISH_OK = 0x1en;
29
27
  var MSG_SETUP = 0x2f00n;
30
28
  var SETUP_OPT_PATH = 0x01n;
29
+ var SETUP_OPT_AUTHORIZATION_TOKEN = 0x03n;
31
30
  var SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE = 0x04n;
32
31
  var SETUP_OPT_AUTHORITY = 0x05n;
33
32
  var SETUP_OPT_MOQT_IMPLEMENTATION = 0x07n;
@@ -57,11 +56,56 @@ var MESSAGE_ID_MAP = new Map(
57
56
 
58
57
  // src/drafts/draft17/data-streams.ts
59
58
  var FETCH_STREAM_TYPE = 0x05n;
59
+ var OBJPROP_PRIOR_GROUP_ID_GAP = 0x3cn;
60
+ var OBJPROP_PRIOR_OBJECT_ID_GAP = 0x3en;
61
+ var KNOWN_OBJ_PROPS = /* @__PURE__ */ new Map([
62
+ [OBJPROP_PRIOR_OBJECT_ID_GAP, "prior_object_id_gap"],
63
+ [OBJPROP_PRIOR_GROUP_ID_GAP, "prior_group_id_gap"]
64
+ ]);
65
+ function decodeObjectProperties(r, propsLength) {
66
+ const endOff = r.offset + propsLength;
67
+ const props = {};
68
+ let prevType = 0n;
69
+ while (r.offset < endOff) {
70
+ const delta = r.readVarInt();
71
+ const propType = prevType + delta;
72
+ prevType = propType;
73
+ if (propType % 2n === 0n) {
74
+ const value = r.readVarInt();
75
+ const name = _nullishCoalesce(KNOWN_OBJ_PROPS.get(propType), () => ( `0x${propType.toString(16)}`));
76
+ props[name] = value;
77
+ } else {
78
+ const length = Number(r.readVarInt());
79
+ r.readBytes(length);
80
+ }
81
+ }
82
+ return props;
83
+ }
84
+ function encodeObjectProperties(props, w) {
85
+ const reverseMap = /* @__PURE__ */ new Map();
86
+ for (const [id, name] of KNOWN_OBJ_PROPS) {
87
+ reverseMap.set(name, id);
88
+ }
89
+ const entries = [];
90
+ for (const [name, value] of Object.entries(props)) {
91
+ const typeId = reverseMap.get(name);
92
+ if (typeId !== void 0) {
93
+ entries.push({ type: typeId, value });
94
+ }
95
+ }
96
+ entries.sort((a, b) => a.type < b.type ? -1 : a.type > b.type ? 1 : 0);
97
+ let prevType = 0n;
98
+ for (const entry of entries) {
99
+ w.writeVarInt(entry.type - prevType);
100
+ w.writeVarInt(entry.value);
101
+ prevType = entry.type;
102
+ }
103
+ }
60
104
  function encodeSubgroupStream(stream) {
61
- const w = new (0, _chunkRUPCJTC3cjs.BufferWriter)();
105
+ const w = new (0, _chunkJL3NEW3Ocjs.BufferWriter)();
62
106
  const streamType = stream.headerType;
63
107
  w.writeVarInt(BigInt(streamType));
64
- const extensionsPresent = (streamType & 1) !== 0;
108
+ const propertiesPresent = (streamType & 1) !== 0;
65
109
  const hasSubgroupField = (streamType & 4) !== 0;
66
110
  const hasPriority = streamType < 48;
67
111
  w.writeVarInt(stream.trackAlias);
@@ -76,9 +120,16 @@ function encodeSubgroupStream(stream) {
76
120
  for (const obj of stream.objects) {
77
121
  const delta = prevObjectId < 0n ? obj.objectId : obj.objectId - prevObjectId - 1n;
78
122
  w.writeVarInt(delta);
79
- if (extensionsPresent) {
80
- w.writeVarInt(BigInt(obj.extensionData.length));
81
- if (obj.extensionData.length > 0) w.writeBytes(obj.extensionData);
123
+ if (propertiesPresent) {
124
+ if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
125
+ const tmpW = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(32);
126
+ encodeObjectProperties(obj.objectProperties, tmpW);
127
+ const raw = tmpW.finish();
128
+ w.writeVarInt(BigInt(raw.byteLength));
129
+ w.writeBytes(raw);
130
+ } else {
131
+ w.writeVarInt(0n);
132
+ }
82
133
  }
83
134
  w.writeVarInt(BigInt(obj.payloadLength));
84
135
  if (obj.payloadLength === 0) {
@@ -91,7 +142,7 @@ function encodeSubgroupStream(stream) {
91
142
  return w.finish();
92
143
  }
93
144
  function encodeDatagram(dg) {
94
- const w = new (0, _chunkRUPCJTC3cjs.BufferWriter)();
145
+ const w = new (0, _chunkJL3NEW3Ocjs.BufferWriter)();
95
146
  const dgType = dg.datagramType;
96
147
  w.writeVarInt(BigInt(dgType));
97
148
  w.writeVarInt(dg.trackAlias);
@@ -99,12 +150,24 @@ function encodeDatagram(dg) {
99
150
  const objectIdAbsent = (dgType & 4) !== 0;
100
151
  const isStatus = (dgType & 32) !== 0;
101
152
  const defaultPriority = (dgType & 8) !== 0;
153
+ const propertiesPresent = (dgType & 1) !== 0;
102
154
  if (!objectIdAbsent) {
103
155
  w.writeVarInt(dg.objectId);
104
156
  }
105
157
  if (!defaultPriority) {
106
158
  w.writeUint8(dg.publisherPriority);
107
159
  }
160
+ if (propertiesPresent) {
161
+ if (dg.objectProperties && Object.keys(dg.objectProperties).length > 0) {
162
+ const tmpW = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(32);
163
+ encodeObjectProperties(dg.objectProperties, tmpW);
164
+ const raw = tmpW.finish();
165
+ w.writeVarInt(BigInt(raw.byteLength));
166
+ w.writeBytes(raw);
167
+ } else {
168
+ w.writeVarInt(0n);
169
+ }
170
+ }
108
171
  if (isStatus) {
109
172
  w.writeVarInt(_nullishCoalesce(dg.objectStatus, () => ( 0n)));
110
173
  } else {
@@ -113,7 +176,7 @@ function encodeDatagram(dg) {
113
176
  return w.finish();
114
177
  }
115
178
  function encodeFetchStream(stream) {
116
- const w = new (0, _chunkRUPCJTC3cjs.BufferWriter)();
179
+ const w = new (0, _chunkJL3NEW3Ocjs.BufferWriter)();
117
180
  w.writeVarInt(FETCH_STREAM_TYPE);
118
181
  w.writeVarInt(stream.requestId);
119
182
  for (const obj of stream.objects) {
@@ -123,6 +186,25 @@ function encodeFetchStream(stream) {
123
186
  w.writeVarInt(obj.groupId);
124
187
  w.writeVarInt(obj.objectId);
125
188
  w.writeVarInt(BigInt(obj.payloadLength));
189
+ } else if (flags & 64) {
190
+ if (flags & 8) w.writeVarInt(obj.groupId);
191
+ if (flags & 4) w.writeVarInt(obj.objectId);
192
+ if (flags & 16) w.writeUint8(obj.publisherPriority);
193
+ if (flags & 32) {
194
+ if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
195
+ const tmpW = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(32);
196
+ encodeObjectProperties(obj.objectProperties, tmpW);
197
+ const raw = tmpW.finish();
198
+ w.writeVarInt(BigInt(raw.byteLength));
199
+ w.writeBytes(raw);
200
+ } else {
201
+ w.writeVarInt(0n);
202
+ }
203
+ }
204
+ w.writeVarInt(BigInt(obj.payloadLength));
205
+ if (obj.payloadLength > 0) {
206
+ w.writeBytes(obj.payload);
207
+ }
126
208
  } else {
127
209
  if (flags & 8) w.writeVarInt(obj.groupId);
128
210
  const subgroupEncoding = flags & 3;
@@ -130,8 +212,15 @@ function encodeFetchStream(stream) {
130
212
  if (flags & 4) w.writeVarInt(obj.objectId);
131
213
  if (flags & 16) w.writeUint8(obj.publisherPriority);
132
214
  if (flags & 32) {
133
- w.writeVarInt(BigInt(obj.extensionData.length));
134
- if (obj.extensionData.length > 0) w.writeBytes(obj.extensionData);
215
+ if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
216
+ const tmpW = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(32);
217
+ encodeObjectProperties(obj.objectProperties, tmpW);
218
+ const raw = tmpW.finish();
219
+ w.writeVarInt(BigInt(raw.byteLength));
220
+ w.writeBytes(raw);
221
+ } else {
222
+ w.writeVarInt(0n);
223
+ }
135
224
  }
136
225
  w.writeVarInt(BigInt(obj.payloadLength));
137
226
  if (obj.payloadLength > 0) {
@@ -143,22 +232,23 @@ function encodeFetchStream(stream) {
143
232
  }
144
233
  function decodeSubgroupStream(bytes) {
145
234
  try {
146
- const r = new (0, _chunkRUPCJTC3cjs.BufferReader)(bytes);
235
+ const r = new (0, _chunkJL3NEW3Ocjs.BufferReader)(bytes);
147
236
  const streamType = Number(r.readVarInt());
148
237
  if (!(streamType >= 16 && streamType <= 29 || streamType >= 48 && streamType <= 61) || (streamType & 6) === 6) {
149
238
  return {
150
239
  ok: false,
151
- error: new (0, _chunkRUPCJTC3cjs.DecodeError)(
240
+ error: new (0, _chunkJL3NEW3Ocjs.DecodeError)(
152
241
  "CONSTRAINT_VIOLATION",
153
242
  `Expected subgroup stream type 0x10-0x15/0x18-0x1D/0x30-0x35/0x38-0x3D, got 0x${streamType.toString(16)}`,
154
243
  0
155
244
  )
156
245
  };
157
246
  }
158
- const extensionsPresent = (streamType & 1) !== 0;
247
+ const propertiesPresent = (streamType & 1) !== 0;
159
248
  const hasSubgroupField = (streamType & 4) !== 0;
160
249
  const subgroupIsFirstObjId = (streamType & 2) !== 0 && !hasSubgroupField;
161
250
  const hasPriority = streamType < 48;
251
+ const endOfGroup = (streamType & 8) !== 0;
162
252
  const trackAlias = r.readVarInt();
163
253
  const groupId = r.readVarInt();
164
254
  let subgroupId = 0n;
@@ -185,10 +275,13 @@ function decodeSubgroupStream(bytes) {
185
275
  } else {
186
276
  objectId = prevObjectId + 1n + delta;
187
277
  }
188
- let extensionData = new Uint8Array(0);
189
- if (extensionsPresent) {
190
- const extLen = Number(r.readVarInt());
191
- extensionData = extLen > 0 ? r.readBytesView(extLen) : new Uint8Array(0);
278
+ const extensionData = new Uint8Array(0);
279
+ let objectProperties;
280
+ if (propertiesPresent) {
281
+ const propsLen = Number(r.readVarInt());
282
+ if (propsLen > 0) {
283
+ objectProperties = decodeObjectProperties(r, propsLen);
284
+ }
192
285
  }
193
286
  const payloadLength = Number(r.readVarInt());
194
287
  let payload;
@@ -202,37 +295,50 @@ function decodeSubgroupStream(bytes) {
202
295
  payloadByteOffset = r.offset;
203
296
  payload = r.readBytesView(payloadLength);
204
297
  }
205
- const obj = { type: "object", byteOffset, payloadByteOffset, objectId, payloadLength, payload, extensionData };
298
+ const obj = {
299
+ type: "object",
300
+ byteOffset,
301
+ payloadByteOffset,
302
+ objectId,
303
+ payloadLength,
304
+ payload,
305
+ extensionData
306
+ };
206
307
  if (status !== void 0) obj.status = status;
308
+ if (objectProperties !== void 0)
309
+ obj.objectProperties = objectProperties;
207
310
  objects.push(obj);
208
311
  prevObjectId = objectId;
209
312
  }
313
+ const result = {
314
+ type: "subgroup",
315
+ headerType: streamType,
316
+ trackAlias,
317
+ groupId,
318
+ subgroupId,
319
+ publisherPriority,
320
+ objects
321
+ };
322
+ if (endOfGroup) result.endOfGroup = true;
210
323
  return {
211
324
  ok: true,
212
- value: {
213
- type: "subgroup",
214
- headerType: streamType,
215
- trackAlias,
216
- groupId,
217
- subgroupId,
218
- publisherPriority,
219
- objects
220
- },
325
+ value: result,
221
326
  bytesRead: r.offset
222
327
  };
223
328
  } catch (e) {
224
- if (e instanceof _chunkRUPCJTC3cjs.DecodeError) return { ok: false, error: e };
329
+ if (e instanceof _chunkJL3NEW3Ocjs.DecodeError) return { ok: false, error: e };
225
330
  throw e;
226
331
  }
227
332
  }
228
333
  function decodeDatagram(bytes) {
229
334
  try {
230
- const r = new (0, _chunkRUPCJTC3cjs.BufferReader)(bytes);
335
+ const r = new (0, _chunkJL3NEW3Ocjs.BufferReader)(bytes);
231
336
  const dgType = Number(r.readVarInt());
232
337
  const objectIdAbsent = (dgType & 4) !== 0;
233
338
  const endOfGroup = (dgType & 2) !== 0;
234
339
  const isStatus = (dgType & 32) !== 0;
235
340
  const defaultPriority = (dgType & 8) !== 0;
341
+ const propertiesPresent = (dgType & 1) !== 0;
236
342
  const trackAlias = r.readVarInt();
237
343
  const groupId = r.readVarInt();
238
344
  let objectId = 0n;
@@ -243,6 +349,13 @@ function decodeDatagram(bytes) {
243
349
  if (!defaultPriority) {
244
350
  publisherPriority = r.readUint8();
245
351
  }
352
+ let objectProperties;
353
+ if (propertiesPresent) {
354
+ const propsLen = Number(r.readVarInt());
355
+ if (propsLen > 0) {
356
+ objectProperties = decodeObjectProperties(r, propsLen);
357
+ }
358
+ }
246
359
  let objectStatus;
247
360
  let payload;
248
361
  if (isStatus) {
@@ -265,20 +378,22 @@ function decodeDatagram(bytes) {
265
378
  if (endOfGroup) result.endOfGroup = true;
266
379
  if (objectStatus !== void 0)
267
380
  result.objectStatus = objectStatus;
381
+ if (objectProperties !== void 0)
382
+ result.objectProperties = objectProperties;
268
383
  return { ok: true, value: result, bytesRead: r.offset };
269
384
  } catch (e) {
270
- if (e instanceof _chunkRUPCJTC3cjs.DecodeError) return { ok: false, error: e };
385
+ if (e instanceof _chunkJL3NEW3Ocjs.DecodeError) return { ok: false, error: e };
271
386
  throw e;
272
387
  }
273
388
  }
274
389
  function decodeFetchStream(bytes) {
275
390
  try {
276
- const r = new (0, _chunkRUPCJTC3cjs.BufferReader)(bytes);
391
+ const r = new (0, _chunkJL3NEW3Ocjs.BufferReader)(bytes);
277
392
  const streamType = r.readVarInt();
278
393
  if (streamType !== FETCH_STREAM_TYPE) {
279
394
  return {
280
395
  ok: false,
281
- error: new (0, _chunkRUPCJTC3cjs.DecodeError)(
396
+ error: new (0, _chunkJL3NEW3Ocjs.DecodeError)(
282
397
  "CONSTRAINT_VIOLATION",
283
398
  `Expected fetch stream type 0x05, got 0x${streamType.toString(16)}`,
284
399
  0
@@ -301,12 +416,12 @@ function decodeFetchStream(bytes) {
301
416
  let payloadLength;
302
417
  let payload;
303
418
  let payloadByteOffset;
304
- let extensionData = new Uint8Array(0);
419
+ const extensionData = new Uint8Array(0);
305
420
  if (flags >= 128) {
306
421
  if (flags !== 140 && flags !== 268) {
307
422
  return {
308
423
  ok: false,
309
- error: new (0, _chunkRUPCJTC3cjs.DecodeError)(
424
+ error: new (0, _chunkJL3NEW3Ocjs.DecodeError)(
310
425
  "CONSTRAINT_VIOLATION",
311
426
  `Unknown serialization flags value: 0x${flags.toString(16)}`,
312
427
  r.offset
@@ -318,28 +433,62 @@ function decodeFetchStream(bytes) {
318
433
  payloadLength = Number(r.readVarInt());
319
434
  payloadByteOffset = r.offset;
320
435
  payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
436
+ } else if (flags & 64) {
437
+ const objectIdPresent = (flags & 4) !== 0;
438
+ const groupIdPresent = (flags & 8) !== 0;
439
+ const priorityPresent = (flags & 16) !== 0;
440
+ const propsPresent = (flags & 32) !== 0;
441
+ if (groupIdPresent) {
442
+ groupId = r.readVarInt();
443
+ }
444
+ if (objectIdPresent) {
445
+ objectId = r.readVarInt();
446
+ }
447
+ if (priorityPresent) {
448
+ prevPriority = r.readUint8();
449
+ }
450
+ let objectProperties;
451
+ if (propsPresent) {
452
+ const propsLen = Number(r.readVarInt());
453
+ if (propsLen > 0) {
454
+ objectProperties = decodeObjectProperties(r, propsLen);
455
+ }
456
+ }
457
+ payloadLength = Number(r.readVarInt());
458
+ payloadByteOffset = r.offset;
459
+ payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
460
+ const obj2 = {
461
+ type: "object",
462
+ byteOffset,
463
+ payloadByteOffset,
464
+ serializationFlags: flags,
465
+ groupId,
466
+ subgroupId: 0n,
467
+ objectId,
468
+ publisherPriority: prevPriority,
469
+ payloadLength,
470
+ payload,
471
+ extensionData
472
+ };
473
+ if (objectProperties)
474
+ obj2.objectProperties = objectProperties;
475
+ objects.push(obj2);
476
+ prevGroupId = groupId;
477
+ prevObjectId = objectId;
478
+ first = false;
479
+ continue;
321
480
  } else {
322
481
  const subgroupEncoding = flags & 3;
323
482
  const objectIdPresent = (flags & 4) !== 0;
324
483
  const groupIdPresent = (flags & 8) !== 0;
325
484
  const priorityPresent = (flags & 16) !== 0;
326
- const extensionsPresent = (flags & 32) !== 0;
327
- if (flags & 64) {
328
- return {
329
- ok: false,
330
- error: new (0, _chunkRUPCJTC3cjs.DecodeError)(
331
- "CONSTRAINT_VIOLATION",
332
- "Reserved bits set in fetch object flags",
333
- r.offset
334
- )
335
- };
336
- }
485
+ const propsPresent = (flags & 32) !== 0;
337
486
  if (groupIdPresent) {
338
487
  groupId = r.readVarInt();
339
488
  } else if (first) {
340
489
  return {
341
490
  ok: false,
342
- error: new (0, _chunkRUPCJTC3cjs.DecodeError)(
491
+ error: new (0, _chunkJL3NEW3Ocjs.DecodeError)(
343
492
  "CONSTRAINT_VIOLATION",
344
493
  "First fetch object must include groupId",
345
494
  r.offset
@@ -352,7 +501,7 @@ function decodeFetchStream(bytes) {
352
501
  if (first) {
353
502
  return {
354
503
  ok: false,
355
- error: new (0, _chunkRUPCJTC3cjs.DecodeError)(
504
+ error: new (0, _chunkJL3NEW3Ocjs.DecodeError)(
356
505
  "CONSTRAINT_VIOLATION",
357
506
  "First fetch object cannot reference prior subgroupId",
358
507
  r.offset
@@ -364,7 +513,7 @@ function decodeFetchStream(bytes) {
364
513
  if (first) {
365
514
  return {
366
515
  ok: false,
367
- error: new (0, _chunkRUPCJTC3cjs.DecodeError)(
516
+ error: new (0, _chunkJL3NEW3Ocjs.DecodeError)(
368
517
  "CONSTRAINT_VIOLATION",
369
518
  "First fetch object cannot reference prior subgroupId",
370
519
  r.offset
@@ -380,7 +529,7 @@ function decodeFetchStream(bytes) {
380
529
  } else if (first) {
381
530
  return {
382
531
  ok: false,
383
- error: new (0, _chunkRUPCJTC3cjs.DecodeError)(
532
+ error: new (0, _chunkJL3NEW3Ocjs.DecodeError)(
384
533
  "CONSTRAINT_VIOLATION",
385
534
  "First fetch object must include objectId",
386
535
  r.offset
@@ -390,15 +539,38 @@ function decodeFetchStream(bytes) {
390
539
  if (priorityPresent) {
391
540
  prevPriority = r.readUint8();
392
541
  }
393
- if (extensionsPresent) {
394
- const extLen = Number(r.readVarInt());
395
- if (extLen > 0) {
396
- extensionData = r.readBytesView(extLen);
542
+ let objectProperties;
543
+ if (propsPresent) {
544
+ const propsLen = Number(r.readVarInt());
545
+ if (propsLen > 0) {
546
+ objectProperties = decodeObjectProperties(r, propsLen);
397
547
  }
398
548
  }
399
549
  payloadLength = Number(r.readVarInt());
400
550
  payloadByteOffset = r.offset;
401
551
  payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
552
+ if (objectProperties) {
553
+ const obj2 = {
554
+ type: "object",
555
+ byteOffset,
556
+ payloadByteOffset,
557
+ serializationFlags: flags,
558
+ groupId,
559
+ subgroupId,
560
+ objectId,
561
+ publisherPriority: prevPriority,
562
+ payloadLength,
563
+ payload,
564
+ extensionData
565
+ };
566
+ obj2.objectProperties = objectProperties;
567
+ objects.push(obj2);
568
+ prevGroupId = groupId;
569
+ prevSubgroupId = subgroupId;
570
+ prevObjectId = objectId;
571
+ first = false;
572
+ continue;
573
+ }
402
574
  }
403
575
  const obj = {
404
576
  type: "object",
@@ -425,7 +597,7 @@ function decodeFetchStream(bytes) {
425
597
  bytesRead: r.offset
426
598
  };
427
599
  } catch (e) {
428
- if (e instanceof _chunkRUPCJTC3cjs.DecodeError) return { ok: false, error: e };
600
+ if (e instanceof _chunkJL3NEW3Ocjs.DecodeError) return { ok: false, error: e };
429
601
  throw e;
430
602
  }
431
603
  }
@@ -463,11 +635,11 @@ function createSubgroupStreamDecoder() {
463
635
  buffer = newBuffer;
464
636
  if (!headerEmitted) {
465
637
  try {
466
- const r = new (0, _chunkRUPCJTC3cjs.BufferReader)(buffer.subarray(offset));
638
+ const r = new (0, _chunkJL3NEW3Ocjs.BufferReader)(buffer.subarray(offset));
467
639
  const streamType = Number(r.readVarInt());
468
640
  if (!(streamType >= 16 && streamType <= 29 || streamType >= 48 && streamType <= 61)) {
469
641
  controller.error(
470
- new (0, _chunkRUPCJTC3cjs.DecodeError)(
642
+ new (0, _chunkJL3NEW3Ocjs.DecodeError)(
471
643
  "CONSTRAINT_VIOLATION",
472
644
  `Expected subgroup stream type, got 0x${streamType.toString(16)}`,
473
645
  0
@@ -499,7 +671,7 @@ function createSubgroupStreamDecoder() {
499
671
  headerEmitted = true;
500
672
  offset += r.offset;
501
673
  } catch (e) {
502
- if (e instanceof _chunkRUPCJTC3cjs.DecodeError && e.code === "UNEXPECTED_END") {
674
+ if (e instanceof _chunkJL3NEW3Ocjs.DecodeError && e.code === "UNEXPECTED_END") {
503
675
  return;
504
676
  }
505
677
  controller.error(e);
@@ -508,7 +680,7 @@ function createSubgroupStreamDecoder() {
508
680
  }
509
681
  while (offset < buffer.length) {
510
682
  try {
511
- const r = new (0, _chunkRUPCJTC3cjs.BufferReader)(buffer.subarray(offset));
683
+ const r = new (0, _chunkJL3NEW3Ocjs.BufferReader)(buffer.subarray(offset));
512
684
  const delta = r.readVarInt();
513
685
  let objectId;
514
686
  if (firstObject) {
@@ -525,11 +697,19 @@ function createSubgroupStreamDecoder() {
525
697
  const payloadLength = Number(r.readVarInt());
526
698
  const payloadByteOffset = r.offset;
527
699
  const payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
528
- controller.enqueue({ type: "object", objectId, payloadLength, payload, extensionData, byteOffset: 0, payloadByteOffset });
700
+ controller.enqueue({
701
+ type: "object",
702
+ objectId,
703
+ payloadLength,
704
+ payload,
705
+ extensionData,
706
+ byteOffset: 0,
707
+ payloadByteOffset
708
+ });
529
709
  offset += r.offset;
530
710
  prevObjectId = objectId;
531
711
  } catch (e) {
532
- if (e instanceof _chunkRUPCJTC3cjs.DecodeError && e.code === "UNEXPECTED_END") {
712
+ if (e instanceof _chunkJL3NEW3Ocjs.DecodeError && e.code === "UNEXPECTED_END") {
533
713
  break;
534
714
  }
535
715
  controller.error(e);
@@ -539,7 +719,7 @@ function createSubgroupStreamDecoder() {
539
719
  },
540
720
  flush(controller) {
541
721
  if (offset < buffer.length) {
542
- controller.error(new (0, _chunkRUPCJTC3cjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
722
+ controller.error(new (0, _chunkJL3NEW3Ocjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
543
723
  }
544
724
  }
545
725
  });
@@ -560,11 +740,11 @@ function createFetchStreamDecoder() {
560
740
  buffer = newBuffer;
561
741
  if (!headerEmitted) {
562
742
  try {
563
- const r = new (0, _chunkRUPCJTC3cjs.BufferReader)(buffer.subarray(offset));
743
+ const r = new (0, _chunkJL3NEW3Ocjs.BufferReader)(buffer.subarray(offset));
564
744
  const streamType = r.readVarInt();
565
745
  if (streamType !== FETCH_STREAM_TYPE) {
566
746
  controller.error(
567
- new (0, _chunkRUPCJTC3cjs.DecodeError)(
747
+ new (0, _chunkJL3NEW3Ocjs.DecodeError)(
568
748
  "CONSTRAINT_VIOLATION",
569
749
  `Expected fetch stream type 0x05, got 0x${streamType.toString(16)}`,
570
750
  0
@@ -577,7 +757,7 @@ function createFetchStreamDecoder() {
577
757
  headerEmitted = true;
578
758
  offset += r.offset;
579
759
  } catch (e) {
580
- if (e instanceof _chunkRUPCJTC3cjs.DecodeError && e.code === "UNEXPECTED_END") {
760
+ if (e instanceof _chunkJL3NEW3Ocjs.DecodeError && e.code === "UNEXPECTED_END") {
581
761
  return;
582
762
  }
583
763
  controller.error(e);
@@ -586,7 +766,7 @@ function createFetchStreamDecoder() {
586
766
  }
587
767
  while (offset < buffer.length) {
588
768
  try {
589
- const r = new (0, _chunkRUPCJTC3cjs.BufferReader)(buffer.subarray(offset));
769
+ const r = new (0, _chunkJL3NEW3Ocjs.BufferReader)(buffer.subarray(offset));
590
770
  const flags = Number(r.readVarInt());
591
771
  const objectIdPresent = (flags & 4) !== 0;
592
772
  const groupIdPresent = (flags & 8) !== 0;
@@ -606,10 +786,18 @@ function createFetchStreamDecoder() {
606
786
  const payloadLength = Number(r.readVarInt());
607
787
  const payloadByteOffset = r.offset;
608
788
  const payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
609
- controller.enqueue({ type: "object", objectId, payloadLength, payload, extensionData, byteOffset: 0, payloadByteOffset });
789
+ controller.enqueue({
790
+ type: "object",
791
+ objectId,
792
+ payloadLength,
793
+ payload,
794
+ extensionData,
795
+ byteOffset: 0,
796
+ payloadByteOffset
797
+ });
610
798
  offset += r.offset;
611
799
  } catch (e) {
612
- if (e instanceof _chunkRUPCJTC3cjs.DecodeError && e.code === "UNEXPECTED_END") {
800
+ if (e instanceof _chunkJL3NEW3Ocjs.DecodeError && e.code === "UNEXPECTED_END") {
613
801
  break;
614
802
  }
615
803
  controller.error(e);
@@ -619,7 +807,7 @@ function createFetchStreamDecoder() {
619
807
  },
620
808
  flush(controller) {
621
809
  if (offset < buffer.length) {
622
- controller.error(new (0, _chunkRUPCJTC3cjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
810
+ controller.error(new (0, _chunkJL3NEW3Ocjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
623
811
  }
624
812
  }
625
813
  });
@@ -649,7 +837,7 @@ function createDataStreamDecoder() {
649
837
  inner = decoder;
650
838
  } else {
651
839
  controller.error(
652
- new (0, _chunkRUPCJTC3cjs.DecodeError)(
840
+ new (0, _chunkJL3NEW3Ocjs.DecodeError)(
653
841
  "CONSTRAINT_VIOLATION",
654
842
  `Unknown data stream type: 0x${firstByte.toString(16)}`,
655
843
  0
@@ -670,7 +858,7 @@ function createDataStreamDecoder() {
670
858
  result = decodeFetchStream(view);
671
859
  } else {
672
860
  controller.error(
673
- new (0, _chunkRUPCJTC3cjs.DecodeError)(
861
+ new (0, _chunkJL3NEW3Ocjs.DecodeError)(
674
862
  "CONSTRAINT_VIOLATION",
675
863
  `Unknown data stream type: 0x${firstByte.toString(16)}`,
676
864
  0
@@ -722,6 +910,18 @@ function encodeSetupOptions(opts, writer) {
722
910
  }
723
911
  });
724
912
  }
913
+ if (opts.authorization_token !== void 0) {
914
+ entries.push({
915
+ type: SETUP_OPT_AUTHORIZATION_TOKEN,
916
+ encode: (w) => {
917
+ const tmpW = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(64);
918
+ encodeAuthorizationToken(opts.authorization_token, tmpW);
919
+ const raw = tmpW.finish();
920
+ w.writeVarInt(BigInt(raw.byteLength));
921
+ w.writeBytes(raw);
922
+ }
923
+ });
924
+ }
725
925
  if (opts.max_auth_token_cache_size !== void 0) {
726
926
  entries.push({
727
927
  type: SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE,
@@ -755,11 +955,11 @@ function encodeSetupOptions(opts, writer) {
755
955
  type: id,
756
956
  encode: (w) => {
757
957
  if (id % 2n === 0n) {
758
- const raw = _chunkKNDYS3DKcjs.hexToBytes.call(void 0, u.raw_hex);
759
- const tmpReader = new (0, _chunkRUPCJTC3cjs.BufferReader)(raw);
958
+ const raw = _chunkJL3NEW3Ocjs.hexToBytes.call(void 0, u.raw_hex);
959
+ const tmpReader = new (0, _chunkJL3NEW3Ocjs.BufferReader)(raw);
760
960
  w.writeVarInt(tmpReader.readVarInt());
761
961
  } else {
762
- const raw = _chunkKNDYS3DKcjs.hexToBytes.call(void 0, u.raw_hex);
962
+ const raw = _chunkJL3NEW3Ocjs.hexToBytes.call(void 0, u.raw_hex);
763
963
  w.writeVarInt(BigInt(raw.byteLength));
764
964
  w.writeBytes(raw);
765
965
  }
@@ -788,13 +988,13 @@ function decodeSetupOptions(reader, payloadEnd) {
788
988
  if (optType === SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE) {
789
989
  result.max_auth_token_cache_size = value;
790
990
  } else {
791
- const tmpWriter = new (0, _chunkRUPCJTC3cjs.BufferWriter)(16);
991
+ const tmpWriter = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(16);
792
992
  tmpWriter.writeVarInt(value);
793
993
  const raw = tmpWriter.finish();
794
994
  unknown.push({
795
995
  id: `0x${optType.toString(16)}`,
796
996
  length: raw.byteLength,
797
- raw_hex: _chunkKNDYS3DKcjs.bytesToHex.call(void 0, raw)
997
+ raw_hex: _chunkJL3NEW3Ocjs.bytesToHex.call(void 0, raw)
798
998
  });
799
999
  }
800
1000
  } else {
@@ -802,27 +1002,95 @@ function decodeSetupOptions(reader, payloadEnd) {
802
1002
  const bytes = reader.readBytes(length);
803
1003
  if (optType === SETUP_OPT_PATH) {
804
1004
  result.path = textDecoder.decode(bytes);
1005
+ } else if (optType === SETUP_OPT_AUTHORIZATION_TOKEN) {
1006
+ result.authorization_token = decodeAuthorizationToken(new (0, _chunkJL3NEW3Ocjs.BufferReader)(bytes));
805
1007
  } else if (optType === SETUP_OPT_AUTHORITY) {
806
1008
  result.authority = textDecoder.decode(bytes);
807
1009
  } else if (optType === SETUP_OPT_MOQT_IMPLEMENTATION) {
808
1010
  result.moqt_implementation = textDecoder.decode(bytes);
809
1011
  } else {
810
- unknown.push({ id: `0x${optType.toString(16)}`, length, raw_hex: _chunkKNDYS3DKcjs.bytesToHex.call(void 0, bytes) });
1012
+ unknown.push({
1013
+ id: `0x${optType.toString(16)}`,
1014
+ length,
1015
+ raw_hex: _chunkJL3NEW3Ocjs.bytesToHex.call(void 0, bytes)
1016
+ });
811
1017
  }
812
1018
  }
813
1019
  }
814
1020
  if (unknown.length > 0) result.unknown = unknown;
815
1021
  return result;
816
1022
  }
1023
+ function encodeAuthorizationToken(token, w) {
1024
+ const aliasType = Number(token.alias_type);
1025
+ w.writeVarInt(token.alias_type);
1026
+ if (aliasType === 0 || aliasType === 1 || aliasType === 2) {
1027
+ w.writeVarInt(_nullishCoalesce(token.token_alias, () => ( 0n)));
1028
+ }
1029
+ if (aliasType === 1 || aliasType === 3) {
1030
+ w.writeVarInt(_nullishCoalesce(token.token_type, () => ( 0n)));
1031
+ const encoded = textEncoder.encode(_nullishCoalesce(token.token_value, () => ( "")));
1032
+ w.writeVarInt(BigInt(encoded.byteLength));
1033
+ w.writeBytes(encoded);
1034
+ }
1035
+ }
1036
+ function decodeAuthorizationToken(r) {
1037
+ const alias_type = r.readVarInt();
1038
+ const aliasType = Number(alias_type);
1039
+ const result = { alias_type };
1040
+ if (aliasType === 0 || aliasType === 1 || aliasType === 2) {
1041
+ ;
1042
+ result.token_alias = r.readVarInt();
1043
+ }
1044
+ if (aliasType === 1 || aliasType === 3) {
1045
+ ;
1046
+ result.token_type = r.readVarInt();
1047
+ const len = Number(r.readVarInt());
1048
+ const bytes = r.readBytes(len);
1049
+ result.token_value = textDecoder.decode(bytes);
1050
+ }
1051
+ return result;
1052
+ }
1053
+ var PARAM_DELIVERY_TIMEOUT = 0x02n;
1054
+ var PARAM_AUTHORIZATION_TOKEN = 0x03n;
1055
+ var PARAM_RENDEZVOUS_TIMEOUT = 0x04n;
817
1056
  var PARAM_EXPIRES = 0x08n;
818
1057
  var PARAM_LARGEST_OBJECT = 0x09n;
1058
+ var PARAM_FORWARD = 0x10n;
819
1059
  var PARAM_SUBSCRIBER_PRIORITY = 0x20n;
820
1060
  var PARAM_SUBSCRIPTION_FILTER = 0x21n;
821
1061
  var PARAM_GROUP_ORDER = 0x22n;
1062
+ var PARAM_NEW_GROUP_REQUEST = 0x32n;
822
1063
  function encodeParams(params, writer) {
823
1064
  const entries = [];
1065
+ if (params.delivery_timeout !== void 0) {
1066
+ entries.push({
1067
+ type: PARAM_DELIVERY_TIMEOUT,
1068
+ encode: (w) => w.writeVarInt(params.delivery_timeout)
1069
+ });
1070
+ }
1071
+ if (params.authorization_token !== void 0) {
1072
+ entries.push({
1073
+ type: PARAM_AUTHORIZATION_TOKEN,
1074
+ encode: (w) => {
1075
+ const tmpW = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(64);
1076
+ encodeAuthorizationToken(params.authorization_token, tmpW);
1077
+ const raw = tmpW.finish();
1078
+ w.writeVarInt(BigInt(raw.byteLength));
1079
+ w.writeBytes(raw);
1080
+ }
1081
+ });
1082
+ }
1083
+ if (params.rendezvous_timeout !== void 0) {
1084
+ entries.push({
1085
+ type: PARAM_RENDEZVOUS_TIMEOUT,
1086
+ encode: (w) => w.writeVarInt(params.rendezvous_timeout)
1087
+ });
1088
+ }
824
1089
  if (params.expires !== void 0) {
825
- entries.push({ type: PARAM_EXPIRES, encode: (w) => w.writeVarInt(params.expires) });
1090
+ entries.push({
1091
+ type: PARAM_EXPIRES,
1092
+ encode: (w) => w.writeVarInt(params.expires)
1093
+ });
826
1094
  }
827
1095
  if (params.largest_object !== void 0) {
828
1096
  entries.push({
@@ -833,6 +1101,12 @@ function encodeParams(params, writer) {
833
1101
  }
834
1102
  });
835
1103
  }
1104
+ if (params.forward !== void 0) {
1105
+ entries.push({
1106
+ type: PARAM_FORWARD,
1107
+ encode: (w) => w.writeVarInt(params.forward)
1108
+ });
1109
+ }
836
1110
  if (params.subscriber_priority !== void 0) {
837
1111
  entries.push({
838
1112
  type: PARAM_SUBSCRIBER_PRIORITY,
@@ -844,7 +1118,7 @@ function encodeParams(params, writer) {
844
1118
  type: PARAM_SUBSCRIPTION_FILTER,
845
1119
  encode: (w) => {
846
1120
  const f = params.subscription_filter;
847
- const tmpW = new (0, _chunkRUPCJTC3cjs.BufferWriter)(32);
1121
+ const tmpW = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(32);
848
1122
  tmpW.writeVarInt(f.filter_type);
849
1123
  if (f.filter_type === 3n || f.filter_type === 4n) {
850
1124
  tmpW.writeVarInt(f.start_group);
@@ -865,13 +1139,19 @@ function encodeParams(params, writer) {
865
1139
  encode: (w) => w.writeUint8(Number(params.group_order))
866
1140
  });
867
1141
  }
1142
+ if (params.new_group_request !== void 0) {
1143
+ entries.push({
1144
+ type: PARAM_NEW_GROUP_REQUEST,
1145
+ encode: (w) => w.writeVarInt(params.new_group_request)
1146
+ });
1147
+ }
868
1148
  if (params.unknown) {
869
1149
  for (const u of params.unknown) {
870
1150
  const id = BigInt(u.id);
871
1151
  entries.push({
872
1152
  type: id,
873
1153
  encode: (w) => {
874
- const raw = _chunkKNDYS3DKcjs.hexToBytes.call(void 0, u.raw_hex);
1154
+ const raw = _chunkJL3NEW3Ocjs.hexToBytes.call(void 0, u.raw_hex);
875
1155
  w.writeBytes(raw);
876
1156
  }
877
1157
  });
@@ -895,7 +1175,15 @@ function decodeParams(reader) {
895
1175
  const delta = reader.readVarInt();
896
1176
  const paramType = prevType + delta;
897
1177
  prevType = paramType;
898
- if (paramType === PARAM_EXPIRES) {
1178
+ if (paramType === PARAM_DELIVERY_TIMEOUT) {
1179
+ result.delivery_timeout = reader.readVarInt();
1180
+ } else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
1181
+ const length = Number(reader.readVarInt());
1182
+ const bytes = reader.readBytes(length);
1183
+ result.authorization_token = decodeAuthorizationToken(new (0, _chunkJL3NEW3Ocjs.BufferReader)(bytes));
1184
+ } else if (paramType === PARAM_RENDEZVOUS_TIMEOUT) {
1185
+ result.rendezvous_timeout = reader.readVarInt();
1186
+ } else if (paramType === PARAM_EXPIRES) {
899
1187
  result.expires = reader.readVarInt();
900
1188
  } else if (paramType === PARAM_LARGEST_OBJECT) {
901
1189
  const group = reader.readVarInt();
@@ -918,45 +1206,109 @@ function decodeParams(reader) {
918
1206
  const consumed = reader.offset - startOff;
919
1207
  if (consumed < length) reader.readBytes(length - consumed);
920
1208
  result.subscription_filter = filter;
1209
+ } else if (paramType === PARAM_FORWARD) {
1210
+ result.forward = reader.readVarInt();
921
1211
  } else if (paramType === PARAM_GROUP_ORDER) {
922
1212
  result.group_order = BigInt(reader.readUint8());
1213
+ } else if (paramType === PARAM_NEW_GROUP_REQUEST) {
1214
+ result.new_group_request = reader.readVarInt();
923
1215
  } else {
924
1216
  if (paramType % 2n === 0n) {
925
1217
  const value = reader.readVarInt();
926
- const tmpWriter = new (0, _chunkRUPCJTC3cjs.BufferWriter)(16);
1218
+ const tmpWriter = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(16);
927
1219
  tmpWriter.writeVarInt(value);
928
1220
  const raw = tmpWriter.finish();
929
1221
  unknown.push({
930
1222
  id: `0x${paramType.toString(16)}`,
931
1223
  length: raw.byteLength,
932
- raw_hex: _chunkKNDYS3DKcjs.bytesToHex.call(void 0, raw)
1224
+ raw_hex: _chunkJL3NEW3Ocjs.bytesToHex.call(void 0, raw)
933
1225
  });
934
1226
  } else {
935
1227
  const length = Number(reader.readVarInt());
936
1228
  const bytes = reader.readBytes(length);
937
- unknown.push({ id: `0x${paramType.toString(16)}`, length, raw_hex: _chunkKNDYS3DKcjs.bytesToHex.call(void 0, bytes) });
1229
+ unknown.push({
1230
+ id: `0x${paramType.toString(16)}`,
1231
+ length,
1232
+ raw_hex: _chunkJL3NEW3Ocjs.bytesToHex.call(void 0, bytes)
1233
+ });
938
1234
  }
939
1235
  }
940
1236
  }
941
1237
  if (unknown.length > 0) result.unknown = unknown;
942
1238
  return result;
943
1239
  }
1240
+ var TPROP_DELIVERY_TIMEOUT = 0x02n;
1241
+ var TPROP_MAX_CACHE_DURATION = 0x04n;
1242
+ var TPROP_IMMUTABLE_PROPERTIES = 0x0bn;
1243
+ var TPROP_DEFAULT_PUBLISHER_PRIORITY = 0x0en;
1244
+ var TPROP_DEFAULT_PUBLISHER_GROUP_ORDER = 0x22n;
1245
+ var TPROP_DYNAMIC_GROUPS = 0x30n;
944
1246
  function encodeTrackProperties(props, writer) {
945
- if (!props.unknown || props.unknown.length === 0) return;
946
- const entries = props.unknown.map((u) => ({ type: BigInt(u.id), raw: u }));
1247
+ const entries = [];
1248
+ if (props.delivery_timeout !== void 0) {
1249
+ entries.push({
1250
+ type: TPROP_DELIVERY_TIMEOUT,
1251
+ encode: (w) => w.writeVarInt(props.delivery_timeout)
1252
+ });
1253
+ }
1254
+ if (props.max_cache_duration !== void 0) {
1255
+ entries.push({
1256
+ type: TPROP_MAX_CACHE_DURATION,
1257
+ encode: (w) => w.writeVarInt(props.max_cache_duration)
1258
+ });
1259
+ }
1260
+ if (props.immutable_properties !== void 0) {
1261
+ entries.push({
1262
+ type: TPROP_IMMUTABLE_PROPERTIES,
1263
+ encode: (w) => {
1264
+ const raw = _chunkJL3NEW3Ocjs.hexToBytes.call(void 0, props.immutable_properties);
1265
+ w.writeVarInt(BigInt(raw.byteLength));
1266
+ w.writeBytes(raw);
1267
+ }
1268
+ });
1269
+ }
1270
+ if (props.default_publisher_priority !== void 0) {
1271
+ entries.push({
1272
+ type: TPROP_DEFAULT_PUBLISHER_PRIORITY,
1273
+ encode: (w) => w.writeVarInt(props.default_publisher_priority)
1274
+ });
1275
+ }
1276
+ if (props.default_publisher_group_order !== void 0) {
1277
+ entries.push({
1278
+ type: TPROP_DEFAULT_PUBLISHER_GROUP_ORDER,
1279
+ encode: (w) => w.writeVarInt(props.default_publisher_group_order)
1280
+ });
1281
+ }
1282
+ if (props.dynamic_groups !== void 0) {
1283
+ entries.push({
1284
+ type: TPROP_DYNAMIC_GROUPS,
1285
+ encode: (w) => w.writeVarInt(props.dynamic_groups)
1286
+ });
1287
+ }
1288
+ if (props.unknown) {
1289
+ for (const u of props.unknown) {
1290
+ const id = BigInt(u.id);
1291
+ entries.push({
1292
+ type: id,
1293
+ encode: (w) => {
1294
+ if (id % 2n === 0n) {
1295
+ const raw = _chunkJL3NEW3Ocjs.hexToBytes.call(void 0, u.raw_hex);
1296
+ const tmpReader = new (0, _chunkJL3NEW3Ocjs.BufferReader)(raw);
1297
+ w.writeVarInt(tmpReader.readVarInt());
1298
+ } else {
1299
+ const raw = _chunkJL3NEW3Ocjs.hexToBytes.call(void 0, u.raw_hex);
1300
+ w.writeVarInt(BigInt(raw.byteLength));
1301
+ w.writeBytes(raw);
1302
+ }
1303
+ }
1304
+ });
1305
+ }
1306
+ }
947
1307
  entries.sort((a, b) => a.type < b.type ? -1 : a.type > b.type ? 1 : 0);
948
1308
  let prevType = 0n;
949
1309
  for (const entry of entries) {
950
1310
  writer.writeVarInt(entry.type - prevType);
951
- if (entry.type % 2n === 0n) {
952
- const raw = _chunkKNDYS3DKcjs.hexToBytes.call(void 0, entry.raw.raw_hex);
953
- const tmpReader = new (0, _chunkRUPCJTC3cjs.BufferReader)(raw);
954
- writer.writeVarInt(tmpReader.readVarInt());
955
- } else {
956
- const raw = _chunkKNDYS3DKcjs.hexToBytes.call(void 0, entry.raw.raw_hex);
957
- writer.writeVarInt(BigInt(raw.byteLength));
958
- writer.writeBytes(raw);
959
- }
1311
+ entry.encode(writer);
960
1312
  prevType = entry.type;
961
1313
  }
962
1314
  }
@@ -970,18 +1322,38 @@ function decodeTrackProperties(reader, payloadEnd) {
970
1322
  prevType = propType;
971
1323
  if (propType % 2n === 0n) {
972
1324
  const value = reader.readVarInt();
973
- const tmpWriter = new (0, _chunkRUPCJTC3cjs.BufferWriter)(16);
974
- tmpWriter.writeVarInt(value);
975
- const raw = tmpWriter.finish();
976
- unknown.push({
977
- id: `0x${propType.toString(16)}`,
978
- length: raw.byteLength,
979
- raw_hex: _chunkKNDYS3DKcjs.bytesToHex.call(void 0, raw)
980
- });
1325
+ if (propType === TPROP_DELIVERY_TIMEOUT) {
1326
+ result.delivery_timeout = value;
1327
+ } else if (propType === TPROP_MAX_CACHE_DURATION) {
1328
+ result.max_cache_duration = value;
1329
+ } else if (propType === TPROP_DEFAULT_PUBLISHER_PRIORITY) {
1330
+ result.default_publisher_priority = value;
1331
+ } else if (propType === TPROP_DEFAULT_PUBLISHER_GROUP_ORDER) {
1332
+ result.default_publisher_group_order = value;
1333
+ } else if (propType === TPROP_DYNAMIC_GROUPS) {
1334
+ result.dynamic_groups = value;
1335
+ } else {
1336
+ const tmpWriter = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(16);
1337
+ tmpWriter.writeVarInt(value);
1338
+ const raw = tmpWriter.finish();
1339
+ unknown.push({
1340
+ id: `0x${propType.toString(16)}`,
1341
+ length: raw.byteLength,
1342
+ raw_hex: _chunkJL3NEW3Ocjs.bytesToHex.call(void 0, raw)
1343
+ });
1344
+ }
981
1345
  } else {
982
1346
  const length = Number(reader.readVarInt());
983
1347
  const bytes = reader.readBytes(length);
984
- unknown.push({ id: `0x${propType.toString(16)}`, length, raw_hex: _chunkKNDYS3DKcjs.bytesToHex.call(void 0, bytes) });
1348
+ if (propType === TPROP_IMMUTABLE_PROPERTIES) {
1349
+ result.immutable_properties = _chunkJL3NEW3Ocjs.bytesToHex.call(void 0, bytes);
1350
+ } else {
1351
+ unknown.push({
1352
+ id: `0x${propType.toString(16)}`,
1353
+ length,
1354
+ raw_hex: _chunkJL3NEW3Ocjs.bytesToHex.call(void 0, bytes)
1355
+ });
1356
+ }
985
1357
  }
986
1358
  }
987
1359
  if (unknown.length > 0) result.unknown = unknown;
@@ -1120,7 +1492,12 @@ function decodeRequestUpdatePayload(r) {
1120
1492
  const request_id = r.readVarInt();
1121
1493
  const required_request_id_delta = r.readVarInt();
1122
1494
  const parameters = decodeParams(r);
1123
- return { type: "request_update", request_id, required_request_id_delta, parameters };
1495
+ return {
1496
+ type: "request_update",
1497
+ request_id,
1498
+ required_request_id_delta,
1499
+ parameters
1500
+ };
1124
1501
  }
1125
1502
  function decodePublishPayload(r, payloadEnd) {
1126
1503
  const request_id = r.readVarInt();
@@ -1198,7 +1575,7 @@ function decodeFetchPayload(r) {
1198
1575
  const fetch_type = r.readVarInt();
1199
1576
  const ft = Number(fetch_type);
1200
1577
  if (ft < 1 || ft > 3) {
1201
- throw new (0, _chunkRUPCJTC3cjs.DecodeError)("CONSTRAINT_VIOLATION", `Invalid fetch_type: ${ft}`, r.offset);
1578
+ throw new (0, _chunkJL3NEW3Ocjs.DecodeError)("CONSTRAINT_VIOLATION", `Invalid fetch_type: ${ft}`, r.offset);
1202
1579
  }
1203
1580
  let standalone;
1204
1581
  let joining;
@@ -1209,7 +1586,14 @@ function decodeFetchPayload(r) {
1209
1586
  const start_object = r.readVarInt();
1210
1587
  const end_group = r.readVarInt();
1211
1588
  const end_object = r.readVarInt();
1212
- standalone = { track_namespace, track_name, start_group, start_object, end_group, end_object };
1589
+ standalone = {
1590
+ track_namespace,
1591
+ track_name,
1592
+ start_group,
1593
+ start_object,
1594
+ end_group,
1595
+ end_object
1596
+ };
1213
1597
  } else {
1214
1598
  const joining_request_id = r.readVarInt();
1215
1599
  const joining_start = r.readVarInt();
@@ -1232,7 +1616,14 @@ function decodeFetchOkPayload(r, payloadEnd) {
1232
1616
  const end_object = r.readVarInt();
1233
1617
  const parameters = decodeParams(r);
1234
1618
  const track_properties = decodeTrackProperties(r, payloadEnd);
1235
- return { type: "fetch_ok", end_of_track, end_group, end_object, parameters, track_properties };
1619
+ return {
1620
+ type: "fetch_ok",
1621
+ end_of_track,
1622
+ end_group,
1623
+ end_object,
1624
+ parameters,
1625
+ track_properties
1626
+ };
1236
1627
  }
1237
1628
  function decodeTrackStatusPayload(r) {
1238
1629
  const request_id = r.readVarInt();
@@ -1269,13 +1660,13 @@ function encodeMessage(message) {
1269
1660
  if (typeId === void 0) {
1270
1661
  throw new Error(`Unknown message type: ${message.type}`);
1271
1662
  }
1272
- const payloadWriter = new (0, _chunkRUPCJTC3cjs.BufferWriter)();
1663
+ const payloadWriter = new (0, _chunkJL3NEW3Ocjs.BufferWriter)();
1273
1664
  encodePayload(message, payloadWriter);
1274
1665
  const payload = payloadWriter.finishView();
1275
1666
  if (payload.byteLength > 65535) {
1276
1667
  throw new Error(`Payload too large for 16-bit length: ${payload.byteLength}`);
1277
1668
  }
1278
- const writer = new (0, _chunkRUPCJTC3cjs.BufferWriter)(payload.byteLength + 16);
1669
+ const writer = new (0, _chunkJL3NEW3Ocjs.BufferWriter)(payload.byteLength + 16);
1279
1670
  writer.writeVarInt(typeId);
1280
1671
  writer.writeUint8(payload.byteLength >> 8 & 255);
1281
1672
  writer.writeUint8(payload.byteLength & 255);
@@ -1328,7 +1719,7 @@ function encodePayload(msg, w) {
1328
1719
  }
1329
1720
  function decodeMessage(bytes) {
1330
1721
  try {
1331
- const reader = new (0, _chunkRUPCJTC3cjs.BufferReader)(bytes);
1722
+ const reader = new (0, _chunkJL3NEW3Ocjs.BufferReader)(bytes);
1332
1723
  const typeId = reader.readVarInt();
1333
1724
  const lenHi = reader.readUint8();
1334
1725
  const lenLo = reader.readUint8();
@@ -1336,7 +1727,7 @@ function decodeMessage(bytes) {
1336
1727
  const payloadStart = reader.offset;
1337
1728
  const _payloadEnd = payloadStart + payloadLength;
1338
1729
  const payloadBytes = reader.readBytes(payloadLength);
1339
- const payloadReader = new (0, _chunkRUPCJTC3cjs.BufferReader)(payloadBytes);
1730
+ const payloadReader = new (0, _chunkJL3NEW3Ocjs.BufferReader)(payloadBytes);
1340
1731
  let message;
1341
1732
  if (typeId === MSG_SETUP) {
1342
1733
  message = decodeSetupPayload(payloadReader, payloadLength);
@@ -1377,7 +1768,7 @@ function decodeMessage(bytes) {
1377
1768
  } else {
1378
1769
  return {
1379
1770
  ok: false,
1380
- error: new (0, _chunkRUPCJTC3cjs.DecodeError)(
1771
+ error: new (0, _chunkJL3NEW3Ocjs.DecodeError)(
1381
1772
  "UNKNOWN_MESSAGE_TYPE",
1382
1773
  `Unknown message type ID: 0x${typeId.toString(16)}`,
1383
1774
  0
@@ -1386,7 +1777,7 @@ function decodeMessage(bytes) {
1386
1777
  }
1387
1778
  return { ok: true, value: message, bytesRead: reader.offset };
1388
1779
  } catch (e) {
1389
- if (e instanceof _chunkRUPCJTC3cjs.DecodeError) {
1780
+ if (e instanceof _chunkJL3NEW3Ocjs.DecodeError) {
1390
1781
  return { ok: false, error: e };
1391
1782
  }
1392
1783
  throw e;
@@ -1421,7 +1812,7 @@ function createStreamDecoder() {
1421
1812
  flush(controller) {
1422
1813
  if (offset < buffer.length) {
1423
1814
  controller.error(
1424
- new (0, _chunkRUPCJTC3cjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete message data", 0)
1815
+ new (0, _chunkJL3NEW3Ocjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete message data", 0)
1425
1816
  );
1426
1817
  }
1427
1818
  }
@@ -1429,7 +1820,7 @@ function createStreamDecoder() {
1429
1820
  }
1430
1821
  function createDraft17Codec() {
1431
1822
  return {
1432
- draft: "draft-ietf-moq-transport-17",
1823
+ draft: "17",
1433
1824
  encodeMessage,
1434
1825
  decodeMessage,
1435
1826
  encodeSubgroupStream,