import{bo as T,bI as $,ed as k,w as E,x as I,l as R,o as b,q as d,r as A,bJ as y,j as t,bS as o,D as O,f as U,$ as m,ef as q,c as H}from"./index-ljTaFLaB.js";import{S as J,a as Q,b as _}from"./StatisticsTables-BKh0n-_K.js";const V=({isOpen:l,handleToggle:f,projectId:c,featurestoreId:r,parentProjectId:G,featuregroup:D,fgName:h,version:F,name:e,feature:L,fgId:C})=>{var v,j,w;const u=T(),S=$(),{data:N}=k({pId:G,fsId:r,fgName:h,version:F},{skip:!h,selectFromResult:E({data:I(R)})}),a=D??N,B=L??(a==null?void 0:a.features.find(n=>n.name===e)),i=C??(a==null?void 0:a.id)??0,p=b(d.project.featureGroup.overview,d.project.value,{id:c,fsId:r,fgId:i}),P=`${b(d.project.featureGroup.preview,d.project.value,{id:c,fsId:r,fgId:i})}?search=${e}`;A.useEffect(()=>{i&&S.featureGroupStatistics.fetch({projectId:c,featureStoreId:r,featureGroupId:i})},[B,S,i,c,r]);const x=y(n=>{var g;return(g=n.featureGroupStatistics)==null?void 0:g.entities.statistics});if(y(n=>n.loading.effects.featureGroupStatistics.fetch))return t.jsx(o,{headerLine:" ",closeOnBackdropClick:!1,isOpen:l,bottomButton:["Open in Feature Groups Page ->",()=>u(p)],onClose:f,children:t.jsx(O,{})});if(e&&(!x||!x[e]))return t.jsx(o,{headerLine:e,isOpen:l,bottomButton:["Open in Feature Groups Page ->",()=>u(p)],onClose:f,children:t.jsx(U,{textAlign:"center",mt:"30px",children:"No Feature Statistics"})});const s=e?x[e]:void 0;return t.jsxs(o,{headerLine:e,isOpen:l,bottomButton:["Open in Feature Groups Page ->",()=>u(p)],onClose:f,children:[s?t.jsx(o.Section,{title:"Data overview",children:t.jsxs(m,{width:"100%",children:[((v=s.extendedStatistics)==null?void 0:v.histogram)&&s.featureType&&t.jsx(m,{width:"100%",justifyContent:"center",children:t.jsx(J,{dataType:q.fg,data:(j=s.extendedStatistics)==null?void 0:j.histogram,type:s.featureType})}),(!((w=s.extendedStatistics)!=null&&w.histogram)||!s.featureType)&&t.jsx(H,{bold:!0,gray:!0,textAlign:"center",children:"No data overview"})]})}):null,t.jsx(o.Section,{title:"Data preview",action:["view data preview table -->",()=>u(P)],children:i&&t.jsx(Q,{projectId:c,featureStoreId:r,fgId:i,isDrawer:!0,featureName:e,featureGroup:a})}),s?t.jsx(o.Section,{title:"Statistics",children:t.jsx(_,{isDrawer:!0,data:s})}):null]})};export{V as F};
