import{bp as T,bI as k,dV as E,x as I,z as R,l as A,q as b,s as d,r as O,bK as y,j as t,bT as o,L as U,b as V,B as m,dX as $,c as q}from"./index-C1DmWO_C.js";import{S as z,a as H,b as K}from"./StatisticsTables-gOzf3GUA.js";const J=({isOpen:l,handleToggle:f,projectId:n,featurestoreId:r,parentProjectId:G,featuregroup:F,fgName:h,version:B,name:e,feature:D,fgId:L})=>{var S,w,g;const u=T(),v=k(),{data:C}=E({pId:G,fsId:r,fgName:h,version:B},{skip:!h,selectFromResult:I({data:R(A)})}),a=F??C,N=D??(a==null?void 0:a.features.find(c=>c.name===e)),i=L??(a==null?void 0:a.id)??0,p=b(d.featureGroup.overview,d.project.value,{id:n,fsId:r,fgId:i}),P=`${b(d.featureGroup.preview,d.project.value,{id:n,fsId:r,fgId:i})}?search=${e}`;O.useEffect(()=>{i&&v.featureGroupStatistics.fetch({projectId:n,featureStoreId:r,featureGroupId:i})},[N,v,i,n,r]);const x=y(c=>{var j;return(j=c.featureGroupStatistics)==null?void 0:j.entities.statistics});if(y(c=>c.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(U,{})});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(V,{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(z,{dataType:$.fg,data:(w=s.extendedStatistics)==null?void 0:w.histogram,type:s.featureType})}),(!((g=s.extendedStatistics)!=null&&g.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(H,{projectId:n,featureStoreId:r,fgId:i,isDrawer:!0,featureName:e,featureGroup:a})}),s?t.jsx(o.Section,{title:"Statistics",children:t.jsx(K,{isDrawer:!0,data:s})}):null]})};export{J as F};
