import{K as m,cT as u,M as a,O as t,e6 as y,e7 as T,z as c,e8 as M,v as g,f as $,U as q,B as h}from"./index-CK33qGU_.js";const v=m.injectEndpoints({endpoints:r=>({getModelsList:r.query({query:({pId:e,params:s={offset:0,limit:40}})=>({url:`project/${e}/modelregistries/${e}/models?${u.stringify(s)}`}),extraOptions:{skipError:!0},providesTags:a.providesListItems(t.ProjectTags.ModelVersions)}),getModel:r.query({query:({projectId:e,modelName:s})=>({url:`project/${e}/modelregistries/${e}/models?filter_by=name_eq:${s}`}),providesTags:a.providesListItems(t.ProjectTags.Model)}),getModelVersion:r.query({query:({projectId:e,modelName:s,modelVersion:o})=>({url:`project/${e}/modelregistries/${e}/models/${s}_${o}?expand=modelschema&expand=inputexample`})}),deleteModelVersion:r.mutation({query:({projectId:e,mlId:s})=>({url:`project/${e}/modelregistries/${e}/models/${s}`,method:"delete"}),invalidatesTags:[{type:t.ProjectTags.Model,id:"LIST"},{type:t.ProjectTags.ModelVersions,id:"LIST"}]}),getModelTags:r.query({query:({projectId:e,modelId:s})=>({url:`project/${e}/modelregistries/${e}/models/${s}/tags?expand=tag_schemas`}),extraOptions:{skipError:!0},transformResponse:e=>{var s;return((s=e.items)==null?void 0:s.map(y))||[]},providesTags:a.cacheByIdArgProperty(t.ProjectTags.ModelTag,"modelId")}),addModelTags:r.mutation({async queryFn({projectId:e,modelId:s,tags:o},P,f,p){const n=T(o).map(l=>p({url:`
            project/${e}/
            modelregistries/${e}/
            models/${s}/
            tags/${l.key}
            `.replace(/\s/g,""),method:"put",data:l.formattedArray})),d=await Promise.all(n),i=c(M(["error","response"]),d);return i?{error:g({error:$(h({data:{usrMsg:"Error while adding tags"}},"response"),g({data:q("usrMsg")}))},i)}:{data:d}},invalidatesTags:a.cacheByIdArgProperty(t.ProjectTags.ModelTag,"modelId")}),deleteModelTag:r.mutation({query:({projectId:e,modelId:s,tagName:o})=>({url:`project/${e}/modelregistries/${e}/models/${s}/tags/${o}`,method:"delete"}),extraOptions:{skipError:!0},invalidatesTags:a.cacheByIdArgProperty(t.ProjectTags.ModelTag,"modelId")})})}),{useGetModelsListQuery:A,useGetModelQuery:k,useGetModelVersionQuery:L,useDeleteModelVersionMutation:O,useGetModelTagsQuery:V,useAddModelTagsMutation:_,useDeleteModelTagMutation:E}=v;export{E as a,V as b,A as c,L as d,k as e,O as f,v as m,_ as u};
