import{E as f,b as d,d as m,i as p,f as a,g as c,aS as i,ar as y,q as h,H as R}from"./index-OtVJl4GC.js";import"./lodash-ZyeDnt0e.js";import"./vendor-ClLR6ncd.js";import{r as E}from"./model-C9Idzwgo.js";import{p as Q}from"./model-DAvH-x8m.js";import{d as x}from"./model-BneMh0-t.js";const g=({catalogId:e})=>{y.resetQueries(E(e))};function M({override:e=!1,...r}){return{override:e,"vector-store-p":!0,embedder:x(r),model:r.model,"embedding-api-key":r.apiKey}}function _({catalogId:e,repositoryId:r,...n}){return p({url:c({catalogId:e,repositoryId:r}),method:"put",params:M(n)})}const w=(e,r,n="")=>{const{catalogId:s}=d();return m(o=>{const{repoName:t,params:u}=typeof o=="string"?{repoName:o}:o;return p({method:e,url:a(c({catalogId:s,repositoryId:t}),n),data:new URLSearchParams(u)})},{onSuccess:(o,t)=>{var u;r({catalogId:s}),(u=t==null?void 0:t.onSuccess)==null||u.call(t)},onError:(o,t)=>{var u;(u=t==null?void 0:t.onError)==null||u.call(t)},onMutate:o=>{var t;(t=o==null?void 0:o.onMutate)==null||t.call(o)}})},D=()=>w("put",()=>{},"rdf-star");function V({onSettled:e=()=>{},onSuccess:r=()=>{}}){const{username:n}=h(),{catalogId:s}=d();return m(async({id:o,catalogId:t=s,cleanUserData:u})=>(u&&await p({method:"delete",url:a("users",n,"data"),params:{prefix:R({catalogId:t,repositoryId:o})}}),p({method:"delete",url:c({catalogId:t,repositoryId:o})})),{onSuccess:(o,{catalogId:t=s})=>{r(),g({catalogId:t})},onSettled:e})}async function I(e){try{return await p({url:a(c(Q(e)),"exists")})}catch(r){if(r instanceof i)return!1;throw r}}function K(e){return["repo-exists",e]}function k(e){return f(K(e),()=>I(e),{enabled:!!e})}export{D as a,w as b,M as c,_ as d,I as e,V as f,g as i,K as r,k as u};
