import{u as L,bX as l,x as u,bx as V,bW as P,r as m,t as G,aU as y,gW as N,eD as R,bG as k,bH as w,j as i,cE as H,L as x,h as U,c5 as W,ee as $}from"./index-DHiyXWqE.js";import{P as M}from"./Panel-VWoblIge.js";import{C as O}from"./Correlation-BcwnH8GK.js";import{u as X}from"./useUserPermissions-BpHid_5k.js";import{u as Y}from"./useFeatureGroupView-BAYuevu9.js";import{u as q}from"./useFeatureGroupVersions-Ckg-j97p.js";import"./Deprecated-C23Jh13V.js";import"./Project-DwrxbZJj.js";import"./alertManagerConfig.selectors-0se_RTtj.js";import"./defineProperty-C28_3XcK.js";import"./HumanizedCronExpression-FxwdMNJF.js";import"./index-5hEKE-oe.js";import"./form-CrZPXKpD.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./symmetricDifference-BqIFhGVd.js";import"./index-C52WzLFZ.js";import"./git-BLdzamrJ.js";import"./useCopyToClipboard-D6oq-fy9.js";import"./transform-C2GfmqNu.js";import"./string-cKWu9XK9.js";import"./linear-C3cNlZpH.js";import"./project-Dyq2GoPZ.js";const dt=()=>{const{id:e,fsId:r,fgId:o,computationTime:a}=L(),d=l(s=>{var c;return(c=s.featureGroupStatistics)==null?void 0:c.entities.statistics}),g=l(s=>s.loading.effects.featureGroupStatistics.fetch),C=l(s=>s.featureGroupStatisticsCommits),{isLoading:h,data:t}=Y(+e,+o,+r),{currentData:I=[t],isFetching:b,handleVersionChange:v}=q(t==null?void 0:t.name,u.project.featureGroup.correlation),p=V(),n=P(),{canEdit:D,isLoading:F,isDataScientist:S,isFeatureStoreRestricted:j}=X();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 E=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(G(u.project.featureGroup.correlationViewCommit,u.project.value,{id:e,fsId:r,fgId:c,computationTime:s}))},[e,r,p,o,a]),f=m.useMemo(()=>y(N(R,["extendedStatistics","correlations"]),d??{}),[d]);return k(`${w.correlation} ${t!=null&&t.name?t.name:"Feature group"}`),!h&&!t?i.jsx(H,{}):h?i.jsx(x,{}):i.jsxs(i.Fragment,{children:[i.jsx(M,{title:t.name,data:t,idColor:(t==null?void 0:t.type)==="onDemandFeaturegroupDTO"?"labels.blue":"labels.orange",isEditDisabled:!D||S||j||F,onClickEdit:()=>p(G(u.project.featureGroup.edit,u.project.value,{id:e,fsId:r,fgId:o})),onClickRefresh:E,version:t==null?void 0:t.version,versions:I||[],isVersionsLoading:b,onVersionChange:v,hasCommits:!0,commits:C||[],commit:a,handleCommitChange:T,pathnamePostFix:"/correlation",editRightText:S||j?"Your role is not allowed to perform this action":void 0}),g&&i.jsx(x,{}),!g&&(!f||U(f)?i.jsx(W,{mainText:"No feature correlation",secondaryText:""}):i.jsx(O,{item:t,correlation:f,type:$.fg}))]})};export{dt as default};
