ooxml-core 1.29.0 → 1.30.1
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/{PptxHandler-CZG6ISCZ.cjs → PptxHandler-DHQPVTUI.cjs} +3 -3
- package/dist/PptxHandler-E4DDV3FQ.mjs +4 -0
- package/dist/{PptxHandler-QIHYALOV.mjs → PptxHandler-KKLAYUGQ.mjs} +2 -2
- package/dist/{PresentationBuilder-66EU3N3O.cjs → PresentationBuilder-JORMF5CP.cjs} +5 -5
- package/dist/{PresentationBuilder-5YM2L7DA.mjs → PresentationBuilder-Q2Z33LLM.mjs} +2 -2
- package/dist/{PresentationBuilder-UAINQZA2.mjs → PresentationBuilder-YYZYCKTZ.mjs} +2 -2
- package/dist/automation/index.cjs +4250 -3145
- package/dist/automation/index.mjs +4250 -3145
- package/dist/chart/box-distribution.d.ts +10 -0
- package/dist/chart/box-distribution.d.ts.map +1 -0
- package/dist/chart/data-table-layout.d.ts +8 -0
- package/dist/chart/data-table-layout.d.ts.map +1 -0
- package/dist/chart/date-axis.d.ts +3 -0
- package/dist/chart/date-axis.d.ts.map +1 -0
- package/dist/chart/date-format.d.ts +39 -0
- package/dist/chart/date-format.d.ts.map +1 -0
- package/dist/chart/edit/chartex-action.d.ts.map +1 -1
- package/dist/chart/edit/chartex-axis.d.ts.map +1 -1
- package/dist/chart/edit/chartex-structure.d.ts.map +1 -1
- package/dist/chart/edit/chartex.d.ts +3 -1
- package/dist/chart/edit/chartex.d.ts.map +1 -1
- package/dist/chart/edit/draft.d.ts.map +1 -1
- package/dist/chart/funnel-geometry.d.ts +15 -0
- package/dist/chart/funnel-geometry.d.ts.map +1 -0
- package/dist/chart/index.cjs +1392 -404
- package/dist/chart/index.d.ts +6 -0
- package/dist/chart/index.d.ts.map +1 -1
- package/dist/chart/index.mjs +1379 -405
- package/dist/chart/line-path.d.ts +30 -0
- package/dist/chart/line-path.d.ts.map +1 -0
- package/dist/chart/manual-layout.d.ts +15 -0
- package/dist/chart/manual-layout.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-analysis.d.ts +2 -0
- package/dist/chart/render/chart-svg-analysis.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-bars.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-box.d.ts +5 -0
- package/dist/chart/render/chart-svg-box.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-cartesian.d.ts +3 -1
- package/dist/chart/render/chart-svg-cartesian.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-data-table.d.ts +11 -0
- package/dist/chart/render/chart-svg-data-table.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-date-axis.d.ts +9 -0
- package/dist/chart/render/chart-svg-date-axis.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-funnel.d.ts +4 -0
- package/dist/chart/render/chart-svg-funnel.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-labels.d.ts +16 -16
- package/dist/chart/render/chart-svg-labels.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-line.d.ts +5 -0
- package/dist/chart/render/chart-svg-line.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-plot-layout.d.ts +6 -0
- package/dist/chart/render/chart-svg-plot-layout.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-plots.d.ts +2 -1
- package/dist/chart/render/chart-svg-plots.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-radial.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-slice-labels.d.ts +18 -0
- package/dist/chart/render/chart-svg-slice-labels.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-xy.d.ts +2 -1
- package/dist/chart/render/chart-svg-xy.d.ts.map +1 -1
- package/dist/chart/render/chart-svg.d.ts.map +1 -1
- package/dist/chart/render/chart-title-text.d.ts +3 -1
- package/dist/chart/render/chart-title-text.d.ts.map +1 -1
- package/dist/chart/render/chart-view-analysis.d.ts +2 -1
- package/dist/chart/render/chart-view-analysis.d.ts.map +1 -1
- package/dist/chart/render/chart-view-data-table.d.ts +13 -0
- package/dist/chart/render/chart-view-data-table.d.ts.map +1 -0
- package/dist/chart/render/chart-view-labels.d.ts +6 -1
- package/dist/chart/render/chart-view-labels.d.ts.map +1 -1
- package/dist/chart/render/chart-view-series.d.ts.map +1 -1
- package/dist/chart/render/chart-view.d.ts +13 -0
- package/dist/chart/render/chart-view.d.ts.map +1 -1
- package/dist/chart/render/render-space.d.ts.map +1 -1
- package/dist/chart/render/summary-ex-series.d.ts +5 -0
- package/dist/chart/render/summary-ex-series.d.ts.map +1 -0
- package/dist/chart/render/summary-from-chartex.d.ts.map +1 -1
- package/dist/chart/render/summary-from-space.d.ts +1 -1
- package/dist/chart/render/summary-from-space.d.ts.map +1 -1
- package/dist/chart/render/summary-labels.d.ts.map +1 -1
- package/dist/chart/render/summary.d.ts +14 -1
- package/dist/chart/render/summary.d.ts.map +1 -1
- package/dist/{chunk-6C4NLBLB.mjs → chunk-6FXOAMNL.mjs} +1 -1
- package/dist/{chunk-T7HBA3CW.cjs → chunk-7T3SJQA6.cjs} +11 -9
- package/dist/{chunk-XROY25LN.cjs → chunk-7XYVFUB3.cjs} +4 -0
- package/dist/{chunk-I2CGNAP2.cjs → chunk-B4LXDHBX.cjs} +1409 -1389
- package/dist/{chunk-GUNTIFGT.cjs → chunk-CZXM4ZJH.cjs} +158 -26
- package/dist/{chunk-RYOJHYA3.mjs → chunk-DJ3CDTMX.mjs} +157 -27
- package/dist/{chunk-BBK3UB7M.mjs → chunk-FFJBOR2Y.mjs} +4 -4
- package/dist/{chunk-DWEQWFQU.mjs → chunk-GJDFCP2T.mjs} +248 -228
- package/dist/{chunk-KBER3RAP.mjs → chunk-KWJYMAEF.mjs} +248 -228
- package/dist/{chunk-XCRDAVFN.mjs → chunk-MKDONWNO.mjs} +237 -95
- package/dist/{chunk-3UMDVJRN.mjs → chunk-NBMXEVHL.mjs} +4 -1
- package/dist/{chunk-TVJL7QIG.cjs → chunk-OGEL4Z4S.cjs} +8 -1
- package/dist/{chunk-HRU3KOE5.mjs → chunk-OORQCSVA.mjs} +5 -3
- package/dist/{chunk-7RJYOVQU.mjs → chunk-R7NS42KQ.mjs} +5 -2
- package/dist/{chunk-DXOBT2JE.mjs → chunk-UZWV2HAJ.mjs} +8 -2
- package/dist/{chunk-PDZ4GQLI.mjs → chunk-WZJ25K7P.mjs} +1 -1
- package/dist/{chunk-IETFPVLN.cjs → chunk-XTUX5RMG.cjs} +15 -12
- package/dist/diagram/drawing.d.ts.map +1 -1
- package/dist/diagram/index.cjs +1218 -592
- package/dist/diagram/index.mjs +1218 -592
- package/dist/diagram/load.d.ts.map +1 -1
- package/dist/diagram/relationships.d.ts +1 -0
- package/dist/diagram/relationships.d.ts.map +1 -1
- package/dist/diagram/types.d.ts +2 -0
- package/dist/diagram/types.d.ts.map +1 -1
- package/dist/docx/diagram.d.ts.map +1 -1
- package/dist/docx/drawing.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +1850 -1138
- package/dist/docx/embedded.mjs +1850 -1138
- package/dist/docx/index.cjs +3312 -1713
- package/dist/docx/index.mjs +3312 -1713
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/fonts.d.ts +1 -1
- package/dist/docx/layout/fonts.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +1933 -518
- package/dist/docx/layout/index.mjs +1933 -518
- package/dist/docx/layout/script-fonts.d.ts +6 -0
- package/dist/docx/layout/script-fonts.d.ts.map +1 -0
- package/dist/docx/load/index.cjs +1853 -1141
- package/dist/docx/load/index.mjs +1853 -1141
- package/dist/docx/parse.d.ts.map +1 -1
- package/dist/docx/shape-model.d.ts +2 -0
- package/dist/docx/shape-model.d.ts.map +1 -1
- package/dist/docx/shape-parse.d.ts.map +1 -1
- package/dist/docx/shape-svg.d.ts.map +1 -1
- package/dist/docx/ui/index.cjs +1763 -593
- package/dist/docx/ui/index.mjs +1763 -593
- package/dist/docx/write-shape.d.ts.map +1 -1
- package/dist/drawingml/custom-geometry.d.ts +5 -0
- package/dist/drawingml/custom-geometry.d.ts.map +1 -0
- package/dist/drawingml/drawing-fill.d.ts.map +1 -1
- package/dist/drawingml/drawing-geometry.d.ts.map +1 -1
- package/dist/drawingml/image-content-type.d.ts +2 -0
- package/dist/drawingml/image-content-type.d.ts.map +1 -0
- package/dist/drawingml/index.cjs +1128 -179
- package/dist/drawingml/index.d.ts +9 -0
- package/dist/drawingml/index.d.ts.map +1 -1
- package/dist/drawingml/index.mjs +1110 -180
- package/dist/drawingml/path-data.d.ts +4 -0
- package/dist/drawingml/path-data.d.ts.map +1 -0
- package/dist/drawingml/picture-crop.d.ts +8 -0
- package/dist/drawingml/picture-crop.d.ts.map +1 -0
- package/dist/drawingml/picture-effects.d.ts +37 -0
- package/dist/drawingml/picture-effects.d.ts.map +1 -0
- package/dist/drawingml/picture-fill.d.ts +7 -0
- package/dist/drawingml/picture-fill.d.ts.map +1 -0
- package/dist/drawingml/read-3d-values.d.ts +8 -0
- package/dist/drawingml/read-3d-values.d.ts.map +1 -0
- package/dist/drawingml/read-text-3d.d.ts +8 -0
- package/dist/drawingml/read-text-3d.d.ts.map +1 -0
- package/dist/drawingml/read-text-body.d.ts.map +1 -1
- package/dist/drawingml/scene3d-coordinate.d.ts +45 -0
- package/dist/drawingml/scene3d-coordinate.d.ts.map +1 -0
- package/dist/drawingml/scene3d-presets.d.ts +12 -0
- package/dist/drawingml/scene3d-presets.d.ts.map +1 -0
- package/dist/drawingml/text-3d-model.d.ts +71 -0
- package/dist/drawingml/text-3d-model.d.ts.map +1 -0
- package/dist/drawingml/text-model.d.ts +3 -0
- package/dist/drawingml/text-model.d.ts.map +1 -1
- package/dist/drawingml/types.d.ts +3 -0
- package/dist/drawingml/types.d.ts.map +1 -1
- package/dist/drawingml/write-pattern-picture.d.ts.map +1 -1
- package/dist/drawingml/write-text-3d.d.ts +6 -0
- package/dist/drawingml/write-text-3d.d.ts.map +1 -0
- package/dist/drawingml/write-text-body.d.ts.map +1 -1
- package/dist/geometry/element-transform.d.ts +3 -0
- package/dist/geometry/element-transform.d.ts.map +1 -1
- package/dist/geometry/index.cjs +69 -4
- package/dist/geometry/index.d.ts +2 -0
- package/dist/geometry/index.d.ts.map +1 -1
- package/dist/geometry/index.mjs +66 -5
- package/dist/geometry/picture-crop.d.ts +21 -0
- package/dist/geometry/picture-crop.d.ts.map +1 -0
- package/dist/geometry/resize-aspect.d.ts +12 -0
- package/dist/geometry/resize-aspect.d.ts.map +1 -0
- package/dist/index.cjs +4201 -2058
- package/dist/index.mjs +4201 -2058
- package/dist/opc/index.cjs +9 -6
- package/dist/opc/index.mjs +9 -6
- package/dist/opc/safe-href.d.ts +10 -3
- package/dist/opc/safe-href.d.ts.map +1 -1
- package/dist/pptx/automation/index.cjs +634 -361
- package/dist/pptx/automation/index.d.ts +6 -6
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{elements-CCEghtE_.d.ts → elements-mSCZ84Tc.d.ts} +4 -4
- package/dist/pptx/chunks/elements-mSCZ84Tc.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-D90lhgiE.d.ts → index-BQDcu_0a.d.ts} +19 -111
- package/dist/pptx/chunks/index-BQDcu_0a.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-CmnbpSCL.d.ts → index-CBV1oHN7.d.ts} +5 -5
- package/dist/pptx/chunks/{index-CmnbpSCL.d.ts.map → index-CBV1oHN7.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-DJIPX0Ge.d.ts → index-PdM5zpmu.d.ts} +5 -5
- package/dist/pptx/chunks/{index-DJIPX0Ge.d.ts.map → index-PdM5zpmu.d.ts.map} +1 -1
- package/dist/pptx/chunks/{smart-art-BLBSej3J.d.ts → smart-art-DLumQo90.d.ts} +135 -103
- package/dist/pptx/chunks/smart-art-DLumQo90.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-D49FKllA.d.ts → text-P9xVnXXf.d.ts} +49 -60
- package/dist/pptx/chunks/text-P9xVnXXf.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-DZ1IgDJN.d.ts → text-operations-hyPODwIQ.d.ts} +4 -4
- package/dist/pptx/chunks/{text-operations-DZ1IgDJN.d.ts.map → text-operations-hyPODwIQ.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +630 -357
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.cjs +102 -67
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/collaboration-assets.cjs +15 -11
- package/dist/pptx/editor/render/collaboration-assets.d.ts +2 -2
- package/dist/pptx/editor/render/collaboration-assets.mjs +1 -1
- package/dist/pptx/editor/render/collaboration-live-patch-target.cjs +5 -5
- package/dist/pptx/editor/render/collaboration-live-patch-target.mjs +3 -3
- package/dist/pptx/editor/render/collaboration-reconcile.cjs +9 -9
- package/dist/pptx/editor/render/collaboration-reconcile.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-reconcile.mjs +3 -3
- package/dist/pptx/editor/render/collaboration-sync.cjs +29 -25
- package/dist/pptx/editor/render/collaboration-sync.d.ts +7 -0
- package/dist/pptx/editor/render/collaboration-sync.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-sync.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.cjs +14 -14
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +1 -1
- package/dist/pptx/editor/render/font-family-update.d.ts +1 -1
- package/dist/pptx/editor/render/paragraph-geometry-overrides.d.ts +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +8 -8
- package/dist/pptx/editor/render/slide-operations.mjs +2 -2
- package/dist/pptx/editor/render/table-cell-edit.cjs +8 -4
- package/dist/pptx/editor/render/table-cell-edit.d.ts +5 -0
- package/dist/pptx/editor/render/table-cell-edit.d.ts.map +1 -1
- package/dist/pptx/editor/render/table-cell-edit.mjs +1 -1
- package/dist/pptx/editor/render/table-cell-merge.cjs +3 -3
- package/dist/pptx/editor/render/table-cell-merge.mjs +1 -1
- package/dist/pptx/editor/render/table-data-grid-ops.cjs +2 -2
- package/dist/pptx/editor/render/table-data-grid-ops.mjs +1 -1
- package/dist/pptx/editor/render/table-merge.cjs +5 -5
- package/dist/pptx/editor/render/table-merge.mjs +1 -1
- package/dist/pptx/editor/render/text-content-style.d.ts +1 -1
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +2 -2
- package/dist/pptx/editor/render/text-style-scope.d.ts +2 -2
- package/dist/pptx/editor/render/update-text-segment-style.d.ts +1 -1
- package/dist/pptx/index.cjs +696 -419
- package/dist/pptx/index.d.ts +8 -8
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/dist/pptx/smartart-layouts/index.d.ts +1 -1
- package/dist/teams/index.cjs +1816 -1049
- package/dist/teams/index.mjs +1816 -1049
- package/dist/text/font-style-name.d.ts +11 -0
- package/dist/text/font-style-name.d.ts.map +1 -0
- package/dist/text/font-substitution-map.d.ts +3 -0
- package/dist/text/font-substitution-map.d.ts.map +1 -0
- package/dist/text/font-substitution.d.ts +34 -0
- package/dist/text/font-substitution.d.ts.map +1 -0
- package/dist/text/index.cjs +460 -0
- package/dist/text/index.d.ts +3 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.mjs +443 -1
- package/dist/text/metric-font-family.d.ts +7 -0
- package/dist/text/metric-font-family.d.ts.map +1 -0
- package/dist/text/panose.d.ts +55 -0
- package/dist/text/panose.d.ts.map +1 -0
- package/dist/text/script-fonts.d.ts +26 -0
- package/dist/text/script-fonts.d.ts.map +1 -0
- package/dist/visio/edit-geometry-admission.d.ts +1 -1
- package/dist/visio/edit-geometry-admission.d.ts.map +1 -1
- package/dist/visio/edit-group-resize.d.ts +26 -0
- package/dist/visio/edit-group-resize.d.ts.map +1 -0
- package/dist/visio/edit-recalculate-index.d.ts +2 -0
- package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
- package/dist/visio/edit-resize-anchor.d.ts.map +1 -1
- package/dist/visio/edit-resize-plan.d.ts +14 -0
- package/dist/visio/edit-resize-plan.d.ts.map +1 -0
- package/dist/visio/edit-scope.d.ts.map +1 -1
- package/dist/visio/index.cjs +1326 -389
- package/dist/visio/index.mjs +1326 -389
- package/dist/visio/ui/geometry-expectation.d.ts +17 -0
- package/dist/visio/ui/geometry-expectation.d.ts.map +1 -0
- package/dist/visio/ui/guides.d.ts +2 -0
- package/dist/visio/ui/guides.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +1582 -411
- package/dist/visio/ui/index.d.ts +2 -0
- package/dist/visio/ui/index.d.ts.map +1 -1
- package/dist/visio/ui/index.mjs +1579 -412
- package/dist/visio/ui/selection-resize.d.ts +19 -0
- package/dist/visio/ui/selection-resize.d.ts.map +1 -0
- package/dist/visio/ui/shape-move.d.ts +1 -1
- package/dist/visio/ui/shape-move.d.ts.map +1 -1
- package/dist/visio/ui/shape-resize.d.ts.map +1 -1
- package/dist/xlsx/edit/drawings.d.ts +5 -0
- package/dist/xlsx/edit/drawings.d.ts.map +1 -1
- package/dist/xlsx/edit/session.d.ts.map +1 -1
- package/dist/xlsx/edit/types.d.ts +4 -0
- package/dist/xlsx/edit/types.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +3908 -2256
- package/dist/xlsx/index.mjs +3908 -2256
- package/dist/xlsx/layout/chart-view.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +2003 -1239
- package/dist/xlsx/load/index.mjs +2003 -1239
- package/dist/xlsx/model.d.ts +4 -0
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/read/chart.d.ts.map +1 -1
- package/dist/xlsx/read/drawing.d.ts.map +1 -1
- package/dist/xlsx/read/smart-art.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +3880 -2228
- package/dist/xlsx/ui/index.mjs +3880 -2228
- package/dist/xlsx/write/drawing.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/PptxHandler-DSXSXMEG.mjs +0 -4
- package/dist/pptx/chunks/elements-CCEghtE_.d.ts.map +0 -1
- package/dist/pptx/chunks/index-D90lhgiE.d.ts.map +0 -1
- package/dist/pptx/chunks/smart-art-BLBSej3J.d.ts.map +0 -1
- package/dist/pptx/chunks/text-D49FKllA.d.ts.map +0 -1
package/dist/diagram/index.mjs
CHANGED
|
@@ -96,8 +96,8 @@ function toEngineTree(node) {
|
|
|
96
96
|
engine.deferred = [];
|
|
97
97
|
engine.groups = [];
|
|
98
98
|
engine.rotation = 0;
|
|
99
|
-
for (const
|
|
100
|
-
toEngineTree(
|
|
99
|
+
for (const child3 of node.children) {
|
|
100
|
+
toEngineTree(child3);
|
|
101
101
|
}
|
|
102
102
|
return engine;
|
|
103
103
|
}
|
|
@@ -140,38 +140,38 @@ function isNameChar(ch) {
|
|
|
140
140
|
function isSpace(ch) {
|
|
141
141
|
return ch === " " || ch === " " || ch === "\n" || ch === "\r";
|
|
142
142
|
}
|
|
143
|
-
function parseAttributes(
|
|
143
|
+
function parseAttributes(source2) {
|
|
144
144
|
const attrs = {};
|
|
145
145
|
let i = 0;
|
|
146
|
-
const n =
|
|
146
|
+
const n = source2.length;
|
|
147
147
|
while (i < n) {
|
|
148
|
-
while (i < n && !isNameChar(
|
|
148
|
+
while (i < n && !isNameChar(source2[i])) {
|
|
149
149
|
i++;
|
|
150
150
|
}
|
|
151
151
|
const nameStart = i;
|
|
152
|
-
while (i < n && isNameChar(
|
|
152
|
+
while (i < n && isNameChar(source2[i])) {
|
|
153
153
|
i++;
|
|
154
154
|
}
|
|
155
|
-
const name =
|
|
156
|
-
while (i < n && isSpace(
|
|
155
|
+
const name = source2.slice(nameStart, i);
|
|
156
|
+
while (i < n && isSpace(source2[i])) {
|
|
157
157
|
i++;
|
|
158
158
|
}
|
|
159
|
-
if (!name ||
|
|
159
|
+
if (!name || source2[i] !== "=") {
|
|
160
160
|
continue;
|
|
161
161
|
}
|
|
162
162
|
i++;
|
|
163
|
-
while (i < n && isSpace(
|
|
163
|
+
while (i < n && isSpace(source2[i])) {
|
|
164
164
|
i++;
|
|
165
165
|
}
|
|
166
|
-
const quote =
|
|
166
|
+
const quote = source2[i];
|
|
167
167
|
if (quote !== '"' && quote !== "'") {
|
|
168
168
|
continue;
|
|
169
169
|
}
|
|
170
|
-
const close =
|
|
170
|
+
const close = source2.indexOf(quote, i + 1);
|
|
171
171
|
if (close < 0) {
|
|
172
172
|
break;
|
|
173
173
|
}
|
|
174
|
-
const value =
|
|
174
|
+
const value = source2.slice(i + 1, close);
|
|
175
175
|
i = close + 1;
|
|
176
176
|
if (name === "xmlns" || name.startsWith("xmlns:")) {
|
|
177
177
|
continue;
|
|
@@ -257,11 +257,11 @@ function findOrderedDescendant(element2, name) {
|
|
|
257
257
|
if (!element2) {
|
|
258
258
|
return void 0;
|
|
259
259
|
}
|
|
260
|
-
for (const
|
|
261
|
-
if (
|
|
262
|
-
return
|
|
260
|
+
for (const child3 of element2.children) {
|
|
261
|
+
if (child3.name === name) {
|
|
262
|
+
return child3;
|
|
263
263
|
}
|
|
264
|
-
const nested = findOrderedDescendant(
|
|
264
|
+
const nested = findOrderedDescendant(child3, name);
|
|
265
265
|
if (nested) {
|
|
266
266
|
return nested;
|
|
267
267
|
}
|
|
@@ -316,16 +316,16 @@ function parseIterator(attrs) {
|
|
|
316
316
|
}
|
|
317
317
|
function parseAlgorithm(element2) {
|
|
318
318
|
const params = {};
|
|
319
|
-
for (const
|
|
320
|
-
if (
|
|
321
|
-
params[
|
|
319
|
+
for (const child3 of element2.children) {
|
|
320
|
+
if (child3.name === "param" && child3.attrs.type) {
|
|
321
|
+
params[child3.attrs.type] = child3.attrs.val ?? "";
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
324
|
return { type: element2.attrs.type ?? "sp", params };
|
|
325
325
|
}
|
|
326
326
|
function parseShape(element2) {
|
|
327
327
|
const adj = {};
|
|
328
|
-
const adjList = element2.children.find((
|
|
328
|
+
const adjList = element2.children.find((child3) => child3.name === "adjLst");
|
|
329
329
|
for (const entry of adjList?.children ?? []) {
|
|
330
330
|
if (entry.name === "adj") {
|
|
331
331
|
adj[Number(entry.attrs.idx)] = Number(entry.attrs.val);
|
|
@@ -381,8 +381,8 @@ function parseCondition(attrs) {
|
|
|
381
381
|
}
|
|
382
382
|
function parseBody(element2, state) {
|
|
383
383
|
const body = [];
|
|
384
|
-
for (const
|
|
385
|
-
const statement = parseStatement(
|
|
384
|
+
for (const child3 of element2.children) {
|
|
385
|
+
const statement = parseStatement(child3, state);
|
|
386
386
|
if (statement) {
|
|
387
387
|
body.push(statement);
|
|
388
388
|
}
|
|
@@ -400,9 +400,9 @@ function parseLayoutNode(element2, state) {
|
|
|
400
400
|
};
|
|
401
401
|
}
|
|
402
402
|
function parseChoose(element2, state) {
|
|
403
|
-
const branches = element2.children.filter((
|
|
404
|
-
condition:
|
|
405
|
-
body: parseBody(
|
|
403
|
+
const branches = element2.children.filter((child3) => child3.name === "if" || child3.name === "else").map((child3) => ({
|
|
404
|
+
condition: child3.name === "if" ? parseCondition(child3.attrs) : void 0,
|
|
405
|
+
body: parseBody(child3, state)
|
|
406
406
|
}));
|
|
407
407
|
return { kind: "choose", branches };
|
|
408
408
|
}
|
|
@@ -455,7 +455,7 @@ function parseStatement(element2, state) {
|
|
|
455
455
|
function parseLayoutDefinitionXml(xml) {
|
|
456
456
|
const document = parseOrderedXml(xml);
|
|
457
457
|
const layoutDef = document?.name === "layoutDef" ? document : findOrderedDescendant(document, "layoutDef");
|
|
458
|
-
const rootElement = layoutDef?.children.find((
|
|
458
|
+
const rootElement = layoutDef?.children.find((child3) => child3.name === "layoutNode");
|
|
459
459
|
if (!layoutDef || !rootElement) {
|
|
460
460
|
return void 0;
|
|
461
461
|
}
|
|
@@ -469,9 +469,9 @@ function parseLayoutDefinitionXml(xml) {
|
|
|
469
469
|
|
|
470
470
|
// diagram/engine/axis.ts
|
|
471
471
|
function descendants(point, out) {
|
|
472
|
-
for (const
|
|
473
|
-
out.push(
|
|
474
|
-
descendants(
|
|
472
|
+
for (const child3 of point.children) {
|
|
473
|
+
out.push(child3);
|
|
474
|
+
descendants(child3, out);
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
477
|
function rootOf(point) {
|
|
@@ -800,11 +800,11 @@ function relatedNodes(node, relation2, name, ptType) {
|
|
|
800
800
|
}
|
|
801
801
|
const out = [];
|
|
802
802
|
const visit = (current) => {
|
|
803
|
-
for (const
|
|
804
|
-
if (matches(
|
|
805
|
-
out.push(
|
|
803
|
+
for (const child3 of current.children) {
|
|
804
|
+
if (matches(child3)) {
|
|
805
|
+
out.push(child3);
|
|
806
806
|
}
|
|
807
|
-
visit(
|
|
807
|
+
visit(child3);
|
|
808
808
|
}
|
|
809
809
|
};
|
|
810
810
|
visit(node);
|
|
@@ -956,12 +956,12 @@ function parseFormula(fmla) {
|
|
|
956
956
|
const args = parts.slice(1);
|
|
957
957
|
return { op, args };
|
|
958
958
|
}
|
|
959
|
-
function resolveOperand(
|
|
960
|
-
const num2 = Number(
|
|
959
|
+
function resolveOperand(token2, variables) {
|
|
960
|
+
const num2 = Number(token2);
|
|
961
961
|
if (Number.isFinite(num2)) {
|
|
962
962
|
return num2;
|
|
963
963
|
}
|
|
964
|
-
const value = variables.get(
|
|
964
|
+
const value = variables.get(token2);
|
|
965
965
|
if (value !== void 0) {
|
|
966
966
|
return value;
|
|
967
967
|
}
|
|
@@ -10165,9 +10165,9 @@ function lookupPresetTextRectOverride(name) {
|
|
|
10165
10165
|
const normalized = normalizeStShapeType(name);
|
|
10166
10166
|
return normalized ? PRESET_TEXT_RECT_OVERRIDES[normalized] : void 0;
|
|
10167
10167
|
}
|
|
10168
|
-
function resolveRectToken(
|
|
10169
|
-
const literal2 = Number(
|
|
10170
|
-
return Number.isFinite(literal2) ? literal2 : resolveOperand(
|
|
10168
|
+
function resolveRectToken(token2, vars) {
|
|
10169
|
+
const literal2 = Number(token2);
|
|
10170
|
+
return Number.isFinite(literal2) ? literal2 : resolveOperand(token2, vars);
|
|
10171
10171
|
}
|
|
10172
10172
|
function getPresetTextRect(prst, width, height, adjustments) {
|
|
10173
10173
|
const def = lookupPresetTextRectOverride(prst);
|
|
@@ -10199,8 +10199,8 @@ function getPresetTextRect(prst, width, height, adjustments) {
|
|
|
10199
10199
|
}
|
|
10200
10200
|
|
|
10201
10201
|
// geometry/preset-shape-evaluator.ts
|
|
10202
|
-
function resolveToken(
|
|
10203
|
-
const trimmed =
|
|
10202
|
+
function resolveToken(token2, vars) {
|
|
10203
|
+
const trimmed = token2.trim();
|
|
10204
10204
|
if (trimmed === "") {
|
|
10205
10205
|
return 0;
|
|
10206
10206
|
}
|
|
@@ -10340,11 +10340,11 @@ function evaluatePresetShape(name, width, height, adjustments) {
|
|
|
10340
10340
|
adjustments
|
|
10341
10341
|
);
|
|
10342
10342
|
if (!textRect && def.rect) {
|
|
10343
|
-
const resolveRectToken2 = (
|
|
10344
|
-
if (
|
|
10345
|
-
return evaluateFormula(parseFormula(
|
|
10343
|
+
const resolveRectToken2 = (token2) => {
|
|
10344
|
+
if (token2.includes(" ")) {
|
|
10345
|
+
return evaluateFormula(parseFormula(token2), vars);
|
|
10346
10346
|
}
|
|
10347
|
-
return resolveToken(
|
|
10347
|
+
return resolveToken(token2, vars);
|
|
10348
10348
|
};
|
|
10349
10349
|
textRect = {
|
|
10350
10350
|
l: resolveRectToken2(def.rect.l),
|
|
@@ -10485,12 +10485,12 @@ var TABLE = {
|
|
|
10485
10485
|
var KERNING_MIN_SIZE_PX = 16;
|
|
10486
10486
|
function decodeKerningPairs(encoded) {
|
|
10487
10487
|
const out = {};
|
|
10488
|
-
for (const
|
|
10489
|
-
if (
|
|
10488
|
+
for (const token2 of encoded.split(/\s+/u)) {
|
|
10489
|
+
if (token2.length < 3) {
|
|
10490
10490
|
continue;
|
|
10491
10491
|
}
|
|
10492
|
-
const pair =
|
|
10493
|
-
const value = Number(
|
|
10492
|
+
const pair = token2.slice(0, 2);
|
|
10493
|
+
const value = Number(token2.slice(2));
|
|
10494
10494
|
if (Number.isFinite(value)) {
|
|
10495
10495
|
out[pair] = value;
|
|
10496
10496
|
}
|
|
@@ -11809,8 +11809,8 @@ function fillChildren(node) {
|
|
|
11809
11809
|
if (!box) {
|
|
11810
11810
|
return;
|
|
11811
11811
|
}
|
|
11812
|
-
for (const
|
|
11813
|
-
|
|
11812
|
+
for (const child3 of node.children) {
|
|
11813
|
+
child3.box = { ...box };
|
|
11814
11814
|
}
|
|
11815
11815
|
}
|
|
11816
11816
|
function layoutSubtree(node, registry) {
|
|
@@ -11834,11 +11834,11 @@ function layoutSubtreeOnce(node, registry) {
|
|
|
11834
11834
|
return;
|
|
11835
11835
|
}
|
|
11836
11836
|
registry.resolve(node.alg.type)(node);
|
|
11837
|
-
for (const
|
|
11838
|
-
if (!
|
|
11839
|
-
|
|
11837
|
+
for (const child3 of node.children) {
|
|
11838
|
+
if (!child3.box) {
|
|
11839
|
+
child3.box = { x: box.x, y: box.y, w: 0, h: 0 };
|
|
11840
11840
|
}
|
|
11841
|
-
layoutSubtree(
|
|
11841
|
+
layoutSubtree(child3, registry);
|
|
11842
11842
|
}
|
|
11843
11843
|
const post = registry.resolvePost?.(node.alg.type);
|
|
11844
11844
|
if (post) {
|
|
@@ -11849,8 +11849,8 @@ function connectors(node, out) {
|
|
|
11849
11849
|
if (node.alg.type === "conn") {
|
|
11850
11850
|
out.push(node);
|
|
11851
11851
|
}
|
|
11852
|
-
for (const
|
|
11853
|
-
connectors(
|
|
11852
|
+
for (const child3 of node.children) {
|
|
11853
|
+
connectors(child3, out);
|
|
11854
11854
|
}
|
|
11855
11855
|
return out;
|
|
11856
11856
|
}
|
|
@@ -11859,8 +11859,8 @@ function layoutTree(root, frame2, registry) {
|
|
|
11859
11859
|
layoutSubtree(root, registry);
|
|
11860
11860
|
for (const connector of connectors(root, [])) {
|
|
11861
11861
|
registry.resolve("conn")(connector);
|
|
11862
|
-
for (const
|
|
11863
|
-
layoutSubtree(
|
|
11862
|
+
for (const child3 of connector.children) {
|
|
11863
|
+
layoutSubtree(child3, registry);
|
|
11864
11864
|
}
|
|
11865
11865
|
}
|
|
11866
11866
|
}
|
|
@@ -12028,9 +12028,9 @@ function walk(statements, point, node, state) {
|
|
|
12028
12028
|
for (const statement of statements) {
|
|
12029
12029
|
switch (statement.kind) {
|
|
12030
12030
|
case "layoutNode": {
|
|
12031
|
-
const
|
|
12032
|
-
if (
|
|
12033
|
-
node.children.push(
|
|
12031
|
+
const child3 = buildNode(statement, point, node, state);
|
|
12032
|
+
if (child3) {
|
|
12033
|
+
node.children.push(child3);
|
|
12034
12034
|
}
|
|
12035
12035
|
break;
|
|
12036
12036
|
}
|
|
@@ -12130,15 +12130,15 @@ function isSelfSizeConstraint(node, index) {
|
|
|
12130
12130
|
const constraint = node.constraints[index];
|
|
12131
12131
|
return constraint.for === "self" && SIZE_TYPES.has(constraint.type);
|
|
12132
12132
|
}
|
|
12133
|
-
function preferredSize(
|
|
12134
|
-
applySelfSizeConstraints(
|
|
12135
|
-
const w =
|
|
12136
|
-
const h =
|
|
12137
|
-
const grown = grownSize(
|
|
12138
|
-
w: clamp(
|
|
12139
|
-
h: clamp(
|
|
12133
|
+
function preferredSize(child3, fallback) {
|
|
12134
|
+
applySelfSizeConstraints(child3);
|
|
12135
|
+
const w = child3.values.get("w");
|
|
12136
|
+
const h = child3.values.get("h");
|
|
12137
|
+
const grown = grownSize(child3, {
|
|
12138
|
+
w: clamp(child3, "w", w ?? fallback.w),
|
|
12139
|
+
h: clamp(child3, "h", h ?? fallback.h)
|
|
12140
12140
|
});
|
|
12141
|
-
return { w: clamp(
|
|
12141
|
+
return { w: clamp(child3, "w", grown.w), h: clamp(child3, "h", grown.h) };
|
|
12142
12142
|
}
|
|
12143
12143
|
function applySelfSizeConstraints(node) {
|
|
12144
12144
|
for (let i = 0; i < node.constraints.length; i++) {
|
|
@@ -12201,16 +12201,16 @@ function resolveSize(values, preferred, hasOwn, near, far, center) {
|
|
|
12201
12201
|
return preferred;
|
|
12202
12202
|
}
|
|
12203
12203
|
function compositeChildBoxes(node, box) {
|
|
12204
|
-
for (const
|
|
12205
|
-
const hasW =
|
|
12206
|
-
const hasH =
|
|
12207
|
-
const preferred = preferredSize(
|
|
12208
|
-
const values =
|
|
12204
|
+
for (const child3 of node.children) {
|
|
12205
|
+
const hasW = child3.values.has("w");
|
|
12206
|
+
const hasH = child3.values.has("h");
|
|
12207
|
+
const preferred = preferredSize(child3, { w: box.w, h: box.h });
|
|
12208
|
+
const values = child3.values;
|
|
12209
12209
|
const w = resolveSize(values, preferred.w, hasW || values.has("w"), "l", "r", "ctrX") + (values.get("wOff") ?? 0);
|
|
12210
12210
|
const h = resolveSize(values, preferred.h, hasH || values.has("h"), "t", "b", "ctrY") + (values.get("hOff") ?? 0);
|
|
12211
12211
|
const l = resolveAxis(values, w, "l", "r", "ctrX") + (values.get("lOff") ?? 0) + (values.get("ctrXOff") ?? 0);
|
|
12212
12212
|
const t = resolveAxis(values, h, "t", "b", "ctrY") + (values.get("tOff") ?? 0) + (values.get("ctrYOff") ?? 0);
|
|
12213
|
-
|
|
12213
|
+
child3.box = { x: box.x + l, y: box.y + t, w, h };
|
|
12214
12214
|
}
|
|
12215
12215
|
}
|
|
12216
12216
|
function alignStart(free, align, start, end) {
|
|
@@ -12249,7 +12249,7 @@ function arrangeComposite(node) {
|
|
|
12249
12249
|
alignChildren(node, frame2);
|
|
12250
12250
|
}
|
|
12251
12251
|
function alignChildren(node, frame2) {
|
|
12252
|
-
const boxes = node.children.map((
|
|
12252
|
+
const boxes = node.children.map((child3) => child3.box).filter((b) => Boolean(b));
|
|
12253
12253
|
if (boxes.length === 0) {
|
|
12254
12254
|
return;
|
|
12255
12255
|
}
|
|
@@ -12410,9 +12410,9 @@ function arrangeConnector(node) {
|
|
|
12410
12410
|
node.rotation = normaliseAngle(Math.atan2(dy, dx) * 180 / Math.PI);
|
|
12411
12411
|
}
|
|
12412
12412
|
}
|
|
12413
|
-
for (const
|
|
12414
|
-
|
|
12415
|
-
|
|
12413
|
+
for (const child3 of node.children) {
|
|
12414
|
+
child3.box = { ...node.box ?? box };
|
|
12415
|
+
child3.rotation = node.rotation;
|
|
12416
12416
|
}
|
|
12417
12417
|
}
|
|
12418
12418
|
function normaliseAngle(degrees) {
|
|
@@ -12426,17 +12426,17 @@ var DEFAULT_GAP_RATIO = 0.5;
|
|
|
12426
12426
|
function groupContentChildren(node) {
|
|
12427
12427
|
const groups = [];
|
|
12428
12428
|
const byPoint = /* @__PURE__ */ new Map();
|
|
12429
|
-
for (const
|
|
12430
|
-
if (
|
|
12429
|
+
for (const child3 of node.children) {
|
|
12430
|
+
if (child3.point.type !== "node" && child3.point.type !== "asst") {
|
|
12431
12431
|
continue;
|
|
12432
12432
|
}
|
|
12433
|
-
let group = byPoint.get(
|
|
12433
|
+
let group = byPoint.get(child3.point);
|
|
12434
12434
|
if (!group) {
|
|
12435
12435
|
group = [];
|
|
12436
|
-
byPoint.set(
|
|
12436
|
+
byPoint.set(child3.point, group);
|
|
12437
12437
|
groups.push(group);
|
|
12438
12438
|
}
|
|
12439
|
-
group.push(
|
|
12439
|
+
group.push(child3);
|
|
12440
12440
|
}
|
|
12441
12441
|
return groups;
|
|
12442
12442
|
}
|
|
@@ -12482,20 +12482,20 @@ function normaliseAngle2(degrees) {
|
|
|
12482
12482
|
return (degrees % 360 + 360) % 360;
|
|
12483
12483
|
}
|
|
12484
12484
|
function setRotation(group, degrees) {
|
|
12485
|
-
const
|
|
12485
|
+
const rotation2 = normaliseAngle2(degrees);
|
|
12486
12486
|
for (const item2 of group) {
|
|
12487
|
-
item2.rotation =
|
|
12487
|
+
item2.rotation = rotation2;
|
|
12488
12488
|
}
|
|
12489
12489
|
}
|
|
12490
12490
|
function placeTransitionChildren(node, centre, fallback) {
|
|
12491
|
-
for (const
|
|
12492
|
-
if (
|
|
12491
|
+
for (const child3 of node.children) {
|
|
12492
|
+
if (child3.point.type === "node" || child3.point.type === "asst") {
|
|
12493
12493
|
continue;
|
|
12494
12494
|
}
|
|
12495
|
-
const size = preferredSize(
|
|
12495
|
+
const size = preferredSize(child3, fallback);
|
|
12496
12496
|
const w = Math.max(1, size.w);
|
|
12497
12497
|
const h = Math.max(1, size.h);
|
|
12498
|
-
|
|
12498
|
+
child3.box = { x: centre.x - w / 2, y: centre.y - h / 2, w, h };
|
|
12499
12499
|
}
|
|
12500
12500
|
}
|
|
12501
12501
|
function arrangeCycle(node) {
|
|
@@ -12667,8 +12667,8 @@ function nodeSize(parts) {
|
|
|
12667
12667
|
part.box = { x: 0, y: 0, w: partW, h: partH };
|
|
12668
12668
|
evaluateWithReference(part, partW, partH);
|
|
12669
12669
|
arrangeComposite(part);
|
|
12670
|
-
for (const
|
|
12671
|
-
const b =
|
|
12670
|
+
for (const child3 of part.children) {
|
|
12671
|
+
const b = child3.box;
|
|
12672
12672
|
if (!b || !(b.w > 0) || !(b.h > 0)) {
|
|
12673
12673
|
continue;
|
|
12674
12674
|
}
|
|
@@ -12683,16 +12683,16 @@ function nodeSize(parts) {
|
|
|
12683
12683
|
|
|
12684
12684
|
// diagram/engine/hier-measure.ts
|
|
12685
12685
|
function itemsOf(node) {
|
|
12686
|
-
return node.children.filter((
|
|
12686
|
+
return node.children.filter((child3) => child3.alg.type === "hierRoot");
|
|
12687
12687
|
}
|
|
12688
12688
|
function rowsOf(root) {
|
|
12689
12689
|
return root.children.filter(
|
|
12690
|
-
(
|
|
12690
|
+
(child3) => child3.alg.type === "hierChild" && itemsOf(child3).length > 0
|
|
12691
12691
|
);
|
|
12692
12692
|
}
|
|
12693
12693
|
function partsOf(root) {
|
|
12694
12694
|
return root.children.filter(
|
|
12695
|
-
(
|
|
12695
|
+
(child3) => child3.alg.type !== "hierChild" && child3.alg.type !== "conn"
|
|
12696
12696
|
);
|
|
12697
12697
|
}
|
|
12698
12698
|
function pack(shapes, vertical, gap, end) {
|
|
@@ -12831,8 +12831,8 @@ function hasHierAncestor(node) {
|
|
|
12831
12831
|
}
|
|
12832
12832
|
function fitContainers(node) {
|
|
12833
12833
|
const boxes = [];
|
|
12834
|
-
for (const
|
|
12835
|
-
const inner = HIER_ALGS.has(
|
|
12834
|
+
for (const child3 of node.children) {
|
|
12835
|
+
const inner = HIER_ALGS.has(child3.alg.type) ? fitContainers(child3) : child3.box;
|
|
12836
12836
|
if (inner && inner.w > 0 && inner.h > 0) {
|
|
12837
12837
|
boxes.push(inner);
|
|
12838
12838
|
}
|
|
@@ -12885,9 +12885,9 @@ function measure(node, box, horizontal, scale, uniform = false) {
|
|
|
12885
12885
|
const refH = !horizontal || uniform ? box.h * scale : box.h;
|
|
12886
12886
|
evaluateWithReference(node, refW, refH);
|
|
12887
12887
|
const sizes = node.children.map(
|
|
12888
|
-
(
|
|
12889
|
-
|
|
12890
|
-
preferredSize(
|
|
12888
|
+
(child3) => boundedSize(
|
|
12889
|
+
child3,
|
|
12890
|
+
preferredSize(child3, horizontal ? { w: 0, h: refH } : { w: refW, h: 0 }),
|
|
12891
12891
|
horizontal
|
|
12892
12892
|
)
|
|
12893
12893
|
);
|
|
@@ -12900,16 +12900,16 @@ function measure(node, box, horizontal, scale, uniform = false) {
|
|
|
12900
12900
|
}
|
|
12901
12901
|
return { sizes, total, cross, spacing };
|
|
12902
12902
|
}
|
|
12903
|
-
function boundedSize(
|
|
12904
|
-
const nested =
|
|
12905
|
-
const unsizedAlong = nested && !
|
|
12906
|
-
const unsizedAcross = nested &&
|
|
12903
|
+
function boundedSize(child3, size, horizontal) {
|
|
12904
|
+
const nested = child3.children.length > 0 && (child3.alg.type === "lin" || child3.alg.type === "composite");
|
|
12905
|
+
const unsizedAlong = nested && !child3.values.has(horizontal ? "w" : "h");
|
|
12906
|
+
const unsizedAcross = nested && child3.alg.type === "lin" && !isAssigned(child3, horizontal ? "h" : "w");
|
|
12907
12907
|
if (Number.isFinite(size.w) && Number.isFinite(size.h) && !unsizedAlong && !unsizedAcross) {
|
|
12908
12908
|
return size;
|
|
12909
12909
|
}
|
|
12910
12910
|
const unsizedW = horizontal ? unsizedAlong : unsizedAcross;
|
|
12911
12911
|
const unsizedH = horizontal ? unsizedAcross : unsizedAlong;
|
|
12912
|
-
const extent = (alongW) => unsizedAlong || unsizedAcross ? measuredExtent(
|
|
12912
|
+
const extent = (alongW) => unsizedAlong || unsizedAcross ? measuredExtent(child3, size, alongW) : contentExtent(child3, alongW);
|
|
12913
12913
|
return {
|
|
12914
12914
|
w: Number.isFinite(size.w) && !unsizedW ? size.w : extent(true),
|
|
12915
12915
|
h: Number.isFinite(size.h) && !unsizedH ? size.h : extent(false)
|
|
@@ -12929,8 +12929,8 @@ function measuredExtent(node, size, horizontal) {
|
|
|
12929
12929
|
function contentExtent(node, horizontal) {
|
|
12930
12930
|
const dir = node.alg.params.linDir ?? "fromL";
|
|
12931
12931
|
const flowsHorizontally = dir === "fromL" || dir === "fromR";
|
|
12932
|
-
const sizes = node.children.map((
|
|
12933
|
-
const size = preferredSize(
|
|
12932
|
+
const sizes = node.children.map((child3) => {
|
|
12933
|
+
const size = preferredSize(child3, { w: 0, h: 0 });
|
|
12934
12934
|
const value = horizontal ? size.w : size.h;
|
|
12935
12935
|
return Number.isFinite(value) ? value : 0;
|
|
12936
12936
|
});
|
|
@@ -13041,13 +13041,13 @@ function arrangeLinear(node) {
|
|
|
13041
13041
|
const band = Math.min(across, fitted.cross);
|
|
13042
13042
|
const bandOffset = horizontal ? alignOffset(across - band, params.vertAlign, "t", "b") : alignOffset(across - band, params.horzAlign, "l", "r");
|
|
13043
13043
|
let cursor = groupOffset;
|
|
13044
|
-
node.children.forEach((
|
|
13044
|
+
node.children.forEach((child3, index) => {
|
|
13045
13045
|
const size = fitted.sizes[index];
|
|
13046
13046
|
const length = horizontal ? size.w : size.h;
|
|
13047
13047
|
const thickness = horizontal ? size.h : size.w;
|
|
13048
13048
|
const crossOffset = bandOffset + (horizontal ? alignOffset(band - thickness, params.nodeVertAlign, "t", "b") : alignOffset(band - thickness, params.nodeHorzAlign, "l", "r"));
|
|
13049
13049
|
const start = reverse ? along - cursor - length : cursor;
|
|
13050
|
-
|
|
13050
|
+
child3.box = horizontal ? { x: box.x + start, y: box.y + crossOffset, w: size.w, h: size.h } : { x: box.x + crossOffset, y: box.y + start, w: size.w, h: size.h };
|
|
13051
13051
|
cursor += length + fitted.spacing;
|
|
13052
13052
|
});
|
|
13053
13053
|
}
|
|
@@ -13055,15 +13055,15 @@ function arrangeLinear(node) {
|
|
|
13055
13055
|
// diagram/engine/alg-pyra.ts
|
|
13056
13056
|
function contentChildren(node) {
|
|
13057
13057
|
return node.children.filter(
|
|
13058
|
-
(
|
|
13058
|
+
(child3) => child3.point.type === "node" || child3.point.type === "asst"
|
|
13059
13059
|
);
|
|
13060
13060
|
}
|
|
13061
13061
|
function findNamedDescendant(node, name) {
|
|
13062
|
-
for (const
|
|
13063
|
-
if (
|
|
13064
|
-
return
|
|
13062
|
+
for (const child3 of node.children) {
|
|
13063
|
+
if (child3.name === name) {
|
|
13064
|
+
return child3;
|
|
13065
13065
|
}
|
|
13066
|
-
const found = findNamedDescendant(
|
|
13066
|
+
const found = findNamedDescendant(child3, name);
|
|
13067
13067
|
if (found) {
|
|
13068
13068
|
return found;
|
|
13069
13069
|
}
|
|
@@ -13093,11 +13093,11 @@ function arrangePyra(node) {
|
|
|
13093
13093
|
const gap = Math.max(0, node.values.get("sibSp") ?? node.values.get("sp") ?? 0);
|
|
13094
13094
|
const bandH = Math.max(0, (box.h - gap * (n - 1)) / n);
|
|
13095
13095
|
const bandCx = box.x + box.w / 2;
|
|
13096
|
-
children2.forEach((
|
|
13096
|
+
children2.forEach((child3, i) => {
|
|
13097
13097
|
const top = box.y + i * (bandH + gap);
|
|
13098
13098
|
const effectiveI = inverted ? n - 1 - i : i;
|
|
13099
13099
|
const halfWide = box.w * (effectiveI + 1) / n / 2;
|
|
13100
|
-
|
|
13100
|
+
child3.box = { x: bandCx - halfWide, y: top, w: halfWide * 2, h: bandH };
|
|
13101
13101
|
});
|
|
13102
13102
|
}
|
|
13103
13103
|
function scaleFromAnchor(x, anchorX, scale) {
|
|
@@ -13190,8 +13190,8 @@ function contentHeight(cell, w, h) {
|
|
|
13190
13190
|
evaluateWithReference(cell, w, h);
|
|
13191
13191
|
compositeChildBoxes(cell, frame2);
|
|
13192
13192
|
let bottom = h;
|
|
13193
|
-
for (const
|
|
13194
|
-
const b =
|
|
13193
|
+
for (const child3 of cell.children) {
|
|
13194
|
+
const b = child3.box;
|
|
13195
13195
|
if (b && b.w > 0 && b.h > 0) {
|
|
13196
13196
|
bottom = Math.max(bottom, b.y + b.h);
|
|
13197
13197
|
}
|
|
@@ -13257,8 +13257,8 @@ function fitSnakeByRule(node, box, cells, spacers, row) {
|
|
|
13257
13257
|
}
|
|
13258
13258
|
|
|
13259
13259
|
// diagram/engine/alg-snake.ts
|
|
13260
|
-
function isSpacer(
|
|
13261
|
-
return
|
|
13260
|
+
function isSpacer(child3) {
|
|
13261
|
+
return child3.point.type === "sibTrans" || child3.point.type === "parTrans";
|
|
13262
13262
|
}
|
|
13263
13263
|
function cellSize(cell, box) {
|
|
13264
13264
|
const assigned = new Set(["w", "h"].filter((type) => cell.values.has(type)));
|
|
@@ -13520,14 +13520,14 @@ function shapeTransform(node) {
|
|
|
13520
13520
|
if (!box) {
|
|
13521
13521
|
return void 0;
|
|
13522
13522
|
}
|
|
13523
|
-
const
|
|
13523
|
+
const rotation2 = (((node.shape?.rot ?? 0) + node.rotation) % 360 + 360) % 360;
|
|
13524
13524
|
const quarter = Math.round((node.shape?.rot ?? 0) / 90);
|
|
13525
13525
|
if (Math.abs(quarter) % 2 === 1 && Math.abs((node.shape?.rot ?? 0) - quarter * 90) < 1e-6) {
|
|
13526
13526
|
const cx = box.x + box.w / 2;
|
|
13527
13527
|
const cy = box.y + box.h / 2;
|
|
13528
|
-
return { x: cx - box.h / 2, y: cy - box.w / 2, w: box.h, h: box.w, rotation };
|
|
13528
|
+
return { x: cx - box.h / 2, y: cy - box.w / 2, w: box.h, h: box.w, rotation: rotation2 };
|
|
13529
13529
|
}
|
|
13530
|
-
return { ...box, rotation };
|
|
13530
|
+
return { ...box, rotation: rotation2 };
|
|
13531
13531
|
}
|
|
13532
13532
|
|
|
13533
13533
|
// diagram/engine/style-label.ts
|
|
@@ -14382,12 +14382,12 @@ function groupedChildren(element2) {
|
|
|
14382
14382
|
return cached;
|
|
14383
14383
|
}
|
|
14384
14384
|
const groups = /* @__PURE__ */ new Map();
|
|
14385
|
-
for (const
|
|
14386
|
-
const group = groups.get(
|
|
14385
|
+
for (const child3 of element2.children) {
|
|
14386
|
+
const group = groups.get(child3.name);
|
|
14387
14387
|
if (group) {
|
|
14388
|
-
group.push(
|
|
14388
|
+
group.push(child3);
|
|
14389
14389
|
} else {
|
|
14390
|
-
groups.set(
|
|
14390
|
+
groups.set(child3.name, [child3]);
|
|
14391
14391
|
}
|
|
14392
14392
|
}
|
|
14393
14393
|
const result = [...groups.values()].flat();
|
|
@@ -14395,10 +14395,10 @@ function groupedChildren(element2) {
|
|
|
14395
14395
|
return result;
|
|
14396
14396
|
}
|
|
14397
14397
|
function childrenNamed(element2, name) {
|
|
14398
|
-
return element2 ? element2.children.filter((
|
|
14398
|
+
return element2 ? element2.children.filter((child3) => child3.name === name) : [];
|
|
14399
14399
|
}
|
|
14400
14400
|
function firstChildNamed(element2, name) {
|
|
14401
|
-
return element2?.children.find((
|
|
14401
|
+
return element2?.children.find((child3) => child3.name === name);
|
|
14402
14402
|
}
|
|
14403
14403
|
function algorithmParameters(alg) {
|
|
14404
14404
|
const params = [];
|
|
@@ -14900,11 +14900,11 @@ function activeBranch(choose, nodeCount, context) {
|
|
|
14900
14900
|
return choose.otherwise?.rawXml ?? void 0;
|
|
14901
14901
|
}
|
|
14902
14902
|
function nestedChooseBranch(choose, nodeCount, context) {
|
|
14903
|
-
for (const
|
|
14904
|
-
if (
|
|
14903
|
+
for (const child3 of groupedChildren(choose)) {
|
|
14904
|
+
if (child3.name !== "if") {
|
|
14905
14905
|
continue;
|
|
14906
14906
|
}
|
|
14907
|
-
const when = parseOrderedWhen(
|
|
14907
|
+
const when = parseOrderedWhen(child3);
|
|
14908
14908
|
if (!when) {
|
|
14909
14909
|
continue;
|
|
14910
14910
|
}
|
|
@@ -14913,7 +14913,7 @@ function nestedChooseBranch(choose, nodeCount, context) {
|
|
|
14913
14913
|
return void 0;
|
|
14914
14914
|
}
|
|
14915
14915
|
if (result) {
|
|
14916
|
-
return
|
|
14916
|
+
return child3;
|
|
14917
14917
|
}
|
|
14918
14918
|
}
|
|
14919
14919
|
return firstChildNamed(choose, "else");
|
|
@@ -14926,25 +14926,25 @@ function boundedCompositeAlg(raw, nodeCount, context) {
|
|
|
14926
14926
|
}
|
|
14927
14927
|
let found;
|
|
14928
14928
|
const visit = (element2) => {
|
|
14929
|
-
for (const
|
|
14929
|
+
for (const child3 of groupedChildren(element2)) {
|
|
14930
14930
|
if (found !== void 0) {
|
|
14931
14931
|
return;
|
|
14932
14932
|
}
|
|
14933
|
-
if (
|
|
14933
|
+
if (child3.name === "layoutNode") {
|
|
14934
14934
|
continue;
|
|
14935
14935
|
}
|
|
14936
|
-
if (
|
|
14937
|
-
if (
|
|
14938
|
-
found = { type: "composite", raw:
|
|
14936
|
+
if (child3.name === "alg") {
|
|
14937
|
+
if (child3.attrs["type"] === "composite") {
|
|
14938
|
+
found = { type: "composite", raw: child3 };
|
|
14939
14939
|
return;
|
|
14940
14940
|
}
|
|
14941
|
-
} else if (
|
|
14942
|
-
const winningBranch = nestedChooseBranch(
|
|
14941
|
+
} else if (child3.name === "choose") {
|
|
14942
|
+
const winningBranch = nestedChooseBranch(child3, nodeCount, context);
|
|
14943
14943
|
if (winningBranch) {
|
|
14944
14944
|
visit(winningBranch);
|
|
14945
14945
|
}
|
|
14946
14946
|
} else {
|
|
14947
|
-
visit(
|
|
14947
|
+
visit(child3);
|
|
14948
14948
|
}
|
|
14949
14949
|
}
|
|
14950
14950
|
};
|
|
@@ -14960,23 +14960,23 @@ function branchAlg(raw, nodeCount, context, allowedTypes = CHOOSE_ALG_TYPES) {
|
|
|
14960
14960
|
}
|
|
14961
14961
|
let found;
|
|
14962
14962
|
const visit = (element2) => {
|
|
14963
|
-
for (const
|
|
14963
|
+
for (const child3 of groupedChildren(element2)) {
|
|
14964
14964
|
if (found !== void 0) {
|
|
14965
14965
|
return;
|
|
14966
14966
|
}
|
|
14967
|
-
if (
|
|
14968
|
-
const type =
|
|
14967
|
+
if (child3.name === "alg") {
|
|
14968
|
+
const type = child3.attrs["type"] ?? "";
|
|
14969
14969
|
if (allowedTypes.has(type)) {
|
|
14970
|
-
found = { type, raw:
|
|
14970
|
+
found = { type, raw: child3 };
|
|
14971
14971
|
return;
|
|
14972
14972
|
}
|
|
14973
|
-
} else if (
|
|
14974
|
-
const winningBranch = nestedChooseBranch(
|
|
14973
|
+
} else if (child3.name === "choose") {
|
|
14974
|
+
const winningBranch = nestedChooseBranch(child3, nodeCount, context);
|
|
14975
14975
|
if (winningBranch) {
|
|
14976
14976
|
visit(winningBranch);
|
|
14977
14977
|
}
|
|
14978
14978
|
} else {
|
|
14979
|
-
visit(
|
|
14979
|
+
visit(child3);
|
|
14980
14980
|
}
|
|
14981
14981
|
}
|
|
14982
14982
|
};
|
|
@@ -15062,15 +15062,15 @@ function isContinuationForEach(node) {
|
|
|
15062
15062
|
}
|
|
15063
15063
|
function hasStructuralDescendant(node) {
|
|
15064
15064
|
return (node.children ?? []).some(
|
|
15065
|
-
(
|
|
15065
|
+
(child3) => STRUCTURAL_ALG_TYPES.has(child3.algorithm?.type ?? "") && !isContinuationForEach(child3) || hasStructuralDescendant(child3)
|
|
15066
15066
|
);
|
|
15067
15067
|
}
|
|
15068
15068
|
function hasRepeatedTemplateStructuralDescendant(node) {
|
|
15069
|
-
return (node.children ?? []).some((
|
|
15070
|
-
if (STRUCTURAL_ALG_TYPES.has(
|
|
15069
|
+
return (node.children ?? []).some((child3) => {
|
|
15070
|
+
if (STRUCTURAL_ALG_TYPES.has(child3.algorithm?.type ?? "") && !isContinuationForEach(child3) && child3.forEachOrigin?.axis?.includes("ch") && child3.forEachOrigin?.pointTypes?.includes("node")) {
|
|
15071
15071
|
return true;
|
|
15072
15072
|
}
|
|
15073
|
-
return hasRepeatedTemplateStructuralDescendant(
|
|
15073
|
+
return hasRepeatedTemplateStructuralDescendant(child3);
|
|
15074
15074
|
});
|
|
15075
15075
|
}
|
|
15076
15076
|
function distinctMappedSlotCount(node) {
|
|
@@ -15090,7 +15090,7 @@ function mapsSlots(node) {
|
|
|
15090
15090
|
return true;
|
|
15091
15091
|
}
|
|
15092
15092
|
return (node.children ?? []).some(
|
|
15093
|
-
(
|
|
15093
|
+
(child3) => (child3.constraints ?? []).some((constraint) => SLOT_CONSTRAINTS.has(constraint.type))
|
|
15094
15094
|
);
|
|
15095
15095
|
}
|
|
15096
15096
|
function itemTemplateNodes(node, out) {
|
|
@@ -15101,15 +15101,15 @@ function itemTemplateNodes(node, out) {
|
|
|
15101
15101
|
if (drivesPoints && item2) {
|
|
15102
15102
|
out.add(item2);
|
|
15103
15103
|
}
|
|
15104
|
-
for (const
|
|
15105
|
-
itemTemplateNodes(
|
|
15104
|
+
for (const child3 of node.children ?? []) {
|
|
15105
|
+
itemTemplateNodes(child3, out);
|
|
15106
15106
|
}
|
|
15107
15107
|
}
|
|
15108
15108
|
function isLayoutNodeOrDescendantOf(ancestor, node) {
|
|
15109
15109
|
if (ancestor === node) {
|
|
15110
15110
|
return true;
|
|
15111
15111
|
}
|
|
15112
|
-
return (ancestor.children ?? []).some((
|
|
15112
|
+
return (ancestor.children ?? []).some((child3) => isLayoutNodeOrDescendantOf(child3, node));
|
|
15113
15113
|
}
|
|
15114
15114
|
|
|
15115
15115
|
// diagram/layout/smartart-layout-interpreter-choose-depth.ts
|
|
@@ -15122,26 +15122,26 @@ var STRUCTURAL_CHOOSE_ALG_TYPES = /* @__PURE__ */ new Set([
|
|
|
15122
15122
|
"hierRoot"
|
|
15123
15123
|
]);
|
|
15124
15124
|
function findStructuralAlgDepth(element2, crossedNames, nodeCount, context) {
|
|
15125
|
-
for (const
|
|
15125
|
+
for (const child3 of groupedChildren(element2)) {
|
|
15126
15126
|
let found;
|
|
15127
|
-
if (
|
|
15128
|
-
if (STRUCTURAL_CHOOSE_ALG_TYPES.has(
|
|
15127
|
+
if (child3.name === "alg") {
|
|
15128
|
+
if (STRUCTURAL_CHOOSE_ALG_TYPES.has(child3.attrs["type"] ?? "")) {
|
|
15129
15129
|
return { depth: crossedNames.length, crossedNames: [...crossedNames] };
|
|
15130
15130
|
}
|
|
15131
|
-
} else if (
|
|
15131
|
+
} else if (child3.name === "layoutNode") {
|
|
15132
15132
|
found = findStructuralAlgDepth(
|
|
15133
|
-
|
|
15134
|
-
[...crossedNames,
|
|
15133
|
+
child3,
|
|
15134
|
+
[...crossedNames, child3.attrs["name"] ?? ""],
|
|
15135
15135
|
nodeCount,
|
|
15136
15136
|
context
|
|
15137
15137
|
);
|
|
15138
|
-
} else if (
|
|
15139
|
-
const winningBranch = nestedChooseBranch(
|
|
15138
|
+
} else if (child3.name === "choose") {
|
|
15139
|
+
const winningBranch = nestedChooseBranch(child3, nodeCount, context);
|
|
15140
15140
|
if (winningBranch) {
|
|
15141
15141
|
found = findStructuralAlgDepth(winningBranch, crossedNames, nodeCount, context);
|
|
15142
15142
|
}
|
|
15143
15143
|
} else {
|
|
15144
|
-
found = findStructuralAlgDepth(
|
|
15144
|
+
found = findStructuralAlgDepth(child3, crossedNames, nodeCount, context);
|
|
15145
15145
|
}
|
|
15146
15146
|
if (found) {
|
|
15147
15147
|
return found;
|
|
@@ -15530,8 +15530,8 @@ function buildConstraintIndex(definition, nodeCount, context) {
|
|
|
15530
15530
|
entries.set(entryKey(role, constraint.type), [entry]);
|
|
15531
15531
|
}
|
|
15532
15532
|
}
|
|
15533
|
-
for (const
|
|
15534
|
-
walk3(
|
|
15533
|
+
for (const child3 of node.children ?? []) {
|
|
15534
|
+
walk3(child3);
|
|
15535
15535
|
}
|
|
15536
15536
|
};
|
|
15537
15537
|
walk3(definition.rootNode);
|
|
@@ -15633,12 +15633,12 @@ function isMappedSlotAlternative(compositeSlot, node) {
|
|
|
15633
15633
|
// diagram/layout/smartart-layout-interpreter-hierarchy-descendant.ts
|
|
15634
15634
|
var HIERARCHY_ALG_TYPES = /* @__PURE__ */ new Set(["hierRoot", "hierChild"]);
|
|
15635
15635
|
function hasHierarchyDescendant(view, node, nodeCount, context) {
|
|
15636
|
-
return (node.children ?? []).some((
|
|
15637
|
-
const type =
|
|
15636
|
+
return (node.children ?? []).some((child3) => {
|
|
15637
|
+
const type = child3.algorithm?.type ?? chooseAlgType(view, child3, nodeCount, context);
|
|
15638
15638
|
if (type && HIERARCHY_ALG_TYPES.has(type)) {
|
|
15639
15639
|
return true;
|
|
15640
15640
|
}
|
|
15641
|
-
return hasHierarchyDescendant(view,
|
|
15641
|
+
return hasHierarchyDescendant(view, child3, nodeCount, context);
|
|
15642
15642
|
});
|
|
15643
15643
|
}
|
|
15644
15644
|
|
|
@@ -15653,7 +15653,7 @@ function resolveNonHierarchyChoose(view, node, resolvedAlg, nodeCount, whenConte
|
|
|
15653
15653
|
const withResolvedAlg = resolvedAlg ? { ...node, algorithm: resolvedAlg } : node;
|
|
15654
15654
|
const kind = type ? PRIMARY_ALG[type] : void 0;
|
|
15655
15655
|
const rawArranger = node.children?.find(
|
|
15656
|
-
(
|
|
15656
|
+
(child3) => child3.algorithm?.type === type && !isTransitionOnlyChild(child3) && !isContinuationForEach(child3)
|
|
15657
15657
|
);
|
|
15658
15658
|
const arranger = rawArranger && !hasPositionGuard(rawArranger) ? rawArranger : withResolvedAlg;
|
|
15659
15659
|
const tunnelledPastOwnSlot = tunnelsPastOwnCompositeSlot(
|
|
@@ -15678,8 +15678,8 @@ function resolveNonHierarchyChoose(view, node, resolvedAlg, nodeCount, whenConte
|
|
|
15678
15678
|
function walkWithTreeLocation(node, visit, location = { position: 1, total: 1, depth: 0 }) {
|
|
15679
15679
|
visit(node, location);
|
|
15680
15680
|
const children2 = node.children ?? [];
|
|
15681
|
-
children2.forEach((
|
|
15682
|
-
walkWithTreeLocation(
|
|
15681
|
+
children2.forEach((child3, i) => {
|
|
15682
|
+
walkWithTreeLocation(child3, visit, {
|
|
15683
15683
|
position: i + 1,
|
|
15684
15684
|
total: children2.length,
|
|
15685
15685
|
depth: location.depth + 1
|
|
@@ -15691,7 +15691,7 @@ function treeMaxDepth(node, depth = 0) {
|
|
|
15691
15691
|
if (children2.length === 0) {
|
|
15692
15692
|
return depth;
|
|
15693
15693
|
}
|
|
15694
|
-
return Math.max(...children2.map((
|
|
15694
|
+
return Math.max(...children2.map((child3) => treeMaxDepth(child3, depth + 1)));
|
|
15695
15695
|
}
|
|
15696
15696
|
|
|
15697
15697
|
// diagram/layout/smartart-layout-interpreter-flow-direction.ts
|
|
@@ -15743,7 +15743,7 @@ function discoverArrangement(view, definition, nodeCount, presLayoutVars, flatNo
|
|
|
15743
15743
|
const resolvedAlg = chooseAlgorithm(view, node, nodeCount, whenContext);
|
|
15744
15744
|
const type2 = resolvedAlg?.type;
|
|
15745
15745
|
if (type2 === "hierRoot" || type2 === "hierChild") {
|
|
15746
|
-
hierarchy = node.children?.find((
|
|
15746
|
+
hierarchy = node.children?.find((child3) => child3.algorithm?.type === type2) ?? node;
|
|
15747
15747
|
} else {
|
|
15748
15748
|
const resolution = resolveNonHierarchyChoose(
|
|
15749
15749
|
view,
|
|
@@ -15846,8 +15846,8 @@ function resolveIteratorIndices(iter, length) {
|
|
|
15846
15846
|
}
|
|
15847
15847
|
function collectFollowSibNodeCounts(node) {
|
|
15848
15848
|
const counts = [];
|
|
15849
|
-
for (const
|
|
15850
|
-
const origin =
|
|
15849
|
+
for (const child3 of node.children ?? []) {
|
|
15850
|
+
const origin = child3.forEachOrigin;
|
|
15851
15851
|
if (origin?.axis?.includes("followSib") && origin.pointTypes?.some((type) => NODE_POINT_TYPES.has(type))) {
|
|
15852
15852
|
counts.push(firstNumber(origin.count) ?? 1);
|
|
15853
15853
|
}
|
|
@@ -15982,8 +15982,8 @@ function findFontRoleNode(item2) {
|
|
|
15982
15982
|
if (isTextRole3(item2)) {
|
|
15983
15983
|
return item2;
|
|
15984
15984
|
}
|
|
15985
|
-
for (const
|
|
15986
|
-
const found = findFontRoleNode(
|
|
15985
|
+
for (const child3 of item2.children ?? []) {
|
|
15986
|
+
const found = findFontRoleNode(child3);
|
|
15987
15987
|
if (found) {
|
|
15988
15988
|
return found;
|
|
15989
15989
|
}
|
|
@@ -16361,12 +16361,12 @@ function findCompositeItemShape(item2) {
|
|
|
16361
16361
|
}
|
|
16362
16362
|
anyShape ??= node.shape;
|
|
16363
16363
|
}
|
|
16364
|
-
for (const
|
|
16365
|
-
walk3(
|
|
16364
|
+
for (const child3 of node.children ?? []) {
|
|
16365
|
+
walk3(child3);
|
|
16366
16366
|
}
|
|
16367
16367
|
};
|
|
16368
|
-
for (const
|
|
16369
|
-
walk3(
|
|
16368
|
+
for (const child3 of item2.children ?? []) {
|
|
16369
|
+
walk3(child3);
|
|
16370
16370
|
}
|
|
16371
16371
|
return textRoleShape ?? hiddenTextRoleShape ?? decorativeShape ?? anyShape;
|
|
16372
16372
|
}
|
|
@@ -16500,12 +16500,12 @@ function buildChildOrder(connections) {
|
|
|
16500
16500
|
function collectFoldedDescendants(node, renderedIds, childrenOf) {
|
|
16501
16501
|
const out = [];
|
|
16502
16502
|
const walk3 = (current) => {
|
|
16503
|
-
for (const
|
|
16504
|
-
if (renderedIds.has(
|
|
16503
|
+
for (const child3 of childrenOf.get(current.id) ?? []) {
|
|
16504
|
+
if (renderedIds.has(child3.id)) {
|
|
16505
16505
|
continue;
|
|
16506
16506
|
}
|
|
16507
|
-
out.push(
|
|
16508
|
-
walk3(
|
|
16507
|
+
out.push(child3);
|
|
16508
|
+
walk3(child3);
|
|
16509
16509
|
}
|
|
16510
16510
|
};
|
|
16511
16511
|
walk3(node);
|
|
@@ -16821,12 +16821,12 @@ function resolveRingItemNode(constraintNode, arrangerConstraints) {
|
|
|
16821
16821
|
const sibSpName = (arrangerConstraints ?? []).find(
|
|
16822
16822
|
(c) => c.type === "sibSp" && typeof c.referenceForName === "string"
|
|
16823
16823
|
)?.referenceForName;
|
|
16824
|
-
const named2 = sibSpName ? (constraintNode.children ?? []).find((
|
|
16824
|
+
const named2 = sibSpName ? (constraintNode.children ?? []).find((child3) => child3.name === sibSpName) : void 0;
|
|
16825
16825
|
if (named2?.forEachOrigin) {
|
|
16826
16826
|
return named2;
|
|
16827
16827
|
}
|
|
16828
16828
|
const children2 = constraintNode.children ?? [];
|
|
16829
|
-
const repeating = children2.find((
|
|
16829
|
+
const repeating = children2.find((child3) => child3.forEachOrigin && child3.algorithm?.type !== "conn") ?? children2.find((child3) => child3.forEachOrigin);
|
|
16830
16830
|
return repeating ?? named2 ?? itemNode(constraintNode);
|
|
16831
16831
|
}
|
|
16832
16832
|
|
|
@@ -16838,8 +16838,8 @@ function findCurveSiblingConnector(node) {
|
|
|
16838
16838
|
if (node.algorithm?.type === "conn" && node.algorithm.parameters?.some((p) => p.type === "connRout" && p.value === "curve") && node.algorithm.parameters?.some((p) => p.type === "begPts" && p.value === "ctr") && node.algorithm.parameters?.some((p) => p.type === "endPts" && p.value === "ctr")) {
|
|
16839
16839
|
return node;
|
|
16840
16840
|
}
|
|
16841
|
-
for (const
|
|
16842
|
-
const found = findCurveSiblingConnector(
|
|
16841
|
+
for (const child3 of node.children ?? []) {
|
|
16842
|
+
const found = findCurveSiblingConnector(child3);
|
|
16843
16843
|
if (found) {
|
|
16844
16844
|
return found;
|
|
16845
16845
|
}
|
|
@@ -16870,9 +16870,9 @@ function resolveCycleConstraintNode(arrangerNode) {
|
|
|
16870
16870
|
if (arrangerNode.name === "cycle") {
|
|
16871
16871
|
return arrangerNode;
|
|
16872
16872
|
}
|
|
16873
|
-
for (const
|
|
16874
|
-
if (
|
|
16875
|
-
return
|
|
16873
|
+
for (const child3 of arrangerNode.children ?? []) {
|
|
16874
|
+
if (child3.name === "cycle") {
|
|
16875
|
+
return child3;
|
|
16876
16876
|
}
|
|
16877
16877
|
}
|
|
16878
16878
|
return arrangerNode;
|
|
@@ -16954,7 +16954,7 @@ function buildCycleRingExtensions(parentCentre, parentNode, context, path) {
|
|
|
16954
16954
|
const spanRad = context.fanSpanDeg * DEG_TO_RAD2;
|
|
16955
16955
|
const nodes = [];
|
|
16956
16956
|
const connectors2 = [];
|
|
16957
|
-
children2.forEach((
|
|
16957
|
+
children2.forEach((child3, i) => {
|
|
16958
16958
|
const angle = count === 1 ? baseAngleRad : baseAngleRad - spanRad / 2 + spanRad * i / (count - 1);
|
|
16959
16959
|
const cx = parentCentre.x + Math.cos(angle) * radius;
|
|
16960
16960
|
const cy = parentCentre.y + Math.sin(angle) * radius;
|
|
@@ -16966,7 +16966,7 @@ function buildCycleRingExtensions(parentCentre, parentNode, context, path) {
|
|
|
16966
16966
|
y: cy - context.itemHeight / 2,
|
|
16967
16967
|
width: context.itemWidth,
|
|
16968
16968
|
height: context.itemHeight,
|
|
16969
|
-
node:
|
|
16969
|
+
node: child3,
|
|
16970
16970
|
index: i,
|
|
16971
16971
|
total: count,
|
|
16972
16972
|
palette: context.palette,
|
|
@@ -16983,7 +16983,7 @@ function buildCycleRingExtensions(parentCentre, parentNode, context, path) {
|
|
|
16983
16983
|
key: `${key}-conn`,
|
|
16984
16984
|
d: `M${parentCentre.x},${parentCentre.y} L${cx},${cy}`
|
|
16985
16985
|
});
|
|
16986
|
-
const nested = buildCycleRingExtensions({ x: cx, y: cy },
|
|
16986
|
+
const nested = buildCycleRingExtensions({ x: cx, y: cy }, child3, context, `${path}-${i}`);
|
|
16987
16987
|
nodes.push(...nested.nodes);
|
|
16988
16988
|
connectors2.push(...nested.connectors);
|
|
16989
16989
|
});
|
|
@@ -17514,9 +17514,9 @@ function topLevelSmartArtNodes(nodes) {
|
|
|
17514
17514
|
function smartArtDescendantsWithText(node, childrenOf) {
|
|
17515
17515
|
const out = [];
|
|
17516
17516
|
const walk3 = (current) => {
|
|
17517
|
-
for (const
|
|
17518
|
-
out.push(
|
|
17519
|
-
walk3(
|
|
17517
|
+
for (const child3 of childrenOf.get(current.id) ?? []) {
|
|
17518
|
+
out.push(child3);
|
|
17519
|
+
walk3(child3);
|
|
17520
17520
|
}
|
|
17521
17521
|
};
|
|
17522
17522
|
walk3(node);
|
|
@@ -17547,7 +17547,7 @@ function smartArtChildrenOf(nodes, connections) {
|
|
|
17547
17547
|
const childOrder = connections ? buildChildOrder(connections) : void 0;
|
|
17548
17548
|
if (childOrder) {
|
|
17549
17549
|
for (const [parentId, list2] of map) {
|
|
17550
|
-
if (list2.length > 1 && list2.some((
|
|
17550
|
+
if (list2.length > 1 && list2.some((child3) => childOrder.has(child3.id))) {
|
|
17551
17551
|
map.set(
|
|
17552
17552
|
parentId,
|
|
17553
17553
|
list2.map((node, originalIndex) => ({ node, originalIndex })).sort(
|
|
@@ -17884,13 +17884,13 @@ function compoundChildIds(role, node, childrenOf) {
|
|
|
17884
17884
|
const positions = positionRange(start, count, 1, children2.length);
|
|
17885
17885
|
const ids = [];
|
|
17886
17886
|
for (const position of positions) {
|
|
17887
|
-
const
|
|
17888
|
-
if (!
|
|
17887
|
+
const child3 = children2[position - 1];
|
|
17888
|
+
if (!child3 || child3.text.trim().length === 0) {
|
|
17889
17889
|
continue;
|
|
17890
17890
|
}
|
|
17891
17891
|
ids.push(
|
|
17892
|
-
|
|
17893
|
-
...smartArtDescendantsWithText(
|
|
17892
|
+
child3.id,
|
|
17893
|
+
...smartArtDescendantsWithText(child3, childrenOf).map((descendant) => descendant.id)
|
|
17894
17894
|
);
|
|
17895
17895
|
}
|
|
17896
17896
|
return ids;
|
|
@@ -17911,8 +17911,8 @@ function isTextRole(node) {
|
|
|
17911
17911
|
}
|
|
17912
17912
|
function hasAmbiguousTopLevelRoles(topLevelChildren) {
|
|
17913
17913
|
const textRoles = topLevelChildren.filter(isTextRole);
|
|
17914
|
-
const descendantAxisRoles = textRoles.filter((
|
|
17915
|
-
const axis =
|
|
17914
|
+
const descendantAxisRoles = textRoles.filter((child3) => {
|
|
17915
|
+
const axis = child3.presentationOf?.axis?.[0];
|
|
17916
17916
|
return axis === "ch" || axis === "des" || axis === "desOrSelf";
|
|
17917
17917
|
});
|
|
17918
17918
|
if (descendantAxisRoles.length >= 2) {
|
|
@@ -17947,7 +17947,7 @@ function contentIds(role, node, childrenOf) {
|
|
|
17947
17947
|
return [node.id];
|
|
17948
17948
|
}
|
|
17949
17949
|
if (axis === "ch") {
|
|
17950
|
-
return (childrenOf.get(node.id) ?? []).filter((
|
|
17950
|
+
return (childrenOf.get(node.id) ?? []).filter((child3) => child3.text.trim().length > 0).map((child3) => child3.id);
|
|
17951
17951
|
}
|
|
17952
17952
|
if (axis === "des") {
|
|
17953
17953
|
return descendantIds(node, childrenOf);
|
|
@@ -17976,11 +17976,11 @@ function unwrapTextRoles(node) {
|
|
|
17976
17976
|
return [];
|
|
17977
17977
|
}
|
|
17978
17978
|
const out = [];
|
|
17979
|
-
for (const
|
|
17980
|
-
if (isTextRole(
|
|
17981
|
-
out.push(
|
|
17979
|
+
for (const child3 of node.children ?? []) {
|
|
17980
|
+
if (isTextRole(child3)) {
|
|
17981
|
+
out.push(child3);
|
|
17982
17982
|
} else {
|
|
17983
|
-
out.push(...unwrapTextRoles(
|
|
17983
|
+
out.push(...unwrapTextRoles(child3));
|
|
17984
17984
|
}
|
|
17985
17985
|
}
|
|
17986
17986
|
return out;
|
|
@@ -18007,13 +18007,13 @@ function findRoleWrapper(node, roles, depth) {
|
|
|
18007
18007
|
if (depth > MAX_WRAPPER_DEPTH) {
|
|
18008
18008
|
return void 0;
|
|
18009
18009
|
}
|
|
18010
|
-
for (const
|
|
18011
|
-
if (roles.includes(
|
|
18010
|
+
for (const child3 of node.children ?? []) {
|
|
18011
|
+
if (roles.includes(child3)) {
|
|
18012
18012
|
continue;
|
|
18013
18013
|
}
|
|
18014
|
-
const unwrapped = unwrapTextRoles(
|
|
18014
|
+
const unwrapped = unwrapTextRoles(child3);
|
|
18015
18015
|
if (unwrapped.length > 0 && roles.every((role) => unwrapped.includes(role))) {
|
|
18016
|
-
return findRoleWrapper(
|
|
18016
|
+
return findRoleWrapper(child3, roles, depth + 1) ?? child3;
|
|
18017
18017
|
}
|
|
18018
18018
|
}
|
|
18019
18019
|
return void 0;
|
|
@@ -18031,7 +18031,7 @@ function isExplicitHorizontalLin(view, node, nodeCount, presLayoutVars) {
|
|
|
18031
18031
|
}
|
|
18032
18032
|
function rawShapeAttributes(branch) {
|
|
18033
18033
|
const shapeXml = branch?.children.find(
|
|
18034
|
-
(
|
|
18034
|
+
(child3) => child3.name === "shape" && (Object.keys(child3.attrs).length > 0 || child3.children.length > 0)
|
|
18035
18035
|
);
|
|
18036
18036
|
if (!shapeXml) {
|
|
18037
18037
|
return void 0;
|
|
@@ -18157,14 +18157,14 @@ function algTypeOf(view, node, nodeCount, presLayoutVars) {
|
|
|
18157
18157
|
return node.algorithm?.type ?? chooseAlgType(view, node, nodeCount, { presLayoutVars: presLayoutVars ?? {} });
|
|
18158
18158
|
}
|
|
18159
18159
|
function findRowChild(view, node, presLayoutVars) {
|
|
18160
|
-
return (node.children ?? []).find((
|
|
18161
|
-
if (
|
|
18160
|
+
return (node.children ?? []).find((child3) => {
|
|
18161
|
+
if (child3.algorithm?.type === "sp") {
|
|
18162
18162
|
return false;
|
|
18163
18163
|
}
|
|
18164
|
-
if (algTypeOf(view,
|
|
18164
|
+
if (algTypeOf(view, child3, 2, presLayoutVars) !== "lin") {
|
|
18165
18165
|
return false;
|
|
18166
18166
|
}
|
|
18167
|
-
return (
|
|
18167
|
+
return (child3.children ?? []).some(
|
|
18168
18168
|
(grandchild) => grandchild.forEachOrigin?.axis?.includes("ch") && grandchild.forEachOrigin?.pointTypes?.includes("node")
|
|
18169
18169
|
);
|
|
18170
18170
|
});
|
|
@@ -18177,7 +18177,7 @@ function isRecursiveTableItemTemplate(view, node, presLayoutVars) {
|
|
|
18177
18177
|
return false;
|
|
18178
18178
|
}
|
|
18179
18179
|
const hasLabel = (node.children ?? []).some(
|
|
18180
|
-
(
|
|
18180
|
+
(child3) => child3.algorithm?.type === "tx" && child3.presentationOf?.axis?.includes("self")
|
|
18181
18181
|
);
|
|
18182
18182
|
return hasLabel && findRowChild(view, node, presLayoutVars) !== void 0;
|
|
18183
18183
|
}
|
|
@@ -18240,8 +18240,8 @@ function arrangeRecursiveTable(view, plan, nodes, box, palette, style, elementId
|
|
|
18240
18240
|
const place = (node, x, width) => {
|
|
18241
18241
|
placed.push({ node, x, width });
|
|
18242
18242
|
const kids = childrenIn(node);
|
|
18243
|
-
for (const [
|
|
18244
|
-
place(
|
|
18243
|
+
for (const [child3, childX, childWidth] of splitAcross(kids, x, width)) {
|
|
18244
|
+
place(child3, childX, childWidth);
|
|
18245
18245
|
}
|
|
18246
18246
|
};
|
|
18247
18247
|
for (const [root, rootX, rootWidth] of splitAcross(roots, 0, w)) {
|
|
@@ -18705,12 +18705,12 @@ function winningOrdinalFor(guardsByOrdinal, nodeCount, flat) {
|
|
|
18705
18705
|
return void 0;
|
|
18706
18706
|
}
|
|
18707
18707
|
function selectFirstMatchChildren(children2, flat) {
|
|
18708
|
-
if (children2.every((
|
|
18708
|
+
if (children2.every((child3) => (child3.chooseGroups?.length ?? 0) === 0)) {
|
|
18709
18709
|
return children2;
|
|
18710
18710
|
}
|
|
18711
18711
|
const guardsByGroup = /* @__PURE__ */ new Map();
|
|
18712
|
-
for (const
|
|
18713
|
-
for (const entry of
|
|
18712
|
+
for (const child3 of children2) {
|
|
18713
|
+
for (const entry of child3.chooseGroups ?? []) {
|
|
18714
18714
|
let byOrdinal = guardsByGroup.get(entry.id);
|
|
18715
18715
|
if (!byOrdinal) {
|
|
18716
18716
|
byOrdinal = /* @__PURE__ */ new Map();
|
|
@@ -18727,7 +18727,7 @@ function selectFirstMatchChildren(children2, flat) {
|
|
|
18727
18727
|
winningOrdinal.set(groupId, winningOrdinalFor(guardsByOrdinal, nodeCount, flat));
|
|
18728
18728
|
}
|
|
18729
18729
|
return children2.filter(
|
|
18730
|
-
(
|
|
18730
|
+
(child3) => (child3.chooseGroups ?? []).every((entry) => {
|
|
18731
18731
|
const winner = winningOrdinal.get(entry.id);
|
|
18732
18732
|
return winner === void 0 || winner === entry.ordinal;
|
|
18733
18733
|
})
|
|
@@ -18801,8 +18801,8 @@ function collectRawCandidates(node, flat, declaringRole, out = [], inheritedOrig
|
|
|
18801
18801
|
const nextAncestorChain = nextRole === declaringRole ? ancestorChain : [declaringRole, ...ancestorChain];
|
|
18802
18802
|
const ownTemplateOrigin = node.algorithm?.type && STRUCTURAL_ALG_TYPES.has(node.algorithm.type) && node.forEachOrigin?.axis?.includes("ch") && node.forEachOrigin?.pointTypes?.includes("node") ? node.forEachOrigin : void 0;
|
|
18803
18803
|
const effectiveOrigin = ownTemplateOrigin ?? inheritedOrigin;
|
|
18804
|
-
for (const
|
|
18805
|
-
collectRawCandidates(
|
|
18804
|
+
for (const child3 of selectFirstMatchChildren(node.children ?? [], flat)) {
|
|
18805
|
+
collectRawCandidates(child3, flat, nextRole, out, effectiveOrigin, nextAncestorChain);
|
|
18806
18806
|
}
|
|
18807
18807
|
return out;
|
|
18808
18808
|
}
|
|
@@ -18936,9 +18936,9 @@ function isPositioned(dims) {
|
|
|
18936
18936
|
}
|
|
18937
18937
|
function readSlots(children2, box, index, declaringRole, sizeBox = box) {
|
|
18938
18938
|
const slots = [];
|
|
18939
|
-
for (const
|
|
18940
|
-
const c =
|
|
18941
|
-
const role = roleOf(
|
|
18939
|
+
for (const child3 of children2) {
|
|
18940
|
+
const c = child3.constraints;
|
|
18941
|
+
const role = roleOf(child3);
|
|
18942
18942
|
const hubSizeBox = isUserSizeHubRole(role, index) ? sizeBox : box;
|
|
18943
18943
|
const dims = {
|
|
18944
18944
|
l: dimOf(c, "l", box, index, role, declaringRole),
|
|
@@ -18949,7 +18949,7 @@ function readSlots(children2, box, index, declaringRole, sizeBox = box) {
|
|
|
18949
18949
|
ctrY: dimOf(c, "ctrY", box, index, role, declaringRole)
|
|
18950
18950
|
};
|
|
18951
18951
|
if (isPositioned(dims)) {
|
|
18952
|
-
slots.push({ node:
|
|
18952
|
+
slots.push({ node: child3, dims });
|
|
18953
18953
|
}
|
|
18954
18954
|
}
|
|
18955
18955
|
return slots;
|
|
@@ -19323,9 +19323,9 @@ function collectChildRepeaterItems(wrapper, anchorChildren) {
|
|
|
19323
19323
|
continue;
|
|
19324
19324
|
}
|
|
19325
19325
|
for (const position of spec.positions) {
|
|
19326
|
-
const
|
|
19327
|
-
if (
|
|
19328
|
-
items.push({ child:
|
|
19326
|
+
const child3 = anchorChildren[position - 1];
|
|
19327
|
+
if (child3) {
|
|
19328
|
+
items.push({ child: child3, position, fold: spec.fold });
|
|
19329
19329
|
}
|
|
19330
19330
|
}
|
|
19331
19331
|
}
|
|
@@ -19528,7 +19528,7 @@ function sameForEachRing(a, b) {
|
|
|
19528
19528
|
}
|
|
19529
19529
|
function findRingDesSibling(allChildren, selfNode) {
|
|
19530
19530
|
return allChildren.find(
|
|
19531
|
-
(
|
|
19531
|
+
(child3) => child3.presentationOf?.axis?.[0] === "des" && sameForEachRing(child3.forEachOrigin, selfNode.forEachOrigin)
|
|
19532
19532
|
);
|
|
19533
19533
|
}
|
|
19534
19534
|
function ringFoldRect(selfRect) {
|
|
@@ -19724,8 +19724,8 @@ function findNamedNode(node, name) {
|
|
|
19724
19724
|
if (node.name === name) {
|
|
19725
19725
|
return node;
|
|
19726
19726
|
}
|
|
19727
|
-
for (const
|
|
19728
|
-
const found = findNamedNode(
|
|
19727
|
+
for (const child3 of node.children ?? []) {
|
|
19728
|
+
const found = findNamedNode(child3, name);
|
|
19729
19729
|
if (found) {
|
|
19730
19730
|
return found;
|
|
19731
19731
|
}
|
|
@@ -19922,8 +19922,8 @@ function collectTxShapeNodes(node, out, seen) {
|
|
|
19922
19922
|
out.push(node);
|
|
19923
19923
|
}
|
|
19924
19924
|
}
|
|
19925
|
-
for (const
|
|
19926
|
-
collectTxShapeNodes(
|
|
19925
|
+
for (const child3 of node.children ?? []) {
|
|
19926
|
+
collectTxShapeNodes(child3, out, seen);
|
|
19927
19927
|
}
|
|
19928
19928
|
}
|
|
19929
19929
|
function crossReferencesAnotherCandidate(candidate, otherNames, constraints) {
|
|
@@ -20113,8 +20113,8 @@ function findNestedChildAlgorithm(view, algorithmNode, nodeCount, presLayoutVars
|
|
|
20113
20113
|
if (!root) {
|
|
20114
20114
|
return void 0;
|
|
20115
20115
|
}
|
|
20116
|
-
for (const
|
|
20117
|
-
const found = findFirst(view,
|
|
20116
|
+
for (const child3 of root.node.children ?? []) {
|
|
20117
|
+
const found = findFirst(view, child3, "hierChild", nodeCount, presLayoutVars, /* @__PURE__ */ new Set());
|
|
20118
20118
|
if (found) {
|
|
20119
20119
|
return found;
|
|
20120
20120
|
}
|
|
@@ -20151,8 +20151,8 @@ function findFirst(view, node, type, nodeCount, presLayoutVars, visited) {
|
|
|
20151
20151
|
if (algorithm?.type === type) {
|
|
20152
20152
|
return { node, algorithm };
|
|
20153
20153
|
}
|
|
20154
|
-
for (const
|
|
20155
|
-
const found = findFirst(view,
|
|
20154
|
+
for (const child3 of node.children ?? []) {
|
|
20155
|
+
const found = findFirst(view, child3, type, nodeCount, presLayoutVars, visited);
|
|
20156
20156
|
if (found) {
|
|
20157
20157
|
return found;
|
|
20158
20158
|
}
|
|
@@ -20171,8 +20171,8 @@ function collectScoped(view, node, crossedHierChild, out, nodeCount, presLayoutV
|
|
|
20171
20171
|
out.push({ node, descendantScope: crossedHierChild });
|
|
20172
20172
|
}
|
|
20173
20173
|
const nextCrossed = crossedHierChild || node.algorithm?.type === "hierChild";
|
|
20174
|
-
for (const
|
|
20175
|
-
collectScoped(view,
|
|
20174
|
+
for (const child3 of node.children ?? []) {
|
|
20175
|
+
collectScoped(view, child3, nextCrossed, out, nodeCount, presLayoutVars);
|
|
20176
20176
|
}
|
|
20177
20177
|
}
|
|
20178
20178
|
function resolvedSize(index, name) {
|
|
@@ -20189,8 +20189,8 @@ function resolveHierarchyGenerationTemplates(view, algorithmNode, index, nodeCou
|
|
|
20189
20189
|
}
|
|
20190
20190
|
const fallbackNode = resolveHierarchyItemNode(algorithmNode);
|
|
20191
20191
|
const scoped = [];
|
|
20192
|
-
for (const
|
|
20193
|
-
collectScoped(view,
|
|
20192
|
+
for (const child3 of algorithmNode.children ?? []) {
|
|
20193
|
+
collectScoped(view, child3, false, scoped, nodeCount, presLayoutVars);
|
|
20194
20194
|
}
|
|
20195
20195
|
const rootScoped = scoped.filter((c) => !c.descendantScope);
|
|
20196
20196
|
const descendantScoped = scoped.filter((c) => c.descendantScope);
|
|
@@ -20258,8 +20258,8 @@ function partitionChildren(t, orgChart) {
|
|
|
20258
20258
|
}
|
|
20259
20259
|
const assistants = [];
|
|
20260
20260
|
const normal = [];
|
|
20261
|
-
for (const
|
|
20262
|
-
(isAssistant(
|
|
20261
|
+
for (const child3 of t.children) {
|
|
20262
|
+
(isAssistant(child3.node) ? assistants : normal).push(child3);
|
|
20263
20263
|
}
|
|
20264
20264
|
return { assistants, normal };
|
|
20265
20265
|
}
|
|
@@ -20269,8 +20269,8 @@ function effectiveWidth(t, orgChart) {
|
|
|
20269
20269
|
return 1;
|
|
20270
20270
|
}
|
|
20271
20271
|
let sum = 0;
|
|
20272
|
-
for (const
|
|
20273
|
-
sum += effectiveWidth(
|
|
20272
|
+
for (const child3 of normal) {
|
|
20273
|
+
sum += effectiveWidth(child3, orgChart);
|
|
20274
20274
|
}
|
|
20275
20275
|
return sum;
|
|
20276
20276
|
}
|
|
@@ -20300,8 +20300,8 @@ function flattenOrgChartGroupWrappers(nodes, orgChart) {
|
|
|
20300
20300
|
function countDescendants(t, orgChart) {
|
|
20301
20301
|
const { normal } = partitionChildren(t, orgChart);
|
|
20302
20302
|
let count = normal.length;
|
|
20303
|
-
for (const
|
|
20304
|
-
count += countDescendants(
|
|
20303
|
+
for (const child3 of normal) {
|
|
20304
|
+
count += countDescendants(child3, orgChart);
|
|
20305
20305
|
}
|
|
20306
20306
|
return count;
|
|
20307
20307
|
}
|
|
@@ -20321,8 +20321,8 @@ function walk2(t, level2, perRow, orgChart, siblingCount) {
|
|
|
20321
20321
|
let maxHang = 0;
|
|
20322
20322
|
let maxRows = 0;
|
|
20323
20323
|
let hangingColumns = 0;
|
|
20324
|
-
for (const
|
|
20325
|
-
const r = walk2(
|
|
20324
|
+
for (const child3 of normal) {
|
|
20325
|
+
const r = walk2(child3, level2 + 1, perRow, orgChart, normal.length);
|
|
20326
20326
|
deepestFan = Math.max(deepestFan, r.deepestFanLevel);
|
|
20327
20327
|
maxHang = Math.max(maxHang, r.maxHangDepth);
|
|
20328
20328
|
maxRows = Math.max(maxRows, r.maxHangRows);
|
|
@@ -20340,8 +20340,8 @@ function walk2(t, level2, perRow, orgChart, siblingCount) {
|
|
|
20340
20340
|
let maxHang = 0;
|
|
20341
20341
|
let maxRows = 0;
|
|
20342
20342
|
let hangingColumns = 0;
|
|
20343
|
-
for (const
|
|
20344
|
-
const r = walk2(
|
|
20343
|
+
for (const child3 of normal) {
|
|
20344
|
+
const r = walk2(child3, level2 + 1, perRow, orgChart, void 0);
|
|
20345
20345
|
deepestFan = Math.max(deepestFan, r.deepestFanLevel);
|
|
20346
20346
|
maxHang = Math.max(maxHang, r.maxHangDepth);
|
|
20347
20347
|
maxRows = Math.max(maxRows, r.maxHangRows);
|
|
@@ -20367,12 +20367,12 @@ function allChildrenHangForRoot(root, orgChart, perRow) {
|
|
|
20367
20367
|
return false;
|
|
20368
20368
|
}
|
|
20369
20369
|
const childLevel = 1;
|
|
20370
|
-
return normal.every((
|
|
20371
|
-
const childNormalCount = partitionChildren(
|
|
20370
|
+
return normal.every((child3) => {
|
|
20371
|
+
const childNormalCount = partitionChildren(child3, orgChart).normal.length;
|
|
20372
20372
|
if (childNormalCount === 0) {
|
|
20373
20373
|
return false;
|
|
20374
20374
|
}
|
|
20375
|
-
const r = walk2(
|
|
20375
|
+
const r = walk2(child3, childLevel, perRow, orgChart, normal.length);
|
|
20376
20376
|
return r.deepestFanLevel === childLevel;
|
|
20377
20377
|
});
|
|
20378
20378
|
}
|
|
@@ -20401,13 +20401,13 @@ function widthWalk(t, level2, perRow, orgChart, siblingCount, map) {
|
|
|
20401
20401
|
width = 1;
|
|
20402
20402
|
} else if (level2 === 0) {
|
|
20403
20403
|
width = 0;
|
|
20404
|
-
for (const
|
|
20405
|
-
width += widthWalk(
|
|
20404
|
+
for (const child3 of normal) {
|
|
20405
|
+
width += widthWalk(child3, level2 + 1, perRow, orgChart, normal.length, map);
|
|
20406
20406
|
}
|
|
20407
20407
|
} else if (fanContinues(t, perRow, orgChart, siblingCount, normal.length)) {
|
|
20408
20408
|
width = 0;
|
|
20409
|
-
for (const
|
|
20410
|
-
width += widthWalk(
|
|
20409
|
+
for (const child3 of normal) {
|
|
20410
|
+
width += widthWalk(child3, level2 + 1, perRow, orgChart, void 0, map);
|
|
20411
20411
|
}
|
|
20412
20412
|
} else {
|
|
20413
20413
|
width = 1;
|
|
@@ -20447,7 +20447,7 @@ function hierarchyLeafFoldsDescendants(node) {
|
|
|
20447
20447
|
if (endsInUnboundedDescendantHop(node.presentationOf?.axis, node.presentationOf?.count)) {
|
|
20448
20448
|
return true;
|
|
20449
20449
|
}
|
|
20450
|
-
return (node.children ?? []).some((
|
|
20450
|
+
return (node.children ?? []).some((child3) => hierarchyLeafFoldsDescendants(child3));
|
|
20451
20451
|
}
|
|
20452
20452
|
|
|
20453
20453
|
// diagram/hierarchy/smartart-hierarchy-fanned-hang-geometry.ts
|
|
@@ -20512,10 +20512,10 @@ function placeDescendantColumn(hc, node, edgeX, side, y, descW, descH, stackGapP
|
|
|
20512
20512
|
pushNode(hc, node.node, x, y, descW, descH);
|
|
20513
20513
|
elbowConnector(hc, parentId, parentCenterX, parentBottom, x + descW / 2, y, node.node.id);
|
|
20514
20514
|
let nextY = y + descH + stackGapPx;
|
|
20515
|
-
for (const
|
|
20515
|
+
for (const child3 of node.children) {
|
|
20516
20516
|
nextY = placeDescendantColumn(
|
|
20517
20517
|
hc,
|
|
20518
|
-
|
|
20518
|
+
child3,
|
|
20519
20519
|
edgeX,
|
|
20520
20520
|
side,
|
|
20521
20521
|
nextY,
|
|
@@ -20565,10 +20565,10 @@ function arrangeFannedHangingForest(view, nodes, box, palette, style, elementId,
|
|
|
20565
20565
|
pushNode(hc, root.node, branchX, 0, rootW, rootH);
|
|
20566
20566
|
const edgeX = side === "right" ? branchX + rootW : branchX;
|
|
20567
20567
|
let y = rootH + rootChildGap;
|
|
20568
|
-
for (const
|
|
20568
|
+
for (const child3 of root.children) {
|
|
20569
20569
|
y = placeDescendantColumn(
|
|
20570
20570
|
hc,
|
|
20571
|
-
|
|
20571
|
+
child3,
|
|
20572
20572
|
edgeX,
|
|
20573
20573
|
side,
|
|
20574
20574
|
y,
|
|
@@ -20618,7 +20618,7 @@ function placeHangingTree(hc, t, x, options, cursor, size, level2 = 0) {
|
|
|
20618
20618
|
return;
|
|
20619
20619
|
}
|
|
20620
20620
|
const childX = align ? placeX : options.direction === "left" ? x - options.indent : x + options.indent;
|
|
20621
|
-
for (const
|
|
20621
|
+
for (const child3 of normal) {
|
|
20622
20622
|
const childY = cursor.y;
|
|
20623
20623
|
elbowConnector(
|
|
20624
20624
|
hc,
|
|
@@ -20627,9 +20627,9 @@ function placeHangingTree(hc, t, x, options, cursor, size, level2 = 0) {
|
|
|
20627
20627
|
y + boxH,
|
|
20628
20628
|
childX + hc.boxH / 2,
|
|
20629
20629
|
childY,
|
|
20630
|
-
|
|
20630
|
+
child3.node.id
|
|
20631
20631
|
);
|
|
20632
|
-
placeHangingTree(hc,
|
|
20632
|
+
placeHangingTree(hc, child3, childX, options, cursor, void 0, level2 + 1);
|
|
20633
20633
|
}
|
|
20634
20634
|
}
|
|
20635
20635
|
function placeHangingForest(hc, roots, startX, startY, options, rootSize) {
|
|
@@ -20711,8 +20711,8 @@ function countRows(t, level2, orgChart, fold) {
|
|
|
20711
20711
|
if (fold && level2 >= 1) {
|
|
20712
20712
|
return count;
|
|
20713
20713
|
}
|
|
20714
|
-
for (const
|
|
20715
|
-
count += countRows(
|
|
20714
|
+
for (const child3 of normal) {
|
|
20715
|
+
count += countRows(child3, level2 + 1, orgChart, fold);
|
|
20716
20716
|
}
|
|
20717
20717
|
return count;
|
|
20718
20718
|
}
|
|
@@ -20821,8 +20821,8 @@ function findCompositeDescendant(node) {
|
|
|
20821
20821
|
if (node.algorithm?.type === "composite") {
|
|
20822
20822
|
return node;
|
|
20823
20823
|
}
|
|
20824
|
-
for (const
|
|
20825
|
-
const found = findCompositeDescendant(
|
|
20824
|
+
for (const child3 of node.children ?? []) {
|
|
20825
|
+
const found = findCompositeDescendant(child3);
|
|
20826
20826
|
if (found) {
|
|
20827
20827
|
return found;
|
|
20828
20828
|
}
|
|
@@ -20831,7 +20831,7 @@ function findCompositeDescendant(node) {
|
|
|
20831
20831
|
}
|
|
20832
20832
|
function findTextBearingChild(compositeNode) {
|
|
20833
20833
|
return (compositeNode.children ?? []).find(
|
|
20834
|
-
(
|
|
20834
|
+
(child3) => (child3.presentationOf?.axis ?? []).includes("self")
|
|
20835
20835
|
);
|
|
20836
20836
|
}
|
|
20837
20837
|
function resolveCompositeChildGeometry(algorithmNode, wrapperAspect, allowOmittedWidthFactor = false) {
|
|
@@ -20839,13 +20839,13 @@ function resolveCompositeChildGeometry(algorithmNode, wrapperAspect, allowOmitte
|
|
|
20839
20839
|
if (!compositeNode) {
|
|
20840
20840
|
return void 0;
|
|
20841
20841
|
}
|
|
20842
|
-
const
|
|
20843
|
-
if (!
|
|
20842
|
+
const child3 = findTextBearingChild(compositeNode);
|
|
20843
|
+
if (!child3?.name) {
|
|
20844
20844
|
return void 0;
|
|
20845
20845
|
}
|
|
20846
20846
|
const constraints = compositeNode.allConstraints ?? compositeNode.constraints ?? [];
|
|
20847
20847
|
const widthConstr = constraints.find(
|
|
20848
|
-
(c) => c.type === "w" && c.for === "ch" && c.forName ===
|
|
20848
|
+
(c) => c.type === "w" && c.for === "ch" && c.forName === child3.name && c.referenceType === "w" && c.referenceForName === void 0 && (typeof c.factor === "number" || allowOmittedWidthFactor && c.factor === void 0)
|
|
20849
20849
|
);
|
|
20850
20850
|
if (!widthConstr) {
|
|
20851
20851
|
return void 0;
|
|
@@ -20855,10 +20855,10 @@ function resolveCompositeChildGeometry(algorithmNode, wrapperAspect, allowOmitte
|
|
|
20855
20855
|
return void 0;
|
|
20856
20856
|
}
|
|
20857
20857
|
const selfHeightConstr = constraints.find(
|
|
20858
|
-
(c) => c.type === "h" && c.for === "ch" && c.forName ===
|
|
20858
|
+
(c) => c.type === "h" && c.for === "ch" && c.forName === child3.name && c.referenceType === "w" && c.referenceFor === "ch" && c.referenceForName === child3.name && typeof c.factor === "number"
|
|
20859
20859
|
);
|
|
20860
20860
|
const leftConstr = constraints.find(
|
|
20861
|
-
(c) => c.type === "l" && c.for === "ch" && c.forName ===
|
|
20861
|
+
(c) => c.type === "l" && c.for === "ch" && c.forName === child3.name && c.referenceType === "w" && c.referenceForName === void 0 && typeof c.factor === "number"
|
|
20862
20862
|
);
|
|
20863
20863
|
const offsetXRatio = leftConstr?.factor ?? 0;
|
|
20864
20864
|
if (selfHeightConstr) {
|
|
@@ -20869,10 +20869,10 @@ function resolveCompositeChildGeometry(algorithmNode, wrapperAspect, allowOmitte
|
|
|
20869
20869
|
};
|
|
20870
20870
|
}
|
|
20871
20871
|
const parentRelativeHeightConstr = constraints.find(
|
|
20872
|
-
(c) => c.type === "h" && c.for === "ch" && c.forName ===
|
|
20872
|
+
(c) => c.type === "h" && c.for === "ch" && c.forName === child3.name && c.referenceType === "h" && c.referenceFor === void 0 && c.referenceForName === void 0 && typeof c.factor === "number"
|
|
20873
20873
|
);
|
|
20874
20874
|
const hasCompoundTextRole = constraints.some(
|
|
20875
|
-
(c) => c.type === "primFontSz" && c.referenceForName ===
|
|
20875
|
+
(c) => c.type === "primFontSz" && c.referenceForName === child3.name
|
|
20876
20876
|
);
|
|
20877
20877
|
if (parentRelativeHeightConstr && !hasCompoundTextRole && typeof wrapperAspect === "number" && wrapperAspect > 0 && typeof parentRelativeHeightConstr.factor === "number") {
|
|
20878
20878
|
return {
|
|
@@ -20889,12 +20889,12 @@ function compositeDeclaresCompoundTextRole(algorithmNode) {
|
|
|
20889
20889
|
if (!compositeNode) {
|
|
20890
20890
|
return false;
|
|
20891
20891
|
}
|
|
20892
|
-
const
|
|
20893
|
-
if (!
|
|
20892
|
+
const child3 = findTextBearingChild(compositeNode);
|
|
20893
|
+
if (!child3?.name) {
|
|
20894
20894
|
return false;
|
|
20895
20895
|
}
|
|
20896
20896
|
const constraints = compositeNode.allConstraints ?? compositeNode.constraints ?? [];
|
|
20897
|
-
return constraints.some((c) => c.type === "primFontSz" && c.referenceForName ===
|
|
20897
|
+
return constraints.some((c) => c.type === "primFontSz" && c.referenceForName === child3.name);
|
|
20898
20898
|
}
|
|
20899
20899
|
|
|
20900
20900
|
// diagram/hierarchy/smartart-hierarchy-constraint-lookup.ts
|
|
@@ -20981,14 +20981,14 @@ function findAlgParamValue(element2, paramType) {
|
|
|
20981
20981
|
if (!element2) {
|
|
20982
20982
|
return void 0;
|
|
20983
20983
|
}
|
|
20984
|
-
for (const
|
|
20985
|
-
if (
|
|
20986
|
-
if (
|
|
20987
|
-
return
|
|
20984
|
+
for (const child3 of groupedChildren(element2)) {
|
|
20985
|
+
if (child3.name === "param") {
|
|
20986
|
+
if (child3.attrs["type"] === paramType) {
|
|
20987
|
+
return child3.attrs["val"];
|
|
20988
20988
|
}
|
|
20989
20989
|
continue;
|
|
20990
20990
|
}
|
|
20991
|
-
const found = findAlgParamValue(
|
|
20991
|
+
const found = findAlgParamValue(child3, paramType);
|
|
20992
20992
|
if (found !== void 0) {
|
|
20993
20993
|
return found;
|
|
20994
20994
|
}
|
|
@@ -21273,7 +21273,7 @@ function placeFannedRow(hc, t, normal, plan, cx, cy, level2, cellW, cellH, optio
|
|
|
21273
21273
|
const fanCy = (level2 + 1) * cellH + cellH / 2;
|
|
21274
21274
|
const fanned = normal.slice(0, plan.columns.length);
|
|
21275
21275
|
for (let i = 0; i < fanned.length; i++) {
|
|
21276
|
-
const
|
|
21276
|
+
const child3 = fanned[i];
|
|
21277
21277
|
const childCx = plan.columns[i];
|
|
21278
21278
|
elbowConnector(
|
|
21279
21279
|
hc,
|
|
@@ -21282,9 +21282,9 @@ function placeFannedRow(hc, t, normal, plan, cx, cy, level2, cellW, cellH, optio
|
|
|
21282
21282
|
cy + hc.boxH / 2,
|
|
21283
21283
|
childCx,
|
|
21284
21284
|
fanCy - hc.boxH / 2,
|
|
21285
|
-
|
|
21285
|
+
child3.node.id
|
|
21286
21286
|
);
|
|
21287
|
-
placeAtFn(hc,
|
|
21287
|
+
placeAtFn(hc, child3, childCx, fanCy, 0, 1, level2 + 1, cellW, cellH, options);
|
|
21288
21288
|
}
|
|
21289
21289
|
if (plan.overflow <= 0 || !options.hangingPlacer) {
|
|
21290
21290
|
return;
|
|
@@ -21293,7 +21293,7 @@ function placeFannedRow(hc, t, normal, plan, cx, cy, level2, cellW, cellH, optio
|
|
|
21293
21293
|
const columnOffset = hc.boxW * HIER_TAIL_OFFSET_RATIO;
|
|
21294
21294
|
const anchorX = plan.columns[0] - hc.boxW / 2 + columnOffset;
|
|
21295
21295
|
const anchorY = (level2 + 2) * cellH;
|
|
21296
|
-
for (const
|
|
21296
|
+
for (const child3 of remainder) {
|
|
21297
21297
|
elbowConnector(
|
|
21298
21298
|
hc,
|
|
21299
21299
|
t.node.id,
|
|
@@ -21301,7 +21301,7 @@ function placeFannedRow(hc, t, normal, plan, cx, cy, level2, cellW, cellH, optio
|
|
|
21301
21301
|
cy + hc.boxH / 2,
|
|
21302
21302
|
anchorX + hc.boxH / 2,
|
|
21303
21303
|
anchorY,
|
|
21304
|
-
|
|
21304
|
+
child3.node.id
|
|
21305
21305
|
);
|
|
21306
21306
|
}
|
|
21307
21307
|
options.hangingPlacer(hc, remainder, anchorX, anchorY);
|
|
@@ -21333,16 +21333,16 @@ function placeFlatChildren(hc, parentId, normal, cx, cy, xOffset, level2, cellW,
|
|
|
21333
21333
|
const siblingCxs = [];
|
|
21334
21334
|
{
|
|
21335
21335
|
let offset = xOffset;
|
|
21336
|
-
for (const
|
|
21337
|
-
const childW = spanOf(
|
|
21336
|
+
for (const child3 of normal) {
|
|
21337
|
+
const childW = spanOf(child3, options);
|
|
21338
21338
|
siblingCxs.push((offset + childW / 2) * cellW);
|
|
21339
21339
|
offset += childW;
|
|
21340
21340
|
}
|
|
21341
21341
|
}
|
|
21342
21342
|
const cascadeShift = options.cascadeOffsetX && level2 + 1 >= options.cascadeOffsetX.fromLevel ? options.cascadeOffsetX.offsetPx : 0;
|
|
21343
21343
|
let childOffset = xOffset;
|
|
21344
|
-
for (const
|
|
21345
|
-
const childW = spanOf(
|
|
21344
|
+
for (const child3 of normal) {
|
|
21345
|
+
const childW = spanOf(child3, options);
|
|
21346
21346
|
const childCx = (childOffset + childW / 2) * cellW + cascadeShift;
|
|
21347
21347
|
const childCy = (level2 + 1) * cellH + cellH / 2;
|
|
21348
21348
|
elbowConnector(
|
|
@@ -21352,11 +21352,11 @@ function placeFlatChildren(hc, parentId, normal, cx, cy, xOffset, level2, cellW,
|
|
|
21352
21352
|
cy + hc.boxH / 2,
|
|
21353
21353
|
childCx,
|
|
21354
21354
|
childCy - hc.boxH / 2,
|
|
21355
|
-
|
|
21355
|
+
child3.node.id
|
|
21356
21356
|
);
|
|
21357
21357
|
placeChild(
|
|
21358
21358
|
hc,
|
|
21359
|
-
|
|
21359
|
+
child3,
|
|
21360
21360
|
childCx,
|
|
21361
21361
|
childCy,
|
|
21362
21362
|
childOffset,
|
|
@@ -21431,12 +21431,12 @@ function placeWrappedChildren(hc, parentId, normal, cx, cy, xOffset, spanW, leve
|
|
|
21431
21431
|
}
|
|
21432
21432
|
function placeRowFanGroup(hc, parentId, group, cx, cy, leftX, unitW, slot2, rowCy, level2, cellW, cellH, options, placeAtFn) {
|
|
21433
21433
|
let cursor = slot2;
|
|
21434
|
-
for (const
|
|
21435
|
-
const childW = effectiveWidth(
|
|
21434
|
+
for (const child3 of group.members) {
|
|
21435
|
+
const childW = effectiveWidth(child3, options.orgChart);
|
|
21436
21436
|
const childCx = leftX + unitW * (cursor + childW / 2);
|
|
21437
|
-
elbowConnector(hc, parentId, cx, cy + hc.boxH / 2, childCx, rowCy - hc.boxH / 2,
|
|
21437
|
+
elbowConnector(hc, parentId, cx, cy + hc.boxH / 2, childCx, rowCy - hc.boxH / 2, child3.node.id);
|
|
21438
21438
|
const virtualOffset = childCx / cellW - childW / 2;
|
|
21439
|
-
placeAtFn(hc,
|
|
21439
|
+
placeAtFn(hc, child3, childCx, rowCy, virtualOffset, childW, level2 + 1, cellW, cellH, options);
|
|
21440
21440
|
cursor += childW;
|
|
21441
21441
|
}
|
|
21442
21442
|
return cursor;
|
|
@@ -21448,13 +21448,13 @@ function placeColumnGroup(hc, parentId, group, cx, cy, leftX, unitW, slot2, rowC
|
|
|
21448
21448
|
let fromX = cx;
|
|
21449
21449
|
let fromY = cy + hc.boxH / 2;
|
|
21450
21450
|
for (let i = 0; i < group.members.length; i++) {
|
|
21451
|
-
const
|
|
21451
|
+
const child3 = group.members[i];
|
|
21452
21452
|
const childCy = rowCy + subRowH * i;
|
|
21453
|
-
elbowConnector(hc, fromId, fromX, fromY, groupCx, childCy - hc.boxH / 2,
|
|
21454
|
-
const childW = effectiveWidth(
|
|
21453
|
+
elbowConnector(hc, fromId, fromX, fromY, groupCx, childCy - hc.boxH / 2, child3.node.id);
|
|
21454
|
+
const childW = effectiveWidth(child3, options.orgChart);
|
|
21455
21455
|
const virtualOffset = groupCx / cellW - childW / 2;
|
|
21456
|
-
placeAtFn(hc,
|
|
21457
|
-
fromId =
|
|
21456
|
+
placeAtFn(hc, child3, groupCx, childCy, virtualOffset, childW, level2 + 1, cellW, cellH, options);
|
|
21457
|
+
fromId = child3.node.id;
|
|
21458
21458
|
fromX = groupCx;
|
|
21459
21459
|
fromY = childCy + hc.boxH / 2;
|
|
21460
21460
|
}
|
|
@@ -21516,7 +21516,7 @@ function placeAt(hc, t, cx, cy, xOffset, spanW, level2, cellW, cellH, options, s
|
|
|
21516
21516
|
}
|
|
21517
21517
|
const anchorY = cy + hc.boxH / 2 + (options.hangHeightRatio ?? HANG_HEIGHT_RATIO) * hc.boxH;
|
|
21518
21518
|
const columnOffset = hc.boxW * HIER_TAIL_OFFSET_RATIO;
|
|
21519
|
-
for (const
|
|
21519
|
+
for (const child3 of normal) {
|
|
21520
21520
|
elbowConnector(
|
|
21521
21521
|
hc,
|
|
21522
21522
|
t.node.id,
|
|
@@ -21524,7 +21524,7 @@ function placeAt(hc, t, cx, cy, xOffset, spanW, level2, cellW, cellH, options, s
|
|
|
21524
21524
|
cy + hc.boxH / 2,
|
|
21525
21525
|
cx + columnOffset,
|
|
21526
21526
|
anchorY,
|
|
21527
|
-
|
|
21527
|
+
child3.node.id
|
|
21528
21528
|
);
|
|
21529
21529
|
}
|
|
21530
21530
|
options.hangingPlacer(hc, normal, cx - hc.boxW / 2 + columnOffset, anchorY);
|
|
@@ -21983,7 +21983,7 @@ function hasRecursiveItemTemplate(arranger) {
|
|
|
21983
21983
|
if (hasAmbiguousTopLevelRoles(arranger.children ?? [])) {
|
|
21984
21984
|
return false;
|
|
21985
21985
|
}
|
|
21986
|
-
const hasChAxisBelow = (node) => (node.children ?? []).some((
|
|
21986
|
+
const hasChAxisBelow = (node) => (node.children ?? []).some((child3) => isChAxisOrigin(child3) || hasChAxisBelow(child3));
|
|
21987
21987
|
return (arranger.children ?? []).some(hasChAxisBelow);
|
|
21988
21988
|
}
|
|
21989
21989
|
function visitOne(node, contextNode, childrenOf, connections, used, out) {
|
|
@@ -22001,8 +22001,8 @@ function visitOne(node, contextNode, childrenOf, connections, used, out) {
|
|
|
22001
22001
|
function collectRecursive(templateNodes, contextNode, childrenOf, connections, used, out) {
|
|
22002
22002
|
for (const templateNode of templateNodes) {
|
|
22003
22003
|
if (isChAxisOrigin(templateNode)) {
|
|
22004
|
-
for (const
|
|
22005
|
-
visitOne(templateNode,
|
|
22004
|
+
for (const child3 of childrenOf.get(contextNode.id) ?? []) {
|
|
22005
|
+
visitOne(templateNode, child3, childrenOf, connections, used, out);
|
|
22006
22006
|
}
|
|
22007
22007
|
} else {
|
|
22008
22008
|
visitOne(templateNode, contextNode, childrenOf, connections, used, out);
|
|
@@ -22012,8 +22012,8 @@ function collectRecursive(templateNodes, contextNode, childrenOf, connections, u
|
|
|
22012
22012
|
function resolveRecursiveItemRoleContent(arranger, node, childrenOf, connections) {
|
|
22013
22013
|
const out = [];
|
|
22014
22014
|
const used = /* @__PURE__ */ new Set();
|
|
22015
|
-
for (const
|
|
22016
|
-
visitOne(
|
|
22015
|
+
for (const child3 of arranger.children ?? []) {
|
|
22016
|
+
visitOne(child3, node, childrenOf, connections, used, out);
|
|
22017
22017
|
}
|
|
22018
22018
|
return out;
|
|
22019
22019
|
}
|
|
@@ -22032,7 +22032,7 @@ function expandRecursiveItemRoles(arranger, arrangerRole, original, node, childr
|
|
|
22032
22032
|
function resolveItemTextRoles(arranger) {
|
|
22033
22033
|
const flatChildren = arranger.children ?? [];
|
|
22034
22034
|
const contributingWrappers = flatChildren.filter(
|
|
22035
|
-
(
|
|
22035
|
+
(child3) => !isTextRole(child3) && unwrapTextRoles(child3).length > 0
|
|
22036
22036
|
);
|
|
22037
22037
|
if (contributingWrappers.length >= 2 && contributingWrappers.some(isPartialForEachOrigin)) {
|
|
22038
22038
|
return resolvePartialForEachRoles(contributingWrappers);
|
|
@@ -22040,7 +22040,7 @@ function resolveItemTextRoles(arranger) {
|
|
|
22040
22040
|
if (hasAmbiguousTopLevelRoles(flatChildren)) {
|
|
22041
22041
|
return void 0;
|
|
22042
22042
|
}
|
|
22043
|
-
const unwrapped = flatChildren.flatMap((
|
|
22043
|
+
const unwrapped = flatChildren.flatMap((child3) => unwrapTextRoles(child3));
|
|
22044
22044
|
const roles = [...flatChildren, ...unwrapped].filter(isTextRole);
|
|
22045
22045
|
return roles.length > 1 ? roles : void 0;
|
|
22046
22046
|
}
|
|
@@ -22125,8 +22125,8 @@ function collectNamedRules(definition) {
|
|
|
22125
22125
|
if (node.rules) {
|
|
22126
22126
|
out.push(...node.rules);
|
|
22127
22127
|
}
|
|
22128
|
-
for (const
|
|
22129
|
-
walk3(
|
|
22128
|
+
for (const child3 of node.children ?? []) {
|
|
22129
|
+
walk3(child3);
|
|
22130
22130
|
}
|
|
22131
22131
|
};
|
|
22132
22132
|
walk3(definition.rootNode);
|
|
@@ -22284,9 +22284,9 @@ function applySmartArtRoleColors(result, flat, colorRoles) {
|
|
|
22284
22284
|
const nodeById = new Map(flat.map((node) => [node.id, node]));
|
|
22285
22285
|
const roleOccurrence = /* @__PURE__ */ new Map();
|
|
22286
22286
|
const nodes = result.nodes.map((node) => {
|
|
22287
|
-
const
|
|
22288
|
-
const role =
|
|
22289
|
-
if (!role ||
|
|
22287
|
+
const source2 = node.nodeId ? nodeById.get(node.nodeId) : void 0;
|
|
22288
|
+
const role = source2?.styleRole;
|
|
22289
|
+
if (!role || source2?.style?.fillColor) {
|
|
22290
22290
|
return node;
|
|
22291
22291
|
}
|
|
22292
22292
|
const roleFillColors = colorRoles[role]?.fill;
|
|
@@ -22846,47 +22846,6 @@ function named(element2, local, ns, lenient = true) {
|
|
|
22846
22846
|
var children = (parent, local, ns, lenient = true) => elements(parent).filter((element2) => named(element2, local, ns, lenient));
|
|
22847
22847
|
var first = (parent, local, ns, lenient = true) => parent ? children(parent, local, ns, lenient)[0] : void 0;
|
|
22848
22848
|
|
|
22849
|
-
// drawingml/dom.ts
|
|
22850
|
-
function attributeReader(element2) {
|
|
22851
|
-
return (name) => {
|
|
22852
|
-
if (!element2) return void 0;
|
|
22853
|
-
const direct = element2.getAttribute(name);
|
|
22854
|
-
if (direct !== null) return direct;
|
|
22855
|
-
const attributes = element2.attributes;
|
|
22856
|
-
for (let index = 0; index < attributes.length; index++) {
|
|
22857
|
-
const candidate = attributes.item(index);
|
|
22858
|
-
if (candidate && candidate.localName === name) return candidate.value;
|
|
22859
|
-
}
|
|
22860
|
-
return void 0;
|
|
22861
|
-
};
|
|
22862
|
-
}
|
|
22863
|
-
function stringAttribute(element2, name) {
|
|
22864
|
-
const value = attributeReader(element2)(name)?.trim();
|
|
22865
|
-
return value ? value : void 0;
|
|
22866
|
-
}
|
|
22867
|
-
function integerAttribute(element2, name) {
|
|
22868
|
-
const parsed = Number.parseInt(attributeReader(element2)(name) ?? "", 10);
|
|
22869
|
-
return Number.isFinite(parsed) ? parsed : void 0;
|
|
22870
|
-
}
|
|
22871
|
-
function booleanAttribute(element2, name) {
|
|
22872
|
-
const value = attributeReader(element2)(name)?.trim().toLowerCase();
|
|
22873
|
-
if (value === "1" || value === "true") return true;
|
|
22874
|
-
if (value === "0" || value === "false") return false;
|
|
22875
|
-
return void 0;
|
|
22876
|
-
}
|
|
22877
|
-
function descendants2(root, local) {
|
|
22878
|
-
const result = [];
|
|
22879
|
-
const visit = (node) => {
|
|
22880
|
-
for (const child2 of Array.from(node.childNodes)) {
|
|
22881
|
-
if (!isElement(child2)) continue;
|
|
22882
|
-
if (child2.localName === local) result.push(child2);
|
|
22883
|
-
visit(child2);
|
|
22884
|
-
}
|
|
22885
|
-
};
|
|
22886
|
-
visit(root);
|
|
22887
|
-
return result;
|
|
22888
|
-
}
|
|
22889
|
-
|
|
22890
22849
|
// color/color-primitives.ts
|
|
22891
22850
|
function clampUnitInterval(value) {
|
|
22892
22851
|
return Math.min(1, Math.max(0, value));
|
|
@@ -23015,6 +22974,47 @@ function linearToSrgb255(linear) {
|
|
|
23015
22974
|
return 255 * (c <= 31308e-7 ? c * 12.92 : 1.055 * c ** (1 / 2.4) - 0.055);
|
|
23016
22975
|
}
|
|
23017
22976
|
|
|
22977
|
+
// drawingml/dom.ts
|
|
22978
|
+
function attributeReader(element2) {
|
|
22979
|
+
return (name) => {
|
|
22980
|
+
if (!element2) return void 0;
|
|
22981
|
+
const direct = element2.getAttribute(name);
|
|
22982
|
+
if (direct !== null) return direct;
|
|
22983
|
+
const attributes = element2.attributes;
|
|
22984
|
+
for (let index = 0; index < attributes.length; index++) {
|
|
22985
|
+
const candidate = attributes.item(index);
|
|
22986
|
+
if (candidate && candidate.localName === name) return candidate.value;
|
|
22987
|
+
}
|
|
22988
|
+
return void 0;
|
|
22989
|
+
};
|
|
22990
|
+
}
|
|
22991
|
+
function stringAttribute(element2, name) {
|
|
22992
|
+
const value = attributeReader(element2)(name)?.trim();
|
|
22993
|
+
return value ? value : void 0;
|
|
22994
|
+
}
|
|
22995
|
+
function integerAttribute(element2, name) {
|
|
22996
|
+
const parsed = Number.parseInt(attributeReader(element2)(name) ?? "", 10);
|
|
22997
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
22998
|
+
}
|
|
22999
|
+
function booleanAttribute(element2, name) {
|
|
23000
|
+
const value = attributeReader(element2)(name)?.trim().toLowerCase();
|
|
23001
|
+
if (value === "1" || value === "true") return true;
|
|
23002
|
+
if (value === "0" || value === "false") return false;
|
|
23003
|
+
return void 0;
|
|
23004
|
+
}
|
|
23005
|
+
function descendants2(root, local) {
|
|
23006
|
+
const result = [];
|
|
23007
|
+
const visit = (node) => {
|
|
23008
|
+
for (const child3 of Array.from(node.childNodes)) {
|
|
23009
|
+
if (!isElement(child3)) continue;
|
|
23010
|
+
if (child3.localName === local) result.push(child3);
|
|
23011
|
+
visit(child3);
|
|
23012
|
+
}
|
|
23013
|
+
};
|
|
23014
|
+
visit(root);
|
|
23015
|
+
return result;
|
|
23016
|
+
}
|
|
23017
|
+
|
|
23018
23018
|
// drawingml/ordered-color-transforms.ts
|
|
23019
23019
|
function orderedColorTransforms(channels, transforms) {
|
|
23020
23020
|
let { r, g, b } = channels;
|
|
@@ -23093,9 +23093,9 @@ function parseDrawingColor(element2) {
|
|
|
23093
23093
|
const color = {
|
|
23094
23094
|
kind,
|
|
23095
23095
|
value: colorValue(kind, element2),
|
|
23096
|
-
transforms: elements(element2).map((
|
|
23097
|
-
name:
|
|
23098
|
-
value:
|
|
23096
|
+
transforms: elements(element2).map((child3) => ({
|
|
23097
|
+
name: child3.localName,
|
|
23098
|
+
value: child3.getAttribute("val") ?? ""
|
|
23099
23099
|
}))
|
|
23100
23100
|
};
|
|
23101
23101
|
const fallback = kind === "system" ? element2.getAttribute("lastClr") : null;
|
|
@@ -23238,6 +23238,348 @@ function resolveDrawingColor(color, theme, options) {
|
|
|
23238
23238
|
};
|
|
23239
23239
|
}
|
|
23240
23240
|
|
|
23241
|
+
// drawingml/scene3d-presets.ts
|
|
23242
|
+
var CAMERA_PRESETS = /* @__PURE__ */ new Set([
|
|
23243
|
+
"legacyObliqueTopLeft",
|
|
23244
|
+
"legacyObliqueTop",
|
|
23245
|
+
"legacyObliqueTopRight",
|
|
23246
|
+
"legacyObliqueLeft",
|
|
23247
|
+
"legacyObliqueFront",
|
|
23248
|
+
"legacyObliqueRight",
|
|
23249
|
+
"legacyObliqueBottomLeft",
|
|
23250
|
+
"legacyObliqueBottom",
|
|
23251
|
+
"legacyObliqueBottomRight",
|
|
23252
|
+
"legacyPerspectiveTopLeft",
|
|
23253
|
+
"legacyPerspectiveTop",
|
|
23254
|
+
"legacyPerspectiveTopRight",
|
|
23255
|
+
"legacyPerspectiveLeft",
|
|
23256
|
+
"legacyPerspectiveFront",
|
|
23257
|
+
"legacyPerspectiveRight",
|
|
23258
|
+
"legacyPerspectiveBottomLeft",
|
|
23259
|
+
"legacyPerspectiveBottom",
|
|
23260
|
+
"legacyPerspectiveBottomRight",
|
|
23261
|
+
"orthographicFront",
|
|
23262
|
+
"isometricTopUp",
|
|
23263
|
+
"isometricTopDown",
|
|
23264
|
+
"isometricBottomUp",
|
|
23265
|
+
"isometricBottomDown",
|
|
23266
|
+
"isometricLeftUp",
|
|
23267
|
+
"isometricLeftDown",
|
|
23268
|
+
"isometricRightUp",
|
|
23269
|
+
"isometricRightDown",
|
|
23270
|
+
"isometricOffAxis1Left",
|
|
23271
|
+
"isometricOffAxis1Right",
|
|
23272
|
+
"isometricOffAxis1Top",
|
|
23273
|
+
"isometricOffAxis2Left",
|
|
23274
|
+
"isometricOffAxis2Right",
|
|
23275
|
+
"isometricOffAxis2Top",
|
|
23276
|
+
"isometricOffAxis3Left",
|
|
23277
|
+
"isometricOffAxis3Right",
|
|
23278
|
+
"isometricOffAxis3Bottom",
|
|
23279
|
+
"isometricOffAxis4Left",
|
|
23280
|
+
"isometricOffAxis4Right",
|
|
23281
|
+
"isometricOffAxis4Bottom",
|
|
23282
|
+
"obliqueTopLeft",
|
|
23283
|
+
"obliqueTop",
|
|
23284
|
+
"obliqueTopRight",
|
|
23285
|
+
"obliqueLeft",
|
|
23286
|
+
"obliqueRight",
|
|
23287
|
+
"obliqueBottomLeft",
|
|
23288
|
+
"obliqueBottom",
|
|
23289
|
+
"obliqueBottomRight",
|
|
23290
|
+
"perspectiveFront",
|
|
23291
|
+
"perspectiveLeft",
|
|
23292
|
+
"perspectiveRight",
|
|
23293
|
+
"perspectiveAbove",
|
|
23294
|
+
"perspectiveBelow",
|
|
23295
|
+
"perspectiveAboveLeftFacing",
|
|
23296
|
+
"perspectiveAboveRightFacing",
|
|
23297
|
+
"perspectiveContrastingLeftFacing",
|
|
23298
|
+
"perspectiveContrastingRightFacing",
|
|
23299
|
+
"perspectiveHeroicLeftFacing",
|
|
23300
|
+
"perspectiveHeroicRightFacing",
|
|
23301
|
+
"perspectiveHeroicExtremeLeftFacing",
|
|
23302
|
+
"perspectiveHeroicExtremeRightFacing",
|
|
23303
|
+
"perspectiveRelaxed",
|
|
23304
|
+
"perspectiveRelaxedModerately"
|
|
23305
|
+
]);
|
|
23306
|
+
var LIGHT_RIGS = /* @__PURE__ */ new Set([
|
|
23307
|
+
"legacyFlat1",
|
|
23308
|
+
"legacyFlat2",
|
|
23309
|
+
"legacyFlat3",
|
|
23310
|
+
"legacyFlat4",
|
|
23311
|
+
"legacyNormal1",
|
|
23312
|
+
"legacyNormal2",
|
|
23313
|
+
"legacyNormal3",
|
|
23314
|
+
"legacyNormal4",
|
|
23315
|
+
"legacyHarsh1",
|
|
23316
|
+
"legacyHarsh2",
|
|
23317
|
+
"legacyHarsh3",
|
|
23318
|
+
"legacyHarsh4",
|
|
23319
|
+
"threePt",
|
|
23320
|
+
"balanced",
|
|
23321
|
+
"soft",
|
|
23322
|
+
"harsh",
|
|
23323
|
+
"flood",
|
|
23324
|
+
"contrasting",
|
|
23325
|
+
"morning",
|
|
23326
|
+
"sunrise",
|
|
23327
|
+
"sunset",
|
|
23328
|
+
"chilly",
|
|
23329
|
+
"freezing",
|
|
23330
|
+
"flat",
|
|
23331
|
+
"twoPt",
|
|
23332
|
+
"glow",
|
|
23333
|
+
"brightRoom"
|
|
23334
|
+
]);
|
|
23335
|
+
var LIGHT_DIRECTIONS = /* @__PURE__ */ new Set(["tl", "t", "tr", "l", "r", "bl", "b", "br"]);
|
|
23336
|
+
|
|
23337
|
+
// drawingml/picture-effects.ts
|
|
23338
|
+
function picturePercentage(value) {
|
|
23339
|
+
const text2 = String(value ?? "").trim();
|
|
23340
|
+
if (!text2) return void 0;
|
|
23341
|
+
const percent = text2.endsWith("%");
|
|
23342
|
+
const n = Number(percent ? text2.slice(0, -1) : text2) / (percent ? 100 : 1e5);
|
|
23343
|
+
return Number.isFinite(n) ? n : void 0;
|
|
23344
|
+
}
|
|
23345
|
+
function readPictureEffect(name, attribute) {
|
|
23346
|
+
if (name === "grayscl") return { kind: "grayscale" };
|
|
23347
|
+
if (name === "lum") {
|
|
23348
|
+
const brightness = picturePercentage(attribute("bright"));
|
|
23349
|
+
const contrast = picturePercentage(attribute("contrast"));
|
|
23350
|
+
for (const [name2, value] of [
|
|
23351
|
+
["bright", brightness],
|
|
23352
|
+
["contrast", contrast]
|
|
23353
|
+
]) {
|
|
23354
|
+
const raw = attribute(name2);
|
|
23355
|
+
if (raw !== void 0 && raw !== null && (value === void 0 || Math.abs(value) > 1))
|
|
23356
|
+
return void 0;
|
|
23357
|
+
}
|
|
23358
|
+
return {
|
|
23359
|
+
kind: "luminance",
|
|
23360
|
+
...brightness !== void 0 ? { brightness } : {},
|
|
23361
|
+
...contrast !== void 0 ? { contrast } : {}
|
|
23362
|
+
};
|
|
23363
|
+
}
|
|
23364
|
+
if (name === "alphaModFix") {
|
|
23365
|
+
const raw = attribute("amt");
|
|
23366
|
+
const amount = raw === void 0 || raw === null ? 1 : picturePercentage(raw);
|
|
23367
|
+
if (amount !== void 0 && amount >= 0) return { kind: "alphaModFix", amount };
|
|
23368
|
+
}
|
|
23369
|
+
return void 0;
|
|
23370
|
+
}
|
|
23371
|
+
function parsePictureEffects(blip) {
|
|
23372
|
+
if (!blip) return [];
|
|
23373
|
+
return elements(blip).map((node) => ({
|
|
23374
|
+
...(node.namespaceURI === NS.a ? readPictureEffect(node.localName, (name) => node.getAttribute(name)) : void 0) ?? { kind: "unsupported", name: node.localName },
|
|
23375
|
+
sourceXml: buildXml(node)
|
|
23376
|
+
}));
|
|
23377
|
+
}
|
|
23378
|
+
function applyPictureEffects(blip, effects) {
|
|
23379
|
+
if (JSON.stringify(parsePictureEffects(blip)) === JSON.stringify(effects)) return;
|
|
23380
|
+
const nodes = effects.map((effect) => {
|
|
23381
|
+
const name = effect.kind === "grayscale" ? "grayscl" : effect.kind === "luminance" ? "lum" : effect.kind === "unsupported" ? effect.name : effect.kind;
|
|
23382
|
+
const source2 = effect.sourceXml ? parseXml(effect.sourceXml).documentElement : void 0;
|
|
23383
|
+
if (effect.kind === "unsupported" && !source2)
|
|
23384
|
+
throw new Error("An unsupported picture effect needs source XML");
|
|
23385
|
+
const node = source2 ? blip.ownerDocument.importNode(source2, true) : blip.ownerDocument.createElementNS(NS.a, `a:${name}`);
|
|
23386
|
+
if (effect.kind !== "unsupported" && (node.namespaceURI !== NS.a || node.localName !== name))
|
|
23387
|
+
throw new Error("Picture effect source does not match its kind");
|
|
23388
|
+
const set = (name2, value) => {
|
|
23389
|
+
const original = picturePercentage(node.getAttribute(name2));
|
|
23390
|
+
if (value === void 0) node.removeAttribute(name2);
|
|
23391
|
+
else if (value !== original) {
|
|
23392
|
+
if (!Number.isFinite(value)) throw new RangeError("Picture effect must be finite");
|
|
23393
|
+
node.setAttribute(name2, String(Math.round(value * 1e5)));
|
|
23394
|
+
}
|
|
23395
|
+
};
|
|
23396
|
+
if (effect.kind === "luminance") {
|
|
23397
|
+
if ([effect.brightness, effect.contrast].some(
|
|
23398
|
+
(value) => value !== void 0 && (!Number.isFinite(value) || Math.abs(value) > 1)
|
|
23399
|
+
))
|
|
23400
|
+
throw new RangeError("Picture luminance must be between -1 and 1");
|
|
23401
|
+
set("bright", effect.brightness);
|
|
23402
|
+
set("contrast", effect.contrast);
|
|
23403
|
+
}
|
|
23404
|
+
if (effect.kind === "alphaModFix") {
|
|
23405
|
+
if (effect.amount < 0) throw new RangeError("Picture alpha must be nonnegative");
|
|
23406
|
+
set("amt", effect.amount);
|
|
23407
|
+
}
|
|
23408
|
+
return node;
|
|
23409
|
+
});
|
|
23410
|
+
for (const node of elements(blip)) blip.removeChild(node);
|
|
23411
|
+
for (const node of nodes) blip.appendChild(node);
|
|
23412
|
+
}
|
|
23413
|
+
|
|
23414
|
+
// drawingml/read-3d-values.ts
|
|
23415
|
+
var integer = (value) => {
|
|
23416
|
+
if (value === void 0 || value === null || String(value).trim() === "") return void 0;
|
|
23417
|
+
const n = Number(value);
|
|
23418
|
+
return Number.isSafeInteger(n) ? n : void 0;
|
|
23419
|
+
};
|
|
23420
|
+
function readScene3DValues(node, read) {
|
|
23421
|
+
const out = {};
|
|
23422
|
+
const camera = read.child(node, "camera");
|
|
23423
|
+
const light = read.child(node, "lightRig");
|
|
23424
|
+
for (const [key, source2, attribute, choices] of [
|
|
23425
|
+
["cameraPreset", camera, "prst", CAMERA_PRESETS],
|
|
23426
|
+
["lightRigType", light, "rig", LIGHT_RIGS],
|
|
23427
|
+
["lightRigDirection", light, "dir", LIGHT_DIRECTIONS]
|
|
23428
|
+
]) {
|
|
23429
|
+
const token2 = String(read.attribute(source2, attribute) ?? "").trim();
|
|
23430
|
+
if (choices.has(token2)) out[key] = token2;
|
|
23431
|
+
}
|
|
23432
|
+
const fov = integer(read.attribute(camera, "fov"));
|
|
23433
|
+
if (fov !== void 0 && fov >= 0 && fov <= 108e5) out.cameraFieldOfView = fov;
|
|
23434
|
+
const zoom = picturePercentage(read.attribute(camera, "zoom"));
|
|
23435
|
+
if (zoom !== void 0 && zoom > 0) out.cameraZoom = zoom;
|
|
23436
|
+
for (const [prefix, source2] of [
|
|
23437
|
+
["camera", camera],
|
|
23438
|
+
["lightRig", light]
|
|
23439
|
+
]) {
|
|
23440
|
+
const rot = read.child(source2, "rot");
|
|
23441
|
+
for (const [axis, key] of [
|
|
23442
|
+
["lat", "RotX"],
|
|
23443
|
+
["lon", "RotY"],
|
|
23444
|
+
["rev", "RotZ"]
|
|
23445
|
+
]) {
|
|
23446
|
+
const value = integer(read.attribute(rot, axis));
|
|
23447
|
+
if (value !== void 0 && value >= 0 && value < 216e5) out[`${prefix}${key}`] = value;
|
|
23448
|
+
}
|
|
23449
|
+
}
|
|
23450
|
+
const backdrop = read.child(node, "backdrop");
|
|
23451
|
+
if (backdrop !== void 0) {
|
|
23452
|
+
out.hasBackdrop = true;
|
|
23453
|
+
for (const [name, prefix, attr] of [
|
|
23454
|
+
["anchor", "backdropAnchor", ""],
|
|
23455
|
+
["norm", "backdropNormal", "d"],
|
|
23456
|
+
["up", "backdropUp", "d"]
|
|
23457
|
+
]) {
|
|
23458
|
+
const point = read.child(backdrop, name);
|
|
23459
|
+
for (const [axis, suffix] of [
|
|
23460
|
+
["x", "X"],
|
|
23461
|
+
["y", "Y"],
|
|
23462
|
+
["z", "Z"]
|
|
23463
|
+
]) {
|
|
23464
|
+
const value = integer(read.attribute(point, `${attr}${axis}`));
|
|
23465
|
+
if (value !== void 0) out[`${prefix}${suffix}`] = value;
|
|
23466
|
+
}
|
|
23467
|
+
}
|
|
23468
|
+
}
|
|
23469
|
+
return out;
|
|
23470
|
+
}
|
|
23471
|
+
function readText3DValues(node, read) {
|
|
23472
|
+
const out = {};
|
|
23473
|
+
for (const [key, attribute] of [
|
|
23474
|
+
["extrusionHeight", "extrusionH"],
|
|
23475
|
+
["contourWidth", "contourW"],
|
|
23476
|
+
["z", "z"]
|
|
23477
|
+
]) {
|
|
23478
|
+
const value = integer(read.attribute(node, attribute));
|
|
23479
|
+
if (value !== void 0) out[key] = value;
|
|
23480
|
+
}
|
|
23481
|
+
const material = String(read.attribute(node, "prstMaterial") ?? "").trim();
|
|
23482
|
+
if (material) out.presetMaterial = material;
|
|
23483
|
+
for (const [name, prefix] of [
|
|
23484
|
+
["bevelT", "bevelTop"],
|
|
23485
|
+
["bevelB", "bevelBottom"]
|
|
23486
|
+
]) {
|
|
23487
|
+
const bevel2 = read.child(node, name);
|
|
23488
|
+
if (!bevel2) continue;
|
|
23489
|
+
out[`${prefix}Type`] = String(read.attribute(bevel2, "prst") || "circle").trim();
|
|
23490
|
+
for (const [attribute, suffix] of [
|
|
23491
|
+
["w", "Width"],
|
|
23492
|
+
["h", "Height"]
|
|
23493
|
+
]) {
|
|
23494
|
+
const value = integer(read.attribute(bevel2, attribute));
|
|
23495
|
+
if (value !== void 0) out[`${prefix}${suffix}`] = value;
|
|
23496
|
+
}
|
|
23497
|
+
}
|
|
23498
|
+
return out;
|
|
23499
|
+
}
|
|
23500
|
+
|
|
23501
|
+
// drawingml/read-text-3d.ts
|
|
23502
|
+
var DOM_3D_READER = {
|
|
23503
|
+
attribute: (node, name) => node?.getAttribute(name),
|
|
23504
|
+
child: (node, name) => first(node, name, NS.a)
|
|
23505
|
+
};
|
|
23506
|
+
function parseDrawingTextScene3D(node) {
|
|
23507
|
+
return { ...readScene3DValues(node, DOM_3D_READER), sourceXml: buildXml(node) };
|
|
23508
|
+
}
|
|
23509
|
+
function parseDrawingTextShape3D(node) {
|
|
23510
|
+
const extrusionColor = parseDrawingColorIn(first(node, "extrusionClr", NS.a));
|
|
23511
|
+
const contourColor = parseDrawingColorIn(first(node, "contourClr", NS.a));
|
|
23512
|
+
return {
|
|
23513
|
+
...readText3DValues(node, DOM_3D_READER),
|
|
23514
|
+
sourceXml: buildXml(node),
|
|
23515
|
+
...extrusionColor ? { extrusionColor } : {},
|
|
23516
|
+
...contourColor ? { contourColor } : {}
|
|
23517
|
+
};
|
|
23518
|
+
}
|
|
23519
|
+
function parseDrawingFlatText3D(node) {
|
|
23520
|
+
const raw = node.getAttribute("z");
|
|
23521
|
+
const z = raw === null || !raw.trim() ? NaN : Number(raw);
|
|
23522
|
+
return { sourceXml: buildXml(node), ...Number.isSafeInteger(z) ? { z } : {} };
|
|
23523
|
+
}
|
|
23524
|
+
|
|
23525
|
+
// drawingml/picture-crop.ts
|
|
23526
|
+
var SIDES2 = { l: "cropLeft", t: "cropTop", r: "cropRight", b: "cropBottom" };
|
|
23527
|
+
function parsePictureCrop(blipFill) {
|
|
23528
|
+
const rect2 = first(blipFill, "srcRect", NS.a);
|
|
23529
|
+
if (!rect2) return void 0;
|
|
23530
|
+
const result = {};
|
|
23531
|
+
for (const [attr, key] of Object.entries(SIDES2)) {
|
|
23532
|
+
const raw = rect2.getAttribute(attr);
|
|
23533
|
+
if (raw === null || !raw.trim()) continue;
|
|
23534
|
+
const percent = raw.endsWith("%");
|
|
23535
|
+
const value = Number(percent ? raw.slice(0, -1) : raw) / (percent ? 100 : 1e5);
|
|
23536
|
+
if (Number.isFinite(value)) result[key] = value;
|
|
23537
|
+
}
|
|
23538
|
+
return result;
|
|
23539
|
+
}
|
|
23540
|
+
function applyPictureCrop(blipFill, crop) {
|
|
23541
|
+
let rect2 = first(blipFill, "srcRect", NS.a);
|
|
23542
|
+
if (!rect2 && crop && Object.values(crop).some((value) => value !== void 0)) {
|
|
23543
|
+
rect2 = blipFill.ownerDocument.createElementNS(NS.a, "a:srcRect");
|
|
23544
|
+
const blip = first(blipFill, "blip", NS.a);
|
|
23545
|
+
blipFill.insertBefore(rect2, blip?.nextSibling ?? blipFill.firstChild);
|
|
23546
|
+
}
|
|
23547
|
+
if (!rect2) return;
|
|
23548
|
+
for (const [attr, key] of Object.entries(SIDES2)) {
|
|
23549
|
+
const value = crop?.[key];
|
|
23550
|
+
if (value === void 0) rect2.removeAttribute(attr);
|
|
23551
|
+
else {
|
|
23552
|
+
if (!Number.isFinite(value)) throw new RangeError("Picture crop must be finite");
|
|
23553
|
+
rect2.setAttribute(attr, String(Math.round(value * 1e5)));
|
|
23554
|
+
}
|
|
23555
|
+
}
|
|
23556
|
+
}
|
|
23557
|
+
|
|
23558
|
+
// drawingml/picture-fill.ts
|
|
23559
|
+
function parseDrawingPictureFill(fill) {
|
|
23560
|
+
const blip = first(fill, "blip", NS.a);
|
|
23561
|
+
const relId = blip?.getAttributeNS(NS.r, "embed") || blip?.getAttribute("r:embed") || void 0;
|
|
23562
|
+
const linkRelId = blip?.getAttributeNS(NS.r, "link") || void 0;
|
|
23563
|
+
const crop = parsePictureCrop(fill);
|
|
23564
|
+
const effects = parsePictureEffects(blip);
|
|
23565
|
+
const tile = first(fill, "tile", NS.a);
|
|
23566
|
+
const rect2 = first(first(fill, "stretch", NS.a), "fillRect", NS.a);
|
|
23567
|
+
const unsupported = [
|
|
23568
|
+
...tile ? ["tile"] : [],
|
|
23569
|
+
...rect2 && ["l", "t", "r", "b"].some((key) => Number(rect2.getAttribute(key) ?? 0) !== 0) ? ["fillRect"] : [],
|
|
23570
|
+
...fill.getAttribute("rotWithShape") === "0" || fill.getAttribute("rotWithShape") === "false" ? ["rotWithShape"] : []
|
|
23571
|
+
];
|
|
23572
|
+
return {
|
|
23573
|
+
kind: "picture",
|
|
23574
|
+
sourceXml: buildXml(fill),
|
|
23575
|
+
...relId ? { relId } : {},
|
|
23576
|
+
...linkRelId ? { linkRelId } : {},
|
|
23577
|
+
...crop ? { crop } : {},
|
|
23578
|
+
...effects.length ? { effects } : {},
|
|
23579
|
+
...unsupported.length ? { unsupportedPicture: unsupported } : {}
|
|
23580
|
+
};
|
|
23581
|
+
}
|
|
23582
|
+
|
|
23241
23583
|
// drawingml/drawing-fill.ts
|
|
23242
23584
|
var FILL_ELEMENTS = /* @__PURE__ */ new Set([
|
|
23243
23585
|
"noFill",
|
|
@@ -23308,17 +23650,8 @@ function parseDrawingFill(properties) {
|
|
|
23308
23650
|
...background ? { background } : {}
|
|
23309
23651
|
};
|
|
23310
23652
|
}
|
|
23311
|
-
case "blipFill":
|
|
23312
|
-
|
|
23313
|
-
const relId = blip?.getAttributeNS(NS.r, "embed") || blip?.getAttribute("r:embed") || void 0;
|
|
23314
|
-
const linkRelId = blip?.getAttributeNS(NS.r, "link") || void 0;
|
|
23315
|
-
return {
|
|
23316
|
-
kind: "picture",
|
|
23317
|
-
sourceXml: buildXml(fill),
|
|
23318
|
-
...relId ? { relId } : {},
|
|
23319
|
-
...linkRelId ? { linkRelId } : {}
|
|
23320
|
-
};
|
|
23321
|
-
}
|
|
23653
|
+
case "blipFill":
|
|
23654
|
+
return parseDrawingPictureFill(fill);
|
|
23322
23655
|
default:
|
|
23323
23656
|
return { kind: "unsupported", element: fill.localName };
|
|
23324
23657
|
}
|
|
@@ -23370,8 +23703,8 @@ function parseDrawingLine(ln) {
|
|
|
23370
23703
|
}
|
|
23371
23704
|
function drawingDashLength(value) {
|
|
23372
23705
|
if (!/^\d+$/u.test(value ?? "")) return void 0;
|
|
23373
|
-
const
|
|
23374
|
-
return Number.isSafeInteger(
|
|
23706
|
+
const number2 = Number(value);
|
|
23707
|
+
return Number.isSafeInteger(number2) && number2 <= 2147483647 ? number2 : void 0;
|
|
23375
23708
|
}
|
|
23376
23709
|
|
|
23377
23710
|
// drawingml/read-run-properties.ts
|
|
@@ -23463,36 +23796,36 @@ function readAttributes(element2, out) {
|
|
|
23463
23796
|
const smartTagId = integerAttribute(element2, "smtId");
|
|
23464
23797
|
if (smartTagId !== void 0) out.smartTagId = smartTagId;
|
|
23465
23798
|
}
|
|
23466
|
-
function readChild(
|
|
23467
|
-
const name =
|
|
23468
|
-
if (!isDrawingElement(
|
|
23469
|
-
extra.push(outerXml(
|
|
23799
|
+
function readChild(child3, out, extra) {
|
|
23800
|
+
const name = child3.localName;
|
|
23801
|
+
if (!isDrawingElement(child3)) {
|
|
23802
|
+
extra.push(outerXml(child3));
|
|
23470
23803
|
return;
|
|
23471
23804
|
}
|
|
23472
23805
|
if (name === "ln") {
|
|
23473
|
-
const line2 = parseDrawingLine(
|
|
23806
|
+
const line2 = parseDrawingLine(child3);
|
|
23474
23807
|
if (line2) out.line = line2;
|
|
23475
|
-
out.lineSourceXml = outerXml(
|
|
23808
|
+
out.lineSourceXml = outerXml(child3);
|
|
23476
23809
|
} else if (name in FONT_SLOTS) {
|
|
23477
|
-
const font = parseDrawingFont(
|
|
23810
|
+
const font = parseDrawingFont(child3);
|
|
23478
23811
|
if (font) out[FONT_SLOTS[name]] = font;
|
|
23479
|
-
else extra.push(outerXml(
|
|
23812
|
+
else extra.push(outerXml(child3));
|
|
23480
23813
|
} else if (name === "highlight") {
|
|
23481
|
-
const color = parseDrawingColorIn(
|
|
23814
|
+
const color = parseDrawingColorIn(child3);
|
|
23482
23815
|
if (color) out.highlight = color;
|
|
23483
23816
|
} else if (name === "uLnTx") out.underlineLineFollowsText = true;
|
|
23484
|
-
else if (name === "uLn") out.underlineLineXml = outerXml(
|
|
23817
|
+
else if (name === "uLn") out.underlineLineXml = outerXml(child3);
|
|
23485
23818
|
else if (name === "uFillTx") out.underlineFillFollowsText = true;
|
|
23486
23819
|
else if (name === "uFill") {
|
|
23487
|
-
const fill = parseDrawingFill(
|
|
23820
|
+
const fill = parseDrawingFill(child3);
|
|
23488
23821
|
if (fill) out.underlineFill = fill;
|
|
23489
|
-
else extra.push(outerXml(
|
|
23490
|
-
} else if (name === "hlinkClick") out.hyperlinkClick = parseDrawingHyperlink(
|
|
23491
|
-
else if (name === "hlinkMouseOver") out.hyperlinkMouseOver = parseDrawingHyperlink(
|
|
23822
|
+
else extra.push(outerXml(child3));
|
|
23823
|
+
} else if (name === "hlinkClick") out.hyperlinkClick = parseDrawingHyperlink(child3);
|
|
23824
|
+
else if (name === "hlinkMouseOver") out.hyperlinkMouseOver = parseDrawingHyperlink(child3);
|
|
23492
23825
|
else if (name === "rtl") {
|
|
23493
|
-
const value = booleanAttribute(
|
|
23826
|
+
const value = booleanAttribute(child3, "val");
|
|
23494
23827
|
out.rightToLeft = value ?? true;
|
|
23495
|
-
} else extra.push(outerXml(
|
|
23828
|
+
} else extra.push(outerXml(child3));
|
|
23496
23829
|
}
|
|
23497
23830
|
var WRITABLE_FILLS = /* @__PURE__ */ new Set(["none", "solid", "gradient"]);
|
|
23498
23831
|
function parseDrawingRunProperties(element2) {
|
|
@@ -23501,14 +23834,14 @@ function parseDrawingRunProperties(element2) {
|
|
|
23501
23834
|
readAttributes(element2, out);
|
|
23502
23835
|
const extra = [];
|
|
23503
23836
|
const fillElement = fillElementOf(element2);
|
|
23504
|
-
for (const
|
|
23505
|
-
if (
|
|
23837
|
+
for (const child3 of elements(element2)) {
|
|
23838
|
+
if (child3 === fillElement) {
|
|
23506
23839
|
const fill = parseDrawingFill(element2);
|
|
23507
23840
|
if (fill && WRITABLE_FILLS.has(fill.kind)) out.fill = fill;
|
|
23508
|
-
else extra.push(outerXml(
|
|
23841
|
+
else extra.push(outerXml(child3));
|
|
23509
23842
|
continue;
|
|
23510
23843
|
}
|
|
23511
|
-
readChild(
|
|
23844
|
+
readChild(child3, out, extra);
|
|
23512
23845
|
}
|
|
23513
23846
|
if (extra.length) out.extraXml = extra;
|
|
23514
23847
|
return out;
|
|
@@ -23560,13 +23893,13 @@ function readTabStops(element2) {
|
|
|
23560
23893
|
return stop;
|
|
23561
23894
|
});
|
|
23562
23895
|
}
|
|
23563
|
-
function readBulletChild(
|
|
23564
|
-
switch (
|
|
23896
|
+
function readBulletChild(child3, out) {
|
|
23897
|
+
switch (child3.localName) {
|
|
23565
23898
|
case "buClrTx":
|
|
23566
23899
|
out.bulletColor = "text";
|
|
23567
23900
|
return true;
|
|
23568
23901
|
case "buClr": {
|
|
23569
|
-
const color = parseDrawingColorIn(
|
|
23902
|
+
const color = parseDrawingColorIn(child3);
|
|
23570
23903
|
if (color) out.bulletColor = color;
|
|
23571
23904
|
return color !== void 0;
|
|
23572
23905
|
}
|
|
@@ -23574,12 +23907,12 @@ function readBulletChild(child2, out) {
|
|
|
23574
23907
|
out.bulletSize = "text";
|
|
23575
23908
|
return true;
|
|
23576
23909
|
case "buSzPct": {
|
|
23577
|
-
const value = parseOoxmlPercent(
|
|
23910
|
+
const value = parseOoxmlPercent(child3.getAttribute("val"));
|
|
23578
23911
|
if (value !== void 0) out.bulletSize = { unit: "percent", value };
|
|
23579
23912
|
return value !== void 0;
|
|
23580
23913
|
}
|
|
23581
23914
|
case "buSzPts": {
|
|
23582
|
-
const value = integerAttribute(
|
|
23915
|
+
const value = integerAttribute(child3, "val");
|
|
23583
23916
|
if (value !== void 0) out.bulletSize = { unit: "points", value: value / 100 };
|
|
23584
23917
|
return value !== void 0;
|
|
23585
23918
|
}
|
|
@@ -23587,7 +23920,7 @@ function readBulletChild(child2, out) {
|
|
|
23587
23920
|
out.bulletFont = "text";
|
|
23588
23921
|
return true;
|
|
23589
23922
|
case "buFont": {
|
|
23590
|
-
const font = parseDrawingFont(
|
|
23923
|
+
const font = parseDrawingFont(child3);
|
|
23591
23924
|
if (font) out.bulletFont = font;
|
|
23592
23925
|
return font !== void 0;
|
|
23593
23926
|
}
|
|
@@ -23595,19 +23928,19 @@ function readBulletChild(child2, out) {
|
|
|
23595
23928
|
out.bullet = { kind: "none" };
|
|
23596
23929
|
return true;
|
|
23597
23930
|
case "buChar": {
|
|
23598
|
-
const char =
|
|
23931
|
+
const char = child3.getAttribute("char");
|
|
23599
23932
|
if (char) out.bullet = { kind: "char", char };
|
|
23600
23933
|
return Boolean(char);
|
|
23601
23934
|
}
|
|
23602
23935
|
case "buAutoNum": {
|
|
23603
|
-
const scheme2 = stringAttribute(
|
|
23936
|
+
const scheme2 = stringAttribute(child3, "type");
|
|
23604
23937
|
if (!scheme2) return false;
|
|
23605
|
-
const startAt = integerAttribute(
|
|
23938
|
+
const startAt = integerAttribute(child3, "startAt");
|
|
23606
23939
|
out.bullet = { kind: "autoNumber", scheme: scheme2, ...startAt !== void 0 ? { startAt } : {} };
|
|
23607
23940
|
return true;
|
|
23608
23941
|
}
|
|
23609
23942
|
case "buBlip":
|
|
23610
|
-
out.bullet = { kind: "picture", xml: outerXml(
|
|
23943
|
+
out.bullet = { kind: "picture", xml: outerXml(child3) };
|
|
23611
23944
|
return true;
|
|
23612
23945
|
default:
|
|
23613
23946
|
return false;
|
|
@@ -23618,22 +23951,22 @@ function parseDrawingParagraphProperties(element2) {
|
|
|
23618
23951
|
const out = {};
|
|
23619
23952
|
readAttributes2(element2, out);
|
|
23620
23953
|
const extra = [];
|
|
23621
|
-
for (const
|
|
23622
|
-
if (!isDrawingElement(
|
|
23623
|
-
extra.push(outerXml(
|
|
23954
|
+
for (const child3 of elements(element2)) {
|
|
23955
|
+
if (!isDrawingElement(child3)) {
|
|
23956
|
+
extra.push(outerXml(child3));
|
|
23624
23957
|
continue;
|
|
23625
23958
|
}
|
|
23626
|
-
const name =
|
|
23959
|
+
const name = child3.localName;
|
|
23627
23960
|
if (name === "lnSpc" || name === "spcBef" || name === "spcAft") {
|
|
23628
|
-
const spacing = parseDrawingTextSpacing(
|
|
23961
|
+
const spacing = parseDrawingTextSpacing(child3);
|
|
23629
23962
|
const key = name === "lnSpc" ? "lineSpacing" : name === "spcBef" ? "spaceBefore" : "spaceAfter";
|
|
23630
23963
|
if (spacing) out[key] = spacing;
|
|
23631
|
-
else extra.push(outerXml(
|
|
23632
|
-
} else if (name === "tabLst") out.tabStops = readTabStops(
|
|
23964
|
+
else extra.push(outerXml(child3));
|
|
23965
|
+
} else if (name === "tabLst") out.tabStops = readTabStops(child3);
|
|
23633
23966
|
else if (name === "defRPr") {
|
|
23634
|
-
const run = parseDrawingRunProperties(
|
|
23967
|
+
const run = parseDrawingRunProperties(child3);
|
|
23635
23968
|
if (run) out.defaultRunProperties = run;
|
|
23636
|
-
} else if (!readBulletChild(
|
|
23969
|
+
} else if (!readBulletChild(child3, out)) extra.push(outerXml(child3));
|
|
23637
23970
|
}
|
|
23638
23971
|
if (extra.length) out.extraXml = extra;
|
|
23639
23972
|
return out;
|
|
@@ -23667,8 +24000,8 @@ var BODY_BOOLEANS = [
|
|
|
23667
24000
|
function parseDrawingBodyProperties(element2) {
|
|
23668
24001
|
if (!element2) return void 0;
|
|
23669
24002
|
const out = {};
|
|
23670
|
-
const
|
|
23671
|
-
if (
|
|
24003
|
+
const rotation2 = integerAttribute(element2, "rot");
|
|
24004
|
+
if (rotation2 !== void 0) out.rotation = rotation2 / 6e4;
|
|
23672
24005
|
for (const [key, name] of BODY_STRINGS) {
|
|
23673
24006
|
const value = stringAttribute(element2, name);
|
|
23674
24007
|
if (value) out[key] = value;
|
|
@@ -23682,12 +24015,12 @@ function parseDrawingBodyProperties(element2) {
|
|
|
23682
24015
|
if (value !== void 0) out[key] = value;
|
|
23683
24016
|
}
|
|
23684
24017
|
const extra = [];
|
|
23685
|
-
for (const
|
|
23686
|
-
const name = isDrawingElement(
|
|
24018
|
+
for (const child3 of elements(element2)) {
|
|
24019
|
+
const name = isDrawingElement(child3) ? child3.localName : "";
|
|
23687
24020
|
if (name === "noAutofit") out.autofit = { kind: "none" };
|
|
23688
24021
|
else if (name === "spAutoFit") out.autofit = { kind: "shape" };
|
|
23689
24022
|
else if (name === "normAutofit") {
|
|
23690
|
-
const read = attributeReader(
|
|
24023
|
+
const read = attributeReader(child3);
|
|
23691
24024
|
const fontScale = parseOoxmlPercent(read("fontScale") ?? "");
|
|
23692
24025
|
const reduction = parseOoxmlPercent(read("lnSpcReduction") ?? "");
|
|
23693
24026
|
out.autofit = {
|
|
@@ -23695,7 +24028,13 @@ function parseDrawingBodyProperties(element2) {
|
|
|
23695
24028
|
...read("fontScale") !== void 0 && fontScale !== void 0 ? { fontScale } : {},
|
|
23696
24029
|
...read("lnSpcReduction") !== void 0 && reduction !== void 0 ? { lineSpacingReduction: reduction } : {}
|
|
23697
24030
|
};
|
|
23698
|
-
} else
|
|
24031
|
+
} else if (name === "scene3d" && children(element2, "scene3d", NS.a).length === 1)
|
|
24032
|
+
out.scene3d = parseDrawingTextScene3D(child3);
|
|
24033
|
+
else if (name === "sp3d" && children(element2, "sp3d", NS.a).length === 1 && !first(element2, "flatTx", NS.a))
|
|
24034
|
+
out.shape3d = parseDrawingTextShape3D(child3);
|
|
24035
|
+
else if (name === "flatTx" && children(element2, "flatTx", NS.a).length === 1 && !first(element2, "sp3d", NS.a))
|
|
24036
|
+
out.flatText3d = parseDrawingFlatText3D(child3);
|
|
24037
|
+
else extra.push(outerXml(child3));
|
|
23699
24038
|
}
|
|
23700
24039
|
if (extra.length) out.extraXml = extra;
|
|
23701
24040
|
return out;
|
|
@@ -23704,12 +24043,12 @@ function parseDrawingListStyle(element2) {
|
|
|
23704
24043
|
if (!element2) return void 0;
|
|
23705
24044
|
const style = { levels: [] };
|
|
23706
24045
|
const extra = [];
|
|
23707
|
-
for (const
|
|
23708
|
-
const level2 = isDrawingElement(
|
|
23709
|
-
if (level2) style.levels[Number(level2[1]) - 1] = parseDrawingParagraphProperties(
|
|
23710
|
-
else if (isDrawingElement(
|
|
23711
|
-
style.default = parseDrawingParagraphProperties(
|
|
23712
|
-
else extra.push(outerXml(
|
|
24046
|
+
for (const child3 of elements(element2)) {
|
|
24047
|
+
const level2 = isDrawingElement(child3) ? /^lvl([1-9])pPr$/u.exec(child3.localName) : null;
|
|
24048
|
+
if (level2) style.levels[Number(level2[1]) - 1] = parseDrawingParagraphProperties(child3);
|
|
24049
|
+
else if (isDrawingElement(child3) && child3.localName === "defPPr")
|
|
24050
|
+
style.default = parseDrawingParagraphProperties(child3) ?? {};
|
|
24051
|
+
else extra.push(outerXml(child3));
|
|
23713
24052
|
}
|
|
23714
24053
|
style.levels = Array.from(style.levels);
|
|
23715
24054
|
if (extra.length) style.extraXml = extra;
|
|
@@ -23718,36 +24057,36 @@ function parseDrawingListStyle(element2) {
|
|
|
23718
24057
|
function textOf(element2) {
|
|
23719
24058
|
return first(element2, "t", NS.a)?.textContent ?? "";
|
|
23720
24059
|
}
|
|
23721
|
-
function readItem(
|
|
23722
|
-
const name = isDrawingElement(
|
|
24060
|
+
function readItem(child3) {
|
|
24061
|
+
const name = isDrawingElement(child3) ? child3.localName : "";
|
|
23723
24062
|
if (name === "pPr" || name === "endParaRPr") return void 0;
|
|
23724
24063
|
if (name === "r") {
|
|
23725
|
-
const properties = parseDrawingRunProperties(first(
|
|
23726
|
-
return { kind: "run", text: textOf(
|
|
24064
|
+
const properties = parseDrawingRunProperties(first(child3, "rPr", NS.a));
|
|
24065
|
+
return { kind: "run", text: textOf(child3), ...properties ? { properties } : {} };
|
|
23727
24066
|
}
|
|
23728
24067
|
if (name === "br") {
|
|
23729
|
-
const properties = parseDrawingRunProperties(first(
|
|
24068
|
+
const properties = parseDrawingRunProperties(first(child3, "rPr", NS.a));
|
|
23730
24069
|
return { kind: "break", ...properties ? { properties } : {} };
|
|
23731
24070
|
}
|
|
23732
24071
|
if (name === "fld") {
|
|
23733
|
-
const properties = parseDrawingRunProperties(first(
|
|
23734
|
-
const paragraphProperties = parseDrawingParagraphProperties(first(
|
|
23735
|
-
const type =
|
|
24072
|
+
const properties = parseDrawingRunProperties(first(child3, "rPr", NS.a));
|
|
24073
|
+
const paragraphProperties = parseDrawingParagraphProperties(first(child3, "pPr", NS.a));
|
|
24074
|
+
const type = child3.getAttribute("type");
|
|
23736
24075
|
return {
|
|
23737
24076
|
kind: "field",
|
|
23738
|
-
id:
|
|
24077
|
+
id: child3.getAttribute("id") ?? "",
|
|
23739
24078
|
...type ? { type } : {},
|
|
23740
|
-
text: textOf(
|
|
24079
|
+
text: textOf(child3),
|
|
23741
24080
|
...properties ? { properties } : {},
|
|
23742
24081
|
...paragraphProperties ? { paragraphProperties } : {}
|
|
23743
24082
|
};
|
|
23744
24083
|
}
|
|
23745
|
-
return { kind: "unknown", xml: outerXml(
|
|
24084
|
+
return { kind: "unknown", xml: outerXml(child3) };
|
|
23746
24085
|
}
|
|
23747
24086
|
function parseDrawingParagraph(element2) {
|
|
23748
24087
|
const items = [];
|
|
23749
|
-
for (const
|
|
23750
|
-
const item2 = readItem(
|
|
24088
|
+
for (const child3 of elements(element2)) {
|
|
24089
|
+
const item2 = readItem(child3);
|
|
23751
24090
|
if (item2) items.push(item2);
|
|
23752
24091
|
}
|
|
23753
24092
|
const properties = parseDrawingParagraphProperties(first(element2, "pPr", NS.a));
|
|
@@ -23781,7 +24120,7 @@ function drawingElement(doc, local) {
|
|
|
23781
24120
|
function dropRedundantDeclarations(element2) {
|
|
23782
24121
|
if (element2.getAttribute("xmlns:a") === NS.a) element2.removeAttribute("xmlns:a");
|
|
23783
24122
|
if (element2.getAttribute("xmlns:r") === NS.r) element2.removeAttribute("xmlns:r");
|
|
23784
|
-
for (const
|
|
24123
|
+
for (const child3 of elements(element2)) dropRedundantDeclarations(child3);
|
|
23785
24124
|
}
|
|
23786
24125
|
function importDrawingXml(doc, xml) {
|
|
23787
24126
|
const wrapper = parseXml(`<w xmlns:a="${NS.a}" xmlns:r="${NS.r}">${xml}</w>`).documentElement;
|
|
@@ -24797,9 +25136,9 @@ function reflowHierarchy(nodes, bounds) {
|
|
|
24797
25136
|
fontSize: Math.max(7, Math.min(10, boxW / 14))
|
|
24798
25137
|
});
|
|
24799
25138
|
let childOffset = xOffset;
|
|
24800
|
-
for (const
|
|
24801
|
-
walkTree(
|
|
24802
|
-
childOffset += treeWidth(
|
|
25139
|
+
for (const child3 of t.children) {
|
|
25140
|
+
walkTree(child3, childOffset, level2 + 1);
|
|
25141
|
+
childOffset += treeWidth(child3);
|
|
24803
25142
|
}
|
|
24804
25143
|
return w;
|
|
24805
25144
|
}
|
|
@@ -25256,23 +25595,23 @@ function ensure(parent, name, namespace = NS.dgm) {
|
|
|
25256
25595
|
const order = parent.localName === "style" ? ["lnRef", "fillRef", "effectRef", "fontRef"] : parent.localName === "styleLbl" ? ["scene3d", "sp3d", "txPr", "style", "extLst"] : [];
|
|
25257
25596
|
parent.insertBefore(
|
|
25258
25597
|
node,
|
|
25259
|
-
elements(parent).find((
|
|
25598
|
+
elements(parent).find((child3) => order.indexOf(child3.localName) > order.indexOf(name)) ?? null
|
|
25260
25599
|
);
|
|
25261
25600
|
}
|
|
25262
25601
|
return node;
|
|
25263
25602
|
}
|
|
25264
|
-
function writeDiagramFormatDefinition(
|
|
25603
|
+
function writeDiagramFormatDefinition(source2, change) {
|
|
25265
25604
|
if (!(change.kind === "colors" ? DIAGRAM_COLOR_ENTRIES : DIAGRAM_STYLE_ENTRIES).some(
|
|
25266
25605
|
(entry) => entry.id === change.value
|
|
25267
25606
|
))
|
|
25268
25607
|
throw new RangeError("Unknown SmartArt format preset.");
|
|
25269
25608
|
const template = change.kind === "colors" ? buildFabricatedColorsXml(change.value) : buildFabricatedQuickStyleXml(change.value);
|
|
25270
25609
|
const fresh = parseXml(template).documentElement;
|
|
25271
|
-
if (!
|
|
25610
|
+
if (!source2) {
|
|
25272
25611
|
fresh.setAttribute("uniqueId", `urn:ooxml-core/${change.kind}/${change.value}`);
|
|
25273
25612
|
return buildXml(fresh);
|
|
25274
25613
|
}
|
|
25275
|
-
const doc = parseXml(
|
|
25614
|
+
const doc = parseXml(source2, { label: "SmartArt formatting definition" });
|
|
25276
25615
|
const root = doc.documentElement;
|
|
25277
25616
|
if (root.namespaceURI !== NS.dgm || root.localName !== (change.kind === "colors" ? "colorsDef" : "styleDef"))
|
|
25278
25617
|
throw new Error("The SmartArt formatting definition is invalid.");
|
|
@@ -25285,9 +25624,9 @@ function writeDiagramFormatDefinition(source, change) {
|
|
|
25285
25624
|
const list2 = ensure(label, listName);
|
|
25286
25625
|
const desired = first(model, listName, NS.dgm);
|
|
25287
25626
|
list2.setAttribute("meth", desired.getAttribute("meth") ?? "repeat");
|
|
25288
|
-
for (const
|
|
25289
|
-
if (
|
|
25290
|
-
list2.removeChild(
|
|
25627
|
+
for (const child3 of elements(list2))
|
|
25628
|
+
if (child3.namespaceURI === NS.a && COLOR_NAMES.has(child3.localName))
|
|
25629
|
+
list2.removeChild(child3);
|
|
25291
25630
|
for (const color of elements(desired)) list2.appendChild(doc.importNode(color, true));
|
|
25292
25631
|
}
|
|
25293
25632
|
} else {
|
|
@@ -25298,9 +25637,9 @@ function writeDiagramFormatDefinition(source, change) {
|
|
|
25298
25637
|
const templateRef = first(desired, key, NS.a);
|
|
25299
25638
|
ref.setAttribute("idx", templateRef.getAttribute("idx") ?? "0");
|
|
25300
25639
|
if (!elements(ref).some(
|
|
25301
|
-
(
|
|
25640
|
+
(child3) => child3.namespaceURI === NS.a && COLOR_NAMES.has(child3.localName)
|
|
25302
25641
|
))
|
|
25303
|
-
for (const
|
|
25642
|
+
for (const child3 of elements(templateRef)) ref.appendChild(doc.importNode(child3, true));
|
|
25304
25643
|
}
|
|
25305
25644
|
if (!first(style, "fontRef", NS.a)) {
|
|
25306
25645
|
const ref = ensure(style, "fontRef", NS.a);
|
|
@@ -25310,13 +25649,13 @@ function writeDiagramFormatDefinition(source, change) {
|
|
|
25310
25649
|
}
|
|
25311
25650
|
return buildXml(doc);
|
|
25312
25651
|
}
|
|
25313
|
-
function formatDiagramSource(
|
|
25652
|
+
function formatDiagramSource(source2, change) {
|
|
25314
25653
|
const xml = writeDiagramFormatDefinition(
|
|
25315
|
-
change.kind === "colors" ?
|
|
25654
|
+
change.kind === "colors" ? source2?.colorsXml : source2?.quickStyleXml,
|
|
25316
25655
|
change
|
|
25317
25656
|
);
|
|
25318
25657
|
const id = `urn:ooxml-core/${change.kind}/${change.value}`;
|
|
25319
|
-
return change.kind === "colors" ? { source: { ...
|
|
25658
|
+
return change.kind === "colors" ? { source: { ...source2, colorsXml: xml }, colorsId: id } : { source: { ...source2, quickStyleXml: xml }, quickStyleId: id };
|
|
25320
25659
|
}
|
|
25321
25660
|
|
|
25322
25661
|
// diagram/write/data-edit.ts
|
|
@@ -25617,11 +25956,11 @@ function patchDrawingColorIn(container, color) {
|
|
|
25617
25956
|
}
|
|
25618
25957
|
const originals = elements(old);
|
|
25619
25958
|
color.transforms.forEach((transform, index) => {
|
|
25620
|
-
const
|
|
25621
|
-
if (
|
|
25959
|
+
const source2 = originals[index];
|
|
25960
|
+
if (source2?.localName === transform.name) {
|
|
25622
25961
|
if (before.transforms[index]?.value !== transform.value) {
|
|
25623
|
-
if (transform.value === "")
|
|
25624
|
-
else
|
|
25962
|
+
if (transform.value === "") source2.removeAttribute("val");
|
|
25963
|
+
else source2.setAttribute("val", transform.value);
|
|
25625
25964
|
}
|
|
25626
25965
|
return;
|
|
25627
25966
|
}
|
|
@@ -25629,7 +25968,7 @@ function patchDrawingColorIn(container, color) {
|
|
|
25629
25968
|
throw new Error("Invalid DrawingML colour transform");
|
|
25630
25969
|
const next = old.ownerDocument.createElementNS(NS.a, `a:${transform.name}`);
|
|
25631
25970
|
if (transform.value !== "") next.setAttribute("val", transform.value);
|
|
25632
|
-
if (
|
|
25971
|
+
if (source2) old.replaceChild(next, source2);
|
|
25633
25972
|
else old.appendChild(next);
|
|
25634
25973
|
});
|
|
25635
25974
|
for (const extra of originals.slice(color.transforms.length)) old.removeChild(extra);
|
|
@@ -25692,6 +26031,10 @@ function drawingPatternPictureXml(fill) {
|
|
|
25692
26031
|
else if (blip.getAttributeNS(NS.r, attribute) !== value)
|
|
25693
26032
|
blip.setAttributeNS(NS.r, `r:${attribute}`, value);
|
|
25694
26033
|
}
|
|
26034
|
+
if (fill.crop !== void 0 && JSON.stringify(before?.kind === "picture" ? before.crop : void 0) !== JSON.stringify(fill.crop))
|
|
26035
|
+
applyPictureCrop(root, fill.crop);
|
|
26036
|
+
if (fill.effects !== void 0 && JSON.stringify(before?.kind === "picture" ? before.effects ?? [] : []) !== JSON.stringify(fill.effects ?? []))
|
|
26037
|
+
applyPictureEffects(blip, fill.effects ?? []);
|
|
25695
26038
|
if (!fill.sourceXml) {
|
|
25696
26039
|
const stretch = doc.createElementNS(NS.a, "a:stretch");
|
|
25697
26040
|
stretch.appendChild(doc.createElementNS(NS.a, "a:fillRect"));
|
|
@@ -25817,20 +26160,20 @@ function importXml(host, xml) {
|
|
|
25817
26160
|
}
|
|
25818
26161
|
function dropDrawingDeclarations(node) {
|
|
25819
26162
|
if (node.getAttribute("xmlns:a") === NS.a) node.removeAttribute("xmlns:a");
|
|
25820
|
-
for (const
|
|
26163
|
+
for (const child3 of elements(node)) dropDrawingDeclarations(child3);
|
|
25821
26164
|
}
|
|
25822
|
-
function insert(host,
|
|
25823
|
-
const rank = ORDER.indexOf(
|
|
26165
|
+
function insert(host, child3) {
|
|
26166
|
+
const rank = ORDER.indexOf(child3.localName);
|
|
25824
26167
|
host.insertBefore(
|
|
25825
|
-
|
|
26168
|
+
child3,
|
|
25826
26169
|
elements(host).find(
|
|
25827
26170
|
(node) => node.namespaceURI === NS.a && ORDER.indexOf(node.localName) > rank
|
|
25828
26171
|
) ?? null
|
|
25829
26172
|
);
|
|
25830
26173
|
}
|
|
25831
26174
|
function remove(host, names) {
|
|
25832
|
-
for (const
|
|
25833
|
-
if (
|
|
26175
|
+
for (const child3 of elements(host))
|
|
26176
|
+
if (child3.namespaceURI === NS.a && names.includes(child3.localName)) host.removeChild(child3);
|
|
25834
26177
|
}
|
|
25835
26178
|
function patchDrawingLine(ln, line2) {
|
|
25836
26179
|
const before = line2.sourceXml ? parseDrawingLine(ln) : void 0;
|
|
@@ -25856,9 +26199,9 @@ function patchDrawingLine(ln, line2) {
|
|
|
25856
26199
|
const xml = line2.fill && drawingFillXml(line2.fill);
|
|
25857
26200
|
if (xml || !line2.fill) remove(ln, FILLS);
|
|
25858
26201
|
if (xml) {
|
|
25859
|
-
const
|
|
25860
|
-
dropDrawingDeclarations(
|
|
25861
|
-
insert(ln,
|
|
26202
|
+
const child3 = importXml(ln, xml);
|
|
26203
|
+
dropDrawingDeclarations(child3);
|
|
26204
|
+
insert(ln, child3);
|
|
25862
26205
|
}
|
|
25863
26206
|
}
|
|
25864
26207
|
}
|
|
@@ -26045,11 +26388,11 @@ function drawingEffectXml(effect) {
|
|
|
26045
26388
|
const color = "color" in effect ? effect.color : void 0;
|
|
26046
26389
|
if (color) patchDrawingColorIn(root, color);
|
|
26047
26390
|
else {
|
|
26048
|
-
for (const
|
|
26049
|
-
if (
|
|
26050
|
-
|
|
26391
|
+
for (const child3 of elements(root))
|
|
26392
|
+
if (child3.namespaceURI === NS.a && ["srgbClr", "schemeClr", "sysClr", "prstClr", "scrgbClr", "hslClr"].includes(
|
|
26393
|
+
child3.localName
|
|
26051
26394
|
))
|
|
26052
|
-
root.removeChild(
|
|
26395
|
+
root.removeChild(child3);
|
|
26053
26396
|
}
|
|
26054
26397
|
}
|
|
26055
26398
|
if (effect.kind === "fillOverlay" && changed("fill")) {
|
|
@@ -26083,6 +26426,217 @@ function drawingEffectsXml(value) {
|
|
|
26083
26426
|
return buildXml(doc);
|
|
26084
26427
|
}
|
|
26085
26428
|
|
|
26429
|
+
// drawingml/scene3d-coordinate.ts
|
|
26430
|
+
var FRACTIONAL_VECTOR_SCALE = 1e6;
|
|
26431
|
+
function scaleVectorToIntegers(x, y, z) {
|
|
26432
|
+
const allInts = Number.isInteger(x) && Number.isInteger(y) && Number.isInteger(z);
|
|
26433
|
+
const scale = allInts ? 1 : FRACTIONAL_VECTOR_SCALE;
|
|
26434
|
+
return {
|
|
26435
|
+
x: Math.round(x * scale),
|
|
26436
|
+
y: Math.round(y * scale),
|
|
26437
|
+
z: Math.round(z * scale)
|
|
26438
|
+
};
|
|
26439
|
+
}
|
|
26440
|
+
|
|
26441
|
+
// drawingml/write-text-3d.ts
|
|
26442
|
+
var bevels = /* @__PURE__ */ new Set([
|
|
26443
|
+
"circle",
|
|
26444
|
+
"relaxedInset",
|
|
26445
|
+
"cross",
|
|
26446
|
+
"coolSlant",
|
|
26447
|
+
"angle",
|
|
26448
|
+
"softRound",
|
|
26449
|
+
"convex",
|
|
26450
|
+
"slope",
|
|
26451
|
+
"divot",
|
|
26452
|
+
"riblet",
|
|
26453
|
+
"hardEdge",
|
|
26454
|
+
"artDeco"
|
|
26455
|
+
]);
|
|
26456
|
+
var materials = /* @__PURE__ */ new Set([
|
|
26457
|
+
"legacyMatte",
|
|
26458
|
+
"legacyPlastic",
|
|
26459
|
+
"legacyMetal",
|
|
26460
|
+
"legacyWireframe",
|
|
26461
|
+
"matte",
|
|
26462
|
+
"plastic",
|
|
26463
|
+
"metal",
|
|
26464
|
+
"warmMatte",
|
|
26465
|
+
"translucentPowder",
|
|
26466
|
+
"powder",
|
|
26467
|
+
"dkEdge",
|
|
26468
|
+
"softEdge",
|
|
26469
|
+
"clear",
|
|
26470
|
+
"flat",
|
|
26471
|
+
"softmetal"
|
|
26472
|
+
]);
|
|
26473
|
+
function remove2(node) {
|
|
26474
|
+
if (node) node.parentNode?.removeChild(node);
|
|
26475
|
+
}
|
|
26476
|
+
function semantics(value) {
|
|
26477
|
+
return JSON.stringify(
|
|
26478
|
+
Object.fromEntries(Object.entries(value).filter(([key]) => key !== "sourceXml"))
|
|
26479
|
+
);
|
|
26480
|
+
}
|
|
26481
|
+
function source(doc, name, xml) {
|
|
26482
|
+
if (!xml) return doc.createElementNS(NS.a, `a:${name}`);
|
|
26483
|
+
const element2 = parseXml(xml).documentElement;
|
|
26484
|
+
if (element2.namespaceURI !== NS.a || element2.localName !== name)
|
|
26485
|
+
throw new Error(`Invalid ${name} source`);
|
|
26486
|
+
return doc.importNode(element2, true);
|
|
26487
|
+
}
|
|
26488
|
+
function child2(node, name) {
|
|
26489
|
+
const existing = first(node, name, NS.a);
|
|
26490
|
+
if (existing) return existing;
|
|
26491
|
+
const result = node.ownerDocument.createElementNS(NS.a, `a:${name}`);
|
|
26492
|
+
const order = node.localName === "scene3d" ? ["camera", "lightRig", "backdrop", "extLst"] : node.localName === "sp3d" ? ["bevelT", "bevelB", "extrusionClr", "contourClr", "extLst"] : node.localName === "backdrop" ? ["anchor", "norm", "up", "extLst"] : ["rot", "extLst"];
|
|
26493
|
+
const rank = order.indexOf(name);
|
|
26494
|
+
node.insertBefore(
|
|
26495
|
+
result,
|
|
26496
|
+
elements(node).find(
|
|
26497
|
+
(item2) => item2.namespaceURI === NS.a && order.indexOf(item2.localName) > rank
|
|
26498
|
+
) ?? null
|
|
26499
|
+
);
|
|
26500
|
+
return result;
|
|
26501
|
+
}
|
|
26502
|
+
function number(node, name, value, before, scale = 1, min = -Infinity, max = Infinity) {
|
|
26503
|
+
if (value === before) return;
|
|
26504
|
+
if (value === void 0) {
|
|
26505
|
+
node.removeAttribute(name);
|
|
26506
|
+
return;
|
|
26507
|
+
}
|
|
26508
|
+
if (["lat", "lon", "rev"].includes(name) && !Number.isSafeInteger(value))
|
|
26509
|
+
throw new RangeError(`Invalid 3D ${name}`);
|
|
26510
|
+
const encoded = Math.round(value * scale);
|
|
26511
|
+
if (name === "zoom" && encoded <= 0) throw new RangeError("Invalid 3D zoom");
|
|
26512
|
+
if (!Number.isFinite(value) || !Number.isSafeInteger(encoded) || value < min || value > max)
|
|
26513
|
+
throw new RangeError(`Invalid 3D ${name}`);
|
|
26514
|
+
node.setAttribute(name, String(encoded));
|
|
26515
|
+
}
|
|
26516
|
+
function token(node, name, value, before, allowed, required = false) {
|
|
26517
|
+
if (value === before) return;
|
|
26518
|
+
if (value === void 0) {
|
|
26519
|
+
if (required && before !== void 0) throw new Error(`Cannot remove required 3D ${name}`);
|
|
26520
|
+
node.removeAttribute(name);
|
|
26521
|
+
} else {
|
|
26522
|
+
if (!allowed.has(value)) throw new RangeError(`Invalid 3D ${name}`);
|
|
26523
|
+
node.setAttribute(name, value);
|
|
26524
|
+
}
|
|
26525
|
+
}
|
|
26526
|
+
function rotation(node, value, before, prefix) {
|
|
26527
|
+
const axes = [
|
|
26528
|
+
["lat", "RotX"],
|
|
26529
|
+
["lon", "RotY"],
|
|
26530
|
+
["rev", "RotZ"]
|
|
26531
|
+
];
|
|
26532
|
+
if (!axes.some(([, suffix]) => value[`${prefix}${suffix}`] !== before[`${prefix}${suffix}`]))
|
|
26533
|
+
return;
|
|
26534
|
+
const existing = first(node, "rot", NS.a);
|
|
26535
|
+
const rot = child2(node, "rot");
|
|
26536
|
+
for (const [attribute, suffix] of axes) {
|
|
26537
|
+
if (existing && value[`${prefix}${suffix}`] === before[`${prefix}${suffix}`]) continue;
|
|
26538
|
+
number(
|
|
26539
|
+
rot,
|
|
26540
|
+
attribute,
|
|
26541
|
+
value[`${prefix}${suffix}`] ?? 0,
|
|
26542
|
+
before[`${prefix}${suffix}`],
|
|
26543
|
+
1,
|
|
26544
|
+
0,
|
|
26545
|
+
21599999
|
|
26546
|
+
);
|
|
26547
|
+
}
|
|
26548
|
+
}
|
|
26549
|
+
function writeDrawingTextScene3D(doc, value) {
|
|
26550
|
+
const node = source(doc, "scene3d", value.sourceXml);
|
|
26551
|
+
const before = value.sourceXml ? parseDrawingTextScene3D(node) : {};
|
|
26552
|
+
if (value.sourceXml && semantics(value) === semantics(before)) return node;
|
|
26553
|
+
if (!value.sourceXml && (!value.cameraPreset || !value.lightRigType || !value.lightRigDirection))
|
|
26554
|
+
throw new Error("A new scene needs camera and light rig presets");
|
|
26555
|
+
const camera = child2(node, "camera");
|
|
26556
|
+
const light = child2(node, "lightRig");
|
|
26557
|
+
token(camera, "prst", value.cameraPreset, before.cameraPreset, CAMERA_PRESETS, true);
|
|
26558
|
+
token(light, "rig", value.lightRigType, before.lightRigType, LIGHT_RIGS, true);
|
|
26559
|
+
token(light, "dir", value.lightRigDirection, before.lightRigDirection, LIGHT_DIRECTIONS, true);
|
|
26560
|
+
number(camera, "fov", value.cameraFieldOfView, before.cameraFieldOfView, 1, 0, 108e5);
|
|
26561
|
+
number(camera, "zoom", value.cameraZoom, before.cameraZoom, 1e5, Number.MIN_VALUE);
|
|
26562
|
+
rotation(camera, value, before, "camera");
|
|
26563
|
+
rotation(light, value, before, "lightRig");
|
|
26564
|
+
if (value.hasBackdrop === false && before.hasBackdrop) remove2(first(node, "backdrop", NS.a));
|
|
26565
|
+
else if (value.hasBackdrop) {
|
|
26566
|
+
if (!first(node, "backdrop", NS.a) && [
|
|
26567
|
+
"backdropAnchorX",
|
|
26568
|
+
"backdropAnchorY",
|
|
26569
|
+
"backdropAnchorZ",
|
|
26570
|
+
"backdropNormalX",
|
|
26571
|
+
"backdropNormalY",
|
|
26572
|
+
"backdropNormalZ",
|
|
26573
|
+
"backdropUpX",
|
|
26574
|
+
"backdropUpY",
|
|
26575
|
+
"backdropUpZ"
|
|
26576
|
+
].some((key) => value[key] === void 0))
|
|
26577
|
+
throw new Error("A new backdrop needs anchor, normal and up vectors");
|
|
26578
|
+
const backdrop = child2(node, "backdrop");
|
|
26579
|
+
for (const [name, prefix, attr] of [
|
|
26580
|
+
["anchor", "backdropAnchor", ""],
|
|
26581
|
+
["norm", "backdropNormal", "d"],
|
|
26582
|
+
["up", "backdropUp", "d"]
|
|
26583
|
+
]) {
|
|
26584
|
+
const values = [value[`${prefix}X`], value[`${prefix}Y`], value[`${prefix}Z`]];
|
|
26585
|
+
if (!values.some((v, index) => v !== before[`${prefix}${["X", "Y", "Z"][index]}`]))
|
|
26586
|
+
continue;
|
|
26587
|
+
if (values.some((v) => v === void 0 || !Number.isFinite(v)))
|
|
26588
|
+
throw new Error("A backdrop point needs three finite coordinates");
|
|
26589
|
+
const point = child2(backdrop, name);
|
|
26590
|
+
const vector = attr === "d" ? scaleVectorToIntegers(values[0], values[1], values[2]) : { x: values[0], y: values[1], z: values[2] };
|
|
26591
|
+
for (const [axis, suffix] of [
|
|
26592
|
+
["x", "X"],
|
|
26593
|
+
["y", "Y"],
|
|
26594
|
+
["z", "Z"]
|
|
26595
|
+
])
|
|
26596
|
+
number(point, `${attr}${axis}`, vector[axis], before[`${prefix}${suffix}`]);
|
|
26597
|
+
}
|
|
26598
|
+
}
|
|
26599
|
+
return node;
|
|
26600
|
+
}
|
|
26601
|
+
function writeDrawingTextShape3D(doc, value) {
|
|
26602
|
+
const node = source(doc, "sp3d", value.sourceXml);
|
|
26603
|
+
const before = value.sourceXml ? parseDrawingTextShape3D(node) : {};
|
|
26604
|
+
if (value.sourceXml && semantics(value) === semantics(before)) return node;
|
|
26605
|
+
number(node, "z", value.z, before.z);
|
|
26606
|
+
number(node, "extrusionH", value.extrusionHeight, before.extrusionHeight, 1, 0);
|
|
26607
|
+
number(node, "contourW", value.contourWidth, before.contourWidth, 1, 0);
|
|
26608
|
+
token(node, "prstMaterial", value.presetMaterial, before.presetMaterial, materials);
|
|
26609
|
+
for (const [name, prefix] of [
|
|
26610
|
+
["bevelT", "bevelTop"],
|
|
26611
|
+
["bevelB", "bevelBottom"]
|
|
26612
|
+
]) {
|
|
26613
|
+
if (value[`${prefix}Type`] === before[`${prefix}Type`] && value[`${prefix}Width`] === before[`${prefix}Width`] && value[`${prefix}Height`] === before[`${prefix}Height`])
|
|
26614
|
+
continue;
|
|
26615
|
+
if (!value[`${prefix}Type`] || value[`${prefix}Type`] === "none") {
|
|
26616
|
+
remove2(first(node, name, NS.a));
|
|
26617
|
+
continue;
|
|
26618
|
+
}
|
|
26619
|
+
const bevel2 = child2(node, name);
|
|
26620
|
+
token(bevel2, "prst", value[`${prefix}Type`], before[`${prefix}Type`], bevels);
|
|
26621
|
+
number(bevel2, "w", value[`${prefix}Width`], before[`${prefix}Width`], 1, 0);
|
|
26622
|
+
number(bevel2, "h", value[`${prefix}Height`], before[`${prefix}Height`], 1, 0);
|
|
26623
|
+
}
|
|
26624
|
+
for (const [key, name] of [
|
|
26625
|
+
["extrusionColor", "extrusionClr"],
|
|
26626
|
+
["contourColor", "contourClr"]
|
|
26627
|
+
]) {
|
|
26628
|
+
if (JSON.stringify(value[key]) === JSON.stringify(before[key])) continue;
|
|
26629
|
+
if (!value[key]) remove2(first(node, name, NS.a));
|
|
26630
|
+
else patchDrawingColorIn(child2(node, name), value[key]);
|
|
26631
|
+
}
|
|
26632
|
+
return node;
|
|
26633
|
+
}
|
|
26634
|
+
function writeDrawingFlatText3D(doc, value) {
|
|
26635
|
+
const node = source(doc, "flatTx", value.sourceXml);
|
|
26636
|
+
number(node, "z", value.z, value.sourceXml ? parseDrawingFlatText3D(node).z : void 0);
|
|
26637
|
+
return node;
|
|
26638
|
+
}
|
|
26639
|
+
|
|
26086
26640
|
// drawingml/write-run-properties.ts
|
|
26087
26641
|
var RUN_PROPERTIES_ORDER = [
|
|
26088
26642
|
"ln",
|
|
@@ -26207,9 +26761,9 @@ function writeDrawingRunProperties(doc, value, local = "rPr") {
|
|
|
26207
26761
|
const element2 = drawingElement(doc, local);
|
|
26208
26762
|
setAttributes(element2, value);
|
|
26209
26763
|
const modelled = modelledChildren(doc, value);
|
|
26210
|
-
const hasFill = modelled.some((
|
|
26764
|
+
const hasFill = modelled.some((child3) => FILL_NAMES.has(child3.name));
|
|
26211
26765
|
const kept = keptChildren(doc, value.extraXml).filter(
|
|
26212
|
-
(
|
|
26766
|
+
(child3) => !(hasFill && FILL_NAMES.has(child3.name))
|
|
26213
26767
|
);
|
|
26214
26768
|
appendInSchemaOrder(element2, RUN_PROPERTIES_ORDER, [...modelled, ...kept]);
|
|
26215
26769
|
return element2;
|
|
@@ -26366,6 +26920,14 @@ function writeDrawingBodyProperties(doc, value) {
|
|
|
26366
26920
|
}
|
|
26367
26921
|
children2.push({ name: local, node });
|
|
26368
26922
|
}
|
|
26923
|
+
if (value.shape3d && value.flatText3d)
|
|
26924
|
+
throw new Error("Text extrusion and flat override are mutually exclusive");
|
|
26925
|
+
if (value.scene3d)
|
|
26926
|
+
children2.push({ name: "scene3d", node: writeDrawingTextScene3D(doc, value.scene3d) });
|
|
26927
|
+
if (value.shape3d)
|
|
26928
|
+
children2.push({ name: "sp3d", node: writeDrawingTextShape3D(doc, value.shape3d) });
|
|
26929
|
+
if (value.flatText3d)
|
|
26930
|
+
children2.push({ name: "flatTx", node: writeDrawingFlatText3D(doc, value.flatText3d) });
|
|
26369
26931
|
appendInSchemaOrder(element2, BODY_PROPERTIES_ORDER, [
|
|
26370
26932
|
...children2,
|
|
26371
26933
|
...keptChildren(doc, value.extraXml)
|
|
@@ -26521,9 +27083,9 @@ function resolveDrawingShadow(effects, theme) {
|
|
|
26521
27083
|
}
|
|
26522
27084
|
function resolveDrawingOuterShadow(effect, theme) {
|
|
26523
27085
|
if (effect.sourceXml) {
|
|
26524
|
-
const
|
|
27086
|
+
const source2 = parseXml(effect.sourceXml).documentElement;
|
|
26525
27087
|
for (const attribute of ["blurRad", "dist", "dir", "sx", "sy", "kx", "ky"]) {
|
|
26526
|
-
const value =
|
|
27088
|
+
const value = source2.getAttribute(attribute);
|
|
26527
27089
|
if (value !== null && !Number.isFinite(Number(value))) return void 0;
|
|
26528
27090
|
}
|
|
26529
27091
|
}
|
|
@@ -26857,8 +27419,8 @@ function parsePoint(element2) {
|
|
|
26857
27419
|
if (customLayout) point.customLayout = customLayout;
|
|
26858
27420
|
return point;
|
|
26859
27421
|
}
|
|
26860
|
-
function parseDiagramDataModel(
|
|
26861
|
-
const root = (typeof
|
|
27422
|
+
function parseDiagramDataModel(source2, part) {
|
|
27423
|
+
const root = (typeof source2 === "string" ? parseXml(source2, { label: "DiagramML" }) : source2).documentElement;
|
|
26862
27424
|
const issues = [];
|
|
26863
27425
|
const report = (code, message) => issues.push({ code, message, ...part ? { part } : {} });
|
|
26864
27426
|
const points = [];
|
|
@@ -26961,7 +27523,7 @@ function resolveDiagramLayoutCategory(uniqueId, categories) {
|
|
|
26961
27523
|
}
|
|
26962
27524
|
|
|
26963
27525
|
// diagram/definitions.ts
|
|
26964
|
-
var rootOf3 = (
|
|
27526
|
+
var rootOf3 = (source2) => (typeof source2 === "string" ? parseXml(source2, { label: "DiagramML" }) : source2).documentElement;
|
|
26965
27527
|
function parseDefinitionHeader(root) {
|
|
26966
27528
|
const header = {
|
|
26967
27529
|
uniqueId: stringAttribute(root, "uniqueId") ?? "",
|
|
@@ -26981,8 +27543,8 @@ function colorList(container) {
|
|
|
26981
27543
|
const method = stringAttribute(container, "meth");
|
|
26982
27544
|
return { ...method ? { method } : {}, colors: parseDrawingColorList(container) };
|
|
26983
27545
|
}
|
|
26984
|
-
function parseDiagramColors(
|
|
26985
|
-
const root = rootOf3(
|
|
27546
|
+
function parseDiagramColors(source2) {
|
|
27547
|
+
const root = rootOf3(source2);
|
|
26986
27548
|
const labels = children(root, "styleLbl", NS.dgm).map((label) => ({
|
|
26987
27549
|
name: stringAttribute(label, "name") ?? "",
|
|
26988
27550
|
fill: colorList(first(label, "fillClrLst", NS.dgm)),
|
|
@@ -27024,13 +27586,13 @@ var hasContent = (element2) => Boolean(element2 && (element2.attributes.length >
|
|
|
27024
27586
|
function spatialScene(scene) {
|
|
27025
27587
|
const camera = first(scene, "camera", NS.a);
|
|
27026
27588
|
if (camera && camera.getAttribute("prst") !== "orthographicFront") return true;
|
|
27027
|
-
const
|
|
27589
|
+
const rotation2 = first(camera, "rot", NS.a);
|
|
27028
27590
|
return Boolean(
|
|
27029
|
-
first(scene, "backdrop", NS.a) ||
|
|
27591
|
+
first(scene, "backdrop", NS.a) || rotation2 && ["lat", "lon", "rev"].some((key) => Number(rotation2.getAttribute(key) ?? 0) !== 0)
|
|
27030
27592
|
);
|
|
27031
27593
|
}
|
|
27032
|
-
function parseDiagramQuickStyle(
|
|
27033
|
-
const root = rootOf3(
|
|
27594
|
+
function parseDiagramQuickStyle(source2) {
|
|
27595
|
+
const root = rootOf3(source2);
|
|
27034
27596
|
const labels = children(root, "styleLbl", NS.dgm).map((label) => ({
|
|
27035
27597
|
name: stringAttribute(label, "name") ?? "",
|
|
27036
27598
|
...parseStyleReferences(first(label, "style", NS.dgm)),
|
|
@@ -27044,8 +27606,8 @@ function parseDiagramQuickStyle(source) {
|
|
|
27044
27606
|
has3d: labels.some((label) => label.hasShape3d)
|
|
27045
27607
|
};
|
|
27046
27608
|
}
|
|
27047
|
-
function parseDiagramLayoutSummary(
|
|
27048
|
-
const root = rootOf3(
|
|
27609
|
+
function parseDiagramLayoutSummary(source2) {
|
|
27610
|
+
const root = rootOf3(source2);
|
|
27049
27611
|
const header = parseDefinitionHeader(root);
|
|
27050
27612
|
const family = resolveDiagramLayoutCategory(
|
|
27051
27613
|
header.uniqueId,
|
|
@@ -27403,8 +27965,8 @@ function previewDiagramLayout(input) {
|
|
|
27403
27965
|
if (direct?.line) shape.line = { ...shape.line, ...direct.line };
|
|
27404
27966
|
const sourceIds = [node.nodeId, ...node.foldedNodeIds ?? []];
|
|
27405
27967
|
const textNodes = sourceIds.flatMap((id) => {
|
|
27406
|
-
const
|
|
27407
|
-
return
|
|
27968
|
+
const source2 = input.nodes.find((entry) => entry.id === id);
|
|
27969
|
+
return source2 ? [source2] : [];
|
|
27408
27970
|
});
|
|
27409
27971
|
if (textNodes.length) shape.text = diagramPreviewText(textNodes, node.fontSize);
|
|
27410
27972
|
});
|
|
@@ -27449,10 +28011,10 @@ function resolveDiagramDrawingStyles(drawing, scheme2) {
|
|
|
27449
28011
|
// diagram/write/cache.ts
|
|
27450
28012
|
var DSP2 = "http://schemas.microsoft.com/office/drawing/2008/diagram";
|
|
27451
28013
|
function add(parent, namespace, name, attrs = {}) {
|
|
27452
|
-
const
|
|
27453
|
-
for (const [key, value] of Object.entries(attrs))
|
|
27454
|
-
parent.appendChild(
|
|
27455
|
-
return
|
|
28014
|
+
const child3 = parent.ownerDocument.createElementNS(namespace, name);
|
|
28015
|
+
for (const [key, value] of Object.entries(attrs)) child3.setAttribute(key, value);
|
|
28016
|
+
parent.appendChild(child3);
|
|
28017
|
+
return child3;
|
|
27456
28018
|
}
|
|
27457
28019
|
function withDiagramDrawingRelationship(xml, relationshipId) {
|
|
27458
28020
|
const doc = parseXml(xml);
|
|
@@ -27468,12 +28030,12 @@ function withDiagramDrawingRelationship(xml, relationshipId) {
|
|
|
27468
28030
|
return buildXml(doc);
|
|
27469
28031
|
}
|
|
27470
28032
|
function buildGeneratedDiagramCache(dataXml, input) {
|
|
27471
|
-
const
|
|
28033
|
+
const source2 = { ...input.source, dataXml };
|
|
27472
28034
|
const model = parseDiagramDataModel(dataXml);
|
|
27473
28035
|
const scheme2 = { ...DEFAULT_GENERATED_DIAGRAM_SCHEME, ...input.scheme };
|
|
27474
28036
|
const preview = previewDiagramLayout({
|
|
27475
28037
|
...input,
|
|
27476
|
-
source,
|
|
28038
|
+
source: source2,
|
|
27477
28039
|
scheme: scheme2,
|
|
27478
28040
|
nodes: diagramNodesInTreeOrder(model)
|
|
27479
28041
|
});
|
|
@@ -27485,7 +28047,7 @@ function buildGeneratedDiagramCache(dataXml, input) {
|
|
|
27485
28047
|
const points = first(root, "ptLst", NS.dgm);
|
|
27486
28048
|
const connections = first(root, "cxnLst", NS.dgm);
|
|
27487
28049
|
if (!points || !connections) return void 0;
|
|
27488
|
-
const colors =
|
|
28050
|
+
const colors = source2.colorsXml ? parseDiagramColors(source2.colorsXml).labels : [];
|
|
27489
28051
|
const authoredColors = colors.flatMap((label) => [...label.fill.colors, ...label.line.colors]);
|
|
27490
28052
|
const themed = /* @__PURE__ */ new Map();
|
|
27491
28053
|
for (const color of authoredColors) {
|
|
@@ -28193,9 +28755,9 @@ function parseRun(run) {
|
|
|
28193
28755
|
}
|
|
28194
28756
|
function parseParagraph(paragraph) {
|
|
28195
28757
|
const runs = [];
|
|
28196
|
-
for (const
|
|
28197
|
-
if (
|
|
28198
|
-
runs.push(parseRun(
|
|
28758
|
+
for (const child3 of elements(paragraph))
|
|
28759
|
+
if (child3.namespaceURI === NS.a && ["r", "fld", "br"].includes(child3.localName))
|
|
28760
|
+
runs.push(parseRun(child3));
|
|
28199
28761
|
const properties = first(paragraph, "pPr", NS.a);
|
|
28200
28762
|
const align = properties?.getAttribute("algn");
|
|
28201
28763
|
const defaults = parseProperties(first(properties, "defRPr", NS.a));
|
|
@@ -28235,6 +28797,108 @@ function parseDrawingTextBody(body) {
|
|
|
28235
28797
|
return result;
|
|
28236
28798
|
}
|
|
28237
28799
|
|
|
28800
|
+
// drawingml/custom-geometry.ts
|
|
28801
|
+
var ARITY = {
|
|
28802
|
+
val: 1,
|
|
28803
|
+
abs: 1,
|
|
28804
|
+
sqrt: 1,
|
|
28805
|
+
"+-": 3,
|
|
28806
|
+
"*/": 3,
|
|
28807
|
+
"+/": 3,
|
|
28808
|
+
"?:": 3,
|
|
28809
|
+
at2: 2,
|
|
28810
|
+
cat2: 3,
|
|
28811
|
+
cos: 2,
|
|
28812
|
+
max: 2,
|
|
28813
|
+
min: 2,
|
|
28814
|
+
mod: 3,
|
|
28815
|
+
pin: 3,
|
|
28816
|
+
sat2: 3,
|
|
28817
|
+
sin: 2,
|
|
28818
|
+
tan: 2
|
|
28819
|
+
};
|
|
28820
|
+
function operand(value, vars) {
|
|
28821
|
+
if (value === null || !value.trim()) return NaN;
|
|
28822
|
+
const literal2 = Number(value);
|
|
28823
|
+
return Number.isFinite(literal2) ? literal2 : vars.get(value) ?? NaN;
|
|
28824
|
+
}
|
|
28825
|
+
function parseCustomGeometry(custom, width, height) {
|
|
28826
|
+
const pathList = first(custom, "pathLst", NS.a);
|
|
28827
|
+
if (!pathList) return void 0;
|
|
28828
|
+
const pathNodes = children(pathList, "path", NS.a);
|
|
28829
|
+
const contextWidth = width;
|
|
28830
|
+
const contextHeight = height;
|
|
28831
|
+
const vars = createBuiltinVariables({ w: contextWidth, h: contextHeight });
|
|
28832
|
+
for (const list2 of ["avLst", "gdLst"]) {
|
|
28833
|
+
const parent = first(custom, list2, NS.a);
|
|
28834
|
+
if (!parent) continue;
|
|
28835
|
+
for (const guide of children(parent, "gd", NS.a)) {
|
|
28836
|
+
const name = guide.getAttribute("name");
|
|
28837
|
+
const formula = parseFormula(guide.getAttribute("fmla") ?? "");
|
|
28838
|
+
if (!name || ARITY[formula.op] !== formula.args.length || formula.args.some((arg) => !Number.isFinite(operand(arg, vars))))
|
|
28839
|
+
return void 0;
|
|
28840
|
+
const result = evaluateFormula(formula, vars);
|
|
28841
|
+
if (!Number.isFinite(result)) return void 0;
|
|
28842
|
+
vars.set(name, result);
|
|
28843
|
+
}
|
|
28844
|
+
}
|
|
28845
|
+
const paths = [];
|
|
28846
|
+
for (const path of pathNodes) {
|
|
28847
|
+
const commands = [];
|
|
28848
|
+
const value = (node, name) => operand(node.getAttribute(name), vars);
|
|
28849
|
+
for (const node of elements(path)) {
|
|
28850
|
+
if (node.namespaceURI !== NS.a) return void 0;
|
|
28851
|
+
const points = children(node, "pt", NS.a).map((point) => ({
|
|
28852
|
+
x: value(point, "x"),
|
|
28853
|
+
y: value(point, "y")
|
|
28854
|
+
}));
|
|
28855
|
+
if (points.some((point) => !Number.isFinite(point.x) || !Number.isFinite(point.y)))
|
|
28856
|
+
return void 0;
|
|
28857
|
+
const [p0, p1, p2] = points;
|
|
28858
|
+
switch (node.localName) {
|
|
28859
|
+
case "moveTo":
|
|
28860
|
+
case "lnTo":
|
|
28861
|
+
if (points.length !== 1 || !p0) return void 0;
|
|
28862
|
+
commands.push({ op: node.localName === "moveTo" ? "M" : "L", ...p0 });
|
|
28863
|
+
break;
|
|
28864
|
+
case "quadBezTo":
|
|
28865
|
+
if (points.length !== 2 || !p0 || !p1) return void 0;
|
|
28866
|
+
commands.push({ op: "Q", x1: p0.x, y1: p0.y, ...p1 });
|
|
28867
|
+
break;
|
|
28868
|
+
case "cubicBezTo":
|
|
28869
|
+
if (points.length !== 3 || !p0 || !p1 || !p2) return void 0;
|
|
28870
|
+
commands.push({ op: "C", x1: p0.x, y1: p0.y, x2: p1.x, y2: p1.y, ...p2 });
|
|
28871
|
+
break;
|
|
28872
|
+
case "arcTo": {
|
|
28873
|
+
const wR = value(node, "wR");
|
|
28874
|
+
const hR = value(node, "hR");
|
|
28875
|
+
const start = value(node, "stAng");
|
|
28876
|
+
const swing = value(node, "swAng");
|
|
28877
|
+
if (![wR, hR, start, swing].every(Number.isFinite)) return void 0;
|
|
28878
|
+
commands.push({ op: "A", wR, hR, startAngle: start / 6e4, swingAngle: swing / 6e4 });
|
|
28879
|
+
break;
|
|
28880
|
+
}
|
|
28881
|
+
case "close":
|
|
28882
|
+
commands.push({ op: "Z" });
|
|
28883
|
+
break;
|
|
28884
|
+
default:
|
|
28885
|
+
return void 0;
|
|
28886
|
+
}
|
|
28887
|
+
}
|
|
28888
|
+
const pathWidth = path.hasAttribute("w") ? Number(path.getAttribute("w")) : contextWidth;
|
|
28889
|
+
const pathHeight = path.hasAttribute("h") ? Number(path.getAttribute("h")) : contextHeight;
|
|
28890
|
+
if (![pathWidth, pathHeight].every((n) => Number.isFinite(n) && n > 0)) return void 0;
|
|
28891
|
+
paths.push({
|
|
28892
|
+
commands,
|
|
28893
|
+
width: pathWidth,
|
|
28894
|
+
height: pathHeight,
|
|
28895
|
+
...path.getAttribute("fill") ? { fill: path.getAttribute("fill") } : {},
|
|
28896
|
+
...["0", "false"].includes(path.getAttribute("stroke") ?? "") ? { stroke: false } : {}
|
|
28897
|
+
});
|
|
28898
|
+
}
|
|
28899
|
+
return paths.length ? paths : void 0;
|
|
28900
|
+
}
|
|
28901
|
+
|
|
28238
28902
|
// drawingml/drawing-geometry.ts
|
|
28239
28903
|
var int = (element2, name) => Number.parseInt(element2?.getAttribute(name) ?? "", 10);
|
|
28240
28904
|
function parseFrame(container) {
|
|
@@ -28259,74 +28923,13 @@ function parseTransform(xfrm) {
|
|
|
28259
28923
|
...booleanAttribute(xfrm, "flipV") ? { flipVertical: true } : {}
|
|
28260
28924
|
};
|
|
28261
28925
|
}
|
|
28262
|
-
function parsePathCommands(path) {
|
|
28263
|
-
const commands = [];
|
|
28264
|
-
const point = (element2) => {
|
|
28265
|
-
const x = int(element2, "x");
|
|
28266
|
-
const y = int(element2, "y");
|
|
28267
|
-
return Number.isFinite(x) && Number.isFinite(y) ? { x, y } : void 0;
|
|
28268
|
-
};
|
|
28269
|
-
for (const element2 of Array.from(path.childNodes)) {
|
|
28270
|
-
if (element2.nodeType !== 1) continue;
|
|
28271
|
-
const node = element2;
|
|
28272
|
-
const points = children(node, "pt", NS.a).map(point);
|
|
28273
|
-
if (points.some((entry) => entry === void 0)) return void 0;
|
|
28274
|
-
const [p0, p1, p2] = points;
|
|
28275
|
-
switch (node.localName) {
|
|
28276
|
-
case "moveTo":
|
|
28277
|
-
case "lnTo":
|
|
28278
|
-
if (!p0) return void 0;
|
|
28279
|
-
commands.push({ op: node.localName === "moveTo" ? "M" : "L", ...p0 });
|
|
28280
|
-
break;
|
|
28281
|
-
case "cubicBezTo":
|
|
28282
|
-
if (!p0 || !p1 || !p2) return void 0;
|
|
28283
|
-
commands.push({ op: "C", x1: p0.x, y1: p0.y, x2: p1.x, y2: p1.y, x: p2.x, y: p2.y });
|
|
28284
|
-
break;
|
|
28285
|
-
case "quadBezTo":
|
|
28286
|
-
if (!p0 || !p1) return void 0;
|
|
28287
|
-
commands.push({ op: "Q", x1: p0.x, y1: p0.y, x: p1.x, y: p1.y });
|
|
28288
|
-
break;
|
|
28289
|
-
case "arcTo": {
|
|
28290
|
-
const wR = int(node, "wR");
|
|
28291
|
-
const hR = int(node, "hR");
|
|
28292
|
-
const startAngle = int(node, "stAng");
|
|
28293
|
-
const swingAngle = int(node, "swAng");
|
|
28294
|
-
if (![wR, hR, startAngle, swingAngle].every(Number.isFinite)) return void 0;
|
|
28295
|
-
commands.push({
|
|
28296
|
-
op: "A",
|
|
28297
|
-
wR,
|
|
28298
|
-
hR,
|
|
28299
|
-
startAngle: startAngle / 6e4,
|
|
28300
|
-
swingAngle: swingAngle / 6e4
|
|
28301
|
-
});
|
|
28302
|
-
break;
|
|
28303
|
-
}
|
|
28304
|
-
case "close":
|
|
28305
|
-
commands.push({ op: "Z" });
|
|
28306
|
-
break;
|
|
28307
|
-
}
|
|
28308
|
-
}
|
|
28309
|
-
return commands;
|
|
28310
|
-
}
|
|
28311
28926
|
function parseDrawingGeometry(spPr) {
|
|
28312
28927
|
const preset = first(spPr, "prstGeom", NS.a);
|
|
28313
28928
|
const custom = first(spPr, "custGeom", NS.a);
|
|
28314
28929
|
if (custom) {
|
|
28315
|
-
const
|
|
28316
|
-
|
|
28317
|
-
|
|
28318
|
-
if (!commands) return { geometry: "custom", issue: "CUSTOM_GEOMETRY_GUIDES_UNSUPPORTED" };
|
|
28319
|
-
const width = int(path, "w");
|
|
28320
|
-
const height = int(path, "h");
|
|
28321
|
-
paths.push({
|
|
28322
|
-
commands,
|
|
28323
|
-
...Number.isFinite(width) ? { width } : {},
|
|
28324
|
-
...Number.isFinite(height) ? { height } : {},
|
|
28325
|
-
...path.getAttribute("fill") ? { fill: path.getAttribute("fill") } : {},
|
|
28326
|
-
...path.getAttribute("stroke") === "0" || path.getAttribute("stroke") === "false" ? { stroke: false } : {}
|
|
28327
|
-
});
|
|
28328
|
-
}
|
|
28329
|
-
return { geometry: "custom", paths };
|
|
28930
|
+
const frame2 = parseFrame(first(spPr, "xfrm", NS.a));
|
|
28931
|
+
const paths = parseCustomGeometry(custom, frame2?.width ?? 21600, frame2?.height ?? 21600);
|
|
28932
|
+
return paths ? { geometry: "custom", paths } : { geometry: "custom", issue: "CUSTOM_GEOMETRY_UNSUPPORTED" };
|
|
28330
28933
|
}
|
|
28331
28934
|
const geometry = preset?.getAttribute("prst") || "rect";
|
|
28332
28935
|
const adjustments = {};
|
|
@@ -28398,7 +29001,8 @@ function parseShape2(sp, index, group, issues) {
|
|
|
28398
29001
|
if (transform.flipVertical) shape.flipVertical = true;
|
|
28399
29002
|
if (adjustments) shape.adjustments = adjustments;
|
|
28400
29003
|
if (paths) shape.paths = paths;
|
|
28401
|
-
const
|
|
29004
|
+
const picture = first(sp, "blipFill", NS.dsp);
|
|
29005
|
+
const fill = picture ? parseDrawingPictureFill(picture) : parseDrawingFill(spPr);
|
|
28402
29006
|
if (fill) shape.fill = fill;
|
|
28403
29007
|
const line2 = parseDrawingLine(first(spPr, "ln", NS.a));
|
|
28404
29008
|
if (line2) shape.line = line2;
|
|
@@ -28417,25 +29021,25 @@ function parseShape2(sp, index, group, issues) {
|
|
|
28417
29021
|
if (textFrame) shape.textFrame = applyGroup(textFrame, group);
|
|
28418
29022
|
return shape;
|
|
28419
29023
|
}
|
|
28420
|
-
function parseDiagramDrawing(
|
|
28421
|
-
const root = (typeof
|
|
29024
|
+
function parseDiagramDrawing(source2, part) {
|
|
29025
|
+
const root = (typeof source2 === "string" ? parseXml(source2, { label: "DiagramML" }) : source2).documentElement;
|
|
28422
29026
|
const issues = [];
|
|
28423
29027
|
const shapes = [];
|
|
28424
29028
|
const tree = root.localName === "spTree" ? root : first(root, "spTree", NS.dsp);
|
|
28425
29029
|
let counter = 0;
|
|
28426
29030
|
const visit = (container, group) => {
|
|
28427
|
-
for (const
|
|
28428
|
-
if (
|
|
28429
|
-
const element2 =
|
|
28430
|
-
if (element2.localName === "sp") {
|
|
29031
|
+
for (const child3 of Array.from(container.childNodes)) {
|
|
29032
|
+
if (child3.nodeType !== 1) continue;
|
|
29033
|
+
const element2 = child3;
|
|
29034
|
+
if (element2.localName === "sp" || element2.localName === "pic") {
|
|
28431
29035
|
const shape = parseShape2(element2, counter++, group, issues);
|
|
28432
29036
|
if (shape) shapes.push(shape);
|
|
29037
|
+
else if (element2.localName === "pic")
|
|
29038
|
+
issues.push({
|
|
29039
|
+
code: "DIAGRAM_DRAWING_PICTURE_UNREADABLE",
|
|
29040
|
+
message: "A cached picture has no usable frame; its source is retained in the drawing part."
|
|
29041
|
+
});
|
|
28433
29042
|
} else if (element2.localName === "grpSp") visit(element2, groupTransform(element2, group));
|
|
28434
|
-
else if (element2.localName === "pic")
|
|
28435
|
-
issues.push({
|
|
28436
|
-
code: "DIAGRAM_DRAWING_PICTURE_SKIPPED",
|
|
28437
|
-
message: "A dsp:pic in the cached drawing is not modelled; the part still holds it."
|
|
28438
|
-
});
|
|
28439
29043
|
}
|
|
28440
29044
|
};
|
|
28441
29045
|
if (tree) visit(tree, IDENTITY);
|
|
@@ -28606,8 +29210,8 @@ function resolveDiagramDrawingShape(shape, options) {
|
|
|
28606
29210
|
return view;
|
|
28607
29211
|
}
|
|
28608
29212
|
var isDrawableDiagramShapeView = (view) => view.shapeType === "line" || view.width > 0 && view.height > 0;
|
|
28609
|
-
function readDiagramDrawingShapes(
|
|
28610
|
-
const drawing = parseDiagramDrawing(
|
|
29213
|
+
function readDiagramDrawingShapes(source2, options, part) {
|
|
29214
|
+
const drawing = parseDiagramDrawing(source2, part);
|
|
28611
29215
|
return {
|
|
28612
29216
|
shapes: drawing.shapes.map((shape) => resolveDiagramDrawingShape(shape, options)).filter(isDrawableDiagramShapeView),
|
|
28613
29217
|
issues: drawing.issues
|
|
@@ -28699,7 +29303,29 @@ async function loadDiagram(hostPart, relationshipIds, host) {
|
|
|
28699
29303
|
);
|
|
28700
29304
|
return parseDiagramDrawing(xml, part);
|
|
28701
29305
|
});
|
|
28702
|
-
if (drawing)
|
|
29306
|
+
if (drawing) {
|
|
29307
|
+
try {
|
|
29308
|
+
const entries = await host.readRelationshipEntries(
|
|
29309
|
+
diagramRelationshipsPart(drawingResolution.path)
|
|
29310
|
+
);
|
|
29311
|
+
const pictures = (entries ?? []).filter(
|
|
29312
|
+
(entry) => entry.type.endsWith("/image") && entry.mode !== "External" && !/^[a-z][a-z0-9+.-]*:/i.test(entry.target)
|
|
29313
|
+
);
|
|
29314
|
+
if (pictures.length)
|
|
29315
|
+
drawing.pictureParts = Object.fromEntries(
|
|
29316
|
+
pictures.map((entry) => [
|
|
29317
|
+
entry.id,
|
|
29318
|
+
host.resolvePath(drawingResolution.path, entry.target)
|
|
29319
|
+
])
|
|
29320
|
+
);
|
|
29321
|
+
} catch {
|
|
29322
|
+
issues.push({
|
|
29323
|
+
code: "DIAGRAM_PICTURE_RELATIONSHIPS_UNREADABLE",
|
|
29324
|
+
message: "Picture relationships in the cached drawing could not be read."
|
|
29325
|
+
});
|
|
29326
|
+
}
|
|
29327
|
+
issues.push(...drawing.issues);
|
|
29328
|
+
}
|
|
28703
29329
|
} else if (data)
|
|
28704
29330
|
issues.push({
|
|
28705
29331
|
code: "DIAGRAM_DRAWING_ABSENT",
|