import{am as o,an as s,ao as r,a8 as u,ad as c}from"./index-CHfgriyV.js";import{u as i}from"./useMutation-DgMLlnbr.js";const l=async({email:t,redirect:n})=>(await o("/api/authentication/login/email",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:t,redirect:n})}),null),p=s({URL:r()}),h=async({redirect:t})=>{const n="/api/authentication/login/github",a=await o(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({redirect:t})});let e;try{e=await a.json()}catch{throw new Error(`the API endpoint ${n} returned HTTP/${a.status} with an invalid JSON payload`)}return p.parse(e)},d=async()=>(await o("/api/authentication/logout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),null);function m(){return i({mutationFn:l})}function S(){return i({mutationFn:h})}const b=()=>{const t=u(),n=c();return i({mutationFn:d,onSuccess:async()=>{n.removeQueries(),await t.invalidate()}})};export{S as a,m as b,b as u};
