@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,1220 @@
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 trimRecoveredSourceAuthObject(recoveredSymbol, trueLength) {
514
+ requireTrueLength(trueLength);
515
+ if (trueLength > recoveredSymbol.byteLength) {
516
+ throw new Error(`true length ${trueLength} exceeds recovered object size ${recoveredSymbol.byteLength}`);
517
+ }
518
+ return recoveredSymbol.subarray(0, trueLength);
519
+ }
520
+ function encodeSourceAuthObjectEntry(entry) {
521
+ requireU32("objectId", entry.objectId);
522
+ requireTrueLength(entry.trueLength);
523
+ requireU64("groupId", entry.groupId);
524
+ requireBytes("digest", entry.digest, 32);
525
+ const frame = new Uint8Array(SOURCE_AUTH_OBJECT_ENTRY_LENGTH);
526
+ const view = new DataView(frame.buffer);
527
+ frame[0] = SOURCE_AUTH_OBJECT_ENTRY_FRAME;
528
+ frame[1] = SOURCE_AUTH_MANIFEST_VERSION;
529
+ view.setBigUint64(4, entry.groupId);
530
+ view.setUint32(12, entry.objectId);
531
+ view.setUint32(16, entry.trueLength);
532
+ frame.set(entry.digest, 20);
533
+ return frame;
534
+ }
535
+ function encodeSourceAuthGroupClose(close) {
536
+ requireU32("objectCount", close.objectCount);
537
+ if (close.objectCount === 0 || close.objectCount > SOURCE_AUTH_MAX_OBJECTS_PER_GROUP) {
538
+ throw new Error(`objectCount must be between 1 and ${SOURCE_AUTH_MAX_OBJECTS_PER_GROUP}`);
539
+ }
540
+ requireU64("groupId", close.groupId);
541
+ requireBytes("root", close.root, 32);
542
+ requireBytes("signature", close.signature, 64);
543
+ const frame = new Uint8Array(SOURCE_AUTH_GROUP_CLOSE_LENGTH);
544
+ const view = new DataView(frame.buffer);
545
+ frame[0] = SOURCE_AUTH_GROUP_CLOSE_FRAME;
546
+ frame[1] = SOURCE_AUTH_MANIFEST_VERSION;
547
+ view.setBigUint64(4, close.groupId);
548
+ view.setUint32(12, close.objectCount);
549
+ frame.set(close.root, 16);
550
+ frame.set(close.signature, 48);
551
+ return frame;
552
+ }
553
+ function sourceAuthSignaturePreimage(authScope, groupId, objectCount, root) {
554
+ requireU32("objectCount", objectCount);
555
+ if (objectCount === 0 || objectCount > SOURCE_AUTH_MAX_OBJECTS_PER_GROUP) {
556
+ throw new Error(`objectCount must be between 1 and ${SOURCE_AUTH_MAX_OBJECTS_PER_GROUP}`);
557
+ }
558
+ requireU64("groupId", groupId);
559
+ requireBytes("authScope", authScope, SOURCE_AUTH_SCOPE_LENGTH);
560
+ requireBytes("root", root, 32);
561
+ const preimage = new Uint8Array(100);
562
+ const view = new DataView(preimage.buffer);
563
+ preimage.set(SIGNATURE_DOMAIN);
564
+ preimage.set(authScope, 24);
565
+ view.setBigUint64(56, groupId);
566
+ view.setUint32(64, objectCount);
567
+ preimage.set(root, 68);
568
+ return preimage;
569
+ }
570
+ function decodeSourceAuthManifestFrame(frame) {
571
+ const frameType = frame[0];
572
+ 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;
573
+ if (expectedLength === 0)
574
+ throw new Error(`unsupported manifest frame type ${frameType}`);
575
+ if (frame.byteLength !== expectedLength) {
576
+ throw new Error(`manifest frame has invalid length ${frame.byteLength} for type ${frameType}`);
577
+ }
578
+ if (frame[1] !== SOURCE_AUTH_MANIFEST_VERSION) {
579
+ throw new Error(`unsupported manifest version ${frame[1]}`);
580
+ }
581
+ if (frame[2] !== 0 || frame[3] !== 0)
582
+ throw new Error("manifest reserved bits must be zero");
583
+ const view = new DataView(frame.buffer, frame.byteOffset, frame.byteLength);
584
+ const groupId = view.getBigUint64(4);
585
+ if (frameType === SOURCE_AUTH_OBJECT_ENTRY_FRAME) {
586
+ const entry = {
587
+ kind: "object",
588
+ groupId,
589
+ objectId: view.getUint32(12),
590
+ trueLength: view.getUint32(16),
591
+ digest: frame.slice(20, 52)
592
+ };
593
+ requireTrueLength(entry.trueLength);
594
+ return entry;
595
+ }
596
+ const close = {
597
+ kind: "close",
598
+ groupId,
599
+ objectCount: view.getUint32(12),
600
+ root: frame.slice(16, 48),
601
+ signature: frame.slice(48, 112)
602
+ };
603
+ if (close.objectCount === 0 || close.objectCount > SOURCE_AUTH_MAX_OBJECTS_PER_GROUP) {
604
+ throw new Error(`objectCount must be between 1 and ${SOURCE_AUTH_MAX_OBJECTS_PER_GROUP}`);
605
+ }
606
+ return close;
607
+ }
608
+
609
+ // ../mmt-manifest-verify/dist/admission.js
610
+ function requireU642(name, value) {
611
+ if (value < 0n || value > 0xffffffffffffffffn) {
612
+ throw new Error(`${name} must be an unsigned 64-bit integer`);
613
+ }
614
+ }
615
+ function equalBytes(left, right) {
616
+ if (left.byteLength !== right.byteLength)
617
+ return false;
618
+ return left.every((value, index) => value === right[index]);
619
+ }
620
+ var _manifestAuthenticated, _entries, _pendingObjects, _entriesAwaitingObjects, _admissions, _groupId, _closed, _SourceAuthAdmission_instances, requireGroup_fn, verifyObject_fn;
621
+ var SourceAuthAdmission = class {
622
+ constructor(options) {
623
+ __privateAdd(this, _SourceAuthAdmission_instances);
624
+ __privateAdd(this, _manifestAuthenticated);
625
+ __privateAdd(this, _entries, /* @__PURE__ */ new Map());
626
+ __privateAdd(this, _pendingObjects, /* @__PURE__ */ new Map());
627
+ __privateAdd(this, _entriesAwaitingObjects, /* @__PURE__ */ new Set());
628
+ __privateAdd(this, _admissions, /* @__PURE__ */ new Map());
629
+ __privateAdd(this, _groupId, null);
630
+ __privateAdd(this, _closed, false);
631
+ __privateSet(this, _manifestAuthenticated, options.manifestAuthenticated);
632
+ }
633
+ admitObject(input) {
634
+ __privateMethod(this, _SourceAuthAdmission_instances, requireGroup_fn).call(this, input.groupId);
635
+ if (__privateGet(this, _closed))
636
+ throw new Error("source-auth group is already closed");
637
+ if (__privateGet(this, _admissions).has(input.objectId) || __privateGet(this, _pendingObjects).has(input.objectId)) {
638
+ throw new Error(`duplicate source-auth object ${input.objectId}`);
639
+ }
640
+ const entry = __privateGet(this, _entries).get(input.objectId);
641
+ if (entry) {
642
+ __privateGet(this, _entriesAwaitingObjects).delete(input.objectId);
643
+ return __privateMethod(this, _SourceAuthAdmission_instances, verifyObject_fn).call(this, entry, input.bytes, input.recovered ?? false);
644
+ }
645
+ if (__privateGet(this, _pendingObjects).size >= 1) {
646
+ throw new Error("source-auth media exceeds one-object manifest skew");
647
+ }
648
+ __privateGet(this, _pendingObjects).set(input.objectId, {
649
+ bytes: input.bytes,
650
+ recovered: input.recovered ?? false
651
+ });
652
+ return {
653
+ groupId: input.groupId,
654
+ objectId: input.objectId,
655
+ recovered: input.recovered ?? false,
656
+ state: "pending-entry"
657
+ };
658
+ }
659
+ admitEntry(entry) {
660
+ __privateMethod(this, _SourceAuthAdmission_instances, requireGroup_fn).call(this, entry.groupId);
661
+ if (__privateGet(this, _closed))
662
+ throw new Error("source-auth group is already closed");
663
+ if (__privateGet(this, _entries).has(entry.objectId)) {
664
+ throw new Error(`duplicate source-auth manifest entry ${entry.objectId}`);
665
+ }
666
+ const pending = __privateGet(this, _pendingObjects).get(entry.objectId);
667
+ if (!pending && __privateGet(this, _entriesAwaitingObjects).size >= 1) {
668
+ throw new Error("source-auth manifest exceeds one-object media skew");
669
+ }
670
+ __privateGet(this, _entries).set(entry.objectId, entry);
671
+ if (!pending) {
672
+ __privateGet(this, _entriesAwaitingObjects).add(entry.objectId);
673
+ return "pending-object";
674
+ }
675
+ __privateGet(this, _pendingObjects).delete(entry.objectId);
676
+ return __privateMethod(this, _SourceAuthAdmission_instances, verifyObject_fn).call(this, entry, pending.bytes, pending.recovered);
677
+ }
678
+ objectState(objectId) {
679
+ if (__privateGet(this, _pendingObjects).has(objectId))
680
+ return "pending-entry";
681
+ if (__privateGet(this, _entriesAwaitingObjects).has(objectId))
682
+ return "pending-object";
683
+ if (__privateGet(this, _closed) && __privateGet(this, _admissions).has(objectId))
684
+ return "authenticated";
685
+ return __privateGet(this, _admissions).get(objectId)?.state;
686
+ }
687
+ async verifyClose(close, authScope, publicKey, subtle = globalThis.crypto.subtle) {
688
+ __privateMethod(this, _SourceAuthAdmission_instances, requireGroup_fn).call(this, close.groupId);
689
+ if (__privateGet(this, _closed))
690
+ throw new Error("source-auth group is already closed");
691
+ if (__privateGet(this, _pendingObjects).size !== 0 || __privateGet(this, _entriesAwaitingObjects).size !== 0) {
692
+ throw new Error("source-auth group closed with unmatched objects or entries");
693
+ }
694
+ if (close.objectCount !== __privateGet(this, _entries).size || __privateGet(this, _admissions).size !== __privateGet(this, _entries).size) {
695
+ throw new Error("source-auth group close object count mismatch");
696
+ }
697
+ const root = sourceAuthMerkleRoot([...__privateGet(this, _entries).values()]);
698
+ if (!equalBytes(root, close.root))
699
+ throw new Error("source-auth group root mismatch");
700
+ const verified = await subtle.verify("Ed25519", publicKey, new Uint8Array(close.signature).buffer, new Uint8Array(sourceAuthSignaturePreimage(authScope, close.groupId, close.objectCount, root)).buffer);
701
+ if (!verified)
702
+ throw new Error("source-auth group close signature failed");
703
+ for (const admission of __privateGet(this, _admissions).values())
704
+ admission.state = "authenticated";
705
+ __privateSet(this, _closed, true);
706
+ }
707
+ };
708
+ _manifestAuthenticated = new WeakMap();
709
+ _entries = new WeakMap();
710
+ _pendingObjects = new WeakMap();
711
+ _entriesAwaitingObjects = new WeakMap();
712
+ _admissions = new WeakMap();
713
+ _groupId = new WeakMap();
714
+ _closed = new WeakMap();
715
+ _SourceAuthAdmission_instances = new WeakSet();
716
+ requireGroup_fn = function(groupId) {
717
+ requireU642("groupId", groupId);
718
+ if (__privateGet(this, _groupId) === null)
719
+ __privateSet(this, _groupId, groupId);
720
+ else if (__privateGet(this, _groupId) !== groupId)
721
+ throw new Error("source-auth group identity mismatch");
722
+ };
723
+ verifyObject_fn = function(entry, bytes, recovered) {
724
+ const authenticated = recovered ? trimRecoveredSourceAuthObject(bytes, entry.trueLength) : bytes;
725
+ if (!recovered && bytes.byteLength !== entry.trueLength) {
726
+ throw new Error(`direct source-auth object length mismatch for ${entry.objectId}`);
727
+ }
728
+ if (!equalBytes(sourceAuthObjectDigest(authenticated), entry.digest)) {
729
+ throw new Error(`source-auth object digest mismatch for ${entry.objectId}`);
730
+ }
731
+ const admission = {
732
+ groupId: entry.groupId,
733
+ objectId: entry.objectId,
734
+ recovered,
735
+ state: __privateGet(this, _manifestAuthenticated) ? "authenticated" : "provisional"
736
+ };
737
+ __privateGet(this, _admissions).set(entry.objectId, admission);
738
+ return admission;
739
+ };
740
+
741
+ // ../mmt-manifest-verify/dist/verifier.js
742
+ function manifestBindingId(trackName, sourceSymbolFormat) {
743
+ return JSON.stringify([trackName, sourceSymbolFormat]);
744
+ }
745
+ function createWebCryptoEd25519Verifier(subtle = globalThis.crypto.subtle) {
746
+ return async (publicKey, message, signature) => {
747
+ const keyBytes = Uint8Array.from(publicKey);
748
+ const messageBytes = Uint8Array.from(message);
749
+ const signatureBytes = Uint8Array.from(signature);
750
+ const key = await subtle.importKey("raw", keyBytes.buffer, "Ed25519", false, ["verify"]);
751
+ return subtle.verify("Ed25519", key, signatureBytes.buffer, messageBytes.buffer);
752
+ };
753
+ }
754
+ var FAILURE_REASONS = [
755
+ "sigInvalid",
756
+ "digestMismatch",
757
+ "manifestLate",
758
+ "manifestAbsent",
759
+ "verifierError"
760
+ ];
761
+ var equalBytes2 = (left, right) => {
762
+ if (left.byteLength !== right.byteLength)
763
+ return false;
764
+ let diff = 0;
765
+ for (let index = 0; index < left.byteLength; index++)
766
+ diff |= left[index] ^ right[index];
767
+ return diff === 0;
768
+ };
769
+ var isPromiseLike = (value) => typeof value === "object" && value !== null && typeof value.then === "function";
770
+ 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;
771
+ var ManifestVerifier = class {
772
+ constructor(options) {
773
+ __privateAdd(this, _ManifestVerifier_instances);
774
+ __privateAdd(this, _config);
775
+ __privateAdd(this, _verifySignature);
776
+ __privateAdd(this, _onFailure);
777
+ __privateAdd(this, _tracks, /* @__PURE__ */ new Map());
778
+ __privateAdd(this, _stats, {
779
+ verified: 0,
780
+ failures: Object.fromEntries(FAILURE_REASONS.map((reason) => [reason, 0])),
781
+ quarantinedBytes: 0
782
+ });
783
+ __privateAdd(this, _disposed, false);
784
+ __privateSet(this, _config, { ...options.manifestAuth });
785
+ __privateSet(this, _verifySignature, options.verifySignature);
786
+ __privateSet(this, _onFailure, options.onFailure);
787
+ }
788
+ get config() {
789
+ return __privateGet(this, _config);
790
+ }
791
+ get stats() {
792
+ let quarantined = 0;
793
+ for (const track of __privateGet(this, _tracks).values())
794
+ quarantined += track.quarantine.length;
795
+ return {
796
+ verified: __privateGet(this, _stats).verified,
797
+ failures: { ...__privateGet(this, _stats).failures },
798
+ quarantined,
799
+ quarantinedBytes: __privateGet(this, _stats).quarantinedBytes
800
+ };
801
+ }
802
+ setMode(mode) {
803
+ __privateSet(this, _config, { ...__privateGet(this, _config), mode });
804
+ if (mode !== "enforce")
805
+ __privateMethod(this, _ManifestVerifier_instances, releaseAllQuarantine_fn).call(this, false);
806
+ }
807
+ registerTrack(context) {
808
+ const bindingId = context.bindingId ?? context.trackName;
809
+ if (__privateGet(this, _tracks).has(bindingId)) {
810
+ throw new Error(`manifest binding ${bindingId} is already registered`);
811
+ }
812
+ if (!Number.isFinite(context.bitrate) || context.bitrate <= 0) {
813
+ throw new Error("manifest track bitrate must be > 0");
814
+ }
815
+ if (!Number.isFinite(context.groupDurationMs) || context.groupDurationMs <= 0) {
816
+ throw new Error("manifest track groupDurationMs must be > 0");
817
+ }
818
+ if (context.authScope.byteLength !== 32)
819
+ throw new Error("manifest authScope must be 32 bytes");
820
+ if (context.publicKey.byteLength !== 32)
821
+ throw new Error("manifest publicKey must be 32 bytes");
822
+ for (const key of context.acceptedPublicKeys ?? []) {
823
+ if (key.byteLength !== 32)
824
+ throw new Error("manifest acceptedPublicKeys must contain 32-byte keys");
825
+ }
826
+ for (const [name, value] of Object.entries({
827
+ broadcastNamespaceId: context.broadcastNamespaceId,
828
+ trackName: context.trackName,
829
+ codec: context.codec,
830
+ timing: context.timing,
831
+ fecGeometry: context.fecGeometry
832
+ })) {
833
+ if (value.length === 0)
834
+ throw new Error(`manifest ${name} must not be empty`);
835
+ }
836
+ __privateGet(this, _tracks).set(bindingId, {
837
+ context: { ...context, bindingId },
838
+ groups: /* @__PURE__ */ new Map(),
839
+ quarantine: [],
840
+ quarantinedBytes: 0,
841
+ capBytes: Math.ceil(context.bitrate * context.groupDurationMs / 8e3),
842
+ manifestEntries: 0,
843
+ maxManifestEntries: Math.ceil(context.bitrate * context.groupDurationMs / (8e3 * 52)),
844
+ maxGroups: context.mapper.d + 1
845
+ });
846
+ }
847
+ ingestManifestFrame(bindingId, frameBytes) {
848
+ const track = __privateMethod(this, _ManifestVerifier_instances, requireTrack_fn).call(this, bindingId);
849
+ try {
850
+ const frame = decodeSourceAuthManifestFrame(frameBytes);
851
+ const groupId = frame.groupId;
852
+ const group = __privateMethod(this, _ManifestVerifier_instances, group_fn).call(this, track, groupId);
853
+ if (frame.kind === "object") {
854
+ if (group.close || group.signaturePending || group.failed) {
855
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, { trackName: track.context.trackName, bindingId, groupId, objectId: frame.objectId }, "verifierError");
856
+ return;
857
+ }
858
+ if (group.entries.has(frame.objectId)) {
859
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, { trackName: track.context.trackName, bindingId, groupId, objectId: frame.objectId }, "verifierError");
860
+ return;
861
+ }
862
+ if (group.entries.size >= 4096 || track.manifestEntries >= track.maxManifestEntries) {
863
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, { trackName: track.context.trackName, bindingId, groupId, objectId: frame.objectId }, "verifierError");
864
+ return;
865
+ }
866
+ group.entries.set(frame.objectId, frame);
867
+ track.manifestEntries++;
868
+ const pending = group.pending.get(frame.objectId);
869
+ if (pending) {
870
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, pending.identity, "manifestLate");
871
+ __privateMethod(this, _ManifestVerifier_instances, resolvePending_fn).call(this, track, group, pending, frame);
872
+ }
873
+ if (group.pendingClose && group.entries.size === group.pendingClose.objectCount) {
874
+ const close = group.pendingClose;
875
+ group.pendingClose = void 0;
876
+ __privateMethod(this, _ManifestVerifier_instances, closeGroup_fn).call(this, track, groupId, group, close);
877
+ }
878
+ return;
879
+ }
880
+ __privateMethod(this, _ManifestVerifier_instances, closeGroup_fn).call(this, track, groupId, group, frame);
881
+ } catch {
882
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, { trackName: track.context.trackName, bindingId, groupId: 0, objectId: 0 }, "verifierError");
883
+ }
884
+ }
885
+ admitObject(identity, data, release) {
886
+ if (__privateGet(this, _config).mode === "off") {
887
+ release();
888
+ return { action: "play", verified: false };
889
+ }
890
+ const track = __privateGet(this, _tracks).get(identity.bindingId ?? identity.trackName);
891
+ if (!track) {
892
+ release();
893
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, identity, "verifierError");
894
+ return { action: "play", verified: false, reason: "verifierError" };
895
+ }
896
+ try {
897
+ if (!__privateMethod(this, _ManifestVerifier_instances, validateIdentity_fn).call(this, track, identity)) {
898
+ return __privateMethod(this, _ManifestVerifier_instances, rejectOrShadow_fn).call(this, identity, release, "digestMismatch");
899
+ }
900
+ const group = __privateMethod(this, _ManifestVerifier_instances, group_fn).call(this, track, BigInt(identity.groupId));
901
+ if (group.failed === "sigInvalid" || group.failed === "digestMismatch") {
902
+ return __privateMethod(this, _ManifestVerifier_instances, rejectOrShadow_fn).call(this, identity, release, group.failed);
903
+ }
904
+ const entry = group.entries.get(identity.objectId);
905
+ if (entry)
906
+ return __privateMethod(this, _ManifestVerifier_instances, admitAgainstEntry_fn).call(this, track, group, identity, data, release, entry);
907
+ if (__privateGet(this, _config).mode === "shadow" || __privateGet(this, _config).onMissingManifest === "fallback-shadow") {
908
+ release();
909
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, identity, "manifestAbsent");
910
+ return { action: "play", verified: false, reason: "manifestAbsent" };
911
+ }
912
+ if (!__privateMethod(this, _ManifestVerifier_instances, quarantine_fn).call(this, track, group, { identity, data, release, bytes: data.byteLength })) {
913
+ return { action: "drop", verified: false };
914
+ }
915
+ return { action: "stall", verified: false };
916
+ } catch {
917
+ release();
918
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, identity, "verifierError");
919
+ return { action: "play", verified: false, reason: "verifierError" };
920
+ }
921
+ }
922
+ dispose() {
923
+ if (__privateGet(this, _disposed))
924
+ return;
925
+ __privateSet(this, _disposed, true);
926
+ __privateMethod(this, _ManifestVerifier_instances, releaseAllQuarantine_fn).call(this, false);
927
+ __privateGet(this, _tracks).clear();
928
+ }
929
+ };
930
+ _config = new WeakMap();
931
+ _verifySignature = new WeakMap();
932
+ _onFailure = new WeakMap();
933
+ _tracks = new WeakMap();
934
+ _stats = new WeakMap();
935
+ _disposed = new WeakMap();
936
+ _ManifestVerifier_instances = new WeakSet();
937
+ requireTrack_fn = function(bindingId) {
938
+ const track = __privateGet(this, _tracks).get(bindingId);
939
+ if (!track)
940
+ throw new Error(`unknown manifest binding ${bindingId}`);
941
+ return track;
942
+ };
943
+ group_fn = function(track, groupId) {
944
+ let group = track.groups.get(groupId);
945
+ if (!group) {
946
+ group = { entries: /* @__PURE__ */ new Map(), pending: /* @__PURE__ */ new Map(), rootVerified: false };
947
+ track.groups.set(groupId, group);
948
+ while (track.groups.size > track.maxGroups) {
949
+ const oldest = track.groups.entries().next().value;
950
+ if (!oldest)
951
+ break;
952
+ const [oldestId, oldestGroup] = oldest;
953
+ for (const pending of [...oldestGroup.pending.values()]) {
954
+ __privateMethod(this, _ManifestVerifier_instances, removePending_fn).call(this, track, oldestGroup, pending);
955
+ pending.release();
956
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, pending.identity, "manifestAbsent");
957
+ }
958
+ track.manifestEntries -= oldestGroup.entries.size;
959
+ track.groups.delete(oldestId);
960
+ }
961
+ }
962
+ return group;
963
+ };
964
+ validateIdentity_fn = function(track, identity) {
965
+ const coordinates = track.context.mapper.derive(Number(identity.groupId), identity.objectId);
966
+ return identity.ssId === void 0 || coordinates.ssId === identity.ssId;
967
+ };
968
+ admitAgainstEntry_fn = function(track, group, identity, data, release, entry) {
969
+ if (entry.trueLength !== data.byteLength) {
970
+ return __privateMethod(this, _ManifestVerifier_instances, rejectOrShadow_fn).call(this, identity, release, "digestMismatch");
971
+ }
972
+ const digestMatches = equalBytes2(sourceAuthObjectDigest(data.subarray(0, entry.trueLength)), entry.digest);
973
+ if (!digestMatches)
974
+ return __privateMethod(this, _ManifestVerifier_instances, rejectOrShadow_fn).call(this, identity, release, "digestMismatch");
975
+ if (!track.context.manifestChannelAuthenticated && !group.rootVerified) {
976
+ if (__privateGet(this, _config).mode === "shadow") {
977
+ release();
978
+ return { action: "play", verified: false };
979
+ }
980
+ if (!__privateMethod(this, _ManifestVerifier_instances, quarantine_fn).call(this, track, group, { identity, data, release, bytes: data.byteLength })) {
981
+ return { action: "drop", verified: false };
982
+ }
983
+ return { action: "stall", verified: false };
984
+ }
985
+ release();
986
+ __privateGet(this, _stats).verified++;
987
+ return { action: "play", verified: true };
988
+ };
989
+ rejectOrShadow_fn = function(identity, release, reason) {
990
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, identity, reason);
991
+ if (__privateGet(this, _config).mode === "enforce") {
992
+ console.warn(JSON.stringify({ event: "manifest-enforce-drop", track: identity.trackName, group: String(identity.groupId), object: identity.objectId, reason }));
993
+ return { action: "drop", verified: false, reason };
994
+ }
995
+ release();
996
+ return { action: "play", verified: false, reason };
997
+ };
998
+ resolvePending_fn = function(track, group, pending, entry) {
999
+ __privateMethod(this, _ManifestVerifier_instances, removePending_fn).call(this, track, group, pending);
1000
+ __privateMethod(this, _ManifestVerifier_instances, admitAgainstEntry_fn).call(this, track, group, pending.identity, pending.data, pending.release, entry);
1001
+ };
1002
+ closeGroup_fn = function(track, groupId, group, close) {
1003
+ if (group.close || group.signaturePending)
1004
+ return;
1005
+ const entries = [...group.entries.values()];
1006
+ if (entries.length !== close.objectCount) {
1007
+ group.pendingClose = close;
1008
+ const hadPending = group.pending.size > 0;
1009
+ if (__privateGet(this, _config).onMissingManifest === "fallback-shadow" || __privateGet(this, _config).mode === "shadow") {
1010
+ for (const pending of [...group.pending.values()]) {
1011
+ __privateMethod(this, _ManifestVerifier_instances, removePending_fn).call(this, track, group, pending);
1012
+ pending.release();
1013
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, pending.identity, "manifestAbsent");
1014
+ }
1015
+ } else {
1016
+ for (const pending of group.pending.values()) {
1017
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, pending.identity, "manifestAbsent");
1018
+ }
1019
+ }
1020
+ if (!hadPending) {
1021
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, { trackName: track.context.trackName, groupId, objectId: 0 }, "manifestAbsent");
1022
+ }
1023
+ return;
1024
+ }
1025
+ if (!equalBytes2(sourceAuthMerkleRoot(entries), close.root)) {
1026
+ group.failed = "digestMismatch";
1027
+ __privateMethod(this, _ManifestVerifier_instances, failGroup_fn).call(this, track, groupId, group, "digestMismatch");
1028
+ return;
1029
+ }
1030
+ const preimage = sourceAuthSignaturePreimage(track.context.authScope, close.groupId, close.objectCount, close.root);
1031
+ let signatureValid;
1032
+ try {
1033
+ signatureValid = __privateMethod(this, _ManifestVerifier_instances, verifyAcceptedSignature_fn).call(this, track, preimage, close.signature);
1034
+ } catch {
1035
+ __privateMethod(this, _ManifestVerifier_instances, failOpenGroup_fn).call(this, track, groupId, group);
1036
+ return;
1037
+ }
1038
+ if (isPromiseLike(signatureValid)) {
1039
+ group.signaturePending = true;
1040
+ void signatureValid.then((valid) => {
1041
+ if (__privateGet(this, _disposed))
1042
+ return;
1043
+ group.signaturePending = false;
1044
+ __privateMethod(this, _ManifestVerifier_instances, finishGroupSignature_fn).call(this, track, groupId, group, close, valid);
1045
+ }, () => {
1046
+ if (__privateGet(this, _disposed))
1047
+ return;
1048
+ group.signaturePending = false;
1049
+ __privateMethod(this, _ManifestVerifier_instances, failOpenGroup_fn).call(this, track, groupId, group);
1050
+ });
1051
+ return;
1052
+ }
1053
+ __privateMethod(this, _ManifestVerifier_instances, finishGroupSignature_fn).call(this, track, groupId, group, close, signatureValid);
1054
+ };
1055
+ finishGroupSignature_fn = function(track, groupId, group, close, signatureValid) {
1056
+ if (!signatureValid) {
1057
+ group.failed = "sigInvalid";
1058
+ __privateMethod(this, _ManifestVerifier_instances, failGroup_fn).call(this, track, groupId, group, "sigInvalid");
1059
+ return;
1060
+ }
1061
+ group.failed = void 0;
1062
+ group.close = close;
1063
+ group.pendingClose = void 0;
1064
+ group.rootVerified = true;
1065
+ for (const pending of [...group.pending.values()]) {
1066
+ const entry = group.entries.get(pending.identity.objectId);
1067
+ if (entry)
1068
+ __privateMethod(this, _ManifestVerifier_instances, resolvePending_fn).call(this, track, group, pending, entry);
1069
+ else if (__privateGet(this, _config).onMissingManifest === "fallback-shadow") {
1070
+ __privateMethod(this, _ManifestVerifier_instances, removePending_fn).call(this, track, group, pending);
1071
+ pending.release();
1072
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, pending.identity, "manifestAbsent");
1073
+ }
1074
+ }
1075
+ };
1076
+ verifyAcceptedSignature_fn = function(track, message, signature) {
1077
+ const keys = track.context.acceptedPublicKeys ?? [track.context.publicKey];
1078
+ const pending = [];
1079
+ let hadSynchronousError = false;
1080
+ for (const key of keys) {
1081
+ try {
1082
+ const result = __privateGet(this, _verifySignature).call(this, key, message, signature);
1083
+ if (isPromiseLike(result)) {
1084
+ pending.push(Promise.resolve(result).then((valid) => valid, () => "error"));
1085
+ } else if (result) {
1086
+ return true;
1087
+ }
1088
+ } catch {
1089
+ hadSynchronousError = true;
1090
+ }
1091
+ }
1092
+ if (pending.length === 0) {
1093
+ if (hadSynchronousError)
1094
+ throw new Error("manifest signature verifier unavailable");
1095
+ return false;
1096
+ }
1097
+ return Promise.all(pending).then((results) => {
1098
+ if (results.some((valid) => valid === true))
1099
+ return true;
1100
+ if (hadSynchronousError || results.some((valid) => valid === "error")) {
1101
+ throw new Error("manifest signature verifier unavailable");
1102
+ }
1103
+ return false;
1104
+ });
1105
+ };
1106
+ failGroup_fn = function(track, groupId, group, reason) {
1107
+ if (group.pending.size === 0) {
1108
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, { trackName: track.context.trackName, groupId, objectId: 0 }, reason);
1109
+ return;
1110
+ }
1111
+ for (const pending of [...group.pending.values()]) {
1112
+ __privateMethod(this, _ManifestVerifier_instances, removePending_fn).call(this, track, group, pending);
1113
+ __privateMethod(this, _ManifestVerifier_instances, rejectOrShadow_fn).call(this, pending.identity, pending.release, reason);
1114
+ }
1115
+ };
1116
+ removePending_fn = function(track, group, pending) {
1117
+ if (group.pending.get(pending.identity.objectId) === pending) {
1118
+ group.pending.delete(pending.identity.objectId);
1119
+ }
1120
+ const index = track.quarantine.indexOf(pending);
1121
+ if (index >= 0)
1122
+ track.quarantine.splice(index, 1);
1123
+ track.quarantinedBytes -= pending.bytes;
1124
+ __privateGet(this, _stats).quarantinedBytes -= pending.bytes;
1125
+ };
1126
+ quarantine_fn = function(track, group, pending) {
1127
+ if (group.pending.has(pending.identity.objectId))
1128
+ return false;
1129
+ group.pending.set(pending.identity.objectId, pending);
1130
+ track.quarantine.push(pending);
1131
+ track.quarantinedBytes += pending.bytes;
1132
+ __privateGet(this, _stats).quarantinedBytes += pending.bytes;
1133
+ __privateMethod(this, _ManifestVerifier_instances, enforceCap_fn).call(this, track);
1134
+ return true;
1135
+ };
1136
+ enforceCap_fn = function(track) {
1137
+ while (track.quarantinedBytes > track.capBytes && track.quarantine.length > 0) {
1138
+ const pending = track.quarantine.shift();
1139
+ const group = track.groups.get(BigInt(pending.identity.groupId));
1140
+ if (group)
1141
+ group.pending.delete(pending.identity.objectId);
1142
+ track.quarantinedBytes -= pending.bytes;
1143
+ __privateGet(this, _stats).quarantinedBytes -= pending.bytes;
1144
+ pending.release();
1145
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, pending.identity, "manifestAbsent");
1146
+ console.warn(`[ManifestVerifier] quarantine cap eviction fail-open track=${pending.identity.trackName} group=${pending.identity.groupId} object=${pending.identity.objectId}`);
1147
+ }
1148
+ };
1149
+ failOpenTrack_fn = function(track, reason) {
1150
+ for (const pending of [...track.quarantine]) {
1151
+ const group = track.groups.get(BigInt(pending.identity.groupId));
1152
+ if (group)
1153
+ __privateMethod(this, _ManifestVerifier_instances, removePending_fn).call(this, track, group, pending);
1154
+ pending.release();
1155
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, pending.identity, reason);
1156
+ }
1157
+ };
1158
+ failOpenGroup_fn = function(track, groupId, group) {
1159
+ const pending = [...group.pending.values()];
1160
+ if (pending.length === 0) {
1161
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, { trackName: track.context.trackName, groupId, objectId: 0 }, "verifierError");
1162
+ return;
1163
+ }
1164
+ for (const object of pending) {
1165
+ __privateMethod(this, _ManifestVerifier_instances, removePending_fn).call(this, track, group, object);
1166
+ object.release();
1167
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, object.identity, "verifierError");
1168
+ }
1169
+ };
1170
+ releaseAllQuarantine_fn = function(countFailure) {
1171
+ for (const track of __privateGet(this, _tracks).values()) {
1172
+ for (const pending of [...track.quarantine]) {
1173
+ const group = track.groups.get(BigInt(pending.identity.groupId));
1174
+ if (group)
1175
+ __privateMethod(this, _ManifestVerifier_instances, removePending_fn).call(this, track, group, pending);
1176
+ pending.release();
1177
+ if (countFailure)
1178
+ __privateMethod(this, _ManifestVerifier_instances, failure_fn).call(this, pending.identity, "verifierError");
1179
+ }
1180
+ }
1181
+ };
1182
+ failure_fn = function(identity, reason) {
1183
+ var _a;
1184
+ __privateGet(this, _stats).failures[reason]++;
1185
+ (_a = __privateGet(this, _onFailure)) == null ? void 0 : _a.call(this, {
1186
+ trackName: identity.trackName,
1187
+ ...identity.bindingId === void 0 ? {} : { bindingId: identity.bindingId },
1188
+ groupId: identity.groupId,
1189
+ objectId: identity.objectId,
1190
+ reason
1191
+ });
1192
+ };
1193
+ export {
1194
+ ManifestVerifier,
1195
+ SOURCE_AUTH_GROUP_CLOSE_FRAME,
1196
+ SOURCE_AUTH_GROUP_CLOSE_LENGTH,
1197
+ SOURCE_AUTH_MANIFEST_VERSION,
1198
+ SOURCE_AUTH_MAX_OBJECTS_PER_GROUP,
1199
+ SOURCE_AUTH_MAX_TRUE_LENGTH,
1200
+ SOURCE_AUTH_OBJECT_ENTRY_FRAME,
1201
+ SOURCE_AUTH_OBJECT_ENTRY_LENGTH,
1202
+ SOURCE_AUTH_SCOPE_LENGTH,
1203
+ SourceAuthAdmission,
1204
+ createWebCryptoEd25519Verifier,
1205
+ decodeSourceAuthManifestFrame,
1206
+ encodeSourceAuthGroupClose,
1207
+ encodeSourceAuthObjectEntry,
1208
+ manifestBindingId,
1209
+ sourceAuthLeafHash,
1210
+ sourceAuthMerkleRoot,
1211
+ sourceAuthObjectDigest,
1212
+ sourceAuthSignaturePreimage,
1213
+ trimRecoveredSourceAuthObject
1214
+ };
1215
+ /*! Bundled license information:
1216
+
1217
+ @noble/hashes/esm/utils.js:
1218
+ (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
1219
+ */
1220
+ //# sourceMappingURL=source-auth.js.map