@poe-platform/safe-bash 0.1.812 → 0.1.814

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (602) hide show
  1. package/dist/audio-ast/id3-source.d.ts +27 -0
  2. package/dist/audio-ast/index.d.ts +4 -0
  3. package/dist/audio-ast/index.js +996 -596
  4. package/dist/audio-ast/mp3-source.d.ts +18 -0
  5. package/dist/audio-ast/ogg-source.d.ts +25 -0
  6. package/dist/audio-ast/ogg-stream-source.d.ts +22 -0
  7. package/dist/image-ast/index.js +139 -9
  8. package/dist/mp4-ast/containers/adapters.d.ts +7 -0
  9. package/dist/mp4-ast/index.d.ts +2 -0
  10. package/dist/mp4-ast/mp4-sample-source.d.ts +52 -0
  11. package/dist/mp4-ast/mp4-source.d.ts +32 -0
  12. package/dist/office-xml/retained-xml-document.d.ts +14 -0
  13. package/dist/pdf-ast/ast.d.ts +2 -0
  14. package/dist/pdf-ast/content/dictionary-cursor.d.ts +15 -0
  15. package/dist/pdf-ast/content/evaluator.d.ts +4 -0
  16. package/dist/pdf-ast/content/range-operator-parser.d.ts +4 -0
  17. package/dist/pdf-ast/content/stored-dictionary.d.ts +10 -0
  18. package/dist/pdf-ast/cos/lexer.d.ts +8 -5
  19. package/dist/pdf-ast/cos/object-reader.d.ts +11 -3
  20. package/dist/pdf-ast/cos/range-parser.d.ts +4 -0
  21. package/dist/pdf-ast/cos/retained-objects.d.ts +1 -0
  22. package/dist/pdf-ast/cos/retained-writer.d.ts +1 -0
  23. package/dist/pdf-ast/cos/value-parser.d.ts +10 -0
  24. package/dist/pdf-ast/edit/retained-append-attachments.d.ts +13 -0
  25. package/dist/pdf-ast/edit/retained-bookmarks.d.ts +13 -0
  26. package/dist/pdf-ast/edit/retained-form-appearances.d.ts +10 -0
  27. package/dist/pdf-ast/edit/retained-graph.d.ts +12 -0
  28. package/dist/pdf-ast/edit/retained-info-updates.d.ts +33 -0
  29. package/dist/pdf-ast/edit/retained-save.d.ts +2 -0
  30. package/dist/pdf-ast/edit/retained-stamps.d.ts +9 -0
  31. package/dist/pdf-ast/fonts/resolve.d.ts +3 -1
  32. package/dist/pdf-ast/index.d.ts +3 -1
  33. package/dist/pdf-ast/index.js +1966 -844
  34. package/dist/pdf-ast/retained-document.d.ts +5 -0
  35. package/dist/safe-bash/audio-ast.browser.js +6 -1
  36. package/dist/safe-bash/chunks/{chunk-HHSOUC3Z.js → chunk-HPQE675Q.js} +1 -1
  37. package/dist/safe-bash/chunks/{chunk-BUYRKFW2.js → chunk-I6ECNJMR.js} +1 -1
  38. package/dist/safe-bash/chunks/{pdftk-WRYEP3CA.js → pdftk-Y2TX74LY.js} +2 -1
  39. package/dist/safe-bash/command-chunks/biff-KRHJ63K3-VQPJCVIL.js +5309 -0
  40. package/dist/safe-bash/command-chunks/{chunk-34G2SQX2.js → chunk-2BLTUQNK.js} +2 -2
  41. package/dist/safe-bash/command-chunks/{chunk-LLU2IQEJ.js → chunk-2BNGPR6Z.js} +2 -2
  42. package/dist/safe-bash/command-chunks/{chunk-HWQ2UHMT.js → chunk-2ETEJOYX.js} +18 -18
  43. package/dist/safe-bash/command-chunks/{chunk-NQDIT667.js → chunk-2PKBXGXD.js} +5 -5
  44. package/dist/safe-bash/command-chunks/{chunk-MMBZTYXO.js → chunk-2PQRZDNR.js} +221 -0
  45. package/dist/safe-bash/command-chunks/{chunk-6QBMND4A.js → chunk-2VVJRVYM.js} +1 -1
  46. package/dist/safe-bash/command-chunks/{chunk-G5QVZQCO.js → chunk-3EASXF5D.js} +5 -5
  47. package/dist/safe-bash/command-chunks/{chunk-U3SBHEKH.js → chunk-3EB2FSAN.js} +9 -9
  48. package/dist/safe-bash/command-chunks/{chunk-VB2TUPO2.js → chunk-3EW7GYHM.js} +9 -9
  49. package/dist/safe-bash/command-chunks/{chunk-RNSKXOG3.js → chunk-3GRMU7TM.js} +6 -6
  50. package/dist/safe-bash/command-chunks/chunk-3JM7E42I.js +197 -0
  51. package/dist/safe-bash/command-chunks/{chunk-6L4IYQAT.js → chunk-3MG5EAMX.js} +4 -4
  52. package/dist/safe-bash/command-chunks/{chunk-RASQPOSV.js → chunk-3SPLP2DB.js} +1 -1
  53. package/dist/safe-bash/command-chunks/{chunk-K5COUQAQ.js → chunk-3VGQTLO6.js} +1 -1
  54. package/dist/safe-bash/command-chunks/{chunk-K7CV55K5.js → chunk-3YEQI5B7.js} +10 -10
  55. package/dist/safe-bash/command-chunks/{chunk-ZXR6LXV5.js → chunk-3ZRCL756.js} +48 -4
  56. package/dist/safe-bash/command-chunks/{chunk-SOFM3GPG.js → chunk-42MEXZBJ.js} +1 -1
  57. package/dist/safe-bash/command-chunks/{chunk-GQ2ZSPZ3.js → chunk-46AMTJPE.js} +10 -10
  58. package/dist/safe-bash/command-chunks/{chunk-MTWZEPAR.js → chunk-47IAU25U.js} +2 -2
  59. package/dist/safe-bash/command-chunks/{chunk-6GI3NTCW.js → chunk-4B2ZUGLT.js} +4 -4
  60. package/dist/safe-bash/command-chunks/{chunk-L5MCW6CM.js → chunk-4EHY6J2Z.js} +9 -155
  61. package/dist/safe-bash/command-chunks/{chunk-QQVACHZA.js → chunk-4EZJV4FZ.js} +1 -1
  62. package/dist/safe-bash/command-chunks/{chunk-SSKMPDN4.js → chunk-4GQKCUS5.js} +15 -15
  63. package/dist/safe-bash/command-chunks/{chunk-UOBW5K3M.js → chunk-4RRYWHED.js} +7 -7
  64. package/dist/safe-bash/command-chunks/{chunk-PINR7QET.js → chunk-4UPKVQWH.js} +8 -8
  65. package/dist/safe-bash/command-chunks/{chunk-M7QE2MN7.js → chunk-4YLACJHE.js} +6 -6
  66. package/dist/safe-bash/command-chunks/chunk-5BIQWWLB.js +175 -0
  67. package/dist/safe-bash/command-chunks/{chunk-P3WU3PSL.js → chunk-5L4YGRQU.js} +3 -3
  68. package/dist/safe-bash/command-chunks/{chunk-HKATEVAP.js → chunk-5LFGXN3D.js} +6 -6
  69. package/dist/safe-bash/command-chunks/{chunk-SPLOIABU.js → chunk-5OM3UIK3.js} +3 -3
  70. package/dist/safe-bash/command-chunks/{chunk-TVH4JORU.js → chunk-6LPSKLLD.js} +3 -3
  71. package/dist/safe-bash/command-chunks/{chunk-CV7M2QJU.js → chunk-6QYSF7I2.js} +7 -7
  72. package/dist/safe-bash/command-chunks/{chunk-XVP6V5K3.js → chunk-6VBDJC6V.js} +6 -6
  73. package/dist/safe-bash/command-chunks/{chunk-6N5GHM72.js → chunk-6WNVGCXD.js} +8 -8
  74. package/dist/safe-bash/command-chunks/{chunk-6CCQI6XZ.js → chunk-6XES7Z4G.js} +12 -12
  75. package/dist/safe-bash/command-chunks/{chunk-AFROLW6S.js → chunk-6XGDWFNQ.js} +4 -4
  76. package/dist/safe-bash/command-chunks/{chunk-WTE23QXN.js → chunk-6ZGCKUAM.js} +3 -3
  77. package/dist/safe-bash/command-chunks/chunk-6ZHQB453.js +35 -0
  78. package/dist/safe-bash/command-chunks/{chunk-RIV6XN7K.js → chunk-7DOLY7IV.js} +2 -2
  79. package/dist/safe-bash/command-chunks/{chunk-QD7ZRDUN.js → chunk-7KZ5LWV2.js} +1 -1
  80. package/dist/safe-bash/command-chunks/{chunk-NGR5KOPQ.js → chunk-A347DLRB.js} +3 -3
  81. package/dist/safe-bash/command-chunks/{chunk-ZM2Y4Z3C.js → chunk-A45UG4KT.js} +4 -4
  82. package/dist/safe-bash/command-chunks/{chunk-56NYSX65.js → chunk-ADHFF2IM.js} +9 -9
  83. package/dist/safe-bash/command-chunks/{chunk-ATI464W3.js → chunk-AG2SNMP5.js} +1 -1
  84. package/dist/safe-bash/command-chunks/{chunk-FDCIPJBQ.js → chunk-AM5LANIE.js} +7 -7
  85. package/dist/safe-bash/command-chunks/{chunk-3Q247UDJ.js → chunk-AVGXFWEB.js} +278 -135
  86. package/dist/safe-bash/command-chunks/{chunk-RBTC7OFT.js → chunk-AVOGFREX.js} +5 -5
  87. package/dist/safe-bash/command-chunks/{chunk-QC5RMGSA.js → chunk-AWPI4DZR.js} +3 -3
  88. package/dist/safe-bash/command-chunks/{chunk-FYMNHG7R.js → chunk-AXXZNB7U.js} +13 -13
  89. package/dist/safe-bash/command-chunks/{chunk-Q6S57NOQ.js → chunk-AY3KQ4EN.js} +7 -7
  90. package/dist/safe-bash/command-chunks/{chunk-456PHA3L.js → chunk-BLGGAHQW.js} +1 -1
  91. package/dist/safe-bash/command-chunks/{chunk-CU4DLVME.js → chunk-BLIFGBIO.js} +2 -2
  92. package/dist/safe-bash/command-chunks/{chunk-NARD63DY.js → chunk-BS3ZEQGT.js} +22 -66
  93. package/dist/safe-bash/command-chunks/{chunk-WFVSUXJL.js → chunk-BS5JEUEW.js} +8 -8
  94. package/dist/safe-bash/command-chunks/{chunk-UYWSIIUX.js → chunk-BZMNC7Q5.js} +7 -7
  95. package/dist/safe-bash/command-chunks/{chunk-RHYJVTJO.js → chunk-CCMAHM3I.js} +2 -2
  96. package/dist/safe-bash/command-chunks/{chunk-N4R2SHSS.js → chunk-CCZZVCHX.js} +2 -2
  97. package/dist/safe-bash/command-chunks/{chunk-WGG6G2KG.js → chunk-CIRDVCAZ.js} +7 -7
  98. package/dist/safe-bash/command-chunks/chunk-CK2WFJZN.js +178 -0
  99. package/dist/safe-bash/command-chunks/{chunk-UZL7G57V.js → chunk-CKEMZUE3.js} +7 -7
  100. package/dist/safe-bash/command-chunks/{chunk-B5LDP7AA.js → chunk-CQBACD2V.js} +2 -2
  101. package/dist/safe-bash/command-chunks/{chunk-JYUJAF4L.js → chunk-CSE4VQKG.js} +16 -1
  102. package/dist/safe-bash/command-chunks/{chunk-Q73EMLLZ.js → chunk-CXME4YHU.js} +107 -5
  103. package/dist/safe-bash/command-chunks/{chunk-FTLDRH47.js → chunk-CZ5K2YPU.js} +16 -16
  104. package/dist/safe-bash/command-chunks/{chunk-554Z6IKP.js → chunk-DBLQUZGN.js} +2 -2
  105. package/dist/safe-bash/command-chunks/{chunk-6M6TM5Z5.js → chunk-DBNJEXHK.js} +3 -3
  106. package/dist/safe-bash/command-chunks/{chunk-SPW4GW4Z.js → chunk-DFI7QF3M.js} +2 -2
  107. package/dist/safe-bash/command-chunks/{chunk-ZO5WBWLL.js → chunk-DN6MSXY7.js} +2 -2
  108. package/dist/safe-bash/command-chunks/{chunk-GXLXWZWH.js → chunk-DZH54L3F.js} +3 -3
  109. package/dist/safe-bash/command-chunks/{chunk-XRVKWGVQ.js → chunk-EBHOZIBS.js} +6 -6
  110. package/dist/safe-bash/command-chunks/{chunk-3Y5EME26.js → chunk-ENEIE44W.js} +2 -2
  111. package/dist/safe-bash/command-chunks/{chunk-ATTWQVR2.js → chunk-EQWFKNHJ.js} +17 -17
  112. package/dist/safe-bash/command-chunks/{chunk-YV72XQKL.js → chunk-ETXPMVR6.js} +13 -13
  113. package/dist/safe-bash/command-chunks/{chunk-JFYWVQ4V.js → chunk-EV5G535P.js} +8 -8
  114. package/dist/safe-bash/command-chunks/{chunk-PZMU3Z4L.js → chunk-EVYKV3QI.js} +5 -5
  115. package/dist/safe-bash/command-chunks/{chunk-D6UMSC45.js → chunk-F4YFTO2K.js} +11 -11
  116. package/dist/safe-bash/command-chunks/{chunk-MPUHH2KR.js → chunk-F762XDNG.js} +3 -3
  117. package/dist/safe-bash/command-chunks/{chunk-D2ASPM7R.js → chunk-FF7UGJWS.js} +5 -5
  118. package/dist/safe-bash/command-chunks/{chunk-OA75SGN2.js → chunk-FOONI6BD.js} +7 -7
  119. package/dist/safe-bash/command-chunks/{chunk-DYLNU57U.js → chunk-FSVJ67G5.js} +1 -1
  120. package/dist/safe-bash/command-chunks/{chunk-CLKOGAR3.js → chunk-FSYMSWJU.js} +8 -8
  121. package/dist/safe-bash/command-chunks/{chunk-22MOB45U.js → chunk-FUQMEUAT.js} +6 -6
  122. package/dist/safe-bash/command-chunks/chunk-FWKLBDMK.js +0 -0
  123. package/dist/safe-bash/command-chunks/{chunk-KXPCSVAT.js → chunk-FXCSPPYE.js} +20 -20
  124. package/dist/safe-bash/command-chunks/{chunk-XZ2FWFNV.js → chunk-FYYFV6PW.js} +6 -6
  125. package/dist/safe-bash/command-chunks/{chunk-3OETVNJA.js → chunk-G2COZLXX.js} +9 -9
  126. package/dist/safe-bash/command-chunks/{chunk-ZEX53S5I.js → chunk-G3TAX3CV.js} +7369 -7221
  127. package/dist/safe-bash/command-chunks/{chunk-LXLLA4PM.js → chunk-GCHB7VNX.js} +17 -17
  128. package/dist/safe-bash/command-chunks/{chunk-4Y6O2K35.js → chunk-GLAF45M7.js} +1 -1
  129. package/dist/safe-bash/command-chunks/{chunk-OEJM666F.js → chunk-GQGMQMIM.js} +5 -5
  130. package/dist/safe-bash/command-chunks/{chunk-RRL3Y562.js → chunk-GXMPXMDP.js} +11 -11
  131. package/dist/safe-bash/command-chunks/{chunk-GEM47B2P.js → chunk-GYM5ICK4.js} +7 -7
  132. package/dist/safe-bash/command-chunks/{chunk-A5FZBR7X.js → chunk-H33D4R26.js} +4 -4
  133. package/dist/safe-bash/command-chunks/{chunk-AGLK7OJR.js → chunk-HDSIIQBS.js} +1 -1
  134. package/dist/safe-bash/command-chunks/{chunk-3ZDANXIC.js → chunk-HELAVGZH.js} +3 -3
  135. package/dist/safe-bash/command-chunks/{chunk-S4QH5BXZ.js → chunk-HGIMFVI2.js} +4 -4
  136. package/dist/safe-bash/command-chunks/{chunk-35IPOBWL.js → chunk-HI6ZYH3W.js} +10 -10
  137. package/dist/safe-bash/command-chunks/{chunk-KB7DUBVL.js → chunk-HK6MSB7Z.js} +5 -5
  138. package/dist/safe-bash/command-chunks/{chunk-7ZE3VIAN.js → chunk-IB5QP4LF.js} +2 -2
  139. package/dist/safe-bash/command-chunks/{chunk-UCR5YDV3.js → chunk-IBYMPAUW.js} +1 -1
  140. package/dist/safe-bash/command-chunks/{chunk-LABOWPFB.js → chunk-IHXZMAMY.js} +9 -9
  141. package/dist/safe-bash/command-chunks/{chunk-XPD636C4.js → chunk-IWHNRYER.js} +3 -3
  142. package/dist/safe-bash/command-chunks/{chunk-PPO7YUZF.js → chunk-JGKSWDGP.js} +1 -1
  143. package/dist/safe-bash/command-chunks/{chunk-KCOJA7EM.js → chunk-JR3Q6QNL.js} +7 -7
  144. package/dist/safe-bash/command-chunks/{chunk-S6R3IB36.js → chunk-JUHOL5KB.js} +1 -1
  145. package/dist/safe-bash/command-chunks/{chunk-3O2YEI47.js → chunk-JVKE7YZN.js} +3 -3
  146. package/dist/safe-bash/command-chunks/{chunk-6NATRKUJ.js → chunk-JW6WVNTM.js} +1 -1
  147. package/dist/safe-bash/command-chunks/{chunk-IK6K2HCG.js → chunk-JWORWL72.js} +1 -1
  148. package/dist/safe-bash/command-chunks/{chunk-JOCFI7TG.js → chunk-K2WOMJOQ.js} +1 -1
  149. package/dist/safe-bash/command-chunks/{chunk-XVLWZTPY.js → chunk-K4XNUJVJ.js} +543 -144
  150. package/dist/safe-bash/command-chunks/{chunk-DM2CPMB4.js → chunk-KBAQHE5Y.js} +2 -2
  151. package/dist/safe-bash/command-chunks/chunk-KCLJGRU7.js +737 -0
  152. package/dist/safe-bash/command-chunks/{chunk-TUDFMNPP.js → chunk-KINIV2SV.js} +1 -1
  153. package/dist/safe-bash/command-chunks/{chunk-43TRBJ2N.js → chunk-KPHLESD4.js} +4 -4
  154. package/dist/safe-bash/command-chunks/{chunk-47NEG4UO.js → chunk-KRRG4MGH.js} +222 -46
  155. package/dist/safe-bash/command-chunks/{chunk-33YCKZZX.js → chunk-KSBNZTAZ.js} +6 -6
  156. package/dist/safe-bash/command-chunks/{chunk-4Y34ZG4T.js → chunk-KUOCGGEU.js} +11 -11
  157. package/dist/safe-bash/command-chunks/{chunk-ML5R5JML.js → chunk-KY4LCHUF.js} +1 -1
  158. package/dist/safe-bash/command-chunks/{chunk-2JSDKQ4J.js → chunk-LAPOMHGY.js} +251 -239
  159. package/dist/safe-bash/command-chunks/{chunk-ENT3IV2G.js → chunk-LDW3RF7Y.js} +12 -12
  160. package/dist/safe-bash/command-chunks/{chunk-U27XPNLP.js → chunk-LEO4VRIN.js} +2 -2
  161. package/dist/safe-bash/command-chunks/{chunk-GZ3VIWNN.js → chunk-LKGTH2Q7.js} +7 -7
  162. package/dist/safe-bash/command-chunks/{chunk-ZMHEGDU2.js → chunk-LNTEV56A.js} +2 -2
  163. package/dist/safe-bash/command-chunks/{chunk-DVGXLBUW.js → chunk-LZ2JFMKT.js} +10 -10
  164. package/dist/safe-bash/command-chunks/{chunk-6D2BMAF4.js → chunk-MEM2ZPMI.js} +2 -2
  165. package/dist/safe-bash/command-chunks/{chunk-HTVIYLVB.js → chunk-MGMTRGKM.js} +4 -4
  166. package/dist/safe-bash/command-chunks/{chunk-B3NLITWP.js → chunk-MKK6FM5H.js} +7 -7
  167. package/dist/safe-bash/command-chunks/{chunk-Z2JW6M2D.js → chunk-MKOIPOXX.js} +3 -3
  168. package/dist/safe-bash/command-chunks/chunk-MLOYUXUV.js +244 -0
  169. package/dist/safe-bash/command-chunks/{chunk-CBNKHBLD.js → chunk-MNK3DDH6.js} +2 -2
  170. package/dist/safe-bash/command-chunks/{chunk-JVGUVHWI.js → chunk-MPXMRTMY.js} +10 -10
  171. package/dist/safe-bash/command-chunks/{chunk-TW73OXPR.js → chunk-MVLVIMJ6.js} +6 -6
  172. package/dist/safe-bash/command-chunks/{chunk-TY4WDAHM.js → chunk-MYZ46FQL.js} +1 -1
  173. package/dist/safe-bash/command-chunks/{chunk-TBAIMDGL.js → chunk-N4MUBJCT.js} +1 -1
  174. package/dist/safe-bash/command-chunks/{chunk-NPLVFAD6.js → chunk-N6G3345Q.js} +8 -8
  175. package/dist/safe-bash/command-chunks/{chunk-ZIIO6GRY.js → chunk-NEMUPUUB.js} +7 -7
  176. package/dist/safe-bash/command-chunks/{chunk-K5GB2YMN.js → chunk-NEVQWOU6.js} +10 -10
  177. package/dist/safe-bash/command-chunks/{chunk-FIIAYCWS.js → chunk-NFGCBQN3.js} +2 -2
  178. package/dist/safe-bash/command-chunks/{chunk-PNGDJA6M.js → chunk-NFII726L.js} +2 -2
  179. package/dist/safe-bash/command-chunks/{chunk-JQPNA77Y.js → chunk-NHNZYWPW.js} +2 -2
  180. package/dist/safe-bash/command-chunks/chunk-NQINS4XY.js +156 -0
  181. package/dist/safe-bash/command-chunks/{chunk-APEWTWCC.js → chunk-NRFTYZ2R.js} +6 -6
  182. package/dist/safe-bash/command-chunks/{chunk-THMZLJQD.js → chunk-NYFYTL5G.js} +18 -18
  183. package/dist/safe-bash/command-chunks/{chunk-SMSGLRIH.js → chunk-OTF2AJ5M.js} +6 -6
  184. package/dist/safe-bash/command-chunks/{chunk-QZZ73J2O.js → chunk-OVQP6KH5.js} +6 -6
  185. package/dist/safe-bash/command-chunks/{chunk-HDJVJTCK.js → chunk-P2LT6TGR.js} +9 -9
  186. package/dist/safe-bash/command-chunks/{chunk-YS25EI54.js → chunk-PCCFLPUQ.js} +2 -2
  187. package/dist/safe-bash/command-chunks/{chunk-26VCZHLJ.js → chunk-PIOQBOEK.js} +1 -1
  188. package/dist/safe-bash/command-chunks/{chunk-D2KZ66W4.js → chunk-PIVH35EQ.js} +190 -42
  189. package/dist/safe-bash/command-chunks/{chunk-QYMEASQ6.js → chunk-PLMF35XK.js} +4 -4
  190. package/dist/safe-bash/command-chunks/{chunk-JQVHUSDD.js → chunk-PLR5IULU.js} +5 -5
  191. package/dist/safe-bash/command-chunks/{chunk-2CORNDGF.js → chunk-PS5GDFIP.js} +2 -2
  192. package/dist/safe-bash/command-chunks/{chunk-R6EGGK5M.js → chunk-Q5PWYPQV.js} +7 -7
  193. package/dist/safe-bash/command-chunks/{chunk-COKYZUBW.js → chunk-Q7TVCBU2.js} +1 -1
  194. package/dist/safe-bash/command-chunks/{chunk-EHTOHOTR.js → chunk-QB72X7FF.js} +9 -9
  195. package/dist/safe-bash/command-chunks/{chunk-F3GP3EXE.js → chunk-RGDOYWOD.js} +2 -2
  196. package/dist/safe-bash/command-chunks/{chunk-RQIQ75W5.js → chunk-RHDERFMR.js} +5 -5
  197. package/dist/safe-bash/command-chunks/{chunk-3KMOXEGH.js → chunk-RHU44OMN.js} +2 -2
  198. package/dist/safe-bash/command-chunks/{chunk-7PVHO47B.js → chunk-RIVKF77R.js} +6 -6
  199. package/dist/safe-bash/command-chunks/{chunk-UOR6PXZZ.js → chunk-ROL5AEX6.js} +1 -1
  200. package/dist/safe-bash/command-chunks/{chunk-AHA6IWAJ.js → chunk-RQYPFLZJ.js} +6 -6
  201. package/dist/safe-bash/command-chunks/{chunk-YSMNXMAO.js → chunk-RTNI47C5.js} +4 -4
  202. package/dist/safe-bash/command-chunks/{chunk-W5LLKV5H.js → chunk-RV5AGXOV.js} +2 -2
  203. package/dist/safe-bash/command-chunks/{chunk-PMAM4N33.js → chunk-RXQ2G2YK.js} +9 -9
  204. package/dist/safe-bash/command-chunks/{chunk-EVU7FLDA.js → chunk-S2QNBAN6.js} +7 -7
  205. package/dist/safe-bash/command-chunks/{chunk-YE6OAKK7.js → chunk-S43QRKDC.js} +7 -7
  206. package/dist/safe-bash/command-chunks/{chunk-774GLJAO.js → chunk-S7HIOT7Z.js} +4 -4
  207. package/dist/safe-bash/command-chunks/chunk-SEPUP6TZ.js +63 -0
  208. package/dist/safe-bash/command-chunks/{chunk-JPMYPOYZ.js → chunk-SUTHGUD3.js} +28 -28
  209. package/dist/safe-bash/command-chunks/chunk-SW37YCBW.js +286 -0
  210. package/dist/safe-bash/command-chunks/{chunk-Y4EYCZFT.js → chunk-SWAKALDJ.js} +10 -10
  211. package/dist/safe-bash/command-chunks/{chunk-QUM3SYAJ.js → chunk-SYSX46IV.js} +3 -3
  212. package/dist/safe-bash/command-chunks/{chunk-WGH3RLJY.js → chunk-T5S4SJGO.js} +9 -9
  213. package/dist/safe-bash/command-chunks/{chunk-7JEIWA3A.js → chunk-TID5TSQW.js} +5 -5
  214. package/dist/safe-bash/command-chunks/{chunk-CRV2Q3PB.js → chunk-TJLXSENN.js} +1 -1
  215. package/dist/safe-bash/command-chunks/{chunk-IT7TAC3F.js → chunk-TKCUGMRZ.js} +24 -20
  216. package/dist/safe-bash/command-chunks/{chunk-7GKKMNL6.js → chunk-TXPDKEGY.js} +8 -8
  217. package/dist/safe-bash/command-chunks/{chunk-A2CLZMQZ.js → chunk-UJERQEJB.js} +1 -1
  218. package/dist/safe-bash/command-chunks/{chunk-6VPQ3CDZ.js → chunk-USGZN2KE.js} +5 -5
  219. package/dist/safe-bash/command-chunks/{chunk-LCZDBW55.js → chunk-UYGQEQIP.js} +5 -5
  220. package/dist/safe-bash/command-chunks/{chunk-MPORWUTU.js → chunk-V5XC43BX.js} +8 -8
  221. package/dist/safe-bash/command-chunks/{chunk-AIMSZBWP.js → chunk-V7E3PZOK.js} +9 -9
  222. package/dist/safe-bash/command-chunks/{chunk-CNHRVUHA.js → chunk-VDTFVRYX.js} +1 -1
  223. package/dist/safe-bash/command-chunks/{chunk-KJ4XXZIL.js → chunk-VT2PHQ63.js} +582 -59
  224. package/dist/safe-bash/command-chunks/{chunk-MOZD7RUY.js → chunk-VT7UBPAE.js} +38 -15
  225. package/dist/safe-bash/command-chunks/{chunk-QDVI2YB6.js → chunk-VUWXLH3E.js} +2 -2
  226. package/dist/safe-bash/command-chunks/{chunk-X7FA7ZD5.js → chunk-W3ZSWK76.js} +8 -8
  227. package/dist/safe-bash/command-chunks/{chunk-JPA2PUYI.js → chunk-WBKB7HBZ.js} +8 -8
  228. package/dist/safe-bash/command-chunks/{chunk-MIRL7HTF.js → chunk-WJ2ERUCQ.js} +1 -1
  229. package/dist/safe-bash/command-chunks/{chunk-36XGIPOG.js → chunk-WTVJLHMG.js} +1 -1
  230. package/dist/safe-bash/command-chunks/{chunk-SLQWQKXP.js → chunk-WWHMI4S3.js} +9 -9
  231. package/dist/safe-bash/command-chunks/{chunk-2UBZALAK.js → chunk-WYZG3DRR.js} +1 -1
  232. package/dist/safe-bash/command-chunks/{chunk-YORJDX4V.js → chunk-WZRFS5OY.js} +4 -4
  233. package/dist/safe-bash/command-chunks/{chunk-EHSM5ZQS.js → chunk-X6OHFKBL.js} +8 -8
  234. package/dist/safe-bash/command-chunks/{chunk-S6ZTBXYO.js → chunk-XKAUKLF7.js} +13 -13
  235. package/dist/safe-bash/command-chunks/{chunk-EUT24Y5Z.js → chunk-XM5QJCPD.js} +8 -8
  236. package/dist/safe-bash/command-chunks/{chunk-WXRYDALR.js → chunk-XMTR7QGL.js} +4 -4
  237. package/dist/safe-bash/command-chunks/{chunk-4CKFNXRN.js → chunk-XNGM3W5R.js} +1 -1
  238. package/dist/safe-bash/command-chunks/{chunk-2ZFLMWOX.js → chunk-XTEIT5CI.js} +1 -1
  239. package/dist/safe-bash/command-chunks/{chunk-4DLIUTQV.js → chunk-XU6S3XUZ.js} +11 -11
  240. package/dist/safe-bash/command-chunks/{chunk-CJQSAATC.js → chunk-XUJAQA3S.js} +30 -30
  241. package/dist/safe-bash/command-chunks/{chunk-W5YSINXC.js → chunk-Y42KSX63.js} +6 -6
  242. package/dist/safe-bash/command-chunks/{chunk-UAXSE3XE.js → chunk-Y54L4P4J.js} +5 -5
  243. package/dist/safe-bash/command-chunks/{chunk-6WQD7LRA.js → chunk-YAD7EV4N.js} +14 -14
  244. package/dist/safe-bash/command-chunks/{chunk-WVMHRNXZ.js → chunk-YRPXBGRX.js} +3 -3
  245. package/dist/safe-bash/command-chunks/{chunk-5HPU7D36.js → chunk-Z2WNYEPD.js} +4 -4
  246. package/dist/safe-bash/command-chunks/{chunk-SDTPO2VV.js → chunk-Z7QOSXQC.js} +7 -7
  247. package/dist/safe-bash/command-chunks/{chunk-WJCN2IXI.js → chunk-ZQM37BGE.js} +2 -2
  248. package/dist/safe-bash/command-chunks/{chunk-W3HV45CI.js → chunk-ZSQZHFWS.js} +9 -9
  249. package/dist/safe-bash/command-chunks/{chunk-IDJQP3A6.js → chunk-ZTMZO4IT.js} +1 -1
  250. package/dist/safe-bash/command-chunks/{chunk-RID6VYS3.js → chunk-ZU2KJMXO.js} +8 -8
  251. package/dist/safe-bash/command-chunks/{chunk-YXKNJ6EM.js → chunk-ZXELXF2H.js} +5 -5
  252. package/dist/safe-bash/command-chunks/{clipboard-BBDK33GP-VB22F7GI.js → clipboard-BBDK33GP-QZ4ERNQX.js} +2 -2
  253. package/dist/safe-bash/command-chunks/{command-engine-BCUQGJJ4.js → command-engine-7V6PZR7G.js} +1012 -678
  254. package/dist/safe-bash/command-chunks/{engine-LAUEWYSQ-DQCEI5HE.js → engine-UYJENSWK-VSCGKSQV.js} +1 -1
  255. package/dist/safe-bash/command-chunks/{gnumeric-UJPXWBVR-YPXTNEDZ.js → gnumeric-UJPXWBVR-7VOHQAPM.js} +2 -2
  256. package/dist/safe-bash/command-chunks/{model-store-E7BHBFJC.js → model-store-UB5DWMAP.js} +24 -24
  257. package/dist/safe-bash/command-chunks/paradox-4FCZE53D-LQPGVMEL.js +365 -0
  258. package/dist/safe-bash/commands/pandoc/index.browser.js +1 -1
  259. package/dist/safe-bash/full-core.browser.js +2 -2
  260. package/dist/safe-bash/plugins/index.browser.js +2 -2
  261. package/dist/safe-bash-command-awk/awk-runtime.js +3 -3
  262. package/dist/safe-bash-command-awk/awk.js +4 -4
  263. package/dist/safe-bash-command-awk/index.js +4 -4
  264. package/dist/safe-bash-command-diff/diff.js +2 -2
  265. package/dist/safe-bash-command-diff/index.js +3 -3
  266. package/dist/safe-bash-command-diff/sync.js +2 -2
  267. package/dist/safe-bash-command-du/du.js +2 -2
  268. package/dist/safe-bash-command-du/index.js +2 -2
  269. package/dist/safe-bash-command-ffmpeg/index.js +1 -1
  270. package/dist/safe-bash-command-ffprobe/index.js +2 -2
  271. package/dist/safe-bash-command-ffprobe/media.d.ts +3 -1
  272. package/dist/safe-bash-command-ffprobe/media.js +2 -2
  273. package/dist/safe-bash-command-html-to-markdown/budget.js +2 -1
  274. package/dist/safe-bash-command-html-to-markdown/entities.js +4 -3
  275. package/dist/safe-bash-command-html-to-markdown/index.js +533 -310
  276. package/dist/safe-bash-command-html-to-markdown/input.js +6 -5
  277. package/dist/safe-bash-command-html-to-markdown/options.js +2 -1
  278. package/dist/safe-bash-command-html-to-markdown/parser.js +5 -4
  279. package/dist/safe-bash-command-html-to-markdown/render.js +6 -5
  280. package/dist/safe-bash-command-html-to-markdown/stored-text.d.ts +50 -0
  281. package/dist/safe-bash-command-html-to-markdown/stored-text.js +12 -0
  282. package/dist/safe-bash-command-html-to-markdown/text.js +3 -2
  283. package/dist/safe-bash-command-htmlq/contracts.d.ts +5 -0
  284. package/dist/safe-bash-command-htmlq/index.js +2006 -259
  285. package/dist/safe-bash-command-htmlq/selectors.d.ts +38 -1
  286. package/dist/safe-bash-command-htmlq/serializer.d.ts +1 -0
  287. package/dist/safe-bash-command-htmlq/tree.d.ts +4 -2
  288. package/dist/safe-bash-command-iconv/command.js +2 -2
  289. package/dist/safe-bash-command-iconv/index.js +2 -2
  290. package/dist/safe-bash-command-llm/command.js +3 -3
  291. package/dist/safe-bash-command-llm/index.js +9 -9
  292. package/dist/safe-bash-command-llm/openai.js +2 -2
  293. package/dist/safe-bash-command-llm/providers/index.js +2 -2
  294. package/dist/safe-bash-command-llm/providers/openai.js +2 -2
  295. package/dist/safe-bash-command-node/commands/node/browser.js +2 -2
  296. package/dist/safe-bash-command-node/commands/node/default-runtime.js +2 -2
  297. package/dist/safe-bash-command-node/commands/node/safejs.js +2 -2
  298. package/dist/safe-bash-command-pandoc/command.js +7 -7
  299. package/dist/safe-bash-command-pandoc/index.js +46 -46
  300. package/dist/safe-bash-command-patch/index.js +6 -6
  301. package/dist/safe-bash-command-patch/patch-envelope.js +53 -3
  302. package/dist/safe-bash-command-patch/patch-formats.d.ts +7 -2
  303. package/dist/safe-bash-command-patch/patch-formats.js +6 -4
  304. package/dist/safe-bash-command-patch/patch-gnu-paths.d.ts +7 -7
  305. package/dist/safe-bash-command-patch/patch-gnu-reject.d.ts +3 -2
  306. package/dist/safe-bash-command-patch/patch-gnu-reject.js +4 -3
  307. package/dist/safe-bash-command-patch/patch-publication.js +2 -1
  308. package/dist/safe-bash-command-patch/patch.js +6 -6
  309. package/dist/safe-bash-command-patch/stored-patch.d.ts +26 -0
  310. package/dist/safe-bash-command-patch/stored-target.d.ts +40 -0
  311. package/dist/safe-bash-command-patch/unified.d.ts +23 -10
  312. package/dist/safe-bash-command-patch/unified.js +3 -1
  313. package/dist/safe-bash-command-pdftk/index.d.ts +6 -2
  314. package/dist/safe-bash-command-pdftk/index.js +1247 -373
  315. package/dist/safe-bash-command-playwright-cli/index.js +26 -26
  316. package/dist/safe-bash-command-playwright-cli/playwright/abilities.js +10 -10
  317. package/dist/safe-bash-command-playwright-cli/playwright/controller.js +14 -14
  318. package/dist/safe-bash-command-playwright-cli/playwright/index.js +23 -23
  319. package/dist/safe-bash-command-playwright-cli/playwright/snapshot.js +2 -2
  320. package/dist/safe-bash-command-playwright-cli/playwright/standard-capabilities.js +6 -6
  321. package/dist/safe-bash-command-playwright-cli/playwright/storage-capabilities.js +4 -4
  322. package/dist/safe-bash-command-pptx/command-engine.d.ts +5 -1
  323. package/dist/safe-bash-command-pptx/engine.js +1 -1
  324. package/dist/safe-bash-command-pptx/index.d.ts +1 -1
  325. package/dist/safe-bash-command-pptx/index.js +172 -19
  326. package/dist/safe-bash-command-pptx/streaming-inputs.d.ts +7 -2
  327. package/dist/safe-bash-command-python/executor.js +5 -5
  328. package/dist/safe-bash-command-python/index.js +5 -5
  329. package/dist/safe-bash-command-python/jspi.js +2 -2
  330. package/dist/safe-bash-command-soffice/index.js +1 -1
  331. package/dist/safe-bash-command-sort/index.js +3 -3
  332. package/dist/safe-bash-command-ssconvert/index.js +2 -2
  333. package/dist/safe-bash-command-tar/create.js +2 -2
  334. package/dist/safe-bash-command-tar/extract.js +2 -2
  335. package/dist/safe-bash-command-tar/index.js +8 -8
  336. package/dist/safe-bash-command-tar/modes.js +4 -4
  337. package/dist/safe-bash-command-timeout/index.js +3 -3
  338. package/dist/safe-bash-command-tree/index.js +2 -2
  339. package/dist/safe-bash-command-tree/tree.js +2 -2
  340. package/dist/safe-bash-command-xmllint/index.js +22 -31
  341. package/dist/safe-bash-command-xz/index.js +5 -5
  342. package/dist/safe-bash-compression-engine/files.js +2 -2
  343. package/dist/safe-bash-compression-engine/operand.js +4 -4
  344. package/dist/safe-bash-contracts/diagnostics.js +3 -3
  345. package/dist/safe-bash-contracts/escaping.js +10 -10
  346. package/dist/safe-bash-contracts/filesystem-descriptor.js +1 -1
  347. package/dist/safe-bash-contracts/filesystem-output.js +6 -6
  348. package/dist/safe-bash-contracts/index.js +33 -33
  349. package/dist/safe-bash-contracts/io.js +2 -2
  350. package/dist/safe-bash-contracts/output.js +3 -3
  351. package/dist/safe-bash-docx-engine/ancillary-resources.js +5 -5
  352. package/dist/safe-bash-docx-engine/batch-operations.js +63 -63
  353. package/dist/safe-bash-docx-engine/batch-result-schema.js +74 -74
  354. package/dist/safe-bash-docx-engine/batch.js +74 -74
  355. package/dist/safe-bash-docx-engine/bookmarks.js +13 -13
  356. package/dist/safe-bash-docx-engine/charts.js +6 -6
  357. package/dist/safe-bash-docx-engine/command-option-rules.js +3 -3
  358. package/dist/safe-bash-docx-engine/comments.js +21 -21
  359. package/dist/safe-bash-docx-engine/control-bindings.js +16 -16
  360. package/dist/safe-bash-docx-engine/control-repeat.js +16 -16
  361. package/dist/safe-bash-docx-engine/controls.js +14 -14
  362. package/dist/safe-bash-docx-engine/create.js +8 -8
  363. package/dist/safe-bash-docx-engine/diagrams.js +6 -6
  364. package/dist/safe-bash-docx-engine/diff.js +8 -8
  365. package/dist/safe-bash-docx-engine/document-properties.js +12 -12
  366. package/dist/safe-bash-docx-engine/equations.js +12 -12
  367. package/dist/safe-bash-docx-engine/extract.js +9 -9
  368. package/dist/safe-bash-docx-engine/fields.js +18 -18
  369. package/dist/safe-bash-docx-engine/font-inventory.js +13 -13
  370. package/dist/safe-bash-docx-engine/font-resources.js +3 -3
  371. package/dist/safe-bash-docx-engine/image-batch-operations.js +11 -11
  372. package/dist/safe-bash-docx-engine/image-insertion.js +17 -17
  373. package/dist/safe-bash-docx-engine/image-layout.js +14 -14
  374. package/dist/safe-bash-docx-engine/image-replacement.js +19 -19
  375. package/dist/safe-bash-docx-engine/images.js +14 -14
  376. package/dist/safe-bash-docx-engine/index.js +102 -102
  377. package/dist/safe-bash-docx-engine/inspection.js +15 -15
  378. package/dist/safe-bash-docx-engine/invocation.js +4 -4
  379. package/dist/safe-bash-docx-engine/io.js +6 -6
  380. package/dist/safe-bash-docx-engine/links.js +17 -17
  381. package/dist/safe-bash-docx-engine/lists.js +16 -16
  382. package/dist/safe-bash-docx-engine/locations.js +10 -10
  383. package/dist/safe-bash-docx-engine/notes.js +18 -18
  384. package/dist/safe-bash-docx-engine/objects.js +14 -14
  385. package/dist/safe-bash-docx-engine/pack.js +9 -9
  386. package/dist/safe-bash-docx-engine/package-view-batch-operations.js +19 -19
  387. package/dist/safe-bash-docx-engine/pandoc-adapter.js +25 -25
  388. package/dist/safe-bash-docx-engine/paragraph-edit.js +21 -21
  389. package/dist/safe-bash-docx-engine/publication.js +6 -6
  390. package/dist/safe-bash-docx-engine/removal.js +16 -16
  391. package/dist/safe-bash-docx-engine/revision-decisions.js +16 -16
  392. package/dist/safe-bash-docx-engine/revision-edit.js +15 -15
  393. package/dist/safe-bash-docx-engine/revisions.js +12 -12
  394. package/dist/safe-bash-docx-engine/run-format.js +15 -15
  395. package/dist/safe-bash-docx-engine/sanitize.js +29 -29
  396. package/dist/safe-bash-docx-engine/sections.js +15 -15
  397. package/dist/safe-bash-docx-engine/settings.js +6 -6
  398. package/dist/safe-bash-docx-engine/shape-edit.js +16 -16
  399. package/dist/safe-bash-docx-engine/signatures.js +11 -11
  400. package/dist/safe-bash-docx-engine/stories.js +18 -18
  401. package/dist/safe-bash-docx-engine/structure-model-batch-operations.js +34 -34
  402. package/dist/safe-bash-docx-engine/style-model-batch-operations.js +24 -24
  403. package/dist/safe-bash-docx-engine/style-model-result-schema.js +39 -39
  404. package/dist/safe-bash-docx-engine/styles.js +14 -14
  405. package/dist/safe-bash-docx-engine/table-edit.js +23 -23
  406. package/dist/safe-bash-docx-engine/table-read.js +11 -11
  407. package/dist/safe-bash-docx-engine/template.js +17 -17
  408. package/dist/safe-bash-docx-engine/text-replace.js +15 -15
  409. package/dist/safe-bash-docx-engine/text-resource-read.js +11 -11
  410. package/dist/safe-bash-docx-engine/text.js +11 -11
  411. package/dist/safe-bash-docx-engine/validation.js +4 -4
  412. package/dist/safe-bash-docx-engine/xml-parts.js +17 -17
  413. package/dist/safe-bash-io-engine/commands/text-programs/shared.js +4 -4
  414. package/dist/safe-bash-line-ending-engine/command.js +3 -3
  415. package/dist/safe-bash-line-ending-engine/convert.js +2 -2
  416. package/dist/safe-bash-line-ending-engine/index.js +6 -6
  417. package/dist/safe-bash-line-ending-engine/info.js +2 -2
  418. package/dist/safe-bash-markdown-engine/commonmark-blocks.js +4 -4
  419. package/dist/safe-bash-markdown-engine/commonmark-inlines.js +4 -4
  420. package/dist/safe-bash-markdown-engine/commonmark-syntax.js +2 -2
  421. package/dist/safe-bash-markdown-engine/gfm-syntax.js +3 -3
  422. package/dist/safe-bash-markdown-engine/index.js +5 -5
  423. package/dist/safe-bash-network-engine/transfer.js +3 -3
  424. package/dist/safe-bash-presentation-engine/accessibility.js +31 -30
  425. package/dist/safe-bash-presentation-engine/animation-editing.js +16 -15
  426. package/dist/safe-bash-presentation-engine/animations.js +16 -15
  427. package/dist/safe-bash-presentation-engine/backgrounds.js +17 -16
  428. package/dist/safe-bash-presentation-engine/bytes.js +3 -3
  429. package/dist/safe-bash-presentation-engine/chart-editing.js +34 -33
  430. package/dist/safe-bash-presentation-engine/chart-object-operations.js +25 -24
  431. package/dist/safe-bash-presentation-engine/charts.js +31 -30
  432. package/dist/safe-bash-presentation-engine/command-placeholder.js +59 -56
  433. package/dist/safe-bash-presentation-engine/comments.js +17 -16
  434. package/dist/safe-bash-presentation-engine/connector-operations.js +32 -31
  435. package/dist/safe-bash-presentation-engine/connectors.js +29 -28
  436. package/dist/safe-bash-presentation-engine/content-types.js +4 -4
  437. package/dist/safe-bash-presentation-engine/creation.js +6 -6
  438. package/dist/safe-bash-presentation-engine/diff.js +32 -31
  439. package/dist/safe-bash-presentation-engine/drawing-enums.d.ts +10 -10
  440. package/dist/safe-bash-presentation-engine/drawing-format.js +20 -19
  441. package/dist/safe-bash-presentation-engine/drawing-operations.js +31 -30
  442. package/dist/safe-bash-presentation-engine/drawing-schema.js +21 -20
  443. package/dist/safe-bash-presentation-engine/equations.js +17 -16
  444. package/dist/safe-bash-presentation-engine/errors.js +2 -2
  445. package/dist/safe-bash-presentation-engine/fields.js +17 -16
  446. package/dist/safe-bash-presentation-engine/font-metrics.js +3 -3
  447. package/dist/safe-bash-presentation-engine/image-extraction.js +20 -19
  448. package/dist/safe-bash-presentation-engine/image-formatting.js +32 -31
  449. package/dist/safe-bash-presentation-engine/image-insertion.js +18 -17
  450. package/dist/safe-bash-presentation-engine/image-replacement.js +21 -20
  451. package/dist/safe-bash-presentation-engine/image-value.js +4 -4
  452. package/dist/safe-bash-presentation-engine/images.js +19 -18
  453. package/dist/safe-bash-presentation-engine/index.d.ts +5 -1
  454. package/dist/safe-bash-presentation-engine/index.js +121 -108
  455. package/dist/safe-bash-presentation-engine/layouts.js +16 -15
  456. package/dist/safe-bash-presentation-engine/length.js +3 -3
  457. package/dist/safe-bash-presentation-engine/links.js +16 -15
  458. package/dist/safe-bash-presentation-engine/masters.js +15 -14
  459. package/dist/safe-bash-presentation-engine/media-editing.js +24 -23
  460. package/dist/safe-bash-presentation-engine/media-extraction.js +17 -16
  461. package/dist/safe-bash-presentation-engine/media.js +16 -15
  462. package/dist/safe-bash-presentation-engine/memberships.js +15 -14
  463. package/dist/safe-bash-presentation-engine/notes.js +16 -15
  464. package/dist/safe-bash-presentation-engine/ole-enum.js +4 -4
  465. package/dist/safe-bash-presentation-engine/ole-insertion.js +20 -19
  466. package/dist/safe-bash-presentation-engine/opaque-objects.js +9 -9
  467. package/dist/safe-bash-presentation-engine/package-reader.js +5 -5
  468. package/dist/safe-bash-presentation-engine/package-tools.d.ts +3 -0
  469. package/dist/safe-bash-presentation-engine/package-tools.js +27 -17
  470. package/dist/safe-bash-presentation-engine/package-uri.js +3 -3
  471. package/dist/safe-bash-presentation-engine/package-writer.js +4 -4
  472. package/dist/safe-bash-presentation-engine/presentation-model.js +58 -55
  473. package/dist/safe-bash-presentation-engine/presentation-settings.js +14 -13
  474. package/dist/safe-bash-presentation-engine/properties.js +16 -15
  475. package/dist/safe-bash-presentation-engine/relationships.js +4 -4
  476. package/dist/safe-bash-presentation-engine/resource-limits.js +1 -1
  477. package/dist/safe-bash-presentation-engine/retained-archive-staging.d.ts +19 -0
  478. package/dist/safe-bash-presentation-engine/retained-extraction-output.d.ts +18 -0
  479. package/dist/safe-bash-presentation-engine/retained-frame-formatting.d.ts +14 -0
  480. package/dist/safe-bash-presentation-engine/retained-inspection.js +14 -12
  481. package/dist/safe-bash-presentation-engine/retained-package-extraction.d.ts +22 -0
  482. package/dist/safe-bash-presentation-engine/retained-package-packing.d.ts +19 -0
  483. package/dist/safe-bash-presentation-engine/retained-package.d.ts +2 -0
  484. package/dist/safe-bash-presentation-engine/retained-package.js +6 -4
  485. package/dist/safe-bash-presentation-engine/retained-text.d.ts +9 -2
  486. package/dist/safe-bash-presentation-engine/retained-text.js +131 -30
  487. package/dist/safe-bash-presentation-engine/retained-xml-document.d.ts +1 -0
  488. package/dist/safe-bash-presentation-engine/retained-xml-parts.d.ts +5 -1
  489. package/dist/safe-bash-presentation-engine/retained-xml-publication.d.ts +18 -0
  490. package/dist/safe-bash-presentation-engine/retained-xml-replacement.d.ts +13 -0
  491. package/dist/safe-bash-presentation-engine/sanitize.js +17 -16
  492. package/dist/safe-bash-presentation-engine/selectors.js +10 -10
  493. package/dist/safe-bash-presentation-engine/shape-groups.js +31 -30
  494. package/dist/safe-bash-presentation-engine/shape-operations.js +30 -29
  495. package/dist/safe-bash-presentation-engine/shape-path-operations.js +32 -31
  496. package/dist/safe-bash-presentation-engine/shape-paths.js +16 -15
  497. package/dist/safe-bash-presentation-engine/shape-presets.js +3 -3
  498. package/dist/safe-bash-presentation-engine/shape-selection.js +31 -30
  499. package/dist/safe-bash-presentation-engine/shape-transforms.js +18 -17
  500. package/dist/safe-bash-presentation-engine/shapes.d.ts +1 -1
  501. package/dist/safe-bash-presentation-engine/shapes.js +27 -26
  502. package/dist/safe-bash-presentation-engine/slide-copy.js +17 -16
  503. package/dist/safe-bash-presentation-engine/slide-import.js +18 -17
  504. package/dist/safe-bash-presentation-engine/slide-merge-split.js +20 -19
  505. package/dist/safe-bash-presentation-engine/slide-model.js +43 -42
  506. package/dist/safe-bash-presentation-engine/slide-removal.js +18 -17
  507. package/dist/safe-bash-presentation-engine/slide-transfer-budget.js +9 -9
  508. package/dist/safe-bash-presentation-engine/slides.js +19 -16
  509. package/dist/safe-bash-presentation-engine/table-operations.js +33 -32
  510. package/dist/safe-bash-presentation-engine/table-spans.js +32 -31
  511. package/dist/safe-bash-presentation-engine/tables.js +31 -30
  512. package/dist/safe-bash-presentation-engine/tags.js +16 -15
  513. package/dist/safe-bash-presentation-engine/template-bindings.js +33 -32
  514. package/dist/safe-bash-presentation-engine/template-repeat.js +40 -39
  515. package/dist/safe-bash-presentation-engine/text-fitting.js +27 -26
  516. package/dist/safe-bash-presentation-engine/text-frames.d.ts +13 -0
  517. package/dist/safe-bash-presentation-engine/text-frames.js +29 -26
  518. package/dist/safe-bash-presentation-engine/text-paragraphs.js +27 -26
  519. package/dist/safe-bash-presentation-engine/text-reading.js +11 -11
  520. package/dist/safe-bash-presentation-engine/text-replacement.js +17 -16
  521. package/dist/safe-bash-presentation-engine/text-runs.js +20 -19
  522. package/dist/safe-bash-presentation-engine/themes.js +16 -15
  523. package/dist/safe-bash-presentation-engine/transitions.js +16 -15
  524. package/dist/safe-bash-presentation-engine/validation.js +10 -9
  525. package/dist/safe-bash-presentation-engine/xml-parts.d.ts +2 -0
  526. package/dist/safe-bash-presentation-engine/xml-parts.js +23 -15
  527. package/dist/safe-bash-presentation-engine/xml-view.js +3 -3
  528. package/dist/safe-bash-presentation-engine/xml.js +3 -3
  529. package/dist/safe-bash-query-engine/index.js +4 -4
  530. package/dist/safe-bash-query-engine/interpreter.js +2 -2
  531. package/dist/safe-bash-query-engine/query-core.js +4 -4
  532. package/dist/safe-bash-regex-engine/index.js +1 -1
  533. package/dist/safe-bash-regex-engine/python-glob.js +1 -1
  534. package/dist/safe-bash-regex-engine/text/regex.d.ts +19 -0
  535. package/dist/safe-bash-regex-engine/text/regex.js +1 -1
  536. package/dist/safe-bash-xml-engine/document.js +3 -3
  537. package/dist/safe-bash-xml-engine/evaluate.js +1 -1
  538. package/dist/safe-bash-xml-engine/index.d.ts +1 -0
  539. package/dist/safe-bash-xml-engine/index.js +9 -5
  540. package/dist/safe-bash-xml-engine/query.js +2 -2
  541. package/dist/safe-bash-xml-engine/recovery.d.ts +10 -0
  542. package/dist/safe-bash-xml-engine/stored-document.d.ts +3 -3
  543. package/dist/safe-bash-xml-engine/stored-document.js +1 -1
  544. package/dist/safe-bash-xml-engine/stored-evaluate.js +1 -1
  545. package/dist/safe-bash-zip-engine/zip/repair.js +3 -3
  546. package/dist/safe-bash-zip-engine/zip/volumes.js +3 -3
  547. package/dist/spreadsheet-engine/datasource.js +16 -2
  548. package/dist/spreadsheet-engine/formulas/diagnostics.d.ts +2 -1
  549. package/dist/spreadsheet-engine/formulas/diagnostics.js +2 -2
  550. package/dist/spreadsheet-engine/formulas/evaluator.d.ts +1 -1
  551. package/dist/spreadsheet-engine/formulas/evaluator.js +2 -1
  552. package/dist/spreadsheet-engine/formulas/functions/python-printf.js +56 -33
  553. package/dist/spreadsheet-format-xls/biff-encrypted-properties.d.ts +1 -1
  554. package/dist/spreadsheet-format-xls/biff-encrypted-properties.js +54 -24
  555. package/dist/spreadsheet-format-xls/biff-properties-merge.d.ts +6 -2
  556. package/dist/spreadsheet-format-xls/biff-properties-merge.js +413 -296
  557. package/dist/spreadsheet-format-xls/biff-properties-write.js +40 -23
  558. package/dist/spreadsheet-format-xls/biff-properties.js +95 -175
  559. package/dist/spreadsheet-format-xls/biff-property-dictionary.d.ts +5 -0
  560. package/dist/spreadsheet-format-xls/biff-property-dictionary.js +75 -0
  561. package/dist/spreadsheet-format-xls/biff-property-index.d.ts +23 -0
  562. package/dist/spreadsheet-format-xls/biff-property-index.js +93 -0
  563. package/dist/spreadsheet-format-xls/biff-property-name.d.ts +4 -0
  564. package/dist/spreadsheet-format-xls/biff-property-name.js +114 -0
  565. package/dist/spreadsheet-format-xls/biff-property-range.d.ts +17 -3
  566. package/dist/spreadsheet-format-xls/biff-property-range.js +178 -37
  567. package/dist/spreadsheet-format-xls/biff-property-text.d.ts +6 -0
  568. package/dist/spreadsheet-format-xls/biff-property-text.js +68 -0
  569. package/dist/spreadsheet-format-xls/biff-property-transcode.d.ts +5 -0
  570. package/dist/spreadsheet-format-xls/biff-property-transcode.js +45 -0
  571. package/package.json +8 -3
  572. package/dist/safe-bash/command-chunks/biff-YKPDH35C-MVQIWNKV.js +0 -4974
  573. package/dist/safe-bash/command-chunks/chunk-2VLAXKTS.js +0 -245
  574. package/dist/safe-bash/command-chunks/chunk-5Q22ZLNC.js +0 -127
  575. package/dist/safe-bash/command-chunks/chunk-JKLOBSMP.js +0 -56
  576. package/dist/safe-bash/command-chunks/chunk-JYTESTBS.js +0 -99
  577. package/dist/safe-bash/command-chunks/chunk-ZEGNRZV2.js +0 -333
  578. package/dist/safe-bash/command-chunks/paradox-ZWWXYY4J-JYOSWSBL.js +0 -362
  579. package/dist/spreadsheet-format-xls/biff-properties-layout.js +0 -56
  580. package/dist/safe-bash/command-chunks/{chunk-X2HVVMTW.js → chunk-AW4Q3GZW.js} +6 -6
  581. package/dist/safe-bash/command-chunks/{chunk-JC2EV66U.js → chunk-BJXADHRT.js} +3 -3
  582. package/dist/safe-bash/command-chunks/{chunk-XI2LETBJ.js → chunk-BXU5Y7I5.js} +3 -3
  583. package/dist/safe-bash/command-chunks/{chunk-PVLPWVRH.js → chunk-D3HW7R2N.js} +3 -3
  584. package/dist/safe-bash/command-chunks/{chunk-OLK3DCJD.js → chunk-DYERIXPU.js} +3 -3
  585. package/dist/safe-bash/command-chunks/{chunk-WYBCSJFG.js → chunk-FWCUEZ3K.js} +3 -3
  586. package/dist/safe-bash/command-chunks/{chunk-FF2SQ2GP.js → chunk-GGH376XQ.js} +3 -3
  587. package/dist/safe-bash/command-chunks/{chunk-D66Q7QJ3.js → chunk-JRSZ5IGD.js} +6 -6
  588. package/dist/safe-bash/command-chunks/{chunk-Z3YB4EVE.js → chunk-KSM5CCHT.js} +8 -8
  589. package/dist/safe-bash/command-chunks/{chunk-NJ4NTTCR.js → chunk-LNLACEAN.js} +8 -8
  590. package/dist/safe-bash/command-chunks/{chunk-NBTG6NF6.js → chunk-LTJRUMK6.js} +3 -3
  591. package/dist/safe-bash/command-chunks/{chunk-XCYTG7CR.js → chunk-NJGL5JQ6.js} +3 -3
  592. package/dist/safe-bash/command-chunks/{chunk-SZ66JC25.js → chunk-Q7J2NTH2.js} +3 -3
  593. package/dist/safe-bash/command-chunks/{chunk-MDV7W5AS.js → chunk-SKNI2XQA.js} +3 -3
  594. package/dist/safe-bash/command-chunks/{chunk-7ZWACKCG.js → chunk-T6OXG7QQ.js} +3 -3
  595. package/dist/safe-bash/command-chunks/{chunk-ECDEPKKW.js → chunk-W25EIKDJ.js} +3 -3
  596. package/dist/safe-bash/command-chunks/{chunk-4YSBUQPV.js → chunk-W2FKFEVY.js} +3 -3
  597. package/dist/safe-bash/command-chunks/{chunk-2CIDPOUV.js → chunk-WSNHJZQ5.js} +3 -3
  598. package/dist/safe-bash/command-chunks/{chunk-4H3TYOVC.js → chunk-Y7AXMCFV.js} +3 -3
  599. package/dist/safe-bash/command-chunks/{chunk-U6IEK2CI.js → chunk-YPG55QTP.js} +7 -7
  600. package/dist/safe-bash/command-chunks/{chunk-252L5YC5.js → chunk-Z37OM247.js} +6 -6
  601. package/dist/safe-bash/command-chunks/{pln-DFS7VLVS-JATX6FS7.js → pln-DFS7VLVS-OVOBS4QX.js} +3 -3
  602. package/dist/safe-bash/command-chunks/{psion-YBI6JEQI-6OMC2PGC.js → psion-YBI6JEQI-GY4S6ZLC.js} +3 -3
