import{r as e}from"./chunk-BEqpzyXh.js";var t=e({getErrorTranslationKey:()=>i,handleApiError:()=>r}),n={"These credentials do not match our records.":`errors.login_invalid_credentials`,"The provided credentials are incorrect.":`errors.login_invalid_credentials`,invalid_key:`errors.invalid_provider_key`,"This feature is available on Starter plan and onwards!":`errors.starter_plan`,taxes_attached:`settings.tax_types.already_in_use`,expense_attached:`settings.expense_category.already_in_use`,payments_attached:`settings.payment_modes.payments_attached`,expenses_attached:`settings.payment_modes.expenses_attached`,role_attached_to_users:`settings.roles.already_in_use`,items_attached:`settings.customization.items.already_in_use`,payment_attached_message:`invoices.payment_attached_message`,"The email has already been taken.":`validation.email_already_taken`,"Relation estimateItems exists.":`items.item_attached_message`,"Relation invoiceItems exists.":`items.item_attached_message`,"Relation taxes exists.":`settings.tax_types.already_in_use`,"Relation payments exists.":`errors.payment_attached`,"The estimate number has already been taken.":`errors.estimate_number_used`,"The payment number has already been taken.":`errors.estimate_number_used`,"The invoice number has already been taken.":`errors.invoice_number_used`,"The name has already been taken.":`errors.name_already_taken`,total_invoice_amount_must_be_more_than_paid_amount:`invoices.invalid_due_amount_message`,you_cannot_edit_currency:`customers.edit_currency_not_allowed`,receipt_does_not_exist:`errors.receipt_does_not_exist`,customer_cannot_be_changed_after_payment_is_added:`errors.customer_cannot_be_changed_after_payment_is_added`,invalid_credentials:`errors.invalid_credentials`,not_allowed:`errors.not_allowed`,invalid_state:`errors.invalid_state`,invalid_city:`errors.invalid_city`,invalid_postal_code:`errors.invalid_postal_code`,invalid_format:`errors.invalid_format`,api_error:`errors.api_error`,feature_not_enabled:`errors.feature_not_enabled`,request_limit_met:`errors.request_limit_met`,address_incomplete:`errors.address_incomplete`,invalid_address:`errors.invalid_address`,"Email could not be sent to this email address.":`errors.email_could_not_be_sent`};function r(e){let t=e;if(!t.response)return{message:`Please check your internet connection or wait until servers are back online.`,statusCode:null,validationErrors:{},isUnauthorized:!1,isValidationError:!1,isNetworkError:!0};let{response:n}=t,r=n.status??null;if(n.statusText===`Unauthorized`||n.data?.message===` Unauthorized.`||r===401)return{message:n.data?.message??`Unauthorized`,statusCode:r,validationErrors:{},isUnauthorized:!0,isValidationError:!1,isNetworkError:!1};let i=n.data?.errors??{};if(Object.keys(i).length>0)return{message:i[Object.keys(i)[0]]?.[0]??`Validation error`,statusCode:r,validationErrors:i,isUnauthorized:!1,isValidationError:!0,isNetworkError:!1};let a=n.data?.error,o;return o=typeof a==`string`?a:n.data?.message??`An unexpected error occurred`,{message:o,statusCode:r,validationErrors:{},isUnauthorized:!1,isValidationError:!1,isNetworkError:!1}}function i(e){return n[e]??null}export{i as n,r,t};