import{j as b,B as w,gZ as j,eb as k,au as A,C as L,r as a,g_ as B}from"./index-C1DmWO_C.js";const v={label:{"> div":{py:0,pl:"4px",pr:"8px",alignItems:"center"},"> div:hover":{div:{backgroundColor:"grayShade3",borderColor:"transparent"}}}},D={label:{div:{backgroundColor:"white"}}},P=({children:e,icon:n,white:u=!1,size:o="md",...i})=>b.jsx(w,{sx:u?j(D,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,u)=>e.filter(({[u]:o})=>Array.isArray(n)?n.length?n.includes(o):e:n===o);var I=(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))(I||{});const E=(e,n="",u=!1,o="")=>{const[i,f]=a.useState([]),[h,y]=a.useState([]),[s,d]=a.useState(7),[m,c]=B({search:n}),x=a.useCallback(({target:r})=>{const t=r.value;c(t?{search:t}:{})},[c]),C=a.useCallback(r=>()=>{d(t=>t===r?7:r)},[d]),T=a.useCallback(()=>{c({}),f([]),y([]),d(7)},[c]),g=a.useMemo(()=>{const r=Array.from(new Set(e.filter(({name:l})=>l!=="Feature Group").map(({type:l})=>l)));let t=[];return u&&(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:x,onToggleKey:C,onReset:T}),[S,g,m,i,s,f,x,C,T])};export{P as F,I as K,p as f,E as u};
