ooxml-core 1.33.0 → 1.34.0

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 (381) hide show
  1. package/dist/PptxHandler-5UDSMCBG.cjs +14 -0
  2. package/dist/PptxHandler-TTRTAQAR.mjs +5 -0
  3. package/dist/{PptxHandler-Q7CFNKOU.mjs → PptxHandler-XCYX5DVX.mjs} +2 -2
  4. package/dist/{PresentationBuilder-VP2637RH.cjs → PresentationBuilder-HA56ZY23.cjs} +6 -5
  5. package/dist/{PresentationBuilder-SADKXDWC.mjs → PresentationBuilder-IVLUEB4K.mjs} +2 -2
  6. package/dist/{PresentationBuilder-PJMQRZI6.mjs → PresentationBuilder-JBTNOIL7.mjs} +3 -2
  7. package/dist/automation/index.cjs +45489 -42876
  8. package/dist/automation/index.mjs +45489 -42876
  9. package/dist/{chunk-2LTIDUXH.cjs → chunk-A27O7M5X.cjs} +147 -133
  10. package/dist/{chunk-Y2RH4QWG.mjs → chunk-EGBNPVBA.mjs} +1542 -721
  11. package/dist/{chunk-QRXMYOVN.mjs → chunk-GNGL4BO7.mjs} +66 -44
  12. package/dist/chunk-LSO5SSFX.mjs +112 -0
  13. package/dist/chunk-MB3TYNMV.mjs +28 -0
  14. package/dist/{chunk-EBBWRRSB.mjs → chunk-MK2IBZU6.mjs} +1 -1
  15. package/dist/{chunk-BDZR4DZ6.cjs → chunk-PA5ADSTX.cjs} +1329 -1306
  16. package/dist/{chunk-BQGLWC6N.mjs → chunk-RI56PFGL.mjs} +67 -44
  17. package/dist/{chunk-3LMHYL4W.mjs → chunk-RPJHMPEL.mjs} +1 -1
  18. package/dist/{chunk-JQVOUS6B.mjs → chunk-TJXK4D4U.mjs} +4 -4
  19. package/dist/{chunk-6LJW76BZ.mjs → chunk-UQMAPY6D.mjs} +147 -128
  20. package/dist/chunk-XF6ZRA2D.cjs +120 -0
  21. package/dist/crypto/index.cjs +23 -15
  22. package/dist/crypto/index.mjs +23 -15
  23. package/dist/docx/block-parser.d.ts.map +1 -1
  24. package/dist/docx/embedded.cjs +519 -161
  25. package/dist/docx/embedded.mjs +519 -161
  26. package/dist/docx/find-pattern.d.ts +33 -0
  27. package/dist/docx/find-pattern.d.ts.map +1 -0
  28. package/dist/docx/find-replacement.d.ts +16 -0
  29. package/dist/docx/find-replacement.d.ts.map +1 -0
  30. package/dist/docx/find-syntax.d.ts +13 -0
  31. package/dist/docx/find-syntax.d.ts.map +1 -0
  32. package/dist/docx/find-wildcards.d.ts +8 -0
  33. package/dist/docx/find-wildcards.d.ts.map +1 -0
  34. package/dist/docx/form-field-model.d.ts +39 -0
  35. package/dist/docx/form-field-model.d.ts.map +1 -1
  36. package/dist/docx/index.cjs +3157 -994
  37. package/dist/docx/index.d.ts +3 -1
  38. package/dist/docx/index.d.ts.map +1 -1
  39. package/dist/docx/index.mjs +3153 -995
  40. package/dist/docx/layout/adapter.d.ts.map +1 -1
  41. package/dist/docx/layout/index.cjs +30 -8
  42. package/dist/docx/layout/index.mjs +30 -8
  43. package/dist/docx/layout/input.d.ts +2 -0
  44. package/dist/docx/layout/input.d.ts.map +1 -1
  45. package/dist/docx/load/index.cjs +6706 -1322
  46. package/dist/docx/load/index.mjs +6706 -1322
  47. package/dist/docx/load/legacy-doc/binary-save.d.ts +4 -0
  48. package/dist/docx/load/legacy-doc/binary-save.d.ts.map +1 -0
  49. package/dist/docx/load/legacy-doc/blocks.d.ts +19 -0
  50. package/dist/docx/load/legacy-doc/blocks.d.ts.map +1 -0
  51. package/dist/docx/load/legacy-doc/borders.d.ts +7 -0
  52. package/dist/docx/load/legacy-doc/borders.d.ts.map +1 -0
  53. package/dist/docx/load/legacy-doc/context.d.ts +65 -0
  54. package/dist/docx/load/legacy-doc/context.d.ts.map +1 -0
  55. package/dist/docx/load/legacy-doc/drawing.d.ts +15 -0
  56. package/dist/docx/load/legacy-doc/drawing.d.ts.map +1 -0
  57. package/dist/docx/load/legacy-doc/error.d.ts +5 -0
  58. package/dist/docx/load/legacy-doc/error.d.ts.map +1 -0
  59. package/dist/docx/load/legacy-doc/inline.d.ts +7 -0
  60. package/dist/docx/load/legacy-doc/inline.d.ts.map +1 -0
  61. package/dist/docx/load/legacy-doc/numbering-part.d.ts +3 -0
  62. package/dist/docx/load/legacy-doc/numbering-part.d.ts.map +1 -0
  63. package/dist/docx/load/legacy-doc/package.d.ts +8 -0
  64. package/dist/docx/load/legacy-doc/package.d.ts.map +1 -0
  65. package/dist/docx/load/legacy-doc/para-props.d.ts +6 -0
  66. package/dist/docx/load/legacy-doc/para-props.d.ts.map +1 -0
  67. package/dist/docx/load/legacy-doc/run-props.d.ts +8 -0
  68. package/dist/docx/load/legacy-doc/run-props.d.ts.map +1 -0
  69. package/dist/docx/load/legacy-doc/sections.d.ts +23 -0
  70. package/dist/docx/load/legacy-doc/sections.d.ts.map +1 -0
  71. package/dist/docx/load/legacy-doc/styles-part.d.ts +3 -0
  72. package/dist/docx/load/legacy-doc/styles-part.d.ts.map +1 -0
  73. package/dist/docx/load/legacy-doc/table.d.ts +6 -0
  74. package/dist/docx/load/legacy-doc/table.d.ts.map +1 -0
  75. package/dist/docx/load/legacy-doc/xml.d.ts +21 -0
  76. package/dist/docx/load/legacy-doc/xml.d.ts.map +1 -0
  77. package/dist/docx/load/legacy-doc.d.ts +5 -4
  78. package/dist/docx/load/legacy-doc.d.ts.map +1 -1
  79. package/dist/docx/model-paragraph.d.ts +5 -0
  80. package/dist/docx/model-paragraph.d.ts.map +1 -1
  81. package/dist/docx/model.d.ts +3 -0
  82. package/dist/docx/model.d.ts.map +1 -1
  83. package/dist/docx/numbering-editing.d.ts +11 -1
  84. package/dist/docx/numbering-editing.d.ts.map +1 -1
  85. package/dist/docx/numbering-format.d.ts.map +1 -1
  86. package/dist/docx/numbering-model.d.ts +17 -0
  87. package/dist/docx/numbering-model.d.ts.map +1 -1
  88. package/dist/docx/numbering-package.d.ts +2 -2
  89. package/dist/docx/numbering-package.d.ts.map +1 -1
  90. package/dist/docx/numbering-parse.d.ts +2 -1
  91. package/dist/docx/numbering-parse.d.ts.map +1 -1
  92. package/dist/docx/numbering-picture-save.d.ts +13 -0
  93. package/dist/docx/numbering-picture-save.d.ts.map +1 -0
  94. package/dist/docx/numbering-picture.d.ts +18 -0
  95. package/dist/docx/numbering-picture.d.ts.map +1 -0
  96. package/dist/docx/parse.d.ts.map +1 -1
  97. package/dist/docx/permission-markers.d.ts +19 -0
  98. package/dist/docx/permission-markers.d.ts.map +1 -0
  99. package/dist/docx/permissions.d.ts +11 -0
  100. package/dist/docx/permissions.d.ts.map +1 -0
  101. package/dist/docx/protection-legacy.d.ts +13 -0
  102. package/dist/docx/protection-legacy.d.ts.map +1 -0
  103. package/dist/docx/protection.d.ts +30 -0
  104. package/dist/docx/protection.d.ts.map +1 -0
  105. package/dist/docx/save.d.ts.map +1 -1
  106. package/dist/docx/settings.d.ts +6 -1
  107. package/dist/docx/settings.d.ts.map +1 -1
  108. package/dist/docx/ui/customization.d.ts.map +1 -1
  109. package/dist/docx/ui/edit-restriction.d.ts +53 -0
  110. package/dist/docx/ui/edit-restriction.d.ts.map +1 -0
  111. package/dist/docx/ui/index.cjs +548 -18
  112. package/dist/docx/ui/index.d.ts +4 -0
  113. package/dist/docx/ui/index.d.ts.map +1 -1
  114. package/dist/docx/ui/index.mjs +528 -19
  115. package/dist/docx/ui/paragraph-attributes.d.ts.map +1 -1
  116. package/dist/docx/ui/ribbon-action-ids.d.ts +1 -1
  117. package/dist/docx/ui/ribbon-action-ids.d.ts.map +1 -1
  118. package/dist/docx/write-paragraph.d.ts.map +1 -1
  119. package/dist/drawingml/index.cjs +1 -0
  120. package/dist/drawingml/index.mjs +1 -0
  121. package/dist/drawingml/write-theme.d.ts +2 -0
  122. package/dist/drawingml/write-theme.d.ts.map +1 -1
  123. package/dist/index.cjs +337 -95
  124. package/dist/index.mjs +337 -95
  125. package/dist/pptx/automation/index.cjs +1919 -758
  126. package/dist/pptx/automation/index.d.ts +37 -3
  127. package/dist/pptx/automation/index.d.ts.map +1 -1
  128. package/dist/pptx/automation/index.mjs +252 -10
  129. package/dist/pptx/automation/schemas/index.cjs +26 -0
  130. package/dist/pptx/automation/schemas/index.d.ts +26 -1
  131. package/dist/pptx/automation/schemas/index.d.ts.map +1 -0
  132. package/dist/pptx/automation/schemas/index.mjs +1 -1
  133. package/dist/pptx/chunks/index-Bp-1pGo1.d.ts.map +1 -1
  134. package/dist/pptx/chunks/{index-BuMPQDQb.d.ts → index-pLLN4OTz.d.ts} +37 -10
  135. package/dist/pptx/chunks/{index-BuMPQDQb.d.ts.map → index-pLLN4OTz.d.ts.map} +1 -1
  136. package/dist/pptx/cli/index.cjs +281 -116
  137. package/dist/pptx/cli/index.mjs +4 -4
  138. package/dist/pptx/converter/index.mjs +2 -2
  139. package/dist/pptx/editor/render/custom-show-operations.cjs +133 -0
  140. package/dist/pptx/editor/render/custom-show-operations.d.ts +42 -0
  141. package/dist/pptx/editor/render/custom-show-operations.d.ts.map +1 -0
  142. package/dist/pptx/editor/render/custom-show-operations.mjs +119 -0
  143. package/dist/pptx/editor/render/find-replace.cjs +15 -14
  144. package/dist/pptx/editor/render/find-replace.d.ts +1 -1
  145. package/dist/pptx/editor/render/find-replace.mjs +2 -1
  146. package/dist/pptx/editor/render/slide-operations.cjs +9 -8
  147. package/dist/pptx/editor/render/slide-operations.mjs +3 -2
  148. package/dist/pptx/editor/render/table-data-grid-ops.cjs +1 -1
  149. package/dist/pptx/editor/render/table-data-grid-ops.mjs +1 -1
  150. package/dist/pptx/index.cjs +1656 -761
  151. package/dist/pptx/index.d.ts +2 -2
  152. package/dist/pptx/index.mjs +5 -5
  153. package/dist/teams/index.cjs +213 -26
  154. package/dist/teams/index.mjs +213 -26
  155. package/dist/text/index.cjs +241 -0
  156. package/dist/text/index.d.ts +2 -0
  157. package/dist/text/index.d.ts.map +1 -1
  158. package/dist/text/index.mjs +240 -1
  159. package/dist/text/truetype/parse.d.ts +36 -0
  160. package/dist/text/truetype/parse.d.ts.map +1 -0
  161. package/dist/text/truetype/subset.d.ts +16 -0
  162. package/dist/text/truetype/subset.d.ts.map +1 -0
  163. package/dist/visio/cell-formula.d.ts.map +1 -1
  164. package/dist/visio/container-relationships.d.ts +40 -6
  165. package/dist/visio/container-relationships.d.ts.map +1 -1
  166. package/dist/visio/data-connections.d.ts +32 -0
  167. package/dist/visio/data-connections.d.ts.map +1 -0
  168. package/dist/visio/data-recordsets.d.ts +7 -0
  169. package/dist/visio/data-recordsets.d.ts.map +1 -1
  170. package/dist/visio/data-refresh.d.ts +33 -0
  171. package/dist/visio/data-refresh.d.ts.map +1 -0
  172. package/dist/visio/edit-commands.d.ts +6 -1
  173. package/dist/visio/edit-commands.d.ts.map +1 -1
  174. package/dist/visio/edit-connector.d.ts.map +1 -1
  175. package/dist/visio/edit-container-fit.d.ts +15 -2
  176. package/dist/visio/edit-container-fit.d.ts.map +1 -1
  177. package/dist/visio/edit-container-members.d.ts +12 -0
  178. package/dist/visio/edit-container-members.d.ts.map +1 -1
  179. package/dist/visio/edit-container-options.d.ts +33 -0
  180. package/dist/visio/edit-container-options.d.ts.map +1 -0
  181. package/dist/visio/edit-data-commands.d.ts +5 -0
  182. package/dist/visio/edit-data-commands.d.ts.map +1 -1
  183. package/dist/visio/edit-data-parts.d.ts +2 -0
  184. package/dist/visio/edit-data-parts.d.ts.map +1 -1
  185. package/dist/visio/edit-data.d.ts.map +1 -1
  186. package/dist/visio/edit-diagram-parts-commands.d.ts +2 -1
  187. package/dist/visio/edit-diagram-parts-commands.d.ts.map +1 -1
  188. package/dist/visio/edit-diagram-parts.d.ts +8 -0
  189. package/dist/visio/edit-diagram-parts.d.ts.map +1 -1
  190. package/dist/visio/edit-group-resize.d.ts.map +1 -1
  191. package/dist/visio/edit-instance-checks.d.ts.map +1 -1
  192. package/dist/visio/edit-package.d.ts.map +1 -1
  193. package/dist/visio/edit-page-theme-commands.d.ts +26 -0
  194. package/dist/visio/edit-page-theme-commands.d.ts.map +1 -1
  195. package/dist/visio/edit-page-theme-part.d.ts +6 -0
  196. package/dist/visio/edit-page-theme-part.d.ts.map +1 -0
  197. package/dist/visio/edit-page-theme.d.ts +9 -1
  198. package/dist/visio/edit-page-theme.d.ts.map +1 -1
  199. package/dist/visio/edit-picture-adjust.d.ts +32 -0
  200. package/dist/visio/edit-picture-adjust.d.ts.map +1 -0
  201. package/dist/visio/edit-resize-anchor.d.ts.map +1 -1
  202. package/dist/visio/edit-swimlane-commands.d.ts +91 -0
  203. package/dist/visio/edit-swimlane-commands.d.ts.map +1 -0
  204. package/dist/visio/edit-swimlane-layout.d.ts +64 -0
  205. package/dist/visio/edit-swimlane-layout.d.ts.map +1 -0
  206. package/dist/visio/edit-swimlane-ops.d.ts +11 -0
  207. package/dist/visio/edit-swimlane-ops.d.ts.map +1 -0
  208. package/dist/visio/edit-swimlane-shapes.d.ts +42 -0
  209. package/dist/visio/edit-swimlane-shapes.d.ts.map +1 -0
  210. package/dist/visio/edit-swimlane-turn.d.ts +9 -0
  211. package/dist/visio/edit-swimlane-turn.d.ts.map +1 -0
  212. package/dist/visio/edit.d.ts.map +1 -1
  213. package/dist/visio/effects.d.ts +3 -2
  214. package/dist/visio/effects.d.ts.map +1 -1
  215. package/dist/visio/geometry.d.ts +2 -1
  216. package/dist/visio/geometry.d.ts.map +1 -1
  217. package/dist/visio/index.cjs +10254 -7285
  218. package/dist/visio/index.d.ts +7 -0
  219. package/dist/visio/index.d.ts.map +1 -1
  220. package/dist/visio/index.mjs +10248 -7286
  221. package/dist/visio/infinite-line.d.ts +17 -0
  222. package/dist/visio/infinite-line.d.ts.map +1 -0
  223. package/dist/visio/model.d.ts +46 -0
  224. package/dist/visio/model.d.ts.map +1 -1
  225. package/dist/visio/package-kind.d.ts +34 -0
  226. package/dist/visio/package-kind.d.ts.map +1 -0
  227. package/dist/visio/page-theme.d.ts +7 -0
  228. package/dist/visio/page-theme.d.ts.map +1 -1
  229. package/dist/visio/parser.d.ts +2 -2
  230. package/dist/visio/parser.d.ts.map +1 -1
  231. package/dist/visio/shadow.d.ts +2 -1
  232. package/dist/visio/shadow.d.ts.map +1 -1
  233. package/dist/visio/shape-structure.d.ts +14 -1
  234. package/dist/visio/shape-structure.d.ts.map +1 -1
  235. package/dist/visio/shapes.d.ts +7 -1
  236. package/dist/visio/shapes.d.ts.map +1 -1
  237. package/dist/visio/stencil-file.d.ts +2 -2
  238. package/dist/visio/style.d.ts.map +1 -1
  239. package/dist/visio/swimlane-stack.d.ts +65 -0
  240. package/dist/visio/swimlane-stack.d.ts.map +1 -0
  241. package/dist/visio/theme-builtins.d.ts +3 -0
  242. package/dist/visio/theme-builtins.d.ts.map +1 -1
  243. package/dist/visio/theme-effects.d.ts +19 -0
  244. package/dist/visio/theme-effects.d.ts.map +1 -0
  245. package/dist/visio/theme-font.d.ts +13 -0
  246. package/dist/visio/theme-font.d.ts.map +1 -0
  247. package/dist/visio/theme-line.d.ts.map +1 -1
  248. package/dist/visio/theme-write.d.ts.map +1 -1
  249. package/dist/visio/theme.d.ts +7 -0
  250. package/dist/visio/theme.d.ts.map +1 -1
  251. package/dist/visio/ui/data-graphic-config.d.ts +45 -0
  252. package/dist/visio/ui/data-graphic-config.d.ts.map +1 -0
  253. package/dist/visio/ui/data-graphic-rules.d.ts +7 -0
  254. package/dist/visio/ui/data-graphic-rules.d.ts.map +1 -1
  255. package/dist/visio/ui/data-graphics.d.ts +9 -0
  256. package/dist/visio/ui/data-graphics.d.ts.map +1 -1
  257. package/dist/visio/ui/diagram-parts.d.ts +8 -1
  258. package/dist/visio/ui/diagram-parts.d.ts.map +1 -1
  259. package/dist/visio/ui/edit-commands.d.ts.map +1 -1
  260. package/dist/visio/ui/guides.d.ts +9 -1
  261. package/dist/visio/ui/guides.d.ts.map +1 -1
  262. package/dist/visio/ui/index.cjs +12664 -9884
  263. package/dist/visio/ui/index.d.ts +4 -0
  264. package/dist/visio/ui/index.d.ts.map +1 -1
  265. package/dist/visio/ui/index.mjs +12630 -9885
  266. package/dist/visio/ui/org-chart.d.ts +75 -0
  267. package/dist/visio/ui/org-chart.d.ts.map +1 -0
  268. package/dist/visio/ui/resize-snap.d.ts +51 -0
  269. package/dist/visio/ui/resize-snap.d.ts.map +1 -0
  270. package/dist/visio/ui/sample-drawing.d.ts +26 -0
  271. package/dist/visio/ui/sample-drawing.d.ts.map +1 -1
  272. package/dist/visio/ui/scene-validation.d.ts.map +1 -1
  273. package/dist/visio/ui/selection-resize.d.ts +2 -2
  274. package/dist/visio/ui/selection-resize.d.ts.map +1 -1
  275. package/dist/visio/ui/shape-resize.d.ts +29 -1
  276. package/dist/visio/ui/shape-resize.d.ts.map +1 -1
  277. package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
  278. package/dist/visio/ui/swimlane.d.ts +37 -0
  279. package/dist/visio/ui/swimlane.d.ts.map +1 -0
  280. package/dist/visio/ui/templates.d.ts +26 -0
  281. package/dist/visio/ui/templates.d.ts.map +1 -0
  282. package/dist/xlsx/audit/ast-text.d.ts +12 -0
  283. package/dist/xlsx/audit/ast-text.d.ts.map +1 -0
  284. package/dist/xlsx/audit/error-check.d.ts +23 -0
  285. package/dist/xlsx/audit/error-check.d.ts.map +1 -0
  286. package/dist/xlsx/audit/evaluate-steps.d.ts +48 -0
  287. package/dist/xlsx/audit/evaluate-steps.d.ts.map +1 -0
  288. package/dist/xlsx/audit/index.d.ts +6 -0
  289. package/dist/xlsx/audit/index.d.ts.map +1 -0
  290. package/dist/xlsx/audit/trace.d.ts +59 -0
  291. package/dist/xlsx/audit/trace.d.ts.map +1 -0
  292. package/dist/xlsx/audit/watch.d.ts +17 -0
  293. package/dist/xlsx/audit/watch.d.ts.map +1 -0
  294. package/dist/xlsx/edit/filter.d.ts +5 -2
  295. package/dist/xlsx/edit/filter.d.ts.map +1 -1
  296. package/dist/xlsx/edit/index.d.ts +4 -1
  297. package/dist/xlsx/edit/index.d.ts.map +1 -1
  298. package/dist/xlsx/edit/session.d.ts.map +1 -1
  299. package/dist/xlsx/edit/sort-choices.d.ts +23 -0
  300. package/dist/xlsx/edit/sort-choices.d.ts.map +1 -0
  301. package/dist/xlsx/edit/sort-keys.d.ts +49 -0
  302. package/dist/xlsx/edit/sort-keys.d.ts.map +1 -0
  303. package/dist/xlsx/edit/sort-reapply.d.ts +11 -0
  304. package/dist/xlsx/edit/sort-reapply.d.ts.map +1 -0
  305. package/dist/xlsx/edit/sort.d.ts +14 -12
  306. package/dist/xlsx/edit/sort.d.ts.map +1 -1
  307. package/dist/xlsx/edit/types.d.ts +7 -6
  308. package/dist/xlsx/edit/types.d.ts.map +1 -1
  309. package/dist/xlsx/edit/view.d.ts +9 -1
  310. package/dist/xlsx/edit/view.d.ts.map +1 -1
  311. package/dist/xlsx/filter-criteria.d.ts +2 -1
  312. package/dist/xlsx/filter-criteria.d.ts.map +1 -1
  313. package/dist/xlsx/formula/engine-types.d.ts +8 -0
  314. package/dist/xlsx/formula/engine-types.d.ts.map +1 -1
  315. package/dist/xlsx/formula/engine.d.ts.map +1 -1
  316. package/dist/xlsx/index.cjs +5478 -4220
  317. package/dist/xlsx/index.d.ts +1 -0
  318. package/dist/xlsx/index.d.ts.map +1 -1
  319. package/dist/xlsx/index.mjs +5450 -4221
  320. package/dist/xlsx/layout/index.d.ts +1 -0
  321. package/dist/xlsx/layout/index.d.ts.map +1 -1
  322. package/dist/xlsx/layout/split.d.ts +55 -0
  323. package/dist/xlsx/layout/split.d.ts.map +1 -0
  324. package/dist/xlsx/layout/viewport.d.ts +2 -0
  325. package/dist/xlsx/layout/viewport.d.ts.map +1 -1
  326. package/dist/xlsx/load/index.cjs +305 -109
  327. package/dist/xlsx/load/index.mjs +305 -109
  328. package/dist/xlsx/model-sort.d.ts +27 -0
  329. package/dist/xlsx/model-sort.d.ts.map +1 -0
  330. package/dist/xlsx/model.d.ts +39 -1
  331. package/dist/xlsx/model.d.ts.map +1 -1
  332. package/dist/xlsx/read/ignored-errors.d.ts +4 -0
  333. package/dist/xlsx/read/ignored-errors.d.ts.map +1 -0
  334. package/dist/xlsx/read/sheet-props.d.ts.map +1 -1
  335. package/dist/xlsx/read/sort-state.d.ts +5 -0
  336. package/dist/xlsx/read/sort-state.d.ts.map +1 -0
  337. package/dist/xlsx/read/tables.d.ts +2 -2
  338. package/dist/xlsx/read/tables.d.ts.map +1 -1
  339. package/dist/xlsx/read/worksheet.d.ts.map +1 -1
  340. package/dist/xlsx/sort-lists.d.ts +6 -0
  341. package/dist/xlsx/sort-lists.d.ts.map +1 -0
  342. package/dist/xlsx/ui/audit-state.d.ts +19 -0
  343. package/dist/xlsx/ui/audit-state.d.ts.map +1 -0
  344. package/dist/xlsx/ui/commands/audit.d.ts +3 -0
  345. package/dist/xlsx/ui/commands/audit.d.ts.map +1 -0
  346. package/dist/xlsx/ui/commands/formulas.d.ts.map +1 -1
  347. package/dist/xlsx/ui/commands/i18n/audit.d.ts +3 -0
  348. package/dist/xlsx/ui/commands/i18n/audit.d.ts.map +1 -0
  349. package/dist/xlsx/ui/commands/i18n/index.d.ts.map +1 -1
  350. package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
  351. package/dist/xlsx/ui/commands/i18n/ribbon-tabs.d.ts.map +1 -1
  352. package/dist/xlsx/ui/commands/i18n/rules.d.ts.map +1 -1
  353. package/dist/xlsx/ui/commands/icons.d.ts.map +1 -1
  354. package/dist/xlsx/ui/commands/sort-filter.d.ts.map +1 -1
  355. package/dist/xlsx/ui/context.d.ts +6 -1
  356. package/dist/xlsx/ui/context.d.ts.map +1 -1
  357. package/dist/xlsx/ui/grid/geometry.d.ts +29 -1
  358. package/dist/xlsx/ui/grid/geometry.d.ts.map +1 -1
  359. package/dist/xlsx/ui/index.cjs +10761 -9573
  360. package/dist/xlsx/ui/index.d.ts +1 -0
  361. package/dist/xlsx/ui/index.d.ts.map +1 -1
  362. package/dist/xlsx/ui/index.mjs +10755 -9574
  363. package/dist/xlsx/ui/ribbon/icon-paths.d.ts.map +1 -1
  364. package/dist/xlsx/ui/ribbon/tabs/review-view.d.ts.map +1 -1
  365. package/dist/xlsx/write/filter-columns.d.ts +14 -0
  366. package/dist/xlsx/write/filter-columns.d.ts.map +1 -1
  367. package/dist/xlsx/write/ignored-errors.d.ts +3 -0
  368. package/dist/xlsx/write/ignored-errors.d.ts.map +1 -0
  369. package/dist/xlsx/write/sheet-parts.d.ts.map +1 -1
  370. package/dist/xlsx/write/sheet-props.d.ts.map +1 -1
  371. package/dist/xlsx/write/sort-state.d.ts +55 -0
  372. package/dist/xlsx/write/sort-state.d.ts.map +1 -0
  373. package/dist/xlsx/write/table-patch.d.ts +2 -1
  374. package/dist/xlsx/write/table-patch.d.ts.map +1 -1
  375. package/dist/xlsx/write/tables.d.ts +2 -1
  376. package/dist/xlsx/write/tables.d.ts.map +1 -1
  377. package/dist/xlsx/write/worksheet.d.ts.map +1 -1
  378. package/package.json +2 -2
  379. package/dist/PptxHandler-MGKMIK22.cjs +0 -13
  380. package/dist/PptxHandler-TEC7SWBU.mjs +0 -4
  381. package/dist/chunk-MHNETXQB.mjs +0 -1
