function n(e){let s="An unexpected error occurred";if(e&&typeof e=="object"){if("response"in e&&e.response&&typeof e.response=="object"){const a=e.response;if("data"in a&&a.data&&typeof a.data=="object"){const t=a.data,r=t.error&&t.error.trim()?t.error:"",i=t.details&&t.details.trim()?t.details:"";if(r&&i)return`${r}. ${i}`;if(r)return r;if(i)return i}if("status"in a){const t=a.status;switch(t){case 400:s="Bad request - please check your input";break;case 401:s="Unauthorized - please log in again";break;case 403:s="Access denied - insufficient permissions";break;case 404:s="Resource not found";break;case 409:s="Conflict - resource already exists or is in use";break;case 422:s="Validation failed - please check your input";break;case 500:s="Internal server error - please try again later";break;default:s=`Request failed with status ${t}`}}}else if(e instanceof Error&&e.message&&!e.message.includes("status code"))return e.message}return s}export{n as e};
