ooxml-core 0.19.0 → 0.21.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.
- package/README.md +21 -43
- package/dist/automation/index.cjs +195 -193
- package/dist/automation/index.mjs +195 -193
- package/dist/chart/axis-nice.d.ts +97 -0
- package/dist/chart/axis-nice.d.ts.map +1 -0
- package/dist/chart/histogram-binning.d.ts +40 -0
- package/dist/chart/histogram-binning.d.ts.map +1 -0
- package/dist/chart/index.cjs +167 -0
- package/dist/chart/index.d.ts +2 -0
- package/dist/chart/index.d.ts.map +1 -1
- package/dist/chart/index.mjs +162 -1
- package/dist/diagram/index.cjs +2 -1
- package/dist/diagram/index.mjs +2 -1
- package/dist/docx/attr-units.d.ts +11 -0
- package/dist/docx/attr-units.d.ts.map +1 -0
- package/dist/docx/block-parser.d.ts.map +1 -1
- package/dist/docx/case-transform.d.ts +9 -0
- package/dist/docx/case-transform.d.ts.map +1 -0
- package/dist/docx/embedded.cjs +2 -1
- package/dist/docx/embedded.mjs +2 -1
- package/dist/docx/index.cjs +289 -3
- package/dist/docx/index.d.ts +5 -0
- package/dist/docx/index.d.ts.map +1 -1
- package/dist/docx/index.mjs +269 -4
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/table-layout.d.ts.map +1 -1
- package/dist/docx/load/index.cjs +2 -1
- package/dist/docx/load/index.mjs +2 -1
- package/dist/docx/page-setup-model.d.ts +29 -0
- package/dist/docx/page-setup-model.d.ts.map +1 -0
- package/dist/docx/page-size.d.ts +11 -0
- package/dist/docx/page-size.d.ts.map +1 -0
- package/dist/docx/parse.d.ts.map +1 -1
- package/dist/docx/section-edit.d.ts +19 -0
- package/dist/docx/section-edit.d.ts.map +1 -0
- package/dist/docx/tab-stops.d.ts.map +1 -1
- package/dist/docx/ui/backstage-focus.d.ts +6 -0
- package/dist/docx/ui/backstage-focus.d.ts.map +1 -0
- package/dist/docx/ui/break-note-schema.d.ts +11 -0
- package/dist/docx/ui/break-note-schema.d.ts.map +1 -0
- package/dist/docx/ui/collaboration-authority.d.ts +31 -0
- package/dist/docx/ui/collaboration-authority.d.ts.map +1 -0
- package/dist/docx/ui/collaboration-identity.d.ts +8 -0
- package/dist/docx/ui/collaboration-identity.d.ts.map +1 -0
- package/dist/docx/ui/collaboration-protocol.d.ts +25 -0
- package/dist/docx/ui/collaboration-protocol.d.ts.map +1 -0
- package/dist/docx/ui/collaboration.d.ts +30 -0
- package/dist/docx/ui/collaboration.d.ts.map +1 -0
- package/dist/docx/ui/defined.d.ts +3 -0
- package/dist/docx/ui/defined.d.ts.map +1 -0
- package/dist/docx/ui/dirty-state.d.ts +9 -0
- package/dist/docx/ui/dirty-state.d.ts.map +1 -0
- package/dist/docx/ui/field-guard.d.ts +21 -0
- package/dist/docx/ui/field-guard.d.ts.map +1 -0
- package/dist/docx/ui/header-footer-history.d.ts +15 -0
- package/dist/docx/ui/header-footer-history.d.ts.map +1 -0
- package/dist/docx/ui/index.cjs +2380 -0
- package/dist/docx/ui/index.d.ts +30 -0
- package/dist/docx/ui/index.d.ts.map +1 -0
- package/dist/docx/ui/index.mjs +2317 -0
- package/dist/docx/ui/inline-content-schema.d.ts +15 -0
- package/dist/docx/ui/inline-content-schema.d.ts.map +1 -0
- package/dist/docx/ui/ligature-style.d.ts +4 -0
- package/dist/docx/ui/ligature-style.d.ts.map +1 -0
- package/dist/docx/ui/node-numbering.d.ts +8 -0
- package/dist/docx/ui/node-numbering.d.ts.map +1 -0
- package/dist/docx/ui/review-schema.d.ts +90 -0
- package/dist/docx/ui/review-schema.d.ts.map +1 -0
- package/dist/docx/ui/ribbon-action-ids.d.ts +26 -0
- package/dist/docx/ui/ribbon-action-ids.d.ts.map +1 -0
- package/dist/docx/ui/ribbon-colors.d.ts +3 -0
- package/dist/docx/ui/ribbon-colors.d.ts.map +1 -0
- package/dist/docx/ui/ribbon-legacy-labels.d.ts +6 -0
- package/dist/docx/ui/ribbon-legacy-labels.d.ts.map +1 -0
- package/dist/docx/ui/run-compare.d.ts +5 -0
- package/dist/docx/ui/run-compare.d.ts.map +1 -0
- package/dist/docx/ui/run-extra-mark.d.ts +17 -0
- package/dist/docx/ui/run-extra-mark.d.ts.map +1 -0
- package/dist/docx/ui/schema-marks.d.ts +273 -0
- package/dist/docx/ui/schema-marks.d.ts.map +1 -0
- package/dist/docx/ui/smartart-theme.d.ts +21 -0
- package/dist/docx/ui/smartart-theme.d.ts.map +1 -0
- package/dist/docx/ui/table-render.d.ts +24 -0
- package/dist/docx/ui/table-render.d.ts.map +1 -0
- package/dist/docx/ui/table-visuals.d.ts +3 -0
- package/dist/docx/ui/table-visuals.d.ts.map +1 -0
- package/dist/docx/ui/theme/css-vars.d.ts +6 -0
- package/dist/docx/ui/theme/css-vars.d.ts.map +1 -0
- package/dist/docx/ui/theme/defaults.d.ts +12 -0
- package/dist/docx/ui/theme/defaults.d.ts.map +1 -0
- package/dist/docx/ui/theme/element.d.ts +9 -0
- package/dist/docx/ui/theme/element.d.ts.map +1 -0
- package/dist/docx/ui/theme/index.d.ts +5 -0
- package/dist/docx/ui/theme/index.d.ts.map +1 -0
- package/dist/docx/ui/theme/types.d.ts +42 -0
- package/dist/docx/ui/theme/types.d.ts.map +1 -0
- package/dist/docx/ui/word-count.d.ts +3 -0
- package/dist/docx/ui/word-count.d.ts.map +1 -0
- package/dist/docx/ui/zoom-fit.d.ts +16 -0
- package/dist/docx/ui/zoom-fit.d.ts.map +1 -0
- package/dist/docx/validate-paragraph.d.ts.map +1 -1
- package/dist/index.cjs +169 -1
- package/dist/index.mjs +169 -1
- package/dist/math/index.cjs +2 -1
- package/dist/math/index.mjs +2 -1
- package/dist/opc/index.cjs +2 -1
- package/dist/opc/index.mjs +2 -1
- package/dist/pptx/automation/index.cjs +1572 -863
- package/dist/pptx/automation/index.d.ts +4 -3
- package/dist/pptx/automation/index.d.ts.map +1 -1
- package/dist/pptx/automation/index.mjs +1572 -863
- package/dist/pptx/chunks/color-ref-BM66NGFP.d.ts +42 -0
- package/dist/pptx/chunks/color-ref-BM66NGFP.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-D0yGoLyw.d.ts → index-CcQTCBnT.d.ts} +63 -479
- package/dist/pptx/chunks/index-CcQTCBnT.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-BtBj3VG1.d.ts → index-DHoPgFcH.d.ts} +529 -11
- package/dist/pptx/chunks/index-DHoPgFcH.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-GuisjlbR.d.ts → text-operations-BzdehTeY.d.ts} +50 -51
- package/dist/pptx/chunks/text-operations-BzdehTeY.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +1204 -489
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +1204 -489
- package/dist/pptx/converter/index.cjs +8 -5
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +8 -5
- package/dist/pptx/index.cjs +1699 -989
- package/dist/pptx/index.d.ts +5 -4
- package/dist/pptx/index.mjs +1698 -990
- package/dist/pptx/ui/index.cjs +510 -0
- package/dist/pptx/ui/index.d.ts +80 -0
- package/dist/pptx/ui/index.d.ts.map +1 -0
- package/dist/pptx/ui/index.mjs +499 -0
- package/dist/visio/index.cjs +2 -1
- package/dist/visio/index.mjs +2 -1
- package/dist/visio/ui/contract.d.ts +33 -0
- package/dist/visio/ui/contract.d.ts.map +1 -0
- package/dist/visio/ui/demo-document.d.ts +4 -0
- package/dist/visio/ui/demo-document.d.ts.map +1 -0
- package/dist/visio/ui/diagnostics.d.ts +10 -0
- package/dist/visio/ui/diagnostics.d.ts.map +1 -0
- package/dist/visio/ui/document-history.d.ts +43 -0
- package/dist/visio/ui/document-history.d.ts.map +1 -0
- package/dist/visio/ui/document-text-search.d.ts +45 -0
- package/dist/visio/ui/document-text-search.d.ts.map +1 -0
- package/dist/visio/ui/edit-commands.d.ts +4 -0
- package/dist/visio/ui/edit-commands.d.ts.map +1 -0
- package/dist/visio/ui/edit-error.d.ts +5 -0
- package/dist/visio/ui/edit-error.d.ts.map +1 -0
- package/dist/visio/ui/foreign-vector-budget.d.ts +25 -0
- package/dist/visio/ui/foreign-vector-budget.d.ts.map +1 -0
- package/dist/visio/ui/index.cjs +1523 -0
- package/dist/visio/ui/index.d.ts +12 -0
- package/dist/visio/ui/index.d.ts.map +1 -0
- package/dist/visio/ui/index.mjs +1498 -0
- package/dist/visio/ui/scene-details.d.ts +8 -0
- package/dist/visio/ui/scene-details.d.ts.map +1 -0
- package/dist/visio/ui/scene-validation.d.ts +5 -0
- package/dist/visio/ui/scene-validation.d.ts.map +1 -0
- package/dist/visio/ui/snapshot-scene.d.ts +9 -0
- package/dist/visio/ui/snapshot-scene.d.ts.map +1 -0
- package/dist/xlsx/index.cjs +100 -98
- package/dist/xlsx/index.mjs +100 -98
- package/dist/xlsx/load/index.cjs +68 -66
- package/dist/xlsx/load/index.mjs +68 -66
- package/dist/xlsx/ui/backstage/templates.d.ts +16 -0
- package/dist/xlsx/ui/backstage/templates.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/alignment.d.ts +4 -0
- package/dist/xlsx/ui/commands/alignment.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/cells.d.ts +3 -0
- package/dist/xlsx/ui/commands/cells.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/cf-presets.d.ts +15 -0
- package/dist/xlsx/ui/commands/cf-presets.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/clipboard.d.ts +22 -0
- package/dist/xlsx/ui/commands/clipboard.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/contextual.d.ts +13 -0
- package/dist/xlsx/ui/commands/contextual.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/data.d.ts +3 -0
- package/dist/xlsx/ui/commands/data.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/editing.d.ts +13 -0
- package/dist/xlsx/ui/commands/editing.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/font.d.ts +21 -0
- package/dist/xlsx/ui/commands/font.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/formulas.d.ts +15 -0
- package/dist/xlsx/ui/commands/formulas.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/core-features.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/core-features.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/format-cells.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/format-cells.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/index.d.ts +4 -0
- package/dist/xlsx/ui/commands/i18n/index.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/messages.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/messages.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/navigation.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/ribbon-home.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/ribbon-home.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/ribbon-tabs.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/ribbon-tabs.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/rules.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/rules.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/tools.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/tools.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/types.d.ts +5 -0
- package/dist/xlsx/ui/commands/i18n/types.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/icons.d.ts +4 -0
- package/dist/xlsx/ui/commands/icons.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/number.d.ts +11 -0
- package/dist/xlsx/ui/commands/number.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/page-layout.d.ts +10 -0
- package/dist/xlsx/ui/commands/page-layout.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/select-special.d.ts +12 -0
- package/dist/xlsx/ui/commands/select-special.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/sort-filter.d.ts +3 -0
- package/dist/xlsx/ui/commands/sort-filter.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/style-presets.d.ts +21 -0
- package/dist/xlsx/ui/commands/style-presets.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/util.d.ts +59 -0
- package/dist/xlsx/ui/commands/util.d.ts.map +1 -0
- package/dist/xlsx/ui/commands.d.ts +36 -0
- package/dist/xlsx/ui/commands.d.ts.map +1 -0
- package/dist/xlsx/ui/context-menu/items.d.ts +36 -0
- package/dist/xlsx/ui/context-menu/items.d.ts.map +1 -0
- package/dist/xlsx/ui/context.d.ts +65 -0
- package/dist/xlsx/ui/context.d.ts.map +1 -0
- package/dist/xlsx/ui/dialogs/format-cells/number-categories.d.ts +28 -0
- package/dist/xlsx/ui/dialogs/format-cells/number-categories.d.ts.map +1 -0
- package/dist/xlsx/ui/dialogs/format-cells/types.d.ts +40 -0
- package/dist/xlsx/ui/dialogs/format-cells/types.d.ts.map +1 -0
- package/dist/xlsx/ui/dialogs/insert-chart-model.d.ts +9 -0
- package/dist/xlsx/ui/dialogs/insert-chart-model.d.ts.map +1 -0
- package/dist/xlsx/ui/dialogs.d.ts +9 -0
- package/dist/xlsx/ui/dialogs.d.ts.map +1 -0
- package/dist/xlsx/ui/dirty-state.d.ts +9 -0
- package/dist/xlsx/ui/dirty-state.d.ts.map +1 -0
- package/dist/xlsx/ui/formula-bar/name-resolve.d.ts +23 -0
- package/dist/xlsx/ui/formula-bar/name-resolve.d.ts.map +1 -0
- package/dist/xlsx/ui/grid/cell-items.d.ts +42 -0
- package/dist/xlsx/ui/grid/cell-items.d.ts.map +1 -0
- package/dist/xlsx/ui/grid/cell-paint.d.ts +26 -0
- package/dist/xlsx/ui/grid/cell-paint.d.ts.map +1 -0
- package/dist/xlsx/ui/grid/edit-bridge.d.ts +47 -0
- package/dist/xlsx/ui/grid/edit-bridge.d.ts.map +1 -0
- package/dist/xlsx/ui/grid/geometry.d.ts +76 -0
- package/dist/xlsx/ui/grid/geometry.d.ts.map +1 -0
- package/dist/xlsx/ui/grid/icon-sets.d.ts +3 -0
- package/dist/xlsx/ui/grid/icon-sets.d.ts.map +1 -0
- package/dist/xlsx/ui/grid/number-fit.d.ts +3 -0
- package/dist/xlsx/ui/grid/number-fit.d.ts.map +1 -0
- package/dist/xlsx/ui/grid/selection-ops.d.ts +32 -0
- package/dist/xlsx/ui/grid/selection-ops.d.ts.map +1 -0
- package/dist/xlsx/ui/grid/view-cache.d.ts +15 -0
- package/dist/xlsx/ui/grid/view-cache.d.ts.map +1 -0
- package/dist/xlsx/ui/index.cjs +28484 -0
- package/dist/xlsx/ui/index.d.ts +56 -0
- package/dist/xlsx/ui/index.d.ts.map +1 -0
- package/dist/xlsx/ui/index.mjs +28290 -0
- package/dist/xlsx/ui/locales/de/commands.d.ts +2 -0
- package/dist/xlsx/ui/locales/de/commands.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/de/grid.d.ts +2 -0
- package/dist/xlsx/ui/locales/de/grid.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/de/index.d.ts +2 -0
- package/dist/xlsx/ui/locales/de/index.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/de/shell.d.ts +2 -0
- package/dist/xlsx/ui/locales/de/shell.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/en/commands.d.ts +2 -0
- package/dist/xlsx/ui/locales/en/commands.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/en/grid.d.ts +2 -0
- package/dist/xlsx/ui/locales/en/grid.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/en/index.d.ts +2 -0
- package/dist/xlsx/ui/locales/en/index.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/en/shell.d.ts +2 -0
- package/dist/xlsx/ui/locales/en/shell.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/es/commands.d.ts +2 -0
- package/dist/xlsx/ui/locales/es/commands.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/es/grid.d.ts +2 -0
- package/dist/xlsx/ui/locales/es/grid.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/es/index.d.ts +2 -0
- package/dist/xlsx/ui/locales/es/index.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/es/shell.d.ts +2 -0
- package/dist/xlsx/ui/locales/es/shell.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/fr/commands.d.ts +2 -0
- package/dist/xlsx/ui/locales/fr/commands.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/fr/grid.d.ts +2 -0
- package/dist/xlsx/ui/locales/fr/grid.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/fr/index.d.ts +2 -0
- package/dist/xlsx/ui/locales/fr/index.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/fr/shell.d.ts +2 -0
- package/dist/xlsx/ui/locales/fr/shell.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/merge.d.ts +7 -0
- package/dist/xlsx/ui/locales/merge.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/zh-CN/commands.d.ts +2 -0
- package/dist/xlsx/ui/locales/zh-CN/commands.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/zh-CN/grid.d.ts +2 -0
- package/dist/xlsx/ui/locales/zh-CN/grid.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/zh-CN/index.d.ts +2 -0
- package/dist/xlsx/ui/locales/zh-CN/index.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/zh-CN/shell.d.ts +2 -0
- package/dist/xlsx/ui/locales/zh-CN/shell.d.ts.map +1 -0
- package/dist/xlsx/ui/localization.d.ts +23 -0
- package/dist/xlsx/ui/localization.d.ts.map +1 -0
- package/dist/xlsx/ui/ribbon/icon-paths.d.ts +9 -0
- package/dist/xlsx/ui/ribbon/icon-paths.d.ts.map +1 -0
- package/dist/xlsx/ui/ribbon/parts.d.ts +88 -0
- package/dist/xlsx/ui/ribbon/parts.d.ts.map +1 -0
- package/dist/xlsx/ui/ribbon/tab-api.d.ts +21 -0
- package/dist/xlsx/ui/ribbon/tab-api.d.ts.map +1 -0
- package/dist/xlsx/ui/ribbon/tabs/review-view.d.ts +5 -0
- package/dist/xlsx/ui/ribbon/tabs/review-view.d.ts.map +1 -0
- package/dist/xlsx/ui/ribbon/tabs/theme-palette.d.ts +8 -0
- package/dist/xlsx/ui/ribbon/tabs/theme-palette.d.ts.map +1 -0
- package/dist/xlsx/ui/ribbon/tell-me.d.ts +16 -0
- package/dist/xlsx/ui/ribbon/tell-me.d.ts.map +1 -0
- package/dist/xlsx/ui/selection.d.ts +34 -0
- package/dist/xlsx/ui/selection.d.ts.map +1 -0
- package/dist/xlsx/ui/theme/css-vars.d.ts +6 -0
- package/dist/xlsx/ui/theme/css-vars.d.ts.map +1 -0
- package/dist/xlsx/ui/theme/defaults.d.ts +6 -0
- package/dist/xlsx/ui/theme/defaults.d.ts.map +1 -0
- package/dist/xlsx/ui/theme/element.d.ts +9 -0
- package/dist/xlsx/ui/theme/element.d.ts.map +1 -0
- package/dist/xlsx/ui/theme/types.d.ts +54 -0
- package/dist/xlsx/ui/theme/types.d.ts.map +1 -0
- package/dist/xml/index.cjs +2 -1
- package/dist/xml/index.mjs +2 -1
- package/package.json +42 -4
- package/dist/pptx/chunks/index-BtBj3VG1.d.ts.map +0 -1
- package/dist/pptx/chunks/index-D0yGoLyw.d.ts.map +0 -1
- package/dist/pptx/chunks/text-operations-GuisjlbR.d.ts.map +0 -1
|
@@ -86,7 +86,8 @@ function parseXml(xml, options = {}) {
|
|
|
86
86
|
}).parseFromString(xml, "application/xml");
|
|
87
87
|
} catch (error) {
|
|
88
88
|
throw new Error(
|
|
89
|
-
`Invalid ${label2} XML: ${error instanceof Error ? error.message : String(error)}
|
|
89
|
+
`Invalid ${label2} XML: ${error instanceof Error ? error.message : String(error)}`,
|
|
90
|
+
{ cause: error }
|
|
90
91
|
);
|
|
91
92
|
}
|
|
92
93
|
if (parseError || !parsed.documentElement)
|
|
@@ -1431,12 +1432,12 @@ function paragraphsOf(blocks) {
|
|
|
1431
1432
|
}
|
|
1432
1433
|
function commentContinuations(blocks) {
|
|
1433
1434
|
const paragraphs = paragraphsOf(blocks);
|
|
1434
|
-
const
|
|
1435
|
+
const first3 = /* @__PURE__ */ new Map();
|
|
1435
1436
|
const last = /* @__PURE__ */ new Map();
|
|
1436
1437
|
const idsByParagraph = paragraphs.map((paragraph, index2) => {
|
|
1437
1438
|
const ids = new Set(paragraph.runs.flatMap(rangeKeys));
|
|
1438
1439
|
for (const id of ids) {
|
|
1439
|
-
if (!
|
|
1440
|
+
if (!first3.has(id)) first3.set(id, index2);
|
|
1440
1441
|
last.set(id, index2);
|
|
1441
1442
|
}
|
|
1442
1443
|
return ids;
|
|
@@ -1444,7 +1445,7 @@ function commentContinuations(blocks) {
|
|
|
1444
1445
|
const result2 = /* @__PURE__ */ new Map();
|
|
1445
1446
|
paragraphs.forEach((paragraph, index2) => {
|
|
1446
1447
|
const ids = [...idsByParagraph[index2] ?? []];
|
|
1447
|
-
const before = new Set(ids.filter((id) => (
|
|
1448
|
+
const before = new Set(ids.filter((id) => (first3.get(id) ?? index2) < index2));
|
|
1448
1449
|
const after = new Set(ids.filter((id) => (last.get(id) ?? index2) > index2));
|
|
1449
1450
|
if (before.size || after.size) result2.set(paragraph.id, { before, after });
|
|
1450
1451
|
});
|
|
@@ -1646,11 +1647,11 @@ function rangeEndNodes(doc, edge) {
|
|
|
1646
1647
|
return [end];
|
|
1647
1648
|
}
|
|
1648
1649
|
function rangeEdges(runs, ranges) {
|
|
1649
|
-
const
|
|
1650
|
+
const first3 = /* @__PURE__ */ new Map();
|
|
1650
1651
|
const last = /* @__PURE__ */ new Map();
|
|
1651
1652
|
runs.forEach((run, index2) => {
|
|
1652
1653
|
for (const key2 of rangeKeys(run)) {
|
|
1653
|
-
if (!
|
|
1654
|
+
if (!first3.has(key2)) first3.set(key2, index2);
|
|
1654
1655
|
last.set(key2, index2);
|
|
1655
1656
|
}
|
|
1656
1657
|
});
|
|
@@ -1670,9 +1671,9 @@ function rangeEdges(runs, ranges) {
|
|
|
1670
1671
|
const opens = /* @__PURE__ */ new Map();
|
|
1671
1672
|
const closes = /* @__PURE__ */ new Map();
|
|
1672
1673
|
const order = (key2) => key2.startsWith("comment:") ? 0 : 1;
|
|
1673
|
-
for (const key2 of [...
|
|
1674
|
+
for (const key2 of [...first3.keys()].sort((a, b) => order(a) - order(b))) {
|
|
1674
1675
|
if (!ranges?.before.has(key2)) {
|
|
1675
|
-
const index2 =
|
|
1676
|
+
const index2 = first3.get(key2);
|
|
1676
1677
|
(opens.get(index2) ?? opens.set(index2, []).get(index2)).push(edgeFor(key2, index2));
|
|
1677
1678
|
}
|
|
1678
1679
|
if (!ranges?.after.has(key2)) {
|
|
@@ -8601,7 +8602,8 @@ async function readZipParts(input, limits = {}) {
|
|
|
8601
8602
|
zip = await JSZip__default.default.loadAsync(bytes);
|
|
8602
8603
|
} catch (error) {
|
|
8603
8604
|
throw new Error(
|
|
8604
|
-
`Not a valid XLSX package: ${error instanceof Error ? error.message : String(error)}
|
|
8605
|
+
`Not a valid XLSX package: ${error instanceof Error ? error.message : String(error)}`,
|
|
8606
|
+
{ cause: error }
|
|
8605
8607
|
);
|
|
8606
8608
|
}
|
|
8607
8609
|
const entries = Object.values(zip.files).filter((entry) => !entry.dir);
|
|
@@ -9591,24 +9593,24 @@ function mergeSpacedAreas(tokens2) {
|
|
|
9591
9593
|
const out = [];
|
|
9592
9594
|
const plainCell = (t) => t?.kind === "ref" && t.ref?.kind === "cell" && !t.spill;
|
|
9593
9595
|
for (let i = 0; i < tokens2.length; i++) {
|
|
9594
|
-
const
|
|
9596
|
+
const first3 = tokens2[i];
|
|
9595
9597
|
let j = i + 1;
|
|
9596
9598
|
while (tokens2[j]?.kind === "ws") j++;
|
|
9597
9599
|
let k = j + 1;
|
|
9598
9600
|
while (tokens2[k]?.kind === "ws") k++;
|
|
9599
9601
|
const colon = tokens2[j];
|
|
9600
9602
|
const last = tokens2[k];
|
|
9601
|
-
if (plainCell(
|
|
9603
|
+
if (plainCell(first3) && colon?.kind === "op" && colon.text === ":" && plainCell(last) && !last?.prefix && k > i + 2 && first3.ref && last?.ref) {
|
|
9602
9604
|
const text = tokens2.slice(i, k + 1).map((t) => t.text).join("");
|
|
9603
9605
|
out.push({
|
|
9604
|
-
...
|
|
9606
|
+
...first3,
|
|
9605
9607
|
text,
|
|
9606
|
-
ref: { kind: "area", start:
|
|
9608
|
+
ref: { kind: "area", start: first3.ref.start, end: last.ref.start }
|
|
9607
9609
|
});
|
|
9608
9610
|
i = k;
|
|
9609
9611
|
continue;
|
|
9610
9612
|
}
|
|
9611
|
-
out.push(
|
|
9613
|
+
out.push(first3);
|
|
9612
9614
|
}
|
|
9613
9615
|
return out;
|
|
9614
9616
|
}
|
|
@@ -9660,10 +9662,10 @@ function renameSheetInFormula(formula, oldName, newName) {
|
|
|
9660
9662
|
for (const token of tokens2) {
|
|
9661
9663
|
const prefix = token.prefix;
|
|
9662
9664
|
if (!prefix || prefix.book !== void 0) continue;
|
|
9663
|
-
const
|
|
9665
|
+
const first3 = prefix.sheet.toLowerCase() === lower2;
|
|
9664
9666
|
const second = prefix.sheet2?.toLowerCase() === lower2;
|
|
9665
|
-
if (!
|
|
9666
|
-
const renamed = { ...prefix, sheet:
|
|
9667
|
+
if (!first3 && !second) continue;
|
|
9668
|
+
const renamed = { ...prefix, sheet: first3 ? newName : prefix.sheet };
|
|
9667
9669
|
if (prefix.sheet2 !== void 0) renamed.sheet2 = second ? newName : prefix.sheet2;
|
|
9668
9670
|
const text = prefixText(renamed);
|
|
9669
9671
|
token.text = text + token.text.slice(prefix.text.length);
|
|
@@ -11483,9 +11485,9 @@ function seriesXml(chart, series, index2) {
|
|
|
11483
11485
|
var axes = (horizontal, scatter) => {
|
|
11484
11486
|
const common = '<c:scaling><c:orientation val="minMax"/></c:scaling><c:delete val="0"/>';
|
|
11485
11487
|
const ticks = '<c:numFmt formatCode="General" sourceLinked="1"/><c:majorTickMark val="out"/><c:minorTickMark val="none"/><c:tickLblPos val="nextTo"/>';
|
|
11486
|
-
const
|
|
11488
|
+
const first3 = scatter ? `<c:valAx><c:axId val="500000001"/>${common}<c:axPos val="b"/>${ticks}<c:crossAx val="500000002"/><c:crosses val="autoZero"/><c:crossBetween val="midCat"/></c:valAx>` : `<c:catAx><c:axId val="500000001"/>${common}<c:axPos val="${horizontal ? "l" : "b"}"/>${ticks}<c:crossAx val="500000002"/><c:crosses val="autoZero"/><c:auto val="1"/><c:lblAlgn val="ctr"/><c:lblOffset val="100"/><c:noMultiLvlLbl val="0"/></c:catAx>`;
|
|
11487
11489
|
const second = `<c:valAx><c:axId val="500000002"/>${common}<c:axPos val="${horizontal ? "b" : "l"}"/><c:majorGridlines/>${ticks}<c:crossAx val="500000001"/><c:crosses val="autoZero"/><c:crossBetween val="${scatter ? "midCat" : "between"}"/></c:valAx>`;
|
|
11488
|
-
return
|
|
11490
|
+
return first3 + second;
|
|
11489
11491
|
};
|
|
11490
11492
|
var AX_IDS = '<c:axId val="500000001"/><c:axId val="500000002"/>';
|
|
11491
11493
|
function plotXml(chart) {
|
|
@@ -12681,8 +12683,8 @@ function fitNumber(value, format, options) {
|
|
|
12681
12683
|
const date1904 = options.date1904 ?? false;
|
|
12682
12684
|
const width = options.width ?? 0;
|
|
12683
12685
|
const fits = (text) => (options.measure ? options.measure(text) : text.length) <= width;
|
|
12684
|
-
const
|
|
12685
|
-
if (fits(
|
|
12686
|
+
const first3 = formatNumber(value, format, date1904);
|
|
12687
|
+
if (fits(first3.text) || first3.text === OVERFLOW_TEXT) return first3;
|
|
12686
12688
|
const choice2 = chooseSection(compileFormat(format), value);
|
|
12687
12689
|
const general = choice2 && !choice2.section.number && !choice2.section.fraction && choice2.section.tokens.some((t) => t.t === "general");
|
|
12688
12690
|
if (general) {
|
|
@@ -12692,7 +12694,7 @@ function fitNumber(value, format, options) {
|
|
|
12692
12694
|
}
|
|
12693
12695
|
}
|
|
12694
12696
|
const fill2 = hashFill(options);
|
|
12695
|
-
return
|
|
12697
|
+
return first3.color ? { text: fill2, color: first3.color } : { text: fill2 };
|
|
12696
12698
|
}
|
|
12697
12699
|
function formatNumber(value, format, date1904, generalWidth) {
|
|
12698
12700
|
if (!Number.isFinite(value)) return { text: "#NUM!" };
|
|
@@ -13343,9 +13345,9 @@ function serialToYmd(serial, date1904 = date1904Mode) {
|
|
|
13343
13345
|
return { year: d.getUTCFullYear(), month: d.getUTCMonth() + 1, day: d.getUTCDate() };
|
|
13344
13346
|
}
|
|
13345
13347
|
function monthStartSerial(year, month0, date1904) {
|
|
13346
|
-
const
|
|
13347
|
-
|
|
13348
|
-
const days = Math.round((
|
|
13348
|
+
const first3 = /* @__PURE__ */ new Date(0);
|
|
13349
|
+
first3.setUTCFullYear(year, month0, 1);
|
|
13350
|
+
const days = Math.round((first3.getTime() - (date1904 ? EPOCH_19042 : EPOCH_19003)) / DAY_MS2);
|
|
13349
13351
|
return !date1904 && days < 61 ? days - 1 : days;
|
|
13350
13352
|
}
|
|
13351
13353
|
function ymdToSerial(year, month, day, date1904 = date1904Mode) {
|
|
@@ -14413,9 +14415,9 @@ function percentRank(values2, x, digits2, exclusive) {
|
|
|
14413
14415
|
const s = sorted(values2);
|
|
14414
14416
|
const n = s.length;
|
|
14415
14417
|
if (n === 0 || digits2 < 1) fail(ERR.NUM);
|
|
14416
|
-
const
|
|
14418
|
+
const first3 = s[0];
|
|
14417
14419
|
const last = s[n - 1];
|
|
14418
|
-
if (x <
|
|
14420
|
+
if (x < first3 || x > last) fail(ERR.NA);
|
|
14419
14421
|
let rank4;
|
|
14420
14422
|
const lower2 = s.filter((v) => v < x).length;
|
|
14421
14423
|
const exact = s.includes(x);
|
|
@@ -14615,8 +14617,8 @@ function weekendDays(value) {
|
|
|
14615
14617
|
}
|
|
14616
14618
|
const code = Math.trunc(num2(v));
|
|
14617
14619
|
if (code >= 1 && code <= 7) {
|
|
14618
|
-
const
|
|
14619
|
-
return /* @__PURE__ */ new Set([
|
|
14620
|
+
const first3 = (code + 5) % 7;
|
|
14621
|
+
return /* @__PURE__ */ new Set([first3, (first3 + 1) % 7]);
|
|
14620
14622
|
}
|
|
14621
14623
|
if (code >= 11 && code <= 17) return /* @__PURE__ */ new Set([code - 11]);
|
|
14622
14624
|
return fail(ERR.NUM);
|
|
@@ -15860,16 +15862,16 @@ function quasiPeriods(anchor, from, to, frequency2, ctx) {
|
|
|
15860
15862
|
}
|
|
15861
15863
|
function accruedInterest(args, ctx) {
|
|
15862
15864
|
const issue = serialArg(args[0]);
|
|
15863
|
-
const
|
|
15865
|
+
const first3 = serialArg(args[1]);
|
|
15864
15866
|
const settlement = serialArg(args[2]);
|
|
15865
15867
|
const [rate, par] = [num2(args[3]), optNum(args, 4, 1e3)];
|
|
15866
15868
|
const frequency2 = int3(args[5]);
|
|
15867
15869
|
const basis = basisOf(args, 6);
|
|
15868
15870
|
const fromIssue = args.length > 7 && args[7] !== null ? bool(args[7]) : true;
|
|
15869
15871
|
if (rate <= 0 || par <= 0 || ![1, 2, 4].includes(frequency2) || issue >= settlement) fail(ERR.NUM);
|
|
15870
|
-
const start = fromIssue ? issue : Math.max(issue,
|
|
15872
|
+
const start = fromIssue ? issue : Math.max(issue, first3);
|
|
15871
15873
|
if (start >= settlement) return 0;
|
|
15872
|
-
const dates = quasiPeriods(
|
|
15874
|
+
const dates = quasiPeriods(first3, start, settlement, frequency2, ctx);
|
|
15873
15875
|
const count2 = (a, b) => basis === 0 || basis === 4 ? days360(a, b, basis === 4, ctx) : b - a;
|
|
15874
15876
|
let sum2 = 0;
|
|
15875
15877
|
for (let i = 0; i + 1 < dates.length; i++) {
|
|
@@ -16328,8 +16330,8 @@ function datedFlows(ctx, args) {
|
|
|
16328
16330
|
const values2 = collectNumbers(ctx, [args[0] ?? null]);
|
|
16329
16331
|
const dates = collectNumbers(ctx, [args[1] ?? null]).map(Math.floor);
|
|
16330
16332
|
if (values2.length !== dates.length || values2.length === 0) fail(ERR.NUM);
|
|
16331
|
-
const
|
|
16332
|
-
if (dates.some((d) => d <
|
|
16333
|
+
const first3 = dates[0];
|
|
16334
|
+
if (dates.some((d) => d < first3)) fail(ERR.NUM);
|
|
16333
16335
|
return { values: values2, dates };
|
|
16334
16336
|
}
|
|
16335
16337
|
var xnpv = (rate, values2, dates) => values2.reduce(
|
|
@@ -16501,13 +16503,13 @@ function sheetIndex(host, name) {
|
|
|
16501
16503
|
function prefixSheets(host, prefix, current) {
|
|
16502
16504
|
if (!prefix) return [current];
|
|
16503
16505
|
if (prefix.book !== void 0) return void 0;
|
|
16504
|
-
const
|
|
16505
|
-
if (
|
|
16506
|
-
if (prefix.sheet2 === void 0) return [
|
|
16506
|
+
const first3 = sheetIndex(host, prefix.sheet);
|
|
16507
|
+
if (first3 < 0) return void 0;
|
|
16508
|
+
if (prefix.sheet2 === void 0) return [first3];
|
|
16507
16509
|
const last = sheetIndex(host, prefix.sheet2);
|
|
16508
16510
|
if (last < 0) return void 0;
|
|
16509
16511
|
const out = [];
|
|
16510
|
-
for (let i = Math.min(
|
|
16512
|
+
for (let i = Math.min(first3, last); i <= Math.max(first3, last); i++) out.push(i);
|
|
16511
16513
|
return out;
|
|
16512
16514
|
}
|
|
16513
16515
|
var specRange = (spec2) => normalizeRange({
|
|
@@ -18078,7 +18080,7 @@ function matchingCells(ctx, pairs, target, sameShape) {
|
|
|
18078
18080
|
const tests = pairs.map((p) => makeCriteria(scalar(p.criteria)));
|
|
18079
18081
|
const values2 = matrices[matrices.length - 1];
|
|
18080
18082
|
const out = [];
|
|
18081
|
-
const
|
|
18083
|
+
const first3 = matrices[0];
|
|
18082
18084
|
const holds = (r, c2) => {
|
|
18083
18085
|
for (let i = 0; i < tests.length; i++) {
|
|
18084
18086
|
if (!tests[i](matrices[i].get(r, c2))) return false;
|
|
@@ -18088,23 +18090,23 @@ function matchingCells(ctx, pairs, target, sameShape) {
|
|
|
18088
18090
|
const candidates = indexedCandidates(pairs, matrices);
|
|
18089
18091
|
if (candidates) {
|
|
18090
18092
|
for (const at of candidates) {
|
|
18091
|
-
const r = Math.floor(at /
|
|
18092
|
-
const c2 = at - r *
|
|
18093
|
+
const r = Math.floor(at / first3.cols);
|
|
18094
|
+
const c2 = at - r * first3.cols;
|
|
18093
18095
|
if (holds(r, c2)) out.push(values2.get(r, c2));
|
|
18094
18096
|
}
|
|
18095
18097
|
} else {
|
|
18096
|
-
for (let r = 0; r <
|
|
18097
|
-
for (let c2 = 0; c2 <
|
|
18098
|
+
for (let r = 0; r < first3.rows; r++) {
|
|
18099
|
+
for (let c2 = 0; c2 < first3.cols; c2++) if (holds(r, c2)) out.push(values2.get(r, c2));
|
|
18098
18100
|
}
|
|
18099
18101
|
}
|
|
18100
18102
|
const blankTail = total2 > block && tests.every((test) => test(null)) ? total2 - block : 0;
|
|
18101
18103
|
return { values: out, blankTail };
|
|
18102
18104
|
}
|
|
18103
18105
|
function indexedCandidates(pairs, matrices) {
|
|
18104
|
-
const
|
|
18106
|
+
const first3 = matrices[0];
|
|
18105
18107
|
for (let i = 0; i < pairs.length; i++) {
|
|
18106
18108
|
const m = matrices[i];
|
|
18107
|
-
if (!(pairs[i]?.range instanceof RefValue) || m.cols !==
|
|
18109
|
+
if (!(pairs[i]?.range instanceof RefValue) || m.cols !== first3.cols) continue;
|
|
18108
18110
|
const key2 = equalityKey(scalar(pairs[i]?.criteria));
|
|
18109
18111
|
if (key2 === void 0) continue;
|
|
18110
18112
|
const found = positionsOf(m, key2);
|
|
@@ -18161,12 +18163,12 @@ var C18 = "Math & Trig";
|
|
|
18161
18163
|
var numbersOf = (values2) => values2.filter((v) => typeof v === "number");
|
|
18162
18164
|
function sumProduct(ctx, args) {
|
|
18163
18165
|
const matrices = args.map((a) => ctx.toMatrix(a));
|
|
18164
|
-
const
|
|
18165
|
-
if (!
|
|
18166
|
-
for (const m of matrices) if (m.rows !==
|
|
18166
|
+
const first3 = matrices[0];
|
|
18167
|
+
if (!first3) fail(ERR.VALUE);
|
|
18168
|
+
for (const m of matrices) if (m.rows !== first3.rows || m.cols !== first3.cols) fail(ERR.VALUE);
|
|
18167
18169
|
let total2 = 0;
|
|
18168
|
-
for (let r = 0; r <
|
|
18169
|
-
for (let c2 = 0; c2 <
|
|
18170
|
+
for (let r = 0; r < first3.rows; r++) {
|
|
18171
|
+
for (let c2 = 0; c2 < first3.cols; c2++) {
|
|
18170
18172
|
let product = 1;
|
|
18171
18173
|
for (const m of matrices) {
|
|
18172
18174
|
const v = m.get(r, c2);
|
|
@@ -22032,9 +22034,9 @@ function visit(node, c2) {
|
|
|
22032
22034
|
let sheet = c2.sheet;
|
|
22033
22035
|
if (node.prefix) {
|
|
22034
22036
|
const sheets = prefixSheets(c2.host, node.prefix, c2.sheet);
|
|
22035
|
-
const
|
|
22036
|
-
if (
|
|
22037
|
-
sheet =
|
|
22037
|
+
const first3 = sheets?.[0];
|
|
22038
|
+
if (first3 === void 0) return;
|
|
22039
|
+
sheet = first3;
|
|
22038
22040
|
}
|
|
22039
22041
|
const defined = findDefinedName(c2.host, node.name, sheet, node.prefix !== void 0);
|
|
22040
22042
|
if (defined) {
|
|
@@ -22172,9 +22174,9 @@ var AreaIndex = class {
|
|
|
22172
22174
|
else this.wide.set(area.sheet, [entry]);
|
|
22173
22175
|
return;
|
|
22174
22176
|
}
|
|
22175
|
-
const
|
|
22177
|
+
const first3 = start.row >> CHUNK_SHIFT;
|
|
22176
22178
|
const last = end.row >> CHUNK_SHIFT;
|
|
22177
|
-
if (last -
|
|
22179
|
+
if (last - first3 + 1 > CHUNKS) {
|
|
22178
22180
|
const cols2 = inner(this.tall, area.sheet);
|
|
22179
22181
|
for (let c2 = start.col; c2 <= end.col; c2++) push2(cols2, c2, entry);
|
|
22180
22182
|
return;
|
|
@@ -22183,7 +22185,7 @@ var AreaIndex = class {
|
|
|
22183
22185
|
for (let c2 = start.col; c2 <= end.col; c2++) {
|
|
22184
22186
|
let chunks = cols.get(c2);
|
|
22185
22187
|
if (!chunks) cols.set(c2, chunks = /* @__PURE__ */ new Map());
|
|
22186
|
-
for (let k =
|
|
22188
|
+
for (let k = first3; k <= last; k++) push2(chunks, k, entry);
|
|
22187
22189
|
}
|
|
22188
22190
|
}
|
|
22189
22191
|
/** Items whose areas intersect `range` on `sheet` (each once). */
|
|
@@ -22224,13 +22226,13 @@ var AreaIndex = class {
|
|
|
22224
22226
|
} else for (const c2 of map.keys()) if (c2 >= start.col && c2 <= end.col) visit2(c2);
|
|
22225
22227
|
};
|
|
22226
22228
|
const chunked = this.chunked.get(sheet);
|
|
22227
|
-
const
|
|
22229
|
+
const first3 = start.row >> CHUNK_SHIFT;
|
|
22228
22230
|
const last = end.row >> CHUNK_SHIFT;
|
|
22229
22231
|
columns(chunked, (c2) => {
|
|
22230
22232
|
const chunks = chunked?.get(c2);
|
|
22231
|
-
if (last -
|
|
22232
|
-
for (let k =
|
|
22233
|
-
} else for (const [k, list] of chunks) if (k >=
|
|
22233
|
+
if (last - first3 + 1 <= chunks.size) {
|
|
22234
|
+
for (let k = first3; k <= last; k++) check3(chunks.get(k));
|
|
22235
|
+
} else for (const [k, list] of chunks) if (k >= first3 && k <= last) check3(list);
|
|
22234
22236
|
});
|
|
22235
22237
|
const tall = this.tall.get(sheet);
|
|
22236
22238
|
columns(tall, (c2) => check3(tall?.get(c2)));
|
|
@@ -22700,8 +22702,8 @@ function formulaOrder(nodes, successors) {
|
|
|
22700
22702
|
const ranks = /* @__PURE__ */ new Map();
|
|
22701
22703
|
const components = stronglyConnected(nodes, successors).map((members, rank4) => {
|
|
22702
22704
|
for (const member of members) ranks.set(member, rank4);
|
|
22703
|
-
const
|
|
22704
|
-
return { nodes: members, cyclic: members.length > 1 || successors(
|
|
22705
|
+
const first3 = members[0];
|
|
22706
|
+
return { nodes: members, cyclic: members.length > 1 || successors(first3).includes(first3) };
|
|
22705
22707
|
});
|
|
22706
22708
|
return { components, ranks };
|
|
22707
22709
|
}
|
|
@@ -22740,9 +22742,9 @@ function sameRange(a, b) {
|
|
|
22740
22742
|
return a.start.row === b.start.row && a.start.col === b.start.col && a.end.row === b.end.row && a.end.col === b.end.col;
|
|
22741
22743
|
}
|
|
22742
22744
|
function boundingBox(ranges) {
|
|
22743
|
-
const
|
|
22744
|
-
const start = { ...
|
|
22745
|
-
const end = { ...
|
|
22745
|
+
const first3 = ranges[0];
|
|
22746
|
+
const start = { ...first3.start };
|
|
22747
|
+
const end = { ...first3.end };
|
|
22746
22748
|
for (const r of ranges) {
|
|
22747
22749
|
start.row = Math.min(start.row, r.start.row);
|
|
22748
22750
|
start.col = Math.min(start.col, r.start.col);
|
|
@@ -22879,13 +22881,13 @@ var EngineCore = class extends EngineHost {
|
|
|
22879
22881
|
this.dynamicCycleHits = /* @__PURE__ */ new Set();
|
|
22880
22882
|
try {
|
|
22881
22883
|
for (const component of order.components) {
|
|
22882
|
-
const
|
|
22884
|
+
const first3 = component.nodes[0];
|
|
22883
22885
|
if (component.cyclic) {
|
|
22884
22886
|
const iterate = this.workbook.iterate;
|
|
22885
22887
|
if (iterate) this.iterateGroup(component.nodes, iterate);
|
|
22886
22888
|
else for (const node of component.nodes) this.markCycle(node);
|
|
22887
|
-
} else if (this.pending.has(
|
|
22888
|
-
this.computeFrom(
|
|
22889
|
+
} else if (this.pending.has(first3)) {
|
|
22890
|
+
this.computeFrom(first3);
|
|
22889
22891
|
}
|
|
22890
22892
|
}
|
|
22891
22893
|
} finally {
|
|
@@ -24432,8 +24434,8 @@ function ruleXml(rule2, styles, anchor) {
|
|
|
24432
24434
|
}
|
|
24433
24435
|
function conditionalFormatsXml(formats, styles) {
|
|
24434
24436
|
return formats.filter((format) => format.ranges.length && format.rules.length).map((format) => {
|
|
24435
|
-
const
|
|
24436
|
-
const anchor =
|
|
24437
|
+
const first3 = format.ranges[0];
|
|
24438
|
+
const anchor = first3 ? formatAddress(first3.start) : "A1";
|
|
24437
24439
|
const rules = format.rules.map((rule2) => ruleXml(rule2, styles, anchor)).join("");
|
|
24438
24440
|
return `<conditionalFormatting sqref="${format.ranges.map((r) => formatRange(r)).join(" ")}">${rules}</conditionalFormatting>`;
|
|
24439
24441
|
}).join("");
|
|
@@ -24536,14 +24538,14 @@ function headerFooterXml(sheet, page) {
|
|
|
24536
24538
|
if (source2 && sameModel(readHeaderFooter(source2), fields))
|
|
24537
24539
|
return snapshotXml(sheet, "headerFooter") ?? "";
|
|
24538
24540
|
if (!Object.keys(fields).length) return "";
|
|
24539
|
-
const
|
|
24541
|
+
const children4 = Object.entries(HEADER_FOOTER_TEXT).map(([key2, local]) => {
|
|
24540
24542
|
const text = fields[key2];
|
|
24541
24543
|
return text === void 0 ? "" : `<${local}>${escapeText(encodeEscapes(text))}</${local}>`;
|
|
24542
24544
|
}).join("");
|
|
24543
24545
|
const flags = {};
|
|
24544
24546
|
for (const key2 of HEADER_FOOTER_FLAGS) flags[key2] = fields[key2];
|
|
24545
24547
|
const head = mergedAttrs(source2, flags);
|
|
24546
|
-
return
|
|
24548
|
+
return children4 ? `<headerFooter${head}>${children4}</headerFooter>` : `<headerFooter${head}/>`;
|
|
24547
24549
|
}
|
|
24548
24550
|
function pageXml(sheet) {
|
|
24549
24551
|
const page = sheet.pageSetup ?? {};
|
|
@@ -25120,9 +25122,9 @@ function sheetPrXml(sheet) {
|
|
|
25120
25122
|
if (source2 && sameModel(readTabColor(source2), sheet.tabColor) && readFitToPage(source2) === fit)
|
|
25121
25123
|
return snapshotXml(sheet, "sheetPr") ?? "";
|
|
25122
25124
|
const sourceAttrs = source2 ? Array.from(source2.attributes).filter((a) => !a.name.startsWith("xmlns")).map((a) => ` ${a.name}="${escapeAttr3(a.value)}"`).join("") : "";
|
|
25123
|
-
const
|
|
25124
|
-
const outline2 =
|
|
25125
|
-
const setUp =
|
|
25125
|
+
const children4 = source2 ? elements(source2) : [];
|
|
25126
|
+
const outline2 = children4.find((node) => node.localName === "outlinePr");
|
|
25127
|
+
const setUp = children4.find((node) => node.localName === "pageSetUpPr");
|
|
25126
25128
|
let setUpXml = "";
|
|
25127
25129
|
if (setUp || fit) {
|
|
25128
25130
|
const keep2 = setUp ? Array.from(setUp.attributes).filter((a) => a.name !== "fitToPage" && !a.name.startsWith("xmlns")).map((a) => ` ${a.name}="${escapeAttr3(a.value)}"`).join("") : "";
|
|
@@ -25140,10 +25142,10 @@ function dimensionXml(sheet) {
|
|
|
25140
25142
|
function sheetViewsXml(sheet, tabSelected) {
|
|
25141
25143
|
const source2 = snapshotElement(sheet, "sheetViews");
|
|
25142
25144
|
if (source2 && sameModel(readSheetView(source2), sheet.view)) {
|
|
25143
|
-
const
|
|
25144
|
-
if (
|
|
25145
|
-
if (tabSelected)
|
|
25146
|
-
else
|
|
25145
|
+
const first3 = elements(source2).find((node) => node.localName === "sheetView");
|
|
25146
|
+
if (first3) {
|
|
25147
|
+
if (tabSelected) first3.setAttribute("tabSelected", "1");
|
|
25148
|
+
else first3.removeAttribute("tabSelected");
|
|
25147
25149
|
}
|
|
25148
25150
|
return outerXml(source2);
|
|
25149
25151
|
}
|
|
@@ -26968,14 +26970,14 @@ var TEXT_NUMBER = /^(.*?)(\d+)(\D*)$/;
|
|
|
26968
26970
|
var QUARTER = /^(q|qtr|quarter)(\s?)([1-4])$/i;
|
|
26969
26971
|
function textSeries(texts) {
|
|
26970
26972
|
const lists = texts.map(listMatch);
|
|
26971
|
-
const
|
|
26972
|
-
if (
|
|
26973
|
+
const first3 = lists[0];
|
|
26974
|
+
if (first3 && lists.every((m) => m && m.list === first3.list)) {
|
|
26973
26975
|
const second = lists[1];
|
|
26974
|
-
const step = second ? mod(second.index -
|
|
26976
|
+
const step = second ? mod(second.index - first3.index, first3.list.length) || 1 : 1;
|
|
26975
26977
|
const sample = texts[0] ?? "";
|
|
26976
26978
|
return (k) => ({
|
|
26977
26979
|
kind: "value",
|
|
26978
|
-
value: matchCase(
|
|
26980
|
+
value: matchCase(first3.list[mod(first3.index + step * k, first3.list.length)] ?? "", sample)
|
|
26979
26981
|
});
|
|
26980
26982
|
}
|
|
26981
26983
|
const quarters = texts.map((t) => QUARTER.exec(t));
|
|
@@ -27015,11 +27017,11 @@ function formatShowsDate(code) {
|
|
|
27015
27017
|
function dateCode(format) {
|
|
27016
27018
|
return (format.split(";")[0] ?? "").replace(/"[^"]*"|\\.|_.|\*./g, "").replace(/\[(h+|m+|s+)\]/gi, "$1").replace(/\[[^\]]*\]/g, "").replace(/am\/pm|a\/p/gi, "").toLowerCase();
|
|
27017
27019
|
}
|
|
27018
|
-
function singleDateSeries(
|
|
27020
|
+
function singleDateSeries(first3, format) {
|
|
27019
27021
|
const code = dateCode(format);
|
|
27020
|
-
if (!formatShowsDate(code)) return (k) => ({ kind: "value", value:
|
|
27021
|
-
const base = /[hs]/.test(code) ?
|
|
27022
|
-
return (k) => ({ kind: "value", value: k === 0 ?
|
|
27022
|
+
if (!formatShowsDate(code)) return (k) => ({ kind: "value", value: first3 + k / 24 });
|
|
27023
|
+
const base = /[hs]/.test(code) ? first3 : Math.floor(first3);
|
|
27024
|
+
return (k) => ({ kind: "value", value: k === 0 ? first3 : base + k });
|
|
27023
27025
|
}
|
|
27024
27026
|
function dateSeries(serials, date1904, format) {
|
|
27025
27027
|
if (serials.length === 1) return singleDateSeries(serials[0] ?? 0, format);
|
|
@@ -27028,9 +27030,9 @@ function dateSeries(serials, date1904, format) {
|
|
|
27028
27030
|
const sameDay = dates.every((d) => d.getUTCDate() === dates[0]?.getUTCDate());
|
|
27029
27031
|
const stepMonths = (monthIndex[1] ?? 0) - (monthIndex[0] ?? 0);
|
|
27030
27032
|
const evenMonths = stepMonths !== 0 && monthIndex.every((m, i) => m - (monthIndex[0] ?? 0) === stepMonths * i);
|
|
27031
|
-
const
|
|
27033
|
+
const first3 = serials[0] ?? 0;
|
|
27032
27034
|
if (sameDay && evenMonths)
|
|
27033
|
-
return (k) => ({ kind: "value", value: addMonths2(
|
|
27035
|
+
return (k) => ({ kind: "value", value: addMonths2(first3, stepMonths * k, date1904) });
|
|
27034
27036
|
const trend = linearTrend(serials);
|
|
27035
27037
|
return (k) => ({ kind: "value", value: trend(k) });
|
|
27036
27038
|
}
|
|
@@ -28721,9 +28723,9 @@ function applyTotalsRow(sheet, table2) {
|
|
|
28721
28723
|
const row2 = table2.range.end.row;
|
|
28722
28724
|
const { columns } = table2;
|
|
28723
28725
|
if (!columns.some((c2) => c2.totalsRowFunction || c2.totalsRowLabel)) {
|
|
28724
|
-
const
|
|
28726
|
+
const first3 = columns[0];
|
|
28725
28727
|
const last = columns[columns.length - 1];
|
|
28726
|
-
if (
|
|
28728
|
+
if (first3 && columns.length > 1) first3.totalsRowLabel = "Total";
|
|
28727
28729
|
if (last) last.totalsRowFunction = "sum";
|
|
28728
28730
|
}
|
|
28729
28731
|
columns.forEach((column, i) => {
|
|
@@ -29046,25 +29048,25 @@ function removeDuplicates(ctx, s, range, columns, hasHeader) {
|
|
|
29046
29048
|
const { workbook } = ctx;
|
|
29047
29049
|
const sheet = sheetAt(workbook, s);
|
|
29048
29050
|
const r = normalizeRange(range);
|
|
29049
|
-
const
|
|
29050
|
-
if (
|
|
29051
|
-
const data = { start: { row:
|
|
29051
|
+
const first3 = hasHeader ? r.start.row + 1 : r.start.row;
|
|
29052
|
+
if (first3 > r.end.row) return { removed: 0, remaining: 0 };
|
|
29053
|
+
const data = { start: { row: first3, col: r.start.col }, end: r.end };
|
|
29052
29054
|
if (sheet.merges.some((m) => rangesIntersect(m, data)))
|
|
29053
29055
|
throw new Error("Cannot remove duplicates from a range that contains merged cells.");
|
|
29054
29056
|
const keyCols = columns.filter((c2) => c2 >= r.start.col && c2 <= r.end.col);
|
|
29055
29057
|
const cols = keyCols.length ? keyCols : Array.from({ length: r.end.col - r.start.col + 1 }, (_v, i) => r.start.col + i);
|
|
29056
|
-
let lastStored =
|
|
29058
|
+
let lastStored = first3;
|
|
29057
29059
|
for (const row2 of sheet.rows.keys()) if (row2 > lastStored) lastStored = row2;
|
|
29058
29060
|
const lastRow = Math.min(r.end.row, lastStored);
|
|
29059
29061
|
const keep2 = [];
|
|
29060
29062
|
const seen = /* @__PURE__ */ new Set();
|
|
29061
|
-
for (let row2 =
|
|
29063
|
+
for (let row2 = first3; row2 <= lastRow; row2++) {
|
|
29062
29064
|
const key2 = cols.map((col) => displayText(workbook, getCell(sheet, row2, col)).toLowerCase()).join("\0");
|
|
29063
29065
|
if (seen.has(key2)) continue;
|
|
29064
29066
|
seen.add(key2);
|
|
29065
29067
|
keep2.push(row2);
|
|
29066
29068
|
}
|
|
29067
|
-
const removed = lastRow -
|
|
29069
|
+
const removed = lastRow - first3 + 1 - keep2.length;
|
|
29068
29070
|
if (!removed) return { removed: 0, remaining: keep2.length };
|
|
29069
29071
|
ctx.run(
|
|
29070
29072
|
"Remove duplicates",
|
|
@@ -29077,11 +29079,11 @@ function removeDuplicates(ctx, s, range, columns, hasHeader) {
|
|
|
29077
29079
|
if (col >= r.start.col && col <= r.end.col) cells3.set(col, cell);
|
|
29078
29080
|
return { row: row2, cells: cells3 };
|
|
29079
29081
|
});
|
|
29080
|
-
for (let row2 =
|
|
29082
|
+
for (let row2 = first3; row2 <= lastRow; row2++)
|
|
29081
29083
|
for (const col of [...sheet.rows.get(row2)?.keys() ?? []])
|
|
29082
29084
|
if (col >= r.start.col && col <= r.end.col) deleteCell(sheet, row2, col);
|
|
29083
29085
|
moved.forEach(({ row: from, cells: cells3 }, i) => {
|
|
29084
|
-
const row2 =
|
|
29086
|
+
const row2 = first3 + i;
|
|
29085
29087
|
for (const [col, cell] of cells3) {
|
|
29086
29088
|
if (cell.formula !== void 0 && row2 !== from)
|
|
29087
29089
|
cell.formula = translateFormula(cell.formula, row2 - from, 0);
|
|
@@ -29868,9 +29870,9 @@ function merge(ctx, s, range, mode) {
|
|
|
29868
29870
|
sheet.merges = sheet.merges.filter((m) => !rangesIntersect(m, r));
|
|
29869
29871
|
for (const target of targets) {
|
|
29870
29872
|
const anchor = target.start;
|
|
29871
|
-
const [
|
|
29872
|
-
if (
|
|
29873
|
-
const source2 = getCell(sheet,
|
|
29873
|
+
const [first3] = filledCells(sheet, target);
|
|
29874
|
+
if (first3 && (first3[0] !== anchor.row || first3[1] !== anchor.col)) {
|
|
29875
|
+
const source2 = getCell(sheet, first3[0], first3[1]);
|
|
29874
29876
|
const corner2 = getCell(sheet, anchor.row, anchor.col);
|
|
29875
29877
|
if (source2) {
|
|
29876
29878
|
const moved = structuredClone(source2);
|
|
@@ -30454,10 +30456,10 @@ var LINE_HEIGHTS = [
|
|
|
30454
30456
|
[72, 93.75]
|
|
30455
30457
|
];
|
|
30456
30458
|
function lineHeightPoints(sizePt) {
|
|
30457
|
-
const
|
|
30459
|
+
const first3 = LINE_HEIGHTS[0];
|
|
30458
30460
|
const last = LINE_HEIGHTS[LINE_HEIGHTS.length - 1];
|
|
30459
30461
|
let height;
|
|
30460
|
-
if (sizePt <=
|
|
30462
|
+
if (sizePt <= first3[0]) height = first3[1] / first3[0] * sizePt;
|
|
30461
30463
|
else if (sizePt >= last[0]) height = last[1] / last[0] * sizePt;
|
|
30462
30464
|
else {
|
|
30463
30465
|
let i = 1;
|
|
@@ -31240,10 +31242,10 @@ async function createXlsx(names) {
|
|
|
31240
31242
|
const workbook = createWorkbook();
|
|
31241
31243
|
const session = createEditSession(workbook);
|
|
31242
31244
|
if (names.length) {
|
|
31243
|
-
const
|
|
31244
|
-
const problem2 = validateSheetName(workbook,
|
|
31245
|
+
const first3 = names[0];
|
|
31246
|
+
const problem2 = validateSheetName(workbook, first3, 0);
|
|
31245
31247
|
if (problem2) throw new Error(problem2);
|
|
31246
|
-
session.renameSheet(0,
|
|
31248
|
+
session.renameSheet(0, first3);
|
|
31247
31249
|
for (const name of names.slice(1)) session.addSheet(name);
|
|
31248
31250
|
}
|
|
31249
31251
|
return saveXlsx(workbook);
|
|
@@ -31864,15 +31866,15 @@ function metadataAttributes(node) {
|
|
|
31864
31866
|
// src/visio/sheet.ts
|
|
31865
31867
|
var VISIO_NS = "http://schemas.microsoft.com/office/visio/2012/main";
|
|
31866
31868
|
var VISIO_LEGACY_NS = "http://schemas.microsoft.com/office/visio/2011/1/core";
|
|
31867
|
-
var
|
|
31869
|
+
var children3 = (node, name) => node ? elements(node).filter(
|
|
31868
31870
|
(child5) => child5.localName === name && (child5.namespaceURI === VISIO_NS || child5.namespaceURI === VISIO_LEGACY_NS)
|
|
31869
31871
|
) : [];
|
|
31870
|
-
var child4 = (node, name) =>
|
|
31872
|
+
var child4 = (node, name) => children3(node, name)[0];
|
|
31871
31873
|
var attribute2 = (node, name) => node?.getAttribute(name) ?? void 0;
|
|
31872
31874
|
var yes = (value) => value === "1" || value === "true";
|
|
31873
31875
|
function readCells(node) {
|
|
31874
31876
|
return new Map(
|
|
31875
|
-
|
|
31877
|
+
children3(node, "Cell").map((cell) => {
|
|
31876
31878
|
const value = attribute2(cell, "V");
|
|
31877
31879
|
const formula = attribute2(cell, "F");
|
|
31878
31880
|
const unit = attribute2(cell, "U");
|
|
@@ -31901,11 +31903,11 @@ function readCells(node) {
|
|
|
31901
31903
|
function readSheet(node) {
|
|
31902
31904
|
if (!node) return { cells: /* @__PURE__ */ new Map(), sections: /* @__PURE__ */ new Map() };
|
|
31903
31905
|
const sections = /* @__PURE__ */ new Map();
|
|
31904
|
-
for (const section of
|
|
31906
|
+
for (const section of children3(node, "Section")) {
|
|
31905
31907
|
const name = metadata(attribute2(section, "N") ?? "", 256, "Section name");
|
|
31906
31908
|
const index2 = metadata(attribute2(section, "IX") ?? "0", 256, "Section index");
|
|
31907
31909
|
const rows = /* @__PURE__ */ new Map();
|
|
31908
|
-
for (const row2 of
|
|
31910
|
+
for (const row2 of children3(section, "Row")) {
|
|
31909
31911
|
const name2 = attribute2(row2, "N");
|
|
31910
31912
|
if (name2 !== void 0) metadata(name2, 256, "Row name");
|
|
31911
31913
|
const index3 = metadata(attribute2(row2, "IX") ?? attribute2(row2, "N") ?? "0", 256, "Row index");
|
|
@@ -31928,7 +31930,7 @@ function readSheet(node) {
|
|
|
31928
31930
|
return { cells: readCells(node), sections };
|
|
31929
31931
|
}
|
|
31930
31932
|
function readShapes(node) {
|
|
31931
|
-
return
|
|
31933
|
+
return children3(child4(node, "Shapes"), "Shape").map((shape2) => {
|
|
31932
31934
|
const text = child4(shape2, "Text");
|
|
31933
31935
|
const foreignData = child4(shape2, "ForeignData");
|
|
31934
31936
|
return {
|
|
@@ -32046,7 +32048,7 @@ async function indexedPart(pkg, source2, node, type) {
|
|
|
32046
32048
|
return rel.target;
|
|
32047
32049
|
}
|
|
32048
32050
|
function connections(root, report) {
|
|
32049
|
-
return
|
|
32051
|
+
return children3(child4(root, "Connects"), "Connect").flatMap((node) => {
|
|
32050
32052
|
const fromShapeId = attribute2(node, "FromSheet"), toShapeId = attribute2(node, "ToSheet");
|
|
32051
32053
|
if (!fromShapeId || !toShapeId) {
|
|
32052
32054
|
report("invalid-connection", "Connection without both shape IDs was omitted.");
|
|
@@ -33341,7 +33343,7 @@ function sanitize(root, limits) {
|
|
|
33341
33343
|
}
|
|
33342
33344
|
return { tag: data2.tag, attrs: attrs2, children: data2.children };
|
|
33343
33345
|
}
|
|
33344
|
-
function
|
|
33346
|
+
function children4(value, optional = false) {
|
|
33345
33347
|
if (value === void 0 && optional) return [];
|
|
33346
33348
|
if (!Array.isArray(value) || Object.getPrototypeOf(value) !== Array.prototype)
|
|
33347
33349
|
unsafe("Expected plain child array.");
|
|
@@ -33372,7 +33374,7 @@ function sanitize(root, limits) {
|
|
|
33372
33374
|
return target;
|
|
33373
33375
|
}
|
|
33374
33376
|
function leaf(data2) {
|
|
33375
|
-
if (
|
|
33377
|
+
if (children4(data2.children, true).length !== 0) unsafe("Path cannot contain child elements.");
|
|
33376
33378
|
return pathCommands(data2.attrs.d, limits, pathBudget);
|
|
33377
33379
|
}
|
|
33378
33380
|
function item(value, depth) {
|
|
@@ -33385,7 +33387,7 @@ function sanitize(root, limits) {
|
|
|
33385
33387
|
paint: paint(data2.attrs)
|
|
33386
33388
|
}) : Object.assign(target, {
|
|
33387
33389
|
kind: "group",
|
|
33388
|
-
items: Object.freeze(
|
|
33390
|
+
items: Object.freeze(children4(data2.children).map((child5) => item(child5, depth + 1)))
|
|
33389
33391
|
});
|
|
33390
33392
|
freezeLater.push(result2);
|
|
33391
33393
|
return result2;
|
|
@@ -33402,7 +33404,7 @@ function sanitize(root, limits) {
|
|
|
33402
33404
|
ids.set(id, clips.length);
|
|
33403
33405
|
const target = base(data2.attrs);
|
|
33404
33406
|
const paths = [];
|
|
33405
|
-
for (const child5 of
|
|
33407
|
+
for (const child5 of children4(data2.children)) {
|
|
33406
33408
|
const part = node(child5, depth + 1, true);
|
|
33407
33409
|
if (part.tag !== "path") unsafe("Clip content must be a path.");
|
|
33408
33410
|
const path = Object.assign(base(part.attrs), {
|
|
@@ -33427,11 +33429,11 @@ function sanitize(root, limits) {
|
|
|
33427
33429
|
if (viewBox[0] !== 0 || viewBox[1] !== 0 || viewBox[2] !== width || viewBox[3] !== height)
|
|
33428
33430
|
unsafe("Viewport differs from dimensions.");
|
|
33429
33431
|
const items = [];
|
|
33430
|
-
for (const child5 of
|
|
33432
|
+
for (const child5 of children4(data.children)) {
|
|
33431
33433
|
const peek2 = record(child5, ["tag", "attrs", "children"]);
|
|
33432
33434
|
if (peek2.tag === "defs") {
|
|
33433
33435
|
const defs = node(child5, 1);
|
|
33434
|
-
for (const value of
|
|
33436
|
+
for (const value of children4(defs.children)) definition(value, 2);
|
|
33435
33437
|
} else items.push(item(child5, 1));
|
|
33436
33438
|
}
|
|
33437
33439
|
for (const { target, id } of pending2) {
|
|
@@ -33540,7 +33542,7 @@ var VISIO_METAFILE_CONVERSION_LIMITS = Object.freeze({
|
|
|
33540
33542
|
});
|
|
33541
33543
|
var states = /* @__PURE__ */ new WeakMap();
|
|
33542
33544
|
async function inspectEmbeddedVisioMetafile(pkg, sourcePart, foreignData, report, converter) {
|
|
33543
|
-
const refs =
|
|
33545
|
+
const refs = children3(foreignData, "Rel");
|
|
33544
33546
|
const id = refs.length === 1 ? refs[0]?.getAttributeNS(NS.r, "id") : void 0;
|
|
33545
33547
|
const rel = id ? (await pkg.relationships(sourcePart)).get(id) : void 0;
|
|
33546
33548
|
if (!rel) {
|
|
@@ -33832,7 +33834,7 @@ async function readVisioImage(pkg, sourcePart, foreignData, report, options = {}
|
|
|
33832
33834
|
};
|
|
33833
33835
|
if (foreignData.getAttribute("ForeignType") && foreignData.getAttribute("ForeignType") !== "Bitmap")
|
|
33834
33836
|
return omit("unsupported-image", "Only embedded bitmap foreign data is supported.");
|
|
33835
|
-
const refs =
|
|
33837
|
+
const refs = children3(foreignData, "Rel");
|
|
33836
33838
|
const id = refs.length === 1 ? refs[0]?.getAttributeNS(NS.r, "id") : void 0;
|
|
33837
33839
|
const rel = id ? (await pkg.relationships(sourcePart)).get(id) : void 0;
|
|
33838
33840
|
if (!rel)
|
|
@@ -34673,8 +34675,8 @@ function roundedRectanglePath(points, rounding, point2) {
|
|
|
34673
34675
|
if (!points || points.length !== 5 || !Number.isFinite(rounding) || rounding <= 0)
|
|
34674
34676
|
return void 0;
|
|
34675
34677
|
if (!points.every((p) => p.every(Number.isFinite))) return void 0;
|
|
34676
|
-
const
|
|
34677
|
-
if (
|
|
34678
|
+
const first3 = points[0], last = points[4];
|
|
34679
|
+
if (first3[0] !== last[0] || first3[1] !== last[1]) return void 0;
|
|
34678
34680
|
const directions = [], lengths = [];
|
|
34679
34681
|
for (let i = 0; i < 4; i++) {
|
|
34680
34682
|
const from = points[i], to = points[i + 1];
|
|
@@ -34716,8 +34718,8 @@ function roundedRectanglePath(points, rounding, point2) {
|
|
|
34716
34718
|
function roundedOrthogonalPath(points, radius, point2) {
|
|
34717
34719
|
if (!points || points.length < 3 || !Number.isFinite(radius) || radius < 1e-9) return void 0;
|
|
34718
34720
|
if (!points.every((p) => p.every(Number.isFinite))) return void 0;
|
|
34719
|
-
const
|
|
34720
|
-
if (
|
|
34721
|
+
const first3 = points[0], last = points[points.length - 1];
|
|
34722
|
+
if (first3[0] === last[0] && first3[1] === last[1]) return void 0;
|
|
34721
34723
|
const directions = [], lengths = [];
|
|
34722
34724
|
for (let i = 1; i < points.length; i++) {
|
|
34723
34725
|
const from = points[i - 1], to = points[i];
|
|
@@ -34740,7 +34742,7 @@ function roundedOrthogonalPath(points, radius, point2) {
|
|
|
34740
34742
|
const required = (Number(corners[i]) + Number(corners[i + 1])) * radius;
|
|
34741
34743
|
if (lengths[i] < required) return void 0;
|
|
34742
34744
|
}
|
|
34743
|
-
const commands = [`M ${point2(
|
|
34745
|
+
const commands = [`M ${point2(first3[0], first3[1])}`];
|
|
34744
34746
|
let extraCommands = 0;
|
|
34745
34747
|
for (let i = 1; i < points.length - 1; i++) {
|
|
34746
34748
|
const vertex = points[i];
|
|
@@ -36000,16 +36002,16 @@ async function parseVsdx(input, options = {}) {
|
|
|
36000
36002
|
fonts: /* @__PURE__ */ new Map(),
|
|
36001
36003
|
themes: await loadVisioThemes(pkg, documentPart, report)
|
|
36002
36004
|
};
|
|
36003
|
-
for (const color2 of
|
|
36005
|
+
for (const color2 of children3(child4(documentRoot, "Colors"), "ColorEntry"))
|
|
36004
36006
|
resources.colors.set(attribute2(color2, "IX") ?? "", attribute2(color2, "RGB") ?? "");
|
|
36005
|
-
|
|
36007
|
+
children3(child4(documentRoot, "FaceNames"), "FaceName").forEach(
|
|
36006
36008
|
(font2, index2) => resources.fonts.set(
|
|
36007
36009
|
metadata(attribute2(font2, "ID") ?? String(index2), 256, "Font ID"),
|
|
36008
36010
|
metadata(attribute2(font2, "Name") ?? attribute2(font2, "NameU") ?? "Arial", 1024, "Font name")
|
|
36009
36011
|
)
|
|
36010
36012
|
);
|
|
36011
36013
|
const styles = /* @__PURE__ */ new Map();
|
|
36012
|
-
for (const style of
|
|
36014
|
+
for (const style of children3(child4(documentRoot, "StyleSheets"), "StyleSheet"))
|
|
36013
36015
|
styles.set(metadata(attribute2(style, "ID") ?? "", 256, "Style ID"), {
|
|
36014
36016
|
sheet: readSheet(style),
|
|
36015
36017
|
attributes: metadataAttributes(style)
|
|
@@ -36019,7 +36021,7 @@ async function parseVsdx(input, options = {}) {
|
|
|
36019
36021
|
const masters = /* @__PURE__ */ new Map();
|
|
36020
36022
|
const mastersPart = await related(pkg, documentPart, "masters", false);
|
|
36021
36023
|
if (mastersPart) {
|
|
36022
|
-
for (const master of
|
|
36024
|
+
for (const master of children3(await visioXml(pkg, mastersPart, "Masters"), "Master")) {
|
|
36023
36025
|
const part = await indexedPart(pkg, mastersPart, master, "master");
|
|
36024
36026
|
const id = metadata(attribute2(master, "ID") ?? "", 256, "Master ID");
|
|
36025
36027
|
if (!id || masters.has(id))
|
|
@@ -36092,7 +36094,7 @@ async function parseVsdx(input, options = {}) {
|
|
|
36092
36094
|
const pagesPart = await related(pkg, documentPart, "pages");
|
|
36093
36095
|
if (!pagesPart) throw new VisioPackageError("INVALID_DOCUMENT", "Missing Visio pages part.");
|
|
36094
36096
|
const pages = [], pageIds = /* @__PURE__ */ new Set();
|
|
36095
|
-
for (const page of
|
|
36097
|
+
for (const page of children3(await visioXml(pkg, pagesPart, "Pages"), "Page")) {
|
|
36096
36098
|
const id = metadata(attribute2(page, "ID") ?? "", 256, "Page ID");
|
|
36097
36099
|
if (!id || pageIds.has(id))
|
|
36098
36100
|
throw new VisioPackageError("INVALID_PAGE_ID", "Page IDs must be present and unique.");
|
|
@@ -36245,11 +36247,11 @@ async function openEditablePackage(bytes, limits, check3) {
|
|
|
36245
36247
|
if (!pagesPart) fail2("INVALID_DOCUMENT", "Missing pages part.");
|
|
36246
36248
|
const pages = /* @__PURE__ */ new Map();
|
|
36247
36249
|
const paths = /* @__PURE__ */ new Set();
|
|
36248
|
-
for (const page of
|
|
36250
|
+
for (const page of children3(await visioXml(pkg, pagesPart, "Pages"), "Page")) {
|
|
36249
36251
|
check3();
|
|
36250
36252
|
const id = attribute2(page, "ID");
|
|
36251
36253
|
if (!id || pages.has(id)) fail2("INVALID_PAGE_ID", "Page IDs must be present and unique.");
|
|
36252
|
-
const rels =
|
|
36254
|
+
const rels = children3(page, "Rel");
|
|
36253
36255
|
if (rels.length !== 1 || !rels[0].getAttributeNS(
|
|
36254
36256
|
"http://schemas.openxmlformats.org/officeDocument/2006/relationships",
|
|
36255
36257
|
"id"
|
|
@@ -36329,10 +36331,10 @@ function writeEditedPackage(parts, maxBytes, deadline, check3) {
|
|
|
36329
36331
|
// src/visio/edit-text.ts
|
|
36330
36332
|
function replacePlainText(root, shapeId, text, check3) {
|
|
36331
36333
|
const shapeChildren = (parent) => {
|
|
36332
|
-
const containers =
|
|
36334
|
+
const containers = children3(parent, "Shapes");
|
|
36333
36335
|
if (containers.length > 1)
|
|
36334
36336
|
fail2("INVALID_SHAPE_ID", "Duplicate Shapes containers are ambiguous.");
|
|
36335
|
-
return
|
|
36337
|
+
return children3(containers[0], "Shape");
|
|
36336
36338
|
};
|
|
36337
36339
|
const shapes = /* @__PURE__ */ new Map();
|
|
36338
36340
|
const pending2 = shapeChildren(root).map((node2) => ({
|
|
@@ -36355,13 +36357,13 @@ function replacePlainText(root, shapeId, text, check3) {
|
|
|
36355
36357
|
if (!target) fail2("EDIT_TARGET_NOT_FOUND", "Local shape does not exist.");
|
|
36356
36358
|
if (target.inherited || target.deleted)
|
|
36357
36359
|
fail2("UNSUPPORTED_TEXT_EDIT", "Master-linked or deleted shapes cannot be edited.");
|
|
36358
|
-
const texts =
|
|
36360
|
+
const texts = children3(target.node, "Text");
|
|
36359
36361
|
if (texts.length !== 1)
|
|
36360
36362
|
fail2("UNSUPPORTED_TEXT_EDIT", "Editing requires one existing local Text element.");
|
|
36361
36363
|
const node = texts[0];
|
|
36362
36364
|
if (Array.from(node.childNodes).some((item) => item.nodeType !== 3 && item.nodeType !== 4))
|
|
36363
36365
|
fail2("UNSUPPORTED_TEXT_EDIT", "Rich text, fields and unknown text markup cannot be edited.");
|
|
36364
|
-
if (
|
|
36366
|
+
if (children3(target.node, "Section").some((section) => attribute2(section, "N") === "Field"))
|
|
36365
36367
|
fail2("UNSUPPORTED_TEXT_EDIT", "Shapes with text fields cannot be edited.");
|
|
36366
36368
|
if (node.textContent === text) return false;
|
|
36367
36369
|
while (node.firstChild) node.removeChild(node.firstChild);
|
|
@@ -37004,8 +37006,8 @@ function indexCells(roots, options) {
|
|
|
37004
37006
|
fail2("EDIT_UNKNOWN_DEPENDENCY", "Page root formula has unknown dependency scope.");
|
|
37005
37007
|
const indexedNodes = /* @__PURE__ */ new Set();
|
|
37006
37008
|
const connected = /* @__PURE__ */ new Set();
|
|
37007
|
-
for (const container of
|
|
37008
|
-
for (const connection of
|
|
37009
|
+
for (const container of children3(root, "Connects"))
|
|
37010
|
+
for (const connection of children3(container, "Connect")) {
|
|
37009
37011
|
for (const attr3 of ["FromSheet", "ToSheet"]) {
|
|
37010
37012
|
const id = attribute2(connection, attr3);
|
|
37011
37013
|
if (id) connected.add(id);
|
|
@@ -37014,21 +37016,21 @@ function indexCells(roots, options) {
|
|
|
37014
37016
|
const sheets = [];
|
|
37015
37017
|
const ids = /* @__PURE__ */ new Set();
|
|
37016
37018
|
const visit2 = (parent, inherited, nested) => {
|
|
37017
|
-
for (const container of
|
|
37018
|
-
for (const node of
|
|
37019
|
+
for (const container of children3(parent, "Shapes"))
|
|
37020
|
+
for (const node of children3(container, "Shape")) {
|
|
37019
37021
|
options.check?.();
|
|
37020
37022
|
const shapeId = attribute2(node, "ID");
|
|
37021
37023
|
if (!shapeId || ids.has(shapeId)) fail2("INVALID_SHAPE_ID", "Shape IDs must be unique.");
|
|
37022
37024
|
ids.add(shapeId);
|
|
37023
|
-
const unsafe2 = inherited || nested || node.hasAttribute("Master") || node.hasAttribute("MasterShape") || attribute2(node, "Type") === "Group" || attribute2(node, "Type") !== void 0 && attribute2(node, "Type") !== "Shape" || connected.has(shapeId) ||
|
|
37025
|
+
const unsafe2 = inherited || nested || node.hasAttribute("Master") || node.hasAttribute("MasterShape") || attribute2(node, "Type") === "Group" || attribute2(node, "Type") !== void 0 && attribute2(node, "Type") !== "Shape" || connected.has(shapeId) || children3(node, "ForeignData").length > 0 || children3(node, "Rel").length > 0 || children3(node, "Cell").some(
|
|
37024
37026
|
(cell) => /^(BeginX|BeginY|EndX|EndY)$/i.test(attribute2(cell, "N") ?? "") || attribute2(cell, "N")?.toLowerCase() === "oned" && (attribute2(cell, "V") !== "0" || !!executableCellFormula(attribute2(cell, "F")) || attribute2(cell, "F") === "Inh")
|
|
37025
|
-
) ||
|
|
37027
|
+
) || children3(node, "Shapes").length > 0 || ["1", "true"].includes(attribute2(node, "Del") ?? "");
|
|
37026
37028
|
sheets.push({ node, shapeId, unsafe: unsafe2 });
|
|
37027
37029
|
visit2(node, unsafe2, true);
|
|
37028
37030
|
}
|
|
37029
37031
|
};
|
|
37030
37032
|
visit2(root, false, false);
|
|
37031
|
-
for (const node of
|
|
37033
|
+
for (const node of children3(root, "PageSheet"))
|
|
37032
37034
|
sheets.push({ node, shapeId: "", unsafe: false });
|
|
37033
37035
|
for (const sheet of sheets) {
|
|
37034
37036
|
const addNode = (node, cell, relative = false, deleted = false) => {
|
|
@@ -37065,17 +37067,17 @@ function indexCells(roots, options) {
|
|
|
37065
37067
|
if (source2 === "Inh") item.unsafe = true;
|
|
37066
37068
|
add3(item);
|
|
37067
37069
|
};
|
|
37068
|
-
for (const node of
|
|
37069
|
-
for (const section of
|
|
37070
|
+
for (const node of children3(sheet.node, "Cell")) addNode(node, attribute2(node, "N") ?? "");
|
|
37071
|
+
for (const section of children3(sheet.node, "Section")) {
|
|
37070
37072
|
const name = attribute2(section, "N") ?? "";
|
|
37071
37073
|
const prefix = name === "Geometry" ? `Geometry${Number(attribute2(section, "IX") ?? "0") + 1}` : name;
|
|
37072
37074
|
const deleted = ["1", "true"].includes(attribute2(section, "Del") ?? "");
|
|
37073
|
-
for (const node of
|
|
37075
|
+
for (const node of children3(section, "Cell"))
|
|
37074
37076
|
addNode(node, `${prefix}.${attribute2(node, "N") ?? ""}`, false, deleted);
|
|
37075
|
-
for (const row2 of
|
|
37077
|
+
for (const row2 of children3(section, "Row")) {
|
|
37076
37078
|
const rowName = attribute2(row2, "N");
|
|
37077
37079
|
const ix = attribute2(row2, "IX") ?? "0";
|
|
37078
|
-
for (const node of
|
|
37080
|
+
for (const node of children3(row2, "Cell")) {
|
|
37079
37081
|
const n = attribute2(node, "N") ?? "";
|
|
37080
37082
|
const rowCell = name === "Geometry" || ["Controls", "Scratch", "Connection"].includes(name) ? `${prefix}.${n}${ix}` : n === "Value" && ["User", "Prop"].includes(name) ? `${prefix}.${rowName ?? ix}` : `${prefix}.${rowName ?? ix}.${n}`;
|
|
37081
37083
|
addNode(
|
|
@@ -37224,8 +37226,8 @@ function assertVisioShapeUnreferenced(roots, pageId, shapeId, options = {}) {
|
|
|
37224
37226
|
}
|
|
37225
37227
|
const root = roots.get(pageId);
|
|
37226
37228
|
if (root)
|
|
37227
|
-
for (const connections2 of
|
|
37228
|
-
for (const connection of
|
|
37229
|
+
for (const connections2 of children3(root, "Connects"))
|
|
37230
|
+
for (const connection of children3(connections2, "Connect")) {
|
|
37229
37231
|
if (["FromSheet", "ToSheet"].some((name) => attribute2(connection, name) === shapeId))
|
|
37230
37232
|
fail2("EDIT_REFERENCED_DELETE", "Shape participates in a Connect record.");
|
|
37231
37233
|
}
|
|
@@ -37267,7 +37269,7 @@ var locks = [
|
|
|
37267
37269
|
"LockAspect",
|
|
37268
37270
|
"LockDelete"
|
|
37269
37271
|
];
|
|
37270
|
-
var cells = (shape2) => new Map(
|
|
37272
|
+
var cells = (shape2) => new Map(children3(shape2, "Cell").map((node) => [attribute2(node, "N") ?? "", node]));
|
|
37271
37273
|
function numeric4(node, fallback) {
|
|
37272
37274
|
if (!node && fallback !== void 0) return fallback;
|
|
37273
37275
|
if (!node || node.hasAttribute("E"))
|
|
@@ -37311,10 +37313,10 @@ function setCell(shape2, name, value, formula) {
|
|
|
37311
37313
|
else if (attribute2(node, "F") !== "No Formula") node.removeAttribute("F");
|
|
37312
37314
|
}
|
|
37313
37315
|
function admitted(root, shapeId, masterMovePins = /* @__PURE__ */ new Set(), masterDimensions = /* @__PURE__ */ new Map()) {
|
|
37314
|
-
const containers =
|
|
37316
|
+
const containers = children3(root, "Shapes");
|
|
37315
37317
|
if (containers.length !== 1)
|
|
37316
37318
|
fail2("UNSUPPORTED_GEOMETRY_EDIT", "One local Shapes container is required.");
|
|
37317
|
-
const candidates =
|
|
37319
|
+
const candidates = children3(containers[0], "Shape").filter(
|
|
37318
37320
|
(node) => attribute2(node, "ID") === shapeId
|
|
37319
37321
|
);
|
|
37320
37322
|
if (candidates.length !== 1)
|
|
@@ -37323,7 +37325,7 @@ function admitted(root, shapeId, masterMovePins = /* @__PURE__ */ new Set(), mas
|
|
|
37323
37325
|
if ((shape2.hasAttribute("Master") || shape2.hasAttribute("MasterShape")) && !["PinX", "PinY"].every((name) => {
|
|
37324
37326
|
const cell = cells(shape2).get(name);
|
|
37325
37327
|
return cell && masterMovePins.has(cell);
|
|
37326
|
-
}) || ["1", "true"].includes(attribute2(shape2, "Del") ?? "") ||
|
|
37328
|
+
}) || ["1", "true"].includes(attribute2(shape2, "Del") ?? "") || children3(shape2, "Shapes").length || children3(shape2, "ForeignData").length || children3(shape2, "Rel").length || attribute2(shape2, "Type") && attribute2(shape2, "Type") !== "Shape")
|
|
37327
37329
|
fail2(
|
|
37328
37330
|
"UNSUPPORTED_GEOMETRY_EDIT",
|
|
37329
37331
|
"Master, group, foreign, deleted and non-shape operations are unsupported."
|
|
@@ -37351,8 +37353,8 @@ function protectedShape(shape2, document, masterMovePins = /* @__PURE__ */ new S
|
|
|
37351
37353
|
return node !== void 0 && masterMovePins.has(node);
|
|
37352
37354
|
});
|
|
37353
37355
|
const styles = /* @__PURE__ */ new Map();
|
|
37354
|
-
for (const container of
|
|
37355
|
-
for (const node of
|
|
37356
|
+
for (const container of children3(document, "StyleSheets"))
|
|
37357
|
+
for (const node of children3(container, "StyleSheet")) {
|
|
37356
37358
|
const id = attribute2(node, "ID");
|
|
37357
37359
|
if (!id || styles.has(id)) fail2("EDIT_PROTECTED_CELL", "Ambiguous protection style IDs.");
|
|
37358
37360
|
styles.set(id, node);
|
|
@@ -37407,7 +37409,7 @@ function protectedShape(shape2, document, masterMovePins = /* @__PURE__ */ new S
|
|
|
37407
37409
|
}
|
|
37408
37410
|
return parent !== void 0 && parent !== id ? resolve2(parent, category, lock, seen) : void 0;
|
|
37409
37411
|
};
|
|
37410
|
-
const defaults =
|
|
37412
|
+
const defaults = children3(document, "DocumentSheet")[0];
|
|
37411
37413
|
for (const category of ["LineStyle", "FillStyle", "TextStyle"]) {
|
|
37412
37414
|
const id = attribute2(shape2, category) ?? attribute2(defaults, category) ?? (styles.has("0") ? "0" : void 0);
|
|
37413
37415
|
if (id === void 0) continue;
|
|
@@ -37436,17 +37438,17 @@ function protectedShape(shape2, document, masterMovePins = /* @__PURE__ */ new S
|
|
|
37436
37438
|
}
|
|
37437
37439
|
}
|
|
37438
37440
|
function resizeGeometry(shape2, roots, edit, check3) {
|
|
37439
|
-
const sections =
|
|
37441
|
+
const sections = children3(shape2, "Section").filter((node) => attribute2(node, "N") === "Geometry");
|
|
37440
37442
|
if (!sections.length)
|
|
37441
37443
|
fail2("UNSUPPORTED_GEOMETRY_EDIT", "Resizing requires explicit supported local geometry.");
|
|
37442
37444
|
for (const section of sections) {
|
|
37443
37445
|
if (section.hasAttribute("Del"))
|
|
37444
37446
|
fail2("UNSUPPORTED_GEOMETRY_EDIT", "Deleted geometry is unsupported.");
|
|
37445
|
-
for (const row2 of
|
|
37447
|
+
for (const row2 of children3(section, "Row")) {
|
|
37446
37448
|
const type = attribute2(row2, "T");
|
|
37447
37449
|
if (row2.hasAttribute("Del") || !["MoveTo", "LineTo", "RelMoveTo", "RelLineTo"].includes(type ?? ""))
|
|
37448
37450
|
fail2("UNSUPPORTED_GEOMETRY_EDIT", "This bundle resizes only local line-based geometry.");
|
|
37449
|
-
for (const node of
|
|
37451
|
+
for (const node of children3(row2, "Cell")) {
|
|
37450
37452
|
if (!["X", "Y"].includes(attribute2(node, "N") ?? ""))
|
|
37451
37453
|
fail2("UNSUPPORTED_GEOMETRY_EDIT", "Unknown geometry row cells are unsupported.");
|
|
37452
37454
|
if ((type ?? "").startsWith("Rel")) continue;
|
|
@@ -37510,7 +37512,7 @@ function prepareMasterMovePins(roots, commands, bindings, check3) {
|
|
|
37510
37512
|
for (const command2 of commands) {
|
|
37511
37513
|
charge();
|
|
37512
37514
|
const root = roots.get(command2.pageId);
|
|
37513
|
-
const instance =
|
|
37515
|
+
const instance = children3(children3(root, "Shapes")[0], "Shape").find(
|
|
37514
37516
|
(shape2) => attribute2(shape2, "ID") === command2.shapeId
|
|
37515
37517
|
);
|
|
37516
37518
|
if (!instance?.hasAttribute("Master")) continue;
|
|
@@ -37520,7 +37522,7 @@ function prepareMasterMovePins(roots, commands, bindings, check3) {
|
|
|
37520
37522
|
if (!binding) fail2("UNSUPPORTED_GEOMETRY_EDIT", "A unique effective master root is required.");
|
|
37521
37523
|
for (const node of [instance, binding.template]) {
|
|
37522
37524
|
charge();
|
|
37523
|
-
if (attribute2(node, "Type") !== "Shape" ||
|
|
37525
|
+
if (attribute2(node, "Type") !== "Shape" || children3(node, "Shapes").length || children3(node, "ForeignData").length || children3(node, "Rel").length || ["1", "true"].includes(attribute2(node, "Del") ?? ""))
|
|
37524
37526
|
fail2("UNSUPPORTED_GEOMETRY_EDIT", "Master moves require top-level local 2D shape roots.");
|
|
37525
37527
|
}
|
|
37526
37528
|
for (const name of ["BeginX", "BeginY", "EndX", "EndY"])
|
|
@@ -37607,13 +37609,13 @@ function prepareMasterMovePins(roots, commands, bindings, check3) {
|
|
|
37607
37609
|
function createRectangle(root, edit) {
|
|
37608
37610
|
const doc = root.ownerDocument;
|
|
37609
37611
|
const node = (name) => doc.createElementNS(root.namespaceURI, name);
|
|
37610
|
-
let container =
|
|
37611
|
-
if (
|
|
37612
|
+
let container = children3(root, "Shapes")[0];
|
|
37613
|
+
if (children3(root, "Shapes").length > 1) fail2("INVALID_SHAPE_ID", "Duplicate Shapes containers.");
|
|
37612
37614
|
const pending2 = [root];
|
|
37613
37615
|
while (pending2.length) {
|
|
37614
37616
|
const parent = pending2.pop();
|
|
37615
|
-
for (const shapes of
|
|
37616
|
-
for (const shape3 of
|
|
37617
|
+
for (const shapes of children3(parent, "Shapes"))
|
|
37618
|
+
for (const shape3 of children3(shapes, "Shape")) {
|
|
37617
37619
|
if (attribute2(shape3, "ID") === edit.shapeId)
|
|
37618
37620
|
fail2("INVALID_SHAPE_ID", "Shape ID already exists.");
|
|
37619
37621
|
pending2.push(shape3);
|
|
@@ -37621,7 +37623,7 @@ function createRectangle(root, edit) {
|
|
|
37621
37623
|
}
|
|
37622
37624
|
if (!container) {
|
|
37623
37625
|
container = node("Shapes");
|
|
37624
|
-
root.insertBefore(container,
|
|
37626
|
+
root.insertBefore(container, children3(root, "Connects")[0] ?? null);
|
|
37625
37627
|
}
|
|
37626
37628
|
const shape2 = node("Shape");
|
|
37627
37629
|
shape2.setAttribute("ID", edit.shapeId);
|
|
@@ -37686,8 +37688,8 @@ function applyGeometryEdit(roots, document, edit, check3, masterMoveProof = empt
|
|
|
37686
37688
|
);
|
|
37687
37689
|
protectedShape(shape2, document, edit.type === "move-shape" ? masterMovePins : /* @__PURE__ */ new Set());
|
|
37688
37690
|
if (edit.type !== "delete-shape") {
|
|
37689
|
-
for (const connections2 of
|
|
37690
|
-
for (const connection of
|
|
37691
|
+
for (const connections2 of children3(root, "Connects"))
|
|
37692
|
+
for (const connection of children3(connections2, "Connect"))
|
|
37691
37693
|
if (["FromSheet", "ToSheet"].some((name) => attribute2(connection, name) === edit.shapeId))
|
|
37692
37694
|
fail2(
|
|
37693
37695
|
"UNSUPPORTED_GEOMETRY_EDIT",
|
|
@@ -37848,14 +37850,14 @@ function masterCells(sheet, charge = () => {
|
|
|
37848
37850
|
fail2("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Ambiguous effective master cells.");
|
|
37849
37851
|
result2.set(id, node);
|
|
37850
37852
|
};
|
|
37851
|
-
for (const node of
|
|
37852
|
-
for (const section of
|
|
37853
|
+
for (const node of children3(sheet, "Cell")) add3(attribute2(node, "N") ?? "", node);
|
|
37854
|
+
for (const section of children3(sheet, "Section")) {
|
|
37853
37855
|
const name = attribute2(section, "N") ?? "";
|
|
37854
37856
|
const prefix = name === "Geometry" ? `Geometry${Number(attribute2(section, "IX") ?? "0") + 1}` : name === "Control" ? "Controls" : name;
|
|
37855
|
-
for (const node of
|
|
37857
|
+
for (const node of children3(section, "Cell"))
|
|
37856
37858
|
add3(`${prefix}.${attribute2(node, "N") ?? ""}`, node);
|
|
37857
|
-
for (const row2 of
|
|
37858
|
-
for (const node of
|
|
37859
|
+
for (const row2 of children3(section, "Row"))
|
|
37860
|
+
for (const node of children3(row2, "Cell")) {
|
|
37859
37861
|
const n = attribute2(node, "N") ?? "";
|
|
37860
37862
|
const rowName = attribute2(row2, "N");
|
|
37861
37863
|
const index2 = attribute2(row2, "IX") ?? (prefix === "Controls" && /^Row_\d+$/.test(rowName ?? "") ? String(Number(rowName.slice(4)) - 1) : void 0);
|
|
@@ -37875,8 +37877,8 @@ function masterShapes(root) {
|
|
|
37875
37877
|
const result2 = [], pending2 = [root];
|
|
37876
37878
|
while (pending2.length) {
|
|
37877
37879
|
const parent = pending2.pop();
|
|
37878
|
-
for (const container of
|
|
37879
|
-
for (const shape2 of
|
|
37880
|
+
for (const container of children3(parent, "Shapes"))
|
|
37881
|
+
for (const shape2 of children3(container, "Shape")) {
|
|
37880
37882
|
result2.push(shape2);
|
|
37881
37883
|
pending2.push(shape2);
|
|
37882
37884
|
}
|
|
@@ -37896,15 +37898,15 @@ function assertMasterMarkup(root, known, check3) {
|
|
|
37896
37898
|
function masterStyleCells(document, template, instance, check3, charge = () => {
|
|
37897
37899
|
}, verifyMovementProtection = false) {
|
|
37898
37900
|
const styles = /* @__PURE__ */ new Map();
|
|
37899
|
-
for (const container of
|
|
37900
|
-
for (const style of
|
|
37901
|
+
for (const container of children3(document, "StyleSheets"))
|
|
37902
|
+
for (const style of children3(container, "StyleSheet")) {
|
|
37901
37903
|
charge();
|
|
37902
37904
|
const id = attribute2(style, "ID");
|
|
37903
37905
|
if (!id || styles.has(id))
|
|
37904
37906
|
fail2("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Ambiguous master style IDs.");
|
|
37905
37907
|
styles.set(id, style);
|
|
37906
37908
|
}
|
|
37907
|
-
const defaults =
|
|
37909
|
+
const defaults = children3(document, "DocumentSheet")[0];
|
|
37908
37910
|
const collect = (id, category, seen = /* @__PURE__ */ new Set()) => {
|
|
37909
37911
|
check3();
|
|
37910
37912
|
if (seen.has(id) || seen.size >= 64)
|
|
@@ -38009,7 +38011,7 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check3) {
|
|
|
38009
38011
|
problem("Active master definitions are missing.");
|
|
38010
38012
|
}
|
|
38011
38013
|
const definitions = /* @__PURE__ */ new Map();
|
|
38012
|
-
for (const node of
|
|
38014
|
+
for (const node of children3(await visioXml(pkg, mastersPart, "Masters"), "Master")) {
|
|
38013
38015
|
const id = attribute2(node, "ID");
|
|
38014
38016
|
if (!id || definitions.has(id)) problem("Master IDs are ambiguous.");
|
|
38015
38017
|
definitions.set(id, node);
|
|
@@ -38050,7 +38052,7 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check3) {
|
|
|
38050
38052
|
);
|
|
38051
38053
|
loaded.set(masterId, root);
|
|
38052
38054
|
}
|
|
38053
|
-
const tops =
|
|
38055
|
+
const tops = children3(children3(root, "Shapes")[0], "Shape");
|
|
38054
38056
|
if (tops.length !== 1) problem("Only a uniquely rooted master can prove independence.");
|
|
38055
38057
|
const templates = masterShapes(root), context = /* @__PURE__ */ new Map();
|
|
38056
38058
|
assertMasterMarkup(
|
|
@@ -38181,7 +38183,7 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check3) {
|
|
|
38181
38183
|
} else {
|
|
38182
38184
|
const formula = executableCellFormula(attribute2(source2.node, "F"));
|
|
38183
38185
|
if (formula && !inertDoubleClickFormula(attribute2(source2.node, "N") ?? "", formula)) {
|
|
38184
|
-
const text =
|
|
38186
|
+
const text = children3(binding.instance, "Text")[0] ?? children3(binding.template, "Text")[0];
|
|
38185
38187
|
const textFieldFree = ![...binding.cells.keys()].some((key2) => /^fields?\./i.test(key2)) && (!text || !Array.from(text.getElementsByTagName("*")).some(
|
|
38186
38188
|
(node) => node.localName.toLowerCase() === "fld"
|
|
38187
38189
|
));
|
|
@@ -38242,14 +38244,14 @@ function cells2(sheet) {
|
|
|
38242
38244
|
fail2("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Ambiguous inherited style cell.");
|
|
38243
38245
|
result2.set(key2, node);
|
|
38244
38246
|
};
|
|
38245
|
-
for (const node of
|
|
38246
|
-
for (const section of
|
|
38247
|
+
for (const node of children3(sheet, "Cell")) add3(attribute2(node, "N") ?? "", node);
|
|
38248
|
+
for (const section of children3(sheet, "Section")) {
|
|
38247
38249
|
const name = attribute2(section, "N") ?? "";
|
|
38248
38250
|
const prefix = name === "Geometry" ? `Geometry${Number(attribute2(section, "IX") ?? "0") + 1}` : name;
|
|
38249
|
-
for (const node of
|
|
38251
|
+
for (const node of children3(section, "Cell"))
|
|
38250
38252
|
add3(`${prefix}.${attribute2(node, "N") ?? ""}`, node);
|
|
38251
|
-
for (const row2 of
|
|
38252
|
-
for (const node of
|
|
38253
|
+
for (const row2 of children3(section, "Row"))
|
|
38254
|
+
for (const node of children3(row2, "Cell")) {
|
|
38253
38255
|
const n = attribute2(node, "N") ?? "", ix = attribute2(row2, "IX") ?? "0", rowName = attribute2(row2, "N") ?? ix;
|
|
38254
38256
|
add3(
|
|
38255
38257
|
name === "Geometry" ? `${prefix}.${n}${ix}` : n === "Value" && ["User", "Prop"].includes(name) ? `${prefix}.${rowName}` : `${prefix}.${rowName}.${n}`,
|
|
@@ -38360,7 +38362,7 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check3, root
|
|
|
38360
38362
|
if (target?.hasAttribute("MasterShape") && !target.hasAttribute("Master"))
|
|
38361
38363
|
fail2("UNSUPPORTED_GEOMETRY_EDIT", "Editing master-linked shapes is unsupported.");
|
|
38362
38364
|
if (target?.hasAttribute("Master") && (command2.type !== "move-shape" || !["PinX", "PinY"].every(
|
|
38363
|
-
(name) =>
|
|
38365
|
+
(name) => children3(target, "Cell").some((node) => attribute2(node, "N") === name)
|
|
38364
38366
|
)))
|
|
38365
38367
|
fail2("UNSUPPORTED_GEOMETRY_EDIT", "Master moves require explicit local rotation pins.");
|
|
38366
38368
|
}
|
|
@@ -38368,15 +38370,15 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check3, root
|
|
|
38368
38370
|
}
|
|
38369
38371
|
if (!documentRoot) return movePins;
|
|
38370
38372
|
const styles = /* @__PURE__ */ new Map();
|
|
38371
|
-
for (const container of
|
|
38372
|
-
for (const style of
|
|
38373
|
+
for (const container of children3(documentRoot, "StyleSheets"))
|
|
38374
|
+
for (const style of children3(container, "StyleSheet")) {
|
|
38373
38375
|
const id = attribute2(style, "ID");
|
|
38374
38376
|
if (!id || styles.has(id))
|
|
38375
38377
|
fail2("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Style IDs must be unique.");
|
|
38376
38378
|
styles.set(id, style);
|
|
38377
38379
|
}
|
|
38378
38380
|
const styleCache2 = /* @__PURE__ */ new Map();
|
|
38379
|
-
const documentSheet =
|
|
38381
|
+
const documentSheet = children3(documentRoot, "DocumentSheet")[0];
|
|
38380
38382
|
const inherited = (id, category, seen = /* @__PURE__ */ new Set()) => {
|
|
38381
38383
|
check3();
|
|
38382
38384
|
const cacheKey = `${category}:${id}`;
|