@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
@@ -0,0 +1,13 @@
1
+ import type { AudioProbeSource } from "./wav-source.js";
2
+ import type { AudioAst } from "./types.js";
3
+ /** UTF-8 comment bytes; block identity preserves replacement across comment blocks. */
4
+ export interface FlacCommentSpan {
5
+ readonly block: number;
6
+ readonly offset: number;
7
+ readonly length: number;
8
+ }
9
+ /** Strict FLAC validation without AST/picture/frame models. onComment avoids collecting tag strings. */
10
+ export declare function probeFlacSource(source: AudioProbeSource, options?: {
11
+ signal?: AbortSignal;
12
+ onComment?: (span: FlacCommentSpan) => Promise<void>;
13
+ }): Promise<Omit<AudioAst, "data" | "nodes" | "pictures">>;
@@ -1,4 +1,5 @@
1
- export { probeWavSource, type AudioProbeSource } from "./wav-source.js";
1
+ export { probeFlacSource, type FlacCommentSpan } from "./flac-source.js";
2
+ export { probeWavSource, type AudioProbeSource, type WavTagSpan } from "./wav-source.js";
2
3
  export * from "./types.js";
3
4
  export { decodePcm, encodeWav } from "./wav.js";
4
5
  export * from "./dsp.js";
@@ -74,6 +74,249 @@ function duration(samples, sampleRate) {
74
74
  return samples / sampleRate;
75
75
  }
76
76
 
