import type { Datum } from "./datumTypes";
import { useChartLegendAndMargin, useLegendInteraction, DEFAULT_COLOR } from "./hooks";
import type { LegendInteractionMode, LegendPosition } from "./hooks";
import type { Accessor, SelectionConfig, LinkedHoverProp, HoverHighlightMode } from "./types";
import type { OnObservationCallback } from "../../store/ObservationStore";
import type { PartialMargin } from "../../types/marginType";
import type { SelectionHookResult } from "./selectionUtils";
import type { ReactElement, ReactNode } from "react";
/**
 * Input parameters for useChartSetup.
 *
 * This hook consolidates the color scale, category extraction, legend interaction,
 * effective selection merge, legend + margin computation, loading/empty guards,
 * and legend behavior props that every HOC chart repeats.
 */
export interface ChartSetupInput {
    /** The data array used for color scale and category extraction */
    data: Array<Datum>;
    /** The original data prop (may be undefined) — used for empty-state check */
    rawData: unknown[] | undefined;
    /** The color-by accessor (may be an "actual" colorBy derived from stackBy/groupBy/categoryAccessor) */
    colorBy: Accessor<string> | undefined;
    /** Color scheme name or custom array — undefined lets useColorScale consult the theme */
    colorScheme: string | string[] | undefined;
    /** Legend interaction mode */
    legendInteraction: LegendInteractionMode | undefined;
    /** Legend position override */
    legendPosition?: LegendPosition;
    /** Selection config from the HOC */
    selection: SelectionConfig | undefined;
    /** Linked hover config from the HOC */
    linkedHover: LinkedHoverProp | undefined;
    /** Fallback fields for selection/hover — typically derived from colorBy or categoryAccessor */
    fallbackFields: string[];
    /** Whether to unwrap data in hover callback (ordinal/network = true, XY = false) */
    unwrapData?: boolean;
    /** onObservation callback */
    onObservation: OnObservationCallback | undefined;
    /** Chart type name (e.g. "BarChart") */
    chartType: string;
    /** Chart ID for observation events */
    chartId: string | undefined;
    /** Show legend override */
    showLegend: boolean | undefined;
    /** User-provided margin */
    userMargin: PartialMargin | undefined;
    /** Mode-resolved margin defaults */
    marginDefaults: {
        top: number;
        bottom: number;
        left: number;
        right: number;
    };
    /** onClick callback */
    onClick?: (datum: any, event: {
        x: number;
        y: number;
    }) => void;
    /** Dim non-hovered series on data mark hover */
    hoverHighlight?: HoverHighlightMode;
    /** Loading state */
    loading: boolean | undefined;
    /** Custom content rendered in place of the default skeleton while `loading` is true. */
    loadingContent?: ReactNode | false;
    /** Empty content override */
    emptyContent?: ReactNode;
    /** Resolved width from useChartMode */
    width: number;
    /** Resolved height from useChartMode */
    height: number;
}
/**
 * Output from useChartSetup.
 */
export interface ChartSetupResult {
    /**
     * The input `data` array with `null`/non-object entries removed. Use
     * this in place of the raw `data` prop when forwarding to the frame
     * or doing any per-row iteration in the HOC body — it is identity-
     * equal to the original prop when nothing was dropped, so consumer
     * memo cache hits are preserved in the common case.
     */
    data: Array<Datum>;
    /** Color scale function, or undefined if no colorBy */
    colorScale: ((v: string) => string) | undefined;
    /** All unique category values from colorBy */
    allCategories: string[];
    /** Legend interaction state (onLegendHover, onLegendClick, highlighted, isolated) */
    legendState: ReturnType<typeof useLegendInteraction>;
    /** The effective selection hook — legend selection takes priority over cross-chart selection */
    effectiveSelectionHook: SelectionHookResult | null;
    /** The active cross-chart selection hook (before legend merge) */
    activeSelectionHook: SelectionHookResult | null;
    /** Custom hover behavior callback for the frame */
    customHoverBehavior: (d: Datum | null) => void;
    /** Custom click behavior callback for the frame */
    customClickBehavior: (d: Datum | null) => void;
    /** Legend config (or undefined if no legend) */
    legend: ReturnType<typeof useChartLegendAndMargin>["legend"];
    /** Computed margin with legend-aware adjustments */
    margin: {
        top: number;
        bottom: number;
        left: number;
        right: number;
    };
    /** Resolved legend position */
    legendPosition: LegendPosition;
    /** If non-null, the HOC should return this element (loading or empty state) */
    earlyReturn: ReactElement | null;
    /** Props to spread into the stream frame for legend behavior */
    legendBehaviorProps: Datum;
    /** Crosshair props to spread into StreamXYFrame when linkedHover mode is "x-position" */
    crosshairProps: {
        linkedCrosshairName: string;
        linkedCrosshairSourceId: string;
    } | undefined;
    /**
     * Selection config merged with theme-level defaults. HOCs should pass this
     * to `wrapStyleWithSelection` instead of the raw `selection` prop so that
     * the current theme's `colors.selectionOpacity` becomes the effective
     * unselected-opacity fallback. Per-chart `selection.unselectedOpacity`
     * still takes priority over the theme value.
     */
    resolvedSelection: SelectionConfig | undefined;
}
/**
 * Hook that consolidates the shared boilerplate across all HOC charts:
 *
 * 1. Loading / empty state guards
 * 2. useChartSelection (selection + linked hover)
 * 3. useColorScale
 * 4. allCategories extraction via useMemo
 * 5. useLegendInteraction
 * 6. effectiveSelectionHook merge (legend selection > cross-chart selection)
 * 7. useChartLegendAndMargin
 * 8. legendBehaviorProps for the stream frame
 *
 * Hooks are always called (no conditional returns before hooks) to satisfy React's
 * rules of hooks. The `earlyReturn` field signals that the HOC should return early.
 */
export declare function useChartSetup(input: ChartSetupInput): ChartSetupResult;
export { DEFAULT_COLOR };
