import{r as t,p as I,w as L,b6 as c,j as n,u as w,fb as C,gQ as E,z as S,X as x,b as F,B as y,aG as k,q as _,s as T,bj as j}from"./index-dP1W1_bd.js";import{F as $}from"./FeatureGroupTypeBadge-BWolRbn-.js";import{D as q}from"./Deprecated-ClfPkp7s.js";import{K as o}from"./useFeatureFilters-H7_GmsAw.js";import{u as b}from"./uniq-98MdbBvs.js";import{z as B}from"./Project-CsYwwOpN.js";const h=t.createContext({lazyKeyFilter:o.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(I(B(c,r),L({primaryFeatures:b,eventTimeFeatures:b,partitionFeatures:b})))},[]),[l,e]=t.useState(o.null),i=t.useCallback(r=>()=>{e(v=>v===r?o.null:r)},[]),m=t.useMemo(()=>({lazyKeyFilter:l,onToggleLazyKey:i,setLazyKeyFilter:e,registeredFeatures:a,registerFeatures:d}),[l,i,d,a]);return n.jsx(h.Provider,{value:m,children:s})},H=({featureGroup:s,name:a,labelFgId:g})=>{const{id:d}=w(),{currentData:l}=C({fsId:s==null?void 0:s.featurestoreId}),{currentData:e}=E({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:m}=t.useContext(h);return t.useEffect(function(){const v=(e==null?void 0:e.features.filter(x("primary")).map(x("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}`)):[],K=(e==null?void 0:e.features.filter(x("partition")).map(x("name")).map(c(`${s==null?void 0:s.id}`)))??[];m({primaryFeatures:v,eventTimeFeatures:z,partitionFeatures:K})},[e==null?void 0:e.id,e==null?void 0:e.features,m,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(k,{my:"-8px",px:"10px",intent:"inline",href:_(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(F,{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(j,{value:"serving",width:"max-content",variant:"success"}),(e==null?void 0:e.eventTime)===a&&s.id===g&&n.jsx(j,{value:"event time",width:"max-content",variant:"label"}),(i==null?void 0:i.onDemand)&&n.jsx(j,{value:"on-demand",width:"max-content",variant:"default"})]})]}):n.jsx(F,{bold:!0,gray:!0,children:"unavailable origin feature group"})},X=t.memo(H);export{h as L,X as T,W as a};
