@poe-platform/safe-bash 0.1.809 → 0.1.811

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 (316) hide show
  1. package/dist/audio-ast/flac-source.d.ts +13 -0
  2. package/dist/audio-ast/index.d.ts +2 -1
  3. package/dist/audio-ast/index.js +254 -179
  4. package/dist/audio-ast/wav-source.d.ts +7 -1
  5. package/dist/image-ast/index.js +1 -1
  6. package/dist/json-ast/backed-json-parser.d.ts +12 -1
  7. package/dist/json-ast/index.d.ts +1 -1
  8. package/dist/office-xml/index.d.ts +1 -0
  9. package/dist/office-xml/retained-xml-edits.d.ts +22 -0
  10. package/dist/pdf-ast/cos/mutable-object-store.d.ts +3 -0
  11. package/dist/pdf-ast/cos/qpdf-json-document.d.ts +43 -0
  12. package/dist/pdf-ast/cos/qpdf-json-values.d.ts +7 -0
  13. package/dist/pdf-ast/index.d.ts +1 -0
  14. package/dist/pdf-ast/index.js +653 -87
  15. package/dist/pdf-ast/retained-document.d.ts +5 -1
  16. package/dist/safe-bash/audio-ast.browser.js +2 -1
  17. package/dist/safe-bash/chunks/{chunk-RQCK77SC.js → chunk-BUYRKFW2.js} +9 -36
  18. package/dist/safe-bash/chunks/{chunk-SOFBGDXG.js → chunk-HHSOUC3Z.js} +32 -0
  19. package/dist/safe-bash/chunks/{chunk-WAZEELYB.js → chunk-TPG55BAQ.js} +10 -7
  20. package/dist/safe-bash/command-chunks/biff-3EFLKBAH-NYWZOYQS.js +4942 -0
  21. package/dist/safe-bash/command-chunks/{chunk-HEHGHIE2.js → chunk-22MOB45U.js} +6 -6
  22. package/dist/safe-bash/command-chunks/{chunk-6DEWZMOL.js → chunk-2CORNDGF.js} +2 -2
  23. package/dist/safe-bash/command-chunks/{chunk-62ZAHKFS.js → chunk-2VCKUNDZ.js} +130 -14
  24. package/dist/safe-bash/command-chunks/{chunk-6UHGIWFX.js → chunk-2ZFLMWOX.js} +1 -1
  25. package/dist/safe-bash/command-chunks/{chunk-HONWGFDA.js → chunk-33YCKZZX.js} +6 -6
  26. package/dist/safe-bash/command-chunks/{chunk-AXWPJRY6.js → chunk-36XGIPOG.js} +1 -1
  27. package/dist/safe-bash/command-chunks/{chunk-32ADKP5E.js → chunk-456PHA3L.js} +1 -1
  28. package/dist/safe-bash/command-chunks/{chunk-UJXP3T6R.js → chunk-4CKFNXRN.js} +1 -1
  29. package/dist/safe-bash/command-chunks/{chunk-5L6GHFRW.js → chunk-554Z6IKP.js} +2 -2
  30. package/dist/safe-bash/command-chunks/{chunk-ORZRWT62.js → chunk-56NYSX65.js} +9 -9
  31. package/dist/safe-bash/command-chunks/{chunk-53JP3S6H.js → chunk-5HPU7D36.js} +4 -4
  32. package/dist/safe-bash/command-chunks/{chunk-NB7JO7FE.js → chunk-5LI2DLNZ.js} +26 -26
  33. package/dist/safe-bash/command-chunks/{chunk-YJJBGN7U.js → chunk-5MB64DWR.js} +9 -9
  34. package/dist/safe-bash/command-chunks/{chunk-3ZWBBS6U.js → chunk-5OO2P27R.js} +340 -34
  35. package/dist/safe-bash/command-chunks/{chunk-IC5GJI7E.js → chunk-5Q22ZLNC.js} +6 -6
  36. package/dist/safe-bash/command-chunks/{chunk-YO3V5RLY.js → chunk-6CCQI6XZ.js} +12 -12
  37. package/dist/safe-bash/command-chunks/{chunk-EO2IVGV7.js → chunk-6M6TM5Z5.js} +3 -3
  38. package/dist/safe-bash/command-chunks/{chunk-Z54Z3KRN.js → chunk-6QBMND4A.js} +1 -1
  39. package/dist/safe-bash/command-chunks/{chunk-INX4JMQ6.js → chunk-6VPQ3CDZ.js} +5 -5
  40. package/dist/safe-bash/command-chunks/chunk-72C3TZ2U.js +826 -0
  41. package/dist/safe-bash/command-chunks/{chunk-VGXVN3BX.js → chunk-7GKKMNL6.js} +8 -8
  42. package/dist/safe-bash/command-chunks/{chunk-TZJC67W3.js → chunk-7PVHO47B.js} +6 -6
  43. package/dist/safe-bash/command-chunks/{chunk-CM3C7AXJ.js → chunk-A2CLZMQZ.js} +1 -1
  44. package/dist/safe-bash/command-chunks/{chunk-ASR27KHW.js → chunk-A5FZBR7X.js} +4 -4
  45. package/dist/safe-bash/command-chunks/{chunk-DMDHE5KC.js → chunk-AHA6IWAJ.js} +6 -6
  46. package/dist/safe-bash/command-chunks/{chunk-PTZ55XXN.js → chunk-APEWTWCC.js} +6 -6
  47. package/dist/safe-bash/command-chunks/{chunk-YUVH6CE4.js → chunk-ATTWQVR2.js} +17 -17
  48. package/dist/safe-bash/command-chunks/{chunk-JON5DB3Z.js → chunk-B5LDP7AA.js} +2 -2
  49. package/dist/safe-bash/command-chunks/{chunk-CHJL6JMU.js → chunk-COKYZUBW.js} +1 -1
  50. package/dist/safe-bash/command-chunks/{chunk-KCTV4NVX.js → chunk-CRV2Q3PB.js} +1 -1
  51. package/dist/safe-bash/command-chunks/{chunk-V3WXPCKN.js → chunk-CV7M2QJU.js} +7 -7
  52. package/dist/safe-bash/command-chunks/{chunk-D7XBUF76.js → chunk-D2ASPM7R.js} +109 -23
  53. package/dist/safe-bash/command-chunks/{chunk-VPDSQPSN.js → chunk-DM2CPMB4.js} +2 -2
  54. package/dist/safe-bash/command-chunks/{chunk-3DTDMEOP.js → chunk-EAGIJ4VW.js} +1 -1
  55. package/dist/safe-bash/command-chunks/{chunk-WFDG3N5R.js → chunk-ECDEPKKW.js} +1 -1
  56. package/dist/safe-bash/command-chunks/{chunk-JW6CMBF2.js → chunk-EHSM5ZQS.js} +8 -8
  57. package/dist/safe-bash/command-chunks/{chunk-WIOH7ZQN.js → chunk-ENT3IV2G.js} +12 -12
  58. package/dist/safe-bash/command-chunks/{chunk-5IE4LJGB.js → chunk-EUT24Y5Z.js} +8 -8
  59. package/dist/safe-bash/command-chunks/{chunk-COKZFXHG.js → chunk-FIIAYCWS.js} +2 -2
  60. package/dist/safe-bash/command-chunks/{chunk-MWVFP2HY.js → chunk-GEM47B2P.js} +7 -7
  61. package/dist/safe-bash/command-chunks/{chunk-OQCJGUI6.js → chunk-HARUYHH7.js} +10 -10
  62. package/dist/safe-bash/command-chunks/{chunk-EHL6B34L.js → chunk-HDJVJTCK.js} +9 -9
  63. package/dist/safe-bash/command-chunks/{chunk-JMM3MNAY.js → chunk-HKATEVAP.js} +6 -6
  64. package/dist/safe-bash/command-chunks/{chunk-NVBUC644.js → chunk-HKGNBH7Z.js} +2 -2
  65. package/dist/safe-bash/command-chunks/{chunk-VWY3EAVQ.js → chunk-HTVIYLVB.js} +4 -4
  66. package/dist/safe-bash/command-chunks/{chunk-Z4QJMDK3.js → chunk-IT7TAC3F.js} +16 -16
  67. package/dist/safe-bash/command-chunks/{chunk-EWS4KYJE.js → chunk-JFYWVQ4V.js} +8 -8
  68. package/dist/safe-bash/command-chunks/{chunk-ZCX63QWA.js → chunk-JOCFI7TG.js} +1 -1
  69. package/dist/safe-bash/command-chunks/{chunk-F5WTH4O4.js → chunk-JQVHUSDD.js} +5 -5
  70. package/dist/safe-bash/command-chunks/{chunk-O4VJEGL6.js → chunk-K5GB2YMN.js} +10 -10
  71. package/dist/safe-bash/command-chunks/{chunk-27C3NT5V.js → chunk-KB7DUBVL.js} +5 -5
  72. package/dist/safe-bash/command-chunks/{chunk-4DZ32PI7.js → chunk-KCOJA7EM.js} +7 -7
  73. package/dist/safe-bash/command-chunks/{chunk-6OKH4X67.js → chunk-KJ4XXZIL.js} +273 -10
  74. package/dist/safe-bash/command-chunks/{chunk-GLVD3JJG.js → chunk-KL3OIBKB.js} +4712 -4654
  75. package/dist/safe-bash/command-chunks/{chunk-U6QHTC5J.js → chunk-L5MCW6CM.js} +4 -4
  76. package/dist/safe-bash/command-chunks/{chunk-LVL3A7YE.js → chunk-LCZDBW55.js} +5 -5
  77. package/dist/safe-bash/command-chunks/{chunk-DJVRDUCA.js → chunk-LXLLA4PM.js} +17 -17
  78. package/dist/safe-bash/command-chunks/{chunk-K7AGAS3K.js → chunk-M7QE2MN7.js} +6 -6
  79. package/dist/safe-bash/command-chunks/chunk-MGBHGZEX.js +12 -0
  80. package/dist/safe-bash/command-chunks/{chunk-SWT6ILF2.js → chunk-MPUHH2KR.js} +3 -3
  81. package/dist/safe-bash/command-chunks/{chunk-DC3OJLRB.js → chunk-NQDIT667.js} +5 -5
  82. package/dist/safe-bash/command-chunks/{chunk-LWZVDDJA.js → chunk-NUGQQDGE.js} +5 -1
  83. package/dist/safe-bash/command-chunks/{chunk-MFLQZLFR.js → chunk-OA75SGN2.js} +7 -7
  84. package/dist/safe-bash/command-chunks/{chunk-5LATYOF7.js → chunk-OEJM666F.js} +5 -5
  85. package/dist/safe-bash/command-chunks/{chunk-AF25YYIO.js → chunk-PMAM4N33.js} +9 -9
  86. package/dist/safe-bash/command-chunks/{chunk-4557HE3J.js → chunk-PMWW7KSB.js} +161 -42
  87. package/dist/safe-bash/command-chunks/{chunk-KMMAJ6H6.js → chunk-PNGDJA6M.js} +2 -2
  88. package/dist/safe-bash/command-chunks/{chunk-62BHPSKJ.js → chunk-Q6S57NOQ.js} +7 -7
  89. package/dist/safe-bash/command-chunks/{chunk-KJ3PEDI2.js → chunk-Q73EMLLZ.js} +146 -4
  90. package/dist/safe-bash/command-chunks/{chunk-FXKBM5KJ.js → chunk-QC5RMGSA.js} +3 -3
  91. package/dist/safe-bash/command-chunks/{chunk-UQ6UIZMM.js → chunk-QD7ZRDUN.js} +1 -1
  92. package/dist/safe-bash/command-chunks/{chunk-JHUYZZGV.js → chunk-QYMEASQ6.js} +4 -4
  93. package/dist/safe-bash/command-chunks/{chunk-3GY5VDIX.js → chunk-QZZ73J2O.js} +6 -6
  94. package/dist/safe-bash/command-chunks/{chunk-S2CYIGWH.js → chunk-R6EGGK5M.js} +7 -7
  95. package/dist/safe-bash/command-chunks/{chunk-7AVN3OBH.js → chunk-RHYJVTJO.js} +2 -2
  96. package/dist/safe-bash/command-chunks/{chunk-EWGDSO6U.js → chunk-RID6VYS3.js} +8 -8
  97. package/dist/safe-bash/command-chunks/{chunk-MMBRBANA.js → chunk-RNSKXOG3.js} +6 -6
  98. package/dist/safe-bash/command-chunks/{chunk-D3ZRZTY5.js → chunk-RQIQ75W5.js} +5 -5
  99. package/dist/safe-bash/command-chunks/{chunk-DWKQPLRT.js → chunk-RRL3Y562.js} +11 -11
  100. package/dist/safe-bash/command-chunks/{chunk-JW3KIZU6.js → chunk-RUXY7GN5.js} +1 -1
  101. package/dist/safe-bash/command-chunks/{chunk-NXCMXD74.js → chunk-S6R3IB36.js} +1 -1
  102. package/dist/safe-bash/command-chunks/{chunk-XUPKFHAQ.js → chunk-SDTPO2VV.js} +7 -7
  103. package/dist/safe-bash/command-chunks/{chunk-PIAGKRFW.js → chunk-SPLOIABU.js} +3 -3
  104. package/dist/safe-bash/command-chunks/{chunk-KELMIFVV.js → chunk-TI52LKLL.js} +1 -1
  105. package/dist/safe-bash/command-chunks/{chunk-WLTJDNSQ.js → chunk-TVH4JORU.js} +3 -3
  106. package/dist/safe-bash/command-chunks/{chunk-6XVMWFHD.js → chunk-TW73OXPR.js} +6 -6
  107. package/dist/safe-bash/command-chunks/{chunk-SFO43CID.js → chunk-UAXSE3XE.js} +5 -5
  108. package/dist/safe-bash/command-chunks/{chunk-K35BSUHO.js → chunk-UYWSIIUX.js} +7 -7
  109. package/dist/safe-bash/command-chunks/{chunk-JJQ72P3V.js → chunk-VCML4T5D.js} +1 -1
  110. package/dist/safe-bash/command-chunks/{chunk-DCD32BEY.js → chunk-VU3EQF7F.js} +91 -53
  111. package/dist/safe-bash/command-chunks/{chunk-2E2YEDVB.js → chunk-W5YSINXC.js} +6 -6
  112. package/dist/safe-bash/command-chunks/{chunk-EYNT4OEJ.js → chunk-WGG6G2KG.js} +7 -7
  113. package/dist/safe-bash/command-chunks/chunk-WH3TIOTS.js +326 -0
  114. package/dist/safe-bash/command-chunks/{chunk-DVQBZXMQ.js → chunk-WJCN2IXI.js} +2 -2
  115. package/dist/safe-bash/command-chunks/{chunk-45FI2IPY.js → chunk-WQ6ABTJU.js} +3 -6
  116. package/dist/safe-bash/command-chunks/{chunk-XBZ4ZWGL.js → chunk-WVMHRNXZ.js} +3 -3
  117. package/dist/safe-bash/command-chunks/{chunk-7GXUCQI4.js → chunk-WXRYDALR.js} +4 -4
  118. package/dist/safe-bash/command-chunks/{chunk-S4IIOSRA.js → chunk-X7FA7ZD5.js} +8 -8
  119. package/dist/safe-bash/command-chunks/{chunk-SFCERNHU.js → chunk-XPD636C4.js} +3 -3
  120. package/dist/safe-bash/command-chunks/{chunk-HYDWQLJ3.js → chunk-XRVKWGVQ.js} +6 -6
  121. package/dist/safe-bash/command-chunks/{chunk-3UJWHRK4.js → chunk-XVP6V5K3.js} +6 -6
  122. package/dist/safe-bash/command-chunks/{chunk-KTI3BULE.js → chunk-XZ2FWFNV.js} +6 -6
  123. package/dist/safe-bash/command-chunks/{chunk-QK3CHRGL.js → chunk-Y4EYCZFT.js} +10 -10
  124. package/dist/safe-bash/command-chunks/{chunk-GTWVMFBK.js → chunk-YORJDX4V.js} +4 -4
  125. package/dist/safe-bash/command-chunks/{chunk-H6F5SN2N.js → chunk-YSMNXMAO.js} +4 -4
  126. package/dist/safe-bash/command-chunks/{chunk-GKYCV6BU.js → chunk-YSY6R6AS.js} +493 -183
  127. package/dist/safe-bash/command-chunks/{chunk-SE5SJ4JT.js → chunk-Z2JW6M2D.js} +3 -3
  128. package/dist/safe-bash/command-chunks/{chunk-5HGEXQVD.js → chunk-ZHRGYR7B.js} +7 -7
  129. package/dist/safe-bash/command-chunks/{chunk-HQYFRQ5W.js → chunk-ZIIO6GRY.js} +7 -7
  130. package/dist/safe-bash/command-chunks/{chunk-NTRZMQZP.js → chunk-ZMHEGDU2.js} +2 -2
  131. package/dist/safe-bash/command-chunks/{chunk-EYBXHGA6.js → chunk-ZXR6LXV5.js} +2 -2
  132. package/dist/safe-bash/command-chunks/{command-engine-P5DFM4OU.js → command-engine-BEWABZ75.js} +10 -3
  133. package/dist/safe-bash/command-chunks/{engine-RU4OFLPO-CPLFYD67.js → engine-AXXFTGCL-QBQNBI6K.js} +1 -1
  134. package/dist/safe-bash/command-chunks/pdf-XHHFTOT4-UJJYOYJ2.js +573 -0
  135. package/dist/safe-bash/commands/audio/index.browser.js +2 -14
  136. package/dist/safe-bash/commands/diff-patch/index.js +0 -5
  137. package/dist/safe-bash/commands/diff3/index.js +0 -2
  138. package/dist/safe-bash/commands/ffprobe/index.browser.js +2 -5
  139. package/dist/safe-bash/commands/pandoc/index.browser.js +3 -1
  140. package/dist/safe-bash/commands/text.js +10 -1
  141. package/dist/safe-bash/core.d.ts +2 -2
  142. package/dist/safe-bash/core.js +2 -2
  143. package/dist/safe-bash/full-core.browser.js +18 -22
  144. package/dist/safe-bash/lazy-optional.d.ts +9 -0
  145. package/dist/safe-bash/lazy-optional.js +24 -0
  146. package/dist/safe-bash/plugins/index.browser.js +5 -3
  147. package/dist/safe-bash/plugins/index.js +3 -1
  148. package/dist/safe-bash/plugins/portable-commands.d.ts +1 -1
  149. package/dist/safe-bash/plugins/portable-commands.js +5 -3
  150. package/dist/safe-bash/registry-entry.browser.js +1 -1
  151. package/dist/safe-bash-command-apply-patch/apply.js +2 -2
  152. package/dist/safe-bash-command-apply-patch/index.js +2 -2
  153. package/dist/safe-bash-command-apply-patch/parser.d.ts +20 -1
  154. package/dist/safe-bash-command-apply-patch/parser.js +1 -1
  155. package/dist/safe-bash-command-diff/index.js +0 -2
  156. package/dist/safe-bash-command-diff3/index.js +830 -56
  157. package/dist/safe-bash-command-ffmpeg/index.js +1 -1
  158. package/dist/safe-bash-command-ffprobe/index.js +3 -2
  159. package/dist/safe-bash-command-ffprobe/media.js +3 -2
  160. package/dist/safe-bash-command-ffprobe/options.d.ts +15 -0
  161. package/dist/safe-bash-command-ffprobe/options.js +7 -0
  162. package/dist/safe-bash-command-html-to-markdown/index.js +75 -21
  163. package/dist/safe-bash-command-media/index.js +2 -2
  164. package/dist/safe-bash-command-media/plugin.js +1 -1
  165. package/dist/safe-bash-command-media/remote.js +2 -2
  166. package/dist/safe-bash-command-pandoc/command.js +8 -8
  167. package/dist/safe-bash-command-pandoc/execution.d.ts +2 -2
  168. package/dist/safe-bash-command-pandoc/index.d.ts +1 -1
  169. package/dist/safe-bash-command-pandoc/index.js +37 -37
  170. package/dist/safe-bash-command-pandoc/lua-filters.js +2 -2
  171. package/dist/safe-bash-command-pandoc/types.d.ts +17 -2
  172. package/dist/safe-bash-command-patch/index.js +2 -2
  173. package/dist/safe-bash-command-patch/patch-publication.d.ts +2 -2
  174. package/dist/safe-bash-command-patch/patch-publication.js +1 -1
  175. package/dist/safe-bash-command-patch/patch.js +2 -2
  176. package/dist/safe-bash-command-pdftk/index.js +616 -265
  177. package/dist/safe-bash-command-pptx/engine.js +1 -1
  178. package/dist/safe-bash-command-qpdf/index.js +115 -9
  179. package/dist/safe-bash-command-soffice/index.js +1 -1
  180. package/dist/safe-bash-command-ssconvert/index.js +2 -2
  181. package/dist/safe-bash-command-xmllint/index.js +137 -30
  182. package/dist/safe-bash-command-xq/index.js +45 -29
  183. package/dist/safe-bash-compression-engine/bounded-codec.js +2 -2
  184. package/dist/safe-bash-compression-engine/codec-loader.js +1 -1
  185. package/dist/safe-bash-compression-engine/files.js +5 -5
  186. package/dist/safe-bash-compression-engine/index.js +4 -4
  187. package/dist/safe-bash-compression-engine/operand.js +5 -5
  188. package/dist/safe-bash-compression-engine/stream.js +4 -4
  189. package/dist/safe-bash-compression-engine/zstd-decode.js +3 -3
  190. package/dist/safe-bash-media-engine/imagemagick.d.ts +2 -0
  191. package/dist/safe-bash-media-engine/index.js +162 -72
  192. package/dist/safe-bash-network-engine/body.d.ts +1 -0
  193. package/dist/safe-bash-network-engine/body.js +1 -1
  194. package/dist/safe-bash-network-engine/transfer.js +11 -3
  195. package/dist/safe-bash-presentation-engine/accessibility.js +30 -30
  196. package/dist/safe-bash-presentation-engine/animation-editing.js +15 -15
  197. package/dist/safe-bash-presentation-engine/animations.js +15 -15
  198. package/dist/safe-bash-presentation-engine/backgrounds.js +16 -16
  199. package/dist/safe-bash-presentation-engine/bytes.js +3 -3
  200. package/dist/safe-bash-presentation-engine/chart-editing.js +33 -33
  201. package/dist/safe-bash-presentation-engine/chart-object-operations.js +24 -24
  202. package/dist/safe-bash-presentation-engine/charts.js +30 -30
  203. package/dist/safe-bash-presentation-engine/command-placeholder.js +55 -54
  204. package/dist/safe-bash-presentation-engine/comments.js +16 -16
  205. package/dist/safe-bash-presentation-engine/connector-operations.js +31 -31
  206. package/dist/safe-bash-presentation-engine/connectors.js +28 -28
  207. package/dist/safe-bash-presentation-engine/content-types.js +4 -4
  208. package/dist/safe-bash-presentation-engine/creation.js +6 -6
  209. package/dist/safe-bash-presentation-engine/diff.js +31 -31
  210. package/dist/safe-bash-presentation-engine/drawing-format.js +19 -19
  211. package/dist/safe-bash-presentation-engine/drawing-operations.js +30 -30
  212. package/dist/safe-bash-presentation-engine/drawing-schema.js +20 -20
  213. package/dist/safe-bash-presentation-engine/equations.js +16 -16
  214. package/dist/safe-bash-presentation-engine/errors.js +2 -2
  215. package/dist/safe-bash-presentation-engine/fields.js +16 -16
  216. package/dist/safe-bash-presentation-engine/font-metrics.js +3 -3
  217. package/dist/safe-bash-presentation-engine/image-extraction.js +19 -19
  218. package/dist/safe-bash-presentation-engine/image-formatting.js +31 -31
  219. package/dist/safe-bash-presentation-engine/image-insertion.js +17 -17
  220. package/dist/safe-bash-presentation-engine/image-replacement.js +20 -20
  221. package/dist/safe-bash-presentation-engine/image-value.js +4 -4
  222. package/dist/safe-bash-presentation-engine/images.js +18 -18
  223. package/dist/safe-bash-presentation-engine/index.d.ts +2 -2
  224. package/dist/safe-bash-presentation-engine/index.js +100 -93
  225. package/dist/safe-bash-presentation-engine/layouts.js +15 -15
  226. package/dist/safe-bash-presentation-engine/length.js +3 -3
  227. package/dist/safe-bash-presentation-engine/links.js +15 -15
  228. package/dist/safe-bash-presentation-engine/masters.js +14 -14
  229. package/dist/safe-bash-presentation-engine/media-editing.js +23 -23
  230. package/dist/safe-bash-presentation-engine/media-extraction.js +16 -16
  231. package/dist/safe-bash-presentation-engine/media.js +15 -15
  232. package/dist/safe-bash-presentation-engine/memberships.js +14 -14
  233. package/dist/safe-bash-presentation-engine/notes.js +15 -15
  234. package/dist/safe-bash-presentation-engine/ole-enum.js +4 -4
  235. package/dist/safe-bash-presentation-engine/ole-insertion.js +19 -19
  236. package/dist/safe-bash-presentation-engine/opaque-objects.js +9 -9
  237. package/dist/safe-bash-presentation-engine/package-reader.js +5 -5
  238. package/dist/safe-bash-presentation-engine/package-tools.js +15 -15
  239. package/dist/safe-bash-presentation-engine/package-uri.js +3 -3
  240. package/dist/safe-bash-presentation-engine/package-writer.js +4 -4
  241. package/dist/safe-bash-presentation-engine/presentation-model.js +54 -53
  242. package/dist/safe-bash-presentation-engine/presentation-settings.js +13 -13
  243. package/dist/safe-bash-presentation-engine/properties.js +15 -15
  244. package/dist/safe-bash-presentation-engine/relationships.js +4 -4
  245. package/dist/safe-bash-presentation-engine/resource-limits.js +1 -1
  246. package/dist/safe-bash-presentation-engine/retained-inspection.js +12 -12
  247. package/dist/safe-bash-presentation-engine/retained-package.js +4 -4
  248. package/dist/safe-bash-presentation-engine/retained-slide-settings.d.ts +15 -0
  249. package/dist/safe-bash-presentation-engine/retained-text.js +19 -19
  250. package/dist/safe-bash-presentation-engine/retained-xml-parts.d.ts +26 -0
  251. package/dist/safe-bash-presentation-engine/sanitize.js +16 -16
  252. package/dist/safe-bash-presentation-engine/selectors.js +10 -10
  253. package/dist/safe-bash-presentation-engine/shape-groups.js +30 -30
  254. package/dist/safe-bash-presentation-engine/shape-operations.js +29 -29
  255. package/dist/safe-bash-presentation-engine/shape-path-operations.js +31 -31
  256. package/dist/safe-bash-presentation-engine/shape-paths.js +15 -15
  257. package/dist/safe-bash-presentation-engine/shape-presets.js +3 -3
  258. package/dist/safe-bash-presentation-engine/shape-selection.js +30 -30
  259. package/dist/safe-bash-presentation-engine/shape-transforms.js +17 -17
  260. package/dist/safe-bash-presentation-engine/shapes.js +26 -26
  261. package/dist/safe-bash-presentation-engine/slide-copy.js +16 -16
  262. package/dist/safe-bash-presentation-engine/slide-import.js +17 -17
  263. package/dist/safe-bash-presentation-engine/slide-merge-split.js +19 -19
  264. package/dist/safe-bash-presentation-engine/slide-model.js +42 -42
  265. package/dist/safe-bash-presentation-engine/slide-removal.js +17 -17
  266. package/dist/safe-bash-presentation-engine/slide-transfer-budget.js +9 -9
  267. package/dist/safe-bash-presentation-engine/slides.d.ts +2 -0
  268. package/dist/safe-bash-presentation-engine/slides.js +21 -16
  269. package/dist/safe-bash-presentation-engine/table-operations.js +32 -32
  270. package/dist/safe-bash-presentation-engine/table-spans.js +31 -31
  271. package/dist/safe-bash-presentation-engine/tables.js +30 -30
  272. package/dist/safe-bash-presentation-engine/tags.js +15 -15
  273. package/dist/safe-bash-presentation-engine/template-bindings.js +32 -32
  274. package/dist/safe-bash-presentation-engine/template-repeat.js +39 -39
  275. package/dist/safe-bash-presentation-engine/text-fitting.js +26 -26
  276. package/dist/safe-bash-presentation-engine/text-frames.js +26 -26
  277. package/dist/safe-bash-presentation-engine/text-paragraphs.js +26 -26
  278. package/dist/safe-bash-presentation-engine/text-reading.js +11 -11
  279. package/dist/safe-bash-presentation-engine/text-replacement.js +16 -16
  280. package/dist/safe-bash-presentation-engine/text-runs.js +19 -19
  281. package/dist/safe-bash-presentation-engine/themes.js +15 -15
  282. package/dist/safe-bash-presentation-engine/transitions.js +15 -15
  283. package/dist/safe-bash-presentation-engine/validation.js +9 -9
  284. package/dist/safe-bash-presentation-engine/xml-parts.d.ts +1 -0
  285. package/dist/safe-bash-presentation-engine/xml-parts.js +19 -13
  286. package/dist/safe-bash-presentation-engine/xml-view.js +3 -3
  287. package/dist/safe-bash-presentation-engine/xml.js +3 -3
  288. package/dist/safe-bash-xml-engine/document.js +1 -1
  289. package/dist/safe-bash-xml-engine/index.js +1 -1
  290. package/dist/safe-bash-xml-engine/json.d.ts +1 -0
  291. package/dist/safe-bash-xml-engine/json.js +203 -0
  292. package/dist/safe-bash-xml-engine/stored-json.d.ts +5 -0
  293. package/dist/spreadsheet-engine/rendering/print/bidi-runs.d.ts +5 -0
  294. package/dist/spreadsheet-engine/rendering/print/bidi-runs.js +35 -0
  295. package/dist/spreadsheet-engine/rendering/print/control-bidi.d.ts +8 -0
  296. package/dist/spreadsheet-engine/rendering/print/control-bidi.js +80 -0
  297. package/dist/spreadsheet-engine/rendering/print/tab-layout.d.ts +11 -0
  298. package/dist/spreadsheet-engine/rendering/print/tab-layout.js +15 -0
  299. package/dist/spreadsheet-engine/rendering/print/text-lines.d.ts +2 -2
  300. package/dist/spreadsheet-engine/rendering/print/text-lines.js +3 -3
  301. package/dist/spreadsheet-format-xls/biff-encrypted-properties.d.ts +5 -1
  302. package/dist/spreadsheet-format-xls/biff-encrypted-properties.js +151 -57
  303. package/dist/spreadsheet-format-xls/biff-encryption.d.ts +1 -1
  304. package/dist/spreadsheet-format-xls/biff-encryption.js +8 -3
  305. package/dist/spreadsheet-format-xls/biff-property-bytes.d.ts +4 -1
  306. package/dist/spreadsheet-format-xls/biff-property-bytes.js +3 -3
  307. package/dist/spreadsheet-format-xls/biff-range.js +1 -1
  308. package/dist/spreadsheet-format-xls/biff.js +11 -3
  309. package/package.json +6 -2
  310. package/dist/safe-bash/chunks/chunk-I2A5ZCPD.js +0 -17
  311. package/dist/safe-bash/chunks/chunk-PQTT2EZP.js +0 -8
  312. package/dist/safe-bash/command-chunks/biff-DS263V2K-2GP4GZT7.js +0 -4868
  313. package/dist/safe-bash/command-chunks/chunk-6ZFYWT3U.js +0 -581
  314. package/dist/safe-bash/command-chunks/chunk-S244SWDH.js +0 -153
  315. package/dist/safe-bash/command-chunks/pdf-T7AWYZGQ-KNAYJ7YF.js +0 -552
  316. /package/dist/safe-bash/command-chunks/{chunk-EMMSXKEJ.js → chunk-4Q4R3VZU.js} +0 -0
