import{u as E,d0 as L,bJ as f,t as u,bI as w,bo as $,r as d,s as l,bx as k,by as y,j as c,D as S,eh as N,bT as R}from"./index-_eM6l4Nf.js";import{P as H}from"./Panel-BNKhRIJO.js";import{S as J}from"./StatisticsContent-K7mFK1un.js";import{u as O}from"./useUserPermissions-Dd9YjnbM.js";import{u as U}from"./useFeatureGroupView-BE-wFUIp.js";import{u as Y}from"./useFeatureGroupVersions-D2tWga8L.js";import"./Deprecated-Cn0z8EIY.js";import"./index-CF1bKnX4.js";import"./StatisticsTables-C0Yy4Jvz.js";import"./randomArrayString---X8tfjV.js";import"./generateCategoricalChart-BCVlxI0r.js";import"./bump-BmRQ39WQ.js";import"./linear-XCPlS1sw.js";import"./string-cKWu9XK9.js";import"./max-DBeXZoyG.js";import"./BarChart-CdzfzD6n.js";import"./TdFeatureGroupHandle-nOWLgnW1.js";import"./FeatureGroupTypeBadge-CTMzMdrC.js";import"./useFeatureFilters-DHl2jdlW.js";import"./FeaturesLayout-B9Mpmu_2.js";import"./FilterResult-DzQsF93v.js";import"./sort-BOLIcXtz.js";import"./FeatureFilters-B-XNaevL.js";import"./min-CIERvabW.js";import"./project-CRArgp9U.js";const lt=()=>{const{id:e,fsId:s,fgId:r,computationTime:a}=E(),[n]=L(),{canEdit:j,isLoading:I,isDataScientist:h}=O(),g=f(i=>{var p;return(p=i.featureGroupStatistics)==null?void 0:p.entities.statistics}),C=f(i=>i.featureGroupStatisticsCommits),G=f(i=>i.loading.effects.featureGroupStatistics.fetch),{data:t,isLoading:x}=U(+e,+r,+s),{currentData:b=[t],isFetching:v,handleVersionChange:D}=Y(t==null?void 0:t.name,u.project.featureGroup.statistics),o=w(),m=$(),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,p=r)=>{if(i&&a!==i){const F=u.project.featureGroup.statisticsViewCommit,V={id:e,fsId:s,fgId:p,computationTime:i};m(l(F,u.project.value,V)+(n?`?${n}`:""));return}m(l(u.project.featureGroup.statistics,u.project.value,{id:e,fsId:s,fgId:p})+(n?`?${n}`:""))},[e,s,m,r,a,n]);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(`${y.statistics} ${t!=null&&t.name?` - ${t.name}`:""}`),x?c.jsx(S,{}):c.jsxs(c.Fragment,{children:[c.jsx(H,{type:N.fg,data:t,title:t==null?void 0:t.name,idColor:(t==null?void 0:t.type)==="onDemandFeaturegroupDTO"?"labels.blue":"labels.orange",isEditDisabled:!j||h||I,onClickEdit:()=>m(l(u.project.featureGroup.edit,u.project.value,{id:e,fsId:s,fgId:r})),onClickRefresh:P,version:t==null?void 0:t.version,versions:b,isVersionsLoading:v,onVersionChange:D,hasCommits:!0,commits:C||[],commit:a,handleCommitChange:T,pathnamePostFix:"/statistics",editRightText:h?"Your role is not allowed to perform this action":void 0}),G&&c.jsx(S,{}),!G&&(!(t!=null&&t.features.length)||!g?c.jsx(R,{mainText:"No data available"}):c.jsx(J,{data:t,statistics:g}))]})};export{lt as default};
