import{r as u,bx as A,by as E,u as w,ax as C,bI as D,bo as P,gb as k,bn as U,A as q,em as z,p as c,gX as H,bu as L,dz as N,T as d,az as R,ge as f,gf as B,gg as J,gh as K,P as M,s as Q,t as l,bJ as X,j as _}from"./index-_eM6l4Nf.js";import{F as V}from"./FeatureGroupForm-D3AqUOaO.js";import"./Anchor-JEsUSbQH.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./schematised-tags.selectors-WK3AUml0.js";import"./AlertForm-CPn3G8rh.js";import"./alertManagerConfig.selectors-B-zYrdGC.js";import"./Project-BTH4PZdL.js";import"./complement-CE-nEpWn.js";import"./index-B-5JhFyZ.js";import"./form-CMT9TYED.js";import"./symmetricDifference-BIbwssIf.js";import"./git-BLdzamrJ.js";import"./useCopyToClipboard-BUvZjse8.js";import"./ServiceAlertList-BHObHhAU.js";import"./index-CpvNjjPQ.js";import"./transformations.selectors-DnzHXZ16.js";import"./LabelsForm-CVLhfBzG.js";import"./randomString-D3iDJlGT.js";import"./project-CRArgp9U.js";import"./where-B0yrqZx2.js";import"./intersection-CujIHiSA.js";import"./flip-EX8WycHt.js";import"./isAfter-CJl-vCKj.js";import"./useUpdateTdOrFvInfoService-Byz_Aakv.js";import"./index-mh_z6Yg4.js";import"./SingleSelect-DCo75wUx.js";import"./FeaturesForm-Cft0Qak8.js";import"./SchematisedTagsForm-D8cUEyzq.js";import"./randomArrayString---X8tfjV.js";import"./sort-BOLIcXtz.js";import"./index-BXwHI1zk.js";import"./StatisticsConfigurationForm-B_SK-LNg.js";import"./index-CZNL5XBB.js";import"./NewTransformationPopup-BEFT03Vq.js";import"./ViewTransformation-D-2ijvBj.js";import"./index-E_WbQbNt.js";import"./zoom-B-6v1BMB.js";import"./transform-Cm7rL0Nj.js";import"./string-cKWu9XK9.js";import"./splitAt-BNOQKbGd.js";var g=(t=>(t.job="job",t.start="start",t.fgStats="fgStats",t.newProject="newProject",t.experiments="experiments",t.featuregroup="featuregroup",t))(g||{});const W=()=>{A(E.createFeatureGroup);const{id:t,fsId:r}=w(),{data:{id:p}={}}=C(),e=D(),n=P(),{currentData:v,isFetching:b}=k();u.useEffect(()=>{e.schematisedTags.fetch()},[e,t,v,r]);const F=u.useCallback(async(m,a)=>{const{features:o,enabled:j,histograms:h,correlations:G,exactUniqueness:I,timeTravelFormat:x,validationType:y,expectationSuite:Y,...S}=m,i=await e.featureGroups.create({projectId:+t,featureStoreId:+r,data:U(q("type",z.STREAM),c(H("timeTravelFormat"),s=>L("primaryKeys",c(N(d("primary")),R(d("name")))(s.features),s)),{...S,features:J(o),timeTravelFormat:x.toUpperCase(),descStatsEnabled:!!f(o).length,validationType:y[0].toUpperCase(),eventTime:B(o),jobs:[],statisticsConfig:{columns:f(o),correlations:G,enabled:j,histograms:h,exactUniqueness:I}})});if(i){if(a&&a.length>1){const s={items:a};await e.validationAlert.createBulk({projectId:+t,featureStoreId:+r,featureGroupId:i,validationAlert:s})}else a&&a.length===1&&await e.validationAlert.create({projectId:+t,featureStoreId:+r,featureGroupId:i,validationAlert:a[0]});e(K.invalidateTags([M.ProjectTags.FeatureGroup])),e.onboarding.checkSection({userId:p,id:g.featuregroup}),e.onboarding.setOpenOnboarding({userId:p,open:!0}),n(Q(l.project.featureGroup.overview,l.project.value,{fgId:i,fsId:r,id:t}))}},[e,r,n,t,p]),T=X(m=>m.loading.effects.featureGroups.create);return _.jsx(V,{isLoading:b,isDisabled:T,submitHandler:F})},Lt=u.memo(W);export{Lt as default};
