@poe-platform/safe-bash 0.1.811 → 0.1.813

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 (351) hide show
  1. package/dist/audio-ast/id3-source.d.ts +27 -0
  2. package/dist/audio-ast/index.d.ts +5 -0
  3. package/dist/audio-ast/index.js +1001 -596
  4. package/dist/audio-ast/mp3-source.d.ts +18 -0
  5. package/dist/audio-ast/ogg-source.d.ts +25 -0
  6. package/dist/audio-ast/ogg-stream-source.d.ts +22 -0
  7. package/dist/audio-ast/vorbis.d.ts +14 -0
  8. package/dist/image-ast/index.js +139 -9
  9. package/dist/mp4-ast/containers/adapters.d.ts +7 -0
  10. package/dist/office-xml/retained-xml-document.d.ts +8 -0
  11. package/dist/pdf-ast/ast.d.ts +2 -0
  12. package/dist/pdf-ast/content/dictionary-cursor.d.ts +15 -0
  13. package/dist/pdf-ast/content/range-operator-parser.d.ts +4 -0
  14. package/dist/pdf-ast/content/stored-dictionary.d.ts +10 -0
  15. package/dist/pdf-ast/cos/lexer.d.ts +8 -5
  16. package/dist/pdf-ast/cos/object-reader.d.ts +4 -3
  17. package/dist/pdf-ast/cos/range-parser.d.ts +4 -0
  18. package/dist/pdf-ast/cos/retained-objects.d.ts +1 -0
  19. package/dist/pdf-ast/cos/retained-writer.d.ts +1 -0
  20. package/dist/pdf-ast/cos/value-parser.d.ts +32 -2
  21. package/dist/pdf-ast/edit/retained-append-attachments.d.ts +13 -0
  22. package/dist/pdf-ast/edit/retained-bookmarks.d.ts +13 -0
  23. package/dist/pdf-ast/edit/retained-graph.d.ts +6 -0
  24. package/dist/pdf-ast/edit/retained-save.d.ts +2 -0
  25. package/dist/pdf-ast/edit/retained-stamps.d.ts +9 -0
  26. package/dist/pdf-ast/extract/retained-form-field-details.d.ts +20 -0
  27. package/dist/pdf-ast/extract/retained-form-fields.d.ts +17 -4
  28. package/dist/pdf-ast/fonts/resolve.d.ts +3 -1
  29. package/dist/pdf-ast/index.d.ts +4 -1
  30. package/dist/pdf-ast/index.js +2127 -975
  31. package/dist/pdf-ast/retained-document.d.ts +4 -0
  32. package/dist/safe-bash/audio-ast.browser.js +7 -1
  33. package/dist/safe-bash/chunks/{chunk-HHSOUC3Z.js → chunk-HPQE675Q.js} +1 -1
  34. package/dist/safe-bash/chunks/{chunk-BUYRKFW2.js → chunk-I6ECNJMR.js} +1 -1
  35. package/dist/safe-bash/chunks/{pdftk-WRYEP3CA.js → pdftk-Y2TX74LY.js} +2 -1
  36. package/dist/safe-bash/command-chunks/biff-4ALVARRF-7SRX6R6N.js +5192 -0
  37. package/dist/safe-bash/command-chunks/{chunk-EHSM5ZQS.js → chunk-2DGJOOXM.js} +8 -8
  38. package/dist/safe-bash/command-chunks/{chunk-Q6S57NOQ.js → chunk-2E2H7MBH.js} +7 -7
  39. package/dist/safe-bash/command-chunks/{chunk-MMBZTYXO.js → chunk-2PQRZDNR.js} +221 -0
  40. package/dist/safe-bash/command-chunks/{chunk-5OO2P27R.js → chunk-2V6FOLXV.js} +78 -25
  41. package/dist/safe-bash/command-chunks/{chunk-56NYSX65.js → chunk-2Z3WRRFT.js} +9 -9
  42. package/dist/safe-bash/command-chunks/chunk-3D24WDND.js +63 -0
  43. package/dist/safe-bash/command-chunks/{chunk-47NEG4UO.js → chunk-3JST2Q7G.js} +219 -43
  44. package/dist/safe-bash/command-chunks/{chunk-WGG6G2KG.js → chunk-3LJAXFH5.js} +7 -7
  45. package/dist/safe-bash/command-chunks/{chunk-AHA6IWAJ.js → chunk-3TYDSGAH.js} +6 -6
  46. package/dist/safe-bash/command-chunks/{chunk-YSMNXMAO.js → chunk-3Y4XZB24.js} +4 -4
  47. package/dist/safe-bash/command-chunks/{chunk-ZIIO6GRY.js → chunk-4PBNMKAT.js} +7 -7
  48. package/dist/safe-bash/command-chunks/{chunk-JFYWVQ4V.js → chunk-4Z6W5EOC.js} +8 -8
  49. package/dist/safe-bash/command-chunks/{chunk-GEM47B2P.js → chunk-57DDYKE5.js} +7 -7
  50. package/dist/safe-bash/command-chunks/{chunk-HARUYHH7.js → chunk-5HUICAWD.js} +1 -1
  51. package/dist/safe-bash/command-chunks/{chunk-4CKFNXRN.js → chunk-5IFRAI7Y.js} +1 -1
  52. package/dist/safe-bash/command-chunks/{chunk-RHYJVTJO.js → chunk-5KGEZ3RW.js} +2 -2
  53. package/dist/safe-bash/command-chunks/{chunk-A5FZBR7X.js → chunk-5MFDRSGG.js} +4 -4
  54. package/dist/safe-bash/command-chunks/{chunk-7GKKMNL6.js → chunk-5P6I2T63.js} +8 -8
  55. package/dist/safe-bash/command-chunks/{chunk-6M6TM5Z5.js → chunk-5VQVZPP3.js} +3 -3
  56. package/dist/safe-bash/command-chunks/{chunk-MIRL7HTF.js → chunk-6244HYJY.js} +1 -1
  57. package/dist/safe-bash/command-chunks/chunk-63EMPQ7Z.js +115 -0
  58. package/dist/safe-bash/command-chunks/{chunk-XRVKWGVQ.js → chunk-6CY5BHBS.js} +6 -6
  59. package/dist/safe-bash/command-chunks/{chunk-XVP6V5K3.js → chunk-6IWE7PTK.js} +6 -6
  60. package/dist/safe-bash/command-chunks/{chunk-6QBMND4A.js → chunk-6SRHWVEB.js} +1 -1
  61. package/dist/safe-bash/command-chunks/chunk-6ZHQB453.js +35 -0
  62. package/dist/safe-bash/command-chunks/chunk-73NYFNAS.js +173 -0
  63. package/dist/safe-bash/command-chunks/{chunk-VU3EQF7F.js → chunk-7NXTEWPR.js} +229 -75
  64. package/dist/safe-bash/command-chunks/{chunk-554Z6IKP.js → chunk-7PRL6RJ6.js} +2 -2
  65. package/dist/safe-bash/command-chunks/{chunk-SDTPO2VV.js → chunk-7PZHWMK6.js} +7 -7
  66. package/dist/safe-bash/command-chunks/{chunk-XZ2FWFNV.js → chunk-7QZ2HP2F.js} +6 -6
  67. package/dist/safe-bash/command-chunks/{chunk-OEJM666F.js → chunk-7UC2Q6Z6.js} +5 -5
  68. package/dist/safe-bash/command-chunks/{chunk-COKYZUBW.js → chunk-AJI55RS7.js} +1 -1
  69. package/dist/safe-bash/command-chunks/{chunk-2VCKUNDZ.js → chunk-B2C3UPJS.js} +27 -17
  70. package/dist/safe-bash/command-chunks/{chunk-WXRYDALR.js → chunk-BBAB7LC4.js} +4 -4
  71. package/dist/safe-bash/command-chunks/{chunk-QYMEASQ6.js → chunk-BEHUSUOY.js} +4 -4
  72. package/dist/safe-bash/command-chunks/{chunk-Z2JW6M2D.js → chunk-BK7ISUJL.js} +3 -3
  73. package/dist/safe-bash/command-chunks/{chunk-33YCKZZX.js → chunk-C5KLFZGT.js} +6 -6
  74. package/dist/safe-bash/command-chunks/{chunk-TVH4JORU.js → chunk-C5QDEB3I.js} +3 -3
  75. package/dist/safe-bash/command-chunks/{chunk-N4R2SHSS.js → chunk-CCZZVCHX.js} +2 -2
  76. package/dist/safe-bash/command-chunks/{chunk-2VLAXKTS.js → chunk-CTDC4LJT.js} +121 -85
  77. package/dist/safe-bash/command-chunks/{chunk-S6R3IB36.js → chunk-D55REQA3.js} +1 -1
  78. package/dist/safe-bash/command-chunks/{chunk-Y4EYCZFT.js → chunk-D6WJY6QO.js} +10 -10
  79. package/dist/safe-bash/command-chunks/{chunk-2CORNDGF.js → chunk-DBLHCJJU.js} +2 -2
  80. package/dist/safe-bash/command-chunks/{chunk-SPW4GW4Z.js → chunk-DFI7QF3M.js} +2 -2
  81. package/dist/safe-bash/command-chunks/{chunk-456PHA3L.js → chunk-DMCI6T6N.js} +1 -1
  82. package/dist/safe-bash/command-chunks/{chunk-TW73OXPR.js → chunk-EJTNVXWF.js} +6 -6
  83. package/dist/safe-bash/command-chunks/{chunk-QD7ZRDUN.js → chunk-ET2VPDUA.js} +1 -1
  84. package/dist/safe-bash/command-chunks/{chunk-5LI2DLNZ.js → chunk-EXOQGXEU.js} +26 -26
  85. package/dist/safe-bash/command-chunks/{chunk-CRV2Q3PB.js → chunk-EZ4NQIPL.js} +1 -1
  86. package/dist/safe-bash/command-chunks/chunk-FWKLBDMK.js +0 -0
  87. package/dist/safe-bash/command-chunks/{chunk-22MOB45U.js → chunk-FWPVQGYK.js} +6 -6
  88. package/dist/safe-bash/command-chunks/{chunk-QC5RMGSA.js → chunk-G3RUXKVY.js} +3 -3
  89. package/dist/safe-bash/command-chunks/{chunk-JYUJAF4L.js → chunk-G7NENPYV.js} +4 -0
  90. package/dist/safe-bash/command-chunks/{chunk-KCOJA7EM.js → chunk-GKILM4HZ.js} +7 -7
  91. package/dist/safe-bash/command-chunks/{chunk-HTVIYLVB.js → chunk-GNXTMSYN.js} +4 -4
  92. package/dist/safe-bash/command-chunks/{chunk-D2ASPM7R.js → chunk-GOBUDKZ3.js} +3 -3
  93. package/dist/safe-bash/command-chunks/{chunk-RNSKXOG3.js → chunk-GVWVRPG6.js} +6 -6
  94. package/dist/safe-bash/command-chunks/{chunk-ZHRGYR7B.js → chunk-HCKYUQ3L.js} +7 -7
  95. package/dist/safe-bash/command-chunks/{chunk-AGLK7OJR.js → chunk-HDSIIQBS.js} +1 -1
  96. package/dist/safe-bash/command-chunks/{chunk-DM2CPMB4.js → chunk-HKOMXGJS.js} +2 -2
  97. package/dist/safe-bash/command-chunks/{chunk-IT7TAC3F.js → chunk-HVW53ARH.js} +16 -16
  98. package/dist/safe-bash/command-chunks/{chunk-M7QE2MN7.js → chunk-I4GMCWAT.js} +6 -6
  99. package/dist/safe-bash/command-chunks/{chunk-5MB64DWR.js → chunk-IHSOOSNC.js} +9 -9
  100. package/dist/safe-bash/command-chunks/{chunk-LCZDBW55.js → chunk-JAHJWVGF.js} +5 -5
  101. package/dist/safe-bash/command-chunks/{chunk-MOZD7RUY.js → chunk-JORIVUPM.js} +27 -11
  102. package/dist/safe-bash/command-chunks/{chunk-PMAM4N33.js → chunk-JUJHYPYL.js} +9 -9
  103. package/dist/safe-bash/command-chunks/{chunk-ENT3IV2G.js → chunk-KBUBSMCQ.js} +12 -12
  104. package/dist/safe-bash/command-chunks/{chunk-ZXR6LXV5.js → chunk-KCE5D4Z4.js} +48 -4
  105. package/dist/safe-bash/command-chunks/{chunk-FIIAYCWS.js → chunk-KZ5ODST6.js} +2 -2
  106. package/dist/safe-bash/command-chunks/{chunk-PNGDJA6M.js → chunk-LD7BONZY.js} +2 -2
  107. package/dist/safe-bash/command-chunks/{chunk-KJ4XXZIL.js → chunk-M3Z5PU2M.js} +582 -59
  108. package/dist/safe-bash/command-chunks/{chunk-LXLLA4PM.js → chunk-MKX4JAZ6.js} +17 -17
  109. package/dist/safe-bash/command-chunks/{chunk-RQIQ75W5.js → chunk-MNHBQBF6.js} +5 -5
  110. package/dist/safe-bash/command-chunks/{chunk-A2CLZMQZ.js → chunk-MPKY37QR.js} +1 -1
  111. package/dist/safe-bash/command-chunks/{chunk-K5GB2YMN.js → chunk-MUUWBZIC.js} +10 -10
  112. package/dist/safe-bash/command-chunks/{chunk-JOCFI7TG.js → chunk-N32GSM3J.js} +1 -1
  113. package/dist/safe-bash/command-chunks/{chunk-EUT24Y5Z.js → chunk-NKTULXVD.js} +8 -8
  114. package/dist/safe-bash/command-chunks/{chunk-5HPU7D36.js → chunk-NMPED6L5.js} +4 -4
  115. package/dist/safe-bash/command-chunks/{chunk-QZZ73J2O.js → chunk-NPFHUS4X.js} +6 -6
  116. package/dist/safe-bash/command-chunks/{chunk-X7FA7ZD5.js → chunk-O675URF4.js} +8 -8
  117. package/dist/safe-bash/command-chunks/{chunk-R6EGGK5M.js → chunk-P7EL2FWW.js} +7 -7
  118. package/dist/safe-bash/command-chunks/{chunk-YS25EI54.js → chunk-PCCFLPUQ.js} +2 -2
  119. package/dist/safe-bash/command-chunks/{chunk-RRL3Y562.js → chunk-PI6MOMHA.js} +11 -11
  120. package/dist/safe-bash/command-chunks/{chunk-26VCZHLJ.js → chunk-PIOQBOEK.js} +1 -1
  121. package/dist/safe-bash/command-chunks/chunk-PK36TVXB.js +175 -0
  122. package/dist/safe-bash/command-chunks/{chunk-72C3TZ2U.js → chunk-PKLJRB7W.js} +264 -129
  123. package/dist/safe-bash/command-chunks/{chunk-6CCQI6XZ.js → chunk-PSCOXGCA.js} +12 -12
  124. package/dist/safe-bash/command-chunks/{chunk-XPD636C4.js → chunk-PVGZMLC6.js} +3 -3
  125. package/dist/safe-bash/command-chunks/{chunk-JQVHUSDD.js → chunk-PXWS3Q7L.js} +5 -5
  126. package/dist/safe-bash/command-chunks/{chunk-HDJVJTCK.js → chunk-QFF5KBOM.js} +9 -9
  127. package/dist/safe-bash/command-chunks/{chunk-MPUHH2KR.js → chunk-QM2HZJSJ.js} +3 -3
  128. package/dist/safe-bash/command-chunks/{chunk-UAXSE3XE.js → chunk-R2BMZAHG.js} +5 -5
  129. package/dist/safe-bash/command-chunks/{chunk-KB7DUBVL.js → chunk-RGOQKIG6.js} +5 -5
  130. package/dist/safe-bash/command-chunks/{chunk-D2KZ66W4.js → chunk-RLCQ7BN3.js} +187 -39
  131. package/dist/safe-bash/command-chunks/{chunk-B5LDP7AA.js → chunk-S2N2V5U4.js} +2 -2
  132. package/dist/safe-bash/command-chunks/{chunk-OA75SGN2.js → chunk-SGPCXAG7.js} +7 -7
  133. package/dist/safe-bash/command-chunks/{chunk-Z5QOVRVH.js → chunk-SU26FZLJ.js} +1 -1
  134. package/dist/safe-bash/command-chunks/{chunk-QUM3SYAJ.js → chunk-SYSX46IV.js} +3 -3
  135. package/dist/safe-bash/command-chunks/chunk-T3E5RV3U.js +737 -0
  136. package/dist/safe-bash/command-chunks/{chunk-YORJDX4V.js → chunk-T5ERNELL.js} +4 -4
  137. package/dist/safe-bash/command-chunks/{chunk-KL3OIBKB.js → chunk-T6C5QP7T.js} +6495 -6343
  138. package/dist/safe-bash/command-chunks/{chunk-ATTWQVR2.js → chunk-TKRLZIFI.js} +17 -17
  139. package/dist/safe-bash/command-chunks/{chunk-ZMHEGDU2.js → chunk-TODWFDYB.js} +2 -2
  140. package/dist/safe-bash/command-chunks/{chunk-YSY6R6AS.js → chunk-TQEB4DH4.js} +703 -102
  141. package/dist/safe-bash/command-chunks/{chunk-36XGIPOG.js → chunk-U5TWQFZY.js} +1 -1
  142. package/dist/safe-bash/command-chunks/{chunk-APEWTWCC.js → chunk-UAF4IX5H.js} +6 -6
  143. package/dist/safe-bash/command-chunks/{chunk-6VPQ3CDZ.js → chunk-V37D6AHO.js} +5 -5
  144. package/dist/safe-bash/command-chunks/{chunk-RID6VYS3.js → chunk-V6XBEYPC.js} +8 -8
  145. package/dist/safe-bash/command-chunks/{chunk-WJCN2IXI.js → chunk-VQOINPVF.js} +2 -2
  146. package/dist/safe-bash/command-chunks/{chunk-W5YSINXC.js → chunk-VVWXY6IA.js} +6 -6
  147. package/dist/safe-bash/command-chunks/{chunk-HKATEVAP.js → chunk-WPVBUVFK.js} +6 -6
  148. package/dist/safe-bash/command-chunks/{chunk-UYWSIIUX.js → chunk-X53AEG36.js} +7 -7
  149. package/dist/safe-bash/command-chunks/{chunk-L5MCW6CM.js → chunk-X64XGIXZ.js} +9 -155
  150. package/dist/safe-bash/command-chunks/{chunk-Q73EMLLZ.js → chunk-X6RHJ6YN.js} +84 -5
  151. package/dist/safe-bash/command-chunks/{chunk-7PVHO47B.js → chunk-XG6UWQV5.js} +6 -6
  152. package/dist/safe-bash/command-chunks/{chunk-NQDIT667.js → chunk-XIDGHIGB.js} +5 -5
  153. package/dist/safe-bash/command-chunks/{chunk-DPR5CYQV.js → chunk-XITDDJFT.js} +2 -0
  154. package/dist/safe-bash/command-chunks/{chunk-CV7M2QJU.js → chunk-XLYIVBAR.js} +7 -7
  155. package/dist/safe-bash/command-chunks/{chunk-WVMHRNXZ.js → chunk-YUXTK3XA.js} +3 -3
  156. package/dist/safe-bash/command-chunks/{chunk-SPLOIABU.js → chunk-YXD6VGVG.js} +3 -3
  157. package/dist/safe-bash/command-chunks/{chunk-2ZFLMWOX.js → chunk-Z5BIM5B7.js} +1 -1
  158. package/dist/safe-bash/command-chunks/chunk-ZYLGNIGA.js +156 -0
  159. package/dist/safe-bash/command-chunks/{command-engine-BEWABZ75.js → command-engine-X3OLN7N6.js} +206 -86
  160. package/dist/safe-bash/command-chunks/{engine-AXXFTGCL-QBQNBI6K.js → engine-XUCIFZ7V-LJFGZM6O.js} +1 -1
  161. package/dist/safe-bash/command-chunks/paradox-4FCZE53D-LQPGVMEL.js +365 -0
  162. package/dist/safe-bash/commands/pandoc/index.browser.js +1 -1
  163. package/dist/safe-bash/full-core.browser.js +2 -2
  164. package/dist/safe-bash/plugins/index.browser.js +2 -2
  165. package/dist/safe-bash-command-apply-patch/apply.js +4 -4
  166. package/dist/safe-bash-command-apply-patch/index.js +4 -4
  167. package/dist/safe-bash-command-apply-patch/matcher.js +2 -2
  168. package/dist/safe-bash-command-apply-patch/parser.js +2 -2
  169. package/dist/safe-bash-command-apply-patch/shared.d.ts +2 -0
  170. package/dist/safe-bash-command-apply-patch/shared.js +1 -1
  171. package/dist/safe-bash-command-diff/diff.js +1 -1
  172. package/dist/safe-bash-command-diff/index.js +1 -1
  173. package/dist/safe-bash-command-ffmpeg/index.js +1 -1
  174. package/dist/safe-bash-command-ffprobe/index.js +2 -2
  175. package/dist/safe-bash-command-ffprobe/media.d.ts +3 -1
  176. package/dist/safe-bash-command-ffprobe/media.js +2 -2
  177. package/dist/safe-bash-command-html-to-markdown/budget.js +2 -1
  178. package/dist/safe-bash-command-html-to-markdown/entities.js +4 -3
  179. package/dist/safe-bash-command-html-to-markdown/index.js +564 -110
  180. package/dist/safe-bash-command-html-to-markdown/input.js +6 -5
  181. package/dist/safe-bash-command-html-to-markdown/options.js +2 -1
  182. package/dist/safe-bash-command-html-to-markdown/parser.js +5 -4
  183. package/dist/safe-bash-command-html-to-markdown/render.js +6 -5
  184. package/dist/safe-bash-command-html-to-markdown/text.js +3 -2
  185. package/dist/safe-bash-command-htmlq/index.js +361 -37
  186. package/dist/safe-bash-command-htmlq/tree.d.ts +3 -2
  187. package/dist/safe-bash-command-pandoc/command.js +7 -7
  188. package/dist/safe-bash-command-pandoc/index.js +55 -55
  189. package/dist/safe-bash-command-patch/index.js +6 -6
  190. package/dist/safe-bash-command-patch/patch-envelope.js +53 -3
  191. package/dist/safe-bash-command-patch/patch-formats.d.ts +2 -2
  192. package/dist/safe-bash-command-patch/patch-formats.js +2 -2
  193. package/dist/safe-bash-command-patch/patch-gnu-reject.d.ts +2 -1
  194. package/dist/safe-bash-command-patch/patch-gnu-reject.js +4 -3
  195. package/dist/safe-bash-command-patch/patch-publication.js +2 -1
  196. package/dist/safe-bash-command-patch/patch.js +6 -6
  197. package/dist/safe-bash-command-patch/unified.d.ts +10 -2
  198. package/dist/safe-bash-command-patch/unified.js +1 -1
  199. package/dist/safe-bash-command-pdftk/index.d.ts +6 -2
  200. package/dist/safe-bash-command-pdftk/index.js +835 -243
  201. package/dist/safe-bash-command-pptx/command-engine.d.ts +15 -3
  202. package/dist/safe-bash-command-pptx/engine.d.ts +2 -2
  203. package/dist/safe-bash-command-pptx/engine.js +1 -1
  204. package/dist/safe-bash-command-pptx/index.js +9 -2
  205. package/dist/safe-bash-command-soffice/index.js +1 -1
  206. package/dist/safe-bash-command-ssconvert/index.js +2 -2
  207. package/dist/safe-bash-command-xmllint/index.js +22 -31
  208. package/dist/safe-bash-diff-engine/document.d.ts +2 -1
  209. package/dist/safe-bash-diff-engine/document.js +7 -4
  210. package/dist/safe-bash-presentation-engine/accessibility.js +31 -30
  211. package/dist/safe-bash-presentation-engine/animation-editing.js +16 -15
  212. package/dist/safe-bash-presentation-engine/animations.js +16 -15
  213. package/dist/safe-bash-presentation-engine/backgrounds.js +17 -16
  214. package/dist/safe-bash-presentation-engine/bytes.js +3 -3
  215. package/dist/safe-bash-presentation-engine/chart-editing.js +34 -33
  216. package/dist/safe-bash-presentation-engine/chart-object-operations.js +25 -24
  217. package/dist/safe-bash-presentation-engine/charts.js +31 -30
  218. package/dist/safe-bash-presentation-engine/command-placeholder.js +59 -55
  219. package/dist/safe-bash-presentation-engine/comments.js +17 -16
  220. package/dist/safe-bash-presentation-engine/connector-operations.js +32 -31
  221. package/dist/safe-bash-presentation-engine/connectors.js +29 -28
  222. package/dist/safe-bash-presentation-engine/content-types.js +4 -4
  223. package/dist/safe-bash-presentation-engine/creation.js +6 -6
  224. package/dist/safe-bash-presentation-engine/diff.js +32 -31
  225. package/dist/safe-bash-presentation-engine/drawing-enums.d.ts +10 -10
  226. package/dist/safe-bash-presentation-engine/drawing-format.js +20 -19
  227. package/dist/safe-bash-presentation-engine/drawing-operations.js +31 -30
  228. package/dist/safe-bash-presentation-engine/drawing-schema.js +21 -20
  229. package/dist/safe-bash-presentation-engine/equations.js +17 -16
  230. package/dist/safe-bash-presentation-engine/errors.js +2 -2
  231. package/dist/safe-bash-presentation-engine/fields.js +17 -16
  232. package/dist/safe-bash-presentation-engine/font-metrics.js +3 -3
  233. package/dist/safe-bash-presentation-engine/image-extraction.js +20 -19
  234. package/dist/safe-bash-presentation-engine/image-formatting.js +32 -31
  235. package/dist/safe-bash-presentation-engine/image-insertion.js +18 -17
  236. package/dist/safe-bash-presentation-engine/image-replacement.js +21 -20
  237. package/dist/safe-bash-presentation-engine/image-value.js +4 -4
  238. package/dist/safe-bash-presentation-engine/images.js +19 -18
  239. package/dist/safe-bash-presentation-engine/index.d.ts +6 -2
  240. package/dist/safe-bash-presentation-engine/index.js +112 -97
  241. package/dist/safe-bash-presentation-engine/layouts.js +16 -15
  242. package/dist/safe-bash-presentation-engine/length.js +3 -3
  243. package/dist/safe-bash-presentation-engine/links.js +16 -15
  244. package/dist/safe-bash-presentation-engine/masters.js +15 -14
  245. package/dist/safe-bash-presentation-engine/media-editing.js +24 -23
  246. package/dist/safe-bash-presentation-engine/media-extraction.js +17 -16
  247. package/dist/safe-bash-presentation-engine/media.js +16 -15
  248. package/dist/safe-bash-presentation-engine/memberships.js +15 -14
  249. package/dist/safe-bash-presentation-engine/notes.js +16 -15
  250. package/dist/safe-bash-presentation-engine/ole-enum.js +4 -4
  251. package/dist/safe-bash-presentation-engine/ole-insertion.js +20 -19
  252. package/dist/safe-bash-presentation-engine/opaque-objects.js +9 -9
  253. package/dist/safe-bash-presentation-engine/package-reader.js +5 -5
  254. package/dist/safe-bash-presentation-engine/package-tools.d.ts +3 -0
  255. package/dist/safe-bash-presentation-engine/package-tools.js +27 -17
  256. package/dist/safe-bash-presentation-engine/package-uri.js +3 -3
  257. package/dist/safe-bash-presentation-engine/package-writer.js +4 -4
  258. package/dist/safe-bash-presentation-engine/presentation-model.js +58 -54
  259. package/dist/safe-bash-presentation-engine/presentation-settings.js +14 -13
  260. package/dist/safe-bash-presentation-engine/properties.js +16 -15
  261. package/dist/safe-bash-presentation-engine/relationships.js +4 -4
  262. package/dist/safe-bash-presentation-engine/resource-limits.js +1 -1
  263. package/dist/safe-bash-presentation-engine/retained-archive-staging.d.ts +19 -0
  264. package/dist/safe-bash-presentation-engine/retained-extraction-output.d.ts +18 -0
  265. package/dist/safe-bash-presentation-engine/retained-inspection.js +14 -12
  266. package/dist/safe-bash-presentation-engine/retained-package-extraction.d.ts +22 -0
  267. package/dist/safe-bash-presentation-engine/retained-package-packing.d.ts +19 -0
  268. package/dist/safe-bash-presentation-engine/retained-package.d.ts +2 -0
  269. package/dist/safe-bash-presentation-engine/retained-package.js +6 -4
  270. package/dist/safe-bash-presentation-engine/retained-slide-publication.d.ts +24 -0
  271. package/dist/safe-bash-presentation-engine/retained-text.js +19 -17
  272. package/dist/safe-bash-presentation-engine/retained-xml-parts.d.ts +5 -1
  273. package/dist/safe-bash-presentation-engine/retained-xml-publication.d.ts +18 -0
  274. package/dist/safe-bash-presentation-engine/retained-xml-replacement.d.ts +13 -0
  275. package/dist/safe-bash-presentation-engine/sanitize.js +17 -16
  276. package/dist/safe-bash-presentation-engine/selectors.js +10 -10
  277. package/dist/safe-bash-presentation-engine/shape-groups.js +31 -30
  278. package/dist/safe-bash-presentation-engine/shape-operations.js +30 -29
  279. package/dist/safe-bash-presentation-engine/shape-path-operations.js +32 -31
  280. package/dist/safe-bash-presentation-engine/shape-paths.js +16 -15
  281. package/dist/safe-bash-presentation-engine/shape-presets.js +3 -3
  282. package/dist/safe-bash-presentation-engine/shape-selection.js +31 -30
  283. package/dist/safe-bash-presentation-engine/shape-transforms.js +18 -17
  284. package/dist/safe-bash-presentation-engine/shapes.d.ts +1 -1
  285. package/dist/safe-bash-presentation-engine/shapes.js +27 -26
  286. package/dist/safe-bash-presentation-engine/slide-copy.js +17 -16
  287. package/dist/safe-bash-presentation-engine/slide-import.js +18 -17
  288. package/dist/safe-bash-presentation-engine/slide-merge-split.js +20 -19
  289. package/dist/safe-bash-presentation-engine/slide-model.js +43 -42
  290. package/dist/safe-bash-presentation-engine/slide-removal.js +18 -17
  291. package/dist/safe-bash-presentation-engine/slide-transfer-budget.js +9 -9
  292. package/dist/safe-bash-presentation-engine/slides.d.ts +1 -0
  293. package/dist/safe-bash-presentation-engine/slides.js +23 -17
  294. package/dist/safe-bash-presentation-engine/table-operations.js +33 -32
  295. package/dist/safe-bash-presentation-engine/table-spans.js +32 -31
  296. package/dist/safe-bash-presentation-engine/tables.js +31 -30
  297. package/dist/safe-bash-presentation-engine/tags.js +16 -15
  298. package/dist/safe-bash-presentation-engine/template-bindings.js +33 -32
  299. package/dist/safe-bash-presentation-engine/template-repeat.js +40 -39
  300. package/dist/safe-bash-presentation-engine/text-fitting.js +27 -26
  301. package/dist/safe-bash-presentation-engine/text-frames.js +27 -26
  302. package/dist/safe-bash-presentation-engine/text-paragraphs.js +27 -26
  303. package/dist/safe-bash-presentation-engine/text-reading.js +11 -11
  304. package/dist/safe-bash-presentation-engine/text-replacement.js +17 -16
  305. package/dist/safe-bash-presentation-engine/text-runs.js +20 -19
  306. package/dist/safe-bash-presentation-engine/themes.js +16 -15
  307. package/dist/safe-bash-presentation-engine/transitions.js +16 -15
  308. package/dist/safe-bash-presentation-engine/validation.js +10 -9
  309. package/dist/safe-bash-presentation-engine/xml-parts.d.ts +2 -0
  310. package/dist/safe-bash-presentation-engine/xml-parts.js +23 -15
  311. package/dist/safe-bash-presentation-engine/xml-view.js +3 -3
  312. package/dist/safe-bash-presentation-engine/xml.js +3 -3
  313. package/dist/safe-bash-regex-engine/index.js +1 -1
  314. package/dist/safe-bash-regex-engine/python-glob.js +1 -1
  315. package/dist/safe-bash-regex-engine/text/regex.d.ts +19 -0
  316. package/dist/safe-bash-regex-engine/text/regex.js +1 -1
  317. package/dist/safe-bash-xml-engine/document.js +3 -3
  318. package/dist/safe-bash-xml-engine/evaluate.js +1 -1
  319. package/dist/safe-bash-xml-engine/index.d.ts +1 -0
  320. package/dist/safe-bash-xml-engine/index.js +8 -4
  321. package/dist/safe-bash-xml-engine/query.js +2 -2
  322. package/dist/safe-bash-xml-engine/recovery.d.ts +10 -0
  323. package/dist/safe-bash-xml-engine/stored-document.d.ts +1 -1
  324. package/dist/safe-bash-xml-engine/stored-document.js +1 -1
  325. package/dist/safe-bash-xml-engine/stored-evaluate.js +1 -1
  326. package/dist/spreadsheet-engine/formulas/functions/python-printf.js +56 -33
  327. package/dist/spreadsheet-format-xls/biff-encrypted-properties.d.ts +2 -2
  328. package/dist/spreadsheet-format-xls/biff-encrypted-properties.js +86 -24
  329. package/dist/spreadsheet-format-xls/biff-metadata.d.ts +1 -0
  330. package/dist/spreadsheet-format-xls/biff-metadata.js +2 -2
  331. package/dist/spreadsheet-format-xls/biff-properties-merge.d.ts +6 -2
  332. package/dist/spreadsheet-format-xls/biff-properties-merge.js +413 -296
  333. package/dist/spreadsheet-format-xls/biff-properties-write.js +40 -23
  334. package/dist/spreadsheet-format-xls/biff-properties.js +3 -68
  335. package/dist/spreadsheet-format-xls/biff-property-index.d.ts +23 -0
  336. package/dist/spreadsheet-format-xls/biff-property-index.js +93 -0
  337. package/dist/spreadsheet-format-xls/biff-property-name.d.ts +4 -0
  338. package/dist/spreadsheet-format-xls/biff-property-name.js +114 -0
  339. package/dist/spreadsheet-format-xls/biff-property-text.d.ts +6 -0
  340. package/dist/spreadsheet-format-xls/biff-property-text.js +68 -0
  341. package/dist/spreadsheet-format-xls/biff-property-transcode.d.ts +5 -0
  342. package/dist/spreadsheet-format-xls/biff-property-transcode.js +45 -0
  343. package/dist/spreadsheet-format-xls/biff-write-metadata.js +10 -1
  344. package/package.json +6 -3
  345. package/dist/safe-bash/command-chunks/biff-3EFLKBAH-NYWZOYQS.js +0 -4942
  346. package/dist/safe-bash/command-chunks/chunk-5Q22ZLNC.js +0 -127
  347. package/dist/safe-bash/command-chunks/chunk-JKLOBSMP.js +0 -56
  348. package/dist/safe-bash/command-chunks/chunk-JYTESTBS.js +0 -99
  349. package/dist/safe-bash/command-chunks/chunk-WH3TIOTS.js +0 -326
  350. package/dist/safe-bash/command-chunks/paradox-ZWWXYY4J-JYOSWSBL.js +0 -362
  351. package/dist/spreadsheet-format-xls/biff-properties-layout.js +0 -56
