@poe-platform/safe-bash 0.1.810 → 0.1.811

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 (248) hide show
  1. package/dist/audio-ast/flac-source.d.ts +13 -0
  2. package/dist/audio-ast/index.d.ts +1 -0
  3. package/dist/audio-ast/index.js +248 -179
  4. package/dist/json-ast/backed-json-parser.d.ts +12 -1
  5. package/dist/json-ast/index.d.ts +1 -1
  6. package/dist/office-xml/index.d.ts +1 -0
  7. package/dist/office-xml/retained-xml-edits.d.ts +22 -0
  8. package/dist/pdf-ast/cos/qpdf-json-document.d.ts +2 -1
  9. package/dist/pdf-ast/index.js +151 -56
  10. package/dist/pdf-ast/retained-document.d.ts +2 -0
  11. package/dist/safe-bash/audio-ast.browser.js +2 -1
  12. package/dist/safe-bash/chunks/{chunk-65TFMAZU.js → chunk-BUYRKFW2.js} +8 -35
  13. package/dist/safe-bash/chunks/{chunk-ZA5FQ34E.js → chunk-TPG55BAQ.js} +0 -2
  14. package/dist/safe-bash/command-chunks/{biff-ORSHM4YX-QYPGRDAZ.js → biff-3EFLKBAH-NYWZOYQS.js} +2141 -2136
  15. package/dist/safe-bash/command-chunks/{chunk-HEHGHIE2.js → chunk-22MOB45U.js} +6 -6
  16. package/dist/safe-bash/command-chunks/{chunk-6DEWZMOL.js → chunk-2CORNDGF.js} +2 -2
  17. package/dist/safe-bash/command-chunks/{chunk-6UHGIWFX.js → chunk-2ZFLMWOX.js} +1 -1
  18. package/dist/safe-bash/command-chunks/{chunk-HONWGFDA.js → chunk-33YCKZZX.js} +6 -6
  19. package/dist/safe-bash/command-chunks/{chunk-AXWPJRY6.js → chunk-36XGIPOG.js} +1 -1
  20. package/dist/safe-bash/command-chunks/{chunk-32ADKP5E.js → chunk-456PHA3L.js} +1 -1
  21. package/dist/safe-bash/command-chunks/{chunk-UJXP3T6R.js → chunk-4CKFNXRN.js} +1 -1
  22. package/dist/safe-bash/command-chunks/{chunk-5L6GHFRW.js → chunk-554Z6IKP.js} +2 -2
  23. package/dist/safe-bash/command-chunks/{chunk-ORZRWT62.js → chunk-56NYSX65.js} +9 -9
  24. package/dist/safe-bash/command-chunks/{chunk-53JP3S6H.js → chunk-5HPU7D36.js} +4 -4
  25. package/dist/safe-bash/command-chunks/{chunk-YTFWPJ3F.js → chunk-5LI2DLNZ.js} +26 -26
  26. package/dist/safe-bash/command-chunks/{chunk-CHR2OD2U.js → chunk-5MB64DWR.js} +9 -9
  27. package/dist/safe-bash/command-chunks/{chunk-3ZWBBS6U.js → chunk-5OO2P27R.js} +340 -34
  28. package/dist/safe-bash/command-chunks/{chunk-IC5GJI7E.js → chunk-5Q22ZLNC.js} +6 -6
  29. package/dist/safe-bash/command-chunks/{chunk-YO3V5RLY.js → chunk-6CCQI6XZ.js} +12 -12
  30. package/dist/safe-bash/command-chunks/{chunk-EO2IVGV7.js → chunk-6M6TM5Z5.js} +3 -3
  31. package/dist/safe-bash/command-chunks/{chunk-Z54Z3KRN.js → chunk-6QBMND4A.js} +1 -1
  32. package/dist/safe-bash/command-chunks/{chunk-INX4JMQ6.js → chunk-6VPQ3CDZ.js} +5 -5
  33. package/dist/safe-bash/command-chunks/{chunk-D5AYP2UM.js → chunk-72C3TZ2U.js} +25 -15
  34. package/dist/safe-bash/command-chunks/{chunk-VGXVN3BX.js → chunk-7GKKMNL6.js} +8 -8
  35. package/dist/safe-bash/command-chunks/{chunk-TZJC67W3.js → chunk-7PVHO47B.js} +6 -6
  36. package/dist/safe-bash/command-chunks/{chunk-CM3C7AXJ.js → chunk-A2CLZMQZ.js} +1 -1
  37. package/dist/safe-bash/command-chunks/{chunk-ASR27KHW.js → chunk-A5FZBR7X.js} +4 -4
  38. package/dist/safe-bash/command-chunks/{chunk-DMDHE5KC.js → chunk-AHA6IWAJ.js} +6 -6
  39. package/dist/safe-bash/command-chunks/{chunk-PTZ55XXN.js → chunk-APEWTWCC.js} +6 -6
  40. package/dist/safe-bash/command-chunks/{chunk-YUVH6CE4.js → chunk-ATTWQVR2.js} +17 -17
  41. package/dist/safe-bash/command-chunks/{chunk-JON5DB3Z.js → chunk-B5LDP7AA.js} +2 -2
  42. package/dist/safe-bash/command-chunks/{chunk-CHJL6JMU.js → chunk-COKYZUBW.js} +1 -1
  43. package/dist/safe-bash/command-chunks/{chunk-KCTV4NVX.js → chunk-CRV2Q3PB.js} +1 -1
  44. package/dist/safe-bash/command-chunks/{chunk-V3WXPCKN.js → chunk-CV7M2QJU.js} +7 -7
  45. package/dist/safe-bash/command-chunks/{chunk-VPDSQPSN.js → chunk-DM2CPMB4.js} +2 -2
  46. package/dist/safe-bash/command-chunks/{chunk-3DTDMEOP.js → chunk-EAGIJ4VW.js} +1 -1
  47. package/dist/safe-bash/command-chunks/{chunk-JW6CMBF2.js → chunk-EHSM5ZQS.js} +8 -8
  48. package/dist/safe-bash/command-chunks/{chunk-WIOH7ZQN.js → chunk-ENT3IV2G.js} +12 -12
  49. package/dist/safe-bash/command-chunks/{chunk-5IE4LJGB.js → chunk-EUT24Y5Z.js} +8 -8
  50. package/dist/safe-bash/command-chunks/{chunk-COKZFXHG.js → chunk-FIIAYCWS.js} +2 -2
  51. package/dist/safe-bash/command-chunks/{chunk-MWVFP2HY.js → chunk-GEM47B2P.js} +7 -7
  52. package/dist/safe-bash/command-chunks/{chunk-EHL6B34L.js → chunk-HDJVJTCK.js} +9 -9
  53. package/dist/safe-bash/command-chunks/{chunk-JMM3MNAY.js → chunk-HKATEVAP.js} +6 -6
  54. package/dist/safe-bash/command-chunks/{chunk-VWY3EAVQ.js → chunk-HTVIYLVB.js} +4 -4
  55. package/dist/safe-bash/command-chunks/{chunk-Z4QJMDK3.js → chunk-IT7TAC3F.js} +16 -16
  56. package/dist/safe-bash/command-chunks/{chunk-EWS4KYJE.js → chunk-JFYWVQ4V.js} +8 -8
  57. package/dist/safe-bash/command-chunks/{chunk-ZCX63QWA.js → chunk-JOCFI7TG.js} +1 -1
  58. package/dist/safe-bash/command-chunks/{chunk-F5WTH4O4.js → chunk-JQVHUSDD.js} +5 -5
  59. package/dist/safe-bash/command-chunks/{chunk-O4VJEGL6.js → chunk-K5GB2YMN.js} +10 -10
  60. package/dist/safe-bash/command-chunks/{chunk-27C3NT5V.js → chunk-KB7DUBVL.js} +5 -5
  61. package/dist/safe-bash/command-chunks/{chunk-4DZ32PI7.js → chunk-KCOJA7EM.js} +7 -7
  62. package/dist/safe-bash/command-chunks/{chunk-CAXJ4RLF.js → chunk-KJ4XXZIL.js} +12 -12
  63. package/dist/safe-bash/command-chunks/{chunk-BYZUOF6X.js → chunk-KL3OIBKB.js} +3742 -3726
  64. package/dist/safe-bash/command-chunks/{chunk-U6QHTC5J.js → chunk-L5MCW6CM.js} +4 -4
  65. package/dist/safe-bash/command-chunks/{chunk-LVL3A7YE.js → chunk-LCZDBW55.js} +5 -5
  66. package/dist/safe-bash/command-chunks/{chunk-DJVRDUCA.js → chunk-LXLLA4PM.js} +17 -17
  67. package/dist/safe-bash/command-chunks/{chunk-K7AGAS3K.js → chunk-M7QE2MN7.js} +6 -6
  68. package/dist/safe-bash/command-chunks/{chunk-SWT6ILF2.js → chunk-MPUHH2KR.js} +3 -3
  69. package/dist/safe-bash/command-chunks/{chunk-DC3OJLRB.js → chunk-NQDIT667.js} +5 -5
  70. package/dist/safe-bash/command-chunks/{chunk-LWZVDDJA.js → chunk-NUGQQDGE.js} +5 -1
  71. package/dist/safe-bash/command-chunks/{chunk-MFLQZLFR.js → chunk-OA75SGN2.js} +7 -7
  72. package/dist/safe-bash/command-chunks/{chunk-5LATYOF7.js → chunk-OEJM666F.js} +5 -5
  73. package/dist/safe-bash/command-chunks/{chunk-AF25YYIO.js → chunk-PMAM4N33.js} +9 -9
  74. package/dist/safe-bash/command-chunks/{chunk-KMMAJ6H6.js → chunk-PNGDJA6M.js} +2 -2
  75. package/dist/safe-bash/command-chunks/{chunk-62BHPSKJ.js → chunk-Q6S57NOQ.js} +7 -7
  76. package/dist/safe-bash/command-chunks/{chunk-KJ3PEDI2.js → chunk-Q73EMLLZ.js} +146 -4
  77. package/dist/safe-bash/command-chunks/{chunk-FXKBM5KJ.js → chunk-QC5RMGSA.js} +3 -3
  78. package/dist/safe-bash/command-chunks/{chunk-UQ6UIZMM.js → chunk-QD7ZRDUN.js} +1 -1
  79. package/dist/safe-bash/command-chunks/{chunk-JHUYZZGV.js → chunk-QYMEASQ6.js} +4 -4
  80. package/dist/safe-bash/command-chunks/{chunk-3GY5VDIX.js → chunk-QZZ73J2O.js} +6 -6
  81. package/dist/safe-bash/command-chunks/{chunk-S2CYIGWH.js → chunk-R6EGGK5M.js} +7 -7
  82. package/dist/safe-bash/command-chunks/{chunk-7AVN3OBH.js → chunk-RHYJVTJO.js} +2 -2
  83. package/dist/safe-bash/command-chunks/{chunk-EWGDSO6U.js → chunk-RID6VYS3.js} +8 -8
  84. package/dist/safe-bash/command-chunks/{chunk-MMBRBANA.js → chunk-RNSKXOG3.js} +6 -6
  85. package/dist/safe-bash/command-chunks/{chunk-D3ZRZTY5.js → chunk-RQIQ75W5.js} +5 -5
  86. package/dist/safe-bash/command-chunks/{chunk-DWKQPLRT.js → chunk-RRL3Y562.js} +11 -11
  87. package/dist/safe-bash/command-chunks/{chunk-NXCMXD74.js → chunk-S6R3IB36.js} +1 -1
  88. package/dist/safe-bash/command-chunks/{chunk-XUPKFHAQ.js → chunk-SDTPO2VV.js} +7 -7
  89. package/dist/safe-bash/command-chunks/{chunk-PIAGKRFW.js → chunk-SPLOIABU.js} +3 -3
  90. package/dist/safe-bash/command-chunks/{chunk-WLTJDNSQ.js → chunk-TVH4JORU.js} +3 -3
  91. package/dist/safe-bash/command-chunks/{chunk-6XVMWFHD.js → chunk-TW73OXPR.js} +6 -6
  92. package/dist/safe-bash/command-chunks/{chunk-SFO43CID.js → chunk-UAXSE3XE.js} +5 -5
  93. package/dist/safe-bash/command-chunks/{chunk-K35BSUHO.js → chunk-UYWSIIUX.js} +7 -7
  94. package/dist/safe-bash/command-chunks/{chunk-DCD32BEY.js → chunk-VU3EQF7F.js} +91 -53
  95. package/dist/safe-bash/command-chunks/{chunk-2E2YEDVB.js → chunk-W5YSINXC.js} +6 -6
  96. package/dist/safe-bash/command-chunks/{chunk-EYNT4OEJ.js → chunk-WGG6G2KG.js} +7 -7
  97. package/dist/safe-bash/command-chunks/{chunk-DVQBZXMQ.js → chunk-WJCN2IXI.js} +2 -2
  98. package/dist/safe-bash/command-chunks/{chunk-XBZ4ZWGL.js → chunk-WVMHRNXZ.js} +3 -3
  99. package/dist/safe-bash/command-chunks/{chunk-7GXUCQI4.js → chunk-WXRYDALR.js} +4 -4
  100. package/dist/safe-bash/command-chunks/{chunk-S4IIOSRA.js → chunk-X7FA7ZD5.js} +8 -8
  101. package/dist/safe-bash/command-chunks/{chunk-SFCERNHU.js → chunk-XPD636C4.js} +3 -3
  102. package/dist/safe-bash/command-chunks/{chunk-HYDWQLJ3.js → chunk-XRVKWGVQ.js} +6 -6
  103. package/dist/safe-bash/command-chunks/{chunk-3UJWHRK4.js → chunk-XVP6V5K3.js} +6 -6
  104. package/dist/safe-bash/command-chunks/{chunk-KTI3BULE.js → chunk-XZ2FWFNV.js} +6 -6
  105. package/dist/safe-bash/command-chunks/{chunk-QK3CHRGL.js → chunk-Y4EYCZFT.js} +10 -10
  106. package/dist/safe-bash/command-chunks/{chunk-GTWVMFBK.js → chunk-YORJDX4V.js} +4 -4
  107. package/dist/safe-bash/command-chunks/{chunk-H6F5SN2N.js → chunk-YSMNXMAO.js} +4 -4
  108. package/dist/safe-bash/command-chunks/{chunk-ZEPDT6I5.js → chunk-YSY6R6AS.js} +21 -25
  109. package/dist/safe-bash/command-chunks/{chunk-SE5SJ4JT.js → chunk-Z2JW6M2D.js} +3 -3
  110. package/dist/safe-bash/command-chunks/{chunk-WC2OCF4H.js → chunk-ZHRGYR7B.js} +7 -7
  111. package/dist/safe-bash/command-chunks/{chunk-HQYFRQ5W.js → chunk-ZIIO6GRY.js} +7 -7
  112. package/dist/safe-bash/command-chunks/{chunk-NTRZMQZP.js → chunk-ZMHEGDU2.js} +2 -2
  113. package/dist/safe-bash/command-chunks/{chunk-EYBXHGA6.js → chunk-ZXR6LXV5.js} +2 -2
  114. package/dist/safe-bash/command-chunks/{engine-MEPOXIXT-WZMRHACG.js → engine-AXXFTGCL-QBQNBI6K.js} +1 -1
  115. package/dist/safe-bash/command-chunks/pdf-XHHFTOT4-UJJYOYJ2.js +573 -0
  116. package/dist/safe-bash/commands/diff-patch/index.js +0 -3
  117. package/dist/safe-bash/commands/diff3/index.js +0 -2
  118. package/dist/safe-bash/full-core.browser.js +2 -2
  119. package/dist/safe-bash/plugins/index.browser.js +2 -2
  120. package/dist/safe-bash/plugins/index.js +3 -1
  121. package/dist/safe-bash/plugins/portable-commands.d.ts +1 -1
  122. package/dist/safe-bash/plugins/portable-commands.js +5 -3
  123. package/dist/safe-bash/registry-entry.browser.js +1 -1
  124. package/dist/safe-bash-command-diff/index.js +0 -2
  125. package/dist/safe-bash-command-diff3/index.js +830 -56
  126. package/dist/safe-bash-command-ffmpeg/index.js +1 -1
  127. package/dist/safe-bash-command-ffprobe/index.js +2 -2
  128. package/dist/safe-bash-command-ffprobe/media.js +2 -2
  129. package/dist/safe-bash-command-html-to-markdown/index.js +75 -21
  130. package/dist/safe-bash-command-pandoc/command.js +3 -3
  131. package/dist/safe-bash-command-pandoc/execution.d.ts +2 -2
  132. package/dist/safe-bash-command-pandoc/index.d.ts +1 -1
  133. package/dist/safe-bash-command-pandoc/index.js +14 -14
  134. package/dist/safe-bash-command-pandoc/lua-filters.js +2 -2
  135. package/dist/safe-bash-command-pandoc/types.d.ts +17 -2
  136. package/dist/safe-bash-command-patch/index.js +1 -1
  137. package/dist/safe-bash-command-patch/patch.js +1 -1
  138. package/dist/safe-bash-command-pdftk/index.js +616 -265
  139. package/dist/safe-bash-command-qpdf/index.js +115 -9
  140. package/dist/safe-bash-command-soffice/index.js +1 -1
  141. package/dist/safe-bash-command-ssconvert/index.js +2 -2
  142. package/dist/safe-bash-command-xq/index.js +45 -29
  143. package/dist/safe-bash-presentation-engine/accessibility.js +30 -30
  144. package/dist/safe-bash-presentation-engine/animation-editing.js +15 -15
  145. package/dist/safe-bash-presentation-engine/animations.js +15 -15
  146. package/dist/safe-bash-presentation-engine/backgrounds.js +16 -16
  147. package/dist/safe-bash-presentation-engine/bytes.js +3 -3
  148. package/dist/safe-bash-presentation-engine/chart-editing.js +33 -33
  149. package/dist/safe-bash-presentation-engine/chart-object-operations.js +24 -24
  150. package/dist/safe-bash-presentation-engine/charts.js +30 -30
  151. package/dist/safe-bash-presentation-engine/command-placeholder.js +55 -55
  152. package/dist/safe-bash-presentation-engine/comments.js +16 -16
  153. package/dist/safe-bash-presentation-engine/connector-operations.js +31 -31
  154. package/dist/safe-bash-presentation-engine/connectors.js +28 -28
  155. package/dist/safe-bash-presentation-engine/content-types.js +4 -4
  156. package/dist/safe-bash-presentation-engine/creation.js +6 -6
  157. package/dist/safe-bash-presentation-engine/diff.js +31 -31
  158. package/dist/safe-bash-presentation-engine/drawing-format.js +19 -19
  159. package/dist/safe-bash-presentation-engine/drawing-operations.js +30 -30
  160. package/dist/safe-bash-presentation-engine/drawing-schema.js +20 -20
  161. package/dist/safe-bash-presentation-engine/equations.js +16 -16
  162. package/dist/safe-bash-presentation-engine/errors.js +2 -2
  163. package/dist/safe-bash-presentation-engine/fields.js +16 -16
  164. package/dist/safe-bash-presentation-engine/font-metrics.js +3 -3
  165. package/dist/safe-bash-presentation-engine/image-extraction.js +19 -19
  166. package/dist/safe-bash-presentation-engine/image-formatting.js +31 -31
  167. package/dist/safe-bash-presentation-engine/image-insertion.js +17 -17
  168. package/dist/safe-bash-presentation-engine/image-replacement.js +20 -20
  169. package/dist/safe-bash-presentation-engine/image-value.js +4 -4
  170. package/dist/safe-bash-presentation-engine/images.js +18 -18
  171. package/dist/safe-bash-presentation-engine/index.d.ts +1 -1
  172. package/dist/safe-bash-presentation-engine/index.js +95 -93
  173. package/dist/safe-bash-presentation-engine/layouts.js +15 -15
  174. package/dist/safe-bash-presentation-engine/length.js +3 -3
  175. package/dist/safe-bash-presentation-engine/links.js +15 -15
  176. package/dist/safe-bash-presentation-engine/masters.js +14 -14
  177. package/dist/safe-bash-presentation-engine/media-editing.js +23 -23
  178. package/dist/safe-bash-presentation-engine/media-extraction.js +16 -16
  179. package/dist/safe-bash-presentation-engine/media.js +15 -15
  180. package/dist/safe-bash-presentation-engine/memberships.js +14 -14
  181. package/dist/safe-bash-presentation-engine/notes.js +15 -15
  182. package/dist/safe-bash-presentation-engine/ole-enum.js +4 -4
  183. package/dist/safe-bash-presentation-engine/ole-insertion.js +19 -19
  184. package/dist/safe-bash-presentation-engine/opaque-objects.js +9 -9
  185. package/dist/safe-bash-presentation-engine/package-reader.js +5 -5
  186. package/dist/safe-bash-presentation-engine/package-tools.js +15 -15
  187. package/dist/safe-bash-presentation-engine/package-uri.js +3 -3
  188. package/dist/safe-bash-presentation-engine/package-writer.js +4 -4
  189. package/dist/safe-bash-presentation-engine/presentation-model.js +54 -54
  190. package/dist/safe-bash-presentation-engine/presentation-settings.js +13 -13
  191. package/dist/safe-bash-presentation-engine/properties.js +15 -15
  192. package/dist/safe-bash-presentation-engine/relationships.js +4 -4
  193. package/dist/safe-bash-presentation-engine/resource-limits.js +1 -1
  194. package/dist/safe-bash-presentation-engine/retained-inspection.js +12 -12
  195. package/dist/safe-bash-presentation-engine/retained-package.js +4 -4
  196. package/dist/safe-bash-presentation-engine/retained-slide-settings.d.ts +15 -0
  197. package/dist/safe-bash-presentation-engine/retained-text.js +17 -17
  198. package/dist/safe-bash-presentation-engine/sanitize.js +16 -16
  199. package/dist/safe-bash-presentation-engine/selectors.js +10 -10
  200. package/dist/safe-bash-presentation-engine/shape-groups.js +30 -30
  201. package/dist/safe-bash-presentation-engine/shape-operations.js +29 -29
  202. package/dist/safe-bash-presentation-engine/shape-path-operations.js +31 -31
  203. package/dist/safe-bash-presentation-engine/shape-paths.js +15 -15
  204. package/dist/safe-bash-presentation-engine/shape-presets.js +3 -3
  205. package/dist/safe-bash-presentation-engine/shape-selection.js +30 -30
  206. package/dist/safe-bash-presentation-engine/shape-transforms.js +17 -17
  207. package/dist/safe-bash-presentation-engine/shapes.js +26 -26
  208. package/dist/safe-bash-presentation-engine/slide-copy.js +16 -16
  209. package/dist/safe-bash-presentation-engine/slide-import.js +17 -17
  210. package/dist/safe-bash-presentation-engine/slide-merge-split.js +19 -19
  211. package/dist/safe-bash-presentation-engine/slide-model.js +42 -42
  212. package/dist/safe-bash-presentation-engine/slide-removal.js +17 -17
  213. package/dist/safe-bash-presentation-engine/slide-transfer-budget.js +9 -9
  214. package/dist/safe-bash-presentation-engine/slides.d.ts +2 -0
  215. package/dist/safe-bash-presentation-engine/slides.js +21 -16
  216. package/dist/safe-bash-presentation-engine/table-operations.js +32 -32
  217. package/dist/safe-bash-presentation-engine/table-spans.js +31 -31
  218. package/dist/safe-bash-presentation-engine/tables.js +30 -30
  219. package/dist/safe-bash-presentation-engine/tags.js +15 -15
  220. package/dist/safe-bash-presentation-engine/template-bindings.js +32 -32
  221. package/dist/safe-bash-presentation-engine/template-repeat.js +39 -39
  222. package/dist/safe-bash-presentation-engine/text-fitting.js +26 -26
  223. package/dist/safe-bash-presentation-engine/text-frames.js +26 -26
  224. package/dist/safe-bash-presentation-engine/text-paragraphs.js +26 -26
  225. package/dist/safe-bash-presentation-engine/text-reading.js +11 -11
  226. package/dist/safe-bash-presentation-engine/text-replacement.js +16 -16
  227. package/dist/safe-bash-presentation-engine/text-runs.js +19 -19
  228. package/dist/safe-bash-presentation-engine/themes.js +15 -15
  229. package/dist/safe-bash-presentation-engine/transitions.js +15 -15
  230. package/dist/safe-bash-presentation-engine/validation.js +9 -9
  231. package/dist/safe-bash-presentation-engine/xml-parts.js +15 -15
  232. package/dist/safe-bash-presentation-engine/xml-view.js +3 -3
  233. package/dist/safe-bash-presentation-engine/xml.js +3 -3
  234. package/dist/safe-bash-xml-engine/json.d.ts +1 -0
  235. package/dist/safe-bash-xml-engine/json.js +203 -0
  236. package/dist/safe-bash-xml-engine/stored-json.d.ts +5 -0
  237. package/dist/spreadsheet-engine/rendering/print/bidi-runs.d.ts +5 -0
  238. package/dist/spreadsheet-engine/rendering/print/bidi-runs.js +35 -0
  239. package/dist/spreadsheet-engine/rendering/print/control-bidi.d.ts +8 -0
  240. package/dist/spreadsheet-engine/rendering/print/control-bidi.js +80 -0
  241. package/dist/spreadsheet-format-xls/biff-encrypted-properties.d.ts +4 -4
  242. package/dist/spreadsheet-format-xls/biff-encrypted-properties.js +36 -23
  243. package/dist/spreadsheet-format-xls/biff-encryption.js +1 -1
  244. package/dist/spreadsheet-format-xls/biff-property-bytes.d.ts +4 -1
  245. package/dist/spreadsheet-format-xls/biff-property-bytes.js +1 -1
  246. package/dist/spreadsheet-format-xls/biff-range.js +1 -1
  247. package/package.json +5 -2
  248. package/dist/safe-bash/command-chunks/pdf-LOZAXXS6-ERI57IAV.js +0 -557
