"use client"
import { kt as useApiConfig, zn as axiosClient } from "./state-B9yzhuKs.mjs";
import { useEffect, useState } from "react";
import axios, { AxiosInstance, AxiosResponse } from "axios";

//#region recce-source/js/src/lib/api/schemacheck.ts
async function createSchemaDiffCheck(params, client = axiosClient) {
	return (await client.post("/api/checks", {
		type: "schema_diff",
		params
	})).data;
}

//#endregion
//#region recce-source/js/src/lib/api/select.ts
async function select(input, client = axiosClient) {
	return (await client.post(`/api/select`, input)).data;
}

//#endregion
//#region recce-source/js/src/lib/api/sessionStorageKeys.ts
const prefix$1 = "recce";
const sessionStorageKeys = {
	recommendationIgnored: `${prefix$1}-recommendation-ignored`,
	recommendationShowed: `${prefix$1}-recommendation-showed`,
	prevRefreshTimeStamp: `${prefix$1}-prev-refresh-timestamp`,
	lineageNotificationDismissed: `${prefix$1}-lineage-notification-dismissed`
};

//#endregion
//#region recce-source/js/src/lib/api/localStorageKeys.ts
const prefix = "recce-";
const localStorageKeys = {
	bypassSaveOverwrite: `${prefix}-bypass-save-overwrite`,
	previewChangeFeedbackID: `${prefix}-preview-change-feedback`,
	prepareEnvGuideID: `${prefix}-prepare-env`
};

//#endregion
//#region recce-source/js/src/lib/api/connectToCloud.ts
async function connectToCloud(client = axiosClient) {
	return (await client.post("/api/connect")).data;
}

//#endregion
//#region recce-source/js/src/lib/api/user.ts
async function fetchUser(client = axiosClient) {
	try {
		return (await client.get("/api/users")).data;
	} catch (error) {
		console.error("Error fetching user data:", error);
		throw error;
	}
}
async function fetchGitHubAvatar(userId) {
	try {
		return (await axios.get(`https://api.github.com/user/${userId}`)).data.avatar_url;
	} catch (error) {
		console.warn("Failed to fetch GitHub avatar:", error);
		return null;
	}
}

//#endregion
//#region recce-source/js/src/lib/api/version.ts
async function getVersion(client = axiosClient) {
	return (await client.get("/api/version")).data;
}
function useVersionNumber() {
	const [version, setVersion] = useState("");
	const [latestVersion, setLatestVersion] = useState("");
	const { apiClient } = useApiConfig();
	useEffect(() => {
		async function fetchVersion() {
			try {
				const { version: version$1, latestVersion: latestVersion$1 } = await getVersion(apiClient);
				setVersion(version$1);
				setLatestVersion(latestVersion$1);
			} catch (error) {
				console.error("Error fetching version number:", error);
			}
		}
		fetchVersion();
	}, [apiClient]);
	return {
		version,
		latestVersion
	};
}

//#endregion
export { connectToCloud as a, select as c, fetchUser as i, createSchemaDiffCheck as l, useVersionNumber as n, localStorageKeys as o, fetchGitHubAvatar as r, sessionStorageKeys as s, getVersion as t };
//# sourceMappingURL=version-OnOKzBeQ.mjs.map