import{bo as R,bH as T,ec as $,w as k,x as E,l as I,o as b,q as d,r as A,bI as y,j as t,bR as o,D as H,f as O,$ as m,ee as U,c as q}from"./index-46ma1THH.js";import{S as Q,a as _,b as z}from"./StatisticsTables-C8cLXJBs.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 S,j,w;const u=R(),v=T(),{data:N}=$({pId:G,fsId:r,fgName:h,version:F},{skip:!h,selectFromResult:k({data:E(I)})}),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&&v.featureGroupStatistics.fetch({projectId:c,featureStoreId:r,featureGroupId:i})},[B,v,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(H,{})});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(O,{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:[((S=s.extendedStatistics)==null?void 0:S.histogram)&&s.featureType&&t.jsx(m,{width:"100%",justifyContent:"center",children:t.jsx(Q,{dataType:U.fg,data:(j=s.extendedStatistics)==null?void 0:j.histogram,type:s.featureType})}),(!((w=s.extendedStatistics)!=null&&w.histogram)||!s.featureType)&&t.jsx(q,{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(_,{projectId:c,featureStoreId:r,fgId:i,isDrawer:!0,featureName:e,featureGroup:a})}),s?t.jsx(o.Section,{title:"Statistics",children:t.jsx(z,{isDrawer:!0,data:s})}):null]})};export{V as F};
