/**
 * Pass 3 Styling Module
 *
 * Two-step styling pass:
 * - Pass 3a: LLM outputs className patches (which nodes get which classes)
 * - Pass 3b: LLM outputs CSS rules (targeting those classes)
 *
 * Programmatic transformations between passes ensure coordination:
 * - Patches are applied deterministically
 * - Selectors are scoped programmatically
 */
import { z } from 'zod';
import type { CustomCssRuleInput, CustomCssAtRuleInput } from '../../contracts';
import { collectLayoutNodeInfos, collectLayoutClassNames, type NodeInfo } from '../validation/layout-utils';
export { collectLayoutNodeInfos, collectLayoutClassNames, type NodeInfo };
export interface LayoutNode {
    type: string;
    props?: Record<string, unknown> | null;
    children?: LayoutNode[] | null;
    $bind?: {
        from: string;
    } | null;
    $repeat?: unknown;
}
export interface ClassNamePatch {
    nodePath: string;
    className: string;
}
export declare const pass3aOutputSchema: z.ZodObject<{
    classNamePatches: z.ZodArray<z.ZodObject<{
        nodePath: z.ZodString;
        className: z.ZodString;
    }, z.core.$strip>>;
    rationale: z.ZodString;
}, z.core.$strip>;
export type Pass3aOutput = z.infer<typeof pass3aOutputSchema>;
export declare const pass3bOutputSchema: z.ZodObject<{
    customCssRules: z.ZodNullable<z.ZodArray<z.ZodObject<{
        id: z.ZodString;
        selector: z.ZodString;
        declarations: z.ZodArray<z.ZodObject<{
            property: z.ZodString;
            value: z.ZodString;
        }, z.core.$strip>>;
    }, z.core.$strip>>>;
    customCssAtRules: z.ZodNullable<z.ZodArray<z.ZodObject<{
        id: z.ZodString;
        type: z.ZodLiteral<"media">;
        query: z.ZodString;
        rules: z.ZodArray<z.ZodObject<{
            selector: z.ZodString;
            declarations: z.ZodArray<z.ZodObject<{
                property: z.ZodString;
                value: z.ZodString;
            }, z.core.$strip>>;
        }, z.core.$strip>>;
    }, z.core.$strip>>>;
    rationale: z.ZodString;
}, z.core.$strip>;
export type Pass3bOutput = z.infer<typeof pass3bOutputSchema>;
/**
 * Get a node at a specific path in the layout tree.
 * Path format: "" for root, or "children[0].children[1]" etc.
 *
 * STRICT PARSING: Rejects invalid path formats to prevent silent failures.
 */
export declare function getNodeAtPath(layout: LayoutNode, path: string): LayoutNode | null;
/**
 * Apply className patches to a layout.
 * Uses APPEND semantics - preserves existing classNames.
 */
export declare function applyClassNamePatches(layout: LayoutNode, patches: ClassNamePatch[]): LayoutNode;
/**
 * Generate node path inventory for the LLM prompt.
 */
export declare function buildNodeInventory(layout: LayoutNode): string;
/**
 * Validate Pass 3a output - className patches.
 */
export declare function validatePass3aOutput(output: Pass3aOutput, layout: LayoutNode): string[];
/**
 * Validate Pass 3b output BEFORE scoping.
 * Ensures selectors are class-based and reference only available classNames.
 */
export declare function validatePass3bOutput(output: Pass3bOutput, availableClassNames: Set<string>): string[];
/**
 * Scope a single selector with the block prefix.
 * Handles comma-separated selector lists safely.
 *
 * IMPORTANT: ".a, .b" must become "[data-block=...] .a, [data-block=...] .b"
 * NOT "[data-block=...] .a, .b" (which would leak .b globally)
 */
export declare function scopeSelector(prefix: string, selector: string): string;
/**
 * Scope and normalize CSS rules from Pass 3b output.
 * Pipeline: scope selectors -> normalize declarations
 */
export declare function scopeAndNormalizeRules(blockId: string, output: Pass3bOutput): {
    customCssRules: CustomCssRuleInput[] | null;
    customCssAtRules: CustomCssAtRuleInput[] | null;
};
export declare function buildPass3aSystemPrompt(): string;
/**
 * Build the user message for Pass 3a (className patches).
 */
export declare function buildPass3aUserMessage(layout: LayoutNode, html: string, nodeInventory: string): string;
export declare function buildPass3bSystemPrompt(): string;
/**
 * Build the user message for Pass 3b (CSS rules).
 */
export declare function buildPass3bUserMessage(patchedLayout: LayoutNode, html: string, availableClassNames: string[], themeSummary: string): string;
