import{n as e,r as t}from"./rolldown-runtime-CpWojdLp.js";import{n,r,t as i}from"./jsx-runtime-BrKkGzFB.js";import{t as a}from"./minus-Cp1h5Y3f.js";import{t as o}from"./plus-ButcMK4X.js";import{B as s}from"./app-KzKSswgw.js";import{t as ee}from"./label-1JB2VirV.js";import{a as c,i as l,n as u,o as d,r as f}from"./utils-Bv0pu62v.js";var p=e({InvestmentAmountField:()=>v}),m=n(),h=t(r(),1),g=i();function _(e,t){let n=t-e;return n<=1?.01:n<=25?1:n<=500?10:50}function v(e){let t=(0,m.c)(66),{amount:n,minAmount:r,maxAmount:i,reinvestMode:p,onAmountChange:v}=e,y=p===void 0?!1:p,b;t[0]!==i||t[1]!==r?(b=_(r,i),t[0]=i,t[1]=r,t[2]=b):b=t[2];let x=b,S;t[3]===n?S=t[4]:(S=()=>l(n),t[3]=n,t[4]=S);let[C,w]=(0,h.useState)(S),T=(0,h.useRef)(!1),E=(0,h.useRef)(null),D,O;t[5]===n?(D=t[6],O=t[7]):(D=()=>{T.current||w(l(n))},O=[n],t[5]=n,t[6]=D,t[7]=O),(0,h.useEffect)(D,O);let k;t[8]!==i||t[9]!==r||t[10]!==v?(k=function(e){let t=c(e);if(t===null){let e=u(r,r,i);w(l(e)),v(e);return}let n=u(t,r,i);w(l(n)),v(n)},t[8]=i,t[9]=r,t[10]=v,t[11]=k):k=t[11];let A=k,j;t[12]!==n||t[13]!==C||t[14]!==i||t[15]!==r||t[16]!==v?(j=function(e){let t=u((c(C)??n)+e,r,i);w(l(t)),v(t),E.current?.focus()},t[12]=n,t[13]=C,t[14]=i,t[15]=r,t[16]=v,t[17]=j):j=t[17];let M=j,N;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,g.jsx)(ee,{className:`text-xs text-muted-foreground`,htmlFor:`investment_amount_manual`,children:`Monto a invertir`}),t[18]=N):N=t[18];let P;t[19]===r?P=t[20]:(P=f(r),t[19]=r,t[20]=P);let F;t[21]===i?F=t[22]:(F=f(i),t[21]=i,t[22]=F);let I;t[23]===y?I=t[24]:(I=y?(0,g.jsxs)(g.Fragment,{children:[` `,`En `,(0,g.jsx)(`strong`,{className:`text-foreground`,children:`reinversión`}),` el mínimo es tu saldo disponible (desde 0,01 US$).`]}):null,t[23]=y,t[24]=I);let L;t[25]!==F||t[26]!==I||t[27]!==P?(L=(0,g.jsxs)(`div`,{className:`space-y-1`,children:[N,(0,g.jsxs)(`p`,{className:`text-xs text-muted-foreground leading-snug`,children:[`Entre `,P,` y `,F,`.`,I]})]}),t[25]=F,t[26]=I,t[27]=P,t[28]=L):L=t[28];let R=n<=r,z;t[29]!==M||t[30]!==x?(z=()=>M(-x),t[29]=M,t[30]=x,t[31]=z):z=t[31];let B;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,g.jsx)(a,{className:`size-4`}),t[32]=B):B=t[32];let V;t[33]!==R||t[34]!==z?(V=(0,g.jsx)(s,{"aria-label":`Disminuir monto`,className:`h-12 w-12 shrink-0`,disabled:R,size:`icon`,type:`button`,variant:`outline`,onClick:z,children:B}),t[33]=R,t[34]=z,t[35]=V):V=t[35];let H;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,g.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground shrink-0 text-sm font-medium tabular-nums`,children:`US$`}),t[36]=H):H=t[36];let U;t[37]!==A||t[38]!==C?(U=()=>{T.current=!1,A(C)},t[37]=A,t[38]=C,t[39]=U):U=t[39];let W;t[40]!==i||t[41]!==r||t[42]!==v?(W=e=>{let t=d(e.target.value);w(t);let n=c(t);n!==null&&v(u(n,r,i))},t[40]=i,t[41]=r,t[42]=v,t[43]=W):W=t[43];let G;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>{T.current=!0},t[44]=G):G=t[44];let K;t[45]!==C||t[46]!==U||t[47]!==W?(K=(0,g.jsxs)(`div`,{className:`border-primary/25 bg-background focus-within:border-ring focus-within:ring-ring/50 flex min-w-0 flex-1 items-center gap-2 rounded-md border px-3 shadow-xs focus-within:ring-[3px]`,children:[H,(0,g.jsx)(`input`,{ref:E,autoComplete:`off`,autoCorrect:`off`,className:`placeholder:text-muted-foreground min-w-0 flex-1 bg-transparent py-2 text-2xl font-bold tracking-tight text-foreground tabular-nums outline-none sm:text-3xl`,enterKeyHint:`done`,id:`investment_amount_manual`,inputMode:`decimal`,name:`investment_amount`,spellCheck:!1,type:`text`,value:C,onBlur:U,onChange:W,onFocus:G})]}),t[45]=C,t[46]=U,t[47]=W,t[48]=K):K=t[48];let q=n>=i,J;t[49]!==M||t[50]!==x?(J=()=>M(x),t[49]=M,t[50]=x,t[51]=J):J=t[51];let Y;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,g.jsx)(o,{className:`size-4`}),t[52]=Y):Y=t[52];let X;t[53]!==q||t[54]!==J?(X=(0,g.jsx)(s,{"aria-label":`Aumentar monto`,className:`h-12 w-12 shrink-0`,disabled:q,size:`icon`,type:`button`,variant:`outline`,onClick:J,children:Y}),t[53]=q,t[54]=J,t[55]=X):X=t[55];let Z;t[56]!==V||t[57]!==K||t[58]!==X?(Z=(0,g.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[V,K,X]}),t[56]=V,t[57]=K,t[58]=X,t[59]=Z):Z=t[59];let Q;t[60]===x?Q=t[61]:(Q=(0,g.jsxs)(`p`,{className:`text-center text-xs text-muted-foreground`,children:[`Usa el teclado numérico, los botones ±`,x,` o la barra deslizante.`]}),t[60]=x,t[61]=Q);let $;return t[62]!==L||t[63]!==Z||t[64]!==Q?($=(0,g.jsxs)(`div`,{className:`space-y-4 rounded-lg border border-primary/30 bg-primary/10 p-4`,children:[L,Z,Q]}),t[62]=L,t[63]=Z,t[64]=Q,t[65]=$):$=t[65],$}export{p as n,v as t};