import type { DomainWithMetadata, InternalAgColorType } from 'ag-charts-core';
import { ChartAxisDirection } from 'ag-charts-core';
import { type AgAreaSeriesOptions, type AgAreaSeriesStylerParams, type AgAreaSeriesStylerResult, type AgDrawingMode, type AgSeriesMarkerStyle } from 'ag-charts-types';
import type { ModuleContext } from '../../../module/moduleContext';
import { BBox } from '../../../scene/bbox';
import { Group } from '../../../scene/group';
import type { Selection } from '../../../scene/selection';
import { Path } from '../../../scene/shape/path';
import type { SegmentedPath } from '../../../scene/shape/segmentedPath';
import type { Text } from '../../../scene/shape/text';
import type { ChartAxis } from '../../chartAxis';
import type { DataController } from '../../data/dataController';
import type { CategoryLegendDatum, ChartLegendType } from '../../legend/legendDatum';
import type { LegendSymbolOptions } from '../../legend/legendSymbol';
import { Marker } from '../../marker/marker';
import { type TooltipContent } from '../../tooltip/tooltip';
import { type PickFocusInputs } from '../series';
import { HighlightState } from '../seriesProperties';
import { AreaSeriesProperties } from './areaSeriesProperties';
import { type AreaSeriesNodeDataContext, type LabelSelectionDatum, type MarkerSelectionDatum } from './areaUtil';
import { CartesianSeries } from './cartesianSeries';
import type { CartesianAnimationDataOf, CartesianMarkerLikeContext, CartesianSeriesTypes } from './cartesianSeriesTypes';
import { type LinePathSpan } from './lineUtil';
type AreaAnimationData = CartesianAnimationDataOf<AreaSeriesTypes>;
interface StackRange {
    leading: number;
    trailing: number;
    dataValid: boolean;
    breakBefore: boolean;
}
interface AreaSeriesStackContext {
    stack: StackRange[];
    fillSpans: LinePathSpan[];
    strokeSpans: LinePathSpan[];
}
/** Context object caching expensive lookups for createNodeData(). */
interface AreaSeriesCreateNodeDatumContext extends CartesianMarkerLikeContext<MarkerSelectionDatum> {
    readonly yKey: string;
    readonly yRawValues: any[];
    readonly yCumulativeValues: any[];
    readonly yFilterValues: any[] | undefined;
    readonly invalidData: boolean[] | undefined;
    readonly indices: Uint32Array | undefined;
    readonly isContinuousY: boolean;
    readonly labelsEnabled: boolean;
    readonly normalizedTo: number | undefined;
    readonly legendItemName: string | undefined;
    readonly markerSize: number;
    readonly markerFill: InternalAgColorType | undefined;
    readonly markerStroke: string | undefined;
    readonly markerStrokeWidth: number;
    readonly yDomain: any[];
    labelData: LabelSelectionDatum[];
    crossFiltering: boolean;
}
/**
 * Consolidated type interface for AreaSeries.
 * Defines all type parameters in one place for the series.
 */
