import{u as E,db as w,bX as f,x as u,bW as R,bx as $,r as d,t as l,bG as k,bH as N,j as c,L as j,ee as y,c5 as H}from"./index-DNBEEyYo.js";import{P as O}from"./Panel-LhPx0w--.js";import{S as U}from"./StatisticsContent-reHnjWjB.js";import{u as W}from"./useUserPermissions-j5Zhfxzb.js";import{u as X}from"./useFeatureGroupView-DPDbQRsB.js";import{u as Y}from"./useFeatureGroupVersions-jUPRdWtO.js";import"./Deprecated-DmDD0-tM.js";import"./index-CFXrGVj-.js";import"./StatisticsTables-eKzOr7AN.js";import"./randomArrayString---X8tfjV.js";import"./PieChart-CDc3QLRP.js";import"./generateCategoricalChart-BC7jg59_.js";import"./isEqual-Caw4eDkN.js";import"./bump-BmRQ39WQ.js";import"./linear-C3cNlZpH.js";import"./string-cKWu9XK9.js";import"./max-DBeXZoyG.js";import"./BarChart-Bo6mG_3p.js";import"./TdFeatureGroupHandle-Bq7zo0Gr.js";import"./FeatureGroupTypeBadge-CDk6DuZk.js";import"./useFeatureFilters-C5S7nVk2.js";import"./FeaturesLayout-Bz5GofId.js";import"./FilterResult-BeVdIco_.js";import"./sort-BOLIcXtz.js";import"./FeatureFilters-DtP7PViD.js";import"./min-EeSpVhPj.js";import"./project-BliS-g3U.js";const Gt=()=>{const{id:e,fsId:s,fgId:r,computationTime:a}=E(),[p]=w(),{canEdit:I,isLoading:C,isDataScientist:h,isFeatureStoreRestricted:g}=W(),G=f(i=>{var m;return(m=i.featureGroupStatistics)==null?void 0:m.entities.statistics}),x=f(i=>i.featureGroupStatisticsCommits),S=f(i=>i.loading.effects.featureGroupStatistics.fetch),{data:t,isLoading:b}=X(+e,+r,+s),{currentData:v=[t],isFetching:D,handleVersionChange:F}=Y(t==null?void 0:t.name,u.project.featureGroup.statistics),o=R(),n=$(),P=d.useCallback(()=>{o.featureGroupStatisticsCommits.fetch({projectId:+e,featureStoreId:+s,featureGroupId:+r}),o.featureGroupStatistics.fetch({projectId:+e,featureStoreId:+s,featureGroupId:+r,computationTime:a})},[o.featureGroupStatisticsCommits,o.featureGroupStatistics,e,s,r,a]),T=d.useCallback((i,m=r)=>{if(i&&a!==i){const L=u.project.featureGroup.statisticsViewCommit,V={id:e,fsId:s,fgId:m,computationTime:i};n(l(L,u.project.value,V)+(p?`?${p}`:""));return}n(l(u.project.featureGroup.statistics,u.project.value,{id:e,fsId:s,fgId:m})+(p?`?${p}`:""))},[e,s,n,r,a,p]);return d.useEffect(()=>(o.featureGroupStatisticsCommits.fetch({projectId:+e,featureStoreId:+s,featureGroupId:+r}),o.featureGroupStatistics.fetch({projectId:+e,featureStoreId:+s,featureGroupId:+r,computationTime:a}),()=>{o.featureGroupDataPreview.clear()}),[e,r,o,s,a]),k(`${N.statistics} ${t!=null&&t.name?` - ${t.name}`:""}`),b?c.jsx(j,{}):c.jsxs(c.Fragment,{children:[c.jsx(O,{type:y.fg,data:t,title:t==null?void 0:t.name,idColor:(t==null?void 0:t.type)==="onDemandFeaturegroupDTO"?"labels.blue":"labels.orange",isEditDisabled:!I||h||g||C,onClickEdit:()=>n(l(u.project.featureGroup.edit,u.project.value,{id:e,fsId:s,fgId:r})),onClickRefresh:P,version:t==null?void 0:t.version,versions:v,isVersionsLoading:D,onVersionChange:F,hasCommits:!0,commits:x||[],commit:a,handleCommitChange:T,pathnamePostFix:"/statistics",editRightText:h||g?"Your role is not allowed to perform this action":void 0}),S&&c.jsx(j,{}),!S&&(!(t!=null&&t.features.length)||!G?c.jsx(H,{mainText:"No data available"}):c.jsx(U,{data:t,statistics:G}))]})};export{Gt as default};
