// Generated by dts-bundle-generator v9.5.1

import { ChildProcess } from 'node:child_process';
import { EventEmitter } from 'node:events';

export interface DeviceListOutput {
	deviceList: string[];
}
export interface IosCommandResult {
	command: string;
	args: string[];
	output: CommandOutput;
	logMessages: LogMessage[];
	exitCode: number;
	raw: {
		stdout: string;
		stderr: string;
	};
}
export interface LogMessage {
	level: "info" | "error" | "warn" | "debug";
	msg: string;
	time: string;
	err?: string;
}
export type CommandOutput = Record<string, unknown>[] | DeviceListOutput[] | [
	LockdownInfo
];
export interface IosListResult {
	udids: string[];
	raw: IosCommandResult;
}
export interface IosFsyncTreeResult {
	/** File/directory names listed in the app container path (e.g. ["qr.png", "test.jpg"]) */
	entries: string[];
	raw: IosCommandResult;
}
export interface IosProfileManifest {
	Description?: string;
	IsActive?: boolean;
}
export interface IosProfileMetadata {
	PayloadDescription?: string;
	PayloadDisplayName?: string;
	PayloadRemovalDisallowed?: boolean;
	PayloadUUID?: string;
	PayloadVersion?: number;
}
export interface IosProfileListEntry {
	Identifier?: string;
	Manifest?: IosProfileManifest;
	Metadata?: IosProfileMetadata;
	Status?: string;
}
export interface IosProfileListResult {
	profiles: IosProfileListEntry[];
	raw: IosCommandResult;
}
export interface BasebandKeyHashInformation {
	AKeyStatus: number;
	SKeyHash: string;
	SKeyStatus: number;
}
export interface NonVolatileRAM {
	StartupMute?: string;
	SystemAudioVolumeSaved?: string;
	"auto-boot"?: string;
	"backlight-level"?: string;
	"backlight-nits"?: string;
	"boot-args"?: string;
	bootdelay?: string;
	"fm-account-masked"?: string;
	"fm-activation-locked"?: string;
	"fm-spkeys"?: string;
	"fm-spstatus"?: string;
	obliteration?: string;
	"panicmedic-telemetry"?: string;
	usbcfwflasherResult?: string;
}
export interface LockdownInfo {
	ActivationState: string;
	ActivationStateAcknowledged: boolean;
	BasebandActivationTicketVersion: string;
	BasebandCertId: number;
	BasebandChipID: number;
	BasebandKeyHashInformation: BasebandKeyHashInformation;
	BasebandMasterKeyHash: string;
	BasebandRegionSKU: string;
	BasebandSerialNumber: string;
	BasebandStatus: string;
	BasebandVersion: string;
	BluetoothAddress: string;
	BoardId: number;
	BootSessionID: string;
	BrickState: boolean;
	BuildVersion: string;
	CPUArchitecture: string;
	CarrierBundleInfoArray: unknown[];
	CertID: number;
	ChipID: number;
	ChipSerialNo: string;
	DeviceClass: string;
	DeviceColor: string;
	DeviceName: string;
	DieID: number;
	EthernetAddress: string;
	FirmwareVersion: string;
	FusingStatus: number;
	HardwareModel: string;
	HardwarePlatform: string;
	HasSiDP: boolean;
	HostAttached: boolean;
	HumanReadableProductVersionString: string;
	InternationalMobileEquipmentIdentity: string;
	InternationalMobileEquipmentIdentity2: string;
	MLBSerialNumber: string;
	MobileEquipmentIdentifier: string;
	MobileSubscriberCountryCode: string;
	MobileSubscriberNetworkCode: string;
	ModelNumber: string;
	NonVolatileRAM: NonVolatileRAM;
	PairRecordProtectionClass: number;
	PartitionType: string;
	PasswordProtected: boolean;
	PkHash: string;
	ProductName: string;
	ProductType: string;
	ProductVersion: string;
	ProductionSOC: boolean;
	ProtocolVersion: string;
	ProximitySensorCalibration: string;
	RegionInfo: string;
	ReleaseType: string;
	SIMStatus: string;
	SIMTrayStatus: string;
	SerialNumber: string;
	SoftwareBehavior: string;
	SoftwareBundleVersion: string;
	SupportedDeviceFamilies: number[];
	TelephonyCapability: boolean;
	TimeIntervalSince1970: number;
	TimeZone: string;
	TimeZoneOffsetFromUTC: number;
	TrustedHostAttached: boolean;
	UniqueChipID: number;
	UniqueDeviceID: string;
	UntrustedHostBUID: string;
	UseRaptorCerts: boolean;
	Uses24HourClock: boolean;
	WiFiAddress: string;
	WirelessBoardSerialNumber: string;
	kCTPostponementInfoServiceProvisioningState: boolean;
	kCTPostponementStatus: string;
}
/**
 * Installed application info
 */
