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
@@ -541,6 +541,8 @@ function resolveParagraphFormatting(paragraph, catalog) {
541
541
  "direction",
542
542
  "spacingBeforeTwips",
543
543
  "spacingAfterTwips",
544
+ "spacingBeforeAuto",
545
+ "spacingAfterAuto",
544
546
  "lineSpacingTwips",
545
547
  "lineSpacingRule",
546
548
  "indentLeftTwips",
@@ -1767,14 +1769,6 @@ function escapeXmlAttr(value) {
1767
1769
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
1768
1770
  }
1769
1771
 
1770
- // docx/expect-defined.ts
1771
- function expectDefined(value, context) {
1772
- if (value === void 0 || value === null) {
1773
- throw new Error(`Internal invariant violated: ${context} is missing.`);
1774
- }
1775
- return value;
1776
- }
1777
-
1778
1772
  // docx/element-order.ts
1779
1773
  function orderChildren(parent, order) {
1780
1774
  const elements2 = Array.from(parent.childNodes).filter(isElement);
@@ -1844,6 +1838,55 @@ function orderParagraphProperties(props) {
1844
1838
  orderChildren(props, PPR_ORDER);
1845
1839
  }
1846
1840
 
1841
+ // docx/expect-defined.ts
1842
+ function expectDefined(value, context) {
1843
+ if (value === void 0 || value === null) {
1844
+ throw new Error(`Internal invariant violated: ${context} is missing.`);
1845
+ }
1846
+ return value;
1847
+ }
1848
+
1849
+ // docx/table-grid.ts
1850
+ var spanOf = (cell) => Math.max(1, cell.gridSpan ?? 1);
1851
+ function tableGrid(table) {
1852
+ const columns = table.grid?.length ?? sumSpans(table.rows[0]);
1853
+ if (!columns || !table.rows.length) return void 0;
1854
+ const rows2 = [];
1855
+ const cover = [];
1856
+ for (let row2 = 0; row2 < table.rows.length; row2++) {
1857
+ const cells = table.rows[row2] ?? [];
1858
+ if (!cells.length || sumSpans(cells) !== columns) return void 0;
1859
+ const placed2 = [];
1860
+ const line3 = new Array(columns);
1861
+ let col = 0;
1862
+ cells.forEach((cell, index) => {
1863
+ const entry = { cell, row: row2, index, col, span: spanOf(cell) };
1864
+ for (let k = 0; k < entry.span; k++) line3[col + k] = entry;
1865
+ col += entry.span;
1866
+ placed2.push(entry);
1867
+ });
1868
+ rows2.push(placed2);
1869
+ cover.push(line3);
1870
+ }
1871
+ const grid = { columns, rows: rows2, cover };
1872
+ for (const entry of rows2.flat())
1873
+ if (entry.cell.verticalMerge === "continue") {
1874
+ const above2 = entry.row > 0 ? cover[entry.row - 1]?.[entry.col] : void 0;
1875
+ if (!above2 || above2.col !== entry.col || above2.span !== entry.span) return void 0;
1876
+ if (!above2.cell.verticalMerge) return void 0;
1877
+ }
1878
+ return grid;
1879
+ }
1880
+ function sumSpans(cells) {
1881
+ return (cells ?? []).reduce((sum, cell) => sum + spanOf(cell), 0);
1882
+ }
1883
+ function rowSpanOf(grid, entry) {
1884
+ if (entry.cell.verticalMerge !== "restart") return 1;
1885
+ let height = 1;
1886
+ while (grid.cover[entry.row + height]?.[entry.col]?.cell.verticalMerge === "continue") height++;
1887
+ return height;
1888
+ }
1889
+
1847
1890
  // docx/special-characters.ts
1848
1891
  function symbolCharacter(char) {
1849
1892
  const code = /^[0-9a-f]{1,6}$/i.test(char) ? Number.parseInt(char, 16) : Number.NaN;
@@ -9289,7 +9332,8 @@ var pie = {
9289
9332
  gd16("stAng", "pin 0 adj1 21599999"),
9290
9333
  gd16("endAng", "pin 0 adj2 21599999"),
9291
9334
  gd16("swAng", "+- endAng 0 stAng"),
9292
- gd16("swAng2", "?: swAng swAng +- 21600000 swAng 0"),
9335
+ gd16("swAngWrap", "+- swAng 21600000 0"),
9336
+ gd16("swAng2", "?: swAng swAng swAngWrap"),
9293
9337
  gd16("stx", "cos wd2 stAng"),
9294
9338
  gd16("sty", "sin hd2 stAng"),
9295
9339
  gd16("x1", "+- hc stx 0"),
@@ -9334,7 +9378,8 @@ var chord = {
9334
9378
  gd16("stAng", "pin 0 adj1 21599999"),
9335
9379
  gd16("endAng", "pin 0 adj2 21599999"),
9336
9380
  gd16("swAng", "+- endAng 0 stAng"),
9337
- gd16("swAng2", "?: swAng swAng +- 21600000 swAng 0"),
9381
+ gd16("swAngWrap", "+- swAng 21600000 0"),
9382
+ gd16("swAng2", "?: swAng swAng swAngWrap"),
9338
9383
  gd16("stx", "cos wd2 stAng"),
9339
9384
  gd16("sty", "sin hd2 stAng"),
9340
9385
  gd16("x1", "+- hc stx 0"),
@@ -9358,7 +9403,8 @@ var arc = {
9358
9403
  gd16("stAng", "pin 0 adj1 21599999"),
9359
9404
  gd16("endAng", "pin 0 adj2 21599999"),
9360
9405
  gd16("swAng", "+- endAng 0 stAng"),
9361
- gd16("swAng2", "?: swAng swAng +- 21600000 swAng 0"),
9406
+ gd16("swAngWrap", "+- swAng 21600000 0"),
9407
+ gd16("swAng2", "?: swAng swAng swAngWrap"),
9362
9408
  gd16("stx", "cos wd2 stAng"),
9363
9409
  gd16("sty", "sin hd2 stAng"),
9364
9410
  gd16("x1", "+- hc stx 0"),
@@ -9453,7 +9499,8 @@ var blockArc = {
9453
9499
  gd16("iwd2", "+- wd2 0 thw"),
9454
9500
  gd16("ihd2", "+- hd2 0 thh2"),
9455
9501
  gd16("swAng", "+- endAng 0 stAng"),
9456
- gd16("swAng2", "?: swAng swAng +- 21600000 swAng 0"),
9502
+ gd16("swAngWrap", "+- swAng 21600000 0"),
9503
+ gd16("swAng2", "?: swAng swAng swAngWrap"),
9457
9504
  gd16("mswAng", "+- 0 0 swAng2"),
9458
9505
  gd16("stx", "cos wd2 stAng"),
9459
9506
  gd16("sty", "sin hd2 stAng"),
@@ -16972,6 +17019,10 @@ function parseDirectParagraphProperties(props) {
16972
17019
  const line3 = signedTwipValue(getW(spacing2, "line"));
16973
17020
  if (before !== void 0) paragraph.spacingBeforeTwips = before;
16974
17021
  if (after !== void 0) paragraph.spacingAfterTwips = after;
17022
+ const beforeAuto = parseOnOff(getW(spacing2, "beforeAutospacing"));
17023
+ const afterAuto = parseOnOff(getW(spacing2, "afterAutospacing"));
17024
+ if (beforeAuto !== void 0) paragraph.spacingBeforeAuto = beforeAuto;
17025
+ if (afterAuto !== void 0) paragraph.spacingAfterAuto = afterAuto;
16975
17026
  if (line3 !== void 0) {
16976
17027
  paragraph.lineSpacingTwips = line3;
16977
17028
  }
@@ -18656,8 +18707,8 @@ function justify(fragments, width) {
18656
18707
  const spaceIndices = fragments.map((f, i) => f.text === " " ? i : -1).filter((i) => i >= 0);
18657
18708
  if (!spaceIndices.length || !fragments.length) return fragments;
18658
18709
  const natural = fragments.at(-1).xPx + fragments.at(-1).widthPx;
18659
- const extra = Math.max(0, width - natural) / spaceIndices.length;
18660
- if (extra <= 0) return fragments;
18710
+ const extra = (width - natural) / spaceIndices.length;
18711
+ if (extra === 0) return fragments;
18661
18712
  let shift = 0;
18662
18713
  return fragments.map((fragment, index) => {
18663
18714
  const placedFragment = { ...fragment, xPx: fragment.xPx + shift };
@@ -18701,6 +18752,7 @@ function cachedParagraphLayout(measurer, key, note, compute) {
18701
18752
  }
18702
18753
 
18703
18754
  // docx/layout/paragraph-layout.ts
18755
+ var SPACE_SHRINK = 0.145;
18704
18756
  function layoutParagraph(paragraph, contentWidthPx, measurer, note, lineBox, startToken = 0) {
18705
18757
  if (lineBox)
18706
18758
  return measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, startToken);
@@ -18739,6 +18791,8 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
18739
18791
  let widthOverflowNoted = false;
18740
18792
  let placed2 = [];
18741
18793
  let lineWidthPx = 0;
18794
+ let lineSpacePx = 0;
18795
+ let jump;
18742
18796
  let marginReachPx = 0;
18743
18797
  let tokenCursor = startToken;
18744
18798
  let firstToken = startToken;
@@ -18756,7 +18810,8 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
18756
18810
  boxes[lineIndex] = {
18757
18811
  leftInsetPx: box?.leftInsetPx ?? 0,
18758
18812
  rightInsetPx: box?.rightInsetPx ?? 0,
18759
- gapBeforePx: gap
18813
+ gapBeforePx: gap,
18814
+ ...box?.hole ? { hole: box.hole } : {}
18760
18815
  };
18761
18816
  }
18762
18817
  return expectDefined(boxes[lineIndex], "line box");
@@ -18803,7 +18858,7 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
18803
18858
  while (rendered.length && rendered.at(-1).token.kind === "space") rendered.pop();
18804
18859
  const fragments = buildFragments(rendered, paragraph);
18805
18860
  const [firstPlaced] = placed2;
18806
- const start = firstPlaced ? globalOffset(firstPlaced.token) : 0;
18861
+ const start = lines.length === 0 && startToken === 0 ? 0 : firstPlaced ? globalOffset(firstPlaced.token) : 0;
18807
18862
  const last = placed2.at(-1)?.token;
18808
18863
  const end = last ? globalOffset(last, last.kind === "word" || last.kind === "space" ? last.text.length : 1) : start;
18809
18864
  const gapBeforePx = boxFor(lineIndex).gapBeforePx;
@@ -18819,6 +18874,9 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
18819
18874
  fragment.topPx = baselinePx - extent2.above;
18820
18875
  if (token.kind !== "object") fragment.boxHeightPx = extent2.ascent + extent2.descent;
18821
18876
  });
18877
+ if (jump) {
18878
+ for (const fragment of fragments.slice(jump.index)) fragment.xPx += jump.shiftPx;
18879
+ }
18822
18880
  lines.push({
18823
18881
  yPx: 0,
18824
18882
  heightPx,
@@ -18835,6 +18893,8 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
18835
18893
  if (forcedByBreak === "column") columnBreakAfterLine.add(lineIndex);
18836
18894
  placed2 = [];
18837
18895
  lineWidthPx = 0;
18896
+ lineSpacePx = 0;
18897
+ jump = void 0;
18838
18898
  marginReachPx = 0;
18839
18899
  }
18840
18900
  for (const [tokenIndex, token] of tokens.entries()) {
@@ -18884,9 +18944,19 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
18884
18944
  leader = tab.leader === "none" ? void 0 : tab.leader;
18885
18945
  }
18886
18946
  const lineIndex = lines.length;
18887
- const limit = Math.max(availableWidth(lineIndex), marginReachPx);
18888
- const wouldFit = lineWidthPx + (token.kind === "tab" ? width : advance) <= limit || placed2.every((placed3) => paragraph.runs[placed3.token.runIndex]?.synthetic);
18889
- if (!wouldFit && token.kind !== "space") {
18947
+ const hole = boxFor(lineIndex).hole;
18948
+ const beforeHole = hole && !jump ? hole.startPx - lineStart(lineIndex) : void 0;
18949
+ const limit = Math.max(
18950
+ beforeHole ?? availableWidth(lineIndex) - (jump?.shiftPx ?? 0),
18951
+ marginReachPx
18952
+ );
18953
+ const squeezePx = effectiveAlign === "justify" && token.kind === "word" ? lineSpacePx * SPACE_SHRINK : 0;
18954
+ const fits = lineWidthPx + (token.kind === "tab" ? width : advance) <= limit + squeezePx;
18955
+ const wouldFit = fits || placed2.every((placed3) => paragraph.runs[placed3.token.runIndex]?.synthetic);
18956
+ const pastHole = !fits && hole && !jump && token.kind === "word" ? hole.endPx - lineStart(lineIndex) - lineWidthPx : void 0;
18957
+ if (pastHole !== void 0 && lineWidthPx + pastHole + advance <= availableWidth(lineIndex)) {
18958
+ jump = { index: placed2.length, shiftPx: pastHole };
18959
+ } else if (!wouldFit && token.kind !== "space") {
18890
18960
  tokenCursor = tokenIndex;
18891
18961
  flushLine(false, void 0);
18892
18962
  tokenCursor = tokenIndex + 1;
@@ -18906,6 +18976,7 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
18906
18976
  ...markerFactor ? { xOffsetPx: -width * markerFactor, advancePx: advance } : {}
18907
18977
  });
18908
18978
  lineWidthPx += token.kind === "tab" ? width : advance;
18979
+ if (token.kind === "space") lineSpacePx += advance;
18909
18980
  }
18910
18981
  flushLine(lines.length === 0, void 0);
18911
18982
  const lastIndex = lines.length - 1;
@@ -18916,7 +18987,8 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
18916
18987
  line3.fragments,
18917
18988
  availableWidth(index),
18918
18989
  index === lastIndex,
18919
- effectiveAlign
18990
+ // A line that runs around a picture is not aligned across it.
18991
+ boxes[index]?.hole ? "left" : effectiveAlign
18920
18992
  ).map((fragment) => ({ ...fragment, xPx: fragment.xPx + lineStart(index) }))
18921
18993
  };
18922
18994
  }
@@ -18968,29 +19040,50 @@ function widowControlEnabled(value) {
18968
19040
 
18969
19041
  // docx/layout/nested-frame-profile.ts
18970
19042
  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;
18971
- function nestedFrameProfile(table, tableWidthPx = table.widthPx) {
19043
+ function mergedAway(table, rowIndex, column, side, merges) {
19044
+ if (!merges) return false;
19045
+ const row2 = table.rows[rowIndex];
19046
+ const cell = row2.cells[column];
19047
+ if (side === "top") return cell.verticalMerge === "continue";
19048
+ const below2 = table.rows[rowIndex + 1]?.cells.find(
19049
+ (other) => other.xPx === cell.xPx && other.widthPx === cell.widthPx
19050
+ );
19051
+ return below2?.verticalMerge === "continue";
19052
+ }
19053
+ function nestedFrameProfile(table, tableWidthPx = table.widthPx, merges = false) {
18972
19054
  const sides = table.rows.flatMap(
18973
- (row2) => row2.cells.flatMap(
18974
- (cell) => ["top", "right", "bottom", "left"].map((side) => cell.borders?.[side])
19055
+ (row2, rowIndex) => row2.cells.flatMap(
19056
+ (cell, column) => ["top", "right", "bottom", "left"].filter(
19057
+ (side) => side !== "top" && side !== "bottom" || !mergedAway(table, rowIndex, column, side, merges)
19058
+ ).map((side) => cell.borders?.[side])
18975
19059
  )
18976
19060
  );
18977
19061
  if (sides.every((side) => !side)) return { leftPx: 0, rightPx: 0, bottomPx: 0 };
18978
19062
  if (!sides.every((side) => side?.style === "solid" && side.widthPx > 0)) return void 0;
19063
+ const gridKnown = merges && table.rows.every(
19064
+ (row2) => row2.cells.every((cell) => cell.xPx !== void 0 && cell.widthPx !== void 0)
19065
+ );
18979
19066
  const first3 = table.rows[0], left = first3.cells[0].borders.left, right = first3.cells.at(-1).borders.right;
18980
19067
  for (const [index, row2] of table.rows.entries()) {
18981
- if (row2.cells.length !== first3.cells.length || !equal(row2.cells[0]?.borders?.left, left) || !equal(row2.cells.at(-1)?.borders?.right, right))
19068
+ if (!gridKnown && row2.cells.length !== first3.cells.length || !equal(row2.cells[0]?.borders?.left, left) || !equal(row2.cells.at(-1)?.borders?.right, right))
18982
19069
  return void 0;
18983
19070
  for (const [column, cell] of row2.cells.entries()) {
18984
19071
  const sourceWidth = cell.widthPx ?? (tableWidthPx === void 0 ? void 0 : tableWidthPx / row2.cells.length);
18985
19072
  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);
18986
19073
  if (paintWidth !== void 0 && paintWidth <= 0) return void 0;
18987
- if (!equal(cell.borders?.top, row2.cells[0]?.borders?.top) || !equal(cell.borders?.bottom, row2.cells[0]?.borders?.bottom))
19074
+ const topAway = mergedAway(table, index, column, "top", merges);
19075
+ const bottomAway = mergedAway(table, index, column, "bottom", merges);
19076
+ const reference = (side) => row2.cells.find((_, at) => !mergedAway(table, index, at, side, merges))?.borders?.[side];
19077
+ if (!topAway && !equal(cell.borders?.top, reference("top")) || !bottomAway && !equal(cell.borders?.bottom, reference("bottom")))
18988
19078
  return void 0;
18989
19079
  if (column && !equal(row2.cells[column - 1]?.borders?.right, cell.borders?.left))
18990
19080
  return void 0;
18991
19081
  if (index) {
18992
- const previous = table.rows[index - 1].cells[column];
18993
- if (previous.xPx !== cell.xPx || previous.widthPx !== cell.widthPx || !equal(previous.borders?.bottom, cell.borders?.top))
19082
+ const above2 = table.rows[index - 1];
19083
+ const previous = gridKnown ? above2.cells.find(
19084
+ (other) => other.xPx <= cell.xPx + 1e-6 && cell.xPx < other.xPx + other.widthPx - 1e-6
19085
+ ) : above2.cells[column];
19086
+ 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))
18994
19087
  return void 0;
18995
19088
  }
18996
19089
  }
@@ -19045,46 +19138,6 @@ function cellContentBottom(boxes, paddingBottom = 0) {
19045
19138
  );
19046
19139
  }
19047
19140
 
19048
- // docx/layout/table-frames.ts
19049
- function clipTableFrames(tables, start, end, inset = 0) {
19050
- return tables.flatMap((table) => {
19051
- const top = Math.max(start, table.yPx);
19052
- const bottom = Math.min(end, table.yPx + table.heightPx);
19053
- if (bottom <= top) return [];
19054
- const rows2 = table.rows.flatMap((row2) => {
19055
- const rowTop = table.yPx + row2.yPx;
19056
- const a = Math.max(top, rowTop), b = Math.min(bottom, rowTop + row2.heightPx);
19057
- if (b <= a) return [];
19058
- return [
19059
- {
19060
- ...row2,
19061
- yPx: a - top,
19062
- heightPx: b - a,
19063
- ...row2.cellTables ? {
19064
- cellTables: row2.cellTables.map(
19065
- (nested) => clipTableFrames(nested, a - rowTop, b - rowTop)
19066
- )
19067
- } : {}
19068
- }
19069
- ];
19070
- });
19071
- if (table.fragmentEdges && rows2.length) {
19072
- const edges = table.fragmentEdges;
19073
- for (const [row2, side] of [
19074
- [rows2[0], "top"],
19075
- [rows2.at(-1), "bottom"]
19076
- ]) {
19077
- if (row2.geometry)
19078
- row2.geometry = row2.geometry.map((cell, index) => ({
19079
- ...cell,
19080
- borders: { ...cell.borders, [side]: edges[side][index] }
19081
- }));
19082
- }
19083
- }
19084
- return [{ ...table, yPx: top - start + inset, heightPx: bottom - top, rows: rows2 }];
19085
- });
19086
- }
19087
-
19088
19141
  // docx/layout/table-cell-layout.ts
19089
19142
  function cellParagraphs(cell) {
19090
19143
  const walk = (blocks) => blocks.flatMap(
@@ -19192,92 +19245,47 @@ function stackCellBlocks(cell, width, measurer, note, top, starts, physicalFragm
19192
19245
  return { heightPx: y, boxes, tables };
19193
19246
  }
19194
19247
 
19195
- // docx/layout/table-layout.ts
19196
- function stackParagraphs(paragraphs, widthPx, measurer, note, topPx = 0, startTokens) {
19197
- let y = topPx;
19198
- const boxes = [];
19199
- for (const paragraph of paragraphs) {
19200
- const layout = layoutParagraph(
19201
- paragraph,
19202
- widthPx,
19203
- measurer,
19204
- note,
19205
- void 0,
19206
- startTokens?.get(paragraph.id) ?? 0
19207
- );
19208
- y += layout.spacingBeforePx;
19209
- const top = y;
19210
- const lines = layout.lines.map((line3) => ({ ...line3 }));
19211
- boxes.push({
19212
- kind: "paragraph",
19213
- blockId: paragraph.id,
19214
- yPx: top,
19215
- heightPx: layout.contentHeightPx,
19216
- lines,
19217
- ...layout.frame ? { frame: layout.frame } : {}
19218
- });
19219
- y += layout.contentHeightPx + layout.spacingAfterPx;
19220
- }
19221
- return { heightPx: y, boxes };
19222
- }
19223
- function layoutRow(row2, tableWidthPx, measurer, note, remaining, startTokens, frameBorders = false, frameLeftBorderPx, physicalFragments = reflowNestedFragments(row2)) {
19224
- const count = row2.cells.length || 1;
19225
- let x = 0;
19226
- const geometry = [];
19227
- const laidOut = row2.cells.map((cell) => {
19228
- const continuation = remaining?.[geometry.length];
19229
- const starts = continuation ? new Map(continuation.map((box) => [box.blockId, box.lines[0]?.firstToken ?? 0])) : startTokens;
19230
- const widthPx = cell.widthPx ?? tableWidthPx / count;
19231
- const margins = cell.padding ?? { top: 0, right: 0, bottom: 0, left: 0 };
19232
- const leftBorder = frameBorders ? cell.borders?.left?.widthPx ?? 0 : 0;
19233
- const rightBorder = frameBorders ? cell.borders?.right?.widthPx ?? 0 : 0;
19234
- const padding = frameBorders ? {
19235
- top: margins.top + (cell.borders?.top?.widthPx ?? 0),
19236
- bottom: margins.bottom,
19237
- left: leftBorder / 2 + Math.max(margins.left, leftBorder / 2),
19238
- right: Math.max(margins.right, rightBorder / 2) - rightBorder / 2
19239
- } : margins;
19240
- const externalRight = frameBorders && geometry.length === row2.cells.length - 1 ? rightBorder : 0;
19241
- const paintWidth = widthPx + (frameBorders ? (leftBorder - rightBorder) / 2 + externalRight : 0);
19242
- const frameX = frameBorders ? ((frameLeftBorderPx ?? leftBorder) - leftBorder) / 2 : 0;
19243
- const content2 = stackCellBlocks(
19244
- cell,
19245
- Math.max(1, paintWidth - padding.left - padding.right - externalRight),
19246
- measurer,
19247
- note,
19248
- padding.top,
19249
- starts,
19250
- physicalFragments
19251
- );
19252
- const heightPx2 = content2.heightPx + padding.bottom;
19253
- geometry.push({
19254
- xPx: (cell.xPx ?? x) + frameX,
19255
- widthPx: paintWidth,
19256
- ...frameBorders ? { borderInsetsReserved: true } : {},
19257
- paddingLeftPx: padding.left,
19258
- paddingRightPx: padding.right + externalRight,
19259
- contentHeightPx: heightPx2,
19260
- ...cell.borders ? { borders: cell.borders } : {},
19261
- ...cell.shading ? { shading: cell.shading } : {},
19262
- ...cell.verticalAlign ? { verticalAlign: cell.verticalAlign } : {}
19248
+ // docx/layout/table-frames.ts
19249
+ function clipTableFrames(tables, start, end, inset = 0) {
19250
+ return tables.flatMap((table) => {
19251
+ const top = Math.max(start, table.yPx);
19252
+ const bottom = Math.min(end, table.yPx + table.heightPx);
19253
+ if (bottom <= top) return [];
19254
+ const rows2 = table.rows.flatMap((row2) => {
19255
+ const rowTop = table.yPx + row2.yPx;
19256
+ const a = Math.max(top, rowTop), b = Math.min(bottom, rowTop + row2.heightPx);
19257
+ if (b <= a) return [];
19258
+ return [
19259
+ {
19260
+ ...row2,
19261
+ yPx: a - top,
19262
+ heightPx: b - a,
19263
+ ...row2.cellTables ? {
19264
+ cellTables: row2.cellTables.map(
19265
+ (nested) => clipTableFrames(nested, a - rowTop, b - rowTop)
19266
+ )
19267
+ } : {}
19268
+ }
19269
+ ];
19263
19270
  });
19264
- x = (cell.xPx ?? x) + widthPx;
19265
- return { heightPx: heightPx2, boxes: content2.boxes, tables: content2.tables ?? [] };
19271
+ if (table.fragmentEdges && rows2.length) {
19272
+ const edges = table.fragmentEdges;
19273
+ for (const [row2, side] of [
19274
+ [rows2[0], "top"],
19275
+ [rows2.at(-1), "bottom"]
19276
+ ]) {
19277
+ if (row2.geometry)
19278
+ row2.geometry = row2.geometry.map((cell, index) => ({
19279
+ ...cell,
19280
+ borders: { ...cell.borders, [side]: edges[side][index] }
19281
+ }));
19282
+ }
19283
+ }
19284
+ return [{ ...table, yPx: top - start + inset, heightPx: bottom - top, rows: rows2 }];
19266
19285
  });
19267
- const content = Math.max(0, ...laidOut.map((cell) => cell.heightPx));
19268
- const heightPx = row2.heightPx === void 0 ? content : row2.heightRule === "exact" ? row2.heightPx : Math.max(content, row2.heightPx);
19269
- if (frameBorders) for (const cell of geometry) cell.alignmentHeightPx = heightPx;
19270
- return {
19271
- heightPx,
19272
- cells: laidOut.map((cell) => cell.boxes),
19273
- geometry,
19274
- ...laidOut.some((cell) => cell.tables.length) ? { cellTables: laidOut.map((cell) => cell.tables) } : {},
19275
- cellPadding: row2.cells.map((cell) => ({
19276
- top: cell.padding?.top ?? 0,
19277
- bottom: cell.padding?.bottom ?? 0
19278
- }))
19279
- };
19280
19286
  }
19287
+
19288
+ // docx/layout/table-row-split.ts
19281
19289
  function splitCellAtHeight(boxes, cutHeightPx, paragraphCuts) {
19282
19290
  const before = [];
19283
19291
  const after = [];
@@ -19351,7 +19359,7 @@ function splitRowAtHeight(row2, cutHeightPx, cellCuts, paragraphCuts) {
19351
19359
  )
19352
19360
  )
19353
19361
  } : {},
19354
- geometry: row2.geometry.map((geometry, index) => ({
19362
+ geometry: row2.geometry.map(({ mergeRows: _merge, ...geometry }, index) => ({
19355
19363
  ...geometry,
19356
19364
  contentHeightPx: splits[index].beforeHeightPx,
19357
19365
  ...row2.borderBottomPx !== void 0 ? { alignmentHeightPx: beforeHeightPx } : {}
@@ -19360,10 +19368,11 @@ function splitRowAtHeight(row2, cutHeightPx, cellCuts, paragraphCuts) {
19360
19368
  ...row2.borderBottomPx !== void 0 ? { borderBottomPx: row2.borderBottomPx } : {}
19361
19369
  };
19362
19370
  if (!anyAfter) return { before, after: null };
19371
+ const tail = (split, index) => split.after.length ? row2.trailingPx?.[index] ?? 0 : 0;
19363
19372
  const afterHeightPx = Math.max(
19364
19373
  0,
19365
19374
  ...splits.map(
19366
- (split, index) => cellContentBottom(split.after, row2.cellPadding?.[index]?.bottom ?? 0)
19375
+ (split, index) => cellContentBottom(split.after, row2.cellPadding?.[index]?.bottom ?? 0) + tail(split, index)
19367
19376
  )
19368
19377
  );
19369
19378
  const after = {
@@ -19379,20 +19388,114 @@ function splitRowAtHeight(row2, cutHeightPx, cellCuts, paragraphCuts) {
19379
19388
  ) : []
19380
19389
  )
19381
19390
  } : {},
19382
- geometry: row2.geometry.map((geometry, index) => ({
19391
+ geometry: row2.geometry.map(({ mergeRows: _merge, ...geometry }, index) => ({
19383
19392
  ...geometry,
19384
- contentHeightPx: cellContentBottom(
19385
- splits[index].after,
19386
- row2.cellPadding?.[index]?.bottom ?? 0
19387
- ),
19393
+ contentHeightPx: cellContentBottom(splits[index].after, row2.cellPadding?.[index]?.bottom ?? 0) + tail(splits[index], index),
19388
19394
  ...row2.borderBottomPx !== void 0 ? { alignmentHeightPx: afterHeightPx } : {}
19389
19395
  })),
19390
19396
  ...row2.cellPadding ? { cellPadding: row2.cellPadding } : {},
19397
+ ...row2.trailingPx ? { trailingPx: row2.trailingPx } : {},
19391
19398
  ...row2.borderBottomPx !== void 0 ? { borderBottomPx: row2.borderBottomPx } : {}
19392
19399
  };
19393
19400
  return { before, after };
19394
19401
  }
19395
19402
 
19403
+ // docx/layout/table-layout.ts
19404
+ function stackParagraphs(paragraphs, widthPx, measurer, note, topPx = 0, startTokens) {
19405
+ let y = topPx;
19406
+ const boxes = [];
19407
+ for (const paragraph of paragraphs) {
19408
+ const layout = layoutParagraph(
19409
+ paragraph,
19410
+ widthPx,
19411
+ measurer,
19412
+ note,
19413
+ void 0,
19414
+ startTokens?.get(paragraph.id) ?? 0
19415
+ );
19416
+ y += layout.spacingBeforePx;
19417
+ const top = y;
19418
+ const lines = layout.lines.map((line3) => ({ ...line3 }));
19419
+ boxes.push({
19420
+ kind: "paragraph",
19421
+ blockId: paragraph.id,
19422
+ yPx: top,
19423
+ heightPx: layout.contentHeightPx,
19424
+ lines,
19425
+ ...layout.frame ? { frame: layout.frame } : {}
19426
+ });
19427
+ y += layout.contentHeightPx + layout.spacingAfterPx;
19428
+ }
19429
+ return { heightPx: y, boxes };
19430
+ }
19431
+ function layoutRow(row2, tableWidthPx, measurer, note, remaining, startTokens, frameBorders = false, frameLeftBorderPx, physicalFragments = reflowNestedFragments(row2)) {
19432
+ const count = row2.cells.length || 1;
19433
+ let x = 0;
19434
+ const geometry = [];
19435
+ const laidOut = row2.cells.map((cell) => {
19436
+ const continuation = remaining?.[geometry.length];
19437
+ const starts = continuation ? new Map(continuation.map((box) => [box.blockId, box.lines[0]?.firstToken ?? 0])) : startTokens;
19438
+ const widthPx = cell.widthPx ?? tableWidthPx / count;
19439
+ const margins = cell.padding ?? { top: 0, right: 0, bottom: 0, left: 0 };
19440
+ const leftBorder = frameBorders ? cell.borders?.left?.widthPx ?? 0 : 0;
19441
+ const rightBorder = frameBorders ? cell.borders?.right?.widthPx ?? 0 : 0;
19442
+ const padding = frameBorders ? {
19443
+ top: margins.top + (cell.borders?.top?.widthPx ?? 0),
19444
+ bottom: margins.bottom,
19445
+ left: leftBorder / 2 + Math.max(margins.left, leftBorder / 2),
19446
+ right: Math.max(margins.right, rightBorder / 2) - rightBorder / 2
19447
+ } : margins;
19448
+ const externalRight = frameBorders && geometry.length === row2.cells.length - 1 ? rightBorder : 0;
19449
+ const paintWidth = widthPx + (frameBorders ? (leftBorder - rightBorder) / 2 + externalRight : 0);
19450
+ const frameX = frameBorders ? ((frameLeftBorderPx ?? leftBorder) - leftBorder) / 2 : 0;
19451
+ const content2 = stackCellBlocks(
19452
+ cell,
19453
+ Math.max(1, paintWidth - padding.left - padding.right - externalRight),
19454
+ measurer,
19455
+ note,
19456
+ padding.top,
19457
+ starts,
19458
+ physicalFragments
19459
+ );
19460
+ const heightPx2 = content2.heightPx + padding.bottom;
19461
+ geometry.push({
19462
+ xPx: (cell.xPx ?? x) + frameX,
19463
+ widthPx: paintWidth,
19464
+ ...frameBorders ? { borderInsetsReserved: true } : {},
19465
+ paddingLeftPx: padding.left,
19466
+ paddingRightPx: padding.right + externalRight,
19467
+ contentHeightPx: heightPx2,
19468
+ ...cell.borders ? { borders: cell.borders } : {},
19469
+ ...cell.shading ? { shading: cell.shading } : {},
19470
+ ...cell.verticalAlign ? { verticalAlign: cell.verticalAlign } : {},
19471
+ ...cell.rowSpan ? { mergeRows: cell.rowSpan } : {}
19472
+ });
19473
+ x = (cell.xPx ?? x) + widthPx;
19474
+ const trailingPx = content2.tables?.length ? 0 : Math.max(0, content2.heightPx - cellContentBottom(content2.boxes));
19475
+ return { heightPx: heightPx2, boxes: content2.boxes, tables: content2.tables ?? [], trailingPx };
19476
+ });
19477
+ const content = Math.max(
19478
+ 0,
19479
+ ...laidOut.map(
19480
+ (cell, index) => (row2.cells[index]?.rowSpan ?? 1) > 1 && !row2.mergedTextInRow ? 0 : cell.heightPx
19481
+ )
19482
+ );
19483
+ const heightPx = row2.heightPx === void 0 ? content : row2.heightRule === "exact" ? row2.heightPx : Math.max(content, row2.heightPx);
19484
+ if (frameBorders) for (const cell of geometry) cell.alignmentHeightPx = heightPx;
19485
+ const trailing = laidOut.map((cell) => cell.trailingPx);
19486
+ return {
19487
+ heightPx,
19488
+ cells: laidOut.map((cell) => cell.boxes),
19489
+ geometry,
19490
+ ...trailing.some((px) => px > 0) ? { trailingPx: trailing } : {},
19491
+ ...laidOut.some((cell) => cell.tables.length) ? { cellTables: laidOut.map((cell) => cell.tables) } : {},
19492
+ cellPadding: row2.cells.map((cell) => ({
19493
+ top: cell.padding?.top ?? 0,
19494
+ bottom: cell.padding?.bottom ?? 0
19495
+ }))
19496
+ };
19497
+ }
19498
+
19396
19499
  // docx/layout/footnote-split.ts
19397
19500
  function splitNote(note, budget) {
19398
19501
  if (note.heightPx <= budget + 1e-6) return { before: note };
@@ -19846,6 +19949,14 @@ var PageCursor = class {
19846
19949
  get usedColumnHeightPx() {
19847
19950
  return this.yPx - this.columnTopPx;
19848
19951
  }
19952
+ /**
19953
+ * At the top of a later page or a later column of the section (not the section's first page, nor
19954
+ * a continuous band). Word drops the space before of the paragraph placed here, whether a page
19955
+ * break, a natural overflow, `pageBreakBefore` or a column overflow brought it (spacing-probe.json).
19956
+ */
19957
+ get atContinuationTop() {
19958
+ return this.atColumnTop && this.columnTopPx === 0 && (this.page.pageInSection > 0 || this.columnIndex > 0);
19959
+ }
19849
19960
  get atColumnTop() {
19850
19961
  return this.yPx === this.columnTopPx;
19851
19962
  }
@@ -19936,13 +20047,16 @@ var PageCursor = class {
19936
20047
  this.pushPage();
19937
20048
  }
19938
20049
  }
19939
- /** Places a box at the current fill position (sets its `yPx`) and advances by `advancePx`. */
19940
- place(box, advancePx) {
20050
+ /**
20051
+ * Places a box at the current fill position (sets its `yPx`) and advances by `advancePx`. The box
20052
+ * sits `offsetPx` below the fill position when the advance starts with space above it.
20053
+ */
20054
+ place(box, advancePx, offsetPx = 0) {
19941
20055
  if (this.page.sectionIndex !== this.sectionIndex && !this.page.sectionIndices?.includes(this.sectionIndex)) {
19942
20056
  (this.page.sectionIndices ??= [this.page.sectionIndex]).push(this.sectionIndex);
19943
20057
  this.pageInSection = 1;
19944
20058
  }
19945
- box.yPx = this.yPx;
20059
+ box.yPx = this.yPx + offsetPx;
19946
20060
  this.column.blocks.push(box);
19947
20061
  this.yPx += advancePx;
19948
20062
  const bodyBottom = this.legacyFootnoteColumns ? this.yPx : Math.max(
@@ -19962,7 +20076,10 @@ var PageCursor = class {
19962
20076
 
19963
20077
  // docx/layout/flow-paragraph.ts
19964
20078
  function placeParagraph(cursor, placement, note) {
19965
- const { paragraph, spacingBeforePx, requiredTogetherPx, reflow } = placement;
20079
+ const { paragraph, requiredTogetherPx, reflow } = placement;
20080
+ const spacingAfterPx = placement.spacingAfterPx ?? placement.layout.spacingAfterPx;
20081
+ const dropsSpaceBefore = () => cursor.atContinuationTop && !(paragraph.pageBreakBefore && placement.keepSpaceBeforePageBreak);
20082
+ let spacingBeforePx = dropsSpaceBefore() ? 0 : placement.spacingBeforePx;
19966
20083
  const trailingBreakLine = (result) => {
19967
20084
  const last = result.lines.at(-1);
19968
20085
  if (!placement.trimLeadingColumnBreak || !last || !result.columnBreakAfterLine.has(result.lines.length - 1))
@@ -19996,6 +20113,7 @@ function placeParagraph(cursor, placement, note) {
19996
20113
  if (requiredTogetherPx > 0 && requiredTogetherPx <= cursor.columnHeightPx && requiredTogetherPx > cursor.remainingHeightPx() && !cursor.atColumnTop) {
19997
20114
  cursor.newColumn();
19998
20115
  }
20116
+ if (dropsSpaceBefore()) spacingBeforePx = 0;
19999
20117
  const widow = widowControlEnabled(paragraph.widowControl);
20000
20118
  let lineCursor = 0;
20001
20119
  let nextToken = 0;
@@ -20024,7 +20142,8 @@ function placeParagraph(cursor, placement, note) {
20024
20142
  if (!layout.lines.length) {
20025
20143
  cursor.place(
20026
20144
  { kind: "paragraph", blockId: paragraph.id, yPx: 0, heightPx: 0, lines: [] },
20027
- spacingBeforePx + layout.spacingAfterPx
20145
+ spacingBeforePx + spacingAfterPx,
20146
+ spacingBeforePx
20028
20147
  );
20029
20148
  return;
20030
20149
  }
@@ -20068,6 +20187,7 @@ function placeParagraph(cursor, placement, note) {
20068
20187
  if (placedCount === 0) {
20069
20188
  if (!cursor.atColumnTop) {
20070
20189
  cursor.newColumn();
20190
+ if (firstSegment && dropsSpaceBefore()) spacingBeforePx = 0;
20071
20191
  continue;
20072
20192
  }
20073
20193
  note(
@@ -20098,8 +20218,8 @@ function placeParagraph(cursor, placement, note) {
20098
20218
  lines: segmentLines,
20099
20219
  ...layout.frame ? { frame: layout.frame } : {}
20100
20220
  };
20101
- const advance = (firstSegment ? spacingBeforePx : 0) + segmentHeight + (isFinal ? layout.spacingAfterPx : 0);
20102
- cursor.place(box, advance);
20221
+ const advance = (firstSegment ? spacingBeforePx : 0) + segmentHeight + (isFinal ? spacingAfterPx : 0);
20222
+ cursor.place(box, advance, firstSegment ? spacingBeforePx : 0);
20103
20223
  for (const item of committedNotes) placedNotes.add(item.id);
20104
20224
  nextToken = layout.lines[lineCursor + placedCount - 1]?.nextToken ?? nextToken;
20105
20225
  lineCursor += placedCount;
@@ -20505,6 +20625,61 @@ var TableFootnotes = class {
20505
20625
  }
20506
20626
  };
20507
20627
 
20628
+ // docx/layout/table-merged-rows.ts
20629
+ var MergedRowPlan = class {
20630
+ constructor(rows2) {
20631
+ this.rows = rows2;
20632
+ }
20633
+ rows;
20634
+ legacy = /* @__PURE__ */ new Set();
20635
+ minimum = /* @__PURE__ */ new Map();
20636
+ cache = /* @__PURE__ */ new Map();
20637
+ apply(source) {
20638
+ const minimum = this.minimum.get(source);
20639
+ if (minimum === void 0 && !this.legacy.has(source)) return source;
20640
+ return {
20641
+ ...source,
20642
+ ...minimum === void 0 ? {} : { heightPx: minimum, heightRule: "atLeast" },
20643
+ ...this.legacy.has(source) ? { mergedTextInRow: true } : {}
20644
+ };
20645
+ }
20646
+ /** The row to lay out and place (the source row itself when the plan leaves it alone). */
20647
+ effective(source) {
20648
+ let row2 = this.cache.get(source);
20649
+ if (!row2) {
20650
+ row2 = this.apply(source);
20651
+ this.cache.set(source, row2);
20652
+ }
20653
+ return row2;
20654
+ }
20655
+ /** Plans the rows a merge starting at `index` covers, given the room left for them. */
20656
+ plan(index, layout, availablePx) {
20657
+ const start = this.rows[index];
20658
+ const spans = start?.cells.map((cell) => cell.rowSpan ?? 1) ?? [];
20659
+ const longest = Math.max(1, ...spans);
20660
+ if (!start || longest < 2) return;
20661
+ const covered = this.rows.slice(index, index + longest);
20662
+ const natural = covered.map((row2) => layout(this.apply(row2)));
20663
+ const heights = natural.map((item) => item.heightPx);
20664
+ spans.forEach((span, cell) => {
20665
+ if (span < 2) return;
20666
+ const count = Math.min(span, covered.length);
20667
+ const need = (natural[0]?.geometry[cell]?.contentHeightPx ?? 0) + (natural[count - 1]?.borderBottomPx ?? 0);
20668
+ const have = heights.slice(0, count).reduce((sum, h) => sum + h, 0);
20669
+ if (need > have) heights[count - 1] = (heights[count - 1] ?? 0) + need - have;
20670
+ });
20671
+ if (heights.reduce((sum, h) => sum + h, 0) > availablePx) {
20672
+ this.legacy.add(start);
20673
+ return;
20674
+ }
20675
+ covered.forEach((row2, at) => {
20676
+ const grown = heights[at] - natural[at].heightPx;
20677
+ if (grown > 1e-6 && row2.heightRule !== "exact")
20678
+ this.minimum.set(row2, heights[at] - (natural[at].borderBottomPx ?? 0));
20679
+ });
20680
+ }
20681
+ };
20682
+
20508
20683
  // docx/layout/flow-table.ts
20509
20684
  function placeTable(cursor, table, measurer, note, resolveFootnotes) {
20510
20685
  const firstBodyRow = table.rows.findIndex((row2) => !row2.isHeader);
@@ -20519,7 +20694,7 @@ function placeTable(cursor, table, measurer, note, resolveFootnotes) {
20519
20694
  const width = (table.widthPx ?? cursor.columnWidthPx) + (activeBorders ? (profile.leftPx + profile.rightPx) / 2 : 0);
20520
20695
  return table.alignment === "center" ? Math.max(0, (cursor.columnWidthPx - width) / 2) : table.alignment === "right" ? Math.max(0, cursor.columnWidthPx - width) : table.indentPx ?? 0;
20521
20696
  };
20522
- const profile = nestedFrameProfile(table, table.widthPx ?? cursor.columnWidthPx);
20697
+ const profile = nestedFrameProfile(table, table.widthPx ?? cursor.columnWidthPx, true);
20523
20698
  const activeBorders = profile !== void 0 && (profile.leftPx > 0 || profile.rightPx > 0 || profile.bottomPx > 0);
20524
20699
  if (!profile && table.rows.some((row2) => row2.cells.some((cell) => cell.borders)))
20525
20700
  note(
@@ -20555,6 +20730,7 @@ function placeTable(cursor, table, measurer, note, resolveFootnotes) {
20555
20730
  };
20556
20731
  function flushFragment() {
20557
20732
  fragmentHeight += fragmentBorders.restore(fragmentRows.at(-1));
20733
+ alignMergedCells(fragmentRows);
20558
20734
  if (!fragmentRows.length) {
20559
20735
  footnotes?.holdFragment();
20560
20736
  return;
@@ -20731,7 +20907,16 @@ function placeTable(cursor, table, measurer, note, resolveFootnotes) {
20731
20907
  ) : after;
20732
20908
  }
20733
20909
  }
20734
- for (const row2 of table.rows) {
20910
+ const merged = new MergedRowPlan(table.rows);
20911
+ for (const [index, source] of table.rows.entries()) {
20912
+ merged.plan(
20913
+ index,
20914
+ (candidate) => layoutRow2(candidate, cursor.columnWidthPx, measurer, () => {
20915
+ }, void 0, source),
20916
+ cursor.remainingHeightPx() - fragmentHeight
20917
+ );
20918
+ const row2 = merged.effective(source);
20919
+ if (row2 !== source) nativeFragments.set(row2, nativeFragments.get(source) ?? false);
20735
20920
  const layout = layoutRow2(row2, cursor.columnWidthPx, measurer, note);
20736
20921
  if (layout.heightPx > cursor.remainingHeightPx() && !nativeFragments.get(row2) && row2.cells.some(
20737
20922
  (cell) => cell.blocks?.some((block) => block.kind === "table" && block.rows.length > 1)
@@ -20748,11 +20933,23 @@ function placeTable(cursor, table, measurer, note, resolveFootnotes) {
20748
20933
  placeRow(
20749
20934
  row2,
20750
20935
  layout,
20751
- Boolean(row2.cantSplit) || headerRows.includes(row2) || !!footnotes && row2.heightRule === "exact"
20936
+ Boolean(row2.cantSplit) || headerRows.includes(source) || !!footnotes && row2.heightRule === "exact"
20752
20937
  );
20753
20938
  }
20754
20939
  flushFragment();
20755
20940
  }
20941
+ function alignMergedCells(rows2) {
20942
+ rows2.forEach((row2, index) => {
20943
+ for (const geometry of row2.geometry ?? []) {
20944
+ const count = geometry.mergeRows ?? 1;
20945
+ if (count < 2 || !geometry.verticalAlign || geometry.verticalAlign === "top") continue;
20946
+ const last = rows2[index + count - 1];
20947
+ if (!last || rows2.slice(index, index + count).some((item) => item.repeated !== row2.repeated))
20948
+ continue;
20949
+ geometry.alignmentHeightPx = last.yPx + last.heightPx - row2.yPx;
20950
+ }
20951
+ });
20952
+ }
20756
20953
 
20757
20954
  // docx/layout/reference-footnotes.ts
20758
20955
  function createReferenceFootnotes(width, measurer, report) {
@@ -20787,7 +20984,8 @@ function wrapExclusions(pages) {
20787
20984
  yPx: float.yPx,
20788
20985
  widthPx: float.widthPx + SIDE_DISTANCE_PX * 2,
20789
20986
  heightPx: float.heightPx,
20790
- topAndBottom: float.wrap === "topAndBottom"
20987
+ topAndBottom: float.wrap === "topAndBottom",
20988
+ ...float.wrapText === "bothSides" ? { bothSides: true } : {}
20791
20989
  }));
20792
20990
  if (list.length) exclusions.set(page.index, list);
20793
20991
  }
@@ -20808,6 +21006,7 @@ function lineBoxesFor(exclusions, topPx, columnLeftPx, columnWidthPx) {
20808
21006
  let leftInsetPx = 0;
20809
21007
  let rightInsetPx = 0;
20810
21008
  let gapBeforePx = 0;
21009
+ const shared = [];
20811
21010
  for (const exclusion of exclusions) {
20812
21011
  const overlapsLine = exclusion.yPx < top + heightPx && exclusion.yPx + exclusion.heightPx > top;
20813
21012
  const start = exclusion.xPx - columnLeftPx;
@@ -20819,10 +21018,26 @@ function lineBoxesFor(exclusions, topPx, columnLeftPx, columnWidthPx) {
20819
21018
  gapBeforePx = Math.max(gapBeforePx, exclusion.yPx + exclusion.heightPx - top);
20820
21019
  continue;
20821
21020
  }
21021
+ if (exclusion.bothSides && Math.min(left, right) >= MIN_SIDE_WIDTH_PX) {
21022
+ shared.push({ start, end });
21023
+ continue;
21024
+ }
20822
21025
  if (left >= right) rightInsetPx = Math.max(rightInsetPx, columnWidthPx - start);
20823
21026
  else leftInsetPx = Math.max(leftInsetPx, end);
20824
21027
  }
20825
- return { leftInsetPx, rightInsetPx, gapBeforePx };
21028
+ const single = shared.length === 1 && !leftInsetPx && !rightInsetPx ? shared[0] : void 0;
21029
+ if (!single)
21030
+ for (const { start, end } of shared) {
21031
+ if (start >= columnWidthPx - end)
21032
+ rightInsetPx = Math.max(rightInsetPx, columnWidthPx - start);
21033
+ else leftInsetPx = Math.max(leftInsetPx, end);
21034
+ }
21035
+ return {
21036
+ leftInsetPx,
21037
+ rightInsetPx,
21038
+ gapBeforePx,
21039
+ ...single ? { hole: { startPx: single.start, endPx: single.end } } : {}
21040
+ };
20826
21041
  };
20827
21042
  }
20828
21043
 
@@ -20984,8 +21199,18 @@ var SectionFlow = class {
20984
21199
  if (block?.kind !== "paragraph") return 0;
20985
21200
  const layout = this.paragraphLayout(index);
20986
21201
  const previous = index > 0 ? this.blocks[index - 1] : void 0;
20987
- if (previous?.kind === "paragraph" && suppressesSpacing(previous, block)) return 0;
20988
- return layout.spacingBeforePx;
21202
+ if (index === 0 && !this.section.addParagraphSpacing)
21203
+ return Math.max(0, layout.spacingBeforePx - (this.section.leadingSpacingAfterPx ?? 0));
21204
+ if (previous?.kind !== "paragraph") return layout.spacingBeforePx;
21205
+ if (suppressesSpacing(previous, block)) return 0;
21206
+ if (this.section.addParagraphSpacing) return layout.spacingBeforePx;
21207
+ return Math.max(0, layout.spacingBeforePx - this.paragraphLayout(index - 1).spacingAfterPx);
21208
+ }
21209
+ /** Contextual spacing: no space after a paragraph that is followed by one of its own style. */
21210
+ spacingAfterSuppressed(index) {
21211
+ const block = this.blocks[index];
21212
+ const next = this.blocks[index + 1];
21213
+ return block?.kind === "paragraph" && next?.kind === "paragraph" && suppressesSpacing(block, next);
20989
21214
  }
20990
21215
  /** Minimum height that must fit before `index` may start, walking a `keepNext` chain. */
20991
21216
  requiredKeepHeight(index, depth = 0) {
@@ -21057,6 +21282,8 @@ var SectionFlow = class {
21057
21282
  layout,
21058
21283
  footnotes,
21059
21284
  spacingBeforePx,
21285
+ ...this.section.keepSpaceBeforePageBreak ? { keepSpaceBeforePageBreak: true } : {},
21286
+ ...this.spacingAfterSuppressed(index) ? { spacingAfterPx: 0 } : {},
21060
21287
  ...this.section.modernFootnoteSeparator || this.section.legacyFootnoteColumns ? { trimLeadingColumnBreak: true } : {},
21061
21288
  requiredTogetherPx,
21062
21289
  reflow: (token) => layoutParagraph(
@@ -21586,7 +21813,8 @@ function paragraphFloats(paragraph, theme) {
21586
21813
  ...placement?.alignV ? { alignV: placement.alignV } : {},
21587
21814
  ...placement?.offsetYPx !== void 0 ? { offsetYPx: placement.offsetYPx } : {},
21588
21815
  ...placement?.behindText ? { behindText: true } : {},
21589
- ...placement?.wrap ? { wrap: placement.wrap } : {}
21816
+ ...placement?.wrap ? { wrap: placement.wrap } : {},
21817
+ ...placement?.wrapText ? { wrapText: placement.wrapText } : {}
21590
21818
  });
21591
21819
  }
21592
21820
  return floats;
@@ -22414,17 +22642,17 @@ function glyph(text2, size, stretch = 1) {
22414
22642
  return box;
22415
22643
  }
22416
22644
  function scripts(base, sub, sup, style) {
22417
- const raise = Math.max(style.size * 0.4, base.ascent - style.size * 0.3);
22418
- const drop = Math.max(style.size * 0.2, base.descent + style.size * 0.12);
22645
+ const raise = Math.max(style.size * 0.36, base.ascent - style.size * 0.42);
22646
+ const drop = Math.max(style.size * 0.15, base.descent - style.size * 0.07);
22419
22647
  const parts = [{ box: base, x: 0, y: 0 }];
22420
22648
  let width = base.width;
22421
22649
  if (sup) {
22422
- const y = -Math.max(raise, sup.descent + style.size * 0.25);
22650
+ const y = -Math.max(raise, sup.descent + style.size * 0.2);
22423
22651
  parts.push({ box: sup, x: base.width + 1, y });
22424
22652
  width = Math.max(width, base.width + 1 + sup.width);
22425
22653
  }
22426
22654
  if (sub) {
22427
- const y = Math.max(drop, sub.ascent - style.size * 0.1);
22655
+ const y = Math.max(drop, sub.ascent - style.size * 0.4);
22428
22656
  parts.push({ box: sub, x: base.width + 1, y });
22429
22657
  width = Math.max(width, base.width + 1 + sub.width);
22430
22658
  }
@@ -22440,8 +22668,8 @@ function nary(node, style, ctx) {
22440
22668
  const chr = val(child(pr, "m:chr")) || "\u222B";
22441
22669
  const big = NARY.has(chr) ? 1.4 : 1.6;
22442
22670
  const op = glyph(chr, style.size * big);
22443
- op.ascent = style.size * 0.78 * (big > 1.5 ? 1.5 : 1.25);
22444
- op.descent = style.size * (big > 1.5 ? 0.55 : 0.4);
22671
+ op.ascent = style.size * (big > 1.5 ? 1.17 : 1.15);
22672
+ op.descent = style.size * (big > 1.5 ? 0.55 : 0.6);
22445
22673
  const limits = (val(child(pr, "m:limLoc")) || (NARY.has(chr) ? "undOvr" : "subSup")) === "undOvr";
22446
22674
  const sub = isOn2(val(child(pr, "m:subHide"))) ? void 0 : ctx.layout(child(node, "m:sub"), ctx.script(style));
22447
22675
  const sup = isOn2(val(child(pr, "m:supHide"))) ? void 0 : ctx.layout(child(node, "m:sup"), ctx.script(style));
@@ -22455,13 +22683,13 @@ function nary(node, style, ctx) {
22455
22683
  parts.push({
22456
22684
  box: sup,
22457
22685
  x: (width - sup.width) / 2,
22458
- y: -(op.ascent + sup.descent + style.size * 0.05)
22686
+ y: -(op.ascent + sup.descent + style.size * 0.075)
22459
22687
  });
22460
22688
  if (hasSub)
22461
22689
  parts.push({
22462
22690
  box: sub,
22463
22691
  x: (width - sub.width) / 2,
22464
- y: op.descent + sub.ascent + style.size * 0.05
22692
+ y: op.descent + sub.ascent + style.size * 0.075
22465
22693
  });
22466
22694
  head = overlay(parts);
22467
22695
  head.width = width;
@@ -22507,7 +22735,7 @@ function matrix(node, style, ctx) {
22507
22735
  (_, c) => Math.max(0, ...rows2.map((cells) => cells[c]?.width ?? 0))
22508
22736
  );
22509
22737
  const gapX = style.size * 0.8;
22510
- const gapY = style.size * 0.3;
22738
+ const gapY = 0;
22511
22739
  const result = emptyBox();
22512
22740
  let y = 0;
22513
22741
  const heights = rows2.map((cells) => ({
@@ -22557,15 +22785,15 @@ function below(base, mark, style) {
22557
22785
  // math/omml-box-structures.ts
22558
22786
  function fraction(node, style, ctx) {
22559
22787
  const type = val(child(child(node, "m:fPr"), "m:type"));
22560
- const inner = ctx.script({ ...style, level: Math.min(style.level, 0) });
22561
- const small = style.level === 0 ? { ...style, size: style.size * 0.9 } : inner;
22788
+ const inner = ctx.script({ ...style, level: Math.min(style.level, 0), display: false });
22789
+ const small = style.level === 0 && style.display ? { ...style, display: false } : inner;
22562
22790
  const num = ctx.layout(child(node, "m:num"), small);
22563
22791
  const den = ctx.layout(child(node, "m:den"), small);
22564
22792
  if (type === "lin") {
22565
22793
  const slash = glyph("/", style.size);
22566
22794
  return row([num, slash, den]);
22567
22795
  }
22568
- const gap = style.size * 0.12;
22796
+ const gap = style.size * 0.15;
22569
22797
  const axis = style.size * AXIS;
22570
22798
  const width = Math.max(num.width, den.width) + style.size * 0.2;
22571
22799
  const bar = type === "noBar" ? [] : [
@@ -22590,9 +22818,9 @@ function radical(node, style, ctx) {
22590
22818
  const content = ctx.layout(child(node, "m:e"), style);
22591
22819
  const hide = isOn2(val(child(child(node, "m:radPr"), "m:degHide")));
22592
22820
  const degree = hide ? void 0 : ctx.layout(child(node, "m:deg"), { ...ctx.script(ctx.script(style)) });
22593
- const gap = style.size * 0.12;
22821
+ const gap = style.size * 0.2;
22594
22822
  const top = -(content.ascent + gap);
22595
- const bottom = content.descent + style.size * 0.05;
22823
+ const bottom = content.descent + style.size * 0.15;
22596
22824
  const height = bottom - top;
22597
22825
  const sign = style.size * 0.55;
22598
22826
  const lead = degree && degree.width ? Math.max(0, degree.width - sign * 0.4) : 0;
@@ -22793,11 +23021,11 @@ function layoutElement(tag, node, style, atStart) {
22793
23021
  if (/Pr$/.test(tag) || tag === "m:ctrlPr") return emptyBox();
22794
23022
  return layoutStructure(tag, node, style, { layout: layoutChildren, script: scriptStyle });
22795
23023
  }
22796
- function layoutEquation(root, sizePx) {
22797
- const box = layoutChildren(root, { level: 0, size: sizePx });
23024
+ function layoutEquation(root, sizePx, options2 = {}) {
23025
+ const box = layoutChildren(root, { level: 0, size: sizePx, display: Boolean(options2.display) });
22798
23026
  const pad2 = 1;
22799
- const ascent = Math.max(box.ascent, sizePx * 0.78) + pad2;
22800
- const descent = Math.max(box.descent, sizePx * 0.22) + pad2;
23027
+ const ascent = Math.max(box.ascent, sizePx * 0.9);
23028
+ const descent = Math.max(box.descent, sizePx * 0.24);
22801
23029
  return {
22802
23030
  box: { ...box, prims: shifted(box.prims, pad2, 0), ascent, descent },
22803
23031
  widthPx: round2(Math.max(box.width, sizePx * 0.5) + pad2 * 2),
@@ -22856,17 +23084,17 @@ function primMarkup(prim) {
22856
23084
  return `<path d="${prim.d}" fill="none" stroke="currentColor" stroke-width="${round2(prim.width)}" stroke-linejoin="round"/>`;
22857
23085
  }
22858
23086
  }
22859
- function drawOmmlTree(root, sizePx, label = "") {
22860
- const { box, widthPx, heightPx, descentPx } = layoutEquation(root, sizePx);
23087
+ function drawOmmlTree(root, sizePx, label = "", options2 = {}) {
23088
+ const { box, widthPx, heightPx, descentPx } = layoutEquation(root, sizePx, options2);
22861
23089
  if (!box.prims.length) return void 0;
22862
23090
  const body = box.prims.map(primMarkup).join("");
22863
23091
  const aria = label ? ` aria-label="${escapeXml2(label).replace(/"/g, "&quot;")}"` : "";
22864
23092
  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>`;
22865
23093
  return { svg, widthPx, heightPx, descentPx };
22866
23094
  }
22867
- function drawEquation(omml, sizePx, label = "") {
23095
+ function drawEquation(omml, sizePx, label = "", options2 = {}) {
22868
23096
  try {
22869
- return drawOmmlTree(parseOmml(omml), sizePx, label);
23097
+ return drawOmmlTree(parseOmml(omml), sizePx, label, options2);
22870
23098
  } catch {
22871
23099
  return void 0;
22872
23100
  }
@@ -22882,11 +23110,11 @@ function latexLabel(omml) {
22882
23110
  return "Equation";
22883
23111
  }
22884
23112
  }
22885
- function equationObject(omml, sizePx) {
22886
- const key = `${sizePx}|${omml}`;
23113
+ function equationObject(omml, sizePx, display = false) {
23114
+ const key = `${sizePx}|${display}|${omml}`;
22887
23115
  const hit = cache.get(key);
22888
23116
  if (hit !== void 0) return hit ?? void 0;
22889
- const drawing = drawEquation(omml, sizePx, latexLabel(omml));
23117
+ const drawing = drawEquation(omml, sizePx, latexLabel(omml), { display });
22890
23118
  const object = drawing ? {
22891
23119
  partName: "",
22892
23120
  contentType: "",
@@ -22944,6 +23172,7 @@ function adaptTable(table, model, adaptParagraph, _nested = false) {
22944
23172
  return start;
22945
23173
  });
22946
23174
  });
23175
+ const merges = tableGrid(table);
22947
23176
  const cellAt = (rowIndex, gridIndex) => {
22948
23177
  const position = gridIndexes[rowIndex]?.indexOf(gridIndex) ?? -1;
22949
23178
  return position >= 0 ? table.rows[rowIndex]?.[position] : void 0;
@@ -22989,10 +23218,13 @@ function adaptTable(table, model, adaptParagraph, _nested = false) {
22989
23218
  const width = gridWidth(start, span) ?? (cell.widthTwips ? twipsToPx2(cell.widthTwips) : void 0);
22990
23219
  const xPx = grid ? gridWidth(0, start) : void 0;
22991
23220
  const fill = cssHex(visuals.shadingFill);
23221
+ const entry = merges?.rows[rowIndex]?.[cellIndex];
23222
+ const rowSpan = merges && entry ? rowSpanOf(merges, entry) : 1;
22992
23223
  return {
22993
23224
  paragraphs: cell.paragraphs.map(adaptParagraph),
22994
23225
  ...cell.gridSpan !== void 0 ? { gridSpan: cell.gridSpan } : {},
22995
23226
  ...cell.verticalMerge ? { verticalMerge: cell.verticalMerge } : {},
23227
+ ...rowSpan > 1 ? { rowSpan } : {},
22996
23228
  ...cell.sourceBlocks ? {
22997
23229
  blocks: cellSourceBlocks(cell).map(
22998
23230
  (block) => block.type === "paragraph" ? adaptParagraph(block) : adaptTable(block, model, adaptParagraph, true)
@@ -23120,6 +23352,7 @@ var TEXT_BOX_NOTE = "Text boxes are shown on the editing surface but are not dra
23120
23352
  var EQUATION_NOTE = "Equations that cannot be drawn show a marker in Print Layout instead of the typeset equation.";
23121
23353
  var NEXT_COLUMN_NOTE = 'A "next column" section break is laid out as a continuous section break.';
23122
23354
  var twipsToPx3 = twipsToPixels;
23355
+ var HTML_AUTO_SPACING_TWIPS = twips(280);
23123
23356
  function isDisplayEquationParagraph(paragraph) {
23124
23357
  return paragraph.runs.some((run) => run.equation?.display) && paragraph.runs.every((run) => run.equation?.display || !run.text && !run.image);
23125
23358
  }
@@ -23139,6 +23372,9 @@ function adaptDocumentModel(model, note = () => {
23139
23372
  const reviewMode = options2.reviewDisplayMode ?? "all";
23140
23373
  const visibleModel = visibleReviewModel(model, reviewMode);
23141
23374
  const catalog = model.paragraphStyles;
23375
+ const addParagraphSpacing = model.doNotUseHtmlParagraphAutoSpacing === true;
23376
+ const keepSpaceBeforePageBreak = model.compatibilityMode !== 15;
23377
+ const autoSpaced = (auto, twipsValue) => auto && !addParagraphSpacing ? HTML_AUTO_SPACING_TWIPS : twipsValue;
23142
23378
  const noted = /* @__PURE__ */ new Set();
23143
23379
  const reportOnce = (message) => {
23144
23380
  if (!noted.has(message)) {
@@ -23164,7 +23400,11 @@ function adaptDocumentModel(model, note = () => {
23164
23400
  if (isRunHiddenForReview(run, reviewMode))
23165
23401
  return { text: run.text, hidden: true, sourceLength: reviewSourceLength(run) };
23166
23402
  const { formatting, family, color } = effective(run, paragraphStyleId);
23167
- const equation = run.equation ? equationObject(run.equation.omml, ptToPx(formatting.fontSize ?? DEFAULT_FONT_SIZE_PT)) : void 0;
23403
+ const equation = run.equation ? equationObject(
23404
+ run.equation.omml,
23405
+ ptToPx(formatting.fontSize ?? DEFAULT_FONT_SIZE_PT),
23406
+ Boolean(run.equation.display)
23407
+ ) : void 0;
23168
23408
  if (run.equation && !equation) reportOnce(EQUATION_NOTE);
23169
23409
  const name = run.field ? fieldName(run.field.instr) : "";
23170
23410
  const noteText = run.noteReference ? noteLabel(run.noteReference.kind, run.noteReference.id) : run.noteMark ? markLabel ?? "" : void 0;
@@ -23245,7 +23485,9 @@ function adaptDocumentModel(model, note = () => {
23245
23485
  function adaptParagraphOnly(paragraph, markLabel) {
23246
23486
  const resolved = catalog ? resolveParagraphFormatting(paragraph, catalog) : paragraph;
23247
23487
  const label = labels.get(paragraph.id);
23248
- const ownFirstLine = resolved.firstLineTwips !== void 0 || resolved.hangingTwips !== void 0;
23488
+ const levelWins = Boolean(label && paragraph.numbering);
23489
+ const indents = levelWins ? paragraph : resolved;
23490
+ const ownFirstLine = indents.firstLineTwips !== void 0 || indents.hangingTwips !== void 0;
23249
23491
  const runs = paragraph.runs.flatMap(
23250
23492
  (run) => symbolSegments(run).flatMap((segment2) => {
23251
23493
  const adapted = adaptRun(segment2, paragraph.style, markLabel);
@@ -23277,16 +23519,16 @@ function adaptDocumentModel(model, note = () => {
23277
23519
  ...definedProps({
23278
23520
  align: resolved.align ?? (isDisplayEquationParagraph(paragraph) ? "center" : void 0),
23279
23521
  direction: resolved.direction,
23280
- spacingBeforeTwips: resolved.spacingBeforeTwips,
23281
- spacingAfterTwips: resolved.spacingAfterTwips,
23522
+ spacingBeforeTwips: autoSpaced(resolved.spacingBeforeAuto, resolved.spacingBeforeTwips),
23523
+ spacingAfterTwips: autoSpaced(resolved.spacingAfterAuto, resolved.spacingAfterTwips),
23282
23524
  lineSpacingTwips: resolved.lineSpacingTwips,
23283
23525
  lineSpacingRule: resolved.lineSpacingRule,
23284
- indentLeftTwips: resolved.indentLeftTwips ?? label?.indentLeftTwips,
23526
+ indentLeftTwips: indents.indentLeftTwips ?? label?.indentLeftTwips ?? (levelWins ? resolved.indentLeftTwips : void 0),
23285
23527
  indentRightTwips: resolved.indentRightTwips,
23286
23528
  indentStartTwips: resolved.indentStartTwips,
23287
23529
  indentEndTwips: resolved.indentEndTwips,
23288
- firstLineTwips: ownFirstLine ? resolved.firstLineTwips : label?.firstLineTwips,
23289
- hangingTwips: ownFirstLine ? resolved.hangingTwips : label?.hangingTwips,
23530
+ firstLineTwips: ownFirstLine ? indents.firstLineTwips : label?.firstLineTwips,
23531
+ hangingTwips: ownFirstLine ? indents.hangingTwips : label?.hangingTwips,
23290
23532
  styleId: paragraph.style
23291
23533
  }),
23292
23534
  ...resolved.pageBreakBefore ? { pageBreakBefore: true } : {},
@@ -23345,6 +23587,8 @@ function adaptDocumentModel(model, note = () => {
23345
23587
  marginLeftPx: model.page.marginLeft
23346
23588
  },
23347
23589
  ...footnoteSeparators ? { footnoteSeparators } : {},
23590
+ ...addParagraphSpacing ? { addParagraphSpacing: true } : {},
23591
+ ...keepSpaceBeforePageBreak ? { keepSpaceBeforePageBreak: true } : {},
23348
23592
  ...modernFootnoteSeparator ? { modernFootnoteSeparator: true } : {},
23349
23593
  ...legacyFootnoteColumns ? { legacyFootnoteColumns: true } : {},
23350
23594
  blocks: blocks.filter((block) => !folded.has(block))
@@ -23411,6 +23655,8 @@ function adaptDocumentModel(model, note = () => {
23411
23655
  } : {}
23412
23656
  }
23413
23657
  } : {},
23658
+ ...addParagraphSpacing ? { addParagraphSpacing: true } : {},
23659
+ ...keepSpaceBeforePageBreak ? { keepSpaceBeforePageBreak: true } : {},
23414
23660
  ...sectionStart && { break: sectionStart },
23415
23661
  ...section.verticalAlign ? { verticalAlign: section.verticalAlign } : {},
23416
23662
  // Empty text break markers share the preceding line. The mandatory
@@ -23423,11 +23669,17 @@ function adaptDocumentModel(model, note = () => {
23423
23669
  })
23424
23670
  };
23425
23671
  });
23426
- return { sections: result };
23672
+ return {
23673
+ sections: result.map((section, index) => {
23674
+ const last = result[index - 1]?.blocks.at(-1);
23675
+ const after = last?.kind === "paragraph" ? last.spacingAfterTwips : void 0;
23676
+ return !addParagraphSpacing && after ? { ...section, leadingSpacingAfterPx: twipsToPx3(after) } : section;
23677
+ })
23678
+ };
23427
23679
  }
23428
23680
 
23429
23681
  // docx/layout/floats.ts
23430
- 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.";
23682
+ 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.";
23431
23683
  function horizontalArea(float, page, column) {
23432
23684
  const contentLeft = page.marginLeftPx;
23433
23685
  switch (float.relativeFromH) {
@@ -23517,7 +23769,8 @@ function positionFloats(input, pages) {
23517
23769
  contentType: float.contentType,
23518
23770
  ...float.chart ? { chart: float.chart } : {},
23519
23771
  behindText: Boolean(float.behindText),
23520
- ...float.wrap ? { wrap: float.wrap } : {}
23772
+ ...float.wrap ? { wrap: float.wrap } : {},
23773
+ ...float.wrapText ? { wrapText: float.wrapText } : {}
23521
23774
  });
23522
23775
  }
23523
23776
  }