@poe-platform/safe-bash 0.1.799 → 0.1.801

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 (1076) hide show
  1. package/README.md +48 -22
  2. package/dist/image-ast/index.browser.js +1503 -98
  3. package/dist/image-ast/index.js +1503 -98
  4. package/dist/mp4-ast/types.d.ts +1 -0
  5. package/dist/office-package/zip.d.ts +2 -0
  6. package/dist/office-package/zip.js +1 -1
  7. package/dist/pdf-ast/index.js +5 -4
  8. package/dist/safe-bash/chunks/{chunk-LUOFIVNI.js → chunk-3NDIFSNM.js} +3 -3
  9. package/dist/safe-bash/chunks/chunk-3R3AANOR.js +26 -0
  10. package/dist/safe-bash/chunks/{chunk-TRVGCN3U.js → chunk-45PK3NWI.js} +4 -4
  11. package/dist/safe-bash/chunks/{chunk-KHMGTPD6.js → chunk-46Z5E5EV.js} +2 -2
  12. package/dist/safe-bash/chunks/{chunk-XB3B7KMM.js → chunk-6O77NL2S.js} +1 -1
  13. package/dist/safe-bash/chunks/{chunk-T3JTVIEP.js → chunk-6PAVEFT3.js} +1 -1
  14. package/dist/safe-bash/chunks/{chunk-PYVEAFJM.js → chunk-74GHTNJA.js} +3 -2
  15. package/dist/safe-bash/chunks/{chunk-LQHGH25W.js → chunk-7R5BDCG7.js} +1 -1
  16. package/dist/safe-bash/chunks/{chunk-WUNK5NXJ.js → chunk-7VNF5BFF.js} +1140 -1660
  17. package/dist/safe-bash/chunks/{chunk-NHOXKQNE.js → chunk-A7XEHALN.js} +6 -6
  18. package/dist/safe-bash/chunks/{chunk-MHZ24KEI.js → chunk-AM5ESLPH.js} +1 -1
  19. package/dist/safe-bash/chunks/{chunk-3L3T6LYV.js → chunk-AUSNDQTJ.js} +1 -1
  20. package/dist/safe-bash/chunks/{chunk-YG5WAHK7.js → chunk-B7TAL7S5.js} +1 -3
  21. package/dist/safe-bash/chunks/{chunk-K7IQZE7D.js → chunk-C5OWC2TL.js} +1 -1
  22. package/dist/safe-bash/chunks/{chunk-F3RV2F72.js → chunk-CHYGPFVM.js} +1 -1
  23. package/dist/safe-bash/chunks/{chunk-M4CFCXHN.js → chunk-CS4MNM6I.js} +1 -1
  24. package/dist/safe-bash/chunks/{chunk-H6JW3E4F.js → chunk-CTVWDACF.js} +1 -1
  25. package/dist/safe-bash/chunks/{chunk-KTGR4U57.js → chunk-D3ANYGMC.js} +2 -3
  26. package/dist/safe-bash/chunks/{chunk-ENR3HB2B.js → chunk-E7OYNDGL.js} +1 -2
  27. package/dist/safe-bash/chunks/{chunk-SOZK5JVX.js → chunk-FBUCWVTE.js} +1 -1
  28. package/dist/safe-bash/chunks/{chunk-NX2SQVON.js → chunk-FNDNHAGE.js} +46 -27
  29. package/dist/safe-bash/chunks/{chunk-KCVSVD65.js → chunk-I5HZ4FGE.js} +1 -1
  30. package/dist/safe-bash/chunks/{chunk-KMH2DF3I.js → chunk-ICFDYV64.js} +7 -2
  31. package/dist/safe-bash/chunks/{chunk-T5KKDMYB.js → chunk-IVRQ4BXL.js} +7 -1
  32. package/dist/safe-bash/chunks/{chunk-KV7PKOHV.js → chunk-IWDICZVK.js} +1 -1
  33. package/dist/safe-bash/chunks/{chunk-I4OAEOP6.js → chunk-J42RIHHJ.js} +1 -1
  34. package/dist/safe-bash/chunks/chunk-K6VCD7IY.js +106 -0
  35. package/dist/safe-bash/chunks/{chunk-63FXVDGF.js → chunk-LVOBFF4D.js} +1 -1
  36. package/dist/safe-bash/chunks/{chunk-U5NUZPCC.js → chunk-MHMMRCYC.js} +1 -1
  37. package/dist/safe-bash/chunks/{chunk-6HZYFL3H.js → chunk-NR3EM4LS.js} +1 -1
  38. package/dist/safe-bash/chunks/{chunk-VYZTG3GV.js → chunk-NZQXYWA3.js} +1 -1
  39. package/dist/safe-bash/chunks/{chunk-JSVX4VIA.js → chunk-OQRVVGR6.js} +3 -2
  40. package/dist/safe-bash/chunks/{chunk-B3DDEDH2.js → chunk-OV6IHKO6.js} +2 -2
  41. package/dist/safe-bash/chunks/{chunk-SPYL72GN.js → chunk-PQRAK7HU.js} +1196 -5781
  42. package/dist/safe-bash/chunks/chunk-SZH7EJLD.js +9221 -0
  43. package/dist/safe-bash/chunks/{chunk-AKC46AF6.js → chunk-TFIBK2GI.js} +8 -41
  44. package/dist/safe-bash/chunks/{chunk-ZNAFMYIA.js → chunk-UE5KZDEK.js} +2 -2
  45. package/dist/safe-bash/chunks/{chunk-QU3BVQ53.js → chunk-UTBUUFDM.js} +1 -1
  46. package/dist/safe-bash/chunks/{chunk-6IBTC4YL.js → chunk-VQDD3G76.js} +93 -39
  47. package/dist/safe-bash/chunks/{chunk-IUTD5FH5.js → chunk-VTH3MLDU.js} +2 -7
  48. package/dist/safe-bash/chunks/{chunk-LLZCZ24K.js → chunk-XVOSKJE2.js} +1 -1
  49. package/dist/safe-bash/chunks/{csvkit-W2UEKH6P.js → csvkit-TACDU7FC.js} +3 -3
  50. package/dist/safe-bash/chunks/{ffmpeg-42CGASMV.js → ffmpeg-WTC3TEFI.js} +2 -2
  51. package/dist/safe-bash/chunks/{gh-26GYLH6D.js → gh-6WU6PXL4.js} +2 -2
  52. package/dist/safe-bash/chunks/{git-YREKMUVD.js → git-EFZIGJW4.js} +2 -2
  53. package/dist/safe-bash/chunks/{imagemagick-3YIX4XO2.js → imagemagick-EIEYGWPF.js} +2 -2
  54. package/dist/safe-bash/chunks/{implementation-E3YMKU3Z.js → implementation-MLFHUQ5M.js} +2 -2
  55. package/dist/safe-bash/chunks/mmdc-ROQJT5HQ.js +118 -0
  56. package/dist/safe-bash/chunks/{pdfimages-UE2UISP2.js → pdfimages-DW7LWXFI.js} +2 -2
  57. package/dist/safe-bash/chunks/{pdfinfo-RGARKLI5.js → pdfinfo-TIP6XLUQ.js} +4 -12
  58. package/dist/safe-bash/chunks/{pdftk-JY3WVCCC.js → pdftk-DMG22ITZ.js} +2 -2
  59. package/dist/safe-bash/chunks/{pdftoppm-GPD3BMPY.js → pdftoppm-WNDYR72T.js} +2 -2
  60. package/dist/safe-bash/chunks/{pdftotext-K7GQ2QJZ.js → pdftotext-5IPZ4NI7.js} +2 -2
  61. package/dist/safe-bash/chunks/{qpdf-F4U7WUSU.js → qpdf-TTX2DIUA.js} +2 -2
  62. package/dist/safe-bash/chunks/{sips-RWENS7X5.js → sips-XYS46JPJ.js} +2 -2
  63. package/dist/safe-bash/chunks/{soffice-IT6W2C5F.js → soffice-TU73E5KL.js} +2 -2
  64. package/dist/safe-bash/chunks/{wkhtmltopdf-JYNDAHIZ.js → wkhtmltopdf-FSZ2CHGE.js} +2 -2
  65. package/dist/safe-bash/command-chunks/{chunk-QBGA56UH.js → chunk-2ELYGJDD.js} +7 -7
  66. package/dist/safe-bash/command-chunks/chunk-2FGJYFWZ.js +44 -0
  67. package/dist/safe-bash/command-chunks/chunk-2H4JTFIL.js +53 -0
  68. package/dist/safe-bash/command-chunks/{chunk-52PCQXD2.js → chunk-2NHI5F5S.js} +2 -1
  69. package/dist/safe-bash/command-chunks/{chunk-HDKVO47G.js → chunk-2SQEIUGJ.js} +3 -3
  70. package/dist/safe-bash/command-chunks/chunk-364TMWBT.js +946 -0
  71. package/dist/safe-bash/command-chunks/chunk-3E2OIS2J.js +7037 -0
  72. package/dist/safe-bash/command-chunks/chunk-3HHCU5YU.js +380 -0
  73. package/dist/safe-bash/command-chunks/{chunk-TF6OA2GK.js → chunk-3NV3HYT2.js} +1 -1
  74. package/dist/safe-bash/command-chunks/chunk-4B7Y7S6E.js +61 -0
  75. package/dist/safe-bash/command-chunks/{chunk-LLCXZKZ6.js → chunk-4BB2SWJ5.js} +2 -2
  76. package/dist/safe-bash/command-chunks/{chunk-IEXHHNOF.js → chunk-4J5CZ2DP.js} +2 -7
  77. package/dist/safe-bash/command-chunks/{chunk-WDHI3S6Y.js → chunk-4OOUQTQO.js} +1 -1
  78. package/dist/safe-bash/command-chunks/chunk-4ZHMW6F5.js +104 -0
  79. package/dist/safe-bash/command-chunks/{chunk-YMONDXET.js → chunk-4ZQWGOZB.js} +2 -2
  80. package/dist/safe-bash/command-chunks/chunk-5BSTFCXG.js +553 -0
  81. package/dist/safe-bash/command-chunks/{chunk-MKQVQMXO.js → chunk-5LU4UCBR.js} +1 -1
  82. package/dist/safe-bash/command-chunks/chunk-5PWJG2UK.js +174 -0
  83. package/dist/safe-bash/command-chunks/chunk-5TBUOBDE.js +346 -0
  84. package/dist/safe-bash/command-chunks/{chunk-JMPP4TCW.js → chunk-5UBXNSFZ.js} +3 -2
  85. package/dist/safe-bash/command-chunks/chunk-5XY4DTNG.js +34 -0
  86. package/dist/safe-bash/command-chunks/chunk-5ZMZ573Q.js +140 -0
  87. package/dist/safe-bash/command-chunks/{chunk-3NG75MOB.js → chunk-67GQA75T.js} +1 -1
  88. package/dist/safe-bash/command-chunks/chunk-67QKREJK.js +347 -0
  89. package/dist/safe-bash/command-chunks/{chunk-L6SU4S26.js → chunk-6B7WQIKB.js} +0 -7
  90. package/dist/safe-bash/command-chunks/chunk-6BNTBWIK.js +327 -0
  91. package/dist/safe-bash/command-chunks/chunk-6EPHJGGF.js +23 -0
  92. package/dist/safe-bash/command-chunks/chunk-6F4XCVON.js +266 -0
  93. package/dist/safe-bash/command-chunks/chunk-6KJ3LPI2.js +94 -0
  94. package/dist/safe-bash/command-chunks/{chunk-HLDTOR7M.js → chunk-6ZVI7LUY.js} +1 -1
  95. package/dist/safe-bash/command-chunks/{chunk-X6NJC3IC.js → chunk-75OFBY5R.js} +1 -1
  96. package/dist/safe-bash/command-chunks/chunk-7K6JYKPJ.js +422 -0
  97. package/dist/safe-bash/command-chunks/chunk-7N2LI2KO.js +206 -0
  98. package/dist/safe-bash/command-chunks/{chunk-MRW5HD2D.js → chunk-7O3E4LPT.js} +4 -22
  99. package/dist/safe-bash/command-chunks/chunk-7U7EXOXX.js +1392 -0
  100. package/dist/safe-bash/command-chunks/{chunk-6CYTRQ24.js → chunk-7VTKQUA5.js} +20 -17
  101. package/dist/safe-bash/command-chunks/{chunk-BZPAWTUL.js → chunk-AEF5BA3D.js} +1 -1
  102. package/dist/safe-bash/command-chunks/{pptx-GBPNWNEP-7EQEVXV5.js → chunk-AI5JAXQF.js} +34820 -18029
  103. package/dist/safe-bash/command-chunks/{chunk-63R3FEZJ.js → chunk-AIV5BF5W.js} +1 -1
  104. package/dist/safe-bash/command-chunks/{chunk-AYUTO323.js → chunk-AKJG2XD3.js} +2 -18
  105. package/dist/safe-bash/command-chunks/{chunk-J34TZVMW.js → chunk-ALDC4XP4.js} +0 -5
  106. package/dist/safe-bash/command-chunks/chunk-AMO3THU4.js +105 -0
  107. package/dist/safe-bash/command-chunks/chunk-ARBYOQUZ.js +65 -0
  108. package/dist/safe-bash/command-chunks/chunk-BAGCY35S.js +231 -0
  109. package/dist/safe-bash/command-chunks/chunk-BAXU7B5Z.js +101 -0
  110. package/dist/safe-bash/command-chunks/{chunk-44AHAB5O.js → chunk-BDSMROQZ.js} +1 -4
  111. package/dist/safe-bash/command-chunks/chunk-BNOU5YQS.js +182 -0
  112. package/dist/safe-bash/command-chunks/{chunk-4ZALPDBV.js → chunk-BPE5INLI.js} +2 -2
  113. package/dist/safe-bash/command-chunks/{chunk-OT4LZMLB.js → chunk-BR73BIOW.js} +1 -1
  114. package/dist/safe-bash/command-chunks/chunk-C5YYCQHW.js +1444 -0
  115. package/dist/safe-bash/command-chunks/chunk-C7I25AAL.js +25 -0
  116. package/dist/safe-bash/command-chunks/{chunk-4ONEXMD3.js → chunk-CAP7ZJSY.js} +8 -8
  117. package/dist/safe-bash/command-chunks/{chunk-DWFLVJC6.js → chunk-CCRHMAU5.js} +2 -1
  118. package/dist/safe-bash/command-chunks/chunk-CQ5YGOGB.js +150 -0
  119. package/dist/safe-bash/command-chunks/{chunk-JCNNOMBV.js → chunk-CQTRW45K.js} +3 -2
  120. package/dist/safe-bash/command-chunks/{chunk-N2F74VRO.js → chunk-CZ7EN3JG.js} +1 -1
  121. package/dist/safe-bash/command-chunks/chunk-DB453IE6.js +122 -0
  122. package/dist/safe-bash/command-chunks/{chunk-KKG4BAFZ.js → chunk-DIEPXUM4.js} +6 -0
  123. package/dist/safe-bash/command-chunks/chunk-DOKKNRRM.js +87 -0
  124. package/dist/safe-bash/command-chunks/{chunk-2PX5B7T5.js → chunk-DQAVUDDX.js} +2 -2
  125. package/dist/safe-bash/command-chunks/chunk-DT7BCTWY.js +249 -0
  126. package/dist/safe-bash/command-chunks/{chunk-6BETHLXZ.js → chunk-DZCY63VJ.js} +13 -11
  127. package/dist/safe-bash/command-chunks/{chunk-QUENU6GM.js → chunk-E55UKBIE.js} +3 -3
  128. package/dist/safe-bash/command-chunks/chunk-EK6YNAXT.js +343 -0
  129. package/dist/safe-bash/command-chunks/chunk-EQ4HV54N.js +22 -0
  130. package/dist/safe-bash/command-chunks/{chunk-HLGKIZ25.js → chunk-F6OYH562.js} +2 -0
  131. package/dist/safe-bash/command-chunks/{chunk-MC3VWLIZ.js → chunk-FDBUV4HJ.js} +28 -19
  132. package/dist/safe-bash/command-chunks/{chunk-7FKUC34S.js → chunk-FPVUD6TH.js} +6 -3
  133. package/dist/safe-bash/command-chunks/chunk-FXELCPFX.js +195 -0
  134. package/dist/safe-bash/command-chunks/chunk-FXOA7RBK.js +42 -0
  135. package/dist/safe-bash/command-chunks/{chunk-LPORMIZS.js → chunk-FZTK4MFI.js} +9 -9
  136. package/dist/safe-bash/command-chunks/{chunk-K543PB3I.js → chunk-G66QUHIZ.js} +6 -35
  137. package/dist/safe-bash/command-chunks/chunk-GFQZCKO6.js +272 -0
  138. package/dist/safe-bash/command-chunks/{chunk-CU5RLO62.js → chunk-GLOZX57Y.js} +92 -18
  139. package/dist/safe-bash/command-chunks/chunk-GMIHJYDG.js +331 -0
  140. package/dist/safe-bash/command-chunks/chunk-GOB777HR.js +97 -0
  141. package/dist/safe-bash/command-chunks/chunk-GRBWW4SG.js +48 -0
  142. package/dist/safe-bash/command-chunks/{chunk-PPNBNFAU.js → chunk-GYQ2HAKQ.js} +8 -8
  143. package/dist/safe-bash/command-chunks/chunk-H622NS6Z.js +11 -0
  144. package/dist/safe-bash/command-chunks/{chunk-UI32HWGS.js → chunk-HMOZ6XVJ.js} +1 -1
  145. package/dist/safe-bash/command-chunks/{chunk-AVSPNLWV.js → chunk-I237SNW5.js} +1 -1
  146. package/dist/safe-bash/command-chunks/{chunk-43GSSUAY.js → chunk-II77KPZN.js} +5 -5
  147. package/dist/safe-bash/command-chunks/{chunk-ZS3QPNUL.js → chunk-IR2BY7EL.js} +21 -6
  148. package/dist/safe-bash/command-chunks/{chunk-SG424QWS.js → chunk-JDYXY44P.js} +2 -2
  149. package/dist/safe-bash/command-chunks/chunk-JNZ3CVAE.js +147 -0
  150. package/dist/safe-bash/command-chunks/{chunk-4QJOYXVB.js → chunk-JV7LBUTP.js} +1 -1
  151. package/dist/safe-bash/command-chunks/{chunk-IKS2YXZQ.js → chunk-K67MWWWH.js} +3 -3
  152. package/dist/safe-bash/command-chunks/chunk-KFVV7ZJO.js +216 -0
  153. package/dist/safe-bash/command-chunks/{chunk-G4PNVO6Z.js → chunk-KP7AO66M.js} +1 -1
  154. package/dist/safe-bash/command-chunks/{chunk-KMCZ6P4O.js → chunk-KQLD3AED.js} +68 -7
  155. package/dist/safe-bash/command-chunks/chunk-KWESKQHR.js +25 -0
  156. package/dist/safe-bash/command-chunks/{chunk-YZ5SVZFD.js → chunk-KXU3IRUO.js} +3 -3
  157. package/dist/safe-bash/command-chunks/{chunk-C7IHMJEW.js → chunk-KZC5UWFF.js} +2 -2
  158. package/dist/safe-bash/command-chunks/{chunk-2WRTLCGK.js → chunk-LAOM65EE.js} +5 -5
  159. package/dist/safe-bash/command-chunks/chunk-LE5LZNHE.js +204 -0
  160. package/dist/safe-bash/command-chunks/{chunk-HFII3QYO.js → chunk-LWS62ISU.js} +46 -32
  161. package/dist/safe-bash/command-chunks/{chunk-BZDDAPSV.js → chunk-LWSBAWLT.js} +1 -1
  162. package/dist/safe-bash/command-chunks/chunk-MDH5T4OS.js +41 -0
  163. package/dist/safe-bash/command-chunks/{chunk-X7TM3AKW.js → chunk-MIXBO6U7.js} +20 -7
  164. package/dist/safe-bash/command-chunks/chunk-MM6HU6CX.js +20 -0
  165. package/dist/safe-bash/command-chunks/{chunk-MYJAZ3U2.js → chunk-MPL2466A.js} +2 -2
  166. package/dist/safe-bash/command-chunks/{chunk-HLBX5IRS.js → chunk-MQFIPHIQ.js} +46 -81
  167. package/dist/safe-bash/command-chunks/{chunk-ZJBR5Q5I.js → chunk-MSFXC3OC.js} +4 -4
  168. package/dist/safe-bash/command-chunks/{chunk-NI7MKJPN.js → chunk-MTQH74CF.js} +3 -55
  169. package/dist/safe-bash/command-chunks/chunk-MWUZZWXK.js +354 -0
  170. package/dist/safe-bash/command-chunks/chunk-N4PFUSRM.js +35 -0
  171. package/dist/safe-bash/command-chunks/chunk-NCD7PEWH.js +298 -0
  172. package/dist/safe-bash/command-chunks/chunk-NFGI5IGF.js +266 -0
  173. package/dist/safe-bash/command-chunks/{chunk-I3K5RYU4.js → chunk-NKFYQSES.js} +73 -26
  174. package/dist/safe-bash/command-chunks/{chunk-KVFCSLKK.js → chunk-NXEQ3ESQ.js} +6 -0
  175. package/dist/safe-bash/command-chunks/{chunk-NGWB2YBL.js → chunk-O4JQSB7O.js} +1 -1
  176. package/dist/safe-bash/command-chunks/{chunk-7L24L4UO.js → chunk-OQU6UT6X.js} +2 -20
  177. package/dist/safe-bash/command-chunks/{chunk-3VGGYEDH.js → chunk-ORYGZYKW.js} +4 -3
  178. package/dist/safe-bash/command-chunks/{chunk-ZXKW7SJ2.js → chunk-OYYV7ZAF.js} +2 -2
  179. package/dist/safe-bash/command-chunks/chunk-P2N33UMN.js +270 -0
  180. package/dist/safe-bash/command-chunks/{chunk-Q7Q5GM5S.js → chunk-P5APDEFB.js} +2 -2
  181. package/dist/safe-bash/command-chunks/{chunk-X2YQLGKS.js → chunk-PCEFOYA3.js} +240 -148
  182. package/dist/safe-bash/command-chunks/{chunk-OLQG7ZCN.js → chunk-PEF7K3UQ.js} +136 -75
  183. package/dist/safe-bash/command-chunks/chunk-PII4YEZW.js +123 -0
  184. package/dist/safe-bash/command-chunks/{chunk-AIRGA2SU.js → chunk-PMBFZXTK.js} +1 -1
  185. package/dist/safe-bash/command-chunks/{chunk-ZT4KSS2V.js → chunk-PTT3I223.js} +1 -1
  186. package/dist/safe-bash/command-chunks/{chunk-4Y3WVMK4.js → chunk-PV66YWHB.js} +1 -0
  187. package/dist/safe-bash/command-chunks/chunk-Q3EWDEUQ.js +185 -0
  188. package/dist/safe-bash/command-chunks/{chunk-AXK3H4PX.js → chunk-QJ33BHI4.js} +1 -1
  189. package/dist/safe-bash/command-chunks/chunk-QKFSRZGQ.js +1091 -0
  190. package/dist/safe-bash/command-chunks/{chunk-JZSNU2MY.js → chunk-QKJLP53H.js} +2 -2
  191. package/dist/safe-bash/command-chunks/{chunk-VVI4Z73I.js → chunk-QP4R6GLA.js} +5 -1
  192. package/dist/safe-bash/command-chunks/chunk-RMWQAAO5.js +2488 -0
  193. package/dist/safe-bash/command-chunks/{chunk-QDTBMSBE.js → chunk-RO62EWX6.js} +2 -2
  194. package/dist/safe-bash/command-chunks/{chunk-HRLIAMXC.js → chunk-RZZI24ZE.js} +7 -6
  195. package/dist/safe-bash/command-chunks/{chunk-PFAADCB5.js → chunk-SDNBCQ3X.js} +10 -24
  196. package/dist/safe-bash/command-chunks/chunk-SEM36PG5.js +11 -0
  197. package/dist/safe-bash/command-chunks/{chunk-36O5OT7E.js → chunk-T35Y7YQD.js} +1 -1
  198. package/dist/safe-bash/command-chunks/{chunk-ESMCX3YV.js → chunk-TGSNCQSR.js} +710 -143
  199. package/dist/safe-bash/command-chunks/chunk-TIOCQVUQ.js +557 -0
  200. package/dist/safe-bash/command-chunks/{chunk-T5H5UJQ3.js → chunk-TNOA7FCQ.js} +1 -1
  201. package/dist/safe-bash/command-chunks/{chunk-GN2TKLE7.js → chunk-TS65BJHG.js} +5 -5
  202. package/dist/safe-bash/command-chunks/chunk-TSCGT46G.js +363 -0
  203. package/dist/safe-bash/command-chunks/chunk-UG7SMZFF.js +178 -0
  204. package/dist/safe-bash/command-chunks/{chunk-KBEURXFF.js → chunk-UN6WS55J.js} +3 -3
  205. package/dist/safe-bash/command-chunks/chunk-UXSR5BZH.js +136 -0
  206. package/dist/safe-bash/command-chunks/{chunk-SX2X3IH4.js → chunk-V2V5OCL3.js} +1 -1
  207. package/dist/safe-bash/command-chunks/chunk-V6BEDRMQ.js +112 -0
  208. package/dist/safe-bash/command-chunks/chunk-V7A7DRTU.js +293 -0
  209. package/dist/safe-bash/command-chunks/{chunk-5SHGJ7NO.js → chunk-VA5ZHYYA.js} +73 -33
  210. package/dist/safe-bash/command-chunks/{chunk-J4PEQWSF.js → chunk-VGG2DL5Q.js} +0 -1
  211. package/dist/safe-bash/command-chunks/chunk-VPR5LQYX.js +1228 -0
  212. package/dist/safe-bash/command-chunks/{chunk-EIVW3X3N.js → chunk-VSRGNQCP.js} +11 -6
  213. package/dist/safe-bash/command-chunks/{chunk-TYVCKQDH.js → chunk-VXSLJH7G.js} +56 -6
  214. package/dist/safe-bash/command-chunks/{chunk-PXYOWWMV.js → chunk-W7RAD4EW.js} +4 -3
  215. package/dist/safe-bash/command-chunks/{src-UJOWAS2S.js → chunk-WD3ERGRY.js} +77 -277
  216. package/dist/safe-bash/command-chunks/{chunk-5ZSM4UFN.js → chunk-WECIOOQB.js} +8 -64
  217. package/dist/safe-bash/command-chunks/{chunk-YFSDDFGV.js → chunk-WH627NJL.js} +446 -53
  218. package/dist/safe-bash/command-chunks/chunk-WNE7FPVR.js +236 -0
  219. package/dist/safe-bash/command-chunks/{chunk-UKS2XJZI.js → chunk-WPYIOKE3.js} +4 -4
  220. package/dist/safe-bash/command-chunks/{chunk-HHP343KT.js → chunk-WTECBRU4.js} +1 -1
  221. package/dist/safe-bash/command-chunks/{chunk-AO6Z5EQ7.js → chunk-WVE64WM2.js} +6 -5
  222. package/dist/safe-bash/command-chunks/chunk-WVHONVZ4.js +594 -0
  223. package/dist/safe-bash/command-chunks/chunk-XIIBTGC5.js +580 -0
  224. package/dist/safe-bash/command-chunks/chunk-XJXU3VVH.js +737 -0
  225. package/dist/safe-bash/command-chunks/chunk-XNLFHHOC.js +63 -0
  226. package/dist/safe-bash/command-chunks/{chunk-XAFSZDY2.js → chunk-XS72HTMA.js} +11 -0
  227. package/dist/safe-bash/command-chunks/chunk-Y5INTD6S.js +220 -0
  228. package/dist/safe-bash/command-chunks/chunk-YIQACGEW.js +43 -0
  229. package/dist/safe-bash/command-chunks/chunk-YOF7R4OY.js +80 -0
  230. package/dist/safe-bash/command-chunks/{chunk-VZHRZMS7.js → chunk-YOFC45RK.js} +1 -1
  231. package/dist/safe-bash/command-chunks/{chunk-2FUAW6GO.js → chunk-Z45N42QC.js} +75 -11
  232. package/dist/safe-bash/command-chunks/chunk-ZHUWOUWB.js +618 -0
  233. package/dist/safe-bash/command-chunks/{chunk-OPUJSTHS.js → chunk-ZYHTWNAE.js} +215 -67
  234. package/dist/safe-bash/command-chunks/chunk-ZYXH3B66.js +636 -0
  235. package/dist/safe-bash/command-chunks/{model-store-L35QTZMJ.js → model-store-WPKMRPV4.js} +2 -2
  236. package/dist/safe-bash/command-chunks/pptx-7G52EJ6L-4JACH5FB.js +625 -0
  237. package/dist/safe-bash/command-chunks/python-worker-source-TYOFJMCW.js +4 -0
  238. package/dist/safe-bash/command-chunks/src-ICMQISAA.js +501 -0
  239. package/dist/safe-bash/commands/archive/create.d.ts +1 -17
  240. package/dist/safe-bash/commands/archive/create.js +1 -252
  241. package/dist/safe-bash/commands/archive/extract.d.ts +1 -11
  242. package/dist/safe-bash/commands/archive/extract.js +1 -640
  243. package/dist/safe-bash/commands/archive/format.d.ts +1 -32
  244. package/dist/safe-bash/commands/archive/format.js +1 -225
  245. package/dist/safe-bash/commands/archive/index.d.ts +5 -10
  246. package/dist/safe-bash/commands/archive/index.js +6 -931
  247. package/dist/safe-bash/commands/archive/listing.d.ts +1 -2
  248. package/dist/safe-bash/commands/archive/listing.js +1 -21
  249. package/dist/safe-bash/commands/archive/modes.d.ts +1 -5
  250. package/dist/safe-bash/commands/archive/modes.js +1 -182
  251. package/dist/safe-bash/commands/archive/options.d.ts +1 -53
  252. package/dist/safe-bash/commands/archive/options.js +1 -462
  253. package/dist/safe-bash/commands/archive/stream.d.ts +1 -22
  254. package/dist/safe-bash/commands/archive/stream.js +1 -188
  255. package/dist/safe-bash/commands/archive/transform.d.ts +1 -16
  256. package/dist/safe-bash/commands/archive/transform.js +1 -85
  257. package/dist/safe-bash/commands/archive/unzip/arguments.d.ts +1 -53
  258. package/dist/safe-bash/commands/archive/unzip/arguments.js +1 -322
  259. package/dist/safe-bash/commands/archive/unzip/safety.d.ts +1 -32
  260. package/dist/safe-bash/commands/archive/unzip/safety.js +1 -295
  261. package/dist/safe-bash/commands/archive/unzip.d.ts +1 -3
  262. package/dist/safe-bash/commands/archive/unzip.js +1 -398
  263. package/dist/safe-bash/commands/archive/zip/aes.d.ts +1 -17
  264. package/dist/safe-bash/commands/archive/zip/aes.js +1 -156
  265. package/dist/safe-bash/commands/archive/zip/comments.d.ts +1 -17
  266. package/dist/safe-bash/commands/archive/zip/comments.js +1 -83
  267. package/dist/safe-bash/commands/archive/zip/crc.d.ts +1 -1
  268. package/dist/safe-bash/commands/archive/zip/crc.js +1 -1
  269. package/dist/safe-bash/commands/archive/zip/crypto.d.ts +1 -19
  270. package/dist/safe-bash/commands/archive/zip/crypto.js +1 -118
  271. package/dist/safe-bash/commands/archive/zip/dates.d.ts +1 -4
  272. package/dist/safe-bash/commands/archive/zip/dates.js +1 -66
  273. package/dist/safe-bash/commands/archive/zip/environment.d.ts +1 -2
  274. package/dist/safe-bash/commands/archive/zip/environment.js +1 -62
  275. package/dist/safe-bash/commands/archive/zip/grow.d.ts +1 -3
  276. package/dist/safe-bash/commands/archive/zip/grow.js +1 -2
  277. package/dist/safe-bash/commands/archive/zip/help.d.ts +1 -4
  278. package/dist/safe-bash/commands/archive/zip/help.js +1 -182
  279. package/dist/safe-bash/commands/archive/zip/line-endings.d.ts +1 -2
  280. package/dist/safe-bash/commands/archive/zip/line-endings.js +1 -194
  281. package/dist/safe-bash/commands/archive/zip/log.d.ts +1 -22
  282. package/dist/safe-bash/commands/archive/zip/log.js +1 -159
  283. package/dist/safe-bash/commands/archive/zip/lzma.d.ts +1 -9
  284. package/dist/safe-bash/commands/archive/zip/lzma.js +1 -40
  285. package/dist/safe-bash/commands/archive/zip/move.d.ts +1 -11
  286. package/dist/safe-bash/commands/archive/zip/move.js +1 -59
  287. package/dist/safe-bash/commands/archive/zip/names.d.ts +1 -2
  288. package/dist/safe-bash/commands/archive/zip/names.js +1 -33
  289. package/dist/safe-bash/commands/archive/zip/options.d.ts +1 -13
  290. package/dist/safe-bash/commands/archive/zip/options.js +1 -124
  291. package/dist/safe-bash/commands/archive/zip/repair.d.ts +1 -10
  292. package/dist/safe-bash/commands/archive/zip/repair.js +1 -392
  293. package/dist/safe-bash/commands/archive/zip/safety.d.ts +1 -54
  294. package/dist/safe-bash/commands/archive/zip/safety.js +1 -360
  295. package/dist/safe-bash/commands/archive/zip/sfx.d.ts +1 -4
  296. package/dist/safe-bash/commands/archive/zip/sfx.js +1 -52
  297. package/dist/safe-bash/commands/archive/zip/test-command.d.ts +1 -5
  298. package/dist/safe-bash/commands/archive/zip/test-command.js +1 -101
  299. package/dist/safe-bash/commands/archive/zip/volumes.d.ts +1 -21
  300. package/dist/safe-bash/commands/archive/zip/volumes.js +1 -281
  301. package/dist/safe-bash/commands/archive/zip/zip64.d.ts +1 -30
  302. package/dist/safe-bash/commands/archive/zip/zip64.js +1 -227
  303. package/dist/safe-bash/commands/archive/zip-format.d.ts +1 -68
  304. package/dist/safe-bash/commands/archive/zip-format.js +1 -1075
  305. package/dist/safe-bash/commands/archive/zip.d.ts +1 -3
  306. package/dist/safe-bash/commands/archive/zip.js +1 -1523
  307. package/dist/safe-bash/commands/awk/index.d.ts +2 -0
  308. package/dist/safe-bash/commands/awk/index.js +2 -0
  309. package/dist/safe-bash/commands/bytes/compression/index.js +4 -2
  310. package/dist/safe-bash/commands/copy-preserve.d.ts +1 -0
  311. package/dist/safe-bash/commands/csplit/index.browser.js +2 -2
  312. package/dist/safe-bash/commands/curl/index.d.ts +2 -0
  313. package/dist/safe-bash/commands/curl/index.js +2 -0
  314. package/dist/safe-bash/commands/diff/index.d.ts +2 -0
  315. package/dist/safe-bash/commands/diff/index.js +2 -0
  316. package/dist/safe-bash/commands/diff-patch/diff-format.d.ts +1 -10
  317. package/dist/safe-bash/commands/diff-patch/diff-format.js +1 -237
  318. package/dist/safe-bash/commands/diff-patch/diff-options.d.ts +1 -38
  319. package/dist/safe-bash/commands/diff-patch/diff-options.js +1 -261
  320. package/dist/safe-bash/commands/diff-patch/diff-output.d.ts +1 -20
  321. package/dist/safe-bash/commands/diff-patch/diff-output.js +1 -290
  322. package/dist/safe-bash/commands/diff-patch/diff.d.ts +1 -2
  323. package/dist/safe-bash/commands/diff-patch/diff.js +1 -656
  324. package/dist/safe-bash/commands/diff-patch/index.d.ts +4 -5
  325. package/dist/safe-bash/commands/diff-patch/index.js +8 -333
  326. package/dist/safe-bash/commands/diff-patch/patch-envelope.d.ts +1 -2
  327. package/dist/safe-bash/commands/diff-patch/patch-envelope.js +1 -63
  328. package/dist/safe-bash/commands/diff-patch/patch-formats.d.ts +1 -7
  329. package/dist/safe-bash/commands/diff-patch/patch-formats.js +1 -264
  330. package/dist/safe-bash/commands/diff-patch/patch-gnu-paths.d.ts +1 -41
  331. package/dist/safe-bash/commands/diff-patch/patch-gnu-paths.js +1 -263
  332. package/dist/safe-bash/commands/diff-patch/patch-gnu-reject.d.ts +1 -3
  333. package/dist/safe-bash/commands/diff-patch/patch-gnu-reject.js +1 -100
  334. package/dist/safe-bash/commands/diff-patch/patch-path.d.ts +1 -3
  335. package/dist/safe-bash/commands/diff-patch/patch-path.js +1 -91
  336. package/dist/safe-bash/commands/diff-patch/patch-publication.d.ts +1 -13
  337. package/dist/safe-bash/commands/diff-patch/patch-publication.js +1 -107
  338. package/dist/safe-bash/commands/diff-patch/patch.d.ts +1 -2
  339. package/dist/safe-bash/commands/diff-patch/patch.js +1 -653
  340. package/dist/safe-bash/commands/diff-patch/shared.d.ts +1 -53
  341. package/dist/safe-bash/commands/diff-patch/shared.js +1 -267
  342. package/dist/safe-bash/commands/diff-patch/unified.d.ts +1 -52
  343. package/dist/safe-bash/commands/diff-patch/unified.js +1 -385
  344. package/dist/safe-bash/commands/directory-admission.d.ts +1 -3
  345. package/dist/safe-bash/commands/directory-admission.js +1 -26
  346. package/dist/safe-bash/commands/docx/index.browser.js +1 -1
  347. package/dist/safe-bash/commands/execution.js +19 -13
  348. package/dist/safe-bash/commands/factor/index.browser.js +2 -2
  349. package/dist/safe-bash/commands/filesystem.d.ts +1 -1
  350. package/dist/safe-bash/commands/filesystem.js +17 -13
  351. package/dist/safe-bash/commands/find/index.d.ts +2 -0
  352. package/dist/safe-bash/commands/find/index.js +2 -0
  353. package/dist/safe-bash/commands/find-format.d.ts +1 -20
  354. package/dist/safe-bash/commands/find-format.js +1 -161
  355. package/dist/safe-bash/commands/find.d.ts +2 -18
  356. package/dist/safe-bash/commands/find.js +2 -1236
  357. package/dist/safe-bash/commands/getopt/index.browser.js +2 -2
  358. package/dist/safe-bash/commands/gzip/index.d.ts +2 -0
  359. package/dist/safe-bash/commands/gzip/index.js +2 -0
  360. package/dist/safe-bash/commands/hexdump/index.browser.js +2 -2
  361. package/dist/safe-bash/commands/htmlq/index.d.ts +1 -1
  362. package/dist/safe-bash/commands/iconv/index.browser.js +2 -2
  363. package/dist/safe-bash/commands/line-endings/index.browser.js +2 -2
  364. package/dist/safe-bash/commands/line-endings/index.d.ts +1 -1
  365. package/dist/safe-bash/commands/line-endings/index.js +1 -262
  366. package/dist/safe-bash/commands/llm/index.browser.js +4 -2
  367. package/dist/safe-bash/commands/llm/providers/index.browser.js +1 -1
  368. package/dist/safe-bash/commands/mdq/index.browser.js +3 -3
  369. package/dist/safe-bash/commands/media/index.browser.js +1 -1
  370. package/dist/safe-bash/commands/metadata/chmod.d.ts +1 -4
  371. package/dist/safe-bash/commands/metadata/chmod.js +2 -63
  372. package/dist/safe-bash/commands/network/aggregate.d.ts +1 -4
  373. package/dist/safe-bash/commands/network/aggregate.js +1 -23
  374. package/dist/safe-bash/commands/network/args.d.ts +1 -68
  375. package/dist/safe-bash/commands/network/args.js +1 -321
  376. package/dist/safe-bash/commands/network/authorizer.d.ts +1 -6
  377. package/dist/safe-bash/commands/network/authorizer.js +1 -33
  378. package/dist/safe-bash/commands/network/body.d.ts +1 -9
  379. package/dist/safe-bash/commands/network/body.js +1 -393
  380. package/dist/safe-bash/commands/network/curl.d.ts +3 -13
  381. package/dist/safe-bash/commands/network/curl.js +6 -695
  382. package/dist/safe-bash/commands/network/deadline.d.ts +1 -2
  383. package/dist/safe-bash/commands/network/deadline.js +1 -14
  384. package/dist/safe-bash/commands/network/decode.d.ts +1 -2
  385. package/dist/safe-bash/commands/network/decode.js +1 -79
  386. package/dist/safe-bash/commands/network/fetch-transport.d.ts +1 -7
  387. package/dist/safe-bash/commands/network/fetch-transport.js +1 -94
  388. package/dist/safe-bash/commands/network/form-content-type.d.ts +1 -5
  389. package/dist/safe-bash/commands/network/form-content-type.js +1 -63
  390. package/dist/safe-bash/commands/network/form-headers.d.ts +1 -2
  391. package/dist/safe-bash/commands/network/form-headers.js +1 -35
  392. package/dist/safe-bash/commands/network/glob.d.ts +1 -7
  393. package/dist/safe-bash/commands/network/glob.js +1 -134
  394. package/dist/safe-bash/commands/network/index.browser.js +4 -12
  395. package/dist/safe-bash/commands/network/input.d.ts +1 -5
  396. package/dist/safe-bash/commands/network/input.js +1 -276
  397. package/dist/safe-bash/commands/network/output.d.ts +1 -6
  398. package/dist/safe-bash/commands/network/output.js +1 -131
  399. package/dist/safe-bash/commands/network/platform-portable.d.ts +1 -5
  400. package/dist/safe-bash/commands/network/platform-portable.js +1 -26
  401. package/dist/safe-bash/commands/network/private-address.d.ts +1 -1
  402. package/dist/safe-bash/commands/network/private-address.js +1 -44
  403. package/dist/safe-bash/commands/network/public.d.ts +2 -2
  404. package/dist/safe-bash/commands/network/public.js +2 -2
  405. package/dist/safe-bash/commands/network/shared.d.ts +1 -14
  406. package/dist/safe-bash/commands/network/shared.js +1 -71
  407. package/dist/safe-bash/commands/network/transport.js +2 -2
  408. package/dist/safe-bash/commands/network/types.d.ts +1 -37
  409. package/dist/safe-bash/commands/network/types.js +1 -31
  410. package/dist/safe-bash/commands/network/url.d.ts +1 -2
  411. package/dist/safe-bash/commands/network/url.js +1 -30
  412. package/dist/safe-bash/commands/network/wget.d.ts +3 -3
  413. package/dist/safe-bash/commands/network/wget.js +9 -332
  414. package/dist/safe-bash/commands/node/filesystem.js +3 -2
  415. package/dist/safe-bash/commands/node/index.browser.js +8 -9
  416. package/dist/safe-bash/commands/node/index.d.ts +3 -3
  417. package/dist/safe-bash/commands/node/index.js +5 -0
  418. package/dist/safe-bash/commands/node/safejs.d.ts +3 -3
  419. package/dist/safe-bash/commands/node/safejs.js +6 -1
  420. package/dist/safe-bash/commands/node/types.d.ts +1 -1
  421. package/dist/safe-bash/commands/node/types.js +1 -1
  422. package/dist/safe-bash/commands/node/unconfigured.d.ts +3 -0
  423. package/dist/safe-bash/commands/node/unconfigured.js +10 -0
  424. package/dist/safe-bash/commands/op/index.browser.js +3 -3
  425. package/dist/safe-bash/commands/patch/index.d.ts +2 -0
  426. package/dist/safe-bash/commands/patch/index.js +2 -0
  427. package/dist/safe-bash/commands/pdfinfo/index.js +2 -1
  428. package/dist/safe-bash/commands/pr/index.browser.js +2 -2
  429. package/dist/safe-bash/commands/predicates.js +3 -4
  430. package/dist/safe-bash/commands/python/host-capabilities.js +31 -14
  431. package/dist/safe-bash/commands/python/index.browser.js +11 -11
  432. package/dist/safe-bash/commands/python/llm-capability.d.ts +1 -0
  433. package/dist/safe-bash/commands/python/llm-capability.js +27 -7
  434. package/dist/safe-bash/commands/python/llm-module.js +11 -0
  435. package/dist/safe-bash/commands/python/manifest.d.ts +2 -0
  436. package/dist/safe-bash/commands/python/manifest.js +13 -6
  437. package/dist/safe-bash/commands/python/provisioning.js +1 -1
  438. package/dist/safe-bash/commands/python/shell-capability.d.ts +1 -0
  439. package/dist/safe-bash/commands/python/shell-capability.js +3 -2
  440. package/dist/safe-bash/commands/python/worker.browser.js +3 -3
  441. package/dist/safe-bash/commands/regex-execution/matching.js +1 -2
  442. package/dist/safe-bash/commands/regex-execution/public.browser.js +8 -8
  443. package/dist/safe-bash/commands/safejs/runtime.js +16 -7
  444. package/dist/safe-bash/commands/search/index.d.ts +1 -1
  445. package/dist/safe-bash/commands/search/index.js +1 -347
  446. package/dist/safe-bash/commands/search/portable.d.ts +2 -2
  447. package/dist/safe-bash/commands/search/portable.js +3 -2
  448. package/dist/safe-bash/commands/sed/index.d.ts +2 -0
  449. package/dist/safe-bash/commands/sed/index.js +2 -0
  450. package/dist/safe-bash/commands/standard.d.ts +1 -0
  451. package/dist/safe-bash/commands/standard.js +2 -1
  452. package/dist/safe-bash/commands/streams.js +6 -24
  453. package/dist/safe-bash/commands/tar/index.d.ts +2 -0
  454. package/dist/safe-bash/commands/tar/index.js +2 -0
  455. package/dist/safe-bash/commands/text-programs/awk-inspection.d.ts +1 -19
  456. package/dist/safe-bash/commands/text-programs/awk-inspection.js +1 -50
  457. package/dist/safe-bash/commands/text-programs/awk-pipes.d.ts +2 -0
  458. package/dist/safe-bash/commands/text-programs/awk-pipes.js +2 -0
  459. package/dist/safe-bash/commands/text-programs/awk-pretty.d.ts +1 -3
  460. package/dist/safe-bash/commands/text-programs/awk-pretty.js +1 -197
  461. package/dist/safe-bash/commands/text-programs/awk-quote.d.ts +1 -2
  462. package/dist/safe-bash/commands/text-programs/awk-quote.js +1 -15
  463. package/dist/safe-bash/commands/text-programs/awk-reader.d.ts +1 -42
  464. package/dist/safe-bash/commands/text-programs/awk-reader.js +1 -449
  465. package/dist/safe-bash/commands/text-programs/awk-retention.d.ts +1 -13
  466. package/dist/safe-bash/commands/text-programs/awk-retention.js +1 -51
  467. package/dist/safe-bash/commands/text-programs/awk-runtime.d.ts +1 -150
  468. package/dist/safe-bash/commands/text-programs/awk-runtime.js +1 -2627
  469. package/dist/safe-bash/commands/text-programs/awk-syntax.d.ts +1 -142
  470. package/dist/safe-bash/commands/text-programs/awk-syntax.js +1 -509
  471. package/dist/safe-bash/commands/text-programs/awk-values.d.ts +1 -32
  472. package/dist/safe-bash/commands/text-programs/awk-values.js +1 -386
  473. package/dist/safe-bash/commands/text-programs/awk.d.ts +1 -3
  474. package/dist/safe-bash/commands/text-programs/awk.js +1 -361
  475. package/dist/safe-bash/commands/text-programs/inplace.d.ts +1 -16
  476. package/dist/safe-bash/commands/text-programs/inplace.js +1 -155
  477. package/dist/safe-bash/commands/text-programs/sed.d.ts +1 -3
  478. package/dist/safe-bash/commands/text-programs/sed.js +1 -1647
  479. package/dist/safe-bash/commands/text.js +268 -364
  480. package/dist/safe-bash/commands/tsort/index.browser.js +2 -2
  481. package/dist/safe-bash/commands/unzip/index.d.ts +2 -0
  482. package/dist/safe-bash/commands/unzip/index.js +2 -0
  483. package/dist/safe-bash/commands/wget/index.d.ts +2 -0
  484. package/dist/safe-bash/commands/wget/index.js +2 -0
  485. package/dist/safe-bash/commands/xml/index.browser.js +2 -2
  486. package/dist/safe-bash/commands/yq/index.browser.js +8 -3
  487. package/dist/safe-bash/commands/yq/index.d.ts +1 -6
  488. package/dist/safe-bash/commands/yq/index.js +1 -36
  489. package/dist/safe-bash/commands/zip/index.d.ts +2 -0
  490. package/dist/safe-bash/commands/zip/index.js +2 -0
  491. package/dist/safe-bash/core.browser.js +2 -2
  492. package/dist/safe-bash/core.d.ts +14 -2
  493. package/dist/safe-bash/core.js +8 -2
  494. package/dist/safe-bash/fs/s3/index.d.ts +2 -2
  495. package/dist/safe-bash/fs/s3/index.js +1 -1
  496. package/dist/safe-bash/full-core.browser.js +321 -286
  497. package/dist/safe-bash/jobs.browser.js +5 -5
  498. package/dist/safe-bash/lazy-mmdc.d.ts +6 -0
  499. package/dist/safe-bash/lazy-mmdc.js +23 -0
  500. package/dist/safe-bash/opt-in/commands/dd/index.js +2 -0
  501. package/dist/safe-bash/opt-in/commands/yq/mike.js +6 -13
  502. package/dist/safe-bash/opt-in/commands/yq/native-work.d.ts +1 -0
  503. package/dist/safe-bash/opt-in/commands/yq/native-work.js +17 -0
  504. package/dist/safe-bash/opt-in/optional/commands/shuf/options.d.ts +1 -0
  505. package/dist/safe-bash/opt-in/optional/commands/shuf/options.js +2 -4
  506. package/dist/safe-bash/opt-in/optional/commands/shuf/shuf.js +2 -1
  507. package/dist/safe-bash/optional-host.browser.js +15 -11
  508. package/dist/safe-bash/optional-host.d.ts +1 -1
  509. package/dist/safe-bash/optional-host.js +1 -1
  510. package/dist/safe-bash/playwright/ability-execution.js +3 -2
  511. package/dist/safe-bash/playwright/adapter.js +1 -1
  512. package/dist/safe-bash/playwright/controller.js +9 -8
  513. package/dist/safe-bash/playwright/modal-capabilities.js +2 -1
  514. package/dist/safe-bash/playwright/native-json-snapshot.js +4 -3
  515. package/dist/safe-bash/playwright/native-snapshot.js +5 -4
  516. package/dist/safe-bash/playwright/open-options.js +3 -3
  517. package/dist/safe-bash/playwright/resource-limit.d.ts +2 -0
  518. package/dist/safe-bash/playwright/resource-limit.js +4 -0
  519. package/dist/safe-bash/playwright/session-configuration.js +8 -3
  520. package/dist/safe-bash/playwright/snapshot.js +8 -7
  521. package/dist/safe-bash/playwright/standard-capabilities.js +5 -4
  522. package/dist/safe-bash/plugins/composition.d.ts +1 -0
  523. package/dist/safe-bash/plugins/composition.js +3 -8
  524. package/dist/safe-bash/plugins/index.browser.js +27 -29
  525. package/dist/safe-bash/registry-entry.browser.js +28 -30
  526. package/dist/safe-bash/shell/arrays/bindings.d.ts +3 -5
  527. package/dist/safe-bash/shell/arrays/bindings.js +7 -3
  528. package/dist/safe-bash/shell/arrays/state.js +4 -0
  529. package/dist/safe-bash/shell/brace-expansion.js +1 -1
  530. package/dist/safe-bash/shell/dynamic-variables.d.ts +10 -0
  531. package/dist/safe-bash/shell/dynamic-variables.js +25 -0
  532. package/dist/safe-bash/shell/input.js +16 -14
  533. package/dist/safe-bash/shell/parser.js +8 -1
  534. package/dist/safe-bash/shell/runtime.d.ts +7 -4
  535. package/dist/safe-bash/shell/runtime.js +604 -802
  536. package/dist/safe-bash/shell/shell.js +2 -31
  537. package/dist/safe-bash/shell/types.d.ts +2 -0
  538. package/dist/safe-bash/shell/value-state.js +17 -2
  539. package/dist/safe-bash/shell/worker-limits.js +1 -0
  540. package/dist/safe-bash/shell-entry.browser.js +25 -27
  541. package/dist/safe-bash/trap.browser.d.ts +3 -0
  542. package/dist/safe-bash/trap.browser.js +14 -0
  543. package/dist/safe-bash/worker/host.js +1 -1
  544. package/dist/safe-bash/yq-browser/index.js +1 -1
  545. package/dist/safe-bash-base-encoding-engine/base.js +2 -2
  546. package/dist/safe-bash-base-encoding-engine/shared.js +1 -1
  547. package/dist/safe-bash-byte-input-engine/index.d.ts +3 -2
  548. package/dist/safe-bash-byte-input-engine/index.js +4 -1
  549. package/dist/safe-bash-checksum-engine/index.js +13 -6
  550. package/dist/safe-bash-command-apply-patch/apply.d.ts +1 -1
  551. package/dist/safe-bash-command-apply-patch/apply.js +4 -3
  552. package/dist/safe-bash-command-apply-patch/index.js +4 -4
  553. package/dist/safe-bash-command-apply-patch/matcher.js +1 -1
  554. package/dist/safe-bash-command-apply-patch/parser.js +1 -1
  555. package/dist/safe-bash-command-awk/LICENSE +21 -0
  556. package/dist/safe-bash-command-awk/awk-inspection.d.ts +19 -0
  557. package/dist/safe-bash-command-awk/awk-inspection.js +9 -0
  558. package/dist/safe-bash-command-awk/awk-pipes.d.ts +19 -0
  559. package/dist/safe-bash-command-awk/awk-pipes.js +8 -0
  560. package/dist/safe-bash-command-awk/awk-pretty.d.ts +3 -0
  561. package/dist/safe-bash-command-awk/awk-pretty.js +8 -0
  562. package/dist/safe-bash-command-awk/awk-quote.d.ts +2 -0
  563. package/dist/safe-bash-command-awk/awk-quote.js +7 -0
  564. package/dist/safe-bash-command-awk/awk-reader.d.ts +42 -0
  565. package/dist/safe-bash-command-awk/awk-reader.js +9 -0
  566. package/dist/safe-bash-command-awk/awk-retention.d.ts +13 -0
  567. package/dist/safe-bash-command-awk/awk-retention.js +7 -0
  568. package/dist/safe-bash-command-awk/awk-runtime.d.ts +151 -0
  569. package/dist/safe-bash-command-awk/awk-runtime.js +11 -0
  570. package/dist/safe-bash-command-awk/awk-syntax.d.ts +144 -0
  571. package/dist/safe-bash-command-awk/awk-syntax.js +14 -0
  572. package/dist/safe-bash-command-awk/awk-values.d.ts +32 -0
  573. package/dist/safe-bash-command-awk/awk-values.js +35 -0
  574. package/dist/safe-bash-command-awk/awk.d.ts +3 -0
  575. package/dist/safe-bash-command-awk/awk.js +16 -0
  576. package/dist/safe-bash-command-awk/index.d.ts +7 -0
  577. package/dist/safe-bash-command-awk/index.js +36 -0
  578. package/dist/safe-bash-command-bc/index.d.ts +6 -0
  579. package/dist/safe-bash-command-bc/index.js +136 -266
  580. package/dist/safe-bash-command-column/column.js +5 -5
  581. package/dist/safe-bash-command-column/display.d.ts +1 -1
  582. package/dist/safe-bash-command-column/display.js +1 -1
  583. package/dist/safe-bash-command-column/index.js +5 -5
  584. package/dist/safe-bash-command-column/internal.d.ts +0 -2
  585. package/dist/safe-bash-command-column/internal.js +1 -1
  586. package/dist/safe-bash-command-column/layout.js +4 -4
  587. package/dist/safe-bash-command-column/table.js +2 -2
  588. package/dist/safe-bash-command-comm/comm.js +1 -1
  589. package/dist/safe-bash-command-comm/index.js +1 -1
  590. package/dist/safe-bash-command-csplit/command.js +2 -2
  591. package/dist/safe-bash-command-csplit/index.js +2 -2
  592. package/dist/safe-bash-command-csvcut/index.d.ts +1 -0
  593. package/dist/safe-bash-command-csvcut/index.js +1 -0
  594. package/dist/safe-bash-command-csvgrep/index.d.ts +1 -0
  595. package/dist/safe-bash-command-csvgrep/index.js +2 -2
  596. package/dist/safe-bash-command-csvkit/contracts.d.ts +1 -0
  597. package/dist/safe-bash-command-csvkit/csvpy-interpreter.d.ts +2 -1
  598. package/dist/safe-bash-command-csvkit/default-csvpy.d.ts +11 -0
  599. package/dist/safe-bash-command-csvkit/errors.js +22 -0
  600. package/dist/safe-bash-command-csvkit/index.d.ts +1 -0
  601. package/dist/safe-bash-command-csvkit/index.js +180 -12
  602. package/dist/safe-bash-command-csvkit/python-worker-browser.d.ts +3 -0
  603. package/dist/safe-bash-command-csvkit/python-worker-browser.js +16 -0
  604. package/dist/safe-bash-command-csvkit/python-worker-contract.d.ts +20 -0
  605. package/dist/safe-bash-command-csvkit/python-worker-node.d.ts +3 -0
  606. package/dist/safe-bash-command-csvkit/python-worker-node.js +9 -0
  607. package/dist/safe-bash-command-csvkit/runtime.d.ts +1 -0
  608. package/dist/safe-bash-command-csvkit/sync-support.js +1 -1
  609. package/dist/safe-bash-command-curl/LICENSE +21 -0
  610. package/dist/safe-bash-command-curl/curl.d.ts +13 -0
  611. package/dist/safe-bash-command-curl/curl.js +9 -0
  612. package/dist/safe-bash-command-curl/index.d.ts +6 -0
  613. package/dist/safe-bash-command-curl/index.js +26 -0
  614. package/dist/safe-bash-command-dd/index.js +2 -0
  615. package/dist/safe-bash-command-diff/LICENSE +21 -0
  616. package/dist/safe-bash-command-diff/diff-format.d.ts +10 -0
  617. package/dist/safe-bash-command-diff/diff-format.js +10 -0
  618. package/dist/safe-bash-command-diff/diff-options.d.ts +38 -0
  619. package/dist/safe-bash-command-diff/diff-options.js +7 -0
  620. package/dist/safe-bash-command-diff/diff-output.d.ts +20 -0
  621. package/dist/safe-bash-command-diff/diff-output.js +19 -0
  622. package/dist/safe-bash-command-diff/diff.d.ts +2 -0
  623. package/dist/safe-bash-command-diff/diff.js +10 -0
  624. package/dist/safe-bash-command-diff/index.d.ts +8 -0
  625. package/dist/safe-bash-command-diff/index.js +34 -0
  626. package/dist/safe-bash-command-diff/sync.d.ts +2 -0
  627. package/dist/safe-bash-command-diff/sync.js +9 -0
  628. package/dist/safe-bash-command-diff3/index.js +5 -5
  629. package/dist/safe-bash-command-docx/index.d.ts +4 -4
  630. package/dist/safe-bash-command-docx/index.js +12 -5
  631. package/dist/safe-bash-command-dos2unix/index.d.ts +1 -0
  632. package/dist/safe-bash-command-dos2unix/index.js +225 -1
  633. package/dist/safe-bash-command-dos2unix/sync.d.ts +1 -0
  634. package/dist/safe-bash-command-exiftool/index.d.ts +1 -0
  635. package/dist/safe-bash-command-exiftool/index.js +2 -2
  636. package/dist/safe-bash-command-factor/command.js +2 -2
  637. package/dist/safe-bash-command-factor/index.js +2 -2
  638. package/dist/safe-bash-command-fd/index.js +9 -9
  639. package/dist/safe-bash-command-ffmpeg/index.js +117 -102
  640. package/dist/safe-bash-command-file/index.js +4 -4
  641. package/dist/safe-bash-command-file/shared.js +1 -1
  642. package/dist/safe-bash-command-find/LICENSE +21 -0
  643. package/dist/safe-bash-command-find/find-format.d.ts +20 -0
  644. package/dist/safe-bash-command-find/find-format.js +9 -0
  645. package/dist/safe-bash-command-find/find.d.ts +18 -0
  646. package/dist/safe-bash-command-find/find.js +10 -0
  647. package/dist/safe-bash-command-find/index.d.ts +13 -0
  648. package/dist/safe-bash-command-find/index.js +45 -0
  649. package/dist/safe-bash-command-fmt/index.js +7 -4
  650. package/dist/safe-bash-command-git/git_rust.wasm +0 -0
  651. package/dist/safe-bash-command-git/index.js +5 -7
  652. package/dist/safe-bash-command-git/wasm.generated.js +1 -1
  653. package/dist/safe-bash-command-gzip/LICENSE +21 -0
  654. package/dist/safe-bash-command-gzip/index.d.ts +11 -0
  655. package/dist/safe-bash-command-gzip/index.js +95 -0
  656. package/dist/safe-bash-command-hexdump/command.js +4 -4
  657. package/dist/safe-bash-command-hexdump/custom.d.ts +24 -0
  658. package/dist/safe-bash-command-hexdump/index.js +4 -4
  659. package/dist/safe-bash-command-hexdump/internal.d.ts +2 -0
  660. package/dist/safe-bash-command-hexdump/internal.js +1 -1
  661. package/dist/safe-bash-command-hexdump/io.js +2 -2
  662. package/dist/safe-bash-command-hexdump/options.d.ts +3 -0
  663. package/dist/safe-bash-command-hexdump/options.js +2 -2
  664. package/dist/safe-bash-command-hostname/index.js +1 -1
  665. package/dist/safe-bash-command-html-to-markdown/budget.js +1 -1
  666. package/dist/safe-bash-command-html-to-markdown/entities.js +3 -3
  667. package/dist/safe-bash-command-html-to-markdown/index.js +11 -11
  668. package/dist/safe-bash-command-html-to-markdown/input.js +5 -5
  669. package/dist/safe-bash-command-html-to-markdown/parser.d.ts +1 -0
  670. package/dist/safe-bash-command-html-to-markdown/parser.js +4 -4
  671. package/dist/safe-bash-command-html-to-markdown/render.js +5 -5
  672. package/dist/safe-bash-command-html-to-markdown/text.js +2 -2
  673. package/dist/safe-bash-command-htmlq/index.d.ts +1 -0
  674. package/dist/safe-bash-command-htmlq/index.js +39 -17
  675. package/dist/safe-bash-command-iconv/codec.js +1 -1
  676. package/dist/safe-bash-command-iconv/command.js +2 -2
  677. package/dist/safe-bash-command-iconv/index.js +2 -2
  678. package/dist/safe-bash-command-imagemagick/index.js +45 -35
  679. package/dist/safe-bash-command-join/index.js +1 -1
  680. package/dist/safe-bash-command-join/join.js +1 -1
  681. package/dist/safe-bash-command-jq/index.js +1 -1
  682. package/dist/safe-bash-command-jq/jq.js +1 -1
  683. package/dist/safe-bash-command-less/index.js +43 -28
  684. package/dist/safe-bash-command-llm/command.js +1 -1
  685. package/dist/safe-bash-command-llm/index.d.ts +1 -0
  686. package/dist/safe-bash-command-llm/index.js +16 -14
  687. package/dist/safe-bash-command-llm/openai.js +3 -3
  688. package/dist/safe-bash-command-llm/providers/index.js +3 -3
  689. package/dist/safe-bash-command-llm/providers/openai.js +3 -3
  690. package/dist/safe-bash-command-llm/stored-schema.d.ts +10 -0
  691. package/dist/safe-bash-command-mmdc/index.d.ts +1 -0
  692. package/dist/safe-bash-command-mmdc/index.js +13 -604
  693. package/dist/safe-bash-command-mmdc/settings.d.ts +2 -0
  694. package/dist/safe-bash-command-mmdc/settings.js +7 -0
  695. package/dist/safe-bash-command-numfmt/index.js +0 -11
  696. package/dist/safe-bash-command-od/index.js +101 -68
  697. package/dist/safe-bash-command-pandoc/command.js +4 -3
  698. package/dist/safe-bash-command-pandoc/defaults.d.ts +1 -0
  699. package/dist/safe-bash-command-pandoc/index.js +4 -3
  700. package/dist/safe-bash-command-pandoc/lua-filters.js +1 -1
  701. package/dist/safe-bash-command-pandoc/types.d.ts +3 -1
  702. package/dist/safe-bash-command-paste/index.js +1 -1
  703. package/dist/safe-bash-command-paste/paste.js +1 -1
  704. package/dist/safe-bash-command-patch/LICENSE +21 -0
  705. package/dist/safe-bash-command-patch/index.d.ts +8 -0
  706. package/dist/safe-bash-command-patch/index.js +38 -0
  707. package/dist/safe-bash-command-patch/patch-envelope.d.ts +2 -0
  708. package/dist/safe-bash-command-patch/patch-envelope.js +7 -0
  709. package/dist/safe-bash-command-patch/patch-formats.d.ts +7 -0
  710. package/dist/safe-bash-command-patch/patch-formats.js +9 -0
  711. package/dist/safe-bash-command-patch/patch-gnu-paths.d.ts +41 -0
  712. package/dist/safe-bash-command-patch/patch-gnu-paths.js +26 -0
  713. package/dist/safe-bash-command-patch/patch-gnu-reject.d.ts +3 -0
  714. package/dist/safe-bash-command-patch/patch-gnu-reject.js +7 -0
  715. package/dist/safe-bash-command-patch/patch-path.d.ts +3 -0
  716. package/dist/safe-bash-command-patch/patch-path.js +11 -0
  717. package/dist/safe-bash-command-patch/patch-publication.d.ts +13 -0
  718. package/dist/safe-bash-command-patch/patch-publication.js +7 -0
  719. package/dist/safe-bash-command-patch/patch.d.ts +2 -0
  720. package/dist/safe-bash-command-patch/patch.js +14 -0
  721. package/dist/safe-bash-command-patch/sync.d.ts +2 -0
  722. package/dist/safe-bash-command-patch/sync.js +7 -0
  723. package/dist/safe-bash-command-patch/unified.d.ts +52 -0
  724. package/dist/safe-bash-command-patch/unified.js +16 -0
  725. package/dist/safe-bash-command-pathchk/index.js +3 -13
  726. package/dist/safe-bash-command-pdfimages/index.js +62 -25
  727. package/dist/safe-bash-command-pdfinfo/index.d.ts +0 -23
  728. package/dist/safe-bash-command-pdfinfo/index.js +39 -782
  729. package/dist/safe-bash-command-pdftk/index.js +40 -12
  730. package/dist/safe-bash-command-pdftoppm/index.js +76 -30
  731. package/dist/safe-bash-command-pdftotext/index.js +37 -15
  732. package/dist/safe-bash-command-pptx/index.d.ts +4 -4
  733. package/dist/safe-bash-command-pptx/index.js +11 -5
  734. package/dist/safe-bash-command-pr/command.js +2 -2
  735. package/dist/safe-bash-command-pr/index.js +4 -4
  736. package/dist/safe-bash-command-qpdf/index.js +31 -18
  737. package/dist/safe-bash-command-rg/index.d.ts +1 -0
  738. package/dist/safe-bash-command-rg/index.js +222 -1
  739. package/dist/safe-bash-command-rg/rg-command.js +1 -1
  740. package/dist/safe-bash-command-rg/sync.d.ts +1 -0
  741. package/dist/safe-bash-command-sed/LICENSE +21 -0
  742. package/dist/safe-bash-command-sed/index.d.ts +7 -0
  743. package/dist/safe-bash-command-sed/index.js +28 -0
  744. package/dist/safe-bash-command-sed/inplace.d.ts +16 -0
  745. package/dist/safe-bash-command-sed/inplace.js +9 -0
  746. package/dist/safe-bash-command-sed/sed.d.ts +3 -0
  747. package/dist/safe-bash-command-sed/sed.js +8 -0
  748. package/dist/safe-bash-command-shuf/options.d.ts +1 -0
  749. package/dist/safe-bash-command-shuf/options.js +2 -4
  750. package/dist/safe-bash-command-shuf/shuf.js +2 -1
  751. package/dist/safe-bash-command-sips/index.js +111 -35
  752. package/dist/safe-bash-command-soffice/index.js +21 -17
  753. package/dist/safe-bash-command-split/index.js +3 -3
  754. package/dist/safe-bash-command-split/io.js +1 -1
  755. package/dist/safe-bash-command-split/outputs.js +2 -2
  756. package/dist/safe-bash-command-split/split.js +3 -3
  757. package/dist/safe-bash-command-sqlite3/btree.d.ts +1 -0
  758. package/dist/safe-bash-command-sqlite3/engine.d.ts +7 -2
  759. package/dist/safe-bash-command-sqlite3/index.js +436 -537
  760. package/dist/safe-bash-command-ssconvert/commands.js +9 -9
  761. package/dist/safe-bash-command-ssconvert/core.js +8 -8
  762. package/dist/safe-bash-command-ssconvert/formats/csv.js +9 -9
  763. package/dist/safe-bash-command-ssconvert/formats/ods.js +9 -9
  764. package/dist/safe-bash-command-ssconvert/formats/spreadsheetml.js +2 -2
  765. package/dist/safe-bash-command-ssconvert/formats/xls.js +9 -9
  766. package/dist/safe-bash-command-ssconvert/formats/xlsx.js +9 -9
  767. package/dist/safe-bash-command-ssconvert/index.js +21 -21
  768. package/dist/safe-bash-command-tar/LICENSE +21 -0
  769. package/dist/safe-bash-command-tar/create.d.ts +17 -0
  770. package/dist/safe-bash-command-tar/create.js +14 -0
  771. package/dist/safe-bash-command-tar/extract.d.ts +11 -0
  772. package/dist/safe-bash-command-tar/extract.js +14 -0
  773. package/dist/safe-bash-command-tar/format.d.ts +32 -0
  774. package/dist/safe-bash-command-tar/format.js +19 -0
  775. package/dist/safe-bash-command-tar/index.d.ts +8 -0
  776. package/dist/safe-bash-command-tar/index.js +551 -0
  777. package/dist/safe-bash-command-tar/listing.d.ts +2 -0
  778. package/dist/safe-bash-command-tar/listing.js +7 -0
  779. package/dist/safe-bash-command-tar/modes.d.ts +5 -0
  780. package/dist/safe-bash-command-tar/modes.js +16 -0
  781. package/dist/safe-bash-command-tar/options.d.ts +53 -0
  782. package/dist/safe-bash-command-tar/options.js +10 -0
  783. package/dist/safe-bash-command-tar/stream.d.ts +22 -0
  784. package/dist/safe-bash-command-tar/stream.js +15 -0
  785. package/dist/safe-bash-command-tar/transform.d.ts +16 -0
  786. package/dist/safe-bash-command-tar/transform.js +9 -0
  787. package/dist/safe-bash-command-tree/arguments.js +3 -3
  788. package/dist/safe-bash-command-tree/charset.js +1 -1
  789. package/dist/safe-bash-command-tree/index.js +4 -4
  790. package/dist/safe-bash-command-tree/io.js +1 -1
  791. package/dist/safe-bash-command-tree/pattern.js +2 -2
  792. package/dist/safe-bash-command-tree/tree.js +4 -4
  793. package/dist/safe-bash-command-unrtf/index.js +14 -7
  794. package/dist/safe-bash-command-unzip/LICENSE +21 -0
  795. package/dist/safe-bash-command-unzip/index.d.ts +7 -0
  796. package/dist/safe-bash-command-unzip/index.js +39 -0
  797. package/dist/safe-bash-command-unzip/sync.d.ts +3 -0
  798. package/dist/safe-bash-command-unzip/sync.js +9 -0
  799. package/dist/safe-bash-command-unzip/unzip/safety.d.ts +32 -0
  800. package/dist/safe-bash-command-unzip/unzip/safety.js +7 -0
  801. package/dist/safe-bash-command-unzip/unzip.d.ts +3 -0
  802. package/dist/safe-bash-command-unzip/unzip.js +8 -0
  803. package/dist/safe-bash-command-wget/LICENSE +21 -0
  804. package/dist/safe-bash-command-wget/index.d.ts +6 -0
  805. package/dist/safe-bash-command-wget/index.js +26 -0
  806. package/dist/safe-bash-command-wget/wget.d.ts +3 -0
  807. package/dist/safe-bash-command-wget/wget.js +7 -0
  808. package/dist/safe-bash-command-xan/argv.d.ts +4 -1
  809. package/dist/safe-bash-command-xan/argv.js +1 -1
  810. package/dist/safe-bash-command-xan/commands.js +6 -3
  811. package/dist/safe-bash-command-xan/csv.d.ts +1 -1
  812. package/dist/safe-bash-command-xan/csv.js +1 -1
  813. package/dist/safe-bash-command-xan/index.js +18 -17
  814. package/dist/safe-bash-command-xan/io.js +3 -3
  815. package/dist/safe-bash-command-xmllint/index.js +190 -50
  816. package/dist/safe-bash-command-xxd/index.js +105 -91
  817. package/dist/safe-bash-command-xz/command.d.ts +2 -0
  818. package/dist/safe-bash-command-xz/index.d.ts +1 -1
  819. package/dist/safe-bash-command-xz/index.js +11 -2
  820. package/dist/safe-bash-command-xz/options.d.ts +9 -1
  821. package/dist/safe-bash-command-xz/options.js +3 -1
  822. package/dist/safe-bash-command-yq/index.d.ts +4 -11
  823. package/dist/safe-bash-command-yq/index.js +3367 -670
  824. package/dist/safe-bash-command-yq/mike.js +6 -13
  825. package/dist/safe-bash-command-yq/native-work.d.ts +1 -0
  826. package/dist/safe-bash-command-yq/native-work.js +17 -0
  827. package/dist/safe-bash-command-yq/query.d.ts +11 -0
  828. package/dist/safe-bash-command-yq/query.js +735 -0
  829. package/dist/safe-bash-command-zip/LICENSE +21 -0
  830. package/dist/safe-bash-command-zip/index.d.ts +7 -0
  831. package/dist/safe-bash-command-zip/index.js +38 -0
  832. package/dist/safe-bash-command-zip/sync.d.ts +3 -0
  833. package/dist/safe-bash-command-zip/sync.js +9 -0
  834. package/dist/safe-bash-command-zip/zip.d.ts +3 -0
  835. package/dist/safe-bash-command-zip/zip.js +7 -0
  836. package/dist/safe-bash-compression-engine/files.js +4 -4
  837. package/dist/safe-bash-compression-engine/index.js +2 -2
  838. package/dist/safe-bash-compression-engine/operand.js +6 -6
  839. package/dist/safe-bash-compression-engine/stream.js +2 -2
  840. package/dist/safe-bash-compression-engine/zstd-decode.js +1 -1
  841. package/dist/safe-bash-contracts/command.js +1 -1
  842. package/dist/safe-bash-contracts/diagnostics.js +4 -4
  843. package/dist/safe-bash-contracts/escaping.js +12 -12
  844. package/dist/safe-bash-contracts/filesystem-descriptor.js +1 -1
  845. package/dist/safe-bash-contracts/filesystem-output.js +8 -8
  846. package/dist/safe-bash-contracts/index.d.ts +1 -0
  847. package/dist/safe-bash-contracts/index.js +39 -35
  848. package/dist/safe-bash-contracts/io.d.ts +4 -1
  849. package/dist/safe-bash-contracts/io.js +4 -2
  850. package/dist/safe-bash-contracts/managed-abort.d.ts +10 -0
  851. package/dist/safe-bash-contracts/output.js +3 -3
  852. package/dist/safe-bash-diff-engine/LICENSE +21 -0
  853. package/dist/safe-bash-diff-engine/index.d.ts +1 -0
  854. package/dist/safe-bash-diff-engine/index.js +24 -0
  855. package/dist/safe-bash-diff-engine/shared.d.ts +54 -0
  856. package/dist/safe-bash-diff-engine/shared.js +19 -0
  857. package/dist/safe-bash-io-engine/commands/archive/internal.js +5 -23
  858. package/dist/safe-bash-io-engine/commands/directory-admission.d.ts +3 -0
  859. package/dist/safe-bash-io-engine/commands/directory-admission.js +34 -0
  860. package/dist/safe-bash-io-engine/commands/mode-change.d.ts +4 -0
  861. package/dist/safe-bash-io-engine/commands/mode-change.js +60 -0
  862. package/dist/safe-bash-io-engine/commands/search/requirements.js +2 -2
  863. package/dist/safe-bash-io-engine/commands/text-programs/shared.js +44 -66
  864. package/dist/safe-bash-io-engine/internal.js +1 -1
  865. package/dist/safe-bash-io-engine/shell/pattern.js +8 -13
  866. package/dist/safe-bash-io-engine/shell/string-operations.js +1 -1
  867. package/dist/safe-bash-markdown-engine/commonmark-blocks.js +4 -4
  868. package/dist/safe-bash-markdown-engine/commonmark-inlines.js +4 -4
  869. package/dist/safe-bash-markdown-engine/commonmark-syntax.js +2 -2
  870. package/dist/safe-bash-markdown-engine/gfm-syntax.js +3 -3
  871. package/dist/safe-bash-markdown-engine/index.js +7 -7
  872. package/dist/safe-bash-mcp/index.browser.d.ts +161 -35
  873. package/dist/safe-bash-mcp/index.browser.js +417 -0
  874. package/dist/safe-bash-mcp/index.d.ts +66 -2
  875. package/dist/safe-bash-mcp/index.js +1838 -122
  876. package/dist/safe-bash-network-engine/LICENSE +21 -0
  877. package/dist/safe-bash-network-engine/aggregate.d.ts +4 -0
  878. package/dist/safe-bash-network-engine/aggregate.js +37 -0
  879. package/dist/safe-bash-network-engine/args.d.ts +68 -0
  880. package/dist/safe-bash-network-engine/args.js +19 -0
  881. package/dist/safe-bash-network-engine/authorizer.d.ts +6 -0
  882. package/dist/safe-bash-network-engine/authorizer.js +8 -0
  883. package/dist/safe-bash-network-engine/body.d.ts +9 -0
  884. package/dist/safe-bash-network-engine/body.js +374 -0
  885. package/dist/safe-bash-network-engine/deadline.d.ts +2 -0
  886. package/dist/safe-bash-network-engine/deadline.js +7 -0
  887. package/dist/safe-bash-network-engine/decode.d.ts +2 -0
  888. package/dist/safe-bash-network-engine/decode.js +80 -0
  889. package/dist/safe-bash-network-engine/fetch-transport.d.ts +7 -0
  890. package/dist/safe-bash-network-engine/fetch-transport.js +9 -0
  891. package/dist/safe-bash-network-engine/form-content-type.d.ts +5 -0
  892. package/dist/safe-bash-network-engine/form-content-type.js +8 -0
  893. package/dist/safe-bash-network-engine/form-headers.d.ts +2 -0
  894. package/dist/safe-bash-network-engine/form-headers.js +10 -0
  895. package/dist/safe-bash-network-engine/glob.d.ts +7 -0
  896. package/dist/safe-bash-network-engine/glob.js +124 -0
  897. package/dist/safe-bash-network-engine/index.d.ts +3 -0
  898. package/dist/safe-bash-network-engine/index.js +26 -0
  899. package/dist/safe-bash-network-engine/input.d.ts +5 -0
  900. package/dist/safe-bash-network-engine/input.js +255 -0
  901. package/dist/safe-bash-network-engine/output.d.ts +6 -0
  902. package/dist/safe-bash-network-engine/output.js +132 -0
  903. package/dist/safe-bash-network-engine/platform-portable.d.ts +5 -0
  904. package/dist/safe-bash-network-engine/platform-portable.js +19 -0
  905. package/dist/safe-bash-network-engine/private-address.d.ts +1 -0
  906. package/dist/safe-bash-network-engine/private-address.js +7 -0
  907. package/dist/safe-bash-network-engine/shared.d.ts +14 -0
  908. package/dist/safe-bash-network-engine/shared.js +23 -0
  909. package/dist/safe-bash-network-engine/types.d.ts +42 -0
  910. package/dist/safe-bash-network-engine/types.js +11 -0
  911. package/dist/safe-bash-network-engine/url.d.ts +2 -0
  912. package/dist/safe-bash-network-engine/url.js +8 -0
  913. package/dist/safe-bash-query-engine/capture.d.ts +1 -0
  914. package/dist/safe-bash-query-engine/capture.js +9 -7
  915. package/dist/safe-bash-query-engine/dates.d.ts +5 -1
  916. package/dist/safe-bash-query-engine/dates.js +10 -2
  917. package/dist/safe-bash-query-engine/delpaths.js +5 -5
  918. package/dist/safe-bash-query-engine/formats.js +3 -3
  919. package/dist/safe-bash-query-engine/index.js +15 -15
  920. package/dist/safe-bash-query-engine/indices.js +5 -5
  921. package/dist/safe-bash-query-engine/input.d.ts +1 -2
  922. package/dist/safe-bash-query-engine/input.js +2 -4
  923. package/dist/safe-bash-query-engine/interpreter.d.ts +5 -0
  924. package/dist/safe-bash-query-engine/interpreter.js +13 -13
  925. package/dist/safe-bash-query-engine/limits.js +1 -1
  926. package/dist/safe-bash-query-engine/parser.d.ts +8 -1
  927. package/dist/safe-bash-query-engine/parser.js +2 -2
  928. package/dist/safe-bash-query-engine/query-core.js +15 -15
  929. package/dist/safe-bash-query-engine/recurse.js +2 -2
  930. package/dist/safe-bash-query-engine/regex.d.ts +4 -2
  931. package/dist/safe-bash-query-engine/regex.js +10 -5
  932. package/dist/safe-bash-query-engine/split.js +2 -2
  933. package/dist/safe-bash-query-engine/splits.d.ts +1 -1
  934. package/dist/safe-bash-query-engine/splits.js +7 -6
  935. package/dist/safe-bash-query-engine/values.js +4 -4
  936. package/dist/safe-bash-regex-engine/ere/matcher.js +106 -34
  937. package/dist/safe-bash-regex-engine/execution/bounded-provider.js +55 -67
  938. package/dist/safe-bash-regex-engine/execution/portable.d.ts +0 -1
  939. package/dist/safe-bash-regex-engine/execution/portable.js +6 -10
  940. package/dist/safe-bash-regex-engine/execution/protocol.d.ts +0 -5
  941. package/dist/safe-bash-regex-engine/execution/protocol.js +1 -3
  942. package/dist/safe-bash-regex-engine/index.js +6 -4
  943. package/dist/safe-bash-regex-engine/text/budget.d.ts +1 -0
  944. package/dist/safe-bash-regex-engine/text/budget.js +1 -1
  945. package/dist/safe-bash-regex-engine/text/regex.d.ts +15 -0
  946. package/dist/safe-bash-regex-engine/text/regex.js +6 -4
  947. package/dist/safe-bash-regex-engine/text/replacement-buffer.js +2 -2
  948. package/dist/safe-bash-regex-engine/text/rust-syntax.js +2 -2
  949. package/dist/safe-bash-search-engine/ergonomic-regex.d.ts +12 -2
  950. package/dist/safe-bash-search-engine/ergonomic-regex.js +2 -2
  951. package/dist/safe-bash-search-engine/glob.js +2 -2
  952. package/dist/safe-bash-search-engine/grep.js +191 -229
  953. package/dist/safe-bash-search-engine/matcher.d.ts +6 -2
  954. package/dist/safe-bash-search-engine/matcher.js +30 -8
  955. package/dist/safe-bash-search-engine/options.js +1 -1
  956. package/dist/safe-bash-search-engine/output.d.ts +3 -2
  957. package/dist/safe-bash-search-engine/output.js +111 -30
  958. package/dist/safe-bash-search-engine/shared.d.ts +2 -0
  959. package/dist/safe-bash-search-engine/shared.js +2 -2
  960. package/dist/safe-bash-search-engine/walk.js +11 -10
  961. package/dist/safe-bash-table-text-engine/table-text/internal.d.ts +7 -5
  962. package/dist/safe-bash-table-text-engine/table-text/internal.js +39 -21
  963. package/dist/safe-bash-xml-engine/document.d.ts +1 -1
  964. package/dist/safe-bash-xml-engine/document.js +3 -3
  965. package/dist/safe-bash-xml-engine/evaluate.d.ts +1 -0
  966. package/dist/safe-bash-xml-engine/evaluate.js +4 -1
  967. package/dist/safe-bash-xml-engine/index.js +8 -6
  968. package/dist/safe-bash-xml-engine/io.js +1 -1
  969. package/dist/safe-bash-xml-engine/limits.d.ts +2 -0
  970. package/dist/safe-bash-xml-engine/limits.js +1 -1
  971. package/dist/safe-bash-xml-engine/predicate.d.ts +57 -0
  972. package/dist/safe-bash-xml-engine/query.d.ts +3 -15
  973. package/dist/safe-bash-xml-engine/query.js +3 -2
  974. package/dist/safe-bash-zip-engine/LICENSE +21 -0
  975. package/dist/safe-bash-zip-engine/index.d.ts +1 -0
  976. package/dist/safe-bash-zip-engine/index.js +32 -0
  977. package/dist/safe-bash-zip-engine/unzip/arguments.d.ts +53 -0
  978. package/dist/safe-bash-zip-engine/unzip/arguments.js +270 -0
  979. package/dist/safe-bash-zip-engine/zip/aes.d.ts +17 -0
  980. package/dist/safe-bash-zip-engine/zip/aes.js +15 -0
  981. package/dist/safe-bash-zip-engine/zip/comments.d.ts +17 -0
  982. package/dist/safe-bash-zip-engine/zip/comments.js +77 -0
  983. package/dist/safe-bash-zip-engine/zip/crc.d.ts +1 -0
  984. package/dist/safe-bash-zip-engine/zip/crc.js +7 -0
  985. package/dist/safe-bash-zip-engine/zip/crypto.d.ts +19 -0
  986. package/dist/safe-bash-zip-engine/zip/crypto.js +16 -0
  987. package/dist/safe-bash-zip-engine/zip/dates.d.ts +4 -0
  988. package/dist/safe-bash-zip-engine/zip/dates.js +68 -0
  989. package/dist/safe-bash-zip-engine/zip/environment.d.ts +2 -0
  990. package/dist/safe-bash-zip-engine/zip/environment.js +60 -0
  991. package/dist/safe-bash-zip-engine/zip/grow.d.ts +3 -0
  992. package/dist/safe-bash-zip-engine/zip/grow.js +7 -0
  993. package/dist/safe-bash-zip-engine/zip/help.d.ts +4 -0
  994. package/dist/safe-bash-zip-engine/zip/help.js +194 -0
  995. package/dist/safe-bash-zip-engine/zip/line-endings.d.ts +2 -0
  996. package/dist/safe-bash-zip-engine/zip/line-endings.js +165 -0
  997. package/dist/safe-bash-zip-engine/zip/log.d.ts +22 -0
  998. package/dist/safe-bash-zip-engine/zip/log.js +153 -0
  999. package/dist/safe-bash-zip-engine/zip/lzma.d.ts +9 -0
  1000. package/dist/safe-bash-zip-engine/zip/lzma.js +7 -0
  1001. package/dist/safe-bash-zip-engine/zip/move.d.ts +11 -0
  1002. package/dist/safe-bash-zip-engine/zip/move.js +57 -0
  1003. package/dist/safe-bash-zip-engine/zip/names.d.ts +2 -0
  1004. package/dist/safe-bash-zip-engine/zip/names.js +37 -0
  1005. package/dist/safe-bash-zip-engine/zip/options.d.ts +13 -0
  1006. package/dist/safe-bash-zip-engine/zip/options.js +23 -0
  1007. package/dist/safe-bash-zip-engine/zip/repair.d.ts +10 -0
  1008. package/dist/safe-bash-zip-engine/zip/repair.js +348 -0
  1009. package/dist/safe-bash-zip-engine/zip/safety.d.ts +54 -0
  1010. package/dist/safe-bash-zip-engine/zip/safety.js +19 -0
  1011. package/dist/safe-bash-zip-engine/zip/sfx.d.ts +4 -0
  1012. package/dist/safe-bash-zip-engine/zip/sfx.js +58 -0
  1013. package/dist/safe-bash-zip-engine/zip/test-command.d.ts +5 -0
  1014. package/dist/safe-bash-zip-engine/zip/test-command.js +98 -0
  1015. package/dist/safe-bash-zip-engine/zip/volumes.d.ts +21 -0
  1016. package/dist/safe-bash-zip-engine/zip/volumes.js +255 -0
  1017. package/dist/safe-bash-zip-engine/zip/zip64.d.ts +30 -0
  1018. package/dist/safe-bash-zip-engine/zip/zip64.js +25 -0
  1019. package/dist/safe-bash-zip-engine/zip-format.d.ts +68 -0
  1020. package/dist/safe-bash-zip-engine/zip-format.js +27 -0
  1021. package/dist/safe-playwright-cloudflare/browser-codegen.generated.d.ts +7 -7
  1022. package/dist/safe-playwright-cloudflare/browser-codegen.generated.js +866 -8069
  1023. package/dist/safe-playwright-cloudflare/browser-run-code-budget.d.ts +0 -1
  1024. package/dist/safe-playwright-cloudflare/browser-run-code-budget.js +0 -2
  1025. package/dist/safe-playwright-cloudflare/browser-trace-archive.d.ts +5 -1
  1026. package/dist/safe-playwright-cloudflare/browser-trace-archive.js +2 -1
  1027. package/dist/safe-playwright-cloudflare/browser-trace-budget.js +8 -4
  1028. package/dist/safe-playwright-cloudflare/shell-browser-resource.d.ts +2 -0
  1029. package/dist/safe-playwright-cloudflare/shell-browser-resource.js +3 -11
  1030. package/dist/safe-playwright-cloudflare/shell-playwright.d.ts +2 -0
  1031. package/dist/safe-playwright-cloudflare/shell-playwright.js +1 -1
  1032. package/dist/spreadsheet-engine/codecs/odf-hyperlinks.js +8 -2
  1033. package/dist/spreadsheet-engine/formulas/functions/captured-bessel-phase.js +2 -2
  1034. package/dist/spreadsheet-engine/formulas/label-references.js +54 -33
  1035. package/dist/spreadsheet-engine/formulas/parser.js +3 -1
  1036. package/dist/spreadsheet-engine/formulas/rewriting.js +13 -3
  1037. package/dist/spreadsheet-engine/io/publication.d.ts +1 -0
  1038. package/dist/spreadsheet-format-xls/biff-data-tables.js +4 -6
  1039. package/dist/spreadsheet-format-xls/biff-formulas.js +3 -0
  1040. package/dist/spreadsheet-format-xls/biff-label-ranges.js +9 -6
  1041. package/dist/spreadsheet-format-xls/biff.js +1 -1
  1042. package/dist/xlsx-ast/xlsx.js +8 -5
  1043. package/package.json +165 -15
  1044. package/dist/safe-bash/chunks/chunk-AZAJJVFX.js +0 -23017
  1045. package/dist/safe-bash/chunks/chunk-O4ZUCRGN.js +0 -13
  1046. package/dist/safe-bash/chunks/chunk-S264DZO2.js +0 -243
  1047. package/dist/safe-bash/chunks/chunk-WVG5SHHQ.js +0 -12
  1048. package/dist/safe-bash/chunks/chunk-ZW6K2J7P.js +0 -2652
  1049. package/dist/safe-bash/command-chunks/chunk-5MPOQ6V3.js +0 -181
  1050. package/dist/safe-bash/command-chunks/chunk-BIXLZ3OG.js +0 -14342
  1051. package/dist/safe-bash/command-chunks/chunk-DUYJE2HY.js +0 -14
  1052. package/dist/safe-bash/command-chunks/chunk-KAGBORIC.js +0 -88
  1053. package/dist/safe-bash/command-chunks/chunk-NETECMOF.js +0 -40
  1054. package/dist/safe-bash/command-chunks/chunk-XS3PGJU2.js +0 -343
  1055. package/dist/safe-bash/command-chunks/chunk-XTZALMLR.js +0 -488
  1056. package/dist/safe-bash/commands/archive/zip/aes-primitives-unavailable.d.ts +0 -2
  1057. package/dist/safe-bash/commands/archive/zip/aes-primitives-unavailable.js +0 -3
  1058. package/dist/safe-bash/commands/archive/zip/aes-primitives.d.ts +0 -2
  1059. package/dist/safe-bash/commands/archive/zip/aes-primitives.js +0 -3
  1060. package/dist/safe-bash/commands/xml/document.d.ts +0 -2
  1061. package/dist/safe-bash/commands/xml/document.js +0 -2
  1062. package/dist/safe-bash/commands/xml/evaluate.d.ts +0 -2
  1063. package/dist/safe-bash/commands/xml/evaluate.js +0 -2
  1064. package/dist/safe-bash/commands/xml/json.d.ts +0 -2
  1065. package/dist/safe-bash/commands/xml/json.js +0 -2
  1066. package/dist/safe-bash/commands/xml/limits.d.ts +0 -2
  1067. package/dist/safe-bash/commands/xml/limits.js +0 -2
  1068. package/dist/safe-bash/commands/xml/query.d.ts +0 -2
  1069. package/dist/safe-bash/commands/xml/query.js +0 -2
  1070. package/dist/safe-bash/command-chunks/{chunk-FIUFIDAO.js → chunk-2JRBIDAD.js} +3 -3
  1071. package/dist/safe-bash/command-chunks/{chunk-BWNXWI33.js → chunk-2LMZVE3I.js} +0 -0
  1072. package/dist/safe-bash/command-chunks/{chunk-B5BKA5WH.js → chunk-B5TAOCKD.js} +3 -3
  1073. package/dist/safe-bash/command-chunks/{chunk-2ENZ6JGA.js → chunk-KEV7C3KH.js} +3 -3
  1074. package/dist/safe-bash/command-chunks/{chunk-S62HELHU.js → chunk-PL6O4K6W.js} +3 -3
  1075. package/dist/safe-bash/command-chunks/{chunk-DDLQ5YDB.js → chunk-YHFXOX6U.js} +9 -9
  1076. package/dist/safe-bash/command-chunks/{chunk-DQMOM72Z.js → chunk-ZRRBXU3M.js} +4 -4
