1import{f as q,c as R,j as e,y as $,d as y,B as S,L as d,h as n}from"./index-CudHG6B4.js";import{L as k}from"./loanStatusPhrases-DlhLah3k.js";import{C as m,a as x}from"./card-5b9UOcPu.js";import{B as _}from"./badge-CMf0SrHQ.js";import{M as A,S as f}from"./skeleton-BegiI0pz.js";import{V as F}from"./V2Layout-CQnVHc2g.js";import{a as M}from"./loanFormatters-CYtLy_Ys.js";import{C as p}from"./clock-DzjvzExH.js";import{C as B}from"./circle-alert-CRUc3mQk.js";import{A as C}from"./arrow-right-B1UlrPw0.js";import{C as L}from"./circle-check-CTosiqnS.js";import{P as D}from"./plus-B9dTNDWs.js";import{C as v}from"./chevron-right-Dr8cwl4J.js";import{L as P}from"./landmark-BA_0Cnnl.js";import{T as E}from"./trending-up-C66B21n6.js";import{D as Y}from"./dollar-sign-BcfyEtLy.js";import{L as K}from"./layers-Ca3pv70P.js";import{i as V}from"./isPast-ChzaWx0D.js";import{f as z}from"./format-ClYrW1qG.js";import"./AuthenticatedApplication-C2-e6xTS.js";import"./InstitutionRegister-CdUSyHyq.js";import"./alert-kp6gCZ70.js";import"./label-B2onvOiF.js";import"./useMutation-CBAYgnG2.js";import"./input-kx1YXBs7.js";import"./index-C1iJF-SR.js";import"./chevron-up-qSRaMRim.js";import"./check-D8BjNWtW.js";import"./building-2-CMfa6c9V.js";import"./shield-check-ic92rXB7.js";import"./users-DX1W4CCh.js";import"./connectors-BciFpN0c.js";import"./textarea-C9FUOvKW.js";import"./circle-C1ccQMbh.js";import"./user-DCnI1kiW.js";import"./arrow-left-lxn-dpfG.js";import"./triangle-alert-BA2tGhup.js";import"./file-text-76AiIfll.js";import"./AboutPage-CamkJ7cK.js";import"./PrivacyPage-Beavwhs0.js";import"./TermsPage-SeBMfIpe.js";import"./BackingDashboard-CVY4Rsg2.js";import"./shield-Hr0aqzVI.js";import"./LandVerifyPage-NEwI3vUf.js";import"./award-BusU1ju6.js";import"./hash-DyzAXdJv.js";import"./globe-NLl4Wr5a.js";import"./scale-DM0tAT-O.js";import"./calendar-BTBtzozc.js";import"./LandCertificate-Du_3NAH9.js";import"./printer-C2HCk7DD.js";import"./OnchainDocsPage-DDA6342p.js";import"./book-open-DvSukaGG.js";import"./code-CMLileHq.js";import"./sprout-z_rucUaP.js";import"./TransparencyPage-Ylxz21fu.js";import"./ProtocolPage-UaH8jgc9.js";import"./LandProtocolDevRef-_yp8P5Ot.js";import"./InstitutionInvitePage-CIc8kA4i.js";import"./FlowOfFundsPage-BjbpHgzo.js";import"./CapitalProviderChoice-C78InrEx.js";import"./IndividualProviderRegister-DyWPKEYx.js";/** 2 * @license lucide-react v0.469.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const H=q("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]),N=[{status:"draft",shortDesc:"Application saved as draft"},{status:"submitted",shortDesc:"Credit team reviews request"},{status:"pre_approved",shortDesc:"Upload full financial package"},{status:"under_review",shortDesc:"Credit team evaluates package"},{status:"published",shortDesc:"Capital partners reviewing deal"},{status:"terms_sent",shortDesc:"Offer ready for acceptance"},{status:"accepted",shortDesc:"Signing documents and closing"}].map(t=>{var r;return{label:((r=k[t.status])==null?void 0:r.uiLabel)??t.status.replace(/_/g," "),shortDesc:t.shortDesc}});function J(t){return t==="closing_complete"?8:t==="accepted"?7:t==="terms_sent"?6:t==="published"||t==="offer_assembly"?5:t==="under_review"?4:t==="pre_approved"?3:t==="submitted"||t==="needs_info"||t==="waitlisted"?2:1}const G={draft:{icon:e.jsx(H,{className:"h-3.5 w-3.5"}),text:"Draft saved. Complete and submit when ready.",color:"text-gray-600 bg-gray-50 border-gray-200"},submitted:{icon:e.jsx(p,{className:"h-3.5 w-3.5"}),text:"Application received. Our credit team will reach out within 2 business days.",color:"text-blue-700 bg-blue-50 border-blue-200"},under_review:{icon:e.jsx(p,{className:"h-3.5 w-3.5"}),text:"In underwriting. Our credit team is evaluating your full package.",color:"text-blue-700 bg-blue-50 border-blue-200"},waitlisted:{icon:e.jsx(p,{className:"h-3.5 w-3.5"}),text:"You are on the waitlist. We will notify you when a spot opens.",color:"text-gray-600 bg-gray-50 border-gray-200"},needs_info:{icon:e.jsx(B,{className:"h-3.5 w-3.5"}),text:"Action required: the credit team needs more information.",color:"text-amber-700 bg-amber-50 border-amber-200"},pre_approved:{icon:e.jsx(C,{className:"h-3.5 w-3.5"}),text:k.pre_approved.uiDescription,color:"text-[#009955] bg-[#009955]/5 border-[#009955]/25"},offer_assembly:{icon:e.jsx(p,{className:"h-3.5 w-3.5"}),text:"Bids received. Our credit team is assembling your final offer.",color:"text-blue-700 bg-blue-50 border-blue-200"},terms_sent:{icon:e.jsx(C,{className:"h-3.5 w-3.5"}),text:"Your loan offer is ready. Review the terms and accept to move to closing.",color:"text-[#009955] bg-[#009955]/5 border-[#009955]/25"},accepted:{icon:e.jsx(p,{className:"h-3.5 w-3.5"}),text:"Closing in progress. Our team will be in touch with next steps.",color:"text-blue-700 bg-blue-50 border-blue-200"},closing_complete:{icon:e.jsx(L,{className:"h-3.5 w-3.5"}
6),text:"Closing is complete. Your loan is being processed for disbursement.",color:"text-[#009955] bg-[#009955]/5 border-[#009955]/25"}};function g(t){const r=typeof t=="string"?parseFloat(t):t;return isNaN(r)?"$0":r>=1e6?"$"+(r/1e6).toFixed(1)+"M":r>=1e3?"$"+(r/1e3).toFixed(0)+"K":"$"+r.toLocaleString("en-US",{maximumFractionDigits:0})}function U(t){return t.landName||t.propertyAddress||"Untitled Property"}function Q(t){var i,o;const r=(i=t.propertyCounty)!=null&&i.length?t.propertyCounty:t.landCounty?[t.landCounty]:[],a=(o=t.propertyState)!=null&&o.length?t.propertyState:t.landState?[t.landState]:[];return M(r,a)}function W({status:t}){const r=J(t),a=r>N.length;return e.jsx("div",{className:"mt-4 pb-6 sm:pb-7",children:e.jsx("div",{className:"flex items-center",children:N.map((i,o)=>{const l=o+1,c=a||r>l,h=!a&&r===l;return e.jsxs("div",{className:"flex items-center flex-1 min-w-0",children:[e.jsxs("div",{className:"relative flex-shrink-0",children:[e.jsx("div",{className:n("flex h-6 w-6 items-center justify-center rounded-full border-2 text-xs font-semibold transition-colors",c?"border-[#009955] bg-[#009955] text-white":h?"border-[#009955] bg-white text-[#009955]":"border-gray-200 bg-white text-gray-400"),children:c?e.jsx(L,{className:"h-3.5 w-3.5"}):e.jsx("span",{children:l})}),e.jsx("span",{className:n("absolute top-7 left-1/2 -translate-x-1/2 text-[10px] leading-tight text-center whitespace-nowrap hidden sm:block",c?"text-[#009955] font-medium":h?"text-gray-900 font-semibold":"text-gray-400"),children:i.label})]}),o<N.length-1&&e.jsx("div",{className:n("h-0.5 flex-1 mx-1 transition-colors",c?"bg-[#009955]":"bg-gray-200")})]},l)})})})}function X({app:t}){const r=G[t.status],a=Q(t);return e.jsx(d,{href:t.status==="pre_approved"?`/loans/applications/${t.id}/full`:`/loans/applications/${t.id}`,children:e.jsx(m,{className:"hover:shadow-md transition-shadow cursor-pointer border border-gray-200 group",children:e.jsxs(x,{className:"p-5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:e.jsx("h3",{className:"font-semibold text-gray-900 text-base leading-tight truncate",children:U(t)})}),a&&e.jsxs("div",{className:"flex items-center gap-1 mt-0.5 text-sm text-muted-foreground",children:[e.jsx(A,{className:"h-3 w-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:a})]})]}),e.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[e.jsx("span",{className:"text-base font-bold text-gray-900",children:g(t.requestedAmountUsd)}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"requested"})]})]}),e.jsx(W,{status:t.status}),r&&e.jsxs("div",{className:n("mt-3 flex items-center gap-2 text-xs rounded-md border px-3 py-2",r.color),children:[r.icon,e.jsx("span",{children:r.text}),e.jsx(v,{className:"h-3.5 w-3.5 ml-auto flex-shrink-0 opacity-60 group-hover:opacity-100 transition-opacity"})]})]})})})}const Z={active:{label:"Active",badgeClass:"border-[#009955]/30 text-[#009955] bg-[#009955]/5"},pending_disbursement:{label:"Pending Disbursement",badgeClass:"border-blue-300 text-blue-700 bg-blue-50"}};function ee({loan:t}){const r=t.nextPayment,a=r?V(new Date(r.dueDate)):!1,i=Z[t.status]??{label:t.status,badgeClass:"border-gray-200 text-gray-600 bg-gray-50"};return e.jsx(d,{href:`/loans/applications/${t.applicationId}`,children:e.jsx(m,{className:"hover:shadow-md transition-shadow cursor-pointer border border-[#009955]/20 bg-[#009955]/[0.02] group",children:e.jsxs(x,{className:"p-5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-[#009955]/10 flex-shrink-0",children:e.jsx(P,{className:"h-3.5 w-3.5 text-[#009955]"})}),e.jsx("h3",{className:"font-semibold text-gray-900 text-base leading-tight truncate",children:t.landName||"Property Loan"})]}),e.jsx("div",{className:"mt-1 ml-9",children:e.jsx(_,{variant:"outline",className:n("text-[10px] h-4",i.badgeClass),children:i.label})})]}),e.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[e.jsx("span",{className:"text-base font-bold text-gray-900",children:g(t.principalUsd)}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"principal"})]})]}),e.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"rounded-lg bg-white border border-gray-100 p-3",children:[e.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1 mb-1",children:[e.jsx(E,{className:"h-3 w-3"}),"Rate"]}),e.jsxs("div",{className:"text-sm font-semibold text-gray-900",children:[(t.blendedRateBps/100).toFixed(2),"%"]})]}
6),e.jsxs("div",{className:n("rounded-lg border p-3",r&&a?"bg-red-50 border-red-200":"bg-white border-gray-100"),children:[e.jsxs("div",{className:n("text-xs flex items-center gap-1 mb-1",a?"text-red-600":"text-muted-foreground"),children:[e.jsx(Y,{className:"h-3 w-3"}),a?"Overdue":"Next payment"]}),r?e.jsxs("div",{className:n("text-sm font-semibold",a?"text-red-700":"text-gray-900"),children:[g(r.amountUsd),e.jsx("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:z(new Date(r.dueDate),"MMM d")})]}):e.jsx("div",{className:"text-sm text-muted-foreground",children:"None due"})]})]}),e.jsx("div",{className:"mt-3 flex items-center justify-end",children:e.jsxs("span",{className:"text-xs text-muted-foreground group-hover:text-primary transition-colors flex items-center gap-1",children:["View details ",e.jsx(v,{className:"h-3 w-3"})]})})]})})})}const te={pending_submission:{label:"In review",color:"text-amber-700 bg-amber-50 border-amber-200"},under_review:{label:"In review",color:"text-amber-700 bg-amber-50 border-amber-200"},documents_pending:{label:"Needs your action",color:"text-amber-700 bg-amber-50 border-amber-200"},approved:{label:"Active",color:"text-[#009955] bg-[#009955]/5 border-[#009955]/20"},rejected:{label:"Rejected",color:"text-destructive bg-destructive/10 border-destructive/20"}};function se({land:t}){const r=te[t.status]??{label:t.status,color:"text-muted-foreground bg-muted border-border"};return e.jsx(d,{href:`/land/${t.id}`,children:e.jsx(m,{className:"hover:shadow-md transition-shadow cursor-pointer border border-gray-200 group",children:e.jsxs(x,{className:"p-5 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-primary/10 flex-shrink-0",children:e.jsx(K,{className:"h-3.5 w-3.5 text-primary"})}),e.jsx("h3",{className:"font-semibold text-gray-900 text-base leading-tight truncate",children:t.name})]}),(t.county||t.state)&&e.jsxs("div",{className:"flex items-center gap-1 mt-1 ml-9 text-sm text-muted-foreground",children:[e.jsx(A,{className:"h-3 w-3 flex-shrink-0"}),e.jsxs("span",{className:"truncate",children:[[t.county,t.state].filter(Boolean).join(", "),t.acreage&&` · ${parseFloat(t.acreage).toLocaleString()} ac`]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[e.jsx("span",{className:n("text-xs font-medium border rounded-full px-2.5 py-0.5",r.color),children:r.label}),e.jsx(v,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]})]})})})}function re(){return e.jsx("div",{className:"space-y-4",children:[1,2].map(t=>e.jsx(m,{className:"border border-gray-200",children:e.jsxs(x,{className:"p-5 space-y-3",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx(f,{className:"h-5 w-48"}),e.jsx(f,{className:"h-5 w-20"})]}),e.jsx(f,{className:"h-4 w-32"}),e.jsx(f,{className:"h-8 w-full mt-2"})]})},t))})}function ae(){return e.jsx(m,{className:"border-2 border-dashed border-gray-200 bg-gray-50/50",children:e.jsxs(x,{className:"flex flex-col items-center justify-center py-16 px-8 text-center",children:[e.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-primary/10 mb-4",children:e.jsx(P,{className:"h-7 w-7 text-primary"})}),e.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Apply for a land-backed loan"}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-sm mb-6",children:"Use the equity in your land as collateral. Apply in minutes and track your progress here."}),e.jsx(S,{asChild:!0,size:"lg",className:"gap-2",children:e.jsxs(d,{href:"/apply",children:[e.jsx(D,{className:"h-4 w-4"}),"Start Application"]})})]})})}function ie(){const{data:t=[],isLoading:r}=y({queryKey:["/api/v2/loan-applications/my"],refetchInterval:3e4}),{data:a=[],isLoading:i}=y({queryKey:["/api/v2/loans/my"],refetchInterval:3e4}),{data:o=[],isLoading:l}=y({queryKey:["/api/lands"]}
6),c=r||i||l,h=new Set(["active","pending_disbursement"]),u=a.filter(s=>h.has(s.status)),I=new Set(u.map(s=>s.applicationId)),b=t.filter(s=>!["declined","cancelled"].includes(s.status)&&!I.has(s.id)),w=t.filter(s=>["declined","cancelled"].includes(s.status)),O=new Set(t.filter(s=>!["declined","cancelled"].includes(s.status)).map(s=>s.landId).filter(s=>s!=null)),j=o.filter(s=>!O.has(s.id)&&s.status!=="rejected"),T=b.length>0||u.length>0||j.length>0;return e.jsx(F,{children:e.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Portfolio"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Your land-backed loan applications and active loans"})]}),e.jsx(S,{asChild:!0,size:"sm",className:"gap-1.5",children:e.jsxs(d,{href:"/apply",children:[e.jsx(D,{className:"h-3.5 w-3.5"}),"New Application"]})})]}),c?e.jsx(re,{}):T?e.jsxs("div",{className:"space-y-8",children:[u.length>0&&e.jsxs("section",{children:[e.jsx("h2",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-3",children:"Active Loans"}),e.jsx("div",{className:"space-y-3",children:u.map(s=>e.jsx(ee,{loan:s},s.id))})]}),b.length>0&&e.jsxs("section",{children:[e.jsx("h2",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-3",children:u.length>0?"Applications in Progress":"Applications"}),e.jsx("div",{className:"space-y-3",children:b.map(s=>e.jsx(X,{app:s},s.id))})]}),j.length>0&&e.jsxs("section",{children:[e.jsx("h2",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-3",children:"Your Land"}),e.jsx("div",{className:"space-y-3",children:j.map(s=>e.jsx(se,{land:s},s.id))})]}),w.length>0&&e.jsxs("section",{children:[e.jsx("h2",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-3",children:"Closed"}),e.jsx("div",{className:"space-y-2",children:w.map(s=>e.jsx(d,{href:`/loans/applications/${s.id}`,children:e.jsx(m,{className:"border border-gray-100 hover:border-gray-200 transition-colors cursor-pointer opacity-70 hover:opacity-100",children:e.jsxs(x,{className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"text-sm font-medium text-gray-600 truncate block",children:U(s)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[g(s.requestedAmountUsd)," requested"]})]}),e.jsx(_,{variant:s.status==="declined"?"destructive":"secondary",className:"text-xs capitalize ml-3 flex-shrink-0",children:s.status})]})})},s.id))})]})]}):e.jsx(ae,{})]})})}function pt(){const{user:t}=R();return(t==null?void 0:t.role)==="capital_provider"?e.jsx($,{to:"/lend"}):e.jsx(ie,{})}export{pt 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.