import { type PropertyInfo } from "@superblocksteam/library-shared";
import type { ParseResult } from "@babel/parser";
import type { Node, NodePath } from "@babel/traverse";
import type { File } from "@babel/types";
import type { Tracer } from "@opentelemetry/api";
import type { CreateRequest, SbElement, SourceLocation } from "@superblocksteam/library-shared/types";
export type FileMeta = {
    code: string;
    ast: ParseResult<File> | null;
    imports: Record<string, string>;
};
export type SourceKind = "api" | "ts";
interface SourceEditActions {
    addElement: (p: CreateRequest) => SbElement | undefined;
    deleteElement: (p: {
        source: SourceLocation;
        scopeName?: string;
    }) => void;
    setProperties: (p: {
        source: SourceLocation;
        changes: Record<string, PropertyInfo>;
    }) => void;
    setProperty: (p: {
        source: SourceLocation;
        property: string;
        info: PropertyInfo;
    }) => void;
}
export declare class SourceTracker implements SourceEditActions {
    private renameManager;
    private elementToLocation;
    private elementToFilePath;
    private newlyAddedCount;
    private fileToMeta;
    private changedFiles;
    constructor(_tracer: Tracer);
    /**
     * Add a file to the changed files set with normalized path (Windows compatibility)
     */
    private addChangedFile;
    getCurrentFiles(): Record<string, FileMeta>;
    /**
     * Retrieves and clears the changes made to files, returning them as a record of file
     * names and their corresponding code.
     * @returns A Record<string, string> object containing the file names as keys and their corresponding code as values.
     */
    getAndFlushChanges: () => Promise<Array<{
        fileName: string;
        source: string;
        kind: SourceKind;
    }>>;
    getElementToFilePath(): Record<SbElement, string>;
    getElementToFilePath(el: SbElement): string;
    getElementToLocation(): Record<SbElement, NodePath<Node>>;
    getElementToLocation(el: SbElement): NodePath<Node>;
    setElementToLocation(el: SbElement, path: NodePath<Node>): void;
    setElementToFilePath(el: SbElement, filePath: string): void;
    deleteElementToLocation(el: SbElement): void;
    deleteElementToFilePath(el: SbElement): void;
    getScopeIdForPage(pageName: string): string;
    private parseJsxFromEntrypoint;
    initializeSourceTracker: ({ files }: {
        files: Record<string, string>;
    }) => void;
    handleNonVisualChangeByDeletingIds: (fileName: string, fileContents: string) => Promise<void>;
    removeFile: (fileName: string) => void;
    updateFileContents(filePath: string, code: string): void;
    addApi: ({ apiName: _apiName }: {
        apiName: string;
    }) => Promise<string>;
    deleteApi: ({ apiName: _apiName, }: {
        apiName: string;
    }) => string | undefined;
    addElement: ({ parentElement, tagName, properties, children, id, scopeName: _scopeName, }: CreateRequest) => SbElement | undefined;
    deleteElement: ({ source, scopeName: _scopeName, }: {
        source: SourceLocation;
        scopeName?: string;
    }) => void;
    private tryDeleteJSXReferenceIfAssigned;
    private removeReferencesUsingBinding;
    private isJSXElementInVariableInit;
    private deleteSectionIfOnlyChild;
    /**
     * Set's a deeply nested property on a JSX attribute. For example, if you have an attribute that is
     * an object like:
     *   ```
     *   columns={{
     *     name: {
     *       accessor: "name",
     *     },
     *   }}
     *   ```
     * And you want to update the `accessor` property, you can use this function to do so, passing a property path like
     * `columns.name.accessor`, rather than the entire columns object.
     */
    private setNestedAttribute;
    private setAttribute;
    private deleteAttribute;
    private transformSelfClosingTagToRegularTag;
    private setJSXChildren;
    setProperty: ({ source, property, info, }: {
        source: SourceLocation;
        property: string;
        info: PropertyInfo;
    }) => void;
    setProperties: ({ source, changes, }: {
        source: SourceLocation;
        changes: Record<string, PropertyInfo>;
    }) => void;
    deleteProperties: ({ source, properties, }: {
        source: SourceLocation;
        properties: string[];
    }) => Promise<void>;
    renameComponent: ({ widgetSourceId, newName, oldName: _oldName, renameInAst, }: {
        widgetSourceId: SbElement;
        newName: string;
        oldName: string;
        renameInAst?: boolean;
    }) => Promise<void>;
    renameIdentifier: ({ oldName, newName, filePath, parentBinding, }: {
        oldName: string;
        newName: string;
        filePath: string;
        parentBinding?: string;
    }) => void;
    getAddElementImports: ({ properties, children, }: Pick<CreateRequest, "properties" | "children">) => {
        importPath: string;
        importName: string;
        isDefaultImport?: boolean;
    }[];
}
export {};
//# sourceMappingURL=source-tracker.d.ts.map