import{r as f}from"./vendor-react-wBh_31cN.js";import{c as y,F as d}from"./index-CHdS1Zyb.js";import{a7 as m,a4 as i,aQ as c,u as T,p as b,X as J,f as j}from"./index-BKr2rJhV.js";import{J as l}from"./utils-C3tzOLw4.js";import{c as C}from"./vendor-router-D1GqFWiT.js";import{p as F}from"./pathEq-BaNhugFq.js";import{m as h}from"./mergeDeepRight-BeT6gxx6.js";const L=m.injectEndpoints({endpoints:t=>({getJobconfig:t.query({query:o=>({url:`project/${o}/jobconfig`}),providesTags:c.providesList(i.ProjectTags.JobConfigurations,"jobType"),transformResponse:T(b("items"))}),getJobconfigForType:t.query({query:({pId:o,type:e})=>({url:`project/${o}/jobconfig/${e}`}),providesTags:c.cacheByIdArgProperty(i.ProjectTags.JobConfigurations,"type")}),updateJobconfigForType:t.mutation({query:({pId:o,type:e,data:r})=>({url:`project/${o}/jobconfig/${e}`,method:"put",data:r}),invalidatesTags:(o,e,{type:r})=>[{type:i.ProjectTags.JobConfigurations,id:"LIST"},{type:i.ProjectTags.JobConfigurations,id:r}]}),deleteJobconfigForType:t.mutation({query:({pId:o,type:e})=>({url:`project/${o}/jobconfig/${e}`,method:"delete"}),invalidatesTags:(o,e,{type:r})=>[{type:i.ProjectTags.JobConfigurations,id:"LIST"},{type:i.ProjectTags.JobConfigurations,id:r},{type:i.ProjectTags.JobConfig,id:"LIST"}]})})}),{useGetJobconfigQuery:P,useGetJobconfigForTypeQuery:_,useUpdateJobconfigForTypeMutation:k,useDeleteJobconfigForTypeMutation:v}=L,A=()=>{const{id:t}=C(),{currentData:o,isLoading:e}=J("ray_enabled"),{data:r=[],isFetching:n,isLoading:g}=y({id:t,excludedConfigs:[l.AGENT,...o?[]:[d.RAY]]},{skip:!t||e}),{currentData:p=[],isFetching:s}=P(+t);return f.useMemo(()=>g||s?{isLoading:!0}:{isLoading:n||s,data:r.map(({data:u})=>{const a=j(F(["config","type"],u.type),p);return h(u,(a==null?void 0:a.config)??{})})},[p,r,s,n,g])};export{k as a,v as b,A as u};
