import{d as $,t as J,u as Q,L as t,T as i,v as X,p as A,q as F,w as c,x as Y,y as S,z as Z,A as ee,B as f,j as te,C as le,D as ae,E as se,F as ne,G as oe,I as ie}from"./index-D68FyEHD.js";import{f as ue,X as de,Y as re,b as me,Q as ce,Z as pe,K as d,V as T,x as v,P as r,u as a,n as e,O as s,W as y,L as V,U as h,F as b,_ as fe,J as O,R as E,e as B}from"./vue-fWJEtAed.js";import{V as P}from"./VPagination-CnXoS-ep.js";import{a as ve}from"./vuetify-C7MH3EJQ.js";const ge={class:"pa-3"},ye={class:"d-flex align-center"},Ve={class:"text-headline-medium ml-2"},he={class:"d-flex justify-end"},Le={class:"d-flex mr-8 overflow-hidden"},_e={class:"d-flex"},Ie=ue({__name:"Logs",setup(ke){const U=de(),{t:p}=$(),{current:M}=ve(),L=J(),{filteredLogs:G,logTypeFilter:u,logMessageFilter:_,paginatedResults:W,currentPage:m,pageCount:g,reverseSort:k}=re(L),j=Q(),D={light:{[t.NORMAL]:new i("black"),[t.INFO]:new i("blue"),[t.WARNING]:new i("orange"),[t.CRITICAL]:new i("red")},dark:{[t.NORMAL]:new i("white"),[t.INFO]:new i("deepskyblue"),[t.WARNING]:new i("darkorange"),[t.CRITICAL]:new i("darkred").lighten(12)}},x=me([{title:t[t.NORMAL],value:t.NORMAL},{title:t[t.INFO],value:t.INFO},{title:t[t.WARNING],value:t.WARNING},{title:t[t.CRITICAL],value:t.CRITICAL}]),N=B(()=>u.value.length>0),C=B(()=>u.value.length===x.value.length);function I(){U.push({name:"dashboard"})}function w(n){return`color: #${D[M.value.dark?"dark":"light"][n.type].toHex()}`}function q(n){return t[n.type]}function z(n){return ie(n.timestamp*1e3).format(j.dateFormat)}function H(){C.value?u.value=[]:u.value=x.value.map(n=>n.value)}function R(n){n.key==="Escape"&&I()}return ce(async()=>{document.addEventListener("keydown",R),await L.cleanAndFetchLogs(),X(()=>{L.updateLogs()},15e3)}),pe(()=>{document.removeEventListener("keydown",R)}),(n,o)=>(d(),T("div",ge,[v("div",ye,[v("div",Ve,r(a(p)("logs.title")),1),e(A),v("div",he,[e(F,{icon:a(k)?"mdi-sort-descending":"mdi-sort-ascending",variant:"plain",onClick:o[0]||(o[0]=l=>k.value=!a(k))},null,8,["icon"]),e(F,{icon:"mdi-close",variant:"plain",onClick:I})])]),e(oe,null,{default:s(()=>[e(c,null,{default:s(()=>[e(Y,null,{default:s(()=>[e(S,{cols:"6"},{default:s(()=>[e(Z,{modelValue:a(u),"onUpdate:modelValue":o[1]||(o[1]=l=>y(u)?u.value=l:null),items:x.value,label:a(p)("logs.filters.type"),chips:"","hide-details":"",multiple:""},{"prepend-item":s(()=>[e(c,{title:a(p)("common.selectAll"),onClick:H},{prepend:s(()=>[e(ee,{indeterminate:N.value&&!C.value,"model-value":N.value},null,8,["indeterminate","model-value"])]),_:1},8,["title"]),e(f)]),_:1},8,["modelValue","items","label"])]),_:1}),e(S,{cols:"6"},{default:s(()=>[e(te,{modelValue:a(_),"onUpdate:modelValue":o[2]||(o[2]=l=>y(_)?_.value=l:null),label:a(p)("logs.filters.query"),clearable:"","hide-details":""},null,8,["modelValue","label"])]),_:1})]),_:1})]),_:1}),e(f,{class:"my-3",thickness:"5"}),a(g)>1?(d(),V(c,{key:0},{default:s(()=>[e(P,{modelValue:a(m),"onUpdate:modelValue":o[3]||(o[3]=l=>y(m)?m.value=l:null),length:a(g),"prev-icon":"mdi-menu-left","next-icon":"mdi-menu-right"},null,8,["modelValue","length"])]),_:1})):h("",!0),e(f),(d(!0),T(b,null,fe(a(W),(l,K)=>(d(),T(b,{key:l.id},[K>0?(d(),V(f,{key:0})):h("",!0),e(c,{class:"pa-0"},{default:s(()=>[e(le,{class:"p-0"},{default:s(()=>[e(ae,{class:"pa-0"},{default:s(()=>[e(se,{class:"text-no-wrap",style:O(w(l))},{default:s(()=>[v("div",Le,"["+r(l.id)+"] "+r(l.message),1),e(A),v("div",_e,r(z(l)),1)]),_:2},1032,["style"]),e(ne,{class:"wrap-word text-select",style:O(w(l))},{default:s(()=>[E(" ["+r(q(l))+"] "+r(l.message),1)]),_:2},1032,["style"])]),_:2},1024)]),_:2},1024)]),_:2},1024)],64))),128)),a(G).length===0?(d(),V(c,{key:1},{default:s(()=>[E(r(a(p)("logs.emptyLogList")),1)]),_:1})):h("",!0),e(f),a(g)>1?(d(),V(c,{key:2},{default:s(()=>[e(P,{modelValue:a(m),"onUpdate:modelValue":o[4]||(o[4]=l=>y(m)?m.value=l:null),length:a(g),"prev-icon":"mdi-menu-left","next-icon":"mdi-menu-right"},null,8,["modelValue","length"])]),_:1})):h("",!0)]),_:1})]))}});export{Ie as default};
