import{r as u,bw as w,bx as A,u as E,ax as C,bH as D,bo as P,g4 as U,bn as k,A as q,ej as H,p as c,gI as L,bt as N,dw as Q,U as d,az as R,g6 as f,g7 as z,g8 as B,g9 as K,Q as M,o as $,q as l,bI as J,j as V}from"./index-46ma1THH.js";import{F as W}from"./FeatureGroupForm-BCvGH9AR.js";import"./Anchor-VqM1KJ3L.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./schematised-tags.selectors-WK3AUml0.js";import"./AlertForm-BcJ4dT7r.js";import"./alertManagerConfig.selectors-ByceE4ck.js";import"./Project-DqNODNns.js";import"./complement-Cl658Mix.js";import"./index-CcWUz40c.js";import"./symmetricDifference-Bbf2VNbK.js";import"./git-BLdzamrJ.js";import"./useCopyToClipboard-B8vQLvqE.js";import"./ServiceAlertList-BRlmr1Cp.js";import"./index-BOKQPbnb.js";import"./transformations.selectors-DnzHXZ16.js";import"./LabelsForm-didD155z.js";import"./randomString-D3iDJlGT.js";import"./project-DhxCVD8Q.js";import"./where-BYLuQ215.js";import"./intersection-DOkgR8_-.js";import"./flip-szqi4alz.js";import"./isAfter-C0OnBXsh.js";import"./useUpdateTdOrFvInfoService-BiDORrPs.js";import"./index-CyflCCZl.js";import"./SingleSelect-DyMHGSBW.js";import"./FeaturesForm-CufhwCoR.js";import"./SchematisedTagsForm-dh4vAE2D.js";import"./randomArrayString---X8tfjV.js";import"./sort-BOLIcXtz.js";import"./index-D241LvV7.js";import"./StatisticsConfigurationForm-8hTSbrIW.js";import"./index-CEcdCfcT.js";import"./NewTransformationPopup-BfKLghWw.js";import"./ViewTransformation-BHQuUfcb.js";import"./index-BSYtROPn.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=()=>{w(A.createFeatureGroup);const{id:t,fsId:r}=E(),{data:{id:p}={}}=C(),e=D(),n=P(),{currentData:v,isFetching:b}=U();u.useEffect(()=>{e.schematisedTags.fetch()},[e,t,v,r]);const j=u.useCallback(async(m,a)=>{const{features:o,enabled:T,histograms:I,correlations:G,exactUniqueness:h,timeTravelFormat:x,validationType:S,expectationSuite:Y,...y}=m,i=await e.featureGroups.create({projectId:+t,featureStoreId:+r,data:k(q("type",H.STREAM),c(L("timeTravelFormat"),s=>N("primaryKeys",c(Q(d("primary")),R(d("name")))(s.features),s)),{...y,features:B(o),timeTravelFormat:x.toUpperCase(),descStatsEnabled:!!f(o).length,validationType:S[0].toUpperCase(),eventTime:z(o),jobs:[],statisticsConfig:{columns:f(o),correlations:G,enabled:T,histograms:I,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(K.invalidateTags([M.ProjectTags.FeatureGroup])),e.onboarding.checkSection({userId:p,id:g.featuregroup}),e.onboarding.setOpenOnboarding({userId:p,open:!0}),n($(l.project.featureGroup.overview,l.project.value,{fgId:i,fsId:r,id:t}))}},[e,r,n,t,p]),F=J(m=>m.loading.effects.featureGroups.create);return V.jsx(W,{isLoading:b,isDisabled:F,submitHandler:j})},Ht=u.memo(X);export{Ht as default};
