@blockcast/mmt-container 0.1.0-main.149f78a4adae

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 (678) hide show
  1. package/README.md +432 -0
  2. package/dist/.build-stamp +0 -0
  3. package/dist/__tests__/test-utils.d.ts +71 -0
  4. package/dist/__tests__/test-utils.d.ts.map +1 -0
  5. package/dist/align.d.ts +148 -0
  6. package/dist/align.d.ts.map +1 -0
  7. package/dist/align.js +88 -0
  8. package/dist/align.js.map +7 -0
  9. package/dist/audio-init-parser.d.ts +66 -0
  10. package/dist/audio-init-parser.d.ts.map +1 -0
  11. package/dist/audio-init-parser.js +118 -0
  12. package/dist/audio-init-parser.js.map +7 -0
  13. package/dist/audio-ring-buffer.d.ts +50 -0
  14. package/dist/audio-ring-buffer.d.ts.map +1 -0
  15. package/dist/audio-ring-buffer.js +93 -0
  16. package/dist/audio-ring-buffer.js.map +7 -0
  17. package/dist/authored-timing.d.ts +32 -0
  18. package/dist/authored-timing.d.ts.map +1 -0
  19. package/dist/authored-timing.js +32 -0
  20. package/dist/authored-timing.js.map +7 -0
  21. package/dist/browser-runtime.js +17109 -0
  22. package/dist/browser-runtime.js.map +7 -0
  23. package/dist/carp-catalog.d.ts +318 -0
  24. package/dist/carp-catalog.d.ts.map +1 -0
  25. package/dist/carp-catalog.js +549 -0
  26. package/dist/carp-catalog.js.map +7 -0
  27. package/dist/catalog-fec-params.d.ts +82 -0
  28. package/dist/catalog-fec-params.d.ts.map +1 -0
  29. package/dist/catalog-fec-params.js +66 -0
  30. package/dist/catalog-fec-params.js.map +7 -0
  31. package/dist/catalog-network-source.d.ts +19 -0
  32. package/dist/catalog-network-source.d.ts.map +1 -0
  33. package/dist/catalog-network-source.js +22 -0
  34. package/dist/catalog-network-source.js.map +7 -0
  35. package/dist/catalog-validator.d.ts +18 -0
  36. package/dist/catalog-validator.d.ts.map +1 -0
  37. package/dist/catalog-validator.js +7747 -0
  38. package/dist/catalog-validator.js.map +7 -0
  39. package/dist/cmaf-block-assembler.d.ts +168 -0
  40. package/dist/cmaf-block-assembler.d.ts.map +1 -0
  41. package/dist/cmaf-block-assembler.js +1755 -0
  42. package/dist/cmaf-block-assembler.js.map +7 -0
  43. package/dist/cmaf-group-batcher.d.ts +38 -0
  44. package/dist/cmaf-group-batcher.d.ts.map +1 -0
  45. package/dist/cmaf-group-batcher.js +195 -0
  46. package/dist/cmaf-group-batcher.js.map +7 -0
  47. package/dist/cmcd-producer.d.ts +104 -0
  48. package/dist/cmcd-producer.d.ts.map +1 -0
  49. package/dist/cmcd-producer.js +207 -0
  50. package/dist/cmcd-producer.js.map +7 -0
  51. package/dist/codec-utils.d.ts +235 -0
  52. package/dist/codec-utils.d.ts.map +1 -0
  53. package/dist/codec-utils.js +1225 -0
  54. package/dist/codec-utils.js.map +7 -0
  55. package/dist/fec-codec.d.ts +32 -0
  56. package/dist/fec-codec.d.ts.map +1 -0
  57. package/dist/fec-codec.js +47 -0
  58. package/dist/fec-codec.js.map +7 -0
  59. package/dist/fec-manager.d.ts +266 -0
  60. package/dist/fec-manager.d.ts.map +1 -0
  61. package/dist/fec-manager.js +1447 -0
  62. package/dist/fec-manager.js.map +7 -0
  63. package/dist/fec-starvation-detector.d.ts +59 -0
  64. package/dist/fec-starvation-detector.d.ts.map +1 -0
  65. package/dist/fec-starvation-detector.js +75 -0
  66. package/dist/fec-starvation-detector.js.map +7 -0
  67. package/dist/fec-worker-setup.d.ts +76 -0
  68. package/dist/fec-worker-setup.d.ts.map +1 -0
  69. package/dist/fec-worker-setup.js +603 -0
  70. package/dist/fec-worker-setup.js.map +7 -0
  71. package/dist/fmp4-completion.d.ts +30 -0
  72. package/dist/fmp4-completion.d.ts.map +1 -0
  73. package/dist/fmp4-completion.js +21 -0
  74. package/dist/fmp4-completion.js.map +7 -0
  75. package/dist/fmp4-reader.d.ts +37 -0
  76. package/dist/fmp4-reader.d.ts.map +1 -0
  77. package/dist/fmp4-reader.js +100 -0
  78. package/dist/fmp4-reader.js.map +7 -0
  79. package/dist/index.d.ts +47 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +330 -0
  82. package/dist/index.js.map +7 -0
  83. package/dist/iso-bmff-timing.d.ts +47 -0
  84. package/dist/iso-bmff-timing.d.ts.map +1 -0
  85. package/dist/iso-bmff-timing.js +526 -0
  86. package/dist/iso-bmff-timing.js.map +7 -0
  87. package/dist/loc.d.ts +68 -0
  88. package/dist/loc.d.ts.map +1 -0
  89. package/dist/loc.js +143 -0
  90. package/dist/loc.js.map +7 -0
  91. package/dist/manifest-auth-plan.d.ts +30 -0
  92. package/dist/manifest-auth-plan.d.ts.map +1 -0
  93. package/dist/manifest-auth-plan.js +1267 -0
  94. package/dist/manifest-auth-plan.js.map +7 -0
  95. package/dist/media-router.d.ts +338 -0
  96. package/dist/media-router.d.ts.map +1 -0
  97. package/dist/media-router.js +802 -0
  98. package/dist/media-router.js.map +7 -0
  99. package/dist/mfu-reassembler.d.ts +264 -0
  100. package/dist/mfu-reassembler.d.ts.map +1 -0
  101. package/dist/mfu-reassembler.js +2668 -0
  102. package/dist/mfu-reassembler.js.map +7 -0
  103. package/dist/mfu-reassembly-policy.d.ts +24 -0
  104. package/dist/mfu-reassembly-policy.d.ts.map +1 -0
  105. package/dist/mfu-reassembly-policy.js +99 -0
  106. package/dist/mfu-reassembly-policy.js.map +7 -0
  107. package/dist/mmtp-container-parser.d.ts +304 -0
  108. package/dist/mmtp-container-parser.d.ts.map +1 -0
  109. package/dist/mmtp-container-parser.js +5378 -0
  110. package/dist/mmtp-container-parser.js.map +7 -0
  111. package/dist/mmtp-container-parser.no-modules.js +7853 -0
  112. package/dist/mmtp-container-parser.no-modules.js.map +7 -0
  113. package/dist/mmtp-decode-pipeline.d.ts +96 -0
  114. package/dist/mmtp-decode-pipeline.d.ts.map +1 -0
  115. package/dist/mmtp-decode-pipeline.js +5589 -0
  116. package/dist/mmtp-decode-pipeline.js.map +7 -0
  117. package/dist/mmtp-router.d.ts +383 -0
  118. package/dist/mmtp-router.d.ts.map +1 -0
  119. package/dist/mmtp-router.js +8384 -0
  120. package/dist/mmtp-router.js.map +7 -0
  121. package/dist/mmtp-to-cmaf.d.ts +166 -0
  122. package/dist/mmtp-to-cmaf.d.ts.map +1 -0
  123. package/dist/mmtp-to-cmaf.js +781 -0
  124. package/dist/mmtp-to-cmaf.js.map +7 -0
  125. package/dist/multicast-auth-catalog.d.ts +115 -0
  126. package/dist/multicast-auth-catalog.d.ts.map +1 -0
  127. package/dist/multicast-auth-catalog.js +202 -0
  128. package/dist/multicast-auth-catalog.js.map +7 -0
  129. package/dist/multicast-input.d.ts +107 -0
  130. package/dist/multicast-input.d.ts.map +1 -0
  131. package/dist/multicast-input.js +256 -0
  132. package/dist/multicast-input.js.map +7 -0
  133. package/dist/multicast-manager.d.ts +330 -0
  134. package/dist/multicast-manager.d.ts.map +1 -0
  135. package/dist/multicast-manager.js +11032 -0
  136. package/dist/multicast-manager.js.map +7 -0
  137. package/dist/multicast-transport.d.ts +62 -0
  138. package/dist/multicast-transport.d.ts.map +1 -0
  139. package/dist/multicast-transport.js +338 -0
  140. package/dist/multicast-transport.js.map +7 -0
  141. package/dist/multicast-unwrap.d.ts +57 -0
  142. package/dist/multicast-unwrap.d.ts.map +1 -0
  143. package/dist/multicast-unwrap.js +384 -0
  144. package/dist/multicast-unwrap.js.map +7 -0
  145. package/dist/no-modules.d.ts +9 -0
  146. package/dist/no-modules.d.ts.map +1 -0
  147. package/dist/no-modules.js +7819 -0
  148. package/dist/no-modules.js.map +7 -0
  149. package/dist/phase14-catalog-override.d.ts +126 -0
  150. package/dist/phase14-catalog-override.d.ts.map +1 -0
  151. package/dist/phase14-catalog-override.js +155 -0
  152. package/dist/phase14-catalog-override.js.map +7 -0
  153. package/dist/repair-fetch.d.ts +58 -0
  154. package/dist/repair-fetch.d.ts.map +1 -0
  155. package/dist/repair-fetch.js +117 -0
  156. package/dist/repair-fetch.js.map +7 -0
  157. package/dist/sample-combiner.d.ts +182 -0
  158. package/dist/sample-combiner.d.ts.map +1 -0
  159. package/dist/sample-combiner.js +571 -0
  160. package/dist/sample-combiner.js.map +7 -0
  161. package/dist/signaling.d.ts +29 -0
  162. package/dist/signaling.d.ts.map +1 -0
  163. package/dist/signaling.js +232 -0
  164. package/dist/signaling.js.map +7 -0
  165. package/dist/source-auth.d.ts +2 -0
  166. package/dist/source-auth.d.ts.map +1 -0
  167. package/dist/source-auth.js +1220 -0
  168. package/dist/source-auth.js.map +7 -0
  169. package/dist/switching-set-alignment.d.ts +61 -0
  170. package/dist/switching-set-alignment.d.ts.map +1 -0
  171. package/dist/switching-set-alignment.js +85 -0
  172. package/dist/switching-set-alignment.js.map +7 -0
  173. package/dist/timestamp-codec.d.ts +34 -0
  174. package/dist/timestamp-codec.d.ts.map +1 -0
  175. package/dist/timestamp-codec.js +456 -0
  176. package/dist/timestamp-codec.js.map +7 -0
  177. package/dist/track-pipeline-setup.d.ts +72 -0
  178. package/dist/track-pipeline-setup.d.ts.map +1 -0
  179. package/dist/track-pipeline-setup.js +306 -0
  180. package/dist/track-pipeline-setup.js.map +7 -0
  181. package/dist/track-pipeline.d.ts +121 -0
  182. package/dist/track-pipeline.d.ts.map +1 -0
  183. package/dist/track-pipeline.js +229 -0
  184. package/dist/track-pipeline.js.map +7 -0
  185. package/dist/track-session.d.ts +269 -0
  186. package/dist/track-session.d.ts.map +1 -0
  187. package/dist/track-session.js +597 -0
  188. package/dist/track-session.js.map +7 -0
  189. package/dist/transport-pool.d.ts +69 -0
  190. package/dist/transport-pool.d.ts.map +1 -0
  191. package/dist/transport-pool.js +88 -0
  192. package/dist/transport-pool.js.map +7 -0
  193. package/dist/wasm-mfu-reassembler.d.ts +81 -0
  194. package/dist/wasm-mfu-reassembler.d.ts.map +1 -0
  195. package/dist/wasm-mfu-reassembler.js +1915 -0
  196. package/dist/wasm-mfu-reassembler.js.map +7 -0
  197. package/dist/wasm-mmtp-container-parser.d.ts +10 -0
  198. package/dist/wasm-mmtp-container-parser.d.ts.map +1 -0
  199. package/dist/wasm-mmtp-container-parser.js +5635 -0
  200. package/dist/wasm-mmtp-container-parser.js.map +7 -0
  201. package/node_modules/@blockcast/fec-worker/README.md +213 -0
  202. package/node_modules/@blockcast/fec-worker/dist/.build-stamp +0 -0
  203. package/node_modules/@blockcast/fec-worker/dist/fec-worker-client.d.ts +80 -0
  204. package/node_modules/@blockcast/fec-worker/dist/fec-worker-client.d.ts.map +1 -0
  205. package/node_modules/@blockcast/fec-worker/dist/fec-worker-client.js +270 -0
  206. package/node_modules/@blockcast/fec-worker/dist/fec-worker-client.js.map +1 -0
  207. package/node_modules/@blockcast/fec-worker/dist/fec-worker-types.d.ts +252 -0
  208. package/node_modules/@blockcast/fec-worker/dist/fec-worker-types.d.ts.map +1 -0
  209. package/node_modules/@blockcast/fec-worker/dist/fec-worker-types.js +11 -0
  210. package/node_modules/@blockcast/fec-worker/dist/fec-worker-types.js.map +1 -0
  211. package/node_modules/@blockcast/fec-worker/dist/fec-worker.d.ts +14 -0
  212. package/node_modules/@blockcast/fec-worker/dist/fec-worker.d.ts.map +1 -0
  213. package/node_modules/@blockcast/fec-worker/dist/fec-worker.js +565 -0
  214. package/node_modules/@blockcast/fec-worker/dist/fec-worker.js.map +7 -0
  215. package/node_modules/@blockcast/fec-worker/dist/index.d.ts +10 -0
  216. package/node_modules/@blockcast/fec-worker/dist/index.d.ts.map +1 -0
  217. package/node_modules/@blockcast/fec-worker/dist/index.js +8 -0
  218. package/node_modules/@blockcast/fec-worker/dist/index.js.map +1 -0
  219. package/node_modules/@blockcast/fec-worker/dist/shred-fec-worker.d.ts +20 -0
  220. package/node_modules/@blockcast/fec-worker/dist/shred-fec-worker.d.ts.map +1 -0
  221. package/node_modules/@blockcast/fec-worker/dist/shred-fec-worker.js +349 -0
  222. package/node_modules/@blockcast/fec-worker/dist/shred-fec-worker.js.map +7 -0
  223. package/node_modules/@blockcast/fec-worker/dist/shred-worker-client.d.ts +104 -0
  224. package/node_modules/@blockcast/fec-worker/dist/shred-worker-client.d.ts.map +1 -0
  225. package/node_modules/@blockcast/fec-worker/dist/shred-worker-client.js +181 -0
  226. package/node_modules/@blockcast/fec-worker/dist/shred-worker-client.js.map +1 -0
  227. package/node_modules/@blockcast/fec-worker/dist/shred-worker-types.d.ts +179 -0
  228. package/node_modules/@blockcast/fec-worker/dist/shred-worker-types.d.ts.map +1 -0
  229. package/node_modules/@blockcast/fec-worker/dist/shred-worker-types.js +47 -0
  230. package/node_modules/@blockcast/fec-worker/dist/shred-worker-types.js.map +1 -0
  231. package/node_modules/@blockcast/fec-worker/dist/transfer.d.ts +9 -0
  232. package/node_modules/@blockcast/fec-worker/dist/transfer.d.ts.map +1 -0
  233. package/node_modules/@blockcast/fec-worker/dist/transfer.js +13 -0
  234. package/node_modules/@blockcast/fec-worker/dist/transfer.js.map +1 -0
  235. package/node_modules/@blockcast/fec-worker/package.json +59 -0
  236. package/node_modules/@blockcast/fec-worker/src/fec-worker-client.ts +309 -0
  237. package/node_modules/@blockcast/fec-worker/src/fec-worker-types.ts +268 -0
  238. package/node_modules/@blockcast/fec-worker/src/fec-worker.ts +1048 -0
  239. package/node_modules/@blockcast/fec-worker/src/index.ts +32 -0
  240. package/node_modules/@blockcast/fec-worker/src/shred-fec-worker.ts +558 -0
  241. package/node_modules/@blockcast/fec-worker/src/shred-worker-client.ts +222 -0
  242. package/node_modules/@blockcast/fec-worker/src/shred-worker-types.ts +194 -0
  243. package/node_modules/@blockcast/fec-worker/src/transfer.ts +12 -0
  244. package/node_modules/@blockcast/mmt-alta-parse/README.md +181 -0
  245. package/node_modules/@blockcast/mmt-alta-parse/dist/.build-stamp +0 -0
  246. package/node_modules/@blockcast/mmt-alta-parse/dist/index.d.ts +57 -0
  247. package/node_modules/@blockcast/mmt-alta-parse/dist/index.d.ts.map +1 -0
  248. package/node_modules/@blockcast/mmt-alta-parse/dist/index.js +115 -0
  249. package/node_modules/@blockcast/mmt-alta-parse/dist/index.js.map +1 -0
  250. package/node_modules/@blockcast/mmt-alta-parse/package.json +50 -0
  251. package/node_modules/@blockcast/mmt-alta-parse/src/index.ts +136 -0
  252. package/node_modules/@blockcast/mmt-base/README.md +120 -0
  253. package/node_modules/@blockcast/mmt-base/dist/.build-stamp +0 -0
  254. package/node_modules/@blockcast/mmt-base/dist/index.d.ts +2 -0
  255. package/node_modules/@blockcast/mmt-base/dist/index.d.ts.map +1 -0
  256. package/node_modules/@blockcast/mmt-base/dist/index.js +2 -0
  257. package/node_modules/@blockcast/mmt-base/dist/index.js.map +1 -0
  258. package/node_modules/@blockcast/mmt-base/dist/mmtp.d.ts +275 -0
  259. package/node_modules/@blockcast/mmt-base/dist/mmtp.d.ts.map +1 -0
  260. package/node_modules/@blockcast/mmt-base/dist/mmtp.js +644 -0
  261. package/node_modules/@blockcast/mmt-base/dist/mmtp.js.map +1 -0
  262. package/node_modules/@blockcast/mmt-base/package.json +49 -0
  263. package/node_modules/@blockcast/mmt-base/src/index.ts +1 -0
  264. package/node_modules/@blockcast/mmt-base/src/mmtp.ts +898 -0
  265. package/node_modules/@blockcast/mmt-fec/README.md +270 -0
  266. package/node_modules/@blockcast/mmt-fec/dist/.build-stamp +0 -0
  267. package/node_modules/@blockcast/mmt-fec/dist/block-manager.d.ts +80 -0
  268. package/node_modules/@blockcast/mmt-fec/dist/block-manager.d.ts.map +1 -0
  269. package/node_modules/@blockcast/mmt-fec/dist/block-manager.js +294 -0
  270. package/node_modules/@blockcast/mmt-fec/dist/block-manager.js.map +1 -0
  271. package/node_modules/@blockcast/mmt-fec/dist/block-processor.d.ts +72 -0
  272. package/node_modules/@blockcast/mmt-fec/dist/block-processor.d.ts.map +1 -0
  273. package/node_modules/@blockcast/mmt-fec/dist/block-processor.js +192 -0
  274. package/node_modules/@blockcast/mmt-fec/dist/block-processor.js.map +1 -0
  275. package/node_modules/@blockcast/mmt-fec/dist/cmaf-recovery.d.ts +46 -0
  276. package/node_modules/@blockcast/mmt-fec/dist/cmaf-recovery.d.ts.map +1 -0
  277. package/node_modules/@blockcast/mmt-fec/dist/cmaf-recovery.js +96 -0
  278. package/node_modules/@blockcast/mmt-fec/dist/cmaf-recovery.js.map +1 -0
  279. package/node_modules/@blockcast/mmt-fec/dist/cmaf-symbols.d.ts +33 -0
  280. package/node_modules/@blockcast/mmt-fec/dist/cmaf-symbols.d.ts.map +1 -0
  281. package/node_modules/@blockcast/mmt-fec/dist/cmaf-symbols.js +57 -0
  282. package/node_modules/@blockcast/mmt-fec/dist/cmaf-symbols.js.map +1 -0
  283. package/node_modules/@blockcast/mmt-fec/dist/fec-block-mapper.d.ts +185 -0
  284. package/node_modules/@blockcast/mmt-fec/dist/fec-block-mapper.d.ts.map +1 -0
  285. package/node_modules/@blockcast/mmt-fec/dist/fec-block-mapper.js +273 -0
  286. package/node_modules/@blockcast/mmt-fec/dist/fec-block-mapper.js.map +1 -0
  287. package/node_modules/@blockcast/mmt-fec/dist/index.d.ts +22 -0
  288. package/node_modules/@blockcast/mmt-fec/dist/index.d.ts.map +1 -0
  289. package/node_modules/@blockcast/mmt-fec/dist/index.js +22 -0
  290. package/node_modules/@blockcast/mmt-fec/dist/index.js.map +1 -0
  291. package/node_modules/@blockcast/mmt-fec/dist/loc-symbols.d.ts +20 -0
  292. package/node_modules/@blockcast/mmt-fec/dist/loc-symbols.d.ts.map +1 -0
  293. package/node_modules/@blockcast/mmt-fec/dist/loc-symbols.js +28 -0
  294. package/node_modules/@blockcast/mmt-fec/dist/loc-symbols.js.map +1 -0
  295. package/node_modules/@blockcast/mmt-fec/dist/oti.d.ts +174 -0
  296. package/node_modules/@blockcast/mmt-fec/dist/oti.d.ts.map +1 -0
  297. package/node_modules/@blockcast/mmt-fec/dist/oti.js +256 -0
  298. package/node_modules/@blockcast/mmt-fec/dist/oti.js.map +1 -0
  299. package/node_modules/@blockcast/mmt-fec/dist/reorder-buffer.d.ts +41 -0
  300. package/node_modules/@blockcast/mmt-fec/dist/reorder-buffer.d.ts.map +1 -0
  301. package/node_modules/@blockcast/mmt-fec/dist/reorder-buffer.js +81 -0
  302. package/node_modules/@blockcast/mmt-fec/dist/reorder-buffer.js.map +1 -0
  303. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-alta-parse/README.md +181 -0
  304. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-alta-parse/dist/.build-stamp +0 -0
  305. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-alta-parse/dist/index.d.ts +57 -0
  306. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-alta-parse/dist/index.d.ts.map +1 -0
  307. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-alta-parse/dist/index.js +115 -0
  308. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-alta-parse/dist/index.js.map +1 -0
  309. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-alta-parse/package.json +50 -0
  310. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-alta-parse/src/index.ts +136 -0
  311. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/README.md +120 -0
  312. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/.build-stamp +0 -0
  313. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/index.d.ts +2 -0
  314. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/index.d.ts.map +1 -0
  315. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/index.js +2 -0
  316. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/index.js.map +1 -0
  317. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/mmtp.d.ts +275 -0
  318. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/mmtp.d.ts.map +1 -0
  319. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/mmtp.js +644 -0
  320. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/mmtp.js.map +1 -0
  321. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/package.json +49 -0
  322. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/src/index.ts +1 -0
  323. package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/src/mmtp.ts +898 -0
  324. package/node_modules/@blockcast/mmt-fec/package.json +79 -0
  325. package/node_modules/@blockcast/mmt-fec/src/block-manager.ts +369 -0
  326. package/node_modules/@blockcast/mmt-fec/src/block-processor.ts +277 -0
  327. package/node_modules/@blockcast/mmt-fec/src/cmaf-recovery.ts +127 -0
  328. package/node_modules/@blockcast/mmt-fec/src/cmaf-symbols.ts +68 -0
  329. package/node_modules/@blockcast/mmt-fec/src/fec-block-mapper.ts +332 -0
  330. package/node_modules/@blockcast/mmt-fec/src/index.ts +77 -0
  331. package/node_modules/@blockcast/mmt-fec/src/loc-symbols.ts +34 -0
  332. package/node_modules/@blockcast/mmt-fec/src/oti.ts +319 -0
  333. package/node_modules/@blockcast/mmt-fec/src/reorder-buffer.ts +101 -0
  334. package/node_modules/@blockcast/mmt-manifest-verify/dist/.build-stamp +0 -0
  335. package/node_modules/@blockcast/mmt-manifest-verify/dist/admission.d.ts +28 -0
  336. package/node_modules/@blockcast/mmt-manifest-verify/dist/admission.d.ts.map +1 -0
  337. package/node_modules/@blockcast/mmt-manifest-verify/dist/admission.js +128 -0
  338. package/node_modules/@blockcast/mmt-manifest-verify/dist/admission.js.map +1 -0
  339. package/node_modules/@blockcast/mmt-manifest-verify/dist/index.d.ts +4 -0
  340. package/node_modules/@blockcast/mmt-manifest-verify/dist/index.d.ts.map +1 -0
  341. package/node_modules/@blockcast/mmt-manifest-verify/dist/index.js +4 -0
  342. package/node_modules/@blockcast/mmt-manifest-verify/dist/index.js.map +1 -0
  343. package/node_modules/@blockcast/mmt-manifest-verify/dist/source-auth.d.ts +37 -0
  344. package/node_modules/@blockcast/mmt-manifest-verify/dist/source-auth.d.ts.map +1 -0
  345. package/node_modules/@blockcast/mmt-manifest-verify/dist/source-auth.js +179 -0
  346. package/node_modules/@blockcast/mmt-manifest-verify/dist/source-auth.js.map +1 -0
  347. package/node_modules/@blockcast/mmt-manifest-verify/dist/verifier.d.ts +90 -0
  348. package/node_modules/@blockcast/mmt-manifest-verify/dist/verifier.d.ts.map +1 -0
  349. package/node_modules/@blockcast/mmt-manifest-verify/dist/verifier.js +462 -0
  350. package/node_modules/@blockcast/mmt-manifest-verify/dist/verifier.js.map +1 -0
  351. package/node_modules/@blockcast/mmt-manifest-verify/package.json +45 -0
  352. package/node_modules/@blockcast/mmt-manifest-verify/src/admission.ts +171 -0
  353. package/node_modules/@blockcast/mmt-manifest-verify/src/index.ts +3 -0
  354. package/node_modules/@blockcast/mmt-manifest-verify/src/source-auth.ts +230 -0
  355. package/node_modules/@blockcast/mmt-manifest-verify/src/verifier.ts +636 -0
  356. package/node_modules/@noble/hashes/LICENSE +21 -0
  357. package/node_modules/@noble/hashes/README.md +521 -0
  358. package/node_modules/@noble/hashes/_assert.d.ts +17 -0
  359. package/node_modules/@noble/hashes/_assert.d.ts.map +1 -0
  360. package/node_modules/@noble/hashes/_assert.js +18 -0
  361. package/node_modules/@noble/hashes/_assert.js.map +1 -0
  362. package/node_modules/@noble/hashes/_blake.d.ts +14 -0
  363. package/node_modules/@noble/hashes/_blake.d.ts.map +1 -0
  364. package/node_modules/@noble/hashes/_blake.js +50 -0
  365. package/node_modules/@noble/hashes/_blake.js.map +1 -0
  366. package/node_modules/@noble/hashes/_md.d.ts +51 -0
  367. package/node_modules/@noble/hashes/_md.d.ts.map +1 -0
  368. package/node_modules/@noble/hashes/_md.js +162 -0
  369. package/node_modules/@noble/hashes/_md.js.map +1 -0
  370. package/node_modules/@noble/hashes/_u64.d.ts +55 -0
  371. package/node_modules/@noble/hashes/_u64.d.ts.map +1 -0
  372. package/node_modules/@noble/hashes/_u64.js +90 -0
  373. package/node_modules/@noble/hashes/_u64.js.map +1 -0
  374. package/node_modules/@noble/hashes/argon2.d.ts +32 -0
  375. package/node_modules/@noble/hashes/argon2.d.ts.map +1 -0
  376. package/node_modules/@noble/hashes/argon2.js +401 -0
  377. package/node_modules/@noble/hashes/argon2.js.map +1 -0
  378. package/node_modules/@noble/hashes/blake1.d.ts +106 -0
  379. package/node_modules/@noble/hashes/blake1.d.ts.map +1 -0
  380. package/node_modules/@noble/hashes/blake1.js +459 -0
  381. package/node_modules/@noble/hashes/blake1.js.map +1 -0
  382. package/node_modules/@noble/hashes/blake2.d.ts +116 -0
  383. package/node_modules/@noble/hashes/blake2.d.ts.map +1 -0
  384. package/node_modules/@noble/hashes/blake2.js +420 -0
  385. package/node_modules/@noble/hashes/blake2.js.map +1 -0
  386. package/node_modules/@noble/hashes/blake2b.d.ts +11 -0
  387. package/node_modules/@noble/hashes/blake2b.d.ts.map +1 -0
  388. package/node_modules/@noble/hashes/blake2b.js +14 -0
  389. package/node_modules/@noble/hashes/blake2b.js.map +1 -0
  390. package/node_modules/@noble/hashes/blake2s.d.ts +20 -0
  391. package/node_modules/@noble/hashes/blake2s.d.ts.map +1 -0
  392. package/node_modules/@noble/hashes/blake2s.js +24 -0
  393. package/node_modules/@noble/hashes/blake2s.js.map +1 -0
  394. package/node_modules/@noble/hashes/blake3.d.ts +54 -0
  395. package/node_modules/@noble/hashes/blake3.d.ts.map +1 -0
  396. package/node_modules/@noble/hashes/blake3.js +255 -0
  397. package/node_modules/@noble/hashes/blake3.js.map +1 -0
  398. package/node_modules/@noble/hashes/crypto.d.ts +2 -0
  399. package/node_modules/@noble/hashes/crypto.d.ts.map +1 -0
  400. package/node_modules/@noble/hashes/crypto.js +5 -0
  401. package/node_modules/@noble/hashes/crypto.js.map +1 -0
  402. package/node_modules/@noble/hashes/cryptoNode.d.ts +2 -0
  403. package/node_modules/@noble/hashes/cryptoNode.d.ts.map +1 -0
  404. package/node_modules/@noble/hashes/cryptoNode.js +18 -0
  405. package/node_modules/@noble/hashes/cryptoNode.js.map +1 -0
  406. package/node_modules/@noble/hashes/eskdf.d.ts +47 -0
  407. package/node_modules/@noble/hashes/eskdf.d.ts.map +1 -0
  408. package/node_modules/@noble/hashes/eskdf.js +166 -0
  409. package/node_modules/@noble/hashes/eskdf.js.map +1 -0
  410. package/node_modules/@noble/hashes/esm/_assert.d.ts +17 -0
  411. package/node_modules/@noble/hashes/esm/_assert.d.ts.map +1 -0
  412. package/node_modules/@noble/hashes/esm/_assert.js +15 -0
  413. package/node_modules/@noble/hashes/esm/_assert.js.map +1 -0
  414. package/node_modules/@noble/hashes/esm/_blake.d.ts +14 -0
  415. package/node_modules/@noble/hashes/esm/_blake.d.ts.map +1 -0
  416. package/node_modules/@noble/hashes/esm/_blake.js +45 -0
  417. package/node_modules/@noble/hashes/esm/_blake.js.map +1 -0
  418. package/node_modules/@noble/hashes/esm/_md.d.ts +51 -0
  419. package/node_modules/@noble/hashes/esm/_md.d.ts.map +1 -0
  420. package/node_modules/@noble/hashes/esm/_md.js +155 -0
  421. package/node_modules/@noble/hashes/esm/_md.js.map +1 -0
  422. package/node_modules/@noble/hashes/esm/_u64.d.ts +55 -0
  423. package/node_modules/@noble/hashes/esm/_u64.d.ts.map +1 -0
  424. package/node_modules/@noble/hashes/esm/_u64.js +67 -0
  425. package/node_modules/@noble/hashes/esm/_u64.js.map +1 -0
  426. package/node_modules/@noble/hashes/esm/argon2.d.ts +32 -0
  427. package/node_modules/@noble/hashes/esm/argon2.d.ts.map +1 -0
  428. package/node_modules/@noble/hashes/esm/argon2.js +392 -0
  429. package/node_modules/@noble/hashes/esm/argon2.js.map +1 -0
  430. package/node_modules/@noble/hashes/esm/blake1.d.ts +106 -0
  431. package/node_modules/@noble/hashes/esm/blake1.d.ts.map +1 -0
  432. package/node_modules/@noble/hashes/esm/blake1.js +452 -0
  433. package/node_modules/@noble/hashes/esm/blake1.js.map +1 -0
  434. package/node_modules/@noble/hashes/esm/blake2.d.ts +116 -0
  435. package/node_modules/@noble/hashes/esm/blake2.d.ts.map +1 -0
  436. package/node_modules/@noble/hashes/esm/blake2.js +413 -0
  437. package/node_modules/@noble/hashes/esm/blake2.js.map +1 -0
  438. package/node_modules/@noble/hashes/esm/blake2b.d.ts +11 -0
  439. package/node_modules/@noble/hashes/esm/blake2b.d.ts.map +1 -0
  440. package/node_modules/@noble/hashes/esm/blake2b.js +11 -0
  441. package/node_modules/@noble/hashes/esm/blake2b.js.map +1 -0
  442. package/node_modules/@noble/hashes/esm/blake2s.d.ts +20 -0
  443. package/node_modules/@noble/hashes/esm/blake2s.d.ts.map +1 -0
  444. package/node_modules/@noble/hashes/esm/blake2s.js +21 -0
  445. package/node_modules/@noble/hashes/esm/blake2s.js.map +1 -0
  446. package/node_modules/@noble/hashes/esm/blake3.d.ts +54 -0
  447. package/node_modules/@noble/hashes/esm/blake3.d.ts.map +1 -0
  448. package/node_modules/@noble/hashes/esm/blake3.js +251 -0
  449. package/node_modules/@noble/hashes/esm/blake3.js.map +1 -0
  450. package/node_modules/@noble/hashes/esm/crypto.d.ts +2 -0
  451. package/node_modules/@noble/hashes/esm/crypto.d.ts.map +1 -0
  452. package/node_modules/@noble/hashes/esm/crypto.js +2 -0
  453. package/node_modules/@noble/hashes/esm/crypto.js.map +1 -0
  454. package/node_modules/@noble/hashes/esm/cryptoNode.d.ts +2 -0
  455. package/node_modules/@noble/hashes/esm/cryptoNode.d.ts.map +1 -0
  456. package/node_modules/@noble/hashes/esm/cryptoNode.js +15 -0
  457. package/node_modules/@noble/hashes/esm/cryptoNode.js.map +1 -0
  458. package/node_modules/@noble/hashes/esm/eskdf.d.ts +47 -0
  459. package/node_modules/@noble/hashes/esm/eskdf.d.ts.map +1 -0
  460. package/node_modules/@noble/hashes/esm/eskdf.js +160 -0
  461. package/node_modules/@noble/hashes/esm/eskdf.js.map +1 -0
  462. package/node_modules/@noble/hashes/esm/hkdf.d.ts +36 -0
  463. package/node_modules/@noble/hashes/esm/hkdf.d.ts.map +1 -0
  464. package/node_modules/@noble/hashes/esm/hkdf.js +82 -0
  465. package/node_modules/@noble/hashes/esm/hkdf.js.map +1 -0
  466. package/node_modules/@noble/hashes/esm/hmac.d.ts +35 -0
  467. package/node_modules/@noble/hashes/esm/hmac.d.ts.map +1 -0
  468. package/node_modules/@noble/hashes/esm/hmac.js +86 -0
  469. package/node_modules/@noble/hashes/esm/hmac.js.map +1 -0
  470. package/node_modules/@noble/hashes/esm/index.d.ts +2 -0
  471. package/node_modules/@noble/hashes/esm/index.d.ts.map +1 -0
  472. package/node_modules/@noble/hashes/esm/index.js +33 -0
  473. package/node_modules/@noble/hashes/esm/index.js.map +1 -0
  474. package/node_modules/@noble/hashes/esm/legacy.d.ts +71 -0
  475. package/node_modules/@noble/hashes/esm/legacy.d.ts.map +1 -0
  476. package/node_modules/@noble/hashes/esm/legacy.js +281 -0
  477. package/node_modules/@noble/hashes/esm/legacy.js.map +1 -0
  478. package/node_modules/@noble/hashes/esm/package.json +10 -0
  479. package/node_modules/@noble/hashes/esm/pbkdf2.d.ts +23 -0
  480. package/node_modules/@noble/hashes/esm/pbkdf2.d.ts.map +1 -0
  481. package/node_modules/@noble/hashes/esm/pbkdf2.js +97 -0
  482. package/node_modules/@noble/hashes/esm/pbkdf2.js.map +1 -0
  483. package/node_modules/@noble/hashes/esm/ripemd160.d.ts +13 -0
  484. package/node_modules/@noble/hashes/esm/ripemd160.d.ts.map +1 -0
  485. package/node_modules/@noble/hashes/esm/ripemd160.js +13 -0
  486. package/node_modules/@noble/hashes/esm/ripemd160.js.map +1 -0
  487. package/node_modules/@noble/hashes/esm/scrypt.d.ts +34 -0
  488. package/node_modules/@noble/hashes/esm/scrypt.d.ts.map +1 -0
  489. package/node_modules/@noble/hashes/esm/scrypt.js +228 -0
  490. package/node_modules/@noble/hashes/esm/scrypt.js.map +1 -0
  491. package/node_modules/@noble/hashes/esm/sha1.d.ts +11 -0
  492. package/node_modules/@noble/hashes/esm/sha1.d.ts.map +1 -0
  493. package/node_modules/@noble/hashes/esm/sha1.js +11 -0
  494. package/node_modules/@noble/hashes/esm/sha1.js.map +1 -0
  495. package/node_modules/@noble/hashes/esm/sha2.d.ts +159 -0
  496. package/node_modules/@noble/hashes/esm/sha2.d.ts.map +1 -0
  497. package/node_modules/@noble/hashes/esm/sha2.js +375 -0
  498. package/node_modules/@noble/hashes/esm/sha2.js.map +1 -0
  499. package/node_modules/@noble/hashes/esm/sha256.d.ts +20 -0
  500. package/node_modules/@noble/hashes/esm/sha256.d.ts.map +1 -0
  501. package/node_modules/@noble/hashes/esm/sha256.js +20 -0
  502. package/node_modules/@noble/hashes/esm/sha256.js.map +1 -0
  503. package/node_modules/@noble/hashes/esm/sha3-addons.d.ts +142 -0
  504. package/node_modules/@noble/hashes/esm/sha3-addons.d.ts.map +1 -0
  505. package/node_modules/@noble/hashes/esm/sha3-addons.js +393 -0
  506. package/node_modules/@noble/hashes/esm/sha3-addons.js.map +1 -0
  507. package/node_modules/@noble/hashes/esm/sha3.d.ts +53 -0
  508. package/node_modules/@noble/hashes/esm/sha3.d.ts.map +1 -0
  509. package/node_modules/@noble/hashes/esm/sha3.js +234 -0
  510. package/node_modules/@noble/hashes/esm/sha3.js.map +1 -0
  511. package/node_modules/@noble/hashes/esm/sha512.d.ts +26 -0
  512. package/node_modules/@noble/hashes/esm/sha512.d.ts.map +1 -0
  513. package/node_modules/@noble/hashes/esm/sha512.js +26 -0
  514. package/node_modules/@noble/hashes/esm/sha512.js.map +1 -0
  515. package/node_modules/@noble/hashes/esm/utils.d.ts +161 -0
  516. package/node_modules/@noble/hashes/esm/utils.d.ts.map +1 -0
  517. package/node_modules/@noble/hashes/esm/utils.js +281 -0
  518. package/node_modules/@noble/hashes/esm/utils.js.map +1 -0
  519. package/node_modules/@noble/hashes/hkdf.d.ts +36 -0
  520. package/node_modules/@noble/hashes/hkdf.d.ts.map +1 -0
  521. package/node_modules/@noble/hashes/hkdf.js +88 -0
  522. package/node_modules/@noble/hashes/hkdf.js.map +1 -0
  523. package/node_modules/@noble/hashes/hmac.d.ts +35 -0
  524. package/node_modules/@noble/hashes/hmac.d.ts.map +1 -0
  525. package/node_modules/@noble/hashes/hmac.js +91 -0
  526. package/node_modules/@noble/hashes/hmac.js.map +1 -0
  527. package/node_modules/@noble/hashes/index.d.ts +1 -0
  528. package/node_modules/@noble/hashes/index.d.ts.map +1 -0
  529. package/node_modules/@noble/hashes/index.js +33 -0
  530. package/node_modules/@noble/hashes/index.js.map +1 -0
  531. package/node_modules/@noble/hashes/legacy.d.ts +71 -0
  532. package/node_modules/@noble/hashes/legacy.d.ts.map +1 -0
  533. package/node_modules/@noble/hashes/legacy.js +287 -0
  534. package/node_modules/@noble/hashes/legacy.js.map +1 -0
  535. package/node_modules/@noble/hashes/package.json +266 -0
  536. package/node_modules/@noble/hashes/pbkdf2.d.ts +23 -0
  537. package/node_modules/@noble/hashes/pbkdf2.d.ts.map +1 -0
  538. package/node_modules/@noble/hashes/pbkdf2.js +101 -0
  539. package/node_modules/@noble/hashes/pbkdf2.js.map +1 -0
  540. package/node_modules/@noble/hashes/ripemd160.d.ts +13 -0
  541. package/node_modules/@noble/hashes/ripemd160.d.ts.map +1 -0
  542. package/node_modules/@noble/hashes/ripemd160.js +16 -0
  543. package/node_modules/@noble/hashes/ripemd160.js.map +1 -0
  544. package/node_modules/@noble/hashes/scrypt.d.ts +34 -0
  545. package/node_modules/@noble/hashes/scrypt.d.ts.map +1 -0
  546. package/node_modules/@noble/hashes/scrypt.js +232 -0
  547. package/node_modules/@noble/hashes/scrypt.js.map +1 -0
  548. package/node_modules/@noble/hashes/sha1.d.ts +11 -0
  549. package/node_modules/@noble/hashes/sha1.d.ts.map +1 -0
  550. package/node_modules/@noble/hashes/sha1.js +14 -0
  551. package/node_modules/@noble/hashes/sha1.js.map +1 -0
  552. package/node_modules/@noble/hashes/sha2.d.ts +159 -0
  553. package/node_modules/@noble/hashes/sha2.d.ts.map +1 -0
  554. package/node_modules/@noble/hashes/sha2.js +384 -0
  555. package/node_modules/@noble/hashes/sha2.js.map +1 -0
  556. package/node_modules/@noble/hashes/sha256.d.ts +20 -0
  557. package/node_modules/@noble/hashes/sha256.d.ts.map +1 -0
  558. package/node_modules/@noble/hashes/sha256.js +23 -0
  559. package/node_modules/@noble/hashes/sha256.js.map +1 -0
  560. package/node_modules/@noble/hashes/sha3-addons.d.ts +142 -0
  561. package/node_modules/@noble/hashes/sha3-addons.d.ts.map +1 -0
  562. package/node_modules/@noble/hashes/sha3-addons.js +402 -0
  563. package/node_modules/@noble/hashes/sha3-addons.js.map +1 -0
  564. package/node_modules/@noble/hashes/sha3.d.ts +53 -0
  565. package/node_modules/@noble/hashes/sha3.d.ts.map +1 -0
  566. package/node_modules/@noble/hashes/sha3.js +239 -0
  567. package/node_modules/@noble/hashes/sha3.js.map +1 -0
  568. package/node_modules/@noble/hashes/sha512.d.ts +26 -0
  569. package/node_modules/@noble/hashes/sha512.d.ts.map +1 -0
  570. package/node_modules/@noble/hashes/sha512.js +29 -0
  571. package/node_modules/@noble/hashes/sha512.js.map +1 -0
  572. package/node_modules/@noble/hashes/src/_assert.ts +22 -0
  573. package/node_modules/@noble/hashes/src/_blake.ts +50 -0
  574. package/node_modules/@noble/hashes/src/_md.ts +176 -0
  575. package/node_modules/@noble/hashes/src/_u64.ts +91 -0
  576. package/node_modules/@noble/hashes/src/argon2.ts +497 -0
  577. package/node_modules/@noble/hashes/src/blake1.ts +534 -0
  578. package/node_modules/@noble/hashes/src/blake2.ts +486 -0
  579. package/node_modules/@noble/hashes/src/blake2b.ts +10 -0
  580. package/node_modules/@noble/hashes/src/blake2s.ts +20 -0
  581. package/node_modules/@noble/hashes/src/blake3.ts +272 -0
  582. package/node_modules/@noble/hashes/src/crypto.ts +9 -0
  583. package/node_modules/@noble/hashes/src/cryptoNode.ts +15 -0
  584. package/node_modules/@noble/hashes/src/eskdf.ts +187 -0
  585. package/node_modules/@noble/hashes/src/hkdf.ts +88 -0
  586. package/node_modules/@noble/hashes/src/hmac.ts +94 -0
  587. package/node_modules/@noble/hashes/src/index.ts +31 -0
  588. package/node_modules/@noble/hashes/src/legacy.ts +293 -0
  589. package/node_modules/@noble/hashes/src/pbkdf2.ts +122 -0
  590. package/node_modules/@noble/hashes/src/ripemd160.ts +12 -0
  591. package/node_modules/@noble/hashes/src/scrypt.ts +257 -0
  592. package/node_modules/@noble/hashes/src/sha1.ts +10 -0
  593. package/node_modules/@noble/hashes/src/sha2.ts +402 -0
  594. package/node_modules/@noble/hashes/src/sha256.ts +24 -0
  595. package/node_modules/@noble/hashes/src/sha3-addons.ts +499 -0
  596. package/node_modules/@noble/hashes/src/sha3.ts +258 -0
  597. package/node_modules/@noble/hashes/src/sha512.ts +34 -0
  598. package/node_modules/@noble/hashes/src/utils.ts +395 -0
  599. package/node_modules/@noble/hashes/utils.d.ts +161 -0
  600. package/node_modules/@noble/hashes/utils.d.ts.map +1 -0
  601. package/node_modules/@noble/hashes/utils.js +313 -0
  602. package/node_modules/@noble/hashes/utils.js.map +1 -0
  603. package/package.json +203 -0
  604. package/schemas/catalog.schema.json +283 -0
  605. package/src/align.ts +235 -0
  606. package/src/audio-init-parser.ts +189 -0
  607. package/src/audio-ring-buffer.ts +120 -0
  608. package/src/authored-timing.ts +63 -0
  609. package/src/carp-catalog.ts +776 -0
  610. package/src/catalog-fec-params.ts +167 -0
  611. package/src/catalog-network-source.ts +49 -0
  612. package/src/catalog-validator.ts +34 -0
  613. package/src/cmaf-block-assembler.ts +1058 -0
  614. package/src/cmaf-group-batcher.ts +104 -0
  615. package/src/cmcd-producer.ts +329 -0
  616. package/src/codec-utils.ts +1539 -0
  617. package/src/fec-codec.ts +61 -0
  618. package/src/fec-manager.ts +1939 -0
  619. package/src/fec-starvation-detector.ts +128 -0
  620. package/src/fec-worker-setup.ts +177 -0
  621. package/src/fmp4-completion.ts +47 -0
  622. package/src/fmp4-reader.ts +112 -0
  623. package/src/index.ts +443 -0
  624. package/src/iso-bmff-timing.ts +688 -0
  625. package/src/loc.ts +181 -0
  626. package/src/manifest-auth-plan.ts +107 -0
  627. package/src/media-router.ts +1185 -0
  628. package/src/mfu-reassembler.ts +2842 -0
  629. package/src/mfu-reassembly-policy.ts +134 -0
  630. package/src/mmtp-container-parser.ts +1498 -0
  631. package/src/mmtp-decode-pipeline.ts +315 -0
  632. package/src/mmtp-router.ts +3027 -0
  633. package/src/mmtp-to-cmaf.ts +956 -0
  634. package/src/multicast-auth-catalog.ts +340 -0
  635. package/src/multicast-input.ts +439 -0
  636. package/src/multicast-manager.ts +1503 -0
  637. package/src/multicast-transport.ts +320 -0
  638. package/src/multicast-unwrap.ts +132 -0
  639. package/src/no-modules.ts +20 -0
  640. package/src/phase14-catalog-override.ts +336 -0
  641. package/src/repair-fetch.ts +217 -0
  642. package/src/sample-combiner.ts +846 -0
  643. package/src/signaling.ts +78 -0
  644. package/src/source-auth.ts +1 -0
  645. package/src/switching-set-alignment.ts +109 -0
  646. package/src/timestamp-codec.ts +265 -0
  647. package/src/track-pipeline-setup.ts +189 -0
  648. package/src/track-pipeline.ts +332 -0
  649. package/src/track-session.ts +778 -0
  650. package/src/transport-pool.ts +128 -0
  651. package/src/wasm-mfu-reassembler.ts +372 -0
  652. package/src/wasm-mmtp-container-parser.ts +23 -0
  653. package/test-vectors/align.json +199 -0
  654. package/test-vectors/catalog/README.md +25 -0
  655. package/test-vectors/catalog/negative/legacy-selection-params.json +15 -0
  656. package/test-vectors/catalog/negative/missing-mmtp-fields.json +12 -0
  657. package/test-vectors/catalog/negative/multicast-auth-padded-key.json +37 -0
  658. package/test-vectors/catalog/negative/multicast-auth-reused-track-format.json +53 -0
  659. package/test-vectors/catalog/negative/multicast-auth-trailing-pad-bits.json +37 -0
  660. package/test-vectors/catalog/negative/multicast-endpoint-missing-protocol-and-source.json +24 -0
  661. package/test-vectors/catalog/negative/network-source-object.json +25 -0
  662. package/test-vectors/catalog/negative/raptorq-unaligned-symbol.json +26 -0
  663. package/test-vectors/catalog/negative/repair-track-legacy-shape.json +18 -0
  664. package/test-vectors/catalog/negative/track-role-empty.json +16 -0
  665. package/test-vectors/catalog/negative/track-role-non-string.json +16 -0
  666. package/test-vectors/catalog/positive/fec-multicast.json +51 -0
  667. package/test-vectors/catalog/positive/flat-av.json +30 -0
  668. package/test-vectors/catalog/positive/multicast-auth-rotation.json +55 -0
  669. package/test-vectors/catalog/positive/ticks-and-mixed-timescales.json +39 -0
  670. package/test-vectors/catalog/positive/track-role.json +49 -0
  671. package/test-vectors/catalog/releases/moqcast-native-v16-v1/catalog.json +65 -0
  672. package/test-vectors/catalog/releases/moqcast-native-v16-v1.archive.sha256 +1 -0
  673. package/test-vectors/catalog-multicast-auth-v1.json +26 -0
  674. package/test-vectors/catalog-validation.json +148 -0
  675. package/test-vectors/catalog-validator-public-api.mjs +25 -0
  676. package/test-vectors/generate-source-auth-fixture.mjs +114 -0
  677. package/test-vectors/source-auth-v1.json +61 -0
  678. package/test-vectors/subsample-placement-v1.json +230 -0
