import{R as a,bE as s,eo as i,d7 as d,ep as r,a as c,aP as h,q as u}from"./index-C88DWJny.js";const l=["can_delete","can_edit"],m=async e=>{const t=new URLSearchParams;return t.set("recursion","1"),d(t,e,l),fetch(`${a}/1.0/auth/identities?${t.toString()}`).then(s).then(n=>(n.metadata.map(r),n.metadata))},y=async e=>{await fetch(`${a}/1.0/auth/identities/${encodeURIComponent(e.authentication_method)}/${encodeURIComponent(e.id)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(s)},S=async e=>Promise.allSettled(e.map(async t=>y(t))).then(i),p=async e=>{await fetch(`${a}/1.0/auth/identities/${encodeURIComponent(e.authentication_method)}/${encodeURIComponent(e.id)}`,{method:"DELETE"}).then(s)},R=async e=>Promise.allSettled(e.map(async t=>p(t))).then(i),$=async(e,t,n=!0)=>fetch(`${a}/1.0/auth/identities/tls`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,groups:t,token:n})}).then(s).then(o=>o.metadata),f=()=>{const{isFineGrained:e}=c();return h({queryKey:[u.identities],queryFn:async()=>m(e),enabled:e!==null})};export{f as a,S as b,p as c,R as d,$ as e,y as u};
