@mechane-ai/elements 0.45.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +353 -50
- package/bin/mechane-elements-catalog.mjs +42 -4
- package/dist/ai.js +268 -202
- package/dist/catalog.json +2480 -71
- package/dist/categorical-values-DdfGIowV.js +107 -0
- package/dist/cells--Bd1fQFR.js +384 -0
- package/dist/chart-cursor-1mFd48Jc.js +23 -0
- package/dist/chart-link-AE_xuxiP.js +35 -0
- package/dist/chart-tones-ei3BC2AL.js +27 -0
- package/dist/charts/cartesian.js +1 -2792
- package/dist/charts/cells.js +1 -0
- package/dist/charts/comparison.js +1 -0
- package/dist/charts/distribution.js +1 -709
- package/dist/charts/figure.js +3404 -0
- package/dist/charts/graph.js +1 -641
- package/dist/charts/hierarchy.js +1 -112
- package/dist/charts/image.js +1 -0
- package/dist/charts/matrix.js +3 -637
- package/dist/charts/plot.js +15 -0
- package/dist/charts/relationship.js +1 -0
- package/dist/charts/text.js +1 -0
- package/dist/charts/timeline.js +1 -233
- package/dist/charts/transforms.js +677 -0
- package/dist/charts/trend.js +1 -0
- package/dist/charts.js +8 -3
- package/dist/{code-block-Cpfr7B6a.js → code-block-DioAM2bZ.js} +67 -52
- package/dist/collections.js +1 -1735
- package/dist/color-legend-CIo7DhXB.js +62 -0
- package/dist/content/code.js +1 -1
- package/dist/content/diff.js +67 -66
- package/dist/content/link.js +1 -1
- package/dist/content/markdown.js +2 -2
- package/dist/content/tree.js +2 -2
- package/dist/{content-link-CGeFFb9F.js → content-link-NWuHp5rC.js} +1 -1
- package/dist/content.js +1 -1
- package/dist/csp.js +6 -11
- package/dist/dates-Cww8UR_n.js +810 -0
- package/dist/dumbbell-plot-B2ZTgQaI.js +508 -0
- package/dist/embedding-map-CGM_k6lC.js +1929 -0
- package/dist/feedback.js +1 -1
- package/dist/figure-format-B8kRZMlo.js +36 -0
- package/dist/figure-frame-wRkIEAwe.js +270 -0
- package/dist/forms/dates.js +1 -750
- package/dist/{forms-DeU0Tiv3.js → forms-CEbwzlRR.js} +50 -41
- package/dist/forms.js +3 -3
- package/dist/heatmap-scale-Zte6Ya-g.js +20 -0
- package/dist/image-grid-CVA4SOy_.js +598 -0
- package/dist/index.js +1 -1
- package/dist/kits/evaluation.js +431 -0
- package/dist/kits/explainers.js +452 -0
- package/dist/kits/interpretability.js +1033 -0
- package/dist/kits/operations.js +239 -0
- package/dist/kits/training.js +335 -0
- package/dist/label-place-Z0fryBZb.js +42 -0
- package/dist/layout.js +207 -207
- package/dist/locate-Bcg3QcP4.js +11 -0
- package/dist/navigation.js +4 -3
- package/dist/packages/ai/src/conversation.d.ts +2 -0
- package/dist/packages/ai/src/prompt-input.d.ts +7 -2
- package/dist/packages/charts/src/cartesian/bar-chart.d.ts +40 -21
- package/dist/packages/charts/src/cartesian/bar-data.d.ts +15 -4
- package/dist/packages/charts/src/cartesian/bar-overlays.d.ts +7 -3
- package/dist/packages/charts/src/cartesian/breakdown-bar.d.ts +10 -8
- package/dist/packages/charts/src/cartesian/bridge-chart.d.ts +20 -16
- package/dist/packages/charts/src/cartesian/bridge-data.d.ts +5 -4
- package/dist/packages/charts/src/cartesian/composition-bars.d.ts +8 -4
- package/dist/packages/charts/src/cartesian/index.d.ts +6 -5
- package/dist/packages/charts/src/cartesian/reference-lines.d.ts +25 -18
- package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +37 -26
- package/dist/packages/charts/src/cartesian/sparkline.d.ts +14 -2
- package/dist/packages/charts/src/cartesian/time-series-bands.d.ts +3 -2
- package/dist/packages/charts/src/cartesian/time-series-data.d.ts +12 -2
- package/dist/packages/charts/src/cartesian/time-series-line.d.ts +2 -2
- package/dist/packages/charts/src/cartesian/time-series-overlays.d.ts +6 -4
- package/dist/packages/charts/src/cartesian/time-series.d.ts +61 -27
- package/dist/packages/charts/src/cartesian/value-labels.d.ts +22 -0
- package/dist/packages/charts/src/categorical-values.d.ts +15 -10
- package/dist/packages/charts/src/cells/bar-cell.d.ts +13 -0
- package/dist/packages/charts/src/cells/cell-layout.d.ts +81 -0
- package/dist/packages/charts/src/cells/change-cell.d.ts +17 -0
- package/dist/packages/charts/src/cells/heat-cell.d.ts +19 -0
- package/dist/packages/charts/src/cells/index.d.ts +11 -0
- package/dist/packages/charts/src/cells/interval-cell.d.ts +16 -0
- package/dist/packages/charts/src/cells/spark-cell.d.ts +22 -0
- package/dist/packages/charts/src/chart-frame.d.ts +17 -12
- package/dist/packages/charts/src/chart-grid.d.ts +19 -0
- package/dist/packages/charts/src/chart-input.d.ts +1 -9
- package/dist/packages/charts/src/chart-inspection.d.ts +1 -2
- package/dist/packages/charts/src/chart-link.d.ts +56 -0
- package/dist/packages/charts/src/chart-range.d.ts +33 -0
- package/dist/packages/charts/src/chart-rows.d.ts +20 -0
- package/dist/packages/charts/src/chart-theme.d.ts +17 -0
- package/dist/packages/charts/src/chart.d.ts +73 -0
- package/dist/packages/charts/src/comparison/bullet-bar.d.ts +34 -0
- package/dist/packages/charts/src/comparison/comparison-plot.d.ts +54 -0
- package/dist/packages/charts/src/comparison/dot-plot.d.ts +41 -0
- package/dist/packages/charts/src/comparison/dumbbell-plot.d.ts +33 -0
- package/dist/packages/charts/src/comparison/index.d.ts +6 -0
- package/dist/packages/charts/src/distribution/box-plot.d.ts +40 -0
- package/dist/packages/charts/src/distribution/distribution-input.d.ts +5 -3
- package/dist/packages/charts/src/distribution/distribution-plot.d.ts +28 -161
- package/dist/packages/charts/src/distribution/ecdf.d.ts +16 -15
- package/dist/packages/charts/src/distribution/group-plot-input.d.ts +35 -0
- package/dist/packages/charts/src/distribution/group-plot-layout.d.ts +79 -0
- package/dist/packages/charts/src/distribution/group-plot.d.ts +73 -0
- package/dist/packages/charts/src/distribution/histogram.d.ts +16 -16
- package/dist/packages/charts/src/distribution/index.d.ts +11 -0
- package/dist/packages/charts/src/distribution/interval-plot.d.ts +16 -13
- package/dist/packages/charts/src/distribution/ranked-bars.d.ts +17 -14
- package/dist/packages/charts/src/distribution/ridgeline.d.ts +34 -0
- package/dist/packages/charts/src/distribution/strip-plot.d.ts +37 -0
- package/dist/packages/charts/src/distribution/violin-plot.d.ts +34 -0
- package/dist/packages/charts/src/figure/figure-format.d.ts +34 -0
- package/dist/packages/charts/src/figure/figure-frame.d.ts +47 -0
- package/dist/packages/charts/src/figure/figure-props.d.ts +54 -0
- package/dist/packages/charts/src/figure/tone-scope.d.ts +32 -0
- package/dist/packages/charts/src/graph/attribution-graph.d.ts +62 -0
- package/dist/packages/charts/src/graph/attribution-layout.d.ts +88 -0
- package/dist/packages/charts/src/graph/flow-diagram.d.ts +14 -15
- package/dist/packages/charts/src/graph/flow-layout.d.ts +4 -2
- package/dist/packages/charts/src/graph/graph-canvas.d.ts +33 -0
- package/dist/packages/charts/src/graph/index.d.ts +6 -2
- package/dist/packages/charts/src/graph/relation-graph.d.ts +24 -13
- package/dist/packages/charts/src/graph/tree-diagram.d.ts +41 -0
- package/dist/packages/charts/src/graph/tree-layout.d.ts +71 -0
- package/dist/packages/charts/src/hierarchy/area-mark.d.ts +17 -0
- package/dist/packages/charts/src/hierarchy/icicle.d.ts +35 -0
- package/dist/packages/charts/src/hierarchy/index.d.ts +2 -0
- package/dist/packages/charts/src/hierarchy/partition-layout.d.ts +25 -0
- package/dist/packages/charts/src/hierarchy/treemap-layout.d.ts +26 -0
- package/dist/packages/charts/src/hierarchy/treemap.d.ts +11 -9
- package/dist/packages/charts/src/image/attribution-legend.d.ts +13 -0
- package/dist/packages/charts/src/image/attribution-overlay.d.ts +50 -0
- package/dist/packages/charts/src/image/attribution-ramp.d.ts +16 -0
- package/dist/packages/charts/src/image/image-atlas.d.ts +37 -0
- package/dist/packages/charts/src/image/image-fill.d.ts +9 -0
- package/dist/packages/charts/src/image/image-grid.d.ts +26 -0
- package/dist/packages/charts/src/image/image-input.d.ts +27 -0
- package/dist/packages/charts/src/image/image-tile.d.ts +27 -0
- package/dist/packages/charts/src/image/index.d.ts +7 -0
- package/dist/packages/charts/src/index.d.ts +16 -1
- package/dist/packages/charts/src/matrix/attention-matrix.d.ts +41 -0
- package/dist/packages/charts/src/matrix/calendar-heatmap.d.ts +37 -0
- package/dist/packages/charts/src/matrix/color-legend.d.ts +9 -2
- package/dist/packages/charts/src/matrix/confusion-matrix.d.ts +36 -0
- package/dist/packages/charts/src/matrix/correlation-matrix.d.ts +34 -0
- package/dist/packages/charts/src/matrix/heatmap-scale.d.ts +8 -2
- package/dist/packages/charts/src/matrix/index.d.ts +14 -3
- package/dist/packages/charts/src/matrix/matrix-cells.d.ts +27 -3
- package/dist/packages/charts/src/matrix/matrix-figure.d.ts +50 -0
- package/dist/packages/charts/src/matrix/matrix-mark.d.ts +34 -0
- package/dist/packages/charts/src/matrix/matrix-presets.d.ts +20 -0
- package/dist/packages/charts/src/matrix/matrix-range.d.ts +45 -0
- package/dist/packages/charts/src/matrix/matrix-strip.d.ts +13 -14
- package/dist/packages/charts/src/matrix/matrix-types.d.ts +40 -0
- package/dist/packages/charts/src/matrix/matrix.d.ts +13 -11
- package/dist/packages/charts/src/matrix/token-heatmap.d.ts +16 -10
- package/dist/packages/charts/src/plot/contours.d.ts +45 -0
- package/dist/packages/charts/src/plot/index.d.ts +49 -0
- package/dist/packages/charts/src/plot/label-place.d.ts +35 -0
- package/dist/packages/charts/src/plot/locate.d.ts +18 -0
- package/dist/packages/charts/src/plot/path.d.ts +39 -0
- package/dist/packages/charts/src/plot/plot-axes.d.ts +20 -0
- package/dist/packages/charts/src/plot/plot-layout.d.ts +221 -0
- package/dist/packages/charts/src/plot/plot-marks.d.ts +124 -0
- package/dist/packages/charts/src/plot/plot-surface.d.ts +32 -0
- package/dist/packages/charts/src/plot/render/density-layer.d.ts +17 -0
- package/dist/packages/charts/src/plot/render/hit-index.d.ts +37 -0
- package/dist/packages/charts/src/plot/render/plot-viewport.d.ts +39 -0
- package/dist/packages/charts/src/plot/render/point-layer.d.ts +41 -0
- package/dist/packages/charts/src/plot/render/theme-colors.d.ts +15 -0
- package/dist/packages/charts/src/plot/scale.d.ts +48 -0
- package/dist/packages/charts/src/plot/ticks.d.ts +34 -0
- package/dist/packages/charts/src/plot-width.d.ts +3 -3
- package/dist/packages/charts/src/relationship/contour-plot.d.ts +61 -0
- package/dist/packages/charts/src/relationship/density-map.d.ts +45 -0
- package/dist/packages/charts/src/relationship/embedding-map.d.ts +75 -0
- package/dist/packages/charts/src/relationship/index.d.ts +11 -0
- package/dist/packages/charts/src/relationship/level-legend.d.ts +11 -0
- package/dist/packages/charts/src/relationship/measures.d.ts +85 -0
- package/dist/packages/charts/src/relationship/parallel-coordinates.d.ts +30 -0
- package/dist/packages/charts/src/relationship/range-controls.d.ts +20 -0
- package/dist/packages/charts/src/relationship/scatter-matrix.d.ts +20 -0
- package/dist/packages/charts/src/spec/chart-guide.d.ts +21 -0
- package/dist/packages/charts/src/spec/figure-registry.d.ts +44 -0
- package/dist/packages/charts/src/spec/figure-spec.d.ts +147 -0
- package/dist/packages/charts/src/spec/figure-text.d.ts +8 -0
- package/dist/packages/charts/src/spec/figure.d.ts +12 -0
- package/dist/packages/charts/src/spec/guide-data.d.ts +85 -0
- package/dist/packages/charts/src/spec/index.d.ts +10 -0
- package/dist/packages/charts/src/spec/validate-figure.d.ts +15 -0
- package/dist/packages/charts/src/text/index.d.ts +11 -0
- package/dist/packages/charts/src/text/token-examples.d.ts +42 -0
- package/dist/packages/charts/src/text/token-grid.d.ts +47 -0
- package/dist/packages/charts/src/text/token-links.d.ts +49 -0
- package/dist/packages/charts/src/text/token-predictions.d.ts +38 -0
- package/dist/packages/charts/src/text/token-scale.d.ts +20 -0
- package/dist/packages/charts/src/text/token-text.d.ts +39 -0
- package/dist/packages/charts/src/timeline/event-strip.d.ts +70 -0
- package/dist/packages/charts/src/timeline/index.d.ts +3 -1
- package/dist/packages/charts/src/timeline/waterfall.d.ts +29 -14
- package/dist/packages/charts/src/transforms/bins.d.ts +91 -0
- package/dist/packages/charts/src/transforms/density.d.ts +53 -0
- package/dist/packages/charts/src/transforms/fits.d.ts +50 -0
- package/dist/packages/charts/src/transforms/index.d.ts +19 -0
- package/dist/packages/charts/src/transforms/matrices.d.ts +49 -0
- package/dist/packages/charts/src/transforms/quantiles.d.ts +96 -0
- package/dist/packages/charts/src/transforms/ranks.d.ts +44 -0
- package/dist/packages/charts/src/transforms/runs.d.ts +47 -0
- package/dist/packages/charts/src/transforms/sampling.d.ts +75 -0
- package/dist/packages/charts/src/transforms/smoothing.d.ts +41 -0
- package/dist/packages/charts/src/transforms/values.d.ts +70 -0
- package/dist/packages/charts/src/trend/bump-chart.d.ts +33 -0
- package/dist/packages/charts/src/trend/column-figure.d.ts +38 -0
- package/dist/packages/charts/src/trend/column-positions.d.ts +21 -0
- package/dist/packages/charts/src/trend/curve-chart.d.ts +69 -0
- package/dist/packages/charts/src/trend/end-labels.d.ts +40 -0
- package/dist/packages/charts/src/trend/horizon-chart.d.ts +37 -0
- package/dist/packages/charts/src/trend/index.d.ts +10 -0
- package/dist/packages/charts/src/trend/line-locate.d.ts +21 -0
- package/dist/packages/charts/src/trend/runs-chart.d.ts +50 -0
- package/dist/packages/charts/src/trend/slope-chart.d.ts +35 -0
- package/dist/packages/collections/src/collection-controls.d.ts +5 -1
- package/dist/packages/collections/src/collection-filters.d.ts +4 -1
- package/dist/packages/collections/src/control-toolbar.d.ts +13 -0
- package/dist/packages/collections/src/data-table-layout.d.ts +78 -0
- package/dist/packages/collections/src/data-table-rows.d.ts +54 -0
- package/dist/packages/collections/src/data-table-styles.d.ts +340 -0
- package/dist/packages/collections/src/data-table-text.d.ts +13 -0
- package/dist/packages/collections/src/data-table-trigger.d.ts +23 -0
- package/dist/packages/collections/src/data-table.d.ts +3 -85
- package/dist/packages/collections/src/index.d.ts +11 -6
- package/dist/packages/collections/src/query-controls.d.ts +6 -2
- package/dist/packages/collections/src/table-results.d.ts +47 -13
- package/dist/packages/collections/src/timeline.d.ts +1 -0
- package/dist/packages/collections/src/use-collection-controls.d.ts +2 -1
- package/dist/packages/collections/src/use-table-window.d.ts +25 -0
- package/dist/packages/content/src/viewer.d.ts +8 -0
- package/dist/packages/core/src/disclosure.d.ts +9 -1
- package/dist/packages/core/src/index.d.ts +1 -0
- package/dist/packages/core/src/route-link.d.ts +11 -0
- package/dist/packages/forms/src/dates/date-inputs.d.ts +3 -1
- package/dist/packages/forms/src/file-picker.d.ts +15 -0
- package/dist/packages/forms/src/form-controls.d.ts +1 -6
- package/dist/packages/forms/src/forms.d.ts +4 -1
- package/dist/packages/forms/src/index.d.ts +4 -2
- package/dist/packages/forms/src/selection.d.ts +14 -0
- package/dist/packages/foundations/src/csp/index.d.ts +1 -1
- package/dist/packages/foundations/src/csp/provider.d.ts +7 -2
- package/dist/packages/kits/src/evaluation/evaluation-data.d.ts +31 -0
- package/dist/packages/kits/src/evaluation/index.d.ts +8 -0
- package/dist/packages/kits/src/evaluation/leaderboard-cells.d.ts +62 -0
- package/dist/packages/kits/src/evaluation/leaderboard.d.ts +59 -0
- package/dist/packages/kits/src/evaluation/model-comparison.d.ts +59 -0
- package/dist/packages/kits/src/evaluation/score-breakdown.d.ts +33 -0
- package/dist/packages/kits/src/explainers/bound-value.d.ts +29 -0
- package/dist/packages/kits/src/explainers/figures.d.ts +31 -0
- package/dist/packages/kits/src/explainers/index.d.ts +8 -0
- package/dist/packages/kits/src/explainers/linked-target.d.ts +22 -0
- package/dist/packages/kits/src/explainers/story-steps.d.ts +46 -0
- package/dist/packages/kits/src/explainers/term.d.ts +29 -0
- package/dist/packages/kits/src/interpretability/attention-head-grid.d.ts +56 -0
- package/dist/packages/kits/src/interpretability/attribution-workbench.d.ts +29 -0
- package/dist/packages/kits/src/interpretability/embedding-atlas.d.ts +41 -0
- package/dist/packages/kits/src/interpretability/feature-card.d.ts +33 -0
- package/dist/packages/kits/src/interpretability/feature-list.d.ts +51 -0
- package/dist/packages/kits/src/interpretability/feature-logits.d.ts +23 -0
- package/dist/packages/kits/src/interpretability/features.d.ts +70 -0
- package/dist/packages/kits/src/interpretability/index.d.ts +16 -0
- package/dist/packages/kits/src/interpretability/kit-styles.d.ts +118 -0
- package/dist/packages/kits/src/interpretability/logit-lens.d.ts +50 -0
- package/dist/packages/kits/src/interpretability/node-panel.d.ts +32 -0
- package/dist/packages/kits/src/interpretability/shared-link.d.ts +8 -0
- package/dist/packages/kits/src/interpretability/steering-panel.d.ts +52 -0
- package/dist/packages/kits/src/operations/budget-board.d.ts +49 -0
- package/dist/packages/kits/src/operations/incident-timeline.d.ts +30 -0
- package/dist/packages/kits/src/operations/index.d.ts +6 -0
- package/dist/packages/kits/src/operations/service-health.d.ts +66 -0
- package/dist/packages/kits/src/training/index.d.ts +8 -0
- package/dist/packages/kits/src/training/run-dashboard.d.ts +49 -0
- package/dist/packages/kits/src/training/run-legend.d.ts +21 -0
- package/dist/packages/kits/src/training/run-marker.d.ts +5 -0
- package/dist/packages/kits/src/training/run-state.d.ts +7 -0
- package/dist/packages/kits/src/training/run-table.d.ts +63 -0
- package/dist/packages/kits/src/training/runs-overview.d.ts +20 -0
- package/dist/packages/kits/src/training/runs.d.ts +34 -0
- package/dist/packages/navigation/src/index.d.ts +1 -1
- package/dist/path-BglsXpnO.js +59 -0
- package/dist/{pierre-diff-B3tD3-6z.js → pierre-diff-DlvjyuJn.js} +1 -1
- package/dist/plot-axes-DJkLW4wk.js +100 -0
- package/dist/plot-layout-BEuoOHbs.js +911 -0
- package/dist/plot-marks-A64v7aTw.js +226 -0
- package/dist/plot-surface-CJTIqtck.js +51 -0
- package/dist/{plot-width-CIqBiHcd.js → plot-width-DcqtSgzb.js} +22 -3
- package/dist/point-layer-C-EYETAt.js +655 -0
- package/dist/reference-lines-CWA8VeUR.js +82 -0
- package/dist/scale-C2xgZyZN.js +63 -0
- package/dist/slope-chart-DT22h_ym.js +1279 -0
- package/dist/{src-gqEebHEa.js → src-1EHkSFS-.js} +395 -274
- package/dist/{src-DBNncL7_.js → src-BPTDJqt0.js} +48 -68
- package/dist/{src-Dcs3SZ9V.js → src-CExIrXPC.js} +170 -194
- package/dist/src-CGc_hjxJ.js +409 -0
- package/dist/{src-DcW_gMX8.js → src-CpdJlDhO.js} +480 -362
- package/dist/src-D5NXRJZe.js +2195 -0
- package/dist/src-DIS0YOj0.js +44 -0
- package/dist/styles2.css +574 -161
- package/dist/time-series-IB3CB93O.js +2668 -0
- package/dist/token-heatmap-C00DnoNO.js +1354 -0
- package/dist/token-predictions-Cxx29iDr.js +1093 -0
- package/dist/tone-scope-DKiSw-JR.js +32 -0
- package/dist/tree-diagram-DsckNKaW.js +1629 -0
- package/dist/treemap-9_DpLCW9.js +472 -0
- package/dist/values-963L6n1m.js +65 -0
- package/dist/violin-plot-BhPHKXsN.js +1291 -0
- package/dist/waterfall-CGksuTy5.js +576 -0
- package/package.json +57 -7
- package/recipes/allocation-report.tsx +15 -7
- package/skills/extend-elements/SKILL.md +134 -0
- package/skills/review-elements/SKILL.md +118 -0
- package/skills/upgrade-elements/SKILL.md +36 -0
- package/skills/upgrade-elements/references/releases.md +242 -0
- package/skills/use-elements/SKILL.md +70 -13
- package/skills/use-elements/references/agent.md +57 -0
- package/skills/use-elements/references/charts.md +384 -0
- package/skills/use-elements/references/collections.md +89 -0
- package/skills/use-elements/references/conversations.md +47 -0
- package/skills/use-elements/references/figures.md +173 -0
- package/skills/use-elements/references/forms.md +81 -0
- package/skills/use-elements/references/kits.md +198 -0
- package/skills/use-elements/references/styling.md +70 -0
- package/skills/use-elements/references/workspace.md +3 -3
- package/dist/categorical-values-DZLGQVW1.js +0 -63
- package/dist/chart-frame-Ztktqs1b.js +0 -255
- package/dist/chart-input-BO3BqlFO.js +0 -22
- package/dist/chart-navigation-BAbb5PV9.js +0 -154
- package/dist/header-styles-COxCYFZx.js +0 -90
- package/dist/packages/charts/src/chart-navigation.d.ts +0 -39
- package/dist/packages/charts/src/chart-surface.d.ts +0 -27
- package/dist/packages/navigation/src/route-link.d.ts +0 -2
- package/dist/src-Bk7M67zy.js +0 -396
|
@@ -0,0 +1,1629 @@
|
|
|
1
|
+
import { t as e } from "./accessibility-P89UG9-r.js";
|
|
2
|
+
import { T as t, k as n } from "./src-CpdJlDhO.js";
|
|
3
|
+
import { n as r, t as i } from "./chart-tones-ei3BC2AL.js";
|
|
4
|
+
import { A as a, C as o, E as s, O as c, S as l, T as u, c as d, k as f, w as p, x as m } from "./plot-layout-BEuoOHbs.js";
|
|
5
|
+
import { i as h } from "./chart-link-AE_xuxiP.js";
|
|
6
|
+
import { a as g } from "./tone-scope-DKiSw-JR.js";
|
|
7
|
+
import { r as _ } from "./figure-format-B8kRZMlo.js";
|
|
8
|
+
import { i as v, l as y, n as b, r as x, t as S } from "./figure-frame-wRkIEAwe.js";
|
|
9
|
+
import { n as C, t as w } from "./plot-width-DcqtSgzb.js";
|
|
10
|
+
import { a as T, c as E, p as D, u as O } from "./plot-marks-A64v7aTw.js";
|
|
11
|
+
import { r as k } from "./plot-surface-CJTIqtck.js";
|
|
12
|
+
import { t as A } from "./label-spacing-BncjePGb.js";
|
|
13
|
+
import { i as ee } from "./path-BglsXpnO.js";
|
|
14
|
+
import { m as j } from "./values-963L6n1m.js";
|
|
15
|
+
import * as M from "@stylexjs/stylex";
|
|
16
|
+
import { useEffect as N, useId as te, useRef as P, useState as F } from "react";
|
|
17
|
+
import { Fragment as I, jsx as L, jsxs as R } from "react/jsx-runtime";
|
|
18
|
+
var z = 16, B = 2, V = .5;
|
|
19
|
+
function H({ nodes: e, links: t, columns: n }) {
|
|
20
|
+
return new Map(e.map((e) => {
|
|
21
|
+
let r = t.filter((t) => t.targetId === e.id).map((e) => (n.get(e.sourceId) ?? 0) + 1);
|
|
22
|
+
return [e.id, Math.max(0, ...r)];
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
function ne({ nodes: e, links: t }) {
|
|
26
|
+
let n = new Map(e.map((e) => [e.id, 0]));
|
|
27
|
+
for (let r of e) n = H({
|
|
28
|
+
nodes: e,
|
|
29
|
+
links: t,
|
|
30
|
+
columns: n
|
|
31
|
+
});
|
|
32
|
+
let r = H({
|
|
33
|
+
nodes: e,
|
|
34
|
+
links: t,
|
|
35
|
+
columns: n
|
|
36
|
+
});
|
|
37
|
+
return e.every((e) => r.get(e.id) === n.get(e.id)) ? n : void 0;
|
|
38
|
+
}
|
|
39
|
+
function U(e) {
|
|
40
|
+
return e.reduce((e, t) => e + t, 0);
|
|
41
|
+
}
|
|
42
|
+
function W(e) {
|
|
43
|
+
return e.value ?? 0;
|
|
44
|
+
}
|
|
45
|
+
function G(e) {
|
|
46
|
+
return e.map((t, n) => U(e.slice(0, n)));
|
|
47
|
+
}
|
|
48
|
+
function re({ nodes: e, links: t, left: n, right: r, top: i, bottom: a, toneOf: o }) {
|
|
49
|
+
let s = ne({
|
|
50
|
+
nodes: e,
|
|
51
|
+
links: t
|
|
52
|
+
}) ?? /* @__PURE__ */ new Map(), c = Math.max(1, ...[...s.values()].map((e) => e + 1)), l = Array.from({ length: c }, (t, n) => e.filter((e) => s.get(e.id) === n)), u = e.map((e) => {
|
|
53
|
+
let n = t.filter((t) => t.targetId === e.id), r = t.filter((t) => t.sourceId === e.id), i = [...n, ...r].some((e) => e.value === null);
|
|
54
|
+
return {
|
|
55
|
+
id: e.id,
|
|
56
|
+
inflow: U(n.map(W)),
|
|
57
|
+
outflow: U(r.map(W)),
|
|
58
|
+
hasUnavailable: i
|
|
59
|
+
};
|
|
60
|
+
}), d = new Map(u.map((e) => [e.id, e]));
|
|
61
|
+
function f(e) {
|
|
62
|
+
let t = d.get(e.id);
|
|
63
|
+
return Math.max(t?.inflow ?? 0, t?.outflow ?? 0);
|
|
64
|
+
}
|
|
65
|
+
let p = a - i, m = Math.min(...l.map((e) => {
|
|
66
|
+
let t = U(e.map(f)), n = p - Math.max(0, e.length - 1) * z - e.length * B;
|
|
67
|
+
return t === 0 ? Infinity : Math.max(0, n) / t;
|
|
68
|
+
})), h = Number.isFinite(m) ? m : 0, g = c === 1 ? 0 : (r - n - 12) / (c - 1), _ = l.flatMap((t, r) => {
|
|
69
|
+
let a = t.map((e) => Math.max(B, f(e) * h)), s = U(a) + Math.max(0, t.length - 1) * z, c = i + (p - s) * V, l = G(a.map((e) => e + z));
|
|
70
|
+
return t.map((t, i) => {
|
|
71
|
+
let s = d.get(t.id);
|
|
72
|
+
return {
|
|
73
|
+
node: t,
|
|
74
|
+
tone: o(t, e.indexOf(t)),
|
|
75
|
+
column: r,
|
|
76
|
+
x: n + r * g,
|
|
77
|
+
y: c + (l[i] ?? 0),
|
|
78
|
+
height: a[i] ?? B,
|
|
79
|
+
inflow: s?.inflow ?? 0,
|
|
80
|
+
outflow: s?.outflow ?? 0,
|
|
81
|
+
hasUnavailable: s?.hasUnavailable ?? !1
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
}), v = new Map(_.map((e) => [e.node.id, e]));
|
|
85
|
+
function y(e) {
|
|
86
|
+
let t = v.get(e);
|
|
87
|
+
return t === void 0 ? 0 : t.y + t.height * V;
|
|
88
|
+
}
|
|
89
|
+
function b(e, t) {
|
|
90
|
+
let n = e.toSorted((e, n) => y(t(e)) - y(t(n))), r = G(n.map((e) => W(e) * h));
|
|
91
|
+
return new Map(n.map((e, t) => [e.id, r[t] ?? 0]));
|
|
92
|
+
}
|
|
93
|
+
let x = new Map(_.map((e) => [e.node.id, b(t.filter((t) => t.sourceId === e.node.id), (e) => e.targetId)])), S = new Map(_.map((e) => [e.node.id, b(t.filter((t) => t.targetId === e.node.id), (e) => e.sourceId)]));
|
|
94
|
+
return {
|
|
95
|
+
nodes: _,
|
|
96
|
+
links: t.flatMap((e) => {
|
|
97
|
+
let t = v.get(e.sourceId), n = v.get(e.targetId);
|
|
98
|
+
if (t === void 0 || n === void 0) return [];
|
|
99
|
+
let r = x.get(t.node.id)?.get(e.id) ?? 0, i = S.get(n.node.id)?.get(e.id) ?? 0;
|
|
100
|
+
return [{
|
|
101
|
+
link: e,
|
|
102
|
+
tone: e.tone ?? n.tone,
|
|
103
|
+
source: t,
|
|
104
|
+
target: n,
|
|
105
|
+
sourceY: t.y + r,
|
|
106
|
+
targetY: n.y + i,
|
|
107
|
+
width: W(e) * h
|
|
108
|
+
}];
|
|
109
|
+
}),
|
|
110
|
+
columnCount: c
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function ie(e) {
|
|
114
|
+
let t = e.source.x + 12, n = e.target.x, r = (t + n) * V, { sourceY: i, targetY: a, width: o } = e;
|
|
115
|
+
return [
|
|
116
|
+
`M${t},${i}`,
|
|
117
|
+
`C${r},${i} ${r},${a} ${n},${a}`,
|
|
118
|
+
`L${n},${a + o}`,
|
|
119
|
+
`C${r},${a + o} ${r},${i + o} ${t},${i + o}`,
|
|
120
|
+
"Z"
|
|
121
|
+
].join(" ");
|
|
122
|
+
}
|
|
123
|
+
function K(e) {
|
|
124
|
+
let t = e.source.x + 12, n = e.target.x, r = (t + n) * V, i = e.sourceY + e.width * V, a = e.targetY + e.width * V;
|
|
125
|
+
return `M${t},${i} C${r},${i} ${r},${a} ${n},${a}`;
|
|
126
|
+
}
|
|
127
|
+
// packages/charts/src/graph/flow-diagram.tsx
|
|
128
|
+
var q = {
|
|
129
|
+
kVYP8I: "x14kjgpu",
|
|
130
|
+
$$css: !0
|
|
131
|
+
}, J = {
|
|
132
|
+
kDwRjp: "xbh8q5q",
|
|
133
|
+
kfJifR: "xhr4kjn",
|
|
134
|
+
kREpy8: "x13efnbd",
|
|
135
|
+
$$css: !0
|
|
136
|
+
}, Y = {
|
|
137
|
+
kfJifR: "xnpr05h",
|
|
138
|
+
$$css: !0
|
|
139
|
+
}, X = {
|
|
140
|
+
ribbon: (e) => [
|
|
141
|
+
q,
|
|
142
|
+
{
|
|
143
|
+
kDwRjp: e == null ? e : "x19zyb68",
|
|
144
|
+
$$css: !0
|
|
145
|
+
},
|
|
146
|
+
{ "--x-fill": e ?? void 0 }
|
|
147
|
+
],
|
|
148
|
+
thread: (e) => [
|
|
149
|
+
J,
|
|
150
|
+
{
|
|
151
|
+
kjVXCG: e == null ? e : "x6mkzkt",
|
|
152
|
+
$$css: !0
|
|
153
|
+
},
|
|
154
|
+
{ "--x-stroke": e ?? void 0 }
|
|
155
|
+
],
|
|
156
|
+
unavailable: {
|
|
157
|
+
k5rJSQ: "x15lqr97",
|
|
158
|
+
$$css: !0
|
|
159
|
+
},
|
|
160
|
+
node: (e, t) => [
|
|
161
|
+
Y,
|
|
162
|
+
{
|
|
163
|
+
kDwRjp: e == null ? e : "x19zyb68",
|
|
164
|
+
kjVXCG: t == null ? t : "x6mkzkt",
|
|
165
|
+
$$css: !0
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"--x-fill": e ?? void 0,
|
|
169
|
+
"--x-stroke": t ?? void 0
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
lit: {
|
|
173
|
+
kVYP8I: "xif5ylx",
|
|
174
|
+
$$css: !0
|
|
175
|
+
},
|
|
176
|
+
dim: {
|
|
177
|
+
kSiTet: "xz5rk10",
|
|
178
|
+
$$css: !0
|
|
179
|
+
},
|
|
180
|
+
transition: {
|
|
181
|
+
k1ekBW: "x19991ni",
|
|
182
|
+
kIyJzY: "xtitasy x12w9bfk",
|
|
183
|
+
kAMwcw: "x1faw7qm",
|
|
184
|
+
$$css: !0
|
|
185
|
+
},
|
|
186
|
+
selected: {
|
|
187
|
+
kjVXCG: "x17y187c",
|
|
188
|
+
kfJifR: "xvlca1e",
|
|
189
|
+
kREpy8: "x13efnbd",
|
|
190
|
+
$$css: !0
|
|
191
|
+
},
|
|
192
|
+
interactive: {
|
|
193
|
+
kkrTdU: "x1ypdohk",
|
|
194
|
+
$$css: !0
|
|
195
|
+
}
|
|
196
|
+
}, Z = {
|
|
197
|
+
nodes: 64,
|
|
198
|
+
links: 256
|
|
199
|
+
}, ae = 8, Q = 8, oe = 16, se = 6.5, ce = 22, le = 180, ue = 48, de = 240, fe = 18, pe = 5;
|
|
200
|
+
function me({ nodes: e, links: t }) {
|
|
201
|
+
if (e.length > Z.nodes || t.length > Z.links) return `This flow exceeds the render limit of ${Z.nodes} nodes or ${Z.links} links. Supply a smaller, labelled grouping.`;
|
|
202
|
+
if (!a([...e, ...t])) return "Flow nodes and links require distinct, unique identifiers.";
|
|
203
|
+
let n = new Set(e.map((e) => e.id));
|
|
204
|
+
for (let e of t) {
|
|
205
|
+
if (!(n.has(e.sourceId) && n.has(e.targetId) && e.sourceId !== e.targetId)) return "Every flow link must join two different supplied nodes.";
|
|
206
|
+
if (e.value !== null && (!Number.isFinite(e.value) || e.value < 0)) return "Flow amounts must be finite and nonnegative, or explicitly unavailable.";
|
|
207
|
+
}
|
|
208
|
+
return ne({
|
|
209
|
+
nodes: e,
|
|
210
|
+
links: t
|
|
211
|
+
}) === void 0 ? "Flow links must not form a cycle." : void 0;
|
|
212
|
+
}
|
|
213
|
+
function he(e) {
|
|
214
|
+
return e.length > ce ? `${e.slice(0, 21)}…` : e;
|
|
215
|
+
}
|
|
216
|
+
function ge(e) {
|
|
217
|
+
return Math.max(e.inflow, e.outflow);
|
|
218
|
+
}
|
|
219
|
+
function _e({ placed: e, amountText: t }) {
|
|
220
|
+
let n = e.inflow > 0 && e.outflow > 0 && e.inflow !== e.outflow ? `in ${t(e.inflow)}, out ${t(e.outflow)}` : t(ge(e));
|
|
221
|
+
return e.hasUnavailable ? `${n}, with an unavailable amount` : n;
|
|
222
|
+
}
|
|
223
|
+
function ve({ placed: e, amountText: t }) {
|
|
224
|
+
let n = e.link.value === null ? "Unavailable" : t(e.link.value);
|
|
225
|
+
return `${e.source.node.label} → ${e.target.node.label}: ${n}`;
|
|
226
|
+
}
|
|
227
|
+
function ye({ nodes: e, links: t, amountText: n }) {
|
|
228
|
+
let r = e.map((e) => {
|
|
229
|
+
let r = t.filter((t) => t.targetId === e.id).reduce((e, t) => e + (t.value ?? 0), 0), i = t.filter((t) => t.sourceId === e.id).reduce((e, t) => e + (t.value ?? 0), 0), a = Math.max(r, i);
|
|
230
|
+
return he(e.label).length + n(a).length + 1;
|
|
231
|
+
});
|
|
232
|
+
return Math.min(le, Math.max(0, ...r) * se + Q);
|
|
233
|
+
}
|
|
234
|
+
function be(e) {
|
|
235
|
+
let { nodes: t, links: n, valueFormat: a, height: o, selected: m, onSelectedChange: T, ...E } = e, { emptyLabel: D = "No flows", ...O } = E, { locale: k, title: A } = O, { ref: ee, width: j } = w(), N = g(), P = h();
|
|
236
|
+
function F(e) {
|
|
237
|
+
return _({
|
|
238
|
+
value: e,
|
|
239
|
+
locale: k,
|
|
240
|
+
format: a
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
let I = me({
|
|
244
|
+
nodes: t,
|
|
245
|
+
links: n
|
|
246
|
+
}), z = (I === void 0 ? ne({
|
|
247
|
+
nodes: t,
|
|
248
|
+
links: n
|
|
249
|
+
}) : void 0) ?? /* @__PURE__ */ new Map(), B = Math.max(0, ...z.values()), V = Array.from({ length: B + 1 }, (e, n) => t.filter((e) => z.get(e.id) === n).length), H = o === void 0 ? Math.max(de, Math.max(...V) * ue) : d[o], U = B === 0 ? [] : t.filter((e) => z.get(e.id) === 0), W = t.filter((e) => z.get(e.id) === B), G = ye({
|
|
250
|
+
nodes: U,
|
|
251
|
+
links: n,
|
|
252
|
+
amountText: F
|
|
253
|
+
}), q = ye({
|
|
254
|
+
nodes: W,
|
|
255
|
+
links: n,
|
|
256
|
+
amountText: F
|
|
257
|
+
}), J = ae + (B > 1 ? fe : 0), Y = re({
|
|
258
|
+
nodes: I === void 0 ? t : [],
|
|
259
|
+
links: I === void 0 ? n : [],
|
|
260
|
+
left: G,
|
|
261
|
+
right: Math.max(G + 12, j - q),
|
|
262
|
+
top: J,
|
|
263
|
+
bottom: H - ae,
|
|
264
|
+
toneOf: (e, t) => N({
|
|
265
|
+
id: e.id,
|
|
266
|
+
tone: e.tone,
|
|
267
|
+
index: t
|
|
268
|
+
})
|
|
269
|
+
}), Z = Y.nodes.flatMap((e) => [{
|
|
270
|
+
id: e.node.id,
|
|
271
|
+
label: `${e.node.label}: ${_e({
|
|
272
|
+
placed: e,
|
|
273
|
+
amountText: F
|
|
274
|
+
})}`
|
|
275
|
+
}, ...Y.links.filter((t) => t.source.node.id === e.node.id).map((e) => ({
|
|
276
|
+
id: e.link.id,
|
|
277
|
+
label: ve({
|
|
278
|
+
placed: e,
|
|
279
|
+
amountText: F
|
|
280
|
+
})
|
|
281
|
+
}))]), Q = te();
|
|
282
|
+
return O.status === "loading" ? /* @__PURE__ */ L(v, {
|
|
283
|
+
...O,
|
|
284
|
+
height: o ?? "regular"
|
|
285
|
+
}) : I === void 0 ? /* @__PURE__ */ L(p, {
|
|
286
|
+
...P,
|
|
287
|
+
items: Z,
|
|
288
|
+
arrows: "both",
|
|
289
|
+
selected: m ?? null,
|
|
290
|
+
onSelect: T,
|
|
291
|
+
render: (e, { inspected: n, cursor: a }) => {
|
|
292
|
+
let o = Y.links.find((e) => e.link.id === n), d = Y.nodes.find((e) => e.node.id === n);
|
|
293
|
+
function p(e) {
|
|
294
|
+
return o === void 0 ? d !== void 0 && [e.source.node.id, e.target.node.id].includes(d.node.id) : o.link.id === e.link.id;
|
|
295
|
+
}
|
|
296
|
+
function h(e) {
|
|
297
|
+
return o === void 0 ? d === void 0 || d.node.id === e.node.id || Y.links.some((t) => p(t) && [t.source.node.id, t.target.node.id].includes(e.node.id)) : [o.source.node.id, o.target.node.id].includes(e.node.id);
|
|
298
|
+
}
|
|
299
|
+
let g = n !== null;
|
|
300
|
+
return /* @__PURE__ */ R(b, {
|
|
301
|
+
...O,
|
|
302
|
+
figure: e,
|
|
303
|
+
footer: /* @__PURE__ */ L(l, {
|
|
304
|
+
id: Q,
|
|
305
|
+
children: c(Z, n)
|
|
306
|
+
}),
|
|
307
|
+
children: [/* @__PURE__ */ L(y, {
|
|
308
|
+
label: `${A} flows`,
|
|
309
|
+
columns: [{
|
|
310
|
+
id: "item",
|
|
311
|
+
label: "Item"
|
|
312
|
+
}, {
|
|
313
|
+
id: "amount",
|
|
314
|
+
label: "Amount"
|
|
315
|
+
}],
|
|
316
|
+
rows: [...Y.nodes.map((e) => ({
|
|
317
|
+
id: `node:${e.node.id}`,
|
|
318
|
+
values: [e.node.label, _e({
|
|
319
|
+
placed: e,
|
|
320
|
+
amountText: F
|
|
321
|
+
})]
|
|
322
|
+
})), ...Y.links.map((e) => ({
|
|
323
|
+
id: `link:${e.link.id}`,
|
|
324
|
+
values: [`${e.source.node.label} → ${e.target.node.label}`, e.link.value === null ? "Unavailable" : F(e.link.value)]
|
|
325
|
+
}))]
|
|
326
|
+
}), /* @__PURE__ */ L("div", {
|
|
327
|
+
ref: ee,
|
|
328
|
+
children: t.length === 0 ? /* @__PURE__ */ L(S, { children: D }) : /* @__PURE__ */ L(s, {
|
|
329
|
+
role: "group",
|
|
330
|
+
"aria-label": f({
|
|
331
|
+
title: A,
|
|
332
|
+
isSelectable: T !== void 0
|
|
333
|
+
}),
|
|
334
|
+
"aria-describedby": Q,
|
|
335
|
+
className: "xeuugli x1we84gm x1t137rt x13qnu6 x19rmrnh x9v5kkp x7s97pk x-default-marker",
|
|
336
|
+
children: /* @__PURE__ */ R("svg", {
|
|
337
|
+
"aria-hidden": !0,
|
|
338
|
+
viewBox: `0 0 ${j} ${H}`,
|
|
339
|
+
height: H,
|
|
340
|
+
className: "x1lliihq xh8yej3 x1rea2x4",
|
|
341
|
+
children: [
|
|
342
|
+
/* @__PURE__ */ L("g", { children: Y.links.map((e) => {
|
|
343
|
+
let t = i[e.tone], n = p(e), r = e.width > 0, o = m === e.link.id, s = !g && !o && a === e.link.id;
|
|
344
|
+
return /* @__PURE__ */ L(u, {
|
|
345
|
+
value: e.link.id,
|
|
346
|
+
render: /* @__PURE__ */ L("path", { d: r ? ie(e) : K(e) }),
|
|
347
|
+
...M.props(r ? X.ribbon(t) : X.thread(t), e.link.value === null && X.unavailable, X.transition, n && r && X.lit, g && !n && X.dim, o && X.selected, T !== void 0 && X.interactive, s && (r ? C.shapeCursor : C.cursor))
|
|
348
|
+
}, e.link.id);
|
|
349
|
+
}) }),
|
|
350
|
+
Y.nodes.map((e) => /* @__PURE__ */ L(u, {
|
|
351
|
+
value: e.node.id,
|
|
352
|
+
render: /* @__PURE__ */ L("rect", {
|
|
353
|
+
x: e.x,
|
|
354
|
+
y: e.y,
|
|
355
|
+
width: 12,
|
|
356
|
+
height: e.height
|
|
357
|
+
}),
|
|
358
|
+
...M.props(X.node(i[e.tone], r[e.tone]), X.transition, g && !h(e) && X.dim, m === e.node.id && X.selected, T !== void 0 && X.interactive, !g && a === e.node.id && C.cursor)
|
|
359
|
+
}, e.node.id)),
|
|
360
|
+
/* @__PURE__ */ L(xe, {
|
|
361
|
+
nodes: Y.nodes,
|
|
362
|
+
columnCount: Y.columnCount,
|
|
363
|
+
width: j,
|
|
364
|
+
top: J,
|
|
365
|
+
bottom: H - ae,
|
|
366
|
+
amountText: F,
|
|
367
|
+
isLit: (e) => !g || h(e)
|
|
368
|
+
})
|
|
369
|
+
]
|
|
370
|
+
})
|
|
371
|
+
})
|
|
372
|
+
})]
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
}) : /* @__PURE__ */ L(x, {
|
|
376
|
+
...O,
|
|
377
|
+
message: I
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
function xe({ nodes: e, columnCount: t, width: n, top: r, bottom: i, amountText: a, isLit: o }) {
|
|
381
|
+
let s = Array.from({ length: t }, (t, n) => e.filter((e) => e.column === n));
|
|
382
|
+
return /* @__PURE__ */ L("g", { children: s.map((e, s) => {
|
|
383
|
+
let c = s === 0 && t > 1, l = s > 0 && s < t - 1, u = A({
|
|
384
|
+
positions: e.map((e) => e.y + e.height / 2),
|
|
385
|
+
gap: oe,
|
|
386
|
+
start: r,
|
|
387
|
+
end: i
|
|
388
|
+
});
|
|
389
|
+
return e.map((e, t) => {
|
|
390
|
+
let r = he(e.node.label), i = a(ge(e)), s = (r.length + i.length + 1) * se / 2, d = c ? e.x - Q : e.x + 12 + Q, f = Math.min(n - s, Math.max(s, e.x + 6));
|
|
391
|
+
return /* @__PURE__ */ R("text", {
|
|
392
|
+
x: l ? f : d,
|
|
393
|
+
y: l ? e.y - pe : u[t] ?? e.y,
|
|
394
|
+
textAnchor: l ? "middle" : c ? "end" : "start",
|
|
395
|
+
dominantBaseline: l ? "auto" : "middle",
|
|
396
|
+
...M.props(C.label, C.haloLabel, X.transition, !o(e) && X.dim),
|
|
397
|
+
children: [
|
|
398
|
+
/* @__PURE__ */ L("tspan", {
|
|
399
|
+
...M.props(C.strongLabel),
|
|
400
|
+
children: r
|
|
401
|
+
}),
|
|
402
|
+
" ",
|
|
403
|
+
i
|
|
404
|
+
]
|
|
405
|
+
}, e.node.id);
|
|
406
|
+
});
|
|
407
|
+
}) });
|
|
408
|
+
}
|
|
409
|
+
// packages/charts/src/graph/relation-graph.tsx
|
|
410
|
+
var Se = 2, Ce = 80;
|
|
411
|
+
function we(e, t) {
|
|
412
|
+
let n = e.width * Math.min(1, t);
|
|
413
|
+
return {
|
|
414
|
+
...e,
|
|
415
|
+
x: (e.x + e.width / 2) * t - n / 2,
|
|
416
|
+
width: n
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
var Te = {
|
|
420
|
+
kVAEAm: "x1n2onr6",
|
|
421
|
+
$$css: !0
|
|
422
|
+
}, Ee = {
|
|
423
|
+
canvas: (e, t) => [
|
|
424
|
+
Te,
|
|
425
|
+
{
|
|
426
|
+
kzqmXN: e == null ? e : "x5lhr3w",
|
|
427
|
+
kZKoxP: t == null ? t : "x16ye13r",
|
|
428
|
+
$$css: !0
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
"--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
|
|
432
|
+
"--x-height": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
|
|
433
|
+
}
|
|
434
|
+
],
|
|
435
|
+
node: {
|
|
436
|
+
kVAEAm: "x10l6tqk",
|
|
437
|
+
k1xSpc: "x78zum5",
|
|
438
|
+
kXwgrk: "xdt5ytf",
|
|
439
|
+
kjj79g: "xl56j7k",
|
|
440
|
+
kB7OPa: "x9f619",
|
|
441
|
+
kg3NbH: "x1doqdfy",
|
|
442
|
+
k8WAf4: "xn9t2bk",
|
|
443
|
+
kOIVth: "xfko13i",
|
|
444
|
+
kMzoRj: "xmkeg23",
|
|
445
|
+
ksu8eU: "x1y0btm7",
|
|
446
|
+
kVAM5u: "x1ey3b81",
|
|
447
|
+
kZ1KPB: "x1vo0akb",
|
|
448
|
+
kMwMTN: "xbixft",
|
|
449
|
+
kWkggS: "xpvm0e4",
|
|
450
|
+
k9WMMc: "x1yc453h",
|
|
451
|
+
kMv6JI: "x1hz01jw",
|
|
452
|
+
k63SB2: "xj57cvi",
|
|
453
|
+
kAzted: "x17tes2r x17oiadl",
|
|
454
|
+
$$css: !0
|
|
455
|
+
},
|
|
456
|
+
position: (e, t) => [{
|
|
457
|
+
kbCHJM: e == null ? e : "xgq9j65",
|
|
458
|
+
k87sOh: t == null ? t : "xjbys53",
|
|
459
|
+
$$css: !0
|
|
460
|
+
}, {
|
|
461
|
+
"--x-left": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
|
|
462
|
+
"--x-top": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
|
|
463
|
+
}],
|
|
464
|
+
size: (e, t) => [{
|
|
465
|
+
kzqmXN: e == null ? e : "x5lhr3w",
|
|
466
|
+
kZKoxP: t == null ? t : "x16ye13r",
|
|
467
|
+
$$css: !0
|
|
468
|
+
}, {
|
|
469
|
+
"--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
|
|
470
|
+
"--x-height": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
|
|
471
|
+
}],
|
|
472
|
+
tone: (e) => [{
|
|
473
|
+
kaZRDh: e == null ? e : "xsb5j7k",
|
|
474
|
+
$$css: !0
|
|
475
|
+
}, { "--x-borderLeftColor": e ?? void 0 }],
|
|
476
|
+
action: {
|
|
477
|
+
kkrTdU: "x1ypdohk",
|
|
478
|
+
k3XXqK: "x1t137rt",
|
|
479
|
+
kGzVvX: "xif5pkx",
|
|
480
|
+
kSReZ0: "x1ecmtor",
|
|
481
|
+
kPJHz1: "x13qnu6",
|
|
482
|
+
kZs9gx: "x19rmrnh",
|
|
483
|
+
k7shQP: "x9v5kkp",
|
|
484
|
+
kiEn40: "x1bqaal",
|
|
485
|
+
$$css: !0
|
|
486
|
+
},
|
|
487
|
+
selected: {
|
|
488
|
+
kMeerF: "x12ei19c",
|
|
489
|
+
kjBf7l: "xx9gdjd",
|
|
490
|
+
k3XXqK: "xaatb59",
|
|
491
|
+
kInvED: "x2ssjo2",
|
|
492
|
+
$$css: !0
|
|
493
|
+
}
|
|
494
|
+
}, $ = {
|
|
495
|
+
nodes: 256,
|
|
496
|
+
edges: 1024,
|
|
497
|
+
groups: 256,
|
|
498
|
+
dimension: 8192
|
|
499
|
+
};
|
|
500
|
+
function De(e) {
|
|
501
|
+
return [
|
|
502
|
+
"compact",
|
|
503
|
+
"regular",
|
|
504
|
+
"tall"
|
|
505
|
+
].toSorted((t, n) => Math.abs(d[t] - e) - Math.abs(d[n] - e))[0] ?? "regular";
|
|
506
|
+
}
|
|
507
|
+
function Oe(e) {
|
|
508
|
+
let { nodes: t, edges: n, groups: r = [], width: a, height: o, selected: d, onSelectedChange: m, ..._ } = e, { emptyLabel: T = "No nodes were supplied.", ...E } = _, { title: D } = E, O = g(), k = t.map((e) => ({
|
|
509
|
+
id: e.id,
|
|
510
|
+
label: [e.label, e.description].filter((e) => e !== void 0).join(", ")
|
|
511
|
+
})), A = te(), ee = te(), j = w(), N = h();
|
|
512
|
+
if (E.status === "loading") return /* @__PURE__ */ L(v, {
|
|
513
|
+
...E,
|
|
514
|
+
height: De(o)
|
|
515
|
+
});
|
|
516
|
+
let P = ke({
|
|
517
|
+
nodes: t,
|
|
518
|
+
edges: n,
|
|
519
|
+
groups: r,
|
|
520
|
+
width: a,
|
|
521
|
+
height: o
|
|
522
|
+
});
|
|
523
|
+
if (P !== null) return /* @__PURE__ */ L(x, {
|
|
524
|
+
...E,
|
|
525
|
+
message: P
|
|
526
|
+
});
|
|
527
|
+
let F = Math.min(...t.map((e) => e.width)), I = Math.max((j.width - Se) / a, Math.min(1, Ce / F)), z = a * I, B = t.map((e) => we(e, I)), V = r.map((e) => ({
|
|
528
|
+
...e,
|
|
529
|
+
x: e.x * I,
|
|
530
|
+
width: e.width * I
|
|
531
|
+
})), H = new Map(B.map((e) => [e.id, e])), ne = Ae(n, H), U = t.length > 0;
|
|
532
|
+
return ne === null ? /* @__PURE__ */ L(x, {
|
|
533
|
+
...E,
|
|
534
|
+
message: "Every relationship must refer to two supplied nodes."
|
|
535
|
+
}) : /* @__PURE__ */ L(p, {
|
|
536
|
+
...N,
|
|
537
|
+
items: k,
|
|
538
|
+
place: (e) => {
|
|
539
|
+
let t = H.get(e);
|
|
540
|
+
return t === void 0 ? void 0 : {
|
|
541
|
+
left: t.x,
|
|
542
|
+
top: t.y,
|
|
543
|
+
right: t.x + t.width,
|
|
544
|
+
bottom: t.y + t.height
|
|
545
|
+
};
|
|
546
|
+
},
|
|
547
|
+
selected: d ?? null,
|
|
548
|
+
onSelect: m,
|
|
549
|
+
render: (e, { inspected: n, cursor: a }) => /* @__PURE__ */ R(b, {
|
|
550
|
+
...E,
|
|
551
|
+
figure: e,
|
|
552
|
+
footer: /* @__PURE__ */ L(l, {
|
|
553
|
+
id: A,
|
|
554
|
+
children: c(k, n)
|
|
555
|
+
}),
|
|
556
|
+
children: [U ? /* @__PURE__ */ L("div", {
|
|
557
|
+
ref: j.ref,
|
|
558
|
+
className: "xeuugli x41o525",
|
|
559
|
+
children: /* @__PURE__ */ L(s, {
|
|
560
|
+
role: "group",
|
|
561
|
+
"aria-label": f({
|
|
562
|
+
title: D,
|
|
563
|
+
isSelectable: m !== void 0
|
|
564
|
+
}),
|
|
565
|
+
"aria-describedby": A,
|
|
566
|
+
className: "xysyzu8 xzuc9lq xeuugli x1t137rt xmkeg23 x1y0btm7 x1ey3b81 x13qnu6 x19rmrnh x9v5kkp x1bqaal x-default-marker",
|
|
567
|
+
children: /* @__PURE__ */ R("div", {
|
|
568
|
+
...M.props(Ee.canvas(z, o)),
|
|
569
|
+
children: [/* @__PURE__ */ R("svg", {
|
|
570
|
+
width: z,
|
|
571
|
+
height: o,
|
|
572
|
+
"aria-hidden": !0,
|
|
573
|
+
className: "x10l6tqk x10a8y8t x1lliihq",
|
|
574
|
+
children: [
|
|
575
|
+
/* @__PURE__ */ L("defs", { children: /* @__PURE__ */ L("marker", {
|
|
576
|
+
id: ee,
|
|
577
|
+
markerWidth: 8,
|
|
578
|
+
markerHeight: 8,
|
|
579
|
+
refX: 7,
|
|
580
|
+
refY: 4,
|
|
581
|
+
orient: "auto",
|
|
582
|
+
markerUnits: "userSpaceOnUse",
|
|
583
|
+
children: /* @__PURE__ */ L("path", {
|
|
584
|
+
d: "M0,0 L8,4 L0,8 Z",
|
|
585
|
+
className: "x8futc7"
|
|
586
|
+
})
|
|
587
|
+
}) }),
|
|
588
|
+
V.map((e) => /* @__PURE__ */ R("g", { children: [/* @__PURE__ */ L("rect", {
|
|
589
|
+
x: e.x,
|
|
590
|
+
y: e.y,
|
|
591
|
+
width: e.width,
|
|
592
|
+
height: e.height,
|
|
593
|
+
className: "x2wnxhi x13hfdr1 xnpr05h"
|
|
594
|
+
}), /* @__PURE__ */ L("svg", {
|
|
595
|
+
x: e.x,
|
|
596
|
+
y: e.y,
|
|
597
|
+
width: e.width,
|
|
598
|
+
height: e.height,
|
|
599
|
+
overflow: "hidden",
|
|
600
|
+
children: /* @__PURE__ */ L("text", {
|
|
601
|
+
x: 12,
|
|
602
|
+
y: 20,
|
|
603
|
+
className: "x1q7gtio x1hz01jw xy8obcc",
|
|
604
|
+
children: e.label
|
|
605
|
+
})
|
|
606
|
+
})] }, e.id)),
|
|
607
|
+
ne.map(({ edge: e, source: t, target: n }) => {
|
|
608
|
+
let r = t.x < n.x, i = t.x + (r ? t.width : 0), a = n.x + (r ? 0 : n.width), o = t.y + t.height / 2, s = n.y + n.height / 2, c = (i + a) / 2, l = t.x + t.width / 2, u = t.id === n.id ? `M${l - 12},${t.y} C${l - 48},${t.y - 36} ${l + 48},${t.y - 36} ${l + 12},${t.y}` : `M${i},${o} C${c},${o} ${c},${s} ${a},${s}`;
|
|
609
|
+
return /* @__PURE__ */ L("path", {
|
|
610
|
+
d: u,
|
|
611
|
+
markerEnd: e.direction === "directed" ? `url(#${ee})` : void 0,
|
|
612
|
+
className: "xbh8q5q x1crw9hw xhr4kjn",
|
|
613
|
+
children: /* @__PURE__ */ L("title", { children: e.label })
|
|
614
|
+
}, e.id);
|
|
615
|
+
})
|
|
616
|
+
]
|
|
617
|
+
}), B.map((e, t) => {
|
|
618
|
+
let o = d === e.id, s = o || n === e.id, c = [
|
|
619
|
+
...r.filter((t) => t.nodeIds.includes(e.id)).map((e) => e.label),
|
|
620
|
+
e.label,
|
|
621
|
+
e.description
|
|
622
|
+
].filter((e) => e !== void 0).join(", ");
|
|
623
|
+
return /* @__PURE__ */ R(u, {
|
|
624
|
+
value: e.id,
|
|
625
|
+
render: m === void 0 ? /* @__PURE__ */ L("div", { role: "group" }) : /* @__PURE__ */ L("button", {
|
|
626
|
+
type: "button",
|
|
627
|
+
tabIndex: -1,
|
|
628
|
+
"aria-pressed": o
|
|
629
|
+
}),
|
|
630
|
+
"aria-label": c,
|
|
631
|
+
title: c,
|
|
632
|
+
...M.props(Ee.node, Ee.position(e.x, e.y), Ee.size(e.width, e.height), Ee.tone(i[O({
|
|
633
|
+
id: e.id,
|
|
634
|
+
tone: e.tone,
|
|
635
|
+
index: t
|
|
636
|
+
})]), m !== void 0 && Ee.action, s && Ee.selected, !s && a === e.id && C.cursor),
|
|
637
|
+
children: [/* @__PURE__ */ L("span", {
|
|
638
|
+
className: "xtqrqnz x1778rvt xk4h15q xb3r6kr xlyipyv xuxw1ft",
|
|
639
|
+
children: e.label
|
|
640
|
+
}), e.description !== void 0 && e.height >= 56 && /* @__PURE__ */ L("span", {
|
|
641
|
+
className: "xy8obcc xas2l8k x153jb6y xb3r6kr xlyipyv xuxw1ft",
|
|
642
|
+
children: e.description
|
|
643
|
+
})]
|
|
644
|
+
}, e.id);
|
|
645
|
+
})]
|
|
646
|
+
})
|
|
647
|
+
})
|
|
648
|
+
}) : /* @__PURE__ */ L(S, { children: T }), /* @__PURE__ */ L(y, {
|
|
649
|
+
label: `${D} graph data`,
|
|
650
|
+
columns: [{
|
|
651
|
+
id: "kind",
|
|
652
|
+
label: "Kind"
|
|
653
|
+
}, {
|
|
654
|
+
id: "description",
|
|
655
|
+
label: "Description"
|
|
656
|
+
}],
|
|
657
|
+
rows: [
|
|
658
|
+
...t.map((e) => ({
|
|
659
|
+
id: `node:${e.id}`,
|
|
660
|
+
values: ["Node", [e.label, e.description].filter((e) => e !== void 0).join(", ")]
|
|
661
|
+
})),
|
|
662
|
+
...r.map((e) => ({
|
|
663
|
+
id: `group:${e.id}`,
|
|
664
|
+
values: ["Group", `${e.label}: ${e.nodeIds.map((e) => H.get(e)?.label).join(", ")}`]
|
|
665
|
+
})),
|
|
666
|
+
...ne.map(({ edge: e, source: t, target: n }) => ({
|
|
667
|
+
id: `edge:${e.id}`,
|
|
668
|
+
values: ["Relationship", `${t.label + (e.direction === "directed" ? " → " : " ↔ ") + n.label}: ${e.label}`]
|
|
669
|
+
}))
|
|
670
|
+
]
|
|
671
|
+
})]
|
|
672
|
+
})
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
function ke({ nodes: e, edges: t, groups: n, width: r, height: i }) {
|
|
676
|
+
let { dimension: o } = $;
|
|
677
|
+
if (!Number.isFinite(r) || r <= 0 || r > o || !Number.isFinite(i) || i <= 0 || i > o) return `Graph dimensions must be finite, positive, and at most ${o} pixels.`;
|
|
678
|
+
if (e.length > $.nodes || t.length > $.edges || n.length > $.groups) return `This graph exceeds the render limit of ${$.nodes} nodes, ${$.edges} relationships, or ${$.groups} groups. Supply a smaller, labelled neighborhood.`;
|
|
679
|
+
let s = new Set(e.map((e) => e.id));
|
|
680
|
+
return !a(e) || !a(t) || !a(n) ? "Graph nodes, relationships, and groups must have unique identifiers." : [...e, ...n].some((e) => {
|
|
681
|
+
if (!Number.isFinite(e.width) || !Number.isFinite(e.height) || e.width <= 0 || e.height <= 0) return !0;
|
|
682
|
+
let t = !Number.isFinite(e.x) || e.x < 0 || e.x + e.width > r, n = !Number.isFinite(e.y) || e.y < 0 || e.y + e.height > i;
|
|
683
|
+
return t || n;
|
|
684
|
+
}) ? "Graph boxes must have finite, positive dimensions and fit inside the supplied canvas." : e.some((e) => e.width < 44 || e.height < 44) ? "Graph node boxes must be at least 44 by 44 pixels." : t.some((t) => t.sourceId === t.targetId && e.some((e) => e.id === t.sourceId && e.y < 36)) ? "A self-relationship needs at least 36 pixels of space above its node." : n.some((e) => new Set(e.nodeIds).size !== e.nodeIds.length || e.nodeIds.some((e) => !s.has(e))) ? "Each group must contain unique references to supplied nodes." : n.some((t) => t.nodeIds.some((n) => {
|
|
685
|
+
let r = e.find((e) => e.id === n);
|
|
686
|
+
if (r === void 0) return !1;
|
|
687
|
+
let i = r.x < t.x || r.x + r.width > t.x + t.width, a = r.y < t.y || r.y + r.height > t.y + t.height;
|
|
688
|
+
return i || a;
|
|
689
|
+
})) ? "A group box must contain the node boxes assigned to it." : null;
|
|
690
|
+
}
|
|
691
|
+
function Ae(e, t) {
|
|
692
|
+
let n = [];
|
|
693
|
+
for (let r of e) {
|
|
694
|
+
let e = t.get(r.sourceId), i = t.get(r.targetId);
|
|
695
|
+
if (e === void 0 || i === void 0) return null;
|
|
696
|
+
n.push({
|
|
697
|
+
edge: r,
|
|
698
|
+
source: e,
|
|
699
|
+
target: i
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
return n;
|
|
703
|
+
}
|
|
704
|
+
// packages/charts/src/graph/attribution-layout.ts
|
|
705
|
+
var je = {
|
|
706
|
+
nodeRadius: 6,
|
|
707
|
+
edgeWidthMin: .75,
|
|
708
|
+
edgeWidthMax: 5,
|
|
709
|
+
padding: 16,
|
|
710
|
+
band: 76,
|
|
711
|
+
spacingMin: 64,
|
|
712
|
+
spacingMax: 200,
|
|
713
|
+
gutterMax: 140,
|
|
714
|
+
gutterGap: 16,
|
|
715
|
+
characterWidth: 7,
|
|
716
|
+
columnMin: 120,
|
|
717
|
+
rowSpacing: 40,
|
|
718
|
+
header: 36,
|
|
719
|
+
labelGap: 6,
|
|
720
|
+
labelGapAcross: 8
|
|
721
|
+
};
|
|
722
|
+
function Me({ weight: e, weightMax: t }) {
|
|
723
|
+
let { edgeWidthMin: n, edgeWidthMax: r } = je, i = t > 0 ? Math.abs(e) / t : 0;
|
|
724
|
+
return n + (r - n) * i;
|
|
725
|
+
}
|
|
726
|
+
var Ne = .5, Pe = 2;
|
|
727
|
+
function Fe(e, t) {
|
|
728
|
+
let n = (e.size - e.count) * e.spacing * Ne;
|
|
729
|
+
return e.start + n + t * e.spacing + e.inset;
|
|
730
|
+
}
|
|
731
|
+
function Ie({ layers: e, nodes: t, edges: n, direction: r, width: i }) {
|
|
732
|
+
let a = je, o = e.map((e) => t.filter((t) => t.layerId === e.id)), s = Math.max(1, ...o.map((e) => e.length)), c = r === "up", l = Math.max(0, ...e.map((e) => e.label.length)), u = c ? Math.min(a.gutterMax, l * a.characterWidth + a.gutterGap) : 0, d = i - u - a.padding * Pe, f = Math.max(0, ...t.map((e) => e.label.length)), p = a.nodeRadius + a.labelGap * Pe + f * a.characterWidth, m = c ? Math.max(a.spacingMin, Math.min(a.spacingMax, p), d / s) : a.rowSpacing, h = c ? a.nodeRadius + a.labelGap : m * Ne, g = Math.max(a.columnMin, (i - a.padding * Pe) / Math.max(1, e.length)), _ = c ? u + a.padding : a.header + a.padding, v = s * m, y = c ? _ + v + a.padding : e.length * g + a.padding * Pe, b = c ? e.length * a.band + a.padding * Pe : _ + v + a.padding;
|
|
733
|
+
function x(t) {
|
|
734
|
+
return c ? a.padding + (e.length - 1 - t + Ne) * a.band : a.padding + (t + Ne) * g;
|
|
735
|
+
}
|
|
736
|
+
let S = o.flatMap((e, t) => e.map((n, r) => {
|
|
737
|
+
let i = x(t), a = Fe({
|
|
738
|
+
count: e.length,
|
|
739
|
+
size: s,
|
|
740
|
+
start: _,
|
|
741
|
+
spacing: m,
|
|
742
|
+
inset: h
|
|
743
|
+
}, r);
|
|
744
|
+
return {
|
|
745
|
+
id: n.id,
|
|
746
|
+
layerIndex: t,
|
|
747
|
+
x: c ? a : i,
|
|
748
|
+
y: c ? i : a
|
|
749
|
+
};
|
|
750
|
+
})), C = new Map(S.map((e) => [e.id, e])), w = Math.max(0, ...n.map((e) => Math.abs(e.weight))), T = a.nodeRadius, E = n.flatMap((e) => {
|
|
751
|
+
let t = C.get(e.sourceId), n = C.get(e.targetId);
|
|
752
|
+
if (t === void 0 || n === void 0) return [];
|
|
753
|
+
let r = ee(c ? {
|
|
754
|
+
x1: t.x,
|
|
755
|
+
y1: t.y - T,
|
|
756
|
+
x2: n.x,
|
|
757
|
+
y2: n.y + T,
|
|
758
|
+
axis: "y"
|
|
759
|
+
} : {
|
|
760
|
+
x1: t.x + T,
|
|
761
|
+
y1: t.y,
|
|
762
|
+
x2: n.x - T,
|
|
763
|
+
y2: n.y,
|
|
764
|
+
axis: "x"
|
|
765
|
+
});
|
|
766
|
+
return [{
|
|
767
|
+
id: e.id,
|
|
768
|
+
d: r,
|
|
769
|
+
width: Me({
|
|
770
|
+
weight: e.weight,
|
|
771
|
+
weightMax: w
|
|
772
|
+
})
|
|
773
|
+
}];
|
|
774
|
+
});
|
|
775
|
+
return {
|
|
776
|
+
width: y,
|
|
777
|
+
height: b,
|
|
778
|
+
layers: e.map((e, t) => {
|
|
779
|
+
let n = x(t), r = (c ? a.band : g) * Ne;
|
|
780
|
+
return {
|
|
781
|
+
id: e.id,
|
|
782
|
+
label: e.label,
|
|
783
|
+
labelX: c ? a.padding : n,
|
|
784
|
+
labelY: c ? n : a.padding + a.labelGapAcross,
|
|
785
|
+
start: n - r,
|
|
786
|
+
end: n + r
|
|
787
|
+
};
|
|
788
|
+
}),
|
|
789
|
+
nodes: C,
|
|
790
|
+
edges: E,
|
|
791
|
+
labelWidth: c ? m - a.nodeRadius - a.labelGap * Pe : g - a.labelGapAcross * Pe,
|
|
792
|
+
weightMax: w
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
// packages/charts/src/graph/graph-canvas.tsx
|
|
796
|
+
var Le = 6, Re = "…", ze = 32, Be = { ring: {
|
|
797
|
+
kDwRjp: "xbh8q5q",
|
|
798
|
+
kfzvcC: "x47corl",
|
|
799
|
+
$$css: !0
|
|
800
|
+
} };
|
|
801
|
+
function Ve({ plotRef: e, title: t, marks: n, readoutId: r, isSelectable: i, width: a, height: o, cursor: c, onKeyDown: l, children: u }) {
|
|
802
|
+
let d = P(null), p = c?.x, m = c?.y;
|
|
803
|
+
return N(() => {
|
|
804
|
+
let e = d.current;
|
|
805
|
+
if (e === null || p === void 0 || m === void 0 || !e.contains(e.ownerDocument.activeElement)) return;
|
|
806
|
+
let t = Math.min(p - ze, Math.max(e.scrollLeft, p + ze - e.clientWidth)), n = Math.min(m - ze, Math.max(e.scrollTop, m + ze - e.clientHeight));
|
|
807
|
+
e.scrollTo({
|
|
808
|
+
left: t,
|
|
809
|
+
top: n
|
|
810
|
+
});
|
|
811
|
+
}, [p, m]), /* @__PURE__ */ L("div", {
|
|
812
|
+
ref: e,
|
|
813
|
+
onKeyDown: l,
|
|
814
|
+
className: "xeuugli x41o525",
|
|
815
|
+
children: /* @__PURE__ */ L(s, {
|
|
816
|
+
ref: d,
|
|
817
|
+
role: "group",
|
|
818
|
+
"aria-label": f({
|
|
819
|
+
title: t,
|
|
820
|
+
marks: n,
|
|
821
|
+
isSelectable: i
|
|
822
|
+
}),
|
|
823
|
+
"aria-describedby": r,
|
|
824
|
+
className: "xysyzu8 x1g9kxxr xeuugli x1t137rt x13qnu6 x19rmrnh x9v5kkp x1bqaal x-default-marker",
|
|
825
|
+
children: /* @__PURE__ */ L("svg", {
|
|
826
|
+
"aria-hidden": !0,
|
|
827
|
+
width: a,
|
|
828
|
+
height: o,
|
|
829
|
+
viewBox: `0 0 ${a} ${o}`,
|
|
830
|
+
className: "x1lliihq",
|
|
831
|
+
children: u
|
|
832
|
+
})
|
|
833
|
+
})
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
function He({ x: e, y: t, radius: n }) {
|
|
837
|
+
return /* @__PURE__ */ L("circle", {
|
|
838
|
+
cx: e,
|
|
839
|
+
cy: t,
|
|
840
|
+
r: n,
|
|
841
|
+
...M.props(C.shapeCursor, Be.ring)
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
function Ue(e, t) {
|
|
845
|
+
let n = Math.max(1, Math.floor(t / Le));
|
|
846
|
+
return e.length > n ? `${e.slice(0, Math.max(0, n - 1))}${Re}` : e;
|
|
847
|
+
}
|
|
848
|
+
// packages/charts/src/graph/attribution-graph.tsx
|
|
849
|
+
var We = {
|
|
850
|
+
nodes: 400,
|
|
851
|
+
edges: 2e3,
|
|
852
|
+
layers: 40
|
|
853
|
+
}, Ge = 3, Ke = 6, qe = 3.5, Je = 14, Ye = 5, Xe = 4, Ze = 16, Qe = 18, $e = 5, et = [
|
|
854
|
+
1,
|
|
855
|
+
.5,
|
|
856
|
+
.25
|
|
857
|
+
], tt = "\xA0", nt = "Point at a node, or focus the graph and use the arrow keys. Press P to pin the node you inspect.", rt = "[data-attribution-controls]", it = /* @__PURE__ */ new Set(["p", "P"]), at = /* @__PURE__ */ new Set(["error"]), ot = {
|
|
858
|
+
token: "square",
|
|
859
|
+
feature: "circle",
|
|
860
|
+
error: "circle",
|
|
861
|
+
output: "diamond"
|
|
862
|
+
}, st = {
|
|
863
|
+
token: "Token",
|
|
864
|
+
feature: "Feature",
|
|
865
|
+
error: "Error (unexplained)",
|
|
866
|
+
output: "Output"
|
|
867
|
+
}, ct = [
|
|
868
|
+
"token",
|
|
869
|
+
"feature",
|
|
870
|
+
"error",
|
|
871
|
+
"output"
|
|
872
|
+
], lt = {
|
|
873
|
+
layerLabel: {
|
|
874
|
+
kDwRjp: "x1q7gtio",
|
|
875
|
+
$$css: !0
|
|
876
|
+
},
|
|
877
|
+
exact: {
|
|
878
|
+
khDVqt: "x1sdyfia",
|
|
879
|
+
$$css: !0
|
|
880
|
+
}
|
|
881
|
+
}, ut = {
|
|
882
|
+
normal: { $$css: !0 },
|
|
883
|
+
context: { $$css: !0 },
|
|
884
|
+
receded: {
|
|
885
|
+
kSiTet: "xk8c4ds",
|
|
886
|
+
$$css: !0
|
|
887
|
+
}
|
|
888
|
+
};
|
|
889
|
+
function dt(e) {
|
|
890
|
+
return e > 0 ? "positive" : e < 0 ? "negative" : "neutral";
|
|
891
|
+
}
|
|
892
|
+
function ft(e) {
|
|
893
|
+
return typeof e == "function" ? e : {
|
|
894
|
+
signDisplay: "exceptZero",
|
|
895
|
+
...e
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
function pt({ layers: e, nodes: t, edges: n, pinned: r, valueFormat: i, valueLabel: o }) {
|
|
899
|
+
let s = We;
|
|
900
|
+
if (e.length > s.layers || t.length > s.nodes || n.length > s.edges) return `This graph draws at most ${s.layers} layers, ${s.nodes} nodes and ${s.edges} edges. Supply a pruned graph.`;
|
|
901
|
+
if (!a(e) || !a(t) || !a(n)) return "Layers, nodes and edges must each have unique identifiers.";
|
|
902
|
+
let c = new Map(e.map((e, t) => [e.id, t])), l = t.find((e) => !c.has(e.layerId));
|
|
903
|
+
if (l !== void 0) return `Node ${l.id} names layer ${l.layerId}, which is not supplied.`;
|
|
904
|
+
let u = t.find((e) => typeof e.value == "number" && !Number.isFinite(e.value));
|
|
905
|
+
if (u !== void 0) return `Node ${u.id} has a value that is not finite. Use null for a value that was not recorded.`;
|
|
906
|
+
if (t.some((e) => typeof e.value == "number") && (i === void 0 || o === void 0)) return "Nodes carry values, so the graph needs a valueLabel and a valueFormat to state them.";
|
|
907
|
+
let d = new Map(t.map((e) => [e.id, c.get(e.layerId) ?? 0]));
|
|
908
|
+
for (let e of n) {
|
|
909
|
+
let t = d.get(e.sourceId), n = d.get(e.targetId);
|
|
910
|
+
if (t === void 0 || n === void 0) return `Edge ${e.id} names a node that is not supplied.`;
|
|
911
|
+
if (e.sourceId === e.targetId) return `Edge ${e.id} joins a node to itself.`;
|
|
912
|
+
if (n <= t) return `Edge ${e.id} does not advance through the layers. Every edge must run from an earlier layer to a later one.`;
|
|
913
|
+
if (!Number.isFinite(e.weight)) return `Edge ${e.id} has a weight that is not finite.`;
|
|
914
|
+
}
|
|
915
|
+
let f = r ?? [];
|
|
916
|
+
if (new Set(f).size !== f.length || f.some((e) => !d.has(e))) return "Pinned nodes must be unique and name supplied nodes.";
|
|
917
|
+
}
|
|
918
|
+
function mt(e, t) {
|
|
919
|
+
let n = { isCanceled: !1 };
|
|
920
|
+
function r() {
|
|
921
|
+
n.isCanceled = !0;
|
|
922
|
+
}
|
|
923
|
+
let i = {
|
|
924
|
+
source: t,
|
|
925
|
+
cancel: r,
|
|
926
|
+
get canceled() {
|
|
927
|
+
return n.isCanceled;
|
|
928
|
+
}
|
|
929
|
+
};
|
|
930
|
+
return e.reason, {
|
|
931
|
+
...i,
|
|
932
|
+
reason: e.reason,
|
|
933
|
+
event: e.event
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
function ht({ kind: e }) {
|
|
937
|
+
let t = Ze / 2;
|
|
938
|
+
return /* @__PURE__ */ L("svg", {
|
|
939
|
+
width: Ze,
|
|
940
|
+
height: Ze,
|
|
941
|
+
"aria-hidden": !0,
|
|
942
|
+
className: "x1lliihq x1rea2x4",
|
|
943
|
+
children: /* @__PURE__ */ L(D, {
|
|
944
|
+
shape: ot[e],
|
|
945
|
+
x: t,
|
|
946
|
+
y: t,
|
|
947
|
+
radius: $e,
|
|
948
|
+
tone: "neutral",
|
|
949
|
+
isHollow: at.has(e)
|
|
950
|
+
})
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
function gt({ weightLabel: e, weightMax: t, weightText: n }) {
|
|
954
|
+
let r = Ze / 2;
|
|
955
|
+
return /* @__PURE__ */ L("ul", {
|
|
956
|
+
"aria-label": `Width: ${e}`,
|
|
957
|
+
className: "x78zum5 x1a02dak x6s0dn4 xjsc2ov x1ghz6dp x1717udv xe8uvvx xy8obcc xas2l8k x153jb6y",
|
|
958
|
+
children: /* @__PURE__ */ R("li", {
|
|
959
|
+
className: "x3nfvp2 x6s0dn4 xunmzkg xuxw1ft",
|
|
960
|
+
children: [`Width: absolute ${e.toLowerCase()}`, et.map((e) => /* @__PURE__ */ R("span", {
|
|
961
|
+
className: "x3nfvp2 x6s0dn4 xunmzkg xa1dmyi",
|
|
962
|
+
children: [/* @__PURE__ */ L("svg", {
|
|
963
|
+
width: Qe,
|
|
964
|
+
height: Ze,
|
|
965
|
+
"aria-hidden": !0,
|
|
966
|
+
className: "x1lliihq x1rea2x4",
|
|
967
|
+
children: /* @__PURE__ */ L(O, {
|
|
968
|
+
d: `M1,${r}H17`,
|
|
969
|
+
tone: "neutral",
|
|
970
|
+
width: Me({
|
|
971
|
+
weight: t * e,
|
|
972
|
+
weightMax: t
|
|
973
|
+
})
|
|
974
|
+
})
|
|
975
|
+
}), n(t * e)]
|
|
976
|
+
}, e))]
|
|
977
|
+
})
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
function _t({ kinds: e, weightLabel: t }) {
|
|
981
|
+
let n = Ze / 2;
|
|
982
|
+
return /* @__PURE__ */ R("ul", {
|
|
983
|
+
"aria-label": "Legend",
|
|
984
|
+
className: "x78zum5 x1a02dak x6s0dn4 xjsc2ov x1ghz6dp x1717udv xe8uvvx xy8obcc xas2l8k x153jb6y",
|
|
985
|
+
children: [
|
|
986
|
+
/* @__PURE__ */ R("li", {
|
|
987
|
+
className: "x3nfvp2 x6s0dn4 xunmzkg xuxw1ft",
|
|
988
|
+
children: [/* @__PURE__ */ L(o, {
|
|
989
|
+
tone: "positive",
|
|
990
|
+
shape: "line"
|
|
991
|
+
}), `${t} above zero`]
|
|
992
|
+
}),
|
|
993
|
+
/* @__PURE__ */ R("li", {
|
|
994
|
+
className: "x3nfvp2 x6s0dn4 xunmzkg xuxw1ft",
|
|
995
|
+
children: [/* @__PURE__ */ L(o, {
|
|
996
|
+
tone: "negative",
|
|
997
|
+
shape: "line"
|
|
998
|
+
}), `${t} below zero`]
|
|
999
|
+
}),
|
|
1000
|
+
e.map((e) => /* @__PURE__ */ R("li", {
|
|
1001
|
+
className: "x3nfvp2 x6s0dn4 xunmzkg xuxw1ft",
|
|
1002
|
+
children: [/* @__PURE__ */ L(ht, { kind: e }), st[e]]
|
|
1003
|
+
}, e)),
|
|
1004
|
+
/* @__PURE__ */ R("li", {
|
|
1005
|
+
className: "x3nfvp2 x6s0dn4 xunmzkg xuxw1ft",
|
|
1006
|
+
children: [/* @__PURE__ */ L("svg", {
|
|
1007
|
+
width: Ze,
|
|
1008
|
+
height: Ze,
|
|
1009
|
+
"aria-hidden": !0,
|
|
1010
|
+
className: "x1lliihq x1rea2x4",
|
|
1011
|
+
children: /* @__PURE__ */ L("circle", {
|
|
1012
|
+
cx: n,
|
|
1013
|
+
cy: n,
|
|
1014
|
+
r: 6,
|
|
1015
|
+
className: "xbh8q5q x17y187c xhr4kjn x13efnbd"
|
|
1016
|
+
})
|
|
1017
|
+
}), "Pinned"]
|
|
1018
|
+
})
|
|
1019
|
+
]
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1022
|
+
function vt({ label: e, placed: t, isUp: n }) {
|
|
1023
|
+
let r = je.nodeRadius;
|
|
1024
|
+
return n ? /* @__PURE__ */ L(E, {
|
|
1025
|
+
x: t.x + r + je.labelGap,
|
|
1026
|
+
y: t.y + Xe,
|
|
1027
|
+
children: e
|
|
1028
|
+
}) : /* @__PURE__ */ L(E, {
|
|
1029
|
+
x: t.x,
|
|
1030
|
+
y: t.y - r - Ye,
|
|
1031
|
+
anchor: "middle",
|
|
1032
|
+
children: e
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
function yt(r) {
|
|
1036
|
+
let { layers: i, nodes: a, edges: o, weightLabel: s, weightFormat: l, valueLabel: d, valueFormat: f, direction: m = "up", pinned: g, onPinnedChange: w, selected: T, onSelectedChange: E, ...A } = r, { emptyLabel: ee = "No attribution graph is available.", ...j } = A, { locale: N, title: P } = j, z = k("tall"), B = te(), V = h(), [H, ne] = F([]);
|
|
1037
|
+
if (j.status === "loading") return /* @__PURE__ */ L(v, {
|
|
1038
|
+
...j,
|
|
1039
|
+
height: "tall"
|
|
1040
|
+
});
|
|
1041
|
+
let U = pt({
|
|
1042
|
+
layers: i,
|
|
1043
|
+
nodes: a,
|
|
1044
|
+
edges: o,
|
|
1045
|
+
pinned: g,
|
|
1046
|
+
valueFormat: f,
|
|
1047
|
+
valueLabel: d
|
|
1048
|
+
});
|
|
1049
|
+
if (U !== void 0) return /* @__PURE__ */ L(x, {
|
|
1050
|
+
...j,
|
|
1051
|
+
message: U
|
|
1052
|
+
});
|
|
1053
|
+
let W = Ie({
|
|
1054
|
+
layers: i,
|
|
1055
|
+
nodes: a,
|
|
1056
|
+
edges: o,
|
|
1057
|
+
direction: m,
|
|
1058
|
+
width: z.width
|
|
1059
|
+
}), G = new Map(a.map((e) => [e.id, e])), re = new Map(i.map((e) => [e.id, e])), ie = g ?? H, K = new Set(ie), q = m === "up", J = je.nodeRadius;
|
|
1060
|
+
function Y(e) {
|
|
1061
|
+
return _({
|
|
1062
|
+
value: e,
|
|
1063
|
+
locale: N,
|
|
1064
|
+
format: ft(l)
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
function X(e) {
|
|
1068
|
+
return _({
|
|
1069
|
+
value: e,
|
|
1070
|
+
locale: N,
|
|
1071
|
+
format: l
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
function Z(e) {
|
|
1075
|
+
return e.toSorted((e, t) => Math.abs(t.weight) - Math.abs(e.weight)).slice(0, Ge).map((e) => `${G.get(e.id)?.label ?? e.id} ${Y(e.weight)}`).join(", ");
|
|
1076
|
+
}
|
|
1077
|
+
function ae(e) {
|
|
1078
|
+
let t = e.kind ?? "feature", n = re.get(e.layerId)?.label ?? e.layerId, r = e.value !== void 0 && d !== void 0 && f !== void 0 ? `${d} ${_({
|
|
1079
|
+
value: e.value ?? null,
|
|
1080
|
+
locale: N,
|
|
1081
|
+
format: f
|
|
1082
|
+
})}` : void 0, i = o.filter((t) => t.targetId === e.id).map((e) => ({
|
|
1083
|
+
id: e.sourceId,
|
|
1084
|
+
weight: e.weight
|
|
1085
|
+
})), a = o.filter((t) => t.sourceId === e.id).map((e) => ({
|
|
1086
|
+
id: e.targetId,
|
|
1087
|
+
weight: e.weight
|
|
1088
|
+
}));
|
|
1089
|
+
return {
|
|
1090
|
+
heading: [
|
|
1091
|
+
e.label,
|
|
1092
|
+
st[t],
|
|
1093
|
+
n,
|
|
1094
|
+
r,
|
|
1095
|
+
e.detail
|
|
1096
|
+
].filter((e) => e !== void 0).join(" · "),
|
|
1097
|
+
inputs: i.length === 0 ? "No inputs" : `Strongest inputs: ${Z(i)}`,
|
|
1098
|
+
outputs: a.length === 0 ? "No outputs" : `Strongest outputs: ${Z(a)}`
|
|
1099
|
+
};
|
|
1100
|
+
}
|
|
1101
|
+
let Q = i.flatMap((e) => a.filter((t) => t.layerId === e.id)), oe = new Map(Q.map((e) => [e.id, ae(e)])), se = Q.map((e) => {
|
|
1102
|
+
let t = oe.get(e.id);
|
|
1103
|
+
return {
|
|
1104
|
+
id: e.id,
|
|
1105
|
+
label: t === void 0 ? e.label : [
|
|
1106
|
+
t.heading,
|
|
1107
|
+
t.inputs,
|
|
1108
|
+
t.outputs
|
|
1109
|
+
].join(". ")
|
|
1110
|
+
};
|
|
1111
|
+
}), ce = ct.filter((e) => a.some((t) => (t.kind ?? "feature") === e));
|
|
1112
|
+
function le(e, t) {
|
|
1113
|
+
w?.(e, t), g === void 0 && !t.canceled && ne(e);
|
|
1114
|
+
}
|
|
1115
|
+
function ue(e) {
|
|
1116
|
+
return K.has(e) ? ie.filter((t) => t !== e) : [...ie, e];
|
|
1117
|
+
}
|
|
1118
|
+
function de(e) {
|
|
1119
|
+
let t = W.nodes.get(e);
|
|
1120
|
+
return t === void 0 ? void 0 : {
|
|
1121
|
+
left: t.x - J,
|
|
1122
|
+
top: t.y - J,
|
|
1123
|
+
right: t.x + J,
|
|
1124
|
+
bottom: t.y + J
|
|
1125
|
+
};
|
|
1126
|
+
}
|
|
1127
|
+
function fe(e) {
|
|
1128
|
+
let { inspected: t, cursor: n } = e, r = o.some((e) => K.has(e.sourceId) && K.has(e.targetId)), i = t !== null || r;
|
|
1129
|
+
function a(e) {
|
|
1130
|
+
return t !== null && (e.sourceId === t || e.targetId === t) || K.has(e.sourceId) && K.has(e.targetId);
|
|
1131
|
+
}
|
|
1132
|
+
let s = new Set(o.filter(a).map((e) => e.id)), c = /* @__PURE__ */ new Set([
|
|
1133
|
+
...ie,
|
|
1134
|
+
...t === null ? [] : [t],
|
|
1135
|
+
...o.flatMap((e) => s.has(e.id) ? [e.sourceId, e.targetId] : [])
|
|
1136
|
+
]), l = W.edges.toSorted((e, t) => Number(s.has(e.id)) - Number(s.has(t.id))), d = n === null ? void 0 : W.nodes.get(n);
|
|
1137
|
+
function f(e) {
|
|
1138
|
+
return i && !c.has(e) ? "receded" : "normal";
|
|
1139
|
+
}
|
|
1140
|
+
return /* @__PURE__ */ R(Ve, {
|
|
1141
|
+
plotRef: z.ref,
|
|
1142
|
+
title: P,
|
|
1143
|
+
marks: "nodes",
|
|
1144
|
+
readoutId: B,
|
|
1145
|
+
isSelectable: E !== void 0,
|
|
1146
|
+
width: W.width,
|
|
1147
|
+
height: W.height,
|
|
1148
|
+
cursor: d,
|
|
1149
|
+
onKeyDown: (e) => {
|
|
1150
|
+
let r = t ?? n, i = e.altKey || e.ctrlKey || e.metaKey;
|
|
1151
|
+
it.has(e.key) && !i && r !== null && (e.preventDefault(), le(ue(r), mt({
|
|
1152
|
+
reason: "shortcut",
|
|
1153
|
+
event: e.nativeEvent
|
|
1154
|
+
}, "keyboard")));
|
|
1155
|
+
},
|
|
1156
|
+
children: [
|
|
1157
|
+
W.layers.map((e, t) => t % 2 == 1 ? /* @__PURE__ */ L("rect", {
|
|
1158
|
+
x: q ? 0 : e.start,
|
|
1159
|
+
y: q ? e.start : 0,
|
|
1160
|
+
width: q ? W.width : e.end - e.start,
|
|
1161
|
+
height: q ? e.end - e.start : W.height,
|
|
1162
|
+
className: "x2wnxhi xeutv01"
|
|
1163
|
+
}, e.id) : null),
|
|
1164
|
+
W.layers.map((e) => /* @__PURE__ */ L("text", {
|
|
1165
|
+
x: e.labelX,
|
|
1166
|
+
y: e.labelY + Xe,
|
|
1167
|
+
textAnchor: q ? "start" : "middle",
|
|
1168
|
+
...M.props(C.label, C.tick, lt.layerLabel),
|
|
1169
|
+
children: q ? e.label : Ue(e.label, e.end - e.start)
|
|
1170
|
+
}, e.id)),
|
|
1171
|
+
l.map((e) => {
|
|
1172
|
+
let t = o.find((t) => t.id === e.id);
|
|
1173
|
+
return t === void 0 ? null : /* @__PURE__ */ L(O, {
|
|
1174
|
+
d: e.d,
|
|
1175
|
+
tone: dt(t.weight),
|
|
1176
|
+
width: e.width,
|
|
1177
|
+
emphasis: i && !s.has(e.id) ? "receded" : "normal"
|
|
1178
|
+
}, e.id);
|
|
1179
|
+
}),
|
|
1180
|
+
Q.map((e) => {
|
|
1181
|
+
let n = W.nodes.get(e.id);
|
|
1182
|
+
if (n === void 0) return null;
|
|
1183
|
+
let r = e.kind ?? "feature", i = f(e.id);
|
|
1184
|
+
return /* @__PURE__ */ R(u, {
|
|
1185
|
+
value: e.id,
|
|
1186
|
+
render: /* @__PURE__ */ L("g", {}),
|
|
1187
|
+
children: [
|
|
1188
|
+
K.has(e.id) && /* @__PURE__ */ L("circle", {
|
|
1189
|
+
cx: n.x,
|
|
1190
|
+
cy: n.y,
|
|
1191
|
+
r: J + qe,
|
|
1192
|
+
className: "xbh8q5q x17y187c xhr4kjn x13efnbd"
|
|
1193
|
+
}),
|
|
1194
|
+
/* @__PURE__ */ L(D, {
|
|
1195
|
+
shape: ot[r],
|
|
1196
|
+
x: n.x,
|
|
1197
|
+
y: n.y,
|
|
1198
|
+
radius: J,
|
|
1199
|
+
tone: "neutral",
|
|
1200
|
+
isHollow: at.has(r),
|
|
1201
|
+
emphasis: i,
|
|
1202
|
+
isInspected: t === e.id,
|
|
1203
|
+
isSelected: T === e.id
|
|
1204
|
+
}),
|
|
1205
|
+
/* @__PURE__ */ L("g", {
|
|
1206
|
+
...M.props(C.emphasis, ut[i], lt.exact),
|
|
1207
|
+
children: /* @__PURE__ */ L(vt, {
|
|
1208
|
+
label: Ue(e.label, W.labelWidth),
|
|
1209
|
+
placed: n,
|
|
1210
|
+
isUp: q
|
|
1211
|
+
})
|
|
1212
|
+
}),
|
|
1213
|
+
/* @__PURE__ */ L("circle", {
|
|
1214
|
+
cx: n.x,
|
|
1215
|
+
cy: n.y,
|
|
1216
|
+
r: Je,
|
|
1217
|
+
className: "xy6m8k3 x1ypdohk"
|
|
1218
|
+
})
|
|
1219
|
+
]
|
|
1220
|
+
}, e.id);
|
|
1221
|
+
}),
|
|
1222
|
+
d !== void 0 && /* @__PURE__ */ L(He, {
|
|
1223
|
+
x: d.x,
|
|
1224
|
+
y: d.y,
|
|
1225
|
+
radius: J + Ke
|
|
1226
|
+
})
|
|
1227
|
+
]
|
|
1228
|
+
});
|
|
1229
|
+
}
|
|
1230
|
+
return /* @__PURE__ */ L(p, {
|
|
1231
|
+
...V,
|
|
1232
|
+
items: se,
|
|
1233
|
+
place: de,
|
|
1234
|
+
selected: T ?? null,
|
|
1235
|
+
onSelect: E,
|
|
1236
|
+
within: (e) => e instanceof Element && e.closest(rt) !== null,
|
|
1237
|
+
render: (r, i) => {
|
|
1238
|
+
let l = T != null && G.has(T), u = i.inspected ?? (l ? T : null), d = i.inspected === null ? void 0 : oe.get(i.inspected), f = u === null ? void 0 : G.get(u)?.label, p = u !== null && K.has(u), m = a.length === 0 ? void 0 : /* @__PURE__ */ R("div", {
|
|
1239
|
+
className: "x78zum5 x1a02dak x7a106z x1qughib x1hnptsi xeuugli",
|
|
1240
|
+
children: [
|
|
1241
|
+
/* @__PURE__ */ L("span", {
|
|
1242
|
+
id: B,
|
|
1243
|
+
...M.props(e.hidden),
|
|
1244
|
+
children: c(se, i.inspected)
|
|
1245
|
+
}),
|
|
1246
|
+
/* @__PURE__ */ R("div", {
|
|
1247
|
+
"aria-hidden": !0,
|
|
1248
|
+
className: "xrvj5dj xgdhuxi xeuugli xbixft xss6m8b xj0a0fe",
|
|
1249
|
+
children: [
|
|
1250
|
+
d === void 0 ? /* @__PURE__ */ L("p", {
|
|
1251
|
+
className: "x1ghz6dp x1mqbd49 x153jb6y",
|
|
1252
|
+
children: nt
|
|
1253
|
+
}) : /* @__PURE__ */ L("p", {
|
|
1254
|
+
className: "x1ghz6dp x1mqbd49 xk4h15q x126k92a",
|
|
1255
|
+
children: d.heading
|
|
1256
|
+
}),
|
|
1257
|
+
/* @__PURE__ */ L("p", {
|
|
1258
|
+
className: "x1ghz6dp x1mqbd49",
|
|
1259
|
+
children: d?.inputs ?? tt
|
|
1260
|
+
}),
|
|
1261
|
+
/* @__PURE__ */ L("p", {
|
|
1262
|
+
className: "x1ghz6dp x1mqbd49",
|
|
1263
|
+
children: d?.outputs ?? tt
|
|
1264
|
+
})
|
|
1265
|
+
]
|
|
1266
|
+
}),
|
|
1267
|
+
/* @__PURE__ */ R("div", {
|
|
1268
|
+
"data-attribution-controls": "",
|
|
1269
|
+
className: "x78zum5 x1a02dak xunmzkg",
|
|
1270
|
+
children: [/* @__PURE__ */ L(t, {
|
|
1271
|
+
variant: "outline",
|
|
1272
|
+
density: "compact",
|
|
1273
|
+
disabled: u === null,
|
|
1274
|
+
"aria-label": f === void 0 ? "Pin a node" : `${p ? "Unpin" : "Pin"} ${f}`,
|
|
1275
|
+
onClick: (e, { source: t }) => {
|
|
1276
|
+
u !== null && le(ue(u), mt({
|
|
1277
|
+
reason: "item-press",
|
|
1278
|
+
event: e.nativeEvent
|
|
1279
|
+
}, t));
|
|
1280
|
+
},
|
|
1281
|
+
children: p ? "Unpin" : "Pin"
|
|
1282
|
+
}), ie.length > 0 && /* @__PURE__ */ L(n, {
|
|
1283
|
+
density: "compact",
|
|
1284
|
+
onClick: (e, { source: t }) => le([], mt({
|
|
1285
|
+
reason: "item-press",
|
|
1286
|
+
event: e.nativeEvent
|
|
1287
|
+
}, t)),
|
|
1288
|
+
children: `Clear ${ie.length} pinned`
|
|
1289
|
+
})]
|
|
1290
|
+
})
|
|
1291
|
+
]
|
|
1292
|
+
});
|
|
1293
|
+
return /* @__PURE__ */ L(b, {
|
|
1294
|
+
...j,
|
|
1295
|
+
figure: r,
|
|
1296
|
+
seriesLegend: a.length === 0 ? void 0 : /* @__PURE__ */ L(_t, {
|
|
1297
|
+
kinds: ce,
|
|
1298
|
+
weightLabel: s
|
|
1299
|
+
}),
|
|
1300
|
+
scaleLegend: a.length === 0 || W.weightMax === 0 ? void 0 : /* @__PURE__ */ L(gt, {
|
|
1301
|
+
weightLabel: s,
|
|
1302
|
+
weightMax: W.weightMax,
|
|
1303
|
+
weightText: X
|
|
1304
|
+
}),
|
|
1305
|
+
footer: m,
|
|
1306
|
+
children: a.length === 0 ? /* @__PURE__ */ L(S, { children: ee }) : /* @__PURE__ */ R(I, { children: [fe(i), /* @__PURE__ */ L(y, {
|
|
1307
|
+
label: `${P} nodes and edges`,
|
|
1308
|
+
columns: [{
|
|
1309
|
+
id: "record",
|
|
1310
|
+
label: "Record"
|
|
1311
|
+
}, {
|
|
1312
|
+
id: "detail",
|
|
1313
|
+
label: "Detail"
|
|
1314
|
+
}],
|
|
1315
|
+
rows: [...se.map((e) => ({
|
|
1316
|
+
id: `node:${e.id}`,
|
|
1317
|
+
values: [G.get(e.id)?.label ?? e.id, e.label]
|
|
1318
|
+
})), ...o.map((e) => ({
|
|
1319
|
+
id: `edge:${e.id}`,
|
|
1320
|
+
values: [`${G.get(e.sourceId)?.label ?? e.sourceId} → ${G.get(e.targetId)?.label ?? e.targetId}`, `${s} ${Y(e.weight)}`]
|
|
1321
|
+
}))]
|
|
1322
|
+
})] })
|
|
1323
|
+
});
|
|
1324
|
+
}
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
// packages/charts/src/graph/tree-layout.ts
|
|
1328
|
+
function bt(e, t) {
|
|
1329
|
+
let n = e.findIndex((e, n) => e !== t[n]);
|
|
1330
|
+
return n === -1 ? e.length - t.length : n >= t.length ? 1 : (e[n] ?? 0) - (t[n] ?? 0);
|
|
1331
|
+
}
|
|
1332
|
+
function xt(e) {
|
|
1333
|
+
let t = new Set(e.map((e) => e.id)), n = e.filter((e) => e.parentId === null), r = e.find((e) => e.parentId !== null && !t.has(e.parentId));
|
|
1334
|
+
if (r !== void 0) return {
|
|
1335
|
+
isValid: !1,
|
|
1336
|
+
message: `Node ${r.id} names parent ${r.parentId}, which is not supplied.`
|
|
1337
|
+
};
|
|
1338
|
+
let [i, a] = n;
|
|
1339
|
+
if (i === void 0) return {
|
|
1340
|
+
isValid: !1,
|
|
1341
|
+
message: "The tree has no root. Every node has a parent, so the parents form a cycle."
|
|
1342
|
+
};
|
|
1343
|
+
if (a !== void 0) return {
|
|
1344
|
+
isValid: !1,
|
|
1345
|
+
message: `The tree has more than one root: ${i.id} and ${a.id}.`
|
|
1346
|
+
};
|
|
1347
|
+
let o = new Map(e.map((t) => [t.id, e.filter((e) => e.parentId === t.id).map((e) => e.id)])), s = new Map(e.map((e) => [e.id, e]));
|
|
1348
|
+
function* c(t) {
|
|
1349
|
+
let n = {
|
|
1350
|
+
at: t,
|
|
1351
|
+
count: 0
|
|
1352
|
+
};
|
|
1353
|
+
for (; n.at !== null && n.count <= e.length;) yield n.at, n.at = s.get(n.at)?.parentId ?? null, n.count += 1;
|
|
1354
|
+
}
|
|
1355
|
+
function l(t) {
|
|
1356
|
+
let n = Array.from(c(t));
|
|
1357
|
+
return n.length > e.length ? void 0 : n;
|
|
1358
|
+
}
|
|
1359
|
+
let u = e.map((e) => ({
|
|
1360
|
+
id: e.id,
|
|
1361
|
+
chain: l(e.id)
|
|
1362
|
+
})), d = u.find((e) => e.chain === void 0);
|
|
1363
|
+
if (d !== void 0) return {
|
|
1364
|
+
isValid: !1,
|
|
1365
|
+
message: `Node ${d.id} is part of a cycle and never reaches the root.`
|
|
1366
|
+
};
|
|
1367
|
+
function f(e) {
|
|
1368
|
+
let t = s.get(e)?.parentId ?? null;
|
|
1369
|
+
return t === null ? 0 : (o.get(t) ?? []).indexOf(e);
|
|
1370
|
+
}
|
|
1371
|
+
let p = u.map((e) => {
|
|
1372
|
+
let t = (e.chain ?? []).toReversed();
|
|
1373
|
+
return {
|
|
1374
|
+
id: e.id,
|
|
1375
|
+
lineage: t,
|
|
1376
|
+
key: t.map(f)
|
|
1377
|
+
};
|
|
1378
|
+
}).toSorted((e, t) => bt(e.key, t.key)).map((e) => ({
|
|
1379
|
+
id: e.id,
|
|
1380
|
+
depth: e.lineage.length - 1,
|
|
1381
|
+
lineage: e.lineage
|
|
1382
|
+
}));
|
|
1383
|
+
return {
|
|
1384
|
+
isValid: !0,
|
|
1385
|
+
root: i.id,
|
|
1386
|
+
children: o,
|
|
1387
|
+
order: p
|
|
1388
|
+
};
|
|
1389
|
+
}
|
|
1390
|
+
var St = {
|
|
1391
|
+
padding: 16,
|
|
1392
|
+
top: 28,
|
|
1393
|
+
leafStep: 26,
|
|
1394
|
+
leafStepDown: 28,
|
|
1395
|
+
depthStep: 96,
|
|
1396
|
+
depthStepDown: 80,
|
|
1397
|
+
gutterMax: 180,
|
|
1398
|
+
gutterMaxDown: 140,
|
|
1399
|
+
characterWidth: 6,
|
|
1400
|
+
labelGap: 10,
|
|
1401
|
+
lineHeight: 20,
|
|
1402
|
+
labelInset: 8,
|
|
1403
|
+
trunkGap: 6,
|
|
1404
|
+
trunkMin: 12,
|
|
1405
|
+
depthStepMin: 72
|
|
1406
|
+
}, Ct = .5;
|
|
1407
|
+
function wt({ structure: e, nodes: t, direction: n, link: r, width: i }) {
|
|
1408
|
+
let a = St, o = n === "right", s = new Map(t.map((e) => [e.id, e.label])), c = e.order.filter((t) => (e.children.get(t.id) ?? []).length === 0), l = new Map(c.map((e, t) => [e.id, t])), u = Math.max(1, ...e.order.map((e) => e.depth)), d = Math.max(0, ...c.map((e) => (s.get(e.id) ?? "").length)), f = o ? a.gutterMax : a.gutterMaxDown, p = d * a.characterWidth + a.labelGap, m = a.padding + a.padding, h = Math.max(1, c.length), g = o ? a.leafStep : Math.max(a.leafStepDown, (i - m) / h), _ = !o && p <= g, v = o ? "beside" : _ ? "below" : "turned", y = _ ? a.lineHeight : Math.min(f, p), b = _ ? g : y, x = Array.from({ length: u }, (t, n) => Math.max(0, ...e.order.filter((e) => e.depth === n && !l.has(e.id)).map((e) => (s.get(e.id) ?? "").length)) * a.characterWidth + a.labelInset + a.trunkGap + a.trunkMin), S = i - m - y, C = j(x), w = x.map((e) => C > S ? Math.max(a.depthStepMin, e * S / C) : Math.max(a.depthStep, e + (S - C) / u)), T = w.map((e, t) => j(w.slice(0, t))), E = h * g, D = o ? j(w) : u * a.depthStepDown, O = /* @__PURE__ */ new Map();
|
|
1409
|
+
e.order.toReversed().map((t) => {
|
|
1410
|
+
let n = e.children.get(t.id) ?? [], r = n[0], i = n.at(-1), a = r === void 0 || i === void 0 ? l.get(t.id) ?? 0 : (k(r) + k(i)) * Ct;
|
|
1411
|
+
return O.set(t.id, a);
|
|
1412
|
+
});
|
|
1413
|
+
function k(e) {
|
|
1414
|
+
return O.get(e) ?? 0;
|
|
1415
|
+
}
|
|
1416
|
+
function A(t) {
|
|
1417
|
+
let n = e.children.get(t) ?? [], r = n[0], i = n.at(-1);
|
|
1418
|
+
return r === void 0 || i === void 0 ? 1 : k(i) - k(r) + 1;
|
|
1419
|
+
}
|
|
1420
|
+
let M = e.order.map((e) => {
|
|
1421
|
+
let t = a.padding + (k(e.id) + Ct) * g, n = o ? a.padding + (T[e.depth] ?? D) : a.top + e.depth * a.depthStepDown, r = l.has(e.id), i = w[e.depth] ?? 0, c = o ? i - a.labelInset - a.trunkGap - a.trunkMin : A(e.id) * g * Ct - a.labelGap, u = r ? b - a.labelGap : c, d = Math.min(u, (s.get(e.id) ?? "").length * a.characterWidth);
|
|
1422
|
+
return {
|
|
1423
|
+
id: e.id,
|
|
1424
|
+
x: o ? n : t,
|
|
1425
|
+
y: o ? t + a.top - a.padding : n,
|
|
1426
|
+
depth: e.depth,
|
|
1427
|
+
isLeaf: r,
|
|
1428
|
+
labelWidth: u,
|
|
1429
|
+
trunk: o && !r ? n + a.labelInset + d + a.trunkGap : n
|
|
1430
|
+
};
|
|
1431
|
+
}), N = new Map(M.map((e) => [e.id, e])), te = t.flatMap((e) => {
|
|
1432
|
+
let t = N.get(e.id), n = e.parentId === null ? void 0 : N.get(e.parentId);
|
|
1433
|
+
if (t === void 0 || n === void 0 || e.parentId === null) return [];
|
|
1434
|
+
let i = ee({
|
|
1435
|
+
x1: o ? n.trunk : n.x,
|
|
1436
|
+
y1: n.y,
|
|
1437
|
+
x2: t.x,
|
|
1438
|
+
y2: t.y,
|
|
1439
|
+
axis: o ? "x" : "y",
|
|
1440
|
+
shape: r
|
|
1441
|
+
});
|
|
1442
|
+
return [{
|
|
1443
|
+
id: e.id,
|
|
1444
|
+
parentId: e.parentId,
|
|
1445
|
+
d: i
|
|
1446
|
+
}];
|
|
1447
|
+
});
|
|
1448
|
+
return {
|
|
1449
|
+
width: o ? a.padding + D + y + a.padding : E + m,
|
|
1450
|
+
height: o ? a.top + E + a.padding : a.top + D + y + a.padding,
|
|
1451
|
+
nodes: N,
|
|
1452
|
+
links: te,
|
|
1453
|
+
leafLabels: v
|
|
1454
|
+
};
|
|
1455
|
+
}
|
|
1456
|
+
// packages/charts/src/graph/tree-diagram.tsx
|
|
1457
|
+
var Tt = {
|
|
1458
|
+
nodes: 300,
|
|
1459
|
+
depth: 12
|
|
1460
|
+
}, Et = " › ", Dt = 4, Ot = 9, kt = 13, At = 8, jt = 18, Mt = 4, Nt = 90;
|
|
1461
|
+
function Pt({ nodes: e, valueFormat: t, valueLabel: n }) {
|
|
1462
|
+
if (e.length > Tt.nodes) return `This tree draws at most ${Tt.nodes} nodes. Supply a cut of the hierarchy.`;
|
|
1463
|
+
if (!a(e)) return "Tree nodes must have unique identifiers.";
|
|
1464
|
+
let r = e.find((e) => typeof e.value == "number" && !Number.isFinite(e.value));
|
|
1465
|
+
return r === void 0 ? e.some((e) => typeof e.value == "number") && (t === void 0 || n === void 0) ? "Nodes carry values, so the tree needs a valueLabel and a valueFormat to state them." : void 0 : `Node ${r.id} has a value that is not finite. Use null for a value that was not recorded.`;
|
|
1466
|
+
}
|
|
1467
|
+
function Ft({ label: e, placed: t, leafLabels: n }) {
|
|
1468
|
+
let r = Ue(e, t.labelWidth);
|
|
1469
|
+
if (!t.isLeaf) return /* @__PURE__ */ L(E, {
|
|
1470
|
+
x: t.x + At,
|
|
1471
|
+
y: t.y + (n === "beside" ? Mt : -7),
|
|
1472
|
+
children: r
|
|
1473
|
+
});
|
|
1474
|
+
switch (n) {
|
|
1475
|
+
case "beside": return /* @__PURE__ */ L(E, {
|
|
1476
|
+
x: t.x + At,
|
|
1477
|
+
y: t.y + Mt,
|
|
1478
|
+
children: r
|
|
1479
|
+
});
|
|
1480
|
+
case "below": return /* @__PURE__ */ L(E, {
|
|
1481
|
+
x: t.x,
|
|
1482
|
+
y: t.y + jt,
|
|
1483
|
+
anchor: "middle",
|
|
1484
|
+
children: r
|
|
1485
|
+
});
|
|
1486
|
+
case "turned": return /* @__PURE__ */ L("g", {
|
|
1487
|
+
transform: `rotate(${Nt} ${t.x} ${t.y})`,
|
|
1488
|
+
children: /* @__PURE__ */ L(E, {
|
|
1489
|
+
x: t.x + At,
|
|
1490
|
+
y: t.y + Mt,
|
|
1491
|
+
children: r
|
|
1492
|
+
})
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
function It(e) {
|
|
1497
|
+
let { nodes: t, direction: n = "right", link: r = "elbow", valueLabel: i, valueFormat: a, toneLegend: o, selected: s, onSelectedChange: d, ...f } = e, { emptyLabel: g = "No hierarchy is available.", ...C } = f, { locale: w, title: E } = C, D = k("tall"), A = te(), ee = h();
|
|
1498
|
+
if (C.status === "loading") return /* @__PURE__ */ L(v, {
|
|
1499
|
+
...C,
|
|
1500
|
+
height: "tall"
|
|
1501
|
+
});
|
|
1502
|
+
let j = Pt({
|
|
1503
|
+
nodes: t,
|
|
1504
|
+
valueFormat: a,
|
|
1505
|
+
valueLabel: i
|
|
1506
|
+
});
|
|
1507
|
+
if (j !== void 0) return /* @__PURE__ */ L(x, {
|
|
1508
|
+
...C,
|
|
1509
|
+
message: j
|
|
1510
|
+
});
|
|
1511
|
+
let M = t.length === 0 ? void 0 : xt(t);
|
|
1512
|
+
if (M !== void 0 && !M.isValid) return /* @__PURE__ */ L(x, {
|
|
1513
|
+
...C,
|
|
1514
|
+
message: M.message
|
|
1515
|
+
});
|
|
1516
|
+
if (Math.max(0, ...(M?.order ?? []).map((e) => e.depth)) + 1 > Tt.depth) return /* @__PURE__ */ L(x, {
|
|
1517
|
+
...C,
|
|
1518
|
+
message: `This tree draws at most ${Tt.depth} levels.`
|
|
1519
|
+
});
|
|
1520
|
+
let N = new Map(t.map((e) => [e.id, e])), P = M === void 0 ? void 0 : wt({
|
|
1521
|
+
structure: M,
|
|
1522
|
+
nodes: t,
|
|
1523
|
+
direction: n,
|
|
1524
|
+
link: r,
|
|
1525
|
+
width: D.width
|
|
1526
|
+
}), F = new Map((M?.order ?? []).map((e) => [e.id, e.lineage])), z = (M?.order ?? []).map((e) => {
|
|
1527
|
+
let t = N.get(e.id), n = e.lineage.map((e) => N.get(e)?.label ?? e), r = t?.value !== void 0 && i !== void 0 && a !== void 0 ? `${i} ${_({
|
|
1528
|
+
value: t.value ?? null,
|
|
1529
|
+
locale: w,
|
|
1530
|
+
format: a
|
|
1531
|
+
})}` : void 0;
|
|
1532
|
+
return {
|
|
1533
|
+
id: e.id,
|
|
1534
|
+
label: [
|
|
1535
|
+
n.join(Et),
|
|
1536
|
+
r,
|
|
1537
|
+
t?.detail
|
|
1538
|
+
].filter((e) => e !== void 0).join(" · ")
|
|
1539
|
+
};
|
|
1540
|
+
});
|
|
1541
|
+
return /* @__PURE__ */ L(p, {
|
|
1542
|
+
...ee,
|
|
1543
|
+
items: z,
|
|
1544
|
+
place: (e) => {
|
|
1545
|
+
let t = P?.nodes.get(e);
|
|
1546
|
+
return t === void 0 ? void 0 : {
|
|
1547
|
+
left: t.x - Dt,
|
|
1548
|
+
top: t.y - Dt,
|
|
1549
|
+
right: t.x + Dt,
|
|
1550
|
+
bottom: t.y + Dt
|
|
1551
|
+
};
|
|
1552
|
+
},
|
|
1553
|
+
selected: s ?? null,
|
|
1554
|
+
onSelect: d,
|
|
1555
|
+
render: (e, { inspected: t, cursor: n }) => {
|
|
1556
|
+
let r = new Set(t === null ? [] : F.get(t) ?? []), i = n === null ? void 0 : P?.nodes.get(n);
|
|
1557
|
+
return /* @__PURE__ */ L(b, {
|
|
1558
|
+
...C,
|
|
1559
|
+
figure: e,
|
|
1560
|
+
seriesLegend: P !== void 0 && o !== void 0 && o.length > 0 ? /* @__PURE__ */ L(m, { items: o }) : void 0,
|
|
1561
|
+
footer: P === void 0 ? void 0 : /* @__PURE__ */ L(l, {
|
|
1562
|
+
id: A,
|
|
1563
|
+
children: c(z, t)
|
|
1564
|
+
}),
|
|
1565
|
+
children: P === void 0 ? /* @__PURE__ */ L(S, { children: g }) : /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ R(Ve, {
|
|
1566
|
+
plotRef: D.ref,
|
|
1567
|
+
title: E,
|
|
1568
|
+
marks: "nodes",
|
|
1569
|
+
readoutId: A,
|
|
1570
|
+
isSelectable: d !== void 0,
|
|
1571
|
+
width: P.width,
|
|
1572
|
+
height: P.height,
|
|
1573
|
+
cursor: i,
|
|
1574
|
+
children: [
|
|
1575
|
+
P.links.map((e) => /* @__PURE__ */ L(O, {
|
|
1576
|
+
d: e.d,
|
|
1577
|
+
tone: "neutral",
|
|
1578
|
+
emphasis: t !== null && !r.has(e.id) ? "receded" : "context"
|
|
1579
|
+
}, e.id)),
|
|
1580
|
+
z.map((e) => {
|
|
1581
|
+
let n = N.get(e.id), r = P.nodes.get(e.id);
|
|
1582
|
+
return n === void 0 || r === void 0 ? null : /* @__PURE__ */ R(u, {
|
|
1583
|
+
value: e.id,
|
|
1584
|
+
render: /* @__PURE__ */ L("g", {}),
|
|
1585
|
+
children: [
|
|
1586
|
+
/* @__PURE__ */ L(T, {
|
|
1587
|
+
x: r.x,
|
|
1588
|
+
y: r.y,
|
|
1589
|
+
radius: Dt,
|
|
1590
|
+
tone: n.tone ?? "neutral",
|
|
1591
|
+
isInspected: t === e.id,
|
|
1592
|
+
isSelected: s === e.id
|
|
1593
|
+
}),
|
|
1594
|
+
/* @__PURE__ */ L(Ft, {
|
|
1595
|
+
label: n.label,
|
|
1596
|
+
placed: r,
|
|
1597
|
+
leafLabels: P.leafLabels
|
|
1598
|
+
}),
|
|
1599
|
+
/* @__PURE__ */ L("circle", {
|
|
1600
|
+
cx: r.x,
|
|
1601
|
+
cy: r.y,
|
|
1602
|
+
r: kt,
|
|
1603
|
+
fill: "transparent"
|
|
1604
|
+
})
|
|
1605
|
+
]
|
|
1606
|
+
}, e.id);
|
|
1607
|
+
}),
|
|
1608
|
+
i !== void 0 && /* @__PURE__ */ L(He, {
|
|
1609
|
+
x: i.x,
|
|
1610
|
+
y: i.y,
|
|
1611
|
+
radius: Ot
|
|
1612
|
+
})
|
|
1613
|
+
]
|
|
1614
|
+
}), /* @__PURE__ */ L(y, {
|
|
1615
|
+
label: `${E} nodes`,
|
|
1616
|
+
columns: [{
|
|
1617
|
+
id: "node",
|
|
1618
|
+
label: "Node"
|
|
1619
|
+
}],
|
|
1620
|
+
rows: z.map((e) => ({
|
|
1621
|
+
id: e.id,
|
|
1622
|
+
values: [e.label]
|
|
1623
|
+
}))
|
|
1624
|
+
})] })
|
|
1625
|
+
});
|
|
1626
|
+
}
|
|
1627
|
+
});
|
|
1628
|
+
}
|
|
1629
|
+
export { Oe as a, Z as c, We as i, Tt as n, $ as o, yt as r, be as s, It as t };
|