var e=new Intl.NumberFormat(`es-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2});function t(t){return`${e.format(t).replace(`$`,``)} US$`}function n(e){let t=e.trim().replace(/\s/g,``);if(t===``||t===`.`||t===`,`)return null;let n=t.replace(`,`,`.`),r=Number.parseFloat(n);return Number.isFinite(r)?r:null}function r(e){let t=e.replace(/[^\d.,]/g,``),n=t.search(/[.,]/);return n>=0&&(t=t.slice(0,n+1)+t.slice(n+1).replace(/[.,]/g,``)),t}function i(e){if(!Number.isFinite(e))return``;let t=Math.round(e*100)/100;return Number.isInteger(t)?String(t):t.toFixed(2)}function a(e,t,n){return Math.round(Math.min(n,Math.max(t,e))*100)/100}function o(e){let{principal:t,durationMonths:n,monthlyReturnPercent:r}=e,i=r/100*t,a=i*n;return{monthlyProfit:i,totalProfitEstimate:a,projectedTotal:t+a}}function s({amount:e,durationMonths:t,durations:n,monthlyReturn:r}){let{monthlyProfit:i,totalProfitEstimate:a,projectedTotal:s}=o({principal:e,durationMonths:t,monthlyReturnPercent:r});return{amount:e,durationMonths:t,monthlyReturn:r,monthlyProfit:i,totalProfit:a,projectedTotal:s,totalReturn:r*t,selectedDuration:n.find(e=>e.months===t)??n[0]}}export{n as a,i,a as n,r as o,t as r,s as t};