1import{c as ge,r as P,j as s,a as X,H as fe}from"./app-BlcLlHUL.js";import{A as be}from"./app-layout-ZVCtoNYy.js";import{B as D}from"./button-BC_dtIew.js";import{I as Q}from"./input-vRy47pv4.js";import{b as W,e as u,a as ve,c as j,T as ye,d as Ne}from"./table-DMrgEgaK.js";import{d as Se,X as _e,S as we,a as Te,b as Ce,c as ke,e as Ae}from"./dropdown-menu-DmUzTOrv.js";import{S as ie,a as ne,b as ce,c as oe,d as $}from"./select-DL-pAdpA.js";import{T as Fe,a as Ee,b as Y,c as Z}from"./tabs-D_nRrSq-.js";import{B as de}from"./badge-BL5I1HF9.js";import{f as Ve}from"./formatDistanceToNow-CBSK5Ifn.js";import{E as Le}from"./eye-BGBLigmt.js";import{F as De}from"./funnel-B8U6fOk5.js";import{f as Ie}from"./format-dF0Ok3Yz.js";import{p as me}from"./pt-BR-Drmqrfon.js";import"./app-CGUa4fkO.js";import"./index-5U0-niVg.js";import"./index-C_uIlz4a.js";import"./sliders-horizontal-DDigK9_E.js";import"./createLucideIcon-Q1S4erf6.js";import"./index-DpQ8-6wD.js";import"./index-C_SHgnPd.js";import"./users-C7dJfz3k.js";import"./layout-grid-Znr6WdXh.js";import"./message-square-zVoFvQO5.js";import"./gavel-DZcxDf0l.js";import"./refresh-cw-V33poztA.js";import"./file-check-CagHtahi.js";import"./trending-up-DYSJkAqP.js";import"./file-text-Dk_FODFJ.js";import"./stethoscope-BIlPb6I5.js";import"./activity-BnuEWjZQ.js";import"./clipboard-list-Dv_Cc9AM.js";import"./building-2-i8KRcRez.js";import"./scale-DP05Exov.js";import"./mail-TmzD6chc.js";import"./tag-DTHWDtrd.js";import"./newspaper-D3NiiGgO.js";import"./circle-question-mark-p_vWdGcE.js";import"./alert-dialog-DK7oyLfr.js";import"./circle-alert-C0ySwRu9.js";import"./index-BdQq_4o_.js";import"./index-CjwpqB9T.js";import"./chevron-down-LRxJl1i6.js";import"./chevron-up-BA83TFVu.js";import"./endOfMonth-DgIZTpiD.js";function Vs(l){const e=ge.c(81),{audits:t,filters:xe,eventTypes:I,auditableTypes:B}=l,[a,pe]=P.useState(null),[G,ee]=P.useState(!1),[o,he]=P.useState(!1),[i,se]=P.useState(xe);let M;e[0]!==i?(M=(c,k)=>{const A={...i,[c]:k||void 0};se(A)},e[0]=i,e[1]=M):M=e[1];const n=M;let H;e[2]!==i?(H=()=>{X.get("/admin/audit-logs",i,{preserveState:!0,preserveScroll:!0})},e[2]=i,e[3]=H):H=e[3];const R=H;let O;e[4]===Symbol.for("react.memo_cache_sentinel")?(O=()=>{se({}),X.get("/admin/audit-logs",{},{preserveState:!0,preserveScroll:!0})},e[4]=O):O=e[4];const ue=O;let z;e[5]===Symbol.for("react.memo_cache_sentinel")?(z=c=>{pe(c),ee(!0)},e[5]=z):z=e[5];const je=z,te=Oe,K=He,ae=Me,re=Re;let g,f,b,v,d,m,x,p,y,h,N,S,_;if(e[6]!==R||e[7]!==B||e[8]!==t.current_page||e[9]!==t.data||e[10]!==t.last_page||e[11]!==t.per_page||e[12]!==t.total||e[13]!==I||e[14]!==n||e[15]!==i||e[16]!==a||e[17]!==o||e[18]!==G){const c=a?ae(a.old_values):null,k=a?ae(a.new_values):null;b=be,e[32]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(fe,{title:"Logs do Sistema"}),e[32]=p):p=e[32],v="p-6";let A;e[33]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Logs do Sistema"}),s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Acompanhe todas as alterações realizadas no sistema"})]}),e[33]=A):A=e[33];let F;e[34]!==o?(F=()=>he(!o),e[34]=o,e[35]=F):F=e[35];let q;e[36]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(De,{className:"h-4 w-4 mr-2"}),e[36]=q):q=e[36],e[37]!==F?(d=s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[A,s.jsxs(D,{variant:"outline",onClick:F,children:[q,"Filtros"]})]}),e[37]=F,e[38]=d):d=e[38],e[39]!==R||e[40]!==B||e[41]!==I||e[42]!==n||e[43]!==i||e[44]!==o?(m=o&&s.jsxs("div",{className:"bg-white rounded-xl border shadow-sm p-4 mb-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Buscar"}),s.jsxs("div",{className:"relative",children:[s.jsx(Se,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),s.jsx(Q,{placeholder:"URL, IP, usuário...",value:i.search||"",onChange:r=>n("search",r.target.value),className:"pl-10"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Evento"}),s.jsxs(ie,{value:i.event||"",onValueChange:r=>n("event",r),children:[s.jsx(ne,{children:s.jsx(ce,{placeholder:"Todos os eventos"})}),s.jsxs(oe,{children:[s.jsx($,{value:"",children:"Todos os eventos"}),I.map(r=>s.jsx($,{value:r,children:K(r)},r))]})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Tipo de Modelo"}),s.jsxs(ie,{value:i.auditable_type||"",onValueChange:r=>n("auditable_type",r),children:[s.jsx(ne,{children:s.jsx(ce,{placeholder:"Todos os tipos"})}),s.jsxs(oe,{children:[s.jsx($,{value:"",children:"Todos os tipos"}),B.map(Be)]})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Data Inicial"}),s.jsx(Q,{type:"date",value:i.date_from||"",onChange:r=>n("date_from",r.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Data Final"}),s.jsx(Q,{type:"date",value:i.date_to||"",onChange:r=>n("date_to",r.target.value)})]})]}),s.jsxs("div",{className:"flex gap-2 mt-4",children:[s.jsx(D,{onClick:R,children:"Aplicar Filtros"}),s.jsxs(D,{variant:"outline",onClick:ue,children:[s.jsx(_e,{className:"h-4 w-4 mr-2"}),"Limpar"]})]})]}),e[39]=R,e[40]=B,e[41]=I,e[42]=n,e[43]=i,e[44]=o,e[45]=m):m=e[45];let J;e[46]===Symbol.for("react.memo_cache_sentinel")?(J=s.jsx(ve,{children:s.jsxs(W,{children:[s.jsx(j,{className:"w-12",children:"#"}),s.jsx(j,{children:"Evento"}),s.jsx(j,{children:"Modelo"}),s.jsx(j,{children:"Usuário"}),s.jsx(j,{children:"IP"}),s.jsx(j,{children:"Data"}),s.jsx(j,{className:"w-24 text-right",children:"Ações"})]})}),e[46]=J):J=e[46];let E;e[47]!==t.data?(E=t.data.length===0?s.jsx(W,{children:s.jsx(u,{colSpan:7,className:"text-center py-12",children:s.jsx("p",{className:"text-gray-500",children:"Nenhum log encontrado"})})}):t.data.map(r=>s.jsxs(W,{children:[s.jsx(u,{className:"font-medium",children:r.id}),s.jsx(u,{children:s.jsx(de,{variant:te(r.event),children:K(r.event)})}),s.jsx(u,{className:"text-sm",children:s.jsx("code",{className:"text-xs bg-gray-100 px-2 py-1 rounded",children:re(r.auditable_type)})}),s.jsx(u,{children:r.user?s.jsxs("div",{children:[s.jsx("div",{className:"font-medium",children:r.user.name}),s.jsx("div",{className:"text-xs text-gray-500",children:r.user.email})]}):s.jsx("span",{className:"text-gray-400",children:"Sistema"})}),s.jsx(u,{className:"text-sm text-gray-500",children:r.ip_address||"-"}),s.jsx(u,{className:"text-sm text-gray-500",children:Ve(new Date(r.created_at),{addSuffix:!0,locale:me})}),s.jsx(u,{className:"text-right",children:s.jsx(D,{variant:"outline",size:"icon",onClick:()=>je(r),children:s.jsx(Le,{className:"h-4 w-4"})})})]},r.id)),e[47]=t.data,e[48]=E):E=e[48];let V;e[49]!==E?(V=s.jsxs(ye,{children:[J,s.jsx(Ne,{children:E})]}),e[49]=E,e[50]=V):V=e[50];let L;e[51]!==t.current_page||e[52]!==t.last_page||e[53]!==t.per_page||e[54]!==t.total||e[55]!==i?(L=t.last_page>1&&s.jsxs("div",{className:"p-4 border-t flex justify-between items-center",children:[s.jsxs("div",{className:"text-sm text-gray-500",children:["Mostrando ",(t.current_page-1)*t.per_page+1," a"," ",Math.min(t.current_page*t.per_page,t.total)," de ",t.total," registros"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(D,{variant:"outline",size:"sm",disabled:t.current_page===1,onClick:()=>X.get("/admin/audit-logs",{...i,page:t.current_page-1},{preserveState:!0,preserveScroll:!0}),children:"Anterior"}),s.jsx(D,{variant:"outline",size:"sm",disabled:t.current_page===t.last_page,onClick:()=>X.get("/admin/audit-logs",{...i,page:t.current_page+1},{preserveState:!0,preserveScroll:!0}),children:"Próxima"})]})]}),e[51]=t.current_page,e[52]=t.last_page,e[53]=t.per_page,e[54]=t.total,e[55]=i,e[56]=L):L=e[56],e[57]!==V||e[58]!==L?(
1x=s.jsxs("div",{className:"bg-white rounded-xl border shadow-sm",children:[V,L]}),e[57]=V,e[58]=L,e[59]=x):x=e[59],f=we,S=G,_=ee,g=Te,y="w-full sm:max-w-2xl overflow-y-auto p-6",e[60]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsxs(Ce,{children:[s.jsx(ke,{children:"Detalhes do Log"}),s.jsx(Ae,{children:"Informações completas sobre esta alteração"})]}),e[60]=h):h=e[60],N=a&&s.jsx("div",{className:"mt-6",children:s.jsxs(Fe,{defaultValue:"basicas",className:"w-full",children:[s.jsxs(Ee,{className:"grid w-full grid-cols-3",children:[s.jsx(Y,{value:"basicas",children:"Informações Básicas"}),s.jsx(Y,{value:"valores",children:"Valores"}),s.jsx(Y,{value:"requisicao",children:"Requisição"})]}),s.jsx(Z,{value:"basicas",className:"mt-4 space-y-4",children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex justify-between items-center py-2 border-b",children:[s.jsx("span",{className:"text-gray-500 text-sm",children:"Evento:"}),s.jsx(de,{variant:te(a.event),children:K(a.event)})]}),s.jsxs("div",{className:"flex justify-between items-center py-2 border-b",children:[s.jsx("span",{className:"text-gray-500 text-sm",children:"Modelo:"}),s.jsx("code",{className:"text-xs bg-gray-100 px-2 py-1 rounded font-medium",children:re(a.auditable_type)})]}),s.jsxs("div",{className:"flex justify-between items-center py-2 border-b",children:[s.jsx("span",{className:"text-gray-500 text-sm",children:"ID do Registro:"}),s.jsx("span",{className:"font-medium",children:a.auditable_id})]}),s.jsxs("div",{className:"flex justify-between items-center py-2 border-b",children:[s.jsx("span",{className:"text-gray-500 text-sm",children:"Data:"}),s.jsx("span",{children:Ie(new Date(a.created_at),"dd/MM/yyyy HH:mm:ss",{locale:me})})]}),a.user&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex justify-between items-center py-2 border-b",children:[s.jsx("span",{className:"text-gray-500 text-sm",children:"Usuário:"}),s.jsx("span",{className:"font-medium",children:a.user.name})]}),s.jsxs("div",{className:"flex justify-between items-center py-2 border-b",children:[s.jsx("span",{className:"text-gray-500 text-sm",children:"Email:"}),s.jsx("span",{className:"text-sm",children:a.user.email})]})]}),a.tags&&s.jsxs("div",{className:"flex justify-between items-center py-2 border-b",children:[s.jsx("span",{className:"text-gray-500 text-sm",children:"Tags:"}),s.jsx("span",{className:"text-sm",children:a.tags})]})]})}),s.jsx(Z,{value:"valores",className:"mt-4 space-y-4",children:(()=>{const r=c&&typeof c=="object"&&Object.keys(c).length>0,le=k&&typeof k=="object"&&Object.keys(k).length>0;return!r&&!le?s.jsxs("div",{className:"text-center py-8 text-gray-500",children:[s.jsx("p",{children:"Nenhum valor registrado para este evento"}),s.jsxs("p",{className:"text-xs mt-2 text-gray-400",children:[a.event==="created"&&"Eventos de criação não possuem valores antigos",a.event==="deleted"&&"Eventos de exclusão podem não possuir valores novos"]})]}):s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"font-semibold mb-2 text-sm text-gray-700",children:"Valores Antigos"}),r?s.jsx("pre",{className:"bg-red-50 border border-red-200 p-4 rounded-lg overflow-auto text-xs max-h-96",children:JSON.stringify(c,null,2)}):s.jsx("div",{className:"bg-gray-50 border border-gray-200 p-4 rounded-lg text-xs text-gray-500 text-center min-h-[100px] flex items-center justify-center",children:"Nenhum valor anterior"})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-semibold mb-2 text-sm text-gray-700",children:"Valores Novos"}),le?s.jsx("pre",{className:"bg-green-50 border border-green-200 p-4 rounded-lg overflow-auto text-xs max-h-96",children:JSON.stringify(k,null,2)}):s.jsx("div",{className:"bg-gray-50 border border-gray-200 p-4 rounded-lg text-xs text-gray-500 text-center min-h-[100px] flex items-center justify-center",children:"Nenhum valor novo"})]})]})})()}),s.jsx(Z,{value:"requisicao",className:"mt-4 space-y-4",children:s.jsxs("div",{className:"space-y-3",children:[a.url&&s.jsxs("div",{className:"py-2 border-b",children:[s.jsx("span",{className:"text-gray-500 text-sm block mb-1",children:"URL:"}),s.jsx("div",{className:"break-all text-sm font-mono bg-gray-50 p-2 rounded",children:a.url})]}),a.ip_address&&s.jsxs("div",{className:"flex justify-between items-center py-2 border-b",children:[s.jsx("span",{className:"text-gray-500 text-sm",children:"IP Address:"}),s.jsx("span",{className:"font-medium font-mono",children:a.ip_address})]}),a.user_agent&&s.jsxs("div",{className:"py-2 border-b",children:[s.jsx("span",{className:"text-gray-500 text-sm block mb-1",children:"User Agent:"}),s.jsx("div",{className:"break-all text-xs font-mono bg-gray-50 p-2 rounded",children:a.user_agent})]}),!a.url&&!a.ip_address&&!a.user_agent&&s.jsx("div",{className:"text-center py-8 text-gray-500",children:s.jsx("p",{children:"Nenhuma informação de requisição disponÃvel"})})]})})]})}),e[6]=R,e[7]=B,e[8]=t.current_page,e[9]=t.data,e[10]=t.last_page,e[11
1]=t.per_page,e[12]=t.total,e[13]=I,e[14]=n,e[15]=i,e[16]=a,e[17]=o,e[18]=G,e[19]=g,e[20]=f,e[21]=b,e[22]=v,e[23]=d,e[24]=m,e[25]=x,e[26]=p,e[27]=y,e[28]=h,e[29]=N,e[30]=S,e[31]=_}else g=e[19],f=e[20],b=e[21],v=e[22],d=e[23],m=e[24],x=e[25],p=e[26],y=e[27],h=e[28],N=e[29],S=e[30],_=e[31];let w;e[61]!==g||e[62]!==y||e[63]!==h||e[64]!==N?(w=s.jsxs(g,{className:y,children:[h,N]}),e[61]=g,e[62]=y,e[63]=h,e[64]=N,e[65]=w):w=e[65];let T;e[66]!==f||e[67]!==w||e[68]!==S||e[69]!==_?(T=s.jsx(f,{open:S,onOpenChange:_,children:w}),e[66]=f,e[67]=w,e[68]=S,e[69]=_,e[70]=T):T=e[70];let C;e[71]!==v||e[72]!==d||e[73]!==m||e[74]!==x||e[75]!==T?(C=s.jsxs("div",{className:v,children:[d,m,x,T]}),e[71]=v,e[72]=d,e[73]=m,e[74]=x,e[75]=T,e[76]=C):C=e[76];let U;return e[77]!==b||e[78]!==p||e[79]!==C?(U=s.jsxs(b,{children:[p,C]}),e[77]=b,e[78]=p,e[79]=C,e[80]=U):U=e[80],U}function Be(l){return s.jsx($,{value:l,children:l.split("\\").pop()},l)}function Re(l){return l.split("\\").pop()||l}function Me(l){if(!l)return null;if(typeof l=="object"&&!Array.isArray(l))return l;if(typeof l=="string")try{return JSON.parse(l)}catch{return null}return null}function He(l){return{created:"Criado",updated:"Atualizado",deleted:"ExcluÃdo",restored:"Restaurado"}[l]||l}function Oe(l){switch(l){case"created":return"default";case"updated":return"secondary";case"deleted":return"destructive";default:return"outline"}}export{Vs as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.