import{u as E,aL as l,s as n,bw as L,aD as N,r as u,q as C,aN as V,aO as P,bC as k,bD as w,j as s,ck as y,L as G,g as R,e0 as O}from"./index-dP1W1_bd.js";import{P as $}from"./Panel-M9AVvYdm.js";import{N as q}from"./NoData-DLZ_8GEo.js";import{C as H}from"./Correlation-ErXXZXUY.js";import{u as M}from"./useUserPermissions-Olw8jjZn.js";import{u as U}from"./useFeatureGroupView-BhSXc6yu.js";import{u as Y}from"./useFeatureGroupVersions-BkufbG6T.js";import{p as z}from"./Project-CsYwwOpN.js";import"./Deprecated-ClfPkp7s.js";import"./CardActionButton-BtCnEqTK.js";import"./uniqBy-6mvKp2Ip.js";import"./transform-C0Urpblx.js";import"./string-CFFdVFMV.js";import"./linear-DWGfDWoG.js";import"./utils-3BV3J1PE.js";import"./storage-connector-BuEuJyVA.js";import"./useDownload-C3yCvYJa.js";import"./useProject-CXVt1xnE.js";import"./length-BzpOfCdE.js";import"./FileUploaderButton-frSujVRY.js";import"./uniq-98MdbBvs.js";import"./dumbPluralize-CcxDsNiu.js";import"./zipObj-DEkcXp9d.js";import"./project-B1Z_dM9_.js";import"./ButtonWithRole-CF64B_Or.js";import"./alertManagerConfig.selectors-B_R5cvew.js";import"./__-BIxbRvwe.js";import"./complement-D_Q2yZKt.js";import"./index-MHdXqM53.js";import"./utils-UGwNsahk.js";import"./useKeyPress-OcDHupLZ.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./symmetricDifference-mJT60wVA.js";import"./git-C8OLuEaG.js";import"./useCopyToClipboard-DTBM3H3Z.js";import"./Anchor-B_lGyhCa.js";const Tt=()=>{const{id:e,fsId:r,fgId:o,computationTime:a}=E(),d=l(i=>{var p;return(p=i.featureGroupStatistics)==null?void 0:p.entities.statistics}),g=l(i=>i.loading.effects.featureGroupStatistics.fetch),j=l(i=>i.featureGroupStatisticsCommits),{isLoading:h,data:t}=U(+e,+o,+r),{currentData:I=[t],isFetching:x,handleVersionChange:D}=Y(t==null?void 0:t.name,n.featureGroup.correlation),c=L(),m=N(),{canEdit:v,isLoading:b,isDataScientist:S}=M();u.useEffect(()=>{m.featureGroupStatisticsCommits.fetch({projectId:+e,featureStoreId:+r,featureGroupId:+o}),m.featureGroupStatistics.fetch({projectId:+e,featureStoreId:+r,featureGroupId:+o,computationTime:a})},[e,o,m,r,a]);const F=u.useCallback(()=>{m.featureGroupStatisticsCommits.fetch({projectId:+e,featureStoreId:+r,featureGroupId:+o}),m.featureGroupStatistics.fetch({projectId:+e,featureStoreId:+r,featureGroupId:+o,computationTime:a})},[m.featureGroupStatisticsCommits,m.featureGroupStatistics,e,r,o,a]),T=u.useCallback((i,p=o)=>{i&&a!==i&&c(C(n.featureGroup.correlationViewCommit,n.project.value,{id:e,fsId:r,fgId:p,computationTime:i}))},[e,r,c,o,a]),f=u.useMemo(()=>V(z(P,["extendedStatistics","correlations"]),d??{}),[d]);return k(`${w.correlation} ${t!=null&&t.name?t.name:"Feature group"}`),!h&&!t?s.jsx(y,{}):h?s.jsx(G,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{title:t.name,data:t,idColor:(t==null?void 0:t.type)==="onDemandFeaturegroupDTO"?"labels.blue":"labels.orange",isEditDisabled:!v||S||b,onClickEdit:()=>c(C(n.featureGroup.edit,n.project.value,{id:e,fsId:r,fgId:o})),onClickRefresh:F,version:t==null?void 0:t.version,versions:I||[],isVersionsLoading:x,onVersionChange:D,hasCommits:!0,commits:j||[],commit:a,handleCommitChange:T,pathnamePostFix:"/correlation",editRightText:S?"Your role is not allowed to perform this action":void 0}),g&&s.jsx(G,{}),!g&&(!f||R(f)?s.jsx(q,{mainText:"No feature correlation",secondaryText:""}):s.jsx(H,{item:t,correlation:f,type:O.fg}))]})};export{Tt as default};
