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-DNBEEyYo.js";import{F as J}from"./FeatureGroupForm-DFyIVGYl.js";import"./defineProperty-9LKwahlh.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./AlertForm-BOLtC7QE.js";import"./alertManagerConfig.selectors-6Q6ry9ha.js";import"./Project-D_38ySn9.js";import"./HumanizedCronExpression-Cc3xtXqn.js";import"./index-DivQJV92.js";import"./form-nDhxPMre.js";import"./symmetricDifference-lQ_DaX5E.js";import"./index-Burx7Ja_.js";import"./git-BLdzamrJ.js";import"./useCopyToClipboard-BnywFRQi.js";import"./ServiceAlertList-BGZarpuB.js";import"./index-DilfZ0pz.js";import"./transformations.selectors-DnzHXZ16.js";import"./LabelsForm-as5sod5c.js";import"./randomString-D3iDJlGT.js";import"./where-B5BSuibK.js";import"./project-BliS-g3U.js";import"./intersection-vX7wnhR7.js";import"./flip-CO85ug7l.js";import"./isAfter-CUgGgEOi.js";import"./useUpdateTdOrFvInfoService-CZYcDMMa.js";import"./index-Bqt-OrF_.js";import"./SingleSelect-DhTVYPhJ.js";import"./FeaturesForm-CzZWLvJz.js";import"./TagsForm-BXATGMc8.js";import"./randomArrayString---X8tfjV.js";import"./sort-BOLIcXtz.js";import"./index-DEeBzOsi.js";import"./StatisticsConfigurationForm-DN8Ay_dc.js";import"./index-XpLJ3bKZ.js";import"./NewTransformationPopup--yFuz-iO.js";import"./ViewTransformation-8wmgMabA.js";import"./index-BCcerhnO.js";import"./zoom-D5h43YeK.js";import"./transform-C2GfmqNu.js";import"./string-cKWu9XK9.js";import"./splitAt-CpEOJQjt.js";import"./index-66RtuHrA.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};
