import{u as F,r as k,ed as c,j as e,f as w,q as o,a as y,F as p,em as T,b9 as l,c as d,bI as D,it as E,A as G,B as M,p as I,bC as A,h2 as B,iu as L,c2 as R,hB as N,iv as P,iw as b,ay as V,E as _,h as C,aJ as q}from"./index-Cox3ZWL0.js";import{a as J,u as Q}from"./index-68SOHHAk.js";import{b as H,S as O,a as U}from"./StatisticsTables-DWSrQv7W.js";import{u as W}from"./Deprecated-g8R65bmH.js";import{T as $}from"./TdFeatureGroupHandle-st3DVIeI.js";import{F as z}from"./FeaturesLayout-Bbjz6mlc.js";const K=({data:a,parent:r,statistics:t,type:s})=>{var x;const{name:i,primary:u,partition:f}=a,{id:h,fgId:j,fsId:n}=F(),{isActiveFeature:m,handleBasket:g,isSwitch:v}=W(),S=k.useMemo(()=>s===c.fg?r.eventTime===i:!1,[i,r,s]);return e.jsxs(w,{children:[s===c.fg&&e.jsxs(o,{alignItems:"flex-end",children:[e.jsx(y,{children:i}),v&&s===c.fg&&e.jsx(p,{ml:"10px",children:e.jsx(T,{handleClick:g([a],r),inBasket:m(a,r),tooltipMainText:m(a,r)?"Remove this feature from basket":"Add this feature to basket"})}),e.jsx(l,{ml:"20px",value:(t==null?void 0:t.featureType)??""}),u&&e.jsx(l,{ml:"20px",value:"primary key",variant:"success"}),f&&e.jsx(l,{ml:"20px",value:"partition key",variant:"success"}),S&&e.jsx(l,{ml:"20px",value:"event time",variant:"label"})]}),s===c.td&&e.jsx(o,{alignItems:"flex-end",children:e.jsxs(o,{flexDirection:"column",children:[e.jsxs(o,{children:[e.jsx(y,{children:i}),e.jsx(l,{ml:"20px",value:(t==null?void 0:t.featureType)??""})]}),e.jsx(o,{mt:"5px",children:a.featuregroup?e.jsxs(o,{children:[e.jsx(d,{bold:!0,gray:!0,mr:"5px",children:"from"}),e.jsx($,{featureGroup:a==null?void 0:a.featuregroup})]}):e.jsx(d,{bold:!0,gray:!0,children:"unavailable origin feature group"})})]})}),t&&e.jsxs(o,{justifyContent:"space-between",alignItems:"flex-start",mt:"20px",flexWrap:"wrap",children:[e.jsx(H,{data:t}),(x=t.extendedStatistics)!=null&&x.histogram?e.jsx(p,{width:"calc((100% - 60px) / 4)",children:e.jsx(O,{dataType:s,data:t.extendedStatistics.histogram,type:t.featureType})}):e.jsx(p,{width:"calc((100% - 60px) / 4)"}),s===c.fg?e.jsx(U,{projectId:+h,fgId:+j,featureStoreId:+n,featureName:i,featureGroup:r}):e.jsx(p,{width:"calc((100% - 60px) / 4)"})]})]})},re=({data:a,statistics:r,type:t=c.fg})=>e.jsx(z,{data:a,type:t,"data-test":"stats-container",renderChild:({type:s,parent:i,data:u})=>e.jsx(K,{type:s,parent:i,data:u,statistics:r[u.name]??{}}),extraActions:e.jsx(X,{})}),X=()=>{const a=D(),{id:r,fgId:t,fsId:s,fvName:i,fvVersion:u,tdVersion:f}=F(),{currentData:{items:h}={}}=J({pId:r,fgId:t,fsId:s},{skip:!t}),{currentData:j}=E({pId:r,fsId:+s,fvName:i,fvVersion:+u,id:+f,params:{fields:"content"}},{skip:!!t,selectFromResult:G({currentData:M(I(A,B))})}),n=t?h:j,[m,{isLoading:g}]=Q(),v=()=>{try{m({pId:r,fgId:t,fsId:s}).unwrap().then(x=>{a.success({title:"New computation started",content:`Job ${x.name} started`})})}catch{}},S=k.useMemo(()=>I(V(I(_(0,"computationTime"),b)),N(P,b(0)),L(R.DATE_TIME.DATE_TIME_FULL))(n??[]),[n]);return e.jsxs(o,{alignItems:"center",sx:{gap:"10px"},children:[n!==void 0&&!C(n)&&e.jsxs(d,{gray:!0,children:["computed at ",S]}),(n===void 0||C(n))&&e.jsx(d,{gray:!0,children:"Statistics are not configured for this version"}),t&&e.jsx(q,{intent:"ghost",onClick:v,isLoading:g,children:"Recompute"})]})};export{X as C,re as S};
