import * as i1 from '@fundamental-ngx/cdk/data-source';
import { BaseDataSource, AbstractDataProvider, DataSourceParser } from '@fundamental-ngx/cdk/data-source';
import { Observable, Subject } from 'rxjs';
import * as i0 from '@angular/core';
import { TemplateRef, ElementRef, OnDestroy, Injector, Signal, OnInit, OnChanges, AfterViewInit, EventEmitter, QueryList, SimpleChanges, InjectionToken } from '@angular/core';
import { SelectableItemToken, Nullable, CssClassBuilder, SelectComponentRootToken, SelectableListValueType, HasElementRef } from '@fundamental-ngx/cdk/utils';
import * as i2 from '@fundamental-ngx/cdk/forms';

declare class FdTreeDataSource<T> extends BaseDataSource<T> {
    dataProvider: AbstractDataProvider<T>;
    /** @hidden */
    limitless: boolean;
    /** @hidden */
    constructor(dataProvider: AbstractDataProvider<T>);
}
declare class ArrayTreeDataSource<T> extends FdTreeDataSource<T> {
    /** @hidden */
    constructor(data: T[]);
}
declare class ObservableTreeDataSource<T> extends FdTreeDataSource<T> {
    /** @hidden */
    constructor(data: Observable<T[]>);
}
/**
 * Type of acceptable objects as a datasource for the Multi-Combo Box component.
 */
type FdTreeAcceptableDataSource<T = any> = FdTreeDataSource<T> | Observable<T[]> | T[];
type FdTreeItemType<Type extends FdTreeAcceptableDataSource> = Type extends BaseDataSource<infer X> ? X : Type extends Array<infer X> ? X : Type extends Observable<infer X> ? X extends Array<infer V> ? V : X : Type;

declare class TreeDataSourceParser<T> implements DataSourceParser<T, FdTreeDataSource<T>> {
    /**
     * Transforms plain array or observable into DataSource class.
     * @param source
     */
    parse(source: FdTreeAcceptableDataSource<T>): FdTreeDataSource<T> | undefined;
}

interface TreeItemDefContext<T = any> {
    $implicit: T;
}

type TreeItemState = 'default' | 'error' | 'success' | 'warning';
interface TreeItem<T = any> {
    id: string;
    children: FdTreeAcceptableDataSource<Partial<TreeItem<T>>>;
    expanded: boolean;
    navigatable: boolean;
    navigationIndicator: boolean;
    data: T;
    level: number;
    renderer: TemplateRef<TreeItemDefContext<T>>;
    state: TreeItemState;
    parentId: string;
}
type TreeItemGeneric<Type> = Type extends TreeItem<infer X> ? X : never;

declare class TreeItemDefDirective<T extends TreeItem = TreeItem> {
    /**
     * @hidden
     * Used for type support.
     */
    fdTreeItemDefAs: T;
    /** Template reference. */
    readonly templateRef: TemplateRef<TreeItemDefContext<T>>;
    /** @hidden */
    static ngTemplateContextGuard(dir: TreeItemDefDirective, ctx: TreeItemDefContext): ctx is TreeItemDefContext;
    static ɵfac: i0.ɵɵFactoryDeclaration<TreeItemDefDirective<any>, never>;
    static ɵdir: i0.ɵɵDirectiveDeclaration<TreeItemDefDirective<any>, "[fdTreeItemDef]", never, { "fdTreeItemDefAs": { "alias": "fdTreeItemDefAs"; "required": false; }; }, {}, never, never, true, never>;
}

/**
 * Abstract base class for tree item components.
 * Defines the contract for tree item implementations with navigation, selection, and hierarchy support.
 * @template T - The tree item type extending TreeItem
 * @template P - The value type of the tree item (defaults to any)
 */
