import{u as s,b as t,c as l}from"./vendor-query-B2UbickB.js";import{b as u}from"./index-BZu5zewH.js";function g(){return s({queryKey:["knowledge","domains"],queryFn:()=>u("/knowledge/domains")})}function f(n,e){var a;const r=new URLSearchParams;r.set("domain",n),(a=e==null?void 0:e.tags)!=null&&a.length&&r.set("tags",e.tags.join(",")),e!=null&&e.search&&r.set("search",e.search),(e==null?void 0:e.limit)!=null&&r.set("limit",String(e.limit)),(e==null?void 0:e.offset)!=null&&r.set("offset",String(e.offset));const i=r.toString();return s({queryKey:["knowledge",n,e==null?void 0:e.tags,e==null?void 0:e.search,e==null?void 0:e.limit,e==null?void 0:e.offset],queryFn:()=>u(`/knowledge/entries?${i}`),enabled:!!n})}function y(n,e){const r=new URLSearchParams;n&&r.set("domain",n),e&&r.set("key",e);const i=r.toString();return s({queryKey:["knowledge",n,e],queryFn:()=>u(`/knowledge/entry?${i}`),enabled:!!n&&!!e})}function m(){const n=t();return l({mutationFn:e=>u("/knowledge/entry",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{n.invalidateQueries({queryKey:["knowledge"]})}})}function w(){const n=t();return l({mutationFn:e=>u("/knowledge/field",{method:"PUT",body:JSON.stringify(e)}),onSuccess:()=>{n.invalidateQueries({queryKey:["knowledge"]})}})}function o(){const n=t();return l({mutationFn:({domain:e,key:r,path:i})=>{const a=new URLSearchParams({domain:e,key:r,path:i});return u(`/knowledge/field?${a}`,{method:"DELETE"})},onSuccess:()=>{n.invalidateQueries({queryKey:["knowledge"]})}})}function S(){const n=t();return l({mutationFn:({domain:e,key:r})=>{const i=new URLSearchParams({domain:e,key:r});return u(`/knowledge/entry?${i}`,{method:"DELETE"})},onSuccess:()=>{n.invalidateQueries({queryKey:["knowledge"]})}})}export{S as a,m as b,w as c,o as d,g as e,f,y as u};
//# sourceMappingURL=knowledge-DJhm5z0p.js.map