@@ -396,30 +396,12 @@ export async function writeBiffProperties(book, context, staged = false) {
396
396
  yield* propertyChunks(encoded.get(guid));
397
397
  } });
398
398
  }
399
- // Opaque snapshot merging still needs random byte-array access. Keep it explicit
400
- // until that reader and its codepage/identity logic migrate to retained ranges.
401
399
  const snapshots = (book.unsupportedRecords ?? []).some(record => record.source === "biff" && record.kind === "ole-properties" && record.disposition === "retained");
402
- const streams = new Map();
403
- if (!staged || snapshots)
404
- for (const [name, value] of planned) {
405
- const bytes = new Uint8Array(value.length);
406
- let at = 0;
407
- for (const part of propertyChunks(value)) {
408
- bytes.set(part, at);
409
- at += part.length;
410
- }
411
- streams.set(name, bytes);
412
- }
413
- const preserved = await mergeBiffProperties(book, streams, handledMetadata, context, charge, allocate);
414
- for (const key of unsupportedKeys)
415
- if (!preserved.has(key))
416
- await context.diagnostic?.({ code: "biff-loss-warning", severity: "warning", message: `Unsupported Excel BIFF document property: ${key}` });
417
- if (!staged)
418
- return { streams, handledMetadata, async close() { } };
400
+ const streams = new Map(), inputs = [];
419
401
  const sources = new Map();
