ooxml-core 1.30.1 → 1.32.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 (418) hide show
  1. package/dist/{PptxHandler-KKLAYUGQ.mjs → PptxHandler-QY5VL3CY.mjs} +2 -2
  2. package/dist/PptxHandler-SJ5ZUIUX.mjs +4 -0
  3. package/dist/{PptxHandler-DHQPVTUI.cjs → PptxHandler-TESZUH66.cjs} +3 -3
  4. package/dist/{PresentationBuilder-YYZYCKTZ.mjs → PresentationBuilder-3CH5TR4W.mjs} +2 -2
  5. package/dist/{PresentationBuilder-JORMF5CP.cjs → PresentationBuilder-5NFBUP7Y.cjs} +5 -5
  6. package/dist/{PresentationBuilder-Q2Z33LLM.mjs → PresentationBuilder-S6HXHKEJ.mjs} +2 -2
  7. package/dist/automation/index.cjs +6446 -3410
  8. package/dist/automation/index.mjs +6446 -3410
  9. package/dist/automation/node.cjs +2 -1
  10. package/dist/automation/node.d.ts.map +1 -1
  11. package/dist/automation/node.mjs +2 -1
  12. package/dist/automation/tools/define.d.ts +2 -0
  13. package/dist/automation/tools/define.d.ts.map +1 -1
  14. package/dist/automation/tools/types.d.ts +6 -0
  15. package/dist/automation/tools/types.d.ts.map +1 -1
  16. package/dist/{chunk-GJDFCP2T.mjs → chunk-3H5UAJB3.mjs} +258 -155
  17. package/dist/{chunk-MKDONWNO.mjs → chunk-4R65YYAD.mjs} +32 -14
  18. package/dist/{chunk-KWJYMAEF.mjs → chunk-IOTGRLJH.mjs} +255 -152
  19. package/dist/{chunk-6FXOAMNL.mjs → chunk-N6424WKA.mjs} +1 -1
  20. package/dist/{chunk-WZJ25K7P.mjs → chunk-NAWLWKOJ.mjs} +1 -1
  21. package/dist/{chunk-DJ3CDTMX.mjs → chunk-O7SVHLD7.mjs} +23 -5
  22. package/dist/{chunk-CZXM4ZJH.cjs → chunk-Q6NM64J2.cjs} +23 -4
  23. package/dist/{chunk-FFJBOR2Y.mjs → chunk-UYMSFJQZ.mjs} +76 -4
  24. package/dist/{chunk-B4LXDHBX.cjs → chunk-X6VNUBES.cjs} +1419 -1316
  25. package/dist/collab/index.cjs +35 -4
  26. package/dist/collab/index.mjs +35 -4
  27. package/dist/collab/websocket-transport.d.ts +9 -1
  28. package/dist/collab/websocket-transport.d.ts.map +1 -1
  29. package/dist/diagram/index.cjs +8 -4
  30. package/dist/diagram/index.mjs +8 -4
  31. package/dist/docx/data-binding.d.ts +9 -0
  32. package/dist/docx/data-binding.d.ts.map +1 -0
  33. package/dist/docx/document-parts.d.ts +1 -0
  34. package/dist/docx/document-parts.d.ts.map +1 -1
  35. package/dist/docx/drawing.d.ts.map +1 -1
  36. package/dist/docx/embedded.cjs +1391 -613
  37. package/dist/docx/embedded.mjs +1391 -613
  38. package/dist/docx/index.cjs +1402 -622
  39. package/dist/docx/index.mjs +1402 -622
  40. package/dist/docx/inline-model.d.ts +2 -0
  41. package/dist/docx/inline-model.d.ts.map +1 -1
  42. package/dist/docx/layout/adapt-floats.d.ts.map +1 -1
  43. package/dist/docx/layout/adapt-table.d.ts.map +1 -1
  44. package/dist/docx/layout/adapter.d.ts.map +1 -1
  45. package/dist/docx/layout/equation-object.d.ts +1 -1
  46. package/dist/docx/layout/equation-object.d.ts.map +1 -1
  47. package/dist/docx/layout/floats.d.ts +1 -1
  48. package/dist/docx/layout/floats.d.ts.map +1 -1
  49. package/dist/docx/layout/flow-paragraph.d.ts +4 -0
  50. package/dist/docx/layout/flow-paragraph.d.ts.map +1 -1
  51. package/dist/docx/layout/flow-table.d.ts.map +1 -1
  52. package/dist/docx/layout/index.cjs +460 -207
  53. package/dist/docx/layout/index.mjs +460 -207
  54. package/dist/docx/layout/input.d.ts +12 -0
  55. package/dist/docx/layout/input.d.ts.map +1 -1
  56. package/dist/docx/layout/nested-frame-profile.d.ts +3 -1
  57. package/dist/docx/layout/nested-frame-profile.d.ts.map +1 -1
  58. package/dist/docx/layout/page-cursor.d.ts +11 -2
  59. package/dist/docx/layout/page-cursor.d.ts.map +1 -1
  60. package/dist/docx/layout/paragraph-fragments.d.ts.map +1 -1
  61. package/dist/docx/layout/paragraph-layout.d.ts +5 -0
  62. package/dist/docx/layout/paragraph-layout.d.ts.map +1 -1
  63. package/dist/docx/layout/result.d.ts +4 -0
  64. package/dist/docx/layout/result.d.ts.map +1 -1
  65. package/dist/docx/layout/section-flow.d.ts +2 -0
  66. package/dist/docx/layout/section-flow.d.ts.map +1 -1
  67. package/dist/docx/layout/table-layout.d.ts +4 -14
  68. package/dist/docx/layout/table-layout.d.ts.map +1 -1
  69. package/dist/docx/layout/table-merged-rows.d.ts +21 -0
  70. package/dist/docx/layout/table-merged-rows.d.ts.map +1 -0
  71. package/dist/docx/layout/table-row-split.d.ts +16 -0
  72. package/dist/docx/layout/table-row-split.d.ts.map +1 -0
  73. package/dist/docx/layout/wrap.d.ts +2 -0
  74. package/dist/docx/layout/wrap.d.ts.map +1 -1
  75. package/dist/docx/load/index.cjs +1405 -627
  76. package/dist/docx/load/index.mjs +1405 -627
  77. package/dist/docx/model-paragraph.d.ts +4 -1
  78. package/dist/docx/model-paragraph.d.ts.map +1 -1
  79. package/dist/docx/model.d.ts +24 -1
  80. package/dist/docx/model.d.ts.map +1 -1
  81. package/dist/docx/paragraph-properties.d.ts.map +1 -1
  82. package/dist/docx/paragraph-styles.d.ts.map +1 -1
  83. package/dist/docx/parse-table.d.ts.map +1 -1
  84. package/dist/docx/parse.d.ts.map +1 -1
  85. package/dist/docx/run-segmentation.d.ts.map +1 -1
  86. package/dist/docx/save-modified.d.ts +4 -0
  87. package/dist/docx/save-modified.d.ts.map +1 -0
  88. package/dist/docx/save.d.ts +2 -2
  89. package/dist/docx/save.d.ts.map +1 -1
  90. package/dist/docx/style-formatting-package.d.ts +9 -0
  91. package/dist/docx/style-formatting-package.d.ts.map +1 -0
  92. package/dist/docx/style-numbering-package.d.ts +4 -1
  93. package/dist/docx/style-numbering-package.d.ts.map +1 -1
  94. package/dist/docx/table-grid.d.ts +35 -0
  95. package/dist/docx/table-grid.d.ts.map +1 -0
  96. package/dist/docx/table-structure-cells.d.ts +19 -0
  97. package/dist/docx/table-structure-cells.d.ts.map +1 -0
  98. package/dist/docx/table-structure-check.d.ts +12 -0
  99. package/dist/docx/table-structure-check.d.ts.map +1 -0
  100. package/dist/docx/table-structure-merge.d.ts +28 -0
  101. package/dist/docx/table-structure-merge.d.ts.map +1 -0
  102. package/dist/docx/table-structure.d.ts +30 -0
  103. package/dist/docx/table-structure.d.ts.map +1 -0
  104. package/dist/docx/ui/index.cjs +725 -260
  105. package/dist/docx/ui/index.d.ts +4 -0
  106. package/dist/docx/ui/index.d.ts.map +1 -1
  107. package/dist/docx/ui/index.mjs +711 -261
  108. package/dist/docx/ui/ribbon-action-ids.d.ts +1 -1
  109. package/dist/docx/ui/ribbon-action-ids.d.ts.map +1 -1
  110. package/dist/docx/ui/table-structure-guard.d.ts +2 -0
  111. package/dist/docx/ui/table-structure-guard.d.ts.map +1 -1
  112. package/dist/docx/word-content-control-docs.d.ts +5 -0
  113. package/dist/docx/word-content-control-docs.d.ts.map +1 -0
  114. package/dist/docx/word-corpus-gaps.d.ts +10 -0
  115. package/dist/docx/word-corpus-gaps.d.ts.map +1 -0
  116. package/dist/docx/word-measurer.d.ts +6 -0
  117. package/dist/docx/word-measurer.d.ts.map +1 -0
  118. package/dist/docx/word-spacing-docs.d.ts +12 -0
  119. package/dist/docx/word-spacing-docs.d.ts.map +1 -0
  120. package/dist/docx/word-table-docs.d.ts +9 -0
  121. package/dist/docx/word-table-docs.d.ts.map +1 -0
  122. package/dist/docx/write-drawing.d.ts.map +1 -1
  123. package/dist/docx/write-fallback.d.ts +5 -0
  124. package/dist/docx/write-fallback.d.ts.map +1 -0
  125. package/dist/docx/write-table-properties.d.ts +1 -0
  126. package/dist/docx/write-table-properties.d.ts.map +1 -1
  127. package/dist/docx/write-table-structure.d.ts +14 -0
  128. package/dist/docx/write-table-structure.d.ts.map +1 -0
  129. package/dist/docx/write-table.d.ts +3 -4
  130. package/dist/docx/write-table.d.ts.map +1 -1
  131. package/dist/geometry/index.cjs +16 -12
  132. package/dist/geometry/index.mjs +16 -12
  133. package/dist/geometry/preset-shape-definitions-table.d.ts.map +1 -1
  134. package/dist/index.cjs +38 -34
  135. package/dist/index.mjs +38 -34
  136. package/dist/math/index.cjs +22 -22
  137. package/dist/math/index.mjs +22 -22
  138. package/dist/math/omml-box-grouped.d.ts.map +1 -1
  139. package/dist/math/omml-box-layout.d.ts +3 -1
  140. package/dist/math/omml-box-layout.d.ts.map +1 -1
  141. package/dist/math/omml-box-structures.d.ts.map +1 -1
  142. package/dist/math/omml-box.d.ts +2 -0
  143. package/dist/math/omml-box.d.ts.map +1 -1
  144. package/dist/math/omml-svg.d.ts +6 -2
  145. package/dist/math/omml-svg.d.ts.map +1 -1
  146. package/dist/pptx/automation/index.cjs +295 -157
  147. package/dist/pptx/automation/index.d.ts +9 -3
  148. package/dist/pptx/automation/index.d.ts.map +1 -1
  149. package/dist/pptx/automation/index.mjs +6 -5
  150. package/dist/pptx/chunks/{index-PdM5zpmu.d.ts → index-D-FdgqrP.d.ts} +102 -3
  151. package/dist/pptx/chunks/index-D-FdgqrP.d.ts.map +1 -0
  152. package/dist/pptx/chunks/{index-BQDcu_0a.d.ts → index-DKybuHPT.d.ts} +51 -3
  153. package/dist/pptx/chunks/{index-BQDcu_0a.d.ts.map → index-DKybuHPT.d.ts.map} +1 -1
  154. package/dist/pptx/chunks/{index-CBV1oHN7.d.ts → index-DnWlmYCy.d.ts} +2 -2
  155. package/dist/pptx/chunks/{index-CBV1oHN7.d.ts.map → index-DnWlmYCy.d.ts.map} +1 -1
  156. package/dist/pptx/cli/index.cjs +294 -157
  157. package/dist/pptx/cli/index.mjs +4 -4
  158. package/dist/pptx/converter/index.cjs +8 -4
  159. package/dist/pptx/converter/index.d.ts +1 -1
  160. package/dist/pptx/converter/index.mjs +2 -2
  161. package/dist/pptx/editor/render/find-replace.cjs +14 -14
  162. package/dist/pptx/editor/render/find-replace.d.ts +1 -1
  163. package/dist/pptx/editor/render/find-replace.mjs +1 -1
  164. package/dist/pptx/editor/render/slide-operations.cjs +8 -8
  165. package/dist/pptx/editor/render/slide-operations.mjs +2 -2
  166. package/dist/pptx/index.cjs +380 -171
  167. package/dist/pptx/index.d.ts +4 -4
  168. package/dist/pptx/index.mjs +5 -5
  169. package/dist/pptx/node/index.d.ts +1 -1
  170. package/dist/teams/chat-rooms.d.ts.map +1 -1
  171. package/dist/teams/chat-view.d.ts +10 -1
  172. package/dist/teams/chat-view.d.ts.map +1 -1
  173. package/dist/teams/chat.d.ts +7 -0
  174. package/dist/teams/chat.d.ts.map +1 -1
  175. package/dist/teams/files.d.ts +1 -1
  176. package/dist/teams/files.d.ts.map +1 -1
  177. package/dist/teams/index.cjs +3471 -1223
  178. package/dist/teams/index.d.ts +4 -0
  179. package/dist/teams/index.d.ts.map +1 -1
  180. package/dist/teams/index.mjs +3435 -1223
  181. package/dist/teams/message-transfer.d.ts +1 -1
  182. package/dist/teams/message-transfer.d.ts.map +1 -1
  183. package/dist/teams/presence-controller.d.ts +18 -3
  184. package/dist/teams/presence-controller.d.ts.map +1 -1
  185. package/dist/teams/presence-meetings.d.ts +21 -0
  186. package/dist/teams/presence-meetings.d.ts.map +1 -0
  187. package/dist/teams/presence.d.ts +40 -2
  188. package/dist/teams/presence.d.ts.map +1 -1
  189. package/dist/teams/protocol.d.ts +30 -0
  190. package/dist/teams/protocol.d.ts.map +1 -0
  191. package/dist/teams/schema.d.ts +59 -0
  192. package/dist/teams/schema.d.ts.map +1 -0
  193. package/dist/teams/server-config.d.ts +19 -2
  194. package/dist/teams/server-config.d.ts.map +1 -1
  195. package/dist/teams/server-file-storage.d.ts +11 -1
  196. package/dist/teams/server-file-storage.d.ts.map +1 -1
  197. package/dist/teams/server-session.d.ts +2 -0
  198. package/dist/teams/server-session.d.ts.map +1 -1
  199. package/dist/teams/signaling.d.ts +2 -0
  200. package/dist/teams/signaling.d.ts.map +1 -1
  201. package/dist/teams/store.d.ts +14 -0
  202. package/dist/teams/store.d.ts.map +1 -1
  203. package/dist/teams/stored-file.d.ts +1 -1
  204. package/dist/teams/stored-file.d.ts.map +1 -1
  205. package/dist/teams/sync-transport.d.ts.map +1 -1
  206. package/dist/teams/validate-members.d.ts +28 -0
  207. package/dist/teams/validate-members.d.ts.map +1 -0
  208. package/dist/teams/validate-owned.d.ts +20 -0
  209. package/dist/teams/validate-owned.d.ts.map +1 -0
  210. package/dist/teams/validate-update.d.ts +70 -0
  211. package/dist/teams/validate-update.d.ts.map +1 -0
  212. package/dist/teams/view.d.ts +5 -0
  213. package/dist/teams/view.d.ts.map +1 -1
  214. package/dist/teams/workspace.d.ts +17 -2
  215. package/dist/teams/workspace.d.ts.map +1 -1
  216. package/dist/visio/connector-route-walk.d.ts +2 -0
  217. package/dist/visio/connector-route-walk.d.ts.map +1 -1
  218. package/dist/visio/edit-connector-reroute.d.ts.map +1 -1
  219. package/dist/visio/edit-connector.d.ts +2 -0
  220. package/dist/visio/edit-connector.d.ts.map +1 -1
  221. package/dist/visio/edit-delete.d.ts.map +1 -1
  222. package/dist/visio/edit-duplicate-line.d.ts +40 -0
  223. package/dist/visio/edit-duplicate-line.d.ts.map +1 -0
  224. package/dist/visio/edit-duplicate.d.ts.map +1 -1
  225. package/dist/visio/edit-formatting-scope.d.ts +5 -1
  226. package/dist/visio/edit-formatting-scope.d.ts.map +1 -1
  227. package/dist/visio/edit-geometry.d.ts.map +1 -1
  228. package/dist/visio/edit-instance-duplicate.d.ts +2 -1
  229. package/dist/visio/edit-instance-duplicate.d.ts.map +1 -1
  230. package/dist/visio/edit-master-move.d.ts.map +1 -1
  231. package/dist/visio/edit-recalculate-index.d.ts +23 -0
  232. package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
  233. package/dist/visio/edit-recalculate-text.d.ts +12 -0
  234. package/dist/visio/edit-recalculate-text.d.ts.map +1 -0
  235. package/dist/visio/edit-recalculate-values.d.ts.map +1 -1
  236. package/dist/visio/edit-recalculate.d.ts +15 -3
  237. package/dist/visio/edit-recalculate.d.ts.map +1 -1
  238. package/dist/visio/edit-resize-anchor.d.ts.map +1 -1
  239. package/dist/visio/edit-stencil-connector-layout.d.ts +1 -1
  240. package/dist/visio/edit-stencil-connector-layout.d.ts.map +1 -1
  241. package/dist/visio/edit-text-scope.d.ts +4 -1
  242. package/dist/visio/edit-text-scope.d.ts.map +1 -1
  243. package/dist/visio/formula-analyze.d.ts +18 -0
  244. package/dist/visio/formula-analyze.d.ts.map +1 -0
  245. package/dist/visio/formula-bound.d.ts +4 -0
  246. package/dist/visio/formula-bound.d.ts.map +1 -0
  247. package/dist/visio/formula-evaluate.d.ts +2 -9
  248. package/dist/visio/formula-evaluate.d.ts.map +1 -1
  249. package/dist/visio/formula-extra-functions.d.ts +23 -0
  250. package/dist/visio/formula-extra-functions.d.ts.map +1 -0
  251. package/dist/visio/formula-indirect.d.ts +6 -0
  252. package/dist/visio/formula-indirect.d.ts.map +1 -0
  253. package/dist/visio/formula-master.d.ts +1 -0
  254. package/dist/visio/formula-master.d.ts.map +1 -1
  255. package/dist/visio/formula-operators.d.ts +6 -0
  256. package/dist/visio/formula-operators.d.ts.map +1 -0
  257. package/dist/visio/formula-text-functions.d.ts +5 -1
  258. package/dist/visio/formula-text-functions.d.ts.map +1 -1
  259. package/dist/visio/formula.d.ts +12 -0
  260. package/dist/visio/formula.d.ts.map +1 -1
  261. package/dist/visio/index.cjs +1359 -396
  262. package/dist/visio/index.mjs +1359 -396
  263. package/dist/visio/ui/index.cjs +1346 -383
  264. package/dist/visio/ui/index.mjs +1346 -383
  265. package/dist/xlsx/collab/apply.d.ts.map +1 -1
  266. package/dist/xlsx/collab/codec.d.ts +2 -0
  267. package/dist/xlsx/collab/codec.d.ts.map +1 -1
  268. package/dist/xlsx/collab/dirty.d.ts +4 -1
  269. package/dist/xlsx/collab/dirty.d.ts.map +1 -1
  270. package/dist/xlsx/collab/index.cjs +551 -106
  271. package/dist/xlsx/collab/index.mjs +551 -106
  272. package/dist/xlsx/collab/keyed.d.ts +36 -0
  273. package/dist/xlsx/collab/keyed.d.ts.map +1 -0
  274. package/dist/xlsx/collab/names.d.ts +2 -0
  275. package/dist/xlsx/collab/names.d.ts.map +1 -1
  276. package/dist/xlsx/collab/part-specs.d.ts +13 -0
  277. package/dist/xlsx/collab/part-specs.d.ts.map +1 -0
  278. package/dist/xlsx/collab/schema.d.ts +8 -0
  279. package/dist/xlsx/collab/schema.d.ts.map +1 -1
  280. package/dist/xlsx/collab/sheet-parts.d.ts +19 -0
  281. package/dist/xlsx/collab/sheet-parts.d.ts.map +1 -0
  282. package/dist/xlsx/collab/sheets.d.ts +6 -0
  283. package/dist/xlsx/collab/sheets.d.ts.map +1 -1
  284. package/dist/xlsx/collab/write.d.ts +3 -0
  285. package/dist/xlsx/collab/write.d.ts.map +1 -1
  286. package/dist/xlsx/edit/clipboard-areas.d.ts +17 -0
  287. package/dist/xlsx/edit/clipboard-areas.d.ts.map +1 -0
  288. package/dist/xlsx/edit/custom-views.d.ts +21 -0
  289. package/dist/xlsx/edit/custom-views.d.ts.map +1 -0
  290. package/dist/xlsx/edit/data-table.d.ts.map +1 -1
  291. package/dist/xlsx/edit/history.d.ts +1 -1
  292. package/dist/xlsx/edit/history.d.ts.map +1 -1
  293. package/dist/xlsx/edit/index.d.ts +2 -0
  294. package/dist/xlsx/edit/index.d.ts.map +1 -1
  295. package/dist/xlsx/edit/paste-selection.d.ts.map +1 -1
  296. package/dist/xlsx/edit/scenario-merge.d.ts +7 -0
  297. package/dist/xlsx/edit/scenario-merge.d.ts.map +1 -0
  298. package/dist/xlsx/edit/session.d.ts.map +1 -1
  299. package/dist/xlsx/edit/shift-data-tables.d.ts +7 -0
  300. package/dist/xlsx/edit/shift-data-tables.d.ts.map +1 -0
  301. package/dist/xlsx/edit/shift-scenarios.d.ts +7 -0
  302. package/dist/xlsx/edit/shift-scenarios.d.ts.map +1 -0
  303. package/dist/xlsx/edit/shift-sheet.d.ts.map +1 -1
  304. package/dist/xlsx/edit/sparkline-grouping.d.ts +10 -0
  305. package/dist/xlsx/edit/sparkline-grouping.d.ts.map +1 -0
  306. package/dist/xlsx/edit/types.d.ts +21 -0
  307. package/dist/xlsx/edit/types.d.ts.map +1 -1
  308. package/dist/xlsx/formula/ets-drift-compare.d.ts +19 -0
  309. package/dist/xlsx/formula/ets-drift-compare.d.ts.map +1 -0
  310. package/dist/xlsx/formula/ets-excel-compare.d.ts +36 -0
  311. package/dist/xlsx/formula/ets-excel-compare.d.ts.map +1 -0
  312. package/dist/xlsx/formula/ets-init-compare.d.ts +24 -0
  313. package/dist/xlsx/formula/ets-init-compare.d.ts.map +1 -0
  314. package/dist/xlsx/formula/ets-init-maps.d.ts +21 -0
  315. package/dist/xlsx/formula/ets-init-maps.d.ts.map +1 -0
  316. package/dist/xlsx/formula/functions/ets-core.d.ts +36 -0
  317. package/dist/xlsx/formula/functions/ets-core.d.ts.map +1 -0
  318. package/dist/xlsx/formula/functions/ets-grid.d.ts +15 -0
  319. package/dist/xlsx/formula/functions/ets-grid.d.ts.map +1 -0
  320. package/dist/xlsx/formula/functions/ets-init-chain.d.ts +11 -0
  321. package/dist/xlsx/formula/functions/ets-init-chain.d.ts.map +1 -0
  322. package/dist/xlsx/formula/functions/ets-init-four.d.ts +3 -0
  323. package/dist/xlsx/formula/functions/ets-init-four.d.ts.map +1 -0
  324. package/dist/xlsx/formula/functions/ets-init-short.d.ts +17 -0
  325. package/dist/xlsx/formula/functions/ets-init-short.d.ts.map +1 -0
  326. package/dist/xlsx/formula/functions/ets-init-states.d.ts +5 -0
  327. package/dist/xlsx/formula/functions/ets-init-states.d.ts.map +1 -0
  328. package/dist/xlsx/formula/functions/ets-init-three.d.ts +23 -0
  329. package/dist/xlsx/formula/functions/ets-init-three.d.ts.map +1 -0
  330. package/dist/xlsx/formula/functions/ets-init-threeplus.d.ts +13 -0
  331. package/dist/xlsx/formula/functions/ets-init-threeplus.d.ts.map +1 -0
  332. package/dist/xlsx/formula/functions/ets-init.d.ts +33 -0
  333. package/dist/xlsx/formula/functions/ets-init.d.ts.map +1 -0
  334. package/dist/xlsx/formula/functions/ets-input.d.ts +13 -0
  335. package/dist/xlsx/formula/functions/ets-input.d.ts.map +1 -0
  336. package/dist/xlsx/formula/functions/ets-search-map.d.ts +24 -0
  337. package/dist/xlsx/formula/functions/ets-search-map.d.ts.map +1 -0
  338. package/dist/xlsx/formula/functions/ets-search.d.ts +17 -0
  339. package/dist/xlsx/formula/functions/ets-search.d.ts.map +1 -0
  340. package/dist/xlsx/formula/functions/ets-season.d.ts +6 -0
  341. package/dist/xlsx/formula/functions/ets-season.d.ts.map +1 -0
  342. package/dist/xlsx/formula/functions/ets-validate.d.ts +16 -0
  343. package/dist/xlsx/formula/functions/ets-validate.d.ts.map +1 -0
  344. package/dist/xlsx/formula/functions/forecast-ets.d.ts +3 -0
  345. package/dist/xlsx/formula/functions/forecast-ets.d.ts.map +1 -0
  346. package/dist/xlsx/formula/functions/statistical.d.ts.map +1 -1
  347. package/dist/xlsx/index.cjs +5118 -2648
  348. package/dist/xlsx/index.mjs +5097 -2649
  349. package/dist/xlsx/layout/form-control-link.d.ts +20 -0
  350. package/dist/xlsx/layout/form-control-link.d.ts.map +1 -0
  351. package/dist/xlsx/layout/form-control-state.d.ts +49 -0
  352. package/dist/xlsx/layout/form-control-state.d.ts.map +1 -0
  353. package/dist/xlsx/layout/form-control-view.d.ts +11 -0
  354. package/dist/xlsx/layout/form-control-view.d.ts.map +1 -0
  355. package/dist/xlsx/layout/header-footer-edit.d.ts +4 -2
  356. package/dist/xlsx/layout/header-footer-edit.d.ts.map +1 -1
  357. package/dist/xlsx/layout/header-footer.d.ts +16 -0
  358. package/dist/xlsx/layout/header-footer.d.ts.map +1 -1
  359. package/dist/xlsx/layout/index.d.ts +5 -0
  360. package/dist/xlsx/layout/index.d.ts.map +1 -1
  361. package/dist/xlsx/layout/ref-evaluator.d.ts +6 -0
  362. package/dist/xlsx/layout/ref-evaluator.d.ts.map +1 -1
  363. package/dist/xlsx/layout/shape-paint.d.ts +25 -0
  364. package/dist/xlsx/layout/shape-paint.d.ts.map +1 -0
  365. package/dist/xlsx/layout/shape-view.d.ts +15 -0
  366. package/dist/xlsx/layout/shape-view.d.ts.map +1 -0
  367. package/dist/xlsx/load/index.cjs +2667 -1163
  368. package/dist/xlsx/load/index.mjs +2667 -1163
  369. package/dist/xlsx/model-custom-views.d.ts +33 -0
  370. package/dist/xlsx/model-custom-views.d.ts.map +1 -0
  371. package/dist/xlsx/model-shapes.d.ts +78 -0
  372. package/dist/xlsx/model-shapes.d.ts.map +1 -0
  373. package/dist/xlsx/model.d.ts +38 -1
  374. package/dist/xlsx/model.d.ts.map +1 -1
  375. package/dist/xlsx/read/custom-views.d.ts +5 -0
  376. package/dist/xlsx/read/custom-views.d.ts.map +1 -0
  377. package/dist/xlsx/read/drawing.d.ts.map +1 -1
  378. package/dist/xlsx/read/form-control.d.ts +14 -0
  379. package/dist/xlsx/read/form-control.d.ts.map +1 -0
  380. package/dist/xlsx/read/header-footer-images.d.ts +5 -0
  381. package/dist/xlsx/read/header-footer-images.d.ts.map +1 -0
  382. package/dist/xlsx/read/load.d.ts.map +1 -1
  383. package/dist/xlsx/read/shape.d.ts +5 -0
  384. package/dist/xlsx/read/shape.d.ts.map +1 -0
  385. package/dist/xlsx/read/sheet-data.d.ts.map +1 -1
  386. package/dist/xlsx/read/workbook-part.d.ts +5 -1
  387. package/dist/xlsx/read/workbook-part.d.ts.map +1 -1
  388. package/dist/xlsx/read/worksheet-children.d.ts +3 -0
  389. package/dist/xlsx/read/worksheet-children.d.ts.map +1 -0
  390. package/dist/xlsx/read/worksheet.d.ts.map +1 -1
  391. package/dist/xlsx/ui/commands/i18n/sparklines.d.ts.map +1 -1
  392. package/dist/xlsx/ui/commands/i18n/what-if.d.ts.map +1 -1
  393. package/dist/xlsx/ui/commands/what-if.d.ts +0 -1
  394. package/dist/xlsx/ui/commands/what-if.d.ts.map +1 -1
  395. package/dist/xlsx/ui/dialogs/forecast-sheet.d.ts +51 -0
  396. package/dist/xlsx/ui/dialogs/forecast-sheet.d.ts.map +1 -0
  397. package/dist/xlsx/ui/dialogs/scenario-summary.d.ts +15 -0
  398. package/dist/xlsx/ui/dialogs/scenario-summary.d.ts.map +1 -0
  399. package/dist/xlsx/ui/index.cjs +5088 -2399
  400. package/dist/xlsx/ui/index.d.ts +2 -0
  401. package/dist/xlsx/ui/index.d.ts.map +1 -1
  402. package/dist/xlsx/ui/index.mjs +5081 -2398
  403. package/dist/xlsx/ui/locales/de/grid.d.ts.map +1 -1
  404. package/dist/xlsx/ui/locales/en/grid.d.ts.map +1 -1
  405. package/dist/xlsx/ui/locales/es/grid.d.ts.map +1 -1
  406. package/dist/xlsx/ui/locales/fr/grid.d.ts.map +1 -1
  407. package/dist/xlsx/ui/locales/zh-CN/grid.d.ts.map +1 -1
  408. package/dist/xlsx/write/custom-views.d.ts +4 -0
  409. package/dist/xlsx/write/custom-views.d.ts.map +1 -0
  410. package/dist/xlsx/write/drawing.d.ts.map +1 -1
  411. package/dist/xlsx/write/form-control.d.ts +4 -0
  412. package/dist/xlsx/write/form-control.d.ts.map +1 -0
  413. package/dist/xlsx/write/sheet-data.d.ts.map +1 -1
  414. package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
  415. package/dist/xlsx/write/worksheet.d.ts.map +1 -1
  416. package/package.json +1 -1
  417. package/dist/PptxHandler-E4DDV3FQ.mjs +0 -4
  418. package/dist/pptx/chunks/index-PdM5zpmu.d.ts.map +0 -1
