ooxml-core 1.8.4 → 1.10.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 (347) hide show
  1. package/dist/PptxHandler-5UURGJEV.mjs +2 -0
  2. package/dist/{PptxHandler-BL4B7CZO.mjs → PptxHandler-ADEFY476.mjs} +2 -2
  3. package/dist/PptxHandler-U5XB2HUE.cjs +11 -0
  4. package/dist/automation/index.cjs +7239 -4037
  5. package/dist/automation/index.mjs +7239 -4037
  6. package/dist/chunk-3N6XMMTT.cjs +87913 -0
  7. package/dist/{chunk-TTPZITQN.mjs → chunk-5NVJN4E6.mjs} +30 -2
  8. package/dist/{chunk-ZAP5WLEN.mjs → chunk-A6P7G3UK.mjs} +1 -1
  9. package/dist/{chunk-CPKNMQLX.cjs → chunk-AWIDASUW.cjs} +25 -2
  10. package/dist/{chunk-SVQZXP3F.mjs → chunk-CBNKBVX5.mjs} +25 -2
  11. package/dist/{chunk-GAGSCAR3.mjs → chunk-CCHYFCPD.mjs} +1199 -348
  12. package/dist/chunk-R6KSBNKX.mjs +44133 -0
  13. package/dist/chunk-S6DOCMQC.cjs +44451 -0
  14. package/dist/{chunk-Z7IQR4S4.mjs → chunk-WUE5ZHU3.mjs} +269 -21
  15. package/dist/chunk-ZE53K7DH.mjs +87907 -0
  16. package/dist/{chunk-NIHPA63A.mjs → chunk-ZOUGMAZG.mjs} +54 -37
  17. package/dist/docx/block-parser.d.ts.map +1 -1
  18. package/dist/docx/cell-blocks.d.ts +4 -0
  19. package/dist/docx/cell-blocks.d.ts.map +1 -0
  20. package/dist/docx/document-paragraphs.d.ts.map +1 -1
  21. package/dist/docx/document-parts.d.ts +2 -0
  22. package/dist/docx/document-parts.d.ts.map +1 -1
  23. package/dist/docx/embedded.cjs +189 -20
  24. package/dist/docx/embedded.mjs +189 -20
  25. package/dist/docx/index.cjs +219 -24
  26. package/dist/docx/index.mjs +219 -24
  27. package/dist/docx/layout/adapt-table.d.ts +2 -2
  28. package/dist/docx/layout/adapt-table.d.ts.map +1 -1
  29. package/dist/docx/layout/adapter.d.ts.map +1 -1
  30. package/dist/docx/layout/flow-paragraph.d.ts +5 -0
  31. package/dist/docx/layout/flow-paragraph.d.ts.map +1 -1
  32. package/dist/docx/layout/flow-table.d.ts +2 -1
  33. package/dist/docx/layout/flow-table.d.ts.map +1 -1
  34. package/dist/docx/layout/footnote-columns.d.ts +22 -0
  35. package/dist/docx/layout/footnote-columns.d.ts.map +1 -0
  36. package/dist/docx/layout/footnote-flow.d.ts +27 -0
  37. package/dist/docx/layout/footnote-flow.d.ts.map +1 -0
  38. package/dist/docx/layout/footnote-split.d.ts +7 -0
  39. package/dist/docx/layout/footnote-split.d.ts.map +1 -0
  40. package/dist/docx/layout/index.cjs +1528 -119
  41. package/dist/docx/layout/index.mjs +1528 -120
  42. package/dist/docx/layout/input.d.ts +17 -1
  43. package/dist/docx/layout/input.d.ts.map +1 -1
  44. package/dist/docx/layout/legacy-footnote-flow.d.ts +18 -0
  45. package/dist/docx/layout/legacy-footnote-flow.d.ts.map +1 -0
  46. package/dist/docx/layout/line-metrics.d.ts.map +1 -1
  47. package/dist/docx/layout/nested-frame-profile.d.ts +9 -0
  48. package/dist/docx/layout/nested-frame-profile.d.ts.map +1 -0
  49. package/dist/docx/layout/page-cursor.d.ts +15 -8
  50. package/dist/docx/layout/page-cursor.d.ts.map +1 -1
  51. package/dist/docx/layout/page-flow.d.ts.map +1 -1
  52. package/dist/docx/layout/paragraph-layout.d.ts.map +1 -1
  53. package/dist/docx/layout/paragraph-tokens.d.ts +2 -0
  54. package/dist/docx/layout/paragraph-tokens.d.ts.map +1 -1
  55. package/dist/docx/layout/reference-footnotes.d.ts +7 -0
  56. package/dist/docx/layout/reference-footnotes.d.ts.map +1 -0
  57. package/dist/docx/layout/result.d.ts +44 -0
  58. package/dist/docx/layout/result.d.ts.map +1 -1
  59. package/dist/docx/layout/section-flow.d.ts +2 -0
  60. package/dist/docx/layout/section-flow.d.ts.map +1 -1
  61. package/dist/docx/layout/table-border-layout.d.ts +16 -0
  62. package/dist/docx/layout/table-border-layout.d.ts.map +1 -0
  63. package/dist/docx/layout/table-cell-layout.d.ts +12 -0
  64. package/dist/docx/layout/table-cell-layout.d.ts.map +1 -0
  65. package/dist/docx/layout/table-content.d.ts +4 -0
  66. package/dist/docx/layout/table-content.d.ts.map +1 -0
  67. package/dist/docx/layout/table-footnotes.d.ts +32 -0
  68. package/dist/docx/layout/table-footnotes.d.ts.map +1 -0
  69. package/dist/docx/layout/table-frames.d.ts +4 -0
  70. package/dist/docx/layout/table-frames.d.ts.map +1 -0
  71. package/dist/docx/layout/table-layout.d.ts +16 -5
  72. package/dist/docx/layout/table-layout.d.ts.map +1 -1
  73. package/dist/docx/layout/table-note-completion.d.ts +5 -0
  74. package/dist/docx/layout/table-note-completion.d.ts.map +1 -0
  75. package/dist/docx/layout/table-note-stories.d.ts +6 -0
  76. package/dist/docx/layout/table-note-stories.d.ts.map +1 -0
  77. package/dist/docx/load/index.cjs +194 -25
  78. package/dist/docx/load/index.mjs +194 -25
  79. package/dist/docx/model-run.d.ts +2 -0
  80. package/dist/docx/model-run.d.ts.map +1 -1
  81. package/dist/docx/model.d.ts +7 -0
  82. package/dist/docx/model.d.ts.map +1 -1
  83. package/dist/docx/notes.d.ts +5 -0
  84. package/dist/docx/notes.d.ts.map +1 -1
  85. package/dist/docx/parse-table.d.ts.map +1 -1
  86. package/dist/docx/parse.d.ts.map +1 -1
  87. package/dist/docx/save.d.ts.map +1 -1
  88. package/dist/docx/section-model.d.ts +2 -0
  89. package/dist/docx/section-model.d.ts.map +1 -1
  90. package/dist/docx/sections.d.ts.map +1 -1
  91. package/dist/docx/settings.d.ts +2 -0
  92. package/dist/docx/settings.d.ts.map +1 -1
  93. package/dist/docx/table-model.d.ts +3 -1
  94. package/dist/docx/table-model.d.ts.map +1 -1
  95. package/dist/docx/ui/index.cjs +55 -0
  96. package/dist/docx/ui/index.d.ts +1 -0
  97. package/dist/docx/ui/index.d.ts.map +1 -1
  98. package/dist/docx/ui/index.mjs +55 -1
  99. package/dist/docx/ui/table-structure-guard.d.ts +4 -0
  100. package/dist/docx/ui/table-structure-guard.d.ts.map +1 -0
  101. package/dist/docx/write-footnote-columns.d.ts +3 -0
  102. package/dist/docx/write-footnote-columns.d.ts.map +1 -0
  103. package/dist/docx/write-notes.d.ts.map +1 -1
  104. package/dist/docx/write-run.d.ts.map +1 -1
  105. package/dist/docx/write-sections.d.ts.map +1 -1
  106. package/dist/index.cjs +8 -5
  107. package/dist/index.mjs +8 -5
  108. package/dist/opc/clone-part-graph.d.ts +4 -0
  109. package/dist/opc/clone-part-graph.d.ts.map +1 -1
  110. package/dist/opc/index.cjs +8 -5
  111. package/dist/opc/index.mjs +8 -5
  112. package/dist/pptx/automation/index.cjs +1156 -389
  113. package/dist/pptx/automation/index.d.ts +4 -4
  114. package/dist/pptx/automation/index.mjs +5 -5
  115. package/dist/pptx/chunks/{index-CKIUurnd.d.ts → index-Cuxtr76Y.d.ts} +29 -10
  116. package/dist/pptx/chunks/index-Cuxtr76Y.d.ts.map +1 -0
  117. package/dist/pptx/chunks/{index-Cn-GzYGp.d.ts → index-DUCGeZh7.d.ts} +94 -5
  118. package/dist/pptx/chunks/index-DUCGeZh7.d.ts.map +1 -0
  119. package/dist/pptx/chunks/{smart-art-Q2kZQtHh.d.ts → smart-art-D-sXa_Nb.d.ts} +11 -1
  120. package/dist/pptx/chunks/smart-art-D-sXa_Nb.d.ts.map +1 -0
  121. package/dist/pptx/chunks/{text-operations-BHfAm5K9.d.ts → text-operations-BqHmLaLA.d.ts} +54 -13
  122. package/dist/pptx/chunks/text-operations-BqHmLaLA.d.ts.map +1 -0
  123. package/dist/pptx/cli/index.cjs +1157 -395
  124. package/dist/pptx/cli/index.d.ts +1 -1
  125. package/dist/pptx/cli/index.mjs +4 -4
  126. package/dist/pptx/converter/index.cjs +54 -36
  127. package/dist/pptx/converter/index.d.ts +1 -1
  128. package/dist/pptx/converter/index.mjs +2 -2
  129. package/dist/pptx/editor/render/collaboration-live-patch-target.cjs +2 -2
  130. package/dist/pptx/editor/render/collaboration-live-patch-target.mjs +1 -1
  131. package/dist/pptx/editor/render/find-replace.cjs +416 -45
  132. package/dist/pptx/editor/render/find-replace.d.ts +35 -4
  133. package/dist/pptx/editor/render/find-replace.d.ts.map +1 -1
  134. package/dist/pptx/editor/render/find-replace.mjs +416 -46
  135. package/dist/pptx/editor/render/remap-text.cjs +2 -2
  136. package/dist/pptx/editor/render/remap-text.d.ts.map +1 -1
  137. package/dist/pptx/editor/render/remap-text.mjs +1 -1
  138. package/dist/pptx/editor/render/slide-operations.cjs +87 -0
  139. package/dist/pptx/editor/render/slide-operations.d.ts +17 -1
  140. package/dist/pptx/editor/render/slide-operations.d.ts.map +1 -1
  141. package/dist/pptx/editor/render/slide-operations.mjs +83 -1
  142. package/dist/pptx/editor/render/slide-search.cjs +6 -10
  143. package/dist/pptx/editor/render/slide-search.d.ts +1 -1
  144. package/dist/pptx/editor/render/slide-search.mjs +6 -10
  145. package/dist/pptx/editor/render/template-editing.d.ts +1 -1
  146. package/dist/pptx/editor/render/template-editing.d.ts.map +1 -1
  147. package/dist/pptx/index.cjs +1651 -419
  148. package/dist/pptx/index.d.ts +5 -5
  149. package/dist/pptx/index.mjs +5 -5
  150. package/dist/pptx/smartart-layouts/index.d.ts +1 -1
  151. package/dist/teams/index.cjs +965 -34
  152. package/dist/teams/index.mjs +965 -34
  153. package/dist/visio/accessibility.d.ts +10 -0
  154. package/dist/visio/accessibility.d.ts.map +1 -0
  155. package/dist/visio/cell-formula.d.ts +2 -0
  156. package/dist/visio/cell-formula.d.ts.map +1 -1
  157. package/dist/visio/connector-curve-aligned.d.ts +5 -0
  158. package/dist/visio/connector-curve-aligned.d.ts.map +1 -0
  159. package/dist/visio/connector-curve-spans.d.ts +14 -0
  160. package/dist/visio/connector-curve-spans.d.ts.map +1 -0
  161. package/dist/visio/connector-jumps.d.ts +5 -0
  162. package/dist/visio/connector-jumps.d.ts.map +1 -0
  163. package/dist/visio/connector-route-walk.d.ts +2 -1
  164. package/dist/visio/connector-route-walk.d.ts.map +1 -1
  165. package/dist/visio/date-cache.d.ts +3 -0
  166. package/dist/visio/date-cache.d.ts.map +1 -0
  167. package/dist/visio/edit-alt-text-scope.d.ts +5 -0
  168. package/dist/visio/edit-alt-text-scope.d.ts.map +1 -0
  169. package/dist/visio/edit-alt-text.d.ts +3 -0
  170. package/dist/visio/edit-alt-text.d.ts.map +1 -0
  171. package/dist/visio/edit-commands.d.ts +7 -2
  172. package/dist/visio/edit-commands.d.ts.map +1 -1
  173. package/dist/visio/edit-formatting-commands.d.ts +5 -0
  174. package/dist/visio/edit-formatting-commands.d.ts.map +1 -1
  175. package/dist/visio/edit-formatting-paint.d.ts.map +1 -1
  176. package/dist/visio/edit-formatting-scope.d.ts.map +1 -1
  177. package/dist/visio/edit-line-jump-cache.d.ts +4 -0
  178. package/dist/visio/edit-line-jump-cache.d.ts.map +1 -0
  179. package/dist/visio/edit-master-index.d.ts.map +1 -1
  180. package/dist/visio/edit-metadata-commands.d.ts +10 -2
  181. package/dist/visio/edit-metadata-commands.d.ts.map +1 -1
  182. package/dist/visio/edit-metadata.d.ts +3 -1
  183. package/dist/visio/edit-metadata.d.ts.map +1 -1
  184. package/dist/visio/edit-page-alt-text.d.ts +4 -0
  185. package/dist/visio/edit-page-alt-text.d.ts.map +1 -0
  186. package/dist/visio/edit-page-layout.d.ts.map +1 -1
  187. package/dist/visio/edit-page-rename.d.ts.map +1 -1
  188. package/dist/visio/edit-page-setup-commands.d.ts +7 -1
  189. package/dist/visio/edit-page-setup-commands.d.ts.map +1 -1
  190. package/dist/visio/edit-page-size.d.ts.map +1 -1
  191. package/dist/visio/edit-pages.d.ts.map +1 -1
  192. package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
  193. package/dist/visio/edit-scope.d.ts.map +1 -1
  194. package/dist/visio/edit-shape-create.d.ts.map +1 -1
  195. package/dist/visio/edit-stencil-connector-write.d.ts.map +1 -1
  196. package/dist/visio/edit-style-admission.d.ts.map +1 -1
  197. package/dist/visio/edit-text-field.d.ts.map +1 -1
  198. package/dist/visio/edit-text.d.ts.map +1 -1
  199. package/dist/visio/edit.d.ts +1 -1
  200. package/dist/visio/edit.d.ts.map +1 -1
  201. package/dist/visio/index.cjs +1215 -248
  202. package/dist/visio/index.d.ts +2 -1
  203. package/dist/visio/index.d.ts.map +1 -1
  204. package/dist/visio/index.mjs +1215 -249
  205. package/dist/visio/line-jumps.d.ts +1 -5
  206. package/dist/visio/line-jumps.d.ts.map +1 -1
  207. package/dist/visio/model.d.ts +13 -0
  208. package/dist/visio/model.d.ts.map +1 -1
  209. package/dist/visio/page-layout.d.ts +11 -2
  210. package/dist/visio/page-layout.d.ts.map +1 -1
  211. package/dist/visio/parser.d.ts.map +1 -1
  212. package/dist/visio/shape-metadata.d.ts +6 -0
  213. package/dist/visio/shape-metadata.d.ts.map +1 -1
  214. package/dist/visio/shapes.d.ts.map +1 -1
  215. package/dist/visio/text-field-case.d.ts +2 -0
  216. package/dist/visio/text-field-case.d.ts.map +1 -0
  217. package/dist/visio/text-field-display.d.ts.map +1 -1
  218. package/dist/visio/text-field-fraction.d.ts +3 -0
  219. package/dist/visio/text-field-fraction.d.ts.map +1 -0
  220. package/dist/visio/text-field-numeric.d.ts +4 -0
  221. package/dist/visio/text-field-numeric.d.ts.map +1 -0
  222. package/dist/visio/text-field-system-date.d.ts +4 -0
  223. package/dist/visio/text-field-system-date.d.ts.map +1 -0
  224. package/dist/visio/text-fields.d.ts +1 -0
  225. package/dist/visio/text-fields.d.ts.map +1 -1
  226. package/dist/visio/ui/connector-preview.d.ts +1 -1
  227. package/dist/visio/ui/connector-preview.d.ts.map +1 -1
  228. package/dist/visio/ui/data-graphic-rules.d.ts +2 -0
  229. package/dist/visio/ui/data-graphic-rules.d.ts.map +1 -1
  230. package/dist/visio/ui/data-graphics.d.ts +3 -2
  231. package/dist/visio/ui/data-graphics.d.ts.map +1 -1
  232. package/dist/visio/ui/edit-commands.d.ts.map +1 -1
  233. package/dist/visio/ui/index.cjs +19310 -18157
  234. package/dist/visio/ui/index.mjs +19310 -18158
  235. package/dist/visio/ui/scene-details.d.ts.map +1 -1
  236. package/dist/visio/ui/scene-validation.d.ts.map +1 -1
  237. package/dist/visio/ui/snapshot-scene.d.ts +2 -1
  238. package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
  239. package/dist/visio/ui/text-field-catalog.d.ts.map +1 -1
  240. package/dist/visio/xml-attribute-whitespace.d.ts +5 -0
  241. package/dist/visio/xml-attribute-whitespace.d.ts.map +1 -0
  242. package/dist/xlsx/edit/index.d.ts +1 -0
  243. package/dist/xlsx/edit/index.d.ts.map +1 -1
  244. package/dist/xlsx/edit/insert-guard.d.ts.map +1 -1
  245. package/dist/xlsx/edit/merge.d.ts.map +1 -1
  246. package/dist/xlsx/edit/page-breaks.d.ts +5 -0
  247. package/dist/xlsx/edit/page-breaks.d.ts.map +1 -0
  248. package/dist/xlsx/edit/pivots.d.ts +8 -0
  249. package/dist/xlsx/edit/pivots.d.ts.map +1 -0
  250. package/dist/xlsx/edit/print-titles.d.ts +7 -0
  251. package/dist/xlsx/edit/print-titles.d.ts.map +1 -0
  252. package/dist/xlsx/edit/session.d.ts.map +1 -1
  253. package/dist/xlsx/edit/sheets.d.ts.map +1 -1
  254. package/dist/xlsx/edit/shift-formulas.d.ts.map +1 -1
  255. package/dist/xlsx/edit/shift-sheet.d.ts.map +1 -1
  256. package/dist/xlsx/edit/sparkline-ranges.d.ts +11 -0
  257. package/dist/xlsx/edit/sparkline-ranges.d.ts.map +1 -0
  258. package/dist/xlsx/edit/sparkline-xml.d.ts +13 -0
  259. package/dist/xlsx/edit/sparkline-xml.d.ts.map +1 -0
  260. package/dist/xlsx/edit/sparklines.d.ts +16 -0
  261. package/dist/xlsx/edit/sparklines.d.ts.map +1 -0
  262. package/dist/xlsx/edit/table-edits.d.ts.map +1 -1
  263. package/dist/xlsx/edit/tables.d.ts.map +1 -1
  264. package/dist/xlsx/edit/types.d.ts +22 -1
  265. package/dist/xlsx/edit/types.d.ts.map +1 -1
  266. package/dist/xlsx/formula/functions/text-regex.d.ts.map +1 -1
  267. package/dist/xlsx/index.cjs +3638 -1199
  268. package/dist/xlsx/index.d.ts +1 -0
  269. package/dist/xlsx/index.d.ts.map +1 -1
  270. package/dist/xlsx/index.mjs +3619 -1200
  271. package/dist/xlsx/layout/cell-view.d.ts +2 -0
  272. package/dist/xlsx/layout/cell-view.d.ts.map +1 -1
  273. package/dist/xlsx/layout/header-footer.d.ts +58 -0
  274. package/dist/xlsx/layout/header-footer.d.ts.map +1 -0
  275. package/dist/xlsx/layout/index.d.ts +5 -0
  276. package/dist/xlsx/layout/index.d.ts.map +1 -1
  277. package/dist/xlsx/layout/print-breaks.d.ts +11 -0
  278. package/dist/xlsx/layout/print-breaks.d.ts.map +1 -0
  279. package/dist/xlsx/layout/print-layout.d.ts +34 -0
  280. package/dist/xlsx/layout/print-layout.d.ts.map +1 -0
  281. package/dist/xlsx/layout/print-merges.d.ts +18 -0
  282. package/dist/xlsx/layout/print-merges.d.ts.map +1 -0
  283. package/dist/xlsx/layout/print-repeat.d.ts +12 -0
  284. package/dist/xlsx/layout/print-repeat.d.ts.map +1 -0
  285. package/dist/xlsx/layout/print-titles.d.ts +20 -0
  286. package/dist/xlsx/layout/print-titles.d.ts.map +1 -0
  287. package/dist/xlsx/layout/sparkline-data.d.ts.map +1 -1
  288. package/dist/xlsx/layout/sparkline-view.d.ts.map +1 -1
  289. package/dist/xlsx/load/index.cjs +8165 -6945
  290. package/dist/xlsx/load/index.mjs +8165 -6945
  291. package/dist/xlsx/model-pivots.d.ts +67 -0
  292. package/dist/xlsx/model-pivots.d.ts.map +1 -0
  293. package/dist/xlsx/model.d.ts +5 -0
  294. package/dist/xlsx/model.d.ts.map +1 -1
  295. package/dist/xlsx/pivot/admission.d.ts +5 -0
  296. package/dist/xlsx/pivot/admission.d.ts.map +1 -0
  297. package/dist/xlsx/pivot/aggregate.d.ts +21 -0
  298. package/dist/xlsx/pivot/aggregate.d.ts.map +1 -0
  299. package/dist/xlsx/pivot/cache-xml.d.ts +9 -0
  300. package/dist/xlsx/pivot/cache-xml.d.ts.map +1 -0
  301. package/dist/xlsx/pivot/data.d.ts +12 -0
  302. package/dist/xlsx/pivot/data.d.ts.map +1 -0
  303. package/dist/xlsx/pivot/hierarchy-first.d.ts +21 -0
  304. package/dist/xlsx/pivot/hierarchy-first.d.ts.map +1 -0
  305. package/dist/xlsx/pivot/hierarchy.d.ts +5 -0
  306. package/dist/xlsx/pivot/hierarchy.d.ts.map +1 -0
  307. package/dist/xlsx/pivot/index.d.ts +3 -0
  308. package/dist/xlsx/pivot/index.d.ts.map +1 -0
  309. package/dist/xlsx/pivot/measures.d.ts +13 -0
  310. package/dist/xlsx/pivot/measures.d.ts.map +1 -0
  311. package/dist/xlsx/pivot/read.d.ts +5 -0
  312. package/dist/xlsx/pivot/read.d.ts.map +1 -0
  313. package/dist/xlsx/pivot/table-xml.d.ts +5 -0
  314. package/dist/xlsx/pivot/table-xml.d.ts.map +1 -0
  315. package/dist/xlsx/pivot/values-axis.d.ts +9 -0
  316. package/dist/xlsx/pivot/values-axis.d.ts.map +1 -0
  317. package/dist/xlsx/pivot/write.d.ts +11 -0
  318. package/dist/xlsx/pivot/write.d.ts.map +1 -0
  319. package/dist/xlsx/read/load.d.ts.map +1 -1
  320. package/dist/xlsx/read/sheet-props.d.ts.map +1 -1
  321. package/dist/xlsx/ui/commands/i18n/index.d.ts.map +1 -1
  322. package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
  323. package/dist/xlsx/ui/commands/i18n/pivots.d.ts +3 -0
  324. package/dist/xlsx/ui/commands/i18n/pivots.d.ts.map +1 -0
  325. package/dist/xlsx/ui/commands/i18n/print-layout.d.ts +3 -0
  326. package/dist/xlsx/ui/commands/i18n/print-layout.d.ts.map +1 -0
  327. package/dist/xlsx/ui/commands/i18n/sparklines.d.ts +3 -0
  328. package/dist/xlsx/ui/commands/i18n/sparklines.d.ts.map +1 -0
  329. package/dist/xlsx/ui/commands/i18n/tools.d.ts.map +1 -1
  330. package/dist/xlsx/ui/commands/page-breaks.d.ts +3 -0
  331. package/dist/xlsx/ui/commands/page-breaks.d.ts.map +1 -0
  332. package/dist/xlsx/ui/index.cjs +2421 -288
  333. package/dist/xlsx/ui/index.d.ts +1 -0
  334. package/dist/xlsx/ui/index.d.ts.map +1 -1
  335. package/dist/xlsx/ui/index.mjs +2421 -289
  336. package/dist/xlsx/write/page-setup.d.ts.map +1 -1
  337. package/dist/xlsx/write/save.d.ts.map +1 -1
  338. package/dist/xlsx/write/sheet-parts.d.ts +1 -0
  339. package/dist/xlsx/write/sheet-parts.d.ts.map +1 -1
  340. package/dist/xlsx/write/workbook-part.d.ts +1 -1
  341. package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
  342. package/dist/xlsx/write/worksheet.d.ts.map +1 -1
  343. package/package.json +1 -1
  344. package/dist/pptx/chunks/index-CKIUurnd.d.ts.map +0 -1
  345. package/dist/pptx/chunks/index-Cn-GzYGp.d.ts.map +0 -1
  346. package/dist/pptx/chunks/smart-art-Q2kZQtHh.d.ts.map +0 -1
  347. package/dist/pptx/chunks/text-operations-BHfAm5K9.d.ts.map +0 -1
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  var xmldom = require('@xmldom/xmldom');
5
- var JSZip6 = require('jszip');
5
+ var JSZip7 = require('jszip');
6
6
  var fastXmlParser = require('fast-xml-parser');
