ooxml-core 1.8.4 → 1.10.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 (347) hide show
  1. package/dist/PptxHandler-5UURGJEV.mjs +2 -0
  2. package/dist/{PptxHandler-BL4B7CZO.mjs → PptxHandler-ADEFY476.mjs} +2 -2
  3. package/dist/PptxHandler-U5XB2HUE.cjs +11 -0
  4. package/dist/automation/index.cjs +7239 -4037
  5. package/dist/automation/index.mjs +7239 -4037
  6. package/dist/chunk-3N6XMMTT.cjs +87913 -0
  7. package/dist/{chunk-TTPZITQN.mjs → chunk-5NVJN4E6.mjs} +30 -2
  8. package/dist/{chunk-ZAP5WLEN.mjs → chunk-A6P7G3UK.mjs} +1 -1
  9. package/dist/{chunk-CPKNMQLX.cjs → chunk-AWIDASUW.cjs} +25 -2
  10. package/dist/{chunk-SVQZXP3F.mjs → chunk-CBNKBVX5.mjs} +25 -2
  11. package/dist/{chunk-GAGSCAR3.mjs → chunk-CCHYFCPD.mjs} +1199 -348
  12. package/dist/chunk-R6KSBNKX.mjs +44133 -0
  13. package/dist/chunk-S6DOCMQC.cjs +44451 -0
  14. package/dist/{chunk-Z7IQR4S4.mjs → chunk-WUE5ZHU3.mjs} +269 -21
  15. package/dist/chunk-ZE53K7DH.mjs +87907 -0
  16. package/dist/{chunk-NIHPA63A.mjs → chunk-ZOUGMAZG.mjs} +54 -37
  17. package/dist/docx/block-parser.d.ts.map +1 -1
  18. package/dist/docx/cell-blocks.d.ts +4 -0
  19. package/dist/docx/cell-blocks.d.ts.map +1 -0
  20. package/dist/docx/document-paragraphs.d.ts.map +1 -1
  21. package/dist/docx/document-parts.d.ts +2 -0
  22. package/dist/docx/document-parts.d.ts.map +1 -1
  23. package/dist/docx/embedded.cjs +189 -20
  24. package/dist/docx/embedded.mjs +189 -20
  25. package/dist/docx/index.cjs +219 -24
  26. package/dist/docx/index.mjs +219 -24
  27. package/dist/docx/layout/adapt-table.d.ts +2 -2
  28. package/dist/docx/layout/adapt-table.d.ts.map +1 -1
  29. package/dist/docx/layout/adapter.d.ts.map +1 -1
  30. package/dist/docx/layout/flow-paragraph.d.ts +5 -0
  31. package/dist/docx/layout/flow-paragraph.d.ts.map +1 -1
  32. package/dist/docx/layout/flow-table.d.ts +2 -1
  33. package/dist/docx/layout/flow-table.d.ts.map +1 -1
  34. package/dist/docx/layout/footnote-columns.d.ts +22 -0
  35. package/dist/docx/layout/footnote-columns.d.ts.map +1 -0
  36. package/dist/docx/layout/footnote-flow.d.ts +27 -0
  37. package/dist/docx/layout/footnote-flow.d.ts.map +1 -0
  38. package/dist/docx/layout/footnote-split.d.ts +7 -0
  39. package/dist/docx/layout/footnote-split.d.ts.map +1 -0
  40. package/dist/docx/layout/index.cjs +1528 -119
  41. package/dist/docx/layout/index.mjs +1528 -120
  42. package/dist/docx/layout/input.d.ts +17 -1
  43. package/dist/docx/layout/input.d.ts.map +1 -1
  44. package/dist/docx/layout/legacy-footnote-flow.d.ts +18 -0
  45. package/dist/docx/layout/legacy-footnote-flow.d.ts.map +1 -0
  46. package/dist/docx/layout/line-metrics.d.ts.map +1 -1
  47. package/dist/docx/layout/nested-frame-profile.d.ts +9 -0
  48. package/dist/docx/layout/nested-frame-profile.d.ts.map +1 -0
  49. package/dist/docx/layout/page-cursor.d.ts +15 -8
  50. package/dist/docx/layout/page-cursor.d.ts.map +1 -1
  51. package/dist/docx/layout/page-flow.d.ts.map +1 -1
  52. package/dist/docx/layout/paragraph-layout.d.ts.map +1 -1
  53. package/dist/docx/layout/paragraph-tokens.d.ts +2 -0
  54. package/dist/docx/layout/paragraph-tokens.d.ts.map +1 -1
  55. package/dist/docx/layout/reference-footnotes.d.ts +7 -0
  56. package/dist/docx/layout/reference-footnotes.d.ts.map +1 -0
  57. package/dist/docx/layout/result.d.ts +44 -0
  58. package/dist/docx/layout/result.d.ts.map +1 -1
  59. package/dist/docx/layout/section-flow.d.ts +2 -0
  60. package/dist/docx/layout/section-flow.d.ts.map +1 -1
  61. package/dist/docx/layout/table-border-layout.d.ts +16 -0
  62. package/dist/docx/layout/table-border-layout.d.ts.map +1 -0
  63. package/dist/docx/layout/table-cell-layout.d.ts +12 -0
  64. package/dist/docx/layout/table-cell-layout.d.ts.map +1 -0
  65. package/dist/docx/layout/table-content.d.ts +4 -0
  66. package/dist/docx/layout/table-content.d.ts.map +1 -0
  67. package/dist/docx/layout/table-footnotes.d.ts +32 -0
  68. package/dist/docx/layout/table-footnotes.d.ts.map +1 -0
  69. package/dist/docx/layout/table-frames.d.ts +4 -0
  70. package/dist/docx/layout/table-frames.d.ts.map +1 -0
  71. package/dist/docx/layout/table-layout.d.ts +16 -5
  72. package/dist/docx/layout/table-layout.d.ts.map +1 -1
  73. package/dist/docx/layout/table-note-completion.d.ts +5 -0
  74. package/dist/docx/layout/table-note-completion.d.ts.map +1 -0
  75. package/dist/docx/layout/table-note-stories.d.ts +6 -0
  76. package/dist/docx/layout/table-note-stories.d.ts.map +1 -0
  77. package/dist/docx/load/index.cjs +194 -25
  78. package/dist/docx/load/index.mjs +194 -25
  79. package/dist/docx/model-run.d.ts +2 -0
  80. package/dist/docx/model-run.d.ts.map +1 -1
  81. package/dist/docx/model.d.ts +7 -0
  82. package/dist/docx/model.d.ts.map +1 -1
  83. package/dist/docx/notes.d.ts +5 -0
  84. package/dist/docx/notes.d.ts.map +1 -1
  85. package/dist/docx/parse-table.d.ts.map +1 -1
  86. package/dist/docx/parse.d.ts.map +1 -1
  87. package/dist/docx/save.d.ts.map +1 -1
  88. package/dist/docx/section-model.d.ts +2 -0
  89. package/dist/docx/section-model.d.ts.map +1 -1
  90. package/dist/docx/sections.d.ts.map +1 -1
  91. package/dist/docx/settings.d.ts +2 -0
  92. package/dist/docx/settings.d.ts.map +1 -1
  93. package/dist/docx/table-model.d.ts +3 -1
  94. package/dist/docx/table-model.d.ts.map +1 -1
  95. package/dist/docx/ui/index.cjs +55 -0
  96. package/dist/docx/ui/index.d.ts +1 -0
  97. package/dist/docx/ui/index.d.ts.map +1 -1
  98. package/dist/docx/ui/index.mjs +55 -1
  99. package/dist/docx/ui/table-structure-guard.d.ts +4 -0
  100. package/dist/docx/ui/table-structure-guard.d.ts.map +1 -0
  101. package/dist/docx/write-footnote-columns.d.ts +3 -0
  102. package/dist/docx/write-footnote-columns.d.ts.map +1 -0
  103. package/dist/docx/write-notes.d.ts.map +1 -1
  104. package/dist/docx/write-run.d.ts.map +1 -1
  105. package/dist/docx/write-sections.d.ts.map +1 -1
  106. package/dist/index.cjs +8 -5
  107. package/dist/index.mjs +8 -5
  108. package/dist/opc/clone-part-graph.d.ts +4 -0
  109. package/dist/opc/clone-part-graph.d.ts.map +1 -1
  110. package/dist/opc/index.cjs +8 -5
  111. package/dist/opc/index.mjs +8 -5
  112. package/dist/pptx/automation/index.cjs +1156 -389
  113. package/dist/pptx/automation/index.d.ts +4 -4
  114. package/dist/pptx/automation/index.mjs +5 -5
  115. package/dist/pptx/chunks/{index-CKIUurnd.d.ts → index-Cuxtr76Y.d.ts} +29 -10
  116. package/dist/pptx/chunks/index-Cuxtr76Y.d.ts.map +1 -0
  117. package/dist/pptx/chunks/{index-Cn-GzYGp.d.ts → index-DUCGeZh7.d.ts} +94 -5
  118. package/dist/pptx/chunks/index-DUCGeZh7.d.ts.map +1 -0
  119. package/dist/pptx/chunks/{smart-art-Q2kZQtHh.d.ts → smart-art-D-sXa_Nb.d.ts} +11 -1
  120. package/dist/pptx/chunks/smart-art-D-sXa_Nb.d.ts.map +1 -0
  121. package/dist/pptx/chunks/{text-operations-BHfAm5K9.d.ts → text-operations-BqHmLaLA.d.ts} +54 -13
  122. package/dist/pptx/chunks/text-operations-BqHmLaLA.d.ts.map +1 -0
  123. package/dist/pptx/cli/index.cjs +1157 -395
  124. package/dist/pptx/cli/index.d.ts +1 -1
  125. package/dist/pptx/cli/index.mjs +4 -4
  126. package/dist/pptx/converter/index.cjs +54 -36
  127. package/dist/pptx/converter/index.d.ts +1 -1
  128. package/dist/pptx/converter/index.mjs +2 -2
  129. package/dist/pptx/editor/render/collaboration-live-patch-target.cjs +2 -2
  130. package/dist/pptx/editor/render/collaboration-live-patch-target.mjs +1 -1
  131. package/dist/pptx/editor/render/find-replace.cjs +416 -45
  132. package/dist/pptx/editor/render/find-replace.d.ts +35 -4
  133. package/dist/pptx/editor/render/find-replace.d.ts.map +1 -1
  134. package/dist/pptx/editor/render/find-replace.mjs +416 -46
  135. package/dist/pptx/editor/render/remap-text.cjs +2 -2
  136. package/dist/pptx/editor/render/remap-text.d.ts.map +1 -1
  137. package/dist/pptx/editor/render/remap-text.mjs +1 -1
  138. package/dist/pptx/editor/render/slide-operations.cjs +87 -0
  139. package/dist/pptx/editor/render/slide-operations.d.ts +17 -1
  140. package/dist/pptx/editor/render/slide-operations.d.ts.map +1 -1
  141. package/dist/pptx/editor/render/slide-operations.mjs +83 -1
  142. package/dist/pptx/editor/render/slide-search.cjs +6 -10
  143. package/dist/pptx/editor/render/slide-search.d.ts +1 -1
  144. package/dist/pptx/editor/render/slide-search.mjs +6 -10
  145. package/dist/pptx/editor/render/template-editing.d.ts +1 -1
  146. package/dist/pptx/editor/render/template-editing.d.ts.map +1 -1
  147. package/dist/pptx/index.cjs +1651 -419
  148. package/dist/pptx/index.d.ts +5 -5
  149. package/dist/pptx/index.mjs +5 -5
  150. package/dist/pptx/smartart-layouts/index.d.ts +1 -1
  151. package/dist/teams/index.cjs +965 -34
  152. package/dist/teams/index.mjs +965 -34
  153. package/dist/visio/accessibility.d.ts +10 -0
  154. package/dist/visio/accessibility.d.ts.map +1 -0
  155. package/dist/visio/cell-formula.d.ts +2 -0
  156. package/dist/visio/cell-formula.d.ts.map +1 -1
  157. package/dist/visio/connector-curve-aligned.d.ts +5 -0
  158. package/dist/visio/connector-curve-aligned.d.ts.map +1 -0
  159. package/dist/visio/connector-curve-spans.d.ts +14 -0
  160. package/dist/visio/connector-curve-spans.d.ts.map +1 -0
  161. package/dist/visio/connector-jumps.d.ts +5 -0
  162. package/dist/visio/connector-jumps.d.ts.map +1 -0
  163. package/dist/visio/connector-route-walk.d.ts +2 -1
  164. package/dist/visio/connector-route-walk.d.ts.map +1 -1
  165. package/dist/visio/date-cache.d.ts +3 -0
  166. package/dist/visio/date-cache.d.ts.map +1 -0
  167. package/dist/visio/edit-alt-text-scope.d.ts +5 -0
  168. package/dist/visio/edit-alt-text-scope.d.ts.map +1 -0
  169. package/dist/visio/edit-alt-text.d.ts +3 -0
  170. package/dist/visio/edit-alt-text.d.ts.map +1 -0
  171. package/dist/visio/edit-commands.d.ts +7 -2
  172. package/dist/visio/edit-commands.d.ts.map +1 -1
  173. package/dist/visio/edit-formatting-commands.d.ts +5 -0
  174. package/dist/visio/edit-formatting-commands.d.ts.map +1 -1
  175. package/dist/visio/edit-formatting-paint.d.ts.map +1 -1
  176. package/dist/visio/edit-formatting-scope.d.ts.map +1 -1
  177. package/dist/visio/edit-line-jump-cache.d.ts +4 -0
  178. package/dist/visio/edit-line-jump-cache.d.ts.map +1 -0
  179. package/dist/visio/edit-master-index.d.ts.map +1 -1
  180. package/dist/visio/edit-metadata-commands.d.ts +10 -2
  181. package/dist/visio/edit-metadata-commands.d.ts.map +1 -1
  182. package/dist/visio/edit-metadata.d.ts +3 -1
  183. package/dist/visio/edit-metadata.d.ts.map +1 -1
  184. package/dist/visio/edit-page-alt-text.d.ts +4 -0
  185. package/dist/visio/edit-page-alt-text.d.ts.map +1 -0
  186. package/dist/visio/edit-page-layout.d.ts.map +1 -1
  187. package/dist/visio/edit-page-rename.d.ts.map +1 -1
  188. package/dist/visio/edit-page-setup-commands.d.ts +7 -1
  189. package/dist/visio/edit-page-setup-commands.d.ts.map +1 -1
  190. package/dist/visio/edit-page-size.d.ts.map +1 -1
  191. package/dist/visio/edit-pages.d.ts.map +1 -1
  192. package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
  193. package/dist/visio/edit-scope.d.ts.map +1 -1
  194. package/dist/visio/edit-shape-create.d.ts.map +1 -1
  195. package/dist/visio/edit-stencil-connector-write.d.ts.map +1 -1
  196. package/dist/visio/edit-style-admission.d.ts.map +1 -1
  197. package/dist/visio/edit-text-field.d.ts.map +1 -1
  198. package/dist/visio/edit-text.d.ts.map +1 -1
  199. package/dist/visio/edit.d.ts +1 -1
  200. package/dist/visio/edit.d.ts.map +1 -1
  201. package/dist/visio/index.cjs +1215 -248
  202. package/dist/visio/index.d.ts +2 -1
  203. package/dist/visio/index.d.ts.map +1 -1
  204. package/dist/visio/index.mjs +1215 -249
  205. package/dist/visio/line-jumps.d.ts +1 -5
  206. package/dist/visio/line-jumps.d.ts.map +1 -1
  207. package/dist/visio/model.d.ts +13 -0
  208. package/dist/visio/model.d.ts.map +1 -1
  209. package/dist/visio/page-layout.d.ts +11 -2
  210. package/dist/visio/page-layout.d.ts.map +1 -1
  211. package/dist/visio/parser.d.ts.map +1 -1
  212. package/dist/visio/shape-metadata.d.ts +6 -0
  213. package/dist/visio/shape-metadata.d.ts.map +1 -1
  214. package/dist/visio/shapes.d.ts.map +1 -1
  215. package/dist/visio/text-field-case.d.ts +2 -0
  216. package/dist/visio/text-field-case.d.ts.map +1 -0
  217. package/dist/visio/text-field-display.d.ts.map +1 -1
  218. package/dist/visio/text-field-fraction.d.ts +3 -0
  219. package/dist/visio/text-field-fraction.d.ts.map +1 -0
  220. package/dist/visio/text-field-numeric.d.ts +4 -0
  221. package/dist/visio/text-field-numeric.d.ts.map +1 -0
  222. package/dist/visio/text-field-system-date.d.ts +4 -0
  223. package/dist/visio/text-field-system-date.d.ts.map +1 -0
  224. package/dist/visio/text-fields.d.ts +1 -0
  225. package/dist/visio/text-fields.d.ts.map +1 -1
  226. package/dist/visio/ui/connector-preview.d.ts +1 -1
  227. package/dist/visio/ui/connector-preview.d.ts.map +1 -1
  228. package/dist/visio/ui/data-graphic-rules.d.ts +2 -0
  229. package/dist/visio/ui/data-graphic-rules.d.ts.map +1 -1
  230. package/dist/visio/ui/data-graphics.d.ts +3 -2
  231. package/dist/visio/ui/data-graphics.d.ts.map +1 -1
  232. package/dist/visio/ui/edit-commands.d.ts.map +1 -1
  233. package/dist/visio/ui/index.cjs +19310 -18157
  234. package/dist/visio/ui/index.mjs +19310 -18158
  235. package/dist/visio/ui/scene-details.d.ts.map +1 -1
  236. package/dist/visio/ui/scene-validation.d.ts.map +1 -1
  237. package/dist/visio/ui/snapshot-scene.d.ts +2 -1
  238. package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
  239. package/dist/visio/ui/text-field-catalog.d.ts.map +1 -1
  240. package/dist/visio/xml-attribute-whitespace.d.ts +5 -0
  241. package/dist/visio/xml-attribute-whitespace.d.ts.map +1 -0
  242. package/dist/xlsx/edit/index.d.ts +1 -0
  243. package/dist/xlsx/edit/index.d.ts.map +1 -1
  244. package/dist/xlsx/edit/insert-guard.d.ts.map +1 -1
  245. package/dist/xlsx/edit/merge.d.ts.map +1 -1
  246. package/dist/xlsx/edit/page-breaks.d.ts +5 -0
  247. package/dist/xlsx/edit/page-breaks.d.ts.map +1 -0
  248. package/dist/xlsx/edit/pivots.d.ts +8 -0
  249. package/dist/xlsx/edit/pivots.d.ts.map +1 -0
  250. package/dist/xlsx/edit/print-titles.d.ts +7 -0
  251. package/dist/xlsx/edit/print-titles.d.ts.map +1 -0
  252. package/dist/xlsx/edit/session.d.ts.map +1 -1
  253. package/dist/xlsx/edit/sheets.d.ts.map +1 -1
  254. package/dist/xlsx/edit/shift-formulas.d.ts.map +1 -1
  255. package/dist/xlsx/edit/shift-sheet.d.ts.map +1 -1
  256. package/dist/xlsx/edit/sparkline-ranges.d.ts +11 -0
  257. package/dist/xlsx/edit/sparkline-ranges.d.ts.map +1 -0
  258. package/dist/xlsx/edit/sparkline-xml.d.ts +13 -0
  259. package/dist/xlsx/edit/sparkline-xml.d.ts.map +1 -0
  260. package/dist/xlsx/edit/sparklines.d.ts +16 -0
  261. package/dist/xlsx/edit/sparklines.d.ts.map +1 -0
  262. package/dist/xlsx/edit/table-edits.d.ts.map +1 -1
  263. package/dist/xlsx/edit/tables.d.ts.map +1 -1
  264. package/dist/xlsx/edit/types.d.ts +22 -1
  265. package/dist/xlsx/edit/types.d.ts.map +1 -1
  266. package/dist/xlsx/formula/functions/text-regex.d.ts.map +1 -1
  267. package/dist/xlsx/index.cjs +3638 -1199
  268. package/dist/xlsx/index.d.ts +1 -0
  269. package/dist/xlsx/index.d.ts.map +1 -1
  270. package/dist/xlsx/index.mjs +3619 -1200
  271. package/dist/xlsx/layout/cell-view.d.ts +2 -0
  272. package/dist/xlsx/layout/cell-view.d.ts.map +1 -1
  273. package/dist/xlsx/layout/header-footer.d.ts +58 -0
  274. package/dist/xlsx/layout/header-footer.d.ts.map +1 -0
  275. package/dist/xlsx/layout/index.d.ts +5 -0
  276. package/dist/xlsx/layout/index.d.ts.map +1 -1
  277. package/dist/xlsx/layout/print-breaks.d.ts +11 -0
  278. package/dist/xlsx/layout/print-breaks.d.ts.map +1 -0
  279. package/dist/xlsx/layout/print-layout.d.ts +34 -0
  280. package/dist/xlsx/layout/print-layout.d.ts.map +1 -0
  281. package/dist/xlsx/layout/print-merges.d.ts +18 -0
  282. package/dist/xlsx/layout/print-merges.d.ts.map +1 -0
  283. package/dist/xlsx/layout/print-repeat.d.ts +12 -0
  284. package/dist/xlsx/layout/print-repeat.d.ts.map +1 -0
  285. package/dist/xlsx/layout/print-titles.d.ts +20 -0
  286. package/dist/xlsx/layout/print-titles.d.ts.map +1 -0
  287. package/dist/xlsx/layout/sparkline-data.d.ts.map +1 -1
  288. package/dist/xlsx/layout/sparkline-view.d.ts.map +1 -1
  289. package/dist/xlsx/load/index.cjs +8165 -6945
  290. package/dist/xlsx/load/index.mjs +8165 -6945
  291. package/dist/xlsx/model-pivots.d.ts +67 -0
  292. package/dist/xlsx/model-pivots.d.ts.map +1 -0
  293. package/dist/xlsx/model.d.ts +5 -0
  294. package/dist/xlsx/model.d.ts.map +1 -1
  295. package/dist/xlsx/pivot/admission.d.ts +5 -0
  296. package/dist/xlsx/pivot/admission.d.ts.map +1 -0
  297. package/dist/xlsx/pivot/aggregate.d.ts +21 -0
  298. package/dist/xlsx/pivot/aggregate.d.ts.map +1 -0
  299. package/dist/xlsx/pivot/cache-xml.d.ts +9 -0
  300. package/dist/xlsx/pivot/cache-xml.d.ts.map +1 -0
  301. package/dist/xlsx/pivot/data.d.ts +12 -0
  302. package/dist/xlsx/pivot/data.d.ts.map +1 -0
  303. package/dist/xlsx/pivot/hierarchy-first.d.ts +21 -0
  304. package/dist/xlsx/pivot/hierarchy-first.d.ts.map +1 -0
  305. package/dist/xlsx/pivot/hierarchy.d.ts +5 -0
  306. package/dist/xlsx/pivot/hierarchy.d.ts.map +1 -0
  307. package/dist/xlsx/pivot/index.d.ts +3 -0
  308. package/dist/xlsx/pivot/index.d.ts.map +1 -0
  309. package/dist/xlsx/pivot/measures.d.ts +13 -0
  310. package/dist/xlsx/pivot/measures.d.ts.map +1 -0
  311. package/dist/xlsx/pivot/read.d.ts +5 -0
  312. package/dist/xlsx/pivot/read.d.ts.map +1 -0
  313. package/dist/xlsx/pivot/table-xml.d.ts +5 -0
  314. package/dist/xlsx/pivot/table-xml.d.ts.map +1 -0
  315. package/dist/xlsx/pivot/values-axis.d.ts +9 -0
  316. package/dist/xlsx/pivot/values-axis.d.ts.map +1 -0
  317. package/dist/xlsx/pivot/write.d.ts +11 -0
  318. package/dist/xlsx/pivot/write.d.ts.map +1 -0
  319. package/dist/xlsx/read/load.d.ts.map +1 -1
  320. package/dist/xlsx/read/sheet-props.d.ts.map +1 -1
  321. package/dist/xlsx/ui/commands/i18n/index.d.ts.map +1 -1
  322. package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
  323. package/dist/xlsx/ui/commands/i18n/pivots.d.ts +3 -0
  324. package/dist/xlsx/ui/commands/i18n/pivots.d.ts.map +1 -0
  325. package/dist/xlsx/ui/commands/i18n/print-layout.d.ts +3 -0
  326. package/dist/xlsx/ui/commands/i18n/print-layout.d.ts.map +1 -0
  327. package/dist/xlsx/ui/commands/i18n/sparklines.d.ts +3 -0
  328. package/dist/xlsx/ui/commands/i18n/sparklines.d.ts.map +1 -0
  329. package/dist/xlsx/ui/commands/i18n/tools.d.ts.map +1 -1
  330. package/dist/xlsx/ui/commands/page-breaks.d.ts +3 -0
  331. package/dist/xlsx/ui/commands/page-breaks.d.ts.map +1 -0
  332. package/dist/xlsx/ui/index.cjs +2421 -288
  333. package/dist/xlsx/ui/index.d.ts +1 -0
  334. package/dist/xlsx/ui/index.d.ts.map +1 -1
  335. package/dist/xlsx/ui/index.mjs +2421 -289
  336. package/dist/xlsx/write/page-setup.d.ts.map +1 -1
  337. package/dist/xlsx/write/save.d.ts.map +1 -1
  338. package/dist/xlsx/write/sheet-parts.d.ts +1 -0
  339. package/dist/xlsx/write/sheet-parts.d.ts.map +1 -1
  340. package/dist/xlsx/write/workbook-part.d.ts +1 -1
  341. package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
  342. package/dist/xlsx/write/worksheet.d.ts.map +1 -1
  343. package/package.json +1 -1
  344. package/dist/pptx/chunks/index-CKIUurnd.d.ts.map +0 -1
  345. package/dist/pptx/chunks/index-Cn-GzYGp.d.ts.map +0 -1
  346. package/dist/pptx/chunks/smart-art-Q2kZQtHh.d.ts.map +0 -1
  347. package/dist/pptx/chunks/text-operations-BHfAm5K9.d.ts.map +0 -1
