1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1999],{8712:function(e,t,r){"use strict";var a,l,n=r(73568);function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)({}).hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(null,arguments)}t.Z=function(e){return n.createElement("svg",o({xmlns:"http://www.w3.org/2000/svg",width:20,height:21,fill:"none"},e),a||(a=n.createElement("g",{clipPath:"url(#check_svg__a)"},n.createElement("path",{fill:"#2FCE82",d:"M10 .508c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10a10.03 10.03 0 0 0-10-10"}),n.createElement("path",{fill:"#fff",d:"M16.09 6.768a.87.87 0 0 0-1.24-.01l-.01.01-6.56 6.57-2.76-2.77a.9.9 0 0 0-1.27-.01.9.9 0 0 0-.02 1.27l.04.04 3.38 3.38c.34.35.9.35 1.24.01l.01-.01 7.18-7.18c.36-.33.38-.89.05-1.24-.01-.03-.02-.04-.04-.06"}))),l||(l=n.createElement("defs",null,n.createElement("clipPath",{id:"check_svg__a"},n.createElement("path",{fill:"#fff",d:"M0 .508h20v20H0z"})))))}},61999:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return g}});var a=r(44037),l=r(73568),n=r(26608),o=r(76292),i=r(64597),s=r(1887),u=r(61019),d=r(7639),m=r.n(d),c=function(e){let{inputRef:t,title:r,min:o,max:d,dataTestId:c,suffix:x,step:p,defaultValue:h,onSliderChange:f,onInputKeyUp:b,isError:_}=e,[g,v]=(0,l.useState)(h),{t:y}=(0,i.Z)("common"),[N,S]=(0,l.useState)(!1),[j,C]=(0,l.useState)(!1),w=e=>Number(e.replace(/\D/g,"")),M="salary"===c?"".concat(y("salary.range_error",{min:(0,s.numberToMoney)(o),max:(0,s.numberToMoney)(d)})):"".concat(y("loan_amount.range_error",{min:(0,s.numberToMoney)(o),max:(0,s.numberToMoney)(d)})," "),T=(0,l.useCallback)(e=>{Array.isArray(e)||(v(e),e<o||e>d?C(!0):(C(!1),null==f||f(e)))},[o,d,f]),k={backgroundColor:j&&_?"#ff3333":m().primaryColor,borderColor:"#fff",width:"30px",height:"30px",marginTop:"-13px",borderWidth:"2px"},A={backgroundColor:j&&_?"#ff3333":m().primaryColor,height:5};return(0,a.jsxs)("div",{className:"sm:mx-6 sm:my-2 md:mx-[30px] md:mb-2 md:mt-[30px]","data-testid":"text_box_with_slider_".concat(c),children:[r&&(0,a.jsx)("div",{className:"text-textColor text-left text-[15px] leading-[1.5rem] font-[700] mb-[10px]",children:r}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{ref:t,type:"text",inputMode:"numeric",className:(0,n.Z)("flex border-grayColor text-[#4F4B66]",[j&&_?"outline-errorColor":"outline-outlineColor","w-full rounded-[10px] px-[16px] pb-[14px] pt-[16px] border focus-within:shadow-md",j&&_?"focus:outline-errorColor focus:my-0":"focus:outline-primaryColor focus:my-0 rounded-b-0"]),"data-testid":"input_".concat(c),onChange:e=>{v(w(e.target.value)),w(e.target.value)<o||w(e.target.value)>d?C(!0):(C(!1),null==f||f(w(e.target.value)))},onKeyUp:b,min:o,onFocus:()=>{S(!N)},value:(0,s.numberToMoney)(g)}),(0,a.jsx)("span",{className:m().textBoxWithSlider__currency,children:x}),(0,a.jsx)("div",{className:(0,n.Z)(m().textBoxWithSlider__rcSliderSection,["mt-[-2px] mb-0 my-2 mx-2",g===o&&"ml-[9px]",g===d&&"mr-[9px]"]),children:(0,a.jsx)(u.Z,{"data-testid":"slider_".concat(c),className:m().textBoxWithSlider__rcSlider,min:o,max:d,defaultValue:h,step:p,value:g,onChange:T,trackStyle:A,handleStyle:k,railStyle:{backgroundColor:"#e9edf5",height:5,width:0}})})]}),j&&_&&(0,a.jsx)("div",{className:"text-errorColor text-left",children:M})]})},x=r(35344),p=r(8712),h=r(89758),f=function(e){var t;let{inputRef:r,title:o,defaultValue:s,defaultUnit:u,unitOptions:d,positiveIntegerMode:m=!0,onChange:c,onUnitChange:f,onInputKeyUp:b}=e,[_,g]=(0,l.useState)(!1),[v,y]=(0,l.useState)(!1),{t:N}=(0,i.Z)("common"),[S,j]=(0,l.useState)(u),[C,w]=(0,l.useState)(s),[M,T]=(0,l.useState)(!0),[k,A]=(0,l.useState)(!0),E=()=>{g(e=>!e)},V=e=>(T(!0),"Years"===S)?e<=h.DF.MAX_YEAR:"Months"===S&&e<=h.DF.MAX_MONTH,F=e=>{j(e),g(!1),f&&f(e)};return(0,a.jsxs)("div",{className:"sm:mx-6 sm:my-2 md:mx-[30px] md:mb-2 md:mt-[30px]",children:[o&&(0,a.jsx)("div",{className:"text-textColor text-left leading-[1.5rem] font-[700] mb-[10px] text-[15px]",children:o}),(0,a.jsxs)("div",{className:(0,n.Z)("rounded-[10px] bg-white relative text-textColor border-grayColor",!_&&["border",C&&M&&k?v?"border-primaryColor":"border-grayColor":"border-errorColor"]),"data-testid":"input-group-container",children:[(0,a.jsxs)("div",{className:(0,n.Z)("py-[14px] px-[16px] flex justify-between items-center",_&&"border-x border-t border-primaryColor roun
1ded-t-[10px]"),children:[(0,a.jsx)("input",{ref:r,value:C,className:"focus:outline-none cursor-text w-full mr-[11px] placeholder:text-placeholder",onChange:e=>{let t=Number(e.target.value);w(e.target.value),A(V(t)),t||T(!1),t&&V(t)&&(null==c||c(e.target.value,S))},placeholder:null===(t=d.find(e=>e.unit===S))||void 0===t?void 0:t.placeholder,onFocus:()=>y(!0),onBlur:()=>y(!1),onKeyPress:e=>{let{target:t,charCode:r}=e,a=r<(Number(t.value)>0?48:49)||r>57;m&&a&&13!==r&&(T(!1),e.preventDefault())},onKeyUp:b,"aria-label":"input-dropdown"}),(0,a.jsxs)("div",{className:"cursor-pointer flex items-center",onClick:E,onKeyDown:E,"data-testid":"unit-value-container",role:"button",children:[(0,a.jsx)("span",{className:"text-textColor mr-[11.37px]","data-testid":"unit-value",children:"Months"===S?N("months"):N("years")}),(0,a.jsx)(x.Z,{className:(0,n.Z)("transition-all ease-in-out duration-300",_?"rotate-180":"rotate-0"),"aria-label":"arrow-icon"})]})]}),(0,a.jsx)("div",{className:(0,n.Z)("transition-all ease-in-out w-full z-21370001 bg-white shadow-[0_7px_15px_0_rgba(42,49,203,0.1)] absolute",_?"border-primaryColor border-x border-b rounded-b-[10px] max-h-[108px]":"max-h-0 duration-300 border-none"),children:(0,a.jsx)("div",{className:(0,n.Z)("overflow-auto",_?"duration-500 max-h-[97px]":"max-h-0"),children:d.map((e,t)=>(0,a.jsxs)("div",{className:(0,n.Z)("px-[14px] py-[12px] text-textColor hover:bg-dropDownItemHover hover:text-primaryColor cursor-pointer flex items-center justify-between",0===t&&"border-t border-grayColor",t>0&&"hover:rounded-b-[10px]"),onClick:()=>F(e.unit),onKeyDown:()=>F(e.unit),"data-testid":"unit-option-".concat(e.unit),role:"button",children:["Months"===e.unit?N("months"):N("years"),e.unit===S&&(0,a.jsx)(p.Z,{alt:"check icon"})]},e.unit))})})]}),!M&&(0,a.jsx)("div",{className:"text-errorColor text-left",children:N("required_error")}),!k&&(0,a.jsxs)("div",{className:"text-errorColor text-left",children:[N("loan_term.range_error",{unit:"Months"===S?h.DF.MAX_MONTH:h.DF.MAX_YEAR}),(0,a.jsx)("span",{className:"ml-1",children:"Months"===S?N("loan_term.less_months"):N("loan_term.less_years")})]})]})},b=r(11909),_=r(60715),g=function(e){var t,r,u;let{title:d,interestRate:m,sliderSalary:x,sliderLoanAmount:p,dropDownLoanTerm:g,monthlyPayment:v,button:y}=e,{t:N}=(0,i.Z)("common"),[S,j]=(0,l.useState)(Number(x.defaultValue)||Number(x.minValue)),[C,w]=(0,l.useState)(Number(p.minValue)),[M,T]=(0,l.useState)(0),[k,A]=(0,l.useState)(g.defaultUnit),[E,V]=(0,l.useState)(0),[F,P]=(0,l.useState)(),[Z,R]=(0,l.useState)(!1),[W,B]=(0,l.useState)(1.5*Number(p.minValue)),[Y,D]=(0,l.useState)(0),O=l.useRef(),U=l.useRef(),H=l.useRef(),I=[{unit:h.k4.MONTHS,placeholder:"Periods in months"},{unit:h.k4.YEARS,placeholder:"Periods in years"}],X=(0,o.TA)({initialValues:{},enableReinitialize:!0,onSubmit:()=>void 0});(0,l.useEffect)(()=>{S&&C&&M&&(V((0,h._G)(C,M,m)),P(()=>{var e;return(0,h.AL)(k,M,S,C,null!==(e=null==y?void 0:y.buttonUrl)&&void 0!==e?e:"")}))},[S,C,M,k]);let K=(0,l.useCallback)((e,t)=>{X.setFieldTouched(e),X.setFieldValue(e,t)},[X]);(0,l.useEffect)(()=>{R(!1),B(S<3e4?1.5*S:5*S),D(1e3)},[S]),(0,l.useEffect)(()=>{let e=Number(g.defaultValue);g.defaultUnit===h.k4.YEARS&&(e*=12),K("loanTerm",g.defaultValue),T(e)},[g]);let q=e=>{let t=e=>{let{value:t}=e;return void 0!==t?(0,s.moneyToNumber)(t):0},r=t(O.current),a=t(U.current),l=t(H.current),n=r<Number(p.minValue)||r>Number(W),o=a<Number(x.minValue)||a>Number(x.maxValue),i=(null!=e?e:k)===h.k4.YEARS?l>h.DF.MAX_YEAR:l>h.DF.MAX_MONTH;n||o||i||l<=0?R(!0):R(!1)},L=(0,l.useCallback)(e=>{K("salary",e),j(e),q()},[K,j]),z=(0,l.useCallback)(e=>{K("loanAmt",e),w(e),q()},[K,w]),G=(0,l.useCallback)((e,t)=>{K("loanTerm",e),T(t===h.k4.MONTHS?e:12*e),q(t)},[K,T]),J=(0,l.useCallback)(e=>{A(e);let t=X.getFieldProps("loanTerm").value;t=Number(t),T(e===h.k4.MONTHS?t:12*t),q(e)},[X]),Q=()=>{q()};return(0,l.useEffect)(()=>{Q()},[null===(t=O.current)||void 0===t?void 0:t.value,null===(r=U.current)||void 0===r?void 0:r.value,null===(u=H.current)||void 0===u?void 0:u.value]),(0,a.jsx)("div",{"data-testid":"loan_wizard",className:"max-w-[90rem] mx-auto my-0",children:(0,a.jsxs)("div",{className:"max-w-[90rem] my-0 mx-auto text-center",children:[(0,a.jsx)("h1",{className:"pb-2 pt-5 font-xl text-primaryColor sm:hidden md:block text-[22px] font-bold",children:d}),(0,a.jsxs)("div",{className:(0,n.Z)("sm:m-1 md:mx-[1.875rem] md:mt-4 md:mb-4","bg-white shadow-[0_7px_15px_0_rgba(42,49,203,0.1)] rounded-2xl","grid md:gap-4 md:grid-cols-3","normalIpad:grid normalIpad:grid-cols-2 ipadPortrait:grid ipadPortrait:grid-cols-2 ipadLandscape:grid ipadLandscape:grid-cols-3"),children:[(0,a.jsx)("div",{className:"mx-auto
1sm:block md:hidden my-0 pb-2 pt-5 font-xl flex text-primaryColor text-[22px] font-bold ipadPortrait:col-span-2",children:d}),x&&(0,a.jsx)(c,{dataTestId:"salary",inputRef:U,title:x.title,min:Number(x.minValue),max:Number(x.maxValue),step:Y,defaultValue:Number(x.defaultValue),suffix:x.suffix,onSliderChange:L,onInputKeyUp:Q,isError:Z}),p&&(0,a.jsx)(c,{inputRef:O,dataTestId:"loan-amount",title:p.title,min:Number(p.minValue),max:W,step:S>5e3?Y:100,defaultValue:Number(p.minValue),suffix:p.suffix,onSliderChange:z,onInputKeyUp:Q,isError:Z}),g&&(0,a.jsx)(f,{inputRef:H,title:g.title,defaultUnit:g.defaultUnit,defaultValue:g.defaultValue||"",unitOptions:I,onChange:G,onUnitChange:J,onInputKeyUp:Q}),v&&(0,a.jsxs)("div",{className:(0,n.Z)("md:col-span-2 sm:mx-6 sm:my-2 md:mx-[30px] md:mb-[30px] md:mt-4 bg-[#F9F9FC]","rounded-lg flex flex-wrap sm:flex-col md:flex-row sm:place-content-center h-[70px] text-textColor","ipadPortrait:flex-col ipadPortrait:items-center ipadPortrait:p-[10px] ipadPortrait:mb-[16px]"),children:[(0,a.jsxs)("div",{className:"md:flex-1 text-left px-4 md:inline-flex grid grid-cols-2 gap-4 md:gap-1",children:[(0,a.jsx)("p",{className:"font-bold whitespace-nowrap ipadPortrait:ml-0",children:v.title}),(0,a.jsxs)("div",{className:"grid grid-cols-8",children:[(0,a.jsx)("span",{className:"mr-2",children:":"}),(0,a.jsxs)("span",{className:"col-span-7 text-start",children:[(0,s.numberToMoney)(E)," ",v.suffix]})]})]}),(0,a.jsxs)("div",{className:"md:flex-1 text-left px-4 md:inline-flex grid grid-cols-2 gap-4 md:gap-1",children:[(0,a.jsx)("p",{className:"font-bold whitespace-nowrap md:ml-10",children:N("effective_rate.title")}),(0,a.jsxs)("div",{className:"grid grid-cols-8",children:[(0,a.jsx)("span",{className:"mr-2",children:":"}),(0,a.jsxs)("span",{className:"col-span-7 text-start whitespace-nowrap",children:[N("effective_rate.prefix")," ",m,N("effective_rate.suffix")]})]})]})]}),(0,a.jsx)("div",{className:"sm:m-4 md:mx-[30px] md:mb-[30px] md:mt-4",children:(0,a.jsx)(_.Z,{href:(null==y?void 0:y.buttonPageSlug)?null==y?void 0:y.buttonPageSlug.slug:null!=F?F:null==y?void 0:y.buttonUrl,rel:null==y?void 0:y.buttonLinkRel,isExternalLink:!(null==y?void 0:y.buttonPageSlug),passHref:!0,dataTestId:"in-page-link",className:"whitespace-nowrap",children:(0,a.jsx)(b.Z,{...y,isDisabled:Z,btnStyle:"min-w-full",isFullWidth:!0})})})]})]})})}},89758:function(e,t,r){"use strict";r.d(t,{AL:function(){return u},DF:function(){return o},_G:function(){return s},iI:function(){return d},k4:function(){return n}});var a,l,n,o,i=r(1887);(a=n||(n={})).YEARS="Years",a.MONTHS="Months",(l=o||(o={}))[l.MAX_YEAR=6]="MAX_YEAR",l[l.MAX_MONTH=72]="MAX_MONTH";let s=(e,t,r)=>{if(0===e||0===t||0===r)return 0;let a=r/100/12;return Math.round(e/((1-1/(1+a)**t)/a))},u=(e,t,r,a,l)=>{let n="Years"===e?(t/12).toString()+"years":t.toString()+"months",o=new URLSearchParams({salary:r.toString(),loanamount:a.toString(),loanterm:n}).toString();return"".concat(l,"?").concat(o)},d=(e,t,r,a)=>{let l=r<=3e4?1.5*r:5*r,n=6===a?0:11,o=6===a?t("loan_term.min_error"):t("loan_term.min_month_error");return e.object().shape({monthlySalary:e.number().required(t("required_error")).min(1,t("salary.min_error",{min:1})),loanAmt:e.number().required(t("required_error")).min(1,t("loan_amount.min_error",{min:1})).max(l,t("loan_amount.range_error",{min:1,max:(0,i.numberToMoney)(Math.round(l))})),loanTermYears:e.number().when("loanTermMonths",{is:0,then:()=>e.number().required().min(1,t("loan_term.error")).max(6,t("loan_term.min_year_error",{min:1,max:6})),otherwise:()=>e.number().min(0).max(6,t("loan_term.min_year_error",{min:1,max:6}))}),loanTermMonths:e.number().when("loanTermYears",{is:0,then:()=>e.number().required().min(1,t("loan_term.error")).max(n,o),otherwise:()=>e.number().min(0).max(n,o)})},[["loanTermMonths","loanTermYears"]])}},7639:function(e){e.exports={primaryColor:"#005098",textBoxWithSlider__rcSlider:"TextBoxWithSlider_textBoxWithSlider__rcSlider__20Baa",textBoxWithSlider__rcSliderSection:"TextBoxWithSlider_textBoxWithSlider__rcSliderSection__Fk6mW",textBoxWithSlider__currency:"TextBoxWithSlider_textBoxWithSlider__currency__W6ivj"}}}]); 2//# sourceMappingURL=1999.785dbc9ae2d6e252.js.map
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.