import { StandardMouseEvent } from "../../../base/browser/mouseEvent.js";
import { IAnchor } from "../../../base/browser/ui/contextview/contextview.js";
import { IListAccessibilityProvider } from "../../../base/browser/ui/list/listWidget.js";
import { IAction } from "../../../base/common/actions.js";
import { CancellationToken } from "../../../base/common/cancellation.js";
import { IMarkdownString, MarkdownString } from "../../../base/common/htmlContent.js";
import { ResolvedKeybinding } from "../../../base/common/keybindings.js";
import { AnchorPosition } from "../../../base/common/layout.js";
import { Disposable } from "../../../base/common/lifecycle.js";
import { ThemeIcon } from "../../../base/common/themables.js";
import { URI } from "../../../base/common/uri.js";
import { IContextViewService } from "../../contextview/browser/contextView.service.js";
import { IKeybindingService } from "../../keybinding/common/keybinding.service.js";
import { IOpenerService } from "../../opener/common/opener.service.js";
import { ILayoutService } from "../../layout/browser/layoutService.service.js";
import { IInstantiationService } from "../../instantiation/common/instantiation.js";
import { IHoverService } from "../../hover/browser/hover.service.js";
import { IHoverPositionOptions } from "../../../base/browser/ui/hover/hover.js";
export declare const acceptSelectedActionCommand = "acceptSelectedCodeAction";
export declare const previewSelectedActionCommand = "previewSelectedCodeAction";
export interface IActionListDelegate<T> {
    onHide(didCancel?: boolean): void;
    onSelect(action: T, preview?: boolean): void;
    onHover?(action: T, cancellationToken: CancellationToken): Promise<{
        canPreview: boolean;
    } | void>;
    onFocus?(action: T | undefined): void;
}
/**
 * Optional hover configuration shown when focusing/hovering over an action list item.
 */
export interface IActionListItemHover {
    /**
     * Content to display in the hover.
     */
    readonly content?: string | MarkdownString;
    readonly position?: IHoverPositionOptions;
}
export interface IActionListItem<T> {
    readonly item?: T;
    readonly kind: ActionListItemKind;
    readonly group?: {
        kind?: unknown;
        icon?: ThemeIcon;
        title: string;
    };
    readonly disabled?: boolean;
    readonly label?: string;
    readonly description?: string | IMarkdownString;
    /**
     * Optional hover configuration shown when focusing/hovering over the item.
     */
    readonly hover?: IActionListItemHover;
    /**
     * Optional actions shown in a nested submenu panel, triggered by a chevron
     * indicator on the right side of the item. When set, hovering or clicking
     * the chevron opens an inline submenu with these actions.
     */
    readonly submenuActions?: IAction[];
    readonly keybinding?: ResolvedKeybinding;
    canPreview?: boolean | undefined;
    readonly hideIcon?: boolean;
    readonly tooltip?: string;
    /**
     * Optional toolbar actions shown when the item is focused or hovered.
     */
    readonly toolbarActions?: IAction[];
    /**
     * Optional section identifier. Items with the same section belong to the same
     * collapsible group. Only meaningful when the ActionList is created with
     * collapsible sections.
     */
    readonly section?: string;
    /**
     * When true, clicking this item toggles the section's collapsed state
     * instead of selecting it.
     */
    readonly isSectionToggle?: boolean;
    /**
     * Optional CSS class name to add to the row container.
     */
    readonly className?: string;
    /**
     * Optional badge text to display after the label (e.g., "New").
     */
    readonly badge?: string;
    /**
     * When true, this item is always shown when filtering produces no other results.
     */
    readonly showAlways?: boolean;
    /**
     * Optional callback invoked when the item is removed via the built-in remove button.
     * When set, a close button is automatically added to the item toolbar.
     */
    readonly onRemove?: () => void;
}
export declare enum ActionListItemKind {
    Action = "action",
    Header = "header",
    Separator = "separator"
}
/**
 * Options for configuring the action list.
 */
export interface IActionListOptions {
    /**
     * When true, shows a filter input.
     */
    readonly showFilter?: boolean;
    /**
     * Placeholder text for the filter input.
     */
    readonly filterPlaceholder?: string;
    /**
     * Optional actions shown in the filter row, to the right of the input.
     */
    readonly filterActions?: readonly IAction[];
    /**
     * Section IDs that should be collapsed by default.
     */
    readonly collapsedByDefault?: ReadonlySet<string>;
    /**
     * Minimum width for the action list.
     */
    readonly minWidth?: number;
    /**
     * Optional handler for markdown links activated in item descriptions or hovers.
     * When unset, links open via the opener service with command links allowed.
     */
    readonly linkHandler?: (uri: URI, item: IActionListItem<unknown>) => void;
    /**
     * Optional callback fired when a section's collapsed state changes.
     */
    readonly onDidToggleSection?: (section: string, collapsed: boolean) => void;
    /**
     * When true, descriptions are rendered as subtext below the title
     * instead of inline to the right.
     */
    readonly descriptionBelow?: boolean;
    /**
     * When true and filtering is enabled, focuses the filter input when the list opens.
     */
    readonly focusFilterOnOpen?: boolean;
}
/**
 * A standalone action list widget that handles core list rendering, filtering,
 * hover, submenu, and section management without depending on IContextViewService
 * or anchor-based positioning. Suitable for embedding directly in any container.
 */