@@ -1,20 +1,25 @@
1
1
  import {
2
- PatchPublication,
2
+ PatchBodyStore,
3
+ patchLine,
4
+ rejectBytes,
5
+ reverseStoredPatch
6
+ } from "./chunk-3JM7E42I.js";
7
+ import {
8
+ PatchPublication
9
+ } from "./chunk-5BIQWWLB.js";
10
+ import {
3
11
  TargetDocuments,
4
12
  TargetOutput,
5
13
  equalTargetLines,
6
14
  targetBytes
7
- } from "./chunk-ZEGNRZV2.js";
15
+ } from "./chunk-CK2WFJZN.js";
8
16
  import {
9
- unwrapPatch
10
- } from "./chunk-JKLOBSMP.js";
17
+ parsePatchWith
18
+ } from "./chunk-SW37YCBW.js";
11
19
  import {
12
- parsePatch
13
- } from "./chunk-2VLAXKTS.js";
14
- import {
15
- reversePatch,
20
+ parseUnifiedReader,
16
21
  startIndex
17
- } from "./chunk-MOZD7RUY.js";
22
+ } from "./chunk-VT7UBPAE.js";
18
23
  import {
19
24
  authorizeOutputs,
20
25
  authorizePaths,
@@ -30,11 +35,14 @@ import {
30
35
  import {
31
36
  safeTarget
32
37
  } from "./chunk-AJEQUVDN.js";
33
- import {
34
- rejectText
35
- } from "./chunk-JYTESTBS.js";
38
+
39
+ // packages/safe-bash-command-patch/src/patch.ts
40
+ import { closeDocumentResources as closeDocumentResources2 } from "../../safe-bash-diff-engine/document.js";
41
+ import { PagedStorage as PagedStorage2 } from "@poe-platform/safe-fs/storage";
36
42
 
37
43
  // packages/safe-bash-command-patch/src/stored-hunks.ts
44
+ import { closeDocumentResources } from "../../safe-bash-diff-engine/document.js";
45
+ import { PagedStorage } from "@poe-platform/safe-fs/storage";
38
46
  import { ToolError } from "../../safe-bash-diff-engine/shared.js";
39
47
  async function applyStoredHunks(original, patch, fuzz, budget, ignoreWhitespace = false, application, documents) {
40
48
  const source = { length: original.length, at(index) {
@@ -42,17 +50,39 @@ async function applyStoredHunks(original, patch, fuzz, budget, ignoreWhitespace
42
50
  } };
43
51
  budget.countLines(source.length);
44
52
  const result = new TargetOutput(documents);
53
+ const indices = new PagedStorage(budget.context, 16, documents.cache);
45
54
  try {
46
55
  let cursor = 0;
47
56
  let offset = 0;
48
57
  let outputOffset = 0;
49
58
  for (const [hunkIndex, hunk] of patch.hunks.entries()) {
50
59
  budget.step();
51
- const oldLines = hunk.lines.filter((line) => line.kind !== "+");
60
+ const oldIndex = indices.allocate((hunk.oldCount + hunk.newCount) * 8), newIndex = oldIndex + hunk.oldCount * 8;
61
+ let oldPosition = oldIndex, newPosition = newIndex;
62
+ const cell = new Uint8Array(8), view = new DataView(cell.buffer);
63
+ for (let index = 0; index < hunk.lines.length; index++) {
64
+ view.setFloat64(0, index, true);
65
+ const line = await patchLine(hunk, index);
66
+ if (line.kind !== "+") {
67
+ await indices.write(oldPosition, cell);
68
+ oldPosition += 8;
69
+ }
70
+ if (line.kind !== "-") {
71
+ await indices.write(newPosition, cell);
72
+ newPosition += 8;
73
+ }
74
+ budget.step();
75
+ const pause = budget.checkpoint();
76
+ if (pause) await pause;
77
+ }
78
+ const indexedLine = async (base, index) => {
79
+ const bytes = await indices.read(base + index * 8, 8);
80
+ return (await patchLine(hunk, new DataView(bytes.buffer).getFloat64(0, true))).text;
81
+ };
52
82
  let leading = 0;
53
83
  let trailing = 0;
54
- while (leading < hunk.lines.length && hunk.lines[leading].kind === " ") leading++;
55
- while (trailing < hunk.lines.length - leading && hunk.lines[hunk.lines.length - trailing - 1].kind === " ") trailing++;
84
+ while (leading < hunk.lines.length && (await patchLine(hunk, leading)).kind === " ") leading++;
85
+ while (trailing < hunk.lines.length - leading && (await patchLine(hunk, hunk.lines.length - trailing - 1)).kind === " ") trailing++;
56
86
  const expected = startIndex(hunk.oldStart, hunk.oldCount) + offset;
57
87
  let found = -1;
58
88
  let misordered = false;
@@ -65,11 +95,11 @@ async function applyStoredHunks(original, patch, fuzz, budget, ignoreWhitespace
65
95
  if (c) await c;
66
96
  }
67
97
  if (position < 0 || position > source.length - hunk.oldCount + suffixFuzz) return false;
68
- for (let lineIndex = 0; lineIndex < oldLines.length; lineIndex++) {
69
- if (lineIndex < prefixFuzz || lineIndex >= oldLines.length - suffixFuzz) continue;
98
+ for (let lineIndex = 0; lineIndex < hunk.oldCount; lineIndex++) {
99
+ if (lineIndex < prefixFuzz || lineIndex >= hunk.oldCount - suffixFuzz) continue;
70
100
  const actual = source.at(position + lineIndex);
71
101
  if (actual === void 0) return false;
72
- const expectedLine = oldLines[lineIndex].text;
102
+ const expectedLine = await indexedLine(oldIndex, lineIndex);
73
103
  if (!await equalTargetLines(actual, expectedLine, budget, ignoreWhitespace)) return false;
74
104
  {
75
105
  const c = budget.checkpoint();
@@ -105,7 +135,7 @@ async function applyStoredHunks(original, patch, fuzz, budget, ignoreWhitespace
105
135
  if (found >= 0) break;
106
136
  continue;
107
137
  }
108
- const retained = oldLines.length - Math.max(0, prefixFuzz) - suffixFuzz;
138
+ const retained = hunk.oldCount - Math.max(0, prefixFuzz) - suffixFuzz;
109
139
  if (retained === 0) {
110
140
  if (await matches(expected, Math.max(0, prefixFuzz), suffixFuzz)) {
111
141
  found = expected;
@@ -152,48 +182,46 @@ async function applyStoredHunks(original, patch, fuzz, budget, ignoreWhitespace
152
182
  if (found < 0 && application.merge && !misordered) {
153
183
  const position = Math.max(cursor, Math.min(source.length, expected));
154
184
  while (cursor < position) await result.append(source.at(cursor++));
155
- let local = Array.from({ length: Math.min(hunk.oldCount, source.length - cursor) }, (_, index) => source.at(cursor + index));
185
+ let localLength = Math.min(hunk.oldCount, source.length - cursor);
156
186
  let anchored = false;
157
- for (let index = 0; index < oldLines.length; index++) {
158
- if (await equalTargetLines(oldLines[index].text, local[index] ?? "", budget)) {
187
+ for (let index = 0; index < hunk.oldCount; index++) {
188
+ if (await equalTargetLines(await indexedLine(oldIndex, index), index < localLength ? source.at(cursor + index) : "", budget)) {
159
189
  anchored = true;
160
190
  break;
161
191
  }
162
192
  }
163
- if (!anchored) local = [];
164
- const incoming = hunk.lines.filter((line) => line.kind !== "-").map((line) => line.text);
165
- const base = oldLines.map((line) => line.text);
193
+ if (!anchored) localLength = 0;
166
194
  let prefix = 0;
167
195
  let suffix = 0;
168
- while (prefix < Math.min(local.length, incoming.length, base.length) && await equalTargetLines(local[prefix], incoming[prefix], budget) && await equalTargetLines(local[prefix], base[prefix], budget)) prefix++;
169
- while (suffix < Math.min(local.length, incoming.length, base.length) - prefix && await equalTargetLines(local[local.length - suffix - 1], incoming[incoming.length - suffix - 1], budget) && await equalTargetLines(local[local.length - suffix - 1], base[base.length - suffix - 1], budget)) suffix++;
196
+ while (prefix < Math.min(localLength, hunk.newCount, hunk.oldCount) && await equalTargetLines(source.at(cursor + prefix), await indexedLine(newIndex, prefix), budget) && await equalTargetLines(source.at(cursor + prefix), await indexedLine(oldIndex, prefix), budget)) prefix++;
197
+ while (suffix < Math.min(localLength, hunk.newCount, hunk.oldCount) - prefix && await equalTargetLines(source.at(cursor + localLength - suffix - 1), await indexedLine(newIndex, hunk.newCount - suffix - 1), budget) && await equalTargetLines(source.at(cursor + localLength - suffix - 1), await indexedLine(oldIndex, hunk.oldCount - suffix - 1), budget)) suffix++;
170
198
  {
171
199
  const c = budget.checkpoint();
172
200
  if (c) await c;
173
201
  }
174
- for (const line of local.slice(0, prefix)) await result.append(line);
202
+ for (let index = 0; index < prefix; index++) await result.append(source.at(cursor + index));
175
203
  const mergeStart = result.length + 1;
176
- let identical = local.length === incoming.length;
177
- for (let index = 0; identical && index < local.length; index++) identical = await equalTargetLines(local[index], incoming[index], budget);
204
+ let identical = localLength === hunk.newCount;
205
+ for (let index = 0; identical && index < localLength; index++) identical = await equalTargetLines(source.at(cursor + index), await indexedLine(newIndex, index), budget);
178
206
  if (identical) {
179
207
  const last = application.outcomes?.pop();
180
208
  if (last) application.outcomes.push({ ...last, failed: false, fuzz: 0, offset: position - startIndex(hunk.oldStart, hunk.oldCount) });
181
- for (const line of local.slice(prefix, local.length - suffix)) await result.append(line);
209
+ for (let index = prefix; index < localLength - suffix; index++) await result.append(source.at(cursor + index));
182
210
  } else {
183
211
  await result.append("<<<<<<<\n");
184
- for (const line of local.slice(prefix, local.length - suffix)) await result.append(line);
212
+ for (let index = prefix; index < localLength - suffix; index++) await result.append(source.at(cursor + index));
185
213
  if (application.merge === "diff3") {
186
214
  await result.append("|||||||\n");
187
- for (const line of base.slice(prefix, base.length - suffix)) await result.append(line);
215
+ for (let index = prefix; index < hunk.oldCount - suffix; index++) await result.append(await indexedLine(oldIndex, index));
188
216
  }
189
217
  await result.append("=======\n");
190
- for (const line of incoming.slice(prefix, incoming.length - suffix)) await result.append(line);
218
+ for (let index = prefix; index < hunk.newCount - suffix; index++) await result.append(await indexedLine(newIndex, index));
191
219
  await result.append(">>>>>>>\n");
192
220
  const last = application.outcomes?.pop();
193
221
  if (last) application.outcomes.push({ ...last, mergeRange: [mergeStart, result.length] });
194
222
  }
195
- for (const line of local.slice(local.length - suffix)) await result.append(line);
196
- cursor += local.length;
223
+ for (let index = localLength - suffix; index < localLength; index++) await result.append(source.at(cursor + index));
224
+ cursor += localLength;
197
225
  outputOffset = result.length - cursor;
198
226
  continue;
199
227
  }
@@ -202,46 +230,130 @@ async function applyStoredHunks(original, patch, fuzz, budget, ignoreWhitespace
202
230
  throw new ToolError(`hunk ${hunkIndex + 1} does not match ${patch.oldPath}`, 1);
203
231
  }
204
232
  while (cursor < found + matchedPrefixFuzz) await result.append(source.at(cursor++));
205
- let removed = [];
206
- let added = [];
207
- const flush = async () => {
208
- if (!removed.length && !added.length) return;
233
+ let changeStart = matchedPrefixFuzz, changeCursor = cursor;
234
+ const flush = async (end) => {
235
+ let removed = 0, added = 0;
236
+ for (let index = changeStart; index < end; index++) {
237
+ if ((await patchLine(hunk, index)).kind === "+") added++;
238
+ else removed++;
239
+ budget.step();
240
+ const pause = budget.checkpoint();
241
+ if (pause) await pause;
242
+ }
243
+ if (!removed && !added) return;
209
244
  if (application.ifdef) {
210
- await result.append(`#${removed.length ? "ifndef" : "ifdef"} ${application.ifdef}
245
+ await result.append(`#${removed ? "ifndef" : "ifdef"} ${application.ifdef}
211
246
  `);
212
- for (const text of removed) await result.append(text);
213
- if (removed.length && added.length) await result.append("#else\n");
214
- for (const text of added) await result.append(text);
215
- await result.append("#endif\n");
216
- } else for (const text of added) await result.append(text);
217
- removed = [];
218
- added = [];
247
+ let position = changeCursor;
248
+ for (let index = changeStart; index < end; index++) if ((await patchLine(hunk, index)).kind === "-") await result.append(source.at(position++) ?? (await patchLine(hunk, index)).text);
249
+ if (removed && added) await result.append("#else\n");
250
+ }
251
+ for (let index = changeStart; index < end; index++) if ((await patchLine(hunk, index)).kind === "+") await result.append((await patchLine(hunk, index)).text);
252
+ if (application.ifdef) await result.append("#endif\n");
219
253
  };
220
- for (const line of hunk.lines.slice(matchedPrefixFuzz, hunk.lines.length - matchedSuffixFuzz)) {
221
- if (line.kind === "+") added.push(line.text);
222
- else if (line.kind === " ") {
223
- await flush();
254
+ for (let index = matchedPrefixFuzz; index < hunk.lines.length - matchedSuffixFuzz; index++) {
255
+ const line = await patchLine(hunk, index);
256
+ if (line.kind === " ") {
257
+ await flush(index);
224
258
  if (cursor < source.length) await result.append(source.at(cursor++));
225
- } else {
226
- removed.push(source.at(cursor) ?? line.text);
227
- cursor++;
228
- }
259
+ changeStart = index + 1;
260
+ changeCursor = cursor;
261
+ } else if (line.kind === "-") cursor++;
229
262
  }
230
- await flush();
263
+ await flush(hunk.lines.length - matchedSuffixFuzz);
231
264
  outputOffset = result.length - cursor;
232
265
  }
233
266
  while (cursor < source.length) await result.append(source.at(cursor++));
234
267
  return await result.finish();
235
268
  } finally {
236
- await result.close();
269
+ await closeDocumentResources([result, indices]);
237
270
  }
238
271
  }
239
272
 
273
+ // packages/safe-bash-command-patch/src/stored-input.ts
274
+ import { ToolError as ToolError2 } from "../../safe-bash-diff-engine/shared.js";
275
+ var StoredPatchInput = class {
276
+ constructor(document, crlf = false, start = 0, length = document.length - start) {
277
+ this.document = document;
278
+ this.crlf = crlf;
279
+ this.start = start;
280
+ this.length = length;
281
+ }
282
+ document;
283
+ crlf;
284
+ start;
285
+ length;
286
+ cachedIndex = -1;
287
+ cachedLine = "";
288
+ async read(index) {
289
+ if (index < 0 || index >= this.length) return void 0;
290
+ if (index === this.cachedIndex) return this.cachedLine;
291
+ const line = await this.document.line(this.start + index);
292
+ const decoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
293
+ let text = "";
294
+ for await (const block of this.document.range(line.start, line.end - (this.crlf ? 2 : 1))) text += decoder.decode(block, { stream: true });
295
+ text += decoder.decode();
296
+ this.cachedIndex = index;
297
+ this.cachedLine = text;
298
+ return text;
299
+ }
300
+ async signature(index) {
301
+ const line = await this.document.line(this.start + index);
302
+ if (line.end - line.start !== (this.crlf ? 5 : 4)) return false;
303
+ const bytes = await this.document.data.read(8 + line.start, 3);
304
+ return bytes[0] === 45 && bytes[1] === 45 && bytes[2] === 32;
305
+ }
306
+ };
307
+ async function unwrapStoredPatch(document, budget) {
308
+ if (document.size && (await document.data.read(8 + document.size - 1, 1))[0] !== 10) throw new ToolError2("patch is truncated: missing final LF");
309
+ let crlf = true;
310
+ for (let index = 0; index < document.length; index++) {
311
+ const line = await document.line(index);
312
+ budget.step(line.end - line.start);
313
+ const pause = budget.checkpoint();
314
+ if (pause) await pause;
315
+ if (line.end - line.start < 2 || (await document.data.read(8 + line.end - 2, 1))[0] !== 13) {
316
+ crlf = false;
317
+ break;
318
+ }
319
+ if (index + 1 > budget.limits.maxLines) throw new ToolError2("transport line limit exceeded");
320
+ }
321
+ const input = new StoredPatchInput(document, crlf);
322
+ let start = 0;
323
+ if (/^(?:From [0-9a-f]{40,64} |(?:From|Date|Subject|To|Cc|MIME-Version|Content-Type):)/u.test(await input.read(0) ?? "")) {
324
+ while (start < input.length) {
325
+ budget.step();
326
+ const pause = budget.checkpoint();
327
+ if (pause) await pause;
328
+ const line = await input.read(start);
329
+ if (/^(?:--- |\*\*\* |diff |\d+(?:,\d+)?[acd]\d)/u.test(line)) break;
330
+ if (/^(?:old mode |new mode |new file mode |deleted file mode |rename |copy |similarity index |dissimilarity index |GIT binary patch|Binary files |index |@@|[+\\])/u.test(line)) throw new ToolError2("unsupported or malformed mail patch metadata");
331
+ if (++start > budget.limits.maxLines) throw new ToolError2("mail preamble limit exceeded");
332
+ }
333
+ if (start === input.length) throw new ToolError2("mail preamble without patch");
334
+ }
335
+ let end = input.length;
336
+ for (let index = start + 1; index < input.length; index++) {
337
+ budget.step();
338
+ const pause = budget.checkpoint();
339
+ if (pause) await pause;
340
+ if (!await input.signature(index)) continue;
341
+ end = index;
342
+ if (input.length - index > budget.limits.maxLines) throw new ToolError2("mail signature limit exceeded");
343
+ for (index++; index < input.length; index++) {
344
+ budget.step();
345
+ const pause2 = budget.checkpoint();
346
+ if (pause2) await pause2;
347
+ if (/^(?:diff |---|\+\+\+|\*\*\*|@@|index |old mode |new mode |new file mode |deleted file mode |rename |copy |similarity index |dissimilarity index |GIT binary patch|Binary files |[+\\]|\d+(?:,\d+)?[acd]\d)/u.test(await input.read(index))) throw new ToolError2("patch data after mail signature");
348
+ }
349
+ }
350
+ return new StoredPatchInput(document, crlf, start, end - start);
351
+ }
352
+
240
353
  // packages/safe-bash-command-patch/src/patch.ts
241
- import { FsError, dirname, pipeBytes, resolvePath, writeBytes } from "../../safe-bash-contracts/index.js";
354
+ import { FsError, dirname, pathOf, pipeBytes, resolvePath, writeBytes } from "../../safe-bash-contracts/index.js";
242
355
  import { publicDiagnosticMessage } from "../../safe-bash-contracts/diagnostics.js";
243
- import { Budget as Budget2, ToolError as ToolError2, definition, host, inspect, integer } from "../../safe-bash-diff-engine/shared.js";
244
- import { encodeBytes } from "../../safe-bash-io-engine/byte-encoding.js";
356
+ import { Budget as Budget3, ToolError as ToolError3, definition, host, inspect, integer } from "../../safe-bash-diff-engine/shared.js";
245
357
  function flags(args) {
246
358
  const result = { input: "-", reverse: false, dryRun: false, atomic: false, quiet: false, force: false, backup: true, fuzz: 2, ignoreWhitespace: false, removeEmpty: false };
247
359
  const operands = [];
@@ -252,7 +364,7 @@ function flags(args) {
252
364
  if (["simple", "never"].includes(parameter)) result.versionControl = "simple";
253
365
  else if (["numbered", "t"].includes(parameter)) result.versionControl = "numbered";
254
366
  else if (["existing", "nil"].includes(parameter)) result.versionControl = "existing";
255
- else throw new ToolError2(`invalid version control: ${parameter}`);
367
+ else throw new ToolError3(`invalid version control: ${parameter}`);
256
368
  };
257
369
  let literal = false;
258
370
  let backupSelected = false;
@@ -260,7 +372,7 @@ function flags(args) {
260
372
  const arg = args[index];
261
373
  const value = (attached, name) => {
262
374
  const next = attached ?? args[++index];
263
- if (next === void 0) throw new ToolError2(`${name} requires an argument`);
375
+ if (next === void 0) throw new ToolError3(`${name} requires an argument`);
264
376
  return next;
265
377
  };
266
378
  if (literal || arg === "-" || !arg.startsWith("-")) operands.push(arg);
@@ -281,7 +393,7 @@ function flags(args) {
281
393
  else if (arg === "--set-utc") result.setTime = "utc";
282
394
  else if (arg === "--merge" || arg.startsWith("--merge=")) {
283
395
  const style = arg.includes("=") ? arg.slice(arg.indexOf("=") + 1) : "merge";
284
- if (style !== "merge" && style !== "diff3") throw new ToolError2(`invalid merge style: ${style}`);
396
+ if (style !== "merge" && style !== "diff3") throw new ToolError3(`invalid merge style: ${style}`);
285
397
  result.merge = style;
286
398
  } else if (arg === "--backup") result.alwaysBackup = true;
287
399
  else if (arg === "--forward") result.forward = true;
@@ -302,13 +414,13 @@ function flags(args) {
302
414
  const parameter = value(arg.includes("=") ? arg.slice(arg.indexOf("=") + 1) : void 0, name);
303
415
  if (name === "--ifdef") result.ifdef = parameter;
304
416
  else if (name === "--quoting-style") {
305
- if (!["literal", "shell", "shell-always", "shell-escape", "shell-escape-always", "c", "escape", "locale", "clocale"].includes(parameter)) throw new ToolError2(`invalid quoting style: ${parameter}`);
417
+ if (!["literal", "shell", "shell-always", "shell-escape", "shell-escape-always", "c", "escape", "locale", "clocale"].includes(parameter)) throw new ToolError3(`invalid quoting style: ${parameter}`);
306
418
  result.quotingStyle = parameter;
307
419
  } else if (name === "--reject-format") {
308
- if (parameter !== "unified" && parameter !== "context") throw new ToolError2(`invalid reject format: ${parameter}`);
420
+ if (parameter !== "unified" && parameter !== "context") throw new ToolError3(`invalid reject format: ${parameter}`);
309
421
  result.rejectFormat = parameter;
310
422
  } else if (name === "--read-only") {
311
- if (!["ignore", "warn", "fail"].includes(parameter)) throw new ToolError2(`invalid read-only behavior: ${parameter}`);
423
+ if (!["ignore", "warn", "fail"].includes(parameter)) throw new ToolError3(`invalid read-only behavior: ${parameter}`);
312
424
  result.readOnly = parameter;
313
425
  } else if (name === "--strip") result.strip = integer(parameter, "strip count");
314
426
  else if (name === "--fuzz") result.fuzz = integer(parameter, "fuzz");
@@ -320,9 +432,9 @@ function flags(args) {
320
432
  else if (name === "--basename-prefix") result.basenamePrefix = parameter;
321
433
  else if (name === "--version-control") versionControl(parameter);
322
434
  else if (name === "--get") {
323
- if (parameter !== "0") throw new ToolError2("version-control acquisition is unsupported; use --get=0");
435
+ if (parameter !== "0") throw new ToolError3("version-control acquisition is unsupported; use --get=0");
324
436
  } else result.input = parameter;
325
- } else if (arg.startsWith("--")) throw new ToolError2(`unsupported option: ${arg}`);
437
+ } else if (arg.startsWith("--")) throw new ToolError3(`unsupported option: ${arg}`);
326
438
  else for (let offset = 1; offset < arg.length; offset++) {
327
439
  const flag = arg[offset];
328
440
  if (flag === "R") result.reverse = true;
@@ -353,25 +465,25 @@ function flags(args) {
353
465
  else if (flag === "Y") result.basenamePrefix = parameter;
354
466
  else if (flag === "V") versionControl(parameter);
355
467
  else if (flag === "g") {
356
- if (parameter !== "0") throw new ToolError2("version-control acquisition is unsupported; use -g0");
468
+ if (parameter !== "0") throw new ToolError3("version-control acquisition is unsupported; use -g0");
357
469
  } else result.input = parameter;
358
470
  break;
359
- } else throw new ToolError2(`unsupported option: -${flag}`);
471
+ } else throw new ToolError3(`unsupported option: -${flag}`);
360
472
  }
361
473
  }
362
- if (operands.length > 2) throw new ToolError2("expected at most a target file and a patch input file");
474
+ if (operands.length > 2) throw new ToolError3("expected at most a target file and a patch input file");
363
475
  if (operands.length) result.target = operands[0];
364
476
  if (operands.length === 2) result.input = operands[1];
365
- if (!result.input || result.input.includes("\0")) throw new ToolError2("invalid patch input path");
366
- for (const path of [result.output, result.directory]) if (path !== void 0 && (!path || path.includes("\0"))) throw new ToolError2("invalid patch option path");
367
- if (result.ifdef !== void 0 && (!result.ifdef || [...result.ifdef].some((c) => !"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_".includes(c)))) throw new ToolError2("invalid ifdef symbol");
477
+ if (!result.input || result.input.includes("\0")) throw new ToolError3("invalid patch input path");
478
+ for (const path of [result.output, result.directory]) if (path !== void 0 && (!path || path.includes("\0"))) throw new ToolError3("invalid patch option path");
479
+ if (result.ifdef !== void 0 && (!result.ifdef || [...result.ifdef].some((c) => !"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_".includes(c)))) throw new ToolError3("invalid ifdef symbol");
368
480
  if (result.merge) result.fuzz = 0;
369
481
  if (result.posix && !backupSelected) result.backup = false;
370
482
  return result;
371
483
  }
372
484
  async function applyContent(sourcePatch, current, exists, options, budget, documents) {
373
485
  let reversed = options.reverse;
374
- let patch = reversed ? reversePatch(sourcePatch) : sourcePatch;
486
+ let patch = reversed ? reverseStoredPatch(sourcePatch) : sourcePatch;
375
487
  const emptyOld = () => patch.hunks.every((hunk) => hunk.oldCount === 0 && hunk.oldStart === 0);
376
488
  const creation = () => patch.oldPath === "/dev/null" || emptyOld() && (patch.oldEpoch || !exists);
377
489
  let autoReversed = false;
@@ -379,7 +491,7 @@ async function applyContent(sourcePatch, current, exists, options, budget, docum
379
491
  const declaredCreation = patch.oldPath === "/dev/null" || patch.oldEpoch && emptyOld();
380
492
  const declaredDeletion = patch.newPath === "/dev/null" || patch.newEpoch && patch.hunks.every((hunk) => hunk.newCount === 0);
381
493
  if (!options.force && (declaredCreation && current.size !== 0 || declaredDeletion && !exists)) {
382
- patch = reversePatch(patch);
494
+ patch = reverseStoredPatch(patch);
383
495
  reversed = !reversed;
384
496
  autoReversed = true;
385
497
  }
@@ -393,7 +505,7 @@ async function applyContent(sourcePatch, current, exists, options, budget, docum
393
505
  rejectAll: creation() && current.size !== 0
394
506
  }, documents);
395
507
  if (!options.merge && !options.force && !autoReversed && (outcomes[0]?.failed || outcomes[0]?.fuzz)) {
396
- const opposite = reversePatch(patch);
508
+ const opposite = reverseStoredPatch(patch);
397
509
  const probe = [];
398
510
  const reverseFuzz = outcomes[0].failed ? options.fuzz : outcomes[0].fuzz - 1;
399
511
  const probeResult = await applyStoredHunks(current, { ...opposite, hunks: opposite.hunks.slice(0, 1) }, reverseFuzz, budget, options.ignoreWhitespace, { partial: true, outcomes: probe }, documents);
@@ -425,12 +537,12 @@ async function unchanged(item, budget, documents) {
425
537
  if (item.sourcePath !== void 0) {
426
538
  const source = await inspect(budget, item.sourcePath);
427
539
  regular(source, item.sourcePath);
428
- if (source === void 0 !== (item.sourceOriginal === void 0) || source && !await sameTarget(item.sourcePath, item.sourceOriginal, documents)) throw new ToolError2(`target changed during preflight: ${item.sourcePath}`, 1);
540
+ if (source === void 0 !== (item.sourceOriginal === void 0) || source && !await sameTarget(item.sourcePath, item.sourceOriginal, documents)) throw new ToolError3(`target changed during preflight: ${item.sourcePath}`, 1);
429
541
  }
430
542
  const stat = await inspect(budget, item.path);
431
543
  regular(stat, item.path);
432
544
  if (stat === void 0 !== (item.original === void 0) || item.original !== void 0 && !await sameTarget(item.path, item.original, documents)) {
433
- throw new ToolError2(`target changed during preflight: ${item.path}`, 1);
545
+ throw new ToolError3(`target changed during preflight: ${item.path}`, 1);
434
546
  }
435
547
  for (const path of [item.backupPath, item.rejectPath]) {
436
548
  if (path !== void 0) regular(await inspect(budget, path), path);
@@ -442,13 +554,12 @@ async function publish(item, budget, rejects, publication, documents) {
442
554
  await unchanged(item, budget, documents);
443
555
  const write = async (path, text, append = false, createParents = true, mode, mtimeMs) => {
444
556
  if (createParents) await ensureParents(path, budget);
445
- else if ((await inspect(budget, dirname(path)))?.type !== "directory") throw new ToolError2(`reject parent does not exist: ${dirname(path)}`);
557
+ else if ((await inspect(budget, dirname(path)))?.type !== "directory") throw new ToolError3(`reject parent does not exist: ${dirname(path)}`);
446
558
  const stat = await inspect(budget, path);
447
559
  regular(stat, path);
448
560
  const capabilities = await host(context, async () => await context.fs.capabilitiesFor?.(path, { signal: context.signal, create: true }) ?? context.fs.capabilities);
449
- if (capabilities?.atomicStagingAncestry !== true && !(publication.trusted && capabilities?.trustedOwnedStaging === true)) throw new ToolError2("filesystem does not support race-safe patch publication");
561
+ if (capabilities?.atomicStagingAncestry !== true && !(publication.trusted && capabilities?.trustedOwnedStaging === true)) throw new ToolError3("filesystem does not support race-safe patch publication");
450
562
  const publicationMode = capabilities?.permissions === false ? void 0 : mode ?? (stat ? stat.mode & 4095 : void 0);
451
- if (typeof text === "string") text = await documents.load(targetBytes(text));
452
563
  if (append && stat) text = await documents.concat(await documents.read(path), text);
453
564
  await publication.write(path, text.range(0, text.size), stat, publicationMode, mtimeMs);
454
565
  };
@@ -457,7 +568,7 @@ async function publish(item, budget, rejects, publication, documents) {
457
568
  if (item.original !== void 0) {
458
569
  const expected = await inspect(budget, item.path);
459
570
  regular(expected, item.path);
460
- if (!expected) throw new ToolError2(`target changed during publication: ${item.path}`, 1);
571
+ if (!expected) throw new ToolError3(`target changed during publication: ${item.path}`, 1);
461
572
  await publication.remove(item.path, expected);
462
573
  }
463
574
  } else if (!item.skipWrite) {
@@ -473,9 +584,9 @@ async function run(context, budget) {
473
584
  const outputToStdout = options.output === "-";
474
585
  if (options.directory !== void 0) {
475
586
  const cwd = resolvePath(context.cwd, options.directory);
476
- if ((await inspect(budget, cwd))?.type !== "directory") throw new ToolError2(`not a directory: ${options.directory}`);
587
+ if ((await inspect(budget, cwd))?.type !== "directory") throw new ToolError3(`not a directory: ${options.directory}`);
477
588
  context = { ...context, cwd };
478
- budget = new Budget2(context, Object.fromEntries(Object.entries(budget.limits).filter(([, value]) => Number.isFinite(value))));
589
+ budget = new Budget3(context, Object.fromEntries(Object.entries(budget.limits).filter(([, value]) => Number.isFinite(value))));
479
590
  }
480
591
  let publication = new PatchPublication(context);
481
592
  if (!options.dryRun) {
@@ -483,8 +594,8 @@ async function run(context, budget) {
483
594
  const capabilities = await host(context, async () => await fs.capabilitiesFor?.(context.cwd, { signal: context.signal }) ?? fs.capabilities);
484
595
  if (capabilities.readOnly === true) throw new FsError("EROFS", { syscall: "patch", path: context.cwd });
485
596
  const trusted = capabilities.atomicStagingAncestry !== true && capabilities.trustedOwnedStaging === true;
486
- if ((trusted ? !fs.prepareDirectory || !fs.removeFileConditional : !fs.confineExtraction || capabilities.atomicStagingAncestry !== true) || !fs.createStagedFile || !fs.publishStagedFile || !fs.removeStagedFile) {
487
- throw new ToolError2("filesystem does not support race-safe patch publication");
597
+ if ((trusted ? !fs.prepareDirectory || !fs.removeFileConditional || !fs.writeFileConditional : !fs.confineExtraction || capabilities.atomicStagingAncestry !== true) || !fs.createStagedFile || !fs.publishStagedFile || !fs.removeStagedFile) {
598
+ throw new ToolError3("filesystem does not support race-safe patch publication");
488
599
  }
489
600
  publication = new PatchPublication(context, trusted);
490
601
  await publication.capture(`${context.cwd === "/" ? "" : context.cwd}/.patch-admission`);
@@ -498,28 +609,46 @@ async function run(context, budget) {
498
609
  return typeof value === "function" ? value.bind(selected) : value;
499
610
  }
500
611
  }) };
501
- budget = new Budget2(context, Object.fromEntries(Object.entries(budget.limits).filter(([, value]) => Number.isFinite(value))));
612
+ budget = new Budget3(context, Object.fromEntries(Object.entries(budget.limits).filter(([, value]) => Number.isFinite(value))));
502
613
  }
503
614
  const documents = new TargetDocuments(budget);
615
+ const bodies = new PatchBodyStore(documents);
616
+ const messages = new PagedStorage2(budget.context, 16, documents.cache);
504
617
  try {
505
618
  const empty = await documents.load({ async *[Symbol.asyncIterator]() {
506
619
  } });
507
620
  const output = options.output === void 0 ? void 0 : safeTarget(options.output, 0, true);
508
- if (options.output !== void 0 && output === void 0) throw new ToolError2("/dev/null is not an output file");
621
+ if (options.output !== void 0 && output === void 0) throw new ToolError3("/dev/null is not an output file");
509
622
  const outputPath = output === void 0 || outputToStdout ? void 0 : resolvePath(context.cwd, output);
510
623
  const explicit = options.target === void 0 ? void 0 : safeTarget(options.target, 0, true);
511
- if (options.target !== void 0 && explicit === void 0) throw new ToolError2("/dev/null is not an explicit target");
624
+ if (options.target !== void 0 && explicit === void 0) throw new ToolError3("/dev/null is not an explicit target");
512
625
  if (options.input !== "-") {
513
626
  const stat = await inspect(budget, options.input);
514
- if (stat?.type !== "file") throw new ToolError2("patch input must be a regular file");
627
+ if (stat?.type !== "file") throw new ToolError3("patch input must be a regular file");
515
628
  }
516
- const input = await budget.read(options.input === "-" ? "-" : resolvePath(context.cwd, options.input));
629
+ const inputPath = pathOf(context, options.input);
630
+ const inputCapabilities = options.input === "-" ? void 0 : await host(context, async () => await context.fs.capabilitiesFor?.(inputPath, { signal: context.signal }) ?? context.fs.capabilities);
631
+ const input = options.input === "-" ? await documents.load(budget.stdinSource()) : inputCapabilities?.retainedRead && context.fs.openReadFile ? await documents.read(inputPath) : context.fs.readStream && inputCapabilities?.streamingRead !== false ? await documents.load(budget.streamSource(inputPath)) : await documents.load(targetBytes(await budget.read(inputPath)));
517
632
  const progress = options.atomic ? void 0 : {};
518
- const sections = await parsePatch(await unwrapPatch(input, budget), budget, options.format, explicit, progress);
633
+ const sections = await parsePatchWith(await unwrapStoredPatch(input, budget), budget, options.format, explicit, {
634
+ unified: (cursor) => parseUnifiedReader(cursor, budget, true, () => bodies.begin()),
635
+ converted: async (chunks) => {
636
+ const converted = await documents.load({ async *[Symbol.asyncIterator]() {
637
+ for await (const chunk of chunks) yield* targetBytes(chunk);
638
+ } });
639
+ try {
640
+ budget.countLines(converted.length);
641
+ return await parseUnifiedReader({ input: new StoredPatchInput(converted), index: 0 }, budget, false, () => bodies.begin());
642
+ } finally {
643
+ await documents.release(converted);
644
+ }
645
+ }
646
+ }, progress);
647
+ await documents.release(input);
519
648
  const parsed = options.format === "normal" ? sections : sections.filter((patch) => !patch.unlocated);
520
- if (sections.length && !parsed.length) throw new ToolError2("no identifiable patch; normal input requires a target, Index header, or -n");
649
+ if (sections.length && !parsed.length) throw new ToolError3("no identifiable patch; normal input requires a target, Index header, or -n");
521
650
  const reject = options.reject === void 0 || options.reject === "-" ? options.reject : safeTarget(options.reject, 0, true);
522
- if (options.reject !== void 0 && reject === void 0) throw new ToolError2("/dev/null is not a reject file; use -r -");
651
+ if (options.reject !== void 0 && reject === void 0) throw new ToolError3("/dev/null is not a reject file; use -r -");
523
652
  const paths = {
524
653
  strip: options.strip,
525
654
  explicit,
@@ -556,23 +685,37 @@ async function run(context, budget) {
556
685
  const backupPaths = /* @__PURE__ */ new Set();
557
686
  const rejectPaths = /* @__PURE__ */ new Set();
558
687
  const parents = /* @__PURE__ */ new Set();
559
- const messages = [];
688
+ let messageSize = 0, messagePosition = 0;
560
689
  let exitCode = 0;
561
690
  let committed = 0;
562
691
  let publishing = false;
563
692
  let activePath;
564
693
  let outputContents = empty;
565
694
  const statusSink = outputToStdout ? context.stderr : context.stdout;
566
- const status = async (text) => {
695
+ const appendStatus = async (text) => {
567
696
  if (!text) return;
568
697
  budget.output(text);
569
- if (options.atomic) messages.push(text);
570
- else await writeBytes(statusSink, encodeBytes(text), context.signal);
698
+ for await (const bytes of targetBytes(text)) {
699
+ await messages.append(bytes);
700
+ messageSize += bytes.length;
701
+ }
702
+ };
703
+ const flushStatus = async (final = false) => {
704
+ if (options.atomic && !final) return;
705
+ while (messagePosition < messageSize) {
706
+ const bytes = await messages.read(8 + messagePosition, Math.min(16384, messageSize - messagePosition));
707
+ await writeBytes(statusSink, bytes, context.signal);
708
+ messagePosition += bytes.length;
709
+ }
710
+ };
711
+ const status = async (text) => {
712
+ await appendStatus(text);
713
+ await flushStatus();
571
714
  };
572
715
  const applySection = async (authorizedPatch) => {
573
716
  const sourcePatch = authorizedPatch.patch;
574
717
  if (sourcePatch.unlocated) {
575
- if (options.atomic) throw new ToolError2("no file to patch; provide a target or Index header", 1);
718
+ if (options.atomic) throw new ToolError3("no file to patch; provide a target or Index header", 1);
576
719
  await status(`No file to patch. Skipping patch.
577
720
  ${sourcePatch.hunks.length} out of ${sourcePatch.hunks.length} hunks ignored
578
721
  `);
@@ -584,7 +727,7 @@ ${sourcePatch.hunks.length} out of ${sourcePatch.hunks.length} hunks ignored
584
727
  activePath = path;
585
728
  const pruning = pruneParents(name, context.cwd).filter((parent) => parent !== context.cwd);
586
729
  if (!options.dryRun) await publication.capture(path, pruning);
587
- if (path === paths.input || backupPaths.has(path) || rejectPaths.has(path)) throw new ToolError2(`patch target aliases input or an earlier output: ${path}`);
730
+ if (path === paths.input || backupPaths.has(path) || rejectPaths.has(path)) throw new ToolError3(`patch target aliases input or an earlier output: ${path}`);
588
731
  targets.add(path);
589
732
  const prior = options.atomic ? staged.get(path) : void 0;
590
733
  const stat = await inspect(budget, path);
@@ -596,13 +739,13 @@ ${sourcePatch.hunks.length} out of ${sourcePatch.hunks.length} hunks ignored
596
739
  await status(`File ${name} is read-only; ${refuse ? "refusing to patch" : "trying to patch anyway"}
597
740
  `);
598
741
  if (refuse) {
599
- if (options.atomic) throw new ToolError2(`read-only target: ${name}`, 1);
742
+ if (options.atomic) throw new ToolError3(`read-only target: ${name}`, 1);
600
743
  const destination = rejectName(outputToStdout ? "-" : name, paths);
601
744
  const rejectPath2 = options.dryRun || destination === void 0 ? void 0 : resolvePath(context.cwd, destination);
602
745
  if (rejectPath2 !== void 0) {
603
746
  await authorizeOutputs([rejectPath2], targets, paths.input, budget);
604
- if (backupPaths.has(rejectPath2)) throw new ToolError2("reject path aliases another section's backup");
605
- const patch = options.reverse ? reversePatch(sourcePatch) : sourcePatch;
747
+ if (backupPaths.has(rejectPath2)) throw new ToolError3("reject path aliases another section's backup");
748
+ const patch = options.reverse ? reverseStoredPatch(sourcePatch) : sourcePatch;
606
749
  const outcomes2 = patch.hunks.map((hunk, index) => ({
607
750
  hunk,
608
751
  index: index + 1,
@@ -613,7 +756,7 @@ ${sourcePatch.hunks.length} out of ${sourcePatch.hunks.length} hunks ignored
613
756
  offset: 0,
614
757
  fuzz: 0
615
758
  }));
616
- const reject2 = await rejectText(sourcePatch, outcomes2, authorizedPatch.oldName, authorizedPatch.newName, authorizedPatch.indexName, options.reverse, budget, options.rejectFormat);
759
+ const reject2 = await documents.load(rejectBytes(sourcePatch, outcomes2, authorizedPatch.oldName, authorizedPatch.newName, authorizedPatch.indexName, options.reverse, budget, options.rejectFormat));
617
760
  const original2 = await documents.read(path);
618
761
  publishing = true;
619
762
  await publish({ path, original: original2, result: original2, remove: false, skipWrite: true, rejectPath: rejectPath2, reject: reject2, parents: [] }, budget, rejects, publication, documents);
@@ -640,7 +783,7 @@ ${sourcePatch.hunks.length} out of ${sourcePatch.hunks.length} hunks ignored
640
783
  }
641
784
  const applied = await applyContent(sourcePatch, current, exists, options, budget, documents);
642
785
  if (!applied) {
643
- if (options.atomic) throw new ToolError2(`patch target does not exist: ${path}`, 1);
786
+ if (options.atomic) throw new ToolError3(`patch target does not exist: ${path}`, 1);
644
787
  await status(`No file to patch. Skipping patch ${name}.
645
788
  ${sourcePatch.hunks.length} out of ${sourcePatch.hunks.length} hunks ignored
646
789
  `);
@@ -657,17 +800,17 @@ ${sourcePatch.hunks.length} out of ${sourcePatch.hunks.length} hunks ignored
657
800
  }
658
801
  const failed = outcomes.filter((outcome) => outcome.failed);
659
802
  const conflict = failed.length > 0 || deletion && result.size !== 0;
660
- if (options.atomic && conflict) throw new ToolError2(failed.length ? `hunk ${failed[0].index} does not match ${name}` : `deletion patch leaves content: ${name}`, 1);
803
+ if (options.atomic && conflict) throw new ToolError3(failed.length ? `hunk ${failed[0].index} does not match ${name}` : `deletion patch leaves content: ${name}`, 1);
661
804
  if (conflict) exitCode = 1;
662
805
  const mismatch = reverseMismatch || outcomes.some((outcome) => outcome.failed || outcome.offset !== 0 || outcome.fuzz !== 0);
663
806
  const backup = !options.dryRun && !outputToStdout && (options.alwaysBackup || options.backup && mismatch) && !touched.has(path) ? original ?? empty : void 0;
664
807
  const backupPath = backup === void 0 ? prior?.backupPath : await backupName(path, budget, options);
665
808
  const rejectDestination = rejectName(outputToStdout ? "-" : name, paths);
666
809
  const rejectPath = !options.dryRun && !options.merge && failed.length && rejectDestination !== void 0 ? resolvePath(context.cwd, rejectDestination) : void 0;
667
- const rejected = rejectPath === void 0 ? void 0 : await rejectText(sourcePatch, outcomes, authorizedPatch.oldName, authorizedPatch.newName, authorizedPatch.indexName, reversed, budget, options.rejectFormat);
810
+ const rejected = rejectPath === void 0 ? void 0 : await documents.load(rejectBytes(sourcePatch, outcomes, authorizedPatch.oldName, authorizedPatch.newName, authorizedPatch.indexName, reversed, budget, options.rejectFormat));
668
811
  await authorizeOutputs([outputPath, backupPath, rejectPath], targets, paths.input, budget);
669
812
  if (backupPath !== void 0 && rejectPaths.has(backupPath) || rejectPath !== void 0 && backupPaths.has(rejectPath)) {
670
- throw new ToolError2("reject path aliases another section's backup");
813
+ throw new ToolError3("reject path aliases another section's backup");
671
814
  }
672
815
  if (backupPath !== void 0) backupPaths.add(backupPath);
673
816
  if (rejectPath !== void 0) rejectPaths.add(rejectPath);
@@ -686,7 +829,7 @@ ${sourcePatch.hunks.length} out of ${sourcePatch.hunks.length} hunks ignored
686
829
  else if (!options.force && mismatch) timeMessage = `Not setting time of file ${name} (contents mismatch)
687
830
  `;
688
831
  else {
689
- if (!options.dryRun && !context.fs.utimes) throw new ToolError2("filesystem does not support setting timestamps");
832
+ if (!options.dryRun && !context.fs.utimes) throw new ToolError3("filesystem does not support setting timestamps");
690
833
  mtimeMs = newTime;
691
834
  }
692
835
  }
@@ -706,38 +849,38 @@ ${sourcePatch.hunks.length} out of ${sourcePatch.hunks.length} hunks ignored
706
849
  parents: remove ? pruning : []
707
850
  };
708
851
  const displayName = quotePatchName(name, options.quotingStyle);
709
- let message = options.quiet ? "" : `${options.dryRun ? "checking" : "patching"} file ${output === void 0 ? displayName : `${quotePatchName(output, options.quotingStyle)} (read from ${displayName})`}
710
- `;
852
+ budget.outputLength(result.size);
853
+ if (backup !== void 0) budget.outputLength(backup.size);
711
854
  if (options.verbose) {
712
855
  const format = sourcePatch.format ?? "unified";
713
856
  const headers = sourcePatch.oldHeader === void 0 ? "" : `|${format === "context" ? "***" : "---"} ${sourcePatch.oldHeader}
714
857
  |${format === "context" ? "---" : "+++"} ${sourcePatch.newHeader}
715
858
  `;
716
- message = `Hmm... Looks like a ${format} diff to me...
859
+ await appendStatus(`Hmm... Looks like a ${format} diff to me...
717
860
  The text leading up to this was:
718
861
  --------------------------
719
862
  ${headers}--------------------------
720
- ` + message;
863
+ `);
721
864
  }
722
- if (autoReversed) message += "Reversed (or previously applied) patch detected! Assuming -R.\n";
865
+ if (!options.quiet) await appendStatus(`${options.dryRun ? "checking" : "patching"} file ${output === void 0 ? displayName : `${quotePatchName(output, options.quotingStyle)} (read from ${displayName})`}
866
+ `);
867
+ if (autoReversed) await appendStatus("Reversed (or previously applied) patch detected! Assuming -R.\n");
723
868
  for (const outcome of outcomes) {
724
- if (outcome.misordered) message += "misordered hunks! output would be garbled\n";
869
+ if (outcome.misordered) await appendStatus("misordered hunks! output would be garbled\n");
725
870
  if (options.quiet) continue;
726
- if (outcome.failed && options.merge) message += `Hunk #${outcome.index} NOT MERGED at ${outcome.mergeRange?.[0] ?? outcome.line}-${outcome.mergeRange?.[1] ?? outcome.line}.
727
- `;
728
- else if (outcome.failed) message += `Hunk #${outcome.index} FAILED at ${outcome.line}.
729
- `;
730
- else if (options.verbose || outcome.offset || outcome.fuzz) message += `Hunk #${outcome.index} succeeded at ${outcome.line}${outcome.fuzz ? ` with fuzz ${outcome.fuzz}` : ""}${outcome.offset ? ` (offset ${outcome.offset} ${outcome.offset === 1 ? "line" : "lines"})` : ""}.
731
- `;
871
+ if (outcome.failed && options.merge) await appendStatus(`Hunk #${outcome.index} NOT MERGED at ${outcome.mergeRange?.[0] ?? outcome.line}-${outcome.mergeRange?.[1] ?? outcome.line}.
872
+ `);
873
+ else if (outcome.failed) await appendStatus(`Hunk #${outcome.index} FAILED at ${outcome.line}.
874
+ `);
875
+ else if (options.verbose || outcome.offset || outcome.fuzz) await appendStatus(`Hunk #${outcome.index} succeeded at ${outcome.line}${outcome.fuzz ? ` with fuzz ${outcome.fuzz}` : ""}${outcome.offset ? ` (offset ${outcome.offset} ${outcome.offset === 1 ? "line" : "lines"})` : ""}.
876
+ `);
732
877
  }
733
- if (failed.length && !options.merge) message += `${failed.length} out of ${outcomes.length} ${outcomes.length === 1 ? "hunk" : "hunks"} FAILED${options.dryRun || rejectPath === void 0 ? "" : ` -- saving rejects to file ${rejectDestination}`}
734
- `;
735
- if (deletion && result.size !== 0) message += `Not deleting file ${name} as content differs from patch
736
- `;
737
- message += timeMessage;
738
- budget.outputLength(result.size);
739
- if (backup !== void 0) budget.outputLength(backup.size);
740
- await status(message);
878
+ if (failed.length && !options.merge) await appendStatus(`${failed.length} out of ${outcomes.length} ${outcomes.length === 1 ? "hunk" : "hunks"} FAILED${options.dryRun || rejectPath === void 0 ? "" : ` -- saving rejects to file ${rejectDestination}`}
879
+ `);
880
+ if (deletion && result.size !== 0) await appendStatus(`Not deleting file ${name} as content differs from patch
881
+ `);
882
+ await appendStatus(timeMessage);
883
+ await flushStatus();
741
884
  touched.add(path);
742
885
  if (options.atomic) {
743
886
  if (outputToStdout) stdoutItems.push(item);
@@ -761,7 +904,7 @@ ${headers}--------------------------
761
904
  } catch (error) {
762
905
  context.signal.throwIfAborted();
763
906
  if (committed === 0 && !publishing) throw error;
764
- throw new ToolError2(`commit stopped; ${committed}/${authorized.length} files committed; failing operation may have side effects; path ${activePath}: ${publicDiagnosticMessage(error, budget.context.onInternalError)}`);
907
+ throw new ToolError3(`commit stopped; ${committed}/${authorized.length} files committed; failing operation may have side effects; path ${activePath}: ${publicDiagnosticMessage(error, budget.context.onInternalError)}`);
765
908
  }
766
909
  }
767
910
  if (options.atomic && (!options.dryRun || outputToStdout)) {
@@ -774,18 +917,18 @@ ${headers}--------------------------
774
917
  committed++;
775
918
  } catch (error) {
776
919
  context.signal.throwIfAborted();
777
- throw new ToolError2(`commit stopped; ${committed}/${prepared.length} files committed; failing operation may have side effects; path ${item.path}: ${publicDiagnosticMessage(error, budget.context.onInternalError)}`);
920
+ throw new ToolError3(`commit stopped; ${committed}/${prepared.length} files committed; failing operation may have side effects; path ${item.path}: ${publicDiagnosticMessage(error, budget.context.onInternalError)}`);
778
921
  }
779
922
  for (const parent of item.parents) parents.add(parent);
780
923
  }
781
924
  }
782
925
  if (!options.dryRun) await pruneDirectories(parents, budget);
783
926
  if (options.verbose) await status("done\n");
784
- if (options.atomic && (!options.quiet || messages.length)) await writeBytes(statusSink, encodeBytes(messages.join("")), context.signal);
927
+ await flushStatus(true);
785
928
  if (progress?.error) throw progress.error;
786
929
  return exitCode;
787
930
  } finally {
788
- await documents.close();
931
+ await closeDocumentResources2([messages, documents, bodies]);
789
932
  }
790
933
  }
791
934
  function patchCommand(options = {}) {