import { AfterViewInit, OnDestroy, ChangeDetectorRef } from '@angular/core';
import { Subject } from 'rxjs';
import { BaseResourceComponent, RecentAccessService, RecentAccessItem, HomeAppPinnedItem } from '@memberjunction/ng-shared';
import { ResourceData, MJUserFavoriteEntity, MJUserNotificationEntity } from '@memberjunction/core-entities';
import { ApplicationManager, BaseApplication } from '@memberjunction/ng-base-application';
import { UserAppConfigComponent } from '@memberjunction/ng-explorer-settings';
import { ActionPinConfigResult } from './action-pin-config-dialog.component';
import { ActionPinRunResult } from './action-pin-runner-dialog.component';
import * as i0 from "@angular/core";
/**
 * Cached app data with pre-computed values for optimal rendering performance
 */
interface AppDisplayData {
    app: BaseApplication;
    color: string;
    icon: string;
    navItemsCount: number;
    navItemsPreview: {
        Label: string;
        Icon: string;
    }[];
    showMoreItems: boolean;
    moreItemsCount: number;
}
/**
 * Home Dashboard - Personalized home screen showing all available applications
 * with quick access navigation and configuration options.
 *
 * Uses OnPush change detection and cached computed values for optimal performance.
 * Registered as a BaseResourceComponent so it can be used as a Custom resource type
 * in nav items, allowing users to return to the Home dashboard after viewing orphan resources.
 */
