@poe-platform/safe-bash 0.1.812 → 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 (329) hide show
  1. package/dist/audio-ast/id3-source.d.ts +27 -0
  2. package/dist/audio-ast/index.d.ts +4 -0
  3. package/dist/audio-ast/index.js +996 -596
  4. package/dist/audio-ast/mp3-source.d.ts +18 -0
  5. package/dist/audio-ast/ogg-source.d.ts +25 -0
  6. package/dist/audio-ast/ogg-stream-source.d.ts +22 -0
  7. package/dist/image-ast/index.js +139 -9
  8. package/dist/mp4-ast/containers/adapters.d.ts +7 -0
  9. package/dist/office-xml/retained-xml-document.d.ts +8 -0
  10. package/dist/pdf-ast/ast.d.ts +2 -0
  11. package/dist/pdf-ast/content/dictionary-cursor.d.ts +15 -0
  12. package/dist/pdf-ast/content/range-operator-parser.d.ts +4 -0
  13. package/dist/pdf-ast/content/stored-dictionary.d.ts +10 -0
  14. package/dist/pdf-ast/cos/lexer.d.ts +8 -5
  15. package/dist/pdf-ast/cos/object-reader.d.ts +4 -3
  16. package/dist/pdf-ast/cos/range-parser.d.ts +4 -0
  17. package/dist/pdf-ast/cos/retained-objects.d.ts +1 -0
  18. package/dist/pdf-ast/cos/retained-writer.d.ts +1 -0
  19. package/dist/pdf-ast/cos/value-parser.d.ts +9 -0
  20. package/dist/pdf-ast/edit/retained-append-attachments.d.ts +13 -0
  21. package/dist/pdf-ast/edit/retained-bookmarks.d.ts +13 -0
  22. package/dist/pdf-ast/edit/retained-graph.d.ts +6 -0
  23. package/dist/pdf-ast/edit/retained-save.d.ts +2 -0
  24. package/dist/pdf-ast/edit/retained-stamps.d.ts +9 -0
  25. package/dist/pdf-ast/fonts/resolve.d.ts +3 -1
  26. package/dist/pdf-ast/index.d.ts +3 -1
  27. package/dist/pdf-ast/index.js +1557 -770
  28. package/dist/safe-bash/audio-ast.browser.js +6 -1
  29. package/dist/safe-bash/chunks/{chunk-HHSOUC3Z.js → chunk-HPQE675Q.js} +1 -1
  30. package/dist/safe-bash/chunks/{chunk-BUYRKFW2.js → chunk-I6ECNJMR.js} +1 -1
  31. package/dist/safe-bash/chunks/{pdftk-WRYEP3CA.js → pdftk-Y2TX74LY.js} +2 -1
  32. package/dist/safe-bash/command-chunks/biff-4ALVARRF-7SRX6R6N.js +5192 -0
  33. package/dist/safe-bash/command-chunks/{chunk-EHSM5ZQS.js → chunk-2DGJOOXM.js} +8 -8
  34. package/dist/safe-bash/command-chunks/{chunk-Q6S57NOQ.js → chunk-2E2H7MBH.js} +7 -7
  35. package/dist/safe-bash/command-chunks/{chunk-MMBZTYXO.js → chunk-2PQRZDNR.js} +221 -0
  36. package/dist/safe-bash/command-chunks/{chunk-NARD63DY.js → chunk-2V6FOLXV.js} +22 -66
  37. package/dist/safe-bash/command-chunks/{chunk-56NYSX65.js → chunk-2Z3WRRFT.js} +9 -9
  38. package/dist/safe-bash/command-chunks/chunk-3D24WDND.js +63 -0
  39. package/dist/safe-bash/command-chunks/{chunk-47NEG4UO.js → chunk-3JST2Q7G.js} +219 -43
  40. package/dist/safe-bash/command-chunks/{chunk-WGG6G2KG.js → chunk-3LJAXFH5.js} +7 -7
  41. package/dist/safe-bash/command-chunks/{chunk-AHA6IWAJ.js → chunk-3TYDSGAH.js} +6 -6
  42. package/dist/safe-bash/command-chunks/{chunk-YSMNXMAO.js → chunk-3Y4XZB24.js} +4 -4
  43. package/dist/safe-bash/command-chunks/{chunk-ZIIO6GRY.js → chunk-4PBNMKAT.js} +7 -7
  44. package/dist/safe-bash/command-chunks/{chunk-JFYWVQ4V.js → chunk-4Z6W5EOC.js} +8 -8
  45. package/dist/safe-bash/command-chunks/{chunk-GEM47B2P.js → chunk-57DDYKE5.js} +7 -7
  46. package/dist/safe-bash/command-chunks/{chunk-4CKFNXRN.js → chunk-5IFRAI7Y.js} +1 -1
  47. package/dist/safe-bash/command-chunks/{chunk-RHYJVTJO.js → chunk-5KGEZ3RW.js} +2 -2
  48. package/dist/safe-bash/command-chunks/{chunk-A5FZBR7X.js → chunk-5MFDRSGG.js} +4 -4
  49. package/dist/safe-bash/command-chunks/{chunk-7GKKMNL6.js → chunk-5P6I2T63.js} +8 -8
  50. package/dist/safe-bash/command-chunks/{chunk-6M6TM5Z5.js → chunk-5VQVZPP3.js} +3 -3
  51. package/dist/safe-bash/command-chunks/{chunk-MIRL7HTF.js → chunk-6244HYJY.js} +1 -1
  52. package/dist/safe-bash/command-chunks/chunk-63EMPQ7Z.js +115 -0
  53. package/dist/safe-bash/command-chunks/{chunk-XRVKWGVQ.js → chunk-6CY5BHBS.js} +6 -6
  54. package/dist/safe-bash/command-chunks/{chunk-XVP6V5K3.js → chunk-6IWE7PTK.js} +6 -6
  55. package/dist/safe-bash/command-chunks/{chunk-6QBMND4A.js → chunk-6SRHWVEB.js} +1 -1
  56. package/dist/safe-bash/command-chunks/chunk-6ZHQB453.js +35 -0
  57. package/dist/safe-bash/command-chunks/chunk-73NYFNAS.js +173 -0
  58. package/dist/safe-bash/command-chunks/{chunk-2JSDKQ4J.js → chunk-7NXTEWPR.js} +119 -44
  59. package/dist/safe-bash/command-chunks/{chunk-554Z6IKP.js → chunk-7PRL6RJ6.js} +2 -2
  60. package/dist/safe-bash/command-chunks/{chunk-SDTPO2VV.js → chunk-7PZHWMK6.js} +7 -7
  61. package/dist/safe-bash/command-chunks/{chunk-XZ2FWFNV.js → chunk-7QZ2HP2F.js} +6 -6
  62. package/dist/safe-bash/command-chunks/{chunk-OEJM666F.js → chunk-7UC2Q6Z6.js} +5 -5
  63. package/dist/safe-bash/command-chunks/{chunk-COKYZUBW.js → chunk-AJI55RS7.js} +1 -1
  64. package/dist/safe-bash/command-chunks/{chunk-WXRYDALR.js → chunk-BBAB7LC4.js} +4 -4
  65. package/dist/safe-bash/command-chunks/{chunk-QYMEASQ6.js → chunk-BEHUSUOY.js} +4 -4
  66. package/dist/safe-bash/command-chunks/{chunk-Z2JW6M2D.js → chunk-BK7ISUJL.js} +3 -3
  67. package/dist/safe-bash/command-chunks/{chunk-33YCKZZX.js → chunk-C5KLFZGT.js} +6 -6
  68. package/dist/safe-bash/command-chunks/{chunk-TVH4JORU.js → chunk-C5QDEB3I.js} +3 -3
  69. package/dist/safe-bash/command-chunks/{chunk-N4R2SHSS.js → chunk-CCZZVCHX.js} +2 -2
  70. package/dist/safe-bash/command-chunks/{chunk-2VLAXKTS.js → chunk-CTDC4LJT.js} +121 -85
  71. package/dist/safe-bash/command-chunks/{chunk-S6R3IB36.js → chunk-D55REQA3.js} +1 -1
  72. package/dist/safe-bash/command-chunks/{chunk-Y4EYCZFT.js → chunk-D6WJY6QO.js} +10 -10
  73. package/dist/safe-bash/command-chunks/{chunk-2CORNDGF.js → chunk-DBLHCJJU.js} +2 -2
  74. package/dist/safe-bash/command-chunks/{chunk-SPW4GW4Z.js → chunk-DFI7QF3M.js} +2 -2
  75. package/dist/safe-bash/command-chunks/{chunk-456PHA3L.js → chunk-DMCI6T6N.js} +1 -1
  76. package/dist/safe-bash/command-chunks/{chunk-TW73OXPR.js → chunk-EJTNVXWF.js} +6 -6
  77. package/dist/safe-bash/command-chunks/{chunk-QD7ZRDUN.js → chunk-ET2VPDUA.js} +1 -1
  78. package/dist/safe-bash/command-chunks/{chunk-CJQSAATC.js → chunk-EXOQGXEU.js} +26 -26
  79. package/dist/safe-bash/command-chunks/{chunk-CRV2Q3PB.js → chunk-EZ4NQIPL.js} +1 -1
  80. package/dist/safe-bash/command-chunks/chunk-FWKLBDMK.js +0 -0
  81. package/dist/safe-bash/command-chunks/{chunk-22MOB45U.js → chunk-FWPVQGYK.js} +6 -6
  82. package/dist/safe-bash/command-chunks/{chunk-QC5RMGSA.js → chunk-G3RUXKVY.js} +3 -3
  83. package/dist/safe-bash/command-chunks/{chunk-JYUJAF4L.js → chunk-G7NENPYV.js} +4 -0
  84. package/dist/safe-bash/command-chunks/{chunk-KCOJA7EM.js → chunk-GKILM4HZ.js} +7 -7
  85. package/dist/safe-bash/command-chunks/{chunk-HTVIYLVB.js → chunk-GNXTMSYN.js} +4 -4
  86. package/dist/safe-bash/command-chunks/{chunk-D2ASPM7R.js → chunk-GOBUDKZ3.js} +3 -3
  87. package/dist/safe-bash/command-chunks/{chunk-RNSKXOG3.js → chunk-GVWVRPG6.js} +6 -6
  88. package/dist/safe-bash/command-chunks/{chunk-FDCIPJBQ.js → chunk-HCKYUQ3L.js} +7 -7
  89. package/dist/safe-bash/command-chunks/{chunk-AGLK7OJR.js → chunk-HDSIIQBS.js} +1 -1
  90. package/dist/safe-bash/command-chunks/{chunk-DM2CPMB4.js → chunk-HKOMXGJS.js} +2 -2
  91. package/dist/safe-bash/command-chunks/{chunk-IT7TAC3F.js → chunk-HVW53ARH.js} +16 -16
  92. package/dist/safe-bash/command-chunks/{chunk-M7QE2MN7.js → chunk-I4GMCWAT.js} +6 -6
  93. package/dist/safe-bash/command-chunks/{chunk-HWQ2UHMT.js → chunk-IHSOOSNC.js} +9 -9
  94. package/dist/safe-bash/command-chunks/{chunk-LCZDBW55.js → chunk-JAHJWVGF.js} +5 -5
  95. package/dist/safe-bash/command-chunks/{chunk-MOZD7RUY.js → chunk-JORIVUPM.js} +27 -11
  96. package/dist/safe-bash/command-chunks/{chunk-PMAM4N33.js → chunk-JUJHYPYL.js} +9 -9
  97. package/dist/safe-bash/command-chunks/{chunk-ENT3IV2G.js → chunk-KBUBSMCQ.js} +12 -12
  98. package/dist/safe-bash/command-chunks/{chunk-ZXR6LXV5.js → chunk-KCE5D4Z4.js} +48 -4
  99. package/dist/safe-bash/command-chunks/{chunk-FIIAYCWS.js → chunk-KZ5ODST6.js} +2 -2
  100. package/dist/safe-bash/command-chunks/{chunk-PNGDJA6M.js → chunk-LD7BONZY.js} +2 -2
  101. package/dist/safe-bash/command-chunks/{chunk-KJ4XXZIL.js → chunk-M3Z5PU2M.js} +582 -59
  102. package/dist/safe-bash/command-chunks/{chunk-LXLLA4PM.js → chunk-MKX4JAZ6.js} +17 -17
  103. package/dist/safe-bash/command-chunks/{chunk-RQIQ75W5.js → chunk-MNHBQBF6.js} +5 -5
  104. package/dist/safe-bash/command-chunks/{chunk-A2CLZMQZ.js → chunk-MPKY37QR.js} +1 -1
  105. package/dist/safe-bash/command-chunks/{chunk-K5GB2YMN.js → chunk-MUUWBZIC.js} +10 -10
  106. package/dist/safe-bash/command-chunks/{chunk-JOCFI7TG.js → chunk-N32GSM3J.js} +1 -1
  107. package/dist/safe-bash/command-chunks/{chunk-EUT24Y5Z.js → chunk-NKTULXVD.js} +8 -8
  108. package/dist/safe-bash/command-chunks/{chunk-5HPU7D36.js → chunk-NMPED6L5.js} +4 -4
  109. package/dist/safe-bash/command-chunks/{chunk-QZZ73J2O.js → chunk-NPFHUS4X.js} +6 -6
  110. package/dist/safe-bash/command-chunks/{chunk-X7FA7ZD5.js → chunk-O675URF4.js} +8 -8
  111. package/dist/safe-bash/command-chunks/{chunk-R6EGGK5M.js → chunk-P7EL2FWW.js} +7 -7
  112. package/dist/safe-bash/command-chunks/{chunk-YS25EI54.js → chunk-PCCFLPUQ.js} +2 -2
  113. package/dist/safe-bash/command-chunks/{chunk-RRL3Y562.js → chunk-PI6MOMHA.js} +11 -11
  114. package/dist/safe-bash/command-chunks/{chunk-26VCZHLJ.js → chunk-PIOQBOEK.js} +1 -1
  115. package/dist/safe-bash/command-chunks/chunk-PK36TVXB.js +175 -0
  116. package/dist/safe-bash/command-chunks/{chunk-3Q247UDJ.js → chunk-PKLJRB7W.js} +264 -129
  117. package/dist/safe-bash/command-chunks/{chunk-6CCQI6XZ.js → chunk-PSCOXGCA.js} +12 -12
  118. package/dist/safe-bash/command-chunks/{chunk-XPD636C4.js → chunk-PVGZMLC6.js} +3 -3
  119. package/dist/safe-bash/command-chunks/{chunk-JQVHUSDD.js → chunk-PXWS3Q7L.js} +5 -5
  120. package/dist/safe-bash/command-chunks/{chunk-HDJVJTCK.js → chunk-QFF5KBOM.js} +9 -9
  121. package/dist/safe-bash/command-chunks/{chunk-MPUHH2KR.js → chunk-QM2HZJSJ.js} +3 -3
  122. package/dist/safe-bash/command-chunks/{chunk-UAXSE3XE.js → chunk-R2BMZAHG.js} +5 -5
  123. package/dist/safe-bash/command-chunks/{chunk-KB7DUBVL.js → chunk-RGOQKIG6.js} +5 -5
  124. package/dist/safe-bash/command-chunks/{chunk-D2KZ66W4.js → chunk-RLCQ7BN3.js} +187 -39
  125. package/dist/safe-bash/command-chunks/{chunk-B5LDP7AA.js → chunk-S2N2V5U4.js} +2 -2
  126. package/dist/safe-bash/command-chunks/{chunk-OA75SGN2.js → chunk-SGPCXAG7.js} +7 -7
  127. package/dist/safe-bash/command-chunks/{chunk-QUM3SYAJ.js → chunk-SYSX46IV.js} +3 -3
  128. package/dist/safe-bash/command-chunks/chunk-T3E5RV3U.js +737 -0
  129. package/dist/safe-bash/command-chunks/{chunk-YORJDX4V.js → chunk-T5ERNELL.js} +4 -4
  130. package/dist/safe-bash/command-chunks/{chunk-ZEX53S5I.js → chunk-T6C5QP7T.js} +6368 -6230
  131. package/dist/safe-bash/command-chunks/{chunk-ATTWQVR2.js → chunk-TKRLZIFI.js} +17 -17
  132. package/dist/safe-bash/command-chunks/{chunk-ZMHEGDU2.js → chunk-TODWFDYB.js} +2 -2
  133. package/dist/safe-bash/command-chunks/{chunk-XVLWZTPY.js → chunk-TQEB4DH4.js} +543 -144
  134. package/dist/safe-bash/command-chunks/{chunk-36XGIPOG.js → chunk-U5TWQFZY.js} +1 -1
  135. package/dist/safe-bash/command-chunks/{chunk-APEWTWCC.js → chunk-UAF4IX5H.js} +6 -6
  136. package/dist/safe-bash/command-chunks/{chunk-6VPQ3CDZ.js → chunk-V37D6AHO.js} +5 -5
  137. package/dist/safe-bash/command-chunks/{chunk-RID6VYS3.js → chunk-V6XBEYPC.js} +8 -8
  138. package/dist/safe-bash/command-chunks/{chunk-WJCN2IXI.js → chunk-VQOINPVF.js} +2 -2
  139. package/dist/safe-bash/command-chunks/{chunk-W5YSINXC.js → chunk-VVWXY6IA.js} +6 -6
  140. package/dist/safe-bash/command-chunks/{chunk-HKATEVAP.js → chunk-WPVBUVFK.js} +6 -6
  141. package/dist/safe-bash/command-chunks/{chunk-UYWSIIUX.js → chunk-X53AEG36.js} +7 -7
  142. package/dist/safe-bash/command-chunks/{chunk-L5MCW6CM.js → chunk-X64XGIXZ.js} +9 -155
  143. package/dist/safe-bash/command-chunks/{chunk-Q73EMLLZ.js → chunk-X6RHJ6YN.js} +84 -5
  144. package/dist/safe-bash/command-chunks/{chunk-7PVHO47B.js → chunk-XG6UWQV5.js} +6 -6
  145. package/dist/safe-bash/command-chunks/{chunk-NQDIT667.js → chunk-XIDGHIGB.js} +5 -5
  146. package/dist/safe-bash/command-chunks/{chunk-CV7M2QJU.js → chunk-XLYIVBAR.js} +7 -7
  147. package/dist/safe-bash/command-chunks/{chunk-WVMHRNXZ.js → chunk-YUXTK3XA.js} +3 -3
  148. package/dist/safe-bash/command-chunks/{chunk-SPLOIABU.js → chunk-YXD6VGVG.js} +3 -3
  149. package/dist/safe-bash/command-chunks/{chunk-2ZFLMWOX.js → chunk-Z5BIM5B7.js} +1 -1
  150. package/dist/safe-bash/command-chunks/chunk-ZYLGNIGA.js +156 -0
  151. package/dist/safe-bash/command-chunks/{command-engine-BCUQGJJ4.js → command-engine-X3OLN7N6.js} +150 -67
  152. package/dist/safe-bash/command-chunks/{engine-LAUEWYSQ-DQCEI5HE.js → engine-XUCIFZ7V-LJFGZM6O.js} +1 -1
  153. package/dist/safe-bash/command-chunks/paradox-4FCZE53D-LQPGVMEL.js +365 -0
  154. package/dist/safe-bash/commands/pandoc/index.browser.js +1 -1
  155. package/dist/safe-bash/full-core.browser.js +2 -2
  156. package/dist/safe-bash/plugins/index.browser.js +2 -2
  157. package/dist/safe-bash-command-diff/diff.js +1 -1
  158. package/dist/safe-bash-command-diff/index.js +1 -1
  159. package/dist/safe-bash-command-ffmpeg/index.js +1 -1
  160. package/dist/safe-bash-command-ffprobe/index.js +2 -2
  161. package/dist/safe-bash-command-ffprobe/media.d.ts +3 -1
  162. package/dist/safe-bash-command-ffprobe/media.js +2 -2
  163. package/dist/safe-bash-command-html-to-markdown/budget.js +2 -1
  164. package/dist/safe-bash-command-html-to-markdown/entities.js +4 -3
  165. package/dist/safe-bash-command-html-to-markdown/index.js +564 -110
  166. package/dist/safe-bash-command-html-to-markdown/input.js +6 -5
  167. package/dist/safe-bash-command-html-to-markdown/options.js +2 -1
  168. package/dist/safe-bash-command-html-to-markdown/parser.js +5 -4
  169. package/dist/safe-bash-command-html-to-markdown/render.js +6 -5
  170. package/dist/safe-bash-command-html-to-markdown/text.js +3 -2
  171. package/dist/safe-bash-command-htmlq/index.js +361 -37
  172. package/dist/safe-bash-command-htmlq/tree.d.ts +3 -2
  173. package/dist/safe-bash-command-pandoc/command.js +7 -7
  174. package/dist/safe-bash-command-pandoc/index.js +55 -55
  175. package/dist/safe-bash-command-patch/index.js +6 -6
  176. package/dist/safe-bash-command-patch/patch-envelope.js +53 -3
  177. package/dist/safe-bash-command-patch/patch-formats.d.ts +2 -2
  178. package/dist/safe-bash-command-patch/patch-formats.js +2 -2
  179. package/dist/safe-bash-command-patch/patch-gnu-reject.d.ts +2 -1
  180. package/dist/safe-bash-command-patch/patch-gnu-reject.js +4 -3
  181. package/dist/safe-bash-command-patch/patch-publication.js +2 -1
  182. package/dist/safe-bash-command-patch/patch.js +6 -6
  183. package/dist/safe-bash-command-patch/unified.d.ts +10 -2
  184. package/dist/safe-bash-command-patch/unified.js +1 -1
  185. package/dist/safe-bash-command-pdftk/index.d.ts +6 -2
  186. package/dist/safe-bash-command-pdftk/index.js +830 -271
  187. package/dist/safe-bash-command-pptx/command-engine.d.ts +3 -0
  188. package/dist/safe-bash-command-pptx/engine.js +1 -1
  189. package/dist/safe-bash-command-pptx/index.js +9 -2
  190. package/dist/safe-bash-command-soffice/index.js +1 -1
  191. package/dist/safe-bash-command-ssconvert/index.js +2 -2
  192. package/dist/safe-bash-command-xmllint/index.js +22 -31
  193. package/dist/safe-bash-presentation-engine/accessibility.js +31 -30
  194. package/dist/safe-bash-presentation-engine/animation-editing.js +16 -15
  195. package/dist/safe-bash-presentation-engine/animations.js +16 -15
  196. package/dist/safe-bash-presentation-engine/backgrounds.js +17 -16
  197. package/dist/safe-bash-presentation-engine/bytes.js +3 -3
  198. package/dist/safe-bash-presentation-engine/chart-editing.js +34 -33
  199. package/dist/safe-bash-presentation-engine/chart-object-operations.js +25 -24
  200. package/dist/safe-bash-presentation-engine/charts.js +31 -30
  201. package/dist/safe-bash-presentation-engine/command-placeholder.js +59 -56
  202. package/dist/safe-bash-presentation-engine/comments.js +17 -16
  203. package/dist/safe-bash-presentation-engine/connector-operations.js +32 -31
  204. package/dist/safe-bash-presentation-engine/connectors.js +29 -28
  205. package/dist/safe-bash-presentation-engine/content-types.js +4 -4
  206. package/dist/safe-bash-presentation-engine/creation.js +6 -6
  207. package/dist/safe-bash-presentation-engine/diff.js +32 -31
  208. package/dist/safe-bash-presentation-engine/drawing-enums.d.ts +10 -10
  209. package/dist/safe-bash-presentation-engine/drawing-format.js +20 -19
  210. package/dist/safe-bash-presentation-engine/drawing-operations.js +31 -30
  211. package/dist/safe-bash-presentation-engine/drawing-schema.js +21 -20
  212. package/dist/safe-bash-presentation-engine/equations.js +17 -16
  213. package/dist/safe-bash-presentation-engine/errors.js +2 -2
  214. package/dist/safe-bash-presentation-engine/fields.js +17 -16
  215. package/dist/safe-bash-presentation-engine/font-metrics.js +3 -3
  216. package/dist/safe-bash-presentation-engine/image-extraction.js +20 -19
  217. package/dist/safe-bash-presentation-engine/image-formatting.js +32 -31
  218. package/dist/safe-bash-presentation-engine/image-insertion.js +18 -17
  219. package/dist/safe-bash-presentation-engine/image-replacement.js +21 -20
  220. package/dist/safe-bash-presentation-engine/image-value.js +4 -4
  221. package/dist/safe-bash-presentation-engine/images.js +19 -18
  222. package/dist/safe-bash-presentation-engine/index.d.ts +5 -1
  223. package/dist/safe-bash-presentation-engine/index.js +109 -96
  224. package/dist/safe-bash-presentation-engine/layouts.js +16 -15
  225. package/dist/safe-bash-presentation-engine/length.js +3 -3
  226. package/dist/safe-bash-presentation-engine/links.js +16 -15
  227. package/dist/safe-bash-presentation-engine/masters.js +15 -14
  228. package/dist/safe-bash-presentation-engine/media-editing.js +24 -23
  229. package/dist/safe-bash-presentation-engine/media-extraction.js +17 -16
  230. package/dist/safe-bash-presentation-engine/media.js +16 -15
  231. package/dist/safe-bash-presentation-engine/memberships.js +15 -14
  232. package/dist/safe-bash-presentation-engine/notes.js +16 -15
  233. package/dist/safe-bash-presentation-engine/ole-enum.js +4 -4
  234. package/dist/safe-bash-presentation-engine/ole-insertion.js +20 -19
  235. package/dist/safe-bash-presentation-engine/opaque-objects.js +9 -9
  236. package/dist/safe-bash-presentation-engine/package-reader.js +5 -5
  237. package/dist/safe-bash-presentation-engine/package-tools.d.ts +3 -0
  238. package/dist/safe-bash-presentation-engine/package-tools.js +27 -17
  239. package/dist/safe-bash-presentation-engine/package-uri.js +3 -3
  240. package/dist/safe-bash-presentation-engine/package-writer.js +4 -4
  241. package/dist/safe-bash-presentation-engine/presentation-model.js +58 -55
  242. package/dist/safe-bash-presentation-engine/presentation-settings.js +14 -13
  243. package/dist/safe-bash-presentation-engine/properties.js +16 -15
  244. package/dist/safe-bash-presentation-engine/relationships.js +4 -4
  245. package/dist/safe-bash-presentation-engine/resource-limits.js +1 -1
  246. package/dist/safe-bash-presentation-engine/retained-archive-staging.d.ts +19 -0
  247. package/dist/safe-bash-presentation-engine/retained-extraction-output.d.ts +18 -0
  248. package/dist/safe-bash-presentation-engine/retained-inspection.js +14 -12
  249. package/dist/safe-bash-presentation-engine/retained-package-extraction.d.ts +22 -0
  250. package/dist/safe-bash-presentation-engine/retained-package-packing.d.ts +19 -0
  251. package/dist/safe-bash-presentation-engine/retained-package.d.ts +2 -0
  252. package/dist/safe-bash-presentation-engine/retained-package.js +6 -4
  253. package/dist/safe-bash-presentation-engine/retained-text.js +19 -17
  254. package/dist/safe-bash-presentation-engine/retained-xml-parts.d.ts +5 -1
  255. package/dist/safe-bash-presentation-engine/retained-xml-publication.d.ts +18 -0
  256. package/dist/safe-bash-presentation-engine/retained-xml-replacement.d.ts +13 -0
  257. package/dist/safe-bash-presentation-engine/sanitize.js +17 -16
  258. package/dist/safe-bash-presentation-engine/selectors.js +10 -10
  259. package/dist/safe-bash-presentation-engine/shape-groups.js +31 -30
  260. package/dist/safe-bash-presentation-engine/shape-operations.js +30 -29
  261. package/dist/safe-bash-presentation-engine/shape-path-operations.js +32 -31
  262. package/dist/safe-bash-presentation-engine/shape-paths.js +16 -15
  263. package/dist/safe-bash-presentation-engine/shape-presets.js +3 -3
  264. package/dist/safe-bash-presentation-engine/shape-selection.js +31 -30
  265. package/dist/safe-bash-presentation-engine/shape-transforms.js +18 -17
  266. package/dist/safe-bash-presentation-engine/shapes.d.ts +1 -1
  267. package/dist/safe-bash-presentation-engine/shapes.js +27 -26
  268. package/dist/safe-bash-presentation-engine/slide-copy.js +17 -16
  269. package/dist/safe-bash-presentation-engine/slide-import.js +18 -17
  270. package/dist/safe-bash-presentation-engine/slide-merge-split.js +20 -19
  271. package/dist/safe-bash-presentation-engine/slide-model.js +43 -42
  272. package/dist/safe-bash-presentation-engine/slide-removal.js +18 -17
  273. package/dist/safe-bash-presentation-engine/slide-transfer-budget.js +9 -9
  274. package/dist/safe-bash-presentation-engine/slides.js +19 -16
  275. package/dist/safe-bash-presentation-engine/table-operations.js +33 -32
  276. package/dist/safe-bash-presentation-engine/table-spans.js +32 -31
  277. package/dist/safe-bash-presentation-engine/tables.js +31 -30
  278. package/dist/safe-bash-presentation-engine/tags.js +16 -15
  279. package/dist/safe-bash-presentation-engine/template-bindings.js +33 -32
  280. package/dist/safe-bash-presentation-engine/template-repeat.js +40 -39
  281. package/dist/safe-bash-presentation-engine/text-fitting.js +27 -26
  282. package/dist/safe-bash-presentation-engine/text-frames.js +27 -26
  283. package/dist/safe-bash-presentation-engine/text-paragraphs.js +27 -26
  284. package/dist/safe-bash-presentation-engine/text-reading.js +11 -11
  285. package/dist/safe-bash-presentation-engine/text-replacement.js +17 -16
  286. package/dist/safe-bash-presentation-engine/text-runs.js +20 -19
  287. package/dist/safe-bash-presentation-engine/themes.js +16 -15
  288. package/dist/safe-bash-presentation-engine/transitions.js +16 -15
  289. package/dist/safe-bash-presentation-engine/validation.js +10 -9
  290. package/dist/safe-bash-presentation-engine/xml-parts.d.ts +2 -0
  291. package/dist/safe-bash-presentation-engine/xml-parts.js +23 -15
  292. package/dist/safe-bash-presentation-engine/xml-view.js +3 -3
  293. package/dist/safe-bash-presentation-engine/xml.js +3 -3
  294. package/dist/safe-bash-regex-engine/index.js +1 -1
  295. package/dist/safe-bash-regex-engine/python-glob.js +1 -1
  296. package/dist/safe-bash-regex-engine/text/regex.d.ts +19 -0
  297. package/dist/safe-bash-regex-engine/text/regex.js +1 -1
  298. package/dist/safe-bash-xml-engine/document.js +3 -3
  299. package/dist/safe-bash-xml-engine/evaluate.js +1 -1
  300. package/dist/safe-bash-xml-engine/index.d.ts +1 -0
  301. package/dist/safe-bash-xml-engine/index.js +8 -4
  302. package/dist/safe-bash-xml-engine/query.js +2 -2
  303. package/dist/safe-bash-xml-engine/recovery.d.ts +10 -0
  304. package/dist/safe-bash-xml-engine/stored-document.d.ts +1 -1
  305. package/dist/safe-bash-xml-engine/stored-document.js +1 -1
  306. package/dist/safe-bash-xml-engine/stored-evaluate.js +1 -1
  307. package/dist/spreadsheet-engine/formulas/functions/python-printf.js +56 -33
  308. package/dist/spreadsheet-format-xls/biff-encrypted-properties.d.ts +1 -1
  309. package/dist/spreadsheet-format-xls/biff-encrypted-properties.js +47 -18
  310. package/dist/spreadsheet-format-xls/biff-properties-merge.d.ts +6 -2
  311. package/dist/spreadsheet-format-xls/biff-properties-merge.js +413 -296
  312. package/dist/spreadsheet-format-xls/biff-properties-write.js +40 -23
  313. package/dist/spreadsheet-format-xls/biff-properties.js +3 -68
  314. package/dist/spreadsheet-format-xls/biff-property-index.d.ts +23 -0
  315. package/dist/spreadsheet-format-xls/biff-property-index.js +93 -0
  316. package/dist/spreadsheet-format-xls/biff-property-name.d.ts +4 -0
  317. package/dist/spreadsheet-format-xls/biff-property-name.js +114 -0
  318. package/dist/spreadsheet-format-xls/biff-property-text.d.ts +6 -0
  319. package/dist/spreadsheet-format-xls/biff-property-text.js +68 -0
  320. package/dist/spreadsheet-format-xls/biff-property-transcode.d.ts +5 -0
  321. package/dist/spreadsheet-format-xls/biff-property-transcode.js +45 -0
  322. package/package.json +6 -3
  323. package/dist/safe-bash/command-chunks/biff-YKPDH35C-MVQIWNKV.js +0 -4974
  324. package/dist/safe-bash/command-chunks/chunk-5Q22ZLNC.js +0 -127
  325. package/dist/safe-bash/command-chunks/chunk-JKLOBSMP.js +0 -56
  326. package/dist/safe-bash/command-chunks/chunk-JYTESTBS.js +0 -99
  327. package/dist/safe-bash/command-chunks/chunk-ZEGNRZV2.js +0 -333
  328. package/dist/safe-bash/command-chunks/paradox-ZWWXYY4J-JYOSWSBL.js +0 -362
  329. package/dist/spreadsheet-format-xls/biff-properties-layout.js +0 -56
