import{FetchError as _}from"ofetch";var e;class t extends Error{toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(_,e,t){super(_),e instanceof Error&&(this.cause=e),this.privyErrorCode=t}}class s extends t{constructor(_,e,t,s,r,a){super(t,s,r),this.type=_,this.status=e,this.data=a}}class r extends t{constructor(_,e,t){super(_,e,t),this.type="client_error"}}class a extends r{constructor(){super("Request timed out",void 0,"client_request_timeout")}}class n extends t{constructor(_,e,t){super(_,e,t),this.type="connector_error"}}const o=e=>{if(e instanceof t)return e;if(!(e instanceof _))return E(e);if(!e.response)return new s("api_error",null,e.message,e);let{type:r,message:a,error:n,code:o}=e.data;return new s(r||"ApiError",e.response.status,a||n,e,o,e.data)},E=_=>_ instanceof t?_:_ instanceof Error?new r(_.message,_):new r(`Internal error: ${_}`);var i=((e={}).OAUTH_ACCOUNT_SUSPENDED="oauth_account_suspended",e.MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",e.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",e.MISSING_OR_INVALID_TOKEN="missing_or_invalid_token",e.INVALID_DATA="invalid_data",e.INVALID_CAPTCHA="invalid_captcha",e.LINKED_TO_ANOTHER_USER="linked_to_another_user",e.CANNOT_LINK_MORE_OF_TYPE="cannot_link_more_of_type",e.FAILED_TO_LINK_ACCOUNT="failed_to_link_account",e.FAILED_TO_UPDATE_ACCOUNT="failed_to_update_account",e.USER_EXITED_UPDATE_FLOW="exited_update_flow",e.ALLOWLIST_REJECTED="allowlist_rejected",e.OAUTH_USER_DENIED="oauth_user_denied",e.OAUTH_UNEXPECTED="oauth_unexpected",e.UNKNOWN_AUTH_ERROR="unknown_auth_error",e.USER_EXITED_AUTH_FLOW="exited_auth_flow",e.USER_EXITED_LINK_FLOW="exited_link_flow",e.USER_EXITED_SET_PASSWORD_FLOW="user_exited_set_password_flow",e.MUST_BE_AUTHENTICATED="must_be_authenticated",e.UNKNOWN_CONNECT_WALLET_ERROR="unknown_connect_wallet_error",e.GENERIC_CONNECT_WALLET_ERROR="generic_connect_wallet_error",e.CLIENT_REQUEST_TIMEOUT="client_request_timeout",e.INVALID_CREDENTIALS="invalid_credentials",e.MISSING_MFA_CREDENTIALS="missing_or_invalid_mfa",e.UNKNOWN_MFA_ERROR="unknown_mfa_error",e.EMBEDDED_WALLET_ALREADY_EXISTS="embedded_wallet_already_exists",e.EMBEDDED_WALLET_NOT_FOUND="embedded_wallet_not_found",e.EMBEDDED_WALLET_CREATE_ERROR="embedded_wallet_create_error",e.UNKNOWN_EMBEDDED_WALLET_ERROR="unknown_embedded_wallet_error",e.EMBEDDED_WALLET_PASSWORD_UNCONFIRMED="embedded_wallet_password_unconfirmed",e.EMBEDDED_WALLET_PASSWORD_ALREADY_EXISTS="embedded_wallet_password_already_exists",e.EMBEDDED_WALLET_RECOVERY_ALREADY_EXISTS="embedded_wallet_recovery_already_exists",e.TRANSACTION_FAILURE="transaction_failure",e.UNSUPPORTED_CHAIN_ID="unsupported_chain_id",e.NOT_SUPPORTED="not_supported",e.CAPTCHA_TIMEOUT="captcha_timeout",e.INVALID_MESSAGE="invalid_message",e.UNABLE_TO_SIGN="unable_to_sign",e.CAPTCHA_FAILURE="captcha_failure",e.CAPTCHA_DISABLED="captcha_disabled",e.SESSION_STORAGE_UNAVAILABLE="session_storage_unavailable",e.TOO_MANY_REQUESTS="too_many_requests",e.USER_LIMIT_REACHED="max_accounts_reached",e.DISALLOWED_LOGIN_METHOD="disallowed_login_method",e.DISALLOWED_PLUS_EMAIL="disallowed_plus_email",e.PASSKEY_NOT_ALLOWED="passkey_not_allowed",e.USER_DOES_NOT_EXIST="user_does_not_exist",e.INSUFFICIENT_BALANCE="insufficient_balance",e.ACCOUNT_TRANSFER_REQUIRED="account_transfer_required",e.BUFFER_NOT_DEFINED="buffer_not_defined",e.UNSUPPORTED_WALLET_TYPE="unsupported_wallet_type",e.NO_SOLANA_ACCOUNTS="no_solana_accounts",e.UNKNOWN_FUNDING_ERROR="unknown_funding_error",e);class d extends r{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}}class c extends r{constructor(_="Embedded wallet error",e){super(_,e,"unknown_embedded_wallet_error")}}class u extends r{constructor(_="User must be authenticated"){super(_,void 0,"must_be_authenticated")}}class l extends r{constructor(_){super("This application is in development mode and must be upgraded to production to log in new users.",_,"max_accounts_reached")}}class A extends n{constructor(){super("No Solana accounts found in wallet",void 0,"no_solana_accounts")}}export{r as P,i as a,t as b,s as c,d,n as e,o as f,a as g,E as h,A as i,l as j,c as k,u as l};
//# sourceMappingURL=errors-Dd6zfYtp.mjs.map