@@ -1308,15 +1308,16 @@ function inspect(bytes, limits) {
1308
1308
  // visio/edit-metadata-commands.ts
1309
1309
  var VISIO_METADATA_TEXT_LIMIT = 4096;
1310
1310
  var VISIO_PICTURE_MAX_BYTES = VISIO_RASTER_IMAGE_LIMITS.maxImageBytes;
1311
- var isVisioMetadataEdit = (edit) => edit.type === "set-shape-hyperlink" || edit.type === "set-shape-screentip";
1311
+ var isVisioMetadataEdit = (edit) => edit.type === "set-shape-hyperlink" || edit.type === "set-shape-screentip" || edit.type === "set-shape-alt-text";
1312
1312
  var invalidText = /[\u0000-\u0008\u000b\u000c\u000e-\u001f￾￿]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/u;
1313
- function field(value, singleLine2) {
1313
+ function metadataText(value, singleLine2) {
1314
1314
  if (typeof value !== "string" || value.length > VISIO_METADATA_TEXT_LIMIT)
1315
- fail("INVALID_EDIT", "Link and ScreenTip text must be strings within the length limit.");
1316
- if (invalidText.test(value) || /[\r\n\t]/.test(value))
1317
- fail("INVALID_EDIT_TEXT", "Link or ScreenTip text contains invalid characters.");
1315
+ fail("INVALID_EDIT", "Shape metadata text must be strings within the length limit.");
1316
+ if (invalidText.test(value) || singleLine2 && /[\r\n\t]/.test(value))
1317
+ fail("INVALID_EDIT_TEXT", "Shape metadata text contains invalid characters.");
1318
1318
  return value;
1319
1319
  }
1320
+ var field = metadataText;
1320
1321
  function target(edit) {
1321
1322
  if (typeof edit.pageId !== "string" || !edit.pageId || edit.pageId.length > 256 || typeof edit.shapeId !== "string" || !/^[1-9]\d{0,9}$/.test(edit.shapeId) || Number(edit.shapeId) > 4294967295)
1322
1323
  fail("INVALID_EDIT", "Invalid edit shape target.");
@@ -1324,8 +1325,15 @@ function target(edit) {
1324
1325
  }
1325
1326
  function snapshotMetadataEdit(edit) {
1326
1327
  const base2 = target(edit);
1328
+ if (edit.type === "set-shape-alt-text")
1329
+ return {
1330
+ ...base2,
1331
+ type: edit.type,
1332
+ title: field(edit.title, true),
1333
+ description: field(edit.description, false)
1334
+ };
1327
1335
  if (edit.type === "set-shape-screentip")
1328
- return { ...base2, type: edit.type, text: field(edit.text) };
1336
+ return { ...base2, type: edit.type, text: field(edit.text, true) };
1329
1337
  if (edit.row !== void 0 && (typeof edit.row !== "string" || !/^[A-Za-z_]\w{0,63}$/.test(edit.row)))
1330
1338
  fail("INVALID_EDIT", "Hyperlink row names must be ShapeSheet row names.");
1331
1339
  const link = edit.hyperlink;
@@ -1335,9 +1343,9 @@ function snapshotMetadataEdit(edit) {
1335
1343
  }
1336
1344
  if (!link || typeof link !== "object") fail("INVALID_EDIT", "Invalid hyperlink fields.");
1337
1345
  const hyperlink2 = {
1338
- address: field(link.address).trim(),
1339
- subAddress: field(link.subAddress).trim(),
1340
- description: field(link.description)
1346
+ address: field(link.address, true).trim(),
1347
+ subAddress: field(link.subAddress, true).trim(),
1348
+ description: field(link.description, true)
1341
1349
  };
1342
1350
  if (!hyperlink2.address && !hyperlink2.subAddress)
1343
1351
  fail("INVALID_EDIT", "A hyperlink needs an address or a page target.");
@@ -1573,6 +1581,20 @@ function writeEditedPackage(parts, maxBytes, deadline, check) {
1573
1581
  });
1574
1582
  }
1575
1583
 
1584
+ // visio/xml-attribute-whitespace.ts
1585
+ function preserveAttributeWhitespace(xml) {
1586
+ return xml.replace(
1587
+ /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\?[\s\S]*?\?>|<\/?[^!?\s>][^"'>]*(?:(?:"[^"]*"|'[^']*')[^"'>]*)*>/g,
1588
+ (token) => {
1589
+ if (token.startsWith("<!") || token.startsWith("<?")) return token;
1590
+ return token.replace(
1591
+ /"[^"]*"|'[^']*'/g,
1592
+ (value) => value.replace(/[\t\r\n]/g, (character) => `&#${character.charCodeAt(0)};`)
1593
+ );
1594
+ }
1595
+ );
1596
+ }
1597
+
1576
1598
  // visio/cell-formula.ts
