import{r as u,bx as A,by as E,u as w,ax as C,bI as D,bo as k,g7 as P,bn as U,A as q,ek as L,p as n,gL as H,bu as N,dx as Q,U as d,az as R,g9 as f,ga as z,gb as B,gc as J,Q as K,o as M,q as l,bJ as $,j as V}from"./index-ljTaFLaB.js";import{F as W}from"./FeatureGroupForm-DFR6uGgJ.js";import"./Anchor-Cg_B9iW8.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./schematised-tags.selectors-WK3AUml0.js";import"./AlertForm-BNPL7Piu.js";import"./alertManagerConfig.selectors-DirIHxFq.js";import"./Project-BXqiQm5O.js";import"./complement-DcmnDjwS.js";import"./index-WyeuJRlK.js";import"./symmetricDifference-Chhazvqc.js";import"./git-BLdzamrJ.js";import"./useCopyToClipboard-CNgp2sLY.js";import"./ServiceAlertList-DPC1ApKd.js";import"./index-CFrWJVZR.js";import"./transformations.selectors-DnzHXZ16.js";import"./LabelsForm-rGCSSNxA.js";import"./randomString-D3iDJlGT.js";import"./project-FezsFbBI.js";import"./where-CKvYL2Df.js";import"./intersection-B1iDcdOv.js";import"./flip-DVsL-10L.js";import"./isAfter-DUSi0zl2.js";import"./useUpdateTdOrFvInfoService-BmKEmn5U.js";import"./index-CRcQpcPt.js";import"./SingleSelect-6Q2B8ZHD.js";import"./FeaturesForm-CmOULT7K.js";import"./SchematisedTagsForm-DnH6WBYV.js";import"./randomArrayString---X8tfjV.js";import"./sort-BOLIcXtz.js";import"./index-Df7phmI_.js";import"./StatisticsConfigurationForm-D_70U16b.js";import"./index-FNYIAcGm.js";import"./NewTransformationPopup-C6hqMfNs.js";import"./ViewTransformation-Di63QQDd.js";import"./index-D4sG62Gj.js";import"./zoom-A7rKCg-F.js";import"./transform-DZgNhtp2.js";import"./string-CFFdVFMV.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 X=()=>{A(E.createFeatureGroup);const{id:t,fsId:r}=w(),{data:{id:p}={}}=C(),e=D(),c=k(),{currentData:v,isFetching:b}=P();u.useEffect(()=>{e.schematisedTags.fetch()},[e,t,v,r]);const F=u.useCallback(async(m,a)=>{const{features:o,enabled:T,histograms:G,correlations:I,exactUniqueness:h,timeTravelFormat:x,validationType:y,expectationSuite:Y,...S}=m,i=await e.featureGroups.create({projectId:+t,featureStoreId:+r,data:U(q("type",L.STREAM),n(H("timeTravelFormat"),s=>N("primaryKeys",n(Q(d("primary")),R(d("name")))(s.features),s)),{...S,features:B(o),timeTravelFormat:x.toUpperCase(),descStatsEnabled:!!f(o).length,validationType:y[0].toUpperCase(),eventTime:z(o),jobs:[],statisticsConfig:{columns:f(o),correlations:I,enabled:T,histograms:G,exactUniqueness:h}})});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(J.invalidateTags([K.ProjectTags.FeatureGroup])),e.onboarding.checkSection({userId:p,id:g.featuregroup}),e.onboarding.setOpenOnboarding({userId:p,open:!0}),c(M(l.project.featureGroup.overview,l.project.value,{fgId:i,fsId:r,id:t}))}},[e,r,c,t,p]),j=$(m=>m.loading.effects.featureGroups.create);return V.jsx(W,{isLoading:b,isDisabled:j,submitHandler:F})},Lt=u.memo(X);export{Lt as default};
