import{i as e,t}from"./useQuery-qKYvnzn0.js";import{t as n}from"./useMutation-C6r_dxL-.js";import{r,t as i}from"./client-BAPwymp0.js";function a(){return t({queryKey:[`currentUser`],queryFn:()=>i.get(`/api/v1/auth/me`),enabled:r(),retry:(e,t)=>e<1&&!(t instanceof Error&&t.message.startsWith(`401`))})}function o(){let t=e();return n({mutationFn:async e=>{await i.login(e.identifier,e.password)},onSuccess:()=>{t.invalidateQueries({queryKey:[`currentUser`]})}})}function s(){return n({mutationFn:e=>i.register(e.email,e.password,e.display_name,e.username)})}function c(){let t=e();return()=>{i.logout().finally(()=>{t.clear(),window.location.href=`/login`})}}function l(){let t=e();return n({mutationFn:e=>i.patch(`/api/v1/auth/me`,e),onSuccess:()=>t.invalidateQueries({queryKey:[`currentUser`]})})}function u(){return n({mutationFn:e=>i.post(`/api/v1/auth/password`,e)})}export{s as a,c as i,a as n,l as o,o as r,u as t};