PageSourceSearch

https://boldfinance.com.br/assets/CalculadoraIR-DyzVPt2P.js

js boldfinance.com.br collected 2026-10-06 18:39:56 UTC 65,409 bytes, 28 lines download raw bytes

vendor: 17,050 bytes, lines 1-28
1import{c as me,j as e,r as n,a as te,u as H,P as D,b as k,d as je,e as Ne,f as Ce,g as pe,h as oe,i as is,k as Re,l as ls,m as ds,T as K,n as Q,o as W,C as cs,B,p as ye,q as we,s as xe,F as Ae,E as Y,t as Z,v as U,w as Ie,x as us,y as ms,z as ps,H as xs,W as hs}from"./index-POHkpQuJ.js";import{C as $,a as J,b as ne,c as re,I as T}from"./input-ClygXj_b.js";import{C as Ee,a as fs}from"./chevron-up-DNCCsAuK.js";import{L as A}from"./label-0WtgJSvA.js";import{p as _,D as P,C as X,f as be}from"./DualCurrencyInput-D3Jp_rOL.js";import{C as vs,U as bs,M as ge,P as gs,L as _e}from"./user-apQLOHWQ.js";import{D as js,a as Ns,b as Cs,c as Rs,d as ys}from"./dialog-1ORktyIS.js";import{g as ws}from"./authService-D8Gr3nXT.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const As=me("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Is=me("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const Es=me("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),ae=[{id:1,name:"Rendimentos"},{id:2,name:"Descontos"},{id:3,name:"Investimentos"},{id:4,name:"Dados dos Imóveis"}];function _s({currentPhase:s,visitedPhases:a,onPhaseClick:o}){const t=r=>{a.has(r)&&o&&o(r)},m=ae.length>1?Math.min(100,Math.max(0,(s-1)/(ae.length-1)*100)):0;return e.jsx("div",{className:"w-full mb-8",children:e.jsx("div",{className:"max-w-3xl mx-auto px-5",children:e.jsxs("div",{className:"relative flex items-start w-full",children:[e.jsxs("div",{className:"absolute top-5 left-[calc(1.25rem+1.25rem)] right-[calc(1.25rem+1.75rem+0rem)] h-1.5 pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 bg-muted-foreground/30 rounded-full"}),e.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-gradient-to-r from-primary via-primary to-primary/80 transition-all duration-500 ease-out shadow-sm",style:{width:`${m}%`}})]}),ae.map((r,v)=>{const x=r.id===s,f=s>r.id,p=a.has(r.id)&&o;return e.jsxs(n.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center flex-shrink-0 relative z-10",children:[e.jsx("button",{onClick:()=>t(r.id),disabled:!p,className:`
17                      w-10 h-10 rounded-full flex items-center justify-center
18                      transition-all duration-300 border-2 bg-background shadow-sm
19                      ${x?"bg-primary border-primary text-primary-foreground scale-110 shadow-lg":""}
20                      ${f?"bg-primary border-primary text-primary-foreground shadow-md":""}
21                      ${!x&&!f?"border-muted-foreground/40 text-muted-foreground hover:border-muted-foreground/60":""}
22                      ${p?"cursor-pointer hover:scale-105":"cursor-default"}
23                    `,"aria-label":`${r.name} - ${f?"Completo":x?"Em andamento":"Pendente"}`,children:f?e.jsx(Ee,{className:"w-5 h-5"}):e.jsx("span",{className:"text-sm font-semibold",children:r.id})}),e.jsx("div",{className:"mt-2 text-center",children:e.jsx("p",{className:`
24                      text-xs md:text-sm font-medium whitespace-nowrap
25                      ${x?"text-primary":""}
26                      ${f?"text-primary":""}
27                      ${!x&&!f?"text-muted-foreground":""}
28                    `,children:r.name})})]}),v<ae.length-1&&e.jsx("div",{className:"flex-1 min-w-0"})]},r.id)})]})})})}var ie="Checkbox",[Fs,ja]=te(ie),[Ss,he]=Fs(ie);function Ps(s){const{__scopeCheckbox:a,checked:o,children:t,defaultChecked:m,disabled:r,form:v,name:x,onCheckedChange:f,required:i,value:p="on",internal_do_not_use_render:l}=s,[j,d]=pe({prop:o,defaultProp:m??!1,onChange:f,caller:ie}),[N,w]=n.useState(null),[b,R]=n.useState(null),u=n.useRef(!1),C=N?!!v||!!N.closest("form"):!0,c={checked:j,disabled:r,setChecked:d,control:N,setControl:w,name:x,form:v,value:p,hasConsumerStoppedPropagationRef:u,required:i,defaultChecked:V(m)?!1:m,isFormControl:C,bubbleInput:b,setBubbleInput:R};return e.jsx(Ss,{scope:a,...c,children:ks(l)?l(c):t})}var Fe="CheckboxTrigger",Se=n.forwardRef(({__scopeCheckbox:s,onKeyDown:a,onClick:o,...t},m)=>{const{control:r,value:v,disabled:x,checked:f,required:i,setControl:p,setChecked:l,hasConsumerStoppedPropagationRef:j,isFormControl:d,bubbleInput:N}=he(Fe,s),w=H(m,p),b=n.useRef(f);return n.useEffect(()=>{const R=r==null?void 0:r.form;if(R){const u=()=>l(b.current);return R.addEventListener("reset",u),()=>R.removeEventListener("reset",u)}},[r,l]),e.jsx(D.button,{type:"button",role:"checkbox","aria-checked":V(f)?"mixed":f,"aria-required":i,"data-state":qe(f),"data-disabled":x?"":void 0,disabled:x,value:v,...t,ref:w,onKeyDown:k(a,R=>{R.key==="Enter"&&R.preventDefault()}),onClick:k(o,R=>{l(u=>V(u)?!0:!u),N&&d&&(j.current=R.isPropagationStopped(),j.current||R.stopPropagation())})})});Se.displayName=Fe;var fe=n.forwardRef((s,a)=>{const{__scopeCheckbox:o,name:t,checked:m,defaultChecked:r,required:v,disabled:x,value:f,onCheckedChange:i,form:p,...l}=s;return e.jsx(Ps,{__scopeCheckbox:o,checked:m,defaultChecked:r,disabled:x,required:v,onCheckedChange:i,name:t,form:p,value:f,internal_do_not_use_render:({isFormControl:j})=>e.jsxs(e.Fragment,{children:[e.jsx(Se,{...l,ref:a,__scopeCheckbox:o}),j&&e.jsx(Oe,{__scopeCheckbox:o})]})})});fe.displayName=ie;var Pe="CheckboxIndicator",ke=n.forwardRef((s,a)=>{const{__scopeCheckbox:o,forceMount:t,...m}=s,r=he(Pe,o);return e.jsx(je,{present:t||V(r.checked)||r.checked===!0,children:e.jsx(D.span,{"data-state":qe(r.checked),"data-disabled":r.disabled?"":void 0,...m,ref:a,style:{pointerEvents:"none",...s.style}})})});ke.displayName=Pe;var Te="CheckboxBubbleInput",Oe=n.forwardRef(({__scopeCheckbox:s,...a},o)=>{const{control:t,hasConsumerStoppedPropagationRef:m,checked:r,defaultChecked:v,required:x,disabled:f,name:i,value:p,form:l,bubbleInput:j,setBubbleInput:d}=he(Te,s),N=H(o,d),w=Ne(r),b=Ce(t);n.useEffect(()=>{const u=j;if(!u)return;const C=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(C,"checked").set,h=!m.current;if(w!==r&&y){const F=new Event("click",{bubbles:h});u.indeterminate=V(r),y.call(u,V(r)?!1:r),u.dispatchEvent(F)}},[j,w,r,m]);const R=n.useRef(V(r)?!1:r);return e.jsx(D.input,{type:"checkbox","aria-hidden":!0,defaultChecked:v??R.current,required:x,disabled:f,name:i,value:p,form:l,...a,tabIndex:-1,ref:N,style:{...a.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Oe.displayName=Te;function ks(s){return typeof s=="function"}function V(s){return s==="indeterminate"}function qe(s){return V(s)?"indeterminate":s?"checked":"unchecked"}const S=n.forwardRef(({className:s,...a},o)=>e.jsx(fe,{ref:o,className:oe("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",s),...a,children:e.jsx(ke,{className:oe("flex items-center justify-center text-current"),children:e.jsx(Ee,{className:"h-4 w-4"})})}));S.displayName=fe.displayName;function Ts({formData:s,errors:a,onInputChange:o}){const m=_(s.rendaAlugueis)>42e4,[r,v]=n.useState(!1),[x,f]=n.useState(!1),[i,p]=n.useState(!1);return n.useEffect(()=>{const l=_(s.rendasPensoes);l>0?v(!0):(!s.rendasPensoes||l===0)&&v(!1)},[s.rendasPensoes]),n.useEffect(()=>{const l=_(s.rendasAutonomo);l>0?f(!0):(!s.rendasAutonomo||l===0)&&f(!1)},[s.rendasAutonomo]),n.useEffect(()=>{const l=_(s.resultadoAtividadeRural);l>0?p(!0):(!s.resultadoAtividadeRural||l===0)&&p(!1)},[s.resultadoAtividadeRural]),e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"text-center",children:e.jsx("h2",{className:"text-2xl font-bold text-secondary mb-2",children:"Rendimentos Tributáveis"})}),e.jsxs($,{children:[e.jsx("div",{className:"mb-5"}),e.jsxs(J,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(P,{label:"Rendas de aluguéis",tooltip:"Valor recebido líquido de taxas imobiliárias e IPTU não reembolsado.",field:"rendaAlugueis",value:s.rendaAlugueis,onInputChange:o,required:!0,error:a.rendaAlugueis}),m&&e.jsxs("div",{className:"flex items-center space-x-2 pt-3 pl-1",children:[e.jsx(S,{id:"casadoComunhao",checked:s.casadoComunhao,onCheckedChange:l=>o("casadoComunhao",l===!0)}),e.jsx(A,{htmlFor:"casadoComunhao",className:"text-sm font-normal cursor-pointer leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Sou casado(a) em comunhão parcial ou universal de bens"})]})]}),e.jsx(P,{label:"Rendas de Trabalho",tooltip:"Inclui salários, pró-labore, férias, 13º salário e outras remunerações de trabalho assalariado.",field:"rendasTrabalho",value:s.rendasTrabalho,onInputChange:o,error:a.rendasTrabalho}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[e.jsx(S,{id:"showRendasPensoes",checked:r,onCheckedChange:l=>v(l===!0)}),e.jsx(A,{htmlFor:"showRendasPensoes",className:"text-sm font-medium cursor-pointer leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Rendas de pensões e aposentadorias"})]}),r&&e.jsx(P,{label:"",tooltip:"Líquida da parte isenta.",field:"rendasPensoes",value:s.rendasPensoes,onInputChange:o,error:a.rendasPensoes})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[e.jsx(S,{id:"showRendasAutonomo",checked:x,onCheckedChange:l=>f(l===!0)}),e.jsx(A,{htmlFor:"showRendasAutonomo",className:"text-sm font-medium cursor-pointer leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Rendas de autônomos e profissionais liberais"})]}),x&&e.jsx(P,{label:"",tooltip:"Informe o valor recebido por trabalho autônomo ou profissional liberal.",field:"rendasAutonomo",value:s.rendasAutonomo,onInputChange:o,error:a.rendasAutonomo})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[e.jsx(S,{id:"showAtividadeRural",checked:i,onCheckedChange:l=>p(l===!0)}),e.jsx(A,{htmlFor:"showAtividadeRural",className:"text-sm font-medium cursor-pointer leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Resultado positivo da atividade rural"})]}),i&&e.jsx(P,{label:"",tooltip:"Informe o resultado positivo obtido com atividades rurais.",field:"resultadoAtividadeRural",value:s.resultadoAtividadeRural,onInputChange:o,error:a.resultadoAtividadeRural})]})]})]}),a.rendimentos&&e.jsx("p",{className:"text-sm text-destructive text-center",children:a.rendimentos})]})}var de="rovingFocusGroup.onEntryFocus",Os={bubbles:!1,cancelable:!0},ee="RovingFocusGroup",[ce,Le,qs]=is(ee),[Ls,Me]=te(ee,[qs]),[Ms,$s]=Ls(ee),$e=n.forwardRef((s,a)=>e.jsx(ce.Provider,{scope:s.__scopeRovingFocusGroup,children:e.jsx(ce.Slot,{scope:s.__scopeRovingFocusGroup,children:e.jsx(Ds,{...s,ref:a})})}));$e.displayName=ee;var Ds=n.forwardRef((s,a)=>{const{__scopeRovingFocusGroup:o,orientation:t,loop:m=!1,dir:r,currentTabStopId:v,defaultCurrentTabStopId:x,onCurrentTabStopIdChange:f,onEntryFocus:i,preventScrollOnEntryFocus:p=!1,...l}=s,j=n.useRef(null),d=H(a,j),N=Re(r),[w,b]=pe({prop:v,defaultProp:x??null,onChange:f,caller:ee}),[R,u]=n.useState(!1),C=ls(i),c=Le(o),y=n.useRef(!1),[h,F]=n.useState(0);return n.useEffect(()=>{const E=j.current;if(E)return E.addEventListener(de,C),()=>E.removeEventListener(de,C)},[C]),e.jsx(Ms,{scope:o,orientation:t,dir:N,loop:m,currentTabStopId:w,onItemFocus:n.useCallback(E=>b(E),[b]),onItemShiftTab:n.useCallback(()=>u(!0),[]),onFocusableItemAdd:n.useCallback(()=>F(E=>E+1),[]),onFocusableItemRemove:n.useCallback(()=>F(E=>E-1),[]),children:e.jsx(D.div,{tabIndex:R||h===0?-1:0,"data-orientation":t,...l,ref:d,style:{outline:"none",...s.style},onMouseDown:k(s.onMouseDown,()=>{y.current=!0}),onFocus:k(s.onFocus,E=>{const q=!y.current;if(E.target===E.currentTarget&&q&&!R){const O=new CustomEvent(de,Os);if(E.currentTarget.dispatchEvent(O),!O.defaultPrevented){const g=c().filter(M=>M.focusable),G=g.find(M=>M.active),L=g.find(M=>M.id===w),z=[G,L,...g].filter(Boolean).map(M=>M.ref.current);Ve(z,p)}}y.current=!1}),onBlur:k(s.onBlur,()=>u(!1))})})}),De="RovingFocusGroupItem",Ge=n.forwardRef((s,a)=>{const{__scopeRovingFocusGroup:o,focusable:t=!0,active:m=!1,tabStopId:r,children:v,...x}=s,f=ds(),i=r||f,p=$s(De,o),l=p.currentTabStopId===i,j=Le(o),{onFocusableItemAdd:d,onFocusableItemRemove:N,currentTabStopId:w}=p;return n.useEffect(()=>{if(t)return d(),()=>N()},[t,d,N]),e.jsx(ce.ItemSlot,{scope:o,id:i,focusable:t,active:m,children:e.jsx(D.span,{tabIndex:l?0:-1,"data-orientation":p.orientation,...x,ref:a,onMouseDown:k(s.onMouseDown,b=>{t?p.onItemFocus(i):b.preventDefault()}),onFocus:k(s.onFocus,()=>p.onItemFocus(i)),onKeyDown:k(s.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){p.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const R=Bs(b,p.orientation,p.dir);if(R!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let C=j().filter(c=>c.focusable).map(c=>c.ref.current);if(R==="last")C.reverse();else if(R==="prev"||R==="next"){R==="prev"&&C.reverse();const c=C.indexOf(b.currentTarget);C=p.loop?Us(C,c+1):C.slice(c+1)}setTimeout(()=>Ve(C))}}),children:typeof v=="function"?v({isCurrentTabStop:l,hasTabStop:w!=null}):v})})});Ge.displayName=De;var Gs={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Vs(s,a){return a!=="rtl"?s:s==="ArrowLeft"?"ArrowRight":s==="ArrowRight"?"ArrowLeft":s}function Bs(s,a,o){const t=Vs(s.key,o);if(!(a==="vertical"&&["ArrowLeft","ArrowRight"].includes(t))&&!(a==="horizontal"&&["ArrowUp","ArrowDown"].includes(t)))return Gs[t]}function Ve(s,a=!1){const o=document.activeElement;for(const t of s)if(t===o||(t.focus({preventScroll:a}),document.activeElement!==o))return}function Us(s,a){return s.map((o,t)=>s[(a+t)%s.length])}var Js=$e,Hs=Ge,ve="Radio",[zs,Be]=te(ve),[Ks,Qs]=zs(ve),Ue=n.forwardRef((s,a)=>{const{__scopeRadio:o,name:t,checked:m=!1,required:r,disabled:v,value:x="on",onCheck:f,form:i,...p}=s,[l,j]=n.useState(null),d=H(a,b=>j(b)),N=n.useRef(!1),w=l?i||!!l.closest("form"):!0;return e.jsxs(Ks,{scope:o,checked:m,disabled:v,children:[e.jsx(D.button,{type:"button",role:"radio","aria-checked":m,"data-state":Ke(m),"data-disabled":v?"":void 0,disabled:v,value:x,...p,ref:d,onClick:k(s.onClick,b=>{m||f==null||f(),w&&(N.current=b.isPropagationStopped(),N.current||b.stopPropagation())})}),w&&e.jsx(ze,{control:l,bubbles:!N.current,name:t,value:x,checked:m,required:r,disabled:v,form:i,style:{transform:"translateX(-100%)"}})]})});Ue.displayName=ve;var Je="RadioIndicator",He=n.forwardRef((s,a)=>{const{__scopeRadio:o,forceMount:t,...m}=s,r=Qs(Je,o);return e.jsx(je,{present:t||r.checked,children:e.jsx(D.span,{"data-state":Ke(r.checked),"data-disabled":r.disabled?"":void 0,...m,ref:a})})});He.displayName=Je;var Ws="RadioBubbleInput",ze=n.forwardRef(({__scopeRadio:s,control:a,checked:o,bubbles:t=!0,...m},r)=>{const v=n.useRef(null),x=H(v,r),f=Ne(o),i=Ce(a);return n.useEffect(()=>{const p=v.current;if(!p)return;const l=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(l,"checked").set;if(f!==o&&d){const N=new Event("click",{bubbles:t});d.call(p,o),p.dispatchEvent(N)}},[f,o,t]),e.jsx(D.input,{type:"radio","aria-hidden":!0,defaultChecked:o,...m,tabIndex:-1,ref:x,style:{...m.style,...i,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});ze.displayName=Ws;function Ke(s){return s?"checked":"unchecked"}var Xs=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],le="RadioGroup",[Ys,Na]=te(le,[Me,Be]),Qe=Me(),We=Be(),[Zs,ea]=Ys(le),Xe=n.forwardRef((s,a)=>{const{__scopeRadioGroup:o,name:t,defaultValue:m,value:r,required:v=!1,disabled:x=!1,orientation:f,dir:i,loop:p=!0,onValueChange:l,...j}=s,d=Qe(o),N=Re(i),[w,b]=pe({prop:r,defaultProp:m??null,onChange:l,caller:le});return e.jsx(Zs,{scope:o,name:t,required:v,disabled:x,value:w,onValueChange:b,children:e.jsx(Js,{asChild:!0,...d,orientation:f,dir:N,loop:p,children:e.jsx(D.div,{role:"radiogroup","aria-required":v,"aria-orientation":f,"data-disabled":x?"":void 0,dir:N,...j,ref:a})})})});Xe.displayName=le;var Ye="RadioGroupItem",Ze=n.forwardRef((s,a)=>{const{__scopeRadioGroup:o,disabled:t,...m}=s,r=ea(Ye,o),v=r.disabled||t,x=Qe(o),f=We(o),i=n.useRef(null),p=H(a,i),l=r.value===m.value,j=n.useRef(!1);return n.useEffect(()=>{const d=w=>{Xs.includes(w.key)&&(j.current=!0)},N=()=>j.current=!1;return document.addEventListener("keydown",d),document.addEventListener("keyup",N),(
28)=>{document.removeEventListener("keydown",d),document.removeEventListener("keyup",N)}},[]),e.jsx(Hs,{asChild:!0,...x,focusable:!v,active:l,children:e.jsx(Ue,{disabled:v,required:r.required,checked:l,...f,...m,name:r.name,ref:p,onCheck:()=>r.onValueChange(m.value),onKeyDown:k(d=>{d.key==="Enter"&&d.preventDefault()}),onFocus:k(m.onFocus,()=>{var d;j.current&&((d=i.current)==null||d.click())})})})});Ze.displayName=Ye;var sa="RadioGroupIndicator",es=n.forwardRef((s,a)=>{const{__scopeRadioGroup:o,...t}=s,m=We(o);return e.jsx(He,{...m,...t,ref:a})});es.displayName=sa;var ss=Xe,as=Ze,aa=es;const os=n.forwardRef(({className:s,...a},o)=>e.jsx(ss,{className:oe("grid gap-2",s),...a,ref:o}));os.displayName=ss.displayName;const ue=n.forwardRef(({className:s,...a},o)=>e.jsx(as,{ref:o,className:oe("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",s),...a,children:e.jsx(aa,{className:"flex items-center justify-center",children:e.jsx(Es,{className:"h-2.5 w-2.5 fill-current text-current"})})}));ue.displayName=as.displayName;function oa({formData:s,rendimentos:a,errors:o,onInputChange:t}){const m=s.modoDescontos||"simplificado",[r,v]=n.useState(!1),[x,f]=n.useState(!1),[i,p]=n.useState(!1),l=n.useMemo(()=>{const g=_(a.rendaAlugueis),G=_(a.rendasTrabalho),L=_(a.rendasPensoes),se=_(a.rendasAutonomo),z=g+G+L+se;return Math.min(z*.2,17640)},[a.rendaAlugueis,a.rendasTrabalho,a.rendasPensoes,a.rendasAutonomo]),j=m==="simplificado",[d,N]=n.useState(!1),[w,b]=n.useState(!1),[R,u]=n.useState(!1),[C,c]=n.useState(!1),[y,h]=n.useState(!1),[F,E]=n.useState(!1),[q,O]=n.useState(!1);return n.useEffect(()=>{const g=_(s.previdenciaOficial);g>0?N(!0):(!s.previdenciaOficial||g===0)&&N(!1)},[s.previdenciaOficial]),n.useEffect(()=>{const g=parseInt(s.dependentes)||0;g>0?b(!0):(!s.dependentes||g===0)&&b(!1)},[s.dependentes]),n.useEffect(()=>{const g=_(s.pensaoAlimenticia);g>0?u(!0):(!s.pensaoAlimenticia||g===0)&&u(!1)},[s.pensaoAlimenticia]),n.useEffect(()=>{const g=_(s.despesasInstrucao);g>0?c(!0):(!s.despesasInstrucao||g===0)&&c(!1)},[s.despesasInstrucao]),n.useEffect(()=>{const g=_(s.despesasMedicas);g>0?h(!0):(!s.despesasMedicas||g===0)&&h(!1)},[s.despesasMedicas]),n.useEffect(()=>{const g=_(s.livroCaixa);g>0?E(!0):(!s.livroCaixa||g===0)&&E(!1)},[s.livroCaixa]),n.useEffect(()=>{const g=_(s.outrosDescontos);g>0?O(!0):(!s.outrosDescontos||g===0)&&O(!1)},[s.outrosDescontos]),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"text-2xl font-bold text-secondary mb-2",children:"Descontos Legais"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Informe suas deduções para um cálculo mais preciso (opcional)"})]}),e.jsxs($,{children:[e.jsx(ne,{children:e.jsx(re,{className:"text-lg",children:"Deduções permitidas pela Receita Federal"})}),e.jsxs(J,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3 pb-4 border-b",children:[e.jsx(A,{className:"text-sm font-medium",children:"Modo de Cálculo"}),e.jsxs(os,{value:m,onValueChange:g=>t("modoDescontos",g),className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ue,{value:"simplificado",id:"simplificado"}),e.jsx(A,{htmlFor:"simplificado",className:"font-normal cursor-pointer",children:"Simplificado"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ue,{value:"completo",id:"completo"}),e.jsx(A,{htmlFor:"completo",className:"font-normal cursor-pointer",children:"Completo"})]})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:j?e.jsxs("p",{children:[e.jsx("strong",{children:"Simplificado:"})," Desconto automático de 20% sobre a soma das rendas tributáveis (limitado a R$ 17.640,00/ano)."]}):e.jsxs("p",{children:[e.jsx("strong",{children:"Completo:"})," Informe suas deduções detalhadas permitidas pela Receita Federal."]})})]}),j&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(A,{className:"text-sm font-medium",children:"Desconto Simplificado Calculado"}),e.jsxs(K,{open:r,onOpenChange:v,children:[e.jsx(Q,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex items-center justify-center",onClick:g=>{g.preventDefault(),v(!r)},"aria-label":"Mais informações",children:e.jsx(X,{className:"h-4 w-4 text-muted-foreground cursor-help hover:text-primary transition-colors"})})}),e.jsx(W,{className:"max-w-xs",children:e.jsx("p",{children:"Desconto automático de 20% sobre a soma das seguintes rendas: aluguéis, trabalho, pensões/aposentadorias e autônomos/profissionais liberais. Limite máximo de R$ 17.640,00 por ano."})})]})]}),e.jsx(T,{type:"text",disabled:!0,value:be(l),className:"bg-muted cursor-not-allowed text-lg font-semibold"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Este valor será aplicad
28o automaticamente no cálculo do IRPF."})]}),!j&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[e.jsx(S,{id:"showPrevidenciaOficial",checked:d,onCheckedChange:g=>N(g===!0)}),e.jsx(A,{htmlFor:"showPrevidenciaOficial",className:"text-sm font-medium cursor-pointer leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Previdência Oficial"})]}),d&&e.jsx(P,{label:"",tooltip:"Contribuições ao INSS ou regime próprio de previdência. Este valor é totalmente dedutível do IR.",field:"previdenciaOficial",value:s.previdenciaOficial,onInputChange:t,error:o.previdenciaOficial})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[e.jsx(S,{id:"showDependentes",checked:w,onCheckedChange:g=>{b(g===!0),g||t("dependentes","")}}),e.jsx(A,{htmlFor:"showDependentes",className:"text-sm font-medium cursor-pointer leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Dedução por Dependentes"})]}),w&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(A,{className:"text-sm font-medium",children:"Quantidade de Dependentes"}),e.jsxs(K,{open:x,onOpenChange:f,children:[e.jsx(Q,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex items-center justify-center",onClick:g=>{g.preventDefault(),f(!x)},"aria-label":"Mais informações",children:e.jsx(X,{className:"h-4 w-4 text-muted-foreground cursor-help hover:text-primary transition-colors"})})}),e.jsx(W,{className:"max-w-xs",children:e.jsx("p",{children:"R$ 2.275,08 por dependente ao ano (2024). Inclui filhos até 21 anos (ou 24 se universitário), cônjuge, pais, etc. O valor anual será calculado automaticamente."})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(A,{className:"text-xs text-muted-foreground",children:"Quantidade"}),e.jsx(T,{id:"dependentes",type:"number",min:"0",step:"1",placeholder:"0",value:s.dependentes,onChange:g=>{const G=g.target.value;if(G===""){t("dependentes","");return}const L=parseInt(G,10);!isNaN(L)&&L>=0&&t("dependentes",String(L))},className:o.dependentes?"border-destructive":""})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(A,{className:"text-xs text-muted-foreground",children:"Valor Anual (R$/ano)"}),e.jsx(T,{type:"text",disabled:!0,value:s.dependentes?be(parseInt(s.dependentes||"0")*2275.08):"0,00",className:"bg-muted cursor-not-allowed"})]})]}),o.dependentes&&e.jsx("p",{className:"text-sm text-destructive mt-1",children:o.dependentes})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[e.jsx(S,{id:"showPensaoAlimenticia",checked:R,onCheckedChange:g=>u(g===!0)}),e.jsx(A,{htmlFor:"showPensaoAlimenticia",className:"text-sm font-medium cursor-pointer leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Pensão Alimentícia"})]}),R&&e.jsx(P,{label:"",tooltip:"Valores pagos a título de pensão alimentícia em cumprimento de decisão judicial ou acordo homologado.",field:"pensaoAlimenticia",value:s.pensaoAlimenticia,onInputChange:t,error:o.pensaoAlimenticia})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[e.jsx(S,{id:"showDespesasInstrucao",checked:C,onCheckedChange:g=>{c(g===!0),g||t("despesasInstrucao","")}}),e.jsx(A,{htmlFor:"showDespesasInstrucao",className:"text-sm font-medium cursor-pointer leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Despesas de Instrução"})]}),C&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(A,{className:"text-sm font-medium",children:"Despesas de Instrução"}),e.jsxs(K,{open:i,onOpenChange:p,children:[e.jsx(Q,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex items-center justify-center",onClick:g=>{g.preventDefault(),p(!i)},"aria-label":"Mais informações",children:e.jsx(X,{className:"h-4 w-4 text-muted-foreground cursor-help hover:text-primary transition-colors"})})}),e.jsx(W,{className:"max-w-xs",children:e.jsx("p",{children:"Despesas com educação (ensino infantil, fund
28amental, médio, superior e técnico). Limite dedutível de R$ 3.561,50 por ano."})})]})]}),e.jsx(P,{label:"",tooltip:"Despesas com educação (ensino infantil, fundamental, médio, superior e técnico). Limite de R$ 3.561,50 por ano.",field:"despesasInstrucao",value:s.despesasInstrucao,onInputChange:t,error:o.despesasInstrucao}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Limite dedutível: R$ 3.561,50 por pessoa por ano",_(s.despesasInstrucao)>3561.5&&e.jsx("div",{className:"text-amber-600 font-medium mt-1",children:"⚠️ Valor acima do limite - pode ser questionado pela Receita Federal"})]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[e.jsx(S,{id:"showDespesasMedicas",checked:y,onCheckedChange:g=>h(g===!0)}),e.jsx(A,{htmlFor:"showDespesasMedicas",className:"text-sm font-medium cursor-pointer leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Despesas Médicas"})]}),y&&e.jsx(P,{label:"",tooltip:"Despesas médicas e odontológicas têm dedução ILIMITADA. Inclua consultas, exames, internações, planos de saúde, etc.",field:"despesasMedicas",value:s.despesasMedicas,onInputChange:t,error:o.despesasMedicas})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[e.jsx(S,{id:"showLivroCaixa",checked:F,onCheckedChange:g=>E(g===!0)}),e.jsx(A,{htmlFor:"showLivroCaixa",className:"text-sm font-medium cursor-pointer leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Livro Caixa"})]}),F&&e.jsx(P,{label:"",tooltip:"Despesas escrituradas em livro caixa (para profissionais autônomos e liberais).",field:"livroCaixa",value:s.livroCaixa,onInputChange:t,error:o.livroCaixa})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[e.jsx(S,{id:"showOutrosDescontos",checked:q,onCheckedChange:g=>O(g===!0)}),e.jsx(A,{htmlFor:"showOutrosDescontos",className:"text-sm font-medium cursor-pointer leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Outros Descontos"})]}),q&&e.jsx(P,{label:"",tooltip:"Outras deduções permitidas pela Receita Federal.",field:"outrosDescontos",value:s.outrosDescontos,onInputChange:t,error:o.outrosDescontos})]})]})]})]})]})}const ta=s=>{const a=s.replace(/\D/g,"");return a===""?"":parseInt(a).toString()};function na({formData:s,errors:a,onInputChange:o}){const[t,m]=n.useState(!1),[r,v]=n.useState(!1),[x,f]=n.useState(!1),[i,p]=n.useState(!1);n.useEffect(()=>{const d=_(s.rendaAplicacaoRendaFixa);d>0?m(!0):(!s.rendaAplicacaoRendaFixa||d===0)&&m(!1)},[s.rendaAplicacaoRendaFixa]),n.useEffect(()=>{const d=_(s.rendaJurosCapital);d>0?v(!0):(!s.rendaJurosCapital||d===0)&&v(!1)},[s.rendaJurosCapital]),n.useEffect(()=>{const d=_(s.rendaLucroDividendo);d>0?f(!0):(!s.rendaLucroDividendo||d===0)&&f(!1)},[s.rendaLucroDividendo]),n.useEffect(()=>{const d=_(s.rendaTitulosIsentos);d>0?p(!0):(!s.rendaTitulosIsentos||d===0)&&p(!1)},[s.rendaTitulosIsentos]);const l=(d,N)=>{const w=ta(N);o(d,w)},j=()=>{const d=_(s.rendaAplicacaoRendaFixa),N=parseFloat(s.aliquotaRendaFixa)||0,w=_(s.rendaJurosCapital),b=parseFloat(s.aliquotaJurosCapital)||0,R=d*(N/100),u=w*(b/100);return R+u};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"text-2xl font-bold text-secondary mb-2",children:"Investimentos"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Rendimentos de aplicações financeiras (opcional)"})]}),e.jsxs($,{children:[e.jsx(ne,{children:e.jsx(re,{className:"text-lg",children:"Rendimentos sujeitos à tributação complementar"})}),e.jsxs(J,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[e.jsx(S,{id:"showRendaFixa",checked:t,onCheckedChange:d=>m(d===!0)}),e.jsx(A,{htmlFor:"showRendaFixa",className:"text-sm font-medium cursor-pointer leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Rendas de aplicações financeiras de renda fixa"})]}
28),t&&e.jsxs(e.Fragment,{children:[e.jsx(P,{label:"",tooltip:"CDB, fundos de investimento, debêntures e outras aplicações de renda fixa.",field:"rendaAplicacaoRendaFixa",value:s.rendaAplicacaoRendaFixa,onInputChange:o,error:a.rendaAplicacaoRendaFixa}),s.rendaAplicacaoRendaFixa&&_(s.rendaAplicacaoRendaFixa)>0&&e.jsxs("div",{className:"pl-4 space-y-2 animate-in fade-in slide-in-from-top-2 duration-300",children:[e.jsx(A,{htmlFor:"aliquotaRendaFixa",className:"text-sm font-medium text-muted-foreground",children:"Alíquota Renda Fixa (%)"}),e.jsxs("div",{className:"relative max-w-xs",children:[e.jsx(T,{id:"aliquotaRendaFixa",type:"text",placeholder:"15",value:s.aliquotaRendaFixa,onChange:d=>l("aliquotaRendaFixa",d.target.value),className:"pr-8"}),e.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[e.jsx(S,{id:"showJurosCapital",checked:r,onCheckedChange:d=>v(d===!0)}),e.jsx(A,{htmlFor:"showJurosCapital",className:"text-sm font-medium cursor-pointer leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Rendas de juros sobre capital próprio"})]}),r&&e.jsxs(e.Fragment,{children:[e.jsx(P,{label:"",tooltip:"Juros sobre capital próprio distribuídos por empresas.",field:"rendaJurosCapital",value:s.rendaJurosCapital,onInputChange:o,error:a.rendaJurosCapital}),s.rendaJurosCapital&&_(s.rendaJurosCapital)>0&&e.jsxs("div",{className:"pl-4 space-y-2 animate-in fade-in slide-in-from-top-2 duration-300",children:[e.jsx(A,{htmlFor:"aliquotaJurosCapital",className:"text-sm font-medium text-muted-foreground",children:"Alíquota Juros sobre Capital (%)"}),e.jsxs("div",{className:"relative max-w-xs",children:[e.jsx(T,{id:"aliquotaJurosCapital",type:"text",placeholder:"15",value:s.aliquotaJurosCapital,onChange:d=>l("aliquotaJurosCapital",d.target.value),className:"pr-8"}),e.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]})]})]}),e.jsxs("div",{className:"space-y-4 pt-2",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[e.jsx(S,{id:"showLucroDividendo",checked:x,onCheckedChange:d=>f(d===!0)}),e.jsx(A,{htmlFor:"showLucroDividendo",className:"text-sm font-medium cursor-pointer leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Lucros e Dividendos"})]}),x&&e.jsx(P,{label:"",tooltip:"Lucros e dividendos distribuídos por empresas (geralmente isentos de IR).",field:"rendaLucroDividendo",value:s.rendaLucroDividendo,onInputChange:o,error:a.rendaLucroDividendo})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[e.jsx(S,{id:"showTitulosIsentos",checked:i,onCheckedChange:d=>p(d===!0)}),e.jsx(A,{htmlFor:"showTitulosIsentos",className:"text-sm font-medium cursor-pointer leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Renda de Títulos Isentos"})]}),i&&e.jsx(P,{label:"",tooltip:"Rendimentos de LCI, LCA, CRI, CRA, debêntures incentivadas e outros títulos isentos.",field:"rendaTitulosIsentos",value:s.rendaTitulosIsentos,onInputChange:o,error:a.rendaTitulosIsentos})]})]})]}),j()>0&&e.jsxs("div",{className:"mt-4 p-3 bg-blue-50 rounded-lg border border-blue-200",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"💡 IR já pago sobre investimentos (calculado automaticamente):"}),e.jsxs("p",{className:"text-lg font-semibold text-blue-600",children:["R$ ",j().toLocaleString("pt-BR",{minimumFractionDigits:2,maximumFractionDigits:2})," / ano"]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["R$ ",(j()/12).toLocaleString("pt-BR",{minimumFractionDigits:2,maximumFractionDigits:2})," / mês"]})]})]})]})]})}function ra({formData:s,errors:a,onInputChange:o}){const[t,m]=n.useState(!1),[r,v]=n.useState(!1),x=i=>{const p=i.replace(/\D/g,"");return p===""||p==="0"?"":(parseInt(p)/100).toLocaleString("pt-BR",{minimumFractionDigits:2,maximumFractionDigits:2})},f=i=>{const p=x(i);o("custoAquisicaoImovel",p)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"text-2xl font-bold text-secondary mb-2",children:"Dados dos Imóveis"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Informações sobre seus imóveis para cálculo de ganho de capital (opcional)"})]}),e.jsxs($,{children:[e.jsx(ne,{children:e.jsx(re,{className:"text-lg",children:"Informações dos Imóveis"})}),e.jsx(J,{children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex items-center gap-1.5 h-5",children:e.jsx(A,{htmlFor:"quantidadeImoveis",className:"text-sm font-medium",children:"Quantidade de imóveis"})}),e.jsx(T,{id:"quantidadeImoveis",type:"number",min:"1",placeholder:"1",value:s.quantidadeImoveis,onChange:i=>o("quantidadeImoveis",i.target.value),className:a.quantidadeImoveis?"border-destructive":""}),a.quantidadeImoveis&&e.jsx("p",{className:"text-sm text-destructive",children:a.quantidadeImoveis})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 h-5",children:[e.jsx(A,{htmlFor:"custoAquisicaoImovel",className:"text-sm font-medium",children:"Custo de aquisição (R$)"}),e.jsxs(K,{open:t,onOpenChange:m,children:[e.jsx(Q,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex items-center justify-center",onClick:i=>{i.preventDefault(),m(!t)},"aria-label":"Mais informações",children:e.jsx(X,{className:"h-4 w-4 text-muted-foreground cursor-help hover:text-primary transition-colors"})})}),e.jsx(W,{className:"max-w-xs",children:e.jsx("p",{children:"Valor total pago na compra do(s) imóvel(is). Inclui o valor pago no contrato de compra e venda."})})]})]}),e.jsx(T,{id:"custoAquisicaoImovel",type:"text",inputMode:"numeric",placeholder:"0,00",value:s.custoAquisicaoImovel,onChange:i=>f(i.target.value),className:a.custoAquisicaoImovel?"border-destructive":""}),a.custoAquisicaoImovel&&e.jsx("p",{className:"text-sm text-destructive",children:a.custoAquisicaoImovel})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 h-5",children:[e.jsx(A,{htmlFor:"anosCompraImovel",className:"text-sm font-medium",children:"Anos de posse"}),e.jsxs(K,{open:r,onOpenChange:v,children:[e.jsx(Q,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex items-center justify-center",onClick:i=>{i.preventDefault(),v(!r)},"aria-label":"Mais informações",children:e.jsx(X,{className:"h-4 w-4 text-muted-foreground cursor-help hover:text-primary transition-colors"})})}),e.jsx(W,{className:"max-w-xs",children:e.jsx("p",{children:"Quantidade de anos que possui os imóveis"})})]})]}),e.jsx(T,{id:"anosCompraImovel",type:"number",min:"0",placeholder:"0",value:s.anosCompraImovel,onChange:i=>o("anosCompraImovel",i.target.value),className:a.anosCompraImovel?"border-destructive":""}),a.anosCompraImovel&&e.jsx("p",{className:"text-sm text-destructive",children:a.anosCompraImovel})]})]})})]}),a.dadosImoveis&&e.jsx("p",{className:"text-sm text-destructive text-center",children:a.dadosImoveis})]})}const I=s=>!s||s.trim()===""?0:parseFloat(s.replace(/\D/g,""))/100,ts=s=>{const a={},o={},t=parseInt(String(s.quantidadeImoveis||"0")),m=I(String(s.custoAquisicaoImovel||"")),r=parseInt(String(s.anosCompraImovel||"0")),v=I(String(s.rendaAlugueis||"")),x=I(String(s.rendasTrabalho||"")),f=I(String(s.rendasPensoes||"")),i=I(String(s.rendasAutonomo||"")),p=I(String(s.resultadoAtivida
28deRural||"")),l=I(String(s.previdenciaOficial||"")),j=I(String(s.despesasInstrucao||""));v<=0&&(a.rendaAlugueis="Rendas de aluguéis são obrigatórias para este estudo de caso");const d=x+f+i+p;x<0&&(a.rendasTrabalho="Valor não pode ser negativo"),f<0&&(a.rendasPensoes="Valor não pode ser negativo"),i<0&&(a.rendasAutonomo="Valor não pode ser negativo");const N=v+d;l>N&&(o.previdenciaOficial="Contribuição à previdência parece muito alta em relação aos rendimentos"),j>3561.5&&(o.despesasInstrucao="Atenção: O limite anual de dedução é R$ 3.561,50 por pessoa. Valores acima podem ser questionados pela Receita Federal."),N>0&&N<2400&&(o.geral="Rendimentos muito baixos. Verifique se os valores estão corretos."),N>12e6&&(o.geral="Rendimentos muito altos. Para valores elevados, recomendamos consultar um contador.");const b=String(s.quantidadeImoveis||"").trim(),R=String(s.custoAquisicaoImovel||"").trim(),u=String(s.anosCompraImovel||"").trim(),C=b!==""&&b!=="0",c=R!==""&&R!=="0,00"&&R!=="0",y=u!=="";return C&&t<1&&(a.quantidadeImoveis="Quantidade de imóveis deve ser pelo menos 1"),c&&m<=0&&(a.custoAquisicaoImovel="O custo de aquisição deve ser maior que zero"),y&&r<0&&(a.anosCompraImovel="Anos de posse não pode ser negativo"),(a.quantidadeImoveis||a.custoAquisicaoImovel||a.anosCompraImovel)&&(a.dadosImoveis="Preencha corretamente todos os campos de dados dos imóveis"),{isValid:Object.keys(a).length===0,errors:a,warnings:o}};function ia({formData:s,errors:a,onInputChange:o,onCalculate:t}){const[m,r]=n.useState(1),[v,x]=n.useState(new Set([1])),[f,i]=n.useState(new Set([1])),[p,l]=n.useState(""),j=()=>{const h=ts(s);return l(""),console.log("Validação completa:",h),console.log("Erros:",h.errors),console.log("FormData:",s),m===1&&h.errors.rendaAlugueis?(l(h.errors.rendaAlugueis),!1):m===4&&h.errors.dadosImoveis?(console.log("Erro em dadosImoveis:",h.errors.dadosImoveis),console.log("Erros individuais:",{quantidadeImoveis:h.errors.quantidadeImoveis,custoAquisicaoImovel:h.errors.custoAquisicaoImovel,anosCompraImovel:h.errors.anosCompraImovel}),l(h.errors.dadosImoveis),!1):!0},d=()=>{if(!j())return;l("");const h=m+1;h<=4&&(r(h),x(F=>new Set([...F,h])),i(new Set([h])))},N=()=>{const h=m-1;h>=1&&(r(h),i(new Set([h])))},w=h=>{v.has(h)&&(r(h),i(new Set([h])))},b=h=>{i(F=>{const E=new Set(F);return E.has(h)?E.delete(h):E.add(h),E})},R=()=>{console.log("handleCalculate chamado, currentPhase:",m);const h=j();console.log("validateCurrentPhase retornou:",h),h?(console.log("Chamando onCalculate()"),t()):console.log("Validação falhou, não chamando onCalculate")},u=h=>f.has(h),C=h=>m===h,c=h=>{if(!u(h))return null;switch(h){case 1:return e.jsx(Ts,{formData:{rendaAlugueis:s.rendaAlugueis,rendasTrabalho:s.rendasTrabalho,rendasPensoes:s.rendasPensoes,rendasAutonomo:s.rendasAutonomo,resultadoAtividadeRural:s.resultadoAtividadeRural,casadoComunhao:s.casadoComunhao},errors:a,onInputChange:o});case 2:return e.jsx(oa,{formData:{previdenciaOficial:s.previdenciaOficial,dependentes:s.dependentes,pensaoAlimenticia:s.pensaoAlimenticia,despesasInstrucao:s.despesasInstrucao,despesasMedicas:s.despesasMedicas,livroCaixa:s.livroCaixa,outrosDescontos:s.outrosDescontos,modoDescontos:s.modoDescontos},rendimentos:{rendaAlugueis:s.rendaAlugueis,rendasTrabalho:s.rendasTrabalho,rendasPensoes:s.rendasPensoes,rendasAutonomo:s.rendasAutonomo},errors:a,onInputChange:o});case 3:return e.jsx(na,{formData:{rendaAplicacaoRendaFixa:s.rendaAplicacaoRendaFixa,aliquotaRendaFixa:s.aliquotaRendaFixa,rendaJurosCapital:s.rendaJurosCapital,aliquotaJurosCapital:s.aliquotaJurosCapital,rendaLucroDividendo:s.rendaLucroDividendo,rendaTitulosIsentos:s.rendaTitulosIsentos},errors:a,onInputChange:o});case 4:return e.jsx(ra,{formData:{quantidadeImoveis:s.quantidadeImoveis,custoAquisicaoImovel:s.custoAquisicaoImovel,anosCompraImovel:s.anosCompraImovel},errors:a,onInputChange:o});default:return null}},y=[{id:1,name:"Rendimentos"},{id:2,name:"Descontos"},{id:3,name:"Investimentos"},{id:4,name:"Dados dos Imóveis"}];return e.jsxs("div",{className:"space-y-8",children:[e.jsx(_s,{currentPhase:m,visitedPhases:v,onPhaseClick:w}),e.jsx("div",{className:"space-y-4",children:y.map(h=>e.jsxs("div",{children:[v.has(h.id)&&!C(h.id)&&e.jsxs("button",{onClick:()=>b(h.id),className:"w-full flex items-center justify-between p-4 bg-muted/30 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsxs("span",{className:"font-medium text-sm",children:[h.id,". ",h.name]}),u(h.id)?e.jsx(fs,{className:"h-5 w-5 text-muted-foreground"}):e.jsx(cs,{className:"h-5 w-5 text-muted-foreground"})]}),c(h.id)]}
28,h.id))}),p&&e.jsxs("div",{className:"flex items-center gap-2 p-4 bg-destructive/10 border border-destructive rounded-lg",children:[e.jsx(Is,{className:"h-5 w-5 text-destructive flex-shrink-0"}),e.jsx("p",{className:"text-sm text-destructive font-medium",children:p})]}),e.jsxs("div",{className:"flex gap-4 pt-4",children:[m>1&&e.jsxs(B,{onClick:N,variant:"outline",size:"lg",className:"flex-1",children:[e.jsx(As,{className:"mr-2 h-5 w-5"}),"Anterior"]}),m<4?e.jsxs(B,{onClick:d,size:"lg",className:"flex-1 bg-primary hover:bg-primary/90",children:["Próximo",e.jsx(vs,{className:"ml-2 h-5 w-5"})]}):e.jsxs(B,{onClick:R,size:"lg",className:"flex-1 bg-primary hover:bg-primary/90 text-white font-semibold shadow-lg hover:shadow-xl transition-all",children:["Calcular IRPF",e.jsx(ye,{className:"ml-2 h-5 w-5"})]})]})]})}const ns="https://calcback.boldfinance.com.br",rs=async()=>{const s={"Content-Type":"application/json"};try{const a=await ws();s.Authorization=`Bearer ${a}`}catch{throw new Error("Falha na autenticação: token não disponível")}return s},la=async s=>{try{const a=await fetch(`${ns}/resumo_estudo_case`,{method:"POST",headers:await rs(),body:JSON.stringify(s)});if(!a.ok){const o=await a.json().catch(()=>({}));throw new Error(o.message||`Erro ao calcular resumo do estudo de case: ${a.status} ${a.statusText}`)}return a.json()}catch(a){throw a instanceof TypeError&&a.message.includes("fetch")?new Error("Erro de conexão: Não foi possível conectar ao servidor. Verifique sua conexão."):a}},da=async s=>{try{const a=await fetch(`${ns}/enviar_pdf_irpf`,{method:"POST",headers:await rs(),body:JSON.stringify(s)});if(!a.ok){const o=await a.json().catch(()=>({}));throw new Error(o.message||`Erro ao solicitar análise: ${a.status} ${a.statusText}`)}}catch(a){throw a instanceof TypeError&&a.message.includes("fetch")?new Error("Erro de conexão: Não foi possível conectar ao servidor. Verifique sua conexão."):a}};function ca({open:s,onOpenChange:a,calculationData:o}){const{toast:t}=we(),{trackEvent:m,trackConversion:r,trackError:v}=xe(),[x,f]=n.useState(!1),[i,p]=n.useState({nome:"",telefone:"",email:""}),[l,j]=n.useState({}),d=u=>{const C=u.replace(/\D/g,"");return C.length<=10?C.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{4})(\d)/,"$1-$2"):C.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2").slice(0,15)},N=u=>{const C=d(u);p(c=>({...c,telefone:C})),l.telefone&&j(c=>{const y={...c};return delete y.telefone,y})},w=(u,C)=>{p(c=>({...c,[u]:C})),l[u]&&j(c=>{const y={...c};return delete y[u],y})},b=()=>{const u={};i.nome.trim()?i.nome.trim().length<3&&(u.nome="Nome deve ter pelo menos 3 caracteres"):u.nome="Nome é obrigatório";const C=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;i.email.trim()?C.test(i.email)||(u.email="Email inválido"):u.email="Email é obrigatório";const c=i.telefone.replace(/\D/g,"");return i.telefone.trim()?(c.length<10||c.length>11)&&(u.telefone="Telefone inválido"):u.telefone="Telefone é obrigatório",j(u),Object.keys(u).length===0},R=async u=>{if(u.preventDefault(),!b()){m({action:Y.ERROR,category:Z.ERROR,label:U.CALCULADORA_IRPF_FORMULARIO_PDF_ERRO_VALIDACAO});return}f(!0);try{const C={contato:{nome:i.nome.trim(),telefone:i.telefone,email:i.email.trim()},...o};await da(C),r({label:U.CALCULADORA_IRPF_FORMULARIO_PDF_ENVIADO_SUCESSO,value:Ie.PDF_DOWNLOAD,transactionId:`pdf_${Date.now()}_${i.email}`}),t({title:"✅ Análise solicitada!",description:"Você receberá o PDF completo no email cadastrado.",duration:5e3}),p({nome:"",telefone:"",email:""}),j({}),a(!1)}catch(C){console.error("Erro ao solicitar análise:",C),m({action:Y.ERROR,category:Z.ERROR,label:U.CALCULADORA_IRPF_FORMULARIO_PDF_ERRO_ENVIO}),v({description:`Calculadora IRPF - Erro ao enviar formulário PDF: ${C instanceof Error?C.message:"Unknown error"}`,fatal:!1}),t({title:"Erro ao solicitar análise",description:C instanceof Error?C.message:"Ocorreu um erro. Tente novamente.",variant:"destructive"})}finally{f(!1)}};return e.jsx(js,{open:s,onOpenChange:a,children:e.jsxs(Ns,{className:"sm:max-w-md",children:[e.jsxs(Cs,{children:[e.jsx("div",{className:"flex items-center justify-center w-12 h-12 rounded-full bg-primary/10 mx-auto mb-2",children:e.jsx(Ae,{className:"w-6 h-6 text-primary"})}),e.jsx(Rs,{className:"text-center text-xl",children:"Receber Análise Completa"}),e.jsx(ys,{className:"text-center",children:"Informe seus dados para receber o PDF com todos os cálculos e fluxos completos no seu email"})]}
28),e.jsxs("form",{onSubmit:R,className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(A,{htmlFor:"nome",className:"text-sm font-medium",children:["Nome completo ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(T,{id:"nome",type:"text",placeholder:"Seu nome completo",value:i.nome,onChange:u=>w("nome",u.target.value),className:`pl-10 ${l.nome?"border-destructive":""}`,disabled:x})]}),l.nome&&e.jsx("p",{className:"text-xs text-destructive",children:l.nome})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(A,{htmlFor:"email",className:"text-sm font-medium",children:["Email ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ge,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(T,{id:"email",type:"email",placeholder:"[email protected]",value:i.email,onChange:u=>w("email",u.target.value),className:`pl-10 ${l.email?"border-destructive":""}`,disabled:x})]}),l.email&&e.jsx("p",{className:"text-xs text-destructive",children:l.email})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(A,{htmlFor:"telefone",className:"text-sm font-medium",children:["Telefone ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(gs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(T,{id:"telefone",type:"tel",placeholder:"(11) 98765-4321",value:i.telefone,onChange:u=>N(u.target.value),className:`pl-10 ${l.telefone?"border-destructive":""}`,disabled:x})]}),l.telefone&&e.jsx("p",{className:"text-xs text-destructive",children:l.telefone})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx(B,{type:"submit",disabled:x,className:"flex-1 bg-primary hover:bg-primary/90",children:x?e.jsxs(e.Fragment,{children:[e.jsx(_e,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ge,{className:"mr-2 h-4 w-4"}),"Receber por Email"]})}),e.jsx(B,{type:"button",variant:"outline",onClick:()=>a(!1),disabled:x,className:"flex-1",children:"Cancelar"})]}),e.jsx("p",{className:"text-xs text-muted-foreground text-center pt-2",children:"Seus dados estão seguros e serão usados apenas para enviar a análise"})]})]})})}const ua=({results:s,calculationData:a,onRecalculate:o})=>{var C;const[t,m]=n.useState(!1),{trackEvent:r}=xe();n.useEffect(()=>{r({action:Y.VIEW,category:Z.ENGAGEMENT,label:U.CALCULADORA_IRPF_RESULTADO_EXIBIDO})},[]);const v=()=>{r({action:Y.CLICK,category:Z.ENGAGEMENT,label:U.CALCULADORA_IRPF_BOTAO_RECEBER_PDF_CLICADO}),m(!0)},x=c=>c.toLocaleString("pt-BR",{style:"currency",currency:"BRL"}),f=(c,y=2)=>c.toLocaleString("pt-BR",{minimumFractionDigits:y,maximumFractionDigits:y}),i=c=>c.valor_liquido_rendas_tributaveis+c.valor_liquido_rendas+c.valor_liquido_ganho_capital-c.irpfm_sobre_alta_renda,p=i(s.pf_puro),l=i(s.pf_bold),j=i(s.pf_holding),d=Math.max(p,l,j),N=[{id:2,name:"PF + Bold",data:s.pf_bold,total:l,color:"green"},{id:1,name:"PF",data:s.pf_puro,total:p,color:"blue"},{id:3,name:"Holding Imobiliária",data:s.pf_holding,total:j,color:"purple"}],w=[{key:"valor_liquido_rendas_tributaveis",label:"Valor líquido das rendas tributáveis",isNegative:!1},{key:"valor_liquido_rendas",label:"Valor líquido das rendas de capital, exceto ganho de capital",isNegative:!1},{key:"valor_liquido_ganho_capital",label:"Valor do ganho de capital",isNegative:!1},{key:"irpfm_sobre_alta_renda",label:"(-) IRPFM sobre as altas rendas",isNegative:!0}],b=((C=a==null?void 0:a.dados_imoveis)==null?void 0:C.prazo_projecao)||10,R=l>p&&p>j;let u=null;if(R&&s.pf_puro.aluguel_anual_total){const c=l-p,y=j-p,h=s.pf_puro.aluguel_anual_total/b,F=c/h,E=Math.abs(y)/h,q=`Com a securitização dos seus aluguéis pela Bold, você ganha ${x(c)} a mais em ${b} anos, o que equivale a ${f(F,1)} anos do seu aluguel médio no período.`,O=`Com a criação de uma holding imobiliária para gerir seus aluguéis, você perde ${x(y)} em ${b} anos, o que equivale a ${f(E,1)} anos do seu aluguel médio no período.`;u={diferencaGanho:c,diferencaGanhoHolding:y,valorMedioAluguelAnual:h,anosEquivalentes:F,anosEquivalentesHolding:E,textoComparacao:q,textoHolding:O}}return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-gradient-to-br from-green-100 to-green-50 mb-2 shadow-lg",children:e.jsx(us,{className:"w-8 h-8 text-green-600"})}),e.jsx("h2",{className:"text-xl md:text-2xl font-bold text-secondary leading-tight",children:"Cálculo Concluído!"}),e.jsx("p",{className:"text-sm md:text-base text-muted-foreground leading-relaxed",children:"Compare os três cenários e veja qual é mais vantajoso"})]}),e.jsx("div",{className:"text-center",children:e.jsx("h3",{className:"text-sm md:text-base font-bold text-secondary uppercase tracking-wide",children:"Resumo Comparativo dos Cenários Somados ao Longo de 10 Anos"})}),e.jsx("div",{className:"hidden md:block",children:e.jsxs("div",{className:"overflow-x-auto",children:[e.jsx($,{className:"border-2 shadow-xl",children:e.jsx(J,{className:"p-0",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b-2",children:[e.jsx("th",{className:"p-2 text-left font-semibold text-sm bg-muted/30",children:"Total de rendas tributáveis"}),N.map(c=>e.jsx("th",{className:`p-2 text-center font-bold text-sm ${c.total===d?"bg-green-100 border-2 border-green-400":"bg-muted/10"}`,children:e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("span",{children:c.name}),c.total===d&&e.jsx("span",{className:"text-xs font-normal text-green-600",children:"✓ Melhor cenário"})]})},c.id))]})}),e.jsxs("tbody",{children:[w.map(c=>e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"p-2 text-sm font-medium bg-muted/10",children:c.label}),N.map(y=>{const h=y.data[c.key],F=c.isNegative?-Math.abs(h):h;return e.jsx("td",{className:`p-2 text-center ${y.total===d?"bg-green-50/50 border-x-2 border-green-400":""}`,children:e.jsx("span",{className:`text-sm ${c.isNegative?"text-red-600":""}`,children:x(F)})},y.id)})]},c.key)),e.jsxs("tr",{className:"bg-muted/20 font-bold",children:[e.jsx("td",{className:"p-2 text-sm",children:"Total"}),N.map(c=>e.jsx("td",{className:`p-2 text-center ${c.total===d?"bg-green-100 border-x-2 border-b-2 border-green-400":""}`,children:e.jsx("span",{className:`text-lg ${c.total===d?"text-green-600":"text-secondary"}`,children:x(c.total)})},c.id))]})]})]})})}),u&&e.jsxs("div",{className:"mt-6 grid grid-cols-2 gap-4",children:[e.jsx("div",{className:"bg-gradient-to-br from-green-50 to-green-100 border-2 border-green-400 rounded-xl p-4 shadow-lg hover:shadow-xl transition-shadow duration-300",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-sm font-bold text-green-800 mb-2 flex items-center gap-2",children:[e.jsx("span",{className:"inline-block w-2 h-2 bg-green-500 rounded-full"}),"Ganho com Bold"]}),e.jsxs("div",{className:"text-base text-green-700 font-bold",children:["+ ",x(u.diferencaGanho)]}),e.jsxs("div",{className:"text-sm text-green-600 font-bold",children:["+ ",f(u.anosEquivalentes,1)," anos de aluguel médio"]})]})}),e.jsx("div",{className:"bg-gradient-to-br from-red-50 to-red-100 border-2 border-red-400 rounded-xl p-4 shadow-lg hover:shadow-xl transition-shadow duration-300",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-sm font-bold text-red-800 mb
28-2 flex items-center gap-2",children:[e.jsx("span",{className:"inline-block w-2 h-2 bg-red-500 rounded-full"}),"Perda com Holding"]}),e.jsxs("div",{className:"text-base text-red-700 font-bold",children:["- ",x(Math.abs(u.diferencaGanhoHolding))]}),e.jsxs("div",{className:"text-sm text-red-600 font-bold",children:["- ",f(u.anosEquivalentesHolding,1)," anos de aluguel médio"]})]})})]})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:N.map(c=>e.jsxs($,{className:`${c.total===d?"border-2 border-green-400 bg-green-50":""}`,children:[e.jsx(ne,{className:"pb-2",children:e.jsxs(re,{className:"text-sm flex items-center justify-between",children:[e.jsx("span",{children:c.name}),c.total===d&&e.jsx("span",{className:"text-xs font-normal text-green-600 bg-white px-2 py-1 rounded",children:"✓ Melhor"})]})}),e.jsxs(J,{className:"space-y-2",children:[w.map(y=>{const h=c.data[y.key],F=y.isNegative?-Math.abs(h):h;return e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("span",{className:"text-xs text-muted-foreground flex-1 pr-2",children:y.label}),e.jsx("span",{className:`text-sm font-semibold ${y.isNegative?"text-red-600":""}`,children:x(F)})]},y.key)}),e.jsxs("div",{className:"pt-2 border-t-2 flex justify-between items-center",children:[e.jsx("span",{className:"text-sm font-bold",children:"Total"}),e.jsx("span",{className:`text-lg font-bold ${c.total===d?"text-green-600":"text-secondary"}`,children:x(c.total)})]}),u&&c.id===2&&e.jsx("div",{className:"pt-2 mt-2 border-t-2",children:e.jsx("div",{className:"bg-gradient-to-br from-green-50 to-green-100 border-2 border-green-400 rounded-lg p-3 shadow-md",children:e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"text-xs font-bold text-green-800 mb-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full"}),"Ganho com Bold"]}),e.jsxs("div",{className:"text-sm text-green-700 font-bold",children:["+ ",x(u.diferencaGanho)]}),e.jsxs("div",{className:"text-xs text-green-600 font-bold",children:["+ ",f(u.anosEquivalentes,1)," anos de aluguel médio"]})]})})}),u&&c.id===3&&e.jsx("div",{className:"pt-2 mt-2 border-t-2",children:e.jsx("div",{className:"bg-gradient-to-br from-red-50 to-red-100 border-2 border-red-400 rounded-lg p-3 shadow-md",children:e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"text-xs font-bold text-red-800 mb-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"inline-block w-1.5 h-1.5 bg-red-500 rounded-full"}),"Perda com Holding"]}),e.jsxs("div",{className:"text-sm text-red-700 font-bold",children:["- ",x(Math.abs(u.diferencaGanhoHolding))]}),e.jsxs("div",{className:"text-xs text-red-600 font-bold",children:["- ",f(u.anosEquivalentesHolding,1)," anos de aluguel médio"]})]})})})]})]},c.id))}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs(B,{onClick:v,size:"lg",className:"flex-1 bg-primary hover:bg-primary/90",children:[e.jsx(Ae,{className:"w-4 h-4 mr-2"}),"Receber Análise Completa"]}),e.jsx(B,{onClick:o,variant:"outline",size:"lg",className:"flex-1",children:"Fazer Novo Cálculo"})]}),e.jsxs("div",{className:"space-y-3 mb-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-secondary text-center",children:"Explicação dos Cenários"}),e.jsxs("div",{className:"space-y-2 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"bg-blue-50 p-3 rounded-md border-l-4 border-blue-400",children:[e.jsx("strong",{className:"text-blue-800",children:"PF:"})," cenário em que você recebe todos os rendimentos na pessoa física, sem constituir holding imobiliária e sem securitizar seus aluguéis."]}),e.jsxs("div",{className:"bg-green-50 p-3 rounded-md border-l-4 border-green-400",children:[e.jsx("strong",{className:"text-green-800",children:"PF + Bold:"})," cenário em que você recebe os rendimentos na pessoa física, sem constituir holding imobiliária, porém securitiza seus aluguéis."]}),e.jsxs("div",{className:"bg-purple-50 p-3 rounded-md border-l-4 border-purple-400",children:[e.jsx("strong",{className:"text-purple-800",children:"PF + Holding Imobiliária:"})," cenário em que você recebe os rendimentos na pessoa física, mas constitui holding imobiliária para os aluguéis."]})]})]}),e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-xs text-muted-foreground",children:"⚠️ Este cálculo é uma simulação. Para informações oficiais, consulte um contador ou a Receita Federal."})}),e.jsx(ca,{open:t,onOpenChange:m,calculationData:a})]})},Ca=()=>{const{toast:s}=we(),{trackPageView:a,trackEvent:o}=xe();n.useEffect(()=>{a(ms.CALCULADORA,ps.CALCULADORA)}
28,[a]);const[t,m]=n.useState({quantidadeImoveis:"",custoAquisicaoImovel:"3.000.000,00",anosCompraImovel:"",rendaAlugueis:"180.000,00",rendasTrabalho:"120.000,00",rendasPensoes:"",rendasAutonomo:"",resultadoAtividadeRural:"",previdenciaOficial:"",dependentes:"",pensaoAlimenticia:"",despesasInstrucao:"",despesasMedicas:"",livroCaixa:"",outrosDescontos:"",rendaAplicacaoRendaFixa:"",aliquotaRendaFixa:"15",rendaJurosCapital:"",aliquotaJurosCapital:"15",rendaLucroDividendo:"",rendaTitulosIsentos:"",casadoComunhao:!1,modoDescontos:"simplificado"}),[r,v]=n.useState({}),[x,f]=n.useState(null),[i,p]=n.useState(!1),[l,j]=n.useState(null),d=(b,R)=>{m(u=>({...u,[b]:R})),r[b]&&v(u=>{const C={...u};return delete C[b],C})},N=async()=>{o({action:Y.CLICK,category:Z.ENGAGEMENT,label:U.CALCULADORA_IRPF_BOTAO_CALCULAR_CLICADO,value:Ie.CALCULATOR_USE});const b=ts(t);if(!b.isValid){v(b.errors),s({title:"Erro de validação",description:Object.values(b.errors)[0],variant:"destructive"});return}if(b.warnings&&Object.keys(b.warnings).length>0){const R=Object.values(b.warnings);s({title:"⚠️ Atenção",description:R[0],duration:5e3})}p(!0),v({});try{const R=I(t.rendaAlugueis),u=I(t.rendaAplicacaoRendaFixa),C=parseFloat(t.aliquotaRendaFixa)||0,c=I(t.rendaJurosCapital),y=parseFloat(t.aliquotaJurosCapital)||0,h=u*(C/100)+c*(y/100),F=t.modoDescontos||"simplificado";let E;if(F==="simplificado"){const g=I(t.rendaAlugueis),G=I(t.rendasTrabalho),L=I(t.rendasPensoes),se=I(t.rendasAutonomo),z=g+G+L+se;E={previdencia_oficial:0,dependentes:0,pensao_alimenticia:0,despesas_instrucao:0,despesas_medicas:0,livro_caixa:0,outros:Math.min(z*.2,17640)}}else E={previdencia_oficial:I(t.previdenciaOficial),dependentes:(parseInt(t.dependentes)||0)*2275.08,pensao_alimenticia:I(t.pensaoAlimenticia),despesas_instrucao:I(t.despesasInstrucao),despesas_medicas:I(t.despesasMedicas),livro_caixa:I(t.livroCaixa),outros:I(t.outrosDescontos)};const q={dados_imoveis:{custo_aquisicao_imovel:I(t.custoAquisicaoImovel),quantidade_imoveis:parseInt(t.quantidadeImoveis)||1,anos_compra_imovel:parseInt(t.anosCompraImovel)||0,proprietarios:1,prazo_projecao:10},rendimentos_tributaveis:{renda_alugueis:R,rendas_trabalho:I(t.rendasTrabalho),rendas_pensoes:I(t.rendasPensoes),rendas_autonomo:I(t.rendasAutonomo),resultado_atividade_rural:I(t.resultadoAtividadeRural)},descontos:E,investimentos:{renda_aplicacao_renda_fixa:I(t.rendaAplicacaoRendaFixa),renda_juros_capital:I(t.rendaJurosCapital),renda_lucro_dividendo:I(t.rendaLucroDividendo),renda_titulos_isentos:I(t.rendaTitulosIsentos),irpago:h}};j(q);const O=await la(q);f(O),s({title:"Cálculo realizado!",description:"Seu resumo do estudo de case foi calculado com sucesso."}),setTimeout(()=>{window.scrollTo({top:0,behavior:"smooth"})},100)}catch(R){console.error("Erro ao calcular:",R),s({title:"Erro ao calcular",description:R instanceof Error?R.message:"Ocorreu um erro ao calcular. Tente novamente.",variant:"destructive"})}finally{p(!1)}},w=()=>{f(null),v({}),window.scrollTo({top:0,behavior:"smooth"})};return e.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-muted/30 to-white",children:[e.jsx(xs,{hideCalculatorLink:!0,title:"Calculadora IRPF no Aluguel"}),e.jsx("main",{className:"container mx-auto px-4 pt-24 pb-6 lg:pt-28 lg:pb-8",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[!x&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"sr-only",children:"Calculadora de Imposto de Renda sobre Aluguel 2026 — Bold Finance"}),e.jsxs("div",{className:"md:hidden text-center mb-6",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-primary/10 mb-3",children:e.jsx(ye,{className:"w-6 h-6 text-primary"})}),e.jsx("p",{className:"text-2xl font-bold text-secondary mb-2",children:"Calculadora de IRPF sobre Aluguel"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Calcule seu Imposto de Renda sobre rendimentos de locação"})]})]}),i&&e.jsx($,{className:"p-12 shadow-xl border-border",children:e.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4",children:[e.jsx(_e,{className:"w-12 h-12 text-primary animate-spin"}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("h3",{className:"text-xl font-semibold text-secondary",children:"Calculando seu IRPF..."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Processando seus dados, aguarde um momento"})]})]})}),!i&&x&&l&&e.jsx($,{className:"p-5 md:p-6 shadow-xl border-border",children:e.jsx(ua,{results:x,calculationData:l,onRecalculate:w})}),!i&&!x&&e.jsxs(e.Fragment,{children:[e.jsx($,{className:"p-5 md:p-6 shadow-xl border-border",children:e.jsx(ia,{formData:t,errors:r,onInputChange:d,onCalculate:N})}),e.jsx("div",{className:"mt-8 text-center space-y-4",children:e.jsxs("div",{className:"flex items-center justify-center gap-6 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-lg",children:"✓"}),e.jsx("span",{children:"Cálculo preciso"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-lg",children:"✓"}),e.jsx("span",{children:"Dados seguros"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-lg",children:"✓"}),e.jsx("span",{children:"100% gratuito"})]})]})})]})]})}),e.jsx(hs,{})]})};export{Ca as default};

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.