import{u as k,r as S,dF as u,j as e,K as w,a as o,M as y,O as d,dH as D,bd as x,c as p,aZ as M,hw as E,hx as G,W as C,gF as L,b8 as A,f0 as R,hy as B,hz as I,m as K,G as V,ak as b,aT as $}from"./index-d6499a22.js";import{a as N,u as O}from"./index-620add9c.js";import{b as _,S as H,a as J}from"./StatisticsTables-f4036ad4.js";import{u as Q}from"./Deprecated-ec8916ed.js";import{T as W}from"./TdFeatureGroupHandle-84d5ab3b.js";import{F as z}from"./FeaturesLayout-e0d1f0d6.js";const P=({data:r,parent:a,statistics:t,type:s})=>{const{name:i,primary:c,partition:l}=r,{id:f,fgId:h,fsId:n}=k(),{isActiveFeature:m,handleBasket:j,isSwitch:g}=Q(),v=S.useMemo(()=>s===u.fg?a.eventTime===i:!1,[i,a,s]);return e.jsxs(w,{children:[s===u.fg&&e.jsxs(o,{alignItems:"flex-end",children:[e.jsx(y,{children:i}),g&&s===u.fg&&e.jsx(d,{ml:"10px",children:e.jsx(D,{handleClick:j([r],a),inBasket:m(r,a),tooltipMainText:m(r,a)?"Remove this feature from basket":"Add this feature to basket"})}),e.jsx(x,{ml:"20px",value:t.dataType}),c&&e.jsx(x,{ml:"20px",value:"primary key",variant:"success"}),l&&e.jsx(x,{ml:"20px",value:"partition key",variant:"success"}),v&&e.jsx(x,{ml:"20px",value:"event time",variant:"label"})]}),s===u.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(x,{ml:"20px",value:t.dataType})]}),e.jsx(o,{mt:"5px",children:r.featuregroup?e.jsxs(o,{children:[e.jsx(p,{bold:!0,gray:!0,mr:"5px",children:"from"}),e.jsx(W,{featureGroup:r==null?void 0:r.featuregroup})]}):e.jsx(p,{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(_,{data:t}),t.histogram?e.jsx(d,{width:"calc((100% - 60px) / 4)",children:e.jsx(H,{dataType:s,data:t.histogram,type:t.dataType})}):e.jsx(d,{width:"calc((100% - 60px) / 4)"}),s===u.fg?e.jsx(J,{projectId:+f,fgId:+h,featureStoreId:+n,featureName:i,featureGroup:a}):e.jsx(d,{width:"calc((100% - 60px) / 4)"})]})]})},se=({data:r,statistics:a,type:t=u.fg})=>e.jsx(z,{data:r,type:t,"data-test":"stats-container",renderChild:({type:s,parent:i,data:c})=>e.jsx(P,{type:s,parent:i,data:c,statistics:a[c.name]}),extraActions:e.jsx(U,{})}),U=()=>{const r=M(),{id:a,fgId:t,fsId:s,fvName:i,fvVersion:c,tdVersion:l}=k(),{currentData:{items:f}={}}=N({pId:a,fgId:t,fsId:s},{skip:!t}),{currentData:h=[]}=E({pId:a,fsId:+s,fvName:i,fvVersion:+c,id:+l},{skip:!!t}),n=t?f:h;G({fixedCacheKey:`${i}-${c}-${l}`});const[m,{isLoading:j}]=O(),g=S.useCallback(()=>m({pId:a,fgId:t,fsId:s}),[m,t,s,a]),v=()=>{try{g().unwrap().then(F=>{r.success({title:"New computation started",content:`Job ${F.name} started`})})}catch{}},T=S.useMemo(()=>C(K(C(V(0,"commitTime"),I)),R(B,I(0)),L(A.DATE_TIME.DATE_TIME_FULL))(n??[]),[n]);return e.jsxs(o,{alignItems:"center",sx:{gap:"10px"},children:[n!==void 0&&!b(n)&&e.jsxs(p,{gray:!0,children:["computed at ",T]}),(n===void 0||b(n))&&e.jsx(p,{gray:!0,children:"Statistics are not configured for this version"}),t&&e.jsx($,{intent:"ghost",onClick:v,isLoading:j,children:"Recompute"})]})};export{U as C,se as S};