@@ -0,0 +1,573 @@
1
+ import {
2
+ f
3
+ } from "./chunk-YXIB6JV5.js";
4
+ import {
5
+ n,
6
+ o
7
+ } from "./chunk-HQAHDJPX.js";
8
+ import {
9
+ a as a2,
10
+ p as p2
11
+ } from "./chunk-2BKOSQD3.js";
12
+ import {
13
+ p
14
+ } from "./chunk-4XWFUW5L.js";
15
+ import {
16
+ t
17
+ } from "./chunk-Y4RGZJIG.js";
18
+ import {
19
+ a
20
+ } from "./chunk-KDG3J4GN.js";
21
+ import {
22
+ e
23
+ } from "./chunk-SB3DHPKZ.js";
24
+ import "./chunk-WHWIZ2B7.js";
25
+ import "./chunk-65DS4IOB.js";
26
+
27
+ // packages/safe-bash-command-ssconvert/dist/chunks/pdf-XHHFTOT4.js
28
+ import { controlBidiItems as Le } from "../../spreadsheet-engine/rendering/print/control-bidi.js";
29
+ import { printBidiRuns as He } from "../../spreadsheet-engine/rendering/print/bidi-runs.js";
30
+ import { rotatedPrintLayout as ue } from "../../spreadsheet-engine/rendering/print/rotated-text.js";
31
+ import { printSharedBorders as Ee } from "../../spreadsheet-engine/rendering/print/shared-borders.js";
32
+ import { printBorderStrokes as Ge } from "../../spreadsheet-engine/rendering/print/diagonal-borders.js";
33
+ import { createPrintBlankStyles as Xe } from "../../spreadsheet-engine/rendering/print/blank-styles.js";
34
+ import { printDiagonalBorders as Ue } from "../../spreadsheet-engine/rendering/print/diagonal-borders.js";
35
+ import { createPrintMerges as Ye } from "../../spreadsheet-engine/rendering/print/merges.js";
36
+ import { justifyPrintLine as $e } from "../../spreadsheet-engine/rendering/print/justify-line.js";
37
+ import { wrapPrintLine as qe } from "../../spreadsheet-engine/rendering/print/wrap-lines.js";
38
+ import { PDFDocument as Je, PDFHexString as fe, PDFName as Se, PDFOperator as ee, PDFOperatorNames as ne, rgb as jt, moveTo as Ze, lineTo as Ke, closePath as Qe, fill as Ve, pushGraphicsState as Tt, popGraphicsState as Ct, concatTransformationMatrix as ce, rectangle as $t, clip as qt, endPath as Jt, drawObject as Be, beginText as Me, endText as Ce, setFontAndSize as Re, setTextMatrix as Fe, showText as xe, setFillingRgbColor as tn, setGraphicsState as en } from "pdf-lib";
39
+ import Ae from "@pdf-lib/fontkit";
40
+ import { admitTrueTypeFont as nn, suppliedDefaultFont as rn, serializePdf as on, decodePng as sn, PdfError as Oe } from "../../safe-bash-pdf-engine/index.js";
41
+ import { graphBackground as ve } from "../../spreadsheet-engine/rendering/images/scene.js";
42
+ import { nextPrintTabStop as ie, mirrorPrintTabRuns as an } from "../../spreadsheet-engine/rendering/print/tab-layout.js";
43
+ import { splitPrintLines as ln, fillPrintNewlines as dn, fillPrintItems as un } from "../../spreadsheet-engine/rendering/print/text-lines.js";
44
+ import { renderPrintFormula as je } from "../../spreadsheet-engine/rendering/print/formula-text.js";
45
+ import { createPrintSpans as fn } from "../../spreadsheet-engine/rendering/print/text-span.js";
46
+ import { cellPrintStyle as Bt } from "../../spreadsheet-engine/rendering/print/cell-style.js";
47
+ import { sheetPrintSettings as ke } from "../../spreadsheet-engine/rendering/print/settings.js";
48
+ import { normalizeFontText as te } from "../../spreadsheet-engine/rendering/print/font-normalization.js";
49
+ import { createFontShaper as Pe } from "../../spreadsheet-engine/rendering/print/font-shaping.js";
50
+ var c = 72 / 96;
51
+ function Et(L, J) {
52
+ let r = L.view?.gnumeric;
53
+ return !!Number(L.view?.[J] ?? (r && typeof r == "object" && !Array.isArray(r) ? r[J.charAt(0).toUpperCase() + J.slice(1)] ?? 0 : 0));
54
+ }
55
+ function re(L) {
56
+ let J = L.style;
57
+ if (!J) return;
58
+ let r = J.gnumeric;
59
+ if (!(Object.keys(J).length === 1 && Object.hasOwn(J, "gnumeric") && r && typeof r == "object" && !Array.isArray(r) && r.name === "Style" && r.namespace === "http://www.gnumeric.org/v10.dtd" && typeof r.text == "string" && r.text.trim() === "" && Array.isArray(r.children) && r.children.length === 0 && Array.isArray(r.attributes) && r.attributes.every((at) => at && typeof at == "object" && at.namespace === "" && at.name === "Format" && typeof at.value == "string"))) {
60
+ if (Object.keys(J).length === 2 && Object.hasOwn(J, "xlsx") && Object.hasOwn(J, "gnumeric") && r && typeof r == "object" && !Array.isArray(r) && Array.isArray(r.attributes)) {
61
+ let H = r.attributes.some((st) => st && typeof st == "object" && st.name === "Format") ? r.attributes.map((st) => st && typeof st == "object" && st.name === "Format" ? { ...st, value: "General" } : st) : [...r.attributes, { name: "Format", namespace: "", value: "General" }];
62
+ return { gnumeric: { ...r, attributes: H } };
63
+ }
64
+ return Object.keys(J).length === 1 && Object.hasOwn(J, "gnumeric") && r && typeof r == "object" && !Array.isArray(r) && Array.isArray(r.attributes) && r.attributes.some((H) => H && typeof H == "object" && H.name === "Format" && H.value !== "General") ? { gnumeric: { ...r, attributes: r.attributes.map((H) => H && typeof H == "object" && H.name === "Format" ? { ...H, value: "General" } : H) } } : J;
65
+ }
66
+ }
67
+ var Zt = { iso_a4: [15120 / 25.4, 297 * 72 / 25.4], na_letter: [612, 792], na_legal: [612, 1008], iso_a3: [297 * 72 / 25.4, 420 * 72 / 25.4], iso_a5: [10656 / 25.4, 15120 / 25.4], iso_b5: [12672 / 25.4, 18e3 / 25.4], na_ledger: [1224, 792], na_executive: [522, 756] };
68
+ function Te(L) {
69
+ let r = { a4: "iso_a4", a3: "iso_a3", a5: "iso_a5", b5: "iso_b5", usletter: "na_letter", "us-letter": "na_letter", letter: "na_letter", uslegal: "na_legal" }[L.toLowerCase()];
70
+ if (r) return r;
71
+ if (L.toLowerCase().startsWith("executive")) return "na_executive";
72
+ for (let at of ["iso_a3", "iso_a4", "iso_a5", "iso_b5", "na_letter", "na_legal", "na_executive"]) if (L.startsWith(`${at}_`)) return at;
73
+ return L;
74
+ }
75
+ function k(L) {
76
+ throw new e("unsupported-feature", `Unsupported ssconvert feature: PDF ${L}`);
77
+ }
78
+ function Ne(L, J, r) {
79
+ let at, H = false, st, xt, e2, lt, Z = [], Gt = [], Nt = 0;
80
+ for (let Qt of J) for (let [rt, G] of p(Qt)) {
81
+ if (r.signal.throwIfAborted(), ++Nt > (r.limits.workbookWork ?? r.limits.inputBytes)) throw new e("resource-limit", "ssconvert PDF option work limit exceeded");
82
+ if (rt === "object") {
83
+ let C = false;
84
+ for (let mt of L.sheets) for (let kt of [...a2(mt, r)].reverse()) if (kt.name === G && (Z.push({ sheet: mt, object: kt }), C = true), ++Nt > (r.limits.workbookWork ?? r.limits.inputBytes)) throw new e("resource-limit", "ssconvert PDF option work limit exceeded");
85
+ if (!C) throw new e("invalid-request", `ssconvert: There is no object with name '${G}'`);
86
+ } else if (rt === "paper") if (G === "fit") H = true;
87
+ else {
88
+ let C = G.toLowerCase(), mt = C.endsWith("-landscape") ? "-landscape" : C.endsWith("_landscape") ? "_landscape" : C === "a4l" || C === "a3l" || C === "a5l" || C === "letterl" ? "l" : "", kt = mt ? G.slice(0, -mt.length) : G;
89
+ mt && !st && (st = "landscape");
90
+ let Xt = Te(kt);
91
+ if (!Object.hasOwn(Zt, Xt)) {
92
+ if (G === "") throw new e("invalid-request", "ssconvert: Unknown paper size");
93
+ k("unqualified named-paper warning profile");
94
+ }
95
+ at = Zt[Xt];
96
+ }
97
+ else if (rt === "orientation") {
98
+ let C = G.toLowerCase();
99
+ if (C !== "portrait" && C !== "landscape" && C !== "reverse-portrait" && C !== "reverse-landscape") throw new e("invalid-request", `ssconvert: Invalid orientation "${G}" for format Gnumeric_pdf:pdf_assistant`);
100
+ st = C;
101
+ } else if (rt === "fit-width" || rt === "fit_width" || rt === "fit-to-pages-wide") {
102
+ let C = Number.parseInt(G, 10);
103
+ if (!Number.isSafeInteger(C) || C < 0 || String(C) !== G.trim()) throw new e("invalid-request", `ssconvert: Invalid fit-width "${G}" for format Gnumeric_pdf:pdf_assistant`);
104
+ xt = C;
105
+ } else if (rt === "fit-height" || rt === "fit_height" || rt === "fit-to-pages-tall") {
106
+ let C = Number.parseInt(G, 10);
107
+ if (!Number.isSafeInteger(C) || C < 0 || String(C) !== G.trim()) throw new e("invalid-request", `ssconvert: Invalid fit-height "${G}" for format Gnumeric_pdf:pdf_assistant`);
108
+ e2 = C;
109
+ } else if (rt === "scale") {
110
+ let C = Number(G);
111
+ if (!Number.isFinite(C) || C <= 0) throw new e("invalid-request", `ssconvert: Invalid scale "${G}" for format Gnumeric_pdf:pdf_assistant`);
112
+ lt = C;
113
+ } else if (rt === "sheet" || rt === "active-sheet") {
114
+ let C = rt === "active-sheet" ? L.sheets.find((mt) => mt.id === L.activeSheet) ?? L.sheets[0] : L.sheets.find((mt) => f(mt.name) === f(G));
115
+ if (!C) throw new e("invalid-request", `ssconvert: Unknown sheet "${G}"`);
116
+ Gt.push(C.id);
117
+ } else throw new e("invalid-request", `ssconvert: Invalid export option "${rt}" for format Gnumeric_pdf:pdf_assistant`);
118
+ }
119
+ return { paper: at, fit: H, orientation: st, scale: xt !== void 0 || e2 !== void 0 ? { kind: "fit", rows: e2 ?? 0, columns: xt ?? 0 } : lt !== void 0 ? { kind: "percentage", x: lt, y: lt } : void 0, objects: Z, sheets: Gt };
120
+ }
121
+ async function Bn(L, J, r) {
122
+ return r && Ne(r, L, J), L;
123
+ }
124
+ async function ti(L, J, r, at) {
125
+ let H = Ne(L, J, r), st = r.formatting ?? t(), xt = 0, e2 = (Z = 1) => {
126
+ if (r.signal.throwIfAborted(), xt += Z, !Number.isSafeInteger(xt) || xt > (r.limits.workbookWork ?? r.limits.inputBytes + r.limits.cells * 32)) throw new e("resource-limit", "ssconvert PDF work limit exceeded");
127
+ };
128
+ e2();
129
+ let lt = Pe(r, e2);
130
+ try {
131
+ let Z = await Je.create({ updateMetadata: false });
132
+ Z.setProducer("ssconvert JavaScript PDF writer");
133
+ let Gt = /* @__PURE__ */ new Map(), Nt = 0, Kt = async (n2, g, w) => {
134
+ let j = JSON.stringify([n2, g, w]), s = Gt.get(j);
135
+ if (!s) {
136
+ Z.registerFontkit(Ae);
137
+ let o2;
138
+ if (r.fonts) {
139
+ let t2 = await r.fonts.resolve(Object.freeze({ family: n2, bold: g, italic: w, maxBytes: r.limits.inputBytes - Nt, signal: r.signal }));
140
+ if (e2(), t2 === void 0 && k("supplied font unavailable"), t2 instanceof Uint8Array || k("supplied font bytes"), t2.byteLength > r.limits.inputBytes - Nt) throw new e("resource-limit", "ssconvert PDF font bytes limit exceeded");
141
+ Nt += t2.byteLength, e2(t2.byteLength), o2 = new Uint8Array(t2), nn(o2, (u) => k(`supplied font: ${u}`), e2);
142
+ } else o2 = rn((t2) => e2(t2)).bytes;
143
+ try {
144
+ let t2 = Ae.create(o2);
145
+ (!Number.isFinite(t2.unitsPerEm) || t2.unitsPerEm <= 0 || !Number.isFinite(t2.ascent) || t2.ascent <= 0 || !Number.isFinite(t2.descent) || t2.descent > 0) && k("supplied font metrics"), await lt.addFont(o2, t2), Z.registerFontkit({ create: () => t2 });
146
+ let u = await Z.embedFont(o2, { subset: true }), a3 = t2.head, D = t2["OS/2"], U = w && !a3?.macStyle?.italic && !D?.fsSelection?.italic && !D?.fsSelection?.oblique ? 0.2 : 0;
147
+ s = { font: u, metrics: t2, shear: U, bytes: o2, shaped: true, supported: new Set(u.getCharacterSet()), ascentRatio: t2.ascent / t2.unitsPerEm, descentRatio: -t2.descent / t2.unitsPerEm }, Gt.set(j, s);
148
+ } catch (t2) {
149
+ if (r.signal.throwIfAborted(), t2 instanceof e) throw t2;
150
+ k("supplied font parsing");
151
+ }
152
+ e2();
153
+ }
154
+ return s;
155
+ }, Qt = async (n2, g, w, j, s = 10, o2 = "left", t2) => {
156
+ if (e2(g.length), !g) return;
157
+ let u = t2?.style.bold ?? false, a3 = t2?.style.italic ?? false, D = t2?.style.family ?? "Sans", U = await Kt(D, u, a3), { font: K, metrics: A, shear: v, supported: E, ascentRatio: et, descentRatio: ht } = U, P = t2?.style.rotation ?? 0, m = w, T = j;
158
+ if (t2?.generalNumber !== void 0 && !P) {
159
+ let Y = await Kt("Sans", false, false), i = (Math.ceil(Y.ascentRatio * 10 / c) + Math.ceil(Y.descentRatio * 10 / c) + 1) / 12.75, d = Math.max(0, Math.floor(t2.width * i * (t2.zoom ?? 1) + 0.5) - 5), p3 = (h) => {
160
+ let R = 0;
161
+ for (let S of lt.shape(A, h).positions) e2(), R += Math.round(S.xAdvance * t2.style.size / A.unitsPerEm);
162
+ return R;
163
+ };
164
+ g = await st.format({ kind: "number", value: t2.generalNumber }, "General", r, { unicodeMinus: true, generalLayout: { width: d, measure: p3 } });
165
+ }
166
+ t2?.style.alignment === "fill" && t2.fillString && g.includes(`
167
+ `) && (g = dn(g, lt.shape(A, g).direction === "rtl", e2));
168
+ let yt = t2?.style.alignment === "fill", pt = yt && g.includes(" "), l = yt && (g.includes("\u2028") || g.includes("\r")), _ = pt || l, dt = l && g.split("\u2028").join("").split("\u2029").join("").split("\r").join("") === "", Rt = t2 && !yt ? ln(g, e2) : [{ text: g, forced: false }], gt = Rt.map((Y) => t2 ? te(Y.text, E, e2) : Y.text);
169
+ for (let Y of gt) for (let i of Y) e2(), !(yt && (i === "\u2029" || i === "\u2028" || i === "\r" || i === " ")) && !E.has(i.codePointAt(0)) && k("font coverage");
170
+ let ot = n2.getHeight() - j - s, ct = t2 ? 0 : K.widthOfTextAtSize(g, s);
171
+ if (t2) {
172
+ if (!U.shaped) try {
173
+ await lt.addFont(U.bytes, A), U.shaped = true;
174
+ } catch (f2) {
175
+ if (r.signal.throwIfAborted(), f2 instanceof e) throw f2;
176
+ k("supplied font parsing");
177
+ }
178
+ let Y = et * s, i = Y + ht * s, d = 0, p3 = 0;
179
+ if (pt) {
180
+ E.has(32) || k("font coverage");
181
+ for (let f2 of lt.shape(A, " ").positions) {
182
+ e2();
183
+ let x = f2.xAdvance * t2.style.size / A.unitsPerEm;
184
+ d += Math.round(x) * c * 8, p3 += Math.round(x / c) * c * 8;
185
+ }
186
+ (!(d > 0) || !Number.isFinite(d) || !(p3 > 0) || !Number.isFinite(p3)) && k("supplied font advances");
187
+ }
188
+ let h;
189
+ if (l) {
190
+ let f2 = await Kt("monospace", u, a3), x = Math.round(t2.style.size / 2.2 * 1024) / 1024, O = 0, N = 0;
191
+ for (let Dt of "0123456789ABCDEF") {
192
+ e2(), f2.supported.has(Dt.codePointAt(0)) || k("font coverage");
193
+ let ft = f2.metrics.glyphForCodePoint(Dt.codePointAt(0)).bbox;
194
+ O = Math.max(O, (ft.maxX - ft.minX) / f2.metrics.unitsPerEm * x), N = Math.max(N, (ft.maxY - ft.minY) / f2.metrics.unitsPerEm * x);
195
+ }
196
+ let y = Math.min((et + ht) * t2.style.size / 43, x), it = 5 * y + 2 * N, B = et * t2.style.size, Q = ht * t2.style.size, W = it <= B ? 2 * y : it <= B + Q - 2 * y ? 2 * y + it - B : Q * it / (B + Q);
197
+ dt && (Y = Math.trunc((it + y - W) * 1024) / 1024 * c, i = Math.trunc((it + 2 * y) * 1024) / 1024 * c);
198
+ let F = Math.trunc((7 * y + 2 * O) * 1024) / 1024, V = Math.round(F) * c, M = V * 0.6, I = Math.min(O * c, M * 0.75), q = y * c / 2, Mt = 5 * q, It = M - I / 2, b = V * 0.2, z = ((5 * y + 2 * N) * c - M) / 2, X = (5 * y + 2 * O) * c, ut = Math.floor((V - X) / (2 * y * c)) * y * c;
199
+ h = { width: V, mini: f2, miniSize: x * c, frame: { x: ut + 3 * q, y: (-W + y / 2) * c, width: X - y * c, height: (it - y) * c, stroke: y * c }, digits: [..."000D"].map((Dt, ft) => ({ text: Dt, x: ut + (3 * y + ft % 2 * (O + y)) * c, y: (-W + 2 * y + (ft < 2 ? N + y : 0)) * c })), inkLeft: y * c, inkRight: (6 * y + 2 * O) * c, inkBottom: -W * c, displayWidth: Math.round(F / c) * c, points: [[b, z], [b + I, z + Mt], [b + I, z + q], [b + M - q, z + q], [b + M - q, z + It], [b + M + q, z + It], [b + M + q, z - q], [b + I, z - q], [b + I, z - Mt]] };
200
+ }
201
+ let R = (f2) => {
202
+ let x = [], O = [], N = 0, y = 0, it = [], B = [], Q = yt && lt.shape(A, f2).direction === "rtl", W = Q && pt, F = pt && ["\r", "\u2029"].some((b) => f2.includes(b)) ? Le(f2, Q ? "rtl" : "ltr", e2) : void 0, V = W || F !== void 0, M = pt && !["\r", "\u2029"].some((b) => f2.includes(b)), I = [], q = [], Mt = F ? F.items.map((b) => b.text) : yt ? f2.split(" ") : [f2];
203
+ for (let [b, z] of Mt.entries()) {
204
+ e2(), !F && b > 0 && (N = ie(N, d), y = ie(y, p3));
205
+ let X = N, ut = I.length;
206
+ F && z === " " && (N = ie(N, d), y = ie(y, p3));
207
+ let Dt = F ? z === " " || z === "\u2029" ? [] : [z] : yt ? un(z, Q, e2) : [z];
208
+ for (let ft of Dt) {
209
+ if (e2(), !ft || Q && ft.split("\u200B").join("") === "") continue;
210
+ if ((ft === "\u2028" || ft === "\r") && h) {
211
+ let Lt = { x: N, carriageReturn: ft === "\r" };
212
+ O.push(Lt), V && I.push(Lt), N += h.width, y += h.displayWidth;
213
+ continue;
214
+ }
215
+ let De = F ? [F.items[b]] : M ? He(ft, Q ? "rtl" : "ltr", e2) : [{ text: ft }];
216
+ for (let Lt of De) {
217
+ let ae = lt.shape(A, Lt.text);
218
+ "direction" in Lt && ae.direction !== Lt.direction && k("bidirectional shaping direction"), B.push(ae);
219
+ for (let Ht of ae.positions) {
220
+ e2();
221
+ let Yt = Ht.xAdvance * t2.style.size / A.unitsPerEm;
222
+ (!Number.isFinite(Yt) || Yt < 0 || !Number.isFinite(Ht.xOffset) || !Number.isFinite(Ht.yOffset) || Ht.yAdvance !== 0) && k("supplied font advances");
223
+ let me = { x: N + Math.round(Ht.xOffset * t2.style.size / A.unitsPerEm) * c, y: -Math.round(-Ht.yOffset * t2.style.size / A.unitsPerEm) * c };
224
+ x.push(me), V && I.push(me), it.push(Math.round(Yt)), N += Math.round(Yt) * c, y += Math.round(Yt / c) * c;
225
+ }
226
+ }
227
+ }
228
+ V && q.push({ start: X, end: N, first: ut, last: I.length });
229
+ }
230
+ if (F) {
231
+ let b = 0;
232
+ for (let z of F.order) {
233
+ e2();
234
+ let X = q[z];
235
+ for (let ut = X.first; ut < X.last; ut++) e2(), I[ut].x += b - X.start;
236
+ b += X.end - X.start;
237
+ }
238
+ } else W && an(I, q, N, e2);
239
+ !F && !M && B.length > 1 && B.some((b) => b.direction === "rtl") && !(Q && B.every((b) => b.direction === "rtl")) && k("bidirectional fill layout");
240
+ let It = B.length < 2 ? B[0] : Object.create(B[0], { glyphs: { value: B.flatMap((b) => b.glyphs) }, positions: { value: B.flatMap((b) => b.positions) } });
241
+ return { shapedValue: f2, run: It, glyphs: x, width: N, displayWidth: y, advances: it, markers: O };
242
+ }, S = 0, wt = 0;
243
+ if (t2.style.indent && o2 !== "center" && t2.style.alignment !== "fill" && t2.style.alignment !== "justify" && t2.style.alignment !== "distributed") {
244
+ let f2 = 0, x = 0;
245
+ for (let O of "0123456789") {
246
+ e2(), E.has(O.codePointAt(0)) || k("font coverage");
247
+ let N = lt.shape(A, O), y = 0, it = 0;
248
+ for (let B of N.positions) {
249
+ e2();
250
+ let Q = B.xAdvance * t2.style.size / A.unitsPerEm;
251
+ (!Number.isFinite(Q) || Q < 0) && k("supplied font advances"), y += Math.round(Q), it += Math.round(Q / c);
252
+ }
253
+ f2 += Math.max(1, y), x += Math.max(1, it);
254
+ }
255
+ S = Math.min(65535, Math.round(t2.style.indent * Math.floor((f2 * 1024 + 5) / 10) / 1024)) * c, wt = Math.min(65535, Math.round(t2.style.indent * Math.floor((x * 1024 + 5) / 10) / 1024)) * c;
256
+ }
257
+ let $ = t2.style.borders?.some((f2) => ["Top", "Bottom", "Left", "Right"].includes(f2.side)) ?? false, vt = t2.style.alignment === "fill", bt;
258
+ if (vt) {
259
+ lt.shape(A, g).direction === "rtl" && (o2 = "right"), gt.length !== 1 && k("fill control-character layout");
260
+ let f2 = R(gt[0]).width;
261
+ P && !$ && (bt = ue({ angle: P, widths: [f2], ascent: Y, lineHeight: i, width: t2.width, height: t2.height, indent: 0, bordered: $, alignment: o2, vertical: t2.style.verticalAlignment }, e2));
262
+ let x = bt?.width ?? f2, O = P && $ ? 1 : x > 0 ? Math.floor((t2.width - 5) / x) : 1;
263
+ O >= 2 && (l && (Y = et * s), e2(O * (g.length + 1)), E.has(8203) || k("font coverage"), gt[0] = Array.from({ length: O }, () => gt[0]).join("\u200B"), g = g.repeat(O)), bt && o2 === "right" && (bt = ue({ angle: P, widths: [f2], ascent: Y, lineHeight: i, horizontalWidth: R(gt[0]).width, width: t2.width, height: t2.height, indent: 0, bordered: $, alignment: o2, vertical: t2.style.verticalAlignment }, e2));
264
+ }
265
+ let nt = t2.wrap === true && (!P || $), Wt = P ? Math.max(0, t2.width - 5 - S) * Math.cos(P * Math.PI / 180) + (t2.height - 1) * Math.abs(Math.sin(P * Math.PI / 180)) : Math.max(0, t2.width - 5 - S), St = (nt ? Rt.flatMap((f2) => qe(f2.text, Wt, (x) => R(te(x, E, e2)).width, e2).map((x, O, N) => ({ ...x, justify: f2.forced || O < N.length - 1 }))) : gt.map((f2) => ({ text: f2, hyphen: false, justify: false }))).map((f2) => {
266
+ f2.hyphen && !E.has(8208) && k("font coverage");
267
+ let x = f2.hyphen && f2.text.endsWith("\xAD") ? f2.text.slice(0, -1) : f2.text, O = te(x + (f2.hyphen ? "\u2010" : ""), E, e2), N = f2.text.split("\u200B").join("").split("\u2060").join(""), y = R(O);
268
+ if (f2.justify && y.run && (t2.style.alignment === "justify" || t2.style.alignment === "distributed")) {
269
+ let it = $e(O, y.run, y.advances, (Wt - y.width) / c, e2);
270
+ for (let [B, Q] of y.glyphs.entries()) e2(), Q.x += it.offsets[B] * c;
271
+ y.width += it.added * c;
272
+ }
273
+ return { ...y, logicalText: N, marked: f2.hyphen || O !== N };
274
+ }), zt = i * St.length, _t = 0;
275
+ for (let f2 of St) e2(), ct = Math.max(ct, f2.width), _t = Math.max(_t, f2.displayWidth);
276
+ let At = ct + S > t2.width - 5;
277
+ (!P && At && !vt && !nt && t2.overflow === void 0 && t2.generalNumber === void 0 || !Number.isFinite(zt)) && k("default-style text layout");
278
+ let Pt = P ? void 0 : t2.overflow?.(_t + wt), Ft = w + 4 - (Pt?.left ?? 0), Ot = Math.max(0, t2.width + (Pt?.left ?? 0) + (Pt?.right ?? 0) - 4);
279
+ w += 2 + 0.5 + 3 * c + (o2 === "left" ? 0 : (t2.width - 5) / (o2 === "center" ? 2 : 1)), o2 === "center" && t2.style.alignment !== "distributed" && Pt && (Pt.left > 0 || Pt.right > 0) && (w += 2.5 + (c - 1) * (t2.width / 2 + Pt.left));
280
+ let Ut = Math.max(0, t2.height - 1 - zt), Vt = t2.style.verticalAlignment === "top" || t2.style.verticalAlignment === "justify" ? 0 : Ut / (t2.style.verticalAlignment === "center" || t2.style.verticalAlignment === "distributed" ? 2 : 1);
281
+ ot = n2.getHeight() - j - c - Vt - Y, w -= o2 === "left" ? -S : o2 === "center" ? ct / 2 : ct + S;
282
+ let We = t2.style.verticalAlignment === "justify" && St.length > 1 ? Math.floor(Ut / c * 1024 / (St.length - 1)) / 1024 * c : 0, se = bt?.origins ?? (P ? ue({ angle: P, ...nt ? { layoutWidth: Wt } : {}, widths: St.map((f2) => f2.width), ascent: Y, lineHeight: i, width: t2.width, height: t2.height, indent: S, bordered: $, alignment: o2, vertical: t2.style.verticalAlignment }, e2).origins : void 0);
283
+ if (t2.style.foregroundAlpha === 0) return;
284
+ let ze = w, _e = ot, Ie = n2.node.newFontDictionary(K.name, K.ref);
285
+ if (n2.pushOperators(Tt()), t2.style.foregroundAlpha !== 1) {
286
+ let f2 = n2.node.newExtGState("CellAlpha", Z.context.obj({ Type: "ExtGState", ca: t2.style.foregroundAlpha, CA: t2.style.foregroundAlpha }));
287
+ n2.pushOperators(en(f2));
288
+ }
289
+ !P && (At || zt > t2.height - 1) && n2.pushOperators($t(Ft, n2.getHeight() - j - t2.height, Ot, t2.height), qt(), Jt()), !nt && !P && !_ && n2.pushOperators(ee.of(ne.BeginMarkedContentSequence, [Se.of("Span"), Z.context.obj({ ActualText: fe.fromText(g) }).toString()]));
290
+ for (let [f2, x] of St.entries()) {
291
+ let { run: O, glyphs: N, shapedValue: y } = x;
292
+ if (!O && !x.markers.length) continue;
293
+ let it = (ct - x.width) / 2;
294
+ if (w = ze + (o2 === "left" ? 0 : o2 === "right" ? ct - x.width : nt && !Number.isInteger((t2.width - 5) / c) ? it : Math.round(it / c) * c), ot = _e - f2 * (i + We), se) {
295
+ let W = P * Math.PI / 180, F = se[f2];
296
+ n2.pushOperators(Tt(), ce(Math.cos(W), Math.sin(W), -Math.sin(W), Math.cos(W), m + 2.5 + F.x, n2.getHeight() - T - F.y)), w = 0, ot = 0;
297
+ }
298
+ (nt || P) && x.marked && !_ && n2.pushOperators(ee.of(ne.BeginMarkedContentSequence, [Se.of("Span"), Z.context.obj({ ActualText: fe.fromText(x.logicalText) }).toString()]));
299
+ let B = A.layout, Q = "";
300
+ try {
301
+ O && (A.layout = () => O, Q = K.encodeText(y).asString());
302
+ } finally {
303
+ A.layout = B;
304
+ }
305
+ Q.length !== N.length * 4 && k("supplied font glyph mapping"), n2.pushOperators(Me(), Re(Ie, s), tn(...t2.style.foreground));
306
+ for (let [W, F] of N.entries()) {
307
+ e2();
308
+ let V = O.glyphs[W].codePoints;
309
+ if (_ && !P && At) {
310
+ let M = O.glyphs[W].bbox, I = s / A.unitsPerEm, q = w + F.x + (M.minX + Math.min(v * M.minY, v * M.maxY)) * I, Mt = w + F.x + (M.maxX + Math.max(v * M.minY, v * M.maxY)) * I;
311
+ if (q >= Ft + Ot || Mt <= Ft) continue;
312
+ }
313
+ _ && V.length > 0 && V.every((M) => M === 8203) && O.positions[W].xAdvance === 0 || n2.pushOperators(Fe(1, 0, v, 1, w + F.x, ot + F.y), xe(fe.of(Q.slice(W * 4, W * 4 + 4))));
314
+ }
315
+ if (n2.pushOperators(Ce()), (nt || P) && x.marked && !_ && n2.pushOperators(ee.of(ne.EndMarkedContent)), h) {
316
+ let W = x.markers.some((F) => F.carriageReturn) ? n2.node.newFontDictionary(h.mini.font.name, h.mini.font.ref) : void 0;
317
+ for (let F of x.markers) if (e2(h.points.length), F.carriageReturn) {
318
+ P || n2.pushOperators(Tt(), $t(Ft, n2.getHeight() - j - t2.height, Ot, t2.height), qt(), Jt());
319
+ let V = h.frame;
320
+ n2.drawRectangle({ x: w + F.x + V.x, y: ot + V.y, width: V.width, height: V.height, borderWidth: V.stroke, borderColor: jt(...t2.style.foreground) }), n2.pushOperators(Me(), Re(W, h.miniSize));
321
+ for (let M of h.digits) e2(), n2.pushOperators(Fe(1, 0, h.mini.shear, 1, w + F.x + M.x, ot + M.y), xe(h.mini.font.encodeText(M.text)));
322
+ n2.pushOperators(Ce()), P || n2.pushOperators(Ct());
323
+ } else n2.pushOperators(...h.points.map(([V, M], I) => (I ? Ke : Ze)(w + F.x + V, ot + M)), Qe(), Ve());
324
+ }
325
+ if (t2.style.underline || t2.style.strikeThrough) {
326
+ let W = s / A.unitsPerEm, F = A.underlineThickness ? A.underlineThickness * W : c, V = A.underlinePosition ? A.underlinePosition * W : -c, M = 1 / 0, I = -1 / 0, q = 1 / 0;
327
+ for (let [b, z] of (O?.glyphs ?? []).entries()) {
328
+ e2();
329
+ let X = z.bbox, ut = N[b];
330
+ Number.isFinite(X.minX) && (M = Math.min(M, ut.x + (X.minX + v * X.minY) * W), I = Math.max(I, ut.x + (X.maxX + v * X.maxY) * W), q = Math.min(q, ut.y + X.minY * W));
331
+ }
332
+ if (h) for (let { x: b } of x.markers) e2(), M = Math.min(M, b + h.inkLeft), I = Math.max(I, b + h.inkRight), q = Math.min(q, h.inkBottom);
333
+ let Mt = t2.style.underline === 3, It = ot + (Mt ? Math.min(0, q) - 2 * F : V - F);
334
+ Mt && !P && n2.pushOperators($t(Ft, n2.getHeight() - j - t2.height, Ot, t2.height), qt(), Jt());
335
+ for (let b = 0; b < (t2.style.underline === 0 ? 0 : t2.style.underline === 2 || t2.style.underline === 4 ? 2 : 1); b++) {
336
+ e2();
337
+ let z = It - b * 2 * F, X = h && !P ? Math.max(z, n2.getHeight() - j - t2.height) : z, ut = h && !P ? Math.min(z + F, n2.getHeight() - j) : z + F;
338
+ ut <= X || n2.drawRectangle({ x: w + Math.min(0, M), y: X, width: Math.max(x.width, Number.isFinite(I - M) ? I - M : 0), height: ut - X, color: jt(...t2.style.foreground) });
339
+ }
340
+ if (t2.style.strikeThrough && Number.isFinite(I - M)) {
341
+ let b = A["OS/2"], z = b?.yStrikeoutSize ? b.yStrikeoutSize * W : c, X = b?.yStrikeoutPosition ? b.yStrikeoutPosition * W : Y / 2;
342
+ e2(), n2.drawRectangle({ x: w + M, y: ot + X - z, width: dt ? I : I - M, height: z, color: jt(...t2.style.foreground) });
343
+ }
344
+ }
345
+ se && n2.pushOperators(Ct());
346
+ }
347
+ !nt && !P && !_ && n2.pushOperators(ee.of(ne.EndMarkedContent)), n2.pushOperators(Ct());
348
+ return;
349
+ }
350
+ n2.drawText(g, { x: w - (o2 === "left" ? 0 : ct / (o2 === "center" ? 2 : 1)), y: ot, size: s, font: K });
351
+ }, rt = /* @__PURE__ */ new WeakMap(), G = (n2) => {
352
+ if (n2.columns?.length || n2.view?.defaultColumnWidth !== void 0) return n2.columns;
353
+ let g = /\.(?:csv|tsv)$/i.test(n2.name) || /\.(?:csv|tsv)$/i.test(r.inputFilename ?? ""), w = (!n2.columns || n2.columns.length === 0) && n2.view?.defaultColumnWidth === void 0 && n2.cells.every((u) => re(u) === void 0) && n2.cells.some((u) => {
354
+ let a3 = u.displayedText ?? (u.value.kind === "blank" ? "" : String(u.value.value));
355
+ return a3.length >= 9 && ![`
356
+ `, "\r", "\u2028", "\u2029"].some((D) => a3.includes(D));
357
+ });
358
+ if (!g && !w) return n2.columns;
359
+ let j = new Map((n2.columns ?? []).map((u) => [u.index, u])), s = typeof n2.view?.defaultColumnWidth == "number" ? n2.view.defaultColumnWidth : 48, o2 = /* @__PURE__ */ new Map();
360
+ for (let u of n2.cells) {
361
+ let a3 = Et(n2, "displayFormulas") && u.formula ? rt.get(u) ?? u.formula : u.displayedText ?? (u.value.kind === "blank" ? "" : u.value.kind === "boolean" ? u.value.value ? "TRUE" : "FALSE" : String(u.value.value));
362
+ if (!a3 || [`
363
+ `, "\r", "\u2028", "\u2029"].some((K) => a3.includes(K))) continue;
364
+ let D = Math.max(s, a3.length * 6 + 14), U = o2.get(u.column) ?? s;
365
+ D > U && o2.set(u.column, D);
366
+ }
367
+ for (let [u, a3] of j) {
368
+ let D = o2.get(u) ?? s;
369
+ o2.set(u, Math.max(D, a3.sizePoints ?? s));
370
+ }
371
+ let t2 = [...o2.entries()].filter(([u, a3]) => a3 > s || j.has(u)).sort((u, a3) => u[0] - a3[0]).map(([u, a3]) => ({ ...j.get(u), index: u, sizePoints: a3 }));
372
+ return t2.length ? t2 : n2.columns;
373
+ }, C = (n2) => {
374
+ let g = (w, j, s = 1) => (o2) => {
375
+ let t2 = o2 * j, u = j;
376
+ for (let a3 of w ?? []) e2(), a3.index < o2 && (t2 += (a3.hidden ? 0 : a3.sizePoints ?? j) - j), a3.index === o2 && (u = a3.hidden ? 0 : a3.sizePoints ?? j);
377
+ return { start: t2 * s, size: u * s };
378
+ };
379
+ return { column: g(G(n2), typeof n2.view?.defaultColumnWidth == "number" ? n2.view.defaultColumnWidth : 48, Et(n2, "displayFormulas") ? 2 : 1), row: g(n2.rows, typeof n2.view?.defaultRowHeight == "number" ? n2.view.defaultRowHeight : 12.75) };
380
+ }, mt = async (n2, g, w, j, s, o2) => {
381
+ if (e2(), g.kind === "graph") {
382
+ let t2 = ve(g.graph);
383
+ t2 && n2.drawRectangle({ x: w, y: n2.getHeight() - j - o2, width: s, height: o2, color: jt(...[1, 3, 5].map((u) => Number.parseInt(t2.slice(u, u + 2), 16) / 255)) });
384
+ } else if (g.kind === "image") {
385
+ let t2 = g.payload.children.find((v) => v.name === "Content" && v.namespace === "");
386
+ t2 || k("image payload");
387
+ let u = t2.text.split(" ").join("").split(`
388
+ `).join("").split("\r").join("").split(" ").join("");
389
+ e2(u.length);
390
+ let a3;
391
+ try {
392
+ let v = atob(u);
393
+ a3 = new Uint8Array(v.length);
394
+ for (let E = 0; E < v.length; E++) a3[E] = v.charCodeAt(E);
395
+ } catch {
396
+ return k("image encoding");
397
+ }
398
+ e2();
399
+ let D = new DataView(a3.buffer, a3.byteOffset, a3.byteLength), U = 0, K = 0, A = a3[0] === 137;
400
+ if (A) (a3.length < 33 || ![137, 80, 78, 71, 13, 10, 26, 10].every((v, E) => a3[E] === v) || D.getUint32(8) !== 13 || D.getUint32(12) !== 1229472850) && k("PNG header"), U = D.getUint32(16), K = D.getUint32(20);
401
+ else if (a3[0] === 255 && a3[1] === 216) {
402
+ let v = 2;
403
+ for (; v + 4 <= a3.length; ) {
404
+ e2(), a3[v] !== 255 && k("JPEG header");
405
+ let E = a3[v + 1], et = D.getUint16(v + 2);
406
+ if ((et < 2 || v + 2 + et > a3.length) && k("JPEG header"), [192, 193, 194].includes(E)) {
407
+ et < 8 && k("JPEG dimensions"), K = D.getUint16(v + 5), U = D.getUint16(v + 7);
408
+ break;
409
+ }
410
+ v += et + 2;
411
+ }
412
+ } else k("image format");
413
+ if ((!U || !K) && k("image dimensions"), e2(U * K * 16), A) {
414
+ let v;
415
+ try {
416
+ v = sn(a3, e2);
417
+ } catch (P) {
418
+ if (!(P instanceof Oe)) throw P;
419
+ if (P.code === "E_LIMIT") throw new e("resource-limit", "ssconvert PDF PNG decoding limit exceeded");
420
+ return k("PNG decoding");
421
+ }
422
+ let E = v.alpha === void 0 ? void 0 : Z.context.register(Z.context.flateStream(v.alpha, { Type: "XObject", Subtype: "Image", Width: U, Height: K, BitsPerComponent: 8, ColorSpace: "DeviceGray" })), et = Z.context.register(Z.context.flateStream(v.rgb, { Type: "XObject", Subtype: "Image", Width: U, Height: K, BitsPerComponent: 8, ColorSpace: "DeviceRGB", SMask: E })), ht = n2.node.newXObject("Image", et);
423
+ n2.pushOperators(Tt(), ce(s, 0, 0, o2, w, n2.getHeight() - j - o2), Be(ht), Ct());
424
+ } else {
425
+ let v = await Z.embedJpg(a3);
426
+ e2(), (v.width !== U || v.height !== K) && k("image dimension mismatch"), n2.drawImage(v, { x: w, y: n2.getHeight() - j - o2, width: s, height: o2 });
427
+ }
428
+ } else k(`object ${g.sourceType}`);
429
+ }, kt = H.objects[0], Xt = (n2, g) => (g.anchor.mode !== "2" && g.anchor.mode !== "absolute" && (n2.rows?.some((w) => w.hidden) || n2.columns?.some((w) => w.hidden)) && k("hidden-axis object placement"), p2(g, C(n2), r));
430
+ if (kt) {
431
+ let n2 = Xt(kt.sheet, kt.object), g = H.fit && kt.object.kind === "graph", w = g ? [Math.max(1, Math.abs(n2.width)), Math.max(1, Math.abs(n2.height))] : H.paper ?? Zt.iso_a4;
432
+ e2();
433
+ let j = Z.addPage([w[0], w[1]]);
434
+ await mt(j, kt.object, g ? 0 : 72, g ? 0 : 72, Math.abs(n2.width), Math.abs(n2.height));
435
+ } else {
436
+ let n2 = H.sheets.length ? H.sheets : at?.sheets, g = [], w = 0, j = 1;
437
+ for (let s of L.sheets) {
438
+ if (e2(), n2 && !n2.includes(s.id) || s.visibility && s.visibility !== "visible") continue;
439
+ let o2 = ke(s, r);
440
+ if (!n2 && o2.doNotPrint) continue;
441
+ s.cells.some((l) => l.richText) && k("styled or merged cells");
442
+ let t2 = Ye(s.merges ?? [], e2), u = /* @__PURE__ */ new Map(), a3 = Xe(s, t2, e2), D = s.cells.filter((l) => {
443
+ let _ = t2(l.row).find((dt) => (e2(), dt.startColumn <= l.column && dt.endColumn >= l.column));
444
+ return _ ? l.row !== _.startRow || l.column !== _.startColumn ? false : (u.set(l, _), true) : true;
445
+ }), U = Et(s, "displayFormulas"), K = /* @__PURE__ */ new Map();
446
+ if (U) for (let l of s.formulaGroups ?? []) {
447
+ if (e2(), l.kind !== "array") continue;
448
+ let _ = je(L, s, { row: l.range.startRow, column: l.range.startColumn, formula: l.expression, arrayStringLiterals: l.arrayStringLiterals ?? false }, r, e2);
449
+ _ !== void 0 && K.set(l.id, "{" + _ + "}");
450
+ }
451
+ for (let l of s.cells) {
452
+ if (U) {
453
+ let dt = (l.formulaGroup ? K.get(l.formulaGroup) : void 0) ?? je(L, s, l, r, e2);
454
+ dt !== void 0 && rt.set(l, dt);
455
+ }
456
+ let _ = re(l);
457
+ _ && (e2(), r.fonts || k("styled or merged cells"), Bt(_, e2));
458
+ }
459
+ let A = o2.paper === void 0 ? void 0 : Zt[Te(o2.paper)];
460
+ H.paper === void 0 && o2.paper !== void 0 && A === void 0 && k("persisted paper size");
461
+ let v = C(s), E = H.paper ?? A ?? Zt.iso_a4, et = a2(s, r).map((l) => ({ object: l, rectangle: Xt(s, l) })), ht = /* @__PURE__ */ new Set(), P = /* @__PURE__ */ new Set();
462
+ for (let l of s.rows ?? []) e2(), l.hidden && ht.add(l.index);
463
+ for (let l of s.columns ?? []) e2(), l.hidden && P.add(l.index);
464
+ let m = a({ ...s, cells: D.filter((l) => (e2(), l.value.kind !== "blank" && !ht.has(l.row) && !P.has(l.column))) });
465
+ for (let [l, _] of u) e2(), !(l.value.kind === "blank" || ht.has(l.row) || P.has(l.column)) && (m = { ...m, endRow: Math.max(m.endRow, _.endRow), endColumn: Math.max(m.endColumn, _.endColumn) });
466
+ for (let { rectangle: l } of et) {
467
+ e2(), (l.width < 0 || l.height < 0 || l.x < 0 || l.y < 0) && k("mirrored or negative workbook object placement");
468
+ let _ = (gt, ot) => {
469
+ let ct = 0;
470
+ for (; ; ) {
471
+ e2();
472
+ let Y = v[gt](ct);
473
+ if (Y.start + Y.size >= ot) return ct;
474
+ ct++;
475
+ }
476
+ }, dt = _("row", l.y + l.height), Rt = _("column", l.x + l.width);
477
+ m = { startRow: 0, startColumn: 0, endRow: Math.max(m.endRow, dt), endColumn: Math.max(m.endColumn, Rt) };
478
+ }
479
+ let T = m.endRow < m.startRow || m.endColumn < m.startColumn;
480
+ T && (m = { startRow: 0, startColumn: 0, endRow: 0, endColumn: 0 });
481
+ let yt = o2.firstPageNumber ?? j, pt = o({ area: m, startPage: yt, defaultRowPoints: typeof s.view?.defaultRowHeight == "number" ? s.view.defaultRowHeight : 12.75, defaultColumnPoints: typeof s.view?.defaultColumnWidth == "number" ? s.view.defaultColumnWidth : 48, ...s.rows ? { rows: s.rows } : {}, ...G(s) ? { columns: G(s) } : {}, paper: { widthPoints: E[0], heightPoints: E[1] }, margins: o2.margins, displayFormulas: Et(s, "displayFormulas"), rowBreaks: o2.rowBreaks, columnBreaks: o2.columnBreaks, orientation: H.orientation ?? o2.orientation, scale: H.scale ?? o2.scale, centerHorizontally: o2.centerHorizontally, centerVertically: o2.centerVertically, acrossThenDown: o2.acrossThenDown }, r);
482
+ if (e2(pt.pages.length), j = yt + pt.pages.length, w += pt.pages.length, !Number.isSafeInteger(w)) throw new e("resource-limit", "ssconvert PDF page count limit exceeded");
483
+ g.push({ sheet: s, print: o2, positions: v, objects: et, layout: pt, hiddenRows: ht, hiddenColumns: P, cells: T ? D.filter((l) => (e2(), !ht.has(l.row))) : D, mergedCells: u, blankCells: a3 });
484
+ }
485
+ for (let { sheet: s, print: o2, positions: t2, objects: u, layout: a3, hiddenRows: D, hiddenColumns: U, cells: K, mergedCells: A, blankCells: v } of g) {
486
+ let E = /* @__PURE__ */ new Map();
487
+ for (let m of s.cells) e2(), E.set(`${m.row}:${m.column}`, m);
488
+ let et = fn({ ...s, cells: K }, t2.column, e2), ht = Et(s, "displayFormulas"), P = Et(s, "hideZero");
489
+ for (let m of a3.pages) {
490
+ e2();
491
+ let T = Z.addPage([a3.widthPoints, a3.heightPoints]), yt = { page: m.number, pages: w, sheetName: s.name, filename: r.inputFilename ?? "", path: "", title: "" };
492
+ for (let [i, d, p3] of [[o2.header, o2.headerPoints, o2.margins.top > o2.headerPoints], [o2.footer, a3.heightPoints - o2.footerPoints - 10, o2.margins.bottom > o2.footerPoints]]) if (p3) for (let [h, R, S] of [["Left", o2.margins.left, "left"], ["Middle", (o2.margins.left + a3.widthPoints - o2.margins.right) / 2, "center"], ["Right", a3.widthPoints - o2.margins.right, "right"]]) await Qt(T, n(i[h], yt, r), R, d, 10, S);
493
+ T.pushOperators(Tt(), ce(a3.scaleX, 0, 0, a3.scaleY, m.originX * (1 - a3.scaleX), (T.getHeight() - m.originY) * (1 - a3.scaleY)));
494
+ let pt = t2.column(m.area.startColumn), l = t2.column(m.area.endColumn), _ = t2.row(m.area.startRow), dt = t2.row(m.area.endRow), Rt = [Tt(), $t(m.originX + 2, T.getHeight() - m.originY - (dt.start + dt.size - _.start), l.start + l.size - pt.start + 0.2, dt.start + dt.size - _.start + 0.2), qt(), Jt()], gt = /* @__PURE__ */ new Map(), ot = [...K.map((i) => ({ cell: i, merge: A.get(i) })), ...v.blankCells(m.area)].flatMap(({ cell: i, merge: d }) => {
495
+ e2();
496
+ let p3 = d ?? { startRow: i.row, endRow: i.row, startColumn: i.column, endColumn: i.column };
497
+ if (p3.endRow < m.area.startRow || p3.startRow > m.area.endRow || p3.endColumn < m.area.startColumn || p3.startColumn > m.area.endColumn || !d && D.has(i.row) || U.has(i.column)) return [];
498
+ let h = t2.column(p3.startColumn), R = t2.column(p3.endColumn), S = t2.row(p3.startRow), wt = t2.row(p3.endRow), $ = d ? R.start + R.size - h.start : h.size, vt = d ? wt.start + wt.size - S.start : S.size;
499
+ if (!$ || !vt) return [];
500
+ let bt = Bt(re(i), e2);
501
+ return [{ cell: i, merge: d, width: $, height: vt, style: bt, x: m.originX + h.start - pt.start, y: m.originY + S.start - _.start }];
502
+ }), ct = [...ot].sort((i, d) => (e2(), i.cell.row - d.cell.row || i.cell.column - d.cell.column));
503
+ for (let { merge: i, width: d, height: p3, style: h, x: R, y: S } of ct) e2(), h.background && (i && T.pushOperators(...Rt), T.drawRectangle({ x: R + 2, y: T.getHeight() - S - p3 - 0.2, width: d + 0.2, height: p3 + 0.2, color: jt(...h.background), ...h.backgroundAlpha === 1 ? {} : { opacity: h.backgroundAlpha } }), i && T.pushOperators(Ct()));
504
+ let Y = ({ width: i, height: d, style: p3, x: h, y: R }) => {
505
+ for (let S of Ue(p3.borders ?? [], i, d, e2)) e2(), T.drawLine({ start: { x: h + 2 + S.x1, y: T.getHeight() - R - S.y1 }, end: { x: h + 2 + S.x2, y: T.getHeight() - R - S.y2 }, thickness: S.width, color: jt(...S.border.color), opacity: S.border.alpha, ..."dash" in S ? { dashArray: [...S.dash] } : {}, ..."phase" in S ? { dashPhase: S.phase } : {} });
506
+ };
507
+ for (let i of ot) i.merge || Y(i);
508
+ for (let { cell: i, merge: d, width: p3, height: h, style: R, x: S, y: wt } of ot) {
509
+ e2();
510
+ let $ = ht ? rt.get(i) ?? i.formula : void 0;
511
+ if (!$ && P && (i.value.kind === "number" ? Math.abs(i.value.value) < 64 * Number.EPSILON : i.value.kind === "boolean" && !i.value.value)) continue;
512
+ let vt = !$ && i.value.kind === "number" && (i.format === void 0 || i.format === "General") && (r.formatting !== void 0 || i.displayedText === void 0) ? i.value.value : void 0, bt = vt !== void 0 ? String(vt) : $ ?? (i.displayedText !== void 0 && !i.style && !r.formatting ? i.displayedText : await st.format(i.value, i.format ?? "General", r, { unicodeMinus: i.value.kind === "number" }));
513
+ e2();
514
+ let nt = R.alignment === "fill" || R.alignment === "justify" ? "left" : R.alignment === "distributed" ? "center" : R.alignment === "general" ? $ ? "left" : i.value.kind === "number" ? "right" : i.value.kind === "boolean" || i.value.kind === "error" ? "center" : "left" : R.alignment, Wt = (R.alignment !== "fill" || !!R.rotation) && !!($ || i.value.kind === "string") && (R.wrap === true || R.alignment === "justify" || R.verticalAlignment === "justify" || R.verticalAlignment === "distributed"), St = !d && R.alignment !== "fill" && !Wt && ($ || i.value.kind === "string") ? (zt) => {
515
+ let _t = nt === "center" ? p3 + Math.max(0, (zt - p3 + 5 * c) / 2) : 1 / 0, At = { left: nt === "left" ? 0 : et(i, S - m.originX + p3, "left", _t) - p3, right: nt === "right" ? 0 : et(i, Math.max(p3, (a3.widthPoints - o2.margins.right - m.originX) / a3.scaleX - (S - m.originX)), "right", _t) - p3 }, Pt = p3 + Math.max(0, zt - p3 + 5 * c) / (nt === "center" ? 2 : 1), Ft = nt === "left" ? 0 : et(i, p3 + At.left, "left", Pt) - p3, Ot = nt === "right" ? 0 : et(i, p3 + At.right, "right", Pt) - p3;
516
+ if (Ft > 0 || Ot > 0) {
517
+ let Ut = t2.column(i.column).start, Vt = gt.get(i.row) ?? [];
518
+ Vt.push({ left: Ut - Ft, right: Ut + p3 + Ot }), gt.set(i.row, Vt);
519
+ }
520
+ return At;
521
+ } : void 0;
522
+ d && T.pushOperators(...Rt), await Qt(T, bt, S, wt, R.size * c, nt, { width: p3, height: h, style: R, wrap: Wt, fillString: !$ && i.value.kind === "string", ...vt === void 0 ? {} : { generalNumber: vt, zoom: Number(s.view?.zoom ?? 1) }, ...d ? { overflow: () => ({ left: 0, right: 0 }) } : St === void 0 ? {} : { overflow: St } }), d && T.pushOperators(Ct());
523
+ }
524
+ for (let i of ot) i.merge && (T.pushOperators(...Rt), Y(i), T.pushOperators(Ct()));
525
+ for (let i of Ee(m.area, { borders(d, p3) {
526
+ e2();
527
+ let h = E.get(`${d}:${p3}`);
528
+ return Bt(h ? re(h) : v.styleAt(d, p3), e2).borders ?? [];
529
+ }, column: t2.column, row: t2.row, hiddenRows: D, hiddenColumns: U, merges: s.merges ?? [], spans: gt }, e2)) {
530
+ e2();
531
+ let d = Ge[i.border.style];
532
+ T.drawLine({ start: { x: m.originX + 2 + i.x1, y: T.getHeight() - m.originY - i.y1 }, end: { x: m.originX + 2 + i.x2, y: T.getHeight() - m.originY - i.y2 }, thickness: d.width, color: jt(...i.border.color), opacity: i.border.alpha, ..."dash" in d ? { dashArray: [...d.dash] } : {}, ..."phase" in d ? { dashPhase: d.phase } : {} });
533
+ }
534
+ for (let { object: i, rectangle: d } of u) {
535
+ e2();
536
+ let p3 = t2.column(m.area.startColumn).start, h = t2.row(m.area.startRow).start, R = t2.column(m.area.endColumn), S = t2.row(m.area.endRow), wt = R.start + R.size, $ = S.start + S.size;
537
+ if (d.x >= wt || d.y >= $ || d.x + d.width <= p3 || d.y + d.height <= h) continue;
538
+ (d.x < p3 || d.y < h || d.x + d.width > wt || d.y + d.height > $) && (i.anchor.mode === "2" || i.anchor.mode === "absolute") && k("absolute workbook objects spanning pages");
539
+ let bt = m.originX + 2, nt = m.originY;
540
+ T.pushOperators(Tt(), $t(bt, T.getHeight() - nt - ($ - h), wt - p3, $ - h), qt(), Jt());
541
+ try {
542
+ await mt(T, i, bt + 0.5 + d.x - p3, nt + 0.5 + d.y - h, d.width, d.height);
543
+ } finally {
544
+ T.pushOperators(Ct());
545
+ }
546
+ }
547
+ T.pushOperators(Ct());
548
+ }
549
+ }
550
+ }
551
+ e2(), await Z.flush(), e2();
552
+ let oe;
553
+ try {
554
+ oe = await on(Z.context, { outputBytes: r.limits.outputBytes, objects: Math.min(1e6, r.limits.workbookWork ?? r.limits.inputBytes), work: e2, cooperate: async () => {
555
+ e2(), await new Promise((n2) => setTimeout(n2, 0)), e2();
556
+ } });
557
+ } catch (n2) {
558
+ if (n2 instanceof Oe) {
559
+ if (n2.code === "E_LIMIT") throw new e("resource-limit", "ssconvert PDF serialization limit exceeded");
560
+ k("serialization capability");
561
+ }
562
+ throw n2;
563
+ }
564
+ if (e2(), oe.length > r.limits.outputBytes) throw new e("resource-limit", "ssconvert output bytes limit exceeded");
565
+ return oe;
566
+ } finally {
567
+ lt.dispose();
568
+ }
569
+ }
570
+ export {
571
+ Bn as pdfExportOptions,
572
+ ti as writePdf
573
+ };
@@ -1,4 +1,3 @@
1
- import { syncCommandEvaluators } from "../internal.js";
2
1
  import { registerDefaultExecutors } from "../internal.js";
