import{u as h}from"./useQuery-DB4moXtm.js";import{i as a,x as m}from"./index-CXwCk-SR.js";function q(){const e=h({queryKey:["menu"],queryFn:()=>m.menu.get(),staleTime:3e4,refetchInterval:6e4,refetchOnWindowFocus:!0}),n=a(()=>{var r;return((r=e.data.value)==null?void 0:r.layers)??[]}),o=a(()=>n.value.filter(r=>r.active)),s=a(()=>n.value.filter(r=>r.serviceCount>0)),i=a(()=>{var r;return((r=e.data.value)==null?void 0:r.oap.reachable)??!1}),t=a(()=>{var r;return(r=e.data.value)==null?void 0:r.oap.error});function c(r){if(r)return n.value.find(f=>f.key===r)}function p(r){return r?!!(r.caps.serviceMap||r.caps.instanceTopology||r.caps.processTopology):!1}return{isLoading:e.isLoading,isError:e.isError,layers:n,activeLayers:o,availableLayers:s,oapReachable:i,oapError:t,findLayer:c,hasTopology:p,refetch:e.refetch}}function w(e){var n,o,s,i,t,c,p,r,f,u,l,y,g,d,v,b;return!e||(n=e.caps)!=null&&n.dashboards?"service":((o=e.caps)==null?void 0:o.instances)??!!((s=e.slots)!=null&&s.instances)?"instance":((i=e.caps)==null?void 0:i.endpoints)??!!((t=e.slots)!=null&&t.endpoints)?"endpoint":(c=e.caps)!=null&&c.serviceMap||(p=e.caps)!=null&&p.instanceTopology||(r=e.caps)!=null&&r.processTopology?"topology":(f=e.caps)!=null&&f.endpointDependency?"dependency":(u=e.caps)!=null&&u.traces?"trace":(l=e.caps)!=null&&l.logs?"logs":(y=e.caps)!=null&&y.traceProfiling?"trace-profiling":(g=e.caps)!=null&&g.ebpfProfiling?"ebpf-profiling":(d=e.caps)!=null&&d.networkProfiling?"network-profiling":(v=e.caps)!=null&&v.asyncProfiling?"async-profiling":(b=e.caps)!=null&&b.pprofProfiling?"pprof":"service"}export{w as f,q as u};