declare abstract class BaseTreeItem<T extends TreeItem = TreeItem, P = any> implements Partial<SelectableItemToken<HTMLElement, P>> {
    /**
     * The data value associated with this tree item.
     */
    abstract value: P;
    /**
     * Unique identifier for the tree item.
     */
    abstract id: string;
    /**
     * ID of the parent tree item, or null if this is a root item.
     */
    abstract parentId: Nullable<string>;
    /**
     * Whether the tree item can be navigated to via keyboard or mouse interaction.
     */
    abstract navigatable: boolean;
    /**
     * Current state of the tree item (e.g., loading, error, success).
     */
    abstract state: Nullable<TreeItemState>;
    /**
     * Data source for child nodes, can be an array or DataSource instance.
     */
    abstract childNodes: FdTreeAcceptableDataSource<T>;
    /**
     * Whether the content text should wrap to multiple lines.
     */
    abstract wrapContent: boolean;
    /**
     * Whether the tree item is currently expanded to show its children.
     */
    abstract expanded: boolean;
    /**
     * The hierarchical level of this item in the tree (root level is 1).
     */
    abstract level: number;
    /**
     * Array of child tree items.
     */
    abstract children: T[];
    /**
     * Whether the tree item has children defined via content projection.
     */
    abstract hasProjectedChildren: boolean;
    /**
     * Whether the tree item has any children (projected or from data source).
     */
    abstract hasChildren: boolean;
    /**
     * Reference to the focusable container element of the tree item.
     */
    abstract itemContainer: Nullable<ElementRef>;
    /**
     * Whether the tree item can receive keyboard focus for navigation.
     */
    abstract keyboardAccessible: boolean;
    /**
     * Reference to the selectable item directive for selection management.
     */
    abstract selectableListItem: SelectableItemToken;
    /**
     * Whether the tree item has children provided by a DataSource.
     */
    abstract hasDsChildren: boolean;
    /**
     * Whether children from DataSource have finished loading.
     */
    abstract childrenLoaded: boolean;
    /**
     * Reference to the host element of the tree item.
     */
    abstract elementRef: ElementRef;
    /**
     * Sets focus on the tree item.
     */
    abstract focus(): void;
    /**
     * Updates the ARIA position information for the item.
     * @param totalItemsCount - Total number of items in the set
     * @param currentIndex - Current position index (0-based)
     */
    abstract setPosition(totalItemsCount: number, currentIndex: number): void;
    /**
     * Sets the tabindex value for the item's container element.
     * @param value - The tabindex value (typically 0 for focusable, -1 for not focusable)
     */
    abstract setContainerTabIndex(value: number): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<BaseTreeItem<any, any>, never>;
    static ɵdir: i0.ɵɵDirectiveDeclaration<BaseTreeItem<any, any>, never, never, {}, {}, never, never, true, never>;
}

declare class TreeItemDirective<T extends TreeItem, P> implements OnDestroy {
    /** Tree item component instance. */
    treeItem: Nullable<BaseTreeItem<T, P>>;
    /** Injector to be used in a tree item component, to resolve a tree item directive. */
    readonly injector: Injector;
    /** @hidden */
    constructor(injector: Injector);
    /** Sets tree item. */
    setTreeItem(item: Nullable<BaseTreeItem<T, P>>): void;
    /** @hidden */
    ngOnDestroy(): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<TreeItemDirective<any, any>, never>;
    static ɵdir: i0.ɵɵDirectiveDeclaration<TreeItemDirective<any, any>, "[fdTreeItem]", ["fdTreeItem"], {}, {}, never, never, true, never>;
}

type SelectionType = 'none' | 'single' | 'multiple';
/**
 * Selection control placement.
 * - 'left' will place control at the most left side of the tree item;
 * - 'right' will place control at the most right side of the tree item;
 * - 'none' will not render the control, but selection will still work according to `SelectionType` mode;
 * - 'afterExpand' will place control right after the expansion button (if present) or on the left side of the tree item,
 * if expansion button is not present.
 */
type SelectionPlacement = 'left' | 'right' | 'none' | 'afterExpand';

