import React, { useMemo, forwardRef } from "react";
import { Flex } from "@netdata/netdata-ui";
import { ChartWrapper } from "../../dashboard/components/chart-wrapper";
import { withChartProps } from "../charts";
import useDuration from "./useDuration";
export const ChartHead = ({ chart, chartAttributes, menuChartAttributes, ...rest }) => {
    const duration = useDuration(chart.update_every);
    const attributes = useMemo(() => ({
        ...menuChartAttributes,
        ...chartAttributes,
        after: -duration,
        points: duration,
    }), [chartAttributes, menuChartAttributes, duration]);
    return React.createElement(ChartWrapper, Object.assign({ attributes: attributes, chartMetadata: chart }, rest));
};
export const ChartHeadContainer = withChartProps(ChartHead);
export const ChartHeadsWrapper = forwardRef((props, ref) => (React.createElement(Flex, Object.assign({ justifyContent: "center", alignItems: "baseline", ref: ref }, props))));
export const ChartHeadsContainer = ({ ids, ...rest }) => (React.createElement(ChartHeadsWrapper, Object.assign({}, rest), ids.map(id => (React.createElement(ChartHeadContainer, { key: id, id: id })))));
//# sourceMappingURL=chartHead.js.map