export declare class HomeDashboardComponent extends BaseResourceComponent implements AfterViewInit, OnDestroy {
    private appManager;
    private recentAccessService;
    private cdr;
    protected destroy$: Subject<void>;
    private metadata;
    private pinService;
    appConfigDialog: UserAppConfigComponent;
    isLoading: boolean;
    apps: BaseApplication[];
    appsDisplayData: AppDisplayData[];
    currentUser: {
        Name: string;
        Email: string;
    } | null;
    showConfigDialog: boolean;
    favorites: MJUserFavoriteEntity[];
    favoritesLoading: boolean;
    recentItems: RecentAccessItem[];
    recentsLoading: boolean;
    unreadNotifications: MJUserNotificationEntity[];
    notificationsLoading: boolean;
    sidebarOpen: boolean;
    HidePinEmptyState: boolean;
    PinnedItems: HomeAppPinnedItem[];
    UngroupedPins: HomeAppPinnedItem[];
    PinGroups: string[];
    EditMode: boolean;
    AddPanelOpen: boolean;
    AddPanelSearchQuery: string;
    AddPanelSelectedGroup: string;
    AddPanelNewGroupName: string;
    EditingPinId: string | null;
    EditingGroupName: string | null;
    AvailableDashboards: {
        id: string;
        name: string;
        pinned: boolean;
    }[];
    AvailableViews: {
        id: string;
        name: string;
        entityName: string;
        pinned: boolean;
    }[];
    AvailableQueries: {
        id: string;
        name: string;
        pinned: boolean;
    }[];
    AvailableActions: {
        id: string;
        name: string;
        description: string;
        pinned: boolean;
    }[];
    AvailableApps: {
        appId: string;
        appName: string;
        icon: string;
        color: string;
        navItems: {
            label: string;
            icon: string;
            pinned: boolean;
        }[];
    }[];
    AddPanelLoading: boolean;
    ActionConfigDialogVisible: boolean;
    ActionConfigActionId: string | null;
    ActionConfigActionName: string | null;
    ActionConfigActionDescription: string | null;
    ActionRunnerDialogVisible: boolean;
    ActionRunnerPin: HomeAppPinnedItem | null;
    PanelSectionCollapsed: Record<string, boolean>;
    PinMenuVisible: boolean;
    PinMenuX: number;
    PinMenuY: number;
    PinMenuPin: HomeAppPinnedItem | null;
    HasDataExplorerApp: boolean;
    DraggingPinId: string | null;
    DragOverPinId: string | null;
    private favoriteIconCache;
    private resourceIconCache;
    favoriteDisplayNames: Map<string, string>;
    /**
     * Check if sidebar has any content to show
     */
    get hasSidebarContent(): boolean;
    /**
     * Toggle sidebar visibility
     */
    toggleSidebar(): void;
    /**
     * Check if current device is mobile (width <= 768px)
     */
    private isMobileDevice;
    constructor(appManager: ApplicationManager, recentAccessService: RecentAccessService, cdr: ChangeDetectorRef);
    GetResourceDisplayName(data: ResourceData): Promise<string>;
    GetResourceIconClass(data: ResourceData): Promise<string>;
    ngAfterViewInit(): Promise<void>;
    /**
     * Publish the current Home dashboard state to the AI agent via NavigationService.
     * The shaping lives in the pure {@link buildHomeAgentContext} helper so it stays
     * unit-testable. Called on init and on every meaningful state change.
     */
    private publishAgentContext;
    /** Structured recent-item summaries (display name + resource type) for the agent context. */
    private buildRecentItemSummaries;
    /**
     * Register the client tools the AI agent can invoke against the Home dashboard.
     * All are navigation / discovery / panel-toggle operations (see SAFETY BOUNDARY
     * above). Each handler delegates to the same component method a user interaction
     * would call and returns a tolerant result.
     *
     * Tools:
     * - OpenApp: switch to an application by name (exact or partial match).
     * - OpenPin: open a pinned item by its display name (exact or partial match).
     * - SearchPins: find pinned items by a name query (read-only — returns matches).
     * - OpenRecent: open a recently-accessed item by display name (read-only navigation).
     * - SearchAddPinPanel: open the Add Pin panel (if needed) and apply a search query.
     * - ClearAddPinPanelSearch: clear the Add Pin panel search query.
     * - OpenAddPinPanel / CloseAddPinPanel: toggle the Add Pin panel.
     * - ToggleSidebar: toggle the notifications/favorites/recents sidebar.
     * - TogglePinEditMode: toggle pin edit mode (reorder/rename UI affordances).
     */
    private registerAgentClientTools;
    /** Resolve an app by name (exact then partial, case-insensitive) and switch to it. */
    private toolOpenApp;
    /** The pinned items narrowed to the resolver's structural shape (Name == DisplayName). */
    private get pinNamedRecords();
    /** Resolve a pinned item by display name (exact then partial, case-insensitive) and open it. */
    private toolOpenPin;
    /** Find pinned items whose display name matches a query (read-only — returns matches). */
    private toolSearchPins;
    /** Resolve a recent item by display name (exact then partial) and navigate to it. */
    private toolOpenRecent;
    /** Open the Add Pin panel (if needed) and apply a search query. */
    private toolSearchAddPinPanel;
    /** Clear the Add Pin panel search query. */
    private toolClearAddPinPanelSearch;
    ngOnDestroy(): void;
    /**
     * Get a greeting based on time of day
     */
    get greeting(): string;
    /**
     * Get formatted date string
     */
    get formattedDate(): string;
    /**
     * Navigate to an application
     */
    onAppClick(app: BaseApplication): Promise<void>;
    /**
     * Open app configuration dialog
     */
    openConfigDialog(): void;
    /**
     * Handle when config is saved
     */
    onConfigSaved(): void;
    /**
     * Pre-compute display data for all apps to avoid repeated calculations during change detection
     */
    private computeAppsDisplayData;
    /**
     * Track function for apps loop
     */
    trackByApp(_index: number, item: AppDisplayData): string;
    /**
     * Track function for nav items preview
     */
    trackByNavItem(_index: number, item: {
        Label: string;
        Icon: string;
    }): string;
    /**
     * Load user favorites from UserInfoEngine (cached) and resolve record display names
     */
    private loadFavorites;
    /**
     * Batch-resolve record display names for favorites using GetEntityRecordNames()
     */
    private resolveFavoriteNames;
    /**
     * Build a CompositeKey for a record. RecordID may be stored as either:
     * - Concatenated format: "FieldName|Value" or "Field1|Val1||Field2|Val2"
     * - Plain value: just the raw value (e.g. a GUID)
     */
    private buildCompositeKeyForRecord;
    /**
     * Get the display name for a favorite (resolved name or entity name fallback)
     */
    getFavoriteDisplayName(favorite: MJUserFavoriteEntity): string;
    /**
     * Load recent items via the RecentAccessService
     */
    private loadRecents;
    /**
     * Navigate to a favorite item using NavigationService
     */
    onFavoriteClick(favorite: MJUserFavoriteEntity): void;
    /**
     * Navigate to a recent item using NavigationService
     */
    onRecentClick(item: RecentAccessItem): void;
    /**
     * Navigate to a notification using NavigationService
     */
    onNotificationClick(notification: MJUserNotificationEntity): void;
    /**
     * Get icon for an entity by name, using entity metadata Icon field (cached)
     */
    getEntityIconByName(entityName: string): string;
    /**
     * Resolve an entity's Icon field to a full Font Awesome class string
     */
    private resolveEntityIcon;
    /**
     * Format a date for display (pure function, safe to call in template)
     */
    formatDate(date: Date): string;
    /**
     * Track function for favorites
     */
    trackByFavorite(_index: number, item: MJUserFavoriteEntity): string;
    /**
     * Remove duplicate recent items (same entity + recordId). Keeps the first occurrence.
     */
    private deduplicateRecents;
    /**
     * Track function for recent items
     */
    trackByRecent(_index: number, item: RecentAccessItem): string;
    /**
     * Track function for notifications
     */
    trackByNotification(_index: number, item: MJUserNotificationEntity): string;
    /**
     * Resolve display names for record-type pins that have raw "Entity - ID|..." titles.
     * Uses batch GetEntityRecordNames() for efficiency, same pattern as favorites.
     */
    private resolveRecordPinNames;
    /**
     * Resolve missing icons for Custom (app nav item) pins by looking up nav items.
     */
    private resolveCustomPinIcons;
    /**
     * Navigate to a pinned resource
     */
    OnPinClick(pin: HomeAppPinnedItem): void;
    /**
     * Resolve a pin's resource type from its stored ResourceType and config keys.
     * Handles legacy pins that may have stored a UUID resourceTypeId or
     * a raw config.resourceType string instead of the canonical type names.
     */
    private resolveStoredResourceType;
    /**
     * Toggle edit mode for pins
     */
    ToggleEditMode(): void;
    /**
     * Permanently hide the "No pinned items yet" empty state for this user.
     * Persisted in UserSettings via UserInfoEngine.
     */
    DismissPinEmptyState(): void;
    /**
     * Remove a pin
     */
    RemovePin(pinId: string): void;
    /**
     * Start inline editing of a pin's display name
     */
    StartEditingPin(pinId: string, event: Event): void;
    /**
     * Save edited pin name
     */
    SavePinName(pinId: string, newName: string): void;
    /**
     * Extract input value from a DOM event (strict template helper)
     */
    GetInputValue(event: Event): string;
    /**
     * Start editing a group name
     */
    StartEditingGroup(groupName: string): void;
    /**
     * Save edited group name - updates all pins in the group
     */
    SaveGroupName(oldName: string, newName: string): void;
    /**
     * Remove a group - moves all pins to ungrouped
     */
    RemoveGroup(groupName: string): void;
    /**
     * Get pins in a specific group
     */
    GetPinsInGroup(groupName: string): HomeAppPinnedItem[];
    /**
     * Get icon for a pin based on resource type and metadata
     */
    GetPinIcon(pin: HomeAppPinnedItem): string;
    /**
     * Get display label for a resource type
     */
    GetResourceTypeLabel(pin: HomeAppPinnedItem): string;
    /** Accent color for a pin — prefers the stored accentColor in Configuration, falls back to Color, then CSS var */
    GetPinAccentColor(pin: HomeAppPinnedItem): string;
    /**
     * Get the app icon for a pin by looking up the app by name
     */
    private getAppIcon;
    /**
     * Look up the nav item icon for a Custom pin from the app's nav items cache.
     * Uses the pre-computed appsDisplayData to avoid async lookups.
     */
    private getNavItemIcon;
    /**
     * Show the pin context menu (triggered by ellipsis button)
     */
    ShowPinMenu(event: MouseEvent, pin: HomeAppPinnedItem): void;
    /**
     * Hide the pin context menu
     */
    HidePinMenu(): void;
    /**
     * Edit a pin (enters edit mode focused on this pin)
     */
    OnPinMenuEdit(): void;
    /**
     * Move a pin to a different group
     */
    OnPinMenuMoveToGroup(groupName: string | undefined): void;
    /**
     * Unpin a resource from the pin context menu
     */
    OnPinMenuUnpin(): void;
    OnDragStart(event: DragEvent, pin: HomeAppPinnedItem): void;
    OnDragOver(event: DragEvent, targetPin: HomeAppPinnedItem): void;
    OnDragLeave(): void;
    OnDrop(event: DragEvent, targetPin: HomeAppPinnedItem): void;
    OnDragEnd(): void;
    trackByPin(_index: number, pin: HomeAppPinnedItem): string;
    trackByGroup(_index: number, group: string): string;
    OpenAddPinPanel(): Promise<void>;
    CloseAddPinPanel(): void;
    private loadAvailableResources;
    /**
     * Filter panel items by search query
     */
    FilterPanelItems<T extends {
        name: string;
    }>(items: T[]): T[];
    /**
     * Load available apps with their nav items for the Add Pin panel
     */
    private loadAvailableApps;
    /**
     * Set a section's collapsed state in the Add Pin panel from the accordion
     * panel's (ExpandedChange) output. The accordion reports the EXPANDED state,
     * which is the inverse of our stored COLLAPSED flag. OnPush component, so
     * mark for check after mutating the map.
     */
    OnPanelSectionExpandedChange(section: string, expanded: boolean): void;
    /**
     * Pin an app nav item from the Add Panel
     */
    PinAppNavItem(appName: string, _appIcon: string, appColor: string, navItemLabel: string, navItemIcon: string): void;
    /**
     * Pin a resource from the Add Panel
     */
    PinFromPanel(resourceType: string, id: string, name: string): void;
    /**
     * Open the Configure Action Pin dialog — triggered when the user clicks an Action
     * in the Add Pin panel. Actions need extra configuration (preset params, runtime
     * params, title, theming) before they can be pinned.
     */
    OpenActionPinConfig(actionId: string, actionName: string, description: string): void;
    /** Callback from the Configure Action Pin dialog */
    OnActionConfigResult(result: ActionPinConfigResult): void;
    /** Callback from the Run Action Pin dialog */
    OnActionRunnerResult(_result: ActionPinRunResult): void;
    /**
     * Resolve the selected group — handles the "new group" option
     */
    private getSelectedGroup;
    private updatePanelPinnedState;
    /**
     * Filter apps by search query (matches app name or nav item labels)
     */
    FilterApps(): typeof this.AvailableApps;
    static ɵfac: i0.ɵɵFactoryDeclaration<HomeDashboardComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<HomeDashboardComponent, "mj-home-dashboard", never, {}, {}, never, never, false, never>;
}
export {};
//# sourceMappingURL=home-dashboard.component.d.ts.map