420
402
  const close = async () => {
421
403
  const errors = [];
422
- for (const source of sources.values())
404
+ for (const source of [...sources.values(), ...inputs])
423
405
  try {
424
406
  await source.close();
425
407
  }
@@ -432,8 +414,42 @@ export async function writeBiffProperties(book, context, staged = false) {
432
414
  throw new AggregateError(errors, "BIFF property sources cleanup failed");
433
415
  };
434
416
  try {
417
+ if (!staged || snapshots)
418
+ for (const [name, value] of planned) {
419
+ if (staged) {
420
+ const source = await stagePropertyBytes(value, context);
421
+ inputs.push(source);
422
+ streams.set(name, source);
423
+ }
424
+ else {
425
+ const bytes = new Uint8Array(value.length);
426
+ let at = 0;
427
+ for (const part of propertyChunks(value)) {
428
+ bytes.set(part, at);
429
+ at += part.length;
430
+ }
431
+ streams.set(name, bytes);
432
+ }
433
+ }
434
+ const preserved = await mergeBiffProperties(book, streams, handledMetadata, context, charge, allocate, staged ? { sources, reserve } : undefined);
435
+ for (const key of unsupportedKeys)
436
+ if (!preserved.has(key))
437
+ await context.diagnostic?.({ code: "biff-loss-warning", severity: "warning", message: `Unsupported Excel BIFF document property: ${key}` });
438
+ if (!staged)
439
+ return { streams, handledMetadata, async close() { } };
435
440
  for (const [name, value] of snapshots ? streams : planned)
436
- sources.set(name, await stagePropertyBytes(value, context));
441
+ if (!sources.has(name)) {
442
+ const bytes = 'size' in value ? { length: value.size, async *chunks() {
443
+ for (let at = 0; at < value.size;) {
444
+ const part = await value.read(at, Math.min(16384, value.size - at));
445
+ at += part.length;
446
+ yield part;
447
+ }
448
+ } } : value;
449
+ sources.set(name, await stagePropertyBytes(bytes, context));
450
+ }
451
+ for (const input of inputs)
452
+ await input.close();
437
453
  return { streams: sources, handledMetadata, close };
438
454
  }
439
455
  catch (error) {
@@ -446,8 +462,9 @@ export async function writeBiffProperties(book, context, staged = false) {
446
462
  throw error;
447
463
  }
448
464
  finally {
449
- if (snapshots)
465
+ if (staged && snapshots)
450
466
  for (const bytes of streams.values())
451
- bytes.fill(0);
467
+ if (bytes instanceof Uint8Array)
468
+ bytes.fill(0);
452
469
  }
453
470
  }
@@ -1,8 +1,7 @@
1
1
  import { SsconvertError } from "../spreadsheet-engine/contracts.js";
2
2
  import { invalidBiff } from "./biff-binary.js";
3
3
  import { propertyRange, readPropertySectionRanges, readPropertyValueRanges } from "./biff-property-range.js";
4
- import { biffDbcsTables } from "../spreadsheet-engine/encoding/biff-dbcs-tables.js";
5
- import { biffDecode } from "./biff-strings.js";
4
+ import { readBiffPropertyText } from "./biff-property-text.js";
6
5
  // OLE property-set layout and IDs: LibreOffice oleprops.cxx/.hxx at
7
6
  // bce0998afefdbc355585ca324285661a2170ba77; source receipts are in the gap ledger.
8
7
  export const biffPropertyFormats = { summary: "e0859ff2f94f6810ab9108002b27b3d9",
@@ -29,70 +28,6 @@ export async function readBiffProperties(streams, context, accountText, accountW
29
28
  if (nodes > (context.limits.workbookNodes ?? context.limits.inputBytes))
30
29
  throw new SsconvertError("resource-limit", "ssconvert BIFF property node limit exceeded");
31
30
  };
32
- const text = async (data, offset, codepage) => {
33
- const count = await data.u32(offset), width = codepage === 1200 ? 2 : 1, size = count * width;
34
- if (!count)
35
- invalidBiff("empty property string buffer");
36
- data.check(offset + 4, size);
37
- // Admit the maximum UTF-8 expansion before allocating a decoded string.
38
- if ((count - 1) * 3 > (context.limits.workbookTextBytes ?? context.limits.inputBytes))
39
- throw new SsconvertError("resource-limit", "ssconvert BIFF property text limit exceeded");
40
- accountWork(size);
41
- const end = offset + 4 + size;
42
- if ((await data.read(end - width, width)).some(Boolean))
43
- invalidBiff("unterminated property string");
44
- let value = "";
45
- const unicode = codepage === 1200 || codepage === 65001;
46
- const decoder = unicode ? new TextDecoder(codepage === 1200 ? "utf-16le" : "utf-8", { fatal: true, ignoreBOM: true }) : undefined;
47
- const multibyte = biffDbcsTables[codepage];
48
- let lead;
49
- if (!unicode && !multibyte)
50
- biffDecode(new Uint8Array(), codepage);
51
- for (let at = offset + 4; at < end - width;) {
52
- const bytes = await data.read(at, Math.min(16384, end - width - at));
53
- at += bytes.length;
54
- if (decoder) {
55
- try {
56
- value += decoder.decode(bytes, { stream: true });
57
- }
58
- catch {
59
- invalidBiff("invalid property string encoding");
60
- }
61
- }
62
- else if (multibyte) {
63
- const characters = [];
64
- for (const byte of bytes) {
65
- if (lead !== undefined) {
66
- const character = multibyte.double[lead]?.[byte];
67
- if (character === undefined || character === "\uffff")
68
- invalidBiff("invalid or truncated DBCS character");
69
- characters.push(character);
70
- lead = undefined;
71
- }
72
- else {
73
- const character = multibyte.single[byte];
74
- if (character === "\uffff")
75
- lead = byte;
76
- else
77
- characters.push(character);
78
- }
79
- }
80
- value += characters.join("");
81
- }
82
- else
83
- value += biffDecode(bytes, codepage);
84
- }
85
- if (lead !== undefined)
86
- invalidBiff("invalid or truncated DBCS character");
87
- if (decoder)
88
- try {
89
- value += decoder.decode();
90
- }
91
- catch {
92
- invalidBiff("invalid property string encoding");
93
- }
94
- return { value: accountText(value), end: width === 2 ? Math.ceil(end / 4) * 4 : end };
95
- };
96
31
  for (const target of ["\u0005SummaryInformation", "\u0005DocumentSummaryInformation"]) {
97
32
  let streamName = target, bytes = streams.get(target);
98
33
  if (!bytes)
@@ -132,7 +67,7 @@ export async function readBiffProperties(streams, context, accountText, accountW
132
67
  admit(length);
133
68
  let at = 4;
134
69
  for (let i = 0; i < length; i++) {
135
- const id = await dictionary.u32(at), entry = await text(dictionary, at + 4, codepage);
70
+ const id = await dictionary.u32(at), entry = await readBiffPropertyText(dictionary, at + 4, codepage, context, accountText, accountWork);
136
71
  if (id < 2 || names.has(id) || !entry.value)
137
72
  invalidBiff("invalid property dictionary entry");
138
73
  names.set(id, entry.value);
@@ -159,7 +94,7 @@ export async function readBiffProperties(streams, context, accountText, accountW
159
94
  const type = await data.u32(0);
160
95
  try {
161
96
  if (type === 30 || type === 31)
162
- value = (await text(data, 4, type === 31 ? 1200 : codepage)).value;
97
+ value = (await readBiffPropertyText(data, 4, type === 31 ? 1200 : codepage, context, accountText, accountWork)).value;
163
98
  else if (type === 3)
164
99
  value = (await data.u32(4)) | 0;
165
100
  else if (type === 5) {
@@ -0,0 +1,23 @@
1
+ import type { WorkingStorage } from "../spreadsheet-engine/contracts.js";
2
+ export interface BiffPropertyDescriptor {
3
+ offset: number;
4
+ size: number;
5
+ block: number;
6
+ name: string;
7
+ }
8
+ /** Two bounded radix caches index UTF-16 name edges and stable range order.
9
+ * Linked fixed-size records replay original descriptor order without an array. */
10
+ export declare class BiffPropertyDescriptorIndex {
11
+ private readonly storage;
12
+ private readonly check;
13
+ private readonly names;
14
+ private readonly ranges;
15
+ private node;
16
+ private count;
17
+ private first;
18
+ private last;
19
+ constructor(storage: WorkingStorage, check: () => void);
20
+ add(entry: BiffPropertyDescriptor): Promise<void>;
21
+ validate(): Promise<void>;
22
+ entries(): AsyncIterable<BiffPropertyDescriptor>;
23
+ }
@@ -0,0 +1,93 @@
1
+ import { IntegerTable } from "@poe-platform/safe-fs/storage";
2
+ import { Binary, invalidBiff } from './biff-binary.js';
3
+ /** Two bounded radix caches index UTF-16 name edges and stable range order.
4
+ * Linked fixed-size records replay original descriptor order without an array. */
5
+ export class BiffPropertyDescriptorIndex {
6
+ storage;
7
+ check;
8
+ names;
9
+ ranges;
10
+ node = 2n;
11
+ count = 0;
12
+ first = 0;
13
+ last = 0;
14
+ constructor(storage, check) {
15
+ this.storage = storage;
16
+ this.check = check;
17
+ storage.allocate(8);
18
+ this.check();
19
+ this.names = new IntegerTable(storage, 64);
20
+ this.ranges = new IntegerTable(storage, 64);
21
+ }
22
+ async add(entry) {
23
+ this.check();
24
+ let node = 1n;
25
+ const name = entry.name.toUpperCase();
26
+ for (let i = 0; i < name.length; i++) {
27
+ const key = node << 16n | BigInt(name.charCodeAt(i));
28
+ let next = await this.names.get(key);
29
+ this.check();
30
+ if (next === undefined) {
31
+ next = this.node++;
32
+ await this.names.set(key, next);
33
+ this.check();
34
+ }
35
+ node = next;
36
+ }
37
+ const terminal = node << 16n;
38
+ if (await this.names.get(terminal) !== undefined)
39
+ invalidBiff('duplicate or invalid encrypted property stream name');
40
+ this.check();
41
+ await this.names.set(terminal, 1n);
42
+ this.check();
43
+ await this.ranges.set(BigInt(entry.offset) << 32n | BigInt(this.count++), BigInt(entry.offset + entry.size));
44
+ this.check();
45
+ const bytes = new Uint8Array(88), view = new DataView(bytes.buffer);
46
+ view.setUint32(8, entry.offset, true);
47
+ view.setUint32(12, entry.size, true);
48
+ view.setUint16(16, entry.block, true);
49
+ view.setUint16(18, entry.name.length, true);
50
+ for (let i = 0; i < entry.name.length; i++)
51
+ view.setUint16(20 + i * 2, entry.name.charCodeAt(i), true);
52
+ const position = this.storage.allocate(bytes.length);
53
+ this.check();
54
+ try {
55
+ await this.storage.write(position, bytes);
56
+ this.check();
57
+ if (this.last) {
58
+ view.setFloat64(0, position, true);
59
+ await this.storage.write(this.last, bytes.subarray(0, 8));
60
+ this.check();
61
+ }
62
+ else
63
+ this.first = position;
64
+ this.last = position;
65
+ }
66
+ finally {
67
+ bytes.fill(0);
68
+ }
69
+ }
70
+ async validate() {
71
+ let end = 0n;
72
+ for await (const [key, next] of this.ranges.entries()) {
73
+ this.check();
74
+ if (key >> 32n < end)
75
+ invalidBiff('overlapping encrypted property payloads');
76
+ end = next;
77
+ }
78
+ }
79
+ async *entries() {
80
+ let position = this.first;
81
+ while (position) {
82
+ this.check();
83
+ const bytes = new Binary(await this.storage.read(position, 88));
84
+ this.check();
85
+ bytes.check(0, 88);
86
+ position = bytes.f64(0);
87
+ let name = '';
88
+ for (let i = 0; i < bytes.u16(18); i++)
89
+ name += String.fromCharCode(bytes.u16(20 + i * 2));
90
+ yield { offset: bytes.u32(8), size: bytes.u32(12), block: bytes.u16(16), name };
91
+ }
92
+ }
93
+ }
@@ -0,0 +1,4 @@
1
+ import { type CapabilityContext } from "../spreadsheet-engine/contracts.js";
2
+ import type { BiffPropertyBytes } from './biff-property-bytes.js';
3
+ /** Validate representability before exposing bounded encoded windows. */
4
+ export declare function createBiffPropertyNameEncoder(context: CapabilityContext, charge: (amount: number) => void, accountText: (text: string) => string): (name: string, codepage: number) => BiffPropertyBytes | undefined;
@@ -0,0 +1,114 @@
1
+ import { SsconvertError } from "../spreadsheet-engine/contracts.js";
2
+ import { singleByteTables } from "../spreadsheet-engine/encoding/tables.js";
3
+ import { biffDbcsTables } from "../spreadsheet-engine/encoding/biff-dbcs-tables.js";
4
+ import { biffDecode } from './biff-strings.js';
5
+ /** Validate representability before exposing bounded encoded windows. */
6
+ export function createBiffPropertyNameEncoder(context, charge, accountText) {
7
+ // Reverse the same tables as the importer; no transliteration or escape fallback.
8
+ const encodings = new Map();
9
+ return (name, cp) => {
10
+ accountText(name);
11
+ if (cp === 65001) {
12
+ let length = 1;
13
+ for (const point of name) {
14
+ const code = point.codePointAt(0);
15
+ length += code < 128 ? 1 : code < 2048 ? 2 : code < 65536 ? 3 : 4;
16
+ }
17
+ return { length, *chunks() {
18
+ const encoder = new TextEncoder(), buffer = new Uint8Array(16384);
19
+ try {
20
+ for (let at = 0; at < name.length;) {
21
+ context.signal.throwIfAborted();
22
+ let end = Math.min(name.length, at + 4096);
23
+ if (end < name.length && name.charCodeAt(end - 1) >= 0xd800 && name.charCodeAt(end - 1) <= 0xdbff)
24
+ end--;
25
+ const result = encoder.encodeInto(name.slice(at, end), buffer);
26
+ at = end;
27
+ yield buffer.subarray(0, result.written);
28
+ }
29
+ yield new Uint8Array(1);
30
+ }
31
+ finally {
32
+ buffer.fill(0);
33
+ }
34
+ } };
35
+ }
36
+ if (cp === 1200) {
37
+ const length = (name.length + 1) * 2;
38
+ charge(length);
39
+ if (length > 0xffffffff || length > context.limits.outputBytes)
40
+ throw new SsconvertError("resource-limit", "ssconvert BIFF property output bytes limit exceeded");
41
+ return { length, *chunks() {
42
+ const buffer = new Uint8Array(16384), view = new DataView(buffer.buffer);
43
+ try {
44
+ for (let at = 0; at < name.length; at += 8192) {
45
+ context.signal.throwIfAborted();
46
+ const size = Math.min(8192, name.length - at);
47
+ for (let i = 0; i < size; i++)
48
+ view.setUint16(i * 2, name.charCodeAt(at + i), true);
49
+ yield buffer.subarray(0, size * 2);
50
+ }
51
+ yield new Uint8Array(2);
52
+ }
53
+ finally {
54
+ buffer.fill(0);
55
+ }
56
+ } };
57
+ }
58
+ let reverse = encodings.get(cp);
59
+ if (!reverse) {
60
+ reverse = new Map();
61
+ encodings.set(cp, reverse);
62
+ const dbcs = biffDbcsTables[cp], table = dbcs?.single ?? singleByteTables[cp === 1201 ? "iso-8859-1" : cp === 10000 ? "macintosh" : cp >= 1250 && cp <= 1258 ? `windows-${cp}` : `cp${cp}`];
63
+ if (!table)
64
+ return undefined;
65
+ for (let i = 0; i < table.length; i++) {
66
+ charge(1);
67
+ if (table[i] !== "\uffff" && !reverse.has(table[i]))
68
+ reverse.set(table[i], [i]);
69
+ }
70
+ if (dbcs)
71
+ for (const [lead, row] of Object.entries(dbcs.double))
72
+ for (let trail = 0; trail < row.length; trail++) {
73
+ charge(1);
74
+ if (row[trail] !== "\uffff" && !reverse.has(row[trail]))
75
+ reverse.set(row[trail], [Number(lead), trail]);
76
+ }
77
+ }
78
+ const characters = function* () { yield* name; yield "\0"; };
79
+ let length = 0;
80
+ for (const character of characters()) {
81
+ charge(1);
82
+ const value = reverse.get(character);
83
+ if (!value)
84
+ return undefined;
85
+ if (biffDecode(Uint8Array.from(value), cp) !== character)
86
+ return undefined;
87
+ length += value.length;
88
+ if (length > context.limits.outputBytes)
89
+ throw new SsconvertError("resource-limit", "ssconvert BIFF property output bytes limit exceeded");
90
+ }
91
+ const table = reverse;
92
+ return { length, *chunks() {
93
+ const buffer = new Uint8Array(16384);
94
+ let at = 0;
95
+ try {
96
+ for (const character of characters()) {
97
+ const value = table.get(character);
98
+ if (at + value.length > buffer.length) {
99
+ context.signal.throwIfAborted();
100
+ yield buffer.subarray(0, at);
101
+ at = 0;
102
+ }
103
+ buffer.set(value, at);
104
+ at += value.length;
105
+ }
106
+ if (at)
107
+ yield buffer.subarray(0, at);
108
+ }
109
+ finally {
110
+ buffer.fill(0);
111
+ }
112
+ } };
113
+ };
114
+ }
@@ -0,0 +1,6 @@
1
+ import { type CapabilityContext } from "../spreadsheet-engine/contracts.js";
2
+ import type { BiffPropertyRange } from './biff-property-range.js';
3
+ export declare function readBiffPropertyText(data: BiffPropertyRange, offset: number, codepage: number, context: CapabilityContext, accountText: (text: string) => string, accountWork: (amount: number) => void): Promise<{
4
+ value: string;
5
+ end: number;
6
+ }>;
@@ -0,0 +1,68 @@
1
+ import { SsconvertError } from "../spreadsheet-engine/contracts.js";
2
+ import { invalidBiff } from './biff-binary.js';
3
+ import { biffDbcsTables } from "../spreadsheet-engine/encoding/biff-dbcs-tables.js";
4
+ import { biffDecode } from './biff-strings.js';
5
+ export async function readBiffPropertyText(data, offset, codepage, context, accountText, accountWork) {
6
+ const count = await data.u32(offset), width = codepage === 1200 ? 2 : 1, size = count * width;
7
+ if (!count)
8
+ invalidBiff("empty property string buffer");
9
+ data.check(offset + 4, size);
10
+ // Admit the maximum UTF-8 expansion before allocating a decoded string.
11
+ if ((count - 1) * 3 > (context.limits.workbookTextBytes ?? context.limits.inputBytes))
12
+ throw new SsconvertError("resource-limit", "ssconvert BIFF property text limit exceeded");
13
+ accountWork(size);
14
+ const end = offset + 4 + size;
15
+ if ((await data.read(end - width, width)).some(Boolean))
16
+ invalidBiff("unterminated property string");
17
+ let value = "";
18
+ const unicode = codepage === 1200 || codepage === 65001;
19
+ const decoder = unicode ? new TextDecoder(codepage === 1200 ? "utf-16le" : "utf-8", { fatal: true, ignoreBOM: true }) : undefined;
20
+ const multibyte = biffDbcsTables[codepage];
21
+ let lead;
22
+ if (!unicode && !multibyte)
23
+ biffDecode(new Uint8Array(), codepage);
24
+ for (let at = offset + 4; at < end - width;) {
25
+ const bytes = await data.read(at, Math.min(16384, end - width - at));
26
+ at += bytes.length;
27
+ if (decoder) {
28
+ try {
29
+ value += decoder.decode(bytes, { stream: true });
30
+ }
31
+ catch {
32
+ invalidBiff("invalid property string encoding");
33
+ }
34
+ }
35
+ else if (multibyte) {
36
+ const characters = [];
37
+ for (const byte of bytes) {
38
+ if (lead !== undefined) {
39
+ const character = multibyte.double[lead]?.[byte];
40
+ if (character === undefined || character === "\uffff")
41
+ invalidBiff("invalid or truncated DBCS character");
42
+ characters.push(character);
43
+ lead = undefined;
44
+ }
45
+ else {
46
+ const character = multibyte.single[byte];
47
+ if (character === "\uffff")
48
+ lead = byte;
49
+ else
50
+ characters.push(character);
51
+ }
52
+ }
53
+ value += characters.join("");
54
+ }
55
+ else
56
+ value += biffDecode(bytes, codepage);
57
+ }
58
+ if (lead !== undefined)
59
+ invalidBiff("invalid or truncated DBCS character");
60
+ if (decoder)
61
+ try {
62
+ value += decoder.decode();
63
+ }
64
+ catch {
65
+ invalidBiff("invalid property string encoding");
66
+ }
67
+ return { value: accountText(value), end: width === 2 ? Math.ceil(end / 4) * 4 : end };
68
+ }
@@ -0,0 +1,5 @@
1
+ import type { CapabilityContext } from "../spreadsheet-engine/contracts.js";
2
+ import type { BiffPropertyRange } from './biff-property-range.js';
3
+ import type { BiffPropertySource } from './biff-encrypted-properties-write.js';
4
+ /** Count UTF-16 units before staging; both passes retain only a bounded decoder window. */
5
+ export declare function stageWideBiffProperty(source: BiffPropertyRange, context: CapabilityContext, charge: (amount: number) => void, reserve: (length: number) => number): Promise<BiffPropertySource>;
@@ -0,0 +1,45 @@
1
+ import { stagePropertyBytes } from './biff-property-bytes.js';
2
+ /** Count UTF-16 units before staging; both passes retain only a bounded decoder window. */
3
+ export async function stageWideBiffProperty(source, context, charge, reserve) {
4
+ reserve(source.size);
5
+ const text = source.slice(8, await source.u32(4) - 1);
6
+ const parts = async function* () {
7
+ const decoder = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true });
8
+ for (let at = 0; at < text.size;) {
9
+ const bytes = await text.read(at, Math.min(8192, text.size - at));
10
+ at += bytes.length;
11
+ try {
12
+ yield decoder.decode(bytes, { stream: true });
13
+ }
14
+ finally {
15
+ bytes.fill(0);
16
+ }
17
+ }
18
+ yield decoder.decode();
19
+ };
20
+ let units = 0;
21
+ for await (const part of parts())
22
+ units += part.length;
23
+ charge(units);
24
+ const length = reserve(8 + (units + 1) * 2);
25
+ return stagePropertyBytes({ length, async *chunks() {
26
+ const header = new Uint8Array(8), view = new DataView(header.buffer);
27
+ view.setUint32(0, 31, true);
28
+ view.setUint32(4, units + 1, true);
29
+ yield header;
30
+ const buffer = new Uint8Array(16384), output = new DataView(buffer.buffer);
31
+ try {
32
+ for await (const part of parts())
33
+ for (let at = 0; at < part.length; at += 8192) {
34
+ const size = Math.min(8192, part.length - at);
35
+ for (let i = 0; i < size; i++)
36
+ output.setUint16(i * 2, part.charCodeAt(at + i), true);
37
+ yield buffer.subarray(0, size * 2);
38
+ }
39
+ yield new Uint8Array(2);
40
+ }
41
+ finally {
42
+ buffer.fill(0);
43
+ }
44
+ } }, context);
45
+ }
@@ -3,7 +3,7 @@ import { parseA1 } from "../spreadsheet-ast/index.js";
3
3
  import { metadataNode } from "../spreadsheet-engine/codecs/xlsx-write-support.js";
4
4
  import { words } from "./biff-write-binary.js";
5
5
  import { biffString } from "./biff-write.js";
6
- import { biffProtectionPermissions } from "./biff-metadata.js";
6
+ import { biffProtectionPermissions, biffHeaderParts } from "./biff-metadata.js";
7
7
  import { biffFontWidth } from "./biff-font-widths.js";
8
8
  import { writeBiffLabelRanges } from "./biff-label-ranges.js";
9
9
  function concat(...parts) {
@@ -442,6 +442,15 @@ export class BiffMetadataWriter {
442
442
  text += source[at] === "&" ? "&&" : source[at];
443
443
  }
444
444
  }
445
+ const original = sheet.view?.[name === "Header" ? "printHeader" : "printFooter"];
446
+ if (node && typeof original === "string") {
447
+ this.charge(original.length);
448
+ const sections = biffHeaderParts(original);
449
+ // Keep the imported token spelling (including formatting controls)
450
+ // when the normalized sections are unchanged. Explicit edits win.
451
+ if (Object.entries(sections).every(([side, value]) => value === (node.attributes[side] ?? "")))
452
+ text = original;
453
+ }
445
454
  await output.record(opcode, biffString(text, revision, this.context, revision === 8 ? 2 : 1));
446
455
  }
447
456
  for (const [name, opcode] of [["hPageBreaks", 0x1b], ["vPageBreaks", 0x1a]]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-bash",
3
- "version": "0.1.811",
3
+ "version": "0.1.813",
4
4
  "description": "Extensible virtual shell with pluggable filesystems and streaming commands",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1407,7 +1407,7 @@
1407
1407
  "access": "public"
1408
1408
  },
1409
1409
  "dependencies": {
1410
- "@poe-platform/safe-fs": "0.1.811",
1410
+ "@poe-platform/safe-fs": "0.1.813",
1411
1411
  "pdf-lib": "1.17.1",
1412
1412
  "@types/node": "^25.2.2",
1413
1413
  "@formatjs/intl-numberformat": "9.4.0",
@@ -2834,12 +2834,15 @@
2834
2834
  "./dist/spreadsheet-format-xls/biff-label-ranges.js",
2835
2835
  "./dist/spreadsheet-format-xls/biff-metadata.js",
2836
2836
  "./dist/spreadsheet-format-xls/biff-name-bindings.js",
2837
- "./dist/spreadsheet-format-xls/biff-properties-layout.js",
2838
2837
  "./dist/spreadsheet-format-xls/biff-properties-merge.js",
2839
2838
  "./dist/spreadsheet-format-xls/biff-properties-write.js",
2840
2839
  "./dist/spreadsheet-format-xls/biff-properties.js",
2841
2840
  "./dist/spreadsheet-format-xls/biff-property-bytes.js",
2841
+ "./dist/spreadsheet-format-xls/biff-property-index.js",
2842
+ "./dist/spreadsheet-format-xls/biff-property-name.js",
2842
2843
  "./dist/spreadsheet-format-xls/biff-property-range.js",
2844
+ "./dist/spreadsheet-format-xls/biff-property-text.js",
2845
+ "./dist/spreadsheet-format-xls/biff-property-transcode.js",
2843
2846
  "./dist/spreadsheet-format-xls/biff-range.js",
2844
2847
  "./dist/spreadsheet-format-xls/biff-record-storage.js",
2845
2848
  "./dist/spreadsheet-format-xls/biff-shared-strings.js",