const trimTrailingSlashes = (value: string): string => value.replace(/\/+$/, ""); export const resolveApiBaseUrl = (rawValue: string | undefined): string => { const normalized = rawValue?.trim() ?? ""; if (!normalized) { return "/"; } if (normalized === "/") { return "/"; } return trimTrailingSlashes(normalized); };