PageSourceSearch

https://app.lexiel.ai/_next/static/chunks/77419-40e6dcf58d6e4bfc.js

js lexiel.ai collected 2026-10-05 13:54:14 UTC 67,767 bytes, 6 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[77419],{7e3:(e,t,a)=>{function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"EUR";if(null==e||""===e)return"-";let a=Number(e);if(isNaN(a))return"-";let[r,n]=Math.abs(a).toFixed(2).split("."),s=r.replace(/\B(?=(\d{3})+(?!\d))/g,".");return`${a<0?"-":""}${s},${n}\u00a0${"EUR"===t?"€":t}`}function n(e){if(null==e)return"-";let[t]=Math.abs(e).toFixed(0).split("."),a=t.replace(/\B(?=(\d{3})+(?!\d))/g,".");return`${e<0?"-":""}${a}`}function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;if(null==e)return"-";let[a,r]=Math.abs(e).toFixed(t).split("."),n=a.replace(/\B(?=(\d{3})+(?!\d))/g,".");return`${e<0?"-":""}${n},${r}`}function i(e){if(null==e)return"-";let t=Number(e);if(isNaN(t))return"-";let[a]=Math.abs(t).toFixed(0).split("."),r=a.replace(/\B(?=(\d{3})+(?!\d))/g,".");return`${t<0?"-":""}${r}\u00a0€`}a.d(t,{BU:()=>N,Ii:()=>S,L5:()=>n,R8:()=>b,SS:()=>r,UH:()=>k,XG:()=>y,Xd:()=>p,YT:()=>s,af:()=>C,eh:()=>h,lE:()=>i,o:()=>x,qw:()=>u,v7:()=>m,z3:()=>w});let l=["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],c=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],o=["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],d=["January","February","March","April","May","June","July","August","September","October","November","December"];function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"es";if(!e)return"-";let a="string"==typeof e?new Date(e):e;return isNaN(a.getTime())?"-":`${a.getDate()} ${("es"===t?l:c)[a.getMonth()]} ${a.getFullYear()}`}function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"es";if(!e)return"-";let a="string"==typeof e?new Date(e):e;if(isNaN(a.getTime()))return"-";let r=String(a.getHours()).padStart(2,"0"),n=String(a.getMinutes()).padStart(2,"0");return`${a.getDate()} ${("es"===t?l:c)[a.getMonth()]}, ${r}:${n}`}function x(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"es";if(!e)return"-";let a="string"==typeof e?new Date(e):e;return isNaN(a.getTime())?"-":"es"===t?`${a.getDate()} de ${o[a.getMonth()]} de ${a.getFullYear()}`:`${a.getDate()} ${d[a.getMonth()]} ${a.getFullYear()}`}function p(e){if(!e)return"-";let t="string"==typeof e?new Date(e):e;return isNaN(t.getTime())?"-":`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function b(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"es";if(!e)return"-";let a="string"==typeof e?new Date(e):e;return isNaN(a.getTime())?"-":`${String(a.getDate()).padStart(2,"0")} ${("es"===t?l:c)[a.getMonth()]}`}function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"es";if(!e)return"-";let a="string"==typeof e?new Date(e):e;return isNaN(a.getTime())?"-":`${String(a.getDate()).padStart(2,"0")} ${("es"===t?l:c)[a.getMonth()]} '${String(a.getFullYear()).slice(2)}`}let g=["domingo","lunes","martes","mi\xe9rcoles","jueves","viernes","s\xe1bado"],f=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],v=["dom","lun","mar","mi\xe9","jue","vie","s\xe1b"],j=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function y(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"es";if(!e)return"-";let a="string"==typeof e?new Date(e):e;return isNaN(a.getTime())?"-":`${("es"===t?l:c)[a.getMonth()]} '${String(a.getFullYear()).slice(2)}`}function N(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"es";if(!e)return"-";let a="string"==typeof e?new Date(e):e;if(isNaN(a.getTime()))return"-";let r="es"===t?o:d;return"es"===t?`${r[a.getMonth()]} de ${a.getFullYear()}`:`${r[a.getMonth()]} ${a.getFullYear()}`}function C(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"es";if(!e)return"-";let a="string"==typeof e?new Date(e):e;if(isNaN(a.getTime()))return"-";let r="es"===t?g[a.getDay()]:f[a.getDay()],n="es"===t?o:d;return"es"===t?`${r}, ${a.getDate()} de ${n[a.getMonth()]} de ${a.getFullYear()}`:`${r}, ${a.getDate()} ${n[a.getMonth()]} ${a.getFullYear()}`}function k(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"es";if(!e)return"-";let a="string"==typeof e?new Date(e):e;if(isNaN(a.getTime()))return"-";let r="es"===t?v[a.getDay()]:j[a.getDay()],n="es"===t?o:d;return"es"===t?`${r}, ${a.getDate()} de ${n[a.getMonth()]} de ${a.getFullYear()}`:`${r}, ${a.getDate()} ${n[a.getMonth()]} ${a.getFullYear()}`}function S(e){if(!e)return"-";let t="string"==typeof e?new Date(e):e;if(isNaN(t.getTime()))return"-";let a=String(t.getDate()).padStart(2,"0"),r=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0");return`${a}/${r} ${n}:${s}`}function w(e){if(0===e)return"0 B";let t=["B","KB","MB","GB"],a=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1);return`${parseFloat((e/Math.pow(1024,a)).toFixed(1))} ${t[a]}`}},24013:(e,t,a)=>{a.d(t,{r:()=>s});var r=a(12115);
1let n='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"]),[contenteditable]';function s(e){let t=(0,r.useRef)(null),a=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!e||!t.current)return;a.current=document.activeElement;let r=t.current.querySelectorAll(n);function s(e){if("Tab"!==e.key||!t.current)return;let a=t.current.querySelectorAll(n);if(0===a.length)return;let r=a[0],s=a[a.length-1];e.shiftKey&&document.activeElement===r?(e.preventDefault(),s.focus()):e.shiftKey||document.activeElement!==s||(e.preventDefault(),r.focus())}return r.length>0&&!t.current.contains(document.activeElement)&&requestAnimationFrame(()=>r[0]?.focus()),document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),a.current?.focus()}},[e]),t}},29913:(e,t,a)=>{a.d(t,{a:()=>m});var r=a(95155),n=a(12115),s=a(90571),i=a(24013);let l=[],c=new Set,o=()=>c.forEach(e=>e()),d=e=>(c.add(e),()=>{c.delete(e)}),u=0;function m(e){let{onClose:t,ref:a,children:c,...m}=e,x=(0,i.r)(!0),p=(0,n.useRef)(Symbol("modal")),b=(0,n.useCallback)(e=>{x.current=e,"function"==typeof a?a(e):a&&(a.current=e)},[x,a]);(0,n.useEffect)(()=>{let e=p.current;return l.push(e),o(),()=>{let t=l.indexOf(e);t>=0&&l.splice(t,1),o()}},[]);let h=(0,n.useSyncExternalStore)(d,()=>l[l.length-1]===p.current,()=>!1);(0,s.f)(h,t,{restoreFocus:!1});let g=void 0!==m["aria-label"]||void 0!==m["aria-labelledby"];return(0,n.useEffect)(()=>{let e=x.current;if(g||!e)return;let t=e.querySelector("h1, h2, h3");t&&(t.id||(t.id=`modal-title-${++u}`),e.setAttribute("aria-labelledby",t.id))},[g,x]),(0,r.jsx)("div",{role:"dialog","aria-modal":"true",...m,ref:b,children:c})}},52863:(e,t,a)=>{a.d(t,{l:()=>r});async function r(e){if(navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let a=document.execCommand("copy");return document.body.removeChild(t),a}catch{return!1}}},77419:(e,t,a)=>{a.r(t),a.d(t,{CriminalRecordsView:()=>er});var r=a(95155),n=a(12115),s=a(52863),i=a(20063),l=a(97214),c=a(53803),o=a(16102),d=a(60161),u=a(99281),m=a(73163),x=a(13801),p=a(90700),b=a(53655),h=a(48753),g=a(70256),f=a(88358),v=a(10619),j=a(65785),y=a(49845),N=a(10730),C=a(78810),k=a(71681),S=a(6088),w=a(37621),$=a(82234),D=a(42228),P=a(7e3);let A={prision:{bar:"bg-red-500 dark:bg-red-600",text:"text-red-700 dark:text-red-400"},multa:{bar:"bg-blue-400 dark:bg-blue-600",text:"text-blue-700 dark:text-blue-400"},inhabilitacion:{bar:"bg-orange-400 dark:bg-orange-600",text:"text-orange-700 dark:text-orange-400"},trabajos_comunidad:{bar:"bg-emerald-400 dark:bg-emerald-600",text:"text-emerald-700 dark:text-emerald-400"},alejamiento:{bar:"bg-purple-500 dark:bg-purple-600",text:"text-purple-700 dark:text-purple-400"},localizacion_permanente:{bar:"bg-gray-400 dark:bg-gray-600",text:"text-gray-700 dark:text-gray-400"},privacion_conducir:{bar:"bg-amber-400 dark:bg-amber-600",text:"text-amber-700 dark:text-amber-400"},privacion_armas:{bar:"bg-rose-400 dark:bg-rose-600",text:"text-rose-700 dark:text-rose-400"}},F={cumpliendo:"opacity-100",cumplida:"opacity-80",suspendida:"opacity-60 bg-elevated",sustituida:"opacity-60",cancelada:"opacity-30",pendiente_cancelacion:"opacity-70"},T={es:{prision:"Prisi\xf3n",multa:"Multa",inhabilitacion:"Inhabilitaci\xf3n",trabajos_comunidad:"TBC",alejamiento:"Alejamiento",localizacion_permanente:"Loc. permanente",privacion_conducir:"Priv. conducir",privacion_armas:"Priv. armas"},en:{prision:"Prison",multa:"Fine",inhabilitacion:"Disqualification",trabajos_comunidad:"Community service",alejamiento:"Restraining order",localizacion_permanente:"Home detention",privacion_conducir:"Driving ban",privacion_armas:"Weapons ban"}},M={sentencia_firme:{symbol:"◆",color:"text-dark"},inicio_cumplimiento:{symbol:"●",color:"text-emerald-600"},fin_cumplimiento:{symbol:"■",color:"text-blue-600"},quebrantamiento:{symbol:"▲",color:"text-red-600"}
1,cancelacion_antecedentes:{symbol:"○",color:"text-emerald-500"},suspension_concedida:{symbol:"⊘",color:"text-amber-600"},suspension_revocada:{symbol:"⊗",color:"text-red-500"},libertad_condicional:{symbol:"◇",color:"text-cyan-600"},indulto:{symbol:"★",color:"text-yellow-500"}};function E(e){return new Date(e).getTime()}function I(e,t){return(0,P.qw)(e,"es"===t?"es":"en")}function z(e){let{records:t,locale:a}=e,[s,i]=(0,n.useState)("year"),[l,c]=(0,n.useState)(null),o="es"===a,{startMs:d,endMs:u,years:m,todayPct:x}=(0,n.useMemo)(()=>{if(0===t.length){let e=Date.now();return{startMs:e-31536e6,endMs:e+31536e6,years:[],todayPct:50}}let e=[];for(let a of t)e.push(E(a.fechaSentencia)),a.fechaInicioCumplimiento&&e.push(E(a.fechaInicioCumplimiento)),a.fechaFinCumplimiento&&e.push(E(a.fechaFinCumplimiento)),a.fechaCancelacion&&e.push(E(a.fechaCancelacion)),a.events?.forEach(t=>e.push(E(t.eventDate)));e.push(Date.now());let a=Math.min(...e),r=Math.max(...e),n=.05*(r-a||31536e6),s=a-n,i=r+n,l=new Date(s).getFullYear(),c=new Date(i).getFullYear(),o=[];for(let e=l;e<=c;e++)o.push(e);let d=(Date.now()-s)/(i-s)*100;return{startMs:s,endMs:i,years:o,todayPct:d}},[t]),p=u-d,b=e=>(e-d)/p*100,h=24+40*t.length+48;return(0,r.jsxs)("div",{className:"bg-card border border-border rounded-xl overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-border",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold text-dark",children:o?"Cronolog\xeda":"Timeline"}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)("button",{type:"button",onClick:()=>i("year"),className:(0,D.A)("px-2 py-1 text-[11px] rounded-md transition-colors","year"===s?"bg-brand/10 text-brand":"text-muted hover:text-dark"),children:o?"A\xf1os":"Years"}),(0,r.jsx)("button",{type:"button",onClick:()=>i("month"),className:(0,D.A)("px-2 py-1 text-[11px] rounded-md transition-colors","month"===s?"bg-brand/10 text-brand":"text-muted hover:text-dark"),children:o?"Meses":"Months"})]})]}),(0,r.jsx)("div",{className:"relative overflow-x-auto",style:{minWidth:"month"===s?`${600*m.length}px`:void 0},children:(0,r.jsxs)("div",{className:"relative",style:{height:h},children:[m.map(e=>{let t=b(E(`${e}-01-01`));return t<0||t>100?null:(0,r.jsxs)("div",{className:"absolute top-0 bottom-0",style:{left:`${t}%`},children:[(0,r.jsx)("div",{className:"absolute top-1 text-[10px] text-muted font-medium px-1",children:e}),(0,r.jsx)("div",{className:"absolute top-5 bottom-0 w-px bg-border/50"})]},e)}),(0,r.jsx)("div",{className:"absolute top-0 bottom-0 w-px bg-brand z-10",style:{left:`${x}%`},children:(0,r.jsx)("div",{className:"absolute -top-0 left-1 text-[9px] font-bold text-brand bg-card px-1 rounded",children:o?"HOY":"TODAY"})}),t.map((e,t)=>{let n,s=A[e.penaType]||A.prision,i=F[e.status]||"",l=(T[a]||T.es)[e.penaType]||e.penaType,d=e.fechaInicioCumplimiento||e.fechaSentencia,u=E(d);n=e.fechaFinCumplimiento?E(e.fechaFinCumplimiento):u+(30*e.penaDurationMonths+e.penaDurationDays)*864e5;let m=b(u),x=b(n)-m,p=0,h=0;e.fechaCancelacion&&e.fechaFinCumplimiento&&(p=b(E(e.fechaFinCumplimiento)),h=b(E(e.fechaCancelacion))-p);let g=e.penaDurationMonths>0?`${e.penaDurationMonths}m${e.penaDurationDays>0?` ${e.penaDurationDays}d`:""}`:`${e.penaDurationDays}d`;return(0,r.jsxs)("div",{className:"absolute left-0 right-0",style:{to
1p:24+40*t},children:[(0,r.jsx)("div",{className:"absolute -left-0 w-0 h-8 flex items-center"}),(0,r.jsx)("div",{role:"button",tabIndex:0,"aria-label":`${e.delito}${e.articuloCP?` (${e.articuloCP})`:""}, ${l} ${g}`,className:(0,D.A)("absolute h-6 rounded-md flex items-center px-1.5 cursor-pointer transition-all hover:brightness-110 focus:outline-none focus:ring-2 focus:ring-white/50",s.bar,i),style:{left:`${Math.max(m,0)}%`,width:`${Math.max(x,.5)}%`,top:4},onMouseEnter:t=>{c({x:t.clientX,y:t.clientY,content:`${e.delito}${e.articuloCP?` (${e.articuloCP})`:""}
2${l} ${g}
3${I(d,a)} → ${e.fechaFinCumplimiento?I(e.fechaFinCumplimiento,a):o?"en curso":"ongoing"}
4${o?"Estado":"Status"}: ${e.status}${e.fechaCancelacion?`
5${o?"Cancelaci\xf3n":"Cancellation"}: ${I(e.fechaCancelacion,a)}`:""}`})},onMouseLeave:()=>c(null),onFocus:t=>{c({x:t.currentTarget.getBoundingClientRect().left,y:t.currentTarget.getBoundingClientRect().top,content:`${e.delito}${e.articuloCP?` (${e.articuloCP})`:""}
6${l} ${g}`})},onBlur:()=>c(null),onKeyDown:e=>{"Escape"===e.key&&c(null)},children:(0,r.jsxs)("span",{className:"text-[10px] text-white font-medium truncate",children:[l," ",g]})}),(0,r.jsx)("div",{className:"absolute text-[10px] text-muted truncate max-w-[140px]",style:{left:`${Math.min(m+x+.5,95)}%`,top:8},children:e.delito}),h>0&&(0,r.jsx)("div",{className:"absolute h-2 rounded-full border border-dashed border-emerald-400 bg-emerald-100/30 dark:bg-emerald-800/20",style:{left:`${p}%`,width:`${h}%`,top:22}}),e.events?.map(e=>{let t=M[e.eventType];if(!t)return null;let n=b(E(e.eventDate));return(0,r.jsx)("div",{className:(0,D.A)("absolute text-xs cursor-pointer z-10",t.color),style:{left:`${n}%`,top:-2},title:`${e.eventType}: ${e.description||""} (${I(e.eventDate,a)})`,children:t.symbol},e.id)})]},e.id)})]})}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3 px-4 py-2 border-t border-border text-[10px] text-muted",children:[Object.entries(A).map(e=>{let[t,{bar:n}]=e;return(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)("div",{className:(0,D.A)("w-3 h-2 rounded-sm",n)}),(0,r.jsx)("span",{children:(T[a]||T.es)[t]})]},t)}),(0,r.jsx)("span",{className:"ml-2",children:"|"}),Object.entries(M).slice(0,5).map(e=>{let[t,{symbol:a,color:n}]=e;return(0,r.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,r.jsx)("span",{className:n,children:a}),(0,r.jsx)("span",{children:t.replace(/_/g," ")})]},t)})]}),l&&(0,r.jsx)("div",{className:"fixed z-50 bg-dark text-white text-[11px] px-3 py-2 rounded-lg shadow-xl max-w-[260px] whitespace-pre-line pointer-events-none",style:{left:l.x+12,top:l.y-8},children:l.content})]})}var R=a(39236),_=a(69185),L=a(9558);function q(e){let{status:t,locale:a}=e,n="es"===a;return(0,r.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[(0,r.jsxs)("div",{className:`rounded-xl border p-4 ${t.hasActiveAntecedentes?"border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-900/20":"border-emerald-200 bg-emerald-50 dark:border-emerald-800 dark:bg-emerald-900/20"}`,children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[t.hasActiveAntecedentes?(0,r.jsx)(l.A,{size:16,className:"text-red-600 dark:text-red-400"}):(0,r.jsx)(R.A,{size:16,className:"text-emerald-600 dark:text-emerald-400"}),(0,r.jsx)("span",{className:"text-xs font-medium text-muted",children:n?"Antecedentes":"Records"})]}),(0,r.jsx)("p",{className:`text-xl font-bold ${t.hasActiveAntecedentes?"text-red-700 dark:text-red-400":"text-emerald-700 dark:text-emerald-400"}`,children:t.activeCount>0?t.activeCount:n?"Limpio":"Clean"}),(0,r.jsx)("p",{className:"text-[11px] text-muted mt-0.5",children:t.canceladoCount>0&&`${t.canceladoCount} ${n?"cancelados":"cancelled"}`})]}),(0,r.jsxs)("div",{className:`rounded-xl border p-4 ${t.reincidenciaWindows.length>0?"border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-900/20":"border-border bg-card"}`,children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,r.jsx)(b.A,{size:16,className:t.reincidenciaWindows.length>
60?"text-amber-600 dark:text-amber-400":"text-muted"}),(0,r.jsx)("span",{className:"text-xs font-medium text-muted",children:n?"Reincidencia":"Recidivism"})]}),(0,r.jsx)("p",{className:"text-xl font-bold text-dark",children:t.reincidenciaWindows.length>0?`${t.reincidenciaWindows.length} ${n?"t\xedtulos":"titles"}`:n?"No aplica":"N/A"}),t.reincidenciaWindows.length>0&&(0,r.jsx)("p",{className:"text-[11px] text-muted mt-0.5",children:"Art. 22.8 CP"})]}),(0,r.jsxs)("div",{className:`rounded-xl border p-4 ${t.activeRestrictions.length>0?"border-purple-200 bg-purple-50 dark:border-purple-800 dark:bg-purple-900/20":"border-border bg-card"}`,children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,r.jsx)(_.A,{size:16,className:t.activeRestrictions.length>0?"text-purple-600 dark:text-purple-400":"text-muted"}),(0,r.jsx)("span",{className:"text-xs font-medium text-muted",children:n?"Restricciones":"Restrictions"})]}),(0,r.jsx)("p",{className:"text-xl font-bold text-dark",children:t.activeRestrictions.length>0?t.activeRestrictions.length:n?"Ninguna":"None"}),t.activeRestrictions.length>0&&(0,r.jsx)("p",{className:"text-[11px] text-muted mt-0.5 truncate",children:t.activeRestrictions.map(e=>e.type.replace(/_/g," ")).join(", ")})]}),(0,r.jsxs)("div",{className:"rounded-xl border border-border bg-card p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,r.jsx)(L.A,{size:16,className:"text-muted"}),(0,r.jsx)("span",{className:"text-xs font-medium text-muted",children:n?"Pr\xf3xima cancelaci\xf3n":"Next cancellation"})]}),t.nextCancelacion?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-xl font-bold text-dark",children:(0,P.qw)(new Date(t.nextCancelacion.date),a)}),(0,r.jsx)("p",{className:"text-[11px] text-muted mt-0.5 truncate",children:t.nextCancelacion.delito})]}):(0,r.jsx)("p",{className:"text-xl font-bold text-muted",children:"\xb7"})]})]})}var B=a(80460),Y=a(73424),G=a(29913);let H=[{value:"prision",label:{es:"Prisi\xf3n",en:"Prison"}},{value:"multa",label:{es:"Multa",en:"Fine"}},{value:"inhabilitacion",label:{es:"Inhabilitaci\xf3n",en:"Disqualification"}},{value:"trabajos_comunidad",label:{es:"Trabajos en beneficio de la comunidad",en:"Community service"}},{value:"alejamiento",label:{es:"Orden de alejamiento",en:"Restraining order"}},{value:"localizacion_permanente",label:{es:"Localizaci\xf3n permanente",en:"Home detention"}},{value:"privacion_conducir",label:{es:"Privaci\xf3n del derecho a conducir",en:"Driving ban"}},{value:"privacion_armas",label:{es:"Privaci\xf3n del derecho a tenencia de armas",en:"Weapons ban"}}],O=[{value:"cumpliendo",label:{es:"Cumpliendo",en:"Serving"}},{value:"cumplida",label:{es:"Cumplida",en:"Served"}},{value:"suspendida",label:{es:"Suspendida",en:"Suspended"}},{value:"sustituida",label:{es:"Sustituida",en:"Substituted"}},{value:"pendiente_cancelacion",label:{es:"Pendiente cancelaci\xf3n",en:"Pending cancellation"}},{value:"cancelada",label:{es:"Cancelada",en:"Cancelled"}}],W="w-full px-3 py-2 text-sm bg-surface border border-border rounded-lg focus:ring-2 focus:ring-brand/30 focus:border-brand outline-none text-dark",V="block text-xs font-medium text-muted mb-1";function X(e){let{clientId:t,caseId:a,existingRecord:s,locale:i,onSave:l,onClose:c}=e,o="es"===i,d=!!s,[u,m]=(0,n.useState)({delito:s?.delito||"",articuloCP:s?.articuloCP||"",tituloCP:s?.tituloCP||"",fechaHechos:s?.fechaHechos||"",fechaSentencia:s?.fechaSentencia||"",tribunal:s?.tribunal||"",numProcedimiento:s?.numProcedimiento||"",penaType:s?.penaType||"prision",penaDurationMonths:s?.penaDurationMonths||0,penaDurationDays:s?.penaDurationDays||0,fechaInicioCumplimiento:s?.fechaInicioCumplimiento||"",fechaFinCumplimiento:s?.fechaFinCumplimiento||"",status:s?.status||"cumpliendo",notes:s?.notes||""}),[x,p]=(0,n.useState)(!1),[b,h]=(0,n.useState)(null);function g(e,t){m(a=>({...a,[e]:t}))}async function f(e){e.preventDefault(),p(!0);try{let e={...u,clientId:t,caseId:a||void 0,penaDurationMonths:Number(u.penaDurationMonths),penaDurationDays:Number(u.penaDurationDays),fechaHechos:u.fechaHechos||void 0,fechaInicioCumplimiento:u.fechaInicioCumplimiento||void 0,fechaFinCumplimiento:u.fechaFinCumplimiento||void 0,articuloCP:u.articuloCP||void 0,tituloCP:u.tituloCP||void 0,tribunal:u.tribunal||void 0,numProcedimiento:u.numProcedimiento||void 0,notes:u.notes||void 0};d&&s?await w.api.patch(`/v1/criminal-records/${s.id}`,e):await w.api.post("/v1/criminal-records",e),l()}catch{}finally{p(!1)}}return(0,n.useEffect)(()=>
6{if(!u.fechaFinCumplimiento||!u.penaType)return void h(null);let e=u.penaDurationMonths+Math.floor(u.penaDurationDays/30),t=function(e,t){switch(e){case"localizacion_permanente":case"multa":return t<=2?.5:2;case"trabajos_comunidad":return 2;case"privacion_conducir":case"privacion_armas":case"alejamiento":case"prision":if(t<=12)return 2;if(t<=36)return 3;return 5;case"inhabilitacion":return t>=60?10:3;default:return 3}}(u.penaType,e),a=new Date(u.fechaFinCumplimiento),r=Math.floor(t),n=Math.round((t-r)*12);a.setFullYear(a.getFullYear()+r),a.setMonth(a.getMonth()+n),h(a.toISOString().split("T")[0])},[u.fechaFinCumplimiento,u.penaType,u.penaDurationMonths,u.penaDurationDays]),(0,r.jsx)(G.a,{onClose:()=>c(),className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:c,children:(0,r.jsxs)("div",{className:"bg-card border border-border rounded-2xl shadow-2xl w-full max-w-2xl max-h-[90vh] overflow-y-auto",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[(0,r.jsx)("h2",{className:"text-base font-semibold text-dark",children:d?o?"Editar antecedente":"Edit record":o?"Nuevo antecedente penal":"New criminal record"}),(0,r.jsx)("button",{type:"button","aria-label":o?"Cerrar":"Close",onClick:c,className:"text-muted hover:text-dark",children:(0,r.jsx)(B.A,{size:18})})]}),(0,r.jsxs)("form",{onSubmit:f,className:"px-6 py-4 space-y-4",children:[(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"crf-delito",className:V,children:o?"Delito *":"Crime *"}),(0,r.jsx)("input",{id:"crf-delito",className:W,value:u.delito,onChange:e=>g("delito",e.target.value),placeholder:o?"Ej: Hurto, Lesiones, Estafa...":"e.g. Theft, Assault...",required:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"crf-articuloCP",className:V,children:o?"Art\xedculo CP":"CP Article"}),(0,r.jsx)("input",{id:"crf-articuloCP",className:W,value:u.articuloCP,onChange:e=>g("articuloCP",e.target.value),placeholder:"Art. 234 CP"})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"crf-tituloCP",className:V,children:o?"T\xedtulo CP (para reincidencia)":"CP Title (for recidivism)"}),(0,r.jsx)("input",{id:"crf-tituloCP",className:W,value:u.tituloCP,onChange:e=>g("tituloCP",e.target.value),placeholder:o?"T\xedtulo XIII - Delitos contra el patrimonio":"Title XIII"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"crf-tribunal",className:V,children:o?"Tribunal":"Court"}),(0,r.jsx)("input",{id:"crf-tribunal",className:W,value:u.tribunal,onChange:e=>g("tribunal",e.target.value),placeholder:o?"Tribunal de Instancia de lo Penal n\xba 3 de Madrid":"Criminal Court"})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"crf-fechaHechos",className:V,children:o?"Fecha hechos":"Offense date"}),(0,r.jsx)("input",{id:"crf-fechaHechos",type:"date",className:W,value:u.fechaHechos,onChange:e=>g("fechaHechos",e.target.value)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"crf-fechaSentencia",className:V,children:o?"Sentencia firme *":"Final sentence *"}),(0,r.jsx)("input",{id:"crf-fechaSentencia",type:"date",className:W,value:u.fechaSentencia,onChange:e=>g("fechaSentencia",e.target.value),required:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"crf-numProcedimiento",className:V,children:o?"N\xba Procedimiento":"Case number"}),(0,r.jsx)("input",{id:"crf-numProcedimiento",className:W,value:u.numProcedimiento,onChange:e=>g("numProcedimiento",e.target.value)})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"crf-penaType",className:V,children:o?"Tipo de pena *":"Penalty type *"}),(0,r.jsx)("select",{id:"crf-penaType",className:W,value:u.penaType,onChange:e=>g("penaType",e.target.value),children:H.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label[o?"es":"en"]},e.value))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"crf-penaDurationMonths",className:V,children:o?"Duraci\xf3n (meses)":"Duration (months)"}),(0,r.jsx)("input",{id:"crf-penaDurationMonths",inputMode:"decimal",type:"number",min:0,className:W,value:u.penaDurationMonths,onChange:e=>g("penaDurationMonths",Number(e.target.value))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"crf-penaDurationDays",className:V,children:o?"D\xedas adicionales":"Extra days"}),(0,r.jsx)("input",{id:"crf-penaDurationDays",inputMode:"decimal",type:"number",min:0,className:W,value:u.penaDurationDays,onChange:e=>g("penaDurationDays",Number(e.target.value))})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"crf-fechaInicioCumplimiento",className:V,children:o?"Inicio cumplimiento":"Start serving"}),(0,r.jsx)("input",{id:"crf-fechaInicioCumplimiento",type:"date",className:W,value:u.fechaInicioCumplimiento,onChange:e=>g("fechaInicioCumplimiento",e.target.value)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"crf-fechaFinCumplimiento",className:V,children:o?"Fin cumplimiento":"End serving"}),(0,r.jsx)("input",{id:"crf-fechaFinCumplimiento",type:"date",className:W,value:u.fechaFinCumplimiento,onChange:e=>g("fechaFinCumplimiento",e.target.value)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"crf-status",className:V,children:o?"Estado":"Status"}),(0,r.jsx)("select",{id:"crf-status",className:W,value:u.status,onChange:e=>g("status",e.target.value),children:O.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label[o?"es":"en"]},e.value))})]})]}),b&&(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-emerald-50 dark:bg-emerald-900/20 border border-emerald-200 dark:border-emerald-800 rounded-lg",children:[(0,r.jsx)(Y.A,{size:14,className:"text-emerald-600 dark:text-emerald-400"}),(0,r.jsxs)("span",{className:"text-xs text-emerald-700 dark:text-emerald-400",children:[o?"Fecha de cancelaci\xf3n estimada (Art. 136 CP):":"Estimated cancellation date (Art. 136 CP):"," ",(0,r.jsx)("strong",{children:(0,P.o)(new Date(b),o?"es":"en")})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"crf-notes",className:V,children:o?"Notas":"Notes"}),(0,r.jsx)("textarea",{id:"crf-notes",className:`${W}
6 min-h-[60px]`,value:u.notes,onChange:e=>g("notes",e.target.value),rows:2})]}),(0,r.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,r.jsx)("button",{type:"button",onClick:c,className:"px-4 py-2 text-sm text-muted border border-border rounded-lg hover:bg-surface-hover",children:o?"Cancelar":"Cancel"}),(0,r.jsx)("button",{type:"submit",disabled:x||!u.delito||!u.fechaSentencia,className:"px-4 py-2 text-sm text-white bg-brand rounded-lg hover:bg-brand/90 disabled:opacity-50",children:x?"...":d?o?"Guardar cambios":"Save changes":o?"Crear antecedente":"Create record"})]})]})]})})}var U=a(96913);let J=[{value:"sentencia_firme",label:{es:"Sentencia firme",en:"Final sentence"}},{value:"inicio_cumplimiento",label:{es:"Inicio cumplimiento",en:"Start serving"}},{value:"fin_cumplimiento",label:{es:"Fin cumplimiento",en:"End serving"}},{value:"suspension_concedida",label:{es:"Suspensi\xf3n concedida",en:"Suspension granted"}},{value:"suspension_revocada",label:{es:"Suspensi\xf3n revocada",en:"Suspension revoked"}},{value:"sustitucion",label:{es:"Sustituci\xf3n de pena",en:"Penalty substitution"}},{value:"quebrantamiento",label:{es:"Quebrantamiento de condena",en:"Breach of sentence"}},{value:"cancelacion_antecedentes",label:{es:"Cancelaci\xf3n de antecedentes",en:"Record cancellation"}},{value:"libertad_condicional",label:{es:"Libertad condicional",en:"Parole"}},{value:"indulto",label:{es:"Indulto",en:"Pardon"}},{value:"nota",label:{es:"Nota",en:"Note"}}],K="w-full px-3 py-2 text-sm bg-surface border border-border rounded-lg focus:ring-2 focus:ring-brand/30 focus:border-brand outline-none text-dark",Q="block text-xs font-medium text-muted mb-1",Z={alto:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400 border-red-200 dark:border-red-800",medio:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400 border-amber-200 dark:border-amber-800",bajo:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400 border-blue-200 dark:border-blue-800"};function ee(e){let{recordId:t,recordStatus:a,recordPenaType:s,locale:i,onSave:l,onClose:c}
6=e,o="es"===i,[d,u]=(0,n.useState)("nota"),[m,x]=(0,n.useState)(""),[p,h]=(0,n.useState)(""),[g,f]=(0,n.useState)(!1),[v,j]=(0,n.useState)(!1),[y,N]=(0,n.useState)(null);async function C(e){e.preventDefault(),j(!0);try{await w.api.post(`/v1/criminal-records/${t}/events`,{eventType:d,eventDate:m,description:p||void 0,metadata:"quebrantamiento"===d?{isNewCrime:g}:void 0}),l()}catch{}finally{j(!1)}}(0,n.useEffect)(()=>{if("quebrantamiento"!==d||!a)return void N(null);w.api.post(`/v1/criminal-records/${t}/analyze-quebrantamiento`,{isNewCrime:g}).then(e=>N(e.analysis)).catch(()=>N(null))},[d,g,t,a]);let k="quebrantamiento"===d;return(0,r.jsx)(G.a,{onClose:()=>c(),className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:c,children:(0,r.jsxs)("div",{className:"bg-card border border-border rounded-2xl shadow-2xl w-full max-w-lg max-h-[90vh] overflow-y-auto",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[(0,r.jsx)("h2",{className:"text-base font-semibold text-dark",children:o?"A\xf1adir evento":"Add event"}),(0,r.jsx)("button",{type:"button","aria-label":o?"Cerrar":"Close",onClick:c,className:"text-muted hover:text-dark",children:(0,r.jsx)(B.A,{size:18})})]}),(0,r.jsxs)("form",{onSubmit:C,className:"px-6 py-4 space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cef-event-type",className:Q,children:o?"Tipo de evento *":"Event type *"}),(0,r.jsx)("select",{id:"cef-event-type",className:K,value:d,onChange:e=>u(e.target.value),children:J.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label[o?"es":"en"]},e.value))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cef-event-date",className:Q,children:o?"Fecha *":"Date *"}),(0,r.jsx)("input",{id:"cef-event-date",type:"date",className:K,value:m,onChange:e=>x(e.target.value),required:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cef-description",className:Q,children:o?"Descripci\xf3n":"Description"}),(0,r.jsx)("textarea",{id:"cef-description",className:`${K} min-h-[60px]`,value:p,onChange:e=>h(e.target.value),rows:2,placeholder:o?"Detalles del evento...":"Event details..."})]}),k&&(0,r.jsxs)("div",{className:"space-y-3",children:[("suspendida"===a||"sustituida"===a)&&(0,r.jsxs)("label",{className:"flex items-center gap-2 px-3 py-2.5 bg-surface border border-border rounded-lg cursor-pointer hover:bg-surface-hover transition-colors",children:[(0,r.jsx)("input",{type:"checkbox",checked:g,onChange:e=>f(e.target.checked),className:"rounded border-border text-brand focus:ring-brand"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-sm font-medium text-dark",children:o?"\xbfHay condena por nuevo delito?":"Is there a conviction for a new crime?"}),(0,r.jsx)("p",{className:"text-[11px] text-muted mt-0.5",children:o?"Art. 86.1 CP: la condena por nuevo delito implica revocaci\xf3n OBLIGATORIA. Sin condena, la revocaci\xf3n es FACULTATIVA (Art. 86.2).":"Art. 86.1 CP: conviction = mandatory revocation. No conviction = discretionary revocation (Art. 86.2)."})]})]}),y&&(0,r.jsxs)("div",{className:`rounded-lg border p-3 space-y-2 ${Z[y.riskLevel]}`,children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(b.A,{size:14}),(0,r.jsxs)("span",{className:"text-xs font-bold uppercase",children:[o?`Riesgo ${y.riskLevel}`:`${y.riskLevel} risk`,"none"!==y.revocationType&&`: ${o?"Revocaci\xf3n":"Revocation"} ${y.revocationType}`]})]}),(0,r.jsx)("p",{className:"text-xs leading-relaxed",children:y.explanation}),(0,r.jsxs)("div",{className:"text-xs",children:[(0,r.jsx)("span",{className:"font-semibold",children:o?"Nuevo cargo: ":"New charge: "}),y.newChargeDescription,(0,r.jsx)("br",{}),(0,r.jsx)("span",{className:"font-semibold",children:o?"Pena: ":"Penalty: "}),y.penaltyRange]}),y.originalPenaResidual&&(0,r.jsxs)("div",{className:"text-xs",children:[(0,r.jsx)("span",{className:"font-semibold",children:o?"Pena original pendiente: ":"Remaining original sentence: "}),y.originalPenaResidual]}),(0,r.jsxs)("div",{className:"text-[10px] opacity-80",children:[(0,r.jsx)("span",{className:"font-semibold",children:o?"Base legal: ":"Legal basis: "}
6),y.legalBasis.join(", ")]}),y.strategicNotes.length>0&&(0,r.jsxs)("div",{className:"mt-2 pt-2 border-t border-current/20",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1 text-[10px] font-bold uppercase mb-1",children:[(0,r.jsx)(U.A,{size:10}),o?"Notas estrat\xe9gicas para la defensa":"Defense strategy notes"]}),(0,r.jsx)("ul",{className:"text-[11px] space-y-1 list-disc list-inside opacity-90",children:y.strategicNotes.map((e,t)=>(0,r.jsx)("li",{children:e},t))})]})]}),!y&&(0,r.jsx)("div",{className:"px-3 py-2 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg text-xs text-red-700 dark:text-red-400",children:o?"Art. 468 CP: El quebrantamiento genera un nuevo delito y puede revocar la suspensi\xf3n o sustituci\xf3n de la pena original.":"Art. 468 CP: Breach generates a new offense and may revoke suspension or substitution of the original sentence."})]}),(0,r.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,r.jsx)("button",{type:"button",onClick:c,className:"px-4 py-2 text-sm text-muted border border-border rounded-lg hover:bg-surface-hover",children:o?"Cancelar":"Cancel"}),(0,r.jsx)("button",{type:"submit",disabled:v||!m,className:"px-4 py-2 text-sm text-white bg-brand rounded-lg hover:bg-brand/90 disabled:opacity-50",children:v?"...":o?"A\xf1adir evento":"Add event"})]})]})]})})}var et=a(43850);let ea={cumpliendo:"bg-red-100 text-red-700 dark:bg-red-500/20 dark:text-red-400",cumplida:"bg-blue-100 text-blue-700 dark:bg-blue-500/20 dark:text-blue-400",suspendida:"bg-amber-100 text-amber-700 dark:bg-amber-500/20 dark:text-amber-400",sustituida:"bg-orange-100 text-orange-700 dark:bg-orange-500/20 dark:text-orange-400",cancelada:"bg-emerald-100 text-emerald-700 dark:bg-emerald-500/20 dark:text-emerald-400",pendiente_cancelacion:"bg-cyan-100 text-cyan-700 dark:bg-cyan-500/20 dark:text-cyan-400"};function er(e){let{caseId:t,preselectedClientId:D}=e,P=(0,i.useParams)(),A=P?.locale||"es",F="es"===A,{toast:T}=(0,$.d)(),[M,E]=(0,n.useState)([]),[I,R]=(0,n.useState)(null),[_,L]=(0,n.useState)([]),[B,Y]=(0,n.useState)(D||""),[H,O]=(0,n.useState)(!0),[W,V]=(0,n.useState)(!1),[U,J]=(0,n.use
6State)(null),[K,Q]=(0,n.useState)(null),[Z,er]=(0,n.useState)(null),[en,es]=(0,n.useState)(!1),[ei,el]=(0,n.useState)(null),[ec,eo]=(0,n.useState)(!1),[ed,eu]=(0,n.useState)(null),[em,ex]=(0,n.useState)(!1),[ep,eb]=(0,n.useState)(null),[eh,eg]=(0,n.useState)(null),[ef,ev]=(0,n.useState)([]),[ej,ey]=(0,n.useState)({}),[eN,eC]=(0,n.useState)(!1),[ek,eS]=(0,n.useState)(null),[ew,e$]=(0,n.useState)(!1),[eD,eP]=(0,n.useState)({}),[eA,eF]=(0,n.useState)({});(0,n.useEffect)(()=>{D||w.api.get("/v1/clients?limit=100").then(e=>L(e.clients)).catch(()=>T(F?"Error al cargar clientes":"Failed to load clients","error"))},[D]);let eT=(0,n.useCallback)(async()=>{if(!B&&!t)return void O(!1);O(!0);try{let e=new URLSearchParams;B&&e.set("clientId",B),t&&e.set("caseId",t);let a=await w.api.get(`/v1/criminal-records?${e}`),r=await Promise.all(a.records.map(async e=>{try{let t=await w.api.get(`/v1/criminal-records/${e.id}`);return{...e,events:t.events}}catch{return e}}));E(r);let n=B||r[0]?.clientId;if(n){let e=await w.api.get(`/v1/criminal-records/client/${n}/status`);R(e.status)}}catch{E([]),T(F?"Error al cargar antecedentes":"Error loading criminal records","error")}finally{O(!1)}},[B,t,F,T]);function eM(){V(!1),J(null),Q(null),eT()}async function eE(e){if(confirm(F?"\xbfEliminar este antecedente?":"Delete this record?"))try{await w.api.delete(`/v1/criminal-records/${e}`),eT()}catch{T(F?"Error al eliminar el antecedente":"Error deleting record","error")}}async function eI(e){es(!0);try{let t=new FormData;t.append("file",e);let a=await w.api.postFormData("/v1/criminal-records/import-hoja",t);el(a.records)}catch{T(F?"Error al procesar el documento":"Failed to process document","error")}finally{es(!1)}}async function ez(){if(!ei)return;let e=B||D||"",a=0;for(let r of ei)try{await w.api.post("/v1/criminal-records",{...r,clientId:e,caseId:t})}catch{a++}a>0&&T(F?`${a} registro(s) no se pudieron importar`:`${a} record(s) could not be imported`,"error"),el(null),eT()}async function eR(e){if(!eD[e]){eP(t=>({...t,[e]:!0}));try{let t=await w.api.post(`/v1/criminal-records/${e}/solicitud-cancelacion`,{});eb(t.escrito)}catch{T(F?"Este antecedente a\xfan no es elegible para cancelaci\xf3n":"This record is not yet eligible for cancellation","warning")}finally{eP(t=>({...t,[e]:!1}))}}}async function e_(e){e.preventDefault();let t=B||D||"";if(!t)return;ex(!0);let a=new FormData(e.currentTarget);try{let e=await w.api.post(`/v1/criminal-records/client/${t}/simulate`,{delito:a.get("delito"),tituloCP:a.get("tituloCP")||void 0,penaType:a.get("penaType"),penaDurationMonths:Number(a.get("penaDurationMonths")||0),penaDurationDays:Number(a.get("penaDurationDays")||0)});eu(e)}catch{T(F?"Error en la simulaci\xf3n":"Simulation failed","error")}finally{ex(!1)}}function eL(e){let t=B||D||"";if(!t)return;let r=w.api.getToken();fetch(`${et.API_URL}/v1/criminal-records/client/${t}/export/${e}`,{headers:r?{Authorization:`Bearer ${r}`}:{}}).then(async e=>{if(!e.ok)throw Error(`${e.status}`);return e.blob()}).then(async t=>{let{downloadBlob:r}=await a.e(14827).then(a.bind(a,14827));r(t,`antecedentes-${new Date().toISOString().slice(0,10)}.${e}`)}).catch(()=>T(F?"Error al exportar el documento":"Failed to export document","error"))}async function eq(e){if(ej[e])return;let[t,a]=await Promise.all([w.api.get(`/v1/criminal-records/${e}/prescripcion`).catch(()=>null),w.api.get(`/v1/criminal-records/${e}/libertad-condicional`).catch(()=>null)]);ey(r=>({...r,[e]:{prescripcion:t?.prescripcion,libertadCondicional:a?.libertadCondicional}}))}async function eB(e){if(!eA[e]){eF(t=>({...t,[e]:!0}));try{let t=await w.api.post(`/v1/criminal-records/${e}/sync-to-calendar`,{});T(F?`${t.created} plazos creados en el calendario`:`${t.created} deadlines created in calendar`,"success")}catch{T(F?"No hay condiciones pendientes para sincronizar":"No pending conditions to sync","warning")}finally{eF(t=>({...t,[e]:!1}))}}}async function eY(e){eC(!0);try{let t=new FormData;t.append("file",e);let a=await w.api.postFormData("/v1/criminal-records/import-csv",t);eS(a.records)}catch{T(F?"Error al procesar el CSV":"Failed to process CSV","error")}finally{eC(!1)}}
6async function eG(){if(!ek)return;let e=B||D||"",a=0;for(let r of ek)try{await w.api.post("/v1/criminal-records",{...r,clientId:e,caseId:t})}catch{a++}a>0&&T(F?`${a} registro(s) CSV no se pudieron importar`:`${a} CSV record(s) could not be imported`,"error"),eS(null),eT()}return(0,n.useEffect)(()=>{eT()},[eT]),(0,n.useEffect)(()=>{w.api.get("/v1/criminal-records/stats").then(e=>eg(e.stats)).catch(e=>console.debug("[noncritical]",e)),w.api.get("/v1/criminal-records/conditions-alerts").then(e=>ev(e.alerts)).catch(e=>console.debug("[noncritical]",e))},[M.length]),ew&&(()=>{let e=new Map,t=[];for(let a of M)if(a.sentenciaGroupId){let t=e.get(a.sentenciaGroupId)||[];t.push(a),e.set(a.sentenciaGroupId,t)}else t.push(a);return Array.from(e.entries())})(),(0,r.jsxs)("div",{className:"p-6 space-y-6 max-w-6xl",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("h1",{className:"text-xl font-bold font-[family-name:var(--font-heading)] text-dark flex items-center gap-2",children:[(0,r.jsx)(l.A,{size:20,className:"text-brand"}),F?"Antecedentes Penales":"Criminal Records"]}),(0,r.jsx)("p",{className:"text-xs text-muted mt-1",children:F?"Timeline cronol\xf3gico con c\xe1lculo autom\xe1tico de cancelaci\xf3n (Art. 136 CP)":"Chronological timeline with automatic cancellation calculation (Art. 136 CP)"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(B||D)&&M.length>0&&(0,r.jsxs)("button",{type:"button",onClick:()=>eo(!ec),className:`flex items-center gap-1.5 px-3 py-2 text-sm border rounded-lg transition-colors ${ec?"border-brand text-brand bg-brand/5":"border-border text-muted hover:bg-surface-hover"}`,children:[(0,r.jsx)(c.A,{size:14}),F?"Simulador":"Simulator"]}),(0,r.jsxs)("label",{className:`flex items-center gap-1.5 px-3 py-2 text-sm border border-border rounded-lg cursor-pointer hover:bg-surface-hover transition-colors ${!B&&!D||en?"opacity-50 pointer-events-none":"text-dark"}`,children:[en?(0,r.jsx)(o.A,{size:14,className:"animate-spin"}):(0,r.jsx)(d.A,{size:14}),F?"Importar hoja":"Import sheet",(0,r.jsx)("input",{type:"file",accept:".pdf,image/*",className:"hidden",onChange:e=>{let t=e.target.files?.[0];t&&eI(t),e.target.value=""}})]}),(0,r.jsxs)("label",{className:`flex items-center gap-1.5 px-3 py-2 text-sm border border-border rounded-lg cursor-pointer hover:bg-surface-hover transition-colors ${!B&&!D||eN?"opacity-50 pointer-events-none":"text-dark"}`,children:[eN?(0,r.jsx)(o.A,{size:14,className:"animate-spin"}):(0,r.jsx)(u.A,{size:14}),"CSV",(0,r.jsx)("input",{type:"file",accept:".csv,.tsv,.txt",className:"hidden",onChange:e=>{let t=e.target.files?.[0];t&&eY(t),e.target.value=""}})]}),M.length>1&&(0,r.jsx)("button",{type:"button",onClick:()=>e$(!ew),className:`flex items-center gap-1.5 px-3 py-2 text-sm border rounded-lg transition-colors ${ew?"border-brand text-brand bg-brand/5":"border-border text-muted hover:bg-surface-hover"}`,title:F?"Agrupar por sentencia":"Group by sentence","aria-label":F?"Agrupar por sentencia":"Group by sentence",children:(0,r.jsx)(m.A,{size:14})}),(B||D)&&M.length>0&&(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>eL("pdf"),className:"flex items-center gap-1 px-2.5 py-2 text-sm text-muted border border-border rounded-l-lg hover:bg-surface-hover",title:"PDF",children:[(0,r.jsx)(x.A,{size:14})," PDF"]}),(0,r.jsx)("button",{type:"button",onClick:()=>eL("docx"),className:"flex items-center gap-1 px-2.5 py-2 text-sm text-muted border border-l-0 border-border rounded-r-lg hover:bg-surface-hover",title:"DOCX",children:"DOCX"})]}),(0,r.jsxs)("button",{type:"button",onClick:()=>{J(null),V(!0)},disabled:!B&&!D,className:"flex items-center gap-1.5 px-3 py-2 text-sm text-white bg-brand rounded-lg hover:bg-brand/90 disabled:opacity-50",children:[(0,r.jsx)(p.A,{size:14}),F?"Nuevo antecedente":"New record"]})]})]}),!D&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cr-select-client",className:"block text-xs font-medium text-muted mb-1",children:F?"Seleccionar cliente":"Select client"}),(0,r.jsxs)("select",{id:"cr-select-client",className:"w-full max-w-xs px-3 py-2 text-sm bg-surface border border-border rounded-lg text-dark",value:
6B,onChange:e=>Y(e.target.value),children:[(0,r.jsx)("option",{value:"",children:F?"\xb7 Elegir cliente \xb7":"\xb7 Choose client \xb7"}),_.map(e=>(0,r.jsxs)("option",{value:e.id,children:[e.firstName," ",e.lastName||""]},e.id))]})]}),H&&(0,r.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,r.jsx)(o.A,{size:20,className:"text-brand animate-spin"})}),!H&&(B||t)&&(0,r.jsxs)(r.Fragment,{children:[I&&(0,r.jsx)(q,{status:I,locale:A}),ef.length>0&&(0,r.jsx)("div",{className:"space-y-1.5",children:ef.map((e,t)=>(0,r.jsxs)("div",{className:`flex items-center gap-2.5 px-3 py-2 border rounded-lg text-xs ${"critical"===e.severity?"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800 text-red-800 dark:text-red-300":"bg-amber-50 dark:bg-amber-900/20 border-amber-200 dark:border-amber-800 text-amber-800 dark:text-amber-300"}`,children:[(0,r.jsx)(b.A,{size:13,className:"shrink-0"}),(0,r.jsxs)("span",{className:"flex-1",children:[(0,r.jsx)("span",{className:"font-semibold",children:e.delito}),(0,r.jsxs)("span",{className:"opacity-75",children:[": ",e.condicionDescripcion]}),(0,r.jsxs)("span",{className:"opacity-60 ml-1",children:["(",e.daysRemaining,"d ",F?"restantes":"remaining",", ",F?"l\xedmite":"due",": ",e.fechaLimite,")"]})]})]},t))}),eh&&!D&&(0,r.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[(0,r.jsxs)("div",{className:"bg-card border border-border rounded-xl px-4 py-3",children:[(0,r.jsx)("div",{className:"text-[11px] text-muted",children:F?"Total registros":"Total records"}),(0,r.jsx)("div",{className:"text-lg font-bold text-dark",children:String(eh.totalRecords??0)})]}),(0,r.jsxs)("div",{className:"bg-card border border-border rounded-xl px-4 py-3",children:[(0,r.jsx)("div",{className:"text-[11px] text-muted",children:F?"Clientes":"Clients"}),(0,r.jsx)("div",{className:"text-lg font-bold text-dark",children:String(eh.uniqueClients??0)})]}),(0,r.jsxs)("div",{className:"bg-card border border-border rounded-xl px-4 py-3",children:[(0,r.jsx)("div",{className:"text-[11px] text-muted",children:F?"Activos":"Active"}),(0,r.jsx)("div",{className:"text-lg font-bold text-red-600 dark:text-red-400",children:String(eh.activeRecords??0)})]}),(0,r.jsxs)("div",{className:"bg-card border border-border rounded-xl px-4 py-3",children:[(0,r.jsx)("div",{className:"text-[11px] text-muted",children:F?"Cancelaciones logradas":"Cancellations achieved"}),(0,r.jsx)("div",{className:"text-lg font-bold text-emerald-600 dark:text-emerald-400",children:String(eh.cancelacionesLogradas??0)})]})]}),ec&&(0,r.jsxs)("div",{className:"border border-brand/30 bg-brand/5 rounded-xl p-4 space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(c.A,{size:16,className:"text-brand"}),(0,r.jsx)("h3",{className:"text-sm font-semibold text-dark",children:F?"Simulador: \xbfQu\xe9 pasa si...?":"Simulator: What if...?"})]}),(0,r.jsx)("p",{className:"text-xs text-muted",children:F?"Simula el impacto de una nueva condena sobre los antecedentes existentes del cliente.":"Simulate the impact of a new conviction on existing client records."}),(0,r.jsxs)("form",{onSubmit:e_,className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[(0,r.jsx)("input",{name:"delito",required:!0,placeholder:F?"Delito *":"Offense *","aria-label":F?"Delito":"Offense",className:"px-3 py-2 text-sm bg-surface border border-border rounded-lg text-dark placeholder:text-muted/50"}),(0,r.jsx)("input",{name:"tituloCP",placeholder:F?"T\xedtulo CP (ej: XIII)":"CP Title (e.g. XIII)","aria-label":F?"T\xedtulo del C\xf3digo Penal":"Criminal Code Title",className:"px-3 py-2 text-sm bg-surface border border-border rounded-lg text-dark placeholder:text-muted/50"}),(0,r.jsxs)("select",{name:"penaType",required:!0,"aria-label":F?"Tipo de pena":"Penalty type",className:"px-3 py-2 text-sm bg-surface border border-border rounded-lg text-dark",children:[(0,r.jsx)("option",{value:"prision",children:F?"Prisi\xf3n":"Prison"}),(0,r.jsx)("option",{value:"multa",children:F?"Multa":"Fine"}),(0,r.jsx)("option",{value:"inhabilitacion",children:F?"Inhabilitaci\xf3n":"Disqualification"}),(0,r.jsx)("option",{value:"trabajos_comunidad",children:F?"Trabajos comunidad":"Community service"}),(0,r.jsx)("option",{value:"alejamiento",children:F?"Alejamiento":"Restraining"}),(0,r.jsx)("option",{value:"localizacion_permanente",children:F?"Localizaci\xf3n permanente":"Fixed location"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("input",{name:"penaDurationMonths",inputMode:"decimal",type:"number",min:"0",required:!0,placeholder:F?"Meses":"Months","aria-label":F?"Duraci\xf3n en meses":"Duration in months",className:"w-20 px-2 py-2 text-sm bg-surface border border-border rounded-lg text-dark placeholder:text-muted/50"}),(0,r.jsx)("input",{name:"penaDurationDays",inputMode:"decimal",type:"number",min:"0",placeholder:F?"D\xedas":"Days","aria-label":F?"Duraci\xf3n en d\xedas":"Duration in days",className:"w-20 px-2 py-2 text-sm bg-surface border border-border rounded-lg text-dark placeholder:text-muted/50"}),(0,r.jsx)("button",{type:"submit",disabled:em,className:"px-3 py-2 text-sm text-white bg-brand rounded-lg hover:bg-brand/90 disabled:opacity-50 whitespace-nowrap",children:em?(0,r.jsx)(o.A,{size:14,className:"animate-spin"}):F?"Simular":"Simulate"})]})]}),ed&&(0,r.jsxs)("div",{className:"border-t border-border/50 pt-3 space-y-2",children:[(0,r.jsx)("h4",{className:"text-xs font-semibold text-dark",children:F?"Resultados de la simulaci\xf3n":"Simulation results"}),ed.reincidencia?(0,r.jsxs)("div",{className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs ${ed.reincidencia?.isApplicable?"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300":"bg-emerald-50 dark:bg-emerald-900/20 text-emerald-700 dark:text-emerald-300"}`,children:[ed.reincidencia?.isApplicable?(0,r.jsx)(b.A,{size:13}):(0,r.jsx)(h.A,{size:13}),(0,r.jsxs)("span",{className:"font-medium",children:[F?"Reincidencia Art. 22.8:":"Recidivism Art. 22.8:"," ",ed.reincidencia?.isApplicable?F?"APLICABLE":"APPLICABLE":F?"No aplicable":"Not applicable"]}),ed.reincidencia?.isApplicable?(0,r.jsxs)("span",{className:"opacity-75",children:[": ",ed.reincidencia?.matchingRecords?.length||0," ",F?"registros coincidentes":"matching records"]}):null]}):null,ed.affectedRecords?.length>0&&(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("div",{className:"text-xs font-medium text-muted",children:F?"Registros afectados:":"Affected records:"}),ed.affectedRecords.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-amber-50 dark:bg-amber-900/20 rounded-lg text-xs text-amber-700 dark:text-amber-300",children:[(0,r.jsx)(b.A,{size:12}),(0,r.jsx)("span",{className:"font-medium",children:String(e.delito||"")}),(0,r.jsxs)("span",{className:"opacity-75",children:["\xb7 ",String(e.impact||"")]})]},t))]}),ed.cancelacionClockReset?.length>0&&(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-orange-50 dark:bg-orange-900/20 rounded-lg text-xs text-orange-700 dark:text-orange-300",children:[(0,r.jsx)(b.A,{size:13}),(0,r.jsxs)("span",{children:[F?"Reloj de cancelaci\xf3n reiniciado en":"C
6ancellation clock reset on"," ",ed.cancelacionClockReset.length," ",F?"registro(s)":"record(s)"]})]})]})]}),M.length>0&&(0,r.jsx)(z,{records:M,locale:A}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("h3",{className:"text-sm font-semibold text-dark",children:[F?"Registros":"Records"," (",M.length,")"]}),0===M.length&&(0,r.jsx)("p",{className:"text-sm text-muted py-8 text-center",children:F?"No hay antecedentes registrados para este cliente.":"No criminal records for this client."}),M.map(e=>(0,r.jsxs)("div",{className:"border border-border rounded-xl bg-card overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 cursor-pointer hover:bg-surface-hover transition-colors",onClick:()=>{let t=Z===e.id?null:e.id;er(t),t&&eq(t)},children:[(0,r.jsx)(g.A,{size:14,className:`text-muted transition-transform ${Z===e.id?"rotate-90":""}`}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-dark truncate",children:e.delito}),e.articuloCP&&(0,r.jsxs)("span",{className:"text-[11px] text-muted",children:["(",e.articuloCP,")"]}),(0,r.jsx)("span",{className:`text-[10px] font-medium px-1.5 py-0.5 rounded-full ${ea[e.status]||""}`,children:e.status.replace(/_/g," ")})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 text-[11px] text-muted mt-0.5",children:[(0,r.jsxs)("span",{children:[e.penaType.replace(/_/g," ")," ",e.penaDurationMonths,"m",e.penaDurationDays>0?` ${e.penaDurationDays}d`:""]}),(0,r.jsxs)("span",{children:[F?"Sentencia":"Sentenced",": ",e.fechaSentencia]}),e.fechaCancelacion&&(0,r.jsxs)("span",{className:"text-emerald-600 dark:text-emerald-400",children:[F?"Cancelaci\xf3n":"Cancellation",": ",e.fechaCancelacion]})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,r.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),Q(e)},className:"p-1.5 text-muted hover:text-brand rounded-md hover:bg-surface-hover",title:F?"A\xf1adir evento":"Add event",children:(0,r.jsx)(f.A,{size:13})}),(0,r.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),J(e),V(!0)},className:"p-1.5 text-muted hover:text-brand rounded-md hover:bg-surface-hover",title:F?"Editar":"Edit",children:(0,r.jsx)(v.A,{size:13})}),(0,r.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),eE(e.id)},className:"p-1.5 text-muted hover:text-red-600 rounded-md hover:bg-surface-hover",title:F?"Eliminar":"Delete",children:(0,r.jsx)(j.A,{size:13})})]})]}),Z===e.id&&(0,r.jsxs)("div",{className:"px-4 py-3 border-t border-border bg-surface/50 space-y-2",children:[(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-x-6 gap-y-1 text-xs",children:[e.tribunal&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-muted",children:F?"Tribunal:":"Court:"})," ",(0,r.jsx)("span",{className:"text-dark",children:e.tribunal})]}),e.numProcedimiento&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-muted",children:F?"N\xba Proc:":"Case #:"})," ",(0,r.jsx)("span",{className:"text-dark",children:e.numProcedimiento})]}),e.tituloCP&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-muted",children:F?"T\xedtulo CP:":"CP Title:"})," ",(0,r.jsx)("span",{className:"text-dark",children:e.tituloCP})]}),e.fechaHechos&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-muted",children:F?"Hechos:":"Offense:"})," ",(0,r.jsx)("span",{className:"text-dark",children:e.fechaHechos})]}),e.fechaInicioCumplimiento&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-muted",children:F?"Inicio:":"Start:"})," ",(0,r.jsx)("span",{className:"text-dark",children:e.fechaInicioCumplimiento})]}),e.fechaFinCumplimiento&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-muted",children:F?"Fin:":"End:"})," ",(0,r.jsx)("span",{className:"text-dark",children:e.fechaFinCumplimiento})]}),e.cancelacionPlazoYears&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-muted",children:F?"Plazo Art.136:":"Art.136 term:"})," ",(0,r.jsxs)("span",{className:"text-dark",children:[e.cancelacionPlazoYears," ",F?"a\xf1os":"years"]})]})]}),e.notes&&(0,r.jsx)("p",{className:"text-xs text-muted mt-2",children:e.notes}),("pendiente_cancelacion"===e.status||"cumplida"===e.status)&&(0,r.jsxs)("button",{type:"button",onClick:()=>eR(e.id),disabled:!!eD[e.id],className:"flex items-center gap-1.5 px-3 py-1.5 mt-1 text-xs font-medium text-brand border border-brand/30 rounded-lg hover:bg-brand/5 transition-colors disabled:opacity-50",children:[eD[e.id]?(0,r.jsx)(o.A,{size:12,className:"animate-spin"}):(0,r.jsx)(y.A,{size:12}),F?"Generar solicitud de cancelaci\xf3n":"Generate cancellation request"]}),ej[e.id]?.prescripcion&&(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-surface rounded-lg text-xs",children:[(0,r.jsx)(N.A,{size:12,className:"text-muted shrink-0"}),(0,r.jsx)("span",{className:"text-muted",children:F?"Prescripci\xf3n:":"Statute of limitations:"}),(0,r.jsxs)("span",{className:"font-medium text-dark",children:[String(ej[e.id].prescripcion.plazoYears)," ",F?"a\xf1os":"years",ej[e.id].prescripcion.fechaPrescripcion?` (${String(ej[e.id].prescripcion.fechaPrescripcion)})`:""]}),ej[e.id].prescripcion.isPrescrito?(0,r.jsx)("span",{className:"text-emerald-600 dark:text-emerald-400 font-semibold",children:F?"PRESCRITO":"PRESCRIBED"}):null,(0,r.jsx)("span",{className:"text-muted opacity-60 ml-auto",children:String(ej[e.id].prescripcion.legalBasis)})]}),ej[e.id]?.libertadCondicional&&"prision"===e.penaType&&"cumpliendo"===e.status&&(0,r.jsxs)("div",{className:"px-3 py-2 bg-surface rounded-lg text-xs space-y-1.5",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(C.A,{size:12,className:"text-muted shrink-0"}),(0,r.jsx)("span",{className:"font-medium text-dark",children:F?"Libertad condicional (Art. 90 CP)":"Parole (Art. 90 CP)"}),ej[e.id].libertadCondicional.eligible?(0,r.jsx)("span",{className:"text-emerald-600 dark:text-emerald-400 font-semibold",children:F?"ELEGIBLE":"ELIGIBLE"}):null]}),(0,r.jsxs)("div",{className:"flex items-center gap-4 text-muted",children:[(0,r.jsxs)("span",{children:["2/3: ",String(ej[e.id].libertadCondicional.fechaDosTermios||"-")]}),(0,r.jsxs)("span",{children:["3/4: ",String(ej[e.id].libertadCondicional.fechaTresCuartos||"-")]}),(0,r.jsxs)("span",{children:[F?"Progreso":"Progress",": ",String(ej[e.id].libertadCondicional.progressPercent),"%"]})]}),(0,r.jsx)("div",{className:"w-full bg-border rounded-full h-1.5",children:(0,r.jsx)("div",{className:"bg-brand rounded-full h-1.5 transition-all",style:{width:`${Math.min(100,Number(ej[e.id].libertadCondicional.progressPercent))}%`}})})]}),("suspendida"===e.status||"sustituida"===e.status)&&(0,r.jsxs)("button",{type:"button",onClick:()=>eB(e.id),disabled:!!eA[e.id],className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-muted border border-border rounded-lg hover:bg-surface-hover transition-colors disabled:opacity-50",children:[eA[e.id]?(0,r.jsx)(o.A,{size:12,className:"animate-spin"}):(0,r.jsx)(k.A,{size:12}),F?"Sincronizar condiciones al calendario":"Sync conditions to calendar"]}),e.sentenciaGroupId&&(0,r.jsxs)("div",{className:"flex items-center gap-1.5 text-[11px] text-muted",children:[(0,r.jsx)(m.A,{size:11}),F?"Grupo sentencia:":"Sentence group:"," ",e.sentenciaGroupId,"(",M.filter(t=>t.sentenciaGroupId===e.sentenciaGroupId).length," ",F?"penas":"penalties",")"]}),e.events&&e.events.length>0&&(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsxs)("h4",{className:"text-xs font-semibold text-dark mb-1.5 flex items-center gap-1",children:[(0,r.jsx)(S.A,{size:12})," ",F?"Eventos":"Events"]}),(0,r.jsx)("div",{className:"space-y-1",children:e.events.map(e=>(0,r.jsxs)("div",{className:"flex items-center gap-2 text-[11px]",children:[(0,r.jsx)("span",{className:"text-muted w-20 shrink-0",children:e.eventDate}),(0,r.jsx)("span",{className:"font-medium text-dark",children:e.eventType.replace(/_/g," ")}),e.description&&(0,r.jsxs)("span",{className:"text-muted truncate",children:["\xb7 ",e.description]})]},e.id))})]})]})]},e.id))]})]}),W&&(0,r.jsx)(X,{clientId:B||D||"",caseId:t,existingRecord:U,locale:A,onSave:eM,onClose:()=>{V(!1),J(null)}}),K&&(0,r.jsx)(ee,{recordId:K.id,recordStatus:K.status,recordPenaType:K.penaType,locale:A,onSave:eM,onClose:()=>Q(null)}),ep&&(0,r.jsx)(G.a,{onClose:()=>eb(null),className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:()=>eb(null),children:(0,r.jsxs)("div",{className:"bg-card border border-border rounded-2xl shadow-2xl w-full max-w-3xl max-h-[90vh] overflow-y-auto",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[(0,r.jsxs)("h2",{className:"text-base font-semibold text-dark flex items-center gap-2",children:[(0,r.jsx)(y.A,{size:16,className:"text-brand"}),F?"Solicitud de Cancelaci\xf3n de Antecedentes":"Criminal Record Cancellation Request"]}),(0,r.jsx)("button",{type:"button",onClick:()=>eb(null),className:"text-muted hover:text-dark text-sm","aria-label":F?"Cerrar":"Close",children:"\xd7"})]}),(0,r.jsxs)("div",{className:"px-6 py-4",children:[(0,r.jsx)("pre",{className:"whitespace-pre-wrap text-xs text-dark font-mono leading-relaxed bg-surface rounded-lg p-4 border border-border",children:ep}),(0,r.jsxs)("div",{className:"flex justify-end gap-2 mt-4",children:[(0,r.jsx)("button",{type:"button",onClick:()=>{(0,s.l)(ep)},className:"px-4 py-2 text-sm text-muted border border-border rounded-lg hover:bg-surface-hover",children:F?"Copiar al portapapeles":"Copy to clipboard"}),(0,r.jsx)("button",{type:"button",onClick:()=>{let e=document.createElement("pre");e.style.cssText="font-family:monospace;white-space:pre-wrap;padding:40px;max-width:800px;margin:0 auto",e.textContent=ep;let t=window.open("","_blank");t&&(t.document.title=F?"Solicitud de Cancelaci\xf3n":"Cancellation Request",t.document.body.appendChild(e),t.print())},className:"px-4 py-2 text-sm text-white bg-brand rounded-lg hover:bg-brand/90",children:F?"Imprimir":"Print"})]})]})]})}),ei&&(0,r.jsx)(G.a,{onClose:()=>el(null),className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:()=>el(null),children:(0,r.jsxs)("div",{className:"bg-card border border-border rounded-2xl shadow-2xl w-full max-w-2xl max-h-[90vh] overflow-y-auto",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[(0,r.jsx)("h2",{className:"text-base font-semibold text-dark",children:F?`${ei.length} antecedente(s) detectado(s)`:`${ei.length} record(s) detected`}),(0,r.jsx)("button",{type:"button",onClick:()=>el(null),className:"text-muted hover:text-dark text-sm",children:F?"Cancelar":"Cancel"})]}),(0,r.jsxs)("div",{className:"px-6 py-4 space-y-3",children:[(0,r.jsx)("p",{className:"text-xs text-muted",children:F?"Revisa los datos extra\xeddos. Al confirmar se crear\xe1n los registros.":"Review extracted data. Confirming will create the records."}),ei.map((e,t)=>(0,r.jsxs)("div",{className:"border border-border rounded-lg p-3 text-xs space-y-1",children:[(0,r.jsxs)("div",{className:"font-medium text-dark",children:[String(e.delito||"")," ",e.articuloCP?`\xb7 ${String(e.articuloCP)}`:""]}),(0,r.jsxs)("div",{className:"text-muted",children:[String(e.penaType||"").replace(/_/g," ")," ",String(e.penaDurationMonths??""),"m \xb7 ",F?"Sentencia":"Sentence",": ",String(e.fechaSentencia||"?")]}),e.tribunal?(0,r.jsx)("div",{className:"text-muted",children:String(e.tribunal)}):null]},t)),(0,r.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,r.jsx)("button",{type:"button",onClick:()=>el(null),className:"px-4 py-2 text-sm text-muted border border-border rounded-lg hover:bg-surface-hover",children:F?"Cancelar":"Cancel"}),(0,r.jsx)("button",{type:"button",onClick:ez,className:"px-4 py-2 text-sm text-white bg-brand rounded-lg hover:bg-brand/90",children:F?`Importar ${ei.length} registro(s)`:`Import ${ei.length} record(s)`})]})]})]})}),ek&&(0,r.jsx)(G.a,{onClose:()=>eS(null),className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:()=>eS(null),children:(0,r.jsxs)("div",{className:"bg-card border border-border rounded-2xl shadow-2xl w-full max-w-2xl max-h-[90vh] overflow-y-auto",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[(0,r.jsxs)("h2",{className:"text-base font-semibold text-dark flex items-center gap-2",children:[(0,r.jsx)(u.A,{size:16,className:"text-brand"}),F?`${ek.length} registro(s) detectado(s)`:`${ek.length} record(s) detected`]}
6),(0,r.jsx)("button",{type:"button",onClick:()=>eS(null),className:"text-muted hover:text-dark text-sm",children:F?"Cancelar":"Cancel"})]}),(0,r.jsxs)("div",{className:"px-6 py-4 space-y-3",children:[(0,r.jsx)("p",{className:"text-xs text-muted",children:F?"Revisa los datos importados del CSV. Al confirmar se crear\xe1n los registros.":"Review imported CSV data. Confirming will create records."}),ek.map((e,t)=>(0,r.jsxs)("div",{className:"border border-border rounded-lg p-3 text-xs space-y-1",children:[(0,r.jsxs)("div",{className:"font-medium text-dark",children:[String(e.delito||"")," ",e.articuloCP?`\xb7 ${String(e.articuloCP)}`:""]}),(0,r.jsxs)("div",{className:"text-muted",children:[String(e.penaType||"").replace(/_/g," ")," ",String(e.penaDurationMonths??""),"m \xb7 ",F?"Sentencia":"Sentence",": ",String(e.fechaSentencia||"?")]}),e.sentenciaGroupId?(0,r.jsxs)("div",{className:"text-muted flex items-center gap-1",children:[(0,r.jsx)(m.A,{size:10})," ",F?"Grupo":"Group",": ",String(e.sentenciaGroupId)]}):null]},t)),(0,r.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,r.jsx)("button",{type:"button",onClick:()=>eS(null),className:"px-4 py-2 text-sm text-muted border border-border rounded-lg hover:bg-surface-hover",children:F?"Cancelar":"Cancel"}),(0,r.jsx)("button",{type:"button",onClick:eG,className:"px-4 py-2 text-sm text-white bg-brand rounded-lg hover:bg-brand/90",children:F?`Importar ${ek.length} registro(s)`:`Import ${ek.length} record(s)`})]})]})]})})]})}},82234:(e,t,a)=>{a.d(t,{d:()=>u,t:()=>d});var r=a(95155),n=a(12115),s=a(20063),i=a(64216),l=a(37621);let c=(0,n.createContext)(null),o=0;function d(e){let{children:t}=e,[a,d]=(0,n.useState)([]),u=(0,s.usePathname)(),m=(0,n.useCallback)(e=>{d(t=>t.filter(t=>t.id!==e))},[]),x=(0,n.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",a=arguments.length>2?arguments[2]:void 0,r=o++;if(d(n=>[...n,{id:r,message:e,type:t,action:a?.action}]),setTimeout(()=>m(r),a?.action?6e3:4e3),"error"===t)try{(0,i.u4)("error_seen",{code:"toast",where:u||"unknown",message:e.slice(0,200)})}catch{}},[m,u]);return(0,n.useEffect)(()=>{function e(e){let t=(0,l.ge)(e.reason);t&&x(t.message,t.kind)}return window.addEventListener("unhandledrejection",e),()=>window.removeEventListener("unhandledrejection",e)},[x]),(0,r.jsx)(c.Provider,{value:{toast:x,toasts:a,dismiss:m},children:t})}function u(){let e=(0,n.useContext)(c);if(!e)throw Error("useToast must be used within ToastProvider");return e}},90571:(e,t,a)=>{a.d(t,{f:()=>n});var r=a(12115);function n(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{restoreFocus:n=!0}=a,s=(0,r.useRef)(t);(0,r.useEffect)(()=>{s.current=t}),(0,r.useEffect)(()=>{if(!e)return;let t=document.activeElement instanceof HTMLElement?document.activeElement:null;function a(e){"Escape"===e.key&&!e.defaultPrevented&&(e.isComposing||(e.preventDefault(),s.current()))}return document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a),n&&t&&t.isConnected&&t!==document.body&&t.focus()}},[e,n])}}}]);

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.