import{r as u,bC as w,u as A,av as D,aD as E,bw as C,fb as P,bv as k,z as U,e3 as q,p as c,gp as L,bA as H,a_ as N,X as f,ax as R,f_ as _,f$ as d,g0 as $,g1 as z,W as B,q as K,s as l,aL as M,j as Q,bD as W}from"./index-dP1W1_bd.js";import{F as X}from"./FeatureGroupForm-CGNnrPbL.js";import"./Anchor-B_lGyhCa.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./schematised-tags.selectors-xn4c-iOu.js";import"./storage-connector-BuEuJyVA.js";import"./AlertForm-DGh3QYA7.js";import"./alertManagerConfig.selectors-B_R5cvew.js";import"./Project-CsYwwOpN.js";import"./ButtonWithRole-CF64B_Or.js";import"./__-BIxbRvwe.js";import"./useDownload-C3yCvYJa.js";import"./useProject-CXVt1xnE.js";import"./length-BzpOfCdE.js";import"./complement-D_Q2yZKt.js";import"./index-MHdXqM53.js";import"./FileUploaderButton-frSujVRY.js";import"./uniq-98MdbBvs.js";import"./uniqBy-6mvKp2Ip.js";import"./dumbPluralize-CcxDsNiu.js";import"./CardActionButton-BtCnEqTK.js";import"./utils-UGwNsahk.js";import"./useKeyPress-OcDHupLZ.js";import"./zipObj-DEkcXp9d.js";import"./symmetricDifference-mJT60wVA.js";import"./git-C8OLuEaG.js";import"./NoData-DLZ_8GEo.js";import"./useCopyToClipboard-DTBM3H3Z.js";import"./ServiceAlertList-DlanmsKI.js";import"./index-DOE28Q4t.js";import"./transformations.selectors-DnzHXZ16.js";import"./LabelsForm-BIr8LRP6.js";import"./randomString-D3iDJlGT.js";import"./project-B1Z_dM9_.js";import"./where-Dy55ClhW.js";import"./intersection-CpRqLFol.js";import"./flip-etQOAW1x.js";import"./isAfter-Bc2eJAcB.js";import"./useUpdateTdOrFvInfoService-Rjt2OAr8.js";import"./index-D6I0YfaY.js";import"./SingleSelect-B8f6hurf.js";import"./SchematisedTagsForm-DmZAUPYh.js";import"./randomArrayString---X8tfjV.js";import"./sort-BOLIcXtz.js";import"./index-DEBSKkGo.js";import"./StatisticsConfigurationForm-5dQkFKI8.js";import"./index-DG59sqU_.js";import"./NewTransformationPopup-Dn8wsxP8.js";import"./ViewTransformation-xgCYfmc6.js";import"./index-TtxdA7bE.js";import"./zoom-CRTJnDeN.js";import"./transform-C0Urpblx.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 J=()=>{w(W.createFeatureGroup);const{id:t,fsId:r}=A(),{data:{id:s}={}}=D(),e=E(),n=C(),{currentData:v,isFetching:F}=P();u.useEffect(()=>{e.schematisedTags.fetch()},[e,t,v,r]);const b=u.useCallback(async(m,a)=>{const{features:o,enabled:j,histograms:G,correlations:h,exactUniqueness:I,timeTravelFormat:S,validationType:x,expectationSuite:V,...y}=m,i=await e.featureGroups.create({projectId:+t,featureStoreId:+r,data:k(U("type",q.STREAM),c(L("timeTravelFormat"),p=>H("primaryKeys",c(N(f("primary")),R(f("name")))(p.features),p)),{...y,features:_(o),timeTravelFormat:S.toUpperCase(),descStatsEnabled:!!d(o).length,validationType:x[0].toUpperCase(),eventTime:$(o),jobs:[],statisticsConfig:{columns:d(o),correlations:h,enabled:j,histograms:G,exactUniqueness:I}})});if(i){if(a&&a.length>1){const p={items:a};await e.validationAlert.createBulk({projectId:+t,featureStoreId:+r,featureGroupId:i,validationAlert:p})}else a&&a.length===1&&await e.validationAlert.create({projectId:+t,featureStoreId:+r,featureGroupId:i,validationAlert:a[0]});e(z.invalidateTags([B.ProjectTags.FeatureGroup])),e.onboarding.checkSection({userId:s,id:g.featuregroup}),e.onboarding.setOpenOnboarding({userId:s,open:!0}),n(K(l.featureGroup.overview,l.project.value,{fgId:i,fsId:r,id:t}))}},[e,r,n,t,s]),T=M(m=>m.loading.effects.featureGroups.create);return Q.jsx(X,{isLoading:F,isDisabled:T,submitHandler:b})},Vt=u.memo(J);export{Vt as default};
