import{r as n,aY as C,u as k,cK as P,b1 as U,aS as N,e7 as q,m as f,w as c,bk as B,ax as H,dF as K,W as m,gE as L,cW as R,dp as W,gz as z,gA as l,gB as M,gC as Q,s as Y,c as Z,b as g,b3 as $,j as J,gD as V,aZ as X}from"./index-ea7817a2.js";import{u as _}from"./useFeatureGroups-2f66c5f0.js";var F=(e=>(e.job="job",e.start="start",e.fgStats="fgStats",e.newProject="newProject",e.experiments="experiments",e.featuregroup="featuregroup",e))(F||{});const O=()=>{C(X.createFeatureGroup);const{id:e,fsId:a}=k(),{data:{id:i}={}}=P(),t=U(),d=N(),{currentData:v,isFetching:G}=q(),{currentData:T=[],isFetching:h}=_();n.useEffect(()=>{t.schematisedTags.fetch()},[t,e,v,a]);const j=f(c("name"),T),b=n.useCallback(async(p,r)=>{const{features:s,enabled:S,histograms:x,correlations:y,exactUniqueness:E,timeTravelFormat:w,validationType:A,expectationSuite:ee,...D}=p,o=await t.featureGroups.create({projectId:+e,featureStoreId:+a,data:B(H("type",K.STREAM),m(L("timeTravelFormat"),u=>R("primaryKeys",m(W(c("primary")),f(c("name")))(u.features),u)),{...D,features:z(s),timeTravelFormat:w[0].toUpperCase(),descStatsEnabled:!!l(s).length,validationType:A[0].toUpperCase(),eventTime:M(s),jobs:[],statisticsConfig:{columns:l(s),correlations:y,enabled:S,histograms:x,exactUniqueness:E}})});if(o){if(r&&r.length>1){const u={items:r};await t.validationAlert.createBulk({projectId:+e,featureStoreId:+a,featureGroupId:o,validationAlert:u})}else r&&r.length===1&&await t.validationAlert.create({projectId:+e,featureStoreId:+a,featureGroupId:o,validationAlert:r[0]});t(Q.invalidateTags([Y.ProjectTags.FeatureGroup])),t.onboarding.checkSection({userId:i,id:F.featuregroup}),t.onboarding.setOpenOnboarding({userId:i,open:!0}),d(Z(g.featureGroup.overview,g.project.value,{fgId:o,fsId:a,id:e}))}},[t,a,d,e,i]),I=$(p=>p.loading.effects.featureGroups.create);return J.jsx(V,{featureGroupsNames:j,isLoading:G||h,isDisabled:I,submitHandler:b})},re=n.memo(O);export{re as default};