77
+ // packages/audio-ast/src/vorbis.ts
78
+ var names = {
79
+ TITLE: "title",
80
+ ARTIST: "artist",
81
+ ALBUM: "album",
82
+ ALBUMARTIST: "albumArtist",
83
+ TRACKNUMBER: "track",
84
+ DISCNUMBER: "disc",
85
+ DATE: "date",
86
+ GENRE: "genre",
87
+ COMMENT: "comment",
88
+ DESCRIPTION: "comment",
89
+ ENCODER: "encoder",
90
+ COPYRIGHT: "copyright"
91
+ };
92
+ function parseComments(bytes) {
93
+ const r = new Reader(bytes), vendorSize = r.u32(0, true), vendor = new TextDecoder().decode(r.slice(4, vendorSize));
94
+ let offset = 4 + vendorSize;
95
+ const count = r.u32(offset, true);
96
+ offset += 4;
97
+ if (count > (bytes.length - offset) / 4) throw new Error("Invalid Vorbis comment count");
98
+ const tags = {}, comments = [];
99
+ for (let i = 0; i < count; i++) {
100
+ const size = r.u32(offset, true);
101
+ offset += 4;
102
+ const value = new TextDecoder().decode(r.slice(offset, size));
103
+ offset += size;
104
+ comments.push(value);
105
+ addVorbisComment(tags, value);
106
+ }
107
+ return { tags, vendor, comments, size: offset };
108
+ }
109
+ function encodeComments(tags, vendor = "poe-code/audio-ast") {
110
+ const encoder = new TextEncoder(), v = encoder.encode(vendor), comments = [];
111
+ for (const [name, value] of Object.entries(tags)) {
112
+ const key = Object.keys(names).find((key2) => names[key2] === name) ?? name.toUpperCase();
113
+ if (key.includes("=") || Array.from(key).some((c) => c.charCodeAt(0) < 32 || c.charCodeAt(0) > 125))
114
+ throw new Error("Invalid Vorbis comment key");
115
+ for (const part of value.split("\n")) {
116
+ const bytes = encoder.encode(`${key}=${part}`);
117
+ comments.push(join([uint32(bytes.length, true), bytes]));
118
+ }
119
+ }
120
+ return join([uint32(v.length, true), v, uint32(comments.length, true), ...comments]);
121
+ }
122
+ function parsePicture(bytes) {
123
+ const r = new Reader(bytes), type = r.u32(0), mimeSize = r.u32(4), mime = r.text(8, mimeSize);
124
+ let offset = 8 + mimeSize;
125
+ const descriptionSize = r.u32(offset);
126
+ offset += 4;
127
+ const description = new TextDecoder().decode(r.slice(offset, descriptionSize));
128
+ offset += descriptionSize;
129
+ const width = r.u32(offset), height = r.u32(offset + 4), depth = r.u32(offset + 8), colors = r.u32(offset + 12), size = r.u32(offset + 16);
130
+ offset += 20;
131
+ const data = r.slice(offset, size);
132
+ if (offset + size !== bytes.length) throw new Error("Trailing FLAC picture bytes");
133
+ return { type, mime, description, width, height, depth, colors, data };
134
+ }
135
+ function encodePicture(p) {
136
+ const description = new TextEncoder().encode(p.description), mime = ascii(p.mime);
137
+ return join([
138
+ uint32(p.type),
139
+ uint32(mime.length),
140
+ mime,
141
+ uint32(description.length),
142
+ description,
143
+ uint32(p.width ?? 0),
144
+ uint32(p.height ?? 0),
145
+ uint32(p.depth ?? 0),
146
+ uint32(p.colors ?? 0),
147
+ uint32(p.data.length),
148
+ p.data
149
+ ]);
150
+ }
151
+ function pictureBase64(picture) {
152
+ const bytes = encodePicture(picture);
153
+ let binary = "";
154
+ for (let i = 0; i < bytes.length; i += 8192)
155
+ binary += String.fromCharCode(...bytes.subarray(i, i + 8192));
156
+ return btoa(binary);
157
+ }
158
+ function addVorbisComment(tags, value) {
159
+ const split = value.indexOf("=");
160
+ if (split > 0) {
161
+ const key = value.slice(0, split).toUpperCase(), name = names[key] ?? key;
162
+ tags[name] = tags[name] ? `${tags[name]}
163
+ ${value.slice(split + 1)}` : value.slice(split + 1);
164
+ }
165
+ }
166
+
167
+ // packages/audio-ast/src/flac.ts
168
+ function parseFlac(bytes) {
169
+ const r = new Reader(bytes), nodes = [], pictures = [];
170
+ const tags = {};
171
+ let offset = 4, last = false, stream;
172
+ while (!last) {
173
+ const header = r.u8(offset), type = header & 127, size = r.u24(offset + 1);
174
+ last = !!(header & 128);
175
+ const data = r.slice(offset + 4, size), node = {
176
+ type: [
177
+ "STREAMINFO",
178
+ "PADDING",
179
+ "APPLICATION",
180
+ "SEEKTABLE",
181
+ "VORBIS_COMMENT",
182
+ "CUESHEET",
183
+ "PICTURE"
184
+ ][type] ?? `BLOCK_${type}`,
185
+ offset,
186
+ size: size + 4,
187
+ data
188
+ };
189
+ nodes.push(node);
190
+ const block = new Reader(data);
191
+ if (type === 0) {
192
+ if (stream || offset !== 4 || size !== 34)
193
+ throw new Error("FLAC requires first unique STREAMINFO");
194
+ stream = flacStream(block, bytes.length);
195
+ const { sampleRate, channels, bitsPerSample, samples } = stream;
196
+ node.fields = {
197
+ minBlockSize: block.u16(0),
198
+ maxBlockSize: block.u16(2),
199
+ minFrameSize: block.u24(4),
200
+ maxFrameSize: block.u24(7),
201
+ sampleRate,
202
+ channels,
203
+ bitsPerSample,
204
+ totalSamples: samples,
205
+ md5: Array.from(block.slice(18, 16), (b) => b.toString(16).padStart(2, "0")).join("")
206
+ };
207
+ } else if (type === 4) {
208
+ const parsed = parseComments(data);
209
+ if (parsed.size !== size) throw new Error("Trailing Vorbis comment bytes");
210
+ Object.assign(tags, parsed.tags);
211
+ node.fields = { vendor: parsed.vendor, comments: parsed.comments };
212
+ } else if (type === 6) pictures.push(parsePicture(data));
213
+ else if (type === 3) {
214
+ if (size % 18) throw new Error("Invalid FLAC seek table");
215
+ const points = [];
216
+ for (let pos = 0; pos < size; pos += 18)
217
+ points.push({
218
+ sample: block.u64(pos),
219
+ offset: block.u64(pos + 8),
220
+ samples: block.u16(pos + 16)
221
+ });
222
+ node.fields = { points };
223
+ } else if (type === 127) throw new Error("Invalid FLAC metadata block");
224
+ offset += 4 + size;
225
+ }
226
+ if (!stream) throw new Error("Missing FLAC STREAMINFO");
227
+ if (offset < bytes.length)
228
+ nodes.push({
229
+ type: "FRAMES",
230
+ offset,
231
+ size: bytes.length - offset,
232
+ data: r.slice(offset, bytes.length - offset)
233
+ });
234
+ return {
235
+ format: "flac",
236
+ data: bytes,
237
+ nodes,
238
+ tags,
239
+ pictures,
240
+ streams: [stream],
241
+ duration: stream.duration,
242
+ bitrate: stream.bitrate
243
+ };
244
+ }
245
+ function flacStream(block, byteLength) {
246
+ const packed = block.u64(10), sampleRate = Number(packed >> 44n), channels = Number(packed >> 41n & 7n) + 1, bitsPerSample = Number(packed >> 36n & 31n) + 1, samples = Number(packed & 0xfffffffffn), seconds2 = duration(samples, sampleRate);
247
+ return { codec: "flac", sampleRate, channels, bitsPerSample, samples, duration: seconds2, bitrate: seconds2 ? byteLength * 8 / seconds2 : 0 };
248
+ }
249
+
250
+ // packages/audio-ast/src/flac-source.ts
251
+ async function probeFlacSource(source, options = {}) {
252
+ const check = (offset2, length, end = source.size) => {
253
+ options.signal?.throwIfAborted();
254
+ if (!Number.isSafeInteger(source.size) || !Number.isSafeInteger(offset2) || !Number.isSafeInteger(length) || offset2 < 0 || length < 0 || length > end - offset2)
255
+ throw new Error("Truncated or invalid audio structure");
256
+ };
257
+ const read = async (offset2, length, end = source.size) => {
258
+ check(offset2, length, end);
259
+ const bytes = await source.read(offset2, length);
260
+ options.signal?.throwIfAborted();
261
+ if (bytes.length !== length) throw new Error("Truncated or invalid audio structure");
262
+ return new Reader(bytes);
263
+ };
264
+ if ((await read(0, 4)).text(0, 4) !== "fLaC") throw new Error("Expected FLAC signature");
265
+ let offset = 4, last = false, stream;
266
+ const tags = {};
267
+ while (!last) {
268
+ const header = await read(offset, 4), type = header.u8(0) & 127, length = header.u24(1), start = offset + 4, end = start + length;
269
+ last = !!(header.u8(0) & 128);
270
+ check(start, length);
271
+ if (type === 0) {
272
+ if (stream || offset !== 4 || length !== 34) throw new Error("FLAC requires first unique STREAMINFO");
273
+ stream = flacStream(await read(start, 34, end), source.size);
274
+ } else if (type === 4) {
275
+ const vendorLength = (await read(start, 4, end)).u32(0, true);
276
+ check(start + 4, vendorLength, end);
277
+ let pos = start + 4 + vendorLength;
278
+ const count = (await read(pos, 4, end)).u32(0, true);
279
+ pos += 4;
280
+ if (count > (end - pos) / 4) throw new Error("Invalid Vorbis comment count");
281
+ const blockTags = {};
282
+ for (let i = 0; i < count; i++) {
283
+ const size = (await read(pos, 4, end)).u32(0, true);
284
+ pos += 4;
285
+ check(pos, size, end);
286
+ if (options.onComment) {
287
+ await options.onComment({ block: offset, offset: pos, length: size });
288
+ options.signal?.throwIfAborted();
289
+ } else {
290
+ const decoder = new TextDecoder();
291
+ let text2 = "";
292
+ for (let at = 0; at < size; at += 16384) text2 += decoder.decode((await read(pos + at, Math.min(16384, size - at), end)).bytes, { stream: true });
293
+ addVorbisComment(blockTags, text2 + decoder.decode());
294
+ }
295
+ pos += size;
296
+ }
297
+ if (pos !== end) throw new Error("Trailing Vorbis comment bytes");
298
+ Object.assign(tags, blockTags);
299
+ } else if (type === 6) {
300
+ const prefix = await read(start, 8, end), mimeLength = prefix.u32(4);
301
+ check(start + 8, mimeLength, end);
302
+ let pos = start + 8 + mimeLength;
303
+ const descriptionLength = (await read(pos, 4, end)).u32(0);
304
+ pos += 4;
305
+ check(pos, descriptionLength, end);
306
+ pos += descriptionLength;
307
+ const size = (await read(pos, 20, end)).u32(16);
308
+ pos += 20;
309
+ check(pos, size, end);
310
+ if (pos + size !== end) throw new Error("Trailing FLAC picture bytes");
311
+ } else if (type === 3 && length % 18) throw new Error("Invalid FLAC seek table");
312
+ else if (type === 127) throw new Error("Invalid FLAC metadata block");
313
+ offset = end;
314
+ }
315
+ if (!stream) throw new Error("Missing FLAC STREAMINFO");
316
+ options.signal?.throwIfAborted();
317
+ return { format: "flac", streams: [stream], tags, duration: stream.duration, bitrate: stream.bitrate };
318
+ }
319
+
77
320
  // packages/audio-ast/src/wav.ts
