@poe-platform/safe-bash 0.1.814 → 0.1.816

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 (602) hide show
  1. package/dist/image-ast/index.js +1 -1
  2. package/dist/mp4-ast/codecs.d.ts +3 -0
  3. package/dist/mp4-ast/esds-source.d.ts +7 -0
  4. package/dist/mp4-ast/index.d.ts +6 -1
  5. package/dist/mp4-ast/mp4-codec-metadata.d.ts +48 -0
  6. package/dist/mp4-ast/mp4-codec-source.d.ts +8 -0
  7. package/dist/mp4-ast/mp4-fragment-source.d.ts +35 -0
  8. package/dist/mp4-ast/mp4-packets-source.d.ts +11 -0
  9. package/dist/mp4-ast/mp4-sample-source.d.ts +5 -2
  10. package/dist/mp4-ast/types.d.ts +11 -0
  11. package/dist/pdf-ast/ast.d.ts +6 -0
  12. package/dist/pdf-ast/content/evaluator.d.ts +4 -1
  13. package/dist/pdf-ast/content/stored-dictionary.d.ts +15 -1
  14. package/dist/pdf-ast/content/stored-record.d.ts +6 -0
  15. package/dist/pdf-ast/cos/object-reader.d.ts +3 -2
  16. package/dist/pdf-ast/cos/retained-writer.d.ts +1 -0
  17. package/dist/pdf-ast/cos/value-parser.d.ts +5 -0
  18. package/dist/pdf-ast/edit/forms.d.ts +1 -0
  19. package/dist/pdf-ast/edit/retained-form-data.d.ts +9 -0
  20. package/dist/pdf-ast/edit/retained-graph.d.ts +1 -0
  21. package/dist/pdf-ast/edit/retained-page-copy.d.ts +10 -0
  22. package/dist/pdf-ast/extract/images.d.ts +2 -1
  23. package/dist/pdf-ast/fonts/resolve.d.ts +1 -0
  24. package/dist/pdf-ast/index.d.ts +3 -0
  25. package/dist/pdf-ast/index.js +1563 -373
  26. package/dist/pdf-ast/render/raster.d.ts +14 -0
  27. package/dist/pdf-ast/render/svg-image-stream.d.ts +6 -0
  28. package/dist/pdf-ast/render/svg-path-stream.d.ts +15 -0
  29. package/dist/pdf-ast/retained-document.d.ts +1 -1
  30. package/dist/safe-bash/chunks/{chunk-I6ECNJMR.js → chunk-AXGI5JVL.js} +1 -1
  31. package/dist/safe-bash/chunks/{chunk-TPG55BAQ.js → chunk-FQRI5AS5.js} +1 -1
  32. package/dist/safe-bash/chunks/{chunk-TWWGAW4M.js → chunk-HD6DWOAC.js} +1 -1
  33. package/dist/safe-bash/chunks/{chunk-5JCZEXEM.js → chunk-SXSEF5E2.js} +12 -7
  34. package/dist/safe-bash/command-chunks/biff-UBP2BZLK-JPODPKS3.js +5448 -0
  35. package/dist/safe-bash/command-chunks/{chunk-S7HIOT7Z.js → chunk-26JE5JEB.js} +4 -4
  36. package/dist/safe-bash/command-chunks/{chunk-AG2SNMP5.js → chunk-2ALHVXEM.js} +2 -2
  37. package/dist/safe-bash/command-chunks/{chunk-4YLACJHE.js → chunk-2IMIKROX.js} +6 -6
  38. package/dist/safe-bash/command-chunks/{chunk-MYZ46FQL.js → chunk-2QZUAZTH.js} +1 -1
  39. package/dist/safe-bash/command-chunks/{chunk-YAD7EV4N.js → chunk-2TWXRJPB.js} +11 -11
  40. package/dist/safe-bash/command-chunks/{chunk-NYFYTL5G.js → chunk-345YBIHP.js} +27 -27
  41. package/dist/safe-bash/command-chunks/{chunk-3MG5EAMX.js → chunk-35DU6I2M.js} +5 -5
  42. package/dist/safe-bash/command-chunks/{chunk-FSVJ67G5.js → chunk-3DWFXESW.js} +2 -2
  43. package/dist/safe-bash/command-chunks/{chunk-TKCUGMRZ.js → chunk-3K5CVXUV.js} +18 -18
  44. package/dist/safe-bash/command-chunks/{chunk-6LPSKLLD.js → chunk-3MUFXGA2.js} +3 -3
  45. package/dist/safe-bash/command-chunks/{chunk-AVGXFWEB.js → chunk-3PM46VWH.js} +191 -70
  46. package/dist/safe-bash/command-chunks/{chunk-6QYSF7I2.js → chunk-3ZWFE4CK.js} +7 -7
  47. package/dist/safe-bash/command-chunks/{chunk-LAPOMHGY.js → chunk-45DKGZYO.js} +857 -424
  48. package/dist/safe-bash/command-chunks/{chunk-SW37YCBW.js → chunk-4772DJKS.js} +54 -36
  49. package/dist/safe-bash/command-chunks/{chunk-FOONI6BD.js → chunk-4ABR3KGK.js} +7 -7
  50. package/dist/safe-bash/command-chunks/{chunk-7KZ5LWV2.js → chunk-4IDV763L.js} +1 -1
  51. package/dist/safe-bash/command-chunks/{chunk-FGGHYUWR.js → chunk-4QEJPP3K.js} +102 -7
  52. package/dist/safe-bash/command-chunks/{chunk-RV5AGXOV.js → chunk-4X2MPZXW.js} +2 -2
  53. package/dist/safe-bash/command-chunks/{chunk-LNTEV56A.js → chunk-4YFTJS5U.js} +2 -2
  54. package/dist/safe-bash/command-chunks/{chunk-6XES7Z4G.js → chunk-57PK2QFX.js} +12 -12
  55. package/dist/safe-bash/command-chunks/{chunk-42MEXZBJ.js → chunk-5GDF5FAS.js} +1 -1
  56. package/dist/safe-bash/command-chunks/{chunk-BS3ZEQGT.js → chunk-5KZMR6AJ.js} +18 -16
  57. package/dist/safe-bash/command-chunks/{chunk-ZU2KJMXO.js → chunk-5MNQTHED.js} +10 -10
  58. package/dist/safe-bash/command-chunks/{chunk-W25EIKDJ.js → chunk-5NC2IQMQ.js} +1 -1
  59. package/dist/safe-bash/command-chunks/{chunk-KY4LCHUF.js → chunk-5O45KGW5.js} +1 -1
  60. package/dist/safe-bash/command-chunks/{chunk-GYM5ICK4.js → chunk-5V7WIQ2D.js} +7 -7
  61. package/dist/safe-bash/command-chunks/{chunk-3JM7E42I.js → chunk-5XUWGUGN.js} +114 -35
  62. package/dist/safe-bash/command-chunks/{chunk-SUTHGUD3.js → chunk-5YL453ZF.js} +34 -34
  63. package/dist/safe-bash/command-chunks/{chunk-IHXZMAMY.js → chunk-62RG3GHF.js} +6 -6
  64. package/dist/safe-bash/command-chunks/{chunk-P2LT6TGR.js → chunk-6EZWG56T.js} +9 -9
  65. package/dist/safe-bash/command-chunks/{chunk-CCMAHM3I.js → chunk-6JGICYHP.js} +2 -2
  66. package/dist/safe-bash/command-chunks/{chunk-AWPI4DZR.js → chunk-6KJDTKE4.js} +3 -3
  67. package/dist/safe-bash/command-chunks/{chunk-FUQMEUAT.js → chunk-6M3JTPKE.js} +8 -8
  68. package/dist/safe-bash/command-chunks/{chunk-H33D4R26.js → chunk-6RLWPB44.js} +4 -4
  69. package/dist/safe-bash/command-chunks/{chunk-3GRMU7TM.js → chunk-6W4RMBFH.js} +6 -6
  70. package/dist/safe-bash/command-chunks/{chunk-RIVKF77R.js → chunk-6YF2QADH.js} +6 -6
  71. package/dist/safe-bash/command-chunks/{chunk-LEO4VRIN.js → chunk-77ROD2TR.js} +5 -5
  72. package/dist/safe-bash/command-chunks/{chunk-XNGM3W5R.js → chunk-7B2MHKIW.js} +1 -1
  73. package/dist/safe-bash/command-chunks/{chunk-RFMHNTTF.js → chunk-7OCTMVYJ.js} +1 -1
  74. package/dist/safe-bash/command-chunks/{chunk-DBLQUZGN.js → chunk-7PYDVQPB.js} +2 -2
  75. package/dist/safe-bash/command-chunks/{chunk-AM5LANIE.js → chunk-A2L3U7DW.js} +7 -7
  76. package/dist/safe-bash/command-chunks/{chunk-UYGQEQIP.js → chunk-A4P37F3P.js} +5 -5
  77. package/dist/safe-bash/command-chunks/{chunk-ADHFF2IM.js → chunk-A5SPMSKD.js} +9 -9
  78. package/dist/safe-bash/command-chunks/{chunk-ENEIE44W.js → chunk-A6OTPNNI.js} +3 -3
  79. package/dist/safe-bash/command-chunks/chunk-AF2IO57Q.js +733 -0
  80. package/dist/safe-bash/command-chunks/{chunk-AFPXADZG.js → chunk-AHD3CGAY.js} +4 -4
  81. package/dist/safe-bash/command-chunks/{chunk-VT7UBPAE.js → chunk-ALD53QFL.js} +89 -30
  82. package/dist/safe-bash/command-chunks/{chunk-4B2ZUGLT.js → chunk-ARE267HR.js} +5 -5
  83. package/dist/safe-bash/command-chunks/{chunk-OTF2AJ5M.js → chunk-AYQPJQJR.js} +6 -6
  84. package/dist/safe-bash/command-chunks/{chunk-2VVJRVYM.js → chunk-B6XTAKKQ.js} +1 -1
  85. package/dist/safe-bash/command-chunks/{chunk-GCHB7VNX.js → chunk-BIJW6QWB.js} +17 -17
  86. package/dist/safe-bash/command-chunks/{chunk-OVEPYULA.js → chunk-BKK4MS3V.js} +1 -1
  87. package/dist/safe-bash/command-chunks/{chunk-3EB2FSAN.js → chunk-BOVDUJ3A.js} +7 -7
  88. package/dist/safe-bash/command-chunks/{chunk-SEPUP6TZ.js → chunk-BSTABZIK.js} +1 -1
  89. package/dist/safe-bash/command-chunks/{chunk-ATHHWPSE.js → chunk-BZRWZ6GO.js} +1 -1
  90. package/dist/safe-bash/command-chunks/{chunk-5BIQWWLB.js → chunk-CFMJXJS5.js} +1 -1
  91. package/dist/safe-bash/command-chunks/{chunk-BZMNC7Q5.js → chunk-CGJ7GMHO.js} +7 -7
  92. package/dist/safe-bash/command-chunks/{chunk-RGDOYWOD.js → chunk-CHZE6FNT.js} +2 -2
  93. package/dist/safe-bash/command-chunks/{chunk-V7E3PZOK.js → chunk-CKA7ZROU.js} +7 -7
  94. package/dist/safe-bash/command-chunks/{chunk-MEM2ZPMI.js → chunk-CKIXC7AO.js} +3 -3
  95. package/dist/safe-bash/command-chunks/{chunk-Y54L4P4J.js → chunk-CORUUCS2.js} +5 -5
  96. package/dist/safe-bash/command-chunks/{chunk-FF7UGJWS.js → chunk-DBZCTL7C.js} +150 -35
  97. package/dist/safe-bash/command-chunks/{chunk-6ZGCKUAM.js → chunk-DIRK47GT.js} +1 -1
  98. package/dist/safe-bash/command-chunks/{chunk-WYZG3DRR.js → chunk-DM5WURQL.js} +2 -2
  99. package/dist/safe-bash/command-chunks/{chunk-EBHOZIBS.js → chunk-DOVWHVHI.js} +6 -6
  100. package/dist/safe-bash/command-chunks/{chunk-GQGMQMIM.js → chunk-DXOXUKQB.js} +248 -6
  101. package/dist/safe-bash/command-chunks/{chunk-JR3Q6QNL.js → chunk-DZOKH5BL.js} +7 -7
  102. package/dist/safe-bash/command-chunks/{chunk-K4XNUJVJ.js → chunk-E22EAYJN.js} +197 -171
  103. package/dist/safe-bash/command-chunks/{chunk-3EASXF5D.js → chunk-E4TF5W6O.js} +2 -2
  104. package/dist/safe-bash/command-chunks/{chunk-MLOYUXUV.js → chunk-EJ4UP7DA.js} +31 -9
  105. package/dist/safe-bash/command-chunks/{chunk-USGZN2KE.js → chunk-ENMJHB2C.js} +5 -5
  106. package/dist/safe-bash/command-chunks/{chunk-ZSQZHFWS.js → chunk-ERWIJYCS.js} +7 -7
  107. package/dist/safe-bash/command-chunks/{chunk-S2QNBAN6.js → chunk-ET6LMDEX.js} +12 -12
  108. package/dist/safe-bash/command-chunks/{chunk-6XGDWFNQ.js → chunk-EWC56JNI.js} +5 -5
  109. package/dist/safe-bash/command-chunks/{chunk-EQWFKNHJ.js → chunk-EZDWPTYB.js} +19 -19
  110. package/dist/safe-bash/command-chunks/{chunk-CQBACD2V.js → chunk-F2NF6FHV.js} +2 -2
  111. package/dist/safe-bash/command-chunks/{chunk-NFII726L.js → chunk-FAU2KL6I.js} +2 -2
  112. package/dist/safe-bash/command-chunks/{chunk-4EHY6J2Z.js → chunk-FB2WPI3M.js} +5 -5
  113. package/dist/safe-bash/command-chunks/{chunk-2PKBXGXD.js → chunk-FEBTT5NH.js} +5 -5
  114. package/dist/safe-bash/command-chunks/chunk-FGARVKAX.js +704 -0
  115. package/dist/safe-bash/command-chunks/{chunk-N4MUBJCT.js → chunk-FGHSE3RZ.js} +1 -1
  116. package/dist/safe-bash/command-chunks/{chunk-WBKB7HBZ.js → chunk-FHQOFEQK.js} +8 -8
  117. package/dist/safe-bash/command-chunks/{chunk-3ZRCL756.js → chunk-FJLSYX5P.js} +7 -7
  118. package/dist/safe-bash/command-chunks/{chunk-PMWW7KSB.js → chunk-FJSD43VF.js} +1 -1
  119. package/dist/safe-bash/command-chunks/{chunk-XKAUKLF7.js → chunk-FLSXHLJG.js} +9 -9
  120. package/dist/safe-bash/command-chunks/{chunk-3EW7GYHM.js → chunk-FR63MJSO.js} +7 -7
  121. package/dist/safe-bash/command-chunks/{chunk-NRFTYZ2R.js → chunk-FUYZUETI.js} +6 -6
  122. package/dist/safe-bash/command-chunks/{chunk-JUHOL5KB.js → chunk-G3FK5VVG.js} +1 -1
  123. package/dist/safe-bash/command-chunks/{chunk-4UPKVQWH.js → chunk-G3LUT475.js} +6 -6
  124. package/dist/safe-bash/command-chunks/{chunk-Q7UZTMF4.js → chunk-GAROGIVU.js} +1 -1
  125. package/dist/safe-bash/command-chunks/{chunk-4RRYWHED.js → chunk-GMBUOYTN.js} +4 -4
  126. package/dist/safe-bash/command-chunks/{chunk-FYYFV6PW.js → chunk-GR4ONCQ5.js} +6 -6
  127. package/dist/safe-bash/command-chunks/{chunk-XTEIT5CI.js → chunk-GTOMW4VV.js} +1 -1
  128. package/dist/safe-bash/command-chunks/{chunk-OVQP6KH5.js → chunk-H56BSMFQ.js} +6 -6
  129. package/dist/safe-bash/command-chunks/{chunk-RQYPFLZJ.js → chunk-HOJ7WDTS.js} +6 -6
  130. package/dist/safe-bash/command-chunks/{chunk-BLIFGBIO.js → chunk-HOKPYTHQ.js} +2 -2
  131. package/dist/safe-bash/command-chunks/chunk-HQEYSSZV.js +152 -0
  132. package/dist/safe-bash/command-chunks/{chunk-NEMUPUUB.js → chunk-ICJH6A73.js} +7 -7
  133. package/dist/safe-bash/command-chunks/{chunk-CSE4VQKG.js → chunk-IJE65P52.js} +3 -3
  134. package/dist/safe-bash/command-chunks/{chunk-MKOIPOXX.js → chunk-IOXMGD2H.js} +3 -3
  135. package/dist/safe-bash/command-chunks/{chunk-LDW3RF7Y.js → chunk-ISFGPCED.js} +12 -12
  136. package/dist/safe-bash/command-chunks/{chunk-S43QRKDC.js → chunk-IVKAFEPO.js} +7 -7
  137. package/dist/safe-bash/command-chunks/{chunk-A347DLRB.js → chunk-IWVANZWH.js} +3 -3
  138. package/dist/safe-bash/command-chunks/{chunk-ZXELXF2H.js → chunk-IZ3SD5S2.js} +4 -4
  139. package/dist/safe-bash/command-chunks/{chunk-HGIMFVI2.js → chunk-J6FNSVHT.js} +5 -5
  140. package/dist/safe-bash/command-chunks/{chunk-GLAF45M7.js → chunk-JA36YOZI.js} +1 -1
  141. package/dist/safe-bash/command-chunks/{chunk-WHNYT34N.js → chunk-K2R7H3KO.js} +1 -1
  142. package/dist/safe-bash/command-chunks/{chunk-2ETEJOYX.js → chunk-K7VDCBXW.js} +21 -21
  143. package/dist/safe-bash/command-chunks/{chunk-CK2WFJZN.js → chunk-KASXIRKD.js} +12 -14
  144. package/dist/safe-bash/command-chunks/{chunk-CKEMZUE3.js → chunk-KDBU5Q2N.js} +6 -6
  145. package/dist/safe-bash/command-chunks/{chunk-6VBDJC6V.js → chunk-KDDXLHN7.js} +6 -6
  146. package/dist/safe-bash/command-chunks/chunk-KHUT7BB5.js +65 -0
  147. package/dist/safe-bash/command-chunks/{chunk-NEVQWOU6.js → chunk-KLAC2MIZ.js} +10 -10
  148. package/dist/safe-bash/command-chunks/{chunk-QGD64UHJ.js → chunk-KLCHCSIV.js} +1 -1
  149. package/dist/safe-bash/command-chunks/{chunk-CXME4YHU.js → chunk-KM2SMMXZ.js} +59 -201
  150. package/dist/safe-bash/command-chunks/{chunk-RHU44OMN.js → chunk-KXM3HTAF.js} +1 -1
  151. package/dist/safe-bash/command-chunks/{chunk-AVOGFREX.js → chunk-KYIGYYEY.js} +3 -3
  152. package/dist/safe-bash/command-chunks/{chunk-5OM3UIK3.js → chunk-L2VLASZ4.js} +3 -3
  153. package/dist/safe-bash/command-chunks/{chunk-Z7QOSXQC.js → chunk-LECGQSQW.js} +7 -7
  154. package/dist/safe-bash/command-chunks/{chunk-RXQ2G2YK.js → chunk-LFSWLJPR.js} +9 -9
  155. package/dist/safe-bash/command-chunks/{chunk-OSYY6E23.js → chunk-LJ3UYESS.js} +1 -1
  156. package/dist/safe-bash/command-chunks/{chunk-MVLVIMJ6.js → chunk-LMLBQSAM.js} +6 -6
  157. package/dist/safe-bash/command-chunks/{chunk-MGMTRGKM.js → chunk-LNAZ3E4Q.js} +4 -4
  158. package/dist/safe-bash/command-chunks/{chunk-WJ2ERUCQ.js → chunk-LNKZVU5V.js} +1 -1
  159. package/dist/safe-bash/command-chunks/{chunk-WWHMI4S3.js → chunk-LQDANF2B.js} +8 -8
  160. package/dist/safe-bash/command-chunks/{chunk-CIRDVCAZ.js → chunk-LQX7RAF7.js} +7 -7
  161. package/dist/safe-bash/command-chunks/{chunk-SWAKALDJ.js → chunk-LT2YCGC5.js} +10 -10
  162. package/dist/safe-bash/command-chunks/{chunk-Y7AXMCFV.js → chunk-LZY46GYY.js} +8 -8
  163. package/dist/safe-bash/command-chunks/{chunk-VT2PHQ63.js → chunk-MDFNUNK5.js} +15 -15
  164. package/dist/safe-bash/command-chunks/{chunk-YP3WWV5N.js → chunk-MN3BB4WW.js} +4 -4
  165. package/dist/safe-bash/command-chunks/{chunk-WTVJLHMG.js → chunk-MOUCMZZP.js} +1 -1
  166. package/dist/safe-bash/command-chunks/{chunk-IB5QP4LF.js → chunk-MQE77MEQ.js} +3 -3
  167. package/dist/safe-bash/command-chunks/{chunk-FSYMSWJU.js → chunk-MUTARE5I.js} +6 -6
  168. package/dist/safe-bash/command-chunks/{chunk-F762XDNG.js → chunk-MZYQKH26.js} +3 -3
  169. package/dist/safe-bash/command-chunks/{chunk-N6G3345Q.js → chunk-N32AP43V.js} +7 -7
  170. package/dist/safe-bash/command-chunks/{chunk-XU6S3XUZ.js → chunk-N35IJXBK.js} +9 -9
  171. package/dist/safe-bash/command-chunks/{chunk-EVYKV3QI.js → chunk-N3ZH4YYH.js} +3 -3
  172. package/dist/safe-bash/command-chunks/{chunk-VUWXLH3E.js → chunk-N4HWOLGZ.js} +2 -2
  173. package/dist/safe-bash/command-chunks/{chunk-G3TAX3CV.js → chunk-N5J3IZZK.js} +8124 -7200
  174. package/dist/safe-bash/command-chunks/{chunk-W3ZSWK76.js → chunk-NCNHJRIY.js} +8 -8
  175. package/dist/safe-bash/command-chunks/{chunk-FXCSPPYE.js → chunk-NDALIHKK.js} +20 -20
  176. package/dist/safe-bash/command-chunks/{chunk-BS5JEUEW.js → chunk-NKK76B4V.js} +8 -8
  177. package/dist/safe-bash/command-chunks/{chunk-4EZJV4FZ.js → chunk-NLCUQD7Y.js} +1 -1
  178. package/dist/safe-bash/command-chunks/{chunk-RHDERFMR.js → chunk-O2HNOQQG.js} +5 -5
  179. package/dist/safe-bash/command-chunks/{chunk-G2COZLXX.js → chunk-OBIXFO25.js} +10 -10
  180. package/dist/safe-bash/command-chunks/{chunk-47IAU25U.js → chunk-OCV5ZU35.js} +3 -3
  181. package/dist/safe-bash/command-chunks/{chunk-3YEQI5B7.js → chunk-OFDJJRAD.js} +9 -9
  182. package/dist/safe-bash/command-chunks/{chunk-VDTFVRYX.js → chunk-OFONWWEZ.js} +2 -2
  183. package/dist/safe-bash/command-chunks/{chunk-F4YFTO2K.js → chunk-OHEZQ4QA.js} +9 -9
  184. package/dist/safe-bash/command-chunks/{chunk-JW6WVNTM.js → chunk-OIHQXURE.js} +1 -1
  185. package/dist/safe-bash/command-chunks/{chunk-ZTMZO4IT.js → chunk-ONQP4FNV.js} +1 -1
  186. package/dist/safe-bash/command-chunks/{chunk-K2WOMJOQ.js → chunk-OVUY46QF.js} +1 -1
  187. package/dist/safe-bash/command-chunks/{chunk-DGBQ7QDE.js → chunk-OWCBX5M2.js} +1 -1
  188. package/dist/safe-bash/command-chunks/{chunk-LKGTH2Q7.js → chunk-P462JTNT.js} +5 -5
  189. package/dist/safe-bash/command-chunks/{chunk-5LFGXN3D.js → chunk-P4OWVKMD.js} +6 -6
  190. package/dist/safe-bash/command-chunks/{chunk-46AMTJPE.js → chunk-POGVOCOB.js} +8 -8
  191. package/dist/safe-bash/command-chunks/{chunk-PLMF35XK.js → chunk-PPN53PX3.js} +4 -4
  192. package/dist/safe-bash/command-chunks/{chunk-V5XC43BX.js → chunk-PRO7JOIH.js} +8 -8
  193. package/dist/safe-bash/command-chunks/{chunk-UJERQEJB.js → chunk-PU5DMQGG.js} +1 -1
  194. package/dist/safe-bash/command-chunks/{chunk-IWHNRYER.js → chunk-Q65GWGQR.js} +3 -3
  195. package/dist/safe-bash/command-chunks/{chunk-BLGGAHQW.js → chunk-QCIAX6HZ.js} +1 -1
  196. package/dist/safe-bash/command-chunks/{chunk-ET5SFGRH.js → chunk-QDV2NIFR.js} +1 -1
  197. package/dist/safe-bash/command-chunks/{chunk-Y42KSX63.js → chunk-QMBMZSJF.js} +6 -6
  198. package/dist/safe-bash/command-chunks/{chunk-KUOCGGEU.js → chunk-QNETPOMH.js} +6 -5
  199. package/dist/safe-bash/command-chunks/{chunk-QB72X7FF.js → chunk-QNX5LZBK.js} +7 -7
  200. package/dist/safe-bash/command-chunks/{chunk-LZ2JFMKT.js → chunk-QOKFSYD5.js} +9 -9
  201. package/dist/safe-bash/command-chunks/{chunk-7DOLY7IV.js → chunk-R7LF4XQV.js} +2 -2
  202. package/dist/safe-bash/command-chunks/{chunk-PIVH35EQ.js → chunk-RINR7XPR.js} +37 -10
  203. package/dist/safe-bash/command-chunks/{chunk-MPXMRTMY.js → chunk-ROQ3VNVX.js} +8 -8
  204. package/dist/safe-bash/command-chunks/{chunk-6WNVGCXD.js → chunk-RRAQII52.js} +5 -5
  205. package/dist/safe-bash/command-chunks/{chunk-2BNGPR6Z.js → chunk-RTHYAGKI.js} +2 -2
  206. package/dist/safe-bash/command-chunks/chunk-RTKDZBJS.js +816 -0
  207. package/dist/safe-bash/command-chunks/{chunk-JVKE7YZN.js → chunk-RVWIEXR7.js} +4 -4
  208. package/dist/safe-bash/command-chunks/{chunk-XM5QJCPD.js → chunk-S5ER73EA.js} +8 -8
  209. package/dist/safe-bash/command-chunks/{chunk-YRPXBGRX.js → chunk-SBXS4S6Y.js} +3 -3
  210. package/dist/safe-bash/command-chunks/{chunk-HI6ZYH3W.js → chunk-SHLT5R64.js} +9 -9
  211. package/dist/safe-bash/command-chunks/{chunk-Q5PWYPQV.js → chunk-SICTBSLW.js} +7 -7
  212. package/dist/safe-bash/command-chunks/{chunk-AXXZNB7U.js → chunk-SL4LD25A.js} +9 -9
  213. package/dist/safe-bash/command-chunks/{chunk-JGKSWDGP.js → chunk-SNA2LVBX.js} +1 -1
  214. package/dist/safe-bash/command-chunks/{chunk-TXPDKEGY.js → chunk-SWIF6BBY.js} +8 -8
  215. package/dist/safe-bash/command-chunks/{chunk-PS5GDFIP.js → chunk-T2FRXSQT.js} +2 -2
  216. package/dist/safe-bash/command-chunks/{chunk-HELAVGZH.js → chunk-T4SEQU66.js} +3 -3
  217. package/dist/safe-bash/command-chunks/{chunk-3SPLP2DB.js → chunk-T5OQ53XS.js} +1 -1
  218. package/dist/safe-bash/command-chunks/{chunk-KBAQHE5Y.js → chunk-TG2RVQLP.js} +2 -2
  219. package/dist/safe-bash/command-chunks/{chunk-CZ5K2YPU.js → chunk-TXU7MMHN.js} +24 -24
  220. package/dist/safe-bash/command-chunks/{chunk-TYPS5MOU.js → chunk-TXWDR2P4.js} +1 -1
  221. package/dist/safe-bash/command-chunks/{chunk-ETXPMVR6.js → chunk-TY7JXEWI.js} +11 -11
  222. package/dist/safe-bash/command-chunks/{chunk-X6OHFKBL.js → chunk-U42WHQRH.js} +8 -8
  223. package/dist/safe-bash/command-chunks/{chunk-Z2WNYEPD.js → chunk-UFLMOU3B.js} +4 -4
  224. package/dist/safe-bash/command-chunks/{chunk-2BLTUQNK.js → chunk-UJYXSLM6.js} +2 -2
  225. package/dist/safe-bash/command-chunks/{chunk-Q7TVCBU2.js → chunk-UKAGRRLZ.js} +1 -1
  226. package/dist/safe-bash/command-chunks/{chunk-4GQKCUS5.js → chunk-UPWLHHZ2.js} +13 -13
  227. package/dist/safe-bash/command-chunks/{chunk-5L4YGRQU.js → chunk-URQSUMMJ.js} +4 -4
  228. package/dist/safe-bash/command-chunks/{chunk-KPHLESD4.js → chunk-UT5X6QRU.js} +5 -5
  229. package/dist/safe-bash/command-chunks/{chunk-T5S4SJGO.js → chunk-V6JPIZUW.js} +7 -7
  230. package/dist/safe-bash/command-chunks/{chunk-MKK6FM5H.js → chunk-VMZIAFVJ.js} +11 -11
  231. package/dist/safe-bash/command-chunks/{chunk-HK6MSB7Z.js → chunk-VNNNVT4C.js} +5 -5
  232. package/dist/safe-bash/command-chunks/{chunk-ROL5AEX6.js → chunk-VVV45NLY.js} +1 -1
  233. package/dist/safe-bash/command-chunks/chunk-VVWHFNHD.js +502 -0
  234. package/dist/safe-bash/command-chunks/{chunk-KCLJGRU7.js → chunk-VZTVR3JI.js} +12 -12
  235. package/dist/safe-bash/command-chunks/{chunk-PLR5IULU.js → chunk-WDVPHDBH.js} +5 -5
  236. package/dist/safe-bash/command-chunks/{chunk-MNK3DDH6.js → chunk-WH624PKJ.js} +2 -2
  237. package/dist/safe-bash/command-chunks/{chunk-TJLXSENN.js → chunk-WHZ6XK7Y.js} +1 -1
  238. package/dist/safe-bash/command-chunks/{chunk-DN6MSXY7.js → chunk-WIW3KDBS.js} +2 -2
  239. package/dist/safe-bash/command-chunks/{chunk-GXMPXMDP.js → chunk-WMBELKPP.js} +11 -11
  240. package/dist/safe-bash/command-chunks/{chunk-NHNZYWPW.js → chunk-WMV5224N.js} +3 -3
  241. package/dist/safe-bash/command-chunks/{chunk-RTNI47C5.js → chunk-WOL3LBXE.js} +4 -4
  242. package/dist/safe-bash/command-chunks/{chunk-7SOE7XIS.js → chunk-WVD5WZXD.js} +5 -5
  243. package/dist/safe-bash/command-chunks/{chunk-XMTR7QGL.js → chunk-X42MJT2J.js} +4 -4
  244. package/dist/safe-bash/command-chunks/{chunk-XUJAQA3S.js → chunk-XBWD6SI3.js} +33 -33
  245. package/dist/safe-bash/command-chunks/{chunk-ZQM37BGE.js → chunk-XFIDOCYH.js} +2 -2
  246. package/dist/safe-bash/command-chunks/{chunk-IBYMPAUW.js → chunk-XPQUUFQD.js} +2 -2
  247. package/dist/safe-bash/command-chunks/{chunk-NQINS4XY.js → chunk-XVEI4HZL.js} +1 -1
  248. package/dist/safe-bash/command-chunks/{chunk-KSBNZTAZ.js → chunk-YKODRSGT.js} +6 -6
  249. package/dist/safe-bash/command-chunks/{chunk-WZRFS5OY.js → chunk-YXR4JE4U.js} +4 -4
  250. package/dist/safe-bash/command-chunks/{chunk-DCMSPMMD.js → chunk-Z7UIOPHJ.js} +1 -1
  251. package/dist/safe-bash/command-chunks/{chunk-AY3KQ4EN.js → chunk-ZAYTFXUX.js} +7 -7
  252. package/dist/safe-bash/command-chunks/{chunk-DZH54L3F.js → chunk-ZM7HMBAJ.js} +10 -10
  253. package/dist/safe-bash/command-chunks/{chunk-NFGCBQN3.js → chunk-ZNCPIZCN.js} +2 -2
  254. package/dist/safe-bash/command-chunks/{chunk-HKGNBH7Z.js → chunk-ZRHKXN6W.js} +4 -4
  255. package/dist/safe-bash/command-chunks/{chunk-A45UG4KT.js → chunk-ZZERSKAR.js} +5 -5
  256. package/dist/safe-bash/command-chunks/{clipboard-BBDK33GP-QZ4ERNQX.js → clipboard-BBDK33GP-VB22F7GI.js} +2 -2
  257. package/dist/safe-bash/command-chunks/{command-engine-7V6PZR7G.js → command-engine-GHE6QUHU.js} +63 -23
  258. package/dist/safe-bash/command-chunks/{engine-UYJENSWK-VSCGKSQV.js → engine-RG6HQCCB-FXYZS264.js} +1 -1
  259. package/dist/safe-bash/command-chunks/{gnumeric-UJPXWBVR-7VOHQAPM.js → gnumeric-UJPXWBVR-YPXTNEDZ.js} +2 -2
  260. package/dist/safe-bash/command-chunks/model-store-I7YAWL5V.js +54 -0
  261. package/dist/safe-bash/command-chunks/{xlsx-RE54MFCS-DI3F765V.js → xlsx-RE54MFCS-IQ6OXXKK.js} +1 -1
  262. package/dist/safe-bash/commands/bc/index.browser.js +1 -1
  263. package/dist/safe-bash/full-core.browser.js +4 -4
  264. package/dist/safe-bash/plugins/index.browser.js +3 -3
  265. package/dist/safe-bash/registry-entry.browser.js +2 -2
  266. package/dist/safe-bash/search.browser.js +1 -1
  267. package/dist/safe-bash/shell/runtime.d.ts +1 -0
  268. package/dist/safe-bash/shell/runtime.js +12 -3
  269. package/dist/safe-bash/shell/sync-extra-evaluators.js +7 -4
  270. package/dist/safe-bash/shell-entry.browser.js +2 -2
  271. package/dist/safe-bash-command-awk/awk-runtime.js +3 -3
  272. package/dist/safe-bash-command-awk/awk.js +4 -4
  273. package/dist/safe-bash-command-awk/index.js +4 -4
  274. package/dist/safe-bash-command-cp/index.js +3 -3
  275. package/dist/safe-bash-command-csvkit/index.js +1 -1
  276. package/dist/safe-bash-command-diff/diff.js +2 -2
  277. package/dist/safe-bash-command-diff/index.js +3 -3
  278. package/dist/safe-bash-command-diff/sync.js +2 -2
  279. package/dist/safe-bash-command-factor/command.js +2 -2
  280. package/dist/safe-bash-command-factor/index.js +2 -2
  281. package/dist/safe-bash-command-ffmpeg/index.js +1 -1
  282. package/dist/safe-bash-command-ffprobe/index.js +2 -2
  283. package/dist/safe-bash-command-ffprobe/media.d.ts +12 -2
  284. package/dist/safe-bash-command-ffprobe/media.js +4 -2
  285. package/dist/safe-bash-command-getopt/command.js +2 -2
  286. package/dist/safe-bash-command-getopt/index.js +2 -2
  287. package/dist/safe-bash-command-html-to-markdown/index.js +51 -813
  288. package/dist/safe-bash-command-html-to-markdown/stored-destination.d.ts +8 -0
  289. package/dist/safe-bash-command-html-to-markdown/stored-destination.js +10 -0
  290. package/dist/safe-bash-command-html-to-markdown/stored-text.d.ts +4 -1
  291. package/dist/safe-bash-command-html-to-markdown/stored-text.js +1 -1
  292. package/dist/safe-bash-command-htmlq/index.js +1280 -419
  293. package/dist/safe-bash-command-iconv/command.js +2 -2
  294. package/dist/safe-bash-command-iconv/index.js +2 -2
  295. package/dist/safe-bash-command-llm/index.js +2 -2
  296. package/dist/safe-bash-command-llm/openai.js +2 -2
  297. package/dist/safe-bash-command-llm/providers/index.js +2 -2
  298. package/dist/safe-bash-command-llm/providers/openai.js +2 -2
  299. package/dist/safe-bash-command-node/commands/node/browser.js +4 -4
  300. package/dist/safe-bash-command-node/commands/node/default-runtime.js +4 -4
  301. package/dist/safe-bash-command-node/commands/node/safejs.js +4 -4
  302. package/dist/safe-bash-command-pandoc/command.js +10 -9
  303. package/dist/safe-bash-command-pandoc/index.js +60 -59
  304. package/dist/safe-bash-command-patch/index.js +8 -7
  305. package/dist/safe-bash-command-patch/patch-formats.d.ts +6 -5
  306. package/dist/safe-bash-command-patch/patch-formats.js +3 -2
  307. package/dist/safe-bash-command-patch/patch-gnu-paths.d.ts +7 -7
  308. package/dist/safe-bash-command-patch/patch-gnu-reject.d.ts +1 -1
  309. package/dist/safe-bash-command-patch/patch-gnu-reject.js +3 -2
  310. package/dist/safe-bash-command-patch/patch-publication.js +3 -2
  311. package/dist/safe-bash-command-patch/patch-text.d.ts +13 -0
  312. package/dist/safe-bash-command-patch/patch.js +7 -6
  313. package/dist/safe-bash-command-patch/stored-patch.d.ts +32 -6
  314. package/dist/safe-bash-command-patch/stored-target.d.ts +2 -1
  315. package/dist/safe-bash-command-patch/unified.d.ts +22 -8
  316. package/dist/safe-bash-command-patch/unified.js +2 -1
  317. package/dist/safe-bash-command-pdftk/index.js +45 -122
  318. package/dist/safe-bash-command-pdftoppm/index.js +131 -27
  319. package/dist/safe-bash-command-playwright-cli/index.js +12 -12
  320. package/dist/safe-bash-command-playwright-cli/playwright/abilities.js +1 -1
  321. package/dist/safe-bash-command-playwright-cli/playwright/capability-events.js +1 -1
  322. package/dist/safe-bash-command-playwright-cli/playwright/capability-result.js +1 -1
  323. package/dist/safe-bash-command-playwright-cli/playwright/controller.js +7 -7
  324. package/dist/safe-bash-command-playwright-cli/playwright/download-capabilities.js +1 -1
  325. package/dist/safe-bash-command-playwright-cli/playwright/drop-capability.js +1 -1
  326. package/dist/safe-bash-command-playwright-cli/playwright/index.js +12 -12
  327. package/dist/safe-bash-command-playwright-cli/playwright/modal-capabilities.js +1 -1
  328. package/dist/safe-bash-command-playwright-cli/playwright/native-evaluation.js +1 -1
  329. package/dist/safe-bash-command-playwright-cli/playwright/native-json-snapshot.js +1 -1
  330. package/dist/safe-bash-command-playwright-cli/playwright/native-snapshot.js +1 -1
  331. package/dist/safe-bash-command-playwright-cli/playwright/open-options.js +2 -2
  332. package/dist/safe-bash-command-playwright-cli/playwright/profile.js +3 -3
  333. package/dist/safe-bash-command-playwright-cli/playwright/recording-capabilities.js +1 -1
  334. package/dist/safe-bash-command-playwright-cli/playwright/route-capabilities.js +1 -1
  335. package/dist/safe-bash-command-playwright-cli/playwright/snapshot.js +3 -3
  336. package/dist/safe-bash-command-playwright-cli/playwright/standard-capabilities.js +1 -1
  337. package/dist/safe-bash-command-playwright-cli/playwright/storage-capabilities.js +1 -1
  338. package/dist/safe-bash-command-playwright-cli/playwright/tracing-capabilities.js +1 -1
  339. package/dist/safe-bash-command-playwright-cli/playwright/webmcp-capabilities.js +1 -1
  340. package/dist/safe-bash-command-pptx/engine.js +1 -1
  341. package/dist/safe-bash-command-python/executor.js +11 -11
  342. package/dist/safe-bash-command-python/index.js +11 -11
  343. package/dist/safe-bash-command-python/jspi.js +2 -2
  344. package/dist/safe-bash-command-rg/index.js +3 -3
  345. package/dist/safe-bash-command-rg/rg-command.js +3 -3
  346. package/dist/safe-bash-command-safejs/index.js +4 -4
  347. package/dist/safe-bash-command-safejs/io.js +3 -3
  348. package/dist/safe-bash-command-safejs/render.js +2 -2
  349. package/dist/safe-bash-command-safejs/runtime.js +4 -4
  350. package/dist/safe-bash-command-soffice/index.js +5 -4
  351. package/dist/safe-bash-command-sort/index.js +3 -3
  352. package/dist/safe-bash-command-ssconvert/index.js +13 -13
  353. package/dist/safe-bash-command-tar/create.js +3 -3
  354. package/dist/safe-bash-command-tar/extract.js +3 -3
  355. package/dist/safe-bash-command-tar/index.js +7 -7
  356. package/dist/safe-bash-command-tar/modes.js +5 -5
  357. package/dist/safe-bash-command-unzip/index.js +2 -2
  358. package/dist/safe-bash-command-unzip/unzip.js +2 -2
  359. package/dist/safe-bash-command-xmllint/index.js +1 -1
  360. package/dist/safe-bash-command-xz/index.js +5 -5
  361. package/dist/safe-bash-compression-engine/files.js +5 -5
  362. package/dist/safe-bash-compression-engine/index.js +3 -3
  363. package/dist/safe-bash-compression-engine/operand.js +6 -6
  364. package/dist/safe-bash-compression-engine/stream.js +3 -3
  365. package/dist/safe-bash-compression-engine/zstd-decode.js +2 -2
  366. package/dist/safe-bash-contracts/escaping.js +3 -3
  367. package/dist/safe-bash-contracts/filesystem-output.js +3 -3
  368. package/dist/safe-bash-contracts/index.js +10 -10
  369. package/dist/safe-bash-docx-engine/ancillary-resources.js +9 -9
  370. package/dist/safe-bash-docx-engine/batch-operations.js +66 -66
  371. package/dist/safe-bash-docx-engine/batch-result-schema.js +78 -78
  372. package/dist/safe-bash-docx-engine/batch.js +77 -77
  373. package/dist/safe-bash-docx-engine/bookmarks.js +17 -17
  374. package/dist/safe-bash-docx-engine/charts.js +10 -10
  375. package/dist/safe-bash-docx-engine/command-option-rules.js +5 -5
  376. package/dist/safe-bash-docx-engine/command-properties.js +3 -3
  377. package/dist/safe-bash-docx-engine/comments.js +25 -25
  378. package/dist/safe-bash-docx-engine/control-bindings.js +20 -20
  379. package/dist/safe-bash-docx-engine/control-repeat.js +20 -20
  380. package/dist/safe-bash-docx-engine/controls.js +18 -18
  381. package/dist/safe-bash-docx-engine/create.js +10 -10
  382. package/dist/safe-bash-docx-engine/diagrams.js +10 -10
  383. package/dist/safe-bash-docx-engine/diff.js +12 -12
  384. package/dist/safe-bash-docx-engine/document-properties.js +15 -15
  385. package/dist/safe-bash-docx-engine/equations.js +16 -16
  386. package/dist/safe-bash-docx-engine/extract.js +13 -13
  387. package/dist/safe-bash-docx-engine/fields.js +22 -22
  388. package/dist/safe-bash-docx-engine/font-inventory.js +17 -17
  389. package/dist/safe-bash-docx-engine/font-resources.js +5 -5
  390. package/dist/safe-bash-docx-engine/image-batch-operations.js +13 -13
  391. package/dist/safe-bash-docx-engine/image-insertion.js +20 -20
  392. package/dist/safe-bash-docx-engine/image-layout.js +18 -18
  393. package/dist/safe-bash-docx-engine/image-replacement.js +21 -21
  394. package/dist/safe-bash-docx-engine/images.js +18 -18
  395. package/dist/safe-bash-docx-engine/index.js +113 -113
  396. package/dist/safe-bash-docx-engine/inspection.js +19 -19
  397. package/dist/safe-bash-docx-engine/invocation.js +8 -8
  398. package/dist/safe-bash-docx-engine/io.js +8 -8
  399. package/dist/safe-bash-docx-engine/links.js +20 -20
  400. package/dist/safe-bash-docx-engine/lists.js +19 -19
  401. package/dist/safe-bash-docx-engine/locations.js +14 -14
  402. package/dist/safe-bash-docx-engine/notes.js +21 -21
  403. package/dist/safe-bash-docx-engine/objects.js +18 -18
  404. package/dist/safe-bash-docx-engine/operation-json-schema.js +3 -3
  405. package/dist/safe-bash-docx-engine/operation-schema.js +2 -2
  406. package/dist/safe-bash-docx-engine/pack.js +13 -13
  407. package/dist/safe-bash-docx-engine/package-view-batch-operations.js +21 -21
  408. package/dist/safe-bash-docx-engine/pandoc-adapter.js +28 -28
  409. package/dist/safe-bash-docx-engine/paragraph-edit.js +24 -24
  410. package/dist/safe-bash-docx-engine/part-provider.js +3 -3
  411. package/dist/safe-bash-docx-engine/property-values.js +3 -3
  412. package/dist/safe-bash-docx-engine/publication.js +8 -8
  413. package/dist/safe-bash-docx-engine/removal.js +20 -20
  414. package/dist/safe-bash-docx-engine/revision-decisions.js +21 -21
  415. package/dist/safe-bash-docx-engine/revision-edit.js +19 -19
  416. package/dist/safe-bash-docx-engine/revisions.js +17 -17
  417. package/dist/safe-bash-docx-engine/run-format.js +19 -19
  418. package/dist/safe-bash-docx-engine/sanitize.js +33 -33
  419. package/dist/safe-bash-docx-engine/sections.js +18 -18
  420. package/dist/safe-bash-docx-engine/settings.js +10 -10
  421. package/dist/safe-bash-docx-engine/shape-edit.js +20 -20
  422. package/dist/safe-bash-docx-engine/signatures.js +14 -14
  423. package/dist/safe-bash-docx-engine/stories.js +21 -21
  424. package/dist/safe-bash-docx-engine/structure-model-batch-operations.js +37 -37
  425. package/dist/safe-bash-docx-engine/style-model-batch-operations.js +26 -26
  426. package/dist/safe-bash-docx-engine/style-model-result-schema.js +43 -43
  427. package/dist/safe-bash-docx-engine/styles.js +17 -17
  428. package/dist/safe-bash-docx-engine/table-edit.js +26 -26
  429. package/dist/safe-bash-docx-engine/table-read.js +15 -15
  430. package/dist/safe-bash-docx-engine/template.js +21 -21
  431. package/dist/safe-bash-docx-engine/text-replace.js +19 -19
  432. package/dist/safe-bash-docx-engine/text-resource-read.js +15 -15
  433. package/dist/safe-bash-docx-engine/text.js +15 -15
  434. package/dist/safe-bash-docx-engine/validation.js +6 -6
  435. package/dist/safe-bash-docx-engine/xml-parts.js +21 -21
  436. package/dist/safe-bash-line-ending-engine/command.js +4 -4
  437. package/dist/safe-bash-line-ending-engine/index.js +7 -7
  438. package/dist/safe-bash-markdown-engine/commonmark-blocks.js +3 -3
  439. package/dist/safe-bash-markdown-engine/commonmark-inlines.js +3 -3
  440. package/dist/safe-bash-markdown-engine/gfm-syntax.js +2 -2
  441. package/dist/safe-bash-markdown-engine/index.js +4 -4
  442. package/dist/safe-bash-network-engine/aggregate.js +3 -3
  443. package/dist/safe-bash-network-engine/args.js +3 -3
  444. package/dist/safe-bash-network-engine/body.js +4 -4
  445. package/dist/safe-bash-network-engine/decode.js +3 -3
  446. package/dist/safe-bash-network-engine/fetch-transport.js +3 -3
  447. package/dist/safe-bash-network-engine/index.js +3 -3
  448. package/dist/safe-bash-network-engine/output.js +3 -3
  449. package/dist/safe-bash-network-engine/platform-portable.js +3 -3
  450. package/dist/safe-bash-network-engine/shared.js +2 -2
  451. package/dist/safe-bash-network-engine/transfer.js +9 -9
  452. package/dist/safe-bash-presentation-engine/accessibility.js +31 -30
  453. package/dist/safe-bash-presentation-engine/animation-editing.js +16 -15
  454. package/dist/safe-bash-presentation-engine/animations.js +16 -15
  455. package/dist/safe-bash-presentation-engine/backgrounds.js +17 -16
  456. package/dist/safe-bash-presentation-engine/bytes.js +4 -3
  457. package/dist/safe-bash-presentation-engine/chart-editing.js +34 -33
  458. package/dist/safe-bash-presentation-engine/chart-object-operations.js +25 -24
  459. package/dist/safe-bash-presentation-engine/charts.js +31 -30
  460. package/dist/safe-bash-presentation-engine/command-placeholder.js +60 -58
  461. package/dist/safe-bash-presentation-engine/comments.js +17 -16
  462. package/dist/safe-bash-presentation-engine/connector-operations.js +32 -31
  463. package/dist/safe-bash-presentation-engine/connectors.js +29 -28
  464. package/dist/safe-bash-presentation-engine/content-types.js +5 -4
  465. package/dist/safe-bash-presentation-engine/creation.js +7 -6
  466. package/dist/safe-bash-presentation-engine/diff.d.ts +1 -0
  467. package/dist/safe-bash-presentation-engine/diff.js +44 -33
  468. package/dist/safe-bash-presentation-engine/drawing-format.js +20 -19
  469. package/dist/safe-bash-presentation-engine/drawing-operations.js +31 -30
  470. package/dist/safe-bash-presentation-engine/drawing-schema.js +21 -20
  471. package/dist/safe-bash-presentation-engine/equations.js +17 -16
  472. package/dist/safe-bash-presentation-engine/errors.js +3 -2
  473. package/dist/safe-bash-presentation-engine/fields.js +17 -16
  474. package/dist/safe-bash-presentation-engine/font-metrics.js +4 -3
  475. package/dist/safe-bash-presentation-engine/image-extraction.js +20 -19
  476. package/dist/safe-bash-presentation-engine/image-formatting.js +32 -31
  477. package/dist/safe-bash-presentation-engine/image-insertion.js +18 -17
  478. package/dist/safe-bash-presentation-engine/image-replacement.js +21 -20
  479. package/dist/safe-bash-presentation-engine/image-value.js +5 -4
  480. package/dist/safe-bash-presentation-engine/images.js +19 -18
  481. package/dist/safe-bash-presentation-engine/index.js +135 -132
  482. package/dist/safe-bash-presentation-engine/layouts.js +16 -15
  483. package/dist/safe-bash-presentation-engine/length.js +4 -3
  484. package/dist/safe-bash-presentation-engine/links.js +16 -15
  485. package/dist/safe-bash-presentation-engine/masters.js +15 -14
  486. package/dist/safe-bash-presentation-engine/media-editing.js +24 -23
  487. package/dist/safe-bash-presentation-engine/media-extraction.js +17 -16
  488. package/dist/safe-bash-presentation-engine/media.js +16 -15
  489. package/dist/safe-bash-presentation-engine/memberships.js +15 -14
  490. package/dist/safe-bash-presentation-engine/notes.d.ts +1 -0
  491. package/dist/safe-bash-presentation-engine/notes.js +22 -15
  492. package/dist/safe-bash-presentation-engine/ole-enum.js +5 -4
  493. package/dist/safe-bash-presentation-engine/ole-insertion.js +20 -19
  494. package/dist/safe-bash-presentation-engine/opaque-objects.js +10 -9
  495. package/dist/safe-bash-presentation-engine/package-reader.js +6 -5
  496. package/dist/safe-bash-presentation-engine/package-tools.js +19 -18
  497. package/dist/safe-bash-presentation-engine/package-uri.js +4 -3
  498. package/dist/safe-bash-presentation-engine/package-writer.js +5 -4
  499. package/dist/safe-bash-presentation-engine/presentation-model.js +59 -57
  500. package/dist/safe-bash-presentation-engine/presentation-settings.js +14 -13
  501. package/dist/safe-bash-presentation-engine/properties.d.ts +2 -1
  502. package/dist/safe-bash-presentation-engine/properties.js +25 -15
  503. package/dist/safe-bash-presentation-engine/relationships.js +5 -4
  504. package/dist/safe-bash-presentation-engine/resource-limits.js +2 -1
  505. package/dist/safe-bash-presentation-engine/retained-diff.d.ts +56 -0
  506. package/dist/safe-bash-presentation-engine/retained-inspection.js +14 -13
  507. package/dist/safe-bash-presentation-engine/retained-notes.d.ts +27 -0
  508. package/dist/safe-bash-presentation-engine/retained-package.js +6 -5
  509. package/dist/safe-bash-presentation-engine/retained-properties.d.ts +26 -0
  510. package/dist/safe-bash-presentation-engine/retained-text.js +33 -517
  511. package/dist/safe-bash-presentation-engine/sanitize.js +20 -16
  512. package/dist/safe-bash-presentation-engine/selectors.js +11 -10
  513. package/dist/safe-bash-presentation-engine/shape-groups.js +31 -30
  514. package/dist/safe-bash-presentation-engine/shape-operations.js +30 -29
  515. package/dist/safe-bash-presentation-engine/shape-path-operations.js +32 -31
  516. package/dist/safe-bash-presentation-engine/shape-paths.js +16 -15
  517. package/dist/safe-bash-presentation-engine/shape-presets.js +4 -3
  518. package/dist/safe-bash-presentation-engine/shape-selection.js +31 -30
  519. package/dist/safe-bash-presentation-engine/shape-transforms.js +18 -17
  520. package/dist/safe-bash-presentation-engine/shapes.js +27 -26
  521. package/dist/safe-bash-presentation-engine/slide-copy.js +17 -16
  522. package/dist/safe-bash-presentation-engine/slide-import.js +18 -17
  523. package/dist/safe-bash-presentation-engine/slide-merge-split.js +20 -19
  524. package/dist/safe-bash-presentation-engine/slide-model.js +43 -42
  525. package/dist/safe-bash-presentation-engine/slide-removal.js +18 -17
  526. package/dist/safe-bash-presentation-engine/slide-transfer-budget.js +10 -9
  527. package/dist/safe-bash-presentation-engine/slides.js +19 -18
  528. package/dist/safe-bash-presentation-engine/table-operations.js +33 -32
  529. package/dist/safe-bash-presentation-engine/table-spans.js +32 -31
  530. package/dist/safe-bash-presentation-engine/tables.js +31 -30
  531. package/dist/safe-bash-presentation-engine/tags.js +16 -15
  532. package/dist/safe-bash-presentation-engine/template-bindings.js +33 -32
  533. package/dist/safe-bash-presentation-engine/template-repeat.js +40 -39
  534. package/dist/safe-bash-presentation-engine/text-fitting.js +27 -26
  535. package/dist/safe-bash-presentation-engine/text-frames.js +27 -26
  536. package/dist/safe-bash-presentation-engine/text-paragraphs.js +27 -26
  537. package/dist/safe-bash-presentation-engine/text-reading.js +12 -11
  538. package/dist/safe-bash-presentation-engine/text-replacement.js +17 -16
  539. package/dist/safe-bash-presentation-engine/text-runs.js +20 -19
  540. package/dist/safe-bash-presentation-engine/themes.js +16 -15
  541. package/dist/safe-bash-presentation-engine/transitions.js +16 -15
  542. package/dist/safe-bash-presentation-engine/validation.js +10 -9
  543. package/dist/safe-bash-presentation-engine/xml-parts.js +19 -18
  544. package/dist/safe-bash-presentation-engine/xml-view.js +4 -3
  545. package/dist/safe-bash-presentation-engine/xml.js +4 -3
  546. package/dist/safe-bash-query-engine/index.js +3 -3
  547. package/dist/safe-bash-query-engine/interpreter.js +2 -2
  548. package/dist/safe-bash-query-engine/query-core.js +3 -3
  549. package/dist/safe-bash-regex-engine/ere/matcher.js +3 -3
  550. package/dist/safe-bash-xml-engine/document.js +3 -3
  551. package/dist/safe-bash-xml-engine/evaluate.js +1 -1
  552. package/dist/safe-bash-xml-engine/index.js +4 -4
  553. package/dist/safe-bash-xml-engine/json.js +14 -10
  554. package/dist/safe-bash-xml-engine/query.js +2 -2
  555. package/dist/safe-bash-xml-engine/stored-document.d.ts +4 -0
  556. package/dist/safe-bash-xml-engine/stored-document.js +1 -1
  557. package/dist/safe-bash-xml-engine/stored-evaluate.js +3 -3
  558. package/dist/safe-bash-zip-engine/index.js +2 -2
  559. package/dist/safe-bash-zip-engine/zip/repair.js +2 -2
  560. package/dist/safe-bash-zip-engine/zip/sfx.js +2 -2
  561. package/dist/safe-bash-zip-engine/zip-format.js +2 -2
  562. package/dist/spreadsheet-format-xls/biff-properties-merge.js +88 -73
  563. package/dist/spreadsheet-format-xls/biff-properties.js +3 -3
  564. package/dist/spreadsheet-format-xls/biff-property-transcode.d.ts +6 -1
  565. package/dist/spreadsheet-format-xls/biff-property-transcode.js +15 -4
  566. package/dist/spreadsheet-format-xls/biff-property-values.d.ts +36 -0
  567. package/dist/spreadsheet-format-xls/biff-property-values.js +227 -0
  568. package/dist/xlsx-ast/comment-geometry.d.ts +12 -0
  569. package/dist/xlsx-ast/comment-geometry.js +71 -0
  570. package/dist/xlsx-ast/xlsx-metadata.d.ts +1 -1
  571. package/dist/xlsx-ast/xlsx-metadata.js +27 -2
  572. package/dist/xlsx-ast/xlsx-write-metadata.js +9 -1
  573. package/dist/xlsx-ast/xlsx.js +9 -4
  574. package/package.json +6 -3
  575. package/dist/safe-bash/command-chunks/biff-KRHJ63K3-VQPJCVIL.js +0 -5309
  576. package/dist/safe-bash/command-chunks/chunk-DBNJEXHK.js +0 -387
  577. package/dist/safe-bash/command-chunks/chunk-EV5G535P.js +0 -240
  578. package/dist/safe-bash/command-chunks/model-store-UB5DWMAP.js +0 -54
  579. package/dist/safe-bash/command-chunks/{chunk-NGSO645G.js → chunk-3ZVK2OAY.js} +6 -6
  580. package/dist/safe-bash/command-chunks/{chunk-W2FKFEVY.js → chunk-4YSBUQPV.js} +3 -3
  581. package/dist/safe-bash/command-chunks/{chunk-UJSLBBQ7.js → chunk-5MFRN3CB.js} +4 -4
  582. package/dist/safe-bash/command-chunks/{chunk-AW4Q3GZW.js → chunk-5QXRIZSS.js} +3 -3
  583. package/dist/safe-bash/command-chunks/{chunk-KUGV3SSL.js → chunk-CZXYWGVO.js} +3 -3
  584. package/dist/safe-bash/command-chunks/{chunk-JWORWL72.js → chunk-DX7KU6YU.js} +3 -3
  585. package/dist/safe-bash/command-chunks/{chunk-Z37OM247.js → chunk-E3BL7W5C.js} +3 -3
  586. package/dist/safe-bash/command-chunks/{chunk-RIKNMBLZ.js → chunk-FEKECRJP.js} +3 -3
  587. package/dist/safe-bash/command-chunks/{chunk-D3HW7R2N.js → chunk-FTZFCMVI.js} +9 -9
  588. package/dist/safe-bash/command-chunks/{chunk-KRRG4MGH.js → chunk-GEDO5V32.js} +3 -3
  589. package/dist/safe-bash/command-chunks/{chunk-NBRXQUK7.js → chunk-M3OXQXCU.js} +3 -3
  590. package/dist/safe-bash/command-chunks/{chunk-JRSZ5IGD.js → chunk-OAM2SUUI.js} +6 -6
  591. package/dist/safe-bash/command-chunks/{chunk-HFKS6AET.js → chunk-OCOJMKDP.js} +4 -4
  592. package/dist/safe-bash/command-chunks/{chunk-FMJKCVSQ.js → chunk-OOB7YCFQ.js} +3 -3
  593. package/dist/safe-bash/command-chunks/{chunk-GGH376XQ.js → chunk-OU4VE5CR.js} +6 -6
  594. package/dist/safe-bash/command-chunks/{chunk-DYERIXPU.js → chunk-QGTQJCKW.js} +3 -3
  595. package/dist/safe-bash/command-chunks/{chunk-ZSQCROFE.js → chunk-RXXNLH7A.js} +3 -3
  596. package/dist/safe-bash/command-chunks/{chunk-TI52LKLL.js → chunk-UVM6QG2H.js} +3 -3
  597. package/dist/safe-bash/command-chunks/{chunk-BJXADHRT.js → chunk-WKU65Z3Q.js} +6 -6
  598. package/dist/safe-bash/command-chunks/{chunk-KGKF5NM2.js → chunk-WOXLPDO6.js} +3 -3
  599. package/dist/safe-bash/command-chunks/{chunk-Y5ADXWBQ.js → chunk-WXW665TV.js} +4 -4
  600. package/dist/safe-bash/command-chunks/{chunk-FWCUEZ3K.js → chunk-WYBCSJFG.js} +3 -3
  601. package/dist/safe-bash/command-chunks/{chunk-BXU5Y7I5.js → chunk-XI2LETBJ.js} +3 -3
  602. package/dist/safe-bash/command-chunks/{chunk-LNLACEAN.js → chunk-Y3ZRIZL7.js} +3 -3
