import{u as E,bI as l,q as u,bo as V,bH as L,r as m,o as j,aJ as P,gf as w,eC as y,bw as N,bx as k,j as i,cp as R,D as C,h as H,bS as $,ee as q}from"./index-46ma1THH.js";import{P as J}from"./Panel-CnxQ3Lqy.js";import{C as M}from"./Correlation-DmzPtXsH.js";import{u as O}from"./useUserPermissions-DiAMkzC6.js";import{u as U}from"./useFeatureGroupView-BGqRdiCP.js";import{u as Y}from"./useFeatureGroupVersions-BlKa4CNF.js";import"./Deprecated-CcWZugSq.js";import"./Project-DqNODNns.js";import"./alertManagerConfig.selectors-ByceE4ck.js";import"./complement-Cl658Mix.js";import"./index-CcWUz40c.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./symmetricDifference-Bbf2VNbK.js";import"./git-BLdzamrJ.js";import"./useCopyToClipboard-B8vQLvqE.js";import"./Anchor-VqM1KJ3L.js";import"./transform-DZgNhtp2.js";import"./string-CFFdVFMV.js";import"./linear-Fo8SwKqx.js";import"./project-DhxCVD8Q.js";const pt=()=>{const{id:e,fsId:r,fgId:o,computationTime:a}=E(),d=l(s=>{var c;return(c=s.featureGroupStatistics)==null?void 0:c.entities.statistics}),g=l(s=>s.loading.effects.featureGroupStatistics.fetch),G=l(s=>s.featureGroupStatisticsCommits),{isLoading:h,data:t}=U(+e,+o,+r),{currentData:I=[t],isFetching:x,handleVersionChange:b}=Y(t==null?void 0:t.name,u.project.featureGroup.correlation),p=V(),n=L(),{canEdit:v,isLoading:D,isDataScientist:S}=O();m.useEffect(()=>{n.featureGroupStatisticsCommits.fetch({projectId:+e,featureStoreId:+r,featureGroupId:+o}),n.featureGroupStatistics.fetch({projectId:+e,featureStoreId:+r,featureGroupId:+o,computationTime:a})},[e,o,n,r,a]);const F=m.useCallback(()=>{n.featureGroupStatisticsCommits.fetch({projectId:+e,featureStoreId:+r,featureGroupId:+o}),n.featureGroupStatistics.fetch({projectId:+e,featureStoreId:+r,featureGroupId:+o,computationTime:a})},[n.featureGroupStatisticsCommits,n.featureGroupStatistics,e,r,o,a]),T=m.useCallback((s,c=o)=>{s&&a!==s&&p(j(u.project.featureGroup.correlationViewCommit,u.project.value,{id:e,fsId:r,fgId:c,computationTime:s}))},[e,r,p,o,a]),f=m.useMemo(()=>P(w(y,["extendedStatistics","correlations"]),d??{}),[d]);return N(`${k.correlation} ${t!=null&&t.name?t.name:"Feature group"}`),!h&&!t?i.jsx(R,{}):h?i.jsx(C,{}):i.jsxs(i.Fragment,{children:[i.jsx(J,{title:t.name,data:t,idColor:(t==null?void 0:t.type)==="onDemandFeaturegroupDTO"?"labels.blue":"labels.orange",isEditDisabled:!v||S||D,onClickEdit:()=>p(j(u.project.featureGroup.edit,u.project.value,{id:e,fsId:r,fgId:o})),onClickRefresh:F,version:t==null?void 0:t.version,versions:I||[],isVersionsLoading:x,onVersionChange:b,hasCommits:!0,commits:G||[],commit:a,handleCommitChange:T,pathnamePostFix:"/correlation",editRightText:S?"Your role is not allowed to perform this action":void 0}),g&&i.jsx(C,{}),!g&&(!f||H(f)?i.jsx($,{mainText:"No feature correlation",secondaryText:""}):i.jsx(M,{item:t,correlation:f,type:q.fg}))]})};export{pt as default};