@@ -1,46 +1,88 @@
1
+ import {
2
+ stageRetainedArchive
3
+ } from "./chunk-3D24WDND.js";
4
+ import {
5
+ openPackageArchive
6
+ } from "./chunk-KCE5D4Z4.js";
1
7
  import {
2
8
  openRetainedPresentationIndex,
3
9
  stageRetainedOutput,
4
10
  streamJson
5
- } from "./chunk-L5MCW6CM.js";
11
+ } from "./chunk-X64XGIXZ.js";
6
12
  import {
7
13
  writePackageArchive
8
- } from "./chunk-DM2CPMB4.js";
14
+ } from "./chunk-HKOMXGJS.js";
9
15
  import {
10
16
  SelectionError
11
- } from "./chunk-X7FA7ZD5.js";
17
+ } from "./chunk-O675URF4.js";
12
18
  import {
13
19
  readPackage
14
- } from "./chunk-XPD636C4.js";
20
+ } from "./chunk-PVGZMLC6.js";
15
21
  import {
16
22
  readBinary
17
- } from "./chunk-PNGDJA6M.js";
23
+ } from "./chunk-LD7BONZY.js";
18
24
  import {
25
+ openRetainedPresentationValidation,
19
26
  validatePresentation
20
- } from "./chunk-RNSKXOG3.js";
27
+ } from "./chunk-GVWVRPG6.js";
21
28
  import {
22
- openRetainedContentTypes
23
- } from "./chunk-QC5RMGSA.js";
29
+ dialects,
30
+ openRetainedContentTypes,
31
+ openRetainedRelationshipGraph
32
+ } from "./chunk-G3RUXKVY.js";
24
33
  import {
25
34
  parseXmlPart
26
- } from "./chunk-554Z6IKP.js";
35
+ } from "./chunk-7PRL6RJ6.js";
27
36
  import {
28
37
  parseContentTypes
29
- } from "./chunk-WJCN2IXI.js";
38
+ } from "./chunk-VQOINPVF.js";
30
39
  import {
31
40
  readRelationshipGraph
32
- } from "./chunk-ZMHEGDU2.js";
41
+ } from "./chunk-TODWFDYB.js";
33
42
  import {
34
43
  packageUri,
35
44
  partName
36
- } from "./chunk-36XGIPOG.js";
45
+ } from "./chunk-U5TWQFZY.js";
46
+ import {
47
+ PackageNotFoundError
48
+ } from "./chunk-D55REQA3.js";
37
49
  import {
38
50
  OfficeError,
51
+ RetainedValues,
39
52
  characters,
53
+ equal,
40
54
  literal,
41
55
  openRetainedXml,
42
- openRetainedXmlDocument
43
- } from "./chunk-Q73EMLLZ.js";
56
+ openRetainedXmlDocument,
57
+ resolveOfficeResources
58
+ } from "./chunk-X6RHJ6YN.js";
59
+
60
+ // packages/safe-bash-presentation-engine/src/xml-replacement-rules.ts
61
+ var xmlReplacementSequences = {
62
+ presentation: [
63
+ "sldMasterIdLst",
64
+ "notesMasterIdLst",
65
+ "handoutMasterIdLst",
66
+ "sldIdLst",
67
+ "sldSz",
68
+ "notesSz",
69
+ "smartTags",
70
+ "embeddedFontLst",
71
+ "custShowLst",
72
+ "photoAlbum",
73
+ "custDataLst",
74
+ "kinsoku",
75
+ "defaultTextStyle",
76
+ "modifyVerifier",
77
+ "extLst"
78
+ ],
79
+ sld: ["cSld", "clrMapOvr", "transition", "timing", "extLst"],
80
+ cSld: ["bg", "spTree", "custDataLst", "controls", "extLst"],
81
+ nvGrpSpPr: ["cNvPr", "cNvGrpSpPr", "nvPr"],
82
+ sp: ["nvSpPr", "spPr", "style", "txBody", "extLst"],
83
+ pic: ["nvPicPr", "blipFill", "spPr", "style", "extLst"],
84
+ graphicFrame: ["nvGraphicFramePr", "xfrm", "graphic", "extLst"]
85
+ };
44
86
 
