@mechane-ai/elements 0.46.0 → 0.48.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 +590 -34
- package/bin/mechane-elements-catalog.mjs +104 -12
- package/dist/ai.js +4 -4
- package/dist/article-BXZr10QQ.js +1904 -0
- package/dist/article.js +1 -0
- package/dist/catalog.json +3696 -33
- package/dist/categorical-values-BpVq8cFj.js +107 -0
- package/dist/cells-xVmnQ9oQ.js +384 -0
- package/dist/chart-link-AE_xuxiP.js +35 -0
- package/dist/chart-tones-ei3BC2AL.js +27 -0
- package/dist/charts/cartesian.js +1 -2958
- package/dist/charts/cells.js +1 -0
- package/dist/charts/comparison.js +1 -0
- package/dist/charts/distribution.js +1 -781
- package/dist/charts/figure.js +3404 -0
- package/dist/charts/graph.js +1 -655
- package/dist/charts/hierarchy.js +1 -121
- package/dist/charts/image.js +1 -0
- package/dist/charts/matrix.js +4 -644
- 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 -266
- package/dist/charts/transforms.js +677 -0
- package/dist/charts/trend.js +1 -0
- package/dist/charts.js +8 -3
- package/dist/clock-DSm5lkNE.js +16 -0
- package/dist/collections.js +1 -2195
- package/dist/color-legend-CIo7DhXB.js +62 -0
- package/dist/dates-Cww8UR_n.js +810 -0
- package/dist/describe-lesson-BmREzDpt.js +175 -0
- package/dist/dumbbell-plot-DQdTxDeO.js +509 -0
- package/dist/embedding-map-CF-J-8JW.js +1929 -0
- package/dist/feedback.js +1 -1
- package/dist/figure-format-B8kRZMlo.js +36 -0
- package/dist/figure-frame-BJ3REgTA.js +270 -0
- package/dist/forms/dates.js +1 -810
- package/dist/forms.js +1 -1
- package/dist/heatmap-scale-Zte6Ya-g.js +20 -0
- package/dist/image-grid-Dl2sjIMB.js +598 -0
- package/dist/kits/evaluation.js +431 -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/lesson/agent.js +811 -0
- package/dist/lesson/spec.js +661 -0
- package/dist/lesson.js +5 -0
- package/dist/locate-Bcg3QcP4.js +11 -0
- package/dist/mdx.js +227 -0
- 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 +5 -5
- package/dist/packages/charts/src/cartesian/reference-lines.d.ts +25 -18
- package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +30 -25
- 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 +60 -36
- package/dist/packages/charts/src/cartesian/value-labels.d.ts +22 -0
- package/dist/packages/charts/src/categorical-values.d.ts +1 -1
- 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 +14 -7
- 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-link.d.ts +56 -0
- package/dist/packages/charts/src/chart.d.ts +0 -8
- 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 +15 -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 +15 -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 +128 -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 -2
- 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 +24 -13
- 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/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/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/teaching/src/agent/index.d.ts +11 -0
- package/dist/packages/teaching/src/agent/learner-trace.d.ts +84 -0
- package/dist/packages/teaching/src/agent/lesson-bridge.d.ts +59 -0
- package/dist/packages/teaching/src/agent/lesson-tour.d.ts +63 -0
- package/dist/packages/teaching/src/agent/tutor-tools.d.ts +86 -0
- package/dist/packages/teaching/src/article/article-checks.d.ts +9 -0
- package/dist/packages/teaching/src/article/article-context.d.ts +49 -0
- package/dist/packages/teaching/src/article/article-error.d.ts +12 -0
- package/dist/packages/teaching/src/article/article-labels.d.ts +54 -0
- package/dist/packages/teaching/src/article/article-layout.stylex.d.ts +14 -0
- package/dist/packages/teaching/src/article/article-outline.d.ts +9 -0
- package/dist/packages/teaching/src/article/article.d.ts +42 -0
- package/dist/packages/teaching/src/article/beat-steps.d.ts +18 -0
- package/dist/packages/teaching/src/article/beat.d.ts +16 -0
- package/dist/packages/teaching/src/article/challenge.d.ts +29 -0
- package/dist/packages/teaching/src/article/exercise-styles.d.ts +76 -0
- package/dist/packages/teaching/src/article/figure.d.ts +51 -0
- package/dist/packages/teaching/src/article/index.d.ts +31 -0
- package/dist/packages/teaching/src/article/lesson-values.d.ts +5 -0
- package/dist/packages/teaching/src/article/linked-target.d.ts +22 -0
- package/dist/packages/teaching/src/article/notes.d.ts +36 -0
- package/dist/packages/teaching/src/article/outline-types.d.ts +73 -0
- package/dist/packages/teaching/src/article/predict.d.ts +58 -0
- package/dist/packages/teaching/src/article/progress-store.d.ts +64 -0
- package/dist/packages/teaching/src/article/scrolly.d.ts +26 -0
- package/dist/packages/teaching/src/article/term.d.ts +35 -0
- package/dist/packages/teaching/src/article/tex.d.ts +12 -0
- package/dist/packages/teaching/src/article/view-essay.d.ts +13 -0
- package/dist/packages/teaching/src/article/view-present.d.ts +8 -0
- package/dist/packages/teaching/src/article/view-sheet.d.ts +7 -0
- package/dist/packages/teaching/src/article/view-static.d.ts +7 -0
- package/dist/packages/teaching/src/article/walk.d.ts +34 -0
- package/dist/packages/teaching/src/lesson/bound-value.d.ts +29 -0
- package/dist/packages/teaching/src/lesson/define-lesson.d.ts +136 -0
- package/dist/packages/teaching/src/lesson/index.d.ts +24 -0
- package/dist/packages/teaching/src/lesson/inline-choice.d.ts +12 -0
- package/dist/packages/teaching/src/lesson/lesson-context.d.ts +18 -0
- package/dist/packages/teaching/src/lesson/lesson-error.d.ts +12 -0
- package/dist/packages/teaching/src/lesson/lesson-locale.d.ts +4 -0
- package/dist/packages/teaching/src/lesson/lesson-persistence.d.ts +17 -0
- package/dist/packages/teaching/src/lesson/lesson-player.d.ts +51 -0
- package/dist/packages/teaching/src/lesson/lesson-store.d.ts +84 -0
- package/dist/packages/teaching/src/lesson/lesson.d.ts +39 -0
- package/dist/packages/teaching/src/lesson/param-controls.d.ts +14 -0
- package/dist/packages/teaching/src/lesson/param.d.ts +34 -0
- package/dist/packages/teaching/src/lesson/playback.d.ts +42 -0
- package/dist/packages/teaching/src/lesson/transport.d.ts +19 -0
- package/dist/packages/teaching/src/lesson/use-lesson.d.ts +36 -0
- package/dist/packages/teaching/src/mdx/essay-components.d.ts +79 -0
- package/dist/packages/teaching/src/mdx/essay-markdown.d.ts +41 -0
- package/dist/packages/teaching/src/mdx/essay.d.ts +32 -0
- package/dist/packages/teaching/src/mdx/index.d.ts +9 -0
- package/dist/packages/teaching/src/mdx/requested-view.d.ts +6 -0
- package/dist/packages/teaching/src/scene/flow/flow-layout.d.ts +38 -0
- package/dist/packages/teaching/src/scene/flow/flow-pulse.d.ts +16 -0
- package/dist/packages/teaching/src/scene/flow/scene-flow.d.ts +81 -0
- package/dist/packages/teaching/src/scene/index.d.ts +77 -0
- package/dist/packages/teaching/src/scene/morph/morph-scope.d.ts +28 -0
- package/dist/packages/teaching/src/scene/plane/plane-hit.d.ts +22 -0
- package/dist/packages/teaching/src/scene/plane/plane-label.d.ts +23 -0
- package/dist/packages/teaching/src/scene/plane/plane-labels.d.ts +42 -0
- package/dist/packages/teaching/src/scene/plane/plane-math.d.ts +45 -0
- package/dist/packages/teaching/src/scene/plane/scene-axes.d.ts +30 -0
- package/dist/packages/teaching/src/scene/plane/scene-curve.d.ts +42 -0
- package/dist/packages/teaching/src/scene/plane/scene-point.d.ts +59 -0
- package/dist/packages/teaching/src/scene/plane/scene-projection.d.ts +27 -0
- package/dist/packages/teaching/src/scene/plane/scene-region.d.ts +38 -0
- package/dist/packages/teaching/src/scene/plane/scene-rule.d.ts +35 -0
- package/dist/packages/teaching/src/scene/plane/scene-vector.d.ts +39 -0
- package/dist/packages/teaching/src/scene/scene-bracket.d.ts +24 -0
- package/dist/packages/teaching/src/scene/scene-callout.d.ts +26 -0
- package/dist/packages/teaching/src/scene/scene-context.d.ts +179 -0
- package/dist/packages/teaching/src/scene/scene-custom.d.ts +31 -0
- package/dist/packages/teaching/src/scene/scene-geometry.d.ts +181 -0
- package/dist/packages/teaching/src/scene/scene-group.d.ts +28 -0
- package/dist/packages/teaching/src/scene/scene-highlight.d.ts +19 -0
- package/dist/packages/teaching/src/scene/scene-layer.d.ts +16 -0
- package/dist/packages/teaching/src/scene/scene-node.d.ts +67 -0
- package/dist/packages/teaching/src/scene/scene-obstacles.d.ts +27 -0
- package/dist/packages/teaching/src/scene/scene-registry.d.ts +79 -0
- package/dist/packages/teaching/src/scene/scene-stagger.d.ts +43 -0
- package/dist/packages/teaching/src/scene/scene-style.d.ts +14 -0
- package/dist/packages/teaching/src/scene/scene-validate.d.ts +65 -0
- package/dist/packages/teaching/src/scene/scene-wire.d.ts +45 -0
- package/dist/packages/teaching/src/scene/scene.d.ts +36 -0
- package/dist/packages/teaching/src/scene/shapes/cell-color.d.ts +11 -0
- package/dist/packages/teaching/src/scene/shapes/cell-grid.d.ts +69 -0
- package/dist/packages/teaching/src/scene/shapes/scene-card.d.ts +114 -0
- package/dist/packages/teaching/src/scene/shapes/scene-cells.d.ts +84 -0
- package/dist/packages/teaching/src/scene/shapes/scene-slot.d.ts +37 -0
- package/dist/packages/teaching/src/scene/shapes/scene-stack.d.ts +46 -0
- package/dist/packages/teaching/src/scene/shapes/scene-token.d.ts +63 -0
- package/dist/packages/teaching/src/scene/shapes/scene-tokens.d.ts +40 -0
- package/dist/packages/teaching/src/scene/shapes/stack-book.d.ts +35 -0
- package/dist/packages/teaching/src/scene/shapes/stack-layout.d.ts +63 -0
- package/dist/packages/teaching/src/scene/shapes/token-layout.d.ts +39 -0
- package/dist/packages/teaching/src/spec/advice.d.ts +23 -0
- package/dist/packages/teaching/src/spec/chart-names.d.ts +2 -0
- package/dist/packages/teaching/src/spec/describe-lesson.d.ts +85 -0
- package/dist/packages/teaching/src/spec/explainer-guide.d.ts +21 -0
- package/dist/packages/teaching/src/spec/findings.d.ts +39 -0
- package/dist/packages/teaching/src/spec/index.d.ts +14 -0
- package/dist/packages/teaching/src/spec/lesson-plan.d.ts +43 -0
- package/dist/packages/teaching/src/spec/validate-plan.d.ts +11 -0
- package/dist/packages/teaching/src/time/clock.d.ts +7 -0
- package/dist/packages/teaching/src/time/tween.d.ts +19 -0
- package/dist/packages/teaching/src/time/use-tween.d.ts +6 -0
- package/dist/param-CqKUTHaO.js +450 -0
- package/dist/path-BglsXpnO.js +59 -0
- package/dist/plot-axes-DJkLW4wk.js +100 -0
- package/dist/plot-layout-CZVSJ-le.js +912 -0
- package/dist/plot-marks-uozcbOIX.js +229 -0
- package/dist/plot-surface-CbVBvgqZ.js +51 -0
- package/dist/plot-width-DcqtSgzb.js +124 -0
- package/dist/point-layer-C-EYETAt.js +655 -0
- package/dist/reference-lines-BDcttOp0.js +82 -0
- package/dist/scale-C2xgZyZN.js +63 -0
- package/dist/scene-0z2gbaDE.js +4938 -0
- package/dist/scene.js +1 -0
- package/dist/slope-chart-BKVEAVCs.js +1279 -0
- package/dist/{src-1EHkSFS-.js → src-BD6xlvDt.js} +2 -2
- package/dist/{src-DVHlknB6.js → src-CExIrXPC.js} +169 -193
- package/dist/src-DIS0YOj0.js +44 -0
- package/dist/src-Dcfq8vE4.js +2195 -0
- package/dist/styles2.css +907 -59
- package/dist/time-series-BgzGNOk0.js +2670 -0
- package/dist/token-heatmap-BrW1OsKD.js +1354 -0
- package/dist/token-predictions-yerq_Oet.js +1093 -0
- package/dist/tone-scope-DKiSw-JR.js +32 -0
- package/dist/transport-BJweqDPj.js +715 -0
- package/dist/tree-diagram-D09BRqE-.js +1629 -0
- package/dist/treemap-CW4WsJNL.js +472 -0
- package/dist/use-tween-5HZ55_9d.js +72 -0
- package/dist/values-963L6n1m.js +65 -0
- package/dist/violin-plot-DrtPZ1-T.js +1292 -0
- package/dist/waterfall-DYLSnGjm.js +576 -0
- package/package.json +78 -4
- package/recipes/allocation-report.tsx +15 -7
- package/recipes/counting-cards.tsx +656 -0
- package/recipes/explorable-essay.tsx +172 -0
- package/skills/extend-elements/SKILL.md +81 -0
- package/skills/plan-lesson/SKILL.md +86 -0
- package/skills/plan-lesson/references/plan-format.md +114 -0
- package/skills/plan-lesson/references/worked-plan.md +171 -0
- package/skills/review-elements/SKILL.md +47 -3
- package/skills/review-explainer/SKILL.md +97 -0
- package/skills/upgrade-elements/SKILL.md +3 -1
- package/skills/upgrade-elements/references/releases.md +249 -0
- package/skills/use-elements/SKILL.md +22 -14
- package/skills/use-elements/references/charts.md +362 -41
- package/skills/use-elements/references/figures.md +173 -0
- package/skills/use-elements/references/kits.md +180 -0
- package/skills/use-elements/references/teaching.md +36 -0
- package/skills/write-explainer/SKILL.md +112 -0
- package/skills/write-explainer/references/article.md +164 -0
- package/skills/write-explainer/references/lesson.md +148 -0
- package/skills/write-explainer/references/mdx.md +78 -0
- package/skills/write-explainer/references/scene-parts.md +273 -0
- package/skills/write-explainer/references/scene.md +168 -0
- package/skills/write-explainer/references/tutor.md +104 -0
- package/skills/write-explainer/references/worked-essay.md +459 -0
- package/templates/essay/AGENTS.md +14 -0
- package/templates/essay/README.md +59 -0
- package/templates/essay/index.html +17 -0
- package/templates/essay/package.template.json +21 -0
- package/templates/essay/plan.json +96 -0
- package/templates/essay/src/essay.mdx +97 -0
- package/templates/essay/src/figures.tsx +92 -0
- package/templates/essay/src/lesson.ts +83 -0
- package/templates/essay/src/main.tsx +53 -0
- package/templates/essay/src/mdx.d.ts +7 -0
- package/templates/essay/tsconfig.template.json +15 -0
- package/templates/essay/vite.config.template.txt +8 -0
- package/dist/categorical-values-BXi-rJuv.js +0 -74
- package/dist/chart-data-CIJVWCYt.js +0 -21
- package/dist/chart-frame-BaxKn_MB.js +0 -236
- package/dist/chart-input-Bm82_9Rd.js +0 -22
- package/dist/chart-theme-4zprJ3rW.js +0 -404
- package/dist/plot-width-v2c_rA20.js +0 -63
|
@@ -0,0 +1,2670 @@
|
|
|
1
|
+
import { k as e } from "./src-CpdJlDhO.js";
|
|
2
|
+
import { g as t } from "./src-BD6xlvDt.js";
|
|
3
|
+
import { d as n, u as r } from "./src-CExIrXPC.js";
|
|
4
|
+
import { n as i, t as a } from "./chart-tones-ei3BC2AL.js";
|
|
5
|
+
import { A as o, O as s, S as c, T as l, a as u, b as d, c as f, i as p, k as m, m as h, n as g, o as _, p as v, w as ee } from "./plot-layout-CZVSJ-le.js";
|
|
6
|
+
import { i as y, n as b, r as x, t as S } from "./categorical-values-BpVq8cFj.js";
|
|
7
|
+
import { a as C } from "./tone-scope-DKiSw-JR.js";
|
|
8
|
+
import { n as w, r as te, t as T } from "./figure-format-B8kRZMlo.js";
|
|
9
|
+
import { a as E, i as D, o as O, r as k, t as A } from "./scale-C2xgZyZN.js";
|
|
10
|
+
import { t as ne } from "./chart-cursor-1mFd48Jc.js";
|
|
11
|
+
import { c as re, i as ie, l as ae, n as j, o as M, r as oe, s as N, t as se } from "./figure-frame-BJ3REgTA.js";
|
|
12
|
+
import { n as P, t as F } from "./plot-width-DcqtSgzb.js";
|
|
13
|
+
import { t as ce } from "./plot-axes-DJkLW4wk.js";
|
|
14
|
+
import { a as I, c as L, d as R, f as le, i as z, l as ue, n as B, o as de, r as V, s as fe, t as pe } from "./plot-marks-uozcbOIX.js";
|
|
15
|
+
import { n as me, r as he, t as ge } from "./plot-surface-CbVBvgqZ.js";
|
|
16
|
+
import { n as _e, t as ve } from "./reference-lines-BDcttOp0.js";
|
|
17
|
+
import { n as ye, r as be, t as xe } from "./path-BglsXpnO.js";
|
|
18
|
+
import { t as Se } from "./locate-Bcg3QcP4.js";
|
|
19
|
+
import * as H from "@stylexjs/stylex";
|
|
20
|
+
import { createParts as U } from "@ui-sdk/react/primitive";
|
|
21
|
+
import { useEffect as Ce, useId as W, useRef as we, useState as G } from "react";
|
|
22
|
+
import { bindDrag as K, createChange as q, createSpans as Te, definePrimitive as Ee, dispatch as De } from "@ui-sdk/core";
|
|
23
|
+
import { Fragment as Oe, jsx as J, jsxs as Y } from "react/jsx-runtime";
|
|
24
|
+
// packages/charts/src/cartesian/bar-data.ts
|
|
25
|
+
function ke({ composition: e, series: t, categoryIds: n, domain: r }) {
|
|
26
|
+
if (e === void 0) return;
|
|
27
|
+
if (e.buckets.length !== n.length) return "Composition requires one explicit bucket per category.";
|
|
28
|
+
let i = e.annotation;
|
|
29
|
+
if (i !== void 0) {
|
|
30
|
+
if (!n.includes(i.categoryId) || !Number.isFinite(i.value)) return "A bar annotation requires an existing category and a finite value.";
|
|
31
|
+
if (i.value < r[0] || i.value > r[1]) return "A bar annotation must fit the supplied domain.";
|
|
32
|
+
}
|
|
33
|
+
for (let [n, i] of e.buckets.entries()) if (i.kind !== "gap") {
|
|
34
|
+
if (!Number.isFinite(i.total) || i.total < r[0] || i.total > r[1]) return "Context totals must be finite and inside the supplied domain.";
|
|
35
|
+
if (i.kind === "parts") {
|
|
36
|
+
let e = t.map((e) => e.values[n]);
|
|
37
|
+
if (e.some((e) => e != null && e < 0)) return "Composition parts require nonnegative reported values.";
|
|
38
|
+
if (e.reduce((e, t) => e + (t ?? 0), 0) > r[1] || i.total < 0) return "Composition parts must fit the supplied positive domain.";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
var X = 6;
|
|
43
|
+
function Z(e, t) {
|
|
44
|
+
return e === null ? !0 : e === void 0 || !Number.isFinite(e) ? !1 : e >= t[0] && e <= t[1];
|
|
45
|
+
}
|
|
46
|
+
function Q({ marker: e, categoryCount: t, domain: n }) {
|
|
47
|
+
let r = e.kind === "tick" ? [e.values] : [e.lower, e.upper];
|
|
48
|
+
if (r.some((e) => e.length !== t)) return "Every bar marker requires one explicit value per category.";
|
|
49
|
+
if (r.some((e) => e.some((e) => !Z(e, n)))) return "Bar marker values must be finite and within the supplied domain.";
|
|
50
|
+
if (e.kind === "range") for (let [t, n] of e.lower.entries()) {
|
|
51
|
+
let r = e.upper[t] ?? null;
|
|
52
|
+
if (n === null != (r === null) || n !== null && r !== null && n > r) return "A range marker needs both bounds, with the lower bound at most the upper bound, or neither.";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function Ae({ markers: e, annotations: t, emphasizedCategoryIds: n, seriesIds: r, categoryIds: i, domain: a }) {
|
|
56
|
+
if (e.length > X) return `Supply at most ${X} bar markers.`;
|
|
57
|
+
let o = [...e, ...t];
|
|
58
|
+
if (new Set(o.map((e) => e.id)).size !== o.length || r.some((e) => o.some((t) => t.id === e))) return "Bar series, markers, and annotations require distinct identifiers.";
|
|
59
|
+
for (let t of e) {
|
|
60
|
+
if (!r.includes(t.seriesId)) return "Each bar marker must refer to a supplied series.";
|
|
61
|
+
let e = Q({
|
|
62
|
+
marker: t,
|
|
63
|
+
categoryCount: i.length,
|
|
64
|
+
domain: a
|
|
65
|
+
});
|
|
66
|
+
if (e !== void 0) return e;
|
|
67
|
+
}
|
|
68
|
+
for (let e of t) {
|
|
69
|
+
let t = e.seriesId === void 0 || r.includes(e.seriesId), n = e.label.trim() !== "";
|
|
70
|
+
if (!(i.includes(e.categoryId) && t && n)) return "Each bar annotation needs a label, a supplied category, and a supplied series when it names one.";
|
|
71
|
+
}
|
|
72
|
+
if (new Set(t.map((e) => JSON.stringify([e.categoryId, e.seriesId ?? null]))).size !== t.length) return "Each bar can hold one annotation.";
|
|
73
|
+
if (new Set(n).size !== n.length || n.some((e) => !i.includes(e))) return "Emphasized categories must be unique supplied categories.";
|
|
74
|
+
}
|
|
75
|
+
function je({ marker: e, index: t, valueText: n }) {
|
|
76
|
+
if (e.kind === "tick") return n(e.values[t] ?? null);
|
|
77
|
+
let r = e.lower[t] ?? null, i = e.upper[t] ?? null;
|
|
78
|
+
return r === null || i === null ? n(null) : `${n(r)} – ${n(i)}`;
|
|
79
|
+
}
|
|
80
|
+
function Me(e, t) {
|
|
81
|
+
return e.kind === "tick" ? e.values[t] ?? null : e.upper[t] ?? null;
|
|
82
|
+
}
|
|
83
|
+
// packages/charts/src/cartesian/value-labels.ts
|
|
84
|
+
var Ne = 6.5, Pe = 14, Fe = 6, Ie = .5;
|
|
85
|
+
function Le(e, t) {
|
|
86
|
+
let n = (e.text.length + t.text.length) * Ne * Ie + Fe;
|
|
87
|
+
return Math.abs(e.x - t.x) < n && Math.abs(e.y - t.y) < Pe;
|
|
88
|
+
}
|
|
89
|
+
function Re(e) {
|
|
90
|
+
return e.filter((t, n) => e.slice(0, n).every((e) => !Le(t, e)));
|
|
91
|
+
}
|
|
92
|
+
function ze({ x: e, text: t, left: n, right: r }) {
|
|
93
|
+
let i = t.length * Ne * Ie;
|
|
94
|
+
return e - i < n ? {
|
|
95
|
+
x: n,
|
|
96
|
+
anchor: "start"
|
|
97
|
+
} : e + i > r ? {
|
|
98
|
+
x: r,
|
|
99
|
+
anchor: "end"
|
|
100
|
+
} : {
|
|
101
|
+
x: e,
|
|
102
|
+
anchor: "middle"
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
// packages/charts/src/cartesian/bar-overlays.tsx
|
|
106
|
+
var Be = 3, Ve = 14, He = .6, Ue = .5;
|
|
107
|
+
function We({ marker: e, index: t, span: n, base: r, y: i }) {
|
|
108
|
+
let a = n.x + n.width * Ue;
|
|
109
|
+
if (e.kind === "tick") {
|
|
110
|
+
let o = e.values[t] ?? null;
|
|
111
|
+
if (o === null) return [];
|
|
112
|
+
let s = {
|
|
113
|
+
key: "tick",
|
|
114
|
+
x1: n.x - Be,
|
|
115
|
+
x2: n.x + n.width + Be,
|
|
116
|
+
y1: i(o),
|
|
117
|
+
y2: i(o)
|
|
118
|
+
};
|
|
119
|
+
return r !== null && r !== o ? [{
|
|
120
|
+
key: "stem",
|
|
121
|
+
x1: a,
|
|
122
|
+
x2: a,
|
|
123
|
+
y1: i(r),
|
|
124
|
+
y2: i(o)
|
|
125
|
+
}, s] : [s];
|
|
126
|
+
}
|
|
127
|
+
let o = e.lower[t] ?? null, s = e.upper[t] ?? null;
|
|
128
|
+
if (o === null || s === null) return [];
|
|
129
|
+
let c = Math.min(Ve, n.width * He) * Ue;
|
|
130
|
+
return [
|
|
131
|
+
{
|
|
132
|
+
key: "whisker",
|
|
133
|
+
x1: a,
|
|
134
|
+
x2: a,
|
|
135
|
+
y1: i(o),
|
|
136
|
+
y2: i(s)
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
key: "upper",
|
|
140
|
+
x1: a - c,
|
|
141
|
+
x2: a + c,
|
|
142
|
+
y1: i(s),
|
|
143
|
+
y2: i(s)
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
key: "lower",
|
|
147
|
+
x1: a - c,
|
|
148
|
+
x2: a + c,
|
|
149
|
+
y1: i(o),
|
|
150
|
+
y2: i(o)
|
|
151
|
+
}
|
|
152
|
+
];
|
|
153
|
+
}
|
|
154
|
+
function Ge({ markers: e, categoryIds: t, span: n, barTop: r, y: i, isReceded: a }) {
|
|
155
|
+
return /* @__PURE__ */ J("g", { children: e.map((e) => /* @__PURE__ */ J("g", { children: t.map((t, o) => {
|
|
156
|
+
let s = We({
|
|
157
|
+
marker: e,
|
|
158
|
+
index: o,
|
|
159
|
+
span: n(t, e.seriesId),
|
|
160
|
+
base: r(o, e.seriesId),
|
|
161
|
+
y: i
|
|
162
|
+
});
|
|
163
|
+
return /* @__PURE__ */ J("g", {
|
|
164
|
+
...H.props(P.emphasis, a(t) && P.receded),
|
|
165
|
+
children: s.map(({ key: t, ...n }) => /* @__PURE__ */ J(fe, {
|
|
166
|
+
...n,
|
|
167
|
+
tone: e.tone ?? "neutral"
|
|
168
|
+
}, t))
|
|
169
|
+
}, t);
|
|
170
|
+
}) }, e.id)) });
|
|
171
|
+
}
|
|
172
|
+
function Ke({ annotations: e, left: t, right: n }) {
|
|
173
|
+
return /* @__PURE__ */ J("g", {
|
|
174
|
+
"aria-hidden": !0,
|
|
175
|
+
children: Re(e).map((e) => {
|
|
176
|
+
let r = ze({
|
|
177
|
+
x: e.x,
|
|
178
|
+
text: e.text,
|
|
179
|
+
left: t,
|
|
180
|
+
right: n
|
|
181
|
+
});
|
|
182
|
+
return /* @__PURE__ */ J("g", {
|
|
183
|
+
...H.props(P.emphasis, e.isReceded && P.receded),
|
|
184
|
+
children: /* @__PURE__ */ J(L, {
|
|
185
|
+
x: r.x,
|
|
186
|
+
y: e.y,
|
|
187
|
+
anchor: r.anchor,
|
|
188
|
+
children: e.text
|
|
189
|
+
})
|
|
190
|
+
}, e.id);
|
|
191
|
+
})
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
// packages/charts/src/cartesian/composition-bars.tsx
|
|
195
|
+
var qe = {
|
|
196
|
+
mark: {
|
|
197
|
+
k3nNDw: "x1hj3fc7",
|
|
198
|
+
k1ekBW: "xwcsmn1",
|
|
199
|
+
kIyJzY: "xtitasy x12w9bfk",
|
|
200
|
+
kAMwcw: "x1faw7qm",
|
|
201
|
+
$$css: !0
|
|
202
|
+
},
|
|
203
|
+
geometry: (e, t) => [{
|
|
204
|
+
k3aq6I: e == null ? e : "xsqj5wx",
|
|
205
|
+
kSiTet: t == null ? t : "xb4nw82",
|
|
206
|
+
$$css: !0
|
|
207
|
+
}, {
|
|
208
|
+
"--x-transform": e ?? void 0,
|
|
209
|
+
"--x-opacity": t ?? void 0
|
|
210
|
+
}]
|
|
211
|
+
}, Je = .18, Ye = .3;
|
|
212
|
+
function Xe({ bucket: e, series: t, focusedSeries: n, index: r, x: i, width: a, y: o, isSelected: s, isInspected: c, highlighted: l, toneOf: u }) {
|
|
213
|
+
let d = n !== void 0, f = n !== void 0 && !t.some((e) => e.id === n.id) ? [...t, n] : t;
|
|
214
|
+
function p(e, t) {
|
|
215
|
+
let n = o(t), r = o(t + e);
|
|
216
|
+
return `translateY(${Math.min(n, r)}px) scaleY(${Math.max(+(e === 0 && t === 0), Math.abs(r - n))})`;
|
|
217
|
+
}
|
|
218
|
+
let m = d ? Je : +(e.kind === "total");
|
|
219
|
+
return /* @__PURE__ */ Y(Oe, { children: [e.kind !== "gap" && /* @__PURE__ */ J("g", {
|
|
220
|
+
...H.props(qe.mark, qe.geometry(p(e.total, 0), m)),
|
|
221
|
+
children: /* @__PURE__ */ J(V, {
|
|
222
|
+
x: i,
|
|
223
|
+
y: 0,
|
|
224
|
+
width: a,
|
|
225
|
+
height: 1,
|
|
226
|
+
tone: "neutral",
|
|
227
|
+
isSelected: s,
|
|
228
|
+
isInspected: c
|
|
229
|
+
})
|
|
230
|
+
}), f.map((o, f) => {
|
|
231
|
+
let m = o.values[r];
|
|
232
|
+
if (m == null) return null;
|
|
233
|
+
let h = d ? 0 : t.slice(0, f).reduce((e, t) => e + (t.values[r] ?? 0), 0), g = d ? n.id === o.id : e.kind === "parts", _ = l != null && l !== o.id, v = g ? !d && _ ? Ye : 1 : 0;
|
|
234
|
+
return /* @__PURE__ */ J("g", {
|
|
235
|
+
...H.props(qe.mark, qe.geometry(p(m, h), v)),
|
|
236
|
+
children: /* @__PURE__ */ J(V, {
|
|
237
|
+
x: i,
|
|
238
|
+
y: 0,
|
|
239
|
+
width: a,
|
|
240
|
+
height: 1,
|
|
241
|
+
tone: u(o.id),
|
|
242
|
+
isSelected: s,
|
|
243
|
+
isInspected: c
|
|
244
|
+
})
|
|
245
|
+
}, o.id);
|
|
246
|
+
})] });
|
|
247
|
+
}
|
|
248
|
+
// packages/charts/src/cartesian/bar-chart.tsx
|
|
249
|
+
var Ze = { placeholder: {
|
|
250
|
+
kqGvvJ: "x1we84gm",
|
|
251
|
+
$$css: !0
|
|
252
|
+
} }, Qe = 18, $e = 8, et = 14, tt = .08, nt = 8, rt = 8, it = .5;
|
|
253
|
+
function at({ legend: e, layoutLegend: t, notes: n, children: r, inspectionId: i, label: a, summary: o, rows: s = [], x: c = 0, width: l = 0, offset: u, data: d, isLoading: f = !1, ...p }) {
|
|
254
|
+
let m = f && e.length === 0 && p.report?.seriesValues === void 0;
|
|
255
|
+
return /* @__PURE__ */ Y(j, {
|
|
256
|
+
...p,
|
|
257
|
+
series: e,
|
|
258
|
+
seriesLegend: m ? /* @__PURE__ */ J(N, {}) : /* @__PURE__ */ J(M, {
|
|
259
|
+
id: i,
|
|
260
|
+
label: a,
|
|
261
|
+
summary: o,
|
|
262
|
+
legend: e,
|
|
263
|
+
hasSeriesSummary: p.report?.seriesValues !== void 0,
|
|
264
|
+
layoutLegend: t,
|
|
265
|
+
rows: s,
|
|
266
|
+
notes: n,
|
|
267
|
+
x: c,
|
|
268
|
+
width: l,
|
|
269
|
+
offset: u
|
|
270
|
+
}),
|
|
271
|
+
children: [d !== void 0 && /* @__PURE__ */ J(ae, { ...d }), r]
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
function ot() {
|
|
275
|
+
let e = C();
|
|
276
|
+
return (t) => t.map((t, n) => ({
|
|
277
|
+
id: t.id,
|
|
278
|
+
label: t.label,
|
|
279
|
+
tone: e({
|
|
280
|
+
id: t.id,
|
|
281
|
+
tone: t.tone,
|
|
282
|
+
index: n
|
|
283
|
+
})
|
|
284
|
+
}));
|
|
285
|
+
}
|
|
286
|
+
function st({ title: e = "Loading chart", series: t = [], height: n = "compact", ...i }) {
|
|
287
|
+
let a = W(), o = ot()(t);
|
|
288
|
+
return /* @__PURE__ */ J("div", {
|
|
289
|
+
"aria-hidden": !0,
|
|
290
|
+
inert: !0,
|
|
291
|
+
children: /* @__PURE__ */ J(at, {
|
|
292
|
+
...i,
|
|
293
|
+
title: e,
|
|
294
|
+
status: "loading",
|
|
295
|
+
legend: o,
|
|
296
|
+
inspectionId: a,
|
|
297
|
+
isLoading: !0,
|
|
298
|
+
children: /* @__PURE__ */ J("div", {
|
|
299
|
+
...H.props(P.plot, Ze.placeholder),
|
|
300
|
+
children: /* @__PURE__ */ J(r, { height: f[n] })
|
|
301
|
+
})
|
|
302
|
+
})
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
function ct(e, t) {
|
|
306
|
+
return Array.from({ length: t }, (t, n) => e.reduce((e, t) => e + Math.max(0, t.values[n] ?? 0), 0));
|
|
307
|
+
}
|
|
308
|
+
function lt({ categories: e, series: t, domain: n, mode: r }) {
|
|
309
|
+
if (e.length > x.items || t.length > x.series) return `Choose a window with at most ${x.items} categories and ${x.series} series.`;
|
|
310
|
+
if (O(n) !== void 0 || n[0] > 0 || n[1] < 0) return "The bar domain must be finite, increasing, and include zero.";
|
|
311
|
+
if (!o(e) || !o(t)) return "Bar categories and series require unique identifiers.";
|
|
312
|
+
for (let i of t) {
|
|
313
|
+
if (i.values.length !== e.length) return "Every series requires one explicit value per category.";
|
|
314
|
+
if (i.values.some((e) => e !== null && E(e, n))) return "Bar values must be finite and within the supplied domain.";
|
|
315
|
+
if (r === "stacked" && i.values.some((e) => e === null || e < 0)) return "Stacked bars require present nonnegative values.";
|
|
316
|
+
}
|
|
317
|
+
if (r === "stacked" && ct(t, e.length).some((e) => e > n[1])) return "Stacked bar totals must fit the supplied domain.";
|
|
318
|
+
}
|
|
319
|
+
function ut({ categories: e, series: t, mode: n, composition: r, referenceLines: i, markers: a }) {
|
|
320
|
+
let o = n === "stacked" || r !== void 0, s = t.flatMap((e) => e.values), c = o ? ct(t, e.length) : [], l = r?.focusedSeries?.values ?? [], u = r?.buckets.map((e) => e.kind === "gap" ? null : e.total) ?? [], d = a.flatMap((e) => e.kind === "tick" ? e.values : [...e.lower, ...e.upper]);
|
|
321
|
+
return [
|
|
322
|
+
...s,
|
|
323
|
+
...c,
|
|
324
|
+
...l,
|
|
325
|
+
...u,
|
|
326
|
+
...d,
|
|
327
|
+
...i.map((e) => e.value),
|
|
328
|
+
...r?.annotation === void 0 ? [] : [r.annotation.value]
|
|
329
|
+
];
|
|
330
|
+
}
|
|
331
|
+
function dt({ categories: e, series: t, domain: n, mode: r = "grouped", valueFormat: i, tickFormat: a, valueLabel: o, highlighted: s, selected: c, onSelectedChange: l, height: d = "compact", composition: f, referenceLines: h = [], markers: g = [], annotations: _ = [], emphasizedCategoryIds: v = [], ...y }) {
|
|
332
|
+
let { emptyLabel: b = "No categories", ...x } = y, { locale: S, title: w } = x, T = f?.focusedSeries, E = W(), D = W(), { ref: O, width: k, height: ie } = he(d), ae = C(), j = ot();
|
|
333
|
+
if (x.status === "loading") return /* @__PURE__ */ J(st, {
|
|
334
|
+
...x,
|
|
335
|
+
series: t,
|
|
336
|
+
height: d
|
|
337
|
+
});
|
|
338
|
+
let M = n ?? u({
|
|
339
|
+
values: ut({
|
|
340
|
+
categories: e,
|
|
341
|
+
series: t,
|
|
342
|
+
mode: r,
|
|
343
|
+
composition: f,
|
|
344
|
+
referenceLines: h,
|
|
345
|
+
markers: g
|
|
346
|
+
}),
|
|
347
|
+
isZeroBased: !0
|
|
348
|
+
}), N = T === void 0 ? void 0 : lt({
|
|
349
|
+
categories: e,
|
|
350
|
+
series: [T],
|
|
351
|
+
domain: M,
|
|
352
|
+
mode: "grouped"
|
|
353
|
+
}), F = lt({
|
|
354
|
+
categories: e,
|
|
355
|
+
series: t,
|
|
356
|
+
domain: M,
|
|
357
|
+
mode: r
|
|
358
|
+
}) ?? N, I = e.map((e) => e.id), L = Ae({
|
|
359
|
+
markers: g,
|
|
360
|
+
annotations: _,
|
|
361
|
+
emphasizedCategoryIds: v,
|
|
362
|
+
seriesIds: [...t, ...T === void 0 ? [] : [T]].map((e) => e.id),
|
|
363
|
+
categoryIds: I,
|
|
364
|
+
domain: M
|
|
365
|
+
}) ?? _e({
|
|
366
|
+
lines: h,
|
|
367
|
+
domain: M
|
|
368
|
+
}), R = F ?? ke({
|
|
369
|
+
composition: f,
|
|
370
|
+
series: t,
|
|
371
|
+
categoryIds: I,
|
|
372
|
+
domain: M
|
|
373
|
+
}) ?? L;
|
|
374
|
+
if (R !== void 0) return /* @__PURE__ */ J(oe, {
|
|
375
|
+
...x,
|
|
376
|
+
message: R
|
|
377
|
+
});
|
|
378
|
+
function z(e) {
|
|
379
|
+
return te({
|
|
380
|
+
value: e,
|
|
381
|
+
locale: S,
|
|
382
|
+
format: i
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
let ue = T !== void 0 && !t.some((e) => e.id === T.id), B = [...t, ...ue ? [T] : []], de = new Map(B.map((e, t) => [e.id, ae({
|
|
386
|
+
id: e.id,
|
|
387
|
+
tone: e.tone,
|
|
388
|
+
index: t
|
|
389
|
+
})]));
|
|
390
|
+
function fe(e) {
|
|
391
|
+
return de.get(e) ?? "neutral";
|
|
392
|
+
}
|
|
393
|
+
let pe = f === void 0 ? void 0 : {
|
|
394
|
+
id: E,
|
|
395
|
+
label: f.contextLabel,
|
|
396
|
+
tone: "neutral",
|
|
397
|
+
values: f.buckets.map((e) => e.kind === "gap" ? null : e.total)
|
|
398
|
+
}, ye = pe === void 0 ? t : [pe, ...B], be = (T !== void 0 && pe !== void 0 ? [T, pe] : t).map((e) => ({
|
|
399
|
+
id: e.id,
|
|
400
|
+
label: e.label,
|
|
401
|
+
tone: e.id === E ? "neutral" : fe(e.id)
|
|
402
|
+
})), xe = g.map((e) => ({
|
|
403
|
+
id: e.id,
|
|
404
|
+
label: e.label,
|
|
405
|
+
tone: e.tone ?? "neutral",
|
|
406
|
+
shape: e.kind
|
|
407
|
+
}));
|
|
408
|
+
function Se(n) {
|
|
409
|
+
let r = e[n], i = f?.buckets[n], a = T !== void 0 && pe !== void 0 ? [T, pe] : pe === void 0 || i?.kind === "parts" ? t : [], o = i === void 0 ? void 0 : i.kind === "gap" ? "No reported value" : z(i.total), s = a.map((e) => ({
|
|
410
|
+
id: e.id,
|
|
411
|
+
label: e.label,
|
|
412
|
+
tone: e.id === E ? "neutral" : fe(e.id),
|
|
413
|
+
value: z(e.values[n] ?? null)
|
|
414
|
+
})), c = g.map((e) => ({
|
|
415
|
+
id: e.id,
|
|
416
|
+
label: e.label,
|
|
417
|
+
tone: e.tone ?? "neutral",
|
|
418
|
+
shape: e.kind,
|
|
419
|
+
value: je({
|
|
420
|
+
marker: e,
|
|
421
|
+
index: n,
|
|
422
|
+
valueText: z
|
|
423
|
+
})
|
|
424
|
+
})), l = h.map((e) => ({
|
|
425
|
+
id: e.id,
|
|
426
|
+
label: e.label,
|
|
427
|
+
tone: e.tone ?? "neutral",
|
|
428
|
+
shape: "dashed",
|
|
429
|
+
value: z(e.value)
|
|
430
|
+
}));
|
|
431
|
+
return {
|
|
432
|
+
category: r,
|
|
433
|
+
label: r?.label,
|
|
434
|
+
summary: o,
|
|
435
|
+
rows: r === void 0 ? [] : [
|
|
436
|
+
...s,
|
|
437
|
+
...c,
|
|
438
|
+
...l
|
|
439
|
+
],
|
|
440
|
+
notes: _.filter((e) => e.categoryId === r?.id).map((e) => e.label)
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
let U = f?.annotation, Ce = _.length > 0 || U !== void 0, we = p({
|
|
444
|
+
width: k,
|
|
445
|
+
height: ie,
|
|
446
|
+
direction: "columns",
|
|
447
|
+
categories: e.map((e) => ({
|
|
448
|
+
id: e.id,
|
|
449
|
+
label: e.axisLabel ?? e.label
|
|
450
|
+
})),
|
|
451
|
+
value: {
|
|
452
|
+
label: o ?? "",
|
|
453
|
+
format: i,
|
|
454
|
+
tickFormat: a
|
|
455
|
+
},
|
|
456
|
+
valueDomain: M,
|
|
457
|
+
locale: S,
|
|
458
|
+
topInset: Ce ? Qe : 0,
|
|
459
|
+
hasValueTitle: o !== void 0
|
|
460
|
+
}), { box: G, band: K } = we, q = we.value.position, Te = A({
|
|
461
|
+
ids: t.map((e) => e.id),
|
|
462
|
+
range: [0, K.bandwidth],
|
|
463
|
+
padding: tt
|
|
464
|
+
}), Ee = r === "stacked" || f !== void 0;
|
|
465
|
+
function De(e) {
|
|
466
|
+
return K.start(e) ?? G.left;
|
|
467
|
+
}
|
|
468
|
+
function Oe(e) {
|
|
469
|
+
return De(e) + K.bandwidth * it;
|
|
470
|
+
}
|
|
471
|
+
function X(e, t) {
|
|
472
|
+
let n = De(e);
|
|
473
|
+
return Ee ? {
|
|
474
|
+
x: n,
|
|
475
|
+
width: K.bandwidth
|
|
476
|
+
} : {
|
|
477
|
+
x: n + (Te.start(t) ?? 0),
|
|
478
|
+
width: Te.bandwidth
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
function Z(e, n) {
|
|
482
|
+
if (!Ee) return t.find((e) => e.id === n)?.values[e] ?? null;
|
|
483
|
+
let r = t.flatMap((t) => [t.values[e] ?? null].filter((e) => e !== null));
|
|
484
|
+
return r.length === 0 ? null : r.reduce((e, t) => e + t, 0);
|
|
485
|
+
}
|
|
486
|
+
function Q(e, n) {
|
|
487
|
+
let r = (n === void 0 ? t : t.filter((e) => e.id === n)).flatMap((t) => [t.values[e] ?? null].filter((e) => e !== null)), i = Ee ? r.reduce((e, t) => e + Math.max(0, t), 0) : Math.max(0, ...r), a = f?.buckets[e], o = a === void 0 || a.kind === "gap" ? 0 : a.total, s = g.filter((e) => n === void 0 || e.seriesId === n).flatMap((t) => [Me(t, e)].filter((e) => e !== null));
|
|
488
|
+
return Math.max(0, i, o, ...s);
|
|
489
|
+
}
|
|
490
|
+
function Ne(e) {
|
|
491
|
+
return Math.max(et, q(e) - $e);
|
|
492
|
+
}
|
|
493
|
+
let Pe = {
|
|
494
|
+
label: `${w} observations`,
|
|
495
|
+
columns: [{
|
|
496
|
+
id: "category",
|
|
497
|
+
label: "Category"
|
|
498
|
+
}, {
|
|
499
|
+
id: "value",
|
|
500
|
+
label: "Value"
|
|
501
|
+
}],
|
|
502
|
+
rows: [...e.map((e, t) => ({
|
|
503
|
+
id: e.id,
|
|
504
|
+
values: [e.label, [
|
|
505
|
+
...ye.map((e) => `${e.label}: ${z(e.values[t] ?? null)}`),
|
|
506
|
+
...g.map((e) => `${e.label}: ${je({
|
|
507
|
+
marker: e,
|
|
508
|
+
index: t,
|
|
509
|
+
valueText: z
|
|
510
|
+
})}`),
|
|
511
|
+
..._.filter((t) => t.categoryId === e.id).map((e) => e.label)
|
|
512
|
+
].join(" · ")]
|
|
513
|
+
})), ...h.map((e) => ({
|
|
514
|
+
id: `reference:${e.id}`,
|
|
515
|
+
values: [e.label, z(e.value)]
|
|
516
|
+
}))]
|
|
517
|
+
};
|
|
518
|
+
return /* @__PURE__ */ J(ee, {
|
|
519
|
+
items: e,
|
|
520
|
+
readout: (e) => re(Se(I.indexOf(e))),
|
|
521
|
+
locate: (e) => K.idAt(e.x / e.width * G.width),
|
|
522
|
+
selected: c ?? null,
|
|
523
|
+
onSelect: l,
|
|
524
|
+
render: (n, { inspected: i, cursor: a }) => {
|
|
525
|
+
let u = Se(I.indexOf(i ?? ""));
|
|
526
|
+
function d(e) {
|
|
527
|
+
let t = v.includes(e);
|
|
528
|
+
return v.length > 0 && !t && i !== e;
|
|
529
|
+
}
|
|
530
|
+
let p = U === void 0 || !I.includes(U.categoryId) ? [] : [{
|
|
531
|
+
id: `composition:${U.categoryId}`,
|
|
532
|
+
text: U.label,
|
|
533
|
+
x: Oe(U.categoryId),
|
|
534
|
+
y: Ne(U.value),
|
|
535
|
+
isReceded: d(U.categoryId)
|
|
536
|
+
}], ee = _.map((e) => {
|
|
537
|
+
let t = e.seriesId === void 0 ? {
|
|
538
|
+
x: De(e.categoryId),
|
|
539
|
+
width: K.bandwidth
|
|
540
|
+
} : X(e.categoryId, e.seriesId);
|
|
541
|
+
return {
|
|
542
|
+
id: e.id,
|
|
543
|
+
text: e.label,
|
|
544
|
+
x: t.x + t.width * it,
|
|
545
|
+
y: Ne(Q(I.indexOf(e.categoryId), e.seriesId)),
|
|
546
|
+
isReceded: d(e.categoryId)
|
|
547
|
+
};
|
|
548
|
+
}), y = [...p, ...ee];
|
|
549
|
+
return /* @__PURE__ */ J(at, {
|
|
550
|
+
...x,
|
|
551
|
+
figure: n,
|
|
552
|
+
legend: [...be, ...xe],
|
|
553
|
+
layoutLegend: [...j(t), ...xe],
|
|
554
|
+
notes: u.notes,
|
|
555
|
+
inspectionId: D,
|
|
556
|
+
label: u.label,
|
|
557
|
+
titleDetail: u.category === void 0 ? void 0 : [u.category.axisLabel ?? u.category.label, u.summary].filter(Boolean).join(" · "),
|
|
558
|
+
summary: u.summary,
|
|
559
|
+
rows: u.rows,
|
|
560
|
+
x: Oe(i ?? ""),
|
|
561
|
+
width: k,
|
|
562
|
+
offset: K.bandwidth * it + rt,
|
|
563
|
+
data: Pe,
|
|
564
|
+
children: e.length === 0 || t.length === 0 && f === void 0 ? /* @__PURE__ */ J(se, { children: b }) : /* @__PURE__ */ Y(me, {
|
|
565
|
+
plotRef: O,
|
|
566
|
+
box: G,
|
|
567
|
+
label: m({
|
|
568
|
+
title: w,
|
|
569
|
+
marks: "categories",
|
|
570
|
+
isSelectable: l !== void 0
|
|
571
|
+
}),
|
|
572
|
+
readoutId: D,
|
|
573
|
+
children: [
|
|
574
|
+
/* @__PURE__ */ J(ce, {
|
|
575
|
+
box: G,
|
|
576
|
+
xTicks: we.bandTicks,
|
|
577
|
+
yTicks: we.valueTicks,
|
|
578
|
+
yTitle: o
|
|
579
|
+
}),
|
|
580
|
+
/* @__PURE__ */ Y(ge, {
|
|
581
|
+
box: G,
|
|
582
|
+
children: [
|
|
583
|
+
e.map((e, n) => {
|
|
584
|
+
let a = f?.buckets[n], o = {
|
|
585
|
+
isSelected: c === e.id,
|
|
586
|
+
isInspected: i === e.id
|
|
587
|
+
};
|
|
588
|
+
return a === void 0 ? t.map((i, a) => {
|
|
589
|
+
let c = i.values[n];
|
|
590
|
+
if (c == null || r === "stacked" && c === 0) return null;
|
|
591
|
+
let l = r === "stacked" ? t.slice(0, a).reduce((e, t) => e + (t.values[n] ?? 0), 0) : 0, u = q(l), f = q(l + c), p = s != null && s !== i.id, m = X(e.id, i.id);
|
|
592
|
+
return /* @__PURE__ */ J(V, {
|
|
593
|
+
...o,
|
|
594
|
+
x: m.x,
|
|
595
|
+
y: Math.min(u, f),
|
|
596
|
+
width: m.width,
|
|
597
|
+
height: Math.max(+(c === 0), Math.abs(f - u)),
|
|
598
|
+
tone: fe(i.id),
|
|
599
|
+
emphasis: p || d(e.id) ? "receded" : "normal",
|
|
600
|
+
mark: t.length === 1 ? e.id : `${e.id}:${i.id}`
|
|
601
|
+
}, `${e.id}:${i.id}`);
|
|
602
|
+
}) : /* @__PURE__ */ J("g", {
|
|
603
|
+
...H.props(P.emphasis, d(e.id) && P.receded),
|
|
604
|
+
children: /* @__PURE__ */ J(Xe, {
|
|
605
|
+
...o,
|
|
606
|
+
bucket: a,
|
|
607
|
+
series: t,
|
|
608
|
+
focusedSeries: T,
|
|
609
|
+
index: n,
|
|
610
|
+
x: De(e.id),
|
|
611
|
+
width: K.bandwidth,
|
|
612
|
+
y: q,
|
|
613
|
+
highlighted: s,
|
|
614
|
+
toneOf: fe
|
|
615
|
+
})
|
|
616
|
+
}, e.id);
|
|
617
|
+
}),
|
|
618
|
+
/* @__PURE__ */ J(le, {
|
|
619
|
+
x1: G.left,
|
|
620
|
+
x2: G.right,
|
|
621
|
+
y1: q(0),
|
|
622
|
+
y2: q(0)
|
|
623
|
+
}),
|
|
624
|
+
/* @__PURE__ */ J(Ge, {
|
|
625
|
+
markers: g,
|
|
626
|
+
categoryIds: I,
|
|
627
|
+
span: X,
|
|
628
|
+
barTop: Z,
|
|
629
|
+
y: q,
|
|
630
|
+
isReceded: d
|
|
631
|
+
})
|
|
632
|
+
]
|
|
633
|
+
}),
|
|
634
|
+
/* @__PURE__ */ J(ve, {
|
|
635
|
+
lines: h,
|
|
636
|
+
box: G,
|
|
637
|
+
position: q,
|
|
638
|
+
valueText: z,
|
|
639
|
+
avoid: Re(y)
|
|
640
|
+
}),
|
|
641
|
+
/* @__PURE__ */ J(Ke, {
|
|
642
|
+
annotations: y,
|
|
643
|
+
left: G.left,
|
|
644
|
+
right: G.right
|
|
645
|
+
}),
|
|
646
|
+
a !== null && /* @__PURE__ */ J(ne, {
|
|
647
|
+
x: Oe(a),
|
|
648
|
+
top: G.top,
|
|
649
|
+
bottom: G.bottom,
|
|
650
|
+
width: Math.max(nt, K.bandwidth)
|
|
651
|
+
})
|
|
652
|
+
]
|
|
653
|
+
})
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
// packages/charts/src/cartesian/breakdown-bar.tsx
|
|
659
|
+
var ft = {
|
|
660
|
+
kzqmXN: "x5lhr3w",
|
|
661
|
+
kGVxlE: "x1iotiob",
|
|
662
|
+
kZKoxP: "x5yr21d",
|
|
663
|
+
$$css: !0
|
|
664
|
+
}, pt = { segment: (e, t, n) => [
|
|
665
|
+
ft,
|
|
666
|
+
{
|
|
667
|
+
kWkggS: t == null ? t : "xl8spv7",
|
|
668
|
+
$$css: !0
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
"--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(`${e}%`),
|
|
672
|
+
"--x-backgroundColor": t ?? void 0,
|
|
673
|
+
"--x-boxShadow": `inset 0 0 0 1px ${n}` == null ? void 0 : `inset 0 0 0 1px ${n}`
|
|
674
|
+
}
|
|
675
|
+
] }, mt = 100;
|
|
676
|
+
function ht({ items: e, total: t, valueFormat: n, selected: r, onSelectedChange: o, ...s }) {
|
|
677
|
+
let { emptyLabel: c = "No values", ...l } = s, { locale: u, title: d } = l, f = C();
|
|
678
|
+
if (l.status === "loading") return /* @__PURE__ */ J(ie, {
|
|
679
|
+
...l,
|
|
680
|
+
height: "compact"
|
|
681
|
+
});
|
|
682
|
+
let p = y(e), m = e.reduce((e, t) => e + (t.value ?? 0), 0), h = 2 ** -52 * Math.max(m, t, 1) * e.length;
|
|
683
|
+
if (p !== void 0) return /* @__PURE__ */ J(oe, {
|
|
684
|
+
...l,
|
|
685
|
+
message: p
|
|
686
|
+
});
|
|
687
|
+
if (!Number.isFinite(t) || t < 0 || m - t > h) return /* @__PURE__ */ J(oe, {
|
|
688
|
+
...l,
|
|
689
|
+
message: "The total must be finite and at least the sum of recorded values."
|
|
690
|
+
});
|
|
691
|
+
function g(e) {
|
|
692
|
+
return te({
|
|
693
|
+
value: e,
|
|
694
|
+
locale: u,
|
|
695
|
+
format: n
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
let _ = e.map((e, t) => ({
|
|
699
|
+
id: e.id,
|
|
700
|
+
label: e.label,
|
|
701
|
+
valueLabel: g(e.value),
|
|
702
|
+
tone: f({
|
|
703
|
+
id: e.id,
|
|
704
|
+
tone: e.tone,
|
|
705
|
+
index: t
|
|
706
|
+
})
|
|
707
|
+
}));
|
|
708
|
+
return /* @__PURE__ */ J(ee, {
|
|
709
|
+
items: b(_),
|
|
710
|
+
arrows: "both",
|
|
711
|
+
selected: r ?? null,
|
|
712
|
+
onSelect: o,
|
|
713
|
+
render: (n, r) => /* @__PURE__ */ J(j, {
|
|
714
|
+
...l,
|
|
715
|
+
figure: n,
|
|
716
|
+
children: e.length === 0 ? /* @__PURE__ */ J(se, { children: c }) : /* @__PURE__ */ Y(Oe, { children: [
|
|
717
|
+
/* @__PURE__ */ J("div", {
|
|
718
|
+
"aria-hidden": !0,
|
|
719
|
+
className: "x78zum5 x170jfvy xb3r6kr x1r7kqkb xmkeg23 x1y0btm7 x1ey3b81 x1jfksii",
|
|
720
|
+
children: e.map((e, n) => {
|
|
721
|
+
let r = _[n]?.tone ?? "neutral";
|
|
722
|
+
return e.value === null ? null : /* @__PURE__ */ J("span", { ...H.props(pt.segment(t === 0 ? 0 : e.value / t * mt, a[r], i[r])) }, e.id);
|
|
723
|
+
})
|
|
724
|
+
}),
|
|
725
|
+
/* @__PURE__ */ J(S, {
|
|
726
|
+
title: d,
|
|
727
|
+
items: _,
|
|
728
|
+
view: o === void 0 ? void 0 : r
|
|
729
|
+
}),
|
|
730
|
+
t - m > h && /* @__PURE__ */ Y("p", {
|
|
731
|
+
className: "x153jb6y x1ghz6dp xy8obcc",
|
|
732
|
+
children: [
|
|
733
|
+
"Unassigned portion: ",
|
|
734
|
+
g(t - m),
|
|
735
|
+
" of ",
|
|
736
|
+
g(t)
|
|
737
|
+
]
|
|
738
|
+
})
|
|
739
|
+
] })
|
|
740
|
+
})
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
// packages/charts/src/cartesian/bridge-data.ts
|
|
744
|
+
function gt(e) {
|
|
745
|
+
return e.kind !== "change" || e.value === null ? "neutral" : e.value < 0 ? "negative" : "positive";
|
|
746
|
+
}
|
|
747
|
+
function _t(e) {
|
|
748
|
+
let t = e.map((e) => e.kind === "total" ? 0 : e.value);
|
|
749
|
+
return e[0]?.kind !== "start" || t.includes(null) ? null : t.reduce((e, t) => e + (t ?? 0), 0);
|
|
750
|
+
}
|
|
751
|
+
function vt({ step: e, before: t, after: n }) {
|
|
752
|
+
let r = e.tone ?? gt(e);
|
|
753
|
+
switch (e.kind) {
|
|
754
|
+
case "start": return {
|
|
755
|
+
step: e,
|
|
756
|
+
from: 0,
|
|
757
|
+
to: e.value,
|
|
758
|
+
tone: r
|
|
759
|
+
};
|
|
760
|
+
case "total": return {
|
|
761
|
+
step: e,
|
|
762
|
+
from: n === null ? null : 0,
|
|
763
|
+
to: n,
|
|
764
|
+
tone: r
|
|
765
|
+
};
|
|
766
|
+
case "change": return {
|
|
767
|
+
step: e,
|
|
768
|
+
from: t,
|
|
769
|
+
to: n,
|
|
770
|
+
tone: r
|
|
771
|
+
};
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
function yt(e) {
|
|
775
|
+
return e.map((t, n) => vt({
|
|
776
|
+
step: t,
|
|
777
|
+
before: _t(e.slice(0, n)),
|
|
778
|
+
after: _t(e.slice(0, n + 1))
|
|
779
|
+
}));
|
|
780
|
+
}
|
|
781
|
+
function bt(e) {
|
|
782
|
+
let t = e.flatMap((e) => [e.from, e.to].filter((e) => e !== null)), n = Math.min(0, ...t), r = Math.max(0, ...t);
|
|
783
|
+
return n === r ? [n, n + 1] : [n, r];
|
|
784
|
+
}
|
|
785
|
+
function xt({ steps: e, domain: t }) {
|
|
786
|
+
if (e.length > x.items) return `Choose a bridge with at most ${x.items} steps.`;
|
|
787
|
+
if (!o(e)) return "Bridge steps require unique identifiers.";
|
|
788
|
+
if (e.length > 0 && e[0]?.kind !== "start") return "A bridge begins with one start step.";
|
|
789
|
+
if (e.filter((e) => e.kind === "start").length > 1) return "A bridge has exactly one start step.";
|
|
790
|
+
if (e.some((e) => {
|
|
791
|
+
let t = e.kind === "total" ? null : e.value;
|
|
792
|
+
return t !== null && !Number.isFinite(t);
|
|
793
|
+
})) return "Bridge values must be finite numbers or explicit missing changes.";
|
|
794
|
+
let n = bt(yt(e));
|
|
795
|
+
if (t === void 0) return Number.isFinite(n[0]) && Number.isFinite(n[1]) ? void 0 : "Running totals must stay finite.";
|
|
796
|
+
let r = t[0] <= n[0] && t[1] >= n[1];
|
|
797
|
+
if (!D(t) || !r) return "The bridge domain must be finite, increasing, and contain zero and every running total.";
|
|
798
|
+
}
|
|
799
|
+
// packages/charts/src/cartesian/bridge-chart.tsx
|
|
800
|
+
var St = 12, Ct = 6, wt = 14, Tt = 12, Et = 8, Dt = 8, Ot = .5;
|
|
801
|
+
function kt(e) {
|
|
802
|
+
return typeof e == "function" ? (t) => t === 0 ? e(0) : `${t > 0 ? "+" : "−"}${e(Math.abs(t))}` : {
|
|
803
|
+
...e,
|
|
804
|
+
signDisplay: "exceptZero"
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
function At({ level: e, valueText: t, changeText: n }) {
|
|
808
|
+
return e.step.kind === "change" && e.step.value !== null ? n(e.step.value) : e.to === null ? "—" : t(e.to);
|
|
809
|
+
}
|
|
810
|
+
function jt({ level: e, valueText: t, changeText: n }) {
|
|
811
|
+
return e.step.kind === "change" ? e.step.value === null ? T : n(e.step.value) : e.to === null ? T : t(e.to);
|
|
812
|
+
}
|
|
813
|
+
function Mt({ level: e, valueText: t }) {
|
|
814
|
+
return e.from === null || e.to === null ? T : `${t(e.from)} → ${t(e.to)}`;
|
|
815
|
+
}
|
|
816
|
+
function Nt(e, t, n) {
|
|
817
|
+
if (e.from === null || e.to === null) {
|
|
818
|
+
let r = Math.min(n - Tt, t(e.from ?? 0) - Tt * Ot);
|
|
819
|
+
return {
|
|
820
|
+
isKnown: !1,
|
|
821
|
+
top: r,
|
|
822
|
+
height: Tt,
|
|
823
|
+
labelY: r - Ct
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
let r = Math.max(e.from, e.to), i = Math.min(e.from, e.to), a = t(r), o = r <= 0 && i < 0;
|
|
827
|
+
return {
|
|
828
|
+
isKnown: !0,
|
|
829
|
+
top: a,
|
|
830
|
+
height: Math.max(1, t(i) - a),
|
|
831
|
+
labelY: o ? t(i) + wt : a - Ct
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
function Pt({ steps: e, valueFormat: t, changeFormat: n = kt(t), tickFormat: r, valueLabel: i, domain: a, referenceLines: o = [], selected: s, onSelectedChange: c, height: l = "regular", ...d }) {
|
|
835
|
+
let { emptyLabel: f = "No steps", ...h } = d, { locale: g, title: _ } = h, v = he(l), y = W();
|
|
836
|
+
if (h.status === "loading") return /* @__PURE__ */ J(ie, {
|
|
837
|
+
...h,
|
|
838
|
+
height: l
|
|
839
|
+
});
|
|
840
|
+
let b = yt(e), x = bt(b), S = a ?? u({ values: [...x, ...o.map((e) => e.value)] }), C = xt({
|
|
841
|
+
steps: e,
|
|
842
|
+
domain: a
|
|
843
|
+
}) ?? _e({
|
|
844
|
+
lines: o,
|
|
845
|
+
domain: S
|
|
846
|
+
});
|
|
847
|
+
if (C !== void 0) return /* @__PURE__ */ J(oe, {
|
|
848
|
+
...h,
|
|
849
|
+
message: C
|
|
850
|
+
});
|
|
851
|
+
function w(e) {
|
|
852
|
+
return (t) => te({
|
|
853
|
+
value: t,
|
|
854
|
+
locale: g,
|
|
855
|
+
format: e
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
let T = w(t), E = w(n), D = o.map((e) => ({
|
|
859
|
+
id: e.id,
|
|
860
|
+
label: e.label,
|
|
861
|
+
tone: e.tone ?? "neutral",
|
|
862
|
+
shape: "dashed",
|
|
863
|
+
value: T(e.value)
|
|
864
|
+
}));
|
|
865
|
+
function O(e) {
|
|
866
|
+
let t = b.find((t) => t.step.id === e);
|
|
867
|
+
if (t === void 0) return {
|
|
868
|
+
level: t,
|
|
869
|
+
label: void 0,
|
|
870
|
+
summary: void 0,
|
|
871
|
+
rows: []
|
|
872
|
+
};
|
|
873
|
+
let n = t.step.kind === "change" ? [{
|
|
874
|
+
id: "running",
|
|
875
|
+
label: "Running total",
|
|
876
|
+
tone: "neutral",
|
|
877
|
+
value: Mt({
|
|
878
|
+
level: t,
|
|
879
|
+
valueText: T
|
|
880
|
+
})
|
|
881
|
+
}] : [];
|
|
882
|
+
return {
|
|
883
|
+
level: t,
|
|
884
|
+
label: t.step.label,
|
|
885
|
+
summary: jt({
|
|
886
|
+
level: t,
|
|
887
|
+
valueText: T,
|
|
888
|
+
changeText: E
|
|
889
|
+
}),
|
|
890
|
+
rows: [...n, ...D]
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
let k = p({
|
|
894
|
+
width: v.width,
|
|
895
|
+
height: v.height,
|
|
896
|
+
direction: "columns",
|
|
897
|
+
categories: b.map((e) => ({
|
|
898
|
+
id: e.step.id,
|
|
899
|
+
label: e.step.axisLabel ?? e.step.label
|
|
900
|
+
})),
|
|
901
|
+
value: {
|
|
902
|
+
label: i ?? "",
|
|
903
|
+
format: t,
|
|
904
|
+
tickFormat: r
|
|
905
|
+
},
|
|
906
|
+
valueDomain: S,
|
|
907
|
+
locale: g,
|
|
908
|
+
topInset: St,
|
|
909
|
+
hasValueTitle: i !== void 0
|
|
910
|
+
}), { box: A, band: N } = k, P = k.value.position, F = b.map((e) => ({
|
|
911
|
+
id: e.step.id,
|
|
912
|
+
label: e.step.label
|
|
913
|
+
}));
|
|
914
|
+
function I(e) {
|
|
915
|
+
return N.start(e) ?? A.left;
|
|
916
|
+
}
|
|
917
|
+
function R(e) {
|
|
918
|
+
return I(e) + N.bandwidth * Ot;
|
|
919
|
+
}
|
|
920
|
+
let ue = Re([...b.filter((e) => e.step.kind !== "change"), ...b.filter((e) => e.step.kind === "change")].map((e) => ({
|
|
921
|
+
id: e.step.id,
|
|
922
|
+
isTotal: e.step.kind !== "change",
|
|
923
|
+
text: At({
|
|
924
|
+
level: e,
|
|
925
|
+
valueText: T,
|
|
926
|
+
changeText: E
|
|
927
|
+
}),
|
|
928
|
+
x: R(e.step.id),
|
|
929
|
+
y: Nt(e, P, A.bottom).labelY
|
|
930
|
+
})));
|
|
931
|
+
return /* @__PURE__ */ J(ee, {
|
|
932
|
+
items: F,
|
|
933
|
+
readout: (e) => re(O(e)),
|
|
934
|
+
locate: (e) => N.idAt(e.x / e.width * A.width),
|
|
935
|
+
selected: s ?? null,
|
|
936
|
+
onSelect: c,
|
|
937
|
+
render: (e, { inspected: t, cursor: n }) => {
|
|
938
|
+
let r = O(t);
|
|
939
|
+
return /* @__PURE__ */ Y(j, {
|
|
940
|
+
...h,
|
|
941
|
+
figure: e,
|
|
942
|
+
titleDetail: r.level === void 0 ? void 0 : `${r.label} · ${r.summary}`,
|
|
943
|
+
children: [
|
|
944
|
+
/* @__PURE__ */ J(ae, {
|
|
945
|
+
label: `${_} steps`,
|
|
946
|
+
columns: [
|
|
947
|
+
{
|
|
948
|
+
id: "step",
|
|
949
|
+
label: "Step"
|
|
950
|
+
},
|
|
951
|
+
{
|
|
952
|
+
id: "value",
|
|
953
|
+
label: "Value"
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
id: "running",
|
|
957
|
+
label: "Running total"
|
|
958
|
+
}
|
|
959
|
+
],
|
|
960
|
+
rows: [...b.map((e) => ({
|
|
961
|
+
id: e.step.id,
|
|
962
|
+
values: [
|
|
963
|
+
e.step.label,
|
|
964
|
+
jt({
|
|
965
|
+
level: e,
|
|
966
|
+
valueText: T,
|
|
967
|
+
changeText: E
|
|
968
|
+
}),
|
|
969
|
+
e.step.kind === "change" ? Mt({
|
|
970
|
+
level: e,
|
|
971
|
+
valueText: T
|
|
972
|
+
}) : jt({
|
|
973
|
+
level: e,
|
|
974
|
+
valueText: T,
|
|
975
|
+
changeText: E
|
|
976
|
+
})
|
|
977
|
+
]
|
|
978
|
+
})), ...o.map((e) => ({
|
|
979
|
+
id: `reference:${e.id}`,
|
|
980
|
+
values: [
|
|
981
|
+
e.label,
|
|
982
|
+
T(e.value),
|
|
983
|
+
""
|
|
984
|
+
]
|
|
985
|
+
}))]
|
|
986
|
+
}),
|
|
987
|
+
/* @__PURE__ */ J(M, {
|
|
988
|
+
id: y,
|
|
989
|
+
label: r.label,
|
|
990
|
+
summary: r.summary,
|
|
991
|
+
legend: [],
|
|
992
|
+
hasLegend: !1,
|
|
993
|
+
rows: r.rows,
|
|
994
|
+
x: R(t ?? ""),
|
|
995
|
+
width: v.width,
|
|
996
|
+
offset: N.bandwidth * Ot + Dt
|
|
997
|
+
}),
|
|
998
|
+
b.length === 0 ? /* @__PURE__ */ J(se, { children: f }) : /* @__PURE__ */ Y(me, {
|
|
999
|
+
plotRef: v.ref,
|
|
1000
|
+
box: A,
|
|
1001
|
+
label: m({
|
|
1002
|
+
title: _,
|
|
1003
|
+
marks: "steps",
|
|
1004
|
+
isSelectable: c !== void 0
|
|
1005
|
+
}),
|
|
1006
|
+
readoutId: y,
|
|
1007
|
+
children: [
|
|
1008
|
+
/* @__PURE__ */ J(ce, {
|
|
1009
|
+
box: A,
|
|
1010
|
+
xTicks: k.bandTicks,
|
|
1011
|
+
yTicks: k.valueTicks,
|
|
1012
|
+
yTitle: i
|
|
1013
|
+
}),
|
|
1014
|
+
/* @__PURE__ */ Y(ge, {
|
|
1015
|
+
box: A,
|
|
1016
|
+
children: [
|
|
1017
|
+
b.map((e, t) => {
|
|
1018
|
+
let n = b[t + 1];
|
|
1019
|
+
return n === void 0 || e.to === null || n.from === null ? null : /* @__PURE__ */ J(z, {
|
|
1020
|
+
x1: I(e.step.id) + N.bandwidth,
|
|
1021
|
+
x2: I(n.step.id),
|
|
1022
|
+
y1: P(e.to),
|
|
1023
|
+
y2: P(e.to)
|
|
1024
|
+
}, `connector:${e.step.id}`);
|
|
1025
|
+
}),
|
|
1026
|
+
b.map((e) => {
|
|
1027
|
+
let n = Nt(e, P, A.bottom);
|
|
1028
|
+
return /* @__PURE__ */ J(V, {
|
|
1029
|
+
x: I(e.step.id),
|
|
1030
|
+
y: n.top,
|
|
1031
|
+
width: N.bandwidth,
|
|
1032
|
+
height: n.height,
|
|
1033
|
+
tone: n.isKnown ? e.tone : "neutral",
|
|
1034
|
+
isHollow: !n.isKnown,
|
|
1035
|
+
isSelected: s === e.step.id,
|
|
1036
|
+
isInspected: t === e.step.id
|
|
1037
|
+
}, e.step.id);
|
|
1038
|
+
}),
|
|
1039
|
+
/* @__PURE__ */ J(le, {
|
|
1040
|
+
x1: A.left,
|
|
1041
|
+
x2: A.right,
|
|
1042
|
+
y1: P(0),
|
|
1043
|
+
y2: P(0)
|
|
1044
|
+
})
|
|
1045
|
+
]
|
|
1046
|
+
}),
|
|
1047
|
+
/* @__PURE__ */ J(ve, {
|
|
1048
|
+
lines: o,
|
|
1049
|
+
box: A,
|
|
1050
|
+
position: P,
|
|
1051
|
+
valueText: T,
|
|
1052
|
+
avoid: ue,
|
|
1053
|
+
marks: b.map((e) => {
|
|
1054
|
+
let t = Nt(e, P, A.bottom);
|
|
1055
|
+
return {
|
|
1056
|
+
left: I(e.step.id),
|
|
1057
|
+
right: I(e.step.id) + N.bandwidth,
|
|
1058
|
+
top: t.top,
|
|
1059
|
+
bottom: t.top + t.height
|
|
1060
|
+
};
|
|
1061
|
+
})
|
|
1062
|
+
}),
|
|
1063
|
+
/* @__PURE__ */ J("g", {
|
|
1064
|
+
"aria-hidden": !0,
|
|
1065
|
+
children: ue.map((e) => /* @__PURE__ */ J(L, {
|
|
1066
|
+
x: e.x,
|
|
1067
|
+
y: e.y,
|
|
1068
|
+
anchor: "middle",
|
|
1069
|
+
isStrong: e.isTotal,
|
|
1070
|
+
children: e.text
|
|
1071
|
+
}, e.id))
|
|
1072
|
+
}),
|
|
1073
|
+
n !== null && /* @__PURE__ */ J(ne, {
|
|
1074
|
+
x: R(n),
|
|
1075
|
+
top: A.top,
|
|
1076
|
+
bottom: A.bottom,
|
|
1077
|
+
width: Math.max(Et, N.bandwidth)
|
|
1078
|
+
})
|
|
1079
|
+
]
|
|
1080
|
+
})
|
|
1081
|
+
]
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
// packages/charts/src/cartesian/scatter-plot.tsx
|
|
1087
|
+
var Ft = { points: 1e3 }, It = {
|
|
1088
|
+
target: {
|
|
1089
|
+
kVAEAm: "x10l6tqk",
|
|
1090
|
+
k1xSpc: "xrvj5dj",
|
|
1091
|
+
kgQiWS: "x1ku5rj1",
|
|
1092
|
+
kzqmXN: "x187nhsf",
|
|
1093
|
+
kZKoxP: "xn3w4p2",
|
|
1094
|
+
k3aq6I: "x11lhmoz",
|
|
1095
|
+
kMzoRj: "xc342km",
|
|
1096
|
+
kmVPX3: "x1717udv",
|
|
1097
|
+
kWkggS: "xjbqb8w",
|
|
1098
|
+
kkrTdU: "x1ypdohk",
|
|
1099
|
+
kfzvcC: "x67bb7w",
|
|
1100
|
+
k3XXqK: "x1t137rt",
|
|
1101
|
+
kPJHz1: "x13qnu6",
|
|
1102
|
+
kZs9gx: "x19rmrnh",
|
|
1103
|
+
k7shQP: "x9v5kkp",
|
|
1104
|
+
kiEn40: "x175ew0f",
|
|
1105
|
+
kmCx7Z: "xwycy1x",
|
|
1106
|
+
kJrEVn: "x15ajoc",
|
|
1107
|
+
kLz2MD: "x13ljvab",
|
|
1108
|
+
k1CtGv: "xzgvv12",
|
|
1109
|
+
$$css: !0
|
|
1110
|
+
},
|
|
1111
|
+
location: (e, t) => [{
|
|
1112
|
+
kbCHJM: e == null ? e : "xgq9j65",
|
|
1113
|
+
k87sOh: t == null ? t : "xjbys53",
|
|
1114
|
+
$$css: !0
|
|
1115
|
+
}, {
|
|
1116
|
+
"--x-left": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
|
|
1117
|
+
"--x-top": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
|
|
1118
|
+
}],
|
|
1119
|
+
ring: {
|
|
1120
|
+
kzqmXN: "xsmyaan",
|
|
1121
|
+
kZKoxP: "x1kpxq89",
|
|
1122
|
+
kaIpWk: "x16rqkct",
|
|
1123
|
+
$$css: !0
|
|
1124
|
+
}
|
|
1125
|
+
};
|
|
1126
|
+
function Lt(e, t) {
|
|
1127
|
+
return !e.every(Number.isFinite) || e[0] > e[1] ? !1 : e[0] >= t[0] && e[1] <= t[1];
|
|
1128
|
+
}
|
|
1129
|
+
function Rt(e, t) {
|
|
1130
|
+
return Number.isFinite(e) && e > 0 && e <= t[1] - t[0];
|
|
1131
|
+
}
|
|
1132
|
+
function zt({ points: e, x: t, y: n, xDomain: r, yDomain: i, range: a, onRangeChange: s, rangeStep: c }) {
|
|
1133
|
+
let l = O(r, t.scale) ?? O(i, n.scale);
|
|
1134
|
+
if (l !== void 0) return l;
|
|
1135
|
+
if (e.length > Ft.points) return `This plot exceeds the ${Ft.points}-point render limit. Supply a smaller, labelled sample.`;
|
|
1136
|
+
if (!o(e)) return "Scatter points must have unique identifiers.";
|
|
1137
|
+
if (e.some((e) => !Number.isFinite(e.x) || !Number.isFinite(e.y))) return "Scatter coordinates must be finite.";
|
|
1138
|
+
if (e.some((e) => E(e.x, r) || E(e.y, i))) return "Scatter coordinates fall outside the declared domain. Widen the domain or supply a labelled window of points.";
|
|
1139
|
+
if (s !== void 0) {
|
|
1140
|
+
if (c === void 0 || !Rt(c.x, r) || !Rt(c.y, i)) return "Range selection steps must be finite, positive, and no larger than their domain span.";
|
|
1141
|
+
if (a != null && (!Lt(a.x, r) || !Lt(a.y, i))) return "The selected range must have finite, ordered bounds inside the declared domain.";
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
function Bt(e, t) {
|
|
1145
|
+
return [Math.min(e, t), Math.max(e, t)];
|
|
1146
|
+
}
|
|
1147
|
+
function Vt(e) {
|
|
1148
|
+
let { points: t, x: n, y: r, range: i, onRangeChange: a, rangeStep: o, selected: d, onSelectedChange: f, height: p = "regular", ...h } = e, { emptyLabel: v = "No points were supplied.", ...y } = h, { locale: b, title: x } = y, S = W(), w = he(p), T = C(), [E, D] = G(null), O = we(null);
|
|
1149
|
+
if (Ce(() => () => O.current?.(), []), y.status === "loading") return /* @__PURE__ */ J(ie, {
|
|
1150
|
+
...y,
|
|
1151
|
+
height: p
|
|
1152
|
+
});
|
|
1153
|
+
let k = n.domain ?? u({
|
|
1154
|
+
values: t.map((e) => e.x),
|
|
1155
|
+
scale: n.scale
|
|
1156
|
+
}), A = r.domain ?? u({
|
|
1157
|
+
values: t.map((e) => e.y),
|
|
1158
|
+
scale: r.scale
|
|
1159
|
+
}), ne = zt({
|
|
1160
|
+
points: t,
|
|
1161
|
+
x: n,
|
|
1162
|
+
y: r,
|
|
1163
|
+
xDomain: k,
|
|
1164
|
+
yDomain: A,
|
|
1165
|
+
range: i,
|
|
1166
|
+
onRangeChange: a,
|
|
1167
|
+
rangeStep: o
|
|
1168
|
+
}), re = i ?? null;
|
|
1169
|
+
if (ne !== void 0) return /* @__PURE__ */ J(oe, {
|
|
1170
|
+
...y,
|
|
1171
|
+
message: ne
|
|
1172
|
+
});
|
|
1173
|
+
let M = _({
|
|
1174
|
+
width: w.width,
|
|
1175
|
+
height: w.height,
|
|
1176
|
+
x: n,
|
|
1177
|
+
y: r,
|
|
1178
|
+
xDomain: k,
|
|
1179
|
+
yDomain: A,
|
|
1180
|
+
locale: b
|
|
1181
|
+
}), { box: N } = M;
|
|
1182
|
+
function F(e) {
|
|
1183
|
+
return te({
|
|
1184
|
+
value: e,
|
|
1185
|
+
locale: b,
|
|
1186
|
+
format: n.format
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
function L(e) {
|
|
1190
|
+
return te({
|
|
1191
|
+
value: e,
|
|
1192
|
+
locale: b,
|
|
1193
|
+
format: r.format
|
|
1194
|
+
});
|
|
1195
|
+
}
|
|
1196
|
+
let R = t.map((e) => ({
|
|
1197
|
+
id: e.id,
|
|
1198
|
+
label: `${e.label}, ${n.label}: ${F(e.x)}, ${r.label}: ${L(e.y)}`
|
|
1199
|
+
})), le = t.map((e, t) => ({
|
|
1200
|
+
...e,
|
|
1201
|
+
tone: T({
|
|
1202
|
+
id: e.id,
|
|
1203
|
+
tone: e.tone,
|
|
1204
|
+
index: t
|
|
1205
|
+
}),
|
|
1206
|
+
left: M.x.position(e.x),
|
|
1207
|
+
top: M.y.position(e.y)
|
|
1208
|
+
})), z = new Map(le.map((e) => [e.id, {
|
|
1209
|
+
left: e.left,
|
|
1210
|
+
top: e.top,
|
|
1211
|
+
right: e.left,
|
|
1212
|
+
bottom: e.top
|
|
1213
|
+
}])), ue = E === null ? i : {
|
|
1214
|
+
x: Bt(E.start.x, E.end.x),
|
|
1215
|
+
y: Bt(E.start.y, E.end.y)
|
|
1216
|
+
};
|
|
1217
|
+
function B(e, t, n) {
|
|
1218
|
+
let r = e.getBoundingClientRect(), i = (t - r.left) / r.width * N.width, a = (n - r.top) / r.height * N.height;
|
|
1219
|
+
return {
|
|
1220
|
+
x: M.x.valueAt(Math.min(N.right, Math.max(N.left, i))),
|
|
1221
|
+
y: M.y.valueAt(Math.min(N.bottom, Math.max(N.top, a)))
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
function de(t) {
|
|
1225
|
+
let n = t.button === 0 && t.pointerType !== "touch", r = t.currentTarget, i = r.parentElement, o = t.target instanceof Element && t.target.closest("[data-brush]") !== null, s = n && o;
|
|
1226
|
+
if (a === void 0 || O.current !== null || !s || i === null) return;
|
|
1227
|
+
let c = B(r, t.clientX, t.clientY);
|
|
1228
|
+
D({
|
|
1229
|
+
start: c,
|
|
1230
|
+
end: c
|
|
1231
|
+
}), O.current = K(i, t.nativeEvent, {
|
|
1232
|
+
cancelOnEscape: !0,
|
|
1233
|
+
onMove: ({ x: e, y: t }) => D({
|
|
1234
|
+
start: c,
|
|
1235
|
+
end: B(r, e, t)
|
|
1236
|
+
}),
|
|
1237
|
+
onEnd: (t, n) => {
|
|
1238
|
+
if (O.current = null, D(null), n) return;
|
|
1239
|
+
let i = B(r, t.clientX, t.clientY), a = {
|
|
1240
|
+
x: Bt(c.x, i.x),
|
|
1241
|
+
y: Bt(c.y, i.y)
|
|
1242
|
+
};
|
|
1243
|
+
De({ options: () => e }, "onRangeChange", a, {
|
|
1244
|
+
reason: "drag",
|
|
1245
|
+
event: t
|
|
1246
|
+
});
|
|
1247
|
+
}
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
return /* @__PURE__ */ J(ee, {
|
|
1251
|
+
items: R,
|
|
1252
|
+
place: (e) => z.get(e),
|
|
1253
|
+
selected: d ?? null,
|
|
1254
|
+
onSelect: f,
|
|
1255
|
+
render: (e, { inspected: i, cursor: u }) => /* @__PURE__ */ Y(j, {
|
|
1256
|
+
...y,
|
|
1257
|
+
figure: e,
|
|
1258
|
+
footer: /* @__PURE__ */ J(c, {
|
|
1259
|
+
id: S,
|
|
1260
|
+
children: s(R, i)
|
|
1261
|
+
}),
|
|
1262
|
+
children: [
|
|
1263
|
+
t.length === 0 ? /* @__PURE__ */ J(se, { children: v }) : /* @__PURE__ */ Y(me, {
|
|
1264
|
+
plotRef: w.ref,
|
|
1265
|
+
box: N,
|
|
1266
|
+
label: m({
|
|
1267
|
+
title: x,
|
|
1268
|
+
isSelectable: f !== void 0
|
|
1269
|
+
}),
|
|
1270
|
+
readoutId: S,
|
|
1271
|
+
onPointerDown: de,
|
|
1272
|
+
overlay: le.map((e, t) => /* @__PURE__ */ J(l, {
|
|
1273
|
+
value: e.id,
|
|
1274
|
+
render: /* @__PURE__ */ J("button", {
|
|
1275
|
+
type: "button",
|
|
1276
|
+
tabIndex: -1,
|
|
1277
|
+
title: e.label,
|
|
1278
|
+
"aria-label": R[t]?.label,
|
|
1279
|
+
"aria-pressed": f === void 0 ? void 0 : d === e.id
|
|
1280
|
+
}),
|
|
1281
|
+
...H.props(It.target, It.location(e.left, e.top)),
|
|
1282
|
+
children: /* @__PURE__ */ J("span", {
|
|
1283
|
+
"aria-hidden": !0,
|
|
1284
|
+
...H.props(It.ring, u === e.id && P.cursor)
|
|
1285
|
+
})
|
|
1286
|
+
}, e.id)),
|
|
1287
|
+
children: [
|
|
1288
|
+
/* @__PURE__ */ J(ce, {
|
|
1289
|
+
box: N,
|
|
1290
|
+
xTicks: M.xTicks,
|
|
1291
|
+
yTicks: M.yTicks,
|
|
1292
|
+
xTitle: g(n),
|
|
1293
|
+
yTitle: g(r),
|
|
1294
|
+
grid: "both"
|
|
1295
|
+
}),
|
|
1296
|
+
a !== void 0 && /* @__PURE__ */ J("rect", {
|
|
1297
|
+
"data-brush": "",
|
|
1298
|
+
x: N.left,
|
|
1299
|
+
y: N.top,
|
|
1300
|
+
width: N.innerWidth,
|
|
1301
|
+
height: N.innerHeight,
|
|
1302
|
+
className: "xsid9ct xy6m8k3"
|
|
1303
|
+
}),
|
|
1304
|
+
/* @__PURE__ */ Y(ge, {
|
|
1305
|
+
box: N,
|
|
1306
|
+
children: [ue != null && /* @__PURE__ */ J(Ht, {
|
|
1307
|
+
range: ue,
|
|
1308
|
+
plot: M
|
|
1309
|
+
}), le.map((e) => /* @__PURE__ */ J(I, {
|
|
1310
|
+
mark: e.id,
|
|
1311
|
+
x: e.left,
|
|
1312
|
+
y: e.top,
|
|
1313
|
+
tone: e.tone,
|
|
1314
|
+
isInspected: i === e.id,
|
|
1315
|
+
isSelected: d === e.id
|
|
1316
|
+
}, e.id))]
|
|
1317
|
+
})
|
|
1318
|
+
]
|
|
1319
|
+
}),
|
|
1320
|
+
a !== void 0 && o !== void 0 && /* @__PURE__ */ J(Wt, {
|
|
1321
|
+
x: n,
|
|
1322
|
+
y: r,
|
|
1323
|
+
xDomain: k,
|
|
1324
|
+
yDomain: A,
|
|
1325
|
+
range: re,
|
|
1326
|
+
rangeStep: o,
|
|
1327
|
+
locale: b,
|
|
1328
|
+
onRangeChange: a
|
|
1329
|
+
}),
|
|
1330
|
+
/* @__PURE__ */ J(ae, {
|
|
1331
|
+
label: `${x} points`,
|
|
1332
|
+
columns: [
|
|
1333
|
+
{
|
|
1334
|
+
id: "point",
|
|
1335
|
+
label: "Point"
|
|
1336
|
+
},
|
|
1337
|
+
{
|
|
1338
|
+
id: "x",
|
|
1339
|
+
label: n.label
|
|
1340
|
+
},
|
|
1341
|
+
{
|
|
1342
|
+
id: "y",
|
|
1343
|
+
label: r.label
|
|
1344
|
+
}
|
|
1345
|
+
],
|
|
1346
|
+
rows: t.map((e) => ({
|
|
1347
|
+
id: e.id,
|
|
1348
|
+
values: [
|
|
1349
|
+
e.label,
|
|
1350
|
+
F(e.x),
|
|
1351
|
+
L(e.y)
|
|
1352
|
+
]
|
|
1353
|
+
}))
|
|
1354
|
+
})
|
|
1355
|
+
]
|
|
1356
|
+
})
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
function Ht({ range: e, plot: t }) {
|
|
1360
|
+
let n = t.x.position(e.x[0]), r = t.y.position(e.y[1]);
|
|
1361
|
+
return /* @__PURE__ */ J("rect", {
|
|
1362
|
+
x: n,
|
|
1363
|
+
y: r,
|
|
1364
|
+
width: t.x.position(e.x[1]) - n,
|
|
1365
|
+
height: t.y.position(e.y[0]) - r,
|
|
1366
|
+
className: "x1e0kj8g xv7c1pl x1tg5nk6 xnpr05h x15lqr97 x47corl"
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
function Ut({ axis: e, domain: n, value: r, step: i, locale: a, onChange: o }) {
|
|
1370
|
+
function s(t) {
|
|
1371
|
+
return te({
|
|
1372
|
+
value: t,
|
|
1373
|
+
locale: a,
|
|
1374
|
+
format: e.format
|
|
1375
|
+
});
|
|
1376
|
+
}
|
|
1377
|
+
return /* @__PURE__ */ Y(t.Root, {
|
|
1378
|
+
value: [...r],
|
|
1379
|
+
format: e.format,
|
|
1380
|
+
min: n[0],
|
|
1381
|
+
max: n[1],
|
|
1382
|
+
step: i,
|
|
1383
|
+
locale: a,
|
|
1384
|
+
onValueChange: (e, t) => o(e, t),
|
|
1385
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
1386
|
+
className: "x78zum5 x1a02dak x1qughib x1hnptsi x153jb6y xy8obcc xj0a0fe",
|
|
1387
|
+
children: [/* @__PURE__ */ J(t.Label, { children: e.label }), /* @__PURE__ */ Y("span", { children: [
|
|
1388
|
+
s(r[0]),
|
|
1389
|
+
" – ",
|
|
1390
|
+
s(r[1])
|
|
1391
|
+
] })]
|
|
1392
|
+
}), /* @__PURE__ */ J(t.Control, { children: /* @__PURE__ */ Y(t.Track, { children: [
|
|
1393
|
+
/* @__PURE__ */ J(t.Indicator, {}),
|
|
1394
|
+
/* @__PURE__ */ J(t.Thumb, {
|
|
1395
|
+
index: 0,
|
|
1396
|
+
"aria-label": `${e.label} minimum`
|
|
1397
|
+
}),
|
|
1398
|
+
/* @__PURE__ */ J(t.Thumb, {
|
|
1399
|
+
index: 1,
|
|
1400
|
+
"aria-label": `${e.label} maximum`
|
|
1401
|
+
})
|
|
1402
|
+
] }) })]
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
function Wt({ x: t, y: n, xDomain: r, yDomain: i, range: a, rangeStep: o, locale: s, onRangeChange: c }) {
|
|
1406
|
+
let l = a ?? {
|
|
1407
|
+
x: r,
|
|
1408
|
+
y: i
|
|
1409
|
+
};
|
|
1410
|
+
return /* @__PURE__ */ Y("fieldset", {
|
|
1411
|
+
className: "xrvj5dj x1n8ia3y x1xxf3xd xc342km x1717udv xeuugli",
|
|
1412
|
+
children: [
|
|
1413
|
+
/* @__PURE__ */ J("legend", {
|
|
1414
|
+
className: "x153jb6y xy8obcc x1jfksii",
|
|
1415
|
+
children: "Drag with a mouse, or adjust these bounds to select a coordinate range."
|
|
1416
|
+
}),
|
|
1417
|
+
/* @__PURE__ */ J(Ut, {
|
|
1418
|
+
axis: t,
|
|
1419
|
+
domain: r,
|
|
1420
|
+
value: l.x,
|
|
1421
|
+
step: o.x,
|
|
1422
|
+
locale: s,
|
|
1423
|
+
onChange: (e, t) => c({
|
|
1424
|
+
x: e,
|
|
1425
|
+
y: l.y
|
|
1426
|
+
}, t)
|
|
1427
|
+
}),
|
|
1428
|
+
/* @__PURE__ */ J(Ut, {
|
|
1429
|
+
axis: n,
|
|
1430
|
+
domain: i,
|
|
1431
|
+
value: l.y,
|
|
1432
|
+
step: o.y,
|
|
1433
|
+
locale: s,
|
|
1434
|
+
onChange: (e, t) => c({
|
|
1435
|
+
x: l.x,
|
|
1436
|
+
y: e
|
|
1437
|
+
}, t)
|
|
1438
|
+
}),
|
|
1439
|
+
/* @__PURE__ */ J(e, {
|
|
1440
|
+
type: "button",
|
|
1441
|
+
disabled: a === null,
|
|
1442
|
+
onClick: (e) => {
|
|
1443
|
+
De({ options: () => ({ onRangeChange: c }) }, "onRangeChange", null, {
|
|
1444
|
+
reason: "clear-press",
|
|
1445
|
+
event: e.nativeEvent
|
|
1446
|
+
});
|
|
1447
|
+
},
|
|
1448
|
+
children: "Clear range"
|
|
1449
|
+
})
|
|
1450
|
+
]
|
|
1451
|
+
});
|
|
1452
|
+
}
|
|
1453
|
+
// packages/charts/src/cartesian/time-series-data.ts
|
|
1454
|
+
var $ = {
|
|
1455
|
+
series: 12,
|
|
1456
|
+
pointsPerSeries: 2e3,
|
|
1457
|
+
markers: 200,
|
|
1458
|
+
panels: 12
|
|
1459
|
+
}, Gt = .01;
|
|
1460
|
+
function Kt({ series: e, isStacked: t, markers: n, timeline: r = [] }) {
|
|
1461
|
+
let i = e[0]?.points.map((e) => e.timestamp) ?? r;
|
|
1462
|
+
if (e.length > $.series || i.length > $.pointsPerSeries || n.length > $.markers) return `Choose a window with at most ${$.series} series, ${$.pointsPerSeries} observations per series, and ${$.markers} markers.`;
|
|
1463
|
+
if (!o(e) || !o(n)) return "Series and markers require unique identifiers.";
|
|
1464
|
+
for (let n of e) {
|
|
1465
|
+
if (n.points.length !== i.length) return "Every series must supply the same observation timestamps.";
|
|
1466
|
+
let e = Zt({
|
|
1467
|
+
points: n.points,
|
|
1468
|
+
timestamps: i,
|
|
1469
|
+
isStacked: t
|
|
1470
|
+
});
|
|
1471
|
+
if (e !== void 0) return e;
|
|
1472
|
+
}
|
|
1473
|
+
for (let t of n) {
|
|
1474
|
+
let n = qt({
|
|
1475
|
+
marker: t,
|
|
1476
|
+
series: e,
|
|
1477
|
+
timestamps: i
|
|
1478
|
+
});
|
|
1479
|
+
if (n !== void 0) return n;
|
|
1480
|
+
}
|
|
1481
|
+
let a = e.flatMap((e) => e.points.flatMap((e) => e.value === null ? [] : [e.value])), s = Math.max(0, ...a) - Math.min(0, ...a), c = (i.at(-1) ?? 0) - (i[0] ?? 0);
|
|
1482
|
+
if (!Number.isFinite(s) || !Number.isFinite(c)) return "The elapsed-time and value ranges must be finite.";
|
|
1483
|
+
if (t && i.some((t, n) => !Number.isFinite(e.reduce((e, t) => e + (t.points[n]?.value ?? 0), 0)))) return "Stacked observation totals must be finite.";
|
|
1484
|
+
}
|
|
1485
|
+
function qt({ marker: e, series: t, timestamps: n }) {
|
|
1486
|
+
if (e.kind === "event") {
|
|
1487
|
+
let t = n[0] ?? 0, r = n.at(-1) ?? t, i = e.timestamp >= t && e.timestamp <= r;
|
|
1488
|
+
return Number.isFinite(e.timestamp) && i ? void 0 : "Every event marker must fall inside the observed time range.";
|
|
1489
|
+
}
|
|
1490
|
+
if (!n.includes(e.timestamp)) return "Every time and point marker must align with an observation timestamp.";
|
|
1491
|
+
if (e.kind !== "time") return t.find((t) => t.id === e.seriesId)?.points.find((t) => t.timestamp === e.timestamp)?.value === e.value ? void 0 : "Point markers must reference the recorded series value.";
|
|
1492
|
+
}
|
|
1493
|
+
function Jt({ series: e, markers: t, timestampUnit: n, isStacked: r }) {
|
|
1494
|
+
return JSON.stringify([
|
|
1495
|
+
n,
|
|
1496
|
+
r,
|
|
1497
|
+
e.map((e) => [
|
|
1498
|
+
e.id,
|
|
1499
|
+
e.label,
|
|
1500
|
+
e.tone,
|
|
1501
|
+
e.points.map((e) => [e.timestamp, e.value])
|
|
1502
|
+
]),
|
|
1503
|
+
t.map((e) => [
|
|
1504
|
+
e.id,
|
|
1505
|
+
e.kind,
|
|
1506
|
+
e.timestamp,
|
|
1507
|
+
e.label,
|
|
1508
|
+
e.seriesId,
|
|
1509
|
+
e.value
|
|
1510
|
+
])
|
|
1511
|
+
]);
|
|
1512
|
+
}
|
|
1513
|
+
function Yt(e, t) {
|
|
1514
|
+
if (e !== t) return [e, t];
|
|
1515
|
+
let n = Math.max(1, Math.abs(e) * Gt), r = e - n, i = t + n;
|
|
1516
|
+
return [Number.isFinite(r) ? r : e, Number.isFinite(i) ? i : t];
|
|
1517
|
+
}
|
|
1518
|
+
function Xt({ series: e, isStacked: t, tones: n }) {
|
|
1519
|
+
let r = e.filter((e) => e.tone === void 0);
|
|
1520
|
+
return e.map((i, a) => {
|
|
1521
|
+
let o = r.findIndex((e) => e.id === i.id), s = n({
|
|
1522
|
+
id: i.id,
|
|
1523
|
+
tone: i.tone,
|
|
1524
|
+
index: o
|
|
1525
|
+
}), c = i.points.map((n, r) => {
|
|
1526
|
+
let i = t ? e.slice(0, a).reduce((e, t) => e + (t.points[r]?.value ?? 0), 0) : 0;
|
|
1527
|
+
return {
|
|
1528
|
+
...n,
|
|
1529
|
+
base: i
|
|
1530
|
+
};
|
|
1531
|
+
});
|
|
1532
|
+
return {
|
|
1533
|
+
id: i.id,
|
|
1534
|
+
label: i.label,
|
|
1535
|
+
tone: s,
|
|
1536
|
+
points: c
|
|
1537
|
+
};
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
function Zt({ points: e, timestamps: t, isStacked: n }) {
|
|
1541
|
+
for (let [r, i] of e.entries()) {
|
|
1542
|
+
let a = e[r - 1], o = a !== void 0 && i.timestamp <= a.timestamp;
|
|
1543
|
+
if (!Number.isFinite(i.timestamp) || i.timestamp !== t[r] || o) return "Observation timestamps must be finite, aligned, and strictly increasing.";
|
|
1544
|
+
if (i.value !== null && !Number.isFinite(i.value)) return "Observations must be finite numbers or explicit missing values.";
|
|
1545
|
+
if (n && (i.value === null || i.value < 0)) return "Stacked observations must be present and nonnegative.";
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
// packages/charts/src/cartesian/time-series-line.tsx
|
|
1549
|
+
function Qt({ series: e, x: t, y: n, pointRadius: r = 3 }) {
|
|
1550
|
+
let i = e.points.findLastIndex((e) => e.value !== null);
|
|
1551
|
+
return /* @__PURE__ */ Y(Oe, { children: [/* @__PURE__ */ J("path", {
|
|
1552
|
+
d: be(e.points.map((e) => ({
|
|
1553
|
+
x: t(e.timestamp),
|
|
1554
|
+
y: e.value === null ? null : n(e.value + e.base)
|
|
1555
|
+
}))),
|
|
1556
|
+
fill: "none",
|
|
1557
|
+
stroke: a[e.tone],
|
|
1558
|
+
...H.props(P.mark)
|
|
1559
|
+
}), e.points.filter((t, n) => {
|
|
1560
|
+
if (t.value === null) return !1;
|
|
1561
|
+
let r = e.points[n - 1]?.value === null || e.points[n + 1]?.value === null;
|
|
1562
|
+
return e.points.length === 1 || n === i || r;
|
|
1563
|
+
}).map((i) => /* @__PURE__ */ J("circle", {
|
|
1564
|
+
cx: t(i.timestamp),
|
|
1565
|
+
cy: n((i.value ?? 0) + i.base),
|
|
1566
|
+
r,
|
|
1567
|
+
fill: a[e.tone]
|
|
1568
|
+
}, i.timestamp))] });
|
|
1569
|
+
}
|
|
1570
|
+
// packages/charts/src/cartesian/sparkline.tsx
|
|
1571
|
+
var $t = {
|
|
1572
|
+
minimum: "Lowest",
|
|
1573
|
+
maximum: "Highest",
|
|
1574
|
+
last: "Latest"
|
|
1575
|
+
}, en = 2.5, tn = 3, nn = {
|
|
1576
|
+
inline: {
|
|
1577
|
+
width: 128,
|
|
1578
|
+
height: 32
|
|
1579
|
+
},
|
|
1580
|
+
figure: { height: 48 }
|
|
1581
|
+
};
|
|
1582
|
+
function rn({ points: e, marked: t }) {
|
|
1583
|
+
let n = e.flatMap((e) => e.value === null ? [] : [{
|
|
1584
|
+
...e,
|
|
1585
|
+
value: e.value
|
|
1586
|
+
}]), r = n.map((e) => e.value), i = {
|
|
1587
|
+
minimum: n.find((e) => e.value === Math.min(...r)),
|
|
1588
|
+
maximum: n.find((e) => e.value === Math.max(...r)),
|
|
1589
|
+
last: n.at(-1)
|
|
1590
|
+
};
|
|
1591
|
+
return t.flatMap((e) => {
|
|
1592
|
+
let t = i[e];
|
|
1593
|
+
return t === void 0 ? [] : [{
|
|
1594
|
+
kind: e,
|
|
1595
|
+
point: t
|
|
1596
|
+
}];
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
function an({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueDomain: o, markedPoints: s = [], baseline: c, layout: l = "inline" }) {
|
|
1600
|
+
let u = W(), f = F(), p = l === "figure", m = p ? f.width : nn.inline.width, h = p ? nn.figure.height : nn.inline.height, g = W(), _ = C(), v = on({
|
|
1601
|
+
title: e,
|
|
1602
|
+
summary: t,
|
|
1603
|
+
unit: n,
|
|
1604
|
+
series: i,
|
|
1605
|
+
valueDomain: o,
|
|
1606
|
+
markedPoints: s,
|
|
1607
|
+
baseline: c
|
|
1608
|
+
}), ee = i.points.some((e) => e.value !== null);
|
|
1609
|
+
if (v !== void 0 || !ee) return /* @__PURE__ */ J("span", {
|
|
1610
|
+
role: "img",
|
|
1611
|
+
"aria-label": `${e}. ${t} Values in ${n}; timestamps in ${r}. ${v ?? "No recorded values. Missing observations remain unavailable."}`,
|
|
1612
|
+
title: v ?? "No recorded values",
|
|
1613
|
+
className: "x2pejg6 x10w6t97 x2lah0s xxymvpz x3nfvp2 x6s0dn4 xl56j7k x153jb6y x1hz01jw xy8obcc",
|
|
1614
|
+
children: v === void 0 ? "No data" : "Invalid trend"
|
|
1615
|
+
});
|
|
1616
|
+
let y = i.points[0]?.timestamp ?? 0, b = i.points.at(-1)?.timestamp ?? y, x = k({
|
|
1617
|
+
domain: Yt(y, b),
|
|
1618
|
+
range: [tn, m - tn]
|
|
1619
|
+
}).position, S = k({
|
|
1620
|
+
domain: o,
|
|
1621
|
+
range: [h - tn, tn]
|
|
1622
|
+
}).position, w = Xt({
|
|
1623
|
+
series: [i],
|
|
1624
|
+
isStacked: !1,
|
|
1625
|
+
tones: _
|
|
1626
|
+
})[0], te = a[w?.tone ?? "series1"], T = rn({
|
|
1627
|
+
points: i.points,
|
|
1628
|
+
marked: s
|
|
1629
|
+
}), E = T.map(({ kind: e, point: t }) => `${$t[e]}: ${t.value} ${n}.`).join(" "), D = c === void 0 ? "" : `Reference: ${c} ${n}.`, O = /* @__PURE__ */ Y("svg", {
|
|
1630
|
+
role: "img",
|
|
1631
|
+
"aria-labelledby": u,
|
|
1632
|
+
"aria-describedby": g,
|
|
1633
|
+
focusable: "false",
|
|
1634
|
+
viewBox: `0 0 ${m} ${h}`,
|
|
1635
|
+
width: m,
|
|
1636
|
+
height: h,
|
|
1637
|
+
...{
|
|
1638
|
+
0: { className: "x1rg5ohu x2pejg6 x10w6t97 x2lah0s xxymvpz" },
|
|
1639
|
+
1: { className: "x1lliihq xh8yej3 xt7dq6l" }
|
|
1640
|
+
}[!!p | 0],
|
|
1641
|
+
children: [
|
|
1642
|
+
/* @__PURE__ */ J("title", {
|
|
1643
|
+
id: u,
|
|
1644
|
+
children: e
|
|
1645
|
+
}),
|
|
1646
|
+
/* @__PURE__ */ Y("desc", {
|
|
1647
|
+
id: g,
|
|
1648
|
+
children: [
|
|
1649
|
+
t,
|
|
1650
|
+
" Values in ",
|
|
1651
|
+
n,
|
|
1652
|
+
"; timestamps in ",
|
|
1653
|
+
r,
|
|
1654
|
+
". Displayed value domain: ",
|
|
1655
|
+
o[0],
|
|
1656
|
+
" to",
|
|
1657
|
+
" ",
|
|
1658
|
+
o[1],
|
|
1659
|
+
" ",
|
|
1660
|
+
n,
|
|
1661
|
+
". ",
|
|
1662
|
+
E,
|
|
1663
|
+
" ",
|
|
1664
|
+
D
|
|
1665
|
+
]
|
|
1666
|
+
}),
|
|
1667
|
+
c !== void 0 && /* @__PURE__ */ J("line", {
|
|
1668
|
+
x1: tn,
|
|
1669
|
+
x2: m - tn,
|
|
1670
|
+
y1: S(c),
|
|
1671
|
+
y2: S(c),
|
|
1672
|
+
className: "x1crw9hw xnpr05h xbw2l0c x13efnbd"
|
|
1673
|
+
}),
|
|
1674
|
+
w !== void 0 && /* @__PURE__ */ J(Qt, {
|
|
1675
|
+
series: w,
|
|
1676
|
+
x,
|
|
1677
|
+
y: S,
|
|
1678
|
+
pointRadius: 2
|
|
1679
|
+
}),
|
|
1680
|
+
T.map(({ kind: e, point: t }) => e === "last" ? /* @__PURE__ */ J("circle", {
|
|
1681
|
+
cx: x(t.timestamp),
|
|
1682
|
+
cy: S(t.value),
|
|
1683
|
+
r: en,
|
|
1684
|
+
fill: te
|
|
1685
|
+
}, e) : /* @__PURE__ */ J("circle", {
|
|
1686
|
+
cx: x(t.timestamp),
|
|
1687
|
+
cy: S(t.value),
|
|
1688
|
+
r: en,
|
|
1689
|
+
stroke: te,
|
|
1690
|
+
className: "x1fytgo2 x1r6sdyr x13efnbd"
|
|
1691
|
+
}, e))
|
|
1692
|
+
]
|
|
1693
|
+
});
|
|
1694
|
+
return p ? /* @__PURE__ */ J(d, {
|
|
1695
|
+
title: e,
|
|
1696
|
+
description: t,
|
|
1697
|
+
children: /* @__PURE__ */ J("div", {
|
|
1698
|
+
ref: f.ref,
|
|
1699
|
+
className: "x1lliihq xeuugli",
|
|
1700
|
+
children: O
|
|
1701
|
+
})
|
|
1702
|
+
}) : O;
|
|
1703
|
+
}
|
|
1704
|
+
function on({ title: e, summary: t, unit: n, series: r, valueDomain: i, markedPoints: a, baseline: o }) {
|
|
1705
|
+
if (e.trim() === "" || t.trim() === "" || n.trim() === "") return "A trend requires a title, a readable summary, and a value unit.";
|
|
1706
|
+
if (!D(i)) return "The displayed value domain must have finite, increasing bounds.";
|
|
1707
|
+
let s = Kt({
|
|
1708
|
+
series: [r],
|
|
1709
|
+
isStacked: !1,
|
|
1710
|
+
markers: []
|
|
1711
|
+
});
|
|
1712
|
+
if (s !== void 0) return s;
|
|
1713
|
+
if (r.points.some((e) => e.value !== null && (e.value < i[0] || e.value > i[1]))) return "Every recorded value must be inside the declared value domain.";
|
|
1714
|
+
if (new Set(a).size !== a.length) return "Mark each recorded point at most once.";
|
|
1715
|
+
if (!(o === void 0 || o >= i[0] && o <= i[1])) return "The reference value must be inside the declared value domain.";
|
|
1716
|
+
}
|
|
1717
|
+
// packages/charts/src/cartesian/time-series-bands.ts
|
|
1718
|
+
var sn = {
|
|
1719
|
+
bands: 4,
|
|
1720
|
+
crossings: 4
|
|
1721
|
+
};
|
|
1722
|
+
function cn(e) {
|
|
1723
|
+
let t = [
|
|
1724
|
+
e.lower,
|
|
1725
|
+
e.center,
|
|
1726
|
+
e.upper
|
|
1727
|
+
].filter((e) => e !== null);
|
|
1728
|
+
return t.some((e) => !Number.isFinite(e)) ? "Band values must be finite numbers or explicit missing values." : e.lower === null == (e.upper === null) ? t.every((e, n) => n === 0 || (t[n - 1] ?? e) <= e) ? void 0 : "Band values must satisfy lower ≤ center ≤ upper." : "A band observation needs both bounds or neither.";
|
|
1729
|
+
}
|
|
1730
|
+
function ln({ bands: e, crossings: t, series: n, timestamps: r }) {
|
|
1731
|
+
if (e.length > sn.bands || t.length > sn.crossings) return `Supply at most ${sn.bands} bands and ${sn.crossings} crossings.`;
|
|
1732
|
+
if (!o([...n, ...e]) || !o(t)) return "Series, bands, and crossings require unique identifiers.";
|
|
1733
|
+
for (let t of e) {
|
|
1734
|
+
if (t.points.length !== r.length || t.points.some((e, t) => e.timestamp !== r[t])) return "Every band must supply the same observation timestamps as the series.";
|
|
1735
|
+
let e = t.points.map(cn).find((e) => e !== void 0);
|
|
1736
|
+
if (e !== void 0) return e;
|
|
1737
|
+
}
|
|
1738
|
+
let i = new Set([...n, ...e].map((e) => e.id));
|
|
1739
|
+
for (let e of t) if (!(i.has(e.seriesId) && e.label.trim() !== "") || !Number.isFinite(e.value)) return "Each crossing needs a label, a finite value, and a supplied series or band.";
|
|
1740
|
+
}
|
|
1741
|
+
function un({ series: e, bands: t, tones: n }) {
|
|
1742
|
+
let r = e.filter((e) => e.tone === void 0).length, i = t.filter((e) => e.tone === void 0);
|
|
1743
|
+
return t.map((e) => {
|
|
1744
|
+
let t = r + i.findIndex((t) => t.id === e.id);
|
|
1745
|
+
return {
|
|
1746
|
+
...e,
|
|
1747
|
+
tone: n({
|
|
1748
|
+
id: e.id,
|
|
1749
|
+
tone: e.tone,
|
|
1750
|
+
index: t
|
|
1751
|
+
})
|
|
1752
|
+
};
|
|
1753
|
+
});
|
|
1754
|
+
}
|
|
1755
|
+
function dn({ start: e, end: t, value: n, direction: r }) {
|
|
1756
|
+
let i = e > n && t <= n, a = e < n && t >= n;
|
|
1757
|
+
switch (r) {
|
|
1758
|
+
case "falling": return i;
|
|
1759
|
+
case "rising": return a;
|
|
1760
|
+
case void 0: return i || a;
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
function fn({ points: e, crossing: t }) {
|
|
1764
|
+
let n = e.flatMap((t, n) => {
|
|
1765
|
+
let r = e[n + 1];
|
|
1766
|
+
return t.value === null || r === void 0 || r.value === null ? [] : [{
|
|
1767
|
+
start: t.timestamp,
|
|
1768
|
+
end: r.timestamp,
|
|
1769
|
+
from: t.value,
|
|
1770
|
+
to: r.value
|
|
1771
|
+
}];
|
|
1772
|
+
}).find(({ from: e, to: n }) => dn({
|
|
1773
|
+
start: e,
|
|
1774
|
+
end: n,
|
|
1775
|
+
value: t.value,
|
|
1776
|
+
direction: t.direction
|
|
1777
|
+
}));
|
|
1778
|
+
if (n === void 0) return;
|
|
1779
|
+
let r = (t.value - n.from) / (n.to - n.from);
|
|
1780
|
+
return n.start + r * (n.end - n.start);
|
|
1781
|
+
}
|
|
1782
|
+
function pn({ crossings: e, series: t, bands: n }) {
|
|
1783
|
+
return e.map((e) => ({
|
|
1784
|
+
crossing: e,
|
|
1785
|
+
timestamp: fn({
|
|
1786
|
+
points: t.find((t) => t.id === e.seriesId)?.points ?? n.find((t) => t.id === e.seriesId)?.points.map((e) => ({
|
|
1787
|
+
timestamp: e.timestamp,
|
|
1788
|
+
value: e.center
|
|
1789
|
+
})) ?? [],
|
|
1790
|
+
crossing: e
|
|
1791
|
+
})
|
|
1792
|
+
}));
|
|
1793
|
+
}
|
|
1794
|
+
function mn(e, t) {
|
|
1795
|
+
let n = Math.min(...e.map((e) => Math.abs(e - t)));
|
|
1796
|
+
return e.find((e) => Math.abs(e - t) === n);
|
|
1797
|
+
}
|
|
1798
|
+
function hn(e) {
|
|
1799
|
+
return e.flatMap((e) => e.points.flatMap((e) => [
|
|
1800
|
+
e.lower,
|
|
1801
|
+
e.center,
|
|
1802
|
+
e.upper
|
|
1803
|
+
].filter((e) => e !== null)));
|
|
1804
|
+
}
|
|
1805
|
+
// packages/charts/src/chart-range.tsx
|
|
1806
|
+
var gn = "axis", _n = "selected", vn = "drawn";
|
|
1807
|
+
function yn({ value: e }) {
|
|
1808
|
+
return {
|
|
1809
|
+
value: e,
|
|
1810
|
+
spans: e === null ? [] : [{
|
|
1811
|
+
id: _n,
|
|
1812
|
+
track: gn,
|
|
1813
|
+
start: e[0],
|
|
1814
|
+
end: e[1]
|
|
1815
|
+
}]
|
|
1816
|
+
};
|
|
1817
|
+
}
|
|
1818
|
+
function bn(e, t) {
|
|
1819
|
+
let { draft: n } = e;
|
|
1820
|
+
return n?.action === "draw" ? t.filter((e) => e.id === n.id) : t;
|
|
1821
|
+
}
|
|
1822
|
+
var xn = Ee({
|
|
1823
|
+
name: "chart-range",
|
|
1824
|
+
options: {
|
|
1825
|
+
value: "value",
|
|
1826
|
+
onValueChange: "callback",
|
|
1827
|
+
min: "number",
|
|
1828
|
+
max: "number",
|
|
1829
|
+
step: "number",
|
|
1830
|
+
describe: "value"
|
|
1831
|
+
},
|
|
1832
|
+
controlled: ["value"],
|
|
1833
|
+
state: (e) => ({
|
|
1834
|
+
...yn(e),
|
|
1835
|
+
draft: null
|
|
1836
|
+
}),
|
|
1837
|
+
sync: yn,
|
|
1838
|
+
api: (e) => {
|
|
1839
|
+
let t = q(e);
|
|
1840
|
+
function n(n, { id: r, action: i, reason: a, event: o }) {
|
|
1841
|
+
let s = i === "delete" ? void 0 : n.find((e) => e.id === r), c = s === void 0 ? null : [s.start, s.end], l = t("value", c, o === void 0 ? { reason: a } : {
|
|
1842
|
+
reason: a,
|
|
1843
|
+
event: o
|
|
1844
|
+
});
|
|
1845
|
+
return l && i === "delete" && e.element("root")?.querySelector("[tabindex=\"0\"]:not([data-span-id])")?.focus(), l;
|
|
1846
|
+
}
|
|
1847
|
+
let r = Te(e, {
|
|
1848
|
+
key: "spans",
|
|
1849
|
+
draft: "draft",
|
|
1850
|
+
axis: "x",
|
|
1851
|
+
min: () => e.options().min,
|
|
1852
|
+
max: () => e.options().max,
|
|
1853
|
+
step: () => e.options().step,
|
|
1854
|
+
create: (e) => ({
|
|
1855
|
+
...e,
|
|
1856
|
+
id: vn
|
|
1857
|
+
}),
|
|
1858
|
+
label: (t) => e.options().describe([t.start, t.end]),
|
|
1859
|
+
createAutoScroll: !1,
|
|
1860
|
+
set: (e, t) => n(e, t)
|
|
1861
|
+
});
|
|
1862
|
+
return {
|
|
1863
|
+
spans: r,
|
|
1864
|
+
shown(t) {
|
|
1865
|
+
return bn(t, r.spans(t)).map((t) => ({
|
|
1866
|
+
id: t.id,
|
|
1867
|
+
label: e.options().describe([t.start, t.end])
|
|
1868
|
+
}));
|
|
1869
|
+
},
|
|
1870
|
+
draw(e) {
|
|
1871
|
+
e.button === 0 && e.pointerType !== "touch" && r.trackPointerdown(e, gn);
|
|
1872
|
+
},
|
|
1873
|
+
setRange(n, r) {
|
|
1874
|
+
let { min: i, max: a, step: o } = e.options(), s = [Number(n), Number(r)].map((e) => i + Math.round((e - i) / o) * o), c = Math.max(i, Math.min(...s)), l = Math.min(a, Math.max(...s));
|
|
1875
|
+
if (!Number.isFinite(c) || !Number.isFinite(l) || c >= l) throw Error(`Give a start and a later end between ${i} and ${a}.`);
|
|
1876
|
+
return t("value", [c, l], { reason: "imperative" });
|
|
1877
|
+
},
|
|
1878
|
+
clear() {
|
|
1879
|
+
return t("value", null, { reason: "imperative" });
|
|
1880
|
+
}
|
|
1881
|
+
};
|
|
1882
|
+
},
|
|
1883
|
+
slots: (e) => ({
|
|
1884
|
+
root: e({
|
|
1885
|
+
role: "group",
|
|
1886
|
+
state: (e, { api: t }) => ({ spans: t.shown(e) }),
|
|
1887
|
+
on: { pointerdown: (e, { api: t }) => t.draw(e) }
|
|
1888
|
+
}),
|
|
1889
|
+
track: e({ bind: (e, { api: t }) => t.spans.bindTrack(e, gn) }),
|
|
1890
|
+
span: e({
|
|
1891
|
+
role: "group",
|
|
1892
|
+
props: { value: "string" },
|
|
1893
|
+
attrs: (e, { api: t, key: n }) => {
|
|
1894
|
+
let r = t.spans.spans(e).find((e) => e.id === n);
|
|
1895
|
+
return {
|
|
1896
|
+
...t.spans.spanAttrs(e, n),
|
|
1897
|
+
tabindex: "0",
|
|
1898
|
+
style: r === void 0 ? void 0 : t.spans.spanStyle(r)
|
|
1899
|
+
};
|
|
1900
|
+
},
|
|
1901
|
+
bind: (e, { api: t, key: n }) => t.spans.bindSpan(e, n),
|
|
1902
|
+
on: {
|
|
1903
|
+
pointerdown: (e, { api: t, key: n }) => t.spans.spanPointerdown(e, n),
|
|
1904
|
+
keydown: (e, { api: t, key: n }) => {
|
|
1905
|
+
t.spans.keydown(e, n);
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
})
|
|
1909
|
+
}),
|
|
1910
|
+
agent: { actions: ["setRange", "clear"] }
|
|
1911
|
+
}), Sn = U(xn, {
|
|
1912
|
+
root: "div",
|
|
1913
|
+
track: "div",
|
|
1914
|
+
span: "div"
|
|
1915
|
+
}), Cn = Sn.Root, wn = Sn.Track, Tn = Sn.Span, En = {
|
|
1916
|
+
kVAEAm: "x10l6tqk",
|
|
1917
|
+
k87sOh: "x13vifvy",
|
|
1918
|
+
kfzvcC: "x47corl",
|
|
1919
|
+
$$css: !0
|
|
1920
|
+
}, Dn = { track: (e, t, n) => [
|
|
1921
|
+
En,
|
|
1922
|
+
{
|
|
1923
|
+
kbCHJM: e == null ? e : "xgq9j65",
|
|
1924
|
+
kzqmXN: t == null ? t : "x5lhr3w",
|
|
1925
|
+
kZKoxP: n == null ? n : "x16ye13r",
|
|
1926
|
+
$$css: !0
|
|
1927
|
+
},
|
|
1928
|
+
{
|
|
1929
|
+
"--x-left": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
|
|
1930
|
+
"--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t),
|
|
1931
|
+
"--x-height": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(n)
|
|
1932
|
+
}
|
|
1933
|
+
] };
|
|
1934
|
+
function On({ left: e, width: t, height: n, label: r, children: i, ...a }) {
|
|
1935
|
+
return /* @__PURE__ */ J(Cn, {
|
|
1936
|
+
...a,
|
|
1937
|
+
"aria-label": r,
|
|
1938
|
+
className: "x1n2onr6 xeuugli",
|
|
1939
|
+
render: (r, { spans: a }) => /* @__PURE__ */ Y("div", {
|
|
1940
|
+
...r,
|
|
1941
|
+
children: [i, /* @__PURE__ */ J(wn, {
|
|
1942
|
+
...H.props(Dn.track(e, t, n)),
|
|
1943
|
+
children: a.map((e) => /* @__PURE__ */ Y(Tn, {
|
|
1944
|
+
value: e.id,
|
|
1945
|
+
"aria-label": `Selected range, ${e.label}. Use arrow keys to move it, Shift and an arrow to move its end, and Delete to clear it.`,
|
|
1946
|
+
className: "x10l6tqk x13vifvy x5yr21d x9f619 x1qatu44 x1l0rsgs x1616tdu xbsl7fq xbm8b0d x1n2ykn x1t137rt x19rmrnh x9v5kkp x13qnu6 x1bqaal",
|
|
1947
|
+
children: [
|
|
1948
|
+
/* @__PURE__ */ J("span", { className: "x10l6tqk x67bb7w x5ve5x3 x7it7wx x1ey2m1c xdk7pt x1jm3nie x1o753nm x1jzqe4 x3onkmb" }),
|
|
1949
|
+
/* @__PURE__ */ J("span", {
|
|
1950
|
+
"data-span-edge": "start",
|
|
1951
|
+
className: "x10l6tqk x67bb7w x5ve5x3 x13vifvy x5yr21d x1fsd2vl x7eptgl x1765b1"
|
|
1952
|
+
}),
|
|
1953
|
+
/* @__PURE__ */ J("span", {
|
|
1954
|
+
"data-span-edge": "end",
|
|
1955
|
+
className: "x10l6tqk x67bb7w x5ve5x3 x13vifvy x5yr21d x1fsd2vl x7eptgl xpa5qit"
|
|
1956
|
+
})
|
|
1957
|
+
]
|
|
1958
|
+
}, e.id))
|
|
1959
|
+
})]
|
|
1960
|
+
})
|
|
1961
|
+
});
|
|
1962
|
+
}
|
|
1963
|
+
// packages/charts/src/cartesian/time-series-overlays.tsx
|
|
1964
|
+
var kn = 16, An = 6, jn = 6.5, Mn = 4;
|
|
1965
|
+
function Nn({ instants: e, x: t, right: n, ends: r }) {
|
|
1966
|
+
let [i, ...a] = e;
|
|
1967
|
+
if (i === void 0) return [];
|
|
1968
|
+
let o = t(i.timestamp), s = i.label.length * jn + An, c = o + s > n ? "end" : "start", l = c === "start" ? o : o - s, u = c === "start" ? o + s : o, d = r.findIndex((e) => l > e), f = d === -1 ? Math.min(r.length, 1) : d, p = [
|
|
1969
|
+
...r.slice(0, f),
|
|
1970
|
+
Math.max(u, r[f] ?? u),
|
|
1971
|
+
...r.slice(f + 1)
|
|
1972
|
+
];
|
|
1973
|
+
return [{
|
|
1974
|
+
...i,
|
|
1975
|
+
lane: f,
|
|
1976
|
+
anchor: c
|
|
1977
|
+
}, ...Nn({
|
|
1978
|
+
instants: a,
|
|
1979
|
+
x: t,
|
|
1980
|
+
right: n,
|
|
1981
|
+
ends: p
|
|
1982
|
+
})];
|
|
1983
|
+
}
|
|
1984
|
+
function Pn({ instants: e, x: t, right: n }) {
|
|
1985
|
+
return Nn({
|
|
1986
|
+
instants: e.toSorted((e, t) => e.timestamp - t.timestamp),
|
|
1987
|
+
x: t,
|
|
1988
|
+
right: n,
|
|
1989
|
+
ends: []
|
|
1990
|
+
});
|
|
1991
|
+
}
|
|
1992
|
+
function Fn(e) {
|
|
1993
|
+
return Math.max(0, ...e.map((e) => e.lane + 1)) * kn;
|
|
1994
|
+
}
|
|
1995
|
+
function In({ bands: e, x: t, y: n }) {
|
|
1996
|
+
return /* @__PURE__ */ J("g", { children: e.map((e) => {
|
|
1997
|
+
function r(t) {
|
|
1998
|
+
return e.points.map((e) => {
|
|
1999
|
+
let r = t(e);
|
|
2000
|
+
return r === null ? null : n(r);
|
|
2001
|
+
});
|
|
2002
|
+
}
|
|
2003
|
+
let i = r((e) => e.lower), a = r((e) => e.upper), o = r((e) => e.center), s = e.points.map((e) => t(e.timestamp));
|
|
2004
|
+
return /* @__PURE__ */ Y("g", { children: [/* @__PURE__ */ J(B, {
|
|
2005
|
+
d: xe(s.map((e, t) => ({
|
|
2006
|
+
x: e,
|
|
2007
|
+
y0: i[t] ?? null,
|
|
2008
|
+
y1: a[t] ?? null
|
|
2009
|
+
}))),
|
|
2010
|
+
tone: e.tone
|
|
2011
|
+
}), /* @__PURE__ */ J(ue, {
|
|
2012
|
+
d: be(s.map((e, t) => ({
|
|
2013
|
+
x: e,
|
|
2014
|
+
y: o[t] ?? null
|
|
2015
|
+
}))),
|
|
2016
|
+
tone: e.tone
|
|
2017
|
+
})] }, e.id);
|
|
2018
|
+
}) });
|
|
2019
|
+
}
|
|
2020
|
+
function Ln({ placed: e, x: t, y: n, top: r, bottom: i }) {
|
|
2021
|
+
let a = r - Fn(e);
|
|
2022
|
+
return /* @__PURE__ */ J("g", {
|
|
2023
|
+
"aria-hidden": !0,
|
|
2024
|
+
children: e.map((e) => {
|
|
2025
|
+
let r = t(e.timestamp), o = a + (e.lane + 1 / 2) * kn, s = e.anchor === "start" ? r + An : r - An;
|
|
2026
|
+
return /* @__PURE__ */ Y("g", { children: [
|
|
2027
|
+
/* @__PURE__ */ J(de, {
|
|
2028
|
+
x: r,
|
|
2029
|
+
top: o,
|
|
2030
|
+
bottom: i
|
|
2031
|
+
}),
|
|
2032
|
+
/* @__PURE__ */ J(L, {
|
|
2033
|
+
x: s,
|
|
2034
|
+
y: o + Mn,
|
|
2035
|
+
anchor: e.anchor,
|
|
2036
|
+
children: e.label
|
|
2037
|
+
}),
|
|
2038
|
+
e.value !== void 0 && /* @__PURE__ */ J(R, {
|
|
2039
|
+
x: r,
|
|
2040
|
+
y: n(e.value)
|
|
2041
|
+
})
|
|
2042
|
+
] }, e.id);
|
|
2043
|
+
})
|
|
2044
|
+
});
|
|
2045
|
+
}
|
|
2046
|
+
// packages/charts/src/cartesian/time-series.tsx
|
|
2047
|
+
var Rn = {
|
|
2048
|
+
seconds: 1e3,
|
|
2049
|
+
milliseconds: 1
|
|
2050
|
+
}, zn = 24, Bn = 12, Vn = 2.5, Hn = 4, Un = {
|
|
2051
|
+
line: "line",
|
|
2052
|
+
area: "swatch"
|
|
2053
|
+
};
|
|
2054
|
+
function Wn(e, t) {
|
|
2055
|
+
return e * Rn[t];
|
|
2056
|
+
}
|
|
2057
|
+
function Gn({ format: e, tickFormat: t, label: n = "" }) {
|
|
2058
|
+
return {
|
|
2059
|
+
label: n,
|
|
2060
|
+
format: e,
|
|
2061
|
+
tickFormat: t
|
|
2062
|
+
};
|
|
2063
|
+
}
|
|
2064
|
+
function Kn({ series: e, isStacked: t, isZeroBased: n, bands: r, crossings: i }) {
|
|
2065
|
+
let a = (e[0]?.points ?? []).map((t, n) => e.reduce((e, t) => e + (t.points[n]?.value ?? 0), 0)), o = t ? a : e.flatMap((e) => e.points.map((e) => e.value));
|
|
2066
|
+
return u({
|
|
2067
|
+
values: [
|
|
2068
|
+
...o,
|
|
2069
|
+
...hn(r),
|
|
2070
|
+
...i.map((e) => e.value)
|
|
2071
|
+
],
|
|
2072
|
+
isZeroBased: n
|
|
2073
|
+
});
|
|
2074
|
+
}
|
|
2075
|
+
function qn({ bands: e, crossings: t }) {
|
|
2076
|
+
return JSON.stringify([e.map((e) => [
|
|
2077
|
+
e.id,
|
|
2078
|
+
e.label,
|
|
2079
|
+
e.rangeLabel,
|
|
2080
|
+
e.tone,
|
|
2081
|
+
e.points.map((e) => [
|
|
2082
|
+
e.timestamp,
|
|
2083
|
+
e.lower,
|
|
2084
|
+
e.center,
|
|
2085
|
+
e.upper
|
|
2086
|
+
])
|
|
2087
|
+
]), t.map((e) => [
|
|
2088
|
+
e.id,
|
|
2089
|
+
e.seriesId,
|
|
2090
|
+
e.value,
|
|
2091
|
+
e.label,
|
|
2092
|
+
e.direction
|
|
2093
|
+
])]);
|
|
2094
|
+
}
|
|
2095
|
+
function Jn({ bands: e, timestamp: t, valueText: n }) {
|
|
2096
|
+
return e.flatMap((e) => {
|
|
2097
|
+
let r = e.points.find((e) => e.timestamp === t), i = r?.center ?? null, a = r?.lower !== null && r?.upper !== null && r !== void 0;
|
|
2098
|
+
return [{
|
|
2099
|
+
id: e.id,
|
|
2100
|
+
label: e.label,
|
|
2101
|
+
tone: e.tone,
|
|
2102
|
+
shape: "band",
|
|
2103
|
+
value: n(i)
|
|
2104
|
+
}, {
|
|
2105
|
+
id: `${e.id}:range`,
|
|
2106
|
+
label: e.rangeLabel,
|
|
2107
|
+
tone: e.tone,
|
|
2108
|
+
shape: "band",
|
|
2109
|
+
value: a ? `${n(r.lower)} – ${n(r.upper)}` : n(null)
|
|
2110
|
+
}];
|
|
2111
|
+
});
|
|
2112
|
+
}
|
|
2113
|
+
function Yn({ found: e, timeText: t }) {
|
|
2114
|
+
return e.timestamp === void 0 ? `${e.crossing.label} · Not reached in this range` : `About ${t(e.timestamp)} · ${e.crossing.label}`;
|
|
2115
|
+
}
|
|
2116
|
+
function Xn(e) {
|
|
2117
|
+
return /* @__PURE__ */ J(nr, {
|
|
2118
|
+
...e,
|
|
2119
|
+
kind: "line",
|
|
2120
|
+
isStacked: !1
|
|
2121
|
+
});
|
|
2122
|
+
}
|
|
2123
|
+
function Zn({ isStacked: e = !1, ...t }) {
|
|
2124
|
+
return /* @__PURE__ */ J(nr, {
|
|
2125
|
+
...t,
|
|
2126
|
+
kind: "area",
|
|
2127
|
+
isStacked: e
|
|
2128
|
+
});
|
|
2129
|
+
}
|
|
2130
|
+
function Qn(e) {
|
|
2131
|
+
return /* @__PURE__ */ J($n, { ...e });
|
|
2132
|
+
}
|
|
2133
|
+
function $n({ series: e, height: t = "compact", showTimeAxis: i = !0, ...a }) {
|
|
2134
|
+
let o = W(), s = C(), c = Xt({
|
|
2135
|
+
series: e.map((e) => ({
|
|
2136
|
+
...e,
|
|
2137
|
+
points: []
|
|
2138
|
+
})),
|
|
2139
|
+
isStacked: !1,
|
|
2140
|
+
tones: s
|
|
2141
|
+
});
|
|
2142
|
+
return /* @__PURE__ */ J("div", {
|
|
2143
|
+
"aria-hidden": !0,
|
|
2144
|
+
inert: !0,
|
|
2145
|
+
className: "xeuugli",
|
|
2146
|
+
children: /* @__PURE__ */ J(j, {
|
|
2147
|
+
...a,
|
|
2148
|
+
status: "loading",
|
|
2149
|
+
series: c,
|
|
2150
|
+
seriesLegend: /* @__PURE__ */ J(M, {
|
|
2151
|
+
id: o,
|
|
2152
|
+
label: void 0,
|
|
2153
|
+
legend: c,
|
|
2154
|
+
rows: [],
|
|
2155
|
+
x: 0,
|
|
2156
|
+
width: 0,
|
|
2157
|
+
hasSeriesSummary: a.report?.seriesValues !== void 0
|
|
2158
|
+
}),
|
|
2159
|
+
children: /* @__PURE__ */ J("div", {
|
|
2160
|
+
className: "xrvj5dj x1n8ia3y",
|
|
2161
|
+
children: /* @__PURE__ */ Y("div", {
|
|
2162
|
+
className: "xeuugli",
|
|
2163
|
+
children: [/* @__PURE__ */ J(r, { height: f[t] - zn }), /* @__PURE__ */ J("div", {
|
|
2164
|
+
className: "x78zum5 x6s0dn4 x1qughib x8zbtdt xxk0z11",
|
|
2165
|
+
children: i && /* @__PURE__ */ Y(Oe, { children: [/* @__PURE__ */ J(n, { width: "8ch" }), /* @__PURE__ */ J(n, { width: "8ch" })] })
|
|
2166
|
+
})]
|
|
2167
|
+
})
|
|
2168
|
+
})
|
|
2169
|
+
})
|
|
2170
|
+
});
|
|
2171
|
+
}
|
|
2172
|
+
function er({ charts: e, timestampUnit: t, timeFormat: n, height: r = "compact", locale: i, status: a }) {
|
|
2173
|
+
let s = we(null), [c, l] = G(), u = JSON.stringify(e.map((e) => [
|
|
2174
|
+
e.id,
|
|
2175
|
+
e.title,
|
|
2176
|
+
Jt({
|
|
2177
|
+
series: e.series,
|
|
2178
|
+
markers: e.markers ?? [],
|
|
2179
|
+
timestampUnit: t,
|
|
2180
|
+
isStacked: !1
|
|
2181
|
+
})
|
|
2182
|
+
])), d = JSON.stringify(e[0]?.series[0]?.points.map((e) => e.timestamp) ?? []), p = e.every((e) => JSON.stringify(e.series[0]?.points.map((e) => e.timestamp) ?? []) === d);
|
|
2183
|
+
if (c !== void 0 && c.signature !== u && l(void 0), a === "loading") return /* @__PURE__ */ J(tr, {
|
|
2184
|
+
charts: e,
|
|
2185
|
+
height: r,
|
|
2186
|
+
locale: i
|
|
2187
|
+
});
|
|
2188
|
+
if (!p || !o(e)) return /* @__PURE__ */ J(oe, {
|
|
2189
|
+
title: "Small multiples",
|
|
2190
|
+
locale: i,
|
|
2191
|
+
message: "Charts need unique identifiers and aligned observation timestamps."
|
|
2192
|
+
});
|
|
2193
|
+
if (e.length > $.panels) return /* @__PURE__ */ J(oe, {
|
|
2194
|
+
title: "Small multiples",
|
|
2195
|
+
locale: i,
|
|
2196
|
+
message: `Choose at most ${$.panels} panels.`
|
|
2197
|
+
});
|
|
2198
|
+
if (e.length === 0) return /* @__PURE__ */ J(j, {
|
|
2199
|
+
title: "Small multiples",
|
|
2200
|
+
locale: i,
|
|
2201
|
+
children: /* @__PURE__ */ J(se, { children: "No charts" })
|
|
2202
|
+
});
|
|
2203
|
+
let m = h({
|
|
2204
|
+
height: f[r],
|
|
2205
|
+
locale: i,
|
|
2206
|
+
hasValueTitle: e.some((e) => e.valueLabel !== void 0),
|
|
2207
|
+
axes: e.map((e) => ({
|
|
2208
|
+
axis: Gn({
|
|
2209
|
+
format: e.valueFormat,
|
|
2210
|
+
tickFormat: e.tickFormat,
|
|
2211
|
+
label: e.valueLabel
|
|
2212
|
+
}),
|
|
2213
|
+
domain: Kn({
|
|
2214
|
+
series: e.series,
|
|
2215
|
+
isStacked: !1,
|
|
2216
|
+
isZeroBased: !1,
|
|
2217
|
+
bands: e.bands ?? [],
|
|
2218
|
+
crossings: []
|
|
2219
|
+
})
|
|
2220
|
+
}))
|
|
2221
|
+
}), g = e.every((e) => e.report !== void 0);
|
|
2222
|
+
return /* @__PURE__ */ J("div", {
|
|
2223
|
+
ref: s,
|
|
2224
|
+
...{
|
|
2225
|
+
0: { className: "xrvj5dj x1j825kq" },
|
|
2226
|
+
1: { className: "xrvj5dj xxhr3t" }
|
|
2227
|
+
}[!!g | 0],
|
|
2228
|
+
children: e.map(({ id: o, ...d }, f) => /* @__PURE__ */ J("div", {
|
|
2229
|
+
...{
|
|
2230
|
+
0: {},
|
|
2231
|
+
1: { className: "x1y332i5" }
|
|
2232
|
+
}[!!(g && f > 0) | 0],
|
|
2233
|
+
children: /* @__PURE__ */ J(nr, {
|
|
2234
|
+
...d,
|
|
2235
|
+
locale: i,
|
|
2236
|
+
status: a,
|
|
2237
|
+
timestampUnit: t,
|
|
2238
|
+
timeFormat: n,
|
|
2239
|
+
height: r,
|
|
2240
|
+
kind: "line",
|
|
2241
|
+
isStacked: !1,
|
|
2242
|
+
sharedInspection: {
|
|
2243
|
+
id: c?.signature === u ? c.id : null,
|
|
2244
|
+
isSource: c?.chartId === o,
|
|
2245
|
+
onChange: (e) => l(e === null ? void 0 : {
|
|
2246
|
+
id: e,
|
|
2247
|
+
signature: u,
|
|
2248
|
+
chartId: o
|
|
2249
|
+
}),
|
|
2250
|
+
within: (e) => s.current?.contains(e) === !0
|
|
2251
|
+
},
|
|
2252
|
+
gutter: m,
|
|
2253
|
+
showTimeAxis: f === e.length - 1
|
|
2254
|
+
})
|
|
2255
|
+
}, o))
|
|
2256
|
+
});
|
|
2257
|
+
}
|
|
2258
|
+
function tr({ charts: e, height: t, locale: n }) {
|
|
2259
|
+
if (!o(e) || e.length > $.panels) return /* @__PURE__ */ J(oe, {
|
|
2260
|
+
title: "Small multiples",
|
|
2261
|
+
locale: n,
|
|
2262
|
+
message: `Choose at most ${$.panels} panels with unique identifiers.`
|
|
2263
|
+
});
|
|
2264
|
+
let r = e.every((e) => e.report !== void 0);
|
|
2265
|
+
return /* @__PURE__ */ J("div", {
|
|
2266
|
+
"aria-hidden": !0,
|
|
2267
|
+
inert: !0,
|
|
2268
|
+
...{
|
|
2269
|
+
0: { className: "xrvj5dj x1j825kq" },
|
|
2270
|
+
1: { className: "xrvj5dj xxhr3t" }
|
|
2271
|
+
}[!!r | 0],
|
|
2272
|
+
children: e.map(({ id: i, ...a }, o) => /* @__PURE__ */ J("div", {
|
|
2273
|
+
...{
|
|
2274
|
+
0: {},
|
|
2275
|
+
1: { className: "x1y332i5" }
|
|
2276
|
+
}[!!(r && o > 0) | 0],
|
|
2277
|
+
children: /* @__PURE__ */ J($n, {
|
|
2278
|
+
...a,
|
|
2279
|
+
locale: n,
|
|
2280
|
+
height: t,
|
|
2281
|
+
showTimeAxis: o === e.length - 1
|
|
2282
|
+
})
|
|
2283
|
+
}, i))
|
|
2284
|
+
});
|
|
2285
|
+
}
|
|
2286
|
+
function nr({ series: t, timestampUnit: n, timeFormat: r, valueFormat: i, tickFormat: a, valueLabel: o, markers: s = [], height: c = "compact", kind: l, isStacked: u, sharedInspection: d, gutter: f, showTimeAxis: p = !0, bands: h = [], crossings: g = [], range: _ = null, onRangeChange: y, rangeStep: b, emptyLabel: x = "No observations", ...S }) {
|
|
2287
|
+
let { title: T, locale: E, report: D } = S, O = C(), k = he(c), A = W(), ie = h[0]?.points.map((e) => e.timestamp) ?? [], N = t[0]?.points.map((e) => e.timestamp) ?? ie, P = Kt({
|
|
2288
|
+
series: t,
|
|
2289
|
+
isStacked: u,
|
|
2290
|
+
markers: s,
|
|
2291
|
+
timeline: ie
|
|
2292
|
+
}) ?? ln({
|
|
2293
|
+
bands: h,
|
|
2294
|
+
crossings: g,
|
|
2295
|
+
series: t,
|
|
2296
|
+
timestamps: N
|
|
2297
|
+
}) ?? rr({
|
|
2298
|
+
range: _,
|
|
2299
|
+
rangeStep: b,
|
|
2300
|
+
isSelectable: y !== void 0,
|
|
2301
|
+
timeline: N
|
|
2302
|
+
}), F = P === void 0 ? Xt({
|
|
2303
|
+
series: t,
|
|
2304
|
+
isStacked: u,
|
|
2305
|
+
tones: O
|
|
2306
|
+
}) : [], L = P === void 0 ? un({
|
|
2307
|
+
series: t,
|
|
2308
|
+
bands: h,
|
|
2309
|
+
tones: O
|
|
2310
|
+
}) : [], z = F[0]?.points ?? L[0]?.points ?? [];
|
|
2311
|
+
function B(e) {
|
|
2312
|
+
return w({
|
|
2313
|
+
timestamp: Wn(e, n),
|
|
2314
|
+
locale: E,
|
|
2315
|
+
format: r
|
|
2316
|
+
});
|
|
2317
|
+
}
|
|
2318
|
+
function V(e) {
|
|
2319
|
+
return te({
|
|
2320
|
+
value: e,
|
|
2321
|
+
locale: E,
|
|
2322
|
+
format: i
|
|
2323
|
+
});
|
|
2324
|
+
}
|
|
2325
|
+
let fe = z.map(({ timestamp: e }) => ({
|
|
2326
|
+
id: String(e),
|
|
2327
|
+
label: B(e)
|
|
2328
|
+
})), _e = `${Jt({
|
|
2329
|
+
series: t,
|
|
2330
|
+
markers: s,
|
|
2331
|
+
timestampUnit: n,
|
|
2332
|
+
isStacked: u
|
|
2333
|
+
})}${qn({
|
|
2334
|
+
bands: h,
|
|
2335
|
+
crossings: g
|
|
2336
|
+
})}`, ve = [...F.map(({ id: e, label: t, tone: n }) => ({
|
|
2337
|
+
id: e,
|
|
2338
|
+
label: t,
|
|
2339
|
+
tone: n,
|
|
2340
|
+
shape: Un[l]
|
|
2341
|
+
})), ...L.map(({ id: e, label: t, tone: n }) => ({
|
|
2342
|
+
id: e,
|
|
2343
|
+
label: t,
|
|
2344
|
+
tone: n,
|
|
2345
|
+
shape: "band"
|
|
2346
|
+
}))], H = D?.seriesValues !== void 0;
|
|
2347
|
+
if (S.status === "loading") return /* @__PURE__ */ J($n, {
|
|
2348
|
+
...S,
|
|
2349
|
+
series: t,
|
|
2350
|
+
height: c,
|
|
2351
|
+
showTimeAxis: p
|
|
2352
|
+
});
|
|
2353
|
+
if (P !== void 0) return /* @__PURE__ */ J(oe, {
|
|
2354
|
+
...S,
|
|
2355
|
+
message: P
|
|
2356
|
+
});
|
|
2357
|
+
if (z.length === 0) return /* @__PURE__ */ J(j, {
|
|
2358
|
+
...S,
|
|
2359
|
+
series: ve,
|
|
2360
|
+
children: /* @__PURE__ */ J(se, { children: x })
|
|
2361
|
+
});
|
|
2362
|
+
let U = z.map((e) => e.timestamp), Ce = pn({
|
|
2363
|
+
crossings: g,
|
|
2364
|
+
series: t,
|
|
2365
|
+
bands: h
|
|
2366
|
+
}), we = [...s.flatMap((e) => e.kind === "event" ? [e] : []), ...Ce.flatMap(({ crossing: e, timestamp: t }) => t === void 0 ? [] : [{
|
|
2367
|
+
id: e.id,
|
|
2368
|
+
timestamp: t,
|
|
2369
|
+
label: e.label,
|
|
2370
|
+
value: e.value
|
|
2371
|
+
}])];
|
|
2372
|
+
function G(e) {
|
|
2373
|
+
return {
|
|
2374
|
+
label: e === void 0 ? void 0 : B(e),
|
|
2375
|
+
rows: [...F.map((t) => {
|
|
2376
|
+
let n = t.points.find((t) => t.timestamp === e);
|
|
2377
|
+
return {
|
|
2378
|
+
id: t.id,
|
|
2379
|
+
label: t.label,
|
|
2380
|
+
tone: t.tone,
|
|
2381
|
+
value: V(n?.value ?? null)
|
|
2382
|
+
};
|
|
2383
|
+
}), ...Jn({
|
|
2384
|
+
bands: L,
|
|
2385
|
+
timestamp: e,
|
|
2386
|
+
valueText: V
|
|
2387
|
+
})],
|
|
2388
|
+
notes: [...s.filter((t) => t.kind !== "event" && t.timestamp === e).map((e) => e.label), ...we.filter((t) => mn(U, t.timestamp) === e).map((e) => `${e.label} · ${B(e.timestamp)}`)]
|
|
2389
|
+
};
|
|
2390
|
+
}
|
|
2391
|
+
let K = U[0] ?? 0, q = U.at(-1) ?? K, Te = {
|
|
2392
|
+
width: k.width,
|
|
2393
|
+
height: k.height,
|
|
2394
|
+
value: Gn({
|
|
2395
|
+
format: i,
|
|
2396
|
+
tickFormat: a,
|
|
2397
|
+
label: o
|
|
2398
|
+
}),
|
|
2399
|
+
valueDomain: Kn({
|
|
2400
|
+
series: t,
|
|
2401
|
+
isStacked: u,
|
|
2402
|
+
isZeroBased: l === "area",
|
|
2403
|
+
bands: h,
|
|
2404
|
+
crossings: g
|
|
2405
|
+
}),
|
|
2406
|
+
timeDomain: Yt(Wn(K, n), Wn(q, n)),
|
|
2407
|
+
timeFormat: r,
|
|
2408
|
+
locale: E,
|
|
2409
|
+
gutter: f,
|
|
2410
|
+
hasValueTitle: o !== void 0
|
|
2411
|
+
}, Ee = v(Te), Oe = Pn({
|
|
2412
|
+
instants: we,
|
|
2413
|
+
x: (e) => Ee.x.position(Wn(e, n)),
|
|
2414
|
+
right: Ee.box.right
|
|
2415
|
+
}), ke = v({
|
|
2416
|
+
...Te,
|
|
2417
|
+
topInset: Fn(Oe)
|
|
2418
|
+
}), { box: X } = ke;
|
|
2419
|
+
function Z(e) {
|
|
2420
|
+
return ke.x.position(Wn(e, n));
|
|
2421
|
+
}
|
|
2422
|
+
let Q = ke.y.position;
|
|
2423
|
+
function Ae(e) {
|
|
2424
|
+
return `${B(e[0])} to ${B(e[1])}`;
|
|
2425
|
+
}
|
|
2426
|
+
let je = y !== void 0 && b !== void 0 && q !== K ? {
|
|
2427
|
+
onRangeChange: y,
|
|
2428
|
+
rangeStep: b
|
|
2429
|
+
} : void 0, Me = U.map((e) => ({
|
|
2430
|
+
id: String(e),
|
|
2431
|
+
x: Z(e),
|
|
2432
|
+
y: 0
|
|
2433
|
+
}));
|
|
2434
|
+
return /* @__PURE__ */ J("div", {
|
|
2435
|
+
className: "xeuugli",
|
|
2436
|
+
children: /* @__PURE__ */ J(ee, {
|
|
2437
|
+
items: fe,
|
|
2438
|
+
readout: (e) => re(G(Number(e))),
|
|
2439
|
+
locate: Se({
|
|
2440
|
+
marks: Me,
|
|
2441
|
+
width: X.width,
|
|
2442
|
+
height: X.height,
|
|
2443
|
+
axis: "x"
|
|
2444
|
+
}),
|
|
2445
|
+
revision: _e,
|
|
2446
|
+
inspected: d?.id,
|
|
2447
|
+
onInspectedChange: d?.onChange,
|
|
2448
|
+
within: d?.within,
|
|
2449
|
+
render: (t, { inspected: r, cursor: i }) => {
|
|
2450
|
+
let a = r === null ? void 0 : Number(r), c = G(d === void 0 || d.isSource ? a : void 0), f = /* @__PURE__ */ Y(me, {
|
|
2451
|
+
plotRef: k.ref,
|
|
2452
|
+
box: X,
|
|
2453
|
+
label: m({
|
|
2454
|
+
title: T,
|
|
2455
|
+
marks: "observations",
|
|
2456
|
+
isSelectable: !1
|
|
2457
|
+
}),
|
|
2458
|
+
readoutId: A,
|
|
2459
|
+
children: [
|
|
2460
|
+
/* @__PURE__ */ J(ce, {
|
|
2461
|
+
box: X,
|
|
2462
|
+
xTicks: p ? ke.xTicks : [],
|
|
2463
|
+
yTicks: ke.yTicks,
|
|
2464
|
+
yTitle: o
|
|
2465
|
+
}),
|
|
2466
|
+
/* @__PURE__ */ Y(ge, {
|
|
2467
|
+
box: X,
|
|
2468
|
+
children: [
|
|
2469
|
+
/* @__PURE__ */ J(In, {
|
|
2470
|
+
bands: L,
|
|
2471
|
+
x: Z,
|
|
2472
|
+
y: Q
|
|
2473
|
+
}),
|
|
2474
|
+
F.map((e) => {
|
|
2475
|
+
let t = e.points.map((e) => ({
|
|
2476
|
+
x: Z(e.timestamp),
|
|
2477
|
+
y: e.value === null ? null : Q(e.value + e.base)
|
|
2478
|
+
})), n = e.points.map((e) => ({
|
|
2479
|
+
x: Z(e.timestamp),
|
|
2480
|
+
y0: e.value === null ? null : Q(e.base),
|
|
2481
|
+
y1: e.value === null ? null : Q(e.value + e.base)
|
|
2482
|
+
}));
|
|
2483
|
+
return /* @__PURE__ */ Y("g", { children: [
|
|
2484
|
+
l === "area" && /* @__PURE__ */ J(pe, {
|
|
2485
|
+
d: xe(n),
|
|
2486
|
+
tone: e.tone,
|
|
2487
|
+
isPale: !u
|
|
2488
|
+
}),
|
|
2489
|
+
/* @__PURE__ */ J(ue, {
|
|
2490
|
+
d: be(t),
|
|
2491
|
+
tone: e.tone
|
|
2492
|
+
}),
|
|
2493
|
+
ye(t).map((t) => /* @__PURE__ */ J(I, {
|
|
2494
|
+
x: t.x,
|
|
2495
|
+
y: t.y,
|
|
2496
|
+
tone: e.tone,
|
|
2497
|
+
radius: Vn
|
|
2498
|
+
}, t.x))
|
|
2499
|
+
] }, e.id);
|
|
2500
|
+
}),
|
|
2501
|
+
g.map((e) => /* @__PURE__ */ J(le, {
|
|
2502
|
+
x1: X.left,
|
|
2503
|
+
x2: X.right,
|
|
2504
|
+
y1: Q(e.value),
|
|
2505
|
+
y2: Q(e.value)
|
|
2506
|
+
}, e.id)),
|
|
2507
|
+
s.map((e) => {
|
|
2508
|
+
if (e.kind === "time") return /* @__PURE__ */ J(de, {
|
|
2509
|
+
x: Z(e.timestamp),
|
|
2510
|
+
top: X.top,
|
|
2511
|
+
bottom: X.bottom
|
|
2512
|
+
}, e.id);
|
|
2513
|
+
let t = F.find((t) => t.id === e.seriesId)?.points.find((t) => t.timestamp === e.timestamp)?.base;
|
|
2514
|
+
return e.kind === "point" ? /* @__PURE__ */ J(R, {
|
|
2515
|
+
x: Z(e.timestamp),
|
|
2516
|
+
y: Q(e.value + (t ?? 0))
|
|
2517
|
+
}, e.id) : void 0;
|
|
2518
|
+
}),
|
|
2519
|
+
a !== void 0 && /* @__PURE__ */ J(de, {
|
|
2520
|
+
x: Z(a),
|
|
2521
|
+
top: X.top,
|
|
2522
|
+
bottom: X.bottom
|
|
2523
|
+
}),
|
|
2524
|
+
a !== void 0 && F.flatMap((e) => {
|
|
2525
|
+
let t = e.points.find((e) => e.timestamp === a);
|
|
2526
|
+
return t === void 0 || t.value === null ? [] : [/* @__PURE__ */ J(I, {
|
|
2527
|
+
x: Z(t.timestamp),
|
|
2528
|
+
y: Q(t.value + t.base),
|
|
2529
|
+
tone: e.tone,
|
|
2530
|
+
isInspected: !0
|
|
2531
|
+
}, e.id)];
|
|
2532
|
+
})
|
|
2533
|
+
]
|
|
2534
|
+
}),
|
|
2535
|
+
/* @__PURE__ */ J(Ln, {
|
|
2536
|
+
placed: Oe,
|
|
2537
|
+
x: Z,
|
|
2538
|
+
y: Q,
|
|
2539
|
+
top: X.top,
|
|
2540
|
+
bottom: X.bottom
|
|
2541
|
+
}),
|
|
2542
|
+
i !== null && /* @__PURE__ */ J(ne, {
|
|
2543
|
+
x: Z(Number(i)),
|
|
2544
|
+
top: X.top,
|
|
2545
|
+
bottom: X.bottom,
|
|
2546
|
+
width: Bn
|
|
2547
|
+
})
|
|
2548
|
+
]
|
|
2549
|
+
});
|
|
2550
|
+
return /* @__PURE__ */ Y(j, {
|
|
2551
|
+
...S,
|
|
2552
|
+
figure: t,
|
|
2553
|
+
titleDetail: H ? void 0 : c.label,
|
|
2554
|
+
series: ve,
|
|
2555
|
+
seriesLegend: /* @__PURE__ */ J(M, {
|
|
2556
|
+
id: A,
|
|
2557
|
+
label: c.label,
|
|
2558
|
+
legend: ve,
|
|
2559
|
+
rows: c.rows,
|
|
2560
|
+
x: Z(a ?? K),
|
|
2561
|
+
width: X.width,
|
|
2562
|
+
notes: c.notes,
|
|
2563
|
+
hasSeriesSummary: H
|
|
2564
|
+
}),
|
|
2565
|
+
children: [/* @__PURE__ */ J(ae, {
|
|
2566
|
+
label: `${T} observations`,
|
|
2567
|
+
columns: [
|
|
2568
|
+
{
|
|
2569
|
+
id: "time",
|
|
2570
|
+
label: `Time (${n})`
|
|
2571
|
+
},
|
|
2572
|
+
...F.map((e) => ({
|
|
2573
|
+
id: `series:${e.id}`,
|
|
2574
|
+
label: e.label
|
|
2575
|
+
})),
|
|
2576
|
+
...L.flatMap((e) => [{
|
|
2577
|
+
id: `band:${e.id}`,
|
|
2578
|
+
label: e.label
|
|
2579
|
+
}, {
|
|
2580
|
+
id: `band-range:${e.id}`,
|
|
2581
|
+
label: `${e.label}: ${e.rangeLabel}`
|
|
2582
|
+
}])
|
|
2583
|
+
],
|
|
2584
|
+
rows: z.map((e, t) => ({
|
|
2585
|
+
id: e.timestamp,
|
|
2586
|
+
values: [
|
|
2587
|
+
B(e.timestamp),
|
|
2588
|
+
...F.map((e) => V(e.points[t]?.value ?? null)),
|
|
2589
|
+
...Jn({
|
|
2590
|
+
bands: L,
|
|
2591
|
+
timestamp: e.timestamp,
|
|
2592
|
+
valueText: V
|
|
2593
|
+
}).map((e) => e.value)
|
|
2594
|
+
]
|
|
2595
|
+
}))
|
|
2596
|
+
}), /* @__PURE__ */ Y("div", {
|
|
2597
|
+
className: "xrvj5dj x1n8ia3y",
|
|
2598
|
+
children: [
|
|
2599
|
+
je === void 0 ? f : /* @__PURE__ */ J(On, {
|
|
2600
|
+
value: _,
|
|
2601
|
+
onValueChange: je.onRangeChange,
|
|
2602
|
+
min: K,
|
|
2603
|
+
max: q,
|
|
2604
|
+
step: je.rangeStep,
|
|
2605
|
+
describe: Ae,
|
|
2606
|
+
label: `${T} time range`,
|
|
2607
|
+
left: Z(K),
|
|
2608
|
+
width: Z(q) - Z(K),
|
|
2609
|
+
height: X.bottom,
|
|
2610
|
+
children: f
|
|
2611
|
+
}),
|
|
2612
|
+
je !== void 0 && /* @__PURE__ */ Y("div", {
|
|
2613
|
+
className: "x78zum5 x1a02dak x6s0dn4 x1qughib x1hnptsi x153jb6y xy8obcc xas2l8k xj0a0fe",
|
|
2614
|
+
children: [/* @__PURE__ */ J("span", { children: _ === null ? "Drag on the plot with a mouse to select a range of time." : `Selected range: ${Ae(_)}` }), _ === null ? /* @__PURE__ */ J(e, {
|
|
2615
|
+
type: "button",
|
|
2616
|
+
onClick: (e) => {
|
|
2617
|
+
De({ options: () => je }, "onRangeChange", ir({
|
|
2618
|
+
first: K,
|
|
2619
|
+
last: q,
|
|
2620
|
+
step: je.rangeStep
|
|
2621
|
+
}), {
|
|
2622
|
+
reason: "trigger-press",
|
|
2623
|
+
event: e.nativeEvent
|
|
2624
|
+
});
|
|
2625
|
+
},
|
|
2626
|
+
children: "Select a range"
|
|
2627
|
+
}) : /* @__PURE__ */ J(e, {
|
|
2628
|
+
type: "button",
|
|
2629
|
+
onClick: (e) => {
|
|
2630
|
+
De({ options: () => je }, "onRangeChange", null, {
|
|
2631
|
+
reason: "clear-press",
|
|
2632
|
+
event: e.nativeEvent
|
|
2633
|
+
});
|
|
2634
|
+
},
|
|
2635
|
+
children: "Clear range"
|
|
2636
|
+
})]
|
|
2637
|
+
}),
|
|
2638
|
+
s.length + Ce.length > 0 && /* @__PURE__ */ Y("ul", {
|
|
2639
|
+
className: "x78zum5 x1a02dak x1n8ia3y x1ghz6dp x1717udv xe8uvvx xy8obcc x153jb6y xj0a0fe",
|
|
2640
|
+
children: [s.map((e) => /* @__PURE__ */ Y("li", { children: [
|
|
2641
|
+
B(e.timestamp),
|
|
2642
|
+
" · ",
|
|
2643
|
+
e.label,
|
|
2644
|
+
e.kind === "point" && ` · ${V(e.value)}`
|
|
2645
|
+
] }, e.id)), Ce.map((e) => /* @__PURE__ */ J("li", { children: Yn({
|
|
2646
|
+
found: e,
|
|
2647
|
+
timeText: B
|
|
2648
|
+
}) }, e.crossing.id))]
|
|
2649
|
+
})
|
|
2650
|
+
]
|
|
2651
|
+
})]
|
|
2652
|
+
});
|
|
2653
|
+
}
|
|
2654
|
+
})
|
|
2655
|
+
});
|
|
2656
|
+
}
|
|
2657
|
+
function rr({ range: e, rangeStep: t, isSelectable: n, timeline: r }) {
|
|
2658
|
+
let i = r[0], a = r.at(-1);
|
|
2659
|
+
if (!n || i === void 0 || a === void 0) return;
|
|
2660
|
+
let o = a - i;
|
|
2661
|
+
if (o !== 0) {
|
|
2662
|
+
if (t === void 0 || !Number.isFinite(t) || t <= 0 || t > o) return "A selectable range needs a rangeStep that is finite, positive, and no longer than the observed time.";
|
|
2663
|
+
if (e !== null && (!(e[0] >= i && e[1] <= a) || e[0] >= e[1])) return "The selected range must have ordered ends inside the observed time.";
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
function ir({ first: e, last: t, step: n }) {
|
|
2667
|
+
let r = Math.max(1, Math.round((t - e) / Hn / n)) * n, i = Math.min(e + r, t - n);
|
|
2668
|
+
return [i, Math.min(t, Math.max(i + n, t - r))];
|
|
2669
|
+
}
|
|
2670
|
+
export { Qn as a, $ as c, Pt as d, ht as f, tr as i, Vt as l, st as m, Xn as n, sn as o, dt as p, er as r, an as s, Zn as t, Ft as u };
|