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,ed as y,c5 as H}from"./index-C6OVXshM.js";import{P as O}from"./Panel-Cdyv0nKn.js";import{S as U}from"./StatisticsContent-aJSToj7A.js";import{u as W}from"./useUserPermissions-BXHH193b.js";import{u as X}from"./useFeatureGroupView-B9u8_FoH.js";import{u as Y}from"./useFeatureGroupVersions-BQM3nEnp.js";import"./Deprecated-C2s2xtW5.js";import"./index-wd_Y41lc.js";import"./StatisticsTables-B2YU9CFy.js";import"./randomArrayString---X8tfjV.js";import"./PieChart-BitaLUOT.js";import"./generateCategoricalChart-dv6gjfk1.js";import"./isEqual-DrICj05y.js";import"./bump-BmRQ39WQ.js";import"./linear-C3cNlZpH.js";import"./string-cKWu9XK9.js";import"./max-DBeXZoyG.js";import"./BarChart-DlmymiaW.js";import"./TdFeatureGroupHandle-Cl6xaIKi.js";import"./FeatureGroupTypeBadge-gC-XAV-_.js";import"./useFeatureFilters-C0tQqz2i.js";import"./FeaturesLayout-Dcj-Pm1X.js";import"./FilterResult-DI0HiAXB.js";import"./sort-BOLIcXtz.js";import"./FeatureFilters-CJeOaW51.js";import"./min-BF2EoXpM.js";import"./project-Wd1niWJn.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};