45
87
  // packages/safe-bash-presentation-engine/src/xml-view-validation.ts
46
88
  function reject() {
@@ -344,12 +386,12 @@ async function openRetainedXmlPart(archive, requested, settings, options = {}) {
344
386
  throw error;
345
387
  }
346
388
  }
347
- async function stageRetainedXmlPart(archive, fingerprint, selection, settings, output) {
348
- const options = { ...selection }, format = { ...output }, index = await openRetainedPresentationIndex(archive, fingerprint, settings);
349
- let xml, staged;
389
+ async function selectRetainedXmlPart(archive, fingerprint, selection, settings, allowMetadata = true) {
390
+ const options = { ...selection }, index = await openRetainedPresentationIndex(archive, fingerprint, settings);
391
+ let failed = false;
350
392
  try {
351
393
  let metadata = false;
352
- if (options.scope === "shared" && options.part) {
394
+ if (allowMetadata && options.scope === "shared" && options.part) {
353
395
  metadata = options.part === "/[Content_Types].xml" || options.part === packageUri("/").relsUri;
354
396
  if (!metadata) {
355
397
  for await (const record2 of index.records.records("part")) if (packageUri(record2.part).relsUri === options.part) {
@@ -382,6 +424,23 @@ async function stageRetainedXmlPart(archive, fingerprint, selection, settings, o
382
424
  }
383
425
  const part = metadata ? options.part : record.part;
384
426
  const location = metadata ? { fingerprint, scope: "shared", owner: part, objectId: part, coordinateSystem: "identity" } : record.location;
427
+ return { part, location };
428
+ } catch (error) {
429
+ failed = true;
430
+ throw error;
431
+ } finally {
432
+ try {
433
+ await index.close();
434
+ } catch (error) {
435
+ if (!failed) await Promise.reject(error);
436
+ }
437
+ }
438
+ }
439
+ async function stageRetainedXmlPart(archive, fingerprint, selection, settings, output) {
440
+ const format = { ...output };
441
+ let xml, staged;
442
+ try {
443
+ const { part, location } = await selectRetainedXmlPart(archive, fingerprint, selection, settings);
385
444
  xml = await openRetainedXmlPart(archive, part, settings, { pretty: format.pretty ?? false });
386
445
  const data = xml;
387
446
  async function* render() {
@@ -396,10 +455,497 @@ async function stageRetainedXmlPart(archive, fingerprint, selection, settings, o
396
455
  }
397
456
  staged = await stageRetainedOutput(render(), settings, format.maxOutputBytes);
398
457
  await xml.close();
399
- await index.close();
400
458
  return staged;
401
459
  } catch (error) {
402
- await Promise.allSettled([xml?.close(), index.close(), staged?.close()]);
460
+ await Promise.allSettled([xml?.close(), staged?.close()]);
461
+ throw error;
462
+ }
463
+ }
464
+
465
+ // packages/safe-bash-presentation-engine/src/retained-xml-replacement.ts
466
+ import { PagedStorage as PagedStorage2 } from "@poe-platform/safe-fs/storage";
467
+ function unsupported(message) {
468
+ throw new OfficeError("unsupported-edit", message, "validate-intent");
469
+ }
470
+ function reject2() {
471
+ return unsupported("Structured XML change exceeds the validated child-operation subset.");
472
+ }
473
+ async function is(doc, node, local, namespaces2) {
474
+ if (!await equal(doc.raw(node.localName), literal(local))) return false;
475
+ if (!namespaces2) return true;
476
+ for (const ns of namespaces2) if (await equal(doc.namespace(node), literal(ns))) return true;
477
+ return false;
478
+ }
479
+ async function sameName(left, a, right, b) {
480
+ return await equal(left.raw(a.localName), right.raw(b.localName)) && await equal(left.namespace(a), right.namespace(b));
481
+ }
482
+ async function* children(doc, node) {
483
+ for await (const child of doc.children(node)) if (child.kind === "element") yield child;
484
+ }
485
+ async function typeInfo(source) {
486
+ let prefix = "", suffix = "", pending = 0, started = false, dangerous = false, window = "";
487
+ for await (const value of characters(source)) {
488
+ if (value === ";") break;
489
+ const character = value.toLowerCase();
490
+ if (!character.trim()) {
491
+ if (started) pending++;
492
+ continue;
493
+ }
494
+ if (pending) {
495
+ prefix = (prefix + " ".repeat(Math.min(160, pending))).slice(0, 160);
496
+ suffix = (suffix + " ".repeat(Math.min(4, pending))).slice(-4);
497
+ window = (window + " ".repeat(Math.min(17, pending))).slice(-17);
498
+ pending = 0;
499
+ }
500
+ started = true;
501
+ prefix = (prefix + character).slice(0, 160);
502
+ suffix = (suffix + character).slice(-4);
503
+ window = (window + character).slice(-17);
504
+ if (["digital-signature", "macroenabled", "vbaproject"].some((value2) => window.includes(value2))) dangerous = true;
505
+ }
506
+ return { name: prefix, xml: prefix === "application/xml" || prefix === "text/xml" || suffix === "+xml", dangerous };
507
+ }
508
+ async function openRetainedXmlReplacement(archive, requested, source, settings) {
509
+ const limits = settings.validationLimits && { ...settings.validationLimits };
510
+ if (!limits) throw new OfficeError("invalid-value", "XML operations require explicit validation limits.", "usage");
511
+ const part = partName(requested, false), working = { ...settings.workingStorage }, signal = settings.signal ?? new AbortController().signal;
512
+ const context = { ...resolveOfficeResources(settings), workingStorage: working, signal, xmlLimits: limits, relationshipLimits: limits };
513
+ let found = false;
514
+ if (part === requested) {
515
+ for await (const name of archive.parts()) if (name === part) found = true;
516
+ }
517
+ if (!found) throw new OfficeError("missing-selection", "An exact existing package part is required.", "select");
518
+ const types = await openRetainedContentTypes(archive.read("/[Content_Types].xml"), context, limits);
519
+ const pages = new PagedStorage2({ fs: working.fs, cwd: working.directory, env: {}, signal }, (working.cacheBytes ?? 1024 * 1024) / 16384);
520
+ let before, after, graph, closed = false, closing, serial = 0;
521
+ const check = () => {
522
+ if (closed) throw new OfficeError("invalid-handle", "XML replacement is closed.", "validate-intent");
523
+ if (signal.aborted) throw new OfficeError("cancelled", "Operation cancelled.", "validate-intent");
524
+ };
525
+ const close = () => {
526
+ closed = true;
527
+ return closing ??= (async () => {
528
+ const results = await Promise.allSettled([before?.close(), after?.close(), graph?.close(), types.close(), pages.close()]);
529
+ for (const result of results) if (result.status === "rejected") throw result.reason;
530
+ })();
531
+ };
532
+ const values = new RetainedValues(pages, check, signal);
533
+ async function row(pointer, count) {
534
+ check();
535
+ const bytes = await pages.read(pointer, count * 8), view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
536
+ return Array.from({ length: count }, (_, i) => view.getFloat64(i * 8, true));
537
+ }
538
+ async function write(pointer, row2) {
539
+ check();
540
+ const bytes = new Uint8Array(row2.length * 8), view = new DataView(bytes.buffer);
541
+ row2.forEach((value, i) => view.setFloat64(i * 8, value, true));
542
+ await pages.write(pointer, bytes);
543
+ }
544
+ async function pairs(left, right, visit) {
545
+ let stack = pages.allocate(24);
546
+ await write(stack, [0, left.reference(left.root), right.reference(right.root)]);
547
+ while (stack) {
548
+ const item = await row(stack, 3);
549
+ stack = item[0];
550
+ const a = await left.node(item[1]), b = await right.node(item[2]);
551
+ if (!await visit(a, b)) continue;
552
+ const iterator = children(right, b);
553
+ try {
554
+ for await (const child of children(left, a)) {
555
+ const next = await iterator.next();
556
+ if (next.done) unsupported("XML replacement must preserve element names and sequence.");
557
+ const pointer = pages.allocate(24);
558
+ await write(pointer, [stack, left.reference(child), right.reference(next.value)]);
559
+ stack = pointer;
560
+ }
561
+ if (!(await iterator.next()).done) unsupported("XML replacement must preserve element names and sequence.");
562
+ } finally {
563
+ await iterator.return(void 0);
564
+ }
565
+ }
566
+ }
567
+ async function compareAttributes(left, a, right, b, declarations) {
568
+ const scope = `attributes:${serial++}`;
569
+ let count = 0, compared = 0;
570
+ async function* key(doc, attribute) {
571
+ yield* doc.namespace(attribute);
572
+ yield* literal("\0");
573
+ yield* doc.raw(attribute.localName);
574
+ }
575
+ for await (const attribute of declarations ? left.declarations(a) : left.attributes(a)) {
576
+ if (!declarations && await equal(left.namespace(attribute), literal(""))) continue;
577
+ const name = await values.store(key(left, attribute)), value = await values.store(left.text(attribute));
578
+ await values.insert(scope, name, value);
579
+ count++;
580
+ }
581
+ for await (const attribute of declarations ? right.declarations(b) : right.attributes(b)) {
582
+ if (!declarations && await equal(right.namespace(attribute), literal(""))) continue;
583
+ const value = await values.find(scope, () => key(right, attribute));
584
+ compared++;
585
+ if (!declarations) {
586
+ for (const dialect of dialects) if (await equal(right.namespace(attribute), literal(dialect.r)) && !await graph.get(part, () => right.text(attribute))) throw new OfficeError("invalid-opc", "XML references an absent relationship.", "validate-result");
587
+ }
588
+ if (!value || !await equal(values.read(value), right.text(attribute))) unsupported(declarations ? "XML replacement must preserve namespace declarations." : "Namespaced XML attributes must remain unchanged.");
589
+ }
590
+ if (count !== compared) unsupported(declarations ? "XML replacement must preserve namespace declarations." : "Namespaced XML attributes must remain unchanged.");
591
+ }
592
+ async function guards(current) {
593
+ let nodes = 0, total = 0;
594
+ for await (const name of current.parts()) {
595
+ check();
596
+ if (name === "/[Content_Types].xml") continue;
597
+ const type = await typeInfo(await types.get(name));
598
+ if (type.dangerous || name.toLowerCase().startsWith("/_xmlsignatures/")) unsupported("Signed and macro-enabled packages cannot be changed.");
599
+ if (!type.xml) continue;
600
+ total += await current.byteLength(name);
601
+ if (total > limits.maxBytes || nodes >= limits.maxNodes) throw new OfficeError("resource-limit", "Package XML inspection limit exceeded.", "index");
602
+ const doc = await openRetainedXmlDocument(current.read(name), { ...context, xmlLimits: { ...limits, maxNodes: limits.maxNodes - nodes } });
603
+ let failed = false;
604
+ try {
605
+ nodes += doc.nodeCount;
606
+ for await (const node of doc.elements(doc.root)) {
607
+ for await (const attribute of doc.attributes(node)) for (const dialect of dialects) if (await equal(doc.namespace(attribute), literal(dialect.r)) && !await graph.get(name, () => doc.text(attribute))) throw new OfficeError("invalid-opc", "XML references an absent relationship.", "validate-intent");
608
+ if (await is(doc, node, "modifyVerifier", dialects.map((d) => d.p))) unsupported("Protected presentations cannot be changed.");
609
+ }
610
+ } catch (error) {
611
+ failed = true;
612
+ throw error;
613
+ } finally {
614
+ try {
615
+ await doc.close();
616
+ } catch (error) {
617
+ if (!failed) await Promise.reject(error);
618
+ }
619
+ }
620
+ }
621
+ async function* owners() {
622
+ yield "/";
623
+ yield* graph.parts();
624
+ }
625
+ for await (const owner of owners()) for await (const edge of graph.outgoing(owner)) {
626
+ let window = "";
627
+ for await (const character of characters(edge.type())) {
628
+ window = (window + character).slice(-19);
629
+ if (window.includes("/digital-signature/")) unsupported("Signed and macro-enabled packages cannot be changed.");
630
+ }
631
+ if (window.endsWith("/vbaProject")) unsupported("Signed and macro-enabled packages cannot be changed.");
632
+ }
633
+ }
634
+ async function validate(current) {
635
+ const validation = await openRetainedPresentationValidation(current, context, limits);
636
+ const valid = validation.valid;
637
+ await validation.close();
638
+ if (!valid) throw new OfficeError("invalid-opc", "Replacement fails presentation graph validation.", "validate-result");
639
+ }
640
+ async function strict(left, right, expected) {
641
+ for await (const child of children(right, right.root)) if (await is(right, child, "sldSz") && await equal(right.namespace(child), right.namespace(right.root))) {
642
+ for (const axis of ["cx", "cy"]) {
643
+ let found2 = false;
644
+ for await (const attribute of right.attributes(child)) if (await is(right, attribute, axis, [""])) {
645
+ let number = 0, digits = 0;
646
+ for await (const character of characters(right.text(attribute))) {
647
+ if (character < "0" || character > "9") throw new OfficeError("invalid-opc", "Invalid authored slide dimensions.", "validate-result");
648
+ number = number * 10 + Number(character);
649
+ digits++;
650
+ if (number > 51206400) break;
651
+ }
652
+ if (digits && number >= 914400 && number <= 51206400) found2 = true;
653
+ }
654
+ if (!found2) throw new OfficeError("invalid-opc", "Invalid authored slide dimensions.", "validate-result");
655
+ }
656
+ }
657
+ if (!await is(left, left.root, expected) || !await is(right, right.root, expected)) throw new OfficeError("invalid-opc", "XML root does not match the content type.", "validate-result");
658
+ let dialect;
659
+ for (const value of dialects) if (await equal(left.namespace(left.root), literal(value.p))) dialect = value;
660
+ if (!dialect || !await equal(left.namespace(left.root), right.namespace(right.root))) unsupported("XML replacement must preserve the presentation dialect.");
661
+ const iterator = right.elements(right.root);
662
+ try {
663
+ for await (const node of left.elements(left.root)) {
664
+ const next = await iterator.next();
665
+ if (next.done) unsupported("XML replacement must preserve namespace declarations.");
666
+ await compareAttributes(left, node, right, next.value, true);
667
+ }
668
+ if (!(await iterator.next()).done) unsupported("XML replacement must preserve namespace declarations.");
669
+ } finally {
670
+ await iterator.return(void 0);
671
+ }
672
+ await pairs(left, right, async (a, b) => {
673
+ if (!await sameName(left, a, right, b)) unsupported("XML replacement must preserve element names and sequence.");
674
+ let understood = false;
675
+ for (const ns of [dialect.p, dialect.a]) if (await equal(right.namespace(b), literal(ns))) understood = true;
676
+ if (!understood || await is(right, b, "graphicData") || await is(right, b, "ext")) {
677
+ if (!await equal(left.markup(a), right.markup(b))) unsupported("Opaque XML content must remain unchanged.");
678
+ return false;
679
+ }
680
+ await compareAttributes(left, a, right, b, false);
681
+ if (await is(right, b, "modifyVerifier", dialects.map((d) => d.p))) unsupported("Protection changes are unsupported.");
682
+ if (await equal(right.namespace(b), literal(dialect.p))) {
683
+ for (const [local, order] of Object.entries(xmlReplacementSequences)) if (await is(right, b, local)) {
684
+ let previous = -1;
685
+ for await (const child of children(right, b)) {
686
+ let rank = -1;
687
+ for (let i = 0; i < order.length; i++) if (await is(right, child, order[i])) rank = i;
688
+ if (rank < 0 || rank <= previous) unsupported("Unsupported XML child sequence.");
689
+ previous = rank;
690
+ }
691
+ }
692
+ }
693
+ for await (const attribute of right.attributes(b)) for (const value of dialects) if (value.r !== dialect.r && await equal(right.namespace(attribute), literal(value.r))) unsupported("XML replacement must preserve relationship dialect.");
694
+ return true;
695
+ });
696
+ }
697
+ async function structural(left, right) {
698
+ let dialect = dialects[0];
699
+ for (const value of dialects) if (await equal(left.namespace(left.root), literal(value.p))) dialect = value;
700
+ async function movable2(node) {
701
+ for await (const child of left.elements(node)) {
702
+ let extent = await is(left, child, "ext", [dialect.a]), count = 0;
703
+ for await (const attribute of left.attributes(child)) {
704
+ count++;
705
+ const plain = await equal(left.namespace(attribute), literal(""));
706
+ if (!plain || !await is(left, attribute, "cx") && !await is(left, attribute, "cy")) extent = false;
707
+ if (!plain) {
708
+ let valid = false;
709
+ for (const ns of [...dialects.map((d) => d.r), "http://www.w3.org/XML/1998/namespace"]) if (await equal(left.namespace(attribute), literal(ns))) valid = true;
710
+ if (!valid) return false;
711
+ }
712
+ }
713
+ extent = extent && count === 2;
714
+ if (!await equal(left.namespace(child), literal(dialect.p)) && !await equal(left.namespace(child), literal(dialect.a)) || await is(left, child, "graphicData") || await is(left, child, "ext") && !extent) return false;
715
+ }
716
+ return true;
717
+ }
718
+ await pairs(left, right, async (a, b) => {
719
+ if (await equal(left.markup(a), right.markup(b))) return false;
720
+ if (!await sameName(left, a, right, b) || !await equal(left.shell(a), right.shell(b))) reject2();
721
+ if (!await equal(left.namespace(a), literal(dialect.p)) && !await equal(left.namespace(a), literal(dialect.a)) || await is(left, a, "graphicData") || await is(left, a, "ext")) reject2();
722
+ const drawing = await is(left, a, "spTree", [dialect.p]), paragraph = await is(left, a, "p", [dialect.a]);
723
+ if (!drawing && !paragraph) return true;
724
+ async function eligible(doc, node) {
725
+ for (const name of drawing ? ["sp", "pic", "cxnSp", "grpSp"] : ["r", "br"]) if (await is(doc, node, name, [drawing ? dialect.p : dialect.a])) return true;
726
+ return false;
727
+ }
728
+ async function* fixed(doc, node) {
729
+ for await (const child of children(doc, node)) if (!await eligible(doc, child)) yield child;
730
+ }
731
+ const iterator = fixed(right, b);
732
+ try {
733
+ for await (const child of fixed(left, a)) {
734
+ const next = await iterator.next();
735
+ if (next.done || !await equal(left.markup(child), right.markup(next.value))) reject2();
736
+ }
737
+ if (!(await iterator.next()).done) reject2();
738
+ } finally {
739
+ await iterator.return(void 0);
740
+ }
741
+ const scope = `children:${serial++}`;
742
+ let first = 0, last = 0, index = 0;
743
+ for await (const child of children(left, a)) {
744
+ if (await eligible(left, child)) {
745
+ const pointer = pages.allocate(40);
746
+ await write(pointer, [0, left.reference(child), index, -1, 0]);
747
+ if (last) await write(last, [pointer]);
748
+ else first = pointer;
749
+ last = pointer;
750
+ const existing = await values.find(scope, () => left.markup(child));
751
+ if (existing) {
752
+ const queue = await row(existing.start, 2);
753
+ await write(queue[1] + 32, [pointer]);
754
+ await write(existing.start + 8, [pointer]);
755
+ } else {
756
+ const key = await values.store(left.markup(child)), queue = pages.allocate(16);
757
+ await write(queue, [pointer, pointer]);
758
+ await values.insert(scope, key, { start: queue, length: 16 });
759
+ }
760
+ }
761
+ index++;
762
+ }
763
+ index = 0;
764
+ let matched = true;
765
+ for await (const child of children(right, b)) {
766
+ if (await eligible(right, child)) {
767
+ const queue = await values.find(scope, () => right.markup(child)), head = queue ? (await row(queue.start, 2))[0] : 0;
768
+ if (!head) {
769
+ matched = false;
770
+ break;
771
+ }
772
+ const item = await row(head, 5);
773
+ await write(head + 24, [index]);
774
+ await write(queue.start, [item[4]]);
775
+ }
776
+ index++;
777
+ }
778
+ if (!matched) return true;
779
+ for (let pointer = first; pointer; ) {
780
+ const item = await row(pointer, 5);
781
+ if (item[2] !== item[3] && !await movable2(await left.node(item[1]))) reject2();
782
+ pointer = item[0];
783
+ }
784
+ index = 0;
785
+ let extension = false, end = false;
786
+ for await (const child of children(right, b)) {
787
+ if (drawing) {
788
+ if (index === 0 && !await is(right, child, "nvGrpSpPr") || index === 1 && !await is(right, child, "grpSpPr") || index >= 2 && (await is(right, child, "nvGrpSpPr") || await is(right, child, "grpSpPr")) || extension) reject2();
789
+ if (await is(right, child, "extLst")) extension = true;
790
+ } else {
791
+ let allowed = false;
792
+ for (const name of ["pPr", "r", "br", "endParaRPr"]) if (await is(right, child, name, [dialect.a])) allowed = true;
793
+ if (!allowed || end || index !== 0 && await is(right, child, "pPr")) reject2();
794
+ if (await is(right, child, "endParaRPr")) end = true;
795
+ }
796
+ index++;
797
+ }
798
+ if (drawing && index < 2) reject2();
799
+ return false;
800
+ });
801
+ }
802
+ try {
803
+ const selectedType = part === "/[Content_Types].xml" ? { name: "application/xml", xml: true } : await typeInfo(await types.get(part));
804
+ if (!selectedType.xml) throw new OfficeError("unsupported-profile", "The selected part is not XML.", "select");
805
+ before = await openRetainedXmlDocument(archive.read(part), context);
806
+ async function* admittedReplacement() {
807
+ const checkInput = () => {
808
+ if (signal.aborted) throw new OfficeError("cancelled", "Operation cancelled.", "admit");
809
+ };
810
+ let iterator, exhausted = false, size = 0;
811
+ try {
812
+ iterator = source[Symbol.asyncIterator]();
813
+ } catch {
814
+ checkInput();
815
+ throw new OfficeError("io-failure", "Byte input failed.", "admit");
816
+ }
817
+ try {
818
+ for (let reads = 0; reads < context.limits.maxReads; reads++) {
819
+ checkInput();
820
+ let item;
821
+ try {
822
+ item = await iterator.next();
823
+ } catch (error) {
824
+ checkInput();
825
+ if (error && typeof error === "object" && "code" in error) {
826
+ if (error.code === "ENOENT") throw new PackageNotFoundError();
827
+ if (error.code === "EFBIG") throw new OfficeError("resource-limit", "Byte input exceeds its limit.", "admit");
828
+ }
829
+ throw new OfficeError("io-failure", "Byte input failed.", "admit");
830
+ }
831
+ checkInput();
832
+ if (item.done) {
833
+ exhausted = true;
834
+ return;
835
+ }
836
+ if (!(item.value instanceof Uint8Array)) throw new OfficeError("invalid-type", "Byte source returned an invalid chunk.", "admit");
837
+ if (item.value.length > limits.maxBytes - size || !Number.isSafeInteger(size + item.value.length)) throw new OfficeError("resource-limit", "Byte input exceeds its limit.", "admit");
838
+ size += item.value.length;
839
+ yield item.value;
840
+ }
841
+ throw new OfficeError("resource-limit", "Byte source exceeded its read limit.", "admit");
842
+ } finally {
843
+ if (!exhausted) try {
844
+ await iterator.return?.();
845
+ } catch {
846
+ }
847
+ }
848
+ }
849
+ const replacement = await values.store(admittedReplacement());
850
+ graph = await openRetainedRelationshipGraph(archive, context);
851
+ await guards(archive);
852
+ const expected = (/* @__PURE__ */ new Map([
853
+ ["application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml", "presentation"],
854
+ ["application/vnd.openxmlformats-officedocument.presentationml.template.main+xml", "presentation"],
855
+ ["application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml", "presentation"],
856
+ ["application/vnd.openxmlformats-officedocument.presentationml.slide+xml", "sld"]
857
+ ])).get(selectedType.name);
858
+ if (!expected) unsupported("Replacement supports presentation and slide XML with unchanged element structure.");
859
+ after = await openRetainedXmlDocument(values.read(replacement), context);
860
+ const changed = !await equal(archive.read(part), values.read(replacement));
861
+ const candidate = {
862
+ async *parts() {
863
+ check();
864
+ yield* archive.parts();
865
+ check();
866
+ },
867
+ async has(name) {
868
+ check();
869
+ return archive.has(name);
870
+ },
871
+ async byteLength(name) {
872
+ check();
873
+ return name === part ? replacement.length : archive.byteLength(name);
874
+ },
875
+ async *read(name) {
876
+ check();
877
+ yield* name === part ? values.read(replacement) : archive.read(name);
878
+ check();
879
+ }
880
+ };
881
+ try {
882
+ await strict(before, after, expected);
883
+ await validate(candidate);
884
+ } catch (error) {
885
+ if (!(error instanceof OfficeError) || error.code !== "unsupported-edit") throw error;
886
+ await strict(before, before, expected);
887
+ await validate(archive);
888
+ await structural(before, after);
889
+ await guards(candidate);
890
+ await strict(after, after, expected);
891
+ await validate(candidate);
892
+ }
893
+ await before.close();
894
+ before = void 0;
895
+ await after.close();
896
+ after = void 0;
897
+ await graph.close();
898
+ graph = void 0;
899
+ await types.close();
900
+ check();
901
+ return Object.freeze({ ...candidate, changed, async replacement(name) {
902
+ check();
903
+ return changed && name === part ? values.read(replacement) : void 0;
904
+ }, close });
905
+ } catch (error) {
906
+ await close().catch(() => {
907
+ });
908
+ throw error;
909
+ }
910
+ }
911
+
912
+ // packages/safe-bash-presentation-engine/src/retained-xml-publication.ts
913
+ import { sha256 } from "@noble/hashes/sha2.js";
914
+ async function stageRetainedXmlReplacement(input, replacement, selection, settings, output) {
915
+ const signal = settings.signal ?? new AbortController().signal, hash = sha256.create();
916
+ for await (const bytes of input.stream()) {
917
+ signal.throwIfAborted();
918
+ hash.update(bytes);
919
+ }
920
+ const before = Array.from(hash.digest(), (byte) => byte.toString(16).padStart(2, "0")).join("");
921
+ const archive = await openPackageArchive(input, settings);
922
+ let mutation;
923
+ let staged, response, closing;
924
+ const close = () => closing ??= (async () => {
925
+ const results = await Promise.allSettled([response?.close(), staged?.close(), mutation?.close(), archive.close()]);
926
+ for (const result of results) if (result.status === "rejected") throw result.reason;
927
+ })();
928
+ try {
929
+ const { part, location } = await selectRetainedXmlPart(archive, before, selection, settings, false);
930
+ mutation = await openRetainedXmlReplacement(archive, part, replacement, settings);
931
+ staged = await stageRetainedArchive(input, before, archive, mutation, settings);
932
+ const { bytes, size, fingerprint } = staged, { dryRun } = output;
933
+ async function* content() {
934
+ if (output.destination === "-" && !dryRun) {
935
+ yield* bytes();
936
+ return;
937
+ }
938
+ if (output.json) {
939
+ yield* streamJson({ version: 1, operation: "xml.set", ok: true, data: { part, dryRun }, warnings: [], errors: [], affected: 1, locations: [location] });
940
+ yield new TextEncoder().encode("\n");
941
+ } else yield new TextEncoder().encode(`${dryRun ? "Validated" : "Replaced"} XML part ${part}
942
+ `);
943
+ }
944
+ response = await stageRetainedOutput(content(), settings, output.maxOutputBytes);
945
+ return Object.freeze({ bytes, size, fingerprint, output: response, close });
946
+ } catch (error) {
947
+ await close().catch(() => {
948
+ });
403
949
  throw error;
404
950
  }
405
951
  }
@@ -413,32 +959,7 @@ var relationshipNamespaces = [
413
959
  "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
414
960
  "http://purl.oclc.org/ooxml/officeDocument/relationships"
415
961
  ];
416
- var sequences = {
417
- presentation: [
418
- "sldMasterIdLst",
419
- "notesMasterIdLst",
420
- "handoutMasterIdLst",
421
- "sldIdLst",
422
- "sldSz",
423
- "notesSz",
424
- "smartTags",
425
- "embeddedFontLst",
426
- "custShowLst",
427
- "photoAlbum",
428
- "custDataLst",
429
- "kinsoku",
430
- "defaultTextStyle",
431
- "modifyVerifier",
432
- "extLst"
433
- ],
434
- sld: ["cSld", "clrMapOvr", "transition", "timing", "extLst"],
435
- cSld: ["bg", "spTree", "custDataLst", "controls", "extLst"],
436
- nvGrpSpPr: ["cNvPr", "cNvGrpSpPr", "nvPr"],
437
- sp: ["nvSpPr", "spPr", "style", "txBody", "extLst"],
438
- pic: ["nvPicPr", "blipFill", "spPr", "style", "extLst"],
439
- graphicFrame: ["nvGraphicFramePr", "xfrm", "graphic", "extLst"]
440
- };
441
- function unsupported(message) {
962
+ function unsupported2(message) {
442
963
  throw new OfficeError("unsupported-edit", message, "validate-intent");
443
964
  }
444
965
  function select(reader, requested, context) {
@@ -566,7 +1087,7 @@ function validateXmlPartReplacement(reader, part, bytes, context) {
566
1087
  if (name === "/[Content_Types].xml") continue;
567
1088
  const type = contentTypes.get(name).split(";", 1)[0].trim().toLowerCase();
568
1089
  if (type.includes("digital-signature") || type.includes("macroenabled") || type.includes("vbaproject") || name.toLowerCase().startsWith("/_xmlsignatures/"))
569
- unsupported("Signed and macro-enabled packages cannot be changed.");
1090
+ unsupported2("Signed and macro-enabled packages cannot be changed.");
570
1091
  if (type.endsWith("+xml") || type === "application/xml" || type === "text/xml") {
571
1092
  const data = reader.get(name);
572
1093
  total += data.length;
@@ -588,7 +1109,7 @@ function validateXmlPartReplacement(reader, part, bytes, context) {
588
1109
  "validate-intent"
589
1110
  );
590
1111
  if (namespaces.includes(node.name.namespace) && node.name.localName === "modifyVerifier")
591
- unsupported("Protected presentations cannot be changed.");
1112
+ unsupported2("Protected presentations cannot be changed.");
592
1113
  pending2.push(...node.children);
593
1114
  }
594
1115
  }
@@ -597,7 +1118,7 @@ function validateXmlPartReplacement(reader, part, bytes, context) {
597
1118
  if (graph.outgoing(owner).some(
598
1119
  (edge) => edge.type.includes("/digital-signature/") || edge.type.endsWith("/vbaProject")
599
1120
  ))
600
- unsupported("Signed and macro-enabled packages cannot be changed.");
1121
+ unsupported2("Signed and macro-enabled packages cannot be changed.");
601
1122
  const root = selected.document.root;
602
1123
  const expected = (/* @__PURE__ */ new Map([
603
1124
  [
@@ -615,7 +1136,7 @@ function validateXmlPartReplacement(reader, part, bytes, context) {
615
1136
  ["application/vnd.openxmlformats-officedocument.presentationml.slide+xml", "sld"]
616
1137
  ])).get(selected.contentType);
617
1138
  if (!expected)
618
- unsupported(
1139
+ unsupported2(
619
1140
  "Replacement supports presentation and slide XML with unchanged element structure."
620
1141
  );
621
1142
  const changed = parseXmlPart(bytes, context.validationLimits);
@@ -642,9 +1163,9 @@ function validateXmlPartReplacement(reader, part, bytes, context) {
642
1163
  "validate-result"
643
1164
  );
644
1165
  if (!namespaces.includes(root.name.namespace) || root.name.namespace !== changed.root.name.namespace)
645
- unsupported("XML replacement must preserve the presentation dialect.");
1166
+ unsupported2("XML replacement must preserve the presentation dialect.");
646
1167
  if (namespaceDeclarations(selected.document) !== namespaceDeclarations(changed))
647
- unsupported("XML replacement must preserve namespace declarations.");
1168
+ unsupported2("XML replacement must preserve namespace declarations.");
648
1169
  const pending = [{ before: root, after: changed.root }];
649
1170
  const understood = [
650
1171
  root.name.namespace,
@@ -654,10 +1175,10 @@ function validateXmlPartReplacement(reader, part, bytes, context) {
654
1175
  while (pending.length) {
655
1176
  const { before, after } = pending.pop();
656
1177
  if (before.name.namespace !== after.name.namespace || before.name.localName !== after.name.localName || before.children.length !== after.children.length)
657
- unsupported("XML replacement must preserve element names and sequence.");
1178
+ unsupported2("XML replacement must preserve element names and sequence.");
658
1179
  if (!understood.includes(after.name.namespace) || ["graphicData", "ext"].includes(after.name.localName)) {
659
1180
  if (selected.document.markup(before) !== changed.markup(after))
660
- unsupported("Opaque XML content must remain unchanged.");
1181
+ unsupported2("Opaque XML content must remain unchanged.");
661
1182
  continue;
662
1183
  }
663
1184
  for (const attribute of [...before.attributes, ...after.attributes]) {
@@ -672,22 +1193,22 @@ function validateXmlPartReplacement(reader, part, bytes, context) {
672
1193
  "validate-result"
673
1194
  );
674
1195
  if (left?.value !== right?.value)
675
- unsupported("Namespaced XML attributes must remain unchanged.");
1196
+ unsupported2("Namespaced XML attributes must remain unchanged.");
676
1197
  }
677
1198
  if (namespaces.includes(after.name.namespace) && after.name.localName === "modifyVerifier")
678
- unsupported("Protection changes are unsupported.");
679
- const order = after.name.namespace === root.name.namespace ? sequences[after.name.localName] : void 0;
1199
+ unsupported2("Protection changes are unsupported.");
1200
+ const order = after.name.namespace === root.name.namespace ? xmlReplacementSequences[after.name.localName] : void 0;
680
1201
  if (order) {
681
1202
  let previous = -1;
682
1203
  for (const child of after.children) {
683
1204
  const rank = order.indexOf(child.name.localName);
684
- if (rank < 0 || rank <= previous) unsupported("Unsupported XML child sequence.");
1205
+ if (rank < 0 || rank <= previous) unsupported2("Unsupported XML child sequence.");
685
1206
  previous = rank;
686
1207
  }
687
1208
  }
688
1209
  for (const attribute of after.attributes) {
689
1210
  if (relationshipNamespaces.includes(attribute.name.namespace) && attribute.name.namespace !== relationshipNamespaces[namespaces.indexOf(root.name.namespace)])
690
- unsupported("XML replacement must preserve relationship dialect.");
1211
+ unsupported2("XML replacement must preserve relationship dialect.");
691
1212
  }
692
1213
  after.children.forEach(
693
1214
  (child, index) => pending.push({ before: before.children[index], after: child })
@@ -712,6 +1233,8 @@ export {
712
1233
  validateXmlViewReplacement,
713
1234
  openRetainedXmlPart,
714
1235
  stageRetainedXmlPart,
1236
+ openRetainedXmlReplacement,
1237
+ stageRetainedXmlReplacement,
715
1238
  getXmlPart,
716
1239
  replaceXmlPart,
717
1240
  validateXmlPartReplacement