import { types as t } from "@marko/compiler";
import type { AccessorPrefix } from "../../common/accessor.debug";
import { type Opt, Sorted } from "./optional";
import { type Binding, type InputBinding, type ParamBinding, type ReferencedBindings, type Sources } from "./references";
import { type SerializeReason } from "./serialize-reasons";
export interface ParamSerializeReasonGroup {
    id: symbol;
    reason: NonNullable<Sources["param"]>;
}
export type ParamSerializeReasonGroups = [
    ParamSerializeReasonGroup,
    ...ParamSerializeReasonGroup[]
];
export declare enum ContentType {
    Comment = 0,
    Dynamic = 1,
    Placeholder = 2,
    Tag = 3,
    Text = 4
}
export interface Section {
    id: number;
    name: string;
    loc: t.SourceLocation | undefined;
    depth: number;
    parent: Section | undefined;
    sectionAccessor: {
        binding: Binding;
        prefix: AccessorPrefix;
    } | undefined;
    params: undefined | ParamBinding | InputBinding;
    referencedLocalClosures: ReferencedBindings;
    referencedClosures: ReferencedBindings;
    referencedHoists: ReferencedBindings;
    bindings: ReferencedBindings;
    hoisted: ReferencedBindings;
    hoistedTo: ReferencedBindings;
    serializeReason: undefined | SerializeReason;
    serializeReasons: Map<symbol, SerializeReason>;
    paramReasonGroups: ParamSerializeReasonGroups | undefined;
    returnValueExpr: t.NodeExtra | undefined;
    returnSerializeReason: SerializeReason | undefined;
    isHoistThrough: true | undefined;
    upstreamExpression: t.NodeExtra | undefined;
    downstreamBinding: {
        binding: Binding;
        properties: Opt<string>;
    } | false | undefined;
    hasAbortSignal: boolean;
    readsOwner: boolean;
    isBranch: boolean;
    content: null | {
        startType: ContentType;
        endType: ContentType;
        singleChild: boolean;
    };
}
declare module "@marko/compiler/dist/types" {
    interface ProgramExtra {
        section?: Section;
        sections?: Section[];
    }
    interface MarkoTagBodyExtra {
        section?: Section;
    }
}
export declare const sectionUtil: Sorted<Section>;
export declare function startSection(path: t.NodePath<t.MarkoTagBody | t.Program>): Section | undefined;
export declare function getOrCreateSection(path: t.NodePath<any>): Section;
export declare function getSectionForBody(body: t.NodePath<t.MarkoTagBody | t.Program>): Section | undefined;
export declare function getSection(path: t.NodePath): Section;
export declare const getScopeIdIdentifier: (section: Section) => t.Identifier;
export declare const getSectionParentIsOwner: (section: Section) => boolean, setSectionParentIsOwner: (section: Section, value: boolean) => void;
export declare const getBranchRendererArgs: (section: Section) => [template?: t.Expression | undefined, walks?: t.Expression | undefined, setup?: t.Expression | undefined, params?: t.Expression | undefined], setBranchRendererArgs: (section: Section, value: [template?: t.Expression | undefined, walks?: t.Expression | undefined, setup?: t.Expression | undefined, params?: t.Expression | undefined]) => void;
export declare function forEachSection(fn: (section: Section) => void): void;
export declare function forEachSectionReverse(fn: (section: Section) => void): void;
export declare function getNodeContentType(path: t.NodePath<t.Statement>, extraMember: "startType" | "endType", contentInfo?: Section["content"]): ContentType | null;
export declare function getSectionRegisterReasons(section: Section): false | SerializeReason;
export declare function isImmediateOwner(section: Section, binding: Binding): boolean;
export declare function isDirectClosure(section: Section, closure: Binding): boolean;
export declare function isDynamicClosure(section: Section, closure: Binding): boolean;
export declare function getDynamicClosureIndex(closure: Binding, closureSection: Section): number;
export declare function getDirectClosures(section: Section): Opt<Binding>;
export declare function isSameOrChildSection(section: Section, other: Section): boolean;
export declare function getCommonSection(section: Section, other: Section): Section;
export declare function finalizeParamSerializeReasonGroups(section: Section): void;
export declare function getParamReasonGroupIndex(section: Section, reason: ParamSerializeReasonGroup["reason"]): number;
export declare function groupParamsBySection(params: Sources["param"]): Map<Section, import("./optional").OneMany<InputBinding | ParamBinding>>;