7
7
  var mtxDecompressor = require('mtx-decompressor');
8
8
  var fs = require('fs');
@@ -28,7 +28,7 @@ function _interopNamespace(e) {
28
28
  return Object.freeze(n);
29
29
  }
30
30
 
31
- var JSZip6__default = /*#__PURE__*/_interopDefault(JSZip6);
31
+ var JSZip7__default = /*#__PURE__*/_interopDefault(JSZip7);
32
32
  var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
33
33
  var path2__namespace = /*#__PURE__*/_interopNamespace(path2);
34
34
 
@@ -10557,6 +10557,32 @@ function inheritCustomGeometryCommandOrder(target, ...sources) {
10557
10557
  }
10558
10558
  }
10559
10559
  }
10560
+ function pathListPaths(pathLst) {
10561
+ if (!pathLst || typeof pathLst !== "object") {
10562
+ return [];
10563
+ }
10564
+ return ensureArrayLocal(childByLocalName(pathLst, "path")).filter(
10565
+ (path3) => Boolean(path3) && typeof path3 === "object"
10566
+ );
10567
+ }
10568
+ function readPathListCommandOrder(pathLst) {
10569
+ const orders = pathListPaths(pathLst).map((path3) => [...commandOrder.get(path3) ?? []]);
10570
+ return orders.some((order) => order.length > 0) ? orders : void 0;
10571
+ }
10572
+ function restorePathListCommandOrder(pathLst, orders) {
10573
+ if (!orders || orders.length === 0) {
10574
+ return;
10575
+ }
10576
+ pathListPaths(pathLst).forEach((path3, index) => {
10577
+ const order = orders[index];
10578
+ if (!order || order.length === 0 || commandOrder.has(path3)) {
10579
+ return;
10580
+ }
10581
+ if (orderSignature([...order]) === pathSignature(path3)) {
10582
+ commandOrder.set(path3, [...order]);
10583
+ }
10584
+ });
10585
+ }
10560
10586
  function orderedXmlKey(baseName, order) {
10561
10587
  return `${baseName}${ORDER_SUFFIX}${order}`;
10562
10588
  }
@@ -33057,6 +33083,13 @@ function parseContentTypes(xml) {
33057
33083
  }
33058
33084
  return { defaults, overrides };
33059
33085
  }
