import type { ReactNode, ReactElement } from "react";
import type { Datum } from "./datumTypes";
import type { Accessor, ChartAccessor, SelectionConfig, LinkedHoverProp } from "./types";
import type { OnObservationCallback } from "../../store/ObservationStore";
import type { PartialMargin, MarginType } from "../../types/marginType";
import { useChartSelection, useChartLegendAndMargin } from "./hooks";
import type { LegendInteractionMode, LegendPosition, LegendInteractionState } from "./hooks";
export interface NetworkChartSetupInput<TNode extends Datum = Datum, TEdge extends Datum = Datum> {
    /** Raw `nodes` prop (may be undefined). */
    nodes: TNode[] | undefined;
    /** Raw `edges` prop (may be undefined). */
    edges: TEdge[] | undefined;
    /**
     * When `true`, missing nodes are inferred from edge endpoints via
     * `inferNodesFromEdges`. Sankey/Chord set this; ForceDirected leaves
     * it `false` and treats both as required. Default: `true`.
     */
    inferNodes?: boolean;
    /** Node id accessor for inference + tooltip identity. */
    nodeIdAccessor?: ChartAccessor<TNode, string>;
    /** Edge source accessor (used by `inferNodesFromEdges`). */
    sourceAccessor?: ChartAccessor<TEdge, string>;
    /** Edge target accessor (used by `inferNodesFromEdges`). */
    targetAccessor?: ChartAccessor<TEdge, string>;
    colorBy?: Accessor<string>;
    colorScheme?: string | string[];
    /** `undefined` defaults to "auto" (on when colorBy is set). */
    showLegend?: boolean;
    legendPosition?: LegendPosition;
    legendInteraction?: LegendInteractionMode;
    selection?: SelectionConfig;
    linkedHover?: LinkedHoverProp;
    onObservation?: OnObservationCallback;
    onClick?: (datum: Datum, event: {
        x: number;
        y: number;
    }) => void;
    /** Used by useChartSelection for chart-type-stamped observation events. */
    chartType: string;
    chartId?: string;
    /** Mode-resolved margin defaults from useChartMode. */
    marginDefaults: MarginType;
    /** User-provided margin override. */
    userMargin?: PartialMargin;
    width: number;
    height: number;
    loading?: boolean;
    /** Custom content rendered in place of the default skeleton while `loading` is true. */
    loadingContent?: ReactNode | false;
    emptyContent?: ReactNode | false;
    /**
     * Which array drives the empty-state check. `"edges"` (default)
     * fits Sankey/Chord/ProcessSankey where edges are the primary
     * data shape and nodes are optional/inferred. `"nodes"` fits
     * ForceDirectedGraph where both nodes and edges are required and
     * empty-state should fire when the user supplied a sparse-only
     * node list. The undefined-vs-empty distinction is preserved
     * either way: undefined = push mode (don't show empty UI);
     * present-but-empty = user supplied empty data (show empty UI).
     */
    emptyDataKey?: "edges" | "nodes";
}
export interface NetworkChartSetupResult {
    /**
     * Sparse-filtered nodes. When `inferNodes` was `true` and the
     * caller didn't supply nodes, this is the inferred `[{id}]` array
     * derived from edge endpoints. Otherwise it's just the input
     * `nodes` with sparse holes removed.
     */
    safeNodes: Datum[];
    /** Sparse-filtered edges. Identity-equal to input when nothing was dropped. */
    safeEdges: Datum[];
    /**
     * Color scale built from `(safeNodes, colorBy, colorScheme)`.
     * `undefined` when colorBy is unset.
     */
    colorScale: ((v: string) => string) | undefined;
    /**
     * Effective palette array. Resolved as:
     * 1. `colorScheme` if it's an array.
     * 2. ThemeProvider categorical if non-empty.
     * 3. Named scheme lookup in `COLOR_SCHEMES`.
     * 4. `DEFAULT_COLORS` fallback.
     *
     * Pass this to the frame's `colorScheme` prop so its internal
     * `getNodeColor` (used for particles, hover, interactions) matches
     * what the HOC's nodeStyle resolves.
     */
    effectivePalette: string[];
    themeCategorical: string[] | undefined;
    /** Distinct category values from `(safeNodes, colorBy)`, for legend interaction. */
    allCategories: string[];
    legendState: LegendInteractionState;
    legend: ReturnType<typeof useChartLegendAndMargin>["legend"];
    margin: MarginType;
    legendPosition: LegendPosition;
    customHoverBehavior: ReturnType<typeof useChartSelection>["customHoverBehavior"];
    customClickBehavior: ReturnType<typeof useChartSelection>["customClickBehavior"];
    /**
     * The full selection-hook output. Most network HOCs only need the
     * resolved hover/click behaviors above, but hierarchy charts
     * (Treemap, CirclePack, TreeDiagram, OrbitDiagram) wrap node styles
     * with selection state via `activeSelectionHook.isActive` /
     * `.predicate`. Passed through verbatim so those charts don't need
     * a parallel `useChartSelection` call.
     */
    activeSelectionHook: ReturnType<typeof useChartSelection>["activeSelectionHook"];
    hoverSelectionHook: ReturnType<typeof useChartSelection>["hoverSelectionHook"];
    crosshairSourceId: ReturnType<typeof useChartSelection>["crosshairSourceId"];
    /** When non-null, render this element instead of the chart. */
    loadingEl: ReactElement | null;
    /** When non-null, render this element instead of the chart. */
    emptyEl: ReactElement | null;
}
/**
 * Run the consolidated network-HOC setup pipeline. Call this once
 * after `useChartMode` and before any chart-specific logic. The
 * returned `loadingEl`/`emptyEl` are early-exit slots — when either
 * is non-null, return it before the frame.
 *
 * @example
 * ```tsx
 * const setup = useNetworkChartSetup({
 *   nodes, edges,
 *   inferNodes: true,
 *   nodeIdAccessor, sourceAccessor, targetAccessor,
 *   colorBy, colorScheme, showLegend, legendPosition, legendInteraction,
 *   selection, linkedHover, onObservation, onClick,
 *   chartType: "SankeyDiagram", chartId,
 *   marginDefaults, userMargin, width, height,
 *   loading, emptyContent,
 * })
 * if (setup.loadingEl) return setup.loadingEl
 * if (setup.emptyEl) return setup.emptyEl
 * return (
 *   <StreamNetworkFrame
 *     nodes={setup.safeNodes}
 *     edges={setup.safeEdges}
 *     colorScheme={setup.effectivePalette}
 *     legend={setup.legend}
 *     legendPosition={setup.legendPosition}
 *     margin={setup.margin}
 *     customHoverBehavior={setup.customHoverBehavior}
 *     customClickBehavior={setup.customClickBehavior}
 *     ...
 *   />
 * )
 * ```
 */
export declare function useNetworkChartSetup<TNode extends Datum = Datum, TEdge extends Datum = Datum>(input: NetworkChartSetupInput<TNode, TEdge>): NetworkChartSetupResult;
