import{w as X,k as l,x as fe,u as pe,h as xe,p as a,j as e,q as k}from"./silentshield-vendor-lib-BOYiOmBi.js";import{c as P,D as ue,E as ge,_ as t,k as I,R as ve,C as d,f as p,h as N,p as D,i as h,T as Y,m as L,Z as O,n as Ne,G as ye,H as Ce,J as be,s as we,x as Te}from"./silentshield-admin.js";import{T as $,a as z,b as y}from"./silentshield-tabs-BTNm6AzK.js";import{T as _e,a as Se,b as B,c as C,d as Ee,e as b}from"./silentshield-table-D7OkaxR3.js";import{C as ke,D as Ie,a as De,b as Ae,c as Le,d as Pe}from"./silentshield-dialog-0-B8aaCF.js";import{S as G,a as K,b as Q,c as J,d as n}from"./silentshield-select-I_0kiXhj.js";import{C as ee}from"./silentshield-circle-x-GQt3emFf.js";import{G as Re}from"./silentshield-globe-DaHeodoC.js";import{D as qe}from"./silentshield-database-DFJNIKdh.js";import{C as Fe}from"./silentshield-clock-D68IEilz.js";import{I as He}from"./silentshield-info-BOcn7Nfl.js";import"./silentshield-vendor-ui-BEc9V-_C.js";import"./silentshield-vendor-charts-CfxhkB09.js";import"./silentshield-chevron-down-DZwGJKhU.js";import"./silentshield-check-JbCO-ozo.js";/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const te=P("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Me=P("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ve=P("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);function je(s={}){return X({queryKey:["audit","summary",s],queryFn:()=>ue(s)})}function Oe(s={}){return X({queryKey:["audit","entries",s],queryFn:()=>ge(s),placeholderData:x=>x})}const w={info:{label:t("Info","captcha-for-contact-form-7"),color:"secondary",icon:He,iconClass:"text-muted-foreground"},warning:{label:t("Warning","captcha-for-contact-form-7"),color:"default",icon:Y,iconClass:"text-warning"},error:{label:t("Error","captcha-for-contact-form-7"),color:"destructive",icon:te,iconClass:"text-destructive"},critical:{label:t("Critical","captcha-for-contact-form-7"),color:"destructive",icon:ee,iconClass:"text-destructive"}},W={settings_change:Ve,cron_run:Fe,activation:Me,rate_limit:Ne,api_error:O,db_error:qe,trial:O,i18n:Re},Z={settings_change:t("Settings","captcha-for-contact-form-7"),cron_run:t("Cron","captcha-for-contact-form-7"),activation:t("Activation","captcha-for-contact-form-7"),rate_limit:t("Rate Limit","captcha-for-contact-form-7"),api_error:t("API Error","captcha-for-contact-form-7"),db_error:t("DB Error","captcha-for-contact-form-7"),trial:t("Trial","captcha-for-contact-form-7"),i18n:t("Translation","captcha-for-contact-form-7")};function U(s){return new Date(s).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function T(){return a(d,{children:[e(p,{className:"pb-2",children:e(L,{className:"h-3 w-24"})}),e(h,{children:e(L,{className:"h-7 w-12"})})]})}const A=20,$e=["off","5","15","30"],ze={off:t("Off","captcha-for-contact-form-7"),5:t("5s","captcha-for-contact-form-7"),15:t("15s","captcha-for-contact-form-7"),30:t("30s","captcha-for-contact-form-7")};function nt(){const[s,x]=l("30"),[_,ae]=l("all"),[S,ce]=l("all"),[u,m]=l(1),[r,R]=l(null),[g,re]=l("off"),[q,F]=l(!1),v=fe(),ne=Number(s),oe=(u-1)*A,se=pe(async()=>{F(!0),await v.invalidateQueries({queryKey:["audit"]}),F(!1)},[v]);xe(()=>{if(g==="off")return;const c=Number(g)*1e3,f=setInterval(()=>{v.invalidateQueries({queryKey:["audit"]})},c);return()=>clearInterval(f)},[g,v]);const H={days:ne,type:_!=="all"?_:void 0,severity:S!=="all"?S:void 0},{data:o,isLoading:le}=je(H),{data:i,isLoading:ie}=Oe({...H,limit:A,offset:oe}),M=(i==null?void 0:i.data)??[],V=(i==null?void 0:i.total)??0,j=Math.max(1,Math.ceil(V/A)),de=c=>{x(c),m(1)},he=c=>{ae(c),m(1)},me=c=>{ce(c),m(1)};return a("div",{className:"space-y-6",children:[a("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[a("div",{children:[e("h1",{className:"text-2xl font-bold tracking-tight",children:t("Audit Log","captcha-for-contact-form-7")}),e("p",{className:"text-muted-foreground",children:t("System events and change log","captcha-for-contact-form-7")})]}),a("div",{className:"flex items-center gap-2",children:[e($,{value:g,onValueChange:c=>re(c),children:e(z,{children:$e.map(c=>e(y,{value:c,className:"text-xs",children:ze[c]},c))})}),e(I,{variant:"outline",size:"icon",className:"h-9 w-9",onClick:se,disabled:q,children:e(ve,{className:`h-4 w-4 ${q?"animate-spin":""}`})}),e($,{value:s,onValueChange:de,children:a(z,{children:[e(y,{value:"7",className:"text-xs",children:t("7 Days","captcha-for-contact-form-7")}),e(y,{value:"30",className:"text-xs",children:t("30 Days","captcha-for-contact-form-7")}),e(y,{value:"90",className:"text-xs",children:t("90 Days","captcha-for-contact-form-7")})]})})]})]}),e("div",{className:"grid gap-4 md:grid-cols-4",children:le?a(k,{children:[e(T,{}),e(T,{}),e(T,{}),e(T,{})]}):a(k,{children:[a(d,{children:[e(p,{className:"pb-2",children:a(N,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e(D,{className:"h-3 w-3"})," ",t("Total Events","captcha-for-contact-form-7")]})}),e(h,{children:e("div",{className:"text-2xl font-bold",children:(o==null?void 0:o.total)??0})})]}),a(d,{children:[e(p,{className:"pb-2",children:a(N,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e(Y,{className:"h-3 w-3 text-warning"})," ",t("Warnings","captcha-for-contact-form-7")]})}),e(h,{children:e("div",{className:"text-2xl font-bold text-warning",children:(o==null?void 0:o.warnings)??0})})]}),a(d,{children:[e(p,{className:"pb-2",children:a(N,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e(te,{className:"h-3 w-3 text-destructive"})," ",t("Error","captcha-for-contact-form-7")]})}),e(h,{children:e("div",{className:"text-2xl font-bold text-destructive",children:(o==null?void 0:o.errors)??0})})]}),a(d,{children:[e(p,{className:"pb-2",children:a(N,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e(ee,{className:"h-3 w-3"})," ",t("Critical","captcha-for-contact-form-7")]})}),e(h,{children:e("div",{className:"text-2xl font-bold",children:(o==null?void 0:o.critical)??0})})]})]})}),a("div",{className:"flex gap-2",children:[a(G,{value:_,onValueChange:he,children:[e(K,{className:"h-8 w-[160px] text-xs",children:e(Q,{placeholder:t("Event Type","captcha-for-contact-form-7")})}),a(J,{children:[e(n,{value:"all",children:t("All Types","captcha-for-contact-form-7")}),e(n,{value:"settings_change",children:t("Settings Change","captcha-for-contact-form-7")}),e(n,{value:"cron_run",children:t("Cron","captcha-for-contact-form-7")}),e(n,{value:"activation",children:t("Activation","captcha-for-contact-form-7")}),e(n,{value:"rate_limit",children:t("Rate Limit","captcha-for-contact-form-7")}),e(n,{value:"api_error",children:t("API Error","captcha-for-contact-form-7")}),e(n,{value:"db_error",children:t("DB Error","captcha-for-contact-form-7")}),e(n,{value:"trial",children:t("Trial","captcha-for-contact-form-7")}),e(n,{value:"i18n",children:t("Translation","captcha-for-contact-form-7")})]})]}),a(G,{value:S,onValueChange:me,children:[e(K,{className:"h-8 w-[140px] text-xs",children:e(Q,{placeholder:t("Severity","captcha-for-contact-form-7")})}),a(J,{children:[e(n,{value:"all",children:t("All","captcha-for-contact-form-7")}),e(n,{value:"info",children:t("Info","captcha-for-contact-form-7")}),e(n,{value:"warning",children:t("Warning","captcha-for-contact-form-7")}),e(n,{value:"error",children:t("Error","captcha-for-contact-form-7")}),e(n,{value:"critical",children:t("Critical","captcha-for-contact-form-7")})]})]})]}),e(d,{children:e(h,{className:"p-0",children:ie?e("div",{className:"p-4 space-y-2",children:[1,2,3,4,5,6].map(c=>e(L,{className:"h-10 w-full"},c))}):M.length===0?e("div",{className:"text-center py-12 text-sm text-muted-foreground",children:t("No events in the selected period","captcha-for-contact-form-7")}):a(k,{children:[a(_e,{children:[e(Se,{children:a(B,{children:[e(C,{className:"text-xs w-[160px]",children:t("Timestamp","captcha-for-contact-form-7")}),e(C,{className:"text-xs w-[110px]",children:t("Type","captcha-for-contact-form-7")}),e(C,{className:"text-xs w-[90px]",children:t("Severity","captcha-for-contact-form-7")}),e(C,{className:"text-xs",children:t("Message","captcha-for-contact-form-7")})]})}),e(Ee,{children:M.map(c=>{const f=W[c.event_type]||D,E=w[c.severity]||w.info;return a(B,{className:"cursor-pointer hover:bg-accent",onClick:()=>R(c),children:[e(b,{className:"text-xs text-muted-foreground",children:U(c.ts)}),e(b,{children:a("div",{className:"flex items-center gap-1.5",children:[e(f,{className:"h-3 w-3 text-muted-foreground"}),e("span",{className:"text-xs",children:Z[c.event_type]||c.event_type})]})}),e(b,{children:a(ye,{children:[e(Ce,{asChild:!0,children:e("span",{className:"inline-flex items-center justify-center",children:e(E.icon,{className:`h-4 w-4 ${E.iconClass}`})})}),e(be,{side:"right",children:e("p",{className:"text-xs",children:E.label})})]})}),e(b,{className:"text-xs max-w-[300px] truncate",children:c.description})]},c.id)})})]}),a("div",{className:"flex items-center justify-between p-4 border-t",children:[e("span",{className:"text-xs text-muted-foreground",children:we(t("Page %1$d of %2$d (%3$d total)","captcha-for-contact-form-7"),u,j,V)}),a("div",{className:"flex gap-1",children:[e(I,{variant:"outline",size:"icon",className:"h-7 w-7",disabled:u===1,onClick:()=>m(c=>c-1),children:e(ke,{className:"h-3 w-3"})}),e(I,{variant:"outline",size:"icon",className:"h-7 w-7",disabled:u>=j,onClick:()=>m(c=>c+1),children:e(Te,{className:"h-3 w-3"})})]})]})]})})}),e(Ie,{open:!!r,onOpenChange:()=>R(null),children:a(De,{children:[a(Ae,{children:[e(Le,{children:t("Event Details","captcha-for-contact-form-7")}),e(Pe,{children:t("Complete event information","captcha-for-contact-form-7")})]}),r&&(()=>{const c=w[r.severity]||w.info,f=W[r.event_type]||D;return a("div",{className:"space-y-3 text-sm",children:[a("div",{className:"grid grid-cols-2 gap-3",children:[a("div",{children:[e("span",{className:"text-muted-foreground text-xs",children:t("Timestamp:","captcha-for-contact-form-7")}),e("p",{className:"text-xs",children:U(r.ts)})]}),a("div",{children:[e("span",{className:"text-muted-foreground text-xs",children:t("Type:","captcha-for-contact-form-7")}),a("p",{className:"flex items-center gap-1 text-xs",children:[e(f,{className:"h-3 w-3"}),Z[r.event_type]||r.event_type]})]}),a("div",{children:[e("span",{className:"text-muted-foreground text-xs",children:t("Severity:","captcha-for-contact-form-7")}),a("p",{className:"flex items-center gap-1 text-xs mt-0.5",children:[e(c.icon,{className:`h-3.5 w-3.5 ${c.iconClass}`}),c.label]})]}),a("div",{children:[e("span",{className:"text-muted-foreground text-xs",children:t("Event Code:","captcha-for-contact-form-7")}),e("p",{className:"text-xs font-mono",children:r.event_code})]}),r.user_id&&a("div",{children:[e("span",{className:"text-muted-foreground text-xs",children:t("User ID:","captcha-for-contact-form-7")}),e("p",{className:"text-xs",children:r.user_id})]}),r.ip_hash&&a("div",{children:[e("span",{className:"text-muted-foreground text-xs",children:t("IP Hash:","captcha-for-contact-form-7")}),e("p",{className:"text-xs font-mono break-all",children:r.ip_hash})]})]}),a("div",{children:[e("span",{className:"text-muted-foreground text-xs",children:t("Message:","captcha-for-contact-form-7")}),e("p",{className:"text-xs mt-1 rounded-lg bg-accent p-3",children:r.description})]}),r.context&&a("div",{children:[e("span",{className:"text-muted-foreground text-xs",children:t("Context:","captcha-for-contact-form-7")}),e("pre",{className:"text-[10px] mt-1 rounded-lg bg-accent p-3 overflow-auto max-h-40 whitespace-pre-wrap",children:(()=>{try{return JSON.stringify(JSON.parse(r.context),null,2)}catch{return r.context}})()})]})]})})()]})})]})}export{nt as default};
