import{n as e}from"./rolldown-runtime-CpWojdLp.js";import{n as t,t as n}from"./jsx-runtime-BrKkGzFB.js";import{t as r}from"./utils--B3oMbdy.js";var i=e({MonthlyGainsChart:()=>u}),a=t(),o=n();function s(e){return typeof e==`number`&&Number.isFinite(e)?e:0}function c(e){let t=e.split(` – `);return t.length===2?`${l(t[0])}–${l(t[1])}`:l(e)}function l(e){let t=e.trim().match(/^(\S+)\s+(\d+(?:-\d+)?)$/u);return t?`${t[1].slice(0,3)} ${t[2]}`:e.length>12?`${e.slice(0,11)}…`:e}function u(e){let t=(0,a.c)(25),{data:n}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Sin períodos configurados.`}),t[0]=e):e=t[0],e}let i;t[1]===n?i=t[2]:(i=Math.max(...n.flatMap(d),1),t[1]=n,t[2]=i);let l=i,u=n.length,f=416/Math.max(u,1),p=f*.29,m;t[3]===l?m=t[4]:(m=l.toFixed(0),t[3]=l,t[4]=m);let h;t[5]===m?h=t[6]:(h=(0,o.jsxs)(`text`,{className:`fill-muted-foreground`,fontSize:10,x:48,y:14,children:[`Máximo `,m,` US$ en el período`]}),t[5]=m,t[6]=h);let g,_;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,o.jsx)(`line`,{className:`stroke-border`,strokeWidth:1,x1:48,x2:464,y1:132,y2:132}),_=(0,o.jsx)(`line`,{className:`stroke-border opacity-40`,strokeWidth:1,x1:48,x2:48,y1:20,y2:132}),t[7]=g,t[8]=_):(g=t[7],_=t[8]);let v;if(t[9]!==f||t[10]!==n||t[11]!==l||t[12]!==p){let e;t[14]!==f||t[15]!==l||t[16]!==p?(e=(e,t)=>{let n=s(e.projectedUsd),i=48+t*f+f*.14,a=i,u=i+p+f*.14,d=n/l*112*.98,m=132-Math.max(d,3),h=e.actualUsd!==null,g=s(e.actualUsd??0),_=h?g/l*112*.98:0,v=h?132-Math.max(_,3):132;return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`title`,{children:`${e.label} — proyectado US$ ${n.toFixed(2)}; acreditado ${h?`US$ ${g.toFixed(2)}`:`sin registrar`}`}),(0,o.jsx)(`rect`,{className:`fill-muted-foreground/45`,height:132-m,rx:5,width:p,x:a,y:m}),(0,o.jsx)(`rect`,{className:r(h?`fill-primary`:`fill-transparent stroke-border opacity-55`),height:h?Math.max(132-v,3):2,rx:5,strokeDasharray:h?void 0:`2 4`,width:p,x:u,y:h?v:130}),(0,o.jsx)(`text`,{className:`fill-muted-foreground`,dominantBaseline:`hanging`,fontSize:9,textAnchor:`middle`,x:i+f/2-f*.14/2,y:138,children:c(e.label)})]},e.label)},t[14]=f,t[15]=l,t[16]=p,t[17]=e):e=t[17],v=n.map(e),t[9]=f,t[10]=n,t[11]=l,t[12]=p,t[13]=v}else v=t[13];let y;t[18]!==h||t[19]!==v?(y=(0,o.jsx)(`div`,{className:`overflow-x-auto`,children:(0,o.jsxs)(`svg`,{"aria-label":`Comparativa de ganancia mensual proyectada y acreditada`,className:`min-h-[220px] min-w-[500px] w-full max-w-[640px] text-muted-foreground`,role:`img`,viewBox:`0 0 480 168`,preserveAspectRatio:`xMidYMid meet`,children:[h,g,_,v]})}),t[18]=h,t[19]=v,t[20]=y):y=t[20];let b;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,o.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,o.jsx)(`span`,{className:`inline-block size-3 rounded-sm bg-muted-foreground/45`}),` `,`Proyectado (plan pactado sobre capital).`]}),t[21]=b):b=t[21];let x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,o.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-2 text-xs text-muted-foreground`,children:[b,(0,o.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,o.jsx)(`span`,{className:`inline-block size-3 rounded-sm bg-primary`}),` `,`Acreditado (suma de días en ese mes calendario).`]})]}),t[22]=x):x=t[22];let S;return t[23]===y?S=t[24]:(S=(0,o.jsxs)(`div`,{className:`space-y-3`,children:[y,x]}),t[23]=y,t[24]=S),S}function d(e){return[s(e.projectedUsd),s(e.actualUsd??0)]}export{i as n,u as t};