export interface AppInfo {
	/**
	 * Bundle identifier (e.g., "com.example.app")
	 */
	bundleId: string;
	/**
	 * Display name shown to user
	 */
	displayName: string;
	/**
	 * App version (CFBundleShortVersionString)
	 */
	version: string;
	/**
	 * Bundle version (CFBundleVersion)
	 */
	bundleVersion: string;
}
/**
 * Port forwarding result
 */
export interface PortForwardResult {
	/** The local port being forwarded */
	localPort: number;
	/** The device port being forwarded to */
	devicePort: number;
}
export interface InstallAppMdmOptions {
	appId?: string;
	url?: string;
	waitForInstalled?: boolean;
}
/**
 * AppleDeviceKit - iOS device operations wrapper
 *
 * Uses idevice command-line tools for iOS device operations.
 * Each instance is associated with a specific device by UDID.
 *
 * Port forwarding is managed automatically - each logical port (USB hub position)
 * gets a dynamically allocated local port that is tracked and cleaned up on dispose.
 *
 * IMPORTANT: Call dispose() when the kit is no longer needed to clean up
 * any running proxy processes and release port allocations.
 */
export declare class AppleDeviceKit {
	private readonly logicalPort;
	private deviceId;
	private proxyProcess;
	private localDevicePort;
	private isDisposed;
	private readonly iosClient;
	private readonly deviceActions;
	private readonly installActions;
	private readonly activationFlow;
	private readonly proxyActions;
	private tunnelProcess;
	constructor(udid: string, logicalPort: number, usbmuxdAddress?: string);
	static setResourcesDir(dir: string): void;
	/**
	 * Throws if the kit has been disposed
	 */
	private ensureNotDisposed;
	info(): Promise<LockdownInfo>;
	listDevices(): Promise<IosListResult>;
	/**
	 * Wait for device to be paired
	 * Polls the pairing status until successful or timeout
	 *
	 * @param timeout Timeout in milliseconds (default: 120000)
	 * @param pollInterval Poll interval in milliseconds (default: 1000)
	 */
	waitForPairing(timeout?: number, pollInterval?: number, signal?: AbortSignal): Promise<boolean>;
	/**
	 * Attempt to pair/trust the device
	 * User must accept the trust dialog on the device
	 */
	pair(): Promise<boolean>;
	/**
	 * Trust/pair the device - initiates pairing and waits for user to accept
	 *
	 * This is the recommended method for establishing trust with a device.
	 * It will:
	 * 1. Check if already paired
	 * 2. If not, initiate pairing (shows "Trust This Computer?" on device)
	 * 3. Wait for user to accept the trust dialog
	 *
	 * @param timeout Timeout in milliseconds to wait for user acceptance (default: 60000)
	 * @param onWaitingForTrust Callback when waiting for user to accept trust dialog
	 * @returns true if device is now trusted
	 */
	trustDevice(timeout?: number, pollInterval?: number, onWaitingForTrust?: () => void, signal?: AbortSignal): Promise<boolean>;
	/**
	 * Unpair/untrust the device
	 */
	unpair(): Promise<boolean>;
	/**
	 * Install an IPA file on the device (install agent)
	 *
	 * @param ipaPath Path to the IPA file
	 */
	installApp(ipaPath: string, options: InstallAppMdmOptions): Promise<IosCommandResult>;
	/**
	 * Uninstall an app by bundle ID (uninstall agent)
	 *
	 * @param bundleId Application bundle identifier
	 */
	uninstallApp(bundleId: string): Promise<IosCommandResult>;
	/**
	 * Check if an app is installed on the device
	 *
	 * @param bundleId Application bundle identifier
	 */
	isAppInstalled(bundleId: string): Promise<boolean>;
	/**
	 * List all installed user applications
	 */
	listApps(): Promise<AppInfo[]>;
	/**
	 * Start port forwarding and wait for it to be ready.
	 * The local port is automatically allocated based on the logical port.
	 *
	 * We need port forwarding to be able to connect to the device from the computer
	 * and communicate with it using the local port.
	 *
	 * Note: Only one port forward can be active at a time per kit instance.
	 * Starting a new port forward will kill any existing one.
	 *
	 * @param devicePort Device port to forward to
	 * @param startupTimeout Time to wait for proxy to start (ms)
	 * @returns The port forward result with the allocated local port
	 */
	startPortForwardAsync(devicePort: number): Promise<PortForwardResult>;
	/**
	 * Kill the current port forwarding process if running
	 */
	private killProxyProcess;
	/**
	 * Close the current port forwarding session and release the port
	 */
	closePortForward(): void;
	/**
	 * Wipe the device
	 */
	wipe(): Promise<void>;
	removeProfile(profileIdentifier: string): Promise<void>;
	listProfiles(): Promise<IosProfileListResult>;
	/**
	 * Activate the device using the activation flow.
	 *
	 * This flow can install WiFi/MDM/trust profiles and skip setup steps.
	 * Returns { promise, events } so callers can attach listeners before the flow completes.
	 * Pass an AbortSignal to cancel the flow (on each retry or between steps).
	 *
	 * Note: This requires a valid activation record or Apple server access.
	 *
	 * Precondition: the device must be paired and trusted.
	 */
	activate(signal?: AbortSignal): {
		promise: Promise<(() => Promise<void>) | undefined>;
		events: EventEmitter;
	};
	/**
	 * Get the device UDID
	 */
	getDeviceId(): string;
	/**
	 * Get the logical port number (USB hub position)
	 */
	getLogicalPort(): number;
	/**
	 * Get the currently allocated local port for forwarding
	 * Returns undefined if no port forward is active
	 */
	getDevicePort(): number | null;
	/**
	 * Check if this kit has been disposed
	 */
	get disposed(): boolean;
	/**
	 * Check if a port forward is currently active
	 */
	get hasActivePortForward(): boolean;
	/**
	 * Dispose of the kit and clean up all resources.
	 * This will kill any running proxy processes and release port allocations.
	 *
	 * After calling dispose(), the kit instance should not be used.
	 */
	dispose(): void;
	/**
	 * Symbol.dispose implementation for using with `using` keyword (TypeScript 5.2+)
	 */
	[Symbol.dispose](): void;
}
export declare class IosClient {
	private iosPath;
	private udid;
	private readonly _usbmuxdAddress?;
	constructor(iosPath: string, udid: string, _usbmuxdAddress?: string | undefined);
	get usbmuxdAddress(): string | undefined;
	private safeParseJson;
	private parseFsyncTreeStdout;
	private parseIosOutput;
	spawnIosCommand(args: string[]): import("child_process").ChildProcessByStdio<null, import("stream").Readable, import("stream").Readable>;
	private runIosCommand;
	listDevices(): Promise<IosListResult>;
	wipe(): Promise<IosCommandResult>;
	installProfile(profilePath: string): Promise<IosCommandResult>;
	removeProfile(profileName: string): Promise<IosCommandResult>;
	listProfiles(): Promise<IosProfileListResult>;
	skipSteps(steps?: string[]): Promise<IosCommandResult>;
	listSteps(): Promise<IosCommandResult>;
	activate(): Promise<IosCommandResult>;
	pair(): Promise<IosCommandResult>;
	forward({ fromPort, toPort }: {
		fromPort: number;
		toPort: number;
	}): Promise<import("child_process").ChildProcessByStdio<null, import("stream").Readable, import("stream").Readable>>;
	info(): Promise<IosCommandResult>;
	installApp(ipaPath: string): Promise<IosCommandResult>;
	uninstallApp(bundleId: string): Promise<IosCommandResult>;
	listApps(): Promise<{
		bundleId: string;
		displayName: string;
		version: string;
	}[]>;
	devMode(): Promise<IosCommandResult>;
	tunnelStart(userspace?: boolean): Promise<import("child_process").ChildProcessByStdio<null, import("stream").Readable, import("stream").Readable>>;
	fsyncPull({ app, srcPath, dstPath, }: {
		app: string;
		srcPath: string;
		dstPath: string;
	}): Promise<IosCommandResult>;
	fsyncPush({ app, srcPath, dstPath, }: {
		app: string;
		srcPath: string;
		dstPath: string;
	}): Promise<IosCommandResult>;
	fsyncTree({ app, path, }: {
		app: string;
		path?: string;
	}): Promise<IosFsyncTreeResult>;
}
export declare class ActivationFlow {
	private readonly udid;
	private readonly iosClient;
	private mdmClient;
	constructor(udid: string, iosClient: IosClient);
	run(steps?: string[], signal?: AbortSignal): {
		promise: Promise<(() => Promise<void>) | undefined>;
		events: EventEmitter;
	};
	private runInternal;
	private installWifiProfile;
	private installMdmProfile;
	private removeWifiProfile;
	private retryIosCommand;
	private retryActivateCommand;
	private retry;
}
/**
 * Activation flow event names (use with EventEmitter.on/emit).
 */
