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
@@ -1759,11 +1759,11 @@ function inspectDeclaration(value3, encoding) {
1759
1759
  if (declarations.length) fail("INVALID_XML", "Invalid XML declaration attributes");
1760
1760
  }
1761
1761
  function decodeXmlAttribute(value3) {
1762
- const entities = { amp: "&", lt: "<", gt: ">", apos: "'", quot: '"' };
1762
+ const entities2 = { amp: "&", lt: "<", gt: ">", apos: "'", quot: '"' };
1763
1763
  return value3.replace(/[\t\r\n]/g, " ").replace(/&(amp|lt|gt|apos|quot|#x[\da-fA-F]+|#\d+);/g, (_, entity) => {
1764
1764
  if (entity.startsWith("#x")) return String.fromCodePoint(parseInt(entity.slice(2), 16));
1765
1765
  if (entity.startsWith("#")) return String.fromCodePoint(Number(entity.slice(1)));
1766
- return entities[entity] ?? "";
1766
+ return entities2[entity] ?? "";
1767
1767
  });
1768
1768
  }
1769
1769
  function inspectNamespaces(root2, check) {
@@ -2988,6 +2988,60 @@ function evaluateNumericFormulaFunction(name3, args) {
2988
2988
  return formulaFailure("unsupported", `Unsupported numeric function ${name3}`);
2989
2989
  }
2990
2990
 
2991
+ // visio/formula-extra-functions.ts
2992
+ var IGNORE_CASE = 1;
2993
+ var IGNORE_NONSPACE = 2;
2994
+ var IGNORE_SYMBOLS = 4;
2995
+ function strSameEx(a2, b, flags) {
2996
+ if (!Number.isInteger(flags) || flags < 0)
2997
+ return formulaFailure("value", "STRSAMEEX flags must be a whole number");
2998
+ if (flags & -8)
2999
+ return formulaFailure("unsupported", "STRSAMEEX with kana or width comparison flags");
3000
+ const fold = (text7) => {
3001
+ let result2 = text7;
3002
+ if (flags & IGNORE_NONSPACE) result2 = result2.normalize("NFD").replace(/\p{Mn}/gu, "");
3003
+ if (flags & IGNORE_SYMBOLS) result2 = result2.replace(/[\p{P}\p{S}\s]/gu, "");
3004
+ return flags & IGNORE_CASE ? result2.toLowerCase() : result2;
3005
+ };
3006
+ return fold(a2) === fold(b);
3007
+ }
3008
+ function formatNumberPicture(value3, picture) {
3009
+ if (value3.unit !== "scalar") return formulaFailure("unit", "FORMAT requires a plain number");
3010
+ const match = /^([#,0]*)(?:\.([0#]*))?(%?)$/.exec(picture);
3011
+ const integerPicture = match?.[1] ?? "";
3012
+ if (!match || !integerPicture.includes("0") || /0,*#/.test(integerPicture) || integerPicture.startsWith(",") || integerPicture.endsWith(",") || integerPicture.includes(",,") || /0#/.test(match[2] ?? ""))
3013
+ return formulaFailure("unsupported", `FORMAT picture "${picture}"`);
3014
+ const fractionPicture = match[2] ?? "", percent = match[3] === "%", grouped = integerPicture.includes(",");
3015
+ const minInteger = (integerPicture.match(/0/g) ?? []).length;
3016
+ const minFraction = (fractionPicture.match(/0/g) ?? []).length;
3017
+ const maxFraction = fractionPicture.length;
3018
+ const scaled = percent ? value3.value * 100 : value3.value;
3019
+ const factor = 10 ** maxFraction;
3020
+ const rounded = Math.sign(scaled) * Math.round(Math.abs(scaled) * factor + 1e-9) / factor;
3021
+ const [digits = "", decimals = ""] = Math.abs(rounded).toFixed(maxFraction).split(".");
3022
+ let whole = digits.replace(/^0+/, "").padStart(minInteger, "0");
3023
+ if (grouped) whole = whole.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
3024
+ let fraction = decimals;
3025
+ while (fraction.length > minFraction && fraction.endsWith("0")) fraction = fraction.slice(0, -1);
3026
+ const negative = rounded < 0;
3027
+ return `${negative ? "-" : ""}${whole}${fraction ? `.${fraction}` : ""}${percent ? "%" : ""}`;
3028
+ }
3029
+ function visioDateSerial(year, month, day) {
3030
+ if (![year, month, day].every(Number.isInteger))
3031
+ return formulaFailure("value", "DATE requires whole numbers");
3032
+ if (year < 1 || year > 9999 || month < 1 || month > 12 || day < 1 || day > 31)
3033
+ return formulaFailure("value", "DATE is outside the calendar");
3034
+ const date2 = /* @__PURE__ */ new Date(0);
3035
+ date2.setUTCFullYear(year, month - 1, day);
3036
+ if (date2.getUTCMonth() !== month - 1) return formulaFailure("value", "DATE is not a real day");
3037
+ return (date2.getTime() - Date.UTC(1899, 11, 30)) / 864e5;
3038
+ }
3039
+ var angleToLocal = (frame, angle) => angle - frame.angle;
3040
+ function localToParent(frame, x, y) {
3041
+ const dx = x - frame.locPinX, dy = y - frame.locPinY, cos = Math.cos(frame.angle), sin = Math.sin(frame.angle);
3042
+ return [frame.pinX + dx * cos - dy * sin, frame.pinY + dx * sin + dy * cos];
3043
+ }
3044
+
2991
3045
  // visio/formula-text-functions.ts
2992
3046
  var textResultFunctions = /* @__PURE__ */ new Set([
2993
3047
  "MID",
@@ -2999,12 +3053,15 @@ var textResultFunctions = /* @__PURE__ */ new Set([
2999
3053
  "SUBSTITUTE",
3000
3054
  "REPLACE",
3001
3055
  "CHAR",
3002
- "INDEX"
3056
+ "INDEX",
3057
+ "FORMAT",
3058
+ "SHAPETEXT"
3003
3059
  ]);
3004
3060
  var textNumberFunctions = /* @__PURE__ */ new Set([
3005
3061
  "LEN",
3006
3062
  "FIND",
3007
3063
  "STRSAME",
3064
+ "STRSAMEEX",
3008
3065
  "LOOKUP"
3009
3066
  ]);
3010
3067
  var LIST_SEPARATOR = ";";
@@ -3020,6 +3077,7 @@ function exactInteger(context, node3, name3) {
3020
3077
  if (!Number.isInteger(value3.value)) return unsupported2(`${name3} with a fractional number`);
3021
3078
  return value3.value;
3022
3079
  }
3080
+ var isTheText = (node3) => node3.kind === "reference" && node3.reference.cell.toLowerCase() === "thetext";
3023
3081
  function evaluateFormulaText(node3, context, depth = 0) {
3024
3082
  context.tick();
3025
3083
  if (depth > 64) return formulaFailure("limit", "Formula evaluation limit");
@@ -3030,6 +3088,10 @@ function evaluateFormulaText(node3, context, depth = 0) {
3030
3088
  if (node3.kind === "string") return node3.value;
3031
3089
  if (node3.kind === "binary" && node3.operator === "&")
3032
3090
  return text7(node3.left, "&") + text7(node3.right, "&");
3091
+ if (node3.kind === "reference" && isTheText(node3)) {
3092
+ const read = context.textOf?.(node3.reference);
3093
+ return read === void 0 ? unsupported2("Text read from a cell") : read;
3094
+ }
3033
3095
  if (node3.kind !== "call") {
3034
3096
  let value3;
3035
3097
  try {
@@ -3051,6 +3113,12 @@ function evaluateFormulaText(node3, context, depth = 0) {
3051
3113
  if (value3.unit !== "scalar") return unsupported2("Text from a number with a unit");
3052
3114
  return String(value3.value);
3053
3115
  }
3116
+ if (name3 === "SHAPETEXT") {
3117
+ arity(1);
3118
+ const target2 = args[0];
3119
+ if (!isTheText(target2)) return unsupported2("SHAPETEXT of something other than TheText");
3120
+ return text7(target2, name3);
3121
+ }
3054
3122
  if (name3 === "MID") {
3055
3123
  arity(3);
3056
3124
  const source = text7(args[0], name3), start = integer(context, args[1], name3), length = integer(context, args[2], name3);
@@ -3105,6 +3173,10 @@ function evaluateFormulaText(node3, context, depth = 0) {
3105
3173
  if (code >= 128 && code <= 159) return unsupported2("CHAR in the Windows-1252 range");
3106
3174
  return String.fromCharCode(code);
3107
3175
  }
3176
+ if (name3 === "FORMAT") {
3177
+ arity(2);
3178
+ return formatNumberPicture(context.number(args[0]), text7(args[1], name3));
3179
+ }
3108
3180
  arity(2);
3109
3181
  const index2 = integer(context, args[0], name3);
3110
3182
  const items = text7(args[1], name3).split(LIST_SEPARATOR);
@@ -3137,6 +3209,11 @@ function evaluateTextNumberFunction(name3, args, context) {
3137
3209
  const ignoreCase = args[2] ? context.number(args[2]).value !== 0 : false;
3138
3210
  return scalar4(ignoreCase ? Number(a2.toLowerCase() === b.toLowerCase()) : Number(a2 === b));
3139
3211
  }
3212
+ if (name3 === "STRSAMEEX") {
3213
+ if (args.length === 4) return formulaFailure("unsupported", "STRSAMEEX with a locale");
3214
+ arity(3);
3215
+ return scalar4(Number(strSameEx(text7(0), text7(1), context.number(args[2]).value)));
3216
+ }
3140
3217
  arity(2);
3141
3218
  const wanted = text7(0).toLowerCase();
3142
3219
  return scalar4(
@@ -3144,6 +3221,23 @@ function evaluateTextNumberFunction(name3, args, context) {
3144
3221
  );
3145
3222
  }
3146
3223
 
3224
+ // visio/formula-indirect.ts
3225
+ var FRAME_INPUTS = {
3226
+ ANGLETOLOC: ["Angle", "FlipX", "FlipY"],
3227
+ LOCTOPAR: ["PinX", "PinY", "LocPinX", "LocPinY", "Angle", "FlipX", "FlipY"]
3228
+ };
3229
+ function literalIndirectTarget(node3) {
3230
+ if (node3.kind !== "call" || node3.args.length !== 1) return void 0;
3231
+ const address = node3.args[0];
3232
+ if (address.kind !== "string") return void 0;
3233
+ try {
3234
+ const target2 = parseVisioFormula(address.value);
3235
+ 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;
3236
+ } catch {
3237
+ return void 0;
3238
+ }
3239
+ }
3240
+
3147
3241
  // visio/formula-math-functions.ts
3148
3242
  var mathFormulaFunctions = /* @__PURE__ */ new Set([
3149
3243
  "ROUND",
@@ -3248,7 +3342,7 @@ function evaluateMathFormulaFunction(name3, args) {
3248
3342
  return formulaFailure("unsupported", `Unsupported function ${name3}`);
3249
3343
  }
3250
3344
 
3251
- // visio/formula-evaluate.ts
3345
+ // visio/formula-analyze.ts
3252
3346
  var supported = /* @__PURE__ */ new Set([
3253
3347
  "GUARD",
3254
3348
  "IF",
@@ -3270,6 +3364,11 @@ var supported = /* @__PURE__ */ new Set([
3270
3364
  "PNTY",
3271
3365
  "ISERROR",
3272
3366
  "IFERROR",
3367
+ "INDIRECT",
3368
+ "DATE",
3369
+ "ANGLETOLOC",
3370
+ "LOCTOPAR",
3371
+ "SHEETREF",
3273
3372
  ...textNumberFunctions,
3274
3373
  ...textResultFunctions,
3275
3374
  ...numericFormulaFunctions,
@@ -3322,10 +3421,11 @@ var staticUnsupported = /* @__PURE__ */ new Set([
3322
3421
  "MSOTINT",
3323
3422
  "SHADE",
3324
3423
  "LUMDIFF",
3325
- "MODULUS"
3424
+ "MODULUS",
3425
+ // Reads an argument of the master the shape was dropped from; pure, evaluated in master scope.
3426
+ "ARG"
3326
3427
  ]);
3327
3428
  var dynamic = /* @__PURE__ */ new Set([
3328
- "INDIRECT",
3329
3429
  "EVALCELL",
3330
3430
  "EVALTEXT",
3331
3431
  "DEPENDSON",
@@ -3342,6 +3442,19 @@ var dynamic = /* @__PURE__ */ new Set([
3342
3442
  "PAR"
3343
3443
  ]);
3344
3444
  var isClassifiedVisioFunction = (name3) => supported.has(name3) || staticUnsupported.has(name3) || dynamic.has(name3);
3445
+ var opaqueFunctions = /* @__PURE__ */ new Set([
3446
+ "EVALCELL",
3447
+ "EVALTEXT",
3448
+ "GETREF",
3449
+ "REF",
3450
+ "_SHEETCELL",
3451
+ // Structure lookups: the result changes when shapes are created, moved or reparented.
3452
+ "CONTAINERSHEETREF",
3453
+ "MEMBERSHEETREF",
3454
+ "CALLOUTTARGET",
3455
+ "PARENT",
3456
+ "PAR"
3457
+ ]);
3345
3458
  function traverse(ast, limits, visit) {
3346
3459
  const maxNodes = formulaLimit(limits.maxNodes, 1024), maxDepth = formulaLimit(limits.maxDepth, 64);
3347
3460
  const queue = [[ast, 0]];
@@ -3359,7 +3472,7 @@ function traverse(ast, limits, visit) {
3359
3472
  function analyzeVisioFormula(source, limits = {}) {
3360
3473
  const ast = typeof source === "string" ? parseVisioFormula(source, limits) : source;
3361
3474
  const references = /* @__PURE__ */ new Map(), unsupportedFunctions = /* @__PURE__ */ new Set();
3362
- let unsafe2 = false, guarded = false;
3475
+ let unsafe2 = false, opaque = false, guarded = false;
3363
3476
  traverse(ast, limits, (node3) => {
3364
3477
  if (node3.kind === "reference")
3365
3478
  references.set(
@@ -3369,9 +3482,23 @@ function analyzeVisioFormula(source, limits = {}) {
3369
3482
  if (node3.kind === "call") {
3370
3483
  const inputs = node3.name === "ISTHEMED" ? ["ColorSchemeIndex"] : ["THEMEVAL", "THEME"].includes(node3.name) ? themeInputs : [];
3371
3484
  for (const cell of inputs) references.set(`!${cell.toLowerCase()}`, { cell });
3485
+ for (const cell of FRAME_INPUTS[node3.name] ?? [])
3486
+ references.set(`!${cell.toLowerCase()}`, { cell });
3487
+ if (node3.name === "INDIRECT") {
3488
+ const target2 = literalIndirectTarget(node3);
3489
+ if (target2 && limits.literalIndirect)
3490
+ references.set(`${target2.shapeId ?? ""}!${target2.cell.toLowerCase()}`, target2);
3491
+ else {
3492
+ unsafe2 = true;
3493
+ opaque = true;
3494
+ }
3495
+ }
3372
3496
  if (!supported.has(node3.name)) unsupportedFunctions.add(node3.name);
3373
- if (dynamic.has(node3.name) || !supported.has(node3.name) && !staticUnsupported.has(node3.name))
3497
+ const shapeText2 = node3.name === "SHAPETEXT" && limits.shapeTextReads === true && node3.args.length === 1 && isTheText(node3.args[0]);
3498
+ if (dynamic.has(node3.name) && !shapeText2 || !supported.has(node3.name) && !staticUnsupported.has(node3.name))
3374
3499
  unsafe2 = true;
3500
+ if (opaqueFunctions.has(node3.name) || node3.name === "SHAPETEXT" && !shapeText2 || !supported.has(node3.name) && !staticUnsupported.has(node3.name) && !dynamic.has(node3.name) && node3.name !== "_SHEETCALL")
3501
+ opaque = true;
3375
3502
  if (node3.name === "GUARD") guarded = true;
3376
3503
  }
3377
3504
  });
@@ -3379,10 +3506,56 @@ function analyzeVisioFormula(source, limits = {}) {
3379
3506
  references: [...references.values()],
3380
3507
  unsupportedFunctions: [...unsupportedFunctions],
3381
3508
  dynamic: unsafe2,
3509
+ opaque,
3382
3510
  guarded
3383
3511
  };
3384
3512
  }
3385
- function binary(operator, a2, b) {
3513
+
3514
+ // visio/formula-bound.ts
3515
+ function evaluateBound(args, arg) {
3516
+ if (args.length < 5 || (args.length - 2) % 3 !== 0 || args.length > 302)
3517
+ return formulaFailure("arity", "Invalid BOUND argument count");
3518
+ const value3 = arg(0), type = arg(1);
3519
+ if (type.unit !== "scalar" || ![0, 1, 2].includes(type.value))
3520
+ return formulaFailure("value", "BOUND type must be 0, 1 or 2");
3521
+ if (type.value === 2) return value3;
3522
+ if (type.value === 1) {
3523
+ let current = value3.value, unit4 = value3.unit;
3524
+ for (let pass = 0; pass <= (args.length - 2) / 3; pass++) {
3525
+ let moved = false;
3526
+ for (let index2 = 2; index2 < args.length; index2 += 3) {
3527
+ if (arg(index2).value !== 0) continue;
3528
+ const a2 = arg(index2 + 1), b = arg(index2 + 2);
3529
+ unit4 = compatibleFormulaUnits({ value: current, unit: unit4 }, a2);
3530
+ unit4 = compatibleFormulaUnits({ value: current, unit: unit4 }, b);
3531
+ const low2 = Math.min(a2.value, b.value), high2 = Math.max(a2.value, b.value);
3532
+ if (current > low2 && current < high2) {
3533
+ current = current - low2 < high2 - current ? low2 : high2;
3534
+ moved = true;
3535
+ }
3536
+ }
3537
+ if (!moved) break;
3538
+ }
3539
+ return finiteFormulaValue({ value: current, unit: unit4 });
3540
+ }
3541
+ let nearest;
3542
+ let unit3 = value3.unit;
3543
+ for (let index2 = 2; index2 < args.length; index2 += 3) {
3544
+ if (arg(index2).value !== 0) continue;
3545
+ const a2 = arg(index2 + 1), b = arg(index2 + 2);
3546
+ unit3 = compatibleFormulaUnits({ value: value3.value, unit: unit3 }, a2);
3547
+ unit3 = compatibleFormulaUnits({ value: value3.value, unit: unit3 }, b);
3548
+ const low2 = Math.min(a2.value, b.value), high2 = Math.max(a2.value, b.value);
3549
+ if (value3.value >= low2 && value3.value <= high2) return finiteFormulaValue({ value: value3.value, unit: unit3 });
3550
+ const edge = value3.value < low2 ? low2 : high2;
3551
+ if (nearest === void 0 || Math.abs(edge - value3.value) < Math.abs(nearest - value3.value))
3552
+ nearest = edge;
3553
+ }
3554
+ return finiteFormulaValue({ value: nearest ?? value3.value, unit: unit3 });
3555
+ }
3556
+
3557
+ // visio/formula-operators.ts
3558
+ function binaryOperator(operator, a2, b) {
3386
3559
  let unit3;
3387
3560
  if (operator === "+" || operator === "-") {
3388
3561
  unit3 = compatibleFormulaUnits(a2, b);
@@ -3412,12 +3585,36 @@ function binary(operator, a2, b) {
3412
3585
  return formulaFailure("syntax", `Unsupported operator ${operator}`);
3413
3586
  return { value: comparisons[operator] ? 1 : 0, unit: "scalar" };
3414
3587
  }
3588
+ function evaluatedShapeFrame(sheet, resolve) {
3589
+ if (sheet.kind !== "call" || sheet.name !== "SHEETREF" || sheet.args.length)
3590
+ return formulaFailure("unsupported", "A sheet other than SHEETREF()");
3591
+ const read = (cell, fallback) => {
3592
+ try {
3593
+ return finiteFormulaValue(resolve({ cell })).value;
3594
+ } catch (error) {
3595
+ if (fallback === void 0) throw error;
3596
+ return fallback;
3597
+ }
3598
+ };
3599
+ if (read("FlipX", 0) !== 0 || read("FlipY", 0) !== 0)
3600
+ return formulaFailure("unsupported", "A coordinate conversion on a flipped shape");
3601
+ return {
3602
+ pinX: read("PinX"),
3603
+ pinY: read("PinY"),
3604
+ locPinX: read("LocPinX", 0),
3605
+ locPinY: read("LocPinY", 0),
3606
+ angle: read("Angle", 0)
3607
+ };
3608
+ }
3609
+
3610
+ // visio/formula-evaluate.ts
3415
3611
  function evaluateVisioFormula(source, resolve, limits = {}) {
3416
3612
  const ast = typeof source === "string" ? parseVisioFormula(source, limits) : source;
3417
3613
  const maxSteps = formulaLimit(limits.maxSteps, 8192), maxDepth = formulaLimit(limits.maxDepth, 64);
3418
3614
  traverse(ast, limits, () => {
3419
3615
  });
3420
3616
  let steps = 0;
3617
+ const shapeFrame = (sheet) => evaluatedShapeFrame(sheet, resolve);
3421
3618
  const evaluate = (node3, depth = 0) => {
3422
3619
  if (++steps > maxSteps || depth > maxDepth)
3423
3620
  return formulaFailure("limit", "Formula evaluation limit");
@@ -3441,7 +3638,7 @@ function evaluateVisioFormula(source, resolve, limits = {}) {
3441
3638
  else if (right2.unit === "length" && left.unit === "scalar" && node3.left.kind === "number")
3442
3639
  left = { ...left, unit: "length" };
3443
3640
  }
3444
- return binary(node3.operator, left, right2);
3641
+ return binaryOperator(node3.operator, left, right2);
3445
3642
  }
3446
3643
  const name3 = node3.name;
3447
3644
  if ((name3 === "TEXTWIDTH" || name3 === "TEXTHEIGHT") && limits.text) {
@@ -3470,18 +3667,57 @@ function evaluateVisioFormula(source, resolve, limits = {}) {
3470
3667
  return formulaFailure("context", `${name3} requires a valid document context`);
3471
3668
  return { value: value4, unit: "scalar" };
3472
3669
  }
3670
+ const textContext = {
3671
+ number: (child3) => evaluate(child3, depth + 1),
3672
+ ...limits.textOf ? { textOf: limits.textOf } : {},
3673
+ tick: () => {
3674
+ if (++steps > maxSteps) formulaFailure("limit", "Formula evaluation limit");
3675
+ }
3676
+ };
3473
3677
  if (textNumberFunctions.has(name3))
3474
- return evaluateTextNumberFunction(name3, node3.args, {
3475
- number: (child3) => evaluate(child3, depth + 1),
3476
- tick: () => {
3477
- if (++steps > maxSteps) formulaFailure("limit", "Formula evaluation limit");
3478
- }
3678
+ return evaluateTextNumberFunction(name3, node3.args, textContext);
3679
+ if (name3 === "INDIRECT") {
3680
+ arity(1);
3681
+ const target2 = parseVisioFormula(evaluateFormulaText(node3.args[0], textContext, 1));
3682
+ if (target2.kind !== "reference")
3683
+ return formulaFailure("value", "INDIRECT needs a cell address");
3684
+ return finiteFormulaValue(resolve(target2.reference));
3685
+ }
3686
+ if (name3 === "DATE") {
3687
+ arity(3);
3688
+ const [year, month, day] = node3.args.map((_, index2) => {
3689
+ const part = arg(index2);
3690
+ if (part.unit !== "scalar") return formulaFailure("unit", "DATE requires plain numbers");
3691
+ return part.value;
3479
3692
  });
3693
+ return { value: visioDateSerial(year, month, day), unit: "time" };
3694
+ }
3695
+ if (name3 === "SHEETREF" || name3 === "LOCTOPAR")
3696
+ return formulaFailure("unsupported", `${name3} does not return a number`);
3697
+ if (name3 === "ANGLETOLOC") {
3698
+ arity(2);
3699
+ const angle = arg(1);
3700
+ if (angle.unit !== "angle" && angle.unit !== "scalar")
3701
+ return formulaFailure("unit", "ANGLETOLOC requires an angle");
3702
+ return { value: angleToLocal(shapeFrame(node3.args[0]), angle.value), unit: "angle" };
3703
+ }
3480
3704
  if (textResultFunctions.has(name3) || name3 === "PNT")
3481
3705
  return formulaFailure("unsupported", `${name3} does not return a number`);
3482
3706
  if (name3 === "PNTX" || name3 === "PNTY") {
3483
3707
  arity(1);
3484
3708
  const point2 = node3.args[0];
3709
+ if (point2.kind === "call" && point2.name === "LOCTOPAR") {
3710
+ if (point2.args.length !== 3)
3711
+ return formulaFailure("arity", "Invalid LOCTOPAR argument count");
3712
+ const [x2, y2] = [1, 2].map((index2) => {
3713
+ const part = evaluate(point2.args[index2], depth + 2);
3714
+ if (part.unit !== "scalar" && part.unit !== "length")
3715
+ return formulaFailure("unit", "LOCTOPAR requires lengths");
3716
+ return part.value;
3717
+ });
3718
+ const parent = localToParent(shapeFrame(point2.args[0]), x2, y2);
3719
+ return finiteFormulaValue({ value: parent[name3 === "PNTX" ? 0 : 1], unit: "length" });
3720
+ }
3485
3721
  if (point2.kind !== "call" || point2.name !== "PNT")
3486
3722
  return formulaFailure("unsupported", `${name3} of something other than PNT(x,y)`);
3487
3723
  if (point2.args.length !== 2) return formulaFailure("arity", "Invalid PNT argument count");
@@ -3539,47 +3775,7 @@ function evaluateVisioFormula(source, resolve, limits = {}) {
3539
3775
  }
3540
3776
  return finiteFormulaValue(result2);
3541
3777
  }
3542
- if (name3 === "BOUND") {
3543
- if (node3.args.length < 5 || (node3.args.length - 2) % 3 !== 0 || node3.args.length > 302)
3544
- return formulaFailure("arity", "Invalid BOUND argument count");
3545
- const value4 = arg(0), type = arg(1);
3546
- if (type.unit !== "scalar" || ![0, 1, 2].includes(type.value))
3547
- return formulaFailure("value", "BOUND type must be 0, 1 or 2");
3548
- if (type.value === 2) return value4;
3549
- if (type.value === 1) {
3550
- let current = value4.value, unit4 = value4.unit;
3551
- for (let pass = 0; pass <= (node3.args.length - 2) / 3; pass++) {
3552
- let moved = false;
3553
- for (let index2 = 2; index2 < node3.args.length; index2 += 3) {
3554
- if (arg(index2).value !== 0) continue;
3555
- const a2 = arg(index2 + 1), b = arg(index2 + 2);
3556
- unit4 = compatibleFormulaUnits({ value: current, unit: unit4 }, a2);
3557
- unit4 = compatibleFormulaUnits({ value: current, unit: unit4 }, b);
3558
- const low2 = Math.min(a2.value, b.value), high2 = Math.max(a2.value, b.value);
3559
- if (current > low2 && current < high2) {
3560
- current = current - low2 < high2 - current ? low2 : high2;
3561
- moved = true;
3562
- }
3563
- }
3564
- if (!moved) break;
3565
- }
3566
- return finiteFormulaValue({ value: current, unit: unit4 });
3567
- }
3568
- let nearest;
3569
- let unit3 = value4.unit;
3570
- for (let index2 = 2; index2 < node3.args.length; index2 += 3) {
3571
- if (arg(index2).value !== 0) continue;
3572
- const a2 = arg(index2 + 1), b = arg(index2 + 2);
3573
- unit3 = compatibleFormulaUnits({ value: value4.value, unit: unit3 }, a2);
3574
- unit3 = compatibleFormulaUnits({ value: value4.value, unit: unit3 }, b);
3575
- const low2 = Math.min(a2.value, b.value), high2 = Math.max(a2.value, b.value);
3576
- if (value4.value >= low2 && value4.value <= high2) return finiteFormulaValue({ value: value4.value, unit: unit3 });
3577
- const edge = value4.value < low2 ? low2 : high2;
3578
- if (nearest === void 0 || Math.abs(edge - value4.value) < Math.abs(nearest - value4.value))
3579
- nearest = edge;
3580
- }
3581
- return finiteFormulaValue({ value: nearest ?? value4.value, unit: unit3 });
3582
- }
3778
+ if (name3 === "BOUND") return evaluateBound(node3.args, arg);
3583
3779
  if (name3 === "ATAN2") {
3584
3780
  arity(2);
3585
3781
  const y = arg(0), x = arg(1);
@@ -3729,14 +3925,18 @@ function parseVisioFormula(source, limits = {}) {
3729
3925
  offset += identifier[0].length;
3730
3926
  whitespace();
3731
3927
  if (source[offset] === "(") {
3732
- if (!/^[A-Za-z_][A-Za-z_0-9]*$/.test(identifier[0]))
3928
+ const qualified = /^Sheet\.(\d+)!([A-Za-z_][A-Za-z_0-9]*)$/i.exec(identifier[0]);
3929
+ if (!qualified && !/^[A-Za-z_][A-Za-z_0-9]*$/.test(identifier[0]))
3733
3930
  return formulaFailure("syntax", "Qualified function names are unsupported");
3734
3931
  offset++;
3735
3932
  const args = [];
3736
3933
  whitespace();
3737
3934
  if (source[offset] !== ")") {
3738
3935
  for (; ; ) {
3739
- args.push(expression(0, depth + 1));
3936
+ whitespace();
3937
+ args.push(
3938
+ /^[,)]/.test(source.slice(offset)) ? node3({ kind: "string", value: "" }) : expression(0, depth + 1)
3939
+ );
3740
3940
  whitespace();
3741
3941
  if (source[offset] !== ",") break;
3742
3942
  offset++;
@@ -3744,7 +3944,27 @@ function parseVisioFormula(source, limits = {}) {
3744
3944
  }
3745
3945
  if (source[offset++] !== ")")
3746
3946
  return formulaFailure("syntax", "Expected function closing parenthesis");
3747
- left = node3({ kind: "call", name: identifier[0].toUpperCase(), args });
3947
+ left = node3({
3948
+ kind: "call",
3949
+ name: (qualified ? qualified[2] : identifier[0]).toUpperCase(),
3950
+ args
3951
+ });
3952
+ if (qualified)
3953
+ left = node3({
3954
+ kind: "call",
3955
+ name: "_SHEETCALL",
3956
+ args: [node3({ kind: "string", value: qualified[1] }), left]
3957
+ });
3958
+ whitespace();
3959
+ const member2 = source[offset] === "!" && /^!([A-Za-z_][A-Za-z_0-9.]*)/.exec(source.slice(offset));
3960
+ if (member2) {
3961
+ offset += member2[0].length;
3962
+ left = node3({
3963
+ kind: "call",
3964
+ name: "_SHEETCELL",
3965
+ args: [left, node3({ kind: "string", value: member2[1] })]
3966
+ });
3967
+ }
3748
3968
  } else {
3749
3969
  const ref = /^Sheet\.(\d+)!(.+)$/i.exec(identifier[0]);
3750
3970
  left = node3({
@@ -4915,20 +5135,36 @@ function indexCells(roots2, options2) {
4915
5135
  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
4916
5136
  // (Visio's freshly dropped connector names its own sheet).
4917
5137
  !(/^(BegTrigger|EndTrigger)$/.test(cell) && isNativeGlueCell(cell, source))) {
5138
+ const lenient = options2.scope === "affected";
5139
+ const unprovable = (message, opaque) => {
5140
+ if (!lenient) fail("EDIT_UNKNOWN_DEPENDENCY", message);
5141
+ item2.unsafe = true;
5142
+ item2.refusal = message;
5143
+ if (opaque) item2.opaque = true;
5144
+ };
4918
5145
  try {
4919
5146
  item2.formula = parseVisioFormula(source);
4920
- const plain4 = analyzeVisioFormula(item2.formula);
5147
+ const plain4 = analyzeVisioFormula(item2.formula, {
5148
+ shapeTextReads: true,
5149
+ literalIndirect: true
5150
+ });
4921
5151
  const analysis = plain4.dynamic && textSizeFormula(item2.formula) || plain4;
4922
- if (analysis.dynamic)
4923
- fail(
4924
- "EDIT_DYNAMIC_DEPENDENCY",
4925
- "Dynamic ShapeSheet dependencies cannot be safely edited."
5152
+ if (analysis.dynamic) {
5153
+ if (!lenient)
5154
+ fail(
5155
+ "EDIT_DYNAMIC_DEPENDENCY",
5156
+ "Dynamic ShapeSheet dependencies cannot be safely edited."
5157
+ );
5158
+ unprovable(
5159
+ `${cell} on shape ${sheet.shapeId || "page"} has dynamic ShapeSheet dependencies that cannot be followed.`,
5160
+ "opaque" in analysis && analysis.opaque
4926
5161
  );
5162
+ }
4927
5163
  item2.dependencies = analysis.references.filter((ref) => !isBooleanLiteral(ref)).map((ref) => key({ pageId: pageId2, shapeId: ref.shapeId ?? sheet.shapeId, cell: ref.cell }));
4928
5164
  } catch (error) {
4929
- fail(
4930
- "EDIT_UNKNOWN_DEPENDENCY",
4931
- `Cannot prove ShapeSheet dependency closure: ${error instanceof Error ? error.message : "invalid formula"}`
5165
+ unprovable(
5166
+ `Cannot prove ShapeSheet dependency closure: ${error instanceof Error ? error.message : "invalid formula"}`,
5167
+ true
4932
5168
  );
4933
5169
  }
4934
5170
  }
@@ -5011,13 +5247,20 @@ function createVisioCellEvaluator(cells4, options2 = {}, verifyCaches = false) {
5011
5247
  if (!item2 || item2.unsafe && (!item2.node || !options2.masterMovePins?.has(item2.node) && !options2.groupRotationCells?.has(item2.node)))
5012
5248
  fail(
5013
5249
  "EDIT_UNSUPPORTED_DEPENDENCY",
5014
- "Affected formula references missing, inherited or grouped cells."
5250
+ item2?.refusal ? `Affected formula cannot be evaluated: ${item2.refusal}` : "Affected formula references missing, inherited or grouped cells."
5015
5251
  );
5016
5252
  if (item2.node?.hasAttribute("E"))
5017
5253
  fail("EDIT_FORMULA_ERROR", "Affected ShapeSheet cell has an error cache.");
5018
5254
  active.add(id3);
5255
+ try {
5256
+ return evaluateCell(id3, item2);
5257
+ } finally {
5258
+ active.delete(id3);
5259
+ }
5260
+ };
5261
+ const evaluateCell = (id3, item2) => {
5019
5262
  let result2;
5020
- const analysis = item2.formula ? analyzeVisioFormula(item2.formula) : void 0;
5263
+ const analysis = item2.formula ? analyzeVisioFormula(item2.formula, { literalIndirect: true }) : void 0;
5021
5264
  if (item2.formula && item2.node && analysis.unsupportedFunctions.length) {
5022
5265
  if (!textSizeFormula(item2.formula))
5023
5266
  fail("EDIT_UNSUPPORTED_FORMULA", "Affected formula uses unsupported functions.");
@@ -5033,6 +5276,9 @@ function createVisioCellEvaluator(cells4, options2 = {}, verifyCaches = false) {
5033
5276
  ),
5034
5277
  {
5035
5278
  ...options2.pageContext?.get(item2.pageId),
5279
+ ...options2.textOf ? {
5280
+ textOf: (ref) => options2.textOf(item2.pageId, ref.shapeId ?? item2.shapeId)
5281
+ } : {},
5036
5282
  onStep: () => {
5037
5283
  if (--steps < 0)
5038
5284
  fail("LIMIT_FORMULA_STEPS", "ShapeSheet dependency evaluation limit exceeded.");
@@ -5056,16 +5302,63 @@ function createVisioCellEvaluator(cells4, options2 = {}, verifyCaches = false) {
5056
5302
  if (Math.abs(cachedValue2.value - result2.value) > 1e-10 * Math.max(1, Math.abs(result2.value)))
5057
5303
  fail("EDIT_FORMULA_CACHE", "Source formula and numeric cache disagree.");
5058
5304
  }
5059
- active.delete(id3);
5060
5305
  values.set(id3, result2);
5061
5306
  return result2;
5062
5307
  };
5063
5308
  return evaluate;
5064
5309
  }
5065
5310
 
5311
+ // visio/edit-recalculate-text.ts
5312
+ function plainShapeText(root2, shapeId2) {
5313
+ if (!root2) return void 0;
5314
+ const pending2 = children2(children2(root2, "Shapes")[0], "Shape");
5315
+ while (pending2.length) {
5316
+ const shape = pending2.pop();
5317
+ if (attribute2(shape, "ID") === shapeId2) {
5318
+ if (shape.hasAttribute("Master") || shape.hasAttribute("MasterShape")) return void 0;
5319
+ if (children2(shape, "Section").some((section3) => attribute2(section3, "N") === "Field"))
5320
+ return void 0;
5321
+ const texts = children2(shape, "Text");
5322
+ if (texts.length > 1) return void 0;
5323
+ const node3 = texts[0];
5324
+ if (!node3) return "";
5325
+ const plain4 = Array.from(node3.childNodes).every(
5326
+ (item2) => item2.nodeType === 3 || item2.nodeType === 4
5327
+ );
5328
+ return plain4 ? decodeVisioPlainText(node3.textContent ?? "") : void 0;
5329
+ }
5330
+ pending2.push(...children2(children2(shape, "Shapes")[0], "Shape"));
5331
+ }
5332
+ return void 0;
5333
+ }
5334
+ var TEXT_READERS = /* @__PURE__ */ new Set([...textNumberFunctions, ...textResultFunctions]);
5335
+ function textReadFormula(source) {
5336
+ try {
5337
+ const ast = parseVisioFormula(source);
5338
+ const analysis = analyzeVisioFormula(ast, { shapeTextReads: true });
5339
+ if (analysis.dynamic || analysis.unsupportedFunctions.length) return false;
5340
+ const textResult = ast.kind === "string" || isTheText(ast) || ast.kind === "binary" && ast.operator === "&" || ast.kind === "call" && textResultFunctions.has(ast.name);
5341
+ if (textResult) return false;
5342
+ let reads = 0;
5343
+ const walk = (node3, parent) => {
5344
+ if (isTheText(node3)) {
5345
+ reads++;
5346
+ return parent?.kind === "call" && TEXT_READERS.has(parent.name);
5347
+ }
5348
+ if (node3.kind === "unary") return walk(node3.operand, node3);
5349
+ if (node3.kind === "binary") return walk(node3.left, node3) && walk(node3.right, node3);
5350
+ if (node3.kind === "call") return node3.args.every((arg) => walk(arg, node3));
5351
+ return true;
5352
+ };
5353
+ return walk(ast) && reads > 0;
5354
+ } catch {
5355
+ return false;
5356
+ }
5357
+ }
5358
+
5066
5359
  // visio/edit-recalculate.ts
5067
5360
  function recalculateVisioCells(roots2, changed, options2 = {}) {
5068
- const cells4 = indexCells(roots2, options2);
5361
+ const cells4 = indexCells(roots2, { scope: "affected", ...options2 });
5069
5362
  const reverse = /* @__PURE__ */ new Map();
5070
5363
  for (const [id3, item2] of cells4)
5071
5364
  for (const dependency of item2.dependencies) {
@@ -5074,6 +5367,8 @@ function recalculateVisioCells(roots2, changed, options2 = {}) {
5074
5367
  reverse.set(dependency, next);
5075
5368
  }
5076
5369
  const affected = new Set(changed.map(key));
5370
+ const editedPages = new Set(changed.map((cell) => cell.pageId));
5371
+ for (const [id3, item2] of cells4) if (item2.opaque && editedPages.has(item2.pageId)) affected.add(id3);
5077
5372
  const pending2 = [...affected];
5078
5373
  const maxAffected = bound(options2.maxAffectedCells, 1e4);
5079
5374
  for (let i = 0; i < pending2.length; i++) {
@@ -5086,13 +5381,29 @@ function recalculateVisioCells(roots2, changed, options2 = {}) {
5086
5381
  if (affected.size > maxAffected)
5087
5382
  fail("LIMIT_FORMULA_AFFECTED", "Affected ShapeSheet cell limit exceeded.");
5088
5383
  }
5089
- const evaluate = createVisioCellEvaluator(cells4, options2);
5384
+ const evaluate = createVisioCellEvaluator(cells4, {
5385
+ textOf: (pageId2, shapeId2) => plainShapeText(roots2.get(pageId2), shapeId2),
5386
+ ...options2
5387
+ });
5090
5388
  const values = /* @__PURE__ */ new Map();
5091
- for (const id3 of affected) values.set(id3, evaluate(id3));
5389
+ for (const id3 of affected) {
5390
+ if (!cells4.has(id3) && /,"thetext"]$/.test(id3)) continue;
5391
+ try {
5392
+ values.set(id3, evaluate(id3));
5393
+ } catch (error) {
5394
+ if (options2.cycles !== "keep" || !(error instanceof VisioPackageError) || error.code !== "EDIT_FORMULA_CYCLE")
5395
+ throw error;
5396
+ const cyclic = cells4.get(id3);
5397
+ options2.diagnostics?.push({
5398
+ code: "FORMULA_CYCLE",
5399
+ 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.`
5400
+ });
5401
+ }
5402
+ }
5092
5403
  const pages = /* @__PURE__ */ new Set();
5093
5404
  for (const id3 of affected) {
5094
5405
  const item2 = cells4.get(id3);
5095
- if (item2.node && item2.formula) {
5406
+ if (item2?.node && item2.formula && values.has(id3)) {
5096
5407
  const value3 = String(values.get(id3).value);
5097
5408
  if (item2.node.getAttribute("V") !== value3) {
5098
5409
  item2.node.setAttribute("V", value3);
@@ -5103,15 +5414,29 @@ function recalculateVisioCells(roots2, changed, options2 = {}) {
5103
5414
  return [...pages];
5104
5415
  }
5105
5416
  function assertVisioShapesUnreferenced(roots2, removed, options2 = {}) {
5106
- const cells4 = indexCells(roots2, options2);
5417
+ const cells4 = indexCells(roots2, { scope: "affected", ...options2 });
5418
+ const frozen = [];
5107
5419
  for (const cell of cells4.values()) {
5108
5420
  options2.check?.();
5421
+ if (cell.opaque && removed.has(cell.pageId) && !removed.get(cell.pageId).has(cell.shapeId))
5422
+ fail(
5423
+ "EDIT_REFERENCED_DELETE",
5424
+ `${cell.cell} on shape ${cell.shapeId || "page"} may read the removed shape through a dynamic dependency.`
5425
+ );
5109
5426
  if (removed.get(cell.pageId)?.has(cell.shapeId)) continue;
5110
5427
  if (cell.dependencies.some((id3) => {
5111
5428
  const parts = JSON.parse(id3);
5112
5429
  return removed.get(parts[0])?.has(parts[1]) ?? false;
5113
- }))
5114
- fail("EDIT_REFERENCED_DELETE", "Shape is referenced by a ShapeSheet formula.");
5430
+ })) {
5431
+ if (!options2.freeze || !cell.node || !cell.formula || cell.unsafe || cell.node.hasAttribute("E") || analyzeVisioFormula(cell.formula, { literalIndirect: true }).guarded || !Number.isFinite(
5432
+ visioFormulaCachedValue(
5433
+ cell.node.getAttribute("V") ?? "",
5434
+ cell.node.getAttribute("U") ?? void 0
5435
+ ).value
5436
+ ))
5437
+ fail("EDIT_REFERENCED_DELETE", "Shape is referenced by a ShapeSheet formula.");
5438
+ frozen.push(cell.node);
5439
+ }
5115
5440
  }
5116
5441
  for (const [pageId2, ids] of removed)
5117
5442
  for (const connections2 of children2(roots2.get(pageId2), "Connects"))
@@ -5120,12 +5445,16 @@ function assertVisioShapesUnreferenced(roots2, removed, options2 = {}) {
5120
5445
  if (["FromSheet", "ToSheet"].some((name3) => ids.has(attribute2(connection, name3) ?? "")))
5121
5446
  fail("EDIT_REFERENCED_DELETE", "Shape participates in a Connect record.");
5122
5447
  }
5448
+ return frozen;
5123
5449
  }
5450
+ var freezeVisioCells = (nodes) => {
5451
+ for (const node3 of nodes) node3.removeAttribute("F");
5452
+ };
5124
5453
  function assertVisioShapeUnreferenced(roots2, pageId2, shapeId2, options2 = {}) {
5125
- assertVisioShapesUnreferenced(roots2, /* @__PURE__ */ new Map([[pageId2, /* @__PURE__ */ new Set([shapeId2])]]), options2);
5454
+ return assertVisioShapesUnreferenced(roots2, /* @__PURE__ */ new Map([[pageId2, /* @__PURE__ */ new Set([shapeId2])]]), options2);
5126
5455
  }
5127
5456
  function createVisioDependencyQuery(roots2, options2 = {}) {
5128
- const cells4 = indexCells(roots2, options2);
5457
+ const cells4 = indexCells(roots2, { scope: "affected", ...options2 });
5129
5458
  return (source, targets) => {
5130
5459
  const wanted = new Set(targets.map(key));
5131
5460
  const seen = /* @__PURE__ */ new Set();
@@ -5140,7 +5469,7 @@ function createVisioDependencyQuery(roots2, options2 = {}) {
5140
5469
  if (seen.size > maxSteps) fail("LIMIT_FORMULA_STEPS", "Dependency analysis limit exceeded.");
5141
5470
  const item2 = cells4.get(id3);
5142
5471
  if (!item2 || item2.unsafe || item2.node?.hasAttribute("E")) return false;
5143
- if (item2.formula && analyzeVisioFormula(item2.formula).unsupportedFunctions.length)
5472
+ if (item2.formula && analyzeVisioFormula(item2.formula, { literalIndirect: true }).unsupportedFunctions.length)
5144
5473
  return false;
5145
5474
  if (wanted.has(id3)) found = true;
5146
5475
  else pending2.push(...item2.dependencies);
@@ -6180,7 +6509,7 @@ var VISIO_DEFAULT_TITLE = "Title";
6180
6509
  var ACCENT = { background: "Background Accent", border: "Border Accent" };
6181
6510
  function visioShade(color2, amount) {
6182
6511
  const value3 = Number.parseInt(color2.slice(1), 16);
6183
- const channel = (shift2) => Math.round((value3 >> shift2 & 255) * (1 - amount)).toString(16).padStart(2, "0");
6512
+ const channel = (shift3) => Math.round((value3 >> shift3 & 255) * (1 - amount)).toString(16).padStart(2, "0");
6184
6513
  return `#${channel(16)}${channel(8)}${channel(0)}`.toUpperCase();
6185
6514
  }
6186
6515
  function visioDecorationName(name3) {
@@ -8310,9 +8639,16 @@ function visioWalkPath(begin, end) {
8310
8639
  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];
8311
8640
  };
8312
8641
  let path3;
8313
- if (gapX >= -EPSILON2 && inside2(from.y, b.minY, b.maxY))
8314
- path3 = jog(side(begin, sx, 0), side(end, -sx, 0), true);
8315
- else if (gapY >= -EPSILON2 && inside2(from.x, b.minX, b.maxX))
8642
+ if (gapX >= -EPSILON2 && inside2(from.y, b.minY, b.maxY)) {
8643
+ const p = side(begin, sx, 0), q = side(end, -sx, 0);
8644
+ if (begin.shape?.floating && end.shape?.floating) {
8645
+ const y = (Math.max(a2.minY, b.minY) + Math.min(a2.maxY, b.maxY)) / 2;
8646
+ path3 = [
8647
+ { x: p.x, y },
8648
+ { x: q.x, y }
8649
+ ];
8650
+ } else path3 = jog(p, q, true);
8651
+ } else if (gapY >= -EPSILON2 && inside2(from.x, b.minX, b.maxX))
8316
8652
  path3 = jog(side(begin, 0, sy), side(end, 0, -sy), false);
8317
8653
  else if (gapY < -EPSILON2 || gapY < CHANNEL && gapX >= CHANNEL) {
8318
8654
  const p = side(begin, sx, 0);
@@ -15369,10 +15705,10 @@ async function* streamEntryGuarded(entry3, alreadyRead, limits) {
15369
15705
  }
15370
15706
  }
15371
15707
  function toBase64(bytes) {
15372
- let binary2 = "";
15708
+ let binary = "";
15373
15709
  for (let i = 0; i < bytes.length; i += 32768)
15374
- binary2 += String.fromCharCode(...bytes.subarray(i, i + 32768));
15375
- return btoa(binary2);
15710
+ binary += String.fromCharCode(...bytes.subarray(i, i + 32768));
15711
+ return btoa(binary);
15376
15712
  }
15377
15713
  function guardZip(zip, limits = {}) {
15378
15714
  const r = resolveLimits(limits);
@@ -17816,6 +18152,332 @@ function parseStyles(xml, warnings) {
17816
18152
  return result2;
17817
18153
  }
17818
18154
 
18155
+ // xlsx/read/print-options.ts
18156
+ var KEYS = ["gridLines", "headings", "horizontalCentered", "verticalCentered"];
18157
+ function readPrintOptions(node3) {
18158
+ if (!node3) return void 0;
18159
+ const out = {};
18160
+ for (const key2 of KEYS) if (boolAttr(node3, key2)) out[key2] = true;
18161
+ return Object.keys(out).length ? out : void 0;
18162
+ }
18163
+
18164
+ // xlsx/read/password-hash.ts
18165
+ function modernHashAttributeNames(prefix2 = "") {
18166
+ const name3 = (base2) => prefix2 ? `${prefix2}${base2[0].toUpperCase()}${base2.slice(1)}` : base2;
18167
+ return {
18168
+ algorithmName: name3("algorithmName"),
18169
+ hashValue: name3("hashValue"),
18170
+ saltValue: name3("saltValue"),
18171
+ spinCount: name3("spinCount")
18172
+ };
18173
+ }
18174
+ function readModernHash(node3, prefix2 = "") {
18175
+ const names = modernHashAttributeNames(prefix2);
18176
+ const algorithmName = att(node3, names.algorithmName);
18177
+ const hashValue = att(node3, names.hashValue);
18178
+ const saltValue = att(node3, names.saltValue);
18179
+ if (!algorithmName || !hashValue || !saltValue) return void 0;
18180
+ const hash = { algorithmName, hashValue, saltValue };
18181
+ const spin = att(node3, names.spinCount);
18182
+ const spinCount = spin === void 0 || spin.trim() === "" ? Number.NaN : Number(spin);
18183
+ if (Number.isFinite(spinCount)) hash.spinCount = spinCount;
18184
+ return hash;
18185
+ }
18186
+
18187
+ // xlsx/read/sheet-props.ts
18188
+ var defaultSheetView = () => ({
18189
+ showGridLines: true,
18190
+ showHeaders: true,
18191
+ showZeros: true,
18192
+ rightToLeft: false,
18193
+ zoom: 100
18194
+ });
18195
+ function parseSqref(sqref) {
18196
+ if (!sqref) return [];
18197
+ return sqref.split(/\s+/).filter(Boolean).map((part) => parseRange(part)).filter((range2) => range2 !== void 0);
18198
+ }
18199
+ var readTabColor = (sheetPr, palette) => parseColor(xFirst(sheetPr, "tabColor"), palette);
18200
+ var readFitToPage = (sheetPr) => boolAttr(xFirst(sheetPr, "pageSetUpPr"), "fitToPage") ?? false;
18201
+ function readSheetView(sheetViews) {
18202
+ const view = defaultSheetView();
18203
+ const node3 = xFirst(sheetViews, "sheetView");
18204
+ if (!node3) return view;
18205
+ view.showGridLines = boolAttr(node3, "showGridLines", true);
18206
+ view.showHeaders = boolAttr(node3, "showRowColHeaders", true);
18207
+ view.showZeros = boolAttr(node3, "showZeros", true);
18208
+ view.rightToLeft = boolAttr(node3, "rightToLeft", false);
18209
+ view.zoom = numAttr(node3, "zoomScale") || 100;
18210
+ if (boolAttr(node3, "showFormulas")) view.showFormulas = true;
18211
+ const mode = att(node3, "view");
18212
+ if (mode === "pageLayout" || mode === "pageBreakPreview") view.mode = mode;
18213
+ const pane = xFirst(node3, "pane");
18214
+ const state = att(pane, "state");
18215
+ const frozen = pane && (state === "frozen" || state === "frozenSplit");
18216
+ if (frozen) {
18217
+ const rows = Math.max(0, Math.round(numAttr(pane, "ySplit") ?? 0));
18218
+ const cols = Math.max(0, Math.round(numAttr(pane, "xSplit") ?? 0));
18219
+ if (rows || cols) view.freeze = { rows, cols };
18220
+ }
18221
+ const topLeft = parseAddress(
18222
+ (frozen ? att(pane, "topLeftCell") : att(node3, "topLeftCell")) ?? ""
18223
+ );
18224
+ if (topLeft) view.topLeft = topLeft;
18225
+ const selections = xChildren(node3, "selection");
18226
+ const activePane = att(pane, "activePane") ?? "topLeft";
18227
+ const selection = selections.find((sel) => (att(sel, "pane") ?? "topLeft") === activePane) ?? selections[0];
18228
+ if (selection) {
18229
+ const ranges = parseSqref(att(selection, "sqref") ?? att(selection, "activeCell") ?? "A1");
18230
+ const active = parseAddress(att(selection, "activeCell") ?? "") ?? ranges[0]?.start ?? { row: 0, col: 0 };
18231
+ view.selection = {
18232
+ active,
18233
+ ranges: ranges.length ? ranges : [{ start: active, end: { ...active } }]
18234
+ };
18235
+ }
18236
+ return view;
18237
+ }
18238
+ var FORMAT_FLAGS = ["zeroHeight", "customHeight", "thickTop", "thickBottom"];
18239
+ function readSheetFormat(format5) {
18240
+ const result2 = {
18241
+ defaultRowHeight: numAttr(format5, "defaultRowHeight") ?? 15
18242
+ };
18243
+ const width = numAttr(format5, "defaultColWidth");
18244
+ if (width !== void 0) result2.defaultColWidth = width;
18245
+ const flags = {};
18246
+ for (const key2 of FORMAT_FLAGS) {
18247
+ const value3 = boolAttr(format5, key2);
18248
+ if (value3 !== void 0) flags[key2] = value3;
18249
+ }
18250
+ const base2 = numAttr(format5, "baseColWidth");
18251
+ if (base2 !== void 0) flags.baseColWidth = base2;
18252
+ if (Object.keys(flags).length) result2.format = flags;
18253
+ return result2;
18254
+ }
18255
+ function readColumns(cols, xfMap) {
18256
+ const out = [];
18257
+ for (const col of cols ? xChildren(cols, "col") : []) {
18258
+ const min = (numAttr(col, "min") ?? 1) - 1;
18259
+ const max = (numAttr(col, "max") ?? min + 1) - 1;
18260
+ const info = { min, max };
18261
+ const width = numAttr(col, "width");
18262
+ if (width !== void 0) info.width = width;
18263
+ if (boolAttr(col, "customWidth")) info.customWidth = true;
18264
+ if (boolAttr(col, "hidden")) info.hidden = true;
18265
+ const style2 = numAttr(col, "style");
18266
+ const styleId = style2 === void 0 ? 0 : xfMap[style2] ?? 0;
18267
+ if (styleId) info.styleId = styleId;
18268
+ const outline = numAttr(col, "outlineLevel");
18269
+ if (outline) info.outlineLevel = outline;
18270
+ if (boolAttr(col, "collapsed")) info.collapsed = true;
18271
+ if (boolAttr(col, "bestFit")) info.bestFit = true;
18272
+ out.push(info);
18273
+ }
18274
+ return out;
18275
+ }
18276
+ var MAIN_NS_DECL = /(?<=^<[^>]*) xmlns="http:\/\/schemas\.openxmlformats\.org\/spreadsheetml\/2006\/main"/;
18277
+ function readAutoFilter(node3) {
18278
+ const range2 = parseRange(att(node3, "ref") ?? "");
18279
+ if (!node3 || !range2) return void 0;
18280
+ const filter = { range: range2 };
18281
+ const columns = [];
18282
+ for (const column of xChildren(node3, "filterColumn")) {
18283
+ const entry3 = {
18284
+ offset: numAttr(column, "colId") ?? 0
18285
+ };
18286
+ const filters = xFirst(column, "filters");
18287
+ if (filters) {
18288
+ entry3.values = xChildren(filters, "filter").map((f) => att(f, "val") ?? "");
18289
+ if (boolAttr(filters, "blank")) entry3.blank = true;
18290
+ }
18291
+ entry3.sourceXml = outerXml(column).replace(MAIN_NS_DECL, "");
18292
+ columns.push(entry3);
18293
+ }
18294
+ if (columns.length) filter.columns = columns;
18295
+ return filter;
18296
+ }
18297
+ var HEADER_FOOTER_TEXT = {
18298
+ header: "oddHeader",
18299
+ footer: "oddFooter",
18300
+ evenHeader: "evenHeader",
18301
+ evenFooter: "evenFooter",
18302
+ firstHeader: "firstHeader",
18303
+ firstFooter: "firstFooter"
18304
+ };
18305
+ var HEADER_FOOTER_FLAGS = [
18306
+ "differentOddEven",
18307
+ "differentFirst",
18308
+ "scaleWithDoc",
18309
+ "alignWithMargins"
18310
+ ];
18311
+ function readHeaderFooter(node3) {
18312
+ const out = {};
18313
+ for (const key2 of HEADER_FOOTER_FLAGS) {
18314
+ const value3 = boolAttr(node3, key2);
18315
+ if (value3 !== void 0) out[key2] = value3;
18316
+ }
18317
+ for (const [key2, local] of Object.entries(HEADER_FOOTER_TEXT)) {
18318
+ const child3 = xFirst(node3, local);
18319
+ if (child3) out[key2] = xText(child3);
18320
+ }
18321
+ return out;
18322
+ }
18323
+ var ORIENTATIONS = /* @__PURE__ */ new Set(["portrait", "landscape"]);
18324
+ function readPageSetup(margins, setup, headerFooter, fitToPage) {
18325
+ const page = {};
18326
+ if (setup) {
18327
+ if (/^(1|true)$/.test(att(setup, "useFirstPageNumber") ?? "")) {
18328
+ page.firstPageNumber = numAttr(setup, "firstPageNumber") ?? 1;
18329
+ }
18330
+ const order = att(setup, "pageOrder");
18331
+ if (order === "downThenOver" || order === "overThenDown") page.pageOrder = order;
18332
+ const orientation = att(setup, "orientation");
18333
+ if (orientation && ORIENTATIONS.has(orientation))
18334
+ page.orientation = orientation;
18335
+ const paper = numAttr(setup, "paperSize");
18336
+ if (paper !== void 0) page.paperSize = paper;
18337
+ const scale = numAttr(setup, "scale");
18338
+ if (scale !== void 0) page.scale = scale;
18339
+ }
18340
+ if (fitToPage) {
18341
+ page.fitToWidth = numAttr(setup, "fitToWidth") ?? 1;
18342
+ page.fitToHeight = numAttr(setup, "fitToHeight") ?? 1;
18343
+ }
18344
+ if (margins) {
18345
+ const m = (name3, fallback) => numAttr(margins, name3) ?? fallback;
18346
+ page.margins = {
18347
+ left: m("left", 0.7),
18348
+ right: m("right", 0.7),
18349
+ top: m("top", 0.75),
18350
+ bottom: m("bottom", 0.75),
18351
+ header: m("header", 0.3),
18352
+ footer: m("footer", 0.3)
18353
+ };
18354
+ }
18355
+ if (headerFooter) Object.assign(page, readHeaderFooter(headerFooter));
18356
+ return Object.keys(page).length ? page : void 0;
18357
+ }
18358
+ var PROTECTION_META = /* @__PURE__ */ new Set([
18359
+ "sheet",
18360
+ "password",
18361
+ "algorithmName",
18362
+ "hashValue",
18363
+ "saltValue",
18364
+ "spinCount"
18365
+ ]);
18366
+ function readProtection(node3) {
18367
+ if (!node3) return void 0;
18368
+ const protection2 = { sheet: boolAttr(node3, "sheet", false) };
18369
+ const password = att(node3, "password");
18370
+ if (password) protection2.passwordHash = password;
18371
+ const modernHash = readModernHash(node3);
18372
+ if (modernHash) protection2.modernHash = modernHash;
18373
+ const allow = [];
18374
+ for (const attribute4 of Array.from(node3.attributes)) {
18375
+ if (PROTECTION_META.has(attribute4.name)) continue;
18376
+ if (attribute4.value === "0" || attribute4.value === "false") allow.push(attribute4.name);
18377
+ }
18378
+ if (allow.length) protection2.allow = allow.sort();
18379
+ return protection2;
18380
+ }
18381
+
18382
+ // xlsx/read/custom-views.ts
18383
+ var SHEET_VIEW_ATTRS = [
18384
+ "guid",
18385
+ "scale",
18386
+ "showGridLines",
18387
+ "showRowCol",
18388
+ "zeroValues",
18389
+ "topLeftCell",
18390
+ "view",
18391
+ "showFormulas",
18392
+ "hiddenRows",
18393
+ "hiddenColumns",
18394
+ "filter",
18395
+ "showAutoFilter",
18396
+ "fitToPage"
18397
+ ];
18398
+ var WORKBOOK_VIEW_KNOWN = ["name", "guid", "includePrintSettings", "includeHiddenRowCol"];
18399
+ function readCustomWorkbookViews(node3) {
18400
+ return xChildren(node3, "customWorkbookView").flatMap((view) => {
18401
+ const guid2 = att(view, "guid");
18402
+ if (!guid2) return [];
18403
+ const attrs = {};
18404
+ for (const attribute4 of Array.from(view.attributes))
18405
+ if (!WORKBOOK_VIEW_KNOWN.includes(attribute4.name) && !attribute4.name.startsWith("xmlns"))
18406
+ attrs[attribute4.name] = attribute4.value;
18407
+ return [
18408
+ {
18409
+ guid: guid2,
18410
+ name: att(view, "name") ?? "",
18411
+ includePrintSettings: boolAttr(view, "includePrintSettings", true),
18412
+ includeHiddenRowCol: boolAttr(view, "includeHiddenRowCol", true),
18413
+ attrs
18414
+ }
18415
+ ];
18416
+ });
18417
+ }
18418
+ var escape3 = (value3) => value3.replace(/&/g, "&amp;").replace(/"/g, "&quot;");
18419
+ function asSheetViews(view) {
18420
+ const map = [
18421
+ ["scale", "zoomScale"],
18422
+ ["showGridLines", "showGridLines"],
18423
+ ["showRowCol", "showRowColHeaders"],
18424
+ ["zeroValues", "showZeros"],
18425
+ ["topLeftCell", "topLeftCell"],
18426
+ ["view", "view"],
18427
+ ["showFormulas", "showFormulas"]
18428
+ ];
18429
+ const attributes = map.flatMap(([from, to]) => {
18430
+ const value3 = att(view, from);
18431
+ return value3 === void 0 ? [] : [` ${to}="${escape3(value3)}"`];
18432
+ }).join("");
18433
+ const children3 = elements(view).filter((child3) => child3.localName === "pane" || child3.localName === "selection").map((child3) => outerXml(child3)).join("");
18434
+ return parseXml(
18435
+ `<sheetViews xmlns="${NS.x}"><sheetView${attributes}>${children3}</sheetView></sheetViews>`
18436
+ ).documentElement;
18437
+ }
18438
+ function readCustomSheetViews(node3) {
18439
+ return xChildren(node3, "customSheetView").flatMap((view) => {
18440
+ const guid2 = att(view, "guid");
18441
+ if (!guid2) return [];
18442
+ const child3 = (name3) => xChildren(view, name3)[0];
18443
+ const pageSetup = readPageSetup(
18444
+ child3("pageMargins"),
18445
+ child3("pageSetup"),
18446
+ child3("headerFooter"),
18447
+ boolAttr(view, "fitToPage", false)
18448
+ );
18449
+ const printOptions = readPrintOptions(child3("printOptions"));
18450
+ const filter = readAutoFilter(child3("autoFilter"));
18451
+ const attrs = {};
18452
+ for (const attribute4 of Array.from(view.attributes))
18453
+ if (!SHEET_VIEW_ATTRS.includes(attribute4.name) && !attribute4.name.startsWith("xmlns"))
18454
+ attrs[attribute4.name] = attribute4.value;
18455
+ const modelled = [
18456
+ "pane",
18457
+ "selection",
18458
+ "pageMargins",
18459
+ "printOptions",
18460
+ "pageSetup",
18461
+ "headerFooter",
18462
+ "autoFilter"
18463
+ ];
18464
+ return [
18465
+ {
18466
+ guid: guid2,
18467
+ view: readSheetView(asSheetViews(view)),
18468
+ ...boolAttr(view, "hiddenRows", false) ? { hiddenRows: true } : {},
18469
+ ...boolAttr(view, "hiddenColumns", false) ? { hiddenColumns: true } : {},
18470
+ ...filter ? { filter } : {},
18471
+ ...boolAttr(view, "showAutoFilter", false) ? { showAutoFilter: true } : {},
18472
+ ...pageSetup ? { pageSetup } : {},
18473
+ ...printOptions ? { printOptions } : {},
18474
+ attrs,
18475
+ extra: elements(view).filter((c2) => !modelled.includes(c2.localName ?? "")).map((c2) => outerXml(c2))
18476
+ }
18477
+ ];
18478
+ });
18479
+ }
18480
+
17819
18481
  // xlsx/read/formula-storage.ts
17820
18482
  function tokens(formula2) {
17821
18483
  try {
@@ -17913,30 +18575,20 @@ function stripFuturePrefixes(formula2) {
17913
18575
  return fromStoredSyntax(plain4);
17914
18576
  }
17915
18577
 
17916
- // xlsx/read/password-hash.ts
17917
- function modernHashAttributeNames(prefix2 = "") {
17918
- const name3 = (base2) => prefix2 ? `${prefix2}${base2[0].toUpperCase()}${base2.slice(1)}` : base2;
17919
- return {
17920
- algorithmName: name3("algorithmName"),
17921
- hashValue: name3("hashValue"),
17922
- saltValue: name3("saltValue"),
17923
- spinCount: name3("spinCount")
17924
- };
17925
- }
17926
- function readModernHash(node3, prefix2 = "") {
17927
- const names = modernHashAttributeNames(prefix2);
17928
- const algorithmName = att(node3, names.algorithmName);
17929
- const hashValue = att(node3, names.hashValue);
17930
- const saltValue = att(node3, names.saltValue);
17931
- if (!algorithmName || !hashValue || !saltValue) return void 0;
17932
- const hash = { algorithmName, hashValue, saltValue };
17933
- const spin = att(node3, names.spinCount);
17934
- const spinCount = spin === void 0 || spin.trim() === "" ? Number.NaN : Number(spin);
17935
- if (Number.isFinite(spinCount)) hash.spinCount = spinCount;
17936
- return hash;
17937
- }
17938
-
17939
18578
  // xlsx/read/workbook-part.ts
18579
+ var NAME_EXTRA_ATTRIBUTES = [
18580
+ "function",
18581
+ "vbProcedure",
18582
+ "xlm",
18583
+ "customMenu",
18584
+ "description",
18585
+ "help",
18586
+ "statusBar",
18587
+ "shortcutKey",
18588
+ "functionGroupId",
18589
+ "publishToServer",
18590
+ "workbookParameter"
18591
+ ];
17940
18592
  function parseWorkbookPart(xml) {
17941
18593
  const root2 = parseXml(xml, { label: "XLSX workbook" }).documentElement;
17942
18594
  const sheets = [];
@@ -17960,6 +18612,12 @@ function parseWorkbookPart(xml) {
17960
18612
  if (boolAttr(node3, "hidden")) name3.hidden = true;
17961
18613
  const comment = att(node3, "comment");
17962
18614
  if (comment) name3.comment = comment;
18615
+ const extra = {};
18616
+ for (const key2 of NAME_EXTRA_ATTRIBUTES) {
18617
+ const value3 = att(node3, key2);
18618
+ if (value3 !== void 0) extra[key2] = value3;
18619
+ }
18620
+ if (Object.keys(extra).length) name3.extra = extra;
17963
18621
  if (name3.name) definedNames.push(name3);
17964
18622
  }
17965
18623
  const view = xFirst(xFirst(root2, "bookViews"), "workbookView");
@@ -17973,7 +18631,9 @@ function parseWorkbookPart(xml) {
17973
18631
  delta: numAttr(calcPr, "iterateDelta") ?? 1e-3
17974
18632
  } : void 0;
17975
18633
  const oleSize = att(xFirst(root2, "oleSize"), "ref");
18634
+ const customViews = xFirst(root2, "customWorkbookViews");
17976
18635
  return {
18636
+ ...customViews ? { customViews: readCustomWorkbookViews(customViews) } : {},
17977
18637
  ...oleSize ? { oleSize } : {},
17978
18638
  ...iterate ? { iterate } : {},
17979
18639
  ...password ? { workbookPasswordHash: password } : {},
@@ -18007,9 +18667,9 @@ function parseFormula(fmla) {
18007
18667
  return { op, args };
18008
18668
  }
18009
18669
  function resolveOperand(token, variables) {
18010
- const num = Number(token);
18011
- if (Number.isFinite(num)) {
18012
- return num;
18670
+ const num2 = Number(token);
18671
+ if (Number.isFinite(num2)) {
18672
+ return num2;
18013
18673
  }
18014
18674
  const value3 = variables.get(token);
18015
18675
  if (value3 !== void 0) {
@@ -19682,18 +20342,18 @@ function groupTransform(group2, parent) {
19682
20342
  const ext = first(xfrm, "ext", NS.a);
19683
20343
  const chOff = first(xfrm, "chOff", NS.a);
19684
20344
  const chExt = first(xfrm, "chExt", NS.a);
19685
- const num = (element2, name3) => Number.parseInt(element2?.getAttribute(name3) ?? "", 10);
19686
- const cx = num(ext, "cx");
19687
- const cy = num(ext, "cy");
19688
- const chCx = num(chExt, "cx");
19689
- const chCy = num(chExt, "cy");
20345
+ const num2 = (element2, name3) => Number.parseInt(element2?.getAttribute(name3) ?? "", 10);
20346
+ const cx = num2(ext, "cx");
20347
+ const cy = num2(ext, "cy");
20348
+ const chCx = num2(chExt, "cx");
20349
+ const chCy = num2(chExt, "cy");
19690
20350
  if (!off || ![cx, cy, chCx, chCy].every(Number.isFinite) || chCx === 0 || chCy === 0)
19691
20351
  return parent;
19692
20352
  const scaleX = cx / chCx;
19693
20353
  const scaleY = cy / chCy;
19694
20354
  const local = {
19695
- offsetX: num(off, "x") - (num(chOff, "x") || 0) * scaleX,
19696
- offsetY: num(off, "y") - (num(chOff, "y") || 0) * scaleY,
20355
+ offsetX: num2(off, "x") - (num2(chOff, "x") || 0) * scaleX,
20356
+ offsetY: num2(off, "y") - (num2(chOff, "y") || 0) * scaleY,
19697
20357
  scaleX,
19698
20358
  scaleY
19699
20359
  };
@@ -20001,200 +20661,48 @@ async function resolveSmartArt(sheets, source, warn) {
20001
20661
  }
20002
20662
  }
20003
20663
 
20004
- // xlsx/read/sheet-props.ts
20005
- var defaultSheetView = () => ({
20006
- showGridLines: true,
20007
- showHeaders: true,
20008
- showZeros: true,
20009
- rightToLeft: false,
20010
- zoom: 100
20011
- });
20012
- function parseSqref(sqref) {
20013
- if (!sqref) return [];
20014
- return sqref.split(/\s+/).filter(Boolean).map((part) => parseRange(part)).filter((range2) => range2 !== void 0);
20015
- }
20016
- var readTabColor = (sheetPr, palette) => parseColor(xFirst(sheetPr, "tabColor"), palette);
20017
- var readFitToPage = (sheetPr) => boolAttr(xFirst(sheetPr, "pageSetUpPr"), "fitToPage") ?? false;
20018
- function readSheetView(sheetViews) {
20019
- const view = defaultSheetView();
20020
- const node3 = xFirst(sheetViews, "sheetView");
20021
- if (!node3) return view;
20022
- view.showGridLines = boolAttr(node3, "showGridLines", true);
20023
- view.showHeaders = boolAttr(node3, "showRowColHeaders", true);
20024
- view.showZeros = boolAttr(node3, "showZeros", true);
20025
- view.rightToLeft = boolAttr(node3, "rightToLeft", false);
20026
- view.zoom = numAttr(node3, "zoomScale") || 100;
20027
- if (boolAttr(node3, "showFormulas")) view.showFormulas = true;
20028
- const mode = att(node3, "view");
20029
- if (mode === "pageLayout" || mode === "pageBreakPreview") view.mode = mode;
20030
- const pane = xFirst(node3, "pane");
20031
- const state = att(pane, "state");
20032
- const frozen = pane && (state === "frozen" || state === "frozenSplit");
20033
- if (frozen) {
20034
- const rows = Math.max(0, Math.round(numAttr(pane, "ySplit") ?? 0));
20035
- const cols = Math.max(0, Math.round(numAttr(pane, "xSplit") ?? 0));
20036
- if (rows || cols) view.freeze = { rows, cols };
20037
- }
20038
- const topLeft = parseAddress(
20039
- (frozen ? att(pane, "topLeftCell") : att(node3, "topLeftCell")) ?? ""
20040
- );
20041
- if (topLeft) view.topLeft = topLeft;
20042
- const selections = xChildren(node3, "selection");
20043
- const activePane = att(pane, "activePane") ?? "topLeft";
20044
- const selection = selections.find((sel) => (att(sel, "pane") ?? "topLeft") === activePane) ?? selections[0];
20045
- if (selection) {
20046
- const ranges = parseSqref(att(selection, "sqref") ?? att(selection, "activeCell") ?? "A1");
20047
- const active = parseAddress(att(selection, "activeCell") ?? "") ?? ranges[0]?.start ?? { row: 0, col: 0 };
20048
- view.selection = {
20049
- active,
20050
- ranges: ranges.length ? ranges : [{ start: active, end: { ...active } }]
20051
- };
20052
- }
20053
- return view;
20054
- }
20055
- var FORMAT_FLAGS = ["zeroHeight", "customHeight", "thickTop", "thickBottom"];
20056
- function readSheetFormat(format5) {
20057
- const result2 = {
20058
- defaultRowHeight: numAttr(format5, "defaultRowHeight") ?? 15
20059
- };
20060
- const width = numAttr(format5, "defaultColWidth");
20061
- if (width !== void 0) result2.defaultColWidth = width;
20062
- const flags = {};
20063
- for (const key2 of FORMAT_FLAGS) {
20064
- const value3 = boolAttr(format5, key2);
20065
- if (value3 !== void 0) flags[key2] = value3;
20066
- }
20067
- const base2 = numAttr(format5, "baseColWidth");
20068
- if (base2 !== void 0) flags.baseColWidth = base2;
20069
- if (Object.keys(flags).length) result2.format = flags;
20070
- return result2;
20071
- }
20072
- function readColumns(cols, xfMap) {
20073
- const out = [];
20074
- for (const col of cols ? xChildren(cols, "col") : []) {
20075
- const min = (numAttr(col, "min") ?? 1) - 1;
20076
- const max = (numAttr(col, "max") ?? min + 1) - 1;
20077
- const info = { min, max };
20078
- const width = numAttr(col, "width");
20079
- if (width !== void 0) info.width = width;
20080
- if (boolAttr(col, "customWidth")) info.customWidth = true;
20081
- if (boolAttr(col, "hidden")) info.hidden = true;
20082
- const style2 = numAttr(col, "style");
20083
- const styleId = style2 === void 0 ? 0 : xfMap[style2] ?? 0;
20084
- if (styleId) info.styleId = styleId;
20085
- const outline = numAttr(col, "outlineLevel");
20086
- if (outline) info.outlineLevel = outline;
20087
- if (boolAttr(col, "collapsed")) info.collapsed = true;
20088
- if (boolAttr(col, "bestFit")) info.bestFit = true;
20089
- out.push(info);
20090
- }
20091
- return out;
20092
- }
20093
- var MAIN_NS_DECL = /(?<=^<[^>]*) xmlns="http:\/\/schemas\.openxmlformats\.org\/spreadsheetml\/2006\/main"/;
20094
- function readAutoFilter(node3) {
20095
- const range2 = parseRange(att(node3, "ref") ?? "");
20096
- if (!node3 || !range2) return void 0;
20097
- const filter = { range: range2 };
20098
- const columns = [];
20099
- for (const column of xChildren(node3, "filterColumn")) {
20100
- const entry3 = {
20101
- offset: numAttr(column, "colId") ?? 0
20102
- };
20103
- const filters = xFirst(column, "filters");
20104
- if (filters) {
20105
- entry3.values = xChildren(filters, "filter").map((f) => att(f, "val") ?? "");
20106
- if (boolAttr(filters, "blank")) entry3.blank = true;
20107
- }
20108
- entry3.sourceXml = outerXml(column).replace(MAIN_NS_DECL, "");
20109
- columns.push(entry3);
20110
- }
20111
- if (columns.length) filter.columns = columns;
20112
- return filter;
20113
- }
20114
- var HEADER_FOOTER_TEXT = {
20115
- header: "oddHeader",
20116
- footer: "oddFooter",
20117
- evenHeader: "evenHeader",
20118
- evenFooter: "evenFooter",
20119
- firstHeader: "firstHeader",
20120
- firstFooter: "firstFooter"
20121
- };
20122
- var HEADER_FOOTER_FLAGS = [
20123
- "differentOddEven",
20124
- "differentFirst",
20125
- "scaleWithDoc",
20126
- "alignWithMargins"
20664
+ // xlsx/read/worksheet-children.ts
20665
+ var WORKSHEET_CHILD_ORDER = [
20666
+ "sheetPr",
20667
+ "dimension",
20668
+ "sheetViews",
20669
+ "sheetFormatPr",
20670
+ "cols",
20671
+ "sheetData",
20672
+ "sheetCalcPr",
20673
+ "sheetProtection",
20674
+ "protectedRanges",
20675
+ "scenarios",
20676
+ "autoFilter",
20677
+ "sortState",
20678
+ "dataConsolidate",
20679
+ "customSheetViews",
20680
+ "mergeCells",
20681
+ "phoneticPr",
20682
+ "conditionalFormatting",
20683
+ "dataValidations",
20684
+ "hyperlinks",
20685
+ "printOptions",
20686
+ "pageMargins",
20687
+ "pageSetup",
20688
+ "headerFooter",
20689
+ "rowBreaks",
20690
+ "colBreaks",
20691
+ "customProperties",
20692
+ "cellWatches",
20693
+ "ignoredErrors",
20694
+ "smartTags",
20695
+ "drawing",
20696
+ "legacyDrawing",
20697
+ "legacyDrawingHF",
20698
+ "drawingHF",
20699
+ "picture",
20700
+ "oleObjects",
20701
+ "controls",
20702
+ "webPublishItems",
20703
+ "tableParts",
20704
+ "extLst"
20127
20705
  ];
20128
- function readHeaderFooter(node3) {
20129
- const out = {};
20130
- for (const key2 of HEADER_FOOTER_FLAGS) {
20131
- const value3 = boolAttr(node3, key2);
20132
- if (value3 !== void 0) out[key2] = value3;
20133
- }
20134
- for (const [key2, local] of Object.entries(HEADER_FOOTER_TEXT)) {
20135
- const child3 = xFirst(node3, local);
20136
- if (child3) out[key2] = xText(child3);
20137
- }
20138
- return out;
20139
- }
20140
- var ORIENTATIONS = /* @__PURE__ */ new Set(["portrait", "landscape"]);
20141
- function readPageSetup(margins, setup, headerFooter, fitToPage) {
20142
- const page = {};
20143
- if (setup) {
20144
- if (/^(1|true)$/.test(att(setup, "useFirstPageNumber") ?? "")) {
20145
- page.firstPageNumber = numAttr(setup, "firstPageNumber") ?? 1;
20146
- }
20147
- const order = att(setup, "pageOrder");
20148
- if (order === "downThenOver" || order === "overThenDown") page.pageOrder = order;
20149
- const orientation = att(setup, "orientation");
20150
- if (orientation && ORIENTATIONS.has(orientation))
20151
- page.orientation = orientation;
20152
- const paper = numAttr(setup, "paperSize");
20153
- if (paper !== void 0) page.paperSize = paper;
20154
- const scale = numAttr(setup, "scale");
20155
- if (scale !== void 0) page.scale = scale;
20156
- }
20157
- if (fitToPage) {
20158
- page.fitToWidth = numAttr(setup, "fitToWidth") ?? 1;
20159
- page.fitToHeight = numAttr(setup, "fitToHeight") ?? 1;
20160
- }
20161
- if (margins) {
20162
- const m = (name3, fallback) => numAttr(margins, name3) ?? fallback;
20163
- page.margins = {
20164
- left: m("left", 0.7),
20165
- right: m("right", 0.7),
20166
- top: m("top", 0.75),
20167
- bottom: m("bottom", 0.75),
20168
- header: m("header", 0.3),
20169
- footer: m("footer", 0.3)
20170
- };
20171
- }
20172
- if (headerFooter) Object.assign(page, readHeaderFooter(headerFooter));
20173
- return Object.keys(page).length ? page : void 0;
20174
- }
20175
- var PROTECTION_META = /* @__PURE__ */ new Set([
20176
- "sheet",
20177
- "password",
20178
- "algorithmName",
20179
- "hashValue",
20180
- "saltValue",
20181
- "spinCount"
20182
- ]);
20183
- function readProtection(node3) {
20184
- if (!node3) return void 0;
20185
- const protection2 = { sheet: boolAttr(node3, "sheet", false) };
20186
- const password = att(node3, "password");
20187
- if (password) protection2.passwordHash = password;
20188
- const modernHash = readModernHash(node3);
20189
- if (modernHash) protection2.modernHash = modernHash;
20190
- const allow = [];
20191
- for (const attribute4 of Array.from(node3.attributes)) {
20192
- if (PROTECTION_META.has(attribute4.name)) continue;
20193
- if (attribute4.value === "0" || attribute4.value === "false") allow.push(attribute4.name);
20194
- }
20195
- if (allow.length) protection2.allow = allow.sort();
20196
- return protection2;
20197
- }
20198
20706
 
20199
20707
  // xlsx/read/conditional.ts
20200
20708
  var CFVO_TYPES = /* @__PURE__ */ new Set(["min", "max", "num", "percent", "percentile", "formula"]);
@@ -23570,9 +24078,205 @@ function readSlicerFrame(content2, anchor, sourceXml) {
23570
24078
  return void 0;
23571
24079
  }
23572
24080
 
23573
- // xlsx/read/drawing.ts
24081
+ // xlsx/read/form-control.ts
24082
+ var TYPES2 = {
24083
+ checkbox: "checkbox",
24084
+ radio: "radio",
24085
+ drop: "dropdown",
24086
+ list: "list",
24087
+ button: "button",
24088
+ spin: "spin",
24089
+ scroll: "scroll",
24090
+ gbox: "groupBox",
24091
+ label: "label",
24092
+ edit: "edit"
24093
+ };
24094
+ function readFormControlFrame(alternate, anchorOf) {
24095
+ const choice2 = elements(alternate).find((node3) => node3.localName === "Choice");
24096
+ const anchorEl = choice2 ? elements(choice2).find((node3) => node3.localName?.endsWith("Anchor")) : void 0;
24097
+ if (!anchorEl) return void 0;
24098
+ const shape = elements(anchorEl).find((node3) => node3.localName === "sp");
24099
+ const nv = first(shape, "nvSpPr", NS.xdr);
24100
+ const cNvPr = first(nv, "cNvPr", NS.xdr);
24101
+ const spid = [...cNvPr?.getElementsByTagName("*") ?? []].find(
24102
+ (node3) => node3.localName === "compatExt"
24103
+ );
24104
+ if (!spid) return void 0;
24105
+ const shapeId2 = Number(att(cNvPr, "id"));
24106
+ if (!Number.isFinite(shapeId2)) return void 0;
24107
+ const name3 = att(cNvPr, "name");
24108
+ return {
24109
+ kind: "formControl",
24110
+ anchor: anchorOf(anchorEl),
24111
+ shapeId: shapeId2,
24112
+ controlType: "other",
24113
+ ...name3 ? { name: name3 } : {},
24114
+ sourceXml: selfContainedXml(alternate)
24115
+ };
24116
+ }
24117
+ var num = (value3) => {
24118
+ if (value3 === void 0 || value3 === "") return void 0;
24119
+ const parsed = Number(value3);
24120
+ return Number.isFinite(parsed) ? parsed : void 0;
24121
+ };
24122
+ function readProps(control, xml) {
24123
+ const props = parseXml(xml, { label: "XLSX form control" }).documentElement;
24124
+ control.controlType = TYPES2[(att(props, "objectType") ?? "").toLowerCase()] ?? "other";
24125
+ const link = att(props, "fmlaLink");
24126
+ if (link) control.linkedCell = link;
24127
+ const range2 = att(props, "fmlaRange");
24128
+ if (range2) control.listRange = range2;
24129
+ if (control.controlType === "checkbox" || control.controlType === "radio") {
24130
+ const checked = att(props, "checked");
24131
+ control.checked = checked === "Checked" ? "checked" : checked === "Mixed" ? "mixed" : "unchecked";
24132
+ }
24133
+ if (att(props, "firstButton") === "1") control.firstButton = true;
24134
+ for (const [key2, attribute4] of [
24135
+ ["selected", "sel"],
24136
+ ["value", "val"],
24137
+ ["min", "min"],
24138
+ ["max", "max"],
24139
+ ["step", "inc"],
24140
+ ["page", "page"]
24141
+ ]) {
24142
+ const value3 = num(att(props, attribute4));
24143
+ if (value3 !== void 0) control[key2] = value3;
24144
+ }
24145
+ if (att(props, "horiz") === "1") control.horizontal = true;
24146
+ const style2 = att(props, "dropStyle");
24147
+ if (style2) control.dropStyle = style2;
24148
+ }
24149
+ var entities = {
24150
+ amp: "&",
24151
+ lt: "<",
24152
+ gt: ">",
24153
+ quot: '"',
24154
+ apos: "'",
24155
+ nbsp: " "
24156
+ };
24157
+ function vmlCaption(vml, shapeId2) {
24158
+ const start = vml.indexOf(`id="_x0000_s${shapeId2}"`);
24159
+ if (start < 0) return void 0;
24160
+ const end = vml.indexOf("</v:shape>", start);
24161
+ const shape = vml.slice(start, end < 0 ? void 0 : end);
24162
+ const box5 = /<v:textbox[^>]*>([\s\S]*?)<\/v:textbox>/.exec(shape)?.[1];
24163
+ if (!box5) return void 0;
24164
+ const text7 = box5.replace(/<br\s*\/?>/gi, "\n").replace(/<[^>]*>/g, "").replace(/&(#x?[0-9a-f]+|\w+);/gi, (match, code) => {
24165
+ if (code.startsWith("#")) {
24166
+ const value3 = code[1]?.toLowerCase() === "x" ? parseInt(code.slice(2), 16) : Number(code.slice(1));
24167
+ return Number.isFinite(value3) ? String.fromCodePoint(value3) : match;
24168
+ }
24169
+ return entities[code.toLowerCase()] ?? match;
24170
+ }).replace(/\s+/g, " ").trim();
24171
+ return text7 || void 0;
24172
+ }
24173
+ function attachFormControls(source, sheetPart, root2, sheet, legacyDrawing) {
24174
+ const controls3 = sheet.drawings.filter(
24175
+ (object) => object.kind === "formControl"
24176
+ );
24177
+ if (!controls3.length) return;
24178
+ const rels = source.rels(sheetPart);
24179
+ const parts = /* @__PURE__ */ new Map();
24180
+ for (const control of Array.from(root2.getElementsByTagNameNS(NS.x, "control"))) {
24181
+ const shapeId2 = Number(att(control, "shapeId"));
24182
+ const rel = rels.get(relAttr(control, "id") ?? "");
24183
+ const target2 = rel ? source.target(sheetPart, rel) : void 0;
24184
+ if (target2) parts.set(shapeId2, target2);
24185
+ }
24186
+ const vmlRel = legacyDrawing ? rels.get(relAttr(legacyDrawing, "id") ?? "") : void 0;
24187
+ const vmlPart = vmlRel ? source.target(sheetPart, vmlRel) : void 0;
24188
+ const vml = vmlPart ? source.text(vmlPart) : void 0;
24189
+ for (const control of controls3) {
24190
+ const part = parts.get(control.shapeId);
24191
+ const xml = part ? source.text(part) : void 0;
24192
+ if (part && xml) {
24193
+ control.partName = part;
24194
+ try {
24195
+ readProps(control, xml);
24196
+ } catch {
24197
+ control.controlType = "other";
24198
+ }
24199
+ }
24200
+ const caption = vml ? vmlCaption(vml, control.shapeId) : void 0;
24201
+ if (caption) control.caption = caption;
24202
+ }
24203
+ }
24204
+
24205
+ // xlsx/read/shape.ts
23574
24206
  var xdr = (parent, local) => first(parent, local, NS.xdr);
23575
- var int2 = (parent, local) => Math.round(Number(xdr(parent, local)?.textContent ?? 0)) || 0;
24207
+ function styleRef2(style2, name3) {
24208
+ const ref = first(style2, name3, NS.a);
24209
+ if (!ref) return void 0;
24210
+ const idx = Number(att(ref, "idx") ?? 0);
24211
+ const color2 = parseDrawingColorIn(ref);
24212
+ return { idx: Number.isFinite(idx) ? idx : 0, ...color2 ? { color: color2 } : {} };
24213
+ }
24214
+ function readStyle(style2) {
24215
+ if (!style2) return void 0;
24216
+ const fill = styleRef2(style2, "fillRef");
24217
+ const line2 = styleRef2(style2, "lnRef");
24218
+ const fontColor = parseDrawingColorIn(first(style2, "fontRef", NS.a));
24219
+ return {
24220
+ ...fill ? { fill } : {},
24221
+ ...line2 ? { line: line2 } : {},
24222
+ ...fontColor ? { font: { color: fontColor } } : {}
24223
+ };
24224
+ }
24225
+ function readShapeNode(element2) {
24226
+ const local = element2.localName;
24227
+ if (local !== "sp" && local !== "cxnSp" && local !== "grpSp") return void 0;
24228
+ const isGroup = local === "grpSp";
24229
+ const nv = elements(element2).find((node4) => node4.localName?.startsWith("nv"));
24230
+ const cNvPr = xdr(nv, "cNvPr");
24231
+ const spPr = xdr(element2, isGroup ? "grpSpPr" : "spPr");
24232
+ const xfrm = first(spPr, "xfrm", NS.a);
24233
+ const transform2 = parseTransform(xfrm);
24234
+ const geometry = isGroup ? { geometry: "group" } : parseDrawingGeometry(spPr);
24235
+ const node3 = {
24236
+ kind: isGroup ? "group" : local === "cxnSp" ? "connector" : "shape",
24237
+ frame: transform2?.frame ?? { x: 0, y: 0, width: 0, height: 0 },
24238
+ geometry: geometry.geometry
24239
+ };
24240
+ const name3 = att(cNvPr, "name");
24241
+ if (name3) node3.name = name3;
24242
+ if (att(xdr(nv, "cNvSpPr"), "txBox") === "1") node3.textBox = true;
24243
+ if (transform2?.rotation) node3.rotation = transform2.rotation;
24244
+ if (transform2?.flipHorizontal) node3.flipH = true;
24245
+ if (transform2?.flipVertical) node3.flipV = true;
24246
+ if ("adjustments" in geometry && geometry.adjustments) node3.adjustments = geometry.adjustments;
24247
+ if ("paths" in geometry && geometry.paths) node3.paths = geometry.paths;
24248
+ if (!isGroup) {
24249
+ const fill = parseDrawingFill(spPr);
24250
+ if (fill) node3.fill = fill;
24251
+ const line2 = parseDrawingLine(first(spPr, "ln", NS.a));
24252
+ if (line2) node3.line = line2;
24253
+ const style2 = readStyle(xdr(element2, "style"));
24254
+ if (style2) node3.style = style2;
24255
+ const text7 = parseDrawingTextBody(xdr(element2, "txBody"));
24256
+ if (text7?.text) node3.text = text7;
24257
+ return node3;
24258
+ }
24259
+ const childFrame = parseFrameOf(first(xfrm, "chOff", NS.a), first(xfrm, "chExt", NS.a));
24260
+ if (childFrame) node3.childFrame = childFrame;
24261
+ node3.children = elements(element2).flatMap((child3) => {
24262
+ const read = readShapeNode(child3);
24263
+ return read ? [read] : [];
24264
+ });
24265
+ return node3;
24266
+ }
24267
+ function parseFrameOf(off, ext) {
24268
+ if (!off || !ext) return void 0;
24269
+ return {
24270
+ x: Number(att(off, "x") ?? 0),
24271
+ y: Number(att(off, "y") ?? 0),
24272
+ width: Number(att(ext, "cx") ?? 0),
24273
+ height: Number(att(ext, "cy") ?? 0)
24274
+ };
24275
+ }
24276
+
24277
+ // xlsx/read/drawing.ts
24278
+ var xdr2 = (parent, local) => first(parent, local, NS.xdr);
24279
+ var int2 = (parent, local) => Math.round(Number(xdr2(parent, local)?.textContent ?? 0)) || 0;
23576
24280
  function marker(node3) {
23577
24281
  return {
23578
24282
  col: int2(node3, "col"),
@@ -23583,7 +24287,7 @@ function marker(node3) {
23583
24287
  }
23584
24288
  function readAnchor(anchor) {
23585
24289
  if (anchor.localName === "absoluteAnchor") {
23586
- const pos = xdr(anchor, "pos");
24290
+ const pos = xdr2(anchor, "pos");
23587
24291
  const result3 = {
23588
24292
  from: {
23589
24293
  row: 0,
@@ -23592,26 +24296,26 @@ function readAnchor(anchor) {
23592
24296
  rowOffset: Number(att(pos, "y") ?? 0)
23593
24297
  }
23594
24298
  };
23595
- const ext2 = xdr(anchor, "ext");
24299
+ const ext2 = xdr2(anchor, "ext");
23596
24300
  if (ext2) result3.ext = { cx: Number(att(ext2, "cx") ?? 0), cy: Number(att(ext2, "cy") ?? 0) };
23597
24301
  return result3;
23598
24302
  }
23599
- const result2 = { from: marker(xdr(anchor, "from")) };
23600
- const to = xdr(anchor, "to");
24303
+ const result2 = { from: marker(xdr2(anchor, "from")) };
24304
+ const to = xdr2(anchor, "to");
23601
24305
  if (to) result2.to = marker(to);
23602
- const ext = xdr(anchor, "ext");
24306
+ const ext = xdr2(anchor, "ext");
23603
24307
  if (ext) result2.ext = { cx: Number(att(ext, "cx") ?? 0), cy: Number(att(ext, "cy") ?? 0) };
23604
24308
  return result2;
23605
24309
  }
23606
24310
  var ANCHOR_PARTS = /* @__PURE__ */ new Set(["from", "to", "ext", "pos", "clientData"]);
23607
24311
  function nonVisual(content2) {
23608
24312
  const nv = elements(content2).find((node3) => node3.localName?.startsWith("nv"));
23609
- return xdr(nv, "cNvPr");
24313
+ return xdr2(nv, "cNvPr");
23610
24314
  }
23611
24315
  function describe(content2) {
23612
24316
  switch (content2.localName) {
23613
24317
  case "sp":
23614
- return xdr(content2, "nvSpPr") && att(xdr(xdr(content2, "nvSpPr"), "cNvSpPr"), "txBox") === "1" ? "text box" : "shape";
24318
+ return xdr2(content2, "nvSpPr") && att(xdr2(xdr2(content2, "nvSpPr"), "cNvSpPr"), "txBox") === "1" ? "text box" : "shape";
23615
24319
  case "grpSp":
23616
24320
  return "group";
23617
24321
  case "cxnSp":
@@ -23631,6 +24335,11 @@ function parseDrawing(source, partName, warn) {
23631
24335
  const rels = source.rels(partName);
23632
24336
  const out = [];
23633
24337
  for (const anchorEl of elements(root2)) {
24338
+ if (anchorEl.localName === "AlternateContent") {
24339
+ const control = readFormControlFrame(anchorEl, readAnchor);
24340
+ if (control) out.push(control);
24341
+ continue;
24342
+ }
23634
24343
  if (!["twoCellAnchor", "oneCellAnchor", "absoluteAnchor"].includes(anchorEl.localName ?? ""))
23635
24344
  continue;
23636
24345
  const anchor = readAnchor(anchorEl);
@@ -23645,7 +24354,7 @@ function parseDrawing(source, partName, warn) {
23645
24354
  const cNvPr = nonVisual(content2);
23646
24355
  const name3 = att(cNvPr, "name");
23647
24356
  if (content2.localName === "pic") {
23648
- const blipFill = xdr(content2, "blipFill");
24357
+ const blipFill = xdr2(content2, "blipFill");
23649
24358
  const blip = first(blipFill, "blip", NS.a);
23650
24359
  const rel = rels.get(relAttr(blip, "embed") ?? "");
23651
24360
  const target2 = rel ? source.target(partName, rel) : void 0;
@@ -23720,11 +24429,50 @@ function parseDrawing(source, partName, warn) {
23720
24429
  continue;
23721
24430
  }
23722
24431
  }
23723
- out.push(unsupported4(describe(content2)));
24432
+ const shape = readShapeNode(content2);
24433
+ out.push({ ...unsupported4(describe(content2)), ...shape ? { shape } : {} });
23724
24434
  }
23725
24435
  return out;
23726
24436
  }
23727
24437
 
24438
+ // xlsx/read/header-footer-images.ts
24439
+ var UNIT_PT = { pt: 1, in: 72, cm: 72 / 2.54, mm: 72 / 25.4, px: 0.75 };
24440
+ function styleLength(style2, property2) {
24441
+ const match = new RegExp(
24442
+ `(?:^|[;\\s])${property2}\\s*:\\s*([\\d.]+)\\s*(pt|in|cm|mm|px)?`,
24443
+ "i"
24444
+ ).exec(style2);
24445
+ return match ? Number(match[1]) * (UNIT_PT[(match[2] ?? "pt").toLowerCase()] ?? 1) : 0;
24446
+ }
24447
+ function readHeaderFooterImages(source, sheetPart, legacyHF) {
24448
+ if (!legacyHF) return void 0;
24449
+ const rel = source.rels(sheetPart).get(relAttr(legacyHF, "id") ?? "");
24450
+ const vmlPart = rel ? source.target(sheetPart, rel) : void 0;
24451
+ const vml = vmlPart ? source.text(vmlPart) : void 0;
24452
+ if (!vmlPart || !vml) return void 0;
24453
+ const rels = source.rels(vmlPart);
24454
+ const images = {};
24455
+ for (const match of vml.matchAll(/<v:shape\b([^>]*)>([\s\S]*?)<\/v:shape>/g)) {
24456
+ const id3 = /\bid="([^"]+)"/.exec(match[1] ?? "")?.[1];
24457
+ const style2 = /style=(?:'([^']*)'|"([^"]*)")/.exec(match[1] ?? "");
24458
+ const data = /<v:imagedata\b([^>]*)>/.exec(match[2] ?? "")?.[1];
24459
+ const relId = /\bo:relid="([^"]+)"/.exec(data ?? "")?.[1];
24460
+ const imageRel = relId ? rels.get(relId) : void 0;
24461
+ const partName = imageRel ? source.target(vmlPart, imageRel) : void 0;
24462
+ if (!id3 || !partName || !source.has(partName)) continue;
24463
+ const css = style2?.[1] ?? style2?.[2] ?? "";
24464
+ const title = /\bo:title="([^"]*)"/.exec(data ?? "")?.[1];
24465
+ images[id3] = {
24466
+ partName,
24467
+ contentType: source.contentType(partName) ?? "application/octet-stream",
24468
+ widthPt: styleLength(css, "width"),
24469
+ heightPt: styleLength(css, "height"),
24470
+ ...title ? { title } : {}
24471
+ };
24472
+ }
24473
+ return Object.keys(images).length ? images : void 0;
24474
+ }
24475
+
23728
24476
  // xlsx/read/dates.ts
23729
24477
  var DAY_MS2 = 864e5;
23730
24478
  var EPOCH_19003 = Date.UTC(1899, 11, 30);
@@ -23866,6 +24614,8 @@ function readRowInfo(ctx, rowEl) {
23866
24614
  const outline = numAttr(rowEl, "outlineLevel");
23867
24615
  if (outline) info.outlineLevel = outline;
23868
24616
  if (boolAttr(rowEl, "collapsed")) info.collapsed = true;
24617
+ if (boolAttr(rowEl, "thickTop")) info.thickTop = true;
24618
+ if (boolAttr(rowEl, "thickBot")) info.thickBot = true;
23869
24619
  return Object.keys(info).length ? info : void 0;
23870
24620
  }
23871
24621
  function readSheetData(ctx, rows, sheet) {
@@ -23978,15 +24728,6 @@ function readScenarios(node3) {
23978
24728
  return set;
23979
24729
  }
23980
24730
 
23981
- // xlsx/read/print-options.ts
23982
- var KEYS = ["gridLines", "headings", "horizontalCentered", "verticalCentered"];
23983
- function readPrintOptions(node3) {
23984
- if (!node3) return void 0;
23985
- const out = {};
23986
- for (const key2 of KEYS) if (boolAttr(node3, key2)) out[key2] = true;
23987
- return Object.keys(out).length ? out : void 0;
23988
- }
23989
-
23990
24731
  // xlsx/read/tables.ts
23991
24732
  function parseTable(xml, partName) {
23992
24733
  const root2 = parseXml(xml, { label: "XLSX table" }).documentElement;
@@ -24077,8 +24818,14 @@ var MODELLED = /* @__PURE__ */ new Set([
24077
24818
  "drawing",
24078
24819
  "legacyDrawing",
24079
24820
  "tableParts",
24080
- "scenarios"
24821
+ "scenarios",
24822
+ "customSheetViews"
24081
24823
  ]);
24824
+ function reportUnplaceable(ctx, sheet, element2) {
24825
+ ctx.warn(
24826
+ `Sheet "${sheet}": the element "${element2}" is not part of the worksheet schema and is dropped on save.`
24827
+ );
24828
+ }
24082
24829
  function keep(sheet, key2, xml) {
24083
24830
  const list2 = sheet.preserved.get(key2);
24084
24831
  if (list2) list2.push(xml);
@@ -24160,9 +24907,15 @@ function readWorksheet(ctx, partName, name3, sheetId5, xml, rows) {
24160
24907
  else if (!byName.has(local)) byName.set(local, node3);
24161
24908
  if (SNAPSHOT_ELEMENTS.includes(local))
24162
24909
  keep(sheet, snapshotKey(local), outerXml(node3));
24163
- else if (local === "AlternateContent")
24164
- keep(sheet, alternateContentName(node3) ?? local, selfContainedXml(node3));
24165
- else if (!MODELLED.has(local)) keep(sheet, local, selfContainedXml(node3));
24910
+ else if (local === "AlternateContent") {
24911
+ const inner = alternateContentName(node3);
24912
+ if (!WORKSHEET_CHILD_ORDER.includes(inner ?? local))
24913
+ reportUnplaceable(ctx, name3, inner ?? local);
24914
+ keep(sheet, inner ?? local, selfContainedXml(node3));
24915
+ } else if (!MODELLED.has(local)) {
24916
+ if (!WORKSHEET_CHILD_ORDER.includes(local)) reportUnplaceable(ctx, name3, local);
24917
+ keep(sheet, local, selfContainedXml(node3));
24918
+ }
24166
24919
  }
24167
24920
  const sheetPr = byName.get("sheetPr");
24168
24921
  const tabColor = readTabColor(sheetPr, ctx.palette);
@@ -24198,6 +24951,10 @@ function readWorksheet(ctx, partName, name3, sheetId5, xml, rows) {
24198
24951
  readFitToPage(sheetPr)
24199
24952
  );
24200
24953
  if (page) sheet.pageSetup = page;
24954
+ const customViews = byName.get("customSheetViews");
24955
+ if (customViews) sheet.customViews = readCustomSheetViews(customViews);
24956
+ const hfImages = readHeaderFooterImages(ctx.source, partName, byName.get("legacyDrawingHF"));
24957
+ if (hfImages) sheet.headerFooterImages = hfImages;
24201
24958
  const printOptions = readPrintOptions(byName.get("printOptions"));
24202
24959
  if (printOptions) sheet.printOptions = printOptions;
24203
24960
  const drawing2 = byName.get("drawing");
@@ -24205,6 +24962,7 @@ function readWorksheet(ctx, partName, name3, sheetId5, xml, rows) {
24205
24962
  const rel = ctx.source.rels(partName).get(relAttr(drawing2, "id") ?? "");
24206
24963
  const target2 = rel ? ctx.source.target(partName, rel) : void 0;
24207
24964
  if (target2) sheet.drawings = parseDrawing(ctx.source, target2, (m) => ctx.warn(m));
24965
+ attachFormControls(ctx.source, partName, root2, sheet, byName.get("legacyDrawing"));
24208
24966
  }
24209
24967
  readTables(ctx, partName, byName.get("tableParts"), sheet);
24210
24968
  readComments(ctx, partName, sheet);
@@ -24313,6 +25071,7 @@ async function loadXlsx(input, options2 = {}) {
24313
25071
  if (book.workbookPasswordHash) workbook.workbookPasswordHash = book.workbookPasswordHash;
24314
25072
  if (book.workbookModernHash) workbook.workbookModernHash = book.workbookModernHash;
24315
25073
  if (book.oleSize) workbook.oleSize = book.oleSize;
25074
+ if (book.customViews) workbook.customViews = book.customViews;
24316
25075
  if (book.calcMode) workbook.calcMode = book.calcMode;
24317
25076
  if (book.iterate) workbook.iterate = book.iterate;
24318
25077
  if (signatures.hasSignatures)
@@ -26059,9 +26818,9 @@ function sampleArc(start, rxIn, ryIn, xAxisRotationDeg, largeArcFlag, sweepFlag,
26059
26818
  ry *= scale;
26060
26819
  }
26061
26820
  const sign2 = largeArcFlag !== sweepFlag ? 1 : -1;
26062
- const num = rx * rx * ry * ry - rx * rx * y1p * y1p - ry * ry * x1p * x1p;
26821
+ const num2 = rx * rx * ry * ry - rx * rx * y1p * y1p - ry * ry * x1p * x1p;
26063
26822
  const den = rx * rx * y1p * y1p + ry * ry * x1p * x1p;
26064
- const coef = sign2 * Math.sqrt(Math.max(0, num / den));
26823
+ const coef = sign2 * Math.sqrt(Math.max(0, num2 / den));
26065
26824
  const cxp = coef * (rx * y1p) / ry;
26066
26825
  const cyp = coef * -(ry * x1p) / rx;
26067
26826
  const cx = cosPhi * cxp - sinPhi * cyp + (start.x + end.x) / 2;
@@ -33083,8 +33842,13 @@ var VISIO_VISIBILITY_LIMITS = Object.freeze({
33083
33842
  });
33084
33843
 
33085
33844
  // visio/edit-formatting-scope.ts
33086
- async function assertFormattingDependencies(pkg, pagePaths, roots2, pageId2, shape, changed, check, instanceView2) {
33087
- indexCells(roots2, { check });
33845
+ async function assertFormattingDependencies(pkg, pagePaths, roots2, pageId2, shape, changed, check, instanceView2, options2 = {}) {
33846
+ for (const item2 of indexCells(roots2, { check, scope: "affected" }).values())
33847
+ if (item2.refusal && item2.pageId === pageId2)
33848
+ fail(
33849
+ "EDIT_UNKNOWN_DEPENDENCY",
33850
+ `Cannot prove ShapeSheet dependency closure: ${item2.refusal}`
33851
+ );
33088
33852
  const shapeId2 = attribute2(shape, "ID");
33089
33853
  const changedNames = new Set([...changed.keys()].map((name3) => name3.toLowerCase()));
33090
33854
  const jumpOnly = [...changedNames].every(
@@ -33139,11 +33903,17 @@ async function assertFormattingDependencies(pkg, pagePaths, roots2, pageId2, sha
33139
33903
  if (textEdit && localShapeId === shapeId2 && sourcePageId === pageId2) continue;
33140
33904
  analysis = sized;
33141
33905
  }
33906
+ if (options2.textReads && textEdit && !named2 && sourcePageId !== void 0 && textReadFormula(source))
33907
+ continue;
33142
33908
  if (named2 && analysis.dynamic) {
33143
33909
  if (mentions()) failure2();
33144
33910
  continue;
33145
33911
  }
33146
- if (analysis.dynamic || analysis.references.some(
33912
+ if (analysis.dynamic && analysis.opaque) {
33913
+ if (sourcePageId === pageId2 || mentions()) failure2();
33914
+ continue;
33915
+ }
33916
+ if (analysis.references.some(
33147
33917
  (ref) => changedNames.has(canonical2(ref.cell)) && (sourcePageId === void 0 || sourcePageId === pageId2) && (ref.shapeId === shapeId2 || ref.shapeId === void 0 && (localShapeId === shapeId2 || sourcePageId === void 0))
33148
33918
  ))
33149
33919
  failure2();
@@ -33156,6 +33926,7 @@ async function assertFormattingDependencies(pkg, pagePaths, roots2, pageId2, sha
33156
33926
  const part = await pkg.readXml(path3);
33157
33927
  const master2 = part.localName === "MasterContents";
33158
33928
  if (instanceView2 && master2) continue;
33929
+ if (master2 && !shape.hasAttribute("Master") && !shape.hasAttribute("MasterShape")) continue;
33159
33930
  inspect3(part, void 0, master2);
33160
33931
  }
33161
33932
  }
@@ -33358,7 +34129,7 @@ function masterTemplate(pkg) {
33358
34129
  return matches2.length === 1 ? matches2[0] : missing();
33359
34130
  };
33360
34131
  }
33361
- function replaceScopedPlainText(pkg, pagePaths, roots2, document, edit, check) {
34132
+ function replaceScopedPlainText(pkg, pagePaths, roots2, document, edit, check, diagnostics = []) {
33362
34133
  return replacePlainText(
33363
34134
  roots2.get(edit.pageId),
33364
34135
  document,
@@ -33372,10 +34143,20 @@ function replaceScopedPlainText(pkg, pagePaths, roots2, document, edit, check) {
33372
34143
  edit.pageId,
33373
34144
  shape,
33374
34145
  /* @__PURE__ */ new Map([["TheText", text7]]),
33375
- check
34146
+ check,
34147
+ void 0,
34148
+ { textReads: true }
33376
34149
  ),
33377
34150
  masterTemplate(pkg)
33378
- );
34151
+ ).then((changed) => {
34152
+ if (changed)
34153
+ recalculateVisioCells(
34154
+ roots2,
34155
+ [{ pageId: edit.pageId, shapeId: edit.shapeId, cell: "TheText" }],
34156
+ { check, cycles: "keep", diagnostics }
34157
+ );
34158
+ return changed;
34159
+ });
33379
34160
  }
33380
34161
 
33381
34162
  // visio/edit-instance-sheet.ts
@@ -34283,7 +35064,7 @@ function layoutConnectorShape(roots2, pageId2, shape, route, sites, check, obsta
34283
35064
 
34284
35065
  // visio/edit-stencil-connector-layout.ts
34285
35066
  var same6 = (a2, b) => Math.abs(a2 - b) <= 1e-9 * Math.max(1, Math.abs(a2), Math.abs(b));
34286
- function walkShape(box5) {
35067
+ function walkShape(box5, floating = false) {
34287
35068
  const [a2, b, c2, d, e, f] = box5.transform;
34288
35069
  const at2 = (x, y) => ({
34289
35070
  x: a2 * x + c2 * y + e,
@@ -34295,7 +35076,8 @@ function walkShape(box5) {
34295
35076
  sites: sites.map((site) => ({ point: site.point, normal: site.normal })),
34296
35077
  bounds: sites[0].box,
34297
35078
  center: at2(box5.width / 2, box5.height / 2),
34298
- corners: [at2(0, 0), at2(box5.width, 0), at2(box5.width, box5.height), at2(0, box5.height)]
35079
+ corners: [at2(0, 0), at2(box5.width, 0), at2(box5.width, box5.height), at2(0, box5.height)],
35080
+ ...floating ? { floating } : {}
34299
35081
  }
34300
35082
  };
34301
35083
  }
@@ -34516,6 +35298,11 @@ function connectionRows(shape) {
34516
35298
  }
34517
35299
  return rows;
34518
35300
  }
35301
+ function hasConnectionPoints(root2, shapeId2) {
35302
+ const target2 = topShape(root2, shapeId2);
35303
+ if (!target2) return false;
35304
+ return (stencilTemplate(target2) ? effectiveRows(target2, "Connection") : connectionRows(target2)).size > 0;
35305
+ }
34519
35306
  function glueSites(root2, end) {
34520
35307
  const box5 = glueBox(root2, end.target);
34521
35308
  if (end.point === void 0) return dynamicSites(box5);
@@ -34626,8 +35413,9 @@ function proveConnector(root2, connectorId) {
34626
35413
  const named2 = visioPointGlueTarget(source);
34627
35414
  return index2 === void 0 ? !named2 : !!named2 && named2.shapeId === target2 && named2.index === index2;
34628
35415
  };
34629
- 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.
34630
- visioGlueTriggerTarget(formula2(triggerName(end))) !== target2 && !(isStencilLine(shape) && formula2(triggerName(end)) === void 0) || !glued("X") || !glued("Y"))
35416
+ 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
35417
+ // point glue on a drawn line has none either (native-edit-families-flat-2026-10-29.json).
35418
+ visioGlueTriggerTarget(formula2(triggerName(end))) !== target2 && !(formula2(triggerName(end)) === void 0 && !local.has(triggerName(end)) && (isStencilLine(shape) || index2 !== void 0)) || !glued("X") || !glued("Y"))
34631
35419
  fail("UNSUPPORTED_GEOMETRY_EDIT", UNSUPPORTED);
34632
35420
  ends[end] = { target: target2, ...index2 === void 0 ? {} : { point: index2 } };
34633
35421
  }
@@ -34893,7 +35681,7 @@ function rerouteConnector(roots2, pageId2, glue, check, options2 = {}) {
34893
35681
  }
34894
35682
  const walk = (end) => {
34895
35683
  const target2 = glue.ends[end];
34896
- return target2 && target2.point === void 0 ? walkShape(glueBox(root2, target2.target)) : { point: sites(end)[0].point };
35684
+ return target2 && target2.point === void 0 ? walkShape(glueBox(root2, target2.target), !hasConnectionPoints(root2, target2.target)) : { point: sites(end)[0].point };
34897
35685
  };
34898
35686
  const route = options2.route ?? current;
34899
35687
  if (route === "straight" && current === "straight" && ENDS.every(
@@ -36109,7 +36897,7 @@ async function assertInstanceLayersUnlocked(pkg, pageId2, layerMember) {
36109
36897
 
36110
36898
  // visio/formula-functions.ts
36111
36899
  var DOCUMENTED = new Set(
36112
- `ABS ACOS AND ANG360 ANGLEALONGPATH ANGLETOLOC ANGLETOPAR ASIN ATAN ATAN2 BITAND BITNOT BITOR
36900
+ `ABS ACOS AND ARG ANG360 ANGLEALONGPATH ANGLETOLOC ANGLETOPAR ASIN ATAN ATAN2 BITAND BITNOT BITOR
36113
36901
  BITXOR BKGPAGENAME BLEND BLOB BLUE BOUND CALLOUTCOUNT CALLOUTTARGETREF CALLTHIS CATEGORY CEILING
36114
36902
  CELLISTHEMED CHAR COMPANY CONTAINERCOUNT CONTAINERMEMBERCOUNT CONTAINERSHEETREF COS COSH CREATOR
36115
36903
  CY DATA1 DATA2 DATA3 DATE DATETIME DATEVALUE DAY DAYOFYEAR DECIMALSEP DEFAULTEVENT DEG DEPENDSON
@@ -37376,6 +38164,7 @@ function resizeVisioShapeAtAnchor(roots2, document, edit, check, glueShapes = /*
37376
38164
  fail("UNSUPPORTED_GEOMETRY_EDIT", "Glued shapes require routing outside this subset.");
37377
38165
  const graph = indexCells(roots2, {
37378
38166
  check,
38167
+ scope: "affected",
37379
38168
  glueShapes,
37380
38169
  ...group2 ? { groupResizeShapes: group2.shapes } : {}
37381
38170
  });
@@ -37689,13 +38478,23 @@ function prepareMasterMovePins(roots2, commands, bindings, check) {
37689
38478
  }
37690
38479
  }
37691
38480
  if (result2.size) {
37692
- const indexed = indexCells(roots2, { check });
38481
+ const indexed = indexCells(roots2, { check, scope: "affected" });
37693
38482
  const pins = new Set(
37694
38483
  [...indexed.values()].filter((cell) => cell.node && result2.has(cell.node)).map(key)
37695
38484
  );
37696
- for (const cell of indexed.values())
37697
- if (charge(), cell.dependencies.some((dependency) => pins.has(dependency)))
38485
+ const pinPages = new Set(
38486
+ [...indexed.values()].filter((cell) => cell.node && result2.has(cell.node)).map((c2) => c2.pageId)
38487
+ );
38488
+ for (const cell of indexed.values()) {
38489
+ charge();
38490
+ if (cell.opaque && pinPages.has(cell.pageId))
38491
+ fail(
38492
+ "EDIT_UNSUPPORTED_DEPENDENCY",
38493
+ "A formula that may read a master rotation pin exists."
38494
+ );
38495
+ if (cell.dependencies.some((dependency) => pins.has(dependency)))
37698
38496
  fail("EDIT_UNSUPPORTED_DEPENDENCY", "A page cache depends on a master rotation pin.");
38497
+ }
37699
38498
  }
37700
38499
  return { pins: result2, dimensions: provenDimensions };
37701
38500
  }
@@ -37792,8 +38591,12 @@ function applyGeometryEdit(roots2, document, edit, check, masterMoveProof = empt
37792
38591
  if (edit.type === "delete-shape") {
37793
38592
  unlocked("LockDelete");
37794
38593
  releaseDeletedGlue(roots2, /* @__PURE__ */ new Map([[edit.pageId, /* @__PURE__ */ new Set([edit.shapeId])]]));
37795
- assertVisioShapeUnreferenced(roots2, edit.pageId, edit.shapeId, { check });
38594
+ const frozen = assertVisioShapeUnreferenced(roots2, edit.pageId, edit.shapeId, {
38595
+ check,
38596
+ freeze: true
38597
+ });
37796
38598
  shape.parentNode.removeChild(shape);
38599
+ freezeVisioCells(frozen);
37797
38600
  return [edit.pageId];
37798
38601
  }
37799
38602
  if (edit.type === "rotate-shape" || edit.type === "flip-shape") {
@@ -38731,7 +39534,7 @@ async function recalculatePageFormulas(pkg, pagesPart, pages, paths, dirty, chec
38731
39534
  }
38732
39535
 
38733
39536
  // visio/edit-page-rename.ts
38734
- var escape3 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
39537
+ var escape4 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
38735
39538
  function localCell(node3) {
38736
39539
  const row2 = node3.parentNode;
38737
39540
  const section3 = row2?.parentNode;
@@ -38760,7 +39563,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
38760
39563
  }
38761
39564
  const roots2 = await editableVisioPageRoots(pkg, pagesPart, pages, pagePaths, dirty, check);
38762
39565
  const changedCells = [];
38763
- const prefix2 = new RegExp(`Pages\\[${escape3(oldUniversal)}\\]!`, "gi");
39566
+ const prefix2 = new RegExp(`Pages\\[${escape4(oldUniversal)}\\]!`, "gi");
38764
39567
  const targetByPath = new Map([...pagePaths].map(([id3, path3]) => [path3, id3]));
38765
39568
  for (const [path3, root2] of roots2) {
38766
39569
  let changed = false;
@@ -38794,7 +39597,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
38794
39597
  if (cell) changedCells.push({ node: node3, cell });
38795
39598
  }
38796
39599
  } else if (/\bPAGENAME\s*\(/i.test(code)) {
38797
- if (target2 === pageId2 || !target2 || new RegExp(`Pages\\[${escape3(oldUniversal)}\\]!`, "i").test(code))
39600
+ if (target2 === pageId2 || !target2 || new RegExp(`Pages\\[${escape4(oldUniversal)}\\]!`, "i").test(code))
38798
39601
  fail(
38799
39602
  "EDIT_UNSUPPORTED_PAGE_NAME_FORMULA",
38800
39603
  "Complex page-name formula caches cannot be safely refreshed."
@@ -38844,7 +39647,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
38844
39647
  for (const changed of changedCells) {
38845
39648
  if (changed.node === node3) continue;
38846
39649
  const reference2 = new RegExp(
38847
- `(?:^|[^a-z0-9_.])${escape3(changed.cell)}(?:$|[^a-z0-9_.])`,
39650
+ `(?:^|[^a-z0-9_.])${escape4(changed.cell)}(?:$|[^a-z0-9_.])`,
38848
39651
  "i"
38849
39652
  );
38850
39653
  if (reference2.test(unquotedVisioFormula(formula2)))
@@ -38866,7 +39669,7 @@ async function renameVisioPage(pkg, pagesPart, pages, pagePaths, dirty, pageId2,
38866
39669
  // visio/edit-page-delete.ts
38867
39670
  var officeRel = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
38868
39671
  var pageType = "http://schemas.microsoft.com/visio/2010/relationships/page";
38869
- var escape4 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
39672
+ var escape5 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
38870
39673
  async function deleteVisioPage(pkg, pagesPart, pages, rels, types, pagePaths, parts, dirty, removed, pageId2, check) {
38871
39674
  const existing = children2(pages, "Page");
38872
39675
  const page = existing.find((node3) => attribute2(node3, "ID") === pageId2);
@@ -38875,7 +39678,7 @@ async function deleteVisioPage(pkg, pagesPart, pages, rels, types, pagePaths, pa
38875
39678
  const names = new Set(
38876
39679
  ["Name", "NameU"].map((key2) => attribute2(page, key2)).filter((value3) => !!value3)
38877
39680
  );
38878
- const reference2 = new RegExp(`Pages\\[(?:${[...names].map(escape4).join("|")})\\]!`, "i");
39681
+ const reference2 = new RegExp(`Pages\\[(?:${[...names].map(escape5).join("|")})\\]!`, "i");
38879
39682
  const documentPart2 = await related(pkg, "", "document");
38880
39683
  const roots2 = await editableVisioPageRoots(
38881
39684
  pkg,
@@ -39200,7 +40003,7 @@ function createVisioPagePart(parts, pages, pageId2, check) {
39200
40003
  }
39201
40004
 
39202
40005
  // visio/edit-page-decoration.ts
39203
- var escape5 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
40006
+ var escape6 = (value3) => value3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
39204
40007
  var name2 = (page) => attribute2(page, "NameU") ?? attribute2(page, "Name") ?? "";
39205
40008
  function largestShapeId(root2) {
39206
40009
  let largest = 0;
@@ -39216,9 +40019,9 @@ function removeDecoration(root2, pageName, kind, pageRoots, check) {
39216
40019
  ) : [];
39217
40020
  if (!targets.length) return false;
39218
40021
  const ids = targets.map((shape) => attribute2(shape, "ID") ?? "");
39219
- const local = new RegExp(`\\bSheet\\.(?:${ids.map(escape5).join("|")})!`, "i");
40022
+ const local = new RegExp(`\\bSheet\\.(?:${ids.map(escape6).join("|")})!`, "i");
39220
40023
  const remote = new RegExp(
39221
- `Pages\\[${escape5(pageName)}\\]!Sheet\\.(?:${ids.map(escape5).join("|")})!`,
40024
+ `Pages\\[${escape6(pageName)}\\]!Sheet\\.(?:${ids.map(escape6).join("|")})!`,
39222
40025
  "i"
39223
40026
  );
39224
40027
  for (const connect of children2(root2, "Connects").flatMap((node3) => children2(node3, "Connect")))
@@ -40052,17 +40855,117 @@ async function formatTarget(pkg, pagePaths, roots2, document, edit, check, insta
40052
40855
  return true;
40053
40856
  }
40054
40857
 
40858
+ // visio/edit-duplicate-line.ts
40859
+ var ENDS2 = ["BeginX", "BeginY", "EndX", "EndY"];
40860
+ var connects = (root2) => children2(root2, "Connects").flatMap((container) => children2(container, "Connect"));
40861
+ var gluedTargets = (root2, id3) => connects(root2).filter((row2) => attribute2(row2, "FromSheet") === id3).map((row2) => attribute2(row2, "ToSheet") ?? "");
40862
+ function assertGlueDroppable(root2, id3, copied, code = "UNSUPPORTED_DUPLICATE") {
40863
+ if (gluedTargets(root2, id3).some((target2) => copied.has(target2)))
40864
+ fail(code, "A glued connector cannot be copied together with a shape it is glued to yet.");
40865
+ }
40866
+ function assertEndFormulas(read, code) {
40867
+ for (const name3 of ENDS2) {
40868
+ const formula2 = executableCellFormula(attribute2(read(name3), "F"));
40869
+ if (formula2 && !isNativeGlueCell(name3, formula2))
40870
+ fail(code, `${name3} of the line holds a formula that is not native glue.`);
40871
+ }
40872
+ }
40873
+ var isLineSheet2 = (shape) => ENDS2.some((name3) => cells(shape).has(name3));
40874
+ function planLineCopy(shape, code = "UNSUPPORTED_DUPLICATE") {
40875
+ proveLocalLine(shape);
40876
+ assertEndFormulas((name3) => cells(shape).get(name3), code);
40877
+ const local = cells(shape);
40878
+ return { x: numeric(local.get("PinX")), y: numeric(local.get("PinY")) };
40879
+ }
40880
+ var shift2 = (node3, delta, name3) => {
40881
+ if (!node3) fail("UNSUPPORTED_DUPLICATE", `The line has no local ${name3}.`);
40882
+ const value3 = numeric(node3);
40883
+ node3.setAttribute("V", String(Object.is(value3 + delta, -0) ? 0 : value3 + delta));
40884
+ node3.removeAttribute("E");
40885
+ };
40886
+ function finishLineCopy(shape, dx, dy) {
40887
+ const local = cells(shape);
40888
+ for (const name3 of ENDS2) {
40889
+ const node3 = local.get(name3);
40890
+ const formula2 = executableCellFormula(attribute2(node3, "F"));
40891
+ if (formula2 && isNativeGlueCell(name3, formula2)) node3.removeAttribute("F");
40892
+ shift2(node3, name3.endsWith("X") ? dx : dy, name3);
40893
+ }
40894
+ shift2(local.get("PinX"), dx, "PinX");
40895
+ shift2(local.get("PinY"), dy, "PinY");
40896
+ }
40897
+ var isStencilConnector2 = (target2) => ENDS2.some((name3) => instanceCell(target2, name3));
40898
+ function planConnectorCopy(target2, code = "UNSUPPORTED_DUPLICATE") {
40899
+ const local = cells(target2.instance);
40900
+ for (const name3 of [...ENDS2, "PinX", "PinY"]) {
40901
+ const node3 = local.get(name3);
40902
+ if (!node3?.hasAttribute("V") || node3.hasAttribute("E"))
40903
+ fail(code, `The stencil connector has no usable local ${name3}.`);
40904
+ numeric(node3);
40905
+ }
40906
+ assertEndFormulas((name3) => local.get(name3), code);
40907
+ return { x: numeric(local.get("PinX")), y: numeric(local.get("PinY")) };
40908
+ }
40909
+ function finishConnectorCopy(shape, id3, dx, dy) {
40910
+ const local = cells(shape);
40911
+ for (const name3 of ENDS2) shift2(local.get(name3), name3.endsWith("X") ? dx : dy, name3);
40912
+ shift2(local.get("PinX"), dx, "PinX");
40913
+ shift2(local.get("PinY"), dy, "PinY");
40914
+ for (const name3 of ["BegTrigger", "EndTrigger"]) {
40915
+ const node3 = local.get(name3);
40916
+ if (!node3) continue;
40917
+ node3.setAttribute("F", visioGlueTrigger(id3));
40918
+ node3.setAttribute("V", "1");
40919
+ }
40920
+ }
40921
+ var CLEARANCE = 0.25;
40922
+ var endsBox = (shape, dx, dy) => {
40923
+ const local = cells(shape);
40924
+ const x = [numeric(local.get("BeginX")) + dx, numeric(local.get("EndX")) + dx];
40925
+ const y = [numeric(local.get("BeginY")) + dy, numeric(local.get("EndY")) + dy];
40926
+ return {
40927
+ minX: Math.min(...x) - CLEARANCE,
40928
+ maxX: Math.max(...x) + CLEARANCE,
40929
+ minY: Math.min(...y) - CLEARANCE,
40930
+ maxY: Math.max(...y) + CLEARANCE
40931
+ };
40932
+ };
40933
+ function assertConnectorCopyApart(root2, copies, dx, dy, code = "UNSUPPORTED_DUPLICATE") {
40934
+ const boxes = copies.map((shape) => endsBox(shape, dx, dy));
40935
+ for (const container of children2(root2, "Shapes"))
40936
+ for (const other of children2(container, "Shape")) {
40937
+ const local = cells(other);
40938
+ const formula2 = executableCellFormula(attribute2(local.get("BeginX"), "F")) ?? "";
40939
+ if (!/^_WALKGLUE\(/i.test(formula2)) continue;
40940
+ const box5 = endsBox(other, 0, 0);
40941
+ for (const copy8 of boxes)
40942
+ if (copy8.minX <= box5.maxX && box5.minX <= copy8.maxX && copy8.minY <= box5.maxY && box5.minY <= copy8.maxY)
40943
+ fail(
40944
+ code,
40945
+ "The copy of a connector would meet another connector, which Visio lays out again."
40946
+ );
40947
+ }
40948
+ }
40949
+
40055
40950
  // visio/edit-instance-duplicate.ts
40056
- async function planInstanceCopy(pkg, pageId2, sourceRoot, target2, offsetX, offsetY, code = "UNSUPPORTED_DUPLICATE") {
40951
+ async function planInstanceCopy(pkg, pageId2, sourceRoot, target2, offsetX, offsetY, code = "UNSUPPORTED_DUPLICATE", allowConnector = code === "UNSUPPORTED_DUPLICATE") {
40057
40952
  const id3 = attribute2(target2.instance, "ID");
40058
- if (["BeginX", "EndX"].some((name3) => instanceCell(target2, name3)) || connectRows(sourceRoot).some((row2) => attribute2(row2, "FromSheet") === id3))
40953
+ const connector2 = allowConnector && isStencilConnector2(target2);
40954
+ if (!connector2 && (isStencilConnector2(target2) || connectRows(sourceRoot).some((row2) => attribute2(row2, "FromSheet") === id3)))
40059
40955
  fail(code, "Lines and connectors that come from a stencil cannot be copied yet.");
40060
40956
  await assertInstanceUnlocked(pkg, pageId2, target2, ["LockSelect"], "selection");
40957
+ if (connector2) {
40958
+ const pin2 = planConnectorCopy(target2, code);
40959
+ const x2 = pin2.x + offsetX, y2 = pin2.y + offsetY;
40960
+ if (Math.abs(x2) > 1e6 || Math.abs(y2) > 1e6)
40961
+ fail(code, "Duplicated pins exceed coordinate limits.");
40962
+ return { x: x2, y: y2, connector: connector2 };
40963
+ }
40061
40964
  const pin = instancePin(target2);
40062
40965
  const x = pin.x + offsetX, y = pin.y + offsetY;
40063
40966
  if (Math.abs(x) > 1e6 || Math.abs(y) > 1e6)
40064
40967
  fail(code, "Duplicated pins exceed coordinate limits.");
40065
- return { x, y };
40968
+ return { x, y, connector: connector2 };
40066
40969
  }
40067
40970
  function finishInstanceCopy(clone, template, x, y, taken, check) {
40068
40971
  const mapping = /* @__PURE__ */ new Map();
@@ -40146,7 +41049,18 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
40146
41049
  structural ||= !source || await shapeIsStructural(source, template);
40147
41050
  }
40148
41051
  await assertDuplicateScope(pkg, pagePaths, root2, newIds, check, structural);
40149
- const indexed = indexCells(detached ? /* @__PURE__ */ new Map([[sourcePageId, sourceRoot]]) : roots2, { check });
41052
+ const glueTargets = new Set(
41053
+ children2(sourceRoot, "Connects").flatMap(
41054
+ (container2) => children2(container2, "Connect").map((row2) => attribute2(row2, "ToSheet"))
41055
+ )
41056
+ );
41057
+ const indexed = indexCells(detached ? /* @__PURE__ */ new Map([[sourcePageId, sourceRoot]]) : roots2, {
41058
+ check,
41059
+ scope: "affected",
41060
+ glueShapes: new Set(
41061
+ pageShapes(sourceRoot).filter((shape) => glueTargets.has(attribute2(shape, "ID")))
41062
+ )
41063
+ });
40150
41064
  const evaluate = createVisioCellEvaluator(indexed, { check }, true);
40151
41065
  const containers = children2(root2, "Shapes");
40152
41066
  if (containers.length > 1) fail("INVALID_SHAPE_ID", "Duplicate Shapes containers.");
@@ -40160,6 +41074,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
40160
41074
  if (value3 !== void 0) occupied.add(value3.toLowerCase());
40161
41075
  }
40162
41076
  const plans = [];
41077
+ const copied = new Set(edit.copies.map((copy8) => copy8.shapeId));
40163
41078
  let cloneNodes = 0, cloneCharacters = buildXml(root2).length;
40164
41079
  const size3 = (source) => {
40165
41080
  cloneNodes += source.getElementsByTagName("*").length + 1;
@@ -40176,6 +41091,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
40176
41091
  "UNSUPPORTED_DUPLICATE"
40177
41092
  );
40178
41093
  if (stencil) {
41094
+ assertGlueDroppable(sourceRoot, copy8.shapeId, copied);
40179
41095
  const pin = await planInstanceCopy(
40180
41096
  pkg,
40181
41097
  edit.pageId,
@@ -40188,18 +41104,33 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
40188
41104
  plans.push({
40189
41105
  source: stencil.instance,
40190
41106
  id: copy8.newShapeId,
40191
- ...pin,
41107
+ x: pin.x,
41108
+ y: pin.y,
41109
+ ...pin.connector ? { connector: true } : {},
40192
41110
  template: stencil.template
40193
41111
  });
40194
41112
  continue;
40195
41113
  }
41114
+ const line2 = pageShapes(sourceRoot).find((shape) => attribute2(shape, "ID") === copy8.shapeId);
41115
+ if (line2 && !line2.hasAttribute("Master") && isLineSheet2(line2)) {
41116
+ assertCloneLeaf(line2);
41117
+ assertUnlayeredShape(line2, document);
41118
+ assertShapeLocks(line2, document, ["LockSelect"]);
41119
+ assertGlueDroppable(sourceRoot, copy8.shapeId, copied);
41120
+ const pin = planLineCopy(line2);
41121
+ if (Math.abs(pin.x + edit.offsetX) > 1e6 || Math.abs(pin.y + edit.offsetY) > 1e6)
41122
+ fail("UNSUPPORTED_DUPLICATE", "Duplicated pins exceed coordinate limits.");
41123
+ size3(line2);
41124
+ plans.push({ source: line2, id: copy8.newShapeId, x: pin.x, y: pin.y, line: true });
41125
+ continue;
41126
+ }
40196
41127
  const source = admitted(sourceRoot, copy8.shapeId);
40197
41128
  assertCloneLeaf(source);
40198
41129
  assertUnlayeredShape(source, document);
40199
41130
  assertShapeLocks(source, document, ["LockSelect"]);
40200
- for (const connects of children2(sourceRoot, "Connects"))
40201
- for (const connection of children2(connects, "Connect"))
40202
- if (["FromSheet", "ToSheet"].some((name3) => attribute2(connection, name3) === copy8.shapeId))
41131
+ for (const connects2 of children2(sourceRoot, "Connects"))
41132
+ for (const connection of children2(connects2, "Connect"))
41133
+ if (attribute2(connection, "FromSheet") === copy8.shapeId)
40203
41134
  fail("UNSUPPORTED_DUPLICATE", "Glued shapes cannot be duplicated safely.");
40204
41135
  const x = numeric(formattingCell(source, "PinX")), y = numeric(formattingCell(source, "PinY"));
40205
41136
  for (const [name3, offset] of [
@@ -40214,6 +41145,9 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
40214
41145
  size3(source);
40215
41146
  plans.push({ source, id: copy8.newShapeId, x: x + edit.offsetX, y: y + edit.offsetY });
40216
41147
  }
41148
+ const connectorSources = plans.filter((plan) => plan.connector).map((plan) => plan.source);
41149
+ if (connectorSources.length)
41150
+ assertConnectorCopyApart(root2, connectorSources, edit.offsetX, edit.offsetY);
40217
41151
  const order = new Map(
40218
41152
  children2(children2(sourceRoot, "Shapes")[0], "Shape").map((source, index2) => [source, index2])
40219
41153
  );
@@ -40224,6 +41158,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
40224
41158
  check();
40225
41159
  const shape = root2.ownerDocument.importNode(plan.source, true);
40226
41160
  copyIdentity(shape, plan.id, names);
41161
+ if (plan.line) finishLineCopy(shape, edit.offsetX, edit.offsetY);
40227
41162
  for (const node3 of [shape, ...Array.from(shape.getElementsByTagName("*"))]) {
40228
41163
  const source = executableCellFormula(attribute2(node3, "F"));
40229
41164
  if (!source) continue;
@@ -40242,6 +41177,15 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
40242
41177
  )
40243
41178
  );
40244
41179
  }
41180
+ if (plan.line) {
41181
+ container.appendChild(shape);
41182
+ continue;
41183
+ }
41184
+ if (plan.connector) {
41185
+ finishConnectorCopy(shape, plan.id, edit.offsetX, edit.offsetY);
41186
+ container.appendChild(shape);
41187
+ continue;
41188
+ }
40245
41189
  if (plan.template) {
40246
41190
  for (const id3 of newIds) ids.add(id3);
40247
41191
  finishInstanceCopy(shape, plan.template, plan.x, plan.y, ids, check);
@@ -40258,7 +41202,7 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
40258
41202
  }
40259
41203
  container.appendChild(shape);
40260
41204
  }
40261
- const local = plans.filter((plan) => !plan.template);
41205
+ const local = plans.filter((plan) => !plan.template && !plan.line);
40262
41206
  if (changed.length) {
40263
41207
  await assertGeometryPackageScope(
40264
41208
  pkg,
@@ -40292,6 +41236,9 @@ async function duplicateVisioShapes(pkg, pagePaths, roots2, document, edit, chec
40292
41236
  }
40293
41237
  const dirty = /* @__PURE__ */ new Set([edit.pageId]);
40294
41238
  for (const id3 of recalculateVisioCells(roots2, changed, { check })) dirty.add(id3);
41239
+ for (const plan of plans)
41240
+ if (!plan.line && !plan.connector)
41241
+ for (const id3 of rerouteBlockedConnectors(roots2, edit.pageId, plan.id, check)) dirty.add(id3);
40295
41242
  return [...dirty];
40296
41243
  }
40297
41244
  function assertCloneLeaf(source) {
@@ -40622,9 +41569,10 @@ function deleteVisioShapes(roots2, document, edits, check, instances = /* @__PUR
40622
41569
  }
40623
41570
  releaseStencilGlue(roots2, removed);
40624
41571
  releaseDeletedGlue(roots2, removed);
40625
- assertVisioShapesUnreferenced(roots2, removed, { check });
41572
+ const frozen = assertVisioShapesUnreferenced(roots2, removed, { check, freeze: true });
40626
41573
  check();
40627
41574
  for (const shape of shapes) shape.parentNode.removeChild(shape);
41575
+ freezeVisioCells(frozen);
40628
41576
  for (const pageId2 of removed.keys())
40629
41577
  for (const container of children2(roots2.get(pageId2), "Connects"))
40630
41578
  if (!children2(container, "Connect").length) container.parentNode.removeChild(container);
@@ -40653,8 +41601,8 @@ function admittedShape(root2, document, shapeId2) {
40653
41601
  if (["1", "true"].includes(attribute2(shape, "Del") ?? "")) refuse3("The shape is deleted.");
40654
41602
  const local = cells(shape);
40655
41603
  if (isLineSheet(local)) refuse3("Lines and connectors (1D shapes) cannot change shape.");
40656
- for (const connects of children2(root2, "Connects"))
40657
- for (const connect of children2(connects, "Connect"))
41604
+ for (const connects2 of children2(root2, "Connects"))
41605
+ for (const connect of children2(connects2, "Connect"))
40658
41606
  if (["FromSheet", "ToSheet"].some((name3) => attribute2(connect, name3) === shapeId2))
40659
41607
  refuse3("Glued connectors would need rerouting, which is not supported yet.");
40660
41608
  if (children2(shape, "Section").some((section3) => attribute2(section3, "N") === "Controls"))
@@ -42097,8 +43045,8 @@ async function captureVisioClipboard(input, pageId2, shapeIds2, options2 = {}) {
42097
43045
  numeric(formattingCell(source, name3));
42098
43046
  evaluate(key({ pageId: pageId2, shapeId: id3, cell: name3 }));
42099
43047
  }
42100
- for (const connects of children2(root2, "Connects"))
42101
- for (const connection of children2(connects, "Connect"))
43048
+ for (const connects2 of children2(root2, "Connects"))
43049
+ for (const connection of children2(connects2, "Connect"))
42102
43050
  if (["FromSheet", "ToSheet"].some((name3) => attribute2(connection, name3) === id3))
42103
43051
  fail("UNSUPPORTED_CLIPBOARD", "Glued shapes cannot be captured safely.");
42104
43052
  }
@@ -42639,8 +43587,8 @@ function assertUnreferenced3(roots2, shapeId2, check) {
42639
43587
  if (reference2.test(executableCellFormula(attribute2(cell, "F")) ?? ""))
42640
43588
  fail("UNSUPPORTED_GUIDE_EDIT", "A shape formula refers to this guide.");
42641
43589
  }
42642
- for (const connects of children2(root2, "Connects"))
42643
- for (const row2 of children2(connects, "Connect"))
43590
+ for (const connects2 of children2(root2, "Connects"))
43591
+ for (const row2 of children2(connects2, "Connect"))
42644
43592
  if (attribute2(row2, "ToSheet") === shapeId2 || attribute2(row2, "FromSheet") === shapeId2)
42645
43593
  fail("UNSUPPORTED_GUIDE_EDIT", "Shapes are glued to this guide.");
42646
43594
  }
@@ -43017,6 +43965,7 @@ async function editVsdxTransaction(input, edits, options2, clock = {
43017
43965
  if (deleteOnly)
43018
43966
  for (const pageId2 of deleteVisioShapes(roots2, document, deletions, check, instanceDeletes))
43019
43967
  dirty.set(pages.get(pageId2), roots2.get(pageId2));
43968
+ const formulaDiagnostics = [];
43020
43969
  const noteTextSize = async (target2, root2) => {
43021
43970
  if (await measuresOwnText(root2, target2.shapeId, masterTemplate(pkg), check))
43022
43971
  clock.textSizes.push({ pageId: target2.pageId, shapeId: target2.shapeId });
@@ -43032,7 +43981,15 @@ async function editVsdxTransaction(input, edits, options2, clock = {
43032
43981
  roots2.set(command2.pageId, root2);
43033
43982
  }
43034
43983
  if (command2.type === "replace-plain-text" || command2.type === "replace-text-ranges") {
43035
- 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))) {
43984
+ if (await (command2.type === "replace-plain-text" ? replaceScopedPlainText(
43985
+ pkg,
43986
+ new Set(pages.values()),
43987
+ roots2,
43988
+ document,
43989
+ command2,
43990
+ check,
43991
+ formulaDiagnostics
43992
+ ) : replaceScopedTextRanges(pkg, new Set(pages.values()), roots2, document, command2, check))) {
43036
43993
  dirty.set(path3, root2);
43037
43994
  textChanged = true;
43038
43995
  await noteTextSize(command2, root2);
@@ -43178,6 +44135,7 @@ async function editVsdxTransaction(input, edits, options2, clock = {
43178
44135
  bytes,
43179
44136
  changedParts: [...dirty.keys()],
43180
44137
  diagnostics: [
44138
+ ...formulaDiagnostics,
43181
44139
  ...pasteChanged ? [
43182
44140
  {
43183
44141
  code: "edit-paste-experimental",
@@ -47008,7 +47966,7 @@ function checkVisioDiagram(document, options2 = {}) {
47008
47966
  }
47009
47967
 
47010
47968
  // visio/ui/shape-report.ts
47011
- var TYPES2 = {
47969
+ var TYPES3 = {
47012
47970
  shape: "Shape",
47013
47971
  group: "Group",
47014
47972
  connector: "1-D shape",
@@ -47054,7 +48012,7 @@ function visioShapeReport(document, options2 = {}) {
47054
48012
  pageId: page.id,
47055
48013
  id: shape.id,
47056
48014
  name: shape.name,
47057
- type: TYPES2[shape.kind],
48015
+ type: TYPES3[shape.kind],
47058
48016
  master: shape.masterId ?? "",
47059
48017
  width: round5(shape.width),
47060
48018
  height: round5(shape.height),