ooxml-core 0.19.0 → 0.20.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/dist/automation/index.cjs +195 -193
- package/dist/automation/index.mjs +195 -193
- 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 +2 -1
- package/dist/index.mjs +2 -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/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 +30 -3
|
@@ -80,7 +80,8 @@ function parseXml(xml, options = {}) {
|
|
|
80
80
|
}).parseFromString(xml, "application/xml");
|
|
81
81
|
} catch (error) {
|
|
82
82
|
throw new Error(
|
|
83
|
-
`Invalid ${label2} XML: ${error instanceof Error ? error.message : String(error)}
|
|
83
|
+
`Invalid ${label2} XML: ${error instanceof Error ? error.message : String(error)}`,
|
|
84
|
+
{ cause: error }
|
|
84
85
|
);
|
|
85
86
|
}
|
|
86
87
|
if (parseError || !parsed.documentElement)
|
|
@@ -1425,12 +1426,12 @@ function paragraphsOf(blocks) {
|
|
|
1425
1426
|
}
|
|
1426
1427
|
function commentContinuations(blocks) {
|
|
1427
1428
|
const paragraphs = paragraphsOf(blocks);
|
|
1428
|
-
const
|
|
1429
|
+
const first3 = /* @__PURE__ */ new Map();
|
|
1429
1430
|
const last = /* @__PURE__ */ new Map();
|
|
1430
1431
|
const idsByParagraph = paragraphs.map((paragraph, index2) => {
|
|
1431
1432
|
const ids = new Set(paragraph.runs.flatMap(rangeKeys));
|
|
1432
1433
|
for (const id of ids) {
|
|
1433
|
-
if (!
|
|
1434
|
+
if (!first3.has(id)) first3.set(id, index2);
|
|
1434
1435
|
last.set(id, index2);
|
|
1435
1436
|
}
|
|
1436
1437
|
return ids;
|
|
@@ -1438,7 +1439,7 @@ function commentContinuations(blocks) {
|
|
|
1438
1439
|
const result2 = /* @__PURE__ */ new Map();
|
|
1439
1440
|
paragraphs.forEach((paragraph, index2) => {
|
|
1440
1441
|
const ids = [...idsByParagraph[index2] ?? []];
|
|
1441
|
-
const before = new Set(ids.filter((id) => (
|
|
1442
|
+
const before = new Set(ids.filter((id) => (first3.get(id) ?? index2) < index2));
|
|
1442
1443
|
const after = new Set(ids.filter((id) => (last.get(id) ?? index2) > index2));
|
|
1443
1444
|
if (before.size || after.size) result2.set(paragraph.id, { before, after });
|
|
1444
1445
|
});
|
|
@@ -1640,11 +1641,11 @@ function rangeEndNodes(doc, edge) {
|
|
|
1640
1641
|
return [end];
|
|
1641
1642
|
}
|
|
1642
1643
|
function rangeEdges(runs, ranges) {
|
|
1643
|
-
const
|
|
1644
|
+
const first3 = /* @__PURE__ */ new Map();
|
|
1644
1645
|
const last = /* @__PURE__ */ new Map();
|
|
1645
1646
|
runs.forEach((run, index2) => {
|
|
1646
1647
|
for (const key2 of rangeKeys(run)) {
|
|
1647
|
-
if (!
|
|
1648
|
+
if (!first3.has(key2)) first3.set(key2, index2);
|
|
1648
1649
|
last.set(key2, index2);
|
|
1649
1650
|
}
|
|
1650
1651
|
});
|
|
@@ -1664,9 +1665,9 @@ function rangeEdges(runs, ranges) {
|
|
|
1664
1665
|
const opens = /* @__PURE__ */ new Map();
|
|
1665
1666
|
const closes = /* @__PURE__ */ new Map();
|
|
1666
1667
|
const order = (key2) => key2.startsWith("comment:") ? 0 : 1;
|
|
1667
|
-
for (const key2 of [...
|
|
1668
|
+
for (const key2 of [...first3.keys()].sort((a, b) => order(a) - order(b))) {
|
|
1668
1669
|
if (!ranges?.before.has(key2)) {
|
|
1669
|
-
const index2 =
|
|
1670
|
+
const index2 = first3.get(key2);
|
|
1670
1671
|
(opens.get(index2) ?? opens.set(index2, []).get(index2)).push(edgeFor(key2, index2));
|
|
1671
1672
|
}
|
|
1672
1673
|
if (!ranges?.after.has(key2)) {
|
|
@@ -8595,7 +8596,8 @@ async function readZipParts(input, limits = {}) {
|
|
|
8595
8596
|
zip = await JSZip.loadAsync(bytes);
|
|
8596
8597
|
} catch (error) {
|
|
8597
8598
|
throw new Error(
|
|
8598
|
-
`Not a valid XLSX package: ${error instanceof Error ? error.message : String(error)}
|
|
8599
|
+
`Not a valid XLSX package: ${error instanceof Error ? error.message : String(error)}`,
|
|
8600
|
+
{ cause: error }
|
|
8599
8601
|
);
|
|
8600
8602
|
}
|
|
8601
8603
|
const entries = Object.values(zip.files).filter((entry) => !entry.dir);
|
|
@@ -9585,24 +9587,24 @@ function mergeSpacedAreas(tokens2) {
|
|
|
9585
9587
|
const out = [];
|
|
9586
9588
|
const plainCell = (t) => t?.kind === "ref" && t.ref?.kind === "cell" && !t.spill;
|
|
9587
9589
|
for (let i = 0; i < tokens2.length; i++) {
|
|
9588
|
-
const
|
|
9590
|
+
const first3 = tokens2[i];
|
|
9589
9591
|
let j = i + 1;
|
|
9590
9592
|
while (tokens2[j]?.kind === "ws") j++;
|
|
9591
9593
|
let k = j + 1;
|
|
9592
9594
|
while (tokens2[k]?.kind === "ws") k++;
|
|
9593
9595
|
const colon = tokens2[j];
|
|
9594
9596
|
const last = tokens2[k];
|
|
9595
|
-
if (plainCell(
|
|
9597
|
+
if (plainCell(first3) && colon?.kind === "op" && colon.text === ":" && plainCell(last) && !last?.prefix && k > i + 2 && first3.ref && last?.ref) {
|
|
9596
9598
|
const text = tokens2.slice(i, k + 1).map((t) => t.text).join("");
|
|
9597
9599
|
out.push({
|
|
9598
|
-
...
|
|
9600
|
+
...first3,
|
|
9599
9601
|
text,
|
|
9600
|
-
ref: { kind: "area", start:
|
|
9602
|
+
ref: { kind: "area", start: first3.ref.start, end: last.ref.start }
|
|
9601
9603
|
});
|
|
9602
9604
|
i = k;
|
|
9603
9605
|
continue;
|
|
9604
9606
|
}
|
|
9605
|
-
out.push(
|
|
9607
|
+
out.push(first3);
|
|
9606
9608
|
}
|
|
9607
9609
|
return out;
|
|
9608
9610
|
}
|
|
@@ -9654,10 +9656,10 @@ function renameSheetInFormula(formula, oldName, newName) {
|
|
|
9654
9656
|
for (const token of tokens2) {
|
|
9655
9657
|
const prefix = token.prefix;
|
|
9656
9658
|
if (!prefix || prefix.book !== void 0) continue;
|
|
9657
|
-
const
|
|
9659
|
+
const first3 = prefix.sheet.toLowerCase() === lower2;
|
|
9658
9660
|
const second = prefix.sheet2?.toLowerCase() === lower2;
|
|
9659
|
-
if (!
|
|
9660
|
-
const renamed = { ...prefix, sheet:
|
|
9661
|
+
if (!first3 && !second) continue;
|
|
9662
|
+
const renamed = { ...prefix, sheet: first3 ? newName : prefix.sheet };
|
|
9661
9663
|
if (prefix.sheet2 !== void 0) renamed.sheet2 = second ? newName : prefix.sheet2;
|
|
9662
9664
|
const text = prefixText(renamed);
|
|
9663
9665
|
token.text = text + token.text.slice(prefix.text.length);
|
|
@@ -11477,9 +11479,9 @@ function seriesXml(chart, series, index2) {
|
|
|
11477
11479
|
var axes = (horizontal, scatter) => {
|
|
11478
11480
|
const common = '<c:scaling><c:orientation val="minMax"/></c:scaling><c:delete val="0"/>';
|
|
11479
11481
|
const ticks = '<c:numFmt formatCode="General" sourceLinked="1"/><c:majorTickMark val="out"/><c:minorTickMark val="none"/><c:tickLblPos val="nextTo"/>';
|
|
11480
|
-
const
|
|
11482
|
+
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>`;
|
|
11481
11483
|
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>`;
|
|
11482
|
-
return
|
|
11484
|
+
return first3 + second;
|
|
11483
11485
|
};
|
|
11484
11486
|
var AX_IDS = '<c:axId val="500000001"/><c:axId val="500000002"/>';
|
|
11485
11487
|
function plotXml(chart) {
|
|
@@ -12675,8 +12677,8 @@ function fitNumber(value, format, options) {
|
|
|
12675
12677
|
const date1904 = options.date1904 ?? false;
|
|
12676
12678
|
const width = options.width ?? 0;
|
|
12677
12679
|
const fits = (text) => (options.measure ? options.measure(text) : text.length) <= width;
|
|
12678
|
-
const
|
|
12679
|
-
if (fits(
|
|
12680
|
+
const first3 = formatNumber(value, format, date1904);
|
|
12681
|
+
if (fits(first3.text) || first3.text === OVERFLOW_TEXT) return first3;
|
|
12680
12682
|
const choice2 = chooseSection(compileFormat(format), value);
|
|
12681
12683
|
const general = choice2 && !choice2.section.number && !choice2.section.fraction && choice2.section.tokens.some((t) => t.t === "general");
|
|
12682
12684
|
if (general) {
|
|
@@ -12686,7 +12688,7 @@ function fitNumber(value, format, options) {
|
|
|
12686
12688
|
}
|
|
12687
12689
|
}
|
|
12688
12690
|
const fill2 = hashFill(options);
|
|
12689
|
-
return
|
|
12691
|
+
return first3.color ? { text: fill2, color: first3.color } : { text: fill2 };
|
|
12690
12692
|
}
|
|
12691
12693
|
function formatNumber(value, format, date1904, generalWidth) {
|
|
12692
12694
|
if (!Number.isFinite(value)) return { text: "#NUM!" };
|
|
@@ -13337,9 +13339,9 @@ function serialToYmd(serial, date1904 = date1904Mode) {
|
|
|
13337
13339
|
return { year: d.getUTCFullYear(), month: d.getUTCMonth() + 1, day: d.getUTCDate() };
|
|
13338
13340
|
}
|
|
13339
13341
|
function monthStartSerial(year, month0, date1904) {
|
|
13340
|
-
const
|
|
13341
|
-
|
|
13342
|
-
const days = Math.round((
|
|
13342
|
+
const first3 = /* @__PURE__ */ new Date(0);
|
|
13343
|
+
first3.setUTCFullYear(year, month0, 1);
|
|
13344
|
+
const days = Math.round((first3.getTime() - (date1904 ? EPOCH_19042 : EPOCH_19003)) / DAY_MS2);
|
|
13343
13345
|
return !date1904 && days < 61 ? days - 1 : days;
|
|
13344
13346
|
}
|
|
13345
13347
|
function ymdToSerial(year, month, day, date1904 = date1904Mode) {
|
|
@@ -14407,9 +14409,9 @@ function percentRank(values2, x, digits2, exclusive) {
|
|
|
14407
14409
|
const s = sorted(values2);
|
|
14408
14410
|
const n = s.length;
|
|
14409
14411
|
if (n === 0 || digits2 < 1) fail(ERR.NUM);
|
|
14410
|
-
const
|
|
14412
|
+
const first3 = s[0];
|
|
14411
14413
|
const last = s[n - 1];
|
|
14412
|
-
if (x <
|
|
14414
|
+
if (x < first3 || x > last) fail(ERR.NA);
|
|
14413
14415
|
let rank4;
|
|
14414
14416
|
const lower2 = s.filter((v) => v < x).length;
|
|
14415
14417
|
const exact = s.includes(x);
|
|
@@ -14609,8 +14611,8 @@ function weekendDays(value) {
|
|
|
14609
14611
|
}
|
|
14610
14612
|
const code = Math.trunc(num2(v));
|
|
14611
14613
|
if (code >= 1 && code <= 7) {
|
|
14612
|
-
const
|
|
14613
|
-
return /* @__PURE__ */ new Set([
|
|
14614
|
+
const first3 = (code + 5) % 7;
|
|
14615
|
+
return /* @__PURE__ */ new Set([first3, (first3 + 1) % 7]);
|
|
14614
14616
|
}
|
|
14615
14617
|
if (code >= 11 && code <= 17) return /* @__PURE__ */ new Set([code - 11]);
|
|
14616
14618
|
return fail(ERR.NUM);
|
|
@@ -15854,16 +15856,16 @@ function quasiPeriods(anchor, from, to, frequency2, ctx) {
|
|
|
15854
15856
|
}
|
|
15855
15857
|
function accruedInterest(args, ctx) {
|
|
15856
15858
|
const issue = serialArg(args[0]);
|
|
15857
|
-
const
|
|
15859
|
+
const first3 = serialArg(args[1]);
|
|
15858
15860
|
const settlement = serialArg(args[2]);
|
|
15859
15861
|
const [rate, par] = [num2(args[3]), optNum(args, 4, 1e3)];
|
|
15860
15862
|
const frequency2 = int3(args[5]);
|
|
15861
15863
|
const basis = basisOf(args, 6);
|
|
15862
15864
|
const fromIssue = args.length > 7 && args[7] !== null ? bool(args[7]) : true;
|
|
15863
15865
|
if (rate <= 0 || par <= 0 || ![1, 2, 4].includes(frequency2) || issue >= settlement) fail(ERR.NUM);
|
|
15864
|
-
const start = fromIssue ? issue : Math.max(issue,
|
|
15866
|
+
const start = fromIssue ? issue : Math.max(issue, first3);
|
|
15865
15867
|
if (start >= settlement) return 0;
|
|
15866
|
-
const dates = quasiPeriods(
|
|
15868
|
+
const dates = quasiPeriods(first3, start, settlement, frequency2, ctx);
|
|
15867
15869
|
const count2 = (a, b) => basis === 0 || basis === 4 ? days360(a, b, basis === 4, ctx) : b - a;
|
|
15868
15870
|
let sum2 = 0;
|
|
15869
15871
|
for (let i = 0; i + 1 < dates.length; i++) {
|
|
@@ -16322,8 +16324,8 @@ function datedFlows(ctx, args) {
|
|
|
16322
16324
|
const values2 = collectNumbers(ctx, [args[0] ?? null]);
|
|
16323
16325
|
const dates = collectNumbers(ctx, [args[1] ?? null]).map(Math.floor);
|
|
16324
16326
|
if (values2.length !== dates.length || values2.length === 0) fail(ERR.NUM);
|
|
16325
|
-
const
|
|
16326
|
-
if (dates.some((d) => d <
|
|
16327
|
+
const first3 = dates[0];
|
|
16328
|
+
if (dates.some((d) => d < first3)) fail(ERR.NUM);
|
|
16327
16329
|
return { values: values2, dates };
|
|
16328
16330
|
}
|
|
16329
16331
|
var xnpv = (rate, values2, dates) => values2.reduce(
|
|
@@ -16495,13 +16497,13 @@ function sheetIndex(host, name) {
|
|
|
16495
16497
|
function prefixSheets(host, prefix, current) {
|
|
16496
16498
|
if (!prefix) return [current];
|
|
16497
16499
|
if (prefix.book !== void 0) return void 0;
|
|
16498
|
-
const
|
|
16499
|
-
if (
|
|
16500
|
-
if (prefix.sheet2 === void 0) return [
|
|
16500
|
+
const first3 = sheetIndex(host, prefix.sheet);
|
|
16501
|
+
if (first3 < 0) return void 0;
|
|
16502
|
+
if (prefix.sheet2 === void 0) return [first3];
|
|
16501
16503
|
const last = sheetIndex(host, prefix.sheet2);
|
|
16502
16504
|
if (last < 0) return void 0;
|
|
16503
16505
|
const out = [];
|
|
16504
|
-
for (let i = Math.min(
|
|
16506
|
+
for (let i = Math.min(first3, last); i <= Math.max(first3, last); i++) out.push(i);
|
|
16505
16507
|
return out;
|
|
16506
16508
|
}
|
|
16507
16509
|
var specRange = (spec2) => normalizeRange({
|
|
@@ -18072,7 +18074,7 @@ function matchingCells(ctx, pairs, target, sameShape) {
|
|
|
18072
18074
|
const tests = pairs.map((p) => makeCriteria(scalar(p.criteria)));
|
|
18073
18075
|
const values2 = matrices[matrices.length - 1];
|
|
18074
18076
|
const out = [];
|
|
18075
|
-
const
|
|
18077
|
+
const first3 = matrices[0];
|
|
18076
18078
|
const holds = (r, c2) => {
|
|
18077
18079
|
for (let i = 0; i < tests.length; i++) {
|
|
18078
18080
|
if (!tests[i](matrices[i].get(r, c2))) return false;
|
|
@@ -18082,23 +18084,23 @@ function matchingCells(ctx, pairs, target, sameShape) {
|
|
|
18082
18084
|
const candidates = indexedCandidates(pairs, matrices);
|
|
18083
18085
|
if (candidates) {
|
|
18084
18086
|
for (const at of candidates) {
|
|
18085
|
-
const r = Math.floor(at /
|
|
18086
|
-
const c2 = at - r *
|
|
18087
|
+
const r = Math.floor(at / first3.cols);
|
|
18088
|
+
const c2 = at - r * first3.cols;
|
|
18087
18089
|
if (holds(r, c2)) out.push(values2.get(r, c2));
|
|
18088
18090
|
}
|
|
18089
18091
|
} else {
|
|
18090
|
-
for (let r = 0; r <
|
|
18091
|
-
for (let c2 = 0; c2 <
|
|
18092
|
+
for (let r = 0; r < first3.rows; r++) {
|
|
18093
|
+
for (let c2 = 0; c2 < first3.cols; c2++) if (holds(r, c2)) out.push(values2.get(r, c2));
|
|
18092
18094
|
}
|
|
18093
18095
|
}
|
|
18094
18096
|
const blankTail = total2 > block && tests.every((test) => test(null)) ? total2 - block : 0;
|
|
18095
18097
|
return { values: out, blankTail };
|
|
18096
18098
|
}
|
|
18097
18099
|
function indexedCandidates(pairs, matrices) {
|
|
18098
|
-
const
|
|
18100
|
+
const first3 = matrices[0];
|
|
18099
18101
|
for (let i = 0; i < pairs.length; i++) {
|
|
18100
18102
|
const m = matrices[i];
|
|
18101
|
-
if (!(pairs[i]?.range instanceof RefValue) || m.cols !==
|
|
18103
|
+
if (!(pairs[i]?.range instanceof RefValue) || m.cols !== first3.cols) continue;
|
|
18102
18104
|
const key2 = equalityKey(scalar(pairs[i]?.criteria));
|
|
18103
18105
|
if (key2 === void 0) continue;
|
|
18104
18106
|
const found = positionsOf(m, key2);
|
|
@@ -18155,12 +18157,12 @@ var C18 = "Math & Trig";
|
|
|
18155
18157
|
var numbersOf = (values2) => values2.filter((v) => typeof v === "number");
|
|
18156
18158
|
function sumProduct(ctx, args) {
|
|
18157
18159
|
const matrices = args.map((a) => ctx.toMatrix(a));
|
|
18158
|
-
const
|
|
18159
|
-
if (!
|
|
18160
|
-
for (const m of matrices) if (m.rows !==
|
|
18160
|
+
const first3 = matrices[0];
|
|
18161
|
+
if (!first3) fail(ERR.VALUE);
|
|
18162
|
+
for (const m of matrices) if (m.rows !== first3.rows || m.cols !== first3.cols) fail(ERR.VALUE);
|
|
18161
18163
|
let total2 = 0;
|
|
18162
|
-
for (let r = 0; r <
|
|
18163
|
-
for (let c2 = 0; c2 <
|
|
18164
|
+
for (let r = 0; r < first3.rows; r++) {
|
|
18165
|
+
for (let c2 = 0; c2 < first3.cols; c2++) {
|
|
18164
18166
|
let product = 1;
|
|
18165
18167
|
for (const m of matrices) {
|
|
18166
18168
|
const v = m.get(r, c2);
|
|
@@ -22026,9 +22028,9 @@ function visit(node, c2) {
|
|
|
22026
22028
|
let sheet = c2.sheet;
|
|
22027
22029
|
if (node.prefix) {
|
|
22028
22030
|
const sheets = prefixSheets(c2.host, node.prefix, c2.sheet);
|
|
22029
|
-
const
|
|
22030
|
-
if (
|
|
22031
|
-
sheet =
|
|
22031
|
+
const first3 = sheets?.[0];
|
|
22032
|
+
if (first3 === void 0) return;
|
|
22033
|
+
sheet = first3;
|
|
22032
22034
|
}
|
|
22033
22035
|
const defined = findDefinedName(c2.host, node.name, sheet, node.prefix !== void 0);
|
|
22034
22036
|
if (defined) {
|
|
@@ -22166,9 +22168,9 @@ var AreaIndex = class {
|
|
|
22166
22168
|
else this.wide.set(area.sheet, [entry]);
|
|
22167
22169
|
return;
|
|
22168
22170
|
}
|
|
22169
|
-
const
|
|
22171
|
+
const first3 = start.row >> CHUNK_SHIFT;
|
|
22170
22172
|
const last = end.row >> CHUNK_SHIFT;
|
|
22171
|
-
if (last -
|
|
22173
|
+
if (last - first3 + 1 > CHUNKS) {
|
|
22172
22174
|
const cols2 = inner(this.tall, area.sheet);
|
|
22173
22175
|
for (let c2 = start.col; c2 <= end.col; c2++) push2(cols2, c2, entry);
|
|
22174
22176
|
return;
|
|
@@ -22177,7 +22179,7 @@ var AreaIndex = class {
|
|
|
22177
22179
|
for (let c2 = start.col; c2 <= end.col; c2++) {
|
|
22178
22180
|
let chunks = cols.get(c2);
|
|
22179
22181
|
if (!chunks) cols.set(c2, chunks = /* @__PURE__ */ new Map());
|
|
22180
|
-
for (let k =
|
|
22182
|
+
for (let k = first3; k <= last; k++) push2(chunks, k, entry);
|
|
22181
22183
|
}
|
|
22182
22184
|
}
|
|
22183
22185
|
/** Items whose areas intersect `range` on `sheet` (each once). */
|
|
@@ -22218,13 +22220,13 @@ var AreaIndex = class {
|
|
|
22218
22220
|
} else for (const c2 of map.keys()) if (c2 >= start.col && c2 <= end.col) visit2(c2);
|
|
22219
22221
|
};
|
|
22220
22222
|
const chunked = this.chunked.get(sheet);
|
|
22221
|
-
const
|
|
22223
|
+
const first3 = start.row >> CHUNK_SHIFT;
|
|
22222
22224
|
const last = end.row >> CHUNK_SHIFT;
|
|
22223
22225
|
columns(chunked, (c2) => {
|
|
22224
22226
|
const chunks = chunked?.get(c2);
|
|
22225
|
-
if (last -
|
|
22226
|
-
for (let k =
|
|
22227
|
-
} else for (const [k, list] of chunks) if (k >=
|
|
22227
|
+
if (last - first3 + 1 <= chunks.size) {
|
|
22228
|
+
for (let k = first3; k <= last; k++) check3(chunks.get(k));
|
|
22229
|
+
} else for (const [k, list] of chunks) if (k >= first3 && k <= last) check3(list);
|
|
22228
22230
|
});
|
|
22229
22231
|
const tall = this.tall.get(sheet);
|
|
22230
22232
|
columns(tall, (c2) => check3(tall?.get(c2)));
|
|
@@ -22694,8 +22696,8 @@ function formulaOrder(nodes, successors) {
|
|
|
22694
22696
|
const ranks = /* @__PURE__ */ new Map();
|
|
22695
22697
|
const components = stronglyConnected(nodes, successors).map((members, rank4) => {
|
|
22696
22698
|
for (const member of members) ranks.set(member, rank4);
|
|
22697
|
-
const
|
|
22698
|
-
return { nodes: members, cyclic: members.length > 1 || successors(
|
|
22699
|
+
const first3 = members[0];
|
|
22700
|
+
return { nodes: members, cyclic: members.length > 1 || successors(first3).includes(first3) };
|
|
22699
22701
|
});
|
|
22700
22702
|
return { components, ranks };
|
|
22701
22703
|
}
|
|
@@ -22734,9 +22736,9 @@ function sameRange(a, b) {
|
|
|
22734
22736
|
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;
|
|
22735
22737
|
}
|
|
22736
22738
|
function boundingBox(ranges) {
|
|
22737
|
-
const
|
|
22738
|
-
const start = { ...
|
|
22739
|
-
const end = { ...
|
|
22739
|
+
const first3 = ranges[0];
|
|
22740
|
+
const start = { ...first3.start };
|
|
22741
|
+
const end = { ...first3.end };
|
|
22740
22742
|
for (const r of ranges) {
|
|
22741
22743
|
start.row = Math.min(start.row, r.start.row);
|
|
22742
22744
|
start.col = Math.min(start.col, r.start.col);
|
|
@@ -22873,13 +22875,13 @@ var EngineCore = class extends EngineHost {
|
|
|
22873
22875
|
this.dynamicCycleHits = /* @__PURE__ */ new Set();
|
|
22874
22876
|
try {
|
|
22875
22877
|
for (const component of order.components) {
|
|
22876
|
-
const
|
|
22878
|
+
const first3 = component.nodes[0];
|
|
22877
22879
|
if (component.cyclic) {
|
|
22878
22880
|
const iterate = this.workbook.iterate;
|
|
22879
22881
|
if (iterate) this.iterateGroup(component.nodes, iterate);
|
|
22880
22882
|
else for (const node of component.nodes) this.markCycle(node);
|
|
22881
|
-
} else if (this.pending.has(
|
|
22882
|
-
this.computeFrom(
|
|
22883
|
+
} else if (this.pending.has(first3)) {
|
|
22884
|
+
this.computeFrom(first3);
|
|
22883
22885
|
}
|
|
22884
22886
|
}
|
|
22885
22887
|
} finally {
|
|
@@ -24426,8 +24428,8 @@ function ruleXml(rule2, styles, anchor) {
|
|
|
24426
24428
|
}
|
|
24427
24429
|
function conditionalFormatsXml(formats, styles) {
|
|
24428
24430
|
return formats.filter((format) => format.ranges.length && format.rules.length).map((format) => {
|
|
24429
|
-
const
|
|
24430
|
-
const anchor =
|
|
24431
|
+
const first3 = format.ranges[0];
|
|
24432
|
+
const anchor = first3 ? formatAddress(first3.start) : "A1";
|
|
24431
24433
|
const rules = format.rules.map((rule2) => ruleXml(rule2, styles, anchor)).join("");
|
|
24432
24434
|
return `<conditionalFormatting sqref="${format.ranges.map((r) => formatRange(r)).join(" ")}">${rules}</conditionalFormatting>`;
|
|
24433
24435
|
}).join("");
|
|
@@ -24530,14 +24532,14 @@ function headerFooterXml(sheet, page) {
|
|
|
24530
24532
|
if (source2 && sameModel(readHeaderFooter(source2), fields))
|
|
24531
24533
|
return snapshotXml(sheet, "headerFooter") ?? "";
|
|
24532
24534
|
if (!Object.keys(fields).length) return "";
|
|
24533
|
-
const
|
|
24535
|
+
const children4 = Object.entries(HEADER_FOOTER_TEXT).map(([key2, local]) => {
|
|
24534
24536
|
const text = fields[key2];
|
|
24535
24537
|
return text === void 0 ? "" : `<${local}>${escapeText(encodeEscapes(text))}</${local}>`;
|
|
24536
24538
|
}).join("");
|
|
24537
24539
|
const flags = {};
|
|
24538
24540
|
for (const key2 of HEADER_FOOTER_FLAGS) flags[key2] = fields[key2];
|
|
24539
24541
|
const head = mergedAttrs(source2, flags);
|
|
24540
|
-
return
|
|
24542
|
+
return children4 ? `<headerFooter${head}>${children4}</headerFooter>` : `<headerFooter${head}/>`;
|
|
24541
24543
|
}
|
|
24542
24544
|
function pageXml(sheet) {
|
|
24543
24545
|
const page = sheet.pageSetup ?? {};
|
|
@@ -25114,9 +25116,9 @@ function sheetPrXml(sheet) {
|
|
|
25114
25116
|
if (source2 && sameModel(readTabColor(source2), sheet.tabColor) && readFitToPage(source2) === fit)
|
|
25115
25117
|
return snapshotXml(sheet, "sheetPr") ?? "";
|
|
25116
25118
|
const sourceAttrs = source2 ? Array.from(source2.attributes).filter((a) => !a.name.startsWith("xmlns")).map((a) => ` ${a.name}="${escapeAttr3(a.value)}"`).join("") : "";
|
|
25117
|
-
const
|
|
25118
|
-
const outline2 =
|
|
25119
|
-
const setUp =
|
|
25119
|
+
const children4 = source2 ? elements(source2) : [];
|
|
25120
|
+
const outline2 = children4.find((node) => node.localName === "outlinePr");
|
|
25121
|
+
const setUp = children4.find((node) => node.localName === "pageSetUpPr");
|
|
25120
25122
|
let setUpXml = "";
|
|
25121
25123
|
if (setUp || fit) {
|
|
25122
25124
|
const keep2 = setUp ? Array.from(setUp.attributes).filter((a) => a.name !== "fitToPage" && !a.name.startsWith("xmlns")).map((a) => ` ${a.name}="${escapeAttr3(a.value)}"`).join("") : "";
|
|
@@ -25134,10 +25136,10 @@ function dimensionXml(sheet) {
|
|
|
25134
25136
|
function sheetViewsXml(sheet, tabSelected) {
|
|
25135
25137
|
const source2 = snapshotElement(sheet, "sheetViews");
|
|
25136
25138
|
if (source2 && sameModel(readSheetView(source2), sheet.view)) {
|
|
25137
|
-
const
|
|
25138
|
-
if (
|
|
25139
|
-
if (tabSelected)
|
|
25140
|
-
else
|
|
25139
|
+
const first3 = elements(source2).find((node) => node.localName === "sheetView");
|
|
25140
|
+
if (first3) {
|
|
25141
|
+
if (tabSelected) first3.setAttribute("tabSelected", "1");
|
|
25142
|
+
else first3.removeAttribute("tabSelected");
|
|
25141
25143
|
}
|
|
25142
25144
|
return outerXml(source2);
|
|
25143
25145
|
}
|
|
@@ -26962,14 +26964,14 @@ var TEXT_NUMBER = /^(.*?)(\d+)(\D*)$/;
|
|
|
26962
26964
|
var QUARTER = /^(q|qtr|quarter)(\s?)([1-4])$/i;
|
|
26963
26965
|
function textSeries(texts) {
|
|
26964
26966
|
const lists = texts.map(listMatch);
|
|
26965
|
-
const
|
|
26966
|
-
if (
|
|
26967
|
+
const first3 = lists[0];
|
|
26968
|
+
if (first3 && lists.every((m) => m && m.list === first3.list)) {
|
|
26967
26969
|
const second = lists[1];
|
|
26968
|
-
const step = second ? mod(second.index -
|
|
26970
|
+
const step = second ? mod(second.index - first3.index, first3.list.length) || 1 : 1;
|
|
26969
26971
|
const sample = texts[0] ?? "";
|
|
26970
26972
|
return (k) => ({
|
|
26971
26973
|
kind: "value",
|
|
26972
|
-
value: matchCase(
|
|
26974
|
+
value: matchCase(first3.list[mod(first3.index + step * k, first3.list.length)] ?? "", sample)
|
|
26973
26975
|
});
|
|
26974
26976
|
}
|
|
26975
26977
|
const quarters = texts.map((t) => QUARTER.exec(t));
|
|
@@ -27009,11 +27011,11 @@ function formatShowsDate(code) {
|
|
|
27009
27011
|
function dateCode(format) {
|
|
27010
27012
|
return (format.split(";")[0] ?? "").replace(/"[^"]*"|\\.|_.|\*./g, "").replace(/\[(h+|m+|s+)\]/gi, "$1").replace(/\[[^\]]*\]/g, "").replace(/am\/pm|a\/p/gi, "").toLowerCase();
|
|
27011
27013
|
}
|
|
27012
|
-
function singleDateSeries(
|
|
27014
|
+
function singleDateSeries(first3, format) {
|
|
27013
27015
|
const code = dateCode(format);
|
|
27014
|
-
if (!formatShowsDate(code)) return (k) => ({ kind: "value", value:
|
|
27015
|
-
const base = /[hs]/.test(code) ?
|
|
27016
|
-
return (k) => ({ kind: "value", value: k === 0 ?
|
|
27016
|
+
if (!formatShowsDate(code)) return (k) => ({ kind: "value", value: first3 + k / 24 });
|
|
27017
|
+
const base = /[hs]/.test(code) ? first3 : Math.floor(first3);
|
|
27018
|
+
return (k) => ({ kind: "value", value: k === 0 ? first3 : base + k });
|
|
27017
27019
|
}
|
|
27018
27020
|
function dateSeries(serials, date1904, format) {
|
|
27019
27021
|
if (serials.length === 1) return singleDateSeries(serials[0] ?? 0, format);
|
|
@@ -27022,9 +27024,9 @@ function dateSeries(serials, date1904, format) {
|
|
|
27022
27024
|
const sameDay = dates.every((d) => d.getUTCDate() === dates[0]?.getUTCDate());
|
|
27023
27025
|
const stepMonths = (monthIndex[1] ?? 0) - (monthIndex[0] ?? 0);
|
|
27024
27026
|
const evenMonths = stepMonths !== 0 && monthIndex.every((m, i) => m - (monthIndex[0] ?? 0) === stepMonths * i);
|
|
27025
|
-
const
|
|
27027
|
+
const first3 = serials[0] ?? 0;
|
|
27026
27028
|
if (sameDay && evenMonths)
|
|
27027
|
-
return (k) => ({ kind: "value", value: addMonths2(
|
|
27029
|
+
return (k) => ({ kind: "value", value: addMonths2(first3, stepMonths * k, date1904) });
|
|
27028
27030
|
const trend = linearTrend(serials);
|
|
27029
27031
|
return (k) => ({ kind: "value", value: trend(k) });
|
|
27030
27032
|
}
|
|
@@ -28715,9 +28717,9 @@ function applyTotalsRow(sheet, table2) {
|
|
|
28715
28717
|
const row2 = table2.range.end.row;
|
|
28716
28718
|
const { columns } = table2;
|
|
28717
28719
|
if (!columns.some((c2) => c2.totalsRowFunction || c2.totalsRowLabel)) {
|
|
28718
|
-
const
|
|
28720
|
+
const first3 = columns[0];
|
|
28719
28721
|
const last = columns[columns.length - 1];
|
|
28720
|
-
if (
|
|
28722
|
+
if (first3 && columns.length > 1) first3.totalsRowLabel = "Total";
|
|
28721
28723
|
if (last) last.totalsRowFunction = "sum";
|
|
28722
28724
|
}
|
|
28723
28725
|
columns.forEach((column, i) => {
|
|
@@ -29040,25 +29042,25 @@ function removeDuplicates(ctx, s, range, columns, hasHeader) {
|
|
|
29040
29042
|
const { workbook } = ctx;
|
|
29041
29043
|
const sheet = sheetAt(workbook, s);
|
|
29042
29044
|
const r = normalizeRange(range);
|
|
29043
|
-
const
|
|
29044
|
-
if (
|
|
29045
|
-
const data = { start: { row:
|
|
29045
|
+
const first3 = hasHeader ? r.start.row + 1 : r.start.row;
|
|
29046
|
+
if (first3 > r.end.row) return { removed: 0, remaining: 0 };
|
|
29047
|
+
const data = { start: { row: first3, col: r.start.col }, end: r.end };
|
|
29046
29048
|
if (sheet.merges.some((m) => rangesIntersect(m, data)))
|
|
29047
29049
|
throw new Error("Cannot remove duplicates from a range that contains merged cells.");
|
|
29048
29050
|
const keyCols = columns.filter((c2) => c2 >= r.start.col && c2 <= r.end.col);
|
|
29049
29051
|
const cols = keyCols.length ? keyCols : Array.from({ length: r.end.col - r.start.col + 1 }, (_v, i) => r.start.col + i);
|
|
29050
|
-
let lastStored =
|
|
29052
|
+
let lastStored = first3;
|
|
29051
29053
|
for (const row2 of sheet.rows.keys()) if (row2 > lastStored) lastStored = row2;
|
|
29052
29054
|
const lastRow = Math.min(r.end.row, lastStored);
|
|
29053
29055
|
const keep2 = [];
|
|
29054
29056
|
const seen = /* @__PURE__ */ new Set();
|
|
29055
|
-
for (let row2 =
|
|
29057
|
+
for (let row2 = first3; row2 <= lastRow; row2++) {
|
|
29056
29058
|
const key2 = cols.map((col) => displayText(workbook, getCell(sheet, row2, col)).toLowerCase()).join("\0");
|
|
29057
29059
|
if (seen.has(key2)) continue;
|
|
29058
29060
|
seen.add(key2);
|
|
29059
29061
|
keep2.push(row2);
|
|
29060
29062
|
}
|
|
29061
|
-
const removed = lastRow -
|
|
29063
|
+
const removed = lastRow - first3 + 1 - keep2.length;
|
|
29062
29064
|
if (!removed) return { removed: 0, remaining: keep2.length };
|
|
29063
29065
|
ctx.run(
|
|
29064
29066
|
"Remove duplicates",
|
|
@@ -29071,11 +29073,11 @@ function removeDuplicates(ctx, s, range, columns, hasHeader) {
|
|
|
29071
29073
|
if (col >= r.start.col && col <= r.end.col) cells3.set(col, cell);
|
|
29072
29074
|
return { row: row2, cells: cells3 };
|
|
29073
29075
|
});
|
|
29074
|
-
for (let row2 =
|
|
29076
|
+
for (let row2 = first3; row2 <= lastRow; row2++)
|
|
29075
29077
|
for (const col of [...sheet.rows.get(row2)?.keys() ?? []])
|
|
29076
29078
|
if (col >= r.start.col && col <= r.end.col) deleteCell(sheet, row2, col);
|
|
29077
29079
|
moved.forEach(({ row: from, cells: cells3 }, i) => {
|
|
29078
|
-
const row2 =
|
|
29080
|
+
const row2 = first3 + i;
|
|
29079
29081
|
for (const [col, cell] of cells3) {
|
|
29080
29082
|
if (cell.formula !== void 0 && row2 !== from)
|
|
29081
29083
|
cell.formula = translateFormula(cell.formula, row2 - from, 0);
|
|
@@ -29862,9 +29864,9 @@ function merge(ctx, s, range, mode) {
|
|
|
29862
29864
|
sheet.merges = sheet.merges.filter((m) => !rangesIntersect(m, r));
|
|
29863
29865
|
for (const target of targets) {
|
|
29864
29866
|
const anchor = target.start;
|
|
29865
|
-
const [
|
|
29866
|
-
if (
|
|
29867
|
-
const source2 = getCell(sheet,
|
|
29867
|
+
const [first3] = filledCells(sheet, target);
|
|
29868
|
+
if (first3 && (first3[0] !== anchor.row || first3[1] !== anchor.col)) {
|
|
29869
|
+
const source2 = getCell(sheet, first3[0], first3[1]);
|
|
29868
29870
|
const corner2 = getCell(sheet, anchor.row, anchor.col);
|
|
29869
29871
|
if (source2) {
|
|
29870
29872
|
const moved = structuredClone(source2);
|
|
@@ -30448,10 +30450,10 @@ var LINE_HEIGHTS = [
|
|
|
30448
30450
|
[72, 93.75]
|
|
30449
30451
|
];
|
|
30450
30452
|
function lineHeightPoints(sizePt) {
|
|
30451
|
-
const
|
|
30453
|
+
const first3 = LINE_HEIGHTS[0];
|
|
30452
30454
|
const last = LINE_HEIGHTS[LINE_HEIGHTS.length - 1];
|
|
30453
30455
|
let height;
|
|
30454
|
-
if (sizePt <=
|
|
30456
|
+
if (sizePt <= first3[0]) height = first3[1] / first3[0] * sizePt;
|
|
30455
30457
|
else if (sizePt >= last[0]) height = last[1] / last[0] * sizePt;
|
|
30456
30458
|
else {
|
|
30457
30459
|
let i = 1;
|
|
@@ -31234,10 +31236,10 @@ async function createXlsx(names) {
|
|
|
31234
31236
|
const workbook = createWorkbook();
|
|
31235
31237
|
const session = createEditSession(workbook);
|
|
31236
31238
|
if (names.length) {
|
|
31237
|
-
const
|
|
31238
|
-
const problem2 = validateSheetName(workbook,
|
|
31239
|
+
const first3 = names[0];
|
|
31240
|
+
const problem2 = validateSheetName(workbook, first3, 0);
|
|
31239
31241
|
if (problem2) throw new Error(problem2);
|
|
31240
|
-
session.renameSheet(0,
|
|
31242
|
+
session.renameSheet(0, first3);
|
|
31241
31243
|
for (const name of names.slice(1)) session.addSheet(name);
|
|
31242
31244
|
}
|
|
31243
31245
|
return saveXlsx(workbook);
|
|
@@ -31858,15 +31860,15 @@ function metadataAttributes(node) {
|
|
|
31858
31860
|
// src/visio/sheet.ts
|
|
31859
31861
|
var VISIO_NS = "http://schemas.microsoft.com/office/visio/2012/main";
|
|
31860
31862
|
var VISIO_LEGACY_NS = "http://schemas.microsoft.com/office/visio/2011/1/core";
|
|
31861
|
-
var
|
|
31863
|
+
var children3 = (node, name) => node ? elements(node).filter(
|
|
31862
31864
|
(child5) => child5.localName === name && (child5.namespaceURI === VISIO_NS || child5.namespaceURI === VISIO_LEGACY_NS)
|
|
31863
31865
|
) : [];
|
|
31864
|
-
var child4 = (node, name) =>
|
|
31866
|
+
var child4 = (node, name) => children3(node, name)[0];
|
|
31865
31867
|
var attribute2 = (node, name) => node?.getAttribute(name) ?? void 0;
|
|
31866
31868
|
var yes = (value) => value === "1" || value === "true";
|
|
31867
31869
|
function readCells(node) {
|
|
31868
31870
|
return new Map(
|
|
31869
|
-
|
|
31871
|
+
children3(node, "Cell").map((cell) => {
|
|
31870
31872
|
const value = attribute2(cell, "V");
|
|
31871
31873
|
const formula = attribute2(cell, "F");
|
|
31872
31874
|
const unit = attribute2(cell, "U");
|
|
@@ -31895,11 +31897,11 @@ function readCells(node) {
|
|
|
31895
31897
|
function readSheet(node) {
|
|
31896
31898
|
if (!node) return { cells: /* @__PURE__ */ new Map(), sections: /* @__PURE__ */ new Map() };
|
|
31897
31899
|
const sections = /* @__PURE__ */ new Map();
|
|
31898
|
-
for (const section of
|
|
31900
|
+
for (const section of children3(node, "Section")) {
|
|
31899
31901
|
const name = metadata(attribute2(section, "N") ?? "", 256, "Section name");
|
|
31900
31902
|
const index2 = metadata(attribute2(section, "IX") ?? "0", 256, "Section index");
|
|
31901
31903
|
const rows = /* @__PURE__ */ new Map();
|
|
31902
|
-
for (const row2 of
|
|
31904
|
+
for (const row2 of children3(section, "Row")) {
|
|
31903
31905
|
const name2 = attribute2(row2, "N");
|
|
31904
31906
|
if (name2 !== void 0) metadata(name2, 256, "Row name");
|
|
31905
31907
|
const index3 = metadata(attribute2(row2, "IX") ?? attribute2(row2, "N") ?? "0", 256, "Row index");
|
|
@@ -31922,7 +31924,7 @@ function readSheet(node) {
|
|
|
31922
31924
|
return { cells: readCells(node), sections };
|
|
31923
31925
|
}
|
|
31924
31926
|
function readShapes(node) {
|
|
31925
|
-
return
|
|
31927
|
+
return children3(child4(node, "Shapes"), "Shape").map((shape2) => {
|
|
31926
31928
|
const text = child4(shape2, "Text");
|
|
31927
31929
|
const foreignData = child4(shape2, "ForeignData");
|
|
31928
31930
|
return {
|
|
@@ -32040,7 +32042,7 @@ async function indexedPart(pkg, source2, node, type) {
|
|
|
32040
32042
|
return rel.target;
|
|
32041
32043
|
}
|
|
32042
32044
|
function connections(root, report) {
|
|
32043
|
-
return
|
|
32045
|
+
return children3(child4(root, "Connects"), "Connect").flatMap((node) => {
|
|
32044
32046
|
const fromShapeId = attribute2(node, "FromSheet"), toShapeId = attribute2(node, "ToSheet");
|
|
32045
32047
|
if (!fromShapeId || !toShapeId) {
|
|
32046
32048
|
report("invalid-connection", "Connection without both shape IDs was omitted.");
|
|
@@ -33335,7 +33337,7 @@ function sanitize(root, limits) {
|
|
|
33335
33337
|
}
|
|
33336
33338
|
return { tag: data2.tag, attrs: attrs2, children: data2.children };
|
|
33337
33339
|
}
|
|
33338
|
-
function
|
|
33340
|
+
function children4(value, optional = false) {
|
|
33339
33341
|
if (value === void 0 && optional) return [];
|
|
33340
33342
|
if (!Array.isArray(value) || Object.getPrototypeOf(value) !== Array.prototype)
|
|
33341
33343
|
unsafe("Expected plain child array.");
|
|
@@ -33366,7 +33368,7 @@ function sanitize(root, limits) {
|
|
|
33366
33368
|
return target;
|
|
33367
33369
|
}
|
|
33368
33370
|
function leaf(data2) {
|
|
33369
|
-
if (
|
|
33371
|
+
if (children4(data2.children, true).length !== 0) unsafe("Path cannot contain child elements.");
|
|
33370
33372
|
return pathCommands(data2.attrs.d, limits, pathBudget);
|
|
33371
33373
|
}
|
|
33372
33374
|
function item(value, depth) {
|
|
@@ -33379,7 +33381,7 @@ function sanitize(root, limits) {
|
|
|
33379
33381
|
paint: paint(data2.attrs)
|
|
33380
33382
|
}) : Object.assign(target, {
|
|
33381
33383
|
kind: "group",
|
|
33382
|
-
items: Object.freeze(
|
|
33384
|
+
items: Object.freeze(children4(data2.children).map((child5) => item(child5, depth + 1)))
|
|
33383
33385
|
});
|
|
33384
33386
|
freezeLater.push(result2);
|
|
33385
33387
|
return result2;
|
|
@@ -33396,7 +33398,7 @@ function sanitize(root, limits) {
|
|
|
33396
33398
|
ids.set(id, clips.length);
|
|
33397
33399
|
const target = base(data2.attrs);
|
|
33398
33400
|
const paths = [];
|
|
33399
|
-
for (const child5 of
|
|
33401
|
+
for (const child5 of children4(data2.children)) {
|
|
33400
33402
|
const part = node(child5, depth + 1, true);
|
|
33401
33403
|
if (part.tag !== "path") unsafe("Clip content must be a path.");
|
|
33402
33404
|
const path = Object.assign(base(part.attrs), {
|
|
@@ -33421,11 +33423,11 @@ function sanitize(root, limits) {
|
|
|
33421
33423
|
if (viewBox[0] !== 0 || viewBox[1] !== 0 || viewBox[2] !== width || viewBox[3] !== height)
|
|
33422
33424
|
unsafe("Viewport differs from dimensions.");
|
|
33423
33425
|
const items = [];
|
|
33424
|
-
for (const child5 of
|
|
33426
|
+
for (const child5 of children4(data.children)) {
|
|
33425
33427
|
const peek2 = record(child5, ["tag", "attrs", "children"]);
|
|
33426
33428
|
if (peek2.tag === "defs") {
|
|
33427
33429
|
const defs = node(child5, 1);
|
|
33428
|
-
for (const value of
|
|
33430
|
+
for (const value of children4(defs.children)) definition(value, 2);
|
|
33429
33431
|
} else items.push(item(child5, 1));
|
|
33430
33432
|
}
|
|
33431
33433
|
for (const { target, id } of pending2) {
|
|
@@ -33534,7 +33536,7 @@ var VISIO_METAFILE_CONVERSION_LIMITS = Object.freeze({
|
|
|
33534
33536
|
});
|
|
33535
33537
|
var states = /* @__PURE__ */ new WeakMap();
|
|
33536
33538
|
async function inspectEmbeddedVisioMetafile(pkg, sourcePart, foreignData, report, converter) {
|
|
33537
|
-
const refs =
|
|
33539
|
+
const refs = children3(foreignData, "Rel");
|
|
33538
33540
|
const id = refs.length === 1 ? refs[0]?.getAttributeNS(NS.r, "id") : void 0;
|
|
33539
33541
|
const rel = id ? (await pkg.relationships(sourcePart)).get(id) : void 0;
|
|
33540
33542
|
if (!rel) {
|
|
@@ -33826,7 +33828,7 @@ async function readVisioImage(pkg, sourcePart, foreignData, report, options = {}
|
|
|
33826
33828
|
};
|
|
33827
33829
|
if (foreignData.getAttribute("ForeignType") && foreignData.getAttribute("ForeignType") !== "Bitmap")
|
|
33828
33830
|
return omit("unsupported-image", "Only embedded bitmap foreign data is supported.");
|
|
33829
|
-
const refs =
|
|
33831
|
+
const refs = children3(foreignData, "Rel");
|
|
33830
33832
|
const id = refs.length === 1 ? refs[0]?.getAttributeNS(NS.r, "id") : void 0;
|
|
33831
33833
|
const rel = id ? (await pkg.relationships(sourcePart)).get(id) : void 0;
|
|
33832
33834
|
if (!rel)
|
|
@@ -34667,8 +34669,8 @@ function roundedRectanglePath(points, rounding, point2) {
|
|
|
34667
34669
|
if (!points || points.length !== 5 || !Number.isFinite(rounding) || rounding <= 0)
|
|
34668
34670
|
return void 0;
|
|
34669
34671
|
if (!points.every((p) => p.every(Number.isFinite))) return void 0;
|
|
34670
|
-
const
|
|
34671
|
-
if (
|
|
34672
|
+
const first3 = points[0], last = points[4];
|
|
34673
|
+
if (first3[0] !== last[0] || first3[1] !== last[1]) return void 0;
|
|
34672
34674
|
const directions = [], lengths = [];
|
|
34673
34675
|
for (let i = 0; i < 4; i++) {
|
|
34674
34676
|
const from = points[i], to = points[i + 1];
|
|
@@ -34710,8 +34712,8 @@ function roundedRectanglePath(points, rounding, point2) {
|
|
|
34710
34712
|
function roundedOrthogonalPath(points, radius, point2) {
|
|
34711
34713
|
if (!points || points.length < 3 || !Number.isFinite(radius) || radius < 1e-9) return void 0;
|
|
34712
34714
|
if (!points.every((p) => p.every(Number.isFinite))) return void 0;
|
|
34713
|
-
const
|
|
34714
|
-
if (
|
|
34715
|
+
const first3 = points[0], last = points[points.length - 1];
|
|
34716
|
+
if (first3[0] === last[0] && first3[1] === last[1]) return void 0;
|
|
34715
34717
|
const directions = [], lengths = [];
|
|
34716
34718
|
for (let i = 1; i < points.length; i++) {
|
|
34717
34719
|
const from = points[i - 1], to = points[i];
|
|
@@ -34734,7 +34736,7 @@ function roundedOrthogonalPath(points, radius, point2) {
|
|
|
34734
34736
|
const required = (Number(corners[i]) + Number(corners[i + 1])) * radius;
|
|
34735
34737
|
if (lengths[i] < required) return void 0;
|
|
34736
34738
|
}
|
|
34737
|
-
const commands = [`M ${point2(
|
|
34739
|
+
const commands = [`M ${point2(first3[0], first3[1])}`];
|
|
34738
34740
|
let extraCommands = 0;
|
|
34739
34741
|
for (let i = 1; i < points.length - 1; i++) {
|
|
34740
34742
|
const vertex = points[i];
|
|
@@ -35994,16 +35996,16 @@ async function parseVsdx(input, options = {}) {
|
|
|
35994
35996
|
fonts: /* @__PURE__ */ new Map(),
|
|
35995
35997
|
themes: await loadVisioThemes(pkg, documentPart, report)
|
|
35996
35998
|
};
|
|
35997
|
-
for (const color2 of
|
|
35999
|
+
for (const color2 of children3(child4(documentRoot, "Colors"), "ColorEntry"))
|
|
35998
36000
|
resources.colors.set(attribute2(color2, "IX") ?? "", attribute2(color2, "RGB") ?? "");
|
|
35999
|
-
|
|
36001
|
+
children3(child4(documentRoot, "FaceNames"), "FaceName").forEach(
|
|
36000
36002
|
(font2, index2) => resources.fonts.set(
|
|
36001
36003
|
metadata(attribute2(font2, "ID") ?? String(index2), 256, "Font ID"),
|
|
36002
36004
|
metadata(attribute2(font2, "Name") ?? attribute2(font2, "NameU") ?? "Arial", 1024, "Font name")
|
|
36003
36005
|
)
|
|
36004
36006
|
);
|
|
36005
36007
|
const styles = /* @__PURE__ */ new Map();
|
|
36006
|
-
for (const style of
|
|
36008
|
+
for (const style of children3(child4(documentRoot, "StyleSheets"), "StyleSheet"))
|
|
36007
36009
|
styles.set(metadata(attribute2(style, "ID") ?? "", 256, "Style ID"), {
|
|
36008
36010
|
sheet: readSheet(style),
|
|
36009
36011
|
attributes: metadataAttributes(style)
|
|
@@ -36013,7 +36015,7 @@ async function parseVsdx(input, options = {}) {
|
|
|
36013
36015
|
const masters = /* @__PURE__ */ new Map();
|
|
36014
36016
|
const mastersPart = await related(pkg, documentPart, "masters", false);
|
|
36015
36017
|
if (mastersPart) {
|
|
36016
|
-
for (const master of
|
|
36018
|
+
for (const master of children3(await visioXml(pkg, mastersPart, "Masters"), "Master")) {
|
|
36017
36019
|
const part = await indexedPart(pkg, mastersPart, master, "master");
|
|
36018
36020
|
const id = metadata(attribute2(master, "ID") ?? "", 256, "Master ID");
|
|
36019
36021
|
if (!id || masters.has(id))
|
|
@@ -36086,7 +36088,7 @@ async function parseVsdx(input, options = {}) {
|
|
|
36086
36088
|
const pagesPart = await related(pkg, documentPart, "pages");
|
|
36087
36089
|
if (!pagesPart) throw new VisioPackageError("INVALID_DOCUMENT", "Missing Visio pages part.");
|
|
36088
36090
|
const pages = [], pageIds = /* @__PURE__ */ new Set();
|
|
36089
|
-
for (const page of
|
|
36091
|
+
for (const page of children3(await visioXml(pkg, pagesPart, "Pages"), "Page")) {
|
|
36090
36092
|
const id = metadata(attribute2(page, "ID") ?? "", 256, "Page ID");
|
|
36091
36093
|
if (!id || pageIds.has(id))
|
|
36092
36094
|
throw new VisioPackageError("INVALID_PAGE_ID", "Page IDs must be present and unique.");
|
|
@@ -36239,11 +36241,11 @@ async function openEditablePackage(bytes, limits, check3) {
|
|
|
36239
36241
|
if (!pagesPart) fail2("INVALID_DOCUMENT", "Missing pages part.");
|
|
36240
36242
|
const pages = /* @__PURE__ */ new Map();
|
|
36241
36243
|
const paths = /* @__PURE__ */ new Set();
|
|
36242
|
-
for (const page of
|
|
36244
|
+
for (const page of children3(await visioXml(pkg, pagesPart, "Pages"), "Page")) {
|
|
36243
36245
|
check3();
|
|
36244
36246
|
const id = attribute2(page, "ID");
|
|
36245
36247
|
if (!id || pages.has(id)) fail2("INVALID_PAGE_ID", "Page IDs must be present and unique.");
|
|
36246
|
-
const rels =
|
|
36248
|
+
const rels = children3(page, "Rel");
|
|
36247
36249
|
if (rels.length !== 1 || !rels[0].getAttributeNS(
|
|
36248
36250
|
"http://schemas.openxmlformats.org/officeDocument/2006/relationships",
|
|
36249
36251
|
"id"
|
|
@@ -36323,10 +36325,10 @@ function writeEditedPackage(parts, maxBytes, deadline, check3) {
|
|
|
36323
36325
|
// src/visio/edit-text.ts
|
|
36324
36326
|
function replacePlainText(root, shapeId, text, check3) {
|
|
36325
36327
|
const shapeChildren = (parent) => {
|
|
36326
|
-
const containers =
|
|
36328
|
+
const containers = children3(parent, "Shapes");
|
|
36327
36329
|
if (containers.length > 1)
|
|
36328
36330
|
fail2("INVALID_SHAPE_ID", "Duplicate Shapes containers are ambiguous.");
|
|
36329
|
-
return
|
|
36331
|
+
return children3(containers[0], "Shape");
|
|
36330
36332
|
};
|
|
36331
36333
|
const shapes = /* @__PURE__ */ new Map();
|
|
36332
36334
|
const pending2 = shapeChildren(root).map((node2) => ({
|
|
@@ -36349,13 +36351,13 @@ function replacePlainText(root, shapeId, text, check3) {
|
|
|
36349
36351
|
if (!target) fail2("EDIT_TARGET_NOT_FOUND", "Local shape does not exist.");
|
|
36350
36352
|
if (target.inherited || target.deleted)
|
|
36351
36353
|
fail2("UNSUPPORTED_TEXT_EDIT", "Master-linked or deleted shapes cannot be edited.");
|
|
36352
|
-
const texts =
|
|
36354
|
+
const texts = children3(target.node, "Text");
|
|
36353
36355
|
if (texts.length !== 1)
|
|
36354
36356
|
fail2("UNSUPPORTED_TEXT_EDIT", "Editing requires one existing local Text element.");
|
|
36355
36357
|
const node = texts[0];
|
|
36356
36358
|
if (Array.from(node.childNodes).some((item) => item.nodeType !== 3 && item.nodeType !== 4))
|
|
36357
36359
|
fail2("UNSUPPORTED_TEXT_EDIT", "Rich text, fields and unknown text markup cannot be edited.");
|
|
36358
|
-
if (
|
|
36360
|
+
if (children3(target.node, "Section").some((section) => attribute2(section, "N") === "Field"))
|
|
36359
36361
|
fail2("UNSUPPORTED_TEXT_EDIT", "Shapes with text fields cannot be edited.");
|
|
36360
36362
|
if (node.textContent === text) return false;
|
|
36361
36363
|
while (node.firstChild) node.removeChild(node.firstChild);
|
|
@@ -36998,8 +37000,8 @@ function indexCells(roots, options) {
|
|
|
36998
37000
|
fail2("EDIT_UNKNOWN_DEPENDENCY", "Page root formula has unknown dependency scope.");
|
|
36999
37001
|
const indexedNodes = /* @__PURE__ */ new Set();
|
|
37000
37002
|
const connected = /* @__PURE__ */ new Set();
|
|
37001
|
-
for (const container of
|
|
37002
|
-
for (const connection of
|
|
37003
|
+
for (const container of children3(root, "Connects"))
|
|
37004
|
+
for (const connection of children3(container, "Connect")) {
|
|
37003
37005
|
for (const attr3 of ["FromSheet", "ToSheet"]) {
|
|
37004
37006
|
const id = attribute2(connection, attr3);
|
|
37005
37007
|
if (id) connected.add(id);
|
|
@@ -37008,21 +37010,21 @@ function indexCells(roots, options) {
|
|
|
37008
37010
|
const sheets = [];
|
|
37009
37011
|
const ids = /* @__PURE__ */ new Set();
|
|
37010
37012
|
const visit2 = (parent, inherited, nested) => {
|
|
37011
|
-
for (const container of
|
|
37012
|
-
for (const node of
|
|
37013
|
+
for (const container of children3(parent, "Shapes"))
|
|
37014
|
+
for (const node of children3(container, "Shape")) {
|
|
37013
37015
|
options.check?.();
|
|
37014
37016
|
const shapeId = attribute2(node, "ID");
|
|
37015
37017
|
if (!shapeId || ids.has(shapeId)) fail2("INVALID_SHAPE_ID", "Shape IDs must be unique.");
|
|
37016
37018
|
ids.add(shapeId);
|
|
37017
|
-
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) ||
|
|
37019
|
+
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(
|
|
37018
37020
|
(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")
|
|
37019
|
-
) ||
|
|
37021
|
+
) || children3(node, "Shapes").length > 0 || ["1", "true"].includes(attribute2(node, "Del") ?? "");
|
|
37020
37022
|
sheets.push({ node, shapeId, unsafe: unsafe2 });
|
|
37021
37023
|
visit2(node, unsafe2, true);
|
|
37022
37024
|
}
|
|
37023
37025
|
};
|
|
37024
37026
|
visit2(root, false, false);
|
|
37025
|
-
for (const node of
|
|
37027
|
+
for (const node of children3(root, "PageSheet"))
|
|
37026
37028
|
sheets.push({ node, shapeId: "", unsafe: false });
|
|
37027
37029
|
for (const sheet of sheets) {
|
|
37028
37030
|
const addNode = (node, cell, relative = false, deleted = false) => {
|
|
@@ -37059,17 +37061,17 @@ function indexCells(roots, options) {
|
|
|
37059
37061
|
if (source2 === "Inh") item.unsafe = true;
|
|
37060
37062
|
add3(item);
|
|
37061
37063
|
};
|
|
37062
|
-
for (const node of
|
|
37063
|
-
for (const section of
|
|
37064
|
+
for (const node of children3(sheet.node, "Cell")) addNode(node, attribute2(node, "N") ?? "");
|
|
37065
|
+
for (const section of children3(sheet.node, "Section")) {
|
|
37064
37066
|
const name = attribute2(section, "N") ?? "";
|
|
37065
37067
|
const prefix = name === "Geometry" ? `Geometry${Number(attribute2(section, "IX") ?? "0") + 1}` : name;
|
|
37066
37068
|
const deleted = ["1", "true"].includes(attribute2(section, "Del") ?? "");
|
|
37067
|
-
for (const node of
|
|
37069
|
+
for (const node of children3(section, "Cell"))
|
|
37068
37070
|
addNode(node, `${prefix}.${attribute2(node, "N") ?? ""}`, false, deleted);
|
|
37069
|
-
for (const row2 of
|
|
37071
|
+
for (const row2 of children3(section, "Row")) {
|
|
37070
37072
|
const rowName = attribute2(row2, "N");
|
|
37071
37073
|
const ix = attribute2(row2, "IX") ?? "0";
|
|
37072
|
-
for (const node of
|
|
37074
|
+
for (const node of children3(row2, "Cell")) {
|
|
37073
37075
|
const n = attribute2(node, "N") ?? "";
|
|
37074
37076
|
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}`;
|
|
37075
37077
|
addNode(
|
|
@@ -37218,8 +37220,8 @@ function assertVisioShapeUnreferenced(roots, pageId, shapeId, options = {}) {
|
|
|
37218
37220
|
}
|
|
37219
37221
|
const root = roots.get(pageId);
|
|
37220
37222
|
if (root)
|
|
37221
|
-
for (const connections2 of
|
|
37222
|
-
for (const connection of
|
|
37223
|
+
for (const connections2 of children3(root, "Connects"))
|
|
37224
|
+
for (const connection of children3(connections2, "Connect")) {
|
|
37223
37225
|
if (["FromSheet", "ToSheet"].some((name) => attribute2(connection, name) === shapeId))
|
|
37224
37226
|
fail2("EDIT_REFERENCED_DELETE", "Shape participates in a Connect record.");
|
|
37225
37227
|
}
|
|
@@ -37261,7 +37263,7 @@ var locks = [
|
|
|
37261
37263
|
"LockAspect",
|
|
37262
37264
|
"LockDelete"
|
|
37263
37265
|
];
|
|
37264
|
-
var cells = (shape2) => new Map(
|
|
37266
|
+
var cells = (shape2) => new Map(children3(shape2, "Cell").map((node) => [attribute2(node, "N") ?? "", node]));
|
|
37265
37267
|
function numeric4(node, fallback) {
|
|
37266
37268
|
if (!node && fallback !== void 0) return fallback;
|
|
37267
37269
|
if (!node || node.hasAttribute("E"))
|
|
@@ -37305,10 +37307,10 @@ function setCell(shape2, name, value, formula) {
|
|
|
37305
37307
|
else if (attribute2(node, "F") !== "No Formula") node.removeAttribute("F");
|
|
37306
37308
|
}
|
|
37307
37309
|
function admitted(root, shapeId, masterMovePins = /* @__PURE__ */ new Set(), masterDimensions = /* @__PURE__ */ new Map()) {
|
|
37308
|
-
const containers =
|
|
37310
|
+
const containers = children3(root, "Shapes");
|
|
37309
37311
|
if (containers.length !== 1)
|
|
37310
37312
|
fail2("UNSUPPORTED_GEOMETRY_EDIT", "One local Shapes container is required.");
|
|
37311
|
-
const candidates =
|
|
37313
|
+
const candidates = children3(containers[0], "Shape").filter(
|
|
37312
37314
|
(node) => attribute2(node, "ID") === shapeId
|
|
37313
37315
|
);
|
|
37314
37316
|
if (candidates.length !== 1)
|
|
@@ -37317,7 +37319,7 @@ function admitted(root, shapeId, masterMovePins = /* @__PURE__ */ new Set(), mas
|
|
|
37317
37319
|
if ((shape2.hasAttribute("Master") || shape2.hasAttribute("MasterShape")) && !["PinX", "PinY"].every((name) => {
|
|
37318
37320
|
const cell = cells(shape2).get(name);
|
|
37319
37321
|
return cell && masterMovePins.has(cell);
|
|
37320
|
-
}) || ["1", "true"].includes(attribute2(shape2, "Del") ?? "") ||
|
|
37322
|
+
}) || ["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")
|
|
37321
37323
|
fail2(
|
|
37322
37324
|
"UNSUPPORTED_GEOMETRY_EDIT",
|
|
37323
37325
|
"Master, group, foreign, deleted and non-shape operations are unsupported."
|
|
@@ -37345,8 +37347,8 @@ function protectedShape(shape2, document, masterMovePins = /* @__PURE__ */ new S
|
|
|
37345
37347
|
return node !== void 0 && masterMovePins.has(node);
|
|
37346
37348
|
});
|
|
37347
37349
|
const styles = /* @__PURE__ */ new Map();
|
|
37348
|
-
for (const container of
|
|
37349
|
-
for (const node of
|
|
37350
|
+
for (const container of children3(document, "StyleSheets"))
|
|
37351
|
+
for (const node of children3(container, "StyleSheet")) {
|
|
37350
37352
|
const id = attribute2(node, "ID");
|
|
37351
37353
|
if (!id || styles.has(id)) fail2("EDIT_PROTECTED_CELL", "Ambiguous protection style IDs.");
|
|
37352
37354
|
styles.set(id, node);
|
|
@@ -37401,7 +37403,7 @@ function protectedShape(shape2, document, masterMovePins = /* @__PURE__ */ new S
|
|
|
37401
37403
|
}
|
|
37402
37404
|
return parent !== void 0 && parent !== id ? resolve2(parent, category, lock, seen) : void 0;
|
|
37403
37405
|
};
|
|
37404
|
-
const defaults =
|
|
37406
|
+
const defaults = children3(document, "DocumentSheet")[0];
|
|
37405
37407
|
for (const category of ["LineStyle", "FillStyle", "TextStyle"]) {
|
|
37406
37408
|
const id = attribute2(shape2, category) ?? attribute2(defaults, category) ?? (styles.has("0") ? "0" : void 0);
|
|
37407
37409
|
if (id === void 0) continue;
|
|
@@ -37430,17 +37432,17 @@ function protectedShape(shape2, document, masterMovePins = /* @__PURE__ */ new S
|
|
|
37430
37432
|
}
|
|
37431
37433
|
}
|
|
37432
37434
|
function resizeGeometry(shape2, roots, edit, check3) {
|
|
37433
|
-
const sections =
|
|
37435
|
+
const sections = children3(shape2, "Section").filter((node) => attribute2(node, "N") === "Geometry");
|
|
37434
37436
|
if (!sections.length)
|
|
37435
37437
|
fail2("UNSUPPORTED_GEOMETRY_EDIT", "Resizing requires explicit supported local geometry.");
|
|
37436
37438
|
for (const section of sections) {
|
|
37437
37439
|
if (section.hasAttribute("Del"))
|
|
37438
37440
|
fail2("UNSUPPORTED_GEOMETRY_EDIT", "Deleted geometry is unsupported.");
|
|
37439
|
-
for (const row2 of
|
|
37441
|
+
for (const row2 of children3(section, "Row")) {
|
|
37440
37442
|
const type = attribute2(row2, "T");
|
|
37441
37443
|
if (row2.hasAttribute("Del") || !["MoveTo", "LineTo", "RelMoveTo", "RelLineTo"].includes(type ?? ""))
|
|
37442
37444
|
fail2("UNSUPPORTED_GEOMETRY_EDIT", "This bundle resizes only local line-based geometry.");
|
|
37443
|
-
for (const node of
|
|
37445
|
+
for (const node of children3(row2, "Cell")) {
|
|
37444
37446
|
if (!["X", "Y"].includes(attribute2(node, "N") ?? ""))
|
|
37445
37447
|
fail2("UNSUPPORTED_GEOMETRY_EDIT", "Unknown geometry row cells are unsupported.");
|
|
37446
37448
|
if ((type ?? "").startsWith("Rel")) continue;
|
|
@@ -37504,7 +37506,7 @@ function prepareMasterMovePins(roots, commands, bindings, check3) {
|
|
|
37504
37506
|
for (const command2 of commands) {
|
|
37505
37507
|
charge();
|
|
37506
37508
|
const root = roots.get(command2.pageId);
|
|
37507
|
-
const instance =
|
|
37509
|
+
const instance = children3(children3(root, "Shapes")[0], "Shape").find(
|
|
37508
37510
|
(shape2) => attribute2(shape2, "ID") === command2.shapeId
|
|
37509
37511
|
);
|
|
37510
37512
|
if (!instance?.hasAttribute("Master")) continue;
|
|
@@ -37514,7 +37516,7 @@ function prepareMasterMovePins(roots, commands, bindings, check3) {
|
|
|
37514
37516
|
if (!binding) fail2("UNSUPPORTED_GEOMETRY_EDIT", "A unique effective master root is required.");
|
|
37515
37517
|
for (const node of [instance, binding.template]) {
|
|
37516
37518
|
charge();
|
|
37517
|
-
if (attribute2(node, "Type") !== "Shape" ||
|
|
37519
|
+
if (attribute2(node, "Type") !== "Shape" || children3(node, "Shapes").length || children3(node, "ForeignData").length || children3(node, "Rel").length || ["1", "true"].includes(attribute2(node, "Del") ?? ""))
|
|
37518
37520
|
fail2("UNSUPPORTED_GEOMETRY_EDIT", "Master moves require top-level local 2D shape roots.");
|
|
37519
37521
|
}
|
|
37520
37522
|
for (const name of ["BeginX", "BeginY", "EndX", "EndY"])
|
|
@@ -37601,13 +37603,13 @@ function prepareMasterMovePins(roots, commands, bindings, check3) {
|
|
|
37601
37603
|
function createRectangle(root, edit) {
|
|
37602
37604
|
const doc = root.ownerDocument;
|
|
37603
37605
|
const node = (name) => doc.createElementNS(root.namespaceURI, name);
|
|
37604
|
-
let container =
|
|
37605
|
-
if (
|
|
37606
|
+
let container = children3(root, "Shapes")[0];
|
|
37607
|
+
if (children3(root, "Shapes").length > 1) fail2("INVALID_SHAPE_ID", "Duplicate Shapes containers.");
|
|
37606
37608
|
const pending2 = [root];
|
|
37607
37609
|
while (pending2.length) {
|
|
37608
37610
|
const parent = pending2.pop();
|
|
37609
|
-
for (const shapes of
|
|
37610
|
-
for (const shape3 of
|
|
37611
|
+
for (const shapes of children3(parent, "Shapes"))
|
|
37612
|
+
for (const shape3 of children3(shapes, "Shape")) {
|
|
37611
37613
|
if (attribute2(shape3, "ID") === edit.shapeId)
|
|
37612
37614
|
fail2("INVALID_SHAPE_ID", "Shape ID already exists.");
|
|
37613
37615
|
pending2.push(shape3);
|
|
@@ -37615,7 +37617,7 @@ function createRectangle(root, edit) {
|
|
|
37615
37617
|
}
|
|
37616
37618
|
if (!container) {
|
|
37617
37619
|
container = node("Shapes");
|
|
37618
|
-
root.insertBefore(container,
|
|
37620
|
+
root.insertBefore(container, children3(root, "Connects")[0] ?? null);
|
|
37619
37621
|
}
|
|
37620
37622
|
const shape2 = node("Shape");
|
|
37621
37623
|
shape2.setAttribute("ID", edit.shapeId);
|
|
@@ -37680,8 +37682,8 @@ function applyGeometryEdit(roots, document, edit, check3, masterMoveProof = empt
|
|
|
37680
37682
|
);
|
|
37681
37683
|
protectedShape(shape2, document, edit.type === "move-shape" ? masterMovePins : /* @__PURE__ */ new Set());
|
|
37682
37684
|
if (edit.type !== "delete-shape") {
|
|
37683
|
-
for (const connections2 of
|
|
37684
|
-
for (const connection of
|
|
37685
|
+
for (const connections2 of children3(root, "Connects"))
|
|
37686
|
+
for (const connection of children3(connections2, "Connect"))
|
|
37685
37687
|
if (["FromSheet", "ToSheet"].some((name) => attribute2(connection, name) === edit.shapeId))
|
|
37686
37688
|
fail2(
|
|
37687
37689
|
"UNSUPPORTED_GEOMETRY_EDIT",
|
|
@@ -37842,14 +37844,14 @@ function masterCells(sheet, charge = () => {
|
|
|
37842
37844
|
fail2("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Ambiguous effective master cells.");
|
|
37843
37845
|
result2.set(id, node);
|
|
37844
37846
|
};
|
|
37845
|
-
for (const node of
|
|
37846
|
-
for (const section of
|
|
37847
|
+
for (const node of children3(sheet, "Cell")) add3(attribute2(node, "N") ?? "", node);
|
|
37848
|
+
for (const section of children3(sheet, "Section")) {
|
|
37847
37849
|
const name = attribute2(section, "N") ?? "";
|
|
37848
37850
|
const prefix = name === "Geometry" ? `Geometry${Number(attribute2(section, "IX") ?? "0") + 1}` : name === "Control" ? "Controls" : name;
|
|
37849
|
-
for (const node of
|
|
37851
|
+
for (const node of children3(section, "Cell"))
|
|
37850
37852
|
add3(`${prefix}.${attribute2(node, "N") ?? ""}`, node);
|
|
37851
|
-
for (const row2 of
|
|
37852
|
-
for (const node of
|
|
37853
|
+
for (const row2 of children3(section, "Row"))
|
|
37854
|
+
for (const node of children3(row2, "Cell")) {
|
|
37853
37855
|
const n = attribute2(node, "N") ?? "";
|
|
37854
37856
|
const rowName = attribute2(row2, "N");
|
|
37855
37857
|
const index2 = attribute2(row2, "IX") ?? (prefix === "Controls" && /^Row_\d+$/.test(rowName ?? "") ? String(Number(rowName.slice(4)) - 1) : void 0);
|
|
@@ -37869,8 +37871,8 @@ function masterShapes(root) {
|
|
|
37869
37871
|
const result2 = [], pending2 = [root];
|
|
37870
37872
|
while (pending2.length) {
|
|
37871
37873
|
const parent = pending2.pop();
|
|
37872
|
-
for (const container of
|
|
37873
|
-
for (const shape2 of
|
|
37874
|
+
for (const container of children3(parent, "Shapes"))
|
|
37875
|
+
for (const shape2 of children3(container, "Shape")) {
|
|
37874
37876
|
result2.push(shape2);
|
|
37875
37877
|
pending2.push(shape2);
|
|
37876
37878
|
}
|
|
@@ -37890,15 +37892,15 @@ function assertMasterMarkup(root, known, check3) {
|
|
|
37890
37892
|
function masterStyleCells(document, template, instance, check3, charge = () => {
|
|
37891
37893
|
}, verifyMovementProtection = false) {
|
|
37892
37894
|
const styles = /* @__PURE__ */ new Map();
|
|
37893
|
-
for (const container of
|
|
37894
|
-
for (const style of
|
|
37895
|
+
for (const container of children3(document, "StyleSheets"))
|
|
37896
|
+
for (const style of children3(container, "StyleSheet")) {
|
|
37895
37897
|
charge();
|
|
37896
37898
|
const id = attribute2(style, "ID");
|
|
37897
37899
|
if (!id || styles.has(id))
|
|
37898
37900
|
fail2("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Ambiguous master style IDs.");
|
|
37899
37901
|
styles.set(id, style);
|
|
37900
37902
|
}
|
|
37901
|
-
const defaults =
|
|
37903
|
+
const defaults = children3(document, "DocumentSheet")[0];
|
|
37902
37904
|
const collect = (id, category, seen = /* @__PURE__ */ new Set()) => {
|
|
37903
37905
|
check3();
|
|
37904
37906
|
if (seen.has(id) || seen.size >= 64)
|
|
@@ -38003,7 +38005,7 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check3) {
|
|
|
38003
38005
|
problem("Active master definitions are missing.");
|
|
38004
38006
|
}
|
|
38005
38007
|
const definitions = /* @__PURE__ */ new Map();
|
|
38006
|
-
for (const node of
|
|
38008
|
+
for (const node of children3(await visioXml(pkg, mastersPart, "Masters"), "Master")) {
|
|
38007
38009
|
const id = attribute2(node, "ID");
|
|
38008
38010
|
if (!id || definitions.has(id)) problem("Master IDs are ambiguous.");
|
|
38009
38011
|
definitions.set(id, node);
|
|
@@ -38044,7 +38046,7 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check3) {
|
|
|
38044
38046
|
);
|
|
38045
38047
|
loaded.set(masterId, root);
|
|
38046
38048
|
}
|
|
38047
|
-
const tops =
|
|
38049
|
+
const tops = children3(children3(root, "Shapes")[0], "Shape");
|
|
38048
38050
|
if (tops.length !== 1) problem("Only a uniquely rooted master can prove independence.");
|
|
38049
38051
|
const templates = masterShapes(root), context = /* @__PURE__ */ new Map();
|
|
38050
38052
|
assertMasterMarkup(
|
|
@@ -38175,7 +38177,7 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check3) {
|
|
|
38175
38177
|
} else {
|
|
38176
38178
|
const formula = executableCellFormula(attribute2(source2.node, "F"));
|
|
38177
38179
|
if (formula && !inertDoubleClickFormula(attribute2(source2.node, "N") ?? "", formula)) {
|
|
38178
|
-
const text =
|
|
38180
|
+
const text = children3(binding.instance, "Text")[0] ?? children3(binding.template, "Text")[0];
|
|
38179
38181
|
const textFieldFree = ![...binding.cells.keys()].some((key2) => /^fields?\./i.test(key2)) && (!text || !Array.from(text.getElementsByTagName("*")).some(
|
|
38180
38182
|
(node) => node.localName.toLowerCase() === "fld"
|
|
38181
38183
|
));
|
|
@@ -38236,14 +38238,14 @@ function cells2(sheet) {
|
|
|
38236
38238
|
fail2("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Ambiguous inherited style cell.");
|
|
38237
38239
|
result2.set(key2, node);
|
|
38238
38240
|
};
|
|
38239
|
-
for (const node of
|
|
38240
|
-
for (const section of
|
|
38241
|
+
for (const node of children3(sheet, "Cell")) add3(attribute2(node, "N") ?? "", node);
|
|
38242
|
+
for (const section of children3(sheet, "Section")) {
|
|
38241
38243
|
const name = attribute2(section, "N") ?? "";
|
|
38242
38244
|
const prefix = name === "Geometry" ? `Geometry${Number(attribute2(section, "IX") ?? "0") + 1}` : name;
|
|
38243
|
-
for (const node of
|
|
38245
|
+
for (const node of children3(section, "Cell"))
|
|
38244
38246
|
add3(`${prefix}.${attribute2(node, "N") ?? ""}`, node);
|
|
38245
|
-
for (const row2 of
|
|
38246
|
-
for (const node of
|
|
38247
|
+
for (const row2 of children3(section, "Row"))
|
|
38248
|
+
for (const node of children3(row2, "Cell")) {
|
|
38247
38249
|
const n = attribute2(node, "N") ?? "", ix = attribute2(row2, "IX") ?? "0", rowName = attribute2(row2, "N") ?? ix;
|
|
38248
38250
|
add3(
|
|
38249
38251
|
name === "Geometry" ? `${prefix}.${n}${ix}` : n === "Value" && ["User", "Prop"].includes(name) ? `${prefix}.${rowName}` : `${prefix}.${rowName}.${n}`,
|
|
@@ -38354,7 +38356,7 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check3, root
|
|
|
38354
38356
|
if (target?.hasAttribute("MasterShape") && !target.hasAttribute("Master"))
|
|
38355
38357
|
fail2("UNSUPPORTED_GEOMETRY_EDIT", "Editing master-linked shapes is unsupported.");
|
|
38356
38358
|
if (target?.hasAttribute("Master") && (command2.type !== "move-shape" || !["PinX", "PinY"].every(
|
|
38357
|
-
(name) =>
|
|
38359
|
+
(name) => children3(target, "Cell").some((node) => attribute2(node, "N") === name)
|
|
38358
38360
|
)))
|
|
38359
38361
|
fail2("UNSUPPORTED_GEOMETRY_EDIT", "Master moves require explicit local rotation pins.");
|
|
38360
38362
|
}
|
|
@@ -38362,15 +38364,15 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check3, root
|
|
|
38362
38364
|
}
|
|
38363
38365
|
if (!documentRoot) return movePins;
|
|
38364
38366
|
const styles = /* @__PURE__ */ new Map();
|
|
38365
|
-
for (const container of
|
|
38366
|
-
for (const style of
|
|
38367
|
+
for (const container of children3(documentRoot, "StyleSheets"))
|
|
38368
|
+
for (const style of children3(container, "StyleSheet")) {
|
|
38367
38369
|
const id = attribute2(style, "ID");
|
|
38368
38370
|
if (!id || styles.has(id))
|
|
38369
38371
|
fail2("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Style IDs must be unique.");
|
|
38370
38372
|
styles.set(id, style);
|
|
38371
38373
|
}
|
|
38372
38374
|
const styleCache2 = /* @__PURE__ */ new Map();
|
|
38373
|
-
const documentSheet =
|
|
38375
|
+
const documentSheet = children3(documentRoot, "DocumentSheet")[0];
|
|
38374
38376
|
const inherited = (id, category, seen = /* @__PURE__ */ new Set()) => {
|
|
38375
38377
|
check3();
|
|
38376
38378
|
const cacheKey = `${category}:${id}`;
|