1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c587a890-6d60-422a-a26c-87855bb5deb1",e._sentryDebugIdIdentifier="sentry-dbid-c587a890-6d60-422a-a26c-87855bb5deb1")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[50752,74264],{50752:(e,t,o)=>{o.r(t),o.d(t,{NmlsImportModal:()=>g});var r=o(95155),n=o(12115),l=o(54515),a=o(59964),i=o(76150),s=o(86555),d=o(11856),c=o(8898),x=o(17943),p=o(74264),u=o(73457);function h(e){return null!=e&&e>0&&e<=20}function f(e){let{candidate:t}=e;return"existing"===t.status?(0,r.jsx)(l.Badge,{colorPalette:"gray",children:"Already imported"}):h(t.rate)?t.refinancedAway?(0,r.jsx)(l.Badge,{colorPalette:"red",children:"Refinanced away"}):(0,r.jsx)(l.Badge,{colorPalette:"green",children:"Current"}):(0,r.jsx)(l.Badge,{colorPalette:"orange",children:"No rate on file"})}function g(e){let{isOpen:t,onClose:o,onImportComplete:l}=e,[g,b]=(0,n.useState)(!0),[m,y]=(0,n.useState)(null),[j,k]=(0,n.useState)([]),[S,w]=(0,n.useState)(new Set),[C,v]=(0,n.use
1State)(!1),[B,z]=(0,n.useState)(null);(0,n.useEffect)(()=>{if(!t)return;let e=!1;return b(!0),y(null),z(null),(async()=>{try{var t;let o=await fetch("/api/clients/import-nmls",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"preview"})}),r=await o.json();if(!o.ok)throw Error("no_nmls"===r.error?"Add your NMLS number in Branding first â the import is built from your NMLS loan history.":r.error||"Failed to load loan history");if(e)return;let n=null!=(t=r.candidates)?t:[];k(n),w(new Set(n.filter(e=>"existing"!==e.status&&h(e.rate)).map(e=>e.loanId)))}catch(t){e||y(t instanceof Error?t.message:"Failed to load loan history")}finally{e||b(!1)}})(),()=>{e=!0}},[t]);let I=(0,n.useMemo)(()=>j.filter(e=>"existing"!==e.status&&h(e.rate)),[j]),T=(0,n.useCallback)(e=>{w(t=>{let o=new Set(t);return o.has(e)?o.delete(e):o.add(e),o})},[]),N=(0,n.useCallback)(()=>{w(e=>e.size>=I.length?new Set:new Set(I.map(e=>e.loanId)))},[I]),P=(0,n.useCallback)(async()=>{v(!0),y(null);try{let e=await fetch("/api/clients/import-nmls",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"commit",loanIds:Array.from(S)})}),t=await e.json();if(!e.ok)throw Error(t.error||"Import failed");z(t.data),l()}catch(e){y(e instanceof Error?e.message:"Import failed")}finally{v(!1)}},[S,l]);return(0,r.jsx)(p.aF,{isOpen:t,onClose:o,size:"2xl",title:"Import from your NMLS history",children:(0,r.jsxs)(a.VStack,{align:"stretch",gap:4,p:2,children:[g&&(0,r.jsxs)(i.HStack,{py:10,justify:"center",children:[(0,r.jsx)(s.Spinner,{color:"purple.500"}),(0,r.jsx)(d.Text,{color:"gray.600",children:"Pulling your recorded loan historyâ¦"})]}),m&&(0,r.jsx)(d.Text,{fontSize:"sm",color:"red.600",children:m}),B&&(0,r.jsxs)(c.Box,{bg:"green.50",borderRadius:"lg",p:4,children:[(0,r.jsxs)(d.Text,{fontWeight:"semibold",color:"green.800",children:["Imported ",B.inserted," client",1===B.inserted?"":"s",B.updated>0?", updated ".concat(B.updated):"",B.contactsQueued>0?" \xb7 contact lookup queued for ".concat(B.contactsQueued," clients"):""]}),B.skippedNoRate?(0,r.jsxs)(d.Text,{fontSize:"sm",color:"green.700",mt:1,children:[B.skippedNoRate," skipped â no rate on file"]}):null,(0,r.jsx)(x.Button,{mt:3,size:"sm",colorPalette:"purple",onClick:o,children:"Done"})]}),!g&&!B&&0===j.length&&!m&&(0,r.jsx)(d.Text,{fontSize:"sm",color:"gray.600",children:"No recorded loans foun
1d for your NMLS number."}),!g&&!B&&j.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(i.HStack,{justify:"space-between",wrap:"wrap",gap:2,children:[(0,r.jsxs)(d.Text,{fontSize:"sm",color:"gray.600",children:[j.length," recorded loan",1===j.length?"":"s"," \xb7"," ",I.length," importable \xb7"," ",j.filter(e=>e.refinancedAway).length," refinanced away"]}),(0,r.jsx)(x.Button,{size:"xs",variant:"outline",colorPalette:"purple",onClick:N,children:S.size>=I.length?"Deselect all":"Select all"})]}),(0,r.jsx)(c.Box,{maxH:"420px",overflowY:"auto",borderWidth:"1px",borderColor:"gray.100",borderRadius:"lg",children:j.map(e=>{var t,o;let n="existing"===e.status||!h(e.rate);return(0,r.jsxs)(i.HStack,{px:3,py:2,gap:3,borderBottomWidth:"1px",borderColor:"gray.50",opacity:n?.55:1,cursor:n?"default":"pointer",onClick:()=>!n&&T(e.loanId),children:[(0,r.jsx)(u.S,{checked:S.has(e.loanId),disabled:n,onCheckedChange:()=>T(e.loanId),colorPalette:"purple",onClick:e=>e.stopPropagation()}),(0,r.jsxs)(c.Box,{flex:"1",minW:0,children:[(0,r.jsx)(d.Text,{fontSize:"sm",fontWeight:"medium",color:"gray.900",truncate:!0,children:e.borrowerName}),(0,r.jsx)(d.Text,{fontSize:"xs",color:"gray.500",truncate:!0,children:e.address})]}),(0,r.jsxs)(c.Box,{textAlign:"right",flexShrink:0,children:[(0,r.jsx)(d.Text,{fontSize:"sm",color:"gray.800",children:null==(o=e.loanAmount)?"â":"$".concat(Math.round(o).toLocaleString())}),(0,r.jsxs)(d.Text,{fontSize:"xs",color:"gray.500",children:[null!=(t=e.dateClosed)?t:"â",null!=e.rate?" \xb7 ".concat(e.rate,"%"):""]})]}),(0,r.jsx)(c.Box,{flexShrink:0,children:(0,r.jsx)(f,{candidate:e})})]},e.loanId)})}),(0,r.jsx)(d.Text,{fontSize:"sm",color:"gray.700",children:"Missing emails and phone numbers are looked up automatically for every imported client. Phone numbers are DNC-checked. Processing continues in the background."}),(0,r.jsxs)(i.HStack,{justify:"flex-end",gap:2,children:[(0,r.jsx)(x.Button,{variant:"ghost",onClick:o,disabled:C,children:"Cancel"}),(0,r.jsx)(x.Button,{colorPalette:"purple",onClick:P,disabled:0===S.size||
1C,children:C?(0,r.jsx)(s.Spinner,{size:"sm"}):"Import ".concat(S.size," client").concat(1===S.size?"":"s")})]})]})]})})}},74264:(e,t,o)=>{o.d(t,{$m:()=>p,aF:()=>c,cw:()=>h,jl:()=>f,mH:()=>x,rQ:()=>u,s_:()=>g});var r=o(95155),n=o(12115),l=o(58579),a=o(8898),i=o(66255),s=o(28122);let d={sm:"400px",md:"600px",lg:"800px",xl:"1000px","2xl":"1200px","3xl":"1400px","4xl":"1600px"},c=e=>{let{isOpen:t,onClose:o,children:c,size:x="2xl",title:p,appearance:u="default"}=e,h="homeai"===u;return((0,n.useEffect)(()=>{if(!t)return;let e=document.body;return e.classList.add("modal-open"),()=>{e.classList.remove("modal-open")}},[t]),t)?(0,r.jsxs)(l.Portal,{children:[(0,r.jsx)(a.Box,{position:"fixed",top:0,left:0,right:0,bottom:0,bg:"rgba(0, 0, 0, 0.4)",zIndex:1e3,onClick:o}),(0,r.jsx)(a.Box,{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1001,display:"flex",alignItems:"center",justifyContent:"center",children:(0,r.jsxs)(a.Box,{position:"relative",maxW:d[x]||x,w:"90%",maxH:"90vh",overflowY:"auto",bg:"surfaceElevated",borderRadius:h?"12px":"2xl",boxShadow:h?{base:"0 24px 64px rgba(15, 23, 42, 0.18)",_dark:"0 24px 64px rgba(0, 0, 0, 0.52)"}:"0 20px 60px -10px rgba(120, 40, 250, 0.3)",border:"1px solid",borderColor:h?"border":"rgba(120, 40, 250, 0.1)",pointerEvents:"auto",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)(i.IconButton,{position:"absolute",top:4,right:4,size:"sm",variant:"ghost",borderRadius:h?"8px":"full",onClick:o,"aria-label":"Close modal",color:h?"ink.medium":"gray.600",_hover:{bg:"surfaceMuted",color:h?"ink.strong":"gray.800"},zIndex:1,children:(0,r.jsx)(s.yGN,{})}),p&&(0,r.jsx)(a.Box,{fontSize:"2xl",fontWeight:"bold",color:h?"ink.strong":"purple.800",p:6,pb:2,children:p}),(0,r.jsx)(a.Box,{p:6,pt:p?4:6,children:c})]})})]}):null},x=e=>{let{bg:t="blackAlpha.400",backdropFilter:o,onClick:n,zIndex:l=1e3}=e;return(0,r.jsx)(a.Box,{position:"fixed",top:0,left:0,right:0,bottom:0,bg:t,...o&&{backdropFilter:o},zIndex:l,onClick:n})},p=e=>{let{children:t,maxW:o="2xl",maxH:n="90vh",overflow:l="auto",bg:i="surfaceElevated",borderRadius:s="2xl",boxShadow:d="0 20px 60px -10px rgba(120, 40, 250, 0.3)",appearance:c="default"}=e,x="homeai"===c;return(0,r.jsx)(a.Box,{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1001,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",children:(0,r.jsx)(a.Box,{position:"relative",maxW:o,w:"90%",maxH:n,overflowY:l,bg:i,borderRadius:s,boxShadow:d,border:"1px solid",borderColor:x?"border":"rgba(120, 40, 250, 0.1)",pointerEvents:"auto",onClick:e=>e.stopPropagation(),_before:x?void 0:{content:'""',position:"absolute",inset:0,borderRadius:"2xl",padding:"2px",background:"linear-gradient(135deg, purple.400, purple.700)",mask:"linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",maskComposite:"exclude",opacity:.15,zIndex:-1},children:t})})},u=e=>{let{children:t,pt:o=6,pb:n=2}=e;return(0,r.jsx)(a.Box,{fontSize:"2xl",fontWeight:"bold",color:"purple.800",p:6,pt:o,pb:n,children:t})},h=e=>{let{children:t,px:o=6,py:n=4,overflow:l,maxH:i}=e;return(0,r.jsx)(a.Box,{px:o,py:n,overflow:l,maxH:i,children:t})},f=e=>{let{children:t,px:o=6,pb:n}=e;return(0,r.jsx)(a.Box,{p:6,px:o,pb:void 0!==n?n:6,pt:4,borderTop:"1px solid",borderColor:"border.DEFAULT",bg:"primaryMuted",borderBottomRadius:"2xl",children:t})},g=e=>{let{onClick:t,borderRadius:o="full",appearance:n="default"}=e;return(0,r.jsx)(i.IconButton,{position:"absolute",top:4,right:4,size:"sm",variant:"ghost",borderRadius:o,onClick:t,"aria-label":"Close modal",color:"homeai"===n?"ink.medium":"gray.600",_hover:{bg:"surfaceMuted",color:"homeai"===n?"ink.strong":"gray.800"},children:(0,r.jsx)(s.yGN,{})})}}}]);
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.