@@ -543,6 +543,8 @@ function resolveParagraphFormatting(paragraph, catalog) {
543
543
  "direction",
544
544
  "spacingBeforeTwips",
545
545
  "spacingAfterTwips",
546
+ "spacingBeforeAuto",
547
+ "spacingAfterAuto",
546
548
  "lineSpacingTwips",
547
549
  "lineSpacingRule",
548
550
  "indentLeftTwips",
@@ -1769,14 +1771,6 @@ function escapeXmlAttr(value) {
1769
1771
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
1770
1772
  }
1771
1773
 
1772
- // docx/expect-defined.ts
1773
- function expectDefined(value, context) {
1774
- if (value === void 0 || value === null) {
1775
- throw new Error(`Internal invariant violated: ${context} is missing.`);
1776
- }
1777
- return value;
1778
- }
1779
-
1780
1774
  // docx/element-order.ts
1781
1775
  function orderChildren(parent, order) {
1782
1776
  const elements2 = Array.from(parent.childNodes).filter(isElement);
@@ -1846,6 +1840,55 @@ function orderParagraphProperties(props) {
1846
1840
  orderChildren(props, PPR_ORDER);
1847
1841
  }
1848
1842
 
1843
+ // docx/expect-defined.ts
1844
+ function expectDefined(value, context) {
1845
+ if (value === void 0 || value === null) {
1846
+ throw new Error(`Internal invariant violated: ${context} is missing.`);
1847
+ }
1848
+ return value;
1849
+ }
1850
+
1851
+ // docx/table-grid.ts
1852
+ var spanOf = (cell) => Math.max(1, cell.gridSpan ?? 1);
1853
+ function tableGrid(table) {
1854
+ const columns = table.grid?.length ?? sumSpans(table.rows[0]);
1855
+ if (!columns || !table.rows.length) return void 0;
1856
+ const rows2 = [];
1857
+ const cover = [];
1858
+ for (let row2 = 0; row2 < table.rows.length; row2++) {
1859
+ const cells = table.rows[row2] ?? [];
1860
+ if (!cells.length || sumSpans(cells) !== columns) return void 0;
1861
+ const placed2 = [];
1862
+ const line3 = new Array(columns);
1863
+ let col = 0;
1864
+ cells.forEach((cell, index) => {
1865
+ const entry = { cell, row: row2, index, col, span: spanOf(cell) };
1866
+ for (let k = 0; k < entry.span; k++) line3[col + k] = entry;
1867
+ col += entry.span;
1868
+ placed2.push(entry);
1869
+ });
1870
+ rows2.push(placed2);
1871
+ cover.push(line3);
1872
+ }
1873
+ const grid = { columns, rows: rows2, cover };
1874
+ for (const entry of rows2.flat())
1875
+ if (entry.cell.verticalMerge === "continue") {
1876
+ const above2 = entry.row > 0 ? cover[entry.row - 1]?.[entry.col] : void 0;
1877
+ if (!above2 || above2.col !== entry.col || above2.span !== entry.span) return void 0;
1878
+ if (!above2.cell.verticalMerge) return void 0;
1879
+ }
1880
+ return grid;
1881
+ }
1882
+ function sumSpans(cells) {
1883
+ return (cells ?? []).reduce((sum, cell) => sum + spanOf(cell), 0);
1884
+ }
1885
+ function rowSpanOf(grid, entry) {
1886
+ if (entry.cell.verticalMerge !== "restart") return 1;
1887
+ let height = 1;
1888
+ while (grid.cover[entry.row + height]?.[entry.col]?.cell.verticalMerge === "continue") height++;
1889
+ return height;
1890
+ }
1891
+
1849
1892
  // docx/special-characters.ts
1850
1893
  function symbolCharacter(char) {
1851
1894
  const code = /^[0-9a-f]{1,6}$/i.test(char) ? Number.parseInt(char, 16) : Number.NaN;
@@ -9291,7 +9334,8 @@ var pie = {
9291
9334
  gd16("stAng", "pin 0 adj1 21599999"),
9292
9335
  gd16("endAng", "pin 0 adj2 21599999"),
9293
9336
  gd16("swAng", "+- endAng 0 stAng"),
9294
- gd16("swAng2", "?: swAng swAng +- 21600000 swAng 0"),
9337
+ gd16("swAngWrap", "+- swAng 21600000 0"),
9338
+ gd16("swAng2", "?: swAng swAng swAngWrap"),
9295
9339
  gd16("stx", "cos wd2 stAng"),
9296
9340
  gd16("sty", "sin hd2 stAng"),
9297
9341
  gd16("x1", "+- hc stx 0"),
@@ -9336,7 +9380,8 @@ var chord = {
9336
9380
  gd16("stAng", "pin 0 adj1 21599999"),
9337
9381
  gd16("endAng", "pin 0 adj2 21599999"),
9338
9382
  gd16("swAng", "+- endAng 0 stAng"),
9339
- gd16("swAng2", "?: swAng swAng +- 21600000 swAng 0"),
9383
+ gd16("swAngWrap", "+- swAng 21600000 0"),
9384
+ gd16("swAng2", "?: swAng swAng swAngWrap"),
9340
9385
  gd16("stx", "cos wd2 stAng"),
9341
9386
  gd16("sty", "sin hd2 stAng"),
9342
9387
  gd16("x1", "+- hc stx 0"),
@@ -9360,7 +9405,8 @@ var arc = {
9360
9405
  gd16("stAng", "pin 0 adj1 21599999"),
9361
9406
  gd16("endAng", "pin 0 adj2 21599999"),
9362
9407
  gd16("swAng", "+- endAng 0 stAng"),
9363
- gd16("swAng2", "?: swAng swAng +- 21600000 swAng 0"),
9408
+ gd16("swAngWrap", "+- swAng 21600000 0"),
9409
+ gd16("swAng2", "?: swAng swAng swAngWrap"),
9364
9410
  gd16("stx", "cos wd2 stAng"),
9365
9411
  gd16("sty", "sin hd2 stAng"),
9366
9412
  gd16("x1", "+- hc stx 0"),
@@ -9455,7 +9501,8 @@ var blockArc = {
9455
9501
  gd16("iwd2", "+- wd2 0 thw"),
9456
9502
  gd16("ihd2", "+- hd2 0 thh2"),
9457
9503
  gd16("swAng", "+- endAng 0 stAng"),
9458
- gd16("swAng2", "?: swAng swAng +- 21600000 swAng 0"),
9504
+ gd16("swAngWrap", "+- swAng 21600000 0"),
9505
+ gd16("swAng2", "?: swAng swAng swAngWrap"),
9459
9506
  gd16("mswAng", "+- 0 0 swAng2"),
9460
9507
  gd16("stx", "cos wd2 stAng"),
9461
9508
  gd16("sty", "sin hd2 stAng"),
@@ -16974,6 +17021,10 @@ function parseDirectParagraphProperties(props) {
16974
17021
  const line3 = signedTwipValue(getW(spacing2, "line"));
16975
17022
  if (before !== void 0) paragraph.spacingBeforeTwips = before;
16976
17023
  if (after !== void 0) paragraph.spacingAfterTwips = after;
17024
+ const beforeAuto = parseOnOff(getW(spacing2, "beforeAutospacing"));
17025
+ const afterAuto = parseOnOff(getW(spacing2, "afterAutospacing"));
17026
+ if (beforeAuto !== void 0) paragraph.spacingBeforeAuto = beforeAuto;
17027
+ if (afterAuto !== void 0) paragraph.spacingAfterAuto = afterAuto;
16977
17028
  if (line3 !== void 0) {
16978
17029
  paragraph.lineSpacingTwips = line3;
16979
17030
  }
@@ -18658,8 +18709,8 @@ function justify(fragments, width) {
18658
18709
  const spaceIndices = fragments.map((f, i) => f.text === " " ? i : -1).filter((i) => i >= 0);
18659
18710
  if (!spaceIndices.length || !fragments.length) return fragments;
18660
18711
  const natural = fragments.at(-1).xPx + fragments.at(-1).widthPx;
18661
- const extra = Math.max(0, width - natural) / spaceIndices.length;
18662
- if (extra <= 0) return fragments;
18712
+ const extra = (width - natural) / spaceIndices.length;
18713
+ if (extra === 0) return fragments;
18663
18714
  let shift = 0;
18664
18715
  return fragments.map((fragment, index) => {
18665
18716
  const placedFragment = { ...fragment, xPx: fragment.xPx + shift };
@@ -18703,6 +18754,7 @@ function cachedParagraphLayout(measurer, key, note, compute) {
18703
18754
  }
18704
18755
 
18705
18756
  // docx/layout/paragraph-layout.ts
18757
+ var SPACE_SHRINK = 0.145;
18706
18758
  function layoutParagraph(paragraph, contentWidthPx, measurer, note, lineBox, startToken = 0) {
18707
18759
  if (lineBox)
18708
18760
  return measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, startToken);
@@ -18741,6 +18793,8 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
18741
18793
  let widthOverflowNoted = false;
18742
18794
  let placed2 = [];
18743
18795
  let lineWidthPx = 0;
18796
+ let lineSpacePx = 0;
18797
+ let jump;
18744
18798
  let marginReachPx = 0;
18745
18799
  let tokenCursor = startToken;
18746
18800
  let firstToken = startToken;
@@ -18758,7 +18812,8 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
18758
18812
  boxes[lineIndex] = {
18759
18813
  leftInsetPx: box?.leftInsetPx ?? 0,
18760
18814
  rightInsetPx: box?.rightInsetPx ?? 0,
18761
- gapBeforePx: gap
18815
+ gapBeforePx: gap,
18816
+ ...box?.hole ? { hole: box.hole } : {}
18762
18817
  };
18763
18818
  }
18764
18819
  return expectDefined(boxes[lineIndex], "line box");
@@ -18805,7 +18860,7 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
18805
18860
  while (rendered.length && rendered.at(-1).token.kind === "space") rendered.pop();
18806
18861
  const fragments = buildFragments(rendered, paragraph);
18807
18862
  const [firstPlaced] = placed2;
18808
- const start = firstPlaced ? globalOffset(firstPlaced.token) : 0;
18863
+ const start = lines.length === 0 && startToken === 0 ? 0 : firstPlaced ? globalOffset(firstPlaced.token) : 0;
18809
18864
  const last = placed2.at(-1)?.token;
18810
18865
  const end = last ? globalOffset(last, last.kind === "word" || last.kind === "space" ? last.text.length : 1) : start;
18811
18866
  const gapBeforePx = boxFor(lineIndex).gapBeforePx;
@@ -18821,6 +18876,9 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
18821
18876
  fragment.topPx = baselinePx - extent2.above;
18822
18877
  if (token.kind !== "object") fragment.boxHeightPx = extent2.ascent + extent2.descent;
18823
18878
  });
18879
+ if (jump) {
18880
+ for (const fragment of fragments.slice(jump.index)) fragment.xPx += jump.shiftPx;
18881
+ }
18824
18882
  lines.push({
18825
18883
  yPx: 0,
18826
18884
  heightPx,
@@ -18837,6 +18895,8 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
18837
18895
  if (forcedByBreak === "column") columnBreakAfterLine.add(lineIndex);
18838
18896
  placed2 = [];
18839
18897
  lineWidthPx = 0;
18898
+ lineSpacePx = 0;
18899
+ jump = void 0;
18840
18900
  marginReachPx = 0;
18841
18901
  }
18842
18902
  for (const [tokenIndex, token] of tokens.entries()) {
@@ -18886,9 +18946,19 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
18886
18946
  leader = tab.leader === "none" ? void 0 : tab.leader;
18887
18947
  }
18888
18948
  const lineIndex = lines.length;
18889
- const limit = Math.max(availableWidth(lineIndex), marginReachPx);
18890
- const wouldFit = lineWidthPx + (token.kind === "tab" ? width : advance) <= limit || placed2.every((placed3) => paragraph.runs[placed3.token.runIndex]?.synthetic);
18891
- if (!wouldFit && token.kind !== "space") {
18949
+ const hole = boxFor(lineIndex).hole;
18950
+ const beforeHole = hole && !jump ? hole.startPx - lineStart(lineIndex) : void 0;
18951
+ const limit = Math.max(
18952
+ beforeHole ?? availableWidth(lineIndex) - (jump?.shiftPx ?? 0),
18953
+ marginReachPx
18954
+ );
18955
+ const squeezePx = effectiveAlign === "justify" && token.kind === "word" ? lineSpacePx * SPACE_SHRINK : 0;
18956
+ const fits = lineWidthPx + (token.kind === "tab" ? width : advance) <= limit + squeezePx;
18957
+ const wouldFit = fits || placed2.every((placed3) => paragraph.runs[placed3.token.runIndex]?.synthetic);
18958
+ const pastHole = !fits && hole && !jump && token.kind === "word" ? hole.endPx - lineStart(lineIndex) - lineWidthPx : void 0;
18959
+ if (pastHole !== void 0 && lineWidthPx + pastHole + advance <= availableWidth(lineIndex)) {
18960
+ jump = { index: placed2.length, shiftPx: pastHole };
18961
+ } else if (!wouldFit && token.kind !== "space") {
18892
18962
  tokenCursor = tokenIndex;
18893
18963
  flushLine(false, void 0);
18894
18964
  tokenCursor = tokenIndex + 1;
@@ -18908,6 +18978,7 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
18908
18978
  ...markerFactor ? { xOffsetPx: -width * markerFactor, advancePx: advance } : {}
18909
18979
  });
18910
18980
  lineWidthPx += token.kind === "tab" ? width : advance;
18981
+ if (token.kind === "space") lineSpacePx += advance;
18911
18982
  }
18912
18983
  flushLine(lines.length === 0, void 0);
18913
18984
  const lastIndex = lines.length - 1;
@@ -18918,7 +18989,8 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
18918
18989
  line3.fragments,
18919
18990
  availableWidth(index),
18920
18991
  index === lastIndex,
18921
- effectiveAlign
18992
+ // A line that runs around a picture is not aligned across it.
18993
+ boxes[index]?.hole ? "left" : effectiveAlign
18922
18994
  ).map((fragment) => ({ ...fragment, xPx: fragment.xPx + lineStart(index) }))
18923
18995
  };
18924
18996
  }
@@ -18970,29 +19042,50 @@ function widowControlEnabled(value) {
18970
19042
 
18971
19043
  // docx/layout/nested-frame-profile.ts
18972
19044
  var equal = (a, b) => a !== void 0 && b !== void 0 && a.style === b.style && a.color === b.color && Math.abs(a.widthPx - b.widthPx) < 1e-6;
18973
- function nestedFrameProfile(table, tableWidthPx = table.widthPx) {
19045
+ function mergedAway(table, rowIndex, column, side, merges) {
19046
+ if (!merges) return false;
19047
+ const row2 = table.rows[rowIndex];
19048
+ const cell = row2.cells[column];
19049
+ if (side === "top") return cell.verticalMerge === "continue";
19050
+ const below2 = table.rows[rowIndex + 1]?.cells.find(
19051
+ (other) => other.xPx === cell.xPx && other.widthPx === cell.widthPx
19052
+ );
19053
+ return below2?.verticalMerge === "continue";
19054
+ }
19055
+ function nestedFrameProfile(table, tableWidthPx = table.widthPx, merges = false) {
18974
19056
  const sides = table.rows.flatMap(
18975
- (row2) => row2.cells.flatMap(
18976
- (cell) => ["top", "right", "bottom", "left"].map((side) => cell.borders?.[side])
19057
+ (row2, rowIndex) => row2.cells.flatMap(
19058
+ (cell, column) => ["top", "right", "bottom", "left"].filter(
19059
+ (side) => side !== "top" && side !== "bottom" || !mergedAway(table, rowIndex, column, side, merges)
19060
+ ).map((side) => cell.borders?.[side])
18977
19061
  )
18978
19062
  );
18979
19063
  if (sides.every((side) => !side)) return { leftPx: 0, rightPx: 0, bottomPx: 0 };
18980
19064
  if (!sides.every((side) => side?.style === "solid" && side.widthPx > 0)) return void 0;
19065
+ const gridKnown = merges && table.rows.every(
19066
+ (row2) => row2.cells.every((cell) => cell.xPx !== void 0 && cell.widthPx !== void 0)
19067
+ );
18981
19068
  const first3 = table.rows[0], left = first3.cells[0].borders.left, right = first3.cells.at(-1).borders.right;
18982
19069
  for (const [index, row2] of table.rows.entries()) {
18983
- if (row2.cells.length !== first3.cells.length || !equal(row2.cells[0]?.borders?.left, left) || !equal(row2.cells.at(-1)?.borders?.right, right))
19070
+ if (!gridKnown && row2.cells.length !== first3.cells.length || !equal(row2.cells[0]?.borders?.left, left) || !equal(row2.cells.at(-1)?.borders?.right, right))
18984
19071
  return void 0;
18985
19072
  for (const [column, cell] of row2.cells.entries()) {
18986
19073
  const sourceWidth = cell.widthPx ?? (tableWidthPx === void 0 ? void 0 : tableWidthPx / row2.cells.length);
18987
19074
  const paintWidth = sourceWidth === void 0 ? void 0 : sourceWidth + (cell.borders.left.widthPx - cell.borders.right.widthPx) / 2 + (column === row2.cells.length - 1 ? cell.borders.right.widthPx : 0);
18988
19075
  if (paintWidth !== void 0 && paintWidth <= 0) return void 0;
18989
- if (!equal(cell.borders?.top, row2.cells[0]?.borders?.top) || !equal(cell.borders?.bottom, row2.cells[0]?.borders?.bottom))
19076
+ const topAway = mergedAway(table, index, column, "top", merges);
19077
+ const bottomAway = mergedAway(table, index, column, "bottom", merges);
19078
+ const reference = (side) => row2.cells.find((_, at) => !mergedAway(table, index, at, side, merges))?.borders?.[side];
19079
+ if (!topAway && !equal(cell.borders?.top, reference("top")) || !bottomAway && !equal(cell.borders?.bottom, reference("bottom")))
18990
19080
  return void 0;
18991
19081
  if (column && !equal(row2.cells[column - 1]?.borders?.right, cell.borders?.left))
18992
19082
  return void 0;
18993
19083
  if (index) {
18994
- const previous = table.rows[index - 1].cells[column];
18995
- if (previous.xPx !== cell.xPx || previous.widthPx !== cell.widthPx || !equal(previous.borders?.bottom, cell.borders?.top))
19084
+ const above2 = table.rows[index - 1];
19085
+ const previous = gridKnown ? above2.cells.find(
19086
+ (other) => other.xPx <= cell.xPx + 1e-6 && cell.xPx < other.xPx + other.widthPx - 1e-6
19087
+ ) : above2.cells[column];
19088
+ if (!previous || !gridKnown && (previous.xPx !== cell.xPx || previous.widthPx !== cell.widthPx) || !topAway && !mergedAway(table, index - 1, above2.cells.indexOf(previous), "bottom", merges) && !equal(previous.borders?.bottom, cell.borders?.top))
18996
19089
  return void 0;
18997
19090
  }
18998
19091
  }
@@ -19047,46 +19140,6 @@ function cellContentBottom(boxes, paddingBottom = 0) {
19047
19140
  );
19048
19141
  }
19049
19142
 
19050
- // docx/layout/table-frames.ts
19051
- function clipTableFrames(tables, start, end, inset = 0) {
19052
- return tables.flatMap((table) => {
19053
- const top = Math.max(start, table.yPx);
19054
- const bottom = Math.min(end, table.yPx + table.heightPx);
19055
- if (bottom <= top) return [];
19056
- const rows2 = table.rows.flatMap((row2) => {
19057
- const rowTop = table.yPx + row2.yPx;
19058
- const a = Math.max(top, rowTop), b = Math.min(bottom, rowTop + row2.heightPx);
19059
- if (b <= a) return [];
19060
- return [
19061
- {
19062
- ...row2,
19063
- yPx: a - top,
19064
- heightPx: b - a,
19065
- ...row2.cellTables ? {
19066
- cellTables: row2.cellTables.map(
19067
- (nested) => clipTableFrames(nested, a - rowTop, b - rowTop)
19068
- )
19069
- } : {}
19070
- }
19071
- ];
19072
- });
19073
- if (table.fragmentEdges && rows2.length) {
19074
- const edges = table.fragmentEdges;
19075
- for (const [row2, side] of [
19076
- [rows2[0], "top"],
19077
- [rows2.at(-1), "bottom"]
19078
- ]) {
19079
- if (row2.geometry)
19080
- row2.geometry = row2.geometry.map((cell, index) => ({
19081
- ...cell,
19082
- borders: { ...cell.borders, [side]: edges[side][index] }
19083
- }));
19084
- }
19085
- }
19086
- return [{ ...table, yPx: top - start + inset, heightPx: bottom - top, rows: rows2 }];
19087
- });
19088
- }
19089
-
19090
19143
  // docx/layout/table-cell-layout.ts
19091
19144
  function cellParagraphs(cell) {
19092
19145
  const walk = (blocks) => blocks.flatMap(
@@ -19194,92 +19247,47 @@ function stackCellBlocks(cell, width, measurer, note, top, starts, physicalFragm
19194
19247
  return { heightPx: y, boxes, tables };
19195
19248
  }
19196
19249
 
19197
- // docx/layout/table-layout.ts
19198
- function stackParagraphs(paragraphs, widthPx, measurer, note, topPx = 0, startTokens) {
19199
- let y = topPx;
19200
- const boxes = [];
19201
- for (const paragraph of paragraphs) {
19202
- const layout = layoutParagraph(
19203
- paragraph,
19204
- widthPx,
19205
- measurer,
19206
- note,
19207
- void 0,
19208
- startTokens?.get(paragraph.id) ?? 0
19209
- );
19210
- y += layout.spacingBeforePx;
19211
- const top = y;
19212
- const lines = layout.lines.map((line3) => ({ ...line3 }));
19213
- boxes.push({
19214
- kind: "paragraph",
19215
- blockId: paragraph.id,
19216
- yPx: top,
19217
- heightPx: layout.contentHeightPx,
19218
- lines,
19219
- ...layout.frame ? { frame: layout.frame } : {}
19220
- });
19221
- y += layout.contentHeightPx + layout.spacingAfterPx;
19222
- }
19223
- return { heightPx: y, boxes };
19224
- }
19225
- function layoutRow(row2, tableWidthPx, measurer, note, remaining, startTokens, frameBorders = false, frameLeftBorderPx, physicalFragments = reflowNestedFragments(row2)) {
19226
- const count = row2.cells.length || 1;
19227
- let x = 0;
19228
- const geometry = [];
19229
- const laidOut = row2.cells.map((cell) => {
19230
- const continuation = remaining?.[geometry.length];
19231
- const starts = continuation ? new Map(continuation.map((box) => [box.blockId, box.lines[0]?.firstToken ?? 0])) : startTokens;
19232
- const widthPx = cell.widthPx ?? tableWidthPx / count;
19233
- const margins = cell.padding ?? { top: 0, right: 0, bottom: 0, left: 0 };
19234
- const leftBorder = frameBorders ? cell.borders?.left?.widthPx ?? 0 : 0;
19235
- const rightBorder = frameBorders ? cell.borders?.right?.widthPx ?? 0 : 0;
19236
- const padding = frameBorders ? {
19237
- top: margins.top + (cell.borders?.top?.widthPx ?? 0),
19238
- bottom: margins.bottom,
19239
- left: leftBorder / 2 + Math.max(margins.left, leftBorder / 2),
19240
- right: Math.max(margins.right, rightBorder / 2) - rightBorder / 2
19241
- } : margins;
19242
- const externalRight = frameBorders && geometry.length === row2.cells.length - 1 ? rightBorder : 0;
19243
- const paintWidth = widthPx + (frameBorders ? (leftBorder - rightBorder) / 2 + externalRight : 0);
19244
- const frameX = frameBorders ? ((frameLeftBorderPx ?? leftBorder) - leftBorder) / 2 : 0;
19245
- const content2 = stackCellBlocks(
19246
- cell,
19247
- Math.max(1, paintWidth - padding.left - padding.right - externalRight),
19248
- measurer,
19249
- note,
19250
- padding.top,
19251
- starts,
19252
- physicalFragments
19253
- );
19254
- const heightPx2 = content2.heightPx + padding.bottom;
19255
- geometry.push({
19256
- xPx: (cell.xPx ?? x) + frameX,
19257
- widthPx: paintWidth,
19258
- ...frameBorders ? { borderInsetsReserved: true } : {},
19259
- paddingLeftPx: padding.left,
19260
- paddingRightPx: padding.right + externalRight,
19261
- contentHeightPx: heightPx2,
19262
- ...cell.borders ? { borders: cell.borders } : {},
19263
- ...cell.shading ? { shading: cell.shading } : {},
19264
- ...cell.verticalAlign ? { verticalAlign: cell.verticalAlign } : {}
19250
+ // docx/layout/table-frames.ts
19251
+ function clipTableFrames(tables, start, end, inset = 0) {
19252
+ return tables.flatMap((table) => {
19253
+ const top = Math.max(start, table.yPx);
19254
+ const bottom = Math.min(end, table.yPx + table.heightPx);
19255
+ if (bottom <= top) return [];
19256
+ const rows2 = table.rows.flatMap((row2) => {
19257
+ const rowTop = table.yPx + row2.yPx;
19258
+ const a = Math.max(top, rowTop), b = Math.min(bottom, rowTop + row2.heightPx);
19259
+ if (b <= a) return [];
19260
+ return [
19261
+ {
19262
+ ...row2,
19263
+ yPx: a - top,
19264
+ heightPx: b - a,
19265
+ ...row2.cellTables ? {
19266
+ cellTables: row2.cellTables.map(
19267
+ (nested) => clipTableFrames(nested, a - rowTop, b - rowTop)
19268
+ )
19269
+ } : {}
19270
+ }
19271
+ ];
19265
19272
  });
19266
- x = (cell.xPx ?? x) + widthPx;
19267
- return { heightPx: heightPx2, boxes: content2.boxes, tables: content2.tables ?? [] };
19273
+ if (table.fragmentEdges && rows2.length) {
19274
+ const edges = table.fragmentEdges;
19275
+ for (const [row2, side] of [
19276
+ [rows2[0], "top"],
19277
+ [rows2.at(-1), "bottom"]
19278
+ ]) {
19279
+ if (row2.geometry)
19280
+ row2.geometry = row2.geometry.map((cell, index) => ({
19281
+ ...cell,
19282
+ borders: { ...cell.borders, [side]: edges[side][index] }
19283
+ }));
19284
+ }
19285
+ }
19286
+ return [{ ...table, yPx: top - start + inset, heightPx: bottom - top, rows: rows2 }];
19268
19287
  });
19269
- const content = Math.max(0, ...laidOut.map((cell) => cell.heightPx));
19270
- const heightPx = row2.heightPx === void 0 ? content : row2.heightRule === "exact" ? row2.heightPx : Math.max(content, row2.heightPx);
19271
- if (frameBorders) for (const cell of geometry) cell.alignmentHeightPx = heightPx;
19272
- return {
19273
- heightPx,
19274
- cells: laidOut.map((cell) => cell.boxes),
19275
- geometry,
19276
- ...laidOut.some((cell) => cell.tables.length) ? { cellTables: laidOut.map((cell) => cell.tables) } : {},
19277
- cellPadding: row2.cells.map((cell) => ({
19278
- top: cell.padding?.top ?? 0,
19279
- bottom: cell.padding?.bottom ?? 0
19280
- }))
19281
- };
19282
19288
  }
19289
+
19290
+ // docx/layout/table-row-split.ts
19283
19291
  function splitCellAtHeight(boxes, cutHeightPx, paragraphCuts) {
19284
19292
  const before = [];
19285
19293
  const after = [];
@@ -19353,7 +19361,7 @@ function splitRowAtHeight(row2, cutHeightPx, cellCuts, paragraphCuts) {
19353
19361
  )
19354
19362
  )
19355
19363
  } : {},
19356
- geometry: row2.geometry.map((geometry, index) => ({
19364
+ geometry: row2.geometry.map(({ mergeRows: _merge, ...geometry }, index) => ({
19357
19365
  ...geometry,
19358
19366
  contentHeightPx: splits[index].beforeHeightPx,
19359
19367
  ...row2.borderBottomPx !== void 0 ? { alignmentHeightPx: beforeHeightPx } : {}
@@ -19362,10 +19370,11 @@ function splitRowAtHeight(row2, cutHeightPx, cellCuts, paragraphCuts) {
19362
19370
  ...row2.borderBottomPx !== void 0 ? { borderBottomPx: row2.borderBottomPx } : {}
19363
19371
  };
19364
19372
  if (!anyAfter) return { before, after: null };
19373
+ const tail = (split, index) => split.after.length ? row2.trailingPx?.[index] ?? 0 : 0;
19365
19374
  const afterHeightPx = Math.max(
19366
19375
  0,
19367
19376
  ...splits.map(
19368
- (split, index) => cellContentBottom(split.after, row2.cellPadding?.[index]?.bottom ?? 0)
19377
+ (split, index) => cellContentBottom(split.after, row2.cellPadding?.[index]?.bottom ?? 0) + tail(split, index)
19369
19378
  )
19370
19379
  );
19371
19380
  const after = {
@@ -19381,20 +19390,114 @@ function splitRowAtHeight(row2, cutHeightPx, cellCuts, paragraphCuts) {
19381
19390
  ) : []
19382
19391
  )
19383
19392
  } : {},
19384
- geometry: row2.geometry.map((geometry, index) => ({
19393
+ geometry: row2.geometry.map(({ mergeRows: _merge, ...geometry }, index) => ({
19385
19394
  ...geometry,
19386
- contentHeightPx: cellContentBottom(
19387
- splits[index].after,
19388
- row2.cellPadding?.[index]?.bottom ?? 0
19389
- ),
19395
+ contentHeightPx: cellContentBottom(splits[index].after, row2.cellPadding?.[index]?.bottom ?? 0) + tail(splits[index], index),
19390
19396
  ...row2.borderBottomPx !== void 0 ? { alignmentHeightPx: afterHeightPx } : {}
19391
19397
  })),
19392
19398
  ...row2.cellPadding ? { cellPadding: row2.cellPadding } : {},
19399
+ ...row2.trailingPx ? { trailingPx: row2.trailingPx } : {},
19393
19400
  ...row2.borderBottomPx !== void 0 ? { borderBottomPx: row2.borderBottomPx } : {}
19394
19401
  };
19395
19402
  return { before, after };
19396
19403
  }
19397
19404
 
19405
+ // docx/layout/table-layout.ts
19406
+ function stackParagraphs(paragraphs, widthPx, measurer, note, topPx = 0, startTokens) {
19407
+ let y = topPx;
19408
+ const boxes = [];
19409
+ for (const paragraph of paragraphs) {
19410
+ const layout = layoutParagraph(
19411
+ paragraph,
19412
+ widthPx,
19413
+ measurer,
19414
+ note,
19415
+ void 0,
19416
+ startTokens?.get(paragraph.id) ?? 0
19417
+ );
19418
+ y += layout.spacingBeforePx;
19419
+ const top = y;
19420
+ const lines = layout.lines.map((line3) => ({ ...line3 }));
19421
+ boxes.push({
19422
+ kind: "paragraph",
19423
+ blockId: paragraph.id,
19424
+ yPx: top,
19425
+ heightPx: layout.contentHeightPx,
19426
+ lines,
19427
+ ...layout.frame ? { frame: layout.frame } : {}
19428
+ });
19429
+ y += layout.contentHeightPx + layout.spacingAfterPx;
19430
+ }
19431
+ return { heightPx: y, boxes };
19432
+ }
19433
+ function layoutRow(row2, tableWidthPx, measurer, note, remaining, startTokens, frameBorders = false, frameLeftBorderPx, physicalFragments = reflowNestedFragments(row2)) {
19434
+ const count = row2.cells.length || 1;
19435
+ let x = 0;
19436
+ const geometry = [];
19437
+ const laidOut = row2.cells.map((cell) => {
19438
+ const continuation = remaining?.[geometry.length];
19439
+ const starts = continuation ? new Map(continuation.map((box) => [box.blockId, box.lines[0]?.firstToken ?? 0])) : startTokens;
19440
+ const widthPx = cell.widthPx ?? tableWidthPx / count;
19441
+ const margins = cell.padding ?? { top: 0, right: 0, bottom: 0, left: 0 };
19442
+ const leftBorder = frameBorders ? cell.borders?.left?.widthPx ?? 0 : 0;
19443
+ const rightBorder = frameBorders ? cell.borders?.right?.widthPx ?? 0 : 0;
19444
+ const padding = frameBorders ? {
19445
+ top: margins.top + (cell.borders?.top?.widthPx ?? 0),
19446
+ bottom: margins.bottom,
19447
+ left: leftBorder / 2 + Math.max(margins.left, leftBorder / 2),
19448
+ right: Math.max(margins.right, rightBorder / 2) - rightBorder / 2
19449
+ } : margins;
19450
+ const externalRight = frameBorders && geometry.length === row2.cells.length - 1 ? rightBorder : 0;
19451
+ const paintWidth = widthPx + (frameBorders ? (leftBorder - rightBorder) / 2 + externalRight : 0);
19452
+ const frameX = frameBorders ? ((frameLeftBorderPx ?? leftBorder) - leftBorder) / 2 : 0;
19453
+ const content2 = stackCellBlocks(
19454
+ cell,
19455
+ Math.max(1, paintWidth - padding.left - padding.right - externalRight),
19456
+ measurer,
19457
+ note,
19458
+ padding.top,
19459
+ starts,
19460
+ physicalFragments
19461
+ );
19462
+ const heightPx2 = content2.heightPx + padding.bottom;
19463
+ geometry.push({
19464
+ xPx: (cell.xPx ?? x) + frameX,
19465
+ widthPx: paintWidth,
19466
+ ...frameBorders ? { borderInsetsReserved: true } : {},
19467
+ paddingLeftPx: padding.left,
19468
+ paddingRightPx: padding.right + externalRight,
19469
+ contentHeightPx: heightPx2,
19470
+ ...cell.borders ? { borders: cell.borders } : {},
19471
+ ...cell.shading ? { shading: cell.shading } : {},
19472
+ ...cell.verticalAlign ? { verticalAlign: cell.verticalAlign } : {},
19473
+ ...cell.rowSpan ? { mergeRows: cell.rowSpan } : {}
19474
+ });
19475
+ x = (cell.xPx ?? x) + widthPx;
19476
+ const trailingPx = content2.tables?.length ? 0 : Math.max(0, content2.heightPx - cellContentBottom(content2.boxes));
19477
+ return { heightPx: heightPx2, boxes: content2.boxes, tables: content2.tables ?? [], trailingPx };
19478
+ });
19479
+ const content = Math.max(
19480
+ 0,
19481
+ ...laidOut.map(
19482
+ (cell, index) => (row2.cells[index]?.rowSpan ?? 1) > 1 && !row2.mergedTextInRow ? 0 : cell.heightPx
19483
+ )
19484
+ );
19485
+ const heightPx = row2.heightPx === void 0 ? content : row2.heightRule === "exact" ? row2.heightPx : Math.max(content, row2.heightPx);
19486
+ if (frameBorders) for (const cell of geometry) cell.alignmentHeightPx = heightPx;
19487
+ const trailing = laidOut.map((cell) => cell.trailingPx);
19488
+ return {
19489
+ heightPx,
19490
+ cells: laidOut.map((cell) => cell.boxes),
19491
+ geometry,
19492
+ ...trailing.some((px) => px > 0) ? { trailingPx: trailing } : {},
19493
+ ...laidOut.some((cell) => cell.tables.length) ? { cellTables: laidOut.map((cell) => cell.tables) } : {},
19494
+ cellPadding: row2.cells.map((cell) => ({
19495
+ top: cell.padding?.top ?? 0,
19496
+ bottom: cell.padding?.bottom ?? 0
19497
+ }))
19498
+ };
19499
+ }
19500
+
19398
19501
  // docx/layout/footnote-split.ts
19399
19502
  function splitNote(note, budget) {
19400
19503
  if (note.heightPx <= budget + 1e-6) return { before: note };
@@ -19848,6 +19951,14 @@ var PageCursor = class {
19848
19951
  get usedColumnHeightPx() {
19849
19952
  return this.yPx - this.columnTopPx;
19850
19953
  }
19954
+ /**
19955
+ * At the top of a later page or a later column of the section (not the section's first page, nor
19956
+ * a continuous band). Word drops the space before of the paragraph placed here, whether a page
19957
+ * break, a natural overflow, `pageBreakBefore` or a column overflow brought it (spacing-probe.json).
19958
+ */
19959
+ get atContinuationTop() {
19960
+ return this.atColumnTop && this.columnTopPx === 0 && (this.page.pageInSection > 0 || this.columnIndex > 0);
19961
+ }
19851
19962
  get atColumnTop() {
19852
19963
  return this.yPx === this.columnTopPx;
19853
19964
  }
@@ -19938,13 +20049,16 @@ var PageCursor = class {
19938
20049
  this.pushPage();
19939
20050
  }
19940
20051
  }
19941
- /** Places a box at the current fill position (sets its `yPx`) and advances by `advancePx`. */
19942
- place(box, advancePx) {
20052
+ /**
20053
+ * Places a box at the current fill position (sets its `yPx`) and advances by `advancePx`. The box
20054
+ * sits `offsetPx` below the fill position when the advance starts with space above it.
20055
+ */
20056
+ place(box, advancePx, offsetPx = 0) {
19943
20057
  if (this.page.sectionIndex !== this.sectionIndex && !this.page.sectionIndices?.includes(this.sectionIndex)) {
19944
20058
  (this.page.sectionIndices ??= [this.page.sectionIndex]).push(this.sectionIndex);
19945
20059
  this.pageInSection = 1;
19946
20060
  }
19947
- box.yPx = this.yPx;
20061
+ box.yPx = this.yPx + offsetPx;
19948
20062
  this.column.blocks.push(box);
19949
20063
  this.yPx += advancePx;
19950
20064
  const bodyBottom = this.legacyFootnoteColumns ? this.yPx : Math.max(
@@ -19964,7 +20078,10 @@ var PageCursor = class {
19964
20078
 
19965
20079
  // docx/layout/flow-paragraph.ts
19966
20080
  function placeParagraph(cursor, placement, note) {
19967
- const { paragraph, spacingBeforePx, requiredTogetherPx, reflow } = placement;
20081
+ const { paragraph, requiredTogetherPx, reflow } = placement;
20082
+ const spacingAfterPx = placement.spacingAfterPx ?? placement.layout.spacingAfterPx;
20083
+ const dropsSpaceBefore = () => cursor.atContinuationTop && !(paragraph.pageBreakBefore && placement.keepSpaceBeforePageBreak);
20084
+ let spacingBeforePx = dropsSpaceBefore() ? 0 : placement.spacingBeforePx;
19968
20085
  const trailingBreakLine = (result) => {
19969
20086
  const last = result.lines.at(-1);
19970
20087
  if (!placement.trimLeadingColumnBreak || !last || !result.columnBreakAfterLine.has(result.lines.length - 1))
@@ -19998,6 +20115,7 @@ function placeParagraph(cursor, placement, note) {
19998
20115
  if (requiredTogetherPx > 0 && requiredTogetherPx <= cursor.columnHeightPx && requiredTogetherPx > cursor.remainingHeightPx() && !cursor.atColumnTop) {
19999
20116
  cursor.newColumn();
20000
20117
  }
20118
+ if (dropsSpaceBefore()) spacingBeforePx = 0;
20001
20119
  const widow = widowControlEnabled(paragraph.widowControl);
20002
20120
  let lineCursor = 0;
20003
20121
  let nextToken = 0;
@@ -20026,7 +20144,8 @@ function placeParagraph(cursor, placement, note) {
20026
20144
  if (!layout.lines.length) {
20027
20145
  cursor.place(
20028
20146
  { kind: "paragraph", blockId: paragraph.id, yPx: 0, heightPx: 0, lines: [] },
20029
- spacingBeforePx + layout.spacingAfterPx
20147
+ spacingBeforePx + spacingAfterPx,
20148
+ spacingBeforePx
20030
20149
  );
20031
20150
  return;
20032
20151
  }
@@ -20070,6 +20189,7 @@ function placeParagraph(cursor, placement, note) {
20070
20189
  if (placedCount === 0) {
20071
20190
  if (!cursor.atColumnTop) {
20072
20191
  cursor.newColumn();
20192
+ if (firstSegment && dropsSpaceBefore()) spacingBeforePx = 0;
20073
20193
  continue;
20074
20194
  }
20075
20195
  note(
@@ -20100,8 +20220,8 @@ function placeParagraph(cursor, placement, note) {
20100
20220
  lines: segmentLines,
20101
20221
  ...layout.frame ? { frame: layout.frame } : {}
20102
20222
  };
20103
- const advance = (firstSegment ? spacingBeforePx : 0) + segmentHeight + (isFinal ? layout.spacingAfterPx : 0);
20104
- cursor.place(box, advance);
20223
+ const advance = (firstSegment ? spacingBeforePx : 0) + segmentHeight + (isFinal ? spacingAfterPx : 0);
20224
+ cursor.place(box, advance, firstSegment ? spacingBeforePx : 0);
20105
20225
  for (const item of committedNotes) placedNotes.add(item.id);
20106
20226
  nextToken = layout.lines[lineCursor + placedCount - 1]?.nextToken ?? nextToken;
20107
20227
  lineCursor += placedCount;
@@ -20507,6 +20627,61 @@ var TableFootnotes = class {
20507
20627
  }
20508
20628
  };
20509
20629
 
20630
+ // docx/layout/table-merged-rows.ts
20631
+ var MergedRowPlan = class {
20632
+ constructor(rows2) {
20633
+ this.rows = rows2;
20634
+ }
20635
+ rows;
20636
+ legacy = /* @__PURE__ */ new Set();
20637
+ minimum = /* @__PURE__ */ new Map();
20638
+ cache = /* @__PURE__ */ new Map();
20639
+ apply(source) {
20640
+ const minimum = this.minimum.get(source);
20641
+ if (minimum === void 0 && !this.legacy.has(source)) return source;
20642
+ return {
20643
+ ...source,
20644
+ ...minimum === void 0 ? {} : { heightPx: minimum, heightRule: "atLeast" },
20645
+ ...this.legacy.has(source) ? { mergedTextInRow: true } : {}
20646
+ };
20647
+ }
20648
+ /** The row to lay out and place (the source row itself when the plan leaves it alone). */
20649
+ effective(source) {
20650
+ let row2 = this.cache.get(source);
20651
+ if (!row2) {
20652
+ row2 = this.apply(source);
20653
+ this.cache.set(source, row2);
20654
+ }
20655
+ return row2;
20656
+ }
20657
+ /** Plans the rows a merge starting at `index` covers, given the room left for them. */
20658
+ plan(index, layout, availablePx) {
20659
+ const start = this.rows[index];
20660
+ const spans = start?.cells.map((cell) => cell.rowSpan ?? 1) ?? [];
20661
+ const longest = Math.max(1, ...spans);
20662
+ if (!start || longest < 2) return;
20663
+ const covered = this.rows.slice(index, index + longest);
20664
+ const natural = covered.map((row2) => layout(this.apply(row2)));
20665
+ const heights = natural.map((item) => item.heightPx);
20666
+ spans.forEach((span, cell) => {
20667
+ if (span < 2) return;
20668
+ const count = Math.min(span, covered.length);
20669
+ const need = (natural[0]?.geometry[cell]?.contentHeightPx ?? 0) + (natural[count - 1]?.borderBottomPx ?? 0);
20670
+ const have = heights.slice(0, count).reduce((sum, h) => sum + h, 0);
20671
+ if (need > have) heights[count - 1] = (heights[count - 1] ?? 0) + need - have;
20672
+ });
20673
+ if (heights.reduce((sum, h) => sum + h, 0) > availablePx) {
20674
+ this.legacy.add(start);
20675
+ return;
20676
+ }
20677
+ covered.forEach((row2, at) => {
20678
+ const grown = heights[at] - natural[at].heightPx;
20679
+ if (grown > 1e-6 && row2.heightRule !== "exact")
20680
+ this.minimum.set(row2, heights[at] - (natural[at].borderBottomPx ?? 0));
20681
+ });
20682
+ }
20683
+ };
20684
+
20510
20685
  // docx/layout/flow-table.ts
20511
20686
  function placeTable(cursor, table, measurer, note, resolveFootnotes) {
20512
20687
  const firstBodyRow = table.rows.findIndex((row2) => !row2.isHeader);
@@ -20521,7 +20696,7 @@ function placeTable(cursor, table, measurer, note, resolveFootnotes) {
20521
20696
  const width = (table.widthPx ?? cursor.columnWidthPx) + (activeBorders ? (profile.leftPx + profile.rightPx) / 2 : 0);
20522
20697
  return table.alignment === "center" ? Math.max(0, (cursor.columnWidthPx - width) / 2) : table.alignment === "right" ? Math.max(0, cursor.columnWidthPx - width) : table.indentPx ?? 0;
20523
20698
  };
20524
- const profile = nestedFrameProfile(table, table.widthPx ?? cursor.columnWidthPx);
20699
+ const profile = nestedFrameProfile(table, table.widthPx ?? cursor.columnWidthPx, true);
20525
20700
  const activeBorders = profile !== void 0 && (profile.leftPx > 0 || profile.rightPx > 0 || profile.bottomPx > 0);
20526
20701
  if (!profile && table.rows.some((row2) => row2.cells.some((cell) => cell.borders)))
20527
20702
  note(
@@ -20557,6 +20732,7 @@ function placeTable(cursor, table, measurer, note, resolveFootnotes) {
20557
20732
  };
20558
20733
  function flushFragment() {
20559
20734
  fragmentHeight += fragmentBorders.restore(fragmentRows.at(-1));
20735
+ alignMergedCells(fragmentRows);
20560
20736
  if (!fragmentRows.length) {
20561
20737
  footnotes?.holdFragment();
20562
20738
  return;
@@ -20733,7 +20909,16 @@ function placeTable(cursor, table, measurer, note, resolveFootnotes) {
20733
20909
  ) : after;
20734
20910
  }
20735
20911
  }
20736
- for (const row2 of table.rows) {
20912
+ const merged = new MergedRowPlan(table.rows);
20913
+ for (const [index, source] of table.rows.entries()) {
20914
+ merged.plan(
20915
+ index,
20916
+ (candidate) => layoutRow2(candidate, cursor.columnWidthPx, measurer, () => {
20917
+ }, void 0, source),
20918
+ cursor.remainingHeightPx() - fragmentHeight
20919
+ );
20920
+ const row2 = merged.effective(source);
20921
+ if (row2 !== source) nativeFragments.set(row2, nativeFragments.get(source) ?? false);
20737
20922
  const layout = layoutRow2(row2, cursor.columnWidthPx, measurer, note);
20738
20923
  if (layout.heightPx > cursor.remainingHeightPx() && !nativeFragments.get(row2) && row2.cells.some(
20739
20924
  (cell) => cell.blocks?.some((block) => block.kind === "table" && block.rows.length > 1)
@@ -20750,11 +20935,23 @@ function placeTable(cursor, table, measurer, note, resolveFootnotes) {
20750
20935
  placeRow(
20751
20936
  row2,
20752
20937
  layout,
20753
- Boolean(row2.cantSplit) || headerRows.includes(row2) || !!footnotes && row2.heightRule === "exact"
20938
+ Boolean(row2.cantSplit) || headerRows.includes(source) || !!footnotes && row2.heightRule === "exact"
20754
20939
  );
20755
20940
  }
20756
20941
  flushFragment();
20757
20942
  }
20943
+ function alignMergedCells(rows2) {
20944
+ rows2.forEach((row2, index) => {
20945
+ for (const geometry of row2.geometry ?? []) {
20946
+ const count = geometry.mergeRows ?? 1;
20947
+ if (count < 2 || !geometry.verticalAlign || geometry.verticalAlign === "top") continue;
20948
+ const last = rows2[index + count - 1];
20949
+ if (!last || rows2.slice(index, index + count).some((item) => item.repeated !== row2.repeated))
20950
+ continue;
20951
+ geometry.alignmentHeightPx = last.yPx + last.heightPx - row2.yPx;
20952
+ }
20953
+ });
20954
+ }
20758
20955
 
20759
20956
  // docx/layout/reference-footnotes.ts
20760
20957
  function createReferenceFootnotes(width, measurer, report) {
@@ -20789,7 +20986,8 @@ function wrapExclusions(pages) {
20789
20986
  yPx: float.yPx,
20790
20987
  widthPx: float.widthPx + SIDE_DISTANCE_PX * 2,
20791
20988
  heightPx: float.heightPx,
20792
- topAndBottom: float.wrap === "topAndBottom"
20989
+ topAndBottom: float.wrap === "topAndBottom",
20990
+ ...float.wrapText === "bothSides" ? { bothSides: true } : {}
20793
20991
  }));
20794
20992
  if (list.length) exclusions.set(page.index, list);
20795
20993
  }
@@ -20810,6 +21008,7 @@ function lineBoxesFor(exclusions, topPx, columnLeftPx, columnWidthPx) {
20810
21008
  let leftInsetPx = 0;
20811
21009
  let rightInsetPx = 0;
20812
21010
  let gapBeforePx = 0;
21011
+ const shared = [];
20813
21012
  for (const exclusion of exclusions) {
20814
21013
  const overlapsLine = exclusion.yPx < top + heightPx && exclusion.yPx + exclusion.heightPx > top;
20815
21014
  const start = exclusion.xPx - columnLeftPx;
@@ -20821,10 +21020,26 @@ function lineBoxesFor(exclusions, topPx, columnLeftPx, columnWidthPx) {
20821
21020
  gapBeforePx = Math.max(gapBeforePx, exclusion.yPx + exclusion.heightPx - top);
20822
21021
  continue;
20823
21022
  }
21023
+ if (exclusion.bothSides && Math.min(left, right) >= MIN_SIDE_WIDTH_PX) {
21024
+ shared.push({ start, end });
21025
+ continue;
21026
+ }
20824
21027
  if (left >= right) rightInsetPx = Math.max(rightInsetPx, columnWidthPx - start);
20825
21028
  else leftInsetPx = Math.max(leftInsetPx, end);
20826
21029
  }
20827
- return { leftInsetPx, rightInsetPx, gapBeforePx };
21030
+ const single = shared.length === 1 && !leftInsetPx && !rightInsetPx ? shared[0] : void 0;
21031
+ if (!single)
21032
+ for (const { start, end } of shared) {
21033
+ if (start >= columnWidthPx - end)
21034
+ rightInsetPx = Math.max(rightInsetPx, columnWidthPx - start);
21035
+ else leftInsetPx = Math.max(leftInsetPx, end);
21036
+ }
21037
+ return {
21038
+ leftInsetPx,
21039
+ rightInsetPx,
21040
+ gapBeforePx,
21041
+ ...single ? { hole: { startPx: single.start, endPx: single.end } } : {}
21042
+ };
20828
21043
  };
20829
21044
  }
20830
21045
 
@@ -20986,8 +21201,18 @@ var SectionFlow = class {
20986
21201
  if (block?.kind !== "paragraph") return 0;
20987
21202
  const layout = this.paragraphLayout(index);
20988
21203
  const previous = index > 0 ? this.blocks[index - 1] : void 0;
20989
- if (previous?.kind === "paragraph" && suppressesSpacing(previous, block)) return 0;
20990
- return layout.spacingBeforePx;
21204
+ if (index === 0 && !this.section.addParagraphSpacing)
21205
+ return Math.max(0, layout.spacingBeforePx - (this.section.leadingSpacingAfterPx ?? 0));
21206
+ if (previous?.kind !== "paragraph") return layout.spacingBeforePx;
21207
+ if (suppressesSpacing(previous, block)) return 0;
21208
+ if (this.section.addParagraphSpacing) return layout.spacingBeforePx;
21209
+ return Math.max(0, layout.spacingBeforePx - this.paragraphLayout(index - 1).spacingAfterPx);
21210
+ }
21211
+ /** Contextual spacing: no space after a paragraph that is followed by one of its own style. */
21212
+ spacingAfterSuppressed(index) {
21213
+ const block = this.blocks[index];
21214
+ const next = this.blocks[index + 1];
21215
+ return block?.kind === "paragraph" && next?.kind === "paragraph" && suppressesSpacing(block, next);
20991
21216
  }
20992
21217
  /** Minimum height that must fit before `index` may start, walking a `keepNext` chain. */
20993
21218
  requiredKeepHeight(index, depth = 0) {
@@ -21059,6 +21284,8 @@ var SectionFlow = class {
21059
21284
  layout,
21060
21285
  footnotes,
21061
21286
  spacingBeforePx,
21287
+ ...this.section.keepSpaceBeforePageBreak ? { keepSpaceBeforePageBreak: true } : {},
21288
+ ...this.spacingAfterSuppressed(index) ? { spacingAfterPx: 0 } : {},
21062
21289
  ...this.section.modernFootnoteSeparator || this.section.legacyFootnoteColumns ? { trimLeadingColumnBreak: true } : {},
21063
21290
  requiredTogetherPx,
21064
21291
  reflow: (token) => layoutParagraph(
@@ -21588,7 +21815,8 @@ function paragraphFloats(paragraph, theme) {
21588
21815
  ...placement?.alignV ? { alignV: placement.alignV } : {},
21589
21816
  ...placement?.offsetYPx !== void 0 ? { offsetYPx: placement.offsetYPx } : {},
21590
21817
  ...placement?.behindText ? { behindText: true } : {},
21591
- ...placement?.wrap ? { wrap: placement.wrap } : {}
21818
+ ...placement?.wrap ? { wrap: placement.wrap } : {},
21819
+ ...placement?.wrapText ? { wrapText: placement.wrapText } : {}
21592
21820
  });
21593
21821
  }
21594
21822
  return floats;
@@ -22416,17 +22644,17 @@ function glyph(text2, size, stretch = 1) {
22416
22644
  return box;
22417
22645
  }
22418
22646
  function scripts(base, sub, sup, style) {
22419
- const raise = Math.max(style.size * 0.4, base.ascent - style.size * 0.3);
22420
- const drop = Math.max(style.size * 0.2, base.descent + style.size * 0.12);
22647
+ const raise = Math.max(style.size * 0.36, base.ascent - style.size * 0.42);
22648
+ const drop = Math.max(style.size * 0.15, base.descent - style.size * 0.07);
22421
22649
  const parts = [{ box: base, x: 0, y: 0 }];
22422
22650
  let width = base.width;
22423
22651
  if (sup) {
22424
- const y = -Math.max(raise, sup.descent + style.size * 0.25);
22652
+ const y = -Math.max(raise, sup.descent + style.size * 0.2);
22425
22653
  parts.push({ box: sup, x: base.width + 1, y });
22426
22654
  width = Math.max(width, base.width + 1 + sup.width);
22427
22655
  }
22428
22656
  if (sub) {
22429
- const y = Math.max(drop, sub.ascent - style.size * 0.1);
22657
+ const y = Math.max(drop, sub.ascent - style.size * 0.4);
22430
22658
  parts.push({ box: sub, x: base.width + 1, y });
22431
22659
  width = Math.max(width, base.width + 1 + sub.width);
22432
22660
  }
@@ -22442,8 +22670,8 @@ function nary(node, style, ctx) {
22442
22670
  const chr = val(child(pr, "m:chr")) || "\u222B";
22443
22671
  const big = NARY.has(chr) ? 1.4 : 1.6;
22444
22672
  const op = glyph(chr, style.size * big);
22445
- op.ascent = style.size * 0.78 * (big > 1.5 ? 1.5 : 1.25);
22446
- op.descent = style.size * (big > 1.5 ? 0.55 : 0.4);
22673
+ op.ascent = style.size * (big > 1.5 ? 1.17 : 1.15);
22674
+ op.descent = style.size * (big > 1.5 ? 0.55 : 0.6);
22447
22675
  const limits = (val(child(pr, "m:limLoc")) || (NARY.has(chr) ? "undOvr" : "subSup")) === "undOvr";
22448
22676
  const sub = isOn2(val(child(pr, "m:subHide"))) ? void 0 : ctx.layout(child(node, "m:sub"), ctx.script(style));
22449
22677
  const sup = isOn2(val(child(pr, "m:supHide"))) ? void 0 : ctx.layout(child(node, "m:sup"), ctx.script(style));
@@ -22457,13 +22685,13 @@ function nary(node, style, ctx) {
22457
22685
  parts.push({
22458
22686
  box: sup,
22459
22687
  x: (width - sup.width) / 2,
22460
- y: -(op.ascent + sup.descent + style.size * 0.05)
22688
+ y: -(op.ascent + sup.descent + style.size * 0.075)
22461
22689
  });
22462
22690
  if (hasSub)
22463
22691
  parts.push({
22464
22692
  box: sub,
22465
22693
  x: (width - sub.width) / 2,
22466
- y: op.descent + sub.ascent + style.size * 0.05
22694
+ y: op.descent + sub.ascent + style.size * 0.075
22467
22695
  });
22468
22696
  head = overlay(parts);
22469
22697
  head.width = width;
@@ -22509,7 +22737,7 @@ function matrix(node, style, ctx) {
22509
22737
  (_, c) => Math.max(0, ...rows2.map((cells) => cells[c]?.width ?? 0))
22510
22738
  );
22511
22739
  const gapX = style.size * 0.8;
22512
- const gapY = style.size * 0.3;
22740
+ const gapY = 0;
22513
22741
  const result = emptyBox();
22514
22742
  let y = 0;
22515
22743
  const heights = rows2.map((cells) => ({
@@ -22559,15 +22787,15 @@ function below(base, mark, style) {
22559
22787
  // math/omml-box-structures.ts
22560
22788
  function fraction(node, style, ctx) {
22561
22789
  const type = val(child(child(node, "m:fPr"), "m:type"));
22562
- const inner = ctx.script({ ...style, level: Math.min(style.level, 0) });
22563
- const small = style.level === 0 ? { ...style, size: style.size * 0.9 } : inner;
22790
+ const inner = ctx.script({ ...style, level: Math.min(style.level, 0), display: false });
22791
+ const small = style.level === 0 && style.display ? { ...style, display: false } : inner;
22564
22792
  const num = ctx.layout(child(node, "m:num"), small);
22565
22793
  const den = ctx.layout(child(node, "m:den"), small);
22566
22794
  if (type === "lin") {
22567
22795
  const slash = glyph("/", style.size);
22568
22796
  return row([num, slash, den]);
22569
22797
  }
22570
- const gap = style.size * 0.12;
22798
+ const gap = style.size * 0.15;
22571
22799
  const axis = style.size * AXIS;
22572
22800
  const width = Math.max(num.width, den.width) + style.size * 0.2;
22573
22801
  const bar = type === "noBar" ? [] : [
@@ -22592,9 +22820,9 @@ function radical(node, style, ctx) {
22592
22820
  const content = ctx.layout(child(node, "m:e"), style);
22593
22821
  const hide = isOn2(val(child(child(node, "m:radPr"), "m:degHide")));
22594
22822
  const degree = hide ? void 0 : ctx.layout(child(node, "m:deg"), { ...ctx.script(ctx.script(style)) });
22595
- const gap = style.size * 0.12;
22823
+ const gap = style.size * 0.2;
22596
22824
  const top = -(content.ascent + gap);
22597
- const bottom = content.descent + style.size * 0.05;
22825
+ const bottom = content.descent + style.size * 0.15;
22598
22826
  const height = bottom - top;
22599
22827
  const sign = style.size * 0.55;
22600
22828
  const lead = degree && degree.width ? Math.max(0, degree.width - sign * 0.4) : 0;
@@ -22795,11 +23023,11 @@ function layoutElement(tag, node, style, atStart) {
22795
23023
  if (/Pr$/.test(tag) || tag === "m:ctrlPr") return emptyBox();
22796
23024
  return layoutStructure(tag, node, style, { layout: layoutChildren, script: scriptStyle });
22797
23025
  }
22798
- function layoutEquation(root, sizePx) {
22799
- const box = layoutChildren(root, { level: 0, size: sizePx });
23026
+ function layoutEquation(root, sizePx, options2 = {}) {
23027
+ const box = layoutChildren(root, { level: 0, size: sizePx, display: Boolean(options2.display) });
22800
23028
  const pad2 = 1;
22801
- const ascent = Math.max(box.ascent, sizePx * 0.78) + pad2;
22802
- const descent = Math.max(box.descent, sizePx * 0.22) + pad2;
23029
+ const ascent = Math.max(box.ascent, sizePx * 0.9);
23030
+ const descent = Math.max(box.descent, sizePx * 0.24);
22803
23031
  return {
22804
23032
  box: { ...box, prims: shifted(box.prims, pad2, 0), ascent, descent },
22805
23033
  widthPx: round2(Math.max(box.width, sizePx * 0.5) + pad2 * 2),
@@ -22858,17 +23086,17 @@ function primMarkup(prim) {
22858
23086
  return `<path d="${prim.d}" fill="none" stroke="currentColor" stroke-width="${round2(prim.width)}" stroke-linejoin="round"/>`;
22859
23087
  }
22860
23088
  }
22861
- function drawOmmlTree(root, sizePx, label = "") {
22862
- const { box, widthPx, heightPx, descentPx } = layoutEquation(root, sizePx);
23089
+ function drawOmmlTree(root, sizePx, label = "", options2 = {}) {
23090
+ const { box, widthPx, heightPx, descentPx } = layoutEquation(root, sizePx, options2);
22863
23091
  if (!box.prims.length) return void 0;
22864
23092
  const body = box.prims.map(primMarkup).join("");
22865
23093
  const aria = label ? ` aria-label="${escapeXml2(label).replace(/"/g, "&quot;")}"` : "";
22866
23094
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${widthPx}" height="${heightPx}" viewBox="0 0 ${widthPx} ${heightPx}" role="img"${aria}><g font-family="${FONT_FAMILY}" fill="currentColor" transform="translate(0 ${round2(box.ascent)})">${body}</g></svg>`;
22867
23095
  return { svg, widthPx, heightPx, descentPx };
22868
23096
  }
22869
- function drawEquation(omml, sizePx, label = "") {
23097
+ function drawEquation(omml, sizePx, label = "", options2 = {}) {
22870
23098
  try {
22871
- return drawOmmlTree(parseOmml(omml), sizePx, label);
23099
+ return drawOmmlTree(parseOmml(omml), sizePx, label, options2);
22872
23100
  } catch {
22873
23101
  return void 0;
22874
23102
  }
@@ -22884,11 +23112,11 @@ function latexLabel(omml) {
22884
23112
  return "Equation";
22885
23113
  }
22886
23114
  }
22887
- function equationObject(omml, sizePx) {
22888
- const key = `${sizePx}|${omml}`;
23115
+ function equationObject(omml, sizePx, display = false) {
23116
+ const key = `${sizePx}|${display}|${omml}`;
22889
23117
  const hit = cache.get(key);
22890
23118
  if (hit !== void 0) return hit ?? void 0;
22891
- const drawing = drawEquation(omml, sizePx, latexLabel(omml));
23119
+ const drawing = drawEquation(omml, sizePx, latexLabel(omml), { display });
22892
23120
  const object = drawing ? {
22893
23121
  partName: "",
22894
23122
  contentType: "",
@@ -22946,6 +23174,7 @@ function adaptTable(table, model, adaptParagraph, _nested = false) {
22946
23174
  return start;
22947
23175
  });
22948
23176
  });
23177
+ const merges = tableGrid(table);
22949
23178
  const cellAt = (rowIndex, gridIndex) => {
22950
23179
  const position = gridIndexes[rowIndex]?.indexOf(gridIndex) ?? -1;
22951
23180
  return position >= 0 ? table.rows[rowIndex]?.[position] : void 0;
@@ -22991,10 +23220,13 @@ function adaptTable(table, model, adaptParagraph, _nested = false) {
22991
23220
  const width = gridWidth(start, span) ?? (cell.widthTwips ? twipsToPx2(cell.widthTwips) : void 0);
22992
23221
  const xPx = grid ? gridWidth(0, start) : void 0;
22993
23222
  const fill = cssHex(visuals.shadingFill);
23223
+ const entry = merges?.rows[rowIndex]?.[cellIndex];
23224
+ const rowSpan = merges && entry ? rowSpanOf(merges, entry) : 1;
22994
23225
  return {
22995
23226
  paragraphs: cell.paragraphs.map(adaptParagraph),
22996
23227
  ...cell.gridSpan !== void 0 ? { gridSpan: cell.gridSpan } : {},
22997
23228
  ...cell.verticalMerge ? { verticalMerge: cell.verticalMerge } : {},
23229
+ ...rowSpan > 1 ? { rowSpan } : {},
22998
23230
  ...cell.sourceBlocks ? {
22999
23231
  blocks: cellSourceBlocks(cell).map(
23000
23232
  (block) => block.type === "paragraph" ? adaptParagraph(block) : adaptTable(block, model, adaptParagraph, true)
@@ -23122,6 +23354,7 @@ var TEXT_BOX_NOTE = "Text boxes are shown on the editing surface but are not dra
23122
23354
  var EQUATION_NOTE = "Equations that cannot be drawn show a marker in Print Layout instead of the typeset equation.";
23123
23355
  var NEXT_COLUMN_NOTE = 'A "next column" section break is laid out as a continuous section break.';
23124
23356
  var twipsToPx3 = twipsToPixels;
23357
+ var HTML_AUTO_SPACING_TWIPS = twips(280);
23125
23358
  function isDisplayEquationParagraph(paragraph) {
23126
23359
  return paragraph.runs.some((run) => run.equation?.display) && paragraph.runs.every((run) => run.equation?.display || !run.text && !run.image);
23127
23360
  }
@@ -23141,6 +23374,9 @@ function adaptDocumentModel(model, note = () => {
23141
23374
  const reviewMode = options2.reviewDisplayMode ?? "all";
23142
23375
  const visibleModel = visibleReviewModel(model, reviewMode);
23143
23376
  const catalog = model.paragraphStyles;
23377
+ const addParagraphSpacing = model.doNotUseHtmlParagraphAutoSpacing === true;
23378
+ const keepSpaceBeforePageBreak = model.compatibilityMode !== 15;
23379
+ const autoSpaced = (auto, twipsValue) => auto && !addParagraphSpacing ? HTML_AUTO_SPACING_TWIPS : twipsValue;
23144
23380
  const noted = /* @__PURE__ */ new Set();
23145
23381
  const reportOnce = (message) => {
23146
23382
  if (!noted.has(message)) {
@@ -23166,7 +23402,11 @@ function adaptDocumentModel(model, note = () => {
23166
23402
  if (isRunHiddenForReview(run, reviewMode))
23167
23403
  return { text: run.text, hidden: true, sourceLength: reviewSourceLength(run) };
23168
23404
  const { formatting, family, color } = effective(run, paragraphStyleId);
23169
- const equation = run.equation ? equationObject(run.equation.omml, ptToPx(formatting.fontSize ?? DEFAULT_FONT_SIZE_PT)) : void 0;
23405
+ const equation = run.equation ? equationObject(
23406
+ run.equation.omml,
23407
+ ptToPx(formatting.fontSize ?? DEFAULT_FONT_SIZE_PT),
23408
+ Boolean(run.equation.display)
23409
+ ) : void 0;
23170
23410
  if (run.equation && !equation) reportOnce(EQUATION_NOTE);
23171
23411
  const name = run.field ? fieldName(run.field.instr) : "";
23172
23412
  const noteText = run.noteReference ? noteLabel(run.noteReference.kind, run.noteReference.id) : run.noteMark ? markLabel ?? "" : void 0;
@@ -23247,7 +23487,9 @@ function adaptDocumentModel(model, note = () => {
23247
23487
  function adaptParagraphOnly(paragraph, markLabel) {
23248
23488
  const resolved = catalog ? resolveParagraphFormatting(paragraph, catalog) : paragraph;
23249
23489
  const label = labels.get(paragraph.id);
23250
- const ownFirstLine = resolved.firstLineTwips !== void 0 || resolved.hangingTwips !== void 0;
23490
+ const levelWins = Boolean(label && paragraph.numbering);
23491
+ const indents = levelWins ? paragraph : resolved;
23492
+ const ownFirstLine = indents.firstLineTwips !== void 0 || indents.hangingTwips !== void 0;
23251
23493
  const runs = paragraph.runs.flatMap(
23252
23494
  (run) => symbolSegments(run).flatMap((segment2) => {
23253
23495
  const adapted = adaptRun(segment2, paragraph.style, markLabel);
@@ -23279,16 +23521,16 @@ function adaptDocumentModel(model, note = () => {
23279
23521
  ...definedProps({
23280
23522
  align: resolved.align ?? (isDisplayEquationParagraph(paragraph) ? "center" : void 0),
23281
23523
  direction: resolved.direction,
23282
- spacingBeforeTwips: resolved.spacingBeforeTwips,
23283
- spacingAfterTwips: resolved.spacingAfterTwips,
23524
+ spacingBeforeTwips: autoSpaced(resolved.spacingBeforeAuto, resolved.spacingBeforeTwips),
23525
+ spacingAfterTwips: autoSpaced(resolved.spacingAfterAuto, resolved.spacingAfterTwips),
23284
23526
  lineSpacingTwips: resolved.lineSpacingTwips,
23285
23527
  lineSpacingRule: resolved.lineSpacingRule,
23286
- indentLeftTwips: resolved.indentLeftTwips ?? label?.indentLeftTwips,
23528
+ indentLeftTwips: indents.indentLeftTwips ?? label?.indentLeftTwips ?? (levelWins ? resolved.indentLeftTwips : void 0),
23287
23529
  indentRightTwips: resolved.indentRightTwips,
23288
23530
  indentStartTwips: resolved.indentStartTwips,
23289
23531
  indentEndTwips: resolved.indentEndTwips,
23290
- firstLineTwips: ownFirstLine ? resolved.firstLineTwips : label?.firstLineTwips,
23291
- hangingTwips: ownFirstLine ? resolved.hangingTwips : label?.hangingTwips,
23532
+ firstLineTwips: ownFirstLine ? indents.firstLineTwips : label?.firstLineTwips,
23533
+ hangingTwips: ownFirstLine ? indents.hangingTwips : label?.hangingTwips,
23292
23534
  styleId: paragraph.style
23293
23535
  }),
23294
23536
  ...resolved.pageBreakBefore ? { pageBreakBefore: true } : {},
@@ -23347,6 +23589,8 @@ function adaptDocumentModel(model, note = () => {
23347
23589
  marginLeftPx: model.page.marginLeft
23348
23590
  },
23349
23591
  ...footnoteSeparators ? { footnoteSeparators } : {},
23592
+ ...addParagraphSpacing ? { addParagraphSpacing: true } : {},
23593
+ ...keepSpaceBeforePageBreak ? { keepSpaceBeforePageBreak: true } : {},
23350
23594
  ...modernFootnoteSeparator ? { modernFootnoteSeparator: true } : {},
23351
23595
  ...legacyFootnoteColumns ? { legacyFootnoteColumns: true } : {},
23352
23596
  blocks: blocks.filter((block) => !folded.has(block))
@@ -23413,6 +23657,8 @@ function adaptDocumentModel(model, note = () => {
23413
23657
  } : {}
23414
23658
  }
23415
23659
  } : {},
23660
+ ...addParagraphSpacing ? { addParagraphSpacing: true } : {},
23661
+ ...keepSpaceBeforePageBreak ? { keepSpaceBeforePageBreak: true } : {},
23416
23662
  ...sectionStart && { break: sectionStart },
23417
23663
  ...section.verticalAlign ? { verticalAlign: section.verticalAlign } : {},
23418
23664
  // Empty text break markers share the preceding line. The mandatory
@@ -23425,11 +23671,17 @@ function adaptDocumentModel(model, note = () => {
23425
23671
  })
23426
23672
  };
23427
23673
  });
23428
- return { sections: result };
23674
+ return {
23675
+ sections: result.map((section, index) => {
23676
+ const last = result[index - 1]?.blocks.at(-1);
23677
+ const after = last?.kind === "paragraph" ? last.spacingAfterTwips : void 0;
23678
+ return !addParagraphSpacing && after ? { ...section, leadingSpacingAfterPx: twipsToPx3(after) } : section;
23679
+ })
23680
+ };
23429
23681
  }
23430
23682
 
23431
23683
  // docx/layout/floats.ts
23432
- var FLOAT_WRAP_NOTE = "Text wraps around floating pictures on their largest side (square, tight and through wrapping use the picture\u2019s rectangle, not its outline); lines continuing onto a later page keep their wrapped widths.";
23684
+ var FLOAT_WRAP_NOTE = "Text wraps around floating pictures on their largest side, or on both sides of a square, tight or through picture whose wrapText is bothSides (all use the picture\u2019s rectangle, not its outline); lines continuing onto a later page keep their wrapped widths.";
23433
23685
  function horizontalArea(float, page, column) {
23434
23686
  const contentLeft = page.marginLeftPx;
23435
23687
  switch (float.relativeFromH) {
@@ -23519,7 +23771,8 @@ function positionFloats(input, pages) {
23519
23771
  contentType: float.contentType,
23520
23772
  ...float.chart ? { chart: float.chart } : {},
23521
23773
  behindText: Boolean(float.behindText),
23522
- ...float.wrap ? { wrap: float.wrap } : {}
23774
+ ...float.wrap ? { wrap: float.wrap } : {},
23775
+ ...float.wrapText ? { wrapText: float.wrapText } : {}
23523
23776
  });
23524
23777
  }
23525
23778
  }