import{u as k,r as w,e0 as c,j as e,m as F,B as o,V as b,e as p,e7 as T,bj as m,b as d,aE as D,gO as E,w as G,x as A,p as I,bz as L,fQ as V,gA as B,bP as M,aS as R,eg as N,gP as y,ax as P,A as Q,g as C,aG as _}from"./index-dP1W1_bd.js";import{a as O,u as q}from"./index-BxoddjA3.js";import{b as z,S as H,a as J}from"./StatisticsTables-vXn70kNI.js";import{u as U}from"./Deprecated-ClfPkp7s.js";import{T as W}from"./TdFeatureGroupHandle-S_pdFVu5.js";import{F as Z}from"./FeaturesLayout-BWknsmf_.js";const $=({data:a,parent:r,statistics:t,type:s})=>{var x;const{name:i,primary:u,partition:f}=a,{id:j,fgId:g,fsId:n}=k(),{isActiveFeature:l,handleBasket:h,isSwitch:v}=U(),S=w.useMemo(()=>s===c.fg?r.eventTime===i:!1,[i,r,s]);return e.jsxs(F,{children:[s===c.fg&&e.jsxs(o,{alignItems:"flex-end",children:[e.jsx(b,{children:i}),v&&s===c.fg&&e.jsx(p,{ml:"10px",children:e.jsx(T,{handleClick:h([a],r),inBasket:l(a,r),tooltipMainText:l(a,r)?"Remove this feature from basket":"Add this feature to basket"})}),e.jsx(m,{ml:"20px",value:(t==null?void 0:t.featureType)??""}),u&&e.jsx(m,{ml:"20px",value:"primary key",variant:"success"}),f&&e.jsx(m,{ml:"20px",value:"partition key",variant:"success"}),S&&e.jsx(m,{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(b,{children:i}),e.jsx(m,{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(W,{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(z,{data:t}),(x=t.extendedStatistics)!=null&&x.histogram?e.jsx(p,{width:"calc((100% - 60px) / 4)",children:e.jsx(H,{dataType:s,data:t.extendedStatistics.histogram,type:t.featureType})}):e.jsx(p,{width:"calc((100% - 60px) / 4)"}),s===c.fg?e.jsx(J,{projectId:+j,fgId:+g,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($,{type:s,parent:i,data:u,statistics:r[u.name]??{}}),extraActions:e.jsx(K,{})}),K=()=>{const a=D(),{id:r,fgId:t,fsId:s,fvName:i,fvVersion:u,tdVersion:f}=k(),{currentData:{items:j}={}}=O({pId:r,fgId:t,fsId:s},{skip:!t}),{currentData:g}=E({pId:r,fsId:+s,fvName:i,fvVersion:+u,id:+f,params:{fields:"content"}},{skip:!!t,selectFromResult:G({currentData:A(I(L,V))})}),n=t?j:g,[l,{isLoading:h}]=q(),v=()=>{try{l({pId:r,fgId:t,fsId:s}).unwrap().then(x=>{a.success({title:"New computation started",content:`Job ${x.name} started`})})}catch{}},S=w.useMemo(()=>I(P(I(Q(0,"computationTime"),y)),R(N,y(0)),B(M.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(_,{intent:"ghost",onClick:v,isLoading:h,children:"Recompute"})]})};export{K as C,re as S};
