import{r as t,p as K,w as L,aV as j,hA as w,aW as y,j as n,u as C,gb as E,hB as S,A as _,T as m,c as T,a as c,aJ as k,s as $,t as b,b8 as h}from"./index-_eM6l4Nf.js";import{F as H}from"./FeatureGroupTypeBadge-CTMzMdrC.js";import{D as P}from"./Deprecated-Cn0z8EIY.js";import{K as F}from"./useFeatureFilters-DHl2jdlW.js";const o=t.createContext({lazyKeyFilter:F.null,onToggleLazyKey:s=>{},setLazyKeyFilter:s=>{},registeredFeatures:{primaryFeatures:[],eventTimeFeatures:[],partitionFeatures:[]},registerFeatures:s=>{}}),W=({children:s})=>{const[a,g]=t.useState({primaryFeatures:[],eventTimeFeatures:[],partitionFeatures:[]}),d=t.useCallback(r=>{g(K(w(y,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})},R=({featureGroup:s,name:a,labelFgId:g})=>{const{id:d}=C(),{currentData:l}=E({fsId:s==null?void 0:s.featurestoreId}),{currentData:e}=S({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(_("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(y(`${s==null?void 0:s.id}`)))??[],z=e!=null&&e.eventTime?[e==null?void 0:e.eventTime].map(y(`${s==null?void 0:s.id}`)):[],I=(e==null?void 0:e.features.filter(m("partition")).map(m("name")).map(y(`${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(c,{justifyContent:"space-between",children:[n.jsxs(c,{children:[e&&e.deprecated&&n.jsx(P,{sx:{fontSize:"12px"},short:!0}),n.jsx(k,{my:"-8px",px:"10px",intent:"inline",href:$(b.project.featureGroup.overview,b.project.value,{id:d,fsId:s.featurestoreId,fgId:s==null?void 0:s.id}),target:"_blank",children:n.jsxs(c,{alignItems:"center",sx:{gap:"15px"},children:[e&&n.jsx(H,{type:e.type,onlineEnabled:e.onlineEnabled,size:"xs"}),s.name," ↗"]})}),n.jsxs(T,{ml:"5px",color:"labels.orange",children:["v",s.version]})]}),n.jsxs(c,{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(T,{bold:!0,gray:!0,children:"unavailable origin feature group"})},J=t.memo(R);export{o as L,J as T,W as a};
