(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{2422:function(e,t,s){Promise.resolve().then(s.bind(s,291))},291:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return M}});var a=s(7437),l=s(2265),r=s(553),n=s(525),i=s(3085),o=s(4508);function c(e){let{title:t,amount:s,subtitle:l,trend:r,icon:c,color:d="text-emerald-400"}=e;return(0,a.jsxs)("div",{className:"relative overflow-hidden rounded-xl border border-slate-700 bg-slate-800 p-6 shadow-lg",children:[(0,a.jsx)("div",{className:(0,o.cn)("absolute right-4 top-4",d),children:(0,a.jsx)(c,{className:"h-10 w-10 opacity-80"})}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-slate-400",children:t}),(0,a.jsx)("p",{className:"mt-2 font-mono text-3xl font-bold text-emerald-400",children:(0,o.xG)(s)}),l&&(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-500",children:l}),r&&(0,a.jsxs)("div",{className:"mt-3 flex items-center gap-1.5",children:[r.isPositive?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.Z,{className:"h-4 w-4 text-emerald-500"}),(0,a.jsxs)("span",{className:"text-sm font-medium text-emerald-500",children:["+",r.value,"%"]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.Z,{className:"h-4 w-4 text-rose-500"}),(0,a.jsxs)("span",{className:"text-sm font-medium text-rose-500",children:["-",r.value,"%"]})]}),(0,a.jsx)("span",{className:"text-sm text-slate-500",children:"vs mes anterior"})]})]})]})}var d=s(3056),x=s(5224),u=s(2572),m=s(407),p=s(7719);let h={housing:"#10b981",services:"#3b82f6",subscription:"#8b5cf6",other:"#64748b",shopping:"#f59e0b",food:"#ef4444",entertainment:"#ec4899",health:"#06b6d4",transport:"#84cc16"},g={housing:"Vivienda",services:"Servicios",subscription:"Suscripciones",other:"Otros",shopping:"Compras",food:"Comida",entertainment:"Entretenimiento",health:"Salud",transport:"Transporte"};function b(e){let{fixedDebts:t,variableDebts:s}=e,l=new Map;t.filter(e=>!e.isPaid).forEach(e=>{let t=l.get(e.category)||0;l.set(e.category,t+e.amount)}),s.filter(e=>!e.isPaid).forEach(e=>{let t=l.get(e.category)||0;l.set(e.category,t+e.amount)});let r=Array.from(l.entries()).map(e=>{let[t,s]=e;return{name:g[t]||t,value:s,color:h[t]||"#64748b",category:t}}).filter(e=>e.value>0).sort((e,t)=>t.value-e.value),n=r.reduce((e,t)=>e+t.value,0);return 0===r.length?(0,a.jsx)("div",{className:"flex h-64 items-center justify-center rounded-xl border border-slate-700 bg-slate-800",children:(0,a.jsx)("p",{className:"text-slate-500",children:"No hay gastos pendientes"})}):(0,a.jsxs)("div",{className:"rounded-xl border border-slate-700 bg-slate-800 p-6",children:[(0,a.jsx)("h3",{className:"mb-4 text-lg font-semibold text-white",children:"Distribuci\xf3n de Gastos"}),(0,a.jsxs)("div",{className:"flex flex-col gap-6 lg:flex-row",children:[(0,a.jsx)("div",{className:"h-64 w-full lg:w-1/2",children:(0,a.jsx)(d.h,{width:"100%",height:"100%",children:(0,a.jsxs)(x.u,{children:[(0,a.jsx)(u.by,{data:r,cx:"50%",cy:"50%",innerRadius:60,outerRadius:90,paddingAngle:2,dataKey:"value",children:r.map((e,t)=>(0,a.jsx)(m.b,{fill:e.color},"cell-".concat(t)))}),(0,a.jsx)(p.u,{formatter:e=>"number"==typeof e?(0,o.xG)(e):e,contentStyle:{backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"8px",color:"#fff"}})]})})}),(0,a.jsxs)("div",{className:"flex w-full flex-col justify-center gap-3 lg:w-1/2",children:[r.map(e=>{let t=n>0?e.value/n*100:0;return(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"h-4 w-4 rounded-full",style:{backgroundColor:e.color}}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-slate-300",children:e.name}),(0,a.jsxs)("span",{className:"text-sm text-slate-400",children:[t.toFixed(1),"%"]})]}),(0,a.jsx)("p",{className:"text-xs text-slate-500",children:(0,o.xG)(e.value)})]})]},e.category)}),(0,a.jsx)("div",{className:"mt-4 border-t border-slate-700 pt-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-slate-400",children:"Total"}),(0,a.jsx)("span",{className:"font-mono text-lg font-bold text-emerald-400",children:(0,o.xG)(n)})]})})]})]})]})}var f=s(9397),j=s(8226),v=s(1804);function N(e){let{onAddDebt:t,onAddCard:s,onAddPayment:l}=e,r=[{label:"Agregar Deuda",icon:f.Z,onClick:t,color:"bg-emerald-500 hover:bg-emerald-600"},{label:"Nueva Tarjeta",icon:j.Z,onClick:s,color:"bg-blue-500 hover:bg-blue-600"},{label:"Registrar Pago",icon:v.Z,onClick:l,color:"bg-violet-500 hover:bg-violet-600"}];return(0,a.jsx)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:r.map(e=>{let t=e.icon;return(0,a.jsxs)("button",{onClick:e.onClick,className:"\n group flex flex-col items-center gap-3 rounded-xl p-6\n transition-all duration-200 ease-out\n ".concat(e.color,"\n focus:outline-none focus:ring-2 focus:ring-white/50 focus:ring-offset-2 focus:ring-offset-slate-800\n "),children:[(0,a.jsx)("div",{className:"rounded-full bg-white/20 p-4 transition-transform group-hover:scale-110",children:(0,a.jsx)(t,{className:"h-8 w-8 text-white"})}),(0,a.jsx)("span",{className:"font-medium text-white",children:e.label})]},e.label)})})}var y=s(2568),w=s(9322),C=s(4835),k=s(3261);function S(){let{fixedDebts:e,variableDebts:t,creditCards:s,monthlyBudgets:l,alerts:r,currentMonth:n,currentYear:i}=(0,C.J)(),d=(0,o.zF)(e),x=(0,o.Q0)(t),u=s.reduce((e,t)=>e+t.currentBalance,0),m=(0,k.B0)(l,n,i),p=(0,k.FB)(e,t),h=m?m.totalIncome-p:0,g=m?m.totalIncome-p:0,f=(null==m?void 0:m.savingsGoal)||0,N=r.filter(e=>!e.isRead).slice(0,3),S={danger:"border-rose-500 bg-rose-500/10 text-rose-400",warning:"border-amber-500 bg-amber-500/10 text-amber-400",info:"border-blue-500 bg-blue-500/10 text-blue-400"};return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[(0,a.jsx)(c,{title:"Deudas Pendientes",amount:d+x,subtitle:"".concat(e.filter(e=>!e.isPaid).length+t.filter(e=>!e.isPaid).length," pagos pendientes"),icon:v.Z,color:"text-rose-400"}),(0,a.jsx)(c,{title:"Balance en Tarjetas",amount:u,subtitle:"".concat(s.length," tarjetas activas"),icon:j.Z,color:"text-blue-400"}),(0,a.jsx)(c,{title:"Presupuesto Disponible",amount:h,subtitle:m?"de ".concat(m.totalIncome.toLocaleString("es-AR",{style:"currency",currency:"ARS"})," ingresos"):"Sin presupuesto definido",icon:y.Z,color:"text-emerald-400"}),(0,a.jsx)(c,{title:"Meta de Ahorro",amount:g,subtitle:f>0?"".concat((g/f*100).toFixed(0),"% de la meta"):"Sin meta definida",icon:y.Z,color:"text-violet-400"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[(0,a.jsx)(b,{fixedDebts:e,variableDebts:t}),(0,a.jsxs)("div",{className:"rounded-xl border border-slate-700 bg-slate-800 p-6",children:[(0,a.jsx)("h3",{className:"mb-4 text-lg font-semibold text-white",children:"Alertas Destacadas"}),0===N.length?(0,a.jsx)("div",{className:"flex h-48 items-center justify-center",children:(0,a.jsx)("p",{className:"text-slate-500",children:"No hay alertas pendientes"})}):(0,a.jsx)("div",{className:"space-y-3",children:N.map(e=>(0,a.jsxs)("div",{className:(0,o.cn)("flex items-start gap-3 rounded-lg border p-4",S[e.severity]),children:[(0,a.jsx)(w.Z,{className:"mt-0.5 h-5 w-5 shrink-0"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"font-medium",children:e.title}),(0,a.jsx)("p",{className:"mt-1 text-sm opacity-90",children:e.message})]})]},e.id))})]})]})]})}var D=s(7580);function Z(e){let{limit:t=5}=e,{fixedDebts:s,variableDebts:l,cardPayments:r,creditCards:n}=(0,C.J)(),i=[...s.slice(0,t).map(e=>({id:e.id,type:"fixed_debt",title:e.name,amount:e.amount,date:new Date().toISOString(),description:"Vence el d\xeda ".concat(e.dueDay)})),...l.slice(0,t).map(e=>({id:e.id,type:"variable_debt",title:e.name,amount:e.amount,date:e.date,description:e.notes})),...r.slice(0,t).map(e=>{let t=n.find(t=>t.id===e.cardId);return{id:e.id,type:"card_payment",title:"Pago - ".concat((null==t?void 0:t.name)||"Tarjeta"),amount:e.amount,date:e.date,description:e.description}})].sort((e,t)=>new Date(t.date).getTime()-new Date(e.date).getTime()).slice(0,t),c={fixed_debt:{icon:v.Z,label:"Deuda Fija",color:"text-amber-400",bgColor:"bg-amber-400/10"},variable_debt:{icon:D.Z,label:"Gasto",color:"text-rose-400",bgColor:"bg-rose-400/10"},card_payment:{icon:j.Z,label:"Pago Tarjeta",color:"text-blue-400",bgColor:"bg-blue-400/10"}};return 0===i.length?(0,a.jsxs)("div",{className:"rounded-xl border border-slate-700 bg-slate-800 p-6",children:[(0,a.jsx)("h3",{className:"mb-4 text-lg font-semibold text-white",children:"Actividad Reciente"}),(0,a.jsx)("div",{className:"flex h-32 items-center justify-center",children:(0,a.jsx)("p",{className:"text-slate-500",children:"No hay actividad reciente"})})]}):(0,a.jsxs)("div",{className:"rounded-xl border border-slate-700 bg-slate-800 p-6",children:[(0,a.jsx)("h3",{className:"mb-4 text-lg font-semibold text-white",children:"Actividad Reciente"}),(0,a.jsx)("div",{className:"space-y-3",children:i.map(e=>{let t=c[e.type],s=t.icon;return(0,a.jsxs)("div",{className:"flex items-center gap-4 rounded-lg border border-slate-700/50 bg-slate-700/30 p-4 transition-colors hover:bg-slate-700/50",children:[(0,a.jsx)("div",{className:(0,o.cn)("flex h-10 w-10 items-center justify-center rounded-full",t.bgColor),children:(0,a.jsx)(s,{className:(0,o.cn)("h-5 w-5",t.color)})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("h4",{className:"truncate font-medium text-white",children:e.title}),(0,a.jsxs)("span",{className:(0,o.cn)("shrink-0 font-mono font-medium","card_payment"===e.type?"text-emerald-400":"text-rose-400"),children:["card_payment"===e.type?"+":"-",(0,o.xG)(e.amount)]})]}),(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-2 text-sm text-slate-400",children:[(0,a.jsx)("span",{className:(0,o.cn)("text-xs",t.color),children:t.label}),(0,a.jsx)("span",{children:"•"}),(0,a.jsx)("span",{children:(0,o.iS)(e.date)}),e.description&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{children:"•"}),(0,a.jsx)("span",{className:"truncate",children:e.description})]})]})]})]},e.id)})})]})}var A=s(9294),F=s(3263),z=s(2489),E=s(2720),P=s(1047),T=s(2934),O=s(8736);function I(e){let{isOpen:t,onClose:s}=e,[r,n]=(0,l.useState)("variable"),[i,c]=(0,l.useState)(""),[d,x]=(0,l.useState)(""),[u,m]=(0,l.useState)(new Date().toISOString().split("T")[0]),[p,h]=(0,l.useState)("1"),[g,b]=(0,l.useState)("housing"),[f,j]=(0,l.useState)("shopping"),[v,N]=(0,l.useState)(!1),[y,w]=(0,l.useState)(""),k=(0,C.J)(e=>e.addFixedDebt),S=(0,C.J)(e=>e.addVariableDebt);return t?(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4 animate-in fade-in duration-200",children:(0,a.jsxs)("div",{className:"w-full max-w-lg rounded-xl bg-slate-900 border border-slate-800 shadow-2xl overflow-hidden scale-100 animate-in zoom-in-95 duration-200",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-slate-800",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-white",children:"Agregar Gasto / Deuda"}),(0,a.jsx)("button",{onClick:s,className:"text-slate-400 hover:text-white transition-colors",children:(0,a.jsx)(z.Z,{size:20})})]}),(0,a.jsxs)("div",{className:"flex p-1 mx-6 mt-6 bg-slate-800/50 rounded-lg",children:[(0,a.jsx)("button",{onClick:()=>n("variable"),className:(0,o.cn)("flex-1 py-2 text-sm font-medium rounded-md transition-all duration-200","variable"===r?"bg-cyan-500 text-white shadow-lg":"text-slate-400 hover:text-white"),children:"Variable (\xdanico)"}),(0,a.jsx)("button",{onClick:()=>n("fixed"),className:(0,o.cn)("flex-1 py-2 text-sm font-medium rounded-md transition-all duration-200","fixed"===r?"bg-cyan-500 text-white shadow-lg":"text-slate-400 hover:text-white"),children:"Fijo (Recurrente)"})]}),(0,a.jsxs)("form",{onSubmit:e=>{if(e.preventDefault(),!i||!d)return;let t=parseFloat(d);isNaN(t)||("fixed"===r?k({name:i,amount:t,dueDay:parseInt(p),category:g,isAutoDebit:v,isPaid:!1,notes:y||void 0}):S({name:i,amount:t,date:new Date(u).toISOString(),category:f,isPaid:!1,notes:y||void 0}),c(""),x(""),w(""),s())},className:"p-6 space-y-5",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider",children:"Monto"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("span",{className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400 font-semibold",children:"$"}),(0,a.jsx)("input",{type:"number",step:"0.01",placeholder:"0.00",value:d,onChange:e=>x(e.target.value),className:"w-full pl-8 pr-4 py-3 bg-slate-950 border border-slate-800 rounded-lg focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 text-white text-lg font-mono outline-none transition-all placeholder:text-slate-600",required:!0,autoFocus:!0})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider",children:"Descripci\xf3n"}),(0,a.jsx)("input",{type:"text",placeholder:"Ej: Supermercado Coto, Netflix, Alquiler",value:i,onChange:e=>c(e.target.value),className:"w-full px-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 text-white outline-none transition-all placeholder:text-slate-600",required:!0})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("label",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider flex items-center gap-1",children:[(0,a.jsx)(E.Z,{size:12})," Categor\xeda"]}),(0,a.jsx)("select",{value:"fixed"===r?g:f,onChange:e=>"fixed"===r?b(e.target.value):j(e.target.value),className:"w-full px-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 text-white outline-none appearance-none cursor-pointer",children:"fixed"===r?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("option",{value:"housing",children:"Vivienda"}),(0,a.jsx)("option",{value:"services",children:"Servicios"}),(0,a.jsx)("option",{value:"subscription",children:"Suscripciones"}),(0,a.jsx)("option",{value:"other",children:"Otro"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("option",{value:"food",children:"Comida / Super"}),(0,a.jsx)("option",{value:"shopping",children:"Compras"}),(0,a.jsx)("option",{value:"transport",children:"Transporte"}),(0,a.jsx)("option",{value:"health",children:"Salud"}),(0,a.jsx)("option",{value:"entertainment",children:"Entretenimiento"}),(0,a.jsx)("option",{value:"other",children:"Otro"})]})})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("label",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider flex items-center gap-1",children:[(0,a.jsx)(P.Z,{size:12})," ","fixed"===r?"D\xeda Vencimiento":"Fecha"]}),"fixed"===r?(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{type:"number",min:"1",max:"31",value:p,onChange:e=>h(e.target.value),className:"w-full px-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 text-white outline-none",required:!0}),(0,a.jsx)("span",{className:"absolute right-4 top-1/2 -translate-y-1/2 text-slate-500 text-sm",children:"del mes"})]}):(0,a.jsx)("input",{type:"date",value:u,onChange:e=>m(e.target.value),className:"w-full px-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 text-white outline-none [color-scheme:dark]",required:!0})]})]}),"fixed"===r&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 bg-slate-800/30 rounded-lg cursor-pointer",onClick:()=>N(!v),children:[(0,a.jsx)("div",{className:(0,o.cn)("w-5 h-5 rounded border flex items-center justify-center transition-colors",v?"bg-cyan-500 border-cyan-500":"border-slate-600 bg-transparent"),children:v&&(0,a.jsx)(T.Z,{size:14,className:"text-white"})}),(0,a.jsx)("span",{className:"text-sm text-slate-300 select-none",children:"D\xe9bito Autom\xe1tico"})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("label",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider flex items-center gap-1",children:[(0,a.jsx)(O.Z,{size:12})," Notas (Opcional)"]}),(0,a.jsx)("textarea",{value:y,onChange:e=>w(e.target.value),placeholder:"Detalles adicionales...",className:"w-full px-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 text-white outline-none min-h-[80px] text-sm resize-none placeholder:text-slate-600"})]}),(0,a.jsx)("div",{className:"pt-2",children:(0,a.jsxs)("button",{type:"submit",className:"w-full py-3 bg-cyan-500 hover:bg-cyan-400 text-white font-semibold rounded-lg shadow-lg shadow-cyan-500/20 transition-all active:scale-[0.98]",children:["Agregar ","fixed"===r?"Gasto Fijo":"Gasto"]})})]})]})}):null}var R=s(2805);let _=[{name:"Slate",value:"#64748b"},{name:"Blue",value:"#3b82f6"},{name:"Cyan",value:"#06b6d4"},{name:"Emerald",value:"#10b981"},{name:"Violet",value:"#8b5cf6"},{name:"Rose",value:"#f43f5e"},{name:"Amber",value:"#f59e0b"}];function q(e){let{isOpen:t,onClose:s}=e,r=(0,C.J)(e=>e.addCreditCard),[n,i]=(0,l.useState)(""),[c,d]=(0,l.useState)(""),[x,u]=(0,l.useState)(""),[m,p]=(0,l.useState)(""),[h,g]=(0,l.useState)(""),[b,f]=(0,l.useState)(_[1].value);return t?(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4 animate-in fade-in duration-200",children:(0,a.jsxs)("div",{className:"w-full max-w-lg rounded-xl bg-slate-900 border border-slate-800 shadow-2xl overflow-hidden scale-100 animate-in zoom-in-95 duration-200",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-slate-800",children:[(0,a.jsxs)("h2",{className:"text-xl font-semibold text-white flex items-center gap-2",children:[(0,a.jsx)(j.Z,{className:"text-cyan-500"})," Nueva Tarjeta"]}),(0,a.jsx)("button",{onClick:s,className:"text-slate-400 hover:text-white transition-colors",children:(0,a.jsx)(z.Z,{size:20})})]}),(0,a.jsxs)("form",{onSubmit:e=>{e.preventDefault(),n&&x&&m&&h&&(r({name:n,lastFourDigits:c||"****",closingDay:parseInt(m),dueDay:parseInt(h),currentBalance:0,creditLimit:parseFloat(x),color:b}),i(""),d(""),u(""),p(""),g(""),f(_[1].value),s())},className:"p-6 space-y-5",children:[(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,a.jsxs)("div",{className:"col-span-2 space-y-2",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider",children:"Nombre Banco / Tarjeta"}),(0,a.jsx)("input",{type:"text",placeholder:"Ej: Visa Santander",value:n,onChange:e=>i(e.target.value),className:"w-full px-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 text-white outline-none",required:!0,autoFocus:!0})]}),(0,a.jsxs)("div",{className:"col-span-1 space-y-2",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider",children:"Ult. 4 Dig."}),(0,a.jsx)("input",{type:"text",maxLength:4,placeholder:"1234",value:c,onChange:e=>d(e.target.value),className:"w-full px-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 text-white outline-none text-center tracking-widest"})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider",children:"L\xedmite de Cr\xe9dito"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("span",{className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400 font-semibold",children:"$"}),(0,a.jsx)("input",{type:"number",step:"0.01",placeholder:"0.00",value:x,onChange:e=>u(e.target.value),className:"w-full pl-8 pr-4 py-3 bg-slate-950 border border-slate-800 rounded-lg focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 text-white text-lg font-mono outline-none",required:!0})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider",children:"D\xeda Cierre"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{type:"number",min:"1",max:"31",placeholder:"20",value:m,onChange:e=>p(e.target.value),className:"w-full px-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 text-white outline-none",required:!0}),(0,a.jsx)("span",{className:"absolute right-4 top-1/2 -translate-y-1/2 text-slate-500 text-sm",children:"del mes"})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider",children:"D\xeda Vencimiento"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{type:"number",min:"1",max:"31",placeholder:"5",value:h,onChange:e=>g(e.target.value),className:"w-full px-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 text-white outline-none",required:!0}),(0,a.jsx)("span",{className:"absolute right-4 top-1/2 -translate-y-1/2 text-slate-500 text-sm",children:"del mes"})]})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("label",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider flex items-center gap-2",children:[(0,a.jsx)(R.Z,{size:12})," Color de Tarjeta"]}),(0,a.jsx)("div",{className:"flex gap-3 overflow-x-auto pb-2",children:_.map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>f(e.value),className:(0,o.cn)("w-8 h-8 rounded-full border-2 transition-all",b===e.value?"border-white scale-110 shadow-lg":"border-transparent opacity-70 hover:opacity-100 hover:scale-105"),style:{backgroundColor:e.value},title:e.name},e.value))})]}),(0,a.jsx)("div",{className:"pt-2",children:(0,a.jsx)("button",{type:"submit",className:"w-full py-3 bg-cyan-500 hover:bg-cyan-400 text-white font-semibold rounded-lg shadow-lg shadow-cyan-500/20 transition-all active:scale-[0.98]",children:"Crear Tarjeta"})})]})]})}):null}var G=s(8124);function J(e){var t;let{isOpen:s,onClose:r}=e,n=(0,C.J)(e=>e.creditCards),i=(0,C.J)(e=>e.addCardPayment),[c,d]=(0,l.useState)((null===(t=n[0])||void 0===t?void 0:t.id)||""),[x,u]=(0,l.useState)(""),[m,p]=(0,l.useState)(""),[h,g]=(0,l.useState)(new Date().toISOString().split("T")[0]),[b,f]=(0,l.useState)(!1),[v,N]=(0,l.useState)("1"),[y,w]=(0,l.useState)("12");return s?(!c&&n.length>0&&d(n[0].id),(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4 animate-in fade-in duration-200",children:(0,a.jsxs)("div",{className:"w-full max-w-lg rounded-xl bg-slate-900 border border-slate-800 shadow-2xl overflow-hidden scale-100 animate-in zoom-in-95 duration-200",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-slate-800",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-white",children:"Registrar Consumo / Pago"}),(0,a.jsx)("button",{onClick:r,className:"text-slate-400 hover:text-white transition-colors",children:(0,a.jsx)(z.Z,{size:20})})]}),0===n.length?(0,a.jsxs)("div",{className:"p-8 text-center space-y-4",children:[(0,a.jsx)(j.Z,{className:"mx-auto text-slate-600 mb-2",size:48}),(0,a.jsx)("h3",{className:"text-lg font-medium text-white",children:"No tienes tarjetas registradas"}),(0,a.jsx)("p",{className:"text-slate-400",children:"Debes agregar una tarjeta antes de registrar pagos."}),(0,a.jsx)("button",{onClick:r,className:"px-4 py-2 bg-slate-800 hover:bg-slate-700 text-white rounded-lg transition",children:"Entendido"})]}):(0,a.jsxs)("form",{onSubmit:e=>{e.preventDefault(),x&&m&&c&&(i({cardId:c,amount:parseFloat(m),date:new Date(h).toISOString(),description:x,installments:b?{current:parseInt(v),total:parseInt(y)}:void 0}),u(""),p(""),f(!1),N("1"),w("12"),r())},className:"p-6 space-y-5",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider",children:"Tarjeta"}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 max-h-[120px] overflow-y-auto pr-1",children:n.map(e=>(0,a.jsxs)("div",{onClick:()=>d(e.id),className:(0,o.cn)("cursor-pointer p-3 rounded-lg border flex items-center gap-3 transition-all",c===e.id?"border-cyan-500 bg-cyan-500/10 ring-1 ring-cyan-500":"border-slate-800 bg-slate-950 hover:border-slate-700"),children:[(0,a.jsx)("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:e.color}}),(0,a.jsxs)("div",{className:"flex flex-col truncate",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-white truncate",children:e.name}),(0,a.jsxs)("span",{className:"text-xs text-slate-500",children:["**** ",e.lastFourDigits]})]})]},e.id))})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider",children:"Monto"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("span",{className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400 font-semibold",children:"$"}),(0,a.jsx)("input",{type:"number",step:"0.01",placeholder:"0.00",value:m,onChange:e=>p(e.target.value),className:"w-full pl-8 pr-4 py-3 bg-slate-950 border border-slate-800 rounded-lg focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 text-white text-lg font-mono outline-none",required:!0,autoFocus:!0})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider",children:"Descripci\xf3n"}),(0,a.jsx)("input",{type:"text",placeholder:"Ej: Cena McDonalds, Compra ML",value:x,onChange:e=>u(e.target.value),className:"w-full px-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 text-white outline-none",required:!0})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("label",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider flex items-center gap-1",children:[(0,a.jsx)(P.Z,{size:12})," Fecha"]}),(0,a.jsx)("input",{type:"date",value:h,onChange:e=>g(e.target.value),className:"w-full px-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 text-white outline-none [color-scheme:dark]",required:!0})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 bg-slate-800/30 rounded-lg cursor-pointer",onClick:()=>f(!b),children:[(0,a.jsx)("div",{className:(0,o.cn)("w-5 h-5 rounded border flex items-center justify-center transition-colors",b?"bg-cyan-500 border-cyan-500":"border-slate-600 bg-transparent"),children:b&&(0,a.jsx)(G.Z,{size:14,className:"text-white"})}),(0,a.jsx)("span",{className:"text-sm text-slate-300 select-none",children:"Es una compra en cuotas"})]}),b&&(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 animate-in slide-in-from-top-2",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider",children:"Cuota N\xb0"}),(0,a.jsx)("input",{type:"number",min:"1",value:v,onChange:e=>N(e.target.value),className:"w-full px-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg text-white"})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider",children:"Total Cuotas"}),(0,a.jsx)("input",{type:"number",min:"1",value:y,onChange:e=>w(e.target.value),className:"w-full px-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg text-white"})]})]}),(0,a.jsx)("div",{className:"pt-2",children:(0,a.jsx)("button",{type:"submit",className:"w-full py-3 bg-cyan-500 hover:bg-cyan-400 text-white font-semibold rounded-lg shadow-lg shadow-cyan-500/20 transition-all active:scale-[0.98]",children:"Registrar Pago"})})]})]})})):null}function M(){let e=(0,A.A)(),t=(0,C.J)(e=>e.markAlertAsRead),s=(0,C.J)(e=>e.deleteAlert),{unreadAlerts:n,unreadCount:i,regenerateAlerts:o}=(0,F.Z7)(),[c,d]=(0,l.useState)(!1),[x,u]=(0,l.useState)(!1),[m,p]=(0,l.useState)(!1);(0,l.useEffect)(()=>{o()},[o]),(0,l.useEffect)(()=>{let t=()=>{window.innerWidth>=1024?e.open():e.close()};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[e]);let h=n.slice(0,3);return(0,a.jsxs)("div",{className:"flex min-h-screen bg-slate-950",children:[(0,a.jsx)(r.YE,{isOpen:e.isOpen,onClose:e.close,unreadAlertsCount:i}),(0,a.jsxs)("div",{className:"flex flex-1 flex-col lg:ml-0",children:[(0,a.jsx)(r.h4,{onMenuClick:e.toggle,title:"Dashboard"}),(0,a.jsx)("main",{className:"flex-1 p-4 md:p-6 lg:p-8 pb-20 lg:pb-8",children:(0,a.jsxs)("div",{className:"mx-auto max-w-7xl space-y-6",children:[h.length>0&&(0,a.jsx)("div",{className:"space-y-3",children:h.map(e=>(0,a.jsx)(F.Y0,{alert:e,onDismiss:()=>s(e.id),onMarkRead:()=>t(e.id)},e.id))}),(0,a.jsx)(S,{}),(0,a.jsx)(N,{onAddDebt:()=>{d(!0)},onAddCard:()=>{u(!0)},onAddPayment:()=>{p(!0)}}),(0,a.jsx)(Z,{limit:5})]})})]}),(0,a.jsx)(r.zM,{unreadAlertsCount:i}),(0,a.jsx)(I,{isOpen:c,onClose:()=>d(!1)}),(0,a.jsx)(q,{isOpen:x,onClose:()=>u(!1)}),(0,a.jsx)(J,{isOpen:m,onClose:()=>p(!1)})]})}}},function(e){e.O(0,[697,71,796,838,489,971,117,744],function(){return e(e.s=2422)}),_N_E=e.O()}]);