import { Orientation } from "../../../../base/browser/ui/sash/sash.js";
import { Event, DynamicListEventMultiplexer, IDynamicListEventMultiplexer } from "../../../../base/common/event.js";
import { URI } from "../../../../base/common/uri.js";
import { TerminalCapability, ITerminalCapabilityImplMap } from "@codingame/monaco-vscode-a9da9abe-278d-5ce6-9418-99c7c07c5c37-common/vscode/vs/platform/terminal/common/capabilities/capabilities";
import { TerminalLocation, ITerminalBackend, ITerminalLaunchError, type IShellLaunchConfig, type ITerminalProfile } from "../../../../platform/terminal/common/terminal.js";
import { GroupIdentifier } from "../../../common/editor.js";
import { EditorInput } from "../../../common/editor/editorInput.js";
import { IEditableData } from "../../../common/views.js";
import { SIDE_GROUP_TYPE, ACTIVE_GROUP_TYPE, AUX_WINDOW_GROUP_TYPE } from "../../../services/editor/common/editorService.js";
import { IStartExtensionTerminalRequest, ITerminalProcessExtHostProxy, IRemoteTerminalAttachTarget, type ITerminalConfiguration, type ITerminalFont } from "@codingame/monaco-vscode-6883db80-c313-54eb-8fbc-5872c56b0326-common/vscode/vs/workbench/contrib/terminal/common/terminal";
import { ITerminalInstanceHost, ITerminalInstance, IDetachedTerminalInstance, TerminalConnectionState, ITerminalGroup, ICreateTerminalOptions, IDetachedXTermOptions, ITerminalLocationOptions, ITerminalServiceNativeDelegate, type IDeserializedTerminalEditorInput, type TerminalEditorLocation } from "./terminal.js";
import { IXtermCore } from "./xterm-private.js";
export declare const ITerminalService: import("../../../../platform/instantiation/common/instantiation.js").ServiceIdentifier<ITerminalService>;
export interface ITerminalService extends ITerminalInstanceHost {
    readonly _serviceBrand: undefined;
    /** Gets all terminal instances, including editor and terminal view (group) instances. */
    readonly instances: readonly ITerminalInstance[];
    /** Gets detached terminal instances created via {@link createDetachedXterm}. */
    readonly detachedInstances: Iterable<IDetachedTerminalInstance>;
    readonly defaultLocation: TerminalLocation;
    readonly isProcessSupportRegistered: boolean;
    readonly connectionState: TerminalConnectionState;
    readonly whenConnected: Promise<void>;
    /** The number of restored terminal groups on startup. */
    readonly restoredGroupCount: number;
    readonly onDidCreateInstance: Event<ITerminalInstance>;
    readonly onDidChangeInstanceDimensions: Event<ITerminalInstance>;
    readonly onDidRequestStartExtensionTerminal: Event<IStartExtensionTerminalRequest>;
    readonly onDidRegisterProcessSupport: Event<void>;
    readonly onDidChangeConnectionState: Event<void>;
    readonly onDidChangeActiveGroup: Event<ITerminalGroup | undefined>;
    readonly onAnyInstanceData: Event<{
        instance: ITerminalInstance;
        data: string;
    }>;
    readonly onAnyInstanceDataInput: Event<ITerminalInstance>;
    readonly onAnyInstanceIconChange: Event<{
        instance: ITerminalInstance;
        userInitiated: boolean;
    }>;
    readonly onAnyInstanceMaximumDimensionsChange: Event<ITerminalInstance>;
    readonly onAnyInstancePrimaryStatusChange: Event<ITerminalInstance>;
    readonly onAnyInstanceProcessIdReady: Event<ITerminalInstance>;
    readonly onAnyInstanceSelectionChange: Event<ITerminalInstance>;
    readonly onAnyInstanceTitleChange: Event<ITerminalInstance>;
    readonly onAnyInstanceShellTypeChanged: Event<ITerminalInstance>;
    readonly onAnyInstanceAddedCapabilityType: Event<TerminalCapability>;
    /**
    * Creates a terminal.
    * @param options The options to create the terminal with, when not specified the default
    * profile will be used at the default target.
    */
    createTerminal(options?: ICreateTerminalOptions): Promise<ITerminalInstance>;
    /**
    * Creates a detached xterm instance which is not attached to the DOM or
    * tracked as a terminal instance.
    * @params options The options to create the terminal with
    */
    createDetachedTerminal(options: IDetachedXTermOptions): Promise<IDetachedTerminalInstance>;
    /**
    * Creates a raw terminal instance, this should not be used outside of the terminal part.
    */
    getInstanceFromId(terminalId: number): ITerminalInstance | undefined;
    getInstanceFromIndex(terminalIndex: number): ITerminalInstance;
    /**
    * An owner of terminals might be created after reconnection has occurred,
    * so store them to be requested/adopted later
    */
    getReconnectedTerminals(reconnectionOwner: string): ITerminalInstance[] | undefined;
    getActiveOrCreateInstance(options?: {
        acceptsInput?: boolean;
    }): Promise<ITerminalInstance>;
    revealTerminal(source: ITerminalInstance, preserveFocus?: boolean): Promise<void>;
    revealActiveTerminal(preserveFocus?: boolean): Promise<void>;
    moveToEditor(source: ITerminalInstance, group?: GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE | AUX_WINDOW_GROUP_TYPE): void;
    moveIntoNewEditor(source: ITerminalInstance): void;
    moveToTerminalView(source: ITerminalInstance | URI): Promise<void>;
    getPrimaryBackend(): ITerminalBackend | undefined;
    /**
    * Fire the onActiveTabChanged event, this will trigger the terminal dropdown to be updated,
    * among other things.
    */
    refreshActiveGroup(): void;
    registerProcessSupport(isSupported: boolean): void;
    showProfileQuickPick(type: "setDefault" | "createInstance", cwd?: string | URI): Promise<ITerminalInstance | undefined>;
    setContainers(panelContainer: HTMLElement, terminalContainer: HTMLElement): void;
    requestStartExtensionTerminal(proxy: ITerminalProcessExtHostProxy, cols: number, rows: number): Promise<ITerminalLaunchError | undefined>;
    isAttachedToTerminal(remoteTerm: IRemoteTerminalAttachTarget): boolean;
    getEditableData(instance: ITerminalInstance): IEditableData | undefined;
    setEditable(instance: ITerminalInstance, data: IEditableData | null): void;
    isEditable(instance: ITerminalInstance | undefined): boolean;
    safeDisposeTerminal(instance: ITerminalInstance): Promise<void>;
    getDefaultInstanceHost(): ITerminalInstanceHost;
    getInstanceHost(target: ITerminalLocationOptions | undefined): Promise<ITerminalInstanceHost>;
    resolveLocation(location?: ITerminalLocationOptions): Promise<TerminalLocation | undefined>;
    setNativeDelegate(nativeCalls: ITerminalServiceNativeDelegate): void;
    getEditingTerminal(): ITerminalInstance | undefined;
    setEditingTerminal(instance: ITerminalInstance | undefined): void;
    /**
    * Creates an instance event listener that listens to all instances, dynamically adding new
    * instances and removing old instances as needed.
    * @param getEvent Maps the instance to the event.
    */
    createOnInstanceEvent<T>(getEvent: (instance: ITerminalInstance) => Event<T>): DynamicListEventMultiplexer<ITerminalInstance, T>;
    /**
    * Creates a capability event listener that listens to capabilities on all instances,
    * dynamically adding and removing instances and capabilities as needed.
    * @param capabilityId The capability type to listen to an event on.
    * @param getEvent Maps the capability to the event.
    */
    createOnInstanceCapabilityEvent<T extends TerminalCapability, K>(capabilityId: T, getEvent: (capability: ITerminalCapabilityImplMap[T]) => Event<K>): IDynamicListEventMultiplexer<{
        instance: ITerminalInstance;
        data: K;
    }>;
}
export declare const ITerminalConfigurationService: import("../../../../platform/instantiation/common/instantiation.js").ServiceIdentifier<ITerminalConfigurationService>;
/**
* A service that provides convenient access to the terminal configuration and derived values.
*/
export interface ITerminalConfigurationService {
    readonly _serviceBrand: undefined;
    /**
    * A typed and partially validated representation of the terminal configuration.
    */
    readonly config: Readonly<ITerminalConfiguration>;
    /**
    * Fires when something within the terminal configuration changes.
    */
    readonly onConfigChanged: Event<void>;
    setPanelContainer(panelContainer: HTMLElement): void;
    configFontIsMonospace(): boolean;
    getFont(w: Window, xtermCore?: IXtermCore, excludeDimensions?: boolean): ITerminalFont;
}
export declare const ITerminalEditorService: import("../../../../platform/instantiation/common/instantiation.js").ServiceIdentifier<ITerminalEditorService>;
/**
* This service is responsible for integrating with the editor service and managing terminal
* editors.
*/
export interface ITerminalEditorService extends ITerminalInstanceHost {
    readonly _serviceBrand: undefined;
    /** Gets all _terminal editor_ instances. */
    readonly instances: readonly ITerminalInstance[];
    openEditor(instance: ITerminalInstance, editorOptions?: TerminalEditorLocation): Promise<void>;
    detachInstance(instance: ITerminalInstance): void;
    splitInstance(instanceToSplit: ITerminalInstance, shellLaunchConfig?: IShellLaunchConfig): ITerminalInstance;
    revealActiveEditor(preserveFocus?: boolean): Promise<void>;
    resolveResource(instance: ITerminalInstance): URI;
    reviveInput(deserializedInput: IDeserializedTerminalEditorInput): EditorInput;
    getInputFromResource(resource: URI): EditorInput;
}
export declare const ITerminalGroupService: import("../../../../platform/instantiation/common/instantiation.js").ServiceIdentifier<ITerminalGroupService>;
/**
* This service is responsible for managing terminal groups, that is the terminals that are hosted
* within the terminal panel, not in an editor.
*/
export interface ITerminalGroupService extends ITerminalInstanceHost {
    readonly _serviceBrand: undefined;
    /** Gets all _terminal view_ instances, ie. instances contained within terminal groups. */
    readonly instances: readonly ITerminalInstance[];
    readonly groups: readonly ITerminalGroup[];
    activeGroup: ITerminalGroup | undefined;
    readonly activeGroupIndex: number;
    /**
    * Gets or sets the last accessed menu, this is used to select the instance(s) for menu actions.
    */
    lastAccessedMenu: "inline-tab" | "tab-list";
    readonly onDidChangeActiveGroup: Event<ITerminalGroup | undefined>;
    readonly onDidDisposeGroup: Event<ITerminalGroup>;
    /** Fires when a group is created, disposed of, or shown (in the case of a background group). */
    readonly onDidChangeGroups: Event<void>;
    /** Fires when the panel has been shown and expanded, so has non-zero dimensions. */
    readonly onDidShow: Event<void>;
    readonly onDidChangePanelOrientation: Event<Orientation>;
    createGroup(shellLaunchConfig?: IShellLaunchConfig): ITerminalGroup;
    createGroup(instance?: ITerminalInstance): ITerminalGroup;
    getGroupForInstance(instance: ITerminalInstance): ITerminalGroup | undefined;
    /**
    * Moves a terminal instance's group to the target instance group's position.
    * @param source The source instance to move.
    * @param target The target instance to move the source instance to.
    */
    moveGroup(source: ITerminalInstance | ITerminalInstance[], target: ITerminalInstance): void;
    moveGroupToEnd(source: ITerminalInstance | ITerminalInstance[]): void;
    moveInstance(source: ITerminalInstance, target: ITerminalInstance, side: "before" | "after"): void;
    unsplitInstance(instance: ITerminalInstance): void;
    joinInstances(instances: ITerminalInstance[]): void;
    instanceIsSplit(instance: ITerminalInstance): boolean;
    getGroupLabels(): string[];
    setActiveGroupByIndex(index: number): void;
    setActiveGroupToNext(): void;
    setActiveGroupToPrevious(): void;
    setActiveInstanceByIndex(terminalIndex: number): void;
    setContainer(container: HTMLElement): void;
    showPanel(focus?: boolean): Promise<void>;
    hidePanel(): void;
    focusTabs(): void;
    focusHover(): void;
    updateVisibility(): void;
}
export declare const ITerminalInstanceService: import("../../../../platform/instantiation/common/instantiation.js").ServiceIdentifier<ITerminalInstanceService>;
/**
* A service used to create instances or fetch backends, this services allows services that
* ITerminalService depends on to also create instances.
*
* **This service is intended to only be used within the terminal contrib.**
*/
export interface ITerminalInstanceService {
    readonly _serviceBrand: undefined;
    /**
    * An event that's fired when a terminal instance is created.
    */
    onDidCreateInstance: Event<ITerminalInstance>;
    /**
    * An event that's fired when a new backend is registered.
    */
    onDidRegisterBackend: Event<ITerminalBackend>;
    /**
    * Helper function to convert a shell launch config, a profile or undefined into its equivalent
    * shell launch config.
    * @param shellLaunchConfigOrProfile A shell launch config, a profile or undefined
    * @param cwd A cwd to override.
    */
    convertProfileToShellLaunchConfig(shellLaunchConfigOrProfile?: IShellLaunchConfig | ITerminalProfile, cwd?: string | URI): IShellLaunchConfig;
    /**
    * Create a new terminal instance.
    * @param launchConfig The shell launch config.
    * @param target The target of the terminal.
    */
    createInstance(launchConfig: IShellLaunchConfig, target: TerminalLocation): ITerminalInstance;
    /**
    * Gets the registered backend for a remote authority (undefined = local). This is a convenience
    * method to avoid using the more verbose fetching from the registry.
    * @param remoteAuthority The remote authority of the backend.
    */
    getBackend(remoteAuthority?: string): Promise<ITerminalBackend | undefined>;
    getRegisteredBackends(): IterableIterator<ITerminalBackend>;
    didRegisterBackend(backend: ITerminalBackend): void;
}