@@ -1,128 +1,3 @@
1
- // packages/mp4-ast/src/types.ts
2
- function cloudflareWorkerLimits(overrides = {}) {
3
- return {
4
- maxInputBytes: 64 * 1024 * 1024,
5
- maxOutputBytes: 64 * 1024 * 1024,
6
- maxMemoryBytes: 96 * 1024 * 1024,
7
- maxFrames: 900,
8
- maxPixelsPerFrame: 1920 * 1080,
9
- maxDurationSeconds: 3600,
10
- maxStreams: 32,
11
- maxSamplesPerTrack: 2e5,
12
- maxConcatInputs: 128,
13
- maxBoxDepth: 32,
14
- maxCpuMs: 25e3,
15
- ...overrides
16
- };
17
- }
18
- var MediaLimitExceededError = class extends Error {
19
- limitName;
20
- limitValue;
21
- actualValue;
22
- constructor(limitName, limitValue, actualValue, message) {
23
- super(
24
- message ?? `Resource limit exceeded for ${limitName}: ${actualValue} exceeds maximum allowed ${limitValue}`
25
- );
26
- this.name = "MediaLimitExceededError";
27
- this.limitName = limitName;
28
- this.limitValue = limitValue;
29
- this.actualValue = actualValue;
30
- }
31
- };
32
- var MediaBudgetTracker = class {
33
- limits;
34
- startTimeMs;
35
- allocatedBytes = 0;
36
- peakAllocatedBytes = 0;
37
- decodedFrames = 0;
38
- constructor(limits = {}) {
39
- this.limits = limits;
40
- this.startTimeMs = Date.now();
41
- }
42
- checkCpu() {
43
- if (this.limits.maxCpuMs !== void 0) {
44
- const elapsed = Date.now() - this.startTimeMs;
45
- if (elapsed > this.limits.maxCpuMs) {
46
- throw new MediaLimitExceededError("maxCpuMs", this.limits.maxCpuMs, elapsed);
47
- }
48
- }
49
- }
50
- checkInputBytes(bytes) {
51
- if (this.limits.maxInputBytes !== void 0 && bytes > this.limits.maxInputBytes) {
52
- throw new MediaLimitExceededError("maxInputBytes", this.limits.maxInputBytes, bytes);
53
- }
54
- }
55
- checkOutputBytes(bytes) {
56
- if (this.limits.maxOutputBytes !== void 0 && bytes > this.limits.maxOutputBytes) {
57
- throw new MediaLimitExceededError("maxOutputBytes", this.limits.maxOutputBytes, bytes);
58
- }
59
- }
60
- allocateMemory(bytes) {
61
- this.allocatedBytes += bytes;
62
- if (this.allocatedBytes > this.peakAllocatedBytes) {
63
- this.peakAllocatedBytes = this.allocatedBytes;
64
- }
65
- if (this.limits.maxMemoryBytes !== void 0 && this.allocatedBytes > this.limits.maxMemoryBytes) {
66
- throw new MediaLimitExceededError(
67
- "maxMemoryBytes",
68
- this.limits.maxMemoryBytes,
69
- this.allocatedBytes
70
- );
71
- }
72
- }
73
- releaseMemory(bytes) {
74
- this.allocatedBytes = Math.max(0, this.allocatedBytes - bytes);
75
- }
76
- recordFrame(width, height) {
77
- const pixels = width * height;
78
- if (this.limits.maxPixelsPerFrame !== void 0 && pixels > this.limits.maxPixelsPerFrame) {
79
- throw new MediaLimitExceededError("maxPixelsPerFrame", this.limits.maxPixelsPerFrame, pixels);
80
- }
81
- this.decodedFrames += 1;
82
- if (this.limits.maxFrames !== void 0 && this.decodedFrames > this.limits.maxFrames) {
83
- throw new MediaLimitExceededError("maxFrames", this.limits.maxFrames, this.decodedFrames);
84
- }
85
- this.checkCpu();
86
- }
87
- checkStreams(count) {
88
- if (this.limits.maxStreams !== void 0 && count > this.limits.maxStreams) {
89
- throw new MediaLimitExceededError("maxStreams", this.limits.maxStreams, count);
90
- }
91
- }
92
- checkSamples(count) {
93
- if (this.limits.maxSamplesPerTrack !== void 0 && count > this.limits.maxSamplesPerTrack) {
94
- throw new MediaLimitExceededError("maxSamplesPerTrack", this.limits.maxSamplesPerTrack, count);
95
- }
96
- }
97
- checkDuration(seconds) {
98
- if (this.limits.maxDurationSeconds !== void 0 && seconds > this.limits.maxDurationSeconds) {
99
- throw new MediaLimitExceededError(
100
- "maxDurationSeconds",
101
- this.limits.maxDurationSeconds,
102
- seconds
103
- );
104
- }
105
- }
106
- checkConcatInputs(count) {
107
- if (this.limits.maxConcatInputs !== void 0 && count > this.limits.maxConcatInputs) {
108
- throw new MediaLimitExceededError("maxConcatInputs", this.limits.maxConcatInputs, count);
109
- }
110
- }
111
- checkBoxDepth(depth) {
112
- if (this.limits.maxBoxDepth !== void 0 && depth > this.limits.maxBoxDepth) {
113
- throw new MediaLimitExceededError("maxBoxDepth", this.limits.maxBoxDepth, depth);
114
- }
115
- }
116
- getStats() {
117
- return {
118
- currentMemoryBytes: this.allocatedBytes,
119
- peakMemoryBytes: this.peakAllocatedBytes,
120
- decodedFrames: this.decodedFrames,
121
- elapsedMs: Date.now() - this.startTimeMs
122
- };
123
- }
124
- };
125
-
126
1
  // packages/mp4-ast/src/binary.ts
