import{r as u,bG as w,bH as D,u as E,au as A,bW as C,bx as P,h9 as k,bw as U,D as H,ej as q,p as n,hS as L,bD as N,dS as Q,Q as d,ay as R,hb as f,hc as B,hd as K,he as M,O as W,t as X,x as l,bX as _,j as z}from"./index-DHiyXWqE.js";import{F as J}from"./FeatureGroupForm-DCeSlRId.js";import"./defineProperty-C28_3XcK.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./AlertForm-jO9r3OcZ.js";import"./alertManagerConfig.selectors-0se_RTtj.js";import"./Project-DwrxbZJj.js";import"./HumanizedCronExpression-FxwdMNJF.js";import"./index-5hEKE-oe.js";import"./form-CrZPXKpD.js";import"./symmetricDifference-BqIFhGVd.js";import"./index-C52WzLFZ.js";import"./git-BLdzamrJ.js";import"./useCopyToClipboard-D6oq-fy9.js";import"./ServiceAlertList-DMbEJyHm.js";import"./index-5xepsXs7.js";import"./transformations.selectors-DnzHXZ16.js";import"./LabelsForm-RnHUCdeH.js";import"./randomString-D3iDJlGT.js";import"./where-DONtqZCk.js";import"./project-Dyq2GoPZ.js";import"./intersection-Dswuvgyu.js";import"./flip-DHDmt_vj.js";import"./isAfter-DPiW206p.js";import"./useUpdateTdOrFvInfoService-DgmLaBNN.js";import"./index-B2fGm7Ye.js";import"./SingleSelect-CAXL6nES.js";import"./FeaturesForm-D_iMRo0-.js";import"./TagsForm-BQYOp_QK.js";import"./randomArrayString---X8tfjV.js";import"./sort-BOLIcXtz.js";import"./index-Bat3pAWW.js";import"./StatisticsConfigurationForm-B-z7ITEi.js";import"./index-DRFB149W.js";import"./NewTransformationPopup-DKJ0V0F1.js";import"./ViewTransformation-8WFBYh7d.js";import"./index-Y07Nps2b.js";import"./zoom-D5h43YeK.js";import"./transform-C2GfmqNu.js";import"./string-cKWu9XK9.js";import"./splitAt-DhBW3V5v.js";import"./index-GdE_-2fu.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 V=()=>{w(D.createFeatureGroup);const{id:t,fsId:r}=E(),{data:{id:p}={}}=A(),e=C(),c=P(),{currentData:h,isFetching:v}=k();u.useEffect(()=>{e.schematisedTags.fetch()},[e,t,h,r]);const b=u.useCallback(async(m,a)=>{const{features:o,enabled:F,histograms:T,correlations:G,exactUniqueness:S,timeTravelFormat:I,validationType:x,expectationSuite:Y,...y}=m,i=await e.featureGroups.create({projectId:+t,featureStoreId:+r,data:U(H("type",q.STREAM),n(L("timeTravelFormat"),s=>N("primaryKeys",n(Q(d("primary")),R(d("name")))(s.features),s)),{...y,features:K(o),timeTravelFormat:I.toUpperCase(),descStatsEnabled:!!f(o).length,validationType:x[0].toUpperCase(),eventTime:B(o),jobs:[],statisticsConfig:{columns:f(o),correlations:G,enabled:F,histograms:T,exactUniqueness:S}})});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([W.ProjectTags.FeatureGroup])),e.onboarding.checkSection({userId:p,id:g.featuregroup}),e.onboarding.setOpenOnboarding({userId:p,open:!0}),c(X(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 z.jsx(J,{isLoading:v,isDisabled:j,submitHandler:b})},Qt=u.memo(V);export{Qt as default};
