import{r as t,f as K,x as L,aO as j,hf as w,aP as c,j as n,u as C,eW as E,hg as P,D as S,U as m,c as b,B as y,b4 as _,q as k,s as T,bb as h}from"./index-C1DmWO_C.js";import{F as $}from"./FeatureGroupTypeBadge-DwrDNbIL.js";import{D as q}from"./Deprecated-BQWZLUTP.js";import{K as F}from"./useFeatureFilters-DdB4Pg89.js";const o=t.createContext({lazyKeyFilter:F.null,onToggleLazyKey:s=>{},setLazyKeyFilter:s=>{},registeredFeatures:{primaryFeatures:[],eventTimeFeatures:[],partitionFeatures:[]},registerFeatures:s=>{}}),M=({children:s})=>{const[a,g]=t.useState({primaryFeatures:[],eventTimeFeatures:[],partitionFeatures:[]}),d=t.useCallback(r=>{g(K(w(c,r),L({primaryFeatures:j,eventTimeFeatures:j,partitionFeatures:j})))},[]),[l,e]=t.useState(F.null),i=t.useCallback(r=>()=>{e(v=>v===r?F.null:r)},[]),x=t.useMemo(()=>({lazyKeyFilter:l,onToggleLazyKey:i,setLazyKeyFilter:e,registeredFeatures:a,registerFeatures:d}),[l,i,d,a]);return n.jsx(o.Provider,{value:x,children:s})},B=({featureGroup:s,name:a,labelFgId:g})=>{const{id:d}=C(),{currentData:l}=E({fsId:s==null?void 0:s.featurestoreId}),{currentData:e}=P({pId:+d,fsId:(s==null?void 0:s.featurestoreId)??-1,id:(s==null?void 0:s.id)??-1,fgName:(s==null?void 0:s.name)??""},{skip:!s||!l}),i=e==null?void 0:e.features.find(S("name",a)),{registerFeatures:x}=t.useContext(o);return t.useEffect(function(){const v=(e==null?void 0:e.features.filter(m("primary")).map(m("name")).map(c(`${s==null?void 0:s.id}`)))??[],z=e!=null&&e.eventTime?[e==null?void 0:e.eventTime].map(c(`${s==null?void 0:s.id}`)):[],I=(e==null?void 0:e.features.filter(m("partition")).map(m("name")).map(c(`${s==null?void 0:s.id}`)))??[];x({primaryFeatures:v,eventTimeFeatures:z,partitionFeatures:I})},[e==null?void 0:e.id,e==null?void 0:e.features,x,e==null?void 0:e.eventTime,s==null?void 0:s.id]),s?n.jsxs(y,{justifyContent:"space-between",children:[n.jsxs(y,{children:[e&&e.deprecated&&n.jsx(q,{sx:{fontSize:"12px"},short:!0}),n.jsx(_,{my:"-8px",px:"10px",intent:"inline",href:k(T.featureGroup.overview,T.project.value,{id:d,fsId:s.featurestoreId,fgId:s==null?void 0:s.id}),target:"_blank",children:n.jsxs(y,{alignItems:"center",sx:{gap:"15px"},children:[e&&n.jsx($,{type:e.type,onlineEnabled:e.onlineEnabled,size:"xs"}),s.name," ↗"]})}),n.jsxs(b,{ml:"5px",color:"labels.orange",children:["v",s.version]})]}),n.jsxs(y,{ml:"12px",sx:{gap:"10px"},children:[(i==null?void 0:i.serving)&&n.jsx(h,{value:"serving",width:"max-content",variant:"success"}),(e==null?void 0:e.eventTime)===a&&s.id===g&&n.jsx(h,{value:"event time",width:"max-content",variant:"label"}),(i==null?void 0:i.onDemand)&&n.jsx(h,{value:"on-demand",width:"max-content",variant:"default"})]})]}):n.jsx(b,{bold:!0,gray:!0,children:"unavailable origin feature group"})},O=t.memo(B);export{o as L,O as T,M as a};