@@ -34253,7 +34253,7 @@ var CCITT_BLACK_CODES = /* @__PURE__ */ new Map([
34253
34253
  ]);
34254
34254
  function decodeCcittFax(bytes, parms) {
34255
34255
  const columns = Math.max(1, parms?.Columns ?? 1728);
34256
- const maxRows = parms?.Rows && parms.Rows > 0 ? parms.Rows : 2048;
34256
+ const maxRows = parms?.Rows && parms.Rows > 0 ? parms.Rows : Infinity;
34257
34257
  const k = parms?.K ?? 0;
34258
34258
  const blackIs1 = parms?.BlackIs1 ?? false;
34259
34259
  const byteAlign = parms?.EncodedByteAlign ?? false;
@@ -47901,6 +47901,7 @@ function formatExtractedPageText(page, options = {}) {
47901
47901
  if (Math.abs(dy) > 4) return dy;
47902
47902
  return a.bbox[0] - b.bbox[0];
47903
47903
  });
47904
+ const leftMargin = allLines.reduce((left, line) => Math.min(left, line.bbox[0]), Infinity);
47904
47905
  const rows = [];
47905
47906
  for (const l of allLines) {
47906
47907
  const lastRow = rows[rows.length - 1];
@@ -47914,17 +47915,17 @@ function formatExtractedPageText(page, options = {}) {
47914
47915
  row.sort((a, b) => a.bbox[0] - b.bbox[0]);
47915
47916
  const pitch = options.fixedPitch !== void 0 && options.fixedPitch > 0 ? options.fixedPitch : 6;
47916
47917
  let lineStr = "";
47917
- let curX = 0;
47918
+ let curX = leftMargin;
47918
47919
  if (options.fixedPitch !== void 0 && options.fixedPitch > 0) {
47919
47920
  const words = row.flatMap((seg) => seg.words).sort((a, b) => a.bbox[0] - b.bbox[0]);
47920
47921
  for (const w of words) {
47921
- const spaces = Math.max(curX > 0 ? 1 : 0, Math.round((w.bbox[0] - curX) / pitch));
47922
+ const spaces = Math.max(lineStr.length > 0 ? 1 : 0, Math.round((w.bbox[0] - curX) / pitch));
47922
47923
  lineStr += " ".repeat(Math.min(spaces, 80)) + w.text;
47923
47924
  curX = w.bbox[2];
47924
47925
  }
47925
47926
  } else {
47926
47927
  for (const seg of row) {
47927
- const spaces = Math.max(curX > 0 ? 2 : 0, Math.round((seg.bbox[0] - curX) / pitch));
47928
+ const spaces = Math.max(lineStr.length > 0 ? 2 : 0, Math.round((seg.bbox[0] - curX) / pitch));
47928
47929
  lineStr += " ".repeat(Math.min(spaces, 40)) + seg.text;
47929
47930
  curX = seg.bbox[2];
47930
47931
  }
@@ -57036,6 +57037,21 @@ var Duplex = class extends EventEmitter {
57036
57037
  }
57037
57038
  };
57038
57039
 
57040
+ // ../safe-fs/dist/platform/transport-budget.js
57041
+ var hasRegisteredS3FileSystem = false;
57042
+ function enableS3TransportBudget() {
57043
+ hasRegisteredS3FileSystem = true;
57044
+ }
57045
+ var budgetKey = /* @__PURE__ */ Symbol("scoped-transport-budget");
57046
+ function chargeTransportOptions(options) {
57047
+ for (const frame of options?.[budgetKey] ?? []) {
57048
+ if (frame.credit > 0)
57049
+ frame.credit--;
57050
+ else
57051
+ frame.admit(options);
57052
+ }
57053
+ }
57054
+
57039
57055
  // ../safe-fs/dist/platform/browser.js
57040
57056
  var platform = Object.freeze({
57041
57057
  nativeFileSystem: Object.freeze({ open: false, permissions: false, timestamps: false, conditionalChmod: false, trustedOwnedStaging: false, atomicRename: false }),
@@ -57076,6 +57092,10 @@ var comparisonContext = Object.freeze({
57076
57092
  }
57077
57093
  }
57078
57094
  });
57095
+ function chargeScopedTransportCall(options) {
57096
+ options?.signal?.throwIfAborted();
57097
+ chargeTransportOptions(options);
57098
+ }
57079
57099
 
57080
57100
  // ../safe-fs/dist/contracts/errors.js
57081
57101
  var descriptions = {
@@ -57187,6 +57207,48 @@ var EMPTY_BYTE_SOURCE = Object.freeze({
57187
57207
  });
57188
57208
  var noop = () => {
57189
57209
  };
57210
+ async function collectBytes(source, options) {
57211
+ if (options.maxBytes !== void 0 && options.maxBytes !== Infinity && (!Number.isSafeInteger(options.maxBytes) || options.maxBytes < 0)) {
57212
+ throw new RangeError("maxBytes must be a nonnegative safe integer");
57213
+ }
57214
+ if (options.maxMemoryBytes !== void 0 && options.maxMemoryBytes !== Infinity && (!Number.isSafeInteger(options.maxMemoryBytes) || options.maxMemoryBytes < 0)) {
57215
+ throw new RangeError("maxMemoryBytes must be a nonnegative safe integer or Infinity");
57216
+ }
57217
+ const memoryLimit = options.maxMemoryBytes ?? Infinity;
57218
+ let reserved = 0;
57219
+ let inputBytes = 0;
57220
+ let buffer = new Uint8Array(0);
57221
+ let size = 0;
57222
+ function reserve(bytes) {
57223
+ if (bytes > memoryLimit - reserved) {
57224
+ throw new FsError("EFBIG", { syscall: "collectBytes", message: "collection exceeds memory budget" });
57225
+ }
57226
+ reserved += bytes;
57227
+ }
57228
+ options.signal?.throwIfAborted();
57229
+ for await (const chunk of readBytes(source, options.signal)) {
57230
+ reserved -= inputBytes;
57231
+ inputBytes = 0;
57232
+ if (chunk.byteLength > (options.maxBytes ?? Infinity) - size) {
57233
+ throw new FsError("EFBIG", { syscall: "collectBytes", message: "output exceeds maxBytes" });
57234
+ }
57235
+ reserve(chunk.buffer.byteLength);
57236
+ inputBytes = chunk.buffer.byteLength;
57237
+ const nextSize = size + chunk.byteLength;
57238
+ if (nextSize > buffer.byteLength) {
57239
+ const capacity = Math.min(options.maxBytes ?? Infinity, Math.max(nextSize, buffer.byteLength * 2));
57240
+ reserve(capacity);
57241
+ const replacement = new Uint8Array(capacity);
57242
+ replacement.set(buffer.subarray(0, size));
57243
+ reserved -= buffer.byteLength;
57244
+ buffer = replacement;
57245
+ }
57246
+ buffer.set(chunk, size);
57247
+ size = nextSize;
57248
+ }
57249
+ options.signal?.throwIfAborted();
57250
+ return buffer.subarray(0, size);
57251
+ }
57190
57252
  async function abortable(operation, signal) {
57191
57253
  signal?.throwIfAborted();
57192
57254
  if (!signal)
@@ -57632,16 +57694,31 @@ async function openFileDescriptor(path, options, capabilities, acquire) {
57632
57694
  }
57633
57695
 
57634
57696
  // ../safe-fs/dist/contracts/virtual-path.js
57635
- var MAX_PATH_BYTES = 65536;
57636
- var MAX_PATH_COMPONENTS = 2048;
57637
- function validatePath(path, maxComponents = MAX_PATH_COMPONENTS) {
57697
+ function pathByteLength(path) {
57698
+ let bytes = 0;
57699
+ for (const point of path) {
57700
+ const code = point.codePointAt(0);
57701
+ bytes += code <= 127 ? 1 : code <= 2047 ? 2 : code <= 65535 ? 3 : 4;
57702
+ }
57703
+ return bytes;
57704
+ }
57705
+ function validatePath(path, limits = {}) {
57706
+ const maxBytes = typeof limits === "number" ? Infinity : limits.maxPathBytes ?? Infinity;
57707
+ const maxComponents = typeof limits === "number" ? limits : limits.maxPathComponents ?? Infinity;
57708
+ for (const value of [maxBytes, maxComponents]) {
57709
+ if (value !== Infinity && (!Number.isSafeInteger(value) || value < 0)) {
57710
+ throw new RangeError("Path limits must be nonnegative safe integers or Infinity");
57711
+ }
57712
+ }
57638
57713
  if (typeof path !== "string" || path.includes("\0")) {
57639
57714
  throw new FsError("EINVAL", { syscall: "resolve", message: "paths must be strings without NUL bytes" });
57640
57715
  }
57641
- if (path.length > MAX_PATH_BYTES) {
57716
+ if (maxBytes !== Infinity && pathByteLength(path) > maxBytes) {
57642
57717
  throw new FsError("ENAMETOOLONG", { syscall: "resolve", path });
57643
57718
  }
57644
- const limit = Math.min(maxComponents, MAX_PATH_COMPONENTS);
57719
+ if (maxComponents === Infinity)
57720
+ return;
57721
+ const limit = maxComponents;
57645
57722
  let components2 = 0;
57646
57723
  let inComponent = false;
57647
57724
  for (let i = 0; i < path.length; i++) {
@@ -57931,10 +58008,76 @@ async function compareEntries(filesystem, path, peer, peerPath, options = {}) {
57931
58008
  }
57932
58009
 
57933
58010
  // ../safe-fs/dist/fs/s3/registry.js
58011
+ var observedStats = /* @__PURE__ */ new WeakMap();
57934
58012
  var entries = /* @__PURE__ */ new WeakMap();
58013
+ var comparisons = /* @__PURE__ */ new WeakMap();
58014
+ var configuredComparisons = /* @__PURE__ */ new WeakMap();
58015
+ function recordS3Observation(filesystem, path, stat, entry) {
58016
+ observedStats.set(stat, { filesystem, path, entry });
58017
+ }
58018
+ function registerS3EntryOwner(filesystem, normalize2, intact, baseComparison, comparison) {
58019
+ enableS3TransportBudget();
58020
+ comparisons.set(filesystem, baseComparison);
58021
+ if (comparison)
58022
+ configuredComparisons.set(filesystem, comparison);
58023
+ entries.set(filesystem, (view) => {
58024
+ if (!intact())
58025
+ return void 0;
58026
+ const observation = observedStats.get(view.stat);
58027
+ return observation?.filesystem === filesystem && observation.path === normalize2(view.path) ? observation.entry : void 0;
58028
+ });
58029
+ }
57935
58030
  function getOwnedS3Entry(view) {
57936
58031
  return entries.get(view.filesystem)?.(view);
57937
58032
  }
58033
+ async function compareOwnedS3Entries(own, peer, options) {
58034
+ options.signal?.throwIfAborted();
58035
+ let explicit = false;
58036
+ let answer = "unknown";
58037
+ const visited = /* @__PURE__ */ new Set();
58038
+ for (const [left2, right2] of [[own, peer], [peer, own]]) {
58039
+ const baseComparison = comparisons.get(left2.filesystem);
58040
+ if (!baseComparison || visited.has(left2.filesystem))
58041
+ continue;
58042
+ visited.add(left2.filesystem);
58043
+ const current = left2.filesystem.compareEntry;
58044
+ const comparison = current === baseComparison ? configuredComparisons.get(left2.filesystem) : current;
58045
+ if (current === baseComparison && comparison === void 0)
58046
+ continue;
58047
+ explicit = true;
58048
+ if (comparison === void 0)
58049
+ continue;
58050
+ options.signal?.throwIfAborted();
58051
+ if (typeof comparison !== "function") {
58052
+ throw new FsError("EIO", { path: own.path, dest: peer.path, message: "invalid explicit S3 comparison method" });
58053
+ }
58054
+ assertCallbackAuthorityAllowed();
58055
+ const result = await comparison.call(left2.filesystem, left2.path, right2.filesystem, right2.path, options);
58056
+ options.signal?.throwIfAborted();
58057
+ if (result !== "same" && result !== "distinct" && result !== "unknown") {
58058
+ throw new FsError("EIO", { path: own.path, dest: peer.path, message: "invalid explicit S3 comparison" });
58059
+ }
58060
+ if (result === "unknown")
58061
+ continue;
58062
+ if (answer !== "unknown" && answer !== result) {
58063
+ throw new FsError("EIO", { path: own.path, dest: peer.path, message: "conflicting explicit S3 comparisons" });
58064
+ }
58065
+ answer = result;
58066
+ }
58067
+ const left = getOwnedS3Entry(own);
58068
+ options.signal?.throwIfAborted();
58069
+ const right = getOwnedS3Entry(peer);
58070
+ options.signal?.throwIfAborted();
58071
+ const same = left && right && left.storage === right.storage && left.key === right.key;
58072
+ if (same && answer === "distinct") {
58073
+ throw new FsError("EIO", { path: own.path, dest: peer.path, message: "explicit S3 comparison contradicts a known alias" });
58074
+ }
58075
+ if (same)
58076
+ return "same";
58077
+ if (explicit)
58078
+ return answer;
58079
+ return left && right ? "distinct" : "unknown";
58080
+ }
57938
58081
 
57939
58082
  // ../safe-fs/dist/fs/webdav/resource-id.js
57940
58083
  var responses = /* @__PURE__ */ new WeakMap();
@@ -57952,10 +58095,10 @@ function ownedResponseIdentifier(response, path) {
57952
58095
  return responses.get(response)?.get(path)?.identifier;
57953
58096
  }
57954
58097
  var queries = /* @__PURE__ */ new WeakMap();
57955
- var comparisons = /* @__PURE__ */ new WeakMap();
58098
+ var comparisons2 = /* @__PURE__ */ new WeakMap();
57956
58099
  var callbacks = /* @__PURE__ */ new WeakMap();
57957
58100
  function registerResourceQuery(filesystem, query, baseComparison, callback) {
57958
- comparisons.set(filesystem, baseComparison);
58101
+ comparisons2.set(filesystem, baseComparison);
57959
58102
  if (callback)
57960
58103
  callbacks.set(filesystem, callback);
57961
58104
  queries.set(filesystem, async (path, options) => {
@@ -57983,7 +58126,7 @@ var compareWebDavResources = async (own, peer, options) => {
57983
58126
  let answer = "unknown";
57984
58127
  const visited = /* @__PURE__ */ new Set();
57985
58128
  for (const [left, right] of [[own, peer], [peer, own]]) {
57986
- const baseComparison = comparisons.get(left.filesystem);
58129
+ const baseComparison = comparisons2.get(left.filesystem);
57987
58130
  if (!baseComparison)
57988
58131
  continue;
57989
58132
  const method = left.filesystem.compareEntry;
@@ -58224,11 +58367,14 @@ function components(path, signal) {
58224
58367
  }
58225
58368
  return result;
58226
58369
  }
58227
- function resolveMissingTarget(root, path, signal) {
58228
- const fail2 = (code, failedPath = path) => {
58370
+ function resolveMissingTarget(root, path, signal, limits = {}) {
58371
+ validatePath(path, limits);
58372
+ const fail3 = (code, failedPath = path) => {
58229
58373
  throw new FsError(code, { syscall: "realpath", path: failedPath });
58230
58374
  };
58231
58375
  const origin = components(path, signal);
58376
+ let remainingBytes = (limits.maxPathBytes ?? Infinity) - pathByteLength(path);
58377
+ let remainingComponents = (limits.maxPathComponents ?? Infinity) - origin.length;
58232
58378
  const initial = { node: root, name: "" };
58233
58379
  let position = initial;
58234
58380
  let links = 0;
@@ -58255,9 +58401,9 @@ function resolveMissingTarget(root, path, signal) {
58255
58401
  }
58256
58402
  const current = position.node;
58257
58403
  if (current.type !== "directory")
58258
- return fail2("ENOTDIR");
58404
+ return fail3("ENOTDIR");
58259
58405
  if ((current.mode >> 6 & 1) !== 1)
58260
- return fail2("EACCES");
58406
+ return fail3("EACCES");
58261
58407
  const name = component.name;
58262
58408
  if (name === ".") {
58263
58409
  first = false;
@@ -58269,7 +58415,7 @@ function resolveMissingTarget(root, path, signal) {
58269
58415
  continue;
58270
58416
  }
58271
58417
  if (exceedsComponentByteLimit(name))
58272
- return fail2("ENAMETOOLONG");
58418
+ return fail3("ENAMETOOLONG");
58273
58419
  const node = current.entries.get(name);
58274
58420
  if (!node) {
58275
58421
  found = false;
@@ -58280,8 +58426,11 @@ function resolveMissingTarget(root, path, signal) {
58280
58426
  first = false;
58281
58427
  if (node.type === "symlink") {
58282
58428
  if (++links > 40)
58283
- return fail2("ELOOP");
58429
+ return fail3("ELOOP");
58430
+ validatePath(node.target, { maxPathBytes: remainingBytes, maxPathComponents: remainingComponents });
58284
58431
  const names2 = components(node.target, signal);
58432
+ remainingBytes -= pathByteLength(node.target);
58433
+ remainingComponents -= names2.length;
58285
58434
  if (node.target.endsWith("/"))
58286
58435
  names2.push({ name: ".", start: node.target.length });
58287
58436
  if (node.target.startsWith("/"))
@@ -58302,7 +58451,7 @@ function resolveMissingTarget(root, path, signal) {
58302
58451
  for (let count = origin.length; count > missing; count--) {
58303
58452
  signal?.throwIfAborted();
58304
58453
  if (count === missing + 1 && path[end - 1] !== "/")
58305
- return fail2("ENOENT", path.slice(0, end));
58454
+ return fail3("ENOENT", path.slice(0, end));
58306
58455
  const last = origin[count - 1];
58307
58456
  if (!last)
58308
58457
  break;
@@ -58485,26 +58634,22 @@ function readConfigRecord(value, label, keys) {
58485
58634
 
58486
58635
  // ../safe-fs/dist/fs/memory/limits.js
58487
58636
  var defaultMemoryFileSystemLimits = Object.freeze({
58637
+ maxPathBytes: Infinity,
58638
+ maxPathComponents: Infinity,
58488
58639
  maxFileBytes: Infinity,
58489
58640
  maxRetainedBytes: Infinity,
58490
58641
  maxMetadataUnits: Infinity
58491
58642
  });
58492
58643
  function normalizeMemoryFileSystemLimits(options) {
58493
- const keys = ["maxFileBytes", "maxRetainedBytes", "maxMetadataUnits"];
58644
+ const keys = ["maxPathBytes", "maxPathComponents", "maxFileBytes", "maxRetainedBytes", "maxMetadataUnits"];
58494
58645
  const record2 = readConfigRecord(options, "memory option", [...keys, "maxBytes"]);
58495
58646
  const limits = { ...defaultMemoryFileSystemLimits };
58496
- if (Object.hasOwn(record2, "maxBytes") && record2.maxBytes !== void 0) {
58497
- if (typeof record2.maxBytes !== "number" || !Number.isSafeInteger(record2.maxBytes) || record2.maxBytes < 0) {
58498
- throw new RangeError("maxBytes must be a nonnegative safe integer");
58499
- }
58500
- limits.maxBytes = record2.maxBytes;
58501
- }
58502
- for (const key of keys) {
58503
- if (!Object.hasOwn(record2, key))
58504
- continue;
58647
+ for (const key of [...keys, "maxBytes"]) {
58505
58648
  const value = record2[key];
58649
+ if (value === void 0 || value === Infinity)
58650
+ continue;
58506
58651
  if (typeof value !== "number" || !Number.isSafeInteger(value) || value < (key === "maxMetadataUnits" ? 1 : 0)) {
58507
- throw new RangeError(`${key} must be a ${key === "maxMetadataUnits" ? "positive" : "nonnegative"} safe integer`);
58652
+ throw new RangeError(`${key} must be a ${key === "maxMetadataUnits" ? "positive" : "nonnegative"} safe integer or Infinity`);
58508
58653
  }
58509
58654
  limits[key] = value;
58510
58655
  }
@@ -58553,12 +58698,10 @@ var DUMMY_POOL_FILE_NODE = new MemoryFileNode(0, 0, null, 0, DUMMY_POOL_ALLOCATI
58553
58698
  DUMMY_POOL_FILE_NODE.atimeMs = DUMMY_POOL_FILE_NODE.mtimeMs = DUMMY_POOL_FILE_NODE.ctimeMs = DUMMY_POOL_FILE_NODE.birthtimeMs = 17e11;
58554
58699
  var defaultDateNow = Date.now;
58555
58700
  var fastWriteCachedNow = Date.now();
58556
- var lastFastMapMiss = {
58557
- map: void 0,
58558
- key: "",
58559
- slot: -1
58560
- };
58561
58701
  var FastDirectoryEntriesMap = class {
58702
+ // Keep speculative slots local so a failed write cannot pin a tenant globally.
58703
+ _missKey = "";
58704
+ _missSlot = -1;
58562
58705
  _table = new Int16Array(128).fill(-1);
58563
58706
  _mask = 127;
58564
58707
  _keys = new Array(64).fill("");
@@ -58595,9 +58738,8 @@ var FastDirectoryEntriesMap = class {
58595
58738
  getForWriteWithHash(k, h) {
58596
58739
  let slot = h & this._mask;
58597
58740
  if (this.size === 0) {
58598
- lastFastMapMiss.map = this;
58599
- lastFastMapMiss.key = k;
58600
- lastFastMapMiss.slot = slot;
58741
+ this._missKey = k;
58742
+ this._missSlot = slot;
58601
58743
  return void 0;
58602
58744
  }
58603
58745
  const mask = this._mask;
@@ -58607,9 +58749,8 @@ var FastDirectoryEntriesMap = class {
58607
58749
  while (true) {
58608
58750
  const idx = table[slot];
58609
58751
  if (idx === -1) {
58610
- lastFastMapMiss.map = this;
58611
- lastFastMapMiss.key = k;
58612
- lastFastMapMiss.slot = firstDeleted !== -1 ? firstDeleted : slot;
58752
+ this._missKey = k;
58753
+ this._missSlot = firstDeleted !== -1 ? firstDeleted : slot;
58613
58754
  return void 0;
58614
58755
  }
58615
58756
  if (idx === -2) {
@@ -58658,6 +58799,7 @@ var FastDirectoryEntriesMap = class {
58658
58799
  return this.get(k) !== void 0;
58659
58800
  }
58660
58801
  _rebuild(newCap) {
58802
+ this._missKey = "";
58661
58803
  const newTableLen = newCap * 2;
58662
58804
  const newMask = newTableLen - 1;
58663
58805
  const newTable = newCap <= 16384 ? new Int16Array(newTableLen).fill(-1) : new Int32Array(newTableLen).fill(-1);
@@ -58697,15 +58839,16 @@ var FastDirectoryEntriesMap = class {
58697
58839
  this._next = writeIdx;
58698
58840
  }
58699
58841
  set(k, v) {
58700
- if (this === lastFastMapMiss.map && k === lastFastMapMiss.key && this._next < this._keys.length) {
58842
+ if (k === this._missKey && this._next < this._keys.length) {
58701
58843
  const entryIdx = this._next++;
58702
- this._table[lastFastMapMiss.slot] = entryIdx;
58844
+ this._table[this._missSlot] = entryIdx;
58703
58845
  this._keys[entryIdx] = k;
58704
58846
  this._vals[entryIdx] = v;
58705
58847
  this.size++;
58706
- lastFastMapMiss.map = void 0;
58848
+ this._missKey = "";
58707
58849
  return this;
58708
58850
  }
58851
+ this._missKey = "";
58709
58852
  if (this._next >= this._keys.length) {
58710
58853
  this._rebuild(this.size * 2 <= this._keys.length ? this._keys.length : this._keys.length * 2);
58711
58854
  }
@@ -58736,6 +58879,7 @@ var FastDirectoryEntriesMap = class {
58736
58879
  }
58737
58880
  }
58738
58881
  delete(k) {
58882
+ this._missKey = "";
58739
58883
  if (this.size === 0)
58740
58884
  return false;
58741
58885
  let slot = this._hash(k);
@@ -58761,6 +58905,7 @@ var FastDirectoryEntriesMap = class {
58761
58905
  }
58762
58906
  }
58763
58907
  clear() {
58908
+ this._missKey = "";
58764
58909
  if (this._next > 0) {
58765
58910
  this._table.fill(-1);
58766
58911
  for (let i = 0; i < this._next; i++) {
@@ -59213,7 +59358,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
59213
59358
  const owner = ownedStores.get(this);
59214
59359
  if (path !== "")
59215
59360
  this.validatePath(path, "realpath");
59216
- return resolveMissingTarget(owner.root, path || ".", options.signal);
59361
+ return resolveMissingTarget(owner.root, path || ".", options.signal, this.ledger.limits);
59217
59362
  }
59218
59363
  async confineExtraction(roots, options = {}) {
59219
59364
  options.signal?.throwIfAborted();
@@ -59466,6 +59611,8 @@ var MemoryFileSystem = class _MemoryFileSystem {
59466
59611
  this.fail("EINVAL", syscall, path);
59467
59612
  if (path.length === 0)
59468
59613
  this.fail("ENOENT", syscall, path);
59614
+ if (this.ledger.limits.maxPathBytes !== Infinity || this.ledger.limits.maxPathComponents !== Infinity)
59615
+ validatePath(path, this.ledger.limits);
59469
59616
  }
59470
59617
  permission(node, mask, syscall, path) {
59471
59618
  if ((node.mode >> 6 & mask) !== mask)
@@ -59487,6 +59634,8 @@ var MemoryFileSystem = class _MemoryFileSystem {
59487
59634
  node.mtimeMs = node.ctimeMs = now;
59488
59635
  }
59489
59636
  resolveNode(path, syscall, followFinal = true) {
59637
+ if (this.ledger.limits.maxPathBytes !== Infinity || this.ledger.limits.maxPathComponents !== Infinity)
59638
+ validatePath(path, this.ledger.limits);
59490
59639
  const cache = memoryCaches.get(this.ledger);
59491
59640
  if (this.symlinkCount === 0 && isCleanAbsolutePath(path)) {
59492
59641
  const fastDir = cache.lastFastDirNode;
@@ -59571,7 +59720,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
59571
59720
  start = slash + 1;
59572
59721
  }
59573
59722
  }
59574
- let remainingPathUnits = 65536 - path.length;
59723
+ let remainingPathUnits = this.ledger.limits.maxPathBytes - pathByteLength(path);
59575
59724
  if (remainingPathUnits < 0)
59576
59725
  this.fail("ENAMETOOLONG", syscall, path);
59577
59726
  let initialComponents = 0;
@@ -59581,12 +59730,12 @@ var MemoryFileSystem = class _MemoryFileSystem {
59581
59730
  inComp = false;
59582
59731
  else if (!inComp) {
59583
59732
  inComp = true;
59584
- if (++initialComponents > 256)
59733
+ if (++initialComponents > this.ledger.limits.maxPathComponents)
59585
59734
  this.fail("ENAMETOOLONG", syscall, path);
59586
59735
  }
59587
59736
  }
59588
- const pending = path.split("/").filter(Boolean);
59589
- let remainingComponents = 256 - pending.length;
59737
+ let pending = path.split("/").filter(Boolean);
59738
+ let remainingComponents = this.ledger.limits.maxPathComponents - pending.length;
59590
59739
  if (path.endsWith("/"))
59591
59740
  pending.push("");
59592
59741
  const stack = [{ node: this.root, name: "" }];
@@ -59636,9 +59785,9 @@ var MemoryFileSystem = class _MemoryFileSystem {
59636
59785
  if (node.type === "symlink" && (options.followFinal !== false || pending.length > 0)) {
59637
59786
  if (++links > 40)
59638
59787
  this.fail("ELOOP", syscall, path);
59639
- if (node.target.length > remainingPathUnits)
59788
+ if (pathByteLength(node.target) > remainingPathUnits)
59640
59789
  this.fail("ENAMETOOLONG", syscall, path);
59641
- remainingPathUnits -= node.target.length;
59790
+ remainingPathUnits -= pathByteLength(node.target);
59642
59791
  const target = node.target.split("/").filter(Boolean);
59643
59792
  if (target.length > remainingComponents)
59644
59793
  this.fail("ENAMETOOLONG", syscall, path);
@@ -59647,7 +59796,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
59647
59796
  target.push("");
59648
59797
  if (options.resizeCreate !== void 0 && target.at(-1) === "" && pending[0] === "")
59649
59798
  target.pop();
59650
- pending.unshift(...target);
59799
+ pending = target.concat(pending);
59651
59800
  if (node.target.startsWith("/"))
59652
59801
  stack.splice(1);
59653
59802
  continue;
@@ -59663,6 +59812,8 @@ var MemoryFileSystem = class _MemoryFileSystem {
59663
59812
  };
59664
59813
  }
59665
59814
  file(path, syscall) {
59815
+ if (this.ledger.limits.maxPathBytes !== Infinity || this.ledger.limits.maxPathComponents !== Infinity)
59816
+ validatePath(path, this.ledger.limits);
59666
59817
  if (this.symlinkCount === 0 && path.charCodeAt(0) === 47 && path.length > 1 && path.indexOf("/", 1) === -1 && !path.includes("\0")) {
59667
59818
  const name = path === _lastFileSlice1Path ? _lastFileSlice1Name : (_lastFileSlice1Path = path, _lastFileSlice1Name = path.slice(1));
59668
59819
  if (name !== "." && name !== "..") {
@@ -59937,6 +60088,8 @@ var MemoryFileSystem = class _MemoryFileSystem {
59937
60088
  }, syscall, path);
59938
60089
  }
59939
60090
  writeData(path, data, options, syscall) {
60091
+ if (this.ledger.limits.maxPathBytes !== Infinity || this.ledger.limits.maxPathComponents !== Infinity)
60092
+ validatePath(path, this.ledger.limits);
59940
60093
  if (!(data instanceof Uint8Array))
59941
60094
  throw new TypeError("Memory files require Uint8Array data");
59942
60095
  const target = this.prepareWrite(path, options, syscall);
@@ -60053,9 +60206,11 @@ var MemoryFileSystem = class _MemoryFileSystem {
60053
60206
  this.changed(node, now);
60054
60207
  }
60055
60208
  writeMemoryFileFast(path, data, append, mode) {
60209
+ if (this.ledger.limits.maxPathBytes !== Infinity || this.ledger.limits.maxPathComponents !== Infinity)
60210
+ validatePath(path, this.ledger.limits);
60056
60211
  const cache = memoryCaches.get(this.ledger);
60057
60212
  const syscall = append ? "appendFile" : "writeFile";
60058
- if (append && path === cache.lastFastFilePath && cache.lastFastFileNode !== void 0 && cache.lastFastFileNode.nlink !== 0 && cache.lastFastDirNode !== void 0 && cache.lastFastDirNode.nlink !== 0 && (cache.lastFastDirNode.mode & 1) !== 0 && (cache.lastFastFileNode.mode & 2) !== 0) {
60213
+ if (append && path === cache.lastFastFilePath && cache.lastFastFileNode !== void 0 && cache.lastFastFileNode.nlink !== 0 && cache.lastFastDirNode !== void 0 && cache.lastFastDirNode.nlink !== 0 && (cache.lastFastDirNode.mode & 64) !== 0 && (cache.lastFastFileNode.mode & 128) !== 0) {
60059
60214
  const current2 = cache.lastFastFileNode;
60060
60215
  const length2 = current2.byteLength + data.byteLength;
60061
60216
  this.admitSize(current2, length2, syscall, path);
@@ -60069,7 +60224,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
60069
60224
  let name = "";
60070
60225
  const cachedPrefix = cache.lastFastDirPrefix;
60071
60226
  const cachedDir = cache.lastFastDirNode;
60072
- if (cachedDir !== void 0 && cachedDir.nlink !== 0 && (cachedDir.mode & 1) !== 0 && cachedPrefix.length > 1 && path.startsWith(cachedPrefix) && path.indexOf("/", cachedPrefix.length) === -1) {
60227
+ if (cachedDir !== void 0 && cachedDir.nlink !== 0 && (cachedDir.mode & 64) !== 0 && cachedPrefix.length > 1 && path.startsWith(cachedPrefix) && path.indexOf("/", cachedPrefix.length) === -1) {
60073
60228
  parent = cachedDir;
60074
60229
  name = path.slice(cachedPrefix.length);
60075
60230
  if (exceedsComponentByteLimit2(name))
@@ -60082,7 +60237,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
60082
60237
  name = path.slice(start);
60083
60238
  if (exceedsComponentByteLimit2(name))
60084
60239
  this.fail("ENAMETOOLONG", syscall, path);
60085
- if (start > 1 && (parent.mode & 1) !== 0) {
60240
+ if (start > 1 && (parent.mode & 64) !== 0) {
60086
60241
  cache.lastFastDirPrefix = path.slice(0, start);
60087
60242
  cache.lastFastDirNode = parent;
60088
60243
  }
@@ -60202,6 +60357,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
60202
60357
  let ino = this.nextInode;
60203
60358
  this.nextInode = ino + batchCount;
60204
60359
  let nextIdx = 1;
60360
+ entries2._missKey = "";
60205
60361
  entries2._next = 1 + batchCount;
60206
60362
  entries2.size = 1 + batchCount;
60207
60363
  const table = entries2._table;
@@ -60251,6 +60407,8 @@ var MemoryFileSystem = class _MemoryFileSystem {
60251
60407
  }
60252
60408
  }
60253
60409
  writeMemoryFileInDirFast(dirPrefix, name, data, append, mode, nameHash) {
60410
+ if (this.ledger.limits.maxPathBytes !== Infinity || this.ledger.limits.maxPathComponents !== Infinity)
60411
+ validatePath(dirPrefix + name, this.ledger.limits);
60254
60412
  const cache = this._cache;
60255
60413
  if (!append && dirPrefix === cache.lastFastDirPrefix && cache.lastFastDirNode !== void 0 && cache.lastFastDirNode.nlink !== 0 && (cache.lastFastDirNode.mode & 192) === 192 && name.length <= 85 && this.ledger.hasInfiniteRetained && this.ledger.hasInfiniteFileBytes && this.ledger.limits.maxBytes === void 0 && sharedFileNodePoolLen > 0) {
60256
60414
  const parent = cache.lastFastDirNode;
@@ -60278,12 +60436,11 @@ var MemoryFileSystem = class _MemoryFileSystem {
60278
60436
  node.allocation = DUMMY_POOL_ALLOCATION;
60279
60437
  node.sourceRef = node.data.subarray(0);
60280
60438
  const entryIdx = entries2._next++;
60281
- entries2._table[lastFastMapMiss.slot] = entryIdx;
60439
+ entries2._table[entries2._missSlot] = entryIdx;
60282
60440
  entries2._keys[entryIdx] = name;
60283
60441
  entries2._vals[entryIdx] = node;
60284
60442
  entries2.size++;
60285
- lastFastMapMiss.map = void 0;
60286
- lastFastMapMiss.key = "";
60443
+ entries2._missKey = "";
60287
60444
  this.ledger.reserve(name.length * 2, 2, "writeFile", name);
60288
60445
  this.totalBytes += length;
60289
60446
  this.mutationTick = this.mutationTick + 1 | 0;
@@ -60297,7 +60454,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
60297
60454
  }
60298
60455
  const syscall = append ? "appendFile" : "writeFile";
60299
60456
  try {
60300
- if (append && dirPrefix === cache.lastFastDirPrefix && name === cache.lastFastFileName && cache.lastFastFileNode !== void 0 && cache.lastFastFileNode.nlink !== 0 && cache.lastFastDirNode !== void 0 && cache.lastFastDirNode.nlink !== 0 && (cache.lastFastDirNode.mode & 1) !== 0 && (cache.lastFastFileNode.mode & 2) !== 0) {
60457
+ if (append && dirPrefix === cache.lastFastDirPrefix && name === cache.lastFastFileName && cache.lastFastFileNode !== void 0 && cache.lastFastFileNode.nlink !== 0 && cache.lastFastDirNode !== void 0 && cache.lastFastDirNode.nlink !== 0 && (cache.lastFastDirNode.mode & 64) !== 0 && (cache.lastFastFileNode.mode & 128) !== 0) {
60301
60458
  const current2 = cache.lastFastFileNode;
60302
60459
  const length2 = current2.byteLength + data.byteLength;
60303
60460
  this.admitSize(current2, length2, syscall, name);
@@ -60308,7 +60465,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
60308
60465
  }
60309
60466
  let parent = this.root;
60310
60467
  const cachedDir = cache.lastFastDirNode;
60311
- if (cachedDir !== void 0 && cachedDir.nlink !== 0 && (cachedDir.mode & 1) !== 0 && dirPrefix === cache.lastFastDirPrefix) {
60468
+ if (cachedDir !== void 0 && cachedDir.nlink !== 0 && (cachedDir.mode & 64) !== 0 && dirPrefix === cache.lastFastDirPrefix) {
60312
60469
  parent = cachedDir;
60313
60470
  if (exceedsComponentByteLimit2(name))
60314
60471
  this.fail("ENAMETOOLONG", syscall, name);
@@ -60333,7 +60490,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
60333
60490
  this.permission(parent, 1, syscall, name);
60334
60491
  if (exceedsComponentByteLimit2(name))
60335
60492
  this.fail("ENAMETOOLONG", syscall, name);
60336
- if (dirPrefix.length > 1 && (parent.mode & 1) !== 0) {
60493
+ if (dirPrefix.length > 1 && (parent.mode & 64) !== 0) {
60337
60494
  cache.lastFastDirPrefix = dirPrefix;
60338
60495
  cache.lastFastDirNode = parent;
60339
60496
  }
@@ -60409,11 +60566,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
60409
60566
  cache.lastFastFilePath = "";
60410
60567
  cache.lastFastFileName = name;
60411
60568
  cache.lastFastFileNode = node;
60412
- lastFastMapMiss.map = void 0;
60413
- lastFastMapMiss.key = "";
60414
60569
  } catch (error) {
60415
- lastFastMapMiss.map = void 0;
60416
- lastFastMapMiss.key = "";
60417
60570
  this.ledger.release(nameBytes, 2);
60418
60571
  throw error;
60419
60572
  }
@@ -62221,7 +62374,7 @@ function qualifiedNameSync(name, cache) {
62221
62374
  }
62222
62375
  return parts;
62223
62376
  }
62224
- function* entities(text) {
62377
+ function* entities(text, recover) {
62225
62378
  let result = "";
62226
62379
  let offset = 0;
62227
62380
  while (offset < text.length) {
@@ -62230,8 +62383,12 @@ function* entities(text) {
62230
62383
  return result + text.slice(offset);
62231
62384
  result += text.slice(offset, start);
62232
62385
  const end = yield* find(text, ";", start + 1);
62233
- if (end < 0)
62234
- invalid("unterminated entity");
62386
+ if (end < 0) {
62387
+ if (!recover)
62388
+ invalid("unterminated entity");
62389
+ recover("unterminated entity");
62390
+ return result + text.slice(start + 1);
62391
+ }
62235
62392
  const entity = text.slice(start + 1, end);
62236
62393
  const predefined = { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'" };
62237
62394
  if (Object.hasOwn(predefined, entity))
@@ -62239,8 +62396,13 @@ function* entities(text) {
62239
62396
  else {
62240
62397
  const hexadecimal = entity.startsWith("#x");
62241
62398
  const digits = entity.slice(hexadecimal ? 2 : 1);
62242
- if (!entity.startsWith("#") || !digits.length)
62243
- invalid("undeclared entity");
62399
+ if (!entity.startsWith("#") || !digits.length) {
62400
+ if (!recover)
62401
+ invalid("undeclared entity");
62402
+ recover("undeclared entity");
62403
+ offset = end + 1;
62404
+ continue;
62405
+ }
62244
62406
  let point = 0;
62245
62407
  for (let index = 0; index < digits.length; index++) {
62246
62408
  const code = digits.charCodeAt(index);
@@ -62398,27 +62560,42 @@ function* parseXmlSteps(input, limits = {}) {
62398
62560
  throw new XmlLimitError("maxContentNodes", "XML content node limit exceeded");
62399
62561
  };
62400
62562
  let pendingWork = 0;
62401
- const skipWhitespace = () => {
62563
+ const skipWhitespace = function* () {
62402
62564
  const start2 = offset;
62403
62565
  while (offset < source.length) {
62404
62566
  const c = source.charCodeAt(offset);
62405
62567
  if (c !== 32 && c !== 9 && c !== 10 && c !== 13)
62406
62568
  break;
62407
62569
  offset++;
62570
+ pendingWork++;
62571
+ if (pendingWork >= 512) {
62572
+ yield 512;
62573
+ pendingWork -= 512;
62574
+ }
62408
62575
  }
62409
62576
  return offset - start2;
62410
62577
  };
62411
- const scanName = () => {
62578
+ const scanName = function* () {
62412
62579
  const start2 = offset;
62413
62580
  while (offset < source.length) {
62414
62581
  const c = source.charCodeAt(offset);
62415
62582
  if (c === 32 || c === 9 || c === 13 || c === 10 || c === 47 || c === 61 || c === 62 || c === 63)
62416
62583
  break;
62417
62584
  offset++;
62585
+ pendingWork++;
62586
+ if (pendingWork >= 512) {
62587
+ yield 512;
62588
+ pendingWork -= 512;
62589
+ }
62418
62590
  }
62419
62591
  const name = source.slice(start2, offset);
62592
+ pendingWork += offset - start2;
62593
+ while (pendingWork >= 512) {
62594
+ yield 512;
62595
+ pendingWork -= 512;
62596
+ }
62420
62597
  const [prefix, localName] = qualifiedNameSync(name, qualifiedNames);
62421
- return [name, prefix, localName, (offset - start2) * 2];
62598
+ return [name, prefix, localName];
62422
62599
  };
62423
62600
  while (offset < source.length) {
62424
62601
  pendingWork += 1;
@@ -62439,7 +62616,7 @@ function* parseXmlSteps(input, limits = {}) {
62439
62616
  }
62440
62617
  if (text.indexOf("]]>") >= 0)
62441
62618
  invalid("CDATA terminator in text");
62442
- const resolved = stack.length ? text.indexOf("&") < 0 ? (pendingWork += text.length, text) : yield* entities(text) : text;
62619
+ const resolved = stack.length ? text.indexOf("&") < 0 ? (pendingWork += text.length, text) : yield* entities(text, limits.recover) : text;
62443
62620
  while (pendingWork >= 512) {
62444
62621
  yield 512;
62445
62622
  pendingWork -= 512;
@@ -62455,11 +62632,15 @@ function* parseXmlSteps(input, limits = {}) {
62455
62632
  }
62456
62633
  } else {
62457
62634
  for (let index = 0; index < resolved.length; index++) {
62635
+ pendingWork++;
62636
+ if (pendingWork >= 512) {
62637
+ yield 512;
62638
+ pendingWork -= 512;
62639
+ }
62458
62640
  const c = resolved.charCodeAt(index);
62459
62641
  if (c !== 32 && c !== 9 && c !== 13 && c !== 10)
62460
62642
  invalid("text outside the root");
62461
62643
  }
62462
- pendingWork += resolved.length;
62463
62644
  while (pendingWork >= 512) {
62464
62645
  yield 512;
62465
62646
  pendingWork -= 512;
@@ -62501,8 +62682,7 @@ function* parseXmlSteps(input, limits = {}) {
62501
62682
  } else if (source.startsWith("<?", offset)) {
62502
62683
  const start2 = offset;
62503
62684
  offset += 2;
62504
- const [target, , , wName] = scanName();
62505
- pendingWork += wName;
62685
+ const [target] = yield* scanName();
62506
62686
  while (pendingWork >= 512) {
62507
62687
  yield 512;
62508
62688
  pendingWork -= 512;
@@ -62541,21 +62721,25 @@ function* parseXmlSteps(input, limits = {}) {
62541
62721
  invalid("DTD and entity declarations are forbidden");
62542
62722
  } else if (source.charCodeAt(offset + 1) === 47) {
62543
62723
  offset += 2;
62544
- const [name, , , wName] = scanName();
62545
- pendingWork += wName + skipWhitespace();
62724
+ const [name] = yield* scanName();
62725
+ yield* skipWhitespace();
62546
62726
  while (pendingWork >= 512) {
62547
62727
  yield 512;
62548
62728
  pendingWork -= 512;
62549
62729
  }
62550
- if (source[offset++] !== ">" || stack.pop()?.name !== name)
62551
- invalid("mismatched closing tag");
62730
+ if (source[offset++] !== ">" || stack.pop()?.name !== name) {
62731
+ if (!limits.recover)
62732
+ invalid("mismatched closing tag");
62733
+ limits.recover("mismatched closing tag");
62734
+ }
62552
62735
  } else {
62553
62736
  offset++;
62554
62737
  const repeated = previousEmpty && source.startsWith(previousEmpty.suffix, offset) ? previousEmpty : void 0;
62555
- const [name, prefix, localName, wName] = repeated ? [repeated.name, repeated.prefix, repeated.localName, repeated.name.length * 2] : scanName();
62738
+ const [name, prefix, localName] = repeated ? [repeated.name, repeated.prefix, repeated.localName] : yield* scanName();
62556
62739
  if (repeated)
62557
62740
  offset += name.length;
62558
- pendingWork += wName;
62741
+ if (repeated)
62742
+ pendingWork += name.length * 2;
62559
62743
  while (pendingWork >= 512) {
62560
62744
  yield 512;
62561
62745
  pendingWork -= 512;
@@ -62565,19 +62749,17 @@ function* parseXmlSteps(input, limits = {}) {
62565
62749
  let namespaces = stack.at(-1)?.namespaces ?? /* @__PURE__ */ new Map([["xml", xmlNamespace]]);
62566
62750
  let ownsNamespaces = stack.length === 0;
62567
62751
  while (!repeated) {
62568
- const ws = skipWhitespace();
62569
- pendingWork += ws;
62752
+ const ws = yield* skipWhitespace();
62570
62753
  while (pendingWork >= 512) {
62571
62754
  yield 512;
62572
62755
  pendingWork -= 512;
62573
62756
  }
62574
62757
  const ch3 = source.charCodeAt(offset);
62575
- if (ch3 === 47 || ch3 === 62)
62758
+ if (ch3 === 47 || ch3 === 62 || limits.recover && offset === source.length)
62576
62759
  break;
62577
62760
  if (ws === 0)
62578
62761
  invalid("attributes require whitespace");
62579
- const [attribute, attrPrefix, attrLocal, wAttr] = scanName();
62580
- pendingWork += wAttr;
62762
+ const [attribute, attrPrefix, attrLocal] = yield* scanName();
62581
62763
  while (pendingWork >= 512) {
62582
62764
  yield 512;
62583
62765
  pendingWork -= 512;
@@ -62588,10 +62770,10 @@ function* parseXmlSteps(input, limits = {}) {
62588
62770
  throw new XmlLimitError("maxAttributes", "XML attribute limit exceeded");
62589
62771
  if ((attributes?.size ?? 0) >= maxAttributesPerElement)
62590
62772
  throw new XmlLimitError("maxAttributesPerElement", "XML attribute limit exceeded");
62591
- pendingWork += skipWhitespace();
62773
+ yield* skipWhitespace();
62592
62774
  if (source[offset++] !== "=")
62593
62775
  invalid("missing attribute equals");
62594
- pendingWork += skipWhitespace();
62776
+ yield* skipWhitespace();
62595
62777
  const quote = source[offset++];
62596
62778
  if (quote !== '"' && quote !== "'")
62597
62779
  invalid("unquoted attribute");
@@ -62613,7 +62795,7 @@ function* parseXmlSteps(input, limits = {}) {
62613
62795
  if (raw.indexOf("<") >= 0)
62614
62796
  invalid("less-than in attribute");
62615
62797
  const normalized = /[\t\n\r]/.test(raw) ? raw.replace(/[\t\n\r]/g, " ") : raw;
62616
- const value = normalized.indexOf("&") < 0 ? (pendingWork += normalized.length, normalized) : yield* entities(normalized);
62798
+ const value = normalized.indexOf("&") < 0 ? (pendingWork += normalized.length, normalized) : yield* entities(normalized, limits.recover);
62617
62799
  while (pendingWork >= 512) {
62618
62800
  yield 512;
62619
62801
  pendingWork -= 512;
@@ -62703,8 +62885,11 @@ function* parseXmlSteps(input, limits = {}) {
62703
62885
  const empty = source[offset] === "/";
62704
62886
  if (empty)
62705
62887
  offset++;
62706
- if (source[offset++] !== ">")
62707
- invalid("unterminated start tag");
62888
+ if (source[offset++] !== ">") {
62889
+ if (!limits.recover)
62890
+ invalid("unterminated start tag");
62891
+ limits.recover("unterminated start tag");
62892
+ }
62708
62893
  if (empty && !attributes && name.length <= 512 && source.slice(offset - name.length - 3, offset) === `<${name}/>`)
62709
62894
  previousEmpty = { suffix: name + "/>", name, prefix, localName };
62710
62895
  if (!empty)
@@ -62715,8 +62900,13 @@ function* parseXmlSteps(input, limits = {}) {
62715
62900
  yield pendingWork;
62716
62901
  pendingWork = 0;
62717
62902
  }
62718
- if (stack.length || !root)
62903
+ if (!root)
62719
62904
  invalid("incomplete document");
62905
+ if (stack.length) {
62906
+ if (!limits.recover)
62907
+ invalid("incomplete document");
62908
+ limits.recover("incomplete document");
62909
+ }
62720
62910
  return root;
62721
62911
  }
62722
62912
 
@@ -62770,14 +62960,13 @@ function scalar(element) {
62770
62960
 
62771
62961
  // ../safe-fs/dist/fs/webdav/webdav.js
62772
62962
  var timestampNamespace = "urn:virtual-bash:metadata";
62773
- var maxTimestampPropertyBytes = 4096;
62774
- function preflightTimestamps(property) {
62963
+ function preflightTimestamps(property, maxTimestampPropertyBytes) {
62775
62964
  let bytes = 0;
62776
62965
  for (const point of property.text) {
62777
62966
  const code = point.codePointAt(0);
62778
62967
  bytes += code <= 127 ? 1 : code <= 2047 ? 2 : code <= 65535 ? 3 : 4;
62779
62968
  if (bytes > maxTimestampPropertyBytes)
62780
- throw new Error("timestamp property exceeds 4KiB limit");
62969
+ throw new Error("timestamp property exceeds byte limit");
62781
62970
  }
62782
62971
  const text = scalar(property);
62783
62972
  let offset = 0;
@@ -63018,6 +63207,7 @@ var WebDavFileSystem = class {
63018
63207
  headers;
63019
63208
  maxResponseBytes;
63020
63209
  maxXmlBytes;
63210
+ maxTimestampPropertyBytes;
63021
63211
  maxEntries;
63022
63212
  xmlLimits;
63023
63213
  timeoutMs;
@@ -63087,6 +63277,7 @@ var WebDavFileSystem = class {
63087
63277
  streamingAppend: this.requestStreamSupport !== false
63088
63278
  });
63089
63279
  this.maxResponseBytes = options.maxResponseBytes === void 0 ? Infinity : positive(options.maxResponseBytes, "maxResponseBytes", false, true);
63280
+ this.maxTimestampPropertyBytes = positive(options.maxTimestampPropertyBytes ?? Infinity, "maxTimestampPropertyBytes", true, true);
63090
63281
  this.maxXmlBytes = options.maxXmlBytes === void 0 ? Infinity : positive(options.maxXmlBytes, "maxXmlBytes", false, true);
63091
63282
  this.xmlLimits = Object.freeze({ ...options.xmlLimits });
63092
63283
  for (const [name, value] of Object.entries(this.xmlLimits))
@@ -63522,7 +63713,7 @@ var WebDavFileSystem = class {
63522
63713
  let mtimeMs = date("getlastmodified") ?? 0;
63523
63714
  let atimeMs = 0;
63524
63715
  if (timestampProperty) {
63525
- const timestamps = JSON.parse(preflightTimestamps(timestampProperty));
63716
+ const timestamps = JSON.parse(preflightTimestamps(timestampProperty, this.maxTimestampPropertyBytes));
63526
63717
  if (typeof timestamps !== "object" || timestamps === null || !("version" in timestamps) || timestamps.version !== 1 || !("etag" in timestamps) || typeof timestamps.etag !== "string" || !/^"[\x21\x23-\x7e\x80-\xff]*"$/.test(timestamps.etag) || !("type" in timestamps) || timestamps.type !== "file" && timestamps.type !== "directory" || !("atimeMs" in timestamps) || typeof timestamps.atimeMs !== "number" || !Number.isFinite(timestamps.atimeMs) || Math.abs(timestamps.atimeMs) > 864e13 || !("mtimeMs" in timestamps) || typeof timestamps.mtimeMs !== "number" || !Number.isFinite(timestamps.mtimeMs) || Math.abs(timestamps.mtimeMs) > 864e13)
63527
63718
  throw new Error("invalid timestamp property");
63528
63719
  if (timestamps.etag === validator && timestamps.type === (directory ? "directory" : "file")) {
@@ -64201,6 +64392,1220 @@ var WebDavFileSystem = class {
64201
64392
  };
64202
64393
  var originalWebDavComparison = WebDavFileSystem.prototype.compareEntry;
64203
64394
 
64395
+ // ../safe-fs/dist/fs/s3/key-order.js
64396
+ function compareKeys(left, right) {
64397
+ const encoder = new TextEncoder();
64398
+ const a = encoder.encode(left), b = encoder.encode(right);
64399
+ for (let index = 0; index < Math.min(a.length, b.length); index++) {
64400
+ const difference = a[index] - b[index];
64401
+ if (difference)
64402
+ return difference;
64403
+ }
64404
+ return a.length - b.length;
64405
+ }
64406
+
64407
+ // ../safe-fs/dist/fs/s3/authority.js
64408
+ var queryKey = /* @__PURE__ */ Symbol("s3-head-query");
64409
+ var queries2 = /* @__PURE__ */ new WeakMap();
64410
+ var providerHeads = /* @__PURE__ */ new WeakMap();
64411
+ var acceptedHeads = /* @__PURE__ */ new WeakMap();
64412
+ async function queryS3Head(input, action) {
64413
+ const token = Object.freeze({});
64414
+ const query = Object.freeze({ ...input });
64415
+ const forwarded = { ...query, [queryKey]: token };
64416
+ queries2.set(token, query);
64417
+ try {
64418
+ const output = await action(forwarded);
64419
+ acceptedHeads.delete(output);
64420
+ const proof = providerHeads.get(output);
64421
+ if (proof?.query === query)
64422
+ acceptedHeads.set(output, proof.entry);
64423
+ return output;
64424
+ } finally {
64425
+ queries2.delete(token);
64426
+ }
64427
+ }
64428
+ function recordS3Stat(filesystem, path, stat, metadata) {
64429
+ if (!metadata)
64430
+ return;
64431
+ const entry = acceptedHeads.get(metadata);
64432
+ acceptedHeads.delete(metadata);
64433
+ if (entry)
64434
+ recordS3Observation(filesystem, path, stat, entry);
64435
+ }
64436
+
64437
+ // ../safe-fs/dist/fs/s3/transport.js
64438
+ function encodeCopySource(bucket, key) {
64439
+ return [bucket, ...key.split("/")].map((part) => encodeURIComponent(part).replace(/[!'()*]/g, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`)).join("/");
64440
+ }
64441
+
64442
+ // ../safe-fs/dist/fs/s3/filesystem.js
64443
+ var S3RenameError = class extends FsError {
64444
+ phase;
64445
+ copiedKeys;
64446
+ deletedKeys;
64447
+ constructor(source, destination, phase, copied, deleted, cause) {
64448
+ super(cause.code, {
64449
+ syscall: "rename",
64450
+ path: source,
64451
+ dest: destination,
64452
+ cause,
64453
+ message: `non-atomic S3 rename failed during ${phase}; destination copies or partial source deletions may remain`
64454
+ });
64455
+ this.name = "S3RenameError";
64456
+ this.phase = phase;
64457
+ this.copiedKeys = Object.freeze([...copied]);
64458
+ this.deletedKeys = Object.freeze([...deleted]);
64459
+ }
64460
+ };
64461
+ function serviceCode(error) {
64462
+ if (typeof error !== "object" || error === null)
64463
+ return void 0;
64464
+ const record2 = error;
64465
+ const value = record2.Code ?? record2.code ?? record2.name;
64466
+ return typeof value === "string" ? value : void 0;
64467
+ }
64468
+ function translate(error, syscall, path, precondition = "EAGAIN") {
64469
+ if (error instanceof FsError)
64470
+ return error;
64471
+ const status = error?.$metadata?.httpStatusCode;
64472
+ const name = serviceCode(error);
64473
+ let code = "EIO";
64474
+ if (name === "AbortError" || status === 499)
64475
+ code = "ECANCELED";
64476
+ else if (name === "NoSuchKey" || name === "NotFound" || name === "NoSuchBucket" || status === 404)
64477
+ code = "ENOENT";
64478
+ else if (["AccessDenied", "InvalidAccessKeyId", "SignatureDoesNotMatch", "ExpiredToken"].includes(name ?? "") || status === 401 || status === 403)
64479
+ code = "EACCES";
64480
+ else if (name === "PreconditionFailed" || status === 412)
64481
+ code = precondition;
64482
+ else if (name === "ConditionalRequestConflict" || name === "SlowDown" || status === 409 || status === 429 || status === 503)
64483
+ code = "EAGAIN";
64484
+ else if (name === "NotImplemented" || status === 501)
64485
+ code = "ENOTSUP";
64486
+ else if (name === "EntityTooLarge")
64487
+ code = "EFBIG";
64488
+ else if (name === "InvalidArgument" || name === "InvalidRequest" || status === 400)
64489
+ code = "EINVAL";
64490
+ else if (name === "TimeoutError" || name === "RequestTimeout" || status === 408)
64491
+ code = "ETIMEDOUT";
64492
+ return new FsError(code, { syscall, path, cause: error });
64493
+ }
64494
+ function fail2(code, syscall, path, message) {
64495
+ throw new FsError(code, { syscall, path, ...message === void 0 ? {} : { message } });
64496
+ }
64497
+ function validateLimit(value, name, minimum, maximum = Number.MAX_SAFE_INTEGER) {
64498
+ if ((value !== Infinity || maximum !== Infinity) && (!Number.isSafeInteger(value) || value < minimum || value > maximum)) {
64499
+ throw new FsError("EINVAL", { message: `${name} must be an integer from ${minimum} to ${maximum}` });
64500
+ }
64501
+ return value;
64502
+ }
64503
+ function utf8ByteLength3(value) {
64504
+ let bytes = 0;
64505
+ for (let i = 0; i < value.length; i++) {
64506
+ const code = value.charCodeAt(i);
64507
+ if (code < 128)
64508
+ bytes += 1;
64509
+ else if (code < 2048)
64510
+ bytes += 2;
64511
+ else if (code >= 55296 && code <= 56319 && i + 1 < value.length && value.charCodeAt(i + 1) >= 56320 && value.charCodeAt(i + 1) <= 57343) {
64512
+ bytes += 4;
64513
+ i++;
64514
+ } else
64515
+ bytes += 3;
64516
+ }
64517
+ return bytes;
64518
+ }
64519
+ function isWellFormed(value) {
64520
+ return !/[\uD800-\uDFFF]/u.test(value);
64521
+ }
64522
+ var S3FileSystem = class {
64523
+ async open(path, options) {
64524
+ options.signal?.throwIfAborted();
64525
+ throw new FsError("ENOTSUP", { syscall: "open", path });
64526
+ }
64527
+ capabilities;
64528
+ readStream;
64529
+ writeStream;
64530
+ transport;
64531
+ bucket;
64532
+ prefix;
64533
+ allowRename;
64534
+ pageSize;
64535
+ maxReadBytes;
64536
+ maxStreamBytes;
64537
+ maxListEntries;
64538
+ maxRequests;
64539
+ requests = 0;
64540
+ removalLimits;
64541
+ removalBudgets = /* @__PURE__ */ new WeakMap();
64542
+ constructor(options) {
64543
+ if (!options?.transport || ["headObject", "getObject", "putObject", "deleteObject", "copyObject", "listObjectsV2"].some((method) => typeof options.transport[method] !== "function")) {
64544
+ throw new FsError("EINVAL", { message: "an explicit six-operation S3 transport is required; no default credentials or network client are created" });
64545
+ }
64546
+ if (options.compareEntry !== void 0 && typeof options.compareEntry !== "function") {
64547
+ throw new FsError("EINVAL", { message: "compareEntry must be a filesystem comparison callback" });
64548
+ }
64549
+ if (typeof options.bucket !== "string" || !options.bucket || /[/:\0]/.test(options.bucket)) {
64550
+ throw new FsError("EINVAL", { message: "bucket must be a nonempty bucket name, not a URL or ARN" });
64551
+ }
64552
+ const prefix = options.prefix ?? "";
64553
+ if (typeof prefix !== "string" || prefix.includes("\0") || !isWellFormed(prefix) || prefix !== "" && prefix.replace(/\/$/, "").split("/").some((part) => !part || part === "." || part === "..")) {
64554
+ throw new FsError("EINVAL", { message: "prefix must be a canonical relative object-key prefix" });
64555
+ }
64556
+ this.prefix = prefix === "" || prefix.endsWith("/") ? prefix : `${prefix}/`;
64557
+ if (utf8ByteLength3(this.prefix) > 1024)
64558
+ throw new FsError("ENAMETOOLONG", { message: "S3 prefix exceeds 1024 UTF-8 bytes" });
64559
+ this.transport = options.transport;
64560
+ this.bucket = options.bucket;
64561
+ this.allowRename = options.allowNonAtomicRename ?? true;
64562
+ this.pageSize = validateLimit(options.pageSize ?? 1e3, "pageSize", 1, 1e3);
64563
+ this.maxReadBytes = options.maxReadBytes === void 0 ? Infinity : validateLimit(options.maxReadBytes, "maxReadBytes", 0, Infinity);
64564
+ this.maxStreamBytes = options.maxStreamBytes === void 0 ? Infinity : validateLimit(options.maxStreamBytes, "maxStreamBytes", 0, Infinity);
64565
+ this.maxListEntries = options.maxListEntries === void 0 ? Infinity : validateLimit(options.maxListEntries, "maxListEntries", 1, Infinity);
64566
+ this.maxRequests = options.maxRequests === void 0 ? Infinity : validateLimit(options.maxRequests, "maxRequests", 1, Infinity);
64567
+ this.removalLimits = {
64568
+ maxRequests: validateLimit(options.removalLimits?.maxRequests ?? Infinity, "removalLimits.maxRequests", 1, Infinity),
64569
+ maxListEntries: validateLimit(options.removalLimits?.maxListEntries ?? Infinity, "removalLimits.maxListEntries", 1, Infinity),
64570
+ maxDeleteObjects: validateLimit(options.removalLimits?.maxDeleteObjects ?? Infinity, "removalLimits.maxDeleteObjects", 1, Infinity)
64571
+ };
64572
+ this.capabilities = Object.freeze({
64573
+ open: false,
64574
+ read: true,
64575
+ stat: true,
64576
+ readdir: true,
64577
+ realpath: true,
64578
+ access: true,
64579
+ write: true,
64580
+ explicitDirectories: true,
64581
+ implicitDirectories: true,
64582
+ mkdir: true,
64583
+ recursiveMkdir: true,
64584
+ remove: true,
64585
+ removeDirectory: true,
64586
+ recursiveRemove: true,
64587
+ copy: true,
64588
+ readlink: false,
64589
+ exclusiveCopy: options.transport.capabilities?.conditionalCopy === true,
64590
+ append: options.transport.capabilities?.conditionalPut === true,
64591
+ exclusiveCreate: options.transport.capabilities?.conditionalPut === true,
64592
+ truncate: options.transport.capabilities?.conditionalPut === true,
64593
+ atomicRenameNoReplace: false,
64594
+ rename: this.allowRename && options.transport.capabilities?.conditionalDelete === true && (options.transport.capabilities?.conditionalCopy === true || options.transport.capabilities?.conditionalPut === true),
64595
+ streamingAppend: options.transport.capabilities?.streamingWrite === true && options.transport.capabilities?.conditionalPut === true && typeof options.transport.putObjectStream === "function",
64596
+ randomAccessWrite: false,
64597
+ readOnly: options.readOnly ?? false,
64598
+ symlinks: false,
64599
+ hardlinks: false,
64600
+ permissions: false,
64601
+ timestamps: options.transport.capabilities?.conditionalCopy === true || options.transport.capabilities?.conditionalPut === true,
64602
+ atomicRename: false,
64603
+ snapshotRmdir: true,
64604
+ streamingRead: options.transport.capabilities?.streamingRead === true && typeof options.transport.getObjectStream === "function",
64605
+ streamingWrite: options.transport.capabilities?.streamingWrite === true && typeof options.transport.putObjectStream === "function"
64606
+ });
64607
+ if (this.capabilities.streamingRead)
64608
+ this.readStream = this.streamRead.bind(this);
64609
+ if (this.capabilities.streamingWrite)
64610
+ this.writeStream = this.streamWrite.bind(this);
64611
+ const transport = this.transport;
64612
+ const bucket = this.bucket;
64613
+ const registeredPrefix = this.prefix;
64614
+ registerS3EntryOwner(this, (path) => this.path(path), () => this.transport === transport && this.bucket === bucket && this.prefix === registeredPrefix, s3Comparison, options.compareEntry);
64615
+ registerEntryAuthority(this, compareOwnedS3Entries);
64616
+ }
64617
+ async compareEntry(path, peer, peerPath, options = {}) {
64618
+ return compareEntries(this, path, peer, peerPath, options);
64619
+ }
64620
+ path(input) {
64621
+ if (typeof input !== "string" || input.includes("\0") || !isWellFormed(input))
64622
+ fail2("EINVAL", "resolve", input, "invalid path string");
64623
+ const components2 = [];
64624
+ for (const part of input.split("/")) {
64625
+ if (!part || part === ".")
64626
+ continue;
64627
+ if (part === "..") {
64628
+ if (components2.length === 0)
64629
+ fail2("EACCES", "resolve", input, "path attempts to escape the configured prefix");
64630
+ components2.pop();
64631
+ } else
64632
+ components2.push(part);
64633
+ }
64634
+ const path = `/${components2.join("/")}`;
64635
+ if (utf8ByteLength3(this.key(path)) > 1024)
64636
+ fail2("ENAMETOOLONG", "resolve", input);
64637
+ return path;
64638
+ }
64639
+ key(path) {
64640
+ return this.prefix + path.slice(1);
64641
+ }
64642
+ directoryKey(path) {
64643
+ const key = path === "/" ? this.prefix : `${this.key(path)}/`;
64644
+ if (utf8ByteLength3(key) > 1024)
64645
+ fail2("ENAMETOOLONG", "resolve", path);
64646
+ return key;
64647
+ }
64648
+ checkAbort(options, syscall, path) {
64649
+ if (options.signal?.aborted)
64650
+ fail2("ECANCELED", syscall, path);
64651
+ }
64652
+ requestOptions(options) {
64653
+ return options.signal === void 0 ? {} : { abortSignal: options.signal };
64654
+ }
64655
+ async call(syscall, path, options, action, precondition) {
64656
+ this.checkAbort(options, syscall, path);
64657
+ chargeScopedTransportCall(options);
64658
+ this.checkAbort(options, syscall, path);
64659
+ const budget = this.removalBudgets.get(options);
64660
+ if (budget && ++budget.requests > this.removalLimits.maxRequests) {
64661
+ fail2("EFBIG", "rm", path, "S3 removal request budget exceeded");
64662
+ }
64663
+ if (this.requests >= this.maxRequests) {
64664
+ fail2("EFBIG", syscall, path, "S3 transport request budget exceeded");
64665
+ }
64666
+ this.requests++;
64667
+ let onAbort;
64668
+ try {
64669
+ const pending = action();
64670
+ const result = options.signal ? await new Promise((resolve, reject) => {
64671
+ const signal = options.signal;
64672
+ onAbort = () => reject(new FsError("ECANCELED", { syscall, path, cause: signal.reason }));
64673
+ signal.addEventListener("abort", onAbort, { once: true });
64674
+ if (signal.aborted)
64675
+ onAbort();
64676
+ pending.then((value) => {
64677
+ if (signal.aborted && typeof value === "object" && value !== null && "Body" in value)
64678
+ this.dispose(value.Body);
64679
+ resolve(value);
64680
+ }, reject);
64681
+ }) : await pending;
64682
+ this.checkAbort(options, syscall, path);
64683
+ return result;
64684
+ } catch (error) {
64685
+ if (options.signal?.aborted)
64686
+ fail2("ECANCELED", syscall, path);
64687
+ throw translate(error, syscall, path, precondition);
64688
+ } finally {
64689
+ if (onAbort)
64690
+ options.signal?.removeEventListener("abort", onAbort);
64691
+ }
64692
+ }
64693
+ writable(path, mode) {
64694
+ if (this.capabilities.readOnly)
64695
+ fail2("EROFS", "write", path);
64696
+ if (mode !== void 0)
64697
+ validateLimit(mode, "mode", 0, 4095);
64698
+ }
64699
+ unsupported(operation, path) {
64700
+ return fail2("ENOTSUP", operation, path, `S3 does not support ${operation} with the configured transport`);
64701
+ }
64702
+ async head(key, path, options) {
64703
+ try {
64704
+ const input = { Bucket: this.bucket, Key: key };
64705
+ return await this.call("headObject", path, options, () => queryS3Head(input, (query) => this.transport.headObject(query, this.requestOptions(options))));
64706
+ } catch (error) {
64707
+ if (isFsError(error, "ENOENT") && serviceCode(error.cause) !== "NoSuchBucket")
64708
+ return void 0;
64709
+ throw error;
64710
+ }
64711
+ }
64712
+ makeStat(type, metadata) {
64713
+ const size = type === "directory" ? 0 : metadata?.ContentLength;
64714
+ if (size === void 0 || !Number.isSafeInteger(size) || size < 0)
64715
+ fail2("EIO", "stat", "", "transport omitted a valid object ContentLength");
64716
+ const modified = metadata?.LastModified?.getTime() ?? 0;
64717
+ if (!Number.isFinite(modified))
64718
+ fail2("EIO", "stat", "", "transport returned an invalid LastModified");
64719
+ const timestamp = (key, fallback) => {
64720
+ const value = metadata?.Metadata?.[key];
64721
+ if (value === void 0)
64722
+ return fallback;
64723
+ const parsed = Number(value);
64724
+ if (!value || !Number.isFinite(parsed))
64725
+ fail2("EIO", "stat", "", "invalid virtual timestamp metadata");
64726
+ return parsed;
64727
+ };
64728
+ const storedMode = metadata?.Metadata?.["virtual-bash-mode"];
64729
+ const mode = storedMode === void 0 ? type === "directory" ? 493 : 420 : Number(storedMode);
64730
+ if (!Number.isSafeInteger(mode) || mode < 0 || mode > 4095 || storedMode === "")
64731
+ fail2("EIO", "stat", "", "invalid virtual mode metadata");
64732
+ return {
64733
+ type,
64734
+ size,
64735
+ mode: (type === "directory" ? 16384 : 32768) | mode,
64736
+ mtimeMs: timestamp("virtual-bash-mtime", modified),
64737
+ atimeMs: timestamp("virtual-bash-atime", 0),
64738
+ ctimeMs: modified
64739
+ };
64740
+ }
64741
+ async page(prefix, path, options, delimiter, token, maxKeys = this.pageSize) {
64742
+ const budget = this.removalBudgets.get(options);
64743
+ if (budget)
64744
+ maxKeys = Math.min(maxKeys, this.removalLimits.maxListEntries - budget.entries + 1);
64745
+ const result = await this.call("listObjectsV2", path, options, () => this.transport.listObjectsV2({
64746
+ Bucket: this.bucket,
64747
+ Prefix: prefix,
64748
+ MaxKeys: maxKeys,
64749
+ ...delimiter === void 0 ? {} : { Delimiter: delimiter },
64750
+ ...token === void 0 ? {} : { ContinuationToken: token }
64751
+ }, this.requestOptions(options)));
64752
+ if (budget) {
64753
+ budget.entries += (result.Contents?.length ?? 0) + (result.CommonPrefixes?.length ?? 0);
64754
+ if (budget.entries > this.removalLimits.maxListEntries)
64755
+ fail2("EFBIG", "rm", path, "S3 removal listing budget exceeded");
64756
+ }
64757
+ for (const item of result.Contents ?? []) {
64758
+ if (typeof item.Key !== "string" || !item.Key.startsWith(prefix))
64759
+ fail2("EIO", "listObjectsV2", path, "transport returned an object outside the requested prefix");
64760
+ this.validateObject(item, path);
64761
+ }
64762
+ for (const item of result.CommonPrefixes ?? []) {
64763
+ if (delimiter === void 0 || typeof item.Prefix !== "string" || !item.Prefix.startsWith(prefix) || !item.Prefix.endsWith("/") || item.Prefix === prefix)
64764
+ fail2("EIO", "listObjectsV2", path, "invalid common prefix");
64765
+ this.validateKey(item.Prefix, path);
64766
+ }
64767
+ if (result.IsTruncated !== void 0 && typeof result.IsTruncated !== "boolean")
64768
+ fail2("EIO", "listObjectsV2", path, "invalid IsTruncated flag");
64769
+ return result;
64770
+ }
64771
+ validateKey(key, path) {
64772
+ if (!key.startsWith(this.prefix))
64773
+ fail2("EIO", "listObjectsV2", path, "key escapes the configured prefix");
64774
+ const relative = key.slice(this.prefix.length).replace(/\/$/, "");
64775
+ if (!isWellFormed(key) || key.includes("\0") || utf8ByteLength3(key) > 1024 || relative !== "" && relative.split("/").some((part) => !part || part === "." || part === "..")) {
64776
+ fail2("ENOTSUP", "listObjectsV2", path, "object key cannot be represented as a canonical filesystem path");
64777
+ }
64778
+ }
64779
+ validateObject(object, path) {
64780
+ const key = object.Key;
64781
+ this.validateKey(key, path);
64782
+ if (object.Size === void 0 || !Number.isSafeInteger(object.Size) || object.Size < 0)
64783
+ fail2("EIO", "listObjectsV2", path, "invalid object size");
64784
+ if (key.endsWith("/") && object.Size !== 0)
64785
+ fail2("ENOTSUP", "listObjectsV2", path, "nonempty slash-suffixed objects cannot be treated as directories");
64786
+ }
64787
+ async *pages(prefix, path, options, delimiter, maxKeys = this.pageSize) {
64788
+ const tokens = /* @__PURE__ */ new Set();
64789
+ let token;
64790
+ let entries2 = 0;
64791
+ do {
64792
+ const page = await this.page(prefix, path, options, delimiter, token, maxKeys);
64793
+ entries2 += (page.Contents?.length ?? 0) + (page.CommonPrefixes?.length ?? 0);
64794
+ if (entries2 > this.maxListEntries || tokens.size >= this.maxListEntries)
64795
+ fail2("EFBIG", "listObjectsV2", path, "listing exceeds maxListEntries");
64796
+ yield page;
64797
+ if (!page.IsTruncated)
64798
+ return;
64799
+ token = page.NextContinuationToken;
64800
+ if (typeof token !== "string" || !token || tokens.has(token))
64801
+ fail2("EIO", "listObjectsV2", path, "missing or repeated continuation token");
64802
+ tokens.add(token);
64803
+ } while (true);
64804
+ }
64805
+ async inspect(path, options) {
64806
+ if (path === "/") {
64807
+ const listing = await this.page(this.prefix, path, options, void 0, void 0, 1);
64808
+ const marker2 = this.prefix && listing.Contents?.some((object) => object.Key === this.prefix) ? await this.head(this.prefix, path, options) : void 0;
64809
+ if (marker2 && marker2.ContentLength !== 0)
64810
+ this.unsupported("nonempty directory markers", path);
64811
+ return { stat: this.makeStat("directory", marker2), ...marker2 ? { metadata: marker2 } : {} };
64812
+ }
64813
+ const file = await this.head(this.key(path), path, options);
64814
+ if (utf8ByteLength3(this.key(path)) === 1024) {
64815
+ return file ? { stat: this.makeStat("file", file), metadata: file } : void 0;
64816
+ }
64817
+ const directoryKey = this.directoryKey(path);
64818
+ let directory = false;
64819
+ let hasMarker = false;
64820
+ for await (const children of this.pages(directoryKey, path, options, void 0, 1)) {
64821
+ if ((children.Contents?.length ?? 0) > 0) {
64822
+ directory = true;
64823
+ hasMarker = children.Contents.some((object) => object.Key === directoryKey);
64824
+ break;
64825
+ }
64826
+ }
64827
+ const marker = hasMarker ? await this.head(directoryKey, path, options) : void 0;
64828
+ if (marker && marker.ContentLength !== 0)
64829
+ this.unsupported("nonempty directory markers", path);
64830
+ if (file && directory)
64831
+ this.unsupported("file/prefix collisions", path);
64832
+ if (file)
64833
+ return { stat: this.makeStat("file", file), metadata: file };
64834
+ if (directory)
64835
+ return { stat: this.makeStat("directory", marker), ...marker ? { metadata: marker } : {} };
64836
+ return void 0;
64837
+ }
64838
+ async lookup(path, options) {
64839
+ const ancestors = [];
64840
+ for (let parent = posixPath.dirname(path); path !== "/"; parent = posixPath.dirname(parent)) {
64841
+ ancestors.unshift(parent);
64842
+ if (parent === "/")
64843
+ break;
64844
+ }
64845
+ for (const parent of ancestors) {
64846
+ if (parent === "/" && this.prefix === "")
64847
+ continue;
64848
+ const ancestor = await this.inspect(parent, options);
64849
+ if (!ancestor)
64850
+ fail2("ENOENT", "stat", parent);
64851
+ if (ancestor.stat.type !== "directory")
64852
+ fail2("ENOTDIR", "stat", parent);
64853
+ }
64854
+ return this.inspect(path, options);
64855
+ }
64856
+ requireDirectorySuffix(input, info3) {
64857
+ if (input.endsWith("/") && info3?.stat.type === "file")
64858
+ fail2("ENOTDIR", "stat", input);
64859
+ }
64860
+ async stat(input, options = {}) {
64861
+ const path = this.path(input);
64862
+ const info3 = await this.lookup(path, options);
64863
+ this.requireDirectorySuffix(input, info3);
64864
+ if (!info3)
64865
+ fail2("ENOENT", "stat", input);
64866
+ recordS3Stat(this, path, info3.stat, info3.metadata);
64867
+ return info3.stat;
64868
+ }
64869
+ async lstat(path, options = {}) {
64870
+ return this.stat(path, options);
64871
+ }
64872
+ async body(output, path, options) {
64873
+ const limit = Math.min(this.maxReadBytes, options.maxBytes === void 0 ? this.maxReadBytes : validateLimit(options.maxBytes, "maxBytes", 0, Infinity));
64874
+ let iterator;
64875
+ return this.call("readFile", path, options, async () => {
64876
+ if (output.Body && Symbol.asyncIterator in output.Body)
64877
+ iterator = output.Body[Symbol.asyncIterator]();
64878
+ if (output.ContentLength !== void 0 && output.ContentLength > limit)
64879
+ fail2("EFBIG", "readFile", path);
64880
+ const body = output.Body;
64881
+ if (!body)
64882
+ fail2("EIO", "readFile", path, "transport omitted the response body");
64883
+ let bytes;
64884
+ if (body instanceof Uint8Array) {
64885
+ if (body.byteLength > limit)
64886
+ fail2("EFBIG", "readFile", path);
64887
+ bytes = new Uint8Array(body);
64888
+ } else if (Symbol.asyncIterator in body) {
64889
+ bytes = await collectBytes({ [Symbol.asyncIterator]: () => iterator }, { ...limit === Infinity ? {} : { maxBytes: limit }, ...options.signal ? { signal: options.signal } : {} });
64890
+ } else if ("transformToByteArray" in body) {
64891
+ const converted = await body.transformToByteArray();
64892
+ if (!(converted instanceof Uint8Array))
64893
+ fail2("EIO", "readFile", path, "transport body is not binary");
64894
+ if (converted.byteLength > limit)
64895
+ fail2("EFBIG", "readFile", path);
64896
+ bytes = new Uint8Array(converted);
64897
+ } else
64898
+ fail2("EIO", "readFile", path, "unsupported response body");
64899
+ this.checkAbort(options, "readFile", path);
64900
+ if (output.ContentLength !== void 0 && output.ContentLength !== bytes.byteLength)
64901
+ fail2("EIO", "readFile", path, "response body length does not match ContentLength");
64902
+ return bytes;
64903
+ }).catch((error) => {
64904
+ this.dispose(iterator);
64905
+ if (output.Body !== iterator)
64906
+ this.dispose(output.Body, iterator === void 0);
64907
+ throw error;
64908
+ });
64909
+ }
64910
+ async get(path, options) {
64911
+ return this.call("getObject", path, options, () => this.transport.getObject({ Bucket: this.bucket, Key: this.key(path) }, this.requestOptions(options)));
64912
+ }
64913
+ async readFile(input, options = {}) {
64914
+ const path = this.path(input);
64915
+ if (options.maxBytes !== void 0)
64916
+ validateLimit(options.maxBytes, "maxBytes", 0, Infinity);
64917
+ const info3 = await this.stat(input, options);
64918
+ if (info3.type === "directory")
64919
+ fail2("EISDIR", "readFile", path);
64920
+ if (info3.size > Math.min(this.maxReadBytes, options.maxBytes ?? this.maxReadBytes))
64921
+ fail2("EFBIG", "readFile", path);
64922
+ const output = this.capabilities.streamingRead ? await this.call("getObject", path, options, () => this.transport.getObjectStream({ Bucket: this.bucket, Key: this.key(path) }, this.requestOptions(options))) : await this.get(path, options);
64923
+ return this.body(output, path, options);
64924
+ }
64925
+ etag(metadata, path) {
64926
+ if (!metadata?.ETag)
64927
+ this.unsupported("conditional mutation without an ETag", path);
64928
+ return metadata.ETag;
64929
+ }
64930
+ async writeFile(input, data, options = {}) {
64931
+ const path = this.path(input);
64932
+ this.writable(path, options.mode);
64933
+ if (!(data instanceof Uint8Array))
64934
+ fail2("EINVAL", "writeFile", path, "data must be Uint8Array");
64935
+ const bytes = new Uint8Array(data);
64936
+ if (bytes.byteLength > 5e9)
64937
+ fail2("EFBIG", "writeFile", path, "multipart upload is not supported");
64938
+ const flag = options.flag ?? "w";
64939
+ if (!["w", "wx", "a", "ax"].includes(flag))
64940
+ fail2("EINVAL", "writeFile", path, "invalid write flag");
64941
+ if (flag !== "w" && !this.transport.capabilities?.conditionalPut)
64942
+ this.unsupported("conditional writes", path);
64943
+ const info3 = await this.lookup(path, options);
64944
+ this.requireDirectorySuffix(input, info3);
64945
+ if (info3?.stat.type === "directory")
64946
+ fail2("EISDIR", "writeFile", path);
64947
+ if (input.endsWith("/"))
64948
+ fail2("EISDIR", "writeFile", input);
64949
+ const exclusive = flag === "wx" || flag === "ax";
64950
+ if (exclusive && info3)
64951
+ fail2("EEXIST", "writeFile", path);
64952
+ let body = bytes;
64953
+ let match;
64954
+ let metadata = this.writeMetadata(info3?.metadata, options.mode);
64955
+ if (flag === "a" && info3) {
64956
+ const current = await this.get(path, options);
64957
+ const previous = await this.body(current, path, options);
64958
+ match = this.etag(current, path);
64959
+ metadata = { ...current.Metadata };
64960
+ delete metadata["virtual-bash-mtime"];
64961
+ if (previous.length + bytes.length > this.maxReadBytes)
64962
+ fail2("EFBIG", "appendFile", path);
64963
+ body = new Uint8Array(previous.length + bytes.length);
64964
+ body.set(previous);
64965
+ body.set(bytes, previous.length);
64966
+ }
64967
+ await this.call("putObject", path, options, () => this.transport.putObject({
64968
+ Bucket: this.bucket,
64969
+ Key: this.key(path),
64970
+ Body: body,
64971
+ ...match === void 0 ? {} : { IfMatch: match },
64972
+ ...exclusive || flag === "a" && !info3 ? { IfNoneMatch: "*" } : {},
64973
+ ...metadata === void 0 ? {} : { Metadata: metadata }
64974
+ }, this.requestOptions(options)), exclusive ? "EEXIST" : "EAGAIN");
64975
+ }
64976
+ writeMetadata(previous, mode) {
64977
+ const metadata = { ...previous?.Metadata };
64978
+ delete metadata["virtual-bash-mtime"];
64979
+ if (previous === void 0 && mode !== void 0)
64980
+ metadata["virtual-bash-mode"] = String(mode);
64981
+ return Object.keys(metadata).length === 0 ? void 0 : metadata;
64982
+ }
64983
+ async appendFile(path, data, options = {}) {
64984
+ return this.writeFile(path, data, { ...options, flag: "a" });
64985
+ }
64986
+ async mkdir(input, options = {}) {
64987
+ const path = this.path(input);
64988
+ this.writable(path, options.mode);
64989
+ if (options.recursive && path !== "/") {
64990
+ await this.mkdir(posixPath.dirname(path), { ...options, recursive: true });
64991
+ }
64992
+ const info3 = await this.lookup(path, options);
64993
+ if (info3) {
64994
+ if (options.recursive && info3.stat.type === "directory")
64995
+ return;
64996
+ fail2("EEXIST", "mkdir", path);
64997
+ }
64998
+ await this.call("putObject", path, options, () => this.transport.putObject({
64999
+ Bucket: this.bucket,
65000
+ Key: this.directoryKey(path),
65001
+ Body: new Uint8Array(),
65002
+ ...options.mode === void 0 ? {} : { Metadata: { "virtual-bash-mode": String(options.mode) } },
65003
+ ...this.transport.capabilities?.conditionalPut ? { IfNoneMatch: "*" } : {}
65004
+ }, this.requestOptions(options)), "EEXIST");
65005
+ }
65006
+ async readdir(input, options = {}) {
65007
+ let limit;
65008
+ if (options.maxEntries !== void 0) {
65009
+ this.checkAbort(options, "readdir", input);
65010
+ limit = directoryEntryLimit(options, input);
65011
+ }
65012
+ const path = this.path(input);
65013
+ if ((await this.stat(input, options)).type !== "directory")
65014
+ fail2("ENOTDIR", "readdir", path);
65015
+ const prefix = this.directoryKey(path);
65016
+ const entries2 = /* @__PURE__ */ new Map();
65017
+ const add = (name, type) => {
65018
+ this.checkAbort(options, "readdir", path);
65019
+ if (!name || name.includes("/"))
65020
+ fail2("EIO", "readdir", path, "invalid direct child in delimited listing");
65021
+ const existing = entries2.get(name);
65022
+ if (existing && existing.type !== type)
65023
+ this.unsupported("file/prefix collisions", path);
65024
+ if (!existing)
65025
+ admitDirectoryEntries(entries2.size + 1, limit, path);
65026
+ entries2.set(name, { name, type });
65027
+ };
65028
+ const maxKeys = limit === void 0 ? this.pageSize : Math.min(this.pageSize, limit + 1);
65029
+ for await (const page of this.pages(prefix, path, options, "/", maxKeys)) {
65030
+ for (const item of page.Contents ?? []) {
65031
+ if (item.Key === prefix)
65032
+ continue;
65033
+ add(item.Key.slice(prefix.length), "file");
65034
+ }
65035
+ for (const item of page.CommonPrefixes ?? [])
65036
+ add(item.Prefix.slice(prefix.length, -1), "directory");
65037
+ }
65038
+ return [...entries2.values()].sort((left, right) => compareKeys(left.name, right.name));
65039
+ }
65040
+ async tree(path, options) {
65041
+ const objects = /* @__PURE__ */ new Map();
65042
+ for await (const page of this.pages(this.directoryKey(path), path, options)) {
65043
+ for (const item of page.Contents ?? [])
65044
+ objects.set(item.Key, item);
65045
+ }
65046
+ for (const key of objects.keys()) {
65047
+ const withoutSlash = key.replace(/\/$/, "");
65048
+ if (key.endsWith("/") && objects.has(withoutSlash))
65049
+ this.unsupported("file/prefix collisions", path);
65050
+ let parent = posixPath.dirname(withoutSlash);
65051
+ while (parent !== "." && parent !== "/") {
65052
+ if (objects.has(parent))
65053
+ this.unsupported("file/prefix collisions", path);
65054
+ parent = posixPath.dirname(parent);
65055
+ }
65056
+ }
65057
+ return [...objects.values()];
65058
+ }
65059
+ async rmdir(input, options = {}) {
65060
+ try {
65061
+ const path = this.path(input);
65062
+ this.checkAbort(options, "rmdir", input);
65063
+ this.writable(path);
65064
+ if (path === "/")
65065
+ fail2("EBUSY", "rmdir", input, "cannot remove the mounted root");
65066
+ const info3 = await this.lookup(path, options);
65067
+ this.checkAbort(options, "rmdir", input);
65068
+ if (!info3)
65069
+ fail2("ENOENT", "rmdir", input);
65070
+ if (info3.stat.type !== "directory")
65071
+ fail2("ENOTDIR", "rmdir", input);
65072
+ const prefix = this.directoryKey(path);
65073
+ let markerObserved = false;
65074
+ for await (const page of this.pages(prefix, path, options, "/", Math.max(2, this.pageSize))) {
65075
+ this.checkAbort(options, "rmdir", input);
65076
+ if (page.Contents?.some((item) => item.Key !== prefix) || page.CommonPrefixes?.length) {
65077
+ fail2("ENOTEMPTY", "rmdir", input);
65078
+ }
65079
+ if (page.IsTruncated === void 0)
65080
+ fail2("EIO", "rmdir", input, "listing did not confirm completeness");
65081
+ if (page.Contents?.some((item) => item.Key === prefix))
65082
+ markerObserved = true;
65083
+ }
65084
+ this.checkAbort(options, "rmdir", input);
65085
+ if (!info3.metadata)
65086
+ fail2("ENOTSUP", "rmdir", input, "snapshot removal requires an explicit directory marker");
65087
+ if (!markerObserved)
65088
+ fail2("ENOENT", "rmdir", input, "directory marker disappeared during inspection");
65089
+ await this.call("deleteObject", path, options, () => this.transport.deleteObject({ Bucket: this.bucket, Key: prefix }, this.requestOptions(options)));
65090
+ } catch (error) {
65091
+ if (isFsError(error) && (error.syscall !== "rmdir" || error.path !== input)) {
65092
+ throw new FsError(error.code, { syscall: "rmdir", path: input, cause: error });
65093
+ }
65094
+ throw error;
65095
+ }
65096
+ }
65097
+ async rm(input, options = {}) {
65098
+ options = { ...options };
65099
+ const budget = { requests: 0, entries: 0 };
65100
+ this.removalBudgets.set(options, budget);
65101
+ const path = this.path(input);
65102
+ this.writable(path);
65103
+ if (path === "/")
65104
+ fail2("EBUSY", "rm", path, "cannot remove the mounted root");
65105
+ let info3;
65106
+ try {
65107
+ info3 = await this.lookup(path, options);
65108
+ } catch (error) {
65109
+ if (options.force && isFsError(error, "ENOENT") && serviceCode(error.cause) !== "NoSuchBucket")
65110
+ return;
65111
+ throw error;
65112
+ }
65113
+ this.requireDirectorySuffix(input, info3);
65114
+ if (!info3) {
65115
+ if (options.force)
65116
+ return;
65117
+ fail2("ENOENT", "rm", path);
65118
+ }
65119
+ let objects;
65120
+ if (info3.stat.type === "directory" && !options.recursive) {
65121
+ const prefix = this.directoryKey(path);
65122
+ objects = [];
65123
+ for await (const page of this.pages(prefix, path, options, void 0, 2)) {
65124
+ if (page.Contents?.some((item) => item.Key !== prefix))
65125
+ fail2("ENOTEMPTY", "rm", path);
65126
+ if (page.Contents?.length)
65127
+ objects = [{ Key: prefix }];
65128
+ }
65129
+ } else {
65130
+ objects = info3.stat.type === "directory" ? await this.tree(path, options) : [{ Key: this.key(path) }];
65131
+ }
65132
+ if (objects.length > this.removalLimits.maxDeleteObjects || budget.requests + objects.length > this.removalLimits.maxRequests) {
65133
+ fail2("EFBIG", "rm", path, "S3 removal delete or request budget exceeded; use bounded batches");
65134
+ }
65135
+ for (const item of objects) {
65136
+ await this.call("deleteObject", path, options, () => this.transport.deleteObject({ Bucket: this.bucket, Key: item.Key }, this.requestOptions(options)));
65137
+ }
65138
+ }
65139
+ async copy(sourceKey, destinationKey, source, metadata, options, destination) {
65140
+ if (metadata.ContentLength === void 0 || metadata.ContentLength > 5e9)
65141
+ this.unsupported("multipart copy", source);
65142
+ const etag = this.etag(metadata, source);
65143
+ const result = await this.call("copyObject", source, options, () => this.transport.copyObject({
65144
+ Bucket: this.bucket,
65145
+ Key: destinationKey,
65146
+ CopySource: encodeCopySource(this.bucket, sourceKey),
65147
+ CopySourceIfMatch: etag,
65148
+ MetadataDirective: "COPY",
65149
+ ...options.exclusive ? { IfNoneMatch: "*" } : {},
65150
+ ...destination === void 0 ? {} : destination === null ? { IfNoneMatch: "*" } : { IfMatch: this.etag(destination, source) }
65151
+ }, this.requestOptions(options)));
65152
+ if (!result.CopyObjectResult?.ETag)
65153
+ fail2("EIO", "copyObject", source, "transport did not confirm a completed CopyObject result");
65154
+ }
65155
+ async copyFile(sourceInput, destinationInput, options = {}) {
65156
+ const source = this.path(sourceInput);
65157
+ const destination = this.path(destinationInput);
65158
+ this.writable(destination);
65159
+ if (options.exclusive && !this.transport.capabilities?.conditionalCopy)
65160
+ this.unsupported("exclusive server-side copy", destination);
65161
+ const origin = await this.lookup(source, options);
65162
+ this.requireDirectorySuffix(sourceInput, origin);
65163
+ if (!origin)
65164
+ fail2("ENOENT", "copyFile", source);
65165
+ if (origin.stat.type === "directory")
65166
+ fail2("EISDIR", "copyFile", source);
65167
+ const target = await this.lookup(destination, options);
65168
+ this.requireDirectorySuffix(destinationInput, target);
65169
+ if (target?.stat.type === "directory" || destinationInput.endsWith("/"))
65170
+ fail2("EISDIR", "copyFile", destination);
65171
+ if (target && options.exclusive)
65172
+ fail2("EEXIST", "copyFile", destination);
65173
+ if (source === destination)
65174
+ return;
65175
+ try {
65176
+ await this.copy(this.key(source), this.key(destination), source, origin.metadata, options);
65177
+ } catch (error) {
65178
+ if (!options.exclusive || !isFsError(error, "EAGAIN"))
65179
+ throw error;
65180
+ const status = error.cause?.$metadata?.httpStatusCode;
65181
+ if (serviceCode(error.cause) !== "PreconditionFailed" && status !== 412)
65182
+ throw error;
65183
+ let destinationExists = false;
65184
+ try {
65185
+ const currentSource = await this.head(this.key(source), source, options);
65186
+ if (currentSource?.ETag === origin.metadata?.ETag) {
65187
+ destinationExists = await this.head(this.key(destination), destination, options) !== void 0;
65188
+ }
65189
+ } catch (diagnosticError) {
65190
+ if (isFsError(diagnosticError, "ECANCELED"))
65191
+ throw diagnosticError;
65192
+ }
65193
+ if (destinationExists) {
65194
+ throw new FsError("EEXIST", { syscall: "copyFile", path: source, dest: destination, cause: error });
65195
+ }
65196
+ throw error;
65197
+ }
65198
+ }
65199
+ async rename(sourceInput, destinationInput, options = {}) {
65200
+ if (options.noReplace) {
65201
+ options.signal?.throwIfAborted();
65202
+ this.unsupported("atomic no-replace rename", sourceInput);
65203
+ }
65204
+ const source = this.path(sourceInput);
65205
+ const destination = this.path(destinationInput);
65206
+ this.writable(destination);
65207
+ if (!this.allowRename)
65208
+ this.unsupported("atomic rename; explicitly enable allowNonAtomicRename for copy/delete semantics", source);
65209
+ if (!this.transport.capabilities?.conditionalDelete)
65210
+ this.unsupported("rename without conditional delete", source);
65211
+ const conditionalCopy = this.transport.capabilities?.conditionalCopy === true;
65212
+ if (!conditionalCopy && this.transport.capabilities?.conditionalPut !== true) {
65213
+ this.unsupported("rename requires conditional destination copy or conditional PUT, plus conditional delete", source);
65214
+ }
65215
+ const streamFallback = this.capabilities.streamingRead && this.capabilities.streamingWrite;
65216
+ if (source === "/" || destination === "/")
65217
+ fail2("EBUSY", "rename", source);
65218
+ const origin = await this.lookup(source, options);
65219
+ this.requireDirectorySuffix(sourceInput, origin);
65220
+ if (!origin)
65221
+ fail2("ENOENT", "rename", source);
65222
+ if (source === destination) {
65223
+ this.requireDirectorySuffix(destinationInput, origin);
65224
+ return;
65225
+ }
65226
+ if (destination.startsWith(`${source}/`))
65227
+ fail2("EINVAL", "rename", destination, "cannot move a path into itself");
65228
+ const target = await this.lookup(destination, options);
65229
+ this.requireDirectorySuffix(destinationInput, target);
65230
+ if (destinationInput.endsWith("/") && origin.stat.type !== "directory")
65231
+ fail2("ENOTDIR", "rename", destination);
65232
+ if (target && target.stat.type !== origin.stat.type)
65233
+ fail2(target.stat.type === "directory" ? "EISDIR" : "ENOTDIR", "rename", destination);
65234
+ if (target?.stat.type === "directory" && (await this.readdir(destination, options)).length > 0)
65235
+ fail2("ENOTEMPTY", "rename", destination);
65236
+ if (target?.metadata)
65237
+ this.etag(target.metadata, destination);
65238
+ const objects = origin.stat.type === "directory" ? await this.tree(source, options) : [{
65239
+ Key: this.key(source),
65240
+ Size: origin.stat.size,
65241
+ ETag: origin.metadata?.ETag
65242
+ }];
65243
+ for (const object of objects) {
65244
+ this.etag({ ETag: object.ETag }, source);
65245
+ if (object.Size === void 0 || object.Size > 5e9)
65246
+ this.unsupported("multipart copy", source);
65247
+ if (!conditionalCopy && object.Size > (streamFallback ? this.maxStreamBytes : this.maxReadBytes)) {
65248
+ fail2("EFBIG", "rename", source, "conditional PUT fallback exceeds its configured transfer or buffered read limit");
65249
+ }
65250
+ if (utf8ByteLength3(this.key(destination) + object.Key.slice(this.key(source).length)) > 1024)
65251
+ fail2("ENAMETOOLONG", "rename", destination);
65252
+ }
65253
+ const copied = [];
65254
+ const deleted = [];
65255
+ let phase = "copy";
65256
+ try {
65257
+ for (const object of objects) {
65258
+ const destinationKey = this.key(destination) + object.Key.slice(this.key(source).length);
65259
+ const destinationMetadata = origin.stat.type === "file" || object.Key === this.directoryKey(source) ? target?.metadata ?? null : null;
65260
+ const metadata = { ContentLength: object.Size, ETag: object.ETag };
65261
+ if (conditionalCopy)
65262
+ await this.copy(object.Key, destinationKey, source, metadata, options, destinationMetadata);
65263
+ else
65264
+ await this.copyWithPut(object.Key, destinationKey, source, metadata, destinationMetadata, options, streamFallback);
65265
+ copied.push(destinationKey);
65266
+ }
65267
+ phase = "delete";
65268
+ for (const object of objects) {
65269
+ await this.call("deleteObject", source, options, () => this.transport.deleteObject({
65270
+ Bucket: this.bucket,
65271
+ Key: object.Key,
65272
+ IfMatch: object.ETag
65273
+ }, this.requestOptions(options)));
65274
+ deleted.push(object.Key);
65275
+ }
65276
+ } catch (error) {
65277
+ throw new S3RenameError(source, destination, phase, copied, deleted, translate(error, "rename", source));
65278
+ }
65279
+ }
65280
+ async copyWithPut(sourceKey, destinationKey, source, expected, destination, options, streaming) {
65281
+ const etag = this.etag(expected, source);
65282
+ const condition = destination === null ? { IfNoneMatch: "*" } : { IfMatch: this.etag(destination, destinationKey) };
65283
+ const controller = new AbortController();
65284
+ const signalScope = options.signal ? composeAbortSignals([options.signal, controller.signal]) : void 0;
65285
+ const signal = signalScope?.signal ?? controller.signal;
65286
+ const operationOptions = { signal };
65287
+ let output;
65288
+ let upload;
65289
+ let reading = false;
65290
+ try {
65291
+ output = await this.call("getObject", source, operationOptions, () => streaming ? this.transport.getObjectStream({ Bucket: this.bucket, Key: sourceKey, IfMatch: etag }, { abortSignal: signal }) : this.transport.getObject({ Bucket: this.bucket, Key: sourceKey }, { abortSignal: signal }));
65292
+ if (this.etag(output, source) !== etag)
65293
+ fail2("EAGAIN", "rename", source, "source changed before conditional PUT copy");
65294
+ if (output.ContentLength !== void 0 && output.ContentLength !== expected.ContentLength) {
65295
+ fail2("EIO", "rename", source, "source response length differs from the enumerated object");
65296
+ }
65297
+ const input = {
65298
+ Bucket: this.bucket,
65299
+ Key: destinationKey,
65300
+ ...condition,
65301
+ ...output.Metadata === void 0 ? {} : { Metadata: { ...output.Metadata } }
65302
+ };
65303
+ if (!streaming) {
65304
+ const body2 = await this.body(output, source, operationOptions);
65305
+ if (body2.length !== expected.ContentLength)
65306
+ fail2("EIO", "rename", source, "source body length differs from the enumerated object");
65307
+ await this.call("putObject", source, operationOptions, () => this.transport.putObject({ ...input, Body: body2 }, { abortSignal: signal }));
65308
+ return;
65309
+ }
65310
+ const body = output.Body;
65311
+ if (!body || !(Symbol.asyncIterator in body))
65312
+ fail2("EIO", "rename", source, "streaming transport did not return an async binary body");
65313
+ let finished = false;
65314
+ upload = (async function* () {
65315
+ let count = 0;
65316
+ reading = true;
65317
+ for await (const chunk of readBytes(body, signal)) {
65318
+ if (chunk.length > expected.ContentLength - count)
65319
+ fail2("EIO", "rename", source, "source body exceeds its enumerated length");
65320
+ count += chunk.length;
65321
+ for (let offset = 0; offset < chunk.length; offset += 64 * 1024) {
65322
+ signal.throwIfAborted();
65323
+ yield new Uint8Array(chunk.subarray(offset, offset + 64 * 1024));
65324
+ }
65325
+ }
65326
+ if (count !== expected.ContentLength)
65327
+ fail2("EIO", "rename", source, "incomplete source body");
65328
+ finished = true;
65329
+ })();
65330
+ await this.call("putObject", source, operationOptions, () => this.transport.putObjectStream({ ...input, Body: upload }, { abortSignal: signal }));
65331
+ if (!finished)
65332
+ fail2("EIO", "rename", source, "transport completed without consuming the conditional copy body");
65333
+ } finally {
65334
+ controller.abort();
65335
+ signalScope?.dispose();
65336
+ this.dispose(upload);
65337
+ this.dispose(output?.Body, !reading);
65338
+ }
65339
+ }
65340
+ async realpath(input, options = {}) {
65341
+ await this.stat(input, options);
65342
+ return this.path(input);
65343
+ }
65344
+ async access(path, mode = 0, options = {}) {
65345
+ if (!Number.isInteger(mode) || mode < 0 || mode > 7)
65346
+ fail2("EINVAL", "access", path);
65347
+ const info3 = await this.stat(path, options);
65348
+ if ((mode & 2) !== 0 && this.capabilities.readOnly)
65349
+ fail2("EROFS", "access", path);
65350
+ if ((mode & 1) !== 0 && info3.type !== "directory")
65351
+ fail2("EACCES", "access", path);
65352
+ }
65353
+ async readlink(path) {
65354
+ return this.unsupported("readlink", path);
65355
+ }
65356
+ async symlink(_target, path) {
65357
+ this.unsupported("symlink", path);
65358
+ }
65359
+ async link(_existingPath, path) {
65360
+ this.unsupported("link", path);
65361
+ }
65362
+ async chmod(path, _mode) {
65363
+ this.unsupported("chmod", path);
65364
+ }
65365
+ async utimes(input, atimeMs, mtimeMs, options = {}) {
65366
+ const path = this.path(input);
65367
+ this.writable(path);
65368
+ if (!Number.isFinite(atimeMs) || !Number.isFinite(mtimeMs))
65369
+ fail2("EINVAL", "utimes", path);
65370
+ const info3 = await this.lookup(path, options);
65371
+ this.requireDirectorySuffix(input, info3);
65372
+ if (!info3)
65373
+ fail2("ENOENT", "utimes", path);
65374
+ if (!this.capabilities.timestamps)
65375
+ this.unsupported("conditional metadata mutation", path);
65376
+ const key = info3.stat.type === "directory" ? this.directoryKey(path) : this.key(path);
65377
+ if (!key)
65378
+ this.unsupported("timestamps on an unprefixed bucket root", path);
65379
+ const metadata = {
65380
+ ...info3.metadata?.Metadata,
65381
+ "virtual-bash-atime": String(atimeMs),
65382
+ "virtual-bash-mtime": String(mtimeMs)
65383
+ };
65384
+ if (!info3.metadata) {
65385
+ if (!this.transport.capabilities?.conditionalPut)
65386
+ this.unsupported("conditional directory marker creation", path);
65387
+ await this.call("utimes", path, options, () => this.transport.putObject({
65388
+ Bucket: this.bucket,
65389
+ Key: key,
65390
+ Body: new Uint8Array(),
65391
+ Metadata: metadata,
65392
+ IfNoneMatch: "*"
65393
+ }, this.requestOptions(options)));
65394
+ return;
65395
+ }
65396
+ if (!this.transport.capabilities?.conditionalCopy) {
65397
+ const current = await this.call("getObject", path, options, () => this.transport.getObject({
65398
+ Bucket: this.bucket,
65399
+ Key: key
65400
+ }, this.requestOptions(options)));
65401
+ const body = await this.body(current, path, options);
65402
+ await this.call("utimes", path, options, () => this.transport.putObject({
65403
+ Bucket: this.bucket,
65404
+ Key: key,
65405
+ Body: body,
65406
+ IfMatch: this.etag(current, path),
65407
+ Metadata: { ...current.Metadata, "virtual-bash-atime": String(atimeMs), "virtual-bash-mtime": String(mtimeMs) }
65408
+ }, this.requestOptions(options)));
65409
+ return;
65410
+ }
65411
+ if (info3.stat.size > 5e9)
65412
+ this.unsupported("multipart metadata copy", path);
65413
+ const etag = this.etag(info3.metadata, path);
65414
+ const result = await this.call("utimes", path, options, () => this.transport.copyObject({
65415
+ Bucket: this.bucket,
65416
+ Key: key,
65417
+ CopySource: encodeCopySource(this.bucket, key),
65418
+ CopySourceIfMatch: etag,
65419
+ IfMatch: etag,
65420
+ MetadataDirective: "REPLACE",
65421
+ Metadata: metadata
65422
+ }, this.requestOptions(options)));
65423
+ if (!result.CopyObjectResult?.ETag)
65424
+ fail2("EIO", "utimes", path, "transport did not confirm a completed metadata copy");
65425
+ }
65426
+ async truncate(input, length = 0, options = {}) {
65427
+ const path = this.path(input);
65428
+ this.writable(path);
65429
+ validateLimit(length, "length", 0);
65430
+ const info3 = await this.lookup(path, options);
65431
+ this.requireDirectorySuffix(input, info3);
65432
+ if (!info3)
65433
+ fail2("ENOENT", "truncate", path);
65434
+ if (info3.stat.type === "directory")
65435
+ fail2("EISDIR", "truncate", path);
65436
+ if (!this.transport.capabilities?.conditionalPut)
65437
+ this.unsupported("conditional truncate", path);
65438
+ if (length > this.maxReadBytes)
65439
+ fail2("EFBIG", "truncate", path);
65440
+ let current = info3.metadata;
65441
+ const body = new Uint8Array(length);
65442
+ if (length !== 0 && info3.stat.size !== 0) {
65443
+ if (this.readStream) {
65444
+ const previous = await this.call("truncate", path, options, () => collectBytes(this.readStream(input, { ...options, endExclusive: Math.min(length, info3.stat.size) }), { ...options, maxBytes: length }));
65445
+ body.set(previous);
65446
+ } else {
65447
+ const output = await this.get(path, options);
65448
+ const previous = await this.body(output, path, options);
65449
+ current = output;
65450
+ body.set(previous.subarray(0, length));
65451
+ }
65452
+ }
65453
+ const metadata = { ...current.Metadata };
65454
+ delete metadata["virtual-bash-mtime"];
65455
+ await this.call("truncate", path, options, () => this.transport.putObject({
65456
+ Bucket: this.bucket,
65457
+ Key: this.key(path),
65458
+ Body: body,
65459
+ IfMatch: this.etag(current, path),
65460
+ Metadata: metadata
65461
+ }, this.requestOptions(options)));
65462
+ }
65463
+ async *streamRead(input, options = {}) {
65464
+ const path = this.path(input);
65465
+ const start = validateLimit(options.start ?? 0, "start", 0);
65466
+ const end = options.endExclusive === void 0 ? void 0 : validateLimit(options.endExclusive, "endExclusive", start);
65467
+ const chunkSize2 = validateLimit(options.chunkSize ?? 64 * 1024, "chunkSize", 1);
65468
+ const info3 = await this.lookup(path, options);
65469
+ this.requireDirectorySuffix(input, info3);
65470
+ if (!info3)
65471
+ fail2("ENOENT", "readStream", path);
65472
+ if (info3.stat.type === "directory")
65473
+ fail2("EISDIR", "readStream", path);
65474
+ const stop = Math.min(end ?? info3.stat.size, info3.stat.size);
65475
+ const expected = Math.max(0, stop - start);
65476
+ if (expected > this.maxStreamBytes)
65477
+ fail2("EFBIG", "readStream", path);
65478
+ if (expected === 0 && info3.stat.size !== 0)
65479
+ return;
65480
+ let count = 0;
65481
+ let finished = false;
65482
+ const controller = new AbortController();
65483
+ const signalScope = options.signal ? composeAbortSignals([options.signal, controller.signal]) : void 0;
65484
+ const signal = signalScope?.signal ?? controller.signal;
65485
+ let output;
65486
+ let iterator;
65487
+ try {
65488
+ output = await this.call("getObject", path, options, () => this.transport.getObjectStream({
65489
+ Bucket: this.bucket,
65490
+ Key: this.key(path),
65491
+ IfMatch: this.etag(info3.metadata, path),
65492
+ ...expected === 0 || start === 0 && stop === info3.stat.size ? {} : { Range: `bytes=${start}-${stop - 1}` }
65493
+ }, { abortSignal: signal }));
65494
+ if (output.ETag !== void 0 && output.ETag !== info3.metadata?.ETag)
65495
+ fail2("EIO", "readStream", path, "response ETag differs from requested snapshot");
65496
+ if (output.ContentLength !== void 0 && output.ContentLength !== expected)
65497
+ fail2("EIO", "readStream", path, "response length differs from requested snapshot");
65498
+ iterator = readBytes(output.Body, signal)[Symbol.asyncIterator]();
65499
+ while (true) {
65500
+ const result = await iterator.next();
65501
+ if (result.done)
65502
+ break;
65503
+ const chunk = result.value;
65504
+ if (chunk.length > expected - count)
65505
+ fail2("EIO", "readStream", path, "response exceeds requested length");
65506
+ count += chunk.length;
65507
+ for (let offset = 0; offset < chunk.length; offset += chunkSize2) {
65508
+ this.checkAbort(options, "readStream", path);
65509
+ yield new Uint8Array(chunk.subarray(offset, offset + chunkSize2));
65510
+ }
65511
+ }
65512
+ if (count !== expected)
65513
+ fail2("EIO", "readStream", path, "incomplete response body");
65514
+ finished = true;
65515
+ } catch (error) {
65516
+ this.checkAbort(options, "readStream", path);
65517
+ throw translate(error, "readStream", path);
65518
+ } finally {
65519
+ controller.abort();
65520
+ signalScope?.dispose();
65521
+ if (!finished && output) {
65522
+ this.dispose(iterator);
65523
+ this.dispose(output.Body, iterator === void 0);
65524
+ }
65525
+ }
65526
+ }
65527
+ dispose(body, returnIterator = true) {
65528
+ const disposable = body;
65529
+ try {
65530
+ const result = typeof disposable?.destroy === "function" ? disposable.destroy() : typeof disposable?.cancel === "function" ? disposable.cancel() : returnIterator ? disposable?.return?.() : void 0;
65531
+ void Promise.resolve(result).catch(() => {
65532
+ });
65533
+ } catch (ignoredError) {
65534
+ void ignoredError;
65535
+ }
65536
+ }
65537
+ async streamWrite(input, source, options = {}) {
65538
+ const path = this.path(input);
65539
+ this.writable(path, options.mode);
65540
+ const flag = options.flag ?? "w";
65541
+ if (!["w", "wx", "a", "ax"].includes(flag))
65542
+ fail2("EINVAL", "writeStream", path);
65543
+ if (flag !== "w" && !this.transport.capabilities?.conditionalPut)
65544
+ this.unsupported("conditional writes", path);
65545
+ const info3 = await this.lookup(path, options);
65546
+ this.requireDirectorySuffix(input, info3);
65547
+ if (info3?.stat.type === "directory" || input.endsWith("/"))
65548
+ fail2("EISDIR", "writeStream", path);
65549
+ const exclusive = flag === "wx" || flag === "ax";
65550
+ if (exclusive && info3)
65551
+ fail2("EEXIST", "writeStream", path);
65552
+ if (flag === "a") {
65553
+ const current = info3 ? await this.get(path, options) : void 0;
65554
+ const previous = current ? await this.body(current, path, options) : new Uint8Array();
65555
+ const limit = Math.min(this.maxReadBytes, this.maxStreamBytes);
65556
+ if (previous.length > limit)
65557
+ fail2("EFBIG", "writeStream", path);
65558
+ const bytes = await this.call("writeStream", path, options, () => collectBytes(source, { ...limit === Infinity ? {} : { maxBytes: limit - previous.length }, ...options }));
65559
+ const body2 = new Uint8Array(previous.length + bytes.length);
65560
+ body2.set(previous);
65561
+ body2.set(bytes, previous.length);
65562
+ const metadata = this.writeMetadata(current, options.mode);
65563
+ await this.call("putObject", path, options, () => this.transport.putObject({
65564
+ Bucket: this.bucket,
65565
+ Key: this.key(path),
65566
+ Body: body2,
65567
+ ...current ? { IfMatch: this.etag(current, path) } : { IfNoneMatch: "*" },
65568
+ ...metadata ? { Metadata: metadata } : {}
65569
+ }, this.requestOptions(options)));
65570
+ return;
65571
+ }
65572
+ const controller = new AbortController();
65573
+ const signalScope = options.signal ? composeAbortSignals([options.signal, controller.signal]) : void 0;
65574
+ const signal = signalScope?.signal ?? controller.signal;
65575
+ let finished = false;
65576
+ const body = (async function* () {
65577
+ let total = 0;
65578
+ for await (const chunk of readBytes(source, signal)) {
65579
+ if (chunk.length > this.maxStreamBytes - total)
65580
+ fail2("EFBIG", "writeStream", path);
65581
+ total += chunk.length;
65582
+ for (let offset = 0; offset < chunk.length; offset += 64 * 1024) {
65583
+ this.checkAbort({ signal }, "writeStream", path);
65584
+ yield new Uint8Array(chunk.subarray(offset, offset + 64 * 1024));
65585
+ }
65586
+ }
65587
+ finished = true;
65588
+ }).call(this);
65589
+ try {
65590
+ const metadata = this.writeMetadata(info3?.metadata, options.mode);
65591
+ await this.call("putObject", path, options, () => this.transport.putObjectStream({
65592
+ Bucket: this.bucket,
65593
+ Key: this.key(path),
65594
+ Body: body,
65595
+ ...exclusive ? { IfNoneMatch: "*" } : {},
65596
+ ...metadata === void 0 ? {} : { Metadata: metadata }
65597
+ }, { abortSignal: signal }), exclusive ? "EEXIST" : "EAGAIN");
65598
+ if (!finished)
65599
+ fail2("EIO", "writeStream", path, "transport completed without consuming the request body");
65600
+ } finally {
65601
+ controller.abort();
65602
+ signalScope?.dispose();
65603
+ this.dispose(body);
65604
+ }
65605
+ }
65606
+ };
65607
+ var s3Comparison = S3FileSystem.prototype.compareEntry;
65608
+
64204
65609
  // src/sharp.ts
64205
65610
  function inferTypedArrayDepth(input) {
64206
65611
  if (!input || !ArrayBuffer.isView(input)) return void 0;