127
2
  var TEXT_DECODER = new TextDecoder("utf-8", { fatal: false });
128
3
  var TEXT_ENCODER = new TextEncoder();
@@ -736,6 +611,131 @@ function yuv420pToRgba(yPlane, uPlane, vPlane, width, height) {
736
611
  return rgba;
737
612
  }
738
613
 
614
+ // packages/mp4-ast/src/types.ts
615
+ function cloudflareWorkerLimits(overrides = {}) {
616
+ return {
617
+ maxInputBytes: 64 * 1024 * 1024,
618
+ maxOutputBytes: 64 * 1024 * 1024,
619
+ maxMemoryBytes: 96 * 1024 * 1024,
620
+ maxFrames: 900,
621
+ maxPixelsPerFrame: 1920 * 1080,
622
+ maxDurationSeconds: 3600,
623
+ maxStreams: 32,
624
+ maxSamplesPerTrack: 2e5,
625
+ maxConcatInputs: 128,
626
+ maxBoxDepth: 32,
627
+ maxCpuMs: 25e3,
628
+ ...overrides
629
+ };
630
+ }
631
+ var MediaLimitExceededError = class extends Error {
632
+ limitName;
633
+ limitValue;
634
+ actualValue;
635
+ constructor(limitName, limitValue, actualValue, message) {
636
+ super(
637
+ message ?? `Resource limit exceeded for ${limitName}: ${actualValue} exceeds maximum allowed ${limitValue}`
638
+ );
639
+ this.name = "MediaLimitExceededError";
640
+ this.limitName = limitName;
641
+ this.limitValue = limitValue;
642
+ this.actualValue = actualValue;
643
+ }
644
+ };
645
+ var MediaBudgetTracker = class {
646
+ limits;
647
+ startTimeMs;
648
+ allocatedBytes = 0;
649
+ peakAllocatedBytes = 0;
650
+ decodedFrames = 0;
651
+ constructor(limits = {}) {
652
+ this.limits = limits;
653
+ this.startTimeMs = Date.now();
654
+ }
655
+ checkCpu() {
656
+ if (this.limits.maxCpuMs !== void 0) {
657
+ const elapsed = Date.now() - this.startTimeMs;
658
+ if (elapsed > this.limits.maxCpuMs) {
659
+ throw new MediaLimitExceededError("maxCpuMs", this.limits.maxCpuMs, elapsed);
660
+ }
661
+ }
662
+ }
663
+ checkInputBytes(bytes) {
664
+ if (this.limits.maxInputBytes !== void 0 && bytes > this.limits.maxInputBytes) {
665
+ throw new MediaLimitExceededError("maxInputBytes", this.limits.maxInputBytes, bytes);
666
+ }
667
+ }
668
+ checkOutputBytes(bytes) {
669
+ if (this.limits.maxOutputBytes !== void 0 && bytes > this.limits.maxOutputBytes) {
670
+ throw new MediaLimitExceededError("maxOutputBytes", this.limits.maxOutputBytes, bytes);
671
+ }
672
+ }
673
+ allocateMemory(bytes) {
674
+ this.allocatedBytes += bytes;
675
+ if (this.allocatedBytes > this.peakAllocatedBytes) {
676
+ this.peakAllocatedBytes = this.allocatedBytes;
677
+ }
678
+ if (this.limits.maxMemoryBytes !== void 0 && this.allocatedBytes > this.limits.maxMemoryBytes) {
679
+ throw new MediaLimitExceededError(
680
+ "maxMemoryBytes",
681
+ this.limits.maxMemoryBytes,
682
+ this.allocatedBytes
683
+ );
684
+ }
685
+ }
686
+ releaseMemory(bytes) {
687
+ this.allocatedBytes = Math.max(0, this.allocatedBytes - bytes);
688
+ }
689
+ recordFrame(width, height) {
690
+ const pixels = width * height;
691
+ if (this.limits.maxPixelsPerFrame !== void 0 && pixels > this.limits.maxPixelsPerFrame) {
692
+ throw new MediaLimitExceededError("maxPixelsPerFrame", this.limits.maxPixelsPerFrame, pixels);
693
+ }
694
+ this.decodedFrames += 1;
695
+ if (this.limits.maxFrames !== void 0 && this.decodedFrames > this.limits.maxFrames) {
696
+ throw new MediaLimitExceededError("maxFrames", this.limits.maxFrames, this.decodedFrames);
697
+ }
698
+ this.checkCpu();
699
+ }
700
+ checkStreams(count) {
701
+ if (this.limits.maxStreams !== void 0 && count > this.limits.maxStreams) {
702
+ throw new MediaLimitExceededError("maxStreams", this.limits.maxStreams, count);
703
+ }
704
+ }
705
+ checkSamples(count) {
706
+ if (this.limits.maxSamplesPerTrack !== void 0 && count > this.limits.maxSamplesPerTrack) {
707
+ throw new MediaLimitExceededError("maxSamplesPerTrack", this.limits.maxSamplesPerTrack, count);
708
+ }
709
+ }
710
+ checkDuration(seconds) {
711
+ if (this.limits.maxDurationSeconds !== void 0 && seconds > this.limits.maxDurationSeconds) {
712
+ throw new MediaLimitExceededError(
713
+ "maxDurationSeconds",
714
+ this.limits.maxDurationSeconds,
715
+ seconds
716
+ );
717
+ }
718
+ }
719
+ checkConcatInputs(count) {
720
+ if (this.limits.maxConcatInputs !== void 0 && count > this.limits.maxConcatInputs) {
721
+ throw new MediaLimitExceededError("maxConcatInputs", this.limits.maxConcatInputs, count);
722
+ }
723
+ }
724
+ checkBoxDepth(depth) {
725
+ if (this.limits.maxBoxDepth !== void 0 && depth > this.limits.maxBoxDepth) {
726
+ throw new MediaLimitExceededError("maxBoxDepth", this.limits.maxBoxDepth, depth);
727
+ }
728
+ }
729
+ getStats() {
730
+ return {
731
+ currentMemoryBytes: this.allocatedBytes,
732
+ peakMemoryBytes: this.peakAllocatedBytes,
733
+ decodedFrames: this.decodedFrames,
734
+ elapsedMs: Date.now() - this.startTimeMs
735
+ };
736
+ }
737
+ };
738
+
739
739
  // packages/media-codecs/vendor/runtime.js
