import{r as t,f as I,v as C,aC as v,j as n,u as L,eK as w,gn as E,A as S,U as x,y as T,d as y,b6 as k,o as P,q as h,aN as j}from"./index-CK33qGU_.js";import{F as _}from"./FeatureGroupTypeBadge-CamLRb8D.js";import{D as $}from"./Deprecated-D5xZ0QMJ.js";import{K as F}from"./useFeatureFilters-b9dUmI_5.js";import{u as o}from"./FileUploaderButton-Bppadu35.js";import{m as q}from"./mergeDeepWith-BpZXvEs5.js";const b=t.createContext({lazyKeyFilter:F.null,onToggleLazyKey:s=>{},setLazyKeyFilter:s=>{},registeredFeatures:{primaryFeatures:[],eventTimeFeatures:[],partitionFeatures:[]},registerFeatures:s=>{}}),U=({children:s})=>{const[a,c]=t.useState({primaryFeatures:[],eventTimeFeatures:[],partitionFeatures:[]}),d=t.useCallback(r=>{c(I(q(v,r),C({primaryFeatures:o,eventTimeFeatures:o,partitionFeatures:o})))},[]),[l,e]=t.useState(F.null),i=t.useCallback(r=>()=>{e(g=>g===r?F.null:r)},[]),m=t.useMemo(()=>({lazyKeyFilter:l,onToggleLazyKey:i,setLazyKeyFilter:e,registeredFeatures:a,registerFeatures:d}),[l,i,d,a]);return n.jsx(b.Provider,{value:m,children:s})},H=({featureGroup:s,name:a,labelFgId:c})=>{const{id:d}=L(),{currentData:l}=w({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(b);return t.useEffect(function(){const g=(e==null?void 0:e.features.filter(x("primary")).map(x("name")).map(v(`${s==null?void 0:s.id}`)))??[],K=e!=null&&e.eventTime?[e==null?void 0:e.eventTime].map(v(`${s==null?void 0:s.id}`)):[],z=(e==null?void 0:e.features.filter(x("partition")).map(x("name")).map(v(`${s==null?void 0:s.id}`)))??[];m({primaryFeatures:g,eventTimeFeatures:K,partitionFeatures:z})},[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($,{sx:{fontSize:"12px"},short:!0}),n.jsx(k,{my:"-8px",px:"10px",intent:"inline",href:P(h.featureGroup.overview,h.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(T,{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===c&&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(T,{bold:!0,gray:!0,children:"unavailable origin feature group"})},V=t.memo(H);export{b as L,V as T,U as a};
