import{M as m,P as a,O as t,eU as u,C as y,eV as T,A as g,p as c,Q as M,E as $,eW as q,ea as P}from"./index-Cox3ZWL0.js";const h=m.injectEndpoints({endpoints:r=>({getModelsList:r.query({query:({pId:e,params:s={offset:0,limit:40}})=>({url:`project/${e}/modelregistries/${e}/models?${P.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(q))||[]},providesTags:a.cacheByIdArgProperty(t.ProjectTags.ModelTag,"modelId")}),addModelTags:r.mutation({async queryFn({projectId:e,modelId:s,tags:o},v,f,p){const n=u(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=y(T(["error","response"]),d);return i?{error:g({error:c($({data:{usrMsg:"Error while adding tags"}},"response"),g({data:M("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:V,useGetModelVersionQuery:k,useDeleteModelVersionMutation:E,useGetModelTagsQuery:L,useAddModelTagsMutation:O,useDeleteModelTagMutation:Q}=h;export{Q as a,L as b,A as c,k as d,V as e,E as f,h as m,O as u};