export declare class ActionListWidget<T> extends Disposable {
    protected readonly _delegate: IActionListDelegate<T>;
    protected readonly _options: IActionListOptions | undefined;
    private readonly _keybindingService;
    private readonly _hoverService;
    private readonly _openerService;
    private readonly _instantiationService;
    readonly domNode: HTMLElement;
    private readonly _list;
    protected readonly _actionLineHeight: number;
    protected readonly _headerLineHeight = 24;
    protected readonly _separatorLineHeight = 8;
    protected _allMenuItems: IActionListItem<T>[];
    private readonly cts;
    private _hover;
    private readonly _submenuDisposables;
    private readonly _submenuContainer;
    private _submenuHideTimeout;
    private _submenuShowTimeout;
    private _currentSubmenuWidget;
    private _currentSubmenuElement;
    private readonly _collapsedSections;
    private _filterText;
    private _suppressHover;
    private readonly _filterInput;
    private readonly _filterContainer;
    private readonly _onDidRequestLayout;
    /**
     * Fired when the widget's visible item set changes and the parent should
     * re-layout (e.g. after filtering or collapsing a section).
     */
    readonly onDidRequestLayout: import("../../../base/common/event.js").Event<void>;
    constructor(user: string, preview: boolean, items: readonly IActionListItem<T>[], _delegate: IActionListDelegate<T>, accessibilityProvider: Partial<IListAccessibilityProvider<IActionListItem<T>>> | undefined, _options: IActionListOptions | undefined, _keybindingService: IKeybindingService, _hoverService: IHoverService, _openerService: IOpenerService, _instantiationService: IInstantiationService);
    private _toggleSection;
    private _applyFilter;
    /**
     * Returns the filter container element, if filter is enabled.
     * The caller is responsible for appending it to the widget DOM.
     */
    get filterContainer(): HTMLElement | undefined;
    get filterInput(): HTMLInputElement | undefined;
    private focusCondition;
    focus(): void;
    getFocusedElement(): IActionListItem<T> | undefined;
    private _focusCheckedOrFirst;
    hide(didCancel?: boolean): void;
    clearFilter(): boolean;
    /**
     * Whether this widget uses dynamic height (has filter or collapsible sections).
     */
    get hasDynamicHeight(): boolean;
    /**
     * The height of a single action row in pixels.
     */
    get lineHeight(): number;
    /**
     * Computes the total height of all items (including collapsed/filtered items).
     */
    computeFullHeight(): number;
    /**
     * Computes the total height of visible items in the list.
     */
    computeListHeight(): number;
    /**
     * Lays out the list widget with the given explicit dimensions.
     */
    layout(height: number, width?: number): void;
    computeMaxWidth(minWidth: number): number;
    focusPrevious(): void;
    focusNext(): void;
    collapseFocusedSection(): void;
    expandFocusedSection(): void;
    toggleFocusedSection(): boolean;
    private _getFocusedSection;
    acceptSelected(preview?: boolean): void;
    private onListSelection;
    private onFocus;
    private _removeItem;
    private _computeToolbarWidth;
    private _getRowElement;
    private _showHoverForElement;
    private _showSubmenuForElement;
    private _hideSubmenu;
    private _scheduleSubmenuHide;
    private _cancelSubmenuHide;
    private _scheduleSubmenuShow;
    private _cancelSubmenuShow;
    private onListHover;
    private onListClick;
}
/**
 * An action list that wraps {@link ActionListWidget} with context-view positioning
 * and anchor-based height computation.
 */
export declare class ActionList<T> extends Disposable {
    private readonly _contextViewService;
    private readonly _layoutService;
    private readonly _widget;
    private readonly _anchor;
    private _lastMinWidth;
    private _cachedMaxWidth;
    private _hasLaidOut;
    private _showAbove;
    get domNode(): HTMLElement;
    get filterContainer(): HTMLElement | undefined;
    get filterInput(): HTMLInputElement | undefined;
    /**
     * Returns the resolved anchor position after the first layout.
     * Used by the context view delegate to lock the dropdown direction.
     */
    get anchorPosition(): AnchorPosition | undefined;
    constructor(user: string, preview: boolean, items: readonly IActionListItem<T>[], _delegate: IActionListDelegate<T>, accessibilityProvider: Partial<IListAccessibilityProvider<IActionListItem<T>>> | undefined, options: IActionListOptions | undefined, anchor: HTMLElement | StandardMouseEvent | IAnchor, _contextViewService: IContextViewService, _layoutService: ILayoutService, instantiationService: IInstantiationService);
    focus(): void;
    hide(didCancel?: boolean): void;
    clearFilter(): boolean;
    focusPrevious(): void;
    focusNext(): void;
    collapseFocusedSection(): void;
    expandFocusedSection(): void;
    toggleFocusedSection(): boolean;
    acceptSelected(preview?: boolean): void;
    private hasDynamicHeight;
    private computeHeight;
    layout(minWidth: number): number;
}
