import{r as u,bb as A,u as E,aq as w,bf as C,b4 as D,eK as U,b3 as q,A as P,du as k,f as n,fU as H,b9 as K,cF as L,U as f,as as N,fp as R,fq as d,fr as B,fs as M,O as Q,o as $,q as l,bh as z,j as J,bc as V}from"./index-CK33qGU_.js";import{F as W}from"./FeatureGroupForm-Bnc8TAZ_.js";import"./Anchor-HBBcGDu5.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./schematised-tags.selectors-xn4c-iOu.js";import"./storage-connector-BuEuJyVA.js";import"./AlertForm-BWXdFIuw.js";import"./alertManagerConfig.selectors-BX2JGYEL.js";import"./Project-j3KdDsvH.js";import"./ButtonWithRole-NHXEosto.js";import"./__-BIxbRvwe.js";import"./useDownload-hrjXceJg.js";import"./useProject-BzBQtp4J.js";import"./length-fOfC3W0h.js";import"./complement-M2aUPqXA.js";import"./FileUploaderButton-Bppadu35.js";import"./dumbPluralize-CcxDsNiu.js";import"./PrimaryIconButton-DQUEhx3G.js";import"./zipObj-DQ8OxaYj.js";import"./git-C8OLuEaG.js";import"./NoData-CuLyR2Bg.js";import"./useCopyToClipboard-_4vnCVip.js";import"./ServiceAlertList-BdM6y14f.js";import"./index-CKCOe8Wi.js";import"./utils-37_jnP5r.js";import"./index-CIxm3shV.js";import"./transformations.selectors-DnzHXZ16.js";import"./LabelsForm-CXM09GXF.js";import"./randomString-D3iDJlGT.js";import"./project-C-jJLTjn.js";import"./where-Mo9A6TUc.js";import"./flip-BOjSlIdl.js";import"./symmetricDifference-BM7wpjYU.js";import"./isAfter-DXq4FRTQ.js";import"./useUpdateTdOrFvInfoService-iD5D3Lyd.js";import"./index-Z2NVN_R3.js";import"./SingleSelect-CV8k2k_j.js";import"./SchematisedTagsForm-BQySjcvw.js";import"./randomArrayString---X8tfjV.js";import"./sort-BOLIcXtz.js";import"./index-B4h3z62J.js";import"./StatisticsConfigurationForm-CIhaZTg5.js";import"./index-DnFHOcek.js";import"./NewTransformationPopup-sCZyxBfG.js";import"./ViewTransformation-B_KH3iXm.js";import"./index-DPxTMw0E.js";import"./zoom-CRTJnDeN.js";import"./transform-C0Urpblx.js";import"./string-CFFdVFMV.js";import"./pathSatisfies-CSrP04yE.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(V.createFeatureGroup);const{id:t,fsId:r}=E(),{data:{id:p}={}}=w(),e=C(),c=D(),{currentData:v,isFetching:b}=U();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:S,validationType:y,expectationSuite:Y,...x}=m,i=await e.featureGroups.create({projectId:+t,featureStoreId:+r,data:q(P("type",k.STREAM),n(H("timeTravelFormat"),s=>K("primaryKeys",n(L(f("primary")),N(f("name")))(s.features),s)),{...x,features:R(o),timeTravelFormat:S.toUpperCase(),descStatsEnabled:!!d(o).length,validationType:y[0].toUpperCase(),eventTime:B(o),jobs:[],statisticsConfig:{columns:d(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(M.invalidateTags([Q.ProjectTags.FeatureGroup])),e.onboarding.checkSection({userId:p,id:g.featuregroup}),e.onboarding.setOpenOnboarding({userId:p,open:!0}),c($(l.featureGroup.overview,l.project.value,{fgId:i,fsId:r,id:t}))}},[e,r,c,t,p]),T=z(m=>m.loading.effects.featureGroups.create);return J.jsx(W,{isLoading:b,isDisabled:T,submitHandler:F})},Vt=u.memo(X);export{Vt as default};
