1import{r as i,j as e}from"./query-vendor-CqOtiPNe.js";import{u as P,L as x}from"./index-CgiuONvO.js";import{I as u}from"./input-oPoHA7Fw.js";import{S as p}from"./slider-DIOeycPW.js";import{u as w}from"./useCurrency-BwCXcmAr.js";import"./react-vendor-Oyj1q24G.js";import"./ui-vendor-C92kXd7i.js";import"./chart-vendor-De-uRwFm.js";import"./index-BdQq_4o_.js";const A=()=>{const{t}=P(),{formatCurrency:a,currencyInfo:v}=w(),[r,h]=i.useState(5e5),[l,g]=i.useState(20),[n,j]=i.useState(5),[m,N]=i.useState(30),o=r*(1-l/100),d=n/100/12,c=m*12,f=d>0?o*d*Math.pow(1+d,c)/(Math.pow(1+d,c)-1):o/c,y=f*c,b=y-o;return e.jsx("div",{className:"space-y-8",children:e.jsxs("div",{className:"grid gap-6 md:grid-cols-2 rtl:md:grid-flow-dense",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"propertyPrice",children:t("tools.propertyPrice")}),e.jsxs("div",{className:"flex gap-2 rtl:flex-row-reverse",children:[e.jsx(u,{id:"propertyPrice",type:"number",value:r,onChange:s=>h(Number(s.target.value)),min:0,max:5e6}),e.jsx("span",{className:"flex items-center text-muted-foreground",children:v.symbol})]}),e.jsx(p,{value:[r],onValueChange:([s])=>h(s),min:0,max:5e6,step:1e4,className:"mt-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a(r)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"downPayment",children:t("tools.downPayment")}),e.jsxs("div",{className:"flex gap-2 rtl:flex-row-reverse",children:[e.jsx(u,{id:"downPayment",type:"number",value:l,onChange:s=>g(Number(s.target.value)),min:0,max:50}),e.jsx("span",{className:"flex items-center text-muted-foreground",children:"%"})]}),e.jsx(p,{value:[l],onValueChange:([s])=>g(s),min:0,max:50,step:1,className:"mt-2"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[l,"% = ",a(r*l/100)]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"interestRate",children:t("tools.interestRate")}),e.jsxs("div",{className:"flex gap-2 rtl:flex-row-reverse",children:[e.jsx(u,{id:"interestRate",type:"number",value:n,onChange:s=>j(Number(s.target.value)),min:0,max:15,step:.1}),e.jsx("span",{className:"flex items-center text-muted-foreground",children:"%"})]}),e.jsx(p,{value:[n],onValueChange:([s])=>j(s),min:0,max:15,step:.1,className:"mt-2"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[n.toFixed(1),"%"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"loanTerm",children:t("tools.loanTerm")}),e.jsxs("div",{className:"flex gap-2 rtl:flex-row-reverse",children:[e.jsx(u,{id:"loanTerm",type:"number",value:m,onChange:s=>N(Number(s.target.value)),min:5,max:30}),e.jsx("span",{className:"flex items-center text-muted-foreground",children:t("tools.years")})]}),e.jsx(p,{value:[m],onValueChange:([s])=>N(s),min:5,max:30,step:1,className:"mt-2"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[m," ",t("tools.years")]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-6 bg-primary/5 rounded-lg border-2 border-primary/20",children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-2",children:t("tools.monthlyPayment")}),e.jsx("p",{className:"text-4xl font-bold text-primary",children:a(f)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 bg-muted rounded-lg",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:t("tools.loanAmount")}),e.jsx("p",{className:"text-lg font-semibold",children:a(o)})]}),e.jsxs("div",{className:"p-4 bg-muted rounded-lg",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:t("tools.totalPayment")}),e.jsx("p",{className:"text-lg font-semibold",children:a(y)})]}),e.jsxs("div",{className:"p-4 bg-muted rounded-lg col-span-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:t("tools.totalInterest")}),e.jsx("p",{className:"text-lg font-semibold",children:a(b)})]})]})]})]})})};export{A as MortgageCalculator};
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.