import{d as T,w as x,c as n,k as y,a,l as R,u as p,f as r,t as c,F as N,r as S,b as w,h as k,i as F,N as I,o,n as A,q as z,$ as O}from"./index-CXwCk-SR.js";import{u as D}from"./useQuery-DB4moXtm.js";import{P}from"./Pill-CQ5c4klO.js";import{B}from"./Btn-C1O3ReU4.js";import{A as $}from"./AdminFeatureWarning-BHIe8rWf.js";import{_ as V}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./useAdminFeatures-De7MCLZf.js";import"./Icon.vue_vue_type_script_setup_true_lang-C11sQmoM.js";const W=new Set(["from","filter","disable"]),q=new Set(["cpm","sum","sumPerMin","avg","longAvg","doubleAvg","count","distinct","rate","percent","p50","p75","p90","p95","p99","histogram","histogramPercentile","apdex","maxLong","minLong","maxDouble","minDouble","sumLabeled","avgLabeled"]),Q=new Set(["Service","ServiceInstance","ServiceRelation","ServiceInstanceRelation","Endpoint","EndpointRelation","DetectPoint","Layer","NodeType","RequestType"]),U=/^(?:\/\/|#)/,Z=/^'(?:\\.|[^'\\])*'/,G=/^"(?:\\.|[^"\\])*"/,K=/^-?\d+(?:\.\d+)?\b/,Y=/^[A-Za-z_][A-Za-z0-9_]*/,j=/^[(){}[\].,;:=<>!+\-*/&|]+/,H=/^\s+/;function J(m,E){return W.has(m)?"keyword":q.has(m)?"fn":Q.has(m)?"type":"plain"}function X(m,E){const u=[];let t=m;for(;t.length>0;){if(U.test(t)){u.push({kind:"comment",text:t});break}let l;if(l=t.match(H)){u.push({kind:"plain",text:l[0]}),t=t.slice(l[0].length);continue}if((l=t.match(Z))||(l=t.match(G))){u.push({kind:"string",text:l[0]}),t=t.slice(l[0].length);continue}if(l=t.match(K)){u.push({kind:"number",text:l[0]}),t=t.slice(l[0].length);continue}if(l=t.match(Y)){u.push({kind:J(l[0]),text:l[0]}),t=t.slice(l[0].length);continue}if(l=t.match(j)){u.push({kind:"punct",text:l[0]}),t=t.slice(l[0].length);continue}u.push({kind:"plain",text:t[0]}),t=t.slice(1)}return u}const ee={class:"oal"},te={class:"oal__header"},le={class:"oal__hint"},se={class:"oal__pane"},ne={class:"oal__paneh"},oe={class:"oal__panecount"},ae={key:0,class:"oal__loading"},ie={key:1,class:"oal__error"},re={key:2,class:"oal__empty"},ue={key:3,class:"oal__filelistwrap"},de={class:"oal__filelist"},ce=["onClick"],_e={class:"oal__filedetail"},fe={key:0,class:"oal__filehead"},me={key:0,class:"oal__filemeta"},pe={key:1,class:"oal__loading"},ve={key:2,class:"oal__error"},he={key:3,class:"oal__filepre"},ge=["title","onClick"],be={key:1,class:"oal__dbgslot","aria-hidden":"true"},ye={class:"oal__linenum"},ke={class:"oal__linetext"},Ee=T({__name:"OalCatalogView",setup(m){const E=z(),u=/^([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*from\s*\(/;function t(s){const e=s.trim();if(e.startsWith("//")||e.startsWith("#")||/^disable\s*\(/.test(e))return null;const f=e.match(u);return f?f[1]:null}function l(s){const e=d.value;e&&E.push({path:"/operate/live-debug/oal",query:{file:e,ruleName:s}})}const d=k(null),v=k(null),L=k(!1),h=k(null),_=D({queryKey:["oal/files"],queryFn:async()=>O.dsl.oalFiles()}),g=F(()=>{var s;return((s=_.data.value)==null?void 0:s.files)??[]});x(()=>d.value,async s=>{if(v.value=null,h.value=null,!!s){L.value=!0;try{v.value=await O.dsl.oalFileContent(s),v.value===null&&(h.value="file not found")}catch(e){h.value=e instanceof Error?e.message:String(e)}finally{L.value=!1}}}),x(()=>g.value,s=>{d.value===null&&s.length>0&&(d.value=s[0])});const C=F(()=>{const s=v.value;return s===null?[]:(s.endsWith(`
`)?s.slice(0,-1):s).split(`
`).map((f,i)=>({num:i+1,tokens:X(f),debugMetric:t(f)}))});return(s,e)=>{const f=I("router-link");return o(),n("div",ee,[y($,{module:"receiver-runtime-rule","feature-label":"OAL catalog"}),a("header",te,[e[10]||(e[10]=a("h1",{class:"oal__h1"},"OAL catalog",-1)),y(P,{tone:"dim"},{default:R(()=>[...e[2]||(e[2]=[r("read-only",-1)])]),_:1}),y(B,{size:"sm",disabled:p(_).isFetching.value,title:"re-pull /runtime/oal/files",onClick:e[0]||(e[0]=i=>p(_).refetch())},{default:R(()=>[r(c(p(_).isFetching.value?"refreshing…":"refresh"),1)]),_:1},8,["disabled"]),a("span",le,[e[4]||(e[4]=r(" OAL hot-update is upstream-deferred. Each ",-1)),e[5]||(e[5]=a("code",null,".oal",-1)),e[6]||(e[6]=r(" file defines source classes (the input row the analyzer emits, e.g. ",-1)),e[7]||(e[7]=a("code",null,"Endpoint",-1)),e[8]||(e[8]=r(") and the metrics derived from them. Browse the loaded files below; install a live debug session from ",-1)),y(f,{to:"/debug",class:"oal__link"},{default:R(()=>[...e[3]||(e[3]=[r("Live debugger",-1)])]),_:1}),e[9]||(e[9]=r(" to see runtime metric capture. ",-1))])]),a("section",se,[a("header",ne,[e[11]||(e[11]=r(" files ",-1)),a("span",oe,c(g.value.length),1)]),p(_).isPending.value?(o(),n("div",ae,"loading…")):p(_).isError.value?(o(),n("div",ie,[e[12]||(e[12]=r(" Could not load OAL files. ",-1)),a("button",{type:"button",onClick:e[1]||(e[1]=i=>p(_).refetch())},"retry")])):g.value.length===0?(o(),n("div",re,[...e[13]||(e[13]=[r(" no ",-1),a("code",null,".oal",-1),r(" files loaded ",-1)])])):(o(),n("div",ue,[a("ul",de,[(o(!0),n(N,null,S(g.value,i=>(o(),n("li",{key:i},[a("button",{type:"button",class:A(["oal__fileitem",{"oal__fileitem--active":d.value===i}]),onClick:b=>d.value=i},[a("code",null,c(i),1)],10,ce)]))),128))]),a("div",_e,[d.value?(o(),n("header",fe,[a("code",null,c(d.value),1),C.value.length>0?(o(),n("span",me,c(C.value.length)+" lines ",1)):w("",!0)])):w("",!0),L.value?(o(),n("div",pe,"loading…")):h.value?(o(),n("div",ve,c(h.value),1)):v.value!==null?(o(),n("pre",he,[(o(!0),n(N,null,S(C.value,i=>(o(),n("span",{key:i.num,class:A(["oal__line",{"oal__line--debuggable":i.debugMetric!==null}])},[i.debugMetric?(o(),n("button",{key:0,type:"button",class:"oal__dbgbtn",title:`Live debug: ${i.debugMetric}`,onClick:b=>l(i.debugMetric)},"▶",8,ge)):(o(),n("span",be)),a("span",ye,c(i.num),1),a("span",ke,[(o(!0),n(N,null,S(i.tokens,(b,M)=>(o(),n("span",{key:M,class:A(`hl hl--${b.kind}`)},c(b.text),3))),128))])],2))),128))])):w("",!0)])]))])])}}}),Fe=V(Ee,[["__scopeId","data-v-a96ac845"]]);export{Fe as default};
