1import{j as e}from"./c-kIrgbF5a.js";import{r as u}from"./c-CxWec-l3.js";import{L as j}from"./c-CT3LHRuu.js";import{D as R}from"./c-BeNg_6Lm.js";import{K as k}from"./app-M4uDje7W.js";import"./c-DhZswihN.js";import"./c-DlhKbKJA.js";import"./c-Ckw_UaHk.js";import"./c-UFx9goMz.js";import"./c-DUzZC5Vl.js";import"./c-PUuJUs18.js";import"./c-o9qr-hkC.js";import"./c-GSNKH8eo.js";import"./c-DBR7hqUm.js";import"./c-BT-tcQYN.js";import"./c-Bz8kG2xq.js";import"./c-j708u-1z.js";import"./c-CFbKinp0.js";import"./c-i5fp2Xux.js";import"./c-DcJuuiQm.js";import"./c-B0yiNQXQ.js";import"./c-DgeKdhQN.js";import"./c-Blkj3mhK.js";import"./c-BmqhbrPq.js";import"./c-B89BEKI0.js";import"./c-cT2ZKdOz.js";import"./c-C-rKfeXX.js";import"./c-sNjF-Dby.js";import"./c-BX_y-627.js";import"./c-Bxt7UlHc.js";import"./c-CkYKwpcT.js";import"./c-BdDwYJeX.js";import"./c-BYHQsW3J.js";import"./c-B-EfqvYX.js";import"./c-Dy3Lag_c.js";import"./c-CHIvDfoy.js";import"./c-DWWpB646.js";import"./c-CBpOQ5Oy.js";import"./c-BkpGQeTt.js";import"./c-D0cUO2RN.js";import"./c-BRtdyFg3.js";import"./c-y4WBau-l.js";import"./c-BNuwloLa.js";import"./c-PaQdZVQY.js";import"./c-DePa6SJS.js";import"./c-DsTkbm-I.js";import"./c-BuiBjdpU.js";import"./c-BqXtzxhB.js";import"./c-ByoWpCGZ.js";import"./c-Dh8isEIW.js";import"./c-XigvQw4p.js";import"./c-PB3kTQ55.js";import"./c-CNWJLL6w.js";import"./c-CTte_Iqn.js";import"./c-DH8ZsXTi.js";import"./c-Jku_zpnh.js";import"./c-CPajVTWD.js";import"./c-Bx5GxluL.js";import"./c-DoKZoJFh.js";import"./c-Ci_OL1v2.js";import"./c-DSjpaNRf.js";import"./c-DLoi9O9H.js";import"./c-CGKIWI_B.js";import"./c-CU5uHpT1.js";import"./c-DrCvoRt3.js";import"./c-BK9ywHlx.js";import"./c-_bYq_IoL.js";import"./c-DXo0hw5g.js";import"./c-fFhJChsR.js";import"./c-Bqh_gdhd.js";import"./c-DQkxnxKY.js";import"./c-Br6DJ3uc.js";import"./c-D6ANMWgq.js";import"./c-jS7wsAh2.js";import"./c-BvDh3_xm.js";import"./c-4U3OvP22.js";import"./c-BA0Mi6P7.js";import"./c-8Ow3CZq5.js";import"./c-Bmec3cgW.js";import"./c-BQWMjUC4.js";import"./c-BmAmJC21.js";import"./c-Dl6_5drd.js";import"./c-sxZdTkrL.js";import"./c-Dxk8vG76.js";import"./c-D1BsncVd.js";import"./c-BFN4pAwG.js";import"./c-nbrZaFxD.js";import"./c-DqO456d0.js";import"./c-CGuipoGd.js";import"./c-B3_DM-aH.js";const A={programs:{homePossible:!1,homeOne:!1,hfaAdvantage:!1,incomeLimitExceeded:!1},property:{projectType:"Single Family",mixedUse:!1,manufactured:!1},financing:{interestType:"Fixed",buydownType:"None",buydownStructure:"2-1",buydownFinanced:0,miType:"Borrower-Paid Monthly",miFinanced:0,secondary:{present:!1,amount:0,source:"None"}},funds:{giftAmount:0,giftSource:"Relative",grantAmount:0,grantSource:"",sweatEquity:!1},condo:{warrantyType:"Standard",projectReview:"Full"},underwriting:{lpaId:"",lpaRiskClass:"Accept",reliefRefi:!1}};function b(t){const a=g(t);return isNaN(a)?0:a}const hn=({application:t,onUpdate:a})=>{const o=(t==null?void 0:t.id)||null,[i,d]=u.useState(A),[F,v]=u.useState(!1),[N,m]=u.useState(""),h=u.useRef(null);u.useEffect(()=>{let n=!0;return(async()=>{var p;if(o)try{const x=await j.get(o),y=(p=x==null?void 0:x.disclosures)==null?void 0:p.freddieAdditional;n&&y&&d({...A,...y})}catch{}})(),()=>{n=!1}},[o]);const r=u.useCallback((n,p)=>{d(x=>{const y=JSON.parse(JSON.stringify(x)),C=n.split(".");let w=y;for(let S=0;S<C.length-1;S++)w=w[C[S]];return w[C[C.length-1]]=p,y})},[]);u.useEffect(()=>{if(o)return h.current&&clearTimeout(h.current),h.current=setTimeout(async()=>{try{v(!0),m("Savingâ¦");const n=await j.get(o),p={...(n==null?void 0:n.disclosures)||{},freddieAdditional:i};await j.update(o,{disclosures:p}),m("Saved"),setTimeout(()=>m(""),2e3)}catch{m("Save failed")}finally{v(!1)}},800),()=>h.current&&clearTimeout(h.current)},[i,o]),u.useEffect(()=>{a==null||a(i)},[i,a]);const P=i.programs.homePossible;return e.jsxs("div",{className:"form-container",children:[e.jsxs("div",{className:"form-header",style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("h2",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(R,{size:24})," Freddie Mac Additional Data"]}
1),e.jsx("div",{style:{color:"#9CA3AF"},children:F?"Savingâ¦":N})]}),e.jsxs("div",{className:"form-content",style:{display:"grid",gap:16},children:[e.jsxs(f,{title:"Affordable Programs",children:[e.jsxs(l,{children:[e.jsx(c,{label:"Home Possible",checked:i.programs.homePossible,onChange:n=>r("programs.homePossible",n)}),e.jsx(c,{label:"HomeOne",checked:i.programs.homeOne,onChange:n=>r("programs.homeOne",n)}),e.jsx(c,{label:"HFA Advantage",checked:i.programs.hfaAdvantage,onChange:n=>r("programs.hfaAdvantage",n)}),e.jsx(c,{label:"Income Limit Exceeded",checked:i.programs.incomeLimitExceeded,onChange:n=>r("programs.incomeLimitExceeded",n)})]}),P&&e.jsx(l,{children:e.jsx(E,{text:"Home Possible selected: verify income limits, borrower education, and occupancy requirements."})})]}),e.jsx(f,{title:"Property",children:e.jsxs(l,{children:[e.jsx(s,{label:"Project Type",value:i.property.projectType,onChange:n=>r("property.projectType",n),options:["Single Family","Condo","PUD","Co-op","Manufactured Home"]}),e.jsx(c,{label:"Mixed Use",checked:i.property.mixedUse,onChange:n=>r("property.mixedUse",n)}),e.jsx(c,{label:"Manufactured",checked:i.property.manufactured,onChange:n=>r("property.manufactured",n)})]})}),e.jsxs(f,{title:"Financing & MI",children:[e.jsxs(l,{children:[e.jsx(s,{label:"Interest Type",value:i.financing.interestType,onChange:n=>r("financing.interestType",n),options:["Fixed","ARM"]}
1),e.jsx(s,{label:"Buydown",value:i.financing.buydownType,onChange:n=>r("financing.buydownType",n),options:["None","Temporary","Permanent"]}),i.financing.buydownType!=="None"&&e.jsxs(e.Fragment,{children:[e.jsx(s,{label:"Structure",value:i.financing.buydownStructure,onChange:n=>r("financing.buydownStructure",n),options:["2-1","3-2-1","1-0"]}),e.jsx(g,{label:"Financed Buydown ($)",value:i.financing.buydownFinanced,onChange:n=>r("financing.buydownFinanced",b(n))})]})]}),e.jsxs(l,{children:[e.jsx(s,{label:"MI Type",value:i.financing.miType,onChange:n=>r("financing.miType",n),options:["Borrower-Paid Monthly","Lender-Paid","Single Premium"]}),e.jsx(g,{label:"Financed MI ($)",value:i.financing.miFinanced,onChange:n=>r("financing.miFinanced",b(n))})]}),e.jsxs(l,{children:[e.jsx(c,{label:"Secondary Financing Present",checked:i.financing.secondary.present,onChange:n=>r("financing.secondary.present",n)}),i.financing.secondary.present&&e.jsxs(e.Fragment,{children:[e.jsx(g,{label:"Secondary Amount ($)",value:i.financing.secondary.amount,onChange:n=>r("financing.secondary.amount",b(n))}),e.jsx(s,{label:"Source",value:i.financing.secondary.source,onChange:n=>r("financing.secondary.source",n),options:["HELOC","HFA","Community Second","Other","None"]})]})]})]}),e.jsx(f,{title:"Funds to Close (Freddie-specific sources)",children:e.jsxs(l,{children:[e.jsx(g,{label:"Gift Funds ($)",value:i.funds.giftAmount,onChange:n=>r("funds.giftAmount",b(n))}),e.jsx(s,{label:"Gift Source",value:i.funds.giftSource,onChange:n=>r("funds.giftSource",n),options:["Relative","Employer","Nonprofit","Government"]}),e.jsx(g,{label:"Grant ($)",value:i.funds.grantAmount,onChange:n=>r("funds.grantAmount",b(n))}),e.jsx(T,{label:"Grant Source",value:i.funds.grantSource,onChange:n=>r("funds.grantSource",n)}),e.jsx(c,{label:"Sweat Equity Used",checked:i.funds.sweatEquity,onChange:n=>r("funds.sweatEquity",n)})]})}),e.jsx(f,{title:"Condo / Project Review",children:e.jsxs(l,{children:[e.jsx(s,{label:"Warranty Type",value:i.condo.warrantyType,onChange:n=>r("condo.warrantyType",n),options:["Standard","Alternative","Limited"]}),e.jsx(s,{label:"Project Review",value:i.condo.projectReview,onChange:n=>r("condo.projectReview",n),options:["Full","Streamlined"]})]})}),e.jsx(f,{title:"Underwriting",children:e.jsxs(l,{children:[e.jsx(T,{label:"LPA Submission ID",value:i.underwriting.lpaId,onChange:n=>r("underwriting.lpaId",n)}),e.jsx(s,{label:"LPA Risk Class",value:i.underwriting.lpaRiskClass,onChange:n=>r("underwriting.lpaRiskClass",n),options:["Accept","Caution","Refer"]}),e.jsx(c,{label:"Relief Refinance",checked:i.underwriting.reliefRefi,onChange:n=>r("underwriting.reliefRefi",n)})]})}),e.jsx("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:e.jsxs("button",{className:"save-btn",onClick:async()=>{if(o){v(!0),m("Savingâ¦");try{const n=await j.get(o),p={...(n==null?void 0:n.disclosures)||{},freddieAdditional:i};await j.update(o,{disclosures:p}),m("Saved"),setTimeout(()=>m(""),1500)}catch{m("Save failed")}finally{v(!1)}}},children:[e.jsx(k,{size:16})," Save"]})})]})]})};function f({title:t,children:a}){return e.jsxs("div",{className:"form-section",style:{background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.08)"},children:[e.jsx("div",{className:"section-header",children:e.jsx("h3",{children:t})}),e.jsx("div",{className:"form-grid",children:a})]})}function l({children:t}){return e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:12},children:t})}function c({label:t,checked:a,onChange:o}){return e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,color:"#E5E7EB"},children:[e.jsx("input",{type:"checkbox",checked:!!a,onChange:i=>o(i.target.checked)})," ",t]})}function s({label:t,value:a,onChange:o,options:i}){return e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:t}),e.jsx("select",{value:a,onChange:d=>o(d.target.value),children:i.map(d=>e.jsx("option",{value:d,children:d},d))})]})}function g({label:t,value:a,onChange:o}){return e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:t}),e.jsx("input",{type:"number",value:a,onChange:i=>o(i.target.value)})]})}function T({label:t,value:a,onChange:o}){return e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:t}),e.jsx("input",{value:a,onChange:i=>o(i.target.value)})]})}function E({text:t}
1){return e.jsx("div",{style:{color:"#9CA3AF"},children:t})}export{hn 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.