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