{"version":3,"file":"ReviewFirstHomeRepayments.BQq2z4II.mjs","names":["React.useState","p","React.useRef","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","_e","p","ce","de","init_framer_BpuvUAiZ","addPropertyControls","ControlType","ReviewFirstHomeRepayments","price","setPrice","equity","setEquity","rate","setRate","preset","setPreset","deposit","p$1","e","valid","r","monthly","input","content","resourcesDropdown","style","value","ResourcesDropdown","open","setOpen","ref","timer","reveal","anchor","click","link","event","url","title","init_ReviewFirstHomeRepayments","init_jsx_runtime"],"sources":["https:/framerusercontent.com/modules/3LJDgyk0WU8aJ5Zavu5i/bLxIlUB8sxVlLBO31vMt/ReviewFirstHomeRepayments.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import*as React from\"react\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function ReviewFirstHomeRepayments({style,resourcesDropdown=false}){const[price,setPrice]=React.useState(\"545000\"),[equity,setEquity]=React.useState(\"109000\");const[rate,setRate]=React.useState(\"6\");const[preset,setPreset]=React.useState(null);const deposit=preset===null?equity:Number(price)>0?String(Math.round(Number(price)*preset/100*100)/100):\"\";const p=Number(price),e=Number(deposit),valid=price.trim()!==\"\"&&deposit.trim()!==\"\"&&Number.isFinite(p)&&Number.isFinite(e)&&p>0&&e>=0&&e<=p&&rate.trim()!==\"\"&&Number.isFinite(Number(rate))&&Number(rate)>=0;const r=Number(rate)/1200,n=360,monthly=r===0?(p-e)/n:(p-e)*r*Math.pow(1+r,n)/(Math.pow(1+r,n)-1);const input={font:\"inherit\",width:\"100%\",boxSizing:\"border-box\",padding:\"14px 0\",border:0,borderBottom:\"1px solid #3E4929\",borderRadius:0,background:\"transparent\",color:\"#3e4929\"};const content=/*#__PURE__*/_jsxs(\"div\",{\"data-tracking-calculator\":\"repayment\",id:\"first-home-repayment-inline\",style:{fontFamily:'\"Archi Sans Light\",sans-serif',fontSize:16,color:\"#3e4929\",width:\"100%\",...resourcesDropdown?{fontFamily:'\"Archi Sans\",sans-serif',background:\"#f3f7f2\",padding:20,borderRadius:12,boxSizing:\"border-box\"}:{},...style},children:[/*#__PURE__*/_jsx(\"style\",{children:`@media(max-width:600px){#first-home-repayment-inline .fhb-input-columns{grid-template-columns:minmax(0,1fr)!important}}`}),!resourcesDropdown&&/*#__PURE__*/_jsx(\"h2\",{style:{fontFamily:'\"Archi Sans Light\",sans-serif',fontWeight:400,fontSize:28,lineHeight:1.2,margin:\"0 0 24px\"},children:\"Repayment calculator\"}),/*#__PURE__*/_jsxs(\"div\",{style:{paddingTop:0},children:[/*#__PURE__*/_jsxs(\"div\",{className:\"fhb-input-columns\",style:{display:\"grid\",gridTemplateColumns:\"repeat(2,minmax(0,1fr))\",gap:32},children:[/*#__PURE__*/_jsxs(\"label\",{children:[\"Purchase price (NZD)\",/*#__PURE__*/_jsx(\"input\",{\"data-tracking-calculator\":\"repayment\",\"data-tracking-field\":\"price\",\"aria-label\":\"Purchase price\",type:\"number\",min:\"1\",value:price,onChange:e=>setPrice(e.target.value),style:input})]}),/*#__PURE__*/_jsxs(\"label\",{children:[\"Your deposit / equity (NZD)\",/*#__PURE__*/_jsx(\"input\",{\"data-tracking-calculator\":\"repayment\",\"data-tracking-field\":\"equity\",\"aria-label\":\"Your deposit or equity\",type:\"number\",min:\"0\",value:deposit,onChange:e=>{setEquity(e.target.value);setPreset(null);},style:input})]}),/*#__PURE__*/_jsxs(\"label\",{children:[\"Interest rate (% p.a.)\",/*#__PURE__*/_jsx(\"input\",{\"data-tracking-calculator\":\"repayment\",\"data-tracking-field\":\"rate\",\"aria-label\":\"Interest rate (% p.a.)\",type:\"number\",min:\"0\",step:\"0.1\",value:rate,onChange:e=>setRate(e.target.value),style:input})]}),/*#__PURE__*/_jsxs(\"div\",{role:\"group\",\"aria-label\":\"Deposit percentage\",style:{display:\"flex\",flexWrap:\"wrap\",gap:12,marginTop:0,gridColumn:\"-2 / -1\"},children:[[5,10].map(value=>/*#__PURE__*/_jsxs(\"button\",{\"data-tracking-calculator\":\"repayment\",\"data-tracking-field\":\"deposit_preset\",type:\"button\",\"aria-pressed\":preset===value,onClick:()=>setPreset(value),style:{font:\"inherit\",color:\"#3e4929\",background:preset===value?\"#e4e9de\":\"transparent\",border:\"1px solid #3e4929\",boxShadow:\"none\",height:44,minHeight:44,boxSizing:\"border-box\",display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",lineHeight:1.25,padding:\"0 20px\",cursor:\"pointer\"},children:[value,\"% deposit\"]},value)),/*#__PURE__*/_jsx(\"button\",{\"data-tracking-calculator\":\"repayment\",\"data-tracking-field\":\"deposit_preset\",type:\"button\",\"aria-pressed\":preset===null,onClick:()=>{setEquity(deposit);setPreset(null);},style:{font:\"inherit\",color:\"#3e4929\",background:preset===null?\"#e4e9de\":\"transparent\",border:\"1px solid #3e4929\",height:44,minHeight:44,boxSizing:\"border-box\",display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",lineHeight:1.25,padding:\"0 20px\",cursor:\"pointer\"},children:\"Custom amount\"})]})]}),/*#__PURE__*/_jsx(\"div\",{\"aria-live\":\"polite\",style:{padding:\"32px 0\",fontSize:24,color:\"#3E4929\"},children:valid?new Intl.NumberFormat(\"en-NZ\",{style:\"currency\",currency:\"NZD\",maximumFractionDigits:0}).format(monthly*12/52)+\" per week\":\"Enter a valid price and equity between zero and the purchase price.\"}),/*#__PURE__*/_jsxs(\"p\",{style:{fontSize:14,lineHeight:1.5},children:[\"Illustrative P&I only: \",rate,\"% annual interest, a 30-year term and monthly repayments converted to a weekly equivalent. Excludes fees, insurance, rates and other costs. Rates and lender terms can change. This is not financial advice or a lending approval.\"]}),/*#__PURE__*/_jsx(\"p\",{style:{fontSize:14,lineHeight:1.5},children:\"A 5% contract deposit is separate from the equity your lender requires. Finance approval depends on your circumstances and lender.\"})]})]});return resourcesDropdown?/*#__PURE__*/_jsx(ResourcesDropdown,{title:\"Repayment calculator\",anchor:\"repayment-calculator\",children:content}):content;}function ResourcesDropdown({title,anchor,children}){const[open,setOpen]=React.useState(false);const ref=React.useRef(null);React.useEffect(()=>{let timer;const reveal=()=>{if(window.location.hash!==\"#\"+anchor)return;setOpen(true);timer=setTimeout(()=>ref.current?.scrollIntoView({block:\"start\",behavior:\"smooth\"}),100);};const click=event=>{const link=event.target?.closest?.(\"a[href]\");if(!link)return;const url=new URL(link.getAttribute(\"href\")||\"\",window.location.href);if(url.pathname===window.location.pathname&&url.hash===\"#\"+anchor){setOpen(true);timer=setTimeout(()=>ref.current?.scrollIntoView({block:\"start\",behavior:\"smooth\"}),100);}};reveal();window.addEventListener(\"hashchange\",reveal);document.addEventListener(\"click\",click);return()=>{clearTimeout(timer);window.removeEventListener(\"hashchange\",reveal);document.removeEventListener(\"click\",click);};},[anchor]);return /*#__PURE__*/_jsxs(\"details\",{ref:ref,open:open,onToggle:event=>setOpen(event.currentTarget.open),style:{width:\"100%\",boxSizing:\"border-box\",background:\"#f3f7f2\",border:\"none\",borderRadius:12,color:\"#3e4929\",fontFamily:'\"Archi Sans\",sans-serif',scrollMarginTop:100,overflow:\"hidden\"},children:[/*#__PURE__*/_jsxs(\"summary\",{\"aria-expanded\":open,\"aria-controls\":anchor+\"-content\",style:{cursor:\"pointer\",minHeight:64,padding:\"16px 20px\",boxSizing:\"border-box\",font:\"inherit\",display:\"flex\",alignItems:\"center\",justifyContent:\"space-between\",listStyle:\"none\",gap:24},children:[/*#__PURE__*/_jsx(\"h2\",{style:{display:\"inline\",font:\"inherit\",fontSize:24,fontWeight:300,lineHeight:1.3,margin:0},children:title}),/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{width:10,height:10,flexShrink:0,borderRight:\"1.5px solid currentColor\",borderBottom:\"1.5px solid currentColor\",transform:open?\"rotate(225deg)\":\"rotate(45deg)\",marginRight:4}})]}),/*#__PURE__*/_jsx(\"div\",{id:anchor+\"-content\",children:children})]});}addPropertyControls(ReviewFirstHomeRepayments,{resourcesDropdown:{type:ControlType.Boolean,title:\"Resources dropdown\",defaultValue:false}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ReviewFirstHomeRepayments\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ReviewFirstHomeRepayments.map"],"mappings":"A,mMAGG,SAAwBc,EAA0B,CAAC,QAAM,oBAAkB,IAAO,CAAC,GAAK,CAACC,EAAMC,GAAUhB,EAAe,QAAQ,EAAE,CAACiB,EAAOC,GAAWlB,EAAe,QAAQ,EAAO,CAACmB,EAAKC,GAASpB,EAAe,GAAG,EAAO,CAACqB,EAAOC,GAAWtB,EAAe,IAAI,EAAQuB,EAAQF,IAAS,KAAKJ,EAAO,OAAOF,CAAK,EAAE,EAAE,OAAO,KAAK,MAAM,OAAOA,CAAK,EAAEM,EAAO,IAAI,GAAG,EAAE,GAAG,EAAE,GAASpB,EAAE,OAAOc,CAAK,EAAEU,EAAE,OAAOF,CAAO,EAAEG,EAAMX,EAAM,KAAK,IAAI,IAAIQ,EAAQ,KAAK,IAAI,IAAI,OAAO,SAAStB,CAAC,GAAG,OAAO,SAASwB,CAAC,GAAGxB,EAAE,GAAGwB,GAAG,GAAGA,GAAGxB,GAAGkB,EAAK,KAAK,IAAI,IAAI,OAAO,SAAS,OAAOA,CAAI,CAAC,GAAG,OAAOA,CAAI,GAAG,EAAQQ,EAAE,OAAOR,CAAI,EAAE,KAAWS,EAAQD,IAAI,GAAG1B,EAAEwB,GAAG,KAAGxB,EAAEwB,GAAGE,GAAW,EAAEA,IAAE,MAAa,EAAEA,IAAE,IAAG,GAASE,EAAM,CAAC,KAAK,UAAU,MAAM,OAAO,UAAU,aAAa,QAAQ,SAAS,OAAO,EAAE,aAAa,oBAAoB,aAAa,EAAE,WAAW,cAAc,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