interface SelectionModeModel {
    mode: SelectionType;
    placement: SelectionPlacement;
}
declare class TreeService {
    /** Tree item template ref. */
    treeItemTemplateRef: Nullable<TemplateRef<TreeItemDefContext>>;
    /** Currently focused tree item. */
    focusedTreeItem: Nullable<BaseTreeItem>;
    /** Current expanded level. */
    get expandedLevel(): Signal<number | undefined>;
    /** Tree selection mode. */
    get selectionMode(): Signal<SelectionModeModel>;
    /** Whether to show navigation indicator. */
    get navigationIndicator(): Signal<boolean>;
    /**
     * @hidden
     */
    readonly detectChanges: Subject<void>;
    /** @hidden */
    private readonly _expandableItems;
    /** @hidden */
    private readonly _selectionMode$;
    /** @hidden */
    private readonly _expandedLevel;
    /** @hidden */
    private readonly _navigationIndicator$;
    /** Sets whether the navigation indicator should be visible. */
    setNavigationIndicator(value: boolean): void;
    /** @hidden */
    normalizeTreeItems<T extends TreeItem = TreeItem>(items: Nullable<T[]>, parentId?: string | null, level?: number): TreeItem<TreeItemGeneric<T>>[];
    /**
     * Adds expandable item to the object of expandable items.
     * @param id
     * @param level
     */
    addExpandableItem(id: string, level: number, expanded: boolean): void;
    /**
     * Removes expandable item from the object of expandable items.
     * @param id
     * @param level
     */
    removeExpandableItem(id: string, level: number): void;
    /**
     * Sets selection mode and it's placement.
     * @param mode Selection mode.
     * @param placement Selection control placement.
     */
    setSelectionMode(mode: SelectionType, placement: SelectionPlacement): void;
    /** @hidden */
    private _emitNewExpandedLevel;
    static ɵfac: i0.ɵɵFactoryDeclaration<TreeService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<TreeService>;
}

