import { Fragment, jsx, jsxs } from "react/jsx-runtime";
import Add from "@mui/icons-material/Add";
import FitScreen from "@mui/icons-material/FitScreen";
import Remove from "@mui/icons-material/Remove";
import { IconButton, Paper, Popper } from "@mui/material";
import { styled } from "@mui/material/styles";
import apollo_core from "@uipath/apollo-core";
import { sankey, sankeyCenter, sankeyJustify, sankeyLeft, sankeyLinkHorizontal, sankeyRight } from "d3-sankey";
import { schemeTableau10 } from "d3-scale-chromatic";
import { select as external_d3_selection_select } from "d3-selection";
import { zoom, zoomIdentity } from "d3-zoom";
import react, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
const SankeyContainer = styled('div')({
    position: 'relative',
    overflow: 'hidden',
    fontFamily: apollo_core.FontFamily.FontNormal,
    width: '100%',
    height: '600px',
    '& svg': {
        display: 'block'
    }
});
const StyledSankeyNode = styled('rect')({
    transition: 'opacity 0.2s',
    cursor: 'pointer',
    '&:hover': {
        opacity: 0.8
    }
});
const StyledSankeyLink = styled('path')({
    transition: 'opacity 0.2s',
    mixBlendMode: 'normal',
    cursor: 'pointer',
    '&:hover': {
        opacity: 1
    }
});
const LABEL_FONT_SIZE = apollo_core.FontVariantToken.fontSizeL;
const LABEL_FONT_FAMILY = apollo_core.FontFamily.FontNormal;
const LABEL_CSS_FONT = `${apollo_core.Typography.fontSizeL.fontWeight} ${apollo_core.Typography.fontSizeL.fontSize} ${LABEL_FONT_FAMILY}`;
const StyledSankeyNodeLabel = styled('text')({
    fontSize: LABEL_FONT_SIZE,
    fontFamily: LABEL_FONT_FAMILY,
    fill: 'var(--color-foreground-emp)',
    pointerEvents: 'auto',
    userSelect: 'none',
    cursor: 'default'
});
const StyledSankeyNodeValue = styled('text')({
    fontSize: LABEL_FONT_SIZE,
    fontFamily: LABEL_FONT_FAMILY,
    fontWeight: apollo_core.FontFamily.FontWeightMedium,
    fill: 'var(--color-foreground-emp)',
    pointerEvents: 'auto',
    userSelect: 'none',
    cursor: 'default'
});
const LinkTooltipContent = styled(Paper)({
    backgroundColor: 'var(--color-background)',
    border: '1px solid var(--color-border)',
    borderRadius: apollo_core.Border.BorderRadiusM,
    padding: apollo_core.Spacing.SpacingM,
    minWidth: '200px',
    pointerEvents: 'none'
});
const TooltipRow = styled('div')({
    display: 'flex',
    justifyContent: 'space-between',
    padding: `${apollo_core.Spacing.SpacingXs} 0`,
    fontSize: apollo_core.FontVariantToken.fontSizeS,
    '&:not(:last-child)': {
        borderBottom: '1px solid var(--color-border)'
    }
});
const TooltipHeader = styled('span')({
    fontSize: apollo_core.FontVariantToken.fontSizeM,
    fontWeight: apollo_core.FontFamily.FontWeightSemibold,
    color: 'var(--color-foreground-emp)'
});
const TooltipLabel = styled('span')({
    color: 'var(--color-foreground-de-emp)',
    marginRight: apollo_core.Spacing.SpacingM
});
const TooltipValue = styled('span')({
    color: 'var(--color-foreground-emp)',
    fontWeight: apollo_core.FontFamily.FontWeightSemibold
});
const ZoomControls = styled('div')({
    position: 'absolute',
    bottom: apollo_core.Spacing.SpacingM,
    right: apollo_core.Spacing.SpacingM,
    display: 'flex',
    gap: '1px',
    backgroundColor: apollo_core.Colors.ColorGray100,
    borderRadius: apollo_core.Border.BorderRadiusM,
    overflow: 'hidden',
    boxShadow: apollo_core.Shadow.ShadowDp2
});
const DIAGRAM_MARGIN_LEFT = 5;
const DIAGRAM_MARGIN_RIGHT = 120;
const DIAGRAM_MARGIN_TOP = 5;
const DIAGRAM_MARGIN_BOTTOM = 40;
const ZOOM_SCALE_EXTENT_MIN = 0.5;
const ZOOM_SCALE_EXTENT_MAX = 2;
function computeSankeyDimensions(data, nodePadding, minNodeHeight, minColumnWidth, marginLeft, marginRight, marginTop, marginBottom) {
    if (!data || 0 === data.nodes.length) return {
        minWidth: 0,
        minHeight: 0
    };
    const outgoing = new Map();
    const incoming = new Map();
    for (const node of data.nodes){
        outgoing.set(node.id, []);
        incoming.set(node.id, []);
    }
    for (const link of data.links){
        outgoing.get(link.source)?.push(link.target);
        incoming.get(link.target)?.push(link.source);
    }
    const depth = new Map();
    const sources = data.nodes.filter((n)=>(incoming.get(n.id)?.length ?? 0) === 0);
    const queue = [];
    for (const s of sources){
        depth.set(s.id, 0);
        queue.push(s.id);
    }
    const maxIterations = data.nodes.length * data.links.length + data.nodes.length;
    let iterations = 0;
    while(queue.length > 0 && iterations++ < maxIterations){
        const id = queue.shift();
        const d = depth.get(id);
        for (const target of outgoing.get(id) ?? [])if (!depth.has(target) || depth.get(target) < d + 1) {
            depth.set(target, d + 1);
            queue.push(target);
        }
    }
    const columnCounts = new Map();
    for (const d of depth.values())columnCounts.set(d, (columnCounts.get(d) ?? 0) + 1);
    const columnCount = columnCounts.size;
    const maxNodesPerColumn = Math.max(0, ...columnCounts.values());
    const minWidth = columnCount * minColumnWidth + marginLeft + marginRight;
    const minHeight = maxNodesPerColumn * (minNodeHeight + nodePadding) - nodePadding + marginTop + marginBottom;
    return {
        minWidth,
        minHeight
    };
}
const truncateToFit = (text, maxWidth, ctx)=>{
    if (maxWidth <= 0) return '';
    if (ctx.measureText(text).width <= maxWidth) return text;
    const ellipsis = '\u2026';
    let lo = 0;
    let hi = text.length;
    while(lo < hi){
        const mid = Math.ceil((lo + hi) / 2);
        if (ctx.measureText(text.substring(0, mid) + ellipsis).width <= maxWidth) lo = mid;
        else hi = mid - 1;
    }
    return 0 === lo ? ellipsis : text.substring(0, lo) + ellipsis;
};
const ApSankeyDiagram = /*#__PURE__*/ react.forwardRef((props, ref)=>{
    const { data, nodeAlignment = 'justify', nodePadding = 16, nodeWidth = 24, style, className, colorScheme = schemeTableau10, ariaLabel = 'Sankey diagram', onLinkClick, onNodeClick, minNodeHeight = 36, minColumnWidth = 140 } = props;
    const containerRef = useRef(null);
    const svgRef = useRef(null);
    const zoomGroupRef = useRef(null);
    const zoomBehaviorRef = useRef(null);
    const zoomTransformRef = useRef(zoomIdentity);
    const hasUserZoomedRef = useRef(false);
    const [containerWidth, setContainerWidth] = useState(0);
    const [containerHeight, setContainerHeight] = useState(0);
    const [selectedLinkIndex, setSelectedLinkIndex] = useState(null);
    const [hoveredNodeId, setHoveredNodeId] = useState(null);
    const [anchorEl, setAnchorEl] = useState(null);
    useImperativeHandle(ref, ()=>containerRef.current);
    useEffect(()=>{
        if (containerRef.current) {
            const resizeObserver = new ResizeObserver((entries)=>{
                const entry = entries[0];
                if (entry) {
                    setContainerWidth(entry.contentRect.width);
                    setContainerHeight(entry.contentRect.height);
                }
            });
            resizeObserver.observe(containerRef.current);
            return ()=>resizeObserver.disconnect();
        }
    }, []);
    const actualWidth = containerWidth || 1200;
    const actualHeight = containerHeight || 600;
    const { minWidth, minHeight } = useMemo(()=>{
        if (!data || 0 === data.nodes.length) return {
            minWidth: 0,
            minHeight: 0
        };
        return computeSankeyDimensions(data, nodePadding, minNodeHeight, minColumnWidth, DIAGRAM_MARGIN_LEFT, DIAGRAM_MARGIN_RIGHT, DIAGRAM_MARGIN_TOP, DIAGRAM_MARGIN_BOTTOM);
    }, [
        data,
        nodePadding,
        minNodeHeight,
        minColumnWidth
    ]);
    const svgWidth = Math.max(actualWidth, minWidth);
    const svgHeight = Math.max(actualHeight, minHeight);
    const nodeColorMap = useMemo(()=>{
        const map = new Map();
        if (!data) return map;
        data.nodes.forEach((node, index)=>{
            const color = node.color || colorScheme[index % colorScheme.length];
            map.set(node.id, color || apollo_core.Colors.ColorGray500);
        });
        return map;
    }, [
        data,
        colorScheme
    ]);
    const sankeyGraph = useMemo(()=>{
        if (!data || 0 === data.nodes.length) return null;
        const alignmentFn = 'left' === nodeAlignment ? sankeyLeft : 'right' === nodeAlignment ? sankeyRight : 'center' === nodeAlignment ? sankeyCenter : sankeyJustify;
        const sankeyGenerator = sankey().nodeId((d)=>d.id).nodeAlign(alignmentFn).nodeWidth(nodeWidth).nodePadding(nodePadding).extent([
            [
                DIAGRAM_MARGIN_LEFT,
                DIAGRAM_MARGIN_TOP
            ],
            [
                svgWidth - DIAGRAM_MARGIN_RIGHT,
                svgHeight - DIAGRAM_MARGIN_BOTTOM
            ]
        ]);
        const graph = {
            nodes: data.nodes.map((node)=>({
                    ...node
                })),
            links: data.links.map((link)=>({
                    ...link
                }))
        };
        return sankeyGenerator(graph);
    }, [
        data,
        nodeAlignment,
        nodeWidth,
        nodePadding,
        svgWidth,
        svgHeight
    ]);
    const linkPaths = useMemo(()=>{
        if (!sankeyGraph) return [];
        const linkPathGenerator = sankeyLinkHorizontal();
        return sankeyGraph.links.map((link, index)=>{
            const sourceNode = link.source;
            const targetNode = link.target;
            const sourceColor = nodeColorMap.get(sourceNode.id) || colorScheme[0] || apollo_core.Colors.ColorGray500;
            const targetColor = nodeColorMap.get(targetNode.id) || colorScheme[1] || apollo_core.Colors.ColorGray500;
            const sourceX = sourceNode.x1 || 0;
            const targetX = targetNode.x0 || 0;
            const sourceY = link.y0 || 0;
            const targetY = link.y1 || 0;
            const centerX = (sourceX + targetX) / 2;
            const centerY = (sourceY + targetY) / 2;
            const originalLink = {
                source: sourceNode.id,
                target: targetNode.id,
                value: link.value,
                color: link.color,
                metadata: link.metadata
            };
            return {
                path: linkPathGenerator(link) || '',
                strokeWidth: Math.max(1, link.width || 0),
                color: link.color,
                sourceColor,
                targetColor,
                gradientId: `sankey-gradient-${index}`,
                originalLink,
                sourceId: sourceNode.id,
                targetId: targetNode.id,
                sourceLabel: sourceNode.label,
                targetLabel: targetNode.label,
                sourceX,
                targetX,
                centerX,
                centerY
            };
        });
    }, [
        sankeyGraph,
        nodeColorMap,
        colorScheme
    ]);
    const nodeData = useMemo(()=>{
        if (!sankeyGraph) return [];
        const labelPad = parseInt(apollo_core.Spacing.SpacingXs, 10);
        const ctx = "u" > typeof document ? document.createElement('canvas').getContext('2d') : null;
        if (ctx) ctx.font = LABEL_CSS_FONT;
        const columnSet = new Map();
        for (const n of sankeyGraph.nodes){
            const ext = n;
            const x0 = ext.x0 || 0;
            const x1 = ext.x1 || 0;
            if (!columnSet.has(x0)) columnSet.set(x0, x1);
        }
        const columns = Array.from(columnSet.entries()).map(([x0, x1])=>({
                x0,
                x1
            })).sort((a, b)=>a.x0 - b.x0);
        return sankeyGraph.nodes.map((node, index)=>{
            const extNode = node;
            const x0 = extNode.x0 || 0;
            const x1 = extNode.x1 || 0;
            const y0 = extNode.y0 || 0;
            const y1 = extNode.y1 || 0;
            const colIndex = columns.findIndex((col)=>col.x0 === x0);
            const nextCol = columns[colIndex + 1];
            const displayLabel = nextCol && ctx ? truncateToFit(extNode.label, Math.max(0, nextCol.x0 - x1 - labelPad), ctx) : extNode.label;
            return {
                node: extNode,
                x: x0,
                y: y0,
                width: x1 - x0,
                height: y1 - y0,
                color: nodeColorMap.get(extNode.id) || colorScheme[index % colorScheme.length],
                labelX: x1 + labelPad,
                labelY: (y0 + y1) / 2,
                labelAnchor: 'start',
                value: extNode.value || 0,
                displayLabel,
                fullLabel: extNode.label
            };
        });
    }, [
        sankeyGraph,
        nodeColorMap,
        colorScheme
    ]);
    const fitToView = useCallback(()=>{
        const svg = svgRef.current;
        const zoomBehavior = zoomBehaviorRef.current;
        if (!svg || !zoomBehavior || 0 === svgWidth || 0 === svgHeight) return;
        hasUserZoomedRef.current = false;
        const cw = containerWidth || 1;
        const ch = containerHeight || 1;
        const scale = 0.95 * Math.min(cw / svgWidth, ch / svgHeight);
        const tx = (cw - svgWidth * scale) / 2;
        const ty = (ch - svgHeight * scale) / 2;
        const t = zoomIdentity.translate(tx, ty).scale(scale);
        external_d3_selection_select(svg).transition().duration(300).call(zoomBehavior.transform, t);
    }, [
        containerWidth,
        containerHeight,
        svgWidth,
        svgHeight
    ]);
    useEffect(()=>{
        const svg = svgRef.current;
        const zoomGroup = zoomGroupRef.current;
        if (!svg || !zoomGroup) return;
        const zoomBehavior = zoom().scaleExtent([
            ZOOM_SCALE_EXTENT_MIN,
            ZOOM_SCALE_EXTENT_MAX
        ]).filter((event)=>{
            if ('wheel' === event.type) return event.ctrlKey || event.metaKey;
            return !event.button;
        }).on('zoom', (event)=>{
            const t = event.transform;
            zoomTransformRef.current = t;
            zoomGroup.setAttribute('transform', `translate(${t.x},${t.y}) scale(${t.k})`);
            if (event.sourceEvent) hasUserZoomedRef.current = true;
        });
        zoomBehaviorRef.current = zoomBehavior;
        external_d3_selection_select(svg).call(zoomBehavior);
        return ()=>{
            external_d3_selection_select(svg).on('.zoom', null);
            zoomBehaviorRef.current = null;
        };
    }, []);
    useEffect(()=>{
        if (!sankeyGraph || 0 === containerWidth || 0 === containerHeight) return;
        if (hasUserZoomedRef.current) return;
        fitToView();
    }, [
        sankeyGraph,
        containerWidth,
        containerHeight,
        fitToView
    ]);
    const handleZoomIn = useCallback(()=>{
        const svg = svgRef.current;
        const zoomBehavior = zoomBehaviorRef.current;
        if (!svg || !zoomBehavior) return;
        external_d3_selection_select(svg).transition().duration(200).call(zoomBehavior.scaleBy, 1.3);
    }, []);
    const handleZoomOut = useCallback(()=>{
        const svg = svgRef.current;
        const zoomBehavior = zoomBehaviorRef.current;
        if (!svg || !zoomBehavior) return;
        external_d3_selection_select(svg).transition().duration(200).call(zoomBehavior.scaleBy, 1 / 1.3);
    }, []);
    const handleLinkMouseEnter = useCallback((index, centerX, centerY)=>{
        if (selectedLinkIndex === index) return;
        const svgRect = svgRef.current?.getBoundingClientRect();
        if (svgRect) {
            const t = zoomTransformRef.current;
            const screenX = svgRect.left + centerX * t.k + t.x;
            const screenY = svgRect.top + centerY * t.k + t.y;
            const virtualAnchor = {
                getBoundingClientRect: ()=>({
                        x: screenX,
                        y: screenY,
                        left: screenX,
                        top: screenY,
                        right: screenX,
                        bottom: screenY,
                        width: 0,
                        height: 0,
                        toJSON: ()=>{}
                    })
            };
            setAnchorEl(virtualAnchor);
        }
        setSelectedLinkIndex(index);
    }, [
        selectedLinkIndex
    ]);
    const handleLinkMouseLeave = useCallback(()=>{
        setSelectedLinkIndex(null);
        setAnchorEl(null);
    }, []);
    const handleNodeMouseEnter = useCallback((nodeId)=>{
        setHoveredNodeId(nodeId);
    }, []);
    const handleNodeMouseLeave = useCallback(()=>{
        setHoveredNodeId(null);
    }, []);
    const connectedLinkIndices = useMemo(()=>{
        if (!hoveredNodeId) return new Set();
        const indices = new Set();
        linkPaths.forEach((linkData, index)=>{
            if (linkData.sourceId === hoveredNodeId || linkData.targetId === hoveredNodeId) indices.add(index);
        });
        return indices;
    }, [
        hoveredNodeId,
        linkPaths
    ]);
    return /*#__PURE__*/ jsxs(SankeyContainer, {
        ref: containerRef,
        style: style,
        className: className,
        role: "figure",
        "aria-label": ariaLabel,
        children: [
            /*#__PURE__*/ jsx("svg", {
                ref: svgRef,
                width: svgWidth,
                height: svgHeight,
                children: /*#__PURE__*/ jsxs("g", {
                    ref: zoomGroupRef,
                    children: [
                        /*#__PURE__*/ jsx("defs", {
                            children: linkPaths.map((linkData)=>/*#__PURE__*/ jsxs("linearGradient", {
                                    id: linkData.gradientId,
                                    gradientUnits: "userSpaceOnUse",
                                    x1: linkData.sourceX,
                                    y1: 0,
                                    x2: linkData.targetX,
                                    y2: 0,
                                    children: [
                                        /*#__PURE__*/ jsx("stop", {
                                            offset: "0%",
                                            stopColor: linkData.sourceColor
                                        }),
                                        /*#__PURE__*/ jsx("stop", {
                                            offset: "100%",
                                            stopColor: linkData.targetColor
                                        })
                                    ]
                                }, linkData.gradientId))
                        }),
                        /*#__PURE__*/ jsx("g", {
                            children: linkPaths.map((linkData, index)=>{
                                const isConnectedToHoveredNode = connectedLinkIndices.has(index);
                                let opacity = 0.6;
                                if (selectedLinkIndex === index) opacity = 1;
                                else if (hoveredNodeId) opacity = isConnectedToHoveredNode ? 1 : 0.3;
                                return /*#__PURE__*/ jsx(StyledSankeyLink, {
                                    d: linkData.path,
                                    stroke: linkData.color ? linkData.color : `url(#${linkData.gradientId})`,
                                    strokeWidth: linkData.strokeWidth,
                                    fill: "none",
                                    opacity: opacity,
                                    onMouseEnter: ()=>handleLinkMouseEnter(index, linkData.centerX, linkData.centerY),
                                    onMouseLeave: handleLinkMouseLeave,
                                    onClick: (e)=>onLinkClick?.(linkData.originalLink, e),
                                    "aria-label": `Link from ${linkData.sourceLabel} to ${linkData.targetLabel}`
                                }, `link-${index}`);
                            })
                        }),
                        /*#__PURE__*/ jsx("g", {
                            children: nodeData.map((nodeItem)=>{
                                const nodeOpacity = hoveredNodeId ? hoveredNodeId === nodeItem.node.id ? 1 : 0.4 : 1;
                                return /*#__PURE__*/ jsxs("g", {
                                    children: [
                                        /*#__PURE__*/ jsx(StyledSankeyNode, {
                                            x: nodeItem.x,
                                            y: nodeItem.y,
                                            width: nodeItem.width,
                                            height: nodeItem.height,
                                            fill: nodeItem.color,
                                            opacity: nodeOpacity,
                                            onMouseEnter: ()=>handleNodeMouseEnter(nodeItem.node.id),
                                            onMouseLeave: handleNodeMouseLeave,
                                            onClick: (e)=>onNodeClick?.(nodeItem.node, e)
                                        }),
                                        /*#__PURE__*/ jsxs(StyledSankeyNodeLabel, {
                                            x: nodeItem.labelX,
                                            y: nodeItem.labelY,
                                            dy: "0.35em",
                                            textAnchor: nodeItem.labelAnchor,
                                            children: [
                                                /*#__PURE__*/ jsx("title", {
                                                    children: nodeItem.fullLabel
                                                }),
                                                nodeItem.displayLabel
                                            ]
                                        }),
                                        nodeItem.value > 0 && /*#__PURE__*/ jsx(StyledSankeyNodeValue, {
                                            x: nodeItem.labelX,
                                            y: nodeItem.labelY + parseInt(apollo_core.Spacing.SpacingM, 10),
                                            dy: "0.35em",
                                            textAnchor: nodeItem.labelAnchor,
                                            children: nodeItem.value
                                        })
                                    ]
                                }, `node-${nodeItem.node.id}`);
                            })
                        })
                    ]
                })
            }),
            /*#__PURE__*/ jsxs(ZoomControls, {
                children: [
                    /*#__PURE__*/ jsx(IconButton, {
                        size: "small",
                        onClick: handleZoomIn,
                        "aria-label": "Zoom in",
                        children: /*#__PURE__*/ jsx(Add, {
                            fontSize: "small"
                        })
                    }),
                    /*#__PURE__*/ jsx(IconButton, {
                        size: "small",
                        onClick: handleZoomOut,
                        "aria-label": "Zoom out",
                        children: /*#__PURE__*/ jsx(Remove, {
                            fontSize: "small"
                        })
                    }),
                    /*#__PURE__*/ jsx(IconButton, {
                        size: "small",
                        onClick: fitToView,
                        "aria-label": "Fit to view",
                        children: /*#__PURE__*/ jsx(FitScreen, {
                            fontSize: "small"
                        })
                    })
                ]
            }),
            /*#__PURE__*/ jsx(Popper, {
                open: null !== selectedLinkIndex && null !== anchorEl,
                anchorEl: anchorEl,
                placement: "top",
                style: {
                    pointerEvents: 'none'
                },
                modifiers: [
                    {
                        name: 'flip',
                        enabled: true,
                        options: {
                            fallbackPlacements: [
                                'bottom',
                                'top',
                                'left',
                                'right'
                            ]
                        }
                    },
                    {
                        name: 'preventOverflow',
                        enabled: true,
                        options: {
                            boundary: containerRef.current || 'clippingParents',
                            padding: 8
                        }
                    },
                    {
                        name: 'offset',
                        options: {
                            offset: [
                                0,
                                8
                            ]
                        }
                    }
                ],
                children: null !== selectedLinkIndex && linkPaths[selectedLinkIndex] && /*#__PURE__*/ jsx(LinkTooltipContent, {
                    elevation: 3,
                    children: (()=>{
                        const linkPath = linkPaths[selectedLinkIndex];
                        const link = linkPath.originalLink;
                        const metadata = link.metadata || {};
                        return /*#__PURE__*/ jsxs(Fragment, {
                            children: [
                                /*#__PURE__*/ jsx(TooltipRow, {
                                    children: /*#__PURE__*/ jsxs(TooltipHeader, {
                                        children: [
                                            linkPath.sourceLabel,
                                            " → ",
                                            linkPath.targetLabel
                                        ]
                                    })
                                }),
                                Object.entries(metadata).map(([key, value])=>/*#__PURE__*/ jsxs(TooltipRow, {
                                        children: [
                                            /*#__PURE__*/ jsx(TooltipLabel, {
                                                children: key
                                            }),
                                            /*#__PURE__*/ jsx(TooltipValue, {
                                                children: String(value)
                                            })
                                        ]
                                    }, key)),
                                0 === Object.keys(metadata).length && /*#__PURE__*/ jsxs(TooltipRow, {
                                    children: [
                                        /*#__PURE__*/ jsx(TooltipLabel, {
                                            children: "Value"
                                        }),
                                        /*#__PURE__*/ jsx(TooltipValue, {
                                            children: link.value
                                        })
                                    ]
                                })
                            ]
                        });
                    })()
                })
            })
        ]
    });
});
ApSankeyDiagram.displayName = 'ApSankeyDiagram';
export { ApSankeyDiagram, computeSankeyDimensions };
