import { type MarketOrderbookData, type VenueMarket, type VenueMarketOutcome } from "@agg-build/hooks";
import type { OrderbookRowData } from "../orderbook";
export type EligibleVenueOutcome = {
    venue: VenueMarket["venue"];
    market: VenueMarket;
    outcome: VenueMarketOutcome;
    outcomeId: string;
    semanticLabel: string;
};
export type AggregatedOrderbookRows = {
    askRows: OrderbookRowData[];
    bidRows: OrderbookRowData[];
    midpoint: number | null;
    spread: number | null;
    hasNoOrderBook: boolean;
    includedOutcomeIds: string[];
    missingOutcomeIds: string[];
};
/**
 * Pick the eligible outcome on each venue-market that corresponds to the
 * user's selected side.
 *
 * Selected-outcome-first (when `selectedOutcomeId` is provided): find
 * that exact outcome in the cluster, emit it, walk its `matchedVenueMarketOutcomes`
 * refs to align siblings by id. **Return immediately** — no fallback to
 * other markets via label. This matches the server-side smart-route CTE
 * which keys off the specific outcome id and does not fall through to
 * label-based discovery. Critical for inversely-framed per-team kalshi
 * binaries where the user's "No" outcome has no MVMO refs (matcher only
 * emits Yes-side rows), but a different market's "No" outcome (e.g.
 * polymarket-No with title "Khamzat Chimaev") DOES have refs pointing
 * to the OPPOSITE semantic side. Falling through to that parent in the
 * label loop emits cross-side outcomes — observed in the orderbook
 * showing 80¢ Chimaev-wins prices when the user clicked the 19¢
 * Strickland-wins side. The selected-outcome short-circuit prevents it.
 *
 * MVMO-first label loop (when `selectedOutcomeId` is null): scan the
 * cluster for any market whose selected-outcome carries MVMO refs and
 * use it as the parent. Walk the refs to align siblings.
 *
 * Label-fallback: for any sibling not covered by an MVMO ref (unmatched
 * markets, or older API responses that pre-date the refs), fall back to
 * label matching with anchor-set guard so we don't regress on the
 * historically-correct cases.
 */
export declare const collectEligibleVenueOutcomes: ({ venueMarkets, selectedOutcomeLabel, selectedOutcomeId, }: {
    venueMarkets: VenueMarket[];
    selectedOutcomeLabel: string | null | undefined;
    /**
     * The exact outcome id the user clicked. When provided AND found in the
     * cluster, the function emits that outcome + only its MVMO siblings, then
     * returns — bypassing the label-based parent-discovery loop. Required to
     * keep inversely-framed-binary surfaces (chart/orderbook) on the same
     * semantic side as the user's selection.
     */
    selectedOutcomeId?: string | null;
}) => EligibleVenueOutcome[];
export declare const collectEligibleVenueOutcomeIds: ({ venueMarkets, selectedOutcomeLabel, selectedOutcomeId, }: {
    venueMarkets: VenueMarket[];
    selectedOutcomeLabel: string | null | undefined;
    selectedOutcomeId?: string | null;
}) => string[];
export declare const mergeVenueOutcomeOrderbooks: ({ eligibleOutcomes, orderbooksByOutcomeId, }: {
    eligibleOutcomes: EligibleVenueOutcome[];
    orderbooksByOutcomeId: Record<string, MarketOrderbookData | null | undefined>;
}) => AggregatedOrderbookRows;
