import{n as f}from"./rolldown-runtime-M0oDzQ_3.js";import{$t as X,Jn as R,Kn as i,On as S,Rn as u,Rt as j,St as Y,Ut as ee,Xt as y,Zn as n,Zt as t,_n as se,an as le,en as r,g as ae,in as m,kn as te,qt as E,rn as ne,t as ie,ut as C,xn as oe,yn as _,z as ue}from"./ui-vendor-CepnLjNg.js";import{c as re,l as _e}from"./vue-vendor-BQwgTLLQ.js";import{d as P,l as ce,n as ve,t as de}from"./_plugin-vue_export-helper-BP_yjQAc.js";async function ge(){return(await P("/api/hermes/logs")).files}async function pe(N,a){const o=new URLSearchParams;a?.lines&&o.set("lines",String(a.lines)),a?.level&&o.set("level",a.level),a?.session&&o.set("session",a.session),a?.since&&o.set("since",a.since);const c=o.toString();return(await P(`/api/hermes/logs/${N}${c?`?${c}`:""}`)).entries.filter(v=>v!==null)}var me=f((()=>{ce()})),O,U,k,B,z,I,q,F,G,$,D,M,T,W,A=f((()=>{j(),ie(),re(),me(),O={class:"logs-view"},U={class:"page-header"},k={class:"header-title"},B={class:"header-actions"},z=["placeholder"],I={class:"logs-body"},q={key:0,class:"logs-empty"},F={class:"log-list"},G={class:"log-time"},$={class:"log-logger"},D={class:"access-method"},M={class:"access-path"},T={key:1,class:"log-message"},W=le({__name:"LogsView",setup(N){const{t:a}=_e(),o=ue(),c=u([]),v=u("agent"),w=u([]),d=u(!1),b=u(100),L=u(""),h=u(""),H=y(()=>c.value.map(s=>({label:`${s.name} (${s.size})`,value:s.name}))),Z=y(()=>[{label:a("logs.all"),value:""},{label:"ERROR",value:"ERROR"},{label:"WARNING",value:"WARNING"},{label:"INFO",value:"INFO"},{label:"DEBUG",value:"DEBUG"}]),J=[{label:"50",value:50},{label:"100",value:100},{label:"200",value:200},{label:"500",value:500}],V=y(()=>{if(!h.value)return w.value;const s=h.value.toLowerCase();return w.value.filter(e=>e.message.toLowerCase().includes(s)||e.logger.toLowerCase().includes(s)||e.raw.toLowerCase().includes(s))});function x(s){switch(s){case"ERROR":return"level-error";case"WARNING":return"level-warning";case"DEBUG":return"level-debug";default:return"level-info"}}function K(s){const e=s.match(/\d{2}:\d{2}:\d{2}/);return e?e[0]:s}function g(s){const e=s.match(/"(\w+)\s+(\S+)\s+HTTP\/[^"]+"\s+(\d+)/);return e?{method:e[1],path:e[2],status:e[3]}:null}async function p(){d.value=!0;try{w.value=(await pe(v.value,{lines:b.value,level:L.value||void 0})).filter(s=>s!==null)}catch(s){o.error(s.message)}finally{d.value=!1}}return se(async()=>{c.value=await ge(),await p()}),(s,e)=>(_(),r("div",O,[t("header",U,[t("h2",k,n(i(a)("logs.title")),1),t("div",B,[m(i(C),{value:v.value,"onUpdate:value":[e[0]||(e[0]=l=>v.value=l),p],options:H.value,size:"small",class:"input-md"},null,8,["value","options"]),m(i(C),{value:L.value,options:Z.value,size:"small",class:"input-sm","onUpdate:value":e[1]||(e[1]=l=>{L.value=l,p()})},null,8,["value","options"]),m(i(C),{value:b.value,options:J,size:"small",class:"input-sm","onUpdate:value":e[2]||(e[2]=l=>{b.value=l,p()})},null,8,["value"]),te(t("input",{"onUpdate:modelValue":e[3]||(e[3]=l=>h.value=l),class:"search-input",placeholder:i(a)("logs.searchPlaceholder")},null,8,z),[[ee,h.value]]),m(i(Y),{size:"small",loading:d.value,onClick:p},{default:S(()=>[ne(n(i(a)("logs.refresh")),1)]),_:1},8,["loading"])])]),t("div",I,[m(i(ae),{show:d.value,class:"logs-spin"},{default:S(()=>[V.value.length===0&&!d.value?(_(),r("div",q,n(i(a)("logs.noEntries")),1)):X("",!0),t("div",F,[(_(!0),r(E,null,oe(V.value,(l,Q)=>(_(),r("div",{key:Q,class:R(["log-entry",x(l.level)])},[t("span",G,n(K(l.timestamp)),1),t("span",{class:R(["log-level",x(l.level)])},n(l.level),3),t("span",$,n(l.logger),1),g(l.message)?(_(),r(E,{key:0},[t("span",D,n(g(l.message).method),1),t("span",M,n(g(l.message).path),1),t("span",{class:R(["access-status","status-"+(g(l.message).status?.[0]||"x")])},n(g(l.message).status),3)],64)):(_(),r("span",T,n(l.message),1))],2))),128))])]),_:1},8,["show"])])]))}})})),he=f((()=>{})),fe,we=f((()=>{A(),A(),he(),ve(),fe=de(W,[["__scopeId","data-v-a840928e"]])}));we();export{fe as default};
