import{aR as N,b0 as B,dv as P,dw as R,y as T,dx as k,g as j,e as d,r as E,b2 as S,j as t,b9 as o,a_ as A,f as O,a as b,dF as U,c as $}from"./index-d6499a22.js";import{S as H,a as I,b as Q}from"./StatisticsTables-f4036ad4.js";const J=({isOpen:l,handleToggle:f,projectId:n,featurestoreId:r,parentProjectId:y,featuregroup:m,fgName:x,version:F,name:e,feature:v,fgId:G})=>{const u=N(),g=B(),{data:C}=P({pId:y,fsId:r,fgName:x,version:F},{skip:!v||!x,selectFromResult:R({data:T(k)})}),a=m??C,D=v??(a==null?void 0:a.features.find(c=>c.name===e)),i=G??(a==null?void 0:a.id)??0,p=j(d.featureGroup.overview,d.project.value,{id:n,fsId:r,fgId:i}),L=`${j(d.featureGroup.preview,d.project.value,{id:n,fsId:r,fgId:i})}?search=${e}`;E.useEffect(()=>{i&&g.featureGroupStatistics.fetch({projectId:n,featureStoreId:r,featureGroupId:i})},[D,g,i,n,r]);const h=S(c=>{var w;return(w=c.featureGroupStatistics)==null?void 0:w.entities.statistics});if(S(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(A,{})});if(e&&(!h||!h[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?h[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(b,{width:"100%",children:[s.histogram&&s.dataType&&t.jsx(b,{width:"100%",justifyContent:"center",children:t.jsx(H,{dataType:U.fg,data:s.histogram,type:s.dataType})}),(!s.histogram||!s.dataType)&&t.jsx($,{bold:!0,gray:!0,textAlign:"center",children:"No data overview"})]})}):null,t.jsx(o.Section,{title:"Data preview",action:["view data preview table -->",()=>u(L)],children:i&&t.jsx(I,{projectId:n,featureStoreId:r,fgId:i,isDrawer:!0,featureName:e,featureGroup:a})}),s?t.jsx(o.Section,{title:"Statistics",children:t.jsx(Q,{isDrawer:!0,data:s})}):null]})};export{J as F};