740
740
  function Module(moduleArg = {}) {
741
741
  var moduleRtn;
@@ -332290,46 +332290,46 @@ function parseVpcC(payload) {
332290
332290
  rawBytes: payload
332291
332291
  };
332292
332292
  }
332293
- function parseEsds(payload) {
332294
- const reader = new BinaryReader(payload);
332295
- if (reader.remaining >= 4) reader.skip(4);
332296
- let objectTypeIndication = 64;
332297
- let maxBitrate = 128e3;
332298
- let avgBitrate = 128e3;
332293
+ function* esdsSteps(table, retainDecoderBytes = false) {
332294
+ let offset = table.payloadSize >= 4 ? 4 : 0;
332295
+ const skip = (length) => {
332296
+ offset = Math.min(table.payloadSize, offset + length);
332297
+ };
332298
+ function* read(length) {
332299
+ const size = Math.min(length, table.payloadSize - offset);
332300
+ const bytes = size ? yield { kind: "read", table, offset: table.payloadOffset + offset, length: size } : new Uint8Array();
332301
+ offset += size;
332302
+ return new BinaryReader(bytes);
332303
+ }
332304
+ let objectTypeIndication = 64, maxBitrate = 128e3, avgBitrate = 128e3;
332299
332305
  let decoderSpecificInfo = new Uint8Array([18, 16]);
332300
- function readDescrLength() {
332301
- let len = 0;
332302
- for (let i = 0; i < 4 && !reader.eof; i++) {
332303
- const b = reader.readU8();
332304
- len = len << 7 | b & 127;
332305
- if ((b & 128) === 0) break;
332306
+ while (offset < table.payloadSize) {
332307
+ const tag = (yield* read(1)).readU8();
332308
+ let length = 0;
332309
+ for (let i = 0; i < 4 && offset < table.payloadSize; i++) {
332310
+ const byte = (yield* read(1)).readU8();
332311
+ length = length << 7 | byte & 127;
332312
+ if (!(byte & 128)) break;
332306
332313
  }
332307
- return len;
332308
- }
332309
- while (!reader.eof) {
332310
- const tag = reader.readU8();
332311
- const len = readDescrLength();
332312
332314
  if (tag === 3) {
332313
- reader.skip(2);
332314
- const flags = reader.readU8();
332315
- if (flags & 128) reader.skip(2);
332315
+ skip(2);
332316
+ const flags = (yield* read(1)).readU8();
332317
+ if (flags & 128) skip(2);
332316
332318
  if (flags & 64) {
332317
- const urlLen = reader.readU8();
332318
- reader.skip(urlLen);
332319
+ const size = (yield* read(1)).readU8();
332320
+ skip(size);
332319
332321
  }
332320
- if (flags & 32) reader.skip(2);
332322
+ if (flags & 32) skip(2);
332321
332323
  } else if (tag === 4) {
332322
- objectTypeIndication = reader.readU8();
332323
- reader.skip(1);
332324
- reader.skip(3);
332325
- maxBitrate = reader.readU32BE();
332326
- avgBitrate = reader.readU32BE();
332324
+ const config = yield* read(13);
332325
+ objectTypeIndication = config.readU8();
332326
+ config.skip(4);
332327
+ maxBitrate = config.readU32BE();
332328
+ avgBitrate = config.readU32BE();
332327
332329
  } else if (tag === 5) {
332328
- decoderSpecificInfo = reader.readSlice(len);
332330
+ decoderSpecificInfo = (yield* read(retainDecoderBytes ? length : Math.min(length, 6))).bytes;
332329
332331
  break;
332330
- } else {
332331
- reader.skip(len);
332332
- }
332332
+ } else skip(length);
332333
332333
  }
332334
332334
  const asc = parseAudioSpecificConfig(decoderSpecificInfo);
332335
332335
  return {
@@ -332339,10 +332339,19 @@ function parseEsds(payload) {
332339
332339
  channelCount: asc.channelCount,
332340
332340
  maxBitrate,
332341
332341
  avgBitrate,
332342
- decoderSpecificInfo,
332343
- rawEsdsBytes: payload
332342
+ decoderSpecificInfo
332344
332343
  };
332345
332344
  }
332345
+ function parseEsds(payload) {
332346
+ const steps = esdsSteps({ payloadOffset: 0, payloadSize: payload.length }, true);
332347
+ let next = steps.next();
332348
+ while (!next.done) {
332349
+ const step = next.value;
332350
+ if (step.kind !== "read") throw new Error("Unexpected ES descriptor step");
332351
+ next = steps.next(payload.subarray(step.offset, step.offset + step.length));
332352
+ }
332353
+ return { ...next.value, rawEsdsBytes: payload };
332354
+ }
332346
332355
  function parseAudioSpecificConfig(asc) {
332347
332356
  if (asc.byteLength < 2) {
332348
332357
  return { audioObjectType: 2, sampleRate: 44100, channelCount: 2 };
@@ -332830,6 +332839,237 @@ function* decodeH264Samples(samples, descriptions, width, height, timescale) {
332830
332839
  if (decoded !== samples.length) throw new Error("H.264 stream did not decode every picture");
332831
332840
  }
332832
332841
 
332842
+ // packages/mp4-ast/src/mp4-codec-metadata.ts
332843
+ function sampleEntryHeader(formatFourCC, body) {
332844
+ const metadata = {
332845
+ formatFourCC,
332846
+ codecName: formatFourCC.trim().toLowerCase(),
332847
+ codecTagString: formatFourCC,
332848
+ profile: void 0,
332849
+ level: void 0,
332850
+ width: void 0,
332851
+ height: void 0,
332852
+ pixFmt: void 0,
332853
+ sarWidth: 1,
332854
+ sarHeight: 1,
332855
+ sampleRate: void 0,
332856
+ channels: void 0,
332857
+ bitsPerSample: void 0
332858
+ };
332859
+ const state = { metadata }, reader = new BinaryReader(body);
332860
+ if (["avc1", "avc3", "hvc1", "hev1", "av01", "vp08", "vp09", "mp4v", "jpeg", "mjpa", "png ", "s263"].includes(formatFourCC)) {
332861
+ state.kind = "video";
332862
+ if (body.length >= 78) {
332863
+ reader.skip(24);
332864
+ metadata.width = reader.readU16BE();
332865
+ metadata.height = reader.readU16BE();
332866
+ state.childOffset = 78;
332867
+ }
332868
+ } else if (["mp4a", "Opus", "fLaC", "alac", "ac-3", "ec-3", "sowt", "twos", "lpcm", ".mp3", "ulaw", "alaw"].includes(formatFourCC)) {
332869
+ state.kind = "audio";
332870
+ if (body.length >= 28) {
332871
+ reader.skip(8);
332872
+ const version = reader.readU16BE();
332873
+ reader.skip(6);
332874
+ metadata.channels = reader.readU16BE();
332875
+ metadata.bitsPerSample = reader.readU16BE();
332876
+ reader.skip(4);
332877
+ metadata.sampleRate = Math.round(reader.readU32BE() / 65536);
332878
+ state.childOffset = 28 + (version === 1 ? 16 : version === 2 ? 36 : 0);
332879
+ }
332880
+ }
332881
+ return state;
332882
+ }
332883
+ function applyCodecMetadata(state, child) {
332884
+ const metadata = state.metadata;
332885
+ if (state.kind === "video") {
332886
+ if (child.type === "avcC") {
332887
+ metadata.codecName = "h264";
332888
+ metadata.level = child.levelIdc;
332889
+ if (child.sps) {
332890
+ const sps = parseH264Sps(child.sps);
332891
+ metadata.profile = sps.profileName;
332892
+ metadata.width = sps.width || metadata.width;
332893
+ metadata.height = sps.height || metadata.height;
332894
+ metadata.pixFmt = sps.pixFmt;
332895
+ metadata.sarWidth = sps.sarWidth;
332896
+ metadata.sarHeight = sps.sarHeight;
332897
+ }
332898
+ } else if (child.type === "hvcC") {
332899
+ metadata.codecName = "hevc";
332900
+ metadata.level = child.generalLevelIdc;
332901
+ metadata.profile = child.generalProfileIdc === 2 ? "Main 10" : "Main";
332902
+ metadata.pixFmt = child.bitDepthLumaMinus8 > 0 ? "yuv420p10le" : "yuv420p";
332903
+ } else if (child.type === "av1C") {
332904
+ metadata.codecName = "av1";
332905
+ metadata.profile = child.seqProfile === 0 ? "Main" : child.seqProfile === 1 ? "High" : "Professional";
332906
+ metadata.level = child.seqLevelIdx0;
332907
+ metadata.pixFmt = child.highBitdepth ? "yuv420p10le" : "yuv420p";
332908
+ } else if (child.type === "vpcC") {
332909
+ metadata.codecName = metadata.formatFourCC === "vp08" ? "vp8" : "vp9";
332910
+ metadata.profile = `Profile ${child.profile}`;
332911
+ metadata.level = child.level;
332912
+ metadata.pixFmt = "yuv420p";
332913
+ } else if (child.type === "pasp") {
332914
+ metadata.sarWidth = child.sarWidth || 1;
332915
+ metadata.sarHeight = child.sarHeight || 1;
332916
+ }
332917
+ } else if (state.kind === "audio") {
332918
+ if (child.type === "esds" || child.type === "wave-esds") {
332919
+ if (child.config.sampleRate > 0) metadata.sampleRate = child.config.sampleRate;
332920
+ if (child.config.channelCount > 0) metadata.channels = child.config.channelCount;
332921
+ if (child.type === "esds") {
332922
+ if (child.config.objectTypeIndication === 107 || child.config.objectTypeIndication === 105) metadata.codecName = "mp3";
332923
+ else {
332924
+ metadata.codecName = "aac";
332925
+ metadata.profile = child.config.audioObjectType === 5 ? "HE-AAC" : "LC";
332926
+ }
332927
+ }
332928
+ } else if (child.type === "dOps") {
332929
+ metadata.codecName = "opus";
332930
+ metadata.sampleRate = child.inputSampleRate || 48e3;
332931
+ metadata.channels = child.outputChannelCount || metadata.channels;
332932
+ }
332933
+ }
332934
+ }
332935
+ function finishCodecMetadata(state) {
332936
+ const metadata = state.metadata, format = metadata.formatFourCC;
332937
+ if (state.kind === "video") {
332938
+ const aliases = { avc1: "h264", avc3: "h264", hvc1: "hevc", hev1: "hevc", av01: "av1", vp08: "vp8", vp09: "vp9", jpeg: "mjpeg", mjpa: "mjpeg", mp4v: "mpeg4", "png ": "png" };
332939
+ metadata.codecName = aliases[format] ?? metadata.codecName;
332940
+ metadata.pixFmt ??= "yuv420p";
332941
+ } else if (state.kind === "audio") {
332942
+ if (format === "mp4a" && metadata.codecName === "mp4a") {
332943
+ metadata.codecName = "aac";
332944
+ metadata.profile ??= "LC";
332945
+ } else {
332946
+ const aliases = { Opus: "opus", fLaC: "flac", alac: "alac", "ac-3": "ac3", "ec-3": "eac3", sowt: "pcm_s16le", twos: "pcm_s16be", lpcm: "pcm_s16le", ".mp3": "mp3" };
332947
+ metadata.codecName = aliases[format] ?? metadata.codecName;
332948
+ }
332949
+ } else if (format === "tx3g" || format === "text") metadata.codecName = "mov_text";
332950
+ else if (format === "wvtt") metadata.codecName = "webvtt";
332951
+ else if (format === "stpp") metadata.codecName = "ttml";
332952
+ return metadata;
332953
+ }
332954
+ function probeSampleFormat(type, codecName) {
332955
+ if (type !== "audio") return void 0;
332956
+ return {
332957
+ pcm_u8: "u8",
332958
+ pcm_s16le: "s16",
332959
+ pcm_s16be: "s16",
332960
+ pcm_s24le: "s32",
332961
+ pcm_s24be: "s32",
332962
+ pcm_s32le: "s32",
332963
+ pcm_s32be: "s32",
332964
+ pcm_f32le: "flt",
332965
+ pcm_f32be: "flt",
332966
+ pcm_f64le: "dbl",
332967
+ pcm_f64be: "dbl"
332968
+ }[codecName] ?? "fltp";
332969
+ }
332970
+
332971
+ // packages/mp4-ast/src/mp4-box-layout.ts
332972
+ var containers = /* @__PURE__ */ new Set([
332973
+ "moov",
332974
+ "trak",
332975
+ "edts",
332976
+ "mdia",
332977
+ "minf",
332978
+ "dinf",
332979
+ "stbl",
332980
+ "mvex",
332981
+ "moof",
332982
+ "traf",
332983
+ "mfra",
332984
+ "udta",
332985
+ "ilst",
332986
+ "sinf",
332987
+ "schi",
332988
+ "tref",
332989
+ "gmhd"
332990
+ ]);
332991
+ function mp4BoxLayout(prefix, remaining) {
332992
+ if (prefix.length < 8) return void 0;
332993
+ const view = new DataView(prefix.buffer, prefix.byteOffset, prefix.length);
332994
+ let size = view.getUint32(0), headerSize = 8;
332995
+ const type = decodeFourCC(prefix, 4);
332996
+ if (size === 1) {
332997
+ if (prefix.length < 16) return void 0;
332998
+ size = view.getUint32(8) * 4294967296 + view.getUint32(12);
332999
+ headerSize = 16;
333000
+ } else if (size === 0) size = remaining;
333001
+ if (size < headerSize || size > remaining) {
333002
+ size = remaining;
333003
+ if (size < headerSize) return void 0;
333004
+ }
333005
+ if (type === "uuid" && headerSize + 16 <= size) return { type, size, headerSize: headerSize + 16, uuidOffset: headerSize };
333006
+ return { type, size, headerSize };
333007
+ }
333008
+ function mp4BoxChildrenOffset(type, payloadSize, metaChildType) {
333009
+ if (containers.has(type)) return 0;
333010
+ if (type !== "meta" || payloadSize < 12) return void 0;
333011
+ return metaChildType === "hdlr" || metaChildType === "ilst" || metaChildType === "keys" || metaChildType === "free" ? 4 : 0;
333012
+ }
333013
+
333014
+ // packages/mp4-ast/src/mp4-source.ts
333015
+ async function* scanMp4Boxes(source, options = {}) {
333016
+ options.signal?.throwIfAborted();
333017
+ if (!Number.isSafeInteger(source.size) || source.size < 0) throw new RangeError("Invalid MP4 source size");
333018
+ let offset = options.offset ?? 0;
333019
+ const length = options.length ?? source.size - offset, depth = options.depth ?? 0;
333020
+ if (!Number.isSafeInteger(offset) || !Number.isSafeInteger(length) || offset < 0 || length < 0 || offset > source.size || length > source.size - offset)
333021
+ throw new RangeError("Invalid MP4 box range");
333022
+ if (!Number.isSafeInteger(depth) || depth < 0) throw new RangeError("Invalid MP4 box depth");
333023
+ options.budget?.checkBoxDepth(depth);
333024
+ const end = offset + length;
333025
+ const read = async (at, size) => {
333026
+ const bytes = new Uint8Array(size);
333027
+ for (let used = 0; used < size; ) {
333028
+ options.signal?.throwIfAborted();
333029
+ const chunk = await source.read(at + used, size - used);
333030
+ options.signal?.throwIfAborted();
333031
+ if (!chunk.length) throw new Error("Truncated MP4 source");
333032
+ if (chunk.length > size - used) throw new Error("MP4 source returned more bytes than requested");
333033
+ bytes.set(chunk, used);
333034
+ used += chunk.length;
333035
+ }
333036
+ await options.checkpoint?.();
333037
+ options.signal?.throwIfAborted();
333038
+ return bytes;
333039
+ };
333040
+ while (end - offset >= 8) {
333041
+ options.signal?.throwIfAborted();
333042
+ options.budget?.checkCpu();
333043
+ let prefix = await read(offset, 8);
333044
+ if (new DataView(prefix.buffer).getUint32(0) === 1) {
333045
+ if (end - offset < 16) break;
333046
+ const extended = new Uint8Array(16);
333047
+ extended.set(prefix);
333048
+ extended.set(await read(offset + 8, 8), 8);
333049
+ prefix = extended;
333050
+ }
333051
+ const layout = mp4BoxLayout(prefix, end - offset);
333052
+ if (!layout) break;
333053
+ const { type, size, headerSize, uuidOffset } = layout;
333054
+ const uuid = uuidOffset === void 0 ? void 0 : await read(offset + uuidOffset, 16);
333055
+ const payloadOffset = offset + headerSize, payloadSize = size - headerSize;
333056
+ const metaType = type === "meta" && payloadSize >= 12 ? decodeFourCC(await read(payloadOffset + 8, 4), 0) : void 0;
333057
+ const childOffset = mp4BoxChildrenOffset(type, payloadSize, metaType);
333058
+ yield {
333059
+ type,
333060
+ offset,
333061
+ size,
333062
+ headerSize,
333063
+ payloadOffset,
333064
+ payloadSize,
333065
+ ...uuid ? { uuid } : {},
333066
+ ...childOffset === void 0 ? {} : { children: { offset: payloadOffset + childOffset, length: payloadSize - childOffset, depth: depth + 1 } }
333067
+ };
333068
+ offset += size;
333069
+ }
333070
+ options.signal?.throwIfAborted();
333071
+ }
333072
+
332833
333073
  // packages/mp4-ast/src/mp4-sample-source.ts
332834
333074
  function* mp4SampleTableSteps(size, tables, options = {}) {
332835
333075
  function* read(table, offset, length) {
@@ -332906,48 +333146,154 @@ function* mp4SampleTableSteps(size, tables, options = {}) {
332906
333146
  }
332907
333147
  }
332908
333148
  }
333149
+ async function* scanMp4SampleTable(source, tables, options = {}) {
333150
+ options.signal?.throwIfAborted();
333151
+ if (!Number.isSafeInteger(source.size) || source.size < 0) throw new RangeError("Invalid MP4 source size");
333152
+ for (const name of ["stts", "ctts", "stsc", "stsz", "stco", "co64", "stss"]) {
333153
+ const table = tables[name];
333154
+ if (table && (!Number.isSafeInteger(table.payloadOffset) || !Number.isSafeInteger(table.payloadSize) || table.payloadOffset < 0 || table.payloadSize < 0 || table.payloadOffset > source.size || table.payloadSize > source.size - table.payloadOffset)) throw new RangeError("Invalid MP4 sample table range");
333155
+ }
333156
+ yield* consumeMp4SampleSteps(source, mp4SampleTableSteps(source.size, tables, options), options);
333157
+ }
333158
+ async function readMp4SampleRange(source, offset, length, options) {
333159
+ const bytes = new Uint8Array(length);
333160
+ for (let used = 0; used < length; ) {
333161
+ options.signal?.throwIfAborted();
333162
+ const chunk = await source.read(offset + used, length - used);
333163
+ options.signal?.throwIfAborted();
333164
+ if (!chunk.length) throw new Error("Truncated MP4 sample source");
333165
+ if (chunk.length > length - used) throw new Error("MP4 sample source returned more bytes than requested");
333166
+ bytes.set(chunk, used);
333167
+ used += chunk.length;
333168
+ }
333169
+ await options.checkpoint?.();
333170
+ options.signal?.throwIfAborted();
333171
+ return bytes;
333172
+ }
333173
+ async function* consumeMp4SampleSteps(source, steps, options) {
333174
+ const cache = /* @__PURE__ */ new Map();
333175
+ let answer, work = 0, retainedBytes = 0;
333176
+ try {
333177
+ for (; ; ) {
333178
+ options.signal?.throwIfAborted();
333179
+ if (++work % 256 === 0) {
333180
+ options.budget?.checkCpu();
333181
+ await options.checkpoint?.();
333182
+ options.signal?.throwIfAborted();
333183
+ }
333184
+ const next = steps.next(answer);
333185
+ if (next.done) return next.value;
333186
+ const step = next.value;
333187
+ answer = void 0;
333188
+ if (step.kind === "sample") {
333189
+ yield step.sample;
333190
+ continue;
333191
+ }
333192
+ if (step.kind === "sync-add" || step.kind === "sync-has") {
333193
+ if (!options.syncSamples) throw new Error("MP4 sync sample index is required");
333194
+ if (step.kind === "sync-add") await options.syncSamples.add(step.sample);
333195
+ else answer = await options.syncSamples.has(step.sample);
333196
+ options.signal?.throwIfAborted();
333197
+ continue;
333198
+ }
333199
+ if (!step.table) {
333200
+ answer = await readMp4SampleRange(source, step.offset, step.length, options);
333201
+ continue;
333202
+ }
333203
+ const bytes = new Uint8Array(step.length);
333204
+ let used = 0;
333205
+ while (used < bytes.length) {
333206
+ const relative = step.offset + used - step.table.payloadOffset, page2 = Math.floor(relative / 16384) * 16384;
333207
+ let cached = cache.get(step.table);
333208
+ if (!cached || cached.offset !== page2) {
333209
+ if (cached) {
333210
+ retainedBytes -= cached.bytes.length;
333211
+ options.budget?.releaseMemory(cached.bytes.length);
333212
+ cache.delete(step.table);
333213
+ cached = void 0;
333214
+ }
333215
+ const length = Math.min(16384, step.table.payloadSize - page2);
333216
+ retainedBytes += length;
333217
+ options.budget?.allocateMemory(length);
333218
+ cached = { offset: page2, bytes: await readMp4SampleRange(source, step.table.payloadOffset + page2, length, options) };
333219
+ cache.set(step.table, cached);
333220
+ }
333221
+ const from = relative - page2, take = Math.min(bytes.length - used, cached.bytes.length - from);
333222
+ bytes.set(cached.bytes.subarray(from, from + take), used);
333223
+ used += take;
333224
+ }
333225
+ answer = bytes;
333226
+ }
333227
+ } finally {
333228
+ cache.clear();
333229
+ options.budget?.releaseMemory(retainedBytes);
333230
+ steps.return(void 0);
333231
+ }
333232
+ }
332909
333233
 
332910
- // packages/mp4-ast/src/mp4-box-layout.ts
332911
- var containers = /* @__PURE__ */ new Set([
332912
- "moov",
332913
- "trak",
332914
- "edts",
332915
- "mdia",
332916
- "minf",
332917
- "dinf",
332918
- "stbl",
332919
- "mvex",
332920
- "moof",
332921
- "traf",
332922
- "mfra",
332923
- "udta",
332924
- "ilst",
332925
- "sinf",
332926
- "schi",
332927
- "tref",
332928
- "gmhd"
332929
- ]);
332930
- function mp4BoxLayout(prefix, remaining) {
332931
- if (prefix.length < 8) return void 0;
332932
- const view = new DataView(prefix.buffer, prefix.byteOffset, prefix.length);
332933
- let size = view.getUint32(0), headerSize = 8;
332934
- const type = decodeFourCC(prefix, 4);
332935
- if (size === 1) {
332936
- if (prefix.length < 16) return void 0;
332937
- size = view.getUint32(8) * 4294967296 + view.getUint32(12);
332938
- headerSize = 16;
332939
- } else if (size === 0) size = remaining;
332940
- if (size < headerSize || size > remaining) {
332941
- size = remaining;
332942
- if (size < headerSize) return void 0;
333234
+ // packages/mp4-ast/src/mp4-fragment-source.ts
333235
+ function mp4FragmentHeader(bytes, options) {
333236
+ if (bytes.length < 8) return;
333237
+ const reader = new BinaryReader(bytes);
333238
+ reader.readU8();
333239
+ const flags = reader.readU24BE(), trackId = reader.readU32BE();
333240
+ if (trackId !== options.trackId) return;
333241
+ return {
333242
+ baseDataOffset: flags & 1 ? reader.readU64BE() : options.moofOffset,
333243
+ defaultSampleDescriptionIndex: flags & 2 ? reader.readU32BE() : options.defaults.defaultSampleDescriptionIndex,
333244
+ defaultSampleDuration: flags & 8 ? reader.readU32BE() : options.defaults.defaultSampleDuration,
333245
+ defaultSampleSize: flags & 16 ? reader.readU32BE() : options.defaults.defaultSampleSize,
333246
+ defaultSampleFlags: flags & 32 ? reader.readU32BE() : options.defaults.defaultSampleFlags
333247
+ };
333248
+ }
333249
+ function mp4FragmentTime(bytes, fallback) {
333250
+ if (bytes.length < 8) return fallback;
333251
+ const reader = new BinaryReader(bytes), version = reader.readU8();
333252
+ reader.skip(3);
333253
+ return version === 1 ? reader.readU64BE() : reader.readU32BE();
333254
+ }
333255
+ function* mp4FragmentRunSteps(size, table, header, state, options) {
333256
+ if (table.payloadSize < 8) return state;
333257
+ function* read(offset, length) {
333258
+ if (offset >= table.payloadSize || !length) return new BinaryReader(new Uint8Array());
333259
+ return new BinaryReader(yield { kind: "read", table, offset: table.payloadOffset + offset, length: Math.min(length, table.payloadSize - offset) });
332943
333260
  }
332944
- if (type === "uuid" && headerSize + 16 <= size) return { type, size, headerSize: headerSize + 16, uuidOffset: headerSize };
332945
- return { type, size, headerSize };
333261
+ const reader = yield* read(0, 16), version = reader.readU8(), flags = reader.readU24BE(), count = reader.readU32BE();
333262
+ options.budget?.checkSamples(state.sampleCount + count);
333263
+ let cursor = header.baseDataOffset + (flags & 1 ? reader.readI32BE() : 0);
333264
+ const firstFlags = flags & 4 ? reader.readU32BE() : void 0, start = reader.offset;
333265
+ const width = [256, 512, 1024, 2048].reduce((n, bit) => n + (flags & bit ? 4 : 0), 0);
333266
+ let dts = state.dts;
333267
+ for (let i = 0; i < count; i++) {
333268
+ options.budget?.checkCpu();
333269
+ const row = yield* read(start + i * width, width);
333270
+ const duration = flags & 256 ? row.readU32BE() : header.defaultSampleDuration;
333271
+ const declaredSize = flags & 512 ? row.readU32BE() : header.defaultSampleSize;
333272
+ const sampleFlags = flags & 1024 ? row.readU32BE() : i === 0 && firstFlags !== void 0 ? firstFlags : header.defaultSampleFlags;
333273
+ const cts = flags & 2048 ? version === 1 ? row.readI32BE() : row.readU32BE() : 0;
333274
+ const offset = Math.max(0, Math.min(size, cursor));
333275
+ const isKeyframe = (sampleFlags >>> 24 & 3) === 2 || !(sampleFlags & 65536) && (i === 0 || options.type !== "video");
333276
+ yield { kind: "sample", sample: { offset, size: Math.max(0, Math.min(size - offset, declaredSize)), dts, pts: dts + cts, cts, duration, isKeyframe, sampleDescriptionIndex: header.defaultSampleDescriptionIndex } };
333277
+ dts += duration;
333278
+ cursor += declaredSize;
333279
+ }
333280
+ return { dts, sampleCount: state.sampleCount + count };
332946
333281
  }
332947
- function mp4BoxChildrenOffset(type, payloadSize, metaChildType) {
332948
- if (containers.has(type)) return 0;
332949
- if (type !== "meta" || payloadSize < 12) return void 0;
332950
- return metaChildType === "hdlr" || metaChildType === "ilst" || metaChildType === "keys" || metaChildType === "free" ? 4 : 0;
333282
+ async function* scanMp4Fragment(source, range, options) {
333283
+ let state = options.state ?? { dts: 0, sampleCount: 0 };
333284
+ let tfhd, tfdt;
333285
+ for await (const box of scanMp4Boxes(source, { ...range, ...options })) {
333286
+ if (box.type === "tfhd" && !tfhd) tfhd = box;
333287
+ if (box.type === "tfdt" && !tfdt) tfdt = box;
333288
+ }
333289
+ if (!tfhd) return state;
333290
+ const header = mp4FragmentHeader(await readMp4SampleRange(source, tfhd.payloadOffset, Math.min(32, tfhd.payloadSize), options), options);
333291
+ if (!header) return state;
333292
+ if (tfdt) state = { ...state, dts: mp4FragmentTime(await readMp4SampleRange(source, tfdt.payloadOffset, Math.min(12, tfdt.payloadSize), options), state.dts) };
333293
+ for await (const box of scanMp4Boxes(source, { ...range, ...options })) {
333294
+ if (box.type === "trun") state = yield* consumeMp4SampleSteps(source, mp4FragmentRunSteps(source.size, box, header, state, options), options);
333295
+ }
333296
+ return state;
332951
333297
  }
332952
333298
 
332953
333299
  // packages/mp4-ast/src/work.ts
@@ -333001,174 +333347,51 @@ function parseStsdBox(payload) {
333001
333347
  const reader = new BinaryReader(payload);
333002
333348
  if (reader.remaining < 8) return [];
333003
333349
  reader.skip(4);
333004
- const entryCount = reader.readU32BE();
333005
- const descriptions = [];
333350
+ const entryCount = reader.readU32BE(), descriptions = [];
333006
333351
  for (let i = 0; i < entryCount && reader.remaining >= 8; i++) {
333007
- const entryStart = reader.offset;
333008
- const entrySize = reader.readU32BE();
333009
- const formatFourCC = reader.readFourCC();
333010
- if (entrySize < 8 || entryStart + entrySize > payload.byteLength) break;
333011
- const rawEntryBytes = payload.subarray(entryStart, entryStart + entrySize);
333012
- const body = payload.subarray(entryStart + 8, entryStart + entrySize);
333013
- let codecName = formatFourCC.trim().toLowerCase();
333014
- let profile;
333015
- let level;
333016
- let width;
333017
- let height;
333018
- let pixFmt;
333019
- let sarWidth = 1;
333020
- let sarHeight = 1;
333021
- let sampleRate;
333022
- let channels;
333023
- let bitsPerSample;
333024
- let avcC;
333025
- let hvcC;
333026
- let av1C;
333027
- let vpcC;
333028
- let esds;
333029
- let dOps;
333030
- if (formatFourCC === "avc1" || formatFourCC === "avc3" || formatFourCC === "hvc1" || formatFourCC === "hev1" || formatFourCC === "av01" || formatFourCC === "vp08" || formatFourCC === "vp09" || formatFourCC === "mp4v" || formatFourCC === "jpeg" || formatFourCC === "mjpa" || formatFourCC === "png " || formatFourCC === "s263") {
333031
- if (body.byteLength >= 78) {
333032
- const vReader = new BinaryReader(body);
333033
- vReader.skip(6 + 2 + 16);
333034
- width = vReader.readU16BE();
333035
- height = vReader.readU16BE();
333036
- vReader.skip(4 + 4 + 4 + 2 + 32 + 2 + 2);
333037
- const childBoxes = parseMp4Boxes(body.subarray(78));
333038
- for (const child of childBoxes) {
333352
+ const start = reader.offset, size = reader.readU32BE(), format = reader.readFourCC();
333353
+ if (size < 8 || start + size > payload.length) break;
333354
+ const body = payload.subarray(start + 8, start + size), state = sampleEntryHeader(format, body);
333355
+ let avcC, hvcC, av1C, vpcC, esds, dOps;
333356
+ if (state.childOffset !== void 0 && state.childOffset < body.length) {
333357
+ for (const child of parseMp4Boxes(body.subarray(state.childOffset))) {
333358
+ if (state.kind === "video") {
333039
333359
  if (child.type === "avcC") {
333040
333360
  avcC = parseAvcC(child.payload);
333041
- codecName = "h264";
333042
- level = avcC.levelIdc;
333043
- if (avcC.sps[0]) {
333044
- const spsInfo = parseH264Sps(avcC.sps[0]);
333045
- profile = spsInfo.profileName;
333046
- width = spsInfo.width || width;
333047
- height = spsInfo.height || height;
333048
- pixFmt = spsInfo.pixFmt;
333049
- sarWidth = spsInfo.sarWidth;
333050
- sarHeight = spsInfo.sarHeight;
333051
- }
333361
+ applyCodecMetadata(state, { type: "avcC", levelIdc: avcC.levelIdc, sps: avcC.sps[0] });
333052
333362
  } else if (child.type === "hvcC") {
333053
333363
  hvcC = parseHvcC(child.payload);
333054
- codecName = "hevc";
333055
- level = hvcC.generalLevelIdc;
333056
- profile = hvcC.generalProfileIdc === 2 ? "Main 10" : "Main";
333057
- pixFmt = hvcC.bitDepthLumaMinus8 > 0 ? "yuv420p10le" : "yuv420p";
333364
+ applyCodecMetadata(state, { ...hvcC, type: "hvcC" });
333058
333365
  } else if (child.type === "av1C") {
333059
333366
  av1C = parseAv1C(child.payload);
333060
- codecName = "av1";
333061
- profile = av1C.seqProfile === 0 ? "Main" : av1C.seqProfile === 1 ? "High" : "Professional";
333062
- level = av1C.seqLevelIdx0;
333063
- pixFmt = av1C.highBitdepth ? "yuv420p10le" : "yuv420p";
333367
+ applyCodecMetadata(state, { ...av1C, type: "av1C" });
333064
333368
  } else if (child.type === "vpcC") {
333065
333369
  vpcC = parseVpcC(child.payload);
333066
- codecName = formatFourCC === "vp08" ? "vp8" : "vp9";
333067
- profile = `Profile ${vpcC.profile}`;
333068
- level = vpcC.level;
333069
- pixFmt = "yuv420p";
333070
- } else if (child.type === "esds") {
333370
+ applyCodecMetadata(state, { ...vpcC, type: "vpcC" });
333371
+ } else if (child.type === "esds") esds = parseEsds(child.payload);
333372
+ else if (child.type === "pasp" && child.payload.length >= 8) {
333373
+ const aspect = new BinaryReader(child.payload);
333374
+ applyCodecMetadata(state, { type: "pasp", sarWidth: aspect.readU32BE(), sarHeight: aspect.readU32BE() });
333375
+ }
333376
+ } else if (state.kind === "audio") {
333377
+ if (child.type === "esds") {
333071
333378
  esds = parseEsds(child.payload);
333072
- } else if (child.type === "pasp" && child.payload.byteLength >= 8) {
333073
- const pReader = new BinaryReader(child.payload);
333074
- sarWidth = pReader.readU32BE() || 1;
333075
- sarHeight = pReader.readU32BE() || 1;
333076
- }
333077
- }
333078
- }
333079
- if (formatFourCC === "avc1" || formatFourCC === "avc3") codecName = "h264";
333080
- else if (formatFourCC === "hvc1" || formatFourCC === "hev1") codecName = "hevc";
333081
- else if (formatFourCC === "av01") codecName = "av1";
333082
- else if (formatFourCC === "vp08") codecName = "vp8";
333083
- else if (formatFourCC === "vp09") codecName = "vp9";
333084
- else if (formatFourCC === "jpeg" || formatFourCC === "mjpa") codecName = "mjpeg";
333085
- else if (formatFourCC === "mp4v") codecName = "mpeg4";
333086
- else if (formatFourCC === "png ") codecName = "png";
333087
- pixFmt = pixFmt ?? "yuv420p";
333088
- } else if (formatFourCC === "mp4a" || formatFourCC === "Opus" || formatFourCC === "fLaC" || formatFourCC === "alac" || formatFourCC === "ac-3" || formatFourCC === "ec-3" || formatFourCC === "sowt" || formatFourCC === "twos" || formatFourCC === "lpcm" || formatFourCC === ".mp3" || formatFourCC === "ulaw" || formatFourCC === "alaw") {
333089
- if (body.byteLength >= 28) {
333090
- const aReader = new BinaryReader(body);
333091
- aReader.skip(6 + 2);
333092
- const qtVersion = aReader.readU16BE();
333093
- aReader.skip(6);
333094
- channels = aReader.readU16BE();
333095
- bitsPerSample = aReader.readU16BE();
333096
- aReader.skip(4);
333097
- sampleRate = Math.round(aReader.readU32BE() / 65536);
333098
- let childOffset = 28;
333099
- if (qtVersion === 1) childOffset += 16;
333100
- else if (qtVersion === 2) childOffset += 36;
333101
- if (childOffset < body.byteLength) {
333102
- const childBoxes = parseMp4Boxes(body.subarray(childOffset));
333103
- for (const child of childBoxes) {
333104
- if (child.type === "esds") {
333105
- esds = parseEsds(child.payload);
333106
- if (esds.sampleRate > 0) sampleRate = esds.sampleRate;
333107
- if (esds.channelCount > 0) channels = esds.channelCount;
333108
- if (esds.objectTypeIndication === 107 || esds.objectTypeIndication === 105) {
333109
- codecName = "mp3";
333110
- } else {
333111
- codecName = "aac";
333112
- profile = esds.audioObjectType === 5 ? "HE-AAC" : "LC";
333113
- }
333114
- } else if (child.type === "dOps") {
333115
- dOps = parseDOps(child.payload);
333116
- codecName = "opus";
333117
- sampleRate = dOps.inputSampleRate || 48e3;
333118
- channels = dOps.outputChannelCount || channels;
333119
- } else if (child.type === "wave" && child.children) {
333120
- const waveEsds = findBox(child.children, "esds");
333121
- if (waveEsds) {
333122
- esds = parseEsds(waveEsds.payload);
333123
- if (esds.sampleRate > 0) sampleRate = esds.sampleRate;
333124
- if (esds.channelCount > 0) channels = esds.channelCount;
333125
- }
333379
+ applyCodecMetadata(state, { type: "esds", config: esds });
333380
+ } else if (child.type === "dOps") {
333381
+ dOps = parseDOps(child.payload);
333382
+ applyCodecMetadata(state, { ...dOps, type: "dOps" });
333383
+ } else if (child.type === "wave" && child.children) {
333384
+ const nested = findBox(child.children, "esds");
333385
+ if (nested) {
333386
+ esds = parseEsds(nested.payload);
333387
+ applyCodecMetadata(state, { type: "wave-esds", config: esds });
333126
333388
  }
333127
333389
  }
333128
333390
  }
333129
333391
  }
333130
- if (formatFourCC === "mp4a" && codecName === "mp4a") {
333131
- codecName = "aac";
333132
- profile = profile ?? "LC";
333133
- } else if (formatFourCC === "Opus") codecName = "opus";
333134
- else if (formatFourCC === "fLaC") codecName = "flac";
333135
- else if (formatFourCC === "alac") codecName = "alac";
333136
- else if (formatFourCC === "ac-3") codecName = "ac3";
333137
- else if (formatFourCC === "ec-3") codecName = "eac3";
333138
- else if (formatFourCC === "sowt") codecName = "pcm_s16le";
333139
- else if (formatFourCC === "twos") codecName = "pcm_s16be";
333140
- else if (formatFourCC === "lpcm") codecName = "pcm_s16le";
333141
- else if (formatFourCC === ".mp3") codecName = "mp3";
333142
- } else if (formatFourCC === "tx3g" || formatFourCC === "text") {
333143
- codecName = "mov_text";
333144
- } else if (formatFourCC === "wvtt") {
333145
- codecName = "webvtt";
333146
- } else if (formatFourCC === "stpp") {
333147
- codecName = "ttml";
333148
333392
  }
333149
- descriptions.push({
333150
- formatFourCC,
333151
- codecName,
333152
- codecTagString: formatFourCC,
333153
- profile,
333154
- level,
333155
- width,
333156
- height,
333157
- pixFmt,
333158
- sarWidth,
333159
- sarHeight,
333160
- sampleRate,
333161
- channels,
333162
- bitsPerSample,
333163
- avcC,
333164
- hvcC,
333165
- av1C,
333166
- vpcC,
333167
- esds,
333168
- dOps,
333169
- rawStsdEntryBytes: rawEntryBytes
333170
- });
333171
- reader.seek(entryStart + entrySize);
333393
+ descriptions.push({ ...finishCodecMetadata(state), avcC, hvcC, av1C, vpcC, esds, dOps, rawStsdEntryBytes: payload.subarray(start, start + size) });
333394
+ reader.seek(start + size);
333172
333395
  }
333173
333396
  return descriptions;
333174
333397
  }
@@ -333461,64 +333684,32 @@ function parseMp4(bytes, options = {}) {
333461
333684
  for (const traf of trafBoxes) {
333462
333685
  const tfhd = findBox(traf.children, "tfhd");
333463
333686
  if (!tfhd || tfhd.payload.byteLength < 8) continue;
333464
- const tfhdReader = new BinaryReader(tfhd.payload);
333465
- tfhdReader.readU8();
333466
- const tfhdFlags = tfhdReader.readU24BE();
333467
- const trafTrackId = tfhdReader.readU32BE();
333468
- if (trafTrackId !== trackId) continue;
333469
- let baseDataOffset = moof.offset;
333470
- let defaultSampleDescriptionIndex = trex.defaultSampleDescriptionIndex;
333471
- let defaultSampleDuration = trex.defaultSampleDuration;
333472
- let defaultSampleSize = trex.defaultSampleSize;
333473
- let defaultSampleFlags = trex.defaultSampleFlags;
333474
- if (tfhdFlags & 1) baseDataOffset = tfhdReader.readU64BE();
333475
- if (tfhdFlags & 2) defaultSampleDescriptionIndex = tfhdReader.readU32BE();
333476
- if (tfhdFlags & 8) defaultSampleDuration = tfhdReader.readU32BE();
333477
- if (tfhdFlags & 16) defaultSampleSize = tfhdReader.readU32BE();
333478
- if (tfhdFlags & 32) defaultSampleFlags = tfhdReader.readU32BE();
333687
+ const fragmentOptions = { trackId, moofOffset: moof.offset, defaults: trex, type, budget };
333688
+ const header = mp4FragmentHeader(tfhd.payload, fragmentOptions);
333689
+ if (!header) continue;
333479
333690
  const tfdt = findBox(traf.children, "tfdt");
333480
- if (tfdt && tfdt.payload.byteLength >= 8) {
333481
- const tfdtReader = new BinaryReader(tfdt.payload);
333482
- const tfdtVersion = tfdtReader.readU8();
333483
- tfdtReader.skip(3);
333484
- runningDts = tfdtVersion === 1 ? tfdtReader.readU64BE() : tfdtReader.readU32BE();
333485
- }
333486
- const trunBoxes = findBoxes(traf.children, "trun");
333487
- for (const trun of trunBoxes) {
333488
- if (trun.payload.byteLength < 8) continue;
333489
- const trunReader = new BinaryReader(trun.payload);
333490
- const trunVersion = trunReader.readU8();
333491
- const trunFlags = trunReader.readU24BE();
333492
- const trunSampleCount = trunReader.readU32BE();
333493
- budget.checkSamples(samples.length + trunSampleCount);
333494
- let dataOffset = baseDataOffset;
333495
- if (trunFlags & 1) {
333496
- dataOffset = baseDataOffset + trunReader.readI32BE();
333497
- }
333498
- const firstSampleFlags = trunFlags & 4 ? trunReader.readU32BE() : void 0;
333499
- let cursor = dataOffset;
333500
- for (let s = 0; s < trunSampleCount; s++) {
333501
- const duration = trunFlags & 256 ? trunReader.readU32BE() : defaultSampleDuration;
333502
- const size = trunFlags & 512 ? trunReader.readU32BE() : defaultSampleSize;
333503
- const flags = trunFlags & 1024 ? trunReader.readU32BE() : s === 0 && firstSampleFlags !== void 0 ? firstSampleFlags : defaultSampleFlags;
333504
- const cts = trunFlags & 2048 ? trunVersion === 1 ? trunReader.readI32BE() : trunReader.readU32BE() : 0;
333505
- const isNonSync = (flags & 65536) !== 0;
333506
- const sampleDependsOn = flags >>> 24 & 3;
333507
- const isKeyframe = sampleDependsOn === 2 || !isNonSync && (s === 0 || type !== "video");
333508
- const safeStart = Math.max(0, Math.min(bytes.byteLength, cursor));
333509
- const safeEnd = Math.max(safeStart, Math.min(bytes.byteLength, safeStart + size));
333510
- samples.push({
333511
- data: bytes.subarray(safeStart, safeEnd),
333512
- dts: runningDts,
333513
- pts: runningDts + cts,
333514
- cts,
333515
- duration,
333516
- size: safeEnd - safeStart,
333517
- isKeyframe,
333518
- sampleDescriptionIndex: defaultSampleDescriptionIndex
333519
- });
333520
- runningDts += duration;
333521
- cursor += size;
333691
+ if (tfdt) runningDts = mp4FragmentTime(tfdt.payload, runningDts);
333692
+ for (const trun of findBoxes(traf.children, "trun")) {
333693
+ const steps2 = mp4FragmentRunSteps(
333694
+ bytes.byteLength,
333695
+ { payloadOffset: trun.offset + trun.headerSize, payloadSize: trun.payload.byteLength },
333696
+ header,
333697
+ { dts: runningDts, sampleCount: samples.length },
333698
+ fragmentOptions
333699
+ );
333700
+ let answer2;
333701
+ for (; ; ) {
333702
+ const next = steps2.next(answer2);
333703
+ if (next.done) {
333704
+ runningDts = next.value.dts;
333705
+ break;
333706
+ }
333707
+ const step = next.value;
333708
+ if (step.kind === "read") answer2 = bytes.subarray(step.offset, step.offset + step.length);
333709
+ else if (step.kind === "sample") {
333710
+ const { offset, ...sample } = step.sample;
333711
+ samples.push({ ...sample, data: bytes.subarray(offset, offset + sample.size) });
333712
+ }
333522
333713
  }
333523
333714
  }
333524
333715
  }
@@ -334685,19 +334876,7 @@ function buildProbeResultFromDoc(doc, byteLength, filename = "input.mp4", option
334685
334876
  const codecLongName = CODEC_LONG_NAMES[codecName] ?? codecName;
334686
334877
  const rawTag = desc?.formatFourCC ?? (track.type === "video" ? "avc1" : "mp4a");
334687
334878
  const tagFourCC = Array.from(rawTag).map((c) => c.charCodeAt(0) < 32 ? `[${c.charCodeAt(0)}]` : c).join("");
334688
- const sampleFormat = track.type !== "audio" ? void 0 : {
334689
- pcm_u8: "u8",
334690
- pcm_s16le: "s16",
334691
- pcm_s16be: "s16",
334692
- pcm_s24le: "s32",
334693
- pcm_s24be: "s32",
334694
- pcm_s32le: "s32",
334695
- pcm_s32be: "s32",
334696
- pcm_f32le: "flt",
334697
- pcm_f32be: "flt",
334698
- pcm_f64le: "dbl",
334699
- pcm_f64be: "dbl"
334700
- }[codecName] ?? "fltp";
334879
+ const sampleFormat = probeSampleFormat(track.type, codecName);
334701
334880
  const tagHex = doc.containerFormat === "wav" ? "0x" + (rawTag.charCodeAt(0) | rawTag.charCodeAt(1) << 8).toString(16).padStart(4, "0") : "0x" + Array.from(rawTag.padEnd(4, " ").slice(0, 4)).map((c) => c.charCodeAt(0).toString(16).padStart(2, "0")).join("");
334702
334881
  const durationSec = track.duration / Math.max(1, track.timescale);
334703
334882
  const totalBytes = materialized.samples.reduce((acc, s) => acc + s.size, 0);
@@ -339415,12 +339594,264 @@ function createMediaAstRegistry(plugins) {
339415
339594
  };
339416
339595
  }
339417
339596
 
339597
+ // packages/mp4-ast/src/esds-source.ts
339598
+ async function probeEsdsSource(source, range, options = {}) {
339599
+ options.signal?.throwIfAborted();
339600
+ if (!Number.isSafeInteger(source.size) || source.size < 0 || !Number.isSafeInteger(range.payloadOffset) || !Number.isSafeInteger(range.payloadSize) || range.payloadOffset < 0 || range.payloadSize < 0 || range.payloadOffset > source.size || range.payloadSize > source.size - range.payloadOffset)
339601
+ throw new RangeError("Invalid ES descriptor range");
339602
+ const iterator = consumeMp4SampleSteps(source, esdsSteps(range), options);
339603
+ const result = await iterator.next();
339604
+ if (!result.done) {
339605
+ await iterator.return(void 0);
339606
+ throw new Error("Unexpected ES descriptor sample");
339607
+ }
339608
+ const { objectTypeIndication, audioObjectType, sampleRate, channelCount, maxBitrate, avgBitrate } = result.value;
339609
+ return { objectTypeIndication, audioObjectType, sampleRate, channelCount, maxBitrate, avgBitrate };
339610
+ }
339611
+
339612
+ // packages/mp4-ast/src/mp4-codec-source.ts
339613
+ async function* scanMp4CodecDescriptions(source, range, options = {}) {
339614
+ options.signal?.throwIfAborted();
339615
+ if (!Number.isSafeInteger(source.size) || source.size < 0 || !Number.isSafeInteger(range.payloadOffset) || !Number.isSafeInteger(range.payloadSize) || range.payloadOffset < 0 || range.payloadSize < 0 || range.payloadOffset > source.size || range.payloadSize > source.size - range.payloadOffset)
339616
+ throw new RangeError("Invalid MP4 sample description range");
339617
+ const read = async (offset, length) => readMp4SampleRange(source, offset, length, options);
339618
+ if (range.payloadSize < 8) return;
339619
+ const header = new BinaryReader(await read(range.payloadOffset, 8));
339620
+ header.skip(4);
339621
+ const count = header.readU32BE();
339622
+ const end = range.payloadOffset + range.payloadSize;
339623
+ for (let i = 0, offset = range.payloadOffset + 8; i < count && end - offset >= 8; i++) {
339624
+ options.signal?.throwIfAborted();
339625
+ options.budget?.checkCpu();
339626
+ const entry = new BinaryReader(await read(offset, 8)), size = entry.readU32BE(), format = entry.readFourCC();
339627
+ if (size < 8 || size > end - offset) break;
339628
+ const bodyOffset = offset + 8, bodySize = size - 8;
339629
+ const state = sampleEntryHeader(format, await read(bodyOffset, Math.min(78, bodySize)));
339630
+ if (state.childOffset !== void 0 && state.childOffset < bodySize) {
339631
+ for await (const child of scanMp4Boxes(source, { offset: bodyOffset + state.childOffset, length: bodySize - state.childOffset, ...options })) {
339632
+ const prefix = async (length) => read(child.payloadOffset, Math.min(length, child.payloadSize));
339633
+ if (state.kind === "video") {
339634
+ if (child.type === "avcC") {
339635
+ const config = await prefix(8), length = config.length >= 8 ? new DataView(config.buffer, config.byteOffset, config.length).getUint16(6) : 0;
339636
+ const spsLength = Math.min(length, Math.max(0, child.payloadSize - 8));
339637
+ if ((config[5] ?? 0) & 31) {
339638
+ try {
339639
+ options.budget?.allocateMemory(spsLength);
339640
+ const sps = new Uint8Array(spsLength);
339641
+ for (let used = 0; used < spsLength; used += 16384) sps.set(await read(child.payloadOffset + 8 + used, Math.min(16384, spsLength - used)), used);
339642
+ applyCodecMetadata(state, { type: "avcC", levelIdc: config[3] ?? 0, sps });
339643
+ } finally {
339644
+ options.budget?.releaseMemory(spsLength);
339645
+ }
339646
+ } else applyCodecMetadata(state, { type: "avcC", levelIdc: config[3] ?? 0 });
339647
+ } else if (child.type === "hvcC") applyCodecMetadata(state, { ...parseHvcC(await prefix(23)), type: "hvcC" });
339648
+ else if (child.type === "av1C") applyCodecMetadata(state, { ...parseAv1C(await prefix(4)), type: "av1C" });
339649
+ else if (child.type === "vpcC") applyCodecMetadata(state, { ...parseVpcC(await prefix(12)), type: "vpcC" });
339650
+ else if (child.type === "pasp" && child.payloadSize >= 8) {
339651
+ const aspect = new BinaryReader(await prefix(8));
339652
+ applyCodecMetadata(state, { type: "pasp", sarWidth: aspect.readU32BE(), sarHeight: aspect.readU32BE() });
339653
+ }
339654
+ } else if (state.kind === "audio") {
339655
+ if (child.type === "esds") applyCodecMetadata(state, { type: "esds", config: await probeEsdsSource(source, child, options) });
339656
+ else if (child.type === "dOps") applyCodecMetadata(state, { ...parseDOps(await prefix(11)), type: "dOps" });
339657
+ }
339658
+ }
339659
+ }
339660
+ yield finishCodecMetadata(state);
339661
+ offset += size;
339662
+ }
339663
+ }
339664
+
339665
+ // packages/mp4-ast/src/mp4-packets-source.ts
339666
+ async function* scanMp4Packets(source, options = {}) {
339667
+ for await (const { sample, track, bytePos } of scanProbeSamples(source, options, false)) {
339668
+ const scale = Math.max(1, track.timescale);
339669
+ yield { codec_type: track.type, stream_index: track.index, pts: sample.pts, pts_time: (sample.pts / scale).toFixed(6), dts: sample.dts, dts_time: (sample.dts / scale).toFixed(6), duration: sample.duration, duration_time: (sample.duration / scale).toFixed(6), size: String(sample.size), pos: String(bytePos), flags: sample.isKeyframe ? "K_" : "__" };
339670
+ }
339671
+ }
339672
+ async function* scanMp4Frames(source, options = {}) {
339673
+ for await (const { sample, track } of scanProbeSamples(source, options, true)) {
339674
+ const scale = Math.max(1, track.timescale), ptsTime = (sample.pts / scale).toFixed(6);
339675
+ yield {
339676
+ media_type: track.type,
339677
+ stream_index: track.index,
339678
+ key_frame: sample.isKeyframe ? 1 : 0,
339679
+ pts: sample.pts,
339680
+ pts_time: ptsTime,
339681
+ pkt_dts: sample.dts,
339682
+ pkt_dts_time: (sample.dts / scale).toFixed(6),
339683
+ best_effort_timestamp: sample.pts,
339684
+ best_effort_timestamp_time: ptsTime,
339685
+ pkt_duration: sample.duration,
339686
+ pkt_duration_time: (sample.duration / scale).toFixed(6),
339687
+ pkt_size: String(sample.size),
339688
+ width: track.width,
339689
+ height: track.height,
339690
+ pix_fmt: track.type === "video" ? track.codec?.pixFmt ?? "yuv420p" : void 0,
339691
+ pict_type: track.type === "video" ? sample.isKeyframe ? "I" : "P" : void 0,
339692
+ sample_fmt: probeSampleFormat(track.type, track.codec?.codecName ?? (track.type === "video" ? "h264" : "aac")),
339693
+ nb_samples: track.type === "audio" ? sample.duration : void 0,
339694
+ channels: track.type === "audio" ? track.codec?.channels ?? 2 : void 0
339695
+ };
339696
+ }
339697
+ }
339698
+ async function* scanProbeSamples(source, options, withCodec) {
339699
+ options.signal?.throwIfAborted();
339700
+ const budget = options.budget ?? new MediaBudgetTracker(options.limits), work = { budget, ...options.signal ? { signal: options.signal } : {}, ...options.checkpoint ? { checkpoint: options.checkpoint } : {} };
339701
+ budget.checkInputBytes(source.size);
339702
+ const read = async (box, length) => new BinaryReader(box ? await readMp4SampleRange(source, box.payloadOffset, Math.min(length, box.payloadSize), work) : new Uint8Array());
339703
+ async function first(parent, type) {
339704
+ if (!parent?.children) return;
339705
+ for await (const box of scanMp4Boxes(source, { ...parent.children, ...work })) if (box.type === type) return box;
339706
+ }
339707
+ let moov, fragmented = false;
339708
+ for await (const box of scanMp4Boxes(source, work)) {
339709
+ if (box.type === "moov" && !moov) moov = box;
339710
+ if (box.type === "moof") fragmented = true;
339711
+ }
339712
+ if (!moov) throw new Error("Invalid MP4/ISOBMFF file: missing 'moov' atom");
339713
+ const mvhd = await first(moov, "mvhd"), movie = await read(mvhd, 32);
339714
+ let movieTimescale = 1e3, movieDuration = 0;
339715
+ if ((mvhd?.payloadSize ?? 0) >= 20) {
339716
+ const version = movie.readU8();
339717
+ movie.skip(3 + (version === 1 ? 16 : 8));
339718
+ movieTimescale = movie.readU32BE() || 1e3;
339719
+ movieDuration = version === 1 ? movie.readU64BE() : movie.readU32BE();
339720
+ }
339721
+ const mvex = await first(moov, "mvex");
339722
+ let trackIndex = 0, maxDuration = movieDuration / Math.max(1, movieTimescale);
339723
+ for await (const trak of scanMp4Boxes(source, { ...moov.children, ...work })) {
339724
+ if (trak.type !== "trak") continue;
339725
+ const index = trackIndex++;
339726
+ budget.checkStreams(trackIndex);
339727
+ const tkhd = await first(trak, "tkhd"), header = await read(tkhd, withCodec ? 96 : 36);
339728
+ let id = index + 1, headerDuration = 0, width, height;
339729
+ if ((tkhd?.payloadSize ?? 0) >= 24) {
339730
+ const version = header.readU8();
339731
+ header.skip(3 + (version === 1 ? 16 : 8));
339732
+ id = header.readU32BE() || id;
339733
+ header.skip(4);
339734
+ headerDuration = version === 1 ? header.readU64BE() : header.readU32BE();
339735
+ if (withCodec) {
339736
+ header.skip(52);
339737
+ const w = Math.round(header.readFixed16_16()), h = Math.round(header.readFixed16_16());
339738
+ if (w > 0) width = w;
339739
+ if (h > 0) height = h;
339740
+ }
339741
+ }
339742
+ const mdia = await first(trak, "mdia"), mdhd = await first(mdia, "mdhd"), media = await read(mdhd, 32);
339743
+ let timescale = movieTimescale, declaredDuration = 0;
339744
+ if ((mdhd?.payloadSize ?? 0) >= 20) {
339745
+ const version = media.readU8();
339746
+ media.skip(3 + (version === 1 ? 16 : 8));
339747
+ timescale = media.readU32BE() || 1e3;
339748
+ declaredDuration = version === 1 ? media.readU64BE() : media.readU32BE();
339749
+ }
339750
+ const hdlr = await first(mdia, "hdlr"), handler = await read(hdlr, 12);
339751
+ handler.skip(8);
339752
+ const handlerType = (hdlr?.payloadSize ?? 0) >= 12 ? handler.readFourCC() : "vide";
339753
+ const type = handlerType === "vide" ? "video" : handlerType === "soun" ? "audio" : ["sbtl", "text", "subp"].includes(handlerType) ? "subtitle" : "data";
339754
+ const stbl = await first(await first(mdia, "minf"), "stbl"), tables = {};
339755
+ if (stbl?.children) for await (const box of scanMp4Boxes(source, { ...stbl.children, ...work })) {
339756
+ if (["stts", "ctts", "stsc", "stsz", "stco", "co64", "stss"].includes(box.type)) {
339757
+ const name = box.type;
339758
+ tables[name] ??= box;
339759
+ }
339760
+ }
339761
+ let codec;
339762
+ if (withCodec) {
339763
+ const stsd = await first(stbl, "stsd");
339764
+ if (stsd) for await (const description of scanMp4CodecDescriptions(source, stsd, work)) {
339765
+ codec = description;
339766
+ break;
339767
+ }
339768
+ }
339769
+ const track = { index, type, timescale, width: width ?? codec?.width, height: height ?? codec?.height, codec };
339770
+ let defaults = { defaultSampleDescriptionIndex: 1, defaultSampleDuration: type === "video" ? 3e3 : 1024, defaultSampleSize: 0, defaultSampleFlags: 0 };
339771
+ if (mvex?.children) for await (const box of scanMp4Boxes(source, { ...mvex.children, ...work })) {
339772
+ if (box.type !== "trex" || box.payloadSize < 24) continue;
339773
+ const row = await read(box, 24);
339774
+ row.skip(4);
339775
+ if (row.readU32BE() !== id) continue;
339776
+ defaults = { defaultSampleDescriptionIndex: row.readU32BE() || 1, defaultSampleDuration: row.readU32BE() || 1024, defaultSampleSize: row.readU32BE(), defaultSampleFlags: row.readU32BE() };
339777
+ }
339778
+ const syncSamples = await options.syncSamples?.(index), sampleOptions = { ...work, type, ...syncSamples ? { syncSamples } : {} };
339779
+ async function* samples() {
339780
+ let state = { dts: 0, sampleCount: 0 };
339781
+ for await (const sample of scanMp4SampleTable(source, tables, sampleOptions)) {
339782
+ state = { dts: sample.dts + sample.duration, sampleCount: state.sampleCount + 1 };
339783
+ yield sample;
339784
+ }
339785
+ if (fragmented) for await (const moof of scanMp4Boxes(source, work)) {
339786
+ if (moof.type !== "moof" || !moof.children) continue;
339787
+ for await (const traf of scanMp4Boxes(source, { ...moof.children, ...work })) {
339788
+ if (traf.type === "traf" && traf.children) state = yield* scanMp4Fragment(source, traf.children, { ...work, type, trackId: id, moofOffset: moof.offset, defaults, state });
339789
+ }
339790
+ }
339791
+ }
339792
+ let duration = 0, mediaEnd = 0, allPacked = true, count = 0;
339793
+ for await (const sample of samples()) {
339794
+ count++;
339795
+ duration += sample.duration;
339796
+ mediaEnd = Math.max(mediaEnd, sample.pts + sample.duration);
339797
+ if (type === "subtitle" && allPacked) {
339798
+ if (sample.size < 2) allPacked = false;
339799
+ else allPacked = new BinaryReader(await readMp4SampleRange(source, sample.offset, 2, work)).readU16BE() === sample.size - 2;
339800
+ }
339801
+ }
339802
+ const elst = await first(await first(trak, "edts"), "elst");
339803
+ function* editDuration() {
339804
+ if (!elst || elst.payloadSize < 8) return;
339805
+ const header2 = new BinaryReader(yield { kind: "read", table: elst, offset: elst.payloadOffset, length: 8 });
339806
+ const version = header2.readU8();
339807
+ header2.skip(3);
339808
+ const count2 = header2.readU32BE(), width2 = version === 1 ? 20 : 12;
339809
+ let total = 0, entries = 0;
339810
+ for (let i = 0; i < count2 && 8 + i * width2 < elst.payloadSize; i++) {
339811
+ const row = new BinaryReader(yield { kind: "read", table: elst, offset: elst.payloadOffset + 8 + i * width2, length: Math.min(width2, elst.payloadSize - 8 - i * width2) });
339812
+ let segment = version === 1 ? row.readU64BE() : row.readU32BE();
339813
+ const mediaTime = version === 1 ? row.readI64BE() : row.readI32BE();
339814
+ if (fragmented && segment === 0 && mediaTime >= 0) segment = Math.round(Math.max(0, mediaEnd - mediaTime) * movieTimescale / timescale);
339815
+ total += segment;
339816
+ entries++;
339817
+ }
339818
+ return entries ? Math.round(total * timescale / movieTimescale) : void 0;
339819
+ }
339820
+ const edits = consumeMp4SampleSteps(source, editDuration(), sampleOptions), result = await edits.next();
339821
+ if (!result.done) throw new Error("Unexpected MP4 edit sample");
339822
+ const trackDuration = result.value ?? (duration || declaredDuration || Math.round(headerDuration / Math.max(1, movieTimescale) * timescale));
339823
+ maxDuration = Math.max(maxDuration, trackDuration / Math.max(1, timescale));
339824
+ budget.checkDuration(maxDuration);
339825
+ let bytePos = 0, cursor = 0;
339826
+ const packet = (sample) => {
339827
+ const record = { sample, track, bytePos };
339828
+ bytePos += sample.size;
339829
+ return record;
339830
+ };
339831
+ for await (const sample of samples()) {
339832
+ if (type !== "subtitle" || !count || allPacked) {
339833
+ yield packet(sample);
339834
+ continue;
339835
+ }
339836
+ const start = Math.max(cursor, Math.round(sample.pts));
339837
+ if (start > cursor) {
339838
+ yield packet({ pts: cursor, dts: cursor, duration: start - cursor, size: 2, isKeyframe: true });
339839
+ cursor = start;
339840
+ }
339841
+ const duration2 = Math.max(1, Math.round(sample.duration));
339842
+ yield packet({ pts: cursor, dts: cursor, duration: duration2, size: sample.size + 2, isKeyframe: true });
339843
+ cursor += duration2;
339844
+ }
339845
+ }
339846
+ budget.checkDuration(maxDuration);
339847
+ }
339848
+
339418
339849
  export {
339850
+ encodeUtf8,
339851
+ decodeUtf8,
339419
339852
  cloudflareWorkerLimits,
339420
339853
  MediaLimitExceededError,
339421
339854
  MediaBudgetTracker,
339422
- encodeUtf8,
339423
- decodeUtf8,
339424
339855
  decodeH264Samples,
339425
339856
  parseMp4,
339426
339857
  concatMp4,
@@ -339439,7 +339870,9 @@ export {
339439
339870
  hlsAst,
339440
339871
  dashAst,
339441
339872
  allMediaAsts,
339442
- createMediaAstRegistry
339873
+ createMediaAstRegistry,
339874
+ scanMp4Packets,
339875
+ scanMp4Frames
339443
339876
  };
339444
339877
  /*!
339445
339878
  Generated portable media codecs.