import{u as k,r as S,dJ as u,j as e,E,Q as c,Y as y,o as p,dL as F,be as x,x as d,a_ as D,hw as G,hx as L,W as C,gO as M,b9 as V,f5 as A,hy as Q,hz as I,m as B,H as R,al as b,aU as _}from"./index-ea7817a2.js";import{a as $,u as J}from"./index-0443c26e.js";import{b as N,S as H,a as O}from"./StatisticsTables-d20123a2.js";import{u as P}from"./Deprecated-9bfe2e44.js";import{T as U}from"./TdFeatureGroupHandle-d5486ece.js";import{F as W}from"./FeaturesLayout-990a2693.js";const Y=({data:r,parent:s,statistics:t,type:a})=>{const{name:i,primary:o,partition:l}=r,{id:f,fgId:h,fsId:n}=k(),{isActiveFeature:m,handleBasket:j,isSwitch:g}=P(),v=S.useMemo(()=>a===u.fg?s.eventTime===i:!1,[i,s,a]);return e.jsxs(E,{children:[a===u.fg&&e.jsxs(c,{alignItems:"flex-end",children:[e.jsx(y,{children:i}),g&&a===u.fg&&e.jsx(p,{ml:"10px",children:e.jsx(F,{handleClick:j([r],s),inBasket:m(r,s),tooltipMainText:m(r,s)?"Remove this feature from basket":"Add this feature to basket"})}),e.jsx(x,{ml:"20px",value:t.dataType}),o&&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"})]}),a===u.td&&e.jsx(c,{alignItems:"flex-end",children:e.jsxs(c,{flexDirection:"column",children:[e.jsxs(c,{children:[e.jsx(y,{children:i}),e.jsx(x,{ml:"20px",value:t.dataType})]}),e.jsx(c,{mt:"5px",children:r.featuregroup?e.jsxs(c,{children:[e.jsx(d,{bold:!0,gray:!0,mr:"5px",children:"from"}),e.jsx(U,{featureGroup:r==null?void 0:r.featuregroup})]}):e.jsx(d,{bold:!0,gray:!0,children:"unavailable origin feature group"})})]})}),t&&e.jsxs(c,{justifyContent:"space-between",alignItems:"flex-start",mt:"20px",flexWrap:"wrap",children:[e.jsx(N,{data:t}),t.histogram?e.jsx(p,{width:"calc((100% - 60px) / 4)",children:e.jsx(H,{dataType:a,data:t.histogram,type:t.dataType})}):e.jsx(p,{width:"calc((100% - 60px) / 4)"}),a===u.fg?e.jsx(O,{projectId:+f,fgId:+h,featureStoreId:+n,featureName:i,featureGroup:s}):e.jsx(p,{width:"calc((100% - 60px) / 4)"})]})]})},se=({data:r,statistics:s,type:t=u.fg})=>e.jsx(W,{data:r,type:t,"data-test":"stats-container",renderChild:({type:a,parent:i,data:o})=>s[o.name]&&e.jsx(Y,{type:a,parent:i,data:o,statistics:s[o.name]}),extraActions:e.jsx(z,{})}),z=()=>{const r=D(),{id:s,fgId:t,fsId:a,fvName:i,fvVersion:o,tdVersion:l}=k(),{currentData:{items:f}={}}=$({pId:s,fgId:t,fsId:a},{skip:!t}),{currentData:h=[]}=G({pId:s,fsId:+a,fvName:i,fvVersion:+o,id:+l},{skip:!!t}),n=t?f:h;L({fixedCacheKey:`${i}-${o}-${l}`});const[m,{isLoading:j}]=J(),g=S.useCallback(()=>m({pId:s,fgId:t,fsId:a}),[m,t,a,s]),v=()=>{try{g().unwrap().then(w=>{r.success({title:"New computation started",content:`Job ${w.name} started`})})}catch{}},T=S.useMemo(()=>C(B(C(R(0,"commitTime"),I)),A(Q,I(0)),M(V.DATE_TIME.DATE_TIME_FULL))(n??[]),[n]);return e.jsxs(c,{alignItems:"center",sx:{gap:"10px"},children:[n!==void 0&&!b(n)&&e.jsxs(d,{gray:!0,children:["computed at ",T]}),(n===void 0||b(n))&&e.jsx(d,{gray:!0,children:"Statistics are not configured for this version"}),t&&e.jsx(_,{intent:"ghost",onClick:v,isLoading:j,children:"Recompute"})]})};export{z as C,se as S};
