let electron = require("electron");
//#region src/ipc/channels.ts
const PICK_FOLDER_CHANNEL = "desktop:pick-folder";
const CONFIRM_CHANNEL = "desktop:confirm";
const SET_THEME_CHANNEL = "desktop:set-theme";
const CONTEXT_MENU_CHANNEL = "desktop:context-menu";
const OPEN_EXTERNAL_CHANNEL = "desktop:open-external";
const OPEN_PATH_CHANNEL = "desktop:open-path";
const MENU_ACTION_CHANNEL = "desktop:menu-action";
const UPDATE_STATE_CHANNEL = "desktop:update-state";
const UPDATE_GET_STATE_CHANNEL = "desktop:update-get-state";
const UPDATE_SET_CHANNEL_CHANNEL = "desktop:update-set-channel";
const UPDATE_DOWNLOAD_CHANNEL = "desktop:update-download";
const UPDATE_INSTALL_CHANNEL = "desktop:update-install";
const UPDATE_CHECK_CHANNEL = "desktop:update-check";
const GET_APP_BRANDING_CHANNEL = "desktop:get-app-branding";
const GET_LOCAL_ENVIRONMENT_BOOTSTRAP_CHANNEL = "desktop:get-local-environment-bootstrap";
const GET_DEBUG_ENDPOINT_STATE_CHANNEL = "desktop:get-debug-endpoint-state";
const PUBLISH_DEBUG_SNAPSHOT_CHANNEL = "desktop:publish-debug-snapshot";
const GET_CLIENT_SETTINGS_CHANNEL = "desktop:get-client-settings";
const SET_CLIENT_SETTINGS_CHANNEL = "desktop:set-client-settings";
const SET_POWER_SAVE_BLOCKER_STATE_CHANNEL = "desktop:set-power-save-blocker-state";
const GET_SAVED_ENVIRONMENT_REGISTRY_CHANNEL = "desktop:get-saved-environment-registry";
const SET_SAVED_ENVIRONMENT_REGISTRY_CHANNEL = "desktop:set-saved-environment-registry";
const GET_SAVED_ENVIRONMENT_SECRET_CHANNEL = "desktop:get-saved-environment-secret";
const SET_SAVED_ENVIRONMENT_SECRET_CHANNEL = "desktop:set-saved-environment-secret";
const REMOVE_SAVED_ENVIRONMENT_SECRET_CHANNEL = "desktop:remove-saved-environment-secret";
const DISCOVER_SSH_HOSTS_CHANNEL = "desktop:discover-ssh-hosts";
const ENSURE_SSH_ENVIRONMENT_CHANNEL = "desktop:ensure-ssh-environment";
const DISCONNECT_SSH_ENVIRONMENT_CHANNEL = "desktop:disconnect-ssh-environment";
const FETCH_SSH_ENVIRONMENT_DESCRIPTOR_CHANNEL = "desktop:fetch-ssh-environment-descriptor";
const BOOTSTRAP_SSH_BEARER_SESSION_CHANNEL = "desktop:bootstrap-ssh-bearer-session";
const FETCH_SSH_SESSION_STATE_CHANNEL = "desktop:fetch-ssh-session-state";
const ISSUE_SSH_WEBSOCKET_TOKEN_CHANNEL = "desktop:issue-ssh-websocket-token";
const GET_SERVER_EXPOSURE_STATE_CHANNEL = "desktop:get-server-exposure-state";
const SET_SERVER_EXPOSURE_MODE_CHANNEL = "desktop:set-server-exposure-mode";
const SET_TAILSCALE_SERVE_ENABLED_CHANNEL = "desktop:set-tailscale-serve-enabled";
const GET_ADVERTISED_ENDPOINTS_CHANNEL = "desktop:get-advertised-endpoints";
//#endregion
//#region src/preload.ts
electron.contextBridge.exposeInMainWorld("desktopBridge", {
	getAppBranding: () => {
		const result = electron.ipcRenderer.sendSync(GET_APP_BRANDING_CHANNEL);
		if (typeof result !== "object" || result === null) return null;
		return result;
	},
	getLocalEnvironmentBootstrap: () => {
		const result = electron.ipcRenderer.sendSync(GET_LOCAL_ENVIRONMENT_BOOTSTRAP_CHANNEL);
		if (typeof result !== "object" || result === null) return null;
		return result;
	},
	getDebugEndpointState: () => electron.ipcRenderer.invoke(GET_DEBUG_ENDPOINT_STATE_CHANNEL),
	publishDebugSnapshot: (snapshot) => electron.ipcRenderer.invoke(PUBLISH_DEBUG_SNAPSHOT_CHANNEL, snapshot),
	getClientSettings: () => electron.ipcRenderer.invoke(GET_CLIENT_SETTINGS_CHANNEL),
	setClientSettings: (settings) => electron.ipcRenderer.invoke(SET_CLIENT_SETTINGS_CHANNEL, settings),
	setPowerSaveBlockerState: (state) => electron.ipcRenderer.invoke(SET_POWER_SAVE_BLOCKER_STATE_CHANNEL, state),
	getSavedEnvironmentRegistry: () => electron.ipcRenderer.invoke(GET_SAVED_ENVIRONMENT_REGISTRY_CHANNEL),
	setSavedEnvironmentRegistry: (records) => electron.ipcRenderer.invoke(SET_SAVED_ENVIRONMENT_REGISTRY_CHANNEL, records),
	getSavedEnvironmentSecret: (environmentId) => electron.ipcRenderer.invoke(GET_SAVED_ENVIRONMENT_SECRET_CHANNEL, environmentId),
	setSavedEnvironmentSecret: (environmentId, secret) => electron.ipcRenderer.invoke(SET_SAVED_ENVIRONMENT_SECRET_CHANNEL, {
		environmentId,
		secret
	}),
	removeSavedEnvironmentSecret: (environmentId) => electron.ipcRenderer.invoke(REMOVE_SAVED_ENVIRONMENT_SECRET_CHANNEL, environmentId),
	discoverSshHosts: () => electron.ipcRenderer.invoke(DISCOVER_SSH_HOSTS_CHANNEL),
	ensureSshEnvironment: async (target, options) => electron.ipcRenderer.invoke(ENSURE_SSH_ENVIRONMENT_CHANNEL, {
		target,
		...options === void 0 ? {} : { options }
	}),
	disconnectSshEnvironment: (target) => electron.ipcRenderer.invoke(DISCONNECT_SSH_ENVIRONMENT_CHANNEL, target),
	fetchSshEnvironmentDescriptor: (httpBaseUrl) => electron.ipcRenderer.invoke(FETCH_SSH_ENVIRONMENT_DESCRIPTOR_CHANNEL, { httpBaseUrl }),
	bootstrapSshBearerSession: (httpBaseUrl, credential) => electron.ipcRenderer.invoke(BOOTSTRAP_SSH_BEARER_SESSION_CHANNEL, {
		httpBaseUrl,
		credential
	}),
	fetchSshSessionState: (httpBaseUrl, bearerToken) => electron.ipcRenderer.invoke(FETCH_SSH_SESSION_STATE_CHANNEL, {
		httpBaseUrl,
		bearerToken
	}),
	issueSshWebSocketToken: (httpBaseUrl, bearerToken) => electron.ipcRenderer.invoke(ISSUE_SSH_WEBSOCKET_TOKEN_CHANNEL, {
		httpBaseUrl,
		bearerToken
	}),
	getServerExposureState: () => electron.ipcRenderer.invoke(GET_SERVER_EXPOSURE_STATE_CHANNEL),
	setServerExposureMode: (mode) => electron.ipcRenderer.invoke(SET_SERVER_EXPOSURE_MODE_CHANNEL, mode),
	setTailscaleServeEnabled: (input) => electron.ipcRenderer.invoke(SET_TAILSCALE_SERVE_ENABLED_CHANNEL, input),
	getAdvertisedEndpoints: () => electron.ipcRenderer.invoke(GET_ADVERTISED_ENDPOINTS_CHANNEL),
	pickFolder: (options) => electron.ipcRenderer.invoke(PICK_FOLDER_CHANNEL, options),
	confirm: (message) => electron.ipcRenderer.invoke(CONFIRM_CHANNEL, message),
	setTheme: (theme) => electron.ipcRenderer.invoke(SET_THEME_CHANNEL, theme),
	showContextMenu: (items, position) => electron.ipcRenderer.invoke(CONTEXT_MENU_CHANNEL, {
		items,
		...position === void 0 ? {} : { position }
	}),
	openExternal: (url) => electron.ipcRenderer.invoke(OPEN_EXTERNAL_CHANNEL, url),
	openPath: (path) => electron.ipcRenderer.invoke(OPEN_PATH_CHANNEL, path),
	onMenuAction: (listener) => {
		const wrappedListener = (_event, action) => {
			if (typeof action !== "string") return;
			listener(action);
		};
		electron.ipcRenderer.on(MENU_ACTION_CHANNEL, wrappedListener);
		return () => {
			electron.ipcRenderer.removeListener(MENU_ACTION_CHANNEL, wrappedListener);
		};
	},
	getUpdateState: () => electron.ipcRenderer.invoke(UPDATE_GET_STATE_CHANNEL),
	setUpdateChannel: (channel) => electron.ipcRenderer.invoke(UPDATE_SET_CHANNEL_CHANNEL, channel),
	checkForUpdate: () => electron.ipcRenderer.invoke(UPDATE_CHECK_CHANNEL),
	downloadUpdate: () => electron.ipcRenderer.invoke(UPDATE_DOWNLOAD_CHANNEL),
	installUpdate: () => electron.ipcRenderer.invoke(UPDATE_INSTALL_CHANNEL),
	onUpdateState: (listener) => {
		const wrappedListener = (_event, state) => {
			if (typeof state !== "object" || state === null) return;
			listener(state);
		};
		electron.ipcRenderer.on(UPDATE_STATE_CHANNEL, wrappedListener);
		return () => {
			electron.ipcRenderer.removeListener(UPDATE_STATE_CHANNEL, wrappedListener);
		};
	}
});
//#endregion

//# sourceMappingURL=preload.cjs.map