export declare const ACTIVATION_FLOW_EVENT_ACTIVATION_DONE = "activationDone";
export declare const ACTIVATION_FLOW_EVENT_WIFI_INSTALLED = "wifiInstalled";
export declare const ACTIVATION_FLOW_EVENT_MDM_PROFILE_INSTALLED = "mdmProfileInstalled";
export declare const ACTIVATION_FLOW_EVENT_STEPS_SKIPPED = "stepsSkipped";
/**
 * Payload when activation completes (1-based attempt that succeeded).
 */
export interface ActivationDonePayload {
	attempt: number;
}
/**
 * Payload for steps that complete after retries (0 = first try succeeded).
 */
export interface RetriesPayload {
	retries: number;
}
/**
 * Payload when skip-steps command completes (steps requested to skip).
 */
export interface StepsSkippedPayload {
	steps: string[];
}
/**
 * Event name to payload type map for activation flow events.
 */
export interface ActivationFlowEventMap {
	[ACTIVATION_FLOW_EVENT_ACTIVATION_DONE]: ActivationDonePayload;
	[ACTIVATION_FLOW_EVENT_WIFI_INSTALLED]: RetriesPayload;
	[ACTIVATION_FLOW_EVENT_MDM_PROFILE_INSTALLED]: RetriesPayload;
	[ACTIVATION_FLOW_EVENT_STEPS_SKIPPED]: StepsSkippedPayload;
}
interface DeviceListOutput$1 {
	deviceList: string[];
}
interface IosCommandResult$1 {
	command: string;
	args: string[];
	output: CommandOutput$1;
	logMessages: LogMessage$1[];
	exitCode: number;
	raw: {
		stdout: string;
		stderr: string;
	};
}
interface LogMessage$1 {
	level: "info" | "error" | "warn" | "debug";
	msg: string;
	time: string;
	err?: string;
}
type CommandOutput$1 = Record<string, unknown>[] | DeviceListOutput$1[] | [
	LockdownInfo$1
];
interface IosListResult$1 {
	udids: string[];
	raw: IosCommandResult$1;
}
interface IosFsyncTreeResult$1 {
	/** File/directory names listed in the app container path (e.g. ["qr.png", "test.jpg"]) */
	entries: string[];
	raw: IosCommandResult$1;
}
interface IosProfileManifest$1 {
	Description?: string;
	IsActive?: boolean;
}
interface IosProfileMetadata$1 {
	PayloadDescription?: string;
	PayloadDisplayName?: string;
	PayloadRemovalDisallowed?: boolean;
	PayloadUUID?: string;
	PayloadVersion?: number;
}
interface IosProfileListEntry$1 {
	Identifier?: string;
	Manifest?: IosProfileManifest$1;
	Metadata?: IosProfileMetadata$1;
	Status?: string;
}
interface IosProfileListResult$1 {
	profiles: IosProfileListEntry$1[];
	raw: IosCommandResult$1;
}
interface BasebandKeyHashInformation$1 {
	AKeyStatus: number;
	SKeyHash: string;
	SKeyStatus: number;
}
interface NonVolatileRAM$1 {
	StartupMute?: string;
	SystemAudioVolumeSaved?: string;
	"auto-boot"?: string;
	"backlight-level"?: string;
	"backlight-nits"?: string;
	"boot-args"?: string;
	bootdelay?: string;
	"fm-account-masked"?: string;
	"fm-activation-locked"?: string;
	"fm-spkeys"?: string;
	"fm-spstatus"?: string;
	obliteration?: string;
	"panicmedic-telemetry"?: string;
	usbcfwflasherResult?: string;
}
interface LockdownInfo$1 {
	ActivationState: string;
	ActivationStateAcknowledged: boolean;
	BasebandActivationTicketVersion: string;
	BasebandCertId: number;
	BasebandChipID: number;
	BasebandKeyHashInformation: BasebandKeyHashInformation$1;
	BasebandMasterKeyHash: string;
	BasebandRegionSKU: string;
	BasebandSerialNumber: string;
	BasebandStatus: string;
	BasebandVersion: string;
	BluetoothAddress: string;
	BoardId: number;
	BootSessionID: string;
	BrickState: boolean;
	BuildVersion: string;
	CPUArchitecture: string;
	CarrierBundleInfoArray: unknown[];
	CertID: number;
	ChipID: number;
	ChipSerialNo: string;
	DeviceClass: string;
	DeviceColor: string;
	DeviceName: string;
	DieID: number;
	EthernetAddress: string;
	FirmwareVersion: string;
	FusingStatus: number;
	HardwareModel: string;
	HardwarePlatform: string;
	HasSiDP: boolean;
	HostAttached: boolean;
	HumanReadableProductVersionString: string;
	InternationalMobileEquipmentIdentity: string;
	InternationalMobileEquipmentIdentity2: string;
	MLBSerialNumber: string;
	MobileEquipmentIdentifier: string;
	MobileSubscriberCountryCode: string;
	MobileSubscriberNetworkCode: string;
	ModelNumber: string;
	NonVolatileRAM: NonVolatileRAM$1;
	PairRecordProtectionClass: number;
	PartitionType: string;
	PasswordProtected: boolean;
	PkHash: string;
	ProductName: string;
	ProductType: string;
	ProductVersion: string;
	ProductionSOC: boolean;
	ProtocolVersion: string;
	ProximitySensorCalibration: string;
	RegionInfo: string;
	ReleaseType: string;
	SIMStatus: string;
	SIMTrayStatus: string;
	SerialNumber: string;
	SoftwareBehavior: string;
	SoftwareBundleVersion: string;
	SupportedDeviceFamilies: number[];
	TelephonyCapability: boolean;
	TimeIntervalSince1970: number;
	TimeZone: string;
	TimeZoneOffsetFromUTC: number;
	TrustedHostAttached: boolean;
	UniqueChipID: number;
	UniqueDeviceID: string;
	UntrustedHostBUID: string;
	UseRaptorCerts: boolean;
	Uses24HourClock: boolean;
	WiFiAddress: string;
	WirelessBoardSerialNumber: string;
	kCTPostponementInfoServiceProvisioningState: boolean;
	kCTPostponementStatus: string;
}
export interface IosCli {
	listDevices(): Promise<IosListResult$1>;
	wipe(deviceId: string): Promise<IosCommandResult$1>;
	installProfile(deviceId: string, profilePath: string): Promise<IosCommandResult$1>;
	removeProfile(deviceId: string, profileName: string): Promise<IosCommandResult$1>;
	skipSteps(deviceId: string, steps?: string[]): Promise<IosCommandResult$1>;
	printSteps(): Promise<IosCommandResult$1>;
	activate(deviceId: string): Promise<IosCommandResult$1>;
	pair(deviceId: string): Promise<IosCommandResult$1>;
	forward(deviceId: string, fromPort: number, toPort: number): Promise<IosCommandResult$1>;
	info(deviceId: string): Promise<IosCommandResult$1>;
	listProfiles(deviceId: string): Promise<IosProfileListResult$1>;
	installApp(deviceId: string, ipaPath: string): Promise<IosCommandResult$1>;
	tunnelStart(deviceId: string, userspace?: boolean): Promise<ChildProcess>;
	fsyncPull(deviceId: string, app: string, srcPath: string, dstPath: string): Promise<IosCommandResult$1>;
	fsyncPush(deviceId: string, app: string, srcPath: string, dstPath: string): Promise<IosCommandResult$1>;
	fsyncTree(deviceId: string, app: string, path?: string): Promise<IosFsyncTreeResult$1>;
}

export {
	IosCommandResult$1 as IosCommandResult,
	IosFsyncTreeResult$1 as IosFsyncTreeResult,
	IosListResult$1 as IosListResult,
};

export {};
