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
@@ -101,13 +101,13 @@ function groupRowsByCategory(rawCategories) {
101
101
  const rowIndexesByCategory = /* @__PURE__ */ new Map();
102
102
  rawCategories.forEach((rawLabel, rowIndex) => {
103
103
  const label = rawLabel ?? "";
104
- let rows = rowIndexesByCategory.get(label);
105
- if (!rows) {
106
- rows = [];
107
- rowIndexesByCategory.set(label, rows);
104
+ let rows2 = rowIndexesByCategory.get(label);
105
+ if (!rows2) {
106
+ rows2 = [];
107
+ rowIndexesByCategory.set(label, rows2);
108
108
  uniqueCategories.push(label);
109
109
  }
110
- rows.push(rowIndex);
110
+ rows2.push(rowIndex);
111
111
  });
112
112
  return { uniqueCategories, rowIndexesByCategory };
113
113
  }
@@ -737,10 +737,10 @@ function squarify(nodes, box) {
737
737
 
738
738
  // chart/hierarchy.ts
739
739
  function normalizeLevels(levels, pointCount) {
740
- return levels.map((level2) => {
740
+ return levels.map((level3) => {
741
741
  let previous = "";
742
742
  return Array.from({ length: pointCount }, (_, index) => {
743
- const label = level2[index]?.trim() ?? "";
743
+ const label = level3[index]?.trim() ?? "";
744
744
  if (label) previous = label;
745
745
  return label || previous;
746
746
  });
@@ -898,12 +898,12 @@ function computeSunburstArcs(series2, cx, cy, maxR) {
898
898
  });
899
899
  return out;
900
900
  }
901
- function hierarchyKey(levels, level2, index) {
902
- return levels.slice(level2).map((labels2) => labels2[index] ?? "").join("\0");
901
+ function hierarchyKey(levels, level3, index) {
902
+ return levels.slice(level3).map((labels2) => labels2[index] ?? "").join("\0");
903
903
  }
904
904
  function computeHierarchicalSunburstArcs(categoryLevels2, values, cx, cy, maxR) {
905
- const levels = categoryLevels2.filter((level2) => level2.length > 0);
906
- const leafCount = Math.max(values.length, ...levels.map((level2) => level2.length), 0);
905
+ const levels = categoryLevels2.filter((level3) => level3.length > 0);
906
+ const leafCount = Math.max(values.length, ...levels.map((level3) => level3.length), 0);
907
907
  if (levels.length === 0 || leafCount === 0) return [];
908
908
  const rawWeights = Array.from({ length: leafCount }, (_, index) => Math.abs(values[index] ?? 0));
909
909
  const weights = rawWeights.some((value) => value !== 0) ? rawWeights : rawWeights.map(() => 1);
@@ -914,15 +914,15 @@ function computeHierarchicalSunburstArcs(categoryLevels2, values, cx, cy, maxR)
914
914
  const rootLabels = levels[levels.length - 1] ?? [];
915
915
  const rootColors = /* @__PURE__ */ new Map();
916
916
  const out = [];
917
- for (let level2 = levels.length - 1; level2 >= 0; level2--) {
918
- const ringIndex = levels.length - 1 - level2;
917
+ for (let level3 = levels.length - 1; level3 >= 0; level3--) {
918
+ const ringIndex = levels.length - 1 - level3;
919
919
  const innerRadius = ringWidth * (ringIndex + 0.5);
920
920
  const outerRadius = ringWidth * (ringIndex + 1.5);
921
921
  let start = 0;
922
922
  while (start < leafCount) {
923
- const key = hierarchyKey(levels, level2, start);
923
+ const key = hierarchyKey(levels, level3, start);
924
924
  let end = start + 1;
925
- while (end < leafCount && hierarchyKey(levels, level2, end) === key) end++;
925
+ while (end < leafCount && hierarchyKey(levels, level3, end) === key) end++;
926
926
  const startAngle = -Math.PI / 2 + (prefix[start] ?? 0) / total * Math.PI * 2;
927
927
  const endAngle = -Math.PI / 2 + (prefix[end] ?? 0) / total * Math.PI * 2;
928
928
  const rootLabel = rootLabels[start] ?? "";
@@ -932,8 +932,8 @@ function computeHierarchicalSunburstArcs(categoryLevels2, values, cx, cy, maxR)
932
932
  colorIndex: rootColors.get(rootLabel) ?? start,
933
933
  opacity: Math.max(0.1, 0.9 - ringIndex * 0.1),
934
934
  level: ringIndex,
935
- label: levels[level2]?.[start] ?? "",
936
- ...level2 === 0 && end === start + 1 ? { pointIndex: start } : {},
935
+ label: levels[level3]?.[start] ?? "",
936
+ ...level3 === 0 && end === start + 1 ? { pointIndex: start } : {},
937
937
  ...arcLabelPlacement(cx, cy, (innerRadius + outerRadius) / 2, startAngle, endAngle)
938
938
  });
939
939
  start = end;
@@ -1191,11 +1191,11 @@ function computeHistogramBins(values, options2, format = String) {
1191
1191
  function aggregateByCategory(values, rawCategories) {
1192
1192
  const { uniqueCategories, rowIndexesByCategory } = groupRowsByCategory(rawCategories);
1193
1193
  return uniqueCategories.map((label) => {
1194
- const rows = rowIndexesByCategory.get(label) ?? [];
1194
+ const rows2 = rowIndexesByCategory.get(label) ?? [];
1195
1195
  return {
1196
- value: rows.reduce((sum, row) => sum + (values[row] ?? 0), 0),
1196
+ value: rows2.reduce((sum, row) => sum + (values[row] ?? 0), 0),
1197
1197
  label,
1198
- sourceIndices: rows
1198
+ sourceIndices: rows2
1199
1199
  };
1200
1200
  });
1201
1201
  }
@@ -2048,8 +2048,8 @@ function parseXml(xml, options2 = {}) {
2048
2048
  let parsed;
2049
2049
  try {
2050
2050
  parsed = new xmldom.DOMParser({
2051
- onError: (level2, message) => {
2052
- if (level2 !== "warning") parseError = message;
2051
+ onError: (level3, message) => {
2052
+ if (level3 !== "warning") parseError = message;
2053
2053
  }
2054
2054
  }).parseFromString(xml, "application/xml");
2055
2055
  } catch (error) {
@@ -2536,6 +2536,141 @@ function builtInChartTextStyle(id) {
2536
2536
  };
2537
2537
  }
2538
2538
 
2539
+ // drawingml/picture-crop.ts
2540
+ var SIDES = { l: "cropLeft", t: "cropTop", r: "cropRight", b: "cropBottom" };
2541
+ function parsePictureCrop(blipFill) {
2542
+ const rect2 = first(blipFill, "srcRect", NS.a);
2543
+ if (!rect2) return void 0;
2544
+ const result = {};
2545
+ for (const [attr2, key] of Object.entries(SIDES)) {
2546
+ const raw2 = rect2.getAttribute(attr2);
2547
+ if (raw2 === null || !raw2.trim()) continue;
2548
+ const percent = raw2.endsWith("%");
2549
+ const value = Number(percent ? raw2.slice(0, -1) : raw2) / (percent ? 100 : 1e5);
2550
+ if (Number.isFinite(value)) result[key] = value;
2551
+ }
2552
+ return result;
2553
+ }
2554
+ function applyPictureCrop(blipFill, crop) {
2555
+ let rect2 = first(blipFill, "srcRect", NS.a);
2556
+ if (!rect2 && crop && Object.values(crop).some((value) => value !== void 0)) {
2557
+ rect2 = blipFill.ownerDocument.createElementNS(NS.a, "a:srcRect");
2558
+ const blip = first(blipFill, "blip", NS.a);
2559
+ blipFill.insertBefore(rect2, blip?.nextSibling ?? blipFill.firstChild);
2560
+ }
2561
+ if (!rect2) return;
2562
+ for (const [attr2, key] of Object.entries(SIDES)) {
2563
+ const value = crop?.[key];
2564
+ if (value === void 0) rect2.removeAttribute(attr2);
2565
+ else {
2566
+ if (!Number.isFinite(value)) throw new RangeError("Picture crop must be finite");
2567
+ rect2.setAttribute(attr2, String(Math.round(value * 1e5)));
2568
+ }
2569
+ }
2570
+ }
2571
+
2572
+ // drawingml/picture-effects.ts
2573
+ function picturePercentage(value) {
2574
+ const text2 = String(value ?? "").trim();
2575
+ if (!text2) return void 0;
2576
+ const percent = text2.endsWith("%");
2577
+ const n2 = Number(percent ? text2.slice(0, -1) : text2) / (percent ? 100 : 1e5);
2578
+ return Number.isFinite(n2) ? n2 : void 0;
2579
+ }
2580
+ function readPictureEffect(name, attribute2) {
2581
+ if (name === "grayscl") return { kind: "grayscale" };
2582
+ if (name === "lum") {
2583
+ const brightness = picturePercentage(attribute2("bright"));
2584
+ const contrast = picturePercentage(attribute2("contrast"));
2585
+ for (const [name2, value] of [
2586
+ ["bright", brightness],
2587
+ ["contrast", contrast]
2588
+ ]) {
2589
+ const raw2 = attribute2(name2);
2590
+ if (raw2 !== void 0 && raw2 !== null && (value === void 0 || Math.abs(value) > 1))
2591
+ return void 0;
2592
+ }
2593
+ return {
2594
+ kind: "luminance",
2595
+ ...brightness !== void 0 ? { brightness } : {},
2596
+ ...contrast !== void 0 ? { contrast } : {}
2597
+ };
2598
+ }
2599
+ if (name === "alphaModFix") {
2600
+ const raw2 = attribute2("amt");
2601
+ const amount = raw2 === void 0 || raw2 === null ? 1 : picturePercentage(raw2);
2602
+ if (amount !== void 0 && amount >= 0) return { kind: "alphaModFix", amount };
2603
+ }
2604
+ return void 0;
2605
+ }
2606
+ function parsePictureEffects(blip) {
2607
+ if (!blip) return [];
2608
+ return elements(blip).map((node) => ({
2609
+ ...(node.namespaceURI === NS.a ? readPictureEffect(node.localName, (name) => node.getAttribute(name)) : void 0) ?? { kind: "unsupported", name: node.localName },
2610
+ sourceXml: buildXml(node)
2611
+ }));
2612
+ }
2613
+ function applyPictureEffects(blip, effects2) {
2614
+ if (JSON.stringify(parsePictureEffects(blip)) === JSON.stringify(effects2)) return;
2615
+ const nodes = effects2.map((effect) => {
2616
+ const name = effect.kind === "grayscale" ? "grayscl" : effect.kind === "luminance" ? "lum" : effect.kind === "unsupported" ? effect.name : effect.kind;
2617
+ const source = effect.sourceXml ? parseXml(effect.sourceXml).documentElement : void 0;
2618
+ if (effect.kind === "unsupported" && !source)
2619
+ throw new Error("An unsupported picture effect needs source XML");
2620
+ const node = source ? blip.ownerDocument.importNode(source, true) : blip.ownerDocument.createElementNS(NS.a, `a:${name}`);
2621
+ if (effect.kind !== "unsupported" && (node.namespaceURI !== NS.a || node.localName !== name))
2622
+ throw new Error("Picture effect source does not match its kind");
2623
+ const set = (name2, value) => {
2624
+ const original = picturePercentage(node.getAttribute(name2));
2625
+ if (value === void 0) node.removeAttribute(name2);
2626
+ else if (value !== original) {
2627
+ if (!Number.isFinite(value)) throw new RangeError("Picture effect must be finite");
2628
+ node.setAttribute(name2, String(Math.round(value * 1e5)));
2629
+ }
2630
+ };
2631
+ if (effect.kind === "luminance") {
2632
+ if ([effect.brightness, effect.contrast].some(
2633
+ (value) => value !== void 0 && (!Number.isFinite(value) || Math.abs(value) > 1)
2634
+ ))
2635
+ throw new RangeError("Picture luminance must be between -1 and 1");
2636
+ set("bright", effect.brightness);
2637
+ set("contrast", effect.contrast);
2638
+ }
2639
+ if (effect.kind === "alphaModFix") {
2640
+ if (effect.amount < 0) throw new RangeError("Picture alpha must be nonnegative");
2641
+ set("amt", effect.amount);
2642
+ }
2643
+ return node;
2644
+ });
2645
+ for (const node of elements(blip)) blip.removeChild(node);
2646
+ for (const node of nodes) blip.appendChild(node);
2647
+ }
2648
+
2649
+ // drawingml/picture-fill.ts
2650
+ function parseDrawingPictureFill(fill) {
2651
+ const blip = first(fill, "blip", NS.a);
2652
+ const relId = blip?.getAttributeNS(NS.r, "embed") || blip?.getAttribute("r:embed") || void 0;
2653
+ const linkRelId = blip?.getAttributeNS(NS.r, "link") || void 0;
2654
+ const crop = parsePictureCrop(fill);
2655
+ const effects2 = parsePictureEffects(blip);
2656
+ const tile = first(fill, "tile", NS.a);
2657
+ const rect2 = first(first(fill, "stretch", NS.a), "fillRect", NS.a);
2658
+ const unsupported2 = [
2659
+ ...tile ? ["tile"] : [],
2660
+ ...rect2 && ["l", "t", "r", "b"].some((key) => Number(rect2.getAttribute(key) ?? 0) !== 0) ? ["fillRect"] : [],
2661
+ ...fill.getAttribute("rotWithShape") === "0" || fill.getAttribute("rotWithShape") === "false" ? ["rotWithShape"] : []
2662
+ ];
2663
+ return {
2664
+ kind: "picture",
2665
+ sourceXml: buildXml(fill),
2666
+ ...relId ? { relId } : {},
2667
+ ...linkRelId ? { linkRelId } : {},
2668
+ ...crop ? { crop } : {},
2669
+ ...effects2.length ? { effects: effects2 } : {},
2670
+ ...unsupported2.length ? { unsupportedPicture: unsupported2 } : {}
2671
+ };
2672
+ }
2673
+
2539
2674
  // drawingml/drawing-fill.ts
2540
2675
  var FILL_ELEMENTS = /* @__PURE__ */ new Set([
2541
2676
  "noFill",
@@ -2545,13 +2680,13 @@ var FILL_ELEMENTS = /* @__PURE__ */ new Set([
2545
2680
  "blipFill",
2546
2681
  "grpFill"
2547
2682
  ]);
2548
- function fillElementOf(properties2) {
2549
- return properties2 ? elements(properties2).find(
2683
+ function fillElementOf(properties) {
2684
+ return properties ? elements(properties).find(
2550
2685
  (element2) => FILL_ELEMENTS.has(element2.localName) && (!element2.namespaceURI || element2.namespaceURI === NS.a)
2551
2686
  ) : void 0;
2552
2687
  }
2553
- function parseDrawingFill(properties2) {
2554
- const fill = fillElementOf(properties2);
2688
+ function parseDrawingFill(properties) {
2689
+ const fill = fillElementOf(properties);
2555
2690
  if (!fill) return void 0;
2556
2691
  switch (fill.localName) {
2557
2692
  case "noFill":
@@ -2606,17 +2741,8 @@ function parseDrawingFill(properties2) {
2606
2741
  ...background ? { background } : {}
2607
2742
  };
2608
2743
  }
2609
- case "blipFill": {
2610
- const blip = first(fill, "blip", NS.a);
2611
- const relId = blip?.getAttributeNS(NS.r, "embed") || blip?.getAttribute("r:embed") || void 0;
2612
- const linkRelId = blip?.getAttributeNS(NS.r, "link") || void 0;
2613
- return {
2614
- kind: "picture",
2615
- sourceXml: buildXml(fill),
2616
- ...relId ? { relId } : {},
2617
- ...linkRelId ? { linkRelId } : {}
2618
- };
2619
- }
2744
+ case "blipFill":
2745
+ return parseDrawingPictureFill(fill);
2620
2746
  default:
2621
2747
  return { kind: "unsupported", element: fill.localName };
2622
2748
  }
@@ -2673,7 +2799,7 @@ function drawingDashLength(value) {
2673
2799
  }
2674
2800
 
2675
2801
  // chart/read-appearance.ts
2676
- function readChartAppearance(text2, properties2) {
2802
+ function readChartAppearance(text2, properties) {
2677
2803
  const out = {};
2678
2804
  const size = Number(text2?.getAttribute("sz") ?? NaN);
2679
2805
  if (Number.isFinite(size) && size > 0) out.fontSize = size / 100;
@@ -2690,8 +2816,8 @@ function readChartAppearance(text2, properties2) {
2690
2816
  if (typeface2) out.typeface = typeface2;
2691
2817
  const color2 = parseDrawingColorIn(first(text2, "solidFill", NS.a));
2692
2818
  if (color2) out.textColor = color2;
2693
- const fill = parseDrawingFill(properties2);
2694
- const line2 = parseDrawingLine(first(properties2, "ln", NS.a));
2819
+ const fill = parseDrawingFill(properties);
2820
+ const line2 = parseDrawingLine(first(properties, "ln", NS.a));
2695
2821
  if (fill) out.fill = fill;
2696
2822
  if (line2) out.line = line2;
2697
2823
  const effects2 = first(text2, "effectLst", NS.a);
@@ -2776,19 +2902,19 @@ function parseSpacing(parent) {
2776
2902
  }
2777
2903
  return void 0;
2778
2904
  }
2779
- function parseProperties(properties2) {
2905
+ function parseProperties(properties) {
2780
2906
  const parsed = {};
2781
- const size = Number.parseInt(properties2?.getAttribute("sz") ?? "", 10);
2907
+ const size = Number.parseInt(properties?.getAttribute("sz") ?? "", 10);
2782
2908
  if (Number.isFinite(size)) parsed.sizePt = size / 100;
2783
- const bold = booleanAttribute(properties2, "b");
2909
+ const bold = booleanAttribute(properties, "b");
2784
2910
  if (bold !== void 0) parsed.bold = bold;
2785
- const italic = booleanAttribute(properties2, "i");
2911
+ const italic = booleanAttribute(properties, "i");
2786
2912
  if (italic !== void 0) parsed.italic = italic;
2787
- const underline = properties2?.getAttribute("u");
2913
+ const underline = properties?.getAttribute("u");
2788
2914
  if (underline) parsed.underline = underline !== "none";
2789
- const color2 = parseDrawingColorIn(first(properties2, "solidFill", NS.a));
2915
+ const color2 = parseDrawingColorIn(first(properties, "solidFill", NS.a));
2790
2916
  if (color2) parsed.color = color2;
2791
- const typeface2 = first(properties2, "latin", NS.a)?.getAttribute("typeface");
2917
+ const typeface2 = first(properties, "latin", NS.a)?.getAttribute("typeface");
2792
2918
  if (typeface2) parsed.typeface = typeface2;
2793
2919
  return parsed;
2794
2920
  }
@@ -2803,12 +2929,12 @@ function parseParagraph(paragraph2) {
2803
2929
  for (const child3 of elements(paragraph2))
2804
2930
  if (child3.namespaceURI === NS.a && ["r", "fld", "br"].includes(child3.localName))
2805
2931
  runs.push(parseRun(child3));
2806
- const properties2 = first(paragraph2, "pPr", NS.a);
2807
- const align = properties2?.getAttribute("algn");
2808
- const defaults = parseProperties(first(properties2, "defRPr", NS.a));
2809
- const lineSpacing = parseSpacing(first(properties2, "lnSpc", NS.a));
2810
- const spaceBefore = parseSpacing(first(properties2, "spcBef", NS.a));
2811
- const spaceAfter = parseSpacing(first(properties2, "spcAft", NS.a));
2932
+ const properties = first(paragraph2, "pPr", NS.a);
2933
+ const align = properties?.getAttribute("algn");
2934
+ const defaults = parseProperties(first(properties, "defRPr", NS.a));
2935
+ const lineSpacing = parseSpacing(first(properties, "lnSpc", NS.a));
2936
+ const spaceBefore = parseSpacing(first(properties, "spcBef", NS.a));
2937
+ const spaceAfter = parseSpacing(first(properties, "spcAft", NS.a));
2812
2938
  return {
2813
2939
  ...align ? { align } : {},
2814
2940
  ...Object.keys(defaults).length ? { defaultProperties: defaults } : {},
@@ -2820,13 +2946,13 @@ function parseParagraph(paragraph2) {
2820
2946
  }
2821
2947
  function parseDrawingTextBody(body) {
2822
2948
  if (!body) return void 0;
2823
- const properties2 = first(body, "bodyPr", NS.a);
2949
+ const properties = first(body, "bodyPr", NS.a);
2824
2950
  const paragraphs = children(body, "p", NS.a).map(parseParagraph);
2825
2951
  const result = {
2826
2952
  paragraphs,
2827
2953
  text: paragraphs.map((paragraph2) => paragraph2.runs.map((run2) => run2.text).join("")).join("\n")
2828
2954
  };
2829
- const anchor = properties2?.getAttribute("anchor");
2955
+ const anchor = properties?.getAttribute("anchor");
2830
2956
  if (anchor) result.anchor = anchor;
2831
2957
  const insets = {};
2832
2958
  for (const [key, attribute2] of [
@@ -2835,7 +2961,7 @@ function parseDrawingTextBody(body) {
2835
2961
  ["right", "rIns"],
2836
2962
  ["bottom", "bIns"]
2837
2963
  ]) {
2838
- const value = Number.parseInt(properties2?.getAttribute(attribute2) ?? "", 10);
2964
+ const value = Number.parseInt(properties?.getAttribute(attribute2) ?? "", 10);
2839
2965
  if (Number.isFinite(value)) insets[key] = value;
2840
2966
  }
2841
2967
  if (Object.keys(insets).length > 0) result.insetsEmu = insets;
@@ -2885,6 +3011,20 @@ function resolveManualLayoutRect(layout, frame, auto) {
2885
3011
  const height = layout.height === void 0 ? auto.height : layout.heightMode === "edge" ? layout.height * frame.height - y : layout.height * frame.height;
2886
3012
  return { x, y, width: Math.max(width, 1), height: Math.max(height, 1) };
2887
3013
  }
3014
+ function resolveManualPlotRect(layout, frame, auto, bands) {
3015
+ const rect2 = resolveManualLayoutRect(layout, frame, auto);
3016
+ if (!rect2 || layout?.layoutTarget === "inner") return rect2;
3017
+ return {
3018
+ x: rect2.x + bands.left,
3019
+ y: rect2.y + bands.top,
3020
+ width: Math.max(1, rect2.width - bands.left - bands.right),
3021
+ height: Math.max(1, rect2.height - bands.top - bands.bottom)
3022
+ };
3023
+ }
3024
+ function applyLabelManualLayout(layout, frame, point) {
3025
+ const rect2 = resolveManualLayoutRect(layout, frame, { ...point, width: 1, height: 1 });
3026
+ return rect2 ? { x: rect2.x, y: rect2.y } : point;
3027
+ }
2888
3028
 
2889
3029
  // chart/read-formatting.ts
2890
3030
  var c = (parent, name) => first(parent, name, NS.c);
@@ -3143,6 +3283,10 @@ function drawingPatternPictureXml(fill) {
3143
3283
  else if (blip.getAttributeNS(NS.r, attribute2) !== value)
3144
3284
  blip.setAttributeNS(NS.r, `r:${attribute2}`, value);
3145
3285
  }
3286
+ if (fill.crop !== void 0 && JSON.stringify(before?.kind === "picture" ? before.crop : void 0) !== JSON.stringify(fill.crop))
3287
+ applyPictureCrop(root, fill.crop);
3288
+ if (fill.effects !== void 0 && JSON.stringify(before?.kind === "picture" ? before.effects ?? [] : []) !== JSON.stringify(fill.effects ?? []))
3289
+ applyPictureEffects(blip, fill.effects ?? []);
3146
3290
  if (!fill.sourceXml) {
3147
3291
  const stretch = doc.createElementNS(NS.a, "a:stretch");
3148
3292
  stretch.appendChild(doc.createElementNS(NS.a, "a:fillRect"));
@@ -3153,26 +3297,26 @@ function drawingPatternPictureXml(fill) {
3153
3297
  }
3154
3298
 
3155
3299
  // drawingml/write-fill.ts
3156
- function setDrawingFillXml(properties2, xml) {
3157
- const doc = properties2.ownerDocument;
3300
+ function setDrawingFillXml(properties, xml) {
3301
+ const doc = properties.ownerDocument;
3158
3302
  const wrapper = parseXml(`<w xmlns:a="${NS.a}">${xml}</w>`);
3159
3303
  const fill = elements(wrapper.documentElement)[0];
3160
3304
  const names = ["solidFill", "gradFill", "pattFill", "blipFill", "grpFill", "noFill"];
3161
3305
  if (elements(wrapper.documentElement).length !== 1 || !fill || fill.namespaceURI !== NS.a || !names.includes(fill.localName))
3162
3306
  throw new Error("Invalid DrawingML fill XML");
3163
- const existing = elements(properties2).filter(
3307
+ const existing = elements(properties).filter(
3164
3308
  (node) => node.namespaceURI === NS.a && names.includes(node.localName)
3165
3309
  );
3166
3310
  const next = doc.importNode(fill, true);
3167
- if (existing[0]) properties2.replaceChild(next, existing[0]);
3311
+ if (existing[0]) properties.replaceChild(next, existing[0]);
3168
3312
  else
3169
- properties2.insertBefore(
3313
+ properties.insertBefore(
3170
3314
  next,
3171
- elements(properties2).find(
3315
+ elements(properties).find(
3172
3316
  (node) => node.namespaceURI === NS.a && ["ln", "effectLst", "effectDag", "scene3d", "sp3d", "extLst"].includes(node.localName)
3173
3317
  ) ?? null
3174
3318
  );
3175
- for (const extra of existing.slice(1)) properties2.removeChild(extra);
3319
+ for (const extra of existing.slice(1)) properties.removeChild(extra);
3176
3320
  }
3177
3321
  function drawingFillXml(fill) {
3178
3322
  if (fill.kind === "none") return "<a:noFill/>";
@@ -3255,12 +3399,12 @@ function writeChartFillFormatting(root, formatting) {
3255
3399
  for (const [part, node] of Object.entries(chartFormattingNodes(root))) {
3256
3400
  const fill = formatting.entries[part]?.fill;
3257
3401
  if (!node || !fill) continue;
3258
- let properties2 = first(node, "spPr", NS.c);
3259
- if (JSON.stringify(parseDrawingFill(properties2)) === JSON.stringify(fill)) continue;
3402
+ let properties = first(node, "spPr", NS.c);
3403
+ if (JSON.stringify(parseDrawingFill(properties)) === JSON.stringify(fill)) continue;
3260
3404
  const xml = drawingFillXml(fill);
3261
3405
  if (xml === void 0) continue;
3262
- if (!properties2) {
3263
- properties2 = root.ownerDocument.createElementNS(NS.c, "c:spPr");
3406
+ if (!properties) {
3407
+ properties = root.ownerDocument.createElementNS(NS.c, "c:spPr");
3264
3408
  const successors = [
3265
3409
  "txPr",
3266
3410
  "crossAx",
@@ -3279,13 +3423,13 @@ function writeChartFillFormatting(root, formatting) {
3279
3423
  "extLst"
3280
3424
  ];
3281
3425
  node.insertBefore(
3282
- properties2,
3426
+ properties,
3283
3427
  elements(node).find(
3284
3428
  (child3) => child3.namespaceURI === NS.c && successors.includes(child3.localName)
3285
3429
  ) ?? null
3286
3430
  );
3287
3431
  }
3288
- setDrawingFillXml(properties2, xml);
3432
+ setDrawingFillXml(properties, xml);
3289
3433
  changed = true;
3290
3434
  }
3291
3435
  return changed;
@@ -4816,8 +4960,8 @@ function drawingLineXml(line2) {
4816
4960
  }
4817
4961
 
4818
4962
  // chart/write-text-body.ts
4819
- function runProperties(local, properties2) {
4820
- const p = properties2 ?? {};
4963
+ function runProperties(local, properties) {
4964
+ const p = properties ?? {};
4821
4965
  const attributes2 = [
4822
4966
  p.sizePt === void 0 ? "" : ` sz="${Math.round(p.sizePt * 100)}"`,
4823
4967
  p.bold === void 0 ? "" : ` b="${p.bold ? 1 : 0}"`,
@@ -4833,16 +4977,16 @@ function spacing(local, value) {
4833
4977
  return `<a:${local}>${inner}</a:${local}>`;
4834
4978
  }
4835
4979
  function run(value) {
4836
- const { text: text2, ...properties2 } = value;
4837
- const hasProperties = Object.keys(properties2).length > 0;
4980
+ const { text: text2, ...properties } = value;
4981
+ const hasProperties = Object.keys(properties).length > 0;
4838
4982
  if (text2 === "\n")
4839
- return hasProperties ? `<a:br>${runProperties("rPr", properties2)}</a:br>` : "<a:br/>";
4840
- return `<a:r>${hasProperties ? runProperties("rPr", properties2) : ""}<a:t>${escapeText(text2)}</a:t></a:r>`;
4983
+ return hasProperties ? `<a:br>${runProperties("rPr", properties)}</a:br>` : "<a:br/>";
4984
+ return `<a:r>${hasProperties ? runProperties("rPr", properties) : ""}<a:t>${escapeText(text2)}</a:t></a:r>`;
4841
4985
  }
4842
4986
  function paragraph(value) {
4843
4987
  const align = value.align ? ` algn="${escapeAttribute(value.align)}"` : "";
4844
- const properties2 = spacing("lnSpc", value.lineSpacing) + spacing("spcBef", value.spaceBefore) + spacing("spcAft", value.spaceAfter) + runProperties("defRPr", value.defaultProperties);
4845
- return `<a:p><a:pPr${align}>${properties2}</a:pPr>${value.runs.map(run).join("")}</a:p>`;
4988
+ const properties = spacing("lnSpc", value.lineSpacing) + spacing("spcBef", value.spaceBefore) + spacing("spcAft", value.spaceAfter) + runProperties("defRPr", value.defaultProperties);
4989
+ return `<a:p><a:pPr${align}>${properties}</a:pPr>${value.runs.map(run).join("")}</a:p>`;
4846
4990
  }
4847
4991
  function writeTextBody(body) {
4848
4992
  const insets = body.insetsEmu ?? {};
@@ -4987,7 +5131,7 @@ function dataSourceInner(source) {
4987
5131
  case "multiLvlStrRef": {
4988
5132
  const levels = source.levels ? elementXml(
4989
5133
  "multiLvlStrCache",
4990
- valXml("ptCount", source.levelPointCount) + source.levels.map((level2) => elementXml("lvl", cachePoints(level2))).join("")
5134
+ valXml("ptCount", source.levelPointCount) + source.levels.map((level3) => elementXml("lvl", cachePoints(level3))).join("")
4991
5135
  ) : "";
4992
5136
  return `<c:multiLvlStrRef>${formula2}${levels}</c:multiLvlStrRef>`;
4993
5137
  }
@@ -5476,7 +5620,7 @@ function parseDimension(context, element2) {
5476
5620
  return assignDefined(
5477
5621
  {
5478
5622
  kind: element2.localName,
5479
- levels: cxChildren(element2, "lvl").map((level2) => parseLevel(context, level2))
5623
+ levels: cxChildren(element2, "lvl").map((level3) => parseLevel(context, level3))
5480
5624
  },
5481
5625
  {
5482
5626
  type: attribute(element2, "type"),
@@ -5917,13 +6061,13 @@ function numberFormatXml2(format) {
5917
6061
  function dataXml(context, data) {
5918
6062
  const dimensions = data.dimensions.map((dimension2) => {
5919
6063
  const levels = dimension2.levels.map(
5920
- (level2) => cxElement(
6064
+ (level3) => cxElement(
5921
6065
  "lvl",
5922
- level2.points.map((point) => cxText("pt", point.value, attributes([["idx", point.index]]))).join("") + raw(context, level2.extLst),
6066
+ level3.points.map((point) => cxText("pt", point.value, attributes([["idx", point.index]]))).join("") + raw(context, level3.extLst),
5923
6067
  attributes([
5924
- ["ptCount", level2.pointCount],
5925
- ["formatCode", level2.formatCode],
5926
- ["name", level2.name]
6068
+ ["ptCount", level3.pointCount],
6069
+ ["formatCode", level3.formatCode],
6070
+ ["name", level3.name]
5927
6071
  ])
5928
6072
  )
5929
6073
  ).join("");
@@ -6293,6 +6437,7 @@ function firstChartGroup(space) {
6293
6437
  return group2;
6294
6438
  }
6295
6439
  function assignOrDelete(target, key, value) {
6440
+ if (key === "__proto__" || key === "constructor" || key === "prototype") return;
6296
6441
  if (value === void 0) delete target[key];
6297
6442
  else target[key] = value;
6298
6443
  }
@@ -6452,6 +6597,11 @@ function chartExSeriesAt(space, index) {
6452
6597
  if (!series2) throw new RangeError(`No chart series at index ${String(index)}`);
6453
6598
  return series2;
6454
6599
  }
6600
+ function chartExAxisAt(space, index) {
6601
+ const axis = typeof index === "number" && Number.isSafeInteger(index) ? space.plotArea.axes.find((_, position) => position === index) : void 0;
6602
+ if (!axis) throw new RangeError(`No chart axis at index ${String(index)}`);
6603
+ return axis;
6604
+ }
6455
6605
  function setChartExTitle(space, text2) {
6456
6606
  return editChartExSpace(space, (draft) => {
6457
6607
  if (text2 === void 0) {
@@ -6568,15 +6718,15 @@ function chartExValueType(layoutId) {
6568
6718
  return layoutId === "treemap" || layoutId === "sunburst" ? "size" : layoutId === "regionMap" ? "colorVal" : "val";
6569
6719
  }
6570
6720
  function freshLevel(values, previous, numeric) {
6571
- const level2 = {
6721
+ const level3 = {
6572
6722
  pointCount: values.length,
6573
6723
  points: values.flatMap(
6574
6724
  (value, index) => value === null || value === "" ? [] : [{ index, value: String(value) }]
6575
6725
  )
6576
6726
  };
6577
- if (numeric) level2.formatCode = previous?.formatCode ?? "General";
6578
- if (previous?.name !== void 0) level2.name = previous.name;
6579
- return level2;
6727
+ if (numeric) level3.formatCode = previous?.formatCode ?? "General";
6728
+ if (previous?.name !== void 0) level3.name = previous.name;
6729
+ return level3;
6580
6730
  }
6581
6731
  function dataOf(draft, index) {
6582
6732
  const series2 = chartExSeriesAt(draft, index);
@@ -6623,7 +6773,7 @@ function setChartExCategories(space, categories) {
6623
6773
  seen.add(data);
6624
6774
  const dimension2 = dimensionOf(data, "strDim", "cat");
6625
6775
  dimension2.levels = levels.map(
6626
- (level2, position) => freshLevel(level2, dimension2.levels[position], false)
6776
+ (level3, position) => freshLevel(level3, dimension2.levels[position], false)
6627
6777
  );
6628
6778
  });
6629
6779
  });
@@ -6653,14 +6803,14 @@ function addChartExSeries(space, name, templateIndex = 0) {
6653
6803
  delete dimension2.formula;
6654
6804
  delete dimension2.nameFormula;
6655
6805
  if (dimension2.kind === "numDim")
6656
- for (const level2 of dimension2.levels) {
6806
+ for (const level3 of dimension2.levels) {
6657
6807
  const count = Math.max(
6658
- level2.pointCount ?? 0,
6659
- ...level2.points.map((point) => (point.index ?? 0) + 1),
6808
+ level3.pointCount ?? 0,
6809
+ ...level3.points.map((point) => (point.index ?? 0) + 1),
6660
6810
  0
6661
6811
  );
6662
- level2.pointCount = count;
6663
- level2.points = Array.from({ length: count }, (_, index) => ({ index, value: "0" }));
6812
+ level3.pointCount = count;
6813
+ level3.points = Array.from({ length: count }, (_, index) => ({ index, value: "0" }));
6664
6814
  }
6665
6815
  }
6666
6816
  draft.chartData.data.push(copy);
@@ -6737,15 +6887,14 @@ function setChartExLayout(space, layout) {
6737
6887
  });
6738
6888
  }
6739
6889
  function setChartExAxis(space, index, edit) {
6740
- if (!Number.isSafeInteger(index) || !space.plotArea.axes[index])
6741
- throw new RangeError("No chart axis at index.");
6890
+ chartExAxisAt(space, index);
6742
6891
  if (edit.scaling) {
6743
6892
  for (const value of Object.values(edit.scaling))
6744
6893
  if (typeof value === "number" && !Number.isFinite(value))
6745
6894
  throw new RangeError("Axis values must be finite.");
6746
6895
  }
6747
6896
  return editChartExSpace(space, (draft) => {
6748
- Object.assign(draft.plotArea.axes[index], edit);
6897
+ Object.assign(chartExAxisAt(draft, index), edit);
6749
6898
  });
6750
6899
  }
6751
6900
  function setChartExPointLabel(space, seriesIndex, pointIndex, label) {
@@ -6779,14 +6928,14 @@ function chartExSeriesDimension(space, index, numeric) {
6779
6928
  (d) => d.kind === (numeric ? "numDim" : "strDim") && (d.type === type || !numeric && d.type === void 0)
6780
6929
  );
6781
6930
  }
6782
- function chartExLevelValues(level2) {
6931
+ function chartExLevelValues(level3) {
6783
6932
  const count = Math.max(
6784
- level2?.pointCount ?? 0,
6785
- ...(level2?.points ?? []).map((p) => (p.index ?? 0) + 1),
6933
+ level3?.pointCount ?? 0,
6934
+ ...(level3?.points ?? []).map((p) => (p.index ?? 0) + 1),
6786
6935
  0
6787
6936
  );
6788
6937
  const values = Array(count).fill("");
6789
- for (const point of level2?.points ?? [])
6938
+ for (const point of level3?.points ?? [])
6790
6939
  if (point.index !== void 0 && point.index >= 0 && point.index < count)
6791
6940
  values[point.index] = point.value;
6792
6941
  return values;
@@ -6810,9 +6959,9 @@ function chartExSpaceDataSheet(space) {
6810
6959
  }))
6811
6960
  };
6812
6961
  }
6813
- function rewrite(level2, values) {
6814
- level2.pointCount = values.length;
6815
- level2.points = values.flatMap(
6962
+ function rewrite(level3, values) {
6963
+ level3.pointCount = values.length;
6964
+ level3.points = values.flatMap(
6816
6965
  (value, index) => value === null || value === "" ? [] : [{ index, value: String(value) }]
6817
6966
  );
6818
6967
  }
@@ -6848,17 +6997,17 @@ function applyChartExSpaceDataSheetEdits(space, edits) {
6848
6997
  const dimension2 = chartExSeriesDimension(draft, i, numeric);
6849
6998
  if (!dimension2 || seen.has(dimension2)) continue;
6850
6999
  seen.add(dimension2);
6851
- dimension2.levels.forEach((level2, l) => {
6852
- const values = chartExLevelValues(level2);
7000
+ dimension2.levels.forEach((level3, l) => {
7001
+ const values = chartExLevelValues(level3);
6853
7002
  if (edit.kind === "category-label") {
6854
- if (!numeric && l === 0) rewrite(level2, next.categories);
7003
+ if (!numeric && l === 0) rewrite(level3, next.categories);
6855
7004
  } else if (edit.kind === "add-category") {
6856
7005
  values.push(numeric ? "0" : "");
6857
7006
  if (!numeric && l === 0) values[values.length - 1] = next.categories.at(-1);
6858
- rewrite(level2, values);
7007
+ rewrite(level3, values);
6859
7008
  } else if (edit.kind === "remove-category") {
6860
7009
  values.splice(edit.category, 1);
6861
- rewrite(level2, values);
7010
+ rewrite(level3, values);
6862
7011
  }
6863
7012
  });
6864
7013
  }
@@ -7033,8 +7182,8 @@ function dimensionWrites(dimension2, resolve) {
7033
7182
  const count = horizontal ? range2.end.col - range2.start.col + 1 : range2.end.row - range2.start.row + 1;
7034
7183
  if (levelCount !== dimension2.levels.length)
7035
7184
  throw new Error("ChartEx source dimensions do not match cached levels.");
7036
- return dimension2.levels.map((level2, index) => {
7037
- const values = chartExLevelValues(level2);
7185
+ return dimension2.levels.map((level3, index) => {
7186
+ const values = chartExLevelValues(level3);
7038
7187
  if (values.length !== count)
7039
7188
  throw new Error("ChartEx source range does not match cached points.");
7040
7189
  const offset = dimension2.kind === "strDim" ? levelCount - 1 - index : index;
@@ -7081,10 +7230,10 @@ function chartExDataChanged(before, after) {
7081
7230
  kind: dimension2.kind,
7082
7231
  formula: dimension2.formula,
7083
7232
  nameFormula: dimension2.nameFormula,
7084
- levels: dimension2.levels.map((level2) => ({
7085
- pointCount: level2.pointCount,
7086
- points: level2.points,
7087
- name: level2.name
7233
+ levels: dimension2.levels.map((level3) => ({
7234
+ pointCount: level3.pointCount,
7235
+ points: level3.points,
7236
+ name: level3.name
7088
7237
  }))
7089
7238
  }))
7090
7239
  });
@@ -7119,9 +7268,9 @@ function dimensionLevels(dimension2, read) {
7119
7268
  const horizontal = dimension2.formula.direction === "row";
7120
7269
  const count = horizontal ? grid.columns : grid.rows;
7121
7270
  const length = horizontal ? grid.rows : grid.columns;
7122
- const levels = Array.from({ length }, (_, level2) => {
7123
- const offset = dimension2.kind === "strDim" ? length - 1 - level2 : level2;
7124
- const previous = dimension2.levels[level2];
7271
+ const levels = Array.from({ length }, (_, level3) => {
7272
+ const offset = dimension2.kind === "strDim" ? length - 1 - level3 : level3;
7273
+ const previous = dimension2.levels[level3];
7125
7274
  const points2 = Array.from({ length: count }, (_2, index) => {
7126
7275
  const value = grid.values[horizontal ? offset * grid.columns + index : index * grid.columns + offset];
7127
7276
  return value === null || value === void 0 || value === "" ? [] : [{ index, value: String(value) }];
@@ -7161,8 +7310,8 @@ function chartExDataLayout(space, sheetName) {
7161
7310
  const start = columns.length;
7162
7311
  const ordered = dimension2.kind === "strDim" ? [...dimension2.levels].reverse() : dimension2.levels;
7163
7312
  let count2 = 0;
7164
- for (const level2 of ordered) {
7165
- const values = chartExLevelValues(level2);
7313
+ for (const level3 of ordered) {
7314
+ const values = chartExLevelValues(level3);
7166
7315
  count2 = Math.max(count2, values.length);
7167
7316
  const data2 = values.map((value) => {
7168
7317
  if (dimension2.kind !== "numDim") return value;
@@ -7171,7 +7320,7 @@ function chartExDataLayout(space, sheetName) {
7171
7320
  if (!Number.isFinite(n2)) throw new Error("Numeric chart data is invalid.");
7172
7321
  return n2;
7173
7322
  });
7174
- columns.push([level2.name ?? `Data ${columns.length + 1}`, ...data2]);
7323
+ columns.push([level3.name ?? `Data ${columns.length + 1}`, ...data2]);
7175
7324
  }
7176
7325
  if (!count2) throw new Error("ChartEx source has no data points.");
7177
7326
  const first2 = ref(start, count2).split(":")[0];
@@ -7211,18 +7360,18 @@ function cell(col, row, value) {
7211
7360
  return `<c r="${ref}" t="inlineStr"><is><t xml:space="preserve">${escape(value)}</t></is></c>`;
7212
7361
  }
7213
7362
  function chartDataWorksheetXml(sheet) {
7214
- const rows = [];
7363
+ const rows2 = [];
7215
7364
  const header = sheet.series.map((series2, index) => cell(index + 1, 0, series2.name)).join("");
7216
- rows.push(`<row r="1">${header}</row>`);
7365
+ rows2.push(`<row r="1">${header}</row>`);
7217
7366
  sheet.categories.forEach((label, category) => {
7218
7367
  const values = sheet.series.map((series2, index) => cell(index + 1, category + 1, series2.values[category] ?? null)).join("");
7219
- rows.push(`<row r="${category + 2}">${cell(0, category + 1, label)}${values}</row>`);
7368
+ rows2.push(`<row r="${category + 2}">${cell(0, category + 1, label)}${values}</row>`);
7220
7369
  });
7221
7370
  const last = formatCellAddress({
7222
7371
  col: Math.max(1, sheet.series.length),
7223
7372
  row: Math.max(1, sheet.categories.length)
7224
7373
  });
7225
- return `${DECLARATION4}<worksheet xmlns="${MAIN}" xmlns:r="${REL}"><dimension ref="A1:${last}"/><sheetData>${rows.join("")}</sheetData><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/></worksheet>`;
7374
+ return `${DECLARATION4}<worksheet xmlns="${MAIN}" xmlns:r="${REL}"><dimension ref="A1:${last}"/><sheetData>${rows2.join("")}</sheetData><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/></worksheet>`;
7226
7375
  }
7227
7376
  var STYLES = `${DECLARATION4}<styleSheet xmlns="${MAIN}"><fonts count="1"><font><sz val="11"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles></styleSheet>`;
7228
7377
  async function createChartWorkbook(sheet, sheetName = DEFAULT_CHART_SHEET_NAME) {
@@ -7247,10 +7396,10 @@ async function createChartWorkbook(sheet, sheetName = DEFAULT_CHART_SHEET_NAME)
7247
7396
  zip.file("xl/styles.xml", STYLES);
7248
7397
  return zip.generateAsync({ type: "uint8array", compression: "DEFLATE" });
7249
7398
  }
7250
- function chartWorkbookRowsXml(rows) {
7251
- const count = Math.max(1, ...rows.map((row) => row.length));
7252
- const body = rows.map((row, r) => `<row r="${r + 1}">${row.map((value, c2) => cell(c2, r, value)).join("")}</row>`).join("");
7253
- const last = formatCellAddress({ col: count - 1, row: Math.max(0, rows.length - 1) });
7399
+ function chartWorkbookRowsXml(rows2) {
7400
+ const count = Math.max(1, ...rows2.map((row) => row.length));
7401
+ const body = rows2.map((row, r) => `<row r="${r + 1}">${row.map((value, c2) => cell(c2, r, value)).join("")}</row>`).join("");
7402
+ const last = formatCellAddress({ col: count - 1, row: Math.max(0, rows2.length - 1) });
7254
7403
  return `${DECLARATION4}<worksheet xmlns="${MAIN}" xmlns:r="${REL}"><dimension ref="A1:${last}"/><sheetData>${body}</sheetData><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/></worksheet>`;
7255
7404
  }
7256
7405
  var DEFAULT_ZIP_LIMITS = {
@@ -7530,12 +7679,12 @@ function ensureCell(sheetData, ref) {
7530
7679
  const address = parseCellAddress(ref);
7531
7680
  if (!address) return void 0;
7532
7681
  const rowNumber = address.row + 1;
7533
- const rows = childrenNamed(sheetData, "row");
7534
- let row = rows.find((candidate) => Number(candidate.getAttribute("r")) === rowNumber);
7682
+ const rows2 = childrenNamed(sheetData, "row");
7683
+ let row = rows2.find((candidate) => Number(candidate.getAttribute("r")) === rowNumber);
7535
7684
  if (!row) {
7536
7685
  row = create(sheetData, "row");
7537
7686
  row.setAttribute("r", String(rowNumber));
7538
- const after = rows.find((candidate) => Number(candidate.getAttribute("r")) > rowNumber);
7687
+ const after = rows2.find((candidate) => Number(candidate.getAttribute("r")) > rowNumber);
7539
7688
  sheetData.insertBefore(row, after ?? null);
7540
7689
  }
7541
7690
  const cells = childrenNamed(row, "c");
@@ -7639,12 +7788,12 @@ function syncTable(table, doc, writes, shared) {
7639
7788
  const cols = new Set(
7640
7789
  cells.filter((cell2) => cell2.row >= box.start.row && cell2.row <= box.end.row + 1).map((cell2) => cell2.col)
7641
7790
  );
7642
- const rows = new Set(
7791
+ const rows2 = new Set(
7643
7792
  cells.filter((cell2) => cell2.col >= box.start.col && cell2.col <= box.end.col + 1).map((cell2) => cell2.row)
7644
7793
  );
7645
7794
  const next = {
7646
7795
  start: box.start,
7647
- end: { col: grown(box.end.col, cols), row: grown(box.end.row, rows) }
7796
+ end: { col: grown(box.end.col, cols), row: grown(box.end.row, rows2) }
7648
7797
  };
7649
7798
  let changed = false;
7650
7799
  const list = childrenNamed(columns, "tableColumn");
@@ -7917,10 +8066,10 @@ async function appendChartWorkbookSheet(bytes, rowsForName, options2 = {}) {
7917
8066
  break;
7918
8067
  }
7919
8068
  }
7920
- const rows = rowsForName(sheetName);
7921
- if (rows.length > 1048576 || rows.some((row) => row.length > 16384))
8069
+ const rows2 = rowsForName(sheetName);
8070
+ if (rows2.length > 1048576 || rows2.some((row) => row.length > 16384))
7922
8071
  throw new RangeError("Chart data exceeds worksheet bounds.");
7923
- for (const row of rows)
8072
+ for (const row of rows2)
7924
8073
  for (const value of row)
7925
8074
  if (typeof value === "number" && !Number.isFinite(value))
7926
8075
  throw new RangeError("Chart workbook numbers must be finite.");
@@ -7976,7 +8125,7 @@ async function appendChartWorkbookSheet(bytes, rowsForName, options2 = {}) {
7976
8125
  zip.file("xl/workbook.xml", DECLARATION5 + buildXml(workbook), { createFolders: false });
7977
8126
  zip.file("xl/_rels/workbook.xml.rels", DECLARATION5 + buildXml(rels), { createFolders: false });
7978
8127
  zip.file("[Content_Types].xml", DECLARATION5 + buildXml(types), { createFolders: false });
7979
- zip.file(part, chartWorkbookRowsXml(rows), { createFolders: false });
8128
+ zip.file(part, chartWorkbookRowsXml(rows2), { createFolders: false });
7980
8129
  return {
7981
8130
  bytes: await zip.generateAsync({ type: "uint8array", compression: "DEFLATE" }),
7982
8131
  sheetName
@@ -8281,6 +8430,9 @@ function summaryAnalysis(series2) {
8281
8430
  // chart/render/summary-labels.ts
8282
8431
  function level(options2, custom) {
8283
8432
  const out = {};
8433
+ if (options2.layout) out.layout = options2.layout;
8434
+ if (options2.showLeaderLines !== void 0) out.showLeaderLines = options2.showLeaderLines;
8435
+ if (options2.leaderLines?.spPr?.line) out.leaderLine = options2.leaderLines.spPr.line;
8284
8436
  if (options2.deleted !== void 0) out.deleted = options2.deleted;
8285
8437
  if (options2.showValue !== void 0) out.showValue = options2.showValue;
8286
8438
  if (options2.showCategoryName !== void 0) out.showCategory = options2.showCategoryName;
@@ -8330,7 +8482,7 @@ var GROUP_TYPES = {
8330
8482
  surface: "surface"
8331
8483
  };
8332
8484
  var GROUPINGS = /* @__PURE__ */ new Set(["clustered", "stacked", "percentStacked", "standard"]);
8333
- function chartSummarySeries(source, chartType, groupLabels) {
8485
+ function chartSummarySeries(source, chartType, groupLabels, groupSmooth) {
8334
8486
  const categories = source.categories ?? source.xValues;
8335
8487
  const values = source.values ?? source.yValues;
8336
8488
  const numeric = (v) => typeof v === "number" ? v : v === "" ? null : Number.isFinite(Number(v)) ? Number(v) : null;
@@ -8338,6 +8490,9 @@ function chartSummarySeries(source, chartType, groupLabels) {
8338
8490
  categories: chartSourceValues(categories),
8339
8491
  values: chartSourceValues(values).map(numeric)
8340
8492
  };
8493
+ const smooth = source.smooth ?? groupSmooth;
8494
+ if (smooth !== void 0) out.smooth = smooth;
8495
+ if (source.spPr?.line) out.line = source.spPr.line;
8341
8496
  if (values?.cache?.formatCode !== void 0) out.numberFormat = values.cache.formatCode;
8342
8497
  if (source.bubbleSizes) {
8343
8498
  out.bubbleSizes = chartSourceValues(source.bubbleSizes).map(numeric);
@@ -8358,12 +8513,12 @@ function chartSummarySeries(source, chartType, groupLabels) {
8358
8513
  const points2 = {};
8359
8514
  const pointFills = {};
8360
8515
  for (const point of source.dataPoints) {
8361
- const properties2 = point.spPr ?? point.marker?.spPr;
8516
+ const properties = point.spPr ?? point.marker?.spPr;
8362
8517
  if (point.index === void 0) continue;
8363
- const pointColor = solidColor(properties2?.fill);
8518
+ const pointColor = solidColor(properties?.fill);
8364
8519
  if (pointColor) points2[point.index] = pointColor;
8365
- if (properties2?.fill && properties2.fill.kind !== "solid")
8366
- pointFills[point.index] = properties2.fill;
8520
+ if (properties?.fill && properties.fill.kind !== "solid")
8521
+ pointFills[point.index] = properties.fill;
8367
8522
  }
8368
8523
  if (Object.keys(points2).length) out.pointColors = points2;
8369
8524
  if (Object.keys(pointFills).length) out.pointFills = pointFills;
@@ -8397,7 +8552,12 @@ function extraGroups(chartSpace, firstType) {
8397
8552
  const entry3 = {
8398
8553
  chartType: type,
8399
8554
  series: group2.series.map((source, index) => ({
8400
- ...chartSummarySeries(source, type, group2.dataLabels),
8555
+ ...chartSummarySeries(
8556
+ source,
8557
+ type,
8558
+ group2.dataLabels,
8559
+ group2.smooth ?? (group2.scatterStyle ? ["smooth", "smoothMarker"].includes(group2.scatterStyle) : void 0)
8560
+ ),
8401
8561
  ...summaryMarkers(source, group2, index)
8402
8562
  })),
8403
8563
  secondary: valueAxisId(chartSpace, group2.axisIds) !== primary
@@ -8418,8 +8578,14 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
8418
8578
  let chartType = group2 ? GROUP_TYPES[group2.kind] : "column";
8419
8579
  if (chartType === "bar" && group2?.barDirection !== "bar") chartType = "column";
8420
8580
  const series2 = (group2?.series ?? []).map((source, index) => ({
8421
- ...chartSummarySeries(source, chartType, group2?.dataLabels),
8422
- ...group2 ? summaryMarkers(source, group2, index) : {}
8581
+ ...chartSummarySeries(
8582
+ source,
8583
+ chartType,
8584
+ group2?.dataLabels,
8585
+ group2?.smooth ?? (group2?.scatterStyle ? ["smooth", "smoothMarker"].includes(group2.scatterStyle) : void 0)
8586
+ ),
8587
+ ...group2 ? summaryMarkers(source, group2, index) : {},
8588
+ ...group2?.kind === "scatter" ? { showLine: !["marker", "none"].includes(group2.scatterStyle ?? "marker") } : {}
8423
8589
  }));
8424
8590
  const summary = {
8425
8591
  chartType,
@@ -8428,6 +8594,9 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
8428
8594
  axes: chartSpace.plotArea.axes,
8429
8595
  axisIds: group2?.axisIds ?? []
8430
8596
  };
8597
+ if (chartSpace.plotArea.dataTable) summary.dataTable = chartSpace.plotArea.dataTable;
8598
+ if (chartSpace.date1904 !== void 0) summary.date1904 = chartSpace.date1904;
8599
+ if (chartSpace.plotArea.layout) summary.plotLayout = chartSpace.plotArea.layout;
8431
8600
  const combined = extraGroups(chartSpace, chartType);
8432
8601
  if (combined.length) summary.extraGroups = combined;
8433
8602
  if (chartType === "stock" && group2) summary.stock = stockStyle(group2);
@@ -8466,6 +8635,41 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
8466
8635
  return summary;
8467
8636
  }
8468
8637
 
8638
+ // chart/render/summary-ex-series.ts
8639
+ var level2 = (source) => ({
8640
+ ...source.visibility?.value === void 0 ? {} : { showValue: source.visibility.value },
8641
+ ...source.visibility?.categoryName === void 0 ? {} : { showCategory: source.visibility.categoryName },
8642
+ ...source.visibility?.seriesName === void 0 ? {} : { showSeriesName: source.visibility.seriesName },
8643
+ ...source.position ? { position: source.position } : {},
8644
+ ...source.numberFormat?.formatCode ? { numberFormat: source.numberFormat.formatCode } : {},
8645
+ ...source.separator === void 0 ? {} : { separator: source.separator }
8646
+ });
8647
+ function chartExSeriesPaint(source, series2, defaultValues = false) {
8648
+ const fill = source.spPr?.fill;
8649
+ if (fill) series2.fill = fill;
8650
+ const points2 = {};
8651
+ const fills = {};
8652
+ for (const point of source.dataPoints) {
8653
+ if (point.index === void 0) continue;
8654
+ const fill2 = point.spPr?.fill;
8655
+ if (fill2?.kind === "solid") points2[point.index] = fill2.color;
8656
+ else if (fill2) fills[point.index] = fill2;
8657
+ }
8658
+ if (Object.keys(points2).length) series2.pointColors = points2;
8659
+ if (Object.keys(fills).length) series2.pointFills = fills;
8660
+ const labels2 = source.dataLabels;
8661
+ if (!labels2 && !defaultValues) return;
8662
+ const overrides = {};
8663
+ for (const label of labels2?.labels ?? [])
8664
+ if (label.index !== void 0) overrides[label.index] = level2(label);
8665
+ for (const index of labels2?.hidden ?? [])
8666
+ overrides[index] = { ...overrides[index], deleted: true };
8667
+ series2.dataLabels = {
8668
+ series: { showValue: defaultValues, ...labels2 ? level2(labels2) : {} },
8669
+ points: overrides
8670
+ };
8671
+ }
8672
+
8469
8673
  // chart/render/summary-from-chartex.ts
8470
8674
  function seriesData(space, series2) {
8471
8675
  if (series2.data) return series2.data;
@@ -8473,17 +8677,17 @@ function seriesData(space, series2) {
8473
8677
  return series2.dataId === void 0 ? shared[0] : shared.find((data) => data.id === series2.dataId);
8474
8678
  }
8475
8679
  var findDimension = (data, kind, type) => data?.dimensions.find((d) => d.kind === kind && (d.type ?? "") === type);
8476
- function levelPoints(level2) {
8680
+ function levelPoints(level3) {
8477
8681
  const points2 = [];
8478
- for (const point of level2.points) points2[point.index ?? points2.length] = point.value.trim();
8479
- for (let i = 0; i < Math.max(level2.pointCount ?? 0, points2.length); i++) points2[i] ??= "";
8682
+ for (const point of level3.points) points2[point.index ?? points2.length] = point.value.trim();
8683
+ for (let i = 0; i < Math.max(level3.pointCount ?? 0, points2.length); i++) points2[i] ??= "";
8480
8684
  return points2;
8481
8685
  }
8482
8686
  function dimension(data, kind, type) {
8483
8687
  const element2 = findDimension(data, kind, type);
8484
8688
  if (!element2) return void 0;
8485
- const level2 = element2.levels[0];
8486
- const out = { points: level2 ? levelPoints(level2) : [] };
8689
+ const level3 = element2.levels[0];
8690
+ const out = { points: level3 ? levelPoints(level3) : [] };
8487
8691
  const formula2 = element2.formula?.formula.trim();
8488
8692
  if (formula2) out.formula = formula2;
8489
8693
  return out;
@@ -8547,13 +8751,8 @@ function chartExFormatting() {
8547
8751
  }
8548
8752
  };
8549
8753
  }
8550
- function chartExSummaryFromModel(space) {
8551
- const all = space.plotArea.series;
8552
- const primary = all.find((s) => s.layoutId !== "paretoLine") ?? all[0];
8553
- const layoutId = primary?.layoutId ?? "";
8554
- const chartType = layoutId === "waterfall" ? "waterfall" : layoutId === "clusteredColumn" ? "histogram" : layoutId === "treemap" || layoutId === "sunburst" ? layoutId : void 0;
8555
- if (!primary || !chartType) return { layoutId };
8556
- const data = seriesData(space, primary);
8754
+ function summarySeries(space, source, chartType) {
8755
+ const data = seriesData(space, source);
8557
8756
  const categories = dimension(data, "strDim", "cat");
8558
8757
  const values = dimension(
8559
8758
  data,
@@ -8565,17 +8764,63 @@ function chartExSummaryFromModel(space) {
8565
8764
  values: (values?.points ?? []).map(
8566
8765
  (p) => p !== "" && Number.isFinite(Number(p)) ? Number(p) : null
8567
8766
  ),
8568
- ...seriesFill(primary)
8767
+ ...seriesFill(source)
8569
8768
  };
8570
- const name = primary.tx?.value?.trim();
8769
+ if (chartType === "funnel" || chartType === "boxWhisker") {
8770
+ chartExSeriesPaint(source, series2, chartType === "funnel" && source.dataLabels !== void 0);
8771
+ if (source.hidden !== void 0) series2.hidden = source.hidden;
8772
+ }
8773
+ if (chartType === "boxWhisker") series2.boxWhisker = source.layoutProperties ?? {};
8774
+ const name = source.tx?.value?.trim();
8571
8775
  if (name) series2.name = name;
8572
- const nameRef = primary.tx?.formula?.formula.trim();
8776
+ const nameRef = source.tx?.formula?.formula.trim();
8573
8777
  if (nameRef) series2.nameRef = nameRef;
8574
8778
  if (categories?.formula) series2.categoriesRef = categories.formula;
8575
8779
  if (values?.formula) series2.valuesRef = values.formula;
8780
+ return series2;
8781
+ }
8782
+ function chartExSummaryFromModel(space) {
8783
+ const all = space.plotArea.series;
8784
+ const primary = all.find((s) => s.layoutId !== "paretoLine") ?? all[0];
8785
+ const layoutId = primary?.layoutId ?? "";
8786
+ const chartType = layoutId === "waterfall" ? "waterfall" : layoutId === "clusteredColumn" ? "histogram" : layoutId === "treemap" || layoutId === "sunburst" || layoutId === "funnel" || layoutId === "boxWhisker" ? layoutId : void 0;
8787
+ if (!primary || !chartType) return { layoutId };
8788
+ const series2 = summarySeries(space, primary, chartType);
8576
8789
  const layout = primary.layoutProperties;
8577
8790
  const legend = space.legend;
8578
- const summary = { chartType, series: [series2], showLegend: legend !== void 0 };
8791
+ const summary = {
8792
+ chartType,
8793
+ series: chartType === "boxWhisker" ? all.filter((s) => s.layoutId === "boxWhisker").map((source) => summarySeries(space, source, chartType)) : [series2],
8794
+ showLegend: legend !== void 0
8795
+ };
8796
+ if (chartType === "boxWhisker") {
8797
+ summary.axes = space.plotArea.axes.flatMap((axis) => {
8798
+ const scaling = axis.scaling;
8799
+ if (!scaling) return [];
8800
+ const value = scaling.kind === "val";
8801
+ return [
8802
+ {
8803
+ kind: value ? "val" : "cat",
8804
+ ...axis.id === void 0 ? {} : { id: axis.id },
8805
+ position: value ? "l" : "b",
8806
+ deleted: axis.hidden ?? false,
8807
+ scaling: {
8808
+ ...value && typeof scaling.min === "number" ? { min: scaling.min } : {},
8809
+ ...value && typeof scaling.max === "number" ? { max: scaling.max } : {}
8810
+ },
8811
+ majorGridlines: !!axis.majorGridlines,
8812
+ minorGridlines: !!axis.minorGridlines,
8813
+ ...axis.majorGridlines?.spPr ? { majorGridlinesSpPr: axis.majorGridlines.spPr } : {},
8814
+ ...axis.minorGridlines?.spPr ? { minorGridlinesSpPr: axis.minorGridlines.spPr } : {},
8815
+ ...value && typeof scaling.majorUnit === "number" ? { majorUnit: scaling.majorUnit } : {},
8816
+ ...value && typeof scaling.minorUnit === "number" ? { minorUnit: scaling.minorUnit } : {},
8817
+ ...axis.spPr ? { spPr: axis.spPr } : {},
8818
+ ...axis.numberFormat ? { numberFormat: axis.numberFormat } : {},
8819
+ ...axis.tickLabels ? {} : { tickLabelPosition: "none" }
8820
+ }
8821
+ ];
8822
+ });
8823
+ }
8579
8824
  summary.formatting = chartExFormatting();
8580
8825
  const title = titleOf(space);
8581
8826
  if (title) summary.title = title;
@@ -8590,11 +8835,11 @@ function chartExSummaryFromModel(space) {
8590
8835
  } else if (chartType === "treemap" || chartType === "sunburst") {
8591
8836
  const parentLayout = layout?.parentLabelLayout;
8592
8837
  summary.hierarchy = {
8593
- levels: categoryLevels(data),
8838
+ levels: categoryLevels(seriesData(space, primary)),
8594
8839
  dataLabels: primary.dataLabels !== void 0,
8595
8840
  ...parentLayout === "none" || parentLayout === "banner" || parentLayout === "overlapping" ? { parentLabelLayout: parentLayout } : {}
8596
8841
  };
8597
- } else summary.histogram = histogramOptions(primary);
8842
+ } else if (chartType === "histogram") summary.histogram = histogramOptions(primary);
8598
8843
  return { layoutId, summary };
8599
8844
  }
8600
8845
 
@@ -8755,45 +9000,15 @@ function themeSlotHex(color2) {
8755
9000
  return value ? value.toUpperCase() : void 0;
8756
9001
  }
8757
9002
 
8758
- // chart/render/chart-svg-util.ts
8759
- var TEXT_COLOR = "#595959";
8760
- var GRID_COLOR = "#D9D9D9";
8761
- var AXIS_COLOR = "#BFBFBF";
8762
- var FONT_SIZE = 10;
8763
- function esc(text2) {
8764
- return text2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
8765
- }
8766
- var n = (value) => String(Math.round(value * 100) / 100);
8767
- var textWidth = (text2, size = FONT_SIZE) => text2.length * size * 0.55;
8768
- function text(x, y, content, attrs = {}) {
8769
- const parts = [`x="${n(x)}"`, `y="${n(y)}"`];
8770
- parts.push(`font-size="${attrs.size ?? FONT_SIZE}"`);
8771
- parts.push(`fill="${esc(attrs.fill ?? TEXT_COLOR)}"`);
8772
- if (attrs.anchor && attrs.anchor !== "start") parts.push(`text-anchor="${attrs.anchor}"`);
8773
- if (attrs.weight) parts.push(`font-weight="${attrs.weight}"`);
8774
- if (attrs.baseline) parts.push(`dominant-baseline="${attrs.baseline}"`);
8775
- if (attrs.family) parts.push(`font-family="${esc(attrs.family)}"`);
8776
- if (attrs.filter) parts.push(`filter="${esc(attrs.filter)}"`);
8777
- if (attrs.italic !== void 0) parts.push(`font-style="${attrs.italic ? "italic" : "normal"}"`);
8778
- if (attrs.underline !== void 0)
8779
- parts.push(`text-decoration="${attrs.underline ? "underline" : "none"}"`);
8780
- return `<text ${parts.join(" ")}>${esc(content)}</text>`;
8781
- }
8782
- var line = (x1, y1, x2, y2, stroke, width = 1) => `<line x1="${n(x1)}" y1="${n(y1)}" x2="${n(x2)}" y2="${n(y2)}" stroke="${stroke}" stroke-width="${width}"/>`;
8783
- var rect = (x, y, w, h, fill, filter) => `<rect x="${n(x)}" y="${n(y)}" width="${n(Math.max(0, w))}" height="${n(Math.max(0, h))}" fill="${fill}"${filter ? ` filter="${esc(filter)}"` : ""}/>`;
8784
- function fit(content, maxWidth, size = FONT_SIZE) {
8785
- if (textWidth(content, size) <= maxWidth) return content;
8786
- const chars = Math.max(1, Math.floor(maxWidth / (size * 0.55)) - 1);
8787
- return `${content.slice(0, chars)}\u2026`;
8788
- }
8789
-
8790
- // chart/render/chart-spacing.ts
8791
- function chartBarSpacing(chart) {
8792
- const stacked = chart.grouping === "stacked" || chart.grouping === "percentStacked";
8793
- return {
8794
- barGapWidth: chart.barGapWidth ?? DEFAULT_BAR_GAP_WIDTH,
8795
- barOverlap: chart.barOverlap ?? (stacked ? 100 : 0)
8796
- };
9003
+ // chart/funnel-geometry.ts
9004
+ function computeFunnelGeometry(values, plot) {
9005
+ const max = Math.max(...values.map((v) => Math.abs(v)), 1);
9006
+ const height = plot.height / Math.max(1, values.length);
9007
+ const center = plot.x + plot.width / 2;
9008
+ return values.map((value, index) => {
9009
+ const width = Math.abs(value) / max * plot.width;
9010
+ return { index, x: center - width / 2, y: plot.y + index * height, width, height, center };
9011
+ });
8797
9012
  }
8798
9013
 
8799
9014
  // drawingml/drawing-color-css.ts
@@ -8998,6 +9213,38 @@ function chartAppearance(chart, theme) {
8998
9213
  return out;
8999
9214
  }
9000
9215
 
9216
+ // chart/render/chart-svg-util.ts
9217
+ var TEXT_COLOR = "#595959";
9218
+ var GRID_COLOR = "#D9D9D9";
9219
+ var AXIS_COLOR = "#BFBFBF";
9220
+ var FONT_SIZE = 10;
9221
+ function esc(text2) {
9222
+ return text2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
9223
+ }
9224
+ var n = (value) => String(Math.round(value * 100) / 100);
9225
+ var textWidth = (text2, size = FONT_SIZE) => text2.length * size * 0.55;
9226
+ function text(x, y, content, attrs = {}) {
9227
+ const parts = [`x="${n(x)}"`, `y="${n(y)}"`];
9228
+ parts.push(`font-size="${attrs.size ?? FONT_SIZE}"`);
9229
+ parts.push(`fill="${esc(attrs.fill ?? TEXT_COLOR)}"`);
9230
+ if (attrs.anchor && attrs.anchor !== "start") parts.push(`text-anchor="${attrs.anchor}"`);
9231
+ if (attrs.weight) parts.push(`font-weight="${attrs.weight}"`);
9232
+ if (attrs.baseline) parts.push(`dominant-baseline="${attrs.baseline}"`);
9233
+ if (attrs.family) parts.push(`font-family="${esc(attrs.family)}"`);
9234
+ if (attrs.filter) parts.push(`filter="${esc(attrs.filter)}"`);
9235
+ if (attrs.italic !== void 0) parts.push(`font-style="${attrs.italic ? "italic" : "normal"}"`);
9236
+ if (attrs.underline !== void 0)
9237
+ parts.push(`text-decoration="${attrs.underline ? "underline" : "none"}"`);
9238
+ return `<text ${parts.join(" ")}>${esc(content)}</text>`;
9239
+ }
9240
+ var line = (x1, y1, x2, y2, stroke, width = 1) => `<line x1="${n(x1)}" y1="${n(y1)}" x2="${n(x2)}" y2="${n(y2)}" stroke="${stroke}" stroke-width="${width}"/>`;
9241
+ var rect = (x, y, w, h, fill, filter) => `<rect x="${n(x)}" y="${n(y)}" width="${n(Math.max(0, w))}" height="${n(Math.max(0, h))}" fill="${fill}"${filter ? ` filter="${esc(filter)}"` : ""}/>`;
9242
+ function fit(content, maxWidth, size = FONT_SIZE) {
9243
+ if (textWidth(content, size) <= maxWidth) return content;
9244
+ const chars = Math.max(1, Math.floor(maxWidth / (size * 0.55)) - 1);
9245
+ return `${content.slice(0, chars)}\u2026`;
9246
+ }
9247
+
9001
9248
  // text/css-font-family.ts
9002
9249
  var FALLBACKS = {
9003
9250
  calibri: '"Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
@@ -9023,9 +9270,9 @@ function chartGradientPaint(model, width = 1024, height = 768) {
9023
9270
  const defs = [];
9024
9271
  const shadowPaint = (shadow, suffix) => {
9025
9272
  const id = `${prefix}-${suffix}`;
9026
- const pad = Math.max(4, shadow.blur * 3 + Math.abs(shadow.dx) + Math.abs(shadow.dy));
9273
+ const pad2 = Math.max(4, shadow.blur * 3 + Math.abs(shadow.dx) + Math.abs(shadow.dy));
9027
9274
  defs.push(
9028
- `<filter id="${id}" filterUnits="userSpaceOnUse" x="${n(-pad)}" y="${n(-pad)}" width="${n(width + pad * 2)}" height="${n(height + pad * 2)}" color-interpolation-filters="sRGB">${svgDropShadowElement(shadow, { number: n, color: (value) => esc(value) })}</filter>`
9275
+ `<filter id="${id}" filterUnits="userSpaceOnUse" x="${n(-pad2)}" y="${n(-pad2)}" width="${n(width + pad2 * 2)}" height="${n(height + pad2 * 2)}" color-interpolation-filters="sRGB">${svgDropShadowElement(shadow, { number: n, color: (value) => esc(value) })}</filter>`
9029
9276
  );
9030
9277
  return `url(#${id})`;
9031
9278
  };
@@ -9103,6 +9350,155 @@ function chartAreaRect(model, part, area) {
9103
9350
  return `${defs}<rect x="${n(area.x)}" y="${n(area.y)}" width="${n(area.w)}" height="${n(area.h)}" fill="${esc(fill)}" stroke="${esc(stroke)}" stroke-width="${n(width)}" data-chart-part="${part}"/>`;
9104
9351
  }
9105
9352
 
9353
+ // chart/render/chart-svg-funnel.ts
9354
+ function funnelSvg(model, area) {
9355
+ const series2 = model.series[0];
9356
+ if (!series2 || series2.hidden) return "";
9357
+ const attrs = chartTextAttributes(model, "categoryAxis", 10);
9358
+ const width = Math.min(
9359
+ area.w * 0.3,
9360
+ Math.max(32, ...model.categories.map((s) => s.length * (attrs.size ?? 10) * 0.55 + 8))
9361
+ );
9362
+ const plot = { x: area.x + width, y: area.y, width: Math.max(1, area.w - width), height: area.h };
9363
+ const out = [
9364
+ chartAreaRect(model, "plotArea", { x: plot.x, y: plot.y, w: plot.width, h: plot.height })
9365
+ ];
9366
+ for (const bar of computeFunnelGeometry(
9367
+ series2.values.map((v) => v ?? 0),
9368
+ plot
9369
+ )) {
9370
+ const value = series2.values[bar.index];
9371
+ if (value === null || value === void 0) continue;
9372
+ out.push(`<g data-chart-series="${series2.sourceIndex ?? 0}" data-chart-point="${bar.index}">`);
9373
+ out.push(
9374
+ rect(bar.x, bar.y, bar.width, bar.height, series2.pointColors?.[bar.index] ?? series2.color)
9375
+ );
9376
+ const size = Math.min(10, bar.height * 0.4);
9377
+ const label = series2.labels?.[bar.index];
9378
+ if (label)
9379
+ out.push(
9380
+ text(bar.center, bar.y + bar.height / 2 + size * 0.35, label.text, {
9381
+ ...chartTextAttributes(model, "dataLabel", size),
9382
+ size,
9383
+ anchor: "middle"
9384
+ })
9385
+ );
9386
+ out.push(
9387
+ text(
9388
+ plot.x - 8,
9389
+ bar.y + bar.height / 2 + (attrs.size ?? 10) * 0.35,
9390
+ fit(model.categories[bar.index] ?? "", width - 8, attrs.size ?? 10),
9391
+ { ...attrs, anchor: "end" }
9392
+ )
9393
+ );
9394
+ out.push("</g>");
9395
+ }
9396
+ return out.join("");
9397
+ }
9398
+
9399
+ // chart/box-distribution.ts
9400
+ function boxWhiskerDistribution(values, method = "exclusive", trimOutliers = false) {
9401
+ const stats = computeBoxStats(values, method);
9402
+ if (!stats) return void 0;
9403
+ const iqr = stats.q3 - stats.q1;
9404
+ const lowerFence = stats.q1 - 1.5 * iqr;
9405
+ const upperFence = stats.q3 + 1.5 * iqr;
9406
+ const inliers = values.filter((v) => !trimOutliers || v >= lowerFence && v <= upperFence);
9407
+ return {
9408
+ stats,
9409
+ whiskerMin: inliers.length ? Math.min(...inliers) : stats.min,
9410
+ whiskerMax: inliers.length ? Math.max(...inliers) : stats.max,
9411
+ mean: values.reduce((a2, b) => a2 + b, 0) / values.length
9412
+ };
9413
+ }
9414
+ function boxMeanMarkerPath(x, y, radius = 3) {
9415
+ return `M${x - radius},${y - radius} L${x + radius},${y + radius} M${x - radius},${y + radius} L${x + radius},${y - radius}`;
9416
+ }
9417
+
9418
+ // chart/render/chart-svg-box.ts
9419
+ function boxWhiskerSvg(model, frame, out) {
9420
+ const visible = model.series.filter((s) => !s.hidden);
9421
+ const slot = frame.bandSize / Math.max(1, visible.length);
9422
+ const width = slot * 0.7;
9423
+ visible.forEach((series2, si) => {
9424
+ if (series2.hidden) return;
9425
+ const groups = groupRowsByCategory(series2.boxCategories ?? []);
9426
+ model.categories.forEach((category, ci) => {
9427
+ const observations = (groups.rowIndexesByCategory.get(category) ?? []).flatMap((row) => {
9428
+ const value = series2.values[row];
9429
+ return value === null || value === void 0 ? [] : [{ row, value }];
9430
+ });
9431
+ const options2 = series2.boxWhisker;
9432
+ const rawMethod = options2?.statistics?.quartileMethod;
9433
+ const method = rawMethod === "inclusive" ? "inclusive" : "exclusive";
9434
+ const visibility = options2?.visibility;
9435
+ const trim = rawMethod === "inclusive" || rawMethod === "exclusive" || !!visibility && Object.values(visibility).some((v) => v !== void 0);
9436
+ const distribution = boxWhiskerDistribution(
9437
+ observations.map((p) => p.value),
9438
+ method,
9439
+ trim
9440
+ );
9441
+ if (!distribution) return;
9442
+ const { stats, whiskerMin, whiskerMax, mean } = distribution;
9443
+ const x = frame.band(ci) - frame.bandSize / 2 + si * slot + (slot - width) / 2;
9444
+ const mid = x + width / 2;
9445
+ const y = frame.value;
9446
+ out.push(
9447
+ `<g data-chart-part="box" data-chart-series="${series2.sourceIndex ?? si}" data-chart-point="${ci}">`
9448
+ );
9449
+ out.push(line(mid, y(whiskerMax), mid, y(stats.q3), "#64748b", 1));
9450
+ out.push(line(mid, y(stats.q1), mid, y(whiskerMin), "#64748b", 1));
9451
+ out.push(
9452
+ line(x + width * 0.25, y(whiskerMin), x + width * 0.75, y(whiskerMin), "#64748b", 1)
9453
+ );
9454
+ out.push(
9455
+ line(x + width * 0.25, y(whiskerMax), x + width * 0.75, y(whiskerMax), "#64748b", 1)
9456
+ );
9457
+ out.push(
9458
+ rect(
9459
+ x,
9460
+ Math.min(y(stats.q1), y(stats.q3)),
9461
+ width,
9462
+ Math.abs(y(stats.q1) - y(stats.q3)),
9463
+ series2.pointColors?.[ci] ?? series2.color
9464
+ )
9465
+ );
9466
+ out.push(line(x, y(stats.median), x + width, y(stats.median), "#1e293b", 2));
9467
+ if (visibility?.meanLine) out.push(line(x, y(mean), x + width, y(mean), "#0f766e", 1.5));
9468
+ if (visibility?.meanMarker !== false)
9469
+ out.push(
9470
+ `<path d="${boxMeanMarkerPath(mid, y(mean))}" fill="none" stroke="#0f766e" stroke-width="1.5" data-chart-part="mean"/>`
9471
+ );
9472
+ observations.forEach((point, index) => {
9473
+ const outlier = point.value < whiskerMin || point.value > whiskerMax;
9474
+ if (outlier ? !visibility?.outliers : !visibility?.nonoutliers) return;
9475
+ const px = x + width * (0.2 + 0.6 * (index + 1) / (observations.length + 1));
9476
+ out.push(
9477
+ `<circle cx="${n(px)}" cy="${n(y(point.value))}" r="2.25" fill="${outlier ? "#dc2626" : "#1e293b"}" data-chart-series="${series2.sourceIndex ?? si}" data-chart-point="${point.row}" data-chart-part="${outlier ? "outlier" : "observation"}"/>`
9478
+ );
9479
+ });
9480
+ out.push("</g>");
9481
+ });
9482
+ });
9483
+ }
9484
+
9485
+ // chart/data-table-layout.ts
9486
+ function chartDataTableMetrics(fontSize, names, showKeys = true) {
9487
+ const rowH = Math.max(14, Math.round(fontSize * 1.45));
9488
+ const longestName = names.reduce((m, name) => Math.max(m, name.length), 0);
9489
+ const keyW = Math.min(160, Math.max(40, longestName * fontSize * 0.55 + (showKeys ? 24 : 8)));
9490
+ return { fontSize, rowH, keyW, height: rowH * (1 + names.length) };
9491
+ }
9492
+
9493
+ // chart/render/chart-spacing.ts
9494
+ function chartBarSpacing(chart) {
9495
+ const stacked = chart.grouping === "stacked" || chart.grouping === "percentStacked";
9496
+ return {
9497
+ barGapWidth: chart.barGapWidth ?? DEFAULT_BAR_GAP_WIDTH,
9498
+ barOverlap: chart.barOverlap ?? (stacked ? 100 : 0)
9499
+ };
9500
+ }
9501
+
9106
9502
  // chart/render/chart-svg-labels.ts
9107
9503
  var GAP = 3;
9108
9504
  var LINE = 1.2;
@@ -9112,6 +9508,7 @@ function measure(model, label) {
9112
9508
  const size = attrs.size ?? 10;
9113
9509
  const lines2 = label.text.split("\n");
9114
9510
  return {
9511
+ ...model.frameSize ? { frame: model.frameSize } : {},
9115
9512
  lines: lines2,
9116
9513
  size,
9117
9514
  w: Math.max(...lines2.map((l) => textWidth(l, size))),
@@ -9120,6 +9517,7 @@ function measure(model, label) {
9120
9517
  };
9121
9518
  }
9122
9519
  function draw(m, label, x, y, anchor, out) {
9520
+ if (m.frame) ({ x, y } = applyLabelManualLayout(label.layout, m.frame, { x, y }));
9123
9521
  const fill = label.color && NAMED_COLORS.test(label.color) ? label.color.toLowerCase() : void 0;
9124
9522
  m.lines.forEach((line2, k) => {
9125
9523
  const lineY = y - m.h / 2 + (k + 0.5) * m.size * LINE + m.size * 0.35;
@@ -9179,46 +9577,6 @@ function pointLabels(model, marks, out) {
9179
9577
  }
9180
9578
  }
9181
9579
  }
9182
- function sliceLabels(model, marks, out) {
9183
- for (const mark of marks) {
9184
- const label = mark.series.labels?.[mark.index];
9185
- if (!label) continue;
9186
- const m = measure(model, label);
9187
- const mid = (mark.start + mark.end) / 2;
9188
- const ux = Math.sin(mid);
9189
- const uy = -Math.cos(mid);
9190
- const place = (radius) => [
9191
- mark.cx + radius * ux,
9192
- mark.cy + radius * uy
9193
- ];
9194
- const position = model.type === "doughnut" ? "ctr" : label.position ?? "bestFit";
9195
- let x;
9196
- let y;
9197
- if (position === "ctr") [x, y] = place(mark.inner + (mark.outer - mark.inner) / 2);
9198
- else if (position === "inEnd") {
9199
- const extent = Math.abs(ux) * m.w / 2 + Math.abs(uy) * m.h / 2;
9200
- [x, y] = place(Math.max(0, mark.outer - GAP - extent));
9201
- } else if (position === "outEnd") {
9202
- const extent = Math.abs(ux) * m.w / 2 + Math.abs(uy) * m.h / 2;
9203
- [x, y] = place(mark.outer + GAP + extent);
9204
- } else {
9205
- const placed = placeBestFitLabel(
9206
- {
9207
- cx: mark.cx,
9208
- cy: mark.cy,
9209
- outerR: mark.outer,
9210
- startAngle: mark.start - Math.PI / 2,
9211
- endAngle: mark.end - Math.PI / 2
9212
- },
9213
- m.w,
9214
- m.h
9215
- );
9216
- x = placed.x;
9217
- y = placed.y;
9218
- }
9219
- draw(m, label, x, y, "middle", out);
9220
- }
9221
- }
9222
9580
  function hasOutsideLabels(model) {
9223
9581
  return model.series.some(
9224
9582
  (s) => s.labels?.some(
@@ -9244,7 +9602,8 @@ function bars(model, frame, out, values) {
9244
9602
  const marks = [];
9245
9603
  model.series.forEach((s, si) => {
9246
9604
  values[si]?.forEach((v, i) => {
9247
- if (v === null || i >= model.categories.length) return;
9605
+ if (v === null || i >= model.categories.length || frame.order && !frame.order.includes(i))
9606
+ return;
9248
9607
  let from = 0;
9249
9608
  let to = v;
9250
9609
  if (stacked) {
@@ -9370,69 +9729,15 @@ function scatterAnalysis(model, px, py, out) {
9370
9729
  });
9371
9730
  }
9372
9731
 
9373
- // chart/render/chart-svg-markers.ts
9374
- function chartMarkerRadius(series2, index, defaultRadius = 3) {
9375
- const marker = { ...series2.marker, ...series2.pointMarkers?.[index] };
9376
- if (marker.symbol === "none") return 0;
9377
- const radius = markerRadius(marker.size, defaultRadius);
9378
- return marker.symbol === "dot" ? Math.max(radius * 0.6, 1) : radius;
9379
- }
9380
- function chartSeriesMarkerSvg(series2, index, cx, cy, defaultRadius = 3) {
9381
- const marker = { ...series2.marker, ...series2.pointMarkers?.[index] };
9382
- const primitive = buildMarkerPrimitive({
9383
- ...marker,
9384
- symbol: marker.symbol,
9385
- size: marker.size,
9386
- cx,
9387
- cy,
9388
- fill: marker.fill ?? series2.pointColors?.[index] ?? series2.color,
9389
- defaultRadius
9390
- });
9391
- if (!primitive) return "";
9392
- let geometry;
9393
- switch (primitive.kind) {
9394
- case "circle":
9395
- geometry = `cx="${n(primitive.cx)}" cy="${n(primitive.cy)}" r="${n(primitive.r)}"`;
9396
- break;
9397
- case "rect":
9398
- geometry = `x="${n(primitive.x)}" y="${n(primitive.y)}" width="${n(primitive.w)}" height="${n(primitive.h)}"`;
9399
- break;
9400
- case "path":
9401
- geometry = `d="${esc(primitive.d)}"`;
9402
- break;
9403
- case "polygon":
9404
- geometry = `points="${esc(primitive.points)}"`;
9405
- break;
9406
- }
9407
- const outline = primitive.stroke ? ` stroke="${esc(primitive.stroke)}" stroke-width="${n(primitive.strokeWidth ?? 1)}"` : "";
9408
- const filter = series2.shadowFilter ? ` filter="${esc(series2.shadowFilter)}"` : "";
9409
- return `<${primitive.kind} ${geometry} fill="${esc(primitive.fill)}"${outline}${filter}/>`;
9410
- }
9411
-
9412
- // chart/line-dash.ts
9413
- function chartLineDashArray(style, width) {
9414
- if (!style || style === "solid") {
9415
- return void 0;
9416
- }
9417
- const unit = Math.max(width, 1);
9418
- if (style === "dot" || style === "sysDot") {
9419
- return `${unit} ${unit * 2}`;
9420
- }
9421
- if (style === "lgDash") {
9422
- return `${unit * 6} ${unit * 3}`;
9423
- }
9424
- return `${unit * 3} ${unit * 2}`;
9425
- }
9426
-
9427
- // chart/render/chart-scale.ts
9428
- var clean = (n2) => Number(n2.toPrecision(12));
9429
- function* units(raw2) {
9430
- let exp = Math.floor(Math.log10(raw2)) - 1;
9431
- for (; ; ) {
9432
- const base = 10 ** exp;
9433
- for (const m of [1, 2, 5]) yield clean(m * base);
9434
- exp++;
9435
- }
9732
+ // chart/render/chart-scale.ts
9733
+ var clean = (n2) => Number(n2.toPrecision(12));
9734
+ function* units(raw2) {
9735
+ let exp = Math.floor(Math.log10(raw2)) - 1;
9736
+ for (; ; ) {
9737
+ const base = 10 ** exp;
9738
+ for (const m of [1, 2, 5]) yield clean(m * base);
9739
+ exp++;
9740
+ }
9436
9741
  }
9437
9742
  function niceScale(dataMin, dataMax, options2 = {}) {
9438
9743
  const maxIntervals = Math.max(1, options2.maxIntervals ?? 10);
@@ -9442,9 +9747,9 @@ function niceScale(dataMin, dataMax, options2 = {}) {
9442
9747
  if (lo === hi) {
9443
9748
  if (lo === 0) hi = 1;
9444
9749
  else if (options2.noZero) {
9445
- const pad = Math.abs(lo) * 0.1 || 1;
9446
- lo -= pad;
9447
- hi += pad;
9750
+ const pad2 = Math.abs(lo) * 0.1 || 1;
9751
+ lo -= pad2;
9752
+ hi += pad2;
9448
9753
  } else if (lo > 0) lo = 0;
9449
9754
  else hi = 0;
9450
9755
  }
@@ -9490,6 +9795,488 @@ function formatAxisValue(value, percent = false) {
9490
9795
  return `${v < 0 ? "-" : ""}${grouped}${frac ? `.${frac}` : ""}`;
9491
9796
  }
9492
9797
 
9798
+ // chart/render/chart-svg-data-table.ts
9799
+ var rows = (model) => [
9800
+ ...model.series,
9801
+ ...(model.extraGroups ?? []).flatMap((g) => g.series)
9802
+ ];
9803
+ function chartTableMetrics(model) {
9804
+ if (!model.dataTable) return void 0;
9805
+ const size = model.dataTable.text?.fontSize;
9806
+ return chartDataTableMetrics(
9807
+ size === void 0 ? 13.333333333333334 : chartPointsToPixels(size),
9808
+ rows(model).map((s) => s.name),
9809
+ model.dataTable.source.showKeys !== false
9810
+ );
9811
+ }
9812
+ function chartDataTableSvg(model, plot) {
9813
+ const table = model.dataTable;
9814
+ const metrics = chartTableMetrics(model);
9815
+ if (!table || !metrics) return "";
9816
+ const { source } = table;
9817
+ const { rowH, keyW, height, fontSize } = metrics;
9818
+ const series2 = rows(model);
9819
+ const top = plot.y + plot.h;
9820
+ const left = plot.x - keyW;
9821
+ const right = plot.x + plot.w;
9822
+ const bottom = top + height;
9823
+ const cellW = plot.w / Math.max(1, model.categories.length);
9824
+ const styled = { ...model, appearance: { ...model.appearance, dataLabel: table.text ?? {} } };
9825
+ const attrs = chartTextAttributes(styled, "dataLabel", fontSize);
9826
+ const out = ['<g data-chart-part="dataTable">'];
9827
+ const border = (x1, y1, x2, y2) => out.push(
9828
+ `<line x1="${n(x1)}" y1="${n(y1)}" x2="${n(x2)}" y2="${n(y2)}" ${strokeAttributes(table.stroke)}/>`
9829
+ );
9830
+ const label = (x, y, value, width, anchor = "middle") => out.push(
9831
+ text(x, y + fontSize * 0.35, fit(value, Math.max(1, width), fontSize), { ...attrs, anchor })
9832
+ );
9833
+ if (table.fill) out.push(rect(left, top, right - left, height, table.fill));
9834
+ if (source.showOutline !== false) {
9835
+ border(plot.x, top, right, top);
9836
+ border(right, top, right, bottom);
9837
+ border(right, bottom, left, bottom);
9838
+ border(left, bottom, left, top + rowH);
9839
+ border(left, top + rowH, plot.x, top + rowH);
9840
+ border(plot.x, top, plot.x, top + rowH);
9841
+ }
9842
+ model.categories.forEach((category, i) => {
9843
+ label(plot.x + (i + 0.5) * cellW, top + rowH / 2, category, cellW - 4);
9844
+ if (source.showVerticalBorder !== false && i > 0)
9845
+ border(plot.x + i * cellW, top, plot.x + i * cellW, bottom);
9846
+ });
9847
+ if (source.showVerticalBorder !== false) border(plot.x, top, plot.x, bottom);
9848
+ series2.forEach((s, i) => {
9849
+ const rowTop = top + rowH * (i + 1);
9850
+ const cy = rowTop + rowH / 2;
9851
+ if (source.showHorizontalBorder !== false) border(left, rowTop, right, rowTop);
9852
+ if (source.showKeys !== false) {
9853
+ const swatch = Math.max(6, Math.round(fontSize * 0.55));
9854
+ out.push(rect(left + 4, cy - swatch / 2, swatch, swatch, s.color));
9855
+ }
9856
+ const keyInset = source.showKeys !== false ? Math.max(6, Math.round(fontSize * 0.55)) + 7 : 4;
9857
+ label(left + keyInset, cy, s.name, keyW - keyInset - 4, "start");
9858
+ model.categories.forEach((_, j) => {
9859
+ const value = s.values[j];
9860
+ const formatted = value === null || value === void 0 ? "" : formatChartNumber(value, s.numberFormat) ?? formatAxisValue(value);
9861
+ label(plot.x + (j + 0.5) * cellW, cy, formatted, cellW - 4);
9862
+ });
9863
+ });
9864
+ return out.join("") + "</g>";
9865
+ }
9866
+
9867
+ // chart/date-axis.ts
9868
+ var DAY_MS = 864e5;
9869
+ function excelSerialToDate(serial, date1904 = false) {
9870
+ const epoch = date1904 ? Date.UTC(1904, 0, 1) : Date.UTC(1899, 11, serial < 60 ? 31 : 30);
9871
+ return new Date(epoch + serial * DAY_MS);
9872
+ }
9873
+ function addUnit(date, amount, unit) {
9874
+ const next = new Date(date);
9875
+ if (unit === "days") {
9876
+ next.setUTCDate(next.getUTCDate() + amount);
9877
+ } else if (unit === "months") {
9878
+ next.setUTCMonth(next.getUTCMonth() + amount);
9879
+ } else {
9880
+ next.setUTCFullYear(next.getUTCFullYear() + amount);
9881
+ }
9882
+ return next;
9883
+ }
9884
+ function calendarTicks(min, max, date1904, unit, step) {
9885
+ const result = [];
9886
+ let date = excelSerialToDate(min, date1904);
9887
+ for (let guard = 0; guard < 1e3 && date.getTime() <= excelSerialToDate(max, date1904).getTime(); guard++) {
9888
+ result.push(min + (date.getTime() - excelSerialToDate(min, date1904).getTime()) / DAY_MS);
9889
+ date = addUnit(date, step, unit);
9890
+ }
9891
+ return result;
9892
+ }
9893
+
9894
+ // chart/date-format.ts
9895
+ var MONTH_ABBR = [
9896
+ "Jan",
9897
+ "Feb",
9898
+ "Mar",
9899
+ "Apr",
9900
+ "May",
9901
+ "Jun",
9902
+ "Jul",
9903
+ "Aug",
9904
+ "Sep",
9905
+ "Oct",
9906
+ "Nov",
9907
+ "Dec"
9908
+ ];
9909
+ var MONTH_FULL = [
9910
+ "January",
9911
+ "February",
9912
+ "March",
9913
+ "April",
9914
+ "May",
9915
+ "June",
9916
+ "July",
9917
+ "August",
9918
+ "September",
9919
+ "October",
9920
+ "November",
9921
+ "December"
9922
+ ];
9923
+ var WEEKDAY_ABBR = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
9924
+ var WEEKDAY_FULL = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
9925
+ function scanDateFormatTokens(code) {
9926
+ const tokens = [];
9927
+ let i = 0;
9928
+ while (i < code.length) {
9929
+ const ch = code[i];
9930
+ if (ch === '"') {
9931
+ const close = code.indexOf('"', i + 1);
9932
+ tokens.push({
9933
+ kind: "literal",
9934
+ text: close === -1 ? code.slice(i + 1) : code.slice(i + 1, close)
9935
+ });
9936
+ i = close === -1 ? code.length : close + 1;
9937
+ continue;
9938
+ }
9939
+ if (ch === "\\") {
9940
+ tokens.push({ kind: "literal", text: code[i + 1] ?? "" });
9941
+ i += 2;
9942
+ continue;
9943
+ }
9944
+ const rest = code.slice(i);
9945
+ if (/^am\/pm/iu.test(rest)) {
9946
+ tokens.push({ kind: "ampm", upper: ch === ch.toUpperCase(), short: false });
9947
+ i += 5;
9948
+ continue;
9949
+ }
9950
+ if (/^a\/p/iu.test(rest)) {
9951
+ tokens.push({ kind: "ampm", upper: ch === ch.toUpperCase(), short: true });
9952
+ i += 3;
9953
+ continue;
9954
+ }
9955
+ if (/[ymdhs]/iu.test(ch)) {
9956
+ let j = i + 1;
9957
+ while (j < code.length && code[j].toLowerCase() === ch.toLowerCase()) {
9958
+ j += 1;
9959
+ }
9960
+ tokens.push({
9961
+ kind: "letters",
9962
+ letter: ch.toLowerCase(),
9963
+ count: j - i
9964
+ });
9965
+ i = j;
9966
+ continue;
9967
+ }
9968
+ tokens.push({ kind: "literal", text: ch });
9969
+ i += 1;
9970
+ }
9971
+ return tokens;
9972
+ }
9973
+ function findNonLiteral(tokens, index, step) {
9974
+ for (let i = index + step; i >= 0 && i < tokens.length; i += step) {
9975
+ if (tokens[i].kind !== "literal") {
9976
+ return tokens[i];
9977
+ }
9978
+ }
9979
+ return void 0;
9980
+ }
9981
+ function pad(n2, width) {
9982
+ return String(n2).padStart(width, "0");
9983
+ }
9984
+ function renderDatePart(part, count, date, twelveHour) {
9985
+ switch (part) {
9986
+ case "year":
9987
+ return count >= 4 ? pad(date.getUTCFullYear(), 4) : pad(date.getUTCFullYear() % 100, 2);
9988
+ case "month":
9989
+ if (count >= 4) {
9990
+ return MONTH_FULL[date.getUTCMonth()] ?? "";
9991
+ }
9992
+ if (count === 3) {
9993
+ return MONTH_ABBR[date.getUTCMonth()] ?? "";
9994
+ }
9995
+ return count >= 2 ? pad(date.getUTCMonth() + 1, 2) : String(date.getUTCMonth() + 1);
9996
+ case "day":
9997
+ if (count >= 4) {
9998
+ return WEEKDAY_FULL[date.getUTCDay()] ?? "";
9999
+ }
10000
+ if (count === 3) {
10001
+ return WEEKDAY_ABBR[date.getUTCDay()] ?? "";
10002
+ }
10003
+ return count >= 2 ? pad(date.getUTCDate(), 2) : String(date.getUTCDate());
10004
+ case "hour": {
10005
+ const h24 = date.getUTCHours();
10006
+ const h = twelveHour ? h24 % 12 === 0 ? 12 : h24 % 12 : h24;
10007
+ return count >= 2 ? pad(h, 2) : String(h);
10008
+ }
10009
+ case "minute":
10010
+ return count >= 2 ? pad(date.getUTCMinutes(), 2) : String(date.getUTCMinutes());
10011
+ case "second":
10012
+ return count >= 2 ? pad(date.getUTCSeconds(), 2) : String(date.getUTCSeconds());
10013
+ }
10014
+ }
10015
+ function renderExcelDateFormat(date, code) {
10016
+ const tokens = scanDateFormatTokens(code);
10017
+ const hasAmPm = tokens.some((t) => t.kind === "ampm");
10018
+ let out = "";
10019
+ for (const [index, token] of tokens.entries()) {
10020
+ if (token.kind === "literal") {
10021
+ out += token.text;
10022
+ continue;
10023
+ }
10024
+ if (token.kind === "ampm") {
10025
+ const hour = date.getUTCHours(), text2 = token.short ? hour < 12 ? "A" : "P" : hour < 12 ? "AM" : "PM";
10026
+ out += token.upper ? text2 : text2.toLowerCase();
10027
+ continue;
10028
+ }
10029
+ if (token.letter === "m") {
10030
+ const prev = findNonLiteral(tokens, index, -1), next = findNonLiteral(tokens, index, 1), isMinute = prev?.kind === "letters" && prev.letter === "h" || next?.kind === "letters" && next.letter === "s";
10031
+ out += renderDatePart(isMinute ? "minute" : "month", token.count, date, hasAmPm);
10032
+ continue;
10033
+ }
10034
+ const part = { y: "year", d: "day", h: "hour", s: "second" };
10035
+ out += renderDatePart(part[token.letter], token.count, date, hasAmPm);
10036
+ }
10037
+ return out;
10038
+ }
10039
+ function formatDate(date, unit, format) {
10040
+ if (format && /[ymdhs]/iu.test(format)) {
10041
+ const rendered = renderExcelDateFormat(date, format);
10042
+ if (rendered.length > 0) {
10043
+ return rendered;
10044
+ }
10045
+ }
10046
+ const month = date.toLocaleString("en-US", { month: "short", timeZone: "UTC" }), year = String(date.getUTCFullYear()), day = String(date.getUTCDate());
10047
+ if (unit === "years") {
10048
+ return year;
10049
+ }
10050
+ if (unit === "months") {
10051
+ return `${month} ${year}`;
10052
+ }
10053
+ return `${day} ${month}`;
10054
+ }
10055
+
10056
+ // chart/render/chart-svg-date-axis.ts
10057
+ function chartDateAxis(model, plot, out) {
10058
+ const axis = model.axes?.category?.source;
10059
+ const values = model.dateCategories;
10060
+ if (axis?.kind !== "date" || !values?.length) return void 0;
10061
+ const points2 = values.flatMap(
10062
+ (value, index) => value === null || !Number.isFinite(value) ? [] : [{ value, index }]
10063
+ ).sort((a2, b) => a2.value - b.value);
10064
+ if (!points2.length) return void 0;
10065
+ const min = axis.scaling.min ?? points2[0].value;
10066
+ const max = axis.scaling.max ?? points2.at(-1).value;
10067
+ if (!Number.isFinite(min) || !Number.isFinite(max) || max < min) return void 0;
10068
+ const position = (value) => {
10069
+ const ratio = max === min ? 0.5 : (value - min) / (max - min);
10070
+ const t = axis.scaling.orientation === "maxMin" ? 1 - ratio : ratio;
10071
+ return model.horizontal ? plot.y + plot.h * (1 - t) : plot.x + plot.w * t;
10072
+ };
10073
+ const visible = points2.filter((p) => p.value >= min && p.value <= max);
10074
+ const unitOf = (unit2) => unit2 === "months" || unit2 === "years" ? unit2 : "days";
10075
+ const unit = unitOf(axis.majorTimeUnit ?? axis.baseTimeUnit);
10076
+ const ticks = calendarTicks(
10077
+ min,
10078
+ max,
10079
+ model.date1904 ?? false,
10080
+ unit,
10081
+ Math.max(1, axis.majorUnit ?? 1)
10082
+ );
10083
+ const attrs = chartTextAttributes(model, "categoryAxis");
10084
+ const size = attrs.size ?? 10;
10085
+ const y = axis.position === "t" ? plot.y : plot.y + plot.h;
10086
+ const paint2 = model.axes?.category?.line;
10087
+ const stroke = { color: paint2?.color ?? "#BFBFBF", width: paint2?.width ?? 1 };
10088
+ const mark = (serial, placement, length) => {
10089
+ if (!placement || placement === "none" || axis.deleted) return;
10090
+ const inward = axis.position === "t" ? length : -length;
10091
+ const start = placement === "cross" ? -length : 0;
10092
+ const end = placement === "cross" ? length : placement === "in" ? inward : -inward;
10093
+ if (model.horizontal) {
10094
+ const x = axis.position === "r" ? plot.x + plot.w : plot.x;
10095
+ const direction = axis.position === "r" ? -1 : 1;
10096
+ const a2 = placement === "cross" ? -length : 0;
10097
+ const b = placement === "cross" ? length : placement === "in" ? direction * length : -direction * length;
10098
+ out.push(
10099
+ `<line x1="${x + a2}" y1="${position(serial)}" x2="${x + b}" y2="${position(serial)}" ${strokeAttributes(stroke)} data-chart-part="dateTick"/>`
10100
+ );
10101
+ } else
10102
+ out.push(
10103
+ `<line x1="${position(serial)}" y1="${y + start}" x2="${position(serial)}" y2="${y + end}" ${strokeAttributes(stroke)} data-chart-part="dateTick"/>`
10104
+ );
10105
+ };
10106
+ ticks.forEach((serial, index) => {
10107
+ if (index % Math.max(1, axis.tickMarkSkip ?? 1) === 0) mark(serial, axis.majorTickMark, 4);
10108
+ if (axis.deleted || model.dataTable || axis.tickLabelPosition === "none" || index % Math.max(1, axis.tickLabelSkip ?? 1))
10109
+ return;
10110
+ const label = formatDate(
10111
+ excelSerialToDate(serial, model.date1904),
10112
+ unit,
10113
+ axis.numberFormat?.formatCode
10114
+ );
10115
+ if (model.horizontal)
10116
+ out.push(text(plot.x - 4, position(serial) + size * 0.3, label, { ...attrs, anchor: "end" }));
10117
+ else {
10118
+ const above = axis.tickLabelPosition === "high" || axis.tickLabelPosition !== "low" && axis.position === "t";
10119
+ const baseline = axis.tickLabelPosition === "high" ? plot.y : axis.tickLabelPosition === "low" ? plot.y + plot.h : y;
10120
+ out.push(
10121
+ text(position(serial), baseline + (above ? -4 : size + 3), label, {
10122
+ ...attrs,
10123
+ anchor: "middle"
10124
+ })
10125
+ );
10126
+ }
10127
+ });
10128
+ if (axis.minorTickMark && axis.minorTickMark !== "none")
10129
+ for (const serial of calendarTicks(
10130
+ min,
10131
+ max,
10132
+ model.date1904 ?? false,
10133
+ unitOf(axis.minorTimeUnit ?? axis.baseTimeUnit ?? unit),
10134
+ Math.max(1, axis.minorUnit ?? 1)
10135
+ ))
10136
+ mark(serial, axis.minorTickMark, 2.5);
10137
+ return {
10138
+ order: visible.map((p) => p.index),
10139
+ band: (index) => position(values[index] ?? min),
10140
+ bandSize: (model.horizontal ? plot.h : plot.w) / Math.max(1, max - min + 1)
10141
+ };
10142
+ }
10143
+
10144
+ // chart/line-path.ts
10145
+ function smoothLinePath(points2) {
10146
+ if (points2.length === 0) {
10147
+ return "";
10148
+ }
10149
+ if (points2.length === 1) {
10150
+ return `M${points2[0].x.toFixed(2)},${points2[0].y.toFixed(2)}`;
10151
+ }
10152
+ if (points2.length === 2) {
10153
+ return `M${points2[0].x.toFixed(2)},${points2[0].y.toFixed(2)} L${points2[1].x.toFixed(2)},${points2[1].y.toFixed(2)}`;
10154
+ }
10155
+ let d = `M${points2[0].x.toFixed(2)},${points2[0].y.toFixed(2)}`;
10156
+ for (let i = 0; i < points2.length - 1; i++) {
10157
+ const [cp1, cp2, end] = smoothSegment(points2, i);
10158
+ d += ` C${cp1.x.toFixed(2)},${cp1.y.toFixed(2)} ${cp2.x.toFixed(2)},${cp2.y.toFixed(2)} ${end.x.toFixed(2)},${end.y.toFixed(2)}`;
10159
+ }
10160
+ return d;
10161
+ }
10162
+ function smoothSegment(points2, i) {
10163
+ const p0 = points2[i - 1] ?? points2[i];
10164
+ const p1 = points2[i];
10165
+ const p2 = points2[i + 1];
10166
+ const p3 = points2[i + 2] ?? p2;
10167
+ return [
10168
+ { x: p1.x + (p2.x - p0.x) / 6, y: p1.y + (p2.y - p0.y) / 6 },
10169
+ { x: p2.x - (p3.x - p1.x) / 6, y: p2.y - (p3.y - p1.y) / 6 },
10170
+ p2
10171
+ ];
10172
+ }
10173
+ function sampleSmoothLine(points2, stepsPerSegment = 16) {
10174
+ if (points2.length < 3) {
10175
+ return [...points2];
10176
+ }
10177
+ const out = [points2[0]];
10178
+ for (let i = 0; i < points2.length - 1; i++) {
10179
+ const start = points2[i], [cp1, cp2, end] = smoothSegment(points2, i);
10180
+ for (let step = 1; step <= stepsPerSegment; step++) {
10181
+ const t = step / stepsPerSegment, u = 1 - t, a2 = u * u * u, b = 3 * u * u * t, c2 = 3 * u * t * t, d = t * t * t;
10182
+ out.push(
10183
+ step === stepsPerSegment ? end : {
10184
+ x: a2 * start.x + b * cp1.x + c2 * cp2.x + d * end.x,
10185
+ y: a2 * start.y + b * cp1.y + c2 * cp2.y + d * end.y
10186
+ }
10187
+ );
10188
+ }
10189
+ }
10190
+ return out;
10191
+ }
10192
+ function polylineRunsPath(runs) {
10193
+ return runs.map(
10194
+ (run2) => run2.map((p, i) => `${i === 0 ? "M" : "L"}${p.x.toFixed(2)},${p.y.toFixed(2)}`).join(" ")
10195
+ ).join(" ");
10196
+ }
10197
+
10198
+ // chart/render/chart-svg-line.ts
10199
+ function chartLineSvg(points2, series2) {
10200
+ if (points2.length < 2) return "";
10201
+ const stroke = series2.stroke;
10202
+ const attrs = strokeAttributes(
10203
+ stroke ? { ...stroke, color: stroke.color === "none" ? "none" : series2.color } : { color: series2.color, width: 2.25 }
10204
+ );
10205
+ const filter = series2.shadowFilter ? ` filter="${series2.shadowFilter}"` : "";
10206
+ return series2.smooth ? `<path d="${smoothLinePath(points2)}" fill="none" ${attrs} stroke-linejoin="round"${filter}/>` : `<polyline points="${points2.map((p) => `${n(p.x)},${n(p.y)}`).join(" ")}" fill="none" ${attrs} stroke-linejoin="round"${filter}/>`;
10207
+ }
10208
+
10209
+ // chart/render/chart-svg-plot-layout.ts
10210
+ function chartPlotRect(model, auto, outer, frame) {
10211
+ if (!frame) return auto;
10212
+ const rect2 = resolveManualPlotRect(
10213
+ model.plotLayout,
10214
+ frame,
10215
+ { x: auto.x, y: auto.y, width: auto.w, height: auto.h },
10216
+ {
10217
+ left: auto.x - outer.x,
10218
+ top: auto.y - outer.y,
10219
+ right: Math.max(0, outer.x + outer.w - auto.x - auto.w),
10220
+ bottom: Math.max(0, outer.y + outer.h - auto.y - auto.h)
10221
+ }
10222
+ );
10223
+ return rect2 ? { x: rect2.x, y: rect2.y, w: rect2.width, h: rect2.height } : auto;
10224
+ }
10225
+
10226
+ // chart/render/chart-svg-markers.ts
10227
+ function chartMarkerRadius(series2, index, defaultRadius = 3) {
10228
+ const marker = { ...series2.marker, ...series2.pointMarkers?.[index] };
10229
+ if (marker.symbol === "none") return 0;
10230
+ const radius = markerRadius(marker.size, defaultRadius);
10231
+ return marker.symbol === "dot" ? Math.max(radius * 0.6, 1) : radius;
10232
+ }
10233
+ function chartSeriesMarkerSvg(series2, index, cx, cy, defaultRadius = 3) {
10234
+ const marker = { ...series2.marker, ...series2.pointMarkers?.[index] };
10235
+ const primitive = buildMarkerPrimitive({
10236
+ ...marker,
10237
+ symbol: marker.symbol,
10238
+ size: marker.size,
10239
+ cx,
10240
+ cy,
10241
+ fill: marker.fill ?? series2.pointColors?.[index] ?? series2.color,
10242
+ defaultRadius
10243
+ });
10244
+ if (!primitive) return "";
10245
+ let geometry;
10246
+ switch (primitive.kind) {
10247
+ case "circle":
10248
+ geometry = `cx="${n(primitive.cx)}" cy="${n(primitive.cy)}" r="${n(primitive.r)}"`;
10249
+ break;
10250
+ case "rect":
10251
+ geometry = `x="${n(primitive.x)}" y="${n(primitive.y)}" width="${n(primitive.w)}" height="${n(primitive.h)}"`;
10252
+ break;
10253
+ case "path":
10254
+ geometry = `d="${esc(primitive.d)}"`;
10255
+ break;
10256
+ case "polygon":
10257
+ geometry = `points="${esc(primitive.points)}"`;
10258
+ break;
10259
+ }
10260
+ const outline = primitive.stroke ? ` stroke="${esc(primitive.stroke)}" stroke-width="${n(primitive.strokeWidth ?? 1)}"` : "";
10261
+ const filter = series2.shadowFilter ? ` filter="${esc(series2.shadowFilter)}"` : "";
10262
+ return `<${primitive.kind} ${geometry} fill="${esc(primitive.fill)}"${outline}${filter}/>`;
10263
+ }
10264
+
10265
+ // chart/line-dash.ts
10266
+ function chartLineDashArray(style, width) {
10267
+ if (!style || style === "solid") {
10268
+ return void 0;
10269
+ }
10270
+ const unit = Math.max(width, 1);
10271
+ if (style === "dot" || style === "sysDot") {
10272
+ return `${unit} ${unit * 2}`;
10273
+ }
10274
+ if (style === "lgDash") {
10275
+ return `${unit * 6} ${unit * 3}`;
10276
+ }
10277
+ return `${unit * 3} ${unit * 2}`;
10278
+ }
10279
+
9493
10280
  // chart/render/chart-svg-axes.ts
9494
10281
  function axisTickText(value, axis, percent = false) {
9495
10282
  return formatChartNumber(value, axis?.source.numberFormat?.formatCode) ?? formatAxisValue(value, percent);
@@ -9812,6 +10599,50 @@ function applyChartAxes(model, chart, color2) {
9812
10599
  model.axes = out;
9813
10600
  }
9814
10601
 
10602
+ // chart/render/chart-title-text.ts
10603
+ function chartRunStyle(run2) {
10604
+ return {
10605
+ ...run2.sizePt === void 0 ? {} : { fontSize: run2.sizePt },
10606
+ ...run2.bold === void 0 ? {} : { bold: run2.bold },
10607
+ ...run2.italic === void 0 ? {} : { italic: run2.italic },
10608
+ ...run2.underline === void 0 ? {} : { underline: run2.underline },
10609
+ ...run2.typeface === void 0 ? {} : { typeface: run2.typeface },
10610
+ ...run2.color === void 0 ? {} : { textColor: run2.color }
10611
+ };
10612
+ }
10613
+ function chartTitleText(chart, theme) {
10614
+ const formatting = chart.formatting;
10615
+ const entry3 = formatting?.entries.title;
10616
+ const body = entry3?.textBody;
10617
+ if (!formatting || !body || body.text !== chart.title) return void 0;
10618
+ 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)
10619
+ return void 0;
10620
+ return {
10621
+ paragraphs: body.paragraphs.map((paragraph2) => ({
10622
+ ...paragraph2.align ? { align: paragraph2.align } : {},
10623
+ ...paragraph2.lineSpacing ? { lineSpacing: paragraph2.lineSpacing } : {},
10624
+ ...paragraph2.spaceBefore ? { spaceBefore: paragraph2.spaceBefore } : {},
10625
+ ...paragraph2.spaceAfter ? { spaceAfter: paragraph2.spaceAfter } : {},
10626
+ runs: paragraph2.runs.map((run2) => {
10627
+ const direct = {
10628
+ sourceXml: "",
10629
+ ...entry3.textBodyStyle,
10630
+ ...chartRunStyle(paragraph2.defaultProperties ?? {}),
10631
+ ...chartRunStyle(run2)
10632
+ };
10633
+ const appearance = chartAppearance(
10634
+ {
10635
+ ...chart,
10636
+ formatting: { ...formatting, entries: { ...formatting.entries, title: direct } }
10637
+ },
10638
+ theme
10639
+ )?.title ?? {};
10640
+ return { text: run2.text, appearance };
10641
+ })
10642
+ }))
10643
+ };
10644
+ }
10645
+
9815
10646
  // chart/render/chart-view-analysis.ts
9816
10647
  function strokeOf(line2, fallback, resolve) {
9817
10648
  if (line2?.fill?.kind === "none") return void 0;
@@ -9839,6 +10670,40 @@ function analysisView(source, seriesColor, resolve) {
9839
10670
  };
9840
10671
  }
9841
10672
 
10673
+ // chart/render/chart-view-data-table.ts
10674
+ function chartDataTableView(chart, theme, color2) {
10675
+ const source = chart.dataTable;
10676
+ if (!source) return void 0;
10677
+ const props = source.txPr?.paragraphs[0];
10678
+ const direct = {
10679
+ sourceXml: "",
10680
+ ...chartRunStyle(props?.defaultProperties ?? {}),
10681
+ ...chartRunStyle(props?.runs[0] ?? {})
10682
+ };
10683
+ const formatting = chart.formatting;
10684
+ const appearance = chartAppearance(
10685
+ {
10686
+ ...chart,
10687
+ formatting: {
10688
+ ...formatting,
10689
+ sourceXml: formatting?.sourceXml ?? "",
10690
+ entries: { ...formatting?.entries, categoryAxis: direct }
10691
+ }
10692
+ },
10693
+ theme
10694
+ );
10695
+ const fill = source.spPr?.fill;
10696
+ return {
10697
+ source,
10698
+ stroke: strokeOf(source.spPr?.line, { color: "#D9D9D9", width: 1 }, color2) ?? {
10699
+ color: "none",
10700
+ width: 0
10701
+ },
10702
+ ...fill?.kind === "solid" && color2(fill.color) ? { fill: color2(fill.color) } : {},
10703
+ ...appearance?.categoryAxis ? { text: appearance.categoryAxis } : {}
10704
+ };
10705
+ }
10706
+
9842
10707
  // chart/render/chart-view-series.ts
9843
10708
  var isRefError = (value) => typeof value === "object" && value !== null && "error" in value;
9844
10709
  function toText(value) {
@@ -9880,7 +10745,8 @@ function seriesContext(chart, theme, options2) {
9880
10745
  function seriesView(ctx, s, index, total, categoriesOf) {
9881
10746
  const { theme, scheme, palette, evaluateRef } = ctx;
9882
10747
  const values = resolveRef(s.valuesRef, evaluateRef)?.map(toNumber) ?? s.values.map(toNumber);
9883
- categoriesOf(resolveRef(s.categoriesRef, evaluateRef) ?? s.categories);
10748
+ const categoryValues2 = resolveRef(s.categoriesRef, evaluateRef) ?? s.categories;
10749
+ categoriesOf(categoryValues2);
9884
10750
  const paletteColor = palette && chartPaletteSeriesColor(palette, index, total, scheme);
9885
10751
  const color2 = s.fill?.kind === "none" ? "none" : ctx.drawingColor(s.fill?.kind === "solid" ? s.fill.color : s.drawingColor) ?? ctx.seriesColor?.(s, index) ?? paletteColor ?? autoSeriesColor(theme, index);
9886
10752
  const view = {
@@ -9889,6 +10755,19 @@ function seriesView(ctx, s, index, total, categoriesOf) {
9889
10755
  color: color2,
9890
10756
  sourceIndex: index
9891
10757
  };
10758
+ if (s.hidden !== void 0) view.hidden = s.hidden;
10759
+ if (s.boxWhisker) {
10760
+ view.boxWhisker = s.boxWhisker;
10761
+ view.boxCategories = categoryValues2.map(toText);
10762
+ }
10763
+ if (s.numberFormat !== void 0) view.numberFormat = s.numberFormat;
10764
+ if (s.showLine !== void 0) view.showLine = s.showLine;
10765
+ if (s.smooth !== void 0) view.smooth = s.smooth;
10766
+ if (s.line)
10767
+ view.stroke = strokeOf(s.line, { color: color2, width: 2.25 }, ctx.drawingColor) ?? {
10768
+ color: "none",
10769
+ width: 0
10770
+ };
9892
10771
  const shadow = resolveDrawingShadowXml(s.effectsXml, { scheme: (name) => scheme[name] });
9893
10772
  if (shadow) view.shadow = shadow;
9894
10773
  const resolvedGradient = ctx.gradient(s.fill);
@@ -10033,52 +10912,8 @@ function categoryTotals(model) {
10033
10912
  );
10034
10913
  }
10035
10914
 
10036
- // chart/render/chart-title-text.ts
10037
- function properties(run2) {
10038
- return {
10039
- ...run2.sizePt === void 0 ? {} : { fontSize: run2.sizePt },
10040
- ...run2.bold === void 0 ? {} : { bold: run2.bold },
10041
- ...run2.italic === void 0 ? {} : { italic: run2.italic },
10042
- ...run2.underline === void 0 ? {} : { underline: run2.underline },
10043
- ...run2.typeface === void 0 ? {} : { typeface: run2.typeface },
10044
- ...run2.color === void 0 ? {} : { textColor: run2.color }
10045
- };
10046
- }
10047
- function chartTitleText(chart, theme) {
10048
- const formatting = chart.formatting;
10049
- const entry3 = formatting?.entries.title;
10050
- const body = entry3?.textBody;
10051
- if (!formatting || !body || body.text !== chart.title) return void 0;
10052
- 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)
10053
- return void 0;
10054
- return {
10055
- paragraphs: body.paragraphs.map((paragraph2) => ({
10056
- ...paragraph2.align ? { align: paragraph2.align } : {},
10057
- ...paragraph2.lineSpacing ? { lineSpacing: paragraph2.lineSpacing } : {},
10058
- ...paragraph2.spaceBefore ? { spaceBefore: paragraph2.spaceBefore } : {},
10059
- ...paragraph2.spaceAfter ? { spaceAfter: paragraph2.spaceAfter } : {},
10060
- runs: paragraph2.runs.map((run2) => {
10061
- const direct = {
10062
- sourceXml: "",
10063
- ...entry3.textBodyStyle,
10064
- ...properties(paragraph2.defaultProperties ?? {}),
10065
- ...properties(run2)
10066
- };
10067
- const appearance = chartAppearance(
10068
- {
10069
- ...chart,
10070
- formatting: { ...formatting, entries: { ...formatting.entries, title: direct } }
10071
- },
10072
- theme
10073
- )?.title ?? {};
10074
- return { text: run2.text, appearance };
10075
- })
10076
- }))
10077
- };
10078
- }
10079
-
10080
10915
  // chart/render/chart-view-labels.ts
10081
- function labelsOf(source, view, categories, numberFormat3) {
10916
+ function labelsOf(source, view, categories, numberFormat3, resolveColor) {
10082
10917
  const { chart, series: series2, points: points2 } = source;
10083
10918
  if ((series2?.deleted ?? chart?.deleted) === true) return void 0;
10084
10919
  const percentBase = view.values.reduce(
@@ -10114,19 +10949,35 @@ function labelsOf(source, view, categories, numberFormat3) {
10114
10949
  });
10115
10950
  }
10116
10951
  if (!built) return;
10952
+ const layout = point?.layout;
10953
+ const showLeaderLines = series2?.showLeaderLines ?? chart?.showLeaderLines;
10954
+ const leaderLine = strokeOf(
10955
+ series2?.leaderLine ?? chart?.leaderLine,
10956
+ { color: "#94a3b8", width: 0.75 },
10957
+ resolveColor
10958
+ ) ?? { color: "none", width: 0 };
10117
10959
  any = true;
10118
10960
  out[i] = {
10119
10961
  text: built.text,
10962
+ ...layout ? { layout } : {},
10963
+ ...showLeaderLines !== void 0 ? { showLeaderLines } : {},
10964
+ ...leaderLine ? { leaderLine } : {},
10120
10965
  ...position ? { position } : {},
10121
10966
  ...built.color ? { color: built.color } : {}
10122
10967
  };
10123
10968
  });
10124
10969
  return any ? out : void 0;
10125
10970
  }
10126
- function applyDataLabels(model, sources, extra) {
10971
+ function applyDataLabels(model, sources, extra, resolveColor) {
10127
10972
  const apply = (source, view) => {
10128
10973
  if (!source?.dataLabels) return;
10129
- const labels2 = labelsOf(source.dataLabels, view, model.categories, source.numberFormat);
10974
+ const labels2 = labelsOf(
10975
+ source.dataLabels,
10976
+ view,
10977
+ model.categories,
10978
+ source.numberFormat,
10979
+ resolveColor
10980
+ );
10130
10981
  if (labels2) view.labels = labels2;
10131
10982
  };
10132
10983
  model.series.forEach((view, i) => apply(sources[i], view));
@@ -10231,7 +11082,9 @@ var SUPPORTED = /* @__PURE__ */ new Set([
10231
11082
  "bubble",
10232
11083
  "stock",
10233
11084
  "treemap",
10234
- "sunburst"
11085
+ "sunburst",
11086
+ "funnel",
11087
+ "boxWhisker"
10235
11088
  ]);
10236
11089
  function chartSummaryView(chart, theme, options2 = {}) {
10237
11090
  const type = chart.chartType;
@@ -10289,10 +11142,17 @@ function chartSummaryView(chart, theme, options2 = {}) {
10289
11142
  showLegend: chart.showLegend,
10290
11143
  legendPosition: chart.legendPosition ?? "r",
10291
11144
  categories,
10292
- series: series2,
11145
+ series: type === "boxWhisker" ? series2.filter((s) => !s.hidden) : series2,
10293
11146
  horizontal: type === "bar",
10294
11147
  supported: SUPPORTED.has(type)
10295
11148
  };
11149
+ const table = chartDataTableView(chart, theme, ctx.drawingColor);
11150
+ if (table) model.dataTable = table;
11151
+ if (chart.date1904 !== void 0) model.date1904 = chart.date1904;
11152
+ if (chart.axes?.some((a2) => a2.kind === "date")) model.dateCategories = firstCats.map(toNumber);
11153
+ if (chart.plotLayout) model.plotLayout = chart.plotLayout;
11154
+ if (type === "boxWhisker")
11155
+ model.categories = [...new Set(model.series.flatMap((s) => s.boxCategories ?? []))];
10296
11156
  if (chart.title) model.title = chart.title;
10297
11157
  const titleFormatting = chart.formatting?.entries.title;
10298
11158
  if (titleFormatting?.layout) model.titleLayout = titleFormatting.layout;
@@ -10314,6 +11174,11 @@ function chartSummaryView(chart, theme, options2 = {}) {
10314
11174
  const range2 = extentOf(xs);
10315
11175
  model.xAxis = xs.length ? niceScale(range2.min, range2.max) : niceScale(0, 1);
10316
11176
  }
11177
+ if (type === "funnel" || type === "boxWhisker")
11178
+ series2.forEach((s, i) => {
11179
+ const points2 = chart.series[i]?.pointColors;
11180
+ if (points2) s.pointColors = s.values.map((_, j) => drawingColor(points2[j]) ?? s.color);
11181
+ });
10317
11182
  if (type === "stock") model.stock = stockView(chart.stock, ctx);
10318
11183
  if (type === "bubble") bubbleView(chart, model, ctx.evaluateRef);
10319
11184
  if (type === "treemap" || type === "sunburst") hierarchyView(chart, model, ctx.evaluateRef);
@@ -10322,23 +11187,31 @@ function chartSummaryView(chart, theme, options2 = {}) {
10322
11187
  chartExtraView(chart, model, ctx, total, collect);
10323
11188
  if (type === "waterfall") waterfallView(chart, model, ctx);
10324
11189
  else if (!byPoint) model.valueAxis = valueAxis(model);
10325
- applyDataLabels(model, chart.series, extra);
11190
+ applyDataLabels(model, chart.series, extra, ctx.drawingColor);
10326
11191
  chartExtraAxes(model);
10327
11192
  applyChartAxes(model, chart, ctx.drawingColor);
10328
11193
  return model;
10329
11194
  }
10330
11195
 
10331
11196
  // chart/render/chart-svg-cartesian.ts
10332
- function cartesianAxes(model, area, out) {
11197
+ function cartesianAxes(model, area, out, size) {
10333
11198
  const scale = model.valueAxis;
10334
11199
  if (!scale) return void 0;
11200
+ const table = chartTableMetrics(model);
11201
+ if (table)
11202
+ area = {
11203
+ ...area,
11204
+ x: Math.max(area.x, table.keyW + 8),
11205
+ w: Math.max(1, area.w - Math.max(0, table.keyW + 8 - area.x)),
11206
+ h: Math.max(1, area.h - table.height)
11207
+ };
10335
11208
  const labels2 = scale.ticks.map((t) => axisTickText(t, model.axes?.value, scale.percent));
10336
11209
  const valueAttrs = chartTextAttributes(model, "valueAxis");
10337
11210
  const categoryAttrs = chartTextAttributes(model, "categoryAxis");
10338
11211
  const valueSize = valueAttrs.size ?? 10;
10339
11212
  const categorySize = categoryAttrs.size ?? 10;
10340
11213
  const valueLabels = chartAxisLabels(model.axes?.value) && model.appearance?.valueAxis?.labelsVisible !== false;
10341
- const categoryLabels = chartAxisLabels(model.axes?.category) && model.appearance?.categoryAxis?.labelsVisible !== false;
11214
+ const categoryLabels = !table && chartAxisLabels(model.axes?.category) && model.appearance?.categoryAxis?.labelsVisible !== false;
10342
11215
  const labelW = valueLabels ? Math.max(...labels2.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
10343
11216
  const horizontal = model.horizontal;
10344
11217
  const cats = Math.max(1, model.categories.length);
@@ -10349,7 +11222,7 @@ function cartesianAxes(model, area, out) {
10349
11222
  const second = horizontal ? void 0 : model.secondaryAxis;
10350
11223
  const secondLabels = second?.ticks.map((t) => axisTickText(t, model.axes?.secondary, second.percent)) ?? [];
10351
11224
  const secondW = second ? valueLabels ? Math.max(...secondLabels.map((l) => textWidth(l, valueSize)), 8) + 8 : 4 : 0;
10352
- const plot = horizontal ? {
11225
+ const auto = horizontal ? {
10353
11226
  x: area.x + catW,
10354
11227
  y: area.y,
10355
11228
  w: Math.max(1, area.w - catW - 4),
@@ -10360,10 +11233,13 @@ function cartesianAxes(model, area, out) {
10360
11233
  w: Math.max(1, area.w - labelW - 4 - secondW),
10361
11234
  h: Math.max(1, area.h - Math.max(20, categorySize * 1.5))
10362
11235
  };
11236
+ const plot = chartPlotRect(model, auto, area, size);
10363
11237
  const value = horizontal ? (v) => plot.x + chartAxisRatio(v, scale, model.axes?.value) * plot.w : (v) => plot.y + plot.h - chartAxisRatio(v, scale, model.axes?.value) * plot.h;
10364
- const bandSize = (horizontal ? plot.h : plot.w) / cats;
11238
+ const dateMarkup = [];
11239
+ const dates = chartDateAxis(model, plot, dateMarkup);
11240
+ const bandSize = dates?.bandSize ?? (horizontal ? plot.h : plot.w) / cats;
10365
11241
  const index = (i) => model.axes?.category?.range.reverseOrder ? cats - 1 - i : i;
10366
- const band = horizontal ? (i) => plot.y + plot.h - bandSize * (index(i) + 0.5) : (i) => plot.x + bandSize * (index(i) + 0.5);
11242
+ const band = dates?.band ?? (horizontal ? (i) => plot.y + plot.h - bandSize * (index(i) + 0.5) : (i) => plot.x + bandSize * (index(i) + 0.5));
10367
11243
  out.push(chartAreaRect(model, "plotArea", plot));
10368
11244
  out.push(axisGridlines(model, model.axes?.value, scale.ticks, value, plot, horizontal));
10369
11245
  if (model.axes?.category?.source.majorGridlines || model.axes?.category?.source.minorGridlines)
@@ -10401,12 +11277,13 @@ function cartesianAxes(model, area, out) {
10401
11277
  out.push(
10402
11278
  axisLine(model, model.axes?.category, "categoryAxis", plot.x, zero, plot.x + plot.w, zero)
10403
11279
  );
11280
+ out.push(...dateMarkup);
10404
11281
  const step = Math.max(
10405
11282
  1,
10406
11283
  Math.ceil(cats / Math.max(1, Math.floor((horizontal ? plot.h : plot.w) / 14)))
10407
11284
  );
10408
11285
  model.categories.forEach((c2, i) => {
10409
- if (!categoryLabels || i % step !== 0) return;
11286
+ if (dates || !categoryLabels || i % step !== 0) return;
10410
11287
  const p = band(i);
10411
11288
  if (horizontal)
10412
11289
  out.push(
@@ -10423,7 +11300,7 @@ function cartesianAxes(model, area, out) {
10423
11300
  })
10424
11301
  );
10425
11302
  });
10426
- const frame = { plot, value, band, bandSize };
11303
+ const frame = { plot, value, band, bandSize, ...dates ? { order: dates.order } : {} };
10427
11304
  if (second) {
10428
11305
  frame.secondary = (v) => plot.y + plot.h - chartAxisRatio(v, second, model.axes?.secondary) * plot.h;
10429
11306
  out.push(
@@ -10470,7 +11347,7 @@ function linesAndAreas(model, frame, out) {
10470
11347
  model.series.forEach((s, si) => {
10471
11348
  const points2 = [];
10472
11349
  const lower = [];
10473
- model.categories.forEach((_, i) => {
11350
+ (frame.order ?? model.categories.map((_, i) => i)).forEach((i) => {
10474
11351
  const v = values[si]?.[i] ?? null;
10475
11352
  if (v === null && !area) {
10476
11353
  points2.push([NaN, NaN]);
@@ -10505,26 +11382,24 @@ function linesAndAreas(model, frame, out) {
10505
11382
  }
10506
11383
  let segment2 = [];
10507
11384
  const flush = () => {
10508
- if (segment2.length > 1)
10509
- out.push(
10510
- `<polyline points="${segment2.join(" ")}" fill="none" stroke="${color2}" stroke-width="2.25" stroke-linejoin="round"${filter}/>`
10511
- );
11385
+ out.push(chartLineSvg(segment2, series2));
10512
11386
  segment2 = [];
10513
11387
  };
10514
11388
  for (const [x, y] of points2) {
10515
11389
  if (Number.isNaN(x)) flush();
10516
- else segment2.push(`${n(x)},${n(y)}`);
11390
+ else segment2.push({ x, y });
10517
11391
  }
10518
11392
  flush();
10519
11393
  points2.forEach(([x, y], index) => {
10520
- if (!Number.isNaN(x)) out.push(chartSeriesMarkerSvg(series2, index, x, y, 2.5));
11394
+ if (!Number.isNaN(x))
11395
+ out.push(chartSeriesMarkerSvg(series2, frame.order?.[index] ?? index, x, y, 2.5));
10521
11396
  });
10522
11397
  }
10523
11398
  pointLabels(model, marks, out);
10524
11399
  }
10525
11400
 
10526
11401
  // chart/render/chart-svg-xy.ts
10527
- function scatter(model, area, out) {
11402
+ function scatter(model, area, out, size) {
10528
11403
  const ys = model.valueAxis;
10529
11404
  const xs = model.xAxis;
10530
11405
  if (!ys || !xs) return;
@@ -10537,18 +11412,19 @@ function scatter(model, area, out) {
10537
11412
  const valueLabels = chartAxisLabels(model.axes?.value) && model.appearance?.valueAxis?.labelsVisible !== false;
10538
11413
  const categoryLabels = chartAxisLabels(model.axes?.category) && model.appearance?.categoryAxis?.labelsVisible !== false;
10539
11414
  const labelW = valueLabels ? Math.max(...yLabels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
10540
- const plot = {
11415
+ const auto = {
10541
11416
  x: area.x + labelW,
10542
11417
  y: area.y + 4,
10543
11418
  w: Math.max(1, area.w - labelW - 8),
10544
11419
  h: Math.max(1, area.h - Math.max(20, categorySize * 1.5))
10545
11420
  };
11421
+ const plot = chartPlotRect(model, auto, area, size);
10546
11422
  const bubble = model.type === "bubble" ? model.bubble : void 0;
10547
11423
  const biggest = maxBubbleSize(
10548
11424
  model.series.flatMap((s) => (s.sizes ?? []).filter((v) => v !== null))
10549
11425
  );
10550
11426
  const median = medianBubbleRadius(plot.w, plot.h);
10551
- const radiusOf = (size) => bubble && !(size !== void 0 && size < 0 && !bubble.showNegativeBubbles) ? computeBubbleRadius(size, biggest, median, bubble) : void 0;
11427
+ const radiusOf = (size2) => bubble && !(size2 !== void 0 && size2 < 0 && !bubble.showNegativeBubbles) ? computeBubbleRadius(size2, biggest, median, bubble) : void 0;
10552
11428
  let reach = 0;
10553
11429
  if (bubble)
10554
11430
  for (const s of model.series)
@@ -10557,11 +11433,11 @@ function scatter(model, area, out) {
10557
11433
  });
10558
11434
  const widen = (s, length, axis) => {
10559
11435
  if (axis?.range.logScale) return s;
10560
- const pad = reach * (s.max - s.min || 1) / Math.max(1, length - 2 * reach);
11436
+ const pad2 = reach * (s.max - s.min || 1) / Math.max(1, length - 2 * reach);
10561
11437
  return {
10562
11438
  ...s,
10563
- min: axis?.source.scaling.min === void 0 ? s.min - pad : s.min,
10564
- max: axis?.source.scaling.max === void 0 ? s.max + pad : s.max
11439
+ min: axis?.source.scaling.min === void 0 ? s.min - pad2 : s.min,
11440
+ max: axis?.source.scaling.max === void 0 ? s.max + pad2 : s.max
10565
11441
  };
10566
11442
  };
10567
11443
  const xView = widen(xs, plot.w, model.axes?.category);
@@ -10606,6 +11482,21 @@ function scatter(model, area, out) {
10606
11482
  out.push(
10607
11483
  axisLine(model, model.axes?.value, "valueAxis", plot.x, plot.y, plot.x, plot.y + plot.h)
10608
11484
  );
11485
+ if (!bubble)
11486
+ for (const series2 of model.series) {
11487
+ if (!series2.showLine) continue;
11488
+ let run2 = [];
11489
+ const flush = () => {
11490
+ out.push(chartLineSvg(run2, series2));
11491
+ run2 = [];
11492
+ };
11493
+ series2.values.forEach((value, i) => {
11494
+ const x = series2.xValues?.[i];
11495
+ if (value === null || x === null || x === void 0) flush();
11496
+ else run2.push({ x: px(x), y: py(value) });
11497
+ });
11498
+ flush();
11499
+ }
10609
11500
  const marks = [];
10610
11501
  for (const [si, s] of model.series.entries())
10611
11502
  s.values.forEach((v, i) => {
@@ -10737,14 +11628,19 @@ function clusterLayers(layers) {
10737
11628
  }
10738
11629
  return out;
10739
11630
  }
10740
- function cartesianSvg(model, area) {
11631
+ function cartesianSvg(model, area, size) {
10741
11632
  const out = [];
10742
11633
  if (model.type === "scatter" || model.type === "bubble") {
10743
- scatter(model, area, out);
11634
+ scatter(model, area, out, size);
10744
11635
  return out.join("");
10745
11636
  }
10746
- const frame = cartesianAxes(model, area, out);
11637
+ const frame = cartesianAxes(model, area, out, size);
10747
11638
  if (!frame) return "";
11639
+ out.push(chartDataTableSvg(model, frame.plot));
11640
+ if (model.type === "boxWhisker") {
11641
+ boxWhiskerSvg(model, frame, out);
11642
+ return out.join("");
11643
+ }
10748
11644
  if (model.type === "waterfall") {
10749
11645
  waterfallBars(model, frame, out);
10750
11646
  return out.join("");
@@ -10777,6 +11673,83 @@ function cartesianSvg(model, area) {
10777
11673
  return out.join("");
10778
11674
  }
10779
11675
 
11676
+ // chart/render/chart-svg-slice-labels.ts
11677
+ var GAP2 = 3;
11678
+ function sliceLabels(model, marks, out) {
11679
+ const items = [];
11680
+ for (const mark of marks) {
11681
+ const label = mark.series.labels?.[mark.index];
11682
+ if (!label) continue;
11683
+ const m = measure(model, label);
11684
+ const mid = (mark.start + mark.end) / 2;
11685
+ const ux = Math.sin(mid);
11686
+ const uy = -Math.cos(mid);
11687
+ const place = (radius) => [
11688
+ mark.cx + radius * ux,
11689
+ mark.cy + radius * uy
11690
+ ];
11691
+ const position = label.position ?? (model.type === "doughnut" ? "ctr" : "bestFit");
11692
+ let x;
11693
+ let y;
11694
+ if (position === "ctr") [x, y] = place(mark.inner + (mark.outer - mark.inner) / 2);
11695
+ else if (position === "inEnd") {
11696
+ const extent = Math.abs(ux) * m.w / 2 + Math.abs(uy) * m.h / 2;
11697
+ [x, y] = place(Math.max(0, mark.outer - GAP2 - extent));
11698
+ } else if (position === "outEnd") {
11699
+ const extent = Math.abs(ux) * m.w / 2 + Math.abs(uy) * m.h / 2;
11700
+ [x, y] = place(mark.outer + GAP2 + extent);
11701
+ } else {
11702
+ const placed = placeBestFitLabel(
11703
+ {
11704
+ cx: mark.cx,
11705
+ cy: mark.cy,
11706
+ outerR: mark.outer,
11707
+ startAngle: mark.start - Math.PI / 2,
11708
+ endAngle: mark.end - Math.PI / 2
11709
+ },
11710
+ m.w,
11711
+ m.h
11712
+ );
11713
+ x = placed.x;
11714
+ y = placed.y;
11715
+ }
11716
+ items.push({
11717
+ mark,
11718
+ label,
11719
+ m,
11720
+ x,
11721
+ y,
11722
+ outside: Math.hypot(x - mark.cx, y - mark.cy) > mark.outer
11723
+ });
11724
+ }
11725
+ const first2 = marks[0];
11726
+ if (!first2) return;
11727
+ const nudges = nudgeOutsideLabels(
11728
+ items.flatMap(
11729
+ (item, id) => item.outside && !item.label.layout ? [{ id, x: item.x, y: item.y, w: item.m.w, h: item.m.h }] : []
11730
+ ),
11731
+ { cx: first2.cx, cy: first2.cy, r: first2.outer },
11732
+ first2.cy - first2.outer,
11733
+ first2.cy + first2.outer
11734
+ );
11735
+ for (const [id, item] of items.entries()) {
11736
+ const { mark, label, m } = item;
11737
+ const nudge = nudges.find((n2) => n2.id === id);
11738
+ let point = { x: item.x + (nudge?.dx ?? 0), y: item.y + (nudge?.dy ?? 0) };
11739
+ if (model.frameSize) point = applyLabelManualLayout(label.layout, model.frameSize, point);
11740
+ const moved = point.x !== item.x || point.y !== item.y;
11741
+ if (label.showLeaderLines !== false && (item.outside || moved)) {
11742
+ const mid = (mark.start + mark.end) / 2;
11743
+ const stroke = label.leaderLine ?? { color: "#94a3b8", width: 0.75 };
11744
+ out.push(
11745
+ `<line x1="${n(mark.cx + mark.outer * Math.sin(mid))}" y1="${n(mark.cy - mark.outer * Math.cos(mid))}" x2="${n(point.x)}" y2="${n(point.y)}" ${strokeAttributes(stroke)} data-chart-part="leaderLine"/>`
11746
+ );
11747
+ }
11748
+ const { layout: _layout, ...fixed } = label;
11749
+ draw(m, fixed, point.x, point.y, "middle", out);
11750
+ }
11751
+ }
11752
+
10780
11753
  // chart/render/chart-svg-radial.ts
10781
11754
  var polar = (cx, cy, r, angle) => [
10782
11755
  cx + r * Math.sin(angle),
@@ -11259,9 +12232,9 @@ function chartRichTitleSvg(model, width, options2 = {}, frameHeight = 400) {
11259
12232
  ),
11260
12233
  { breakWords: true }
11261
12234
  );
11262
- const { spaceBefore, spaceAfter, ...properties2 } = line2;
12235
+ const { spaceBefore, spaceAfter, ...properties } = line2;
11263
12236
  return wrapped.map((runs, index) => ({
11264
- ...properties2,
12237
+ ...properties,
11265
12238
  runs,
11266
12239
  ...index === 0 && spaceBefore ? { spaceBefore } : {},
11267
12240
  ...index === wrapped.length - 1 && spaceAfter ? { spaceAfter } : {}
@@ -11348,7 +12321,7 @@ function chartRichTitleSvg(model, width, options2 = {}, frameHeight = 400) {
11348
12321
  // chart/render/chart-svg.ts
11349
12322
  function renderChartSvg(model, width, height, options2 = {}) {
11350
12323
  const paint2 = chartGradientPaint(model, Math.max(1, width), Math.max(1, height));
11351
- model = paint2.model;
12324
+ model = { ...paint2.model, frameSize: { width: Math.max(1, width), height: Math.max(1, height) } };
11352
12325
  const w = Math.max(1, width);
11353
12326
  const h = Math.max(1, height);
11354
12327
  const out = [];
@@ -11404,10 +12377,11 @@ function renderChartSvg(model, width, height, options2 = {}) {
11404
12377
  if (!legend.foreground) out.push(legend.markup);
11405
12378
  if (area.w > 4 && area.h > 4) {
11406
12379
  if (model.type === "pie" || model.type === "doughnut") out.push(pieSvg(model, area));
12380
+ else if (model.type === "funnel") out.push(funnelSvg(model, area));
11407
12381
  else if (model.type === "radar") out.push(radarSvg(model, area));
11408
12382
  else if (model.type === "treemap") out.push(treemapSvg(model, area));
11409
12383
  else if (model.type === "sunburst") out.push(sunburstSvg(model, area));
11410
- else out.push(cartesianSvg(model, area));
12384
+ else out.push(cartesianSvg(model, area, { width: w, height: h }));
11411
12385
  }
11412
12386
  if (legend.foreground) out.push(legend.markup);
11413
12387
  if (foregroundTitle) out.push(foregroundTitle);
@@ -11430,7 +12404,9 @@ var DRAWN_CHART_TYPES = /* @__PURE__ */ new Set([
11430
12404
  "bubble",
11431
12405
  "stock",
11432
12406
  "treemap",
11433
- "sunburst"
12407
+ "sunburst",
12408
+ "funnel",
12409
+ "boxWhisker"
11434
12410
  ]);
11435
12411
  function chartThemePalette(theme, fonts = {}) {
11436
12412
  return {
@@ -13387,7 +14363,7 @@ function setChartTypedCategories(space, values) {
13387
14363
  if (source?.levels) {
13388
14364
  if (Math.max(
13389
14365
  source.levelPointCount ?? 0,
13390
- ...source.levels.map((level2) => chartCacheValues(level2).length)
14366
+ ...source.levels.map((level3) => chartCacheValues(level3).length)
13391
14367
  ) !== values.length)
13392
14368
  throw new RangeError("Growing a hierarchy requires every category level.");
13393
14369
  const first2 = source.levels[0];
@@ -13402,7 +14378,7 @@ function setChartTypedCategories(space, values) {
13402
14378
  });
13403
14379
  }
13404
14380
  function setChartCategoryLevels(space, levels) {
13405
- if (!levels.length || levels.some((level2) => level2.length !== levels[0].length))
14381
+ if (!levels.length || levels.some((level3) => level3.length !== levels[0].length))
13406
14382
  throw new RangeError("Category levels must have matching lengths.");
13407
14383
  return editChartSpace(space, (draft) => {
13408
14384
  for (const { group: group2, series: series2 } of chartSeriesEntries(draft)) {
@@ -14893,15 +15869,14 @@ function applyChartExEditIntent(space, intent) {
14893
15869
 
14894
15870
  // chart/edit/chartex-axis.ts
14895
15871
  function editChartExAxis(space, index, edit) {
14896
- if (!Number.isSafeInteger(index) || !space.plotArea.axes[index])
14897
- throw new RangeError("No ChartEx axis at index.");
15872
+ chartExAxisAt(space, index);
14898
15873
  for (const key of ["min", "max", "majorUnit", "minorUnit"]) {
14899
15874
  const value = edit[key];
14900
15875
  if (value !== void 0 && value !== null && (!Number.isFinite(value) || (key === "majorUnit" || key === "minorUnit") && value <= 0))
14901
15876
  throw new RangeError("Invalid ChartEx axis scaling.");
14902
15877
  }
14903
15878
  return editChartExSpace(space, (draft) => {
14904
- const axis = draft.plotArea.axes[index];
15879
+ const axis = chartExAxisAt(draft, index);
14905
15880
  for (const key of ["min", "max", "majorUnit", "minorUnit"])
14906
15881
  if (edit[key] !== void 0) {
14907
15882
  if (axis.scaling?.kind !== "val")
@@ -15059,8 +16034,7 @@ function applyChartExEditAction(space, action) {
15059
16034
  return setChartExAxis(space, action.axisIndex, action.edit);
15060
16035
  case "tickLabels":
15061
16036
  return editChartExSpace(space, (draft) => {
15062
- const axis = draft.plotArea.axes[action.axisIndex];
15063
- if (!axis) throw new RangeError("No chart axis at index.");
16037
+ const axis = chartExAxisAt(draft, action.axisIndex);
15064
16038
  if (action.visible) axis.tickLabels ??= {};
15065
16039
  else delete axis.tickLabels;
15066
16040
  });
@@ -15587,13 +16561,13 @@ function chartSpaceWorkbookWrites(space) {
15587
16561
  // chart/workbook/rebase-data.ts
15588
16562
  function rebaseChartData(space, sheetName) {
15589
16563
  const next = structuredClone(space);
15590
- const rows = [[]];
16564
+ const rows2 = [[]];
15591
16565
  let column = 0;
15592
16566
  const ref = (col, row) => formatCellAddress({ col, row }).replace(/^([A-Z]+)(\d+)$/u, "$$$1$$$2");
15593
16567
  const formula2 = (from, to, count, row = 1) => `${quoteChartSheetName(sheetName)}!${ref(from, row)}:${ref(to, row + Math.max(1, count) - 1)}`;
15594
16568
  const vector = (cache, heading) => {
15595
16569
  const col = column++;
15596
- rows[0][col] = heading;
16570
+ rows2[0][col] = heading;
15597
16571
  let count = cache.pointCount ?? 0;
15598
16572
  for (const [at, point] of cache.points.entries()) {
15599
16573
  const index = point.index ?? at;
@@ -15604,11 +16578,11 @@ function rebaseChartData(space, sheetName) {
15604
16578
  const value = cache.type === "number" && text2.trim() !== "" ? Number(text2) : text2;
15605
16579
  if (typeof value === "number" && !Number.isFinite(value))
15606
16580
  throw new RangeError("Invalid chart number");
15607
- (rows[index + 1] ??= [])[col] = text2 === "" ? null : value;
16581
+ (rows2[index + 1] ??= [])[col] = text2 === "" ? null : value;
15608
16582
  }
15609
16583
  if (count > 1048575 || column > 16384)
15610
16584
  throw new RangeError("Chart data exceeds worksheet bounds");
15611
- for (let i = 1; i <= Math.max(1, count); i++) (rows[i] ??= [])[col] ??= null;
16585
+ for (let i = 1; i <= Math.max(1, count); i++) (rows2[i] ??= [])[col] ??= null;
15612
16586
  return { col, count };
15613
16587
  };
15614
16588
  const source = (data, heading) => {
@@ -15645,8 +16619,8 @@ function rebaseChartData(space, sheetName) {
15645
16619
  };
15646
16620
  source(series2.bubbleSizes, `${name} Size`);
15647
16621
  }
15648
- for (const row of rows) for (let col = 0; col < column; col++) row[col] ??= null;
15649
- return { chartSpace: next, rows };
16622
+ for (const row of rows2) for (let col = 0; col < column; col++) row[col] ??= null;
16623
+ return { chartSpace: next, rows: rows2 };
15650
16624
  }
15651
16625
 
15652
16626
  exports.BEST_FIT_EDGE_TOLERANCE = BEST_FIT_EDGE_TOLERANCE;
@@ -15706,6 +16680,7 @@ exports.applyChartExSpaceDataSheetEdits = applyChartExSpaceDataSheetEdits;
15706
16680
  exports.applyChartQuickLayout = applyChartQuickLayout;
15707
16681
  exports.applyChartSpaceDataSheetEdits = applyChartSpaceDataSheetEdits;
15708
16682
  exports.applyChartStylePreset = applyChartStylePreset;
16683
+ exports.applyLabelManualLayout = applyLabelManualLayout;
15709
16684
  exports.applyStandardChartLayout = applyStandardChartLayout;
15710
16685
  exports.assertBarClusterOptions = assertBarClusterOptions;
15711
16686
  exports.assertChartPercent = assertChartPercent;
@@ -15713,12 +16688,15 @@ exports.assignOrDelete = assignOrDelete;
15713
16688
  exports.autoSeriesColor = autoSeriesColor;
15714
16689
  exports.automaticMarkerSymbol = automaticMarkerSymbol;
15715
16690
  exports.axisTargetIntervals = axisTargetIntervals;
16691
+ exports.boxMeanMarkerPath = boxMeanMarkerPath;
16692
+ exports.boxWhiskerDistribution = boxWhiskerDistribution;
15716
16693
  exports.buildChartGradientDef = buildChartGradientDef;
15717
16694
  exports.buildHierarchyRoots = buildHierarchyRoots;
15718
16695
  exports.buildMarkerPrimitive = buildMarkerPrimitive;
15719
16696
  exports.buildWaterfallSteps = buildWaterfallSteps;
15720
16697
  exports.builtInChartStyleXml = builtInChartStyleXml;
15721
16698
  exports.builtInChartTextStyle = builtInChartTextStyle;
16699
+ exports.calendarTicks = calendarTicks;
15722
16700
  exports.canApplyChartDataSheetEdit = canApplyChartDataSheetEdit;
15723
16701
  exports.categorySource = categorySource;
15724
16702
  exports.categoryTotals = categoryTotals;
@@ -15730,12 +16708,14 @@ exports.chartColorStyleXml = chartColorStyleXml;
15730
16708
  exports.chartDataLabelsRange = chartDataLabelsRange;
15731
16709
  exports.chartDataSheetCellEdit = chartDataSheetCellEdit;
15732
16710
  exports.chartDataSheetPasteEdits = chartDataSheetPasteEdits;
16711
+ exports.chartDataTableMetrics = chartDataTableMetrics;
15733
16712
  exports.chartDataWorksheetXml = chartDataWorksheetXml;
15734
16713
  exports.chartDrawingColorFromHex = chartDrawingColorFromHex;
15735
16714
  exports.chartDrawingGradientFrom = chartDrawingGradientFrom;
15736
16715
  exports.chartEffectEditsFromAppearance = chartEffectEditsFromAppearance;
15737
16716
  exports.chartElementShape = chartElementShape;
15738
16717
  exports.chartErrorBarAmount = chartErrorBarAmount;
16718
+ exports.chartExAxisAt = chartExAxisAt;
15739
16719
  exports.chartExDataChanged = chartExDataChanged;
15740
16720
  exports.chartExDataLayout = chartExDataLayout;
15741
16721
  exports.chartExLevelValues = chartExLevelValues;
@@ -15808,6 +16788,7 @@ exports.computeAxisStackedValueRange = computeAxisStackedValueRange;
15808
16788
  exports.computeAxisValueRange = computeAxisValueRange;
15809
16789
  exports.computeBoxStats = computeBoxStats;
15810
16790
  exports.computeBubbleRadius = computeBubbleRadius;
16791
+ exports.computeFunnelGeometry = computeFunnelGeometry;
15811
16792
  exports.computeHierarchicalSunburstArcs = computeHierarchicalSunburstArcs;
15812
16793
  exports.computeHistogramBins = computeHistogramBins;
15813
16794
  exports.computeLinearRegression = computeLinearRegression;
@@ -15843,6 +16824,7 @@ exports.editChartSpace = editChartSpace;
15843
16824
  exports.editChartTextBody = editChartTextBody;
15844
16825
  exports.editChartTextRunProperties = editChartTextRunProperties;
15845
16826
  exports.effectiveBuiltInChartStyle = effectiveBuiltInChartStyle;
16827
+ exports.excelSerialToDate = excelSerialToDate;
15846
16828
  exports.expandRangeAddresses = expandRangeAddresses;
15847
16829
  exports.findChartColorPalette = findChartColorPalette;
15848
16830
  exports.findChartQuickLayout = findChartQuickLayout;
@@ -15855,6 +16837,7 @@ exports.formatCellAddress = formatCellAddress;
15855
16837
  exports.formatChartNumber = formatChartNumber;
15856
16838
  exports.formatChartNumberWithColor = formatChartNumberWithColor;
15857
16839
  exports.formatCompactAxisValue = formatCompactAxisValue;
16840
+ exports.formatDate = formatDate;
15858
16841
  exports.formatExponentialEquation = formatExponentialEquation;
15859
16842
  exports.formatLinearEquation = formatLinearEquation;
15860
16843
  exports.formatLogarithmicEquation = formatLogarithmicEquation;
@@ -15898,6 +16881,7 @@ exports.parseChartFormulaRange = parseChartFormulaRange;
15898
16881
  exports.parseChartSpace = parseChartSpace;
15899
16882
  exports.patchChartFormulas = patchChartFormulas;
15900
16883
  exports.placeBestFitLabel = placeBestFitLabel;
16884
+ exports.polylineRunsPath = polylineRunsPath;
15901
16885
  exports.quoteChartSheetName = quoteChartSheetName;
15902
16886
  exports.radarAngle = radarAngle;
15903
16887
  exports.radarRingPoints = radarRingPoints;
@@ -15917,6 +16901,7 @@ exports.renameChartSeries = renameChartSeries;
15917
16901
  exports.renderChartSpaceSvg = renderChartSpaceSvg;
15918
16902
  exports.renderChartSummarySvg = renderChartSummarySvg;
15919
16903
  exports.renderChartSvg = renderChartSvg;
16904
+ exports.renderExcelDateFormat = renderExcelDateFormat;
15920
16905
  exports.repaintSeriesForFamily = repaintSeriesForFamily;
15921
16906
  exports.resolveAutoTitleText = resolveAutoTitleText;
15922
16907
  exports.resolveBlankDisplay = resolveBlankDisplay;
@@ -15924,10 +16909,12 @@ exports.resolveChartGradient = resolveChartGradient;
15924
16909
  exports.resolveChartStyleDefinition = resolveChartStyleDefinition;
15925
16910
  exports.resolveDataLabelFlags = resolveDataLabelFlags;
15926
16911
  exports.resolveManualLayoutRect = resolveManualLayoutRect;
16912
+ exports.resolveManualPlotRect = resolveManualPlotRect;
15927
16913
  exports.retextChartTextBody = retextChartTextBody;
15928
16914
  exports.rotatedAxisPosition = rotatedAxisPosition;
15929
16915
  exports.sameChartColors = sameChartColors;
15930
16916
  exports.sameDrawingColor = sameDrawingColor;
16917
+ exports.sampleSmoothLine = sampleSmoothLine;
15931
16918
  exports.saveChartWorkbookUpdates = saveChartWorkbookUpdates;
15932
16919
  exports.scottBinCount = scottBinCount;
15933
16920
  exports.seriesMarkerViews = seriesMarkerViews;
@@ -16002,6 +16989,7 @@ exports.setChartTypedCategories = setChartTypedCategories;
16002
16989
  exports.setChartView3D = setChartView3D;
16003
16990
  exports.shade = shade;
16004
16991
  exports.sharedStringTexts = sharedStringTexts;
16992
+ exports.smoothLinePath = smoothLinePath;
16005
16993
  exports.sortGradientStops = sortGradientStops;
16006
16994
  exports.squarify = squarify;
16007
16995
  exports.standardChartFormulas = standardChartFormulas;