@poe-platform/safe-bash 0.1.813 → 0.1.814

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (516) hide show
  1. package/dist/image-ast/index.js +1 -1
  2. package/dist/mp4-ast/index.d.ts +2 -0
  3. package/dist/mp4-ast/mp4-sample-source.d.ts +52 -0
  4. package/dist/mp4-ast/mp4-source.d.ts +32 -0
  5. package/dist/office-xml/retained-xml-document.d.ts +6 -0
  6. package/dist/pdf-ast/content/evaluator.d.ts +4 -0
  7. package/dist/pdf-ast/cos/object-reader.d.ts +7 -0
  8. package/dist/pdf-ast/cos/value-parser.d.ts +1 -0
  9. package/dist/pdf-ast/edit/retained-form-appearances.d.ts +10 -0
  10. package/dist/pdf-ast/edit/retained-graph.d.ts +6 -0
  11. package/dist/pdf-ast/edit/retained-info-updates.d.ts +33 -0
  12. package/dist/pdf-ast/index.d.ts +1 -1
  13. package/dist/pdf-ast/index.js +460 -125
  14. package/dist/pdf-ast/retained-document.d.ts +5 -0
  15. package/dist/safe-bash/command-chunks/biff-KRHJ63K3-VQPJCVIL.js +5309 -0
  16. package/dist/safe-bash/command-chunks/{chunk-34G2SQX2.js → chunk-2BLTUQNK.js} +2 -2
  17. package/dist/safe-bash/command-chunks/{chunk-LLU2IQEJ.js → chunk-2BNGPR6Z.js} +2 -2
  18. package/dist/safe-bash/command-chunks/{chunk-IHSOOSNC.js → chunk-2ETEJOYX.js} +17 -17
  19. package/dist/safe-bash/command-chunks/{chunk-XIDGHIGB.js → chunk-2PKBXGXD.js} +5 -5
  20. package/dist/safe-bash/command-chunks/{chunk-6SRHWVEB.js → chunk-2VVJRVYM.js} +1 -1
  21. package/dist/safe-bash/command-chunks/{chunk-G5QVZQCO.js → chunk-3EASXF5D.js} +5 -5
  22. package/dist/safe-bash/command-chunks/{chunk-U3SBHEKH.js → chunk-3EB2FSAN.js} +9 -9
  23. package/dist/safe-bash/command-chunks/{chunk-VB2TUPO2.js → chunk-3EW7GYHM.js} +9 -9
  24. package/dist/safe-bash/command-chunks/{chunk-GVWVRPG6.js → chunk-3GRMU7TM.js} +6 -6
  25. package/dist/safe-bash/command-chunks/{chunk-63EMPQ7Z.js → chunk-3JM7E42I.js} +94 -12
  26. package/dist/safe-bash/command-chunks/{chunk-6L4IYQAT.js → chunk-3MG5EAMX.js} +4 -4
  27. package/dist/safe-bash/command-chunks/{chunk-RASQPOSV.js → chunk-3SPLP2DB.js} +1 -1
  28. package/dist/safe-bash/command-chunks/{chunk-K5COUQAQ.js → chunk-3VGQTLO6.js} +1 -1
  29. package/dist/safe-bash/command-chunks/{chunk-K7CV55K5.js → chunk-3YEQI5B7.js} +10 -10
  30. package/dist/safe-bash/command-chunks/{chunk-KCE5D4Z4.js → chunk-3ZRCL756.js} +3 -3
  31. package/dist/safe-bash/command-chunks/{chunk-SOFM3GPG.js → chunk-42MEXZBJ.js} +1 -1
  32. package/dist/safe-bash/command-chunks/{chunk-GQ2ZSPZ3.js → chunk-46AMTJPE.js} +10 -10
  33. package/dist/safe-bash/command-chunks/{chunk-MTWZEPAR.js → chunk-47IAU25U.js} +2 -2
  34. package/dist/safe-bash/command-chunks/{chunk-6GI3NTCW.js → chunk-4B2ZUGLT.js} +4 -4
  35. package/dist/safe-bash/command-chunks/{chunk-X64XGIXZ.js → chunk-4EHY6J2Z.js} +5 -5
  36. package/dist/safe-bash/command-chunks/{chunk-QQVACHZA.js → chunk-4EZJV4FZ.js} +1 -1
  37. package/dist/safe-bash/command-chunks/{chunk-SSKMPDN4.js → chunk-4GQKCUS5.js} +15 -15
  38. package/dist/safe-bash/command-chunks/{chunk-UOBW5K3M.js → chunk-4RRYWHED.js} +7 -7
  39. package/dist/safe-bash/command-chunks/{chunk-PINR7QET.js → chunk-4UPKVQWH.js} +8 -8
  40. package/dist/safe-bash/command-chunks/{chunk-I4GMCWAT.js → chunk-4YLACJHE.js} +6 -6
  41. package/dist/safe-bash/command-chunks/{chunk-PK36TVXB.js → chunk-5BIQWWLB.js} +1 -1
  42. package/dist/safe-bash/command-chunks/{chunk-P3WU3PSL.js → chunk-5L4YGRQU.js} +3 -3
  43. package/dist/safe-bash/command-chunks/{chunk-WPVBUVFK.js → chunk-5LFGXN3D.js} +6 -6
  44. package/dist/safe-bash/command-chunks/{chunk-YXD6VGVG.js → chunk-5OM3UIK3.js} +3 -3
  45. package/dist/safe-bash/command-chunks/{chunk-C5QDEB3I.js → chunk-6LPSKLLD.js} +3 -3
  46. package/dist/safe-bash/command-chunks/{chunk-XLYIVBAR.js → chunk-6QYSF7I2.js} +7 -7
  47. package/dist/safe-bash/command-chunks/{chunk-6IWE7PTK.js → chunk-6VBDJC6V.js} +6 -6
  48. package/dist/safe-bash/command-chunks/{chunk-6N5GHM72.js → chunk-6WNVGCXD.js} +8 -8
  49. package/dist/safe-bash/command-chunks/{chunk-PSCOXGCA.js → chunk-6XES7Z4G.js} +12 -12
  50. package/dist/safe-bash/command-chunks/{chunk-AFROLW6S.js → chunk-6XGDWFNQ.js} +4 -4
  51. package/dist/safe-bash/command-chunks/{chunk-WTE23QXN.js → chunk-6ZGCKUAM.js} +3 -3
  52. package/dist/safe-bash/command-chunks/{chunk-RIV6XN7K.js → chunk-7DOLY7IV.js} +2 -2
  53. package/dist/safe-bash/command-chunks/{chunk-ET2VPDUA.js → chunk-7KZ5LWV2.js} +1 -1
  54. package/dist/safe-bash/command-chunks/{chunk-NGR5KOPQ.js → chunk-A347DLRB.js} +3 -3
  55. package/dist/safe-bash/command-chunks/{chunk-ZM2Y4Z3C.js → chunk-A45UG4KT.js} +4 -4
  56. package/dist/safe-bash/command-chunks/{chunk-2Z3WRRFT.js → chunk-ADHFF2IM.js} +9 -9
  57. package/dist/safe-bash/command-chunks/{chunk-ATI464W3.js → chunk-AG2SNMP5.js} +1 -1
  58. package/dist/safe-bash/command-chunks/{chunk-HCKYUQ3L.js → chunk-AM5LANIE.js} +7 -7
  59. package/dist/safe-bash/command-chunks/{chunk-PKLJRB7W.js → chunk-AVGXFWEB.js} +48 -40
  60. package/dist/safe-bash/command-chunks/{chunk-RBTC7OFT.js → chunk-AVOGFREX.js} +5 -5
  61. package/dist/safe-bash/command-chunks/{chunk-G3RUXKVY.js → chunk-AWPI4DZR.js} +3 -3
  62. package/dist/safe-bash/command-chunks/{chunk-FYMNHG7R.js → chunk-AXXZNB7U.js} +13 -13
  63. package/dist/safe-bash/command-chunks/{chunk-2E2H7MBH.js → chunk-AY3KQ4EN.js} +7 -7
  64. package/dist/safe-bash/command-chunks/{chunk-DMCI6T6N.js → chunk-BLGGAHQW.js} +1 -1
  65. package/dist/safe-bash/command-chunks/{chunk-CU4DLVME.js → chunk-BLIFGBIO.js} +2 -2
  66. package/dist/safe-bash/command-chunks/{chunk-2V6FOLXV.js → chunk-BS3ZEQGT.js} +14 -14
  67. package/dist/safe-bash/command-chunks/{chunk-WFVSUXJL.js → chunk-BS5JEUEW.js} +8 -8
  68. package/dist/safe-bash/command-chunks/{chunk-X53AEG36.js → chunk-BZMNC7Q5.js} +7 -7
  69. package/dist/safe-bash/command-chunks/{chunk-5KGEZ3RW.js → chunk-CCMAHM3I.js} +2 -2
  70. package/dist/safe-bash/command-chunks/{chunk-3LJAXFH5.js → chunk-CIRDVCAZ.js} +7 -7
  71. package/dist/safe-bash/command-chunks/{chunk-73NYFNAS.js → chunk-CK2WFJZN.js} +5 -0
  72. package/dist/safe-bash/command-chunks/{chunk-UZL7G57V.js → chunk-CKEMZUE3.js} +7 -7
  73. package/dist/safe-bash/command-chunks/{chunk-S2N2V5U4.js → chunk-CQBACD2V.js} +2 -2
  74. package/dist/safe-bash/command-chunks/{chunk-G7NENPYV.js → chunk-CSE4VQKG.js} +12 -1
  75. package/dist/safe-bash/command-chunks/{chunk-X6RHJ6YN.js → chunk-CXME4YHU.js} +23 -0
  76. package/dist/safe-bash/command-chunks/{chunk-FTLDRH47.js → chunk-CZ5K2YPU.js} +16 -16
  77. package/dist/safe-bash/command-chunks/{chunk-7PRL6RJ6.js → chunk-DBLQUZGN.js} +2 -2
  78. package/dist/safe-bash/command-chunks/{chunk-5VQVZPP3.js → chunk-DBNJEXHK.js} +3 -3
  79. package/dist/safe-bash/command-chunks/{chunk-ZO5WBWLL.js → chunk-DN6MSXY7.js} +2 -2
  80. package/dist/safe-bash/command-chunks/{chunk-GXLXWZWH.js → chunk-DZH54L3F.js} +3 -3
  81. package/dist/safe-bash/command-chunks/{chunk-6CY5BHBS.js → chunk-EBHOZIBS.js} +6 -6
  82. package/dist/safe-bash/command-chunks/{chunk-3Y5EME26.js → chunk-ENEIE44W.js} +2 -2
  83. package/dist/safe-bash/command-chunks/{chunk-TKRLZIFI.js → chunk-EQWFKNHJ.js} +17 -17
  84. package/dist/safe-bash/command-chunks/{chunk-YV72XQKL.js → chunk-ETXPMVR6.js} +13 -13
  85. package/dist/safe-bash/command-chunks/{chunk-4Z6W5EOC.js → chunk-EV5G535P.js} +8 -8
  86. package/dist/safe-bash/command-chunks/{chunk-PZMU3Z4L.js → chunk-EVYKV3QI.js} +5 -5
  87. package/dist/safe-bash/command-chunks/{chunk-D6UMSC45.js → chunk-F4YFTO2K.js} +11 -11
  88. package/dist/safe-bash/command-chunks/{chunk-QM2HZJSJ.js → chunk-F762XDNG.js} +3 -3
  89. package/dist/safe-bash/command-chunks/{chunk-GOBUDKZ3.js → chunk-FF7UGJWS.js} +4 -4
  90. package/dist/safe-bash/command-chunks/{chunk-SGPCXAG7.js → chunk-FOONI6BD.js} +7 -7
  91. package/dist/safe-bash/command-chunks/{chunk-DYLNU57U.js → chunk-FSVJ67G5.js} +1 -1
  92. package/dist/safe-bash/command-chunks/{chunk-CLKOGAR3.js → chunk-FSYMSWJU.js} +8 -8
  93. package/dist/safe-bash/command-chunks/{chunk-FWPVQGYK.js → chunk-FUQMEUAT.js} +6 -6
  94. package/dist/safe-bash/command-chunks/{chunk-KXPCSVAT.js → chunk-FXCSPPYE.js} +20 -20
  95. package/dist/safe-bash/command-chunks/{chunk-7QZ2HP2F.js → chunk-FYYFV6PW.js} +6 -6
  96. package/dist/safe-bash/command-chunks/{chunk-3OETVNJA.js → chunk-G2COZLXX.js} +9 -9
  97. package/dist/safe-bash/command-chunks/{chunk-T6C5QP7T.js → chunk-G3TAX3CV.js} +5963 -5953
  98. package/dist/safe-bash/command-chunks/{chunk-MKX4JAZ6.js → chunk-GCHB7VNX.js} +17 -17
  99. package/dist/safe-bash/command-chunks/{chunk-4Y6O2K35.js → chunk-GLAF45M7.js} +1 -1
  100. package/dist/safe-bash/command-chunks/{chunk-7UC2Q6Z6.js → chunk-GQGMQMIM.js} +5 -5
  101. package/dist/safe-bash/command-chunks/{chunk-PI6MOMHA.js → chunk-GXMPXMDP.js} +11 -11
  102. package/dist/safe-bash/command-chunks/{chunk-57DDYKE5.js → chunk-GYM5ICK4.js} +7 -7
  103. package/dist/safe-bash/command-chunks/{chunk-5MFDRSGG.js → chunk-H33D4R26.js} +4 -4
  104. package/dist/safe-bash/command-chunks/{chunk-3ZDANXIC.js → chunk-HELAVGZH.js} +3 -3
  105. package/dist/safe-bash/command-chunks/{chunk-S4QH5BXZ.js → chunk-HGIMFVI2.js} +4 -4
  106. package/dist/safe-bash/command-chunks/{chunk-35IPOBWL.js → chunk-HI6ZYH3W.js} +10 -10
  107. package/dist/safe-bash/command-chunks/{chunk-RGOQKIG6.js → chunk-HK6MSB7Z.js} +5 -5
  108. package/dist/safe-bash/command-chunks/{chunk-7ZE3VIAN.js → chunk-IB5QP4LF.js} +2 -2
  109. package/dist/safe-bash/command-chunks/{chunk-UCR5YDV3.js → chunk-IBYMPAUW.js} +1 -1
  110. package/dist/safe-bash/command-chunks/{chunk-LABOWPFB.js → chunk-IHXZMAMY.js} +9 -9
  111. package/dist/safe-bash/command-chunks/{chunk-PVGZMLC6.js → chunk-IWHNRYER.js} +3 -3
  112. package/dist/safe-bash/command-chunks/{chunk-PPO7YUZF.js → chunk-JGKSWDGP.js} +1 -1
  113. package/dist/safe-bash/command-chunks/{chunk-GKILM4HZ.js → chunk-JR3Q6QNL.js} +7 -7
  114. package/dist/safe-bash/command-chunks/{chunk-D55REQA3.js → chunk-JUHOL5KB.js} +1 -1
  115. package/dist/safe-bash/command-chunks/{chunk-3O2YEI47.js → chunk-JVKE7YZN.js} +3 -3
  116. package/dist/safe-bash/command-chunks/{chunk-6NATRKUJ.js → chunk-JW6WVNTM.js} +1 -1
  117. package/dist/safe-bash/command-chunks/{chunk-IK6K2HCG.js → chunk-JWORWL72.js} +1 -1
  118. package/dist/safe-bash/command-chunks/{chunk-N32GSM3J.js → chunk-K2WOMJOQ.js} +1 -1
  119. package/dist/safe-bash/command-chunks/{chunk-TQEB4DH4.js → chunk-K4XNUJVJ.js} +1 -1
  120. package/dist/safe-bash/command-chunks/{chunk-HKOMXGJS.js → chunk-KBAQHE5Y.js} +2 -2
  121. package/dist/safe-bash/command-chunks/{chunk-T3E5RV3U.js → chunk-KCLJGRU7.js} +12 -12
  122. package/dist/safe-bash/command-chunks/{chunk-TUDFMNPP.js → chunk-KINIV2SV.js} +1 -1
  123. package/dist/safe-bash/command-chunks/{chunk-43TRBJ2N.js → chunk-KPHLESD4.js} +4 -4
  124. package/dist/safe-bash/command-chunks/{chunk-C5KLFZGT.js → chunk-KSBNZTAZ.js} +6 -6
  125. package/dist/safe-bash/command-chunks/{chunk-4Y34ZG4T.js → chunk-KUOCGGEU.js} +11 -11
  126. package/dist/safe-bash/command-chunks/{chunk-ML5R5JML.js → chunk-KY4LCHUF.js} +1 -1
  127. package/dist/safe-bash/command-chunks/{chunk-7NXTEWPR.js → chunk-LAPOMHGY.js} +132 -195
  128. package/dist/safe-bash/command-chunks/{chunk-KBUBSMCQ.js → chunk-LDW3RF7Y.js} +12 -12
  129. package/dist/safe-bash/command-chunks/{chunk-U27XPNLP.js → chunk-LEO4VRIN.js} +2 -2
  130. package/dist/safe-bash/command-chunks/{chunk-GZ3VIWNN.js → chunk-LKGTH2Q7.js} +7 -7
  131. package/dist/safe-bash/command-chunks/{chunk-TODWFDYB.js → chunk-LNTEV56A.js} +2 -2
  132. package/dist/safe-bash/command-chunks/{chunk-DVGXLBUW.js → chunk-LZ2JFMKT.js} +10 -10
  133. package/dist/safe-bash/command-chunks/{chunk-6D2BMAF4.js → chunk-MEM2ZPMI.js} +2 -2
  134. package/dist/safe-bash/command-chunks/{chunk-GNXTMSYN.js → chunk-MGMTRGKM.js} +4 -4
  135. package/dist/safe-bash/command-chunks/{chunk-B3NLITWP.js → chunk-MKK6FM5H.js} +7 -7
  136. package/dist/safe-bash/command-chunks/{chunk-BK7ISUJL.js → chunk-MKOIPOXX.js} +3 -3
  137. package/dist/safe-bash/command-chunks/chunk-MLOYUXUV.js +244 -0
  138. package/dist/safe-bash/command-chunks/{chunk-CBNKHBLD.js → chunk-MNK3DDH6.js} +2 -2
  139. package/dist/safe-bash/command-chunks/{chunk-JVGUVHWI.js → chunk-MPXMRTMY.js} +10 -10
  140. package/dist/safe-bash/command-chunks/{chunk-EJTNVXWF.js → chunk-MVLVIMJ6.js} +6 -6
  141. package/dist/safe-bash/command-chunks/{chunk-TY4WDAHM.js → chunk-MYZ46FQL.js} +1 -1
  142. package/dist/safe-bash/command-chunks/{chunk-TBAIMDGL.js → chunk-N4MUBJCT.js} +1 -1
  143. package/dist/safe-bash/command-chunks/{chunk-NPLVFAD6.js → chunk-N6G3345Q.js} +8 -8
  144. package/dist/safe-bash/command-chunks/{chunk-4PBNMKAT.js → chunk-NEMUPUUB.js} +7 -7
  145. package/dist/safe-bash/command-chunks/{chunk-MUUWBZIC.js → chunk-NEVQWOU6.js} +10 -10
  146. package/dist/safe-bash/command-chunks/{chunk-KZ5ODST6.js → chunk-NFGCBQN3.js} +2 -2
  147. package/dist/safe-bash/command-chunks/{chunk-LD7BONZY.js → chunk-NFII726L.js} +2 -2
  148. package/dist/safe-bash/command-chunks/{chunk-JQPNA77Y.js → chunk-NHNZYWPW.js} +2 -2
  149. package/dist/safe-bash/command-chunks/{chunk-ZYLGNIGA.js → chunk-NQINS4XY.js} +1 -1
  150. package/dist/safe-bash/command-chunks/{chunk-UAF4IX5H.js → chunk-NRFTYZ2R.js} +6 -6
  151. package/dist/safe-bash/command-chunks/{chunk-THMZLJQD.js → chunk-NYFYTL5G.js} +18 -18
  152. package/dist/safe-bash/command-chunks/{chunk-SMSGLRIH.js → chunk-OTF2AJ5M.js} +6 -6
  153. package/dist/safe-bash/command-chunks/{chunk-NPFHUS4X.js → chunk-OVQP6KH5.js} +6 -6
  154. package/dist/safe-bash/command-chunks/{chunk-QFF5KBOM.js → chunk-P2LT6TGR.js} +9 -9
  155. package/dist/safe-bash/command-chunks/{chunk-RLCQ7BN3.js → chunk-PIVH35EQ.js} +3 -3
  156. package/dist/safe-bash/command-chunks/{chunk-BEHUSUOY.js → chunk-PLMF35XK.js} +4 -4
  157. package/dist/safe-bash/command-chunks/{chunk-PXWS3Q7L.js → chunk-PLR5IULU.js} +5 -5
  158. package/dist/safe-bash/command-chunks/{chunk-DBLHCJJU.js → chunk-PS5GDFIP.js} +2 -2
  159. package/dist/safe-bash/command-chunks/{chunk-P7EL2FWW.js → chunk-Q5PWYPQV.js} +7 -7
  160. package/dist/safe-bash/command-chunks/{chunk-AJI55RS7.js → chunk-Q7TVCBU2.js} +1 -1
  161. package/dist/safe-bash/command-chunks/{chunk-EHTOHOTR.js → chunk-QB72X7FF.js} +9 -9
  162. package/dist/safe-bash/command-chunks/{chunk-F3GP3EXE.js → chunk-RGDOYWOD.js} +2 -2
  163. package/dist/safe-bash/command-chunks/{chunk-MNHBQBF6.js → chunk-RHDERFMR.js} +5 -5
  164. package/dist/safe-bash/command-chunks/{chunk-3KMOXEGH.js → chunk-RHU44OMN.js} +2 -2
  165. package/dist/safe-bash/command-chunks/{chunk-XG6UWQV5.js → chunk-RIVKF77R.js} +6 -6
  166. package/dist/safe-bash/command-chunks/{chunk-UOR6PXZZ.js → chunk-ROL5AEX6.js} +1 -1
  167. package/dist/safe-bash/command-chunks/{chunk-3TYDSGAH.js → chunk-RQYPFLZJ.js} +6 -6
  168. package/dist/safe-bash/command-chunks/{chunk-3Y4XZB24.js → chunk-RTNI47C5.js} +4 -4
  169. package/dist/safe-bash/command-chunks/{chunk-W5LLKV5H.js → chunk-RV5AGXOV.js} +2 -2
  170. package/dist/safe-bash/command-chunks/{chunk-JUJHYPYL.js → chunk-RXQ2G2YK.js} +9 -9
  171. package/dist/safe-bash/command-chunks/{chunk-EVU7FLDA.js → chunk-S2QNBAN6.js} +7 -7
  172. package/dist/safe-bash/command-chunks/{chunk-YE6OAKK7.js → chunk-S43QRKDC.js} +7 -7
  173. package/dist/safe-bash/command-chunks/{chunk-774GLJAO.js → chunk-S7HIOT7Z.js} +4 -4
  174. package/dist/safe-bash/command-chunks/{chunk-3D24WDND.js → chunk-SEPUP6TZ.js} +1 -1
  175. package/dist/safe-bash/command-chunks/{chunk-JPMYPOYZ.js → chunk-SUTHGUD3.js} +28 -28
  176. package/dist/safe-bash/command-chunks/{chunk-CTDC4LJT.js → chunk-SW37YCBW.js} +15 -10
  177. package/dist/safe-bash/command-chunks/{chunk-D6WJY6QO.js → chunk-SWAKALDJ.js} +10 -10
  178. package/dist/safe-bash/command-chunks/{chunk-WGH3RLJY.js → chunk-T5S4SJGO.js} +9 -9
  179. package/dist/safe-bash/command-chunks/{chunk-7JEIWA3A.js → chunk-TID5TSQW.js} +5 -5
  180. package/dist/safe-bash/command-chunks/{chunk-EZ4NQIPL.js → chunk-TJLXSENN.js} +1 -1
  181. package/dist/safe-bash/command-chunks/{chunk-HVW53ARH.js → chunk-TKCUGMRZ.js} +24 -20
  182. package/dist/safe-bash/command-chunks/{chunk-5P6I2T63.js → chunk-TXPDKEGY.js} +8 -8
  183. package/dist/safe-bash/command-chunks/{chunk-MPKY37QR.js → chunk-UJERQEJB.js} +1 -1
  184. package/dist/safe-bash/command-chunks/{chunk-V37D6AHO.js → chunk-USGZN2KE.js} +5 -5
  185. package/dist/safe-bash/command-chunks/{chunk-JAHJWVGF.js → chunk-UYGQEQIP.js} +5 -5
  186. package/dist/safe-bash/command-chunks/{chunk-MPORWUTU.js → chunk-V5XC43BX.js} +8 -8
  187. package/dist/safe-bash/command-chunks/{chunk-AIMSZBWP.js → chunk-V7E3PZOK.js} +9 -9
  188. package/dist/safe-bash/command-chunks/{chunk-CNHRVUHA.js → chunk-VDTFVRYX.js} +1 -1
  189. package/dist/safe-bash/command-chunks/{chunk-M3Z5PU2M.js → chunk-VT2PHQ63.js} +15 -15
  190. package/dist/safe-bash/command-chunks/{chunk-JORIVUPM.js → chunk-VT7UBPAE.js} +15 -8
  191. package/dist/safe-bash/command-chunks/{chunk-QDVI2YB6.js → chunk-VUWXLH3E.js} +2 -2
  192. package/dist/safe-bash/command-chunks/{chunk-O675URF4.js → chunk-W3ZSWK76.js} +8 -8
  193. package/dist/safe-bash/command-chunks/{chunk-JPA2PUYI.js → chunk-WBKB7HBZ.js} +8 -8
  194. package/dist/safe-bash/command-chunks/{chunk-6244HYJY.js → chunk-WJ2ERUCQ.js} +1 -1
  195. package/dist/safe-bash/command-chunks/{chunk-U5TWQFZY.js → chunk-WTVJLHMG.js} +1 -1
  196. package/dist/safe-bash/command-chunks/{chunk-SLQWQKXP.js → chunk-WWHMI4S3.js} +9 -9
  197. package/dist/safe-bash/command-chunks/{chunk-2UBZALAK.js → chunk-WYZG3DRR.js} +1 -1
  198. package/dist/safe-bash/command-chunks/{chunk-T5ERNELL.js → chunk-WZRFS5OY.js} +4 -4
  199. package/dist/safe-bash/command-chunks/{chunk-2DGJOOXM.js → chunk-X6OHFKBL.js} +8 -8
  200. package/dist/safe-bash/command-chunks/{chunk-S6ZTBXYO.js → chunk-XKAUKLF7.js} +13 -13
  201. package/dist/safe-bash/command-chunks/{chunk-NKTULXVD.js → chunk-XM5QJCPD.js} +8 -8
  202. package/dist/safe-bash/command-chunks/{chunk-BBAB7LC4.js → chunk-XMTR7QGL.js} +4 -4
  203. package/dist/safe-bash/command-chunks/{chunk-5IFRAI7Y.js → chunk-XNGM3W5R.js} +1 -1
  204. package/dist/safe-bash/command-chunks/{chunk-Z5BIM5B7.js → chunk-XTEIT5CI.js} +1 -1
  205. package/dist/safe-bash/command-chunks/{chunk-4DLIUTQV.js → chunk-XU6S3XUZ.js} +11 -11
  206. package/dist/safe-bash/command-chunks/{chunk-EXOQGXEU.js → chunk-XUJAQA3S.js} +30 -30
  207. package/dist/safe-bash/command-chunks/{chunk-VVWXY6IA.js → chunk-Y42KSX63.js} +6 -6
  208. package/dist/safe-bash/command-chunks/{chunk-R2BMZAHG.js → chunk-Y54L4P4J.js} +5 -5
  209. package/dist/safe-bash/command-chunks/{chunk-6WQD7LRA.js → chunk-YAD7EV4N.js} +14 -14
  210. package/dist/safe-bash/command-chunks/{chunk-YUXTK3XA.js → chunk-YRPXBGRX.js} +3 -3
  211. package/dist/safe-bash/command-chunks/{chunk-NMPED6L5.js → chunk-Z2WNYEPD.js} +4 -4
  212. package/dist/safe-bash/command-chunks/{chunk-7PZHWMK6.js → chunk-Z7QOSXQC.js} +7 -7
  213. package/dist/safe-bash/command-chunks/{chunk-VQOINPVF.js → chunk-ZQM37BGE.js} +2 -2
  214. package/dist/safe-bash/command-chunks/{chunk-W3HV45CI.js → chunk-ZSQZHFWS.js} +9 -9
  215. package/dist/safe-bash/command-chunks/{chunk-IDJQP3A6.js → chunk-ZTMZO4IT.js} +1 -1
  216. package/dist/safe-bash/command-chunks/{chunk-V6XBEYPC.js → chunk-ZU2KJMXO.js} +8 -8
  217. package/dist/safe-bash/command-chunks/{chunk-YXKNJ6EM.js → chunk-ZXELXF2H.js} +5 -5
  218. package/dist/safe-bash/command-chunks/{clipboard-BBDK33GP-VB22F7GI.js → clipboard-BBDK33GP-QZ4ERNQX.js} +2 -2
  219. package/dist/safe-bash/command-chunks/{command-engine-X3OLN7N6.js → command-engine-7V6PZR7G.js} +931 -680
  220. package/dist/safe-bash/command-chunks/{engine-XUCIFZ7V-LJFGZM6O.js → engine-UYJENSWK-VSCGKSQV.js} +1 -1
  221. package/dist/safe-bash/command-chunks/{gnumeric-UJPXWBVR-YPXTNEDZ.js → gnumeric-UJPXWBVR-7VOHQAPM.js} +2 -2
  222. package/dist/safe-bash/command-chunks/{model-store-E7BHBFJC.js → model-store-UB5DWMAP.js} +24 -24
  223. package/dist/safe-bash-command-awk/awk-runtime.js +3 -3
  224. package/dist/safe-bash-command-awk/awk.js +4 -4
  225. package/dist/safe-bash-command-awk/index.js +4 -4
  226. package/dist/safe-bash-command-diff/diff.js +2 -2
  227. package/dist/safe-bash-command-diff/index.js +3 -3
  228. package/dist/safe-bash-command-diff/sync.js +2 -2
  229. package/dist/safe-bash-command-du/du.js +2 -2
  230. package/dist/safe-bash-command-du/index.js +2 -2
  231. package/dist/safe-bash-command-ffmpeg/index.js +1 -1
  232. package/dist/safe-bash-command-ffprobe/index.js +2 -2
  233. package/dist/safe-bash-command-ffprobe/media.js +2 -2
  234. package/dist/safe-bash-command-html-to-markdown/index.js +3 -234
  235. package/dist/safe-bash-command-html-to-markdown/stored-text.d.ts +50 -0
  236. package/dist/safe-bash-command-html-to-markdown/stored-text.js +12 -0
  237. package/dist/safe-bash-command-htmlq/contracts.d.ts +5 -0
  238. package/dist/safe-bash-command-htmlq/index.js +1715 -292
  239. package/dist/safe-bash-command-htmlq/selectors.d.ts +38 -1
  240. package/dist/safe-bash-command-htmlq/serializer.d.ts +1 -0
  241. package/dist/safe-bash-command-htmlq/tree.d.ts +1 -0
  242. package/dist/safe-bash-command-iconv/command.js +2 -2
  243. package/dist/safe-bash-command-iconv/index.js +2 -2
  244. package/dist/safe-bash-command-llm/command.js +3 -3
  245. package/dist/safe-bash-command-llm/index.js +9 -9
  246. package/dist/safe-bash-command-llm/openai.js +2 -2
  247. package/dist/safe-bash-command-llm/providers/index.js +2 -2
  248. package/dist/safe-bash-command-llm/providers/openai.js +2 -2
  249. package/dist/safe-bash-command-node/commands/node/browser.js +2 -2
  250. package/dist/safe-bash-command-node/commands/node/default-runtime.js +2 -2
  251. package/dist/safe-bash-command-node/commands/node/safejs.js +2 -2
  252. package/dist/safe-bash-command-pandoc/command.js +4 -4
  253. package/dist/safe-bash-command-pandoc/index.js +39 -39
  254. package/dist/safe-bash-command-patch/index.js +6 -6
  255. package/dist/safe-bash-command-patch/patch-formats.d.ts +6 -1
  256. package/dist/safe-bash-command-patch/patch-formats.js +6 -4
  257. package/dist/safe-bash-command-patch/patch-gnu-paths.d.ts +7 -7
  258. package/dist/safe-bash-command-patch/patch-gnu-reject.d.ts +2 -2
  259. package/dist/safe-bash-command-patch/patch-gnu-reject.js +2 -2
  260. package/dist/safe-bash-command-patch/patch-publication.js +2 -2
  261. package/dist/safe-bash-command-patch/patch.js +6 -6
  262. package/dist/safe-bash-command-patch/stored-patch.d.ts +26 -0
  263. package/dist/safe-bash-command-patch/stored-target.d.ts +40 -0
  264. package/dist/safe-bash-command-patch/unified.d.ts +13 -8
  265. package/dist/safe-bash-command-patch/unified.js +3 -1
  266. package/dist/safe-bash-command-pdftk/index.js +741 -426
  267. package/dist/safe-bash-command-playwright-cli/index.js +26 -26
  268. package/dist/safe-bash-command-playwright-cli/playwright/abilities.js +10 -10
  269. package/dist/safe-bash-command-playwright-cli/playwright/controller.js +14 -14
  270. package/dist/safe-bash-command-playwright-cli/playwright/index.js +23 -23
  271. package/dist/safe-bash-command-playwright-cli/playwright/snapshot.js +2 -2
  272. package/dist/safe-bash-command-playwright-cli/playwright/standard-capabilities.js +6 -6
  273. package/dist/safe-bash-command-playwright-cli/playwright/storage-capabilities.js +4 -4
  274. package/dist/safe-bash-command-pptx/command-engine.d.ts +2 -1
  275. package/dist/safe-bash-command-pptx/engine.js +1 -1
  276. package/dist/safe-bash-command-pptx/index.d.ts +1 -1
  277. package/dist/safe-bash-command-pptx/index.js +163 -17
  278. package/dist/safe-bash-command-pptx/streaming-inputs.d.ts +7 -2
  279. package/dist/safe-bash-command-python/executor.js +5 -5
  280. package/dist/safe-bash-command-python/index.js +5 -5
  281. package/dist/safe-bash-command-python/jspi.js +2 -2
  282. package/dist/safe-bash-command-soffice/index.js +1 -1
  283. package/dist/safe-bash-command-sort/index.js +3 -3
  284. package/dist/safe-bash-command-ssconvert/index.js +2 -2
  285. package/dist/safe-bash-command-tar/create.js +2 -2
  286. package/dist/safe-bash-command-tar/extract.js +2 -2
  287. package/dist/safe-bash-command-tar/index.js +8 -8
  288. package/dist/safe-bash-command-tar/modes.js +4 -4
  289. package/dist/safe-bash-command-timeout/index.js +3 -3
  290. package/dist/safe-bash-command-tree/index.js +2 -2
  291. package/dist/safe-bash-command-tree/tree.js +2 -2
  292. package/dist/safe-bash-command-xz/index.js +5 -5
  293. package/dist/safe-bash-compression-engine/files.js +2 -2
  294. package/dist/safe-bash-compression-engine/operand.js +4 -4
  295. package/dist/safe-bash-contracts/diagnostics.js +3 -3
  296. package/dist/safe-bash-contracts/escaping.js +10 -10
  297. package/dist/safe-bash-contracts/filesystem-descriptor.js +1 -1
  298. package/dist/safe-bash-contracts/filesystem-output.js +6 -6
  299. package/dist/safe-bash-contracts/index.js +33 -33
  300. package/dist/safe-bash-contracts/io.js +2 -2
  301. package/dist/safe-bash-contracts/output.js +3 -3
  302. package/dist/safe-bash-docx-engine/ancillary-resources.js +5 -5
  303. package/dist/safe-bash-docx-engine/batch-operations.js +63 -63
  304. package/dist/safe-bash-docx-engine/batch-result-schema.js +74 -74
  305. package/dist/safe-bash-docx-engine/batch.js +74 -74
  306. package/dist/safe-bash-docx-engine/bookmarks.js +13 -13
  307. package/dist/safe-bash-docx-engine/charts.js +6 -6
  308. package/dist/safe-bash-docx-engine/command-option-rules.js +3 -3
  309. package/dist/safe-bash-docx-engine/comments.js +21 -21
  310. package/dist/safe-bash-docx-engine/control-bindings.js +16 -16
  311. package/dist/safe-bash-docx-engine/control-repeat.js +16 -16
  312. package/dist/safe-bash-docx-engine/controls.js +14 -14
  313. package/dist/safe-bash-docx-engine/create.js +8 -8
  314. package/dist/safe-bash-docx-engine/diagrams.js +6 -6
  315. package/dist/safe-bash-docx-engine/diff.js +8 -8
  316. package/dist/safe-bash-docx-engine/document-properties.js +12 -12
  317. package/dist/safe-bash-docx-engine/equations.js +12 -12
  318. package/dist/safe-bash-docx-engine/extract.js +9 -9
  319. package/dist/safe-bash-docx-engine/fields.js +18 -18
  320. package/dist/safe-bash-docx-engine/font-inventory.js +13 -13
  321. package/dist/safe-bash-docx-engine/font-resources.js +3 -3
  322. package/dist/safe-bash-docx-engine/image-batch-operations.js +11 -11
  323. package/dist/safe-bash-docx-engine/image-insertion.js +17 -17
  324. package/dist/safe-bash-docx-engine/image-layout.js +14 -14
  325. package/dist/safe-bash-docx-engine/image-replacement.js +19 -19
  326. package/dist/safe-bash-docx-engine/images.js +14 -14
  327. package/dist/safe-bash-docx-engine/index.js +102 -102
  328. package/dist/safe-bash-docx-engine/inspection.js +15 -15
  329. package/dist/safe-bash-docx-engine/invocation.js +4 -4
  330. package/dist/safe-bash-docx-engine/io.js +6 -6
  331. package/dist/safe-bash-docx-engine/links.js +17 -17
  332. package/dist/safe-bash-docx-engine/lists.js +16 -16
  333. package/dist/safe-bash-docx-engine/locations.js +10 -10
  334. package/dist/safe-bash-docx-engine/notes.js +18 -18
  335. package/dist/safe-bash-docx-engine/objects.js +14 -14
  336. package/dist/safe-bash-docx-engine/pack.js +9 -9
  337. package/dist/safe-bash-docx-engine/package-view-batch-operations.js +19 -19
  338. package/dist/safe-bash-docx-engine/pandoc-adapter.js +25 -25
  339. package/dist/safe-bash-docx-engine/paragraph-edit.js +21 -21
  340. package/dist/safe-bash-docx-engine/publication.js +6 -6
  341. package/dist/safe-bash-docx-engine/removal.js +16 -16
  342. package/dist/safe-bash-docx-engine/revision-decisions.js +16 -16
  343. package/dist/safe-bash-docx-engine/revision-edit.js +15 -15
  344. package/dist/safe-bash-docx-engine/revisions.js +12 -12
  345. package/dist/safe-bash-docx-engine/run-format.js +15 -15
  346. package/dist/safe-bash-docx-engine/sanitize.js +29 -29
  347. package/dist/safe-bash-docx-engine/sections.js +15 -15
  348. package/dist/safe-bash-docx-engine/settings.js +6 -6
  349. package/dist/safe-bash-docx-engine/shape-edit.js +16 -16
  350. package/dist/safe-bash-docx-engine/signatures.js +11 -11
  351. package/dist/safe-bash-docx-engine/stories.js +18 -18
  352. package/dist/safe-bash-docx-engine/structure-model-batch-operations.js +34 -34
  353. package/dist/safe-bash-docx-engine/style-model-batch-operations.js +24 -24
  354. package/dist/safe-bash-docx-engine/style-model-result-schema.js +39 -39
  355. package/dist/safe-bash-docx-engine/styles.js +14 -14
  356. package/dist/safe-bash-docx-engine/table-edit.js +23 -23
  357. package/dist/safe-bash-docx-engine/table-read.js +11 -11
  358. package/dist/safe-bash-docx-engine/template.js +17 -17
  359. package/dist/safe-bash-docx-engine/text-replace.js +15 -15
  360. package/dist/safe-bash-docx-engine/text-resource-read.js +11 -11
  361. package/dist/safe-bash-docx-engine/text.js +11 -11
  362. package/dist/safe-bash-docx-engine/validation.js +4 -4
  363. package/dist/safe-bash-docx-engine/xml-parts.js +17 -17
  364. package/dist/safe-bash-io-engine/commands/text-programs/shared.js +4 -4
  365. package/dist/safe-bash-line-ending-engine/command.js +3 -3
  366. package/dist/safe-bash-line-ending-engine/convert.js +2 -2
  367. package/dist/safe-bash-line-ending-engine/index.js +6 -6
  368. package/dist/safe-bash-line-ending-engine/info.js +2 -2
  369. package/dist/safe-bash-markdown-engine/commonmark-blocks.js +4 -4
  370. package/dist/safe-bash-markdown-engine/commonmark-inlines.js +4 -4
  371. package/dist/safe-bash-markdown-engine/commonmark-syntax.js +2 -2
  372. package/dist/safe-bash-markdown-engine/gfm-syntax.js +3 -3
  373. package/dist/safe-bash-markdown-engine/index.js +5 -5
  374. package/dist/safe-bash-network-engine/transfer.js +3 -3
  375. package/dist/safe-bash-presentation-engine/accessibility.js +30 -30
  376. package/dist/safe-bash-presentation-engine/animation-editing.js +15 -15
  377. package/dist/safe-bash-presentation-engine/animations.js +15 -15
  378. package/dist/safe-bash-presentation-engine/backgrounds.js +16 -16
  379. package/dist/safe-bash-presentation-engine/bytes.js +3 -3
  380. package/dist/safe-bash-presentation-engine/chart-editing.js +33 -33
  381. package/dist/safe-bash-presentation-engine/chart-object-operations.js +24 -24
  382. package/dist/safe-bash-presentation-engine/charts.js +30 -30
  383. package/dist/safe-bash-presentation-engine/command-placeholder.js +58 -58
  384. package/dist/safe-bash-presentation-engine/comments.js +16 -16
  385. package/dist/safe-bash-presentation-engine/connector-operations.js +31 -31
  386. package/dist/safe-bash-presentation-engine/connectors.js +28 -28
  387. package/dist/safe-bash-presentation-engine/content-types.js +4 -4
  388. package/dist/safe-bash-presentation-engine/creation.js +6 -6
  389. package/dist/safe-bash-presentation-engine/diff.js +31 -31
  390. package/dist/safe-bash-presentation-engine/drawing-format.js +19 -19
  391. package/dist/safe-bash-presentation-engine/drawing-operations.js +30 -30
  392. package/dist/safe-bash-presentation-engine/drawing-schema.js +20 -20
  393. package/dist/safe-bash-presentation-engine/equations.js +16 -16
  394. package/dist/safe-bash-presentation-engine/errors.js +2 -2
  395. package/dist/safe-bash-presentation-engine/fields.js +16 -16
  396. package/dist/safe-bash-presentation-engine/font-metrics.js +3 -3
  397. package/dist/safe-bash-presentation-engine/image-extraction.js +19 -19
  398. package/dist/safe-bash-presentation-engine/image-formatting.js +31 -31
  399. package/dist/safe-bash-presentation-engine/image-insertion.js +17 -17
  400. package/dist/safe-bash-presentation-engine/image-replacement.js +20 -20
  401. package/dist/safe-bash-presentation-engine/image-value.js +4 -4
  402. package/dist/safe-bash-presentation-engine/images.js +18 -18
  403. package/dist/safe-bash-presentation-engine/index.js +114 -114
  404. package/dist/safe-bash-presentation-engine/layouts.js +15 -15
  405. package/dist/safe-bash-presentation-engine/length.js +3 -3
  406. package/dist/safe-bash-presentation-engine/links.js +15 -15
  407. package/dist/safe-bash-presentation-engine/masters.js +14 -14
  408. package/dist/safe-bash-presentation-engine/media-editing.js +23 -23
  409. package/dist/safe-bash-presentation-engine/media-extraction.js +16 -16
  410. package/dist/safe-bash-presentation-engine/media.js +15 -15
  411. package/dist/safe-bash-presentation-engine/memberships.js +14 -14
  412. package/dist/safe-bash-presentation-engine/notes.js +15 -15
  413. package/dist/safe-bash-presentation-engine/ole-enum.js +4 -4
  414. package/dist/safe-bash-presentation-engine/ole-insertion.js +19 -19
  415. package/dist/safe-bash-presentation-engine/opaque-objects.js +9 -9
  416. package/dist/safe-bash-presentation-engine/package-reader.js +5 -5
  417. package/dist/safe-bash-presentation-engine/package-tools.js +18 -18
  418. package/dist/safe-bash-presentation-engine/package-uri.js +3 -3
  419. package/dist/safe-bash-presentation-engine/package-writer.js +4 -4
  420. package/dist/safe-bash-presentation-engine/presentation-model.js +57 -57
  421. package/dist/safe-bash-presentation-engine/presentation-settings.js +13 -13
  422. package/dist/safe-bash-presentation-engine/properties.js +15 -15
  423. package/dist/safe-bash-presentation-engine/relationships.js +4 -4
  424. package/dist/safe-bash-presentation-engine/resource-limits.js +1 -1
  425. package/dist/safe-bash-presentation-engine/retained-frame-formatting.d.ts +14 -0
  426. package/dist/safe-bash-presentation-engine/retained-inspection.js +13 -13
  427. package/dist/safe-bash-presentation-engine/retained-package.js +5 -5
  428. package/dist/safe-bash-presentation-engine/retained-text.d.ts +9 -2
  429. package/dist/safe-bash-presentation-engine/retained-text.js +130 -31
  430. package/dist/safe-bash-presentation-engine/retained-xml-document.d.ts +1 -0
  431. package/dist/safe-bash-presentation-engine/sanitize.js +16 -16
  432. package/dist/safe-bash-presentation-engine/selectors.js +10 -10
  433. package/dist/safe-bash-presentation-engine/shape-groups.js +30 -30
  434. package/dist/safe-bash-presentation-engine/shape-operations.js +29 -29
  435. package/dist/safe-bash-presentation-engine/shape-path-operations.js +31 -31
  436. package/dist/safe-bash-presentation-engine/shape-paths.js +15 -15
  437. package/dist/safe-bash-presentation-engine/shape-presets.js +3 -3
  438. package/dist/safe-bash-presentation-engine/shape-selection.js +30 -30
  439. package/dist/safe-bash-presentation-engine/shape-transforms.js +17 -17
  440. package/dist/safe-bash-presentation-engine/shapes.js +26 -26
  441. package/dist/safe-bash-presentation-engine/slide-copy.js +16 -16
  442. package/dist/safe-bash-presentation-engine/slide-import.js +17 -17
  443. package/dist/safe-bash-presentation-engine/slide-merge-split.js +19 -19
  444. package/dist/safe-bash-presentation-engine/slide-model.js +42 -42
  445. package/dist/safe-bash-presentation-engine/slide-removal.js +17 -17
  446. package/dist/safe-bash-presentation-engine/slide-transfer-budget.js +9 -9
  447. package/dist/safe-bash-presentation-engine/slides.js +18 -18
  448. package/dist/safe-bash-presentation-engine/table-operations.js +32 -32
  449. package/dist/safe-bash-presentation-engine/table-spans.js +31 -31
  450. package/dist/safe-bash-presentation-engine/tables.js +30 -30
  451. package/dist/safe-bash-presentation-engine/tags.js +15 -15
  452. package/dist/safe-bash-presentation-engine/template-bindings.js +32 -32
  453. package/dist/safe-bash-presentation-engine/template-repeat.js +39 -39
  454. package/dist/safe-bash-presentation-engine/text-fitting.js +26 -26
  455. package/dist/safe-bash-presentation-engine/text-frames.d.ts +13 -0
  456. package/dist/safe-bash-presentation-engine/text-frames.js +28 -26
  457. package/dist/safe-bash-presentation-engine/text-paragraphs.js +26 -26
  458. package/dist/safe-bash-presentation-engine/text-reading.js +11 -11
  459. package/dist/safe-bash-presentation-engine/text-replacement.js +16 -16
  460. package/dist/safe-bash-presentation-engine/text-runs.js +19 -19
  461. package/dist/safe-bash-presentation-engine/themes.js +15 -15
  462. package/dist/safe-bash-presentation-engine/transitions.js +15 -15
  463. package/dist/safe-bash-presentation-engine/validation.js +9 -9
  464. package/dist/safe-bash-presentation-engine/xml-parts.js +18 -18
  465. package/dist/safe-bash-presentation-engine/xml-view.js +3 -3
  466. package/dist/safe-bash-presentation-engine/xml.js +3 -3
  467. package/dist/safe-bash-query-engine/index.js +4 -4
  468. package/dist/safe-bash-query-engine/interpreter.js +2 -2
  469. package/dist/safe-bash-query-engine/query-core.js +4 -4
  470. package/dist/safe-bash-xml-engine/document.js +3 -3
  471. package/dist/safe-bash-xml-engine/evaluate.js +1 -1
  472. package/dist/safe-bash-xml-engine/index.js +6 -6
  473. package/dist/safe-bash-xml-engine/query.js +2 -2
  474. package/dist/safe-bash-xml-engine/stored-document.d.ts +2 -2
  475. package/dist/safe-bash-xml-engine/stored-document.js +1 -1
  476. package/dist/safe-bash-xml-engine/stored-evaluate.js +1 -1
  477. package/dist/safe-bash-zip-engine/zip/repair.js +3 -3
  478. package/dist/safe-bash-zip-engine/zip/volumes.js +3 -3
  479. package/dist/spreadsheet-engine/datasource.js +16 -2
  480. package/dist/spreadsheet-engine/formulas/diagnostics.d.ts +2 -1
  481. package/dist/spreadsheet-engine/formulas/diagnostics.js +2 -2
  482. package/dist/spreadsheet-engine/formulas/evaluator.d.ts +1 -1
  483. package/dist/spreadsheet-engine/formulas/evaluator.js +2 -1
  484. package/dist/spreadsheet-format-xls/biff-encrypted-properties.js +7 -6
  485. package/dist/spreadsheet-format-xls/biff-properties-merge.js +2 -2
  486. package/dist/spreadsheet-format-xls/biff-properties.js +94 -109
  487. package/dist/spreadsheet-format-xls/biff-property-dictionary.d.ts +5 -0
  488. package/dist/spreadsheet-format-xls/biff-property-dictionary.js +75 -0
  489. package/dist/spreadsheet-format-xls/biff-property-range.d.ts +17 -3
  490. package/dist/spreadsheet-format-xls/biff-property-range.js +178 -37
  491. package/package.json +4 -2
  492. package/dist/safe-bash/command-chunks/biff-4ALVARRF-7SRX6R6N.js +0 -5192
  493. package/dist/safe-bash/command-chunks/{chunk-X2HVVMTW.js → chunk-AW4Q3GZW.js} +6 -6
  494. package/dist/safe-bash/command-chunks/{chunk-JC2EV66U.js → chunk-BJXADHRT.js} +3 -3
  495. package/dist/safe-bash/command-chunks/{chunk-XI2LETBJ.js → chunk-BXU5Y7I5.js} +3 -3
  496. package/dist/safe-bash/command-chunks/{chunk-PVLPWVRH.js → chunk-D3HW7R2N.js} +3 -3
  497. package/dist/safe-bash/command-chunks/{chunk-OLK3DCJD.js → chunk-DYERIXPU.js} +3 -3
  498. package/dist/safe-bash/command-chunks/{chunk-WYBCSJFG.js → chunk-FWCUEZ3K.js} +3 -3
  499. package/dist/safe-bash/command-chunks/{chunk-FF2SQ2GP.js → chunk-GGH376XQ.js} +3 -3
  500. package/dist/safe-bash/command-chunks/{chunk-D66Q7QJ3.js → chunk-JRSZ5IGD.js} +6 -6
  501. package/dist/safe-bash/command-chunks/{chunk-3JST2Q7G.js → chunk-KRRG4MGH.js} +3 -3
  502. package/dist/safe-bash/command-chunks/{chunk-Z3YB4EVE.js → chunk-KSM5CCHT.js} +8 -8
  503. package/dist/safe-bash/command-chunks/{chunk-NJ4NTTCR.js → chunk-LNLACEAN.js} +8 -8
  504. package/dist/safe-bash/command-chunks/{chunk-NBTG6NF6.js → chunk-LTJRUMK6.js} +3 -3
  505. package/dist/safe-bash/command-chunks/{chunk-XCYTG7CR.js → chunk-NJGL5JQ6.js} +3 -3
  506. package/dist/safe-bash/command-chunks/{chunk-SZ66JC25.js → chunk-Q7J2NTH2.js} +3 -3
  507. package/dist/safe-bash/command-chunks/{chunk-MDV7W5AS.js → chunk-SKNI2XQA.js} +3 -3
  508. package/dist/safe-bash/command-chunks/{chunk-7ZWACKCG.js → chunk-T6OXG7QQ.js} +3 -3
  509. package/dist/safe-bash/command-chunks/{chunk-ECDEPKKW.js → chunk-W25EIKDJ.js} +3 -3
  510. package/dist/safe-bash/command-chunks/{chunk-4YSBUQPV.js → chunk-W2FKFEVY.js} +3 -3
  511. package/dist/safe-bash/command-chunks/{chunk-2CIDPOUV.js → chunk-WSNHJZQ5.js} +3 -3
  512. package/dist/safe-bash/command-chunks/{chunk-4H3TYOVC.js → chunk-Y7AXMCFV.js} +3 -3
  513. package/dist/safe-bash/command-chunks/{chunk-U6IEK2CI.js → chunk-YPG55QTP.js} +7 -7
  514. package/dist/safe-bash/command-chunks/{chunk-252L5YC5.js → chunk-Z37OM247.js} +6 -6
  515. package/dist/safe-bash/command-chunks/{pln-DFS7VLVS-JATX6FS7.js → pln-DFS7VLVS-OVOBS4QX.js} +3 -3
  516. package/dist/safe-bash/command-chunks/{psion-YBI6JEQI-6OMC2PGC.js → psion-YBI6JEQI-GY4S6ZLC.js} +3 -3
