1import{bm as Ot,u as Bt,r as i,j as e,c1 as Mt,bW as S,bT as U,b_ as I,bS as Lt,c2 as Tt,c3 as Ft,c4 as qt,c5 as Wt,b$ as Vt,c0 as Dt,c6 as zt,c7 as Gt,c8 as _t}from"./index-t4UNL-er.js";import{H as Ht,C as Z,c as ee}from"./card-DbH3HPdJ.js";import{T as Qt,a as Jt,b as te,c as re}from"./tabs-sgZtMKX6.js";import{P as Kt}from"./ProfilePopup-acBF9Pse.js";import{S as Xt,a as Yt,b as Zt,d as er,e as tr}from"./select-CwLWroP5.js";import"./index-BiHj8eX2.js";import"./index-BjqtNt-N.js";import"./Combination-HGhFtX4F.js";import"./briefcase-DoSn8kXa.js";import"./external-link-GaWiUDyf.js";/** 2 * @license lucide-react v0.462.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 rr=Ot("UserRoundPlus",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M22 19h-6",key:"vcuq98"}]]);function se(s){const r={drafted:null,introRequested:null,optInPending:null,optInAccepted:null,optInRejected:null,introSent:null,inConvo:null,closed:null};for(const n of s){const l=String(n.name).toLowerCase().trim();l==="drafted"?r.drafted=n:l==="intro requested"?r.introRequested=n:l.startsWith("investor opt in")&&l.includes("pending")?r.optInPending=n:l.startsWith("investor opt in")&&l.includes("accepted")||l==="accepted"?r.optInAccepted=n:l.startsWith("investor opt in")&&l.includes("rejected")||l==="rejected"?r.optInRejected=n:l==="intro sent"?r.introSent=n:l==="in convo"||l==="in conversation"?r.inConvo=n:l==="closed"&&(r.closed=n)}return r}function ne(s,r){var n,l,c;return s&&((n=r.optInAccepted)==null?void 0:n.id)===s?"accepted":s&&((l=r.optInRejected)==null?void 0:l.id)===s?"rejected":(s&&((c=r.optInPending)==null?void 0:c.id)===s,"pending")}function bt(s,r){var n,l,c;return s?s===((n=r.optInPending)==null?void 0:n.id)||s===((l=r.optInAccepted)==null?void 0:l.id)||s===((c=r.optInRejected)==null?void 0:c.id):!1}const sr=["Drafted","Intro Requested","Investor Opt In","Intro Sent","In Convo"];function ae(s,r){var n,l,c,f,h;return s?((n=r.drafted)==null?void 0:n.id)===s?"Drafted":((l=r.introRequested)==null?void 0:l.id)===s?"Intro Requested":bt(s,r)?"Investor Opt In":((c=r.introSent)==null?void 0:c.id)===s?"Intro Sent":((f=r.inConvo)==null?void 0:f.id)===s?"In Convo":((h=r.closed)==null?void 0:h.id)===s?"Closed":"":""}function D(s,r,n){return s==="Drafted"?r?"bg-slate-500/15 border-slate-500/40 text-slate-700 dark:text-slate-300":"border-border text-muted-foreground hover:bg-accent/40":s==="Intro Requested"?r?"bg-sky-500/15 border-sky-500/40 text-sky-700 dark:text-sky-300":"border-border text-muted-foreground hover:bg-accent/40":s==="Investor Opt In"?r?n==="accepted"?"bg-emerald-500/15 border-emerald-500/40 text-emerald-700 dark:text-emerald-400":n==="rejected"?"bg-red-500/15 border-red-500/40 text-red-700 dark:text-red-400":"bg-amber-500/15 border-amber-500/40 text-amber-700 dark:text-amber-400":"border-border text-muted-foreground":s==="Intro Sent"?r?"bg-indigo-500/15 border-indigo-500/40 text-indigo-700 dark:text-indigo-300":"border-border text-muted-foreground hover:bg-accent/40":s==="In Convo"?r?"bg-violet-500/15 border-violet-500/40 text-violet-700 dark:text-violet-300":"border-border text-muted-foreground hover:bg-accent/40":"border-border text-muted-foreground"}function le(s){return s==="accepted"?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-400":s==="rejected"?"bg-red-500/15 text-red-700 dark:text-red-400":"bg-amber-500/15 text-amber-700 dark:text-amber-400"}function nr(s){return s==="accepted"?"bg-emerald-500":s==="rejected"?"bg-red-500":"bg-amber-500"}function ar(s,r){const n=se(r),l=r.find(f=>f.name===s);if(!l){const f=se([{id:0,name:s}]),h=ae(0,f);if(h==="Investor Opt In"){const O=s.toLowerCase().includes("accepted")?"accepted":s.toLowerCase().includes("rejected")?"rejected":"pending";return{label:`Investor Opt In (${O.charAt(0).toUpperCase()+O.slice(1)})`,cls:le(O)}}if(h)return{label:h,cls:D(h,!0).replace(/border-\S+/g,"")}}const c=ae(l==null?void 0:l.id,n);if(c==="Investor Opt In"){const f=ne(l==null?void 0:l.id,n);return{label:`Investor Opt In (${f.charAt(0).toUpperCase()+f.slice(1)})`,cls:le(f)}}return c?{label:c,cls:D(c,!0).replace(/border-\S+/g,"")}:{label:s,cls:"bg-muted text-muted-foreground"}}function V(s){const r=(s.fullname??"").trim(),n=(s.email??"").trim();return r&&n?`${r} ⢠${n}`:r||n||`User ${s.id}`}function vt(s){const r=s.replace(/\s+/g," ").trim().split(" ").filter(
6Boolean);return r.length>=2?(r[0][0]+r[r.length-1][0]).toUpperCase():s.slice(0,2).toUpperCase()||"?"}function E({u:s,onAvatarClick:r}){const n=(s.fullname??"").trim()||`User ${s.id}`,l=s.profilePhoto??null;return s.isCrmContact?e.jsx("span",{className:"inline-flex max-w-full items-center rounded-full bg-sky-500/15 text-sky-700 dark:text-sky-300 text-[11px] px-2 py-0.5",children:e.jsx("span",{className:"truncate",children:n})}):e.jsxs("span",{className:"inline-flex items-center gap-1.5 min-w-0",children:[e.jsx("button",{type:"button",onClick:c=>{c.stopPropagation(),s.id>0&&r&&r(s.id,n,l)},className:"shrink-0 w-6 h-6 rounded-full overflow-hidden bg-muted flex items-center justify-center ring-1 ring-border/60 hover:ring-primary/60 hover:scale-110 transition-all cursor-pointer",title:`View ${n}'s profile`,children:l&&String(l).trim()?e.jsx("img",{src:String(l).trim(),alt:"",className:"w-full h-full object-cover",onError:c=>{c.target.style.display="none"}}):e.jsx("span",{className:"text-[9px] font-semibold text-muted-foreground",children:vt(n)})}),e.jsx("span",{className:"truncate",children:n})]})}function hr(){var Oe,Be,Me,Le,Te,Fe,qe,We,Ve,De,ze,Ge,_e,He,Qe,Je,Ke,Xe,Ye,Ze,et,tt,rt,st,nt,at,lt,it,ot,dt,ct,mt,ut,xt;const{user:s}=Bt(),r=(s==null?void 0:s.accessToken)??"",[n,l]=i.useState("access"),[c,f]=i.useState(""),[h,O]=i.useState(!1),[z,jt]=i.useState([]),[P,yt]=i.useState(null),[G,Nt]=i.useState(!0),[ie,oe]=i.useState(!1),[y,Ct]=i.useState(null),[N,St]=i.useState(null),[de,wt]=i.useState("Warm intro"),[ce,me]=i.useState(!1),[ue,x]=i.useState(null),[xe,b]=i.useState(null),[_,pe]=i.useState(!1),[fe,kt]=i.useState([]),[v,It]=i.useState(null),[o,Pt]=i.useState(null),[At,he]=i.useState(!1),[ge,be]=i.useState(""),[T,ve]=i.useState(""),[B,F]=i.useState(!1),[H,je]=i.useState(""),[C,ye]=i.useState(null),M=(t,a,d)=>{ye({id:t,name:a,photo:d})},[q,Ne]=i.useState(""),[W,Ce]=i.useState(""),[Se,we]=i.useState(""),[ke,Ie]=i.useState(""),[Pe,Ae]=i.useState(""),[Ue,Re]=i.useState(!1),Q=c.trim().length>=2,$e=i.useMemo(()=>!y||!N?"":`${V(y)} â ${V(N)}`,[y,N]);async function Ee(){if(!(!r||!Q)){O(!0),x(null),b(null);try{const[t,a]=await Promise.all([Tt(r,c.trim()),Ft(r,c.trim())]),d=(t.data??[]).map(u=>({id:u.id,fullname:u.fullname??null,email:u.email??null,role:u.role,isCrmContact:!1})),p=(a.data??[]).map(u=>({id:u.id,fullname:u.name??null,email:u.email??null,isCrmContact:!0}));jt([...d,...p])}catch(t){x(t instanceof Error?t.message:"Search failed")}finally{O(!1)}}}async function Ut(){if(!(!r||!P)){oe(!0),x(null),b(null);try{await qt(r,P.id,G),b(`CRM access ${G?"enabled":"disabled"} for ${V(P)}`)}catch(t){x(t instanceof Error?t.message:"Failed to update access")}finally{oe(!1)}}}async function Rt(){var t,a;if(!(!r||!y||!N)){me(!0),x(null),b(null);try{const d=await Wt(r,y.id,N.id,de.trim()||"Warm intro"),p=((t=d==null?void 0:d.data)==null?void 0:t.id)??((a=d==null?void 0:d.data)==null?void 0:a.ID);b(`Intro created${p?` (#${p})`:""}: ${$e}`)}catch(d){x(d instanceof Error?d.message:"Failed to create intro")}finally{me(!1)}}}async function J(){if(r){pe(!0),x(null);try{const t=await Vt(r);kt(t.data??[])}catch(t){x(t instanceof Error?t.message:"Failed to load overview")}finally{pe(!1)}}}async function K(t){if(r){he(!0);try{const a=await Dt(r,t);Pt(a)}catch(a){x(a instanceof Error?a.message:"Failed to load intro")}finally{he(!1)}}}i.useEffect(()=>{n==="overview"&&J()},[n]),i.useEffect(()=>{n==="overview"&&v!=null&&K(v)},[v]);async function X(t){if(!(!r||v==null)){F(!0),x(null),b(null);try{await zt(r,v,t,ge.trim()||void 0),be(""),await K(v),await J(),b("Stage updated.")}catch(a){x(a instanceof Error?a.message:"Failed to move stage")}finally{F(!1)}}}async function $t(){if(!(!r||v==null||!T.trim())){F(!0),x(null),b(null);try{await Gt(r,v,T.trim()),ve(""),await K(v),b("Note added.")}catch(t){x(t instanceof Error?t.message:"Failed to add note")}finally{F(!1)}}}async function Et(){if(!(!r||!q.trim()||!W.trim())){Re(!0),x(null),b(null);try{const t=await _t(r,{name:q.trim(),email:W.trim(),company:Se.trim()||void 0,position:ke.trim()||void 0,linkedinProfile:Pe.trim()||void 0}),a=t==null?void 0:t.data;b(`New CRM contact created${a!=null&&a.id?` (#${a.id})`:""}. This contact lives only in CRM tables.`),Ne(""),Ce(""),we(""),Ie(""),Ae("")}
6catch(t){x(t instanceof Error?t.message:"Failed to create CRM contact")}finally{Re(!1)}}}return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(Ht,{}),e.jsxs("main",{className:"pt-24 pb-12 px-4 sm:px-6 max-w-5xl mx-auto",children:[e.jsx("div",{className:"flex items-start sm:items-center justify-between gap-4 mb-6",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold tracking-tight flex items-center gap-2",children:[e.jsx(Mt,{className:"w-5 h-5 text-muted-foreground"}),"Admin CRM"]}),e.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mt-1",children:"Enable CRM access for users and manually create intros."})]})}),ue&&e.jsx("div",{className:"mb-4 rounded-lg border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:ue}),xe&&e.jsx("div",{className:"mb-4 rounded-lg border border-emerald-500/40 bg-emerald-500/10 px-4 py-3 text-sm text-emerald-700 dark:text-emerald-400",children:xe}),e.jsxs(Qt,{value:n,onValueChange:t=>l(t),children:[e.jsxs(Jt,{className:"bg-muted/60",children:[e.jsx(te,{value:"access",children:"Access"}),e.jsx(te,{value:"create",children:"Create intro"}),e.jsx(te,{value:"overview",children:"Overview"})]}),e.jsx(re,{value:"access",className:"mt-4",children:e.jsx(Z,{className:"border-border/60 bg-card/80",children:e.jsxs(ee,{className:"p-5 space-y-4",children:[e.jsx("div",{className:"font-semibold",children:"Enable CRM for a user"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(S,{value:c,onChange:t=>f(t.target.value),placeholder:"Search name or emailâ¦"}),e.jsx(U,{onClick:Ee,disabled:!Q||h,variant:"outline",children:h?e.jsx(I,{className:"w-4 h-4 animate-spin"}):"Search"})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:z.map(t=>e.jsxs("button",{type:"button",onClick:()=>yt(t),className:`rounded-xl border px-3 py-3 text-left transition-colors ${(P==null?void 0:P.id)===t.id?"border-primary bg-primary/5":"border-border hover:bg-accent/30"}`,children:[e.jsx("div",{className:"font-medium truncate",children:e.jsx(E,{u:t})}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:(t.email??"").trim()||"â"})]},t.id))}),P&&e.jsxs("div",{className:"rounded-xl border border-border p-4 bg-background/40 space-y-3",children:[e.jsx("div",{className:"text-sm font-medium",children:"Selected"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:V(P)}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("label",{className:"text-sm font-medium",children:"Enable CRM"}),e.jsx("input",{type:"checkbox",checked:G,onChange:t=>Nt(t.target.checked),className:"h-4 w-4"}),e.jsx(U,{onClick:Ut,disabled:ie,className:"ml-auto",children:ie?e.jsx(I,{className:"w-4 h-4 animate-spin"}):"Save"})]})]})]})})}),e.jsx(re,{value:"create",className:"mt-4",children:e.jsx(Z,{className:"border-border/60 bg-card/80",children:e.jsxs(ee,{className:"p-5 space-y-4",children:[e.jsxs("div",{className:"font-semibold flex items-center gap-2",children:[e.jsx(rr,{className:"w-4 h-4 text-muted-foreground"}),"Create a CRM intro (between 2 users)"]}),e.jsxs("div",{className:"rounded-xl border border-border bg-background/40 p-4 space-y-3",children:[e.jsx("div",{className:"text-sm font-medium",children:"Create new Gemphere user (for CRM)"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-xs font-medium text-muted-foreground",children:"Full name *"}),e.jsx(S,{value:q,onChange:t=>Ne(t.target.value),placeholder:"e.g. Alex Christian"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-xs font-medium text-muted-foreground",children:"Email *"}),e.jsx(S,{value:W,onChange:t=>Ce(t.target.value),placeholder:"[email protected]"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-xs font-medium text-muted-foreground",children:"Company / Fund (optional)"}),e.jsx(S,{value:Se,onChange:t=>we(t.target.value),placeholder:"Company or fund"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-xs font-medium text-muted-foreground",children:"Position (optional)"}),e.jsx(S,{value:ke,onChange:t=>Ie(t.target.value),placeholder:"e.g. Partner, Founder"})]}),e.jsxs("div",{className:"space-y-2 md:col-span-2",children:[e.jsx("label",{className:"block text-xs font-medium text-muted-foreground",children:"LinkedIn profile (optional)"}),e.jsx(S,{value:Pe,onChange:t=>Ae(t.target.value),placeholder:"https://www.linkedin.com/in/username"})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(U,{type:"button",size:"sm",onClick:Et,disabled:Ue||!q.trim()||!W.trim(),children:[Ue?e.jsx(I,{className:"w-4 h-4 animate-spin mr-2"}):null,"Save user"]})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-medium",children:"Party A (Gemphere users only)"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(S,{value:c,onChange:t=>f(t.target.value),placeholder:"Searchâ¦"}),e.jsx(U,{onClick:Ee,disabled:!Q||h,variant:"outline",children:h?e.jsx(I,{className:"w-4 h-4 animate-spin"}):"Search"})]}),e.jsx("div",{className:"max-h-56 overflow-auto space-y-2 pr-1",children:z.map(t=>e.jsxs("button",{type:"button",onClick:()=>Ct(t),className:`w-full rounded-xl border px-3 py-3 text-left transition-colors ${(y==null?void 0:y.id)===t.id?"border-primary bg-primary/5":"border-border hover:bg-accent/30"}`,children:[e.jsx("div",{className:"font-medium truncate",children:e.jsx(E,{u:t})}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:(t.email??"").trim()||"â"})]},`a-${t.id}`))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-medium",children:"Party B (Gemphere users only)"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Pick from the same search results list."}),e.jsx("div",{className:"max-h-64 overflow-auto space-y-2 pr-1",children:z.map(t=>e.jsxs("button",{type:"button",onClick:()=>St(t),className:`w-full rounded-xl border px-3 py-3 text-left transition-colors ${(N==null?void 0:N.id)===t.id?"border-primary bg-primary/5":"border-border hover:bg-accent/30"}`,children:[e.jsx("div",{className:"font-medium truncate",children:e.jsx(E,{u:t})}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:(t.email??"").trim()||"â"})]},`b-${t.id}`))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-medium",children:"Title"}),e.jsx(S,{value:de,onChange:t=>wt(t.target.value),placeholder:"e.g. Intro: Alice â Bob"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:$e||"Select both parties."}),e.jsx(U,{onClick:Rt,disabled:!y||!N||y.id===N.id||ce,children:ce?e.jsx(I,{className:"w-4 h-4 animate-spin"}):"Create intro"})]})]})})}),e.jsx(re,{value:"overview",className:"mt-4",children:e.jsx(Z,{className:"border-border/60 bg-card/80",children:e.jsxs(ee,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4",children:[e.jsx("div",{className:"font-semibold",children:"Manage CRM intros"}),e.jsxs(U,{variant:"outline",size:"sm",onClick:J,disabled:_,children:[e.jsx(I,{className:`w-4 h-4 mr-2 ${_?"animate-spin":""}`}),"Refresh"]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[320px_1fr] gap-4",children:[e.jsx("div",{className:"space-y-2",children:_?e.jsx("div",{className:"py-10 flex items-center justify-center",children:e.jsx(I,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):fe.length===0?e.jsx("div",{className:"py-8 text-sm text-muted-foreground",children:"No intros yet."}):fe.map(t=>{var a,d,p,u,g,w,R,j,$,L,m,k,A,pt,ft,ht,gt;return e.jsxs("button",{type:"button",onClick:()=>It(t.id),className:`w-full rounded-xl border px-3 py-3 text-left transition-colors ${v===t.id?"border-primary bg-primary/5":"border-border hover:bg-accent/30"}`,children:[e.jsx("div",{className:"font-medium truncate",children:t.title||"Warm intro"}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-0.5 flex flex-wrap items-center gap-1",children:[e.jsx(E,{u:{id:((d=(a=t.partyAUser)==null?void 0:a.user)==null?void 0:d.id)??0,fullname:((u=(p=t.partyAUser)==null?void 0:p.user)==null?void 0:u.fullname)??null,email:void 0,profilePhoto:((w=(g=t.partyAUser)==null?void 0:g.user)==null?void 0:w.profilePhoto)??null,isCrmContact:((j=(R=t.partyAUser)==null?void 0:R.user)==null?void 0:j.id)===0},onAvatarClick:M}),e.jsx("span",{className:"mx-1",children:"â"}),e.jsx(E,{u:{id:((L=($=t.partyBUser)==null?void 0:$.user)==null?void 0:L.id)??0,fullname:((k=(m=t.partyBUser)==null?void 0:m.user)==null?void 0:k.fullname)??null,email:void 0,profilePhoto:((pt=(A=t.partyBUser)==null?void 0:A.user)==null?void 0:pt.profilePhoto)??null,isCrmContact:((ht=(ft=t.partyBUser)==null?void 0:ft.user)==null?void 0:ht.id)===0},onAvatarClick:M})]}),(gt=t.currentStage)!=null&>.name?(()=>{const Y=ar(t.currentStage.name,[{id:t.currentStage.id,name:t.currentStage.name}]);return e.jsx("div",{className:`mt-2 text-[11px] inline-flex px-2 py-0.5 rounded-full ${Y.cls}`,title:Y.label,children:Y.label})})():null]},t.id)})}),e.jsx("div",{className:"rounded-xl border border-border bg-background/40 p-4 space-y-4 min-h-[260px]",children:!v||!o?e.jsx("div",{className:"text-sm text-muted-foreground",children:"Select an intro on the left to manage stages and notes."}):At?e.jsx("div",{className:"py-10 flex items-center justify-center",children:e.jsx(I,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("div",{className:"text-base font-semibold",children:[((Oe=o.intro)==null?void 0:Oe.title)||"Warm intro"," ",(Be=o.intro)!=null&&Be.isClosed?e.jsx("span",{className:"ml-2 text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground",children:"Closed"}):null]}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-0.5 flex flex-wrap items-center gap-2",children:[e.jsx(E,{u:{id:((Le=(Me=o.partyA)==null?void 0:Me.User)==null?void 0:Le.Id)??((Fe=(Te=o.partyA)==null?void 0:Te.user)==null?void 0:Fe.id)??0,fullname:((We=(qe=o.partyA)==null?void 0:qe.User)==null?void 0:We.Fullname)??((De=(Ve=o.partyA)==null?void 0:Ve.user)==null?void 0:De.fullname)??"â",email:void 0,profilePhoto:((Ge=(ze=o.partyA)==null?void 0:ze.User)==null?void 0:Ge.ProfilePhoto)??((He=(_e=o.partyA)==null?void 0:_e.user)==null?void 0:He.profilePhoto)??null,isCrmContact:(((Je=(Qe=o.partyA)==null?void 0:Qe.
6User)==null?void 0:Je.Id)??((Xe=(Ke=o.partyA)==null?void 0:Ke.user)==null?void 0:Xe.id))===0},onAvatarClick:M}),e.jsx("span",{children:"â"}),e.jsx(E,{u:{id:((Ze=(Ye=o.partyB)==null?void 0:Ye.User)==null?void 0:Ze.Id)??((tt=(et=o.partyB)==null?void 0:et.user)==null?void 0:tt.id)??0,fullname:((st=(rt=o.partyB)==null?void 0:rt.User)==null?void 0:st.Fullname)??((at=(nt=o.partyB)==null?void 0:nt.user)==null?void 0:at.fullname)??"â",email:void 0,profilePhoto:((it=(lt=o.partyB)==null?void 0:lt.User)==null?void 0:it.ProfilePhoto)??((dt=(ot=o.partyB)==null?void 0:ot.user)==null?void 0:dt.profilePhoto)??null,isCrmContact:(((mt=(ct=o.partyB)==null?void 0:ct.User)==null?void 0:mt.Id)??((xt=(ut=o.partyB)==null?void 0:ut.user)==null?void 0:xt.id))===0},onAvatarClick:M})]}),(()=>{var u,g,w,R,j,$;const t=o.createdByUser,a=(((u=t==null?void 0:t.User)==null?void 0:u.Fullname)??((g=t==null?void 0:t.user)==null?void 0:g.fullname)??"").trim();if(!a)return null;const d=((w=t==null?void 0:t.User)==null?void 0:w.Id)??((R=t==null?void 0:t.user)==null?void 0:R.id)??0,p=((j=t==null?void 0:t.User)==null?void 0:j.ProfilePhoto)??(($=t==null?void 0:t.user)==null?void 0:$.profilePhoto)??null;return e.jsxs("div",{className:"text-[11px] text-muted-foreground mt-1.5 flex items-center gap-1.5",children:[e.jsx(Lt,{className:"w-3 h-3 shrink-0 text-primary/60"}),e.jsx("span",{children:"Introduced by"}),d>0?e.jsxs("button",{type:"button",onClick:()=>M(d,a,p),className:"inline-flex items-center gap-1 font-medium text-primary hover:underline",children:[e.jsx("span",{className:"w-4 h-4 rounded-full overflow-hidden bg-muted flex items-center justify-center ring-1 ring-border/60 shrink-0",children:p&&String(p).trim()?e.jsx("img",{src:String(p).trim(),alt:"",className:"w-full h-full object-cover"}):e.jsx("span",{className:"text-[7px] font-semibold text-muted-foreground",children:vt(a)})}),a]}):e.jsx("span",{className:"font-medium",children:a})]})})()]}),(()=>{var L;const t=(o==null?void 0:o.stages)??[],a=se(t),d=(L=o.intro)==null?void 0:L.currentStageId,p=ae(d,a),u=bt(d,a),g=ne(d,a),w=[a.optInPending,a.optInAccepted,a.optInRejected].filter(Boolean),R=w.length>0,j=a.optInPending??w[0],$={Drafted:a.drafted,"Intro Requested":a.introRequested,"Intro Sent":a.introSent,"In Convo":a.inConvo};return e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Pipeline"}),e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:sr.map(m=>{const k=m===p;if(m==="Investor Opt In")return e.jsxs("button",{type:"button",disabled:B||!j,onClick:()=>
6{!u&&j&&X(j.id)},title:`Investor Opt In: ${u?g.charAt(0).toUpperCase()+g.slice(1):"Pending"}`,className:`px-3 py-1.5 rounded-full text-xs border ${D(m,k,u?g:"pending")}`,children:["Investor Opt In",e.jsx("span",{className:`ml-1.5 text-[10px] px-1.5 py-0.5 rounded-full ${le(u?g:"pending")}`,children:u?g.charAt(0).toUpperCase()+g.slice(1):"Pending"})]},m);const A=$[m];return e.jsx("button",{type:"button",onClick:()=>A&&X(A.id),disabled:B||!A,title:m,className:`px-3 py-1.5 rounded-full text-xs border ${D(m,k)}`,children:m},m)})}),R&&e.jsxs("div",{className:"rounded-lg border border-border bg-background/40 p-3 space-y-2",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground block",children:"Investor Opt In Status"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Xt,{value:H||(u?String(d):j?String(j.id):""),onValueChange:m=>je(m),disabled:B,children:[e.jsx(Yt,{className:"w-48 h-9 text-xs",title:"Select investor opt-in status",children:e.jsx(Zt,{placeholder:"Pending"})}),e.jsx(er,{children:w.map(m=>{const k=ne(m.id,a),A=k.charAt(0).toUpperCase()+k.slice(1);return e.jsx(tr,{value:String(m.id),children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${nr(k)}`}),A]})},m.id)})})]}),e.jsx(U,{type:"button",size:"sm",disabled:B||!H,onClick:()=>{const m=Number(H);m>0&&(X(m),je(""))},children:B?e.jsx(I,{className:"w-3.5 h-3.5 animate-spin"}):"Update"})]}),!u&&e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Currently Pending. Use the dropdown to change status."})]}),e.jsx(S,{value:ge,onChange:m=>be(m.target.value),placeholder:"Optional note for this stage moveâ¦",className:"text-xs"})]})})(),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Add note"}),e.jsx(S,{value:T,onChange:t=>ve(t.target.value),placeholder:"Write a note about this introâ¦"}),e.jsx(U,{type:"button",size:"sm",onClick:$t,disabled:B||!T.trim(),className:"mt-1",children:"Save note"})]})]})})]})]})})})]}),e.jsx(Kt,{open:!!C,onOpenChange:t=>{t||ye(null)},userId:(C==null?void 0:C.id)??0,accessToken:r,initialName:C==null?void 0:C.name,initialPhoto:C==null?void 0:C.photo})]})]})}export{hr 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.