@openclaw/whatsapp 2026.9.6 → 2026.9.7

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 (354) hide show
  1. package/assets/icon.png +0 -0
  2. package/dist/.setup/{accounts-D_NGDjCx.mjs → accounts-CtRPAQCL.mjs} +3 -9
  3. package/dist/.setup/{action-runtime-DZZFamfl.mjs → action-runtime-DeVk5V7r.mjs} +2 -2
  4. package/dist/.setup/{approval-handler.runtime-C0hzmMSj.mjs → approval-handler.runtime-CjqMlPOX.mjs} +6 -26
  5. package/dist/.setup/{approval-reactions-BnXw-UZI.mjs → approval-reactions-DiOFvb1s.mjs} +8 -14
  6. package/dist/.setup/{auth-store-Dh8a3cba.mjs → auth-store-BBonwKks.mjs} +9 -33
  7. package/dist/.setup/{channel-Bg_fS2iF.mjs → channel-CJFE0kD_.mjs} +82 -154
  8. package/dist/.setup/{channel-react-action-1iBiEnq7.mjs → channel-react-action-2r_hjLZV.mjs} +4 -8
  9. package/dist/.setup/{channel.runtime-rurG-kbr.mjs → channel.runtime-C94goLw9.mjs} +4 -4
  10. package/dist/.setup/{channel.setup-C8P5q8uD.mjs → channel.setup-CfN1UfdY.mjs} +1 -1
  11. package/dist/.setup/{connection-controller-C60mU7j7.mjs → connection-controller-CHo1oRJA.mjs} +13 -63
  12. package/dist/.setup/{creds-files-Drg3usj1.mjs → creds-files-CDATZWWM.mjs} +5 -11
  13. package/dist/.setup/{directory-config-BHPoBklt.mjs → directory-config-DUiJ5d8I.mjs} +13 -14
  14. package/dist/.setup/doctor-iMwg0Vhr.mjs +222 -0
  15. package/dist/.setup/group-config-path-DZr3ucUO.mjs +40 -0
  16. package/dist/.setup/{group-session-key-D22hYMdE.mjs → group-session-key-2-mja4OF.mjs} +3 -9
  17. package/dist/.setup/{login-2dmd1TfE.mjs → login-BFlvSh9h.mjs} +9 -11
  18. package/dist/.setup/{login-qr-CgKtO_ef.mjs → login-qr-Ayb8i25J.mjs} +29 -77
  19. package/dist/.setup/{monitor-By82ehLA.mjs → monitor-CGpV2VNN.mjs} +376 -504
  20. package/dist/.setup/{question-reactions-D3Zq9Gbn.mjs → question-reactions-CPyyi5AY.mjs} +2 -2
  21. package/dist/.setup/rolldown-runtime-BBjsoOtd.mjs +27 -0
  22. package/dist/.setup/{send-C6jDmcL9.mjs → send-BGdvf5cC.mjs} +31 -80
  23. package/dist/.setup/{send-api-B4DOt2RJ.mjs → send-api-H4AkQJjT.mjs} +45 -109
  24. package/dist/.setup/{session-errors-JuazczrA.mjs → session-errors-B8UcAnZN.mjs} +1 -4
  25. package/dist/.setup/{session.runtime-DcJuO42v.mjs → session.runtime-st1konFI.mjs} +1 -1
  26. package/dist/.setup/{setup-finalize-pGqWOiFX.mjs → setup-finalize-DmPX4EaW.mjs} +32 -70
  27. package/dist/.setup/setup-plugin-api-vJlxKzca.mjs +3 -0
  28. package/dist/.setup/{setup-surface-B9CYwDPZ.mjs → setup-surface-43fj197P.mjs} +3 -3
  29. package/dist/.setup/{shared-DVgQ8kRG.mjs → shared-DgOG5Iqr.mjs} +26 -37
  30. package/dist/.setup/{socket-close-CCVSFufF.mjs → socket-close-CT__V2fz.mjs} +80 -92
  31. package/dist/.setup/{targets-runtime-RBjx3pg_.mjs → targets-runtime-DmiqXIXO.mjs} +2 -7
  32. package/dist/action-runtime-api.js +1 -1
  33. package/dist/action-runtime.runtime.js +1 -1
  34. package/dist/agent-tools-api.js +5 -12
  35. package/dist/api.js +10 -10
  36. package/dist/auth-presence.js +1 -1
  37. package/dist/channel-plugin-api.js +1 -1
  38. package/dist/contract-api.js +2 -2
  39. package/dist/directory-contract-api.js +1 -1
  40. package/dist/doctor-contract-api.js +9 -10
  41. package/dist/light-runtime-api.js +2 -2
  42. package/dist/login-qr-runtime.js +1 -1
  43. package/dist/runtime-api.js +9 -9
  44. package/dist/setup-entry.js +1 -1
  45. package/dist/setup-plugin-api.js +1 -1
  46. package/node_modules/audio-decode/LICENSE +9 -10
  47. package/node_modules/audio-decode/README.md +16 -0
  48. package/node_modules/audio-decode/audio-decode.d.ts +2 -14
  49. package/node_modules/audio-decode/audio-decode.js +4 -92
  50. package/node_modules/audio-decode/meta.js +1 -0
  51. package/node_modules/audio-decode/node_modules/{audio-buffer → @audio/decode}/LICENSE +1 -1
  52. package/node_modules/audio-decode/node_modules/@audio/decode/audio-decode.d.ts +52 -0
  53. package/node_modules/audio-decode/node_modules/@audio/decode/audio-decode.js +242 -0
  54. package/node_modules/audio-decode/node_modules/@audio/decode/meta.js +14 -0
  55. package/node_modules/audio-decode/node_modules/@audio/decode/package.json +114 -0
  56. package/node_modules/audio-decode/node_modules/@audio/decode/readme.md +191 -0
  57. package/node_modules/audio-decode/node_modules/@audio/decode/stream.d.ts +12 -0
  58. package/node_modules/audio-decode/node_modules/@audio/decode/stream.js +1 -0
  59. package/node_modules/audio-decode/node_modules/@audio/decode/test.html +52 -0
  60. package/node_modules/audio-decode/node_modules/@audio/decode-aac/LICENSE +9 -0
  61. package/node_modules/audio-decode/node_modules/@audio/decode-aac/README.md +80 -0
  62. package/node_modules/audio-decode/node_modules/@audio/decode-aac/alac.js +326 -0
  63. package/node_modules/audio-decode/node_modules/@audio/decode-aac/audio.d.ts +15 -0
  64. package/node_modules/audio-decode/node_modules/@audio/decode-aac/audio.js +10 -0
  65. package/node_modules/audio-decode/node_modules/@audio/decode-aac/decode-aac.d.ts +24 -0
  66. package/node_modules/audio-decode/node_modules/@audio/decode-aac/decode-aac.js +452 -0
  67. package/node_modules/audio-decode/node_modules/@audio/decode-aac/meta.js +81 -0
  68. package/node_modules/audio-decode/node_modules/@audio/decode-aac/package.json +63 -0
  69. package/node_modules/audio-decode/node_modules/@audio/decode-aac/src/aac.wasm.js +0 -0
  70. package/node_modules/audio-decode/node_modules/@audio/decode-ac3/LICENSE +12 -0
  71. package/node_modules/audio-decode/node_modules/@audio/decode-ac3/LICENSE.liba52 +340 -0
  72. package/node_modules/audio-decode/node_modules/@audio/decode-ac3/README.md +41 -0
  73. package/node_modules/audio-decode/node_modules/@audio/decode-ac3/audio.d.ts +15 -0
  74. package/node_modules/audio-decode/node_modules/@audio/decode-ac3/audio.js +9 -0
  75. package/node_modules/audio-decode/node_modules/@audio/decode-ac3/decode-ac3.d.ts +20 -0
  76. package/node_modules/audio-decode/node_modules/@audio/decode-ac3/decode-ac3.js +131 -0
  77. package/node_modules/audio-decode/node_modules/@audio/decode-ac3/package.json +64 -0
  78. package/node_modules/audio-decode/node_modules/@audio/decode-ac3/src/ac3.wasm.js +0 -0
  79. package/node_modules/audio-decode/node_modules/@audio/decode-aiff/LICENSE +21 -0
  80. package/node_modules/audio-decode/node_modules/@audio/decode-aiff/README.md +46 -0
  81. package/node_modules/audio-decode/node_modules/@audio/decode-aiff/audio.d.ts +15 -0
  82. package/node_modules/audio-decode/node_modules/@audio/decode-aiff/audio.js +10 -0
  83. package/node_modules/audio-decode/node_modules/@audio/decode-aiff/decode-aiff.d.ts +16 -0
  84. package/node_modules/audio-decode/node_modules/@audio/decode-aiff/decode-aiff.js +583 -0
  85. package/node_modules/audio-decode/node_modules/@audio/decode-aiff/package.json +52 -0
  86. package/node_modules/audio-decode/node_modules/@audio/decode-amr/LICENSE +191 -0
  87. package/node_modules/audio-decode/node_modules/@audio/decode-amr/README.md +65 -0
  88. package/node_modules/audio-decode/node_modules/@audio/decode-amr/audio.d.ts +15 -0
  89. package/node_modules/audio-decode/node_modules/@audio/decode-amr/audio.js +10 -0
  90. package/node_modules/audio-decode/node_modules/@audio/decode-amr/decode-amr.d.ts +16 -0
  91. package/node_modules/audio-decode/node_modules/@audio/decode-amr/decode-amr.js +150 -0
  92. package/node_modules/audio-decode/node_modules/@audio/decode-amr/package.json +58 -0
  93. package/node_modules/audio-decode/node_modules/@audio/decode-amr/src/amr.wasm.js +0 -0
  94. package/node_modules/audio-decode/node_modules/@audio/decode-avi/LICENSE +21 -0
  95. package/node_modules/audio-decode/node_modules/@audio/decode-avi/README.md +53 -0
  96. package/node_modules/audio-decode/node_modules/@audio/decode-avi/audio.d.ts +15 -0
  97. package/node_modules/audio-decode/node_modules/@audio/decode-avi/audio.js +9 -0
  98. package/node_modules/audio-decode/node_modules/@audio/decode-avi/decode-avi.d.ts +21 -0
  99. package/node_modules/audio-decode/node_modules/@audio/decode-avi/decode-avi.js +241 -0
  100. package/node_modules/audio-decode/node_modules/@audio/decode-avi/package.json +66 -0
  101. package/node_modules/audio-decode/node_modules/@audio/decode-caf/LICENSE +21 -0
  102. package/node_modules/audio-decode/node_modules/@audio/decode-caf/README.md +48 -0
  103. package/node_modules/audio-decode/node_modules/@audio/decode-caf/audio.d.ts +15 -0
  104. package/node_modules/audio-decode/node_modules/@audio/decode-caf/audio.js +10 -0
  105. package/node_modules/audio-decode/node_modules/@audio/decode-caf/decode-caf.d.ts +16 -0
  106. package/node_modules/audio-decode/node_modules/@audio/decode-caf/decode-caf.js +238 -0
  107. package/node_modules/audio-decode/node_modules/@audio/decode-caf/package.json +53 -0
  108. package/node_modules/audio-decode/node_modules/@audio/decode-dsd/LICENSE +21 -0
  109. package/node_modules/audio-decode/node_modules/@audio/decode-dsd/README.md +73 -0
  110. package/node_modules/audio-decode/node_modules/@audio/decode-dsd/audio.d.ts +21 -0
  111. package/node_modules/audio-decode/node_modules/@audio/decode-dsd/audio.js +15 -0
  112. package/node_modules/audio-decode/node_modules/@audio/decode-dsd/decode-dsd.d.ts +29 -0
  113. package/node_modules/audio-decode/node_modules/@audio/decode-dsd/decode-dsd.js +423 -0
  114. package/node_modules/audio-decode/node_modules/@audio/decode-dsd/meta.js +40 -0
  115. package/node_modules/audio-decode/node_modules/@audio/decode-dsd/package.json +64 -0
  116. package/node_modules/audio-decode/node_modules/@audio/decode-dts/LICENSE +12 -0
  117. package/node_modules/audio-decode/node_modules/@audio/decode-dts/LICENSE.libdca +339 -0
  118. package/node_modules/audio-decode/node_modules/@audio/decode-dts/README.md +41 -0
  119. package/node_modules/audio-decode/node_modules/@audio/decode-dts/audio.d.ts +15 -0
  120. package/node_modules/audio-decode/node_modules/@audio/decode-dts/audio.js +9 -0
  121. package/node_modules/audio-decode/node_modules/@audio/decode-dts/decode-dts.d.ts +20 -0
  122. package/node_modules/audio-decode/node_modules/@audio/decode-dts/decode-dts.js +139 -0
  123. package/node_modules/audio-decode/node_modules/@audio/decode-dts/package.json +64 -0
  124. package/node_modules/audio-decode/node_modules/@audio/decode-dts/src/dts.wasm.js +0 -0
  125. package/node_modules/audio-decode/node_modules/@audio/decode-eac3/LICENSE +12 -0
  126. package/node_modules/audio-decode/node_modules/@audio/decode-eac3/LICENSE.ffmpeg +502 -0
  127. package/node_modules/audio-decode/node_modules/@audio/decode-eac3/README.md +45 -0
  128. package/node_modules/audio-decode/node_modules/@audio/decode-eac3/audio.d.ts +15 -0
  129. package/node_modules/audio-decode/node_modules/@audio/decode-eac3/audio.js +9 -0
  130. package/node_modules/audio-decode/node_modules/@audio/decode-eac3/decode-eac3.d.ts +20 -0
  131. package/node_modules/audio-decode/node_modules/@audio/decode-eac3/decode-eac3.js +124 -0
  132. package/node_modules/audio-decode/node_modules/@audio/decode-eac3/package.json +68 -0
  133. package/node_modules/audio-decode/node_modules/@audio/decode-eac3/src/eac3.wasm.js +0 -0
  134. package/node_modules/audio-decode/node_modules/@audio/decode-flac/LICENSE +25 -0
  135. package/node_modules/audio-decode/node_modules/@audio/decode-flac/README.md +23 -0
  136. package/node_modules/audio-decode/node_modules/@audio/decode-flac/audio.d.ts +15 -0
  137. package/node_modules/audio-decode/node_modules/@audio/decode-flac/audio.js +10 -0
  138. package/node_modules/audio-decode/node_modules/@audio/decode-flac/decode-flac.d.ts +18 -0
  139. package/node_modules/audio-decode/node_modules/@audio/decode-flac/decode-flac.js +3172 -0
  140. package/node_modules/audio-decode/node_modules/@audio/decode-flac/meta.js +115 -0
  141. package/node_modules/audio-decode/node_modules/@audio/decode-flac/package.json +60 -0
  142. package/node_modules/audio-decode/node_modules/@audio/decode-mod/LICENSE +23 -0
  143. package/node_modules/audio-decode/node_modules/@audio/decode-mod/LICENSE.libopenmpt +25 -0
  144. package/node_modules/audio-decode/node_modules/@audio/decode-mod/README.md +86 -0
  145. package/node_modules/audio-decode/node_modules/@audio/decode-mod/audio.d.ts +20 -0
  146. package/node_modules/audio-decode/node_modules/@audio/decode-mod/audio.js +12 -0
  147. package/node_modules/audio-decode/node_modules/@audio/decode-mod/decode-mod.d.ts +58 -0
  148. package/node_modules/audio-decode/node_modules/@audio/decode-mod/decode-mod.js +148 -0
  149. package/node_modules/audio-decode/node_modules/@audio/decode-mod/package.json +68 -0
  150. package/node_modules/audio-decode/node_modules/@audio/decode-mod/src/mod.wasm.js +0 -0
  151. package/node_modules/audio-decode/node_modules/@audio/decode-mp3/LICENSE +25 -0
  152. package/node_modules/audio-decode/node_modules/@audio/decode-mp3/README.md +20 -0
  153. package/node_modules/audio-decode/node_modules/@audio/decode-mp3/audio.d.ts +15 -0
  154. package/node_modules/audio-decode/node_modules/@audio/decode-mp3/audio.js +10 -0
  155. package/node_modules/audio-decode/node_modules/@audio/decode-mp3/decode-mp3.d.ts +16 -0
  156. package/node_modules/audio-decode/node_modules/@audio/decode-mp3/decode-mp3.js +793 -0
  157. package/node_modules/audio-decode/node_modules/@audio/decode-mp3/meta.js +143 -0
  158. package/node_modules/audio-decode/node_modules/@audio/decode-mp3/package.json +60 -0
  159. package/node_modules/audio-decode/node_modules/@audio/decode-mp4/LICENSE +21 -0
  160. package/node_modules/audio-decode/node_modules/@audio/decode-mp4/README.md +58 -0
  161. package/node_modules/audio-decode/node_modules/@audio/decode-mp4/audio.d.ts +15 -0
  162. package/node_modules/audio-decode/node_modules/@audio/decode-mp4/audio.js +9 -0
  163. package/node_modules/audio-decode/node_modules/@audio/decode-mp4/decode-mp4.d.ts +21 -0
  164. package/node_modules/audio-decode/node_modules/@audio/decode-mp4/decode-mp4.js +455 -0
  165. package/node_modules/audio-decode/node_modules/@audio/decode-mp4/package.json +74 -0
  166. package/node_modules/audio-decode/node_modules/@audio/decode-mpc/LICENSE +31 -0
  167. package/node_modules/audio-decode/node_modules/@audio/decode-mpc/LICENSE.libmpcdec +31 -0
  168. package/node_modules/audio-decode/node_modules/@audio/decode-mpc/README.md +60 -0
  169. package/node_modules/audio-decode/node_modules/@audio/decode-mpc/audio.d.ts +15 -0
  170. package/node_modules/audio-decode/node_modules/@audio/decode-mpc/audio.js +9 -0
  171. package/node_modules/audio-decode/node_modules/@audio/decode-mpc/decode-mpc.d.ts +20 -0
  172. package/node_modules/audio-decode/node_modules/@audio/decode-mpc/decode-mpc.js +158 -0
  173. package/node_modules/audio-decode/node_modules/@audio/decode-mpc/package.json +64 -0
  174. package/node_modules/audio-decode/node_modules/@audio/decode-mpc/src/mpc.wasm.js +0 -0
  175. package/node_modules/audio-decode/node_modules/@audio/decode-opus/LICENSE +25 -0
  176. package/node_modules/audio-decode/node_modules/@audio/decode-opus/LICENSE.libopus +44 -0
  177. package/node_modules/audio-decode/node_modules/@audio/decode-opus/README.md +32 -0
  178. package/node_modules/audio-decode/node_modules/@audio/decode-opus/audio.d.ts +15 -0
  179. package/node_modules/audio-decode/node_modules/@audio/decode-opus/audio.js +10 -0
  180. package/node_modules/audio-decode/node_modules/@audio/decode-opus/core.d.ts +33 -0
  181. package/node_modules/audio-decode/node_modules/@audio/decode-opus/core.js +147 -0
  182. package/node_modules/audio-decode/node_modules/@audio/decode-opus/decode-opus.d.ts +18 -0
  183. package/node_modules/audio-decode/node_modules/@audio/decode-opus/decode-opus.js +1 -0
  184. package/node_modules/audio-decode/node_modules/@audio/decode-opus/meta.js +103 -0
  185. package/node_modules/audio-decode/node_modules/@audio/decode-opus/package.json +68 -0
  186. package/node_modules/audio-decode/node_modules/@audio/decode-opus/src/decode-opus.js +2 -0
  187. package/node_modules/audio-decode/node_modules/@audio/decode-opus/src/opus.wasm.js +0 -0
  188. package/node_modules/audio-decode/node_modules/@audio/decode-qoa/LICENSE +25 -0
  189. package/node_modules/audio-decode/node_modules/@audio/decode-qoa/README.md +19 -0
  190. package/node_modules/audio-decode/node_modules/@audio/decode-qoa/audio.d.ts +15 -0
  191. package/node_modules/audio-decode/node_modules/@audio/decode-qoa/audio.js +10 -0
  192. package/node_modules/audio-decode/node_modules/@audio/decode-qoa/decode-qoa.d.ts +16 -0
  193. package/node_modules/audio-decode/node_modules/@audio/decode-qoa/decode-qoa.js +275 -0
  194. package/node_modules/audio-decode/node_modules/@audio/decode-qoa/package.json +56 -0
  195. package/node_modules/audio-decode/node_modules/@audio/decode-tta/LICENSE +21 -0
  196. package/node_modules/audio-decode/node_modules/@audio/decode-tta/LICENSE.ttadec +39 -0
  197. package/node_modules/audio-decode/node_modules/@audio/decode-tta/README.md +58 -0
  198. package/node_modules/audio-decode/node_modules/@audio/decode-tta/audio.d.ts +15 -0
  199. package/node_modules/audio-decode/node_modules/@audio/decode-tta/audio.js +9 -0
  200. package/node_modules/audio-decode/node_modules/@audio/decode-tta/decode-tta.d.ts +17 -0
  201. package/node_modules/audio-decode/node_modules/@audio/decode-tta/decode-tta.js +302 -0
  202. package/node_modules/audio-decode/node_modules/@audio/decode-tta/package.json +58 -0
  203. package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/LICENSE +25 -0
  204. package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/README.md +33 -0
  205. package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/audio.d.ts +15 -0
  206. package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/audio.js +10 -0
  207. package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/decode-vorbis.d.ts +18 -0
  208. package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/decode-vorbis.js +2984 -0
  209. package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/meta.js +102 -0
  210. package/node_modules/audio-decode/node_modules/@audio/decode-vorbis/package.json +60 -0
  211. package/node_modules/audio-decode/node_modules/@audio/decode-wav/LICENSE +21 -0
  212. package/node_modules/audio-decode/node_modules/@audio/decode-wav/README.md +23 -0
  213. package/node_modules/audio-decode/node_modules/@audio/decode-wav/audio.d.ts +15 -0
  214. package/node_modules/audio-decode/node_modules/@audio/decode-wav/audio.js +10 -0
  215. package/node_modules/audio-decode/node_modules/@audio/decode-wav/decode-wav.d.ts +8 -0
  216. package/node_modules/audio-decode/node_modules/@audio/decode-wav/decode-wav.js +256 -0
  217. package/node_modules/audio-decode/node_modules/@audio/decode-wav/meta.js +114 -0
  218. package/node_modules/audio-decode/node_modules/@audio/decode-wav/package.json +52 -0
  219. package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/LICENSE +29 -0
  220. package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/LICENSE.wavpack +25 -0
  221. package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/README.md +41 -0
  222. package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/audio.d.ts +15 -0
  223. package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/audio.js +9 -0
  224. package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/decode-wavpack.d.ts +18 -0
  225. package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/decode-wavpack.js +140 -0
  226. package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/package.json +62 -0
  227. package/node_modules/audio-decode/node_modules/@audio/decode-wavpack/src/wavpack.wasm.js +0 -0
  228. package/node_modules/audio-decode/node_modules/@audio/decode-webm/LICENSE +21 -0
  229. package/node_modules/audio-decode/node_modules/@audio/decode-webm/LICENSE.libopus +44 -0
  230. package/node_modules/audio-decode/node_modules/@audio/decode-webm/README.md +59 -0
  231. package/node_modules/audio-decode/node_modules/@audio/decode-webm/audio.d.ts +15 -0
  232. package/node_modules/audio-decode/node_modules/@audio/decode-webm/audio.js +10 -0
  233. package/node_modules/audio-decode/node_modules/@audio/decode-webm/decode-webm.d.ts +18 -0
  234. package/node_modules/audio-decode/node_modules/@audio/decode-webm/decode-webm.js +141 -0
  235. package/node_modules/audio-decode/node_modules/@audio/decode-webm/package.json +76 -0
  236. package/node_modules/audio-decode/node_modules/@audio/decode-webm/src/opus.wasm.js +0 -0
  237. package/node_modules/audio-decode/node_modules/@audio/decode-wma/LICENSE +12 -0
  238. package/node_modules/audio-decode/node_modules/@audio/decode-wma/README.md +74 -0
  239. package/node_modules/audio-decode/node_modules/@audio/decode-wma/audio.d.ts +15 -0
  240. package/node_modules/audio-decode/node_modules/@audio/decode-wma/audio.js +10 -0
  241. package/node_modules/audio-decode/node_modules/@audio/decode-wma/decode-wma.d.ts +33 -0
  242. package/node_modules/audio-decode/node_modules/@audio/decode-wma/decode-wma.js +516 -0
  243. package/node_modules/audio-decode/node_modules/@audio/decode-wma/package.json +57 -0
  244. package/node_modules/audio-decode/node_modules/@audio/decode-wma/src/wma.wasm.js +0 -0
  245. package/node_modules/audio-decode/package.json +37 -39
  246. package/node_modules/audio-decode/stream.d.ts +2 -0
  247. package/node_modules/audio-decode/stream.js +2 -0
  248. package/node_modules/baileys/lib/Utils/messages-media.js +1 -1
  249. package/node_modules/baileys/node_modules/file-type/package.json +1 -1
  250. package/node_modules/baileys/node_modules/file-type/readme.md +2 -0
  251. package/node_modules/baileys/node_modules/file-type/source/detectors/zip.js +9 -4
  252. package/node_modules/baileys/package.json +1 -1
  253. package/node_modules/typebox/build/compile/code.mjs +1 -2
  254. package/node_modules/typebox/build/compile/validator.mjs +5 -1
  255. package/node_modules/typebox/build/format/iri.mjs +16 -9
  256. package/node_modules/typebox/build/guard/emit.mjs +2 -2
  257. package/node_modules/typebox/build/guard/guard.d.mts +7 -5
  258. package/node_modules/typebox/build/guard/guard.mjs +14 -9
  259. package/node_modules/typebox/build/guard/index.mjs +6 -0
  260. package/node_modules/typebox/build/guard/unicode/unicode.d.mts +6 -0
  261. package/node_modules/typebox/build/guard/unicode/unicode.mjs +35 -0
  262. package/node_modules/typebox/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
  263. package/node_modules/typebox/build/schema/build.mjs +2 -3
  264. package/node_modules/typebox/build/schema/engine/_pathing.d.mts +1 -0
  265. package/node_modules/typebox/build/schema/engine/_pathing.mjs +11 -0
  266. package/node_modules/typebox/build/schema/engine/_refine.mjs +13 -5
  267. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +2 -1
  268. package/node_modules/typebox/build/schema/engine/dependencies.mjs +2 -1
  269. package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +2 -1
  270. package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +1 -1
  271. package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +2 -2
  272. package/node_modules/typebox/build/schema/engine/format.mjs +9 -2
  273. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +3 -2
  274. package/node_modules/typebox/build/schema/engine/properties.mjs +3 -2
  275. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -1
  276. package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +1 -1
  277. package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +2 -2
  278. package/node_modules/typebox/build/schema/engine/ref.d.mts +1 -1
  279. package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
  280. package/node_modules/typebox/build/schema/engine/schema.mjs +24 -24
  281. package/node_modules/typebox/build/schema/parse.mjs +3 -0
  282. package/node_modules/typebox/build/schema/pointer/pointer.d.mts +1 -6
  283. package/node_modules/typebox/build/schema/pointer/pointer.mjs +47 -64
  284. package/node_modules/typebox/build/system/settings/internal.d.mts +2 -0
  285. package/node_modules/typebox/build/system/settings/internal.mjs +20 -0
  286. package/node_modules/typebox/build/system/settings/settings.d.mts +11 -0
  287. package/node_modules/typebox/build/system/settings/settings.mjs +14 -0
  288. package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
  289. package/node_modules/typebox/build/type/extends/inference.mjs +15 -2
  290. package/node_modules/typebox/build/type/extends/tuple.d.mts +2 -1
  291. package/node_modules/typebox/build/type/extends/tuple.mjs +21 -1
  292. package/node_modules/typebox/build/value/parse/parse.mjs +10 -4
  293. package/node_modules/typebox/package.json +1 -1
  294. package/node_modules/typebox/readme.md +3 -1
  295. package/package.json +6 -6
  296. package/dist/.setup/doctor-BPb-SjdE.mjs +0 -65
  297. package/dist/.setup/group-config-path-BGyzT9Lg.mjs +0 -54
  298. package/dist/.setup/normalize-DdsROMMa.mjs +0 -2
  299. package/dist/.setup/rolldown-runtime-D7D4PA-g.mjs +0 -13
  300. package/dist/.setup/runtime-group-policy-DeSRFXEV.mjs +0 -11
  301. package/dist/.setup/setup-plugin-api-2wUapweU.mjs +0 -3
  302. package/dist/.setup/text-runtime-CHl0iPYe.mjs +0 -4
  303. package/node_modules/audio-decode/.eslintrc.json +0 -43
  304. package/node_modules/audio-decode/.github/workflows/test.js.yml +0 -31
  305. package/node_modules/audio-decode/.travis.yml +0 -13
  306. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/README.md +0 -293
  307. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/dist/opus-ml-decoder.min.js +0 -11646
  308. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/dist/opus-ml-decoder.min.js.map +0 -1
  309. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/index.js +0 -8
  310. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/package.json +0 -58
  311. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/src/EmscriptenWasm.js +0 -0
  312. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/src/OpusMLDecoder.js +0 -253
  313. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/src/OpusMLDecoderWebWorker.js +0 -17
  314. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/types.d.ts +0 -77
  315. package/node_modules/audio-decode/node_modules/audio-buffer/.eslintrc.json +0 -44
  316. package/node_modules/audio-decode/node_modules/audio-buffer/.github/workflows/node.js.yml +0 -31
  317. package/node_modules/audio-decode/node_modules/audio-buffer/.travis.yml +0 -7
  318. package/node_modules/audio-decode/node_modules/audio-buffer/index.js +0 -76
  319. package/node_modules/audio-decode/node_modules/audio-buffer/package.json +0 -37
  320. package/node_modules/audio-decode/node_modules/audio-buffer/readme.md +0 -56
  321. package/node_modules/audio-decode/node_modules/node-wav/README.md +0 -35
  322. package/node_modules/audio-decode/node_modules/node-wav/file.wav +0 -0
  323. package/node_modules/audio-decode/node_modules/node-wav/index.js +0 -291
  324. package/node_modules/audio-decode/node_modules/node-wav/package.json +0 -29
  325. package/node_modules/audio-decode/node_modules/node-wav/tests/file1.wav +0 -0
  326. package/node_modules/audio-decode/node_modules/node-wav/tests/test.js +0 -66
  327. package/node_modules/audio-decode/node_modules/node-wav/x.js +0 -12
  328. package/node_modules/audio-decode/node_modules/node-wav/x.json +0 -86702
  329. package/node_modules/audio-decode/node_modules/node-wav/x.js~ +0 -13
  330. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/README.md +0 -320
  331. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.min.js +0 -232
  332. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.min.js.map +0 -1
  333. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.opus-ml.min.js +0 -0
  334. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.opus-ml.min.js.map +0 -1
  335. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/index.js +0 -8
  336. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/package.json +0 -74
  337. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/src/OggOpusDecoder.js +0 -226
  338. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/src/OggOpusDecoderWebWorker.js +0 -17
  339. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/types.d.ts +0 -37
  340. package/node_modules/audio-decode/node_modules/opus-decoder/README.md +0 -265
  341. package/node_modules/audio-decode/node_modules/opus-decoder/dist/opus-decoder.min.js +0 -232
  342. package/node_modules/audio-decode/node_modules/opus-decoder/dist/opus-decoder.min.js.map +0 -1
  343. package/node_modules/audio-decode/node_modules/opus-decoder/index.js +0 -8
  344. package/node_modules/audio-decode/node_modules/opus-decoder/package.json +0 -56
  345. package/node_modules/audio-decode/node_modules/opus-decoder/src/EmscriptenWasm.js +0 -0
  346. package/node_modules/audio-decode/node_modules/opus-decoder/src/OpusDecoder.js +0 -239
  347. package/node_modules/audio-decode/node_modules/opus-decoder/src/OpusDecoderWebWorker.js +0 -17
  348. package/node_modules/audio-decode/node_modules/opus-decoder/types.d.ts +0 -74
  349. package/node_modules/audio-decode/readme.md +0 -49
  350. package/node_modules/audio-decode/tea.yaml +0 -6
  351. package/node_modules/audio-decode/test-case.js +0 -11
  352. package/node_modules/audio-decode/test.html +0 -15
  353. package/node_modules/audio-decode/test.js +0 -107
  354. /package/node_modules/typebox/build/guard/{string.d.mts → unicode/unicode_segment.d.mts} +0 -0
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Ogg Opus metadata — Vorbis comment tags + cover art.
3
+ * @module @audio/decode-opus/meta
4
+ *
5
+ * import { parseMeta } from '@audio/decode-opus/meta'
6
+ * let { meta, sampleRate } = parseMeta(opusBytes)
7
+ * // meta: { title, artist, album, year, genre, ..., pictures, raw }
8
+ */
9
+
10
+ const TD = new TextDecoder('utf-8'), TD_L1 = new TextDecoder('iso-8859-1')
11
+
12
+ const VORBIS_MAP = {
13
+ TITLE: 'title', ARTIST: 'artist', ALBUM: 'album', ALBUMARTIST: 'albumartist',
14
+ COMPOSER: 'composer', GENRE: 'genre', DATE: 'year', TRACKNUMBER: 'track',
15
+ DISCNUMBER: 'disc', BPM: 'bpm', KEY: 'key', COMMENT: 'comment', DESCRIPTION: 'comment',
16
+ COPYRIGHT: 'copyright', ISRC: 'isrc', PUBLISHER: 'publisher', ENCODER: 'software',
17
+ LYRICS: 'lyrics'
18
+ }
19
+
20
+ function u32le(b, o) { return (b[o] | (b[o + 1] << 8) | (b[o + 2] << 16) | (b[o + 3] * 0x1000000)) >>> 0 }
21
+ function u32be(b, o) { return (b[o] * 0x1000000) + (b[o + 1] << 16) + (b[o + 2] << 8) + b[o + 3] }
22
+ function magic(b, s) { for (let i = 0; i < s.length; i++) if (b[i] !== s.charCodeAt(i)) return false; return true }
23
+
24
+ function concat(arr) {
25
+ if (arr.length === 1) return arr[0]
26
+ let n = 0; for (let a of arr) n += a.length
27
+ let out = new Uint8Array(n), o = 0
28
+ for (let a of arr) { out.set(a, o); o += a.length }
29
+ return out
30
+ }
31
+
32
+ // Reassemble logical packets from the leading Ogg pages (enough for the header packets).
33
+ function oggPackets(b, max) {
34
+ let packets = [], seg = [], off = 0
35
+ while (off + 27 <= b.length && packets.length < max) {
36
+ if (b[off] !== 0x4f || b[off + 1] !== 0x67 || b[off + 2] !== 0x67 || b[off + 3] !== 0x53) break // 'OggS'
37
+ let nseg = b[off + 26], tbl = off + 27, body = tbl + nseg
38
+ if (body > b.length) break
39
+ let size = 0
40
+ for (let i = 0; i < nseg; i++) size += b[tbl + i]
41
+ let p = body
42
+ for (let i = 0; i < nseg; i++) {
43
+ let lace = b[tbl + i]
44
+ seg.push(b.subarray(p, p + lace)); p += lace
45
+ if (lace < 255) { packets.push(concat(seg)); seg = []; if (packets.length >= max) break }
46
+ }
47
+ off = body + size
48
+ }
49
+ return packets
50
+ }
51
+
52
+ function decodeB64(s) {
53
+ if (typeof atob === 'function') { let bin = atob(s), u = new Uint8Array(bin.length); for (let i = 0; i < bin.length; i++) u[i] = bin.charCodeAt(i); return u }
54
+ return Uint8Array.from(Buffer.from(s, 'base64'))
55
+ }
56
+
57
+ // FLAC PICTURE block layout (also used by METADATA_BLOCK_PICTURE)
58
+ function parsePicture(b) {
59
+ let type = u32be(b, 0), o = 4
60
+ let ml = u32be(b, o); o += 4
61
+ let mime = TD_L1.decode(b.subarray(o, o + ml)); o += ml
62
+ let dl = u32be(b, o); o += 4
63
+ let desc = TD.decode(b.subarray(o, o + dl)); o += dl
64
+ o += 16 // width, height, depth, colors
65
+ let len = u32be(b, o); o += 4
66
+ return { mime, type, description: desc, data: b.slice(o, o + len) }
67
+ }
68
+
69
+ // Vorbis comment block: vendor string + key=value list. Returns { tags, pictures, vendor }.
70
+ export function parseComment(b) {
71
+ let off = 0, tags = {}, pictures = []
72
+ let vlen = u32le(b, off); off += 4
73
+ let vendor = TD.decode(b.subarray(off, off + vlen)); off += vlen
74
+ let n = u32le(b, off); off += 4
75
+ for (let i = 0; i < n && off + 4 <= b.length; i++) {
76
+ let len = u32le(b, off); off += 4
77
+ let s = TD.decode(b.subarray(off, off + len)); off += len
78
+ let eq = s.indexOf('='); if (eq < 0) continue
79
+ let key = s.slice(0, eq).toUpperCase(), val = s.slice(eq + 1)
80
+ if (key === 'METADATA_BLOCK_PICTURE') { try { pictures.push(parsePicture(decodeB64(val))) } catch {} continue }
81
+ let norm = VORBIS_MAP[key]
82
+ if (norm && tags[norm] == null) tags[norm] = val
83
+ }
84
+ return { tags, pictures, vendor }
85
+ }
86
+
87
+ /** Parse Ogg Opus metadata. Returns { meta, sampleRate, markers, regions } or null. */
88
+ export function parseMeta(bytes) {
89
+ let b = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)
90
+ if (b.length < 4 || b[0] !== 0x4f || b[1] !== 0x67 || b[2] !== 0x67 || b[3] !== 0x53) return null
91
+ let [id, comment] = oggPackets(b, 2)
92
+ if (!id || !magic(id, 'OpusHead')) return null
93
+ // Opus always decodes to 48 kHz; OpusHead+10 holds the original input rate (informational)
94
+ let meta = {}, pictures = []
95
+ let inputRate = id.length >= 16 ? u32le(id, 12) : 0
96
+ // comment header: 'OpusTags' magic then the comment block (no framing bit)
97
+ if (comment && magic(comment, 'OpusTags')) {
98
+ let { tags, pictures: pics, vendor } = parseComment(comment.subarray(8))
99
+ Object.assign(meta, tags); pictures = pics; meta.raw = { vendor, inputSampleRate: inputRate }
100
+ }
101
+ meta.pictures = pictures
102
+ return { meta, sampleRate: 48000, markers: [], regions: [] }
103
+ }
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@audio/decode-opus",
3
+ "version": "1.3.1",
4
+ "description": "Decode Ogg Opus audio with local libopus WASM",
5
+ "type": "module",
6
+ "main": "decode-opus.js",
7
+ "types": "decode-opus.d.ts",
8
+ "exports": {
9
+ ".": "./decode-opus.js",
10
+ "./core": {
11
+ "types": "./core.d.ts",
12
+ "default": "./core.js"
13
+ },
14
+ "./meta": "./meta.js",
15
+ "./audio": {
16
+ "types": "./audio.d.ts",
17
+ "default": "./audio.js"
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "files": [
22
+ "decode-opus.js",
23
+ "src/decode-opus.js",
24
+ "core.js",
25
+ "core.d.ts",
26
+ "meta.js",
27
+ "decode-opus.d.ts",
28
+ "src/opus.wasm.js",
29
+ "LICENSE",
30
+ "LICENSE.libopus",
31
+ "audio.js",
32
+ "audio.d.ts"
33
+ ],
34
+ "scripts": {
35
+ "build": "bash build.sh",
36
+ "prepack": "npm run build",
37
+ "test": "node test.js"
38
+ },
39
+ "keywords": [
40
+ "opus",
41
+ "ogg",
42
+ "audio",
43
+ "decode",
44
+ "decoder",
45
+ "wasm"
46
+ ],
47
+ "publishConfig": {
48
+ "access": "public"
49
+ },
50
+ "license": "MIT",
51
+ "author": "audiojs",
52
+ "homepage": "https://github.com/audiojs/decode/tree/master/packages/decode-opus#readme",
53
+ "repository": {
54
+ "type": "git",
55
+ "url": "git+https://github.com/audiojs/decode.git",
56
+ "directory": "packages/decode-opus"
57
+ },
58
+ "bugs": "https://github.com/audiojs/decode/issues",
59
+ "dependencies": {
60
+ "codec-parser": "~2.5.0"
61
+ },
62
+ "engines": {
63
+ "node": ">=18"
64
+ },
65
+ "audio": "./audio.js",
66
+ "sideEffects": false,
67
+ "funding": "https://github.com/sponsors/audiojs"
68
+ }
@@ -0,0 +1,2 @@
1
+ var k=Symbol,Y0=", ",h=(()=>{let o="front",t="side",r="rear",s="left",e="center",n="right";return["",o+" ",t+" ",r+" "].map(a=>[[s,n],[s,n,e],[s,e,n],[e,s,n],[e]].flatMap(c=>c.map(p=>a+p).join(Y0)))})(),it="LFE",Ft="monophonic (mono)",kt="stereo",_e="surround",M=(o,...t)=>`${[Ft,kt,`linear ${_e}`,"quadraphonic",`5.0 ${_e}`,`5.1 ${_e}`,`6.1 ${_e}`,`7.1 ${_e}`][o-1]} (${t.join(Y0)})`,Se=[Ft,M(2,h[0][0]),M(3,h[0][2]),M(4,h[1][0],h[3][0]),M(5,h[1][2],h[3][0]),M(6,h[1][2],h[3][0],it),M(7,h[1][2],h[2][0],h[3][4],it),M(8,h[1][2],h[2][0],h[3][0],it)],Q0=192e3,tr=176400,i0=96e3,a0=88200,er=64e3,Mt=48e3,te=44100,ee=32e3,re=24e3,se=22050,oe=16e3,c0=12e3,p0=11025,ne=8e3,rr=7350,K="absoluteGranulePosition",f="bandwidth",I="bitDepth",U="bitrate",ye=U+"Maximum",Ce=U+"Minimum",we=U+"Nominal",at="buffer",Fe=at+"Fullness",F="codec",O=F+"Frames",ie="coupledStreamCount",ae="crc",ke=ae+"16",Me=ae+"32",w="data",u="description",ct="duration",ce="emphasis",Pe="hasOpusPadding",q="header",Pt="isContinuedPacket",He="isCopyrighted",Ht="isFirstPage",ve="isHome",W="isLastPage",mt="isOriginal",dt="isPrivate",De="isVbr",$="layer",i="length",d="mode",ft=d+"Extension",l0="mpeg",bt=l0+"Version",Re="numberAACFrames",pe="outputGain",vt="preSkip",Ae="profile",u0=k(),gt="protection",L0="rawData",X="segments",b="subarray",Dt="version",$t="vorbis",Be=$t+"Comments",Le=$t+"Setup",h0="block",Ne=h0+"ingStrategy",m0=k(),xt=h0+"Size",Rt=h0+"size0",At=h0+"size1",Ie=k(),d0="channel",_t=d0+"MappingFamily",le=d0+"MappingTable",T=d0+"Mode",Ue=k(),l=d0+"s",sr="copyright",Oe=sr+"Id",Te=sr+"IdStart",St="frame",yt=St+"Count",G=St+"Length",f0="Number",Ct=St+f0,pt=St+"Padding",m=St+"Size",or="Rate",ze="inputSample"+or,N0="page",Gt=N0+"Checksum",ue=k(),Bt=N0+"SegmentTable",R=N0+"Sequence"+f0,I0="sample",Ee=I0+f0,g=I0+or,lt=k(),x=I0+"s",b0="stream",he=b0+"Count",Ve=b0+"Info",ut=b0+"Serial"+f0,U0=b0+"StructureVersion",O0="total",qt=O0+"BytesOut",Wt=O0+"Duration",jt=O0+"Samples",S=k(),Y=k(),$e=k(),Lt=k(),st=k(),g0=k(),T0=k(),Nt=k(),y=k(),Q=k(),tt=k(),ht=k(),It=k(),x0=k(),ot=k(),nt=k(),et=k(),_0=k(),z=Uint8Array,Ut=DataView,C="reserved",E="bad",me="free",Ge="none",S0="16bit CRC";var z0=(o,t,r)=>{for(let s=0;s<o[i];s++){let e=t(s);for(let n=8;n>0;n--)e=r(e);o[s]=e}return o},Nr=z0(new z(256),o=>o,o=>o&128?7^o<<1:o<<1),P=[z0(new Uint16Array(256),o=>o<<8,o=>o<<1^(o&32768?32773:0))],H=[z0(new Uint32Array(256),o=>o,o=>o>>>1^(o&1)*3988292384)];for(let o=0;o<15;o++){P.push(new Uint16Array(256)),H.push(new Uint32Array(256));for(let t=0;t<=255;t++)P[o+1][t]=P[0][P[o][t]>>>8]^P[o][t]<<8,H[o+1][t]=H[o][t]>>>8^H[0][H[o][t]&255]}var ir=o=>{let t=0,r=o[i];for(let s=0;s!==r;s++)t=Nr[t^o[s]];return t},ar=o=>{let t=o[i],r=t-16,s=0,e=0;for(;e<=r;)s^=o[e++]<<8|o[e++],s=P[15][s>>8]^P[14][s&255]^P[13][o[e++]]^P[12][o[e++]]^P[11][o[e++]]^P[10][o[e++]]^P[9][o[e++]]^P[8][o[e++]]^P[7][o[e++]]^P[6][o[e++]]^P[5][o[e++]]^P[4][o[e++]]^P[3][o[e++]]^P[2][o[e++]]^P[1][o[e++]]^P[0][o[e++]];for(;e!==t;)s=(s&255)<<8^P[0][s>>8^o[e++]];return s},cr=o=>{let t=o[i],r=t-16,s=0,e=0;for(;e<=r;)s=H[15][(o[e++]^s)&255]^H[14][(o[e++]^s>>>8)&255]^H[13][(o[e++]^s>>>16)&255]^H[12][o[e++]^s>>>24]^H[11][o[e++]]^H[10][o[e++]]^H[9][o[e++]]^H[8][o[e++]]^H[7][o[e++]]^H[6][o[e++]]^H[5][o[e++]]^H[4][o[e++]]^H[3][o[e++]]^H[2][o[e++]]^H[1][o[e++]]^H[0][o[e++]];for(;e!==t;)s=H[0][(s^o[e++])&255]^s>>>8;return s^-1},We=(...o)=>{let t=new z(o.reduce((r,s)=>r+s[i],0));return o.reduce((r,s)=>(t.set(s,r),r+s[i]),0),t},j=o=>String.fromCharCode(...o),nr=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],qe=o=>nr[o&15]<<4|nr[o>>4],y0=class{constructor(t){this._data=t,this._pos=t[i]*8}set position(t){this._pos=t}get position(){return this._pos}read(t){let r=Math.floor(this._pos/8),s=this._pos%8;return this._pos-=t,(qe(this._data[r-1])<<8)+qe(this._data[r])>>7-s&255}},pr=(o,t)=>{try{return o.getBigInt64(t,!0)}catch{let r=o.getUint8(t+7)&128?-1:1,s=o.getUint32(t,!0),e=o.getUint32(t+4,!0);return r===-1&&(s=~s+1,e=~e+1),e>1048575&&console.warn("This platform does not support BigInt"),r*(s+e*2**32)}};var je=class{constructor(t,r){this._onCodecHeader=t,this._onCodecUpdate=r,this[ot]()}[nt](){this._isEnabled=!0}[ot](){this._headerCache=new Map,this._codecUpdateData=new WeakMap,this._codecHeaderSent=!1,this._codecShouldUpdate=!1,this._bitrate=null,this._isEnabled=!1}[x0](t,r){if(this._onCodecUpdate){this._bitrate!==t&&(this._bitrate=t,this._codecShouldUpdate=!0);let s=this._codecUpdateData.get(this._headerCache.get(this._currentHeader));this._codecShouldUpdate&&s&&this._onCodecUpdate({bitrate:t,...s},r),this._codecShouldUpdate=!1}}[y](t){let r=this._headerCache.get(t);return r&&this._updateCurrentHeader(t),r}[Q](t,r,s){this._isEnabled&&(this._codecHeaderSent||(this._onCodecHeader({...r}),this._codecHeaderSent=!0),this._updateCurrentHeader(t),this._headerCache.set(t,r),this._codecUpdateData.set(r,s))}_updateCurrentHeader(t){this._onCodecUpdate&&t!==this._currentHeader&&(this._codecShouldUpdate=!0,this._currentHeader=t)}};var B=new WeakMap,L=new WeakMap;var V=class{constructor(t,r){this._codecParser=t,this._headerCache=r}*[T0](){let t;do{if(t=yield*this.Frame[tt](this._codecParser,this._headerCache,0),t)return t;this._codecParser[Y](1)}while(!0)}*[Nt](t){let r=yield*this[T0](),s=L.get(r)[i];if(t||this._codecParser._flushing||(yield*this.Header[y](this._codecParser,this._headerCache,s)))return this._headerCache[nt](),this._codecParser[Y](s),this._codecParser[Lt](r),r;this._codecParser[st](`Missing ${St} at ${s} bytes from current position.`,`Dropping current ${St} and trying again.`),this._headerCache[ot](),this._codecParser[Y](1)}};var Jt=class{constructor(t,r){L.set(this,{[q]:t}),this[w]=r}};var J=class extends Jt{static*[tt](t,r,s,e,n){let a=yield*t[y](s,e,n);if(a){let c=B.get(a)[G],p=B.get(a)[x],_=(yield*s[S](c,n))[b](0,c);return new r(a,_,p)}else return null}constructor(t,r,s){super(t,r),this[q]=t,this[x]=s,this[ct]=s/t[g]*1e3,this[Ct]=null,this[qt]=null,this[jt]=null,this[Wt]=null,L.get(this)[i]=r[i]}};var E0="unsynchronizationFlag",V0="extendedHeaderFlag",$0="experimentalFlag",G0="footerPresent",Je=class o{static*getID3v2Header(t,r,s){let n={},a=yield*t[S](3,s);if(a[0]!==73||a[1]!==68||a[2]!==51||(a=yield*t[S](10,s),n[Dt]=`id3v2.${a[3]}.${a[4]}`,a[5]&15)||(n[E0]=!!(a[5]&128),n[V0]=!!(a[5]&64),n[$0]=!!(a[5]&32),n[G0]=!!(a[5]&16),a[6]&128||a[7]&128||a[8]&128||a[9]&128))return null;let c=a[6]<<21|a[7]<<14|a[8]<<7|a[9];return n[i]=10+c,new o(n)}constructor(t){this[Dt]=t[Dt],this[E0]=t[E0],this[V0]=t[V0],this[$0]=t[$0],this[G0]=t[G0],this[i]=t[i]}};var Z=class{constructor(t){B.set(this,t),this[I]=t[I],this[U]=null,this[l]=t[l],this[T]=t[T],this[g]=t[g]}};var dr={0:[me,me,me,me,me],16:[32,32,32,32,8],240:[E,E,E,E,E]},C0=(o,t,r)=>8*((o+r)%t+t)*(1<<(o+r)/t)-8*t*(t/8|0);for(let o=2;o<15;o++)dr[o<<4]=[o*32,C0(o,4,0),C0(o,4,-1),C0(o,8,4),C0(o,8,0)];var Ir=0,Ur=1,Or=2,Tr=3,lr=4,w0="bands ",F0=" to 31",ur={0:w0+4+F0,16:w0+8+F0,32:w0+12+F0,48:w0+16+F0},Zt="bitrateIndex",Ze="v2",v0="v1",k0="Intensity stereo ",M0=", MS stereo ",P0="on",H0="off",zr={0:k0+H0+M0+H0,16:k0+P0+M0+H0,32:k0+H0+M0+P0,48:k0+P0+M0+P0},q0={0:{[u]:C},2:{[u]:"Layer III",[pt]:1,[ft]:zr,[v0]:{[Zt]:Or,[x]:1152},[Ze]:{[Zt]:lr,[x]:576}},4:{[u]:"Layer II",[pt]:1,[ft]:ur,[x]:1152,[v0]:{[Zt]:Ur},[Ze]:{[Zt]:lr}},6:{[u]:"Layer I",[pt]:4,[ft]:ur,[x]:384,[v0]:{[Zt]:Ir},[Ze]:{[Zt]:Tr}}},W0="MPEG Version ",hr="ISO/IEC ",Er={0:{[u]:`${W0}2.5 (later extension of MPEG 2)`,[$]:Ze,[g]:{0:p0,4:c0,8:ne,12:C}},8:{[u]:C},16:{[u]:`${W0}2 (${hr}13818-3)`,[$]:Ze,[g]:{0:se,4:re,8:oe,12:C}},24:{[u]:`${W0}1 (${hr}11172-3)`,[$]:v0,[g]:{0:te,4:Mt,8:ee,12:C}},length:i},Vr={0:S0,1:Ge},$r={0:Ge,1:"50/15 ms",2:C,3:"CCIT J.17"},mr={0:{[l]:2,[u]:kt},64:{[l]:2,[u]:"joint "+kt},128:{[l]:2,[u]:"dual channel"},192:{[l]:1,[u]:Ft}},Kt=class o extends Z{static*[y](t,r,s){let e={},n=yield*Je.getID3v2Header(t,r,s);n&&(yield*t[S](n[i],s),t[Y](n[i]));let a=yield*t[S](4,s),c=j(a[b](0,4)),p=r[y](c);if(p)return new o(p);if(a[0]!==255||a[1]<224)return null;let _=Er[a[1]&24];if(_[u]===C)return null;let A=a[1]&6;if(q0[A][u]===C)return null;let v={...q0[A],...q0[A][_[$]]};if(e[bt]=_[u],e[$]=v[u],e[x]=v[x],e[gt]=Vr[a[1]&1],e[i]=4,e[U]=dr[a[2]&240][v[Zt]],e[U]===E||(e[g]=_[g][a[2]&12],e[g]===C)||(e[pt]=a[2]&2&&v[pt],e[dt]=!!(a[2]&1),e[G]=Math.floor(125*e[U]*e[x]/e[g]+e[pt]),!e[G]))return null;let D=a[3]&192;if(e[T]=mr[D][u],e[l]=mr[D][l],e[ft]=v[ft][a[3]&48],e[He]=!!(a[3]&8),e[mt]=!!(a[3]&4),e[ce]=$r[a[3]&3],e[ce]===C)return null;e[I]=16;{let{length:Vt,frameLength:wt,samples:K0,...B0}=e;r[Q](c,e,B0)}return new o(e)}constructor(t){super(t),this[U]=t[U],this[ce]=t[ce],this[pt]=t[pt],this[He]=t[He],this[mt]=t[mt],this[dt]=t[dt],this[$]=t[$],this[ft]=t[ft],this[bt]=t[bt],this[gt]=t[gt]}};var Ke=class o extends J{static*[tt](t,r,s){return yield*super[tt](Kt,o,t,r,s)}constructor(t,r,s){super(t,r,s)}};var Xe=class extends V{constructor(t,r,s){super(t,r),this.Frame=Ke,this.Header=Kt,s(this[F])}get[F](){return l0}*[ht](){return yield*this[Nt]()}};var Gr={0:"MPEG-4",8:"MPEG-2"},qr={0:"valid",2:E,4:E,6:E},Wr={0:S0,1:Ge},jr={0:"AAC Main",64:"AAC LC (Low Complexity)",128:"AAC SSR (Scalable Sample Rate)",192:"AAC LTP (Long Term Prediction)"},Jr={0:i0,4:a0,8:er,12:Mt,16:te,20:ee,24:re,28:se,32:oe,36:c0,40:p0,44:ne,48:rr,52:C,56:C,60:"frequency is written explicitly"},fr={0:{[l]:0,[u]:"Defined in AOT Specific Config"},64:{[l]:1,[u]:Ft},128:{[l]:2,[u]:M(2,h[0][0])},192:{[l]:3,[u]:M(3,h[1][3])},256:{[l]:4,[u]:M(4,h[1][3],h[3][4])},320:{[l]:5,[u]:M(5,h[1][3],h[3][0])},384:{[l]:6,[u]:M(6,h[1][3],h[3][0],it)},448:{[l]:8,[u]:M(8,h[1][3],h[2][0],h[3][0],it)}},Xt=class o extends Z{static*[y](t,r,s){let e={},n=yield*t[S](7,s),a=j([n[0],n[1],n[2],n[3]&252|n[6]&3]),c=r[y](a);if(c)Object.assign(e,c);else{if(n[0]!==255||n[1]<240||(e[bt]=Gr[n[1]&8],e[$]=qr[n[1]&6],e[$]===E))return null;let _=n[1]&1;e[gt]=Wr[_],e[i]=_?7:9,e[u0]=n[2]&192,e[lt]=n[2]&60;let A=n[2]&2;if(e[Ae]=jr[e[u0]],e[g]=Jr[e[lt]],e[g]===C)return null;e[dt]=!!A,e[Ue]=(n[2]<<8|n[3])&448,e[T]=fr[e[Ue]][u],e[l]=fr[e[Ue]][l],e[mt]=!!(n[3]&32),e[ve]=!!(n[3]&8),e[Oe]=!!(n[3]&8),e[Te]=!!(n[3]&4),e[I]=16,e[x]=1024,e[Re]=n[6]&3;{let{length:v,channelModeBits:D,profileBits:Vt,sampleRateBits:wt,frameLength:K0,samples:B0,numberAACFrames:X0,...Br}=e;r[Q](a,e,Br)}}if(e[G]=(n[3]<<11|n[4]<<3|n[5]>>5)&8191,!e[G])return null;let p=(n[5]<<6|n[6]>>2)&2047;return e[Fe]=p===2047?"VBR":p,new o(e)}constructor(t){super(t),this[Oe]=t[Oe],this[Te]=t[Te],this[Fe]=t[Fe],this[ve]=t[ve],this[mt]=t[mt],this[dt]=t[dt],this[$]=t[$],this[i]=t[i],this[bt]=t[bt],this[Re]=t[Re],this[Ae]=t[Ae],this[gt]=t[gt]}get audioSpecificConfig(){let t=B.get(this),r=t[u0]+64<<5|t[lt]<<5|t[Ue]>>3,s=new z(2);return new Ut(s[at]).setUint16(0,r,!1),s}};var Ye=class o extends J{static*[tt](t,r,s){return yield*super[tt](Xt,o,t,r,s)}constructor(t,r,s){super(t,r,s)}};var Qe=class extends V{constructor(t,r,s){super(t,r),this.Frame=Ye,this.Header=Xt,s(this[F])}get[F](){return"aac"}*[ht](){return yield*this[Nt]()}};var Ot=class o extends J{static _getFrameFooterCrc16(t){return(t[t[i]-2]<<8)+t[t[i]-1]}static[_0](t){let r=o._getFrameFooterCrc16(t),s=ar(t[b](0,-2));return r===s}constructor(t,r,s){r[Ve]=s,r[ke]=o._getFrameFooterCrc16(t),super(r,t,B.get(r)[x])}};var br="get from STREAMINFO metadata block",Zr={0:"Fixed",1:"Variable"},gr={0:C,16:192};for(let o=2;o<16;o++)gr[o<<4]=o<6?576*2**(o-2):2**o;var Kr={0:br,1:a0,2:tr,3:Q0,4:ne,5:oe,6:se,7:re,8:ee,9:te,10:Mt,11:i0,15:E},Xr={0:{[l]:1,[u]:Ft},16:{[l]:2,[u]:M(2,h[0][0])},32:{[l]:3,[u]:M(3,h[0][1])},48:{[l]:4,[u]:M(4,h[1][0],h[3][0])},64:{[l]:5,[u]:M(5,h[1][1],h[3][0])},80:{[l]:6,[u]:M(6,h[1][1],it,h[3][0])},96:{[l]:7,[u]:M(7,h[1][1],it,h[3][4],h[2][0])},112:{[l]:8,[u]:M(8,h[1][1],it,h[3][0],h[2][0])},128:{[l]:2,[u]:`${kt} (left, diff)`},144:{[l]:2,[u]:`${kt} (diff, right)`},160:{[l]:2,[u]:`${kt} (avg, diff)`},176:C,192:C,208:C,224:C,240:C},Yr={0:br,2:8,4:12,6:C,8:16,10:20,12:24,14:C},Tt=class o extends Z{static _decodeUTF8Int(t){if(t[0]>254)return null;if(t[0]<128)return{value:t[0],length:1};let r=1;for(let a=64;a&t[0];a>>=1)r++;let s=r-1,e=0,n=0;for(;s>0;n+=6,s--){if((t[s]&192)!==128)return null;e|=(t[s]&63)<<n}return e|=(t[s]&127>>r)<<n,{value:e,length:r}}static[et](t,r){let s={[S]:function*(){return t}};return o[y](s,r,0).next().value}static*[y](t,r,s){let e=yield*t[S](6,s);if(e[0]!==255||!(e[1]===248||e[1]===249))return null;let n={},a=j(e[b](0,4)),c=r[y](a);if(c)Object.assign(n,c);else{if(n[m0]=e[1]&1,n[Ne]=Zr[n[m0]],n[Ie]=e[2]&240,n[lt]=e[2]&15,n[xt]=gr[n[Ie]],n[xt]===C||(n[g]=Kr[n[lt]],n[g]===E)||e[3]&1)return null;let _=Xr[e[3]&240];if(_===C||(n[l]=_[l],n[T]=_[u],n[I]=Yr[e[3]&14],n[I]===C))return null}n[i]=5,e=yield*t[S](n[i]+8,s);let p=o._decodeUTF8Int(e[b](4));if(!p||(n[m0]?n[Ee]=p.value:n[Ct]=p.value,n[i]+=p[i],n[Ie]===96?(e[i]<n[i]&&(e=yield*t[S](n[i],s)),n[xt]=e[n[i]-1]+1,n[i]+=1):n[Ie]===112&&(e[i]<n[i]&&(e=yield*t[S](n[i],s)),n[xt]=(e[n[i]-1]<<8)+e[n[i]]+1,n[i]+=2),n[x]=n[xt],n[lt]===12?(e[i]<n[i]&&(e=yield*t[S](n[i],s)),n[g]=e[n[i]-1]*1e3,n[i]+=1):n[lt]===13?(e[i]<n[i]&&(e=yield*t[S](n[i],s)),n[g]=(e[n[i]-1]<<8)+e[n[i]],n[i]+=2):n[lt]===14&&(e[i]<n[i]&&(e=yield*t[S](n[i],s)),n[g]=((e[n[i]-1]<<8)+e[n[i]])*10,n[i]+=2),e[i]<n[i]&&(e=yield*t[S](n[i],s)),n[ae]=e[n[i]-1],n[ae]!==ir(e[b](0,n[i]-1))))return null;if(!c){let{blockingStrategyBits:_,frameNumber:A,sampleNumber:v,samples:D,sampleRateBits:Vt,blockSizeBits:wt,crc:K0,length:B0,...X0}=n;r[Q](a,n,X0)}return new o(n)}constructor(t){super(t),this[ke]=null,this[Ne]=t[Ne],this[xt]=t[xt],this[Ct]=t[Ct],this[Ee]=t[Ee],this[Ve]=null}};var Qr=2,ts=512*1024,Yt=class extends V{constructor(t,r,s){super(t,r),this.Frame=Ot,this.Header=Tt,s(this[F])}get[F](){return"flac"}*_getNextFrameSyncOffset(t){let r=yield*this._codecParser[S](2,0),s=r[i]-2;for(;t<s;){if(r[t]===255){let n=r[t+1];if(n===248||n===249)break;n!==255&&t++}t++}return t}*[ht](){do{let t=yield*Tt[y](this._codecParser,this._headerCache,0);if(t){let r=B.get(t)[i]+Qr;for(;r<=ts;){if(this._codecParser._flushing||(yield*Tt[y](this._codecParser,this._headerCache,r))){let s=yield*this._codecParser[S](r);if(this._codecParser._flushing||(s=s[b](0,r)),Ot[_0](s)){let e=new Ot(s,t);return this._headerCache[nt](),this._codecParser[Y](r),this._codecParser[Lt](e),e}}r=yield*this._getNextFrameSyncOffset(r+1)}this._codecParser[st](`Unable to sync FLAC frame after searching ${r} bytes.`),this._codecParser[Y](r)}else this._codecParser[Y](yield*this._getNextFrameSyncOffset(1))}while(!0)}[It](t){return t[R]===0?(this._headerCache[nt](),this._streamInfo=t[w][b](13)):t[R]===1||(t[O]=L.get(t)[X].map(r=>{let s=Tt[et](r,this._headerCache);if(s)return new Ot(r,s,this._streamInfo);this._codecParser[st]("Failed to parse Ogg FLAC frame","Skipping invalid FLAC frame")}).filter(r=>!!r)),t}};var Qt=class o{static*[y](t,r,s){let e={},n=yield*t[S](28,s);if(n[0]!==79||n[1]!==103||n[2]!==103||n[3]!==83||(e[U0]=n[4],n[5]&248))return null;e[W]=!!(n[5]&4),e[Ht]=!!(n[5]&2),e[Pt]=!!(n[5]&1);let c=new Ut(z.from(n[b](0,28))[at]);e[K]=pr(c,6),e[ut]=c.getInt32(14,!0),e[R]=c.getInt32(18,!0),e[Gt]=c.getInt32(22,!0);let p=n[26];e[i]=p+27,n=yield*t[S](e[i],s),e[G]=0,e[Bt]=[],e[ue]=z.from(n[b](27,e[i]));for(let _=0,A=0;_<p;_++){let v=e[ue][_];e[G]+=v,A+=v,(v!==255||_===p-1)&&(e[Bt].push(A),A=0)}return new o(e)}constructor(t){B.set(this,t),this[K]=t[K],this[Pt]=t[Pt],this[Ht]=t[Ht],this[W]=t[W],this[Bt]=t[Bt],this[R]=t[R],this[Gt]=t[Gt],this[ut]=t[ut]}};var t0=class o extends Jt{static*[tt](t,r,s){let e=yield*Qt[y](t,r,s);if(e){let n=B.get(e)[G],a=B.get(e)[i],c=a+n,p=(yield*t[S](c,0))[b](0,c),_=p[b](a,c);return new o(e,_,p)}else return null}constructor(t,r,s){super(t,r),L.get(this)[i]=s[i],this[O]=[],this[L0]=s,this[K]=t[K],this[Me]=t[Gt],this[ct]=0,this[Pt]=t[Pt],this[Ht]=t[Ht],this[W]=t[W],this[R]=t[R],this[x]=0,this[ut]=t[ut]}};var de=class extends J{constructor(t,r,s){super(r,t,s)}};var xr={0:Se.slice(0,2),1:Se},rt="SILK-only",N="CELT-only",D0="Hybrid",zt="narrowband",R0="medium-band",Et="wideband",fe="super-wideband",be="fullband",es={0:{[d]:rt,[f]:zt,[m]:10},8:{[d]:rt,[f]:zt,[m]:20},16:{[d]:rt,[f]:zt,[m]:40},24:{[d]:rt,[f]:zt,[m]:60},32:{[d]:rt,[f]:R0,[m]:10},40:{[d]:rt,[f]:R0,[m]:20},48:{[d]:rt,[f]:R0,[m]:40},56:{[d]:rt,[f]:R0,[m]:60},64:{[d]:rt,[f]:Et,[m]:10},72:{[d]:rt,[f]:Et,[m]:20},80:{[d]:rt,[f]:Et,[m]:40},88:{[d]:rt,[f]:Et,[m]:60},96:{[d]:D0,[f]:fe,[m]:10},104:{[d]:D0,[f]:fe,[m]:20},112:{[d]:D0,[f]:be,[m]:10},120:{[d]:D0,[f]:be,[m]:20},128:{[d]:N,[f]:zt,[m]:2.5},136:{[d]:N,[f]:zt,[m]:5},144:{[d]:N,[f]:zt,[m]:10},152:{[d]:N,[f]:zt,[m]:20},160:{[d]:N,[f]:Et,[m]:2.5},168:{[d]:N,[f]:Et,[m]:5},176:{[d]:N,[f]:Et,[m]:10},184:{[d]:N,[f]:Et,[m]:20},192:{[d]:N,[f]:fe,[m]:2.5},200:{[d]:N,[f]:fe,[m]:5},208:{[d]:N,[f]:fe,[m]:10},216:{[d]:N,[f]:fe,[m]:20},224:{[d]:N,[f]:be,[m]:2.5},232:{[d]:N,[f]:be,[m]:5},240:{[d]:N,[f]:be,[m]:10},248:{[d]:N,[f]:be,[m]:20}},ge=class o extends Z{static[et](t,r,s){let e={};if(e[l]=t[9],e[_t]=t[18],e[i]=e[_t]!==0?21+e[l]:19,t[i]<e[i])throw new Error("Out of data while inside an Ogg Page");let n=r[0]&3,a=n===3?2:1,c=j(t[b](0,e[i]))+j(r[b](0,a)),p=s[y](c);if(p)return new o(p);if(c.substr(0,8)!=="OpusHead"||t[8]!==1)return null;e[w]=z.from(t[b](0,e[i]));let _=new Ut(e[w][at]);if(e[I]=16,e[vt]=_.getUint16(10,!0),e[ze]=_.getUint32(12,!0),e[g]=Mt,e[pe]=_.getInt16(16,!0),e[_t]in xr&&(e[T]=xr[e[_t]][e[l]-1],!e[T]))return null;e[_t]!==0&&(e[he]=t[19],e[ie]=t[20],e[le]=[...t[b](21,e[l]+21)]);let A=es[248&r[0]];switch(e[d]=A[d],e[f]=A[f],e[m]=A[m],n){case 0:e[yt]=1;break;case 1:case 2:e[yt]=2;break;case 3:e[De]=!!(128&r[1]),e[Pe]=!!(64&r[1]),e[yt]=63&r[1];break;default:return null}{let{length:v,data:D,channelMappingFamily:Vt,...wt}=e;s[Q](c,e,wt)}return new o(e)}constructor(t){super(t),this[w]=t[w],this[f]=t[f],this[_t]=t[_t],this[le]=t[le],this[ie]=t[ie],this[yt]=t[yt],this[m]=t[m],this[Pe]=t[Pe],this[ze]=t[ze],this[De]=t[De],this[d]=t[d],this[pe]=t[pe],this[vt]=t[vt],this[he]=t[he]}};var e0=class extends V{constructor(t,r,s){super(t,r),this.Frame=de,this.Header=ge,s(this[F]),this._identificationHeader=null,this._preSkipRemaining=null}get[F](){return"opus"}[It](t){return t[R]===0?(this._headerCache[nt](),this._identificationHeader=t[w]):t[R]===1||(t[O]=L.get(t)[X].map(r=>{let s=ge[et](this._identificationHeader,r,this._headerCache);if(s){this._preSkipRemaining===null&&(this._preSkipRemaining=s[vt]);let e=s[m]*s[yt]/1e3*s[g];return this._preSkipRemaining>0&&(this._preSkipRemaining-=e,e=this._preSkipRemaining<0?-this._preSkipRemaining:0),new de(r,s,e)}this._codecParser[g0]("Failed to parse Ogg Opus Header","Not a valid Ogg Opus file")})),t}};var xe=class extends J{constructor(t,r,s){super(r,t,s)}};var j0={};for(let o=0;o<8;o++)j0[o+6]=2**(6+o);var r0=class o extends Z{static[et](t,r,s,e){if(t[i]<30)throw new Error("Out of data while inside an Ogg Page");let n=j(t[b](0,30)),a=r[y](n);if(a)return new o(a);let c={[i]:30};if(n.substr(0,7)!=="vorbis")return null;c[w]=z.from(t[b](0,30));let p=new Ut(c[w][at]);if(c[Dt]=p.getUint32(7,!0),c[Dt]!==0||(c[l]=t[11],c[T]=Se[c[l]-1]||"application defined",c[g]=p.getUint32(12,!0),c[ye]=p.getInt32(16,!0),c[we]=p.getInt32(20,!0),c[Ce]=p.getInt32(24,!0),c[At]=j0[(t[28]&240)>>4],c[Rt]=j0[t[28]&15],c[Rt]>c[At])||t[29]!==1)return null;c[I]=32,c[Le]=e,c[Be]=s;{let{length:_,data:A,version:v,vorbisSetup:D,vorbisComments:Vt,...wt}=c;r[Q](n,c,wt)}return new o(c)}constructor(t){super(t),this[ye]=t[ye],this[Ce]=t[Ce],this[we]=t[we],this[Rt]=t[Rt],this[At]=t[At],this[w]=t[w],this[Be]=t[Be],this[Le]=t[Le]}};var s0=class extends V{constructor(t,r,s){super(t,r),this.Frame=xe,s(this[F]),this._identificationHeader=null,this._setupComplete=!1,this._prevBlockSize=null}get[F](){return $t}[It](t){t[O]=[];for(let r of L.get(t)[X])if(r[0]===1)this._headerCache[nt](),this._identificationHeader=t[w],this._setupComplete=!1;else if(r[0]===3)this._vorbisComments=r;else if(r[0]===5)this._vorbisSetup=r,this._mode=this._parseSetupHeader(r),this._setupComplete=!0;else if(this._setupComplete){let s=r0[et](this._identificationHeader,this._headerCache,this._vorbisComments,this._vorbisSetup);s?t[O].push(new xe(r,s,this._getSamples(r,s))):this._codecParser[logError]("Failed to parse Ogg Vorbis Header","Not a valid Ogg Vorbis file")}return t}_getSamples(t,r){let e=this._mode.blockFlags[t[0]>>1&this._mode.mask]?r[At]:r[Rt],n=this._prevBlockSize===null?0:(this._prevBlockSize+e)/4;return this._prevBlockSize=e,n}_parseSetupHeader(t){let r=new y0(t),s={count:0,blockFlags:[]};for(;(r.read(1)&1)!==1;);let e;for(;s.count<64&&r.position>0;){qe(r.read(8));let n=0;for(;r.read(8)===0&&n++<3;);if(n===4)e=r.read(7),s.blockFlags.unshift(e&1),r.position+=6,s.count++;else{((qe(e)&126)>>1)+1!==s.count&&this._codecParser[st]("vorbis derived mode count did not match actual mode count");break}}return s.mask=(1<<Math.log2(s.count))-1,s}};var J0=class{constructor(t,r,s){this._codecParser=t,this._headerCache=r,this._onCodec=s,this._continuedPacket=new z,this._codec=null,this._isSupported=null,this._previousAbsoluteGranulePosition=null}get[F](){return this._codec||""}_updateCodec(t,r){this._codec!==t&&(this._headerCache[ot](),this._parser=new r(this._codecParser,this._headerCache,this._onCodec),this._codec=t)}_checkCodecSupport({data:t}){let r=j(t[b](0,8));switch(r){case"fishead\0":return!1;case"OpusHead":return this._updateCodec("opus",e0),!0;case(/^\x7fFLAC/.test(r)&&r):return this._updateCodec("flac",Yt),!0;case(/^\x01vorbis/.test(r)&&r):return this._updateCodec($t,s0),!0;default:return!1}}_checkPageSequenceNumber(t){t[R]!==this._pageSequenceNumber+1&&this._pageSequenceNumber>1&&t[R]>1&&this._codecParser[st]("Unexpected gap in Ogg Page Sequence Number.",`Expected: ${this._pageSequenceNumber+1}, Got: ${t[R]}`),this._pageSequenceNumber=t[R]}_parsePage(t){this._isSupported===null&&(this._pageSequenceNumber=t[R],this._isSupported=this._checkCodecSupport(t)),this._checkPageSequenceNumber(t);let r=L.get(t),s=B.get(r[q]),e=0;if(r[X]=s[Bt].map(n=>t[w][b](e,e+=n)),this._continuedPacket[i]&&(r[X][0]=We(this._continuedPacket,r[X][0]),this._continuedPacket=new z),s[ue][s[ue][i]-1]===255&&(this._continuedPacket=We(this._continuedPacket,r[X].pop())),this._previousAbsoluteGranulePosition!==null&&(t[x]=Number(t[K]-this._previousAbsoluteGranulePosition)),this._previousAbsoluteGranulePosition=t[K],this._isSupported){let n=this._parser[It](t);return this._codecParser[Lt](n),n}else return t}},o0=class extends V{constructor(t,r,s){super(t,r),this._onCodec=s,this.Frame=t0,this.Header=Qt,this._streams=new Map,this._currentSerialNumber=null}get[F](){let t=this._streams.get(this._currentSerialNumber);return t?t.codec:""}*[ht](){let t=yield*this[Nt](!0);this._currentSerialNumber=t[ut];let r=this._streams.get(this._currentSerialNumber);return r||(r=new J0(this._codecParser,this._headerCache,this._onCodec),this._streams.set(this._currentSerialNumber,r)),t[W]&&this._streams.delete(this._currentSerialNumber),r._parsePage(t)}};var Z0=()=>{},n0=class{constructor(t,{onCodec:r,onCodecHeader:s,onCodecUpdate:e,enableLogging:n=!1,enableFrameCRC32:a=!0}={}){this._inputMimeType=t,this._onCodec=r||Z0,this._onCodecHeader=s||Z0,this._onCodecUpdate=e,this._enableLogging=n,this._crc32=a?cr:Z0,this[ot]()}get[F](){return this._parser?this._parser[F]:""}[ot](){this._headerCache=new je(this._onCodecHeader,this._onCodecUpdate),this._generator=this._getGenerator(),this._generator.next()}*flush(){this._flushing=!0;for(let t=this._generator.next();t.value;t=this._generator.next())yield t.value;this._flushing=!1,this[ot]()}*parseChunk(t){for(let r=this._generator.next(t);r.value;r=this._generator.next())yield r.value}parseAll(t){return[...this.parseChunk(t),...this.flush()]}*_getGenerator(){if(this._inputMimeType.match(/aac/))this._parser=new Qe(this,this._headerCache,this._onCodec);else if(this._inputMimeType.match(/mpeg/))this._parser=new Xe(this,this._headerCache,this._onCodec);else if(this._inputMimeType.match(/flac/))this._parser=new Yt(this,this._headerCache,this._onCodec);else if(this._inputMimeType.match(/ogg/))this._parser=new o0(this,this._headerCache,this._onCodec);else throw new Error(`Unsupported Codec ${mimeType}`);for(this._frameNumber=0,this._currentReadPosition=0,this._totalBytesIn=0,this._totalBytesOut=0,this._totalSamples=0,this._sampleRate=void 0,this._rawData=new Uint8Array(0);;){let t=yield*this._parser[ht]();t&&(yield t)}}*[S](t=0,r=0){let s;for(;this._rawData[i]<=t+r;){if(s=yield,this._flushing)return this._rawData[b](r);s&&(this._totalBytesIn+=s[i],this._rawData=We(this._rawData,s))}return this._rawData[b](r)}[Y](t){this._currentReadPosition+=t,this._rawData=this._rawData[b](t)}[$e](t){this._sampleRate=t[q][g],t[q][U]=t[ct]>0?Math.round(t[w][i]/t[ct])*8:0,t[Ct]=this._frameNumber++,t[qt]=this._totalBytesOut,t[jt]=this._totalSamples,t[Wt]=this._totalSamples/this._sampleRate*1e3,t[Me]=this._crc32(t[w]),this._headerCache[x0](t[q][U],t[Wt]),this._totalBytesOut+=t[w][i],this._totalSamples+=t[x]}[Lt](t){if(t[O]){if(t[W]){let r=t[x];t[O].forEach(s=>{let e=s[x];r<e&&(s[x]=r>0?r:0,s[ct]=s[x]/s[q][g]*1e3),r-=e,this[$e](s)})}else t[x]=0,t[O].forEach(r=>{t[x]+=r[x],this[$e](r)});t[ct]=t[x]/this._sampleRate*1e3||0,t[jt]=this._totalSamples,t[Wt]=this._totalSamples/this._sampleRate*1e3||0,t[qt]=this._totalBytesOut}else this[$e](t)}_log(t,r){if(this._enableLogging){let s=[`${F}: ${this[F]}`,`inputMimeType: ${this._inputMimeType}`,`readPosition: ${this._currentReadPosition}`,`totalBytesIn: ${this._totalBytesIn}`,`${qt}: ${this._totalBytesOut}`],e=Math.max(...s.map(n=>n[i]));r.push(`--stats--${"-".repeat(e-9)}`,...s,"-".repeat(e)),t("codec-parser",r.reduce((n,a)=>n+`
2
+ `+a,""))}}[st](...t){this._log(console.warn,t)}[g0](...t){this._log(console.error,t)}};var _r=n0,Sr=K;var yr=O,Cr=ie;var wr=w;var Fr=q;var kr=W;var Mr=pe,Pr=vt;var Hr=le;var vr=l;var Dr=he;var Rr=jt;import{createOpusDecoder as rs}from"../core.js";var A0=Object.freeze({channelData:Object.freeze([]),sampleRate:0});async function ss(o){let t=o instanceof Uint8Array?o:new Uint8Array(o),r=await os();try{let s=r.decode(t),e=r.flush();return ns(s,e)}finally{r.free()}}async function os(){let o=await rs(),t=new _r("application/ogg",{onCodec:c=>{if(c!=="opus")throw Error("@audio/decode-opus does not support this codec "+c)},enableFrameCRC32:!1}),r=!1,s=0,e=!1,n=!1,a=c=>{let p=[];for(let _ of c){let A=_[yr];if(A.length){if(!r){let D=A[0][Fr];o.configure({sampleRate:48e3,channels:D[vr],streamCount:D[Dr],coupledStreamCount:D[Cr],channelMappingTable:D[Hr],preSkip:D[Pr],outputGain:D[Mr]}),r=!0,s=0}let v=o.decodeFrames(A.map(D=>D[wr]));s+=v.samplesDecoded,v.channelData.length&&p.push(v)}if(_[kr]){if(_[Sr]!==void 0&&p.length){let v=s-_[Rr];if(v>0){let D=p[p.length-1],Vt=Math.max(0,D.samplesDecoded-v);D.channelData=D.channelData.map(wt=>wt.subarray(0,Vt)),D.samplesDecoded=Vt}}o.unconfigure(),r=!1,s=0}}return Ar(p)};return{decode(c){if(n)throw Error("Decoder already freed");if(e)throw Error("Decoder already flushed");if(!c)return A0;let p=c instanceof Uint8Array?c:new Uint8Array(c);return p.length?a([...t.parseChunk(p)]):A0},flush(){if(n||e)return A0;e=!0;try{return a([...t.flush()])}finally{t=null,o.unconfigure(),r=!1}},free(){n||(n=!0,t=null,o.free())}}}function Ar(o){if(!o.length)return A0;if(o.length===1)return o[0];let t=Math.max(...o.map(r=>r.channelData.length));return{errors:o.flatMap(r=>r.errors),channelData:Array.from({length:t},(r,s)=>{let e=o.reduce((c,p)=>c+p.channelData[s%p.channelData.length].length,0),n=new Float32Array(e),a=0;for(let c of o){let p=c.channelData[s%c.channelData.length];n.set(p,a),a+=p.length}return n}),samplesDecoded:o.reduce((r,s)=>r+s.samplesDecoded,0),sampleRate:o[0].sampleRate,bitDepth:32}}function ns(o,t){return t?.channelData?.length?o?.channelData?.length?Ar([o,t]):t:o}export{os as decoder,ss as default};
@@ -0,0 +1,25 @@
1
+ This work is offered to Krishna (https://github.com/krishnized/license).
2
+
3
+ ---
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2025 audiojs
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
23
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
25
+ OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ # @audio/decode-qoa
2
+
3
+ Decode QOA (Quite OK Audio) to PCM samples with [qoa-format](https://github.com/nicokoenig/qoa-format).
4
+
5
+ ```js
6
+ import decode, { decoder } from '@audio/decode-qoa'
7
+
8
+ let { channelData, sampleRate } = decode(qoaBytes)
9
+
10
+ let dec = decoder()
11
+ let result = dec.decode(completeQoaFile)
12
+ dec.free()
13
+ ```
14
+
15
+ `decode()` and `decoder()` are synchronous. The decoder is stateless, so every chunk must contain a complete QOA file.
16
+
17
+ ## License
18
+
19
+ [ॐ](https://github.com/krishnized/license/) · [MIT](./LICENSE)
@@ -0,0 +1,15 @@
1
+ // Generated from the audio.js manifest (params metadata is the source of truth).
2
+ // Regenerate: node tools/dts.js in @audio/compile. Do not edit by hand.
3
+
4
+ /** Automatable number — scalar, `t => value` fn, or breakpoint curve {t, v} */
5
+ type Auto = number | ((t: number) => number) | { t: number[], v: number[] }
6
+ /** Per-block param values as delivered by hosts (numbers arrive as 1-length Float32Array) */
7
+ type Live = Record<string, Float32Array | string | boolean>
8
+ type Ctx = { sampleRate: number, maxBlockSize: number, maxChannels: number, currentTime: number, duration?: number, events?: readonly any[], emit?: (name: string, ...args: any[]) => void, [k: string]: unknown }
9
+ type Process = (inputs: Float32Array[][], outputs: Float32Array[][], params: Live) => void
10
+
11
+ /** Codec plugin 'qoa' — extends audio()'s openable formats / save() targets */
12
+ export declare const qoa: {
13
+ codec: 'qoa'
14
+ decode(bytes: Uint8Array): { channelData: Float32Array[], sampleRate: number } | Promise<{ channelData: Float32Array[], sampleRate: number }>
15
+ }
@@ -0,0 +1,10 @@
1
+ // audio.js manifest — codec atom, decode half: whole-buffer bytes → { channelData,
2
+ // sampleRate }. Hosts merge with the encode half (@audio/encode-qoa) by format
3
+ // name. Format detection is magic-byte (audio-type) — no test() needed here.
4
+
5
+ import decodeFn from './decode-qoa.js'
6
+
7
+ export const qoa = {
8
+ codec: 'qoa',
9
+ decode: (bytes) => decodeFn(bytes),
10
+ }
@@ -0,0 +1,16 @@
1
+ export interface AudioData {
2
+ channelData: Float32Array[];
3
+ sampleRate: number;
4
+ }
5
+
6
+ interface QoaDecoder {
7
+ decode(data: Uint8Array | ArrayBuffer): AudioData;
8
+ flush(): AudioData;
9
+ free(): void;
10
+ }
11
+
12
+ /** Decode a complete QOA file synchronously. */
13
+ export default function decode(src: ArrayBuffer | Uint8Array): AudioData;
14
+
15
+ /** Create a synchronous stateless decoder. */
16
+ export function decoder(): QoaDecoder;
@@ -0,0 +1,275 @@
1
+ // ../../node_modules/@thi.ng/errors/deferror.js
2
+ var defError = (prefix, suffix = (msg) => msg !== void 0 ? ": " + msg : "") => class extends Error {
3
+ origMessage;
4
+ constructor(msg) {
5
+ super(prefix(msg) + suffix(msg));
6
+ this.origMessage = msg !== void 0 ? String(msg) : "";
7
+ }
8
+ };
9
+
10
+ // ../../node_modules/@thi.ng/errors/illegal-arguments.js
11
+ var IllegalArgumentError = defError(() => "illegal argument(s)");
12
+ var illegalArgs = (msg) => {
13
+ throw new IllegalArgumentError(msg);
14
+ };
15
+
16
+ // ../../node_modules/@thi.ng/errors/illegal-state.js
17
+ var IllegalStateError = defError(() => "illegal state");
18
+ var illegalState = (msg) => {
19
+ throw new IllegalStateError(msg);
20
+ };
21
+
22
+ // ../../node_modules/@thi.ng/bitstream/input.js
23
+ var U32 = 4294967296;
24
+ var BitInputStream = class {
25
+ buffer;
26
+ start;
27
+ limit;
28
+ pos;
29
+ bitPos;
30
+ bit;
31
+ constructor(buffer, offset = 0, limit = buffer.length << 3) {
32
+ this.buffer = buffer;
33
+ this.start = offset;
34
+ this.limit = limit;
35
+ this.seek(offset);
36
+ }
37
+ *[Symbol.iterator]() {
38
+ let j = this.start;
39
+ let i = j >>> 3;
40
+ let b = 7 - (j & 7);
41
+ while (j < this.limit) {
42
+ yield this.buffer[i] >>> b & 1;
43
+ if (--b < 0) {
44
+ i++;
45
+ b = 7;
46
+ }
47
+ j++;
48
+ }
49
+ }
50
+ get length() {
51
+ return this.limit;
52
+ }
53
+ get position() {
54
+ return this.bitPos;
55
+ }
56
+ seek(pos) {
57
+ if (pos < this.start || pos >= this.limit) {
58
+ illegalArgs(`seek pos out of bounds: ${pos}`);
59
+ }
60
+ this.pos = pos >>> 3;
61
+ this.bit = 8 - (pos & 7);
62
+ this.bitPos = pos;
63
+ return this;
64
+ }
65
+ read(wordSize = 1, safe = true) {
66
+ if (wordSize > 32) {
67
+ return this.read(wordSize - 32, safe) * U32 + this.read(32, safe);
68
+ } else if (wordSize > 8) {
69
+ let out = 0;
70
+ let n = wordSize & -8;
71
+ let msb = wordSize - n;
72
+ if (msb > 0) {
73
+ out = this._read(msb, safe);
74
+ }
75
+ while (n > 0) {
76
+ out = (out << 8 | this._read(8, safe)) >>> 0;
77
+ n -= 8;
78
+ }
79
+ return out;
80
+ } else {
81
+ return this._read(wordSize, safe);
82
+ }
83
+ }
84
+ readFields(fields, safe = true) {
85
+ return fields.map((word) => this.read(word, safe));
86
+ }
87
+ readWords(n, wordSize = 8, safe = true) {
88
+ let out = [];
89
+ while (n-- > 0) {
90
+ out.push(this.read(wordSize, safe));
91
+ }
92
+ return out;
93
+ }
94
+ readStruct(fields, safe = true) {
95
+ return fields.reduce((acc, [id, word]) => {
96
+ return acc[id] = this.read(word, safe), acc;
97
+ }, {});
98
+ }
99
+ readBit(safe = true) {
100
+ safe && this.checkLimit(1);
101
+ this.bit--;
102
+ this.bitPos++;
103
+ let out = this.buffer[this.pos] >>> this.bit & 1;
104
+ if (this.bit === 0) {
105
+ this.pos++;
106
+ this.bit = 8;
107
+ }
108
+ return out;
109
+ }
110
+ _read(wordSize, safe = true) {
111
+ safe && this.checkLimit(wordSize);
112
+ let l = this.bit - wordSize, out;
113
+ if (l >= 0) {
114
+ this.bit = l;
115
+ out = this.buffer[this.pos] >>> l & (1 << wordSize) - 1;
116
+ if (l === 0) {
117
+ this.pos++;
118
+ this.bit = 8;
119
+ }
120
+ } else {
121
+ out = (this.buffer[this.pos++] & (1 << this.bit) - 1) << -l;
122
+ this.bit = 8 + l;
123
+ out = out | this.buffer[this.pos] >>> this.bit;
124
+ }
125
+ this.bitPos += wordSize;
126
+ return out;
127
+ }
128
+ checkLimit(requested) {
129
+ if (this.bitPos + requested > this.limit) {
130
+ illegalState(`can't read past EOF`);
131
+ }
132
+ }
133
+ };
134
+
135
+ // ../../node_modules/qoa-format/lib/common.js
136
+ var QOA_MIN_FILESIZE = 16;
137
+ var QOA_SLICE_LEN = 20;
138
+ var QOA_SLICES_PER_FRAME = 256;
139
+ var QOA_FRAME_LEN = QOA_SLICES_PER_FRAME * QOA_SLICE_LEN;
140
+ var QOA_LMS_LEN = 4;
141
+ var QOA_MAGIC = 1903124838;
142
+ function qoa_clamp(v, min, max) {
143
+ return v < min ? min : v > max ? max : v;
144
+ }
145
+ function LMS(h, w) {
146
+ const history = new Int16Array(h || 4);
147
+ const weights = new Int16Array(w || 4);
148
+ return { history, weights };
149
+ }
150
+ function qoa_lms_predict(weights, history) {
151
+ return weights[0] * history[0] + weights[1] * history[1] + weights[2] * history[2] + weights[3] * history[3] >> 13;
152
+ }
153
+ function qoa_lms_update(weights, history, sample, residual) {
154
+ let delta = residual >> 4;
155
+ weights[0] += history[0] < 0 ? -delta : delta;
156
+ weights[1] += history[1] < 0 ? -delta : delta;
157
+ weights[2] += history[2] < 0 ? -delta : delta;
158
+ weights[3] += history[3] < 0 ? -delta : delta;
159
+ history[0] = history[1];
160
+ history[1] = history[2];
161
+ history[2] = history[3];
162
+ history[3] = sample;
163
+ }
164
+ var qoa_round = (num) => Math.sign(num) * Math.round(Math.abs(num));
165
+ var qoa_scalefactor_tab = Array(16).fill().map((_, s) => qoa_round(Math.pow(s + 1, 2.75)));
166
+ var dqt = [0.75, -0.75, 2.5, -2.5, 4.5, -4.5, 7, -7];
167
+ var qoa_dequant_tab = qoa_scalefactor_tab.map((sf) => {
168
+ return dqt.map((dq) => qoa_round(dq * sf));
169
+ });
170
+
171
+ // ../../node_modules/qoa-format/decode.js
172
+ function decodeHeader(stream) {
173
+ const magic = stream.read(32);
174
+ if (magic !== QOA_MAGIC) {
175
+ throw new Error(`Not a QOA file; expected magic number 'qoaf'`);
176
+ }
177
+ const header = {
178
+ samples: stream.read(32),
179
+ channels: stream.read(8),
180
+ sampleRate: stream.read(24)
181
+ };
182
+ stream.seek(64);
183
+ return header;
184
+ }
185
+ function qoa_decode_frame(stream, audio, lmses, channelData, sampleOffset) {
186
+ const channels = stream.read(8);
187
+ const sampleRate = stream.read(24);
188
+ const samples = stream.read(16);
189
+ const frameSize = stream.read(16);
190
+ const dataSize = Math.floor(frameSize - 8 - QOA_LMS_LEN * 4 * channels);
191
+ const numSlices = Math.floor(dataSize / 8);
192
+ const maxTotalSamples = numSlices * QOA_SLICE_LEN;
193
+ if (channels != audio.channels || sampleRate != audio.sampleRate || samples * channels > maxTotalSamples) {
194
+ throw new Error(`invalid frame header data`);
195
+ }
196
+ for (let c = 0; c < channels; c++) {
197
+ const lms = lmses[c];
198
+ for (let i = 0; i < QOA_LMS_LEN; i++) {
199
+ let h = stream.read(16);
200
+ lms.history[i] = h;
201
+ }
202
+ for (let i = 0; i < QOA_LMS_LEN; i++) {
203
+ let w = stream.read(16);
204
+ lms.weights[i] = w;
205
+ }
206
+ }
207
+ for (let sample_index = 0; sample_index < samples; sample_index += QOA_SLICE_LEN) {
208
+ for (let c = 0; c < channels; c++) {
209
+ const scalefactor = stream.read(4);
210
+ const table = qoa_dequant_tab[scalefactor];
211
+ const slice_start = sample_index;
212
+ const slice_end = Math.min(sample_index + QOA_SLICE_LEN, samples);
213
+ const slice_count = slice_end - slice_start;
214
+ const lms = lmses[c];
215
+ const sampleData = channelData[c];
216
+ let idx = sampleOffset + slice_start;
217
+ const weights = lms.weights;
218
+ const history = lms.history;
219
+ let bitsRemaining = 60;
220
+ for (let i = 0; i < slice_count; i++) {
221
+ const predicted = qoa_lms_predict(weights, history);
222
+ const quantized = stream.read(3);
223
+ const dequantized = table[quantized];
224
+ const reconstructed = qoa_clamp(predicted + dequantized, -32768, 32767);
225
+ const sample = reconstructed < 0 ? reconstructed / 32768 : reconstructed / 32767;
226
+ sampleData[idx++] = sample;
227
+ qoa_lms_update(weights, history, reconstructed, dequantized);
228
+ bitsRemaining -= 3;
229
+ }
230
+ if (bitsRemaining > 0) {
231
+ stream.read(bitsRemaining);
232
+ }
233
+ }
234
+ }
235
+ return samples;
236
+ }
237
+ function decode(data) {
238
+ if (data.byteLength < QOA_MIN_FILESIZE) {
239
+ throw new Error(`QOA file size must be >= ${QOA_MIN_FILESIZE}`);
240
+ }
241
+ const stream = new BitInputStream(data);
242
+ const audio = decodeHeader(stream);
243
+ const channelData = [];
244
+ const lmses = [];
245
+ for (let c = 0; c < audio.channels; c++) {
246
+ const d = new Float32Array(audio.samples);
247
+ channelData.push(d);
248
+ lmses.push(LMS());
249
+ }
250
+ let sampleIndex = 0;
251
+ let frameLen = 0;
252
+ do {
253
+ frameLen = qoa_decode_frame(stream, audio, lmses, channelData, sampleIndex);
254
+ sampleIndex += frameLen;
255
+ } while (frameLen && sampleIndex < audio.samples);
256
+ return {
257
+ ...audio,
258
+ channelData
259
+ };
260
+ }
261
+
262
+ // src/decode-qoa.src.js
263
+ var decodeQoa = (src) => decode(src instanceof Uint8Array ? src : new Uint8Array(src));
264
+ function decoder() {
265
+ return {
266
+ decode: decodeQoa,
267
+ flush: () => ({ channelData: [], sampleRate: 0 }),
268
+ free: () => {
269
+ }
270
+ };
271
+ }
272
+ export {
273
+ decoder,
274
+ decodeQoa as default
275
+ };
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@audio/decode-qoa",
3
+ "version": "1.2.0",
4
+ "description": "Decode QOA audio to PCM samples",
5
+ "type": "module",
6
+ "main": "decode-qoa.js",
7
+ "types": "decode-qoa.d.ts",
8
+ "exports": {
9
+ ".": "./decode-qoa.js",
10
+ "./audio": {
11
+ "types": "./audio.d.ts",
12
+ "default": "./audio.js"
13
+ },
14
+ "./package.json": "./package.json"
15
+ },
16
+ "files": [
17
+ "decode-qoa.js",
18
+ "decode-qoa.d.ts",
19
+ "LICENSE",
20
+ "audio.js",
21
+ "audio.d.ts"
22
+ ],
23
+ "scripts": {
24
+ "build": "bash build.sh",
25
+ "prepack": "npm run build",
26
+ "test": "node test.js"
27
+ },
28
+ "keywords": [
29
+ "qoa",
30
+ "audio",
31
+ "decode",
32
+ "decoder",
33
+ "quite-ok-audio"
34
+ ],
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "license": "MIT",
39
+ "author": "audiojs",
40
+ "homepage": "https://github.com/audiojs/decode/tree/master/packages/decode-qoa#readme",
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/audiojs/decode.git",
44
+ "directory": "packages/decode-qoa"
45
+ },
46
+ "bugs": "https://github.com/audiojs/decode/issues",
47
+ "dependencies": {
48
+ "qoa-format": "^1.0.1"
49
+ },
50
+ "engines": {
51
+ "node": ">=18"
52
+ },
53
+ "audio": "./audio.js",
54
+ "sideEffects": false,
55
+ "funding": "https://github.com/sponsors/audiojs"
56
+ }