import { EventEmitter } from '@angular/core';
import type { FormMode } from '@memberjunction/interactive-component-types/forms';
import { ComponentStudioStateService } from '../../services/component-studio-state.service';
import { type FormCanvasElement, type FormCanvasModel, type FormCanvasSection } from '../../services/form-canvas-model';
import * as i0 from "@angular/core";
/**
 * Form Builder tab — the visual drag-and-drop canvas surface that appears
 * in Component Studio's editor-tabs strip when the active spec is form-role.
 *
 * The canvas is the source-of-truth while this tab is active. On save, the
 * dashboard serialises the canvas to JSX via `generateCodeFromCanvas` and
 * pushes that into `state.EditableCode`. When the user opens an existing
 * form-role Component, `parseCanvasFromCode` reconstructs the canvas
 * (lossily) from the stored code; if the round-trip is too lossy, we leave
 * the canvas empty and steer the user toward the Code tab.
 *
 * The component is presentational where it can be — the heavy state
 * (canvas, schema, selection, preview mode) lives on
 * `ComponentStudioStateService`. This keeps the right-panel and the live
 * preview pane in sync with whatever the user is doing in here.
 */
export declare class FormBuilderTabComponent {
    /** Notifies the parent (dashboard) that the user wants to switch to the Code tab. */
    RequestCodeTab: EventEmitter<void>;
    /** Fired separately for the dashboard's NavigationService bridge. */
    OpenInChatRequested: EventEmitter<void>;
    IsEntityPickerOpen: boolean;
    EntityPickerSearch: string;
    EntityChoices: Array<{
        Name: string;
        DisplayName: string;
    }>;
    readonly state: ComponentStudioStateService;
    private readonly cdr;
    private readonly notifications;
    private readonly destroy$;
    ngOnInit(): void;
    ngOnDestroy(): void;
    ToggleEntityPicker(): void;
    OnEntityPickerSearch(event: Event): void;
    OnEntityPicked(entityName: string): void;
    get filteredEntityChoices(): Array<{
        Name: string;
        DisplayName: string;
    }>;
    private refreshEntityChoices;
    SetPreviewMode(mode: FormMode): void;
    OnCanvasChanged(next: FormCanvasModel): void;
    OnElementSelected(payload: {
        sectionId: string;
        elementId: string;
    }): void;
    OnSectionSelected(sectionId: string): void;
    OnDeselected(): void;
    OnElementChanged(next: FormCanvasElement): void;
    OnSectionChanged(next: FormCanvasSection): void;
    OnElementDeleted(elementId: string): void;
    OnSectionDeleted(sectionId: string): void;
    OnFieldAddedFromPalette(payload: {
        fieldName: string;
    }): void;
    private findFocusedSection;
    /**
     * Bubble up — the dashboard wires up `navigationService.SetAgentContext`
     * via the state event because we don't extend BaseResourceComponent
     * here. The tab also fires a local Output for the editor-tabs parent in
     * case it wants to react.
     */
    OnOpenInChat(): void;
    OnViewCode(): void;
    OnKeyDown(event: KeyboardEvent): void;
    /**
     * Build a fresh canvas if the spec already has a target entity but no
     * canvas yet (e.g. tab activated for the first time). Best-effort — if
     * the spec's code is too lossy to parse, we leave the canvas empty and
     * show a banner.
     */
    private hydrateCanvasFromState;
    /**
     * Mirror the canvas into ComponentStudioStateService.EditableCode so the
     * Code tab, the preview, and the eventual Save flow all see the same
     * source. Quietly no-op if we don't have enough to render.
     */
    private regenerateCode;
    static ɵfac: i0.ɵɵFactoryDeclaration<FormBuilderTabComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<FormBuilderTabComponent, "mj-form-builder-tab", never, {}, { "RequestCodeTab": "RequestCodeTab"; "OpenInChatRequested": "OpenInChatRequested"; }, never, never, false, never>;
}
//# sourceMappingURL=form-builder-tab.component.d.ts.map