ooxml-core 1.32.0 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (318) hide show
  1. package/dist/{PptxHandler-TESZUH66.cjs → PptxHandler-MGKMIK22.cjs} +3 -3
  2. package/dist/PptxHandler-Q7CFNKOU.mjs +7 -0
  3. package/dist/PptxHandler-TEC7SWBU.mjs +4 -0
  4. package/dist/{PresentationBuilder-3CH5TR4W.mjs → PresentationBuilder-PJMQRZI6.mjs} +2 -2
  5. package/dist/{PresentationBuilder-S6HXHKEJ.mjs → PresentationBuilder-SADKXDWC.mjs} +4 -4
  6. package/dist/{PresentationBuilder-5NFBUP7Y.cjs → PresentationBuilder-VP2637RH.cjs} +5 -5
  7. package/dist/automation/index.cjs +4398 -2262
  8. package/dist/automation/index.mjs +4398 -2262
  9. package/dist/chart/funnel-geometry.d.ts +1 -1
  10. package/dist/chart/funnel-geometry.d.ts.map +1 -1
  11. package/dist/chart/index.cjs +5743 -3820
  12. package/dist/chart/index.mjs +5736 -3821
  13. package/dist/chart/region-map/alias.d.ts +12 -0
  14. package/dist/chart/region-map/alias.d.ts.map +1 -0
  15. package/dist/chart/region-map/cache.d.ts +20 -0
  16. package/dist/chart/region-map/cache.d.ts.map +1 -0
  17. package/dist/chart/region-map/colors.d.ts +4 -0
  18. package/dist/chart/region-map/colors.d.ts.map +1 -0
  19. package/dist/chart/region-map/data.d.ts +45 -0
  20. package/dist/chart/region-map/data.d.ts.map +1 -0
  21. package/dist/chart/region-map/geographic-projection.d.ts +4 -0
  22. package/dist/chart/region-map/geographic-projection.d.ts.map +1 -0
  23. package/dist/chart/region-map/geometry.d.ts +10 -0
  24. package/dist/chart/region-map/geometry.d.ts.map +1 -0
  25. package/dist/chart/region-map/index.cjs +892 -0
  26. package/dist/chart/region-map/index.d.ts +12 -0
  27. package/dist/chart/region-map/index.d.ts.map +1 -0
  28. package/dist/chart/region-map/index.mjs +870 -0
  29. package/dist/chart/region-map/projection.d.ts +19 -0
  30. package/dist/chart/region-map/projection.d.ts.map +1 -0
  31. package/dist/chart/region-map/types.d.ts +39 -0
  32. package/dist/chart/region-map/types.d.ts.map +1 -0
  33. package/dist/chart/region-map/value-color-positions.d.ts +4 -0
  34. package/dist/chart/region-map/value-color-positions.d.ts.map +1 -0
  35. package/dist/chart/region-map/value-colors.d.ts +4 -0
  36. package/dist/chart/region-map/value-colors.d.ts.map +1 -0
  37. package/dist/chart/region-map/world-regions.d.ts +22 -0
  38. package/dist/chart/region-map/world-regions.d.ts.map +1 -0
  39. package/dist/chart/render/chart-3d-camera.d.ts +26 -0
  40. package/dist/chart/render/chart-3d-camera.d.ts.map +1 -0
  41. package/dist/chart/render/chart-3d-layout.d.ts +27 -0
  42. package/dist/chart/render/chart-3d-layout.d.ts.map +1 -0
  43. package/dist/chart/render/chart-3d-marks.d.ts +10 -0
  44. package/dist/chart/render/chart-3d-marks.d.ts.map +1 -0
  45. package/dist/chart/render/chart-3d-mesh.d.ts +32 -0
  46. package/dist/chart/render/chart-3d-mesh.d.ts.map +1 -0
  47. package/dist/chart/render/chart-3d-pie.d.ts +16 -0
  48. package/dist/chart/render/chart-3d-pie.d.ts.map +1 -0
  49. package/dist/chart/render/chart-3d-projection.d.ts +37 -0
  50. package/dist/chart/render/chart-3d-projection.d.ts.map +1 -0
  51. package/dist/chart/render/chart-3d-scene.d.ts +9 -0
  52. package/dist/chart/render/chart-3d-scene.d.ts.map +1 -0
  53. package/dist/chart/render/chart-3d-shading.d.ts +10 -0
  54. package/dist/chart/render/chart-3d-shading.d.ts.map +1 -0
  55. package/dist/chart/render/chart-3d-surface.d.ts +5 -0
  56. package/dist/chart/render/chart-3d-surface.d.ts.map +1 -0
  57. package/dist/chart/render/chart-3d-svg.d.ts +7 -0
  58. package/dist/chart/render/chart-3d-svg.d.ts.map +1 -0
  59. package/dist/chart/render/chart-3d-walls.d.ts +13 -0
  60. package/dist/chart/render/chart-3d-walls.d.ts.map +1 -0
  61. package/dist/chart/render/chart-svg-funnel.d.ts.map +1 -1
  62. package/dist/chart/render/chart-svg-region-map.d.ts +4 -0
  63. package/dist/chart/render/chart-svg-region-map.d.ts.map +1 -0
  64. package/dist/chart/render/chart-svg-text-metrics.d.ts +2 -0
  65. package/dist/chart/render/chart-svg-text-metrics.d.ts.map +1 -1
  66. package/dist/chart/render/chart-svg.d.ts.map +1 -1
  67. package/dist/chart/render/chart-view.d.ts +5 -1
  68. package/dist/chart/render/chart-view.d.ts.map +1 -1
  69. package/dist/chart/render/index.d.ts +5 -0
  70. package/dist/chart/render/index.d.ts.map +1 -1
  71. package/dist/chart/render/render-space.d.ts.map +1 -1
  72. package/dist/chart/render/summary-ex-formatting.d.ts +5 -0
  73. package/dist/chart/render/summary-ex-formatting.d.ts.map +1 -0
  74. package/dist/chart/render/summary-ex-series.d.ts.map +1 -1
  75. package/dist/chart/render/summary-from-chartex.d.ts.map +1 -1
  76. package/dist/chart/render/summary-from-space.d.ts.map +1 -1
  77. package/dist/chart/render/summary.d.ts +5 -1
  78. package/dist/chart/render/summary.d.ts.map +1 -1
  79. package/dist/{chunk-Q6NM64J2.cjs → chunk-2LTIDUXH.cjs} +4791 -950
  80. package/dist/chunk-2N7RZQLC.mjs +8 -0
  81. package/dist/{chunk-NAWLWKOJ.mjs → chunk-3LMHYL4W.mjs} +2 -2
  82. package/dist/{chunk-O7SVHLD7.mjs → chunk-6LJW76BZ.mjs} +4756 -951
  83. package/dist/{chunk-X6VNUBES.cjs → chunk-BDZR4DZ6.cjs} +2058 -1748
  84. package/dist/{chunk-IOTGRLJH.mjs → chunk-BQGLWC6N.mjs} +867 -557
  85. package/dist/{chunk-N6424WKA.mjs → chunk-EBBWRRSB.mjs} +1 -1
  86. package/dist/{chunk-UYMSFJQZ.mjs → chunk-JQVOUS6B.mjs} +5 -5
  87. package/dist/{chunk-3H5UAJB3.mjs → chunk-QRXMYOVN.mjs} +870 -525
  88. package/dist/{chunk-54S5A5PZ.mjs → chunk-VDUNZTJC.mjs} +36 -1
  89. package/dist/{chunk-4R65YYAD.mjs → chunk-Y2RH4QWG.mjs} +4228 -1070
  90. package/dist/diagram/drawing-resolve.d.ts.map +1 -1
  91. package/dist/diagram/drawing-view.d.ts +6 -0
  92. package/dist/diagram/drawing-view.d.ts.map +1 -1
  93. package/dist/diagram/engine/engine-to-result.d.ts.map +1 -1
  94. package/dist/diagram/index.cjs +786 -145
  95. package/dist/diagram/index.d.ts +1 -0
  96. package/dist/diagram/index.d.ts.map +1 -1
  97. package/dist/diagram/index.mjs +783 -147
  98. package/dist/diagram/layout/smartart-layout-types.d.ts +7 -0
  99. package/dist/diagram/layout/smartart-layout-types.d.ts.map +1 -1
  100. package/dist/diagram/layout-preview.d.ts +4 -0
  101. package/dist/diagram/layout-preview.d.ts.map +1 -1
  102. package/dist/diagram/layout-role-style.d.ts +4 -0
  103. package/dist/diagram/layout-role-style.d.ts.map +1 -0
  104. package/dist/diagram/load.d.ts.map +1 -1
  105. package/dist/diagram/picture-layout.d.ts +23 -0
  106. package/dist/diagram/picture-layout.d.ts.map +1 -0
  107. package/dist/diagram/types.d.ts +6 -0
  108. package/dist/diagram/types.d.ts.map +1 -1
  109. package/dist/diagram/write/cache.d.ts +1 -0
  110. package/dist/diagram/write/cache.d.ts.map +1 -1
  111. package/dist/digest/crc32.d.ts +2 -0
  112. package/dist/digest/crc32.d.ts.map +1 -0
  113. package/dist/digest/index.cjs +11 -0
  114. package/dist/digest/index.d.ts +1 -0
  115. package/dist/digest/index.d.ts.map +1 -1
  116. package/dist/digest/index.mjs +11 -1
  117. package/dist/docx/diagram-cache.d.ts.map +1 -1
  118. package/dist/docx/diagram-save.d.ts.map +1 -1
  119. package/dist/docx/drawing.d.ts.map +1 -1
  120. package/dist/docx/embedded.cjs +882 -212
  121. package/dist/docx/embedded.mjs +882 -212
  122. package/dist/docx/index.cjs +3082 -866
  123. package/dist/docx/index.mjs +3082 -866
  124. package/dist/docx/inline-model.d.ts +4 -0
  125. package/dist/docx/inline-model.d.ts.map +1 -1
  126. package/dist/docx/layout/adapt-floats.d.ts.map +1 -1
  127. package/dist/docx/layout/adapter.d.ts.map +1 -1
  128. package/dist/docx/layout/floats.d.ts.map +1 -1
  129. package/dist/docx/layout/index.cjs +2200 -438
  130. package/dist/docx/layout/index.mjs +2200 -438
  131. package/dist/docx/layout/input.d.ts +3 -0
  132. package/dist/docx/layout/input.d.ts.map +1 -1
  133. package/dist/docx/layout/result.d.ts +3 -0
  134. package/dist/docx/layout/result.d.ts.map +1 -1
  135. package/dist/docx/load/index.cjs +1311 -641
  136. package/dist/docx/load/index.mjs +1311 -641
  137. package/dist/docx/parse.d.ts.map +1 -1
  138. package/dist/docx/ui/index.cjs +2832 -842
  139. package/dist/docx/ui/index.mjs +2832 -842
  140. package/dist/docx/ui/inline-content-schema.d.ts.map +1 -1
  141. package/dist/docx/ui/run-adapter.d.ts.map +1 -1
  142. package/dist/docx/write-drawing.d.ts.map +1 -1
  143. package/dist/drawingml/index.cjs +707 -111
  144. package/dist/drawingml/index.d.ts +7 -0
  145. package/dist/drawingml/index.d.ts.map +1 -1
  146. package/dist/drawingml/index.mjs +697 -113
  147. package/dist/drawingml/picture-artistic.d.ts +14 -0
  148. package/dist/drawingml/picture-artistic.d.ts.map +1 -0
  149. package/dist/drawingml/picture-effects.d.ts +4 -1
  150. package/dist/drawingml/picture-effects.d.ts.map +1 -1
  151. package/dist/drawingml/picture-fill.d.ts.map +1 -1
  152. package/dist/drawingml/picture-hsl-pixels.d.ts +4 -0
  153. package/dist/drawingml/picture-hsl-pixels.d.ts.map +1 -0
  154. package/dist/drawingml/picture-layout.d.ts +25 -0
  155. package/dist/drawingml/picture-layout.d.ts.map +1 -0
  156. package/dist/drawingml/picture-standard-effects.d.ts +15 -0
  157. package/dist/drawingml/picture-standard-effects.d.ts.map +1 -0
  158. package/dist/drawingml/picture-transfer.d.ts +11 -0
  159. package/dist/drawingml/picture-transfer.d.ts.map +1 -0
  160. package/dist/drawingml/raster-image.d.ts +29 -0
  161. package/dist/drawingml/raster-image.d.ts.map +1 -0
  162. package/dist/drawingml/types.d.ts +1 -0
  163. package/dist/drawingml/types.d.ts.map +1 -1
  164. package/dist/drawingml/write-pattern-picture.d.ts.map +1 -1
  165. package/dist/geometry/index.cjs +38 -0
  166. package/dist/geometry/index.d.ts +1 -0
  167. package/dist/geometry/index.d.ts.map +1 -1
  168. package/dist/geometry/index.mjs +36 -1
  169. package/dist/geometry/picture-tile.d.ts +29 -0
  170. package/dist/geometry/picture-tile.d.ts.map +1 -0
  171. package/dist/index.cjs +15164 -12669
  172. package/dist/index.mjs +15164 -12669
  173. package/dist/pptx/automation/index.cjs +7431 -2967
  174. package/dist/pptx/automation/index.d.ts +5 -5
  175. package/dist/pptx/automation/index.mjs +7 -7
  176. package/dist/pptx/chunks/{elements-mSCZ84Tc.d.ts → elements-f3UbFph-.d.ts} +7 -2
  177. package/dist/pptx/chunks/elements-f3UbFph-.d.ts.map +1 -0
  178. package/dist/pptx/chunks/{index-DnWlmYCy.d.ts → index-BnH2QjYm.d.ts} +4 -4
  179. package/dist/pptx/chunks/{index-DnWlmYCy.d.ts.map → index-BnH2QjYm.d.ts.map} +1 -1
  180. package/dist/pptx/chunks/{index-D-FdgqrP.d.ts → index-Bp-1pGo1.d.ts} +4 -4
  181. package/dist/pptx/chunks/{index-D-FdgqrP.d.ts.map → index-Bp-1pGo1.d.ts.map} +1 -1
  182. package/dist/pptx/chunks/{index-DKybuHPT.d.ts → index-BuMPQDQb.d.ts} +27 -16
  183. package/dist/pptx/chunks/index-BuMPQDQb.d.ts.map +1 -0
  184. package/dist/pptx/chunks/{smart-art-DLumQo90.d.ts → smart-art-CmOrPLLQ.d.ts} +86 -2
  185. package/dist/pptx/chunks/smart-art-CmOrPLLQ.d.ts.map +1 -0
  186. package/dist/pptx/chunks/{text-operations-hyPODwIQ.d.ts → text-operations-D5sgspO6.d.ts} +2 -2
  187. package/dist/pptx/chunks/{text-operations-hyPODwIQ.d.ts.map → text-operations-D5sgspO6.d.ts.map} +1 -1
  188. package/dist/pptx/cli/index.cjs +7196 -2732
  189. package/dist/pptx/cli/index.d.ts +1 -1
  190. package/dist/pptx/cli/index.mjs +6 -6
  191. package/dist/pptx/converter/index.cjs +3895 -503
  192. package/dist/pptx/converter/index.d.ts +1 -1
  193. package/dist/pptx/converter/index.mjs +3 -3
  194. package/dist/pptx/editor/render/find-replace.cjs +14 -14
  195. package/dist/pptx/editor/render/find-replace.d.ts +2 -2
  196. package/dist/pptx/editor/render/find-replace.mjs +1 -1
  197. package/dist/pptx/editor/render/slide-operations.cjs +8 -8
  198. package/dist/pptx/editor/render/slide-operations.mjs +2 -2
  199. package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
  200. package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
  201. package/dist/pptx/index.cjs +6828 -2969
  202. package/dist/pptx/index.d.ts +7 -7
  203. package/dist/pptx/index.mjs +7 -7
  204. package/dist/pptx/node/index.d.ts +1 -1
  205. package/dist/pptx/smartart-layouts/index.d.ts +1 -1
  206. package/dist/pptx/smartart-layouts/index.mjs +2 -2
  207. package/dist/teams/index.cjs +1964 -726
  208. package/dist/teams/index.mjs +1964 -726
  209. package/dist/visio/cell-formula.d.ts +5 -1
  210. package/dist/visio/cell-formula.d.ts.map +1 -1
  211. package/dist/visio/collab/index.cjs +3 -1
  212. package/dist/visio/collab/index.mjs +3 -1
  213. package/dist/visio/container-relationships.d.ts +19 -0
  214. package/dist/visio/container-relationships.d.ts.map +1 -0
  215. package/dist/visio/edit-container-fit.d.ts +19 -0
  216. package/dist/visio/edit-container-fit.d.ts.map +1 -0
  217. package/dist/visio/edit-container-members.d.ts +21 -0
  218. package/dist/visio/edit-container-members.d.ts.map +1 -0
  219. package/dist/visio/edit-delete.d.ts.map +1 -1
  220. package/dist/visio/edit-diagram-parts-commands.d.ts +23 -1
  221. package/dist/visio/edit-diagram-parts-commands.d.ts.map +1 -1
  222. package/dist/visio/edit-diagram-parts.d.ts +3 -2
  223. package/dist/visio/edit-diagram-parts.d.ts.map +1 -1
  224. package/dist/visio/edit-geometry.d.ts +4 -1
  225. package/dist/visio/edit-geometry.d.ts.map +1 -1
  226. package/dist/visio/edit-recalculate-index.d.ts +13 -0
  227. package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
  228. package/dist/visio/edit-recalculate-values.d.ts.map +1 -1
  229. package/dist/visio/edit-recalculate.d.ts.map +1 -1
  230. package/dist/visio/edit.d.ts.map +1 -1
  231. package/dist/visio/formula-analyze.d.ts +2 -0
  232. package/dist/visio/formula-analyze.d.ts.map +1 -1
  233. package/dist/visio/formula-evaluate.d.ts.map +1 -1
  234. package/dist/visio/formula-master.d.ts +1 -0
  235. package/dist/visio/formula-master.d.ts.map +1 -1
  236. package/dist/visio/index.cjs +2771 -1312
  237. package/dist/visio/index.d.ts +1 -1
  238. package/dist/visio/index.d.ts.map +1 -1
  239. package/dist/visio/index.mjs +2771 -1312
  240. package/dist/visio/media.d.ts +4 -23
  241. package/dist/visio/media.d.ts.map +1 -1
  242. package/dist/visio/package-common.d.ts +1 -1
  243. package/dist/visio/package-common.d.ts.map +1 -1
  244. package/dist/visio/shape-structure.d.ts +6 -3
  245. package/dist/visio/shape-structure.d.ts.map +1 -1
  246. package/dist/visio/ui/diagram-parts.d.ts +12 -1
  247. package/dist/visio/ui/diagram-parts.d.ts.map +1 -1
  248. package/dist/visio/ui/index.cjs +2679 -1201
  249. package/dist/visio/ui/index.mjs +2679 -1202
  250. package/dist/xlsx/edit/cell-values.d.ts.map +1 -1
  251. package/dist/xlsx/edit/chart-ex.d.ts +1 -0
  252. package/dist/xlsx/edit/chart-ex.d.ts.map +1 -1
  253. package/dist/xlsx/edit/filter.d.ts +5 -1
  254. package/dist/xlsx/edit/filter.d.ts.map +1 -1
  255. package/dist/xlsx/edit/index.d.ts +1 -0
  256. package/dist/xlsx/edit/index.d.ts.map +1 -1
  257. package/dist/xlsx/edit/session-calc.d.ts +5 -0
  258. package/dist/xlsx/edit/session-calc.d.ts.map +1 -1
  259. package/dist/xlsx/edit/session.d.ts.map +1 -1
  260. package/dist/xlsx/edit/text-columns.d.ts +21 -0
  261. package/dist/xlsx/edit/text-columns.d.ts.map +1 -0
  262. package/dist/xlsx/edit/types.d.ts +5 -1
  263. package/dist/xlsx/edit/types.d.ts.map +1 -1
  264. package/dist/xlsx/embedded-chart-ex-space.d.ts +18 -0
  265. package/dist/xlsx/embedded-chart-ex-space.d.ts.map +1 -0
  266. package/dist/xlsx/filter-criteria.d.ts +22 -0
  267. package/dist/xlsx/filter-criteria.d.ts.map +1 -0
  268. package/dist/xlsx/filter-dynamic.d.ts +8 -0
  269. package/dist/xlsx/filter-dynamic.d.ts.map +1 -0
  270. package/dist/xlsx/filter-menu.d.ts +49 -0
  271. package/dist/xlsx/filter-menu.d.ts.map +1 -0
  272. package/dist/xlsx/filter-rows.d.ts +4 -4
  273. package/dist/xlsx/filter-rows.d.ts.map +1 -1
  274. package/dist/xlsx/index.cjs +5861 -2939
  275. package/dist/xlsx/index.d.ts +4 -0
  276. package/dist/xlsx/index.d.ts.map +1 -1
  277. package/dist/xlsx/index.mjs +5844 -2939
  278. package/dist/xlsx/load/index.cjs +1871 -585
  279. package/dist/xlsx/load/index.mjs +1871 -585
  280. package/dist/xlsx/model-filter.d.ts +54 -0
  281. package/dist/xlsx/model-filter.d.ts.map +1 -0
  282. package/dist/xlsx/model.d.ts +42 -3
  283. package/dist/xlsx/model.d.ts.map +1 -1
  284. package/dist/xlsx/read/chart.d.ts.map +1 -1
  285. package/dist/xlsx/read/drawing.d.ts.map +1 -1
  286. package/dist/xlsx/read/filter-columns.d.ts +5 -0
  287. package/dist/xlsx/read/filter-columns.d.ts.map +1 -0
  288. package/dist/xlsx/read/shared-strings.d.ts +5 -3
  289. package/dist/xlsx/read/shared-strings.d.ts.map +1 -1
  290. package/dist/xlsx/read/sheet-data.d.ts.map +1 -1
  291. package/dist/xlsx/read/sheet-props.d.ts +2 -2
  292. package/dist/xlsx/read/sheet-props.d.ts.map +1 -1
  293. package/dist/xlsx/ui/commands/i18n/filters.d.ts +3 -0
  294. package/dist/xlsx/ui/commands/i18n/filters.d.ts.map +1 -0
  295. package/dist/xlsx/ui/commands/i18n/index.d.ts.map +1 -1
  296. package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
  297. package/dist/xlsx/ui/commands/i18n/tools.d.ts.map +1 -1
  298. package/dist/xlsx/ui/commands/sort-filter.d.ts.map +1 -1
  299. package/dist/xlsx/ui/dialogs/grid-chart.d.ts.map +1 -1
  300. package/dist/xlsx/ui/index.cjs +7177 -4234
  301. package/dist/xlsx/ui/index.mjs +7177 -4234
  302. package/dist/xlsx/write/drawing.d.ts.map +1 -1
  303. package/dist/xlsx/write/filter-columns.d.ts +39 -0
  304. package/dist/xlsx/write/filter-columns.d.ts.map +1 -0
  305. package/dist/xlsx/write/shared-strings.d.ts +4 -4
  306. package/dist/xlsx/write/shared-strings.d.ts.map +1 -1
  307. package/dist/xlsx/write/sheet-props.d.ts +2 -1
  308. package/dist/xlsx/write/sheet-props.d.ts.map +1 -1
  309. package/dist/xlsx/write/smart-art-cache.d.ts.map +1 -1
  310. package/dist/xlsx/write/smart-art.d.ts.map +1 -1
  311. package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
  312. package/package.json +6 -1
  313. package/dist/PptxHandler-QY5VL3CY.mjs +0 -7
  314. package/dist/PptxHandler-SJ5ZUIUX.mjs +0 -4
  315. package/dist/chunk-3GXV5MPC.mjs +0 -41
  316. package/dist/pptx/chunks/elements-mSCZ84Tc.d.ts.map +0 -1
  317. package/dist/pptx/chunks/index-DKybuHPT.d.ts.map +0 -1
  318. package/dist/pptx/chunks/smart-art-DLumQo90.d.ts.map +0 -1
@@ -3620,8 +3620,8 @@ var LiteElement = class {
3620
3620
  return out;
3621
3621
  }
3622
3622
  getAttribute(name) {
3623
- const attrs2 = this.attrs;
3624
- for (let i2 = 0; i2 < attrs2.length; i2 += 2) if (attrs2[i2] === name) return attrs2[i2 + 1] ?? null;
3623
+ const attrs3 = this.attrs;
3624
+ for (let i2 = 0; i2 < attrs3.length; i2 += 2) if (attrs3[i2] === name) return attrs3[i2 + 1] ?? null;
3625
3625
  return null;
3626
3626
  }
3627
3627
  hasAttribute(name) {
@@ -4776,6 +4776,11 @@ var MS_PER_DAY = 864e5;
4776
4776
  var EPOCH_1900 = Date.UTC(1899, 11, 30);
4777
4777
  var EPOCH_1904 = Date.UTC(1904, 0, 1);
4778
4778
  var MAX_DATE_SERIAL = 2958465;
4779
+ function serialToDate(serial, date1904 = false) {
4780
+ if (date1904) return new Date(EPOCH_1904 + Math.round(serial * MS_PER_DAY));
4781
+ const adjusted = serial < 61 ? serial + 1 : serial;
4782
+ return new Date(EPOCH_1900 + Math.round(adjusted * MS_PER_DAY));
4783
+ }
4779
4784
  function dateToSerial(date, date1904 = false) {
4780
4785
  const ms = date.getTime();
4781
4786
  if (date1904) return (ms - EPOCH_1904) / MS_PER_DAY;
@@ -5548,23 +5553,23 @@ function compileFormat(format) {
5548
5553
  if (hit) return hit;
5549
5554
  const code = format.trim() === "" ? "General" : format;
5550
5555
  const sections = splitSections(code).slice(0, 4).map(compileSection);
5551
- let numeric2;
5556
+ let numeric3;
5552
5557
  let text;
5553
5558
  const last = sections[sections.length - 1];
5554
5559
  if (sections.length === 4) {
5555
- numeric2 = sections.slice(0, 3);
5560
+ numeric3 = sections.slice(0, 3);
5556
5561
  text = sections[3];
5557
5562
  } else if (last && last.kind === "text") {
5558
- numeric2 = sections.slice(0, -1);
5563
+ numeric3 = sections.slice(0, -1);
5559
5564
  text = last;
5560
- } else numeric2 = sections;
5561
- if (numeric2.length === 0) numeric2 = [generalSection()];
5562
- const conditional = numeric2.some((s) => s.condition !== void 0);
5563
- if (conditional && numeric2.length === 1) numeric2.push(generalSection());
5565
+ } else numeric3 = sections;
5566
+ if (numeric3.length === 0) numeric3 = [generalSection()];
5567
+ const conditional = numeric3.some((s) => s.condition !== void 0);
5568
+ if (conditional && numeric3.length === 1) numeric3.push(generalSection());
5564
5569
  const compiled = {
5565
- numeric: numeric2,
5570
+ numeric: numeric3,
5566
5571
  conditional,
5567
- isDate: numeric2.some((s) => s.kind === "date")
5572
+ isDate: numeric3.some((s) => s.kind === "date")
5568
5573
  };
5569
5574
  if (text) compiled.text = text;
5570
5575
  if (cache.size >= CACHE_LIMIT) cache.clear();
@@ -6035,26 +6040,494 @@ function displayText(workbook, cell) {
6035
6040
  }).text;
6036
6041
  }
6037
6042
 
