ooxml-core 1.30.1 → 1.31.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 (342) hide show
  1. package/dist/automation/index.cjs +5829 -3266
  2. package/dist/automation/index.mjs +5829 -3266
  3. package/dist/automation/node.cjs +2 -1
  4. package/dist/automation/node.d.ts.map +1 -1
  5. package/dist/automation/node.mjs +2 -1
  6. package/dist/automation/tools/define.d.ts +2 -0
  7. package/dist/automation/tools/define.d.ts.map +1 -1
  8. package/dist/automation/tools/types.d.ts +6 -0
  9. package/dist/automation/tools/types.d.ts.map +1 -1
  10. package/dist/collab/index.cjs +35 -4
  11. package/dist/collab/index.mjs +35 -4
  12. package/dist/collab/websocket-transport.d.ts +9 -1
  13. package/dist/collab/websocket-transport.d.ts.map +1 -1
  14. package/dist/docx/data-binding.d.ts +9 -0
  15. package/dist/docx/data-binding.d.ts.map +1 -0
  16. package/dist/docx/document-parts.d.ts +1 -0
  17. package/dist/docx/document-parts.d.ts.map +1 -1
  18. package/dist/docx/drawing.d.ts.map +1 -1
  19. package/dist/docx/embedded.cjs +1383 -609
  20. package/dist/docx/embedded.mjs +1383 -609
  21. package/dist/docx/index.cjs +1394 -618
  22. package/dist/docx/index.mjs +1394 -618
  23. package/dist/docx/inline-model.d.ts +2 -0
  24. package/dist/docx/inline-model.d.ts.map +1 -1
  25. package/dist/docx/layout/adapt-floats.d.ts.map +1 -1
  26. package/dist/docx/layout/adapt-table.d.ts.map +1 -1
  27. package/dist/docx/layout/adapter.d.ts.map +1 -1
  28. package/dist/docx/layout/equation-object.d.ts +1 -1
  29. package/dist/docx/layout/equation-object.d.ts.map +1 -1
  30. package/dist/docx/layout/floats.d.ts +1 -1
  31. package/dist/docx/layout/floats.d.ts.map +1 -1
  32. package/dist/docx/layout/flow-paragraph.d.ts +4 -0
  33. package/dist/docx/layout/flow-paragraph.d.ts.map +1 -1
  34. package/dist/docx/layout/flow-table.d.ts.map +1 -1
  35. package/dist/docx/layout/index.cjs +452 -203
  36. package/dist/docx/layout/index.mjs +452 -203
  37. package/dist/docx/layout/input.d.ts +12 -0
  38. package/dist/docx/layout/input.d.ts.map +1 -1
  39. package/dist/docx/layout/nested-frame-profile.d.ts +3 -1
  40. package/dist/docx/layout/nested-frame-profile.d.ts.map +1 -1
  41. package/dist/docx/layout/page-cursor.d.ts +11 -2
  42. package/dist/docx/layout/page-cursor.d.ts.map +1 -1
  43. package/dist/docx/layout/paragraph-fragments.d.ts.map +1 -1
  44. package/dist/docx/layout/paragraph-layout.d.ts +5 -0
  45. package/dist/docx/layout/paragraph-layout.d.ts.map +1 -1
  46. package/dist/docx/layout/result.d.ts +4 -0
  47. package/dist/docx/layout/result.d.ts.map +1 -1
  48. package/dist/docx/layout/section-flow.d.ts +2 -0
  49. package/dist/docx/layout/section-flow.d.ts.map +1 -1
  50. package/dist/docx/layout/table-layout.d.ts +4 -14
  51. package/dist/docx/layout/table-layout.d.ts.map +1 -1
  52. package/dist/docx/layout/table-merged-rows.d.ts +21 -0
  53. package/dist/docx/layout/table-merged-rows.d.ts.map +1 -0
  54. package/dist/docx/layout/table-row-split.d.ts +16 -0
  55. package/dist/docx/layout/table-row-split.d.ts.map +1 -0
  56. package/dist/docx/layout/wrap.d.ts +2 -0
  57. package/dist/docx/layout/wrap.d.ts.map +1 -1
  58. package/dist/docx/load/index.cjs +1397 -623
  59. package/dist/docx/load/index.mjs +1397 -623
  60. package/dist/docx/model-paragraph.d.ts +4 -1
  61. package/dist/docx/model-paragraph.d.ts.map +1 -1
  62. package/dist/docx/model.d.ts +24 -1
  63. package/dist/docx/model.d.ts.map +1 -1
  64. package/dist/docx/paragraph-properties.d.ts.map +1 -1
  65. package/dist/docx/paragraph-styles.d.ts.map +1 -1
  66. package/dist/docx/parse-table.d.ts.map +1 -1
  67. package/dist/docx/parse.d.ts.map +1 -1
  68. package/dist/docx/run-segmentation.d.ts.map +1 -1
  69. package/dist/docx/save-modified.d.ts +4 -0
  70. package/dist/docx/save-modified.d.ts.map +1 -0
  71. package/dist/docx/save.d.ts +2 -2
  72. package/dist/docx/save.d.ts.map +1 -1
  73. package/dist/docx/style-formatting-package.d.ts +9 -0
  74. package/dist/docx/style-formatting-package.d.ts.map +1 -0
  75. package/dist/docx/style-numbering-package.d.ts +4 -1
  76. package/dist/docx/style-numbering-package.d.ts.map +1 -1
  77. package/dist/docx/table-grid.d.ts +35 -0
  78. package/dist/docx/table-grid.d.ts.map +1 -0
  79. package/dist/docx/table-structure-cells.d.ts +19 -0
  80. package/dist/docx/table-structure-cells.d.ts.map +1 -0
  81. package/dist/docx/table-structure-check.d.ts +12 -0
  82. package/dist/docx/table-structure-check.d.ts.map +1 -0
  83. package/dist/docx/table-structure-merge.d.ts +28 -0
  84. package/dist/docx/table-structure-merge.d.ts.map +1 -0
  85. package/dist/docx/table-structure.d.ts +30 -0
  86. package/dist/docx/table-structure.d.ts.map +1 -0
  87. package/dist/docx/ui/index.cjs +717 -256
  88. package/dist/docx/ui/index.d.ts +4 -0
  89. package/dist/docx/ui/index.d.ts.map +1 -1
  90. package/dist/docx/ui/index.mjs +703 -257
  91. package/dist/docx/ui/ribbon-action-ids.d.ts +1 -1
  92. package/dist/docx/ui/ribbon-action-ids.d.ts.map +1 -1
  93. package/dist/docx/ui/table-structure-guard.d.ts +2 -0
  94. package/dist/docx/ui/table-structure-guard.d.ts.map +1 -1
  95. package/dist/docx/word-content-control-docs.d.ts +5 -0
  96. package/dist/docx/word-content-control-docs.d.ts.map +1 -0
  97. package/dist/docx/word-corpus-gaps.d.ts +10 -0
  98. package/dist/docx/word-corpus-gaps.d.ts.map +1 -0
  99. package/dist/docx/word-measurer.d.ts +6 -0
  100. package/dist/docx/word-measurer.d.ts.map +1 -0
  101. package/dist/docx/word-spacing-docs.d.ts +12 -0
  102. package/dist/docx/word-spacing-docs.d.ts.map +1 -0
  103. package/dist/docx/word-table-docs.d.ts +9 -0
  104. package/dist/docx/word-table-docs.d.ts.map +1 -0
  105. package/dist/docx/write-drawing.d.ts.map +1 -1
  106. package/dist/docx/write-fallback.d.ts +5 -0
  107. package/dist/docx/write-fallback.d.ts.map +1 -0
  108. package/dist/docx/write-table-properties.d.ts +1 -0
  109. package/dist/docx/write-table-properties.d.ts.map +1 -1
  110. package/dist/docx/write-table-structure.d.ts +14 -0
  111. package/dist/docx/write-table-structure.d.ts.map +1 -0
  112. package/dist/docx/write-table.d.ts +3 -4
  113. package/dist/docx/write-table.d.ts.map +1 -1
  114. package/dist/index.cjs +22 -22
  115. package/dist/index.mjs +22 -22
  116. package/dist/math/index.cjs +22 -22
  117. package/dist/math/index.mjs +22 -22
  118. package/dist/math/omml-box-grouped.d.ts.map +1 -1
  119. package/dist/math/omml-box-layout.d.ts +3 -1
  120. package/dist/math/omml-box-layout.d.ts.map +1 -1
  121. package/dist/math/omml-box-structures.d.ts.map +1 -1
  122. package/dist/math/omml-box.d.ts +2 -0
  123. package/dist/math/omml-box.d.ts.map +1 -1
  124. package/dist/math/omml-svg.d.ts +6 -2
  125. package/dist/math/omml-svg.d.ts.map +1 -1
  126. package/dist/pptx/automation/index.cjs +1 -0
  127. package/dist/pptx/automation/index.d.ts +6 -0
  128. package/dist/pptx/automation/index.d.ts.map +1 -1
  129. package/dist/pptx/automation/index.mjs +1 -0
  130. package/dist/teams/chat-rooms.d.ts.map +1 -1
  131. package/dist/teams/chat.d.ts +7 -0
  132. package/dist/teams/chat.d.ts.map +1 -1
  133. package/dist/teams/files.d.ts +1 -1
  134. package/dist/teams/files.d.ts.map +1 -1
  135. package/dist/teams/index.cjs +2735 -1148
  136. package/dist/teams/index.d.ts +3 -0
  137. package/dist/teams/index.d.ts.map +1 -1
  138. package/dist/teams/index.mjs +2710 -1148
  139. package/dist/teams/message-transfer.d.ts +1 -1
  140. package/dist/teams/message-transfer.d.ts.map +1 -1
  141. package/dist/teams/protocol.d.ts +30 -0
  142. package/dist/teams/protocol.d.ts.map +1 -0
  143. package/dist/teams/schema.d.ts +59 -0
  144. package/dist/teams/schema.d.ts.map +1 -0
  145. package/dist/teams/server-config.d.ts +19 -2
  146. package/dist/teams/server-config.d.ts.map +1 -1
  147. package/dist/teams/server-file-storage.d.ts +11 -1
  148. package/dist/teams/server-file-storage.d.ts.map +1 -1
  149. package/dist/teams/server-session.d.ts +2 -0
  150. package/dist/teams/server-session.d.ts.map +1 -1
  151. package/dist/teams/signaling.d.ts +2 -0
  152. package/dist/teams/signaling.d.ts.map +1 -1
  153. package/dist/teams/store.d.ts +9 -0
  154. package/dist/teams/store.d.ts.map +1 -1
  155. package/dist/teams/stored-file.d.ts +1 -1
  156. package/dist/teams/stored-file.d.ts.map +1 -1
  157. package/dist/teams/sync-transport.d.ts.map +1 -1
  158. package/dist/teams/validate-members.d.ts +28 -0
  159. package/dist/teams/validate-members.d.ts.map +1 -0
  160. package/dist/teams/validate-owned.d.ts +20 -0
  161. package/dist/teams/validate-owned.d.ts.map +1 -0
  162. package/dist/teams/validate-update.d.ts +70 -0
  163. package/dist/teams/validate-update.d.ts.map +1 -0
  164. package/dist/teams/workspace.d.ts +12 -0
  165. package/dist/teams/workspace.d.ts.map +1 -1
  166. package/dist/visio/connector-route-walk.d.ts +2 -0
  167. package/dist/visio/connector-route-walk.d.ts.map +1 -1
  168. package/dist/visio/edit-connector-reroute.d.ts.map +1 -1
  169. package/dist/visio/edit-connector.d.ts +2 -0
  170. package/dist/visio/edit-connector.d.ts.map +1 -1
  171. package/dist/visio/edit-delete.d.ts.map +1 -1
  172. package/dist/visio/edit-duplicate-line.d.ts +40 -0
  173. package/dist/visio/edit-duplicate-line.d.ts.map +1 -0
  174. package/dist/visio/edit-duplicate.d.ts.map +1 -1
  175. package/dist/visio/edit-formatting-scope.d.ts +5 -1
  176. package/dist/visio/edit-formatting-scope.d.ts.map +1 -1
  177. package/dist/visio/edit-geometry.d.ts.map +1 -1
  178. package/dist/visio/edit-instance-duplicate.d.ts +2 -1
  179. package/dist/visio/edit-instance-duplicate.d.ts.map +1 -1
  180. package/dist/visio/edit-master-move.d.ts.map +1 -1
  181. package/dist/visio/edit-recalculate-index.d.ts +23 -0
  182. package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
  183. package/dist/visio/edit-recalculate-text.d.ts +12 -0
  184. package/dist/visio/edit-recalculate-text.d.ts.map +1 -0
  185. package/dist/visio/edit-recalculate-values.d.ts.map +1 -1
  186. package/dist/visio/edit-recalculate.d.ts +15 -3
  187. package/dist/visio/edit-recalculate.d.ts.map +1 -1
  188. package/dist/visio/edit-resize-anchor.d.ts.map +1 -1
  189. package/dist/visio/edit-stencil-connector-layout.d.ts +1 -1
  190. package/dist/visio/edit-stencil-connector-layout.d.ts.map +1 -1
  191. package/dist/visio/edit-text-scope.d.ts +4 -1
  192. package/dist/visio/edit-text-scope.d.ts.map +1 -1
  193. package/dist/visio/formula-analyze.d.ts +18 -0
  194. package/dist/visio/formula-analyze.d.ts.map +1 -0
  195. package/dist/visio/formula-bound.d.ts +4 -0
  196. package/dist/visio/formula-bound.d.ts.map +1 -0
  197. package/dist/visio/formula-evaluate.d.ts +2 -9
  198. package/dist/visio/formula-evaluate.d.ts.map +1 -1
  199. package/dist/visio/formula-extra-functions.d.ts +23 -0
  200. package/dist/visio/formula-extra-functions.d.ts.map +1 -0
  201. package/dist/visio/formula-indirect.d.ts +6 -0
  202. package/dist/visio/formula-indirect.d.ts.map +1 -0
  203. package/dist/visio/formula-master.d.ts +1 -0
  204. package/dist/visio/formula-master.d.ts.map +1 -1
  205. package/dist/visio/formula-operators.d.ts +6 -0
  206. package/dist/visio/formula-operators.d.ts.map +1 -0
  207. package/dist/visio/formula-text-functions.d.ts +5 -1
  208. package/dist/visio/formula-text-functions.d.ts.map +1 -1
  209. package/dist/visio/formula.d.ts +12 -0
  210. package/dist/visio/formula.d.ts.map +1 -1
  211. package/dist/visio/index.cjs +1354 -396
  212. package/dist/visio/index.mjs +1354 -396
  213. package/dist/visio/ui/index.cjs +1341 -383
  214. package/dist/visio/ui/index.mjs +1341 -383
  215. package/dist/xlsx/collab/apply.d.ts.map +1 -1
  216. package/dist/xlsx/collab/codec.d.ts +2 -0
  217. package/dist/xlsx/collab/codec.d.ts.map +1 -1
  218. package/dist/xlsx/collab/dirty.d.ts +4 -1
  219. package/dist/xlsx/collab/dirty.d.ts.map +1 -1
  220. package/dist/xlsx/collab/index.cjs +551 -106
  221. package/dist/xlsx/collab/index.mjs +551 -106
  222. package/dist/xlsx/collab/keyed.d.ts +36 -0
  223. package/dist/xlsx/collab/keyed.d.ts.map +1 -0
  224. package/dist/xlsx/collab/names.d.ts +2 -0
  225. package/dist/xlsx/collab/names.d.ts.map +1 -1
  226. package/dist/xlsx/collab/part-specs.d.ts +13 -0
  227. package/dist/xlsx/collab/part-specs.d.ts.map +1 -0
  228. package/dist/xlsx/collab/schema.d.ts +8 -0
  229. package/dist/xlsx/collab/schema.d.ts.map +1 -1
  230. package/dist/xlsx/collab/sheet-parts.d.ts +19 -0
  231. package/dist/xlsx/collab/sheet-parts.d.ts.map +1 -0
  232. package/dist/xlsx/collab/sheets.d.ts +6 -0
  233. package/dist/xlsx/collab/sheets.d.ts.map +1 -1
  234. package/dist/xlsx/collab/write.d.ts +3 -0
  235. package/dist/xlsx/collab/write.d.ts.map +1 -1
  236. package/dist/xlsx/edit/clipboard-areas.d.ts +17 -0
  237. package/dist/xlsx/edit/clipboard-areas.d.ts.map +1 -0
  238. package/dist/xlsx/edit/custom-views.d.ts +21 -0
  239. package/dist/xlsx/edit/custom-views.d.ts.map +1 -0
  240. package/dist/xlsx/edit/data-table.d.ts.map +1 -1
  241. package/dist/xlsx/edit/history.d.ts +1 -1
  242. package/dist/xlsx/edit/history.d.ts.map +1 -1
  243. package/dist/xlsx/edit/index.d.ts +2 -0
  244. package/dist/xlsx/edit/index.d.ts.map +1 -1
  245. package/dist/xlsx/edit/paste-selection.d.ts.map +1 -1
  246. package/dist/xlsx/edit/scenario-merge.d.ts +7 -0
  247. package/dist/xlsx/edit/scenario-merge.d.ts.map +1 -0
  248. package/dist/xlsx/edit/session.d.ts.map +1 -1
  249. package/dist/xlsx/edit/shift-data-tables.d.ts +7 -0
  250. package/dist/xlsx/edit/shift-data-tables.d.ts.map +1 -0
  251. package/dist/xlsx/edit/shift-scenarios.d.ts +7 -0
  252. package/dist/xlsx/edit/shift-scenarios.d.ts.map +1 -0
  253. package/dist/xlsx/edit/shift-sheet.d.ts.map +1 -1
  254. package/dist/xlsx/edit/sparkline-grouping.d.ts +10 -0
  255. package/dist/xlsx/edit/sparkline-grouping.d.ts.map +1 -0
  256. package/dist/xlsx/edit/types.d.ts +21 -0
  257. package/dist/xlsx/edit/types.d.ts.map +1 -1
  258. package/dist/xlsx/formula/ets-excel-compare.d.ts +24 -0
  259. package/dist/xlsx/formula/ets-excel-compare.d.ts.map +1 -0
  260. package/dist/xlsx/formula/functions/ets-core.d.ts +36 -0
  261. package/dist/xlsx/formula/functions/ets-core.d.ts.map +1 -0
  262. package/dist/xlsx/formula/functions/ets-grid.d.ts +15 -0
  263. package/dist/xlsx/formula/functions/ets-grid.d.ts.map +1 -0
  264. package/dist/xlsx/formula/functions/ets-init.d.ts +15 -0
  265. package/dist/xlsx/formula/functions/ets-init.d.ts.map +1 -0
  266. package/dist/xlsx/formula/functions/ets-input.d.ts +13 -0
  267. package/dist/xlsx/formula/functions/ets-input.d.ts.map +1 -0
  268. package/dist/xlsx/formula/functions/ets-season.d.ts +6 -0
  269. package/dist/xlsx/formula/functions/ets-season.d.ts.map +1 -0
  270. package/dist/xlsx/formula/functions/forecast-ets.d.ts +3 -0
  271. package/dist/xlsx/formula/functions/forecast-ets.d.ts.map +1 -0
  272. package/dist/xlsx/formula/functions/statistical.d.ts.map +1 -1
  273. package/dist/xlsx/index.cjs +4444 -2447
  274. package/dist/xlsx/index.mjs +4423 -2448
  275. package/dist/xlsx/layout/form-control-link.d.ts +20 -0
  276. package/dist/xlsx/layout/form-control-link.d.ts.map +1 -0
  277. package/dist/xlsx/layout/form-control-state.d.ts +49 -0
  278. package/dist/xlsx/layout/form-control-state.d.ts.map +1 -0
  279. package/dist/xlsx/layout/form-control-view.d.ts +11 -0
  280. package/dist/xlsx/layout/form-control-view.d.ts.map +1 -0
  281. package/dist/xlsx/layout/header-footer-edit.d.ts +4 -2
  282. package/dist/xlsx/layout/header-footer-edit.d.ts.map +1 -1
  283. package/dist/xlsx/layout/header-footer.d.ts +16 -0
  284. package/dist/xlsx/layout/header-footer.d.ts.map +1 -1
  285. package/dist/xlsx/layout/index.d.ts +5 -0
  286. package/dist/xlsx/layout/index.d.ts.map +1 -1
  287. package/dist/xlsx/layout/ref-evaluator.d.ts +6 -0
  288. package/dist/xlsx/layout/ref-evaluator.d.ts.map +1 -1
  289. package/dist/xlsx/layout/shape-paint.d.ts +25 -0
  290. package/dist/xlsx/layout/shape-paint.d.ts.map +1 -0
  291. package/dist/xlsx/layout/shape-view.d.ts +15 -0
  292. package/dist/xlsx/layout/shape-view.d.ts.map +1 -0
  293. package/dist/xlsx/load/index.cjs +2134 -1103
  294. package/dist/xlsx/load/index.mjs +2134 -1103
  295. package/dist/xlsx/model-custom-views.d.ts +33 -0
  296. package/dist/xlsx/model-custom-views.d.ts.map +1 -0
  297. package/dist/xlsx/model-shapes.d.ts +78 -0
  298. package/dist/xlsx/model-shapes.d.ts.map +1 -0
  299. package/dist/xlsx/model.d.ts +38 -1
  300. package/dist/xlsx/model.d.ts.map +1 -1
  301. package/dist/xlsx/read/custom-views.d.ts +5 -0
  302. package/dist/xlsx/read/custom-views.d.ts.map +1 -0
  303. package/dist/xlsx/read/drawing.d.ts.map +1 -1
  304. package/dist/xlsx/read/form-control.d.ts +14 -0
  305. package/dist/xlsx/read/form-control.d.ts.map +1 -0
  306. package/dist/xlsx/read/header-footer-images.d.ts +5 -0
  307. package/dist/xlsx/read/header-footer-images.d.ts.map +1 -0
  308. package/dist/xlsx/read/load.d.ts.map +1 -1
  309. package/dist/xlsx/read/shape.d.ts +5 -0
  310. package/dist/xlsx/read/shape.d.ts.map +1 -0
  311. package/dist/xlsx/read/sheet-data.d.ts.map +1 -1
  312. package/dist/xlsx/read/workbook-part.d.ts +5 -1
  313. package/dist/xlsx/read/workbook-part.d.ts.map +1 -1
  314. package/dist/xlsx/read/worksheet-children.d.ts +3 -0
  315. package/dist/xlsx/read/worksheet-children.d.ts.map +1 -0
  316. package/dist/xlsx/read/worksheet.d.ts.map +1 -1
  317. package/dist/xlsx/ui/commands/i18n/sparklines.d.ts.map +1 -1
  318. package/dist/xlsx/ui/commands/i18n/what-if.d.ts.map +1 -1
  319. package/dist/xlsx/ui/commands/what-if.d.ts +0 -1
  320. package/dist/xlsx/ui/commands/what-if.d.ts.map +1 -1
  321. package/dist/xlsx/ui/dialogs/forecast-sheet.d.ts +51 -0
  322. package/dist/xlsx/ui/dialogs/forecast-sheet.d.ts.map +1 -0
  323. package/dist/xlsx/ui/dialogs/scenario-summary.d.ts +15 -0
  324. package/dist/xlsx/ui/dialogs/scenario-summary.d.ts.map +1 -0
  325. package/dist/xlsx/ui/index.cjs +4411 -2195
  326. package/dist/xlsx/ui/index.d.ts +2 -0
  327. package/dist/xlsx/ui/index.d.ts.map +1 -1
  328. package/dist/xlsx/ui/index.mjs +4404 -2194
  329. package/dist/xlsx/ui/locales/de/grid.d.ts.map +1 -1
  330. package/dist/xlsx/ui/locales/en/grid.d.ts.map +1 -1
  331. package/dist/xlsx/ui/locales/es/grid.d.ts.map +1 -1
  332. package/dist/xlsx/ui/locales/fr/grid.d.ts.map +1 -1
  333. package/dist/xlsx/ui/locales/zh-CN/grid.d.ts.map +1 -1
  334. package/dist/xlsx/write/custom-views.d.ts +4 -0
  335. package/dist/xlsx/write/custom-views.d.ts.map +1 -0
  336. package/dist/xlsx/write/drawing.d.ts.map +1 -1
  337. package/dist/xlsx/write/form-control.d.ts +4 -0
  338. package/dist/xlsx/write/form-control.d.ts.map +1 -0
  339. package/dist/xlsx/write/sheet-data.d.ts.map +1 -1
  340. package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
  341. package/dist/xlsx/write/worksheet.d.ts.map +1 -1
  342. package/package.json +1 -1