@@ -6279,18 +6279,18 @@ function getCommentMarkerPosition(comment, index, width, height) {
6279
6279
  };
6280
6280
  }
6281
6281
  async function readFileAsDataUrl(file) {
6282
- return await new Promise((resolve, reject) => {
6282
+ return await new Promise((resolve, reject2) => {
6283
6283
  const reader2 = new FileReader();
6284
6284
  reader2.onload = () => {
6285
6285
  const result = reader2.result;
6286
6286
  if (typeof result !== "string") {
6287
- reject(new Error("Failed to read image file."));
6287
+ reject2(new Error("Failed to read image file."));
6288
6288
  return;
6289
6289
  }
6290
6290
  resolve(result);
6291
6291
  };
6292
6292
  reader2.onerror = () => {
6293
- reject(new Error("Failed to read image file."));
6293
+ reject2(new Error("Failed to read image file."));
6294
6294
  };
6295
6295
  reader2.readAsDataURL(file);
6296
6296
  });
@@ -22807,10 +22807,10 @@ var init_ole_utils = __esm({
22807
22807
  }
22808
22808
  });
22809
22809
 
22810
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js
22810
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js
22811
22811
  var OLE_MAGIC, ENDOFCHAIN, FREESECT, FATSECT, DIFSECT, MAXREGSECT, ENTRY_TYPE_EMPTY, ENTRY_TYPE_STORAGE, ENTRY_TYPE_STREAM, NOSTREAM, ENTRY_TYPE_ROOT, DIR_ENTRY_SIZE; exports.Ole2ParseError = void 0;
22812
22812
  var init_ole2_parser_types = __esm({
22813
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js"() {
22813
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js"() {
22814
22814
  OLE_MAGIC = new Uint8Array([208, 207, 17, 224, 161, 177, 26, 225]);
22815
22815
  ENDOFCHAIN = 4294967294;
22816
22816
  FREESECT = 4294967295;
@@ -22832,15 +22832,23 @@ var init_ole2_parser_types = __esm({
22832
22832
  }
22833
22833
  });
22834
22834
 
22835
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-directory.js
22836
- function readFileTime(view, offset) {
22837
- const ticks = view.getBigUint64(offset, true);
22835
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-filetime.js
22836
+ function fileTimeDate(ticks) {
22838
22837
  if (ticks === 0n)
22839
22838
  return void 0;
22840
- const ms = Number((ticks - FILETIME_UNIX_EPOCH) / 10000n);
22841
- const date = new Date(ms);
22839
+ const delta2 = ticks - EPOCH;
22840
+ const ms = delta2 >= 0n ? delta2 / 10000n : (delta2 - 9999n) / 10000n;
22841
+ const date = new Date(Number(ms));
22842
22842
  return Number.isNaN(date.getTime()) ? void 0 : date;
22843
22843
  }
22844
+ var EPOCH;
22845
+ var init_ole2_filetime = __esm({
22846
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-filetime.js"() {
22847
+ EPOCH = 116444736000000000n;
22848
+ }
22849
+ });
22850
+
22851
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-directory.js
22844
22852
  function decodeSlot(dir, id, majorVersion, warnings) {
22845
22853
  const view = new DataView(dir.buffer, dir.byteOffset + id * DIR_ENTRY_SIZE, DIR_ENTRY_SIZE);
22846
22854
  const nameLen = view.getUint16(64, true);
@@ -22876,8 +22884,10 @@ function decodeSlot(dir, id, majorVersion, warnings) {
22876
22884
  childId: link(76),
22877
22885
  clsid: new Uint8Array(view.buffer.slice(view.byteOffset + 80, view.byteOffset + 96)),
22878
22886
  stateBits: view.getUint32(96, true),
22879
- created: readFileTime(view, 100),
22880
- modified: readFileTime(view, 108),
22887
+ created: fileTimeDate(view.getBigUint64(100, true)),
22888
+ modified: fileTimeDate(view.getBigUint64(108, true)),
22889
+ createdFileTime: view.getBigUint64(100, true),
22890
+ modifiedFileTime: view.getBigUint64(108, true),
22881
22891
  startSector: view.getUint32(116, true),
22882
22892
  size,
22883
22893
  parentId: -1
@@ -22992,15 +23002,14 @@ function findStreamByName(entries, name, isReadable) {
22992
23002
  const top = entries.filter((entry2) => entry2.parentId === root?.id && isReadable(entry2));
22993
23003
  return top.find((entry2) => entry2.name === name) ?? top.find((entry2) => sameName(entry2.name, name)) ?? entries.find((entry2) => entry2.name === name && isReadable(entry2));
22994
23004
  }
22995
- var FILETIME_UNIX_EPOCH;
22996
23005
  var init_ole2_directory = __esm({
22997
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-directory.js"() {
23006
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-directory.js"() {
23007
+ init_ole2_filetime();
22998
23008
  init_ole2_parser_types();
22999
- FILETIME_UNIX_EPOCH = 116444736000000000n;
23000
23009
  }
23001
23010
  });
23002
23011
 
23003
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js
23012
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js
23004
23013
  function parseOle2(buffer, options2 = {}) {
23005
23014
  const strict = options2.strict === true;
23006
23015
  const data = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
@@ -23147,7 +23156,11 @@ function parseOle2(buffer, options2 = {}) {
23147
23156
  }
23148
23157
  if (firstDirectorySector > MAXREGSECT)
23149
23158
  throw new exports.Ole2ParseError("Missing directory chain");
23150
- const entries = readDirectory(readMetadataChain(firstDirectorySector, "directory"), majorVersion, strict, warnings);
23159
+ const directoryBytes = readMetadataChain(firstDirectorySector, "directory");
23160
+ if (strict && majorVersion === 4 && view.getUint32(40, true) !== directoryBytes.length / sectorSize) {
23161
+ throw new exports.Ole2ParseError("Unexpected directory sector count");
23162
+ }
23163
+ const entries = readDirectory(directoryBytes, majorVersion, strict, warnings);
23151
23164
  for (const entry2 of entries) {
23152
23165
  if (majorVersion === 4 && (!Number.isSafeInteger(entry2.size) || entry2.size > sectorCount * sectorSize)) {
23153
23166
  throw new exports.Ole2ParseError("Stream size exceeds supported file bounds");
@@ -23238,7 +23251,7 @@ function parseOle2(buffer, options2 = {}) {
23238
23251
  };
23239
23252
  }
23240
23253
  var init_ole2_parser_read = __esm({
23241
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js"() {
23254
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js"() {
23242
23255
  init_ole2_parser_types();
23243
23256
  init_ole2_directory();
23244
23257
  }
@@ -23379,7 +23392,7 @@ var init_ole_embedded_extract = __esm({
23379
23392
  }
23380
23393
  });
23381
23394
 
23382
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js
23395
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js
23383
23396
  function compareDirEntryNames(a, b) {
23384
23397
  const ua = a.toUpperCase();
23385
23398
  const ub = b.toUpperCase();
@@ -23446,12 +23459,12 @@ function writeInt32Sectors(outBytes, int32Data, firstSector, numSectors, sectorS
23446
23459
  }
23447
23460
  }
23448
23461
  var init_ole2_parser_write_helpers = __esm({
23449
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js"() {
23462
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js"() {
23450
23463
  init_ole2_parser_types();
23451
23464
  }
23452
23465
  });
23453
23466
 
23454
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js
23467
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js
23455
23468
  function writeHeader(outView, outBytes, params) {
23456
23469
  outBytes.set(OLE_MAGIC, 0);
23457
23470
  outView.setUint16(24, 62, true);
@@ -23544,14 +23557,14 @@ function writeStreamSectors(outBytes, streamData, chain2, sectorSize) {
23544
23557
  }
23545
23558
  var HEADER_DIFAT_ENTRIES;
23546
23559
  var init_ole2_parser_write_serialize = __esm({
23547
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js"() {
23560
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js"() {
23548
23561
  init_ole2_parser_types();
23549
23562
  init_ole2_parser_write_helpers();
23550
23563
  HEADER_DIFAT_ENTRIES = 109;
23551
23564
  }
23552
23565
  });
23553
23566
 
23554
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js
23567
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js
23555
23568
  function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
23556
23569
  const sectorSize = 512;
23557
23570
  const miniSectorSize = 64;
@@ -23732,7 +23745,7 @@ function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
23732
23745
  return output;
23733
23746
  }
23734
23747
  var init_ole2_parser_write = __esm({
23735
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js"() {
23748
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js"() {
23736
23749
  init_ole2_parser_types();
23737
23750
  init_ole2_parser_write_helpers();
23738
23751
  init_ole2_parser_write_serialize();
@@ -24646,7 +24659,7 @@ var init_ole_sheet_xlsx_editor = __esm({
24646
24659
  }
24647
24660
  });
24648
24661
 
24649
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-edit.js
24662
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-edit.js
24650
24663
  function chain(table, start, limit) {
24651
24664
  if (start === END && limit === 0)
24652
24665
  return [];
@@ -24730,21 +24743,21 @@ function readTarget(input, target, root, fat, sector, sectorCount, sectorSize, m
24730
24743
  return out;
24731
24744
  }
24732
24745
  function processCompoundFileStream(input, path3, replacement) {
24733
- const reject = () => replacement ? input : void 0;
24746
+ const reject2 = () => replacement ? input : void 0;
24734
24747
  try {
24735
24748
  if (path3.length === 0 || path3.some((part) => !part) || input.length < 512)
24736
- return reject();
24749
+ return reject2();
24737
24750
  const view = new DataView(input.buffer, input.byteOffset, input.byteLength);
24738
24751
  const read32 = (offset2) => view.getUint32(offset2, true);
24739
24752
  if (input[0] !== 208 || input[1] !== 207 || input[2] !== 17 || input[3] !== 224 || input[4] !== 161 || input[5] !== 177 || input[6] !== 26 || input[7] !== 225 || // Readers tolerate a non-canonical byte-order mark; edits do not.
24740
24753
  replacement && view.getUint16(28, true) !== 65534)
24741
- return reject();
24754
+ return reject2();
24742
24755
  const major = view.getUint16(26, true), shift = view.getUint16(30, true), miniShift = view.getUint16(32, true);
24743
24756
  if (major !== 3 && major !== 4 || shift !== (major === 3 ? 9 : 12) || miniShift !== 6)
24744
- return reject();
24757
+ return reject2();
24745
24758
  const sectorSize = 1 << shift, miniSize = 1 << miniShift;
24746
24759
  if (input.length < sectorSize || replacement && input.length % sectorSize !== 0)
24747
- return reject();
24760
+ return reject2();
24748
24761
  const sectorCount = Math.ceil(input.length / sectorSize) - 1;
24749
24762
  const offset = (id) => (id + 1) * sectorSize;
24750
24763
  const sector = (id) => {
@@ -24763,7 +24776,7 @@ function processCompoundFileStream(input, path3, replacement) {
24763
24776
  const difatIds = /* @__PURE__ */ new Set();
24764
24777
  for (let i2 = 0; i2 < difatCount; i2++) {
24765
24778
  if (difatIds.has(difat) || difat > MAX)
24766
- return reject();
24779
+ return reject2();
24767
24780
  difatIds.add(difat);
24768
24781
  const bytes = sector(difat), dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
24769
24782
  for (let j = 0; j < (sectorSize - 4) / 4 && fatIds.length < fatCount; j++) {
@@ -24774,7 +24787,7 @@ function processCompoundFileStream(input, path3, replacement) {
24774
24787
  difat = dv.getUint32(sectorSize - 4, true);
24775
24788
  }
24776
24789
  if (fatIds.length !== fatCount || new Set(fatIds).size !== fatIds.length || fatIds.some((id) => difatIds.has(id)))
24777
- return reject();
24790
+ return reject2();
24778
24791
  const fat = [];
24779
24792
  for (const id of fatIds) {
24780
24793
  const bytes = sector(id), dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
@@ -24793,13 +24806,13 @@ function processCompoundFileStream(input, path3, replacement) {
24793
24806
  continue;
24794
24807
  const nameLength = dvDir.getUint16(p + 64, true);
24795
24808
  if (nameLength < 2 || nameLength > 64 || nameLength % 2)
24796
- return reject();
24809
+ return reject2();
24797
24810
  let name = "";
24798
24811
  for (let i2 = 0; i2 < nameLength - 2; i2 += 2)
24799
24812
  name += String.fromCharCode(dvDir.getUint16(p + i2, true));
24800
24813
  const sizeLow = dvDir.getUint32(p + 120, true), sizeHigh = dvDir.getUint32(p + 124, true);
24801
24814
  if (sizeHigh !== 0 && (replacement || major === 4))
24802
- return reject();
24815
+ return reject2();
24803
24816
  entries.push({
24804
24817
  id,
24805
24818
  name,
@@ -24814,7 +24827,7 @@ function processCompoundFileStream(input, path3, replacement) {
24814
24827
  const byId = new Map(entries.map((e) => [e.id, e]));
24815
24828
  const root = entries.find((e) => e.type === 5);
24816
24829
  if (!root)
24817
- return reject();
24830
+ return reject2();
24818
24831
  let parent = root, target;
24819
24832
  for (let partIndex = 0; partIndex < path3.length; partIndex++) {
24820
24833
  const matches = [], seen = /* @__PURE__ */ new Set();
@@ -24834,22 +24847,22 @@ function processCompoundFileStream(input, path3, replacement) {
24834
24847
  };
24835
24848
  visit(parent.child);
24836
24849
  if (matches.length !== 1)
24837
- return reject();
24850
+ return reject2();
24838
24851
  target = matches[0];
24839
24852
  if (partIndex < path3.length - 1) {
24840
24853
  if (target.type !== 1)
24841
- return reject();
24854
+ return reject2();
24842
24855
  parent = target;
24843
24856
  } else if (target.type !== 2 || replacement && replacement.length !== target.size)
24844
- return reject();
24857
+ return reject2();
24845
24858
  }
24846
24859
  if (!target)
24847
- return reject();
24860
+ return reject2();
24848
24861
  if (!replacement)
24849
24862
  return readTarget(input, target, root, fat, sector, sectorCount, sectorSize, miniSize, read32);
24850
24863
  const names = entries.map((e) => e.name.toLowerCase());
24851
24864
  if (replacement && (names.includes("encryptioninfo") || names.includes("encryptedpackage")))
24852
- return reject();
24865
+ return reject2();
24853
24866
  for (const name of replacement ? ["book", "workbook"] : []) {
24854
24867
  if (!names.includes(name))
24855
24868
  continue;
@@ -24860,7 +24873,7 @@ function processCompoundFileStream(input, path3, replacement) {
24860
24873
  const record2 = workbook[p] | workbook[p + 1] << 8;
24861
24874
  const length = workbook[p + 2] | workbook[p + 3] << 8;
24862
24875
  if (record2 === 47)
24863
- return reject();
24876
+ return reject2();
24864
24877
  if (p + 4 + length > workbook.length || record2 === 10)
24865
24878
  break;
24866
24879
  p += 4 + length;
@@ -24869,13 +24882,13 @@ function processCompoundFileStream(input, path3, replacement) {
24869
24882
  if (replacement && names.includes("worddocument")) {
24870
24883
  const word = readCompoundFileStream(input, ["WordDocument"]);
24871
24884
  if (word && word.length >= 12 && ((word[10] | word[11] << 8) & 256) !== 0)
24872
- return reject();
24885
+ return reject2();
24873
24886
  }
24874
24887
  const miniCutoff = read32(56), miniFatCount = read32(64), miniFatStart = read32(60);
24875
24888
  const miniFatSectors = miniFatCount ? chain(fat, miniFatStart, miniFatCount) : [];
24876
24889
  const metadataSectors = [...fatIds, ...difatIds, ...dirSectors, ...miniFatSectors];
24877
24890
  if (new Set(metadataSectors).size !== metadataSectors.length)
24878
- return reject();
24891
+ return reject2();
24879
24892
  const miniFat = [];
24880
24893
  const miniCapacity = Math.floor(Math.min(root.size, sectorCount * sectorSize) / miniSize);
24881
24894
  for (const id of miniFatSectors) {
@@ -24894,7 +24907,7 @@ function processCompoundFileStream(input, path3, replacement) {
24894
24907
  for (const id of exactChain(fat, entry2.start, entry2.size, sectorSize)) {
24895
24908
  sector(id);
24896
24909
  if (regularUsed.has(id))
24897
- return reject();
24910
+ return reject2();
24898
24911
  regularUsed.add(id);
24899
24912
  }
24900
24913
  }
@@ -24905,7 +24918,7 @@ function processCompoundFileStream(input, path3, replacement) {
24905
24918
  const ids = exactChain(miniFat, entry2.start, entry2.size, miniSize);
24906
24919
  for (const id of ids) {
24907
24920
  if ((id + 1) * miniSize > rootMini.size || miniUsed.has(id))
24908
- return reject();
24921
+ return reject2();
24909
24922
  miniUsed.add(id);
24910
24923
  }
24911
24924
  }
@@ -24939,7 +24952,7 @@ function processCompoundFileStream(input, path3, replacement) {
24939
24952
  output.set(replacement.subarray(i2 * sectorSize, Math.min((i2 + 1) * sectorSize, replacement.length)), offset(sectors[i2]));
24940
24953
  } else {
24941
24954
  if (!miniFat.length)
24942
- return reject();
24955
+ return reject2();
24943
24956
  const miniSectors = exactChain(miniFat, target.start, target.size, miniSize);
24944
24957
  const rootMini2 = entries.find((e) => e.type === 5);
24945
24958
  const rootSectors = exactChain(fat, rootMini2.start, rootMini2.size, sectorSize);
@@ -24949,18 +24962,18 @@ function processCompoundFileStream(input, path3, replacement) {
24949
24962
  for (let i2 = 0; i2 < replacement.length; i2++) {
24950
24963
  const miniOffset = miniSectors[Math.floor(i2 / miniSize)] * miniSize + i2 % miniSize;
24951
24964
  if (miniOffset >= rootData.length)
24952
- return reject();
24965
+ return reject2();
24953
24966
  const rootSectorIndex = Math.floor(miniOffset / sectorSize);
24954
24967
  const rootSector = rootSectors[rootSectorIndex];
24955
24968
  if (rootSector === void 0)
24956
- return reject();
24969
+ return reject2();
24957
24970
  const physical = offset(rootSector) + miniOffset % sectorSize;
24958
24971
  output[physical] = replacement[i2];
24959
24972
  }
24960
24973
  }
24961
24974
  return output;
24962
24975
  } catch {
24963
- return reject();
24976
+ return reject2();
24964
24977
  }
24965
24978
  }
24966
24979
  function readCompoundFileStream(input, path3) {
@@ -24971,7 +24984,7 @@ function replaceCompoundFileStream(input, path3, replacement) {
24971
24984
  }
24972
24985
  var END, MAX, NIL, SIZE;
24973
24986
  var init_ole2_stream_edit = __esm({
24974
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-edit.js"() {
24987
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-edit.js"() {
24975
24988
  END = 4294967294;
24976
24989
  MAX = 4294967290;
24977
24990
  NIL = 4294967295;
@@ -24979,7 +24992,7 @@ var init_ole2_stream_edit = __esm({
24979
24992
  }
24980
24993
  });
24981
24994
 
24982
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-cfb.js
24995
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-cfb.js
24983
24996
  function unwrapXlsBytes(bytes) {
24984
24997
  if (!isCfb(bytes)) {
24985
24998
  return { workbookBytes: bytes };
@@ -25046,7 +25059,7 @@ function isCfb(bytes) {
25046
25059
  }
25047
25060
  var WORKBOOK_STREAM_NAMES;
25048
25061
  var init_legacy_excel_cfb = __esm({
25049
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-cfb.js"() {
25062
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-cfb.js"() {
25050
25063
  init_ole2_parser_read();
25051
25064
  init_ole2_parser_types();
25052
25065
  init_ole2_parser_write();
@@ -25055,7 +25068,1165 @@ var init_legacy_excel_cfb = __esm({
25055
25068
  }
25056
25069
  });
25057
25070
 
25058
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-edit.js
25071
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-record-edit-model.js
25072
+ function reject(reason) {
25073
+ throw new EditError(reason);
25074
+ }
25075
+ function model(bytes) {
25076
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
25077
+ const records = [];
25078
+ const streams2 = /* @__PURE__ */ new Map();
25079
+ let offset = 0, depth = 0, globalsEnd = -1;
25080
+ let top;
25081
+ while (offset < bytes.length) {
25082
+ if (depth === 0 && globalsEnd >= 0 && bytes[offset] === 0 && bytes.subarray(offset).every((b) => b === 0))
25083
+ break;
25084
+ if (offset + 4 > bytes.length)
25085
+ reject("malformed-records");
25086
+ const opcode = view.getUint16(offset, true), length = view.getUint16(offset + 2, true), dataOffset = offset + 4;
25087
+ if (length > 8224 || dataOffset + length > bytes.length)
25088
+ reject("malformed-records");
25089
+ if (opcode === 2057) {
25090
+ if (length < 4 || view.getUint16(dataOffset, true) !== 1536 || depth >= 64)
25091
+ reject("unsupported-workbook");
25092
+ const kind = view.getUint16(dataOffset + 2, true);
25093
+ if (depth === 0) {
25094
+ if (offset === 0 ? kind !== 5 : globalsEnd < 0 || kind === 5)
25095
+ reject("malformed-records");
25096
+ top = { start: offset, kind };
25097
+ }
25098
+ depth++;
25099
+ } else if (opcode === 10) {
25100
+ if (depth === 0 || length !== 0)
25101
+ reject("malformed-records");
25102
+ } else if (depth === 0)
25103
+ reject("malformed-records");
25104
+ records.push({ opcode, length, headerOffset: offset, dataOffset, depth });
25105
+ if (opcode === 10 && --depth === 0) {
25106
+ if (!top)
25107
+ reject("malformed-records");
25108
+ streams2.set(top.start, { ...top, end: dataOffset });
25109
+ if (top.kind === 5)
25110
+ globalsEnd = dataOffset;
25111
+ top = void 0;
25112
+ }
25113
+ offset = dataOffset + length;
25114
+ }
25115
+ if (depth !== 0 || globalsEnd < 0)
25116
+ reject("malformed-records");
25117
+ if (records.some((r) => r.opcode === 47 && r.headerOffset < globalsEnd))
25118
+ reject("unsupported-workbook");
25119
+ const bounds = records.filter((r) => r.opcode === 133 && r.headerOffset < globalsEnd && r.depth === 1);
25120
+ if (bounds.length === 0)
25121
+ reject("malformed-records");
25122
+ const worksheets = [];
25123
+ const used = /* @__PURE__ */ new Set();
25124
+ for (const bound of bounds) {
25125
+ const p = bound.dataOffset;
25126
+ if (bound.length < 8)
25127
+ reject("malformed-records");
25128
+ const chars = view.getUint8(p + 6), wide = Boolean(view.getUint8(p + 7) & 1), kind = view.getUint8(p + 5);
25129
+ if (chars < 1 || chars > 31 || bound.length !== 8 + chars * (wide ? 2 : 1) || (view.getUint8(p + 4) & 3) > 2)
25130
+ reject("malformed-records");
25131
+ const expected = { 0: 16, 1: 64, 2: 32, 6: 6 };
25132
+ const stream = streams2.get(view.getUint32(p, true));
25133
+ if (!stream || stream.kind !== expected[kind] || used.has(stream.start))
25134
+ reject("malformed-records");
25135
+ used.add(stream.start);
25136
+ if (kind === 0)
25137
+ worksheets.push(stream);
25138
+ }
25139
+ if (used.size !== streams2.size - 1)
25140
+ reject("malformed-records");
25141
+ return { records, worksheets, globalsEnd };
25142
+ }
25143
+ function findTarget(bytes, m, edit, allowed = [253, 638, 515, 189]) {
25144
+ const range = m.worksheets[edit.worksheetIndex ?? 0];
25145
+ if (!range)
25146
+ reject("sheet-not-found");
25147
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
25148
+ const targets = [];
25149
+ for (const r of m.records) {
25150
+ if (r.headerOffset < range.start || r.headerOffset >= range.end || r.depth !== 1)
25151
+ continue;
25152
+ const p = r.dataOffset;
25153
+ if ([515, 638, 253, 6, 513, 516, 517, 214].includes(r.opcode)) {
25154
+ if (r.length < 6)
25155
+ reject("malformed-records");
25156
+ if (view.getUint16(p, true) === edit.row && view.getUint16(p + 2, true) === edit.col)
25157
+ targets.push(r);
25158
+ } else if (r.opcode === 189 || r.opcode === 190) {
25159
+ const stride = r.opcode === 189 ? 6 : 2;
25160
+ if (r.length < 6 + stride || (r.length - 6) % stride !== 0)
25161
+ reject("malformed-records");
25162
+ const first2 = view.getUint16(p + 2, true), last = view.getUint16(p + r.length - 2, true);
25163
+ if (last > 255 || last < first2 || last - first2 + 1 !== (r.length - 6) / stride)
25164
+ reject("malformed-records");
25165
+ if (r.opcode === 190 && (first2 > 254 || last <= first2))
25166
+ reject("malformed-records");
25167
+ if (view.getUint16(p, true) === edit.row && edit.col >= first2 && edit.col <= last)
25168
+ targets.push(r);
25169
+ }
25170
+ }
25171
+ if (targets.length > 1)
25172
+ reject("ambiguous-cell");
25173
+ const target = targets[0];
25174
+ if (!target || !allowed.includes(target.opcode))
25175
+ reject("cell-not-supported");
25176
+ if (target.opcode !== 189 && target.opcode !== 190 && target.length !== (target.opcode === 515 ? 14 : target.opcode === 517 ? 8 : target.opcode === 513 ? 6 : 10))
25177
+ reject("malformed-records");
25178
+ for (const record2 of m.records.filter((r) => r.headerOffset >= range.start && r.headerOffset < range.end && r.depth === 1 && [545, 1212, 566].includes(r.opcode))) {
25179
+ if (record2.length < 6)
25180
+ reject("malformed-records");
25181
+ const p = record2.dataOffset;
25182
+ if (edit.row >= view.getUint16(p, true) && edit.row <= view.getUint16(p + 2, true) && edit.col >= view.getUint8(p + 4) && edit.col <= view.getUint8(p + 5))
25183
+ reject("cell-not-supported");
25184
+ }
25185
+ return target;
25186
+ }
25187
+ var EditError;
25188
+ var init_legacy_excel_record_edit_model = __esm({
25189
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-record-edit-model.js"() {
25190
+ EditError = class extends Error {
25191
+ reason;
25192
+ constructor(reason) {
25193
+ super(reason);
25194
+ this.reason = reason;
25195
+ }
25196
+ };
25197
+ }
25198
+ });
25199
+
25200
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-cell-record-splices.js
25201
+ function relocateXlsDbCells(input, out, records, replacement, map) {
25202
+ const source2 = new DataView(input.buffer, input.byteOffset, input.byteLength), dest = new DataView(out.buffer, out.byteOffset, out.byteLength);
25203
+ const byOffset = new Map(records.map((r) => [r.headerOffset, r]));
25204
+ for (const db of records.filter((r) => r.opcode === 215)) {
25205
+ if (db.length < 4 || (db.length - 4) % 2 !== 0 || db.length > 68)
25206
+ throw new Error("Invalid DBCELL size");
25207
+ const back = source2.getUint32(db.dataOffset, true);
25208
+ if (back === 0) {
25209
+ if (db.length !== 4)
25210
+ throw new Error("Unsupported empty DBCELL");
25211
+ continue;
25212
+ }
25213
+ const firstRow = byOffset.get(db.headerOffset - back);
25214
+ if (!firstRow || firstRow.opcode !== 520 || firstRow.length !== 16)
25215
+ throw new Error("Invalid DBCELL row pointer");
25216
+ if (replacement.start < firstRow.headerOffset || replacement.start >= db.headerOffset)
25217
+ continue;
25218
+ const rows = records.filter((r) => r.opcode === 520 && r.headerOffset >= firstRow.headerOffset && r.headerOffset < db.headerOffset);
25219
+ if (rows.length !== (db.length - 4) / 2 || rows.some((r) => r.length !== 16))
25220
+ throw new Error("Unsupported DBCELL row block");
25221
+ let base = firstRow.dataOffset + firstRow.length;
25222
+ const addresses = [];
25223
+ for (let i2 = 0; i2 < rows.length; i2++) {
25224
+ const address = base + source2.getUint16(db.dataOffset + 4 + i2 * 2, true), cell2 = byOffset.get(address);
25225
+ if (!cell2 || !CELL_OPS.has(cell2.opcode) || address >= db.headerOffset || source2.getUint16(cell2.dataOffset, true) !== source2.getUint16(rows[i2].dataOffset, true))
25226
+ throw new Error("Unsupported DBCELL first-cell pointer");
25227
+ addresses.push(address);
25228
+ base = address;
25229
+ }
25230
+ const offset = map(db.headerOffset) - map(firstRow.headerOffset);
25231
+ if (offset < 0 || offset > 4294967295)
25232
+ throw new Error("DBCELL row pointer overflow");
25233
+ dest.setUint32(map(db.dataOffset), offset, true);
25234
+ let newBase = map(firstRow.dataOffset + firstRow.length);
25235
+ for (let i2 = 0; i2 < addresses.length; i2++) {
25236
+ const address = map(addresses[i2]), relative = address - newBase;
25237
+ if (relative < 0 || relative > 65535)
25238
+ throw new Error("DBCELL cell pointer overflow");
25239
+ dest.setUint16(map(db.dataOffset + 4 + i2 * 2), relative, true);
25240
+ newBase = address;
25241
+ }
25242
+ }
25243
+ }
25244
+ var CELL_OPS;
25245
+ var init_legacy_excel_cell_record_splices = __esm({
25246
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-cell-record-splices.js"() {
25247
+ CELL_OPS = /* @__PURE__ */ new Set([6, 513, 515, 516, 517, 638, 253, 189, 190, 214]);
25248
+ }
25249
+ });
25250
+
25251
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-known-records.js
25252
+ var KNOWN_XLS_RECORDS, XLS_FRT_WRAPPER;
25253
+ var init_legacy_excel_known_records = __esm({
25254
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-known-records.js"() {
25255
+ KNOWN_XLS_RECORDS = /* @__PURE__ */ new Set([
25256
+ 6,
25257
+ 10,
25258
+ 12,
25259
+ 13,
25260
+ 14,
25261
+ 15,
25262
+ 16,
25263
+ 17,
25264
+ 18,
25265
+ 19,
25266
+ 20,
25267
+ 21,
25268
+ 23,
25269
+ 24,
25270
+ 25,
25271
+ 26,
25272
+ 27,
25273
+ 28,
25274
+ 29,
25275
+ 34,
25276
+ 35,
25277
+ 38,
25278
+ 39,
25279
+ 40,
25280
+ 41,
25281
+ 42,
25282
+ 43,
25283
+ 47,
25284
+ 49,
25285
+ 51,
25286
+ 60,
25287
+ 61,
25288
+ 64,
25289
+ 65,
25290
+ 66,
25291
+ 77,
25292
+ 80,
25293
+ 81,
25294
+ 82,
25295
+ 85,
25296
+ 89,
25297
+ 90,
25298
+ 91,
25299
+ 92,
25300
+ 93,
25301
+ 94,
25302
+ 95,
25303
+ 96,
25304
+ 97,
25305
+ 99,
25306
+ 125,
25307
+ 128,
25308
+ 129,
25309
+ 130,
25310
+ 131,
25311
+ 132,
25312
+ 133,
25313
+ 134,
25314
+ 140,
25315
+ 141,
25316
+ 144,
25317
+ 146,
25318
+ 151,
25319
+ 152,
25320
+ 153,
25321
+ 154,
25322
+ 155,
25323
+ 156,
25324
+ 157,
25325
+ 158,
25326
+ 160,
25327
+ 161,
25328
+ 174,
25329
+ 175,
25330
+ 176,
25331
+ 177,
25332
+ 178,
25333
+ 180,
25334
+ 181,
25335
+ 182,
25336
+ 184,
25337
+ 185,
25338
+ 189,
25339
+ 190,
25340
+ 193,
25341
+ 197,
25342
+ 198,
25343
+ 199,
25344
+ 200,
25345
+ 201,
25346
+ 202,
25347
+ 203,
25348
+ 204,
25349
+ 205,
25350
+ 206,
25351
+ 207,
25352
+ 208,
25353
+ 209,
25354
+ 210,
25355
+ 211,
25356
+ 213,
25357
+ 215,
25358
+ 216,
25359
+ 217,
25360
+ 218,
25361
+ 220,
25362
+ 221,
25363
+ 222,
25364
+ 224,
25365
+ 225,
25366
+ 226,
25367
+ 227,
25368
+ 229,
25369
+ 233,
25370
+ 235,
25371
+ 236,
25372
+ 237,
25373
+ 239,
25374
+ 240,
25375
+ 241,
25376
+ 242,
25377
+ 244,
25378
+ 245,
25379
+ 246,
25380
+ 247,
25381
+ 248,
25382
+ 249,
25383
+ 251,
25384
+ 252,
25385
+ 253,
25386
+ 255,
25387
+ 256,
25388
+ 259,
25389
+ 290,
25390
+ 311,
25391
+ 312,
25392
+ 315,
25393
+ 317,
25394
+ 318,
25395
+ 319,
25396
+ 320,
25397
+ 330,
25398
+ 331,
25399
+ 333,
25400
+ 334,
25401
+ 335,
25402
+ 336,
25403
+ 337,
25404
+ 338,
25405
+ 339,
25406
+ 340,
25407
+ 351,
25408
+ 352,
25409
+ 353,
25410
+ 401,
25411
+ 402,
25412
+ 403,
25413
+ 404,
25414
+ 405,
25415
+ 406,
25416
+ 407,
25417
+ 408,
25418
+ 425,
25419
+ 426,
25420
+ 427,
25421
+ 428,
25422
+ 429,
25423
+ 430,
25424
+ 431,
25425
+ 432,
25426
+ 433,
25427
+ 434,
25428
+ 437,
25429
+ 438,
25430
+ 439,
25431
+ 440,
25432
+ 441,
25433
+ 442,
25434
+ 443,
25435
+ 444,
25436
+ 445,
25437
+ 446,
25438
+ 448,
25439
+ 449,
25440
+ 450,
25441
+ 512,
25442
+ 513,
25443
+ 515,
25444
+ 516,
25445
+ 517,
25446
+ 519,
25447
+ 520,
25448
+ 523,
25449
+ 545,
25450
+ 549,
25451
+ 566,
25452
+ 574,
25453
+ 638,
25454
+ 659,
25455
+ 1048,
25456
+ 1054,
25457
+ 1084,
25458
+ 1212,
25459
+ 2048,
25460
+ 2049,
25461
+ 2050,
25462
+ 2051,
25463
+ 2052,
25464
+ 2053,
25465
+ 2054,
25466
+ 2055,
25467
+ 2056,
25468
+ 2057,
25469
+ 2058,
25470
+ 2059,
25471
+ 2060,
25472
+ 2061,
25473
+ 2062,
25474
+ 2063,
25475
+ 2064,
25476
+ 2066,
25477
+ 2067,
25478
+ 2128,
25479
+ 2129,
25480
+ 2130,
25481
+ 2131,
25482
+ 2132,
25483
+ 2133,
25484
+ 2134,
25485
+ 2135,
25486
+ 2136,
25487
+ 2137,
25488
+ 2138,
25489
+ 2146,
25490
+ 2147,
25491
+ 2148,
25492
+ 2149,
25493
+ 2150,
25494
+ 2151,
25495
+ 2152,
25496
+ 2154,
25497
+ 2155,
25498
+ 2156,
25499
+ 2161,
25500
+ 2162,
25501
+ 2164,
25502
+ 2165,
25503
+ 2166,
25504
+ 2167,
25505
+ 2168,
25506
+ 2169,
25507
+ 2170,
25508
+ 2171,
25509
+ 2172,
25510
+ 2173,
25511
+ 2174,
25512
+ 2175,
25513
+ 2180,
25514
+ 2181,
25515
+ 2182,
25516
+ 2183,
25517
+ 2184,
25518
+ 2185,
25519
+ 2186,
25520
+ 2187,
25521
+ 2188,
25522
+ 2189,
25523
+ 2190,
25524
+ 2191,
25525
+ 2192,
25526
+ 2194,
25527
+ 2195,
25528
+ 2196,
25529
+ 2197,
25530
+ 2198,
25531
+ 2199,
25532
+ 2200,
25533
+ 2201,
25534
+ 2202,
25535
+ 2203,
25536
+ 2204,
25537
+ 2205,
25538
+ 2206,
25539
+ 2207,
25540
+ 2211,
25541
+ 2212,
25542
+ 2213,
25543
+ 2214,
25544
+ 2215,
25545
+ 4097,
25546
+ 4098,
25547
+ 4099,
25548
+ 4102,
25549
+ 4103,
25550
+ 4105,
25551
+ 4106,
25552
+ 4107,
25553
+ 4108,
25554
+ 4109,
25555
+ 4116,
25556
+ 4117,
25557
+ 4118,
25558
+ 4119,
25559
+ 4120,
25560
+ 4121,
25561
+ 4122,
25562
+ 4123,
25563
+ 4124,
25564
+ 4125,
25565
+ 4126,
25566
+ 4127,
25567
+ 4128,
25568
+ 4129,
25569
+ 4130,
25570
+ 4132,
25571
+ 4133,
25572
+ 4134,
25573
+ 4135,
25574
+ 4146,
25575
+ 4147,
25576
+ 4148,
25577
+ 4149,
25578
+ 4154,
25579
+ 4156,
25580
+ 4157,
25581
+ 4158,
25582
+ 4159,
25583
+ 4160,
25584
+ 4161,
25585
+ 4163,
25586
+ 4164,
25587
+ 4165,
25588
+ 4166,
25589
+ 4168,
25590
+ 4170,
25591
+ 4171,
25592
+ 4174,
25593
+ 4175,
25594
+ 4176,
25595
+ 4177,
25596
+ 4187,
25597
+ 4188,
25598
+ 4189,
25599
+ 4191,
25600
+ 4192,
25601
+ 4193,
25602
+ 4194,
25603
+ 4195,
25604
+ 4196,
25605
+ 4197,
25606
+ 4198,
25607
+ 4199,
25608
+ 4200
25609
+ ]);
25610
+ XLS_FRT_WRAPPER = 2129;
25611
+ }
25612
+ });
25613
+
25614
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-cell-record-replacement.js
25615
+ function applyXlsCellRecordReplacement(input, m, replacement) {
25616
+ if (!Number.isSafeInteger(replacement.start) || !Number.isSafeInteger(replacement.end) || replacement.start < 0 || replacement.end <= replacement.start || replacement.end > input.length || !(replacement.bytes instanceof Uint8Array))
25617
+ reject("malformed-records");
25618
+ const target = m.records.find((r) => r.headerOffset === replacement.start);
25619
+ if (!target || target.dataOffset + target.length !== replacement.end || ![513, 190, 517, 515, 638, 189, 253].includes(target.opcode))
25620
+ reject("malformed-records");
25621
+ const delta2 = replacement.bytes.length - (replacement.end - replacement.start);
25622
+ if (delta2 !== 0 && m.records.some((r) => !KNOWN_XLS_RECORDS.has(r.opcode) || r.opcode === XLS_FRT_WRAPPER))
25623
+ reject("unsupported-pointer-record");
25624
+ const map = (address) => {
25625
+ if (!Number.isSafeInteger(address) || address < 0 || address > input.length || address > replacement.start && address < replacement.end)
25626
+ reject("malformed-records");
25627
+ return address >= replacement.end ? address + delta2 : address;
25628
+ };
25629
+ const out = new Uint8Array(input.length + delta2);
25630
+ out.set(input.subarray(0, replacement.start));
25631
+ out.set(replacement.bytes, replacement.start);
25632
+ out.set(input.subarray(replacement.end), replacement.start + replacement.bytes.length);
25633
+ if (delta2 !== 0) {
25634
+ relocateXlsDbCells(input, out, m.records, replacement, map);
25635
+ const source2 = new DataView(input.buffer, input.byteOffset, input.byteLength), dest = new DataView(out.buffer), byOffset = new Map(m.records.map((r) => [r.headerOffset, r]));
25636
+ for (const r of m.records) {
25637
+ if (r.opcode === 133) {
25638
+ if (r.headerOffset >= m.globalsEnd || r.depth !== 1)
25639
+ reject("malformed-records");
25640
+ dest.setUint32(map(r.dataOffset), map(source2.getUint32(r.dataOffset, true)), true);
25641
+ }
25642
+ if (r.opcode === 523) {
25643
+ if (r.length < 16 || (r.length - 16) % 4 !== 0)
25644
+ reject("malformed-records");
25645
+ const owner = m.worksheets.find((sheet) => r.depth === 1 && r.headerOffset >= sheet.start && r.headerOffset < sheet.end);
25646
+ if (!owner)
25647
+ reject("malformed-records");
25648
+ const pointers = /* @__PURE__ */ new Set();
25649
+ for (let p = r.dataOffset + 12; p < r.dataOffset + r.length; p += 4) {
25650
+ const address = source2.getUint32(p, true);
25651
+ const pointed = byOffset.get(address);
25652
+ if (pointed?.opcode !== (p === r.dataOffset + 12 ? 85 : 215) || pointed.depth !== 1 || address < owner.start || address >= owner.end)
25653
+ reject("malformed-records");
25654
+ if (pointers.has(address))
25655
+ reject("malformed-records");
25656
+ pointers.add(address);
25657
+ dest.setUint32(map(p), map(address), true);
25658
+ }
25659
+ }
25660
+ }
25661
+ }
25662
+ return out;
25663
+ }
25664
+ var init_legacy_excel_cell_record_replacement = __esm({
25665
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-cell-record-replacement.js"() {
25666
+ init_legacy_excel_record_edit_model();
25667
+ init_legacy_excel_cell_record_splices();
25668
+ init_legacy_excel_known_records();
25669
+ }
25670
+ });
25671
+
25672
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-numeric-promotion.js
25673
+ function promote(input, target, col, value) {
25674
+ const source2 = new DataView(input.buffer, input.byteOffset, input.byteLength), p = target.dataOffset;
25675
+ const packed = target.opcode === 189;
25676
+ const first2 = packed ? source2.getUint16(p + 2, true) : col;
25677
+ const count2 = packed ? (target.length - 6) / 6 : 1, selected = col - first2;
25678
+ const record2 = (opcode, data2) => {
25679
+ const out = new Uint8Array(data2.length + 4), view2 = new DataView(out.buffer);
25680
+ view2.setUint16(0, opcode, true);
25681
+ view2.setUint16(2, data2.length, true);
25682
+ out.set(data2, 4);
25683
+ return out;
25684
+ };
25685
+ const group = (start, size) => {
25686
+ if (!size)
25687
+ return new Uint8Array();
25688
+ const data2 = new Uint8Array(size === 1 ? 10 : 6 + size * 6), view2 = new DataView(data2.buffer);
25689
+ view2.setUint16(0, source2.getUint16(p, true), true);
25690
+ view2.setUint16(2, first2 + start, true);
25691
+ data2.set(input.subarray(p + 4 + start * 6, p + 4 + (start + size) * 6), 4);
25692
+ if (size > 1)
25693
+ view2.setUint16(data2.length - 2, first2 + start + size - 1, true);
25694
+ return record2(size === 1 ? 638 : 189, data2);
25695
+ };
25696
+ const data = new Uint8Array(14), view = new DataView(data.buffer);
25697
+ view.setUint16(0, source2.getUint16(p, true), true);
25698
+ view.setUint16(2, col, true);
25699
+ view.setUint16(4, source2.getUint16(p + (packed ? 4 + selected * 6 : 4), true), true);
25700
+ view.setFloat64(6, value, true);
25701
+ const prefix = packed ? group(0, selected) : new Uint8Array(), number2 = record2(515, data);
25702
+ const suffix = packed ? group(selected + 1, count2 - selected - 1) : new Uint8Array();
25703
+ const bytes = new Uint8Array(prefix.length + number2.length + suffix.length);
25704
+ bytes.set(prefix);
25705
+ bytes.set(number2, prefix.length);
25706
+ bytes.set(suffix, prefix.length + number2.length);
25707
+ return bytes;
25708
+ }
25709
+ function promoteXlsNumericCell(input, edit) {
25710
+ const m = model(input), target = findTarget(input, m, edit, [638, 189]);
25711
+ const source2 = new DataView(input.buffer, input.byteOffset, input.byteLength), range = m.worksheets[edit.worksheetIndex ?? 0];
25712
+ for (const record2 of m.records.filter((r) => r.opcode === 229 && r.depth === 1 && r.headerOffset >= range.start && r.headerOffset < range.end)) {
25713
+ if (record2.length < 2 || record2.length !== 2 + source2.getUint16(record2.dataOffset, true) * 8)
25714
+ reject("malformed-records");
25715
+ for (let p = record2.dataOffset + 2; p < record2.dataOffset + record2.length; p += 8) {
25716
+ const firstRow = source2.getUint16(p, true), lastRow = source2.getUint16(p + 2, true), firstCol = source2.getUint16(p + 4, true), lastCol = source2.getUint16(p + 6, true);
25717
+ if (firstRow > lastRow || firstCol > lastCol || lastCol > 255)
25718
+ reject("malformed-records");
25719
+ if (edit.row >= firstRow && edit.row <= lastRow && edit.col >= firstCol && edit.col <= lastCol && (edit.row !== firstRow || edit.col !== firstCol))
25720
+ reject("cell-not-supported");
25721
+ }
25722
+ }
25723
+ return applyXlsCellRecordReplacement(input, m, { start: target.headerOffset, end: target.dataOffset + target.length, bytes: promote(input, target, edit.col, edit.value) });
25724
+ }
25725
+ var init_legacy_excel_numeric_promotion = __esm({
25726
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-numeric-promotion.js"() {
25727
+ init_legacy_excel_record_edit_model();
25728
+ init_legacy_excel_cell_record_replacement();
25729
+ }
25730
+ });
25731
+
25732
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-v4.js
25733
+ function follow(table, start) {
25734
+ const ids = [], seen = /* @__PURE__ */ new Set();
25735
+ for (let id = start; id !== END2; id = table[id]) {
25736
+ if (id >= table.length || seen.has(id))
25737
+ throw new Error("Invalid allocation chain");
25738
+ seen.add(id);
25739
+ ids.push(id);
25740
+ }
25741
+ return ids;
25742
+ }
25743
+ function findSlot(slots, path3) {
25744
+ let parent = slots.get(0);
25745
+ if (!parent || parent.type !== 5)
25746
+ throw new Error("Invalid root");
25747
+ const parents = /* @__PURE__ */ new Set();
25748
+ for (let part = 0; part < path3.length; part++) {
25749
+ if (parents.has(parent.id))
25750
+ throw new Error("Cyclic storage hierarchy");
25751
+ parents.add(parent.id);
25752
+ const stack = [parent.child], seen = /* @__PURE__ */ new Set(), matches = [];
25753
+ while (stack.length) {
25754
+ const id = stack.pop();
25755
+ if (id === FREE)
25756
+ continue;
25757
+ if (seen.has(id))
25758
+ throw new Error("Invalid directory tree");
25759
+ seen.add(id);
25760
+ const slot2 = slots.get(id);
25761
+ if (!slot2)
25762
+ throw new Error("Missing directory slot");
25763
+ if (slot2.name.toLocaleLowerCase() === path3[part].toLocaleLowerCase())
25764
+ matches.push(slot2);
25765
+ stack.push(slot2.left, slot2.right);
25766
+ }
25767
+ if (matches.length !== 1)
25768
+ throw new Error("Missing or ambiguous stream");
25769
+ parent = matches[0];
25770
+ if (parent.type !== (part === path3.length - 1 ? 2 : 1))
25771
+ throw new Error("Invalid storage path");
25772
+ }
25773
+ return parent;
25774
+ }
25775
+ function validateHierarchy(slots) {
25776
+ const owners = /* @__PURE__ */ new Set(), storages = [0];
25777
+ while (storages.length) {
25778
+ const storage = slots.get(storages.pop());
25779
+ const stack = [storage.child], names = /* @__PURE__ */ new Set();
25780
+ while (stack.length) {
25781
+ const id = stack.pop();
25782
+ if (id === FREE)
25783
+ continue;
25784
+ const slot2 = slots.get(id);
25785
+ if (!slot2 || slot2.type !== 1 && slot2.type !== 2 || owners.has(id))
25786
+ throw new Error("Ambiguous directory ownership");
25787
+ const name = slot2.name.toLocaleLowerCase();
25788
+ if (names.has(name))
25789
+ throw new Error("Duplicate sibling name");
25790
+ names.add(name);
25791
+ owners.add(id);
25792
+ stack.push(slot2.left, slot2.right);
25793
+ if (slot2.type === 1)
25794
+ storages.push(id);
25795
+ }
25796
+ }
25797
+ if (owners.size !== slots.size - 1)
25798
+ throw new Error("Unreachable directory entries");
25799
+ }
25800
+ function resizeCompoundFileStreamV4(input, path3, replacement) {
25801
+ const fail2 = (reason) => ({ ok: false, bytes: input, reason });
25802
+ try {
25803
+ if (input.length < 512 || !path3.length || path3.some((part) => !part))
25804
+ return fail2("invalid-or-missing-stream");
25805
+ const view = new DataView(input.buffer, input.byteOffset, input.byteLength);
25806
+ const read = (offset) => view.getUint32(offset, true);
25807
+ const version = view.getUint16(26, true);
25808
+ if (version !== 4)
25809
+ return fail2("unsupported-version");
25810
+ const SECTOR3 = 4096, FAT_ENTRIES2 = SECTOR3 / 4, DIRECTORY_ENTRIES = SECTOR3 / 128;
25811
+ if (read(72) !== 0 || read(44) > 109)
25812
+ return fail2("unsupported-difat");
25813
+ const cutoff = read(56);
25814
+ if (cutoff !== 0 && cutoff !== 4096)
25815
+ return fail2("unsupported-layout");
25816
+ const original = readCompoundFileStream(input, path3);
25817
+ if (!original)
25818
+ return fail2("invalid-or-missing-stream");
25819
+ const name = path3[path3.length - 1].toLocaleLowerCase();
25820
+ if (name === "worddocument" && original.length >= 12 && (original[10] | original[11] << 8) & 33024)
25821
+ return fail2("unsafe-edit");
25822
+ if (name === "book" || name === "workbook") {
25823
+ for (let offset = 0; offset + 4 <= original.length; ) {
25824
+ const record2 = original[offset] | original[offset + 1] << 8;
25825
+ const length = original[offset + 2] | original[offset + 3] << 8;
25826
+ if (record2 === 47)
25827
+ return fail2("unsafe-edit");
25828
+ if (record2 === 10 || offset + 4 + length > original.length)
25829
+ break;
25830
+ offset += 4 + length;
25831
+ }
25832
+ }
25833
+ const validated = replaceCompoundFileStream(input, path3, original);
25834
+ if (validated === input)
25835
+ return fail2("unsafe-edit");
25836
+ const sameLength = replacement.length === original.length;
25837
+ if (!sameLength && original.length < cutoff)
25838
+ return fail2("unsupported-mini-stream");
25839
+ if (!sameLength && replacement.length < cutoff)
25840
+ return fail2("unsupported-mini-transition");
25841
+ const sectorCount = input.length / SECTOR3 - 1, fatCount = read(44);
25842
+ if (sectorCount > fatCount * FAT_ENTRIES2)
25843
+ return fail2("unsafe-edit");
25844
+ const fatIds = Array.from({ length: fatCount }, (_, i2) => read(76 + 4 * i2));
25845
+ const fat = [];
25846
+ for (const id of fatIds) {
25847
+ for (let i2 = 0; i2 < FAT_ENTRIES2 && fat.length < sectorCount; i2++)
25848
+ fat.push(read((id + 1) * SECTOR3 + i2 * 4));
25849
+ }
25850
+ if (fatIds.some((id) => fat[id] !== FAT))
25851
+ return fail2("unsafe-edit");
25852
+ const slots = /* @__PURE__ */ new Map();
25853
+ const directoryChain = follow(fat, read(48));
25854
+ if (read(40) !== directoryChain.length)
25855
+ return fail2("unsafe-edit");
25856
+ for (const [block, sector] of directoryChain.entries()) {
25857
+ for (let entry2 = 0; entry2 < DIRECTORY_ENTRIES; entry2++) {
25858
+ const offset = (sector + 1) * SECTOR3 + entry2 * 128, type = view.getUint8(offset + 66);
25859
+ if (!type)
25860
+ continue;
25861
+ const nameLength = view.getUint16(offset + 64, true);
25862
+ if (![1, 2, 5].includes(type) || nameLength < 2 || nameLength > 64 || nameLength % 2 || view.getUint16(offset + nameLength - 2, true))
25863
+ return fail2("unsafe-edit");
25864
+ let name2 = "";
25865
+ for (let i2 = 0; i2 < nameLength - 2; i2 += 2)
25866
+ name2 += String.fromCharCode(view.getUint16(offset + i2, true));
25867
+ if (read(offset + 124) !== 0)
25868
+ return fail2("unsafe-edit");
25869
+ const id = block * DIRECTORY_ENTRIES + entry2;
25870
+ slots.set(id, { id, name: name2, type, left: read(offset + 68), right: read(offset + 72), child: read(offset + 76), start: read(offset + 116), size: read(offset + 120), offset });
25871
+ }
25872
+ }
25873
+ if ([...slots.values()].filter((slot2) => slot2.type === 5).length !== 1)
25874
+ return fail2("unsafe-edit");
25875
+ const target = findSlot(slots, path3);
25876
+ validateHierarchy(slots);
25877
+ if (sameLength) {
25878
+ const bytes = replaceCompoundFileStream(input, path3, replacement);
25879
+ return bytes === input ? fail2("unsafe-edit") : { ok: true, bytes };
25880
+ }
25881
+ const oldChain = follow(fat, target.start);
25882
+ if (target.size !== original.length || oldChain.length !== Math.ceil(target.size / SECTOR3))
25883
+ return fail2("unsafe-edit");
25884
+ const payloadSectors = Math.ceil(replacement.length / SECTOR3);
25885
+ let newFatCount = fatCount;
25886
+ while (sectorCount + payloadSectors + newFatCount - fatCount > newFatCount * FAT_ENTRIES2)
25887
+ newFatCount++;
25888
+ if (newFatCount > 109)
25889
+ return fail2("allocation-limit");
25890
+ const totalSectors = sectorCount + payloadSectors + newFatCount - fatCount;
25891
+ const output = new Uint8Array((totalSectors + 1) * SECTOR3);
25892
+ output.set(input);
25893
+ output.set(replacement, (sectorCount + 1) * SECTOR3);
25894
+ const outView = new DataView(output.buffer);
25895
+ for (let i2 = fatCount; i2 < newFatCount; i2++) {
25896
+ const id = sectorCount + payloadSectors + i2 - fatCount;
25897
+ fatIds.push(id);
25898
+ output.fill(255, (id + 1) * SECTOR3, (id + 2) * SECTOR3);
25899
+ outView.setUint32(76 + i2 * 4, id, true);
25900
+ }
25901
+ outView.setUint32(44, newFatCount, true);
25902
+ const writeFat = (id, value) => outView.setUint32((fatIds[Math.floor(id / FAT_ENTRIES2)] + 1) * SECTOR3 + id % FAT_ENTRIES2 * 4, value, true);
25903
+ for (const id of oldChain)
25904
+ writeFat(id, FREE);
25905
+ for (let i2 = 0; i2 < payloadSectors; i2++)
25906
+ writeFat(sectorCount + i2, i2 + 1 === payloadSectors ? END2 : sectorCount + i2 + 1);
25907
+ for (const id of fatIds)
25908
+ writeFat(id, FAT);
25909
+ outView.setUint32(target.offset + 116, payloadSectors ? sectorCount : END2, true);
25910
+ outView.setUint32(target.offset + 120, replacement.length, true);
25911
+ return { ok: true, bytes: output };
25912
+ } catch {
25913
+ return fail2("unsafe-edit");
25914
+ }
25915
+ }
25916
+ var END2, FREE, FAT;
25917
+ var init_ole2_stream_resize_v4 = __esm({
25918
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-v4.js"() {
25919
+ init_ole2_stream_edit();
25920
+ END2 = 4294967294;
25921
+ FREE = 4294967295;
25922
+ FAT = 4294967293;
25923
+ }
25924
+ });
25925
+
25926
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-allocation.js
25927
+ function appendCompoundAllocations(input, existingFatIds, payloads, sectorSize = 512) {
25928
+ const sectorCount = input.length / sectorSize - 1;
25929
+ const entriesPerFat = sectorSize / 4;
25930
+ const counts = payloads.map((payload) => Math.ceil(payload.length / sectorSize));
25931
+ const payloadSectors = counts.reduce((sum, count2) => sum + count2, 0);
25932
+ let fatCount = existingFatIds.length;
25933
+ while (sectorCount + payloadSectors + fatCount - existingFatIds.length > fatCount * entriesPerFat)
25934
+ fatCount++;
25935
+ if (fatCount > 109)
25936
+ return void 0;
25937
+ const totalSectors = sectorCount + payloadSectors + fatCount - existingFatIds.length;
25938
+ const bytes = new Uint8Array((totalSectors + 1) * sectorSize);
25939
+ bytes.set(input);
25940
+ const view = new DataView(bytes.buffer), fatIds = [...existingFatIds];
25941
+ for (let i2 = existingFatIds.length; i2 < fatCount; i2++) {
25942
+ const id = sectorCount + payloadSectors + i2 - existingFatIds.length;
25943
+ fatIds.push(id);
25944
+ bytes.fill(255, (id + 1) * sectorSize, (id + 2) * sectorSize);
25945
+ view.setUint32(76 + i2 * 4, id, true);
25946
+ }
25947
+ view.setUint32(44, fatCount, true);
25948
+ const writeFat = (id, value) => view.setUint32((fatIds[Math.floor(id / entriesPerFat)] + 1) * sectorSize + id % entriesPerFat * 4, value, true);
25949
+ const chains = [];
25950
+ let next = sectorCount;
25951
+ for (let payload = 0; payload < payloads.length; payload++) {
25952
+ bytes.set(payloads[payload], (next + 1) * sectorSize);
25953
+ const chain2 = Array.from({ length: counts[payload] }, (_, i2) => next + i2);
25954
+ chain2.forEach((id, i2) => writeFat(id, chain2[i2 + 1] ?? 4294967294));
25955
+ chains.push(chain2);
25956
+ next += counts[payload];
25957
+ }
25958
+ for (const id of fatIds)
25959
+ writeFat(id, 4294967293);
25960
+ return { bytes, view, chains, writeFat };
25961
+ }
25962
+ function followCompoundAllocation(table, start) {
25963
+ const ids = [], seen = /* @__PURE__ */ new Set();
25964
+ for (let id = start; id !== 4294967294; id = table[id]) {
25965
+ if (id >= table.length || seen.has(id))
25966
+ throw new Error("Invalid allocation chain");
25967
+ seen.add(id);
25968
+ ids.push(id);
25969
+ }
25970
+ return ids;
25971
+ }
25972
+ var init_ole2_stream_resize_allocation = __esm({
25973
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-allocation.js"() {
25974
+ }
25975
+ });
25976
+
25977
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-mini.js
25978
+ function resizeMiniCompoundStream(input, fat, fatIds, root, target, replacement, cutoff) {
25979
+ const inputView = new DataView(input.buffer, input.byteOffset, input.byteLength);
25980
+ const miniFatCount = inputView.getUint32(64, true);
25981
+ const miniFatSectors = miniFatCount ? followCompoundAllocation(fat, inputView.getUint32(60, true)) : [];
25982
+ if (miniFatSectors.length !== miniFatCount)
25983
+ throw new Error("Invalid mini FAT count");
25984
+ const rootSectors = root.size ? followCompoundAllocation(fat, root.start) : [];
25985
+ if (rootSectors.length !== Math.ceil(root.size / SECTOR))
25986
+ throw new Error("Invalid root mini stream");
25987
+ const miniCapacity = Math.floor(root.size / MINI), miniFat = [];
25988
+ for (const id of miniFatSectors) {
25989
+ for (let slot2 = 0; slot2 < SECTOR / 4 && miniFat.length < miniCapacity; slot2++)
25990
+ miniFat.push(inputView.getUint32((id + 1) * SECTOR + slot2 * 4, true));
25991
+ }
25992
+ const wasMini = target.size < cutoff;
25993
+ const oldChain = followCompoundAllocation(wasMini ? miniFat : fat, target.start);
25994
+ if (oldChain.length !== Math.ceil(target.size / (wasMini ? MINI : SECTOR)))
25995
+ throw new Error("Invalid stream allocation");
25996
+ if (!replacement.length) {
25997
+ const bytes = input.slice(), view = new DataView(bytes.buffer);
25998
+ for (const id of oldChain) {
25999
+ const table = wasMini ? miniFatSectors : fatIds;
26000
+ view.setUint32((table[Math.floor(id / 128)] + 1) * SECTOR + id % 128 * 4, FREE2, true);
26001
+ }
26002
+ view.setUint32(target.offset + 116, END3, true);
26003
+ view.setUint32(target.offset + 120, 0, true);
26004
+ return bytes;
26005
+ }
26006
+ if (replacement.length >= cutoff) {
26007
+ const output2 = appendCompoundAllocations(input, fatIds, [replacement]);
26008
+ if (!output2)
26009
+ return void 0;
26010
+ for (const id of oldChain)
26011
+ output2.view.setUint32((miniFatSectors[Math.floor(id / 128)] + 1) * SECTOR + id % 128 * 4, FREE2, true);
26012
+ output2.view.setUint32(target.offset + 116, output2.chains[0][0] ?? END3, true);
26013
+ output2.view.setUint32(target.offset + 120, replacement.length, true);
26014
+ return output2.bytes;
26015
+ }
26016
+ const firstMini = Math.ceil(root.size / MINI), count2 = Math.ceil(replacement.length / MINI);
26017
+ const newRootSize = count2 ? (firstMini + count2) * MINI : root.size;
26018
+ const newRoot = new Uint8Array(newRootSize);
26019
+ rootSectors.forEach((id, i2) => newRoot.set(input.subarray((id + 1) * SECTOR, (id + 1) * SECTOR + Math.min(SECTOR, root.size - i2 * SECTOR)), i2 * SECTOR));
26020
+ if (count2)
26021
+ newRoot.set(replacement, firstMini * MINI);
26022
+ const newMiniFatCount = Math.max(miniFatCount, Math.ceil((firstMini + count2) / 128));
26023
+ const newMiniFat = new Uint8Array(newMiniFatCount * SECTOR).fill(255);
26024
+ miniFatSectors.forEach((id, i2) => newMiniFat.set(input.subarray((id + 1) * SECTOR, (id + 2) * SECTOR), i2 * SECTOR));
26025
+ const miniView = new DataView(newMiniFat.buffer);
26026
+ if (wasMini)
26027
+ for (const id of oldChain)
26028
+ miniView.setUint32(id * 4, FREE2, true);
26029
+ for (let i2 = 0; i2 < count2; i2++)
26030
+ miniView.setUint32((firstMini + i2) * 4, i2 + 1 === count2 ? END3 : firstMini + i2 + 1, true);
26031
+ const output = appendCompoundAllocations(input, fatIds, [newRoot, newMiniFat]);
26032
+ if (!output)
26033
+ return void 0;
26034
+ for (const id of [...rootSectors, ...miniFatSectors, ...wasMini ? [] : oldChain])
26035
+ output.writeFat(id, FREE2);
26036
+ output.view.setUint32(root.offset + 116, output.chains[0][0] ?? END3, true);
26037
+ output.view.setUint32(root.offset + 120, newRootSize, true);
26038
+ output.view.setUint32(60, output.chains[1][0] ?? END3, true);
26039
+ output.view.setUint32(64, newMiniFatCount, true);
26040
+ output.view.setUint32(target.offset + 116, count2 ? firstMini : END3, true);
26041
+ output.view.setUint32(target.offset + 120, replacement.length, true);
26042
+ return output.bytes;
26043
+ }
26044
+ var END3, FREE2, SECTOR, MINI;
26045
+ var init_ole2_stream_resize_mini = __esm({
26046
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-mini.js"() {
26047
+ init_ole2_stream_resize_allocation();
26048
+ END3 = 4294967294;
26049
+ FREE2 = 4294967295;
26050
+ SECTOR = 512;
26051
+ MINI = 64;
26052
+ }
26053
+ });
26054
+
26055
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize.js
26056
+ function follow2(table, start) {
26057
+ const ids = [], seen = /* @__PURE__ */ new Set();
26058
+ for (let id = start; id !== END4; id = table[id]) {
26059
+ if (id >= table.length || seen.has(id))
26060
+ throw new Error("Invalid allocation chain");
26061
+ seen.add(id);
26062
+ ids.push(id);
26063
+ }
26064
+ return ids;
26065
+ }
26066
+ function findSlot2(slots, path3) {
26067
+ let parent = slots.get(0);
26068
+ if (!parent || parent.type !== 5)
26069
+ throw new Error("Invalid root");
26070
+ const parents = /* @__PURE__ */ new Set();
26071
+ for (let part = 0; part < path3.length; part++) {
26072
+ if (parents.has(parent.id))
26073
+ throw new Error("Cyclic storage hierarchy");
26074
+ parents.add(parent.id);
26075
+ const stack = [parent.child], seen = /* @__PURE__ */ new Set(), matches = [];
26076
+ while (stack.length) {
26077
+ const id = stack.pop();
26078
+ if (id === FREE3)
26079
+ continue;
26080
+ if (seen.has(id))
26081
+ throw new Error("Invalid directory tree");
26082
+ seen.add(id);
26083
+ const slot2 = slots.get(id);
26084
+ if (!slot2)
26085
+ throw new Error("Missing directory slot");
26086
+ if (slot2.name.toLocaleLowerCase() === path3[part].toLocaleLowerCase())
26087
+ matches.push(slot2);
26088
+ stack.push(slot2.left, slot2.right);
26089
+ }
26090
+ if (matches.length !== 1)
26091
+ throw new Error("Missing or ambiguous stream");
26092
+ parent = matches[0];
26093
+ if (parent.type !== (part === path3.length - 1 ? 2 : 1))
26094
+ throw new Error("Invalid storage path");
26095
+ }
26096
+ return parent;
26097
+ }
26098
+ function validateHierarchy2(slots) {
26099
+ const owners = /* @__PURE__ */ new Set(), storages = [0];
26100
+ while (storages.length) {
26101
+ const storage = slots.get(storages.pop());
26102
+ const stack = [storage.child], names = /* @__PURE__ */ new Set();
26103
+ while (stack.length) {
26104
+ const id = stack.pop();
26105
+ if (id === FREE3)
26106
+ continue;
26107
+ const slot2 = slots.get(id);
26108
+ if (!slot2 || slot2.type !== 1 && slot2.type !== 2 || owners.has(id))
26109
+ throw new Error("Ambiguous directory ownership");
26110
+ const name = slot2.name.toLocaleLowerCase();
26111
+ if (names.has(name))
26112
+ throw new Error("Duplicate sibling name");
26113
+ names.add(name);
26114
+ owners.add(id);
26115
+ stack.push(slot2.left, slot2.right);
26116
+ if (slot2.type === 1)
26117
+ storages.push(id);
26118
+ }
26119
+ }
26120
+ if (owners.size !== slots.size - 1)
26121
+ throw new Error("Unreachable directory entries");
26122
+ }
26123
+ function resizeCompoundFileStream(input, path3, replacement) {
26124
+ if (input.length >= 512 && new DataView(input.buffer, input.byteOffset, input.byteLength).getUint16(26, true) === 4)
26125
+ return resizeCompoundFileStreamV4(input, path3, replacement);
26126
+ const fail2 = (reason) => ({ ok: false, bytes: input, reason });
26127
+ try {
26128
+ if (input.length < SECTOR2 || !path3.length || path3.some((part) => !part))
26129
+ return fail2("invalid-or-missing-stream");
26130
+ const view = new DataView(input.buffer, input.byteOffset, input.byteLength);
26131
+ const read = (offset) => view.getUint32(offset, true);
26132
+ if (view.getUint16(26, true) !== 3)
26133
+ return fail2("unsupported-version");
26134
+ if (read(72) !== 0 || read(44) > 109)
26135
+ return fail2("unsupported-difat");
26136
+ const cutoff = read(56);
26137
+ if (cutoff !== 0 && cutoff !== 4096)
26138
+ return fail2("unsupported-layout");
26139
+ const original = readCompoundFileStream(input, path3);
26140
+ if (!original)
26141
+ return fail2("invalid-or-missing-stream");
26142
+ const name = path3[path3.length - 1].toLocaleLowerCase();
26143
+ if (name === "worddocument" && original.length >= 12 && (original[10] | original[11] << 8) & 33024)
26144
+ return fail2("unsafe-edit");
26145
+ if (name === "book" || name === "workbook") {
26146
+ for (let offset = 0; offset + 4 <= original.length; ) {
26147
+ const record2 = original[offset] | original[offset + 1] << 8;
26148
+ const length = original[offset + 2] | original[offset + 3] << 8;
26149
+ if (record2 === 47)
26150
+ return fail2("unsafe-edit");
26151
+ if (record2 === 10 || offset + 4 + length > original.length)
26152
+ break;
26153
+ offset += 4 + length;
26154
+ }
26155
+ }
26156
+ const validated = replaceCompoundFileStream(input, path3, original);
26157
+ if (validated === input)
26158
+ return fail2("unsafe-edit");
26159
+ const sameLength = replacement.length === original.length;
26160
+ const sectorCount = input.length / SECTOR2 - 1, fatCount = read(44);
26161
+ if (sectorCount > fatCount * FAT_ENTRIES)
26162
+ return fail2("unsafe-edit");
26163
+ const fatIds = Array.from({ length: fatCount }, (_, i2) => read(76 + 4 * i2));
26164
+ const fat = [];
26165
+ for (const id of fatIds) {
26166
+ for (let i2 = 0; i2 < FAT_ENTRIES && fat.length < sectorCount; i2++)
26167
+ fat.push(read((id + 1) * SECTOR2 + i2 * 4));
26168
+ }
26169
+ if (fatIds.some((id) => fat[id] !== FAT2))
26170
+ return fail2("unsafe-edit");
26171
+ const slots = /* @__PURE__ */ new Map();
26172
+ for (const [block, sector] of follow2(fat, read(48)).entries()) {
26173
+ for (let entry2 = 0; entry2 < 4; entry2++) {
26174
+ const offset = (sector + 1) * SECTOR2 + entry2 * 128, type = view.getUint8(offset + 66);
26175
+ if (!type)
26176
+ continue;
26177
+ const nameLength = view.getUint16(offset + 64, true);
26178
+ if (![1, 2, 5].includes(type) || nameLength < 2 || nameLength > 64 || nameLength % 2 || view.getUint16(offset + nameLength - 2, true))
26179
+ return fail2("unsafe-edit");
26180
+ let name2 = "";
26181
+ for (let i2 = 0; i2 < nameLength - 2; i2 += 2)
26182
+ name2 += String.fromCharCode(view.getUint16(offset + i2, true));
26183
+ const id = block * 4 + entry2;
26184
+ slots.set(id, { id, name: name2, type, left: read(offset + 68), right: read(offset + 72), child: read(offset + 76), start: read(offset + 116), size: read(offset + 120), offset });
26185
+ }
26186
+ }
26187
+ if ([...slots.values()].filter((slot2) => slot2.type === 5).length !== 1)
26188
+ return fail2("unsafe-edit");
26189
+ const target = findSlot2(slots, path3);
26190
+ validateHierarchy2(slots);
26191
+ if (sameLength) {
26192
+ const bytes = replaceCompoundFileStream(input, path3, replacement);
26193
+ return bytes === input ? fail2("unsafe-edit") : { ok: true, bytes };
26194
+ }
26195
+ if (original.length < cutoff || replacement.length < cutoff) {
26196
+ const bytes = resizeMiniCompoundStream(input, fat, fatIds, slots.get(0), target, replacement, cutoff);
26197
+ return bytes ? { ok: true, bytes } : fail2("allocation-limit");
26198
+ }
26199
+ const oldChain = follow2(fat, target.start);
26200
+ if (target.size !== original.length || oldChain.length !== Math.ceil(target.size / SECTOR2))
26201
+ return fail2("unsafe-edit");
26202
+ const output = appendCompoundAllocations(input, fatIds, [replacement]);
26203
+ if (!output)
26204
+ return fail2("allocation-limit");
26205
+ for (const id of oldChain)
26206
+ output.writeFat(id, FREE3);
26207
+ output.view.setUint32(target.offset + 116, output.chains[0][0] ?? END4, true);
26208
+ output.view.setUint32(target.offset + 120, replacement.length, true);
26209
+ return { ok: true, bytes: output.bytes };
26210
+ } catch {
26211
+ return fail2("unsafe-edit");
26212
+ }
26213
+ }
26214
+ var END4, FREE3, FAT2, SECTOR2, FAT_ENTRIES;
26215
+ var init_ole2_stream_resize = __esm({
26216
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize.js"() {
26217
+ init_ole2_stream_edit();
26218
+ init_ole2_stream_resize_v4();
26219
+ init_ole2_stream_resize_allocation();
26220
+ init_ole2_stream_resize_mini();
26221
+ END4 = 4294967294;
26222
+ FREE3 = 4294967295;
26223
+ FAT2 = 4294967293;
26224
+ SECTOR2 = 512;
26225
+ FAT_ENTRIES = SECTOR2 / 4;
26226
+ }
26227
+ });
26228
+
26229
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-edit.js
25059
26230
  function encodeRkExact(value) {
25060
26231
  if (!Number.isFinite(value))
25061
26232
  return void 0;
@@ -25132,6 +26303,7 @@ function worksheetRanges(bytes) {
25132
26303
  }
25133
26304
  function editXlsNumericCell(input, edit) {
25134
26305
  const unchanged2 = (reason) => ({ status: "unchanged", bytes: input, reason });
26306
+ edit = { row: edit.row, col: edit.col, value: edit.value, worksheetIndex: edit.worksheetIndex };
25135
26307
  const sheet = edit.worksheetIndex ?? 0;
25136
26308
  if (!Number.isInteger(edit.row) || edit.row < 0 || edit.row > 65535 || !Number.isInteger(edit.col) || edit.col < 0 || edit.col > 255 || !Number.isInteger(sheet) || sheet < 0 || !Number.isFinite(edit.value))
25137
26309
  return unchanged2("invalid-edit");
@@ -25203,8 +26375,18 @@ function editXlsNumericCell(input, edit) {
25203
26375
  if (payload === void 0)
25204
26376
  return unchanged2("cell-not-supported");
25205
26377
  const rk = packed ? encodeRkExact(edit.value) : void 0;
25206
- if (packed && rk === void 0)
25207
- return unchanged2("inexact-rk");
26378
+ if (packed && rk === void 0) {
26379
+ if (!readRecords(bytes, 0, bytes.length).some((r) => r.opcode === 133))
26380
+ return unchanged2("inexact-rk");
26381
+ const promoted = promoteXlsNumericCell(bytes, edit);
26382
+ if (!rewrap)
26383
+ return { status: "edited", bytes: promoted, recalculationRequired: true };
26384
+ const names = ["Workbook", "Book"].filter((name) => readCompoundFileStream(input, [name]) !== void 0);
26385
+ if (names.length !== 1)
26386
+ return unchanged2("unsupported-workbook");
26387
+ const resized = resizeCompoundFileStream(input, [names[0]], promoted);
26388
+ return resized.ok ? { status: "edited", bytes: resized.bytes, recalculationRequired: true } : unchanged2("container-not-writable");
26389
+ }
25208
26390
  const out = bytes.slice();
25209
26391
  const outView = new DataView(out.buffer, out.byteOffset, out.byteLength);
25210
26392
  if (packed)
@@ -25215,18 +26397,22 @@ function editXlsNumericCell(input, edit) {
25215
26397
  if (result === input)
25216
26398
  return unchanged2("container-not-writable");
25217
26399
  return { status: "edited", bytes: result, recalculationRequired: true };
25218
- } catch {
25219
- return unchanged2("malformed-records");
26400
+ } catch (error) {
26401
+ return unchanged2(error instanceof EditError ? error.reason : "malformed-records");
25220
26402
  }
25221
26403
  }
25222
26404
  var init_legacy_excel_biff8_edit = __esm({
25223
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-edit.js"() {
26405
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-edit.js"() {
25224
26406
  init_legacy_excel_biff8();
25225
26407
  init_legacy_excel_cfb();
26408
+ init_legacy_excel_numeric_promotion();
26409
+ init_legacy_excel_record_edit_model();
26410
+ init_ole2_stream_resize();
26411
+ init_ole2_stream_edit();
25226
26412
  }
25227
26413
  });
25228
26414
 
25229
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8.js
26415
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8.js
25230
26416
  function readRecords(bytes, start, end) {
25231
26417
  const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
25232
26418
  const records = [];
@@ -25397,7 +26583,7 @@ function writeOleXlsNumericCellEdit(inputBytes, edit) {
25397
26583
  }
25398
26584
  var OPCODE_BOF, OPCODE_EOF, OPCODE_FILEPASS, OPCODE_NUMBER, OPCODE_RK, OPCODE_LABELSST, OPCODE_LABEL, OPCODE_SST, OPCODE_EXTSST, OPCODE_ROW, OPCODE_DBCELL, OPCODE_DIMENSIONS, OPCODE_BLANK, OPCODE_BOUNDSHEET, WORKSHEET_DT, DEFAULT_MAX_ROWS2, DEFAULT_MAX_COLS2;
25399
26585
  var init_legacy_excel_biff8 = __esm({
25400
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8.js"() {
26586
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8.js"() {
25401
26587
  init_legacy_excel_biff8_edit();
25402
26588
  init_legacy_excel_cfb();
25403
26589
  OPCODE_BOF = 2057;
@@ -25427,7 +26613,7 @@ var init_ole_sheet_xls_biff8 = __esm({
25427
26613
  }
25428
26614
  });
25429
26615
 
25430
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-grid.js
26616
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-grid.js
25431
26617
  function biffRecord(opcode, data) {
25432
26618
  return [
25433
26619
  opcode & 255,
@@ -25552,12 +26738,12 @@ function buildXlsRowCellRegion(grid) {
25552
26738
  return Uint8Array.from(bytesOut);
25553
26739
  }
25554
26740
  var init_legacy_excel_biff8_grid = __esm({
25555
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-grid.js"() {
26741
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-grid.js"() {
25556
26742
  init_legacy_excel_biff8();
25557
26743
  }
25558
26744
  });
25559
26745
 
25560
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-writer.js
26746
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-writer.js
25561
26747
  function resolveSstIndex(sharedStrings, value, bytes) {
25562
26748
  const existing = sharedStrings.indexOf(value);
25563
26749
  if (existing !== -1)
@@ -25719,7 +26905,7 @@ function writeOleXlsStringCellEdit(inputBytes, edit) {
25719
26905
  }
25720
26906
  }
25721
26907
  var init_legacy_excel_biff8_writer = __esm({
25722
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-writer.js"() {
26908
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-writer.js"() {
25723
26909
  init_legacy_excel_biff8();
25724
26910
  init_legacy_excel_biff8_grid();
25725
26911
  init_legacy_excel_cfb();
@@ -25826,7 +27012,7 @@ var init_ole_document_docx_editor = __esm({
25826
27012
  }
25827
27013
  });
25828
27014
 
25829
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fib.js
27015
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fib.js
25830
27016
  function readDocFib(wordDoc) {
25831
27017
  const view = new DataView(wordDoc.buffer, wordDoc.byteOffset, wordDoc.byteLength);
25832
27018
  const wIdent = view.getUint16(0, true);
@@ -25916,7 +27102,7 @@ function patchDocFib(wordDoc, fib, patch) {
25916
27102
  }
25917
27103
  var FC_LCB_INDEX, F_COMPLEX_BIT;
25918
27104
  var init_ole_document_doc_fib = __esm({
25919
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fib.js"() {
27105
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fib.js"() {
25920
27106
  FC_LCB_INDEX = {
25921
27107
  plcfbteChpx: 12,
25922
27108
  plcfbtePapx: 13,
@@ -25927,504 +27113,7 @@ var init_ole_document_doc_fib = __esm({
25927
27113
  }
25928
27114
  });
25929
27115
 
25930
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-v4.js
25931
- function follow(table, start) {
25932
- const ids = [], seen = /* @__PURE__ */ new Set();
25933
- for (let id = start; id !== END2; id = table[id]) {
25934
- if (id >= table.length || seen.has(id))
25935
- throw new Error("Invalid allocation chain");
25936
- seen.add(id);
25937
- ids.push(id);
25938
- }
25939
- return ids;
25940
- }
25941
- function findSlot(slots, path3) {
25942
- let parent = slots.get(0);
25943
- if (!parent || parent.type !== 5)
25944
- throw new Error("Invalid root");
25945
- const parents = /* @__PURE__ */ new Set();
25946
- for (let part = 0; part < path3.length; part++) {
25947
- if (parents.has(parent.id))
25948
- throw new Error("Cyclic storage hierarchy");
25949
- parents.add(parent.id);
25950
- const stack = [parent.child], seen = /* @__PURE__ */ new Set(), matches = [];
25951
- while (stack.length) {
25952
- const id = stack.pop();
25953
- if (id === FREE)
25954
- continue;
25955
- if (seen.has(id))
25956
- throw new Error("Invalid directory tree");
25957
- seen.add(id);
25958
- const slot2 = slots.get(id);
25959
- if (!slot2)
25960
- throw new Error("Missing directory slot");
25961
- if (slot2.name.toLocaleLowerCase() === path3[part].toLocaleLowerCase())
25962
- matches.push(slot2);
25963
- stack.push(slot2.left, slot2.right);
25964
- }
25965
- if (matches.length !== 1)
25966
- throw new Error("Missing or ambiguous stream");
25967
- parent = matches[0];
25968
- if (parent.type !== (part === path3.length - 1 ? 2 : 1))
25969
- throw new Error("Invalid storage path");
25970
- }
25971
- return parent;
25972
- }
25973
- function validateHierarchy(slots) {
25974
- const owners = /* @__PURE__ */ new Set(), storages = [0];
25975
- while (storages.length) {
25976
- const storage = slots.get(storages.pop());
25977
- const stack = [storage.child], names = /* @__PURE__ */ new Set();
25978
- while (stack.length) {
25979
- const id = stack.pop();
25980
- if (id === FREE)
25981
- continue;
25982
- const slot2 = slots.get(id);
25983
- if (!slot2 || slot2.type !== 1 && slot2.type !== 2 || owners.has(id))
25984
- throw new Error("Ambiguous directory ownership");
25985
- const name = slot2.name.toLocaleLowerCase();
25986
- if (names.has(name))
25987
- throw new Error("Duplicate sibling name");
25988
- names.add(name);
25989
- owners.add(id);
25990
- stack.push(slot2.left, slot2.right);
25991
- if (slot2.type === 1)
25992
- storages.push(id);
25993
- }
25994
- }
25995
- if (owners.size !== slots.size - 1)
25996
- throw new Error("Unreachable directory entries");
25997
- }
25998
- function resizeCompoundFileStreamV4(input, path3, replacement) {
25999
- const fail2 = (reason) => ({ ok: false, bytes: input, reason });
26000
- try {
26001
- if (input.length < 512 || !path3.length || path3.some((part) => !part))
26002
- return fail2("invalid-or-missing-stream");
26003
- const view = new DataView(input.buffer, input.byteOffset, input.byteLength);
26004
- const read = (offset) => view.getUint32(offset, true);
26005
- const version = view.getUint16(26, true);
26006
- if (version !== 4)
26007
- return fail2("unsupported-version");
26008
- const SECTOR3 = 4096, FAT_ENTRIES2 = SECTOR3 / 4, DIRECTORY_ENTRIES = SECTOR3 / 128;
26009
- if (read(72) !== 0 || read(44) > 109)
26010
- return fail2("unsupported-difat");
26011
- const cutoff = read(56);
26012
- if (cutoff !== 0 && cutoff !== 4096)
26013
- return fail2("unsupported-layout");
26014
- const original = readCompoundFileStream(input, path3);
26015
- if (!original)
26016
- return fail2("invalid-or-missing-stream");
26017
- const name = path3[path3.length - 1].toLocaleLowerCase();
26018
- if (name === "worddocument" && original.length >= 12 && (original[10] | original[11] << 8) & 33024)
26019
- return fail2("unsafe-edit");
26020
- if (name === "book" || name === "workbook") {
26021
- for (let offset = 0; offset + 4 <= original.length; ) {
26022
- const record2 = original[offset] | original[offset + 1] << 8;
26023
- const length = original[offset + 2] | original[offset + 3] << 8;
26024
- if (record2 === 47)
26025
- return fail2("unsafe-edit");
26026
- if (record2 === 10 || offset + 4 + length > original.length)
26027
- break;
26028
- offset += 4 + length;
26029
- }
26030
- }
26031
- const validated = replaceCompoundFileStream(input, path3, original);
26032
- if (validated === input)
26033
- return fail2("unsafe-edit");
26034
- const sameLength = replacement.length === original.length;
26035
- if (!sameLength && original.length < cutoff)
26036
- return fail2("unsupported-mini-stream");
26037
- if (!sameLength && replacement.length < cutoff)
26038
- return fail2("unsupported-mini-transition");
26039
- const sectorCount = input.length / SECTOR3 - 1, fatCount = read(44);
26040
- if (sectorCount > fatCount * FAT_ENTRIES2)
26041
- return fail2("unsafe-edit");
26042
- const fatIds = Array.from({ length: fatCount }, (_, i2) => read(76 + 4 * i2));
26043
- const fat = [];
26044
- for (const id of fatIds) {
26045
- for (let i2 = 0; i2 < FAT_ENTRIES2 && fat.length < sectorCount; i2++)
26046
- fat.push(read((id + 1) * SECTOR3 + i2 * 4));
26047
- }
26048
- if (fatIds.some((id) => fat[id] !== FAT))
26049
- return fail2("unsafe-edit");
26050
- const slots = /* @__PURE__ */ new Map();
26051
- const directoryChain = follow(fat, read(48));
26052
- if (read(40) !== directoryChain.length)
26053
- return fail2("unsafe-edit");
26054
- for (const [block, sector] of directoryChain.entries()) {
26055
- for (let entry2 = 0; entry2 < DIRECTORY_ENTRIES; entry2++) {
26056
- const offset = (sector + 1) * SECTOR3 + entry2 * 128, type = view.getUint8(offset + 66);
26057
- if (!type)
26058
- continue;
26059
- const nameLength = view.getUint16(offset + 64, true);
26060
- if (![1, 2, 5].includes(type) || nameLength < 2 || nameLength > 64 || nameLength % 2 || view.getUint16(offset + nameLength - 2, true))
26061
- return fail2("unsafe-edit");
26062
- let name2 = "";
26063
- for (let i2 = 0; i2 < nameLength - 2; i2 += 2)
26064
- name2 += String.fromCharCode(view.getUint16(offset + i2, true));
26065
- if (read(offset + 124) !== 0)
26066
- return fail2("unsafe-edit");
26067
- const id = block * DIRECTORY_ENTRIES + entry2;
26068
- slots.set(id, { id, name: name2, type, left: read(offset + 68), right: read(offset + 72), child: read(offset + 76), start: read(offset + 116), size: read(offset + 120), offset });
26069
- }
26070
- }
26071
- if ([...slots.values()].filter((slot2) => slot2.type === 5).length !== 1)
26072
- return fail2("unsafe-edit");
26073
- const target = findSlot(slots, path3);
26074
- validateHierarchy(slots);
26075
- if (sameLength) {
26076
- const bytes = replaceCompoundFileStream(input, path3, replacement);
26077
- return bytes === input ? fail2("unsafe-edit") : { ok: true, bytes };
26078
- }
26079
- const oldChain = follow(fat, target.start);
26080
- if (target.size !== original.length || oldChain.length !== Math.ceil(target.size / SECTOR3))
26081
- return fail2("unsafe-edit");
26082
- const payloadSectors = Math.ceil(replacement.length / SECTOR3);
26083
- let newFatCount = fatCount;
26084
- while (sectorCount + payloadSectors + newFatCount - fatCount > newFatCount * FAT_ENTRIES2)
26085
- newFatCount++;
26086
- if (newFatCount > 109)
26087
- return fail2("allocation-limit");
26088
- const totalSectors = sectorCount + payloadSectors + newFatCount - fatCount;
26089
- const output = new Uint8Array((totalSectors + 1) * SECTOR3);
26090
- output.set(input);
26091
- output.set(replacement, (sectorCount + 1) * SECTOR3);
26092
- const outView = new DataView(output.buffer);
26093
- for (let i2 = fatCount; i2 < newFatCount; i2++) {
26094
- const id = sectorCount + payloadSectors + i2 - fatCount;
26095
- fatIds.push(id);
26096
- output.fill(255, (id + 1) * SECTOR3, (id + 2) * SECTOR3);
26097
- outView.setUint32(76 + i2 * 4, id, true);
26098
- }
26099
- outView.setUint32(44, newFatCount, true);
26100
- const writeFat = (id, value) => outView.setUint32((fatIds[Math.floor(id / FAT_ENTRIES2)] + 1) * SECTOR3 + id % FAT_ENTRIES2 * 4, value, true);
26101
- for (const id of oldChain)
26102
- writeFat(id, FREE);
26103
- for (let i2 = 0; i2 < payloadSectors; i2++)
26104
- writeFat(sectorCount + i2, i2 + 1 === payloadSectors ? END2 : sectorCount + i2 + 1);
26105
- for (const id of fatIds)
26106
- writeFat(id, FAT);
26107
- outView.setUint32(target.offset + 116, payloadSectors ? sectorCount : END2, true);
26108
- outView.setUint32(target.offset + 120, replacement.length, true);
26109
- return { ok: true, bytes: output };
26110
- } catch {
26111
- return fail2("unsafe-edit");
26112
- }
26113
- }
26114
- var END2, FREE, FAT;
26115
- var init_ole2_stream_resize_v4 = __esm({
26116
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-v4.js"() {
26117
- init_ole2_stream_edit();
26118
- END2 = 4294967294;
26119
- FREE = 4294967295;
26120
- FAT = 4294967293;
26121
- }
26122
- });
26123
-
26124
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-allocation.js
26125
- function appendCompoundAllocations(input, existingFatIds, payloads, sectorSize = 512) {
26126
- const sectorCount = input.length / sectorSize - 1;
26127
- const entriesPerFat = sectorSize / 4;
26128
- const counts = payloads.map((payload) => Math.ceil(payload.length / sectorSize));
26129
- const payloadSectors = counts.reduce((sum, count2) => sum + count2, 0);
26130
- let fatCount = existingFatIds.length;
26131
- while (sectorCount + payloadSectors + fatCount - existingFatIds.length > fatCount * entriesPerFat)
26132
- fatCount++;
26133
- if (fatCount > 109)
26134
- return void 0;
26135
- const totalSectors = sectorCount + payloadSectors + fatCount - existingFatIds.length;
26136
- const bytes = new Uint8Array((totalSectors + 1) * sectorSize);
26137
- bytes.set(input);
26138
- const view = new DataView(bytes.buffer), fatIds = [...existingFatIds];
26139
- for (let i2 = existingFatIds.length; i2 < fatCount; i2++) {
26140
- const id = sectorCount + payloadSectors + i2 - existingFatIds.length;
26141
- fatIds.push(id);
26142
- bytes.fill(255, (id + 1) * sectorSize, (id + 2) * sectorSize);
26143
- view.setUint32(76 + i2 * 4, id, true);
26144
- }
26145
- view.setUint32(44, fatCount, true);
26146
- const writeFat = (id, value) => view.setUint32((fatIds[Math.floor(id / entriesPerFat)] + 1) * sectorSize + id % entriesPerFat * 4, value, true);
26147
- const chains = [];
26148
- let next = sectorCount;
26149
- for (let payload = 0; payload < payloads.length; payload++) {
26150
- bytes.set(payloads[payload], (next + 1) * sectorSize);
26151
- const chain2 = Array.from({ length: counts[payload] }, (_, i2) => next + i2);
26152
- chain2.forEach((id, i2) => writeFat(id, chain2[i2 + 1] ?? 4294967294));
26153
- chains.push(chain2);
26154
- next += counts[payload];
26155
- }
26156
- for (const id of fatIds)
26157
- writeFat(id, 4294967293);
26158
- return { bytes, view, chains, writeFat };
26159
- }
26160
- function followCompoundAllocation(table, start) {
26161
- const ids = [], seen = /* @__PURE__ */ new Set();
26162
- for (let id = start; id !== 4294967294; id = table[id]) {
26163
- if (id >= table.length || seen.has(id))
26164
- throw new Error("Invalid allocation chain");
26165
- seen.add(id);
26166
- ids.push(id);
26167
- }
26168
- return ids;
26169
- }
26170
- var init_ole2_stream_resize_allocation = __esm({
26171
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-allocation.js"() {
26172
- }
26173
- });
26174
-
26175
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-mini.js
26176
- function resizeMiniCompoundStream(input, fat, fatIds, root, target, replacement, cutoff) {
26177
- const inputView = new DataView(input.buffer, input.byteOffset, input.byteLength);
26178
- const miniFatCount = inputView.getUint32(64, true);
26179
- const miniFatSectors = miniFatCount ? followCompoundAllocation(fat, inputView.getUint32(60, true)) : [];
26180
- if (miniFatSectors.length !== miniFatCount)
26181
- throw new Error("Invalid mini FAT count");
26182
- const rootSectors = root.size ? followCompoundAllocation(fat, root.start) : [];
26183
- if (rootSectors.length !== Math.ceil(root.size / SECTOR))
26184
- throw new Error("Invalid root mini stream");
26185
- const miniCapacity = Math.floor(root.size / MINI), miniFat = [];
26186
- for (const id of miniFatSectors) {
26187
- for (let slot2 = 0; slot2 < SECTOR / 4 && miniFat.length < miniCapacity; slot2++)
26188
- miniFat.push(inputView.getUint32((id + 1) * SECTOR + slot2 * 4, true));
26189
- }
26190
- const wasMini = target.size < cutoff;
26191
- const oldChain = followCompoundAllocation(wasMini ? miniFat : fat, target.start);
26192
- if (oldChain.length !== Math.ceil(target.size / (wasMini ? MINI : SECTOR)))
26193
- throw new Error("Invalid stream allocation");
26194
- if (!replacement.length) {
26195
- const bytes = input.slice(), view = new DataView(bytes.buffer);
26196
- for (const id of oldChain) {
26197
- const table = wasMini ? miniFatSectors : fatIds;
26198
- view.setUint32((table[Math.floor(id / 128)] + 1) * SECTOR + id % 128 * 4, FREE2, true);
26199
- }
26200
- view.setUint32(target.offset + 116, END3, true);
26201
- view.setUint32(target.offset + 120, 0, true);
26202
- return bytes;
26203
- }
26204
- if (replacement.length >= cutoff) {
26205
- const output2 = appendCompoundAllocations(input, fatIds, [replacement]);
26206
- if (!output2)
26207
- return void 0;
26208
- for (const id of oldChain)
26209
- output2.view.setUint32((miniFatSectors[Math.floor(id / 128)] + 1) * SECTOR + id % 128 * 4, FREE2, true);
26210
- output2.view.setUint32(target.offset + 116, output2.chains[0][0] ?? END3, true);
26211
- output2.view.setUint32(target.offset + 120, replacement.length, true);
26212
- return output2.bytes;
26213
- }
26214
- const firstMini = Math.ceil(root.size / MINI), count2 = Math.ceil(replacement.length / MINI);
26215
- const newRootSize = count2 ? (firstMini + count2) * MINI : root.size;
26216
- const newRoot = new Uint8Array(newRootSize);
26217
- rootSectors.forEach((id, i2) => newRoot.set(input.subarray((id + 1) * SECTOR, (id + 1) * SECTOR + Math.min(SECTOR, root.size - i2 * SECTOR)), i2 * SECTOR));
26218
- if (count2)
26219
- newRoot.set(replacement, firstMini * MINI);
26220
- const newMiniFatCount = Math.max(miniFatCount, Math.ceil((firstMini + count2) / 128));
26221
- const newMiniFat = new Uint8Array(newMiniFatCount * SECTOR).fill(255);
26222
- miniFatSectors.forEach((id, i2) => newMiniFat.set(input.subarray((id + 1) * SECTOR, (id + 2) * SECTOR), i2 * SECTOR));
26223
- const miniView = new DataView(newMiniFat.buffer);
26224
- if (wasMini)
26225
- for (const id of oldChain)
26226
- miniView.setUint32(id * 4, FREE2, true);
26227
- for (let i2 = 0; i2 < count2; i2++)
26228
- miniView.setUint32((firstMini + i2) * 4, i2 + 1 === count2 ? END3 : firstMini + i2 + 1, true);
26229
- const output = appendCompoundAllocations(input, fatIds, [newRoot, newMiniFat]);
26230
- if (!output)
26231
- return void 0;
26232
- for (const id of [...rootSectors, ...miniFatSectors, ...wasMini ? [] : oldChain])
26233
- output.writeFat(id, FREE2);
26234
- output.view.setUint32(root.offset + 116, output.chains[0][0] ?? END3, true);
26235
- output.view.setUint32(root.offset + 120, newRootSize, true);
26236
- output.view.setUint32(60, output.chains[1][0] ?? END3, true);
26237
- output.view.setUint32(64, newMiniFatCount, true);
26238
- output.view.setUint32(target.offset + 116, count2 ? firstMini : END3, true);
26239
- output.view.setUint32(target.offset + 120, replacement.length, true);
26240
- return output.bytes;
26241
- }
26242
- var END3, FREE2, SECTOR, MINI;
26243
- var init_ole2_stream_resize_mini = __esm({
26244
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-mini.js"() {
26245
- init_ole2_stream_resize_allocation();
26246
- END3 = 4294967294;
26247
- FREE2 = 4294967295;
26248
- SECTOR = 512;
26249
- MINI = 64;
26250
- }
26251
- });
26252
-
26253
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize.js
26254
- function follow2(table, start) {
26255
- const ids = [], seen = /* @__PURE__ */ new Set();
26256
- for (let id = start; id !== END4; id = table[id]) {
26257
- if (id >= table.length || seen.has(id))
26258
- throw new Error("Invalid allocation chain");
26259
- seen.add(id);
26260
- ids.push(id);
26261
- }
26262
- return ids;
26263
- }
26264
- function findSlot2(slots, path3) {
26265
- let parent = slots.get(0);
26266
- if (!parent || parent.type !== 5)
26267
- throw new Error("Invalid root");
26268
- const parents = /* @__PURE__ */ new Set();
26269
- for (let part = 0; part < path3.length; part++) {
26270
- if (parents.has(parent.id))
26271
- throw new Error("Cyclic storage hierarchy");
26272
- parents.add(parent.id);
26273
- const stack = [parent.child], seen = /* @__PURE__ */ new Set(), matches = [];
26274
- while (stack.length) {
26275
- const id = stack.pop();
26276
- if (id === FREE3)
26277
- continue;
26278
- if (seen.has(id))
26279
- throw new Error("Invalid directory tree");
26280
- seen.add(id);
26281
- const slot2 = slots.get(id);
26282
- if (!slot2)
26283
- throw new Error("Missing directory slot");
26284
- if (slot2.name.toLocaleLowerCase() === path3[part].toLocaleLowerCase())
26285
- matches.push(slot2);
26286
- stack.push(slot2.left, slot2.right);
26287
- }
26288
- if (matches.length !== 1)
26289
- throw new Error("Missing or ambiguous stream");
26290
- parent = matches[0];
26291
- if (parent.type !== (part === path3.length - 1 ? 2 : 1))
26292
- throw new Error("Invalid storage path");
26293
- }
26294
- return parent;
26295
- }
26296
- function validateHierarchy2(slots) {
26297
- const owners = /* @__PURE__ */ new Set(), storages = [0];
26298
- while (storages.length) {
26299
- const storage = slots.get(storages.pop());
26300
- const stack = [storage.child], names = /* @__PURE__ */ new Set();
26301
- while (stack.length) {
26302
- const id = stack.pop();
26303
- if (id === FREE3)
26304
- continue;
26305
- const slot2 = slots.get(id);
26306
- if (!slot2 || slot2.type !== 1 && slot2.type !== 2 || owners.has(id))
26307
- throw new Error("Ambiguous directory ownership");
26308
- const name = slot2.name.toLocaleLowerCase();
26309
- if (names.has(name))
26310
- throw new Error("Duplicate sibling name");
26311
- names.add(name);
26312
- owners.add(id);
26313
- stack.push(slot2.left, slot2.right);
26314
- if (slot2.type === 1)
26315
- storages.push(id);
26316
- }
26317
- }
26318
- if (owners.size !== slots.size - 1)
26319
- throw new Error("Unreachable directory entries");
26320
- }
26321
- function resizeCompoundFileStream(input, path3, replacement) {
26322
- if (input.length >= 512 && new DataView(input.buffer, input.byteOffset, input.byteLength).getUint16(26, true) === 4)
26323
- return resizeCompoundFileStreamV4(input, path3, replacement);
26324
- const fail2 = (reason) => ({ ok: false, bytes: input, reason });
26325
- try {
26326
- if (input.length < SECTOR2 || !path3.length || path3.some((part) => !part))
26327
- return fail2("invalid-or-missing-stream");
26328
- const view = new DataView(input.buffer, input.byteOffset, input.byteLength);
26329
- const read = (offset) => view.getUint32(offset, true);
26330
- if (view.getUint16(26, true) !== 3)
26331
- return fail2("unsupported-version");
26332
- if (read(72) !== 0 || read(44) > 109)
26333
- return fail2("unsupported-difat");
26334
- const cutoff = read(56);
26335
- if (cutoff !== 0 && cutoff !== 4096)
26336
- return fail2("unsupported-layout");
26337
- const original = readCompoundFileStream(input, path3);
26338
- if (!original)
26339
- return fail2("invalid-or-missing-stream");
26340
- const name = path3[path3.length - 1].toLocaleLowerCase();
26341
- if (name === "worddocument" && original.length >= 12 && (original[10] | original[11] << 8) & 33024)
26342
- return fail2("unsafe-edit");
26343
- if (name === "book" || name === "workbook") {
26344
- for (let offset = 0; offset + 4 <= original.length; ) {
26345
- const record2 = original[offset] | original[offset + 1] << 8;
26346
- const length = original[offset + 2] | original[offset + 3] << 8;
26347
- if (record2 === 47)
26348
- return fail2("unsafe-edit");
26349
- if (record2 === 10 || offset + 4 + length > original.length)
26350
- break;
26351
- offset += 4 + length;
26352
- }
26353
- }
26354
- const validated = replaceCompoundFileStream(input, path3, original);
26355
- if (validated === input)
26356
- return fail2("unsafe-edit");
26357
- const sameLength = replacement.length === original.length;
26358
- const sectorCount = input.length / SECTOR2 - 1, fatCount = read(44);
26359
- if (sectorCount > fatCount * FAT_ENTRIES)
26360
- return fail2("unsafe-edit");
26361
- const fatIds = Array.from({ length: fatCount }, (_, i2) => read(76 + 4 * i2));
26362
- const fat = [];
26363
- for (const id of fatIds) {
26364
- for (let i2 = 0; i2 < FAT_ENTRIES && fat.length < sectorCount; i2++)
26365
- fat.push(read((id + 1) * SECTOR2 + i2 * 4));
26366
- }
26367
- if (fatIds.some((id) => fat[id] !== FAT2))
26368
- return fail2("unsafe-edit");
26369
- const slots = /* @__PURE__ */ new Map();
26370
- for (const [block, sector] of follow2(fat, read(48)).entries()) {
26371
- for (let entry2 = 0; entry2 < 4; entry2++) {
26372
- const offset = (sector + 1) * SECTOR2 + entry2 * 128, type = view.getUint8(offset + 66);
26373
- if (!type)
26374
- continue;
26375
- const nameLength = view.getUint16(offset + 64, true);
26376
- if (![1, 2, 5].includes(type) || nameLength < 2 || nameLength > 64 || nameLength % 2 || view.getUint16(offset + nameLength - 2, true))
26377
- return fail2("unsafe-edit");
26378
- let name2 = "";
26379
- for (let i2 = 0; i2 < nameLength - 2; i2 += 2)
26380
- name2 += String.fromCharCode(view.getUint16(offset + i2, true));
26381
- const id = block * 4 + entry2;
26382
- slots.set(id, { id, name: name2, type, left: read(offset + 68), right: read(offset + 72), child: read(offset + 76), start: read(offset + 116), size: read(offset + 120), offset });
26383
- }
26384
- }
26385
- if ([...slots.values()].filter((slot2) => slot2.type === 5).length !== 1)
26386
- return fail2("unsafe-edit");
26387
- const target = findSlot2(slots, path3);
26388
- validateHierarchy2(slots);
26389
- if (sameLength) {
26390
- const bytes = replaceCompoundFileStream(input, path3, replacement);
26391
- return bytes === input ? fail2("unsafe-edit") : { ok: true, bytes };
26392
- }
26393
- if (original.length < cutoff || replacement.length < cutoff) {
26394
- const bytes = resizeMiniCompoundStream(input, fat, fatIds, slots.get(0), target, replacement, cutoff);
26395
- return bytes ? { ok: true, bytes } : fail2("allocation-limit");
26396
- }
26397
- const oldChain = follow2(fat, target.start);
26398
- if (target.size !== original.length || oldChain.length !== Math.ceil(target.size / SECTOR2))
26399
- return fail2("unsafe-edit");
26400
- const output = appendCompoundAllocations(input, fatIds, [replacement]);
26401
- if (!output)
26402
- return fail2("allocation-limit");
26403
- for (const id of oldChain)
26404
- output.writeFat(id, FREE3);
26405
- output.view.setUint32(target.offset + 116, output.chains[0][0] ?? END4, true);
26406
- output.view.setUint32(target.offset + 120, replacement.length, true);
26407
- return { ok: true, bytes: output.bytes };
26408
- } catch {
26409
- return fail2("unsafe-edit");
26410
- }
26411
- }
26412
- var END4, FREE3, FAT2, SECTOR2, FAT_ENTRIES;
26413
- var init_ole2_stream_resize = __esm({
26414
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize.js"() {
26415
- init_ole2_stream_edit();
26416
- init_ole2_stream_resize_v4();
26417
- init_ole2_stream_resize_allocation();
26418
- init_ole2_stream_resize_mini();
26419
- END4 = 4294967294;
26420
- FREE3 = 4294967295;
26421
- FAT2 = 4294967293;
26422
- SECTOR2 = 512;
26423
- FAT_ENTRIES = SECTOR2 / 4;
26424
- }
26425
- });
26426
-
26427
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cfb.js
27116
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cfb.js
26428
27117
  function unwrapDocBytes(bytes) {
26429
27118
  if (bytes.length < 8 || bytes[0] !== 208 || bytes[1] !== 207 || bytes[2] !== 17 || bytes[3] !== 224 || bytes[4] !== 161 || bytes[5] !== 177 || bytes[6] !== 26 || bytes[7] !== 225) {
26430
27119
  return void 0;
@@ -26474,7 +27163,7 @@ function unwrapDocBytes(bytes) {
26474
27163
  }
26475
27164
  var DocCfbRewriteError;
26476
27165
  var init_ole_document_doc_cfb = __esm({
26477
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cfb.js"() {
27166
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cfb.js"() {
26478
27167
  init_ole_document_doc_fib();
26479
27168
  init_ole2_stream_edit();
26480
27169
  init_ole2_stream_resize();
@@ -26487,7 +27176,7 @@ var init_ole_document_doc_cfb = __esm({
26487
27176
  }
26488
27177
  });
26489
27178
 
26490
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fkp.js
27179
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fkp.js
26491
27180
  function parseBteTable(tableStream, at2) {
26492
27181
  const view = new DataView(tableStream.buffer, tableStream.byteOffset, tableStream.byteLength);
26493
27182
  if (!Number.isInteger(at2.fc) || !Number.isInteger(at2.lcb) || at2.fc < 0 || at2.lcb < 4 || (at2.lcb - 4) % 8 !== 0 || at2.fc > tableStream.length - at2.lcb)
@@ -26628,12 +27317,12 @@ function buildSingleRunChpxPage(fcStart, fcEnd, blob) {
26628
27317
  }
26629
27318
  var PAGE_SIZE;
26630
27319
  var init_ole_document_doc_fkp = __esm({
26631
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fkp.js"() {
27320
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fkp.js"() {
26632
27321
  PAGE_SIZE = 512;
26633
27322
  }
26634
27323
  });
26635
27324
 
26636
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cp1252.js
27325
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cp1252.js
26637
27326
  function decodeCp1252Byte(byte) {
26638
27327
  if (byte >= 128 && byte <= 159) {
26639
27328
  return CP1252_HIGH_BLOCK[byte - 128];
@@ -26667,7 +27356,7 @@ function encodeCp1252(text2) {
26667
27356
  }
26668
27357
  var CP1252_HIGH_BLOCK, CP1252_HIGH_BLOCK_REVERSE;
26669
27358
  var init_ole_document_doc_cp1252 = __esm({
26670
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cp1252.js"() {
27359
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cp1252.js"() {
26671
27360
  CP1252_HIGH_BLOCK = [
26672
27361
  8364,
26673
27362
  129,
@@ -26706,7 +27395,7 @@ var init_ole_document_doc_cp1252 = __esm({
26706
27395
  }
26707
27396
  });
26708
27397
 
26709
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-pieces.js
27398
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-pieces.js
26710
27399
  function parseDocClx(tableStream, clx, maxPieces) {
26711
27400
  if (maxPieces !== void 0 && (!Number.isSafeInteger(maxPieces) || maxPieces < 0))
26712
27401
  throw new Error("Invalid DOC piece limit");
@@ -26911,7 +27600,7 @@ function buildClxBytes(pieces, prcBytes = new Uint8Array()) {
26911
27600
  }
26912
27601
  var CLXT_PRC, CLXT_PCDT, DocResourceLimitError;
26913
27602
  var init_ole_document_doc_pieces = __esm({
26914
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-pieces.js"() {
27603
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-pieces.js"() {
26915
27604
  init_ole_document_doc_cp1252();
26916
27605
  CLXT_PRC = 1;
26917
27606
  CLXT_PCDT = 2;
@@ -26924,7 +27613,7 @@ var init_ole_document_doc_pieces = __esm({
26924
27613
  }
26925
27614
  });
26926
27615
 
26927
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fields.js
27616
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fields.js
26928
27617
  function checkFieldRanges(markers, editStart, editEnd, maxDepth2) {
26929
27618
  const stack = [];
26930
27619
  for (const { cp, ch } of markers) {
@@ -27003,7 +27692,7 @@ function shiftDocMainFieldCps(table, at2, body, editStart, editEnd, delta2, maxF
27003
27692
  }
27004
27693
  var UnsupportedDocFieldEditError;
27005
27694
  var init_ole_document_doc_fields = __esm({
27006
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fields.js"() {
27695
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fields.js"() {
27007
27696
  init_ole_document_doc_pieces();
27008
27697
  UnsupportedDocFieldEditError = class extends Error {
27009
27698
  constructor(message) {
@@ -27014,7 +27703,7 @@ var init_ole_document_doc_fields = __esm({
27014
27703
  }
27015
27704
  });
27016
27705
 
27017
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-editor.js
27706
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-editor.js
27018
27707
  function processingLimits(limits) {
27019
27708
  const resolved = {
27020
27709
  maxCharacters: limits?.maxCharacters ?? DEFAULT_OLE_DOC_PROCESSING_LIMITS.maxCharacters,
@@ -27074,6 +27763,42 @@ function encodePieceTextUtf16(text2) {
27074
27763
  view.setUint16(i2 * 2, text2.charCodeAt(i2), true);
27075
27764
  return bytes;
27076
27765
  }
27766
+ function protectedWordRanges(word, table, fib) {
27767
+ const view = new DataView(word.buffer, word.byteOffset, word.byteLength);
27768
+ const extension = fib.fibRgFcLcbOffset + fib.fibRgFcLcbCount * 8;
27769
+ const fibEnd = extension + 2 + view.getUint16(extension, true) * 2;
27770
+ const pages = /* @__PURE__ */ new Set();
27771
+ for (const at2 of [fib.plcfbteChpx, fib.plcfbtePapx]) {
27772
+ if (at2.lcb > 65536 * 8 + 4)
27773
+ throw new DocResourceLimitError("DOC formatting page count exceeds the processing limit");
27774
+ for (const pn of parseBteTable(table, at2).pns) {
27775
+ const start = (pn & 4194303) * 512;
27776
+ if (start > word.length - 512)
27777
+ throw new Error("Formatting page outside WordDocument");
27778
+ pages.add(start);
27779
+ }
27780
+ }
27781
+ const ranges = [[0, fibEnd]];
27782
+ for (const start of [...pages].sort((a, b) => a - b)) {
27783
+ const last = ranges.at(-1);
27784
+ if (start <= last[1])
27785
+ ranges[ranges.length - 1] = [last[0], Math.max(last[1], start + 512)];
27786
+ else
27787
+ ranges.push([start, start + 512]);
27788
+ }
27789
+ return ranges;
27790
+ }
27791
+ function overlapsWordStructure(ranges, start, end) {
27792
+ let low = 0, high = ranges.length;
27793
+ while (low < high) {
27794
+ const middle = low + Math.floor((high - low) / 2);
27795
+ if (ranges[middle][1] <= start)
27796
+ low = middle + 1;
27797
+ else
27798
+ high = middle;
27799
+ }
27800
+ return low < ranges.length && ranges[low][0] < end;
27801
+ }
27077
27802
  function readOleDocParagraphs(docBytes, limits) {
27078
27803
  try {
27079
27804
  const budget = processingLimits(limits);
@@ -27105,11 +27830,19 @@ function readOleDocParagraphs(docBytes, limits) {
27105
27830
  return void 0;
27106
27831
  }
27107
27832
  }
27108
- function shiftSectionTableCps(tableBytes, sed, editEndCp, delta2) {
27833
+ function shiftSectionTableCps(tableBytes, sed, editEndCp, delta2, storyLength) {
27109
27834
  const view = new DataView(tableBytes.buffer, tableBytes.byteOffset, tableBytes.byteLength);
27110
27835
  if (sed.lcb < 4 || (sed.lcb - 4) % 16 !== 0 || sed.fc > tableBytes.length - sed.lcb)
27111
27836
  throw new Error("Invalid section table");
27112
27837
  const n = (sed.lcb - 4) / 16;
27838
+ let previous = -1;
27839
+ for (let i2 = 0; i2 <= n; i2++) {
27840
+ const cp = view.getInt32(sed.fc + i2 * 4, true);
27841
+ const shifted = cp >= editEndCp ? cp + delta2 : cp;
27842
+ if (cp < 0 || cp > storyLength + 1 || cp < previous || shifted < 0 || shifted > 2147483647 || shifted > storyLength + delta2 + 1)
27843
+ throw new Error("Invalid section table character positions");
27844
+ previous = cp;
27845
+ }
27113
27846
  for (let i2 = 0; i2 <= n; i2++) {
27114
27847
  const off = sed.fc + i2 * 4;
27115
27848
  const cp = view.getInt32(off, true);
@@ -27162,8 +27895,11 @@ function tryWriteOleDocParagraphEdit(docBytes, paragraphIndex, text2, limits) {
27162
27895
  const sanitizedText = text2.replaceAll(/[\r\n]+/gu, " ");
27163
27896
  if (fib.ccpText - (paragraphEndCp - paragraphStartCp) + sanitizedText.length + 1 > budget.maxCharacters)
27164
27897
  return rejected("resource-limit");
27898
+ const mainFields = readFcLcbAt(cfb.wordDocBytes, fib, 16);
27899
+ shiftDocMainFieldCps(cfb.tableBytes, mainFields, bodyText, paragraphStartCp, paragraphEndCp, 0, budget.maxFieldRecords);
27165
27900
  if (sanitizedText.length + 1 === paragraphEndCp - paragraphStartCp && bodyText[paragraphEndCp - 1] === "\r") {
27166
27901
  const replacement = `${sanitizedText}\r`;
27902
+ const protectedRanges = protectedWordRanges(cfb.wordDocBytes, cfb.tableBytes, fib);
27167
27903
  const patched = cfb.wordDocBytes.slice();
27168
27904
  let canPatch = true;
27169
27905
  for (const piece of pieces) {
@@ -27175,6 +27911,8 @@ function tryWriteOleDocParagraphEdit(docBytes, paragraphIndex, text2, limits) {
27175
27911
  const unit = piece.compressed ? 1 : 2;
27176
27912
  const fc = piece.fc + (start - piece.cpStart) * unit;
27177
27913
  const fcEnd = fc + part.length * unit;
27914
+ if (overlapsWordStructure(protectedRanges, fc, fcEnd))
27915
+ return rejected("invalid-document");
27178
27916
  if (pieces.some((other) => other !== piece && other.fc < fcEnd && other.fc + (other.cpEnd - other.cpStart) * (other.compressed ? 1 : 2) > fc)) {
27179
27917
  canPatch = false;
27180
27918
  break;
@@ -27194,13 +27932,14 @@ function tryWriteOleDocParagraphEdit(docBytes, paragraphIndex, text2, limits) {
27194
27932
  if (hasUnsupportedFeatures(cfb.wordDocBytes, fib))
27195
27933
  return rejected("unsupported-features");
27196
27934
  const delta2 = sanitizedText.length + 1 - (paragraphEndCp - paragraphStartCp);
27197
- const mainFields = readFcLcbAt(cfb.wordDocBytes, fib, 16);
27198
- if (mainFields.lcb > 0) {
27935
+ for (const [targetIndex, target] of [[16, mainFields], [6, fib.sed]]) {
27936
+ if (target.lcb === 0)
27937
+ continue;
27199
27938
  for (let index = 0; index < fib.fibRgFcLcbCount; index++) {
27200
- if (index === 16 || index === 87)
27939
+ if (index === targetIndex || index === 87)
27201
27940
  continue;
27202
27941
  const other = readFcLcbAt(cfb.wordDocBytes, fib, index);
27203
- if (other.lcb > 0 && other.fc < mainFields.fc + mainFields.lcb && other.fc + other.lcb > mainFields.fc)
27942
+ if (other.lcb > 0 && other.fc < target.fc + target.lcb && other.fc + other.lcb > target.fc)
27204
27943
  return rejected("invalid-document");
27205
27944
  }
27206
27945
  }
@@ -27262,7 +28001,7 @@ function tryWriteOleDocParagraphEdit(docBytes, paragraphIndex, text2, limits) {
27262
28001
  tableOff += papxBteBytes.length;
27263
28002
  const newChpxBteFcLcb = { fc: tableOff, lcb: chpxBteBytes.length };
27264
28003
  newTableBytes.set(chpxBteBytes, tableOff);
27265
- shiftSectionTableCps(newTableBytes, fib.sed, paragraphEndCp, delta2);
28004
+ shiftSectionTableCps(newTableBytes, fib.sed, paragraphEndCp, delta2, fib.ccpText);
27266
28005
  patchDocFib(newWordDoc, fib, {
27267
28006
  ccpText: newCcpText,
27268
28007
  cbMac: newWordDocLen,
@@ -27283,7 +28022,7 @@ function tryWriteOleDocParagraphEdit(docBytes, paragraphIndex, text2, limits) {
27283
28022
  }
27284
28023
  var RISKY_PLCF_INDICES, RISKY_STTB_INDICES, SAFE_EXTENDED_FC_LCB_INDICES, DEFAULT_OLE_DOC_PROCESSING_LIMITS;
27285
28024
  var init_ole_document_doc_editor = __esm({
27286
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-editor.js"() {
28025
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ole-document-doc-editor.js"() {
27287
28026
  init_ole_document_doc_cfb();
27288
28027
  init_ole_document_doc_fib();
27289
28028
  init_ole_document_doc_fkp();
@@ -27387,7 +28126,7 @@ var init_ole_nested_deck_editor = __esm({
27387
28126
  }
27388
28127
  });
27389
28128
 
27390
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js
28129
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js
27391
28130
  function crc32(bytes) {
27392
28131
  let crc = 4294967295;
27393
28132
  for (let i2 = 0; i2 < bytes.length; i2++) {
@@ -27497,7 +28236,7 @@ function decodePngDimensions(png2) {
27497
28236
  }
27498
28237
  var CRC_TABLE, PNG_SIGNATURE;
27499
28238
  var init_png_encoder = __esm({
27500
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js"() {
28239
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js"() {
27501
28240
  CRC_TABLE = (() => {
27502
28241
  const table = new Uint32Array(256);
27503
28242
  for (let n = 0; n < 256; n++) {
@@ -33263,8 +34002,8 @@ function runSmartArtEngine(data, layoutXml3, width, height, context) {
33263
34002
  if (!def) {
33264
34003
  return void 0;
33265
34004
  }
33266
- const model = buildDataModel(data.nodes, data.connections);
33267
- const tree = buildPresentationTree(def, model.doc, {
34005
+ const model2 = buildDataModel(data.nodes, data.connections);
34006
+ const tree = buildPresentationTree(def, model2.doc, {
33268
34007
  direction: data.presLayoutVars?.direction === "rev" ? "rev" : void 0
33269
34008
  });
33270
34009
  if (!tree) {
@@ -51929,7 +52668,7 @@ function remapFill(fill3, id) {
51929
52668
  }
51930
52669
  return { ...fill3, relId: id, sourceXml: buildXml(node) };
51931
52670
  }
51932
- function captureDiagramPictures(model, dataXml2, dataParts, drawing) {
52671
+ function captureDiagramPictures(model2, dataXml2, dataParts, drawing) {
51933
52672
  const pictures = [];
51934
52673
  const parts = { ...dataParts };
51935
52674
  const add8 = (source2, owner) => {
@@ -51954,7 +52693,7 @@ function captureDiagramPictures(model, dataXml2, dataParts, drawing) {
51954
52693
  for (const element2 of saved) {
51955
52694
  const nodeId = element2.getAttribute("nodeId");
51956
52695
  const fill3 = first(element2, "blipFill", NS.a);
51957
- if (nodeId && fill3 && model.nodes.some((node) => node.modelId === nodeId))
52696
+ if (nodeId && fill3 && model2.nodes.some((node) => node.modelId === nodeId))
51958
52697
  add8(
51959
52698
  {
51960
52699
  nodeId,
@@ -51965,10 +52704,10 @@ function captureDiagramPictures(model, dataXml2, dataParts, drawing) {
51965
52704
  dataParts
51966
52705
  );
51967
52706
  }
51968
- for (const point2 of model.points) {
52707
+ for (const point2 of model2.points) {
51969
52708
  if (point2.fill?.kind !== "picture") continue;
51970
52709
  const nodeId = point2.type === "pres" ? point2.presAssocId : point2.modelId;
51971
- if (nodeId && model.nodes.some((node) => node.modelId === nodeId) && !pictures.some((item2) => item2.nodeId === nodeId))
52710
+ if (nodeId && model2.nodes.some((node) => node.modelId === nodeId) && !pictures.some((item2) => item2.nodeId === nodeId))
51972
52711
  add8(
51973
52712
  {
51974
52713
  nodeId,
@@ -51981,14 +52720,14 @@ function captureDiagramPictures(model, dataXml2, dataParts, drawing) {
51981
52720
  }
51982
52721
  for (const shape2 of drawing?.shapes ?? []) {
51983
52722
  if (shape2.fill?.kind !== "picture") continue;
51984
- const point2 = model.points.find((point3) => point3.modelId === shape2.modelId);
52723
+ const point2 = model2.points.find((point3) => point3.modelId === shape2.modelId);
51985
52724
  const nodeId = shape2.sourceNodeId ?? (point2?.type === "pres" ? point2.presAssocId : point2?.modelId);
51986
52725
  const part = shape2.fill.relId ? drawing?.pictureParts?.[shape2.fill.relId] : void 0;
51987
52726
  if (saved.length && pictures.some(
51988
52727
  (item2) => item2.nodeId === nodeId && item2.fill.relId && parts[item2.fill.relId] === part && item2.role !== point2?.presName && item2.styleLabel !== point2?.presStyleLabel
51989
52728
  ))
51990
52729
  continue;
51991
- if (nodeId && model.nodes.some((node) => node.modelId === nodeId))
52730
+ if (nodeId && model2.nodes.some((node) => node.modelId === nodeId))
51992
52731
  add8(
51993
52732
  {
51994
52733
  nodeId,
@@ -52398,10 +53137,10 @@ function add(parent, namespace, name, attrs4 = {}) {
52398
53137
  }
52399
53138
  function withDiagramDrawingRelationship(xml, relationshipId2) {
52400
53139
  const doc = parseXml(xml);
52401
- const model = doc.documentElement;
52402
- let extension = descendants2(model, "dataModelExt").find((node) => node.namespaceURI === DSP2);
53140
+ const model2 = doc.documentElement;
53141
+ let extension = descendants2(model2, "dataModelExt").find((node) => node.namespaceURI === DSP2);
52403
53142
  if (!extension) {
52404
- const extLst = first(model, "extLst", NS.dgm) ?? add(model, NS.dgm, "dgm:extLst");
53143
+ const extLst = first(model2, "extLst", NS.dgm) ?? add(model2, NS.dgm, "dgm:extLst");
52405
53144
  extension = add(add(extLst, NS.a, "a:ext", { uri: DSP2 }), DSP2, "dsp:dataModelExt", {
52406
53145
  minVer: NS.dgm
52407
53146
  });
@@ -52412,13 +53151,13 @@ function withDiagramDrawingRelationship(xml, relationshipId2) {
52412
53151
  function buildGeneratedDiagramCache(dataXml2, input) {
52413
53152
  dataXml2 = withDiagramPictureSources(dataXml2, input.source);
52414
53153
  const source2 = { ...input.source, dataXml: dataXml2 };
52415
- const model = parseDiagramDataModel(dataXml2);
53154
+ const model2 = parseDiagramDataModel(dataXml2);
52416
53155
  const scheme2 = { ...DEFAULT_GENERATED_DIAGRAM_SCHEME, ...input.scheme };
52417
53156
  const preview = previewDiagramLayout({
52418
53157
  ...input,
52419
53158
  source: source2,
52420
53159
  scheme: scheme2,
52421
- nodes: diagramNodesInTreeOrder(model)
53160
+ nodes: diagramNodesInTreeOrder(model2)
52422
53161
  });
52423
53162
  if (preview.mode !== "interpreted" || preview.issues.length || !preview.drawing?.shapes.length)
52424
53163
  return void 0;
@@ -52450,7 +53189,7 @@ function buildGeneratedDiagramCache(dataXml2, input) {
52450
53189
  const point2 = children2(points7, "pt", NS.dgm).find(
52451
53190
  (point3) => point3.getAttribute("modelId") === shape2.sourceNodeId
52452
53191
  );
52453
- const direct = model.nodes.find((node) => node.modelId === shape2.sourceNodeId);
53192
+ const direct = model2.nodes.find((node) => node.modelId === shape2.sourceNodeId);
52454
53193
  const fillIndex = shape2.style?.fill?.index;
52455
53194
  const template = fillIndex ? input.formatScheme?.fillStyles[fillIndex - 1]?.fill : void 0;
52456
53195
  if (!direct?.fill && shape2.fill?.kind === "solid" && shape2.fill.color.kind === "srgb" && (!template || template.kind === "solid" && template.color.kind === "scheme" && template.color.value === "phClr")) {
@@ -54512,7 +55251,7 @@ var init_encryption_detection = __esm({
54512
55251
  }
54513
55252
  });
54514
55253
 
54515
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/utils/ooxml-crypto-primitives.js
55254
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/ooxml-crypto-primitives.js
54516
55255
  function getSubtle() {
54517
55256
  if (typeof globalThis.crypto !== "undefined" && globalThis.crypto.subtle) {
54518
55257
  return globalThis.crypto.subtle;
@@ -54630,7 +55369,7 @@ async function hmac(algorithm, key2, data) {
54630
55369
  return new Uint8Array(result);
54631
55370
  }
54632
55371
  var init_ooxml_crypto_primitives = __esm({
54633
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/utils/ooxml-crypto-primitives.js"() {
55372
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/ooxml-crypto-primitives.js"() {
54634
55373
  }
54635
55374
  });
54636
55375
 
@@ -69523,6 +70262,130 @@ var init_custom_show_utils = __esm({
69523
70262
  }
69524
70263
  });
69525
70264
 
70265
+ // pptx/core/utils/custom-show-actions.ts
70266
+ function isUnsignedInt(id) {
70267
+ return /^\d+$/.test(id) && Number(id) <= UNSIGNED_INT_MAX;
70268
+ }
70269
+ function normalizeCustomShowIds(shows) {
70270
+ const used = /* @__PURE__ */ new Set();
70271
+ let max = -1;
70272
+ for (const show of shows) {
70273
+ if (isUnsignedInt(show.id) && !used.has(show.id)) {
70274
+ used.add(show.id);
70275
+ max = Math.max(max, Number(show.id));
70276
+ }
70277
+ }
70278
+ const kept = /* @__PURE__ */ new Set();
70279
+ const idMap = /* @__PURE__ */ new Map();
70280
+ const next = shows.map((show) => {
70281
+ if (isUnsignedInt(show.id) && !kept.has(show.id)) {
70282
+ kept.add(show.id);
70283
+ return show;
70284
+ }
70285
+ const id = String(++max);
70286
+ if (!idMap.has(show.id)) {
70287
+ idMap.set(show.id, id);
70288
+ }
70289
+ return { ...show, id };
70290
+ });
70291
+ return {
70292
+ shows: idMap.size > 0 || next.some((s, i2) => s !== shows[i2]) ? next : [...shows],
70293
+ idMap
70294
+ };
70295
+ }
70296
+ function customShowActionId(action) {
70297
+ if (!action || !action.toLowerCase().includes("ppaction://customshow")) {
70298
+ return void 0;
70299
+ }
70300
+ const match = action.match(/[?&]id=([^&]*)/i);
70301
+ return match ? decodeURIComponent(match[1]) : void 0;
70302
+ }
70303
+ function rewriteAction(action, rewrite) {
70304
+ const id = customShowActionId(action);
70305
+ if (id === void 0) {
70306
+ return { changed: false, action };
70307
+ }
70308
+ const next = rewrite(id);
70309
+ if (next === id) {
70310
+ return { changed: false, action };
70311
+ }
70312
+ return {
70313
+ changed: true,
70314
+ action: next === null ? void 0 : action.replace(/([?&]id=)[^&]*/i, `$1${encodeURIComponent(next)}`)
70315
+ };
70316
+ }
70317
+ function mapElement(element2, rewrite) {
70318
+ let changed = 0;
70319
+ let next = element2;
70320
+ const edit = () => {
70321
+ if (next === element2) {
70322
+ next = { ...element2 };
70323
+ }
70324
+ return next;
70325
+ };
70326
+ for (const key2 of ["actionClick", "actionHover"]) {
70327
+ const current = element2[key2];
70328
+ const result = rewriteAction(current?.action, rewrite);
70329
+ if (current && result.changed) {
70330
+ changed++;
70331
+ if (result.action === void 0) {
70332
+ delete edit()[key2];
70333
+ } else {
70334
+ edit()[key2] = { ...current, action: result.action };
70335
+ }
70336
+ }
70337
+ }
70338
+ const segments = "textSegments" in element2 ? element2.textSegments : void 0;
70339
+ if (segments?.some((s) => customShowActionId(s.style?.hyperlinkAction) !== void 0)) {
70340
+ edit().textSegments = segments.map((segment) => {
70341
+ const result = rewriteAction(segment.style?.hyperlinkAction, rewrite);
70342
+ if (!result.changed) {
70343
+ return segment;
70344
+ }
70345
+ changed++;
70346
+ if (result.action !== void 0) {
70347
+ return { ...segment, style: { ...segment.style, hyperlinkAction: result.action } };
70348
+ }
70349
+ const {
70350
+ hyperlink: _h,
70351
+ hyperlinkRId: _r,
70352
+ hyperlinkTooltip: _t,
70353
+ hyperlinkAction: _a,
70354
+ hyperlinkTargetSlideIndex: _i,
70355
+ ...style
70356
+ } = segment.style;
70357
+ return { ...segment, style };
70358
+ });
70359
+ }
70360
+ if (element2.type === "group") {
70361
+ const children17 = element2.children.map((child34) => mapElement(child34, rewrite));
70362
+ if (children17.some((c) => c.changed > 0)) {
70363
+ edit().children = children17.map((c) => c.element);
70364
+ changed += children17.reduce((n, c) => n + c.changed, 0);
70365
+ }
70366
+ }
70367
+ return { element: next, changed };
70368
+ }
70369
+ function mapCustomShowActions(slides, rewrite) {
70370
+ let changed = 0;
70371
+ const next = slides.map((slide) => {
70372
+ const results = slide.elements.map((element2) => mapElement(element2, rewrite));
70373
+ const n = results.reduce((sum, r) => sum + r.changed, 0);
70374
+ if (n === 0) {
70375
+ return slide;
70376
+ }
70377
+ changed += n;
70378
+ return { ...slide, elements: results.map((r) => r.element) };
70379
+ });
70380
+ return { slides: next, changed };
70381
+ }
70382
+ var UNSIGNED_INT_MAX;
70383
+ var init_custom_show_actions = __esm({
70384
+ "pptx/core/utils/custom-show-actions.ts"() {
70385
+ UNSIGNED_INT_MAX = 4294967295;
70386
+ }
70387
+ });
70388
+
69526
70389
  // pptx/core/utils/table-style-resolver.ts
69527
70390
  function mergeBorder(base, override) {
69528
70391
  if (!base && !override) {
@@ -76654,6 +77517,7 @@ var init_utils = __esm({
76654
77517
  init_smartart_definition_metadata();
76655
77518
  init_accessibility_checker();
76656
77519
  init_custom_show_utils();
77520
+ init_custom_show_actions();
76657
77521
  init_table_style_resolver();
76658
77522
  init_animation_preset_catalog();
76659
77523
  init_smartart_relayout();
@@ -129503,6 +130367,32 @@ var init_modern_comment_package = __esm({
129503
130367
  }
129504
130368
  });
129505
130369
 
130370
+ // pptx/core/core/runtime/custom-show-save-ids.ts
130371
+ function withValidCustomShowIds(slides, options2) {
130372
+ if (!options2?.customShows) {
130373
+ return { slides, options: options2 };
130374
+ }
130375
+ const { shows, idMap } = normalizeCustomShowIds(options2.customShows);
130376
+ if (idMap.size === 0) {
130377
+ return { slides, options: options2 };
130378
+ }
130379
+ const properties = options2.presentationProperties;
130380
+ const showId = properties?.showSlidesCustomShowId;
130381
+ return {
130382
+ slides: mapCustomShowActions(slides, (id) => idMap.get(id) ?? id).slides,
130383
+ options: {
130384
+ ...options2,
130385
+ customShows: shows,
130386
+ ...properties && showId !== void 0 && idMap.has(showId) ? { presentationProperties: { ...properties, showSlidesCustomShowId: idMap.get(showId) } } : {}
130387
+ }
130388
+ };
130389
+ }
130390
+ var init_custom_show_save_ids = __esm({
130391
+ "pptx/core/core/runtime/custom-show-save-ids.ts"() {
130392
+ init_custom_show_actions();
130393
+ }
130394
+ });
130395
+
129506
130396
  // pptx/core/core/runtime/comment-authors-retention.ts
129507
130397
  function shouldKeepSourceCommentAuthors(input) {
129508
130398
  return !input.hasUsedCommentAuthors && input.authorsPartPresent && input.existingLegacyCommentPartCount === 0;
@@ -131348,7 +132238,7 @@ var init_metro_blob_collect = __esm({
131348
132238
  }
131349
132239
  });
131350
132240
 
131351
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/byte-writer.js
132241
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/byte-writer.js
131352
132242
  function record(recType, data, recInstance = 0, isContainer2 = false, recVer = 0) {
131353
132243
  const header = new Uint8Array(8);
131354
132244
  const view = new DataView(header.buffer);
@@ -131363,7 +132253,7 @@ function record(recType, data, recInstance = 0, isContainer2 = false, recVer = 0
131363
132253
  }
131364
132254
  var ByteWriter;
131365
132255
  var init_byte_writer = __esm({
131366
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/byte-writer.js"() {
132256
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/byte-writer.js"() {
131367
132257
  ByteWriter = class {
131368
132258
  chunks = [];
131369
132259
  length = 0;
@@ -131446,13 +132336,13 @@ var init_byte_writer = __esm({
131446
132336
  }
131447
132337
  });
131448
132338
 
131449
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js
132339
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js
131450
132340
  function masterToEmu(mu) {
131451
132341
  return Math.round(mu * EMU_PER_MASTER);
131452
132342
  }
131453
132343
  var RT, OA, TEXT_TYPE, HEADER_TOKEN_PLAIN, HEADER_TOKEN_ENCRYPTED, EMU_PER_MASTER;
131454
132344
  var init_legacy_ppt_record_types = __esm({
131455
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js"() {
132345
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js"() {
131456
132346
  RT = {
131457
132347
  Document: 1e3,
131458
132348
  DocumentAtom: 1001,
@@ -131581,14 +132471,14 @@ var init_legacy_ppt_record_types = __esm({
131581
132471
  }
131582
132472
  });
131583
132473
 
131584
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/record-types.js
132474
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/record-types.js
131585
132475
  var init_record_types = __esm({
131586
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/record-types.js"() {
132476
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/record-types.js"() {
131587
132477
  init_legacy_ppt_record_types();
131588
132478
  }
131589
132479
  });
131590
132480
 
131591
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/current-user-writer.js
132481
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/current-user-writer.js
131592
132482
  function buildCurrentUserStream(offsetToCurrentEdit, encrypted) {
131593
132483
  const nameBytes = new ByteWriter().ansi(USER_NAME).toBytes();
131594
132484
  const data = new ByteWriter().u32(20).u32(encrypted ? HEADER_TOKEN_ENCRYPTED : HEADER_TOKEN_PLAIN).u32(offsetToCurrentEdit).u16(nameBytes.length).u16(1012).u8(3).u8(0).bytes(new Uint8Array(2)).bytes(nameBytes).u32(8).toBytes();
@@ -131602,7 +132492,7 @@ function buildCurrentUserStream(offsetToCurrentEdit, encrypted) {
131602
132492
  }
131603
132493
  var USER_NAME, CURRENT_USER_STREAM_SIZE;
131604
132494
  var init_current_user_writer = __esm({
131605
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/current-user-writer.js"() {
132495
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/current-user-writer.js"() {
131606
132496
  init_record_types();
131607
132497
  init_byte_writer();
131608
132498
  USER_NAME = "pptx-viewer";
@@ -131610,7 +132500,7 @@ var init_current_user_writer = __esm({
131610
132500
  }
131611
132501
  });
131612
132502
 
131613
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/utils/digests/bit-ops.js
132503
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/digests/bit-ops.js
131614
132504
  function rotl322(x, n) {
131615
132505
  return (x << n | x >>> 32 - n) >>> 0;
131616
132506
  }
@@ -131659,11 +132549,11 @@ function mdStyleDigest2(message, initialState, transform7) {
131659
132549
  return out;
131660
132550
  }
131661
132551
  var init_bit_ops2 = __esm({
131662
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/utils/digests/bit-ops.js"() {
132552
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/digests/bit-ops.js"() {
131663
132553
  }
131664
132554
  });
131665
132555
 
131666
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js
132556
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js
131667
132557
  function f13(x, y, z) {
131668
132558
  return x & y | ~x & z;
131669
132559
  }
@@ -131687,7 +132577,7 @@ function md42(message) {
131687
132577
  }
131688
132578
  var INITIAL_STATE5, K22, K32, ROUND12, ROUND22, ROUND32;
131689
132579
  var init_md42 = __esm({
131690
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js"() {
132580
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js"() {
131691
132581
  init_bit_ops2();
131692
132582
  INITIAL_STATE5 = [1732584193, 4023233417, 2562383102, 271733878];
131693
132583
  K22 = 1518500249;
@@ -131749,7 +132639,7 @@ var init_md42 = __esm({
131749
132639
  }
131750
132640
  });
131751
132641
 
131752
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/blip-writer.js
132642
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/blip-writer.js
131753
132643
  function pictureUid(picture) {
131754
132644
  return md42(picture.bytes);
131755
132645
  }
@@ -131772,7 +132662,7 @@ function buildFbse(picture, uid, foDelay, size) {
131772
132662
  }
131773
132663
  var MSOBLIP_PICT, BLIP_INFO;
131774
132664
  var init_blip_writer = __esm({
131775
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/blip-writer.js"() {
132665
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/blip-writer.js"() {
131776
132666
  init_md42();
131777
132667
  init_png_encoder();
131778
132668
  init_record_types();
@@ -131788,7 +132678,7 @@ var init_blip_writer = __esm({
131788
132678
  }
131789
132679
  });
131790
132680
 
131791
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/fopt-writer.js
132681
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/fopt-writer.js
131792
132682
  function boolPropValue(flag2, bit, useBit) {
131793
132683
  return useBit | (flag2 ? bit : 0);
131794
132684
  }
@@ -131824,7 +132714,7 @@ function buildMetroBlobTertiaryFopt(metroBlob) {
131824
132714
  }
131825
132715
  var OPT, FBID_FLAG, METRO_BLOB_OPID;
131826
132716
  var init_fopt_writer = __esm({
131827
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/fopt-writer.js"() {
132717
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/fopt-writer.js"() {
131828
132718
  init_record_types();
131829
132719
  init_byte_writer();
131830
132720
  OPT = {
@@ -131852,7 +132742,7 @@ var init_fopt_writer = __esm({
131852
132742
  }
131853
132743
  });
131854
132744
 
131855
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/bstore-writer.js
132745
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/bstore-writer.js
131856
132746
  function buildDggDefaultProperties() {
131857
132747
  return buildFopt([
131858
132748
  { id: 385, value: 134217732 },
@@ -131910,7 +132800,7 @@ function buildPictureStore(pictures, shapesPerDrawing) {
131910
132800
  }
131911
132801
  var SHAPE_ID_CLUSTER_SIZE;
131912
132802
  var init_bstore_writer = __esm({
131913
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/bstore-writer.js"() {
132803
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/bstore-writer.js"() {
131914
132804
  init_record_types();
131915
132805
  init_blip_writer();
131916
132806
  init_byte_writer();
@@ -131919,7 +132809,7 @@ var init_bstore_writer = __esm({
131919
132809
  }
131920
132810
  });
131921
132811
 
131922
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/font-collection-writer.js
132812
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/font-collection-writer.js
131923
132813
  function buildFontEntityAtom(name, index) {
131924
132814
  const nameBytes = new ByteWriter().utf16(name.slice(0, 31)).u16(0).toBytes();
131925
132815
  const padded = new Uint8Array(LF_FACE_NAME_BYTES);
@@ -131947,14 +132837,14 @@ function buildEnvironment(fonts, otherTextStyle) {
131947
132837
  }
131948
132838
  var LF_FACE_NAME_BYTES;
131949
132839
  var init_font_collection_writer = __esm({
131950
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/font-collection-writer.js"() {
132840
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/font-collection-writer.js"() {
131951
132841
  init_record_types();
131952
132842
  init_byte_writer();
131953
132843
  LF_FACE_NAME_BYTES = 64;
131954
132844
  }
131955
132845
  });
131956
132846
 
131957
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-writer.js
132847
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-writer.js
131958
132848
  function emuToMaster(emu2) {
131959
132849
  return Math.round(emu2 / EMU_PER_MASTER);
131960
132850
  }
@@ -132010,7 +132900,7 @@ function buildDocumentContainer(input) {
132010
132900
  }
132011
132901
  var MASTER_SLIDE_ID_SENTINEL, RT_CSTRING, RT_BINARY_TAG_DATA_BLOB;
132012
132902
  var init_document_writer = __esm({
132013
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-writer.js"() {
132903
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-writer.js"() {
132014
132904
  init_record_types();
132015
132905
  init_byte_writer();
132016
132906
  init_font_collection_writer();
@@ -132020,7 +132910,7 @@ var init_document_writer = __esm({
132020
132910
  }
132021
132911
  });
132022
132912
 
132023
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/hyperlink-writer.js
132913
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/hyperlink-writer.js
132024
132914
  function buildCString(text2, recInstance) {
132025
132915
  return record(RT.CString, new ByteWriter().utf16(text2).toBytes(), recInstance, false, 0);
132026
132916
  }
@@ -132156,7 +133046,7 @@ function buildTextInteractiveInfoAtom(beginChar, endChar) {
132156
133046
  }
132157
133047
  var II_ACTION, II_JUMP, LT, FLAG_CUSTOM_SHOW_RETURN, HyperlinkCollector;
132158
133048
  var init_hyperlink_writer = __esm({
132159
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/hyperlink-writer.js"() {
133049
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/hyperlink-writer.js"() {
132160
133050
  init_record_types();
132161
133051
  init_byte_writer();
132162
133052
  II_ACTION = {
@@ -132219,7 +133109,7 @@ var init_hyperlink_writer = __esm({
132219
133109
  }
132220
133110
  });
132221
133111
 
132222
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/media-writer.js
133112
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/media-writer.js
132223
133113
  function buildCString2(text2, recInstance) {
132224
133114
  return record(RT.CString, new ByteWriter().utf16(text2).toBytes(), recInstance, false, 0);
132225
133115
  }
@@ -132255,7 +133145,7 @@ function buildMediaExObjEntries(media) {
132255
133145
  }
132256
133146
  var MediaCollector, SOUND_EXTENSION_WAV, SOUND_LENGTH_UNKNOWN;
132257
133147
  var init_media_writer = __esm({
132258
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/media-writer.js"() {
133148
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/media-writer.js"() {
132259
133149
  init_record_types();
132260
133150
  init_byte_writer();
132261
133151
  MediaCollector = class {
@@ -132291,7 +133181,7 @@ var init_media_writer = __esm({
132291
133181
  }
132292
133182
  });
132293
133183
 
132294
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/ole-writer.js
133184
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/ole-writer.js
132295
133185
  function hexToBytes(hex3) {
132296
133186
  const out = new Uint8Array(hex3.length / 2);
132297
133187
  for (let i2 = 0; i2 < out.length; i2++) {
@@ -132353,7 +133243,7 @@ function buildExObjRefAtom(exObjId) {
132353
133243
  }
132354
133244
  var PACKAGE_ROOT_CLSID, COMP_OBJ_HEX, EX_OLE_EMBEDDED, DV_ASPECT_ICON, EX_OLE_SUB_DEFAULT, PACKAGER_MENU_NAME, OleCollector;
132355
133245
  var init_ole_writer = __esm({
132356
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/ole-writer.js"() {
133246
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/ole-writer.js"() {
132357
133247
  init_ole2_parser_write();
132358
133248
  init_record_types();
132359
133249
  init_byte_writer();
@@ -132413,7 +133303,7 @@ var init_ole_writer = __esm({
132413
133303
  }
132414
133304
  });
132415
133305
 
132416
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/ex-obj-list-writer.js
133306
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/ex-obj-list-writer.js
132417
133307
  function buildExObjList(hyperlinks, ole, media) {
132418
133308
  const oleEntries = ole?.all ?? [];
132419
133309
  const mediaEntries = media?.all ?? [];
@@ -132440,7 +133330,7 @@ function buildExObjList(hyperlinks, ole, media) {
132440
133330
  return record(RT.ExternalObjectList, w.toBytes(), 0, true);
132441
133331
  }
132442
133332
  var init_ex_obj_list_writer = __esm({
132443
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/ex-obj-list-writer.js"() {
133333
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/ex-obj-list-writer.js"() {
132444
133334
  init_record_types();
132445
133335
  init_byte_writer();
132446
133336
  init_hyperlink_writer();
@@ -132449,7 +133339,7 @@ var init_ex_obj_list_writer = __esm({
132449
133339
  }
132450
133340
  });
132451
133341
 
132452
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/anchor-writer.js
133342
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/anchor-writer.js
132453
133343
  function emuToMaster2(emu2) {
132454
133344
  return Math.round(emu2 / EMU_PER_MASTER);
132455
133345
  }
@@ -132494,7 +133384,7 @@ function buildChildAnchor(rect2) {
132494
133384
  }
132495
133385
  var INT16_MIN, INT16_MAX;
132496
133386
  var init_anchor_writer = __esm({
132497
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/anchor-writer.js"() {
133387
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/anchor-writer.js"() {
132498
133388
  init_record_types();
132499
133389
  init_byte_writer();
132500
133390
  INT16_MIN = -32768;
@@ -132502,7 +133392,7 @@ var init_anchor_writer = __esm({
132502
133392
  }
132503
133393
  });
132504
133394
 
132505
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/colors.js
133395
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/colors.js
132506
133396
  function parseHex(rgb2) {
132507
133397
  const hex3 = (rgb2 ?? DEFAULT_RGB).replace(/^#/u, "");
132508
133398
  if (!/^[0-9a-fA-F]{6}$/u.test(hex3)) {
@@ -132524,12 +133414,12 @@ function encodeColorIndex(rgb2) {
132524
133414
  }
132525
133415
  var DEFAULT_RGB;
132526
133416
  var init_colors2 = __esm({
132527
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/colors.js"() {
133417
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/colors.js"() {
132528
133418
  DEFAULT_RGB = "000000";
132529
133419
  }
132530
133420
  });
132531
133421
 
132532
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-exception-writer.js
133422
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-exception-writer.js
132533
133423
  function writePfException(w, para) {
132534
133424
  let mask = 0;
132535
133425
  if (para.hasBullet !== void 0) {
@@ -132619,7 +133509,7 @@ function writeCfException(w, run2, fontIndex) {
132619
133509
  }
132620
133510
  var ALIGN_CODE, EMU_PER_MASTER_UNIT;
132621
133511
  var init_text_exception_writer = __esm({
132622
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-exception-writer.js"() {
133512
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-exception-writer.js"() {
132623
133513
  init_colors2();
132624
133514
  ALIGN_CODE = {
132625
133515
  l: 0,
@@ -132631,7 +133521,7 @@ var init_text_exception_writer = __esm({
132631
133521
  }
132632
133522
  });
132633
133523
 
132634
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-atom-writer.js
133524
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-atom-writer.js
132635
133525
  function joinParagraphText(body) {
132636
133526
  return body.paragraphs.map((p) => p.runs.map((r) => r.text).join("")).join("\r");
132637
133527
  }
@@ -132692,7 +133582,7 @@ function buildTextAtoms(body, fonts, hyperlinks) {
132692
133582
  return new ByteWriter().bytes(buildTextHeaderAtom(body.textType)).bytes(buildTextCharsAtom(text2)).bytes(buildStyleTextPropAtom(body, fontIndex)).bytes(buildRunHyperlinks(body, hyperlinks)).toBytes();
132693
133583
  }
132694
133584
  var init_text_atom_writer = __esm({
132695
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-atom-writer.js"() {
133585
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-atom-writer.js"() {
132696
133586
  init_record_types();
132697
133587
  init_byte_writer();
132698
133588
  init_hyperlink_writer();
@@ -132700,7 +133590,7 @@ var init_text_atom_writer = __esm({
132700
133590
  }
132701
133591
  });
132702
133592
 
132703
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-placeholders-writer.js
133593
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-placeholders-writer.js
132704
133594
  function utf16z(text2) {
132705
133595
  return new ByteWriter().utf16(text2).u16(0).toBytes();
132706
133596
  }
@@ -132797,7 +133687,7 @@ function buildMasterPlaceholders(placeholders, allocator, fieldFontIndex) {
132797
133687
  }
132798
133688
  var FSP_FLAGS, RECTANGLE_SPT, TEXT_TYPE_TITLE, TEXT_TYPE_BODY, TEXT_TYPE_OTHER, SPECS, MASTER_PLACEHOLDER_ORDER, TITLE_PROMPT, BODY_PROMPT, DEFAULT_FRAMES;
132799
133689
  var init_master_placeholders_writer = __esm({
132800
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-placeholders-writer.js"() {
133690
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-placeholders-writer.js"() {
132801
133691
  init_record_types();
132802
133692
  init_anchor_writer();
132803
133693
  init_byte_writer();
@@ -132864,18 +133754,18 @@ var init_master_placeholders_writer = __esm({
132864
133754
  }
132865
133755
  });
132866
133756
 
132867
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-style-fonts.js
133757
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-style-fonts.js
132868
133758
  function masterStyleFonts(styles2) {
132869
133759
  if (!styles2)
132870
133760
  return [];
132871
133761
  return [styles2.title, styles2.body, styles2.other].flatMap((levels) => levels ?? []).map((level2) => level2.run.fontName).filter((name) => Boolean(name));
132872
133762
  }
132873
133763
  var init_master_style_fonts = __esm({
132874
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-style-fonts.js"() {
133764
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-style-fonts.js"() {
132875
133765
  }
132876
133766
  });
132877
133767
 
132878
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-text-styles-writer.js
133768
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-text-styles-writer.js
132879
133769
  function buildMasterStyleAtom(recInstance, levels, fontIndex) {
132880
133770
  const w = new ByteWriter().u16(levels.length);
132881
133771
  for (const level2 of levels) {
@@ -132906,7 +133796,7 @@ function buildMasterTextStyles(styles2, fontIndex) {
132906
133796
  }
132907
133797
  var EMPTY_LEVELS, FIXED_INSTANCE_DATA;
132908
133798
  var init_master_text_styles_writer = __esm({
132909
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-text-styles-writer.js"() {
133799
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-text-styles-writer.js"() {
132910
133800
  init_record_types();
132911
133801
  init_byte_writer();
132912
133802
  init_text_exception_writer();
@@ -132922,7 +133812,7 @@ var init_master_text_styles_writer = __esm({
132922
133812
  }
132923
133813
  });
132924
133814
 
132925
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-props-writer.js
133815
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-props-writer.js
132926
133816
  function fillEntries(fill3) {
132927
133817
  if (!fill3 || fill3.kind === "none") {
132928
133818
  return [{ id: OPT.fNoFillHitTest, value: boolPropValue(false, 16, 1048576) }];
@@ -132977,7 +133867,7 @@ function buildShapeFoptProps(input) {
132977
133867
  }
132978
133868
  var DASH_CODE;
132979
133869
  var init_shape_props_writer = __esm({
132980
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-props-writer.js"() {
133870
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-props-writer.js"() {
132981
133871
  init_colors2();
132982
133872
  init_fopt_writer();
132983
133873
  DASH_CODE = {
@@ -132992,7 +133882,7 @@ var init_shape_props_writer = __esm({
132992
133882
  }
132993
133883
  });
132994
133884
 
132995
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-writer.js
133885
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-writer.js
132996
133886
  function buildShapeAnchor(rect2, inGroup) {
132997
133887
  return inGroup ? buildChildAnchor(rect2) : buildClientAnchor(rect2);
132998
133888
  }
@@ -133094,7 +133984,7 @@ function buildMediaShapeContainer(media, allocator, hyperlinks, mediaEmbeds, inG
133094
133984
  }
133095
133985
  var FSP_FLAG_FLIPH, FSP_FLAG_FLIPV, FSP_FLAG_OLE_SHAPE, FSP_FLAG_CHILD, PLACEHOLDER_ID;
133096
133986
  var init_shape_writer = __esm({
133097
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-writer.js"() {
133987
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-writer.js"() {
133098
133988
  init_record_types();
133099
133989
  init_anchor_writer();
133100
133990
  init_byte_writer();
@@ -133116,7 +134006,7 @@ var init_shape_writer = __esm({
133116
134006
  }
133117
134007
  });
133118
134008
 
133119
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/group-writer.js
134009
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/group-writer.js
133120
134010
  function buildFspgr(childRect) {
133121
134011
  return record(OA.FSPGR, buildChildAnchorData(childRect), 0, false, 1);
133122
134012
  }
@@ -133157,7 +134047,7 @@ function buildGroupContainer(group, fonts, allocator, hyperlinks, oleEmbeds, med
133157
134047
  }
133158
134048
  var FSP_FLAG_GROUP, FSP_FLAG_PATRIARCH, FSP_FLAG_HAVE_ANCHOR, ZERO_RECT;
133159
134049
  var init_group_writer = __esm({
133160
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/group-writer.js"() {
134050
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/group-writer.js"() {
133161
134051
  init_record_types();
133162
134052
  init_anchor_writer();
133163
134053
  init_byte_writer();
@@ -133169,10 +134059,10 @@ var init_group_writer = __esm({
133169
134059
  }
133170
134060
  });
133171
134061
 
133172
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-id-allocator.js
134062
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-id-allocator.js
133173
134063
  var ShapeIdAllocator2;
133174
134064
  var init_shape_id_allocator = __esm({
133175
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-id-allocator.js"() {
134065
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-id-allocator.js"() {
133176
134066
  ShapeIdAllocator2 = class {
133177
134067
  current;
133178
134068
  constructor(drawingId, clusterSize) {
@@ -133198,7 +134088,7 @@ var init_shape_id_allocator = __esm({
133198
134088
  }
133199
134089
  });
133200
134090
 
133201
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/drawing-writer.js
134091
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/drawing-writer.js
133202
134092
  function buildDg(drawingId, shapeCount, lastShapeId) {
133203
134093
  const data = new ByteWriter().u32(shapeCount + 1).u32(lastShapeId).toBytes();
133204
134094
  return record(OA.Dg, data, drawingId, false, 0);
@@ -133229,7 +134119,7 @@ function buildDrawing(canvasRect, shapes, backgroundRgb, fonts, drawingId, hyper
133229
134119
  }
133230
134120
  var FSP_FLAG_BACKGROUND, BACKGROUND_RECT_SPT, SHAPE_ID_CLUSTER_SIZE2;
133231
134121
  var init_drawing_writer = __esm({
133232
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/drawing-writer.js"() {
134122
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/drawing-writer.js"() {
133233
134123
  init_record_types();
133234
134124
  init_byte_writer();
133235
134125
  init_colors2();
@@ -133242,7 +134132,7 @@ var init_drawing_writer = __esm({
133242
134132
  }
133243
134133
  });
133244
134134
 
133245
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/notes-writer.js
134135
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/notes-writer.js
133246
134136
  function buildNotesAtom(slidePersistIdRef) {
133247
134137
  const data = new ByteWriter().i32(slidePersistIdRef).u16(0).u16(0).toBytes();
133248
134138
  return record(RT.NotesAtom, data, 0, false, 1);
@@ -133260,14 +134150,14 @@ function buildNotesContainer(paragraphs, notesRect, slidePersistIdRef, fonts, dr
133260
134150
  return record(RT.Notes, data, 0, true);
133261
134151
  }
133262
134152
  var init_notes_writer = __esm({
133263
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/notes-writer.js"() {
134153
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/notes-writer.js"() {
133264
134154
  init_record_types();
133265
134155
  init_byte_writer();
133266
134156
  init_drawing_writer();
133267
134157
  }
133268
134158
  });
133269
134159
 
133270
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js
134160
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js
133271
134161
  function readRecord(view, offset) {
133272
134162
  if (!Number.isSafeInteger(offset) || offset < 0 || offset + RECORD_HEADER_SIZE > view.byteLength) {
133273
134163
  return void 0;
@@ -133347,7 +134237,7 @@ function recordBytes(data, rec) {
133347
134237
  }
133348
134238
  var PptParseError, RECORD_HEADER_SIZE;
133349
134239
  var init_legacy_ppt_record_stream = __esm({
133350
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js"() {
134240
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js"() {
133351
134241
  PptParseError = class extends Error {
133352
134242
  constructor(message) {
133353
134243
  super(message);
@@ -133358,14 +134248,14 @@ var init_legacy_ppt_record_stream = __esm({
133358
134248
  }
133359
134249
  });
133360
134250
 
133361
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/record-stream.js
134251
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/record-stream.js
133362
134252
  var init_record_stream = __esm({
133363
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/record-stream.js"() {
134253
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/record-stream.js"() {
133364
134254
  init_legacy_ppt_record_stream();
133365
134255
  }
133366
134256
  });
133367
134257
 
133368
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/color-scheme.js
134258
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/color-scheme.js
133369
134259
  function toHex3(r, g2, b) {
133370
134260
  return [r, g2, b].map((v) => (v & 255).toString(16).padStart(2, "0").toUpperCase()).join("");
133371
134261
  }
@@ -133416,7 +134306,7 @@ function resolveEscherColor(colorRef, scheme2) {
133416
134306
  }
133417
134307
  var SCHEME, DEFAULT_SCHEME;
133418
134308
  var init_color_scheme = __esm({
133419
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/color-scheme.js"() {
134309
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/color-scheme.js"() {
133420
134310
  init_record_stream();
133421
134311
  init_record_types();
133422
134312
  SCHEME = {
@@ -133442,7 +134332,7 @@ var init_color_scheme = __esm({
133442
134332
  }
133443
134333
  });
133444
134334
 
133445
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/color-scheme-writer.js
134335
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/color-scheme-writer.js
133446
134336
  function buildColorSchemeAtom(recInstance = 1, colors) {
133447
134337
  const w = new ByteWriter();
133448
134338
  for (const rgb2 of colors?.length === 8 ? colors : DEFAULT_SCHEME) {
@@ -133451,7 +134341,7 @@ function buildColorSchemeAtom(recInstance = 1, colors) {
133451
134341
  return record(RT.ColorSchemeAtom, w.toBytes(), recInstance, false, 0);
133452
134342
  }
133453
134343
  var init_color_scheme_writer = __esm({
133454
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/color-scheme-writer.js"() {
134344
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/color-scheme-writer.js"() {
133455
134345
  init_color_scheme();
133456
134346
  init_record_types();
133457
134347
  init_byte_writer();
@@ -133459,7 +134349,7 @@ var init_color_scheme_writer = __esm({
133459
134349
  }
133460
134350
  });
133461
134351
 
133462
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/slide-writer.js
134352
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/slide-writer.js
133463
134353
  function buildSlideAtomRaw(geom, masterIdRef, notesIdRef, flags3) {
133464
134354
  const data = new ByteWriter().i32(geom).bytes(new Uint8Array(8)).u32(masterIdRef).i32(notesIdRef).u16(flags3).u16(0).toBytes();
133465
134355
  return record(RT.SlideAtom, data, 0, false, 2);
@@ -133496,7 +134386,7 @@ function buildMainMasterContainer(slideRect, drawingId, hyperlinks, oleEmbeds, m
133496
134386
  }
133497
134387
  var SLIDE_FLAG_MASTER_OBJECTS, SLIDE_FLAG_MASTER_SCHEME, SLIDE_FLAG_MASTER_BACKGROUND, SLIDE_MASTER_ID_SENTINEL, MASTER_FIRST_COLOR_SCHEME_INSTANCE;
133498
134388
  var init_slide_writer = __esm({
133499
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/slide-writer.js"() {
134389
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/slide-writer.js"() {
133500
134390
  init_record_types();
133501
134391
  init_byte_writer();
133502
134392
  init_color_scheme_writer();
@@ -133511,7 +134401,7 @@ var init_slide_writer = __esm({
133511
134401
  }
133512
134402
  });
133513
134403
 
133514
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-stream-layout.js
134404
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-stream-layout.js
133515
134405
  function masterSlideId(index) {
133516
134406
  return MASTER_SLIDE_ID_SENTINEL + index;
133517
134407
  }
@@ -133635,7 +134525,7 @@ function ensureMinimumDocumentStreamSize(contentSizeWithoutPadding, maxPersistId
133635
134525
  }
133636
134526
  var DOC_ID, MASTER_ID;
133637
134527
  var init_document_stream_layout = __esm({
133638
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-stream-layout.js"() {
134528
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-stream-layout.js"() {
133639
134529
  init_bstore_writer();
133640
134530
  init_byte_writer();
133641
134531
  init_document_writer();
@@ -133653,15 +134543,15 @@ var init_document_stream_layout = __esm({
133653
134543
  }
133654
134544
  });
133655
134545
 
133656
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/crypto-constants.js
134546
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/crypto-constants.js
133657
134547
  var RC4_ALG_ID2;
133658
134548
  var init_crypto_constants = __esm({
133659
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/crypto-constants.js"() {
134549
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/crypto-constants.js"() {
133660
134550
  RC4_ALG_ID2 = 26625;
133661
134551
  }
133662
134552
  });
133663
134553
 
133664
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/utils/rc4-cipher.js
134554
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/rc4-cipher.js
133665
134555
  function rc4Cipher(key2, data) {
133666
134556
  if (key2.length === 0) {
133667
134557
  throw new Error("RC4 key must not be empty.");
@@ -133692,11 +134582,11 @@ function rc4Cipher(key2, data) {
133692
134582
  return out;
133693
134583
  }
133694
134584
  var init_rc4_cipher = __esm({
133695
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/utils/rc4-cipher.js"() {
134585
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/utils/rc4-cipher.js"() {
133696
134586
  }
133697
134587
  });
133698
134588
 
133699
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-key.js
134589
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-key.js
133700
134590
  async function rc4CryptoApiKeyBase(password, salt) {
133701
134591
  return hash("SHA-1", concatArrays(salt, encodePasswordUtf16LE(password)));
133702
134592
  }
@@ -133737,14 +134627,14 @@ async function rc4CryptoApiEncryptVerifier(key0, verifier) {
133737
134627
  }
133738
134628
  var PADDED_40_BIT_KEY_BYTES;
133739
134629
  var init_rc4_cryptoapi_key = __esm({
133740
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-key.js"() {
134630
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-key.js"() {
133741
134631
  init_ooxml_crypto_primitives();
133742
134632
  init_rc4_cipher();
133743
134633
  PADDED_40_BIT_KEY_BYTES = 16;
133744
134634
  }
133745
134635
  });
133746
134636
 
133747
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-streams.js
134637
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-streams.js
133748
134638
  function readHeader(bytes) {
133749
134639
  const view = new DataView(bytes.buffer, bytes.byteOffset, RECORD_HEADER_SIZE);
133750
134640
  return {
@@ -133813,7 +134703,7 @@ async function cipherPicturesStream(stream, keyFor3, mode) {
133813
134703
  }
133814
134704
  var UID_SIZE, METAFILE_HEADER_SIZE, BITMAP_TAG_SIZE, METAFILE_BLIPS, BITMAP_BLIPS;
133815
134705
  var init_rc4_cryptoapi_streams = __esm({
133816
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-streams.js"() {
134706
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-streams.js"() {
133817
134707
  init_rc4_cipher();
133818
134708
  init_record_stream();
133819
134709
  UID_SIZE = 16;
@@ -133824,7 +134714,7 @@ var init_rc4_cryptoapi_streams = __esm({
133824
134714
  }
133825
134715
  });
133826
134716
 
133827
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/encrypt-writer.js
134717
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/encrypt-writer.js
133828
134718
  async function buildCryptSession(password) {
133829
134719
  const salt = new Uint8Array(SALT_SIZE);
133830
134720
  crypto.getRandomValues(salt);
@@ -133852,7 +134742,7 @@ async function encryptPicturesStream(stream, ctx) {
133852
134742
  }
133853
134743
  var CSP_NAME, KEY_SIZE_BITS, SALT_SIZE, VERIFIER_SIZE, VERIFIER_HASH_SIZE, ENCRYPTION_FLAGS;
133854
134744
  var init_encrypt_writer = __esm({
133855
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/encrypt-writer.js"() {
134745
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/encrypt-writer.js"() {
133856
134746
  init_crypto_constants();
133857
134747
  init_rc4_cryptoapi_key();
133858
134748
  init_rc4_cryptoapi_streams();
@@ -133867,7 +134757,7 @@ var init_encrypt_writer = __esm({
133867
134757
  }
133868
134758
  });
133869
134759
 
133870
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-relative-runs.js
134760
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-relative-runs.js
133871
134761
  function levelsFor(styles2, textType) {
133872
134762
  switch (textType) {
133873
134763
  case 0:
@@ -133933,12 +134823,12 @@ function withMasterRelativeRunStyles(deck) {
133933
134823
  }
133934
134824
  var STYLE_KEYS;
133935
134825
  var init_master_relative_runs = __esm({
133936
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-relative-runs.js"() {
134826
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-relative-runs.js"() {
133937
134827
  STYLE_KEYS = ["bold", "italic", "underline"];
133938
134828
  }
133939
134829
  });
133940
134830
 
133941
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/persist-writer.js
134831
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/persist-writer.js
133942
134832
  function buildPersistDirectoryAtom(entries) {
133943
134833
  const sorted = [...entries].sort((a, b) => a[0] - b[0]);
133944
134834
  const w = new ByteWriter();
@@ -133968,17 +134858,17 @@ function buildEncryptedUserEditAtom(input) {
133968
134858
  }
133969
134859
  var MAX_RUN;
133970
134860
  var init_persist_writer = __esm({
133971
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/persist-writer.js"() {
134861
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/persist-writer.js"() {
133972
134862
  init_record_types();
133973
134863
  init_byte_writer();
133974
134864
  MAX_RUN = 4095;
133975
134865
  }
133976
134866
  });
133977
134867
 
133978
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/ppt-clsid.js
134868
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/ppt-clsid.js
133979
134869
  var PPT_STORAGE_CLSID;
133980
134870
  var init_ppt_clsid = __esm({
133981
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/ppt-clsid.js"() {
134871
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/ppt-clsid.js"() {
133982
134872
  PPT_STORAGE_CLSID = new Uint8Array([
133983
134873
  16,
133984
134874
  141,
@@ -134000,7 +134890,7 @@ var init_ppt_clsid = __esm({
134000
134890
  }
134001
134891
  });
134002
134892
 
134003
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js
134893
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js
134004
134894
  async function finishUnencrypted(layout, lastSlideId) {
134005
134895
  const w = new ByteWriter().append(layout.bytes);
134006
134896
  const dirAtom = buildPersistDirectoryAtom(layout.offsets);
@@ -134054,7 +134944,7 @@ async function buildPptFile(deck, options2 = {}) {
134054
134944
  return new Uint8Array(buildOle2(streams2, PPT_STORAGE_CLSID, 0));
134055
134945
  }
134056
134946
  var init_write_ppt = __esm({
134057
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js"() {
134947
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js"() {
134058
134948
  init_ole2_parser_write();
134059
134949
  init_byte_writer();
134060
134950
  init_current_user_writer();
@@ -134066,9 +134956,9 @@ var init_write_ppt = __esm({
134066
134956
  }
134067
134957
  });
134068
134958
 
134069
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-writer.js
134959
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-ppt-writer.js
134070
134960
  var init_legacy_ppt_writer = __esm({
134071
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-writer.js"() {
134961
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/legacy-ppt-writer.js"() {
134072
134962
  init_write_ppt();
134073
134963
  init_master_style_fonts();
134074
134964
  }
@@ -136514,13 +137404,13 @@ function samePaint(a, b) {
136514
137404
  }
136515
137405
  return colorsEqual(a, b);
136516
137406
  }
136517
- function sameFill(model, authored) {
136518
- if (model.gradient || authored.gradient) {
137407
+ function sameFill(model2, authored) {
137408
+ if (model2.gradient || authored.gradient) {
136519
137409
  return Boolean(
136520
- model.gradient && authored.gradient && chartGradientsEqual(model.gradient, authored.gradient)
137410
+ model2.gradient && authored.gradient && chartGradientsEqual(model2.gradient, authored.gradient)
136521
137411
  );
136522
137412
  }
136523
- return samePaint(model.fill, authored.fill);
137413
+ return samePaint(model2.fill, authored.fill);
136524
137414
  }
136525
137415
  function setPaint(node, entry2, choices, after, getLocalName2) {
136526
137416
  const entries = Object.entries(node).filter(([key2]) => !choices.has(getLocalName2(key2)));
@@ -139195,10 +140085,10 @@ var init_chart_title_text_edit = __esm({
139195
140085
  });
139196
140086
 
139197
140087
  // pptx/core/utils/chart-title-serializer.ts
139198
- function applyChartTitleToXml(chartRoot, model, getLocalName2, options2 = { prefix: "c" }) {
140088
+ function applyChartTitleToXml(chartRoot, model2, getLocalName2, options2 = { prefix: "c" }) {
139199
140089
  const { prefix } = options2;
139200
140090
  const existingKey = findKey7(chartRoot, "title", getLocalName2);
139201
- const remove4 = model.hasTitle === false || model.title === "" && model.hasTitle !== true;
140091
+ const remove4 = model2.hasTitle === false || model2.title === "" && model2.hasTitle !== true;
139202
140092
  if (remove4) {
139203
140093
  if (existingKey) {
139204
140094
  delete chartRoot[existingKey];
@@ -139208,21 +140098,21 @@ function applyChartTitleToXml(chartRoot, model, getLocalName2, options2 = { pref
139208
140098
  }
139209
140099
  return false;
139210
140100
  }
139211
- if (model.title === void 0 && model.hasTitle !== true) {
140101
+ if (model2.title === void 0 && model2.hasTitle !== true) {
139212
140102
  return existingKey !== void 0;
139213
140103
  }
139214
- const runsFirstText = model.titleRuns?.[0]?.text;
139215
- const runsStale = model.title !== void 0 && runsFirstText !== void 0 && model.title !== runsFirstText;
139216
- let runs = prefix === "c" && model.titleRuns && model.titleRuns.length > 0 && !runsStale ? model.titleRuns : void 0;
139217
- const staleRuns = model.titleRuns;
139218
- if (prefix === "c" && runsStale && model.title !== void 0 && staleRuns && staleRuns.length > 1) {
139219
- runs = realignOrCollapseRuns(staleRuns, model.title);
140104
+ const runsFirstText = model2.titleRuns?.[0]?.text;
140105
+ const runsStale = model2.title !== void 0 && runsFirstText !== void 0 && model2.title !== runsFirstText;
140106
+ let runs = prefix === "c" && model2.titleRuns && model2.titleRuns.length > 0 && !runsStale ? model2.titleRuns : void 0;
140107
+ const staleRuns = model2.titleRuns;
140108
+ if (prefix === "c" && runsStale && model2.title !== void 0 && staleRuns && staleRuns.length > 1) {
140109
+ runs = realignOrCollapseRuns(staleRuns, model2.title);
139220
140110
  }
139221
140111
  let titleNode = existingKey ? chartRoot[existingKey] : void 0;
139222
140112
  const textOnlyStylesMatch = Boolean(
139223
- runs && model.titleTextOnlyStyles?.length === runs.length && runs.every(
140113
+ runs && model2.titleTextOnlyStyles?.length === runs.length && runs.every(
139224
140114
  (run2, index) => ["bold", "italic", "fontSize", "color"].every(
139225
- (key2) => run2[key2] === model.titleTextOnlyStyles[index][key2]
140115
+ (key2) => run2[key2] === model2.titleTextOnlyStyles[index][key2]
139226
140116
  )
139227
140117
  )
139228
140118
  );
@@ -139230,19 +140120,19 @@ function applyChartTitleToXml(chartRoot, model, getLocalName2, options2 = { pref
139230
140120
  const existingTexts = [];
139231
140121
  collectAllText(titleNode, getLocalName2, existingTexts);
139232
140122
  const newTexts = runs.map((run2) => run2.text);
139233
- if ((!model.titleTextOnly || textOnlyStylesMatch) && existingTexts.length === newTexts.length && existingTexts.every((text2, index) => text2 === newTexts[index])) {
140123
+ if ((!model2.titleTextOnly || textOnlyStylesMatch) && existingTexts.length === newTexts.length && existingTexts.every((text2, index) => text2 === newTexts[index])) {
139234
140124
  runs = void 0;
139235
140125
  }
139236
140126
  }
139237
140127
  if (!titleNode || typeof titleNode !== "object") {
139238
- titleNode = buildTitleNode(prefix, model.title, runs);
140128
+ titleNode = buildTitleNode(prefix, model2.title, runs);
139239
140129
  if (existingKey) {
139240
140130
  chartRoot[existingKey] = titleNode;
139241
140131
  } else {
139242
140132
  insertAt2(chartRoot, 0, `${prefix}:title`, titleNode);
139243
140133
  }
139244
140134
  } else if (runs) {
139245
- if (model.titleTextOnly && textOnlyStylesMatch) {
140135
+ if (model2.titleTextOnly && textOnlyStylesMatch) {
139246
140136
  if (!patchChartTitleRunText(titleNode, runs, getLocalName2))
139247
140137
  throw new Error("This chart title cannot be replaced without changing its text source");
139248
140138
  if (prefix === "c") setAutoTitleDeleted(chartRoot, false, getLocalName2);
@@ -139254,12 +140144,12 @@ function applyChartTitleToXml(chartRoot, model, getLocalName2, options2 = { pref
139254
140144
  } else {
139255
140145
  insertAt2(titleNode, 0, `${prefix}:tx`, buildTitleTextFromRuns(prefix, runs));
139256
140146
  }
139257
- } else if (model.title !== void 0 && !replaceFirstText(titleNode, model.title, getLocalName2)) {
140147
+ } else if (model2.title !== void 0 && !replaceFirstText(titleNode, model2.title, getLocalName2)) {
139258
140148
  const txKey = findKey7(titleNode, "tx", getLocalName2);
139259
140149
  if (txKey) {
139260
- titleNode[txKey] = buildTitleText(prefix, model.title);
140150
+ titleNode[txKey] = buildTitleText(prefix, model2.title);
139261
140151
  } else {
139262
- insertAt2(titleNode, 0, `${prefix}:tx`, buildTitleText(prefix, model.title));
140152
+ insertAt2(titleNode, 0, `${prefix}:tx`, buildTitleText(prefix, model2.title));
139263
140153
  }
139264
140154
  }
139265
140155
  if (prefix === "c") {
@@ -141604,13 +142494,13 @@ async function prepareWorkbook(zip, chart, saved, resolve) {
141604
142494
  const path3 = resolve(chart.chartPartPath, data.targetPath);
141605
142495
  const bytes = await zip.file(path3)?.async("uint8array");
141606
142496
  if (!bytes) throw new Error("The embedded chart workbook is missing.");
141607
- let model;
142497
+ let model2;
141608
142498
  const allocated = await appendChartWorkbookSheet(bytes, (name) => {
141609
142499
  const rebased = rebaseChartData(saved.workbookModel, name);
141610
- model = rebased.chartSpace;
142500
+ model2 = rebased.chartSpace;
141611
142501
  return rebased.rows;
141612
142502
  });
141613
- const xml = writeChartSpaceOverSource(saved.xml, model);
142503
+ const xml = writeChartSpaceOverSource(saved.xml, model2);
141614
142504
  zip.file(path3, allocated.bytes);
141615
142505
  syncIds();
141616
142506
  return { xml, workbookWrites: [] };
@@ -158893,9 +159783,9 @@ var init_PptxHandlerRuntimeSaveModel3D = __esm({
158893
159783
  /** Wrap newly authored model nodes in the required Choice/Fallback envelope. */
158894
159784
  wrapNewModel3DEnvelopes(spTree, models) {
158895
159785
  const envelopes = [];
158896
- for (const model of models) {
158897
- const fallback = this.newModel3DFallbackByXml.get(model);
158898
- if (!fallback || this.alternateContentBlockByRawXml.has(model)) {
159786
+ for (const model2 of models) {
159787
+ const fallback = this.newModel3DFallbackByXml.get(model2);
159788
+ if (!fallback || this.alternateContentBlockByRawXml.has(model2)) {
158899
159789
  continue;
158900
159790
  }
158901
159791
  envelopes.push({
@@ -158903,7 +159793,7 @@ var init_PptxHandlerRuntimeSaveModel3D = __esm({
158903
159793
  "mc:Choice": {
158904
159794
  "@_Requires": "p16",
158905
159795
  "@_xmlns:p16": MODEL3D_NAMESPACE,
158906
- "p16:model3D": model
159796
+ "p16:model3D": model2
158907
159797
  },
158908
159798
  "mc:Fallback": { "p:pic": fallback }
158909
159799
  });
@@ -163382,6 +164272,7 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
163382
164272
  init_modern_comment_package();
163383
164273
  init_builders();
163384
164274
  init_factories();
164275
+ init_custom_show_save_ids();
163385
164276
  init_comment_authors_retention();
163386
164277
  init_header_footer_parts();
163387
164278
  init_pptx_print_properties();
@@ -163411,7 +164302,8 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
163411
164302
  * one that fails does not hold up the next.
163412
164303
  */
163413
164304
  async save(slides, options2) {
163414
- const run2 = this.saveQueue.then(() => this.saveNow(slides, options2));
164305
+ const valid = withValidCustomShowIds(slides, options2);
164306
+ const run2 = this.saveQueue.then(() => this.saveNow(valid.slides, valid.options));
163415
164307
  this.saveQueue = run2.catch(() => void 0);
163416
164308
  return run2;
163417
164309
  }
@@ -171342,27 +172234,27 @@ var init_PptxHandlerRuntimeThemePartModel = __esm({
171342
172234
  * Record a parsed part under its path: its original XML (byte-stable passthrough on save,
171343
172235
  * C-H3), its names, per-script fonts and the raw subtrees the save re-emits.
171344
172236
  */
171345
- cacheThemePartModel(themePath, themeXml3, model) {
172237
+ cacheThemePartModel(themePath, themeXml3, model2) {
171346
172238
  this.originalThemeXmlByPath.set(themePath, themeXml3);
171347
172239
  const keyed = [
171348
- [this.masterThemeNames, model.name],
171349
- [this.masterThemeColorSchemeNames, model.colorSchemeName],
171350
- [this.masterThemeFontSchemeNames, model.fontSchemeName],
171351
- [this.masterThemeObjectDefaults, model.objectDefaults],
171352
- [this.masterThemeExtraClrSchemeLst, model.extraClrSchemeLst],
171353
- [this.masterThemeCustClrLst, model.custClrLst],
171354
- [this.masterThemeExtLst, model.extLst]
172240
+ [this.masterThemeNames, model2.name],
172241
+ [this.masterThemeColorSchemeNames, model2.colorSchemeName],
172242
+ [this.masterThemeFontSchemeNames, model2.fontSchemeName],
172243
+ [this.masterThemeObjectDefaults, model2.objectDefaults],
172244
+ [this.masterThemeExtraClrSchemeLst, model2.extraClrSchemeLst],
172245
+ [this.masterThemeCustClrLst, model2.custClrLst],
172246
+ [this.masterThemeExtLst, model2.extLst]
171355
172247
  ];
171356
172248
  for (const [map, value] of keyed) {
171357
172249
  if (value !== void 0) {
171358
172250
  map.set(themePath, value);
171359
172251
  }
171360
172252
  }
171361
- if (Object.keys(model.majorFontScripts).length > 0) {
171362
- this.masterThemeMajorFontScripts.set(themePath, model.majorFontScripts);
172253
+ if (Object.keys(model2.majorFontScripts).length > 0) {
172254
+ this.masterThemeMajorFontScripts.set(themePath, model2.majorFontScripts);
171363
172255
  }
171364
- if (Object.keys(model.minorFontScripts).length > 0) {
171365
- this.masterThemeMinorFontScripts.set(themePath, model.minorFontScripts);
172256
+ if (Object.keys(model2.minorFontScripts).length > 0) {
172257
+ this.masterThemeMinorFontScripts.set(themePath, model2.minorFontScripts);
171366
172258
  }
171367
172259
  }
171368
172260
  /**
@@ -171396,13 +172288,13 @@ var init_PptxHandlerRuntimeThemePartModel = __esm({
171396
172288
  if (themeXml3 === void 0) {
171397
172289
  return void 0;
171398
172290
  }
171399
- const model = this.parseThemePartXml(themeXml3);
172291
+ const model2 = this.parseThemePartXml(themeXml3);
171400
172292
  return {
171401
172293
  path: path3,
171402
- ...model.name ? { name: model.name } : {},
171403
- colorScheme: colorSchemeFromMap(model.colorMap),
171404
- fontScheme: fontSchemeFromMap(model.fontMap, model.majorFontScripts, model.minorFontScripts),
171405
- ...model.formatScheme ? { formatScheme: model.formatScheme } : {}
172294
+ ...model2.name ? { name: model2.name } : {},
172295
+ colorScheme: colorSchemeFromMap(model2.colorMap),
172296
+ fontScheme: fontSchemeFromMap(model2.fontMap, model2.majorFontScripts, model2.minorFontScripts),
172297
+ ...model2.formatScheme ? { formatScheme: model2.formatScheme } : {}
171406
172298
  };
171407
172299
  }
171408
172300
  };
@@ -171573,9 +172465,9 @@ var init_PptxHandlerRuntimeThemeLoading = __esm({
171573
172465
  return null;
171574
172466
  }
171575
172467
  const themeXml3 = await this.readPartText(themePath) ?? "";
171576
- const model = this.parseThemePartXml(themeXml3);
171577
- this.cacheThemePartModel(themePath, themeXml3, model);
171578
- return { colorMap: model.colorMap, fontMap: model.fontMap, formatScheme: model.formatScheme };
172468
+ const model2 = this.parseThemePartXml(themeXml3);
172469
+ this.cacheThemePartModel(themePath, themeXml3, model2);
172470
+ return { colorMap: model2.colorMap, fontMap: model2.fontMap, formatScheme: model2.formatScheme };
171579
172471
  }
171580
172472
  /**
171581
172473
  * Flatten a per-theme-path script-override map (`themePath -> {script ->
@@ -171890,27 +172782,27 @@ var init_PptxHandlerRuntimeThemeSwitching = __esm({
171890
172782
  if (themeXml3 === void 0) {
171891
172783
  return;
171892
172784
  }
171893
- const model = this.parseThemePartXml(themeXml3);
172785
+ const model2 = this.parseThemePartXml(themeXml3);
171894
172786
  if (!this.originalThemeXmlByPath.has(themePath)) {
171895
- this.cacheThemePartModel(themePath, themeXml3, model);
172787
+ this.cacheThemePartModel(themePath, themeXml3, model2);
171896
172788
  }
171897
172789
  this.masterThemePaths.set(masterPath, themePath);
171898
- this.masterThemeColorMaps.set(masterPath, { ...model.colorMap });
171899
- this.masterThemeFontMaps.set(masterPath, { ...model.fontMap });
171900
- if (model.formatScheme) {
171901
- this.masterThemeFormatSchemes.set(masterPath, model.formatScheme);
172790
+ this.masterThemeColorMaps.set(masterPath, { ...model2.colorMap });
172791
+ this.masterThemeFontMaps.set(masterPath, { ...model2.fontMap });
172792
+ if (model2.formatScheme) {
172793
+ this.masterThemeFormatSchemes.set(masterPath, model2.formatScheme);
171902
172794
  } else {
171903
172795
  this.masterThemeFormatSchemes.delete(masterPath);
171904
172796
  }
171905
172797
  if (this.zip.file(SLIDE_MASTER_PART)[0]?.name !== masterPath) {
171906
172798
  return;
171907
172799
  }
171908
- this.themeColorMap = { ...model.colorMap };
171909
- this.themeFontMap = { ...model.fontMap };
171910
- this.themeFormatScheme = model.formatScheme;
171911
- this.globalThemeColorMapSnapshot = { ...model.colorMap };
171912
- this.globalThemeFontMapSnapshot = { ...model.fontMap };
171913
- this.globalThemeFormatSchemeSnapshot = model.formatScheme;
172800
+ this.themeColorMap = { ...model2.colorMap };
172801
+ this.themeFontMap = { ...model2.fontMap };
172802
+ this.themeFormatScheme = model2.formatScheme;
172803
+ this.globalThemeColorMapSnapshot = { ...model2.colorMap };
172804
+ this.globalThemeFontMapSnapshot = { ...model2.fontMap };
172805
+ this.globalThemeFormatSchemeSnapshot = model2.formatScheme;
171914
172806
  }
171915
172807
  };
171916
172808
  }
@@ -174308,15 +175200,15 @@ var init_PptxHandlerRuntimeChartExParsing = __esm({
174308
175200
  * @returns Parsed chart data, or `undefined` if cx parsing yields no series.
174309
175201
  */
174310
175202
  async parseCxChart(plotArea, chartType, chartSpace, chartRoot, chartPartPath, chartRelationshipId, sourceXml) {
174311
- let model;
175203
+ let model2;
174312
175204
  try {
174313
175205
  const parsed = sourceXml ? parseChartExSpace(sourceXml) : void 0;
174314
175206
  if (parsed && !parsed.issues.length && parsed.chartExSpace.plotArea.series.length)
174315
- model = parsed.chartExSpace;
175207
+ model2 = parsed.chartExSpace;
174316
175208
  } catch {
174317
175209
  }
174318
- const result = model ? chartExFromNeutral(
174319
- model,
175210
+ const result = model2 ? chartExFromNeutral(
175211
+ model2,
174320
175212
  readChartExStyleBridge(
174321
175213
  plotArea,
174322
175214
  this.xmlLookupService,
@@ -174351,7 +175243,7 @@ var init_PptxHandlerRuntimeChartExParsing = __esm({
174351
175243
  const chartChrome = this.parseChartChrome(chartRoot);
174352
175244
  const clrMapOvr = this.parseClrMapOvr(chartSpace);
174353
175245
  return {
174354
- chartType: model ? chartExTypeFromNeutral(model) : chartType,
175246
+ chartType: model2 ? chartExTypeFromNeutral(model2) : chartType,
174355
175247
  categories: result.categories,
174356
175248
  ...result.categoryLevels ? { categoryLevels: result.categoryLevels } : {},
174357
175249
  series: result.series,
@@ -177639,7 +178531,7 @@ var init_deflate_utils = __esm({
177639
178531
  }
177640
178532
  });
177641
178533
 
177642
- // ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js
178534
+ // ../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js
177643
178535
  function checkedLimit(value) {
177644
178536
  if (!Number.isSafeInteger(value) || value < 1)
177645
178537
  throw new PptParseError("Invalid persist directory resource limit");
@@ -177765,7 +178657,7 @@ function readPersistRecord(view, directory, persistId) {
177765
178657
  }
177766
178658
  var DEFAULT_MAX_EDITS, DEFAULT_MAX_ENTRIES;
177767
178659
  var init_persist_directory = __esm({
177768
- "../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js"() {
178660
+ "../../node_modules/.bun/@christophervr+ole2@0.14.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js"() {
177769
178661
  init_record_stream();
177770
178662
  init_record_types();
177771
178663
  DEFAULT_MAX_EDITS = 1e4;
@@ -196159,18 +197051,18 @@ var FallbackElementProcessor = class {
196159
197051
  * way to be interactive: the poster is exactly what PowerPoint itself shows
196160
197052
  * a viewer that cannot render the model.
196161
197053
  */
196162
- async renderModel3D(model, ctx) {
196163
- const alt = model.altText?.trim() || "3D Model";
196164
- const poster = await this.savePoster(model, ctx);
197054
+ async renderModel3D(model2, ctx) {
197055
+ const alt = model2.altText?.trim() || "3D Model";
197056
+ const poster = await this.savePoster(model2, ctx);
196165
197057
  if (poster) {
196166
197058
  return `![${alt}](${poster})
196167
197059
 
196168
197060
  *[3D Model]*`;
196169
197061
  }
196170
- return model.modelPath ? `*[3D Model: ${model.modelPath}]*` : "*[3D Model]*";
197062
+ return model2.modelPath ? `*[3D Model: ${model2.modelPath}]*` : "*[3D Model]*";
196171
197063
  }
196172
- async savePoster(model, ctx) {
196173
- const dataUrl = model.posterImage ?? model.imageData;
197064
+ async savePoster(model2, ctx) {
197065
+ const dataUrl = model2.posterImage ?? model2.imageData;
196174
197066
  if (!dataUrl || !dataUrl.startsWith("data:")) {
196175
197067
  return null;
196176
197068
  }
@@ -199202,6 +200094,7 @@ exports.createUniformTextSegments = createUniformTextSegments;
199202
200094
  exports.cropShapeForPresetGeometry = cropShapeForPresetGeometry;
199203
200095
  exports.cssDegreesToOoxmlGradientAngle = cssDegreesToOoxmlGradientAngle;
199204
200096
  exports.customGeometryPathsToSvgSubpaths = customGeometryPathsToSvgSubpaths;
200097
+ exports.customShowActionId = customShowActionId;
199205
200098
  exports.dataUrlToMediaBytes = dataUrlToMediaBytes;
199206
200099
  exports.decodeOle10Native = decodeOle10Native;
199207
200100
  exports.decodePngDimensions = decodePngDimensions;
@@ -199417,6 +200310,7 @@ exports.lookupPresetShape = lookupPresetShape;
199417
200310
  exports.lookupPresetTextRectOverride = lookupPresetTextRectOverride;
199418
200311
  exports.mailMerge = mailMerge;
199419
200312
  exports.makeStoreAwareId = makeStoreAwareId;
200313
+ exports.mapCustomShowActions = mapCustomShowActions;
199420
200314
  exports.mergeNativeAfterAnimationIntoEditorAnimations = mergeNativeAfterAnimationIntoEditorAnimations;
199421
200315
  exports.mergeNativeSoundIntoEditorAnimations = mergeNativeSoundIntoEditorAnimations;
199422
200316
  exports.mergePresentation = mergePresentation;
@@ -199433,6 +200327,7 @@ exports.nodeFill = nodeFill;
199433
200327
  exports.nodeOpacity = nodeOpacity;
199434
200328
  exports.nodeStroke = nodeStroke;
199435
200329
  exports.nodeTextStyle = nodeTextStyle;
200330
+ exports.normalizeCustomShowIds = normalizeCustomShowIds;
199436
200331
  exports.normalizeHexColor = normalizeHexColor;
199437
200332
  exports.normalizeNamespaceUri = normalizeNamespaceUri;
199438
200333
  exports.normalizePartPath = normalizePartPath;