import{r as t,j as n}from"./vendor-react-wBh_31cN.js";import{B as o}from"./badge-UCnweWGd.js";import{aW as L,dE as N,h as b,e as z,dS as I,b as k,p as g,R as w,g as E,r as j}from"./index-dNe6i2rS.js";import{u as _}from"./selectors-DK1_X0Cd.js";import{D as C}from"./Deprecated-DEh1iT37.js";import{K as h}from"./useFeatureFilters-dgIPcuD2.js";import{u as y}from"./uniq--Ej6WwWR.js";import{c as x}from"./concat-CTXo1gGM.js";import{c as S}from"./vendor-router-D1GqFWiT.js";import{a_ as R}from"./vendor-icons-BUUmD6ht.js";var W=L(function(r,m,a){return N(function(d,e,i){return r(e,i)},m,a)});const F=t.createContext({lazyKeyFilter:h.null,onToggleLazyKey:s=>()=>{},setLazyKeyFilter:s=>{},registeredFeatures:{primaryFeatures:[],eventTimeFeatures:[],partitionFeatures:[]},registerFeatures:s=>{}}),V=({children:s})=>{const[r,m]=t.useState({primaryFeatures:[],eventTimeFeatures:[],partitionFeatures:[]}),a=t.useCallback(l=>{m(b(W(x,l),z({primaryFeatures:y,eventTimeFeatures:y,partitionFeatures:y})))},[]),[d,e]=t.useState(h.null),i=t.useCallback(l=>()=>{e(v=>v===l?h.null:l)},[]),c=t.useMemo(()=>({lazyKeyFilter:d,onToggleLazyKey:i,setLazyKeyFilter:e,registeredFeatures:r,registerFeatures:a}),[d,i,a,r]);return n.jsx(F.Provider,{value:c,children:s})},$=({featureGroup:s,name:r,labelFgId:m})=>{const{id:a}=S(),{currentData:d}=_({fsId:s==null?void 0:s.featurestoreId}),{currentData:e}=I({pId:+a,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||!d}),i=e==null?void 0:e.features.find(k("name",r)),{registerFeatures:c}=t.useContext(F);return t.useEffect(function(){const v=(e==null?void 0:e.features.filter(g("primary")).map(g("name")).map(x(`${s==null?void 0:s.id}`)))??[],T=e!=null&&e.eventTime?[e==null?void 0:e.eventTime].map(x(`${s==null?void 0:s.id}`)):[],K=(e==null?void 0:e.features.filter(g("partition")).map(g("name")).map(x(`${s==null?void 0:s.id}`)))??[];c({primaryFeatures:v,eventTimeFeatures:T,partitionFeatures:K})},[e==null?void 0:e.id,e==null?void 0:e.features,c,e==null?void 0:e.eventTime,s==null?void 0:s.id]),s?n.jsxs("div",{className:"flex items-center gap-1.5",children:[e&&e.deprecated&&n.jsx(C,{className:"text-xs",short:!0}),n.jsxs("a",{href:E(j.project.featureGroup.overview,j.project.value,{id:a,fsId:s.featurestoreId,fgId:s==null?void 0:s.id}),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground hover:underline",children:[s.name,n.jsx(R,{className:"h-3 w-3"})]}),n.jsxs("span",{className:"text-xs text-quartz-label-orange",children:["v",s.version]}),(i==null?void 0:i.serving)&&n.jsx(o,{className:"w-max",variant:"success",children:"serving"}),(e==null?void 0:e.eventTime)===r&&s.id===m&&n.jsx(o,{className:"w-max",variant:"outline",children:"event time"}),(i==null?void 0:i.onDemand)&&n.jsx(o,{className:"w-max",variant:"default",children:"on-demand"})]}):n.jsx(w,{bold:!0,gray:!0,children:"unavailable origin feature group"})},X=t.memo($);export{F as L,X as T,V as a};
