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