6038
- // xlsx/filter-rows.ts
6039
- function rowMatchesFilter(workbook, sheet, row2, filter2) {
6040
- return (filter2.columns ?? []).every((column2) => {
6041
- if (!column2.values && !column2.blank) return true;
6042
- const text = displayText(workbook, getCell(sheet, row2, filter2.range.start.col + column2.offset));
6043
- return text === "" ? !!column2.blank : (column2.values ?? []).includes(text);
6044
- });
6043
+ // xlsx/time-period.ts
6044
+ function timePeriodFormula(period, cell) {
6045
+ const day = `FLOOR(${cell},1)`;
6046
+ const down = `ROUNDDOWN(${cell},0)`;
6047
+ const month = (offset2) => `AND(MONTH(${cell})=MONTH(EDATE(TODAY(),${offset2})),YEAR(${cell})=YEAR(EDATE(TODAY(),${offset2})))`;
6048
+ switch (period) {
6049
+ case "today":
6050
+ return `${day}=TODAY()`;
6051
+ case "yesterday":
6052
+ return `${day}=TODAY()-1`;
6053
+ case "tomorrow":
6054
+ return `${day}=TODAY()+1`;
6055
+ case "last7Days":
6056
+ return `AND(TODAY()-${day}<=6,${day}<=TODAY())`;
6057
+ case "thisWeek":
6058
+ return `AND(TODAY()-${down}<=WEEKDAY(TODAY())-1,${down}-TODAY()<=7-WEEKDAY(TODAY()))`;
6059
+ case "lastWeek":
6060
+ return `AND(TODAY()-${down}>=(WEEKDAY(TODAY())),TODAY()-${down}<(WEEKDAY(TODAY())+7))`;
6061
+ case "nextWeek":
6062
+ return `AND(${down}-TODAY()>(7-WEEKDAY(TODAY())),${down}-TODAY()<(15-WEEKDAY(TODAY())))`;
6063
+ case "thisMonth":
6064
+ return `AND(MONTH(${cell})=MONTH(TODAY()),YEAR(${cell})=YEAR(TODAY()))`;
6065
+ case "lastMonth":
6066
+ return month("0-1");
6067
+ case "nextMonth":
6068
+ return month("0+1");
6069
+ }
6070
+ }
6071
+ function inTimePeriod(period, value2, today, date1904 = false) {
6072
+ const v = Math.floor(value2);
6073
+ const t = Math.floor(today);
6074
+ const todayDate = serialToDate(t, date1904);
6075
+ const weekday2 = todayDate.getUTCDay() + 1;
6076
+ const monthOf = (serial) => {
6077
+ const d = serialToDate(serial, date1904);
6078
+ return d.getUTCFullYear() * 12 + d.getUTCMonth();
6079
+ };
6080
+ const current = todayDate.getUTCFullYear() * 12 + todayDate.getUTCMonth();
6081
+ switch (period) {
6082
+ case "today":
6083
+ return v === t;
6084
+ case "yesterday":
6085
+ return v === t - 1;
6086
+ case "tomorrow":
6087
+ return v === t + 1;
6088
+ case "last7Days":
6089
+ return t - v <= 6 && v <= t;
6090
+ case "thisWeek":
6091
+ return t - v <= weekday2 - 1 && v - t <= 7 - weekday2;
6092
+ case "lastWeek":
6093
+ return t - v >= weekday2 && t - v < weekday2 + 7;
6094
+ case "nextWeek":
6095
+ return v - t > 7 - weekday2 && v - t < 15 - weekday2;
6096
+ case "thisMonth":
6097
+ return monthOf(v) === current;
6098
+ case "lastMonth":
6099
+ return monthOf(v) === current - 1;
6100
+ case "nextMonth":
6101
+ return monthOf(v) === current + 1;
6102
+ }
6103
+ }
6104
+
6105
+ // xlsx/filter-dynamic.ts
6106
+ function todaySerial(date1904) {
6107
+ const now = /* @__PURE__ */ new Date();
6108
+ return Math.floor(
6109
+ dateToSerial(new Date(Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())), date1904)
6110
+ );
6111
+ }
6112
+ var PERIODS = {
6113
+ today: "today",
6114
+ yesterday: "yesterday",
6115
+ tomorrow: "tomorrow",
6116
+ thisWeek: "thisWeek",
6117
+ lastWeek: "lastWeek",
6118
+ nextWeek: "nextWeek",
6119
+ thisMonth: "thisMonth",
6120
+ lastMonth: "lastMonth",
6121
+ nextMonth: "nextMonth"
6122
+ };
6123
+ function inDynamicPeriod(type, value2, today, date1904) {
6124
+ const period = PERIODS[type];
6125
+ if (period) return inTimePeriod(period, value2, today, date1904);
6126
+ const d = serialToDate(Math.floor(value2), date1904);
6127
+ const now = serialToDate(today, date1904);
6128
+ const quarter = (date) => date.getUTCFullYear() * 4 + Math.floor(date.getUTCMonth() / 3);
6129
+ switch (type) {
6130
+ case "thisQuarter":
6131
+ return quarter(d) === quarter(now);
6132
+ case "lastQuarter":
6133
+ return quarter(d) === quarter(now) - 1;
6134
+ case "nextQuarter":
6135
+ return quarter(d) === quarter(now) + 1;
6136
+ case "thisYear":
6137
+ return d.getUTCFullYear() === now.getUTCFullYear();
6138
+ case "lastYear":
6139
+ return d.getUTCFullYear() === now.getUTCFullYear() - 1;
6140
+ case "nextYear":
6141
+ return d.getUTCFullYear() === now.getUTCFullYear() + 1;
6142
+ case "yearToDate":
6143
+ return d.getUTCFullYear() === now.getUTCFullYear() && Math.floor(value2) <= today;
6144
+ }
6145
+ const q = /^Q([1-4])$/.exec(type);
6146
+ if (q) return Math.floor(d.getUTCMonth() / 3) + 1 === Number(q[1]);
6147
+ const m = /^M(\d{1,2})$/.exec(type);
6148
+ if (m) return d.getUTCMonth() + 1 === Number(m[1]);
6149
+ return false;
6150
+ }
6151
+ function inDateGroup(item2, serial, date1904) {
6152
+ const d = serialToDate(serial, date1904);
6153
+ const fields = [
6154
+ [item2.year, d.getUTCFullYear()],
6155
+ [item2.month, d.getUTCMonth() + 1],
6156
+ [item2.day, d.getUTCDate()],
6157
+ [item2.hour, d.getUTCHours()],
6158
+ [item2.minute, d.getUTCMinutes()],
6159
+ [item2.second, d.getUTCSeconds()]
6160
+ ];
6161
+ const depth = ["year", "month", "day", "hour", "minute", "second"].indexOf(item2.grouping);
6162
+ return fields.slice(0, depth + 1).every(([want, have]) => want === void 0 || want === have);
6163
+ }
6164
+
6165
+ // color/hex-rgb.ts
6166
+ function parseArgbHex(hex) {
6167
+ const clean = hex.replace(/^#/, "");
6168
+ const rgb = clean.length === 8 ? clean.slice(2) : clean;
6169
+ if (!/^[0-9a-fA-F]{6}$/.test(rgb)) return void 0;
6170
+ return [0, 2, 4].map((i2) => parseInt(rgb.slice(i2, i2 + 2), 16));
6171
+ }
6172
+ var clamp255 = (v) => Math.max(0, Math.min(255, v));
6173
+ var rgbToUpperHex = (rgb) => `#${rgb.map((v) => clamp255(Math.round(v)).toString(16).padStart(2, "0")).join("").toUpperCase()}`;
6174
+
6175
+ // xlsx/layout/tint.ts
6176
+ var HLSMAX = 240;
6177
+ var RGBMAX = 255;
6178
+ var idiv = (a2, b) => Math.trunc(a2 / b);
6179
+ function rgbToHls240(r, g2, b) {
6180
+ const max = Math.max(r, g2, b);
6181
+ const min = Math.min(r, g2, b);
6182
+ const l = idiv((max + min) * HLSMAX + RGBMAX, 2 * RGBMAX);
6183
+ if (max === min) return { h: idiv(HLSMAX * 2, 3), l, s: 0 };
6184
+ const sum3 = max + min;
6185
+ const s = l <= HLSMAX / 2 ? idiv((max - min) * HLSMAX + idiv(sum3, 2), sum3) : idiv((max - min) * HLSMAX + idiv(2 * RGBMAX - sum3, 2), 2 * RGBMAX - sum3);
6186
+ const delta = (c2) => idiv((max - c2) * idiv(HLSMAX, 6) + idiv(max - min, 2), max - min);
6187
+ const rd = delta(r);
6188
+ const gd18 = delta(g2);
6189
+ const bd = delta(b);
6190
+ let h2;
6191
+ if (r === max) h2 = bd - gd18;
6192
+ else if (g2 === max) h2 = idiv(HLSMAX, 3) + rd - bd;
6193
+ else h2 = idiv(2 * HLSMAX, 3) + gd18 - rd;
6194
+ if (h2 < 0) h2 += HLSMAX;
6195
+ if (h2 > HLSMAX) h2 -= HLSMAX;
6196
+ return { h: h2, l, s };
6197
+ }
6198
+ function hueToRgb(n1, n2, hue) {
6199
+ let h2 = hue;
6200
+ if (h2 < 0) h2 += HLSMAX;
6201
+ if (h2 > HLSMAX) h2 -= HLSMAX;
6202
+ const sixth = idiv(HLSMAX, 6);
6203
+ if (h2 < sixth) return n1 + idiv((n2 - n1) * h2 + idiv(HLSMAX, 12), sixth);
6204
+ if (h2 < idiv(HLSMAX, 2)) return n2;
6205
+ if (h2 < idiv(HLSMAX * 2, 3))
6206
+ return n1 + idiv((n2 - n1) * (idiv(HLSMAX * 2, 3) - h2) + idiv(HLSMAX, 12), sixth);
6207
+ return n1;
6208
+ }
6209
+ var clamp2552 = (v) => Math.max(0, Math.min(255, v));
6210
+ function hls240ToRgb({ h: h2, l, s }) {
6211
+ if (s === 0) {
6212
+ const v = clamp2552(Math.round(l * RGBMAX / HLSMAX));
6213
+ return [v, v, v];
6214
+ }
6215
+ const m2 = l <= HLSMAX / 2 ? idiv(l * (HLSMAX + s) + idiv(HLSMAX, 2), HLSMAX) : l + s - idiv(l * s + idiv(HLSMAX, 2), HLSMAX);
6216
+ const m1 = 2 * l - m2;
6217
+ const channel = (hue) => clamp2552(idiv(hueToRgb(m1, m2, hue) * RGBMAX + idiv(HLSMAX, 2), HLSMAX));
6218
+ return [channel(h2 + idiv(HLSMAX, 3)), channel(h2), channel(h2 - idiv(HLSMAX, 3))];
6219
+ }
6220
+ var parseHex = parseArgbHex;
6221
+ var toHexColor = rgbToUpperHex;
6222
+ function applyTint(hex, tint) {
6223
+ const rgb = parseHex(hex) ?? [0, 0, 0];
6224
+ if (!tint) return toHexColor(rgb);
6225
+ const t = Math.max(-1, Math.min(1, tint));
6226
+ const hls = rgbToHls240(...rgb);
6227
+ const l = t < 0 ? Math.trunc(hls.l * (1 + t)) : Math.round(hls.l * (1 - t) + HLSMAX * t);
6228
+ return toHexColor(hls240ToRgb({ ...hls, l: Math.max(0, Math.min(HLSMAX, l)) }));
6229
+ }
6230
+
6231
+ // chart/render/theme-palette.ts
6232
+ var THEME_SLOTS = [
6233
+ "lt1",
6234
+ "dk1",
6235
+ "lt2",
6236
+ "dk2",
6237
+ "accent1",
6238
+ "accent2",
6239
+ "accent3",
6240
+ "accent4",
6241
+ "accent5",
6242
+ "accent6",
6243
+ "hlink",
6244
+ "folHlink"
6245
+ ];
6246
+ var DEFAULT_THEME_COLORS = [
6247
+ "FFFFFF",
6248
+ "000000",
6249
+ "E7E6E6",
6250
+ "44546A",
6251
+ "4472C4",
6252
+ "ED7D31",
6253
+ "A5A5A5",
6254
+ "FFC000",
6255
+ "5B9BD5",
6256
+ "70AD47",
6257
+ "0563C1",
6258
+ "954F72"
6259
+ ];
6260
+ function themeColor(theme, index3) {
6261
+ const hex = theme.colors[index3] ?? DEFAULT_THEME_COLORS[index3];
6262
+ return hex && parseArgbHex(hex) ? hex.replace(/^#/, "") : void 0;
6263
+ }
6264
+
6265
+ // xlsx/layout/colors.ts
6266
+ var INDEXED_COLORS = [
6267
+ "000000",
6268
+ "FFFFFF",
6269
+ "FF0000",
6270
+ "00FF00",
6271
+ "0000FF",
6272
+ "FFFF00",
6273
+ "FF00FF",
6274
+ "00FFFF",
6275
+ "000000",
6276
+ "FFFFFF",
6277
+ "FF0000",
6278
+ "00FF00",
6279
+ "0000FF",
6280
+ "FFFF00",
6281
+ "FF00FF",
6282
+ "00FFFF",
6283
+ "800000",
6284
+ "008000",
6285
+ "000080",
6286
+ "808000",
6287
+ "800080",
6288
+ "008080",
6289
+ "C0C0C0",
6290
+ "808080",
6291
+ "9999FF",
6292
+ "993366",
6293
+ "FFFFCC",
6294
+ "CCFFFF",
6295
+ "660066",
6296
+ "FF8080",
6297
+ "0066CC",
6298
+ "CCCCFF",
6299
+ "000080",
6300
+ "FF00FF",
6301
+ "FFFF00",
6302
+ "00FFFF",
6303
+ "800080",
6304
+ "800000",
6305
+ "008080",
6306
+ "0000FF",
6307
+ "00CCFF",
6308
+ "CCFFFF",
6309
+ "CCFFCC",
6310
+ "FFFF99",
6311
+ "99CCFF",
6312
+ "FF99CC",
6313
+ "CC99FF",
6314
+ "FFCC99",
6315
+ "3366FF",
6316
+ "33CCCC",
6317
+ "99CC00",
6318
+ "FFCC00",
6319
+ "FF9900",
6320
+ "FF6600",
6321
+ "666699",
6322
+ "969696",
6323
+ "003366",
6324
+ "339966",
6325
+ "003300",
6326
+ "333300",
6327
+ "993300",
6328
+ "993366",
6329
+ "333399",
6330
+ "333333",
6331
+ "000000",
6332
+ "FFFFFF"
6333
+ ];
6334
+ function resolveColor(color, theme, fallback, indexed = INDEXED_COLORS) {
6335
+ if (!color) return fallback;
6336
+ let base;
6337
+ if (color.rgb !== void 0) base = parseHex(color.rgb) ? color.rgb : void 0;
6338
+ else if (color.theme !== void 0) base = themeColor(theme, color.theme);
6339
+ else if (color.indexed !== void 0)
6340
+ base = indexed[color.indexed] ?? INDEXED_COLORS[color.indexed];
6341
+ if (base === void 0) return fallback;
6342
+ return applyTint(base, color.tint);
6343
+ }
6344
+
6345
+ // xlsx/filter-criteria.ts
6346
+ var numeric = (cell) => typeof cell?.value === "number" ? cell.value : void 0;
6347
+ function wildcardRegex(pattern) {
6348
+ let out = "";
6349
+ let wild = false;
6350
+ for (let i2 = 0; i2 < pattern.length; i2++) {
6351
+ const ch = pattern[i2];
6352
+ if (ch === "~" && i2 + 1 < pattern.length) {
6353
+ wild = true;
6354
+ out += pattern[++i2].replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
6355
+ } else if (ch === "*") {
6356
+ out += "[\\s\\S]*";
6357
+ wild = true;
6358
+ } else if (ch === "?") {
6359
+ out += "[\\s\\S]";
6360
+ wild = true;
6361
+ } else out += ch.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
6362
+ }
6363
+ return wild ? new RegExp(`^${out}$`, "i") : void 0;
6364
+ }
6365
+ var rank = (v) => typeof v === "number" ? 0 : typeof v === "string" ? 1 : 2;
6366
+ function compare(cell, text, operand2) {
6367
+ const value2 = cell?.value ?? null;
6368
+ const asNumber = operand2.trim() === "" ? NaN : Number(operand2);
6369
+ if (typeof value2 === "number" && !Number.isNaN(asNumber)) return value2 - asNumber;
6370
+ if (typeof value2 === "string") {
6371
+ const a2 = value2.toLowerCase();
6372
+ const b = operand2.toLowerCase();
6373
+ return a2 < b ? -1 : a2 > b ? 1 : 0;
6374
+ }
6375
+ return rank(value2) - (Number.isNaN(asNumber) ? 1 : 0);
6376
+ }
6377
+ function conditionTest(workbook, condition) {
6378
+ const { operator, value: operand2 } = condition;
6379
+ if (operand2 === " " && (operator === "notEqual" || operator === "equal")) {
6380
+ const blank = (cell) => cell?.value === null || cell?.value === void 0 || cell.value === "";
6381
+ return operator === "notEqual" ? (cell) => !blank(cell) : blank;
6382
+ }
6383
+ const wild = operator === "equal" || operator === "notEqual" ? wildcardRegex(operand2) : void 0;
6384
+ return (cell) => {
6385
+ const empty = cell?.value === null || cell?.value === void 0 || cell.value === "";
6386
+ if (empty)
6387
+ return operator === "notEqual" ? operand2 !== "" : operator === "equal" && operand2 === "";
6388
+ if (wild) {
6389
+ const hit = wild.test(displayText(workbook, cell));
6390
+ return operator === "equal" ? hit : !hit;
6391
+ }
6392
+ const cmp = compare(cell, displayText(workbook, cell), operand2);
6393
+ switch (operator) {
6394
+ case "equal":
6395
+ return cmp === 0;
6396
+ case "notEqual":
6397
+ return cmp !== 0;
6398
+ case "lessThan":
6399
+ return cmp < 0;
6400
+ case "lessThanOrEqual":
6401
+ return cmp <= 0;
6402
+ case "greaterThan":
6403
+ return cmp > 0;
6404
+ case "greaterThanOrEqual":
6405
+ return cmp >= 0;
6406
+ }
6407
+ };
6408
+ }
6409
+ var SOLID = (fill) => fill?.type === "pattern" && fill.pattern !== "none" ? fill.fgColor ?? fill.bgColor : void 0;
6410
+ function cellFillColor(workbook, cell, cf) {
6411
+ const fromCf = SOLID(cf?.style?.fill);
6412
+ if (fromCf) return resolveColor(fromCf, workbook.theme)?.toUpperCase();
6413
+ if (cf?.colorScale) return cf.colorScale.toUpperCase();
6414
+ const fill = styleAt(workbook, cell?.styleId).fill;
6415
+ return resolveColor(SOLID(fill), workbook.theme)?.toUpperCase();
6416
+ }
6417
+ function cellFontColor(workbook, cell, cf) {
6418
+ const color = cf?.style?.font?.color ?? styleAt(workbook, cell?.styleId).font.color;
6419
+ return (resolveColor(color, workbook.theme, "#000000") ?? "#000000").toUpperCase();
6420
+ }
6421
+ function colourTest(workbook, column2, read) {
6422
+ const color = column2.color;
6423
+ if (!color?.style) return void 0;
6424
+ if (color.cellColor) {
6425
+ const want2 = resolveColor(SOLID(color.style.fill), workbook.theme)?.toUpperCase();
6426
+ return (row2) => {
6427
+ const { cell, cf } = read(row2);
6428
+ return cellFillColor(workbook, cell, cf) === want2;
6429
+ };
6430
+ }
6431
+ const want = (resolveColor(color.style.font?.color, workbook.theme, "#000000") ?? "#000000").toUpperCase();
6432
+ return (row2) => {
6433
+ const { cell, cf } = read(row2);
6434
+ return cellFontColor(workbook, cell, cf) === want;
6435
+ };
6045
6436
  }
6046
- function isFilteredRow(workbook, sheet, row2) {
6437
+ function compileAutoFilter(workbook, sheet, filter2, options = {}) {
6438
+ const { range } = filter2;
6439
+ const tests = [];
6440
+ const today = options.today ?? todaySerial(workbook.date1904);
6441
+ for (const column2 of filter2.columns ?? []) {
6442
+ const col = range.start.col + column2.offset;
6443
+ const cellOf2 = (row2) => getCell(sheet, row2, col);
6444
+ const numbers3 = () => {
6445
+ const out = [];
6446
+ for (let r = range.start.row + 1; r <= range.end.row; r++) {
6447
+ const n = numeric(cellOf2(r));
6448
+ if (n !== void 0) out.push(n);
6449
+ }
6450
+ return out;
6451
+ };
6452
+ if (column2.top10) {
6453
+ const spec2 = column2.top10;
6454
+ const sorted2 = numbers3().sort((a2, b) => spec2.top ? b - a2 : a2 - b);
6455
+ const count2 = spec2.percent ? Math.max(1, Math.floor(sorted2.length * spec2.value / 100)) : Math.max(1, Math.floor(spec2.value));
6456
+ const cut = sorted2[Math.min(count2, sorted2.length) - 1];
6457
+ tests.push((row2) => {
6458
+ const n = numeric(cellOf2(row2));
6459
+ return n !== void 0 && cut !== void 0 && (spec2.top ? n >= cut : n <= cut);
6460
+ });
6461
+ } else if (column2.custom?.conditions.length) {
6462
+ const parts = column2.custom.conditions.slice(0, 2).map((c2) => conditionTest(workbook, c2));
6463
+ const and = !!column2.custom.and;
6464
+ tests.push((row2) => {
6465
+ const cell = cellOf2(row2);
6466
+ return and ? parts.every((t) => t(cell)) : parts.some((t) => t(cell));
6467
+ });
6468
+ } else if (column2.dynamic) {
6469
+ const { type } = column2.dynamic;
6470
+ if (type === "aboveAverage" || type === "belowAverage") {
6471
+ const all2 = numbers3();
6472
+ const avg = all2.length ? all2.reduce((a2, b) => a2 + b, 0) / all2.length : 0;
6473
+ tests.push((row2) => {
6474
+ const n = numeric(cellOf2(row2));
6475
+ return n !== void 0 && (type === "aboveAverage" ? n > avg : n < avg);
6476
+ });
6477
+ } else if (type !== "null")
6478
+ tests.push((row2) => {
6479
+ const n = numeric(cellOf2(row2));
6480
+ return n !== void 0 && inDynamicPeriod(type, n, today, workbook.date1904);
6481
+ });
6482
+ } else if (column2.color) {
6483
+ const test = colourTest(workbook, column2, (row2) => ({
6484
+ cell: cellOf2(row2),
6485
+ cf: options.formatAt?.(row2, col)
6486
+ }));
6487
+ if (test) tests.push(test);
6488
+ } else if (column2.icon) {
6489
+ const { iconSet, iconId } = column2.icon;
6490
+ if (options.formatAt)
6491
+ tests.push((row2) => {
6492
+ const icon = options.formatAt?.(row2, col)?.icon;
6493
+ return iconId === void 0 ? !icon : icon?.set === iconSet && icon.index === iconId;
6494
+ });
6495
+ } else if (column2.values || column2.blank || column2.dateGroups?.length) {
6496
+ const values2 = new Set(column2.values ?? []);
6497
+ const groups = column2.dateGroups ?? [];
6498
+ tests.push((row2) => {
6499
+ const cell = cellOf2(row2);
6500
+ const text = displayText(workbook, cell);
6501
+ if (text === "") return !!column2.blank;
6502
+ if (values2.has(text)) return true;
6503
+ const n = numeric(cell);
6504
+ return n !== void 0 && groups.some((g2) => inDateGroup(g2, n, workbook.date1904));
6505
+ });
6506
+ }
6507
+ }
6508
+ return (row2) => tests.every((test) => test(row2));
6509
+ }
6510
+ function rowMatchesFilter(workbook, sheet, row2, filter2, options) {
6511
+ return compileAutoFilter(workbook, sheet, filter2, options)(row2);
6512
+ }
6513
+
6514
+ // xlsx/filter-rows.ts
6515
+ function isFilteredRow(workbook, sheet, row2, matches2) {
6047
6516
  const filter2 = sheet.autoFilter;
6048
6517
  if (!filter2) return false;
6049
6518
  const info = sheet.rowInfo.get(row2);
6050
6519
  if (info?.filteredOut !== void 0) return info.filteredOut;
6051
- return !!info?.hidden && row2 > filter2.range.start.row && row2 <= filter2.range.end.row && !rowMatchesFilter(workbook, sheet, row2, filter2);
6520
+ return !!info?.hidden && row2 > filter2.range.start.row && row2 <= filter2.range.end.row && !(matches2 ?? compileAutoFilter(workbook, sheet, filter2))(row2);
6052
6521
  }
6053
6522
  function readFilteredRows(workbook) {
6054
- for (const sheet of workbook.sheets)
6523
+ for (const sheet of workbook.sheets) {
6524
+ const filter2 = sheet.autoFilter;
6525
+ if (!filter2) continue;
6526
+ const matches2 = compileAutoFilter(workbook, sheet, filter2);
6055
6527
  for (const [row2, info] of sheet.rowInfo)
6056
- if (sheet.autoFilter && row2 > sheet.autoFilter.range.start.row && row2 <= sheet.autoFilter.range.end.row && info.hidden)
6057
- info.filteredOut = isFilteredRow(workbook, sheet, row2);
6528
+ if (row2 > filter2.range.start.row && row2 <= filter2.range.end.row && info.hidden)
6529
+ info.filteredOut = isFilteredRow(workbook, sheet, row2, matches2);
6530
+ }
6058
6531
  }
6059
6532
 
6060
6533
  // xlsx/workbook.ts
@@ -6561,14 +7034,14 @@ function tokenize(formula2) {
6561
7034
  }
6562
7035
  if (ch === "'" || ch === "[") throw new FormulaError("Malformed sheet reference", start);
6563
7036
  }
6564
- const numeric2 = isDigit3(code) || ch === ".";
6565
- if (numeric2 || ch === "$" || nameStart) {
7037
+ const numeric3 = isDigit3(code) || ch === ".";
7038
+ if (numeric3 || ch === "$" || nameStart) {
6566
7039
  const ref = readReference(source3, i2);
6567
7040
  if (ref) {
6568
7041
  push(refToken(source3, start, i2 + ref.length, ref.ref, void 0));
6569
7042
  continue;
6570
7043
  }
6571
- if (numeric2) {
7044
+ if (numeric3) {
6572
7045
  const m = matchAt(NUMBER_AT, source3, i2);
6573
7046
  if (!m) throw new FormulaError(`Unexpected '${ch}'`, start);
6574
7047
  push({ kind: "number", text: m[0], start, value: numberLiteral(m[0]) });
@@ -7542,9 +8015,9 @@ function pivotItems(pivot, field) {
7542
8015
  const key = pivotValueKey(value2);
7543
8016
  if (!items.has(key)) items.set(key, value2);
7544
8017
  }
7545
- const rank3 = (value2) => value2 === null || value2 === "" ? 4 : isCellError(value2) ? 3 : typeof value2 === "boolean" ? 2 : typeof value2 === "string" ? 1 : 0;
8018
+ const rank4 = (value2) => value2 === null || value2 === "" ? 4 : isCellError(value2) ? 3 : typeof value2 === "boolean" ? 2 : typeof value2 === "string" ? 1 : 0;
7546
8019
  return [...items.values()].sort(
7547
- (a2, b) => (group ? groupRank(group, a2) - groupRank(group, b) : 0) || rank3(a2) - rank3(b) || (typeof a2 === "number" && typeof b === "number" ? a2 - b : String(pivotItemLabel(a2)).localeCompare(String(pivotItemLabel(b)), "en", {
8020
+ (a2, b) => (group ? groupRank(group, a2) - groupRank(group, b) : 0) || rank4(a2) - rank4(b) || (typeof a2 === "number" && typeof b === "number" ? a2 - b : String(pivotItemLabel(a2)).localeCompare(String(pivotItemLabel(b)), "en", {
7548
8021
  sensitivity: "base",
7549
8022
  numeric: true
7550
8023
  }))
@@ -9897,9 +10370,39 @@ function parseIndexedPalette(styleSheet) {
9897
10370
  }
9898
10371
 
9899
10372
  // xlsx/read/shared-strings.ts
10373
+ var PHONETIC_TYPES = [
10374
+ "halfwidthKatakana",
10375
+ "fullwidthKatakana",
10376
+ "Hiragana",
10377
+ "noConversion"
10378
+ ];
10379
+ var PHONETIC_ALIGNMENTS = ["noControl", "left", "center", "distributed"];
10380
+ var oneOf = (allowed, value2) => allowed.find((item2) => item2 === value2);
10381
+ function parsePhonetic(element3) {
10382
+ const runs = xChildren(element3, "rPh").map((run2) => {
10383
+ const sb = numAttr(run2, "sb") ?? 0;
10384
+ return { text: xText(xFirst(run2, "t")), sb, eb: numAttr(run2, "eb") ?? sb };
10385
+ });
10386
+ const pr = xFirst(element3, "phoneticPr");
10387
+ if (!runs.length && !pr) return void 0;
10388
+ const phonetic = { runs };
10389
+ if (pr) {
10390
+ const properties2 = {};
10391
+ const fontId = numAttr(pr, "fontId");
10392
+ if (fontId !== void 0) properties2.fontId = fontId;
10393
+ const type = oneOf(PHONETIC_TYPES, att(pr, "type"));
10394
+ if (type) properties2.type = type;
10395
+ const alignment = oneOf(PHONETIC_ALIGNMENTS, att(pr, "alignment"));
10396
+ if (alignment) properties2.alignment = alignment;
10397
+ if (Object.keys(properties2).length) phonetic.properties = properties2;
10398
+ }
10399
+ return phonetic;
10400
+ }
9900
10401
  function parseRichString(element3, palette) {
10402
+ const phonetic = parsePhonetic(element3);
10403
+ const withPhonetic = (value2) => phonetic ? { ...value2, phonetic } : value2;
9901
10404
  const runs = xChildren(element3, "r");
9902
- if (!runs.length) return { text: xText(xFirst(element3, "t")) };
10405
+ if (!runs.length) return withPhonetic({ text: xText(xFirst(element3, "t")) });
9903
10406
  const parsed = runs.map((run2) => {
9904
10407
  const out = { text: xText(xFirst(run2, "t")) };
9905
10408
  const rPr = xFirst(run2, "rPr");
@@ -9910,7 +10413,7 @@ function parseRichString(element3, palette) {
9910
10413
  return out;
9911
10414
  });
9912
10415
  const text = parsed.map((run2) => run2.text).join("");
9913
- return { text, runs: parsed };
10416
+ return withPhonetic({ text, runs: parsed });
9914
10417
  }
9915
10418
  var LABEL = "XLSX shared strings";
9916
10419
  function parseSharedStrings(xml, palette, maxXmlElements) {
@@ -10405,37 +10908,271 @@ function resolveDrawingColor(color, theme, options) {
10405
10908
  };
10406
10909
  }
10407
10910
 
10408
- // drawingml/picture-crop.ts
10409
- var SIDES = { l: "cropLeft", t: "cropTop", r: "cropRight", b: "cropBottom" };
10410
- function parsePictureCrop(blipFill) {
10411
- const rect2 = first(blipFill, "srcRect", NS.a);
10412
- if (!rect2) return void 0;
10413
- const result2 = {};
10414
- for (const [attr3, key] of Object.entries(SIDES)) {
10415
- const raw2 = rect2.getAttribute(attr3);
10416
- if (raw2 === null || !raw2.trim()) continue;
10417
- const percent = raw2.endsWith("%");
10418
- const value2 = Number(percent ? raw2.slice(0, -1) : raw2) / (percent ? 100 : 1e5);
10419
- if (Number.isFinite(value2)) result2[key] = value2;
10911
+ // drawingml/picture-artistic.ts
10912
+ var ARTISTIC_PRIMARY_ATTRIBUTE = {
10913
+ artisticBlur: "radius",
10914
+ artisticCement: "crackSpacing",
10915
+ artisticChalkSketch: "pressure",
10916
+ artisticCrisscrossEtching: "pressure",
10917
+ artisticCutout: "numberOfShades",
10918
+ artisticFilmGrain: "grainSize",
10919
+ artisticGlass: "scaling",
10920
+ artisticGlowDiffused: "intensity",
10921
+ artisticGlowEdges: "smoothness",
10922
+ artisticLightScreen: "gridSize",
10923
+ artisticLineDrawing: "pencilSize",
10924
+ artisticMarker: "size",
10925
+ // Spelled "Mosiaic" in the schema; Microsoft's typo is part of the format.
10926
+ artisticMosiaicBubbles: "pressure",
10927
+ artisticPaintBrush: "brushSize",
10928
+ artisticPaintStrokes: "intensity",
10929
+ artisticPastelsSmooth: "scaling",
10930
+ artisticPencilGrayscale: "pencilSize",
10931
+ artisticPencilSketch: "pressure",
10932
+ artisticPhotocopy: "detail",
10933
+ artisticPlasticWrap: "smoothness",
10934
+ artisticTexturizer: "scaling",
10935
+ artisticWatercolorSponge: "brushSize"
10936
+ };
10937
+ function parseArtisticPictureExtension(node2) {
10938
+ if (node2.namespaceURI !== NS.a || node2.localName !== "extLst") return void 0;
10939
+ const found = [];
10940
+ const unhandled = [];
10941
+ const pending2 = [node2];
10942
+ while (pending2.length) {
10943
+ const item2 = pending2.pop();
10944
+ if (item2 !== node2 && !(item2.namespaceURI === NS.a && item2.localName === "ext") && !(item2.namespaceURI === "http://schemas.microsoft.com/office/drawing/2010/main" && (["imgProps", "imgLayer", "imgEffect", "useLocalDpi"].includes(item2.localName) || ARTISTIC_PRIMARY_ATTRIBUTE[item2.localName])))
10945
+ unhandled.push(item2.localName);
10946
+ if (item2.namespaceURI === "http://schemas.microsoft.com/office/drawing/2010/main" && item2.localName.startsWith("artistic"))
10947
+ found.push(item2);
10948
+ pending2.push(...elements(item2));
10949
+ }
10950
+ if (found.length !== 1) return void 0;
10951
+ const effect = found[0];
10952
+ const key = ARTISTIC_PRIMARY_ATTRIBUTE[effect.localName];
10953
+ if (!key) return void 0;
10954
+ const raw2 = key ? effect.getAttribute(key) : null;
10955
+ const n = raw2 === null ? 0 : Number(raw2);
10956
+ if (!Number.isFinite(n)) return void 0;
10957
+ return {
10958
+ kind: "artistic",
10959
+ name: effect.localName,
10960
+ radius: effect.localName === "artisticBlur" ? n : n / 1e3,
10961
+ baked: true,
10962
+ ...unhandled.length ? { unhandled } : {}
10963
+ };
10964
+ }
10965
+
10966
+ // drawingml/write-color.ts
10967
+ var ELEMENTS = {
10968
+ srgb: "srgbClr",
10969
+ scheme: "schemeClr",
10970
+ system: "sysClr",
10971
+ preset: "prstClr",
10972
+ scrgb: "scrgbClr",
10973
+ hsl: "hslClr"
10974
+ };
10975
+ function drawingColorXml(color) {
10976
+ const local = ELEMENTS[color.kind];
10977
+ const doc = parseXml(`<a:${local} xmlns:a="${NS.a}"/>`);
10978
+ const root = doc.documentElement;
10979
+ if (color.kind === "scrgb" || color.kind === "hsl") {
10980
+ const keys = color.kind === "scrgb" ? ["r", "g", "b"] : ["hue", "sat", "lum"];
10981
+ const values2 = color.value.split(",");
10982
+ keys.forEach((key, i2) => root.setAttribute(key, values2[i2] ?? "0"));
10983
+ } else root.setAttribute("val", color.value);
10984
+ if (color.fallback !== void 0 && color.kind === "system")
10985
+ root.setAttribute("lastClr", color.fallback);
10986
+ for (const transform6 of color.transforms) {
10987
+ if (!/^[A-Za-z_][\w.-]*$/.test(transform6.name))
10988
+ throw new Error(`Invalid DrawingML transform ${transform6.name}`);
10989
+ const node2 = doc.createElementNS(NS.a, `a:${transform6.name}`);
10990
+ if (transform6.value !== "") node2.setAttribute("val", transform6.value);
10991
+ root.appendChild(node2);
10420
10992
  }
10421
- return result2;
10993
+ return buildXml(doc);
10422
10994
  }
10423
- function applyPictureCrop(blipFill, crop) {
10424
- let rect2 = first(blipFill, "srcRect", NS.a);
10425
- if (!rect2 && crop && Object.values(crop).some((value2) => value2 !== void 0)) {
10426
- rect2 = blipFill.ownerDocument.createElementNS(NS.a, "a:srcRect");
10427
- const blip = first(blipFill, "blip", NS.a);
10428
- blipFill.insertBefore(rect2, blip?.nextSibling ?? blipFill.firstChild);
10995
+
10996
+ // drawingml/patch-color.ts
10997
+ function patchDrawingColorIn(container2, color) {
10998
+ const old = elements(container2).find((node2) => parseDrawingColor(node2));
10999
+ const before = parseDrawingColorIn(container2);
11000
+ if (!old || !before || before.kind !== color.kind) {
11001
+ const next = container2.ownerDocument.importNode(
11002
+ parseXml(drawingColorXml(color)).documentElement,
11003
+ true
11004
+ );
11005
+ if (old) container2.replaceChild(next, old);
11006
+ else container2.insertBefore(next, container2.firstChild);
11007
+ return;
10429
11008
  }
10430
- if (!rect2) return;
10431
- for (const [attr3, key] of Object.entries(SIDES)) {
10432
- const value2 = crop?.[key];
10433
- if (value2 === void 0) rect2.removeAttribute(attr3);
10434
- else {
10435
- if (!Number.isFinite(value2)) throw new RangeError("Picture crop must be finite");
10436
- rect2.setAttribute(attr3, String(Math.round(value2 * 1e5)));
11009
+ if (before.value !== color.value) {
11010
+ if (color.kind === "scrgb" || color.kind === "hsl") {
11011
+ const keys = color.kind === "scrgb" ? ["r", "g", "b"] : ["hue", "sat", "lum"];
11012
+ const values2 = color.value.split(",");
11013
+ keys.forEach((key, index3) => old.setAttribute(key, values2[index3] ?? "0"));
11014
+ } else old.setAttribute("val", color.value);
11015
+ }
11016
+ if (before.fallback !== color.fallback && color.kind === "system") {
11017
+ if (color.fallback === void 0) old.removeAttribute("lastClr");
11018
+ else old.setAttribute("lastClr", color.fallback);
11019
+ }
11020
+ const originals = elements(old);
11021
+ color.transforms.forEach((transform6, index3) => {
11022
+ const source3 = originals[index3];
11023
+ if (source3?.localName === transform6.name) {
11024
+ if (before.transforms[index3]?.value !== transform6.value) {
11025
+ if (transform6.value === "") source3.removeAttribute("val");
11026
+ else source3.setAttribute("val", transform6.value);
11027
+ }
11028
+ return;
10437
11029
  }
11030
+ if (!/^[A-Za-z_][\w.-]*$/u.test(transform6.name))
11031
+ throw new Error("Invalid DrawingML colour transform");
11032
+ const next = old.ownerDocument.createElementNS(NS.a, `a:${transform6.name}`);
11033
+ if (transform6.value !== "") next.setAttribute("val", transform6.value);
11034
+ if (source3) old.replaceChild(next, source3);
11035
+ else old.appendChild(next);
11036
+ });
11037
+ for (const extra of originals.slice(color.transforms.length)) old.removeChild(extra);
11038
+ }
11039
+
11040
+ // drawingml/picture-standard-effects.ts
11041
+ var attrs2 = {
11042
+ biLevel: { threshold: "thresh" },
11043
+ alphaRepl: { amount: "a" },
11044
+ alphaBiLevel: { threshold: "thresh" },
11045
+ hsl: { hue: "hue", saturation: "sat", luminance: "lum" },
11046
+ tint: { hue: "hue", amount: "amt" },
11047
+ blur: { radiusEmu: "rad" }
11048
+ };
11049
+ function parseStandardPictureEffect(node2) {
11050
+ const name = node2.localName;
11051
+ if (![
11052
+ "biLevel",
11053
+ "alphaInv",
11054
+ "alphaCeiling",
11055
+ "alphaFloor",
11056
+ "alphaRepl",
11057
+ "alphaBiLevel",
11058
+ "alphaMod",
11059
+ "duotone",
11060
+ "clrRepl",
11061
+ "clrChange",
11062
+ "hsl",
11063
+ "tint",
11064
+ "blur"
11065
+ ].includes(name))
11066
+ return void 0;
11067
+ const values2 = {};
11068
+ for (const [key, attribute2] of Object.entries(attrs2[name] ?? {})) {
11069
+ const raw2 = node2.getAttribute(attribute2);
11070
+ if (raw2 === null) continue;
11071
+ const percent = raw2.endsWith("%");
11072
+ const n = Number(percent ? raw2.slice(0, -1) : raw2) / (key === "hue" ? 6e4 : key === "radiusEmu" ? 1 : percent ? 100 : 1e5);
11073
+ if (!Number.isFinite(n) || key === "hue" && (n < 0 || n >= 360) || key === "threshold" && (n < 0 || n > 1) || key === "radiusEmu" && (!Number.isSafeInteger(n) || n < 0) || ["saturation", "luminance", "amount"].includes(key) && name !== "alphaMod" && (n < (name === "alphaRepl" ? 0 : -1) || n > 1))
11074
+ return void 0;
11075
+ values2[key] = n;
11076
+ }
11077
+ if (["biLevel", "alphaBiLevel"].includes(name) && values2.threshold === void 0)
11078
+ return void 0;
11079
+ if (name === "alphaRepl" && values2.amount === void 0) return void 0;
11080
+ if (name === "alphaMod") {
11081
+ const cont = first(node2, "cont", NS.a);
11082
+ const nested = cont ? elements(cont) : [];
11083
+ if (nested.length !== 1 || nested[0]?.localName !== "alphaModFix") return void 0;
11084
+ const raw2 = nested[0].getAttribute("amt") ?? "100000";
11085
+ const n = Number(raw2.endsWith("%") ? raw2.slice(0, -1) : raw2) / (raw2.endsWith("%") ? 100 : 1e5);
11086
+ if (!Number.isFinite(n) || n < 0) return void 0;
11087
+ values2.amount = n;
11088
+ }
11089
+ let colors = [];
11090
+ if (name === "duotone") {
11091
+ const candidates = elements(node2).filter(
11092
+ (item2) => item2.namespaceURI === NS.a && /Clr$/.test(item2.localName)
11093
+ );
11094
+ colors = candidates.map((item2) => parseDrawingColor(item2)).filter((item2) => Boolean(item2));
11095
+ if (colors.length !== 2) return void 0;
11096
+ }
11097
+ if (name === "clrRepl") {
11098
+ const color = parseDrawingColorIn(node2);
11099
+ if (!color) return void 0;
11100
+ colors = [color];
11101
+ }
11102
+ if (name === "clrChange") {
11103
+ const from = parseDrawingColorIn(first(node2, "clrFrom", NS.a)), to = parseDrawingColorIn(first(node2, "clrTo", NS.a));
11104
+ if (!from || !to) return void 0;
11105
+ colors = [from, to];
11106
+ }
11107
+ if (name === "alphaInv") {
11108
+ const color = parseDrawingColorIn(node2);
11109
+ if (color) colors = [color];
11110
+ }
11111
+ return {
11112
+ kind: "standard",
11113
+ name,
11114
+ ...Object.keys(values2).length ? { values: values2 } : {},
11115
+ ...colors.length ? { colors } : {},
11116
+ ...name === "clrChange" && node2.hasAttribute("useA") ? { useAlpha: !["0", "false"].includes(node2.getAttribute("useA") ?? "") } : {},
11117
+ ...name === "blur" && node2.hasAttribute("grow") ? { grow: !["0", "false"].includes(node2.getAttribute("grow") ?? "") } : {}
11118
+ };
11119
+ }
11120
+ function applyStandardPictureEffect(node2, effect) {
11121
+ const doc = node2.ownerDocument, before = parseStandardPictureEffect(node2);
11122
+ for (const [key, value2] of Object.entries(effect.values ?? {})) {
11123
+ if (!Number.isFinite(value2) || key === "hue" && (value2 < 0 || value2 >= 360) || key === "threshold" && (value2 < 0 || value2 > 1) || key === "radiusEmu" && (!Number.isSafeInteger(value2) || value2 < 0) || key === "amount" && effect.name === "alphaMod" && value2 < 0 || ["saturation", "luminance", "amount"].includes(key) && effect.name !== "alphaMod" && (value2 < (effect.name === "alphaRepl" ? 0 : -1) || value2 > 1))
11124
+ throw new RangeError("Invalid picture effect values");
11125
+ }
11126
+ const count2 = effect.colors?.length ?? 0;
11127
+ if (["duotone", "clrChange"].includes(effect.name) && count2 !== 2 || effect.name === "clrRepl" && count2 !== 1 || effect.name === "alphaInv" && count2 > 1)
11128
+ throw new RangeError("Invalid picture effect colours");
11129
+ for (const [key, attribute2] of Object.entries(attrs2[effect.name] ?? {})) {
11130
+ const value2 = effect.values?.[key];
11131
+ if (value2 === before?.values?.[key]) continue;
11132
+ if (value2 === void 0) node2.removeAttribute(attribute2);
11133
+ else
11134
+ node2.setAttribute(
11135
+ attribute2,
11136
+ String(Math.round(value2 * (key === "hue" ? 6e4 : key === "radiusEmu" ? 1 : 1e5)))
11137
+ );
11138
+ }
11139
+ if (effect.name === "alphaMod" && effect.values?.amount !== before?.values?.amount) {
11140
+ const cont = first(node2, "cont", NS.a) ?? doc.createElementNS(NS.a, "a:cont");
11141
+ const fix = first(cont, "alphaModFix", NS.a) ?? doc.createElementNS(NS.a, "a:alphaModFix");
11142
+ fix.setAttribute("amt", String(Math.round((effect.values?.amount ?? 1) * 1e5)));
11143
+ if (!fix.parentNode) cont.appendChild(fix);
11144
+ if (!cont.parentNode) node2.appendChild(cont);
11145
+ }
11146
+ if (effect.useAlpha !== before?.useAlpha) {
11147
+ if (effect.useAlpha === void 0) node2.removeAttribute("useA");
11148
+ else node2.setAttribute("useA", effect.useAlpha ? "1" : "0");
11149
+ }
11150
+ if (effect.grow !== before?.grow) {
11151
+ if (effect.grow === void 0) node2.removeAttribute("grow");
11152
+ else node2.setAttribute("grow", effect.grow ? "1" : "0");
11153
+ }
11154
+ if (JSON.stringify(effect.colors) !== JSON.stringify(before?.colors)) {
11155
+ if (effect.name === "duotone") {
11156
+ const old = elements(node2).filter(
11157
+ (item2) => item2.namespaceURI === NS.a && /Clr$/.test(item2.localName)
11158
+ );
11159
+ for (let i2 = 0; i2 < (effect.colors?.length ?? 0); i2++) {
11160
+ const holder = doc.createElementNS(NS.a, "a:holder");
11161
+ if (old[i2]) holder.appendChild(doc.importNode(old[i2], true));
11162
+ patchDrawingColorIn(holder, effect.colors[i2]);
11163
+ const next = elements(holder)[0];
11164
+ if (old[i2]) node2.replaceChild(next, old[i2]);
11165
+ else node2.insertBefore(next, first(node2, "extLst", NS.a) ?? null);
11166
+ }
11167
+ } else if (effect.name === "clrChange") {
11168
+ for (const [i2, name] of ["clrFrom", "clrTo"].entries()) {
11169
+ const holder = first(node2, name, NS.a) ?? doc.createElementNS(NS.a, `a:${name}`);
11170
+ if (effect.colors?.[i2]) patchDrawingColorIn(holder, effect.colors[i2]);
11171
+ if (!holder.parentNode) node2.insertBefore(holder, first(node2, "extLst", NS.a) ?? null);
11172
+ }
11173
+ } else if (effect.colors?.[0]) patchDrawingColorIn(node2, effect.colors[0]);
10438
11174
  }
11175
+ if (!parseStandardPictureEffect(node2)) throw new RangeError("Invalid picture effect values");
10439
11176
  }
10440
11177
 
10441
11178
  // drawingml/picture-effects.ts
@@ -10475,14 +11212,19 @@ function readPictureEffect(name, attribute2) {
10475
11212
  function parsePictureEffects(blip) {
10476
11213
  if (!blip) return [];
10477
11214
  return elements(blip).map((node2) => ({
10478
- ...(node2.namespaceURI === NS.a ? readPictureEffect(node2.localName, (name) => node2.getAttribute(name)) : void 0) ?? { kind: "unsupported", name: node2.localName },
11215
+ ...(node2.namespaceURI === NS.a ? readPictureEffect(node2.localName, (name) => node2.getAttribute(name)) ?? parseStandardPictureEffect(node2) ?? parseArtisticPictureExtension(node2) : void 0) ?? { kind: "unsupported", name: node2.localName },
10479
11216
  sourceXml: buildXml(node2)
10480
11217
  }));
10481
11218
  }
10482
11219
  function applyPictureEffects(blip, effects) {
10483
11220
  if (JSON.stringify(parsePictureEffects(blip)) === JSON.stringify(effects)) return;
10484
11221
  const nodes = effects.map((effect) => {
10485
- const name = effect.kind === "grayscale" ? "grayscl" : effect.kind === "luminance" ? "lum" : effect.kind === "unsupported" ? effect.name : effect.kind;
11222
+ const name = effect.kind === "grayscale" ? "grayscl" : effect.kind === "luminance" ? "lum" : effect.kind === "unsupported" ? effect.name : effect.kind === "artistic" ? "extLst" : effect.kind === "standard" ? effect.name : effect.kind;
11223
+ if (effect.kind === "artistic") {
11224
+ const before = effect.sourceXml ? parseArtisticPictureExtension(parseXml(effect.sourceXml).documentElement) : void 0;
11225
+ if (!effect.baked || !before || before.name !== effect.name || before.radius !== effect.radius)
11226
+ throw new Error("Artistic authoring requires a host-generated baked picture cache");
11227
+ }
10486
11228
  const source3 = effect.sourceXml ? parseXml(effect.sourceXml).documentElement : void 0;
10487
11229
  if (effect.kind === "unsupported" && !source3)
10488
11230
  throw new Error("An unsupported picture effect needs source XML");
@@ -10509,12 +11251,157 @@ function applyPictureEffects(blip, effects) {
10509
11251
  if (effect.amount < 0) throw new RangeError("Picture alpha must be nonnegative");
10510
11252
  set("amt", effect.amount);
10511
11253
  }
11254
+ if (effect.kind === "standard") applyStandardPictureEffect(node2, effect);
10512
11255
  return node2;
10513
11256
  });
10514
11257
  for (const node2 of elements(blip)) blip.removeChild(node2);
10515
11258
  for (const node2 of nodes) blip.appendChild(node2);
10516
11259
  }
10517
11260
 
11261
+ // drawingml/picture-layout.ts
11262
+ function parsePictureLayout(fill) {
11263
+ const out = {};
11264
+ const rot = fill.getAttribute("rotWithShape");
11265
+ if (rot !== null) out.rotWithShape = rot !== "0" && rot !== "false";
11266
+ const dpi = Number(fill.getAttribute("dpi"));
11267
+ if (fill.hasAttribute("dpi") && Number.isFinite(dpi) && dpi > 0) out.dpi = dpi;
11268
+ const tile = first(fill, "tile", NS.a);
11269
+ if (tile) {
11270
+ const value2 = {};
11271
+ for (const [key, attr3] of [
11272
+ ["scaleX", "sx"],
11273
+ ["scaleY", "sy"]
11274
+ ]) {
11275
+ const n = picturePercentage(tile.getAttribute(attr3));
11276
+ if (n !== void 0) value2[key] = n;
11277
+ }
11278
+ for (const [key, attr3] of [
11279
+ ["offsetXEmu", "tx"],
11280
+ ["offsetYEmu", "ty"]
11281
+ ]) {
11282
+ const raw2 = tile.getAttribute(attr3);
11283
+ const n = raw2 === null ? NaN : Number(raw2);
11284
+ if (Number.isSafeInteger(n)) value2[key] = n;
11285
+ }
11286
+ const alignment = tile.getAttribute("algn");
11287
+ if (alignment) value2.alignment = alignment;
11288
+ const flip = tile.getAttribute("flip");
11289
+ if (flip && ["none", "x", "y", "xy"].includes(flip))
11290
+ value2.flip = flip;
11291
+ out.tile = value2;
11292
+ }
11293
+ const rect2 = first(first(fill, "stretch", NS.a), "fillRect", NS.a);
11294
+ if (rect2)
11295
+ out.fillRect = {
11296
+ l: picturePercentage(rect2.getAttribute("l")) ?? 0,
11297
+ t: picturePercentage(rect2.getAttribute("t")) ?? 0,
11298
+ r: picturePercentage(rect2.getAttribute("r")) ?? 0,
11299
+ b: picturePercentage(rect2.getAttribute("b")) ?? 0
11300
+ };
11301
+ return out;
11302
+ }
11303
+ function applyPictureLayout(fill, layout3) {
11304
+ const before = parsePictureLayout(fill);
11305
+ const attr3 = (node2, name, value2, old) => {
11306
+ if (value2 === old) return;
11307
+ if (value2 === void 0) node2.removeAttribute(name);
11308
+ else node2.setAttribute(name, String(value2));
11309
+ };
11310
+ if (layout3.rotWithShape !== before.rotWithShape)
11311
+ attr3(
11312
+ fill,
11313
+ "rotWithShape",
11314
+ layout3.rotWithShape === void 0 ? void 0 : layout3.rotWithShape ? "1" : "0",
11315
+ void 0
11316
+ );
11317
+ if (layout3.dpi !== before.dpi) {
11318
+ if (layout3.dpi !== void 0 && (!Number.isSafeInteger(layout3.dpi) || layout3.dpi <= 0))
11319
+ throw new RangeError("Invalid picture DPI");
11320
+ attr3(fill, "dpi", layout3.dpi, void 0);
11321
+ }
11322
+ const make2 = (parent, name) => {
11323
+ const old = first(parent, name, NS.a);
11324
+ if (old) return old;
11325
+ const node2 = fill.ownerDocument.createElementNS(NS.a, `a:${name}`);
11326
+ parent.insertBefore(node2, first(parent, "extLst", NS.a) ?? null);
11327
+ return node2;
11328
+ };
11329
+ if (layout3.tile) {
11330
+ const stretch = first(fill, "stretch", NS.a);
11331
+ if (stretch) fill.removeChild(stretch);
11332
+ const tile = make2(fill, "tile");
11333
+ for (const [key, name] of [
11334
+ ["scaleX", "sx"],
11335
+ ["scaleY", "sy"],
11336
+ ["offsetXEmu", "tx"],
11337
+ ["offsetYEmu", "ty"]
11338
+ ]) {
11339
+ const n = layout3.tile[key];
11340
+ if (n !== void 0 && (!Number.isFinite(n) || (name === "sx" || name === "sy" ? n <= 0 : !Number.isSafeInteger(n))))
11341
+ throw new RangeError("Invalid picture tile");
11342
+ if (n !== before.tile?.[key])
11343
+ attr3(
11344
+ tile,
11345
+ name,
11346
+ n === void 0 ? void 0 : Math.round(n * (name === "sx" || name === "sy" ? 1e5 : 1)),
11347
+ void 0
11348
+ );
11349
+ }
11350
+ if (layout3.tile.alignment !== before.tile?.alignment) {
11351
+ if (layout3.tile.alignment && !["tl", "t", "tr", "l", "ctr", "r", "bl", "b", "br"].includes(layout3.tile.alignment))
11352
+ throw new RangeError("Invalid picture tile alignment");
11353
+ attr3(tile, "algn", layout3.tile.alignment, void 0);
11354
+ }
11355
+ if (layout3.tile.flip !== void 0 && !["none", "x", "y", "xy"].includes(layout3.tile.flip))
11356
+ throw new RangeError("Invalid picture tile flip");
11357
+ if (layout3.tile.flip !== before.tile?.flip) attr3(tile, "flip", layout3.tile.flip, void 0);
11358
+ } else if (before.tile || layout3.fillRect) {
11359
+ const tile = first(fill, "tile", NS.a);
11360
+ if (tile) fill.removeChild(tile);
11361
+ const rect2 = make2(make2(fill, "stretch"), "fillRect");
11362
+ for (const key of ["l", "t", "r", "b"]) {
11363
+ const n = layout3.fillRect?.[key];
11364
+ if (n !== void 0 && !Number.isFinite(n))
11365
+ throw new RangeError("Invalid picture fill rectangle");
11366
+ if (n !== before.fillRect?.[key])
11367
+ attr3(rect2, key, n === void 0 ? void 0 : Math.round(n * 1e5), void 0);
11368
+ }
11369
+ }
11370
+ }
11371
+
11372
+ // drawingml/picture-crop.ts
11373
+ var SIDES = { l: "cropLeft", t: "cropTop", r: "cropRight", b: "cropBottom" };
11374
+ function parsePictureCrop(blipFill) {
11375
+ const rect2 = first(blipFill, "srcRect", NS.a);
11376
+ if (!rect2) return void 0;
11377
+ const result2 = {};
11378
+ for (const [attr3, key] of Object.entries(SIDES)) {
11379
+ const raw2 = rect2.getAttribute(attr3);
11380
+ if (raw2 === null || !raw2.trim()) continue;
11381
+ const percent = raw2.endsWith("%");
11382
+ const value2 = Number(percent ? raw2.slice(0, -1) : raw2) / (percent ? 100 : 1e5);
11383
+ if (Number.isFinite(value2)) result2[key] = value2;
11384
+ }
11385
+ return result2;
11386
+ }
11387
+ function applyPictureCrop(blipFill, crop) {
11388
+ let rect2 = first(blipFill, "srcRect", NS.a);
11389
+ if (!rect2 && crop && Object.values(crop).some((value2) => value2 !== void 0)) {
11390
+ rect2 = blipFill.ownerDocument.createElementNS(NS.a, "a:srcRect");
11391
+ const blip = first(blipFill, "blip", NS.a);
11392
+ blipFill.insertBefore(rect2, blip?.nextSibling ?? blipFill.firstChild);
11393
+ }
11394
+ if (!rect2) return;
11395
+ for (const [attr3, key] of Object.entries(SIDES)) {
11396
+ const value2 = crop?.[key];
11397
+ if (value2 === void 0) rect2.removeAttribute(attr3);
11398
+ else {
11399
+ if (!Number.isFinite(value2)) throw new RangeError("Picture crop must be finite");
11400
+ rect2.setAttribute(attr3, String(Math.round(value2 * 1e5)));
11401
+ }
11402
+ }
11403
+ }
11404
+
10518
11405
  // drawingml/picture-fill.ts
10519
11406
  function parseDrawingPictureFill(fill) {
10520
11407
  const blip = first(fill, "blip", NS.a);
@@ -10522,13 +11409,32 @@ function parseDrawingPictureFill(fill) {
10522
11409
  const linkRelId = blip?.getAttributeNS(NS.r, "link") || void 0;
10523
11410
  const crop = parsePictureCrop(fill);
10524
11411
  const effects = parsePictureEffects(blip);
10525
- const tile = first(fill, "tile", NS.a);
10526
- const rect2 = first(first(fill, "stretch", NS.a), "fillRect", NS.a);
10527
- const unsupported2 = [
10528
- ...tile ? ["tile"] : [],
10529
- ...rect2 && ["l", "t", "r", "b"].some((key) => Number(rect2.getAttribute(key) ?? 0) !== 0) ? ["fillRect"] : [],
10530
- ...fill.getAttribute("rotWithShape") === "0" || fill.getAttribute("rotWithShape") === "false" ? ["rotWithShape"] : []
10531
- ];
11412
+ const layout3 = parsePictureLayout(fill);
11413
+ const unsupported2 = [];
11414
+ const tile = first(fill, "tile", NS.a), stretch = first(fill, "stretch", NS.a);
11415
+ if (tile && stretch) unsupported2.push("tile/stretch-choice");
11416
+ if (tile) {
11417
+ for (const [attr3, key] of [
11418
+ ["sx", "scaleX"],
11419
+ ["sy", "scaleY"],
11420
+ ["tx", "offsetXEmu"],
11421
+ ["ty", "offsetYEmu"]
11422
+ ])
11423
+ if (tile.hasAttribute(attr3) && (layout3.tile?.[key] === void 0 || (attr3 === "sx" || attr3 === "sy") && layout3.tile[key] <= 0))
11424
+ unsupported2.push(`tile:${attr3}`);
11425
+ if (tile.hasAttribute("algn") && !["tl", "t", "tr", "l", "ctr", "r", "bl", "b", "br"].includes(tile.getAttribute("algn") ?? ""))
11426
+ unsupported2.push("tile:algn");
11427
+ if (tile.hasAttribute("flip") && !layout3.tile?.flip) unsupported2.push("tile:flip");
11428
+ }
11429
+ const rect2 = first(stretch, "fillRect", NS.a);
11430
+ if (rect2)
11431
+ for (const key of ["l", "t", "r", "b"]) {
11432
+ const raw2 = rect2.getAttribute(key);
11433
+ if (raw2 !== null && !/^[-+]?(?:\d+\.?\d*|\.\d+)%?$/.test(raw2))
11434
+ unsupported2.push(`fillRect:${key}`);
11435
+ }
11436
+ if (fill.hasAttribute("rotWithShape") && !["0", "1", "true", "false"].includes(fill.getAttribute("rotWithShape") ?? ""))
11437
+ unsupported2.push("rotWithShape");
10532
11438
  return {
10533
11439
  kind: "picture",
10534
11440
  sourceXml: buildXml(fill),
@@ -10536,6 +11442,7 @@ function parseDrawingPictureFill(fill) {
10536
11442
  ...linkRelId ? { linkRelId } : {},
10537
11443
  ...crop ? { crop } : {},
10538
11444
  ...effects.length ? { effects } : {},
11445
+ ...Object.keys(layout3).length ? { layout: layout3 } : {},
10539
11446
  ...unsupported2.length ? { unsupportedPicture: unsupported2 } : {}
10540
11447
  };
10541
11448
  }
@@ -10667,80 +11574,6 @@ function drawingDashLength(value2) {
10667
11574
  return Number.isSafeInteger(number2) && number2 <= 2147483647 ? number2 : void 0;
10668
11575
  }
10669
11576
 
10670
- // drawingml/write-color.ts
10671
- var ELEMENTS = {
10672
- srgb: "srgbClr",
10673
- scheme: "schemeClr",
10674
- system: "sysClr",
10675
- preset: "prstClr",
10676
- scrgb: "scrgbClr",
10677
- hsl: "hslClr"
10678
- };
10679
- function drawingColorXml(color) {
10680
- const local = ELEMENTS[color.kind];
10681
- const doc = parseXml(`<a:${local} xmlns:a="${NS.a}"/>`);
10682
- const root = doc.documentElement;
10683
- if (color.kind === "scrgb" || color.kind === "hsl") {
10684
- const keys = color.kind === "scrgb" ? ["r", "g", "b"] : ["hue", "sat", "lum"];
10685
- const values2 = color.value.split(",");
10686
- keys.forEach((key, i2) => root.setAttribute(key, values2[i2] ?? "0"));
10687
- } else root.setAttribute("val", color.value);
10688
- if (color.fallback !== void 0 && color.kind === "system")
10689
- root.setAttribute("lastClr", color.fallback);
10690
- for (const transform6 of color.transforms) {
10691
- if (!/^[A-Za-z_][\w.-]*$/.test(transform6.name))
10692
- throw new Error(`Invalid DrawingML transform ${transform6.name}`);
10693
- const node2 = doc.createElementNS(NS.a, `a:${transform6.name}`);
10694
- if (transform6.value !== "") node2.setAttribute("val", transform6.value);
10695
- root.appendChild(node2);
10696
- }
10697
- return buildXml(doc);
10698
- }
10699
-
10700
- // drawingml/patch-color.ts
10701
- function patchDrawingColorIn(container2, color) {
10702
- const old = elements(container2).find((node2) => parseDrawingColor(node2));
10703
- const before = parseDrawingColorIn(container2);
10704
- if (!old || !before || before.kind !== color.kind) {
10705
- const next = container2.ownerDocument.importNode(
10706
- parseXml(drawingColorXml(color)).documentElement,
10707
- true
10708
- );
10709
- if (old) container2.replaceChild(next, old);
10710
- else container2.insertBefore(next, container2.firstChild);
10711
- return;
10712
- }
10713
- if (before.value !== color.value) {
10714
- if (color.kind === "scrgb" || color.kind === "hsl") {
10715
- const keys = color.kind === "scrgb" ? ["r", "g", "b"] : ["hue", "sat", "lum"];
10716
- const values2 = color.value.split(",");
10717
- keys.forEach((key, index3) => old.setAttribute(key, values2[index3] ?? "0"));
10718
- } else old.setAttribute("val", color.value);
10719
- }
10720
- if (before.fallback !== color.fallback && color.kind === "system") {
10721
- if (color.fallback === void 0) old.removeAttribute("lastClr");
10722
- else old.setAttribute("lastClr", color.fallback);
10723
- }
10724
- const originals = elements(old);
10725
- color.transforms.forEach((transform6, index3) => {
10726
- const source3 = originals[index3];
10727
- if (source3?.localName === transform6.name) {
10728
- if (before.transforms[index3]?.value !== transform6.value) {
10729
- if (transform6.value === "") source3.removeAttribute("val");
10730
- else source3.setAttribute("val", transform6.value);
10731
- }
10732
- return;
10733
- }
10734
- if (!/^[A-Za-z_][\w.-]*$/u.test(transform6.name))
10735
- throw new Error("Invalid DrawingML colour transform");
10736
- const next = old.ownerDocument.createElementNS(NS.a, `a:${transform6.name}`);
10737
- if (transform6.value !== "") next.setAttribute("val", transform6.value);
10738
- if (source3) old.replaceChild(next, source3);
10739
- else old.appendChild(next);
10740
- });
10741
- for (const extra of originals.slice(color.transforms.length)) old.removeChild(extra);
10742
- }
10743
-
10744
11577
  // drawingml/write-pattern-picture.ts
10745
11578
  function drawingPatternPictureXml(fill) {
10746
11579
  const name = fill.kind === "pattern" ? "pattFill" : "blipFill";
@@ -10802,7 +11635,8 @@ function drawingPatternPictureXml(fill) {
10802
11635
  applyPictureCrop(root, fill.crop);
10803
11636
  if (fill.effects !== void 0 && JSON.stringify(before?.kind === "picture" ? before.effects ?? [] : []) !== JSON.stringify(fill.effects ?? []))
10804
11637
  applyPictureEffects(blip, fill.effects ?? []);
10805
- if (!fill.sourceXml) {
11638
+ if (fill.layout !== void 0) applyPictureLayout(root, fill.layout);
11639
+ if (!fill.sourceXml && !fill.layout?.tile && !first(root, "stretch", NS.a)) {
10806
11640
  const stretch = doc.createElementNS(NS.a, "a:stretch");
10807
11641
  stretch.appendChild(doc.createElementNS(NS.a, "a:fillRect"));
10808
11642
  root.appendChild(stretch);
@@ -10930,11 +11764,11 @@ function dropDrawingDeclarations(node2) {
10930
11764
  for (const child6 of elements(node2)) dropDrawingDeclarations(child6);
10931
11765
  }
10932
11766
  function insert(host, child6) {
10933
- const rank3 = ORDER.indexOf(child6.localName);
11767
+ const rank4 = ORDER.indexOf(child6.localName);
10934
11768
  host.insertBefore(
10935
11769
  child6,
10936
11770
  elements(host).find(
10937
- (node2) => node2.namespaceURI === NS.a && ORDER.indexOf(node2.localName) > rank3
11771
+ (node2) => node2.namespaceURI === NS.a && ORDER.indexOf(node2.localName) > rank4
10938
11772
  ) ?? null
10939
11773
  );
10940
11774
  }
@@ -11396,8 +12230,8 @@ function readPrintOptions(node2) {
11396
12230
  }
11397
12231
  function printOptionsXml(options) {
11398
12232
  if (!options) return "";
11399
- const attrs2 = KEYS.filter((key) => options[key]).map((key) => ` ${key}="1"`);
11400
- return attrs2.length ? `<printOptions${attrs2.join("")}/>` : "";
12233
+ const attrs3 = KEYS.filter((key) => options[key]).map((key) => ` ${key}="1"`);
12234
+ return attrs3.length ? `<printOptions${attrs3.join("")}/>` : "";
11401
12235
  }
11402
12236
 
11403
12237
  // xlsx/read/password-hash.ts
@@ -11423,6 +12257,89 @@ function readModernHash(node2, prefix = "") {
11423
12257
  return hash2;
11424
12258
  }
11425
12259
 
12260
+ // xlsx/read/filter-columns.ts
12261
+ var MAIN_NS_DECL = /(?<=^<[^>]*) xmlns="http:\/\/schemas\.openxmlformats\.org\/spreadsheetml\/2006\/main"/;
12262
+ var OPERATORS2 = /* @__PURE__ */ new Set([
12263
+ "equal",
12264
+ "lessThan",
12265
+ "lessThanOrEqual",
12266
+ "notEqual",
12267
+ "greaterThanOrEqual",
12268
+ "greaterThan"
12269
+ ]);
12270
+ var LEVELS = /* @__PURE__ */ new Set(["year", "month", "day", "hour", "minute", "second"]);
12271
+ function readDateGroup(node2) {
12272
+ const grouping = att(node2, "dateTimeGrouping");
12273
+ const year = numAttr(node2, "year");
12274
+ if (year === void 0 || !grouping || !LEVELS.has(grouping)) return void 0;
12275
+ const item2 = { year, grouping };
12276
+ for (const key of ["month", "day", "hour", "minute", "second"]) {
12277
+ const value2 = numAttr(node2, key);
12278
+ if (value2 !== void 0) item2[key] = value2;
12279
+ }
12280
+ return item2;
12281
+ }
12282
+ function readFilterColumn(column2, dxfs) {
12283
+ const entry3 = { offset: numAttr(column2, "colId") ?? 0 };
12284
+ const filters = xFirst(column2, "filters");
12285
+ if (filters) {
12286
+ entry3.values = xChildren(filters, "filter").map((f6) => att(f6, "val") ?? "");
12287
+ if (boolAttr(filters, "blank")) entry3.blank = true;
12288
+ const groups = xChildren(filters, "dateGroupItem").map(readDateGroup).filter((g2) => g2 !== void 0);
12289
+ if (groups.length) entry3.dateGroups = groups;
12290
+ }
12291
+ const custom = xFirst(column2, "customFilters");
12292
+ if (custom) {
12293
+ const conditions = xChildren(custom, "customFilter").map((c2) => {
12294
+ const op2 = att(c2, "operator") ?? "equal";
12295
+ return {
12296
+ operator: OPERATORS2.has(op2) ? op2 : "equal",
12297
+ value: att(c2, "val") ?? ""
12298
+ };
12299
+ });
12300
+ entry3.custom = { ...boolAttr(custom, "and") ? { and: true } : {}, conditions };
12301
+ }
12302
+ const top = xFirst(column2, "top10");
12303
+ if (top) {
12304
+ const filterValue = numAttr(top, "filterVal");
12305
+ entry3.top10 = {
12306
+ top: boolAttr(top, "top", true),
12307
+ percent: boolAttr(top, "percent", false),
12308
+ value: numAttr(top, "val") ?? 10,
12309
+ ...filterValue !== void 0 ? { filterValue } : {}
12310
+ };
12311
+ }
12312
+ const dynamic = xFirst(column2, "dynamicFilter");
12313
+ if (dynamic) {
12314
+ const value2 = numAttr(dynamic, "val");
12315
+ const maxValue = numAttr(dynamic, "maxVal");
12316
+ entry3.dynamic = {
12317
+ type: att(dynamic, "type") ?? "null",
12318
+ ...value2 !== void 0 ? { value: value2 } : {},
12319
+ ...maxValue !== void 0 ? { maxValue } : {}
12320
+ };
12321
+ }
12322
+ const color = xFirst(column2, "colorFilter");
12323
+ if (color) {
12324
+ const dxfId = numAttr(color, "dxfId");
12325
+ const style2 = dxfId === void 0 ? void 0 : dxfs?.[dxfId];
12326
+ entry3.color = {
12327
+ cellColor: boolAttr(color, "cellColor", true),
12328
+ ...dxfId !== void 0 ? { dxfId } : {},
12329
+ ...style2 ? { style: structuredClone(style2) } : {}
12330
+ };
12331
+ }
12332
+ const icon = xFirst(column2, "iconFilter");
12333
+ const iconSet = att(icon, "iconSet");
12334
+ if (iconSet) {
12335
+ const iconId = numAttr(icon, "iconId");
12336
+ entry3.icon = { iconSet, ...iconId !== void 0 ? { iconId } : {} };
12337
+ }
12338
+ if (boolAttr(column2, "hiddenButton")) entry3.hiddenButton = true;
12339
+ entry3.sourceXml = outerXml(column2).replace(MAIN_NS_DECL, "");
12340
+ return entry3;
12341
+ }
12342
+
11426
12343
  // xlsx/read/sheet-props.ts
11427
12344
  var defaultSheetView = () => ({
11428
12345
  showGridLines: true,
@@ -11512,24 +12429,11 @@ function readColumns(cols, xfMap) {
11512
12429
  }
11513
12430
  return out;
11514
12431
  }
11515
- var MAIN_NS_DECL = /(?<=^<[^>]*) xmlns="http:\/\/schemas\.openxmlformats\.org\/spreadsheetml\/2006\/main"/;
11516
- function readAutoFilter(node2) {
12432
+ function readAutoFilter(node2, dxfs) {
11517
12433
  const range = parseRange(att(node2, "ref") ?? "");
11518
12434
  if (!node2 || !range) return void 0;
11519
12435
  const filter2 = { range };
11520
- const columns = [];
11521
- for (const column2 of xChildren(node2, "filterColumn")) {
11522
- const entry3 = {
11523
- offset: numAttr(column2, "colId") ?? 0
11524
- };
11525
- const filters = xFirst(column2, "filters");
11526
- if (filters) {
11527
- entry3.values = xChildren(filters, "filter").map((f6) => att(f6, "val") ?? "");
11528
- if (boolAttr(filters, "blank")) entry3.blank = true;
11529
- }
11530
- entry3.sourceXml = outerXml(column2).replace(MAIN_NS_DECL, "");
11531
- columns.push(entry3);
11532
- }
12436
+ const columns = xChildren(node2, "filterColumn").map((column2) => readFilterColumn(column2, dxfs));
11533
12437
  if (columns.length) filter2.columns = columns;
11534
12438
  return filter2;
11535
12439
  }
@@ -11639,17 +12543,17 @@ function readCustomWorkbookViews(node2) {
11639
12543
  return xChildren(node2, "customWorkbookView").flatMap((view) => {
11640
12544
  const guid2 = att(view, "guid");
11641
12545
  if (!guid2) return [];
11642
- const attrs2 = {};
12546
+ const attrs3 = {};
11643
12547
  for (const attribute2 of Array.from(view.attributes))
11644
12548
  if (!WORKBOOK_VIEW_KNOWN.includes(attribute2.name) && !attribute2.name.startsWith("xmlns"))
11645
- attrs2[attribute2.name] = attribute2.value;
12549
+ attrs3[attribute2.name] = attribute2.value;
11646
12550
  return [
11647
12551
  {
11648
12552
  guid: guid2,
11649
12553
  name: att(view, "name") ?? "",
11650
12554
  includePrintSettings: boolAttr(view, "includePrintSettings", true),
11651
12555
  includeHiddenRowCol: boolAttr(view, "includeHiddenRowCol", true),
11652
- attrs: attrs2
12556
+ attrs: attrs3
11653
12557
  }
11654
12558
  ];
11655
12559
  });
@@ -11687,10 +12591,10 @@ function readCustomSheetViews(node2) {
11687
12591
  );
11688
12592
  const printOptions = readPrintOptions(child6("printOptions"));
11689
12593
  const filter2 = readAutoFilter(child6("autoFilter"));
11690
- const attrs2 = {};
12594
+ const attrs3 = {};
11691
12595
  for (const attribute2 of Array.from(view.attributes))
11692
12596
  if (!SHEET_VIEW_ATTRS.includes(attribute2.name) && !attribute2.name.startsWith("xmlns"))
11693
- attrs2[attribute2.name] = attribute2.value;
12597
+ attrs3[attribute2.name] = attribute2.value;
11694
12598
  const modelled = [
11695
12599
  "pane",
11696
12600
  "selection",
@@ -11710,7 +12614,7 @@ function readCustomSheetViews(node2) {
11710
12614
  ...boolAttr(view, "showAutoFilter", false) ? { showAutoFilter: true } : {},
11711
12615
  ...pageSetup ? { pageSetup } : {},
11712
12616
  ...printOptions ? { printOptions } : {},
11713
- attrs: attrs2,
12617
+ attrs: attrs3,
11714
12618
  extra: elements(view).filter((c2) => !modelled.includes(c2.localName ?? "")).map((c2) => outerXml(c2))
11715
12619
  }
11716
12620
  ];
@@ -12292,7 +13196,7 @@ function isSpace3(ch) {
12292
13196
  return ch === " " || ch === " " || ch === "\n" || ch === "\r";
12293
13197
  }
12294
13198
  function parseAttributes(source3) {
12295
- const attrs2 = {};
13199
+ const attrs3 = {};
12296
13200
  let i2 = 0;
12297
13201
  const n = source3.length;
12298
13202
  while (i2 < n) {
@@ -12327,9 +13231,9 @@ function parseAttributes(source3) {
12327
13231
  if (name === "xmlns" || name.startsWith("xmlns:")) {
12328
13232
  continue;
12329
13233
  }
12330
- attrs2[localName(name)] = decodeEntities(value2);
13234
+ attrs3[localName(name)] = decodeEntities(value2);
12331
13235
  }
12332
- return attrs2;
13236
+ return attrs3;
12333
13237
  }
12334
13238
  function tagEnd2(xml, from) {
12335
13239
  let quote2 = "";
@@ -12455,14 +13359,14 @@ function numOrNaN(value2) {
12455
13359
  function relation(value2) {
12456
13360
  return value2 === "ch" || value2 === "des" ? value2 : "self";
12457
13361
  }
12458
- function parseIterator(attrs2) {
13362
+ function parseIterator(attrs3) {
12459
13363
  return {
12460
- axis: list(attrs2.axis),
12461
- ptType: list(attrs2.ptType),
12462
- hideLastTrans: list(attrs2.hideLastTrans).map((v) => v === "1" || v === "true"),
12463
- st: numberList(attrs2.st),
12464
- cnt: numberList(attrs2.cnt),
12465
- step: numberList(attrs2.step)
13364
+ axis: list(attrs3.axis),
13365
+ ptType: list(attrs3.ptType),
13366
+ hideLastTrans: list(attrs3.hideLastTrans).map((v) => v === "1" || v === "true"),
13367
+ st: numberList(attrs3.st),
13368
+ cnt: numberList(attrs3.cnt),
13369
+ step: numberList(attrs3.step)
12466
13370
  };
12467
13371
  }
12468
13372
  function parseAlgorithm(element3) {
@@ -12493,41 +13397,41 @@ function parseShape(element3) {
12493
13397
  adj
12494
13398
  };
12495
13399
  }
12496
- function parseConstraint(attrs2) {
12497
- const op2 = attrs2.op;
13400
+ function parseConstraint(attrs3) {
13401
+ const op2 = attrs3.op;
12498
13402
  return {
12499
- type: attrs2.type ?? "none",
12500
- for: relation(attrs2.for),
12501
- forName: attrs2.forName || void 0,
12502
- ptType: attrs2.ptType ?? "all",
12503
- refType: attrs2.refType ?? "none",
12504
- refFor: relation(attrs2.refFor),
12505
- refForName: attrs2.refForName || void 0,
12506
- refPtType: attrs2.refPtType ?? "all",
13403
+ type: attrs3.type ?? "none",
13404
+ for: relation(attrs3.for),
13405
+ forName: attrs3.forName || void 0,
13406
+ ptType: attrs3.ptType ?? "all",
13407
+ refType: attrs3.refType ?? "none",
13408
+ refFor: relation(attrs3.refFor),
13409
+ refForName: attrs3.refForName || void 0,
13410
+ refPtType: attrs3.refPtType ?? "all",
12507
13411
  op: op2 === "equ" || op2 === "gte" || op2 === "lte" ? op2 : "none",
12508
- val: num2(attrs2.val, 0),
12509
- hasVal: attrs2.val !== void 0,
12510
- fact: num2(attrs2.fact, 1)
13412
+ val: num2(attrs3.val, 0),
13413
+ hasVal: attrs3.val !== void 0,
13414
+ fact: num2(attrs3.fact, 1)
12511
13415
  };
12512
13416
  }
12513
- function parseRule(attrs2) {
13417
+ function parseRule(attrs3) {
12514
13418
  return {
12515
- type: attrs2.type ?? "none",
12516
- for: relation(attrs2.for),
12517
- forName: attrs2.forName || void 0,
12518
- ptType: attrs2.ptType ?? "all",
12519
- val: numOrNaN(attrs2.val),
12520
- fact: numOrNaN(attrs2.fact),
12521
- max: numOrNaN(attrs2.max)
13419
+ type: attrs3.type ?? "none",
13420
+ for: relation(attrs3.for),
13421
+ forName: attrs3.forName || void 0,
13422
+ ptType: attrs3.ptType ?? "all",
13423
+ val: numOrNaN(attrs3.val),
13424
+ fact: numOrNaN(attrs3.fact),
13425
+ max: numOrNaN(attrs3.max)
12522
13426
  };
12523
13427
  }
12524
- function parseCondition(attrs2) {
13428
+ function parseCondition(attrs3) {
12525
13429
  return {
12526
- ...parseIterator(attrs2),
12527
- func: attrs2.func ?? "cnt",
12528
- arg: attrs2.arg,
12529
- op: attrs2.op ?? "equ",
12530
- val: attrs2.val ?? ""
13430
+ ...parseIterator(attrs3),
13431
+ func: attrs3.func ?? "cnt",
13432
+ arg: attrs3.arg,
13433
+ op: attrs3.op ?? "equ",
13434
+ val: attrs3.val ?? ""
12531
13435
  };
12532
13436
  }
12533
13437
  function parseBody(element3, state) {
@@ -24046,12 +24950,12 @@ function functionValue(condition, point, lookup2) {
24046
24950
  return void 0;
24047
24951
  }
24048
24952
  }
24049
- function compare(left2, op2, rightRaw) {
24953
+ function compare2(left2, op2, rightRaw) {
24050
24954
  const leftNumber = typeof left2 === "number" ? left2 : Number(left2);
24051
24955
  const rightNumber = Number(rightRaw);
24052
- const numeric2 = !Number.isNaN(leftNumber) && !Number.isNaN(rightNumber) && rightRaw !== "";
24053
- const a2 = numeric2 ? leftNumber : String(left2);
24054
- const b = numeric2 ? rightNumber : rightRaw;
24956
+ const numeric3 = !Number.isNaN(leftNumber) && !Number.isNaN(rightNumber) && rightRaw !== "";
24957
+ const a2 = numeric3 ? leftNumber : String(left2);
24958
+ const b = numeric3 ? rightNumber : rightRaw;
24055
24959
  switch (op2) {
24056
24960
  case "equ":
24057
24961
  return a2 === b;
@@ -24084,7 +24988,7 @@ function evaluateCondition(condition, point, lookup2) {
24084
24988
  return false;
24085
24989
  }
24086
24990
  const expected = condition.func === "var" ? String(normaliseVariable(condition.val)) : condition.val;
24087
- return compare(normaliseVariable(value2), condition.op, expected);
24991
+ return compare2(normaliseVariable(value2), condition.op, expected);
24088
24992
  }
24089
24993
 
24090
24994
  // diagram/engine/pres-tree.ts
@@ -26043,7 +26947,13 @@ function buildRenderedNode(node2, index3, nodeById, palette, style2, mergedSourc
26043
26947
  fontSize: 0,
26044
26948
  textX: x + width / 2,
26045
26949
  textY: y + height / 2,
26046
- nodeId: primary?.id,
26950
+ // Picture roles often omit presOf: they present the current point's image, not its text.
26951
+ nodeId: primary?.id ?? (node2.shape?.blipPhldr ? node2.point.source?.id : void 0),
26952
+ picturePlaceholder: node2.shape?.blipPhldr,
26953
+ layoutRole: node2.name,
26954
+ contextNodeId: node2.point.source?.id,
26955
+ textAlign: ["l", "ctr", "r"].includes(node2.alg.params.parTxLTRAlign ?? "") ? node2.alg.params.parTxLTRAlign : void 0,
26956
+ textVerticalAnchor: ["t", "ctr", "b"].includes(node2.alg.params.txAnchorVert ?? "") ? node2.alg.params.txAnchorVert : void 0,
26047
26957
  rotation: transform6.rotation === 0 ? void 0 : transform6.rotation,
26048
26958
  presetOverride: node2.shape?.type ?? "roundRect",
26049
26959
  foldedNodeIds: foldedNodeIds.length > 0 ? foldedNodeIds : void 0,
@@ -27232,11 +28142,11 @@ function keptChildren(doc, xml) {
27232
28142
  }));
27233
28143
  }
27234
28144
  function appendInSchemaOrder(parent, order, entries) {
27235
- const rank3 = (name) => {
28145
+ const rank4 = (name) => {
27236
28146
  const index3 = order.indexOf(name);
27237
28147
  return index3 < 0 ? order.length : index3;
27238
28148
  };
27239
- entries.map((entry3, index3) => ({ entry: entry3, index: index3 })).sort((a2, b) => rank3(a2.entry.name) - rank3(b.entry.name) || a2.index - b.index).forEach(({ entry: entry3 }) => parent.appendChild(entry3.node));
28149
+ entries.map((entry3, index3) => ({ entry: entry3, index: index3 })).sort((a2, b) => rank4(a2.entry.name) - rank4(b.entry.name) || a2.index - b.index).forEach(({ entry: entry3 }) => parent.appendChild(entry3.node));
27240
28150
  }
27241
28151
  function setBoolean(element3, name, value2) {
27242
28152
  if (value2 !== void 0) element3.setAttribute(name, value2 ? "1" : "0");
@@ -28330,11 +29240,11 @@ function child3(node2, name) {
28330
29240
  if (existing) return existing;
28331
29241
  const result2 = node2.ownerDocument.createElementNS(NS.a, `a:${name}`);
28332
29242
  const order = node2.localName === "scene3d" ? ["camera", "lightRig", "backdrop", "extLst"] : node2.localName === "sp3d" ? ["bevelT", "bevelB", "extrusionClr", "contourClr", "extLst"] : node2.localName === "backdrop" ? ["anchor", "norm", "up", "extLst"] : ["rot", "extLst"];
28333
- const rank3 = order.indexOf(name);
29243
+ const rank4 = order.indexOf(name);
28334
29244
  node2.insertBefore(
28335
29245
  result2,
28336
29246
  elements(node2).find(
28337
- (item2) => item2.namespaceURI === NS.a && order.indexOf(item2.localName) > rank3
29247
+ (item2) => item2.namespaceURI === NS.a && order.indexOf(item2.localName) > rank4
28338
29248
  ) ?? null
28339
29249
  );
28340
29250
  return result2;
@@ -29428,6 +30338,203 @@ function approximateDiagramDrawingFromNodes(input) {
29428
30338
  });
29429
30339
  }
29430
30340
 
30341
+ // diagram/picture-layout.ts
30342
+ var DIAGRAM_PICTURE_SOURCE_NS = "urn:ooxml-core:diagram-picture-sources:1";
30343
+ function remapFill(fill, id) {
30344
+ if (!fill.sourceXml) return { ...fill, relId: id };
30345
+ const node2 = parseXml(fill.sourceXml).documentElement;
30346
+ const blip = first(node2, "blip", NS.a);
30347
+ if (blip) {
30348
+ blip.setAttributeNS(NS.r, "r:embed", id);
30349
+ blip.removeAttributeNS(NS.r, "link");
30350
+ }
30351
+ return { ...fill, relId: id, sourceXml: buildXml(node2) };
30352
+ }
30353
+ function captureDiagramPictures(model2, dataXml2, dataParts, drawing) {
30354
+ const pictures = [];
30355
+ const parts = { ...dataParts };
30356
+ const add3 = (source3, owner) => {
30357
+ const part = source3.fill.relId ? owner[source3.fill.relId] : void 0;
30358
+ if (!part) return;
30359
+ let id = Object.keys(parts).find((key) => parts[key] === part);
30360
+ if (!id) {
30361
+ let index3 = 1;
30362
+ while (Object.hasOwn(parts, `ooxmlDiagramPicture${index3}`)) index3++;
30363
+ id = `ooxmlDiagramPicture${index3}`;
30364
+ parts[id] = part;
30365
+ }
30366
+ const entry3 = { ...source3, fill: remapFill(source3.fill, id) };
30367
+ const existing = pictures.findIndex(
30368
+ (item2) => item2.nodeId === entry3.nodeId && (item2.role === entry3.role && item2.styleLabel === entry3.styleLabel || !item2.role && !item2.styleLabel && item2.fill.relId === entry3.fill.relId)
30369
+ );
30370
+ if (existing < 0) pictures.push(entry3);
30371
+ else pictures[existing] = entry3;
30372
+ };
30373
+ const root = parseXml(dataXml2).documentElement;
30374
+ const saved = root.getElementsByTagNameNS(DIAGRAM_PICTURE_SOURCE_NS, "picture");
30375
+ for (const element3 of saved) {
30376
+ const nodeId = element3.getAttribute("nodeId");
30377
+ const fill = first(element3, "blipFill", NS.a);
30378
+ if (nodeId && fill && model2.nodes.some((node2) => node2.modelId === nodeId))
30379
+ add3(
30380
+ {
30381
+ nodeId,
30382
+ fill: parseDrawingPictureFill(fill),
30383
+ ...element3.getAttribute("role") ? { role: element3.getAttribute("role") } : {},
30384
+ ...element3.getAttribute("styleLabel") ? { styleLabel: element3.getAttribute("styleLabel") } : {}
30385
+ },
30386
+ dataParts
30387
+ );
30388
+ }
30389
+ for (const point of model2.points) {
30390
+ if (point.fill?.kind !== "picture") continue;
30391
+ const nodeId = point.type === "pres" ? point.presAssocId : point.modelId;
30392
+ if (nodeId && model2.nodes.some((node2) => node2.modelId === nodeId) && !pictures.some((item2) => item2.nodeId === nodeId))
30393
+ add3(
30394
+ {
30395
+ nodeId,
30396
+ fill: point.fill,
30397
+ ...point.presName ? { role: point.presName } : {},
30398
+ ...point.presStyleLabel ? { styleLabel: point.presStyleLabel } : {}
30399
+ },
30400
+ dataParts
30401
+ );
30402
+ }
30403
+ for (const shape2 of drawing?.shapes ?? []) {
30404
+ if (shape2.fill?.kind !== "picture") continue;
30405
+ const point = model2.points.find((point2) => point2.modelId === shape2.modelId);
30406
+ const nodeId = shape2.sourceNodeId ?? (point?.type === "pres" ? point.presAssocId : point?.modelId);
30407
+ const part = shape2.fill.relId ? drawing?.pictureParts?.[shape2.fill.relId] : void 0;
30408
+ if (saved.length && pictures.some(
30409
+ (item2) => item2.nodeId === nodeId && item2.fill.relId && parts[item2.fill.relId] === part && item2.role !== point?.presName && item2.styleLabel !== point?.presStyleLabel
30410
+ ))
30411
+ continue;
30412
+ if (nodeId && model2.nodes.some((node2) => node2.modelId === nodeId))
30413
+ add3(
30414
+ {
30415
+ nodeId,
30416
+ fill: shape2.fill,
30417
+ ...point?.presName ? { role: point.presName } : {},
30418
+ ...point?.presStyleLabel ? { styleLabel: point.presStyleLabel } : {}
30419
+ },
30420
+ drawing?.pictureParts ?? {}
30421
+ );
30422
+ }
30423
+ return pictures.length ? { pictures, pictureParts: parts } : {};
30424
+ }
30425
+ function applyDiagramPictureSources(drawing, nodes, source3, issues, liveNodeIds) {
30426
+ if (!source3?.pictures?.length) return;
30427
+ if (source3.pictureParts) drawing.pictureParts = { ...source3.pictureParts };
30428
+ const used = /* @__PURE__ */ new Set();
30429
+ nodes.forEach((node2, index3) => {
30430
+ if (!node2.picturePlaceholder || !node2.nodeId) return;
30431
+ const shape2 = drawing.shapes[index3];
30432
+ if (!shape2) return;
30433
+ const candidates = source3.pictures.filter((picture2) => picture2.nodeId === node2.nodeId);
30434
+ const matching2 = candidates.filter(
30435
+ (picture2) => picture2.role === node2.layoutRole || !!picture2.styleLabel && picture2.styleLabel === node2.styleLabel
30436
+ );
30437
+ const picture = matching2.length === 1 ? matching2[0] : candidates.length === 1 ? candidates[0] : void 0;
30438
+ if (picture) {
30439
+ shape2.fill = structuredClone(picture.fill);
30440
+ delete shape2.text;
30441
+ delete shape2.body;
30442
+ used.add(picture);
30443
+ } else if (candidates.length)
30444
+ issues.push({
30445
+ code: "DIAGRAM_PICTURE_AMBIGUOUS",
30446
+ message: `Picture role ${node2.layoutRole ?? node2.key} has multiple source pictures; no arbitrary assignment was made.`
30447
+ });
30448
+ });
30449
+ if (source3.pictures.some(
30450
+ (picture) => (!liveNodeIds || liveNodeIds.has(picture.nodeId)) && !used.has(picture)
30451
+ ))
30452
+ issues.push({
30453
+ code: "DIAGRAM_PICTURE_LAYOUT_UNSUPPORTED",
30454
+ message: "Some retained pictures have no matching image placeholder in this layout. Their source associations are preserved for a compatible layout."
30455
+ });
30456
+ }
30457
+ function withDiagramPictureSources(dataXml2, source3) {
30458
+ if (!source3?.pictures?.length) return dataXml2;
30459
+ const doc = parseXml(dataXml2);
30460
+ const root = doc.documentElement;
30461
+ const points2 = first(root, "ptLst", NS.dgm);
30462
+ const live = children(points2 ?? root, "pt", NS.dgm).filter(
30463
+ (point) => !["doc", "pres", "parTrans", "sibTrans"].includes(point.getAttribute("type") ?? "node")
30464
+ );
30465
+ for (const element3 of [...root.getElementsByTagNameNS(DIAGRAM_PICTURE_SOURCE_NS, "pictures")]) {
30466
+ const extension2 = element3.parentNode;
30467
+ if (extension2?.parentNode) extension2.parentNode.removeChild(extension2);
30468
+ }
30469
+ const retained = source3.pictures.filter(
30470
+ (picture) => live.some((point) => point.getAttribute("modelId") === picture.nodeId)
30471
+ );
30472
+ if (!retained.length) return buildXml(doc);
30473
+ const list2 = first(root, "extLst", NS.dgm) ?? doc.createElementNS(NS.dgm, "dgm:extLst");
30474
+ if (!list2.parentNode) root.appendChild(list2);
30475
+ const extension = doc.createElementNS(NS.a, "a:ext");
30476
+ extension.setAttribute("uri", DIAGRAM_PICTURE_SOURCE_NS);
30477
+ const payload = doc.createElementNS(DIAGRAM_PICTURE_SOURCE_NS, "op:pictures");
30478
+ extension.appendChild(payload);
30479
+ list2.appendChild(extension);
30480
+ for (const picture of retained) {
30481
+ if (!picture.fill.sourceXml)
30482
+ throw new Error("A retained SmartArt picture needs source fill XML");
30483
+ const element3 = doc.createElementNS(DIAGRAM_PICTURE_SOURCE_NS, "op:picture");
30484
+ element3.setAttribute("nodeId", picture.nodeId);
30485
+ if (picture.role) element3.setAttribute("role", picture.role);
30486
+ if (picture.styleLabel) element3.setAttribute("styleLabel", picture.styleLabel);
30487
+ const fill = parseXml(picture.fill.sourceXml).documentElement;
30488
+ element3.appendChild(doc.importNode(fill, true));
30489
+ payload.appendChild(element3);
30490
+ const presentations = children(points2 ?? root, "pt", NS.dgm).filter((point) => {
30491
+ const props = first(point, "prSet", NS.dgm);
30492
+ return point.getAttribute("type") === "pres" && props?.getAttribute("presAssocID") === picture.nodeId && (picture.role && props.getAttribute("presName") === picture.role || picture.styleLabel && props.getAttribute("presStyleLbl") === picture.styleLabel);
30493
+ });
30494
+ if (presentations.length === 1) {
30495
+ const point = presentations[0];
30496
+ const props = first(point, "spPr", NS.dgm) ?? doc.createElementNS(NS.dgm, "dgm:spPr");
30497
+ if (!props.parentNode) point.appendChild(props);
30498
+ for (const old of [...props.childNodes].filter((node2) => node2.nodeType === 1).filter(
30499
+ (node2) => node2.namespaceURI === NS.a && ["blipFill", "solidFill", "gradFill", "pattFill", "noFill", "grpFill"].includes(
30500
+ node2.localName
30501
+ )
30502
+ ))
30503
+ props.removeChild(old);
30504
+ props.insertBefore(doc.importNode(fill, true), props.firstChild);
30505
+ }
30506
+ }
30507
+ return buildXml(doc);
30508
+ }
30509
+ function diagramPictureRelationships(owner, source3, existing) {
30510
+ if (!source3?.pictures?.length || !source3.pictureParts) return existing;
30511
+ const rels = parseRelationships(existing);
30512
+ for (const [id, part] of Object.entries(source3.pictureParts)) {
30513
+ const previous = rels.get(id);
30514
+ if (previous && (previous.mode === "External" || resolvePartPath(owner, previous.target) !== part))
30515
+ throw new Error(`Conflicting SmartArt picture relationship: ${id}`);
30516
+ rels.set(id, { id, type: RELATIONSHIP_TYPES.image, target: `/${part}`, mode: "Internal" });
30517
+ }
30518
+ return buildRelationshipsXml(rels);
30519
+ }
30520
+
30521
+ // diagram/layout-role-style.ts
30522
+ function applyDiagramRoleColors(shape2, role, index3, minorFont) {
30523
+ const at = (colors) => colors[index3 % colors.length];
30524
+ const fill = role && at(role.fill.colors);
30525
+ if (fill && shape2.fill?.kind !== "none" && shape2.fill?.kind !== "picture")
30526
+ shape2.fill = { kind: "solid", color: structuredClone(fill) };
30527
+ const line3 = role && at(role.line.colors);
30528
+ if (line3 && shape2.line) shape2.line.fill = { kind: "solid", color: structuredClone(line3) };
30529
+ const text = role && at(role.textFill.colors);
30530
+ for (const paragraph2 of shape2.text?.paragraphs ?? []) {
30531
+ for (const run2 of paragraph2.runs) {
30532
+ if (!run2.color && text) run2.color = structuredClone(text);
30533
+ if (!run2.typeface && minorFont) run2.typeface = minorFont;
30534
+ }
30535
+ }
30536
+ }
30537
+
29431
30538
  // diagram/layout-preview.ts
29432
30539
  function diagramLayoutData(input) {
29433
30540
  const original = input.source?.dataXml ? parseDiagramDataModel(input.source.dataXml) : void 0;
@@ -29573,6 +30680,8 @@ function previewDiagramLayout(input) {
29573
30680
  ];
29574
30681
  });
29575
30682
  const drawing2 = diagramDrawingFromViews(views);
30683
+ drawing2.extentEmu = { ...input.extentEmu };
30684
+ const colors = input.source?.colorsXml ? parseDiagramColors(input.source.colorsXml) : void 0;
29576
30685
  const quickStyle = input.source?.quickStyleXml ? parseDiagramQuickStyle(input.source.quickStyleXml) : void 0;
29577
30686
  const originalModel = input.source?.dataXml ? parseDiagramDataModel(input.source.dataXml) : void 0;
29578
30687
  result2.nodes.forEach((node2, index3) => {
@@ -29583,7 +30692,9 @@ function previewDiagramLayout(input) {
29583
30692
  shape2.style = label2;
29584
30693
  shape2.has3d = label2.requires3d ?? label2.hasShape3d;
29585
30694
  }
29586
- if (node2.nodeId) shape2.sourceNodeId = node2.nodeId;
30695
+ const contextNodeId = node2.nodeId ?? node2.contextNodeId;
30696
+ if (contextNodeId) shape2.sourceNodeId = contextNodeId;
30697
+ if (node2.layoutRole) shape2.sourceLayoutRole = node2.layoutRole;
29587
30698
  if (node2.styleLabel) shape2.sourceStyleLabel = node2.styleLabel;
29588
30699
  if (node2.foldedNodeIds?.length) shape2.foldedNodeIds = node2.foldedNodeIds;
29589
30700
  const sourceNode = data.nodes.find((entry3) => entry3.id === node2.nodeId);
@@ -29596,15 +30707,36 @@ function previewDiagramLayout(input) {
29596
30707
  if (fill) shape2.fill = fill;
29597
30708
  }
29598
30709
  const direct = originalModel?.nodes.find((entry3) => entry3.modelId === node2.nodeId);
29599
- if (direct?.fill) shape2.fill = direct.fill;
29600
- if (direct?.line) shape2.line = { ...shape2.line, ...direct.line };
29601
30710
  const sourceIds = [node2.nodeId, ...node2.foldedNodeIds ?? []];
29602
30711
  const textNodes = sourceIds.flatMap((id) => {
29603
30712
  const source3 = input.nodes.find((entry3) => entry3.id === id);
29604
30713
  return source3 ? [source3] : [];
29605
30714
  });
29606
30715
  if (textNodes.length) shape2.text = diagramPreviewText(textNodes, node2.fontSize);
30716
+ if (shape2.text) {
30717
+ if (node2.textVerticalAnchor) shape2.text.anchor = node2.textVerticalAnchor;
30718
+ for (const paragraph2 of shape2.text.paragraphs)
30719
+ if (!paragraph2.align && node2.textAlign) paragraph2.align = node2.textAlign;
30720
+ }
30721
+ applyDiagramRoleColors(
30722
+ shape2,
30723
+ colors?.labels.find((label3) => label3.name === node2.styleLabel),
30724
+ Math.max(
30725
+ 0,
30726
+ input.nodes.findIndex((entry3) => entry3.id === contextNodeId)
30727
+ ),
30728
+ input.minorFont
30729
+ );
30730
+ if (direct?.fill && direct.fill.kind !== "picture") shape2.fill = direct.fill;
30731
+ if (direct?.line) shape2.line = { ...shape2.line, ...direct.line };
29607
30732
  });
30733
+ applyDiagramPictureSources(
30734
+ drawing2,
30735
+ result2.nodes,
30736
+ input.source,
30737
+ issues,
30738
+ new Set(input.nodes.map((node2) => node2.id))
30739
+ );
29608
30740
  return { drawing: drawing2, mode: "interpreted", issues };
29609
30741
  }
29610
30742
  } catch (error) {
@@ -29645,9 +30777,9 @@ function resolveDiagramDrawingStyles(drawing, scheme2) {
29645
30777
 
29646
30778
  // diagram/write/cache.ts
29647
30779
  var DSP2 = "http://schemas.microsoft.com/office/drawing/2008/diagram";
29648
- function add(parent, namespace, name, attrs2 = {}) {
30780
+ function add(parent, namespace, name, attrs3 = {}) {
29649
30781
  const child6 = parent.ownerDocument.createElementNS(namespace, name);
29650
- for (const [key, value2] of Object.entries(attrs2)) child6.setAttribute(key, value2);
30782
+ for (const [key, value2] of Object.entries(attrs3)) child6.setAttribute(key, value2);
29651
30783
  parent.appendChild(child6);
29652
30784
  return child6;
29653
30785
  }
@@ -29665,6 +30797,7 @@ function withDiagramDrawingRelationship(xml, relationshipId) {
29665
30797
  return buildXml(doc);
29666
30798
  }
29667
30799
  function buildGeneratedDiagramCache(dataXml2, input) {
30800
+ dataXml2 = withDiagramPictureSources(dataXml2, input.source);
29668
30801
  const source3 = { ...input.source, dataXml: dataXml2 };
29669
30802
  const model2 = parseDiagramDataModel(dataXml2);
29670
30803
  const scheme2 = { ...DEFAULT_GENERATED_DIAGRAM_SCHEME, ...input.scheme };
@@ -29691,7 +30824,10 @@ function buildGeneratedDiagramCache(dataXml2, input) {
29691
30824
  }
29692
30825
  for (const shape2 of drawing.shapes) {
29693
30826
  if (shape2.has3d || shape2.foldedNodeIds?.length) return void 0;
29694
- if (shape2.fill && !["none", "solid", "gradient"].includes(shape2.fill.kind)) return void 0;
30827
+ if (shape2.fill && !["none", "solid", "gradient", "picture"].includes(shape2.fill.kind))
30828
+ return void 0;
30829
+ if (shape2.fill?.kind === "picture" && (!shape2.fill.relId || !drawing.pictureParts?.[shape2.fill.relId]))
30830
+ return void 0;
29695
30831
  if (shape2.fill?.kind === "gradient" && shape2.fill.path && !["circle", "rect"].includes(shape2.fill.path))
29696
30832
  return void 0;
29697
30833
  if (shape2.effects?.effects.some(
@@ -29798,12 +30934,15 @@ function buildGeneratedDiagramCache(dataXml2, input) {
29798
30934
  const point = add(points2, NS.dgm, "dgm:pt", { modelId: id, type: "pres" });
29799
30935
  add(point, NS.dgm, "dgm:prSet", {
29800
30936
  ...shape2.sourceNodeId ? { presAssocID: shape2.sourceNodeId } : {},
29801
- presName: "node",
30937
+ presName: shape2.sourceLayoutRole ?? "node",
29802
30938
  presStyleLbl: shape2.sourceStyleLabel ?? "node1",
29803
30939
  presStyleIdx: String(index3),
29804
30940
  presStyleCnt: String(drawing.shapes.length)
29805
30941
  });
29806
- add(point, NS.dgm, "dgm:spPr");
30942
+ const properties2 = add(point, NS.dgm, "dgm:spPr");
30943
+ if (shape2.fill?.kind === "picture" && shape2.fill.sourceXml) {
30944
+ properties2.appendChild(doc.importNode(parseXml(shape2.fill.sourceXml).documentElement, true));
30945
+ }
29807
30946
  if (shape2.sourceNodeId)
29808
30947
  add(connections, NS.dgm, "dgm:cxn", {
29809
30948
  modelId: createOfficeGuid(),
@@ -29816,7 +30955,11 @@ function buildGeneratedDiagramCache(dataXml2, input) {
29816
30955
  });
29817
30956
  add(marker3, GENERATED_DIAGRAM_CACHE_NS, "oc:shape", { id });
29818
30957
  });
29819
- return { dataXml: buildXml(doc), drawingXml: serialized.xml };
30958
+ return {
30959
+ dataXml: buildXml(doc),
30960
+ drawingXml: serialized.xml,
30961
+ ...drawing.pictureParts ? { pictureParts: drawing.pictureParts } : {}
30962
+ };
29820
30963
  }
29821
30964
 
29822
30965
  // diagram/relationships.ts
@@ -30321,6 +31464,29 @@ async function loadDiagram(hostPart, relationshipIds, host) {
30321
31464
  code: "DIAGRAM_DRAWING_ABSENT",
30322
31465
  message: "The package has no cached drawing for this diagram; its layout can only be recomputed from the layout definition."
30323
31466
  });
31467
+ if (data && layoutSource.dataXml) {
31468
+ let pictureParts = {};
31469
+ if (paths.data) {
31470
+ const owner = paths.data;
31471
+ try {
31472
+ const entries = await host.readRelationshipEntries(diagramRelationshipsPart(owner));
31473
+ pictureParts = Object.fromEntries(
31474
+ (entries ?? []).filter(
31475
+ (entry3) => entry3.type.endsWith("/image") && entry3.mode !== "External" && !/^[a-z][a-z0-9+.-]*:/i.test(entry3.target)
31476
+ ).map((entry3) => [entry3.id, host.resolvePath(owner, entry3.target)])
31477
+ );
31478
+ } catch {
31479
+ issues.push({
31480
+ code: "DIAGRAM_PICTURE_RELATIONSHIPS_UNREADABLE",
31481
+ message: "Picture relationships in the diagram data could not be read."
31482
+ });
31483
+ }
31484
+ }
31485
+ Object.assign(
31486
+ layoutSource,
31487
+ captureDiagramPictures(data, layoutSource.dataXml, pictureParts, drawing)
31488
+ );
31489
+ }
30324
31490
  return {
30325
31491
  layoutSource,
30326
31492
  ...generatedCache ? { generatedCache: true } : {},
@@ -30934,11 +32100,11 @@ function readChartFormatting(root) {
30934
32100
  // chart/data-cache.ts
30935
32101
  function chartCacheValues(cache2) {
30936
32102
  if (!cache2) return [];
30937
- const numeric2 = cache2.type === "number";
32103
+ const numeric3 = cache2.type === "number";
30938
32104
  const out = [];
30939
32105
  for (const point of cache2.points) {
30940
32106
  const text = point.value;
30941
- out[point.index ?? out.length] = numeric2 && text.trim() !== "" && Number.isFinite(Number(text)) ? Number(text) : text;
32107
+ out[point.index ?? out.length] = numeric3 && text.trim() !== "" && Number.isFinite(Number(text)) ? Number(text) : text;
30942
32108
  }
30943
32109
  const size = Math.max(cache2.pointCount ?? 0, out.length);
30944
32110
  for (let index3 = 0; index3 < size; index3++) if (out[index3] === void 0) out[index3] = "";
@@ -32409,8 +33575,8 @@ function graft(from, to, order, kinds) {
32409
33575
  for (const child6 of elements(from)) {
32410
33576
  if (child6.namespaceURI !== NS.c || !kinds.has(child6.localName)) continue;
32411
33577
  if (first(to, child6.localName, NS.c)) continue;
32412
- const rank3 = order.indexOf(child6.localName);
32413
- const before = elements(to).find((item2) => order.indexOf(item2.localName) > rank3);
33578
+ const rank4 = order.indexOf(child6.localName);
33579
+ const before = elements(to).find((item2) => order.indexOf(item2.localName) > rank4);
32414
33580
  to.insertBefore(to.ownerDocument.importNode(child6, true), before ?? null);
32415
33581
  changed = true;
32416
33582
  }
@@ -32688,17 +33854,17 @@ var GROUPINGS = /* @__PURE__ */ new Set(["clustered", "stacked", "percentStacked
32688
33854
  function chartSummarySeries(source3, chartType, groupLabels, groupSmooth) {
32689
33855
  const categories = source3.categories ?? source3.xValues;
32690
33856
  const values2 = source3.values ?? source3.yValues;
32691
- const numeric2 = (v) => typeof v === "number" ? v : v === "" ? null : Number.isFinite(Number(v)) ? Number(v) : null;
33857
+ const numeric3 = (v) => typeof v === "number" ? v : v === "" ? null : Number.isFinite(Number(v)) ? Number(v) : null;
32692
33858
  const out = {
32693
33859
  categories: chartSourceValues(categories),
32694
- values: chartSourceValues(values2).map(numeric2)
33860
+ values: chartSourceValues(values2).map(numeric3)
32695
33861
  };
32696
33862
  const smooth = source3.smooth ?? groupSmooth;
32697
33863
  if (smooth !== void 0) out.smooth = smooth;
32698
33864
  if (source3.spPr?.line) out.line = source3.spPr.line;
32699
33865
  if (values2?.cache?.formatCode !== void 0) out.numberFormat = values2.cache.formatCode;
32700
33866
  if (source3.bubbleSizes) {
32701
- out.bubbleSizes = chartSourceValues(source3.bubbleSizes).map(numeric2);
33867
+ out.bubbleSizes = chartSourceValues(source3.bubbleSizes).map(numeric3);
32702
33868
  if (source3.bubbleSizes.formula) out.bubbleSizesRef = source3.bubbleSizes.formula;
32703
33869
  }
32704
33870
  if (source3.tx?.text !== void 0) out.name = source3.tx.text;
@@ -32811,6 +33977,18 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
32811
33977
  showNegativeBubbles: group.showNegativeBubbles === true
32812
33978
  };
32813
33979
  }
33980
+ if (group?.is3D) {
33981
+ const v = chartSpace.view3D;
33982
+ summary.view3D = {
33983
+ ...v?.rotX === void 0 ? {} : { rotX: v.rotX },
33984
+ ...v?.rotY === void 0 ? {} : { rotY: v.rotY },
33985
+ ...v?.perspective === void 0 ? {} : { perspective: v.perspective },
33986
+ ...v?.rightAngleAxes === void 0 ? {} : { rAngAx: v.rightAngleAxes },
33987
+ ...v?.depthPercent === void 0 ? {} : { depthPercent: v.depthPercent },
33988
+ ...v?.heightPercent === void 0 ? {} : { hPercent: v.heightPercent },
33989
+ ...group.gapDepth === void 0 ? {} : { gapDepth: group.gapDepth }
33990
+ };
33991
+ }
32814
33992
  const grouping = group?.grouping;
32815
33993
  if (grouping && GROUPINGS.has(grouping))
32816
33994
  summary.grouping = grouping;
@@ -32892,6 +34070,7 @@ function chartObjectFromSpace(space, frame2, root) {
32892
34070
  if (summary.extraGroups) object.extraGroups = summary.extraGroups;
32893
34071
  if (summary.bubble) object.bubble = summary.bubble;
32894
34072
  if (summary.stock) object.stock = summary.stock;
34073
+ if (summary.view3D) object.view3D = summary.view3D;
32895
34074
  if (frame2.name) object.name = frame2.name;
32896
34075
  if (frame2.quickLayout !== void 0) object.quickLayout = frame2.quickLayout;
32897
34076
  if (frame2.colorPalette !== void 0) object.colorPalette = frame2.colorPalette;
@@ -33442,6 +34621,136 @@ function parseChartExSpace(source3) {
33442
34621
  return { chartExSpace, issues: context.issues };
33443
34622
  }
33444
34623
 
34624
+ // chart/color-palettes.ts
34625
+ var COLORFUL_VARIATIONS = [
34626
+ {},
34627
+ { lumMod: 6e4 },
34628
+ { lumMod: 8e4, lumOff: 2e4 },
34629
+ { lumMod: 8e4 },
34630
+ { lumMod: 6e4, lumOff: 4e4 },
34631
+ { lumMod: 5e4 },
34632
+ { lumMod: 7e4, lumOff: 3e4 },
34633
+ { lumMod: 7e4 },
34634
+ { lumMod: 5e4, lumOff: 5e4 }
34635
+ ];
34636
+ var GRAY_VARIATIONS = [
34637
+ { tint: 88500 },
34638
+ { tint: 55e3 },
34639
+ { tint: 75e3 },
34640
+ { tint: 98500 },
34641
+ { tint: 3e4 },
34642
+ { tint: 6e4 },
34643
+ { tint: 8e4 }
34644
+ ];
34645
+ var ACCENTS = ["accent1", "accent2", "accent3", "accent4", "accent5", "accent6"];
34646
+ function colorful(id, index3, base) {
34647
+ return { id, group: "colorful", index: index3, meth: "cycle", base, variations: COLORFUL_VARIATIONS };
34648
+ }
34649
+ function mono(id, index3, accent, meth) {
34650
+ return { id, group: "monochromatic", index: index3, meth, base: [accent], variations: [] };
34651
+ }
34652
+ var CHART_COLOR_PALETTES = [
34653
+ colorful(10, 1, ACCENTS),
34654
+ colorful(11, 2, ["accent1", "accent3", "accent5"]),
34655
+ colorful(12, 3, ["accent2", "accent4", "accent6"]),
34656
+ colorful(13, 4, ["accent6", "accent5", "accent4"]),
34657
+ ...ACCENTS.map((accent, i2) => mono(14 + i2, 1 + i2, accent, "withinLinear")),
34658
+ {
34659
+ id: 20,
34660
+ group: "monochromatic",
34661
+ index: 7,
34662
+ meth: "cycle",
34663
+ base: ["dk1"],
34664
+ variations: GRAY_VARIATIONS
34665
+ },
34666
+ ...ACCENTS.map((accent, i2) => mono(21 + i2, 8 + i2, accent, "withinLinearReversed"))
34667
+ ];
34668
+ function findChartColorPalette(id) {
34669
+ return CHART_COLOR_PALETTES.find((palette) => palette.id === id);
34670
+ }
34671
+ function withinLinearTransform(i2, n) {
34672
+ if (n <= 1) {
34673
+ return {};
34674
+ }
34675
+ const step = 140 / (n + 1);
34676
+ const centre = (n - 1) / 2;
34677
+ const value2 = 100 - step * Math.abs(i2 - centre);
34678
+ if (i2 < centre) {
34679
+ return { shade: Math.floor(value2 + 1e-9) * 1e3 };
34680
+ }
34681
+ if (i2 > centre) {
34682
+ return { tint: Math.ceil(value2 - 1e-9) * 1e3 };
34683
+ }
34684
+ return {};
34685
+ }
34686
+ function chartPaletteSeriesColorChoice(palette, i2, n) {
34687
+ let base;
34688
+ let transform6;
34689
+ if (palette.meth === "cycle") {
34690
+ base = palette.base[i2 % palette.base.length];
34691
+ const round3 = Math.floor(i2 / palette.base.length);
34692
+ transform6 = (palette.variations.length ? palette.variations[round3 % palette.variations.length] : {}) ?? {};
34693
+ } else {
34694
+ const index3 = palette.meth === "withinLinearReversed" ? n - 1 - i2 : i2;
34695
+ base = palette.base[0];
34696
+ transform6 = withinLinearTransform(index3, n);
34697
+ }
34698
+ if (!base) throw new RangeError("A chart palette must have a base color");
34699
+ return {
34700
+ kind: "scheme",
34701
+ value: base,
34702
+ transforms: Object.entries(transform6).map(([name, value2]) => ({ name, value: String(value2) }))
34703
+ };
34704
+ }
34705
+
34706
+ // chart/render/chart-title-text.ts
34707
+ function chartRunStyle(run2) {
34708
+ return {
34709
+ ...run2.sizePt === void 0 ? {} : { fontSize: run2.sizePt },
34710
+ ...run2.bold === void 0 ? {} : { bold: run2.bold },
34711
+ ...run2.italic === void 0 ? {} : { italic: run2.italic },
34712
+ ...run2.underline === void 0 ? {} : { underline: run2.underline },
34713
+ ...run2.typeface === void 0 ? {} : { typeface: run2.typeface },
34714
+ ...run2.color === void 0 ? {} : { textColor: run2.color }
34715
+ };
34716
+ }
34717
+
34718
+ // chart/render/summary-ex-formatting.ts
34719
+ function textStyle(body) {
34720
+ const paragraph2 = body?.paragraphs[0];
34721
+ return {
34722
+ ...chartRunStyle(paragraph2?.defaultProperties ?? {}),
34723
+ ...chartRunStyle(paragraph2?.runs[0] ?? {})
34724
+ };
34725
+ }
34726
+ function chartExFormatting(space) {
34727
+ return {
34728
+ builtInStyle: 2,
34729
+ sourceXml: "",
34730
+ entries: {
34731
+ title: {
34732
+ fontSize: 18,
34733
+ bold: false,
34734
+ textColor: {
34735
+ kind: "scheme",
34736
+ value: "tx1",
34737
+ transforms: []
34738
+ },
34739
+ ...textStyle(space.title?.txPr),
34740
+ ...textStyle(space.title?.tx?.rich),
34741
+ ...space.title?.tx?.rich ? { textBody: space.title.tx.rich } : {},
34742
+ sourceXml: ""
34743
+ },
34744
+ legend: { fontSize: 12, ...textStyle(space.legend?.txPr), sourceXml: "" },
34745
+ categoryAxis: {
34746
+ fontSize: 10,
34747
+ ...textStyle(space.plotArea.axes.find((a2) => a2.scaling?.kind === "cat")?.txPr),
34748
+ sourceXml: ""
34749
+ }
34750
+ }
34751
+ };
34752
+ }
34753
+
33445
34754
  // chart/render/summary-ex-series.ts
33446
34755
  var level3 = (source3) => ({
33447
34756
  ...source3.visibility?.value === void 0 ? {} : { showValue: source3.visibility.value },
@@ -33454,6 +34763,7 @@ var level3 = (source3) => ({
33454
34763
  function chartExSeriesPaint(source3, series, defaultValues = false) {
33455
34764
  const fill = source3.spPr?.fill;
33456
34765
  if (fill) series.fill = fill;
34766
+ if (source3.spPr?.line) series.line = source3.spPr.line;
33457
34767
  const points2 = {};
33458
34768
  const fills = {};
33459
34769
  for (const point of source3.dataPoints) {
@@ -33537,34 +34847,13 @@ function chartExSummary(source3) {
33537
34847
  if (!isChartExRoot(root)) return void 0;
33538
34848
  return chartExSummaryFromModel(parseChartExSpace(root).chartExSpace);
33539
34849
  }
33540
- function chartExFormatting() {
33541
- return {
33542
- builtInStyle: 2,
33543
- sourceXml: "",
33544
- entries: {
33545
- title: {
33546
- fontSize: 14,
33547
- bold: false,
33548
- textColor: {
33549
- kind: "scheme",
33550
- value: "tx1",
33551
- transforms: [
33552
- { name: "lumMod", value: "65000" },
33553
- { name: "lumOff", value: "35000" }
33554
- ]
33555
- },
33556
- sourceXml: ""
33557
- }
33558
- }
33559
- };
33560
- }
33561
34850
  function summarySeries(space, source3, chartType) {
33562
34851
  const data = seriesData(space, source3);
33563
34852
  const categories = dimension(data, "strDim", "cat");
33564
34853
  const values2 = dimension(
33565
34854
  data,
33566
34855
  "numDim",
33567
- chartType === "treemap" || chartType === "sunburst" ? "size" : "val"
34856
+ chartType === "treemap" || chartType === "sunburst" ? "size" : chartType === "regionMap" ? "colorVal" : "val"
33568
34857
  );
33569
34858
  const series = {
33570
34859
  categories: categories?.points ?? [],
@@ -33573,11 +34862,24 @@ function summarySeries(space, source3, chartType) {
33573
34862
  ),
33574
34863
  ...seriesFill(source3)
33575
34864
  };
33576
- if (chartType === "funnel" || chartType === "boxWhisker") {
34865
+ if (chartType === "funnel" || chartType === "boxWhisker" || chartType === "regionMap") {
33577
34866
  chartExSeriesPaint(source3, series, chartType === "funnel" && source3.dataLabels !== void 0);
33578
34867
  if (source3.hidden !== void 0) series.hidden = source3.hidden;
33579
34868
  }
33580
34869
  if (chartType === "boxWhisker") series.boxWhisker = source3.layoutProperties ?? {};
34870
+ if (chartType === "regionMap") {
34871
+ const geo = source3.layoutProperties?.geography;
34872
+ series.regionMap = {
34873
+ ...geo,
34874
+ ...geo?.geoCacheXml ? { geographyCacheXml: geo.geoCacheXml } : {},
34875
+ ...dimension(data, "strDim", "entityId") ? { entityIds: dimension(data, "strDim", "entityId").points } : {},
34876
+ ...source3.layoutProperties?.regionLabelLayout ? {
34877
+ regionLabelLayout: source3.layoutProperties.regionLabelLayout
34878
+ } : {},
34879
+ ...source3.valueColorsXml ? { valueColorsXml: source3.valueColorsXml } : {},
34880
+ ...source3.valueColorPositionsXml ? { valueColorPositionsXml: source3.valueColorPositionsXml } : {}
34881
+ };
34882
+ }
33581
34883
  const name = source3.tx?.value?.trim();
33582
34884
  if (name) series.name = name;
33583
34885
  const nameRef = source3.tx?.formula?.formula.trim();
@@ -33590,7 +34892,7 @@ function chartExSummaryFromModel(space) {
33590
34892
  const all2 = space.plotArea.series;
33591
34893
  const primary = all2.find((s) => s.layoutId !== "paretoLine") ?? all2[0];
33592
34894
  const layoutId = primary?.layoutId ?? "";
33593
- const chartType = layoutId === "waterfall" ? "waterfall" : layoutId === "clusteredColumn" ? "histogram" : layoutId === "treemap" || layoutId === "sunburst" || layoutId === "funnel" || layoutId === "boxWhisker" ? layoutId : void 0;
34895
+ const chartType = layoutId === "waterfall" ? "waterfall" : layoutId === "clusteredColumn" ? "histogram" : layoutId === "treemap" || layoutId === "sunburst" || layoutId === "funnel" || layoutId === "boxWhisker" || layoutId === "regionMap" ? layoutId : void 0;
33594
34896
  if (!primary || !chartType) return { layoutId };
33595
34897
  const series = summarySeries(space, primary, chartType);
33596
34898
  const layout3 = primary.layoutProperties;
@@ -33628,7 +34930,12 @@ function chartExSummaryFromModel(space) {
33628
34930
  ];
33629
34931
  });
33630
34932
  }
33631
- summary.formatting = chartExFormatting();
34933
+ if (chartType === "funnel") {
34934
+ const cat = space.plotArea.axes.find((axis) => axis.scaling?.kind === "cat")?.scaling;
34935
+ if (cat?.kind === "cat" && typeof cat.gapWidth === "number")
34936
+ summary.funnelGapWidth = cat.gapWidth;
34937
+ }
34938
+ summary.formatting = chartExFormatting(space);
33632
34939
  const title = titleOf(space);
33633
34940
  if (title) summary.title = title;
33634
34941
  const position = legend?.position;
@@ -34102,6 +35409,7 @@ function parseDrawing(source3, partName, warn) {
34102
35409
  kind: "image",
34103
35410
  anchor,
34104
35411
  sourceXml: selfContainedXml(anchorEl),
35412
+ ...blipFill ? { layout: parsePictureLayout(blipFill) } : {},
34105
35413
  ...parsePictureCrop(blipFill) ? { crop: parsePictureCrop(blipFill) } : {},
34106
35414
  ...parsePictureEffects(blip).length ? { effects: parsePictureEffects(blip) } : {},
34107
35415
  partName: target,
@@ -34253,6 +35561,7 @@ function readValue2(ctx, c2, cell) {
34253
35561
  }
34254
35562
  cell.value = entry3.text;
34255
35563
  if (entry3.runs) cell.richText = entry3.runs.map((run2) => ({ ...run2 }));
35564
+ if (entry3.phonetic) cell.phonetic = structuredClone(entry3.phonetic);
34256
35565
  return;
34257
35566
  }
34258
35567
  case "inlineStr": {
@@ -34261,6 +35570,7 @@ function readValue2(ctx, c2, cell) {
34261
35570
  const entry3 = parseRichString(is2, ctx.palette);
34262
35571
  cell.value = entry3.text;
34263
35572
  if (entry3.runs) cell.richText = entry3.runs;
35573
+ if (entry3.phonetic) cell.phonetic = entry3.phonetic;
34264
35574
  return;
34265
35575
  }
34266
35576
  case "str":
@@ -34666,7 +35976,7 @@ function readWorksheet(ctx, partName, name, sheetId, xml, rows) {
34666
35976
  if (data) readSheetData(ctx, rows ?? elements(data), sheet);
34667
35977
  const protection = readProtection(byName.get("sheetProtection"));
34668
35978
  if (protection) sheet.protection = protection;
34669
- const autoFilter = readAutoFilter(byName.get("autoFilter"));
35979
+ const autoFilter = readAutoFilter(byName.get("autoFilter"), ctx.dxfs);
34670
35980
  if (autoFilter) sheet.autoFilter = autoFilter;
34671
35981
  sheet.merges = xChildren(byName.get("mergeCells") ?? root, "mergeCell").map((node2) => parseRange(att(node2, "ref") ?? "")).filter((range) => range !== void 0);
34672
35982
  sheet.conditionalFormats = readConditionalFormats(
@@ -34952,8 +36262,8 @@ function attributes(entries) {
34952
36262
  return ` ${name}="${text}"`;
34953
36263
  }).join("");
34954
36264
  }
34955
- var cxElement = (local, content2 = "", attrs2 = "") => content2 ? `<cx:${local}${attrs2}>${content2}</cx:${local}>` : `<cx:${local}${attrs2}/>`;
34956
- var cxText = (local, text, attrs2 = "") => text === void 0 ? "" : `<cx:${local}${attrs2}>${escapeText3(text)}</cx:${local}>`;
36265
+ var cxElement = (local, content2 = "", attrs3 = "") => content2 ? `<cx:${local}${attrs3}>${content2}</cx:${local}>` : `<cx:${local}${attrs3}/>`;
36266
+ var cxText = (local, text, attrs3 = "") => text === void 0 ? "" : `<cx:${local}${attrs3}>${escapeText3(text)}</cx:${local}>`;
34957
36267
  var cxVal = (local, value2) => value2 === void 0 ? "" : `<cx:${local}${attributes([["val", value2]])}/>`;
34958
36268
  var formulaXml = (local, formula2) => formula2 ? cxText(local, formula2.formula, attributes([["dir", formula2.direction]])) : "";
34959
36269
  var shapeXml = (context, shape2) => shape2 ? cxElement("spPr", shapePropertiesInnerXml(context, shape2)) : "";
@@ -35927,104 +37237,6 @@ function defaultChartAxes(horizontal, scatter, ids = DEFAULT_CHART_AXIS_IDS) {
35927
37237
  return [first2, second];
35928
37238
  }
35929
37239
 
35930
- // chart/color-palettes.ts
35931
- var COLORFUL_VARIATIONS = [
35932
- {},
35933
- { lumMod: 6e4 },
35934
- { lumMod: 8e4, lumOff: 2e4 },
35935
- { lumMod: 8e4 },
35936
- { lumMod: 6e4, lumOff: 4e4 },
35937
- { lumMod: 5e4 },
35938
- { lumMod: 7e4, lumOff: 3e4 },
35939
- { lumMod: 7e4 },
35940
- { lumMod: 5e4, lumOff: 5e4 }
35941
- ];
35942
- var GRAY_VARIATIONS = [
35943
- { tint: 88500 },
35944
- { tint: 55e3 },
35945
- { tint: 75e3 },
35946
- { tint: 98500 },
35947
- { tint: 3e4 },
35948
- { tint: 6e4 },
35949
- { tint: 8e4 }
35950
- ];
35951
- var ACCENTS = ["accent1", "accent2", "accent3", "accent4", "accent5", "accent6"];
35952
- function colorful(id, index3, base) {
35953
- return { id, group: "colorful", index: index3, meth: "cycle", base, variations: COLORFUL_VARIATIONS };
35954
- }
35955
- function mono(id, index3, accent, meth) {
35956
- return { id, group: "monochromatic", index: index3, meth, base: [accent], variations: [] };
35957
- }
35958
- var CHART_COLOR_PALETTES = [
35959
- colorful(10, 1, ACCENTS),
35960
- colorful(11, 2, ["accent1", "accent3", "accent5"]),
35961
- colorful(12, 3, ["accent2", "accent4", "accent6"]),
35962
- colorful(13, 4, ["accent6", "accent5", "accent4"]),
35963
- ...ACCENTS.map((accent, i2) => mono(14 + i2, 1 + i2, accent, "withinLinear")),
35964
- {
35965
- id: 20,
35966
- group: "monochromatic",
35967
- index: 7,
35968
- meth: "cycle",
35969
- base: ["dk1"],
35970
- variations: GRAY_VARIATIONS
35971
- },
35972
- ...ACCENTS.map((accent, i2) => mono(21 + i2, 8 + i2, accent, "withinLinearReversed"))
35973
- ];
35974
- function findChartColorPalette(id) {
35975
- return CHART_COLOR_PALETTES.find((palette) => palette.id === id);
35976
- }
35977
- function withinLinearTransform(i2, n) {
35978
- if (n <= 1) {
35979
- return {};
35980
- }
35981
- const step = 140 / (n + 1);
35982
- const centre = (n - 1) / 2;
35983
- const value2 = 100 - step * Math.abs(i2 - centre);
35984
- if (i2 < centre) {
35985
- return { shade: Math.floor(value2 + 1e-9) * 1e3 };
35986
- }
35987
- if (i2 > centre) {
35988
- return { tint: Math.ceil(value2 - 1e-9) * 1e3 };
35989
- }
35990
- return {};
35991
- }
35992
- function chartPaletteSeriesColorChoice(palette, i2, n) {
35993
- let base;
35994
- let transform6;
35995
- if (palette.meth === "cycle") {
35996
- base = palette.base[i2 % palette.base.length];
35997
- const round3 = Math.floor(i2 / palette.base.length);
35998
- transform6 = (palette.variations.length ? palette.variations[round3 % palette.variations.length] : {}) ?? {};
35999
- } else {
36000
- const index3 = palette.meth === "withinLinearReversed" ? n - 1 - i2 : i2;
36001
- base = palette.base[0];
36002
- transform6 = withinLinearTransform(index3, n);
36003
- }
36004
- if (!base) throw new RangeError("A chart palette must have a base color");
36005
- return {
36006
- kind: "scheme",
36007
- value: base,
36008
- transforms: Object.entries(transform6).map(([name, value2]) => ({ name, value: String(value2) }))
36009
- };
36010
- }
36011
-
36012
- // chart/render/theme-palette.ts
36013
- var THEME_SLOTS = [
36014
- "lt1",
36015
- "dk1",
36016
- "lt2",
36017
- "dk2",
36018
- "accent1",
36019
- "accent2",
36020
- "accent3",
36021
- "accent4",
36022
- "accent5",
36023
- "accent6",
36024
- "hlink",
36025
- "folHlink"
36026
- ];
36027
-
36028
37240
  // xlsx/edit/chart-series-fill.ts
36029
37241
  function chartDrawingColor(color) {
36030
37242
  if (!color) return void 0;
@@ -36164,7 +37376,7 @@ var PackageWriter = class {
36164
37376
  const date = new Date(Date.UTC(1980, 0, 1));
36165
37377
  const options = { date, createFolders: false };
36166
37378
  zip.file("[Content_Types].xml", this.contentTypesXml(), options);
36167
- const names = [...this.parts.keys()].sort((a2, b) => rank(a2) - rank(b) || a2.localeCompare(b));
37379
+ const names = [...this.parts.keys()].sort((a2, b) => rank2(a2) - rank2(b) || a2.localeCompare(b));
36168
37380
  for (const name of names) zip.file(name, this.parts.get(name) ?? "", options);
36169
37381
  return zip.generateAsync({
36170
37382
  type: "uint8array",
@@ -36173,7 +37385,7 @@ var PackageWriter = class {
36173
37385
  });
36174
37386
  }
36175
37387
  };
36176
- var rank = (name) => name === "_rels/.rels" ? 0 : name.startsWith("docProps/") ? 1 : name === "xl/workbook.xml" ? 2 : 3;
37388
+ var rank2 = (name) => name === "_rels/.rels" ? 0 : name.startsWith("docProps/") ? 1 : name === "xl/workbook.xml" ? 2 : 3;
36177
37389
 
36178
37390
  // xlsx/write/chart-colors.ts
36179
37391
  function chartSeriesDrawingFill(chart, series, index3) {
@@ -36268,8 +37480,8 @@ function seriesModel(chart, series, index3) {
36268
37480
  }
36269
37481
  if (lineLike) out.marker = { symbol: "none" };
36270
37482
  if (type === "bar" || type === "column") out.invertIfNegative = false;
36271
- const numeric2 = series.categories.length > 0 && series.categories.every((c2) => typeof c2 === "number");
36272
- const categories = series.categoriesRef !== void 0 || series.categories.length > 0 ? source2(numeric2 ? "num" : "str", series.categoriesRef, series.categories) : void 0;
37483
+ const numeric3 = series.categories.length > 0 && series.categories.every((c2) => typeof c2 === "number");
37484
+ const categories = series.categoriesRef !== void 0 || series.categories.length > 0 ? source2(numeric3 ? "num" : "str", series.categoriesRef, series.categories) : void 0;
36273
37485
  const values2 = source2("num", series.valuesRef, series.values);
36274
37486
  if (type === "scatter") {
36275
37487
  if (categories) out.xValues = categories;
@@ -36434,6 +37646,7 @@ function writeSmartArtCache(writer, object, parts, rels, relativeTarget2, contex
36434
37646
  height: object.anchor.ext?.cy ?? 2667e3
36435
37647
  },
36436
37648
  source: {
37649
+ ...object.layoutSource,
36437
37650
  ...layoutXml3 ? { layoutXml: layoutXml3 } : {},
36438
37651
  ...colorsXml ? { colorsXml } : {},
36439
37652
  ...quickStyleXml ? { quickStyleXml } : {}
@@ -36451,6 +37664,8 @@ function writeSmartArtCache(writer, object, parts, rels, relativeTarget2, contex
36451
37664
  const drawingName = `xl/diagrams/drawing${index3}.xml`;
36452
37665
  const relationship2 = rels.add(DIAGRAM_RELATIONSHIP_TYPES.drawing, relativeTarget2(drawingName));
36453
37666
  writer.add(drawingName, cache2.drawingXml, DIAGRAM_CONTENT_TYPES.drawing);
37667
+ const pictureRels = diagramPictureRelationships(drawingName, object.layoutSource);
37668
+ if (pictureRels) writer.add(drawingName.replace(/([^/]+)$/, "_rels/$1.rels"), pictureRels);
36454
37669
  writer.add(
36455
37670
  parts.data,
36456
37671
  withDiagramDrawingRelationship(cache2.dataXml, relationship2),
@@ -36517,6 +37732,20 @@ function writeEditedSmartArt(writer, object, rels, relativeTarget2, context = {}
36517
37732
  ...relaid && object.layoutId ? { layout: { uniqueId: object.layoutId, category: object.layoutFamily } } : {}
36518
37733
  })
36519
37734
  );
37735
+ if (object.layoutSource?.pictures?.length) {
37736
+ const pending2 = writer.peek(dataPart);
37737
+ if (typeof pending2 === "string")
37738
+ writer.add(dataPart, withDiagramPictureSources(pending2, object.layoutSource));
37739
+ const name = relationshipsPartFor(dataPart);
37740
+ const existing = writer.peek(name) ?? writer.source?.text(name);
37741
+ const relsXml = diagramPictureRelationships(
37742
+ dataPart,
37743
+ object.layoutSource,
37744
+ typeof existing === "string" ? existing : existing ? new TextDecoder().decode(existing) : void 0
37745
+ );
37746
+ if (relsXml) writer.add(name, relsXml, CONTENT_TYPES.rels);
37747
+ for (const part of Object.values(object.layoutSource.pictureParts ?? {})) writer.carry(part);
37748
+ }
36520
37749
  if (rels && relativeTarget2)
36521
37750
  writeSmartArtCache(
36522
37751
  writer,
@@ -36780,6 +38009,7 @@ function writeDrawing(writer, partName, objects, sourceDrawing, context) {
36780
38009
  }
36781
38010
  if (blip && object.effects !== void 0 && !sameModel(object.effects, parsePictureEffects(blip)))
36782
38011
  applyPictureEffects(blip, object.effects ?? []);
38012
+ if (fill && object.layout !== void 0) applyPictureLayout(fill, object.layout);
36783
38013
  if (fill && object.crop !== void 0 && !sameModel(object.crop, parsePictureCrop(fill)))
36784
38014
  applyPictureCrop(fill, object.crop);
36785
38015
  body += buildXml(imported ? picture.documentElement : elements(picture.documentElement)[0]);
@@ -37387,7 +38617,7 @@ function collectNumbers(ctx, args, options = {}) {
37387
38617
  }
37388
38618
  var all = (ctx, args) => collectNumbers(ctx, args, { includeAll: true });
37389
38619
  var domain = (ok, value2) => ok ? value2 : fail(ERR.NUM);
37390
- var wildcardRegex = compileWildcard;
38620
+ var wildcardRegex2 = compileWildcard;
37391
38621
  var hasWildcards = (text) => /[*?~]/.test(text);
37392
38622
  function makeCriteria(criteria) {
37393
38623
  if (isError(criteria)) return (value2) => isError(value2) && value2.error === criteria.error;
@@ -37418,7 +38648,7 @@ function makeCriteria(criteria) {
37418
38648
  } else if (errorOperand) {
37419
38649
  test = (value2) => isError(value2) && value2.error === errorOperand;
37420
38650
  } else if (hasWildcards(operandText)) {
37421
- const regex = wildcardRegex(operandText);
38651
+ const regex = wildcardRegex2(operandText);
37422
38652
  test = (value2) => typeof value2 === "string" && regex.test(value2);
37423
38653
  } else {
37424
38654
  const lower3 = operandText.toLowerCase();
@@ -37441,7 +38671,7 @@ function spec(name, category, syntax, description, minArgs, maxArgs, fn, params,
37441
38671
  if (volatile) out.volatile = true;
37442
38672
  return out;
37443
38673
  }
37444
- function numeric(name, category, syntax, description, minArgs, maxArgs, fn, defaults = []) {
38674
+ function numeric2(name, category, syntax, description, minArgs, maxArgs, fn, defaults = []) {
37445
38675
  return spec(name, category, syntax, description, minArgs, maxArgs, (args) => {
37446
38676
  const values2 = [];
37447
38677
  for (let i2 = 0; i2 < maxArgs; i2++) {
@@ -37968,19 +39198,19 @@ function percentRank(values2, x, digits2, exclusive) {
37968
39198
  const first2 = s[0];
37969
39199
  const last = s[n - 1];
37970
39200
  if (x < first2 || x > last) fail(ERR.NA);
37971
- let rank3;
39201
+ let rank4;
37972
39202
  const lower3 = s.filter((v) => v < x).length;
37973
39203
  const exact = s.includes(x);
37974
39204
  if (exact) {
37975
- rank3 = exclusive ? (lower3 + 1) / (n + 1) : n === 1 ? 1 : lower3 / (n - 1);
39205
+ rank4 = exclusive ? (lower3 + 1) / (n + 1) : n === 1 ? 1 : lower3 / (n - 1);
37976
39206
  } else {
37977
39207
  const below = s[lower3 - 1];
37978
39208
  const above = s[lower3];
37979
39209
  const frac = (x - below) / (above - below);
37980
- rank3 = exclusive ? (lower3 + frac) / (n + 1) : (lower3 - 1 + frac) / (n - 1);
39210
+ rank4 = exclusive ? (lower3 + frac) / (n + 1) : (lower3 - 1 + frac) / (n - 1);
37981
39211
  }
37982
39212
  const factor = Math.pow(10, Math.trunc(digits2));
37983
- return Math.floor(rank3 * factor + 1e-9) / factor;
39213
+ return Math.floor(rank4 * factor + 1e-9) / factor;
37984
39214
  }
37985
39215
  function covariance(xs, ys, sample) {
37986
39216
  if (xs.length !== ys.length) fail(ERR.NA);
@@ -38014,7 +39244,7 @@ function linearFit(xs, ys) {
38014
39244
  const slope = sxy / sxx;
38015
39245
  return { slope, intercept: my - slope * mx };
38016
39246
  }
38017
- function rank2(values2, x, ascending, average) {
39247
+ function rank3(values2, x, ascending, average) {
38018
39248
  let better2 = 0;
38019
39249
  let ties = 0;
38020
39250
  for (const v of values2) {
@@ -39213,7 +40443,7 @@ var ENGINEERING_FUNCTIONS = [
39213
40443
  const out = Math.floor(bitArg(args[0]) / Math.pow(2, int3(args[1])));
39214
40444
  return out >= 2 ** 48 ? fail(ERR.NUM) : out;
39215
40445
  }),
39216
- numeric(
40446
+ numeric2(
39217
40447
  "DELTA",
39218
40448
  C8,
39219
40449
  "DELTA(number1, [number2])",
@@ -39222,7 +40452,7 @@ var ENGINEERING_FUNCTIONS = [
39222
40452
  2,
39223
40453
  (a2, b = 0) => a2 === b ? 1 : 0
39224
40454
  ),
39225
- numeric(
40455
+ numeric2(
39226
40456
  "GESTEP",
39227
40457
  C8,
39228
40458
  "GESTEP(number, [step])",
@@ -39843,7 +41073,7 @@ function variableDeclining(cost, salvage, life, start, end, factor, noSwitch) {
39843
41073
  return total2;
39844
41074
  }
39845
41075
  var DEPRECIATION_FUNCTIONS = [
39846
- numeric(
41076
+ numeric2(
39847
41077
  "SLN",
39848
41078
  C12,
39849
41079
  "SLN(cost, salvage, life)",
@@ -39852,7 +41082,7 @@ var DEPRECIATION_FUNCTIONS = [
39852
41082
  3,
39853
41083
  (c2, s, l) => l === 0 ? fail(ERR.DIV0) : (c2 - (s ?? 0)) / (l ?? 1)
39854
41084
  ),
39855
- numeric(
41085
+ numeric2(
39856
41086
  "SYD",
39857
41087
  C12,
39858
41088
  "SYD(cost, salvage, life, per)",
@@ -39864,7 +41094,7 @@ var DEPRECIATION_FUNCTIONS = [
39864
41094
  return (c2 - s) * (l - p + 1) * 2 / (l * (l + 1));
39865
41095
  }
39866
41096
  ),
39867
- numeric(
41097
+ numeric2(
39868
41098
  "DDB",
39869
41099
  C12,
39870
41100
  "DDB(cost, salvage, life, period, [factor])",
@@ -39902,7 +41132,7 @@ var DEPRECIATION_FUNCTIONS = [
39902
41132
  );
39903
41133
  }
39904
41134
  ),
39905
- numeric(
41135
+ numeric2(
39906
41136
  "DB",
39907
41137
  C12,
39908
41138
  "DB(cost, salvage, life, period, [month])",
@@ -39921,7 +41151,7 @@ var DEPRECIATION_FUNCTIONS = [
39921
41151
  return period === Math.trunc(l) + 1 ? book * rate * (12 - month) / 12 : book * rate;
39922
41152
  }
39923
41153
  ),
39924
- numeric(
41154
+ numeric2(
39925
41155
  "EFFECT",
39926
41156
  C12,
39927
41157
  "EFFECT(nominal_rate, npery)",
@@ -39934,7 +41164,7 @@ var DEPRECIATION_FUNCTIONS = [
39934
41164
  return Math.pow(1 + r / p, p) - 1;
39935
41165
  }
39936
41166
  ),
39937
- numeric(
41167
+ numeric2(
39938
41168
  "NOMINAL",
39939
41169
  C12,
39940
41170
  "NOMINAL(effect_rate, npery)",
@@ -39947,7 +41177,7 @@ var DEPRECIATION_FUNCTIONS = [
39947
41177
  return p * (Math.pow(1 + r, 1 / p) - 1);
39948
41178
  }
39949
41179
  ),
39950
- numeric(
41180
+ numeric2(
39951
41181
  "CUMIPMT",
39952
41182
  C12,
39953
41183
  "CUMIPMT(rate, nper, pv, start_period, end_period, type)",
@@ -39956,7 +41186,7 @@ var DEPRECIATION_FUNCTIONS = [
39956
41186
  6,
39957
41187
  (...a2) => cumulative(a2, false)
39958
41188
  ),
39959
- numeric(
41189
+ numeric2(
39960
41190
  "CUMPRINC",
39961
41191
  C12,
39962
41192
  "CUMPRINC(rate, nper, pv, start_period, end_period, type)",
@@ -39965,7 +41195,7 @@ var DEPRECIATION_FUNCTIONS = [
39965
41195
  6,
39966
41196
  (...a2) => cumulative(a2, true)
39967
41197
  ),
39968
- numeric(
41198
+ numeric2(
39969
41199
  "ISPMT",
39970
41200
  C12,
39971
41201
  "ISPMT(rate, per, nper, pv)",
@@ -39977,7 +41207,7 @@ var DEPRECIATION_FUNCTIONS = [
39977
41207
  return p * r * (per / n - 1);
39978
41208
  }
39979
41209
  ),
39980
- numeric(
41210
+ numeric2(
39981
41211
  "PDURATION",
39982
41212
  C12,
39983
41213
  "PDURATION(rate, pv, fv)",
@@ -39989,7 +41219,7 @@ var DEPRECIATION_FUNCTIONS = [
39989
41219
  return (Math.log(f6) - Math.log(p)) / Math.log(1 + r);
39990
41220
  }
39991
41221
  ),
39992
- numeric(
41222
+ numeric2(
39993
41223
  "RRI",
39994
41224
  C12,
39995
41225
  "RRI(nper, pv, fv)",
@@ -40011,7 +41241,7 @@ var DEPRECIATION_FUNCTIONS = [
40011
41241
  (args, ctx) => collectNumbers(ctx, [args[1] ?? null]).reduce((acc, r) => acc * (1 + r), num4(args[0])),
40012
41242
  ["value", "any"]
40013
41243
  ),
40014
- numeric(
41244
+ numeric2(
40015
41245
  "DOLLARDE",
40016
41246
  C12,
40017
41247
  "DOLLARDE(fractional_dollar, fraction)",
@@ -40027,7 +41257,7 @@ var DEPRECIATION_FUNCTIONS = [
40027
41257
  return int4 + (d - int4) * Math.pow(10, digits2) / frac;
40028
41258
  }
40029
41259
  ),
40030
- numeric(
41260
+ numeric2(
40031
41261
  "DOLLARFR",
40032
41262
  C12,
40033
41263
  "DOLLARFR(decimal_dollar, fraction)",
@@ -40201,7 +41431,7 @@ var FINANCIAL_FUNCTIONS = [
40201
41431
  ...COUPON_FUNCTIONS,
40202
41432
  ...BOND_FUNCTIONS,
40203
41433
  ...SECURITY_FUNCTIONS,
40204
- numeric(
41434
+ numeric2(
40205
41435
  "PMT",
40206
41436
  C15,
40207
41437
  "PMT(rate, nper, pv, [fv], [type])",
@@ -40210,7 +41440,7 @@ var FINANCIAL_FUNCTIONS = [
40210
41440
  5,
40211
41441
  (r, n, p, f6, t) => pmt(r, n ?? 0, p ?? 0, f6, t)
40212
41442
  ),
40213
- numeric(
41443
+ numeric2(
40214
41444
  "FV",
40215
41445
  C15,
40216
41446
  "FV(rate, nper, pmt, [pv], [type])",
@@ -40219,7 +41449,7 @@ var FINANCIAL_FUNCTIONS = [
40219
41449
  5,
40220
41450
  (r, n, p, v, t) => fv(r, n ?? 0, p ?? 0, v, t)
40221
41451
  ),
40222
- numeric(
41452
+ numeric2(
40223
41453
  "PV",
40224
41454
  C15,
40225
41455
  "PV(rate, nper, pmt, [fv], [type])",
@@ -40228,7 +41458,7 @@ var FINANCIAL_FUNCTIONS = [
40228
41458
  5,
40229
41459
  (r, n, p, f6, t) => pv(r, n ?? 0, p ?? 0, f6, t)
40230
41460
  ),
40231
- numeric(
41461
+ numeric2(
40232
41462
  "NPER",
40233
41463
  C15,
40234
41464
  "NPER(rate, pmt, pv, [fv], [type])",
@@ -40245,7 +41475,7 @@ var FINANCIAL_FUNCTIONS = [
40245
41475
  return Math.log(num1 / den) / Math.log(1 + r);
40246
41476
  }
40247
41477
  ),
40248
- numeric(
41478
+ numeric2(
40249
41479
  "IPMT",
40250
41480
  C15,
40251
41481
  "IPMT(rate, per, nper, pv, [fv], [type])",
@@ -40254,7 +41484,7 @@ var FINANCIAL_FUNCTIONS = [
40254
41484
  6,
40255
41485
  (r, per, n, p, f6, t) => ipmt(r, per ?? 0, n ?? 0, p ?? 0, f6, t)
40256
41486
  ),
40257
- numeric(
41487
+ numeric2(
40258
41488
  "PPMT",
40259
41489
  C15,
40260
41490
  "PPMT(rate, per, nper, pv, [fv], [type])",
@@ -40263,7 +41493,7 @@ var FINANCIAL_FUNCTIONS = [
40263
41493
  6,
40264
41494
  (r, per, n, p, f6, t) => pmt(r, n ?? 0, p ?? 0, f6, t) - ipmt(r, per ?? 0, n ?? 0, p ?? 0, f6, t)
40265
41495
  ),
40266
- numeric(
41496
+ numeric2(
40267
41497
  "RATE",
40268
41498
  C15,
40269
41499
  "RATE(nper, pmt, pv, [fv], [type], [guess])",
@@ -40949,7 +42179,7 @@ var sameKind = (a2, b) => typeof a2 === "number" && typeof b === "number" || typ
40949
42179
  var compareLookup = (a2, b) => a2 === null ? b === null ? 0 : 1 : b === null ? -1 : compareScalars(a2, b);
40950
42180
  function exactMatcher(lookup2, wildcards) {
40951
42181
  if (typeof lookup2 === "string" && wildcards && hasWildcards(lookup2)) {
40952
- const regex = wildcardRegex(lookup2);
42182
+ const regex = wildcardRegex2(lookup2);
40953
42183
  return (v) => typeof v === "string" && regex.test(v);
40954
42184
  }
40955
42185
  if (lookup2 === null) return (v) => v === null;
@@ -42043,10 +43273,10 @@ var SUM_FUNCTIONS = [
42043
43273
  // xlsx/formula/functions/math-more.ts
42044
43274
  var C22 = "Math & Trig";
42045
43275
  var MATH_MORE = [
42046
- numeric("SIN", C22, "SIN(number)", "The sine of an angle in radians.", 1, 1, Math.sin),
42047
- numeric("COS", C22, "COS(number)", "The cosine of an angle in radians.", 1, 1, Math.cos),
42048
- numeric("TAN", C22, "TAN(number)", "The tangent of an angle in radians.", 1, 1, Math.tan),
42049
- numeric(
43276
+ numeric2("SIN", C22, "SIN(number)", "The sine of an angle in radians.", 1, 1, Math.sin),
43277
+ numeric2("COS", C22, "COS(number)", "The cosine of an angle in radians.", 1, 1, Math.cos),
43278
+ numeric2("TAN", C22, "TAN(number)", "The tangent of an angle in radians.", 1, 1, Math.tan),
43279
+ numeric2(
42050
43280
  "ASIN",
42051
43281
  C22,
42052
43282
  "ASIN(number)",
@@ -42055,7 +43285,7 @@ var MATH_MORE = [
42055
43285
  1,
42056
43286
  (x) => domain(Math.abs(x) <= 1, Math.asin(x))
42057
43287
  ),
42058
- numeric(
43288
+ numeric2(
42059
43289
  "ACOS",
42060
43290
  C22,
42061
43291
  "ACOS(number)",
@@ -42064,8 +43294,8 @@ var MATH_MORE = [
42064
43294
  1,
42065
43295
  (x) => domain(Math.abs(x) <= 1, Math.acos(x))
42066
43296
  ),
42067
- numeric("ATAN", C22, "ATAN(number)", "The arctangent in radians.", 1, 1, Math.atan),
42068
- numeric(
43297
+ numeric2("ATAN", C22, "ATAN(number)", "The arctangent in radians.", 1, 1, Math.atan),
43298
+ numeric2(
42069
43299
  "ATAN2",
42070
43300
  C22,
42071
43301
  "ATAN2(x_num, y_num)",
@@ -42077,11 +43307,11 @@ var MATH_MORE = [
42077
43307
  return Math.atan2(y ?? 0, x);
42078
43308
  }
42079
43309
  ),
42080
- numeric("SINH", C22, "SINH(number)", "The hyperbolic sine.", 1, 1, Math.sinh),
42081
- numeric("COSH", C22, "COSH(number)", "The hyperbolic cosine.", 1, 1, Math.cosh),
42082
- numeric("TANH", C22, "TANH(number)", "The hyperbolic tangent.", 1, 1, Math.tanh),
42083
- numeric("ASINH", C22, "ASINH(number)", "The inverse hyperbolic sine.", 1, 1, Math.asinh),
42084
- numeric(
43310
+ numeric2("SINH", C22, "SINH(number)", "The hyperbolic sine.", 1, 1, Math.sinh),
43311
+ numeric2("COSH", C22, "COSH(number)", "The hyperbolic cosine.", 1, 1, Math.cosh),
43312
+ numeric2("TANH", C22, "TANH(number)", "The hyperbolic tangent.", 1, 1, Math.tanh),
43313
+ numeric2("ASINH", C22, "ASINH(number)", "The inverse hyperbolic sine.", 1, 1, Math.asinh),
43314
+ numeric2(
42085
43315
  "ACOSH",
42086
43316
  C22,
42087
43317
  "ACOSH(number)",
@@ -42090,7 +43320,7 @@ var MATH_MORE = [
42090
43320
  1,
42091
43321
  (x) => domain(x >= 1, Math.acosh(x))
42092
43322
  ),
42093
- numeric(
43323
+ numeric2(
42094
43324
  "ATANH",
42095
43325
  C22,
42096
43326
  "ATANH(number)",
@@ -42099,7 +43329,7 @@ var MATH_MORE = [
42099
43329
  1,
42100
43330
  (x) => domain(Math.abs(x) < 1, Math.atanh(x))
42101
43331
  ),
42102
- numeric(
43332
+ numeric2(
42103
43333
  "COT",
42104
43334
  C22,
42105
43335
  "COT(number)",
@@ -42108,7 +43338,7 @@ var MATH_MORE = [
42108
43338
  1,
42109
43339
  (x) => x === 0 ? fail(ERR.DIV0) : 1 / Math.tan(x)
42110
43340
  ),
42111
- numeric(
43341
+ numeric2(
42112
43342
  "COTH",
42113
43343
  C22,
42114
43344
  "COTH(number)",
@@ -42117,7 +43347,7 @@ var MATH_MORE = [
42117
43347
  1,
42118
43348
  (x) => x === 0 ? fail(ERR.DIV0) : 1 / Math.tanh(x)
42119
43349
  ),
42120
- numeric(
43350
+ numeric2(
42121
43351
  "CSC",
42122
43352
  C22,
42123
43353
  "CSC(number)",
@@ -42126,7 +43356,7 @@ var MATH_MORE = [
42126
43356
  1,
42127
43357
  (x) => x === 0 ? fail(ERR.DIV0) : 1 / Math.sin(x)
42128
43358
  ),
42129
- numeric(
43359
+ numeric2(
42130
43360
  "CSCH",
42131
43361
  C22,
42132
43362
  "CSCH(number)",
@@ -42135,10 +43365,10 @@ var MATH_MORE = [
42135
43365
  1,
42136
43366
  (x) => x === 0 ? fail(ERR.DIV0) : 1 / Math.sinh(x)
42137
43367
  ),
42138
- numeric("SEC", C22, "SEC(number)", "The secant of an angle.", 1, 1, (x) => 1 / Math.cos(x)),
42139
- numeric("SECH", C22, "SECH(number)", "The hyperbolic secant.", 1, 1, (x) => 1 / Math.cosh(x)),
42140
- numeric("ACOT", C22, "ACOT(number)", "The arccotangent.", 1, 1, (x) => Math.PI / 2 - Math.atan(x)),
42141
- numeric(
43368
+ numeric2("SEC", C22, "SEC(number)", "The secant of an angle.", 1, 1, (x) => 1 / Math.cos(x)),
43369
+ numeric2("SECH", C22, "SECH(number)", "The hyperbolic secant.", 1, 1, (x) => 1 / Math.cosh(x)),
43370
+ numeric2("ACOT", C22, "ACOT(number)", "The arccotangent.", 1, 1, (x) => Math.PI / 2 - Math.atan(x)),
43371
+ numeric2(
42142
43372
  "ACOTH",
42143
43373
  C22,
42144
43374
  "ACOTH(number)",
@@ -42147,7 +43377,7 @@ var MATH_MORE = [
42147
43377
  1,
42148
43378
  (x) => domain(Math.abs(x) > 1, 0.5 * Math.log((x + 1) / (x - 1)))
42149
43379
  ),
42150
- numeric(
43380
+ numeric2(
42151
43381
  "DEGREES",
42152
43382
  C22,
42153
43383
  "DEGREES(angle)",
@@ -42156,7 +43386,7 @@ var MATH_MORE = [
42156
43386
  1,
42157
43387
  (x) => x * 180 / Math.PI
42158
43388
  ),
42159
- numeric(
43389
+ numeric2(
42160
43390
  "RADIANS",
42161
43391
  C22,
42162
43392
  "RADIANS(angle)",
@@ -42237,14 +43467,14 @@ function integers(args, ctx) {
42237
43467
  });
42238
43468
  }
42239
43469
  var COMBINATORIC_FUNCTIONS = [
42240
- numeric("FACT", C23, "FACT(number)", "The factorial of a number.", 1, 1, fact),
42241
- numeric("FACTDOUBLE", C23, "FACTDOUBLE(number)", "The double factorial of a number.", 1, 1, (n) => {
43470
+ numeric2("FACT", C23, "FACT(number)", "The factorial of a number.", 1, 1, fact),
43471
+ numeric2("FACTDOUBLE", C23, "FACTDOUBLE(number)", "The double factorial of a number.", 1, 1, (n) => {
42242
43472
  if (n < -1) fail(ERR.NUM);
42243
43473
  let out = 1;
42244
43474
  for (let i2 = Math.trunc(n); i2 > 1; i2 -= 2) out *= i2;
42245
43475
  return out;
42246
43476
  }),
42247
- numeric(
43477
+ numeric2(
42248
43478
  "COMBIN",
42249
43479
  C23,
42250
43480
  "COMBIN(number, number_chosen)",
@@ -42253,7 +43483,7 @@ var COMBINATORIC_FUNCTIONS = [
42253
43483
  2,
42254
43484
  (n, k) => combin(n, k ?? 0)
42255
43485
  ),
42256
- numeric(
43486
+ numeric2(
42257
43487
  "COMBINA",
42258
43488
  C23,
42259
43489
  "COMBINA(number, number_chosen)",
@@ -42358,8 +43588,8 @@ var quotientMultiple = (x, sig, op2) => {
42358
43588
  var MATH_FUNCTIONS = [
42359
43589
  ...MATH_MORE,
42360
43590
  ...SUM_FUNCTIONS,
42361
- numeric("ABS", C24, "ABS(number)", "The absolute value of a number.", 1, 1, Math.abs),
42362
- numeric(
43591
+ numeric2("ABS", C24, "ABS(number)", "The absolute value of a number.", 1, 1, Math.abs),
43592
+ numeric2(
42363
43593
  "SIGN",
42364
43594
  C24,
42365
43595
  "SIGN(number)",
@@ -42368,7 +43598,7 @@ var MATH_FUNCTIONS = [
42368
43598
  1,
42369
43599
  (x) => Math.sign(x)
42370
43600
  ),
42371
- numeric(
43601
+ numeric2(
42372
43602
  "INT",
42373
43603
  C24,
42374
43604
  "INT(number)",
@@ -42377,7 +43607,7 @@ var MATH_FUNCTIONS = [
42377
43607
  1,
42378
43608
  Math.floor
42379
43609
  ),
42380
- numeric(
43610
+ numeric2(
42381
43611
  "TRUNC",
42382
43612
  C24,
42383
43613
  "TRUNC(number, [num_digits])",
@@ -42386,7 +43616,7 @@ var MATH_FUNCTIONS = [
42386
43616
  2,
42387
43617
  (x, d) => roundTo(x, d ?? 0, "down")
42388
43618
  ),
42389
- numeric(
43619
+ numeric2(
42390
43620
  "ROUND",
42391
43621
  C24,
42392
43622
  "ROUND(number, num_digits)",
@@ -42395,7 +43625,7 @@ var MATH_FUNCTIONS = [
42395
43625
  2,
42396
43626
  (x, d) => roundTo(x, d ?? 0, "half")
42397
43627
  ),
42398
- numeric(
43628
+ numeric2(
42399
43629
  "ROUNDUP",
42400
43630
  C24,
42401
43631
  "ROUNDUP(number, num_digits)",
@@ -42404,7 +43634,7 @@ var MATH_FUNCTIONS = [
42404
43634
  2,
42405
43635
  (x, d) => roundTo(x, d ?? 0, "up")
42406
43636
  ),
42407
- numeric(
43637
+ numeric2(
42408
43638
  "ROUNDDOWN",
42409
43639
  C24,
42410
43640
  "ROUNDDOWN(number, num_digits)",
@@ -42413,7 +43643,7 @@ var MATH_FUNCTIONS = [
42413
43643
  2,
42414
43644
  (x, d) => roundTo(x, d ?? 0, "down")
42415
43645
  ),
42416
- numeric(
43646
+ numeric2(
42417
43647
  "MROUND",
42418
43648
  C24,
42419
43649
  "MROUND(number, multiple)",
@@ -42422,7 +43652,7 @@ var MATH_FUNCTIONS = [
42422
43652
  2,
42423
43653
  (x, m) => mround(x, m ?? 0)
42424
43654
  ),
42425
- numeric(
43655
+ numeric2(
42426
43656
  "CEILING",
42427
43657
  C24,
42428
43658
  "CEILING(number, significance)",
@@ -42434,7 +43664,7 @@ var MATH_FUNCTIONS = [
42434
43664
  return quotientMultiple(x, s ?? 0, Math.ceil);
42435
43665
  }
42436
43666
  ),
42437
- numeric(
43667
+ numeric2(
42438
43668
  "FLOOR",
42439
43669
  C24,
42440
43670
  "FLOOR(number, significance)",
@@ -42447,7 +43677,7 @@ var MATH_FUNCTIONS = [
42447
43677
  return quotientMultiple(x, s ?? 1, Math.floor);
42448
43678
  }
42449
43679
  ),
42450
- numeric(
43680
+ numeric2(
42451
43681
  "CEILING.MATH",
42452
43682
  C24,
42453
43683
  "CEILING.MATH(number, [significance], [mode])",
@@ -42460,7 +43690,7 @@ var MATH_FUNCTIONS = [
42460
43690
  return quotientMultiple(x, sig, Math.ceil);
42461
43691
  }
42462
43692
  ),
42463
- numeric(
43693
+ numeric2(
42464
43694
  "FLOOR.MATH",
42465
43695
  C24,
42466
43696
  "FLOOR.MATH(number, [significance], [mode])",
@@ -42473,7 +43703,7 @@ var MATH_FUNCTIONS = [
42473
43703
  return quotientMultiple(x, sig, Math.floor);
42474
43704
  }
42475
43705
  ),
42476
- numeric(
43706
+ numeric2(
42477
43707
  "CEILING.PRECISE",
42478
43708
  C24,
42479
43709
  "CEILING.PRECISE(number, [significance])",
@@ -42482,7 +43712,7 @@ var MATH_FUNCTIONS = [
42482
43712
  2,
42483
43713
  (x, s) => quotientMultiple(x, Math.abs(s ?? 1), Math.ceil)
42484
43714
  ),
42485
- numeric(
43715
+ numeric2(
42486
43716
  "ISO.CEILING",
42487
43717
  C24,
42488
43718
  "ISO.CEILING(number, [significance])",
@@ -42491,7 +43721,7 @@ var MATH_FUNCTIONS = [
42491
43721
  2,
42492
43722
  (x, s) => quotientMultiple(x, Math.abs(s ?? 1), Math.ceil)
42493
43723
  ),
42494
- numeric(
43724
+ numeric2(
42495
43725
  "FLOOR.PRECISE",
42496
43726
  C24,
42497
43727
  "FLOOR.PRECISE(number, [significance])",
@@ -42500,7 +43730,7 @@ var MATH_FUNCTIONS = [
42500
43730
  2,
42501
43731
  (x, s) => quotientMultiple(x, Math.abs(s ?? 1), Math.floor)
42502
43732
  ),
42503
- numeric(
43733
+ numeric2(
42504
43734
  "EVEN",
42505
43735
  C24,
42506
43736
  "EVEN(number)",
@@ -42509,7 +43739,7 @@ var MATH_FUNCTIONS = [
42509
43739
  1,
42510
43740
  (x) => Math.sign(x) * Math.ceil(round15(Math.abs(x)) / 2) * 2
42511
43741
  ),
42512
- numeric(
43742
+ numeric2(
42513
43743
  "ODD",
42514
43744
  C24,
42515
43745
  "ODD(number)",
@@ -42521,7 +43751,7 @@ var MATH_FUNCTIONS = [
42521
43751
  return (x < 0 ? -1 : 1) * (n % 2 === 0 ? n + 1 : n);
42522
43752
  }
42523
43753
  ),
42524
- numeric(
43754
+ numeric2(
42525
43755
  "MOD",
42526
43756
  C24,
42527
43757
  "MOD(number, divisor)",
@@ -42530,7 +43760,7 @@ var MATH_FUNCTIONS = [
42530
43760
  2,
42531
43761
  (n, d) => excelMod(n, d ?? 0)
42532
43762
  ),
42533
- numeric(
43763
+ numeric2(
42534
43764
  "QUOTIENT",
42535
43765
  C24,
42536
43766
  "QUOTIENT(numerator, denominator)",
@@ -42542,7 +43772,7 @@ var MATH_FUNCTIONS = [
42542
43772
  return Math.trunc(n / (d ?? 1));
42543
43773
  }
42544
43774
  ),
42545
- numeric(
43775
+ numeric2(
42546
43776
  "SQRT",
42547
43777
  C24,
42548
43778
  "SQRT(number)",
@@ -42551,7 +43781,7 @@ var MATH_FUNCTIONS = [
42551
43781
  1,
42552
43782
  (x) => domain(x >= 0, Math.sqrt(x))
42553
43783
  ),
42554
- numeric(
43784
+ numeric2(
42555
43785
  "SQRTPI",
42556
43786
  C24,
42557
43787
  "SQRTPI(number)",
@@ -42560,7 +43790,7 @@ var MATH_FUNCTIONS = [
42560
43790
  1,
42561
43791
  (x) => domain(x >= 0, Math.sqrt(x * Math.PI))
42562
43792
  ),
42563
- numeric(
43793
+ numeric2(
42564
43794
  "POWER",
42565
43795
  C24,
42566
43796
  "POWER(number, power)",
@@ -42569,9 +43799,9 @@ var MATH_FUNCTIONS = [
42569
43799
  2,
42570
43800
  (b, e) => power(b, e ?? 1)
42571
43801
  ),
42572
- numeric("EXP", C24, "EXP(number)", "e raised to a power.", 1, 1, Math.exp),
42573
- numeric("LN", C24, "LN(number)", "The natural logarithm.", 1, 1, (x) => domain(x > 0, Math.log(x))),
42574
- numeric(
43802
+ numeric2("EXP", C24, "EXP(number)", "e raised to a power.", 1, 1, Math.exp),
43803
+ numeric2("LN", C24, "LN(number)", "The natural logarithm.", 1, 1, (x) => domain(x > 0, Math.log(x))),
43804
+ numeric2(
42575
43805
  "LOG10",
42576
43806
  C24,
42577
43807
  "LOG10(number)",
@@ -42580,7 +43810,7 @@ var MATH_FUNCTIONS = [
42580
43810
  1,
42581
43811
  (x) => domain(x > 0, Math.log10(x))
42582
43812
  ),
42583
- numeric(
43813
+ numeric2(
42584
43814
  "LOG",
42585
43815
  C24,
42586
43816
  "LOG(number, [base])",
@@ -42594,7 +43824,7 @@ var MATH_FUNCTIONS = [
42594
43824
  return base === 10 ? Math.log10(x) : Math.log(x) / Math.log(base);
42595
43825
  }
42596
43826
  ),
42597
- numeric("PI", C24, "PI()", "The value of pi.", 0, 0, () => Math.PI),
43827
+ numeric2("PI", C24, "PI()", "The value of pi.", 0, 0, () => Math.PI),
42598
43828
  ...COMBINATORIC_FUNCTIONS
42599
43829
  ];
42600
43830
 
@@ -44037,7 +45267,7 @@ var negbinomPmf = (f6, s, p) => {
44037
45267
  return combin(ff + ss - 1, ss - 1) * Math.pow(p, ss) * Math.pow(1 - p, ff);
44038
45268
  };
44039
45269
  var DISTRIBUTION_F = [
44040
- numeric(
45270
+ numeric2(
44041
45271
  "F.DIST",
44042
45272
  C28,
44043
45273
  "F.DIST(x, deg_freedom1, deg_freedom2, cumulative)",
@@ -44053,7 +45283,7 @@ var DISTRIBUTION_F = [
44053
45283
  }
44054
45284
  ),
44055
45285
  ...["F.DIST.RT", "FDIST"].map(
44056
- (name) => numeric(
45286
+ (name) => numeric2(
44057
45287
  name,
44058
45288
  C28,
44059
45289
  `${name}(x, deg_freedom1, deg_freedom2)`,
@@ -44067,7 +45297,7 @@ var DISTRIBUTION_F = [
44067
45297
  }
44068
45298
  )
44069
45299
  ),
44070
- numeric(
45300
+ numeric2(
44071
45301
  "F.INV",
44072
45302
  C28,
44073
45303
  "F.INV(probability, deg_freedom1, deg_freedom2)",
@@ -44081,7 +45311,7 @@ var DISTRIBUTION_F = [
44081
45311
  }
44082
45312
  ),
44083
45313
  ...["F.INV.RT", "FINV"].map(
44084
- (name) => numeric(
45314
+ (name) => numeric2(
44085
45315
  name,
44086
45316
  C28,
44087
45317
  `${name}(probability, deg_freedom1, deg_freedom2)`,
@@ -44096,7 +45326,7 @@ var DISTRIBUTION_F = [
44096
45326
  )
44097
45327
  ),
44098
45328
  ...["BETA.INV", "BETAINV"].map(
44099
- (name) => numeric(
45329
+ (name) => numeric2(
44100
45330
  name,
44101
45331
  C28,
44102
45332
  `${name}(probability, alpha, beta, [A], [B])`,
@@ -44107,7 +45337,7 @@ var DISTRIBUTION_F = [
44107
45337
  [0, 0, 0, 0, 1]
44108
45338
  )
44109
45339
  ),
44110
- numeric(
45340
+ numeric2(
44111
45341
  "BETADIST",
44112
45342
  C28,
44113
45343
  "BETADIST(x, alpha, beta, [A], [B])",
@@ -44121,7 +45351,7 @@ var DISTRIBUTION_F = [
44121
45351
  [0, 0, 0, 0, 1]
44122
45352
  ),
44123
45353
  ...["GAMMA.INV", "GAMMAINV"].map(
44124
- (name) => numeric(
45354
+ (name) => numeric2(
44125
45355
  name,
44126
45356
  C28,
44127
45357
  `${name}(probability, alpha, beta)`,
@@ -44131,7 +45361,7 @@ var DISTRIBUTION_F = [
44131
45361
  (p, a2, b) => gammaInverse(p, a2 ?? 1, b ?? 1)
44132
45362
  )
44133
45363
  ),
44134
- numeric(
45364
+ numeric2(
44135
45365
  "GAMMADIST",
44136
45366
  C28,
44137
45367
  "GAMMADIST(x, alpha, beta, cumulative)",
@@ -44146,7 +45376,7 @@ var DISTRIBUTION_F = [
44146
45376
  return c2 ? gammaP(al, x / be) : Math.exp((al - 1) * Math.log(x) - x / be - gammaLn(al) - al * Math.log(be));
44147
45377
  }
44148
45378
  ),
44149
- numeric(
45379
+ numeric2(
44150
45380
  "LOGINV",
44151
45381
  C28,
44152
45382
  "LOGINV(probability, mean, standard_dev)",
@@ -44159,7 +45389,7 @@ var DISTRIBUTION_F = [
44159
45389
  return Math.exp((m ?? 0) + (s ?? 1) * normInv(p));
44160
45390
  }
44161
45391
  ),
44162
- numeric(
45392
+ numeric2(
44163
45393
  "LOGNORMDIST",
44164
45394
  C28,
44165
45395
  "LOGNORMDIST(x, mean, standard_dev)",
@@ -44172,7 +45402,7 @@ var DISTRIBUTION_F = [
44172
45402
  }
44173
45403
  ),
44174
45404
  ...["BINOM.INV", "CRITBINOM"].map(
44175
- (name) => numeric(
45405
+ (name) => numeric2(
44176
45406
  name,
44177
45407
  C28,
44178
45408
  `${name}(trials, probability_s, alpha)`,
@@ -44182,7 +45412,7 @@ var DISTRIBUTION_F = [
44182
45412
  (n, p, alpha) => binomInverse(n, p ?? 0, alpha ?? 0)
44183
45413
  )
44184
45414
  ),
44185
- numeric(
45415
+ numeric2(
44186
45416
  "BINOM.DIST.RANGE",
44187
45417
  C28,
44188
45418
  "BINOM.DIST.RANGE(trials, probability_s, number_s, [number_s2])",
@@ -44200,7 +45430,7 @@ var DISTRIBUTION_F = [
44200
45430
  return Math.min(1, total2);
44201
45431
  }
44202
45432
  ),
44203
- numeric(
45433
+ numeric2(
44204
45434
  "HYPGEOMDIST",
44205
45435
  C28,
44206
45436
  "HYPGEOMDIST(sample_s, number_sample, population_s, number_pop)",
@@ -44209,7 +45439,7 @@ var DISTRIBUTION_F = [
44209
45439
  4,
44210
45440
  hypgeomPmf
44211
45441
  ),
44212
- numeric(
45442
+ numeric2(
44213
45443
  "NEGBINOMDIST",
44214
45444
  C28,
44215
45445
  "NEGBINOMDIST(number_f, number_s, probability_s)",
@@ -44339,7 +45569,7 @@ var STATISTICAL_SHAPE = [
44339
45569
  },
44340
45570
  ["any"]
44341
45571
  ),
44342
- numeric(
45572
+ numeric2(
44343
45573
  "STANDARDIZE",
44344
45574
  C29,
44345
45575
  "STANDARDIZE(x, mean, standard_dev)",
@@ -44377,7 +45607,7 @@ var STATISTICAL_SHAPE = [
44377
45607
  (args, ctx) => frequency(collectNumbers(ctx, [args[0] ?? null]), collectNumbers(ctx, [args[1] ?? null])),
44378
45608
  ["any"]
44379
45609
  ),
44380
- numeric(
45610
+ numeric2(
44381
45611
  "PERMUT",
44382
45612
  C29,
44383
45613
  "PERMUT(number, number_chosen)",
@@ -44393,7 +45623,7 @@ var STATISTICAL_SHAPE = [
44393
45623
  return out;
44394
45624
  }
44395
45625
  ),
44396
- numeric(
45626
+ numeric2(
44397
45627
  "PERMUTATIONA",
44398
45628
  C29,
44399
45629
  "PERMUTATIONA(number, number_chosen)",
@@ -44405,11 +45635,11 @@ var STATISTICAL_SHAPE = [
44405
45635
  return Math.pow(Math.trunc(n), Math.trunc(k ?? 0));
44406
45636
  }
44407
45637
  ),
44408
- numeric("FISHER", C29, "FISHER(x)", "The Fisher transformation.", 1, 1, (x) => {
45638
+ numeric2("FISHER", C29, "FISHER(x)", "The Fisher transformation.", 1, 1, (x) => {
44409
45639
  if (x <= -1 || x >= 1) fail(ERR.NUM);
44410
45640
  return 0.5 * Math.log((1 + x) / (1 - x));
44411
45641
  }),
44412
- numeric(
45642
+ numeric2(
44413
45643
  "FISHERINV",
44414
45644
  C29,
44415
45645
  "FISHERINV(y)",
@@ -44418,11 +45648,11 @@ var STATISTICAL_SHAPE = [
44418
45648
  1,
44419
45649
  (y) => Math.tanh(y)
44420
45650
  ),
44421
- numeric("GAMMA", C29, "GAMMA(number)", "The gamma function value.", 1, 1, (x) => {
45651
+ numeric2("GAMMA", C29, "GAMMA(number)", "The gamma function value.", 1, 1, (x) => {
44422
45652
  if (x <= 0 && Number.isInteger(x)) fail(ERR.NUM);
44423
45653
  return gamma(x);
44424
45654
  }),
44425
- numeric(
45655
+ numeric2(
44426
45656
  "GAMMALN",
44427
45657
  C29,
44428
45658
  "GAMMALN(x)",
@@ -44431,7 +45661,7 @@ var STATISTICAL_SHAPE = [
44431
45661
  1,
44432
45662
  gammaLn
44433
45663
  ),
44434
- numeric(
45664
+ numeric2(
44435
45665
  "GAMMALN.PRECISE",
44436
45666
  C29,
44437
45667
  "GAMMALN.PRECISE(x)",
@@ -45139,7 +46369,7 @@ var STATISTICAL_FUNCTIONS = [
45139
46369
  const x = num4(args[0]);
45140
46370
  const values2 = collectNumbers(ctx, [args[1] ?? null]);
45141
46371
  const ascending = args.length > 2 && num4(args[2]) !== 0;
45142
- return rank2(values2, x, ascending, name === "RANK.AVG");
46372
+ return rank3(values2, x, ascending, name === "RANK.AVG");
45143
46373
  },
45144
46374
  ["value", "any", "value"]
45145
46375
  )
@@ -45149,7 +46379,7 @@ var STATISTICAL_FUNCTIONS = [
45149
46379
  // xlsx/formula/functions/distributions-more.ts
45150
46380
  var C35 = "Statistical";
45151
46381
  var DISTRIBUTION_MORE = [
45152
- numeric(
46382
+ numeric2(
45153
46383
  "T.DIST",
45154
46384
  C35,
45155
46385
  "T.DIST(x, deg_freedom, cumulative)",
@@ -45161,7 +46391,7 @@ var DISTRIBUTION_MORE = [
45161
46391
  return c2 ? tCdf(x, Math.trunc(df ?? 1)) : tPdf(x, Math.trunc(df ?? 1));
45162
46392
  }
45163
46393
  ),
45164
- numeric(
46394
+ numeric2(
45165
46395
  "T.DIST.RT",
45166
46396
  C35,
45167
46397
  "T.DIST.RT(x, deg_freedom)",
@@ -45173,7 +46403,7 @@ var DISTRIBUTION_MORE = [
45173
46403
  return 1 - tCdf(x, Math.trunc(df ?? 1));
45174
46404
  }
45175
46405
  ),
45176
- numeric(
46406
+ numeric2(
45177
46407
  "T.DIST.2T",
45178
46408
  C35,
45179
46409
  "T.DIST.2T(x, deg_freedom)",
@@ -45185,7 +46415,7 @@ var DISTRIBUTION_MORE = [
45185
46415
  return 2 * (1 - tCdf(x, Math.trunc(df ?? 1)));
45186
46416
  }
45187
46417
  ),
45188
- numeric(
46418
+ numeric2(
45189
46419
  "TDIST",
45190
46420
  C35,
45191
46421
  "TDIST(x, deg_freedom, tails)",
@@ -45197,7 +46427,7 @@ var DISTRIBUTION_MORE = [
45197
46427
  return (tails ?? 1) * (1 - tCdf(x, Math.trunc(df ?? 1)));
45198
46428
  }
45199
46429
  ),
45200
- numeric(
46430
+ numeric2(
45201
46431
  "T.INV",
45202
46432
  C35,
45203
46433
  "T.INV(probability, deg_freedom)",
@@ -45212,7 +46442,7 @@ var DISTRIBUTION_MORE = [
45212
46442
  }
45213
46443
  ),
45214
46444
  ...["T.INV.2T", "TINV"].map(
45215
- (name) => numeric(
46445
+ (name) => numeric2(
45216
46446
  name,
45217
46447
  C35,
45218
46448
  `${name}(probability, deg_freedom)`,
@@ -45225,7 +46455,7 @@ var DISTRIBUTION_MORE = [
45225
46455
  }
45226
46456
  )
45227
46457
  ),
45228
- numeric(
46458
+ numeric2(
45229
46459
  "CHISQ.DIST",
45230
46460
  C35,
45231
46461
  "CHISQ.DIST(x, deg_freedom, cumulative)",
@@ -45239,7 +46469,7 @@ var DISTRIBUTION_MORE = [
45239
46469
  }
45240
46470
  ),
45241
46471
  ...["CHISQ.DIST.RT", "CHIDIST"].map(
45242
- (name) => numeric(
46472
+ (name) => numeric2(
45243
46473
  name,
45244
46474
  C35,
45245
46475
  `${name}(x, deg_freedom)`,
@@ -45252,7 +46482,7 @@ var DISTRIBUTION_MORE = [
45252
46482
  }
45253
46483
  )
45254
46484
  ),
45255
- numeric(
46485
+ numeric2(
45256
46486
  "CHISQ.INV",
45257
46487
  C35,
45258
46488
  "CHISQ.INV(probability, deg_freedom)",
@@ -45265,7 +46495,7 @@ var DISTRIBUTION_MORE = [
45265
46495
  }
45266
46496
  ),
45267
46497
  ...["CHISQ.INV.RT", "CHIINV"].map(
45268
- (name) => numeric(
46498
+ (name) => numeric2(
45269
46499
  name,
45270
46500
  C35,
45271
46501
  `${name}(probability, deg_freedom)`,
@@ -45278,7 +46508,7 @@ var DISTRIBUTION_MORE = [
45278
46508
  }
45279
46509
  )
45280
46510
  ),
45281
- numeric(
46511
+ numeric2(
45282
46512
  "BETA.DIST",
45283
46513
  C35,
45284
46514
  "BETA.DIST(x, alpha, beta, cumulative, [A], [B])",
@@ -45298,7 +46528,7 @@ var DISTRIBUTION_MORE = [
45298
46528
  return Math.exp((al - 1) * Math.log(t) + (be - 1) * Math.log(1 - t) - lnB) / (B - A2);
45299
46529
  }
45300
46530
  ),
45301
- numeric(
46531
+ numeric2(
45302
46532
  "NEGBINOM.DIST",
45303
46533
  C35,
45304
46534
  "NEGBINOM.DIST(number_f, number_s, probability_s, cumulative)",
@@ -45317,7 +46547,7 @@ var DISTRIBUTION_MORE = [
45317
46547
  return total2;
45318
46548
  }
45319
46549
  ),
45320
- numeric(
46550
+ numeric2(
45321
46551
  "HYPGEOM.DIST",
45322
46552
  C35,
45323
46553
  "HYPGEOM.DIST(sample_s, number_sample, population_s, number_pop, cumulative)",
@@ -45344,7 +46574,7 @@ var C36 = "Statistical";
45344
46574
  var DISTRIBUTION_FUNCTIONS = [
45345
46575
  ...DISTRIBUTION_MORE,
45346
46576
  ...DISTRIBUTION_F,
45347
- numeric(
46577
+ numeric2(
45348
46578
  "NORM.DIST",
45349
46579
  C36,
45350
46580
  "NORM.DIST(x, mean, standard_dev, cumulative)",
@@ -45353,7 +46583,7 @@ var DISTRIBUTION_FUNCTIONS = [
45353
46583
  4,
45354
46584
  (x, m, s, c2) => normDist(x, m ?? 0, s ?? 1, c2 ?? 0)
45355
46585
  ),
45356
- numeric(
46586
+ numeric2(
45357
46587
  "NORMDIST",
45358
46588
  C36,
45359
46589
  "NORMDIST(x, mean, standard_dev, cumulative)",
@@ -45362,7 +46592,7 @@ var DISTRIBUTION_FUNCTIONS = [
45362
46592
  4,
45363
46593
  (x, m, s, c2) => normDist(x, m ?? 0, s ?? 1, c2 ?? 0)
45364
46594
  ),
45365
- numeric(
46595
+ numeric2(
45366
46596
  "NORM.S.DIST",
45367
46597
  C36,
45368
46598
  "NORM.S.DIST(z, cumulative)",
@@ -45371,7 +46601,7 @@ var DISTRIBUTION_FUNCTIONS = [
45371
46601
  2,
45372
46602
  (z, c2) => c2 ? normCdf(z) : normPdf(z)
45373
46603
  ),
45374
- numeric(
46604
+ numeric2(
45375
46605
  "NORMSDIST",
45376
46606
  C36,
45377
46607
  "NORMSDIST(z)",
@@ -45380,7 +46610,7 @@ var DISTRIBUTION_FUNCTIONS = [
45380
46610
  1,
45381
46611
  normCdf
45382
46612
  ),
45383
- numeric(
46613
+ numeric2(
45384
46614
  "NORM.INV",
45385
46615
  C36,
45386
46616
  "NORM.INV(probability, mean, standard_dev)",
@@ -45392,7 +46622,7 @@ var DISTRIBUTION_FUNCTIONS = [
45392
46622
  return (m ?? 0) + (s ?? 1) * normInv(p);
45393
46623
  }
45394
46624
  ),
45395
- numeric(
46625
+ numeric2(
45396
46626
  "NORMINV",
45397
46627
  C36,
45398
46628
  "NORMINV(probability, mean, standard_dev)",
@@ -45404,7 +46634,7 @@ var DISTRIBUTION_FUNCTIONS = [
45404
46634
  return (m ?? 0) + (s ?? 1) * normInv(p);
45405
46635
  }
45406
46636
  ),
45407
- numeric(
46637
+ numeric2(
45408
46638
  "NORM.S.INV",
45409
46639
  C36,
45410
46640
  "NORM.S.INV(probability)",
@@ -45413,7 +46643,7 @@ var DISTRIBUTION_FUNCTIONS = [
45413
46643
  1,
45414
46644
  normInv
45415
46645
  ),
45416
- numeric(
46646
+ numeric2(
45417
46647
  "NORMSINV",
45418
46648
  C36,
45419
46649
  "NORMSINV(probability)",
@@ -45422,8 +46652,8 @@ var DISTRIBUTION_FUNCTIONS = [
45422
46652
  1,
45423
46653
  normInv
45424
46654
  ),
45425
- numeric("PHI", C36, "PHI(x)", "The standard normal density.", 1, 1, normPdf),
45426
- numeric(
46655
+ numeric2("PHI", C36, "PHI(x)", "The standard normal density.", 1, 1, normPdf),
46656
+ numeric2(
45427
46657
  "GAUSS",
45428
46658
  C36,
45429
46659
  "GAUSS(z)",
@@ -45432,7 +46662,7 @@ var DISTRIBUTION_FUNCTIONS = [
45432
46662
  1,
45433
46663
  (z) => normCdf(z) - 0.5
45434
46664
  ),
45435
- numeric(
46665
+ numeric2(
45436
46666
  "ERF",
45437
46667
  "Engineering",
45438
46668
  "ERF(lower_limit, [upper_limit])",
@@ -45441,8 +46671,8 @@ var DISTRIBUTION_FUNCTIONS = [
45441
46671
  2,
45442
46672
  (a2, b) => b === void 0 ? erf(a2) : erf(b) - erf(a2)
45443
46673
  ),
45444
- numeric("ERF.PRECISE", "Engineering", "ERF.PRECISE(x)", "The error function.", 1, 1, erf),
45445
- numeric(
46674
+ numeric2("ERF.PRECISE", "Engineering", "ERF.PRECISE(x)", "The error function.", 1, 1, erf),
46675
+ numeric2(
45446
46676
  "ERFC",
45447
46677
  "Engineering",
45448
46678
  "ERFC(x)",
@@ -45451,7 +46681,7 @@ var DISTRIBUTION_FUNCTIONS = [
45451
46681
  1,
45452
46682
  (x) => 1 - erf(x)
45453
46683
  ),
45454
- numeric(
46684
+ numeric2(
45455
46685
  "ERFC.PRECISE",
45456
46686
  "Engineering",
45457
46687
  "ERFC.PRECISE(x)",
@@ -45461,7 +46691,7 @@ var DISTRIBUTION_FUNCTIONS = [
45461
46691
  (x) => 1 - erf(x)
45462
46692
  ),
45463
46693
  ...["CONFIDENCE", "CONFIDENCE.NORM"].map(
45464
- (name) => numeric(
46694
+ (name) => numeric2(
45465
46695
  name,
45466
46696
  C36,
45467
46697
  `${name}(alpha, standard_dev, size)`,
@@ -45476,7 +46706,7 @@ var DISTRIBUTION_FUNCTIONS = [
45476
46706
  }
45477
46707
  )
45478
46708
  ),
45479
- numeric(
46709
+ numeric2(
45480
46710
  "CONFIDENCE.T",
45481
46711
  C36,
45482
46712
  "CONFIDENCE.T(alpha, standard_dev, size)",
@@ -45492,7 +46722,7 @@ var DISTRIBUTION_FUNCTIONS = [
45492
46722
  }
45493
46723
  ),
45494
46724
  ...["BINOM.DIST", "BINOMDIST"].map(
45495
- (name) => numeric(
46725
+ (name) => numeric2(
45496
46726
  name,
45497
46727
  C36,
45498
46728
  `${name}(number_s, trials, probability_s, cumulative)`,
@@ -45503,7 +46733,7 @@ var DISTRIBUTION_FUNCTIONS = [
45503
46733
  )
45504
46734
  ),
45505
46735
  ...["POISSON.DIST", "POISSON"].map(
45506
- (name) => numeric(
46736
+ (name) => numeric2(
45507
46737
  name,
45508
46738
  C36,
45509
46739
  `${name}(x, mean, cumulative)`,
@@ -45514,7 +46744,7 @@ var DISTRIBUTION_FUNCTIONS = [
45514
46744
  )
45515
46745
  ),
45516
46746
  ...["EXPON.DIST", "EXPONDIST"].map(
45517
- (name) => numeric(
46747
+ (name) => numeric2(
45518
46748
  name,
45519
46749
  C36,
45520
46750
  `${name}(x, lambda, cumulative)`,
@@ -45528,7 +46758,7 @@ var DISTRIBUTION_FUNCTIONS = [
45528
46758
  }
45529
46759
  )
45530
46760
  ),
45531
- numeric(
46761
+ numeric2(
45532
46762
  "LOGNORM.DIST",
45533
46763
  C36,
45534
46764
  "LOGNORM.DIST(x, mean, standard_dev, cumulative)",
@@ -45541,7 +46771,7 @@ var DISTRIBUTION_FUNCTIONS = [
45541
46771
  return c2 ? normCdf(z) : normPdf(z) / (x * (s ?? 1));
45542
46772
  }
45543
46773
  ),
45544
- numeric(
46774
+ numeric2(
45545
46775
  "LOGNORM.INV",
45546
46776
  C36,
45547
46777
  "LOGNORM.INV(probability, mean, standard_dev)",
@@ -45554,7 +46784,7 @@ var DISTRIBUTION_FUNCTIONS = [
45554
46784
  }
45555
46785
  ),
45556
46786
  ...["WEIBULL.DIST", "WEIBULL"].map(
45557
- (name) => numeric(
46787
+ (name) => numeric2(
45558
46788
  name,
45559
46789
  C36,
45560
46790
  `${name}(x, alpha, beta, cumulative)`,
@@ -45570,7 +46800,7 @@ var DISTRIBUTION_FUNCTIONS = [
45570
46800
  }
45571
46801
  )
45572
46802
  ),
45573
- numeric(
46803
+ numeric2(
45574
46804
  "GAMMA.DIST",
45575
46805
  C36,
45576
46806
  "GAMMA.DIST(x, alpha, beta, cumulative)",
@@ -45788,7 +47018,7 @@ function find2(args, insensitive) {
45788
47018
  const at2 = haystack.indexOf(needle, from);
45789
47019
  return at2 < 0 ? fail(ERR.VALUE) : at2 + 1;
45790
47020
  }
45791
- const at = wildcardRegex(needle).search(haystack, from);
47021
+ const at = wildcardRegex2(needle).search(haystack, from);
45792
47022
  return at < 0 ? fail(ERR.VALUE) : at + 1;
45793
47023
  }
45794
47024
  function joinValues(ctx, args) {
@@ -46973,7 +48203,7 @@ function patchChartFormulas2(xml, edits) {
46973
48203
  if (open && gt === -1) break;
46974
48204
  if (open) {
46975
48205
  const prefix = open[1] ?? "";
46976
- const attrs2 = xml.slice(FORMULA_OPEN.lastIndex, gt);
48206
+ const attrs3 = xml.slice(FORMULA_OPEN.lastIndex, gt);
46977
48207
  const lt = xml.indexOf("<", gt + 1);
46978
48208
  const close2 = [`</${prefix}f>`, "</f>"].find((c2) => lt !== -1 && xml.startsWith(c2, lt));
46979
48209
  if (lt !== -1 && close2 !== void 0) {
@@ -46981,7 +48211,7 @@ function patchChartFormulas2(xml, edits) {
46981
48211
  const next = patchCarriedFormula(formula2, "", edits);
46982
48212
  const end = lt + close2.length;
46983
48213
  if (next !== formula2) {
46984
- out += `${xml.slice(copied, at)}<${prefix}f${attrs2}>${escapeXmlText(next)}</${prefix}f>`;
48214
+ out += `${xml.slice(copied, at)}<${prefix}f${attrs3}>${escapeXmlText(next)}</${prefix}f>`;
46985
48215
  copied = end;
46986
48216
  }
46987
48217
  at = xml.indexOf("<", end);
@@ -47005,11 +48235,11 @@ function findWorksheetSource(xml) {
47005
48235
  const gt = nextGt(after);
47006
48236
  if (gt === -1) return void 0;
47007
48237
  const selfClose = xml[gt - 1] === "/" && gt - 1 > after;
47008
- const attrs2 = xml.slice(after, selfClose ? gt - 1 : gt);
48238
+ const attrs3 = xml.slice(after, selfClose ? gt - 1 : gt);
47009
48239
  return [
47010
48240
  xml.slice(start - 1, gt + 1),
47011
48241
  `${prefix}worksheetSource`,
47012
- attrs2,
48242
+ attrs3,
47013
48243
  selfClose ? "/" : ""
47014
48244
  ];
47015
48245
  }
@@ -47022,10 +48252,10 @@ var attrPattern = (name) => new RegExp(`(\\s${name}\\s*=\\s*)(["'])(.*?)\\2`);
47022
48252
  function patchWorksheetSource(xml, edits) {
47023
48253
  const match2 = findWorksheetSource(xml);
47024
48254
  if (!match2) return xml;
47025
- const [whole, tag, attrs2 = "", close2] = match2;
47026
- if (/\sr:id\s*=/.test(attrs2)) return xml;
47027
- const sheetMatch = attrPattern("sheet").exec(attrs2);
47028
- const refMatch = attrPattern("ref").exec(attrs2);
48255
+ const [whole, tag, attrs3 = "", close2] = match2;
48256
+ if (/\sr:id\s*=/.test(attrs3)) return xml;
48257
+ const sheetMatch = attrPattern("sheet").exec(attrs3);
48258
+ const refMatch = attrPattern("ref").exec(attrs3);
47029
48259
  if (!sheetMatch || !refMatch) return xml;
47030
48260
  const sheet = unescapeXml(sheetMatch[3] ?? "");
47031
48261
  const ref = unescapeXml(refMatch[3] ?? "");
@@ -47037,7 +48267,7 @@ function patchWorksheetSource(xml, edits) {
47037
48267
  const rename = edits.renamed.find(([from]) => from.toLowerCase() === sheet.toLowerCase());
47038
48268
  const nextSheet = rename ? rename[1] : sheet;
47039
48269
  if (nextRef === ref && nextSheet === sheet) return xml;
47040
- let nextAttrs = attrs2;
48270
+ let nextAttrs = attrs3;
47041
48271
  if (nextRef !== ref)
47042
48272
  nextAttrs = nextAttrs.replace(attrPattern("ref"), (_m, lead, q) => {
47043
48273
  return `${lead}${q}${escapeXmlAttr(nextRef)}${q}`;
@@ -47142,8 +48372,8 @@ function child5(doc, root, local) {
47142
48372
  const existing = kids(root, local)[0];
47143
48373
  if (existing) return existing;
47144
48374
  const node2 = doc.createElementNS(NS.x, local);
47145
- const rank3 = ORDER2.indexOf(local);
47146
- const next = elements(root).find((e) => ORDER2.indexOf(e.localName) > rank3);
48375
+ const rank4 = ORDER2.indexOf(local);
48376
+ const next = elements(root).find((e) => ORDER2.indexOf(e.localName) > rank4);
47147
48377
  root.insertBefore(node2, next ?? null);
47148
48378
  return node2;
47149
48379
  }
@@ -47298,19 +48528,27 @@ function protectionXml(protection) {
47298
48528
  var numFmtXml = (id, code) => `<numFmt numFmtId="${id}" formatCode="${escapeAttr3(code)}"/>`;
47299
48529
 
47300
48530
  // xlsx/write/shared-strings.ts
47301
- function richStringXml(text, runs) {
47302
- if (!runs?.length) return tElement(text);
47303
- return runs.map(
48531
+ function phoneticXml(phonetic) {
48532
+ const runs = phonetic.runs.map((run2) => `<rPh${attrs({ sb: run2.sb, eb: run2.eb })}>${tElement(run2.text)}</rPh>`).join("");
48533
+ const pr = phonetic.properties;
48534
+ const settings = pr ? `<phoneticPr${attrs({ fontId: pr.fontId, type: pr.type, alignment: pr.alignment })}/>` : "";
48535
+ return runs + settings;
48536
+ }
48537
+ function richStringXml(text, runs, phonetic) {
48538
+ const guide = phonetic ? phoneticXml(phonetic) : "";
48539
+ if (!runs?.length) return tElement(text) + guide;
48540
+ const body = runs.map(
47304
48541
  (run2) => `<r>${run2.font && Object.keys(run2.font).length ? fontXml(run2.font, "rPr") : ""}${tElement(run2.text)}</r>`
47305
48542
  ).join("");
48543
+ return body + guide;
47306
48544
  }
47307
48545
  var SharedStringTable = class {
47308
48546
  items = [];
47309
48547
  index = /* @__PURE__ */ new Map();
47310
48548
  references = 0;
47311
- id(text, runs) {
48549
+ id(text, runs, phonetic) {
47312
48550
  this.references++;
47313
- const body = richStringXml(text, runs);
48551
+ const body = richStringXml(text, runs, phonetic);
47314
48552
  let id = this.index.get(body);
47315
48553
  if (id === void 0) {
47316
48554
  id = this.items.length;
@@ -47681,6 +48919,95 @@ function pageXml(sheet) {
47681
48919
  return result2;
47682
48920
  }
47683
48921
 
48922
+ // xlsx/write/filter-columns.ts
48923
+ function criteriaOf(column2) {
48924
+ const { values: values2, blank, dateGroups, custom, top10, dynamic, color, icon, hiddenButton } = column2;
48925
+ const bare = color && { cellColor: color.cellColor, dxfId: color.dxfId };
48926
+ return { values: values2, blank, dateGroups, custom, top10, dynamic, color: bare, icon, hiddenButton };
48927
+ }
48928
+ function unresolvedFilter(filter2) {
48929
+ return filter2 && {
48930
+ range: filter2.range,
48931
+ columns: filter2.columns?.map((column2) => ({
48932
+ offset: column2.offset,
48933
+ sourceXml: column2.sourceXml,
48934
+ ...criteriaOf(column2)
48935
+ }))
48936
+ };
48937
+ }
48938
+ function sourceCriteria(xml) {
48939
+ try {
48940
+ const wrapped = `<autoFilter xmlns="${NS.x}" ref="A1">${xml}</autoFilter>`;
48941
+ const column2 = readAutoFilter(parseXml(wrapped).documentElement)?.columns?.[0];
48942
+ return column2 ? criteriaOf(column2) : void 0;
48943
+ } catch {
48944
+ return void 0;
48945
+ }
48946
+ }
48947
+ function hasCriteria(column2) {
48948
+ return !!(column2.values?.length || column2.blank || column2.dateGroups?.length || column2.custom?.conditions.length || column2.top10 || column2.dynamic || column2.color || column2.icon);
48949
+ }
48950
+ function criteriaXml(column2, styles) {
48951
+ if (column2.top10) {
48952
+ const { top, percent, value: value2, filterValue } = column2.top10;
48953
+ return el("top10", {
48954
+ top: top ? void 0 : false,
48955
+ percent: percent || void 0,
48956
+ val: value2,
48957
+ filterVal: filterValue
48958
+ });
48959
+ }
48960
+ if (column2.custom?.conditions.length) {
48961
+ const items = column2.custom.conditions.slice(0, 2).map(
48962
+ (c2) => el("customFilter", {
48963
+ operator: c2.operator === "equal" ? void 0 : c2.operator,
48964
+ val: c2.value
48965
+ })
48966
+ ).join("");
48967
+ return el("customFilters", { and: column2.custom.and || void 0 }, items);
48968
+ }
48969
+ if (column2.dynamic) {
48970
+ const { type, value: value2, maxValue } = column2.dynamic;
48971
+ return el("dynamicFilter", { type, val: value2, maxVal: maxValue });
48972
+ }
48973
+ if (column2.color) {
48974
+ const { cellColor, style: style2, dxfId } = column2.color;
48975
+ const id = style2 && styles ? styles.dxfId(style2) : dxfId;
48976
+ return el("colorFilter", { dxfId: id, cellColor: cellColor ? void 0 : false });
48977
+ }
48978
+ if (column2.icon)
48979
+ return el("iconFilter", { iconSet: column2.icon.iconSet, iconId: column2.icon.iconId });
48980
+ const values2 = (column2.values ?? []).map((value2) => el("filter", { val: value2 }));
48981
+ const groups = (column2.dateGroups ?? []).map(
48982
+ (g2) => el("dateGroupItem", {
48983
+ year: g2.year,
48984
+ month: g2.month,
48985
+ day: g2.day,
48986
+ hour: g2.hour,
48987
+ minute: g2.minute,
48988
+ second: g2.second,
48989
+ dateTimeGrouping: g2.grouping
48990
+ })
48991
+ );
48992
+ return el("filters", { blank: column2.blank || void 0 }, values2.join("") + groups.join(""));
48993
+ }
48994
+ function filterColumnXml2(column2, styles) {
48995
+ if (column2.sourceXml && sameModel(sourceCriteria(column2.sourceXml), criteriaOf(column2))) {
48996
+ const head = /^<filterColumn\b[^>]*?>/.exec(column2.sourceXml)?.[0];
48997
+ if (head) {
48998
+ const colId = ` colId="${column2.offset}"`;
48999
+ const patched = /\scolId="[^"]*"/.test(head) ? head.replace(/\scolId="[^"]*"/, colId) : head.replace(/^<filterColumn\b/, `<filterColumn${colId}`);
49000
+ return patched + column2.sourceXml.slice(head.length);
49001
+ }
49002
+ }
49003
+ if (!hasCriteria(column2)) return "";
49004
+ return el(
49005
+ "filterColumn",
49006
+ { colId: column2.offset, hiddenButton: column2.hiddenButton || void 0 },
49007
+ criteriaXml(column2, styles)
49008
+ );
49009
+ }
49010
+
47684
49011
  // xlsx/write/sheet-props.ts
47685
49012
  var sqref = (ranges) => ranges.map((range) => formatRange(range)).join(" ");
47686
49013
  function sheetPrXml(sheet) {
@@ -47823,40 +49150,14 @@ function protectionXml2(sheet) {
47823
49150
  for (const name of allow) values2[name] = false;
47824
49151
  return el("sheetProtection", values2);
47825
49152
  }
47826
- function sourceCriteria(xml) {
47827
- try {
47828
- const wrapped = `<autoFilter xmlns="${NS.x}" ref="A1">${xml}</autoFilter>`;
47829
- const column2 = readAutoFilter(parseXml(wrapped).documentElement)?.columns?.[0];
47830
- return column2 ? { values: column2.values, blank: column2.blank } : void 0;
47831
- } catch {
47832
- return void 0;
47833
- }
47834
- }
47835
- function filterColumnXml2(column2) {
47836
- if (column2.sourceXml && sameModel(sourceCriteria(column2.sourceXml), { values: column2.values, blank: column2.blank })) {
47837
- const head = /^<filterColumn\b[^>]*?>/.exec(column2.sourceXml)?.[0];
47838
- if (head) {
47839
- const colId = ` colId="${column2.offset}"`;
47840
- const patched = /\scolId="[^"]*"/.test(head) ? head.replace(/\scolId="[^"]*"/, colId) : head.replace(/^<filterColumn\b/, `<filterColumn${colId}`);
47841
- return patched + column2.sourceXml.slice(head.length);
47842
- }
47843
- }
47844
- if (!column2.values?.length && !column2.blank) return "";
47845
- const values2 = (column2.values ?? []).map((value2) => el("filter", { val: value2 })).join("");
47846
- return el(
47847
- "filterColumn",
47848
- { colId: column2.offset },
47849
- el("filters", { blank: column2.blank || void 0 }, values2) || "<filters/>"
47850
- );
47851
- }
47852
- function autoFilterXml(sheet) {
49153
+ function autoFilterXml(sheet, styles) {
47853
49154
  const filter2 = sheet.autoFilter;
47854
49155
  if (!filter2) return "";
47855
49156
  const source3 = snapshotElement(sheet, "autoFilter");
47856
- if (source3 && sameModel(readAutoFilter(source3), filter2))
49157
+ if (source3 && sameModel(unresolvedFilter(readAutoFilter(source3)), unresolvedFilter(filter2)))
47857
49158
  return snapshotXml(sheet, "autoFilter") ?? "";
47858
49159
  const width = filter2.range.end.col - filter2.range.start.col + 1;
47859
- const columns = (filter2.columns ?? []).filter((column2) => column2.offset >= 0 && column2.offset < width).sort((a2, b) => a2.offset - b.offset).map(filterColumnXml2).join("");
49160
+ const columns = (filter2.columns ?? []).filter((column2) => column2.offset >= 0 && column2.offset < width).sort((a2, b) => a2.offset - b.offset).map((column2) => filterColumnXml2(column2, styles)).join("");
47860
49161
  const sort2 = source3 && sameModel(readAutoFilter(source3)?.range, filter2.range) ? elements(source3).filter((node2) => node2.localName === "sortState" || node2.localName === "extLst").map((node2) => outerXml(node2)).join("") : "";
47861
49162
  return el("autoFilter", { ref: formatRange(filter2.range) }, columns + sort2);
47862
49163
  }
@@ -47928,6 +49229,15 @@ function absoluteRange(range) {
47928
49229
  const cell = (row2, col) => `$${columnLabel(col)}$${row2 + 1}`;
47929
49230
  return `${cell(range.start.row, range.start.col)}:${cell(range.end.row, range.end.col)}`;
47930
49231
  }
49232
+ function hasUncachedFormula(workbook) {
49233
+ return workbook.sheets.some((sheet) => {
49234
+ for (const row2 of sheet.rows.values())
49235
+ for (const cell of row2.values())
49236
+ if (cell.formula !== void 0 && (cell.value === null || cell.value === void 0))
49237
+ return true;
49238
+ return false;
49239
+ });
49240
+ }
47931
49241
  function definedNamesOf(workbook) {
47932
49242
  const names = workbook.definedNames.filter(
47933
49243
  (name) => name.name && (name.localSheet === void 0 || name.localSheet >= 0 && name.localSheet < workbook.sheets.length)
@@ -47988,7 +49298,12 @@ function workbookXml(workbook, sheets, activeTab, sourceXml, pivotCachesXml) {
47988
49298
  const mode = workbook.calcMode === "manual" ? ' calcMode="manual"' : "";
47989
49299
  const iterate = workbook.iterate ? ` iterate="1" iterateCount="${workbook.iterate.count}" iterateDelta="${workbook.iterate.delta}"` : "";
47990
49300
  const owned = ["fullCalcOnLoad", "calcId", "calcMode", "iterate", "iterateCount", "iterateDelta"];
47991
- out += `<calcPr${copyAttrs(calc, owned)} calcId="191029"${mode}${iterate} fullCalcOnLoad="1"/>`;
49301
+ const sourceAttr = (name) => calc ? Array.from(calc.attributes).find((a2) => a2.name === name)?.value : void 0;
49302
+ const calcId = sourceAttr("calcId") ?? "191029";
49303
+ const recalculate = workbook.fullCalcOnLoad || workbook.valuesStale || hasUncachedFormula(workbook);
49304
+ const sourceFull = sourceAttr("fullCalcOnLoad");
49305
+ const fullCalc = recalculate ? ' fullCalcOnLoad="1"' : sourceFull !== void 0 ? ` fullCalcOnLoad="${escapeAttr3(sourceFull)}"` : "";
49306
+ out += `<calcPr${copyAttrs(calc, owned)} calcId="${escapeAttr3(calcId)}"${mode}${iterate}${fullCalc}/>`;
47992
49307
  const tailOf = (names2) => names2.map(
47993
49308
  (name) => name === "oleSize" && workbook.oleSize ? `<oleSize ref="${escapeAttr3(workbook.oleSize)}"/>` : name === "customWorkbookViews" && workbook.customViews ? customWorkbookViewsXml(workbook.customViews) : raw2([name])
47994
49309
  ).join("");
@@ -48143,35 +49458,6 @@ function refreshFormControlParts(writer, workbook, sheet) {
48143
49458
  }
48144
49459
  }
48145
49460
 
48146
- // xlsx/time-period.ts
48147
- function timePeriodFormula(period, cell) {
48148
- const day = `FLOOR(${cell},1)`;
48149
- const down = `ROUNDDOWN(${cell},0)`;
48150
- const month = (offset2) => `AND(MONTH(${cell})=MONTH(EDATE(TODAY(),${offset2})),YEAR(${cell})=YEAR(EDATE(TODAY(),${offset2})))`;
48151
- switch (period) {
48152
- case "today":
48153
- return `${day}=TODAY()`;
48154
- case "yesterday":
48155
- return `${day}=TODAY()-1`;
48156
- case "tomorrow":
48157
- return `${day}=TODAY()+1`;
48158
- case "last7Days":
48159
- return `AND(TODAY()-${day}<=6,${day}<=TODAY())`;
48160
- case "thisWeek":
48161
- return `AND(TODAY()-${down}<=WEEKDAY(TODAY())-1,${down}-TODAY()<=7-WEEKDAY(TODAY()))`;
48162
- case "lastWeek":
48163
- return `AND(TODAY()-${down}>=(WEEKDAY(TODAY())),TODAY()-${down}<(WEEKDAY(TODAY())+7))`;
48164
- case "nextWeek":
48165
- return `AND(${down}-TODAY()>(7-WEEKDAY(TODAY())),${down}-TODAY()<(15-WEEKDAY(TODAY())))`;
48166
- case "thisMonth":
48167
- return `AND(MONTH(${cell})=MONTH(TODAY()),YEAR(${cell})=YEAR(TODAY()))`;
48168
- case "lastMonth":
48169
- return month("0-1");
48170
- case "nextMonth":
48171
- return month("0+1");
48172
- }
48173
- }
48174
-
48175
49461
  // xlsx/write/conditional.ts
48176
49462
  var cfvoXml = (threshold) => el("cfvo", {
48177
49463
  type: threshold.type,
@@ -48387,7 +49673,7 @@ function cellXml(ctx, spills, source3, row2, col, dataTable) {
48387
49673
  v = escapeText2(encodeEscapes(text));
48388
49674
  } else {
48389
49675
  t = "s";
48390
- v = String(ctx.strings.id(text, cell.richText));
49676
+ v = String(ctx.strings.id(text, cell.richText, cell.phonetic));
48391
49677
  }
48392
49678
  } else if (isCellError(value2)) {
48393
49679
  t = "e";
@@ -48494,17 +49780,17 @@ function numberSource(values2, previous, formula2) {
48494
49780
  };
48495
49781
  }
48496
49782
  function categorySource(values2, previous, formula2) {
48497
- const numeric2 = values2.length > 0 && values2.every((value2) => typeof value2 === "number");
49783
+ const numeric3 = values2.length > 0 && values2.every((value2) => typeof value2 === "number");
48498
49784
  const reference2 = formula2 ?? (previous?.kind === "numRef" || previous?.kind === "strRef" || previous?.kind === "multiLvlStrRef" ? previous.formula : void 0);
48499
- const kind = numeric2 ? reference2 !== void 0 ? "numRef" : "numLit" : reference2 !== void 0 ? "strRef" : "strLit";
49785
+ const kind = numeric3 ? reference2 !== void 0 ? "numRef" : "numLit" : reference2 !== void 0 ? "strRef" : "strLit";
48500
49786
  return {
48501
49787
  kind,
48502
49788
  ...reference2 !== void 0 ? { formula: reference2 } : {},
48503
49789
  cache: {
48504
- type: numeric2 ? "number" : "string",
48505
- ...numeric2 ? { formatCode: previous?.cache?.formatCode ?? "General" } : {},
49790
+ type: numeric3 ? "number" : "string",
49791
+ ...numeric3 ? { formatCode: previous?.cache?.formatCode ?? "General" } : {},
48506
49792
  pointCount: values2.length,
48507
- points: points(values2, numeric2 ? previous?.cache : void 0)
49793
+ points: points(values2, numeric3 ? previous?.cache : void 0)
48508
49794
  }
48509
49795
  };
48510
49796
  }
@@ -49375,7 +50661,7 @@ function writeWorksheet(ctx, sheet, index3, partName) {
49375
50661
  blocks.set("sheetProtection", protectionXml2(sheet));
49376
50662
  blocks.set("scenarios", scenariosXml(sheet.scenarios));
49377
50663
  blocks.set("customSheetViews", customSheetViewsXml(sheet.customViews));
49378
- blocks.set("autoFilter", autoFilterXml(sheet));
50664
+ blocks.set("autoFilter", autoFilterXml(sheet, ctx.styles));
49379
50665
  blocks.set("mergeCells", mergeCellsXml(sheet));
49380
50666
  blocks.set("conditionalFormatting", conditionalFormatsXml(sheet.conditionalFormats, ctx.styles));
49381
50667
  blocks.set("dataValidations", dataValidationsXml(sheet.dataValidations));