require("./chunk-9hOWP6kD.cjs");
const require_query_keys = require("./query-keys-p6qddudR.cjs");
let react = require("react");
let _tanstack_react_query = require("@tanstack/react-query");
//#region ../core/src/account-api-context.ts
const AccountApiContext = (0, react.createContext)(null);
const AccountApiProvider = AccountApiContext.Provider;
function useAccountApi() {
	const api = (0, react.use)(AccountApiContext);
	if (!api) throw new Error("useAccountApi must be used within an AccountApiProvider");
	return api;
}
//#endregion
//#region src/hooks/use-account.ts
/**
* Fetches the current user's account from GET /api/account.
* Replaces the old useCurrentUser (which called non-existent /api/me).
*/
function useAccount() {
	const api = useAccountApi();
	return (0, _tanstack_react_query.useQuery)({
		queryKey: require_query_keys.accountKeys.detail(),
		queryFn: async () => {
			return (await api.fetchAccount()).account;
		},
		staleTime: 300 * 1e3
	});
}
//#endregion
Object.defineProperty(exports, "AccountApiProvider", {
	enumerable: true,
	get: function() {
		return AccountApiProvider;
	}
});
Object.defineProperty(exports, "useAccount", {
	enumerable: true,
	get: function() {
		return useAccount;
	}
});
Object.defineProperty(exports, "useAccountApi", {
	enumerable: true,
	get: function() {
		return useAccountApi;
	}
});

//# sourceMappingURL=use-account-C596ARpR.cjs.map