@@ -1765,11 +1765,11 @@ function inspectDeclaration(value3, encoding) {
1765
1765
  if (declarations.length) fail("INVALID_XML", "Invalid XML declaration attributes");
1766
1766
  }
1767
1767
  function decodeXmlAttribute(value3) {
1768
- const entities = { amp: "&", lt: "<", gt: ">", apos: "'", quot: '"' };
1768
+ const entities2 = { amp: "&", lt: "<", gt: ">", apos: "'", quot: '"' };
1769
1769
  return value3.replace(/[\t\r\n]/g, " ").replace(/&(amp|lt|gt|apos|quot|#x[\da-fA-F]+|#\d+);/g, (_, entity) => {
1770
1770
  if (entity.startsWith("#x")) return String.fromCodePoint(parseInt(entity.slice(2), 16));
1771
1771
  if (entity.startsWith("#")) return String.fromCodePoint(Number(entity.slice(1)));
1772
- return entities[entity] ?? "";
1772
+ return entities2[entity] ?? "";
1773
1773
  });
1774
1774
  }
1775
1775
  function inspectNamespaces(root2, check) {
@@ -2994,6 +2994,60 @@ function evaluateNumericFormulaFunction(name3, args) {
2994
2994
  return formulaFailure("unsupported", `Unsupported numeric function ${name3}`);
2995
2995
  }
2996
2996
 
2997
+ // visio/formula-extra-functions.ts
2998
+ var IGNORE_CASE = 1;
2999
+ var IGNORE_NONSPACE = 2;
3000
+ var IGNORE_SYMBOLS = 4;
3001
+ function strSameEx(a2, b, flags) {
3002
+ if (!Number.isInteger(flags) || flags < 0)
3003
+ return formulaFailure("value", "STRSAMEEX flags must be a whole number");
3004
+ if (flags & -8)
3005
+ return formulaFailure("unsupported", "STRSAMEEX with kana or width comparison flags");
3006
+ const fold = (text7) => {
3007
+ let result2 = text7;
3008
+ if (flags & IGNORE_NONSPACE) result2 = result2.normalize("NFD").replace(/\p{Mn}/gu, "");
3009
+ if (flags & IGNORE_SYMBOLS) result2 = result2.replace(/[\p{P}\p{S}\s]/gu, "");
3010
+ return flags & IGNORE_CASE ? result2.toLowerCase() : result2;
3011
+ };
3012
+ return fold(a2) === fold(b);
3013
+ }
3014
+ function formatNumberPicture(value3, picture) {
3015
+ if (value3.unit !== "scalar") return formulaFailure("unit", "FORMAT requires a plain number");
3016
+ const match = /^([#,0]*)(?:\.([0#]*))?(%?)$/.exec(picture);
3017
+ const integerPicture = match?.[1] ?? "";
3018
+ if (!match || !integerPicture.includes("0") || /0,*#/.test(integerPicture) || integerPicture.startsWith(",") || integerPicture.endsWith(",") || integerPicture.includes(",,") || /0#/.test(match[2] ?? ""))
3019
+ return formulaFailure("unsupported", `FORMAT picture "${picture}"`);
3020
+ const fractionPicture = match[2] ?? "", percent = match[3] === "%", grouped = integerPicture.includes(",");
3021
+ const minInteger = (integerPicture.match(/0/g) ?? []).length;
3022
+ const minFraction = (fractionPicture.match(/0/g) ?? []).length;
3023
+ const maxFraction = fractionPicture.length;
3024
+ const scaled = percent ? value3.value * 100 : value3.value;
3025
+ const factor = 10 ** maxFraction;
3026
+ const rounded = Math.sign(scaled) * Math.round(Math.abs(scaled) * factor + 1e-9) / factor;
3027
+ const [digits = "", decimals = ""] = Math.abs(rounded).toFixed(maxFraction).split(".");
3028
+ let whole = digits.replace(/^0+/, "").padStart(minInteger, "0");
3029
+ if (grouped) whole = whole.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
3030
+ let fraction = decimals;
3031
+ while (fraction.length > minFraction && fraction.endsWith("0")) fraction = fraction.slice(0, -1);
3032
+ const negative = rounded < 0;
3033
+ return `${negative ? "-" : ""}${whole}${fraction ? `.${fraction}` : ""}${percent ? "%" : ""}`;
3034
+ }
3035
+ function visioDateSerial(year, month, day) {
3036
+ if (![year, month, day].every(Number.isInteger))
3037
+ return formulaFailure("value", "DATE requires whole numbers");
3038
+ if (year < 1 || year > 9999 || month < 1 || month > 12 || day < 1 || day > 31)
3039
+ return formulaFailure("value", "DATE is outside the calendar");
3040
+ const date2 = /* @__PURE__ */ new Date(0);
3041
+ date2.setUTCFullYear(year, month - 1, day);
3042
+ if (date2.getUTCMonth() !== month - 1) return formulaFailure("value", "DATE is not a real day");
3043
+ return (date2.getTime() - Date.UTC(1899, 11, 30)) / 864e5;
3044
+ }
3045
+ var angleToLocal = (frame, angle) => angle - frame.angle;
3046
+ function localToParent(frame, x, y) {
3047
+ const dx = x - frame.locPinX, dy = y - frame.locPinY, cos = Math.cos(frame.angle), sin = Math.sin(frame.angle);
3048
+ return [frame.pinX + dx * cos - dy * sin, frame.pinY + dx * sin + dy * cos];
3049
+ }
3050
+
2997
3051
  // visio/formula-text-functions.ts
2998
3052
  var textResultFunctions = /* @__PURE__ */ new Set([
2999
3053
  "MID",
@@ -3005,12 +3059,15 @@ var textResultFunctions = /* @__PURE__ */ new Set([
3005
3059
  "SUBSTITUTE",
3006
3060
  "REPLACE",
3007
3061
  "CHAR",
3008
- "INDEX"
3062
+ "INDEX",
3063
+ "FORMAT",
3064
+ "SHAPETEXT"
3009
3065
  ]);
3010
3066
  var textNumberFunctions = /* @__PURE__ */ new Set([
3011
3067
  "LEN",
3012
3068
  "FIND",
3013
3069
  "STRSAME",
3070
+ "STRSAMEEX",
3014
3071
  "LOOKUP"
3015
3072
  ]);
3016
3073
  var LIST_SEPARATOR = ";";
@@ -3026,6 +3083,7 @@ function exactInteger(context, node3, name3) {
3026
3083
  if (!Number.isInteger(value3.value)) return unsupported2(`${name3} with a fractional number`);
3027
3084
  return value3.value;
3028
3085
  }
3086
+ var isTheText = (node3) => node3.kind === "reference" && node3.reference.cell.toLowerCase() === "thetext";
3029
3087
  function evaluateFormulaText(node3, context, depth = 0) {
3030
3088
  context.tick();
3031
3089
  if (depth > 64) return formulaFailure("limit", "Formula evaluation limit");
@@ -3036,6 +3094,10 @@ function evaluateFormulaText(node3, context, depth = 0) {
3036
3094
  if (node3.kind === "string") return node3.value;
3037
3095
  if (node3.kind === "binary" && node3.operator === "&")
3038
3096
  return text7(node3.left, "&") + text7(node3.right, "&");
3097
+ if (node3.kind === "reference" && isTheText(node3)) {
3098
+ const read = context.textOf?.(node3.reference);
3099
+ return read === void 0 ? unsupported2("Text read from a cell") : read;
3100
+ }
3039
3101
  if (node3.kind !== "call") {
3040
3102
  let value3;
3041
3103
  try {
@@ -3057,6 +3119,12 @@ function evaluateFormulaText(node3, context, depth = 0) {
3057
3119
  if (value3.unit !== "scalar") return unsupported2("Text from a number with a unit");
3058
3120
  return String(value3.value);
3059
3121
  }
3122
+ if (name3 === "SHAPETEXT") {
3123
+ arity(1);
3124
+ const target2 = args[0];
3125
+ if (!isTheText(target2)) return unsupported2("SHAPETEXT of something other than TheText");
3126
+ return text7(target2, name3);
3127
+ }
3060
3128
  if (name3 === "MID") {
3061
3129
  arity(3);
3062
3130
  const source = text7(args[0], name3), start = integer(context, args[1], name3), length = integer(context, args[2], name3);
@@ -3111,6 +3179,10 @@ function evaluateFormulaText(node3, context, depth = 0) {
3111
3179
  if (code >= 128 && code <= 159) return unsupported2("CHAR in the Windows-1252 range");
3112
3180
  return String.fromCharCode(code);
3113
3181
  }
3182
+ if (name3 === "FORMAT") {
3183
+ arity(2);
3184
+ return formatNumberPicture(context.number(args[0]), text7(args[1], name3));
3185
+ }
3114
3186
  arity(2);
3115
3187
  const index2 = integer(context, args[0], name3);
3116
3188
  const items = text7(args[1], name3).split(LIST_SEPARATOR);
@@ -3143,6 +3215,11 @@ function evaluateTextNumberFunction(name3, args, context) {
3143
3215
  const ignoreCase = args[2] ? context.number(args[2]).value !== 0 : false;
3144
3216
  return scalar4(ignoreCase ? Number(a2.toLowerCase() === b.toLowerCase()) : Number(a2 === b));
3145
3217
  }
3218
+ if (name3 === "STRSAMEEX") {
3219
+ if (args.length === 4) return formulaFailure("unsupported", "STRSAMEEX with a locale");
3220
+ arity(3);
3221
+ return scalar4(Number(strSameEx(text7(0), text7(1), context.number(args[2]).value)));
3222
+ }
3146
3223
  arity(2);
3147
3224
  const wanted = text7(0).toLowerCase();
3148
3225
  return scalar4(
@@ -3150,6 +3227,23 @@ function evaluateTextNumberFunction(name3, args, context) {
3150
3227
  );
3151
3228
  }
3152
3229
 
3230
+ // visio/formula-indirect.ts
3231
+ var FRAME_INPUTS = {
3232
+ ANGLETOLOC: ["Angle", "FlipX", "FlipY"],
3233
+ LOCTOPAR: ["PinX", "PinY", "LocPinX", "LocPinY", "Angle", "FlipX", "FlipY"]
3234
+ };
3235
+ function literalIndirectTarget(node3) {
3236
+ if (node3.kind !== "call" || node3.args.length !== 1) return void 0;
3237
+ const address = node3.args[0];
3238
+ if (address.kind !== "string") return void 0;
3239
+ try {
3240
+ const target2 = parseVisioFormula(address.value);
3241
+ return target2.kind === "reference" && !(target2.reference.shapeId === void 0 && /^(true|false)$/i.test(target2.reference.cell)) && target2.reference.cell.toLowerCase() !== "thetext" ? target2.reference : void 0;
3242
+ } catch {
3243
+ return void 0;
3244
+ }
3245
+ }
3246
+
3153
3247
  // visio/formula-math-functions.ts
3154
3248
  var mathFormulaFunctions = /* @__PURE__ */ new Set([
3155
3249
  "ROUND",
@@ -3254,7 +3348,7 @@ function evaluateMathFormulaFunction(name3, args) {
3254
3348
  return formulaFailure("unsupported", `Unsupported function ${name3}`);
3255
3349
  }
3256
3350
 
3257
- // visio/formula-evaluate.ts
3351
+ // visio/formula-analyze.ts
3258
3352
  var supported = /* @__PURE__ */ new Set([
3259
3353
  "GUARD",
3260
3354
  "IF",
@@ -3276,6 +3370,11 @@ var supported = /* @__PURE__ */ new Set([
3276
3370
  "PNTY",
3277
3371
  "ISERROR",
3278
3372
  "IFERROR",
3373
+ "INDIRECT",
3374
+ "DATE",
3375
+ "ANGLETOLOC",
3376
+ "LOCTOPAR",
3377
+ "SHEETREF",
3279
3378
  ...textNumberFunctions,
3280
3379
  ...textResultFunctions,
3281
3380
  ...numericFormulaFunctions,
@@ -3328,10 +3427,11 @@ var staticUnsupported = /* @__PURE__ */ new Set([
3328
3427
  "MSOTINT",
3329
3428
  "SHADE",
3330
3429
  "LUMDIFF",
3331
- "MODULUS"
3430
+ "MODULUS",
3431
+ // Reads an argument of the master the shape was dropped from; pure, evaluated in master scope.
3432
+ "ARG"
3332
3433
  ]);
3333
3434
  var dynamic = /* @__PURE__ */ new Set([
3334
- "INDIRECT",
3335
3435
  "EVALCELL",
3336
3436
  "EVALTEXT",
3337
3437
  "DEPENDSON",
@@ -3348,6 +3448,19 @@ var dynamic = /* @__PURE__ */ new Set([
3348
3448
  "PAR"
3349
3449
  ]);
3350
3450
  var isClassifiedVisioFunction = (name3) => supported.has(name3) || staticUnsupported.has(name3) || dynamic.has(name3);
3451
+ var opaqueFunctions = /* @__PURE__ */ new Set([
3452
+ "EVALCELL",
3453
+ "EVALTEXT",
3454
+ "GETREF",
3455
+ "REF",
3456
+ "_SHEETCELL",
3457
+ // Structure lookups: the result changes when shapes are created, moved or reparented.
3458
+ "CONTAINERSHEETREF",
3459
+ "MEMBERSHEETREF",
3460
+ "CALLOUTTARGET",
3461
+ "PARENT",
3462
+ "PAR"
3463
+ ]);
3351
3464
  function traverse(ast, limits, visit) {
3352
3465
  const maxNodes = formulaLimit(limits.maxNodes, 1024), maxDepth = formulaLimit(limits.maxDepth, 64);
3353
3466
  const queue = [[ast, 0]];
@@ -3365,7 +3478,7 @@ function traverse(ast, limits, visit) {
3365
3478
  function analyzeVisioFormula(source, limits = {}) {
3366
3479
  const ast = typeof source === "string" ? parseVisioFormula(source, limits) : source;
3367
3480
  const references = /* @__PURE__ */ new Map(), unsupportedFunctions = /* @__PURE__ */ new Set();
3368
- let unsafe2 = false, guarded = false;
3481
+ let unsafe2 = false, opaque = false, guarded = false;
3369
3482
  traverse(ast, limits, (node3) => {
3370
3483
  if (node3.kind === "reference")
3371
3484
  references.set(
@@ -3375,9 +3488,23 @@ function analyzeVisioFormula(source, limits = {}) {
3375
3488
  if (node3.kind === "call") {
3376
3489
  const inputs = node3.name === "ISTHEMED" ? ["ColorSchemeIndex"] : ["THEMEVAL", "THEME"].includes(node3.name) ? themeInputs : [];
3377
3490
  for (const cell of inputs) references.set(`!${cell.toLowerCase()}`, { cell });
3491
+ for (const cell of FRAME_INPUTS[node3.name] ?? [])
3492
+ references.set(`!${cell.toLowerCase()}`, { cell });
3493
+ if (node3.name === "INDIRECT") {
3494
+ const target2 = literalIndirectTarget(node3);
3495
+ if (target2 && limits.literalIndirect)
3496
+ references.set(`${target2.shapeId ?? ""}!${target2.cell.toLowerCase()}`, target2);
3497
+ else {
3498
+ unsafe2 = true;
3499
+ opaque = true;
3500
+ }
3501
+ }
3378
3502
  if (!supported.has(node3.name)) unsupportedFunctions.add(node3.name);
3379
- if (dynamic.has(node3.name) || !supported.has(node3.name) && !staticUnsupported.has(node3.name))
3503
+ const shapeText2 = node3.name === "SHAPETEXT" && limits.shapeTextReads === true && node3.args.length === 1 && isTheText(node3.args[0]);
3504
+ if (dynamic.has(node3.name) && !shapeText2 || !supported.has(node3.name) && !staticUnsupported.has(node3.name))
3380
3505
  unsafe2 = true;
3506
+ if (opaqueFunctions.has(node3.name) || node3.name === "SHAPETEXT" && !shapeText2 || !supported.has(node3.name) && !staticUnsupported.has(node3.name) && !dynamic.has(node3.name) && node3.name !== "_SHEETCALL")
3507
+ opaque = true;
3381
3508
  if (node3.name === "GUARD") guarded = true;
3382
3509
  }
3383
3510
  });
@@ -3385,10 +3512,56 @@ function analyzeVisioFormula(source, limits = {}) {
3385
3512
  references: [...references.values()],
3386
3513
  unsupportedFunctions: [...unsupportedFunctions],
3387
3514
  dynamic: unsafe2,
3515
+ opaque,
3388
3516
  guarded
3389
3517
  };
3390
3518
  }
3391
- function binary(operator, a2, b) {
3519
+
3520
+ // visio/formula-bound.ts
3521
+ function evaluateBound(args, arg) {
3522
+ if (args.length < 5 || (args.length - 2) % 3 !== 0 || args.length > 302)
3523
+ return formulaFailure("arity", "Invalid BOUND argument count");
3524
+ const value3 = arg(0), type = arg(1);
3525
+ if (type.unit !== "scalar" || ![0, 1, 2].includes(type.value))
3526
+ return formulaFailure("value", "BOUND type must be 0, 1 or 2");
3527
+ if (type.value === 2) return value3;
3528
+ if (type.value === 1) {
3529
+ let current = value3.value, unit4 = value3.unit;
3530
+ for (let pass = 0; pass <= (args.length - 2) / 3; pass++) {
3531
+ let moved = false;
3532
+ for (let index2 = 2; index2 < args.length; index2 += 3) {
3533
+ if (arg(index2).value !== 0) continue;
3534
+ const a2 = arg(index2 + 1), b = arg(index2 + 2);
3535
+ unit4 = compatibleFormulaUnits({ value: current, unit: unit4 }, a2);
3536
+ unit4 = compatibleFormulaUnits({ value: current, unit: unit4 }, b);
3537
+ const low2 = Math.min(a2.value, b.value), high2 = Math.max(a2.value, b.value);
3538
+ if (current > low2 && current < high2) {
3539
+ current = current - low2 < high2 - current ? low2 : high2;
3540
+ moved = true;
3541
+ }
3542
+ }
3543
+ if (!moved) break;
3544
+ }
3545
+ return finiteFormulaValue({ value: current, unit: unit4 });
3546
+ }
3547
+ let nearest;
3548
+ let unit3 = value3.unit;
3549
+ for (let index2 = 2; index2 < args.length; index2 += 3) {
3550
+ if (arg(index2).value !== 0) continue;
3551
+ const a2 = arg(index2 + 1), b = arg(index2 + 2);
3552
+ unit3 = compatibleFormulaUnits({ value: value3.value, unit: unit3 }, a2);
3553
+ unit3 = compatibleFormulaUnits({ value: value3.value, unit: unit3 }, b);
3554
+ const low2 = Math.min(a2.value, b.value), high2 = Math.max(a2.value, b.value);
3555
+ if (value3.value >= low2 && value3.value <= high2) return finiteFormulaValue({ value: value3.value, unit: unit3 });
3556
+ const edge = value3.value < low2 ? low2 : high2;
3557
+ if (nearest === void 0 || Math.abs(edge - value3.value) < Math.abs(nearest - value3.value))
3558
+ nearest = edge;
3559
+ }
3560
+ return finiteFormulaValue({ value: nearest ?? value3.value, unit: unit3 });
3561
+ }
3562
+
3563
+ // visio/formula-operators.ts
3564
+ function binaryOperator(operator, a2, b) {
3392
3565
  let unit3;
3393
3566
  if (operator === "+" || operator === "-") {
3394
3567
  unit3 = compatibleFormulaUnits(a2, b);
@@ -3418,12 +3591,36 @@ function binary(operator, a2, b) {
3418
3591
  return formulaFailure("syntax", `Unsupported operator ${operator}`);
3419
3592
  return { value: comparisons[operator] ? 1 : 0, unit: "scalar" };
3420
3593
  }
3594
+ function evaluatedShapeFrame(sheet, resolve) {
3595
+ if (sheet.kind !== "call" || sheet.name !== "SHEETREF" || sheet.args.length)
3596
+ return formulaFailure("unsupported", "A sheet other than SHEETREF()");
3597
+ const read = (cell, fallback) => {
3598
+ try {
3599
+ return finiteFormulaValue(resolve({ cell })).value;
3600
+ } catch (error) {
3601
+ if (fallback === void 0) throw error;
3602
+ return fallback;
3603
+ }
3604
+ };
3605
+ if (read("FlipX", 0) !== 0 || read("FlipY", 0) !== 0)
3606
+ return formulaFailure("unsupported", "A coordinate conversion on a flipped shape");
3607
+ return {
3608
+ pinX: read("PinX"),
3609
+ pinY: read("PinY"),
3610
+ locPinX: read("LocPinX", 0),
3611
+ locPinY: read("LocPinY", 0),
3612
+ angle: read("Angle", 0)
3613
+ };
3614
+ }
3615
+
3616
+ // visio/formula-evaluate.ts
3421
3617
  function evaluateVisioFormula(source, resolve, limits = {}) {
3422
3618
  const ast = typeof source === "string" ? parseVisioFormula(source, limits) : source;
3423
3619
  const maxSteps = formulaLimit(limits.maxSteps, 8192), maxDepth = formulaLimit(limits.maxDepth, 64);
3424
3620
  traverse(ast, limits, () => {
3425
3621
  });
3426
3622
  let steps = 0;
3623
+ const shapeFrame = (sheet) => evaluatedShapeFrame(sheet, resolve);
3427
3624
  const evaluate = (node3, depth = 0) => {
3428
3625
  if (++steps > maxSteps || depth > maxDepth)
3429
3626
  return formulaFailure("limit", "Formula evaluation limit");
@@ -3447,7 +3644,7 @@ function evaluateVisioFormula(source, resolve, limits = {}) {
3447
3644
  else if (right2.unit === "length" && left.unit === "scalar" && node3.left.kind === "number")
3448
3645
  left = { ...left, unit: "length" };
3449
3646
  }
3450
- return binary(node3.operator, left, right2);
3647
+ return binaryOperator(node3.operator, left, right2);
3451
3648
  }
3452
3649
  const name3 = node3.name;
3453
3650
  if ((name3 === "TEXTWIDTH" || name3 === "TEXTHEIGHT") && limits.text) {
@@ -3476,18 +3673,57 @@ function evaluateVisioFormula(source, resolve, limits = {}) {
3476
3673
  return formulaFailure("context", `${name3} requires a valid document context`);
3477
3674
  return { value: value4, unit: "scalar" };
3478
3675
  }
3676
+ const textContext = {
3677
+ number: (child3) => evaluate(child3, depth + 1),
3678
+ ...limits.textOf ? { textOf: limits.textOf } : {},
3679
+ tick: () => {
3680
+ if (++steps > maxSteps) formulaFailure("limit", "Formula evaluation limit");
3681
+ }
3682
+ };
3479
3683
  if (textNumberFunctions.has(name3))
3480
- return evaluateTextNumberFunction(name3, node3.args, {
3481
- number: (child3) => evaluate(child3, depth + 1),
3482
- tick: () => {
3483
- if (++steps > maxSteps) formulaFailure("limit", "Formula evaluation limit");
3484
- }
3684
+ return evaluateTextNumberFunction(name3, node3.args, textContext);
3685
+ if (name3 === "INDIRECT") {
3686
+ arity(1);
3687
+ const target2 = parseVisioFormula(evaluateFormulaText(node3.args[0], textContext, 1));
3688
+ if (target2.kind !== "reference")
3689
+ return formulaFailure("value", "INDIRECT needs a cell address");
3690
+ return finiteFormulaValue(resolve(target2.reference));
3691
+ }
3692
+ if (name3 === "DATE") {
3693
+ arity(3);
3694
+ const [year, month, day] = node3.args.map((_, index2) => {
3695
+ const part = arg(index2);
3696
+ if (part.unit !== "scalar") return formulaFailure("unit", "DATE requires plain numbers");
3697
+ return part.value;
3485
3698
  });
3699
+ return { value: visioDateSerial(year, month, day), unit: "time" };
3700
+ }
3701
+ if (name3 === "SHEETREF" || name3 === "LOCTOPAR")
3702
+ return formulaFailure("unsupported", `${name3} does not return a number`);
3703
+ if (name3 === "ANGLETOLOC") {
3704
+ arity(2);
3705
+ const angle = arg(1);
3706
+ if (angle.unit !== "angle" && angle.unit !== "scalar")
3707
+ return formulaFailure("unit", "ANGLETOLOC requires an angle");
3708
+ return { value: angleToLocal(shapeFrame(node3.args[0]), angle.value), unit: "angle" };
3709
+ }
3486
3710
  if (textResultFunctions.has(name3) || name3 === "PNT")
3487
3711
  return formulaFailure("unsupported", `${name3} does not return a number`);
3488
3712
  if (name3 === "PNTX" || name3 === "PNTY") {
3489
3713
  arity(1);
3490
3714
  const point2 = node3.args[0];
3715
+ if (point2.kind === "call" && point2.name === "LOCTOPAR") {
3716
+ if (point2.args.length !== 3)
3717
+ return formulaFailure("arity", "Invalid LOCTOPAR argument count");
3718
+ const [x2, y2] = [1, 2].map((index2) => {
3719
+ const part = evaluate(point2.args[index2], depth + 2);
3720
+ if (part.unit !== "scalar" && part.unit !== "length")
3721
+ return formulaFailure("unit", "LOCTOPAR requires lengths");
3722
+ return part.value;
3723
+ });
3724
+ const parent = localToParent(shapeFrame(point2.args[0]), x2, y2);
3725
+ return finiteFormulaValue({ value: parent[name3 === "PNTX" ? 0 : 1], unit: "length" });
3726
+ }
3491
3727
  if (point2.kind !== "call" || point2.name !== "PNT")
3492
3728
  return formulaFailure("unsupported", `${name3} of something other than PNT(x,y)`);
3493
3729
  if (point2.args.length !== 2) return formulaFailure("arity", "Invalid PNT argument count");
@@ -3545,47 +3781,7 @@ function evaluateVisioFormula(source, resolve, limits = {}) {
3545
3781
  }
3546
3782
  return finiteFormulaValue(result2);
3547
3783
  }
3548
- if (name3 === "BOUND") {
3549
- if (node3.args.length < 5 || (node3.args.length - 2) % 3 !== 0 || node3.args.length > 302)
3550
- return formulaFailure("arity", "Invalid BOUND argument count");
3551
- const value4 = arg(0), type = arg(1);
3552
- if (type.unit !== "scalar" || ![0, 1, 2].includes(type.value))
3553
- return formulaFailure("value", "BOUND type must be 0, 1 or 2");
3554
- if (type.value === 2) return value4;
3555
- if (type.value === 1) {
3556
- let current = value4.value, unit4 = value4.unit;
3557
- for (let pass = 0; pass <= (node3.args.length - 2) / 3; pass++) {
3558
- let moved = false;
3559
- for (let index2 = 2; index2 < node3.args.length; index2 += 3) {
3560
- if (arg(index2).value !== 0) continue;
3561
- const a2 = arg(index2 + 1), b = arg(index2 + 2);
3562
- unit4 = compatibleFormulaUnits({ value: current, unit: unit4 }, a2);
3563
- unit4 = compatibleFormulaUnits({ value: current, unit: unit4 }, b);
3564
- const low2 = Math.min(a2.value, b.value), high2 = Math.max(a2.value, b.value);
3565
- if (current > low2 && current < high2) {
3566
- current = current - low2 < high2 - current ? low2 : high2;
3567
- moved = true;
3568
- }
3569
- }
3570
- if (!moved) break;
3571
- }
3572
- return finiteFormulaValue({ value: current, unit: unit4 });
3573
- }
3574
- let nearest;
3575
- let unit3 = value4.unit;
3576
- for (let index2 = 2; index2 < node3.args.length; index2 += 3) {
3577
- if (arg(index2).value !== 0) continue;
3578
- const a2 = arg(index2 + 1), b = arg(index2 + 2);
3579
- unit3 = compatibleFormulaUnits({ value: value4.value, unit: unit3 }, a2);
3580
- unit3 = compatibleFormulaUnits({ value: value4.value, unit: unit3 }, b);
3581
- const low2 = Math.min(a2.value, b.value), high2 = Math.max(a2.value, b.value);
3582
- if (value4.value >= low2 && value4.value <= high2) return finiteFormulaValue({ value: value4.value, unit: unit3 });
3583
- const edge = value4.value < low2 ? low2 : high2;
3584
- if (nearest === void 0 || Math.abs(edge - value4.value) < Math.abs(nearest - value4.value))
3585
- nearest = edge;
3586
- }
3587
- return finiteFormulaValue({ value: nearest ?? value4.value, unit: unit3 });
3588
- }
3784
+ if (name3 === "BOUND") return evaluateBound(node3.args, arg);
3589
3785
  if (name3 === "ATAN2") {
3590
3786
  arity(2);
3591
3787
  const y = arg(0), x = arg(1);
@@ -3735,14 +3931,18 @@ function parseVisioFormula(source, limits = {}) {
3735
3931
  offset += identifier[0].length;
3736
3932
  whitespace();
3737
3933
  if (source[offset] === "(") {
3738
- if (!/^[A-Za-z_][A-Za-z_0-9]*$/.test(identifier[0]))
3934
+ const qualified = /^Sheet\.(\d+)!([A-Za-z_][A-Za-z_0-9]*)$/i.exec(identifier[0]);
3935
+ if (!qualified && !/^[A-Za-z_][A-Za-z_0-9]*$/.test(identifier[0]))
3739
3936
  return formulaFailure("syntax", "Qualified function names are unsupported");
3740
3937
  offset++;
3741
3938
  const args = [];
3742
3939
  whitespace();
3743
3940
  if (source[offset] !== ")") {
3744
3941
  for (; ; ) {
3745
- args.push(expression(0, depth + 1));
3942
+ whitespace();
3943
+ args.push(
3944
+ /^[,)]/.test(source.slice(offset)) ? node3({ kind: "string", value: "" }) : expression(0, depth + 1)
3945
+ );
3746
3946
  whitespace();
3747
3947
  if (source[offset] !== ",") break;
3748
3948
  offset++;
@@ -3750,7 +3950,27 @@ function parseVisioFormula(source, limits = {}) {
3750
3950
  }
3751
3951
  if (source[offset++] !== ")")
3752
3952
  return formulaFailure("syntax", "Expected function closing parenthesis");
3753
- left = node3({ kind: "call", name: identifier[0].toUpperCase(), args });
3953
+ left = node3({
3954
+ kind: "call",
3955
+ name: (qualified ? qualified[2] : identifier[0]).toUpperCase(),
3956
+ args
3957
+ });
3958
+ if (qualified)
3959
+ left = node3({
3960
+ kind: "call",
3961
+ name: "_SHEETCALL",
3962
+ args: [node3({ kind: "string", value: qualified[1] }), left]
3963
+ });
3964
+ whitespace();
3965
+ const member2 = source[offset] === "!" && /^!([A-Za-z_][A-Za-z_0-9.]*)/.exec(source.slice(offset));
3966
+ if (member2) {
3967
+ offset += member2[0].length;
3968
+ left = node3({
3969
+ kind: "call",
3970
+ name: "_SHEETCELL",
3971
+ args: [left, node3({ kind: "string", value: member2[1] })]
3972
+ });
3973
+ }
3754
3974
  } else {
3755
3975
  const ref = /^Sheet\.(\d+)!(.+)$/i.exec(identifier[0]);
3756
3976
  left = node3({
@@ -4921,20 +5141,36 @@ function indexCells(roots2, options2) {
4921
5141
  if (executableCellFormula(source) && !independentTextFieldFormula(node3, source) && !inertDoubleClickFormula(cell, source) && !(glue2 && isNativeGlueCell(cell, source)) && // A trigger only counts events of the sheet it names; an unglued connector keeps one
4922
5142
  // (Visio's freshly dropped connector names its own sheet).
4923
5143
  !(/^(BegTrigger|EndTrigger)$/.test(cell) && isNativeGlueCell(cell, source))) {
5144
+ const lenient = options2.scope === "affected";
5145
+ const unprovable = (message, opaque) => {
5146
+ if (!lenient) fail("EDIT_UNKNOWN_DEPENDENCY", message);
5147
+ item2.unsafe = true;
5148
+ item2.refusal = message;
5149
+ if (opaque) item2.opaque = true;
5150
+ };
4924
5151
  try {
4925
5152
  item2.formula = parseVisioFormula(source);
4926
- const plain4 = analyzeVisioFormula(item2.formula);
5153
+ const plain4 = analyzeVisioFormula(item2.formula, {
5154
+ shapeTextReads: true,
5155
+ literalIndirect: true
5156
+ });
4927
5157
  const analysis = plain4.dynamic && textSizeFormula(item2.formula) || plain4;
4928
- if (analysis.dynamic)
4929
- fail(
4930
- "EDIT_DYNAMIC_DEPENDENCY",
4931
- "Dynamic ShapeSheet dependencies cannot be safely edited."
5158
+ if (analysis.dynamic) {
5159
+ if (!lenient)
5160
+ fail(
5161
+ "EDIT_DYNAMIC_DEPENDENCY",
5162
+ "Dynamic ShapeSheet dependencies cannot be safely edited."
5163
+ );
5164
+ unprovable(
5165
+ `${cell} on shape ${sheet.shapeId || "page"} has dynamic ShapeSheet dependencies that cannot be followed.`,
5166
+ "opaque" in analysis && analysis.opaque
4932
5167
  );
5168
+ }
4933
5169
  item2.dependencies = analysis.references.filter((ref) => !isBooleanLiteral(ref)).map((ref) => key({ pageId: pageId2, shapeId: ref.shapeId ?? sheet.shapeId, cell: ref.cell }));
4934
5170
  } catch (error) {
4935
- fail(
4936
- "EDIT_UNKNOWN_DEPENDENCY",
4937
- `Cannot prove ShapeSheet dependency closure: ${error instanceof Error ? error.message : "invalid formula"}`
5171
+ unprovable(
5172
+ `Cannot prove ShapeSheet dependency closure: ${error instanceof Error ? error.message : "invalid formula"}`,
5173
+ true
4938
5174
  );
4939
5175
  }
4940
5176
  }
@@ -5017,13 +5253,20 @@ function createVisioCellEvaluator(cells4, options2 = {}, verifyCaches = false) {
5017
5253
  if (!item2 || item2.unsafe && (!item2.node || !options2.masterMovePins?.has(item2.node) && !options2.groupRotationCells?.has(item2.node)))
5018
5254
  fail(
5019
5255
  "EDIT_UNSUPPORTED_DEPENDENCY",
5020
- "Affected formula references missing, inherited or grouped cells."
5256
+ item2?.refusal ? `Affected formula cannot be evaluated: ${item2.refusal}` : "Affected formula references missing, inherited or grouped cells."
5021
5257
  );
5022
5258
  if (item2.node?.hasAttribute("E"))
5023
5259
  fail("EDIT_FORMULA_ERROR", "Affected ShapeSheet cell has an error cache.");
5024
5260
  active.add(id3);
5261
+ try {
5262
+ return evaluateCell(id3, item2);
5263
+ } finally {
5264
+ active.delete(id3);
5265
+ }
5266
+ };
5267
+ const evaluateCell = (id3, item2) => {
5025
5268
  let result2;
5026
- const analysis = item2.formula ? analyzeVisioFormula(item2.formula) : void 0;
5269
+ const analysis = item2.formula ? analyzeVisioFormula(item2.formula, { literalIndirect: true }) : void 0;
5027
5270
  if (item2.formula && item2.node && analysis.unsupportedFunctions.length) {
5028
5271
  if (!textSizeFormula(item2.formula))
5029
5272
  fail("EDIT_UNSUPPORTED_FORMULA", "Affected formula uses unsupported functions.");
@@ -5039,6 +5282,9 @@ function createVisioCellEvaluator(cells4, options2 = {}, verifyCaches = false) {
5039
5282
  ),
5040
5283
  {
5041
5284
  ...options2.pageContext?.get(item2.pageId),
5285
+ ...options2.textOf ? {
5286
+ textOf: (ref) => options2.textOf(item2.pageId, ref.shapeId ?? item2.shapeId)
5287
+ } : {},
5042
5288
  onStep: () => {
5043
5289
  if (--steps < 0)
5044
5290
  fail("LIMIT_FORMULA_STEPS", "ShapeSheet dependency evaluation limit exceeded.");
@@ -5062,16 +5308,63 @@ function createVisioCellEvaluator(cells4, options2 = {}, verifyCaches = false) {
5062
5308
  if (Math.abs(cachedValue2.value - result2.value) > 1e-10 * Math.max(1, Math.abs(result2.value)))
5063
5309
  fail("EDIT_FORMULA_CACHE", "Source formula and numeric cache disagree.");
5064
5310
  }
5065
- active.delete(id3);
5066
5311
  values.set(id3, result2);
5067
5312
  return result2;
5068
5313
  };
5069
5314
  return evaluate;
5070
5315
  }
5071
5316
 
5317
+ // visio/edit-recalculate-text.ts
5318
+ function plainShapeText(root2, shapeId2) {
5319
+ if (!root2) return void 0;
5320
+ const pending2 = children2(children2(root2, "Shapes")[0], "Shape");
5321
+ while (pending2.length) {
5322
+ const shape = pending2.pop();
5323
+ if (attribute2(shape, "ID") === shapeId2) {
5324
+ if (shape.hasAttribute("Master") || shape.hasAttribute("MasterShape")) return void 0;
5325
+ if (children2(shape, "Section").some((section3) => attribute2(section3, "N") === "Field"))
5326
+ return void 0;
5327
+ const texts = children2(shape, "Text");
5328
+ if (texts.length > 1) return void 0;
5329
+ const node3 = texts[0];
5330
+ if (!node3) return "";
5331
+ const plain4 = Array.from(node3.childNodes).every(
5332
+ (item2) => item2.nodeType === 3 || item2.nodeType === 4
5333
+ );
5334
+ return plain4 ? decodeVisioPlainText(node3.textContent ?? "") : void 0;
5335
+ }
5336
+ pending2.push(...children2(children2(shape, "Shapes")[0], "Shape"));
5337
+ }
5338
+ return void 0;
5339
+ }
5340
+ var TEXT_READERS = /* @__PURE__ */ new Set([...textNumberFunctions, ...textResultFunctions]);
5341
+ function textReadFormula(source) {
5342
+ try {
5343
+ const ast = parseVisioFormula(source);
5344
+ const analysis = analyzeVisioFormula(ast, { shapeTextReads: true });
5345
+ if (analysis.dynamic || analysis.unsupportedFunctions.length) return false;
5346
+ const textResult = ast.kind === "string" || isTheText(ast) || ast.kind === "binary" && ast.operator === "&" || ast.kind === "call" && textResultFunctions.has(ast.name);
5347
+ if (textResult) return false;
5348
+ let reads = 0;
5349
+ const walk = (node3, parent) => {
5350
+ if (isTheText(node3)) {
5351
+ reads++;
5352
+ return parent?.kind === "call" && TEXT_READERS.has(parent.name);
5353
+ }
5354
+ if (node3.kind === "unary") return walk(node3.operand, node3);
5355
+ if (node3.kind === "binary") return walk(node3.left, node3) && walk(node3.right, node3);
5356
+ if (node3.kind === "call") return node3.args.every((arg) => walk(arg, node3));
5357
+ return true;
5358
+ };
5359
+ return walk(ast) && reads > 0;
5360
+ } catch {
5361
+ return false;
5362
+ }
5363
+ }
5364
+
5072
5365
  // visio/edit-recalculate.ts
5073
5366
  function recalculateVisioCells(roots2, changed, options2 = {}) {
5074
- const cells4 = indexCells(roots2, options2);
5367
+ const cells4 = indexCells(roots2, { scope: "affected", ...options2 });
5075
5368
  const reverse = /* @__PURE__ */ new Map();
5076
5369
  for (const [id3, item2] of cells4)
5077
5370
  for (const dependency of item2.dependencies) {
@@ -5080,6 +5373,8 @@ function recalculateVisioCells(roots2, changed, options2 = {}) {
5080
5373
  reverse.set(dependency, next);
5081
5374
  }
5082
5375
  const affected = new Set(changed.map(key));
5376
+ const editedPages = new Set(changed.map((cell) => cell.pageId));
5377
+ for (const [id3, item2] of cells4) if (item2.opaque && editedPages.has(item2.pageId)) affected.add(id3);
5083
5378
  const pending2 = [...affected];
5084
5379
  const maxAffected = bound(options2.maxAffectedCells, 1e4);
5085
5380
  for (let i = 0; i < pending2.length; i++) {
@@ -5092,13 +5387,29 @@ function recalculateVisioCells(roots2, changed, options2 = {}) {
5092
5387
  if (affected.size > maxAffected)
5093
5388
  fail("LIMIT_FORMULA_AFFECTED", "Affected ShapeSheet cell limit exceeded.");
5094
5389
  }
5095
- const evaluate = createVisioCellEvaluator(cells4, options2);
5390
+ const evaluate = createVisioCellEvaluator(cells4, {
5391
+ textOf: (pageId2, shapeId2) => plainShapeText(roots2.get(pageId2), shapeId2),
5392
+ ...options2
5393
+ });
5096
5394
  const values = /* @__PURE__ */ new Map();
5097
- for (const id3 of affected) values.set(id3, evaluate(id3));
5395
+ for (const id3 of affected) {
5396
+ if (!cells4.has(id3) && /,"thetext"]$/.test(id3)) continue;
5397
+ try {
5398
+ values.set(id3, evaluate(id3));
5399
+ } catch (error) {
5400
+ if (options2.cycles !== "keep" || !(error instanceof VisioPackageError) || error.code !== "EDIT_FORMULA_CYCLE")
5401
+ throw error;
5402
+ const cyclic = cells4.get(id3);
5403
+ options2.diagnostics?.push({
5404
+ code: "FORMULA_CYCLE",
5405
+ message: `Kept the cached value of ${cyclic.cell} on shape ${cyclic.shapeId || "page"} (page ${cyclic.pageId}): it is part of, or depends on, a dependency cycle.`
5406
+ });
5407
+ }
5408
+ }
5098
5409
  const pages = /* @__PURE__ */ new Set();
5099
5410
  for (const id3 of affected) {
5100
5411
  const item2 = cells4.get(id3);
5101
- if (item2.node && item2.formula) {
5412
+ if (item2?.node && item2.formula && values.has(id3)) {
5102
5413
  const value3 = String(values.get(id3).value);
5103
5414
  if (item2.node.getAttribute("V") !== value3) {
5104
5415
  item2.node.setAttribute("V", value3);
@@ -5109,15 +5420,29 @@ function recalculateVisioCells(roots2, changed, options2 = {}) {
5109
5420
  return [...pages];
5110
5421
  }
5111
5422
  function assertVisioShapesUnreferenced(roots2, removed, options2 = {}) {
5112
- const cells4 = indexCells(roots2, options2);
5423
+ const cells4 = indexCells(roots2, { scope: "affected", ...options2 });
5424
+ const frozen = [];
5113
5425
  for (const cell of cells4.values()) {
5114
5426
  options2.check?.();
5427
+ if (cell.opaque && removed.has(cell.pageId) && !removed.get(cell.pageId).has(cell.shapeId))
5428
+ fail(
5429
+ "EDIT_REFERENCED_DELETE",
5430
+ `${cell.cell} on shape ${cell.shapeId || "page"} may read the removed shape through a dynamic dependency.`
5431
+ );
5115
5432
  if (removed.get(cell.pageId)?.has(cell.shapeId)) continue;
5116
5433
  if (cell.dependencies.some((id3) => {
5117
5434
  const parts = JSON.parse(id3);
5118
5435
  return removed.get(parts[0])?.has(parts[1]) ?? false;
5119
- }))
5120
- fail("EDIT_REFERENCED_DELETE", "Shape is referenced by a ShapeSheet formula.");
5436
+ })) {
5437
+ if (!options2.freeze || !cell.node || !cell.formula || cell.unsafe || cell.node.hasAttribute("E") || analyzeVisioFormula(cell.formula, { literalIndirect: true }).guarded || !Number.isFinite(
5438
+ visioFormulaCachedValue(
5439
+ cell.node.getAttribute("V") ?? "",
5440
+ cell.node.getAttribute("U") ?? void 0
5441
+ ).value
5442
+ ))
5443
+ fail("EDIT_REFERENCED_DELETE", "Shape is referenced by a ShapeSheet formula.");
5444
+ frozen.push(cell.node);
5445
+ }
5121
5446
  }
5122
5447
  for (const [pageId2, ids] of removed)
5123
5448
  for (const connections2 of children2(roots2.get(pageId2), "Connects"))
@@ -5126,12 +5451,16 @@ function assertVisioShapesUnreferenced(roots2, removed, options2 = {}) {
5126
5451
  if (["FromSheet", "ToSheet"].some((name3) => ids.has(attribute2(connection, name3) ?? "")))
5127
5452
  fail("EDIT_REFERENCED_DELETE", "Shape participates in a Connect record.");
5128
5453
  }
5454
+ return frozen;
5129
5455
  }
5456
+ var freezeVisioCells = (nodes) => {
5457
+ for (const node3 of nodes) node3.removeAttribute("F");
5458
+ };
5130
5459
  function assertVisioShapeUnreferenced(roots2, pageId2, shapeId2, options2 = {}) {
5131
- assertVisioShapesUnreferenced(roots2, /* @__PURE__ */ new Map([[pageId2, /* @__PURE__ */ new Set([shapeId2])]]), options2);
5460
+ return assertVisioShapesUnreferenced(roots2, /* @__PURE__ */ new Map([[pageId2, /* @__PURE__ */ new Set([shapeId2])]]), options2);
5132
5461
  }
5133
5462
  function createVisioDependencyQuery(roots2, options2 = {}) {
5134
- const cells4 = indexCells(roots2, options2);
5463
+ const cells4 = indexCells(roots2, { scope: "affected", ...options2 });
5135
5464
  return (source, targets) => {
5136
5465
  const wanted = new Set(targets.map(key));
5137
5466
  const seen = /* @__PURE__ */ new Set();
@@ -5146,7 +5475,7 @@ function createVisioDependencyQuery(roots2, options2 = {}) {
5146
5475
  if (seen.size > maxSteps) fail("LIMIT_FORMULA_STEPS", "Dependency analysis limit exceeded.");
5147
5476
  const item2 = cells4.get(id3);
5148
5477
  if (!item2 || item2.unsafe || item2.node?.hasAttribute("E")) return false;
5149
- if (item2.formula && analyzeVisioFormula(item2.formula).unsupportedFunctions.length)
5478
+ if (item2.formula && analyzeVisioFormula(item2.formula, { literalIndirect: true }).unsupportedFunctions.length)
5150
5479
  return false;
5151
5480
  if (wanted.has(id3)) found = true;
5152
5481
  else pending2.push(...item2.dependencies);
@@ -6186,7 +6515,7 @@ var VISIO_DEFAULT_TITLE = "Title";
6186
6515
  var ACCENT = { background: "Background Accent", border: "Border Accent" };
6187
6516
  function visioShade(color2, amount) {
6188
6517
  const value3 = Number.parseInt(color2.slice(1), 16);
6189
- const channel = (shift2) => Math.round((value3 >> shift2 & 255) * (1 - amount)).toString(16).padStart(2, "0");
6518
+ const channel = (shift3) => Math.round((value3 >> shift3 & 255) * (1 - amount)).toString(16).padStart(2, "0");
6190
6519
  return `#${channel(16)}${channel(8)}${channel(0)}`.toUpperCase();
6191
6520
  }
6192
6521
  function visioDecorationName(name3) {
@@ -8316,9 +8645,16 @@ function visioWalkPath(begin, end) {
8316
8645
  return horizontal3 ? [p, { x: p.x + turn, y: p.y }, { x: p.x + turn, y: q.y }, q] : [p, { x: p.x, y: p.y + turn }, { x: q.x, y: p.y + turn }, q];
8317
8646
  };
8318
8647
  let path3;
8319
- if (gapX >= -EPSILON2 && inside2(from.y, b.minY, b.maxY))
8320
- path3 = jog(side(begin, sx, 0), side(end, -sx, 0), true);
8321
- else if (gapY >= -EPSILON2 && inside2(from.x, b.minX, b.maxX))
8648
+ if (gapX >= -EPSILON2 && inside2(from.y, b.minY, b.maxY)) {
8649
+ const p = side(begin, sx, 0), q = side(end, -sx, 0);
8650
+ if (begin.shape?.floating && end.shape?.floating) {
8651
+ const y = (Math.max(a2.minY, b.minY) + Math.min(a2.maxY, b.maxY)) / 2;
8652
+ path3 = [
8653
+ { x: p.x, y },
8654
+ { x: q.x, y }
8655
+ ];
8656
+ } else path3 = jog(p, q, true);
8657
+ } else if (gapY >= -EPSILON2 && inside2(from.x, b.minX, b.maxX))
8322
8658
  path3 = jog(side(begin, 0, sy), side(end, 0, -sy), false);
8323
8659
  else if (gapY < -EPSILON2 || gapY < CHANNEL && gapX >= CHANNEL) {
8324
8660
  const p = side(begin, sx, 0);
@@ -15375,10 +15711,10 @@ async function* streamEntryGuarded(entry3, alreadyRead, limits) {
15375
15711
  }
15376
15712
  }
15377
15713
  function toBase64(bytes) {
15378
- let binary2 = "";
15714
+ let binary = "";
15379
15715
  for (let i = 0; i < bytes.length; i += 32768)
15380
- binary2 += String.fromCharCode(...bytes.subarray(i, i + 32768));
15381
- return btoa(binary2);
15716
+ binary += String.fromCharCode(...bytes.subarray(i, i + 32768));
15717
+ return btoa(binary);
15382
15718
  }
15383
15719
  function guardZip(zip, limits = {}) {
15384
15720
  const r = resolveLimits(limits);
@@ -17822,6 +18158,332 @@ function parseStyles(xml, warnings) {
17822
18158
  return result2;
17823
18159
  }
17824
18160
 
18161
+ // xlsx/read/print-options.ts
18162
+ var KEYS = ["gridLines", "headings", "horizontalCentered", "verticalCentered"];
18163
+ function readPrintOptions(node3) {
18164
+ if (!node3) return void 0;
18165
+ const out = {};
18166
+ for (const key2 of KEYS) if (boolAttr(node3, key2)) out[key2] = true;
18167
+ return Object.keys(out).length ? out : void 0;
18168
+ }
18169
+
18170
+ // xlsx/read/password-hash.ts
18171
+ function modernHashAttributeNames(prefix2 = "") {
18172
+ const name3 = (base2) => prefix2 ? `${prefix2}${base2[0].toUpperCase()}${base2.slice(1)}` : base2;
18173
+ return {
18174
+ algorithmName: name3("algorithmName"),
18175
+ hashValue: name3("hashValue"),
18176
+ saltValue: name3("saltValue"),
18177
+ spinCount: name3("spinCount")
18178
+ };
18179
+ }
18180
+ function readModernHash(node3, prefix2 = "") {
18181
+ const names = modernHashAttributeNames(prefix2);
18182
+ const algorithmName = att(node3, names.algorithmName);
18183
+ const hashValue = att(node3, names.hashValue);
18184
+ const saltValue = att(node3, names.saltValue);
18185
+ if (!algorithmName || !hashValue || !saltValue) return void 0;
18186
+ const hash = { algorithmName, hashValue, saltValue };
18187
+ const spin = att(node3, names.spinCount);
18188
+ const spinCount = spin === void 0 || spin.trim() === "" ? Number.NaN : Number(spin);
18189
+ if (Number.isFinite(spinCount)) hash.spinCount = spinCount;
18190
+ return hash;
18191
+ }
18192
+
18193
+ // xlsx/read/sheet-props.ts
18194
+ var defaultSheetView = () => ({
18195
+ showGridLines: true,
18196
+ showHeaders: true,
18197
+ showZeros: true,
18198
+ rightToLeft: false,
18199
+ zoom: 100
18200
+ });
18201
+ function parseSqref(sqref) {
18202
+ if (!sqref) return [];
18203
+ return sqref.split(/\s+/).filter(Boolean).map((part) => parseRange(part)).filter((range2) => range2 !== void 0);
18204
+ }
18205
+ var readTabColor = (sheetPr, palette) => parseColor(xFirst(sheetPr, "tabColor"), palette);
18206
+ var readFitToPage = (sheetPr) => boolAttr(xFirst(sheetPr, "pageSetUpPr"), "fitToPage") ?? false;
18207
+ function readSheetView(sheetViews) {
18208
+ const view = defaultSheetView();
18209
+ const node3 = xFirst(sheetViews, "sheetView");
18210
+ if (!node3) return view;
18211
+ view.showGridLines = boolAttr(node3, "showGridLines", true);
18212
+ view.showHeaders = boolAttr(node3, "showRowColHeaders", true);
18213
+ view.showZeros = boolAttr(node3, "showZeros", true);
18214
+ view.rightToLeft = boolAttr(node3, "rightToLeft", false);
18215
+ view.zoom = numAttr(node3, "zoomScale") || 100;
18216
+ if (boolAttr(node3, "showFormulas")) view.showFormulas = true;
18217
+ const mode = att(node3, "view");
18218
+ if (mode === "pageLayout" || mode === "pageBreakPreview") view.mode = mode;
18219
+ const pane = xFirst(node3, "pane");
18220
+ const state = att(pane, "state");
18221
+ const frozen = pane && (state === "frozen" || state === "frozenSplit");
18222
+ if (frozen) {
18223
+ const rows = Math.max(0, Math.round(numAttr(pane, "ySplit") ?? 0));
18224
+ const cols = Math.max(0, Math.round(numAttr(pane, "xSplit") ?? 0));
18225
+ if (rows || cols) view.freeze = { rows, cols };
18226
+ }
18227
+ const topLeft = parseAddress(
18228
+ (frozen ? att(pane, "topLeftCell") : att(node3, "topLeftCell")) ?? ""
18229
+ );
18230
+ if (topLeft) view.topLeft = topLeft;
18231
+ const selections = xChildren(node3, "selection");
18232
+ const activePane = att(pane, "activePane") ?? "topLeft";
18233
+ const selection = selections.find((sel) => (att(sel, "pane") ?? "topLeft") === activePane) ?? selections[0];
18234
+ if (selection) {
18235
+ const ranges = parseSqref(att(selection, "sqref") ?? att(selection, "activeCell") ?? "A1");
18236
+ const active = parseAddress(att(selection, "activeCell") ?? "") ?? ranges[0]?.start ?? { row: 0, col: 0 };
18237
+ view.selection = {
18238
+ active,
18239
+ ranges: ranges.length ? ranges : [{ start: active, end: { ...active } }]
18240
+ };
18241
+ }
18242
+ return view;
18243
+ }
18244
+ var FORMAT_FLAGS = ["zeroHeight", "customHeight", "thickTop", "thickBottom"];
18245
+ function readSheetFormat(format5) {
18246
+ const result2 = {
18247
+ defaultRowHeight: numAttr(format5, "defaultRowHeight") ?? 15
18248
+ };
18249
+ const width = numAttr(format5, "defaultColWidth");
18250
+ if (width !== void 0) result2.defaultColWidth = width;
18251
+ const flags = {};
18252
+ for (const key2 of FORMAT_FLAGS) {
18253
+ const value3 = boolAttr(format5, key2);
18254
+ if (value3 !== void 0) flags[key2] = value3;
18255
+ }
18256
+ const base2 = numAttr(format5, "baseColWidth");
18257
+ if (base2 !== void 0) flags.baseColWidth = base2;
18258
+ if (Object.keys(flags).length) result2.format = flags;
18259
+ return result2;
18260
+ }
18261
+ function readColumns(cols, xfMap) {
18262
+ const out = [];
18263
+ for (const col of cols ? xChildren(cols, "col") : []) {
18264
+ const min = (numAttr(col, "min") ?? 1) - 1;
18265
+ const max = (numAttr(col, "max") ?? min + 1) - 1;
18266
+ const info = { min, max };
18267
+ const width = numAttr(col, "width");
18268
+ if (width !== void 0) info.width = width;
18269
+ if (boolAttr(col, "customWidth")) info.customWidth = true;
18270
+ if (boolAttr(col, "hidden")) info.hidden = true;
18271
+ const style2 = numAttr(col, "style");
18272
+ const styleId = style2 === void 0 ? 0 : xfMap[style2] ?? 0;
18273
+ if (styleId) info.styleId = styleId;
18274
+ const outline = numAttr(col, "outlineLevel");
18275
+ if (outline) info.outlineLevel = outline;
18276
+ if (boolAttr(col, "collapsed")) info.collapsed = true;
18277
+ if (boolAttr(col, "bestFit")) info.bestFit = true;
18278
+ out.push(info);
18279
+ }
18280
+ return out;
18281
+ }
18282
+ var MAIN_NS_DECL = /(?<=^<[^>]*) xmlns="http:\/\/schemas\.openxmlformats\.org\/spreadsheetml\/2006\/main"/;
18283
+ function readAutoFilter(node3) {
18284
+ const range2 = parseRange(att(node3, "ref") ?? "");
18285
+ if (!node3 || !range2) return void 0;
18286
+ const filter = { range: range2 };
18287
+ const columns = [];
18288
+ for (const column of xChildren(node3, "filterColumn")) {
18289
+ const entry3 = {
18290
+ offset: numAttr(column, "colId") ?? 0
18291
+ };
18292
+ const filters = xFirst(column, "filters");
18293
+ if (filters) {
18294
+ entry3.values = xChildren(filters, "filter").map((f) => att(f, "val") ?? "");
18295
+ if (boolAttr(filters, "blank")) entry3.blank = true;
18296
+ }
18297
+ entry3.sourceXml = outerXml(column).replace(MAIN_NS_DECL, "");
18298
+ columns.push(entry3);
18299
+ }
18300
+ if (columns.length) filter.columns = columns;
18301
+ return filter;
18302
+ }
18303
+ var HEADER_FOOTER_TEXT = {
18304
+ header: "oddHeader",
18305
+ footer: "oddFooter",
18306
+ evenHeader: "evenHeader",
18307
+ evenFooter: "evenFooter",
18308
+ firstHeader: "firstHeader",
18309
+ firstFooter: "firstFooter"
18310
+ };
18311
+ var HEADER_FOOTER_FLAGS = [
18312
+ "differentOddEven",
18313
+ "differentFirst",
18314
+ "scaleWithDoc",
18315
+ "alignWithMargins"
18316
+ ];
18317
+ function readHeaderFooter(node3) {
18318
+ const out = {};
18319
+ for (const key2 of HEADER_FOOTER_FLAGS) {
18320
+ const value3 = boolAttr(node3, key2);
18321
+ if (value3 !== void 0) out[key2] = value3;
18322
+ }
18323
+ for (const [key2, local] of Object.entries(HEADER_FOOTER_TEXT)) {
18324
+ const child3 = xFirst(node3, local);
18325
+ if (child3) out[key2] = xText(child3);
18326
+ }
18327
+ return out;
18328
+ }
18329
+ var ORIENTATIONS = /* @__PURE__ */ new Set(["portrait", "landscape"]);
18330
+ function readPageSetup(margins, setup, headerFooter, fitToPage) {
18331
+ const page = {};
18332
+ if (setup) {
18333
+ if (/^(1|true)$/.test(att(setup, "useFirstPageNumber") ?? "")) {
18334
+ page.firstPageNumber = numAttr(setup, "firstPageNumber") ?? 1;
18335
+ }
18336
+ const order = att(setup, "pageOrder");
18337
+ if (order === "downThenOver" || order === "overThenDown") page.pageOrder = order;
18338
+ const orientation = att(setup, "orientation");
18339
+ if (orientation && ORIENTATIONS.has(orientation))
18340
+ page.orientation = orientation;
18341
+ const paper = numAttr(setup, "paperSize");
18342
+ if (paper !== void 0) page.paperSize = paper;
18343
+ const scale = numAttr(setup, "scale");
18344
+ if (scale !== void 0) page.scale = scale;
18345
+ }
18346
+ if (fitToPage) {
18347
+ page.fitToWidth = numAttr(setup, "fitToWidth") ?? 1;
18348
+ page.fitToHeight = numAttr(setup, "fitToHeight") ?? 1;
18349
+ }
18350
+ if (margins) {
18351
+ const m = (name3, fallback) => numAttr(margins, name3) ?? fallback;
18352
+ page.margins = {
18353
+ left: m("left", 0.7),
18354
+ right: m("right", 0.7),
18355
+ top: m("top", 0.75),
18356
+ bottom: m("bottom", 0.75),
18357
+ header: m("header", 0.3),
18358
+ footer: m("footer", 0.3)
18359
+ };
18360
+ }
18361
+ if (headerFooter) Object.assign(page, readHeaderFooter(headerFooter));
18362
+ return Object.keys(page).length ? page : void 0;
18363
+ }
18364
+ var PROTECTION_META = /* @__PURE__ */ new Set([
18365
+ "sheet",
18366
+ "password",
18367
+ "algorithmName",
18368
+ "hashValue",
18369
+ "saltValue",
18370
+ "spinCount"
18371
+ ]);
18372
+ function readProtection(node3) {
18373
+ if (!node3) return void 0;
18374
+ const protection2 = { sheet: boolAttr(node3, "sheet", false) };
18375
+ const password = att(node3, "password");
18376
+ if (password) protection2.passwordHash = password;
18377
+ const modernHash = readModernHash(node3);
18378
+ if (modernHash) protection2.modernHash = modernHash;
18379
+ const allow = [];
18380
+ for (const attribute4 of Array.from(node3.attributes)) {
18381
+ if (PROTECTION_META.has(attribute4.name)) continue;
18382
+ if (attribute4.value === "0" || attribute4.value === "false") allow.push(attribute4.name);
18383
+ }
18384
+ if (allow.length) protection2.allow = allow.sort();
18385
+ return protection2;
18386
+ }
18387
+
18388
+ // xlsx/read/custom-views.ts
18389
+ var SHEET_VIEW_ATTRS = [
18390
+ "guid",
18391
+ "scale",
18392
+ "showGridLines",
18393
+ "showRowCol",
18394
+ "zeroValues",
18395
+ "topLeftCell",
18396
+ "view",
18397
+ "showFormulas",
18398
+ "hiddenRows",
18399
+ "hiddenColumns",
18400
+ "filter",
18401
+ "showAutoFilter",
18402
+ "fitToPage"
18403
+ ];
18404
+ var WORKBOOK_VIEW_KNOWN = ["name", "guid", "includePrintSettings", "includeHiddenRowCol"];
18405
+ function readCustomWorkbookViews(node3) {
18406
+ return xChildren(node3, "customWorkbookView").flatMap((view) => {
18407
+ const guid2 = att(view, "guid");
18408
+ if (!guid2) return [];
18409
+ const attrs = {};
18410
+ for (const attribute4 of Array.from(view.attributes))
18411
+ if (!WORKBOOK_VIEW_KNOWN.includes(attribute4.name) && !attribute4.name.startsWith("xmlns"))
18412
+ attrs[attribute4.name] = attribute4.value;
18413
+ return [
18414
+ {
18415
+ guid: guid2,
18416
+ name: att(view, "name") ?? "",
18417
+ includePrintSettings: boolAttr(view, "includePrintSettings", true),
18418
+ includeHiddenRowCol: boolAttr(view, "includeHiddenRowCol", true),
18419
+ attrs
18420
+ }
18421
+ ];
18422
+ });
18423
+ }
18424
+ var escape3 = (value3) => value3.replace(/&/g, "&amp;").replace(/"/g, "&quot;");
18425
+ function asSheetViews(view) {
18426
+ const map = [
18427
+ ["scale", "zoomScale"],
18428
+ ["showGridLines", "showGridLines"],
18429
+ ["showRowCol", "showRowColHeaders"],
18430
+ ["zeroValues", "showZeros"],
18431
+ ["topLeftCell", "topLeftCell"],
18432
+ ["view", "view"],
18433
+ ["showFormulas", "showFormulas"]
18434
+ ];
18435
+ const attributes = map.flatMap(([from, to]) => {
18436
+ const value3 = att(view, from);
18437
+ return value3 === void 0 ? [] : [` ${to}="${escape3(value3)}"`];
18438
+ }).join("");
18439
+ const children3 = elements(view).filter((child3) => child3.localName === "pane" || child3.localName === "selection").map((child3) => outerXml(child3)).join("");
18440
+ return parseXml(
18441
+ `<sheetViews xmlns="${NS.x}"><sheetView${attributes}>${children3}</sheetView></sheetViews>`
18442
+ ).documentElement;
18443
+ }
18444
+ function readCustomSheetViews(node3) {
18445
+ return xChildren(node3, "customSheetView").flatMap((view) => {
18446
+ const guid2 = att(view, "guid");
18447
+ if (!guid2) return [];
18448
+ const child3 = (name3) => xChildren(view, name3)[0];
18449
+ const pageSetup = readPageSetup(
18450
+ child3("pageMargins"),
18451
+ child3("pageSetup"),
18452
+ child3("headerFooter"),
18453
+ boolAttr(view, "fitToPage", false)
18454
+ );
18455
+ const printOptions = readPrintOptions(child3("printOptions"));
18456
+ const filter = readAutoFilter(child3("autoFilter"));
18457
+ const attrs = {};
18458
+ for (const attribute4 of Array.from(view.attributes))
18459
+ if (!SHEET_VIEW_ATTRS.includes(attribute4.name) && !attribute4.name.startsWith("xmlns"))
18460
+ attrs[attribute4.name] = attribute4.value;
18461
+ const modelled = [
18462
+ "pane",
18463
+ "selection",
18464
+ "pageMargins",
18465
+ "printOptions",
18466
+ "pageSetup",
18467
+ "headerFooter",
18468
+ "autoFilter"
18469
+ ];
18470
+ return [
18471
+ {
18472
+ guid: guid2,
18473
+ view: readSheetView(asSheetViews(view)),
18474
+ ...boolAttr(view, "hiddenRows", false) ? { hiddenRows: true } : {},
18475
+ ...boolAttr(view, "hiddenColumns", false) ? { hiddenColumns: true } : {},
18476
+ ...filter ? { filter } : {},
18477
+ ...boolAttr(view, "showAutoFilter", false) ? { showAutoFilter: true } : {},
18478
+ ...pageSetup ? { pageSetup } : {},
18479
+ ...printOptions ? { printOptions } : {},
18480
+ attrs,
18481
+ extra: elements(view).filter((c2) => !modelled.includes(c2.localName ?? "")).map((c2) => outerXml(c2))
18482
+ }
18483
+ ];
18484
+ });
18485
+ }
18486
+
17825
18487
  // xlsx/read/formula-storage.ts
17826
18488
  function tokens(formula2) {
17827
18489
  try {
@@ -17919,30 +18581,20 @@ function stripFuturePrefixes(formula2) {
17919
18581
  return fromStoredSyntax(plain4);
17920
18582
  }
17921
18583
 
17922
- // xlsx/read/password-hash.ts
17923
- function modernHashAttributeNames(prefix2 = "") {
17924
- const name3 = (base2) => prefix2 ? `${prefix2}${base2[0].toUpperCase()}${base2.slice(1)}` : base2;
17925
- return {
17926
- algorithmName: name3("algorithmName"),
17927
- hashValue: name3("hashValue"),
17928
- saltValue: name3("saltValue"),
17929
- spinCount: name3("spinCount")
17930
- };
17931
- }
17932
- function readModernHash(node3, prefix2 = "") {
17933
- const names = modernHashAttributeNames(prefix2);
17934
- const algorithmName = att(node3, names.algorithmName);
17935
- const hashValue = att(node3, names.hashValue);
17936
- const saltValue = att(node3, names.saltValue);
17937
- if (!algorithmName || !hashValue || !saltValue) return void 0;
17938
- const hash = { algorithmName, hashValue, saltValue };
17939
- const spin = att(node3, names.spinCount);
17940
- const spinCount = spin === void 0 || spin.trim() === "" ? Number.NaN : Number(spin);
17941
- if (Number.isFinite(spinCount)) hash.spinCount = spinCount;
17942
- return hash;
17943
- }
17944
-
17945
18584
  // xlsx/read/workbook-part.ts
18585
+ var NAME_EXTRA_ATTRIBUTES = [
18586
+ "function",
18587
+ "vbProcedure",
18588
+ "xlm",
18589
+ "customMenu",
18590
+ "description",
18591
+ "help",
18592
+ "statusBar",
18593
+ "shortcutKey",
18594
+ "functionGroupId",
18595
+ "publishToServer",
18596
+ "workbookParameter"
18597
+ ];
17946
18598
  function parseWorkbookPart(xml) {
17947
18599
  const root2 = parseXml(xml, { label: "XLSX workbook" }).documentElement;
17948
18600
  const sheets = [];
@@ -17966,6 +18618,12 @@ function parseWorkbookPart(xml) {
17966
18618
  if (boolAttr(node3, "hidden")) name3.hidden = true;
17967
18619
  const comment = att(node3, "comment");
17968
18620
  if (comment) name3.comment = comment;
18621
+ const extra = {};
18622
+ for (const key2 of NAME_EXTRA_ATTRIBUTES) {
18623
+ const value3 = att(node3, key2);
18624
+ if (value3 !== void 0) extra[key2] = value3;
18625
+ }
18626
+ if (Object.keys(extra).length) name3.extra = extra;
17969
18627
  if (name3.name) definedNames.push(name3);
17970
18628
  }
17971
18629
  const view = xFirst(xFirst(root2, "bookViews"), "workbookView");
@@ -17979,7 +18637,9 @@ function parseWorkbookPart(xml) {
17979
18637
  delta: numAttr(calcPr, "iterateDelta") ?? 1e-3
17980
18638
  } : void 0;
17981
18639
  const oleSize = att(xFirst(root2, "oleSize"), "ref");
18640
+ const customViews = xFirst(root2, "customWorkbookViews");
17982
18641
  return {
18642
+ ...customViews ? { customViews: readCustomWorkbookViews(customViews) } : {},
17983
18643
  ...oleSize ? { oleSize } : {},
17984
18644
  ...iterate ? { iterate } : {},
17985
18645
  ...password ? { workbookPasswordHash: password } : {},
@@ -18013,9 +18673,9 @@ function parseFormula(fmla) {
18013
18673
  return { op, args };
18014
18674
  }
18015
18675
  function resolveOperand(token, variables) {
18016
- const num = Number(token);
18017
- if (Number.isFinite(num)) {
18018
- return num;
18676
+ const num2 = Number(token);
18677
+ if (Number.isFinite(num2)) {
18678
+ return num2;
18019
18679
  }
18020
18680
  const value3 = variables.get(token);
18021
18681
  if (value3 !== void 0) {
@@ -19688,18 +20348,18 @@ function groupTransform(group2, parent) {
19688
20348
  const ext = first(xfrm, "ext", NS.a);
19689
20349
  const chOff = first(xfrm, "chOff", NS.a);
19690
20350
  const chExt = first(xfrm, "chExt", NS.a);
19691
- const num = (element2, name3) => Number.parseInt(element2?.getAttribute(name3) ?? "", 10);
19692
- const cx = num(ext, "cx");
19693
- const cy = num(ext, "cy");
19694
- const chCx = num(chExt, "cx");
19695
- const chCy = num(chExt, "cy");
20351
+ const num2 = (element2, name3) => Number.parseInt(element2?.getAttribute(name3) ?? "", 10);
20352
+ const cx = num2(ext, "cx");
20353
+ const cy = num2(ext, "cy");
20354
+ const chCx = num2(chExt, "cx");
20355
+ const chCy = num2(chExt, "cy");
19696
20356
  if (!off || ![cx, cy, chCx, chCy].every(Number.isFinite) || chCx === 0 || chCy === 0)
19697
20357
  return parent;
19698
20358
  const scaleX = cx / chCx;
19699
20359
  const scaleY = cy / chCy;
19700
20360
  const local = {
19701
- offsetX: num(off, "x") - (num(chOff, "x") || 0) * scaleX,
19702
- offsetY: num(off, "y") - (num(chOff, "y") || 0) * scaleY,
20361
+ offsetX: num2(off, "x") - (num2(chOff, "x") || 0) * scaleX,
20362
+ offsetY: num2(off, "y") - (num2(chOff, "y") || 0) * scaleY,
19703
20363
  scaleX,
19704
20364
  scaleY
19705
20365
  };
@@ -20007,200 +20667,48 @@ async function resolveSmartArt(sheets, source, warn) {
20007
20667
  }
20008
20668
  }
20009
20669
 
20010
- // xlsx/read/sheet-props.ts
20011
- var defaultSheetView = () => ({
20012
- showGridLines: true,
20013
- showHeaders: true,
20014
- showZeros: true,
20015
- rightToLeft: false,
20016
- zoom: 100
20017
- });
20018
- function parseSqref(sqref) {
20019
- if (!sqref) return [];
20020
- return sqref.split(/\s+/).filter(Boolean).map((part) => parseRange(part)).filter((range2) => range2 !== void 0);
20021
- }
20022
- var readTabColor = (sheetPr, palette) => parseColor(xFirst(sheetPr, "tabColor"), palette);
20023
- var readFitToPage = (sheetPr) => boolAttr(xFirst(sheetPr, "pageSetUpPr"), "fitToPage") ?? false;
20024
- function readSheetView(sheetViews) {
20025
- const view = defaultSheetView();
20026
- const node3 = xFirst(sheetViews, "sheetView");
20027
- if (!node3) return view;
20028
- view.showGridLines = boolAttr(node3, "showGridLines", true);
20029
- view.showHeaders = boolAttr(node3, "showRowColHeaders", true);
20030
- view.showZeros = boolAttr(node3, "showZeros", true);
20031
- view.rightToLeft = boolAttr(node3, "rightToLeft", false);
20032
- view.zoom = numAttr(node3, "zoomScale") || 100;
20033
- if (boolAttr(node3, "showFormulas")) view.showFormulas = true;
20034
- const mode = att(node3, "view");
20035
- if (mode === "pageLayout" || mode === "pageBreakPreview") view.mode = mode;
20036
- const pane = xFirst(node3, "pane");
20037
- const state = att(pane, "state");
20038
- const frozen = pane && (state === "frozen" || state === "frozenSplit");
20039
- if (frozen) {
20040
- const rows = Math.max(0, Math.round(numAttr(pane, "ySplit") ?? 0));
20041
- const cols = Math.max(0, Math.round(numAttr(pane, "xSplit") ?? 0));
20042
- if (rows || cols) view.freeze = { rows, cols };
20043
- }
20044
- const topLeft = parseAddress(
20045
- (frozen ? att(pane, "topLeftCell") : att(node3, "topLeftCell")) ?? ""
20046
- );
20047
- if (topLeft) view.topLeft = topLeft;
20048
- const selections = xChildren(node3, "selection");
20049
- const activePane = att(pane, "activePane") ?? "topLeft";
20050
- const selection = selections.find((sel) => (att(sel, "pane") ?? "topLeft") === activePane) ?? selections[0];
20051
- if (selection) {
20052
- const ranges = parseSqref(att(selection, "sqref") ?? att(selection, "activeCell") ?? "A1");
20053
- const active = parseAddress(att(selection, "activeCell") ?? "") ?? ranges[0]?.start ?? { row: 0, col: 0 };
20054
- view.selection = {
20055
- active,
20056
- ranges: ranges.length ? ranges : [{ start: active, end: { ...active } }]
20057
- };
20058
- }
20059
- return view;
20060
- }
20061
- var FORMAT_FLAGS = ["zeroHeight", "customHeight", "thickTop", "thickBottom"];
20062
- function readSheetFormat(format5) {
20063
- const result2 = {
20064
- defaultRowHeight: numAttr(format5, "defaultRowHeight") ?? 15
20065
- };
20066
- const width = numAttr(format5, "defaultColWidth");
20067
- if (width !== void 0) result2.defaultColWidth = width;
20068
- const flags = {};
20069
- for (const key2 of FORMAT_FLAGS) {
20070
- const value3 = boolAttr(format5, key2);
20071
- if (value3 !== void 0) flags[key2] = value3;
20072
- }
20073
- const base2 = numAttr(format5, "baseColWidth");
20074
- if (base2 !== void 0) flags.baseColWidth = base2;
20075
- if (Object.keys(flags).length) result2.format = flags;
20076
- return result2;
20077
- }
20078
- function readColumns(cols, xfMap) {
20079
- const out = [];
20080
- for (const col of cols ? xChildren(cols, "col") : []) {
20081
- const min = (numAttr(col, "min") ?? 1) - 1;
20082
- const max = (numAttr(col, "max") ?? min + 1) - 1;
20083
- const info = { min, max };
20084
- const width = numAttr(col, "width");
20085
- if (width !== void 0) info.width = width;
20086
- if (boolAttr(col, "customWidth")) info.customWidth = true;
20087
- if (boolAttr(col, "hidden")) info.hidden = true;
20088
- const style2 = numAttr(col, "style");
20089
- const styleId = style2 === void 0 ? 0 : xfMap[style2] ?? 0;
20090
- if (styleId) info.styleId = styleId;
20091
- const outline = numAttr(col, "outlineLevel");
20092
- if (outline) info.outlineLevel = outline;
20093
- if (boolAttr(col, "collapsed")) info.collapsed = true;
20094
- if (boolAttr(col, "bestFit")) info.bestFit = true;
20095
- out.push(info);
20096
- }
20097
- return out;
20098
- }
20099
- var MAIN_NS_DECL = /(?<=^<[^>]*) xmlns="http:\/\/schemas\.openxmlformats\.org\/spreadsheetml\/2006\/main"/;
20100
- function readAutoFilter(node3) {
20101
- const range2 = parseRange(att(node3, "ref") ?? "");
20102
- if (!node3 || !range2) return void 0;
20103
- const filter = { range: range2 };
20104
- const columns = [];
20105
- for (const column of xChildren(node3, "filterColumn")) {
20106
- const entry3 = {
20107
- offset: numAttr(column, "colId") ?? 0
20108
- };
20109
- const filters = xFirst(column, "filters");
20110
- if (filters) {
20111
- entry3.values = xChildren(filters, "filter").map((f) => att(f, "val") ?? "");
20112
- if (boolAttr(filters, "blank")) entry3.blank = true;
20113
- }
20114
- entry3.sourceXml = outerXml(column).replace(MAIN_NS_DECL, "");
20115
- columns.push(entry3);
20116
- }
20117
- if (columns.length) filter.columns = columns;
20118
- return filter;
20119
- }
20120
- var HEADER_FOOTER_TEXT = {
20121
- header: "oddHeader",
20122
- footer: "oddFooter",
20123
- evenHeader: "evenHeader",
20124
- evenFooter: "evenFooter",
20125
- firstHeader: "firstHeader",
20126
- firstFooter: "firstFooter"
20127
- };
20128
- var HEADER_FOOTER_FLAGS = [
20129
- "differentOddEven",
20130
- "differentFirst",
20131
- "scaleWithDoc",
20132
- "alignWithMargins"
20670
+ // xlsx/read/worksheet-children.ts
20671
+ var WORKSHEET_CHILD_ORDER = [
20672
+ "sheetPr",
20673
+ "dimension",
20674
+ "sheetViews",
20675
+ "sheetFormatPr",
20676
+ "cols",
20677
+ "sheetData",
20678
+ "sheetCalcPr",
20679
+ "sheetProtection",
20680
+ "protectedRanges",
20681
+ "scenarios",
20682
+ "autoFilter",
20683
+ "sortState",
20684
+ "dataConsolidate",
20685
+ "customSheetViews",
20686
+ "mergeCells",
20687
+ "phoneticPr",
20688
+ "conditionalFormatting",
20689
+ "dataValidations",
20690
+ "hyperlinks",
20691
+ "printOptions",
20692
+ "pageMargins",
20693
+ "pageSetup",
20694
+ "headerFooter",
20695
+ "rowBreaks",
20696
+ "colBreaks",
20697
+ "customProperties",
20698
+ "cellWatches",
20699
+ "ignoredErrors",
20700
+ "smartTags",
20701
+ "drawing",
20702
+ "legacyDrawing",
20703
+ "legacyDrawingHF",
20704
+ "drawingHF",
20705
+ "picture",
20706
+ "oleObjects",
20707
+ "controls",
20708
+ "webPublishItems",
20709
+ "tableParts",
20710
+ "extLst"
20133
20711
  ];
20134
- function readHeaderFooter(node3) {
20135
- const out = {};
20136
- for (const key2 of HEADER_FOOTER_FLAGS) {
20137
- const value3 = boolAttr(node3, key2);
20138
- if (value3 !== void 0) out[key2] = value3;
20139
- }
20140
- for (const [key2, local] of Object.entries(HEADER_FOOTER_TEXT)) {
20141
- const child3 = xFirst(node3, local);
20142
- if (child3) out[key2] = xText(child3);
20143
- }
20144
- return out;
20145
- }
20146
- var ORIENTATIONS = /* @__PURE__ */ new Set(["portrait", "landscape"]);
20147
- function readPageSetup(margins, setup, headerFooter, fitToPage) {
20148
- const page = {};
20149
- if (setup) {
20150
- if (/^(1|true)$/.test(att(setup, "useFirstPageNumber") ?? "")) {
20151
- page.firstPageNumber = numAttr(setup, "firstPageNumber") ?? 1;
20152
- }
20153
- const order = att(setup, "pageOrder");
20154
- if (order === "downThenOver" || order === "overThenDown") page.pageOrder = order;
20155
- const orientation = att(setup, "orientation");
20156
- if (orientation && ORIENTATIONS.has(orientation))
20157
- page.orientation = orientation;
20158
- const paper = numAttr(setup, "paperSize");
20159
- if (paper !== void 0) page.paperSize = paper;
20160
- const scale = numAttr(setup, "scale");
20161
- if (scale !== void 0) page.scale = scale;
20162
- }
20163
- if (fitToPage) {
20164
- page.fitToWidth = numAttr(setup, "fitToWidth") ?? 1;
20165
- page.fitToHeight = numAttr(setup, "fitToHeight") ?? 1;
20166
- }
20167
- if (margins) {
20168
- const m = (name3, fallback) => numAttr(margins, name3) ?? fallback;
20169
- page.margins = {
20170
- left: m("left", 0.7),
20171
- right: m("right", 0.7),
20172
- top: m("top", 0.75),
20173
- bottom: m("bottom", 0.75),
20174
- header: m("header", 0.3),
20175
- footer: m("footer", 0.3)
20176
- };
20177
- }
20178
- if (headerFooter) Object.assign(page, readHeaderFooter(headerFooter));
20179
- return Object.keys(page).length ? page : void 0;
20180
- }
20181
- var PROTECTION_META = /* @__PURE__ */ new Set([
20182
- "sheet",
20183
- "password",
20184
- "algorithmName",
20185
- "hashValue",
20186
- "saltValue",
20187
- "spinCount"
20188
- ]);
20189
- function readProtection(node3) {
20190
- if (!node3) return void 0;
20191
- const protection2 = { sheet: boolAttr(node3, "sheet", false) };
20192
- const password = att(node3, "password");
20193
- if (password) protection2.passwordHash = password;
20194
- const modernHash = readModernHash(node3);
20195
- if (modernHash) protection2.modernHash = modernHash;
20196
- const allow = [];
20197
- for (const attribute4 of Array.from(node3.attributes)) {
20198
- if (PROTECTION_META.has(attribute4.name)) continue;
20199
- if (attribute4.value === "0" || attribute4.value === "false") allow.push(attribute4.name);
20200
- }
20201
- if (allow.length) protection2.allow = allow.sort();
20202
- return protection2;
20203
- }
20204
20712
 
20205
20713
  // xlsx/read/conditional.ts
20206
20714
  var CFVO_TYPES = /* @__PURE__ */ new Set(["min", "max", "num", "percent", "percentile", "formula"]);
@@ -23576,9 +24084,205 @@ function readSlicerFrame(content2, anchor, sourceXml) {
23576
24084
  return void 0;
23577
24085
  }
23578
24086
 
23579
- // xlsx/read/drawing.ts
24087
+ // xlsx/read/form-control.ts
24088
+ var TYPES2 = {
24089
+ checkbox: "checkbox",
24090
+ radio: "radio",
24091
+ drop: "dropdown",
24092
+ list: "list",
24093
+ button: "button",
24094
+ spin: "spin",
24095
+ scroll: "scroll",
24096
+ gbox: "groupBox",
24097
+ label: "label",
24098
+ edit: "edit"
24099
+ };
24100
+ function readFormControlFrame(alternate, anchorOf) {
24101
+ const choice2 = elements(alternate).find((node3) => node3.localName === "Choice");
24102
+ const anchorEl = choice2 ? elements(choice2).find((node3) => node3.localName?.endsWith("Anchor")) : void 0;
24103
+ if (!anchorEl) return void 0;
24104
+ const shape = elements(anchorEl).find((node3) => node3.localName === "sp");
24105
+ const nv = first(shape, "nvSpPr", NS.xdr);
24106
+ const cNvPr = first(nv, "cNvPr", NS.xdr);
24107
+ const spid = [...cNvPr?.getElementsByTagName("*") ?? []].find(
24108
+ (node3) => node3.localName === "compatExt"
24109
+ );
24110
+ if (!spid) return void 0;
24111
+ const shapeId2 = Number(att(cNvPr, "id"));
24112
+ if (!Number.isFinite(shapeId2)) return void 0;
24113
+ const name3 = att(cNvPr, "name");
24114
+ return {
24115
+ kind: "formControl",
24116
+ anchor: anchorOf(anchorEl),
24117
+ shapeId: shapeId2,
24118
+ controlType: "other",
24119
+ ...name3 ? { name: name3 } : {},
24120
+ sourceXml: selfContainedXml(alternate)
24121
+ };
24122
+ }
24123
+ var num = (value3) => {
24124
+ if (value3 === void 0 || value3 === "") return void 0;
24125
+ const parsed = Number(value3);
24126
+ return Number.isFinite(parsed) ? parsed : void 0;
24127
+ };
24128
+ function readProps(control, xml) {
24129
+ const props = parseXml(xml, { label: "XLSX form control" }).documentElement;
24130
+ control.controlType = TYPES2[(att(props, "objectType") ?? "").toLowerCase()] ?? "other";
24131
+ const link = att(props, "fmlaLink");
24132
+ if (link) control.linkedCell = link;
24133
+ const range2 = att(props, "fmlaRange");
24134
+ if (range2) control.listRange = range2;
24135
+ if (control.controlType === "checkbox" || control.controlType === "radio") {
24136
+ const checked = att(props, "checked");
24137
+ control.checked = checked === "Checked" ? "checked" : checked === "Mixed" ? "mixed" : "unchecked";
24138
+ }
24139
+ if (att(props, "firstButton") === "1") control.firstButton = true;
24140
+ for (const [key2, attribute4] of [
24141
+ ["selected", "sel"],
24142
+ ["value", "val"],
24143
+ ["min", "min"],
24144
+ ["max", "max"],
24145
+ ["step", "inc"],
24146
+ ["page", "page"]
24147
+ ]) {
24148
+ const value3 = num(att(props, attribute4));
24149
+ if (value3 !== void 0) control[key2] = value3;
24150
+ }
24151
+ if (att(props, "horiz") === "1") control.horizontal = true;
24152
+ const style2 = att(props, "dropStyle");
24153
+ if (style2) control.dropStyle = style2;
24154
+ }
24155
+ var entities = {
24156
+ amp: "&",
24157
+ lt: "<",
24158
+ gt: ">",
24159
+ quot: '"',
24160
+ apos: "'",
24161
+ nbsp: " "
24162
+ };
24163
+ function vmlCaption(vml, shapeId2) {
24164
+ const start = vml.indexOf(`id="_x0000_s${shapeId2}"`);
24165
+ if (start < 0) return void 0;
24166
+ const end = vml.indexOf("</v:shape>", start);
24167
+ const shape = vml.slice(start, end < 0 ? void 0 : end);
24168
+ const box5 = /<v:textbox[^>]*>([\s\S]*?)<\/v:textbox>/.exec(shape)?.[1];
24169
+ if (!box5) return void 0;
24170
+ const text7 = box5.replace(/<br\s*\/?>/gi, "\n").replace(/<[^>]*>/g, "").replace(/&(#x?[0-9a-f]+|\w+);/gi, (match, code) => {
24171
+ if (code.startsWith("#")) {
24172
+ const value3 = code[1]?.toLowerCase() === "x" ? parseInt(code.slice(2), 16) : Number(code.slice(1));
24173
+ return Number.isFinite(value3) ? String.fromCodePoint(value3) : match;
24174
+ }
24175
+ return entities[code.toLowerCase()] ?? match;
24176
+ }).replace(/\s+/g, " ").trim();
24177
+ return text7 || void 0;
24178
+ }
24179
+ function attachFormControls(source, sheetPart, root2, sheet, legacyDrawing) {
24180
+ const controls3 = sheet.drawings.filter(
24181
+ (object) => object.kind === "formControl"
24182
+ );
24183
+ if (!controls3.length) return;
24184
+ const rels = source.rels(sheetPart);
24185
+ const parts = /* @__PURE__ */ new Map();
24186
+ for (const control of Array.from(root2.getElementsByTagNameNS(NS.x, "control"))) {
24187
+ const shapeId2 = Number(att(control, "shapeId"));
24188
+ const rel = rels.get(relAttr(control, "id") ?? "");
24189
+ const target2 = rel ? source.target(sheetPart, rel) : void 0;
24190
+ if (target2) parts.set(shapeId2, target2);
24191
+ }
24192
+ const vmlRel = legacyDrawing ? rels.get(relAttr(legacyDrawing, "id") ?? "") : void 0;
24193
+ const vmlPart = vmlRel ? source.target(sheetPart, vmlRel) : void 0;
24194
+ const vml = vmlPart ? source.text(vmlPart) : void 0;
24195
+ for (const control of controls3) {
24196
+ const part = parts.get(control.shapeId);
24197
+ const xml = part ? source.text(part) : void 0;
24198
+ if (part && xml) {
24199
+ control.partName = part;
24200
+ try {
24201
+ readProps(control, xml);
24202
+ } catch {
24203
+ control.controlType = "other";
24204
+ }
24205
+ }
24206
+ const caption = vml ? vmlCaption(vml, control.shapeId) : void 0;
24207
+ if (caption) control.caption = caption;
24208
+ }
24209
+ }
24210
+
24211
+ // xlsx/read/shape.ts
23580
24212
  var xdr = (parent, local) => first(parent, local, NS.xdr);
23581
- var int2 = (parent, local) => Math.round(Number(xdr(parent, local)?.textContent ?? 0)) || 0;
24213
+ function styleRef2(style2, name3) {
24214
+ const ref = first(style2, name3, NS.a);
24215
+ if (!ref) return void 0;
24216
+ const idx = Number(att(ref, "idx") ?? 0);
24217
+ const color2 = parseDrawingColorIn(ref);
24218
+ return { idx: Number.isFinite(idx) ? idx : 0, ...color2 ? { color: color2 } : {} };
24219
+ }
24220
+ function readStyle(style2) {
24221
+ if (!style2) return void 0;
24222
+ const fill = styleRef2(style2, "fillRef");
24223
+ const line2 = styleRef2(style2, "lnRef");
24224
+ const fontColor = parseDrawingColorIn(first(style2, "fontRef", NS.a));
24225
+ return {
24226
+ ...fill ? { fill } : {},
24227
+ ...line2 ? { line: line2 } : {},
24228
+ ...fontColor ? { font: { color: fontColor } } : {}
24229
+ };
24230
+ }
24231
+ function readShapeNode(element2) {
24232
+ const local = element2.localName;
24233
+ if (local !== "sp" && local !== "cxnSp" && local !== "grpSp") return void 0;
24234
+ const isGroup = local === "grpSp";
24235
+ const nv = elements(element2).find((node4) => node4.localName?.startsWith("nv"));
24236
+ const cNvPr = xdr(nv, "cNvPr");
24237
+ const spPr = xdr(element2, isGroup ? "grpSpPr" : "spPr");
24238
+ const xfrm = first(spPr, "xfrm", NS.a);
24239
+ const transform2 = parseTransform(xfrm);
24240
+ const geometry = isGroup ? { geometry: "group" } : parseDrawingGeometry(spPr);
24241
+ const node3 = {
24242
+ kind: isGroup ? "group" : local === "cxnSp" ? "connector" : "shape",
24243
+ frame: transform2?.frame ?? { x: 0, y: 0, width: 0, height: 0 },
24244
+ geometry: geometry.geometry
24245
+ };
24246
+ const name3 = att(cNvPr, "name");
24247
+ if (name3) node3.name = name3;
24248
+ if (att(xdr(nv, "cNvSpPr"), "txBox") === "1") node3.textBox = true;
24249
+ if (transform2?.rotation) node3.rotation = transform2.rotation;
24250
+ if (transform2?.flipHorizontal) node3.flipH = true;
24251
+ if (transform2?.flipVertical) node3.flipV = true;
24252
+ if ("adjustments" in geometry && geometry.adjustments) node3.adjustments = geometry.adjustments;
24253
+ if ("paths" in geometry && geometry.paths) node3.paths = geometry.paths;
24254
+ if (!isGroup) {
24255
+ const fill = parseDrawingFill(spPr);
24256
+ if (fill) node3.fill = fill;
24257
+ const line2 = parseDrawingLine(first(spPr, "ln", NS.a));
24258
+ if (line2) node3.line = line2;
24259
+ const style2 = readStyle(xdr(element2, "style"));
24260
+ if (style2) node3.style = style2;
24261
+ const text7 = parseDrawingTextBody(xdr(element2, "txBody"));
24262
+ if (text7?.text) node3.text = text7;
24263
+ return node3;
24264
+ }
24265
+ const childFrame = parseFrameOf(first(xfrm, "chOff", NS.a), first(xfrm, "chExt", NS.a));
24266
+ if (childFrame) node3.childFrame = childFrame;
24267
+ node3.children = elements(element2).flatMap((child3) => {
24268
+ const read = readShapeNode(child3);
24269
+ return read ? [read] : [];
24270
+ });
24271
+ return node3;
24272
+ }
24273
+ function parseFrameOf(off, ext) {
24274
+ if (!off || !ext) return void 0;
24275
+ return {
24276
+ x: Number(att(off, "x") ?? 0),
24277
+ y: Number(att(off, "y") ?? 0),
24278
+ width: Number(att(ext, "cx") ?? 0),
24279
+ height: Number(att(ext, "cy") ?? 0)
24280
+ };
24281
+ }
24282
+
24283
+ // xlsx/read/drawing.ts
24284
+ var xdr2 = (parent, local) => first(parent, local, NS.xdr);
24285
+ var int2 = (parent, local) => Math.round(Number(xdr2(parent, local)?.textContent ?? 0)) || 0;
23582
24286
  function marker(node3) {
23583
24287
  return {
23584
24288
  col: int2(node3, "col"),
@@ -23589,7 +24293,7 @@ function marker(node3) {
23589
24293
  }
23590
24294
  function readAnchor(anchor) {
23591
24295
  if (anchor.localName === "absoluteAnchor") {
23592
- const pos = xdr(anchor, "pos");
24296
+ const pos = xdr2(anchor, "pos");
23593
24297
  const result3 = {
23594
24298
  from: {
23595
24299
  row: 0,
@@ -23598,26 +24302,26 @@ function readAnchor(anchor) {
23598
24302
  rowOffset: Number(att(pos, "y") ?? 0)
23599
24303
  }
23600
24304
  };
23601
- const ext2 = xdr(anchor, "ext");
24305
+ const ext2 = xdr2(anchor, "ext");
23602
24306
  if (ext2) result3.ext = { cx: Number(att(ext2, "cx") ?? 0), cy: Number(att(ext2, "cy") ?? 0) };
23603
24307
  return result3;
23604
24308
  }
23605
- const result2 = { from: marker(xdr(anchor, "from")) };
23606
- const to = xdr(anchor, "to");
24309
+ const result2 = { from: marker(xdr2(anchor, "from")) };
24310
+ const to = xdr2(anchor, "to");
23607
24311
  if (to) result2.to = marker(to);
23608
- const ext = xdr(anchor, "ext");
24312
+ const ext = xdr2(anchor, "ext");
23609
24313
  if (ext) result2.ext = { cx: Number(att(ext, "cx") ?? 0), cy: Number(att(ext, "cy") ?? 0) };
23610
24314
  return result2;
23611
24315
  }
23612
24316
  var ANCHOR_PARTS = /* @__PURE__ */ new Set(["from", "to", "ext", "pos", "clientData"]);
23613
24317
  function nonVisual(content2) {
23614
24318
  const nv = elements(content2).find((node3) => node3.localName?.startsWith("nv"));
23615
- return xdr(nv, "cNvPr");
24319
+ return xdr2(nv, "cNvPr");
23616
24320
  }
23617
24321
  function describe(content2) {
23618
24322
  switch (content2.localName) {
23619
24323
  case "sp":
23620
- return xdr(content2, "nvSpPr") && att(xdr(xdr(content2, "nvSpPr"), "cNvSpPr"), "txBox") === "1" ? "text box" : "shape";
24324
+ return xdr2(content2, "nvSpPr") && att(xdr2(xdr2(content2, "nvSpPr"), "cNvSpPr"), "txBox") === "1" ? "text box" : "shape";
23621
24325
  case "grpSp":
23622
24326
  return "group";
23623
24327
  case "cxnSp":
@@ -23637,6 +24341,11 @@ function parseDrawing(source, partName, warn) {
23637
24341
  const rels = source.rels(partName);
23638
24342
  const out = [];
23639
24343
  for (const anchorEl of elements(root2)) {
24344
+ if (anchorEl.localName === "AlternateContent") {
24345
+ const control = readFormControlFrame(anchorEl, readAnchor);
24346
+ if (control) out.push(control);
24347
+ continue;
24348
+ }
23640
24349
  if (!["twoCellAnchor", "oneCellAnchor", "absoluteAnchor"].includes(anchorEl.localName ?? ""))
23641
24350
  continue;
23642
24351
  const anchor = readAnchor(anchorEl);
@@ -23651,7 +24360,7 @@ function parseDrawing(source, partName, warn) {
23651
24360
  const cNvPr = nonVisual(content2);
23652
24361
  const name3 = att(cNvPr, "name");
23653
24362
  if (content2.localName === "pic") {
23654
- const blipFill = xdr(content2, "blipFill");
24363
+ const blipFill = xdr2(content2, "blipFill");
23655
24364
  const blip = first(blipFill, "blip", NS.a);
23656
24365
  const rel = rels.get(relAttr(blip, "embed") ?? "");
23657
24366
  const target2 = rel ? source.target(partName, rel) : void 0;
@@ -23726,11 +24435,50 @@ function parseDrawing(source, partName, warn) {
23726
24435
  continue;
23727
24436
  }
23728
24437
  }
23729
- out.push(unsupported4(describe(content2)));
24438
+ const shape = readShapeNode(content2);
24439
+ out.push({ ...unsupported4(describe(content2)), ...shape ? { shape } : {} });
23730
24440
  }
23731
24441
  return out;
23732
24442
  }
23733
24443
 
24444
+ // xlsx/read/header-footer-images.ts
24445
+ var UNIT_PT = { pt: 1, in: 72, cm: 72 / 2.54, mm: 72 / 25.4, px: 0.75 };
24446
+ function styleLength(style2, property2) {
24447
+ const match = new RegExp(
24448
+ `(?:^|[;\\s])${property2}\\s*:\\s*([\\d.]+)\\s*(pt|in|cm|mm|px)?`,
24449
+ "i"
24450
+ ).exec(style2);
24451
+ return match ? Number(match[1]) * (UNIT_PT[(match[2] ?? "pt").toLowerCase()] ?? 1) : 0;
24452
+ }
24453
+ function readHeaderFooterImages(source, sheetPart, legacyHF) {
24454
+ if (!legacyHF) return void 0;
24455
+ const rel = source.rels(sheetPart).get(relAttr(legacyHF, "id") ?? "");
24456
+ const vmlPart = rel ? source.target(sheetPart, rel) : void 0;
24457
+ const vml = vmlPart ? source.text(vmlPart) : void 0;
24458
+ if (!vmlPart || !vml) return void 0;
24459
+ const rels = source.rels(vmlPart);
24460
+ const images = {};
24461
+ for (const match of vml.matchAll(/<v:shape\b([^>]*)>([\s\S]*?)<\/v:shape>/g)) {
24462
+ const id3 = /\bid="([^"]+)"/.exec(match[1] ?? "")?.[1];
24463
+ const style2 = /style=(?:'([^']*)'|"([^"]*)")/.exec(match[1] ?? "");
24464
+ const data = /<v:imagedata\b([^>]*)>/.exec(match[2] ?? "")?.[1];
24465
+ const relId = /\bo:relid="([^"]+)"/.exec(data ?? "")?.[1];
24466
+ const imageRel = relId ? rels.get(relId) : void 0;
24467
+ const partName = imageRel ? source.target(vmlPart, imageRel) : void 0;
24468
+ if (!id3 || !partName || !source.has(partName)) continue;
24469
+ const css = style2?.[1] ?? style2?.[2] ?? "";
24470
+ const title = /\bo:title="([^"]*)"/.exec(data ?? "")?.[1];
24471
+ images[id3] = {
24472
+ partName,
24473
+ contentType: source.contentType(partName) ?? "application/octet-stream",
24474
+ widthPt: styleLength(css, "width"),
24475
+ heightPt: styleLength(css, "height"),
24476
+ ...title ? { title } : {}
24477
+ };
24478
+ }
24479
+ return Object.keys(images).length ? images : void 0;
24480
+ }
24481
+
23734
24482
  // xlsx/read/dates.ts
23735
24483
  var DAY_MS2 = 864e5;
23736
24484
  var EPOCH_19003 = Date.UTC(1899, 11, 30);
@@ -23872,6 +24620,8 @@ function readRowInfo(ctx, rowEl) {
23872
24620
  const outline = numAttr(rowEl, "outlineLevel");
23873
24621
  if (outline) info.outlineLevel = outline;
23874
24622
  if (boolAttr(rowEl, "collapsed")) info.collapsed = true;
24623
+ if (boolAttr(rowEl, "thickTop")) info.thickTop = true;
24624
+ if (boolAttr(rowEl, "thickBot")) info.thickBot = true;
23875
24625
  return Object.keys(info).length ? info : void 0;
23876
24626
  }
23877
24627
  function readSheetData(ctx, rows, sheet) {
@@ -23984,15 +24734,6 @@ function readScenarios(node3) {
23984
24734
  return set;
23985
24735
  }
23986
24736
 
23987
- // xlsx/read/print-options.ts
23988
- var KEYS = ["gridLines", "headings", "horizontalCentered", "verticalCentered"];
23989
- function readPrintOptions(node3) {
23990
- if (!node3) return void 0;
23991
- const out = {};
23992
- for (const key2 of KEYS) if (boolAttr(node3, key2)) out[key2] = true;
23993
- return Object.keys(out).length ? out : void 0;
23994
- }
23995
-
23996
24737
  // xlsx/read/tables.ts
23997
24738
  function parseTable(xml, partName) {
23998
24739
  const root2 = parseXml(xml, { label: "XLSX table" }).documentElement;
@@ -24083,8 +24824,14 @@ var MODELLED = /* @__PURE__ */ new Set([
24083
24824
  "drawing",
24084
24825
  "legacyDrawing",
24085
24826
  "tableParts",
24086
- "scenarios"
24827
+ "scenarios",
24828
+ "customSheetViews"
24087
24829
  ]);
24830
+ function reportUnplaceable(ctx, sheet, element2) {
24831
+ ctx.warn(
24832
+ `Sheet "${sheet}": the element "${element2}" is not part of the worksheet schema and is dropped on save.`
24833
+ );
24834
+ }
24088
24835
  function keep(sheet, key2, xml) {
24089
24836
  const list2 = sheet.preserved.get(key2);
24090
24837
  if (list2) list2.push(xml);
@@ -24166,9 +24913,15 @@ function readWorksheet(ctx, partName, name3, sheetId5, xml, rows) {
24166
24913
  else if (!byName.has(local)) byName.set(local, node3);
24167
24914
  if (SNAPSHOT_ELEMENTS.includes(local))
24168
24915
  keep(sheet, snapshotKey(local), outerXml(node3));
24169
- else if (local === "AlternateContent")
24170
- keep(sheet, alternateContentName(node3) ?? local, selfContainedXml(node3));
24171
- else if (!MODELLED.has(local)) keep(sheet, local, selfContainedXml(node3));
24916
+ else if (local === "AlternateContent") {
24917
+ const inner = alternateContentName(node3);
24918
+ if (!WORKSHEET_CHILD_ORDER.includes(inner ?? local))
24919
+ reportUnplaceable(ctx, name3, inner ?? local);
24920
+ keep(sheet, inner ?? local, selfContainedXml(node3));
24921
+ } else if (!MODELLED.has(local)) {
24922
+ if (!WORKSHEET_CHILD_ORDER.includes(local)) reportUnplaceable(ctx, name3, local);
24923
+ keep(sheet, local, selfContainedXml(node3));
24924
+ }
24172
24925
  }
24173
24926
  const sheetPr = byName.get("sheetPr");
24174
24927
  const tabColor = readTabColor(sheetPr, ctx.palette);
@@ -24204,6 +24957,10 @@ function readWorksheet(ctx, partName, name3, sheetId5, xml, rows) {
24204
24957
  readFitToPage(sheetPr)
24205
24958
  );
24206
24959
  if (page) sheet.pageSetup = page;
24960
+ const customViews = byName.get("customSheetViews");
24961
+ if (customViews) sheet.customViews = readCustomSheetViews(customViews);
24962
+ const hfImages = readHeaderFooterImages(ctx.source, partName, byName.get("legacyDrawingHF"));
24963
+ if (hfImages) sheet.headerFooterImages = hfImages;
24207
24964
  const printOptions = readPrintOptions(byName.get("printOptions"));
24208
24965
  if (printOptions) sheet.printOptions = printOptions;
24209
24966
  const drawing2 = byName.get("drawing");
@@ -24211,6 +24968,7 @@ function readWorksheet(ctx, partName, name3, sheetId5, xml, rows) {
24211
24968
  const rel = ctx.source.rels(partName).get(relAttr(drawing2, "id") ?? "");
24212
24969
  const target2 = rel ? ctx.source.target(partName, rel) : void 0;
24213
24970
  if (target2) sheet.drawings = parseDrawing(ctx.source, target2, (m) => ctx.warn(m));
24971
+ attachFormControls(ctx.source, partName, root2, sheet, byName.get("legacyDrawing"));
24214
24972
  }
24215
24973
  readTables(ctx, partName, byName.get("tableParts"), sheet);
24216
24974
  readComments(ctx, partName, sheet);
@@ -24319,6 +25077,7 @@ async function loadXlsx(input, options2 = {}) {
24319
25077
  if (book.workbookPasswordHash) workbook.workbookPasswordHash = book.workbookPasswordHash;
24320
25078
  if (book.workbookModernHash) workbook.workbookModernHash = book.workbookModernHash;
24321
25079
  if (book.oleSize) workbook.oleSize = book.oleSize;
25080
+ if (book.customViews) workbook.customViews = book.customViews;
24322
25081
  if (book.calcMode) workbook.calcMode = book.calcMode;
24323
25082
  if (book.iterate) workbook.iterate = book.iterate;
24324
25083
  if (signatures.hasSignatures)
@@ -26065,9 +26824,9 @@ function sampleArc(start, rxIn, ryIn, xAxisRotationDeg, largeArcFlag, sweepFlag,
26065
26824
  ry *= scale;
26066
26825
  }
26067
26826
  const sign2 = largeArcFlag !== sweepFlag ? 1 : -1;
26068
- const num = rx * rx * ry * ry - rx * rx * y1p * y1p - ry * ry * x1p * x1p;
26827
+ const num2 = rx * rx * ry * ry - rx * rx * y1p * y1p - ry * ry * x1p * x1p;
26069
26828
  const den = rx * rx * y1p * y1p + ry * ry * x1p * x1p;
26070
- const coef = sign2 * Math.sqrt(Math.max(0, num / den));
26829
+ const coef = sign2 * Math.sqrt(Math.max(0, num2 / den));
26071
26830
  const cxp = coef * (rx * y1p) / ry;
26072
26831
  const cyp = coef * -(ry * x1p) / rx;
26073
26832
  const cx = cosPhi * cxp - sinPhi * cyp + (start.x + end.x) / 2;
@@ -33089,8 +33848,13 @@ var VISIO_VISIBILITY_LIMITS = Object.freeze({
33089
33848
  });
33090
33849
 
33091
33850
  // visio/edit-formatting-scope.ts
33092
- async function assertFormattingDependencies(pkg, pagePaths, roots2, pageId2, shape, changed, check, instanceView2) {
33093
- indexCells(roots2, { check });
33851
+ async function assertFormattingDependencies(pkg, pagePaths, roots2, pageId2, shape, changed, check, instanceView2, options2 = {}) {
33852
+ for (const item2 of indexCells(roots2, { check, scope: "affected" }).values())
33853
+ if (item2.refusal && item2.pageId === pageId2)
33854
+ fail(
33855
+ "EDIT_UNKNOWN_DEPENDENCY",
33856
+ `Cannot prove ShapeSheet dependency closure: ${item2.refusal}`
33857
+ );
33094
33858
  const shapeId2 = attribute2(shape, "ID");
33095
33859
  const changedNames = new Set([...changed.keys()].map((name3) => name3.toLowerCase()));
33096
33860
  const jumpOnly = [...changedNames].every(
@@ -33145,11 +33909,17 @@ async function assertFormattingDependencies(pkg, pagePaths, roots2, pageId2, sha
33145
33909
  if (textEdit && localShapeId === shapeId2 && sourcePageId === pageId2) continue;
33146
33910
  analysis = sized;
33147
33911
  }
33912
+ if (options2.textReads && textEdit && !named2 && sourcePageId !== void 0 && textReadFormula(source))
33913
+ continue;
33148
33914
  if (named2 && analysis.dynamic) {
33149
33915
  if (mentions()) failure2();
33150
33916
  continue;
33151
33917
  }
33152
- if (analysis.dynamic || analysis.references.some(
33918
+ if (analysis.dynamic && analysis.opaque) {
33919
+ if (sourcePageId === pageId2 || mentions()) failure2();
33920
+ continue;
33921
+ }
33922
+ if (analysis.references.some(
33153
33923
  (ref) => changedNames.has(canonical2(ref.cell)) && (sourcePageId === void 0 || sourcePageId === pageId2) && (ref.shapeId === shapeId2 || ref.shapeId === void 0 && (localShapeId === shapeId2 || sourcePageId === void 0))
33154
33924
  ))
33155
33925
  failure2();
@@ -33162,6 +33932,7 @@ async function assertFormattingDependencies(pkg, pagePaths, roots2, pageId2, sha
33162
33932
  const part = await pkg.readXml(path3);
33163
33933
  const master2 = part.localName === "MasterContents";
33164
33934
  if (instanceView2 && master2) continue;
33935
+ if (master2 && !shape.hasAttribute("Master") && !shape.hasAttribute("MasterShape")) continue;
33165
33936
  inspect3(part, void 0, master2);
33166
33937
  }
33167
33938
  }
@@ -33364,7 +34135,7 @@ function masterTemplate(pkg) {
33364
34135
  return matches2.length === 1 ? matches2[0] : missing();
33365
34136
  };
33366
34137
  }
33367
- function replaceScopedPlainText(pkg, pagePaths, roots2, document, edit, check) {
34138
+ function replaceScopedPlainText(pkg, pagePaths, roots2, document, edit, check, diagnostics = []) {
33368
34139
  return replacePlainText(
33369
34140
  roots2.get(edit.pageId),
33370
34141
  document,
@@ -33378,10 +34149,20 @@ function replaceScopedPlainText(pkg, pagePaths, roots2, document, edit, check) {
33378
34149
  edit.pageId,
33379
34150
  shape,
33380
34151
  /* @__PURE__ */ new Map([["TheText", text7]]),
33381
- check
34152
+ check,
34153
+ void 0,
34154
+ { textReads: true }
33382
34155
  ),
33383
34156
  masterTemplate(pkg)
33384
- );
34157
+ ).then((changed) => {
34158
+ if (changed)
34159
+ recalculateVisioCells(
34160
+ roots2,
34161
+ [{ pageId: edit.pageId, shapeId: edit.shapeId, cell: "TheText" }],
34162
+ { check, cycles: "keep", diagnostics }
34163
+ );
34164
+ return changed;
34165
+ });
33385
34166
  }
33386
34167
 
33387
34168
  // visio/edit-instance-sheet.ts
@@ -34289,7 +35070,7 @@ function layoutConnectorShape(roots2, pageId2, shape, route, sites, check, obsta
34289
35070
 
34290
35071
  // visio/edit-stencil-connector-layout.ts
34291
35072
  var same6 = (a2, b) => Math.abs(a2 - b) <= 1e-9 * Math.max(1, Math.abs(a2), Math.abs(b));
34292
- function walkShape(box5) {
35073
+ function walkShape(box5, floating = false) {
34293
35074
  const [a2, b, c2, d, e, f] = box5.transform;
34294
35075
  const at2 = (x, y) => ({
34295
35076
  x: a2 * x + c2 * y + e,
@@ -34301,7 +35082,8 @@ function walkShape(box5) {
34301
35082
  sites: sites.map((site) => ({ point: site.point, normal: site.normal })),
34302
35083
  bounds: sites[0].box,
34303
35084
  center: at2(box5.width / 2, box5.height / 2),
34304
- corners: [at2(0, 0), at2(box5.width, 0), at2(box5.width, box5.height), at2(0, box5.height)]
35085
+ corners: [at2(0, 0), at2(box5.width, 0), at2(box5.width, box5.height), at2(0, box5.height)],
35086
+ ...floating ? { floating } : {}
34305
35087
  }
34306
35088
  };
34307
35089
  }
@@ -34522,6 +35304,11 @@ function connectionRows(shape) {
34522
35304
  }
34523
35305
  return rows;
34524
35306
  }
35307
+ function hasConnectionPoints(root2, shapeId2) {
35308
+ const target2 = topShape(root2, shapeId2);
35309
+ if (!target2) return false;
35310
+ return (stencilTemplate(target2) ? effectiveRows(target2, "Connection") : connectionRows(target2)).size > 0;
35311
+ }
34525
35312
  function glueSites(root2, end) {
34526
35313
  const box5 = glueBox(root2, end.target);
34527
35314
  if (end.point === void 0) return dynamicSites(box5);
@@ -34632,8 +35419,9 @@ function proveConnector(root2, connectorId) {
34632
35419
  const named2 = visioPointGlueTarget(source);
34633
35420
  return index2 === void 0 ? !named2 : !!named2 && named2.shapeId === target2 && named2.index === index2;
34634
35421
  };
34635
- if (!end || !target2 || ends[end] !== void 0 || (index2 === void 0 ? toCell !== "PinX" || attribute2(row2, "ToPart") !== "3" : attribute2(row2, "ToPart") !== String(100 + index2)) || // A line master has no glue trigger of its own unless Visio wrote one with the glue.
34636
- visioGlueTriggerTarget(formula2(triggerName(end))) !== target2 && !(isStencilLine(shape) && formula2(triggerName(end)) === void 0) || !glued("X") || !glued("Y"))
35422
+ if (!end || !target2 || ends[end] !== void 0 || (index2 === void 0 ? toCell !== "PinX" || attribute2(row2, "ToPart") !== "3" : attribute2(row2, "ToPart") !== String(100 + index2)) || // A line master has no glue trigger of its own unless Visio wrote one with the glue, and
35423
+ // point glue on a drawn line has none either (native-edit-families-flat-2026-10-29.json).
35424
+ visioGlueTriggerTarget(formula2(triggerName(end))) !== target2 && !(formula2(triggerName(end)) === void 0 && !local.has(triggerName(end)) && (isStencilLine(shape) || index2 !== void 0)) || !glued("X") || !glued("Y"))
34637
35425
  fail("UNSUPPORTED_GEOMETRY_EDIT", UNSUPPORTED);
34638
35426
  ends[end] = { target: target2, ...index2 === void 0 ? {} : { point: index2 } };
34639
35427
  }
@@ -34899,7 +35687,7 @@ function rerouteConnector(roots2, pageId2, glue, check, options2 = {}) {
34899
35687
  }
34900
35688
  const walk = (end) => {
34901
35689
  const target2 = glue.ends[end];
34902
- return target2 && target2.point === void 0 ? walkShape(glueBox(root2, target2.target)) : { point: sites(end)[0].point };
35690
+ return target2 && target2.point === void 0 ? walkShape(glueBox(root2, target2.target), !hasConnectionPoints(root2, target2.target)) : { point: sites(end)[0].point };
34903
35691
  };
34904
35692
  const route = options2.route ?? current;
34905
35693
  if (route === "straight" && current === "straight" && ENDS.every(
@@ -36115,7 +36903,7 @@ async function assertInstanceLayersUnlocked(pkg, pageId2, layerMember) {
36115
36903
 
36116
36904
  // visio/formula-functions.ts
36117
36905
  var DOCUMENTED = new Set(
36118
- `ABS ACOS AND ANG360 ANGLEALONGPATH ANGLETOLOC ANGLETOPAR ASIN ATAN ATAN2 BITAND BITNOT BITOR
36906
+ `ABS ACOS AND ARG ANG360 ANGLEALONGPATH ANGLETOLOC ANGLETOPAR ASIN ATAN ATAN2 BITAND BITNOT BITOR
36119
36907
  BITXOR BKGPAGENAME BLEND BLOB BLUE BOUND CALLOUTCOUNT CALLOUTTARGETREF CALLTHIS CATEGORY CEILING
36120
36908
  CELLISTHEMED CHAR COMPANY CONTAINERCOUNT CONTAINERMEMBERCOUNT CONTAINERSHEETREF COS COSH CREATOR
36121
36909
  CY DATA1 DATA2 DATA3 DATE DATETIME DATEVALUE DAY DAYOFYEAR DECIMALSEP DEFAULTEVENT DEG DEPENDSON
@@ -37382,6 +38170,7 @@ function resizeVisioShapeAtAnchor(roots2, document, edit, check, glueShapes = /*
37382
38170
  fail("UNSUPPORTED_GEOMETRY_EDIT", "Glued shapes require routing outside this subset.");
37383
38171
  const graph = indexCells(roots2, {
37384
38172
  check,
38173
+ scope: "affected",
37385
38174
  glueShapes,
37386
38175
  ...group2 ? { groupResizeShapes: group2.shapes } : {}
37387
38176
  });
@@ -37695,13 +38484,23 @@ function prepareMasterMovePins(roots2, commands, bindings, check) {
37695
38484
  }
37696
38485
  }
37697
38486
  if (result2.size) {
37698
- const indexed = indexCells(roots2, { check });
38487
+ const indexed = indexCells(roots2, { check, scope: "affected" });
37699
38488
  const pins = new Set(
37700
38489
  [...indexed.values()].filter((cell) => cell.node && result2.has(cell.node)).map(key)
37701
38490
  );
37702
- for (const cell of indexed.values())
37703
- if (charge(), cell.dependencies.some((dependency) => pins.has(dependency)))
38491
+ const pinPages = new Set(
38492
+ [...indexed.values()].filter((cell) => cell.node && result2.has(cell.node)).map((c2) => c2.pageId)
38493
+ );
38494
+ for (const cell of indexed.values()) {
38495
+ charge();
38496
+ if (cell.opaque && pinPages.has(cell.pageId))
38497
+ fail(
38498
+ "EDIT_UNSUPPORTED_DEPENDENCY",
38499
+ "A formula that may read a master rotation pin exists."
38500
+ );
38501
+ if (cell.dependencies.some((dependency) => pins.has(dependency)))
37704
38502
  fail("EDIT_UNSUPPORTED_DEPENDENCY", "A page cache depends on a master rotation pin.");
38503
+ }
37705
38504
  }
37706
38505
  return { pins: result2, dimensions: provenDimensions };
37707
38506
  }
@@ -37798,8 +38597,12 @@ function applyGeometryEdit(roots2, document, edit, check, masterMoveProof = empt
37798
38597
  if (edit.type === "delete-shape") {
37799
38598
  unlocked("LockDelete");
37800
38599
  releaseDeletedGlue(roots2, /* @__PURE__ */ new Map([[edit.pageId, /* @__PURE__ */ new Set([edit.shapeId])]]));
37801
- assertVisioShapeUnreferenced(roots2, edit.pageId, edit.shapeId, { check });
38600
+ const frozen = assertVisioShapeUnreferenced(roots2, edit.pageId, edit.shapeId, {
38601
+ check,
38602
+ freeze: true
38603
+ });
37802
38604
  shape.parentNode.removeChild(shape);
38605
+ freezeVisioCells(frozen);
37803
38606
  return [edit.pageId];
37804
38607
  }
37805
38608
  if (edit.type === "rotate-shape" || edit.type === "flip-shape") {
@@ -38737,7 +39540,7 @@ async function recalculatePageFormulas(pkg, pagesPart, pages, paths, dirty, chec
38737
39540
  }
38738
39541
 
38739
39542
  // visio/edit-page-rename.ts
38740
- var escape3 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
39543
+ var escape4 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
38741
39544
  function localCell(node3) {
38742
39545
  const row2 = node3.parentNode;
38743
39546
  const section3 = row2?.parentNode;
@@ -38766,7 +39569,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
38766
39569
  }
38767
39570
  const roots2 = await editableVisioPageRoots(pkg, pagesPart, pages, pagePaths, dirty, check);
38768
39571
  const changedCells = [];
38769
- const prefix2 = new RegExp(`Pages\\[${escape3(oldUniversal)}\\]!`, "gi");
39572
+ const prefix2 = new RegExp(`Pages\\[${escape4(oldUniversal)}\\]!`, "gi");
38770
39573
  const targetByPath = new Map([...pagePaths].map(([id3, path3]) => [path3, id3]));
38771
39574
  for (const [path3, root2] of roots2) {
38772
39575
  let changed = false;
@@ -38800,7 +39603,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
38800
39603
  if (cell) changedCells.push({ node: node3, cell });
38801
39604
  }
38802
39605
  } else if (/\bPAGENAME\s*\(/i.test(code)) {
38803
- if (target2 === pageId2 || !target2 || new RegExp(`Pages\\[${escape3(oldUniversal)}\\]!`, "i").test(code))
39606
+ if (target2 === pageId2 || !target2 || new RegExp(`Pages\\[${escape4(oldUniversal)}\\]!`, "i").test(code))
38804
39607
  fail(
38805
39608
  "EDIT_UNSUPPORTED_PAGE_NAME_FORMULA",
38806
39609
  "Complex page-name formula caches cannot be safely refreshed."
@@ -38850,7 +39653,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
38850
39653
  for (const changed of changedCells) {
38851
39654
  if (changed.node === node3) continue;
38852
39655
  const reference2 = new RegExp(
38853
- `(?:^|[^a-z0-9_.])${escape3(changed.cell)}(?:$|[^a-z0-9_.])`,
39656
+ `(?:^|[^a-z0-9_.])${escape4(changed.cell)}(?:$|[^a-z0-9_.])`,
38854
39657
  "i"
38855
39658
  );
38856
39659
  if (reference2.test(unquotedVisioFormula(formula2)))
@@ -38872,7 +39675,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
38872
39675
  // visio/edit-page-delete.ts
38873
39676
  var officeRel = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
38874
39677
  var pageType = "http://schemas.microsoft.com/visio/2010/relationships/page";
38875
- var escape4 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
39678
+ var escape5 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
38876
39679
  async function deleteVisioPage(pkg, pagesPart, pages, rels, types, pagePaths, parts, dirty, removed, pageId2, check) {
38877
39680
  const existing = children2(pages, "Page");
38878
39681
  const page = existing.find((node3) => attribute2(node3, "ID") === pageId2);
@@ -38881,7 +39684,7 @@ async function deleteVisioPage(pkg, pagesPart, pages, rels, types, pagePaths, pa
38881
39684
  const names = new Set(
38882
39685
  ["Name", "NameU"].map((key2) => attribute2(page, key2)).filter((value3) => !!value3)
38883
39686
  );
38884
- const reference2 = new RegExp(`Pages\\[(?:${[...names].map(escape4).join("|")})\\]!`, "i");
39687
+ const reference2 = new RegExp(`Pages\\[(?:${[...names].map(escape5).join("|")})\\]!`, "i");
38885
39688
  const documentPart2 = await related(pkg, "", "document");
38886
39689
  const roots2 = await editableVisioPageRoots(
38887
39690
  pkg,
@@ -39206,7 +40009,7 @@ function createVisioPagePart(parts, pages, pageId2, check) {
39206
40009
  }
39207
40010
 
39208
40011
  // visio/edit-page-decoration.ts
39209
- var escape5 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
40012
+ var escape6 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
39210
40013
  var name2 = (page) => attribute2(page, "NameU") ?? attribute2(page, "Name") ?? "";
39211
40014
  function largestShapeId(root2) {
39212
40015
  let largest = 0;
@@ -39222,9 +40025,9 @@ function removeDecoration(root2, pageName, kind, pageRoots, check) {
39222
40025
  ) : [];
39223
40026
  if (!targets.length) return false;
39224
40027
  const ids = targets.map((shape) => attribute2(shape, "ID") ?? "");
39225
- const local = new RegExp(`\\bSheet\\.(?:${ids.map(escape5).join("|")})!`, "i");
40028
+ const local = new RegExp(`\\bSheet\\.(?:${ids.map(escape6).join("|")})!`, "i");
39226
40029
  const remote = new RegExp(
39227
- `Pages\\[${escape5(pageName)}\\]!Sheet\\.(?:${ids.map(escape5).join("|")})!`,
40030
+ `Pages\\[${escape6(pageName)}\\]!Sheet\\.(?:${ids.map(escape6).join("|")})!`,
39228
40031
  "i"
39229
40032
  );
39230
40033
  for (const connect of children2(root2, "Connects").flatMap((node3) => children2(node3, "Connect")))
@@ -40058,17 +40861,117 @@ async function formatTarget(pkg, pagePaths, roots2, document, edit, check, insta
40058
40861
  return true;
40059
40862
  }
40060
40863
 
40864
+ // visio/edit-duplicate-line.ts
40865
+ var ENDS2 = ["BeginX", "BeginY", "EndX", "EndY"];
40866
+ var connects = (root2) => children2(root2, "Connects").flatMap((container) => children2(container, "Connect"));
40867
+ var gluedTargets = (root2, id3) => connects(root2).filter((row2) => attribute2(row2, "FromSheet") === id3).map((row2) => attribute2(row2, "ToSheet") ?? "");
40868
+ function assertGlueDroppable(root2, id3, copied, code = "UNSUPPORTED_DUPLICATE") {
40869
+ if (gluedTargets(root2, id3).some((target2) => copied.has(target2)))
40870
+ fail(code, "A glued connector cannot be copied together with a shape it is glued to yet.");
40871
+ }
40872
+ function assertEndFormulas(read, code) {
40873
+ for (const name3 of ENDS2) {
40874
+ const formula2 = executableCellFormula(attribute2(read(name3), "F"));
40875
+ if (formula2 && !isNativeGlueCell(name3, formula2))
40876
+ fail(code, `${name3} of the line holds a formula that is not native glue.`);
40877
+ }
40878
+ }
40879
+ var isLineSheet2 = (shape) => ENDS2.some((name3) => cells(shape).has(name3));
40880
+ function planLineCopy(shape, code = "UNSUPPORTED_DUPLICATE") {
40881
+ proveLocalLine(shape);
40882
+ assertEndFormulas((name3) => cells(shape).get(name3), code);
40883
+ const local = cells(shape);
40884
+ return { x: numeric(local.get("PinX")), y: numeric(local.get("PinY")) };
40885
+ }
40886
+ var shift2 = (node3, delta, name3) => {
40887
+ if (!node3) fail("UNSUPPORTED_DUPLICATE", `The line has no local ${name3}.`);
40888
+ const value3 = numeric(node3);
40889
+ node3.setAttribute("V", String(Object.is(value3 + delta, -0) ? 0 : value3 + delta));
40890
+ node3.removeAttribute("E");
40891
+ };
40892
+ function finishLineCopy(shape, dx, dy) {
40893
+ const local = cells(shape);
40894
+ for (const name3 of ENDS2) {
40895
+ const node3 = local.get(name3);
40896
+ const formula2 = executableCellFormula(attribute2(node3, "F"));
40897
+ if (formula2 && isNativeGlueCell(name3, formula2)) node3.removeAttribute("F");
40898
+ shift2(node3, name3.endsWith("X") ? dx : dy, name3);
40899
+ }
40900
+ shift2(local.get("PinX"), dx, "PinX");
40901
+ shift2(local.get("PinY"), dy, "PinY");
40902
+ }
40903
+ var isStencilConnector2 = (target2) => ENDS2.some((name3) => instanceCell(target2, name3));
40904
+ function planConnectorCopy(target2, code = "UNSUPPORTED_DUPLICATE") {
40905
+ const local = cells(target2.instance);
40906
+ for (const name3 of [...ENDS2, "PinX", "PinY"]) {
40907
+ const node3 = local.get(name3);
40908
+ if (!node3?.hasAttribute("V") || node3.hasAttribute("E"))
40909
+ fail(code, `The stencil connector has no usable local ${name3}.`);
40910
+ numeric(node3);
40911
+ }
40912
+ assertEndFormulas((name3) => local.get(name3), code);
40913
+ return { x: numeric(local.get("PinX")), y: numeric(local.get("PinY")) };
40914
+ }
40915
+ function finishConnectorCopy(shape, id3, dx, dy) {
40916
+ const local = cells(shape);
40917
+ for (const name3 of ENDS2) shift2(local.get(name3), name3.endsWith("X") ? dx : dy, name3);
40918
+ shift2(local.get("PinX"), dx, "PinX");
40919
+ shift2(local.get("PinY"), dy, "PinY");
40920
+ for (const name3 of ["BegTrigger", "EndTrigger"]) {
40921
+ const node3 = local.get(name3);
40922
+ if (!node3) continue;
40923
+ node3.setAttribute("F", visioGlueTrigger(id3));
40924
+ node3.setAttribute("V", "1");
40925
+ }
40926
+ }
40927
+ var CLEARANCE = 0.25;
40928
+ var endsBox = (shape, dx, dy) => {
40929
+ const local = cells(shape);
40930
+ const x = [numeric(local.get("BeginX")) + dx, numeric(local.get("EndX")) + dx];
40931
+ const y = [numeric(local.get("BeginY")) + dy, numeric(local.get("EndY")) + dy];
40932
+ return {
40933
+ minX: Math.min(...x) - CLEARANCE,
40934
+ maxX: Math.max(...x) + CLEARANCE,
40935
+ minY: Math.min(...y) - CLEARANCE,
40936
+ maxY: Math.max(...y) + CLEARANCE
40937
+ };
40938
+ };
40939
+ function assertConnectorCopyApart(root2, copies, dx, dy, code = "UNSUPPORTED_DUPLICATE") {
40940
+ const boxes = copies.map((shape) => endsBox(shape, dx, dy));
40941
+ for (const container of children2(root2, "Shapes"))
40942
+ for (const other of children2(container, "Shape")) {
40943
+ const local = cells(other);
40944
+ const formula2 = executableCellFormula(attribute2(local.get("BeginX"), "F")) ?? "";
40945
+ if (!/^_WALKGLUE\(/i.test(formula2)) continue;
40946
+ const box5 = endsBox(other, 0, 0);
40947
+ for (const copy8 of boxes)
40948
+ if (copy8.minX <= box5.maxX && box5.minX <= copy8.maxX && copy8.minY <= box5.maxY && box5.minY <= copy8.maxY)
40949
+ fail(
40950
+ code,
40951
+ "The copy of a connector would meet another connector, which Visio lays out again."
40952
+ );
40953
+ }
40954
+ }
40955
+
40061
40956
  // visio/edit-instance-duplicate.ts
40062
- async function planInstanceCopy(pkg, pageId2, sourceRoot, target2, offsetX, offsetY, code = "UNSUPPORTED_DUPLICATE") {
40957
+ async function planInstanceCopy(pkg, pageId2, sourceRoot, target2, offsetX, offsetY, code = "UNSUPPORTED_DUPLICATE", allowConnector = code === "UNSUPPORTED_DUPLICATE") {
40063
40958
  const id3 = attribute2(target2.instance, "ID");
40064
- if (["BeginX", "EndX"].some((name3) => instanceCell(target2, name3)) || connectRows(sourceRoot).some((row2) => attribute2(row2, "FromSheet") === id3))
40959
+ const connector2 = allowConnector && isStencilConnector2(target2);
40960
+ if (!connector2 && (isStencilConnector2(target2) || connectRows(sourceRoot).some((row2) => attribute2(row2, "FromSheet") === id3)))
40065
40961
  fail(code, "Lines and connectors that come from a stencil cannot be copied yet.");
40066
40962
  await assertInstanceUnlocked(pkg, pageId2, target2, ["LockSelect"], "selection");
40963
+ if (connector2) {
40964
+ const pin2 = planConnectorCopy(target2, code);
40965
+ const x2 = pin2.x + offsetX, y2 = pin2.y + offsetY;
40966
+ if (Math.abs(x2) > 1e6 || Math.abs(y2) > 1e6)
40967
+ fail(code, "Duplicated pins exceed coordinate limits.");
40968
+ return { x: x2, y: y2, connector: connector2 };
40969
+ }
40067
40970
  const pin = instancePin(target2);
40068
40971
  const x = pin.x + offsetX, y = pin.y + offsetY;
40069
40972
  if (Math.abs(x) > 1e6 || Math.abs(y) > 1e6)
40070
40973
  fail(code, "Duplicated pins exceed coordinate limits.");
40071
- return { x, y };
40974
+ return { x, y, connector: connector2 };
40072
40975
  }
40073
40976
  function finishInstanceCopy(clone, template, x, y, taken, check) {
40074
40977
  const mapping = /* @__PURE__ */ new Map();
@@ -40152,7 +41055,18 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
40152
41055
  structural ||= !source || await shapeIsStructural(source, template);
40153
41056
  }
40154
41057
  await assertDuplicateScope(pkg, pagePaths, root2, newIds, check, structural);
40155
- const indexed = indexCells(detached ? /* @__PURE__ */ new Map([[sourcePageId, sourceRoot]]) : roots2, { check });
41058
+ const glueTargets = new Set(
41059
+ children2(sourceRoot, "Connects").flatMap(
41060
+ (container2) => children2(container2, "Connect").map((row2) => attribute2(row2, "ToSheet"))
41061
+ )
41062
+ );
41063
+ const indexed = indexCells(detached ? /* @__PURE__ */ new Map([[sourcePageId, sourceRoot]]) : roots2, {
41064
+ check,
41065
+ scope: "affected",
41066
+ glueShapes: new Set(
41067
+ pageShapes(sourceRoot).filter((shape) => glueTargets.has(attribute2(shape, "ID")))
41068
+ )
41069
+ });
40156
41070
  const evaluate = createVisioCellEvaluator(indexed, { check }, true);
40157
41071
  const containers = children2(root2, "Shapes");
40158
41072
  if (containers.length > 1) fail("INVALID_SHAPE_ID", "Duplicate Shapes containers.");
@@ -40166,6 +41080,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
40166
41080
  if (value3 !== void 0) occupied.add(value3.toLowerCase());
40167
41081
  }
40168
41082
  const plans = [];
41083
+ const copied = new Set(edit.copies.map((copy8) => copy8.shapeId));
40169
41084
  let cloneNodes = 0, cloneCharacters = buildXml(root2).length;
40170
41085
  const size3 = (source) => {
40171
41086
  cloneNodes += source.getElementsByTagName("*").length + 1;
@@ -40182,6 +41097,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
40182
41097
  "UNSUPPORTED_DUPLICATE"
40183
41098
  );
40184
41099
  if (stencil) {
41100
+ assertGlueDroppable(sourceRoot, copy8.shapeId, copied);
40185
41101
  const pin = await planInstanceCopy(
40186
41102
  pkg,
40187
41103
  edit.pageId,
@@ -40194,18 +41110,33 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
40194
41110
  plans.push({
40195
41111
  source: stencil.instance,
40196
41112
  id: copy8.newShapeId,
40197
- ...pin,
41113
+ x: pin.x,
41114
+ y: pin.y,
41115
+ ...pin.connector ? { connector: true } : {},
40198
41116
  template: stencil.template
40199
41117
  });
40200
41118
  continue;
40201
41119
  }
41120
+ const line2 = pageShapes(sourceRoot).find((shape) => attribute2(shape, "ID") === copy8.shapeId);
41121
+ if (line2 && !line2.hasAttribute("Master") && isLineSheet2(line2)) {
41122
+ assertCloneLeaf(line2);
41123
+ assertUnlayeredShape(line2, document);
41124
+ assertShapeLocks(line2, document, ["LockSelect"]);
41125
+ assertGlueDroppable(sourceRoot, copy8.shapeId, copied);
41126
+ const pin = planLineCopy(line2);
41127
+ if (Math.abs(pin.x + edit.offsetX) > 1e6 || Math.abs(pin.y + edit.offsetY) > 1e6)
41128
+ fail("UNSUPPORTED_DUPLICATE", "Duplicated pins exceed coordinate limits.");
41129
+ size3(line2);
41130
+ plans.push({ source: line2, id: copy8.newShapeId, x: pin.x, y: pin.y, line: true });
41131
+ continue;
41132
+ }
40202
41133
  const source = admitted(sourceRoot, copy8.shapeId);
40203
41134
  assertCloneLeaf(source);
40204
41135
  assertUnlayeredShape(source, document);
40205
41136
  assertShapeLocks(source, document, ["LockSelect"]);
40206
- for (const connects of children2(sourceRoot, "Connects"))
40207
- for (const connection of children2(connects, "Connect"))
40208
- if (["FromSheet", "ToSheet"].some((name3) => attribute2(connection, name3) === copy8.shapeId))
41137
+ for (const connects2 of children2(sourceRoot, "Connects"))
41138
+ for (const connection of children2(connects2, "Connect"))
41139
+ if (attribute2(connection, "FromSheet") === copy8.shapeId)
40209
41140
  fail("UNSUPPORTED_DUPLICATE", "Glued shapes cannot be duplicated safely.");
40210
41141
  const x = numeric(formattingCell(source, "PinX")), y = numeric(formattingCell(source, "PinY"));
40211
41142
  for (const [name3, offset] of [
@@ -40220,6 +41151,9 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
40220
41151
  size3(source);
40221
41152
  plans.push({ source, id: copy8.newShapeId, x: x + edit.offsetX, y: y + edit.offsetY });
40222
41153
  }
41154
+ const connectorSources = plans.filter((plan) => plan.connector).map((plan) => plan.source);
41155
+ if (connectorSources.length)
41156
+ assertConnectorCopyApart(root2, connectorSources, edit.offsetX, edit.offsetY);
40223
41157
  const order = new Map(
40224
41158
  children2(children2(sourceRoot, "Shapes")[0], "Shape").map((source, index2) => [source, index2])
40225
41159
  );
@@ -40230,6 +41164,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
40230
41164
  check();
40231
41165
  const shape = root2.ownerDocument.importNode(plan.source, true);
40232
41166
  copyIdentity(shape, plan.id, names);
41167
+ if (plan.line) finishLineCopy(shape, edit.offsetX, edit.offsetY);
40233
41168
  for (const node3 of [shape, ...Array.from(shape.getElementsByTagName("*"))]) {
40234
41169
  const source = executableCellFormula(attribute2(node3, "F"));
40235
41170
  if (!source) continue;
@@ -40248,6 +41183,15 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
40248
41183
  )
40249
41184
  );
40250
41185
  }
41186
+ if (plan.line) {
41187
+ container.appendChild(shape);
41188
+ continue;
41189
+ }
41190
+ if (plan.connector) {
41191
+ finishConnectorCopy(shape, plan.id, edit.offsetX, edit.offsetY);
41192
+ container.appendChild(shape);
41193
+ continue;
41194
+ }
40251
41195
  if (plan.template) {
40252
41196
  for (const id3 of newIds) ids.add(id3);
40253
41197
  finishInstanceCopy(shape, plan.template, plan.x, plan.y, ids, check);
@@ -40264,7 +41208,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
40264
41208
  }
40265
41209
  container.appendChild(shape);
40266
41210
  }
40267
- const local = plans.filter((plan) => !plan.template);
41211
+ const local = plans.filter((plan) => !plan.template && !plan.line);
40268
41212
  if (changed.length) {
40269
41213
  await assertGeometryPackageScope(
40270
41214
  pkg,
@@ -40298,6 +41242,9 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
40298
41242
  }
40299
41243
  const dirty = /* @__PURE__ */ new Set([edit.pageId]);
40300
41244
  for (const id3 of recalculateVisioCells(roots2, changed, { check })) dirty.add(id3);
41245
+ for (const plan of plans)
41246
+ if (!plan.line && !plan.connector)
41247
+ for (const id3 of rerouteBlockedConnectors(roots2, edit.pageId, plan.id, check)) dirty.add(id3);
40301
41248
  return [...dirty];
40302
41249
  }
40303
41250
  function assertCloneLeaf(source) {
@@ -40628,9 +41575,10 @@ function deleteVisioShapes(roots2, document, edits, check, instances = /* @__PUR
40628
41575
  }
40629
41576
  releaseStencilGlue(roots2, removed);
40630
41577
  releaseDeletedGlue(roots2, removed);
40631
- assertVisioShapesUnreferenced(roots2, removed, { check });
41578
+ const frozen = assertVisioShapesUnreferenced(roots2, removed, { check, freeze: true });
40632
41579
  check();
40633
41580
  for (const shape of shapes) shape.parentNode.removeChild(shape);
41581
+ freezeVisioCells(frozen);
40634
41582
  for (const pageId2 of removed.keys())
40635
41583
  for (const container of children2(roots2.get(pageId2), "Connects"))
40636
41584
  if (!children2(container, "Connect").length) container.parentNode.removeChild(container);
@@ -40659,8 +41607,8 @@ function admittedShape(root2, document, shapeId2) {
40659
41607
  if (["1", "true"].includes(attribute2(shape, "Del") ?? "")) refuse3("The shape is deleted.");
40660
41608
  const local = cells(shape);
40661
41609
  if (isLineSheet(local)) refuse3("Lines and connectors (1D shapes) cannot change shape.");
40662
- for (const connects of children2(root2, "Connects"))
40663
- for (const connect of children2(connects, "Connect"))
41610
+ for (const connects2 of children2(root2, "Connects"))
41611
+ for (const connect of children2(connects2, "Connect"))
40664
41612
  if (["FromSheet", "ToSheet"].some((name3) => attribute2(connect, name3) === shapeId2))
40665
41613
  refuse3("Glued connectors would need rerouting, which is not supported yet.");
40666
41614
  if (children2(shape, "Section").some((section3) => attribute2(section3, "N") === "Controls"))
@@ -42103,8 +43051,8 @@ async function captureVisioClipboard(input, pageId2, shapeIds2, options2 = {}) {
42103
43051
  numeric(formattingCell(source, name3));
42104
43052
  evaluate(key({ pageId: pageId2, shapeId: id3, cell: name3 }));
42105
43053
  }
42106
- for (const connects of children2(root2, "Connects"))
42107
- for (const connection of children2(connects, "Connect"))
43054
+ for (const connects2 of children2(root2, "Connects"))
43055
+ for (const connection of children2(connects2, "Connect"))
42108
43056
  if (["FromSheet", "ToSheet"].some((name3) => attribute2(connection, name3) === id3))
42109
43057
  fail("UNSUPPORTED_CLIPBOARD", "Glued shapes cannot be captured safely.");
42110
43058
  }
@@ -42645,8 +43593,8 @@ function assertUnreferenced3(roots2, shapeId2, check) {
42645
43593
  if (reference2.test(executableCellFormula(attribute2(cell, "F")) ?? ""))
42646
43594
  fail("UNSUPPORTED_GUIDE_EDIT", "A shape formula refers to this guide.");
42647
43595
  }
42648
- for (const connects of children2(root2, "Connects"))
42649
- for (const row2 of children2(connects, "Connect"))
43596
+ for (const connects2 of children2(root2, "Connects"))
43597
+ for (const row2 of children2(connects2, "Connect"))
42650
43598
  if (attribute2(row2, "ToSheet") === shapeId2 || attribute2(row2, "FromSheet") === shapeId2)
42651
43599
  fail("UNSUPPORTED_GUIDE_EDIT", "Shapes are glued to this guide.");
42652
43600
  }
@@ -43023,6 +43971,7 @@ async function editVsdxTransaction(input, edits, options2, clock = {
43023
43971
  if (deleteOnly)
43024
43972
  for (const pageId2 of deleteVisioShapes(roots2, document, deletions, check, instanceDeletes))
43025
43973
  dirty.set(pages.get(pageId2), roots2.get(pageId2));
43974
+ const formulaDiagnostics = [];
43026
43975
  const noteTextSize = async (target2, root2) => {
43027
43976
  if (await measuresOwnText(root2, target2.shapeId, masterTemplate(pkg), check))
43028
43977
  clock.textSizes.push({ pageId: target2.pageId, shapeId: target2.shapeId });
@@ -43038,7 +43987,15 @@ async function editVsdxTransaction(input, edits, options2, clock = {
43038
43987
  roots2.set(command2.pageId, root2);
43039
43988
  }
43040
43989
  if (command2.type === "replace-plain-text" || command2.type === "replace-text-ranges") {
43041
- if (await (command2.type === "replace-plain-text" ? replaceScopedPlainText(pkg, new Set(pages.values()), roots2, document, command2, check) : replaceScopedTextRanges(pkg, new Set(pages.values()), roots2, document, command2, check))) {
43990
+ if (await (command2.type === "replace-plain-text" ? replaceScopedPlainText(
43991
+ pkg,
43992
+ new Set(pages.values()),
43993
+ roots2,
43994
+ document,
43995
+ command2,
43996
+ check,
43997
+ formulaDiagnostics
43998
+ ) : replaceScopedTextRanges(pkg, new Set(pages.values()), roots2, document, command2, check))) {
43042
43999
  dirty.set(path3, root2);
43043
44000
  textChanged = true;
43044
44001
  await noteTextSize(command2, root2);
@@ -43184,6 +44141,7 @@ async function editVsdxTransaction(input, edits, options2, clock = {
43184
44141
  bytes,
43185
44142
  changedParts: [...dirty.keys()],
43186
44143
  diagnostics: [
44144
+ ...formulaDiagnostics,
43187
44145
  ...pasteChanged ? [
43188
44146
  {
43189
44147
  code: "edit-paste-experimental",
@@ -47014,7 +47972,7 @@ function checkVisioDiagram(document, options2 = {}) {
47014
47972
  }
47015
47973
 
47016
47974
  // visio/ui/shape-report.ts
47017
- var TYPES2 = {
47975
+ var TYPES3 = {
47018
47976
  shape: "Shape",
47019
47977
  group: "Group",
47020
47978
  connector: "1-D shape",
@@ -47060,7 +48018,7 @@ function visioShapeReport(document, options2 = {}) {
47060
48018
  pageId: page.id,
47061
48019
  id: shape.id,
47062
48020
  name: shape.name,
47063
- type: TYPES2[shape.kind],
48021
+ type: TYPES3[shape.kind],
47064
48022
  master: shape.masterId ?? "",
47065
48023
  width: round5(shape.width),
47066
48024
  height: round5(shape.height),