interface AreaSeriesTypes extends CartesianSeriesTypes {
    readonly node: Marker;
    readonly options: AgAreaSeriesOptions;
    readonly properties: AreaSeriesProperties;
    readonly datum: MarkerSelectionDatum;
    readonly label: LabelSelectionDatum;
    readonly context: AreaSeriesNodeDataContext;
    readonly stackContext: AreaSeriesStackContext;
    readonly createNodeDataContext: AreaSeriesCreateNodeDatumContext;
}
export declare class AreaSeries extends CartesianSeries<AreaSeriesTypes> {
    static readonly className = "AreaSeries";
    static readonly type: "area";
    properties: AreaSeriesProperties;
    connectsToYAxis: boolean;
    private readonly aggregationManager;
    readonly backgroundGroup: Group<unknown>;
    get pickModeAxis(): "main";
    constructor(moduleCtx: ModuleContext);
    renderToOffscreenCanvas(): boolean;
    attachSeries(seriesContentNode: Group, seriesNode: Group, annotationNode: Group | undefined): void;
    detachSeries(seriesContentNode: Group | undefined, seriesNode: Group, annotationNode: Group | undefined): void;
    protected attachPaths([fill, stroke]: Path[]): void;
    protected detachPaths([fill, stroke]: Path[]): void;
    private isStacked;
    private isNormalized;
    private _isStacked;
    setSeriesIndex(index: number): boolean;
    setZIndex(zIndex: number): void;
    processData(dataController: DataController): Promise<void>;
    xCoordinateRange(xValue: any, pixelSize: number): [number, number];
    yCoordinateRange(yValues: any[], pixelSize: number): [number, number];
    private yValueKey;
    private yCumulativeKey;
    getSeriesDomain(direction: ChartAxisDirection): DomainWithMetadata<any>;
    getSeriesRange(_direction: ChartAxisDirection, visibleRange: [any, any]): [number, number];
    getZoomRangeFittingItems(xVisibleRange: [number, number], yVisibleRange: [number, number] | undefined, minVisibleItems: number): {
        x: [number, number];
        y: [number, number] | undefined;
    } | undefined;
    getVisibleItems(xVisibleRange: [number, number], yVisibleRange: [number, number] | undefined, minVisibleItems: number): number;
    private aggregateData;
    private estimateTargetRange;
    private fillSpans;
    private phantomSpans;
    private strokeSpans;
    private stackAggregatedData;
    private hasInvalidDatumsInRange;
    private stackYValueData;
    createStackContext(): AreaSeriesStackContext | undefined;
    /**
     * Creates the context object with cached lookups for createNodeData().
     * All expensive operations (data resolution, scale lookups) are performed once here.
     */
    protected createNodeDatumContext(xAxis: ChartAxis, yAxis: ChartAxis): AreaSeriesCreateNodeDatumContext | undefined;
    /**
     * Computes the marker coordinate for a datum.
     * Uses cached context values to avoid repeated lookups.
     */
    private computeMarkerCoordinate;
    /**
     * Processes a single datum and updates the context's marker/label data.
     * Uses scratch object to avoid allocations in tight loops.
     */
    private handleDatum;
    /**
     * Populates the node data array by iterating over visible data.
     */
    protected populateNodeData(ctx: AreaSeriesCreateNodeDatumContext): void;
    /**
     * Initializes the result context object with default values.
     * Called before populate phase to allow early return for invisible series.
     *
     * Note: We use the actual fillSpans/strokeSpans/phantomSpans because createStackContext()
     * runs BEFORE createNodeData() and populates these instance fields. They are valid
     * even in the early return case when !visible.
     */
    protected initializeResult(ctx: AreaSeriesCreateNodeDatumContext): AreaSeriesNodeDataContext;
    /**
     * Assembles the final result with computed fields.
     * Note: fillData/strokeData are already set in initializeResult() from instance fields.
     */
    protected assembleResult(ctx: AreaSeriesCreateNodeDatumContext, result: AreaSeriesNodeDataContext): AreaSeriesNodeDataContext;
    protected isPathOrSelectionDirty(): boolean;
    protected updatePathNodes(opts: {
        paths: SegmentedPath[];
        visible: boolean;
        animationEnabled: boolean;
    }): void;
    protected updatePaths(opts: {
        contextData: AreaSeriesNodeDataContext;
        paths: Path[];
    }): void;
    private updateAreaPaths;
    private updateFillPath;
    private updateStrokePath;
    protected updateDatumSelection(opts: {
        nodeData: MarkerSelectionDatum[];
        datumSelection: Selection<Marker, MarkerSelectionDatum>;
    }): Selection<Marker, MarkerSelectionDatum>;
    protected updateDatumStyles(opts: {
        datumSelection: Selection<Marker, MarkerSelectionDatum>;
        isHighlight: boolean;
    }): void;
    protected updateDatumNodes(opts: {
        datumSelection: Selection<Marker, MarkerSelectionDatum>;
        isHighlight: boolean;
        drawingMode: AgDrawingMode;
    }): void;
    protected updateLabelSelection(opts: {
        labelData: LabelSelectionDatum[];
        labelSelection: Selection<Text, LabelSelectionDatum>;
    }): Selection<Text<any>, LabelSelectionDatum>;
    protected updateLabelNodes(opts: {
        labelSelection: Selection<Text, LabelSelectionDatum>;
        isHighlight?: boolean;
    }): void;
    makeStylerParams(highlightStateEnum?: HighlightState): AgAreaSeriesStylerParams<unknown, unknown>;
    private makeItemStylerParams;
    private makeLabelFormatterParams;
    getTooltipContent(datumIndex: number): TooltipContent | undefined;
    legendItemSymbol(): LegendSymbolOptions;
    getLegendData(legendType: ChartLegendType): CategoryLegendDatum[];
    protected resetDatumAnimation(data: AreaAnimationData): void;
    animateEmptyUpdateReady(animationData: AreaAnimationData): void;
    protected animateReadyResize(animationData: AreaAnimationData): void;
    animateWaitingUpdateReady(animationData: AreaAnimationData): void;
    protected isLabelEnabled(): boolean;
    protected nodeFactory(): Marker;
    getStyle(highlightState?: HighlightState): Required<AgAreaSeriesStylerResult> & {
        marker: Required<AgSeriesMarkerStyle> & {
            enabled: boolean;
        };
    };
    getFormattedMarkerStyle(datum: MarkerSelectionDatum): AgSeriesMarkerStyle & {
        size: number;
    };
    isPointInArea(x: number, y: number): boolean;
    protected computeFocusBounds(opts: PickFocusInputs): BBox | undefined;
    protected hasItemStylers(): boolean;
}
export {};
