1import{r as c,j as e,Z as k}from"./index-BV1hn8pg.js";import{C as N}from"./chevron-left-BLhhIh8b.js";import{R as u,T as b,a3 as h}from"./generateCategoricalChart-nBdWBG8C.js";import{A as g}from"./AreaChart-BOX95vqa.js";import{C as m,X as y,Y as j,A as p}from"./YAxis-C9Javs_p.js";import"./index-GJcVpAAA.js";import"./index-jtQY2-DT.js";const D=[{year:1950,lifeExpectancy:68,pensionDesign:75},{year:1960,lifeExpectancy:70,pensionDesign:75},{year:1970,lifeExpectancy:72,pensionDesign:75},{year:1980,lifeExpectancy:74,pensionDesign:75},{year:1990,lifeExpectancy:76,pensionDesign:75},{year:2e3,lifeExpectancy:78,pensionDesign:75},{year:2010,lifeExpectancy:81,pensionDesign:75},{year:2020,lifeExpectancy:83,pensionDesign:75},{year:2030,lifeExpectancy:86,pensionDesign:75},{year:2040,lifeExpectancy:90,pensionDesign:75}],C=({active:r,payload:t,label:d})=>{var l,f;if(!r||!(t!=null&&t.length))return null;const s=(l=t.find(x=>x.dataKey==="lifeExpectancy"))==null?void 0:l.value,n=(f=t.find(x=>x.dataKey==="pensionDesign"))==null?void 0:f.value,i=s&&n&&s>n?s-n:0;return e.jsxs("div",{className:"bg-card/95 backdrop-blur border border-border/50 rounded-lg px-4 py-3 text-sm shadow-xl",children:[e.jsx("p",{className:"font-mono text-foreground font-semibold mb-1",children:d}),e.jsxs("p",{className:"text-foreground",children:["Life expectancy: ",s]}),e.jsxs("p",{className:"text-muted-foreground",children:["Pension designed for: ",n]}),i>0&&e.jsxs("p",{style:{color:"#f59e0b"},className:"mt-1 border-t border-border/30 pt-1",children:["Uncovered: ",e.jsxs("span",{className:"font-semibold",children:[i," yrs"]})]})]})},w=()=>e.jsxs("div",{className:"w-full space-y-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-3xl md:text-4xl font-bold font-mono text-foreground",children:"15 yrs"}),e.jsx("p",{className:"text-xs text-muted-foreground tracking-wide",children:"gap between pension design age & projected lifespan by 2040"})]}),e.jsx("div",{className:"w-full h-[280px]",children:e.jsx(u,{width:"100%",height:"100%",children:e.jsxs(g,{data:D,margin:{top:10,right:30,left:5,bottom:0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"uncoveredFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#f59e0b",stopOpacity:.3}),e.jsx("stop",{offset:"100%",stopColor:"#f59e0b",stopOpacity:.05})]})}),e.jsx(m,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",opacity:.2}),e.jsx(y,{dataKey:"year",tick:{fill:"hsl(var(--muted-foreground))",fontSize:11},axisLine:!1,tickLine:!1}),e.jsx(j,{tick:{fill:"hsl(var(--muted-foreground))",fontSize:11},axisLine:!1,tickLine:!1,domain:[60,95],tickFormatter:r=>`${r}`}),e.jsx(b,{content:e.jsx(C,{})}),e.jsx(p,{type:"monotone",dataKey:"lifeExpectancy",stroke:"hsl(var(--foreground))",strokeWidth:2,fill:"url(#uncoveredFill)",fillOpacity:1,dot:!1,activeDot:{r:4,fill:"hsl(var(--foreground))"}}),e.jsx(p,{type:"monotone",dataKey:"pensionDesign",stroke:"hsl(var(--muted-foreground))",strokeWidth:1.5,strokeDasharray:"6 3",fill:"transparent",dot:!1}),e.jsx(h,{y:75,stroke:"transparent",label:{value:"Pension ceiling (age 75)",fill:"hsl(var(--muted-foreground))",fontSize:10,position:"right"}})]})})}),e.jsxs("div",{className:"flex justify-center gap-6 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-3 h-0.5 rounded bg-foreground"})," Life expectancy"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-3 h-0.5 rounded border-b border-dashed border-muted-foreground"})," Pension design age"]})]})]}),E=[{age:65,probability:0},{age:68,probability:2},{age:70,probability:4},{age:72,probability:7},{age:74,probability:11},{age:76,probability:16},{age:78,probability:23},{age:80,probability:31},{age:82,probability:40},{age:84,probability:48},{age:86,probability:56},{age:88,probability:64},{age:90,probability:72},{age:92,probability:79},{age:95,probability:88}],L=({active:r,payload:t,label:d})=>{var n;if(!r||!(t!=null&&t.length))return null;const s=(n=t[0])==null?void 0:n.value;return e.jsxs("div",{className:"bg-card/95 backdrop-blur border border-border/50 rounded-lg px-4 py-3 text-sm shadow-xl",children:[e.jsxs("p",{className:"font-mono text-foreground font-semibold mb-1",children:["Age ",d]}),e.jsxs("p",{style:{color:s>=50?"#ff6b6b":"#f59e0b"},children:["Depletion probability: ",e.jsxs("span",{className:"font-semibold",children:[s,"%"]})]})]})},S=()=>e.jsxs("div",{className:"w-full space-y-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-3xl md:text-4xl font-bold font-mono text-foreground",children:"50%"}),e.jsx("p",{className:"text-xs text-muted-foreground tracking-wide",children:"chance of outliving savings by age 86"})]}),e.jsx("div",{className:"w-full h-[280px]",children:e.jsx(u,{width:"100%",height:"100%",children:e.jsxs(g,{data:E,margin:{top:10,right:30,left:5,bottom:0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"depletionFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#ff6b6b",stopOpacity:.35}),e.jsx("stop",{offset:"100%",stopColor:"#ff6b6b",stopOpacity:.03})]})}),e.jsx(m,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",opacity:.2}),e.jsx(y,{dataKey:"age",tick:{fill:"hsl(var(--muted-foreground))",fontSize:11}
1,axisLine:!1,tickLine:!1}),e.jsx(j,{tick:{fill:"hsl(var(--muted-foreground))",fontSize:11},axisLine:!1,tickLine:!1,domain:[0,100],tickFormatter:r=>`${r}%`}),e.jsx(b,{content:e.jsx(L,{})}),e.jsx(h,{y:50,stroke:"hsl(var(--muted-foreground))",strokeDasharray:"4 4",strokeOpacity:.5,label:{value:"50% threshold",fill:"hsl(var(--muted-foreground))",fontSize:10,position:"left"}}),e.jsx(p,{type:"monotone",dataKey:"probability",stroke:"#ff6b6b",strokeWidth:2.5,fill:"url(#depletionFill)",fillOpacity:1,dot:!1,activeDot:{r:5,fill:"#ff6b6b"}})]})})}),e.jsx("p",{className:"text-[10px] text-muted-foreground/60 text-center",children:"Based on median EU savings (Eurostat HFCS 2023), 4% withdrawal rate. Sources: Milevsky (2012), OECD Pensions at a Glance 2023"})]}),O=["Pension Gap","Outliving Savings"],G=()=>{const[r,t]=c.useState(0),d=c.useRef(null),[s,n]=c.useState(!1),i=c.useRef(null);c.useEffect(()=>{const o=d.current;if(!o)return;const a=new IntersectionObserver(([v])=>{v.isIntersecting&&(n(!0),a.disconnect())},{threshold:.3});return a.observe(o),()=>a.disconnect()},[]);const l=c.useCallback(()=>{i.current&&clearInterval(i.current),i.current=setInterval(()=>t(o=>(o+1)%2),8e3)},[]);c.useEffect(()=>{if(s)return l(),()=>{i.current&&clearInterval(i.current)}},[s,l]);const f=o=>{t(a=>
1(a+o+2)%2),l()},x=[e.jsx(w,{}),e.jsx(S,{})];return e.jsxs("div",{ref:d,className:"w-full space-y-3",children:[e.jsxs("div",{className:"relative min-h-[400px]",children:[x[r],e.jsx("button",{onClick:()=>f(-1),className:"absolute left-0 top-1/2 -translate-y-1/2 -translate-x-2 p-1.5 rounded-full bg-card/80 border border-border/30 text-muted-foreground hover:text-foreground transition-colors","aria-label":"Previous chart",children:e.jsx(N,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>f(1),className:"absolute right-0 top-1/2 -translate-y-1/2 translate-x-2 p-1.5 rounded-full bg-card/80 border border-border/30 text-muted-foreground hover:text-foreground transition-colors","aria-label":"Next chart",children:e.jsx(k,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"flex justify-center items-center gap-3",children:O.map((o,a)=>e.jsx("button",{onClick:()=>{t(a),l()},className:`text-[10px] px-2 py-1 rounded-full border transition-all ${a===r?"border-primary/50 bg-primary/10 text-foreground":"border-border/30 text-muted-foreground hover:text-foreground"}`,children:o},o))})]})};export{G as FinancialResilienceChart};
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.