import{cT as w,a7 as P,a4 as o,aQ as p,aR as h,h as g,u as A,e as T,m as u,a as m,p as $,a_ as y,cs as V,aT as l,k as I,l as k,aS as _,q as D,aC as B,aa as F,cU as M,a8 as j}from"./index-dNe6i2rS.js";import{n as Q}from"./notifications-5miqOdlG.js";import{i as x}from"./ifElse-D151OpR6.js";import{h as N}from"./has-BFHy-Ez2.js";import{u as E}from"./uniq--Ej6WwWR.js";var O=w(function(n,e){return e},null);const q=g(u(T({extendedStatistics:JSON.parse})),M),G=(n,e)=>{const s=u($("version"),n),a=u($("version"),e);return[j(a,s),j(s,a)]},L=P.injectEndpoints({endpoints:n=>({getAllFVTrainingDatasets:n.query({query:({id:e,version:s,pId:a,fsId:r,params:t})=>{const i=E(["tddata",...F([(t==null?void 0:t.expand)??[]]),"mandatorytags"]),c=l.stringify({...t,expand:i},{skipNull:!0});return{url:`
          project/${a}/
          featurestores/${r}/
          featureview/${e}/
          version/${s}/
          trainingdatasets?${c}
          `.replace(/\s/g,"")}},onQueryStarted:(e,{getCacheEntry:s,queryFulfilled:a})=>{const{data:r}=s();a.then(()=>{const{data:t}=s();if(r&&t&&r.count!==t.count){const[i,c]=G(r.items,t.items),v=i.join(", "),f=v?`New training data added, version: ${v}`:"",d=c.join(", "),S=d?`Training data removed, version: ${d}`:"";(!D(i)||!D(c))&&Q.info({title:"Info",content:[f,S].filter(B).join(", ")})}})},providesTags:p.providesListItems(o.ProjectTags.TrainingData,"version")}),getFVTrainingDataset:n.query({query:({fvName:e,fvVersion:s,pId:a,fsId:r,params:t,id:i})=>{const c=l.stringify(t??{});return{url:`
          project/${a}/
          featurestores/${r}/
          featureview/${e}/version/${s}/
          trainingdatasets/version/${i}
          ?${c}
          `.replace(/\s/g,"")}},transformResponse:I(k,T({tags:g(m([],"items"),u(_))})),providesTags:p.cacheByIdArgProperty(o.ProjectTags.TrainingData)}),getFVTDStatistics:n.query({query:({fvName:e,fvVersion:s,pId:a,fsId:r,id:t,params:i={}})=>{const c=l.stringify(i);return{url:`
          project/${a}/
          featurestores/${r}/
          featureview/${e}/version/${s}/
          trainingdatasets/version/${t}/
          statistics
          ?${c}
          `.replace(/\s/g,"")}},extraOptions:{skipError:!0},transformResponse:g(V(["items",0]),A(g(T({featureDescriptiveStatistics:q,splitStatistics:u(T({featureDescriptiveStatistics:q}))}),x(N("splitStatistics"),e=>g(m([],"splitStatistics"),O($("name")),u($("featureDescriptiveStatistics")),u(y("computationTime",e.computationTime)))(e),e=>g(m({},"featureDescriptiveStatistics"),u(y("computationTime",e.computationTime)))(e)))))}),computeTrainingDataset:n.mutation({query:({pId:e,fsId:s,fvName:a,fvVersion:r,id:t})=>({url:`
          project/${e}/
          featurestores/${s}/
          featureview/${a}/version/${r}/
          trainingdatasets/version/${t}/
          compute
          `.replace(/\s/g,""),method:"post",data:{}}),invalidatesTags:p.cacheByIdArgProperty(o.ProjectTags.TrainingData)}),computeTrainingDatasetStatistics:n.mutation({query:({pId:e,fsId:s,fvName:a,fvVersion:r,id:t})=>({url:`
          project/${e}/
          featurestores/${s}/
          featureview/${a}/version/${r}/
          trainingdatasets/version/${t}/
          compute
          `.replace(/\s/g,""),method:"post"}),invalidatesTags:p.cacheByIdArgProperty(o.ProjectTags.TrainingData)}),createTrainingDataset:n.mutation({query:({pId:e,fsId:s,id:a,version:r,data:t})=>({url:`
          project/${e}/
          featurestores/${s}/
          featureview/${a}/version/${r}/
          trainingdatasets
          `.replace(/\s/g,""),method:"post",data:t}),invalidatesTags:(e,s,{pId:a,fsId:r,id:t,version:i})=>[{id:"LIST",type:o.ProjectTags.TrainingData},{id:`project/${a}/featurestores/${r}/featureview/${t}/version/${i}/provenance/links`,type:o.ProjectTags.Href}]}),addTDKeyword:n.mutation({query:({pId:e,fsId:s,data:a,fvName:r,fvVersion:t,id:i})=>({url:`
        project/${e}/
        featurestores/${s}/
        featureview/${r}/version/${t}/
        trainingdatasets/version/${i}/
        keywords
        `.replace(/\s/g,""),method:"post",data:a}),invalidatesTags:p.cacheByIdArgProperty(o.ProjectTags.TrainingData)}),addTDTags:n.mutation({queryFn:({pId:e,fsId:s,fvName:a,fvVersion:r,id:t,tags:i},c,v,f)=>h(f,i,d=>`
          project/${e}/
          featurestores/${s}/
          featureview/${a}/version/${r}/
          trainingdatasets/version/${t}/
          tags/${d}
          `.replace(/\s/g,"")),invalidatesTags:p.cacheByIdArgProperty(o.ProjectTags.TrainingData)}),deleteTD:n.mutation({query:({pId:e,fsId:s,dataOnly:a,fvName:r,fvVersion:t,id:i})=>({url:`
        project/${e}/
        featurestores/${s}/
        featureview/${r}/version/${t}/
        trainingdatasets/version/${i}
        ${a?"/data":""}
        `.replace(/\s/g,""),method:"delete"}),invalidatesTags:(e,s,{pId:a,fsId:r,fvName:t,fvVersion:i})=>[{id:"LIST",type:o.ProjectTags.TrainingData},{id:`project/${a}/featurestores/${r}/featureview/${t}/version/${i}/provenance/links`,type:o.ProjectTags.Href}]})})}),{useGetAllFVTrainingDatasetsQuery:J,useGetFVTrainingDatasetQuery:U,useGetFVTDStatisticsQuery:W,useComputeTrainingDatasetMutation:X,useCreateTrainingDatasetMutation:Y,useAddTDKeywordMutation:Z,useAddTDTagsMutation:b,useDeleteTDMutation:ee,endpoints:te}=L;export{W as a,U as b,Z as c,b as d,X as e,ee as f,Y as g,te as h,L as t,J as u};