@@ -1,163 +1,110 @@
1
+ import {
2
+ resolveFfprobeLimits
3
+ } from "./chunk-MGBHGZEX.js";
1
4
  import {
2
5
  MediaBudgetTracker,
3
6
  allMediaAsts,
4
7
  createMediaAstRegistry,
5
8
  encodeUtf8,
6
9
  parseStreamingManifest
7
- } from "./chunk-DCD32BEY.js";
10
+ } from "./chunk-VU3EQF7F.js";
8
11
 
9
- // packages/safe-bash-command-ffprobe/src/probe-output.ts
10
- import { PagedStorage } from "@poe-platform/safe-fs/storage";
11
- import { writeBytes } from "../../safe-bash-contracts/io.js";
12
+ // packages/safe-bash-command-ffprobe/src/wav-tags.ts
13
+ import { IntegerTable, PagedStorage } from "@poe-platform/safe-fs/storage";
12
14
  import { yieldTurn } from "../../safe-bash-contracts/yield.js";
13
- async function* encodeParts(parts, signal) {
14
- const encoder = new TextEncoder();
15
- let high = "", steps = 0;
16
- for (const part of parts) {
17
- signal.throwIfAborted();
18
- for (let offset = 0; offset < part.length; offset += 4096) {
19
- signal.throwIfAborted();
20
- let text = high + part.slice(offset, offset + 4096);
21
- high = "";
22
- const last = text.charCodeAt(text.length - 1);
23
- if (last >= 55296 && last <= 56319) {
24
- high = text.at(-1);
25
- text = text.slice(0, -1);
26
- }
27
- if (text) yield encoder.encode(text);
28
- if (++steps % 256 === 0) await yieldTurn(signal);
29
- }
15
+ var WavTags = class {
16
+ constructor(source, context) {
17
+ this.source = source;
18
+ this.context = context;
19
+ this.storage = new PagedStorage(context, 4);
20
+ this.close = this.storage.close.bind(this.storage);
21
+ this.keys = new IntegerTable(this.storage, 128);
22
+ this.numeric = new IntegerTable(this.storage, 128);
30
23
  }
31
- if (high) yield encoder.encode(high);
32
- }
33
- async function writeProbeOutput(context, parts, check) {
34
- const storage = new PagedStorage(context, 4), start = storage.allocate(0);
35
- let size = 0, failed = true;
36
- try {
37
- for await (const bytes of encodeParts(parts, context.signal)) {
38
- size += bytes.length;
39
- check(size);
40
- await storage.append(bytes);
24
+ source;
25
+ context;
26
+ storage;
27
+ keys;
28
+ numeric;
29
+ head = 0;
30
+ tail = 0;
31
+ count = 0;
32
+ close;
33
+ async *decoded(offset, length) {
34
+ const decoder = new TextDecoder();
35
+ let steps = 0;
36
+ for (let at = 0; at < length; at += 16384) {
37
+ this.context.signal.throwIfAborted();
38
+ const bytes = await this.source.read(offset + at, Math.min(16384, length - at));
39
+ this.context.signal.throwIfAborted();
40
+ if (bytes.length !== Math.min(16384, length - at)) throw new Error("Truncated WAV tag");
41
+ yield decoder.decode(bytes, { stream: true });
42
+ if (++steps % 256 === 0) await yieldTurn(this.context.signal);
41
43
  }
42
- context.signal.throwIfAborted();
43
- if (size === 0) await writeBytes(context.stdout, new Uint8Array(0), context.signal);
44
- for (let offset = 0; offset < size; offset += 16384)
45
- await writeBytes(context.stdout, await storage.read(start + offset, Math.min(16384, size - offset)), context.signal);
46
- failed = false;
47
- } finally {
48
- if (failed) {
49
- try {
50
- await storage.close();
51
- } catch {
52
- }
53
- } else await storage.close();
44
+ yield decoder.decode();
54
45
  }
55
- }
56
-
57
- // packages/safe-bash-command-ffprobe/src/stream-input.ts
58
- import { PagedStorage as PagedStorage2 } from "@poe-platform/safe-fs/storage";
59
- import { readBytes } from "../../safe-bash-contracts/io.js";
60
- import { readFileStream } from "../../safe-bash-contracts/filesystem.js";
61
- import { yieldTurn as yieldTurn2 } from "../../safe-bash-contracts/yield.js";
62
- async function openProbeStream(context, path) {
63
- context.signal.throwIfAborted();
64
- if (path === void 0) return readBytes(context.stdin, context.signal);
65
- const capabilities = await context.fs.capabilitiesFor?.(path, { signal: context.signal }) ?? context.fs.capabilities;
66
- context.signal.throwIfAborted();
67
- if (!context.fs.readStream || capabilities.streamingRead === false || context.fs.capabilities.streamingRead === false) return void 0;
68
- return readFileStream(context.fs, path, { signal: context.signal, chunkSize: 16384 });
69
- }
70
- async function sniffWavStream(source, signal, account) {
71
- const iterator = source[Symbol.asyncIterator](), prefix = new Uint8Array(12);
72
- let size = 0, total = 0, ended = false;
73
- let remainder = new Uint8Array(0);
74
- try {
75
- while (size < prefix.length) {
76
- signal.throwIfAborted();
77
- const next = await iterator.next();
78
- signal.throwIfAborted();
79
- if (next.done) {
80
- ended = true;
81
- break;
46
+ async add(span) {
47
+ let units = 0, kept = 0;
48
+ for await (const text of this.decoded(span.offset, span.length)) {
49
+ const zero = text.indexOf("\0"), part = zero < 0 ? text : text.slice(0, zero);
50
+ for (const unit of part) {
51
+ units += unit.length;
52
+ if (unit.trimEnd()) kept = units;
82
53
  }
83
- total += next.value.length;
84
- account(total);
85
- const take = Math.min(prefix.length - size, next.value.length);
86
- prefix.set(next.value.subarray(0, take), size);
87
- size += take;
88
- remainder = next.value.subarray(take);
54
+ if (zero >= 0) break;
89
55
  }
90
- } catch (error) {
91
- try {
92
- await iterator.return?.();
93
- } catch {
56
+ let key = 0n;
57
+ for (let i = 0; i < span.key.length; i++) key = key << (span.key.length > 4 ? 7n : 16n) | BigInt(span.key.charCodeAt(i));
58
+ if (span.key.length > 4) key |= 1n << 63n;
59
+ const existing = await this.keys.get(key);
60
+ const position = existing === void 0 ? this.storage.allocate(56) : Number(existing);
61
+ const bytes = existing === void 0 ? new Uint8Array(56) : await this.storage.read(position, 56);
62
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
63
+ view.setFloat64(8, span.offset, true);
64
+ view.setFloat64(16, span.length, true);
65
+ view.setFloat64(24, kept, true);
66
+ view.setUint16(32, span.key.length, true);
67
+ for (let i = 0; i < span.key.length; i++) view.setUint16(34 + i * 2, span.key.charCodeAt(i), true);
68
+ await this.storage.write(position, bytes);
69
+ if (existing !== void 0) return;
70
+ await this.keys.set(key, BigInt(position));
71
+ this.count++;
72
+ const numeric = Number(span.key);
73
+ if (Number.isInteger(numeric) && numeric >= 0 && numeric < 4294967295 && String(numeric) === span.key) await this.numeric.set(BigInt(numeric), BigInt(position));
74
+ else {
75
+ if (this.tail) {
76
+ const link = new Uint8Array(8);
77
+ new DataView(link.buffer).setFloat64(0, position, true);
78
+ await this.storage.write(this.tail, link);
79
+ } else this.head = position;
80
+ this.tail = position;
94
81
  }
95
- throw error;
96
82
  }
97
- async function* replay() {
98
- let failed = false;
99
- try {
100
- signal.throwIfAborted();
101
- if (size) yield prefix.subarray(0, size);
102
- if (remainder.length) yield remainder;
103
- remainder = new Uint8Array(0);
104
- while (!ended) {
105
- signal.throwIfAborted();
106
- const next = await iterator.next();
107
- signal.throwIfAborted();
108
- if (next.done) {
109
- ended = true;
110
- break;
111
- }
112
- total += next.value.length;
113
- account(total);
114
- yield next.value;
115
- }
116
- } catch (error) {
117
- failed = true;
118
- throw error;
119
- } finally {
120
- if (!ended) {
121
- if (failed) {
122
- try {
123
- await iterator.return?.();
124
- } catch {
125
- }
126
- } else await iterator.return?.();
83
+ async record(position) {
84
+ const bytes = await this.storage.read(position, 56), view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
85
+ let key = "";
86
+ for (let i = 0; i < view.getUint16(32, true); i++) key += String.fromCharCode(view.getUint16(34 + i * 2, true));
87
+ const offset = view.getFloat64(8, true), length = view.getFloat64(16, true), kept = view.getFloat64(24, true), decoded = this.decoded.bind(this);
88
+ return { key, next: view.getFloat64(0, true), async *text() {
89
+ let remaining = kept;
90
+ if (!remaining) return;
91
+ for await (const part of decoded(offset, length)) {
92
+ const take = Math.min(remaining, part.length);
93
+ if (take) yield part.slice(0, take);
94
+ remaining -= take;
95
+ if (!remaining) return;
127
96
  }
128
- }
97
+ } };
129
98
  }
130
- const text = new TextDecoder().decode(prefix);
131
- return { wav: size === 12 && text.slice(0, 4) === "RIFF" && text.slice(8) === "WAVE", stream: replay() };
132
- }
133
- async function withStagedProbeSource(context, input, probe2) {
134
- const storage = new PagedStorage2(context, 4);
135
- let start;
136
- let size = 0, steps = 0, failed = true;
137
- try {
138
- for await (const chunk of input) {
139
- context.signal.throwIfAborted();
140
- size += chunk.length;
141
- start ??= storage.allocate(0);
142
- await storage.append(chunk);
143
- if (++steps % 256 === 0) await yieldTurn2(context.signal);
99
+ async *entries() {
100
+ for await (const [, position] of this.numeric.entries()) yield await this.record(Number(position));
101
+ for (let position = this.head; position; ) {
102
+ const entry = await this.record(position);
103
+ position = entry.next;
104
+ yield entry;
144
105
  }
145
- context.signal.throwIfAborted();
146
- start ??= storage.allocate(0);
147
- const base = start;
148
- const result = await probe2({ size, read: (offset, length) => storage.read(base + offset, length) });
149
- context.signal.throwIfAborted();
150
- failed = false;
151
- return result;
152
- } finally {
153
- if (failed) {
154
- try {
155
- await storage.close();
156
- } catch {
157
- }
158
- } else await storage.close();
159
106
  }
160
- }
107
+ };
161
108
 
162
109
  // packages/safe-bash-command-ffprobe/src/probe.ts
163
110
  import { parseAudio } from "../../audio-ast/index.js";
@@ -221,8 +168,8 @@ function probe(data, args) {
221
168
  const parsed = parseArguments(args);
222
169
  return formatAudioProbe(parseAudio(data, { maxAtomDepth: 64 }), data.length, parsed);
223
170
  }
224
- function formatAudioProbe(audio, size, parsed) {
225
- const { sections, format, settings } = parsed;
171
+ function audioProbeRows(audio, size, parsed, retainedTags = false) {
172
+ const { sections } = parsed;
226
173
  const serials = [
227
174
  ...new Set(
228
175
  audio.nodes.filter((node) => node.type === "OggS").map((node) => node.fields?.serial)
@@ -285,11 +232,16 @@ function formatAudioProbe(audio, size, parsed) {
285
232
  duration: formatDuration.toFixed(6),
286
233
  size: String(size),
287
234
  bit_rate: String(formatDuration ? Math.floor(size * 8 / formatDuration) : 0),
288
- ...Object.keys(formatTags).length ? { tags: formatTags } : {}
235
+ ...retainedTags || Object.keys(formatTags).length ? { tags: formatTags } : {}
289
236
  });
290
237
  if (sections.has("format_tags")) row.tags = tags;
291
238
  rows.push({ section: "format", row });
292
239
  }
240
+ return rows;
241
+ }
242
+ function formatAudioProbe(audio, size, parsed) {
243
+ const { sections, format, settings } = parsed;
244
+ const rows = audioProbeRows(audio, size, parsed);
293
245
  if (format === "json") {
294
246
  const result = {};
295
247
  if (sections.has("stream") || sections.has("stream_tags"))
@@ -334,6 +286,320 @@ function formatAudioProbe(audio, size, parsed) {
334
286
  return lines.length ? lines.join("\n") + "\n" : "";
335
287
  }
336
288
 
289
+ // packages/safe-bash-command-ffprobe/src/tag-format.ts
290
+ async function* parts(value, prefix = "") {
291
+ if (prefix) yield prefix;
292
+ if (typeof value === "function") yield* value();
293
+ else yield String(value);
294
+ }
295
+ async function* jsonString(input) {
296
+ yield '"';
297
+ for await (const part of input) yield JSON.stringify(part).slice(1, -1);
298
+ yield '"';
299
+ }
300
+ async function* replace(input, needle, replacement) {
301
+ let pending = "", first = true;
302
+ if (!needle) {
303
+ for await (const part of input) {
304
+ let text = "";
305
+ for (let i = 0; i < part.length; i++) {
306
+ text += (first ? "" : replacement) + part[i];
307
+ first = false;
308
+ if (text.length >= 4096) {
309
+ yield text;
310
+ text = "";
311
+ }
312
+ }
313
+ if (text) yield text;
314
+ }
315
+ return;
316
+ }
317
+ for await (const part of input) {
318
+ const text = pending + part;
319
+ let at = 0, found, output = "";
320
+ while ((found = text.indexOf(needle, at)) >= 0) {
321
+ output += text.slice(at, found) + replacement;
322
+ at = found + needle.length;
323
+ if (output.length >= 16384) {
324
+ yield output;
325
+ output = "";
326
+ }
327
+ }
328
+ const end = Math.max(at, text.length - needle.length + 1);
329
+ output += text.slice(at, end);
330
+ if (output) yield output;
331
+ pending = text.slice(end);
332
+ }
333
+ if (pending) yield pending;
334
+ }
335
+ async function needsQuotes(input, separator) {
336
+ if (!separator) return true;
337
+ let tail = "";
338
+ for await (const part of input) {
339
+ const text = tail + part;
340
+ if (text.includes(separator) || text.includes('"') || text.includes("\n")) return true;
341
+ tail = text.slice(Math.max(0, text.length - separator.length + 1));
342
+ }
343
+ return false;
344
+ }
345
+ async function* formatTaggedAudio(audio, size, args, tags) {
346
+ const parsed = parseArguments(args), { sections, format, settings } = parsed;
347
+ const rows = audioProbeRows({ ...audio, nodes: [] }, size, parsed, tags.count > 0);
348
+ async function* tagFields(section) {
349
+ const selected = sections.get(section + "_tags");
350
+ for await (const entry of tags.entries()) if (selected === void 0 || selected.includes(entry.key)) yield { key: entry.key, value: entry.text };
351
+ }
352
+ async function* jsonRow(row, section, indent) {
353
+ yield "{";
354
+ let first = true;
355
+ for (const [key, value] of Object.entries(row)) {
356
+ yield (first ? "\n" : ",\n") + " ".repeat(indent + 4) + JSON.stringify(key) + ": ";
357
+ first = false;
358
+ if (typeof value === "object") {
359
+ yield "{";
360
+ let firstTag = true;
361
+ for await (const field of tagFields(section)) {
362
+ yield (firstTag ? "\n" : ",\n") + " ".repeat(indent + 8) + JSON.stringify(field.key) + ": ";
363
+ firstTag = false;
364
+ yield* jsonString(parts(field.value));
365
+ }
366
+ yield (firstTag ? "" : "\n" + " ".repeat(indent + 4)) + "}";
367
+ } else if (typeof value === "number") yield JSON.stringify(value);
368
+ else yield* jsonString(parts(value));
369
+ }
370
+ yield (first ? "" : "\n" + " ".repeat(indent)) + "}";
371
+ }
372
+ if (format === "json") {
373
+ yield "{";
374
+ let first = true;
375
+ if (sections.has("stream") || sections.has("stream_tags")) {
376
+ yield '\n "streams": [';
377
+ first = false;
378
+ let firstStream = true;
379
+ for (const { section, row } of rows) if (section === "stream") {
380
+ yield (firstStream ? "\n" : ",\n") + " ";
381
+ firstStream = false;
382
+ yield* jsonRow(row, section, 8);
383
+ }
384
+ yield (firstStream ? "" : "\n ") + "]";
385
+ }
386
+ for (const { section, row } of rows) if (section === "format") {
387
+ yield (first ? "\n" : ",\n") + ' "format": ';
388
+ first = false;
389
+ yield* jsonRow(row, section, 4);
390
+ }
391
+ yield (first ? "" : "\n") + "}\n";
392
+ return;
393
+ }
394
+ const enabled = (a, b, fallback) => {
395
+ const value = settings.get(a) ?? settings.get(b);
396
+ return value === void 0 ? fallback : value === "1";
397
+ };
398
+ let streamIndex = 0;
399
+ for (const { section, row } of rows) {
400
+ async function* fields() {
401
+ for (const [key, value] of Object.entries(row)) {
402
+ if (typeof value === "object") {
403
+ for await (const tag of tagFields(section)) yield { key: "tag:" + tag.key, value: tag.value };
404
+ } else yield { key, value };
405
+ }
406
+ }
407
+ if (format === "compact" || format === "csv") {
408
+ const separator = settings.get("item_sep") ?? settings.get("s") ?? (format === "csv" ? "," : "|");
409
+ let first = true;
410
+ if (enabled("print_section", "p", true)) {
411
+ yield section;
412
+ first = false;
413
+ }
414
+ for await (const field of fields()) {
415
+ if (!first) yield separator;
416
+ first = false;
417
+ const prefix = enabled("nokey", "nk", format === "csv") ? "" : field.key + "=";
418
+ if (format === "csv") {
419
+ const quote = await needsQuotes(parts(field.value, prefix), separator);
420
+ if (quote) yield '"';
421
+ yield* quote ? replace(parts(field.value, prefix), '"', '""') : parts(field.value, prefix);
422
+ if (quote) yield '"';
423
+ } else yield* replace(replace(replace(replace(parts(field.value, prefix), "\\", "\\\\"), "\n", "\\n"), "\r", "\\r"), separator, "\\" + separator);
424
+ }
425
+ yield "\n";
426
+ } else if (format === "flat") {
427
+ const prefix = section === "stream" ? `streams.stream.${streamIndex++}` : "format";
428
+ for await (const field of fields()) {
429
+ yield prefix + "." + (field.key.startsWith("tag:") ? "tags." + field.key.slice(4) : field.key) + "=";
430
+ if (typeof field.value === "number") yield String(field.value);
431
+ else yield* jsonString(parts(field.value));
432
+ yield "\n";
433
+ }
434
+ } else {
435
+ if (!enabled("noprint_wrappers", "nw", false)) yield "[" + section.toUpperCase() + "]\n";
436
+ for await (const field of fields()) {
437
+ if (!enabled("nokey", "nk", false)) yield (field.key.startsWith("tag:") ? "TAG:" + field.key.slice(4) : field.key) + "=";
438
+ yield* parts(field.value);
439
+ yield "\n";
440
+ }
441
+ if (!enabled("noprint_wrappers", "nw", false)) yield "[/" + section.toUpperCase() + "]\n";
442
+ }
443
+ }
444
+ }
445
+
446
+ // packages/safe-bash-command-ffprobe/src/probe-output.ts
447
+ import { PagedStorage as PagedStorage2 } from "@poe-platform/safe-fs/storage";
448
+ import { writeBytes } from "../../safe-bash-contracts/io.js";
449
+ import { yieldTurn as yieldTurn2 } from "../../safe-bash-contracts/yield.js";
450
+ async function* encodeParts(parts2, signal) {
451
+ const encoder = new TextEncoder();
452
+ let high = "", steps = 0;
453
+ for await (const part of parts2) {
454
+ signal.throwIfAborted();
455
+ for (let offset = 0; offset < part.length; offset += 4096) {
456
+ signal.throwIfAborted();
457
+ let text = high + part.slice(offset, offset + 4096);
458
+ high = "";
459
+ const last = text.charCodeAt(text.length - 1);
460
+ if (last >= 55296 && last <= 56319) {
461
+ high = text.at(-1);
462
+ text = text.slice(0, -1);
463
+ }
464
+ if (text) yield encoder.encode(text);
465
+ if (++steps % 256 === 0) await yieldTurn2(signal);
466
+ }
467
+ }
468
+ if (high) yield encoder.encode(high);
469
+ }
470
+ async function writeProbeOutput(context, parts2, check, beforePublish) {
471
+ const storage = new PagedStorage2(context, 4), start = storage.allocate(0);
472
+ let size = 0, failed = true;
473
+ try {
474
+ for await (const bytes of encodeParts(parts2, context.signal)) {
475
+ size += bytes.length;
476
+ check(size);
477
+ await storage.append(bytes);
478
+ }
479
+ context.signal.throwIfAborted();
480
+ await beforePublish?.();
481
+ context.signal.throwIfAborted();
482
+ if (size === 0) await writeBytes(context.stdout, new Uint8Array(0), context.signal);
483
+ for (let offset = 0; offset < size; offset += 16384)
484
+ await writeBytes(context.stdout, await storage.read(start + offset, Math.min(16384, size - offset)), context.signal);
485
+ failed = false;
486
+ } finally {
487
+ if (failed) {
488
+ try {
489
+ await storage.close();
490
+ } catch {
491
+ }
492
+ } else await storage.close();
493
+ }
494
+ }
495
+
496
+ // packages/safe-bash-command-ffprobe/src/stream-input.ts
497
+ import { PagedStorage as PagedStorage3 } from "@poe-platform/safe-fs/storage";
498
+ import { readBytes } from "../../safe-bash-contracts/io.js";
499
+ import { readFileStream } from "../../safe-bash-contracts/filesystem.js";
500
+ import { yieldTurn as yieldTurn3 } from "../../safe-bash-contracts/yield.js";
501
+ async function openProbeStream(context, path) {
502
+ context.signal.throwIfAborted();
503
+ if (path === void 0) return readBytes(context.stdin, context.signal);
504
+ const capabilities = await context.fs.capabilitiesFor?.(path, { signal: context.signal }) ?? context.fs.capabilities;
505
+ context.signal.throwIfAborted();
506
+ if (!context.fs.readStream || capabilities.streamingRead === false || context.fs.capabilities.streamingRead === false) return void 0;
507
+ return readFileStream(context.fs, path, { signal: context.signal, chunkSize: 16384 });
508
+ }
509
+ async function sniffMediaStream(source, signal, account) {
510
+ const iterator = source[Symbol.asyncIterator](), prefix = new Uint8Array(12);
511
+ let size = 0, total = 0, ended = false;
512
+ let remainder = new Uint8Array(0);
513
+ try {
514
+ while (size < prefix.length) {
515
+ signal.throwIfAborted();
516
+ const next = await iterator.next();
517
+ signal.throwIfAborted();
518
+ if (next.done) {
519
+ ended = true;
520
+ break;
521
+ }
522
+ total += next.value.length;
523
+ account(total);
524
+ const take = Math.min(prefix.length - size, next.value.length);
525
+ prefix.set(next.value.subarray(0, take), size);
526
+ size += take;
527
+ remainder = next.value.subarray(take);
528
+ }
529
+ } catch (error) {
530
+ try {
531
+ await iterator.return?.();
532
+ } catch {
533
+ }
534
+ throw error;
535
+ }
536
+ async function* replay() {
537
+ let failed = false;
538
+ try {
539
+ signal.throwIfAborted();
540
+ if (size) yield prefix.subarray(0, size);
541
+ if (remainder.length) yield remainder;
542
+ remainder = new Uint8Array(0);
543
+ while (!ended) {
544
+ signal.throwIfAborted();
545
+ const next = await iterator.next();
546
+ signal.throwIfAborted();
547
+ if (next.done) {
548
+ ended = true;
549
+ break;
550
+ }
551
+ total += next.value.length;
552
+ account(total);
553
+ yield next.value;
554
+ }
555
+ } catch (error) {
556
+ failed = true;
557
+ throw error;
558
+ } finally {
559
+ if (!ended) {
560
+ if (failed) {
561
+ try {
562
+ await iterator.return?.();
563
+ } catch {
564
+ }
565
+ } else await iterator.return?.();
566
+ }
567
+ }
568
+ }
569
+ return { prefix: prefix.subarray(0, size), stream: replay() };
570
+ }
571
+ async function withStagedProbeSource(context, input, probe2, retain) {
572
+ const storage = new PagedStorage3(context, 4);
573
+ retain?.(storage.close.bind(storage));
574
+ let start;
575
+ let size = 0, steps = 0, failed = true;
576
+ try {
577
+ for await (const chunk of input) {
578
+ context.signal.throwIfAborted();
579
+ size += chunk.length;
580
+ start ??= storage.allocate(0);
581
+ await storage.append(chunk);
582
+ if (++steps % 256 === 0) await yieldTurn3(context.signal);
583
+ }
584
+ context.signal.throwIfAborted();
585
+ start ??= storage.allocate(0);
586
+ const base = start;
587
+ const result = await probe2({ size, read: (offset, length) => storage.read(base + offset, length) });
588
+ context.signal.throwIfAborted();
589
+ failed = false;
590
+ return result;
591
+ } finally {
592
+ if (!retain) {
593
+ if (failed) {
594
+ try {
595
+ await storage.close();
596
+ } catch {
597
+ }
598
+ } else await storage.close();
599
+ }
600
+ }
601
+ }
602
+
337
603
  // packages/safe-bash-command-ffprobe/src/media.ts
338
604
  import { probeWavSource } from "../../audio-ast/index.js";
339
605
  import { commandRuntimeIdentity, getCommandArguments } from "../../safe-bash-contracts/command.js";
@@ -411,9 +677,9 @@ function resolvePath(cwd, p) {
411
677
  return normalizePath(`${cwd.endsWith("/") ? cwd : `${cwd}/`}${p}`);
412
678
  }
413
679
  function normalizePath(p) {
414
- const parts = p.split("/");
680
+ const parts2 = p.split("/");
415
681
  const stack = [];
416
- for (const part of parts) {
682
+ for (const part of parts2) {
417
683
  if (!part || part === ".") continue;
418
684
  if (part === "..") {
419
685
  stack.pop();
@@ -840,7 +1106,7 @@ function parseProbeArguments(args) {
840
1106
  inputTarget
841
1107
  };
842
1108
  }
843
- async function probeSourceMetadata(context, plugin, input, filename, budget, records, onAudio) {
1109
+ async function probeSourceMetadata(context, plugins, input, filename, budget, records, onAudio, retain, detect = false) {
844
1110
  let sourceFailed = false;
845
1111
  const source = { size: input.size, async read(offset, length) {
846
1112
  try {
@@ -852,21 +1118,26 @@ async function probeSourceMetadata(context, plugin, input, filename, budget, rec
852
1118
  throw error;
853
1119
  }
854
1120
  } };
855
- if (onAudio) {
856
- if (input.size < 12) {
857
- return void 0;
858
- }
859
- const header = await source.read(0, 12);
1121
+ let plugin = plugins[0];
1122
+ if (detect) {
1123
+ const header = await source.read(0, Math.min(12, input.size));
860
1124
  context.signal.throwIfAborted();
861
- const text = new TextDecoder().decode(header);
862
- if (text.slice(0, 4) !== "RIFF" || text.slice(8) !== "WAVE") {
863
- return void 0;
864
- }
1125
+ plugin = plugins.find((candidate) => candidate.detect(header, filename));
865
1126
  }
1127
+ if (!plugin) return void 0;
866
1128
  const result = await plugin.probeMetadata(source, { ...records, filename, signal: context.signal, budget, limits: budget.limits });
867
1129
  if (onAudio) {
1130
+ const tags = new WavTags(source, context);
1131
+ retain(tags.close);
868
1132
  try {
869
- onAudio(await probeWavSource(source, { signal: context.signal }), input.size);
1133
+ onAudio(await probeWavSource(source, { signal: context.signal, onTag: async (span) => {
1134
+ try {
1135
+ await tags.add(span);
1136
+ } catch (error) {
1137
+ sourceFailed = true;
1138
+ throw error;
1139
+ }
1140
+ } }), input.size, tags);
870
1141
  } catch (error) {
871
1142
  context.signal.throwIfAborted();
872
1143
  if (sourceFailed) throw error;
@@ -874,13 +1145,14 @@ async function probeSourceMetadata(context, plugin, input, filename, budget, rec
874
1145
  }
875
1146
  return result;
876
1147
  }
877
- async function probeRetainedMetadata(context, plugin, path, filename, budget, records, onAudio) {
878
- if (!plugin.canDemux || !plugin.probeMetadata || !context.fs.openReadFile) return void 0;
1148
+ async function probeRetainedMetadata(context, plugins, path, filename, budget, records, onAudio, retain, detect = false) {
1149
+ if (!plugins.length || !context.fs.openReadFile) return void 0;
879
1150
  context.signal.throwIfAborted();
880
1151
  const capabilities = await context.fs.capabilitiesFor?.(path, { signal: context.signal }) ?? context.fs.capabilities;
881
1152
  context.signal.throwIfAborted();
882
1153
  if (capabilities.retainedRead !== true) return void 0;
883
1154
  const handle = await context.fs.openReadFile(path, { signal: context.signal });
1155
+ if (onAudio) retain(handle.close.bind(handle));
884
1156
  let failed = true;
885
1157
  try {
886
1158
  context.signal.throwIfAborted();
@@ -889,20 +1161,22 @@ async function probeRetainedMetadata(context, plugin, path, filename, budget, re
889
1161
  if (!Number.isSafeInteger(stat.size) || stat.size < 0) throw new Error("Invalid media source size");
890
1162
  context.inputBudget?.check(stat.size);
891
1163
  budget.checkInputBytes(stat.size);
892
- const result = await probeSourceMetadata(context, plugin, {
1164
+ const result = await probeSourceMetadata(context, plugins, {
893
1165
  size: stat.size,
894
1166
  read: (offset, length) => handle.read(offset, length, { signal: context.signal })
895
- }, filename, budget, records, onAudio);
1167
+ }, filename, budget, records, onAudio, retain, detect);
896
1168
  context.signal.throwIfAborted();
897
1169
  failed = false;
898
1170
  return result;
899
1171
  } finally {
900
- if (failed) {
901
- try {
902
- await handle.close();
903
- } catch {
904
- }
905
- } else await handle.close();
1172
+ if (!onAudio) {
1173
+ if (failed) {
1174
+ try {
1175
+ await handle.close();
1176
+ } catch {
1177
+ }
1178
+ } else await handle.close();
1179
+ }
906
1180
  }
907
1181
  }
908
1182
  async function probeStreamMetadata(context, plugin, filename, budget, records) {
@@ -926,10 +1200,7 @@ async function probeStreamMetadata(context, plugin, filename, budget, records) {
926
1200
  return result;
927
1201
  }
928
1202
  function createFfprobeCommand(options = {}) {
929
- const limits = { maxInputBytes: 32 * 1024 * 1024, maxOutputBytes: 1024 * 1024, ...options.limits };
930
- for (const value of [limits.maxInputBytes, limits.maxOutputBytes]) {
931
- if (value !== void 0 && (!Number.isSafeInteger(value) || value < 1)) throw new RangeError("Invalid ffprobe limit");
932
- }
1203
+ const limits = resolveFfprobeLimits(options.limits);
933
1204
  const astPlugins = options.asts ?? getDefaultMediaRegistry().astPlugins;
934
1205
  const registry = options.asts ? createMediaAstRegistry(astPlugins) : getDefaultMediaRegistry().registry;
935
1206
  return {
@@ -967,6 +1238,25 @@ function createFfprobeCommand(options = {}) {
967
1238
  return { exitCode: 0 };
968
1239
  }
969
1240
  }
1241
+ const retained = [];
1242
+ const retain = (close) => {
1243
+ retained.push(close);
1244
+ };
1245
+ const closeInputs = async () => {
1246
+ let failure, failed = false;
1247
+ while (retained.length) {
1248
+ try {
1249
+ await retained.pop()();
1250
+ } catch (error) {
1251
+ if (!failed) {
1252
+ failed = true;
1253
+ failure = error;
1254
+ }
1255
+ }
1256
+ }
1257
+ if (failed) throw failure;
1258
+ };
1259
+ let storedTags;
970
1260
  try {
971
1261
  const {
972
1262
  printFormat,
@@ -992,26 +1282,41 @@ function createFfprobeCommand(options = {}) {
992
1282
  automaticAudio = false;
993
1283
  }
994
1284
  }
995
- const automaticPlugin = automaticAudio ? registry.findByFormatName("wav") : void 0;
1285
+ const automaticPlugins = !options.asts && !explicitFormat ? astPlugins.filter((plugin) => plugin.canDemux && plugin.probeMetadata && (!automaticAudio || plugin === registry.findByFormatName("wav"))) : [];
996
1286
  const explicitPlugin = explicitFormat ? registry.findByFormatName(explicitFormat) : void 0;
997
- const retainedPlugin = explicitPlugin ?? automaticPlugin;
998
- let probeResult = retainedPlugin && !isStdin(inputTarget) ? await probeRetainedMetadata(context, retainedPlugin, resolvePath(context.cwd, inputTarget), inputTarget, budget, { showPackets, showFrames }, automaticAudio ? (audio, size) => {
1287
+ const retainedPlugins = explicitPlugin ? explicitPlugin.canDemux && explicitPlugin.probeMetadata ? [explicitPlugin] : [] : automaticPlugins;
1288
+ let probeResult = retainedPlugins.length && !isStdin(inputTarget) ? await probeRetainedMetadata(context, retainedPlugins, resolvePath(context.cwd, inputTarget), inputTarget, budget, { showPackets, showFrames }, automaticAudio ? (audio, size, tags) => {
999
1289
  audioInput = { audio, size, args };
1000
- } : void 0) : void 0;
1290
+ storedTags = tags;
1291
+ } : void 0, retain, !explicitPlugin) : void 0;
1001
1292
  if (!probeResult && explicitPlugin)
1002
1293
  probeResult = await probeStreamMetadata(context, explicitPlugin, inputTarget, budget, { showPackets, showFrames });
1003
1294
  let replay;
1004
- if (!probeResult && automaticPlugin?.probeMetadata) {
1295
+ if (!probeResult && automaticPlugins.length) {
1005
1296
  const source = await openProbeStream(context, isStdin(inputTarget) ? void 0 : resolvePath(context.cwd, inputTarget));
1006
1297
  if (source) {
1007
- const sniffed = await sniffWavStream(source, context.signal, (total) => {
1298
+ const sniffed = await sniffMediaStream(source, context.signal, (total) => {
1008
1299
  context.inputBudget?.check(total);
1009
1300
  budget.checkInputBytes(total);
1010
1301
  });
1011
- if (sniffed.wav) {
1012
- probeResult = await withStagedProbeSource(context, sniffed.stream, (source2) => probeSourceMetadata(context, automaticPlugin, source2, inputTarget, budget, { showPackets, showFrames }, (audio, size) => {
1013
- audioInput = { audio, size, args };
1014
- }));
1302
+ const automaticPlugin = automaticPlugins.find((plugin) => plugin.detect(sniffed.prefix, inputTarget));
1303
+ if (automaticPlugin) {
1304
+ if (!automaticAudio && automaticPlugin.probeMetadataStream) {
1305
+ probeResult = await automaticPlugin.probeMetadataStream(sniffed.stream, {
1306
+ showPackets,
1307
+ showFrames,
1308
+ filename: inputTarget,
1309
+ signal: context.signal,
1310
+ budget,
1311
+ limits: budget.limits
1312
+ });
1313
+ context.signal.throwIfAborted();
1314
+ } else {
1315
+ probeResult = await withStagedProbeSource(context, sniffed.stream, (source2) => probeSourceMetadata(context, [automaticPlugin], source2, inputTarget, budget, { showPackets, showFrames }, automaticAudio ? (audio, size, tags) => {
1316
+ audioInput = { audio, size, args };
1317
+ storedTags = tags;
1318
+ } : void 0, retain), retain);
1319
+ }
1015
1320
  } else replay = sniffed.stream;
1016
1321
  }
1017
1322
  }
@@ -1022,6 +1327,7 @@ function createFfprobeCommand(options = {}) {
1022
1327
  const msg = explicitFormat ? `ffprobe: Unknown input format: '${explicitFormat}' (AST not registered)
1023
1328
  ` : `ffprobe: ${inputTarget}: Invalid data found when processing input or format AST not registered
1024
1329
  `;
1330
+ await closeInputs();
1025
1331
  if (!quiet) await writeBytes2(context.stderr, encodeUtf8(msg), context.signal);
1026
1332
  return { exitCode: 1 };
1027
1333
  }
@@ -1036,7 +1342,7 @@ function createFfprobeCommand(options = {}) {
1036
1342
  });
1037
1343
  if (!options.asts && !explicitFormat) audioInput = { bytes, args };
1038
1344
  }
1039
- const formatted = formatFfprobeResultChunks(probeResult, {
1345
+ const formatted = storedTags && audioInput && "audio" in audioInput ? formatTaggedAudio(audioInput.audio, audioInput.size, audioInput.args, storedTags) : formatFfprobeResultChunks(probeResult, {
1040
1346
  printFormat,
1041
1347
  showFormat,
1042
1348
  showStreams,
@@ -1049,10 +1355,14 @@ function createFfprobeCommand(options = {}) {
1049
1355
  countFrames,
1050
1356
  countPackets
1051
1357
  }, audioInput);
1052
- await writeProbeOutput(context, formatted, (total) => budget.checkOutputBytes(total));
1358
+ await writeProbeOutput(context, formatted, (total) => budget.checkOutputBytes(total), closeInputs);
1053
1359
  options.onMetrics?.(budget.getStats());
1054
1360
  return { exitCode: 0 };
1055
1361
  } catch (err) {
1362
+ try {
1363
+ await closeInputs();
1364
+ } catch {
1365
+ }
1056
1366
  rethrowRuntimeError(context, err);
1057
1367
  const msg = err instanceof Error ? err.message : String(err);
1058
1368
  if (!quiet)