3
2
  import { diffCommand } from "../../../safe-bash-command-diff/index.js";
4
3
  import { patchCommand } from "../../../safe-bash-command-patch/index.js";
@@ -22,6 +21,4 @@ export function diffPatchCommands(options = {}) {
22
21
  }
23
22
  export * from "../../../safe-bash-command-diff/index.js";
24
23
  export * from "../../../safe-bash-command-patch/index.js";
25
- import { evalSyncDiff } from "../../../safe-bash-command-diff/index.js";
26
- syncCommandEvaluators.evalSyncDiff = evalSyncDiff;
27
24
  //# sourceMappingURL=index.js.map
@@ -60,6 +60,4 @@ export function evalSyncDiff3(inBytes, opArgs, readFileSync) {
60
60
  return undefined;
61
61
  }
62
62
  }
63
- import { syncCommandEvaluators } from "../internal.js";
64
- syncCommandEvaluators.evalSyncDiff3 = evalSyncDiff3;
65
63
  //# sourceMappingURL=index.js.map
@@ -33,7 +33,7 @@ import {
33
33
  htmlqCommands,
34
34
  mmdcCommands,
35
35
  unrtfCommands
36
- } from "./chunks/chunk-65TFMAZU.js";
36
+ } from "./chunks/chunk-BUYRKFW2.js";
37
37
  import {
38
38
  createMikeYqCommand,
39
39
  createMikeYqCommands,
@@ -225,7 +225,7 @@ import {
225
225
  xanCommands,
226
226
  xxdCommands,
227
227
  yesCommands
228
- } from "./chunks/chunk-ZA5FQ34E.js";
228
+ } from "./chunks/chunk-TPG55BAQ.js";
229
229
  import {
230
230
  createDos2unixCommand,
231
231
  createDos2unixCommands,