declare class TreeComponent<P extends FdTreeAcceptableDataSource, T extends TreeItem = FdTreeItemType<P>> implements CssClassBuilder, OnInit, OnChanges, AfterViewInit, SelectComponentRootToken, OnDestroy {
    /** @hidden */
    class: string;
    /**
     * Whether the tree should be borderless.
     */
    noBorder: boolean;
    /** Type of tree items selection. */
    selection: SelectionType;
    /** Placement of the selection control. */
    selectionPlacement: SelectionPlacement;
    /**
     * Whether the sections should be dependent for selection mode.
     * If true, selection control will shift, according to the level.
     * If false, selection control will stay on the same place ignoring the item level.
     */
    independentSections: boolean;
    /**
     * Whether the Tree component has navigation indicators.
     */
    set navigationIndicator(value: boolean);
    get navigationIndicator(): boolean;
    /** Event emitted when data loading is started. */
    dataRequested: EventEmitter<boolean>;
    /** Event emitted when data loading is finished. */
    dataReceived: EventEmitter<boolean>;
    /** Event emitted when selected state changed. */
    selectedChange: EventEmitter<any>;
    /** Tree item template definition. */
    set treeItemDef(value: Nullable<TreeItemDefDirective>);
    get treeItemDef(): Nullable<TreeItemDefDirective>;
    /** @hidden */
    _treeItemDirectives: QueryList<TreeItemDirective<TreeItem, any>>;
    /** @hidden */
    readonly _projectedTreeItems: QueryList<BaseTreeItem>;
    /** @hidden */
    _items: TreeItem<TreeItemGeneric<T>>[];
    /** @hidden */
    get multiple(): boolean;
    /** @hidden */
    get toggle(): boolean;
    /**
     * @hidden
     * Used for skeleton to appear before first meaningful data being loaded.
     */
    _initialDataLoaded: boolean;
    /** @hidden */
    readonly loadingRange: number[];
    /** @hidden */
    readonly elementRef: ElementRef<any>;
    /** @hidden */
    readonly _treeService: TreeService;
    /** @hidden */
    private _navigationIndicator;
    /** @hidden */
    private _treeItemDef;
    /** @hidden */
    private readonly _contentDensityObserver;
    /** @hidden */
    private readonly _dataSourceDirective;
    /** @hidden */
    private readonly _destroyRef;
    /** @hidden */
    private readonly _selectionService;
    /** @hidden */
    private readonly _rtlService;
    /** @hidden */
    private readonly _cvaDirective;
    /** @hidden */
    private readonly _cdr;
    /** @hidden */
    private _dsSubscription;
    /** @hidden */
    private _expandedLevel;
    /** @hidden */
    private _focusKeyManager;
    /**
     * @hidden
     * Sorted tree item components.
     */
    private _sortedTreeItems;
    /**
     * @hidden
     * All tree item components.
     */
    private _allItems;
    /** @hidden */
    private _eventSub;
    /** @hidden */
    private _selectionSub;
    /** @hidden */
    constructor();
    /** @hidden */
    buildComponentCssClass(): string[];
    /**
     * @hidden
     * Keyboard navigation
     * @param event Keyboard event.
     */
    protected _onKeyUp(event: KeyboardEvent): void;
    /** @hidden */
    ngOnInit(): void;
    /** @hidden */
    ngOnChanges(changes: SimpleChanges): void;
    /** @hidden */
    ngAfterViewInit(): void;
    /** @hidden */
    ngOnDestroy(): void;
    /** @hidden */
    _onItemFocused(treeItem: BaseTreeItem): void;
    /** @hidden */
    _onItemKeyDown(event: KeyboardEvent, treeItem: Nullable<BaseTreeItem>): void;
    /** @hidden */
    _trackFn(index: number, item: TreeItem<TreeItemGeneric<T>>): string;
    /**
     * @hidden
     * Select list interface method implementation.
     * Sets value for control value accessor and emits it.
     * @param value value of the selection.
     */
    onChange(value: SelectableListValueType<any>): void;
    /** @hidden */
    private _expandTreeSection;
    /** @hidden */
    private _collapseTreeSection;
    /** @hidden */
    private _openDataStream;
    /** @hidden */
    private _setupEventListeners;
    /** @hidden */
    private _sortTreeItems;
    /** @hidden */
    private _setSelectionListener;
    /** @hidden */
    private _listenToTreeItemDirectiveChanges;
    /** @hidden */
    private _listenToTreeItemsChanges;
    /** @hidden */
    private _setFlattenedItems;
    static ɵfac: i0.ɵɵFactoryDeclaration<TreeComponent<any, any>, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<TreeComponent<any, any>, "fd-tree", never, { "class": { "alias": "class"; "required": false; }; "noBorder": { "alias": "noBorder"; "required": false; }; "selection": { "alias": "selection"; "required": false; }; "selectionPlacement": { "alias": "selectionPlacement"; "required": false; }; "independentSections": { "alias": "independentSections"; "required": false; }; "navigationIndicator": { "alias": "navigationIndicator"; "required": false; }; }, { "dataRequested": "dataRequested"; "dataReceived": "dataReceived"; "selectedChange": "selectedChange"; }, ["treeItemDef", "_projectedTreeItems"], ["fd-tree-item"], true, [{ directive: typeof i1.DataSourceDirective; inputs: { "dataSource": "dataSource"; }; outputs: { "dataChanged": "dataChanged"; }; }, { directive: typeof i2.CvaDirective; inputs: { "name": "name"; "id": "id"; "state": "state"; "stateMessage": "stateMessage"; "disabled": "disabled"; "readonly": "readonly"; }; outputs: {}; }]>;
}

