import{j as b,d as w,g9 as j,dE as k,an as A,T as L,r as a,ga as D}from"./index-CK33qGU_.js";const v={label:{"> div":{py:0,pl:"4px",pr:"8px",alignItems:"center"},"> div:hover":{div:{backgroundColor:"grayShade3",borderColor:"transparent"}}}},M={label:{div:{backgroundColor:"white"}}},G=({children:e,icon:n,white:c=!1,size:o="md",...i})=>b.jsx(w,{sx:c?j(M,v):v,alignItems:"center",children:b.jsxs(k,{...i,children:[b.jsx(A,{p:"4px !important",size:o,icon:n||L.cross,sx:!n&&{visibility:"hidden",width:"0px",mr:"-15px"}}),e]})}),p=(e,n,c)=>e.filter(({[c]:o})=>Array.isArray(n)?n.length?n.includes(o):e:n===o);var E=(e=>(e[e.primary=0]="primary",e[e.partition=1]="partition",e[e.label=2]="label",e[e.type=3]="type",e[e.onlineType=4]="onlineType",e[e.eventTime=5]="eventTime",e[e.onDemand=6]="onDemand",e[e.null=7]="null",e))(E||{});const I=(e,n="",c=!1,o="")=>{const[i,f]=a.useState([]),[h,y]=a.useState([]),[s,d]=a.useState(7),[m,u]=D({search:n}),T=a.useCallback(({target:r})=>{const t=r.value;u(t?{search:t}:{})},[u]),x=a.useCallback(r=>()=>{d(t=>t===r?7:r)},[d]),C=a.useCallback(()=>{u({}),f([]),y([]),d(7)},[u]),g=a.useMemo(()=>{const r=Array.from(new Set(e.filter(({name:l})=>l!=="Feature Group").map(({type:l})=>l)));let t=[];return c&&(t=Array.from(new Set(e.map(({onlineType:l})=>l)))),{offlineTypes:r,onlineTypes:t}},[e]),S=a.useMemo(()=>{let r=e;return s===1&&(r=p(r,!0,"partition")),s===6&&(r=p(r,!0,"onDemand")),s===0&&(r=p(r,!0,"primary")),s===2&&(r=p(r,!0,"label")),r=p(r,i,"type"),r=p(r,h,"onlineType"),s===5&&(r=r.filter(({name:t})=>t.toLowerCase()===o)),r.filter(({name:t})=>{const l=(m.get("search")||"").toLowerCase();return t.toLowerCase().includes(l)||t.includes("Feature Group")})},[e,m,s,i,h,o]);return a.useMemo(()=>({dataFiltered:S,types:g.offlineTypes,onlineTypes:g.onlineTypes,search:m.get("search")||"",typeFilters:i,onlineTypeFilters:h,keyFilter:s,onTypeFiltersChange:f,onOnlineTypeFiltersChange:y,onSearchChange:T,onToggleKey:x,onReset:C}),[S,g,m,i,s,f,T,x,C])};export{G as F,E as K,p as f,I as u};