33086
+ function contentTypeForPart(types, partName) {
33087
+ const overridePath = partName.startsWith("/") ? partName : `/${partName}`;
33088
+ const override = types.overrides.get(overridePath);
33089
+ if (override) return override;
33090
+ const extension = partName.split(".").pop()?.toLowerCase();
33091
+ return extension ? types.defaults.get(extension) : void 0;
33092
+ }
33060
33093
  var init_content_types = __esm({
33061
33094
  "opc/content-types.ts"() {
33062
33095
  init_xml2();
@@ -33096,10 +33129,13 @@ function relativePartTarget(basePart, targetPart) {
33096
33129
  }
33097
33130
  async function clonePartGraph(options) {
33098
33131
  const { zip, sourcePart, targetPart, shouldClone } = options;
33099
- const copies = /* @__PURE__ */ new Map([[sourcePart, targetPart]]);
33100
- const types = parseContentTypes(await zip.file("[Content_Types].xml")?.async("string"));
33132
+ const sourceZip = options.sourceZip ?? zip;
33133
+ const copies = options.copies ?? /* @__PURE__ */ new Map();
33134
+ copies.set(sourcePart, targetPart);
33135
+ const types = parseContentTypes(await sourceZip.file("[Content_Types].xml")?.async("string"));
33101
33136
  const reserved = new Set(Object.keys(zip.files));
33102
33137
  reserved.add(targetPart);
33138
+ for (const target of copies.values()) reserved.add(target);
33103
33139
  const allocate = (source) => {
33104
33140
  const match = /^(?<stem>.*?)(?:\d+)?(?<extension>\.[^/.]+)$/u.exec(source);
33105
33141
  const stem = match?.groups?.stem ?? source;
@@ -33111,9 +33147,9 @@ async function clonePartGraph(options) {
33111
33147
  return path3;
33112
33148
  };
33113
33149
  const copyRelationships = async (source, destination) => {
33114
- const contentType = types.overrides.get(`/${source}`);
33150
+ const contentType = contentTypeForPart(types, source);
33115
33151
  if (contentType) await ensureContentTypeOverride(zip, destination, contentType);
33116
- const xml = await zip.file(relationshipsPartFor(source))?.async("string");
33152
+ const xml = await sourceZip.file(relationshipsPartFor(source))?.async("string");
33117
33153
  if (!xml) return;
33118
33154
  const relationships2 = parseRelationships(xml);
33119
33155
  for (const relationship of relationships2.values()) {
@@ -33121,7 +33157,7 @@ async function clonePartGraph(options) {
33121
33157
  const originalTarget = resolvePartPath(source, relationship.target);
33122
33158
  let newTarget = copies.get(originalTarget);
33123
33159
  if (!newTarget && shouldClone(relationship, originalTarget)) {
33124
- const file = zip.file(originalTarget);
33160
+ const file = sourceZip.file(originalTarget);
33125
33161
  if (!file) throw new Error(`Cannot clone missing package part: ${originalTarget}`);
33126
33162
  newTarget = allocate(originalTarget);
33127
33163
  copies.set(originalTarget, newTarget);
@@ -41789,7 +41825,7 @@ function resolveCellValue(cell, sharedStrings) {
41789
41825
  }
41790
41826
  async function parseEmbeddedXlsx(xlsxData) {
41791
41827
  try {
41792
- const xlsxZip = await JSZip6__default.default.loadAsync(xlsxData);
41828
+ const xlsxZip = await JSZip7__default.default.loadAsync(xlsxData);
41793
41829
  const xmlParser = new fastXmlParser.XMLParser({
41794
41830
  ignoreAttributes: false,
41795
41831
  attributeNamePrefix: "@_",
@@ -50065,6 +50101,7 @@ var init_custom_geometry_parser = __esm({
50065
50101
  // pptx/core/geometry/custom-geometry-live-eval.ts
50066
50102
  function pathNodesOf(rawData) {
50067
50103
  const pathLst = rawData?.pathLstXml;
50104
+ restorePathListCommandOrder(pathLst, rawData?.pathCommandOrder);
50068
50105
  return ensureArrayValue(pathLst?.["a:path"]);
50069
50106
  }
50070
50107
  function evaluateCustomGeometryPaths(rawData, pathWidth, pathHeight, overrides) {
@@ -50104,6 +50141,7 @@ var init_custom_geometry_live_eval = __esm({
50104
50141
  "pptx/core/geometry/custom-geometry-live-eval.ts"() {
50105
50142
  init_utils();
50106
50143
  init_custom_geometry();
50144
+ init_custom_geometry_command_order();
50107
50145
  init_custom_geometry_guides();
50108
50146
  init_custom_geometry_parser();
50109
50147
  ensureArray7 = (value) => ensureArrayValue(value);
@@ -51278,6 +51316,7 @@ var init_presentation_field_keys = __esm({
51278
51316
  modernCommentAuthors: true,
51279
51317
  conformance: true,
51280
51318
  embedTrueTypeFonts: true,
51319
+ firstSlideNumber: true,
51281
51320
  defaultTextStyle: true
51282
51321
  };
51283
51322
  PRESENTATION_FIELD_NAMES = Object.keys(PRESENTATION_FIELD_KEYS);
@@ -52871,7 +52910,7 @@ function rootRelsXml() {
52871
52910
  <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
52872
52911
  </Relationships>`;
52873
52912
  }
52874
- function presentationXml(width, height, slideCount) {
52913
+ function presentationXml(width, height, slideCount, firstSlideNumber) {
52875
52914
  const slideIdBase = 256;
52876
52915
  const slideRIdBase = 6;
52877
52916
  const sldIdLst = slideCount > 0 ? ` <p:sldIdLst>
@@ -52880,6 +52919,7 @@ ${Array.from(
52880
52919
  (_, i2) => ` <p:sldId id="${slideIdBase + i2}" r:id="rId${slideRIdBase + i2}"/>`
52881
52920
  ).join("\n")}
52882
52921
  </p:sldIdLst>` : "";
52922
+ const firstSlideNum = firstSlideNumber === void 0 ? "" : ` firstSlideNum="${Math.trunc(firstSlideNumber)}"`;
52883
52923
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
52884
52924
  <p:presentation xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
52885
52925
  xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
@@ -52887,7 +52927,7 @@ ${Array.from(
52887
52927
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
52888
52928
  xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main"
52889
52929
  xmlns:p15="http://schemas.microsoft.com/office/powerpoint/2012/main"
52890
- saveSubsetFonts="1">
52930
+ saveSubsetFonts="1"${firstSlideNum}>
52891
52931
  <p:sldMasterIdLst>
52892
52932
  <p:sldMasterId id="2147483648" r:id="rId1"/>
52893
52933
  </p:sldMasterIdLst>
@@ -53121,10 +53161,13 @@ async function buildBlankPresentationArchive(options) {
53121
53161
  const layoutCount = STANDARD_LAYOUTS.length;
53122
53162
  const initialSlideCount = Math.max(0, options?.initialSlideCount ?? 0);
53123
53163
  const blankLayoutIdx = STANDARD_LAYOUTS.findIndex((l) => l.type === "blank") + 1 || 7;
53124
- const zip = new JSZip6__default.default();
53164
+ const zip = new JSZip7__default.default();
53125
53165
  zip.file("[Content_Types].xml", contentTypesXml(layoutCount, initialSlideCount));
53126
53166
  zip.file("_rels/.rels", rootRelsXml());
53127
- zip.file("ppt/presentation.xml", presentationXml(width, height, initialSlideCount));
53167
+ zip.file(
53168
+ "ppt/presentation.xml",
53169
+ presentationXml(width, height, initialSlideCount, options?.firstSlideNumber)
53170
+ );
53128
53171
  zip.file("ppt/_rels/presentation.xml.rels", presentationRelsXml(layoutCount, initialSlideCount));
53129
53172
  zip.file("ppt/slideMasters/slideMaster1.xml", slideMasterXml(layoutCount));
53130
53173
  zip.file("ppt/slideMasters/_rels/slideMaster1.xml.rels", slideMasterRelsXml(layoutCount));
@@ -55806,7 +55849,13 @@ var init_PptxSlideNotesPartUpdater = __esm({
55806
55849
  init.slideNotesRelationshipType,
55807
55850
  `../notesSlides/${fileName}`
55808
55851
  );
55809
- init.zip.file(notesPath, init.xmlBuilder.build(this.buildNotesSlide(init.slide, strict)));
55852
+ const notesXmlObject = this.buildNotesSlide(init.slide, strict);
55853
+ init.updateNotesXmlText(
55854
+ notesXmlObject,
55855
+ init.slide.notes ?? init.slide.notesSegments?.map((segment) => segment.text).join("") ?? "",
55856
+ init.slide.notesSegments
55857
+ );
55858
+ init.zip.file(notesPath, init.xmlBuilder.build(notesXmlObject));
55810
55859
  init.zip.file(
55811
55860
  `ppt/notesSlides/_rels/${fileName}.rels`,
55812
55861
  init.xmlBuilder.build({
@@ -60490,7 +60539,7 @@ function parseShapeLockNode(node, spec) {
60490
60539
  return void 0;
60491
60540
  }
60492
60541
  const locks = {};
60493
- let hasAny = false;
60542
+ let hasAny2 = false;
60494
60543
  for (const prop of spec.permitted) {
60495
60544
  const raw = node[LOCK_ATTRIBUTE[prop]];
60496
60545
  if (raw === void 0) {
@@ -60498,9 +60547,9 @@ function parseShapeLockNode(node, spec) {
60498
60547
  }
60499
60548
  const value = String(raw).trim().toLowerCase();
60500
60549
  locks[prop] = value === "1" || value === "true";
60501
- hasAny = true;
60550
+ hasAny2 = true;
60502
60551
  }
60503
- return hasAny ? locks : void 0;
60552
+ return hasAny2 ? locks : void 0;
60504
60553
  }
60505
60554
  var LOCK_ATTRIBUTE, MODELLED_ATTRIBUTES, CARRIED_WHEN_UNSET;
60506
60555
  var init_shape_lock_node = __esm({
@@ -61367,6 +61416,7 @@ var init_PptxLoadDataBuilder = __esm({
61367
61416
  modernCommentAuthors;
61368
61417
  conformance;
61369
61418
  embedTrueTypeFonts;
61419
+ firstSlideNumber;
61370
61420
  defaultTextStyle;
61371
61421
  withDimensions(width, height, widthEmu, heightEmu) {
61372
61422
  this.width = width;
@@ -61536,6 +61586,10 @@ var init_PptxLoadDataBuilder = __esm({
61536
61586
  this.embedTrueTypeFonts = embedTrueTypeFonts;
61537
61587
  return this;
61538
61588
  }
61589
+ withFirstSlideNumber(firstSlideNumber) {
61590
+ this.firstSlideNumber = firstSlideNumber;
61591
+ return this;
61592
+ }
61539
61593
  withDefaultTextStyle(defaultTextStyle) {
61540
61594
  this.defaultTextStyle = defaultTextStyle;
61541
61595
  return this;
@@ -61587,6 +61641,7 @@ var init_PptxLoadDataBuilder = __esm({
61587
61641
  modernCommentAuthors: this.modernCommentAuthors,
61588
61642
  conformance: this.conformance,
61589
61643
  embedTrueTypeFonts: this.embedTrueTypeFonts,
61644
+ firstSlideNumber: this.firstSlideNumber,
61590
61645
  defaultTextStyle: this.defaultTextStyle
61591
61646
  };
61592
61647
  }
@@ -65491,6 +65546,297 @@ var init_native_animation_media_duration = __esm({
65491
65546
  }
65492
65547
  });
65493
65548
 
65549
+ // pptx/core/services/editor-animation-entry.ts
65550
+ function hasAuthoredAnimationEffect(entry2) {
65551
+ return Boolean(
65552
+ [entry2.entrance, entry2.exit, entry2.emphasis].some((preset) => preset && preset !== "none") || entry2.motionPath
65553
+ );
65554
+ }
65555
+ function animationFor(slideAnimations, elementId) {
65556
+ return slideAnimations.find((a) => a.elementId === elementId);
65557
+ }
65558
+ var init_editor_animation_entry = __esm({
65559
+ "pptx/core/services/editor-animation-entry.ts"() {
65560
+ }
65561
+ });
65562
+
65563
+ // pptx/core/services/native-animation-after-effect.ts
65564
+ function hasAfterEffectFlag(cTn) {
65565
+ const raw = cTn?.["@_afterEffect"];
65566
+ return raw === "1" || raw === "true";
65567
+ }
65568
+ function extractSrgbHex(colorContainer) {
65569
+ const srgb = colorContainer?.["a:srgbClr"];
65570
+ const val = srgb?.["@_val"];
65571
+ return val !== void 0 ? `#${String(val).toUpperCase()}` : void 0;
65572
+ }
65573
+ function findDimBehaviour(subTnLst) {
65574
+ for (const node of ensureArray10(subTnLst["p:animClr"])) {
65575
+ const cBhvr = node["p:cBhvr"];
65576
+ if (extractAttrNameFromCBhvr(cBhvr) !== "ppt_c") {
65577
+ continue;
65578
+ }
65579
+ if (!hasAfterEffectFlag(cBhvr?.["p:cTn"])) {
65580
+ continue;
65581
+ }
65582
+ const toNode = node["p:to"];
65583
+ const color2 = extractSrgbHex(toNode);
65584
+ if (color2) {
65585
+ return { action: "dimToColor", color: color2 };
65586
+ }
65587
+ const colorRef = themeColorRefFromSchemeClr(toNode?.["a:schemeClr"]);
65588
+ return colorRef ? { action: "dimToColor", colorRef } : { action: "dimToColor" };
65589
+ }
65590
+ return void 0;
65591
+ }
65592
+ function findHideBehaviour(subTnLst) {
65593
+ for (const node of ensureArray10(subTnLst["p:set"])) {
65594
+ const cBhvr = node["p:cBhvr"];
65595
+ if (extractAttrNameFromCBhvr(cBhvr) !== "style.visibility") {
65596
+ continue;
65597
+ }
65598
+ const innerCTn = cBhvr?.["p:cTn"];
65599
+ if (!hasAfterEffectFlag(innerCTn)) {
65600
+ continue;
65601
+ }
65602
+ const toNode = node["p:to"];
65603
+ const strVal = toNode?.["p:strVal"]?.["@_val"];
65604
+ if (String(strVal ?? "").toLowerCase() !== "hidden") {
65605
+ continue;
65606
+ }
65607
+ const action = innerCTn?.["@_masterRel"] === "sameClick" ? "hideAfterAnimation" : "hideOnNextClick";
65608
+ return { action };
65609
+ }
65610
+ return void 0;
65611
+ }
65612
+ function extractAfterAnimationFromSubTnLst(cTn) {
65613
+ const subTnLst = cTn["p:subTnLst"];
65614
+ if (!subTnLst) {
65615
+ return void 0;
65616
+ }
65617
+ return findDimBehaviour(subTnLst) ?? findHideBehaviour(subTnLst);
65618
+ }
65619
+ var init_native_animation_after_effect = __esm({
65620
+ "pptx/core/services/native-animation-after-effect.ts"() {
65621
+ init_theme_color_ref();
65622
+ init_native_animation_attr_name();
65623
+ init_native_animation_helpers();
65624
+ }
65625
+ });
65626
+
65627
+ // pptx/core/services/animation-after-effect-write.ts
65628
+ function assertAfterAnimationClearSupported(effectCTn) {
65629
+ const shapeIds = /* @__PURE__ */ new Set();
65630
+ const checkTarget = (value) => {
65631
+ if (Array.isArray(value)) {
65632
+ value.forEach(checkTarget);
65633
+ return;
65634
+ }
65635
+ if (!isXmlObject5(value)) return;
65636
+ const shapeTarget = value["p:spTgt"];
65637
+ if (isXmlObject5(shapeTarget) && shapeTarget["@_spid"] !== void 0)
65638
+ shapeIds.add(String(shapeTarget["@_spid"]));
65639
+ if ([
65640
+ "p:bg",
65641
+ "p:txEl",
65642
+ "p:subSp",
65643
+ "p:graphicEl",
65644
+ "p:oleChartEl",
65645
+ "p:sndTgt",
65646
+ "p:inkTgt",
65647
+ "p:sldTgt"
65648
+ ].some((key2) => value[key2] !== void 0))
65649
+ throw new Error("Clearing after-animation supports whole-shape targets only");
65650
+ Object.values(value).forEach(checkTarget);
65651
+ };
65652
+ checkTarget(effectCTn["p:childTnLst"]);
65653
+ if (shapeIds.size > 1)
65654
+ throw new Error("Editing after-animation supports a single whole-shape target only");
65655
+ const sub = effectCTn["p:subTnLst"];
65656
+ if (!isXmlObject5(sub)) return;
65657
+ const countAfterFlags = (value) => {
65658
+ if (Array.isArray(value))
65659
+ return value.reduce((count, child30) => count + countAfterFlags(child30), 0);
65660
+ if (!isXmlObject5(value)) return 0;
65661
+ return Object.entries(value).reduce(
65662
+ (count, [key2, child30]) => count + (key2 === "@_afterEffect" && ["1", "true"].includes(String(child30)) ? 1 : countAfterFlags(child30)),
65663
+ 0
65664
+ );
65665
+ };
65666
+ for (const [key2, value] of Object.entries(sub)) {
65667
+ for (const node of ensureArray10(value)) {
65668
+ const flags = countAfterFlags(node);
65669
+ if (!flags) continue;
65670
+ if (flags !== 1 || !extractAfterAnimationFromSubTnLst({ "p:subTnLst": { [key2]: node } }))
65671
+ throw new Error("Cannot clear an unsupported native after-animation behavior");
65672
+ checkTarget(node);
65673
+ }
65674
+ }
65675
+ if (shapeIds.size > 1)
65676
+ throw new Error("Editing after-animation supports a single whole-shape target only");
65677
+ }
65678
+ function clearAfterAnimationBehavior(effectCTn) {
65679
+ const sub = effectCTn["p:subTnLst"];
65680
+ if (!isXmlObject5(sub)) return;
65681
+ for (const key2 of Object.keys(sub)) {
65682
+ const nodes = ensureArray10(sub[key2]);
65683
+ const remaining = nodes.filter(
65684
+ (node) => !extractAfterAnimationFromSubTnLst({ "p:subTnLst": { [key2]: node } })
65685
+ );
65686
+ if (remaining.length === nodes.length) continue;
65687
+ if (remaining.length === 0) delete sub[key2];
65688
+ else sub[key2] = remaining.length === 1 ? remaining[0] : remaining;
65689
+ }
65690
+ if (Object.keys(sub).length === 0) delete effectCTn["p:subTnLst"];
65691
+ }
65692
+ function applyAfterAnimationBehavior(effectCTn, anim, shapeId) {
65693
+ if (anim.afterAnimation === void 0) return;
65694
+ if (anim.afterAnimation === "none") {
65695
+ assertAfterAnimationClearSupported(effectCTn);
65696
+ clearAfterAnimationBehavior(effectCTn);
65697
+ return;
65698
+ }
65699
+ assertAfterAnimationClearSupported(effectCTn);
65700
+ clearAfterAnimationBehavior(effectCTn);
65701
+ delete effectCTn["@_afterEffect"];
65702
+ if (anim.afterAnimation === "dimToColor" && anim.afterAnimationColor) {
65703
+ appendAfterAnimationBehavior(effectCTn, buildDimSubTnLst(shapeId, anim.afterAnimationColor));
65704
+ return;
65705
+ }
65706
+ if (anim.afterAnimation === "hideAfterAnimation") {
65707
+ const entranceId = effectCTn["@_id"] !== void 0 ? String(effectCTn["@_id"]) : "0";
65708
+ appendAfterAnimationBehavior(effectCTn, buildHideSubTnLst(shapeId, "sameClick", entranceId));
65709
+ return;
65710
+ }
65711
+ if (anim.afterAnimation === "hideOnNextClick") {
65712
+ appendAfterAnimationBehavior(effectCTn, buildHideSubTnLst(shapeId, "nextClick"));
65713
+ }
65714
+ }
65715
+ function appendAfterAnimationBehavior(effect, addition) {
65716
+ const sub = isXmlObject5(effect["p:subTnLst"]) ? effect["p:subTnLst"] : {};
65717
+ for (const [key2, value] of Object.entries(addition)) {
65718
+ const nodes = [...ensureArray10(sub[key2]), ...ensureArray10(value)];
65719
+ sub[key2] = nodes.length === 1 ? nodes[0] : nodes;
65720
+ }
65721
+ effect["p:subTnLst"] = sub;
65722
+ }
65723
+ function buildDimSubTnLst(shapeId, colorHex) {
65724
+ const hex3 = colorHex.replace(/^#/u, "").toUpperCase();
65725
+ return {
65726
+ "p:animClr": {
65727
+ "@_clrSpc": "rgb",
65728
+ "@_dir": "cw",
65729
+ "p:cBhvr": {
65730
+ "@_override": "childStyle",
65731
+ "p:cTn": {
65732
+ "@_dur": "1",
65733
+ "@_fill": "hold",
65734
+ "@_display": "0",
65735
+ "@_masterRel": "nextClick",
65736
+ "@_afterEffect": "1"
65737
+ },
65738
+ "p:tgtEl": { "p:spTgt": { "@_spid": shapeId } },
65739
+ "p:attrNameLst": { "p:attrName": "ppt_c" }
65740
+ },
65741
+ "p:to": { "a:srgbClr": { "@_val": hex3 } }
65742
+ }
65743
+ };
65744
+ }
65745
+ function buildHideSubTnLst(shapeId, masterRel, entranceId) {
65746
+ const cTn = {
65747
+ "@_dur": "1",
65748
+ "@_fill": "hold",
65749
+ "@_display": "0",
65750
+ "@_masterRel": masterRel,
65751
+ "@_afterEffect": "1"
65752
+ };
65753
+ if (masterRel === "sameClick") {
65754
+ cTn["p:stCondLst"] = {
65755
+ "p:cond": {
65756
+ "@_evt": "end",
65757
+ "@_delay": "0",
65758
+ "p:tn": { "@_val": entranceId ?? "0" }
65759
+ }
65760
+ };
65761
+ }
65762
+ return {
65763
+ "p:set": {
65764
+ "p:cBhvr": {
65765
+ "@_override": "childStyle",
65766
+ "p:cTn": cTn,
65767
+ "p:tgtEl": { "p:spTgt": { "@_spid": shapeId } },
65768
+ "p:attrNameLst": { "p:attrName": "style.visibility" }
65769
+ },
65770
+ "p:to": { "p:strVal": { "@_val": "hidden" } }
65771
+ }
65772
+ };
65773
+ }
65774
+ var init_animation_after_effect_write = __esm({
65775
+ "pptx/core/services/animation-after-effect-write.ts"() {
65776
+ init_native_animation_after_effect();
65777
+ init_native_animation_helpers();
65778
+ }
65779
+ });
65780
+
65781
+ // pptx/core/services/editor-animation-after-effect.ts
65782
+ function mergeNativeAfterAnimationIntoEditorAnimations(nativeAnimations, animations, rawTiming) {
65783
+ for (const native of nativeAnimations ?? []) {
65784
+ const existing = native.targetId ? animationFor(animations, native.targetId) : void 0;
65785
+ const action = native.afterAnimationAction ?? (existing?.afterAnimation !== void 0 ? "none" : void 0);
65786
+ if ((nativeAnimations ?? []).filter(
65787
+ (other) => other.targetId === native.targetId && ["entr", "emph"].includes(other.presetClass ?? "")
65788
+ ).length !== 1)
65789
+ continue;
65790
+ if (!native.targetId || !action || !["entr", "emph"].includes(native.presetClass ?? "") || native.textTarget)
65791
+ continue;
65792
+ if (native.target && (native.target.type !== "shape" || native.target.backgroundOnly || native.target.subShapeId || native.target.graphicElement || native.target.oleChartElement))
65793
+ continue;
65794
+ try {
65795
+ if (rawTiming && native.target?.type === "shape" && indexEffectNodes(rawTiming).filter(
65796
+ (ref) => ref.spid === (native.target?.type === "shape" ? native.target.shapeId : void 0) && ["entr", "emph"].includes(ref.presetClass)
65797
+ ).length !== 1)
65798
+ continue;
65799
+ const effect = rawTiming ? indexEffectNodes(rawTiming).find(
65800
+ (ref) => String(ref.cTn["@_id"]) === String(native.nodeId) && native.target?.type === "shape" && ref.spid === native.target.shapeId
65801
+ ) : void 0;
65802
+ if (rawTiming && !effect) continue;
65803
+ assertAfterAnimationClearSupported(
65804
+ effect?.cTn ?? { "p:subTnLst": native.cTnAttributes?.["p:subTnLst"] }
65805
+ );
65806
+ } catch {
65807
+ continue;
65808
+ }
65809
+ let entry2 = animationFor(animations, native.targetId);
65810
+ if (!entry2) {
65811
+ entry2 = { elementId: native.targetId };
65812
+ animations.push(entry2);
65813
+ }
65814
+ if (entry2.nativeAfterAnimation !== void 0) continue;
65815
+ entry2.nativeAfterAnimation = action;
65816
+ entry2.nativeAfterAnimationColor = native.afterAnimationColor;
65817
+ }
65818
+ }
65819
+ function isNativeAfterAnimationFallback(entry2) {
65820
+ return entry2.nativeAfterAnimation !== void 0 && Object.entries(entry2).every(
65821
+ ([key2, value]) => value === void 0 || [
65822
+ "elementId",
65823
+ "nativeAfterAnimation",
65824
+ "nativeAfterAnimationColor",
65825
+ "soundRId",
65826
+ "soundPath",
65827
+ "soundName",
65828
+ "stopSound"
65829
+ ].includes(key2)
65830
+ );
65831
+ }
65832
+ var init_editor_animation_after_effect = __esm({
65833
+ "pptx/core/services/editor-animation-after-effect.ts"() {
65834
+ init_editor_animation_entry();
65835
+ init_animation_after_effect_write();
65836
+ init_animation_timing_tree();
65837
+ }
65838
+ });
65839
+
65494
65840
  // pptx/core/services/slide-name.ts
65495
65841
  function asNode3(value) {
65496
65842
  return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
@@ -65821,6 +66167,7 @@ var init_PptxSlideLoaderService = __esm({
65821
66167
  init_animation_target_reconcile();
65822
66168
  init_animation_timeline_anchors();
65823
66169
  init_native_animation_media_duration();
66170
+ init_editor_animation_after_effect();
65824
66171
  init_slide_name();
65825
66172
  init_slide_transition_envelope();
65826
66173
  PptxSlideLoaderService = class {
@@ -66032,6 +66379,8 @@ var init_PptxSlideLoaderService = __esm({
66032
66379
  }
66033
66380
  });
66034
66381
  reconcileAnimationTargets(elements2, nativeAnimations, animations, animationTimelineAnchors);
66382
+ animations ??= [];
66383
+ mergeNativeAfterAnimationIntoEditorAnimations(nativeAnimations, animations, rawTiming);
66035
66384
  mergeNativeSoundIntoEditorAnimations(nativeAnimations, animations);
66036
66385
  mergeNativeBuildTemplatesIntoEditorAnimations(nativeAnimations, animations);
66037
66386
  applyHiddenFlagFromRawXml(elements2);
@@ -66374,6 +66723,7 @@ function sortOrder(animation) {
66374
66723
  var PptxEditorAnimationService;
66375
66724
  var init_PptxEditorAnimationService = __esm({
66376
66725
  "pptx/core/services/PptxEditorAnimationService.ts"() {
66726
+ init_editor_animation_after_effect();
66377
66727
  init_editor_animation_normalizers();
66378
66728
  init_editor_animation_trigger_meta();
66379
66729
  PptxEditorAnimationService = class {
@@ -66472,7 +66822,7 @@ var init_PptxEditorAnimationService = __esm({
66472
66822
  * @param animations - Editor animations to serialize.
66473
66823
  */
66474
66824
  applyEditorAnimations(slideNode, animations) {
66475
- const sequenced = [...animations].sort((left, right) => sortOrder(left) - sortOrder(right));
66825
+ const sequenced = animations.filter((entry2) => !isNativeAfterAnimationFallback(entry2)).sort((left, right) => sortOrder(left) - sortOrder(right));
66476
66826
  const sanitizedAnimations = sequenced.map((animation) => {
66477
66827
  const elementId = String(animation.elementId || "").trim();
66478
66828
  if (elementId.length === 0) {
@@ -66486,7 +66836,7 @@ var init_PptxEditorAnimationService = __esm({
66486
66836
  const orderIsTreeDerived = animation.orderFromTimeline !== void 0 && animation.order === animation.orderFromTimeline;
66487
66837
  const order = typeof animation.order === "number" && Number.isFinite(animation.order) && !orderIsTreeDerived ? Math.round(animation.order) : void 0;
66488
66838
  const repeatCount = typeof animation.repeatCount === "number" && Number.isFinite(animation.repeatCount) && animation.repeatCount > 0 ? animation.repeatCount : void 0;
66489
- if (!entrance && !exit2 && !emphasis && !animation.motionPath) {
66839
+ if (!entrance && !exit2 && !emphasis && !animation.motionPath && animation.afterAnimation === void 0) {
66490
66840
  return null;
66491
66841
  }
66492
66842
  return {
@@ -66971,70 +67321,6 @@ var init_animation_effect_filter_parsing = __esm({
66971
67321
  }
66972
67322
  });
66973
67323
 
66974
- // pptx/core/services/native-animation-after-effect.ts
66975
- function hasAfterEffectFlag(cTn) {
66976
- const raw = cTn?.["@_afterEffect"];
66977
- return raw === "1" || raw === "true";
66978
- }
66979
- function extractSrgbHex(colorContainer) {
66980
- const srgb = colorContainer?.["a:srgbClr"];
66981
- const val = srgb?.["@_val"];
66982
- return val !== void 0 ? `#${String(val).toUpperCase()}` : void 0;
66983
- }
66984
- function findDimBehaviour(subTnLst) {
66985
- for (const node of ensureArray10(subTnLst["p:animClr"])) {
66986
- const cBhvr = node["p:cBhvr"];
66987
- if (extractAttrNameFromCBhvr(cBhvr) !== "ppt_c") {
66988
- continue;
66989
- }
66990
- if (!hasAfterEffectFlag(cBhvr?.["p:cTn"])) {
66991
- continue;
66992
- }
66993
- const toNode = node["p:to"];
66994
- const color2 = extractSrgbHex(toNode);
66995
- if (color2) {
66996
- return { action: "dimToColor", color: color2 };
66997
- }
66998
- const colorRef = themeColorRefFromSchemeClr(toNode?.["a:schemeClr"]);
66999
- return colorRef ? { action: "dimToColor", colorRef } : { action: "dimToColor" };
67000
- }
67001
- return void 0;
67002
- }
67003
- function findHideBehaviour(subTnLst) {
67004
- for (const node of ensureArray10(subTnLst["p:set"])) {
67005
- const cBhvr = node["p:cBhvr"];
67006
- if (extractAttrNameFromCBhvr(cBhvr) !== "style.visibility") {
67007
- continue;
67008
- }
67009
- const innerCTn = cBhvr?.["p:cTn"];
67010
- if (!hasAfterEffectFlag(innerCTn)) {
67011
- continue;
67012
- }
67013
- const toNode = node["p:to"];
67014
- const strVal = toNode?.["p:strVal"]?.["@_val"];
67015
- if (String(strVal ?? "").toLowerCase() !== "hidden") {
67016
- continue;
67017
- }
67018
- const action = innerCTn?.["@_masterRel"] === "sameClick" ? "hideAfterAnimation" : "hideOnNextClick";
67019
- return { action };
67020
- }
67021
- return void 0;
67022
- }
67023
- function extractAfterAnimationFromSubTnLst(cTn) {
67024
- const subTnLst = cTn["p:subTnLst"];
67025
- if (!subTnLst) {
67026
- return void 0;
67027
- }
67028
- return findDimBehaviour(subTnLst) ?? findHideBehaviour(subTnLst);
67029
- }
67030
- var init_native_animation_after_effect = __esm({
67031
- "pptx/core/services/native-animation-after-effect.ts"() {
67032
- init_theme_color_ref();
67033
- init_native_animation_attr_name();
67034
- init_native_animation_helpers();
67035
- }
67036
- });
67037
-
67038
67324
  // pptx/core/services/native-animation-cbhvr-attrs.ts
67039
67325
  function extractCBhvrAttrs(cBhvr) {
67040
67326
  if (!cBhvr) {
@@ -67183,6 +67469,16 @@ function readTiming(cTn) {
67183
67469
  return {};
67184
67470
  }
67185
67471
  const timing = {};
67472
+ const starts = ensureArray10(cTn["p:stCondLst"]?.["p:cond"]);
67473
+ if (starts.length > 1 || cTn["@_dur"] === "indefinite" || cTn["@_repeatCount"] === "indefinite" || cTn["@_repeatDur"] !== void 0 || cTn["p:endCondLst"] !== void 0 || cTn["p:endSync"] !== void 0 || starts.some(
67474
+ (condition) => condition === null || typeof condition !== "object" || condition["@_evt"] !== void 0 || condition["@_tn"] !== void 0 || condition["@_rtn"] !== void 0 || condition["p:tn"] !== void 0 || condition["p:rtn"] !== void 0 || condition["p:tgtEl"] !== void 0 || condition["@_delay"] !== void 0 && !/^\d+$/u.test(String(condition["@_delay"])) || condition["@_delay"] === "indefinite"
67475
+ )) {
67476
+ timing.unsupportedSetTiming = true;
67477
+ }
67478
+ const fill = cTn["@_fill"];
67479
+ if (fill === "remove" || fill === "freeze" || fill === "hold" || fill === "transition") {
67480
+ timing.fill = fill;
67481
+ }
67186
67482
  const durationMs = readTimingAttr(cTn["@_dur"]);
67187
67483
  if (durationMs !== void 0) {
67188
67484
  timing.durationMs = durationMs;
@@ -67588,6 +67884,7 @@ function buildTimingNodeAnimation(cTn, trigger, group) {
67588
67884
  commandString: cmdInfo2.commandString,
67589
67885
  textTarget: textTarget ?? void 0,
67590
67886
  cTnAttributes: roundTripAttrs,
67887
+ unsupportedOpacitySetTiming: cTn["@_dur"] === "indefinite" || cTn["p:endSync"] !== void 0 || void 0,
67591
67888
  afterEffect: afterEffectFlag,
67592
67889
  afterAnimationAction: parsedAfterAnimation?.action,
67593
67890
  afterAnimationColor: parsedAfterAnimation?.color,
@@ -68391,79 +68688,6 @@ var init_PptxSlideTransitionService = __esm({
68391
68688
  }
68392
68689
  });
68393
68690
 
68394
- // pptx/core/services/animation-after-effect-write.ts
68395
- function applyAfterAnimationBehavior(effectCTn, anim, shapeId) {
68396
- delete effectCTn["p:subTnLst"];
68397
- delete effectCTn["@_afterEffect"];
68398
- if (anim.afterAnimation === "dimToColor" && anim.afterAnimationColor) {
68399
- effectCTn["p:subTnLst"] = buildDimSubTnLst(shapeId, anim.afterAnimationColor);
68400
- return;
68401
- }
68402
- if (anim.afterAnimation === "hideAfterAnimation") {
68403
- const entranceId = effectCTn["@_id"] !== void 0 ? String(effectCTn["@_id"]) : "0";
68404
- effectCTn["p:subTnLst"] = buildHideSubTnLst(shapeId, "sameClick", entranceId);
68405
- return;
68406
- }
68407
- if (anim.afterAnimation === "hideOnNextClick") {
68408
- effectCTn["p:subTnLst"] = buildHideSubTnLst(shapeId, "nextClick");
68409
- }
68410
- }
68411
- function buildDimSubTnLst(shapeId, colorHex) {
68412
- const hex3 = colorHex.replace(/^#/u, "").toUpperCase();
68413
- return {
68414
- "p:animClr": {
68415
- "@_clrSpc": "rgb",
68416
- "@_dir": "cw",
68417
- "p:cBhvr": {
68418
- "@_override": "childStyle",
68419
- "p:cTn": {
68420
- "@_dur": "1",
68421
- "@_fill": "hold",
68422
- "@_display": "0",
68423
- "@_masterRel": "nextClick",
68424
- "@_afterEffect": "1"
68425
- },
68426
- "p:tgtEl": { "p:spTgt": { "@_spid": shapeId } },
68427
- "p:attrNameLst": { "p:attrName": "ppt_c" }
68428
- },
68429
- "p:to": { "a:srgbClr": { "@_val": hex3 } }
68430
- }
68431
- };
68432
- }
68433
- function buildHideSubTnLst(shapeId, masterRel, entranceId) {
68434
- const cTn = {
68435
- "@_dur": "1",
68436
- "@_fill": "hold",
68437
- "@_display": "0",
68438
- "@_masterRel": masterRel,
68439
- "@_afterEffect": "1"
68440
- };
68441
- if (masterRel === "sameClick") {
68442
- cTn["p:stCondLst"] = {
68443
- "p:cond": {
68444
- "@_evt": "end",
68445
- "@_delay": "0",
68446
- "p:tn": { "@_val": entranceId ?? "0" }
68447
- }
68448
- };
68449
- }
68450
- return {
68451
- "p:set": {
68452
- "p:cBhvr": {
68453
- "@_override": "childStyle",
68454
- "p:cTn": cTn,
68455
- "p:tgtEl": { "p:spTgt": { "@_spid": shapeId } },
68456
- "p:attrNameLst": { "p:attrName": "style.visibility" }
68457
- },
68458
- "p:to": { "p:strVal": { "@_val": "hidden" } }
68459
- }
68460
- };
68461
- }
68462
- var init_animation_after_effect_write = __esm({
68463
- "pptx/core/services/animation-after-effect-write.ts"() {
68464
- }
68465
- });
68466
-
68467
68691
  // pptx/core/services/animation-behavior-captures.json
68468
68692
  var animation_behavior_captures_default;
68469
68693
  var init_animation_behavior_captures = __esm({
@@ -86678,6 +86902,33 @@ function updateEffectNodeAttributes(cTn, anim, presetClass, shapeId, allocateId)
86678
86902
  applySoundToEffectCTn(cTn, anim);
86679
86903
  }
86680
86904
  function surgicallyUpdateTimingTree(rawTiming, animations) {
86905
+ const sourceRefs = indexEffectNodes(rawTiming);
86906
+ for (const entry2 of animations.filter((animation) => animation.afterAnimation !== void 0)) {
86907
+ if (sourceRefs.filter(
86908
+ (ref) => ref.spid === entry2.elementId && ["entr", "emph"].includes(ref.presetClass)
86909
+ ).length > 1)
86910
+ throw new Error(
86911
+ "Cannot edit an ambiguous native after-animation target with multiple effects"
86912
+ );
86913
+ }
86914
+ const explicitClears = new Map(
86915
+ animations.filter((a) => a.afterAnimation !== void 0 && !hasAuthoredAnimationEffect(a)).map((a) => [a.elementId, a])
86916
+ );
86917
+ const clearRefs = sourceRefs.filter(
86918
+ (ref) => ref.spid && explicitClears.has(ref.spid) && (ref.presetClass === "entr" || ref.presetClass === "emph")
86919
+ );
86920
+ for (const target of explicitClears.keys()) {
86921
+ if (!clearRefs.some((ref) => ref.spid === target))
86922
+ throw new Error("Cannot edit after-animation without a supported native effect");
86923
+ if (clearRefs.filter((ref) => ref.spid === target).length > 1)
86924
+ throw new Error(
86925
+ "Cannot clear an ambiguous native after-animation target with multiple effects"
86926
+ );
86927
+ }
86928
+ clearRefs.forEach((ref) => assertAfterAnimationClearSupported(ref.cTn));
86929
+ clearRefs.forEach(
86930
+ (ref) => applyAfterAnimationBehavior(ref.cTn, explicitClears.get(ref.spid), ref.spid)
86931
+ );
86681
86932
  const desired = collectDesiredEffects(animations);
86682
86933
  const previouslyOwned = readOwnedEffectKeys(rawTiming);
86683
86934
  if (desired.length === 0 && previouslyOwned.size === 0) {
@@ -86744,6 +86995,7 @@ function surgicallyUpdateTimingTree(rawTiming, animations) {
86744
86995
  }
86745
86996
  var init_animation_timing_surgical = __esm({
86746
86997
  "pptx/core/services/animation-timing-surgical.ts"() {
86998
+ init_editor_animation_entry();
86747
86999
  init_animation_after_effect_write();
86748
87000
  init_animation_behavior_captured();
86749
87001
  init_animation_timing_build_surgical();
@@ -86794,9 +87046,11 @@ var init_PptxAnimationWriteService = __esm({
86794
87046
  const validAnimations = animations.filter((a) => a.entrance || a.exit || a.emphasis || a.motionPath).sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
86795
87047
  if (existingRawTiming) {
86796
87048
  const cloned = typeof structuredClone === "function" ? structuredClone(existingRawTiming) : JSON.parse(JSON.stringify(existingRawTiming));
86797
- return surgicallyUpdateTimingTree(cloned, validAnimations);
87049
+ return surgicallyUpdateTimingTree(cloned, animations);
86798
87050
  }
86799
87051
  if (validAnimations.length === 0) {
87052
+ if (animations.some((entry2) => entry2.afterAnimation !== void 0))
87053
+ throw new Error("Cannot edit after-animation without a supported native effect");
86800
87054
  return void 0;
86801
87055
  }
86802
87056
  this.nextId = 1;
@@ -88339,6 +88593,341 @@ var init_header_footer_parts = __esm({
88339
88593
  }
88340
88594
  });
88341
88595
 
88596
+ // pptx/core/utils/chart-xlsx-write-validation.ts
88597
+ function unsupported(reason) {
88598
+ throw new Error(`Chart label replacement requires direct literal workbook cells: ${reason}.`);
88599
+ }
88600
+ async function validateAtomicChartWorkbookWrites(zip, parser, paths, writes, requireCurrentValues = false) {
88601
+ const relationships2 = xmlChild(
88602
+ parser.parse(
88603
+ await zip.file("xl/_rels/workbook.xml.rels")?.async("string") ?? ""
88604
+ ),
88605
+ "Relationships"
88606
+ );
88607
+ for (const rel of xmlChildren(relationships2, "Relationship")) {
88608
+ if (xmlAttr(rel, "TargetMode") === "External") {
88609
+ unsupported("external worksheet relationships are not supported");
88610
+ }
88611
+ }
88612
+ const sheets = /* @__PURE__ */ new Map();
88613
+ const cellsByPath = /* @__PURE__ */ new Map();
88614
+ for (const path3 of new Set(paths.values())) {
88615
+ const file = zip.file(path3);
88616
+ if (!file) {
88617
+ unsupported("a referenced worksheet is missing");
88618
+ }
88619
+ let tree;
88620
+ try {
88621
+ tree = parser.parse(await file.async("string"));
88622
+ } catch {
88623
+ unsupported("a worksheet cannot be parsed");
88624
+ }
88625
+ const data = xmlChild(xmlChild(tree, "worksheet"), "sheetData");
88626
+ if (!data) {
88627
+ unsupported("a worksheet has no cell data");
88628
+ }
88629
+ if (Object.keys(data).some((key2) => key2.includes(":"))) {
88630
+ unsupported("prefixed worksheet cell nodes are not supported");
88631
+ }
88632
+ const cells = /* @__PURE__ */ new Map();
88633
+ for (const row of xmlChildren(data, "row")) {
88634
+ if (Object.keys(row).some((key2) => key2.includes(":"))) {
88635
+ unsupported("prefixed worksheet cell nodes are not supported");
88636
+ }
88637
+ for (const cell of xmlChildren(row, "c")) {
88638
+ const ref = xmlAttr(cell, "r");
88639
+ if (!ref || cells.has(ref)) {
88640
+ unsupported("duplicate or unidentified worksheet cells are not supported");
88641
+ }
88642
+ cells.set(ref, cell);
88643
+ if (Object.keys(cell).some((key2) => key2 === "f" || key2.endsWith(":f"))) {
88644
+ unsupported("formula-dependent workbooks are not supported");
88645
+ }
88646
+ }
88647
+ }
88648
+ sheets.set(path3, data);
88649
+ cellsByPath.set(path3, cells);
88650
+ }
88651
+ const sharedFile = zip.file("xl/sharedStrings.xml");
88652
+ const shared = sharedFile ? xmlChildren(
88653
+ xmlChild(parser.parse(await sharedFile.async("string")), "sst"),
88654
+ "si"
88655
+ ) : [];
88656
+ const destinations = /* @__PURE__ */ new Map();
88657
+ for (const write of writes) {
88658
+ const range = parseChartFormulaRange(write.formula);
88659
+ if (!range || /[\[\]:!]/u.test(range.sheetName)) {
88660
+ unsupported("a range is not a direct local reference");
88661
+ }
88662
+ if ([range.start, range.end].some(
88663
+ (cell) => cell.row < 0 || cell.row >= 1048576 || cell.col < 0 || cell.col >= 16384
88664
+ )) {
88665
+ unsupported("a source cell lies outside the worksheet limits");
88666
+ }
88667
+ const addresses = expandRangeAddresses(range, write.values.length);
88668
+ const path3 = paths.get(range.sheetName.toLowerCase());
88669
+ const data = path3 ? sheets.get(path3) : void 0;
88670
+ if (!addresses || !path3 || !data) {
88671
+ unsupported("a source range cannot be resolved");
88672
+ }
88673
+ for (const [index, address] of addresses.entries()) {
88674
+ const value = write.values[index];
88675
+ const key2 = `${path3}!${address}`;
88676
+ const prior = destinations.get(key2);
88677
+ if (prior && (prior.value !== value || prior.numeric !== write.isNumeric)) {
88678
+ unsupported("overlapping source ranges request conflicting values");
88679
+ }
88680
+ destinations.set(key2, { value, numeric: write.isNumeric });
88681
+ const cell = cellsByPath.get(path3)?.get(address);
88682
+ if (!cell) {
88683
+ unsupported("a source cell is missing");
88684
+ }
88685
+ const type = xmlAttr(cell, "t") ?? "n";
88686
+ const text2 = type === "s" ? shared[Number(xmlText(cell.v))] : xmlChild(cell, "is");
88687
+ if (text2 && Object.keys(text2).some((node) => !node.startsWith("@_") && node !== "t" && node !== "#text")) {
88688
+ unsupported("rich worksheet strings require source-workbook editing");
88689
+ }
88690
+ if (requireCurrentValues) {
88691
+ const current = text2 ? xmlText(text2.t) : xmlText(cell.v);
88692
+ const equal = write.isNumeric ? current !== void 0 && Number(current) === Number(value) : current === value;
88693
+ if (!equal) {
88694
+ unsupported("the workbook and chart caches disagree");
88695
+ }
88696
+ }
88697
+ if (write.isNumeric && !Number.isFinite(Number(value))) {
88698
+ unsupported("a numeric cache value is not finite");
88699
+ }
88700
+ if (!["n", "s", "inlineStr", "str"].includes(type)) {
88701
+ unsupported("a source cell has an unsupported value type");
88702
+ }
88703
+ }
88704
+ }
88705
+ }
88706
+ var init_chart_xlsx_write_validation = __esm({
88707
+ "pptx/core/utils/chart-xlsx-write-validation.ts"() {
88708
+ init_chart_xlsx_cellref();
88709
+ init_xml_access();
88710
+ }
88711
+ });
88712
+ function collectChartWorkbookWrite(xmlLookupService, container2, isNumeric2, values) {
88713
+ if (!container2) {
88714
+ return void 0;
88715
+ }
88716
+ const refNode = xmlLookupService.getChildByLocalName(container2, isNumeric2 ? "numRef" : "strRef");
88717
+ const formula = refNode ? xmlLookupService.getScalarChildByLocalName(refNode, "f") : void 0;
88718
+ return formula ? { formula, isNumeric: isNumeric2, values } : void 0;
88719
+ }
88720
+ function createSpreadsheetXmlParser() {
88721
+ return new fastXmlParser.XMLParser({
88722
+ ignoreAttributes: false,
88723
+ attributeNamePrefix: "@_",
88724
+ trimValues: false,
88725
+ parseTagValue: false,
88726
+ tagValueProcessor: (tagName, tagValue) => preservesSpreadsheetXmlWhitespace(tagName) ? tagValue : tagValue.trim()
88727
+ });
88728
+ }
88729
+ function createSpreadsheetXmlBuilder() {
88730
+ return new fastXmlParser.XMLBuilder({
88731
+ ignoreAttributes: false,
88732
+ attributeNamePrefix: "@_",
88733
+ suppressBooleanAttributes: false,
88734
+ format: false
88735
+ });
88736
+ }
88737
+ async function resolveWorksheetPathsByName(xlsxZip, parser) {
88738
+ const result = /* @__PURE__ */ new Map();
88739
+ const workbookFile = xlsxZip.file("xl/workbook.xml");
88740
+ const relsFile = xlsxZip.file("xl/_rels/workbook.xml.rels");
88741
+ if (!workbookFile || !relsFile) {
88742
+ return result;
88743
+ }
88744
+ try {
88745
+ const workbookTree = parser.parse(await workbookFile.async("string"));
88746
+ const relsTree = parser.parse(await relsFile.async("string"));
88747
+ const targetByRelId = /* @__PURE__ */ new Map();
88748
+ const relationships2 = xmlChild(relsTree, "Relationships");
88749
+ for (const rel of xmlChildren(relationships2, "Relationship")) {
88750
+ const id = xmlAttr(rel, "Id");
88751
+ const target = xmlAttr(rel, "Target");
88752
+ if (id && target) {
88753
+ targetByRelId.set(id, target);
88754
+ }
88755
+ }
88756
+ const workbookRoot = xmlChild(workbookTree, "workbook");
88757
+ const sheets = xmlChild(workbookRoot, "sheets");
88758
+ for (const sheet of xmlChildren(sheets, "sheet")) {
88759
+ const name = xmlAttr(sheet, "name");
88760
+ const relId = xmlAttr(sheet, "r:id") ?? xmlAttr(sheet, "id");
88761
+ const target = relId ? targetByRelId.get(relId) : void 0;
88762
+ if (name && target) {
88763
+ result.set(name.toLowerCase(), resolveWorkbookPartPath(target));
88764
+ }
88765
+ }
88766
+ } catch {
88767
+ }
88768
+ return result;
88769
+ }
88770
+ function resolveWorkbookPartPath(target) {
88771
+ return target.startsWith("/") ? target.slice(1) : `xl/${target}`;
88772
+ }
88773
+ async function writeChartWorkbookUpdates(xlsxBytes, writes, options = {}) {
88774
+ if (writes.length === 0) {
88775
+ return { unresolved: 0 };
88776
+ }
88777
+ let xlsxZip;
88778
+ try {
88779
+ xlsxZip = await JSZip7__default.default.loadAsync(xlsxBytes);
88780
+ } catch {
88781
+ if (options.atomic) {
88782
+ throw new Error("Chart label replacement requires a readable embedded workbook.");
88783
+ }
88784
+ return { unresolved: writes.length };
88785
+ }
88786
+ const parser = createSpreadsheetXmlParser();
88787
+ const sheetPathByName = await resolveWorksheetPathsByName(xlsxZip, parser);
88788
+ if (options.atomic) {
88789
+ await validateAtomicChartWorkbookWrites(
88790
+ xlsxZip,
88791
+ parser,
88792
+ sheetPathByName,
88793
+ writes,
88794
+ options.requireCurrentValues ?? false
88795
+ );
88796
+ }
88797
+ const writesBySheetPath = /* @__PURE__ */ new Map();
88798
+ let unresolved = 0;
88799
+ for (const write of writes) {
88800
+ const range = parseChartFormulaRange(write.formula);
88801
+ const sheetPath = range ? sheetPathByName.get(range.sheetName.toLowerCase()) : void 0;
88802
+ const refs = range ? expandRangeAddresses(range, write.values.length) : void 0;
88803
+ if (!range || !sheetPath || !refs) {
88804
+ unresolved += 1;
88805
+ continue;
88806
+ }
88807
+ const bucket = writesBySheetPath.get(sheetPath) ?? [];
88808
+ bucket.push({ refs, values: write.values, isNumeric: write.isNumeric });
88809
+ writesBySheetPath.set(sheetPath, bucket);
88810
+ }
88811
+ const builder3 = createSpreadsheetXmlBuilder();
88812
+ let changedAny = false;
88813
+ for (const [sheetPath, resolvedWrites] of writesBySheetPath) {
88814
+ const sheetFile = xlsxZip.file(sheetPath);
88815
+ if (!sheetFile) {
88816
+ unresolved += resolvedWrites.length;
88817
+ continue;
88818
+ }
88819
+ try {
88820
+ const sheetTree = parser.parse(await sheetFile.async("string"));
88821
+ const cellWrites = resolvedWrites.flatMap(
88822
+ ({ refs, values, isNumeric: isNumeric2 }) => refs.map((ref, i2) => ({ ref, isNumeric: isNumeric2, value: values[i2] }))
88823
+ );
88824
+ if (applyCellWritesToWorksheet(sheetTree, cellWrites)) {
88825
+ xlsxZip.file(sheetPath, builder3.build(sheetTree));
88826
+ changedAny = true;
88827
+ }
88828
+ } catch {
88829
+ unresolved += resolvedWrites.length;
88830
+ }
88831
+ }
88832
+ if (options.atomic && unresolved > 0) {
88833
+ throw new Error("Chart label replacement could not update every source range.");
88834
+ }
88835
+ if (!changedAny) {
88836
+ return { unresolved };
88837
+ }
88838
+ const bytes = await xlsxZip.generateAsync({
88839
+ type: "uint8array",
88840
+ compression: "DEFLATE",
88841
+ compressionOptions: { level: 6 }
88842
+ });
88843
+ return { bytes, unresolved };
88844
+ }
88845
+ var init_chart_xlsx_writer = __esm({
88846
+ "pptx/core/utils/chart-xlsx-writer.ts"() {
88847
+ init_chart_xlsx_cellref();
88848
+ init_chart_xlsx_write_validation();
88849
+ init_chart_xlsx_sheet_cells();
88850
+ init_xml_access();
88851
+ init_xml_whitespace();
88852
+ }
88853
+ });
88854
+ function formulaCount(value) {
88855
+ if (!value || typeof value !== "object") return 0;
88856
+ if (Array.isArray(value)) return value.reduce((total, item) => total + formulaCount(item), 0);
88857
+ return Object.entries(value).reduce(
88858
+ (total, [key2, child30]) => total + (key2 === "f" || key2.endsWith(":f") ? 1 : formulaCount(child30)),
88859
+ 0
88860
+ );
88861
+ }
88862
+ async function chartLabelsHaveEditableSources(xml, zip, chartSpace, seriesNodes, series, categories, external, chartPartPath, resolve2) {
88863
+ if (!chartSpace || seriesNodes.length !== series.length || !categories.length || external?.isExternal)
88864
+ return false;
88865
+ if (formulaCount(chartSpace) !== seriesNodes.reduce((sum, node) => sum + formulaCount(node), 0))
88866
+ return false;
88867
+ const writes = [];
88868
+ const labelOwners = /* @__PURE__ */ new Map();
88869
+ for (const [index, node] of seriesNodes.entries()) {
88870
+ const entry2 = series[index];
88871
+ for (const [name, numeric, values] of [
88872
+ ["tx", false, [entry2.name]],
88873
+ ["cat", false, [...categories]],
88874
+ ["val", true, entry2.values.map(String)]
88875
+ ]) {
88876
+ const container2 = xml.getChildByLocalName(node, name);
88877
+ if (!container2) return false;
88878
+ const write = collectChartWorkbookWrite(xml, container2, numeric, [...values]);
88879
+ if (write) {
88880
+ writes.push(write);
88881
+ if (!numeric) {
88882
+ const range = parseChartFormulaRange(write.formula);
88883
+ const addresses = range ? expandRangeAddresses(range, values.length) : void 0;
88884
+ if (!range || !addresses) return false;
88885
+ for (const [point2, address] of addresses.entries()) {
88886
+ const key2 = `${range.sheetName.toLowerCase()}!${address}`;
88887
+ const owner = name === "tx" ? `series:${index}` : `category:${point2}`;
88888
+ if (labelOwners.has(key2) && labelOwners.get(key2) !== owner) return false;
88889
+ labelOwners.set(key2, owner);
88890
+ }
88891
+ }
88892
+ } else if (external || !xml.getChildByLocalName(container2, numeric ? "numLit" : "strLit") && !(name === "tx" && xml.getScalarChildByLocalName(container2, "v") !== void 0))
88893
+ return false;
88894
+ }
88895
+ }
88896
+ if (formulaCount(chartSpace) !== writes.length) return false;
88897
+ if (!external) return writes.length === 0;
88898
+ if (!external.targetPath || !external.embeddedWorkbookData) return false;
88899
+ const target = resolve2(chartPartPath, external.targetPath);
88900
+ let references = 0;
88901
+ const parser = new fastXmlParser.XMLParser({ ignoreAttributes: false, attributeNamePrefix: "@_" });
88902
+ try {
88903
+ for (const path3 of Object.keys(zip.files)) {
88904
+ if (!path3.endsWith(".rels") || !path3.includes("/_rels/")) continue;
88905
+ const source = path3.replace("/_rels/", "/").slice(0, -5);
88906
+ const tree = parser.parse(await zip.file(path3).async("string"));
88907
+ for (const rel of xmlChildren(xmlChild(tree, "Relationships"), "Relationship")) {
88908
+ const relationshipTarget2 = xmlAttr(rel, "Target");
88909
+ if (relationshipTarget2 && xmlAttr(rel, "TargetMode") !== "External" && resolve2(source, relationshipTarget2) === target)
88910
+ references++;
88911
+ }
88912
+ }
88913
+ if (references !== 1) return false;
88914
+ await writeChartWorkbookUpdates(external.embeddedWorkbookData, writes, {
88915
+ atomic: true,
88916
+ requireCurrentValues: true
88917
+ });
88918
+ return true;
88919
+ } catch {
88920
+ return false;
88921
+ }
88922
+ }
88923
+ var init_chart_label_source = __esm({
88924
+ "pptx/core/utils/chart-label-source.ts"() {
88925
+ init_chart_xlsx_writer();
88926
+ init_xml_access();
88927
+ init_chart_xlsx_cellref();
88928
+ }
88929
+ });
88930
+
88342
88931
  // pptx/core/utils/chart-band-fmts.ts
88343
88932
  function safeUnsignedInt2(val) {
88344
88933
  const n = Number(val);
@@ -95768,7 +96357,7 @@ function buildContentTypesXml(overrides) {
95768
96357
  }
95769
96358
  async function buildMetroBlobPackage(input) {
95770
96359
  const root = ROOT[input.kind];
95771
- const zip = new JSZip6__default.default();
96360
+ const zip = new JSZip7__default.default();
95772
96361
  const overrides = new Map([
95773
96362
  [root.path, root.contentType],
95774
96363
  ...input.parts.contentTypes,
@@ -96084,7 +96673,7 @@ async function buildOne(zip, slidePath, slideXml3, element) {
96084
96673
  });
96085
96674
  }
96086
96675
  async function buildMetroBlobs(pptxBytes, slides) {
96087
- const zip = await JSZip6__default.default.loadAsync(pptxBytes);
96676
+ const zip = await JSZip7__default.default.loadAsync(pptxBytes);
96088
96677
  const slidePaths = await orderedSlidePaths(zip);
96089
96678
  const out = /* @__PURE__ */ new Map();
96090
96679
  for (let i2 = 0; i2 < slides.length; i2++) {
@@ -99076,7 +99665,7 @@ function withDeclaration(xml) {
99076
99665
  ${body}`;
99077
99666
  }
99078
99667
  async function zipParts(parts) {
99079
- const zip = new JSZip6__default.default();
99668
+ const zip = new JSZip7__default.default();
99080
99669
  for (const [name, text2] of parts) {
99081
99670
  zip.file(name, text2);
99082
99671
  }
@@ -99123,7 +99712,7 @@ async function buildMasterRoundTrip(source) {
99123
99712
  };
99124
99713
  }
99125
99714
  async function buildDeckMasterRoundTripsFromPptx(pptxBytes) {
99126
- const zip = await JSZip6__default.default.loadAsync(pptxBytes);
99715
+ const zip = await JSZip7__default.default.loadAsync(pptxBytes);
99127
99716
  const slidePaths = await readSlideMasterPaths(zip);
99128
99717
  const masterPaths = [...new Set(slidePaths)];
99129
99718
  if (masterPaths.length === 0) {
@@ -102370,6 +102959,18 @@ var init_tag_package = __esm({
102370
102959
  }
102371
102960
  });
102372
102961
 
102962
+ // pptx/core/utils/chart-workbook-data-signature.ts
102963
+ function chartWorkbookDataSignature(data) {
102964
+ return JSON.stringify({
102965
+ categories: data.dateCategories?.values ?? data.categories,
102966
+ series: data.series.map((series) => ({ name: series.name, values: series.values }))
102967
+ });
102968
+ }
102969
+ var init_chart_workbook_data_signature = __esm({
102970
+ "pptx/core/utils/chart-workbook-data-signature.ts"() {
102971
+ }
102972
+ });
102973
+
102373
102974
  // pptx/core/utils/chart-axis-deleted.ts
102374
102975
  function authoredDeleted(node) {
102375
102976
  if (node === void 0) {
@@ -102538,8 +103139,8 @@ function buildDefRPr(style, existing, resolveColor2) {
102538
103139
  return rPr;
102539
103140
  }
102540
103141
  function applyChartAxisTitleStyleToXml(axisNode, style, getLocalName2, resolveColor2) {
102541
- const hasAny = style.fontFamily !== void 0 || style.fontSize !== void 0 || style.fontBold !== void 0 || style.fontColor !== void 0;
102542
- if (!hasAny) {
103142
+ const hasAny2 = style.fontFamily !== void 0 || style.fontSize !== void 0 || style.fontBold !== void 0 || style.fontColor !== void 0;
103143
+ if (!hasAny2) {
102543
103144
  return;
102544
103145
  }
102545
103146
  const titleKey = findKey6(axisNode, "title", getLocalName2);
@@ -103457,6 +104058,33 @@ var init_chart_title_run_alignment = __esm({
103457
104058
  }
103458
104059
  });
103459
104060
 
104061
+ // pptx/core/utils/chart-title-text-edit.ts
104062
+ function patchChartTitleRunText(title, runs, local) {
104063
+ const tx = title[findKey6(title, "tx", local) ?? ""];
104064
+ const rich = tx?.[findKey6(tx, "rich", local) ?? ""];
104065
+ const raw = rich?.[findKey6(rich, "p", local) ?? ""];
104066
+ const paragraphs = Array.isArray(raw) ? raw : raw ? [raw] : [];
104067
+ if (paragraphs.length !== 1) return false;
104068
+ const paragraph = paragraphs[0];
104069
+ if (findKey6(paragraph, "br", local) || findKey6(paragraph, "fld", local)) return false;
104070
+ const rawRuns = paragraph[findKey6(paragraph, "r", local) ?? ""];
104071
+ const original = Array.isArray(rawRuns) ? rawRuns : rawRuns ? [rawRuns] : [];
104072
+ if (original.length !== runs.length) return false;
104073
+ const keys = original.map((run) => findKey6(run, "t", local));
104074
+ if (keys.some((key2) => !key2)) return false;
104075
+ for (const [index, value] of original.entries()) {
104076
+ const run = value, key2 = keys[index];
104077
+ const text2 = run[key2];
104078
+ run[key2] = text2 && typeof text2 === "object" && !Array.isArray(text2) ? { ...text2, "#text": runs[index].text } : runs[index].text;
104079
+ }
104080
+ return true;
104081
+ }
104082
+ var init_chart_title_text_edit = __esm({
104083
+ "pptx/core/utils/chart-title-text-edit.ts"() {
104084
+ init_chart_title_xml_ops();
104085
+ }
104086
+ });
104087
+
103460
104088
  // pptx/core/utils/chart-title-serializer.ts
103461
104089
  function applyChartTitleToXml(chartRoot, model, getLocalName2, options = { prefix: "c" }) {
103462
104090
  const { prefix } = options;
@@ -103482,11 +104110,18 @@ function applyChartTitleToXml(chartRoot, model, getLocalName2, options = { prefi
103482
104110
  runs = realignOrCollapseTitleRuns(staleRuns, model.title);
103483
104111
  }
103484
104112
  let titleNode = existingKey ? chartRoot[existingKey] : void 0;
104113
+ const textOnlyStylesMatch = Boolean(
104114
+ runs && model.titleTextOnlyStyles?.length === runs.length && runs.every(
104115
+ (run, index) => ["bold", "italic", "fontSize", "color"].every(
104116
+ (key2) => run[key2] === model.titleTextOnlyStyles[index][key2]
104117
+ )
104118
+ )
104119
+ );
103485
104120
  if (runs && titleNode && typeof titleNode === "object") {
103486
104121
  const existingTexts = [];
103487
104122
  collectAllText(titleNode, getLocalName2, existingTexts);
103488
104123
  const newTexts = runs.map((run) => run.text);
103489
- if (existingTexts.length === newTexts.length && existingTexts.every((text2, index) => text2 === newTexts[index])) {
104124
+ if ((!model.titleTextOnly || textOnlyStylesMatch) && existingTexts.length === newTexts.length && existingTexts.every((text2, index) => text2 === newTexts[index])) {
103490
104125
  runs = void 0;
103491
104126
  }
103492
104127
  }
@@ -103498,6 +104133,12 @@ function applyChartTitleToXml(chartRoot, model, getLocalName2, options = { prefi
103498
104133
  insertAt2(chartRoot, 0, `${prefix}:title`, titleNode);
103499
104134
  }
103500
104135
  } else if (runs) {
104136
+ if (model.titleTextOnly && textOnlyStylesMatch) {
104137
+ if (!patchChartTitleRunText(titleNode, runs, getLocalName2))
104138
+ throw new Error("This chart title cannot be replaced without changing its text source");
104139
+ if (prefix === "c") setAutoTitleDeleted(chartRoot, false, getLocalName2);
104140
+ return true;
104141
+ }
103501
104142
  const txKey = findKey6(titleNode, "tx", getLocalName2);
103502
104143
  if (txKey) {
103503
104144
  titleNode[txKey] = buildTitleTextFromRuns(prefix, runs);
@@ -103521,6 +104162,7 @@ var init_chart_title_serializer = __esm({
103521
104162
  "pptx/core/utils/chart-title-serializer.ts"() {
103522
104163
  init_chart_title_node_builder();
103523
104164
  init_chart_title_run_alignment();
104165
+ init_chart_title_text_edit();
103524
104166
  init_chart_title_xml_ops();
103525
104167
  }
103526
104168
  });
@@ -103682,131 +104324,6 @@ var init_chart_title_style_serializer = __esm({
103682
104324
  };
103683
104325
  }
103684
104326
  });
103685
- function collectChartWorkbookWrite(xmlLookupService, container2, isNumeric2, values) {
103686
- if (!container2) {
103687
- return void 0;
103688
- }
103689
- const refNode = xmlLookupService.getChildByLocalName(container2, isNumeric2 ? "numRef" : "strRef");
103690
- const formula = refNode ? xmlLookupService.getScalarChildByLocalName(refNode, "f") : void 0;
103691
- return formula ? { formula, isNumeric: isNumeric2, values } : void 0;
103692
- }
103693
- function createSpreadsheetXmlParser() {
103694
- return new fastXmlParser.XMLParser({
103695
- ignoreAttributes: false,
103696
- attributeNamePrefix: "@_",
103697
- trimValues: false,
103698
- tagValueProcessor: (tagName, tagValue) => preservesSpreadsheetXmlWhitespace(tagName) ? tagValue : tagValue.trim()
103699
- });
103700
- }
103701
- function createSpreadsheetXmlBuilder() {
103702
- return new fastXmlParser.XMLBuilder({
103703
- ignoreAttributes: false,
103704
- attributeNamePrefix: "@_",
103705
- suppressBooleanAttributes: false,
103706
- format: false
103707
- });
103708
- }
103709
- async function resolveWorksheetPathsByName(xlsxZip, parser) {
103710
- const result = /* @__PURE__ */ new Map();
103711
- const workbookFile = xlsxZip.file("xl/workbook.xml");
103712
- const relsFile = xlsxZip.file("xl/_rels/workbook.xml.rels");
103713
- if (!workbookFile || !relsFile) {
103714
- return result;
103715
- }
103716
- try {
103717
- const workbookTree = parser.parse(await workbookFile.async("string"));
103718
- const relsTree = parser.parse(await relsFile.async("string"));
103719
- const targetByRelId = /* @__PURE__ */ new Map();
103720
- const relationships2 = xmlChild(relsTree, "Relationships");
103721
- for (const rel of xmlChildren(relationships2, "Relationship")) {
103722
- const id = xmlAttr(rel, "Id");
103723
- const target = xmlAttr(rel, "Target");
103724
- if (id && target) {
103725
- targetByRelId.set(id, target);
103726
- }
103727
- }
103728
- const workbookRoot = xmlChild(workbookTree, "workbook");
103729
- const sheets = xmlChild(workbookRoot, "sheets");
103730
- for (const sheet of xmlChildren(sheets, "sheet")) {
103731
- const name = xmlAttr(sheet, "name");
103732
- const relId = xmlAttr(sheet, "r:id") ?? xmlAttr(sheet, "id");
103733
- const target = relId ? targetByRelId.get(relId) : void 0;
103734
- if (name && target) {
103735
- result.set(name.toLowerCase(), resolveWorkbookPartPath(target));
103736
- }
103737
- }
103738
- } catch {
103739
- }
103740
- return result;
103741
- }
103742
- function resolveWorkbookPartPath(target) {
103743
- return target.startsWith("/") ? target.slice(1) : `xl/${target}`;
103744
- }
103745
- async function writeChartWorkbookUpdates(xlsxBytes, writes) {
103746
- if (writes.length === 0) {
103747
- return { unresolved: 0 };
103748
- }
103749
- let xlsxZip;
103750
- try {
103751
- xlsxZip = await JSZip6__default.default.loadAsync(xlsxBytes);
103752
- } catch {
103753
- return { unresolved: writes.length };
103754
- }
103755
- const parser = createSpreadsheetXmlParser();
103756
- const sheetPathByName = await resolveWorksheetPathsByName(xlsxZip, parser);
103757
- const writesBySheetPath = /* @__PURE__ */ new Map();
103758
- let unresolved = 0;
103759
- for (const write of writes) {
103760
- const range = parseChartFormulaRange(write.formula);
103761
- const sheetPath = range ? sheetPathByName.get(range.sheetName.toLowerCase()) : void 0;
103762
- const refs = range ? expandRangeAddresses(range, write.values.length) : void 0;
103763
- if (!range || !sheetPath || !refs) {
103764
- unresolved += 1;
103765
- continue;
103766
- }
103767
- const bucket = writesBySheetPath.get(sheetPath) ?? [];
103768
- bucket.push({ refs, values: write.values, isNumeric: write.isNumeric });
103769
- writesBySheetPath.set(sheetPath, bucket);
103770
- }
103771
- const builder3 = createSpreadsheetXmlBuilder();
103772
- let changedAny = false;
103773
- for (const [sheetPath, resolvedWrites] of writesBySheetPath) {
103774
- const sheetFile = xlsxZip.file(sheetPath);
103775
- if (!sheetFile) {
103776
- unresolved += resolvedWrites.length;
103777
- continue;
103778
- }
103779
- try {
103780
- const sheetTree = parser.parse(await sheetFile.async("string"));
103781
- const cellWrites = resolvedWrites.flatMap(
103782
- ({ refs, values, isNumeric: isNumeric2 }) => refs.map((ref, i2) => ({ ref, isNumeric: isNumeric2, value: values[i2] }))
103783
- );
103784
- if (applyCellWritesToWorksheet(sheetTree, cellWrites)) {
103785
- xlsxZip.file(sheetPath, builder3.build(sheetTree));
103786
- changedAny = true;
103787
- }
103788
- } catch {
103789
- unresolved += resolvedWrites.length;
103790
- }
103791
- }
103792
- if (!changedAny) {
103793
- return { unresolved };
103794
- }
103795
- const bytes = await xlsxZip.generateAsync({
103796
- type: "uint8array",
103797
- compression: "DEFLATE",
103798
- compressionOptions: { level: 6 }
103799
- });
103800
- return { bytes, unresolved };
103801
- }
103802
- var init_chart_xlsx_writer = __esm({
103803
- "pptx/core/utils/chart-xlsx-writer.ts"() {
103804
- init_chart_xlsx_cellref();
103805
- init_chart_xlsx_sheet_cells();
103806
- init_xml_access();
103807
- init_xml_whitespace();
103808
- }
103809
- });
103810
104327
 
103811
104328
  // pptx/core/core/runtime/chart-cx-update-data.ts
103812
104329
  function findKey31(node, localName28, getLocalName2) {
@@ -104142,13 +104659,19 @@ var init_chart_cx_update = __esm({
104142
104659
  });
104143
104660
 
104144
104661
  // pptx/core/core/runtime/chart-external-workbook-save.ts
104145
- async function saveChartExternalWorkbookUpdates(deps, chartPartPath, slidePath, externalData, writes) {
104662
+ async function saveChartExternalWorkbookUpdates(deps, chartPartPath, slidePath, externalData, writes, atomic = false) {
104663
+ if (atomic && externalData && (!externalData.targetPath || externalData.isExternal)) {
104664
+ throw new Error("Chart label replacement cannot update an external or missing workbook.");
104665
+ }
104146
104666
  if (writes.length === 0 || !externalData?.targetPath) {
104147
- return;
104667
+ return writes.length === 0;
104148
104668
  }
104149
104669
  const embeddingPath = deps.resolveImagePath(chartPartPath, externalData.targetPath);
104150
104670
  const looksEmbedded = embeddingPath.includes("embeddings/") && /\.xlsx$/iu.test(embeddingPath);
104151
- if (!looksEmbedded) {
104671
+ if (!looksEmbedded || externalData.isExternal) {
104672
+ if (atomic) {
104673
+ throw new Error("Chart label replacement requires an embedded .xlsx workbook.");
104674
+ }
104152
104675
  deps.reportWarning({
104153
104676
  code: "CHART_EXTERNAL_DATA_WRITEBACK_UNSUPPORTED",
104154
104677
  message: "Chart data changes were saved to the cached values only: the linked data source is external or not an embedded .xlsx workbook, so it was not updated.",
@@ -104157,10 +104680,13 @@ async function saveChartExternalWorkbookUpdates(deps, chartPartPath, slidePath,
104157
104680
  slideId: slidePath,
104158
104681
  xmlPath: chartPartPath
104159
104682
  });
104160
- return;
104683
+ return false;
104161
104684
  }
104162
104685
  const xlsxFile = deps.zip.file(embeddingPath);
104163
104686
  if (!xlsxFile) {
104687
+ if (atomic) {
104688
+ throw new Error("Chart label replacement workbook is missing.");
104689
+ }
104164
104690
  deps.reportWarning({
104165
104691
  code: "CHART_EMBEDDED_WORKBOOK_MISSING",
104166
104692
  message: "Chart data changes were saved to the cached values only: the referenced embedded workbook was not found in the package.",
@@ -104169,12 +104695,15 @@ async function saveChartExternalWorkbookUpdates(deps, chartPartPath, slidePath,
104169
104695
  slideId: slidePath,
104170
104696
  xmlPath: embeddingPath
104171
104697
  });
104172
- return;
104698
+ return false;
104173
104699
  }
104174
104700
  let xlsxBytes;
104175
104701
  try {
104176
104702
  xlsxBytes = await xlsxFile.async("uint8array");
104177
104703
  } catch {
104704
+ if (atomic) {
104705
+ throw new Error("Chart label replacement workbook cannot be read.");
104706
+ }
104178
104707
  deps.reportWarning({
104179
104708
  code: "CHART_EMBEDDED_WORKBOOK_UNREADABLE",
104180
104709
  message: "Chart data changes were saved to the cached values only: the referenced embedded workbook could not be read.",
@@ -104183,9 +104712,9 @@ async function saveChartExternalWorkbookUpdates(deps, chartPartPath, slidePath,
104183
104712
  slideId: slidePath,
104184
104713
  xmlPath: embeddingPath
104185
104714
  });
104186
- return;
104715
+ return false;
104187
104716
  }
104188
- const result = await writeChartWorkbookUpdates(xlsxBytes, writes);
104717
+ const result = await writeChartWorkbookUpdates(xlsxBytes, writes, { atomic });
104189
104718
  if (result.bytes) {
104190
104719
  deps.zip.file(embeddingPath, result.bytes);
104191
104720
  }
@@ -104199,6 +104728,7 @@ async function saveChartExternalWorkbookUpdates(deps, chartPartPath, slidePath,
104199
104728
  xmlPath: embeddingPath
104200
104729
  });
104201
104730
  }
104731
+ return result.unresolved === 0;
104202
104732
  }
104203
104733
  var init_chart_external_workbook_save = __esm({
104204
104734
  "pptx/core/core/runtime/chart-external-workbook-save.ts"() {
@@ -104464,8 +104994,8 @@ function applyRotationFlipToRawNode(node, rotation, flipH, flipV) {
104464
104994
  const spPrKey = findChildKey2(node, "spPr");
104465
104995
  const container2 = spPrKey ? node[spPrKey] ?? node : node;
104466
104996
  const xfrmKey = findChildKey2(container2, "xfrm");
104467
- const hasAny = Boolean(rotation) || Boolean(flipH) || Boolean(flipV);
104468
- if (!xfrmKey && !hasAny) {
104997
+ const hasAny2 = Boolean(rotation) || Boolean(flipH) || Boolean(flipV);
104998
+ if (!xfrmKey && !hasAny2) {
104469
104999
  return;
104470
105000
  }
104471
105001
  const xfrm = xfrmKey ? container2[xfrmKey] : {};
@@ -104500,24 +105030,24 @@ function hexVal(hex3) {
104500
105030
  }
104501
105031
  function buildRunProps(para) {
104502
105032
  const rPr = {};
104503
- let hasAny = false;
105033
+ let hasAny2 = false;
104504
105034
  if (para.fontSize !== void 0) {
104505
105035
  rPr["@_sz"] = String(Math.round(para.fontSize * 100));
104506
- hasAny = true;
105036
+ hasAny2 = true;
104507
105037
  }
104508
105038
  if (para.bold) {
104509
105039
  rPr["@_b"] = "1";
104510
- hasAny = true;
105040
+ hasAny2 = true;
104511
105041
  }
104512
105042
  if (para.italic) {
104513
105043
  rPr["@_i"] = "1";
104514
- hasAny = true;
105044
+ hasAny2 = true;
104515
105045
  }
104516
105046
  if (para.color) {
104517
105047
  rPr["a:solidFill"] = { "a:srgbClr": { "@_val": hexVal(para.color) } };
104518
- hasAny = true;
105048
+ hasAny2 = true;
104519
105049
  }
104520
- return hasAny ? rPr : void 0;
105050
+ return hasAny2 ? rPr : void 0;
104521
105051
  }
104522
105052
  function buildParagraphNode(para) {
104523
105053
  const node = {};
@@ -106540,7 +107070,7 @@ var init_svg_stretch_fill = __esm({
106540
107070
 
106541
107071
  // pptx/core/core/runtime/image-a14-effects-model.ts
106542
107072
  function applyA14ExtensionToEffects(effects, a14) {
106543
- let hasAny = false;
107073
+ let hasAny2 = false;
106544
107074
  if (a14.artisticEffect !== void 0) {
106545
107075
  effects.artisticEffect = a14.artisticEffect;
106546
107076
  if (a14.originalImageRelId !== void 0) {
@@ -106552,15 +107082,15 @@ function applyA14ExtensionToEffects(effects, a14) {
106552
107082
  if (a14.artisticParams) {
106553
107083
  effects.artisticParams = a14.artisticParams;
106554
107084
  }
106555
- hasAny = true;
107085
+ hasAny2 = true;
106556
107086
  }
106557
107087
  if (a14.backgroundRemoval) {
106558
107088
  effects.backgroundRemoval = a14.backgroundRemoval;
106559
- hasAny = true;
107089
+ hasAny2 = true;
106560
107090
  }
106561
107091
  if (a14.originalImageRelId !== void 0) {
106562
107092
  effects.originalImageRelId = a14.originalImageRelId;
106563
- hasAny = true;
107093
+ hasAny2 = true;
106564
107094
  }
106565
107095
  const corrections = {};
106566
107096
  if (a14.sharpenSoften) {
@@ -106583,9 +107113,9 @@ function applyA14ExtensionToEffects(effects, a14) {
106583
107113
  if (a14.originalImageRelId !== void 0) {
106584
107114
  effects.prerenderedCorrections = corrections;
106585
107115
  }
106586
- hasAny = true;
107116
+ hasAny2 = true;
106587
107117
  }
106588
- return hasAny;
107118
+ return hasAny2;
106589
107119
  }
106590
107120
  var init_image_a14_effects_model = __esm({
106591
107121
  "pptx/core/core/runtime/image-a14-effects-model.ts"() {
@@ -106708,7 +107238,7 @@ var init_PptxHandlerRuntimeState = __esm({
106708
107238
  */
106709
107239
  savedSlideFingerprints = /* @__PURE__ */ new Map();
106710
107240
  /**
106711
- * `chartData` exactly as it stood right after `enrichChartData` parsed it,
107241
+ * `chartData` as parsed or last serialized into the current ZIP,
106712
107242
  * serialized to JSON and keyed by `chartPartPath`. The save pipeline used
106713
107243
  * to re-serialize EVERY chart part on any slide rewrite regardless of
106714
107244
  * whether the chart itself was touched, which materializes the load-time
@@ -106721,6 +107251,10 @@ var init_PptxHandlerRuntimeState = __esm({
106721
107251
  * untouched chart part pass through byte-for-byte instead.
106722
107252
  */
106723
107253
  chartDataBaselines = /* @__PURE__ */ new Map();
107254
+ /** Pending chart requests also retain warned workbook writes for later retry. */
107255
+ pendingChartUpdates;
107256
+ /** Last fully reconciled workbook data plus whether a write-back needs retry. */
107257
+ chartWorkbookDataBaselines = /* @__PURE__ */ new Map();
106724
107258
  /** Per-slide relationship maps: slide path -> (rId -> target path). */
106725
107259
  slideRelsMap = /* @__PURE__ */ new Map();
106726
107260
  /** Tracks relationship IDs with TargetMode="External" per slide/part path. */
@@ -107927,13 +108461,13 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
107927
108461
  return null;
107928
108462
  }
107929
108463
  const effects = {};
107930
- let hasAny = false;
108464
+ let hasAny2 = false;
107931
108465
  const brightRaw = blip["@_bright"] ?? blip["@_brt"];
107932
108466
  if (brightRaw !== null) {
107933
108467
  const val = parseInt(String(brightRaw));
107934
108468
  if (Number.isFinite(val)) {
107935
108469
  effects.brightness = val / 1e3;
107936
- hasAny = true;
108470
+ hasAny2 = true;
107937
108471
  }
107938
108472
  }
107939
108473
  const contrastRaw = blip["@_contrast"] ?? blip["@_cont"];
@@ -107941,7 +108475,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
107941
108475
  const val = parseInt(String(contrastRaw));
107942
108476
  if (Number.isFinite(val)) {
107943
108477
  effects.contrast = val / 1e3;
107944
- hasAny = true;
108478
+ hasAny2 = true;
107945
108479
  }
107946
108480
  }
107947
108481
  const colorEffects = parseImageColorEffects(
@@ -107951,12 +108485,12 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
107951
108485
  );
107952
108486
  Object.assign(effects, colorEffects);
107953
108487
  if (Object.keys(colorEffects).length > 0) {
107954
- hasAny = true;
108488
+ hasAny2 = true;
107955
108489
  }
107956
108490
  const alphaEffects = parseImageAlphaEffects(blip, (node) => this.parseColor(node));
107957
108491
  Object.assign(effects, alphaEffects);
107958
108492
  if (Object.keys(alphaEffects).length > 0) {
107959
- hasAny = true;
108493
+ hasAny2 = true;
107960
108494
  }
107961
108495
  const lumNode = blip["a:lum"];
107962
108496
  if (lumNode) {
@@ -107976,7 +108510,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
107976
108510
  }
107977
108511
  }
107978
108512
  effects.lum = lumEffect;
107979
- hasAny = true;
108513
+ hasAny2 = true;
107980
108514
  }
107981
108515
  const hslNode = blip["a:hsl"];
107982
108516
  if (hslNode) {
@@ -108003,7 +108537,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
108003
108537
  }
108004
108538
  }
108005
108539
  effects.hsl = hslEffect;
108006
- hasAny = true;
108540
+ hasAny2 = true;
108007
108541
  }
108008
108542
  const tintNode = blip["a:tint"];
108009
108543
  if (tintNode) {
@@ -108023,7 +108557,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
108023
108557
  }
108024
108558
  }
108025
108559
  effects.tint = tintEffect;
108026
- hasAny = true;
108560
+ hasAny2 = true;
108027
108561
  }
108028
108562
  const fillOverlay = blip["a:fillOverlay"];
108029
108563
  if (fillOverlay) {
@@ -108050,7 +108584,7 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
108050
108584
  ...resolvedGradient ? { resolvedGradient } : {},
108051
108585
  ...resolvedPattern ? { resolvedPattern } : {}
108052
108586
  };
108053
- hasAny = true;
108587
+ hasAny2 = true;
108054
108588
  }
108055
108589
  const blurNode = blip["a:blur"];
108056
108590
  if (blurNode) {
@@ -108068,16 +108602,16 @@ var init_PptxHandlerRuntimeImageEffects = __esm({
108068
108602
  blurEffect.grow = s === "1" || s === "true";
108069
108603
  }
108070
108604
  effects.blur = blurEffect;
108071
- hasAny = true;
108605
+ hasAny2 = true;
108072
108606
  }
108073
108607
  const extLst = xmlChild(blip, "a:extLst");
108074
108608
  if (extLst) {
108075
108609
  const a14 = parseA14ImageExtension(this.ensureArray(extLst["a:ext"]));
108076
108610
  if (a14 && applyA14ExtensionToEffects(effects, a14)) {
108077
- hasAny = true;
108611
+ hasAny2 = true;
108078
108612
  }
108079
108613
  }
108080
- return hasAny ? effects : null;
108614
+ return hasAny2 ? effects : null;
108081
108615
  }
108082
108616
  /**
108083
108617
  * Resolve a blip `a:fillOverlay/a:gradFill` to the structured gradient a
@@ -109730,8 +110264,8 @@ function buildTextRunEffectListXml(style, parseColor) {
109730
110264
  const hasTextHsl = typeof style.textHslHue === "number" || typeof style.textHslSaturation === "number" || typeof style.textHslLuminance === "number";
109731
110265
  const hasTextClrChange = Boolean(style.textClrChangeFrom) && Boolean(style.textClrChangeTo);
109732
110266
  const hasTextDuotone = Boolean(style.textDuotone);
109733
- const hasAny = hasTextShadow || hasTextInnerShadow || hasTextPresetShadow || hasTextGlow || hasTextReflection || hasTextBlur || hasTextSoftEdge || hasTextAlphaModFix || hasTextAlphaMod || hasTextHsl || hasTextClrChange || hasTextDuotone;
109734
- if (!hasAny) {
110267
+ const hasAny2 = hasTextShadow || hasTextInnerShadow || hasTextPresetShadow || hasTextGlow || hasTextReflection || hasTextBlur || hasTextSoftEdge || hasTextAlphaModFix || hasTextAlphaMod || hasTextHsl || hasTextClrChange || hasTextDuotone;
110268
+ if (!hasAny2) {
109735
110269
  return void 0;
109736
110270
  }
109737
110271
  const effectLst = {};
@@ -114044,6 +114578,87 @@ var init_table_column_width_save = __esm({
114044
114578
  }
114045
114579
  });
114046
114580
 
114581
+ // pptx/core/core/runtime/table-style-change-cell-clear.ts
114582
+ function normaliseStyleId(id) {
114583
+ const text2 = typeof id === "string" || typeof id === "number" ? String(id) : "";
114584
+ const trimmed2 = text2.trim().toUpperCase();
114585
+ if (!trimmed2) {
114586
+ return "";
114587
+ }
114588
+ return trimmed2.startsWith("{") ? trimmed2 : `{${trimmed2}}`;
114589
+ }
114590
+ function xmlTableStyleId(tblPr) {
114591
+ if (!tblPr || typeof tblPr !== "object") {
114592
+ return "";
114593
+ }
114594
+ const props = tblPr;
114595
+ const node = props["a:tableStyleId"];
114596
+ const spec = normaliseStyleId(
114597
+ node && typeof node === "object" ? node["#text"] : node
114598
+ );
114599
+ if (spec) {
114600
+ return spec;
114601
+ }
114602
+ const legacy = props["a:tblStyle"];
114603
+ return normaliseStyleId(legacy?.["@_val"] || props["@_tblStyle"]);
114604
+ }
114605
+ function tableStyleIdChanged(tblPr, nextStyleId) {
114606
+ if (nextStyleId === void 0) {
114607
+ return false;
114608
+ }
114609
+ return normaliseStyleId(nextStyleId) !== xmlTableStyleId(tblPr);
114610
+ }
114611
+ function clearCellFormattingForStyleChange(xmlCell, style) {
114612
+ const tcPr = xmlCell["a:tcPr"];
114613
+ if (!tcPr || typeof tcPr !== "object") {
114614
+ return;
114615
+ }
114616
+ const props = tcPr;
114617
+ if (!hasAny(style, FILL_FIELDS)) {
114618
+ for (const key2 of FILL_KEYS) {
114619
+ delete props[key2];
114620
+ }
114621
+ }
114622
+ for (const [key2, fields] of LINE_KEYS) {
114623
+ if (!hasAny(style, fields)) {
114624
+ delete props[key2];
114625
+ }
114626
+ }
114627
+ if (!style?.cell3D) {
114628
+ delete props["a:cell3D"];
114629
+ }
114630
+ }
114631
+ var FILL_KEYS, LINE_KEYS, FILL_FIELDS, hasAny;
114632
+ var init_table_style_change_cell_clear = __esm({
114633
+ "pptx/core/core/runtime/table-style-change-cell-clear.ts"() {
114634
+ FILL_KEYS = [
114635
+ "a:noFill",
114636
+ "a:solidFill",
114637
+ "a:gradFill",
114638
+ "a:blipFill",
114639
+ "a:pattFill",
114640
+ "a:grpFill"
114641
+ ];
114642
+ LINE_KEYS = [
114643
+ ["a:lnL", ["borderLeftWidth", "borderLeftColor", "borderLeftDash"]],
114644
+ ["a:lnR", ["borderRightWidth", "borderRightColor", "borderRightDash"]],
114645
+ ["a:lnT", ["borderTopWidth", "borderTopColor", "borderTopDash"]],
114646
+ ["a:lnB", ["borderBottomWidth", "borderBottomColor", "borderBottomDash"]],
114647
+ ["a:lnTlToBr", ["borderDiagDownWidth", "borderDiagDownColor"]],
114648
+ ["a:lnBlToTr", ["borderDiagUpWidth", "borderDiagUpColor"]]
114649
+ ];
114650
+ FILL_FIELDS = [
114651
+ "fillMode",
114652
+ "backgroundColor",
114653
+ "gradientFillStops",
114654
+ "patternFillPreset",
114655
+ "backgroundImageFillPath",
114656
+ "backgroundImageFillData"
114657
+ ];
114658
+ hasAny = (style, keys) => keys.some((key2) => style?.[key2] !== void 0);
114659
+ }
114660
+ });
114661
+
114047
114662
  // pptx/core/core/runtime/table-paragraph-save-order.ts
114048
114663
  function runTag(run) {
114049
114664
  return run.isLineBreak ? "a:br" : run.isField ? "a:fld" : "a:r";
@@ -114555,6 +115170,7 @@ var init_table_tblpr_save = __esm({
114555
115170
  var CHART_DATA_DISPLAY_OPTIONS_EXT_URI, PptxHandlerRuntime24;
114556
115171
  var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
114557
115172
  "pptx/core/core/runtime/PptxHandlerRuntimeSaveDataSerialization.ts"() {
115173
+ init_chart_workbook_data_signature();
114558
115174
  init_chart_axis_dispunits_serializer();
114559
115175
  init_chart_axis_gridlines_serializer();
114560
115176
  init_chart_axis_label_formatting();
@@ -114606,6 +115222,7 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
114606
115222
  init_PptxHandlerRuntimeChartUserShapes();
114607
115223
  init_save_table_merge_helpers();
114608
115224
  init_table_column_width_save();
115225
+ init_table_style_change_cell_clear();
114609
115226
  init_table_paragraph_save_order();
114610
115227
  init_table_structural_ops();
114611
115228
  init_table_tblpr_save();
@@ -114627,6 +115244,7 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
114627
115244
  if (!tbl) {
114628
115245
  return;
114629
115246
  }
115247
+ const styleChanged = tableData.clearDirectCellFormatting === true || tableStyleIdChanged(tbl["a:tblPr"], tableData.tableStyleId);
114630
115248
  serializeTablePropertyFlags(tbl, tableData);
114631
115249
  writeTablePropertiesOwnFillAndEffects(tbl["a:tblPr"], tableData);
114632
115250
  const xmlRows = this.ensureArray(tbl["a:tr"]);
@@ -114658,6 +115276,9 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
114658
115276
  if (cell.text !== void 0) {
114659
115277
  this.writeTableCellText(xmlCell, cell.text);
114660
115278
  }
115279
+ if (styleChanged) {
115280
+ clearCellFormattingForStyleChange(xmlCell, cell.style);
115281
+ }
114661
115282
  if (cell.style) {
114662
115283
  this.writeTableCellStyle(xmlCell, cell.style, cell.paragraphs);
114663
115284
  }
@@ -114681,6 +115302,9 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
114681
115302
  if (cell.text !== void 0) {
114682
115303
  this.writeTableCellText(xmlCell, cell.text);
114683
115304
  }
115305
+ if (styleChanged) {
115306
+ clearCellFormattingForStyleChange(xmlCell, cell.style);
115307
+ }
114684
115308
  if (cell.style) {
114685
115309
  this.writeTableCellStyle(xmlCell, cell.style, cell.paragraphs);
114686
115310
  }
@@ -114692,8 +115316,6 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
114692
115316
  console.warn("Failed to serialize table data:", e);
114693
115317
  }
114694
115318
  }
114695
- /** Pending chart data updates to process in the async save method. */
114696
- pendingChartUpdates;
114697
115319
  /**
114698
115320
  * Record `chartData` as parsed, straight off `enrichChartData`, as this
114699
115321
  * chart's load-time baseline. See {@link chartDataBaselines}.
@@ -114703,6 +115325,10 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
114703
115325
  return;
114704
115326
  }
114705
115327
  this.chartDataBaselines.set(chartData.chartPartPath, JSON.stringify(chartData));
115328
+ this.chartWorkbookDataBaselines.set(chartData.chartPartPath, {
115329
+ signature: chartWorkbookDataSignature(chartData),
115330
+ pending: false
115331
+ });
114706
115332
  }
114707
115333
  /**
114708
115334
  * Collect chart data for deferred async processing during save.
@@ -114719,12 +115345,28 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
114719
115345
  /**
114720
115346
  * Process all pending chart data updates (called from the async save method).
114721
115347
  */
114722
- async processPendingChartUpdates() {
115348
+ async processPendingChartUpdates(slides) {
114723
115349
  if (!this.pendingChartUpdates || this.pendingChartUpdates.length === 0) {
114724
115350
  return;
114725
115351
  }
115352
+ if (slides) {
115353
+ const current = /* @__PURE__ */ new Map();
115354
+ const visit = (elements2, slidePath) => {
115355
+ for (const element of elements2) {
115356
+ if (element.type === "group") visit(element.children, slidePath);
115357
+ else if (element.type === "chart" && element.chartData?.chartPartPath) {
115358
+ current.set(element.chartData.chartPartPath, {
115359
+ chartData: element.chartData,
115360
+ slidePath
115361
+ });
115362
+ }
115363
+ }
115364
+ };
115365
+ for (const slide of slides) visit(slide.elements, slide.id);
115366
+ this.pendingChartUpdates = [...current.values()];
115367
+ }
114726
115368
  for (const { chartData, slidePath } of this.pendingChartUpdates) {
114727
- if (chartData.chartPartPath && this.chartDataBaselines.get(chartData.chartPartPath) === JSON.stringify(chartData)) {
115369
+ if (chartData.chartPartPath && !this.chartWorkbookDataBaselines.get(chartData.chartPartPath)?.pending && this.chartDataBaselines.get(chartData.chartPartPath) === JSON.stringify(chartData)) {
114728
115370
  continue;
114729
115371
  }
114730
115372
  if (chartData.colorPalette && chartData.colorStylePartPath) {
@@ -115143,7 +115785,9 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
115143
115785
  {
115144
115786
  title: chartData.title,
115145
115787
  hasTitle: chartData.style?.hasTitle,
115146
- titleRuns: chartData.titleRuns
115788
+ titleRuns: chartData.titleRuns,
115789
+ titleTextOnly: chartData.titleTextOnly,
115790
+ titleTextOnlyStyles: chartData.titleTextOnlyStyles
115147
115791
  },
115148
115792
  (key2) => this.compatibilityService.getXmlLocalName(key2)
115149
115793
  );
@@ -115335,23 +115979,41 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
115335
115979
  }
115336
115980
  }
115337
115981
  await this.syncChartUserShapesToXml(chartSpace, chartData, chartPartPath);
115982
+ const serializedBaseline = this.chartDataBaselines.get(chartPartPath);
115983
+ const signature = chartWorkbookDataSignature(chartData);
115984
+ const workbookBaseline = this.chartWorkbookDataBaselines.get(chartPartPath);
115985
+ const previousSignature = workbookBaseline?.signature ?? (serializedBaseline ? chartWorkbookDataSignature(JSON.parse(serializedBaseline)) : void 0);
115986
+ const workbookDataChanged = workbookBaseline?.pending || signature !== previousSignature;
115987
+ if (workbookDataChanged) {
115988
+ const complete = await saveChartExternalWorkbookUpdates(
115989
+ {
115990
+ zip: this.zip,
115991
+ resolveImagePath: (basePath, target) => this.resolveImagePath(basePath, target),
115992
+ reportWarning: (warning) => this.compatibilityService.reportWarning(warning)
115993
+ },
115994
+ chartPartPath,
115995
+ slidePath,
115996
+ chartData.externalData,
115997
+ workbookWrites,
115998
+ chartData.dataLabelTextOnly ?? false
115999
+ );
116000
+ this.chartWorkbookDataBaselines.set(chartPartPath, {
116001
+ signature: complete ? signature : previousSignature ?? signature,
116002
+ pending: !complete
116003
+ });
116004
+ }
115338
116005
  this.zip.file(chartPartPath, this.builder.build(chartXmlData));
115339
- await saveChartExternalWorkbookUpdates(
115340
- {
115341
- zip: this.zip,
115342
- resolveImagePath: (basePath, target) => this.resolveImagePath(basePath, target),
115343
- reportWarning: (warning) => this.compatibilityService.reportWarning(warning)
115344
- },
115345
- chartPartPath,
115346
- slidePath,
115347
- chartData.externalData,
115348
- workbookWrites
115349
- );
116006
+ this.chartDataBaselines.set(chartPartPath, JSON.stringify(chartData));
115350
116007
  } catch (e) {
116008
+ if (chartData.dataLabelTextOnly) {
116009
+ throw e;
116010
+ }
115351
116011
  console.warn(`[pptx-save] Failed to serialize chart data for ${chartPartPath}:`, e);
115352
116012
  }
115353
116013
  }
115354
- this.pendingChartUpdates = void 0;
116014
+ this.pendingChartUpdates = this.pendingChartUpdates.filter(
116015
+ ({ chartData }) => chartData.chartPartPath && this.chartWorkbookDataBaselines.get(chartData.chartPartPath)?.pending
116016
+ );
115355
116017
  }
115356
116018
  /**
115357
116019
  * Route a chart save that the 2006 `c:*Chart` update loop cannot handle:
@@ -123555,22 +124217,44 @@ function drawingNamespace(strict) {
123555
124217
  var NOTES_MASTER_CONTENT_TYPE, PptxHandlerRuntime50;
123556
124218
  var init_PptxHandlerRuntimeSaveNotesInfrastructure = __esm({
123557
124219
  "pptx/core/core/runtime/PptxHandlerRuntimeSaveNotesInfrastructure.ts"() {
124220
+ init_relationships();
123558
124221
  init_PptxHandlerRuntimeSaveViewProperties();
123559
124222
  NOTES_MASTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml";
123560
124223
  PptxHandlerRuntime50 = class extends PptxHandlerRuntime49 {
123561
124224
  /** Ensure authored notes have the global notes-master OPC infrastructure. */
123562
124225
  async ensureNotesMasterForAuthoredNotes(slides, constants) {
123563
124226
  const needsNotes = slides.some(
123564
- (slide) => slide.notes !== void 0 || Boolean(slide.notesSegments?.length)
124227
+ (slide) => Boolean(slide.notes) || Boolean(slide.notesSegments?.some((segment) => segment.text))
123565
124228
  );
123566
124229
  if (!needsNotes || Object.keys(this.zip.files).some(
123567
124230
  (path3) => /^ppt\/notesMasters\/notesMaster\d+\.xml$/u.test(path3)
123568
124231
  )) {
123569
124232
  return;
123570
124233
  }
124234
+ const relsPath2 = "ppt/_rels/presentation.xml.rels";
124235
+ const relsXml = await this.zip.file(relsPath2)?.async("string");
124236
+ if (!relsXml || !this.presentationData) return;
124237
+ if (Array.from(parseRelationships(relsXml).values()).some(
124238
+ (relationship) => relationship.type.endsWith("/notesMaster") && relationship.mode !== "External" && this.zip.file(resolvePartPath("ppt/presentation.xml", relationship.target))
124239
+ ))
124240
+ return;
123571
124241
  const strict = constants.conformance === "strict";
123572
124242
  const masterPath = "ppt/notesMasters/notesMaster1.xml";
123573
- const themePath = Object.keys(this.zip.files).find((path3) => /^ppt\/theme\/theme\d+\.xml$/u.test(path3)) ?? "ppt/theme/theme1.xml";
124243
+ const sourceThemePath = Object.keys(this.zip.files).find((path3) => /^ppt\/theme\/theme\d+\.xml$/u.test(path3)) ?? "ppt/theme/theme1.xml";
124244
+ let themeIndex = 1;
124245
+ while (this.zip.file(`ppt/theme/theme${themeIndex}.xml`)) themeIndex += 1;
124246
+ const themePath = `ppt/theme/theme${themeIndex}.xml`;
124247
+ const themeBytes = await this.zip.file(sourceThemePath)?.async("uint8array");
124248
+ const theme = themeBytes ?? this.buildThemeXml(themePath, void 0);
124249
+ if (!theme) throw new Error("Cannot create a notes theme from the presentation state");
124250
+ this.zip.file(themePath, theme);
124251
+ const themeRelationships = await this.zip.file(`ppt/theme/_rels/${sourceThemePath.slice(sourceThemePath.lastIndexOf("/") + 1)}.rels`)?.async("uint8array");
124252
+ if (themeRelationships)
124253
+ this.zip.file(`ppt/theme/_rels/theme${themeIndex}.xml.rels`, themeRelationships);
124254
+ await this.addContentTypeOverride(
124255
+ `/${themePath}`,
124256
+ "application/vnd.openxmlformats-officedocument.theme+xml"
124257
+ );
123574
124258
  this.zip.file(masterPath, this.builder.build(this.buildDefaultNotesMaster(strict)));
123575
124259
  this.zip.file(
123576
124260
  "ppt/notesMasters/_rels/notesMaster1.xml.rels",
@@ -123585,11 +124269,6 @@ var init_PptxHandlerRuntimeSaveNotesInfrastructure = __esm({
123585
124269
  }
123586
124270
  })
123587
124271
  );
123588
- const relsPath2 = "ppt/_rels/presentation.xml.rels";
123589
- const relsXml = await this.zip.file(relsPath2)?.async("string");
123590
- if (!relsXml || !this.presentationData) {
123591
- return;
123592
- }
123593
124272
  const relsData = this.parser.parse(relsXml);
123594
124273
  const relsRoot = relsData["Relationships"] ?? {};
123595
124274
  const relationships2 = asArray7(relsRoot["Relationship"]);
@@ -124324,7 +125003,7 @@ var init_PptxHandlerRuntimeSavePipeline = __esm({
124324
125003
  saveSession,
124325
125004
  saveConstants
124326
125005
  );
124327
- await this.processPendingChartUpdates();
125006
+ await this.processPendingChartUpdates(slides);
124328
125007
  await this.ensureChartPartContentTypes();
124329
125008
  await this.ensureOleEmbeddingContentTypes();
124330
125009
  await this.processPendingOleContentUpdates();
@@ -125300,6 +125979,7 @@ var PptxHandlerRuntime60;
125300
125979
  var init_PptxHandlerRuntimeGeometryParsing = __esm({
125301
125980
  "pptx/core/core/runtime/PptxHandlerRuntimeGeometryParsing.ts"() {
125302
125981
  init_color_primitives();
125982
+ init_custom_geometry_command_order();
125303
125983
  init_custom_geometry_parser();
125304
125984
  init_guide_formula();
125305
125985
  init_PptxHandlerRuntimePlaceholderLookup();
@@ -125461,6 +126141,10 @@ var init_PptxHandlerRuntimeGeometryParsing = __esm({
125461
126141
  const pathLst = custGeom["a:pathLst"];
125462
126142
  if (isNonEmpty(pathLst)) {
125463
126143
  result.pathLstXml = pathLst;
126144
+ const pathCommandOrder = readPathListCommandOrder(pathLst);
126145
+ if (pathCommandOrder) {
126146
+ result.pathCommandOrder = pathCommandOrder;
126147
+ }
125464
126148
  }
125465
126149
  return Object.keys(result).length > 0 ? result : void 0;
125466
126150
  }
@@ -126371,7 +127055,7 @@ var init_PptxHandlerRuntimeShapeBodyParsing = __esm({
126371
127055
  return void 0;
126372
127056
  }
126373
127057
  const locks = {};
126374
- let hasAny = false;
127058
+ let hasAny2 = false;
126375
127059
  const boolAttr2 = (attr6) => {
126376
127060
  const raw = spLocks[attr6];
126377
127061
  if (raw === void 0) {
@@ -126384,7 +127068,7 @@ var init_PptxHandlerRuntimeShapeBodyParsing = __esm({
126384
127068
  const val = boolAttr2(attr6);
126385
127069
  if (val !== void 0) {
126386
127070
  fn(val);
126387
- hasAny = true;
127071
+ hasAny2 = true;
126388
127072
  }
126389
127073
  };
126390
127074
  set2("@_noGrp", (v) => {
@@ -126423,7 +127107,7 @@ var init_PptxHandlerRuntimeShapeBodyParsing = __esm({
126423
127107
  set2("@_noCrop", (v) => {
126424
127108
  locks.noCrop = v;
126425
127109
  });
126426
- return hasAny ? locks : void 0;
127110
+ return hasAny2 ? locks : void 0;
126427
127111
  }
126428
127112
  /**
126429
127113
  * Parse the `@txBox` attribute from a `p:cNvSpPr` node. Returns `true` /
@@ -134335,6 +135019,7 @@ var init_PptxHandlerRuntimeChartExternalData = __esm({
134335
135019
  );
134336
135020
  const autoUpdateAttr = externalDataNode["@_autoUpdate"];
134337
135021
  const autoUpdate = autoUpdateNode?.["@_val"] === "1" || autoUpdateNode?.["@_val"] === "true" || autoUpdateAttr === "1" || autoUpdateAttr === "true" || false;
135022
+ let isExternal = false;
134338
135023
  let targetPath;
134339
135024
  try {
134340
135025
  const chartDir = chartPartPath.substring(0, chartPartPath.lastIndexOf("/") + 1);
@@ -134349,6 +135034,7 @@ var init_PptxHandlerRuntimeChartExternalData = __esm({
134349
135034
  for (const rel of rels) {
134350
135035
  if (String(rel?.["@_Id"] || "") === relId) {
134351
135036
  targetPath = String(rel?.["@_Target"] || "").trim() || void 0;
135037
+ isExternal = String(rel?.["@_TargetMode"] || "") === "External";
134352
135038
  break;
134353
135039
  }
134354
135040
  }
@@ -134357,7 +135043,7 @@ var init_PptxHandlerRuntimeChartExternalData = __esm({
134357
135043
  } catch {
134358
135044
  }
134359
135045
  let embeddedWorkbookData;
134360
- if (targetPath) {
135046
+ if (targetPath && !isExternal) {
134361
135047
  try {
134362
135048
  const embeddingPath = this.resolveImagePath(chartPartPath, targetPath);
134363
135049
  if (embeddingPath.includes("embeddings/") && embeddingPath.endsWith(".xlsx")) {
@@ -134371,6 +135057,7 @@ var init_PptxHandlerRuntimeChartExternalData = __esm({
134371
135057
  }
134372
135058
  return {
134373
135059
  relId,
135060
+ ...isExternal ? { isExternal: true } : {},
134374
135061
  targetPath,
134375
135062
  autoUpdate,
134376
135063
  ...embeddedWorkbookData ? { embeddedWorkbookData } : {}
@@ -134741,6 +135428,8 @@ var init_PptxHandlerRuntimeChartExParsing = __esm({
134741
135428
  ...result.categoryLevels ? { categoryLevels: result.categoryLevels } : {},
134742
135429
  series: result.series,
134743
135430
  title: cxTitleText,
135431
+ titleTextEditable: false,
135432
+ dataLabelTextEditable: false,
134744
135433
  style: chartStyle2,
134745
135434
  chartPartPath,
134746
135435
  chartRelationshipId,
@@ -134764,6 +135453,7 @@ var init_PptxHandlerRuntimeChartExParsing = __esm({
134764
135453
  var PptxHandlerRuntime95;
134765
135454
  var init_PptxHandlerRuntimeChartParsing = __esm({
134766
135455
  "pptx/core/core/runtime/PptxHandlerRuntimeChartParsing.ts"() {
135456
+ init_chart_label_source();
134767
135457
  init_chart_advanced_parser();
134768
135458
  init_chart_axis_parser();
134769
135459
  init_chart_band_fmts();
@@ -134954,12 +135644,34 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
134954
135644
  colorAdapter
134955
135645
  );
134956
135646
  const style = chartStyleFromNeutral(neutral, this.extractChartStyle(chartSpace, chartRoot));
135647
+ const titleTx = reader2.xml.getChildByLocalName(
135648
+ reader2.xml.getChildByLocalName(chartRoot, "title"),
135649
+ "tx"
135650
+ );
135651
+ const titleRich = reader2.xml.getChildByLocalName(titleTx, "rich");
135652
+ const titleParagraphs = reader2.xml.getChildrenArrayByLocalName(titleRich, "p");
135653
+ const titleTextEditable = Boolean(
135654
+ titleRuns?.length && titleParagraphs.length === 1 && !Object.keys(titleParagraphs[0] ?? {}).some(
135655
+ (key2) => ["br", "fld"].includes(reader2.localName(key2))
135656
+ )
135657
+ );
134957
135658
  const groupOptions = groupOptionsFromNeutral(groups[0]?.group, chartType);
134958
135659
  const linesAndChrome = this.readChartLinesAndChrome(neutral, tree, groups, reader2);
134959
135660
  const facts = await this.readChartPartFacts(chartSpace, chartRoot, chartPartPath);
134960
135661
  const workbook = facts.embeddedWorkbookData;
134961
135662
  const dateCategories = rawDateCategories ? { ...rawDateCategories, date1904: neutral.date1904 ?? workbook?.date1904 ?? false } : void 0;
134962
135663
  const filled = applyEmbeddedWorkbookFallback(chartType, categories, built.series, workbook);
135664
+ const dataLabelTextEditable = !categoryLevels && !dateCategories && await chartLabelsHaveEditableSources(
135665
+ reader2.xml,
135666
+ this.zip,
135667
+ chartSpace,
135668
+ built.seriesNodes,
135669
+ filled.series,
135670
+ filled.categories,
135671
+ facts.externalData,
135672
+ chartPartPath,
135673
+ this.resolveImagePath.bind(this)
135674
+ );
134963
135675
  const hasPicture = filled.series.some(
134964
135676
  (entry2) => entry2.picture || entry2.impliedPicture || entry2.dataPoints?.some((point2) => point2.picture || point2.impliedPicture)
134965
135677
  );
@@ -134992,6 +135704,14 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
134992
135704
  ...built.filtered,
134993
135705
  title: neutralTitleText(neutral.title),
134994
135706
  ...titleRuns ? { titleRuns } : {},
135707
+ titleTextEditable,
135708
+ dataLabelTextEditable,
135709
+ ...dataLabelTextEditable ? {
135710
+ dataLabelSourceShape: {
135711
+ categoryCount: filled.categories.length,
135712
+ seriesValueCounts: filled.series.map((series) => series.values.length)
135713
+ }
135714
+ } : {},
134995
135715
  style,
134996
135716
  grouping: groupOptions.grouping,
134997
135717
  ...groupOptions,
@@ -135015,13 +135735,15 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
135015
135735
  });
135016
135736
 
135017
135737
  // pptx/core/core/runtime/PptxHandlerRuntimePresentationStructure.ts
135018
- var PptxHandlerRuntime96;
135738
+ var XSD_INT_MIN, XSD_INT_MAX, PptxHandlerRuntime96;
135019
135739
  var init_PptxHandlerRuntimePresentationStructure = __esm({
135020
135740
  "pptx/core/core/runtime/PptxHandlerRuntimePresentationStructure.ts"() {
135021
135741
  init_kinsoku_parser();
135022
135742
  init_presentation_section_parser();
135023
135743
  init_header_footer_parts();
135024
135744
  init_PptxHandlerRuntimeChartParsing();
135745
+ XSD_INT_MIN = -2147483648;
135746
+ XSD_INT_MAX = 2147483647;
135025
135747
  PptxHandlerRuntime96 = class extends PptxHandlerRuntime95 {
135026
135748
  parseEditorAnimations(slideXml3) {
135027
135749
  return this.editorAnimationService.parseEditorAnimations(slideXml3);
@@ -135204,6 +135926,22 @@ var init_PptxHandlerRuntimePresentationStructure = __esm({
135204
135926
  const lexical = String(raw).trim().toLowerCase();
135205
135927
  return lexical !== "0" && lexical !== "false";
135206
135928
  }
135929
+ /**
135930
+ * Extract `p:presentation/@firstSlideNum` (ECMA-376 §19.2.1.26, an
135931
+ * `xsd:int`). `undefined` when absent, not an integer, or outside the
135932
+ * `xsd:int` range (-2147483648 to 2147483647, which also rejects digit
135933
+ * strings too long to parse), so the spec default (`1`) is never forced
135934
+ * onto the typed model.
135935
+ */
135936
+ extractFirstSlideNumber() {
135937
+ const pres = this.presentationData?.["p:presentation"];
135938
+ const lexical = String(pres?.["@_firstSlideNum"] ?? "").trim();
135939
+ if (!/^[+-]?\d+$/.test(lexical)) {
135940
+ return void 0;
135941
+ }
135942
+ const value = Number(lexical);
135943
+ return value >= XSD_INT_MIN && value <= XSD_INT_MAX ? value : void 0;
135944
+ }
135207
135945
  };
135208
135946
  }
135209
135947
  });
@@ -135451,7 +136189,7 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
135451
136189
  );
135452
136190
  }
135453
136191
  try {
135454
- this.zip = await JSZip6__default.default.loadAsync(data);
136192
+ this.zip = await JSZip7__default.default.loadAsync(data);
135455
136193
  this.documentPropertiesUpdater = this.dependencyFactory.createDocumentPropertiesUpdater(
135456
136194
  this.zip,
135457
136195
  this.parser,
@@ -135489,6 +136227,8 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
135489
136227
  this.slideMap.clear();
135490
136228
  this.savedSlideFingerprints.clear();
135491
136229
  this.chartDataBaselines.clear();
136230
+ this.chartWorkbookDataBaselines.clear();
136231
+ this.pendingChartUpdates = void 0;
135492
136232
  this.layoutCache.clear();
135493
136233
  this.masterCache.clear();
135494
136234
  this.templateElementBaselines.reset();
@@ -135872,7 +136612,7 @@ var init_PptxHandlerRuntimeLoadPipeline = __esm({
135872
136612
  this.commentAuthorDetails.size > 0 ? Array.from(this.commentAuthorDetails.values()) : void 0
135873
136613
  ).withModernCommentAuthors(
135874
136614
  this.modernCommentAuthors.size > 0 ? Array.from(this.modernCommentAuthors.values()) : void 0
135875
- ).withConformance(this.isStrictOoxml ? "strict" : "transitional").withEmbedTrueTypeFonts(embedTrueTypeFonts).withDefaultTextStyle(defaultTextStyle).build();
136615
+ ).withConformance(this.isStrictOoxml ? "strict" : "transitional").withEmbedTrueTypeFonts(embedTrueTypeFonts).withFirstSlideNumber(this.extractFirstSlideNumber()).withDefaultTextStyle(defaultTextStyle).build();
135876
136616
  }
135877
136617
  /**
135878
136618
  * Walk the raw XML of every slide to find the highest numeric `@_id`
@@ -135978,6 +136718,8 @@ var init_PptxHandlerRuntimeLoadPipeline = __esm({
135978
136718
  this.slideMap.clear();
135979
136719
  this.savedSlideFingerprints.clear();
135980
136720
  this.chartDataBaselines.clear();
136721
+ this.chartWorkbookDataBaselines.clear();
136722
+ this.pendingChartUpdates = void 0;
135981
136723
  this.slideRelsMap.clear();
135982
136724
  this.externalRelsMap.clear();
135983
136725
  this.layoutCache.clear();
@@ -136376,7 +137118,7 @@ var init_PptxHandlerRuntimeImplementation = __esm({
136376
137118
  constructor(dependencyFactory = new PptxRuntimeDependencyFactory()) {
136377
137119
  super();
136378
137120
  this.dependencyFactory = dependencyFactory;
136379
- this.zip = new JSZip6__default.default();
137121
+ this.zip = new JSZip7__default.default();
136380
137122
  this.parser = this.dependencyFactory.createParser();
136381
137123
  this.builder = this.dependencyFactory.createBuilder();
136382
137124
  this.elementXmlBuilder = new PptxElementXmlBuilder({
@@ -139381,7 +140123,7 @@ function collectPictureIndexes(slide) {
139381
140123
  return indexes;
139382
140124
  }
139383
140125
  async function buildPptxPackage(deck) {
139384
- const zip = new JSZip6__default.default();
140126
+ const zip = new JSZip7__default.default();
139385
140127
  const usage = { fileNumbers: /* @__PURE__ */ new Map() };
139386
140128
  let mediaCounter = 0;
139387
140129
  for (const slide of deck.slides) {
@@ -140220,7 +140962,10 @@ var init_PptxHandler = __esm({
140220
140962
  const imported = deserializePptxFromJson(text2);
140221
140963
  const blankBytes = await buildBlankPresentationArchive({
140222
140964
  width: imported.widthEmu,
140223
- height: imported.heightEmu
140965
+ height: imported.heightEmu,
140966
+ // Saving writes presentation.xml from the loaded archive, not from
140967
+ // the overlaid model, so the archive must carry the value itself.
140968
+ firstSlideNumber: imported.firstSlideNumber
140224
140969
  });
140225
140970
  const base = await super.load(blankBytes, options);
140226
140971
  return applyImportedPptxData(base, imported);
@@ -141521,15 +142266,26 @@ init_font_substitution();
141521
142266
  var DEFAULT_FONT_SIZE = 18;
141522
142267
  var FALLBACK_PAD_FACTOR = 0.06;
141523
142268
  function drawTextSegments(ctx, segments, bodyStyle, w, h2, scaleFactor = 1) {
141524
- const padL = bodyStyle?.bodyInsetLeft ? bodyStyle.bodyInsetLeft * scaleFactor : Math.round(w * FALLBACK_PAD_FACTOR);
141525
- const padR = bodyStyle?.bodyInsetRight ? bodyStyle.bodyInsetRight * scaleFactor : Math.round(w * FALLBACK_PAD_FACTOR);
141526
- const padT = bodyStyle?.bodyInsetTop ? bodyStyle.bodyInsetTop * scaleFactor : Math.round(h2 * FALLBACK_PAD_FACTOR);
141527
- const padB = bodyStyle?.bodyInsetBottom ? bodyStyle.bodyInsetBottom * scaleFactor : Math.round(h2 * FALLBACK_PAD_FACTOR);
142269
+ const padL = bodyStyle?.bodyInsetLeft !== void 0 ? bodyStyle.bodyInsetLeft * scaleFactor : Math.round(w * FALLBACK_PAD_FACTOR);
142270
+ const padR = bodyStyle?.bodyInsetRight !== void 0 ? bodyStyle.bodyInsetRight * scaleFactor : Math.round(w * FALLBACK_PAD_FACTOR);
142271
+ const padT = bodyStyle?.bodyInsetTop !== void 0 ? bodyStyle.bodyInsetTop * scaleFactor : Math.round(h2 * FALLBACK_PAD_FACTOR);
142272
+ const padB = bodyStyle?.bodyInsetBottom !== void 0 ? bodyStyle.bodyInsetBottom * scaleFactor : Math.round(h2 * FALLBACK_PAD_FACTOR);
141528
142273
  const maxWidth = w - padL - padR;
141529
142274
  if (maxWidth <= 0) {
141530
142275
  return;
141531
142276
  }
141532
- const paragraphs = splitIntoParagraphs(segments);
142277
+ const paragraphs = splitIntoParagraphs(
142278
+ segments.map((segment) => ({
142279
+ ...segment,
142280
+ style: {
142281
+ ...bodyStyle,
142282
+ ...Object.fromEntries(
142283
+ Object.entries(segment.style).filter(([, value]) => value !== void 0)
142284
+ )
142285
+ }
142286
+ })),
142287
+ bodyStyle
142288
+ );
141533
142289
  const lines = layoutParagraphs(ctx, paragraphs, maxWidth, scaleFactor);
141534
142290
  if (lines.length === 0) {
141535
142291
  return;
@@ -141565,33 +142321,58 @@ function drawTextSegments(ctx, segments, bodyStyle, w, h2, scaleFactor = 1) {
141565
142321
  y += line2.height * 0.3;
141566
142322
  }
141567
142323
  }
141568
- function splitIntoParagraphs(segments) {
141569
- const paragraphs = [[]];
142324
+ function splitIntoParagraphs(segments, bodyStyle) {
142325
+ const paragraphs = [{ segments: [], style: bodyStyle ?? {} }];
141570
142326
  for (const seg of segments) {
141571
- if (seg.isParagraphBreak) {
141572
- paragraphs.push([]);
141573
- } else if (seg.text) {
141574
- paragraphs[paragraphs.length - 1].push(seg);
142327
+ if (seg.isParagraphBreak || seg.text === "\n" && !seg.isLineBreak) {
142328
+ paragraphs.push({ segments: [], style: seg.style });
142329
+ } else if (seg.text || seg.isLineBreak) {
142330
+ paragraphs[paragraphs.length - 1].segments.push(seg);
141575
142331
  }
141576
142332
  }
141577
- return paragraphs.filter((p) => p.length > 0);
142333
+ return paragraphs;
141578
142334
  }
141579
142335
  function layoutParagraphs(ctx, paragraphs, maxWidth, scaleFactor) {
141580
142336
  const lines = [];
141581
- for (const para of paragraphs) {
141582
- const paraAlign = para[0]?.style?.align;
142337
+ for (const paragraph of paragraphs) {
142338
+ const para = paragraph.segments;
142339
+ const paraAlign = para[0]?.style.align ?? paragraph.style.align;
141583
142340
  let currentLine = [];
141584
142341
  let lineWidth = 0;
141585
142342
  let lineHeight = 0;
142343
+ let fallbackHeight = (para[0]?.style.fontSize ?? paragraph.style.fontSize ?? DEFAULT_FONT_SIZE) * scaleFactor * 1.2;
142344
+ const flushLine = () => {
142345
+ while (currentLine.length > 0 && /^\s+$/.test(currentLine[currentLine.length - 1].text)) {
142346
+ lineWidth -= currentLine.pop().measuredWidth;
142347
+ }
142348
+ lines.push({
142349
+ runs: currentLine,
142350
+ width: lineWidth,
142351
+ height: lineHeight || fallbackHeight,
142352
+ align: paraAlign
142353
+ });
142354
+ currentLine = [];
142355
+ lineWidth = 0;
142356
+ lineHeight = 0;
142357
+ };
141586
142358
  for (const seg of para) {
141587
142359
  ctx.font = buildFont(seg.style, scaleFactor);
141588
142360
  const fontSize = (seg.style.fontSize ?? DEFAULT_FONT_SIZE) * scaleFactor;
141589
142361
  const segHeight = fontSize * 1.2;
141590
- const tokens = seg.text.split(/(?<=\s)(?=\S)|(?<=\S)(?=\s)/);
142362
+ fallbackHeight = segHeight;
142363
+ if (seg.isLineBreak) {
142364
+ flushLine();
142365
+ continue;
142366
+ }
142367
+ const tokens = seg.text.split(/(\r\n|\r|\n)|(?<=\s)(?=\S)|(?<=\S)(?=\s)/);
141591
142368
  for (const raw of tokens) {
141592
142369
  if (!raw) {
141593
142370
  continue;
141594
142371
  }
142372
+ if (/^(\r\n|\r|\n)$/.test(raw)) {
142373
+ flushLine();
142374
+ continue;
142375
+ }
141595
142376
  if (/^\s+$/.test(raw)) {
141596
142377
  if (currentLine.length > 0) {
141597
142378
  const spaceW = ctx.measureText(raw).width;
@@ -141607,19 +142388,7 @@ function layoutParagraphs(ctx, paragraphs, maxWidth, scaleFactor) {
141607
142388
  const word = raw;
141608
142389
  const wordW = ctx.measureText(word).width;
141609
142390
  if (lineWidth + wordW > maxWidth && currentLine.length > 0) {
141610
- while (currentLine.length > 0 && /^\s+$/.test(currentLine[currentLine.length - 1].text)) {
141611
- const removed = currentLine.pop();
141612
- lineWidth -= removed.measuredWidth;
141613
- }
141614
- lines.push({
141615
- runs: currentLine,
141616
- width: lineWidth,
141617
- height: lineHeight,
141618
- align: paraAlign
141619
- });
141620
- currentLine = [];
141621
- lineWidth = 0;
141622
- lineHeight = 0;
142391
+ flushLine();
141623
142392
  }
141624
142393
  currentLine.push({
141625
142394
  text: word,
@@ -141630,14 +142399,7 @@ function layoutParagraphs(ctx, paragraphs, maxWidth, scaleFactor) {
141630
142399
  lineHeight = Math.max(lineHeight, segHeight);
141631
142400
  }
141632
142401
  }
141633
- if (currentLine.length > 0) {
141634
- lines.push({
141635
- runs: currentLine,
141636
- width: lineWidth,
141637
- height: lineHeight,
141638
- align: paraAlign
141639
- });
141640
- }
142402
+ flushLine();
141641
142403
  }
141642
142404
  return lines;
141643
142405
  }