@@ -28310,7 +28310,7 @@ function* parseValueSteps(lexer, maxDepth, repair = false, maxNodes = Infinity,
28310
28310
  continue;
28311
28311
  }
28312
28312
  if (tok.kind === "dict-start") {
28313
- const backed = options.dictionaryStorage && (parent?.kind === "dict" && options.storedDictionaryKeys?.includes(parent.key.decoded) || !parent && options.storeRootDictionary);
28313
+ const backed = options.dictionaryStorage && (parent?.kind === "dict" && !parent.storedEntries && options.storedDictionaryKeys?.includes(parent.key.decoded) || !parent && options.storeRootDictionary);
28314
28314
  yield* push({
28315
28315
  kind: "dict",
28316
28316
  path: ancestorPath(parent),
@@ -43006,6 +43006,13 @@ function* resolveEvaluationDict(node, arrayPathPrefix) {
43006
43006
  const resolved = yield* resolveEvaluationNode(node, false, arrayPathPrefix);
43007
43007
  return resolved?.kind === "dict" ? resolved : resolved?.kind === "stream" ? resolved.dict : void 0;
43008
43008
  }
43009
+ function* lookupEvaluationDictionary(dict, key) {
43010
+ if (!dict) return void 0;
43011
+ if (!dict.storedEntries) return dictGet(dict, key);
43012
+ const result = yield { kind: "dictionary-value", dict, key };
43013
+ if (!result || !("kind" in result) || result.kind !== "resolved") throw new TypeError("Expected a PDF dictionary value");
43014
+ return result.node;
43015
+ }
43009
43016
  function* resolveEvaluationArray(node, storeRootArray = false, arrayPathPrefix) {
43010
43017
  const resolved = yield* resolveEvaluationNode(node, storeRootArray, arrayPathPrefix);
43011
43018
  return resolved?.kind === "array" ? resolved : void 0;
@@ -43853,8 +43860,8 @@ function* evaluateContentSteps(params) {
43853
43860
  let resolvedMcid = node.mcid;
43854
43861
  let resolvedActualText = node.actualText ?? node.storedActualText;
43855
43862
  if (typeof node.properties === "string" && activeResources) {
43856
- const propsMap = yield* resolveEvaluationDict(dictGet(activeResources, "Properties"));
43857
- const propRefOrNode = propsMap ? dictGet(propsMap, node.properties) : void 0;
43863
+ const propsMap = yield* resolveEvaluationDict(dictGet(activeResources, "Properties"), ["Properties"]);
43864
+ const propRefOrNode = yield* lookupEvaluationDictionary(propsMap, node.properties);
43858
43865
  if (propRefOrNode) {
43859
43866
  const propDict = yield* resolveEvaluationDict(propRefOrNode);
43860
43867
  const propType = propDict ? yield* resolveEvaluationNode(dictGet(propDict, "Type")) : void 0;
@@ -44037,8 +44044,8 @@ function* evaluateContentSteps(params) {
44037
44044
  case "xobject": {
44038
44045
  const st = curState();
44039
44046
  if (activeResources) {
44040
- const xobjDict = yield* resolveEvaluationDict(dictGet(activeResources, "XObject"));
44041
- const xobjNode = xobjDict ? yield* resolveEvaluationNode(dictGet(xobjDict, node.name)) : void 0;
44047
+ const xobjDict = yield* resolveEvaluationDict(dictGet(activeResources, "XObject"), ["XObject"]);
44048
+ const xobjNode = xobjDict ? yield* resolveEvaluationNode(yield* lookupEvaluationDictionary(xobjDict, node.name)) : void 0;
44042
44049
  if (xobjNode?.kind === "stream") {
44043
44050
  if (!(yield* optionalContentVisibilitySteps(dictGet(xobjNode.dict, "OC")))) {
44044
44051
  break;
@@ -44439,7 +44446,7 @@ function* evaluateContentStreamSteps(params) {
44439
44446
  else exhausted = true;
44440
44447
  }
44441
44448
  step = work.next(next.done ? void 0 : next.value);
44442
- } else if (step.value.kind === "dash-array" || step.value.kind === "array-reference" || step.value.kind === "array-item" || step.value.kind === "string-bytes" || step.value.kind === "font-width" || step.value.kind === "font-unicode" || step.value.kind === "cmap-lookup" || step.value.kind === "cmap-character" || step.value.kind === "truetype-number" || step.value.kind === "truetype-path" || step.value.kind === "cid-gid" || step.value.kind === "frame-push" || step.value.kind === "frame-pop" || step.value.kind === "capture-append" || step.value.kind === "transform-path" || step.value.kind === "append-clip" || step.value.kind === "path-append" || step.value.kind === "path-finish") {
44449
+ } else if (step.value.kind === "dictionary-value" || step.value.kind === "dash-array" || step.value.kind === "array-reference" || step.value.kind === "array-item" || step.value.kind === "string-bytes" || step.value.kind === "font-width" || step.value.kind === "font-unicode" || step.value.kind === "cmap-lookup" || step.value.kind === "cmap-character" || step.value.kind === "truetype-number" || step.value.kind === "truetype-path" || step.value.kind === "cid-gid" || step.value.kind === "frame-push" || step.value.kind === "frame-pop" || step.value.kind === "capture-append" || step.value.kind === "transform-path" || step.value.kind === "append-clip" || step.value.kind === "path-append" || step.value.kind === "path-finish") {
44443
44450
  throw new PdfError("E_CAPABILITY", "Stored PDF paths require an asynchronous source driver");
44444
44451
  } else if (step.value.kind === "shading") {
44445
44452
  if (!params.cosDoc) throw new PdfError("E_CAPABILITY", "PDF shading requires a source driver");
@@ -44631,7 +44638,8 @@ function* preparePageAppearanceSteps(pageDict, pageRes, evalResourcesDict, hideA
44631
44638
  const sub = yield* resolveDict3(entry.value, [entry.key.decoded]);
44632
44639
  if (sub) {
44633
44640
  onAllocation?.(64 + sub.entries.length * 64);
44634
- const clonedSub = sub.storedEntries ? yield { kind: "dictionary-merge", destination: sub } : cosDict({});
44641
+ const shareBacking = entry.key.decoded === "XObject" || entry.key.decoded === "Properties";
44642
+ const clonedSub = sub.storedEntries ? shareBacking ? { ...sub, entries: [] } : yield { kind: "dictionary-merge", destination: sub } : cosDict({});
44635
44643
  if (!sub.storedEntries) for (const se of sub.entries) dictSet(clonedSub, se.key.decoded, se.value);
44636
44644
  dictSet(evalResourcesDict, entry.key.decoded, clonedSub);
44637
44645
  } else {
@@ -49283,54 +49291,6 @@ async function openPdfCrossReference(source, storage, options = {}) {
49283
49291
  }
49284
49292
  }
49285
49293
 
49286
- // packages/pdf-ast/src/cos/filter-dictionary.ts
49287
- async function resolvePdfStreamDictionary(dict, lookup, active, options) {
49288
- let remaining = options.maxNodes ?? 65536;
49289
- const resolve2 = async (node, depth) => {
49290
- if (--remaining < 0 || depth >= (options.maxRecursionDepth ?? 100)) throw new PdfError("E_LIMIT", "PDF filter resolution limit exceeded");
49291
- if (node.kind === "ref") {
49292
- if (active.has(node.objectNumber)) throw new PdfError("E_PARSE", "PDF filter reference cycle");
49293
- const object = await lookup(node);
49294
- if (!object) throw new PdfError("E_PARSE", "Missing PDF filter reference");
49295
- active.add(node.objectNumber);
49296
- try {
49297
- return await resolve2(object.value, depth + 1);
49298
- } finally {
49299
- active.delete(node.objectNumber);
49300
- }
49301
- }
49302
- if (node.kind === "array") {
49303
- const items = [];
49304
- const { storedItems, ...ordinary } = node;
49305
- if (storedItems) {
49306
- const reader = readStoredItems(storedItems, options.signal);
49307
- try {
49308
- for (; ; ) {
49309
- const item = await reader.next().catch((error) => {
49310
- options.onBackingError?.(error);
49311
- throw error;
49312
- });
49313
- if (item.done) break;
49314
- items.push(await resolve2(item.value, depth + 1));
49315
- }
49316
- } finally {
49317
- await reader.return();
49318
- }
49319
- } else for (const item of node.items) items.push(await resolve2(item, depth + 1));
49320
- return { ...ordinary, items };
49321
- }
49322
- if (node.kind === "dict") {
49323
- const entries2 = [];
49324
- for (const entry of node.entries) entries2.push({ ...entry, value: await resolve2(entry.value, depth + 1) });
49325
- return { ...node, entries: entries2 };
49326
- }
49327
- return node;
49328
- };
49329
- const entries = [];
49330
- for (const entry of dict.entries) entries.push(["Filter", "F", "DecodeParms", "DP", "Type"].includes(entry.key.decoded) ? { ...entry, value: await resolve2(entry.value, 0) } : entry);
49331
- return { ...dict, entries };
49332
- }
49333
-
49334
49294
  // packages/pdf-ast/src/cos/reference-set.ts
49335
49295
  var PdfReferenceSet = class {
49336
49296
  constructor(storage, maximum10 = Infinity, signal) {
@@ -49345,12 +49305,16 @@ var PdfReferenceSet = class {
49345
49305
  tail = /* @__PURE__ */ new Set();
49346
49306
  levels = [];
49347
49307
  closed = false;
49348
- async add(number) {
49308
+ async has(number) {
49349
49309
  if (this.closed) throw new PdfError("E_CAPABILITY", "PDF reference set is closed");
49350
49310
  this.signal?.throwIfAborted();
49351
49311
  if (!Number.isSafeInteger(number) || number < 0) throw new RangeError("Invalid PDF reference number");
49352
- if (this.tail.has(number)) return false;
49353
- for (const level2 of this.levels) if (await level2?.get(number, this.signal)) return false;
49312
+ if (this.tail.has(number)) return true;
49313
+ for (const level of this.levels) if (await level?.get(number, this.signal)) return true;
49314
+ return false;
49315
+ }
49316
+ async add(number) {
49317
+ if (await this.has(number)) return false;
49354
49318
  this.tail.add(number);
49355
49319
  if (this.tail.size < 64) return true;
49356
49320
  let level = 0;
@@ -49398,6 +49362,54 @@ var PdfReferenceSet = class {
49398
49362
  }
49399
49363
  };
49400
49364
 
49365
+ // packages/pdf-ast/src/cos/filter-dictionary.ts
49366
+ async function resolvePdfStreamDictionary(dict, lookup, active, options) {
49367
+ let remaining = options.maxNodes ?? 65536;
49368
+ const resolve2 = async (node, depth) => {
49369
+ if (--remaining < 0 || depth >= (options.maxRecursionDepth ?? 100)) throw new PdfError("E_LIMIT", "PDF filter resolution limit exceeded");
49370
+ if (node.kind === "ref") {
49371
+ if (active.has(node.objectNumber)) throw new PdfError("E_PARSE", "PDF filter reference cycle");
49372
+ const object = await lookup(node);
49373
+ if (!object) throw new PdfError("E_PARSE", "Missing PDF filter reference");
49374
+ active.add(node.objectNumber);
49375
+ try {
49376
+ return await resolve2(object.value, depth + 1);
49377
+ } finally {
49378
+ active.delete(node.objectNumber);
49379
+ }
49380
+ }
49381
+ if (node.kind === "array") {
49382
+ const items = [];
49383
+ const { storedItems, ...ordinary } = node;
49384
+ if (storedItems) {
49385
+ const reader = readStoredItems(storedItems, options.signal);
49386
+ try {
49387
+ for (; ; ) {
49388
+ const item = await reader.next().catch((error) => {
49389
+ options.onBackingError?.(error);
49390
+ throw error;
49391
+ });
49392
+ if (item.done) break;
49393
+ items.push(await resolve2(item.value, depth + 1));
49394
+ }
49395
+ } finally {
49396
+ await reader.return();
49397
+ }
49398
+ } else for (const item of node.items) items.push(await resolve2(item, depth + 1));
49399
+ return { ...ordinary, items };
49400
+ }
49401
+ if (node.kind === "dict") {
49402
+ const entries2 = [];
49403
+ for (const entry of node.entries) entries2.push({ ...entry, value: await resolve2(entry.value, depth + 1) });
49404
+ return { ...node, entries: entries2 };
49405
+ }
49406
+ return node;
49407
+ };
49408
+ const entries = [];
49409
+ for (const entry of dict.entries) entries.push(["Filter", "F", "DecodeParms", "DP", "Type"].includes(entry.key.decoded) ? { ...entry, value: await resolve2(entry.value, 0) } : entry);
49410
+ return { ...dict, entries };
49411
+ }
49412
+
49401
49413
  // packages/pdf-ast/src/cos/recovered-reference.ts
49402
49414
  async function* recoveredBodies(source, index2, storage, options) {
49403
49415
  const visited = new PdfReferenceSet(storage, options.index?.maxStagingBytes, options.signal);
@@ -49527,6 +49539,7 @@ var PdfObjectReader = class {
49527
49539
  this.capacity = integer2(options.objectStreamCacheEntries ?? 2, "objectStreamCacheEntries", 1);
49528
49540
  this.stagingLimit = maximum2(options.maxStagingBytes, "maxStagingBytes");
49529
49541
  maximum2(options.maxObjectStreamMembers, "maxObjectStreamMembers");
49542
+ maximum2(options.maxTraversalStagingBytes, "maxTraversalStagingBytes");
49530
49543
  this.options = {
49531
49544
  maxNodes: 65536,
49532
49545
  maxTokenBytes: 1048576,
@@ -49543,6 +49556,7 @@ var PdfObjectReader = class {
49543
49556
  // Recursive length/object-stream lookups share one failure identity so an
49544
49557
  // outer recovery pass cannot mistake a caller-storage error for PDF syntax.
49545
49558
  backingFailures = /* @__PURE__ */ new WeakMap();
49559
+ lengthPaths = /* @__PURE__ */ new WeakMap();
49546
49560
  repairedOffsets = /* @__PURE__ */ new Map();
49547
49561
  options;
49548
49562
  capacity;
@@ -49583,10 +49597,76 @@ var PdfObjectReader = class {
49583
49597
  const decodeOptions = { ...this.options, stopBeforeImageCodec: options.stopBeforeImageCodec ?? false, raw: options.raw ?? false };
49584
49598
  yield* security ? decodePdfEncryptedStreamChunks(security, objectNumber, generationNumber, dict, input, decodeOptions) : decodePdfStreamChunks(dict, input, decodeOptions);
49585
49599
  }
49586
- async load(objectNumber, generationNumber, active, arrays = this.options.valueArrays ?? {}) {
49600
+ /** A stream-valued /Length is invalid as a length, but its references still
49601
+ * need cycle, admission and backing-error validation. Walk those discarded
49602
+ * values in source order instead of retaining one parser and AST per link. */
49603
+ async resolveLength(reference, active) {
49604
+ const path = {
49605
+ seen: new PdfReferenceSet(this.storage, this.options.maxTraversalStagingBytes, this.options.signal),
49606
+ parent: this.lengthPaths.get(active),
49607
+ depth: 0
49608
+ };
49609
+ this.lengthPaths.set(active, path);
49610
+ let next = reference, result, failed = false;
49611
+ try {
49612
+ while (next) {
49613
+ const current = next;
49614
+ next = void 0;
49615
+ const object = await this.load(
49616
+ current.objectNumber,
49617
+ current.generationNumber,
49618
+ active,
49619
+ this.options.valueArrays ?? {},
49620
+ async (child) => {
49621
+ next = child;
49622
+ return void 0;
49623
+ }
49624
+ );
49625
+ if (path.depth === 0 && object?.value.kind === "number") result = object.value.value;
49626
+ try {
49627
+ await path.seen.add(current.objectNumber);
49628
+ } catch (error) {
49629
+ this.backingFailures.set(active, { error });
49630
+ this.options.onBackingError?.(error);
49631
+ throw error;
49632
+ }
49633
+ path.depth++;
49634
+ }
49635
+ return result;
49636
+ } catch (error) {
49637
+ failed = true;
49638
+ throw error;
49639
+ } finally {
49640
+ if (path.parent) this.lengthPaths.set(active, path.parent);
49641
+ else this.lengthPaths.delete(active);
49642
+ try {
49643
+ await path.seen.close();
49644
+ } catch (error) {
49645
+ if (!failed) {
49646
+ this.backingFailures.set(active, { error });
49647
+ this.options.onBackingError?.(error);
49648
+ await Promise.reject(error);
49649
+ }
49650
+ }
49651
+ }
49652
+ }
49653
+ async load(objectNumber, generationNumber, active, arrays = this.options.valueArrays ?? {}, resolveLength) {
49587
49654
  this.options.signal?.throwIfAborted();
49588
49655
  if (active.has(objectNumber)) throw new PdfError("E_PARSE", "PDF indirect object cycle");
49589
- if (active.size >= this.options.maxRecursionDepth) throw new PdfError("E_LIMIT", "PDF object resolution depth limit exceeded");
49656
+ let depth = active.size;
49657
+ for (let path = this.lengthPaths.get(active); path; path = path.parent) {
49658
+ let seen;
49659
+ try {
49660
+ seen = await path.seen.has(objectNumber);
49661
+ } catch (error) {
49662
+ this.backingFailures.set(active, { error });
49663
+ this.options.onBackingError?.(error);
49664
+ throw error;
49665
+ }
49666
+ if (seen) throw new PdfError("E_PARSE", "PDF indirect object cycle");
49667
+ depth += path.depth;
49668
+ }
49669
+ if (depth >= this.options.maxRecursionDepth) throw new PdfError("E_LIMIT", "PDF object resolution depth limit exceeded");
49590
49670
  const entry = await this.index.get(objectNumber, this.options.signal);
49591
49671
  if (!entry || entry.type === "free" || generationNumber !== (entry.generationNumber ?? 0)) return void 0;
49592
49672
  active.add(objectNumber);
@@ -49611,18 +49691,18 @@ var PdfObjectReader = class {
49611
49691
  return { objectNumber, generationNumber, value: parsed.value, span: { start, end: parsed.offset } };
49612
49692
  }
49613
49693
  let object;
49694
+ let pendingLength;
49614
49695
  try {
49615
49696
  object = await parseCosRangeObject(this.source, this.repairedOffsets.get(objectNumber) ?? entry.offset, {
49616
49697
  ...this.options,
49617
49698
  ...arrays,
49618
49699
  onBackingError,
49619
- resolveLength: async (reference) => {
49620
- const resolved = await this.load(reference.objectNumber, reference.generationNumber, active);
49621
- return resolved?.value.kind === "number" ? resolved.value.value : void 0;
49622
- }
49700
+ resolveLength: (reference) => pendingLength = resolveLength ? resolveLength(reference) : this.resolveLength(reference, active)
49623
49701
  });
49624
49702
  if (object.objectNumber !== objectNumber || object.generationNumber !== generationNumber) throw new PdfError("E_PARSE", "Indirect object identity does not match xref");
49625
49703
  } catch (error) {
49704
+ await pendingLength?.catch(() => {
49705
+ });
49626
49706
  this.options.signal?.throwIfAborted();
49627
49707
  const backingFailure = this.backingFailures.get(active);
49628
49708
  if (backingFailure && Object.is(backingFailure.error, error)) throw error;
@@ -54950,7 +55030,7 @@ async function resolveRetainedFont(document2, storage, resources, name, options
54950
55030
  }
54951
55031
  let value;
54952
55032
  if (step.value.kind === "resolve") {
54953
- const retained = await document2.lookup(step.value.node, options.resourceStorage ? { dictionaryStorage: options.resourceStorage, storedDictionaryKeys: ["Font"], storeRootDictionary: step.value.storeRootDictionary ?? false, arrayStorage: options.resourceStorage, storedArrayKeys: ["Widths", "W", "Differences"], storeRootArray: step.value.storeRootArray ?? false } : {});
55033
+ const retained = await document2.lookup(step.value.node, options.resourceStorage ? { dictionaryStorage: options.resourceStorage, storedDictionaryKeys: ["Font", "XObject", "Properties"], storeRootDictionary: step.value.storeRootDictionary ?? false, arrayStorage: options.resourceStorage, storedArrayKeys: ["Widths", "W", "Differences"], storeRootArray: step.value.storeRootArray ?? false } : {});
54954
55034
  value = retained?.value;
54955
55035
  if (retained?.stream) {
54956
55036
  if (retained.value.kind !== "dict" || !retained.reference) throw new PdfError("E_PARSE", "Font stream has no retained identity");
@@ -55290,6 +55370,9 @@ async function* evaluateRetainedContentSteps(document2, content, params, storage
55290
55370
  reply = { kind: "dash-array", value: await storeDashArray(request.array, request.storage, request.resolveReferences ? resolve2 : async (node) => node, signal) };
55291
55371
  break;
55292
55372
  }
55373
+ case "dictionary-value":
55374
+ reply = { kind: "resolved", node: await readPdfDictionaryValue(request.dict, request.key, signal) };
55375
+ break;
55293
55376
  case "array-reference":
55294
55377
  reply = { kind: "resolved", node: cosBool(await memberships.has(request.items, request.objectNumber)) };
55295
55378
  break;
@@ -58358,7 +58441,7 @@ var PdfMergeOutlines = class {
58358
58441
  if (node.kind === "ref" && !await seen.add(node.objectNumber)) continue;
58359
58442
  const dict = (await document2.lookup(node))?.value;
58360
58443
  if (dict?.kind !== "dict") continue;
58361
- yield dict;
58444
+ yield { dict, level: depth + 1 };
58362
58445
  if (outlines) {
58363
58446
  await push(dictGet(dict, "Next"), depth);
58364
58447
  await push(dictGet(dict, "First"), depth + 1);
@@ -58380,7 +58463,7 @@ var PdfMergeOutlines = class {
58380
58463
  }
58381
58464
  }
58382
58465
  }
58383
- async append(document2, pageOffset, includeUntitled = false) {
58466
+ async append(document2, pageOffset, includeUntitled = false, includeNameTitles = false) {
58384
58467
  const resolve2 = async (node) => (await document2.lookup(node))?.value;
58385
58468
  const catalog = await resolve2(document2.crossReference.rootRef);
58386
58469
  if (catalog?.kind !== "dict") return;
@@ -58391,7 +58474,7 @@ var PdfMergeOutlines = class {
58391
58474
  const legacy = await resolve2(dictGet(catalog, "Dests")), direct = legacy?.kind === "dict" ? dictGet(legacy, name) : void 0;
58392
58475
  if (direct) return direct;
58393
58476
  const names = await resolve2(dictGet(catalog, "Names"));
58394
- if (names?.kind === "dict") for await (const tree of this.walk(document2, dictGet(names, "Dests"), false)) {
58477
+ if (names?.kind === "dict") for await (const { dict: tree } of this.walk(document2, dictGet(names, "Dests"), false)) {
58395
58478
  const pairs = await resolve2(dictGet(tree, "Names"));
58396
58479
  if (pairs?.kind === "array") for (let i = 0; i + 1 < pairs.items.length; i += 2) {
58397
58480
  await this.checkpoint();
@@ -58424,10 +58507,10 @@ var PdfMergeOutlines = class {
58424
58507
  return number?.kind === "number" && number.value >= 0 && number.value < pageCount ? Math.round(number.value) : 0;
58425
58508
  };
58426
58509
  try {
58427
- for await (const outline of this.walk(document2, dictGet(outlines, "First"), true)) {
58428
- const title = await resolve2(dictGet(outline, "Title")), text = title?.kind === "string" ? decodePdfString(title) : "";
58510
+ for await (const { dict: outline, level } of this.walk(document2, dictGet(outlines, "First"), true)) {
58511
+ const title = await resolve2(dictGet(outline, "Title")), text = title?.kind === "string" ? decodePdfString(title) : includeNameTitles && title?.kind === "name" ? title.decoded : "";
58429
58512
  const index2 = await destination(dictGet(outline, "Dest") ?? dictGet(outline, "A"));
58430
- if (text || includeUntitled) await this.objects.set({ objectNumber: ++this.count, generationNumber: 0, value: cosDict({ Title: cosString(text), Page: cosNumber(pageOffset + index2) }) });
58513
+ if (text || includeUntitled) await this.objects.set({ objectNumber: ++this.count, generationNumber: 0, value: cosDict({ Title: cosString(text), Page: cosNumber(pageOffset + index2), Level: cosNumber(level) }) });
58431
58514
  }
58432
58515
  } catch (error) {
58433
58516
  failed = true;
@@ -58439,11 +58522,14 @@ var PdfMergeOutlines = class {
58439
58522
  }
58440
58523
  }
58441
58524
  async *entries() {
58525
+ for await (const { title, pageIndex } of this.details()) yield { title, pageIndex };
58526
+ }
58527
+ async *details() {
58442
58528
  for await (const object of this.objects.objects()) {
58443
58529
  await this.checkpoint();
58444
- const row = object.value, title = dictGet(row, "Title"), index2 = dictGet(row, "Page");
58530
+ const row = object.value, title = dictGet(row, "Title"), index2 = dictGet(row, "Page"), level = dictGet(row, "Level");
58445
58531
  if (title?.kind !== "string" || index2?.kind !== "number") throw new PdfError("E_PARSE", "Invalid staged outline summary");
58446
- yield { title: decodePdfString(title), pageIndex: index2.value };
58532
+ yield { title: decodePdfString(title), pageIndex: index2.value, level: level?.kind === "number" ? level.value : 1 };
58447
58533
  }
58448
58534
  }
58449
58535
  async finish(target, catalog, pageCount, page2) {
@@ -59539,7 +59625,7 @@ async function markedText(document2, page2, mcid, storage, options) {
59539
59625
  var boundary = boundary2, scan = scan2;
59540
59626
  source = await PdfFileSource.fromStream(storage.fs, storage.directory, input(), { chunkBytes, cacheBytes: chunkBytes, maxInputBytes: maximum10, ...signal ? { signal } : {} });
59541
59627
  const resources = (await document2.lookup(dictGet(page2, "Resources")))?.value;
59542
- const properties = resources?.kind === "dict" ? (await document2.lookup(dictGet(resources, "Properties")))?.value : void 0;
59628
+ const properties = resources?.kind === "dict" ? (await document2.lookup(dictGet(resources, "Properties"), void 0, ["Properties"]))?.value : void 0;
59543
59629
  const operators2 = parseContentRangeOperators(source, storage, { chunkBytes, maxStagingBytes: maximum10 - source.size, ...signal ? { signal } : {} });
59544
59630
  let pending, matching = false, inText = false, part = 0, recorded = false;
59545
59631
  async function* fragments(command) {
@@ -59568,7 +59654,7 @@ async function markedText(document2, page2, mcid, storage, options) {
59568
59654
  await marks.push({ kind: "boolean", value: matching });
59569
59655
  if (operator !== "q") {
59570
59656
  const property = operands[1];
59571
- const dict = property?.kind === "name" && properties?.kind === "dict" ? (await document2.lookup(dictGet(properties, property.decoded)))?.value : property;
59657
+ const dict = property?.kind === "name" && properties?.kind === "dict" ? (await document2.lookup(await readPdfDictionaryValue(properties, property.decoded, signal)))?.value : property;
59572
59658
  const number = dict?.kind === "dict" ? (await document2.lookup(dictGet(dict, "MCID")))?.value : void 0;
59573
59659
  if (number?.kind === "number") matching = number.value === mcid;
59574
59660
  }
@@ -59967,8 +60053,8 @@ async function* walkRetainedImages(document2, storage, options) {
59967
60053
  const decodeOptions = { chunkBytes, ...options.maxDecodedBytes === void 0 ? {} : { maxDecodedBytes: options.maxDecodedBytes }, ...options.signal ? { signal: options.signal } : {} };
59968
60054
  let imageIndex = 0;
59969
60055
  let stagedBytes = 0;
59970
- async function dictionary(node) {
59971
- const value = await document2.lookup(node);
60056
+ async function dictionary(node, resourceKey) {
60057
+ const value = await document2.lookup(node, void 0, resourceKey ? [resourceKey] : void 0);
59972
60058
  return value?.value.kind === "dict" && !value.stream ? value.value : void 0;
59973
60059
  }
59974
60060
  async function number(node, fallback) {
@@ -60067,8 +60153,8 @@ async function* walkRetainedImages(document2, storage, options) {
60067
60153
  } else if (op.operator === "Do") {
60068
60154
  const name = op.operands[0];
60069
60155
  if (name?.kind !== "name") continue;
60070
- const objects = await dictionary(dictGet(activeResources, "XObject"));
60071
- const target = await document2.lookup(objects ? dictGet(objects, name.decoded) : void 0);
60156
+ const objects = await dictionary(dictGet(activeResources, "XObject"), "XObject");
60157
+ const target = await document2.lookup(objects ? await readPdfDictionaryValue(objects, name.decoded, options.signal) : void 0);
60072
60158
  if (target?.value.kind !== "dict" || !target.stream || !target.reference) continue;
60073
60159
  const subtype = (await document2.lookup(dictGet(target.value, "Subtype")))?.value;
60074
60160
  if (subtype?.kind !== "name") continue;
@@ -60129,8 +60215,8 @@ async function* walkRetainedImages(document2, storage, options) {
60129
60215
  yield* content(page2.streamContents(), resources, identity, /* @__PURE__ */ new Set(), 0);
60130
60216
  const patterns = await dictionary(dictGet(resources, "Pattern"));
60131
60217
  if (patterns) for (const entry of patterns.entries) yield* auxiliary(entry.value, resources);
60132
- const fonts = await dictionary(dictGet(resources, "Font"));
60133
- if (fonts) for (const entry of fonts.entries) {
60218
+ const fonts = await dictionary(dictGet(resources, "Font"), "Font");
60219
+ if (fonts) for await (const entry of readPdfDictionaryEntries(fonts, options.signal)) {
60134
60220
  const font = await dictionary(entry.value);
60135
60221
  if (!font) continue;
60136
60222
  const subtype = (await document2.lookup(dictGet(font, "Subtype")))?.value;
@@ -60145,8 +60231,8 @@ async function* walkRetainedImages(document2, storage, options) {
60145
60231
  const appearance = annotation ? await dictionary(dictGet(annotation, "AP")) : void 0;
60146
60232
  if (appearance) yield* auxiliary(dictGet(appearance, "N"), resources);
60147
60233
  }
60148
- const objects = await dictionary(dictGet(resources, "XObject"));
60149
- if (objects) for (const entry of objects.entries) {
60234
+ const objects = await dictionary(dictGet(resources, "XObject"), "XObject");
60235
+ if (objects) for await (const entry of readPdfDictionaryEntries(objects, options.signal)) {
60150
60236
  const ref = entry.value;
60151
60237
  if (ref.kind === "ref" && !(await seen.intern(`${ref.objectNumber}:${ref.generationNumber}`)).added) continue;
60152
60238
  const target = await document2.lookup(ref);
@@ -60183,8 +60269,8 @@ async function* walkRetainedFonts(document2, storage, options) {
60183
60269
  const last = options.lastPage ?? Infinity;
60184
60270
  if (!Number.isSafeInteger(first) || first < 1 || last !== Infinity && (!Number.isSafeInteger(last) || last < first)) throw new RangeError("Invalid PDF font page range");
60185
60271
  let failed = false;
60186
- async function dictionary(node) {
60187
- const resolved = await document2.lookup(node);
60272
+ async function dictionary(node, resourceKey) {
60273
+ const resolved = await document2.lookup(node, void 0, resourceKey ? [resourceKey] : void 0);
60188
60274
  return resolved?.value.kind === "dict" && !resolved.stream ? resolved.value : void 0;
60189
60275
  }
60190
60276
  async function* font(node, key, depth) {
@@ -60220,8 +60306,8 @@ async function* walkRetainedFonts(document2, storage, options) {
60220
60306
  options.signal?.throwIfAborted();
60221
60307
  if (!value) return;
60222
60308
  if (depth > options.maxDepth) throw new PdfError("E_LIMIT", "PDF font resource depth limit exceeded");
60223
- const fonts = await dictionary(dictGet(value, "Font"));
60224
- if (fonts) for (const entry of fonts.entries) yield* font(entry.value, entry.key.decoded, depth);
60309
+ const fonts = await dictionary(dictGet(value, "Font"), "Font");
60310
+ if (fonts) for await (const entry of readPdfDictionaryEntries(fonts, options.signal)) yield* font(entry.value, entry.key.decoded, depth);
60225
60311
  const states = await dictionary(dictGet(value, "ExtGState"));
60226
60312
  if (states) for (const entry of states.entries) {
60227
60313
  const state = await dictionary(entry.value);
@@ -60229,9 +60315,9 @@ async function* walkRetainedFonts(document2, storage, options) {
60229
60315
  if (gsFont?.kind === "array" && gsFont.items[0]) yield* font(gsFont.items[0], `ExtGS_${entry.key.decoded}`, depth);
60230
60316
  }
60231
60317
  for (const key of ["XObject", "Pattern"]) {
60232
- const objects = await dictionary(dictGet(value, key));
60318
+ const objects = await dictionary(dictGet(value, key), key);
60233
60319
  if (!objects) continue;
60234
- for (const entry of objects.entries) {
60320
+ for await (const entry of readPdfDictionaryEntries(objects, options.signal)) {
60235
60321
  if (entry.value.kind === "ref" && !(await names.intern(`form:${entry.value.objectNumber}`)).added) continue;
60236
60322
  const resolved = await document2.lookup(entry.value);
60237
60323
  if (!resolved?.stream || resolved.value.kind !== "dict") continue;
@@ -60815,6 +60901,29 @@ var PdfRetainedDocument = class _PdfRetainedDocument {
60815
60901
  const work = visit(this);
60816
60902
  return work;
60817
60903
  }
60904
+ outlineDetails() {
60905
+ async function* visit(doc) {
60906
+ doc.assertOpen();
60907
+ doc.walks.add(work);
60908
+ const storage = new PdfStagingStorage(doc.storage, doc.options.maxTraversalStagingBytes);
60909
+ const outlines = new PdfMergeOutlines(storage, doc.options.signal, Infinity);
60910
+ let failed = false;
60911
+ try {
60912
+ await outlines.append(doc, 0, false, true);
60913
+ yield* outlines.details();
60914
+ } catch (error) {
60915
+ failed = true;
60916
+ throw error;
60917
+ } finally {
60918
+ doc.walks.delete(work);
60919
+ await outlines.close().catch((error) => {
60920
+ if (!failed) throw error;
60921
+ });
60922
+ }
60923
+ }
60924
+ const work = visit(this);
60925
+ return work;
60926
+ }
60818
60927
  pageLabels() {
60819
60928
  async function* visit(doc) {
60820
60929
  doc.assertOpen();
@@ -62280,6 +62389,9 @@ async function* saveRetainedDocumentChunks(document2, storage, options = {}) {
62280
62389
  }
62281
62390
  }
62282
62391
 
62392
+ // packages/pdf-ast/src/edit/retained-info-updates.ts
62393
+ import { PagedStorage as PagedStorage14 } from "@poe-platform/safe-fs/storage";
62394
+
62283
62395
  // packages/pdf-ast/src/edit/retained-bookmarks.ts
62284
62396
  import { PagedStorage as PagedStorage13 } from "@poe-platform/safe-fs/storage";
62285
62397
  async function setRetainedBookmarks(store, storage, root, pageCount, pageReference, bookmarks, signal, maxDepth = Infinity) {
@@ -62357,6 +62469,126 @@ async function setRetainedBookmarks(store, storage, root, pageCount, pageReferen
62357
62469
  }
62358
62470
  }
62359
62471
 
62472
+ // packages/pdf-ast/src/edit/retained-info-updates.ts
62473
+ async function applyRetainedInfoUpdates(document2, store, storage, count, getPage, updates, signal, maxDepth) {
62474
+ const pages = new PagedStorage14({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4);
62475
+ const base = pages.allocate(count * 4 * 48), heads = [-1, -1, -1, -1], tails = [-1, -1, -1, -1];
62476
+ const labels = new PdfMutableObjectStore(storage, { signal }), bookmarks = new PdfMutableObjectStore(storage, { signal });
62477
+ let infoRef = document2.crossReference.infoRef, idArray = document2.crossReference.idArray, labelCount = 0, work = 0, failed = false;
62478
+ const rootRef = document2.crossReference.rootRef;
62479
+ async function checkpoint() {
62480
+ signal.throwIfAborted();
62481
+ if (++work % 64 === 0) await new Promise((resolve2) => setTimeout(resolve2, 0));
62482
+ signal.throwIfAborted();
62483
+ }
62484
+ const position = (group, index2) => base + (group * count + index2) * 48;
62485
+ try {
62486
+ for await (const update of updates) {
62487
+ await checkpoint();
62488
+ if (update.kind === "info") {
62489
+ const standard = ["Title", "Author", "Subject", "Keywords", "Creator", "Producer"].includes(update.key);
62490
+ let info3 = infoRef ? await store.get(infoRef.objectNumber) : void 0;
62491
+ if (infoRef && info3?.value.kind !== "dict") {
62492
+ const resolved = await document2.lookup(infoRef);
62493
+ if (resolved?.value.kind === "dict" && resolved.reference) info3 = await store.get(resolved.reference.objectNumber);
62494
+ }
62495
+ if (!infoRef || standard && info3?.value.kind !== "dict") {
62496
+ infoRef = await store.allocate(cosDict(!standard ? { Title: cosString("") } : {}));
62497
+ info3 = await store.get(infoRef.objectNumber);
62498
+ }
62499
+ if (info3?.value.kind === "dict") {
62500
+ dictSet(info3.value, update.key, cosString(update.value));
62501
+ await store.set(info3);
62502
+ }
62503
+ } else if (update.kind === "id") {
62504
+ if (idArray === document2.crossReference.idArray) {
62505
+ const first = await document2.lookup(idArray?.items[0]), second = await document2.lookup(idArray?.items[1]);
62506
+ const a = first?.value.kind === "string" ? first.value.bytes : new Uint8Array(16), b = second?.value.kind === "string" ? second.value.bytes : a;
62507
+ idArray = cosArray([cosHexString(a), cosHexString(b)]);
62508
+ }
62509
+ idArray.items[update.index] = cosHexString(new Uint8Array(update.bytes));
62510
+ } else if (update.kind === "page") {
62511
+ const index2 = update.pageNumber - 1;
62512
+ if (!Number.isSafeInteger(index2) || index2 < 0 || index2 >= count) continue;
62513
+ const group = ["rotation", "dimensions", "media", "crop"].indexOf(update.property), size = group === 0 ? 1 : group === 1 ? 2 : 4;
62514
+ if (update.values.length !== size || !update.values.every(Number.isFinite)) throw new RangeError("Invalid page property values");
62515
+ const offset = position(group, index2), bytes = await pages.read(offset, 48), view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
62516
+ if (!view.getFloat64(0)) {
62517
+ view.setFloat64(0, 1);
62518
+ view.setFloat64(8, -1);
62519
+ if (tails[group] >= 0) {
62520
+ const link2 = new Uint8Array(8);
62521
+ new DataView(link2.buffer).setFloat64(0, index2);
62522
+ await pages.write(position(group, tails[group]) + 8, link2);
62523
+ } else heads[group] = index2;
62524
+ tails[group] = index2;
62525
+ }
62526
+ for (let i = 0; i < size; i++) view.setFloat64(16 + i * 8, update.values[i]);
62527
+ await pages.write(offset, bytes);
62528
+ } else if (update.kind === "label") {
62529
+ const value = cosDict({ St: cosNumber(update.start) });
62530
+ if (update.prefix) dictSet(value, "P", cosString(update.prefix));
62531
+ if (update.style) dictSet(value, "S", cosName(update.style));
62532
+ await labels.allocate(cosArray([cosNumber(update.index), value]));
62533
+ labelCount++;
62534
+ } else await bookmarks.allocate(cosArray([cosString(update.title), cosNumber(update.level), cosNumber(update.pageNumber)]));
62535
+ }
62536
+ for (let group = 0; group < 4; group++) for (let index2 = heads[group]; index2 >= 0; ) {
62537
+ await checkpoint();
62538
+ const bytes = await pages.read(position(group, index2), 48), view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length), page2 = await getPage(index2);
62539
+ if (group === 0) dictSet(page2.dict, "Rotate", cosNumber((Math.round(view.getFloat64(16) / 90) * 90 % 360 + 360) % 360));
62540
+ else {
62541
+ const values = group === 1 ? [0, 0, view.getFloat64(16), view.getFloat64(24)] : [16, 24, 32, 40].map((offset) => view.getFloat64(offset));
62542
+ dictSet(page2.dict, group === 3 ? "CropBox" : "MediaBox", cosArray(values.map((value) => cosNumber(value))));
62543
+ }
62544
+ await store.set({ objectNumber: page2.reference.objectNumber, generationNumber: page2.reference.generationNumber, value: page2.dict });
62545
+ index2 = view.getFloat64(8);
62546
+ }
62547
+ if (labelCount) {
62548
+ const root = await store.get(rootRef.objectNumber);
62549
+ if (root?.value.kind === "dict") {
62550
+ const ref = await store.allocate(cosDict({}));
62551
+ dictSet(root.value, "PageLabels", ref);
62552
+ await store.set(root);
62553
+ async function* chunks() {
62554
+ const encoder = new TextEncoder();
62555
+ yield encoder.encode("<<\n/Nums [ ");
62556
+ for await (const object of labels.objects()) {
62557
+ await checkpoint();
62558
+ if (object.value.kind !== "array") throw new Error("Invalid label record");
62559
+ for (const node of object.value.items) {
62560
+ yield* serializeCosNodeChunks(node, { signal });
62561
+ yield encoder.encode(" ");
62562
+ }
62563
+ }
62564
+ yield encoder.encode("]\n>>");
62565
+ }
62566
+ let length = 0;
62567
+ for await (const bytes of chunks()) length += bytes.length;
62568
+ await store.setSerializedValue({ objectNumber: ref.objectNumber, generationNumber: 0, body: { length, chunks: chunks() } });
62569
+ }
62570
+ }
62571
+ async function* outlineUpdates() {
62572
+ for await (const object of bookmarks.objects()) {
62573
+ await checkpoint();
62574
+ const value = object.value;
62575
+ if (value.kind !== "array" || value.items[0]?.kind !== "string" || value.items[1]?.kind !== "number" || value.items[2]?.kind !== "number") throw new Error("Invalid bookmark record");
62576
+ yield { title: decodePdfString(value.items[0]), level: value.items[1].value, pageNumber: value.items[2].value };
62577
+ }
62578
+ }
62579
+ await setRetainedBookmarks(store, storage, rootRef, count, async (index2) => (await getPage(index2)).reference, outlineUpdates(), signal, maxDepth);
62580
+ return { infoRef, idArray };
62581
+ } catch (error) {
62582
+ failed = true;
62583
+ throw error;
62584
+ } finally {
62585
+ const results = await Promise.allSettled([pages.close(), labels.close(), bookmarks.close()]);
62586
+ if (!failed) {
62587
+ for (const result of results) if (result.status === "rejected") await Promise.reject(result.reason);
62588
+ }
62589
+ }
62590
+ }
62591
+
62360
62592
  // packages/pdf-ast/src/edit/retained-append-attachments.ts
62361
62593
  async function appendRetainedAttachments(document2, target, storage, attachments, options = {}) {
62362
62594
  const signal = options.signal ?? new AbortController().signal, appended = new PdfMutableObjectStore(storage, { signal });
@@ -62481,7 +62713,7 @@ async function appendRetainedAttachments(document2, target, storage, attachments
62481
62713
  }
62482
62714
 
62483
62715
  // packages/pdf-ast/src/edit/retained-form-appearances.ts
62484
- import { IntegerTable as IntegerTable8, PagedStorage as PagedStorage14 } from "@poe-platform/safe-fs/storage";
62716
+ import { IntegerTable as IntegerTable8, PagedStorage as PagedStorage15 } from "@poe-platform/safe-fs/storage";
62485
62717
 
62486
62718
  // packages/pdf-ast/src/edit/form-appearance-chunks.ts
62487
62719
  function* serializeFormAppearanceChunks(text, options) {
@@ -62567,10 +62799,11 @@ function* operators(text, options) {
62567
62799
  }
62568
62800
 
62569
62801
  // packages/pdf-ast/src/edit/retained-form-appearances.ts
62570
- async function generateRetainedFormAppearances(document2, store, storage, signal) {
62802
+ async function generateRetainedFormAppearances(document2, store, storage, signal, update) {
62571
62803
  if (!document2.crossReference.rootRef) return;
62572
- const backing = new PagedStorage14({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4), active = new IntegerTable8(backing);
62804
+ const backing = new PagedStorage15({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4), active = new IntegerTable8(backing);
62573
62805
  let head = -1, failed = false, work = 0;
62806
+ let matched = false;
62574
62807
  let defaultAppearance;
62575
62808
  async function checkpoint(depth = 0) {
62576
62809
  signal.throwIfAborted();
@@ -62672,14 +62905,30 @@ async function generateRetainedFormAppearances(document2, store, storage, signal
62672
62905
  return "Yes";
62673
62906
  }
62674
62907
  try {
62675
- const form = await locate(formLocation);
62908
+ let form = await locate(formLocation);
62909
+ if (update && form?.value.kind !== "dict") {
62910
+ const catalog = await locate(root);
62911
+ if (catalog?.value.kind !== "dict") return;
62912
+ dictSet(catalog.value, "AcroForm", await store.allocate(cosDict({ Fields: cosArray([]), NeedAppearances: cosBool(true) })));
62913
+ await store.set(catalog.owner);
62914
+ form = await locate(formLocation);
62915
+ }
62676
62916
  if (form?.value.kind !== "dict") return;
62917
+ if (update) {
62918
+ dictSet(form.value, "NeedAppearances", cosBool(true));
62919
+ await store.set(form.owner);
62920
+ const fields3 = await locate(child(form.location, "Fields"));
62921
+ if (fields3?.value.kind !== "array") {
62922
+ dictSet(form.value, "Fields", cosArray([]));
62923
+ await store.set(form.owner);
62924
+ }
62925
+ }
62677
62926
  defaultAppearance = dictGet(form.value, "DA");
62678
62927
  const need = await resolve2(dictGet(form.value, "NeedAppearances")), force = need?.kind === "boolean" && need.value;
62679
62928
  const fields2 = await locate(child(form.location, "Fields"));
62680
62929
  if (fields2?.value.kind === "array") for (let i = fields2.value.items.length - 1; i >= 0; i--) {
62681
62930
  await checkpoint();
62682
- await push({ location: itemLocation(fields2.location, i, fields2.value.items[i]), named: false, ft: "", ff: 0, q: 0, depth: 0 });
62931
+ await push({ location: itemLocation(fields2.location, i, fields2.value.items[i]), named: "", ft: "", ff: 0, q: 0, depth: 0 });
62683
62932
  }
62684
62933
  while (head !== -1) {
62685
62934
  const record = await readStoredRecord(backing, head, signal);
@@ -62699,7 +62948,8 @@ async function generateRetainedFormAppearances(document2, store, storage, signal
62699
62948
  await push({ exit: id });
62700
62949
  }
62701
62950
  const name = await resolve2(dictGet(field2.value, "T")), ft = await resolve2(dictGet(field2.value, "FT"));
62702
- const named = frame.named || (name?.kind === "name" ? !!name.decoded : name?.kind === "string" ? !!decodePdfString(name) : false);
62951
+ const partial = name?.kind === "name" ? name.decoded : name?.kind === "string" ? decodePdfString(name) : "";
62952
+ const named = update ? frame.named && partial ? `${frame.named}.${partial}` : partial || frame.named : frame.named || partial ? "1" : "";
62703
62953
  const inherited = { ...frame, named, ft: ft?.kind === "name" ? ft.decoded : frame.ft, ff: await number(dictGet(field2.value, "Ff"), frame.ff), q: await number(dictGet(field2.value, "Q"), frame.q) };
62704
62954
  const maxLen = await resolve2(dictGet(field2.value, "MaxLen"));
62705
62955
  if (maxLen?.kind === "number") inherited.maxLen = maxLen.value;
@@ -62723,6 +62973,70 @@ async function generateRetainedFormAppearances(document2, store, storage, signal
62723
62973
  }
62724
62974
  }
62725
62975
  if (!named) continue;
62976
+ if (update) {
62977
+ if (named !== update.name) continue;
62978
+ matched = true;
62979
+ const value2 = update.value;
62980
+ if (typeof value2 === "boolean" || inherited.ft === "Btn") {
62981
+ const on = await onValue(field2.location);
62982
+ const checked = typeof value2 === "boolean" ? value2 : value2 !== "Off" && value2 !== "false" && value2 !== "0" && value2 !== "";
62983
+ const chosen = typeof value2 === "string" && value2 !== "true" && value2 !== "false" && value2 !== "Off" ? value2 : on;
62984
+ const state = cosName(checked ? chosen : "Off");
62985
+ dictSet(field2.value, "FT", cosName("Btn"));
62986
+ dictSet(field2.value, "V", state);
62987
+ dictSet(field2.value, "AS", state);
62988
+ await store.set(field2.owner);
62989
+ if (kids?.value.kind === "array") for (let i = 0; i < kids.value.items.length; i++) {
62990
+ await checkpoint();
62991
+ const kid = await locate(itemLocation(kids.location, i, kids.value.items[i]));
62992
+ if (kid?.value.kind !== "dict") continue;
62993
+ const normal = await locate(child(child(kid.location, "AP"), "N"));
62994
+ const selected2 = normal?.value.kind === "dict" && normal.value.entries.length ? cosName(checked && dictGet(normal.value, chosen) !== void 0 ? chosen : "Off") : state;
62995
+ dictSet(kid.value, "AS", selected2);
62996
+ await store.set(kid.owner);
62997
+ }
62998
+ continue;
62999
+ }
63000
+ if (!inherited.ft) dictSet(field2.value, "FT", cosName("Tx"));
63001
+ let text2 = String(value2);
63002
+ const multi = inherited.ft === "Ch" && !!(inherited.ff & 1 << 21) && text2.includes(",");
63003
+ const selected = multi ? text2.split(",").map((value3) => value3.trim()).filter(Boolean) : [text2];
63004
+ dictSet(field2.value, "V", multi ? cosArray(selected.map((value3) => cosString(value3))) : cosString(text2));
63005
+ if (inherited.ft === "Ch") {
63006
+ const choices = await resolve2(dictGet(field2.value, "Opt")), indices = [];
63007
+ if (choices?.kind === "array") for (let i = 0; i < choices.items.length; i++) {
63008
+ await checkpoint();
63009
+ const option = await resolve2(choices.items[i]);
63010
+ let exported = "", label = "", valid = false;
63011
+ if (option?.kind === "string") {
63012
+ exported = decodePdfString(option);
63013
+ label = exported;
63014
+ valid = true;
63015
+ } else if (option?.kind === "array" && option.items.length >= 2) {
63016
+ const first = await resolve2(option.items[0]), second = await resolve2(option.items[1]);
63017
+ exported = first?.kind === "string" ? decodePdfString(first) : "";
63018
+ label = second?.kind === "string" ? decodePdfString(second) : "";
63019
+ valid = true;
63020
+ }
63021
+ if (valid && (selected.includes(exported) || selected.includes(label))) {
63022
+ indices.push(i);
63023
+ if (!multi) {
63024
+ if (label) text2 = label;
63025
+ break;
63026
+ }
63027
+ }
63028
+ }
63029
+ if (indices.length) dictSet(field2.value, "I", cosArray(indices.map((value3) => cosNumber(value3))));
63030
+ }
63031
+ await store.set(field2.owner);
63032
+ await synthesize(field2.location, text2, inherited);
63033
+ if (kids?.value.kind === "array") for (let i = 0; i < kids.value.items.length; i++) {
63034
+ await checkpoint();
63035
+ const kid = await locate(itemLocation(kids.location, i, kids.value.items[i]));
63036
+ if (kid?.value.kind === "dict" && !dictGet(kid.value, "T")) await synthesize(kid.location, text2, inherited);
63037
+ }
63038
+ continue;
63039
+ }
62726
63040
  const value = await resolve2(dictGet(field2.value, "V"));
62727
63041
  if (!value) continue;
62728
63042
  const appearance = await resolve2(dictGet(field2.value, "AP")), hasNormal = appearance?.kind === "dict" && dictGet(appearance, "N") !== void 0;
@@ -62760,9 +63074,18 @@ async function generateRetainedFormAppearances(document2, store, storage, signal
62760
63074
  if (kid?.value.kind === "dict" && !dictGet(kid.value, "T")) await synthesize(kid.location, text, inherited);
62761
63075
  }
62762
63076
  }
63077
+ if (update && !matched) {
63078
+ const fields3 = await locate(child(formLocation, "Fields"));
63079
+ if (fields3?.value.kind === "array") {
63080
+ const value = update.value;
63081
+ const field2 = typeof value === "boolean" ? cosDict({ FT: cosName("Btn"), T: cosString(update.name), V: cosName(value ? "Yes" : "Off"), AS: cosName(value ? "Yes" : "Off") }) : cosDict({ FT: cosName("Tx"), T: cosString(update.name), V: cosString(value) });
63082
+ fields3.value.items.push(await store.allocate(field2));
63083
+ await store.set(fields3.owner);
63084
+ }
63085
+ }
62763
63086
  const latest = await locate(formLocation);
62764
63087
  if (latest?.value.kind === "dict") {
62765
- dictSet(latest.value, "NeedAppearances", cosBool(false));
63088
+ dictSet(latest.value, "NeedAppearances", cosBool(!!update));
62766
63089
  await store.set(latest.owner);
62767
63090
  }
62768
63091
  } catch (error) {
@@ -62776,16 +63099,16 @@ async function generateRetainedFormAppearances(document2, store, storage, signal
62776
63099
  }
62777
63100
 
62778
63101
  // packages/pdf-ast/src/edit/retained-flatten-annotations.ts
62779
- import { IntegerTable as IntegerTable10, PagedStorage as PagedStorage18 } from "@poe-platform/safe-fs/storage";
63102
+ import { IntegerTable as IntegerTable10, PagedStorage as PagedStorage19 } from "@poe-platform/safe-fs/storage";
62780
63103
 
62781
63104
  // packages/pdf-ast/src/edit/retained-content-edit.ts
62782
- import { IntegerTable as IntegerTable9, PagedStorage as PagedStorage15 } from "@poe-platform/safe-fs/storage";
63105
+ import { IntegerTable as IntegerTable9, PagedStorage as PagedStorage16 } from "@poe-platform/safe-fs/storage";
62783
63106
  var RetainedContentEditor = class _RetainedContentEditor {
62784
63107
  constructor(store, storage, signal) {
62785
63108
  this.store = store;
62786
63109
  this.storage = storage;
62787
63110
  this.signal = signal;
62788
- this.backing = new PagedStorage15({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4);
63111
+ this.backing = new PagedStorage16({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4);
62789
63112
  this.counts = new IntegerTable9(this.backing);
62790
63113
  this.identities = new PdfNameIndex(storage, Infinity, signal);
62791
63114
  }
@@ -62857,14 +63180,14 @@ var RetainedContentEditor = class _RetainedContentEditor {
62857
63180
  };
62858
63181
 
62859
63182
  // packages/pdf-ast/src/edit/retained-name-replacement.ts
62860
- import { PagedStorage as PagedStorage16 } from "@poe-platform/safe-fs/storage";
63183
+ import { PagedStorage as PagedStorage17 } from "@poe-platform/safe-fs/storage";
62861
63184
  async function* replaceRetainedPdfName(input, oldName, newName, storage, options = {}) {
62862
63185
  const chunkBytes = options.chunkBytes ?? 16384, maximum10 = options.maxOutputBytes ?? Infinity;
62863
63186
  if (!Number.isSafeInteger(chunkBytes) || chunkBytes < 1) throw new RangeError("Invalid name replacement chunk size");
62864
63187
  if (maximum10 !== Infinity && (!Number.isSafeInteger(maximum10) || maximum10 < 0)) throw new RangeError("Invalid name replacement output limit");
62865
63188
  const signal = options.signal ?? new AbortController().signal;
62866
63189
  signal.throwIfAborted();
62867
- const table = new PagedStorage16({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4), length = oldName.length + 1;
63190
+ const table = new PagedStorage17({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4), length = oldName.length + 1;
62868
63191
  const base = table.allocate(length * 8), record = new Uint8Array(8), view = new DataView(record.buffer);
62869
63192
  const pattern = (at) => at ? oldName.charCodeAt(at - 1) : 47;
62870
63193
  let buffer = new Uint8Array(chunkBytes), used = 0, total = 0, work = 0, failed = false;
@@ -62942,10 +63265,10 @@ async function* replaceRetainedPdfName(input, oldName, newName, storage, options
62942
63265
  }
62943
63266
 
62944
63267
  // packages/pdf-ast/src/edit/retained-draw-text.ts
62945
- import { PagedStorage as PagedStorage17 } from "@poe-platform/safe-fs/storage";
63268
+ import { PagedStorage as PagedStorage18 } from "@poe-platform/safe-fs/storage";
62946
63269
  async function drawRetainedAnnotationText(page2, editor, storage, text, x, y, isolated, font, signal) {
62947
63270
  const source = await PdfFileSource.fromStream(storage.fs, storage.directory, page2.streamContents(), { signal });
62948
- const backing = new PagedStorage17({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4);
63271
+ const backing = new PagedStorage18({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4);
62949
63272
  let failed = false;
62950
63273
  try {
62951
63274
  const name = await font(), position = backing.allocate(text.length);
@@ -63021,7 +63344,7 @@ async function flattenRetainedAnnotations(document2, store, storage, mode, signa
63021
63344
  for await (const page2 of document2.pages()) {
63022
63345
  const annotations = await array(dictGet(page2.dict, "Annots"));
63023
63346
  if (!annotations) continue;
63024
- const survivorStorage = new PagedStorage18({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4);
63347
+ const survivorStorage = new PagedStorage19({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4);
63025
63348
  const survivorBase = survivorStorage.allocate(0);
63026
63349
  let pageFailed = false;
63027
63350
  try {
@@ -63107,7 +63430,7 @@ async function flattenRetainedAnnotations(document2, store, storage, mode, signa
63107
63430
  }
63108
63431
  if (normal?.stream && normal.reference && normal.value.kind === "dict") {
63109
63432
  let content = await PdfFileSource.fromStream(storage.fs, storage.directory, document2.objects.decodeStream(normal.reference.objectNumber, normal.reference.generationNumber), { signal });
63110
- const backing = new PagedStorage18({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4), renames = new IntegerTable10(backing), names = new PdfNameIndex(storage, Infinity, signal);
63433
+ const backing = new PagedStorage19({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4), renames = new IntegerTable10(backing), names = new PdfNameIndex(storage, Infinity, signal);
63111
63434
  let appearanceFailed = false, count = 0;
63112
63435
  try {
63113
63436
  if (content.size) {
@@ -63226,11 +63549,11 @@ q ${scaleX} 0 0 ${scaleY} ${tx} ${ty} cm${matSuffix}
63226
63549
  }
63227
63550
 
63228
63551
  // packages/pdf-ast/src/edit/retained-name-map.ts
63229
- import { PagedStorage as PagedStorage19 } from "@poe-platform/safe-fs/storage";
63552
+ import { PagedStorage as PagedStorage20 } from "@poe-platform/safe-fs/storage";
63230
63553
  async function* replaceRetainedPdfNames(input, names, storage, options = {}) {
63231
63554
  const signal = options.signal ?? new AbortController().signal, size = options.chunkBytes ?? 16384;
63232
63555
  if (!Number.isSafeInteger(size) || size < 1) throw new RangeError("Invalid name replacement chunk size");
63233
- const trie = new PagedStorage19({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4), pending = new PagedStorage19({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4);
63556
+ const trie = new PagedStorage20({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4), pending = new PagedStorage20({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4);
63234
63557
  const root = trie.allocate(40), prefixBase = pending.allocate(0);
63235
63558
  let output = new Uint8Array(size), used = 0, failed = false, work = 0;
63236
63559
  const body = (byte3) => byte3 >= 48 && byte3 <= 57 || byte3 >= 65 && byte3 <= 90 || byte3 >= 97 && byte3 <= 122 || [95, 46, 43, 45].includes(byte3);
@@ -63512,7 +63835,7 @@ async function preserveRetainedStamp(document2, source, page2, other, store, edi
63512
63835
  }
63513
63836
 
63514
63837
  // packages/pdf-ast/src/edit/retained-stamps.ts
63515
- import { IntegerTable as IntegerTable11, PagedStorage as PagedStorage20 } from "@poe-platform/safe-fs/storage";
63838
+ import { IntegerTable as IntegerTable11, PagedStorage as PagedStorage21 } from "@poe-platform/safe-fs/storage";
63516
63839
  async function stampRetainedPages(document2, store, storage, getPage, stamps, signal) {
63517
63840
  const editor = await RetainedContentEditor.open(store, storage, signal);
63518
63841
  let counter = 1, failed = false, work = 0;
@@ -63523,7 +63846,7 @@ async function stampRetainedPages(document2, store, storage, getPage, stamps, si
63523
63846
  try {
63524
63847
  for await (const stamp of stamps) {
63525
63848
  const source = await editRetainedDocument(stamp.source, storage, { signal });
63526
- const backing = new PagedStorage20({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4), memo = new IntegerTable11(backing);
63849
+ const backing = new PagedStorage21({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4), memo = new IntegerTable11(backing);
63527
63850
  let stampFailed = false;
63528
63851
  async function clone(node, depth = 0) {
63529
63852
  await checkpoint();
@@ -63709,12 +64032,12 @@ ${fmt6(s)} 0 0 ${fmt6(s)} ${fmt4(tx)} ${fmt4(ty)} cm
63709
64032
  }
63710
64033
 
63711
64034
  // packages/pdf-ast/src/edit/retained-inline-images.ts
63712
- import { PagedStorage as PagedStorage21 } from "@poe-platform/safe-fs/storage";
64035
+ import { PagedStorage as PagedStorage22 } from "@poe-platform/safe-fs/storage";
63713
64036
  async function externalizeRetainedInlineImages(document2, store, storage, options, signal) {
63714
64037
  const minimum = options.minBytes ?? 1024;
63715
64038
  if (!Number.isSafeInteger(minimum) || minimum < 0) throw new RangeError("Invalid inline-image minimum size");
63716
64039
  const editor = await RetainedContentEditor.open(store, storage, signal);
63717
- const paths = new PagedStorage21({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4);
64040
+ const paths = new PagedStorage22({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4);
63718
64041
  const keys = { BPC: "BitsPerComponent", CS: "ColorSpace", D: "Decode", DP: "DecodeParms", F: "Filter", H: "Height", IM: "ImageMask", I: "Interpolate", W: "Width" };
63719
64042
  const colors = { G: "DeviceGray", RGB: "DeviceRGB", CMYK: "DeviceCMYK", I: "Indexed" };
63720
64043
  const filters = { AHx: "ASCIIHexDecode", A85: "ASCII85Decode", LZW: "LZWDecode", Fl: "FlateDecode", RL: "RunLengthDecode", CCF: "CCITTFaxDecode", DCT: "DCTDecode" };
@@ -63806,7 +64129,7 @@ async function externalizeRetainedInlineImages(document2, store, storage, option
63806
64129
  }
63807
64130
 
63808
64131
  // packages/pdf-ast/src/edit/retained-resource-pruning.ts
63809
- import { IntegerTable as IntegerTable12, PagedStorage as PagedStorage22 } from "@poe-platform/safe-fs/storage";
64132
+ import { IntegerTable as IntegerTable12, PagedStorage as PagedStorage23 } from "@poe-platform/safe-fs/storage";
63810
64133
  async function collectNames(input, names, found, signal) {
63811
64134
  const iterator = input[Symbol.asyncIterator](), pending = [];
63812
64135
  let chunk = new Uint8Array(), at = 0, ended = false, changed = false, work = 0, failed = false;
@@ -63888,7 +64211,7 @@ async function pruneRetainedResources(document2, store, storage, signal) {
63888
64211
  return { ...found2, value: same(page2.reference) ? page2.dict : same(resources?.reference) ? resources.value : found2.value };
63889
64212
  }
63890
64213
  const names = new PdfNameIndex(storage, Infinity, signal), visitedNames = new PdfNameIndex(storage, Infinity, signal);
63891
- const backing = new PagedStorage22({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4), found = new IntegerTable12(backing);
64214
+ const backing = new PagedStorage23({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4), found = new IntegerTable12(backing);
63892
64215
  let failed = false;
63893
64216
  try {
63894
64217
  const referenced = async (name) => await found.get(BigInt((await names.intern(name)).index)) !== void 0;
@@ -64018,7 +64341,7 @@ async function flattenRetainedRotations(document2, store, storage, signal) {
64018
64341
  }
64019
64342
 
64020
64343
  // packages/pdf-ast/src/edit/retained-attachment-edits.ts
64021
- import { IntegerTable as IntegerTable13, PagedStorage as PagedStorage23 } from "@poe-platform/safe-fs/storage";
64344
+ import { IntegerTable as IntegerTable13, PagedStorage as PagedStorage24 } from "@poe-platform/safe-fs/storage";
64022
64345
  var PdfDuplicateAttachment = class extends PdfError {
64023
64346
  constructor(key) {
64024
64347
  super("E_CAPABILITY", `Duplicate attachment key: ${key}`);
@@ -64029,7 +64352,7 @@ var PdfDuplicateAttachment = class extends PdfError {
64029
64352
  async function editRetainedAttachments(document2, target, storage, remove, additions, signal, preserveTree = false) {
64030
64353
  const pairs = new PdfMutableObjectStore(storage, { signal });
64031
64354
  const names = new PdfNameIndex(storage, Infinity, signal), removed = new PdfNameIndex(storage, Infinity, signal);
64032
- const backing = new PagedStorage23({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4), first = new IntegerTable13(backing), removals = new IntegerTable13(backing);
64355
+ const backing = new PagedStorage24({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4), first = new IntegerTable13(backing), removals = new IntegerTable13(backing);
64033
64356
  let failed = false, count = 0, work = 0;
64034
64357
  async function checkpoint() {
64035
64358
  signal.throwIfAborted();
@@ -64231,13 +64554,13 @@ async function* retainedAttachmentNameTokens(document2, storage, root, signal, r
64231
64554
  }
64232
64555
 
64233
64556
  // packages/pdf-ast/src/edit/retained-graph.ts
64234
- import { PagedStorage as PagedStorage24 } from "@poe-platform/safe-fs/storage";
64557
+ import { PagedStorage as PagedStorage25 } from "@poe-platform/safe-fs/storage";
64235
64558
  async function editRetainedDocument(source, storage, options = {}) {
64236
64559
  if (options.maxPages !== void 0 && options.maxPages !== Infinity && (!Number.isSafeInteger(options.maxPages) || options.maxPages < 0)) throw new RangeError("Invalid page limit");
64237
64560
  if (options.maxRecursionDepth !== void 0 && options.maxRecursionDepth !== Infinity && (!Number.isSafeInteger(options.maxRecursionDepth) || options.maxRecursionDepth < 1)) throw new RangeError("Invalid edit depth");
64238
64561
  const signal = options.signal ?? new AbortController().signal;
64239
64562
  const store = new PdfMutableObjectStore(storage, { ...options, signal });
64240
- const pages = new PagedStorage24({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4);
64563
+ const pages = new PagedStorage25({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4);
64241
64564
  const base = pages.allocate(0);
64242
64565
  let count = 0, document2;
64243
64566
  let closing;
@@ -64286,6 +64609,14 @@ async function editRetainedDocument(source, storage, options = {}) {
64286
64609
  ...options.maxRecursionDepth === void 0 ? {} : { maxRecursionDepth: options.maxRecursionDepth }
64287
64610
  };
64288
64611
  document2 = await PdfRetainedDocument.openStore(store, storage, { ...configured, ...infoRef ? { infoRef } : {} });
64612
+ if (options.infoUpdates) {
64613
+ const updated = await applyRetainedInfoUpdates(document2, store, storage, count, getPage, options.infoUpdates, signal, options.maxRecursionDepth);
64614
+ infoRef = updated.infoRef;
64615
+ if (updated.idArray) configured.idArray = updated.idArray;
64616
+ await document2.close();
64617
+ document2 = await PdfRetainedDocument.openStore(store, storage, { ...configured, ...infoRef ? { infoRef } : {} });
64618
+ addedObjects = true;
64619
+ }
64289
64620
  for await (const edit of options.rotations ?? []) {
64290
64621
  signal.throwIfAborted();
64291
64622
  if (!Number.isSafeInteger(edit.pageIndex) || edit.pageIndex < 0 || edit.pageIndex >= count) throw new RangeError("Page index out of bounds");
@@ -64348,13 +64679,17 @@ async function editRetainedDocument(source, storage, options = {}) {
64348
64679
  await setRetainedBookmarks(store, storage, source.crossReference.rootRef, count, reference, options.bookmarks, signal, options.maxRecursionDepth);
64349
64680
  addedObjects = true;
64350
64681
  }
64682
+ for await (const update of options.formUpdates ?? []) {
64683
+ await generateRetainedFormAppearances(document2, store, storage, signal, update);
64684
+ addedObjects = true;
64685
+ }
64351
64686
  if (options.generateAppearances && !options.removeAcroform) {
64352
64687
  await generateRetainedFormAppearances(document2, store, storage, signal);
64353
64688
  addedObjects = true;
64354
64689
  }
64355
64690
  if (options.removeInfo) {
64356
64691
  await removeRoot(["Metadata"]);
64357
- const found = await document2.lookup(source.crossReference.infoRef);
64692
+ const found = await document2.lookup(infoRef);
64358
64693
  if (found?.value.kind === "dict" && !found.stream && found.reference) {
64359
64694
  const date = dictGet(found.value, "ModDate");
64360
64695
  found.value.entries.length = 0;
@@ -64459,9 +64794,9 @@ async function* copyRetainedAttachments(document2, storage, options = {}) {
64459
64794
  }
64460
64795
 
64461
64796
  // packages/pdf-ast/src/cos/retained-object-order.ts
64462
- import { IntegerTable as IntegerTable14, PagedStorage as PagedStorage25 } from "@poe-platform/safe-fs/storage";
64797
+ import { IntegerTable as IntegerTable14, PagedStorage as PagedStorage26 } from "@poe-platform/safe-fs/storage";
64463
64798
  async function* retainedObjectOrder(document2, source, storage, signal) {
64464
- const backing = new PagedStorage25({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4);
64799
+ const backing = new PagedStorage26({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4);
64465
64800
  const seen = new IntegerTable14(backing), streams = new IntegerTable14(backing);
64466
64801
  let failed = false, work = 0;
64467
64802
  async function candidate(number) {
@@ -64598,12 +64933,12 @@ async function* encryptRetainedPdfChunks(source, storage, options = {}) {
64598
64933
  }
64599
64934
 
64600
64935
  // packages/pdf-ast/src/cos/qpdf-json-values.ts
64601
- import { IntegerTable as IntegerTable15, PagedStorage as PagedStorage26 } from "@poe-platform/safe-fs/storage";
64936
+ import { IntegerTable as IntegerTable15, PagedStorage as PagedStorage27 } from "@poe-platform/safe-fs/storage";
64602
64937
  var QpdfJsonValues = class _QpdfJsonValues {
64603
64938
  constructor(tree, storage, signal) {
64604
64939
  this.tree = tree;
64605
64940
  this.signal = signal;
64606
- this.scratch = new PagedStorage26({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4);
64941
+ this.scratch = new PagedStorage27({ fs: storage.fs, cwd: storage.directory, env: {}, signal }, 4);
64607
64942
  this.first = new IntegerTable15(this.scratch, 64);
64608
64943
  this.next = new IntegerTable15(this.scratch, 64);
64609
64944
  }
@@ -64996,13 +65331,13 @@ var QpdfJsonValues = class _QpdfJsonValues {
64996
65331
  };
64997
65332
 
64998
65333
  // packages/pdf-ast/src/cos/qpdf-json-document.ts
64999
- import { IntegerTable as IntegerTable16, PagedStorage as PagedStorage27 } from "@poe-platform/safe-fs/storage";
65334
+ import { IntegerTable as IntegerTable16, PagedStorage as PagedStorage28 } from "@poe-platform/safe-fs/storage";
65000
65335
  var QpdfJsonDocument = class _QpdfJsonDocument {
65001
65336
  constructor(storage, options = {}) {
65002
65337
  this.storage = storage;
65003
65338
  this.signal = options.signal ? AbortSignal.any([options.signal, this.controller.signal]) : this.controller.signal;
65004
65339
  this.store = new PdfMutableObjectStore(storage, { signal: this.signal });
65005
- this.backing = new PagedStorage27(
65340
+ this.backing = new PagedStorage28(
65006
65341
  { fs: storage.fs, cwd: storage.directory, env: {}, signal: this.signal },
65007
65342
  4
65008
65343
  );
@@ -65071,7 +65406,7 @@ var QpdfJsonDocument = class _QpdfJsonDocument {
65071
65406
  env: {},
65072
65407
  signal: this.signal
65073
65408
  };
65074
- const tape = new PagedStorage27(context, 4), scratch = new PagedStorage27(context, 4);
65409
+ const tape = new PagedStorage28(context, 4), scratch = new PagedStorage28(context, 4);
65075
65410
  let values, failed = false, work = 0;
65076
65411
  const cooperate = async (units = 1) => {
65077
65412
  this.signal.throwIfAborted();