1import{r as n,j as e}from"./react-core-SaLnwSRd.js";import{C as W}from"./clock-CybSkUW5.js";import{k as R,C as P,m as I}from"./index-CRJ-gAjQ.js";import{C as T}from"./copy-B09pROQG.js";const Y=({theme:E})=>{const[o,m]=n.useState(65e4),[l,y]=n.useState(3800),[i,f]=n.useState(6),[d,w]=n.useState(2.5),[s,j]=n.useState(1400),[p,b]=n.useState(!1),a=n.useMemo(()=>{let t=o;const c=i/100/12,k=d/100/12;let x=Math.max(0,l-s),h=0,r=0;const v=1200,u=[],M=t*c>=x&&i-d>0&&l>0;for(;t>0&&r<v;){r++;const L=t*c;t+=L;const g=Math.min(t,x);t-=g,h+=g+s,x*=1+k,(r%12===0||t<=0)&&u.push({year:Math.ceil(r/12),balance:Math.max(0,Math.round(t)),monthlyWithdrawal:Math.round(x+s),totalWithdrawn:Math.round(h)})}const S=Math.floor(r/12),$=r%12,C=o*.04/12+s;return{years:S,remainingMonths:$,months:r,isPerpetual:M,totalWithdrawn:Math.round(h),safe4PercentMonthly:Math.round(C),yearlyMilestones:u.slice(0,35)}},[o,l,i,d,s]),N=()=>{const t=`Savings Longevity: Nest Egg $${o.toLocaleString()}, Monthly Spending $${l.toLocaleString()}/mo, Return ${i}%, Inflation ${d}%. Projected Longevity: ${a.isPerpetual?"Perpetual (Indefinite)":`${a.years} years and ${a.remainingMonths} months`}. Total Withdrawn: $${a.totalWithdrawn.toLocaleString()}`;navigator.clipboard.writeText(t),b(!0),setTimeout(()=>b(!1),2e3)};return e.jsxs("div",{className:"space-y-8",children:[e.jsx("div",{className:"rounded-3xl bg-linear-to-r from-amber-950 via-slate-900 to-amber-900 text-white p-6 sm:p-8 shadow-xl relative overflow-hidden",children:e.jsxs("div",{className:"relative z-10 max-w-3xl space-y-3",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-bold uppercase tracking-wider bg-white/10 text-amber-300 border border-white/20",children:[e.jsx(W,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Retirement & Savings Drawdown Engine"})]}),e.jsxs("h1",{className:"text-2xl sm:text-4xl font-extrabold font-serif tracking-tight text-white",children:["How Long Will My Money Last ",e.jsx("span",{className:"italic text-amber-300",children:"Calculator"})," 2027"]}),e.jsx("p",{className:"text-slate-200 text-xs sm:text-sm leading-relaxed",children:"Determine exactly how many years and months your retirement savings, 401(k), IRA, or lump sum investment will last with custom monthly spending, inflation adjustments, Social Security offsets, and investment compound growth."})]})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-8",children:[e.jsx("div",{className:"lg:col-span-5 space-y-6",children:e.jsxs("div",{className:"bg-white dark:bg-slate-900 rounded-2xl p-6 border border-slate-200 dark:border-slate-800 shadow-sm space-y-5",children:[e.jsxs("h2",{className:"font-bold text-slate-900 dark:text-white text-base flex items-center gap-2 border-b border-slate-100 dark:border-slate-800 pb-3",children:[e.jsx(R,{className:"w-4 h-4 text-amber-600"}),"Savings & Spending Inputs"]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-slate-700 dark:text-slate-300 flex justify-between",children:[e.jsx("span",{children:"Current Total Savings / Nest Egg ($):"}),e.jsxs("span",{className:"font-mono text-emerald-600 font-bold",children:["$",o.toLocaleString()]})]}),e.jsx("input",{type:"number",step:"10000",min:"1000",value:o,onChange:t=>m(parseFloat(t.target.value)||0),className:"w-full px-3.5 py-2 text-sm font-bold rounded-xl border border-slate-300 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-900 dark:text-white font-mono"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-slate-700 dark:text-slate-300 flex justify-between",children:[e.jsx("span",{children:"Desired Monthly Total Spending ($):"}),e.jsxs("span",{className:"font-mono text-amber-600 font-bold",children:["$",l.toLocaleString(),"/mo"]})]}),e.jsx("input",{type:"number",step:"200",min:"100",value:l,onChange:t=>y(parseFloat(t.target.value)||0),className:"w-full px-3.5 py-2 text-sm font-bold rounded-xl border border-slate-300 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-900 dark:text-white font-mono"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-slate-700 dark:text-slate-300 flex justify-between",children:[e.jsx("span",{children:"Monthly Guaranteed Income (Social Security / Pension):"}),e.jsxs("span",{className:"font-mono text-blue-600 font-bold",children:["$",s.toLocaleStr
1ing(),"/mo"]})]}),e.jsx("input",{type:"number",step:"100",min:"0",value:s,onChange:t=>j(parseFloat(t.target.value)||0),className:"w-full px-3.5 py-2 text-sm font-bold rounded-xl border border-slate-300 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-900 dark:text-white font-mono"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-1",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs font-bold text-slate-700 dark:text-slate-300",children:"Annual Return (%):"}),e.jsx("input",{type:"number",step:"0.5",value:i,onChange:t=>f(parseFloat(t.target.value)||0),className:"w-full px-3 py-2 text-xs font-bold rounded-xl border border-slate-300 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-900 dark:text-white font-mono text-center"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs font-bold text-slate-700 dark:text-slate-300",children:"Annual Inflation (%):"}),e.jsx("input",{type:"number",step:"0.5",value:d,onChange:t=>w(parseFloat(t.target.value)||0),className:"w-full px-3 py-2 text-xs font-bold rounded-xl border border-slate-300 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-900 dark:text-white font-mono text-center"})]})]}),e.jsxs("div",{className:"pt-2 border-t border-slate-100 dark:border-slate-800",children:[e.jsx("span",{className:"text-[11px] font-bold text-slate-400 block mb-2",children:"Nest Egg Presets:"}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{b:25e4,label:"$250k"},{b:5e5,label:"$500k"},{b:75e4,label:"$750k"},{b:1e6,label:"$1.0M"},{b:15e5,label:"$1.5M"},{b:2e6,label:"$2.0M"}].map((t,c)=>e.jsx("button",{type:"button",onClick:()=>m(t.b),className:"py-1.5 px-2 text-xs font-semibold rounded-lg bg-slate-100 dark:bg-slate-800 hover:bg-amber-50 dark:hover:bg-amber-950 text-slate-700 dark:text-slate-300 hover:text-amber-700 cursor-pointer text-center",children:t.label},c))})]})]})}),e.jsxs("div",{className:"lg:col-span-7 space-y-6",children:[e.jsxs("div",{className:"p-6 rounded-2xl bg-slate-950 text-white border border-slate-800 shadow-xl space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-bold uppercase tracking-widest text-amber-400 flex items-center gap-1.5",children:[e.jsx(P,{className:"w-4 h-4 text-emerald-400"}),"Projected Longevity Duration"]}),e.jsxs("button",{type:"button",onClick:N,className:"px-3 py-1 rounded-lg bg-white/10 hover:bg-white/20 text-xs font-semibold flex items-center gap-1 cursor-pointer transition-colors",children:[p?e.jsx(I,{className:"w-3.5 h-3.5 text-emerald-400"}):e.jsx(T,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:p?"Copied!":"Copy Summary"})]})]}),e.jsxs("div",{className:"text-center py-4 space-y-1",children:[e.jsx("span",{className:"text-xs text-slate-400 uppercase tracking-wider block",children:"Your money will last:"}),e.jsx("div",{className:"text-3xl sm:text-5xl font-black font-serif text-amber-300 tracking-tight",children:a.isPerpetual?"Forever (Perpetual Wealth)":`${a.years} Years, ${a.remainingMonths} Months`}),e.jsx("p",{className:"text-xs text-slate-300 pt-1",children:a.isPerpetual?"Your portfolio annual growth outpaces your inflation-adjusted net withdrawals.":`Net monthly portfolio withdrawal starts at $${Math.max(0,l-s).toLocaleString()}/mo and escalates at ${d}% annual inflation.`})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2 border-t border-slate-800 text-xs",children:[e.jsxs("div",{className:"p-3 rounded-xl bg-white/5 border border-white/10",children:[e.jsx("span",{className:"text-slate-400 block",children:"Total Lifetime Withdrawn:"}),e.jsxs("span",{className:"font-mono font-bold text-emerald-400 text-sm sm:text-base",children:["$",a.totalWithdrawn.toLocaleString()]})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-white/5 border border-white/10",children:[e.jsx("span",{className:"text-slate-400 block",children:"Safe 4% Rule Monthly Total:"}),e.jsxs("span",{className:"font-mono font-bold text-blue-400 text-sm sm:text-base",children:["$",a.safe4PercentMonthly.toLocaleStr
1ing(),"/mo"]})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-slate-900 rounded-2xl p-6 border border-slate-200 dark:border-slate-800 shadow-sm space-y-4",children:[e.jsx("h3",{className:"font-bold text-slate-900 dark:text-white text-base",children:"Annual Balance & Spending Trajectory"}),e.jsx("div",{className:"overflow-x-auto max-h-72 border border-slate-100 dark:border-slate-800 rounded-xl",children:e.jsxs("table",{className:"w-full text-left text-xs font-mono",children:[e.jsx("thead",{className:"sticky top-0 bg-slate-100 dark:bg-slate-800 text-slate-700 dark:text-slate-300 uppercase text-[10px] tracking-wider",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-2.5 px-3",children:"Year"}),e.jsx("th",{className:"py-2.5 px-3",children:"Ending Balance"}),e.jsx("th",{className:"py-2.5 px-3",children:"Monthly Spending"}),e.jsx("th",{className:"py-2.5 px-3",children:"Cumul. Withdrawn"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-100 dark:divide-slate-800 text-slate-600 dark:text-slate-300",children:a.yearlyMilestones.map(t=>e.jsxs("tr",{className:t.balance===0?"bg-rose-50/70 dark:bg-rose-950/40 font-bold":"",children:[e.jsxs("td",{className:"py-2 px-3 font-semibold text-slate-900 dark:text-white",children:["Year ",t.year]}),e.jsxs("td",{className:"py-2 px-3 font-bold text-slate-900 dark:text-white",children:["$",t.balance.toLocaleString()]}),e.jsxs("td",{className:"py-2 px-3 text-amber-600",children:["$",t.monthlyWithdrawal.toLocaleString(),"/mo"]}),e.jsxs("td",{className:"py-2 px-3 text-emerald-600",children:["$",t.totalWithdrawn.toLocaleString()]})]},t.year))})]})})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-slate-900 rounded-3xl p-6 sm:p-8 border border-slate-200 dark:border-slate-800 shadow-sm space-y-6",children:[e.jsx("h2",{className:"text-xl sm:text-2xl font-extrabold font-serif text-slate-900 dark:text-white",children:"Retirement Longevity & Safe Drawdown FAQs"}),e.jsxs("div",{className:"space-y-4 text-sm",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h3",{className:"font-bold text-slate-900 dark:text-white",children:"What is the 4% Safe Withdrawal Rule in retirement planning?"}),e.jsx("p",{className:"text-xs text-slate-600 dark:text-slate-400 leading-relaxed",children:"Based on the Trinity Study, the 4% rule states that if you withdraw 4% of your starting portfolio value in your first year of retirement and adjust subsequent annual withdrawals for inflation, your savings has a 95%+ historical probability of lasting at least 30 years across a standard 50/50 stock-and-bond allocation."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h3",{className:"font-bold text-slate-900 dark:text-white",children:"How does inflation impact retirement longevity?"}),e.jsx("p",{className:"text-xs text-slate-600 dark:text-slate-400 leading-relaxed",children:"Even modest 2.5%â3.0% annual inflation compounds dramatically over 25 to 30 years. A $4,000 monthly budget today requires approximately $8,380 per month after 30 years at 2.5% inflation just to maintain the exact same purchasing power."})]})]})]})]})};export{Y as HowLongMoneyLastCalculator};
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.