@@ -0,0 +1,1267 @@
1
+ var __typeError = (msg) => {
2
+ throw TypeError(msg);
3
+ };
4
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
5
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
7
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
8
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
9
+
10
+ // ../mmt-manifest-verify/node_modules/@noble/hashes/esm/utils.js
11
+ function isBytes(a) {
12
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
13
+ }
14
+ function anumber(n) {
15
+ if (!Number.isSafeInteger(n) || n < 0)
16
+ throw new Error("positive integer expected, got " + n);
17
+ }
18
+ function abytes(b, ...lengths) {
19
+ if (!isBytes(b))
20
+ throw new Error("Uint8Array expected");
21
+ if (lengths.length > 0 && !lengths.includes(b.length))
22
+ throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
23
+ }
24
+ function aexists(instance, checkFinished = true) {
25
+ if (instance.destroyed)
26
+ throw new Error("Hash instance has been destroyed");
27
+ if (checkFinished && instance.finished)
28
+ throw new Error("Hash#digest() has already been called");
29
+ }
30
+ function aoutput(out, instance) {
31
+ abytes(out);
32
+ const min = instance.outputLen;
33
+ if (out.length < min) {
34
+ throw new Error("digestInto() expects output buffer of length at least " + min);
35
+ }
36
+ }
37
+ function u8(arr) {
38
+ return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
39
+ }
40
+ function u32(arr) {
41
+ return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
42
+ }
43
+ function clean(...arrays) {
44
+ for (let i = 0; i < arrays.length; i++) {
45
+ arrays[i].fill(0);
46
+ }
47
+ }
48
+ function rotr(word, shift) {
49
+ return word << 32 - shift | word >>> shift;
50
+ }
51
+ var isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
52
+ function byteSwap(word) {
53
+ return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
54
+ }
55
+ var swap8IfBE = isLE ? (n) => n : (n) => byteSwap(n);
56
+ function byteSwap32(arr) {
57
+ for (let i = 0; i < arr.length; i++) {
58
+ arr[i] = byteSwap(arr[i]);
59
+ }
60
+ return arr;
61
+ }
62
+ var swap32IfBE = isLE ? (u) => u : byteSwap32;
63
+ function utf8ToBytes(str) {
64
+ if (typeof str !== "string")
65
+ throw new Error("string expected");
66
+ return new Uint8Array(new TextEncoder().encode(str));
67
+ }
68
+ function toBytes(data) {
69
+ if (typeof data === "string")
70
+ data = utf8ToBytes(data);
71
+ abytes(data);
72
+ return data;
73
+ }
74
+ var Hash = class {
75
+ };
76
+ function createXOFer(hashCons) {
77
+ const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
78
+ const tmp = hashCons({});
79
+ hashC.outputLen = tmp.outputLen;
80
+ hashC.blockLen = tmp.blockLen;
81
+ hashC.create = (opts) => hashCons(opts);
82
+ return hashC;
83
+ }
84
+
85
+ // ../mmt-manifest-verify/node_modules/@noble/hashes/esm/_md.js
86
+ var SHA256_IV = /* @__PURE__ */ Uint32Array.from([
87
+ 1779033703,
88
+ 3144134277,
89
+ 1013904242,
90
+ 2773480762,
91
+ 1359893119,
92
+ 2600822924,
93
+ 528734635,
94
+ 1541459225
95
+ ]);
96
+
97
+ // ../mmt-manifest-verify/node_modules/@noble/hashes/esm/_u64.js
98
+ var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
99
+ var _32n = /* @__PURE__ */ BigInt(32);
100
+ function fromBig(n, le = false) {
101
+ if (le)
102
+ return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
103
+ return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
104
+ }
105
+
106
+ // ../mmt-manifest-verify/node_modules/@noble/hashes/esm/_blake.js
107
+ function G1s(a, b, c, d, x) {
108
+ a = a + b + x | 0;
109
+ d = rotr(d ^ a, 16);
110
+ c = c + d | 0;
111
+ b = rotr(b ^ c, 12);
112
+ return { a, b, c, d };
113
+ }
114
+ function G2s(a, b, c, d, x) {
115
+ a = a + b + x | 0;
116
+ d = rotr(d ^ a, 8);
117
+ c = c + d | 0;
118
+ b = rotr(b ^ c, 7);
119
+ return { a, b, c, d };
120
+ }
121
+
122
+ // ../mmt-manifest-verify/node_modules/@noble/hashes/esm/blake2.js
123
+ var BLAKE2 = class extends Hash {
124
+ constructor(blockLen, outputLen) {
125
+ super();
126
+ this.finished = false;
127
+ this.destroyed = false;
128
+ this.length = 0;
129
+ this.pos = 0;
130
+ anumber(blockLen);
131
+ anumber(outputLen);
132
+ this.blockLen = blockLen;
133
+ this.outputLen = outputLen;
134
+ this.buffer = new Uint8Array(blockLen);
135
+ this.buffer32 = u32(this.buffer);
136
+ }
137
+ update(data) {
138
+ aexists(this);
139
+ data = toBytes(data);
140
+ abytes(data);
141
+ const { blockLen, buffer, buffer32 } = this;
142
+ const len = data.length;
143
+ const offset = data.byteOffset;
144
+ const buf = data.buffer;
145
+ for (let pos = 0; pos < len; ) {
146
+ if (this.pos === blockLen) {
147
+ swap32IfBE(buffer32);
148
+ this.compress(buffer32, 0, false);
149
+ swap32IfBE(buffer32);
150
+ this.pos = 0;
151
+ }
152
+ const take = Math.min(blockLen - this.pos, len - pos);
153
+ const dataOffset = offset + pos;
154
+ if (take === blockLen && !(dataOffset % 4) && pos + take < len) {
155
+ const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4));
156
+ swap32IfBE(data32);
157
+ for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) {
158
+ this.length += blockLen;
159
+ this.compress(data32, pos32, false);
160
+ }
161
+ swap32IfBE(data32);
162
+ continue;
163
+ }
164
+ buffer.set(data.subarray(pos, pos + take), this.pos);
165
+ this.pos += take;
166
+ this.length += take;
167
+ pos += take;
168
+ }
169
+ return this;
170
+ }
171
+ digestInto(out) {
172
+ aexists(this);
173
+ aoutput(out, this);
174
+ const { pos, buffer32 } = this;
175
+ this.finished = true;
176
+ clean(this.buffer.subarray(pos));
177
+ swap32IfBE(buffer32);
178
+ this.compress(buffer32, 0, true);
179
+ swap32IfBE(buffer32);
180
+ const out32 = u32(out);
181
+ this.get().forEach((v, i) => out32[i] = swap8IfBE(v));
182
+ }
183
+ digest() {
184
+ const { buffer, outputLen } = this;
185
+ this.digestInto(buffer);
186
+ const res = buffer.slice(0, outputLen);
187
+ this.destroy();
188
+ return res;
189
+ }
190
+ _cloneInto(to) {
191
+ const { buffer, length, finished, destroyed, outputLen, pos } = this;
192
+ to || (to = new this.constructor({ dkLen: outputLen }));
193
+ to.set(...this.get());
194
+ to.buffer.set(buffer);
195
+ to.destroyed = destroyed;
196
+ to.finished = finished;
197
+ to.length = length;
198
+ to.pos = pos;
199
+ to.outputLen = outputLen;
200
+ return to;
201
+ }
202
+ clone() {
203
+ return this._cloneInto();
204
+ }
205
+ };
206
+ function compress(s, offset, msg, rounds, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) {
207
+ let j = 0;
208
+ for (let i = 0; i < rounds; i++) {
209
+ ({ a: v0, b: v4, c: v8, d: v12 } = G1s(v0, v4, v8, v12, msg[offset + s[j++]]));
210
+ ({ a: v0, b: v4, c: v8, d: v12 } = G2s(v0, v4, v8, v12, msg[offset + s[j++]]));
211
+ ({ a: v1, b: v5, c: v9, d: v13 } = G1s(v1, v5, v9, v13, msg[offset + s[j++]]));
212
+ ({ a: v1, b: v5, c: v9, d: v13 } = G2s(v1, v5, v9, v13, msg[offset + s[j++]]));
213
+ ({ a: v2, b: v6, c: v10, d: v14 } = G1s(v2, v6, v10, v14, msg[offset + s[j++]]));
214
+ ({ a: v2, b: v6, c: v10, d: v14 } = G2s(v2, v6, v10, v14, msg[offset + s[j++]]));
215
+ ({ a: v3, b: v7, c: v11, d: v15 } = G1s(v3, v7, v11, v15, msg[offset + s[j++]]));
216
+ ({ a: v3, b: v7, c: v11, d: v15 } = G2s(v3, v7, v11, v15, msg[offset + s[j++]]));
217
+ ({ a: v0, b: v5, c: v10, d: v15 } = G1s(v0, v5, v10, v15, msg[offset + s[j++]]));
218
+ ({ a: v0, b: v5, c: v10, d: v15 } = G2s(v0, v5, v10, v15, msg[offset + s[j++]]));
219
+ ({ a: v1, b: v6, c: v11, d: v12 } = G1s(v1, v6, v11, v12, msg[offset + s[j++]]));
220
+ ({ a: v1, b: v6, c: v11, d: v12 } = G2s(v1, v6, v11, v12, msg[offset + s[j++]]));
221
+ ({ a: v2, b: v7, c: v8, d: v13 } = G1s(v2, v7, v8, v13, msg[offset + s[j++]]));
222
+ ({ a: v2, b: v7, c: v8, d: v13 } = G2s(v2, v7, v8, v13, msg[offset + s[j++]]));
223
+ ({ a: v3, b: v4, c: v9, d: v14 } = G1s(v3, v4, v9, v14, msg[offset + s[j++]]));
224
+ ({ a: v3, b: v4, c: v9, d: v14 } = G2s(v3, v4, v9, v14, msg[offset + s[j++]]));
225
+ }
226
+ return { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 };
227
+ }
228
+
229
+ // ../mmt-manifest-verify/node_modules/@noble/hashes/esm/blake3.js
230
+ var B3_Flags = {
231
+ CHUNK_START: 1,
232
+ CHUNK_END: 2,
233
+ PARENT: 4,
234
+ ROOT: 8,
235
+ KEYED_HASH: 16,
236
+ DERIVE_KEY_CONTEXT: 32,
237
+ DERIVE_KEY_MATERIAL: 64
238
+ };
239
+ var B3_IV = SHA256_IV.slice();
240
+ var B3_SIGMA = /* @__PURE__ */ (() => {
241
+ const Id = Array.from({ length: 16 }, (_, i) => i);
242
+ const permute = (arr) => [2, 6, 3, 10, 7, 0, 4, 13, 1, 11, 12, 5, 9, 14, 15, 8].map((i) => arr[i]);
243
+ const res = [];
244
+ for (let i = 0, v = Id; i < 7; i++, v = permute(v))
245
+ res.push(...v);
246
+ return Uint8Array.from(res);
247
+ })();
248
+ var BLAKE3 = class _BLAKE3 extends BLAKE2 {
249
+ constructor(opts = {}, flags = 0) {
250
+ super(64, opts.dkLen === void 0 ? 32 : opts.dkLen);
251
+ this.chunkPos = 0;
252
+ this.chunksDone = 0;
253
+ this.flags = 0 | 0;
254
+ this.stack = [];
255
+ this.posOut = 0;
256
+ this.bufferOut32 = new Uint32Array(16);
257
+ this.chunkOut = 0;
258
+ this.enableXOF = true;
259
+ const { key, context } = opts;
260
+ const hasContext = context !== void 0;
261
+ if (key !== void 0) {
262
+ if (hasContext)
263
+ throw new Error('Only "key" or "context" can be specified at same time');
264
+ const k = toBytes(key).slice();
265
+ abytes(k, 32);
266
+ this.IV = u32(k);
267
+ swap32IfBE(this.IV);
268
+ this.flags = flags | B3_Flags.KEYED_HASH;
269
+ } else if (hasContext) {
270
+ const ctx = toBytes(context);
271
+ const contextKey = new _BLAKE3({ dkLen: 32 }, B3_Flags.DERIVE_KEY_CONTEXT).update(ctx).digest();
272
+ this.IV = u32(contextKey);
273
+ swap32IfBE(this.IV);
274
+ this.flags = flags | B3_Flags.DERIVE_KEY_MATERIAL;
275
+ } else {
276
+ this.IV = B3_IV.slice();
277
+ this.flags = flags;
278
+ }
279
+ this.state = this.IV.slice();
280
+ this.bufferOut = u8(this.bufferOut32);
281
+ }
282
+ // Unused
283
+ get() {
284
+ return [];
285
+ }
286
+ set() {
287
+ }
288
+ b2Compress(counter, flags, buf, bufPos = 0) {
289
+ const { state: s, pos } = this;
290
+ const { h, l } = fromBig(BigInt(counter), true);
291
+ const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = compress(B3_SIGMA, bufPos, buf, 7, s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], B3_IV[0], B3_IV[1], B3_IV[2], B3_IV[3], h, l, pos, flags);
292
+ s[0] = v0 ^ v8;
293
+ s[1] = v1 ^ v9;
294
+ s[2] = v2 ^ v10;
295
+ s[3] = v3 ^ v11;
296
+ s[4] = v4 ^ v12;
297
+ s[5] = v5 ^ v13;
298
+ s[6] = v6 ^ v14;
299
+ s[7] = v7 ^ v15;
300
+ }
301
+ compress(buf, bufPos = 0, isLast = false) {
302
+ let flags = this.flags;
303
+ if (!this.chunkPos)
304
+ flags |= B3_Flags.CHUNK_START;
305
+ if (this.chunkPos === 15 || isLast)
306
+ flags |= B3_Flags.CHUNK_END;
307
+ if (!isLast)
308
+ this.pos = this.blockLen;
309
+ this.b2Compress(this.chunksDone, flags, buf, bufPos);
310
+ this.chunkPos += 1;
311
+ if (this.chunkPos === 16 || isLast) {
312
+ let chunk = this.state;
313
+ this.state = this.IV.slice();
314
+ for (let last, chunks = this.chunksDone + 1; isLast || !(chunks & 1); chunks >>= 1) {
315
+ if (!(last = this.stack.pop()))
316
+ break;
317
+ this.buffer32.set(last, 0);
318
+ this.buffer32.set(chunk, 8);
319
+ this.pos = this.blockLen;
320
+ this.b2Compress(0, this.flags | B3_Flags.PARENT, this.buffer32, 0);
321
+ chunk = this.state;
322
+ this.state = this.IV.slice();
323
+ }
324
+ this.chunksDone++;
325
+ this.chunkPos = 0;
326
+ this.stack.push(chunk);
327
+ }
328
+ this.pos = 0;
329
+ }
330
+ _cloneInto(to) {
331
+ to = super._cloneInto(to);
332
+ const { IV, flags, state, chunkPos, posOut, chunkOut, stack, chunksDone } = this;
333
+ to.state.set(state.slice());
334
+ to.stack = stack.map((i) => Uint32Array.from(i));
335
+ to.IV.set(IV);
336
+ to.flags = flags;
337
+ to.chunkPos = chunkPos;
338
+ to.chunksDone = chunksDone;
339
+ to.posOut = posOut;
340
+ to.chunkOut = chunkOut;
341
+ to.enableXOF = this.enableXOF;
342
+ to.bufferOut32.set(this.bufferOut32);
343
+ return to;
344
+ }
345
+ destroy() {
346
+ this.destroyed = true;
347
+ clean(this.state, this.buffer32, this.IV, this.bufferOut32);
348
+ clean(...this.stack);
349
+ }
350
+ // Same as b2Compress, but doesn't modify state and returns 16 u32 array (instead of 8)
351
+ b2CompressOut() {
352
+ const { state: s, pos, flags, buffer32, bufferOut32: out32 } = this;
353
+ const { h, l } = fromBig(BigInt(this.chunkOut++));
354
+ swap32IfBE(buffer32);
355
+ const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = compress(B3_SIGMA, 0, buffer32, 7, s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], B3_IV[0], B3_IV[1], B3_IV[2], B3_IV[3], l, h, pos, flags);
356
+ out32[0] = v0 ^ v8;
357
+ out32[1] = v1 ^ v9;
358
+ out32[2] = v2 ^ v10;
359
+ out32[3] = v3 ^ v11;
360
+ out32[4] = v4 ^ v12;
361
+ out32[5] = v5 ^ v13;
362
+ out32[6] = v6 ^ v14;
363
+ out32[7] = v7 ^ v15;
364
+ out32[8] = s[0] ^ v8;
365
+ out32[9] = s[1] ^ v9;
366
+ out32[10] = s[2] ^ v10;
367
+ out32[11] = s[3] ^ v11;
368
+ out32[12] = s[4] ^ v12;
369
+ out32[13] = s[5] ^ v13;
370
+ out32[14] = s[6] ^ v14;
371
+ out32[15] = s[7] ^ v15;
372
+ swap32IfBE(buffer32);
373
+ swap32IfBE(out32);
374
+ this.posOut = 0;
375
+ }
376
+ finish() {
377
+ if (this.finished)
378
+ return;
379
+ this.finished = true;
380
+ clean(this.buffer.subarray(this.pos));
381
+ let flags = this.flags | B3_Flags.ROOT;
382
+ if (this.stack.length) {
383
+ flags |= B3_Flags.PARENT;
384
+ swap32IfBE(this.buffer32);
385
+ this.compress(this.buffer32, 0, true);
386
+ swap32IfBE(this.buffer32);
387
+ this.chunksDone = 0;
388
+ this.pos = this.blockLen;
389
+ } else {
390
+ flags |= (!this.chunkPos ? B3_Flags.CHUNK_START : 0) | B3_Flags.CHUNK_END;
391
+ }
392
+ this.flags = flags;
393
+ this.b2CompressOut();
394
+ }
395
+ writeInto(out) {
396
+ aexists(this, false);
397
+ abytes(out);
398
+ this.finish();
399
+ const { blockLen, bufferOut } = this;
400
+ for (let pos = 0, len = out.length; pos < len; ) {
401
+ if (this.posOut >= blockLen)
402
+ this.b2CompressOut();
403
+ const take = Math.min(blockLen - this.posOut, len - pos);
404
+ out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
405
+ this.posOut += take;
406
+ pos += take;
407
+ }
408
+ return out;
409
+ }
410
+ xofInto(out) {
411
+ if (!this.enableXOF)
412
+ throw new Error("XOF is not possible after digest call");
413
+ return this.writeInto(out);
414
+ }
415
+ xof(bytes) {
416
+ anumber(bytes);
417
+ return this.xofInto(new Uint8Array(bytes));
418
+ }
419
+ digestInto(out) {
420
+ aoutput(out, this);
421
+ if (this.finished)
422
+ throw new Error("digest() was already called");
423
+ this.enableXOF = false;
424
+ this.writeInto(out);
425
+ this.destroy();
426
+ return out;
427
+ }
428
+ digest() {
429
+ return this.digestInto(new Uint8Array(this.outputLen));
430
+ }
431
+ };
432
+ var blake3 = /* @__PURE__ */ createXOFer((opts) => new BLAKE3(opts));
433
+
434
+ // ../mmt-manifest-verify/dist/source-auth.js
435
+ var SOURCE_AUTH_MANIFEST_VERSION = 1;
436
+ var SOURCE_AUTH_OBJECT_ENTRY_FRAME = 1;
437
+ var SOURCE_AUTH_GROUP_CLOSE_FRAME = 2;
438
+ var SOURCE_AUTH_OBJECT_ENTRY_LENGTH = 52;
439
+ var SOURCE_AUTH_GROUP_CLOSE_LENGTH = 112;
440
+ var SOURCE_AUTH_MAX_OBJECTS_PER_GROUP = 4096;
441
+ var SOURCE_AUTH_MAX_TRUE_LENGTH = 16 * 1024 * 1024;
442
+ var SOURCE_AUTH_SCOPE_LENGTH = 32;
443
+ var SIGNATURE_DOMAIN = new TextEncoder().encode("blockcast-mmt-root-v1\0\0\0");
444
+ function requireBytes(name, value, length) {
445
+ if (value.byteLength !== length) {
446
+ throw new Error(`${name} must be ${length} bytes, got ${value.byteLength}`);
447
+ }
448
+ }
449
+ function requireU32(name, value) {
450
+ if (!Number.isInteger(value) || value < 0 || value > 4294967295) {
451
+ throw new Error(`${name} must be an unsigned 32-bit integer`);
452
+ }
453
+ }
454
+ function requireU64(name, value) {
455
+ if (value < 0n || value > 0xffffffffffffffffn) {
456
+ throw new Error(`${name} must be an unsigned 64-bit integer`);
457
+ }
458
+ }
459
+ function requireTrueLength(value) {
460
+ requireU32("trueLength", value);
461
+ if (value > SOURCE_AUTH_MAX_TRUE_LENGTH) {
462
+ throw new Error(`trueLength exceeds the ${SOURCE_AUTH_MAX_TRUE_LENGTH}-byte profile maximum`);
463
+ }
464
+ }
465
+ function sourceAuthObjectDigest(object) {
466
+ return blake3(object);
467
+ }
468
+ function sourceAuthLeafHash(groupId, objectId, digest, trueLength) {
469
+ requireU64("groupId", groupId);
470
+ requireU32("objectId", objectId);
471
+ requireBytes("digest", digest, 32);
472
+ requireTrueLength(trueLength);
473
+ const preimage = new Uint8Array(49);
474
+ const view = new DataView(preimage.buffer);
475
+ view.setBigUint64(1, groupId);
476
+ view.setUint32(9, objectId);
477
+ preimage.set(digest, 13);
478
+ view.setUint32(45, trueLength);
479
+ return blake3(preimage);
480
+ }
481
+ function sourceAuthMerkleRoot(entries) {
482
+ if (entries.length === 0)
483
+ throw new Error("Merkle tree requires at least one object");
484
+ if (entries.length > SOURCE_AUTH_MAX_OBJECTS_PER_GROUP) {
485
+ throw new Error(`group exceeds ${SOURCE_AUTH_MAX_OBJECTS_PER_GROUP} objects`);
486
+ }
487
+ const groupId = entries[0].groupId;
488
+ const objectIds = /* @__PURE__ */ new Set();
489
+ const ordered = [...entries].sort((left, right) => left.objectId - right.objectId);
490
+ let level = ordered.map((entry) => {
491
+ if (entry.groupId !== groupId)
492
+ throw new Error("Merkle entries must belong to one group");
493
+ if (objectIds.has(entry.objectId))
494
+ throw new Error(`duplicate objectId ${entry.objectId}`);
495
+ objectIds.add(entry.objectId);
496
+ return sourceAuthLeafHash(entry.groupId, entry.objectId, entry.digest, entry.trueLength);
497
+ });
498
+ while (level.length > 1) {
499
+ const parents = [];
500
+ for (let index = 0; index < level.length; index += 2) {
501
+ const left = level[index];
502
+ const right = level[index + 1] ?? left;
503
+ const preimage = new Uint8Array(65);
504
+ preimage[0] = 1;
505
+ preimage.set(left, 1);
506
+ preimage.set(right, 33);
507
+ parents.push(blake3(preimage));
508
+ }
509
+ level = parents;
510
+ }
511
+ return level[0];
512
+ }
513
+ function sourceAuthSignaturePreimage(authScope, groupId, objectCount, root) {
514
+ requireU32("objectCount", objectCount);
515
+ if (objectCount === 0 || objectCount > SOURCE_AUTH_MAX_OBJECTS_PER_GROUP) {
516
+ throw new Error(`objectCount must be between 1 and ${SOURCE_AUTH_MAX_OBJECTS_PER_GROUP}`);
517
+ }
518
+ requireU64("groupId", groupId);
519
+ requireBytes("authScope", authScope, SOURCE_AUTH_SCOPE_LENGTH);
520
+ requireBytes("root", root, 32);
521
+ const preimage = new Uint8Array(100);
522
+ const view = new DataView(preimage.buffer);
523
+ preimage.set(SIGNATURE_DOMAIN);
524
+ preimage.set(authScope, 24);
525
+ view.setBigUint64(56, groupId);
526
+ view.setUint32(64, objectCount);
527
+ preimage.set(root, 68);
528
+ return preimage;
529
+ }
530
+ function decodeSourceAuthManifestFrame(frame) {
531
+ const frameType = frame[0];
532
+ const expectedLength = frameType === SOURCE_AUTH_OBJECT_ENTRY_FRAME ? SOURCE_AUTH_OBJECT_ENTRY_LENGTH : frameType === SOURCE_AUTH_GROUP_CLOSE_FRAME ? SOURCE_AUTH_GROUP_CLOSE_LENGTH : 0;
533
+ if (expectedLength === 0)
534
+ throw new Error(`unsupported manifest frame type ${frameType}`);
535
+ if (frame.byteLength !== expectedLength) {
536
+ throw new Error(`manifest frame has invalid length ${frame.byteLength} for type ${frameType}`);
537
+ }
538
+ if (frame[1] !== SOURCE_AUTH_MANIFEST_VERSION) {
539
+ throw new Error(`unsupported manifest version ${frame[1]}`);
540
+ }
541
+ if (frame[2] !== 0 || frame[3] !== 0)
542
+ throw new Error("manifest reserved bits must be zero");
543
+ const view = new DataView(frame.buffer, frame.byteOffset, frame.byteLength);
544
+ const groupId = view.getBigUint64(4);
545
+ if (frameType === SOURCE_AUTH_OBJECT_ENTRY_FRAME) {
546
+ const entry = {
547
+ kind: "object",
548
+ groupId,
549
+ objectId: view.getUint32(12),
550
+ trueLength: view.getUint32(16),
551
+ digest: frame.slice(20, 52)
552
+ };
553
+ requireTrueLength(entry.trueLength);
554
+ return entry;
555
+ }
556
+ const close = {
557
+ kind: "close",
558
+ groupId,
559
+ objectCount: view.getUint32(12),
560
+ root: frame.slice(16, 48),
561
+ signature: frame.slice(48, 112)
562
+ };
563
+ if (close.objectCount === 0 || close.objectCount > SOURCE_AUTH_MAX_OBJECTS_PER_GROUP) {
564
+ throw new Error(`objectCount must be between 1 and ${SOURCE_AUTH_MAX_OBJECTS_PER_GROUP}`);
565
+ }
566
+ return close;
567
+ }
568
+
569
+ // ../mmt-manifest-verify/dist/verifier.js
570
+ function manifestBindingId(trackName, sourceSymbolFormat) {
571
+ return JSON.stringify([trackName, sourceSymbolFormat]);
572
+ }
573
+ var FAILURE_REASONS = [
574
+ "sigInvalid",
575
+ "digestMismatch",
576
+ "manifestLate",
577
+ "manifestAbsent",
578
+ "verifierError"
579
+ ];
580
+ var equalBytes = (left, right) => {
581
+ if (left.byteLength !== right.byteLength)
582
+ return false;
583
+ let diff = 0;
584
+ for (let index = 0; index < left.byteLength; index++)
585
+ diff |= left[index] ^ right[index];
586
+ return diff === 0;
587
+ };
588
+ var isPromiseLike = (value) => typeof value === "object" && value !== null && typeof value.then === "function";
589
+ var _config, _verifySignature, _onFailure, _tracks, _stats, _disposed, _ManifestVerifier_instances, requireTrack_fn, group_fn, validateIdentity_fn, admitAgainstEntry_fn, rejectOrShadow_fn, resolvePending_fn, closeGroup_fn, finishGroupSignature_fn, verifyAcceptedSignature_fn, failGroup_fn, removePending_fn, quarantine_fn, enforceCap_fn, failOpenTrack_fn, failOpenGroup_fn, releaseAllQuarantine_fn, failure_fn;
590
+ var ManifestVerifier = class {
591
+ constructor(options) {
592
+ __privateAdd(this, _ManifestVerifier_instances);
593
+ __privateAdd(this, _config);
594
+ __privateAdd(this, _verifySignature);
595
+ __privateAdd(this, _onFailure);
596
+ __privateAdd(this, _tracks, /* @__PURE__ */ new Map());
597
+ __privateAdd(this, _stats, {
598
+ verified: 0,
599
+ failures: Object.fromEntries(FAILURE_REASONS.map((reason) => [reason, 0])),
600
+ quarantinedBytes: 0
601
+ });
602
+ __privateAdd(this, _disposed, false);
603
+ __privateSet(this, _config, { ...options.manifestAuth });
604
+ __privateSet(this, _verifySignature, options.verifySignature);
605
+ __privateSet(this, _onFailure, options.onFailure);
606
+ }
607
+ get config() {
608
+ return __privateGet(this, _config);
609
+ }
610
+ get stats() {
611
+ let quarantined = 0;
612
+ for (const track of __privateGet(this, _tracks).values())
613
+ quarantined += track.quarantine.length;
614
+ return {
615
+ verified: __privateGet(this, _stats).verified,
616
+ failures: { ...__privateGet(this, _stats).failures },
617
+ quarantined,
618
+ quarantinedBytes: __privateGet(this, _stats).quarantinedBytes
619
+ };
620
+ }
621
+ setMode(mode) {
622
+ __privateSet(this, _config, { ...__privateGet(this, _config), mode });
623
+ if (mode !== "enforce")
624
+ __privateMethod(this, _ManifestVerifier_instances, releaseAllQuarantine_fn).call(this, false);
625
+ }
626
+ registerTrack(context) {
627
+ const bindingId = context.bindingId ?? context.trackName;
628
+ if (__privateGet(this, _tracks).has(bindingId)) {
629
+ throw new Error(`manifest binding ${bindingId} is already registered`);
630
+ }
631
+ if (!Number.isFinite(context.bitrate) || context.bitrate <= 0) {
632
+ throw new Error("manifest track bitrate must be > 0");
633
+ }
634
+ if (!Number.isFinite(context.groupDurationMs) || context.groupDurationMs <= 0) {
635
+ throw new Error("manifest track groupDurationMs must be > 0");
636
+ }
637
+ if (context.authScope.byteLength !== 32)
638
+ throw new Error("manifest authScope must be 32 bytes");
639
+ if (context.publicKey.byteLength !== 32)
640
+ throw new Error("manifest publicKey must be 32 bytes");
641
+ for (const key of context.acceptedPublicKeys ?? []) {
642
+ if (key.byteLength !== 32)
643
+ throw new Error("manifest acceptedPublicKeys must contain 32-byte keys");
644
+ }
645
+ for (const [name, value] of Object.entries({
646
+ broadcastNamespaceId: context.broadcastNamespaceId,
647
+ trackName: context.trackName,
648
+ codec: context.codec,
649
+ timing: context.timing,
650
+ fecGeometry: context.fecGeometry
651
+ })) {
652
+ if (value.length === 0)
653
+ throw new Error(`manifest ${name} must not be empty`);
654
+ }
655
+ __privateGet(this, _tracks).set(bindingId, {
656
+ context: { ...context, bindingId },
657
+ groups: /* @__PURE__ */ new Map(),
658
+ quarantine: [],
659
+ quarantinedBytes: 0,
660
+ capBytes: Math.ceil(context.bitrate * context.groupDurationMs / 8e3),
661
+ manifestEntries: 0,
662
+ maxManifestEntries: Math.ceil(context.bitrate * context.groupDurationMs / (8e3 * 52)),
663
+ maxGroups: context.mapper.d + 1
664
+ });
665
+ }
666
+ ingestManifestFrame(bindingId, frameBytes) {
667
+ const track = __privateMethod(this, _ManifestVerifier_instances, requireTrack_fn).call(this, bindingId);
668
+ try {
669
+ const frame = decodeSourceAuthManifestFrame(frameBytes);
670
+ const groupId = frame.groupId;
671
+ const group = __privateMethod(this, _ManifestVerifier_instances, group_fn).call(this, track, groupId);
672
+ if (frame.kind === "object") {
673
+ if (group.close || group.signaturePending || group.failed) {
674
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, { trackName: track.context.trackName, bindingId, groupId, objectId: frame.objectId }, "verifierError");
675
+ return;
676
+ }
677
+ if (group.entries.has(frame.objectId)) {
678
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, { trackName: track.context.trackName, bindingId, groupId, objectId: frame.objectId }, "verifierError");
679
+ return;
680
+ }
681
+ if (group.entries.size >= 4096 || track.manifestEntries >= track.maxManifestEntries) {
682
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, { trackName: track.context.trackName, bindingId, groupId, objectId: frame.objectId }, "verifierError");
683
+ return;
684
+ }
685
+ group.entries.set(frame.objectId, frame);
686
+ track.manifestEntries++;
687
+ const pending = group.pending.get(frame.objectId);
688
+ if (pending) {
689
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, pending.identity, "manifestLate");
690
+ __privateMethod(this, _ManifestVerifier_instances, resolvePending_fn).call(this, track, group, pending, frame);
691
+ }
692
+ if (group.pendingClose && group.entries.size === group.pendingClose.objectCount) {
693
+ const close = group.pendingClose;
694
+ group.pendingClose = void 0;
695
+ __privateMethod(this, _ManifestVerifier_instances, closeGroup_fn).call(this, track, groupId, group, close);
696
+ }
697
+ return;
698
+ }
699
+ __privateMethod(this, _ManifestVerifier_instances, closeGroup_fn).call(this, track, groupId, group, frame);
700
+ } catch {
701
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, { trackName: track.context.trackName, bindingId, groupId: 0, objectId: 0 }, "verifierError");
702
+ }
703
+ }
704
+ admitObject(identity, data, release) {
705
+ if (__privateGet(this, _config).mode === "off") {
706
+ release();
707
+ return { action: "play", verified: false };
708
+ }
709
+ const track = __privateGet(this, _tracks).get(identity.bindingId ?? identity.trackName);
710
+ if (!track) {
711
+ release();
712
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, identity, "verifierError");
713
+ return { action: "play", verified: false, reason: "verifierError" };
714
+ }
715
+ try {
716
+ if (!__privateMethod(this, _ManifestVerifier_instances, validateIdentity_fn).call(this, track, identity)) {
717
+ return __privateMethod(this, _ManifestVerifier_instances, rejectOrShadow_fn).call(this, identity, release, "digestMismatch");
718
+ }
719
+ const group = __privateMethod(this, _ManifestVerifier_instances, group_fn).call(this, track, BigInt(identity.groupId));
720
+ if (group.failed === "sigInvalid" || group.failed === "digestMismatch") {
721
+ return __privateMethod(this, _ManifestVerifier_instances, rejectOrShadow_fn).call(this, identity, release, group.failed);
722
+ }
723
+ const entry = group.entries.get(identity.objectId);
724
+ if (entry)
725
+ return __privateMethod(this, _ManifestVerifier_instances, admitAgainstEntry_fn).call(this, track, group, identity, data, release, entry);
726
+ if (__privateGet(this, _config).mode === "shadow" || __privateGet(this, _config).onMissingManifest === "fallback-shadow") {
727
+ release();
728
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, identity, "manifestAbsent");
729
+ return { action: "play", verified: false, reason: "manifestAbsent" };
730
+ }
731
+ if (!__privateMethod(this, _ManifestVerifier_instances, quarantine_fn).call(this, track, group, { identity, data, release, bytes: data.byteLength })) {
732
+ return { action: "drop", verified: false };
733
+ }
734
+ return { action: "stall", verified: false };
735
+ } catch {
736
+ release();
737
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, identity, "verifierError");
738
+ return { action: "play", verified: false, reason: "verifierError" };
739
+ }
740
+ }
741
+ dispose() {
742
+ if (__privateGet(this, _disposed))
743
+ return;
744
+ __privateSet(this, _disposed, true);
745
+ __privateMethod(this, _ManifestVerifier_instances, releaseAllQuarantine_fn).call(this, false);
746
+ __privateGet(this, _tracks).clear();
747
+ }
748
+ };
749
+ _config = new WeakMap();
750
+ _verifySignature = new WeakMap();
751
+ _onFailure = new WeakMap();
752
+ _tracks = new WeakMap();
753
+ _stats = new WeakMap();
754
+ _disposed = new WeakMap();
755
+ _ManifestVerifier_instances = new WeakSet();
756
+ requireTrack_fn = function(bindingId) {
757
+ const track = __privateGet(this, _tracks).get(bindingId);
758
+ if (!track)
759
+ throw new Error(`unknown manifest binding ${bindingId}`);
760
+ return track;
761
+ };
762
+ group_fn = function(track, groupId) {
763
+ let group = track.groups.get(groupId);
764
+ if (!group) {
765
+ group = { entries: /* @__PURE__ */ new Map(), pending: /* @__PURE__ */ new Map(), rootVerified: false };
766
+ track.groups.set(groupId, group);
767
+ while (track.groups.size > track.maxGroups) {
768
+ const oldest = track.groups.entries().next().value;
769
+ if (!oldest)
770
+ break;
771
+ const [oldestId, oldestGroup] = oldest;
772
+ for (const pending of [...oldestGroup.pending.values()]) {
773
+ __privateMethod(this, _ManifestVerifier_instances, removePending_fn).call(this, track, oldestGroup, pending);
774
+ pending.release();
775
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, pending.identity, "manifestAbsent");
776
+ }
777
+ track.manifestEntries -= oldestGroup.entries.size;
778
+ track.groups.delete(oldestId);
779
+ }
780
+ }
781
+ return group;
782
+ };
783
+ validateIdentity_fn = function(track, identity) {
784
+ const coordinates = track.context.mapper.derive(Number(identity.groupId), identity.objectId);
785
+ return identity.ssId === void 0 || coordinates.ssId === identity.ssId;
786
+ };
787
+ admitAgainstEntry_fn = function(track, group, identity, data, release, entry) {
788
+ if (entry.trueLength !== data.byteLength) {
789
+ return __privateMethod(this, _ManifestVerifier_instances, rejectOrShadow_fn).call(this, identity, release, "digestMismatch");
790
+ }
791
+ const digestMatches = equalBytes(sourceAuthObjectDigest(data.subarray(0, entry.trueLength)), entry.digest);
792
+ if (!digestMatches)
793
+ return __privateMethod(this, _ManifestVerifier_instances, rejectOrShadow_fn).call(this, identity, release, "digestMismatch");
794
+ if (!track.context.manifestChannelAuthenticated && !group.rootVerified) {
795
+ if (__privateGet(this, _config).mode === "shadow") {
796
+ release();
797
+ return { action: "play", verified: false };
798
+ }
799
+ if (!__privateMethod(this, _ManifestVerifier_instances, quarantine_fn).call(this, track, group, { identity, data, release, bytes: data.byteLength })) {
800
+ return { action: "drop", verified: false };
801
+ }
802
+ return { action: "stall", verified: false };
803
+ }
804
+ release();
805
+ __privateGet(this, _stats).verified++;
806
+ return { action: "play", verified: true };
807
+ };
808
+ rejectOrShadow_fn = function(identity, release, reason) {
809
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, identity, reason);
810
+ if (__privateGet(this, _config).mode === "enforce") {
811
+ console.warn(JSON.stringify({ event: "manifest-enforce-drop", track: identity.trackName, group: String(identity.groupId), object: identity.objectId, reason }));
812
+ return { action: "drop", verified: false, reason };
813
+ }
814
+ release();
815
+ return { action: "play", verified: false, reason };
816
+ };
817
+ resolvePending_fn = function(track, group, pending, entry) {
818
+ __privateMethod(this, _ManifestVerifier_instances, removePending_fn).call(this, track, group, pending);
819
+ __privateMethod(this, _ManifestVerifier_instances, admitAgainstEntry_fn).call(this, track, group, pending.identity, pending.data, pending.release, entry);
820
+ };
821
+ closeGroup_fn = function(track, groupId, group, close) {
822
+ if (group.close || group.signaturePending)
823
+ return;
824
+ const entries = [...group.entries.values()];
825
+ if (entries.length !== close.objectCount) {
826
+ group.pendingClose = close;
827
+ const hadPending = group.pending.size > 0;
828
+ if (__privateGet(this, _config).onMissingManifest === "fallback-shadow" || __privateGet(this, _config).mode === "shadow") {
829
+ for (const pending of [...group.pending.values()]) {
830
+ __privateMethod(this, _ManifestVerifier_instances, removePending_fn).call(this, track, group, pending);
831
+ pending.release();
832
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, pending.identity, "manifestAbsent");
833
+ }
834
+ } else {
835
+ for (const pending of group.pending.values()) {
836
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, pending.identity, "manifestAbsent");
837
+ }
838
+ }
839
+ if (!hadPending) {
840
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, { trackName: track.context.trackName, groupId, objectId: 0 }, "manifestAbsent");
841
+ }
842
+ return;
843
+ }
844
+ if (!equalBytes(sourceAuthMerkleRoot(entries), close.root)) {
845
+ group.failed = "digestMismatch";
846
+ __privateMethod(this, _ManifestVerifier_instances, failGroup_fn).call(this, track, groupId, group, "digestMismatch");
847
+ return;
848
+ }
849
+ const preimage = sourceAuthSignaturePreimage(track.context.authScope, close.groupId, close.objectCount, close.root);
850
+ let signatureValid;
851
+ try {
852
+ signatureValid = __privateMethod(this, _ManifestVerifier_instances, verifyAcceptedSignature_fn).call(this, track, preimage, close.signature);
853
+ } catch {
854
+ __privateMethod(this, _ManifestVerifier_instances, failOpenGroup_fn).call(this, track, groupId, group);
855
+ return;
856
+ }
857
+ if (isPromiseLike(signatureValid)) {
858
+ group.signaturePending = true;
859
+ void signatureValid.then((valid) => {
860
+ if (__privateGet(this, _disposed))
861
+ return;
862
+ group.signaturePending = false;
863
+ __privateMethod(this, _ManifestVerifier_instances, finishGroupSignature_fn).call(this, track, groupId, group, close, valid);
864
+ }, () => {
865
+ if (__privateGet(this, _disposed))
866
+ return;
867
+ group.signaturePending = false;
868
+ __privateMethod(this, _ManifestVerifier_instances, failOpenGroup_fn).call(this, track, groupId, group);
869
+ });
870
+ return;
871
+ }
872
+ __privateMethod(this, _ManifestVerifier_instances, finishGroupSignature_fn).call(this, track, groupId, group, close, signatureValid);
873
+ };
874
+ finishGroupSignature_fn = function(track, groupId, group, close, signatureValid) {
875
+ if (!signatureValid) {
876
+ group.failed = "sigInvalid";
877
+ __privateMethod(this, _ManifestVerifier_instances, failGroup_fn).call(this, track, groupId, group, "sigInvalid");
878
+ return;
879
+ }
880
+ group.failed = void 0;
881
+ group.close = close;
882
+ group.pendingClose = void 0;
883
+ group.rootVerified = true;
884
+ for (const pending of [...group.pending.values()]) {
885
+ const entry = group.entries.get(pending.identity.objectId);
886
+ if (entry)
887
+ __privateMethod(this, _ManifestVerifier_instances, resolvePending_fn).call(this, track, group, pending, entry);
888
+ else if (__privateGet(this, _config).onMissingManifest === "fallback-shadow") {
889
+ __privateMethod(this, _ManifestVerifier_instances, removePending_fn).call(this, track, group, pending);
890
+ pending.release();
891
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, pending.identity, "manifestAbsent");
892
+ }
893
+ }
894
+ };
895
+ verifyAcceptedSignature_fn = function(track, message, signature) {
896
+ const keys = track.context.acceptedPublicKeys ?? [track.context.publicKey];
897
+ const pending = [];
898
+ let hadSynchronousError = false;
899
+ for (const key of keys) {
900
+ try {
901
+ const result = __privateGet(this, _verifySignature).call(this, key, message, signature);
902
+ if (isPromiseLike(result)) {
903
+ pending.push(Promise.resolve(result).then((valid) => valid, () => "error"));
904
+ } else if (result) {
905
+ return true;
906
+ }
907
+ } catch {
908
+ hadSynchronousError = true;
909
+ }
910
+ }
911
+ if (pending.length === 0) {
912
+ if (hadSynchronousError)
913
+ throw new Error("manifest signature verifier unavailable");
914
+ return false;
915
+ }
916
+ return Promise.all(pending).then((results) => {
917
+ if (results.some((valid) => valid === true))
918
+ return true;
919
+ if (hadSynchronousError || results.some((valid) => valid === "error")) {
920
+ throw new Error("manifest signature verifier unavailable");
921
+ }
922
+ return false;
923
+ });
924
+ };
925
+ failGroup_fn = function(track, groupId, group, reason) {
926
+ if (group.pending.size === 0) {
927
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, { trackName: track.context.trackName, groupId, objectId: 0 }, reason);
928
+ return;
929
+ }
930
+ for (const pending of [...group.pending.values()]) {
931
+ __privateMethod(this, _ManifestVerifier_instances, removePending_fn).call(this, track, group, pending);
932
+ __privateMethod(this, _ManifestVerifier_instances, rejectOrShadow_fn).call(this, pending.identity, pending.release, reason);
933
+ }
934
+ };
935
+ removePending_fn = function(track, group, pending) {
936
+ if (group.pending.get(pending.identity.objectId) === pending) {
937
+ group.pending.delete(pending.identity.objectId);
938
+ }
939
+ const index = track.quarantine.indexOf(pending);
940
+ if (index >= 0)
941
+ track.quarantine.splice(index, 1);
942
+ track.quarantinedBytes -= pending.bytes;
943
+ __privateGet(this, _stats).quarantinedBytes -= pending.bytes;
944
+ };
945
+ quarantine_fn = function(track, group, pending) {
946
+ if (group.pending.has(pending.identity.objectId))
947
+ return false;
948
+ group.pending.set(pending.identity.objectId, pending);
949
+ track.quarantine.push(pending);
950
+ track.quarantinedBytes += pending.bytes;
951
+ __privateGet(this, _stats).quarantinedBytes += pending.bytes;
952
+ __privateMethod(this, _ManifestVerifier_instances, enforceCap_fn).call(this, track);
953
+ return true;
954
+ };
955
+ enforceCap_fn = function(track) {
956
+ while (track.quarantinedBytes > track.capBytes && track.quarantine.length > 0) {
957
+ const pending = track.quarantine.shift();
958
+ const group = track.groups.get(BigInt(pending.identity.groupId));
959
+ if (group)
960
+ group.pending.delete(pending.identity.objectId);
961
+ track.quarantinedBytes -= pending.bytes;
962
+ __privateGet(this, _stats).quarantinedBytes -= pending.bytes;
963
+ pending.release();
964
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, pending.identity, "manifestAbsent");
965
+ console.warn(`[ManifestVerifier] quarantine cap eviction fail-open track=${pending.identity.trackName} group=${pending.identity.groupId} object=${pending.identity.objectId}`);
966
+ }
967
+ };
968
+ failOpenTrack_fn = function(track, reason) {
969
+ for (const pending of [...track.quarantine]) {
970
+ const group = track.groups.get(BigInt(pending.identity.groupId));
971
+ if (group)
972
+ __privateMethod(this, _ManifestVerifier_instances, removePending_fn).call(this, track, group, pending);
973
+ pending.release();
974
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, pending.identity, reason);
975
+ }
976
+ };
977
+ failOpenGroup_fn = function(track, groupId, group) {
978
+ const pending = [...group.pending.values()];
979
+ if (pending.length === 0) {
980
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, { trackName: track.context.trackName, groupId, objectId: 0 }, "verifierError");
981
+ return;
982
+ }
983
+ for (const object of pending) {
984
+ __privateMethod(this, _ManifestVerifier_instances, removePending_fn).call(this, track, group, object);
985
+ object.release();
986
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, object.identity, "verifierError");
987
+ }
988
+ };
989
+ releaseAllQuarantine_fn = function(countFailure) {
990
+ for (const track of __privateGet(this, _tracks).values()) {
991
+ for (const pending of [...track.quarantine]) {
992
+ const group = track.groups.get(BigInt(pending.identity.groupId));
993
+ if (group)
994
+ __privateMethod(this, _ManifestVerifier_instances, removePending_fn).call(this, track, group, pending);
995
+ pending.release();
996
+ if (countFailure)
997
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, pending.identity, "verifierError");
998
+ }
999
+ }
1000
+ };
1001
+ failure_fn = function(identity, reason) {
1002
+ var _a;
1003
+ __privateGet(this, _stats).failures[reason]++;
1004
+ (_a = __privateGet(this, _onFailure)) == null ? void 0 : _a.call(this, {
1005
+ trackName: identity.trackName,
1006
+ ...identity.bindingId === void 0 ? {} : { bindingId: identity.bindingId },
1007
+ groupId: identity.groupId,
1008
+ objectId: identity.objectId,
1009
+ reason
1010
+ });
1011
+ };
1012
+
1013
+ // src/multicast-auth-catalog.ts
1014
+ var RAW_ED25519_KEY_LENGTH = 32;
1015
+ var SOURCE_AUTH_SCOPE_LENGTH2 = 32;
1016
+ var BASE64URL_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
1017
+ function encodeBase64Url(bytes) {
1018
+ let output = "";
1019
+ for (let i = 0; i < bytes.length; i += 3) {
1020
+ const b0 = bytes[i];
1021
+ const b1 = bytes[i + 1];
1022
+ const b2 = bytes[i + 2];
1023
+ output += BASE64URL_ALPHABET[b0 >> 2];
1024
+ output += BASE64URL_ALPHABET[(b0 & 3) << 4 | (b1 === void 0 ? 0 : b1 >> 4)];
1025
+ if (b1 === void 0) break;
1026
+ output += BASE64URL_ALPHABET[(b1 & 15) << 2 | (b2 === void 0 ? 0 : b2 >> 6)];
1027
+ if (b2 === void 0) break;
1028
+ output += BASE64URL_ALPHABET[b2 & 63];
1029
+ }
1030
+ return output;
1031
+ }
1032
+ var BASE64URL_DECODE_TABLE = (() => {
1033
+ const table = new Int8Array(128).fill(-1);
1034
+ for (let i = 0; i < BASE64URL_ALPHABET.length; i++) {
1035
+ table[BASE64URL_ALPHABET.charCodeAt(i)] = i;
1036
+ }
1037
+ return table;
1038
+ })();
1039
+ function decodeBase64Url(text) {
1040
+ if (text.length % 4 === 1) {
1041
+ throw new Error(`[multicast-auth-catalog] invalid unpadded base64url length for "${text}"`);
1042
+ }
1043
+ const bytes = [];
1044
+ let buffer = 0;
1045
+ let bits = 0;
1046
+ for (let i = 0; i < text.length; i++) {
1047
+ const code = text.charCodeAt(i);
1048
+ const value = code < 128 ? BASE64URL_DECODE_TABLE[code] : -1;
1049
+ if (value === void 0 || value < 0) {
1050
+ throw new Error(`[multicast-auth-catalog] invalid base64url character in "${text}"`);
1051
+ }
1052
+ buffer = buffer << 6 | value;
1053
+ bits += 6;
1054
+ if (bits >= 8) {
1055
+ bits -= 8;
1056
+ bytes.push(buffer >> bits & 255);
1057
+ }
1058
+ }
1059
+ const decoded = Uint8Array.from(bytes);
1060
+ if (encodeBase64Url(decoded) !== text) {
1061
+ throw new Error(`[multicast-auth-catalog] non-canonical base64url encoding "${text}"`);
1062
+ }
1063
+ return decoded;
1064
+ }
1065
+ function decodeAuthScope(authScope) {
1066
+ const bytes = decodeBase64Url(authScope);
1067
+ if (bytes.byteLength !== SOURCE_AUTH_SCOPE_LENGTH2) {
1068
+ throw new Error(
1069
+ `[multicast-auth-catalog] authScope must decode to ${SOURCE_AUTH_SCOPE_LENGTH2} raw bytes, got ${bytes.byteLength}`
1070
+ );
1071
+ }
1072
+ return bytes;
1073
+ }
1074
+ function decodeEd25519PublicKey(publicKey) {
1075
+ const bytes = decodeBase64Url(publicKey);
1076
+ if (bytes.byteLength !== RAW_ED25519_KEY_LENGTH) {
1077
+ throw new Error(
1078
+ `[multicast-auth-catalog] public key must decode to ${RAW_ED25519_KEY_LENGTH} raw bytes, got ${bytes.byteLength}`
1079
+ );
1080
+ }
1081
+ return bytes;
1082
+ }
1083
+ function isNonEmptyString(value) {
1084
+ return typeof value === "string" && value.length > 0;
1085
+ }
1086
+ function isValidAuthScopeField(value) {
1087
+ if (!isNonEmptyString(value)) return false;
1088
+ try {
1089
+ decodeAuthScope(value);
1090
+ return true;
1091
+ } catch {
1092
+ return false;
1093
+ }
1094
+ }
1095
+ function isValidPublicKeyField(value) {
1096
+ if (!isNonEmptyString(value)) return false;
1097
+ try {
1098
+ decodeEd25519PublicKey(value);
1099
+ return true;
1100
+ } catch {
1101
+ return false;
1102
+ }
1103
+ }
1104
+ function hasOnlyKeys(object, allowed) {
1105
+ const allowedKeys = new Set(allowed);
1106
+ return Object.keys(object).every((key) => allowedKeys.has(key));
1107
+ }
1108
+ function isMulticastAuthTrackConfig(obj) {
1109
+ if (typeof obj !== "object" || obj === null) return false;
1110
+ const o = obj;
1111
+ return hasOnlyKeys(o, ["mediaTrack", "manifestTrack", "authScope", "sourceSymbolFormat"]) && isNonEmptyString(o["mediaTrack"]) && isNonEmptyString(o["manifestTrack"]) && o["mediaTrack"] !== o["manifestTrack"] && isValidAuthScopeField(o["authScope"]) && isNonEmptyString(o["sourceSymbolFormat"]);
1112
+ }
1113
+ var VALID_COMPACTION = /* @__PURE__ */ new Set(["merkle", "none"]);
1114
+ var VALID_ENFORCEMENT = /* @__PURE__ */ new Set(["shadow", "enforce"]);
1115
+ function hasUniqueMulticastAuthTrackBindings(tracks) {
1116
+ const bindings = tracks.flatMap((track) => {
1117
+ if (typeof track !== "object" || track === null) return [];
1118
+ const value = track;
1119
+ if (typeof value["mediaTrack"] !== "string" || typeof value["sourceSymbolFormat"] !== "string") {
1120
+ return [];
1121
+ }
1122
+ return [JSON.stringify([value["mediaTrack"], value["sourceSymbolFormat"]])];
1123
+ });
1124
+ return new Set(bindings).size === bindings.length;
1125
+ }
1126
+ function isMulticastAuthConfig(obj) {
1127
+ if (typeof obj !== "object" || obj === null) return false;
1128
+ const o = obj;
1129
+ if (o["scheme"] !== "bc-provenance") return false;
1130
+ if (o["hash"] !== "blake3") return false;
1131
+ if (o["sig"] !== "ed25519") return false;
1132
+ if (!hasOnlyKeys(o, ["scheme", "hash", "sig", "publicKey", "keyId", "previousKey", "compaction", "enforcement", "tracks"])) return false;
1133
+ if (!isValidPublicKeyField(o["publicKey"])) return false;
1134
+ if (!isNonEmptyString(o["keyId"])) return false;
1135
+ if (o["previousKey"] !== void 0 && !isValidPublicKeyField(o["previousKey"])) return false;
1136
+ if (o["previousKey"] === o["publicKey"]) return false;
1137
+ if (typeof o["compaction"] !== "string" || !VALID_COMPACTION.has(o["compaction"])) return false;
1138
+ if (o["enforcement"] !== void 0) {
1139
+ if (typeof o["enforcement"] !== "string" || !VALID_ENFORCEMENT.has(o["enforcement"])) return false;
1140
+ }
1141
+ if (!Array.isArray(o["tracks"]) || o["tracks"].length === 0) return false;
1142
+ const tracks = o["tracks"];
1143
+ if (!tracks.every((t) => isMulticastAuthTrackConfig(t))) return false;
1144
+ const typedTracks = tracks;
1145
+ const scopes = typedTracks.map((t) => t.authScope);
1146
+ if (new Set(scopes).size !== scopes.length) return false;
1147
+ if (!hasUniqueMulticastAuthTrackBindings(typedTracks)) return false;
1148
+ const manifestTracks = typedTracks.map((t) => t.manifestTrack);
1149
+ if (new Set(manifestTracks).size !== manifestTracks.length) return false;
1150
+ return true;
1151
+ }
1152
+ function resolveMulticastAuthMode(playerMode, auth) {
1153
+ if (playerMode !== void 0) return playerMode;
1154
+ if (auth === void 0) return "off";
1155
+ return auth.enforcement ?? "shadow";
1156
+ }
1157
+ function resolveMulticastAuthCatalog(catalog, playerMode) {
1158
+ if (typeof catalog !== "object" || catalog === null || Array.isArray(catalog)) {
1159
+ throw new Error("[multicast-auth-catalog] catalog must be an object");
1160
+ }
1161
+ const root = catalog;
1162
+ const rawAuth = root["multicast.auth"];
1163
+ if (rawAuth === void 0) {
1164
+ if (playerMode === "enforce") {
1165
+ throw new Error("[multicast-auth-catalog] player enforce mode requires multicast.auth");
1166
+ }
1167
+ return void 0;
1168
+ }
1169
+ if (!isMulticastAuthConfig(rawAuth)) {
1170
+ throw new Error("[multicast-auth-catalog] invalid multicast.auth v2 block");
1171
+ }
1172
+ const rawTracks = root["tracks"];
1173
+ if (!Array.isArray(rawTracks)) {
1174
+ throw new Error("[multicast-auth-catalog] catalog tracks must be an array");
1175
+ }
1176
+ const catalogTrackNames = new Set(
1177
+ rawTracks.flatMap(
1178
+ (track) => typeof track === "object" && track !== null && typeof track["name"] === "string" ? [track["name"]] : []
1179
+ )
1180
+ );
1181
+ for (const track of rawAuth.tracks) {
1182
+ if (!catalogTrackNames.has(track.mediaTrack)) {
1183
+ throw new Error(`[multicast-auth-catalog] unknown mediaTrack "${track.mediaTrack}"`);
1184
+ }
1185
+ if (!catalogTrackNames.has(track.manifestTrack)) {
1186
+ throw new Error(`[multicast-auth-catalog] unknown manifestTrack "${track.manifestTrack}"`);
1187
+ }
1188
+ }
1189
+ return {
1190
+ keyId: rawAuth.keyId,
1191
+ acceptedPublicKeys: [
1192
+ decodeEd25519PublicKey(rawAuth.publicKey),
1193
+ ...rawAuth.previousKey === void 0 ? [] : [decodeEd25519PublicKey(rawAuth.previousKey)]
1194
+ ],
1195
+ mode: resolveMulticastAuthMode(playerMode, rawAuth),
1196
+ compaction: rawAuth.compaction,
1197
+ tracks: rawAuth.tracks.map((track) => ({
1198
+ ...track,
1199
+ authScope: decodeAuthScope(track.authScope)
1200
+ }))
1201
+ };
1202
+ }
1203
+
1204
+ // src/manifest-auth-plan.ts
1205
+ function createManifestAuthPlan(catalog, options) {
1206
+ const resolved = resolveMulticastAuthCatalog(catalog, options.playerMode);
1207
+ if (!resolved || resolved.mode === "off") return void 0;
1208
+ const verifier = new ManifestVerifier({
1209
+ manifestAuth: {
1210
+ mode: resolved.mode,
1211
+ onMissingManifest: options.onMissingManifest ?? (resolved.mode === "enforce" ? "stall" : "fallback-shadow")
1212
+ },
1213
+ verifySignature: options.verifySignature,
1214
+ ...options.onFailure === void 0 ? {} : { onFailure: options.onFailure }
1215
+ });
1216
+ const byManifestTrack = /* @__PURE__ */ new Map();
1217
+ const bindings = resolved.tracks.map((binding) => {
1218
+ const bindingId = manifestBindingId(binding.mediaTrack, binding.sourceSymbolFormat);
1219
+ const planned = {
1220
+ bindingId,
1221
+ mediaTrack: binding.mediaTrack,
1222
+ manifestTrack: binding.manifestTrack,
1223
+ sourceSymbolFormat: binding.sourceSymbolFormat
1224
+ };
1225
+ verifier.registerTrack({
1226
+ ...options.contextFor(binding, resolved),
1227
+ bindingId,
1228
+ trackName: binding.mediaTrack,
1229
+ sourceSymbolFormat: binding.sourceSymbolFormat,
1230
+ authScope: binding.authScope,
1231
+ publicKey: resolved.acceptedPublicKeys[0],
1232
+ acceptedPublicKeys: resolved.acceptedPublicKeys
1233
+ });
1234
+ byManifestTrack.set(binding.manifestTrack, planned);
1235
+ return planned;
1236
+ });
1237
+ let disposed = false;
1238
+ return {
1239
+ verifier,
1240
+ mode: resolved.mode,
1241
+ bindings,
1242
+ manifestTracks: [...byManifestTrack.keys()],
1243
+ bindingIdFor(mediaTrack, sourceSymbolFormat) {
1244
+ const bindingId = manifestBindingId(mediaTrack, sourceSymbolFormat);
1245
+ return bindings.some((binding) => binding.bindingId === bindingId) ? bindingId : void 0;
1246
+ },
1247
+ ingestManifestPayload(manifestTrack, payload) {
1248
+ const binding = byManifestTrack.get(manifestTrack);
1249
+ if (!binding) throw new Error(`unknown manifest subscription track ${manifestTrack}`);
1250
+ verifier.ingestManifestFrame(binding.bindingId, payload);
1251
+ },
1252
+ dispose() {
1253
+ if (disposed) return;
1254
+ disposed = true;
1255
+ verifier.dispose();
1256
+ }
1257
+ };
1258
+ }
1259
+ export {
1260
+ createManifestAuthPlan
1261
+ };
1262
+ /*! Bundled license information:
1263
+
1264
+ @noble/hashes/esm/utils.js:
1265
+ (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
1266
+ */
1267
+ //# sourceMappingURL=manifest-auth-plan.js.map