declare class TreeItemComponent<T extends TreeItem = TreeItem, P = any> extends BaseTreeItem<T, P> implements Partial<SelectableItemToken<HTMLElement, P>>, OnInit, AfterViewInit, OnDestroy, HasElementRef {
    /**
     * Tree item value.
     */
    value: P;
    /**
     * Tree item ID.
     */
    id: string;
    /**
     * Tree item aria label.
     */
    ariaLabel: string;
    /**
     * Tree item parent ID.
     */
    set parentId(value: Nullable<string>);
    get parentId(): Nullable<string>;
    /**
     * Whether the tree item is navigatable.
     */
    navigatable: boolean;
    /**
     * Tree item state.
     */
    state: Nullable<TreeItemState>;
    /**
     * Tree item child nodes data source.
     */
    childNodes: FdTreeAcceptableDataSource<T>;
    /**
     * Whether to wrap content.
     */
    wrapContent: boolean;
    /**
     * Tree item level.
     */
    set level(value: number);
    get level(): number;
    /**
     * Whether the tree item is expanded.
     */
    set expanded(value: boolean);
    get expanded(): boolean;
    /**
     * Event emitted when user clicks on tree item.
     */
    readonly treeItemClick: EventEmitter<MouseEvent | KeyboardEvent>;
    /**
     * Event emitted when `expanded` state changes.
     */
    expandedChange: EventEmitter<boolean>;
    /** Tree item focusable container. */
    itemContainer: Nullable<ElementRef<HTMLElement>>;
    /** Selectable item. */
    selectableListItem: SelectableItemToken;
    /** @hidden */
    _projectedTreeItems: QueryList<BaseTreeItem>;
    /**
     * @hidden
     * Selection state.
     */
    _selectionState: boolean;
    /** @hidden */
    children: T[];
    /** @hidden */
    childrenLoaded: boolean;
    /** @Hidden */
    _containerTabIndex: number;
    /** @hidden */
    _setSize: number;
    /** @hidden */
    _currentPosition: number;
    /** @hidden */
    _totalChildrenLoaded: boolean;
    /** Clicked behavior implementation. */
    clicked: Observable<MouseEvent | KeyboardEvent>;
    /** @hidden */
    readonly elementRef: ElementRef<any>;
    /** @hidden */
    readonly _treeService: TreeService;
    /** Whether the tree item has any type of child nodes. */
    get hasChildren(): boolean;
    /** Whether the tree item has content-projected child nodes. */
    get hasProjectedChildren(): boolean;
    /** Whether the tree item has data source children. */
    get hasDsChildren(): boolean;
    /** Whether the item is accessible via keyboard. */
    get keyboardAccessible(): boolean;
    /**
     * Custom background color
     */
    backgroundColor: i0.InputSignal<string | undefined>;
    /**
     * Custom styles
     */
    customStyles: i0.InputSignal<object | undefined>;
    /** @hidden */
    private _parentId;
    /** @hidden */
    private _level;
    /** @hidden */
    private _expanded;
    /** @hidden */
    private _dsChildrenNumber;
    /** @hidden */
    private readonly _clicked$;
    /** @hidden */
    private readonly _treeItemDir;
    /** @hidden */
    private readonly _dataSourceDirective;
    /** @hidden */
    private readonly _cdr;
    /** @hidden */
    private readonly _destroyRef;
    /** @hidden */
    private readonly _parentTreeItem;
    /** @hidden */
    constructor();
    /** @hidden */
    ngOnInit(): void;
    /** @hidden */
    ngAfterViewInit(): void;
    /** @hidden */
    ngOnDestroy(): void;
    /**
     * Sets position of the current item in the set.
     * @param totalItems Total items amount in the set.
     * @param currentIndex Current item position in the set.
     */
    setPosition(totalItems: number, currentIndex: number): void;
    /** Method to focus on the tree item. */
    focus(): void;
    /** Method for setting the focusable tabindex. */
    setContainerTabIndex(value: number): void;
    /** @hidden */
    _toggleExpandState(event: MouseEvent): void;
    /** @hidden */
    _onClick(event: MouseEvent | KeyboardEvent): void;
    /** @hidden */
    _setSelected(selected: boolean): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<TreeItemComponent<any, any>, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<TreeItemComponent<any, any>, "fd-tree-item", never, { "value": { "alias": "value"; "required": false; }; "id": { "alias": "id"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "parentId": { "alias": "parentId"; "required": false; }; "navigatable": { "alias": "navigatable"; "required": false; }; "state": { "alias": "state"; "required": false; }; "childNodes": { "alias": "childNodes"; "required": false; }; "wrapContent": { "alias": "wrapContent"; "required": false; }; "level": { "alias": "level"; "required": false; }; "expanded": { "alias": "expanded"; "required": false; }; "backgroundColor": { "alias": "backgroundColor"; "required": false; "isSignal": true; }; "customStyles": { "alias": "customStyles"; "required": false; "isSignal": true; }; }, { "treeItemClick": "treeItemClick"; "expandedChange": "expandedChange"; }, ["_projectedTreeItems"], ["[fdTreeItemIcon]", "[fdTreeItemText]", "[fdTreeItemButton]", "fd-tree-item"], true, [{ directive: typeof i1.DataSourceDirective; inputs: {}; outputs: {}; }]>;
}

declare class TreeItemIconDirective {
    /** @hidden */
    protected readonly _role = "presentation";
    /** @hidden */
    protected readonly _ariaHidden = true;
    static ɵfac: i0.ɵɵFactoryDeclaration<TreeItemIconDirective, never>;
    static ɵdir: i0.ɵɵDirectiveDeclaration<TreeItemIconDirective, "[fdTreeItemIcon]", never, {}, {}, never, never, true, never>;
}
declare class TreeItemTextDirective {
    static ɵfac: i0.ɵɵFactoryDeclaration<TreeItemTextDirective, never>;
    static ɵdir: i0.ɵɵDirectiveDeclaration<TreeItemTextDirective, "[fdTreeItemText]", never, {}, {}, never, never, true, never>;
}

declare class TreeItemButtonDirective {
    static ɵfac: i0.ɵɵFactoryDeclaration<TreeItemButtonDirective, never>;
    static ɵdir: i0.ɵɵDirectiveDeclaration<TreeItemButtonDirective, "[fdTreeItemButton]", never, {}, {}, never, never, true, never>;
}

/**
 * @deprecated
 *
 * Use direct imports of `TreeComponent`,
        `TreeItemComponent`,
        `TreeItemDefDirective`,
        `TreeItemDirective`,
        `TreeItemIconDirective`,
        `TreeItemTextDirective`,
        `TreeItemButtonDirective`
 */
declare class TreeModule {
    static ɵfac: i0.ɵɵFactoryDeclaration<TreeModule, never>;
    static ɵmod: i0.ɵɵNgModuleDeclaration<TreeModule, never, [typeof TreeComponent, typeof TreeItemComponent, typeof TreeItemDefDirective, typeof TreeItemDirective, typeof TreeItemIconDirective, typeof TreeItemTextDirective, typeof TreeItemButtonDirective], [typeof TreeComponent, typeof TreeItemComponent, typeof TreeItemDefDirective, typeof TreeItemDirective, typeof TreeItemIconDirective, typeof TreeItemTextDirective, typeof TreeItemButtonDirective]>;
    static ɵinj: i0.ɵɵInjectorDeclaration<TreeModule>;
}

declare const FD_TREE_ITEM: InjectionToken<unknown>;

export { ArrayTreeDataSource, BaseTreeItem, FD_TREE_ITEM, FdTreeDataSource, ObservableTreeDataSource, TreeComponent, TreeDataSourceParser, TreeItemButtonDirective, TreeItemComponent, TreeItemDefDirective, TreeItemDirective, TreeItemIconDirective, TreeItemTextDirective, TreeModule };
export type { FdTreeAcceptableDataSource, FdTreeItemType, SelectionPlacement, SelectionType, TreeItem, TreeItemDefContext, TreeItemGeneric, TreeItemState };
