ooxml-core 1.29.0 → 1.30.1

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 (308) hide show
  1. package/dist/{PptxHandler-CZG6ISCZ.cjs → PptxHandler-DHQPVTUI.cjs} +3 -3
  2. package/dist/PptxHandler-E4DDV3FQ.mjs +4 -0
  3. package/dist/{PptxHandler-QIHYALOV.mjs → PptxHandler-KKLAYUGQ.mjs} +2 -2
  4. package/dist/{PresentationBuilder-66EU3N3O.cjs → PresentationBuilder-JORMF5CP.cjs} +5 -5
  5. package/dist/{PresentationBuilder-5YM2L7DA.mjs → PresentationBuilder-Q2Z33LLM.mjs} +2 -2
  6. package/dist/{PresentationBuilder-UAINQZA2.mjs → PresentationBuilder-YYZYCKTZ.mjs} +2 -2
  7. package/dist/automation/index.cjs +4250 -3145
  8. package/dist/automation/index.mjs +4250 -3145
  9. package/dist/chart/box-distribution.d.ts +10 -0
  10. package/dist/chart/box-distribution.d.ts.map +1 -0
  11. package/dist/chart/data-table-layout.d.ts +8 -0
  12. package/dist/chart/data-table-layout.d.ts.map +1 -0
  13. package/dist/chart/date-axis.d.ts +3 -0
  14. package/dist/chart/date-axis.d.ts.map +1 -0
  15. package/dist/chart/date-format.d.ts +39 -0
  16. package/dist/chart/date-format.d.ts.map +1 -0
  17. package/dist/chart/edit/chartex-action.d.ts.map +1 -1
  18. package/dist/chart/edit/chartex-axis.d.ts.map +1 -1
  19. package/dist/chart/edit/chartex-structure.d.ts.map +1 -1
  20. package/dist/chart/edit/chartex.d.ts +3 -1
  21. package/dist/chart/edit/chartex.d.ts.map +1 -1
  22. package/dist/chart/edit/draft.d.ts.map +1 -1
  23. package/dist/chart/funnel-geometry.d.ts +15 -0
  24. package/dist/chart/funnel-geometry.d.ts.map +1 -0
  25. package/dist/chart/index.cjs +1392 -404
  26. package/dist/chart/index.d.ts +6 -0
  27. package/dist/chart/index.d.ts.map +1 -1
  28. package/dist/chart/index.mjs +1379 -405
  29. package/dist/chart/line-path.d.ts +30 -0
  30. package/dist/chart/line-path.d.ts.map +1 -0
  31. package/dist/chart/manual-layout.d.ts +15 -0
  32. package/dist/chart/manual-layout.d.ts.map +1 -1
  33. package/dist/chart/render/chart-svg-analysis.d.ts +2 -0
  34. package/dist/chart/render/chart-svg-analysis.d.ts.map +1 -1
  35. package/dist/chart/render/chart-svg-bars.d.ts.map +1 -1
  36. package/dist/chart/render/chart-svg-box.d.ts +5 -0
  37. package/dist/chart/render/chart-svg-box.d.ts.map +1 -0
  38. package/dist/chart/render/chart-svg-cartesian.d.ts +3 -1
  39. package/dist/chart/render/chart-svg-cartesian.d.ts.map +1 -1
  40. package/dist/chart/render/chart-svg-data-table.d.ts +11 -0
  41. package/dist/chart/render/chart-svg-data-table.d.ts.map +1 -0
  42. package/dist/chart/render/chart-svg-date-axis.d.ts +9 -0
  43. package/dist/chart/render/chart-svg-date-axis.d.ts.map +1 -0
  44. package/dist/chart/render/chart-svg-funnel.d.ts +4 -0
  45. package/dist/chart/render/chart-svg-funnel.d.ts.map +1 -0
  46. package/dist/chart/render/chart-svg-labels.d.ts +16 -16
  47. package/dist/chart/render/chart-svg-labels.d.ts.map +1 -1
  48. package/dist/chart/render/chart-svg-line.d.ts +5 -0
  49. package/dist/chart/render/chart-svg-line.d.ts.map +1 -0
  50. package/dist/chart/render/chart-svg-plot-layout.d.ts +6 -0
  51. package/dist/chart/render/chart-svg-plot-layout.d.ts.map +1 -0
  52. package/dist/chart/render/chart-svg-plots.d.ts +2 -1
  53. package/dist/chart/render/chart-svg-plots.d.ts.map +1 -1
  54. package/dist/chart/render/chart-svg-radial.d.ts.map +1 -1
  55. package/dist/chart/render/chart-svg-slice-labels.d.ts +18 -0
  56. package/dist/chart/render/chart-svg-slice-labels.d.ts.map +1 -0
  57. package/dist/chart/render/chart-svg-xy.d.ts +2 -1
  58. package/dist/chart/render/chart-svg-xy.d.ts.map +1 -1
  59. package/dist/chart/render/chart-svg.d.ts.map +1 -1
  60. package/dist/chart/render/chart-title-text.d.ts +3 -1
  61. package/dist/chart/render/chart-title-text.d.ts.map +1 -1
  62. package/dist/chart/render/chart-view-analysis.d.ts +2 -1
  63. package/dist/chart/render/chart-view-analysis.d.ts.map +1 -1
  64. package/dist/chart/render/chart-view-data-table.d.ts +13 -0
  65. package/dist/chart/render/chart-view-data-table.d.ts.map +1 -0
  66. package/dist/chart/render/chart-view-labels.d.ts +6 -1
  67. package/dist/chart/render/chart-view-labels.d.ts.map +1 -1
  68. package/dist/chart/render/chart-view-series.d.ts.map +1 -1
  69. package/dist/chart/render/chart-view.d.ts +13 -0
  70. package/dist/chart/render/chart-view.d.ts.map +1 -1
  71. package/dist/chart/render/render-space.d.ts.map +1 -1
  72. package/dist/chart/render/summary-ex-series.d.ts +5 -0
  73. package/dist/chart/render/summary-ex-series.d.ts.map +1 -0
  74. package/dist/chart/render/summary-from-chartex.d.ts.map +1 -1
  75. package/dist/chart/render/summary-from-space.d.ts +1 -1
  76. package/dist/chart/render/summary-from-space.d.ts.map +1 -1
  77. package/dist/chart/render/summary-labels.d.ts.map +1 -1
  78. package/dist/chart/render/summary.d.ts +14 -1
  79. package/dist/chart/render/summary.d.ts.map +1 -1
  80. package/dist/{chunk-6C4NLBLB.mjs → chunk-6FXOAMNL.mjs} +1 -1
  81. package/dist/{chunk-T7HBA3CW.cjs → chunk-7T3SJQA6.cjs} +11 -9
  82. package/dist/{chunk-XROY25LN.cjs → chunk-7XYVFUB3.cjs} +4 -0
  83. package/dist/{chunk-I2CGNAP2.cjs → chunk-B4LXDHBX.cjs} +1409 -1389
  84. package/dist/{chunk-GUNTIFGT.cjs → chunk-CZXM4ZJH.cjs} +158 -26
  85. package/dist/{chunk-RYOJHYA3.mjs → chunk-DJ3CDTMX.mjs} +157 -27
  86. package/dist/{chunk-BBK3UB7M.mjs → chunk-FFJBOR2Y.mjs} +4 -4
  87. package/dist/{chunk-DWEQWFQU.mjs → chunk-GJDFCP2T.mjs} +248 -228
  88. package/dist/{chunk-KBER3RAP.mjs → chunk-KWJYMAEF.mjs} +248 -228
  89. package/dist/{chunk-XCRDAVFN.mjs → chunk-MKDONWNO.mjs} +237 -95
  90. package/dist/{chunk-3UMDVJRN.mjs → chunk-NBMXEVHL.mjs} +4 -1
  91. package/dist/{chunk-TVJL7QIG.cjs → chunk-OGEL4Z4S.cjs} +8 -1
  92. package/dist/{chunk-HRU3KOE5.mjs → chunk-OORQCSVA.mjs} +5 -3
  93. package/dist/{chunk-7RJYOVQU.mjs → chunk-R7NS42KQ.mjs} +5 -2
  94. package/dist/{chunk-DXOBT2JE.mjs → chunk-UZWV2HAJ.mjs} +8 -2
  95. package/dist/{chunk-PDZ4GQLI.mjs → chunk-WZJ25K7P.mjs} +1 -1
  96. package/dist/{chunk-IETFPVLN.cjs → chunk-XTUX5RMG.cjs} +15 -12
  97. package/dist/diagram/drawing.d.ts.map +1 -1
  98. package/dist/diagram/index.cjs +1218 -592
  99. package/dist/diagram/index.mjs +1218 -592
  100. package/dist/diagram/load.d.ts.map +1 -1
  101. package/dist/diagram/relationships.d.ts +1 -0
  102. package/dist/diagram/relationships.d.ts.map +1 -1
  103. package/dist/diagram/types.d.ts +2 -0
  104. package/dist/diagram/types.d.ts.map +1 -1
  105. package/dist/docx/diagram.d.ts.map +1 -1
  106. package/dist/docx/drawing.d.ts.map +1 -1
  107. package/dist/docx/embedded.cjs +1850 -1138
  108. package/dist/docx/embedded.mjs +1850 -1138
  109. package/dist/docx/index.cjs +3312 -1713
  110. package/dist/docx/index.mjs +3312 -1713
  111. package/dist/docx/layout/adapter.d.ts.map +1 -1
  112. package/dist/docx/layout/fonts.d.ts +1 -1
  113. package/dist/docx/layout/fonts.d.ts.map +1 -1
  114. package/dist/docx/layout/index.cjs +1933 -518
  115. package/dist/docx/layout/index.mjs +1933 -518
  116. package/dist/docx/layout/script-fonts.d.ts +6 -0
  117. package/dist/docx/layout/script-fonts.d.ts.map +1 -0
  118. package/dist/docx/load/index.cjs +1853 -1141
  119. package/dist/docx/load/index.mjs +1853 -1141
  120. package/dist/docx/parse.d.ts.map +1 -1
  121. package/dist/docx/shape-model.d.ts +2 -0
  122. package/dist/docx/shape-model.d.ts.map +1 -1
  123. package/dist/docx/shape-parse.d.ts.map +1 -1
  124. package/dist/docx/shape-svg.d.ts.map +1 -1
  125. package/dist/docx/ui/index.cjs +1763 -593
  126. package/dist/docx/ui/index.mjs +1763 -593
  127. package/dist/docx/write-shape.d.ts.map +1 -1
  128. package/dist/drawingml/custom-geometry.d.ts +5 -0
  129. package/dist/drawingml/custom-geometry.d.ts.map +1 -0
  130. package/dist/drawingml/drawing-fill.d.ts.map +1 -1
  131. package/dist/drawingml/drawing-geometry.d.ts.map +1 -1
  132. package/dist/drawingml/image-content-type.d.ts +2 -0
  133. package/dist/drawingml/image-content-type.d.ts.map +1 -0
  134. package/dist/drawingml/index.cjs +1128 -179
  135. package/dist/drawingml/index.d.ts +9 -0
  136. package/dist/drawingml/index.d.ts.map +1 -1
  137. package/dist/drawingml/index.mjs +1110 -180
  138. package/dist/drawingml/path-data.d.ts +4 -0
  139. package/dist/drawingml/path-data.d.ts.map +1 -0
  140. package/dist/drawingml/picture-crop.d.ts +8 -0
  141. package/dist/drawingml/picture-crop.d.ts.map +1 -0
  142. package/dist/drawingml/picture-effects.d.ts +37 -0
  143. package/dist/drawingml/picture-effects.d.ts.map +1 -0
  144. package/dist/drawingml/picture-fill.d.ts +7 -0
  145. package/dist/drawingml/picture-fill.d.ts.map +1 -0
  146. package/dist/drawingml/read-3d-values.d.ts +8 -0
  147. package/dist/drawingml/read-3d-values.d.ts.map +1 -0
  148. package/dist/drawingml/read-text-3d.d.ts +8 -0
  149. package/dist/drawingml/read-text-3d.d.ts.map +1 -0
  150. package/dist/drawingml/read-text-body.d.ts.map +1 -1
  151. package/dist/drawingml/scene3d-coordinate.d.ts +45 -0
  152. package/dist/drawingml/scene3d-coordinate.d.ts.map +1 -0
  153. package/dist/drawingml/scene3d-presets.d.ts +12 -0
  154. package/dist/drawingml/scene3d-presets.d.ts.map +1 -0
  155. package/dist/drawingml/text-3d-model.d.ts +71 -0
  156. package/dist/drawingml/text-3d-model.d.ts.map +1 -0
  157. package/dist/drawingml/text-model.d.ts +3 -0
  158. package/dist/drawingml/text-model.d.ts.map +1 -1
  159. package/dist/drawingml/types.d.ts +3 -0
  160. package/dist/drawingml/types.d.ts.map +1 -1
  161. package/dist/drawingml/write-pattern-picture.d.ts.map +1 -1
  162. package/dist/drawingml/write-text-3d.d.ts +6 -0
  163. package/dist/drawingml/write-text-3d.d.ts.map +1 -0
  164. package/dist/drawingml/write-text-body.d.ts.map +1 -1
  165. package/dist/geometry/element-transform.d.ts +3 -0
  166. package/dist/geometry/element-transform.d.ts.map +1 -1
  167. package/dist/geometry/index.cjs +69 -4
  168. package/dist/geometry/index.d.ts +2 -0
  169. package/dist/geometry/index.d.ts.map +1 -1
  170. package/dist/geometry/index.mjs +66 -5
  171. package/dist/geometry/picture-crop.d.ts +21 -0
  172. package/dist/geometry/picture-crop.d.ts.map +1 -0
  173. package/dist/geometry/resize-aspect.d.ts +12 -0
  174. package/dist/geometry/resize-aspect.d.ts.map +1 -0
  175. package/dist/index.cjs +4201 -2058
  176. package/dist/index.mjs +4201 -2058
  177. package/dist/opc/index.cjs +9 -6
  178. package/dist/opc/index.mjs +9 -6
  179. package/dist/opc/safe-href.d.ts +10 -3
  180. package/dist/opc/safe-href.d.ts.map +1 -1
  181. package/dist/pptx/automation/index.cjs +634 -361
  182. package/dist/pptx/automation/index.d.ts +6 -6
  183. package/dist/pptx/automation/index.mjs +5 -5
  184. package/dist/pptx/chunks/{elements-CCEghtE_.d.ts → elements-mSCZ84Tc.d.ts} +4 -4
  185. package/dist/pptx/chunks/elements-mSCZ84Tc.d.ts.map +1 -0
  186. package/dist/pptx/chunks/{index-D90lhgiE.d.ts → index-BQDcu_0a.d.ts} +19 -111
  187. package/dist/pptx/chunks/index-BQDcu_0a.d.ts.map +1 -0
  188. package/dist/pptx/chunks/{index-CmnbpSCL.d.ts → index-CBV1oHN7.d.ts} +5 -5
  189. package/dist/pptx/chunks/{index-CmnbpSCL.d.ts.map → index-CBV1oHN7.d.ts.map} +1 -1
  190. package/dist/pptx/chunks/{index-DJIPX0Ge.d.ts → index-PdM5zpmu.d.ts} +5 -5
  191. package/dist/pptx/chunks/{index-DJIPX0Ge.d.ts.map → index-PdM5zpmu.d.ts.map} +1 -1
  192. package/dist/pptx/chunks/{smart-art-BLBSej3J.d.ts → smart-art-DLumQo90.d.ts} +135 -103
  193. package/dist/pptx/chunks/smart-art-DLumQo90.d.ts.map +1 -0
  194. package/dist/pptx/chunks/{text-D49FKllA.d.ts → text-P9xVnXXf.d.ts} +49 -60
  195. package/dist/pptx/chunks/text-P9xVnXXf.d.ts.map +1 -0
  196. package/dist/pptx/chunks/{text-operations-DZ1IgDJN.d.ts → text-operations-hyPODwIQ.d.ts} +4 -4
  197. package/dist/pptx/chunks/{text-operations-DZ1IgDJN.d.ts.map → text-operations-hyPODwIQ.d.ts.map} +1 -1
  198. package/dist/pptx/cli/index.cjs +630 -357
  199. package/dist/pptx/cli/index.d.ts +1 -1
  200. package/dist/pptx/cli/index.mjs +4 -4
  201. package/dist/pptx/converter/index.cjs +102 -67
  202. package/dist/pptx/converter/index.d.ts +1 -1
  203. package/dist/pptx/converter/index.mjs +2 -2
  204. package/dist/pptx/editor/render/collaboration-assets.cjs +15 -11
  205. package/dist/pptx/editor/render/collaboration-assets.d.ts +2 -2
  206. package/dist/pptx/editor/render/collaboration-assets.mjs +1 -1
  207. package/dist/pptx/editor/render/collaboration-live-patch-target.cjs +5 -5
  208. package/dist/pptx/editor/render/collaboration-live-patch-target.mjs +3 -3
  209. package/dist/pptx/editor/render/collaboration-reconcile.cjs +9 -9
  210. package/dist/pptx/editor/render/collaboration-reconcile.d.ts.map +1 -1
  211. package/dist/pptx/editor/render/collaboration-reconcile.mjs +3 -3
  212. package/dist/pptx/editor/render/collaboration-sync.cjs +29 -25
  213. package/dist/pptx/editor/render/collaboration-sync.d.ts +7 -0
  214. package/dist/pptx/editor/render/collaboration-sync.d.ts.map +1 -1
  215. package/dist/pptx/editor/render/collaboration-sync.mjs +2 -2
  216. package/dist/pptx/editor/render/find-replace.cjs +14 -14
  217. package/dist/pptx/editor/render/find-replace.d.ts +2 -2
  218. package/dist/pptx/editor/render/find-replace.mjs +1 -1
  219. package/dist/pptx/editor/render/font-family-update.d.ts +1 -1
  220. package/dist/pptx/editor/render/paragraph-geometry-overrides.d.ts +1 -1
  221. package/dist/pptx/editor/render/slide-operations.cjs +8 -8
  222. package/dist/pptx/editor/render/slide-operations.mjs +2 -2
  223. package/dist/pptx/editor/render/table-cell-edit.cjs +8 -4
  224. package/dist/pptx/editor/render/table-cell-edit.d.ts +5 -0
  225. package/dist/pptx/editor/render/table-cell-edit.d.ts.map +1 -1
  226. package/dist/pptx/editor/render/table-cell-edit.mjs +1 -1
  227. package/dist/pptx/editor/render/table-cell-merge.cjs +3 -3
  228. package/dist/pptx/editor/render/table-cell-merge.mjs +1 -1
  229. package/dist/pptx/editor/render/table-data-grid-ops.cjs +2 -2
  230. package/dist/pptx/editor/render/table-data-grid-ops.mjs +1 -1
  231. package/dist/pptx/editor/render/table-merge.cjs +5 -5
  232. package/dist/pptx/editor/render/table-merge.mjs +1 -1
  233. package/dist/pptx/editor/render/text-content-style.d.ts +1 -1
  234. package/dist/pptx/editor/render/text-runs-style-patch.d.ts +2 -2
  235. package/dist/pptx/editor/render/text-style-scope.d.ts +2 -2
  236. package/dist/pptx/editor/render/update-text-segment-style.d.ts +1 -1
  237. package/dist/pptx/index.cjs +696 -419
  238. package/dist/pptx/index.d.ts +8 -8
  239. package/dist/pptx/index.mjs +5 -5
  240. package/dist/pptx/node/index.d.ts +1 -1
  241. package/dist/pptx/smartart-layouts/index.d.ts +1 -1
  242. package/dist/teams/index.cjs +1816 -1049
  243. package/dist/teams/index.mjs +1816 -1049
  244. package/dist/text/font-style-name.d.ts +11 -0
  245. package/dist/text/font-style-name.d.ts.map +1 -0
  246. package/dist/text/font-substitution-map.d.ts +3 -0
  247. package/dist/text/font-substitution-map.d.ts.map +1 -0
  248. package/dist/text/font-substitution.d.ts +34 -0
  249. package/dist/text/font-substitution.d.ts.map +1 -0
  250. package/dist/text/index.cjs +460 -0
  251. package/dist/text/index.d.ts +3 -0
  252. package/dist/text/index.d.ts.map +1 -1
  253. package/dist/text/index.mjs +443 -1
  254. package/dist/text/metric-font-family.d.ts +7 -0
  255. package/dist/text/metric-font-family.d.ts.map +1 -0
  256. package/dist/text/panose.d.ts +55 -0
  257. package/dist/text/panose.d.ts.map +1 -0
  258. package/dist/text/script-fonts.d.ts +26 -0
  259. package/dist/text/script-fonts.d.ts.map +1 -0
  260. package/dist/visio/edit-geometry-admission.d.ts +1 -1
  261. package/dist/visio/edit-geometry-admission.d.ts.map +1 -1
  262. package/dist/visio/edit-group-resize.d.ts +26 -0
  263. package/dist/visio/edit-group-resize.d.ts.map +1 -0
  264. package/dist/visio/edit-recalculate-index.d.ts +2 -0
  265. package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
  266. package/dist/visio/edit-resize-anchor.d.ts.map +1 -1
  267. package/dist/visio/edit-resize-plan.d.ts +14 -0
  268. package/dist/visio/edit-resize-plan.d.ts.map +1 -0
  269. package/dist/visio/edit-scope.d.ts.map +1 -1
  270. package/dist/visio/index.cjs +1326 -389
  271. package/dist/visio/index.mjs +1326 -389
  272. package/dist/visio/ui/geometry-expectation.d.ts +17 -0
  273. package/dist/visio/ui/geometry-expectation.d.ts.map +1 -0
  274. package/dist/visio/ui/guides.d.ts +2 -0
  275. package/dist/visio/ui/guides.d.ts.map +1 -1
  276. package/dist/visio/ui/index.cjs +1582 -411
  277. package/dist/visio/ui/index.d.ts +2 -0
  278. package/dist/visio/ui/index.d.ts.map +1 -1
  279. package/dist/visio/ui/index.mjs +1579 -412
  280. package/dist/visio/ui/selection-resize.d.ts +19 -0
  281. package/dist/visio/ui/selection-resize.d.ts.map +1 -0
  282. package/dist/visio/ui/shape-move.d.ts +1 -1
  283. package/dist/visio/ui/shape-move.d.ts.map +1 -1
  284. package/dist/visio/ui/shape-resize.d.ts.map +1 -1
  285. package/dist/xlsx/edit/drawings.d.ts +5 -0
  286. package/dist/xlsx/edit/drawings.d.ts.map +1 -1
  287. package/dist/xlsx/edit/session.d.ts.map +1 -1
  288. package/dist/xlsx/edit/types.d.ts +4 -0
  289. package/dist/xlsx/edit/types.d.ts.map +1 -1
  290. package/dist/xlsx/index.cjs +3908 -2256
  291. package/dist/xlsx/index.mjs +3908 -2256
  292. package/dist/xlsx/layout/chart-view.d.ts.map +1 -1
  293. package/dist/xlsx/load/index.cjs +2003 -1239
  294. package/dist/xlsx/load/index.mjs +2003 -1239
  295. package/dist/xlsx/model.d.ts +4 -0
  296. package/dist/xlsx/model.d.ts.map +1 -1
  297. package/dist/xlsx/read/chart.d.ts.map +1 -1
  298. package/dist/xlsx/read/drawing.d.ts.map +1 -1
  299. package/dist/xlsx/read/smart-art.d.ts.map +1 -1
  300. package/dist/xlsx/ui/index.cjs +3880 -2228
  301. package/dist/xlsx/ui/index.mjs +3880 -2228
  302. package/dist/xlsx/write/drawing.d.ts.map +1 -1
  303. package/package.json +1 -1
  304. package/dist/PptxHandler-DSXSXMEG.mjs +0 -4
  305. package/dist/pptx/chunks/elements-CCEghtE_.d.ts.map +0 -1
  306. package/dist/pptx/chunks/index-D90lhgiE.d.ts.map +0 -1
  307. package/dist/pptx/chunks/smart-art-BLBSej3J.d.ts.map +0 -1
  308. package/dist/pptx/chunks/text-D49FKllA.d.ts.map +0 -1
