import { ApiClientEvents as e } from "../events/api-client-events.js";
import { eventBus as t } from "../services/eventEmitter.js";
import "../services/index.js";
import n from "axios";
//#region src/api/client.ts
function r(r, i) {
	let a = n.create({
		baseURL: r,
		withCredentials: !0,
		headers: { "Content-Type": "application/json" }
	});
	return a.interceptors.response.use((e) => e, (n) => (n.response?.status && [401, 403].includes(n.response.status) && t.emit(e.UNAUTHORIZED, i), n.code === "ERR_NETWORK" && (console.error("Connection refused - server may be down"), t.emit(e.ERR_NETWORK, i)), Promise.reject(n))), a;
}
//#endregion
export { r as createAxiosClient };