78
321
  var infoNames = {
79
322
  INAM: "title",
@@ -328,6 +571,12 @@ async function probeWavSource(source, options = {}) {
328
571
  for (let pos = start + 4; pos < start + size; ) {
329
572
  const info = await read(pos, 8), id = info.text(0, 4), length = info.u32(4, true);
330
573
  if (length > start + size - pos - 8) throw new Error("WAV INFO exceeds LIST bounds");
574
+ if (options.onTag) {
575
+ await options.onTag({ key: infoNames[id] ?? id, offset: pos + 8, length });
576
+ options.signal?.throwIfAborted();
577
+ pos += 8 + length + length % 2;
578
+ continue;
579
+ }
331
580
  const decoder = new TextDecoder();
332
581
  let text2 = "", ended = false;
333
582
  for (let index = 0; index < length; index += 16384) {
@@ -537,7 +786,7 @@ function transformAudio(pcm, effects) {
537
786
  }
538
787
 
539
788
  // packages/audio-ast/src/id3.ts
540
- var names = {
789
+ var names2 = {
541
790
  TIT2: "title",
542
791
  TPE1: "artist",
543
792
  TPE2: "albumArtist",
@@ -630,7 +879,7 @@ function parseId3(bytes) {
630
879
  if (version === 4 && frameFlags & 1) prefix += 4;
631
880
  data = data.subarray(prefix);
632
881
  if (id.startsWith("T") && id !== "TXXX" && id !== "TXX")
633
- tags[names[id] ?? id] = text(data.subarray(1), data[0]);
882
+ tags[names2[id] ?? id] = text(data.subarray(1), data[0]);
634
883
  else if (id === "COMM" || id === "COM") {
635
884
  const encoding = data[0], end = terminated(data, 4, encoding), width = encoding === 1 || encoding === 2 ? 2 : 1;
636
885
  tags.comment = text(data.subarray(end + width), encoding);
@@ -670,13 +919,13 @@ function encodeId3(tags, retained = [], pictures = []) {
670
919
  if (flags & (node.fields?.version === 3 ? 192 : 12)) {
671
920
  throw new Error(`Cannot safely rewrite transformed ID3 frame ${node.type}`);
672
921
  }
673
- if (node.type === "APIC" || node.type === "PIC" || names[node.type] || node.type.startsWith("T") && node.type !== "TXXX" && node.type !== "TXX" || node.type === "COMM" || node.type === "COM")
922
+ if (node.type === "APIC" || node.type === "PIC" || names2[node.type] || node.type.startsWith("T") && node.type !== "TXXX" && node.type !== "TXX" || node.type === "COMM" || node.type === "COM")
674
923
  continue;
675
924
  if (node.type.length === 4 && !node.fields?.flags) frame(node.type, node.data);
676
925
  else throw new Error(`Cannot safely rewrite ID3 frame ${node.type}`);
677
926
  }
678
927
  for (const [name, value] of Object.entries(tags)) {
679
- const id = Object.keys(names).find((key) => key.length === 4 && names[key] === name) ?? name;
928
+ const id = Object.keys(names2).find((key) => key.length === 4 && names2[key] === name) ?? name;
680
929
  if (name === "comment")
681
930
  frame(
682
931
  "COMM",
@@ -859,181 +1108,6 @@ function parseMp3(bytes) {
859
1108
  };
860
1109
  }
861
1110
 
862
- // packages/audio-ast/src/vorbis.ts
863
- var names2 = {
864
- TITLE: "title",
865
- ARTIST: "artist",
866
- ALBUM: "album",
867
- ALBUMARTIST: "albumArtist",
868
- TRACKNUMBER: "track",
869
- DISCNUMBER: "disc",
870
- DATE: "date",
871
- GENRE: "genre",
872
- COMMENT: "comment",
873
- DESCRIPTION: "comment",
874
- ENCODER: "encoder",
875
- COPYRIGHT: "copyright"
876
- };
877
- function parseComments(bytes) {
878
- const r = new Reader(bytes), vendorSize = r.u32(0, true), vendor = new TextDecoder().decode(r.slice(4, vendorSize));
879
- let offset = 4 + vendorSize;
880
- const count = r.u32(offset, true);
881
- offset += 4;
882
- if (count > (bytes.length - offset) / 4) throw new Error("Invalid Vorbis comment count");
883
- const tags = {}, comments = [];
884
- for (let i = 0; i < count; i++) {
885
- const size = r.u32(offset, true);
886
- offset += 4;
887
- const value = new TextDecoder().decode(r.slice(offset, size));
888
- offset += size;
889
- comments.push(value);
890
- const split = value.indexOf("=");
891
- if (split > 0) {
892
- const key = value.slice(0, split).toUpperCase(), name = names2[key] ?? key;
893
- tags[name] = tags[name] ? `${tags[name]}
894
- ${value.slice(split + 1)}` : value.slice(split + 1);
895
- }
896
- }
897
- return { tags, vendor, comments, size: offset };
898
- }
899
- function encodeComments(tags, vendor = "poe-code/audio-ast") {
900
- const encoder = new TextEncoder(), v = encoder.encode(vendor), comments = [];
901
- for (const [name, value] of Object.entries(tags)) {
902
- const key = Object.keys(names2).find((key2) => names2[key2] === name) ?? name.toUpperCase();
903
- if (key.includes("=") || Array.from(key).some((c) => c.charCodeAt(0) < 32 || c.charCodeAt(0) > 125))
904
- throw new Error("Invalid Vorbis comment key");
905
- for (const part of value.split("\n")) {
906
- const bytes = encoder.encode(`${key}=${part}`);
907
- comments.push(join([uint32(bytes.length, true), bytes]));
908
- }
909
- }
910
- return join([uint32(v.length, true), v, uint32(comments.length, true), ...comments]);
911
- }
912
- function parsePicture(bytes) {
913
- const r = new Reader(bytes), type = r.u32(0), mimeSize = r.u32(4), mime = r.text(8, mimeSize);
914
- let offset = 8 + mimeSize;
915
- const descriptionSize = r.u32(offset);
916
- offset += 4;
917
- const description = new TextDecoder().decode(r.slice(offset, descriptionSize));
918
- offset += descriptionSize;
919
- const width = r.u32(offset), height = r.u32(offset + 4), depth = r.u32(offset + 8), colors = r.u32(offset + 12), size = r.u32(offset + 16);
920
- offset += 20;
921
- const data = r.slice(offset, size);
922
- if (offset + size !== bytes.length) throw new Error("Trailing FLAC picture bytes");
923
- return { type, mime, description, width, height, depth, colors, data };
924
- }
925
- function encodePicture(p) {
926
- const description = new TextEncoder().encode(p.description), mime = ascii(p.mime);
927
- return join([
928
- uint32(p.type),
929
- uint32(mime.length),
930
- mime,
931
- uint32(description.length),
932
- description,
933
- uint32(p.width ?? 0),
934
- uint32(p.height ?? 0),
935
- uint32(p.depth ?? 0),
936
- uint32(p.colors ?? 0),
937
- uint32(p.data.length),
938
- p.data
939
- ]);
940
- }
941
- function pictureBase64(picture) {
942
- const bytes = encodePicture(picture);
943
- let binary = "";
944
- for (let i = 0; i < bytes.length; i += 8192)
945
- binary += String.fromCharCode(...bytes.subarray(i, i + 8192));
946
- return btoa(binary);
947
- }
948
-
949
- // packages/audio-ast/src/flac.ts
950
- function parseFlac(bytes) {
951
- const r = new Reader(bytes), nodes = [], pictures = [];
952
- const tags = {};
953
- let offset = 4, last = false, stream;
954
- while (!last) {
955
- const header = r.u8(offset), type = header & 127, size = r.u24(offset + 1);
956
- last = !!(header & 128);
957
- const data = r.slice(offset + 4, size), node = {
958
- type: [
959
- "STREAMINFO",
960
- "PADDING",
961
- "APPLICATION",
962
- "SEEKTABLE",
963
- "VORBIS_COMMENT",
964
- "CUESHEET",
965
- "PICTURE"
966
- ][type] ?? `BLOCK_${type}`,
967
- offset,
968
- size: size + 4,
969
- data
970
- };
971
- nodes.push(node);
972
- const block = new Reader(data);
973
- if (type === 0) {
974
- if (stream || offset !== 4 || size !== 34)
975
- throw new Error("FLAC requires first unique STREAMINFO");
976
- const packed = block.u64(10), sampleRate = Number(packed >> 44n), channels = Number(packed >> 41n & 7n) + 1, bitsPerSample = Number(packed >> 36n & 31n) + 1, samples = Number(packed & 0xfffffffffn);
977
- const seconds2 = duration(samples, sampleRate);
978
- stream = {
979
- codec: "flac",
980
- sampleRate,
981
- channels,
982
- bitsPerSample,
983
- samples,
984
- duration: seconds2,
985
- bitrate: seconds2 ? bytes.length * 8 / seconds2 : 0
986
- };
987
- node.fields = {
988
- minBlockSize: block.u16(0),
989
- maxBlockSize: block.u16(2),
990
- minFrameSize: block.u24(4),
991
- maxFrameSize: block.u24(7),
992
- sampleRate,
993
- channels,
994
- bitsPerSample,
995
- totalSamples: samples,
996
- md5: Array.from(block.slice(18, 16), (b) => b.toString(16).padStart(2, "0")).join("")
997
- };
998
- } else if (type === 4) {
999
- const parsed = parseComments(data);
1000
- if (parsed.size !== size) throw new Error("Trailing Vorbis comment bytes");
1001
- Object.assign(tags, parsed.tags);
1002
- node.fields = { vendor: parsed.vendor, comments: parsed.comments };
1003
- } else if (type === 6) pictures.push(parsePicture(data));
1004
- else if (type === 3) {
1005
- if (size % 18) throw new Error("Invalid FLAC seek table");
1006
- const points = [];
1007
- for (let pos = 0; pos < size; pos += 18)
1008
- points.push({
1009
- sample: block.u64(pos),
1010
- offset: block.u64(pos + 8),
1011
- samples: block.u16(pos + 16)
1012
- });
1013
- node.fields = { points };
1014
- } else if (type === 127) throw new Error("Invalid FLAC metadata block");
1015
- offset += 4 + size;
1016
- }
1017
- if (!stream) throw new Error("Missing FLAC STREAMINFO");
1018
- if (offset < bytes.length)
1019
- nodes.push({
1020
- type: "FRAMES",
1021
- offset,
1022
- size: bytes.length - offset,
1023
- data: r.slice(offset, bytes.length - offset)
1024
- });
1025
- return {
1026
- format: "flac",
1027
- data: bytes,
1028
- nodes,
1029
- tags,
1030
- pictures,
1031
- streams: [stream],
1032
- duration: stream.duration,
1033
- bitrate: stream.bitrate
1034
- };
1035
- }
1036
-
1037
1111
  // packages/audio-ast/src/ogg.ts
1038
1112
  function oggCrc(bytes) {
1039
1113
  let crc = 0;
@@ -1623,6 +1697,7 @@ export {
1623
1697
  pad,
1624
1698
  parseAudio,
1625
1699
  probeAudio,
1700
+ probeFlacSource,
1626
1701
  probeWavSource,
1627
1702
  remix,
1628
1703
  resample,
@@ -4,7 +4,13 @@ export interface AudioProbeSource {
4
4
  readonly size: number;
5
5
  read(offset: number, length: number): Promise<Uint8Array>;
6
6
  }
7
- /** Skip sample/unknown payloads and AST nodes. Tag strings remain an explicit metadata model. */
7
+ export interface WavTagSpan {
8
+ readonly key: string;
9
+ readonly offset: number;
10
+ readonly length: number;
11
+ }
12
+ /** Skip sample/unknown payloads and AST nodes. onTag exposes spans instead of materialized tag strings. */
8
13
  export declare function probeWavSource(source: AudioProbeSource, options?: {
9
14
  signal?: AbortSignal;
15
+ onTag?: (span: WavTagSpan) => Promise<void>;
10
16
  }): Promise<Omit<AudioAst, "data" | "nodes" | "pictures">>;
@@ -1762,7 +1762,7 @@ async function openPdfImage(source, fs, directory, signal, options, storage) {
1762
1762
  if (failure) throw failure.error;
1763
1763
  };
1764
1764
  try {
1765
- document = await PdfRetainedDocument.open(retained, { fs, directory }, { signal, recovery: "repair", chunkBytes: 16384, maxNodes: 1 / 0, maxTokenBytes: 1 / 0, maxRecursionDepth: 1 / 0, maxPageTreeDepth: 1 / 0, xref: { arrayStorage: values, storedArrayKeys: ["Index"] }, valueArrays: { stringStorage: values, storedStringKeys: ["ActualText"], arrayStorage: values, storedArrayKeys: ["Widths", "W", "Differences", "ON", "OFF", "OCGs"], storedArrayPaths: [["ExtGState", "*", "D"]] } });
1765
+ document = await PdfRetainedDocument.open(retained, { fs, directory }, { signal, recovery: "repair", chunkBytes: 16384, maxNodes: 1 / 0, maxTokenBytes: 1 / 0, maxRecursionDepth: 1 / 0, maxPageTreeDepth: 1 / 0, xref: { arrayStorage: values, storedArrayKeys: ["Index"] }, valueArrays: { stringStorage: values, storedStringKeys: ["ActualText"], arrayStorage: values, storedArrayKeys: ["Contents", "Annots", "Kids", "Widths", "W", "Differences", "ON", "OFF", "OCGs"], storedArrayPaths: [["ExtGState", "*", "D"]] } });
1766
1766
  let pages = 0, selected;
1767
1767
  for await (let page of document.pages())
1768
1768
  pages++, page.index <= Math.max(0, settings.page ?? 0) && (selected = page);
@@ -1,6 +1,17 @@
1
1
  import type { PagedStorage } from "@poe-platform/safe-fs/storage";
2
2
  import type { BackedJson } from "./backed-json.js";
3
+ type Mode = "value" | "arrayFirst" | "keyFirst" | "key" | "colon" | "separator" | "done";
4
+ type NumberState = "start" | "minus" | "zero" | "int" | "dot" | "frac" | "exp" | "expSign" | "expDigits";
5
+ export interface JsonSyntaxContext {
6
+ readonly mode: Mode;
7
+ readonly token: "string" | "number" | "keyword" | undefined;
8
+ readonly number: NumberState;
9
+ readonly escape: boolean;
10
+ readonly hex: number;
11
+ readonly container: "array" | "object" | undefined;
12
+ }
3
13
  /** JSON syntax and duplicate-key validation over streamed UTF-16 fragments.
4
14
  * Numeric spellings stay on tape; format-specific range/rounding validation is
5
15
  * separate. Both nesting state and the key index live in caller storage. */
6
- export declare function parseBackedJson(chunks: AsyncIterable<string>, tree: BackedJson, index: PagedStorage, cooperate: (units?: number) => Promise<void>, error: (offset: number, message: string, tokenOffset?: number) => never, validateNumber?: (node: number, offset: number) => Promise<void>, allowDuplicateKeys?: boolean, checkDepth?: (depth: number, container?: boolean) => void, node?: (kind: "object" | "array" | "key" | "scalar", complete?: boolean) => void, reference?: () => void, retained?: (bytes: number) => void): Promise<void>;
16
+ export declare function parseBackedJson(chunks: AsyncIterable<string>, tree: BackedJson, index: PagedStorage, cooperate: (units?: number) => Promise<void>, onError: (offset: number, message: string, tokenOffset?: number, context?: JsonSyntaxContext) => never, validateNumber?: (node: number, offset: number) => Promise<void>, allowDuplicateKeys?: boolean, checkDepth?: (depth: number, container?: boolean) => void, node?: (kind: "object" | "array" | "key" | "scalar", complete?: boolean) => void, reference?: () => void, retained?: (bytes: number) => void): Promise<void>;
17
+ export {};
@@ -1,4 +1,4 @@
1
1
  export { BackedJson } from "./backed-json.js";
2
- export { parseBackedJson } from "./backed-json-parser.js";
2
+ export { parseBackedJson, type JsonSyntaxContext } from "./backed-json-parser.js";
3
3
  export { JsonNumberError, readJsonNumber } from "./json-number.js";
4
4
  export { indexJsonObjects } from "./object-order.js";
@@ -2,3 +2,4 @@ export * from "./office-errors.js";
2
2
  export * from "./office-resources.js";
3
3
  export * from "./retained-xml.js";
4
4
  export * from "./retained-xml-document.js";
5
+ export * from "./retained-xml-edits.js";
@@ -0,0 +1,22 @@
1
+ import type { ByteSource } from "../office-package/index.js";
2
+ import { type RetainedXmlContext } from './office-resources.js';
3
+ import { type RetainedXml, type XmlRange } from './retained-xml.js';
4
+ export interface RetainedXmlEdit {
5
+ /** Original decoded UTF-8 coordinates. Edits must be ordered and disjoint;
6
+ * consecutive zero-length insertions at the same coordinate preserve order. */
7
+ readonly range: XmlRange;
8
+ /** Borrowed UTF-8 replacement, consumed before the next edit is requested. */
9
+ readonly replacement: ByteSource;
10
+ }
11
+ export interface StagedXmlMutation {
12
+ readonly byteLength: number;
13
+ bytes(): ByteSource;
14
+ write(sink: {
15
+ write(bytes: Uint8Array): Promise<void>;
16
+ }): Promise<void>;
17
+ close(): Promise<void>;
18
+ }
19
+ /** Admit source and result, then expose an owned staged mutation. The edit
20
+ * factory may traverse the immutable lexical view; that view expires before
21
+ * return. Neither a whole XML part nor the edit collection is retained in RAM. */
22
+ export declare function stageRetainedXmlEdits(source: ByteSource, edits: (original: RetainedXml) => AsyncIterable<RetainedXmlEdit>, settings: RetainedXmlContext): Promise<StagedXmlMutation>;
@@ -42,6 +42,9 @@ export declare class PdfMutableObjectStore {
42
42
  private save;
43
43
  get(number: number): Promise<PdfRetainedOutputObject | undefined>;
44
44
  private load;
45
+ /** Borrow encoded stream bytes without parsing the object's dictionary. */
46
+ getStream(number: number): Promise<PdfRetainedOutputObject["stream"]>;
47
+ private streamSnapshot;
45
48
  /** Remember successful decoding only while this stream snapshot is current. */
46
49
  markDecoded(object: PdfRetainedOutputObject): Promise<void>;
47
50
  /** Enumerate live identities without parsing values or reading payloads. */
@@ -0,0 +1,43 @@
1
+ import { type JsonSyntaxContext } from "../../json-ast/index.js";
2
+ import { type PdfCosRef } from "../ast.js";
3
+ import { PdfFileSource } from "../source.js";
4
+ import type { PdfRetainedDocument } from "../retained-document.js";
5
+ import type { PdfIndexStorage } from "./object-index.js";
6
+ export interface ApplyQpdfJsonOptions {
7
+ /** The caller retains ownership of datafile handles. */
8
+ readonly dataFile?: (path: string) => Promise<PdfFileSource | undefined>;
9
+ readonly maxInputBytes?: number;
10
+ readonly syntaxError?: (offset: number, message: string, tokenOffset?: number, context?: JsonSyntaxContext) => never;
11
+ }
12
+ /** A mutable JSON-import document backed only by the caller filesystem. Apply
13
+ * updates sequentially and publish chunks only after all updates succeed.
14
+ * A failed update may have applied earlier objects; discard the owner on error. */
15
+ export declare class QpdfJsonDocument {
16
+ private readonly storage;
17
+ rootRef: PdfCosRef | undefined;
18
+ infoRef: PdfCosRef | undefined;
19
+ private readonly store;
20
+ private readonly backing;
21
+ private readonly positions;
22
+ private readonly order;
23
+ private readonly catalogs;
24
+ private ordinal;
25
+ private readonly controller;
26
+ private readonly signal;
27
+ private pending;
28
+ private closing;
29
+ constructor(storage: PdfIndexStorage, options?: {
30
+ signal?: AbortSignal;
31
+ });
32
+ private remember;
33
+ static fromDocument(document: PdfRetainedDocument, source: PdfFileSource, storage: PdfIndexStorage, options?: {
34
+ signal?: AbortSignal;
35
+ }): Promise<QpdfJsonDocument>;
36
+ apply(input: AsyncIterable<Uint8Array> | Iterable<Uint8Array>, options?: ApplyQpdfJsonOptions): Promise<void>;
37
+ private update;
38
+ chunks(options?: {
39
+ maxOutputBytes?: number;
40
+ chunkBytes?: number;
41
+ }): AsyncGenerator<Uint8Array>;
42
+ close(): Promise<void>;
43
+ }
@@ -10,6 +10,7 @@ export declare class QpdfJsonValues {
10
10
  private readonly scratch;
11
11
  private readonly first;
12
12
  private readonly next;
13
+ private sourceOrder;
13
14
  private closed;
14
15
  private work;
15
16
  private constructor();
@@ -26,6 +27,12 @@ export declare class QpdfJsonValues {
26
27
  /** Match the legacy reference grammar without collecting long zero padding. */
27
28
  reference(position: number): Promise<PdfCosRef | undefined>;
28
29
  private scalar;
30
+ validate(root: number): Promise<void>;
31
+ /** Look up a converted PDF dictionary name, after prefix decoding/collisions. */
32
+ property(root: number, name: string): Promise<number | undefined>;
33
+ private keyEquals;
34
+ /** Stream an imported stream dictionary with legacy filter/length handling. */
35
+ streamDictionary(root: number | undefined, length: number): AsyncGenerator<Uint8Array>;
29
36
  chunks(root: number): AsyncGenerator<Uint8Array>;
30
37
  close(): Promise<void>;
31
38
  }
@@ -75,3 +75,4 @@ export { retainedObjectOrder } from "./cos/retained-object-order.js";
75
75
  export { encryptRetainedPdfChunks } from "./cos/retained-encryption.js";
76
76
  export { replaceRetainedPdfName } from "./edit/retained-name-replacement.js";
77
77
  export { QpdfJsonValues } from "./cos/qpdf-json-values.js";
78
+ export { QpdfJsonDocument, type ApplyQpdfJsonOptions } from "./cos/qpdf-json-document.js";