import{u as E,bh as d,q as n,b4 as L,bf as V,r as p,o as G,aB as N,dQ as P,bb as y,bc as k,j as s,bW as w,L as C,g as R,dq as q}from"./index-CK33qGU_.js";import{P as $}from"./Panel-q_vviXAK.js";import{N as B}from"./NoData-CuLyR2Bg.js";import{C as H}from"./Correlation-DqBxMc97.js";import{u as M}from"./useUserPermissions-CGy0I-II.js";import{u as O}from"./useFeatureGroupView-CYNDCcvd.js";import{u as Q}from"./useFeatureGroupVersions-BNoRnFKV.js";import{p as U}from"./pathSatisfies-CSrP04yE.js";import"./Deprecated-D5xZ0QMJ.js";import"./CardActionButton-DcsFpjJz.js";import"./useDownload-hrjXceJg.js";import"./useProject-BzBQtp4J.js";import"./length-fOfC3W0h.js";import"./Project-j3KdDsvH.js";import"./ButtonWithRole-NHXEosto.js";import"./alertManagerConfig.selectors-BX2JGYEL.js";import"./__-BIxbRvwe.js";import"./complement-M2aUPqXA.js";import"./FileUploaderButton-Bppadu35.js";import"./dumbPluralize-CcxDsNiu.js";import"./PrimaryIconButton-DQUEhx3G.js";import"./zipObj-DQ8OxaYj.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./git-C8OLuEaG.js";import"./useCopyToClipboard-_4vnCVip.js";import"./Anchor-HBBcGDu5.js";import"./transform-C0Urpblx.js";import"./string-CFFdVFMV.js";import"./linear-DWGfDWoG.js";import"./utils-LzNCUvhl.js";import"./storage-connector-BuEuJyVA.js";import"./props-DsctD44O.js";import"./project-C-jJLTjn.js";const vt=()=>{const{id:e,fsId:r,fgId:o,computationTime:a}=E(),l=d(i=>{var u;return(u=i.featureGroupStatistics)==null?void 0:u.entities.statistics}),g=d(i=>i.loading.effects.featureGroupStatistics.fetch),j=d(i=>i.featureGroupStatisticsCommits),{isLoading:h,data:t}=O(+e,+o,+r),{currentData:I=[t],isFetching:x,handleVersionChange:b}=Q(t==null?void 0:t.name,n.featureGroup.correlation),c=L(),m=V(),{canEdit:v,isLoading:D,isDataScientist:S}=M();p.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=p.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=p.useCallback((i,u=o)=>{i&&a!==i&&c(G(n.featureGroup.correlationViewCommit,n.project.value,{id:e,fsId:r,fgId:u,computationTime:i}))},[e,r,c,o,a]),f=p.useMemo(()=>N(U(P,["extendedStatistics","correlations"]),l??{}),[l]);return y(`${k.correlation} ${t!=null&&t.name?t.name:"Feature group"}`),!h&&!t?s.jsx(w,{}):h?s.jsx(C,{}):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||D,onClickEdit:()=>c(G(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:b,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(C,{}),!g&&(!f||R(f)?s.jsx(B,{mainText:"No feature correlation",secondaryText:""}):s.jsx(H,{item:t,correlation:f,type:q.fg}))]})};export{vt as default};