1577
1599
  function executableCellFormula(source) {
1578
1600
  return !source || source === "No Formula" || source === "Inh" ? void 0 : source;
@@ -1580,6 +1602,7 @@ function executableCellFormula(source) {
1580
1602
  function inertDoubleClickFormula(cell, source) {
1581
1603
  return cell === "EventDblClick" && /^\s*=?\s*(OPENTEXTWIN|DEFAULTEVENT)\(\s*\)\s*$/i.test(source);
1582
1604
  }
1605
+ var shapeDataFormulaSection = (name3) => name3 === "Property" ? "Prop" : name3;
1583
1606
 
1584
1607
  // visio/formula-theme.ts
1585
1608
  var themeInputs = [
@@ -2969,6 +2992,19 @@ function createBox(root2, document, edit) {
2969
2992
  value,
2970
2993
  name3 === "LocPinX" ? "Width*0.5" : name3 === "LocPinY" ? "Height*0.5" : void 0
2971
2994
  );
2995
+ if (edit.followShapeId !== void 0) {
2996
+ const owner = admitted(root2, edit.followShapeId);
2997
+ const local = cells(owner);
2998
+ if (isLineSheet(local))
2999
+ fail("UNSUPPORTED_GEOMETRY_EDIT", "Position followers require a 2D owner.");
3000
+ for (const [name3, value] of [
3001
+ ["PinX", edit.x],
3002
+ ["PinY", edit.y]
3003
+ ]) {
3004
+ const offset = value - numeric(local.get(name3));
3005
+ setCell(shape, name3, value, `Sheet.${edit.followShapeId}!${name3}+(${offset}IN)`);
3006
+ }
3007
+ }
2972
3008
  return shape;
2973
3009
  }
2974
3010
  function createRectangle(root2, document, edit) {
@@ -3552,7 +3588,7 @@ function indexCells(roots, options) {
3552
3588
  for (const node2 of children2(sheet.node, "Cell"))
3553
3589
  addNode(node2, attribute2(node2, "N") ?? "", false, false, glue);
3554
3590
  for (const section3 of children2(sheet.node, "Section")) {
3555
- const name3 = attribute2(section3, "N") ?? "";
3591
+ const name3 = shapeDataFormulaSection(attribute2(section3, "N") ?? "");
3556
3592
  const prefix2 = name3 === "Geometry" ? `Geometry${Number(attribute2(section3, "IX") ?? "0") + 1}` : name3;
3557
3593
  const deleted4 = ["1", "true"].includes(attribute2(section3, "Del") ?? "");
3558
3594
  for (const node2 of children2(section3, "Cell"))
@@ -4148,6 +4184,7 @@ function effectiveShapeCell(shape, document, name3, category, rows) {
4148
4184
  if (delegatedLocal && !(category === "TextStyle" && cellName && ["Character", "Paragraph"].includes(section3)))
4149
4185
  fail("EDIT_PROTECTED_CELL", "Inherited formatting cells cannot be overwritten.");
4150
4186
  if (local && !cellName) return local;
4187
+ if (/^ConLineJump(?:Code|Style|DirX|DirY)$/.test(name3)) return void 0;
4151
4188
  if (cellName) {
4152
4189
  const sources = rows?.source ?? effectiveFormattingRows(shape, document, section3);
4153
4190
  const cells4 = sources.get(index) ?? sources.get("0");
@@ -4388,14 +4425,9 @@ function serializeEditedXml(root2, limits, check) {
4388
4425
  const node2 = pending.pop();
4389
4426
  if ((node2.nodeType === 3 || node2.nodeType === 4) && node2.nodeValue?.includes("\r"))
4390
4427
  fail("UNSUPPORTED_XML_EDIT", "Carriage-return text cannot be preserved by this writer.");
4391
- if (node2.nodeType === 1) {
4392
- for (const attr2 of Array.from(node2.attributes))
4393
- if (/[\t\r\n]/.test(attr2.value))
4394
- fail("UNSUPPORTED_XML_EDIT", "Attribute whitespace cannot be preserved by this writer.");
4395
- }
4396
4428
  for (const child3 of Array.from(node2.childNodes)) pending.push(child3);
4397
4429
  }
4398
- let xml = buildXml(root2.ownerDocument);
4430
+ let xml = preserveAttributeWhitespace(buildXml(root2.ownerDocument));
4399
4431
  xml = xml.replace(
4400
4432
  /^<\?xml\s[^?]*\?>/,
4401
4433
  (declaration) => declaration.replace(/encoding\s*=\s*(['"])[^'"]*\1/, 'encoding="UTF-8"')
@@ -7263,10 +7295,10 @@ function orderedColorTransforms(channels, transforms) {
7263
7295
  else if (name3 === "inv") [r, g, b] = [255 - r, 255 - g, 255 - b];
7264
7296
  else if (name3 === "gray") r = g = b = 0.299 * r + 0.587 * g + 0.114 * b;
7265
7297
  else if ((name3 === "shade" || name3 === "tint") && fraction !== void 0) {
7266
- const mix2 = (channel) => linearToSrgb255(
7298
+ const mix3 = (channel) => linearToSrgb255(
7267
7299
  name3 === "shade" ? srgb255ToLinear(channel) * fraction : 1 - (1 - srgb255ToLinear(channel)) * fraction
7268
7300
  );
7269
- [r, g, b] = [mix2(r), mix2(g), mix2(b)];
7301
+ [r, g, b] = [mix3(r), mix3(g), mix3(b)];
7270
7302
  } else {
7271
7303
  const hsl = rgbToHsl(r, g, b);
7272
7304
  if (name3 === "comp") hsl.h = wrap(hsl.h + 180);
@@ -8619,6 +8651,230 @@ function characterExtras(cells4, report) {
8619
8651
  };
8620
8652
  }
8621
8653
 
8654
+ // visio/text-field-case.ts
8655
+ var LOWER = [
8656
+ [65, 90, 1, 32],
8657
+ [192, 214, 1, 32],
8658
+ [216, 222, 1, 32],
8659
+ [256, 302, 2, 1],
8660
+ [304, 304, 2, -199],
8661
+ [306, 310, 2, 1],
8662
+ [313, 327, 2, 1],
8663
+ [330, 374, 2, 1],
8664
+ [376, 376, 1, -121],
8665
+ [377, 381, 2, 1],
8666
+ [385, 385, 1, 210],
8667
+ [386, 388, 2, 1],
8668
+ [390, 390, 1, 206],
8669
+ [391, 391, 2, 1],
8670
+ [393, 394, 1, 205],
8671
+ [395, 395, 1, 1],
8672
+ [398, 398, 1, 79],
8673
+ [399, 399, 1, 202],
8674
+ [400, 400, 1, 203],
8675
+ [401, 401, 2, 1],
8676
+ [403, 403, 1, 205],
8677
+ [404, 404, 2, 207],
8678
+ [406, 406, 1, 211],
8679
+ [407, 407, 1, 209],
8680
+ [408, 408, 1, 1],
8681
+ [412, 412, 1, 211],
8682
+ [413, 413, 2, 213],
8683
+ [415, 415, 1, 214],
8684
+ [416, 420, 2, 1],
8685
+ [422, 422, 1, 218],
8686
+ [423, 423, 2, 1],
8687
+ [425, 425, 1, 218],
8688
+ [428, 428, 2, 1],
8689
+ [430, 430, 1, 218],
8690
+ [431, 431, 2, 1],
8691
+ [433, 434, 1, 217],
8692
+ [435, 437, 2, 1],
8693
+ [439, 439, 1, 219],
8694
+ [440, 440, 1, 1],
8695
+ [444, 444, 1, 1],
8696
+ [452, 452, 1, 2],
8697
+ [453, 453, 2, 1],
8698
+ [455, 455, 1, 2],
8699
+ [456, 456, 2, 1],
8700
+ [458, 458, 1, 2],
8701
+ [459, 475, 2, 1],
8702
+ [478, 494, 2, 1],
8703
+ [497, 497, 1, 2],
8704
+ [498, 500, 2, 1],
8705
+ [502, 502, 1, -97],
8706
+ [503, 503, 1, -56],
8707
+ [504, 542, 2, 1],
8708
+ [544, 544, 2, -130],
8709
+ [546, 562, 2, 1],
8710
+ [570, 570, 1, 10795],
8711
+ [571, 571, 2, 1],
8712
+ [573, 573, 1, -163],
8713
+ [574, 574, 1, 10792],
8714
+ [577, 577, 2, 1],
8715
+ [579, 579, 1, -195],
8716
+ [580, 580, 1, 69],
8717
+ [581, 581, 1, 71],
8718
+ [582, 590, 2, 1],
8719
+ [902, 902, 2, 38],
8720
+ [904, 906, 1, 37],
8721
+ [908, 908, 2, 64],
8722
+ [910, 911, 1, 63],
8723
+ [913, 929, 1, 32],
8724
+ [931, 939, 1, 32],
8725
+ [986, 1006, 2, 1],
8726
+ [1024, 1039, 1, 80],
8727
+ [1040, 1071, 1, 32],
8728
+ [1120, 1152, 2, 1],
8729
+ [1162, 1214, 2, 1],
8730
+ [1216, 1216, 1, 15],
8731
+ [1217, 1229, 2, 1],
8732
+ [1232, 1298, 2, 1],
8733
+ [1329, 1366, 1, 48],
8734
+ [4256, 4293, 1, 48],
8735
+ [7680, 7828, 2, 1],
8736
+ [7840, 7928, 2, 1],
8737
+ [8498, 8498, 1, 28],
8738
+ [8579, 8579, 1, 1],
8739
+ [9398, 9423, 1, 26],
8740
+ [11360, 11360, 2, 1],
8741
+ [11362, 11362, 1, -10743],
8742
+ [11363, 11363, 1, -3814],
8743
+ [11364, 11364, 1, -10727],
8744
+ [11367, 11371, 2, 1],
8745
+ [11381, 11381, 1, 1],
8746
+ [65313, 65338, 1, 32],
8747
+ [66560, 66599, 1, 40],
8748
+ [66736, 66771, 1, 40],
8749
+ [68736, 68786, 1, 64],
8750
+ [71840, 71871, 1, 32],
8751
+ [93760, 93791, 1, 32],
8752
+ [125184, 125217, 1, 34]
8753
+ ];
8754
+ var UPPER = [
8755
+ [97, 122, 1, -32],
8756
+ [224, 246, 1, -32],
8757
+ [248, 254, 1, -32],
8758
+ [255, 255, 2, 121],
8759
+ [257, 303, 2, -1],
8760
+ [305, 305, 2, -232],
8761
+ [307, 311, 2, -1],
8762
+ [314, 328, 2, -1],
8763
+ [331, 375, 2, -1],
8764
+ [378, 382, 2, -1],
8765
+ [384, 384, 1, 195],
8766
+ [387, 389, 2, -1],
8767
+ [392, 392, 1, -1],
8768
+ [396, 396, 1, -1],
8769
+ [402, 402, 1, -1],
8770
+ [405, 405, 1, 97],
8771
+ [409, 409, 1, -1],
8772
+ [410, 410, 1, 163],
8773
+ [414, 414, 1, 130],
8774
+ [417, 421, 2, -1],
8775
+ [424, 424, 1, -1],
8776
+ [429, 429, 1, -1],
8777
+ [432, 432, 1, -1],
8778
+ [436, 438, 2, -1],
8779
+ [441, 441, 1, -1],
8780
+ [445, 445, 2, -1],
8781
+ [447, 447, 1, 56],
8782
+ [453, 453, 1, -1],
8783
+ [454, 454, 2, -2],
8784
+ [456, 456, 1, -1],
8785
+ [457, 457, 2, -2],
8786
+ [459, 459, 1, -1],
8787
+ [460, 460, 2, -2],
8788
+ [462, 476, 2, -1],
8789
+ [477, 477, 2, -79],
8790
+ [479, 495, 2, -1],
8791
+ [498, 498, 1, -1],
8792
+ [499, 499, 2, -2],
8793
+ [501, 501, 1, -1],
8794
+ [505, 543, 2, -1],
8795
+ [547, 563, 2, -1],
8796
+ [572, 572, 1, -1],
8797
+ [578, 578, 1, -1],
8798
+ [583, 591, 2, -1],
8799
+ [595, 595, 1, -210],
8800
+ [596, 596, 2, -206],
8801
+ [598, 599, 1, -205],
8802
+ [601, 601, 2, -202],
8803
+ [603, 603, 1, -203],
8804
+ [608, 608, 1, -205],
8805
+ [611, 611, 1, -207],
8806
+ [616, 616, 1, -209],
8807
+ [617, 617, 2, -211],
8808
+ [619, 619, 1, 10743],
8809
+ [623, 623, 1, -211],
8810
+ [626, 626, 1, -213],
8811
+ [629, 629, 1, -214],
8812
+ [637, 637, 1, 10727],
8813
+ [640, 640, 1, -218],
8814
+ [643, 643, 1, -218],
8815
+ [648, 648, 1, -218],
8816
+ [649, 649, 1, -69],
8817
+ [650, 651, 1, -217],
8818
+ [652, 652, 1, -71],
8819
+ [658, 658, 1, -219],
8820
+ [912, 912, 1, 26],
8821
+ [940, 940, 1, -38],
8822
+ [941, 943, 1, -37],
8823
+ [944, 944, 1, -5],
8824
+ [945, 961, 1, -32],
8825
+ [962, 962, 1, -31],
8826
+ [963, 971, 1, -32],
8827
+ [972, 972, 1, -64],
8828
+ [973, 974, 1, -63],
8829
+ [976, 976, 1, -62],
8830
+ [977, 977, 1, -57],
8831
+ [981, 981, 1, -47],
8832
+ [982, 982, 1, -54],
8833
+ [987, 1007, 2, -1],
8834
+ [1008, 1008, 1, -86],
8835
+ [1009, 1009, 1, -80],
8836
+ [1072, 1103, 1, -32],
8837
+ [1104, 1119, 1, -80],
8838
+ [1121, 1153, 2, -1],
8839
+ [1163, 1215, 2, -1],
8840
+ [1218, 1230, 2, -1],
8841
+ [1231, 1231, 2, -15],
8842
+ [1233, 1299, 2, -1],
8843
+ [1377, 1414, 1, -48],
8844
+ [7549, 7549, 1, 3814],
8845
+ [7681, 7829, 2, -1],
8846
+ [7841, 7929, 2, -1],
8847
+ [8526, 8526, 1, -28],
8848
+ [8580, 8580, 1, -1],
8849
+ [9424, 9449, 1, -26],
8850
+ [11361, 11361, 1, -1],
8851
+ [11365, 11365, 1, -10795],
8852
+ [11366, 11366, 2, -10792],
8853
+ [11368, 11372, 2, -1],
8854
+ [11382, 11382, 1, -1],
8855
+ [65345, 65370, 1, -32],
8856
+ [66600, 66639, 1, -40],
8857
+ [66776, 66811, 1, -40],
8858
+ [68800, 68850, 1, -64],
8859
+ [71872, 71903, 1, -32],
8860
+ [93792, 93823, 1, -32],
8861
+ [125218, 125251, 1, -34]
8862
+ ];
8863
+ function visioFieldCase(text5, upper) {
8864
+ const ranges = upper ? UPPER : LOWER;
8865
+ return Array.from(text5, (character) => {
8866
+ const point2 = character.codePointAt(0);
8867
+ let low = 0, high = ranges.length;
8868
+ while (low < high) {
8869
+ const middle = low + high >>> 1;
8870
+ if (ranges[middle][1] < point2) low = middle + 1;
8871
+ else high = middle;
8872
+ }
8873
+ const range2 = ranges[low];
8874
+ return range2 && point2 >= range2[0] && (point2 - range2[0]) % range2[2] === 0 ? String.fromCodePoint(point2 + range2[3]) : character;
8875
+ }).join("");
8876
+ }
8877
+
8622
8878
  // visio/text-fields.ts
8623
8879
  var PROPERTY_FUNCTIONS = {
8624
8880
  TITLE: "title",
@@ -8655,7 +8911,6 @@ function visioWallClock(date2) {
8655
8911
  );
8656
8912
  }
8657
8913
  var EPOCH = Date.UTC(1899, 11, 30);
8658
- var visioDateSerial = (date2) => Number(((date2.getTime() - EPOCH) / 864e5).toFixed(8));
8659
8914
  var visioSerialDate = (serial) => Number.isFinite(serial) && Math.abs(serial) < 3e6 ? new Date(EPOCH + Math.round(serial * 864e5)) : void 0;
8660
8915
  function evaluateVisioTextField(formula, context) {
8661
8916
  let ast;
@@ -8766,7 +9021,10 @@ function formatNumber(value, picture) {
8766
9021
  if (!match) return void 0;
8767
9022
  const decimals = match[2]?.length ?? 0;
8768
9023
  const optional = match[2]?.startsWith("#") ?? false;
8769
- let text5 = value.toFixed(decimals);
9024
+ const [coefficient, exponent = "0"] = Math.abs(value).toString().split("e");
9025
+ const shifted = Number(coefficient + "e" + (Number(exponent) + decimals));
9026
+ const rounded = Math.floor(shifted + 0.5) / 10 ** decimals;
9027
+ let text5 = (Math.sign(value) * rounded).toFixed(decimals);
8770
9028
  if (optional && text5.includes(".")) text5 = text5.replace(/\.?0+$/, "");
8771
9029
  if (match[1]) {
8772
9030
  const [whole, fraction] = text5.split(".");
@@ -8776,6 +9034,7 @@ function formatNumber(value, picture) {
8776
9034
  }
8777
9035
  var VISIO_FIELD_FORMATS = {
8778
9036
  shortDate: "{{M/d/yyyy}}",
9037
+ isoDate: "{{yyyy-MM-dd}}",
8779
9038
  longDate: "{{dddd, MMMM d, yyyy}}",
8780
9039
  time: "{{h:mm tt}}",
8781
9040
  dateTime: "{{M/d/yyyy h:mm tt}}",
@@ -8805,12 +9064,147 @@ function formatVisioFieldValue(value, format4 = "") {
8805
9064
  return units2 || body === "" ? `${text5}${suffix}` : text5;
8806
9065
  }
8807
9066
 
9067
+ // visio/text-field-fraction.ts
9068
+ function fractionalFieldNumber(value, maxDenominator) {
9069
+ if (!Number.isFinite(value) || Math.abs(value) > 1e15) return void 0;
9070
+ const absolute = Math.abs(value);
9071
+ let whole = Math.floor(absolute);
9072
+ const remainder = absolute - whole;
9073
+ let numerator = 0, denominator = 1, error = remainder;
9074
+ for (let candidate = 1; candidate <= maxDenominator; candidate++) {
9075
+ const top = Math.round(remainder * candidate);
9076
+ const fraction = top / candidate;
9077
+ const distance4 = Math.abs(remainder - fraction);
9078
+ if (distance4 < error || distance4 === error && fraction > numerator / denominator) {
9079
+ numerator = top;
9080
+ denominator = candidate;
9081
+ error = distance4;
9082
+ }
9083
+ }
9084
+ if (numerator === denominator) {
9085
+ whole++;
9086
+ numerator = 0;
9087
+ }
9088
+ const text5 = numerator ? `${whole ? whole + " " : ""}${numerator}/${denominator}` : String(whole);
9089
+ return value < 0 && text5 !== "0" ? "-" + text5 : text5;
9090
+ }
9091
+
9092
+ // visio/text-field-numeric.ts
9093
+ function numericFieldPicture(value, code, displayUnit) {
9094
+ if (value.kind !== "number" || code < 0 || code > 18 || code > 9 && code < 15 || !Number.isInteger(code))
9095
+ return void 0;
9096
+ const unit3 = displayUnit?.toUpperCase() ?? "NUM";
9097
+ const units2 = {
9098
+ NUM: ["scalar", 1, ""],
9099
+ IN: ["length", 1, " in."],
9100
+ MM: ["length", 25.4, " mm."],
9101
+ CM: ["length", 2.54, " cm."],
9102
+ FT: ["length", 1 / 12, " ft."],
9103
+ DEG: ["angle", 180 / Math.PI, " deg."],
9104
+ RAD: ["angle", 1, " rad."]
9105
+ };
9106
+ const definition = Object.hasOwn(units2, unit3) ? units2[unit3] : void 0;
9107
+ if (!definition || definition[0] !== value.unit) return void 0;
9108
+ const general = code < 2;
9109
+ const decimals = general ? 4 : Math.floor((code - 2) / 2);
9110
+ const picture = general ? "0.####" : decimals ? `0.${"0".repeat(decimals)}` : "0";
9111
+ const displayed = value.value * definition[1];
9112
+ if (!Number.isFinite(displayed)) return void 0;
9113
+ if (code >= 15) {
9114
+ const fraction = fractionalFieldNumber(displayed, code < 17 ? 9 : 99);
9115
+ return fraction === void 0 ? void 0 : fraction + (code % 2 === 0 ? definition[2] : "");
9116
+ }
9117
+ if ((general || !decimals) && Math.abs(displayed) > 1e15) return void 0;
9118
+ const scientific = decimals > 0 && (Math.abs(displayed) >= 1e15 || displayed !== 0 && Math.abs(displayed) < 0.5 / 10 ** decimals);
9119
+ let text5;
9120
+ if (scientific) {
9121
+ const [coefficient, power] = displayed.toExponential().split("e");
9122
+ let exponent = Number(power);
9123
+ let precision = Math.abs(displayed) >= 1e15 ? decimals : decimals - 1;
9124
+ const mantissaPicture = precision ? `0.${"0".repeat(precision)}` : "0";
9125
+ let mantissa = formatVisioFieldValue(
9126
+ { kind: "number", value: Number(coefficient), unit: "scalar" },
9127
+ mantissaPicture
9128
+ );
9129
+ if (mantissa === void 0) return void 0;
9130
+ if (Math.abs(Number(mantissa)) >= 10) {
9131
+ exponent += 1;
9132
+ precision = decimals;
9133
+ mantissa = Math.sign(displayed).toFixed(precision);
9134
+ }
9135
+ if (general) mantissa = mantissa.replace(/\.?0+$/, "");
9136
+ else if (!mantissa.includes(".")) mantissa += ".";
9137
+ text5 = mantissa + (code % 2 ? "e" : "E") + exponent;
9138
+ } else {
9139
+ text5 = formatVisioFieldValue({ kind: "number", value: displayed, unit: "scalar" }, picture);
9140
+ }
9141
+ return text5 === void 0 ? void 0 : text5 + (code % 2 ? definition[2] : "");
9142
+ }
9143
+
9144
+ // visio/date-cache.ts
9145
+ function visioIsoDateSerial(text5) {
9146
+ const match = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?)?$/.exec(
9147
+ text5.trim()
9148
+ );
9149
+ if (!match) return void 0;
9150
+ const year = Number(match[1]), month = Number(match[2]), day = Number(match[3]);
9151
+ const hour = Number(match[4] ?? 0), minute = Number(match[5] ?? 0), second = Number(match[6] ?? 0);
9152
+ const millisecond = Number((match[7] ?? "").padEnd(3, "0").slice(0, 3));
9153
+ if (year < 1 || hour > 23 || minute > 59 || second > 59) return void 0;
9154
+ const date2 = /* @__PURE__ */ new Date(0);
9155
+ date2.setUTCFullYear(year, month - 1, day);
9156
+ date2.setUTCHours(hour, minute, second, millisecond);
9157
+ if (date2.getUTCFullYear() !== year || date2.getUTCMonth() !== month - 1 || date2.getUTCDate() !== day)
9158
+ return void 0;
9159
+ return (date2.getTime() - Date.UTC(1899, 11, 30)) / 864e5;
9160
+ }
9161
+
9162
+ // visio/text-field-system-date.ts
9163
+ var LONG_DATE = "{{dddd, MMMM d, yyyy}}";
9164
+ function englishLongDateProfile(cached5) {
9165
+ const match = /^[A-Za-z]+, [A-Za-z]+ ([1-9]|[12]\d|3[01]), (\d{4})$/.exec(cached5);
9166
+ if (!match) return false;
9167
+ for (let month = 0; month < 12; month++) {
9168
+ const candidate = /* @__PURE__ */ new Date(0);
9169
+ candidate.setUTCFullYear(Number(match[2]), month, Number(match[1]));
9170
+ if (candidate.getUTCMonth() === month && candidate.getTime() >= Date.UTC(1899, 11, 30) && formatVisioFieldValue({ kind: "date", date: candidate }, LONG_DATE) === cached5)
9171
+ return true;
9172
+ }
9173
+ return false;
9174
+ }
9175
+ function systemDatePicture(date2, code, cached5) {
9176
+ if (!Number.isFinite(date2.getTime()) || date2.getTime() < Date.UTC(1899, 11, 30) || date2.getUTCFullYear() > 9999)
9177
+ return void 0;
9178
+ if (code === "204") return formatVisioFieldValue({ kind: "date", date: date2 }, "{{yyyy-MM-dd}}");
9179
+ if (code === "21" || code === "201")
9180
+ return englishLongDateProfile(cached5) ? formatVisioFieldValue({ kind: "date", date: date2 }, LONG_DATE) : void 0;
9181
+ if (code === "20" || code === "200") {
9182
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(cached5) || visioIsoDateSerial(cached5) === void 0)
9183
+ return void 0;
9184
+ return formatVisioFieldValue({ kind: "date", date: date2 }, "{{yyyy-MM-dd}}");
9185
+ }
9186
+ if (code !== "211" && code !== "212") return void 0;
9187
+ const match = /^(\d{4}-\d{2}-\d{2}) ([1-9]|1[0-2]):([0-5]\d)(?::([0-5]\d))? (AM|PM)$/.exec(
9188
+ cached5
9189
+ );
9190
+ if (!match || code === "212" !== (match[4] !== void 0)) return void 0;
9191
+ const hour = Number(match[2]) % 12 + (match[5] === "PM" ? 12 : 0);
9192
+ if (visioIsoDateSerial(
9193
+ `${match[1]}T${String(hour).padStart(2, "0")}:${match[3]}:${match[4] ?? "00"}`
9194
+ ) === void 0)
9195
+ return void 0;
9196
+ return formatVisioFieldValue(
9197
+ { kind: "date", date: date2 },
9198
+ code === "211" ? "{{yyyy-MM-dd h:mm tt}}" : "{{yyyy-MM-dd h:mm:ss tt}}"
9199
+ );
9200
+ }
9201
+
8808
9202
  // visio/text-field-display.ts
8809
9203
  function cachedValue(value, unit3) {
8810
9204
  if (value === void 0) return void 0;
8811
9205
  if (unit3 === "STR") return { kind: "string", text: value };
8812
9206
  if (unit3 === "DATE") {
8813
- const date2 = visioSerialDate(Number(value));
9207
+ const date2 = visioSerialDate(visioIsoDateSerial(value) ?? Number(value));
8814
9208
  return date2 ? { kind: "date", date: date2 } : void 0;
8815
9209
  }
8816
9210
  try {
@@ -8827,11 +9221,23 @@ function textFieldDisplay(element2, sheet, context) {
8827
9221
  const value = row2?.cells.get("Value"), format4 = row2?.cells.get("Format");
8828
9222
  const formula = value?.formula && value.formula !== "Inh" ? value.formula : void 0;
8829
9223
  const result = { cached: cached5, ...formula ? { formula } : {} };
8830
- if (!row2 || !context || format4?.formula && /^\s*FIELDPICTURE\s*\(/i.test(format4.formula))
8831
- return { text: cached5, ...result };
9224
+ if (!row2 || !context) return { text: cached5, ...result };
8832
9225
  const picture = format4?.value ?? "";
8833
9226
  const evaluated = formula ? evaluateVisioTextField(formula, context) : void 0;
8834
9227
  const source = evaluated ?? cachedValue(value?.value, value?.unit);
9228
+ if (format4?.formula && /^\s*FIELDPICTURE\s*\(/i.test(format4.formula)) {
9229
+ const code = /^\s*FIELDPICTURE\s*\(\s*(\d+)\s*\)\s*$/i.exec(format4.formula)?.[1];
9230
+ let text6 = cached5;
9231
+ if (source?.kind === "string") {
9232
+ if (code === "0" || code === "37") text6 = source.text;
9233
+ else if (code === "38" || code === "39") text6 = visioFieldCase(source.text, code === "39");
9234
+ }
9235
+ if (source?.kind === "number" && code !== void 0)
9236
+ text6 = numericFieldPicture(source, Number(code), value?.unit) ?? cached5;
9237
+ if (source?.kind === "date" && code !== void 0)
9238
+ text6 = systemDatePicture(source.date, code, cached5) ?? cached5;
9239
+ return { text: text6, ...result };
9240
+ }
8835
9241
  const text5 = source ? formatVisioFieldValue(source, picture) : void 0;
8836
9242
  return { text: text5 ?? cached5, ...result };
8837
9243
  }
@@ -9426,7 +9832,7 @@ function geometryPaths(sheet, width, height, report, consume, consumeWork = () =
9426
9832
  else {
9427
9833
  const radius = chord * chord / (8 * Math.abs(bow)) + Math.abs(bow) / 2;
9428
9834
  commands.push(
9429
- `A ${point(radius, radius)} 0 ${Math.abs(bow) > chord / 2 ? 1 : 0} ${bow < 0 ? 1 : 0} ${point(x, y)}`
9835
+ `A ${point(radius, radius)} 0 ${Math.abs(bow) > chord / 2 ? 1 : 0} ${bow < 0 ? 0 : 1} ${point(x, y)}`
9430
9836
  );
9431
9837
  }
9432
9838
  break;
@@ -10286,15 +10692,6 @@ function booleanValue(text5) {
10286
10692
  const value = numeric3(text5);
10287
10693
  return value === void 0 ? void 0 : value !== 0;
10288
10694
  }
10289
- function isoSerialDays(text5) {
10290
- const match = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2}(?:\.\d+)?))?)?$/.exec(
10291
- text5.trim()
10292
- );
10293
- if (!match) return void 0;
10294
- const [year, month, day, hour, minute, second] = match.slice(1).map((part) => Number(part ?? 0));
10295
- const time = Date.UTC(year, month - 1, day, hour, minute, second);
10296
- return Number.isFinite(time) ? (time - Date.UTC(1899, 11, 30)) / 864e5 : void 0;
10297
- }
10298
10695
  function property(row2, budget, report) {
10299
10696
  const get = (key2) => cached(row2.cells, key2, budget, report);
10300
10697
  const rawType = get("Type"), rawValue = get("Value");
@@ -10305,7 +10702,7 @@ function property(row2, budget, report) {
10305
10702
  if (rawValue !== void 0 && row2.cells.get("Value")?.error === void 0) {
10306
10703
  if (type === 0 || type === 1 || type === 4) value = budget.retain(rawValue);
10307
10704
  else if (type === 3) value = booleanValue(rawValue);
10308
- else if (type === 5) value = numeric3(rawValue) ?? isoSerialDays(rawValue);
10705
+ else if (type === 5) value = numeric3(rawValue) ?? visioIsoDateSerial(rawValue);
10309
10706
  else if (valueKind !== "unparsed") value = numeric3(rawValue);
10310
10707
  }
10311
10708
  if (value === void 0) {
@@ -10402,6 +10799,21 @@ function hyperlink(row2, budget, report) {
10402
10799
  ...sortKey === void 0 ? {} : { sortKey }
10403
10800
  };
10404
10801
  }
10802
+ function alternativeTextMetadata(sheet, report, budget) {
10803
+ const result = {};
10804
+ for (const section3 of sheet.sections.values()) {
10805
+ if (section3.deleted || section3.name !== "User") continue;
10806
+ for (const row2 of section3.rows.values()) {
10807
+ if (row2.deleted || !["visAltText", "visAltDescription"].includes(row2.name ?? row2.index))
10808
+ continue;
10809
+ budget.consumeRow();
10810
+ const value = cached(row2.cells, "Value", budget, report);
10811
+ if (value !== void 0)
10812
+ result[(row2.name ?? row2.index) === "visAltText" ? "accessibilityTitle" : "alternativeText"] = value;
10813
+ }
10814
+ }
10815
+ return result;
10816
+ }
10405
10817
  function shapeMetadata(sheet, report, budget = createMetadataBudget()) {
10406
10818
  const shapeData = [], hyperlinks = [];
10407
10819
  let count = 0;
@@ -10418,7 +10830,12 @@ function shapeMetadata(sheet, report, budget = createMetadataBudget()) {
10418
10830
  }
10419
10831
  const comment = sheet.cells.get("Comment");
10420
10832
  const screenTip = comment?.value && comment.error === void 0 ? budget.retain(comment.value) : void 0;
10421
- return { shapeData, hyperlinks, ...screenTip === void 0 ? {} : { screenTip } };
10833
+ return {
10834
+ shapeData,
10835
+ hyperlinks,
10836
+ ...alternativeTextMetadata(sheet, report, budget),
10837
+ ...screenTip === void 0 ? {} : { screenTip }
10838
+ };
10422
10839
  }
10423
10840
 
10424
10841
  // visio/theme-root.ts
@@ -10777,6 +11194,31 @@ function shapeConnections(sheet, local, inheritedSheet, transform2, oneD, report
10777
11194
  return result;
10778
11195
  }
10779
11196
 
11197
+ // visio/connector-jumps.ts
11198
+ function readConnectorJumps(cells4, report) {
11199
+ const result = {};
11200
+ for (const [key2, name3, maximum] of [
11201
+ ["lineJumpCode", "ConLineJumpCode", 4],
11202
+ ["lineJumpStyle", "ConLineJumpStyle", 9],
11203
+ ["lineJumpDirectionX", "ConLineJumpDirX", 2],
11204
+ ["lineJumpDirectionY", "ConLineJumpDirY", 2]
11205
+ ]) {
11206
+ const cell = cells4.get(name3);
11207
+ if (!cell || cell.formula === "Inh") continue;
11208
+ const raw = cell.value?.trim();
11209
+ const value = raw && raw.length <= 64 && /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(raw) ? Number(raw) : NaN;
11210
+ if (cell.error !== void 0 || !Number.isInteger(value) || value < 0 || value > maximum) {
11211
+ report(
11212
+ "unsupported-connector-jump",
11213
+ `${name3} has no supported cached value; the page setting is used.`
11214
+ );
11215
+ continue;
11216
+ }
11217
+ result[key2] = value;
11218
+ }
11219
+ return result;
11220
+ }
11221
+
10780
11222
  // visio/shapes.ts
10781
11223
  function mergeShape(base2, local, context) {
10782
11224
  context.consumeExpansion();
@@ -10939,6 +11381,7 @@ function normalizeShapes(raw, context, depth = 0, masterStack = []) {
10939
11381
  report("missing-geometry", "Shape has no supported cached geometry.");
10940
11382
  return {
10941
11383
  ...shapeMetadata(sheet, report, context.metadataBudget),
11384
+ ...oneD ? readConnectorJumps(sheet.cells, report) : {},
10942
11385
  ...structureOf(sheet),
10943
11386
  id: shape.id,
10944
11387
  name: shape.attributes.get("Name") ?? shape.attributes.get("NameU") ?? `Shape ${shape.id}`,
@@ -11162,6 +11605,12 @@ var VISIO_RULER_DENSITIES = Object.freeze([8, 16, 32]);
11162
11605
  var VISIO_PAGE_LAYOUT_DEFAULTS = Object.freeze({
11163
11606
  lineJumpCode: 1,
11164
11607
  lineJumpStyle: 0,
11608
+ lineJumpDirectionX: 0,
11609
+ lineJumpDirectionY: 0,
11610
+ lineJumpFactorX: 2 / 3,
11611
+ lineJumpFactorY: 2 / 3,
11612
+ lineToLineX: 0.125,
11613
+ lineToLineY: 0.125,
11165
11614
  gridDensityX: 8,
11166
11615
  gridDensityY: 8,
11167
11616
  gridSpacingX: 0,
@@ -11176,6 +11625,12 @@ var VISIO_PAGE_LAYOUT_DEFAULTS = Object.freeze({
11176
11625
  var NAMES = {
11177
11626
  lineJumpCode: "LineJumpCode",
11178
11627
  lineJumpStyle: "LineJumpStyle",
11628
+ lineJumpDirectionX: "PageLineJumpDirX",
11629
+ lineJumpDirectionY: "PageLineJumpDirY",
11630
+ lineJumpFactorX: "LineJumpFactorX",
11631
+ lineJumpFactorY: "LineJumpFactorY",
11632
+ lineToLineX: "LineToLineX",
11633
+ lineToLineY: "LineToLineY",
11179
11634
  gridDensityX: "XGridDensity",
11180
11635
  gridDensityY: "YGridDensity",
11181
11636
  gridSpacingX: "XGridSpacing",
@@ -12037,6 +12492,7 @@ async function parseVsdx(input, options = {}) {
12037
12492
  localReport("dangling-connection", "A connection references a missing shape.");
12038
12493
  pages.push({
12039
12494
  id: id3,
12495
+ ...alternativeTextMetadata(sheet, localReport, context.metadataBudget),
12040
12496
  ...pageModes,
12041
12497
  ...drawingToPageScale === 1 ? {} : { drawingToPageScale },
12042
12498
  ...pageSetup ? { pageSetup } : {},
@@ -21574,6 +22030,9 @@ async function assertFormattingDependencies(pkg, pagePaths, roots, pageId2, shap
21574
22030
  indexCells(roots, { check });
21575
22031
  const shapeId2 = attribute2(shape, "ID");
21576
22032
  const changedNames = new Set([...changed.keys()].map((name3) => name3.toLowerCase()));
22033
+ const jumpOnly = [...changedNames].every(
22034
+ (name3) => /^conlinejump(code|style|dirx|diry)$/.test(name3)
22035
+ );
21577
22036
  const canonical2 = (name3) => name3.toLowerCase().replace(/^char\.([a-z]+)$/, "character.0.$1").replace(/^para\.([a-z]+)$/, "paragraph.0.$1");
21578
22037
  const replaced = new Set(changed.values());
21579
22038
  const textEdit = [...changedNames].some(
@@ -21594,6 +22053,9 @@ async function assertFormattingDependencies(pkg, pagePaths, roots, pageId2, shap
21594
22053
  if (!source || inertDoubleClickFormula(attribute2(node2, "N") ?? "", source)) continue;
21595
22054
  if (attribute2(node2, "V") === "Themed" && isThemeLookupFormula(source)) continue;
21596
22055
  if (isConnectedGlueCell(node2, source)) continue;
22056
+ const owner = node2.parentNode;
22057
+ if (jumpOnly && node2.localName === "Cell" && /^(BegTrigger|EndTrigger)$/.test(attribute2(node2, "N") ?? "") && owner?.localName === "Shape" && owner.parentNode?.parentNode?.localName === "PageContents" && visioGlueTriggerTarget(source) === attribute2(owner, "ID"))
22058
+ continue;
21597
22059
  let localShapeId;
21598
22060
  let parent = node2;
21599
22061
  while (parent?.nodeType === 1) {
@@ -21676,7 +22138,7 @@ function masterCells(sheet, charge = () => {
21676
22138
  };
21677
22139
  for (const node2 of children2(sheet, "Cell")) add(attribute2(node2, "N") ?? "", node2);
21678
22140
  for (const section3 of children2(sheet, "Section")) {
21679
- const name3 = attribute2(section3, "N") ?? "";
22141
+ const name3 = shapeDataFormulaSection(attribute2(section3, "N") ?? "");
21680
22142
  const prefix2 = name3 === "Geometry" ? `Geometry${Number(attribute2(section3, "IX") ?? "0") + 1}` : name3 === "Control" ? "Controls" : name3;
21681
22143
  for (const node2 of children2(section3, "Cell"))
21682
22144
  add(`${prefix2}.${attribute2(node2, "N") ?? ""}`, node2);
@@ -23218,6 +23680,99 @@ function connectorObstacles(root2, exclude) {
23218
23680
  return result;
23219
23681
  }
23220
23682
 
23683
+ // visio/connector-curve-aligned.ts
23684
+ function alignedVisioCurve(begin, end) {
23685
+ const a = begin.shape;
23686
+ const b = end.shape;
23687
+ if (!a || !b) return void 0;
23688
+ for (const shape of [a, b])
23689
+ if (shape.corners.some(
23690
+ (p) => Math.abs(p.x - shape.bounds.minX) > 1e-9 && Math.abs(p.x - shape.bounds.maxX) > 1e-9 || Math.abs(p.y - shape.bounds.minY) > 1e-9 && Math.abs(p.y - shape.bounds.maxY) > 1e-9
23691
+ ))
23692
+ return void 0;
23693
+ for (const axis of ["x", "y"]) {
23694
+ const horizontal2 = axis === "x";
23695
+ const low = horizontal2 ? "minY" : "minX";
23696
+ const high = horizontal2 ? "maxY" : "maxX";
23697
+ const overlapLow = Math.max(a.bounds[low], b.bounds[low]);
23698
+ const overlapHigh = Math.min(a.bounds[high], b.bounds[high]);
23699
+ if (overlapHigh - overlapLow <= 1e-9) continue;
23700
+ const forward = b.center[axis] > a.center[axis];
23701
+ const from = horizontal2 ? a.bounds[forward ? "maxX" : "minX"] : a.bounds[forward ? "maxY" : "minY"];
23702
+ const to = horizontal2 ? b.bounds[forward ? "minX" : "maxX"] : b.bounds[forward ? "minY" : "maxY"];
23703
+ if ((to - from) * (forward ? 1 : -1) <= 1e-9) continue;
23704
+ const middle = (overlapLow + overlapHigh) / 2;
23705
+ return [0, 0.25, 0.75, 1].map((t) => {
23706
+ const along = from + (to - from) * t;
23707
+ return horizontal2 ? { x: along, y: middle } : { x: middle, y: along };
23708
+ });
23709
+ }
23710
+ return void 0;
23711
+ }
23712
+
23713
+ // visio/connector-curve-spans.ts
23714
+ var mix = (a, b, t) => ({
23715
+ x: a.x + (b.x - a.x) * t,
23716
+ y: a.y + (b.y - a.y) * t
23717
+ });
23718
+ function cornerCurve(path) {
23719
+ const [begin, corner, end] = path;
23720
+ return [begin, mix(begin, corner, 0.25), corner, mix(corner, end, 0.75), end];
23721
+ }
23722
+ function cornerCurveKnots(points) {
23723
+ const distance4 = (a, b) => Math.hypot(points[b].x - points[a].x, points[b].y - points[a].y) / 3;
23724
+ const internal = distance4(0, 3);
23725
+ return [internal, internal + distance4(1, 4)];
23726
+ }
23727
+ function connectorCurveSpans(points) {
23728
+ if (points.length === 4) return [[...points]];
23729
+ if (points.length !== 5) return [];
23730
+ const [internal, last] = cornerCurveKnots(points);
23731
+ const ratio = internal / last;
23732
+ const left = mix(points[1], points[2], ratio);
23733
+ const right2 = mix(points[2], points[3], ratio);
23734
+ const join = mix(left, right2, ratio);
23735
+ return [
23736
+ [points[0], points[1], left, join],
23737
+ [join, right2, points[3], points[4]]
23738
+ ];
23739
+ }
23740
+ function connectorPolylineMiddle(points) {
23741
+ const lengths = points.slice(1).map((p, i) => Math.hypot(p.x - points[i].x, p.y - points[i].y));
23742
+ let remaining = lengths.reduce((sum, length) => sum + length, 0) / 2;
23743
+ for (const [i, length] of lengths.entries()) {
23744
+ if (remaining <= length && length > 0)
23745
+ return mix(points[i], points[i + 1], remaining / length);
23746
+ remaining -= length;
23747
+ }
23748
+ return points.at(-1);
23749
+ }
23750
+ function flattenCornerCurve(points) {
23751
+ const [internal, last] = cornerCurveKnots(points);
23752
+ const flattened = flattenNurbs(
23753
+ points.map((p) => ({ ...p, weight: 1 })),
23754
+ [0, 0, 0, 0, internal, last, last, last, last],
23755
+ 3,
23756
+ () => {
23757
+ },
23758
+ () => {
23759
+ }
23760
+ );
23761
+ return flattened ? [points[0], ...flattened] : void 0;
23762
+ }
23763
+ function connectorCurveMiddle(points) {
23764
+ const spans = connectorCurveSpans(points);
23765
+ if (points.length === 5) {
23766
+ const flattened = flattenCornerCurve(points);
23767
+ if (flattened) return connectorPolylineMiddle(flattened);
23768
+ return mix(points[0], points.at(-1), 0.5);
23769
+ }
23770
+ const row2 = [...spans[0]];
23771
+ for (let count = row2.length - 1; count > 0; count--)
23772
+ for (let i = 0; i < count; i++) row2[i] = mix(row2[i], row2[i + 1], 0.5);
23773
+ return row2[0];
23774
+ }
23775
+
23221
23776
  // visio/connector-route-walk.ts
23222
23777
  var EPSILON3 = 1e-9;
23223
23778
  var CHANNEL = 2 * VISIO_ROUTE_CLEARANCE;
@@ -23286,9 +23841,25 @@ function visioWalkRoute(begin, end, route, obstacles = []) {
23286
23841
  const q = end.shape ? exit(end.shape, center(begin)) : end.point;
23287
23842
  return Math.hypot(q.x - p.x, q.y - p.y) > EPSILON3 ? [p, q] : void 0;
23288
23843
  }
23844
+ if (route === "curved") {
23845
+ const aligned = alignedVisioCurve(begin, end);
23846
+ if (aligned && !routeCrossings(aligned, obstacles)) return aligned;
23847
+ }
23289
23848
  const path = visioWalkPath(begin, end);
23290
23849
  if (!path || routeCrossings(path, obstacles)) return void 0;
23291
23850
  if (route === "right-angle") return path;
23851
+ if (path.length === 3 && begin.shape && end.shape && [begin.shape, end.shape].every(
23852
+ (shape) => shape.sites.every(
23853
+ (site) => Math.abs(site.normal.x) < EPSILON3 || Math.abs(site.normal.y) < EPSILON3
23854
+ )
23855
+ )) {
23856
+ const curve = cornerCurve(path);
23857
+ if (obstacles.length) {
23858
+ const sampled = flattenCornerCurve(curve);
23859
+ if (!sampled || routeCrossings(sampled, obstacles)) return void 0;
23860
+ }
23861
+ return curve;
23862
+ }
23292
23863
  const unit3 = (p, q) => {
23293
23864
  const length = Math.hypot(q.x - p.x, q.y - p.y) || 1;
23294
23865
  return { x: (q.x - p.x) / length, y: (q.y - p.y) / length };
@@ -23337,26 +23908,6 @@ function put(parent, inherited, name3, value, formula) {
23337
23908
  node2.removeAttribute("E");
23338
23909
  if (formula !== void 0) node2.setAttribute("F", formula);
23339
23910
  }
23340
- function midpoint(points) {
23341
- const lengths = points.slice(1).map((point2, index) => Math.hypot(point2.x - points[index].x, point2.y - points[index].y));
23342
- let left = lengths.reduce((sum, value) => sum + value, 0) / 2;
23343
- for (const [index, length] of lengths.entries()) {
23344
- if (left <= length && length > 0) {
23345
- const from = points[index], to = points[index + 1];
23346
- return {
23347
- x: from.x + (to.x - from.x) * left / length,
23348
- y: from.y + (to.y - from.y) * left / length
23349
- };
23350
- }
23351
- left -= length;
23352
- }
23353
- return points.at(-1);
23354
- }
23355
- var bezier = (p, t) => {
23356
- const u = 1 - t;
23357
- const mix2 = (key2) => u * u * u * p[0][key2] + 3 * u * u * t * p[1][key2] + 3 * u * t * t * p[2][key2] + t * t * t * p[3][key2];
23358
- return { x: mix2("x"), y: mix2("y") };
23359
- };
23360
23911
  function section(shape, name3, index) {
23361
23912
  let node2 = children2(shape, "Section").find((item) => attribute2(item, "N") === name3);
23362
23913
  if (!node2) {
@@ -23412,8 +23963,9 @@ function writeStencilConnector(shape, route, vertices) {
23412
23963
  x: point2.x - (begin.x + end.x) / 2 + width / 2,
23413
23964
  y: point2.y - (begin.y + end.y) / 2 + height / 2
23414
23965
  });
23415
- const curved2 = route === "curved" && !flatX && !flatY && vertices.length === 4;
23966
+ const curved2 = route === "curved" && (vertices.length === 5 || !flatX && !flatY && vertices.length === 4);
23416
23967
  const local = (curved2 || route !== "curved" ? vertices : [begin, end]).map(at2);
23968
+ const [internalKnot, lastKnot] = local.length === 5 ? cornerCurveKnots(local) : [0, 1];
23417
23969
  const masterGeometry = children2(template, "Section").find(
23418
23970
  (item) => attribute2(item, "N") === "Geometry"
23419
23971
  );
@@ -23438,15 +23990,15 @@ function writeStencilConnector(shape, route, vertices) {
23438
23990
  {
23439
23991
  type: "NURBSTo",
23440
23992
  cells: [
23441
- ["X", local[3].x, flatX ? void 0 : "Width*1"],
23442
- ["Y", local[3].y, flatY ? void 0 : "Height*1"],
23443
- ["A", 0],
23993
+ ["X", local.at(-1).x, flatX ? void 0 : "Width*1"],
23994
+ ["Y", local.at(-1).y, flatY ? void 0 : "Height*1"],
23995
+ ["A", internalKnot],
23444
23996
  ["B", 1],
23445
23997
  ["C", 0],
23446
23998
  ["D", 1],
23447
23999
  [
23448
24000
  "E",
23449
- `NURBS(1,3,1,1,${text2(local[1].x - local[0].x)},${text2(local[1].y - local[0].y)},0,1,${text2(local[2].x - local[0].x)},${text2(local[2].y - local[0].y)},0,1)`
24001
+ `NURBS(${text2(lastKnot)},3,1,1,${local.slice(1, -1).map((point2) => `${text2(point2.x)},${text2(point2.y)},0,1`).join(",")})`
23450
24002
  ]
23451
24003
  ]
23452
24004
  }
@@ -23483,7 +24035,7 @@ function writeStencilConnector(shape, route, vertices) {
23483
24035
  }
23484
24036
  }
23485
24037
  drop(shape, geometry);
23486
- const middle = curved2 ? bezier(local, 0.5) : midpoint(local);
24038
+ const middle = curved2 ? connectorCurveMiddle(local) : connectorPolylineMiddle(local);
23487
24039
  const masterControl = children2(template, "Section").filter((item) => attribute2(item, "N") === "Control").flatMap((item) => children2(item, "Row")).find((row2) => attribute2(row2, "N") === "TextPosition");
23488
24040
  const control = section(shape, "Control");
23489
24041
  let position = children2(control, "Row").find((row2) => attribute2(row2, "N") === "TextPosition");
@@ -24613,6 +25165,344 @@ async function refreshTextSizes(targets, result, options, deadline) {
24613
25165
  return { ...result, diagnostics };
24614
25166
  }
24615
25167
 
25168
+ // visio/line-jumps.ts
25169
+ var VISIO_LINE_JUMP_WIDTH = 2 / 3 * 0.125;
25170
+ var VISIO_LINE_JUMP_LIMITS = Object.freeze({ connectors: 2e3, segments: 2e4 });
25171
+ var TOKEN = /([MLZmlz]|[A-Za-z])|([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)/g;
25172
+ function polylines(path) {
25173
+ const result = [];
25174
+ let command2 = "";
25175
+ let pending;
25176
+ for (const match of path.matchAll(TOKEN)) {
25177
+ if (match[1]) {
25178
+ if (match[1] !== "M" && match[1] !== "L") return void 0;
25179
+ if (pending !== void 0) return void 0;
25180
+ command2 = match[1];
25181
+ continue;
25182
+ }
25183
+ const value = Number(match[2]);
25184
+ if (!Number.isFinite(value) || !command2) return void 0;
25185
+ if (pending === void 0) {
25186
+ pending = value;
25187
+ continue;
25188
+ }
25189
+ const point2 = { x: pending, y: value };
25190
+ pending = void 0;
25191
+ if (command2 === "M") {
25192
+ result.push([point2]);
25193
+ command2 = "L";
25194
+ } else result.at(-1)?.push(point2);
25195
+ }
25196
+ return pending === void 0 && result.every((line) => line.length > 1) ? result : void 0;
25197
+ }
25198
+ var apply2 = (m, p) => ({
25199
+ x: m[0] * p.x + m[2] * p.y + m[4],
25200
+ y: m[1] * p.x + m[3] * p.y + m[5]
25201
+ });
25202
+ function invert(m) {
25203
+ const det = m[0] * m[3] - m[1] * m[2];
25204
+ if (!Number.isFinite(det) || Math.abs(det) < 1e-12) return void 0;
25205
+ return [
25206
+ m[3] / det,
25207
+ -m[1] / det,
25208
+ -m[2] / det,
25209
+ m[0] / det,
25210
+ (m[2] * m[5] - m[3] * m[4]) / det,
25211
+ (m[1] * m[4] - m[0] * m[5]) / det
25212
+ ];
25213
+ }
25214
+ var clean2 = (value) => Math.abs(value) < 1e-9 ? 0 : Number(value.toFixed(6));
25215
+ var text3 = (p) => `${clean2(p.x)} ${clean2(p.y)}`;
25216
+ var horizontal = (s) => Math.abs(s.b.x - s.a.x) > Math.abs(s.b.y - s.a.y);
25217
+ var vertical = (s) => Math.abs(s.b.y - s.a.y) > Math.abs(s.b.x - s.a.x);
25218
+ function crossing(s, other, margin) {
25219
+ const dx = s.b.x - s.a.x, dy = s.b.y - s.a.y, ox = other.b.x - other.a.x, oy = other.b.y - other.a.y;
25220
+ const det = dx * oy - dy * ox;
25221
+ const length = Math.hypot(dx, dy), otherLength = Math.hypot(ox, oy);
25222
+ if (Math.abs(det) < 1e-9 || Math.abs(det) / (length * otherLength) < 0.2) return void 0;
25223
+ const t = ((other.a.x - s.a.x) * oy - (other.a.y - s.a.y) * ox) / det;
25224
+ const u = ((other.a.x - s.a.x) * dy - (other.a.y - s.a.y) * dx) / det;
25225
+ if (u * otherLength < 1e-6 || (1 - u) * otherLength < 1e-6) return void 0;
25226
+ if (t * length < margin || (1 - t) * length < margin) return void 0;
25227
+ return t;
25228
+ }
25229
+ function jumps(code, s, other, shapes) {
25230
+ const own = shapes[s.owner]?.lineJumpCode ?? 0;
25231
+ const peer = shapes[other.owner]?.lineJumpCode ?? 0;
25232
+ if (own === 4 || peer === 4 || own === 1) return false;
25233
+ if (own !== peer) {
25234
+ if (own === 2 || peer === 3) return true;
25235
+ if (own === 3 || peer === 2) return false;
25236
+ }
25237
+ if (code === 1) return horizontal(s) && !horizontal(other);
25238
+ if (code === 2) return vertical(s) && !vertical(other);
25239
+ if (code === 3 || code === 4) return s.owner > other.owner;
25240
+ return code === 5 && s.owner < other.owner;
25241
+ }
25242
+ function jump(style2, from, to, local, reverse) {
25243
+ const half = Math.hypot(to.x - from.x, to.y - from.y) / 2;
25244
+ const ux = (to.x - from.x) / (2 * half), uy = (to.y - from.y) / (2 * half);
25245
+ let nx = -uy, ny = ux;
25246
+ if (ny < -1e-9 || Math.abs(ny) <= 1e-9 && nx > 0) {
25247
+ nx = -nx;
25248
+ ny = -ny;
25249
+ }
25250
+ if (reverse) {
25251
+ nx = -nx;
25252
+ ny = -ny;
25253
+ }
25254
+ const centre = { x: (from.x + to.x) / 2, y: (from.y + to.y) / 2 };
25255
+ const at2 = (along, out) => local({ x: centre.x + ux * along + nx * out, y: centre.y + uy * along + ny * out });
25256
+ const end = local(to);
25257
+ if (style2 === 1) return `M ${text3(end)}`;
25258
+ if (style2 === 2) return `L ${text3(at2(-half, half))} L ${text3(at2(half, half))} L ${text3(end)}`;
25259
+ if (style2 >= 3) {
25260
+ const sides = style2 - 1;
25261
+ let out = "";
25262
+ for (let index = 1; index < sides; ++index) {
25263
+ const angle = Math.PI - Math.PI * index / sides;
25264
+ out += `L ${text3(at2(Math.cos(angle) * half, Math.sin(angle) * half))} `;
25265
+ }
25266
+ return `${out}L ${text3(end)}`;
25267
+ }
25268
+ const start = local(from), top = at2(0, half);
25269
+ const radius = Math.hypot(end.x - start.x, end.y - start.y) / 2;
25270
+ const sweep = (end.x - start.x) * (top.y - start.y) - (end.y - start.y) * (top.x - start.x) > 0 ? 0 : 1;
25271
+ return `A ${clean2(radius)} ${clean2(radius)} 0 0 ${sweep} ${text3(end)}`;
25272
+ }
25273
+ var connector = (shape, glued) => shape.kind === "connector" && !shape.hidden && !shape.children.length && (shape.connectorRoute !== void 0 || glued.has(shape.id));
25274
+ function visioLineJumpPaths(page) {
25275
+ const result = /* @__PURE__ */ new Map();
25276
+ const layout = visioPageLayout(page);
25277
+ const code = layout.lineJumpCode;
25278
+ const glued = new Set(page.connectors.map((connection) => connection.fromShapeId));
25279
+ const shapes = page.shapes.filter((shape) => connector(shape, glued)).slice(0, VISIO_LINE_JUMP_LIMITS.connectors);
25280
+ for (const shape of shapes) {
25281
+ if (shape.connectorRoute !== "straight" || !shape.lineEnds) continue;
25282
+ if (shape.geometry.length !== 1) continue;
25283
+ const geometry = shape.geometry[0];
25284
+ if (!geometry.stroke || geometry.fill) continue;
25285
+ const { begin, end } = shape.lineEnds;
25286
+ if (![begin.x, begin.y, end.x, end.y].every(Number.isFinite)) continue;
25287
+ const path = `M ${text3(begin)} L ${text3(end)}`;
25288
+ if (geometry.path !== path) result.set(shape, [path]);
25289
+ }
25290
+ if (shapes.length < 2) return result;
25291
+ if ((code < 1 || code > 5) && !shapes.some((shape) => shape.lineJumpCode === 2 || shape.lineJumpCode === 3))
25292
+ return result;
25293
+ const lines2 = [];
25294
+ const segments = [];
25295
+ shapes.forEach((shape, owner) => {
25296
+ shape.geometry.forEach((geometry, index) => {
25297
+ if (!geometry.stroke || geometry.fill) return;
25298
+ for (const line of polylines(result.get(shape)?.[index] ?? geometry.path) ?? []) {
25299
+ const points = line.map((point2) => apply2(shape.transform, point2));
25300
+ lines2.push({ shape, owner, geometry: index, points });
25301
+ for (let i = 1; i < points.length; ++i)
25302
+ segments.push({ a: points[i - 1], b: points[i], owner });
25303
+ }
25304
+ });
25305
+ });
25306
+ if (segments.length > VISIO_LINE_JUMP_LIMITS.segments) return result;
25307
+ const bounded6 = (value, fallback, max) => typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= max ? value : fallback;
25308
+ const scale = bounded6(page.drawingToPageScale, 1, Number.MAX_VALUE);
25309
+ const halfX = bounded6(layout.lineJumpFactorX, 2 / 3, 10) * bounded6(layout.lineToLineX, 0.125, 1e4) * scale / 2;
25310
+ const halfY = bounded6(layout.lineJumpFactorY, 2 / 3, 10) * bounded6(layout.lineToLineY, 0.125, 1e4) * scale / 2;
25311
+ const paths = /* @__PURE__ */ new Map();
25312
+ const any = /* @__PURE__ */ new Set();
25313
+ for (const line of lines2) {
25314
+ const inverse = invert(line.shape.transform);
25315
+ if (!inverse) continue;
25316
+ const local = (point2) => apply2(inverse, point2);
25317
+ let out = `M ${text3(local(line.points[0]))}`;
25318
+ for (let i = 1; i < line.points.length; ++i) {
25319
+ const s = { a: line.points[i - 1], b: line.points[i], owner: line.owner };
25320
+ const length = Math.hypot(s.b.x - s.a.x, s.b.y - s.a.y);
25321
+ const half = vertical(s) ? halfY : halfX;
25322
+ if (half <= 0) {
25323
+ out += ` L ${text3(local(s.b))}`;
25324
+ continue;
25325
+ }
25326
+ const hits = segments.filter((other) => other.owner !== s.owner && jumps(code, s, other, shapes)).flatMap((other) => crossing(s, other, half * 1.5) ?? []).sort((a, b) => a - b);
25327
+ let last = -Infinity;
25328
+ for (const t of hits) {
25329
+ if ((t - last) * length < half * 2.5) continue;
25330
+ last = t;
25331
+ const at2 = (offset) => ({
25332
+ x: s.a.x + (s.b.x - s.a.x) * (t * length + offset) / length,
25333
+ y: s.a.y + (s.b.y - s.a.y) * (t * length + offset) / length
25334
+ });
25335
+ const override = line.shape.lineJumpStyle ?? 0;
25336
+ const savedStyle = override >= 1 && override <= 9 ? override : layout.lineJumpStyle;
25337
+ const style2 = savedStyle >= 1 && savedStyle <= 9 ? savedStyle - 1 : 0;
25338
+ const direction = horizontal(s) ? line.shape.lineJumpDirectionX || layout.lineJumpDirectionX : vertical(s) ? line.shape.lineJumpDirectionY || layout.lineJumpDirectionY : 0;
25339
+ out += ` L ${text3(local(at2(-half)))} ${jump(style2, at2(-half), at2(half), local, direction === 2)}`;
25340
+ any.add(line.shape);
25341
+ }
25342
+ out += ` L ${text3(local(s.b))}`;
25343
+ }
25344
+ const byGeometry = paths.get(line.shape) ?? /* @__PURE__ */ new Map();
25345
+ byGeometry.set(line.geometry, [...byGeometry.get(line.geometry) ?? [], out]);
25346
+ paths.set(line.shape, byGeometry);
25347
+ }
25348
+ for (const shape of any) {
25349
+ const byGeometry = paths.get(shape);
25350
+ result.set(
25351
+ shape,
25352
+ shape.geometry.map(
25353
+ (geometry, index) => byGeometry.get(index)?.join(" ") ?? result.get(shape)?.[index] ?? geometry.path
25354
+ )
25355
+ );
25356
+ }
25357
+ return result;
25358
+ }
25359
+
25360
+ // visio/edit-line-jump-cache.ts
25361
+ var jumpState = (page) => JSON.stringify([
25362
+ Object.entries(visioPageLayout(page)).filter(([key2]) => /^lineJump|^lineToLine/.test(key2)),
25363
+ page.shapes.map((shape) => [
25364
+ shape.id,
25365
+ shape.lineJumpCode,
25366
+ shape.lineJumpStyle,
25367
+ shape.lineJumpDirectionX,
25368
+ shape.lineJumpDirectionY
25369
+ ])
25370
+ ]);
25371
+ function plainRows(section3) {
25372
+ return children2(section3, "Row").every(
25373
+ (row2) => ["MoveTo", "LineTo", "ArcTo"].includes(attribute2(row2, "T") ?? "") && Array.from(row2.attributes).every((attr2) => ["IX", "T", "Del"].includes(attr2.name)) && Array.from(row2.children ?? row2.childNodes).filter((node2) => node2.nodeType === 1).every((node2) => {
25374
+ const cell = node2;
25375
+ return cell.localName === "Cell" && cell.namespaceURI === section3.namespaceURI && ["X", "Y", ...attribute2(row2, "T") === "ArcTo" ? ["A"] : []].includes(
25376
+ attribute2(cell, "N") ?? ""
25377
+ ) && Array.from(cell.attributes).every((attr2) => ["N", "V", "U", "F"].includes(attr2.name)) && !executableCellFormula(attribute2(cell, "F")) && !Array.from(cell.childNodes).some((child3) => child3.nodeType === 1);
25378
+ })
25379
+ );
25380
+ }
25381
+ function cacheRows(path) {
25382
+ const tokens2 = path.trim().split(/\s+/);
25383
+ const rows = [];
25384
+ while (tokens2.length) {
25385
+ const command2 = tokens2.shift();
25386
+ if (command2 === "M" || command2 === "L") {
25387
+ rows.push({
25388
+ type: command2 === "M" ? "MoveTo" : "LineTo",
25389
+ x: Number(tokens2.shift()),
25390
+ y: Number(tokens2.shift())
25391
+ });
25392
+ } else if (command2 === "A") {
25393
+ const [rx, ry, rotation, large, sweep, x, y] = tokens2.splice(0, 7).map(Number);
25394
+ if (rx === void 0 || ry !== rx || rotation !== 0 || large !== 0 || sweep !== 0 && sweep !== 1 || x === void 0 || y === void 0)
25395
+ return [];
25396
+ rows.push({ type: "ArcTo", x, y, bow: sweep ? rx : -rx });
25397
+ } else return [];
25398
+ if (rows.length > 1e4) return [];
25399
+ }
25400
+ return rows.every((row2) => Number.isFinite(row2.x) && Number.isFinite(row2.y)) ? rows : [];
25401
+ }
25402
+ async function refreshLineJumpCaches(pageIds2, source, result, options, deadline) {
25403
+ if (!pageIds2.size || !result.changedParts.length) return result;
25404
+ const check = () => {
25405
+ if (Date.now() >= deadline) fail("LIMIT_RUNTIME", "Visio edit deadline exceeded.");
25406
+ };
25407
+ const limits = {
25408
+ ...DEFAULTS,
25409
+ ...options.limits,
25410
+ maxRuntimeMs: Math.max(1, deadline - Date.now())
25411
+ };
25412
+ const { pkg, parts, pages } = await openEditablePackage(result.bytes, limits, check);
25413
+ const model2 = await parseVsdx(result.bytes, { limits });
25414
+ const before = source ? await parseVsdx(source, { limits }) : void 0;
25415
+ const template = masterTemplate(pkg);
25416
+ const changed = new Set(result.changedParts);
25417
+ const kept = [];
25418
+ let referenced = false;
25419
+ for (const path of pkg.paths()) {
25420
+ check();
25421
+ if (!/^visio\/.*\.xml$/i.test(path)) continue;
25422
+ const root2 = await pkg.readXml(path);
25423
+ for (const node2 of Array.from(root2.getElementsByTagName("*")))
25424
+ if (/\b(?:Geometry|Geom)\d*\./i.test(attribute2(node2, "F") ?? "")) referenced = true;
25425
+ }
25426
+ for (const page of model2.pages) {
25427
+ if (!pageIds2.has(page.id)) continue;
25428
+ const prior = before?.pages.find((item) => item.id === page.id);
25429
+ if (prior && jumpState(prior) === jumpState(page)) continue;
25430
+ const path = pages.get(page.id);
25431
+ const root2 = await visioXml(pkg, path, "PageContents");
25432
+ let dirty = false;
25433
+ for (const [shape, paths] of visioLineJumpPaths(page)) {
25434
+ check();
25435
+ if (shape.connectorRoute !== "straight" || paths.length !== 1) continue;
25436
+ const target2 = children2(children2(root2, "Shapes")[0], "Shape").find(
25437
+ (node2) => attribute2(node2, "ID") === shape.id
25438
+ );
25439
+ if (!target2) continue;
25440
+ const sections = children2(target2, "Section").filter(
25441
+ (node2) => attribute2(node2, "N") === "Geometry"
25442
+ );
25443
+ const section3 = sections[0];
25444
+ const rows = cacheRows(paths[0]);
25445
+ if (referenced || !section3 || sections.length !== 1 || !rows.length || !plainRows(section3) || Array.from(section3.getElementsByTagName("*")).some(
25446
+ (node2) => executableCellFormula(attribute2(node2, "F"))
25447
+ )) {
25448
+ kept.push(shape.id);
25449
+ continue;
25450
+ }
25451
+ const indices = /* @__PURE__ */ new Map();
25452
+ const masterId = attribute2(target2, "Master");
25453
+ if (masterId) {
25454
+ const master2 = await template(masterId, attribute2(target2, "MasterShape"));
25455
+ const base2 = children2(master2, "Section").find(
25456
+ (node2) => attribute2(node2, "N") === "Geometry" && attribute2(node2, "IX") === attribute2(section3, "IX")
25457
+ );
25458
+ for (const row2 of children2(base2, "Row"))
25459
+ indices.set(attribute2(row2, "IX"), attribute2(row2, "T"));
25460
+ }
25461
+ for (const row2 of children2(section3, "Row")) section3.removeChild(row2);
25462
+ for (const [index, value] of rows.entries()) {
25463
+ const row2 = root2.ownerDocument.createElementNS(root2.namespaceURI, "Row");
25464
+ row2.setAttribute("IX", String(index + 1));
25465
+ row2.setAttribute("T", value.type);
25466
+ setCell(row2, "X", value.x);
25467
+ setCell(row2, "Y", value.y);
25468
+ if (value.bow !== void 0) setCell(row2, "A", value.bow);
25469
+ section3.appendChild(row2);
25470
+ indices.delete(String(index + 1));
25471
+ }
25472
+ for (const [index, type] of indices) {
25473
+ const row2 = root2.ownerDocument.createElementNS(root2.namespaceURI, "Row");
25474
+ row2.setAttribute("IX", index);
25475
+ row2.setAttribute("T", type);
25476
+ row2.setAttribute("Del", "1");
25477
+ section3.appendChild(row2);
25478
+ }
25479
+ dirty = true;
25480
+ }
25481
+ if (dirty) {
25482
+ parts.set(path, serializeEditedXml(root2, limits, check).bytes);
25483
+ changed.add(path);
25484
+ }
25485
+ }
25486
+ return {
25487
+ bytes: await writeEditedPackage(
25488
+ parts,
25489
+ options.maxOutputBytes ?? limits.maxInputBytes,
25490
+ deadline,
25491
+ check
25492
+ ),
25493
+ changedParts: [...changed].sort(),
25494
+ diagnostics: [
25495
+ ...result.diagnostics,
25496
+ ...kept.length ? [
25497
+ {
25498
+ code: "edit-line-jump-cache-kept",
25499
+ message: `Connector ${kept.join(", ")} retains its saved geometry because formula dependencies prevent refreshing native jump caches.`
25500
+ }
25501
+ ] : []
25502
+ ]
25503
+ };
25504
+ }
25505
+
24616
25506
  // visio/resize-anchor.ts
24617
25507
  function snapshotResizeAnchor(value) {
24618
25508
  if (value === void 0) return void 0;
@@ -26030,7 +26920,8 @@ function shapeResolver(shape) {
26030
26920
  }
26031
26921
  function valueCell(value) {
26032
26922
  if (value.kind === "string") return { v: value.text, u: "STR", type: 0 };
26033
- if (value.kind === "date") return { v: String(visioDateSerial(value.date)), u: "DATE", type: 5 };
26923
+ if (value.kind === "date")
26924
+ return { v: value.date.toISOString().replace(/Z$/, ""), u: "DATE", type: 5 };
26034
26925
  const unit3 = value.unit === "length" ? "IN" : value.unit === "angle" ? "DEG" : void 0;
26035
26926
  return { v: String(Number(value.value.toFixed(10))), ...unit3 ? { u: unit3 } : {}, type: 2 };
26036
26927
  }
@@ -26117,7 +27008,8 @@ async function insertVisioTextField(pkg, pagePaths, roots, document, edit, check
26117
27008
  };
26118
27009
  const stored = valueCell(value);
26119
27010
  cell("Value", stored.v, { ...stored.u ? { U: stored.u } : {}, F: edit.formula });
26120
- if (edit.format) cell("Format", edit.format, { F: `"${edit.format.replaceAll('"', '""')}"` });
27011
+ if (edit.format)
27012
+ cell("Format", edit.format, { U: "STR", F: `"${edit.format.replaceAll('"', '""')}"` });
26121
27013
  cell("Type", String(stored.type));
26122
27014
  section3.appendChild(row2);
26123
27015
  const field2 = owner.createElementNS(ns, "fld");
@@ -26548,6 +27440,9 @@ function assertDependencies(roots, pagesPart, pages, pagePaths, pageId2, changed
26548
27440
  "gi"
26549
27441
  ) : void 0;
26550
27442
  const paths = new Map([...pagePaths].map(([id3, path]) => [path, id3]));
27443
+ const jumpDecorationOnly = changed.every(
27444
+ (name3) => /^(LineJumpCode|LineJumpStyle|PageLineJumpDir[XY]|LineJumpFactor[XY])$/.test(name3)
27445
+ );
26551
27446
  for (const [path, root2] of roots)
26552
27447
  for (const node2 of [root2, ...Array.from(root2.getElementsByTagName("*"))]) {
26553
27448
  check();
@@ -26568,8 +27463,10 @@ function assertDependencies(roots, pagesPart, pages, pagePaths, pageId2, changed
26568
27463
  const nativeGlue = paths.has(path) && connected && node2.localName === "Cell" && node2.namespaceURI === root2.namespaceURI && (/^(BeginX|BeginY|EndX|EndY)$/.test(name3) && /^\s*_WALKGLUE\((?:BegTrigger,EndTrigger|EndTrigger,BegTrigger),WalkPreference\)\s*$/i.test(
26569
27464
  code
26570
27465
  ) || /^(BegTrigger|EndTrigger)$/.test(name3) && /^\s*_XFTRIGGER\(Sheet\.[1-9]\d*!EventXFMod\)\s*$/i.test(code));
27466
+ const nativeJumpTrigger = jumpDecorationOnly && paths.has(path) && node2.localName === "Cell" && node2.namespaceURI === root2.namespaceURI && /^(BegTrigger|EndTrigger)$/.test(name3) && owner?.localName === "Shape" && owner.namespaceURI === root2.namespaceURI && container?.localName === "Shapes" && container.parentNode === root2 && !!ownerId2 && visioGlueTriggerTarget(formula) === ownerId2;
27467
+ const nativeJumpText = jumpDecorationOnly && node2.localName === "Cell" && node2.namespaceURI === root2.namespaceURI && (/^(TxtPinX|TxtPinY)$/.test(name3) && /^\s*SETATREF\(Controls\.TextPosition(?:\.Y)?\)\s*$/i.test(formula) || !!textSizeFormula(formula) || name3 === "XCon" && /^\s*IF\(OR\(STRSAME\(SHAPETEXT\(TheText\),""\),HideText\),5,0\)\s*$/i.test(formula));
26571
27468
  let dynamic2 = false;
26572
- if (!nativeGlue) {
27469
+ if (!nativeGlue && !nativeJumpTrigger && !nativeJumpText) {
26573
27470
  try {
26574
27471
  dynamic2 = analyzeVisioFormula(
26575
27472
  mapVisioFormulaSyntax(
@@ -26584,7 +27481,7 @@ function assertDependencies(roots, pagesPart, pages, pagePaths, pageId2, changed
26584
27481
  if (dynamic2)
26585
27482
  fail(
26586
27483
  "EDIT_UNSUPPORTED_PAGE_SIZE_DEPENDENCY",
26587
- "Dynamic or unknown page-size dependencies cannot be safely refreshed."
27484
+ `Dynamic or unknown page-size dependencies cannot be safely refreshed (${path}, ${name3}).`
26588
27485
  );
26589
27486
  let local = paths.get(path);
26590
27487
  if (path === pagesPart) {
@@ -26802,6 +27699,12 @@ function setVisioPageProperties(pagesPart, pages, dirty, command2) {
26802
27699
  var CELLS = [
26803
27700
  ["lineJumpCode", "LineJumpCode", false],
26804
27701
  ["lineJumpStyle", "LineJumpStyle", false],
27702
+ ["lineJumpDirectionX", "PageLineJumpDirX", false],
27703
+ ["lineJumpDirectionY", "PageLineJumpDirY", false],
27704
+ ["lineJumpFactorX", "LineJumpFactorX", false],
27705
+ ["lineJumpFactorY", "LineJumpFactorY", false],
27706
+ ["lineToLineX", "LineToLineX", true],
27707
+ ["lineToLineY", "LineToLineY", true],
26805
27708
  ["gridDensityX", "XGridDensity", false],
26806
27709
  ["gridDensityY", "YGridDensity", false],
26807
27710
  ["gridSpacingX", "XGridSpacing", true],
@@ -26815,8 +27718,13 @@ var CELLS = [
26815
27718
  ];
26816
27719
  function valid(key2, value) {
26817
27720
  const number5 = typeof value === "number" && Number.isFinite(value) ? value : Number.NaN;
27721
+ if (key2.startsWith("lineJumpFactor") || key2.startsWith("lineToLine")) {
27722
+ if (!(number5 >= 0 && number5 <= (key2.startsWith("lineJumpFactor") ? 10 : 1e4)))
27723
+ fail("INVALID_EDIT", `Invalid page layout value for ${key2}.`);
27724
+ return number5;
27725
+ }
26818
27726
  const integer3 = Number.isSafeInteger(number5);
26819
- const ok = key2 === "lineJumpCode" ? integer3 && number5 >= 0 && number5 <= 5 : key2 === "lineJumpStyle" ? integer3 && number5 >= 0 && number5 <= 8 : key2.startsWith("gridDensity") ? VISIO_GRID_DENSITIES.includes(number5) : key2.startsWith("rulerDensity") ? VISIO_RULER_DENSITIES.includes(number5) : key2.startsWith("gridSpacing") ? number5 >= 0 && number5 <= 1e4 : Math.abs(number5) <= 1e6;
27727
+ const ok = key2 === "lineJumpDirectionX" || key2 === "lineJumpDirectionY" ? integer3 && number5 >= 0 && number5 <= 2 : key2 === "lineJumpCode" ? integer3 && number5 >= 0 && number5 <= 5 : key2 === "lineJumpStyle" ? integer3 && number5 >= 0 && number5 <= 9 : key2.startsWith("gridDensity") ? VISIO_GRID_DENSITIES.includes(number5) : key2.startsWith("rulerDensity") ? VISIO_RULER_DENSITIES.includes(number5) : key2.startsWith("gridSpacing") ? number5 >= 0 && number5 <= 1e4 : Math.abs(number5) <= 1e6;
26820
27728
  if (!ok) fail("INVALID_EDIT", `Invalid page layout value for ${key2}.`);
26821
27729
  return number5;
26822
27730
  }
@@ -27043,7 +27951,7 @@ function visioBorderShapes(style2, width, height, title = VISIO_DEFAULT_TITLE) {
27043
27951
 
27044
27952
  // visio/edit-page-setup-commands.ts
27045
27953
  var VISIO_SCALE_UNITS = Object.freeze(["IN", "FT", "MM", "CM", "M"]);
27046
- var isVisioPageSetupEdit = (edit) => edit.type === "set-page-setup" || edit.type === "set-page-properties" || edit.type === "set-page-decoration" || edit.type === "set-page-layout" || edit.type === "set-snap-glue";
27954
+ var isVisioPageSetupEdit = (edit) => edit.type === "set-page-alt-text" || edit.type === "set-page-setup" || edit.type === "set-page-properties" || edit.type === "set-page-decoration" || edit.type === "set-page-layout" || edit.type === "set-snap-glue";
27047
27955
  var pageId = (value, label) => {
27048
27956
  if (typeof value !== "string" || !value || value.length > 256)
27049
27957
  fail("INVALID_EDIT", `Invalid ${label}.`);
@@ -27063,6 +27971,13 @@ function snapshotPageSetupEdit(edit) {
27063
27971
  if (edit.type === "set-page-layout") return snapshotPageLayoutEdit(edit);
27064
27972
  if (edit.type === "set-snap-glue") return snapshotSnapGlueEdit(edit);
27065
27973
  const id3 = pageId(edit.pageId, "page");
27974
+ if (edit.type === "set-page-alt-text")
27975
+ return {
27976
+ type: edit.type,
27977
+ pageId: id3,
27978
+ title: metadataText(edit.title, true),
27979
+ description: metadataText(edit.description, false)
27980
+ };
27066
27981
  if (edit.type === "set-page-setup") {
27067
27982
  const result = { type: edit.type, pageId: id3 };
27068
27983
  if (edit.printOrientation !== void 0) {
@@ -28756,7 +29671,7 @@ var OFFICE_FALLBACK = [
28756
29671
  "#4472c4",
28757
29672
  "#70ad47"
28758
29673
  ];
28759
- function mix(color2, target2, amount) {
29674
+ function mix2(color2, target2, amount) {
28760
29675
  return `#${[1, 3, 5].map((index) => {
28761
29676
  const value = parseInt(color2.slice(index, index + 2), 16);
28762
29677
  return Math.round(value + (target2 - value) * amount).toString(16).padStart(2, "0");
@@ -28769,15 +29684,15 @@ function visioFallbackQuickStyle(style2) {
28769
29684
  case 1:
28770
29685
  return { fill: light, line: base2, font: dark };
28771
29686
  case 2:
28772
- return { fill: mix(base2, 255, 0.8), line: base2, font: dark };
29687
+ return { fill: mix2(base2, 255, 0.8), line: base2, font: dark };
28773
29688
  case 3:
28774
- return { fill: mix(base2, 255, 0.6), line: base2, font: dark };
29689
+ return { fill: mix2(base2, 255, 0.6), line: base2, font: dark };
28775
29690
  case 4:
28776
- return { fill: base2, line: mix(base2, 0, 0.25), font: light };
29691
+ return { fill: base2, line: mix2(base2, 0, 0.25), font: light };
28777
29692
  case 5:
28778
- return { fill: mix(base2, 0, 0.25), line: mix(base2, 0, 0.5), font: light };
29693
+ return { fill: mix2(base2, 0, 0.25), line: mix2(base2, 0, 0.5), font: light };
28779
29694
  default:
28780
- return { fill: mix(base2, 0, 0.5), line: mix(base2, 0, 0.5), font: light };
29695
+ return { fill: mix2(base2, 0, 0.5), line: mix2(base2, 0, 0.5), font: light };
28781
29696
  }
28782
29697
  }
28783
29698
  var rgb = (color2) => `RGB(${[1, 3, 5].map((index) => parseInt(color2.slice(index, index + 2), 16)).join(",")})`;
@@ -29081,7 +29996,11 @@ function snapshotFormatting(edit) {
29081
29996
  ["endArrow", 45, "Arrowheads are numbered 0 to 45."],
29082
29997
  ["beginArrowSize", 6, "Arrowhead sizes are numbered 0 to 6."],
29083
29998
  ["endArrowSize", 6, "Arrowhead sizes are numbered 0 to 6."],
29084
- ["lineCap", 2, "Line caps are 0 (round), 1 (square) or 2 (extended)."]
29999
+ ["lineCap", 2, "Line caps are 0 (round), 1 (square) or 2 (extended)."],
30000
+ ["lineJumpCode", 4, "Connector jump policies are numbered 0 to 4."],
30001
+ ["lineJumpStyle", 9, "Connector jump styles are numbered 0 to 9."],
30002
+ ["lineJumpDirectionX", 2, "Connector jump directions are numbered 0 to 2."],
30003
+ ["lineJumpDirectionY", 2, "Connector jump directions are numbered 0 to 2."]
29085
30004
  ]) {
29086
30005
  const value = edit[name3];
29087
30006
  if (value === void 0) continue;
@@ -29160,6 +30079,12 @@ function geometryChangedCells(edit) {
29160
30079
  if (edit.type === "flip-shape") return ["Angle", edit.axis === "horizontal" ? "FlipX" : "FlipY"];
29161
30080
  return ["PinX", "PinY", "Width", "Height"];
29162
30081
  }
30082
+ function snapshotPositionFollower(value, own) {
30083
+ if (value === void 0) return {};
30084
+ if (typeof value !== "string" || !/^[1-9]\d{0,9}$/.test(value) || Number(value) > 4294967295 || value === own)
30085
+ fail("INVALID_EDIT", "A distinct numeric owner shape ID is required.");
30086
+ return { followShapeId: value };
30087
+ }
29163
30088
  function snapshotVisioEdits(edits, maxEdits, maxText) {
29164
30089
  if (!Array.isArray(edits) || edits.length > maxEdits)
29165
30090
  fail("LIMIT_EDITS", "Edit command count exceeds limit.");
@@ -29251,6 +30176,7 @@ function snapshotVisioEdits(edits, maxEdits, maxText) {
29251
30176
  case "create-text-box":
29252
30177
  return {
29253
30178
  ...target2,
30179
+ ...snapshotPositionFollower(edit.followShapeId, edit.shapeId),
29254
30180
  type: edit.type,
29255
30181
  x: numeric5(edit.x),
29256
30182
  y: numeric5(edit.y),
@@ -29282,6 +30208,7 @@ function snapshotVisioEdits(edits, maxEdits, maxText) {
29282
30208
  fail("INVALID_EDIT", "Unknown outline shape.");
29283
30209
  return {
29284
30210
  ...target2,
30211
+ ...snapshotPositionFollower(edit.followShapeId, edit.shapeId),
29285
30212
  type: edit.type,
29286
30213
  x: numeric5(edit.x),
29287
30214
  y: numeric5(edit.y),
@@ -30308,7 +31235,7 @@ function cells2(sheet) {
30308
31235
  };
30309
31236
  for (const node2 of children2(sheet, "Cell")) add(attribute2(node2, "N") ?? "", node2);
30310
31237
  for (const section3 of children2(sheet, "Section")) {
30311
- const name3 = attribute2(section3, "N") ?? "";
31238
+ const name3 = shapeDataFormulaSection(attribute2(section3, "N") ?? "");
30312
31239
  const prefix2 = name3 === "Geometry" ? `Geometry${Number(attribute2(section3, "IX") ?? "0") + 1}` : name3;
30313
31240
  for (const node2 of children2(section3, "Cell"))
30314
31241
  add(`${prefix2}.${attribute2(node2, "N") ?? ""}`, node2);
@@ -30672,7 +31599,7 @@ function localCell(node2) {
30672
31599
  const row2 = node2.parentNode;
30673
31600
  const section3 = row2?.parentNode;
30674
31601
  if (row2?.localName === "Row" && section3?.localName === "Section") {
30675
- const name3 = attribute2(section3, "N"), rowName = attribute2(row2, "N") ?? attribute2(row2, "IX");
31602
+ const name3 = shapeDataFormulaSection(attribute2(section3, "N") ?? ""), rowName = attribute2(row2, "N") ?? attribute2(row2, "IX");
30676
31603
  if (!name3 || !rowName) return void 0;
30677
31604
  return `${name3}.${rowName}${attribute2(node2, "N") === "Value" && ["User", "Prop"].includes(name3) ? "" : `.${attribute2(node2, "N")}`}`;
30678
31605
  }
@@ -31009,6 +31936,87 @@ function addReplacementPage(pagesPart, pages, rels, types, pagePaths, parts, dir
31009
31936
  );
31010
31937
  }
31011
31938
 
31939
+ // visio/edit-alt-text.ts
31940
+ function writeShapeAltText(shape, title, description, inherited = false) {
31941
+ const sections = children2(shape, "Section").filter(
31942
+ (section4) => attribute2(section4, "N") === "User"
31943
+ );
31944
+ if (sections.length > 1 || sections[0]?.hasAttribute("Del"))
31945
+ fail("UNSUPPORTED_METADATA_EDIT", "Ambiguous or deleted User sections cannot be edited.");
31946
+ let section3 = sections[0];
31947
+ let changed = false;
31948
+ for (const [name3, value] of [
31949
+ ["visAltText", title],
31950
+ ["visAltDescription", description]
31951
+ ]) {
31952
+ const rows = children2(section3, "Row").filter((row3) => attribute2(row3, "N") === name3);
31953
+ if (rows.length > 1 || rows[0]?.hasAttribute("Del"))
31954
+ fail(
31955
+ "UNSUPPORTED_METADATA_EDIT",
31956
+ "Ambiguous or deleted accessibility rows cannot be edited."
31957
+ );
31958
+ let row2 = rows[0];
31959
+ const cells4 = children2(row2, "Cell").filter((cell2) => attribute2(cell2, "N") === "Value");
31960
+ if (cells4.length > 1 || cells4[0]?.hasAttribute("E") || executableCellFormula(attribute2(cells4[0], "F")))
31961
+ fail("UNSUPPORTED_METADATA_EDIT", "Formula-driven alternative text cannot be replaced.");
31962
+ let cell = cells4[0];
31963
+ if (attribute2(cell, "V") === value || !row2 && !value && !inherited) continue;
31964
+ const create2 = (tag) => shape.ownerDocument.createElementNS(shape.namespaceURI, tag);
31965
+ if (!section3) {
31966
+ section3 = create2("Section");
31967
+ section3.setAttribute("N", "User");
31968
+ const after = Array.from(shape.childNodes).find(
31969
+ (node2) => node2.nodeType === 1 && ["Text", "Data1", "Data2", "Data3", "ForeignData", "Shapes"].includes(
31970
+ node2.localName
31971
+ )
31972
+ );
31973
+ shape.insertBefore(section3, after ?? null);
31974
+ }
31975
+ if (!row2) {
31976
+ row2 = create2("Row");
31977
+ row2.setAttribute("N", name3);
31978
+ section3.appendChild(row2);
31979
+ }
31980
+ if (!cell) {
31981
+ cell = create2("Cell");
31982
+ cell.setAttribute("N", "Value");
31983
+ row2.insertBefore(cell, row2.firstChild);
31984
+ }
31985
+ cell.setAttribute("V", value);
31986
+ cell.setAttribute("U", "STR");
31987
+ cell.removeAttribute("F");
31988
+ changed = true;
31989
+ }
31990
+ return changed;
31991
+ }
31992
+
31993
+ // visio/edit-page-alt-text.ts
31994
+ async function setVisioPageAltText(pkg, pagesPart, pages, dirty, command2, check) {
31995
+ const page = pageById(pages, command2.pageId);
31996
+ const sheets = children2(page, "PageSheet");
31997
+ if (sheets.length > 1) fail("UNSUPPORTED_METADATA_EDIT", "Ambiguous PageSheet metadata.");
31998
+ for (const path of pkg.paths()) {
31999
+ if (!/^visio\/.*\.xml$/i.test(path)) continue;
32000
+ const part = path === pagesPart ? pages : dirty.get(path) ?? await pkg.readXml(path);
32001
+ for (const cell of Array.from(part.getElementsByTagNameNS(part.namespaceURI, "Cell"))) {
32002
+ check();
32003
+ const formula = executableCellFormula(attribute2(cell, "F"));
32004
+ if (formula && /\bUser\s*\.\s*visAlt(?:Text|Description)\b/i.test(formula))
32005
+ fail(
32006
+ "UNSUPPORTED_METADATA_EDIT",
32007
+ "A formula reads alternative text; dependent caches cannot be recalculated."
32008
+ );
32009
+ }
32010
+ }
32011
+ let sheet = sheets[0];
32012
+ if (!sheet) {
32013
+ if (!command2.title && !command2.description) return;
32014
+ sheet = page.ownerDocument.createElementNS(page.namespaceURI, "PageSheet");
32015
+ page.insertBefore(sheet, page.firstChild);
32016
+ }
32017
+ if (writeShapeAltText(sheet, command2.title, command2.description)) dirty.set(pagesPart, pages);
32018
+ }
32019
+
31012
32020
  // visio/edit-page-create.ts
31013
32021
  var officeRel2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
31014
32022
  var pageType2 = "http://schemas.microsoft.com/visio/2010/relationships/page";
@@ -31090,7 +32098,7 @@ function removeDecoration(root2, pageName, kind, pageRoots, check) {
31090
32098
  for (const shape of targets) container.removeChild(shape);
31091
32099
  return true;
31092
32100
  }
31093
- function text3(shape, cellName, value) {
32101
+ function text4(shape, cellName, value) {
31094
32102
  const node2 = shape.ownerDocument.createElementNS(shape.namespaceURI, "Cell");
31095
32103
  node2.setAttribute("N", cellName);
31096
32104
  node2.setAttribute("V", value);
@@ -31126,10 +32134,10 @@ function decorationShape(root2, document, id3, spec, ratio) {
31126
32134
  setCell(shape, "LocPinY", height / 2, "Height*0.5");
31127
32135
  setCell(shape, "Angle", 0);
31128
32136
  setCell(shape, "FillPattern", spec.fill ? 1 : 0);
31129
- if (spec.fill) text3(shape, "FillForegnd", spec.fill);
32137
+ if (spec.fill) text4(shape, "FillForegnd", spec.fill);
31130
32138
  setCell(shape, "LinePattern", spec.line ? 1 : 0);
31131
32139
  if (spec.line) {
31132
- text3(shape, "LineColor", spec.line);
32140
+ text4(shape, "LineColor", spec.line);
31133
32141
  setCell(shape, "LineWeight", 1 / 72);
31134
32142
  }
31135
32143
  setCell(shape, "ShdwPattern", 0);
@@ -31286,6 +32294,10 @@ async function editVsdxPages(original, pkg, parts, commands, limits, maxOutput,
31286
32294
  for (const command2 of commands) {
31287
32295
  check();
31288
32296
  const existing = children2(pages, "Page");
32297
+ if (command2.type === "set-page-alt-text") {
32298
+ await setVisioPageAltText(pkg, pagesPart, pages, dirty, command2, check);
32299
+ continue;
32300
+ }
31289
32301
  if (command2.type === "set-page-setup") {
31290
32302
  await setVisioPageSetup(pkg, pagesPart, pages, pagePaths, dirty, command2, check);
31291
32303
  continue;
@@ -31381,7 +32393,7 @@ async function editVsdxPages(original, pkg, parts, commands, limits, maxOutput,
31381
32393
  return { bytes: original, changedParts: [], diagnostics: [] };
31382
32394
  }
31383
32395
  if (commands.some(
31384
- (command2) => command2.type !== "set-page-size" && command2.type !== "set-page-setup" && command2.type !== "set-page-layout" && command2.type !== "set-snap-glue"
32396
+ (command2) => command2.type !== "set-page-size" && command2.type !== "set-page-setup" && command2.type !== "set-page-layout" && command2.type !== "set-page-alt-text" && command2.type !== "set-snap-glue"
31385
32397
  )) {
31386
32398
  await updatePageAppProperties(pkg, pages, priorCount, dirty, limits, check);
31387
32399
  await recalculatePageFormulas(pkg, pagesPart, pages, pagePaths, dirty, check);
@@ -31709,7 +32721,11 @@ function shapeFormattingWrites(edit) {
31709
32721
  ["endArrow", "EndArrow"],
31710
32722
  ["beginArrowSize", "BeginArrowSize"],
31711
32723
  ["endArrowSize", "EndArrowSize"],
31712
- ["lineCap", "LineCap"]
32724
+ ["lineCap", "LineCap"],
32725
+ ["lineJumpCode", "ConLineJumpCode"],
32726
+ ["lineJumpStyle", "ConLineJumpStyle"],
32727
+ ["lineJumpDirectionX", "ConLineJumpDirX"],
32728
+ ["lineJumpDirectionY", "ConLineJumpDirY"]
31713
32729
  ])
31714
32730
  if (edit[name3] !== void 0) add(cell, edit[name3], "LineStyle");
31715
32731
  if (edit.rounding !== void 0) add("Rounding", edit.rounding / 72, "LineStyle", "PT");
@@ -31782,6 +32798,14 @@ async function applyFormattingEdit(pkg, pagePaths, roots, document, edit, check)
31782
32798
  }
31783
32799
  async function formatTarget(pkg, pagePaths, roots, document, edit, check, instance, root2, lenient) {
31784
32800
  const shape = instance?.view ?? targetShape(root2, edit.shapeId);
32801
+ if (edit.type === "format-shape" && [edit.lineJumpCode, edit.lineJumpStyle, edit.lineJumpDirectionX, edit.lineJumpDirectionY].some(
32802
+ (value) => value !== void 0
32803
+ ) && !(children2(shape, "Cell").some(
32804
+ (cell) => attribute2(cell, "N") === "OneD" && Number(attribute2(cell, "V")) === 1
32805
+ ) || ["BeginX", "EndX"].every(
32806
+ (name3) => children2(shape, "Cell").some((cell) => attribute2(cell, "N") === name3)
32807
+ )))
32808
+ fail("INVALID_EDIT", "Line jump settings require a connector.");
31785
32809
  if (instance) {
31786
32810
  const layers = children2(shape, "Cell").find((cell) => attribute2(cell, "N") === "LayerMember");
31787
32811
  await assertInstanceLayersUnlocked(pkg, edit.pageId, attribute2(layers, "V"));
@@ -31815,7 +32839,7 @@ async function formatTarget(pkg, pagePaths, roots, document, edit, check, instan
31815
32839
  continue;
31816
32840
  throw error;
31817
32841
  }
31818
- if (/^(LinePattern|FillPattern|FillGradientEnabled|LineGradientEnabled|LineColorTrans|FillForegndTrans|FillBkgndTrans|FillBkgnd|ShdwPattern|ShdwForegndTrans|ShapeShdwType|GlowColorTrans|ReflectionTrans|ReflectionSize|QuickStyle[A-Za-z]+)$/.test(
32842
+ if (/^(ConLineJump(?:Code|Style|DirX|DirY)|LinePattern|FillPattern|FillGradientEnabled|LineGradientEnabled|LineColorTrans|FillForegndTrans|FillBkgndTrans|FillBkgnd|ShdwPattern|ShdwForegndTrans|ShapeShdwType|GlowColorTrans|ReflectionTrans|ReflectionSize|QuickStyle[A-Za-z]+)$/.test(
31819
32843
  write2.name
31820
32844
  ) && effective?.hasAttribute("U") && visioFormulaCachedValue("0", attribute2(effective, "U")).unit !== "scalar")
31821
32845
  fail(
@@ -32707,6 +33731,56 @@ function applyMetadataEdit(roots, edit, check) {
32707
33731
  return true;
32708
33732
  }
32709
33733
 
33734
+ // visio/edit-alt-text-scope.ts
33735
+ async function applyShapeAltText(pkg, pagePaths, roots, edit, check) {
33736
+ const root2 = roots.get(edit.pageId);
33737
+ if (!root2) fail("EDIT_TARGET_NOT_FOUND", "Page does not exist.");
33738
+ const target2 = textTarget(root2, edit.shapeId, check);
33739
+ const inspect6 = (part) => {
33740
+ for (const cell of Array.from(part.getElementsByTagNameNS(part.namespaceURI, "Cell"))) {
33741
+ check();
33742
+ const formula = executableCellFormula(attribute2(cell, "F"));
33743
+ if (formula && /\bUser\s*\.\s*visAlt(?:Text|Description)\b/i.test(formula))
33744
+ fail(
33745
+ "UNSUPPORTED_METADATA_EDIT",
33746
+ "A formula reads alternative text; dependent caches cannot be recalculated."
33747
+ );
33748
+ }
33749
+ };
33750
+ for (const page of roots.values()) inspect6(page);
33751
+ for (const path of pkg.paths()) {
33752
+ if (/^visio\/.*\.xml$/i.test(path) && !pagePaths.has(path)) inspect6(await pkg.readXml(path));
33753
+ }
33754
+ if (target2.masterId !== void 0) {
33755
+ const template = await masterTemplate(pkg)(target2.masterId, target2.masterShapeId);
33756
+ if (template.hasAttribute("Master") || template.hasAttribute("MasterShape"))
33757
+ fail("UNSUPPORTED_METADATA_EDIT", "Chained master accessibility metadata is not supported.");
33758
+ const inherited = template.cloneNode(true);
33759
+ for (const section3 of children2(inherited, "Section").filter(
33760
+ (section4) => attribute2(section4, "N") === "User"
33761
+ )) {
33762
+ for (const row2 of children2(section3, "Row")) {
33763
+ const localRow = children2(target2.node, "Section").filter((s) => attribute2(s, "N") === "User").flatMap((s) => children2(s, "Row")).find((r) => attribute2(r, "N") === attribute2(row2, "N"));
33764
+ const local = children2(localRow, "Cell").find((cell) => attribute2(cell, "N") === "Value");
33765
+ if (local && attribute2(local, "F") !== "Inh") {
33766
+ for (const cell of children2(row2, "Cell").filter(
33767
+ (cell2) => attribute2(cell2, "N") === "Value"
33768
+ ))
33769
+ row2.removeChild(cell);
33770
+ row2.appendChild(local.cloneNode(true));
33771
+ }
33772
+ }
33773
+ }
33774
+ writeShapeAltText(inherited, edit.title, edit.description, true);
33775
+ }
33776
+ return writeShapeAltText(
33777
+ target2.node,
33778
+ edit.title,
33779
+ edit.description,
33780
+ target2.masterId !== void 0
33781
+ );
33782
+ }
33783
+
32710
33784
  // visio/edit-picture.ts
32711
33785
  var FORMATS = {
32712
33786
  "image/png": { extension: "png", compression: "PNG" },
@@ -32918,7 +33992,7 @@ function assertParentIndependent(facts, from, ids) {
32918
33992
  }
32919
33993
 
32920
33994
  // visio/edit-group.ts
32921
- var clean2 = (value) => Math.abs(value) < 1e-12 ? 0 : value;
33995
+ var clean3 = (value) => Math.abs(value) < 1e-12 ? 0 : value;
32922
33996
  var NONE = /* @__PURE__ */ new Map();
32923
33997
  function topLevel(root2) {
32924
33998
  const containers = children2(root2, "Shapes");
@@ -33038,7 +34112,7 @@ function groupVisioShapes(root2, document, edit, check, instances = NONE) {
33038
34112
  const topmost = members3[members3.length - 1];
33039
34113
  topmost.parentNode.insertBefore(group, topmost);
33040
34114
  for (const plan of plans) {
33041
- const x = clean2(plan.pinX - minX), y = clean2(plan.pinY - minY);
34115
+ const x = clean3(plan.pinX - minX), y = clean3(plan.pinY - minY);
33042
34116
  const instance = instances.get(plan.member);
33043
34117
  if (instance) placeInstance(instance, x, y, check);
33044
34118
  else {
@@ -33111,9 +34185,9 @@ function ungroupVisioShape(root2, document, edit, check, instances = NONE) {
33111
34185
  if (Math.abs(Math.abs(angle) - Math.PI) < 1e-12) angle = Math.PI;
33112
34186
  const plan = {
33113
34187
  member,
33114
- pinX: clean2(a * box4.pinX + c * box4.pinY + e),
33115
- pinY: clean2(b * box4.pinX + d * box4.pinY + f),
33116
- angle: clean2(angle),
34188
+ pinX: clean3(a * box4.pinX + c * box4.pinY + e),
34189
+ pinY: clean3(b * box4.pinX + d * box4.pinY + f),
34190
+ angle: clean3(angle),
33117
34191
  flipX: box4.flipX !== parent.flipX ? 1 : 0,
33118
34192
  flipY: box4.flipY !== parent.flipY ? 1 : 0,
33119
34193
  box: box4
@@ -34330,9 +35404,22 @@ function positive2(value) {
34330
35404
  return value;
34331
35405
  }
34332
35406
  async function editVsdx(input, edits, options = {}) {
34333
- const clock = { deadline: 0, autoSize: /* @__PURE__ */ new Set(), textSizes: [] };
35407
+ const clock = {
35408
+ deadline: 0,
35409
+ autoSize: /* @__PURE__ */ new Set(),
35410
+ textSizes: [],
35411
+ jumpPages: /* @__PURE__ */ new Set(),
35412
+ jumpSource: void 0
35413
+ };
34334
35414
  const edited = await editVsdxTransaction(input, edits, options, clock);
34335
- const result = await refreshTextSizes(clock.textSizes, edited, options, clock.deadline);
35415
+ const resized = await refreshTextSizes(clock.textSizes, edited, options, clock.deadline);
35416
+ const result = await refreshLineJumpCaches(
35417
+ clock.jumpPages,
35418
+ clock.jumpSource,
35419
+ resized,
35420
+ options,
35421
+ clock.deadline
35422
+ );
34336
35423
  return growAutoSizePages(
34337
35424
  clock.autoSize,
34338
35425
  result,
@@ -34342,7 +35429,13 @@ async function editVsdx(input, edits, options = {}) {
34342
35429
  })
34343
35430
  );
34344
35431
  }
34345
- async function editVsdxTransaction(input, edits, options, clock = { deadline: 0, autoSize: /* @__PURE__ */ new Set(), textSizes: [] }) {
35432
+ async function editVsdxTransaction(input, edits, options, clock = {
35433
+ deadline: 0,
35434
+ autoSize: /* @__PURE__ */ new Set(),
35435
+ textSizes: [],
35436
+ jumpPages: /* @__PURE__ */ new Set(),
35437
+ jumpSource: void 0
35438
+ }) {
34346
35439
  const limits = { ...DEFAULTS, ...options.limits };
34347
35440
  for (const value of Object.values(limits)) positive2(value);
34348
35441
  const maxEdits = positive2(options.maxEdits ?? 1e3);
@@ -34354,10 +35447,14 @@ async function editVsdxTransaction(input, edits, options, clock = { deadline: 0,
34354
35447
  if (Date.now() >= deadline) fail("LIMIT_RUNTIME", "Visio edit deadline exceeded.");
34355
35448
  };
34356
35449
  const allCommands = snapshotVisioEdits(edits, maxEdits, maxText);
35450
+ for (const command2 of allCommands)
35451
+ if ((command2.type === "set-page-layout" || command2.type === "format-shape") && Object.keys(command2).some((key2) => /^lineJump|^lineToLine/.test(key2)))
35452
+ clock.jumpPages.add(command2.pageId);
34357
35453
  const commands = allCommands.filter((command2) => !isVisioPageEdit(command2));
34358
35454
  const source = input instanceof Uint8Array ? input : new Uint8Array(input);
34359
35455
  if (source.length > limits.maxInputBytes) fail("LIMIT_INPUT", "ZIP input exceeds limit.");
34360
35456
  const original = new Uint8Array(source);
35457
+ if (clock.jumpPages.size) clock.jumpSource ??= original;
34361
35458
  const subprocess = allCommands.find((command2) => command2.type === "create-subprocess");
34362
35459
  if (subprocess) {
34363
35460
  if (allCommands.length !== 1)
@@ -34624,7 +35721,7 @@ async function editVsdxTransaction(input, edits, options, clock = { deadline: 0,
34624
35721
  if (command2.type === "format-text") await noteTextSize(command2, root2);
34625
35722
  }
34626
35723
  } else if (isVisioMetadataEdit(command2)) {
34627
- if (applyMetadataEdit(roots, command2, check)) {
35724
+ if (command2.type === "set-shape-alt-text" ? await applyShapeAltText(pkg, new Set(pages.values()), roots, command2, check) : applyMetadataEdit(roots, command2, check)) {
34628
35725
  dirty.set(path, root2);
34629
35726
  metadataChanged = true;
34630
35727
  }
@@ -35009,162 +36106,6 @@ async function createVsdx(options = {}) {
35009
36106
  return writeEditedPackage(parts, DEFAULTS.maxInputBytes, deadline, check);
35010
36107
  }
35011
36108
 
35012
- // visio/line-jumps.ts
35013
- var VISIO_LINE_JUMP_WIDTH = 2 / 3 * (1 / 6);
35014
- var VISIO_LINE_JUMP_LIMITS = Object.freeze({ connectors: 2e3, segments: 2e4 });
35015
- var TOKEN = /([MLZmlz]|[A-Za-z])|([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)/g;
35016
- function polylines(path) {
35017
- const result = [];
35018
- let command2 = "";
35019
- let pending;
35020
- for (const match of path.matchAll(TOKEN)) {
35021
- if (match[1]) {
35022
- if (match[1] !== "M" && match[1] !== "L") return void 0;
35023
- if (pending !== void 0) return void 0;
35024
- command2 = match[1];
35025
- continue;
35026
- }
35027
- const value = Number(match[2]);
35028
- if (!Number.isFinite(value) || !command2) return void 0;
35029
- if (pending === void 0) {
35030
- pending = value;
35031
- continue;
35032
- }
35033
- const point2 = { x: pending, y: value };
35034
- pending = void 0;
35035
- if (command2 === "M") {
35036
- result.push([point2]);
35037
- command2 = "L";
35038
- } else result.at(-1)?.push(point2);
35039
- }
35040
- return pending === void 0 && result.every((line) => line.length > 1) ? result : void 0;
35041
- }
35042
- var apply2 = (m, p) => ({
35043
- x: m[0] * p.x + m[2] * p.y + m[4],
35044
- y: m[1] * p.x + m[3] * p.y + m[5]
35045
- });
35046
- function invert(m) {
35047
- const det = m[0] * m[3] - m[1] * m[2];
35048
- if (!Number.isFinite(det) || Math.abs(det) < 1e-12) return void 0;
35049
- return [
35050
- m[3] / det,
35051
- -m[1] / det,
35052
- -m[2] / det,
35053
- m[0] / det,
35054
- (m[2] * m[5] - m[3] * m[4]) / det,
35055
- (m[1] * m[4] - m[0] * m[5]) / det
35056
- ];
35057
- }
35058
- var clean3 = (value) => Math.abs(value) < 1e-9 ? 0 : Number(value.toFixed(6));
35059
- var text4 = (p) => `${clean3(p.x)} ${clean3(p.y)}`;
35060
- var horizontal = (s) => Math.abs(s.a.y - s.b.y) < 1e-6 && Math.abs(s.a.x - s.b.x) > 1e-6;
35061
- var vertical = (s) => Math.abs(s.a.x - s.b.x) < 1e-6 && Math.abs(s.a.y - s.b.y) > 1e-6;
35062
- function crossing(s, other, margin) {
35063
- const dx = s.b.x - s.a.x, dy = s.b.y - s.a.y, ox = other.b.x - other.a.x, oy = other.b.y - other.a.y;
35064
- const det = dx * oy - dy * ox;
35065
- const length = Math.hypot(dx, dy), otherLength = Math.hypot(ox, oy);
35066
- if (Math.abs(det) < 1e-9 || Math.abs(det) / (length * otherLength) < 0.2) return void 0;
35067
- const t = ((other.a.x - s.a.x) * oy - (other.a.y - s.a.y) * ox) / det;
35068
- const u = ((other.a.x - s.a.x) * dy - (other.a.y - s.a.y) * dx) / det;
35069
- if (u * otherLength < 1e-6 || (1 - u) * otherLength < 1e-6) return void 0;
35070
- if (t * length < margin || (1 - t) * length < margin) return void 0;
35071
- return t;
35072
- }
35073
- function jumps(code, s, other) {
35074
- if (code === 1) return horizontal(s) && !horizontal(other);
35075
- if (code === 2) return vertical(s) && !vertical(other);
35076
- if (code === 3 || code === 4) return s.owner > other.owner;
35077
- return code === 5 && s.owner < other.owner;
35078
- }
35079
- function jump(style2, from, to, local) {
35080
- const half = Math.hypot(to.x - from.x, to.y - from.y) / 2;
35081
- const ux = (to.x - from.x) / (2 * half), uy = (to.y - from.y) / (2 * half);
35082
- let nx = -uy, ny = ux;
35083
- if (ny < -1e-9 || Math.abs(ny) <= 1e-9 && nx > 0) {
35084
- nx = -nx;
35085
- ny = -ny;
35086
- }
35087
- const centre = { x: (from.x + to.x) / 2, y: (from.y + to.y) / 2 };
35088
- const at2 = (along, out) => local({ x: centre.x + ux * along + nx * out, y: centre.y + uy * along + ny * out });
35089
- const end = local(to);
35090
- if (style2 === 1) return `M ${text4(end)}`;
35091
- if (style2 === 2) return `L ${text4(at2(-half, half))} L ${text4(at2(half, half))} L ${text4(end)}`;
35092
- if (style2 >= 3) {
35093
- const sides = style2 - 1;
35094
- let out = "";
35095
- for (let index = 1; index < sides; ++index) {
35096
- const angle = Math.PI - Math.PI * index / sides;
35097
- out += `L ${text4(at2(Math.cos(angle) * half, Math.sin(angle) * half))} `;
35098
- }
35099
- return `${out}L ${text4(end)}`;
35100
- }
35101
- const start = local(from), top = at2(0, half);
35102
- const radius = Math.hypot(end.x - start.x, end.y - start.y) / 2;
35103
- const sweep = (end.x - start.x) * (top.y - start.y) - (end.y - start.y) * (top.x - start.x) > 0 ? 0 : 1;
35104
- return `A ${clean3(radius)} ${clean3(radius)} 0 0 ${sweep} ${text4(end)}`;
35105
- }
35106
- var connector = (shape, glued) => shape.kind === "connector" && !shape.hidden && !shape.children.length && (shape.connectorRoute !== void 0 || glued.has(shape.id));
35107
- function visioLineJumpPaths(page) {
35108
- const result = /* @__PURE__ */ new Map();
35109
- const layout = visioPageLayout(page);
35110
- const code = layout.lineJumpCode;
35111
- if (code < 1 || code > 5) return result;
35112
- const glued = new Set(page.connectors.map((connection) => connection.fromShapeId));
35113
- const shapes = page.shapes.filter((shape) => connector(shape, glued)).slice(0, VISIO_LINE_JUMP_LIMITS.connectors);
35114
- if (shapes.length < 2) return result;
35115
- const lines2 = [];
35116
- const segments = [];
35117
- shapes.forEach((shape, owner) => {
35118
- shape.geometry.forEach((geometry, index) => {
35119
- if (!geometry.stroke || geometry.fill) return;
35120
- for (const line of polylines(geometry.path) ?? []) {
35121
- const points = line.map((point2) => apply2(shape.transform, point2));
35122
- lines2.push({ shape, owner, geometry: index, points });
35123
- for (let i = 1; i < points.length; ++i)
35124
- segments.push({ a: points[i - 1], b: points[i], owner });
35125
- }
35126
- });
35127
- });
35128
- if (segments.length > VISIO_LINE_JUMP_LIMITS.segments) return result;
35129
- const half = VISIO_LINE_JUMP_WIDTH / 2;
35130
- const paths = /* @__PURE__ */ new Map();
35131
- const any = /* @__PURE__ */ new Set();
35132
- for (const line of lines2) {
35133
- const inverse = invert(line.shape.transform);
35134
- if (!inverse) continue;
35135
- const local = (point2) => apply2(inverse, point2);
35136
- let out = `M ${text4(local(line.points[0]))}`;
35137
- for (let i = 1; i < line.points.length; ++i) {
35138
- const s = { a: line.points[i - 1], b: line.points[i], owner: line.owner };
35139
- const length = Math.hypot(s.b.x - s.a.x, s.b.y - s.a.y);
35140
- const hits = segments.filter((other) => other.owner !== s.owner && jumps(code, s, other)).flatMap((other) => crossing(s, other, half * 1.5) ?? []).sort((a, b) => a - b);
35141
- let last = -Infinity;
35142
- for (const t of hits) {
35143
- if ((t - last) * length < half * 2.5) continue;
35144
- last = t;
35145
- const at2 = (offset) => ({
35146
- x: s.a.x + (s.b.x - s.a.x) * (t * length + offset) / length,
35147
- y: s.a.y + (s.b.y - s.a.y) * (t * length + offset) / length
35148
- });
35149
- out += ` L ${text4(local(at2(-half)))} ${jump(layout.lineJumpStyle, at2(-half), at2(half), local)}`;
35150
- any.add(line.shape);
35151
- }
35152
- out += ` L ${text4(local(s.b))}`;
35153
- }
35154
- const byGeometry = paths.get(line.shape) ?? /* @__PURE__ */ new Map();
35155
- byGeometry.set(line.geometry, [...byGeometry.get(line.geometry) ?? [], out]);
35156
- paths.set(line.shape, byGeometry);
35157
- }
35158
- for (const shape of any) {
35159
- const byGeometry = paths.get(shape);
35160
- result.set(
35161
- shape,
35162
- shape.geometry.map((geometry, index) => byGeometry.get(index)?.join(" ") ?? geometry.path)
35163
- );
35164
- }
35165
- return result;
35166
- }
35167
-
35168
36109
  // visio/open-arrow.ts
35169
36110
  function visioOpenArrowExtent(size3, lineWidth) {
35170
36111
  const index = Number.isFinite(size3) ? Math.max(0, Math.min(6, Math.trunc(size3))) : 2;
@@ -35257,4 +36198,29 @@ function trimVisioArrowLine(path, start, end, beginExtension = 0) {
35257
36198
  return `M ${point2(start)}${base2 > start ? ` L ${point2(base2)}` : ""} L ${point2(length - end)}`;
35258
36199
  }
35259
36200
 
35260
- export { VISIO_ARROW_SHAPES, VISIO_BACKGROUND_STYLES, VISIO_BASIC_SHAPES, VISIO_BASIC_STENCIL, VISIO_BORDER_STYLES, VISIO_BUILT_IN_STENCILS, VISIO_BUILT_IN_THEMES, VISIO_BUILT_IN_THEME_IDS, VISIO_CALLOUT_STYLES, VISIO_CLIPBOARD_MAGIC, VISIO_CLIPBOARD_MAX_CHARS, VISIO_COMMENT_AUTHOR_LIMIT, VISIO_COMMENT_LIMIT, VISIO_COMMENT_TEXT_LIMIT, VISIO_CONNECTOR_ROUTES, VISIO_CONTAINER_HEADING, VISIO_CONTAINER_MARGIN, VISIO_CONTAINER_STYLES, VISIO_DATA_LIMITS, VISIO_EMF_ADMISSION_LIMITS, VISIO_FIELD_FORMATS, VISIO_FIELD_FUNCTIONS, VISIO_FLOWCHART_SHAPES, VISIO_FOREIGN_VECTOR_LIMITS, VISIO_GLOW_SIZES, VISIO_GLOW_TRANSPARENCY, VISIO_GLUE, VISIO_GRID_DENSITIES, VISIO_LAYER_NAME_LIMIT, VISIO_LINE_JUMP_LIMITS, VISIO_LINE_JUMP_WIDTH, VISIO_MANAGED_BACKGROUND, VISIO_METADATA_TEXT_LIMIT, VISIO_PAGE_LAYOUT_DEFAULTS, VISIO_PATH_SEGMENT_LIMIT, VISIO_PICTURE_MAX_BYTES, VISIO_QUICK_STYLE_COLORS, VISIO_QUICK_STYLE_VARIANT_COLORS, VISIO_RASTER_IMAGE_LIMITS, VISIO_REFLECTION_PRESETS, VISIO_RULER_DENSITIES, VISIO_SCALE_UNITS, VISIO_SHADOW_PRESETS, VISIO_SHAPE_DATA_TYPES, VISIO_SNAP, VISIO_SNAP_GLUE_DEFAULTS, VISIO_SOFT_EDGE_SIZES, VISIO_STENCILS, VISIO_STENCIL_FILES, VISIO_TEXT_CASES, VISIO_TEXT_POSITIONS, VISIO_THEME_COLOR_SLOTS, VISIO_UNTHEMED_COLORS, VISIO_VISIBILITY_LIMITS, VisioForeignVectorError, VisioFormulaError, VisioImageError, VisioPackageError, analyzeVisioFormula, canonicalShapeDataValue, captureVisioClipboard, convertVisioMetafile, createVsdx, deserializeVisioClipboard, designTextMeasurer, editVsdx, evaluateVisioFormula, evaluateVisioTextField, formatVisioFieldValue, getVisioPageLayers, inspectVisioEmfAdmission, inspectVisioRasterImage, isVisioBasicShape, isVisioBuiltInThemeId, isVisioChangeShapeTarget, isVisioDiagramPartEdit, isVisioLayerName, isVisioOutlineShape, isVisioQuickStyleColor, isVisioShadowPreset, isVisioStencilShape, isVisioThemeColorRef, layoutVisioFilledArrowLine, loadVisio, parseLegacyVsd, parseVisioFormula, parseVisioThemeColorFormula, parseVsdx, resolveVisioPageVisibility, resolveVisioThemeColor, sanitizeVisioForeignVectorTree, serializeVisioClipboard, setVisioTextMeasurer, trimVisioArrowLine, validateVisioForeignVector, visioBackgroundShapes, visioBasicShapeOutline, visioBorderShapes, visioBuiltInMaster, visioBuiltInStencil, visioBuiltInTheme, visioCircleThrough, visioCurvedRoute, visioDecorationName, visioFallbackQuickStyle, visioFilledArrow, visioFitFreeform, visioFitPencil, visioFontAssumed, visioFormulaCachedValue, visioLineJumpPaths, visioLinkedRowNames, visioOpenArrowExtent, visioOpenArrowPath, visioOrthogonalRoute, visioOutlineShape, visioPageLayout, visioPageThemeColors, visioPathBounds, visioPathSamples, visioQuarterArc, visioShade, visioShadowPresetGeometry, visioShapeDataRowName, visioShapeStructure, visioSimplifyPath, visioSnapGlue, visioStencilMaster, visioStencilShapeOutline, visioTextExtents, visioThemeColorFormula, visioThemeVariantColors, visioThemeXml };
36201
+ // visio/accessibility.ts
36202
+ function checkVisioAlternativeText(document) {
36203
+ const issues = [];
36204
+ for (const page of document.pages) {
36205
+ const visit = (shapes) => {
36206
+ for (const shape of shapes) {
36207
+ if (shape.hidden) continue;
36208
+ const named2 = [shape.accessibilityTitle, shape.alternativeText, shape.text.plainText].some(
36209
+ (value) => value?.trim()
36210
+ );
36211
+ if (!named2 && shape.kind !== "group")
36212
+ issues.push({
36213
+ pageId: page.id,
36214
+ shapeId: shape.id,
36215
+ shapeName: shape.name,
36216
+ code: "missing-alternative-text"
36217
+ });
36218
+ if (!named2) visit(shape.children);
36219
+ }
36220
+ };
36221
+ visit(page.shapes);
36222
+ }
36223
+ return issues;
36224
+ }
36225
+
36226
+ export { VISIO_ARROW_SHAPES, VISIO_BACKGROUND_STYLES, VISIO_BASIC_SHAPES, VISIO_BASIC_STENCIL, VISIO_BORDER_STYLES, VISIO_BUILT_IN_STENCILS, VISIO_BUILT_IN_THEMES, VISIO_BUILT_IN_THEME_IDS, VISIO_CALLOUT_STYLES, VISIO_CLIPBOARD_MAGIC, VISIO_CLIPBOARD_MAX_CHARS, VISIO_COMMENT_AUTHOR_LIMIT, VISIO_COMMENT_LIMIT, VISIO_COMMENT_TEXT_LIMIT, VISIO_CONNECTOR_ROUTES, VISIO_CONTAINER_HEADING, VISIO_CONTAINER_MARGIN, VISIO_CONTAINER_STYLES, VISIO_DATA_LIMITS, VISIO_EMF_ADMISSION_LIMITS, VISIO_FIELD_FORMATS, VISIO_FIELD_FUNCTIONS, VISIO_FLOWCHART_SHAPES, VISIO_FOREIGN_VECTOR_LIMITS, VISIO_GLOW_SIZES, VISIO_GLOW_TRANSPARENCY, VISIO_GLUE, VISIO_GRID_DENSITIES, VISIO_LAYER_NAME_LIMIT, VISIO_LINE_JUMP_LIMITS, VISIO_LINE_JUMP_WIDTH, VISIO_MANAGED_BACKGROUND, VISIO_METADATA_TEXT_LIMIT, VISIO_PAGE_LAYOUT_DEFAULTS, VISIO_PATH_SEGMENT_LIMIT, VISIO_PICTURE_MAX_BYTES, VISIO_QUICK_STYLE_COLORS, VISIO_QUICK_STYLE_VARIANT_COLORS, VISIO_RASTER_IMAGE_LIMITS, VISIO_REFLECTION_PRESETS, VISIO_RULER_DENSITIES, VISIO_SCALE_UNITS, VISIO_SHADOW_PRESETS, VISIO_SHAPE_DATA_TYPES, VISIO_SNAP, VISIO_SNAP_GLUE_DEFAULTS, VISIO_SOFT_EDGE_SIZES, VISIO_STENCILS, VISIO_STENCIL_FILES, VISIO_TEXT_CASES, VISIO_TEXT_POSITIONS, VISIO_THEME_COLOR_SLOTS, VISIO_UNTHEMED_COLORS, VISIO_VISIBILITY_LIMITS, VisioForeignVectorError, VisioFormulaError, VisioImageError, VisioPackageError, analyzeVisioFormula, canonicalShapeDataValue, captureVisioClipboard, checkVisioAlternativeText, convertVisioMetafile, createVsdx, deserializeVisioClipboard, designTextMeasurer, editVsdx, evaluateVisioFormula, evaluateVisioTextField, formatVisioFieldValue, getVisioPageLayers, inspectVisioEmfAdmission, inspectVisioRasterImage, isVisioBasicShape, isVisioBuiltInThemeId, isVisioChangeShapeTarget, isVisioDiagramPartEdit, isVisioLayerName, isVisioOutlineShape, isVisioQuickStyleColor, isVisioShadowPreset, isVisioStencilShape, isVisioThemeColorRef, layoutVisioFilledArrowLine, loadVisio, parseLegacyVsd, parseVisioFormula, parseVisioThemeColorFormula, parseVsdx, resolveVisioPageVisibility, resolveVisioThemeColor, sanitizeVisioForeignVectorTree, serializeVisioClipboard, setVisioTextMeasurer, trimVisioArrowLine, validateVisioForeignVector, visioBackgroundShapes, visioBasicShapeOutline, visioBorderShapes, visioBuiltInMaster, visioBuiltInStencil, visioBuiltInTheme, visioCircleThrough, visioCurvedRoute, visioDecorationName, visioFallbackQuickStyle, visioFilledArrow, visioFitFreeform, visioFitPencil, visioFontAssumed, visioFormulaCachedValue, visioLineJumpPaths, visioLinkedRowNames, visioOpenArrowExtent, visioOpenArrowPath, visioOrthogonalRoute, visioOutlineShape, visioPageLayout, visioPageThemeColors, visioPathBounds, visioPathSamples, visioQuarterArc, visioShade, visioShadowPresetGeometry, visioShapeDataRowName, visioShapeStructure, visioSimplifyPath, visioSnapGlue, visioStencilMaster, visioStencilShapeOutline, visioTextExtents, visioThemeColorFormula, visioThemeVariantColors, visioThemeXml };