@@ -151,8 +151,8 @@ function parseXml(xml, options2 = {}) {
151
151
  let parsed;
152
152
  try {
153
153
  parsed = new xmldom.DOMParser({
154
- onError: (level2, message) => {
155
- if (level2 !== "warning") parseError = message;
154
+ onError: (level3, message) => {
155
+ if (level3 !== "warning") parseError = message;
156
156
  }
157
157
  }).parseFromString(xml, "application/xml");
158
158
  } catch (error) {
@@ -270,15 +270,15 @@ function* liteChildElements(xml, namespaces) {
270
270
  function* topLevelNodes(xml, namespaces) {
271
271
  const source = hasLineEnds(xml) ? xml.replace(/\r[\n\u0085]/g, "\n").replace(/[\r\u0085\u2028\u2029]/g, "\n") : xml;
272
272
  const root2 = new LiteElement("", "", null);
273
- const level2 = root2.childNodes;
273
+ const level3 = root2.childNodes;
274
274
  const stack = [root2];
275
275
  let top = root2;
276
276
  const n = source.length;
277
277
  let pos = 0;
278
278
  while (pos < n) {
279
- if (level2.length && stack.length === 1) {
280
- yield* level2;
281
- level2.length = 0;
279
+ if (level3.length && stack.length === 1) {
280
+ yield* level3;
281
+ level3.length = 0;
282
282
  }
283
283
  const lt = source.indexOf("<", pos);
284
284
  const end = lt < 0 ? n : lt;
@@ -314,7 +314,7 @@ function* topLevelNodes(xml, namespaces) {
314
314
  pos = parsed.end;
315
315
  }
316
316
  if (stack.length !== 1) return false;
317
- yield* level2;
317
+ yield* level3;
318
318
  return true;
319
319
  }
320
320
  var DECLARATIONS = /<!DOCTYPE|<!ENTITY/i;
@@ -378,14 +378,14 @@ function startTag(source, from, namespaces) {
378
378
  while (q < n && isSpace(source.charCodeAt(q))) q++;
379
379
  const quote = source[q];
380
380
  if (quote !== '"' && quote !== "'") return void 0;
381
- const close4 = source.indexOf(quote, q + 1);
382
- if (close4 < 0) return void 0;
383
- const raw2 = source.slice(q + 1, close4);
381
+ const close3 = source.indexOf(quote, q + 1);
382
+ if (close3 < 0) return void 0;
383
+ const raw2 = source.slice(q + 1, close3);
384
384
  if (raw2.includes("<") || element2.hasAttribute(name3)) return void 0;
385
385
  const value3 = decode(/[\t\n\r]/.test(raw2) ? raw2.replace(/[\t\n\r]/g, " ") : raw2);
386
386
  if (value3 === void 0) return void 0;
387
387
  element2.attrs.push(name3, value3);
388
- i = close4 + 1;
388
+ i = close3 + 1;
389
389
  const after = source.charCodeAt(i);
390
390
  if (i < n && !isSpace(after) && after !== 62 && after !== 47) return void 0;
391
391
  }
@@ -4370,7 +4370,11 @@ function indexCells(roots, options2) {
4370
4370
  const unsafe2 = inherited || nested || node3.hasAttribute("Master") || node3.hasAttribute("MasterShape") || attribute2(node3, "Type") === "Group" || !isLocalForeignFrameShape(node3) && (attribute2(node3, "Type") !== void 0 && attribute2(node3, "Type") !== "Shape" || children2(node3, "ForeignData").length > 0 || children2(node3, "Rel").length > 0) || connected.has(shapeId2) && !options2.glueShapes?.has(node3) || !options2.lineEditShapes?.has(node3) && children2(node3, "Cell").some(
4371
4371
  (cell) => /^(BeginX|BeginY|EndX|EndY)$/i.test(attribute2(cell, "N") ?? "") || attribute2(cell, "N")?.toLowerCase() === "oned" && (attribute2(cell, "V") !== "0" || !!executableCellFormula(attribute2(cell, "F")) || attribute2(cell, "F") === "Inh")
4372
4372
  ) || children2(node3, "Shapes").length > 0 || ["1", "true"].includes(attribute2(node3, "Del") ?? "");
4373
- sheets.push({ node: node3, shapeId: shapeId2, unsafe: unsafe2 });
4373
+ sheets.push({
4374
+ node: node3,
4375
+ shapeId: shapeId2,
4376
+ unsafe: options2.groupResizeShapes?.has(node3) ? false : unsafe2
4377
+ });
4374
4378
  visit(node3, unsafe2, true);
4375
4379
  }
4376
4380
  };
@@ -4791,7 +4795,7 @@ function protectedShape(shape, document, masterMovePins = /* @__PURE__ */ new Se
4791
4795
  }
4792
4796
  return local.has("LockRotate") ? numeric(local.get("LockRotate"), 0) !== 0 : inheritedRotationLocked;
4793
4797
  }
4794
- function resizeGeometry(shape, roots, edit, check, lineEditShapes = /* @__PURE__ */ new Set(), glueShapes = /* @__PURE__ */ new Set()) {
4798
+ function resizeGeometry(shape, roots, edit, check, lineEditShapes = /* @__PURE__ */ new Set(), glueShapes = /* @__PURE__ */ new Set(), groupResizeShapes = /* @__PURE__ */ new Set()) {
4795
4799
  const sections2 = children2(shape, "Section").filter((node3) => attribute2(node3, "N") === "Geometry");
4796
4800
  let depends;
4797
4801
  if (!sections2.length)
@@ -4833,7 +4837,12 @@ function resizeGeometry(shape, roots, edit, check, lineEditShapes = /* @__PURE__
4833
4837
  const analysis = analyzeVisioFormula(formula2);
4834
4838
  if (!analysis.references.length && numeric(node3) === 0) continue;
4835
4839
  const cell = `Geometry${Number(attribute2(section3, "IX") ?? "0") + 1}.${attribute2(node3, "N")}${attribute2(row2, "IX")}`;
4836
- depends ??= createVisioDependencyQuery(roots, { check, lineEditShapes, glueShapes });
4840
+ depends ??= createVisioDependencyQuery(roots, {
4841
+ check,
4842
+ lineEditShapes,
4843
+ glueShapes,
4844
+ groupResizeShapes
4845
+ });
4837
4846
  if (!depends(
4838
4847
  { pageId: edit.pageId, shapeId: edit.shapeId, cell },
4839
4848
  ["Width", "Height"].map((cell2) => ({
@@ -6833,7 +6842,7 @@ function pathCommands(value3, limits, budget) {
6833
6842
  const whitespace = () => {
6834
6843
  while (position < data.length && WSP.test(data[position])) position++;
6835
6844
  };
6836
- function operand(separator, flag) {
6845
+ function operand2(separator, flag) {
6837
6846
  whitespace();
6838
6847
  if (separator && data[position] === ",") {
6839
6848
  position++;
@@ -6863,7 +6872,7 @@ function pathCommands(value3, limits, budget) {
6863
6872
  if (budget.commands >= limits.maxPathCommands) limit("Path command limit exceeded.");
6864
6873
  const values = [];
6865
6874
  for (let i = 0; i < arity; i++)
6866
- values.push(operand(i > 0 || !explicit, command2 === "A" && (i === 3 || i === 4)));
6875
+ values.push(operand2(i > 0 || !explicit, command2 === "A" && (i === 3 || i === 4)));
6867
6876
  const px = (i) => values[i] + (relative ? x : 0);
6868
6877
  const py = (i) => values[i] + (relative ? y : 0);
6869
6878
  let output;
@@ -8039,6 +8048,141 @@ function resolveDrawingColor(color2, theme2, options2) {
8039
8048
  };
8040
8049
  }
8041
8050
 
8051
+ // drawingml/picture-crop.ts
8052
+ var SIDES = { l: "cropLeft", t: "cropTop", r: "cropRight", b: "cropBottom" };
8053
+ function parsePictureCrop(blipFill) {
8054
+ const rect = first(blipFill, "srcRect", NS.a);
8055
+ if (!rect) return void 0;
8056
+ const result2 = {};
8057
+ for (const [attr2, key2] of Object.entries(SIDES)) {
8058
+ const raw2 = rect.getAttribute(attr2);
8059
+ if (raw2 === null || !raw2.trim()) continue;
8060
+ const percent = raw2.endsWith("%");
8061
+ const value3 = Number(percent ? raw2.slice(0, -1) : raw2) / (percent ? 100 : 1e5);
8062
+ if (Number.isFinite(value3)) result2[key2] = value3;
8063
+ }
8064
+ return result2;
8065
+ }
8066
+ function applyPictureCrop(blipFill, crop) {
8067
+ let rect = first(blipFill, "srcRect", NS.a);
8068
+ if (!rect && crop && Object.values(crop).some((value3) => value3 !== void 0)) {
8069
+ rect = blipFill.ownerDocument.createElementNS(NS.a, "a:srcRect");
8070
+ const blip = first(blipFill, "blip", NS.a);
8071
+ blipFill.insertBefore(rect, blip?.nextSibling ?? blipFill.firstChild);
8072
+ }
8073
+ if (!rect) return;
8074
+ for (const [attr2, key2] of Object.entries(SIDES)) {
8075
+ const value3 = crop?.[key2];
8076
+ if (value3 === void 0) rect.removeAttribute(attr2);
8077
+ else {
8078
+ if (!Number.isFinite(value3)) throw new RangeError("Picture crop must be finite");
8079
+ rect.setAttribute(attr2, String(Math.round(value3 * 1e5)));
8080
+ }
8081
+ }
8082
+ }
8083
+
8084
+ // drawingml/picture-effects.ts
8085
+ function picturePercentage(value3) {
8086
+ const text5 = String(value3 ?? "").trim();
8087
+ if (!text5) return void 0;
8088
+ const percent = text5.endsWith("%");
8089
+ const n = Number(percent ? text5.slice(0, -1) : text5) / (percent ? 100 : 1e5);
8090
+ return Number.isFinite(n) ? n : void 0;
8091
+ }
8092
+ function readPictureEffect(name3, attribute4) {
8093
+ if (name3 === "grayscl") return { kind: "grayscale" };
8094
+ if (name3 === "lum") {
8095
+ const brightness = picturePercentage(attribute4("bright"));
8096
+ const contrast = picturePercentage(attribute4("contrast"));
8097
+ for (const [name4, value3] of [
8098
+ ["bright", brightness],
8099
+ ["contrast", contrast]
8100
+ ]) {
8101
+ const raw2 = attribute4(name4);
8102
+ if (raw2 !== void 0 && raw2 !== null && (value3 === void 0 || Math.abs(value3) > 1))
8103
+ return void 0;
8104
+ }
8105
+ return {
8106
+ kind: "luminance",
8107
+ ...brightness !== void 0 ? { brightness } : {},
8108
+ ...contrast !== void 0 ? { contrast } : {}
8109
+ };
8110
+ }
8111
+ if (name3 === "alphaModFix") {
8112
+ const raw2 = attribute4("amt");
8113
+ const amount = raw2 === void 0 || raw2 === null ? 1 : picturePercentage(raw2);
8114
+ if (amount !== void 0 && amount >= 0) return { kind: "alphaModFix", amount };
8115
+ }
8116
+ return void 0;
8117
+ }
8118
+ function parsePictureEffects(blip) {
8119
+ if (!blip) return [];
8120
+ return elements(blip).map((node3) => ({
8121
+ ...(node3.namespaceURI === NS.a ? readPictureEffect(node3.localName, (name3) => node3.getAttribute(name3)) : void 0) ?? { kind: "unsupported", name: node3.localName },
8122
+ sourceXml: buildXml(node3)
8123
+ }));
8124
+ }
8125
+ function applyPictureEffects(blip, effects) {
8126
+ if (JSON.stringify(parsePictureEffects(blip)) === JSON.stringify(effects)) return;
8127
+ const nodes = effects.map((effect) => {
8128
+ const name3 = effect.kind === "grayscale" ? "grayscl" : effect.kind === "luminance" ? "lum" : effect.kind === "unsupported" ? effect.name : effect.kind;
8129
+ const source = effect.sourceXml ? parseXml(effect.sourceXml).documentElement : void 0;
8130
+ if (effect.kind === "unsupported" && !source)
8131
+ throw new Error("An unsupported picture effect needs source XML");
8132
+ const node3 = source ? blip.ownerDocument.importNode(source, true) : blip.ownerDocument.createElementNS(NS.a, `a:${name3}`);
8133
+ if (effect.kind !== "unsupported" && (node3.namespaceURI !== NS.a || node3.localName !== name3))
8134
+ throw new Error("Picture effect source does not match its kind");
8135
+ const set = (name4, value3) => {
8136
+ const original = picturePercentage(node3.getAttribute(name4));
8137
+ if (value3 === void 0) node3.removeAttribute(name4);
8138
+ else if (value3 !== original) {
8139
+ if (!Number.isFinite(value3)) throw new RangeError("Picture effect must be finite");
8140
+ node3.setAttribute(name4, String(Math.round(value3 * 1e5)));
8141
+ }
8142
+ };
8143
+ if (effect.kind === "luminance") {
8144
+ if ([effect.brightness, effect.contrast].some(
8145
+ (value3) => value3 !== void 0 && (!Number.isFinite(value3) || Math.abs(value3) > 1)
8146
+ ))
8147
+ throw new RangeError("Picture luminance must be between -1 and 1");
8148
+ set("bright", effect.brightness);
8149
+ set("contrast", effect.contrast);
8150
+ }
8151
+ if (effect.kind === "alphaModFix") {
8152
+ if (effect.amount < 0) throw new RangeError("Picture alpha must be nonnegative");
8153
+ set("amt", effect.amount);
8154
+ }
8155
+ return node3;
8156
+ });
8157
+ for (const node3 of elements(blip)) blip.removeChild(node3);
8158
+ for (const node3 of nodes) blip.appendChild(node3);
8159
+ }
8160
+
8161
+ // drawingml/picture-fill.ts
8162
+ function parseDrawingPictureFill(fill) {
8163
+ const blip = first(fill, "blip", NS.a);
8164
+ const relId = blip?.getAttributeNS(NS.r, "embed") || blip?.getAttribute("r:embed") || void 0;
8165
+ const linkRelId = blip?.getAttributeNS(NS.r, "link") || void 0;
8166
+ const crop = parsePictureCrop(fill);
8167
+ const effects = parsePictureEffects(blip);
8168
+ const tile = first(fill, "tile", NS.a);
8169
+ const rect = first(first(fill, "stretch", NS.a), "fillRect", NS.a);
8170
+ const unsupported4 = [
8171
+ ...tile ? ["tile"] : [],
8172
+ ...rect && ["l", "t", "r", "b"].some((key2) => Number(rect.getAttribute(key2) ?? 0) !== 0) ? ["fillRect"] : [],
8173
+ ...fill.getAttribute("rotWithShape") === "0" || fill.getAttribute("rotWithShape") === "false" ? ["rotWithShape"] : []
8174
+ ];
8175
+ return {
8176
+ kind: "picture",
8177
+ sourceXml: buildXml(fill),
8178
+ ...relId ? { relId } : {},
8179
+ ...linkRelId ? { linkRelId } : {},
8180
+ ...crop ? { crop } : {},
8181
+ ...effects.length ? { effects } : {},
8182
+ ...unsupported4.length ? { unsupportedPicture: unsupported4 } : {}
8183
+ };
8184
+ }
8185
+
8042
8186
  // drawingml/drawing-fill.ts
8043
8187
  var FILL_ELEMENTS = /* @__PURE__ */ new Set([
8044
8188
  "noFill",
@@ -8048,13 +8192,13 @@ var FILL_ELEMENTS = /* @__PURE__ */ new Set([
8048
8192
  "blipFill",
8049
8193
  "grpFill"
8050
8194
  ]);
8051
- function fillElementOf(properties2) {
8052
- return properties2 ? elements(properties2).find(
8195
+ function fillElementOf(properties) {
8196
+ return properties ? elements(properties).find(
8053
8197
  (element2) => FILL_ELEMENTS.has(element2.localName) && (!element2.namespaceURI || element2.namespaceURI === NS.a)
8054
8198
  ) : void 0;
8055
8199
  }
8056
- function parseDrawingFill(properties2) {
8057
- const fill = fillElementOf(properties2);
8200
+ function parseDrawingFill(properties) {
8201
+ const fill = fillElementOf(properties);
8058
8202
  if (!fill) return void 0;
8059
8203
  switch (fill.localName) {
8060
8204
  case "noFill":
@@ -8109,17 +8253,8 @@ function parseDrawingFill(properties2) {
8109
8253
  ...background2 ? { background: background2 } : {}
8110
8254
  };
8111
8255
  }
8112
- case "blipFill": {
8113
- const blip = first(fill, "blip", NS.a);
8114
- const relId = blip?.getAttributeNS(NS.r, "embed") || blip?.getAttribute("r:embed") || void 0;
8115
- const linkRelId = blip?.getAttributeNS(NS.r, "link") || void 0;
8116
- return {
8117
- kind: "picture",
8118
- sourceXml: buildXml(fill),
8119
- ...relId ? { relId } : {},
8120
- ...linkRelId ? { linkRelId } : {}
8121
- };
8122
- }
8256
+ case "blipFill":
8257
+ return parseDrawingPictureFill(fill);
8123
8258
  default:
8124
8259
  return { kind: "unsupported", element: fill.localName };
8125
8260
  }
@@ -8306,6 +8441,10 @@ function drawingPatternPictureXml(fill) {
8306
8441
  else if (blip.getAttributeNS(NS.r, attribute4) !== value3)
8307
8442
  blip.setAttributeNS(NS.r, `r:${attribute4}`, value3);
8308
8443
  }
8444
+ if (fill.crop !== void 0 && JSON.stringify(before?.kind === "picture" ? before.crop : void 0) !== JSON.stringify(fill.crop))
8445
+ applyPictureCrop(root2, fill.crop);
8446
+ if (fill.effects !== void 0 && JSON.stringify(before?.kind === "picture" ? before.effects ?? [] : []) !== JSON.stringify(fill.effects ?? []))
8447
+ applyPictureEffects(blip, fill.effects ?? []);
8309
8448
  if (!fill.sourceXml) {
8310
8449
  const stretch = doc.createElementNS(NS.a, "a:stretch");
8311
8450
  stretch.appendChild(doc.createElementNS(NS.a, "a:fillRect"));
@@ -8316,26 +8455,26 @@ function drawingPatternPictureXml(fill) {
8316
8455
  }
8317
8456
 
8318
8457
  // drawingml/write-fill.ts
8319
- function setDrawingFillXml(properties2, xml) {
8320
- const doc = properties2.ownerDocument;
8458
+ function setDrawingFillXml(properties, xml) {
8459
+ const doc = properties.ownerDocument;
8321
8460
  const wrapper = parseXml(`<w xmlns:a="${NS.a}">${xml}</w>`);
8322
8461
  const fill = elements(wrapper.documentElement)[0];
8323
8462
  const names = ["solidFill", "gradFill", "pattFill", "blipFill", "grpFill", "noFill"];
8324
8463
  if (elements(wrapper.documentElement).length !== 1 || !fill || fill.namespaceURI !== NS.a || !names.includes(fill.localName))
8325
8464
  throw new Error("Invalid DrawingML fill XML");
8326
- const existing = elements(properties2).filter(
8465
+ const existing = elements(properties).filter(
8327
8466
  (node3) => node3.namespaceURI === NS.a && names.includes(node3.localName)
8328
8467
  );
8329
8468
  const next = doc.importNode(fill, true);
8330
- if (existing[0]) properties2.replaceChild(next, existing[0]);
8469
+ if (existing[0]) properties.replaceChild(next, existing[0]);
8331
8470
  else
8332
- properties2.insertBefore(
8471
+ properties.insertBefore(
8333
8472
  next,
8334
- elements(properties2).find(
8473
+ elements(properties).find(
8335
8474
  (node3) => node3.namespaceURI === NS.a && ["ln", "effectLst", "effectDag", "scene3d", "sp3d", "extLst"].includes(node3.localName)
8336
8475
  ) ?? null
8337
8476
  );
8338
- for (const extra of existing.slice(1)) properties2.removeChild(extra);
8477
+ for (const extra of existing.slice(1)) properties.removeChild(extra);
8339
8478
  }
8340
8479
  function drawingFillXml(fill) {
8341
8480
  if (fill.kind === "none") return "<a:noFill/>";
@@ -11224,18 +11363,18 @@ function pivotColumnEntries(pivot) {
11224
11363
  const root2 = { children: /* @__PURE__ */ new Map() };
11225
11364
  for (const record5 of pivot.records) {
11226
11365
  let current = root2;
11227
- indices.forEach((field2, level2) => {
11366
+ indices.forEach((field2, level3) => {
11228
11367
  const value3 = record5[field2] ?? null;
11229
11368
  const key2 = pivotValueKey(value3);
11230
11369
  let child4 = current.children.get(key2);
11231
11370
  if (!child4) {
11232
- child4 = { index: order[level2].get(key2), value: value3, children: /* @__PURE__ */ new Map() };
11371
+ child4 = { index: order[level3].get(key2), value: value3, children: /* @__PURE__ */ new Map() };
11233
11372
  current.children.set(key2, child4);
11234
11373
  }
11235
11374
  current = child4;
11236
11375
  });
11237
11376
  }
11238
- const visit = (node3, level2, path3, values, keys) => {
11377
+ const visit = (node3, level3, path3, values, keys) => {
11239
11378
  for (const child4 of [...node3.children.entries()].sort((a2, b) => a2[1].index - b[1].index)) {
11240
11379
  const here = {
11241
11380
  path: [...path3, child4[1].index],
@@ -11247,10 +11386,10 @@ function pivotColumnEntries(pivot) {
11247
11386
  key: columnKey(here.keys, here.keys.length),
11248
11387
  values: here.values
11249
11388
  };
11250
- if (level2 === names.length - 1) entries.push({ kind: "leaf", ...entry3 });
11389
+ if (level3 === names.length - 1) entries.push({ kind: "leaf", ...entry3 });
11251
11390
  else {
11252
- visit(child4[1], level2 + 1, here.path, here.values, here.keys);
11253
- const own = functions[level2];
11391
+ visit(child4[1], level3 + 1, here.path, here.values, here.keys);
11392
+ const own = functions[level3];
11254
11393
  if (own === "auto") entries.push({ kind: "subtotal", ...entry3 });
11255
11394
  else for (const fn of own) entries.push({ kind: "subtotal", ...entry3, fn });
11256
11395
  }
@@ -11296,9 +11435,9 @@ function pivotColumnHeaders(pivot, columns, rowLabels, valuesOnRows = false) {
11296
11435
  columns.entries.forEach((entry3, j) => {
11297
11436
  const at2 = labelColumns + j * count;
11298
11437
  if (entry3.kind === "leaf") {
11299
- entry3.path.forEach((_index, level2) => {
11300
- const continued = entry3.path.slice(0, level2 + 1).every((p, i) => p === previous[i]);
11301
- if (!continued) grid[1 + level2][at2] = labelOf(columns.names[level2], entry3.values[level2]);
11438
+ entry3.path.forEach((_index, level3) => {
11439
+ const continued = entry3.path.slice(0, level3 + 1).every((p, i) => p === previous[i]);
11440
+ if (!continued) grid[1 + level3][at2] = labelOf(columns.names[level3], entry3.values[level3]);
11302
11441
  });
11303
11442
  previous = entry3.path;
11304
11443
  if (count > 1) measures2.forEach((measure2, m) => grid[rows - 1][at2 + m] = measure2.caption);
@@ -11329,7 +11468,7 @@ function nestedPivotGrid(pivot) {
11329
11468
  const valuesAt = pivotValuesIndex(pivot);
11330
11469
  const onRows = valuesAt >= 0;
11331
11470
  const levels = depth + (onRows ? 1 : 0);
11332
- const fieldOf = (level2) => !onRows || level2 < valuesAt ? level2 : level2 === valuesAt ? -1 : level2 - 1;
11471
+ const fieldOf = (level3) => !onRows || level3 < valuesAt ? level3 : level3 === valuesAt ? -1 : level3 - 1;
11333
11472
  const axisItems = names.map((name3) => pivotItems(pivot, name3));
11334
11473
  const itemIndices = axisItems.map(
11335
11474
  (items) => new Map(items.map((item2, index2) => [pivotValueKey(item2), index2]))
@@ -11389,13 +11528,13 @@ function nestedPivotGrid(pivot) {
11389
11528
  (one) => fn ? aggregateValues(records, pivot.fields.indexOf(one.field), fn) : pivotMeasureNumber(pivot, records, one)
11390
11529
  );
11391
11530
  });
11392
- const labelCells = (path3, shown, level2, text5) => {
11531
+ const labelCells = (path3, shown, level3, text5) => {
11393
11532
  if (compact) return [text5];
11394
11533
  const row2 = Array(levels).fill(null);
11395
11534
  path3.labels.forEach((value3, at2) => {
11396
11535
  if (shown[at2]) row2[at2] = value3;
11397
11536
  });
11398
- row2[level2] = text5;
11537
+ row2[level3] = text5;
11399
11538
  return row2;
11400
11539
  };
11401
11540
  const push = (indent, build2) => {
@@ -11414,11 +11553,11 @@ function nestedPivotGrid(pivot) {
11414
11553
  ...measure2 !== void 0 ? { measure: measure2 } : {},
11415
11554
  ...type ? { type } : {}
11416
11555
  });
11417
- const walk = (level2, group2, measure2, path3) => {
11418
- const field2 = fieldOf(level2);
11419
- const last = level2 === levels - 1;
11556
+ const walk = (level3, group2, measure2, path3) => {
11557
+ const field2 = fieldOf(level3);
11558
+ const last = level3 === levels - 1;
11420
11559
  const repeated = Array.from(
11421
- { length: level2 },
11560
+ { length: level3 },
11422
11561
  (_v, k) => !!pivot.repeatLabels && fieldOf(k) >= 0
11423
11562
  );
11424
11563
  const leafShown = (firsts) => repeated.map((repeat, k) => repeat || tabular && firsts.slice(k + 1).every(Boolean));
@@ -11430,23 +11569,23 @@ function nestedPivotGrid(pivot) {
11430
11569
  firsts: [...path3.firsts, m === 0]
11431
11570
  };
11432
11571
  if (last)
11433
- return push(level2, () => [
11434
- labelCells(path3, leafShown(here.firsts), level2, one.caption),
11572
+ return push(level3, () => [
11573
+ labelCells(path3, leafShown(here.firsts), level3, one.caption),
11435
11574
  cells4(group2, void 0, m),
11436
11575
  entryOf(here.indices, m)
11437
11576
  ]);
11438
11577
  if (!tabular)
11439
- push(level2, () => [
11440
- labelCells(path3, repeated, level2, one.caption),
11578
+ push(level3, () => [
11579
+ labelCells(path3, repeated, level3, one.caption),
11441
11580
  blanks(),
11442
11581
  entryOf(here.indices, m)
11443
11582
  ]);
11444
- walk(level2 + 1, group2, m, here);
11583
+ walk(level3 + 1, group2, m, here);
11445
11584
  });
11446
11585
  return;
11447
11586
  }
11448
11587
  const own = functions[field2];
11449
- const valuesAbove = !onRows || valuesAt < level2;
11588
+ const valuesAbove = !onRows || valuesAt < level3;
11450
11589
  const showsValue = above && own === "auto" && valuesAbove;
11451
11590
  const children5 = [...group2.children.values()].sort((a2, b) => a2.index - b.index);
11452
11591
  children5.forEach((child4, position) => {
@@ -11457,22 +11596,22 @@ function nestedPivotGrid(pivot) {
11457
11596
  };
11458
11597
  const text5 = labelOf(names[field2], child4.value);
11459
11598
  if (last)
11460
- return push(level2, () => [
11461
- labelCells(path3, leafShown(here.firsts), level2, text5),
11599
+ return push(level3, () => [
11600
+ labelCells(path3, leafShown(here.firsts), level3, text5),
11462
11601
  cells4(child4, void 0, measure2),
11463
11602
  entryOf(here.indices, measure2)
11464
11603
  ]);
11465
11604
  if (!tabular)
11466
- push(level2, () => [
11467
- labelCells(path3, repeated, level2, text5),
11605
+ push(level3, () => [
11606
+ labelCells(path3, repeated, level3, text5),
11468
11607
  showsValue ? cells4(child4, void 0, measure2) : blanks(),
11469
11608
  entryOf(here.indices, measure2)
11470
11609
  ]);
11471
- walk(level2 + 1, child4, measure2, here);
11610
+ walk(level3 + 1, child4, measure2, here);
11472
11611
  if (field2 === depth - 1) return;
11473
11612
  const caption = String(text5);
11474
- const subtotal = (title, fn, one) => push(level2, () => [
11475
- labelCells(path3, repeated, level2, title),
11613
+ const subtotal = (title, fn, one) => push(level3, () => [
11614
+ labelCells(path3, repeated, level3, title),
11476
11615
  cells4(child4, fn, one),
11477
11616
  entryOf(here.indices, one, fn ?? "default")
11478
11617
  ]);
@@ -12577,8 +12716,8 @@ function parseSlicer(node3, sheet, partName) {
12577
12716
  if (start !== void 0) slicer.startItem = start;
12578
12717
  const locked = boolAttr(node3, "lockedPosition");
12579
12718
  if (locked !== void 0) slicer.lockedPosition = locked;
12580
- const level2 = numAttr(node3, "level");
12581
- if (level2 !== void 0) slicer.level = level2;
12719
+ const level3 = numAttr(node3, "level");
12720
+ if (level3 !== void 0) slicer.level = level3;
12582
12721
  if (extLst) slicer.extLstXml = selfContainedXml(extLst);
12583
12722
  return slicer;
12584
12723
  }
@@ -13905,10 +14044,10 @@ function blankComments(xml) {
13905
14044
  const at2 = match.index;
13906
14045
  const section3 = SECTIONS.find(([open2]) => xml.startsWith(open2, at2));
13907
14046
  if (!section3) return void 0;
13908
- const [open, close4] = section3;
13909
- const end = xml.indexOf(close4, at2 + open.length);
14047
+ const [open, close3] = section3;
14048
+ const end = xml.indexOf(close3, at2 + open.length);
13910
14049
  if (end < 0) return void 0;
13911
- const after = end + close4.length;
14050
+ const after = end + close3.length;
13912
14051
  if (open !== "<?") {
13913
14052
  pieces.push(xml.slice(copied, at2), " ".repeat(after - at2));
13914
14053
  copied = after;
@@ -13926,9 +14065,9 @@ function rootChildren(xml) {
13926
14065
  const namespaces = rootNamespaces(plain4);
13927
14066
  const root2 = ROOT.exec(plain4.slice(0, 8192));
13928
14067
  if (!namespaces || !root2 || (root2[2] ?? "").trimEnd().endsWith("/")) return void 0;
13929
- const close4 = plain4.lastIndexOf(`</${root2[1] ?? ""}`);
13930
- if (close4 < root2[0].length || !/^<\/[^\s>]+\s*>\s*$/.test(plain4.slice(close4))) return void 0;
13931
- const content2 = xml.slice(root2[0].length, close4);
14068
+ const close3 = plain4.lastIndexOf(`</${root2[1] ?? ""}`);
14069
+ if (close3 < root2[0].length || !/^<\/[^\s>]+\s*>\s*$/.test(plain4.slice(close3))) return void 0;
14070
+ const content2 = xml.slice(root2[0].length, close3);
13932
14071
  return { [Symbol.iterator]: () => liteChildElements(content2, namespaces) };
13933
14072
  }
13934
14073
  function findSheetData(plain4) {
@@ -13949,11 +14088,11 @@ function splitSheetData(xml) {
13949
14088
  const start = plain4 === void 0 ? void 0 : findSheetData(plain4);
13950
14089
  if (plain4 === void 0 || !start) return void 0;
13951
14090
  const { namespaces, tagName: tagName2, contentStart } = start;
13952
- const close4 = plain4.indexOf(`</${tagName2}`, contentStart);
13953
- if (close4 < 0 || OPEN.test(plain4.slice(contentStart - 1))) return void 0;
13954
- const data = xml.slice(contentStart, close4);
14091
+ const close3 = plain4.indexOf(`</${tagName2}`, contentStart);
14092
+ if (close3 < 0 || OPEN.test(plain4.slice(contentStart - 1))) return void 0;
14093
+ const data = xml.slice(contentStart, close3);
13955
14094
  return {
13956
- xml: xml.slice(0, contentStart) + xml.slice(close4),
14095
+ xml: xml.slice(0, contentStart) + xml.slice(close3),
13957
14096
  rows: { [Symbol.iterator]: () => liteChildElements(data, namespaces) }
13958
14097
  };
13959
14098
  }
@@ -14284,14 +14423,14 @@ function fromStoredSyntax(formula2) {
14284
14423
  if (name3 !== "ANCHORARRAY" && name3 !== "SINGLE") continue;
14285
14424
  const open = nextIndex(list2, i + 1);
14286
14425
  const arg = nextIndex(list2, open + 1);
14287
- const close4 = nextIndex(list2, arg + 1);
14426
+ const close3 = nextIndex(list2, arg + 1);
14288
14427
  const target2 = list2[arg];
14289
- if (list2[open]?.kind !== "open" || list2[close4]?.kind !== "close" || !target2) continue;
14428
+ if (list2[open]?.kind !== "open" || list2[close3]?.kind !== "close" || !target2) continue;
14290
14429
  const single2 = target2.kind === "ref" || target2.kind === "name" || target2.kind === "structured";
14291
14430
  if (name3 === "ANCHORARRAY" && !(target2.kind === "ref" && target2.ref?.kind === "cell")) continue;
14292
14431
  if (name3 === "SINGLE" && !single2) continue;
14293
14432
  const text5 = name3 === "ANCHORARRAY" ? `${target2.text}#` : `@${target2.text}`;
14294
- for (let k = i; k <= close4; k++) list2[k].text = "";
14433
+ for (let k = i; k <= close3; k++) list2[k].text = "";
14295
14434
  token.text = text5;
14296
14435
  changed = true;
14297
14436
  }
@@ -14437,6 +14576,142 @@ function parseDocProps(core, app, custom) {
14437
14576
  };
14438
14577
  }
14439
14578
 
14579
+ // geometry/guide-formula-eval.ts
14580
+ var ANGLE_SCALE = 6e4;
14581
+ function angleToRadians(ooxmlAngle) {
14582
+ return ooxmlAngle / ANGLE_SCALE * (Math.PI / 180);
14583
+ }
14584
+ function parseFormula(fmla) {
14585
+ const parts = fmla.trim().split(/\s+/);
14586
+ const op = parts[0] ?? "";
14587
+ const args = parts.slice(1);
14588
+ return { op, args };
14589
+ }
14590
+ function resolveOperand(token, variables) {
14591
+ const num = Number(token);
14592
+ if (Number.isFinite(num)) {
14593
+ return num;
14594
+ }
14595
+ const value3 = variables.get(token);
14596
+ if (value3 !== void 0) {
14597
+ return value3;
14598
+ }
14599
+ return 0;
14600
+ }
14601
+ function evaluateFormula(parsed, vars) {
14602
+ const r = (idx) => resolveOperand(parsed.args[idx] ?? "0", vars);
14603
+ switch (parsed.op) {
14604
+ // val x — literal value
14605
+ case "val":
14606
+ return r(0);
14607
+ // abs x — absolute value
14608
+ case "abs":
14609
+ return Math.abs(r(0));
14610
+ // sqrt x — square root
14611
+ case "sqrt":
14612
+ return Math.sqrt(Math.max(r(0), 0));
14613
+ // +- x y z — x + y - z
14614
+ case "+-":
14615
+ return r(0) + r(1) - r(2);
14616
+ // */ x y z — (x * y) / z
14617
+ case "*/": {
14618
+ const z = r(2);
14619
+ if (z === 0) {
14620
+ return 0;
14621
+ }
14622
+ return r(0) * r(1) / z;
14623
+ }
14624
+ // +/ x y z — (x + y) / z
14625
+ case "+/": {
14626
+ const z = r(2);
14627
+ if (z === 0) {
14628
+ return 0;
14629
+ }
14630
+ return (r(0) + r(1)) / z;
14631
+ }
14632
+ // ?: x y z — if x > 0 then y else z
14633
+ case "?:":
14634
+ case "if":
14635
+ return r(0) > 0 ? r(1) : r(2);
14636
+ // min x y — minimum
14637
+ case "min":
14638
+ return Math.min(r(0), r(1));
14639
+ // max x y — maximum
14640
+ case "max":
14641
+ return Math.max(r(0), r(1));
14642
+ // mod x y z — sqrt(x² + y² + z²)
14643
+ case "mod": {
14644
+ const a2 = r(0);
14645
+ const b = r(1);
14646
+ const c2 = r(2);
14647
+ return Math.sqrt(a2 * a2 + b * b + c2 * c2);
14648
+ }
14649
+ // pin x y z — clamp y between x and z
14650
+ case "pin": {
14651
+ const lo = r(0);
14652
+ const val = r(1);
14653
+ const hi = r(2);
14654
+ return Math.max(lo, Math.min(val, hi));
14655
+ }
14656
+ // sin x y — x * sin(y) where y is in OOXML angle units
14657
+ case "sin": {
14658
+ const sinVal = Math.sin(angleToRadians(r(1)));
14659
+ if (!Number.isFinite(sinVal)) {
14660
+ return 0;
14661
+ }
14662
+ return r(0) * sinVal;
14663
+ }
14664
+ // cos x y — x * cos(y) where y is in OOXML angle units
14665
+ case "cos": {
14666
+ const cosVal = Math.cos(angleToRadians(r(1)));
14667
+ if (!Number.isFinite(cosVal)) {
14668
+ return 0;
14669
+ }
14670
+ return r(0) * cosVal;
14671
+ }
14672
+ // tan x y — x * tan(y) where y is in OOXML angle units
14673
+ case "tan": {
14674
+ const angle = angleToRadians(r(1));
14675
+ const tanVal = Math.tan(angle);
14676
+ if (!Number.isFinite(tanVal)) {
14677
+ return 0;
14678
+ }
14679
+ return r(0) * tanVal;
14680
+ }
14681
+ // atan x — atan(x) result in OOXML angle units
14682
+ // x is a ratio scaled by the shape coordinate space
14683
+ case "atan": {
14684
+ const radians = Math.atan(r(0));
14685
+ return radians * 180 * ANGLE_SCALE / Math.PI;
14686
+ }
14687
+ // at2 x y -> arctan(y / x), i.e. Math.atan2(y, x), result in OOXML angle
14688
+ // units. ECMA-376 / ISO-IEC-29500-1 section 20.1.9.6 defines the operand
14689
+ // order as (x, y) with the ARGUMENTS REVERSED relative to Math.atan2, so
14690
+ // the first operand is the horizontal component and the second is the
14691
+ // vertical one. This matches the companion `cat2`/`sat2` operators below,
14692
+ // which take (x, y, z) and compute atan2(z, y).
14693
+ case "at2":
14694
+ case "atan2": {
14695
+ const radians = Math.atan2(r(1), r(0));
14696
+ return radians * 180 * ANGLE_SCALE / Math.PI;
14697
+ }
14698
+ // cat2 x y z — x * cos(atan2(z, y))
14699
+ // Computes the cosine-component of a vector scaled by x
14700
+ case "cat2": {
14701
+ const angle = Math.atan2(r(2), r(1));
14702
+ return r(0) * Math.cos(angle);
14703
+ }
14704
+ // sat2 x y z — x * sin(atan2(z, y))
14705
+ // Computes the sine-component of a vector scaled by x
14706
+ case "sat2": {
14707
+ const angle = Math.atan2(r(2), r(1));
14708
+ return r(0) * Math.sin(angle);
14709
+ }
14710
+ default:
14711
+ return Number(parsed.op) || 0;
14712
+ }
14713
+ }
14714
+
14440
14715
  // geometry/indexed.ts
14441
14716
  function at(items, index2) {
14442
14717
  const value3 = items[index2];
@@ -14446,6 +14721,251 @@ function at(items, index2) {
14446
14721
  return value3;
14447
14722
  }
14448
14723
 
14724
+ // geometry/guide-formula-api.ts
14725
+ function createBuiltinVariables(ctx) {
14726
+ const { w, h } = ctx;
14727
+ const vars = /* @__PURE__ */ new Map();
14728
+ vars.set("w", w);
14729
+ vars.set("h", h);
14730
+ vars.set("l", 0);
14731
+ vars.set("t", 0);
14732
+ vars.set("r", w);
14733
+ vars.set("b", h);
14734
+ vars.set("hc", w / 2);
14735
+ vars.set("vc", h / 2);
14736
+ const widthDivisors = [2, 3, 4, 5, 6, 8, 10, 12, 16, 32];
14737
+ for (const d of widthDivisors) {
14738
+ vars.set(`wd${d}`, w / d);
14739
+ }
14740
+ const heightDivisors = [2, 3, 4, 5, 6, 8, 10, 12, 16, 32];
14741
+ for (const d of heightDivisors) {
14742
+ vars.set(`hd${d}`, h / d);
14743
+ }
14744
+ const ss = Math.min(w, h);
14745
+ const ls = Math.max(w, h);
14746
+ vars.set("ss", ss);
14747
+ vars.set("ls", ls);
14748
+ const ssDivisors = [2, 4, 6, 8, 16, 32];
14749
+ for (const d of ssDivisors) {
14750
+ vars.set(`ssd${d}`, ss / d);
14751
+ }
14752
+ vars.set("cd2", 180 * ANGLE_SCALE);
14753
+ vars.set("cd4", 90 * ANGLE_SCALE);
14754
+ vars.set("cd8", 45 * ANGLE_SCALE);
14755
+ vars.set("3cd4", 270 * ANGLE_SCALE);
14756
+ vars.set("3cd8", 135 * ANGLE_SCALE);
14757
+ vars.set("5cd8", 225 * ANGLE_SCALE);
14758
+ vars.set("7cd8", 315 * ANGLE_SCALE);
14759
+ return vars;
14760
+ }
14761
+
14762
+ // drawingml/scene3d-presets.ts
14763
+ var CAMERA_PRESETS = /* @__PURE__ */ new Set([
14764
+ "legacyObliqueTopLeft",
14765
+ "legacyObliqueTop",
14766
+ "legacyObliqueTopRight",
14767
+ "legacyObliqueLeft",
14768
+ "legacyObliqueFront",
14769
+ "legacyObliqueRight",
14770
+ "legacyObliqueBottomLeft",
14771
+ "legacyObliqueBottom",
14772
+ "legacyObliqueBottomRight",
14773
+ "legacyPerspectiveTopLeft",
14774
+ "legacyPerspectiveTop",
14775
+ "legacyPerspectiveTopRight",
14776
+ "legacyPerspectiveLeft",
14777
+ "legacyPerspectiveFront",
14778
+ "legacyPerspectiveRight",
14779
+ "legacyPerspectiveBottomLeft",
14780
+ "legacyPerspectiveBottom",
14781
+ "legacyPerspectiveBottomRight",
14782
+ "orthographicFront",
14783
+ "isometricTopUp",
14784
+ "isometricTopDown",
14785
+ "isometricBottomUp",
14786
+ "isometricBottomDown",
14787
+ "isometricLeftUp",
14788
+ "isometricLeftDown",
14789
+ "isometricRightUp",
14790
+ "isometricRightDown",
14791
+ "isometricOffAxis1Left",
14792
+ "isometricOffAxis1Right",
14793
+ "isometricOffAxis1Top",
14794
+ "isometricOffAxis2Left",
14795
+ "isometricOffAxis2Right",
14796
+ "isometricOffAxis2Top",
14797
+ "isometricOffAxis3Left",
14798
+ "isometricOffAxis3Right",
14799
+ "isometricOffAxis3Bottom",
14800
+ "isometricOffAxis4Left",
14801
+ "isometricOffAxis4Right",
14802
+ "isometricOffAxis4Bottom",
14803
+ "obliqueTopLeft",
14804
+ "obliqueTop",
14805
+ "obliqueTopRight",
14806
+ "obliqueLeft",
14807
+ "obliqueRight",
14808
+ "obliqueBottomLeft",
14809
+ "obliqueBottom",
14810
+ "obliqueBottomRight",
14811
+ "perspectiveFront",
14812
+ "perspectiveLeft",
14813
+ "perspectiveRight",
14814
+ "perspectiveAbove",
14815
+ "perspectiveBelow",
14816
+ "perspectiveAboveLeftFacing",
14817
+ "perspectiveAboveRightFacing",
14818
+ "perspectiveContrastingLeftFacing",
14819
+ "perspectiveContrastingRightFacing",
14820
+ "perspectiveHeroicLeftFacing",
14821
+ "perspectiveHeroicRightFacing",
14822
+ "perspectiveHeroicExtremeLeftFacing",
14823
+ "perspectiveHeroicExtremeRightFacing",
14824
+ "perspectiveRelaxed",
14825
+ "perspectiveRelaxedModerately"
14826
+ ]);
14827
+ var LIGHT_RIGS = /* @__PURE__ */ new Set([
14828
+ "legacyFlat1",
14829
+ "legacyFlat2",
14830
+ "legacyFlat3",
14831
+ "legacyFlat4",
14832
+ "legacyNormal1",
14833
+ "legacyNormal2",
14834
+ "legacyNormal3",
14835
+ "legacyNormal4",
14836
+ "legacyHarsh1",
14837
+ "legacyHarsh2",
14838
+ "legacyHarsh3",
14839
+ "legacyHarsh4",
14840
+ "threePt",
14841
+ "balanced",
14842
+ "soft",
14843
+ "harsh",
14844
+ "flood",
14845
+ "contrasting",
14846
+ "morning",
14847
+ "sunrise",
14848
+ "sunset",
14849
+ "chilly",
14850
+ "freezing",
14851
+ "flat",
14852
+ "twoPt",
14853
+ "glow",
14854
+ "brightRoom"
14855
+ ]);
14856
+ var LIGHT_DIRECTIONS = /* @__PURE__ */ new Set(["tl", "t", "tr", "l", "r", "bl", "b", "br"]);
14857
+
14858
+ // drawingml/read-3d-values.ts
14859
+ var integer3 = (value3) => {
14860
+ if (value3 === void 0 || value3 === null || String(value3).trim() === "") return void 0;
14861
+ const n = Number(value3);
14862
+ return Number.isSafeInteger(n) ? n : void 0;
14863
+ };
14864
+ function readScene3DValues(node3, read) {
14865
+ const out = {};
14866
+ const camera = read.child(node3, "camera");
14867
+ const light = read.child(node3, "lightRig");
14868
+ for (const [key2, source, attribute4, choices] of [
14869
+ ["cameraPreset", camera, "prst", CAMERA_PRESETS],
14870
+ ["lightRigType", light, "rig", LIGHT_RIGS],
14871
+ ["lightRigDirection", light, "dir", LIGHT_DIRECTIONS]
14872
+ ]) {
14873
+ const token = String(read.attribute(source, attribute4) ?? "").trim();
14874
+ if (choices.has(token)) out[key2] = token;
14875
+ }
14876
+ const fov = integer3(read.attribute(camera, "fov"));
14877
+ if (fov !== void 0 && fov >= 0 && fov <= 108e5) out.cameraFieldOfView = fov;
14878
+ const zoom = picturePercentage(read.attribute(camera, "zoom"));
14879
+ if (zoom !== void 0 && zoom > 0) out.cameraZoom = zoom;
14880
+ for (const [prefix2, source] of [
14881
+ ["camera", camera],
14882
+ ["lightRig", light]
14883
+ ]) {
14884
+ const rot = read.child(source, "rot");
14885
+ for (const [axis, key2] of [
14886
+ ["lat", "RotX"],
14887
+ ["lon", "RotY"],
14888
+ ["rev", "RotZ"]
14889
+ ]) {
14890
+ const value3 = integer3(read.attribute(rot, axis));
14891
+ if (value3 !== void 0 && value3 >= 0 && value3 < 216e5) out[`${prefix2}${key2}`] = value3;
14892
+ }
14893
+ }
14894
+ const backdrop = read.child(node3, "backdrop");
14895
+ if (backdrop !== void 0) {
14896
+ out.hasBackdrop = true;
14897
+ for (const [name3, prefix2, attr2] of [
14898
+ ["anchor", "backdropAnchor", ""],
14899
+ ["norm", "backdropNormal", "d"],
14900
+ ["up", "backdropUp", "d"]
14901
+ ]) {
14902
+ const point2 = read.child(backdrop, name3);
14903
+ for (const [axis, suffix] of [
14904
+ ["x", "X"],
14905
+ ["y", "Y"],
14906
+ ["z", "Z"]
14907
+ ]) {
14908
+ const value3 = integer3(read.attribute(point2, `${attr2}${axis}`));
14909
+ if (value3 !== void 0) out[`${prefix2}${suffix}`] = value3;
14910
+ }
14911
+ }
14912
+ }
14913
+ return out;
14914
+ }
14915
+ function readText3DValues(node3, read) {
14916
+ const out = {};
14917
+ for (const [key2, attribute4] of [
14918
+ ["extrusionHeight", "extrusionH"],
14919
+ ["contourWidth", "contourW"],
14920
+ ["z", "z"]
14921
+ ]) {
14922
+ const value3 = integer3(read.attribute(node3, attribute4));
14923
+ if (value3 !== void 0) out[key2] = value3;
14924
+ }
14925
+ const material = String(read.attribute(node3, "prstMaterial") ?? "").trim();
14926
+ if (material) out.presetMaterial = material;
14927
+ for (const [name3, prefix2] of [
14928
+ ["bevelT", "bevelTop"],
14929
+ ["bevelB", "bevelBottom"]
14930
+ ]) {
14931
+ const bevel = read.child(node3, name3);
14932
+ if (!bevel) continue;
14933
+ out[`${prefix2}Type`] = String(read.attribute(bevel, "prst") || "circle").trim();
14934
+ for (const [attribute4, suffix] of [
14935
+ ["w", "Width"],
14936
+ ["h", "Height"]
14937
+ ]) {
14938
+ const value3 = integer3(read.attribute(bevel, attribute4));
14939
+ if (value3 !== void 0) out[`${prefix2}${suffix}`] = value3;
14940
+ }
14941
+ }
14942
+ return out;
14943
+ }
14944
+
14945
+ // drawingml/read-text-3d.ts
14946
+ var DOM_3D_READER = {
14947
+ attribute: (node3, name3) => node3?.getAttribute(name3),
14948
+ child: (node3, name3) => first(node3, name3, NS.a)
14949
+ };
14950
+ function parseDrawingTextScene3D(node3) {
14951
+ return { ...readScene3DValues(node3, DOM_3D_READER), sourceXml: buildXml(node3) };
14952
+ }
14953
+ function parseDrawingTextShape3D(node3) {
14954
+ const extrusionColor = parseDrawingColorIn(first(node3, "extrusionClr", NS.a));
14955
+ const contourColor = parseDrawingColorIn(first(node3, "contourClr", NS.a));
14956
+ return {
14957
+ ...readText3DValues(node3, DOM_3D_READER),
14958
+ sourceXml: buildXml(node3),
14959
+ ...extrusionColor ? { extrusionColor } : {},
14960
+ ...contourColor ? { contourColor } : {}
14961
+ };
14962
+ }
14963
+ function parseDrawingFlatText3D(node3) {
14964
+ const raw2 = node3.getAttribute("z");
14965
+ const z = raw2 === null || !raw2.trim() ? NaN : Number(raw2);
14966
+ return { sourceXml: buildXml(node3), ...Number.isSafeInteger(z) ? { z } : {} };
14967
+ }
14968
+
14449
14969
  // drawingml/read-run-properties.ts
14450
14970
  function outerXml2(element2) {
14451
14971
  return buildXml(element2);
@@ -14607,8 +15127,8 @@ var BOOLEAN_ATTRIBUTES2 = [
14607
15127
  ["hangingPunctuation", "hangingPunct"]
14608
15128
  ];
14609
15129
  function readAttributes2(element2, out) {
14610
- const level2 = integerAttribute(element2, "lvl");
14611
- if (level2 !== void 0) out.level = Math.min(Math.max(level2, 0), 8);
15130
+ const level3 = integerAttribute(element2, "lvl");
15131
+ if (level3 !== void 0) out.level = Math.min(Math.max(level3, 0), 8);
14612
15132
  const align = stringAttribute(element2, "algn");
14613
15133
  if (align) out.align = align;
14614
15134
  for (const [key2, name3] of EMU_ATTRIBUTES) {
@@ -14767,7 +15287,13 @@ function parseDrawingBodyProperties(element2) {
14767
15287
  ...read("fontScale") !== void 0 && fontScale !== void 0 ? { fontScale } : {},
14768
15288
  ...read("lnSpcReduction") !== void 0 && reduction !== void 0 ? { lineSpacingReduction: reduction } : {}
14769
15289
  };
14770
- } else extra.push(outerXml2(child4));
15290
+ } else if (name3 === "scene3d" && children(element2, "scene3d", NS.a).length === 1)
15291
+ out.scene3d = parseDrawingTextScene3D(child4);
15292
+ else if (name3 === "sp3d" && children(element2, "sp3d", NS.a).length === 1 && !first(element2, "flatTx", NS.a))
15293
+ out.shape3d = parseDrawingTextShape3D(child4);
15294
+ else if (name3 === "flatTx" && children(element2, "flatTx", NS.a).length === 1 && !first(element2, "sp3d", NS.a))
15295
+ out.flatText3d = parseDrawingFlatText3D(child4);
15296
+ else extra.push(outerXml2(child4));
14771
15297
  }
14772
15298
  if (extra.length) out.extraXml = extra;
14773
15299
  return out;
@@ -14777,8 +15303,8 @@ function parseDrawingListStyle(element2) {
14777
15303
  const style2 = { levels: [] };
14778
15304
  const extra = [];
14779
15305
  for (const child4 of elements(element2)) {
14780
- const level2 = isDrawingElement(child4) ? /^lvl([1-9])pPr$/u.exec(child4.localName) : null;
14781
- if (level2) style2.levels[Number(level2[1]) - 1] = parseDrawingParagraphProperties(child4);
15306
+ const level3 = isDrawingElement(child4) ? /^lvl([1-9])pPr$/u.exec(child4.localName) : null;
15307
+ if (level3) style2.levels[Number(level3[1]) - 1] = parseDrawingParagraphProperties(child4);
14782
15308
  else if (isDrawingElement(child4) && child4.localName === "defPPr")
14783
15309
  style2.default = parseDrawingParagraphProperties(child4) ?? {};
14784
15310
  else extra.push(outerXml2(child4));
@@ -14794,15 +15320,15 @@ function readItem(child4) {
14794
15320
  const name3 = isDrawingElement(child4) ? child4.localName : "";
14795
15321
  if (name3 === "pPr" || name3 === "endParaRPr") return void 0;
14796
15322
  if (name3 === "r") {
14797
- const properties2 = parseDrawingRunProperties(first(child4, "rPr", NS.a));
14798
- return { kind: "run", text: textOf(child4), ...properties2 ? { properties: properties2 } : {} };
15323
+ const properties = parseDrawingRunProperties(first(child4, "rPr", NS.a));
15324
+ return { kind: "run", text: textOf(child4), ...properties ? { properties } : {} };
14799
15325
  }
14800
15326
  if (name3 === "br") {
14801
- const properties2 = parseDrawingRunProperties(first(child4, "rPr", NS.a));
14802
- return { kind: "break", ...properties2 ? { properties: properties2 } : {} };
15327
+ const properties = parseDrawingRunProperties(first(child4, "rPr", NS.a));
15328
+ return { kind: "break", ...properties ? { properties } : {} };
14803
15329
  }
14804
15330
  if (name3 === "fld") {
14805
- const properties2 = parseDrawingRunProperties(first(child4, "rPr", NS.a));
15331
+ const properties = parseDrawingRunProperties(first(child4, "rPr", NS.a));
14806
15332
  const paragraphProperties = parseDrawingParagraphProperties(first(child4, "pPr", NS.a));
14807
15333
  const type = child4.getAttribute("type");
14808
15334
  return {
@@ -14810,7 +15336,7 @@ function readItem(child4) {
14810
15336
  id: child4.getAttribute("id") ?? "",
14811
15337
  ...type ? { type } : {},
14812
15338
  text: textOf(child4),
14813
- ...properties2 ? { properties: properties2 } : {},
15339
+ ...properties ? { properties } : {},
14814
15340
  ...paragraphProperties ? { paragraphProperties } : {}
14815
15341
  };
14816
15342
  }
@@ -14822,10 +15348,10 @@ function parseDrawingParagraph(element2) {
14822
15348
  const item2 = readItem(child4);
14823
15349
  if (item2) items.push(item2);
14824
15350
  }
14825
- const properties2 = parseDrawingParagraphProperties(first(element2, "pPr", NS.a));
15351
+ const properties = parseDrawingParagraphProperties(first(element2, "pPr", NS.a));
14826
15352
  const endProperties = parseDrawingRunProperties(first(element2, "endParaRPr", NS.a));
14827
15353
  return {
14828
- ...properties2 ? { properties: properties2 } : {},
15354
+ ...properties ? { properties } : {},
14829
15355
  items,
14830
15356
  ...endProperties ? { endProperties } : {}
14831
15357
  };
@@ -15231,9 +15757,9 @@ function parsePoint(element2) {
15231
15757
  text: paragraphs.join("\n"),
15232
15758
  ...textParagraphs2 ? { textParagraphs: textParagraphs2 } : {}
15233
15759
  };
15234
- const properties2 = first(element2, "spPr", NS.dgm);
15235
- const fill = parseDrawingFill(properties2);
15236
- const line = parseDrawingLine(first(properties2, "ln", NS.a));
15760
+ const properties = first(element2, "spPr", NS.dgm);
15761
+ const fill = parseDrawingFill(properties);
15762
+ const line = parseDrawingLine(first(properties, "ln", NS.a));
15237
15763
  if (fill) point2.fill = fill;
15238
15764
  if (line) point2.line = line;
15239
15765
  const optional = [
@@ -15509,19 +16035,19 @@ function parseSpacing(parent) {
15509
16035
  }
15510
16036
  return void 0;
15511
16037
  }
15512
- function parseProperties(properties2) {
16038
+ function parseProperties(properties) {
15513
16039
  const parsed = {};
15514
- const size3 = Number.parseInt(properties2?.getAttribute("sz") ?? "", 10);
16040
+ const size3 = Number.parseInt(properties?.getAttribute("sz") ?? "", 10);
15515
16041
  if (Number.isFinite(size3)) parsed.sizePt = size3 / 100;
15516
- const bold = booleanAttribute(properties2, "b");
16042
+ const bold = booleanAttribute(properties, "b");
15517
16043
  if (bold !== void 0) parsed.bold = bold;
15518
- const italic = booleanAttribute(properties2, "i");
16044
+ const italic = booleanAttribute(properties, "i");
15519
16045
  if (italic !== void 0) parsed.italic = italic;
15520
- const underline = properties2?.getAttribute("u");
16046
+ const underline = properties?.getAttribute("u");
15521
16047
  if (underline) parsed.underline = underline !== "none";
15522
- const color2 = parseDrawingColorIn(first(properties2, "solidFill", NS.a));
16048
+ const color2 = parseDrawingColorIn(first(properties, "solidFill", NS.a));
15523
16049
  if (color2) parsed.color = color2;
15524
- const typeface2 = first(properties2, "latin", NS.a)?.getAttribute("typeface");
16050
+ const typeface2 = first(properties, "latin", NS.a)?.getAttribute("typeface");
15525
16051
  if (typeface2) parsed.typeface = typeface2;
15526
16052
  return parsed;
15527
16053
  }
@@ -15536,12 +16062,12 @@ function parseParagraph(paragraph2) {
15536
16062
  for (const child4 of elements(paragraph2))
15537
16063
  if (child4.namespaceURI === NS.a && ["r", "fld", "br"].includes(child4.localName))
15538
16064
  runs.push(parseRun(child4));
15539
- const properties2 = first(paragraph2, "pPr", NS.a);
15540
- const align = properties2?.getAttribute("algn");
15541
- const defaults = parseProperties(first(properties2, "defRPr", NS.a));
15542
- const lineSpacing = parseSpacing(first(properties2, "lnSpc", NS.a));
15543
- const spaceBefore = parseSpacing(first(properties2, "spcBef", NS.a));
15544
- const spaceAfter = parseSpacing(first(properties2, "spcAft", NS.a));
16065
+ const properties = first(paragraph2, "pPr", NS.a);
16066
+ const align = properties?.getAttribute("algn");
16067
+ const defaults = parseProperties(first(properties, "defRPr", NS.a));
16068
+ const lineSpacing = parseSpacing(first(properties, "lnSpc", NS.a));
16069
+ const spaceBefore = parseSpacing(first(properties, "spcBef", NS.a));
16070
+ const spaceAfter = parseSpacing(first(properties, "spcAft", NS.a));
15545
16071
  return {
15546
16072
  ...align ? { align } : {},
15547
16073
  ...Object.keys(defaults).length ? { defaultProperties: defaults } : {},
@@ -15553,13 +16079,13 @@ function parseParagraph(paragraph2) {
15553
16079
  }
15554
16080
  function parseDrawingTextBody(body) {
15555
16081
  if (!body) return void 0;
15556
- const properties2 = first(body, "bodyPr", NS.a);
16082
+ const properties = first(body, "bodyPr", NS.a);
15557
16083
  const paragraphs = children(body, "p", NS.a).map(parseParagraph);
15558
16084
  const result2 = {
15559
16085
  paragraphs,
15560
16086
  text: paragraphs.map((paragraph2) => paragraph2.runs.map((run2) => run2.text).join("")).join("\n")
15561
16087
  };
15562
- const anchor = properties2?.getAttribute("anchor");
16088
+ const anchor = properties?.getAttribute("anchor");
15563
16089
  if (anchor) result2.anchor = anchor;
15564
16090
  const insets = {};
15565
16091
  for (const [key2, attribute4] of [
@@ -15568,13 +16094,115 @@ function parseDrawingTextBody(body) {
15568
16094
  ["right", "rIns"],
15569
16095
  ["bottom", "bIns"]
15570
16096
  ]) {
15571
- const value3 = Number.parseInt(properties2?.getAttribute(attribute4) ?? "", 10);
16097
+ const value3 = Number.parseInt(properties?.getAttribute(attribute4) ?? "", 10);
15572
16098
  if (Number.isFinite(value3)) insets[key2] = value3;
15573
16099
  }
15574
16100
  if (Object.keys(insets).length > 0) result2.insetsEmu = insets;
15575
16101
  return result2;
15576
16102
  }
15577
16103
 
16104
+ // drawingml/custom-geometry.ts
16105
+ var ARITY3 = {
16106
+ val: 1,
16107
+ abs: 1,
16108
+ sqrt: 1,
16109
+ "+-": 3,
16110
+ "*/": 3,
16111
+ "+/": 3,
16112
+ "?:": 3,
16113
+ at2: 2,
16114
+ cat2: 3,
16115
+ cos: 2,
16116
+ max: 2,
16117
+ min: 2,
16118
+ mod: 3,
16119
+ pin: 3,
16120
+ sat2: 3,
16121
+ sin: 2,
16122
+ tan: 2
16123
+ };
16124
+ function operand(value3, vars) {
16125
+ if (value3 === null || !value3.trim()) return NaN;
16126
+ const literal2 = Number(value3);
16127
+ return Number.isFinite(literal2) ? literal2 : vars.get(value3) ?? NaN;
16128
+ }
16129
+ function parseCustomGeometry(custom, width, height) {
16130
+ const pathList = first(custom, "pathLst", NS.a);
16131
+ if (!pathList) return void 0;
16132
+ const pathNodes = children(pathList, "path", NS.a);
16133
+ const contextWidth = width;
16134
+ const contextHeight = height;
16135
+ const vars = createBuiltinVariables({ w: contextWidth, h: contextHeight });
16136
+ for (const list2 of ["avLst", "gdLst"]) {
16137
+ const parent = first(custom, list2, NS.a);
16138
+ if (!parent) continue;
16139
+ for (const guide of children(parent, "gd", NS.a)) {
16140
+ const name3 = guide.getAttribute("name");
16141
+ const formula2 = parseFormula(guide.getAttribute("fmla") ?? "");
16142
+ if (!name3 || ARITY3[formula2.op] !== formula2.args.length || formula2.args.some((arg) => !Number.isFinite(operand(arg, vars))))
16143
+ return void 0;
16144
+ const result2 = evaluateFormula(formula2, vars);
16145
+ if (!Number.isFinite(result2)) return void 0;
16146
+ vars.set(name3, result2);
16147
+ }
16148
+ }
16149
+ const paths = [];
16150
+ for (const path3 of pathNodes) {
16151
+ const commands = [];
16152
+ const value3 = (node3, name3) => operand(node3.getAttribute(name3), vars);
16153
+ for (const node3 of elements(path3)) {
16154
+ if (node3.namespaceURI !== NS.a) return void 0;
16155
+ const points = children(node3, "pt", NS.a).map((point2) => ({
16156
+ x: value3(point2, "x"),
16157
+ y: value3(point2, "y")
16158
+ }));
16159
+ if (points.some((point2) => !Number.isFinite(point2.x) || !Number.isFinite(point2.y)))
16160
+ return void 0;
16161
+ const [p0, p1, p2] = points;
16162
+ switch (node3.localName) {
16163
+ case "moveTo":
16164
+ case "lnTo":
16165
+ if (points.length !== 1 || !p0) return void 0;
16166
+ commands.push({ op: node3.localName === "moveTo" ? "M" : "L", ...p0 });
16167
+ break;
16168
+ case "quadBezTo":
16169
+ if (points.length !== 2 || !p0 || !p1) return void 0;
16170
+ commands.push({ op: "Q", x1: p0.x, y1: p0.y, ...p1 });
16171
+ break;
16172
+ case "cubicBezTo":
16173
+ if (points.length !== 3 || !p0 || !p1 || !p2) return void 0;
16174
+ commands.push({ op: "C", x1: p0.x, y1: p0.y, x2: p1.x, y2: p1.y, ...p2 });
16175
+ break;
16176
+ case "arcTo": {
16177
+ const wR = value3(node3, "wR");
16178
+ const hR = value3(node3, "hR");
16179
+ const start = value3(node3, "stAng");
16180
+ const swing = value3(node3, "swAng");
16181
+ if (![wR, hR, start, swing].every(Number.isFinite)) return void 0;
16182
+ commands.push({ op: "A", wR, hR, startAngle: start / 6e4, swingAngle: swing / 6e4 });
16183
+ break;
16184
+ }
16185
+ case "close":
16186
+ commands.push({ op: "Z" });
16187
+ break;
16188
+ default:
16189
+ return void 0;
16190
+ }
16191
+ }
16192
+ const pathWidth = path3.hasAttribute("w") ? Number(path3.getAttribute("w")) : contextWidth;
16193
+ const pathHeight = path3.hasAttribute("h") ? Number(path3.getAttribute("h")) : contextHeight;
16194
+ if (![pathWidth, pathHeight].every((n) => Number.isFinite(n) && n > 0)) return void 0;
16195
+ paths.push({
16196
+ commands,
16197
+ width: pathWidth,
16198
+ height: pathHeight,
16199
+ ...path3.getAttribute("fill") ? { fill: path3.getAttribute("fill") } : {},
16200
+ ...["0", "false"].includes(path3.getAttribute("stroke") ?? "") ? { stroke: false } : {}
16201
+ });
16202
+ }
16203
+ return paths.length ? paths : void 0;
16204
+ }
16205
+
15578
16206
  // drawingml/drawing-geometry.ts
15579
16207
  var int = (element2, name3) => Number.parseInt(element2?.getAttribute(name3) ?? "", 10);
15580
16208
  function parseFrame(container) {
@@ -15599,74 +16227,13 @@ function parseTransform(xfrm) {
15599
16227
  ...booleanAttribute(xfrm, "flipV") ? { flipVertical: true } : {}
15600
16228
  };
15601
16229
  }
15602
- function parsePathCommands(path3) {
15603
- const commands = [];
15604
- const point2 = (element2) => {
15605
- const x = int(element2, "x");
15606
- const y = int(element2, "y");
15607
- return Number.isFinite(x) && Number.isFinite(y) ? { x, y } : void 0;
15608
- };
15609
- for (const element2 of Array.from(path3.childNodes)) {
15610
- if (element2.nodeType !== 1) continue;
15611
- const node3 = element2;
15612
- const points = children(node3, "pt", NS.a).map(point2);
15613
- if (points.some((entry3) => entry3 === void 0)) return void 0;
15614
- const [p0, p1, p2] = points;
15615
- switch (node3.localName) {
15616
- case "moveTo":
15617
- case "lnTo":
15618
- if (!p0) return void 0;
15619
- commands.push({ op: node3.localName === "moveTo" ? "M" : "L", ...p0 });
15620
- break;
15621
- case "cubicBezTo":
15622
- if (!p0 || !p1 || !p2) return void 0;
15623
- commands.push({ op: "C", x1: p0.x, y1: p0.y, x2: p1.x, y2: p1.y, x: p2.x, y: p2.y });
15624
- break;
15625
- case "quadBezTo":
15626
- if (!p0 || !p1) return void 0;
15627
- commands.push({ op: "Q", x1: p0.x, y1: p0.y, x: p1.x, y: p1.y });
15628
- break;
15629
- case "arcTo": {
15630
- const wR = int(node3, "wR");
15631
- const hR = int(node3, "hR");
15632
- const startAngle = int(node3, "stAng");
15633
- const swingAngle = int(node3, "swAng");
15634
- if (![wR, hR, startAngle, swingAngle].every(Number.isFinite)) return void 0;
15635
- commands.push({
15636
- op: "A",
15637
- wR,
15638
- hR,
15639
- startAngle: startAngle / 6e4,
15640
- swingAngle: swingAngle / 6e4
15641
- });
15642
- break;
15643
- }
15644
- case "close":
15645
- commands.push({ op: "Z" });
15646
- break;
15647
- }
15648
- }
15649
- return commands;
15650
- }
15651
16230
  function parseDrawingGeometry(spPr) {
15652
16231
  const preset = first(spPr, "prstGeom", NS.a);
15653
16232
  const custom = first(spPr, "custGeom", NS.a);
15654
16233
  if (custom) {
15655
- const paths = [];
15656
- for (const path3 of children(first(custom, "pathLst", NS.a) ?? custom, "path", NS.a)) {
15657
- const commands = parsePathCommands(path3);
15658
- if (!commands) return { geometry: "custom", issue: "CUSTOM_GEOMETRY_GUIDES_UNSUPPORTED" };
15659
- const width = int(path3, "w");
15660
- const height = int(path3, "h");
15661
- paths.push({
15662
- commands,
15663
- ...Number.isFinite(width) ? { width } : {},
15664
- ...Number.isFinite(height) ? { height } : {},
15665
- ...path3.getAttribute("fill") ? { fill: path3.getAttribute("fill") } : {},
15666
- ...path3.getAttribute("stroke") === "0" || path3.getAttribute("stroke") === "false" ? { stroke: false } : {}
15667
- });
15668
- }
15669
- return { geometry: "custom", paths };
16234
+ const frame = parseFrame(first(spPr, "xfrm", NS.a));
16235
+ const paths = parseCustomGeometry(custom, frame?.width ?? 21600, frame?.height ?? 21600);
16236
+ return paths ? { geometry: "custom", paths } : { geometry: "custom", issue: "CUSTOM_GEOMETRY_UNSUPPORTED" };
15670
16237
  }
15671
16238
  const geometry = preset?.getAttribute("prst") || "rect";
15672
16239
  const adjustments = {};
@@ -15738,7 +16305,8 @@ function parseShape(sp, index2, group2, issues) {
15738
16305
  if (transform2.flipVertical) shape.flipVertical = true;
15739
16306
  if (adjustments) shape.adjustments = adjustments;
15740
16307
  if (paths) shape.paths = paths;
15741
- const fill = parseDrawingFill(spPr);
16308
+ const picture = first(sp, "blipFill", NS.dsp);
16309
+ const fill = picture ? parseDrawingPictureFill(picture) : parseDrawingFill(spPr);
15742
16310
  if (fill) shape.fill = fill;
15743
16311
  const line = parseDrawingLine(first(spPr, "ln", NS.a));
15744
16312
  if (line) shape.line = line;
@@ -15767,15 +16335,15 @@ function parseDiagramDrawing(source, part) {
15767
16335
  for (const child4 of Array.from(container.childNodes)) {
15768
16336
  if (child4.nodeType !== 1) continue;
15769
16337
  const element2 = child4;
15770
- if (element2.localName === "sp") {
16338
+ if (element2.localName === "sp" || element2.localName === "pic") {
15771
16339
  const shape = parseShape(element2, counter++, group2, issues);
15772
16340
  if (shape) shapes.push(shape);
16341
+ else if (element2.localName === "pic")
16342
+ issues.push({
16343
+ code: "DIAGRAM_DRAWING_PICTURE_UNREADABLE",
16344
+ message: "A cached picture has no usable frame; its source is retained in the drawing part."
16345
+ });
15773
16346
  } else if (element2.localName === "grpSp") visit(element2, groupTransform(element2, group2));
15774
- else if (element2.localName === "pic")
15775
- issues.push({
15776
- code: "DIAGRAM_DRAWING_PICTURE_SKIPPED",
15777
- message: "A dsp:pic in the cached drawing is not modelled; the part still holds it."
15778
- });
15779
16347
  }
15780
16348
  };
15781
16349
  if (tree) visit(tree, IDENTITY2);
@@ -15870,7 +16438,29 @@ async function loadDiagram(hostPart, relationshipIds, host) {
15870
16438
  );
15871
16439
  return parseDiagramDrawing(xml, part);
15872
16440
  });
15873
- if (drawing) issues.push(...drawing.issues);
16441
+ if (drawing) {
16442
+ try {
16443
+ const entries = await host.readRelationshipEntries(
16444
+ diagramRelationshipsPart(drawingResolution.path)
16445
+ );
16446
+ const pictures = (entries ?? []).filter(
16447
+ (entry3) => entry3.type.endsWith("/image") && entry3.mode !== "External" && !/^[a-z][a-z0-9+.-]*:/i.test(entry3.target)
16448
+ );
16449
+ if (pictures.length)
16450
+ drawing.pictureParts = Object.fromEntries(
16451
+ pictures.map((entry3) => [
16452
+ entry3.id,
16453
+ host.resolvePath(drawingResolution.path, entry3.target)
16454
+ ])
16455
+ );
16456
+ } catch {
16457
+ issues.push({
16458
+ code: "DIAGRAM_PICTURE_RELATIONSHIPS_UNREADABLE",
16459
+ message: "Picture relationships in the cached drawing could not be read."
16460
+ });
16461
+ }
16462
+ issues.push(...drawing.issues);
16463
+ }
15874
16464
  } else if (data)
15875
16465
  issues.push({
15876
16466
  code: "DIAGRAM_DRAWING_ABSENT",
@@ -15945,10 +16535,11 @@ async function resolveOne(object, info, source) {
15945
16535
  const xml = source.text(relsPart);
15946
16536
  if (!xml) return void 0;
15947
16537
  try {
15948
- return [...parseRelationships(xml).values()].map(({ id: id3, type, target: target2 }) => ({
16538
+ return [...parseRelationships(xml).values()].map(({ id: id3, type, target: target2, mode }) => ({
15949
16539
  id: id3,
15950
16540
  type,
15951
- target: target2
16541
+ target: target2,
16542
+ ...mode ? { mode } : {}
15952
16543
  }));
15953
16544
  } catch {
15954
16545
  return void 0;
@@ -16398,7 +16989,7 @@ function readConditionalExtensions(sheet) {
16398
16989
  }
16399
16990
 
16400
16991
  // chart/read-appearance.ts
16401
- function readChartAppearance(text5, properties2) {
16992
+ function readChartAppearance(text5, properties) {
16402
16993
  const out = {};
16403
16994
  const size3 = Number(text5?.getAttribute("sz") ?? NaN);
16404
16995
  if (Number.isFinite(size3) && size3 > 0) out.fontSize = size3 / 100;
@@ -16415,8 +17006,8 @@ function readChartAppearance(text5, properties2) {
16415
17006
  if (typeface2) out.typeface = typeface2;
16416
17007
  const color2 = parseDrawingColorIn(first(text5, "solidFill", NS.a));
16417
17008
  if (color2) out.textColor = color2;
16418
- const fill = parseDrawingFill(properties2);
16419
- const line = parseDrawingLine(first(properties2, "ln", NS.a));
17009
+ const fill = parseDrawingFill(properties);
17010
+ const line = parseDrawingLine(first(properties, "ln", NS.a));
16420
17011
  if (fill) out.fill = fill;
16421
17012
  if (line) out.line = line;
16422
17013
  const effects = first(text5, "effectLst", NS.a);
@@ -17623,8 +18214,8 @@ function parseChartSpace(source) {
17623
18214
  }
17624
18215
 
17625
18216
  // chart/write-text-body.ts
17626
- function runProperties(local, properties2) {
17627
- const p = properties2 ?? {};
18217
+ function runProperties(local, properties) {
18218
+ const p = properties ?? {};
17628
18219
  const attributes = [
17629
18220
  p.sizePt === void 0 ? "" : ` sz="${Math.round(p.sizePt * 100)}"`,
17630
18221
  p.bold === void 0 ? "" : ` b="${p.bold ? 1 : 0}"`,
@@ -17640,16 +18231,16 @@ function spacing(local, value3) {
17640
18231
  return `<a:${local}>${inner}</a:${local}>`;
17641
18232
  }
17642
18233
  function run(value3) {
17643
- const { text: text5, ...properties2 } = value3;
17644
- const hasProperties = Object.keys(properties2).length > 0;
18234
+ const { text: text5, ...properties } = value3;
18235
+ const hasProperties = Object.keys(properties).length > 0;
17645
18236
  if (text5 === "\n")
17646
- return hasProperties ? `<a:br>${runProperties("rPr", properties2)}</a:br>` : "<a:br/>";
17647
- return `<a:r>${hasProperties ? runProperties("rPr", properties2) : ""}<a:t>${escapeText2(text5)}</a:t></a:r>`;
18237
+ return hasProperties ? `<a:br>${runProperties("rPr", properties)}</a:br>` : "<a:br/>";
18238
+ return `<a:r>${hasProperties ? runProperties("rPr", properties) : ""}<a:t>${escapeText2(text5)}</a:t></a:r>`;
17648
18239
  }
17649
18240
  function paragraph(value3) {
17650
18241
  const align = value3.align ? ` algn="${escapeAttribute(value3.align)}"` : "";
17651
- const properties2 = spacing("lnSpc", value3.lineSpacing) + spacing("spcBef", value3.spaceBefore) + spacing("spcAft", value3.spaceAfter) + runProperties("defRPr", value3.defaultProperties);
17652
- return `<a:p><a:pPr${align}>${properties2}</a:pPr>${value3.runs.map(run).join("")}</a:p>`;
18242
+ const properties = spacing("lnSpc", value3.lineSpacing) + spacing("spcBef", value3.spaceBefore) + spacing("spcAft", value3.spaceAfter) + runProperties("defRPr", value3.defaultProperties);
18243
+ return `<a:p><a:pPr${align}>${properties}</a:pPr>${value3.runs.map(run).join("")}</a:p>`;
17653
18244
  }
17654
18245
  function writeTextBody(body) {
17655
18246
  const insets = body.insetsEmu ?? {};
@@ -17786,7 +18377,7 @@ function dataSourceInner(source) {
17786
18377
  case "multiLvlStrRef": {
17787
18378
  const levels = source.levels ? elementXml(
17788
18379
  "multiLvlStrCache",
17789
- valXml("ptCount", source.levelPointCount) + source.levels.map((level2) => elementXml("lvl", cachePoints(level2))).join("")
18380
+ valXml("ptCount", source.levelPointCount) + source.levels.map((level3) => elementXml("lvl", cachePoints(level3))).join("")
17790
18381
  ) : "";
17791
18382
  return `<c:multiLvlStrRef>${formula2}${levels}</c:multiLvlStrRef>`;
17792
18383
  }
@@ -18178,13 +18769,13 @@ function parsePattern(code) {
18178
18769
  continue;
18179
18770
  }
18180
18771
  if (ch === "[") {
18181
- const close4 = code.indexOf("]", i);
18182
- const token = code.slice(i + 1, close4 === -1 ? code.length : close4);
18772
+ const close3 = code.indexOf("]", i);
18773
+ const token = code.slice(i + 1, close3 === -1 ? code.length : close3);
18183
18774
  const named2 = NAMED_FORMAT_COLORS[token.trim().toLowerCase()];
18184
18775
  if (named2 && color2 === void 0) {
18185
18776
  color2 = named2;
18186
18777
  }
18187
- i = close4 === -1 ? code.length : close4;
18778
+ i = close3 === -1 ? code.length : close3;
18188
18779
  continue;
18189
18780
  }
18190
18781
  chars.push({ ch, literal: false });
@@ -18414,6 +19005,9 @@ function composeDataLabelText(input) {
18414
19005
  // chart/render/summary-labels.ts
18415
19006
  function level(options2, custom) {
18416
19007
  const out = {};
19008
+ if (options2.layout) out.layout = options2.layout;
19009
+ if (options2.showLeaderLines !== void 0) out.showLeaderLines = options2.showLeaderLines;
19010
+ if (options2.leaderLines?.spPr?.line) out.leaderLine = options2.leaderLines.spPr.line;
18417
19011
  if (options2.deleted !== void 0) out.deleted = options2.deleted;
18418
19012
  if (options2.showValue !== void 0) out.showValue = options2.showValue;
18419
19013
  if (options2.showCategoryName !== void 0) out.showCategory = options2.showCategoryName;
@@ -18463,7 +19057,7 @@ var GROUP_TYPES = {
18463
19057
  surface: "surface"
18464
19058
  };
18465
19059
  var GROUPINGS = /* @__PURE__ */ new Set(["clustered", "stacked", "percentStacked", "standard"]);
18466
- function chartSummarySeries(source, chartType, groupLabels) {
19060
+ function chartSummarySeries(source, chartType, groupLabels, groupSmooth) {
18467
19061
  const categories = source.categories ?? source.xValues;
18468
19062
  const values = source.values ?? source.yValues;
18469
19063
  const numeric5 = (v) => typeof v === "number" ? v : v === "" ? null : Number.isFinite(Number(v)) ? Number(v) : null;
@@ -18471,6 +19065,9 @@ function chartSummarySeries(source, chartType, groupLabels) {
18471
19065
  categories: chartSourceValues(categories),
18472
19066
  values: chartSourceValues(values).map(numeric5)
18473
19067
  };
19068
+ const smooth = source.smooth ?? groupSmooth;
19069
+ if (smooth !== void 0) out.smooth = smooth;
19070
+ if (source.spPr?.line) out.line = source.spPr.line;
18474
19071
  if (values?.cache?.formatCode !== void 0) out.numberFormat = values.cache.formatCode;
18475
19072
  if (source.bubbleSizes) {
18476
19073
  out.bubbleSizes = chartSourceValues(source.bubbleSizes).map(numeric5);
@@ -18491,12 +19088,12 @@ function chartSummarySeries(source, chartType, groupLabels) {
18491
19088
  const points = {};
18492
19089
  const pointFills = {};
18493
19090
  for (const point2 of source.dataPoints) {
18494
- const properties2 = point2.spPr ?? point2.marker?.spPr;
19091
+ const properties = point2.spPr ?? point2.marker?.spPr;
18495
19092
  if (point2.index === void 0) continue;
18496
- const pointColor = solidColor(properties2?.fill);
19093
+ const pointColor = solidColor(properties?.fill);
18497
19094
  if (pointColor) points[point2.index] = pointColor;
18498
- if (properties2?.fill && properties2.fill.kind !== "solid")
18499
- pointFills[point2.index] = properties2.fill;
19095
+ if (properties?.fill && properties.fill.kind !== "solid")
19096
+ pointFills[point2.index] = properties.fill;
18500
19097
  }
18501
19098
  if (Object.keys(points).length) out.pointColors = points;
18502
19099
  if (Object.keys(pointFills).length) out.pointFills = pointFills;
@@ -18530,7 +19127,12 @@ function extraGroups(chartSpace, firstType) {
18530
19127
  const entry3 = {
18531
19128
  chartType: type,
18532
19129
  series: group2.series.map((source, index2) => ({
18533
- ...chartSummarySeries(source, type, group2.dataLabels),
19130
+ ...chartSummarySeries(
19131
+ source,
19132
+ type,
19133
+ group2.dataLabels,
19134
+ group2.smooth ?? (group2.scatterStyle ? ["smooth", "smoothMarker"].includes(group2.scatterStyle) : void 0)
19135
+ ),
18534
19136
  ...summaryMarkers(source, group2, index2)
18535
19137
  })),
18536
19138
  secondary: valueAxisId(chartSpace, group2.axisIds) !== primary
@@ -18551,8 +19153,14 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
18551
19153
  let chartType = group2 ? GROUP_TYPES[group2.kind] : "column";
18552
19154
  if (chartType === "bar" && group2?.barDirection !== "bar") chartType = "column";
18553
19155
  const series = (group2?.series ?? []).map((source, index2) => ({
18554
- ...chartSummarySeries(source, chartType, group2?.dataLabels),
18555
- ...group2 ? summaryMarkers(source, group2, index2) : {}
19156
+ ...chartSummarySeries(
19157
+ source,
19158
+ chartType,
19159
+ group2?.dataLabels,
19160
+ group2?.smooth ?? (group2?.scatterStyle ? ["smooth", "smoothMarker"].includes(group2.scatterStyle) : void 0)
19161
+ ),
19162
+ ...group2 ? summaryMarkers(source, group2, index2) : {},
19163
+ ...group2?.kind === "scatter" ? { showLine: !["marker", "none"].includes(group2.scatterStyle ?? "marker") } : {}
18556
19164
  }));
18557
19165
  const summary = {
18558
19166
  chartType,
@@ -18561,6 +19169,9 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
18561
19169
  axes: chartSpace.plotArea.axes,
18562
19170
  axisIds: group2?.axisIds ?? []
18563
19171
  };
19172
+ if (chartSpace.plotArea.dataTable) summary.dataTable = chartSpace.plotArea.dataTable;
19173
+ if (chartSpace.date1904 !== void 0) summary.date1904 = chartSpace.date1904;
19174
+ if (chartSpace.plotArea.layout) summary.plotLayout = chartSpace.plotArea.layout;
18564
19175
  const combined = extraGroups(chartSpace, chartType);
18565
19176
  if (combined.length) summary.extraGroups = combined;
18566
19177
  if (chartType === "stock" && group2) summary.stock = stockStyle(group2);
@@ -18640,6 +19251,9 @@ function chartObjectFromSpace(space, frame, root2) {
18640
19251
  showLegend: summary.showLegend
18641
19252
  };
18642
19253
  if (frame.partName !== void 0) object.partName = frame.partName;
19254
+ if (summary.dataTable) object.dataTable = summary.dataTable;
19255
+ if (summary.date1904 !== void 0) object.date1904 = summary.date1904;
19256
+ if (summary.plotLayout) object.plotLayout = summary.plotLayout;
18643
19257
  if (summary.axes) object.axes = summary.axes;
18644
19258
  if (summary.axisIds) object.axisIds = summary.axisIds;
18645
19259
  if (summary.grouping) object.grouping = summary.grouping;
@@ -18789,7 +19403,7 @@ function parseDimension(context, element2) {
18789
19403
  return assignDefined(
18790
19404
  {
18791
19405
  kind: element2.localName,
18792
- levels: cxChildren(element2, "lvl").map((level2) => parseLevel(context, level2))
19406
+ levels: cxChildren(element2, "lvl").map((level3) => parseLevel(context, level3))
18793
19407
  },
18794
19408
  {
18795
19409
  type: attribute3(element2, "type"),
@@ -19200,6 +19814,41 @@ function parseChartExSpace(source) {
19200
19814
  return { chartExSpace, issues: context.issues };
19201
19815
  }
19202
19816
 
19817
+ // chart/render/summary-ex-series.ts
19818
+ var level2 = (source) => ({
19819
+ ...source.visibility?.value === void 0 ? {} : { showValue: source.visibility.value },
19820
+ ...source.visibility?.categoryName === void 0 ? {} : { showCategory: source.visibility.categoryName },
19821
+ ...source.visibility?.seriesName === void 0 ? {} : { showSeriesName: source.visibility.seriesName },
19822
+ ...source.position ? { position: source.position } : {},
19823
+ ...source.numberFormat?.formatCode ? { numberFormat: source.numberFormat.formatCode } : {},
19824
+ ...source.separator === void 0 ? {} : { separator: source.separator }
19825
+ });
19826
+ function chartExSeriesPaint(source, series, defaultValues = false) {
19827
+ const fill = source.spPr?.fill;
19828
+ if (fill) series.fill = fill;
19829
+ const points = {};
19830
+ const fills = {};
19831
+ for (const point2 of source.dataPoints) {
19832
+ if (point2.index === void 0) continue;
19833
+ const fill2 = point2.spPr?.fill;
19834
+ if (fill2?.kind === "solid") points[point2.index] = fill2.color;
19835
+ else if (fill2) fills[point2.index] = fill2;
19836
+ }
19837
+ if (Object.keys(points).length) series.pointColors = points;
19838
+ if (Object.keys(fills).length) series.pointFills = fills;
19839
+ const labels = source.dataLabels;
19840
+ if (!labels && !defaultValues) return;
19841
+ const overrides = {};
19842
+ for (const label of labels?.labels ?? [])
19843
+ if (label.index !== void 0) overrides[label.index] = level2(label);
19844
+ for (const index2 of labels?.hidden ?? [])
19845
+ overrides[index2] = { ...overrides[index2], deleted: true };
19846
+ series.dataLabels = {
19847
+ series: { showValue: defaultValues, ...labels ? level2(labels) : {} },
19848
+ points: overrides
19849
+ };
19850
+ }
19851
+
19203
19852
  // chart/render/summary-from-chartex.ts
19204
19853
  function seriesData(space, series) {
19205
19854
  if (series.data) return series.data;
@@ -19207,17 +19856,17 @@ function seriesData(space, series) {
19207
19856
  return series.dataId === void 0 ? shared[0] : shared.find((data) => data.id === series.dataId);
19208
19857
  }
19209
19858
  var findDimension = (data, kind, type) => data?.dimensions.find((d) => d.kind === kind && (d.type ?? "") === type);
19210
- function levelPoints(level2) {
19859
+ function levelPoints(level3) {
19211
19860
  const points = [];
19212
- for (const point2 of level2.points) points[point2.index ?? points.length] = point2.value.trim();
19213
- for (let i = 0; i < Math.max(level2.pointCount ?? 0, points.length); i++) points[i] ??= "";
19861
+ for (const point2 of level3.points) points[point2.index ?? points.length] = point2.value.trim();
19862
+ for (let i = 0; i < Math.max(level3.pointCount ?? 0, points.length); i++) points[i] ??= "";
19214
19863
  return points;
19215
19864
  }
19216
19865
  function dimension(data, kind, type) {
19217
19866
  const element2 = findDimension(data, kind, type);
19218
19867
  if (!element2) return void 0;
19219
- const level2 = element2.levels[0];
19220
- const out = { points: level2 ? levelPoints(level2) : [] };
19868
+ const level3 = element2.levels[0];
19869
+ const out = { points: level3 ? levelPoints(level3) : [] };
19221
19870
  const formula2 = element2.formula?.formula.trim();
19222
19871
  if (formula2) out.formula = formula2;
19223
19872
  return out;
@@ -19281,13 +19930,8 @@ function chartExFormatting() {
19281
19930
  }
19282
19931
  };
19283
19932
  }
19284
- function chartExSummaryFromModel(space) {
19285
- const all = space.plotArea.series;
19286
- const primary = all.find((s) => s.layoutId !== "paretoLine") ?? all[0];
19287
- const layoutId = primary?.layoutId ?? "";
19288
- const chartType = layoutId === "waterfall" ? "waterfall" : layoutId === "clusteredColumn" ? "histogram" : layoutId === "treemap" || layoutId === "sunburst" ? layoutId : void 0;
19289
- if (!primary || !chartType) return { layoutId };
19290
- const data = seriesData(space, primary);
19933
+ function summarySeries(space, source, chartType) {
19934
+ const data = seriesData(space, source);
19291
19935
  const categories = dimension(data, "strDim", "cat");
19292
19936
  const values = dimension(
19293
19937
  data,
@@ -19299,17 +19943,63 @@ function chartExSummaryFromModel(space) {
19299
19943
  values: (values?.points ?? []).map(
19300
19944
  (p) => p !== "" && Number.isFinite(Number(p)) ? Number(p) : null
19301
19945
  ),
19302
- ...seriesFill(primary)
19946
+ ...seriesFill(source)
19303
19947
  };
19304
- const name3 = primary.tx?.value?.trim();
19948
+ if (chartType === "funnel" || chartType === "boxWhisker") {
19949
+ chartExSeriesPaint(source, series, chartType === "funnel" && source.dataLabels !== void 0);
19950
+ if (source.hidden !== void 0) series.hidden = source.hidden;
19951
+ }
19952
+ if (chartType === "boxWhisker") series.boxWhisker = source.layoutProperties ?? {};
19953
+ const name3 = source.tx?.value?.trim();
19305
19954
  if (name3) series.name = name3;
19306
- const nameRef = primary.tx?.formula?.formula.trim();
19955
+ const nameRef = source.tx?.formula?.formula.trim();
19307
19956
  if (nameRef) series.nameRef = nameRef;
19308
19957
  if (categories?.formula) series.categoriesRef = categories.formula;
19309
19958
  if (values?.formula) series.valuesRef = values.formula;
19959
+ return series;
19960
+ }
19961
+ function chartExSummaryFromModel(space) {
19962
+ const all = space.plotArea.series;
19963
+ const primary = all.find((s) => s.layoutId !== "paretoLine") ?? all[0];
19964
+ const layoutId = primary?.layoutId ?? "";
19965
+ const chartType = layoutId === "waterfall" ? "waterfall" : layoutId === "clusteredColumn" ? "histogram" : layoutId === "treemap" || layoutId === "sunburst" || layoutId === "funnel" || layoutId === "boxWhisker" ? layoutId : void 0;
19966
+ if (!primary || !chartType) return { layoutId };
19967
+ const series = summarySeries(space, primary, chartType);
19310
19968
  const layout = primary.layoutProperties;
19311
19969
  const legend = space.legend;
19312
- const summary = { chartType, series: [series], showLegend: legend !== void 0 };
19970
+ const summary = {
19971
+ chartType,
19972
+ series: chartType === "boxWhisker" ? all.filter((s) => s.layoutId === "boxWhisker").map((source) => summarySeries(space, source, chartType)) : [series],
19973
+ showLegend: legend !== void 0
19974
+ };
19975
+ if (chartType === "boxWhisker") {
19976
+ summary.axes = space.plotArea.axes.flatMap((axis) => {
19977
+ const scaling = axis.scaling;
19978
+ if (!scaling) return [];
19979
+ const value3 = scaling.kind === "val";
19980
+ return [
19981
+ {
19982
+ kind: value3 ? "val" : "cat",
19983
+ ...axis.id === void 0 ? {} : { id: axis.id },
19984
+ position: value3 ? "l" : "b",
19985
+ deleted: axis.hidden ?? false,
19986
+ scaling: {
19987
+ ...value3 && typeof scaling.min === "number" ? { min: scaling.min } : {},
19988
+ ...value3 && typeof scaling.max === "number" ? { max: scaling.max } : {}
19989
+ },
19990
+ majorGridlines: !!axis.majorGridlines,
19991
+ minorGridlines: !!axis.minorGridlines,
19992
+ ...axis.majorGridlines?.spPr ? { majorGridlinesSpPr: axis.majorGridlines.spPr } : {},
19993
+ ...axis.minorGridlines?.spPr ? { minorGridlinesSpPr: axis.minorGridlines.spPr } : {},
19994
+ ...value3 && typeof scaling.majorUnit === "number" ? { majorUnit: scaling.majorUnit } : {},
19995
+ ...value3 && typeof scaling.minorUnit === "number" ? { minorUnit: scaling.minorUnit } : {},
19996
+ ...axis.spPr ? { spPr: axis.spPr } : {},
19997
+ ...axis.numberFormat ? { numberFormat: axis.numberFormat } : {},
19998
+ ...axis.tickLabels ? {} : { tickLabelPosition: "none" }
19999
+ }
20000
+ ];
20001
+ });
20002
+ }
19313
20003
  summary.formatting = chartExFormatting();
19314
20004
  const title = titleOf(space);
19315
20005
  if (title) summary.title = title;
@@ -19324,11 +20014,11 @@ function chartExSummaryFromModel(space) {
19324
20014
  } else if (chartType === "treemap" || chartType === "sunburst") {
19325
20015
  const parentLayout = layout?.parentLabelLayout;
19326
20016
  summary.hierarchy = {
19327
- levels: categoryLevels(data),
20017
+ levels: categoryLevels(seriesData(space, primary)),
19328
20018
  dataLabels: primary.dataLabels !== void 0,
19329
20019
  ...parentLayout === "none" || parentLayout === "banner" || parentLayout === "overlapping" ? { parentLabelLayout: parentLayout } : {}
19330
20020
  };
19331
- } else summary.histogram = histogramOptions(primary);
20021
+ } else if (chartType === "histogram") summary.histogram = histogramOptions(primary);
19332
20022
  return { layoutId, summary };
19333
20023
  }
19334
20024
 
@@ -19536,7 +20226,8 @@ function parseDrawing(source, partName, warn) {
19536
20226
  const cNvPr = nonVisual(content2);
19537
20227
  const name3 = att(cNvPr, "name");
19538
20228
  if (content2.localName === "pic") {
19539
- const blip = first(xdr(content2, "blipFill"), "blip", NS.a);
20229
+ const blipFill = xdr(content2, "blipFill");
20230
+ const blip = first(blipFill, "blip", NS.a);
19540
20231
  const rel = rels.get(relAttr(blip, "embed") ?? "");
19541
20232
  const target2 = rel ? source.target(partName, rel) : void 0;
19542
20233
  if (!target2 || !source.has(target2)) {
@@ -19546,6 +20237,9 @@ function parseDrawing(source, partName, warn) {
19546
20237
  const image = {
19547
20238
  kind: "image",
19548
20239
  anchor,
20240
+ sourceXml: selfContainedXml(anchorEl),
20241
+ ...parsePictureCrop(blipFill) ? { crop: parsePictureCrop(blipFill) } : {},
20242
+ ...parsePictureEffects(blip).length ? { effects: parsePictureEffects(blip) } : {},
19549
20243
  partName: target2,
19550
20244
  contentType: source.contentType(target2) ?? "application/octet-stream"
19551
20245
  };
@@ -20176,7 +20870,7 @@ async function loadXlsx(input, options2 = {}) {
20176
20870
  const corePart = source.targetOfType("", RELATIONSHIP_TYPES.coreProperties);
20177
20871
  const appPart = source.targetOfType("", RELATIONSHIP_TYPES.extendedProperties);
20178
20872
  const customPart = source.targetOfType("", RELATIONSHIP_TYPES.customProperties);
20179
- const properties2 = readProperties(
20873
+ const properties = readProperties(
20180
20874
  corePart ? source.text(corePart) : void 0,
20181
20875
  appPart ? source.text(appPart) : void 0,
20182
20876
  customPart ? source.text(customPart) : void 0,
@@ -20190,7 +20884,7 @@ async function loadXlsx(input, options2 = {}) {
20190
20884
  theme: parseTheme2(themePart ? source.text(themePart) : void 0),
20191
20885
  activeSheet: Math.min(Math.max(0, book.activeTab), Math.max(0, sheets.length - 1)),
20192
20886
  date1904: book.date1904,
20193
- properties: properties2,
20887
+ properties,
20194
20888
  source: { parts },
20195
20889
  format: MACRO_TYPES.has(contentType2) ? "xlsm" : "xlsx",
20196
20890
  warnings
@@ -20520,10 +21214,10 @@ var STOCK_DEFAULT_WICK_COLOR = "#334155";
20520
21214
 
20521
21215
  // chart/hierarchy.ts
20522
21216
  function normalizeLevels(levels, pointCount) {
20523
- return levels.map((level2) => {
21217
+ return levels.map((level3) => {
20524
21218
  let previous = "";
20525
21219
  return Array.from({ length: pointCount }, (_, index2) => {
20526
- const label = level2[index2]?.trim() ?? "";
21220
+ const label = level3[index2]?.trim() ?? "";
20527
21221
  if (label) previous = label;
20528
21222
  return label || previous;
20529
21223
  });
@@ -20709,9 +21403,6 @@ function resolveChartGradient(fill, resolve) {
20709
21403
  };
20710
21404
  }
20711
21405
 
20712
- // chart/render/chart-svg-util.ts
20713
- var TEXT_COLOR = "#595959";
20714
-
20715
21406
  // chart/render/chart-colors.ts
20716
21407
  function chartColorScheme(theme2) {
20717
21408
  const slots = Object.fromEntries(
@@ -20818,6 +21509,9 @@ function chartAppearance(chart, theme2) {
20818
21509
  return out;
20819
21510
  }
20820
21511
 
21512
+ // chart/render/chart-svg-util.ts
21513
+ var TEXT_COLOR = "#595959";
21514
+
20821
21515
  // chart/render/chart-scale.ts
20822
21516
  var clean = (n) => Number(n.toPrecision(12));
20823
21517
  function* units2(raw2) {
@@ -21071,6 +21765,50 @@ function applyChartAxes(model2, chart, color2) {
21071
21765
  model2.axes = out;
21072
21766
  }
21073
21767
 
21768
+ // chart/render/chart-title-text.ts
21769
+ function chartRunStyle(run2) {
21770
+ return {
21771
+ ...run2.sizePt === void 0 ? {} : { fontSize: run2.sizePt },
21772
+ ...run2.bold === void 0 ? {} : { bold: run2.bold },
21773
+ ...run2.italic === void 0 ? {} : { italic: run2.italic },
21774
+ ...run2.underline === void 0 ? {} : { underline: run2.underline },
21775
+ ...run2.typeface === void 0 ? {} : { typeface: run2.typeface },
21776
+ ...run2.color === void 0 ? {} : { textColor: run2.color }
21777
+ };
21778
+ }
21779
+ function chartTitleText(chart, theme2) {
21780
+ const formatting = chart.formatting;
21781
+ const entry3 = formatting?.entries.title;
21782
+ const body = entry3?.textBody;
21783
+ if (!formatting || !body || body.text !== chart.title) return void 0;
21784
+ if (body.paragraphs.length === 1 && body.paragraphs[0].runs.length <= 1 && !body.text.includes("\n") && !body.paragraphs[0].lineSpacing && !body.paragraphs[0].spaceBefore && !body.paragraphs[0].spaceAfter)
21785
+ return void 0;
21786
+ return {
21787
+ paragraphs: body.paragraphs.map((paragraph2) => ({
21788
+ ...paragraph2.align ? { align: paragraph2.align } : {},
21789
+ ...paragraph2.lineSpacing ? { lineSpacing: paragraph2.lineSpacing } : {},
21790
+ ...paragraph2.spaceBefore ? { spaceBefore: paragraph2.spaceBefore } : {},
21791
+ ...paragraph2.spaceAfter ? { spaceAfter: paragraph2.spaceAfter } : {},
21792
+ runs: paragraph2.runs.map((run2) => {
21793
+ const direct = {
21794
+ sourceXml: "",
21795
+ ...entry3.textBodyStyle,
21796
+ ...chartRunStyle(paragraph2.defaultProperties ?? {}),
21797
+ ...chartRunStyle(run2)
21798
+ };
21799
+ const appearance = chartAppearance(
21800
+ {
21801
+ ...chart,
21802
+ formatting: { ...formatting, entries: { ...formatting.entries, title: direct } }
21803
+ },
21804
+ theme2
21805
+ )?.title ?? {};
21806
+ return { text: run2.text, appearance };
21807
+ })
21808
+ }))
21809
+ };
21810
+ }
21811
+
21074
21812
  // chart/render/chart-view-analysis.ts
21075
21813
  function strokeOf(line, fallback, resolve) {
21076
21814
  if (line?.fill?.kind === "none") return void 0;
@@ -21098,6 +21836,40 @@ function analysisView(source, seriesColor, resolve) {
21098
21836
  };
21099
21837
  }
21100
21838
 
21839
+ // chart/render/chart-view-data-table.ts
21840
+ function chartDataTableView(chart, theme2, color2) {
21841
+ const source = chart.dataTable;
21842
+ if (!source) return void 0;
21843
+ const props = source.txPr?.paragraphs[0];
21844
+ const direct = {
21845
+ sourceXml: "",
21846
+ ...chartRunStyle(props?.defaultProperties ?? {}),
21847
+ ...chartRunStyle(props?.runs[0] ?? {})
21848
+ };
21849
+ const formatting = chart.formatting;
21850
+ const appearance = chartAppearance(
21851
+ {
21852
+ ...chart,
21853
+ formatting: {
21854
+ ...formatting,
21855
+ sourceXml: formatting?.sourceXml ?? "",
21856
+ entries: { ...formatting?.entries, categoryAxis: direct }
21857
+ }
21858
+ },
21859
+ theme2
21860
+ );
21861
+ const fill = source.spPr?.fill;
21862
+ return {
21863
+ source,
21864
+ stroke: strokeOf(source.spPr?.line, { color: "#D9D9D9", width: 1 }, color2) ?? {
21865
+ color: "none",
21866
+ width: 0
21867
+ },
21868
+ ...fill?.kind === "solid" && color2(fill.color) ? { fill: color2(fill.color) } : {},
21869
+ ...appearance?.categoryAxis ? { text: appearance.categoryAxis } : {}
21870
+ };
21871
+ }
21872
+
21101
21873
  // chart/render/chart-view-series.ts
21102
21874
  var isRefError = (value3) => typeof value3 === "object" && value3 !== null && "error" in value3;
21103
21875
  function toText(value3) {
@@ -21139,7 +21911,8 @@ function seriesContext(chart, theme2, options2) {
21139
21911
  function seriesView(ctx, s, index2, total, categoriesOf) {
21140
21912
  const { theme: theme2, scheme, palette, evaluateRef: evaluateRef2 } = ctx;
21141
21913
  const values = resolveRef(s.valuesRef, evaluateRef2)?.map(toNumber) ?? s.values.map(toNumber);
21142
- categoriesOf(resolveRef(s.categoriesRef, evaluateRef2) ?? s.categories);
21914
+ const categoryValues = resolveRef(s.categoriesRef, evaluateRef2) ?? s.categories;
21915
+ categoriesOf(categoryValues);
21143
21916
  const paletteColor2 = palette && chartPaletteSeriesColor(palette, index2, total, scheme);
21144
21917
  const color2 = s.fill?.kind === "none" ? "none" : ctx.drawingColor(s.fill?.kind === "solid" ? s.fill.color : s.drawingColor) ?? ctx.seriesColor?.(s, index2) ?? paletteColor2 ?? autoSeriesColor(theme2, index2);
21145
21918
  const view2 = {
@@ -21148,6 +21921,19 @@ function seriesView(ctx, s, index2, total, categoriesOf) {
21148
21921
  color: color2,
21149
21922
  sourceIndex: index2
21150
21923
  };
21924
+ if (s.hidden !== void 0) view2.hidden = s.hidden;
21925
+ if (s.boxWhisker) {
21926
+ view2.boxWhisker = s.boxWhisker;
21927
+ view2.boxCategories = categoryValues.map(toText);
21928
+ }
21929
+ if (s.numberFormat !== void 0) view2.numberFormat = s.numberFormat;
21930
+ if (s.showLine !== void 0) view2.showLine = s.showLine;
21931
+ if (s.smooth !== void 0) view2.smooth = s.smooth;
21932
+ if (s.line)
21933
+ view2.stroke = strokeOf(s.line, { color: color2, width: 2.25 }, ctx.drawingColor) ?? {
21934
+ color: "none",
21935
+ width: 0
21936
+ };
21151
21937
  const shadow = resolveDrawingShadowXml(s.effectsXml, { scheme: (name3) => scheme[name3] });
21152
21938
  if (shadow) view2.shadow = shadow;
21153
21939
  const resolvedGradient = ctx.gradient(s.fill);
@@ -21287,52 +22073,8 @@ function valueAxis(model2) {
21287
22073
  return { ...niceScale(min, max), percent: false };
21288
22074
  }
21289
22075
 
21290
- // chart/render/chart-title-text.ts
21291
- function properties(run2) {
21292
- return {
21293
- ...run2.sizePt === void 0 ? {} : { fontSize: run2.sizePt },
21294
- ...run2.bold === void 0 ? {} : { bold: run2.bold },
21295
- ...run2.italic === void 0 ? {} : { italic: run2.italic },
21296
- ...run2.underline === void 0 ? {} : { underline: run2.underline },
21297
- ...run2.typeface === void 0 ? {} : { typeface: run2.typeface },
21298
- ...run2.color === void 0 ? {} : { textColor: run2.color }
21299
- };
21300
- }
21301
- function chartTitleText(chart, theme2) {
21302
- const formatting = chart.formatting;
21303
- const entry3 = formatting?.entries.title;
21304
- const body = entry3?.textBody;
21305
- if (!formatting || !body || body.text !== chart.title) return void 0;
21306
- if (body.paragraphs.length === 1 && body.paragraphs[0].runs.length <= 1 && !body.text.includes("\n") && !body.paragraphs[0].lineSpacing && !body.paragraphs[0].spaceBefore && !body.paragraphs[0].spaceAfter)
21307
- return void 0;
21308
- return {
21309
- paragraphs: body.paragraphs.map((paragraph2) => ({
21310
- ...paragraph2.align ? { align: paragraph2.align } : {},
21311
- ...paragraph2.lineSpacing ? { lineSpacing: paragraph2.lineSpacing } : {},
21312
- ...paragraph2.spaceBefore ? { spaceBefore: paragraph2.spaceBefore } : {},
21313
- ...paragraph2.spaceAfter ? { spaceAfter: paragraph2.spaceAfter } : {},
21314
- runs: paragraph2.runs.map((run2) => {
21315
- const direct = {
21316
- sourceXml: "",
21317
- ...entry3.textBodyStyle,
21318
- ...properties(paragraph2.defaultProperties ?? {}),
21319
- ...properties(run2)
21320
- };
21321
- const appearance = chartAppearance(
21322
- {
21323
- ...chart,
21324
- formatting: { ...formatting, entries: { ...formatting.entries, title: direct } }
21325
- },
21326
- theme2
21327
- )?.title ?? {};
21328
- return { text: run2.text, appearance };
21329
- })
21330
- }))
21331
- };
21332
- }
21333
-
21334
22076
  // chart/render/chart-view-labels.ts
21335
- function labelsOf(source, view2, categories, numberFormat3) {
22077
+ function labelsOf(source, view2, categories, numberFormat3, resolveColor2) {
21336
22078
  const { chart, series, points } = source;
21337
22079
  if ((series?.deleted ?? chart?.deleted) === true) return void 0;
21338
22080
  const percentBase = view2.values.reduce(
@@ -21368,19 +22110,35 @@ function labelsOf(source, view2, categories, numberFormat3) {
21368
22110
  });
21369
22111
  }
21370
22112
  if (!built) return;
22113
+ const layout = point2?.layout;
22114
+ const showLeaderLines = series?.showLeaderLines ?? chart?.showLeaderLines;
22115
+ const leaderLine = strokeOf(
22116
+ series?.leaderLine ?? chart?.leaderLine,
22117
+ { color: "#94a3b8", width: 0.75 },
22118
+ resolveColor2
22119
+ ) ?? { color: "none", width: 0 };
21371
22120
  any = true;
21372
22121
  out[i] = {
21373
22122
  text: built.text,
22123
+ ...layout ? { layout } : {},
22124
+ ...showLeaderLines !== void 0 ? { showLeaderLines } : {},
22125
+ ...leaderLine ? { leaderLine } : {},
21374
22126
  ...position ? { position } : {},
21375
22127
  ...built.color ? { color: built.color } : {}
21376
22128
  };
21377
22129
  });
21378
22130
  return any ? out : void 0;
21379
22131
  }
21380
- function applyDataLabels(model2, sources, extra) {
22132
+ function applyDataLabels(model2, sources, extra, resolveColor2) {
21381
22133
  const apply3 = (source, view2) => {
21382
22134
  if (!source?.dataLabels) return;
21383
- const labels = labelsOf(source.dataLabels, view2, model2.categories, source.numberFormat);
22135
+ const labels = labelsOf(
22136
+ source.dataLabels,
22137
+ view2,
22138
+ model2.categories,
22139
+ source.numberFormat,
22140
+ resolveColor2
22141
+ );
21384
22142
  if (labels) view2.labels = labels;
21385
22143
  };
21386
22144
  model2.series.forEach((view2, i) => apply3(sources[i], view2));
@@ -21485,7 +22243,9 @@ var SUPPORTED = /* @__PURE__ */ new Set([
21485
22243
  "bubble",
21486
22244
  "stock",
21487
22245
  "treemap",
21488
- "sunburst"
22246
+ "sunburst",
22247
+ "funnel",
22248
+ "boxWhisker"
21489
22249
  ]);
21490
22250
  function chartSummaryView(chart, theme2, options2 = {}) {
21491
22251
  const type = chart.chartType;
@@ -21543,10 +22303,17 @@ function chartSummaryView(chart, theme2, options2 = {}) {
21543
22303
  showLegend: chart.showLegend,
21544
22304
  legendPosition: chart.legendPosition ?? "r",
21545
22305
  categories,
21546
- series,
22306
+ series: type === "boxWhisker" ? series.filter((s) => !s.hidden) : series,
21547
22307
  horizontal: type === "bar",
21548
22308
  supported: SUPPORTED.has(type)
21549
22309
  };
22310
+ const table2 = chartDataTableView(chart, theme2, ctx.drawingColor);
22311
+ if (table2) model2.dataTable = table2;
22312
+ if (chart.date1904 !== void 0) model2.date1904 = chart.date1904;
22313
+ if (chart.axes?.some((a2) => a2.kind === "date")) model2.dateCategories = firstCats.map(toNumber);
22314
+ if (chart.plotLayout) model2.plotLayout = chart.plotLayout;
22315
+ if (type === "boxWhisker")
22316
+ model2.categories = [...new Set(model2.series.flatMap((s) => s.boxCategories ?? []))];
21550
22317
  if (chart.title) model2.title = chart.title;
21551
22318
  const titleFormatting = chart.formatting?.entries.title;
21552
22319
  if (titleFormatting?.layout) model2.titleLayout = titleFormatting.layout;
@@ -21568,6 +22335,11 @@ function chartSummaryView(chart, theme2, options2 = {}) {
21568
22335
  const range2 = extentOf(xs);
21569
22336
  model2.xAxis = xs.length ? niceScale(range2.min, range2.max) : niceScale(0, 1);
21570
22337
  }
22338
+ if (type === "funnel" || type === "boxWhisker")
22339
+ series.forEach((s, i) => {
22340
+ const points = chart.series[i]?.pointColors;
22341
+ if (points) s.pointColors = s.values.map((_, j) => drawingColor2(points[j]) ?? s.color);
22342
+ });
21571
22343
  if (type === "stock") model2.stock = stockView(chart.stock, ctx);
21572
22344
  if (type === "bubble") bubbleView(chart, model2, ctx.evaluateRef);
21573
22345
  if (type === "treemap" || type === "sunburst") hierarchyView(chart, model2, ctx.evaluateRef);
@@ -21576,7 +22348,7 @@ function chartSummaryView(chart, theme2, options2 = {}) {
21576
22348
  chartExtraView(chart, model2, ctx, total, collect);
21577
22349
  if (type === "waterfall") waterfallView(chart, model2, ctx);
21578
22350
  else if (!byPoint) model2.valueAxis = valueAxis(model2);
21579
- applyDataLabels(model2, chart.series, extra);
22351
+ applyDataLabels(model2, chart.series, extra, ctx.drawingColor);
21580
22352
  chartExtraAxes(model2);
21581
22353
  applyChartAxes(model2, chart, ctx.drawingColor);
21582
22354
  return model2;
@@ -21640,10 +22412,14 @@ function withHierarchyRanges(workbook, chart) {
21640
22412
  }
21641
22413
  function chartView(workbook, sheetIndex, chart, evaluateRef2) {
21642
22414
  const theme2 = workbook.theme;
21643
- return chartSummaryView(withHierarchyRanges(workbook, chart), theme2, {
21644
- evaluateRef: evaluateRef2,
21645
- seriesColor: (series) => resolveColor(series.color, theme2)
21646
- });
22415
+ return chartSummaryView(
22416
+ { ...withHierarchyRanges(workbook, chart), date1904: chart.date1904 ?? workbook.date1904 },
22417
+ theme2,
22418
+ {
22419
+ evaluateRef: evaluateRef2,
22420
+ seriesColor: (series) => resolveColor(series.color, theme2)
22421
+ }
22422
+ );
21647
22423
  }
21648
22424
 
21649
22425
  // xlsx/ui/dialogs/insert-chart-model.ts
@@ -22307,7 +23083,7 @@ function extension(node3, name3) {
22307
23083
  (ext) => themeChildren(ext, name3, THEME_NS)
22308
23084
  )[0];
22309
23085
  }
22310
- function integer3(value3) {
23086
+ function integer4(value3) {
22311
23087
  if (!value3 || !/^\d{1,6}$/.test(value3)) return void 0;
22312
23088
  return Number(value3);
22313
23089
  }
@@ -22333,7 +23109,7 @@ function drawingPaint(node3, colors, placeholder3, depth = 0) {
22333
23109
  if (!color2 || color2.transforms.length > 32) return void 0;
22334
23110
  const transforms = color2.transforms.filter((transform2) => transform2.name !== "hueMod");
22335
23111
  if (transforms.some(
22336
- (transform2) => !SUPPORTED_TRANSFORMS.has(transform2.name) || (integer3(transform2.value) ?? 100001) > 1e5
23112
+ (transform2) => !SUPPORTED_TRANSFORMS.has(transform2.name) || (integer4(transform2.value) ?? 100001) > 1e5
22337
23113
  ))
22338
23114
  return void 0;
22339
23115
  let rgb6;
@@ -22365,7 +23141,7 @@ function drawingColor(node3, colors, placeholder3) {
22365
23141
  }
22366
23142
 
22367
23143
  // visio/theme-resolve.ts
22368
- var cellNumber = (cells4, name3) => integer3(cells4?.get(name3)?.value);
23144
+ var cellNumber = (cells4, name3) => integer4(cells4?.get(name3)?.value);
22369
23145
  function rootThemeSelected(cells4, resources) {
22370
23146
  const local = cellNumber(cells4, "ColorSchemeIndex");
22371
23147
  return local === 0 || local === 65534 && cellNumber(resources.pageCells, "ColorSchemeIndex") === 0;
@@ -22423,7 +23199,7 @@ function themeFormat(cells4, category, resources) {
22423
23199
  if (matrix3 !== void 0 && matrix3 >= 100 && matrix3 <= 103) {
22424
23200
  const variant = inheritedIndex(cells4, resources.pageCells, "VariationStyleIndex", 0);
22425
23201
  const style2 = variant === void 0 ? void 0 : effect.variationStyles[variant]?.[matrix3 - 100];
22426
- matrix3 = integer3(
23202
+ matrix3 = integer4(
22427
23203
  style2?.getAttribute(`${category === "Effects" ? "effect" : category.toLowerCase()}Idx`)
22428
23204
  );
22429
23205
  }
@@ -22517,7 +23293,7 @@ function themeLinearGradient(sheet, resources, width, height, report) {
22517
23293
  return reject2();
22518
23294
  const stops = [];
22519
23295
  for (const node3 of nodes) {
22520
- const position = integer3(node3.getAttribute("pos"));
23296
+ const position = integer4(node3.getAttribute("pos"));
22521
23297
  const paint2 = drawingPaint(colorChoice(node3), context.colors, context.base);
22522
23298
  if (position === void 0 || position > 1e5 || !paint2 || position / 1e5 < (stops.at(-1)?.offset ?? 0))
22523
23299
  return reject2();
@@ -24861,12 +25637,12 @@ function visioThemeVariantColors(source, variant) {
24861
25637
 
24862
25638
  // visio/page-theme.ts
24863
25639
  function visioPageTheme(themes, pageCells) {
24864
- const id3 = integer3(pageCells.get("ColorSchemeIndex")?.value);
25640
+ const id3 = integer4(pageCells.get("ColorSchemeIndex")?.value);
24865
25641
  if (!themes || id3 === void 0 || id3 === 0 || id3 >= 65534) return void 0;
24866
25642
  const matches2 = themes.filter((theme3) => theme3.colorId === id3);
24867
25643
  if (matches2.length !== 1) return void 0;
24868
25644
  const theme2 = matches2[0];
24869
- const variant = Math.min(3, integer3(pageCells.get("VariationColorIndex")?.value) ?? 0);
25645
+ const variant = Math.min(3, integer4(pageCells.get("VariationColorIndex")?.value) ?? 0);
24870
25646
  const accents = [1, 2, 3, 4, 5, 6].map(
24871
25647
  (index2) => drawingColor(theme2.colors.get(`accent${index2}`), theme2.colors) ?? "#808080"
24872
25648
  );
@@ -25123,7 +25899,7 @@ var VISIO_SCHEME_SLOTS = [
25123
25899
  "accent5",
25124
25900
  "accent6"
25125
25901
  ];
25126
- var componentId = (node3) => integer3(themeChild(node3, "schemeID", THEME_NS)?.getAttribute("schemeEnum"));
25902
+ var componentId = (node3) => integer4(themeChild(node3, "schemeID", THEME_NS)?.getAttribute("schemeEnum"));
25127
25903
  async function loadVisioThemes(pkg, source, report) {
25128
25904
  const result2 = [];
25129
25905
  for (const rel of (await pkg.relationships(source)).values()) {
@@ -25164,7 +25940,7 @@ async function loadVisioThemes(pkg, source, report) {
25164
25940
  const name3 = root2.getAttribute("name");
25165
25941
  result2.push({
25166
25942
  ...name3 ? { name: name3.slice(0, 256) } : {},
25167
- colorId: integer3(extension(palette, "schemeID")?.getAttribute("schemeEnum")),
25943
+ colorId: integer4(extension(palette, "schemeID")?.getAttribute("schemeEnum")),
25168
25944
  effectId: componentId(extension(base2, "fmtSchemeEx")),
25169
25945
  connectorId: componentId(extension(base2, "fmtConnectorSchemeEx")),
25170
25946
  colors,
@@ -25636,8 +26412,8 @@ function rootThemeSheet(sheet, resources, report) {
25636
26412
  const root2 = resources.rootSheet;
25637
26413
  if (!root2) return sheet;
25638
26414
  const colorRoot = rootThemeSelected(sheet.cells, resources);
25639
- const lineRoot = colorRoot || integer3(sheet.cells.get("QuickStyleLineMatrix")?.value) === 0;
25640
- const fillRoot = colorRoot || integer3(sheet.cells.get("QuickStyleFillMatrix")?.value) === 0;
26415
+ const lineRoot = colorRoot || integer4(sheet.cells.get("QuickStyleLineMatrix")?.value) === 0;
26416
+ const fillRoot = colorRoot || integer4(sheet.cells.get("QuickStyleFillMatrix")?.value) === 0;
25641
26417
  let cells4 = sheet.cells;
25642
26418
  if (colorRoot)
25643
26419
  cells4 = replaceThemed(cells4, root2.cells, ["LineColor", "FillForegnd", "FillBkgnd"], report);
@@ -26679,13 +27455,13 @@ async function parseVsdx(input, options2 = {}) {
26679
27455
  const cache2 = options2.documentCache;
26680
27456
  const cached5 = cacheMatches(cache2?.entry, pkg, options2) ? cache2.entry : void 0;
26681
27457
  const stopRecording = cache2 && !cached5 ? pkg.record() : void 0;
26682
- let level2;
27458
+ let level3;
26683
27459
  if (cached5) {
26684
- level2 = cached5.level;
26685
- for (const args of level2.reports) report(...args);
26686
- } else level2 = await readDocumentLevel(pkg, documentPart2, options2, checkTime, report);
26687
- const { documentRoot, styles, readPrintSettings, masters, masterRecords } = level2;
26688
- const resources = { ...level2.resources };
27460
+ level3 = cached5.level;
27461
+ for (const args of level3.reports) report(...args);
27462
+ } else level3 = await readDocumentLevel(pkg, documentPart2, options2, checkTime, report);
27463
+ const { documentRoot, styles, readPrintSettings, masters, masterRecords } = level3;
27464
+ const resources = { ...level3.resources };
26689
27465
  delete resources.pageCells;
26690
27466
  delete resources.fieldContext;
26691
27467
  let geometryCount = 0, textCount = 0, expansionCount = 0, textRuns = 0, paragraphCount = 0;
@@ -26764,7 +27540,7 @@ async function parseVsdx(input, options2 = {}) {
26764
27540
  options: optionsKey(options2),
26765
27541
  converter: options2.metafileConverter,
26766
27542
  reads: stopRecording(),
26767
- level: { ...level2, resources: { ...resources } },
27543
+ level: { ...level3, resources: { ...resources } },
26768
27544
  listed: {
26769
27545
  documentMasters,
26770
27546
  counters: {
@@ -29519,9 +30295,9 @@ function writeExclusiveOperand(input, cpStart, cpEnd, opcode, value3) {
29519
30295
  const operands = row2.prls.filter((p) => p.opcode === opcode);
29520
30296
  if (operands.length !== 1)
29521
30297
  throw new Error("inherited-formatting");
29522
- const operand = operands[0], size3 = opcode === 19011;
29523
- const previous = operand.operand[0] + (size3 ? operand.operand[1] * 256 : 0);
29524
- if (size3 ? operand.operand.length !== 2 || previous < 2 || previous > 3276 : opcode === 10814 ? ![0, 1, 3].includes(previous) : ![0, 1, 128, 129].includes(previous))
30298
+ const operand2 = operands[0], size3 = opcode === 19011;
30299
+ const previous = operand2.operand[0] + (size3 ? operand2.operand[1] * 256 : 0);
30300
+ if (size3 ? operand2.operand.length !== 2 || previous < 2 || previous > 3276 : opcode === 10814 ? ![0, 1, 3].includes(previous) : ![0, 1, 128, 129].includes(previous))
29525
30301
  throw new Error("inherited-formatting");
29526
30302
  const piece = parsed.pieces.find((p) => p.cpStart <= cpStart && p.cpEnd >= cpEnd);
29527
30303
  const unit3 = piece.compressed ? 1 : 2, start = piece.fc + (cpStart - piece.cpStart) * unit3;
@@ -29553,9 +30329,9 @@ function writeExclusiveOperand(input, cpStart, cpEnd, opcode, value3) {
29553
30329
  if (previous === value3)
29554
30330
  return input;
29555
30331
  const word = parsed.word.slice();
29556
- word[operand.at] = value3 & 255;
30332
+ word[operand2.at] = value3 & 255;
29557
30333
  if (size3)
29558
- word[operand.at + 1] = value3 >>> 8;
30334
+ word[operand2.at + 1] = value3 >>> 8;
29559
30335
  return parsed.doc.rewrap(word, parsed.doc.tableBytes);
29560
30336
  }
29561
30337
 
@@ -29883,8 +30659,8 @@ var DocDocument = class extends Ole2DocumentBase {
29883
30659
  else
29884
30660
  size3 = value3;
29885
30661
  const opcode = flag === "bold" ? 2101 : flag === "italic" ? 2102 : flag === "underline" ? 10814 : 19011;
29886
- const operand = flag === "size" ? [value3 * 2 & 255, value3 * 2 >>> 8] : flag === "underline" ? [value3 === "none" ? 0 : value3 === "single" ? 1 : 3] : [Number(value3)];
29887
- sprms = Object.freeze(sprms.map((p) => p.opcode === opcode ? Object.freeze({ opcode: p.opcode, operand: Object.freeze(operand) }) : p));
30662
+ const operand2 = flag === "size" ? [value3 * 2 & 255, value3 * 2 >>> 8] : flag === "underline" ? [value3 === "none" ? 0 : value3 === "single" ? 1 : 3] : [Number(value3)];
30663
+ sprms = Object.freeze(sprms.map((p) => p.opcode === opcode ? Object.freeze({ opcode: p.opcode, operand: Object.freeze(operand2) }) : p));
29888
30664
  };
29889
30665
  return Object.freeze({
29890
30666
  cpStart,
@@ -29974,14 +30750,14 @@ function buildDirectoryTree(entryCount) {
29974
30750
  let redLevel = 0;
29975
30751
  for (let remaining = entryCount - 2; remaining >= 0; remaining = Math.floor(remaining / 2) - 1)
29976
30752
  redLevel++;
29977
- const build = (low, high, level2) => {
30753
+ const build = (low, high, level3) => {
29978
30754
  if (low > high)
29979
30755
  return 4294967295;
29980
30756
  const id3 = Math.floor((low + high) / 2);
29981
30757
  links.set(id3, {
29982
- left: build(low, id3 - 1, level2 + 1),
29983
- right: build(id3 + 1, high, level2 + 1),
29984
- color: level2 === redLevel ? 0 : 1
30758
+ left: build(low, id3 - 1, level3 + 1),
30759
+ right: build(id3 + 1, high, level3 + 1),
30760
+ color: level3 === redLevel ? 0 : 1
29985
30761
  });
29986
30762
  return id3;
29987
30763
  };
@@ -35496,11 +36272,11 @@ function readVsdDrawing(input) {
35496
36272
  if (++records > 1e5)
35497
36273
  throw new VsdError("record-count");
35498
36274
  bounded3(bytes, cursor, 19);
35499
- const cv = view(bytes), chunk = cv.getUint32(cursor, true), chunkId = cv.getUint32(cursor + 4, true), list2 = cv.getUint32(cursor + 8, true), length2 = cv.getUint32(cursor + 12, true), level2 = cv.getUint16(cursor + 16, true), marker3 = bytes[cursor + 18];
36275
+ const cv = view(bytes), chunk = cv.getUint32(cursor, true), chunkId = cv.getUint32(cursor + 4, true), list2 = cv.getUint32(cursor + 8, true), length2 = cv.getUint32(cursor + 12, true), level3 = cv.getUint16(cursor + 16, true), marker3 = bytes[cursor + 18];
35500
36276
  if (chunk === 77)
35501
36277
  throw new VsdError("unsupported-guide");
35502
36278
  let trailer = list2 || [113, 112, 107, 106, 105, 102, 101, 44].includes(chunk) ? 8 : 0;
35503
- if (list2 || level2 === 2 && marker3 === 85 || level2 === 2 && marker3 === 84 && chunk === 170 || level2 === 3 && marker3 !== 80 && marker3 !== 84)
36279
+ if (list2 || level3 === 2 && marker3 === 85 || level3 === 2 && marker3 === 84 && chunk === 170 || level3 === 3 && marker3 !== 80 && marker3 !== 84)
35504
36280
  trailer += 4;
35505
36281
  if ([100, 101, 102, 105, 106, 107, 111, 113, 146, 169, 180, 182, 185, 199].includes(chunk) && trailer !== 12 && trailer !== 4)
35506
36282
  trailer += 4;
@@ -35509,22 +36285,22 @@ function readVsdDrawing(input) {
35509
36285
  const start = cursor + 19;
35510
36286
  if (length2 + trailer > bytes.length - start)
35511
36287
  throw new VsdError(`chunk-bounds-${offset}-${cursor}-${chunk}-${length2}-${trailer}-${bytes.length}`);
35512
- while (stack.length && level2 <= stack[stack.length - 1].level)
36288
+ while (stack.length && level3 <= stack[stack.length - 1].level)
35513
36289
  stack.pop();
35514
36290
  let current = stack[stack.length - 1]?.shape ?? shape;
35515
36291
  if (current && [70, 74].includes(chunk))
35516
36292
  throw new VsdError("unsupported-sheet-owner");
35517
- while (orderStack.length && level2 <= orderStack[orderStack.length - 1].level)
36293
+ while (orderStack.length && level3 <= orderStack[orderStack.length - 1].level)
35518
36294
  orderStack.pop();
35519
36295
  if (page && chunk === 70) {
35520
36296
  if (sheetIds.has(page))
35521
36297
  page.shapeOrderIssue = "ambiguous-page-owner";
35522
- sheetIds.set(page, length2 >= 54 && level2 === 1 && [10, 18, 26].every((o) => cv.getUint32(start + o, true) === 4294967295) ? chunkId : void 0);
36298
+ sheetIds.set(page, length2 >= 54 && level3 === 1 && [10, 18, 26].every((o) => cv.getUint32(start + o, true) === 4294967295) ? chunkId : void 0);
35523
36299
  }
35524
36300
  if (page && chunk === 101) {
35525
36301
  const orders = shapeOrders.get(page) ?? /* @__PURE__ */ new Map();
35526
36302
  shapeOrders.set(page, orders);
35527
- const order = { owner: current, elements: [], ids: /* @__PURE__ */ new Map(), level: level2 };
36303
+ const order = { owner: current, elements: [], ids: /* @__PURE__ */ new Map(), level: level3 };
35528
36304
  if (orders.has(current))
35529
36305
  order.issue = "duplicate-shape-order";
35530
36306
  orders.set(current, order);
@@ -35556,7 +36332,7 @@ function readVsdDrawing(input) {
35556
36332
  const order = orderStack[orderStack.length - 1];
35557
36333
  if (!order)
35558
36334
  page.shapeOrderIssue = "orphan-shape-id";
35559
- else if (level2 !== order.level + 1)
36335
+ else if (level3 !== order.level + 1)
35560
36336
  order.issue = "shape-id-owner-level";
35561
36337
  else if (length2 < 4)
35562
36338
  order.issue = "shape-id-bounds";
@@ -35573,7 +36349,7 @@ function readVsdDrawing(input) {
35573
36349
  current.masterPageId = cv.getUint32(start + 18, true);
35574
36350
  current.masterShapeId = cv.getUint32(start + 26, true);
35575
36351
  page.shapes.push(current);
35576
- stack.push({ level: level2, shape: current });
36352
+ stack.push({ level: level3, shape: current });
35577
36353
  }
35578
36354
  if (chunk === 146 && page) {
35579
36355
  if (length2 < 54)
@@ -41630,13 +42406,13 @@ async function pageContext(pkg, pageId2) {
41630
42406
  const page = pages.find((node3) => attribute2(node3, "ID") === pageId2);
41631
42407
  const foreground = pages.filter((node3) => !yes(attribute2(node3, "Background")));
41632
42408
  const number5 = page ? foreground.indexOf(page) + 1 : 0;
41633
- const properties2 = await readVisioFieldProperties(pkg);
41634
- for (const key2 of STRING_PROPERTIES) properties2[key2] ??= "";
42409
+ const properties = await readVisioFieldProperties(pkg);
42410
+ for (const key2 of STRING_PROPERTIES) properties[key2] ??= "";
41635
42411
  return {
41636
42412
  pageName: attribute2(page, "Name") ?? attribute2(page, "NameU") ?? `Page ${pageId2}`,
41637
42413
  ...number5 ? { pageNumber: number5 } : {},
41638
42414
  pageCount: foreground.length,
41639
- properties: properties2,
42415
+ properties,
41640
42416
  now: visioWallClock(/* @__PURE__ */ new Date())
41641
42417
  };
41642
42418
  }
@@ -42503,8 +43279,8 @@ function valid(key2, value3) {
42503
43279
  fail("INVALID_EDIT", `Invalid page layout value for ${key2}.`);
42504
43280
  return number5;
42505
43281
  }
42506
- const integer5 = Number.isSafeInteger(number5);
42507
- const ok = key2 === "lineJumpDirectionX" || key2 === "lineJumpDirectionY" ? integer5 && number5 >= 0 && number5 <= 2 : key2 === "lineJumpCode" ? integer5 && number5 >= 0 && number5 <= 5 : key2 === "lineJumpStyle" ? integer5 && number5 >= 0 && number5 <= 9 : key2.startsWith("gridDensity") ? VISIO_GRID_DENSITIES.includes(number5) : key2.startsWith("rulerDensity") ? VISIO_RULER_DENSITIES.includes(number5) : key2.startsWith("gridSpacing") ? number5 >= 0 && number5 <= 1e4 : Math.abs(number5) <= 1e6;
43282
+ const integer6 = Number.isSafeInteger(number5);
43283
+ const ok = key2 === "lineJumpDirectionX" || key2 === "lineJumpDirectionY" ? integer6 && number5 >= 0 && number5 <= 2 : key2 === "lineJumpCode" ? integer6 && number5 >= 0 && number5 <= 5 : key2 === "lineJumpStyle" ? integer6 && number5 >= 0 && number5 <= 9 : key2.startsWith("gridDensity") ? VISIO_GRID_DENSITIES.includes(number5) : key2.startsWith("rulerDensity") ? VISIO_RULER_DENSITIES.includes(number5) : key2.startsWith("gridSpacing") ? number5 >= 0 && number5 <= 1e4 : Math.abs(number5) <= 1e6;
42508
43284
  if (!ok) fail("INVALID_EDIT", `Invalid page layout value for ${key2}.`);
42509
43285
  return number5;
42510
43286
  }
@@ -44336,7 +45112,7 @@ function visioThemeColorFormula(ref) {
44336
45112
  const base2 = slot2 ? `THEMEVAL("${slot2[1]}")` : `RGB(${[1, 3, 5].map((index2) => parseInt(ref.base.slice(index2, index2 + 2), 16)).join(",")})`;
44337
45113
  return `THEMEGUARD(${ref.tint ? `MSOTINT(${base2},${ref.tint})` : base2})`;
44338
45114
  }
44339
- var integer4 = (node3) => {
45115
+ var integer5 = (node3) => {
44340
45116
  const value3 = node3?.kind === "unary" && node3.operator === "-" && node3.operand.kind === "number" ? -node3.operand.value : node3?.kind === "number" ? node3.value : void 0;
44341
45117
  return value3 !== void 0 && Number.isInteger(value3) ? value3 : void 0;
44342
45118
  };
@@ -44347,7 +45123,7 @@ function base(node3) {
44347
45123
  return SLOTS.find(([, native]) => native.toLowerCase() === name3)?.[0];
44348
45124
  }
44349
45125
  if (node3.name !== "RGB" || node3.args.length !== 3) return void 0;
44350
- const channels = node3.args.map(integer4);
45126
+ const channels = node3.args.map(integer5);
44351
45127
  if (channels.some((value3) => value3 === void 0 || value3 < 0 || value3 > 255)) return void 0;
44352
45128
  return `#${channels.map((value3) => value3.toString(16).padStart(2, "0")).join("")}`;
44353
45129
  }
@@ -44363,7 +45139,7 @@ function parseVisioThemeColorFormula(source) {
44363
45139
  const inner = ast.args[0];
44364
45140
  if (inner.kind === "call" && inner.name === "MSOTINT" && inner.args.length === 2) {
44365
45141
  const from2 = base(inner.args[0]);
44366
- const tint = integer4(inner.args[1]);
45142
+ const tint = integer5(inner.args[1]);
44367
45143
  return from2 && tint !== void 0 && tint !== 0 && Math.abs(tint) <= 100 ? { base: from2, tint } : void 0;
44368
45144
  }
44369
45145
  const from = base(inner);
@@ -45124,9 +45900,39 @@ function snapshotVisioEdits(edits, maxEdits, maxText) {
45124
45900
  });
45125
45901
  }
45126
45902
 
45127
- // visio/edit-resize-anchor.ts
45128
- var close3 = (a2, b) => Math.abs(a2 - b) <= 1e-10 * Math.max(1, Math.abs(a2), Math.abs(b));
45129
- function closure(graph, changed, check) {
45903
+ // visio/edit-resize-plan.ts
45904
+ var resizeClose = (a2, b) => Math.abs(a2 - b) <= 1e-10 * Math.max(1, Math.abs(a2), Math.abs(b));
45905
+ function assertCanonicalResizeCells(shape) {
45906
+ const canonical2 = [
45907
+ "Width",
45908
+ "Height",
45909
+ "PinX",
45910
+ "PinY",
45911
+ "LocPinX",
45912
+ "LocPinY",
45913
+ "Angle",
45914
+ "FlipX",
45915
+ "FlipY",
45916
+ "LockMoveX",
45917
+ "LockMoveY",
45918
+ "LockWidth",
45919
+ "LockHeight",
45920
+ "LockAspect",
45921
+ "LockDelete",
45922
+ "ResizeMode"
45923
+ ];
45924
+ for (const cell of children2(shape, "Cell")) {
45925
+ const name3 = attribute2(cell, "N") ?? "";
45926
+ if (canonical2.some(
45927
+ (expected) => expected.toLowerCase() === name3.toLowerCase() && expected !== name3
45928
+ ))
45929
+ fail(
45930
+ "EDIT_AMBIGUOUS_CELL",
45931
+ "Noncanonical transform and protection cell names are unsupported."
45932
+ );
45933
+ }
45934
+ }
45935
+ function resizeClosure(graph, changed, check) {
45130
45936
  const reverse = /* @__PURE__ */ new Map();
45131
45937
  for (const [id3, item2] of graph) {
45132
45938
  check();
@@ -45149,40 +45955,128 @@ function closure(graph, changed, check) {
45149
45955
  }
45150
45956
  return affected;
45151
45957
  }
45958
+
45959
+ // visio/edit-group-resize.ts
45960
+ function localGroupResize(root2, id3, document, check) {
45961
+ const candidates = children2(children2(root2, "Shapes")[0], "Shape").filter(
45962
+ (shape) => attribute2(shape, "ID") === id3
45963
+ );
45964
+ if (candidates.length !== 1 || attribute2(candidates[0], "Type") !== "Group") return void 0;
45965
+ const group2 = candidates[0];
45966
+ const members3 = children2(children2(group2, "Shapes")[0], "Shape");
45967
+ if ([group2, ...members3].some(
45968
+ (shape) => shape.hasAttribute("Master") || shape.hasAttribute("MasterShape")
45969
+ ) || !members3.length || members3.length > 500 || members3.some(
45970
+ (shape) => attribute2(shape, "Type") !== "Shape" || children2(shape, "Shapes").length
45971
+ ))
45972
+ fail("UNSUPPORTED_GEOMETRY_EDIT", "Group resizing requires a flat local group of 2D shapes.");
45973
+ const ids = proveLocalShapeTree(group2, check);
45974
+ assertUngluedTree(root2, ids, "Group resizing cannot update glued members or group connections.");
45975
+ const shapes = /* @__PURE__ */ new Set([group2, ...members3]);
45976
+ for (const shape of shapes) {
45977
+ check();
45978
+ assertCanonicalResizeCells(shape);
45979
+ protectedShape(shape, document);
45980
+ assertUnlayeredShape(shape, document);
45981
+ if (shape !== group2 && Math.abs(Math.sin(numeric(cells(shape).get("Angle"), 0))) > 1e-10)
45982
+ fail("UNSUPPORTED_GEOMETRY_EDIT", "Group resizing requires axis-aligned local members.");
45983
+ for (const node3 of Array.from(shape.childNodes).filter(
45984
+ (node4) => node4.nodeType === 1 && node4.localName !== "Shapes"
45985
+ )) {
45986
+ for (const cell of [node3, ...Array.from(node3.getElementsByTagName("*"))]) {
45987
+ const formula2 = executableCellFormula(attribute2(cell, "F"));
45988
+ if (formula2 && analyzeVisioFormula(formula2).unsupportedFunctions.length)
45989
+ fail(
45990
+ "EDIT_UNSUPPORTED_FORMULA",
45991
+ "Group resize cannot refresh unsupported or text-measured formulas."
45992
+ );
45993
+ }
45994
+ }
45995
+ }
45996
+ return { group: group2, members: members3, shapes, groups: /* @__PURE__ */ new Set([group2]) };
45997
+ }
45998
+ function planGroupResize(scope, roots, edit, source, check) {
45999
+ const writes = [];
46000
+ const expected = /* @__PURE__ */ new Map();
46001
+ const read = (shape, name3, fallback) => {
46002
+ const local = cells(shape);
46003
+ return local.has(name3) || ["LocPinX", "LocPinY"].includes(name3) ? source(key({ pageId: edit.pageId, shapeId: attribute2(shape, "ID"), cell: name3 })).value : numeric(local.get(name3), fallback);
46004
+ };
46005
+ const mode = (shape, fallback) => {
46006
+ const cell = cells(shape).get("ResizeMode");
46007
+ if (!cell) return fallback;
46008
+ const formula2 = executableCellFormula(attribute2(cell, "F"));
46009
+ if (attribute2(cell, "F") === "Inh" || formula2 && analyzeVisioFormula(formula2).references.length || visioFormulaCachedValue("0", attribute2(cell, "U")).unit !== "scalar")
46010
+ fail("UNSUPPORTED_GEOMETRY_EDIT", "Group resize needs a constant local ResizeMode.");
46011
+ const value3 = read(shape, "ResizeMode");
46012
+ if (![0, 1, 2].includes(value3))
46013
+ fail("UNSUPPORTED_GEOMETRY_EDIT", "Unsupported group ResizeMode.");
46014
+ return value3 || fallback;
46015
+ };
46016
+ const width = read(scope.group, "Width"), height = read(scope.group, "Height");
46017
+ const sx = edit.width / width, sy = edit.height / height, groupMode = mode(scope.group, 2);
46018
+ for (const shape of scope.members) {
46019
+ check();
46020
+ const id3 = attribute2(shape, "ID"), local = cells(shape), scaling = mode(shape, groupMode) === 2;
46021
+ const childW = read(shape, "Width"), childH = read(shape, "Height");
46022
+ const sizeX = scaling ? sx : 1, sizeY = scaling ? sy : 1;
46023
+ if (numeric(local.get("LockAspect"), 0) !== 0 && !resizeClose(sizeX, sizeY))
46024
+ fail("EDIT_PROTECTED_CELL", "A group member LockAspect prevents resizing.");
46025
+ if (scaling && (!resizeClose(sx, 1) || !resizeClose(sy, 1)))
46026
+ resizeGeometry(
46027
+ shape,
46028
+ roots,
46029
+ { ...edit, shapeId: id3 },
46030
+ check,
46031
+ /* @__PURE__ */ new Set(),
46032
+ /* @__PURE__ */ new Set(),
46033
+ scope.shapes
46034
+ );
46035
+ for (const [name3, factor, formula2, lock] of [
46036
+ ["PinX", sx, `Sheet.${edit.shapeId}!Width*${read(shape, "PinX") / width}`, "LockMoveX"],
46037
+ ["PinY", sy, `Sheet.${edit.shapeId}!Height*${read(shape, "PinY") / height}`, "LockMoveY"],
46038
+ ["Width", sizeX, `Sheet.${edit.shapeId}!Width*${childW / width}`, "LockWidth"],
46039
+ ["Height", sizeY, `Sheet.${edit.shapeId}!Height*${childH / height}`, "LockHeight"],
46040
+ ["LocPinX", sizeX, `Width*${read(shape, "LocPinX") / childW}`, ""],
46041
+ ["LocPinY", sizeY, `Height*${read(shape, "LocPinY") / childH}`, ""]
46042
+ ]) {
46043
+ const old = read(shape, name3), value3 = old * factor;
46044
+ if (!Number.isFinite(value3) || Math.abs(value3) > 1e6 || ["Width", "Height"].includes(name3) && value3 <= 0)
46045
+ fail("UNSUPPORTED_GEOMETRY_EDIT", "Resized group member exceeds coordinate limits.");
46046
+ expected.set(key({ pageId: edit.pageId, shapeId: id3, cell: name3 }), value3);
46047
+ if (resizeClose(value3, old)) continue;
46048
+ if (lock && numeric(local.get(lock), 0) !== 0)
46049
+ fail("EDIT_PROTECTED_CELL", `A group member ${lock} prevents resizing.`);
46050
+ const node3 = local.get(name3);
46051
+ const existing = executableCellFormula(attribute2(node3, "F"));
46052
+ if (guardedCell(node3) || existing && analyzeVisioFormula(existing).references.length)
46053
+ continue;
46054
+ editableCell(
46055
+ node3,
46056
+ (reference2) => source(
46057
+ key({ pageId: edit.pageId, shapeId: reference2.shapeId ?? id3, cell: reference2.cell })
46058
+ )
46059
+ );
46060
+ writes.push({ shape, name: name3, value: value3, formula: formula2 });
46061
+ }
46062
+ for (const name3 of ["Angle", "FlipX", "FlipY"])
46063
+ expected.set(key({ pageId: edit.pageId, shapeId: id3, cell: name3 }), read(shape, name3, 0));
46064
+ }
46065
+ return { writes, expected };
46066
+ }
46067
+
46068
+ // visio/edit-resize-anchor.ts
45152
46069
  function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /* @__PURE__ */ new Set()) {
45153
46070
  check();
45154
46071
  const root2 = roots.get(edit.pageId);
45155
46072
  if (!root2) fail("EDIT_TARGET_NOT_FOUND", "Page does not exist.");
45156
- const shape = admitted(root2, edit.shapeId);
46073
+ const group2 = localGroupResize(root2, edit.shapeId, document, check);
46074
+ const shape = admitted(root2, edit.shapeId, /* @__PURE__ */ new Set(), /* @__PURE__ */ new Map(), void 0, group2?.groups);
45157
46075
  const local = cells(shape);
45158
- const canonical2 = [
45159
- "Width",
45160
- "Height",
45161
- "PinX",
45162
- "PinY",
45163
- "LocPinX",
45164
- "LocPinY",
45165
- "Angle",
45166
- "FlipX",
45167
- "FlipY",
45168
- "LockMoveX",
45169
- "LockMoveY",
45170
- "LockWidth",
45171
- "LockHeight",
45172
- "LockAspect",
45173
- "LockDelete"
45174
- ];
45175
- for (const name3 of local.keys())
45176
- if (canonical2.some(
45177
- (expected) => expected.toLowerCase() === name3.toLowerCase() && expected !== name3
45178
- ))
45179
- fail(
45180
- "EDIT_AMBIGUOUS_CELL",
45181
- "Noncanonical transform and protection cell names are unsupported."
45182
- );
46076
+ assertCanonicalResizeCells(shape);
45183
46077
  if (!edit.anchor || isLineSheet(cells(shape)) || edit.height <= 0)
45184
46078
  fail("UNSUPPORTED_GEOMETRY_EDIT", "Anchored resizing requires an ordinary local 2D shape.");
45185
- if (Array.from(shape.getElementsByTagName("*")).some(
46079
+ if (!group2 && Array.from(shape.getElementsByTagName("*")).some(
45186
46080
  (node3) => node3.localName === "Shape" && [VISIO_NS, VISIO_LEGACY_NS].includes(node3.namespaceURI ?? "")
45187
46081
  ))
45188
46082
  fail("UNSUPPORTED_GEOMETRY_EDIT", "Nested shape identities cannot be resized as a local leaf.");
@@ -45192,7 +46086,11 @@ function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /*
45192
46086
  for (const connection of children2(container, "Connect"))
45193
46087
  if (!glueShapes.has(shape) && ["FromSheet", "ToSheet"].some((name3) => attribute2(connection, name3) === edit.shapeId))
45194
46088
  fail("UNSUPPORTED_GEOMETRY_EDIT", "Glued shapes require routing outside this subset.");
45195
- const graph = indexCells(roots, { check, glueShapes });
46089
+ const graph = indexCells(roots, {
46090
+ check,
46091
+ glueShapes,
46092
+ ...group2 ? { groupResizeShapes: group2.shapes } : {}
46093
+ });
45196
46094
  const id3 = (cell) => key({ pageId: edit.pageId, shapeId: edit.shapeId, cell });
45197
46095
  const source = createVisioCellEvaluator(graph, { check, glueShapes }, true);
45198
46096
  const read = (name3, fallback) => graph.has(id3(name3)) ? source(id3(name3)).value : numeric(local.get(name3), fallback);
@@ -45208,8 +46106,9 @@ function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /*
45208
46106
  if (![0, 1].includes(flipX) || ![0, 1].includes(flipY))
45209
46107
  fail("EDIT_FORMULA_UNIT", "Flip cells must be scalar booleans.");
45210
46108
  if (width === edit.width && height === edit.height) return [];
45211
- resizeGeometry(shape, roots, edit, check);
45212
- if (numeric(local.get("LockAspect"), 0) !== 0 && !close3(edit.width / width, edit.height / height))
46109
+ if (!group2 || children2(shape, "Section").some((section3) => attribute2(section3, "N") === "Geometry"))
46110
+ resizeGeometry(shape, roots, edit, check, /* @__PURE__ */ new Set(), glueShapes, group2?.shapes);
46111
+ if (numeric(local.get("LockAspect"), 0) !== 0 && !resizeClose(edit.width / width, edit.height / height))
45213
46112
  fail("EDIT_PROTECTED_CELL", "LockAspect prevents changing the aspect ratio.");
45214
46113
  const geometry = visioAnchoredResizeGeometry(
45215
46114
  {
@@ -45251,19 +46150,21 @@ function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /*
45251
46150
  writes.push({ name: name3, value: value3 });
45252
46151
  }
45253
46152
  const changedDimensions = writes.map((write2) => id3(write2.name));
45254
- const dimensionClosure = closure(graph, changedDimensions, check);
46153
+ const dimensionClosure = resizeClosure(graph, changedDimensions, check);
45255
46154
  for (const [name3, value3, old] of [
45256
46155
  ["PinX", geometry.pinX, pinX],
45257
46156
  ["PinY", geometry.pinY, pinY]
45258
46157
  ])
45259
- if (!local.has(name3) || !close3(value3, old) || dimensionClosure.has(id3(name3)) && !guardedCell(local.get(name3))) {
45260
- if (!close3(value3, old)) unlocked(name3 === "PinX" ? "LockMoveX" : "LockMoveY");
46158
+ if (!local.has(name3) || !resizeClose(value3, old) || dimensionClosure.has(id3(name3)) && !guardedCell(local.get(name3))) {
46159
+ if (!resizeClose(value3, old)) unlocked(name3 === "PinX" ? "LockMoveX" : "LockMoveY");
45261
46160
  writable(name3);
45262
- writes.push({ name: name3, value: close3(value3, old) ? old : value3 });
46161
+ writes.push({ name: name3, value: resizeClose(value3, old) ? old : value3 });
45263
46162
  }
45264
46163
  const projected = new Map(graph);
46164
+ const writeId = (write2) => key({ pageId: edit.pageId, shapeId: attribute2(write2.shape ?? shape, "ID"), cell: write2.name });
45265
46165
  const install = (write2) => {
45266
- const original = local.get(write2.name);
46166
+ const owner = write2.shape ?? shape, ownerId2 = attribute2(owner, "ID");
46167
+ const original = cells(owner).get(write2.name);
45267
46168
  const node3 = original ? original.cloneNode(true) : shape.ownerDocument.createElementNS(shape.namespaceURI, "Cell");
45268
46169
  node3.setAttribute("N", write2.name);
45269
46170
  node3.setAttribute("V", String(write2.value));
@@ -45271,7 +46172,7 @@ function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /*
45271
46172
  else node3.removeAttribute("F");
45272
46173
  const cell = {
45273
46174
  pageId: edit.pageId,
45274
- shapeId: edit.shapeId,
46175
+ shapeId: ownerId2,
45275
46176
  cell: write2.name,
45276
46177
  node: node3,
45277
46178
  unsafe: false,
@@ -45280,9 +46181,11 @@ function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /*
45280
46181
  };
45281
46182
  if (write2.formula) {
45282
46183
  cell.formula = parseVisioFormula(write2.formula);
45283
- cell.dependencies = [id3(write2.name === "LocPinX" ? "Width" : "Height")];
46184
+ cell.dependencies = analyzeVisioFormula(cell.formula).references.map(
46185
+ (reference2) => key({ pageId: edit.pageId, shapeId: reference2.shapeId ?? ownerId2, cell: reference2.cell })
46186
+ );
45284
46187
  }
45285
- projected.set(id3(write2.name), cell);
46188
+ projected.set(writeId(write2), cell);
45286
46189
  };
45287
46190
  for (const write2 of writes) install(write2);
45288
46191
  const guardedPins = [];
@@ -45302,16 +46205,17 @@ function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /*
45302
46205
  }
45303
46206
  const projectedPins = createVisioCellEvaluator(projected, { check });
45304
46207
  for (const pin of guardedPins)
45305
- if (!close3(projectedPins(id3(pin.name)).value, pin.value))
46208
+ if (!resizeClose(projectedPins(id3(pin.name)).value, pin.value))
45306
46209
  fail(
45307
46210
  "EDIT_PROTECTED_CELL",
45308
46211
  "Guarded local pin does not scale proportionally with the requested dimension."
45309
46212
  );
45310
- const affected = closure(
45311
- projected,
45312
- writes.map((write2) => id3(write2.name)),
45313
- check
45314
- );
46213
+ const members3 = group2 && planGroupResize(group2, roots, edit, source, check);
46214
+ for (const write2 of members3?.writes ?? []) {
46215
+ writes.push(write2);
46216
+ install(write2);
46217
+ }
46218
+ const affected = resizeClosure(projected, writes.map(writeId), check);
45315
46219
  for (const name3 of ["Angle", "FlipX", "FlipY"])
45316
46220
  if (affected.has(id3(name3)))
45317
46221
  fail(
@@ -45337,17 +46241,23 @@ function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /*
45337
46241
  ["LocPinX", geometry.locPinX],
45338
46242
  ["LocPinY", geometry.locPinY]
45339
46243
  ])
45340
- if (!close3(projected.has(id3(name3)) ? evaluate(id3(name3)).value : read(name3), expected))
46244
+ if (!resizeClose(projected.has(id3(name3)) ? evaluate(id3(name3)).value : read(name3), expected))
45341
46245
  fail(
45342
46246
  "EDIT_UNSUPPORTED_DEPENDENCY",
45343
46247
  "Dependent formulas would violate the requested anchor or dimensions."
45344
46248
  );
46249
+ for (const [cellId, expected] of members3?.expected ?? [])
46250
+ if (!resizeClose(projected.has(cellId) ? evaluate(cellId).value : 0, expected))
46251
+ fail(
46252
+ "EDIT_UNSUPPORTED_DEPENDENCY",
46253
+ "Dependent formulas would violate a resized group member pose."
46254
+ );
45345
46255
  check();
45346
- for (const write2 of writes) setCell(shape, write2.name, write2.value, write2.formula);
46256
+ for (const write2 of writes) setCell(write2.shape ?? shape, write2.name, write2.value, write2.formula);
45347
46257
  const dirty = /* @__PURE__ */ new Set([edit.pageId]);
45348
46258
  for (const [cellId, value3] of values) {
45349
46259
  const item2 = graph.get(cellId);
45350
- if (!item2?.node || !item2.formula || writes.some((write2) => id3(write2.name) === cellId)) continue;
46260
+ if (!item2?.node || !item2.formula || writes.some((write2) => writeId(write2) === cellId)) continue;
45351
46261
  if (attribute2(item2.node, "V") !== String(value3)) {
45352
46262
  item2.node.setAttribute("V", String(value3));
45353
46263
  dirty.add(item2.pageId);
@@ -46175,6 +47085,23 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check, roots
46175
47085
  cell
46176
47086
  }))
46177
47087
  );
47088
+ const groupResizeShapes = /* @__PURE__ */ new Set();
47089
+ const groupResizePages = /* @__PURE__ */ new Set();
47090
+ for (const command2 of commands) {
47091
+ if (command2.type !== "resize-shape" || !command2.anchor) continue;
47092
+ const group2 = children2(children2(roots.get(command2.pageId), "Shapes")[0], "Shape").find(
47093
+ (shape) => attribute2(shape, "ID") === command2.shapeId && attribute2(shape, "Type") === "Group" && !shape.hasAttribute("Master")
47094
+ );
47095
+ if (!group2) continue;
47096
+ groupResizePages.add(command2.pageId);
47097
+ groupResizeShapes.add(group2);
47098
+ for (const member of Array.from(group2.getElementsByTagNameNS(group2.namespaceURI, "Shape"))) {
47099
+ check();
47100
+ groupResizeShapes.add(member);
47101
+ for (const cell of ["PinX", "PinY", "Width", "Height", "LocPinX", "LocPinY"])
47102
+ changed.push({ pageId: command2.pageId, shapeId: attribute2(member, "ID"), cell });
47103
+ }
47104
+ }
46178
47105
  const deleting = commands.filter((command2) => command2.type === "delete-shape");
46179
47106
  let query;
46180
47107
  const hasMasterInstances = [...roots.values()].some(
@@ -46187,7 +47114,7 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check, roots
46187
47114
  const key2 = JSON.stringify([pageId2, shapeId2, cell.toLowerCase()]);
46188
47115
  let result2 = dependencyCache.get(key2);
46189
47116
  if (result2 === void 0) {
46190
- query ??= createVisioDependencyQuery(roots, { check });
47117
+ query ??= createVisioDependencyQuery(roots, { check, groupResizeShapes });
46191
47118
  result2 = query({ pageId: pageId2, shapeId: shapeId2, cell }, changed);
46192
47119
  dependencyCache.set(key2, result2);
46193
47120
  }
@@ -46243,6 +47170,11 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check, roots
46243
47170
  const item2 = pending2.pop(), node3 = item2.node;
46244
47171
  const pageId2 = admitted2(node3) && node3.localName === "Page" && root2.localName === "Pages" ? attribute2(node3, "ID") : item2.pageId;
46245
47172
  const style2 = item2.style || admitted2(node3) && node3.localName === "StyleSheets";
47173
+ if (pageId2 && groupResizePages.has(pageId2) && node3.localName === "Cell" && attribute2(node3, "N")?.toLowerCase() === "resizemode" && node3.parentNode?.nodeName.endsWith("PageSheet") && (node3.hasAttribute("E") || visioFormulaCachedValue("0", attribute2(node3, "U")).unit !== "scalar" || executableCellFormula(attribute2(node3, "F")) || attribute2(node3, "F") === "Inh" || !["0", "2"].includes(attribute2(node3, "V") ?? "")))
47174
+ fail(
47175
+ "UNSUPPORTED_GEOMETRY_EDIT",
47176
+ "Nondefault page-level ResizeMode is not supported for group resizing."
47177
+ );
46246
47178
  if (admitted2(node3) && !style2) {
46247
47179
  inspectFormula(node3, path3, pageId2);
46248
47180
  if (deleting.some(
@@ -50908,6 +51840,11 @@ async function editVsdxTransaction(input, edits, options2, clock = {
50908
51840
  dirty.set(pages.get(pageId2), roots.get(pageId2));
50909
51841
  duplicateChanged = true;
50910
51842
  } else if (command2.type !== "insert-picture" && !isVisioChartObjectEdit(command2) && command2.type !== "set-page-theme" && command2.type !== "create-subprocess" && !isVisioCommentEdit(command2) && !isVisioDataEdit(command2) && command2.type !== "assign-layers" && command2.type !== "set-layer-properties" && !isVisioMasterDrop(command2)) {
51843
+ if (command2.type === "resize-shape" && command2.anchor) {
51844
+ const target2 = topShape(root2, command2.shapeId);
51845
+ if (attribute2(target2, "Type") === "Group" && !target2?.hasAttribute("Master"))
51846
+ await assertGeometryPackageScope(pkg, new Set(pages.values()), [command2], check, roots);
51847
+ }
50911
51848
  const changedPages = instanceCommands.has(command2) && isInstanceGeometryEdit(roots, command2) ? await applyInstanceGeometryEdit(roots, command2, masterTemplate(pkg), check) : applyGeometryEdit(roots, document, command2, check, masterMovePins);
50912
51849
  for (const pageId2 of changedPages) dirty.set(pages.get(pageId2), roots.get(pageId2));
50913
51850
  if (changedPages.length && ["move-shape", "resize-shape", "rotate-shape", "flip-shape"].includes(command2.type))