PageSourceSearch

https://www.gemphere.com/assets/MyNetwork-CCiuMloP.js

js gemphere.com collected 2026-10-02 01:30:05 UTC 114,203 bytes, 9 lines download raw bytes

1import{u as _n,r as i,q as zr,t as Gr,j as t,L as Kr,P as Ie,v as Vt,x as Yr,y as Hr,c as Vr,d as Qr,a as Zr,z as Xr,E as Jr,A as ei,B as ti,C as ni,D as ai,F as si,G as oi,H as ri,J as ii,K as li,N as ci,O as di,Q as mi,R as ui,S as hi,T as pi,U as po,V as fi,W as gi,X as Ln,Y as yi,Z as ki,_ as bi,$ as Ni,a0 as vi,p as xi,a1 as wi,a2 as ji,a3 as fo,a4 as Ii,a5 as Ci,a6 as go,m as Si,a7 as Kt,a8 as yo,a9 as Li,aa as Ei,ab as Ti,ac as Mi,ad as Xt,ae as V,af as En,ag as ko,ah as ze,ai as Yt,aj as Tn,ak as Mn,al as bo,am as Pi,an as Pn,ao as Ai,ap as Ri,aq as Fi,ar as No,as as qo,at as Ui,au as _i,av as Bi,aw as Di,ax as Oi,ay as vo,az as $i,aA as qi,aB as Wi,aC as zi,aD as Gi,aE as Ki,aF as Yi}from"./index-t4UNL-er.js";import{r as Hi,u as Vi,s as Qi}from"./linkedin-csv-upload-flow-D1etFt0g.js";import{d as xo,S as Zi,I as Xi,D as Ji,a as el,b as tl,c as Ge}from"./InviteContactModal-eJvvz2_d.js";import{S as nl,M as al}from"./MuteContactModal-D95J0zhy.js";import{i as sl,A as ol}from"./AddConnectorModal-B1Vne4p5.js";import{I as rl}from"./InviteTeammatesModal-B4Of1wFK.js";import{i as il,k as wo,b as ll,c as cl,a as dl,r as jo,f as ml,d as ul,e as hl}from"./home-checkin-people-BVy6E0N1.js";import{u as pl}from"./use-resolved-title-company-BlONIib3.js";import{C as fl}from"./chevron-right-vNJNS7I3.js";import"./index-BjqtNt-N.js";import"./Combination-HGhFtX4F.js";import"./index-BiHj8eX2.js";function gl(r){const c=new Date(r);if(Number.isNaN(c.getTime()))return r;const d=Date.now()-c.getTime(),p=24*60*60*1e3,y=Math.floor(d/p);return y<=0?"today":y===1?"yesterday":y<7?`${y} days ago`:y<30?`${Math.floor(y/7)} weeks ago`:`${c.getMonth()+1}/${c.getDate()}/${c.getFullYear()}`}function yl({inviteByEmailOpen:r,inviteByEmailValue:c,onInviteByEmailOpen:h,onInviteByEmailChange:d,onInviteByEmailCancel:p,onInviteByEmailSubmit:y,invitedList:b,invitedLoading:v,invitedError:T,onAddConnector:_,onInviteTeammate:z}){const{user:B}=_n(),I=(B==null?void 0:B.accessToken)||"",q=i.useRef(null),E=i.useRef(null),[H,M]=i.useState(!1),[C,G]=i.useState(null),[ce,te]=i.useState([]),[Z,de]=i.useState(!1),[oe,Fe]=i.useState(0),[ne,be]=i.useState(0);i.useEffect(()=>{if(!I)return;let N=!1;return(async()=>{try{const J=await zr(I,{limit:1,offset:0});N||Fe(J.total||J.contacts.length)}catch{}})(),()=>{N=!0}},[I,ne]);const Ce=i.useCallback(()=>{var N;(N=E.current)==null||N.call(E),E.current=null,de(!1),be(J=>J+1)},[]);i.useEffect(()=>()=>{var N;(N=E.current)==null||N.call(E)},[]),i.useEffect(()=>{if(!Z)return;const N=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=N}},[Z]);const S=i.useCallback(async N=>{var J;if(!I){G({kind:"err",text:"Please sign in again to upload."});return}M(!0),G(null),(J=E.current)==null||J.call(E),E.current=null;try{const{csv:ue,parsed:Ne}=await Hi(N);await Vi(I,N.name,ue,oe),te(Ne),de(!0),be(He=>He+1),E.current=Qi(I,Ne,te)}catch(ue){G({kind:"err",text:ue instanceof Error?ue.message:"Upload failed"})}finally{M(!1)}},[I,oe]),me=Z&&typeof document<"u"?Gr.createPortal(t.jsxs("div",{className:"em-conn-flow-portal",role:"dialog","aria-modal":"true",children:[t.jsx("button",{type:"button",className:"em-conn-flow-close",onClick:Ce,"aria-label":"Close",children:"×"}),t.jsx(Kr,{active:Z,token:I,csvContacts:ce,onBack:Ce,onFinish:Ce})]}),document.body):null;return t.jsxs("div",{className:"page-expand-map network-add-people-panel",children:[me,t.jsx("input",{ref:q,type:"file",accept:".csv,text/csv,application/vnd.ms-excel",style:{display:"none"},onChange:N=>{var ue;const J=(ue=N.target.files)==null?void 0:ue[0];J&&S(J),N.target&&(N.target.value="")}}),I?t.jsxs("div",{className:"em-actions",children:[z?t.jsxs("div",{className:"em-action-row",children:[t.jsxs("div",{className:"em-action-copy",children:[t.jsx("div",{className:"em-action-name",children:"Add teammate"}),t.jsx("div",{className:"em-action-desc",children:"A colleague inside your workspace. You each see who the other knows."})]}),t.jsx("button",{type:"button",className:"em-csv-upload-btn",onClick:z,children:"Add teammate"})]}):null,_?t.jsxs("div",{className:"em-action-row",children:[t.jsxs("div",{className:"em-action-copy",children:[t.jsx("div",{className:"em-action-name",children:"Add connector"}),t.jsx("div",{className:"em-action-desc",children:"Someone outside the team who makes intros for you. Their network stays theirs."})]}),t.jsx("button",{type:"button",className:"em-csv-upload-btn",onClick:_,children:"Add connector"})]}):null,t.jsxs("div",{className:"em-action-row",children:[t.jsxs("div",{className:"em-action-copy",children:[t.jsx("div",{className:"em-action-name",children:"Upload CSV"}),t.jsx("div",{className:"em-action-desc",children:"Your LinkedIn connections in bulk — Connections.csv, from Settings → Data privacy."})]}),t.jsx("button",{type:"button",className:"em-csv-upload-btn",disabled:H||!I,onClick:()=>{var N;return(N=q.current)==null?void 0:N.click()},children:H?"Uploading…":"Upload CSV"})]}),r?null:t.jsxs("div",{className:"em-action-row",children:[t.jsxs("div",{className:"em-action-copy",children:[t.jsx("div",{className:"em-action-name",children:"Invite by email"}),t.jsx("div",{className:"em-action-desc",children:"Invite someone to Gem. When they accept, their network joins your paths."})]}),t.jsx("button",{type:"button",className:"em-csv-upload-btn",onClick:h,children:"Invite by email"})]})]}):null,r?t.jsxs("form",{className:"network-invite-email-form",onSubmit:N=>{N.preventDefault(),y()},children:[t.jsx("input",{type:"email",autoFocus:!0,className:"network-invite-email-input",placeholder:"[email protected]",value:c,onChange:N=>d(N.target.value),onKeyDown:N=>
1{N.key==="Escape"&&p()}}),t.jsx("button",{type:"submit",className:"network-side-action network-side-action--primary",disabled:!c.trim(),children:"Preview invite"}),t.jsx("button",{type:"button",className:"network-side-action",onClick:p,children:"Cancel"})]}):null,C&&C.kind==="err"?t.jsx("div",{className:"em-csv-msg err",role:"status",children:C.text}):null,b.length>0||v||T?t.jsxs("div",{className:"em-invited-section",children:[t.jsxs("div",{className:"em-invited-head",children:[t.jsx("div",{className:"em-section-kicker",children:"Outreach"}),t.jsx("div",{className:"em-section-title",children:"Invited"})]}),v?t.jsx(Ie,{variant:"section",message:"Loading invited list…"}):T?t.jsxs("div",{className:"em-empty",children:["Couldn't load invites: ",T]}):t.jsx("div",{className:"network-side-list",children:b.map(N=>t.jsxs("div",{className:"network-side-row",children:[t.jsx("div",{className:"network-side-row-avatar",children:N.email.slice(0,1).toUpperCase()}),t.jsxs("div",{className:"network-side-row-main",children:[t.jsx("div",{className:"network-side-row-name",children:N.email}),N.createdOn?t.jsxs("div",{className:"network-side-row-meta",children:["Invited ",gl(N.createdOn)]}):null]}),N.isSignUp?t.jsx("span",{className:"network-side-status network-side-status--joined",children:"Joined"}):t.jsx("span",{className:"network-side-status",children:"Pending"})]},N.email+(N.createdOn||"")))})]}):null]})}function kl({open:r,contact:c,onClose:h,onSaved:d}){const{user:p}=_n(),y=p==null?void 0:p.accessToken,[b,v]=i.useState(""),[T,_]=i.useState(""),[z,B]=i.useState(""),[I,q]=i.useState(""),[E,H]=i.useState(""),[M,C]=i.useState(""),[G,ce]=i.useState(""),[te,Z]=i.useState(""),[de,oe]=i.useState(!1),[Fe,ne]=i.useState(null);i.useEffect(()=>{!r||!c||(v(Vt(c.fullName||"",c.email)),_((c.email||"").trim()),B((c.phoneNumber||"").trim()),q((c.title||"").trim()),H((c.companyName||"").trim()),C((c.linkedinUrl||"").trim()),ce((c.location||"").trim()),Z((c.companyWebsite||"").trim()),oe(!1),ne(null))},[r,c]);const be=()=>{de||h()},Ce=async()=>{if(!y||!(c!=null&&c.id)){ne("Please sign in again.");return}const S=b.trim();if(!S){ne("Name is required.");return}oe(!0),ne(null);try{const me={fullName:S,email:T.trim()||null,phoneNumber:z.trim()||null,title:I.trim()||null,companyName:E.trim()||null,linkedinUrl:M.trim()||null,location:G.trim()||null,companyWebsite:te.trim()||null},N=await Yr(y,c.id,me);d==null||d({id:c.id,fullName:N.fullName,email:N.email,phoneNumber:N.phoneNumber,title:N.title,companyName:N.companyName,linkedinUrl:N.linkedinUrl,location:N.location,companyWebsite:N.companyWebsite}),h()}catch(me){ne(me instanceof Error?me.message:"Failed to update contact")}finally{oe(!1)}};return!r||!c?null:t.jsx("div",{className:"modal-overlay open",onClick:be,children:t.jsxs("div",{className:"modal",onClick:S=>S.stopPropagation(),style:{maxWidth:480},children:[t.jsxs("div",{className:"modal-head",children:[t.jsxs("div",{children:[t.jsx("div",{className:"mod-title",children:"Edit profile"}),t.jsx("div",{className:"mod-sub",children:"Update this connection's details in your network."})]}),t.jsx("button",{className:"mod-close",onClick:be,disabled:de,children:"×"})]}),t.jsxs("div",{className:"modal-body",children:[t.jsxs("div",{className:"fld-row",children:[t.jsx("label",{className:"fld-lbl",children:"Name"}),t.jsx("input",{className:"fld-input",type:"text",value:b,onChange:S=>v(S.target.value),autoFocus:!0})]}),t.jsxs("div",{className:"fld-row",children:[t.jsx("label",{className:"fld-lbl",children:"Email"}),t.jsx("input",{className:"fld-input",type:"email",value:T,onChange:S=>_(S.target.value),placeholder:"[email protected]"})]}),t.jsxs("div",{className:"fld-row",children:[t.jsx("label",{className:"fld-lbl",children:"Phone"}),t.jsx("input",{className:"fld-input",type:"tel",value:z,onChange:S=>B(S.target.value)})]}),t.jsxs("div",{className:"fld-row",children:[t.jsx("label",{className:"fld-lbl",children:"Title"}),t.jsx("input",{className:"fld-input",type:"text",value:I,onChange:S=>q(S.target.value),placeholder:"Partner, CEO, etc."})]}),t.jsxs("div",{className:"fld-row",children:[t.jsx("label",{className:"fld-lbl",children:"Company"}),t.jsx("input",{className:"fld-input",type:"text",value:E,onChange:S=>H(S.target.value)})]}),t.jsxs("div",{className:"fld-row",children:[t.jsx("label",{className:"fld-lbl",children:"LinkedIn URL"}),t.jsx("input",{className:"fld-input",type:"url",value:M,onChange:S=>C(S.target.value),placeholder:"https://linkedin.com/in/..."})]}),t.jsxs("div",{className:"fld-row",children:[t.jsx("label",{className:"fld-lbl",children:"Location"}),t.jsx("input",{className:"fld-input",type:"text",value:G,onChange:S=>ce(S.target.value)})]}),t.jsxs("div",{className:"fld-row",children:[t.jsx("label",{className:"fld-lbl",children:"Company website"}),t.jsx("input",{className:"fld-input",type:"url",value:te,onChange:S=>Z(S.target.value),placeholder:"https://..."})]}),Fe&&t.jsx("div",{className:"info-banner",style:{background:"#fdecea",borderColor:"#f3c3bb",color:"#9a3a2a",marginBottom:0,marginTop:12},children:Fe})]}),t.jsxs("div",{className:"modal-foot",children:[t.jsx("button",{className:"btn-foot",onClick:be,disabled:de,children:"Cancel"}),t.jsx("button",{className:"btn-foot primary",onClick:Ce,disabled:de,children:de?"Saving…":"Save changes"})]})]})})}const bl=4,Nl=!1,Io=100,vl=100,xl=300,Co=["purple","green","amber","blue","red","teal"];function So(r){return Co[Math.abs(r)%Co.length]}function ye(r){const c=(r||"").replace(/\s+/g," ").trim().split(" ").filter(
1Boolean);return c.length>=2?(c[0][0]+c[c.length-1][0]).toUpperCase():(r||"?").slice(0,2).toUpperCase()||"?"}function Ke(r){return(r||"").trim().split(/\s+/)[0]||r||"there"}const wl=/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$/i;function jl(r,c){const h=(r||"").trim();if(!h||wl.test(h))return!0;const d=(c||"").trim().toLowerCase();return!!(d&&h.toLowerCase()===d)}function pt(r,c){const h=(r||"").trim();return!h||jl(h,c)?"":h}function Il(r,c){const h=pt(r,c);return h?h.split(/\s+/).filter(p=>/[a-zA-Z]/.test(p)).length>=2:!1}function Re(r,c){return Xt(r,c)}function Qt(r){return r?Gi({meetings12mo:r.meetingCount||0,emailsSent90d:r.sentCount||0,emailsReceived90d:r.receivedCount||0,lastMeetingAt:r.lastMeetingAt,lastEmailAt:r.lastSentAt&&r.lastReceivedAt?r.lastSentAt>r.lastReceivedAt?r.lastSentAt:r.lastReceivedAt:r.lastSentAt||r.lastReceivedAt}):null}const Lo={very_strong:"vs",strong:"s",solid:"so",light:"l"},Ht={very_strong:"Very strong",strong:"Strong",solid:"Solid",light:"Light"};function Cl(r){const c=Qt(r);return!c||c.hidden||!c.tier?null:c.tier}function Eo(r,c){const h=(r.email||"").trim().toLowerCase(),d=h?c[h]:null;return Qt(d)}function Zt(r,c,h=!1){return Fi(r,h||Ki(c))}function To(r,c){if(r==="connector")return 0;const h=Zt(c,r);return h?h==="very_strong"||h==="strong"?0:h==="light"?1:h==="solid"?2:3:3}function Mo(r,c){return Il(r,c)?0:pt(r,c)?1:2}function Bn(r,c,h={}){const d=r.email?h[r.email.trim().toLowerCase()]:null,p=c.email?h[c.email.trim().toLowerCase()]:null,y=Qt(d),b=Qt(p),v=y&&!y.hidden?y.tier:null,T=b&&!b.hidden?b.tier:null,_=To(r.strengthLabel??null,v),z=To(c.strengthLabel??null,T);if(_!==z)return _-z;const B=Zt(v,r.strengthLabel??null),I=Zt(T,c.strengthLabel??null);if(B&&I&&B!==I)return No[I]-No[B];const q=y&&!y.hidden?y.score:0,E=b&&!b.hidden?b.score:0;if(q!==E)return E-q;const H=(y==null?void 0:y.lastTouchMs)??0,M=(b==null?void 0:b.lastTouchMs)??0;if(H!==M)return M-H;const C=Mo(r.rawName,r.email),G=Mo(c.rawName,c.email);return C!==G?C-G:Re(r.rawName,r.email).toLowerCase().localeCompare(Re(c.rawName,c.email).toLowerCase())}function Sl(r,c,h={}){return Bn(r,c,h)}function Po(r,c,h={}){return Bn({rawName:r.rawName??r.name,email:r.email,strengthLabel:r.strengthLabel},{rawName:c.rawName??c.name,email:c.email,strengthLabel:c.strengthLabel},h)}const Ao="network-tier-group-other",Ll=["very_strong","strong","solid","light","other"];function El(r,c){const h=new Map;for(const d of r){const p=c(d)??"other",y=h.get(p);y?y.push(d):h.set(p,[d])}return Ll.filter(d=>{var p;return(((p=h.get(d))==null?void 0:p.length)??0)>0}).map(d=>({tier:d,label:d==="other"?"Other":qo(d),rows:h.get(d)}))}const An="__no_company__";function Tl(r){const c=new Map;for(const d of r){const p=(d.companyName||"").trim(),y=p?p.toLowerCase():An,b=p||"No company listed",v=c.get(y);v?v.rows.push(d):c.set(y,{label:b,rows:[d]})}const h=Array.from(c.entries()).map(([d,{label:p,rows:y}])=>({tier:d,label:p,rows:y}));return h.sort((d,p)=>d.tier===An?1:p.tier===An?-1:p.rows.length!==d.rows.length?p.rows.length-d.rows.length:d.label.localeCompare(p.label)),h}function Ro(r){if(!r)return"";const c=new Date(r);if(!Number.isFinite(c.getTime()))return"";const h=c.getUTCFullYear()===new Date().getUTCFullYear();return c.toLocaleDateString(void 0,h?{month:"short",day:"numeric"}:{month:"short",day:"numeric",year:"numeric"})}function Ml(r){return`${r.toLocaleString()} meeting${r===1?"":"s"}`}function Rn(r){if(!r)return"";const c=Date.now()-new Date(r).getTime();if(!Number.isFinite(c))return"";if(c<0){const b=Math.abs(c),v=Math.round(b/864e5);return v<1?"soon":v<7?`in ${v}d`:v<30?`in ${Math.round(v/7)}w`:v<365?`in ${Math.round(v/30)}mo`:`in ${Math.round(v/365)}y`}const h=Math.floor(c/1e3);if(h<60)return"just now";const d=Math.floor(h/60);if(d<60)return`${d}m ago`;const p=Math.floor(d/60);if(p<24)return`${p}h ago`;const y=Math.floor(p/24);return y===0?"today":y<7?`${y}d ago`:y<30?`${Math.floor(y/7)}w ago`:y<365?`${Math.floor(y/30)}mo ago`:`${Math.floor(y/365)}y ago`}function W(r){return r===1?"Founder":r===2?"Investor":r===3?"Scout":""}function Fo(r,c){return c?r.name.toLowerCase().includes(c)||(r.rawName||"").toLowerCase().includes(c)||(r.role||"").toLowerCase().includes(c)||(r.email||"").toLowerCase().includes(c):!0}function Wo(r){const c=r.user,h=(c!=null&&c.user&&typeof c.user=="object"?c.user:void 0)||(c&&typeof c=="object"&&"id"in c?c:void 0),d=(h==null?void 0:h.id)??0;if(!d)return null;const p=h==null?void 0:h.email,y=((h==null?void 0:h.fullname)||"").trim(),b=pt(y,p)||Re(y,p)||`User ${d}`,v=(c==null?void 0:c.founder)??null,T=(c==null?void 0:c.investor)??null;let _="",z=null,B=null;v&&(v.title||v.companyName)?(z=v.title||null,B=v.companyName||null,_=[v.title,v.companyName].filter(
1Boolean).join(" · ")):T&&(T.title||T.fundName)?(z=T.title||null,B=T.fundName||null,_=[T.title,T.fundName].filter(Boolean).join(" · ")):h!=null&&h.title&&(z=h.title,_=h.title);const I=r.role??(h==null?void 0:h.role)??0;return{connectionID:r.connectionID??0,userId:d,name:b,rawName:y||b,role:_||W(I),email:p,photo:(h==null?void 0:h.profilePhoto)??null,roleKind:I,title:z,companyName:B}}const Uo=[{value:"double",label:"Double",note:"Both sides say yes before anyone is connected."},{value:"single",label:"Single",note:"Only one side is asked — you vouch for the other."},{value:"disabled",label:"Off",note:"No approvals: we connect them right away."}];function Pl({mode:r,onChange:c,disabled:h}){const d=Uo.find(p=>p.value===r);return t.jsxs("div",{className:"intro-optin-bar",children:[t.jsx("span",{className:"intro-optin-bar-lbl",children:"Opt-in"}),t.jsx("div",{className:"intro-optin-seg",role:"radiogroup","aria-label":"Opt-in mode",children:Uo.map(p=>t.jsx("button",{type:"button",role:"radio","aria-checked":r===p.value,title:p.note,className:`intro-optin-seg-btn${r===p.value?" active":""}`,disabled:h,onClick:()=>c(p.value),children:p.label},p.value))}),t.jsx("span",{className:"intro-optin-bar-note",children:d==null?void 0:d.note})]})}function Ye({name:r,photo:c,label:h,tone:d,userId:p,title:y,company:b}){const v=pl(p,y,b),T=r.trim().toLowerCase()===h.trim().toLowerCase();return t.jsxs("div",{className:"intro-pick-node",children:[t.jsx("span",{className:`intro-pick-av intro-pick-av--${d}`,children:c?t.jsx("img",{src:c,alt:""}):ye(r)}),t.jsx("span",{className:"intro-pick-node-lbl",children:h}),T?null:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"intro-pick-node-name",title:r,children:r}),v.title?t.jsx("span",{className:"intro-pick-node-meta",title:v.title,children:v.title}):null,v.company?t.jsx("span",{className:"intro-pick-node-meta",title:v.company,children:v.company}):null]})]})}const Fn=[{id:"raise",label:"💰 Series A raise",custom:!1},{id:"hire",label:"👥 Hiring",custom:!1},{id:"partner",label:"🤝 Partnerships",custom:!1}];function ht(r){if(r.sourceKind==="connector"&&r.userId<0)return{key:`connector-${Math.abs(r.userId)}`,userId:0,name:r.name,rawName:r.rawName??r.name,role:r.role,title:r.title??null,companyName:r.companyName??null,email:r.email??null,photo:r.photo,roleKind:r.roleKind,kind:"contact",isGem:!1,strengthLabel:r.strengthLabel??null};if(r.userId<0){const c=Math.abs(r.userId);return{key:`contact-${c}`,userId:0,contactId:c,name:r.name,rawName:r.rawName??r.name,role:r.role,title:r.title??null,companyName:r.companyName??null,email:r.email??null,photo:r.photo,roleKind:r.roleKind,kind:"contact",isGem:!1,strengthLabel:r.strengthLabel??null}}return{key:`u-${r.userId}`,userId:r.userId,name:r.name,rawName:r.rawName??r.name,role:r.role,title:r.title??null,companyName:r.companyName??null,email:r.email,photo:r.photo,roleKind:r.roleKind,kind:"gem",isGem:!0,strengthLabel:r.strengthLabel??null}}function zo(r){const c=Wo(r);return c?{key:`u-${c.userId}`,userId:c.userId,name:Xt(c.rawName??c.name,c.email),rawName:c.rawName??c.name,role:c.role,title:c.title??null,companyName:c.companyName??null,email:c.email,photo:c.photo,roleKind:c.roleKind,kind:"gem",isGem:!0,strengthLabel:c.strengthLabel??null}:null}function Un(r,c){const h=r,d=Number(h.id||0);if(!d)return null;const p=String(h.fullName||h.displayName||h.name||"").trim(),y=h.email||null,b=h.phoneNumber||h.phone_number||null,v=h.profilePhotoUrl||h.profilePhoto||h.profile_photo_url||null,T=h.linkedinUrl||h.linkedin_url||null,_=h.connectedUserId??h.connected_user_id??null,z=Number(_||0)||null,B=h.title||null,I=h.location||null,q=h.companyName||h.company||null,E=h.companyWebsite||h.company_website||null,H=h.apolloEnrichedAt||h.apollo_enriched_at||null,M=h.strengthLabel||h.strength_label||null,C=M==="strong_connection"||M==="connector"?M:null,G=h.geminiSummary||h.gemini_summary||null;let ce=null;const te=h.source||null;return{id:d,fullName:p,source:te&&String(te).trim()?String(te).trim():null,email:y&&String(y).trim()?String(y).trim():null,phoneNumber:b&&String(b).trim()?String(b).trim():null,profilePhotoUrl:v&&String(v).trim()?String(v).trim():null,linkedinUrl:T&&String(T).trim()?String(T).trim():null,connectedUserId:z,title:B&&String(B).trim()?String(B).trim():null,location:I&&String(I).trim()?String(I).trim():null,companyName:q&&String(q).trim()?String(q).trim():null,companyWebsite:E&&String(E).trim()?String(E).trim():null,apolloEnrichedAt:H&&String(H).trim()?String(H).trim():null,
1strengthLabel:C,geminiSummary:G&&String(G).trim()?String(G).trim():null,geminiProfile:ce}}function _o(r){return/already signed up|already invited|already exists?/i.test(r)?"Invitation already exists":r||"Failed to send invite"}function Al(r){return/invitation already exists|already signed up|already invited|already exists?/i.test(r)}async function Rl(r){try{const c=await r.json();if(typeof(c==null?void 0:c.message)=="string")return _o(c.message);if(typeof(c==null?void 0:c.error)=="string")return _o(c.error)}catch{}return`Failed to send invite (${r.status})`}async function Fl(r,c,h={}){const d=(h.note||"").trim(),p={email:c,...h.name?{name:h.name}:{},...h.resend?{resend:!0}:{},...d?{note:d}:{}},y=await Ui(p,r);if(!y.ok)throw new Error(await Rl(y));const b=await y.json().catch(()=>null),v=typeof(b==null?void 0:b.message)=="string"?b.message:"";if(!h.resend&&/already sent|already invited|already had an invite|already exists?/i.test(v))throw new Error("Invitation already exists")}function Bo(r,c){if(r==null)return null;const h=String(r).trim();if(!h||h==="-1,-1,-1"||h==="-1")return null;if(!h.includes("-1")&&!/^\d/.test(h))return h;const d=h.split(",").map(p=>p.trim()).filter(p=>p&&p!=="-1"&&p!=="0").map(p=>c[p]).filter(p=>!!p);return d.length>0?d.join(", "):null}function Go(r){const c=Number((r==null?void 0:r.contactId)||0);if(!c)return null;const h=Number((r==null?void 0:r.connectedUserId)||0),d=[r==null?void 0:r.title,r==null?void 0:r.company].filter(Boolean).join(" · "),p=(r==null?void 0:r.strengthLabel)==="strong_connection"||(r==null?void 0:r.strengthLabel)==="connector"?r.strengthLabel:null,y=((r==null?void 0:r.displayName)||"").trim();return{key:`c-${c}`,userId:h>0?h:0,contactId:c,name:Xt(y,(r==null?void 0:r.email)||null),rawName:y,role:d||"",title:(r==null?void 0:r.title)??null,companyName:(r==null?void 0:r.company)??null,email:(r==null?void 0:r.email)||null,photo:null,roleKind:0,kind:"contact",isGem:h>0,strengthLabel:p}}function Do(r,c,h){const p=_i(r).map(zo).filter(b=>!!b&&b.userId!==c&&b.userId!==h),y=Bi(r).map(b=>Go(b)).filter(b=>!(!b||b.userId>0&&(b.userId===c||b.userId===h)));return[...p,...y]}function Ul(r,c,h){const d=r.trim();return{key:`adhoc-${h}`,userId:0,name:d||"Added contact",rawName:d,role:"Added by email",email:c.trim(),photo:null,roleKind:0,kind:"contact",isGem:!1}}function Oo(r,c,h){const d=((h==null?void 0:h.email)||c.email||"").trim().toLowerCase(),p=c.userId>0?c.userId:Number((h==null?void 0:h.connectedUserId)||0);for(const y of r)if(!(y.status==="revoked"||y.status==="rejected")&&(p>0&&y.userId===p||d&&(y.email||"").trim().toLowerCase()===d))return y;return null}function _l(){const r="(max-width: 900px)",[c,h]=i.useState(()=>typeof window<"u"&&window.matchMedia(r).matches);return i.useEffect(()=>{const d=window.matchMedia(r),p=()=>h(d.matches);return p(),d.addEventListener("change",p),()=>d.removeEventListener("change",p)},[]),c}function $o({className:r="",onInvite:c,inviteLabel:h="Invite",inviteDisabled:d=!1,inviteTitle:p,onMarkConnector:y,onUnmarkConnector:b,connectorMarkBusy:v=!1,isConnector:T=!1,connectorPending:_=!1,connectorInviteDisabled:z=!1,connectorInviteTitle:B,onMarkStrong:I,markStrongBusy:q=!1,onEdit:E,onArchive:H,archiving:M=!1}){return t.jsxs(Ji,{children:[t.jsx(el,{asChild:!0,children:t.jsx("button",{type:"button",className:`nc-card-menu-btn ${r}`.trim(),"aria-label":"More actions",onPointerDown:C=>C.stopPropagation(),onClick:C=>C.stopPropagation(),children:"⋯"})}),t.jsxs(tl,{align:"end",sideOffset:4,className:"nc-card-menu-dropdown",children:[t.jsx(Ge,{className:"nc-card-menu-item",disabled:!c||d,onClick:C=>C.stopPropagation(),onSelect:C=>{C.stopPropagation(),c==null||c()},title:p||"Invite",children:"Invite"}),T?t.jsx(Ge,{className:"nc-card-menu-item",disabled:!b||v,onClick:C=>C.stopPropagation(),onSelect:C=>{C.stopPropagation(),b==null||b()},children:v?"Updating…":_?"Cancel connector invite":"Remove connector"}):t.jsx(Ge,{className:"nc-card-menu-item",disabled:!y||v||z,title:B,onClick:C=>C.stopPropagation(),onSelect:C=>{C.stopPropagation(),y==null||y()},children:v?"Updating…":"Invite as connector"}),I?t.jsx(Ge,{className:"nc-card-menu-item",disabled:q,onClick:C=>C.stopPropagation(),onSelect:C=>{C.stopPropagation(),I()},children:q?"Updating…":"Mark as strong"}):null,t.jsx(Ge,{className:"nc-card-menu-item",disabled:!E||M,onClick:C=>C.stopPropagation(),onSelect:C=>{C.stopPropagation(),E==null||E()},children:"Edit profile"}),t.jsx(Ge,{className:"nc-card-menu-item",disabled:!H||M,onClick:C=>C.stopPropagation(),onSelect:C=>{C.stopPropagation(),H==null||H()},children:M?"Archiving…":"Archive"})]})]})}function rc(){var js,Is,Cs,Ss,Ls,Es,Ts,Ms,Ps,As,Rs,Fs,Us,_s,Bs,Ds,Os,$s,qs,Ws,zs,Gs,Ks,Ys,Hs,Vs,Qs,Zs,Xs,Js,eo,to,no,ao,so,oo,ro,io,lo,co;const{user:r}
1=_n(),{openUpgrade:c,guardPaidAction:h}=Hr(),d=r==null?void 0:r.accessToken,p=r==null?void 0:r.userId,y=ye((r==null?void 0:r.fullName)||"You"),[b,v]=i.useState(!0);Vr(!b);const T=i.useRef(0),_=i.useRef(!1),[z,B]=i.useState(null),[I,q]=i.useState([]),[E,H]=i.useState(""),[M,C]=i.useState(""),G=i.useRef(null),[ce,te]=i.useState(Io),[Z,de]=i.useState(null),[oe,Fe]=i.useState(""),[ne,be]=i.useState(""),[Ce]=Qr(),[S,me]=i.useState(()=>Ce.get("tab")==="add"?"add":"all"),[N,J]=i.useState("all"),[ue]=i.useState("strength"),[Ne,He]=i.useState(!1),Jt=i.useRef(null),Se=_l(),Ko=Zr(),Yo=Xr(),[Ve,Ue]=i.useState(null);i.useEffect(()=>{Se||Ue(null)},[Se]),i.useEffect(()=>{if(!Ve)return;const e=document.body.style.overflow;document.body.style.overflow="hidden";const n=a=>{a.key==="Escape"&&Ue(null)};return window.addEventListener("keydown",n),()=>{document.body.style.overflow=e,window.removeEventListener("keydown",n)}},[Ve]),i.useEffect(()=>{if(!Ne)return;const e=n=>{Jt.current&&!Jt.current.contains(n.target)&&He(!1)};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[Ne]);const[$,he]=i.useState([]),[en,Qe]=i.useState(!1),[Bl,ft]=i.useState(null),[_e,tn]=i.useState(!1),[Ho,Dn]=i.useState(new Set),[On,$n]=i.useState(null),[Ze,gt]=i.useState(null),[qn,Wn]=i.useState(null),[zn,Gn]=i.useState(null),[Be,Vo]=i.useState([]),[De,Qo]=i.useState(null),[Zo,nn]=i.useState(!1),[Xo,an]=i.useState(!1),[ve,Kn]=i.useState(null),[sn,Yn]=i.useState(null),[Hn,yt]=i.useState(null),[A,Oe]=i.useState(null),[Xe,Vn]=i.useState(""),[Qn,Zn]=i.useState(!1),[Jo,er]=i.useState([]),[on,Xn]=i.useState(!1),[tr,Jn]=i.useState(null),[kt,nr]=i.useState(!1),[rn,ea]=i.useState([]),[ln,ta]=i.useState(!1),[na,aa]=i.useState(null),[cn,ar]=i.useState(!1),[sr,Dl]=i.useState("all"),[or,sa]=i.useState(null),[rr,dn]=i.useState(!1),[bt,mn]=i.useState(""),[Le,Je]=i.useState(null),[et,oa]=i.useState(!1),[ra,ia]=i.useState({}),[Nt,la]=i.useState(!1),[ca,da]=i.useState(!1),[Ol,ma]=i.useState(null),[F,un]=i.useState({}),[xe,vt]=i.useState(!1),[ua,ha]=i.useState(!1),[pe,ir]=i.useState(null),[tt,lr]=i.useState({}),[pa,cr]=i.useState(Jr),[P,nt]=i.useState(null),[s,D]=i.useState(null),hn=i.useRef(null),[$e,qe]=i.useState(""),[re,fa]=i.useState(!1),[xt,Q]=i.useState(null),[wt,at]=i.useState(null),[ga,j]=i.useState(null),[we,st]=i.useState({}),[dr,jt]=i.useState(!1),[ya,ot]=i.useState(null),[ka,rt]=i.useState([]),[ba,Na]=i.useState([]),[mr,va]=i.useState(0),[It,it]=i.useState({}),[lt,Ct]=i.useState({}),[k,Ee]=i.useState(null),[xa,wa]=i.useState([]),[$l,ct]=i.useState(!1),[ql,St]=i.useState(null),[Lt,pn]=i.useState(new Set),[Wl,ur]=i.useState(new Set),[ja,Ia]=i.useState([]),[zl,dt]=i.useState(!1),[Gl,Et]=i.useState(null),[Kl,Ca]=i.useState(180),[Sa,La]=i.useState(null),[hr,Ea]=i.useState(null),[Ta,Ma]=i.useState(null),[Pa,Aa]=i.useState(null),[pr,Ra]=i.useState(null),[Fa,fn]=i.useState(null),[Ua,gn]=i.useState(null),[fr,yn]=i.useState(null),[_a,gr]=i.useState({}),[Ba,yr]=i.useState({}),Da=i.useCallback(async()=>{if(!d||!p){v(!1);return}const e=++T.current;_.current=!0,v(!0),ct(!0),dt(!0),Qe(!0),B(null),St(null),Et(null),ft(null);try{const n=await ei(d,p);if(e!==T.current)return;const o=(Array.isArray(n.connections)?n.connections:[]).map(Wo).filter(m=>!!m&&m.userId!==p);q(o),wa(n.stayInTouch||[]),pn(new Set),Ia(n.worthReactivating||[]),Ca(n.silentDays||180),ir(n.networkShape??null),lr(n.signalTiersByEmail??{}),cr(ti(n.strongRelationships)),v(!1),ct(!1),dt(!1);const l=Array.isArray(n.contacts)?n.contacts:[];queueMicrotask(()=>{if(e!==T.current){_.current=!1;return}const m=l.map(u=>Un(u)).filter(u=>!!u);he(m),tn(!0),Qe(!1),_.current=!1})}catch(n){if(e!==T.current)return;const a=n instanceof Error?n.message:"Failed to load";B(a),St(a),Et(a),ft(a),v(!1),ct(!1),dt(!1),Qe(!1),_.current=!1}},[d,p]);i.useEffect(()=>{Da()},[Da]);const Oa=i.useCallback(async()=>{if(!(!d||!p)){ct(!0),St(null);try{const e=await ni(d,p);wa(e.stayInTouch||[]),pn(new Set)}catch(e){St(e instanceof Error?e.message:"Failed to load")}finally{ct(!1)}}},[d,p]);i.useCallback(e=>{const n=e.contactUserId&&e.contactUserId>0?e.contactUserId:e.userId>0?e.userId:null,a=e.contactImportId&&e.contactImportId>0?e.contactImportId:null;!n&&!a||(yn({contactName:e.name}),fn(n),gn(a))},[]);const kr=i.useCallback((e,n)=>{n.contactUserId&&pn(a=>
1{const o=new Set(a);return o.add(n.contactUserId),o}),n.contactImportId&&ur(a=>{const o=new Set(a);return o.add(n.contactImportId),o}),j(e),setTimeout(()=>j(null),3e3)},[]),$a=i.useCallback(async()=>{if(!(!d||!p)){dt(!0),Et(null);try{const e=await ai(d,p);Ia(e.worthReactivating||[]),Ca(e.silentDays||180)}catch(e){Et(e instanceof Error?e.message:"Failed to load")}finally{dt(!1)}}},[d,p]),qa=i.useCallback(e=>{j(e),setTimeout(()=>j(null),3500),Oa(),$a()},[Oa,$a]);i.useMemo(()=>xa.filter(e=>!Lt.has(e.userId)).slice(0,bl),[xa,Lt]),i.useMemo(()=>ja.filter(e=>!Lt.has(e.userId)),[ja,Lt]);const Tt=i.useCallback(async()=>{if(d){Qe(!0),ft(null);try{const e=await si(d),n=(e==null?void 0:e.data)??e,a=Array.isArray(n)?n:(n==null?void 0:n.contacts)??(e==null?void 0:e.contacts)??[],l=(Array.isArray(a)?a:[]).map(m=>Un(m)).filter(m=>!!m);he(l),tn(!0)}catch(e){ft(e instanceof Error?e.message:"Failed to load contacts")}finally{Qe(!1)}}},[d]),Mt=i.useCallback(async()=>{if(d){Xn(!0),Jn(null);try{const e=await oi(d),n=(e==null?void 0:e.data)??e,a=Array.isArray(n)?n:(n==null?void 0:n.invited)??(e==null?void 0:e.invited)??[],l=(Array.isArray(a)?a:[]).map(m=>{const u=m,f=String(u.email||"").trim();return f?{email:f,isSignUp:u.isSignUp===!0,createdOn:u.createdOn||null}:null}).filter(m=>!!m);er(l),nr(!0)}catch(e){Jn(e instanceof Error?e.message:"Failed to load invites")}finally{Xn(!1)}}},[d]),Wa=i.useCallback(async()=>{if(d){ta(!0),aa(null);try{const e=await ri(d);ea(Array.isArray(e)?e:[]),ar(!0)}catch(e){aa(e instanceof Error?e.message:"Failed to load follow requests")}finally{ta(!1)}}},[d]),za=i.useCallback(async(e,n)=>{if(!(!d||!e)){sa(e);try{await ii(d,e,n),ea(a=>a.filter(o=>o.connectionID!==e)),j(n?"Follow request accepted":"Follow request declined"),setTimeout(()=>j(null),2500)}catch(a){j(a instanceof Error?a.message:"Couldn't respond to request"),setTimeout(()=>j(null),3500)}finally{sa(null)}}},[d]),Ga=i.useCallback(async()=>{if(!(!d||!p)){da(!0),ma(null);try{const e=new Date,n=new Date(e);n.setUTCMonth(n.getUTCMonth()-12);const a=n.toISOString().slice(0,10),o=new Date(e);o.setUTCDate(o.getUTCDate()+1);const l=o.toISOString().slice(0,10),m=await li(p,a,l,d),u=await m.json().catch(()=>null);if(!m.ok||!u||!u.success){if(m.status===404){ia({}),la(!0);return}throw new Error(u&&u.error||`meeting-stats HTTP ${m.status}`)}const f=Date.now(),g={};for(const x of u.contacts||[]){const w=String(x.contact_email||"").trim().toLowerCase();if(!w)continue;const L=x.last_meeting_at,Y=L?new Date(L).getTime():0,R=L&&Number.isFinite(Y)&&Y<=f?L:null;g[w]={count:Number(x.meeting_count)||0,firstMet:x.first_meeting_at,lastMet:R,name:x.contact_name}}ia(g),la(!0)}catch(e){ma(e instanceof Error?e.message:"Failed to load meetings")}finally{da(!1)}}},[d,p]),Ka=i.useCallback(async()=>{if(!(!d||!p)){ha(!0);try{const e=await ci(p,d),n=await e.json().catch(()=>null);if(!e.ok||!n||!n.success){if(e.status===404){un({}),vt(!0);return}vt(!0);return}const a={};for(const o of n.signals||[]){const l=String(o.contact_email||"").trim().toLowerCase();l&&(a[l]={sentCount:Number(o.sent_count)||0,receivedCount:Number(o.received_count)||0,meetingCount:Number(o.meeting_count)||0,lastSentAt:o.last_sent_at,lastReceivedAt:o.last_received_at,lastMeetingAt:o.last_meeting_at,lastSignalAt:o.last_signal_at,name:o.contact_name})}un(a),vt(!0)}catch{vt(!0)}finally{ha(!1)}}},[d,p]),Ya=i.useCallback(e=>{if(e==="all")return"2016-01-01";const n=e==="1mo"?1:e==="3mo"?3:e==="6mo"?6:e==="24mo"?24:12,a=new Date;return a.setUTCMonth(a.getUTCMonth()-n),a.toISOString().slice(0,10)},[]),br=i.useCallback(async(e,n,a="12mo")=>{if(!(!d||!p||!e)){nt(o=>({email:e,name:n,range:a,loading:!0,error:null,totalMeetings:(o==null?void 0:o.email)===e?o.totalMeetings:0,months:(o==null?void 0:o.email)===e?o.months:[],recent:(o==null?void 0:o.email)===e?o.recent:[]}));try{const o=Ya(a),l=new Date;l.setUTCDate(l.getUTCDate()+1);const m=l.toISOString().slice(0,10),[u,f]=await Promise.all([di(p,e,o,m,d),mi(p,e,o,m,d)]),g=await u.json().catch(()=>null),x=await f.json().catch(()=>null);if(!u.ok||!(g!=null&&g.success))throw new Error((g==null?void 0:g.error)||`HTTP ${u.status}`);nt({email:e,name:n,range:a,loading:!1,error:null,totalMeetings:Number(g.total_meetings)||0,months:Array.isArray(g.months)?g.months:[],recent:f.ok&&Array.isArray(x==null?void 0:x.meetings)?x.meetings.map(w=>({start_at:w.start_at,event_title:w.event_title,status:w.status})):[]})}catch(o){nt(l=>l?{...l,loading:!1,error:o instanceof Error?o.message:"Failed to load meeting details"}:null)}}},[d,p,Ya]),ke=i.useCallback(e=>{const n=(r==null?void 0:r.fullName)||"You";Vn(xo(n)),Oe({contactId:e.contactId,email:e.email,name:e.name,mode:e.mode||"send",fromRequestIntro:e.fromRequestIntro})},[r==null?void 0:r.fullName]);i.useCallback(e=>{const n=$.find(l=>l.id===e);if(!n)return;const a=(n.email||"").trim(),o=pt(n.fullName||"",n.email)||n.fullName||"";if(!a){ke({contactId:e,email:"",name:o,mode:"no_email"});return}ke({contactId:e,email:a,name:o,mode:"send"})},[$,ke]);const kn=i.useCallback((e,n,a)=>{const o=(a||"").trim();ke({contactId:e,email:o,name:n,mode:o?"send":"no_email"})},[ke]),Ha=i.useCallback((e,n,a)=>{const o=(a||"").trim();ke({contactId:e,email:o,name:n,mode:o?"send":"no_email",fromRequestIntro:!0})},[ke]),Pt=i.useCallback(async e=>{if(!d)return;const n=e.email.trim();if(n){Zn(!0),e.contactId&&$n(e.contactId);try{await Fl(d,n,{name:e.name,note:e.note,resend:e.resend}),e.contactId&&Dn(a=>
1{const o=new Set(a);return o.add(e.contactId),o}),Oe(null),mn(""),dn(!1),Je(null),j(`Invite sent to ${n}.`),setTimeout(()=>j(null),3e3),kt&&Mt()}catch(a){const o=a instanceof Error?a.message:"Failed to send invite";!e.resend&&Al(o)?(Oe(null),Je({email:n,name:e.name,contactId:e.contactId})):(j(o),setTimeout(()=>j(null),3500))}finally{Zn(!1),e.contactId&&$n(null)}}},[d,kt,Mt]),Va=i.useMemo(()=>new Map($.map(e=>[e.id,e])),[$]),Qa=i.useMemo(()=>{const e=new Map;for(const n of $)n.connectedUserId&&!e.has(n.connectedUserId)&&e.set(n.connectedUserId,n);return e},[$]),Za=i.useMemo(()=>{const e=new Map;for(const n of $){const a=(n.email||"").trim().toLowerCase();a&&!e.has(a)&&e.set(a,n)}return e},[$]),ie=i.useCallback(e=>{if(e.contactId){const a=Va.get(e.contactId);if(a)return a}if(e.userId>0){const a=Qa.get(e.userId);if(a)return a}const n=(e.email||"").trim().toLowerCase();if(n){const a=Za.get(n);if(a)return a}return null},[Va,Qa,Za]),Nr=i.useCallback(e=>{const n=$.find(a=>a.id===e);n&&yt({...n,fullName:Vt(n.fullName,n.email)})},[$]),fe=i.useCallback(async e=>{if(!d)return j("Please sign in again."),setTimeout(()=>j(null),3e3),null;const n=ie(e);if(n)return n;const a={fullName:Vt(e.rawName||e.name,e.email),email:e.email??null,phoneNumber:null,title:e.title??null,companyName:e.companyName??null,linkedinUrl:e.linkedinUrl??null,location:e.location??null,companyWebsite:e.companyWebsite??null,connectedUserId:e.userId>0?e.userId:null,profilePhotoUrl:e.photo??null,source:e.userId>0?"gem_connection":"my_network",strengthLabel:e.strengthLabel??null};try{const o=await ui(d,a),l=Un({...o,connectedUserId:o.connectedUserId??a.connectedUserId,profilePhotoUrl:o.profilePhotoUrl??a.profilePhotoUrl,source:o.source??a.source,strengthLabel:o.strengthLabel??a.strengthLabel});if(!l)throw new Error("Contact create succeeded but no contact returned");return he(m=>m.some(u=>u.id===l.id)?m.map(u=>u.id===l.id?l:u):[...m,l]),tn(!0),l}catch(o){return j(o instanceof Error?o.message:"Failed to create editable contact"),setTimeout(()=>j(null),3500),null}},[d,ie]),Te=i.useMemo(()=>hi($.map(e=>({id:e.id,connectedUserId:e.connectedUserId,strengthLabel:e.strengthLabel}))),[$]),Me=i.useCallback(async()=>{if(d)try{const e=await pi(d);Vo(e.connectors),Qo(e.quota??null)}catch{}},[d]),vr=i.useCallback(()=>{if(sl(De)){c((De==null?void 0:De.tier)==="pro"?"team":"connectors");return}nn(!0)},[De,c]),xr=i.useCallback(()=>{h(()=>an(!0),"team")},[h]);i.useEffect(()=>{Me()},[Me]);const bn=i.useCallback(e=>{const n=ie(e),a=((n==null?void 0:n.email)||e.email||"").trim(),o=n?Re(n.fullName,n.email):e.name,l=o&&o.toLowerCase()!==a.toLowerCase()?o:"";Kn({email:a,name:l})},[ie]),Xa=i.useCallback(async(e,n)=>{if(!d||n.status!=="active")return;const a=await fe(e);!a||a.strengthLabel==="connector"||(await po(d,a.id,"connector"),he(o=>o.map(l=>l.id===a.id?{...l,strengthLabel:"connector"}:l)),q(o=>o.map(l=>l.userId===e.userId&&e.userId>0?{...l,strengthLabel:"connector"}:l)))},[d,fe]),At=i.useCallback(async e=>{if(!d)return;const n=await fe(e);if(n){Gn(n.id);try{await po(d,n.id,"strong_connection"),he(a=>a.map(o=>o.id===n.id?{...o,strengthLabel:"strong_connection"}:o)),q(a=>a.map(o=>o.userId===e.userId&&e.userId>0?{...o,strengthLabel:"strong_connection"}:o))}catch{j("Couldn't update — try again."),setTimeout(()=>j(null),3e3)}finally{Gn(null)}}},[d,fe]),wr=i.useCallback(async e=>{await Me();const n=I.find(a=>e.userId!=null&&a.userId>0&&a.userId===e.userId||e.email&&a.email&&a.email.toLowerCase()===e.email.toLowerCase())??null;n&&await Xa(n,e)},[I,Me,Xa]),Nn=i.useCallback(async e=>{if(!d)return;const n=ie(e),a=Oo(Be,e,n),o=(n==null?void 0:n.id)??(e.userId>0?e.userId:null);o!=null&&Wn(o);try{if(a&&(a.status==="pending"||a.status==="active")){const m=a.status==="pending"?"Cancel":"Remove",u=a.name||a.email||e.name;if(!window.confirm(`${m} connector relationship with ${u}?`))return;await fi(d,a.id),await Me()}const l=n??await fe(e);(l==null?void 0:l.strengthLabel)==="connector"&&(await gi(d,l.id),he(m=>m.map(u=>u.id===l.id?{...u,strengthLabel:null}:u)),q(m=>m.map(u=>u.userId===e.userId&&e.userId>0?{...u,strengthLabel:null}:u))),j(`${e.name} removed as connector`),setTimeout(()=>j(null),3e3)}catch(l){j(l instanceof Error?l.message:"Failed to update connector"),setTimeout(()=>j(null),3500)}finally{Wn(null)}},[d,Be,ie,fe,Me]),jr=i.useCallback(async e=>{const n=await fe(e);n&&yt({...n,fullName:Vt(n.fullName,n.email)})},[fe]),Ir=i.useCallback(e=>{he(n=>n.map(a=>a.id===e.id?{...a,fullName:e.fullName,email:e.email??null,phoneNumber:e.phoneNumber??null,title:e.title??null,companyName:e.companyName??null,linkedinUrl:e.linkedinUrl??null,location:e.location??null,companyWebsite:e.companyWebsite??null}:a)),j("Contact updated."),setTimeout(()=>j(null),3e3)},[]),Ja=i.useCallback(async e=>{if(!d||Ze!=null)return;const n=$.find(o=>o.id===e),a=n?Re(n.fullName,n.email):"this contact";if(window.confirm(`Archive ${a}? They will be hidden from My Network.`)){gt(e);try{await Ln(d,e),he(o=>o.filter(l=>l.id!==e)),Dn(o=>
1{if(!o.has(e))return o;const l=new Set(o);return l.delete(e),l}),yt(o=>(o==null?void 0:o.id)===e?null:o),j("Contact archived."),setTimeout(()=>j(null),3e3)}catch(o){j(o instanceof Error?o.message:"Failed to archive contact"),setTimeout(()=>j(null),3500)}finally{gt(null)}}},[d,Ze,$]),es=i.useCallback(async e=>{if(!d||sn!=null)return!1;if(!e.connectionID||e.connectionID<=0)return j("Preparing contact for archive..."),setTimeout(()=>j(null),3e3),!1;if(!window.confirm(`Archive ${e.name}? They will be hidden from My Network.`))return!1;Yn(e.connectionID);try{return await yi(d,e.connectionID),q(n=>n.filter(a=>a.connectionID!==e.connectionID)),j("Contact archived."),setTimeout(()=>j(null),3e3),!0}catch(n){return j(n instanceof Error?n.message:"Failed to archive contact"),setTimeout(()=>j(null),3500),!1}finally{Yn(null)}},[d,sn]),Cr=i.useCallback(async e=>{const n=ie(e);if(e.connectionID>0){if(await es(e)&&n&&d)try{await Ln(d,n.id),he(l=>l.filter(m=>m.id!==n.id))}catch{}return}if(n){await Ja(n.id);return}const a=await fe(e);if(!(!a||!d||Ze!=null)&&window.confirm(`Archive ${e.name}? They will be hidden from My Network.`)){gt(a.id);try{await Ln(d,a.id),he(l=>l.filter(m=>m.id!==a.id));const o=(e.email||a.email||"").trim().toLowerCase();o&&un(l=>{if(!l[o])return l;const m={...l};return delete m[o],m}),j("Contact archived."),setTimeout(()=>j(null),3e3)}catch(o){j(o instanceof Error?o.message:"Failed to archive contact"),setTimeout(()=>j(null),3500)}finally{gt(null)}}},[Ja,es,Ze,ie,fe,d]),Sr=i.useCallback(async()=>{if(!A)return;const e=(A.email||"").trim();if(e){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)){j("Enter a valid email."),setTimeout(()=>j(null),3e3);return}await Pt({email:e,name:A.name,contactId:A.contactId,note:Xe})}},[A,Xe,Pt]),Lr=i.useCallback(()=>{const e=bt.trim();if(!e)return;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)){j("Enter a valid email."),setTimeout(()=>j(null),3e3);return}const n=$.find(a=>(a.email||"").trim().toLowerCase()===e.toLowerCase());ke({contactId:n==null?void 0:n.id,email:e,name:(n==null?void 0:n.fullName)||e,mode:"send"})},[bt,$,ke]),Er=i.useCallback(async()=>{if(!(Le!=null&&Le.email))return;const{email:e,name:n,contactId:a}=Le;oa(!0),await Pt({email:e,name:n,contactId:a,note:Xe||xo((r==null?void 0:r.fullName)||"You"),resend:!0}),oa(!1)},[Le,Xe,Pt,r==null?void 0:r.fullName]);i.useEffect(()=>{d&&(S==="contacts"&&!_e&&!en&&!_.current&&Tt(),!kt&&!on&&Mt(),!cn&&!ln&&Wa(),!Nt&&!ca&&Ga(),!xe&&!ua&&Ka())},[S,d,_e,en,kt,on,cn,ln,Nt,ca,xe,ua,Tt,Mt,Wa,Ga,Ka]);const[Rt,ts]=i.useState(!1),ns=i.useRef(new Set),as=i.useCallback(async e=>{if(!(!d||e.length===0||Rt)){ts(!0);try{const n=await ki(e.slice(0,25),d);if(!n.ok){n.status!==503&&console.warn("apollo enrich failed",n.status);return}await Tt()}catch(n){console.warn("apollo enrich error",n)}finally{ts(!1)}}},[d,Rt,Tt]);i.useEffect(()=>{var n;if(S!=="contacts"||!_e||!Nt&&!xe||Rt)return;const e=[];for(const a of $){if(a.apolloEnrichedAt||!a.email||ns.current.has(a.id))continue;const o=a.email.trim().toLowerCase(),l=((n=ra[o])==null?void 0:n.count)||0,m=F[o],u=((m==null?void 0:m.sentCount)||0)+((m==null?void 0:m.receivedCount)||0);if((l>=1||u>=3)&&(e.push(a.id),ns.current.add(a.id)),e.length>=25)break}e.length>0&&as(e)},[S,_e,Nt,xe,Rt,$,ra,F,as]),i.useEffect(()=>{if(!d)return;let e=!1;return(async()=>{try{const[n,a]=await Promise.all([bi(d),Ni(d)]);if(n.ok&&!e){const o=await n.json(),l=Array.isArray(o)?o:(o==null?void 0:o.data)??[],m={};for(const u of l)(u==null?void 0:u.id)!=null&&(u!=null&&u.name)&&(m[String(u.id)]=u.name);gr(m)}if(a.ok&&!e){const o=await a.json(),l=Array.isArray(o)?o:(o==null?void 0:o.data)??[],m={};for(const u of l)(u==null?void 0:u.id)!=null&&(u!=null&&u.name)&&(m[String(u.id)]=u.name);yr(m)}}catch{}})(),()=>{e=!0}},[d]),i.useEffect(()=>{if(!d||!p)return;let e=!1;return(async()=>{var n,a,o,l;try{const m=await vi(p,d);if(!m.ok)return;const u=await m.json(),f=((n=u==null?void 0:u.user)==null?void 0:n.user)??(u==null?void 0:u.user)??((a=u==null?void 0:u.data)==null?void 0:a.user)??(u==null?void 0:u.data)??u,g=(f==null?void 0:f.profilePhoto)||(f==null?void 0:f.ProfilePhoto)||(f==null?void 0:f.profile_photo)||null,x=(f==null?void 0:f.founder)??((o=u==null?void 0:u.user)==null?void 0:o.founder)??null,w=(f==null?void 0:f.investor)??((l=u==null?void 0:u.user)==null?void 0:l.investor)??null,{title:L,company:Y}=xi({founder:x,investor:w,user:f});e||(g&&de(String(g)),Fe(L),be(Y))}catch{}})(),()=>{e=!0}},[d,p]),i.useEffect(()=>(G.current&&clearTimeout(G.current),G.current=setTimeout(()=>{C(E),G.current=null},xl),()=>{G.current&&clearTimeout(G.current)}),[E]);const X=i.useMemo(()=>$.filter(e=>!il(e)).slice().sort((e,n)=>Sl({rawName:e.fullName,email:e.email,strengthLabel:e.strengthLabel},{rawName:n.fullName,email:n.email,strengthLabel:n.strengthLabel},F)),[$,F]),ss=i.useMemo(()=>
1{if(!X.length)return[];const e=new Set(I.map(o=>(o.email||"").trim().toLowerCase()).filter(Boolean)),n=new Set(I.map(o=>o.userId).filter(o=>o>0)),a=new Set;return X.filter(o=>{const l=(o.email||"").trim().toLowerCase();if(o.connectedUserId){if(o.connectedUserId===p||n.has(o.connectedUserId)||a.has(o.connectedUserId))return!1;a.add(o.connectedUserId)}return!l||!e.has(l)}).map(o=>{const l=[o.title,o.companyName].filter(Boolean).join(" at "),m=o.connectedUserId&&o.connectedUserId>0?o.connectedUserId:null;return{connectionID:-o.id,userId:m??-o.id,contactId:o.id,name:Re(o.fullName,o.email),rawName:o.fullName,role:l||"",email:o.email||void 0,photo:o.profilePhotoUrl??null,roleKind:0,strengthLabel:o.strengthLabel??null,linkedinUrl:o.linkedinUrl??null,title:o.title??null,location:o.location??null,companyName:o.companyName??null,companyWebsite:o.companyWebsite??null}})},[X,I,p]),os=2e9,Ft=i.useMemo(()=>{if(!Be.length)return[];const e=new Set(I.map(a=>a.userId).filter(a=>a>0));for(const a of X)a.connectedUserId&&a.connectedUserId>0&&e.add(a.connectedUserId);const n=new Set;for(const a of I){const o=(a.email||"").trim().toLowerCase();o&&n.add(o)}for(const a of X){const o=(a.email||"").trim().toLowerCase();o&&n.add(o)}return Be.filter(a=>a.status==="active"||a.status==="pending").filter(a=>{if(a.userId&&a.userId>0&&e.has(a.userId))return!1;const o=(a.email||"").trim().toLowerCase();return!(o&&n.has(o))}).map(a=>{const o=(a.name||a.email||"Connector").trim(),l=a.userId&&a.userId>0?a.userId:null;return{connectionID:-(os+a.id),userId:l??-(os+a.id),name:o,rawName:o,role:a.role||(a.status==="pending"?"Connector invite pending":"Connector"),email:a.email||void 0,photo:a.profilePhoto,roleKind:0,strengthLabel:a.status==="active"?"connector":null,companyName:a.company,sourceKind:"connector"}})},[Be,I,X]),rs=i.useMemo(()=>{if(!xe)return[];const e=wo(I.map(n=>n.email||""),X.map(n=>n.email));return ll(e,F)},[I,X,F,xe]),vn=i.useMemo(()=>[...I.map(a=>{const o=ie(a);return o!=null&&o.strengthLabel?{...a,strengthLabel:o.strengthLabel}:a}),...ss,...Ft,...rs].slice().sort((a,o)=>Po(a,o,F)),[I,ss,Ft,rs,F,ie]),ae=i.useMemo(()=>{const e=M.trim().toLowerCase();return e?vn.filter(n=>Fo(n,e)):vn},[vn,M]),Ut=i.useMemo(()=>{const e=new Set(I.map(o=>(o.email||"").trim().toLowerCase()).filter(Boolean)),n=_e?cl(I.length,e,X):I.length;if(!xe)return n;const a=wo(I.map(o=>o.email||""),X.map(o=>o.email));return n+dl(a,F)+Ft.length},[I,_e,X,F,xe,Ft.length]),_t=i.useMemo(()=>{const e={};for(const[n,a]of Object.entries(F))e[n]={...a,contactName:a.name};return e},[F]),Pe=i.useCallback(e=>{const n=(e.email||"").trim().toLowerCase();let a=n?jo(n,F,tt):null,o=n;if(!a){const m=ml(e.rawName||e.name,_t);m&&(o=o||m,a=jo(m,F,tt))}const l=wi(pa,{userId:e.userId,email:o});return Zt(a,e.strengthLabel,l)},[F,_t,tt,pa]),je=i.useCallback((e,n)=>{if(n==="all")return!0;const a=Pe(e);return n==="not_rated"?a==null:n==="very_strong"?a==="very_strong":n==="strong"?a==="strong":n==="solid"?a==="solid":a==="light"},[Pe]),se=i.useMemo(()=>{const e={all:ae.length,very_strong:0,strong:0,solid:0,light:0,not_rated:0};for(const n of ae)je(n,"very_strong")&&e.very_strong++,je(n,"strong")&&e.strong++,je(n,"solid")&&e.solid++,je(n,"light")&&e.light++,je(n,"not_rated")&&e.not_rated++;if(pe){const n=(pe.veryStrong??e.very_strong)+(pe.strong??e.strong)+(pe.solid??e.solid)+(pe.light??e.light);return{all:ae.length,very_strong:pe.veryStrong??e.very_strong,strong:pe.strong??e.strong,solid:pe.solid??e.solid,light:pe.light??e.light,not_rated:Math.max(e.n
1ot_rated,ae.length-n)}}return e},[ae,je,pe]),Ae=i.useMemo(()=>{if(N==="all")return ae;const e=ae.filter(m=>je(m,N));if(N!=="light")return e;const n=new Set;for(const m of e){const f=(ul({name:m.rawName||m.name,email:m.email},_t)||m.email||"").trim().toLowerCase();f&&n.add(f)}const a=hl(n,tt),o=M.trim().toLowerCase(),l=o?a.filter(m=>Fo(m,o)):a;return[...e,...l].sort((m,u)=>Po(m,u,F))},[ae,N,je,tt,_t,M,F]);i.useEffect(()=>{te(Io)},[S,M,N]);const Bt=i.useMemo(()=>M.trim()?Ae:Ae.slice(0,ce),[Ae,M,ce]),Tr=!M.trim()&&ce<Ae.length,xn=i.useMemo(()=>ue==="company"?Tl(Bt):El(Bt,Pe),[Bt,Pe,ue]),[is,ls]=i.useState(!1),cs=i.useCallback(()=>{const e=document.getElementById(Ao);return e?(e.scrollIntoView({behavior:"smooth",block:"start"}),!0):!1},[]),Dt=i.useMemo(()=>ae.filter(e=>Pe(e)==null),[ae,Pe]),Mr=i.useCallback(()=>{Dt.length&&(J("not_rated"),ls(!0),Se&&Ue({row:Dt[0],mode:"more"}))},[Dt,Se]);i.useEffect(()=>{is&&cs()&&ls(!1)},[is,xn,cs]),i.useMemo(()=>{const e=M.trim().toLowerCase();if(!e)return X;const n=e.replace(/[\s\-()]/g,"");return X.filter(a=>{const o=(a.fullName||"").toLowerCase(),l=pt(a.fullName,a.email).toLowerCase(),m=(a.email||"").toLowerCase(),u=(a.phoneNumber||"").replace(/[\s\-()]/g,"").toLowerCase();return o.includes(e)||l.includes(e)||m.includes(e)||n.length>0&&u.includes(n)})},[X,M]);const ds=i.useMemo(()=>({all:[...rn]}),[rn]),ms=i.useMemo(()=>{const e=ds.all,n=M.trim().toLowerCase();return n?e.filter(a=>{var g,x,w,L,Y;const o=(g=a==null?void 0:a.user)==null?void 0:g.user,l=String((o==null?void 0:o.fullname)||"").toLowerCase(),m=String((o==null?void 0:o.email)||"").toLowerCase(),u=String(((w=(x=a==null?void 0:a.user)==null?void 0:x.founder)==null?void 0:w.companyName)||"").toLowerCase(),f=String(((Y=(L=a==null?void 0:a.user)==null?void 0:L.investor)==null?void 0:Y.fundName)||"").toLowerCase();return l.includes(n)||m.includes(n)||u.includes(n)||f.includes(n)}):e},[ds,sr,M]),us=rn.length,Pr=i.useCallback(async()=>{if(!(!d||!p)){jt(!0),ot(null),rt([]);try{const e=await ji(p,d),n=l=>l.userId>0&&Te.userIds.has(l.userId)?{...l,strengthLabel:"connector"}:l,a=(Array.isArray(e==null?void 0:e.gemConnections)?e.gemConnections:[]).map(l=>zo(l)).filter(l=>!!l).map(n),o=(Array.isArray(e==null?void 0:e.importContacts)?e.importContacts:[]).map(l=>{const m=$.find(f=>f.id===Number(l.contactId)),u=m?{...l,strengthLabel:m.strengthLabel,displayName:l.displayName||m.fullName}:l;return Go(u)}).filter(l=>!!l).map(l=>l.contactId&&Te.contactIds.has(l.contactId)?{...l,strengthLabel:"connector"}:n(l));rt([...a,...o])}catch(e){ot(e instanceof Error?e.message:"Network error")}finally{jt(!1)}}},[d,p,$,Te]),hs=e=>{st({});const n=go(e,null,Te);D({mode:"make",step:"pick",anchor:e,picked:null,activeSide:e?"to":"from",note:"",goals:Fn.map(a=>({...a})),selectedGoalId:null,editingGoalId:null,editingGoalDraft:"",sendMode:"gemphere",email1Subject:"",email1Body:"",email2Subject:"",email2Body:"",optInMode:n,singleOptInFirstParty:"from"}),qe(""),Q(null),at(null),hn.current=null,Pr()},ps=(e,n)=>{const a=ge(e),o=Kt(K(n),U(n)),l=`Would you be open to introducing me to ${o}?`,m=`Hi ${a},
2
3Hope you're doing well. I noticed you're connected to ${o} — I'd love an intro if you're open to it.
4
5I've drafted a short blurb below you can forward as-is, or edit however you like. Totally understand if the timing isn't right.
6
7Thanks either way.
8
9${(r==null?void 0:r.fullName)||"Me"}`,u=`Intro: ${(r==null?void 0:r.fullName)||"Me"} ↔ ${o}`,f=Yi(r==null?void 0:r.fullName,r==null?void 0:r.email);return{email1Subject:l,email1Body:m,email2Subject:u,email2Body:f}},Ar=i.useCallback(async e=>{if(!(!d||!p)){jt(!0),ot(null),rt([]);try{const n=await fo(e,d);rt(Do(n,p,e))}catch(n){ot(n instanceof Error?n.message:"Network error")}finally{jt(!1)}}},[d,p]),fs=e=>{st({}),D({mode:"request",step:"pick",anchor:e,picked:null,activeSide:"to",note:"",goals:Fn.map(n=>({...n})),selectedGoalId:null,editingGoalId:null,editingGoalDraft:"",sendMode:"gemphere",email1Subject:"",email1Body:"",email2Subject:"",email2Body:"",optInMode:"double",singleOptInFirstParty:"from"}),qe(""),Q(null),at(null),e.userId>0&&Ar(e.userId)},Rr=(e,n)=>{const a=(p&&we[p]||"").trim();st({});const o=ps(e,n);a&&(o.email2Body=a),D({mode:"request",step:"compose",anchor:e,picked:n,activeSide:"to",note:"",goals:Fn.map(l=>({...l})),selectedGoalId:null,editingGoalId:null,editingGoalDraft:"",sendMode:"gemphere",...o,optInMode:"double",singleOptInFirstParty:"from"}),qe(""),Q(null),at(null)};i.useCallback(async e=>{if(d)try{const n=await Ii(e.userId,d),a=n!=null&&n.data&&typeof n.data=="object"?n.data:n,o=a!=null&&a.user&&typeof a.user=="object"?a.user:a,l=a!=null&&a.founder&&typeof a.founder=="object"?a.founder:{},m=a!=null&&a.investor&&typeof a.investor=="object"?a.investor:{},u={...o,...l,...m},f=w=>{const L=u[w];if(L==null)return null;const R=(typeof L=="string"?L:String(L)).trim();return R&&R!=="Not provided"?R:null},g=Number(f("role"))||e.roleKind||0,x={fullname:f("fullname")||f("Fullname")||e.name,photo:f("profilePhoto")||f("ProfilePhoto")||f("photo")||e.photo||null,title:f("title")||f("Title"),role:g||0,linkedinUrl:f("linkedinProfile")||f("linkedinUrl")||f("linkedin_url"),email:f("email")||e.email||null,location:f("location")||f("city"),school:f("school")||f("education"),experience:f("experience"),companyName:f("companyName")||f("company"),companyOverview:f("companyOverview"),traction:f("traction"),superpower:f("superpower"),why:f("why"),sector:Bo(f("sectorIndustryFocus")||f("sector")||f("sectors"),_a),fundName:f("fundName")||f("fund"),checkSize:Bo(f("askInitialCheck")||f("checkSize")||f("check_size"),Ba),commonAdvice:f("commonAdvice"),whatThey:f("whatThey"),favPitchStyle:f("favPitchStyle")};Ee(w=>w&&w.anchor.userId===e.userId?{...w,profile:x,profileLoading:!1,profileError:null}:w)}catch(n){Ee(a=>a&&a.anchor.userId===e.userId?{...a,profileLoading:!1,profileError:n 
9instanceof Error?n.message:"Failed to load profile"}:a)}},[d,_a,Ba]),i.useCallback(async e=>{if(!(!d||!p))try{const n=await fo(e.userId,d),a=Do(n,p,e.userId);Ee(o=>o&&o.anchor.userId===e.userId?{...o,people:a,peopleLoading:!1,peopleError:null}:o)}catch(n){Ee(a=>a&&a.anchor.userId===e.userId?{...a,peopleLoading:!1,peopleError:n instanceof Error?n.message:"Failed to load network"}:a)}},[d,p]);const Fr=(e,n)=>{Ee({mode:n,anchor:e,profile:null,profileLoading:n==="request",profileError:null,people:[],peopleLoading:n==="request",peopleError:null,search:""})},mt=e=>Fr(e,"view"),Ot=()=>Ee(null),gs=i.useMemo(()=>{const e=[];for(const n of(k==null?void 0:k.people)??[])e.push(n);return{all:e}},[k==null?void 0:k.people]),ys=i.useMemo(()=>{if(!k)return[];const e=gs.all,n=k.search.trim().toLowerCase();return n?e.filter(a=>a.name.toLowerCase().includes(n)||(a.role||"").toLowerCase().includes(n)):[]},[k,gs]),Ur=e=>{if(!k)return;const n=ht(k.anchor);Ot(),Rr(n,e)},ee=()=>{D(null),Q(null),at(null),rt([]),ot(null),Na([]),va(0),it({}),Ct({}),st({})},ks=()=>{Q(null),D(e=>e&&{...e,step:"compose"})},bs=()=>{Q(null),D(e=>e&&{...e,step:"pick"})},_r=e=>{D(n=>{if(!n)return n;if(n.mode==="make"){if(n.activeSide==="from"){const m=n.picked&&n.picked.key===e.key?null:n.picked;return{...n,anchor:e,picked:m,activeSide:m?"from":"to"}}
9const l=n.anchor&&n.anchor.key===e.key?null:n.anchor;return{...n,picked:e,anchor:l,activeSide:l?"to":"from"}}if(!n.anchor)return n;const a=ps(n.anchor,e),o=(p&&we[p]||"").trim();return o&&(a.email2Body=o),{...n,picked:e,...a}})},Ns=i.useMemo(()=>{var o,l;const e=[],n=(s==null?void 0:s.mode)==="make"?s.activeSide==="from"?(o=s.picked)==null?void 0:o.key:(l=s.anchor)==null?void 0:l.key:void 0,a=[...ka,...ba];for(const m of a)n&&m.key===n||e.push(m);return{all:e}},[ka,ba,s==null?void 0:s.mode,s==null?void 0:s.activeSide,(js=s==null?void 0:s.picked)==null?void 0:js.key,(Is=s==null?void 0:s.anchor)==null?void 0:Is.key]),wn=(e,n,a)=>{const o=mr+1;va(o);const l=Ul(n,a,o);Na(m=>[l,...m]),D(m=>{if(!m)return m;const u={...m,activeSide:e};return m.mode==="make"?e==="from"?(u.anchor=l,m.picked&&m.picked.key===l.key&&(u.picked=null),u.activeSide=u.picked?"from":"to"):(u.picked=l,m.anchor&&m.anchor.key===l.key&&(u.anchor=null),u.activeSide=u.anchor?"to":"from"):u.picked=l,u})},U=e=>{if(!e)return null;const n=It[e.key];return n&&n.trim()?n.trim():e.email||null},K=e=>{if(!e)return"";const n=lt[e.key];return n&&n.trim()?n.trim():(e.rawName??e.name).trim()},ge=e=>Di(K(e),U(e)),jn=e=>{const n=K(e),a=U(e);return Oi(n,a)?Kt(n,a):"Add their name"},vs=i.useMemo(()=>s?Ns.all:[],[s,Ns]),xs=i.useMemo(()=>{const e=$e.trim().toLowerCase();return e?vs.filter(a=>[a.name,a.rawName,a.role,a.title,a.companyName,a.email].filter(Boolean).join(" ").toLowerCase().includes(e)).slice().sort((a,o)=>Bn({rawName:a.name,email:a.email??void 0,strengthLabel:a.strengthLabel??null},{rawName:o.name,email:o.email??void 0,strengthLabel:o.strengthLabel??null},F)):[]},[vs,$e,F]);i.useEffect(()=>{if(!s||s.mode!=="make"||!s.anchor||!s.picked)return;const e=`${s.anchor.key}:${s.picked.key}`;if(hn.current===e)return;hn.current=e;const n=Ci(s.anchor,s.picked,Te,Eo(s.anchor,F),Eo(s.picked,F)),a=go(s.anchor,s.picked,Te);D(o=>!o||o.mode!=="make"||!o.anchor||!o.picked||o.singleOptInFirstParty===n&&o.optInMode===a?o:{...o,singleOptInFirstParty:n,optInMode:a})},[s==null?void 0:s.mode,(Cs=s==null?void 0:s.anchor)==null?void 0:Cs.key,(Ss=s==null?void 0:s.picked)==null?void 0:Ss.key,(Ls=s==null?void 0:s.anchor)==null?void 0:Ls.roleKind,(Es=s==null?void 0:s.picked)==null?void 0:Es.roleKind,(Ts=s==null?void 0:s.anchor)==null?void 0:Ts.strengthLabel,(Ms=s==null?void 0:s.picked)==null?void 0:Ms.strengthLabel,(Ps=s==null?void 0:s.anchor)==null?void 0:Ps.userId,(As=s==null?void 0:s.picked)==null?void 0:As.userId,(Rs=s==null?void 0:s.anchor)==null?void 0:Rs.contactId,(Fs=s==null?void 0:s.picked)==null?void 0:Fs.contactId,F,Te]),i.useEffect(()=>{var o,l,m,u;if(!s||!d)return;const e=[];(o=s.anchor)!=null&&o.userId&&s.anchor.userId>0&&e.push(s.anchor.userId),(l=s.picked)!=null&&l.userId&&s.picked.userId>0&&e.push(s.picked.userId),p&&(s.mode==="request"&&e.push(p),s.mode==="make"&&(((m=s.anchor)==null?void 0:m.userId)===p&&e.push(p),((u=s.picked)==null?void 0:u.userId)===p&&e.push(p)));const n=Array.from(new Set(e));if(n.length===0)return;let a=!1;return(async()=>{const f={};await Promise.all(n.map(async g=>{try{const x=await Si(d,g);f[g]=(x||"").trim()}catch{f[g]=""}})),!a&&st(g=>({...g,...f}))})(),()=>{a=!0}},[s==null?void 0:s.mode,(Us=s==null?void 0:s.anchor)==null?void 0:Us.key,(_s=s==null?void 0:s.picked)==null?void 0:_s.key,(Bs=s==null?void 0:s.anchor)==null?void 0:Bs.userId,(Ds=s==null?void 0:s.picked)==null?void 0:Ds.userId,(Os=s==null?void 0:s.anchor)==null?void 0:Os.isGem,($s=s==null?void 0:s.picked)==null?void 0:$s.isGem,d,p]),i.useEffect(()=>{if(!s||s.mode!=="make"||!s.anchor||!s.picked)return;const e=K(s.anchor),n=K(s.picked),a=U(s.anchor),o=U(s.picked),l=Kt(e,a),m=Kt(n,o),u=s.note.trim()||"something super interesting",f=(s.picked.userId>0&&we[s.picked.userId]||"").trim(),g=(s.anchor.userId>0&&we[s.anchor.userId]||"").trim(),x=`Want me to intro you to ${m}?`,w=yo(n,o,f,u,"working_on"),L=`Want me to intro you to ${l}?`,Y=yo(e,a,g,u,"click");D(R=>!R||R.mode!=="make"||!R.anchor||!R.picked?R:{...R,email1Subject:x,email1Body:w,email2Subject:L,email2Body:Y})},[s==null?void 0:s.mode,(qs=s==null?void 0:s.anchor)==null?void 0:qs.key,(Ws=s==null?void 0:s.picked)==null?void 0:Ws.key,s==null?void 0:s.note,r==null?void 0:r.fullName,lt,It,we[((zs=s==null?void 0:s.anchor)==null?void 0:zs.userId)||0],we[((Gs=s==null?void 0:s.picked)==null?void 0:Gs.userId)||0]]),i.useEffect(()=>{if(!s||s.mode!=="request"||!s.picked)return;const e=(p&&we[p]||"").trim();e&&D(n=>!n||n.mode!=="request"||!n.picked||!Li(n.email2Body,r==null?void 0:r.fullName,r==null?void 0:r.email)?n:{...n,email2Body:e})},[s==null?void 0:s.mode,(Ks=s==null?void 0:s.picked)==null?void 0:Ks.key,p,r==null?void 0:r.fullName,we[p||0]]);const ws=async()=>
9{if(!s||!d||!p)return;const{mode:e,anchor:n,picked:a,note:o}=s;if(!a){Q("Pick the 'to' person first.");return}if(e==="make"&&!n){Q("Pick the 'from' person first.");return}const l=a.isGem&&a.userId>0,m=U(a),u=e==="make"?!!(n&&n.isGem&&n.userId>0):!0,f=e==="make"?U(n):null;if(e==="make"&&!u&&!f){Q(`${n.name} doesn't have an email yet — add one in the warning above to send the intro.`);return}if(!l&&!m){Q(`${a.name} doesn't have an email yet — add one in the warning above to send the intro.`);return}if(e==="make"&&!u&&!vo(K(n),f)){Q(`Add a name for ${n.name} above — intro emails never greet someone by their email address.`);return}if(!l&&!vo(K(a),m)){Q(`Add a name for ${a.name} above — intro emails never greet someone by their email address.`);return}fa(!0),Q(null);try{const g={};if(e==="make"){const L=n;u?g.fromUserID=L.userId:(g.fromUserID=p,f&&(g.fromEmail=f),g.fromName=K(L)),l?g.toUserID=a.userId:(g.toUserID=0,m&&(g.toEmail=m),g.toName=K(a)),g.note=o.trim()||"I think you two should connect!",s.email1Body.trim()&&(g.connectorMessage=s.email1Body.trim()),s.email2Body.trim()&&(g.blurb=s.email2Body.trim()),s.email1Subject.trim()&&(g.connectorSubject=s.email1Subject.trim()),s.email2Subject.trim()&&(g.blurbSubject=s.email2Subject.trim())}else g.fromUserID=p,g.connectorUserID=n.userId,g.toUserID=l?a.userId:0,l||(m&&(g.toEmail=m),g.toName=K(a)),g.note=s.email1Body.trim()||"I'd love an intro!",g.connectorMessage=s.email1Body.trim(),g.blurb=s.email2Body.trim(),s.email1Subject.trim()&&(g.connectorSubject=s.email1Subject.trim()),s.email2Subject.trim()&&(g.blurbSubject=s.email2Subject.trim());e==="make"&&Object.assign(g,$i(s.optInMode,s.singleOptInFirstParty));const x=await qi(g,d),w=await x.json().catch(()=>null);if(!x.ok||(w==null?void 0:w.success)===!1||w!=null&&w.error){const L=w&&(w.message||w.error)||`Request failed (${x.status})`;Q(String(L))}else{const L=s.optInMode,Y=s.singleOptInFirstParty==="from"?a.name:n.name,R=e==="make"?L==="disabled"?`Connected ${n.name} and ${a.name}.`:L==="single"?`Intro started between ${n.name} and ${a.name} (single opt-in — waiting on ${Y}).`:`Intro started between ${n.name} and ${a.name}.`:`Asked ${n.name} to intro you to ${a.name}.`;at(R),setTimeout(()=>{ee(),j(R),setTimeout(()=>j(null),4e3)},900)}}catch(g){Q(g instanceof Error?g.message:"Network error")}finally{fa(!1)}},Br=i.useCallback(e=>{const n=(e.email||"").trim().toLowerCase(),a=n?F[n]:null;return Ei(Cl(a),e.strengthLabel??null)},[F]),In=e=>{var m,u,f;const n=(s==null?void 0:s.mode)==="make",a=n?e==="from"?(m=s==null?void 0:s.anchor)==null?void 0:m.key:(u=s==null?void 0:s.picked)==null?void 0:u.key:(f=s==null?void 0:s.picked)==null?void 0:f.key,l=!n||(s==null?void 0:s.activeSide)===e?$e.trim():"";return dr?t.jsx(Ie,{variant:"section",message:"Loading your network…"}):ya?t.jsx("div",{className:"intro-picker-empty",style:{color:"#9a3a2a"},children:ya}):l?xs.length===0?t.jsx("div",{className:"intro-picker-empty",children:"No matches — try a different search."}):t.jsx("div",{className:"intro-picker-list",role:"radiogroup","aria-label":"Pick a person",children:xs.map(g=>{const x=a===g.key,w=Br(g),{titleLine:L,emailLine:Y}=Wi(g);return t.jsxs("button",{type:"button",role:"radio","aria-checked":x,className:`intro-pick-row${x?" picked":""}`,onClick:()=>{n&&D(R=>R&&{...R,activeSide:e}),_r(g)},children:[t.jsx("span",{className:"intro-pick-radio","aria-hidden":"true"}),t.jsx("span",{className:"intro-pick-av intro-pick-av--row",children:g.photo?t.jsx("img",{src:g.photo,alt:""}):ye(g.name)}),t.jsx("span",{className:"intro-pick-name",children:g.name}),t.jsx("span",{className:"intro-pick-role",children:L||Y||""}),t.jsx("span",{className:"intro-pick-tier",children:w?qo(w):""})]},g.key)})}):t.jsx("div",{className:"intro-picker-empty",children:"Start typing a name to see who you can pick."})},Cn=e=>{const n=e.sourceKind==="connector",a=e.userId<0&&!n,o=ie(e),l=(o==null?void 0:o.id)??0,m=l||(a?e.contactId??Math.abs(e.userId):0),u=a&&Ho.has(m),f=a&&!u,g=!!e.email,x=a&&On===m,w=l?Ze===l:sn===e.connectionID,L=o?Re(o.fullName,o.email):e.name,Y=((o==null?void 0:o.title)||e.title||"").trim(),R=((o==null?void 0:o.companyName)||e.companyName||"").trim(),$t=(e.role||W(e.roleKind)).trim(),qt=Y||(!Y&&!R?$t:""),Wt=R,zt=x?"Sending...":u?"Invited":"Invite",ut=g?u?"Already invited":"Invite this contact to Gemphere":"Add their email in the invite popup",Gt=()=>{jr(e)},We=()=>{Cr(e)},O=Oo(Be,e,o),le=(o==null?void 0:o.strengthLabel)==="connector"||e.strengthLabel==="connector"||(O==null?void 0:O.status)==="active"||(O==null?void 0:O.status)==="pending"&&O.direction==="outgoing",mo=(O==null?void 0:O.status)==="pending"&&O.direction==="outgoing",uo=(O==null?void 0:O.status)==="active"||(O==null?void 0:O.status)==="pending"&&O.direction==="outgoing",$r=uo?mo?"Connector invite already sent":"Already connected as a connector":"Send a connector invite — they'll need to accept before sharing targets",qr=l>0&&qn===l||e.userId>0&&qn===e.userId,Sn=Pe(e),ho=!zi(Sn,"strong"),Wr=l>0&&zn===l||e.userId>0&&zn===e.userId;
9return{isImportedContact:a,contactId:m,canInvite:f,sending:x,archiving:w,displayName:L,roleText:qt,companyDisplay:Wt,inviteLabel:zt,inviteTitle:ut,handleEditProfile:Gt,handleArchiveProfile:We,isConnectorMarked:le,connectorPending:mo,connectorInviteDisabled:uo,connectorInviteTitle:$r,connectorMarkBusy:qr,rowTier:Sn,canMarkStrong:ho,markStrongBusy:Wr,showMarkStrongAction:ho&&Sn===null}},Dr=e=>{const{displayName:n,roleText:a,companyDisplay:o,rowTier:l}=Cn(e),m=[a,o].filter(Boolean).join(" · ");return t.jsxs("div",{className:"mnet-row",role:"button",tabIndex:0,onClick:()=>mt(e),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),mt(e))},children:[e.photo?t.jsx("img",{src:e.photo,alt:"",className:"mnet-row-av"}):t.jsx("div",{className:"mnet-row-av",children:ye(n)}),t.jsxs("div",{className:"mnet-row-main",children:[t.jsx("div",{className:"mnet-row-name",children:n}),m?t.jsx("div",{className:"mnet-row-meta",children:m}):null]}),t.jsx("i",{role:"img",className:l?`net-dot net-dot--${Lo[l]} mnet-row-dot`:"mnet-row-dot mnet-row-dot--none","aria-label":l?Ht[l]:"Not rated"}),t.jsx("button",{type:"button",className:"mnet-row-intro","aria-label":`Start an intro with ${n}`,"aria-haspopup":"dialog",onPointerDown:u=>u.stopPropagation(),onClick:u=>{u.stopPropagation(),Ue({row:e,mode:"intro"})},children:"Intro"}),t.jsx("button",{type:"button",className:"mnet-row-more","aria-label":`More actions for ${n}`,"aria-haspopup":"dialog",onPointerDown:u=>u.stopPropagation(),onClick:u=>{u.stopPropagation(),Ue({row:e,mode:"more"})},children:"⋯"})]},e.connectionID)},Or=e=>{if(Se)return Dr(e);const{isImportedContact:n,contactId:a,canInvite:o,sending:l,archiving:m,displayName:u,roleText:f,companyDisplay:g,inviteLabel:x,inviteTitle:w,handleEditProfile:L,handleArchiveProfile:Y,isConnectorMarked:R,connectorPending:$t,connectorInviteDisabled:qt,connectorInviteTitle:Wt,connectorMarkBusy:zt,rowTier:ut,canMarkStrong:Gt,markStrongBusy:We,showMarkStrongAction:O}=Cn(e);return t.jsxs("div",{className:"network-row",role:"button",tabIndex:0,onClick:()=>mt(e),onKeyDown:le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),mt(e))},children:[e.photo?t.jsx("img",{src:e.photo,alt:"",className:"network-row-avatar network-row-avatar-neutral no-border",style:{objectFit:"cover"}}):t.jsx("div",{className:"network-row-avatar network-row-avatar-neutral no-border",children:ye(u)}),t.jsxs("div",{className:"network-row-person",children:[t.jsx("div",{className:"network-row-name-line",children:t.jsx("span",{className:"network-row-name-text",children:u})}),f?t.jsx("span",{className:"network-row-role",children:f}):null]}),t.jsx("div",{className:"network-row-company-col",children:g}),t.jsx("div",{className:"network-row-strength",children:ut?t.jsxs(t.Fragment,{children:[t.jsx("i",{className:`net-dot net-dot--${Lo[ut]}`}),t.jsx("span",{children:Ht[ut]})]}):t.jsx("span",{className:"network-row-strength-none",children:"Not rated"})}),t.jsxs("div",{className:`network-row-actions${O?" has-strong":""}`,children:[t.jsx("button",{type:"button",className:"network-row-action network-row-action-text",onClick:le=>{le.stopPropagation(),hs(ht(e))},children:"Make an intro"}),t.jsx("button",{type:"button",className:"network-row-action network-row-action-pill",onClick:le=>{if(le.stopPropagation(),n){Ha(a,e.name,e.email);return}fs(ht(e))},children:"Request an intro"}),O?t.jsx("button",{type:"button",className:"network-row-action network-row-action-pill network-row-action-strong",disabled:We,onClick:le=>{le.stopPropagation(),At(e)},children:We?"Updating…":"Mark as strong"}):null,t.jsx($o,{className:"nc-card-desktop-menu network-row-menu",onInvite:n?()=>kn(a,e.name,e.email):void 0,inviteLabel:x,inviteDisabled:n?!o||l||m:!1,inviteTitle:w,isConnector:R,connectorPending:$t,connectorInviteDisabled:qt,connectorInviteTitle:Wt,connectorMarkBusy:zt,onMarkConnector:()=>bn(e),onUnmarkConnector:()=>void Nn(e),onMarkStrong:Gt&&!O?()=>void At(e):void 0,markStrongBusy:We,onEdit:L,onArchive:Y,archiving:m}),t.jsx($o,{className:"nc-card-mobile-menu network-row-menu",onInvite:n?()=>kn(a,e.name,e.email):void 0,inviteLabel:x,inviteDisabled:n?!o||l||m:!1,inviteTitle:w,isConnector:R,connectorPending:$t,connectorInviteDisabled:qt,connectorInviteTitle:Wt,connectorMarkBusy:zt,onMarkConnector:()=>bn(e),onUnmarkConnector:()=>void Nn(e),onMarkStrong:Gt&&!O?()=>void At(e):void 0,markStrongBusy:We,onEdit:L,onArchive:Y,archiving:m})]})]},e.connectionID)};return t.jsxs("div",{className:"page active page-network",children:[t.jsxs("div",{className:"top-header network-page-header",children:[t.jsxs("div",{className:"header-left",children:[t.jsx("div",{className:"page-h",children:"My network"}),t.jsx("div",{className:"page-sub",children:"People you know directly, sorted by how well you know them."})]}),t.jsxs("div",{className:"network-header-stat","aria-label":b?"Loading count of people you know":`${Ut.toLocaleStr
9ing("en-US")} people you know`,children:[t.jsx("div",{className:"network-header-stat-num",children:b?"—":Ut.toLocaleString("en-US")}),t.jsx("div",{className:"network-header-stat-lbl",children:"People you know"})]})]}),Se&&Ko.canSeeTeam?t.jsxs("button",{type:"button",className:"net-teams-entry",onClick:()=>Yo("/team"),children:[t.jsx("span",{className:"net-teams-entry-icon","aria-hidden":!0,children:t.jsx(Ti,{size:17,strokeWidth:1.75})}),t.jsxs("span",{className:"net-teams-entry-body",children:[t.jsx("span",{className:"net-teams-entry-title",children:"Teams"}),t.jsx("span",{className:"net-teams-entry-sub",children:"Your workspace and its shared network"})]}),t.jsx("span",{className:"net-teams-entry-caret","aria-hidden":!0,children:t.jsx(fl,{size:16,strokeWidth:2})})]}):null,z&&t.jsxs("div",{className:"info-banner",style:{background:"#fdecea",borderColor:"#f3c3bb",color:"#9a3a2a"},children:[t.jsx("strong",{children:"Couldn't load your connections:"})," ",z]}),Nl,t.jsxs("div",{className:"filters-row network-filters-tabs",children:[t.jsxs("div",{className:"filters network-tab-filters",children:[t.jsxs("div",{className:"net-people-tab",ref:Jt,children:[t.jsxs("span",{className:`filt${S==="all"?" active":""}`,onClick:()=>me("all"),style:{cursor:"pointer"},children:["People",b?null:t.jsx("span",{className:"cnt",children:Ut.toLocaleString("en-US")})]}),S==="all"?t.jsx("button",{type:"button",className:`net-strength-caret${N!=="all"?" filtered":""}${Ne?" open":""}`,"aria-label":"Filter by relationship strength","aria-haspopup":"menu","aria-expanded":Ne,onClick:e=>{e.stopPropagation(),He(n=>!n)},children:t.jsx(Mi,{size:13,strokeWidth:2})}):null,S==="all"&&Ne?t.jsx("div",{className:"net-strength-menu",role:"menu",children:[["all","All",null,Ut],["very_strong","Very strong","vs",se.very_strong],["strong","Strong","s",se.strong],["solid","Solid","so",se.solid],["light","Light","l",se.light],["not_rated","Not rated","u",se.not_rated]].map(([e,n,a,o])=>t.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":N===e,className:`net-strength-menu-item${N===e?" active":""}`,onClick:()=>{J(e),He(!1)},children:[t.jsxs("span",{className:"net-strength-menu-label",children:[a?t.jsx("i",{className:`net-dot net-dot--${a}`}):null,n]}),t.jsx("span",{className:"net-strength-menu-count",children:o.toLocaleString("en-US")})]},e))}):null]}),t.jsx("span",{className:`filt${S==="add"?" active":""}`,onClick:()=>me("add"),style:{cursor:"pointer"},children:"Grow your network"}),t.jsxs("span",{className:`filt${S==="requests"?" active":""}`,onClick:()=>me("requests"),style:{cursor:"pointer"},children:["Requests",cn&&us?t.jsx("span",{className:"cnt",children:us.toLocaleString("en-US")}):null]})]}),S==="all"?t.jsxs("label",{className:"net-tab-search",children:[t.jsx("span",{"aria-hidden":!0,children:"⌕"}),t.jsx("input",{type:"text",placeholder:"Search your network",value:E,onChange:e=>H(e.target.value)})]}):null]}),S==="all"&&se.not_rated>0&&Dt.length>0&&N!=="not_rated"?t.jsxs("div",{className:"net-notice",children:[t.jsxs("div",{className:"net-notice-text",children:[t.jsxs("b",{children:[se.not_rated.toLocaleString("en-US")," people aren't rated yet."]})," ","We haven't seen enough email or calendar activity to judge how well you know them."]}),t.jsx("button",{type:"button",className:"net-notice-btn",onClick:Mr,children:"Rate connections"})]}):null,S==="add"?t.jsx(yl,{inviteByEmailOpen:rr,inviteByEmailValue:bt,onInviteByEmailOpen:()=>dn(!0),onInviteByEmailChange:mn,onInviteByEmailCancel:()=>{dn(!1),mn("")},onInviteByEmailSubmit:()=>{bt.trim()&&Lr()},invitedList:Jo,invitedLoading:on,invitedError:tr,onAddConnector:vr,onInviteTeammate:xr}):S==="requests"?t.jsxs("div",{className:"network-side-panel",children:[t.jsxs("div",{className:"network-side-panel-head",children:[t.jsx("div",{className:"network-side-panel-kicker",children:"Inbox"}),t.jsx("h2",{className:"network-side-panel-title",children:"Follow requests"}),t.jsx("p",{className:"network-side-panel-desc",children:"People who want to connect with you on Gemphere — accept to add them to your network."})]}),ln?t.jsx(Ie,{variant:"section",message:"Loading follow requests…"}):na?t.jsxs("div",{className:"network-side-empty network-side-empty--error",children:["Couldn't load follow requests: ",na]}):ms.length===0?t.jsx("div",{className:"network-side-empty",children:M?"No requests match your search.":"You're all caught up — new follow requests will show up here."}):t.jsx("div",{className:"network-side-list",children:ms.map(e=>{var g,x,w;const n=((g=e==null?void 0:e.user)==null?void 0:g.user)||{},a=((x=e==null?void 0:e.user)==null?void 0:x.founder)||null,o=((w=e==null?void 0:e.user)==null?void 0:w.investor)||null,l=Xt(String(n.fullname||""),n.email||null),m=n.profilePhoto||null,u=a!=null&&a.companyName?[a.title,a.companyName].filter(
9Boolean).join(" · "):o!=null&&o.fundName?[o.title,o.fundName].filter(Boolean).join(" · "):W(Number(n.role)||0),f=or===e.connectionID;return t.jsxs("div",{className:"network-side-row",children:[t.jsx("div",{className:"network-side-row-avatar",children:m?t.jsx("img",{src:m,alt:""}):ye(l)}),t.jsxs("div",{className:"network-side-row-main",children:[t.jsx("div",{className:"network-side-row-name",children:l}),u?t.jsx("div",{className:"network-side-row-meta",children:u}):null]}),t.jsxs("div",{className:"network-side-row-actions",children:[t.jsx("button",{type:"button",className:"network-side-action network-side-action--danger",onClick:()=>za(e.connectionID,!1),disabled:f,children:f?"…":"Decline"}),t.jsx("button",{type:"button",className:"network-side-action network-side-action--primary",onClick:()=>za(e.connectionID,!0),disabled:f,children:f?"…":"Accept"})]})]},e.connectionID)})})]}):b?t.jsx(Ie,{variant:"page",message:"Loading your network…"}):ae.length===0&&en?t.jsx(Ie,{variant:"section",message:"Loading imported contacts…"}):ae.length===0?t.jsx("div",{className:"network-empty",children:"No connections yet"}):Ae.length===0||xn.length===0?t.jsx("div",{className:"network-empty",children:"No one matches that search"}):t.jsxs(t.Fragment,{children:[xn.map(e=>{const n=e.tier==="very_strong"?se.very_strong:e.tier==="strong"?se.strong:e.tier==="solid"?se.solid:e.tier==="light"?se.light:e.tier==="other"?se.not_rated:e.rows.length;return t.jsxs("div",{className:"network-tier-group",id:e.tier==="other"?Ao:void 0,children:[t.jsxs("div",{className:"network-tier-head",children:[t.jsx("div",{className:"network-tier-title",children:e.label==="Very Strong"?"Very strong":e.label}),t.jsx("div",{className:"network-tier-count",children:n>e.rows.length?`Showing ${e.rows.length.toLocaleString("en-US")} of ${n.toLocaleString("en-US")}`:e.rows.length.toLocaleString("en-US")}),t.jsx("div",{className:"network-tier-line","aria-hidden":!0})]}),t.jsx("div",{className:"network-list",children:e.rows.map(Or)})]},e.tier)}),Tr?t.jsx("div",{className:"network-load-more",children:t.jsx("button",{type:"button",className:"network-load-more-btn","aria-label":`Load more contacts (${Bt.length} of ${Ae.length} shown)`,onClick:()=>te(e=>Math.min(e+vl,Ae.length)),children:"Load more contacts"})}):null]}),Se&&Ve?(()=>{const e=Ve.row,n=Cn(e),a=()=>Ue(null),o=Ke(n.displayName),l=[n.roleText,n.companyDisplay].filter(Boolean).join(" · "),m=()=>{a(),hs(ht(e))},u=()=>{if(a(),n.isImportedContact){Ha(n.contactId,e.name,e.email);return}fs(ht(e))},f=t.jsx("span",{className:"mnet-chain-av mnet-chain-av--them",children:e.photo?t.jsx("img",{src:e.photo,alt:""}):ye(n.displayName)}),g=t.jsx("span",{className:"mnet-chain-av mnet-chain-av--you",children:Z?t.jsx("img",{src:Z,alt:""}):y});return Ve.mode==="intro"?t.jsx("div",{className:"mnet-sheet-overlay",role:"presentation",onClick:a,children:t.jsxs("div",{className:"mnet-sheet mnet-sheet--intro",role:"dialog","aria-modal":"true","aria-label":`Start an intro with ${n.displayName}`,onClick:x=>x.stopPropagation(),children:[t.jsx("span",{className:"mnet-sheet-grab","aria-hidden":!0}),t.jsxs("div",{className:"mnet-intro-nav",children:[t.jsx("button",{type:"button",className:"mnet-intro-back",onClick:a,"aria-label":"Back",children:"‹"}),t.jsxs("div",{children:[t.jsxs("div",{className:"mnet-sheet-eyebrow",children:["With ",o]}),t.jsx("div",{className:"mnet-sheet-title",children:"Start an intro"})]})]}),t.jsxs("div",{className:"mnet-intro-body",children:[t.jsxs("div",{className:"mnet-intro-person",children:[e.photo?t.jsx("img",{src:e.photo,alt:"",className:"mnet-row-av"}):t.jsx("div",{className:"mnet-row-av",children:ye(n.displayName)}),t.jsxs("div",{className:"mnet-row-main",children:[t.jsx("div",{className:"mnet-row-name",children:n.displayName}),t.jsx("div",{className:"mnet-row-meta",children:[l,n.rowTier?Ht[n.rowTier].toLowerCase():"not rated"].filter(Boolean).join(" · ")})]})]}),t.jsxs("button",{type:"button",className:"mnet-intro-card",onClick:m,children:[t.jsxs("span",{className:"mnet-chain","aria-hidden":!0,children:[f,t.jsx("span",{className:"mnet-chain-arm"}),g,t.jsx("span",{className:"mnet-chain-arm"}),t.jsx("span",{className:"mnet-chain-av mnet-chain-av--open",children:"?"})]}),t.jsx("span",{className:"mnet-intro-card-eyebrow",children:"Make an intro"}),t.jsxs("span",{className:"mnet-intro-card-title",children:["Introduce ",o," to someone"]}),t.jsx("span",{className:"mnet-intro-card-note",children:"You're the one in the middle. Pick who they should meet, and Gem drafts the emails and asks both of them before anything sends."})]}),t.jsxs("button",{type:"button",className:"mnet-intro-card",onClick:u,children:[t.jsxs("span",{className:"mnet-chain","aria-hidden":!0,
9children:[g,t.jsx("span",{className:"mnet-chain-arm"}),f,t.jsx("span",{className:"mnet-chain-arm"}),t.jsx("span",{className:"mnet-chain-av mnet-chain-av--target",children:"?"})]}),t.jsx("span",{className:"mnet-intro-card-eyebrow",children:"Request an intro"}),t.jsxs("span",{className:"mnet-intro-card-title",children:["Ask ",o," for an intro"]}),t.jsx("span",{className:"mnet-intro-card-note",children:"They're the connector. Pick someone they know, and Gem asks them to forward your blurb — nothing goes out until they say yes."})]})]})]})}):t.jsx("div",{className:"mnet-sheet-overlay",role:"presentation",onClick:a,children:t.jsxs("div",{className:"mnet-sheet",role:"dialog","aria-modal":"true","aria-label":n.displayName,onClick:x=>x.stopPropagation(),children:[t.jsx("span",{className:"mnet-sheet-grab","aria-hidden":!0}),t.jsxs("div",{className:"mnet-sheet-head",children:[t.jsx("div",{className:"mnet-sheet-eyebrow",children:n.rowTier?Ht[n.rowTier]:"Not rated"}),t.jsx("div",{className:"mnet-sheet-title",children:n.displayName}),l?t.jsx("div",{className:"mnet-sheet-sub",children:l}):null]}),n.canMarkStrong?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"mnet-sheet-sec",children:"How well you know them"}),t.jsx("div",{className:"mnet-sheet-group",children:t.jsx("button",{type:"button",className:"mnet-sheet-item",disabled:n.markStrongBusy,onClick:()=>{At(e),a()},children:t.jsxs("span",{className:"mnet-sheet-item-main",children:[t.jsx("span",{className:"mnet-sheet-item-name",children:n.markStrongBusy?"Updating…":"Mark as strong"}),t.jsx("span",{className:"mnet-sheet-item-desc",children:"Tell Gem this is someone you actually know well"})]})})})]}):null,t.jsx("div",{className:"mnet-sheet-sec",children:"Bring them in"}),t.jsxs("div",{className:"mnet-sheet-group",children:[n.isImportedContact?t.jsx("button",{type:"button",className:"mnet-sheet-item",disabled:!n.canInvite||n.sending||n.archiving,title:n.inviteTitle,onClick:()=>{a(),kn(n.contactId,e.name,e.email)},children:t.jsxs("span",{className:"mnet-sheet-item-main",children:[t.jsx("span",{className:"mnet-sheet-item-name",children:n.inviteLabel}),t.jsx("span",{className:"mnet-sheet-item-desc",children:"Send them Gemphere. Their network joins the paths you can reach."})]})}):null,n.isConnectorMarked?t.jsx("button",{type:"button",className:"mnet-sheet-item",disabled:n.connectorMarkBusy,onClick:()=>{a(),Nn(e)},children:t.jsxs("span",{className:"mnet-sheet-item-main",children:[t.jsx("span",{className:"mnet-sheet-item-name",children:n.connectorMarkBusy?"Updating…":n.connectorPending?"Cancel connector invite":"Remove connector"}),t.jsx("span",{className:"mnet-sheet-item-desc",children:n.connectorPending?"Withdraw the connector invite you sent":"Stop sharing path-matched targets with them"})]})}):t.jsx("button",{type:"button",className:"mnet-sheet-item",disabled:n.connectorMarkBusy||n.connectorInviteDisabled,title:n.connectorInviteTitle,onClick:()=>{a(),bn(e)},children:t.jsxs("span",{className:"mnet-sheet-item-main",children:[t.jsx("span",{className:"mnet-sheet-item-name",children:n.connectorMarkBusy?"Updating…":"Invite as connector"}),t.jsx("span",{className:"mnet-sheet-item-desc",children:"They stay on their own network and pass intros along"})]})})]}),t.jsx("div",{className:"mnet-sheet-sec",children:"Manage"}),t.jsxs("div",{className:"mnet-sheet-group",children:[t.jsx("button",{type:"button",className:"mnet-sheet-item",onClick:()=>{a(),mt(e)},children:t.jsxs("span",{className:"mnet-sheet-item-main",children:[t.jsx("span",{className:"mnet-sheet-item-name",children:"View profile"}),t.jsx("span",{className:"mnet-sheet-item-desc",children:"Meetings, shared contacts and how you know them"})]})}),t.jsx("button",{type:"button",className:"mnet-sheet-item",disabled:n.archiving,onClick:()=>{a(),n.handleEditProfile()},children:t.jsxs("span",{className:"mnet-sheet-item-main",children:[t.jsx("span",{className:"mnet-sheet-item-name",children:"Edit profile"}),t.jsx("span",{className:"mnet-sheet-item-desc",children:"Fix the name, title, company or email on file"})]})}),t.jsx("button",{type:"button",className:"mnet-sheet-item mnet-sheet-item--danger",disabled:n.archiving,onClick:()=>{a(),n.handleArchiveProfile()},children:t.jsxs("span",{className:"mnet-sheet-item-main",children:[t.jsx("span",{className:"mnet-sheet-item-name",children:n.archiving?"Archiv
9ing…":"Archive"}),t.jsx("span",{className:"mnet-sheet-item-desc",children:"Hide them from your lists and stop suggesting them"})]})})]}),t.jsx("button",{type:"button",className:"mnet-sheet-cancel",onClick:a,children:"Close"})]})})})():null,s&&s.mode==="make"&&s.step==="pick"&&t.jsx("div",{className:"modal-overlay open request-intro-portal",onClick:ee,role:"presentation",children:t.jsxs("div",{className:"modal intro-picker",onClick:e=>e.stopPropagation(),children:[t.jsxs("div",{className:"intro-picker-head",children:[t.jsxs("div",{className:"intro-picker-kicker",children:[t.jsx("span",{children:"Step 1 of 2 · Who meets who"}),t.jsx("span",{className:"intro-picker-kicker-note",children:"Double opt-in · Nothing sends yet"})]}),t.jsx("button",{className:"mod-close intro-picker-close",onClick:ee,"aria-label":"Close",children:"×"}),t.jsx("h2",{className:"intro-picker-title",children:s.anchor?`Introduce ${s.anchor.name} to someone.`:"Introduce two people in your network."}),t.jsxs("div",{className:"intro-picker-chain",children:[t.jsx(Ye,{name:((Ys=s.anchor)==null?void 0:Ys.name)||"Person A",photo:(Hs=s.anchor)==null?void 0:Hs.photo,label:"Person A",tone:"asker",userId:(Vs=s.anchor)==null?void 0:Vs.userId,title:V(s.anchor,W).title,company:V(s.anchor,W).company}),t.jsx("span",{className:"intro-pick-link","aria-hidden":"true"}),t.jsx(Ye,{name:(r==null?void 0:r.fullName)||"You",photo:Z,label:"Connector",tone:"connector",userId:p,title:oe,company:ne}),t.jsx("span",{className:"intro-pick-link","aria-hidden":"true"}),t.jsx(Ye,{name:((Qs=s.picked)==null?void 0:Qs.name)||"Person B",photo:(Zs=s.picked)==null?void 0:Zs.photo,label:"Person B",tone:"target",userId:(Xs=s.picked)==null?void 0:Xs.userId,title:V(s.picked,W).title,company:V(s.picked,W).company})]})]}),t.jsxs("div",{className:"intro-picker-body",children:[!s.anchor&&t.jsxs("div",{className:"intro-picker-field",children:[t.jsx("div",{className:"intro-picker-lede",children:"Person A — who you're introducing"}),t.jsx("div",{className:"intro-picker-search",children:t.jsx(En,{value:s.activeSide==="from"?$e:"",onFocus:()=>D(e=>e&&{...e,activeSide:"from"}),onChange:e=>{D(n=>n&&{...n,activeSide:"from"}),qe(e)},onAdd:({name:e,email:n})=>wn("from",e,n)})}),In("from")]}),t.jsxs("div",{className:"intro-picker-field",children:[t.jsx("div",{className:"intro-picker-lede",children:s.anchor?`Who should ${ge(s.anchor)} meet?`:"Person B — who they should meet"}),t.jsx("div",{className:"intro-picker-search",children:t.jsx(En,{value:s.activeSide==="to"?$e:"",onFocus:()=>D(e=>e&&{...e,activeSide:"to"}),onChange:e=>{D(n=>n&&{...n,activeSide:"to"}),qe(e)},onAdd:({name:e,email:n})=>wn("to",e,n)})}),In("to")]})]}),t.jsxs("div",{className:"intro-picker-foot",children:[t.jsxs("button",{type:"button",className:"intro-picker-go",disabled:!s.anchor||!s.picked,onClick:ks,children:["Draft the emails",t.jsx("span",{"aria-hidden":"true",children:" →"})]}),t.jsx("span",{className:"intro-picker-note",children:"Nothing sends yet — you will see every email first."}),t.jsx("button",{type:"button",className:"intro-picker-cancel",onClick:ee,children:"Cancel"})]})]})}),s&&s.mode==="make"&&s.step==="compose"&&t.jsx("div",{className:"modal-overlay open request-intro-portal",onClick:ee,role:"presentation",children:t.jsxs("div",{className:"modal req-modal req-modal--wide make-intro-modal mynet-intro-sheet",onClick:e=>e.stopPropagation(),children:[t.jsxs("div",{className:"mynet-sheet-top",children:[t.jsx("div",{className:"modal-head",children:t.jsxs("div",{children:[t.jsxs("div",{className:"req-step-kicker",children:[t.jsx("span",{children:"Step 2 of 2 · What Gem sends"}),t.jsx("span",{className:"req-step-kicker-note",children:s.optInMode==="disabled"?"Nothing sends yet":s.optInMode==="single"?"Single opt-in · Nothing sends yet":"Double opt-in · Nothing sends yet"})]}),t.jsx("div",{className:"mod-title",children:s.anchor&&s.picked?`Intro ${s.anchor.name} to ${s.picked.name}.`:"Make an intro."}),t.jsx("div",{className:"mod-sub",children:"Read every email before anything sends. Only the blurbs are yours to edit."})]})}),t.jsxs(ko,{children:[t.jsx(ze,{name:((Js=s.anchor)==null?void 0:Js.name)||"Person A",photo:(eo=s.anchor)==null?void 0:eo.photo,role:V(s.anchor,W).title,company:V(s.anchor,W).company,kindLabel:"Person A",badge:"target",badgeLabel:"Person A",avatarTone:"green",compactName:!1}),t.jsx(Yt,{}),t.jsx(ze,{name:(r==null?void 0:r.fullName)||"You",photo:Z,role:oe,company:ne,kindLabel:"Connector",badge:"you",badgeLabel:"Connector",avatarTone:"green",compactName:!1}),t.jsx(Yt,{}),t.jsx(ze,{name:((to=s.picked)==null?void 0:to.name)||"Person B",photo:(no=s.picked)==null?void 0:no.photo,role:V(s.picked,W).title,company:V(s.picked,W).company,kindLabel:"Person B",badge:"target",badgeLabel:"Person B",avatarTone:"green",compactName:!1})]}),t.jsx("button",{className:"mod-close mynet-sheet-close",onClick:ee,"aria-label":"Close",children:"×"})]}),t.jsxs("div",{className:"req-body",children:[s.anchor&&Tn(s.anchor,U(s.anchor))&&t.jsx(Mn,{personEmail
9:U(s.anchor),value:lt[s.anchor.key]||"",onChange:e=>Ct(n=>({...n,[s.anchor.key]:e}))}),s.picked&&Tn(s.picked,U(s.picked))&&t.jsx(Mn,{personEmail:U(s.picked),value:lt[s.picked.key]||"",onChange:e=>Ct(n=>({...n,[s.picked.key]:e}))}),s.anchor&&!(s.anchor.isGem&&s.anchor.userId>0)&&!s.anchor.email&&t.jsx(bo,{personName:s.anchor.name,value:It[s.anchor.key]||"",onChange:e=>it(n=>({...n,[s.anchor.key]:e}))}),s.picked&&!(s.picked.isGem&&s.picked.userId>0)&&!s.picked.email&&t.jsx(bo,{personName:s.picked.name,value:It[s.picked.key]||"",onChange:e=>it(n=>({...n,[s.picked.key]:e}))}),t.jsxs("div",{className:"intro-note-row",children:[t.jsxs("label",{className:"intro-note-lbl",htmlFor:"make-intro-note",children:["Why this intro? ",t.jsx("span",{className:"intro-note-optional",children:"optional"})]}),t.jsx("input",{id:"make-intro-note",className:"intro-note-input",type:"text",placeholder:"Context helps Gemphere draft both blurbs",value:s.note,onChange:e=>D(n=>n&&{...n,note:e.target.value}),disabled:re})]}),s.anchor&&s.picked&&s.optInMode==="single"&&t.jsx(Pi,{parties:[{key:"from",name:ge(s.anchor),role:"Person A",isApprover:s.singleOptInFirstParty==="to"},{key:"connector",name:(r==null?void 0:r.fullName)||"You",role:"Connector"},{key:"to",name:ge(s.picked),role:"Person B",isApprover:s.singleOptInFirstParty==="from"}],singleOptInFirstParty:s.singleOptInFirstParty,onSelectFirstParty:e=>D(n=>n&&{...n,singleOptInFirstParty:e}),makerName:(r==null?void 0:r.fullName)||"You",fromName:K(s.anchor),toName:K(s.picked)}),s.anchor&&s.picked&&t.jsx("div",{className:"req-email req-email--split",children:s.optInMode==="single"?(()=>{const e=s.singleOptInFirstParty==="from"?s.picked:s.anchor,n=s.singleOptInFirstParty==="from"?s.email2Body:s.email1Body,a=s.singleOptInFirstParty==="from"?s.anchor:s.picked;return t.jsx(Pn,{title:`Email to ${jn(e)}`,meta:"Cc'd to all parties",recipientName:K(e),recipientEmail:U(e),otherName:K(a),otherEmail:U(a),connectorName:(r==null?void 0:r.fullName)||"Me",blurb:n,onBlurbChange:o=>D(l=>l&&(s.singleOptInFirstParty==="from"?{...l,email2Body:o}:{...l,email1Body:o}))})})():t.jsxs(t.Fragment,{children:[t.jsx(Pn,{title:`1 · Email to ${jn(s.anchor)}`,meta:U(s.anchor)?r!=null&&r.email?"Cc'd to you":"Sends now":"Add their email above",recipientName:K(s.anchor),recipientEmail:U(s.anchor),otherName:K(s.picked),otherEmail:U(s.picked),connectorName:(r==null?void 0:r.fullName)||"Me",blurb:s.email1Body,onBlurbChange:e=>D(n=>n&&{...n,email1Body:e})}),t.jsx(Pn,{title:`2 · Email to ${jn(s.picked)}`,meta:U(s.picked)?r!=null&&r.email?"Cc'd to you":"Sends now":"Add their email above",recipientName:K(s.picked),recipientEmail:U(s.picked),otherName:K(s.anchor),otherEmail:U(s.anchor),connectorName:(r==null?void 0:r.fullName)||"Me",blurb:s.email2Body,onBlurbChange:e=>D(n=>n&&{...n,email2Body:e})})]})}),xt&&t.jsx("div",{className:"info-banner",style:{background:"#fdecea",borderColor:"#f3c3bb",color:"#9a3a2a",marginBottom:0,marginTop:12},children:xt}),wt&&t.jsx("div",{className:"info-banner",style:{background:"#E1F5EE",borderColor:"#9FE1CB",color:"#0F6E56",marginBottom:0,marginTop:12},children:wt})]}),t.jsx(Pl,{mode:s.optInMode,onChange:e=>D(n=>n&&{...n,optInMode:e}),disabled:re}),t.jsxs("div",{className:"modal-foot req-modal-foot--steps",children:[t.jsx("button",{className:"btn-foot primary",onClick:ws,disabled:re||!s.picked||!s.anchor,children:re?"Sending…":s.optInMode==="disabled"?"Connect now":"Send intro"}),t.jsx("button",{type:"button",className:"btn-foot req-foot-back",onClick:bs,disabled:re,children:"← Back"}),s.optInMode!=="disabled"&&s.anchor&&s.picked?t.jsxs("span",{className:"req-foot-note",children:["Neither ",ge(s.anchor)," nor"," ",ge(s.picked)," is connected until they opt in."]}):null,t.jsx("button",{className:"btn-foot req-foot-cancel",onClick:ee,disabled:re,children:"Cancel"})]})]})}),k&&k.mode==="view"&&(()=>{const e=k.anchor;return t.jsx(Ai,{open:!0,onClose:Ot,userId:k.anchor.userId,fallbackName:k.anchor.name,fallbackPhoto:k.anchor.photo??null,fallbackRole:k.anchor.roleKind,mode:"view",fallbackEmail:k.anchor.email??null,fallbackLinkedinUrl:e.linkedinUrl??null,fallbackTitle:e.title??null,fallbackLocation:e.location??null,fallbackCompanyName:e.companyName??null,fallbackCompanyWebsite:e.companyWebsite??null})})(),k&&k.mode==="request"&&t.jsx("div",{className:"slide-panel-overlay open",onClick:Ot,children:t.jsxs("div",{className:"slide-panel",onClick:e=>e.stopPropagation(),style:{maxWidth:620},children:[t.jsx("button",{className:"sp-close",onClick:Ot,children:"×"}),t.jsxs("div",{className:"sp-body",children:[t.jsxs("div",{className:"sp-header",children:[(ao=k.profile)!=null&&ao.photo||k.anchor.photo?t.jsx("img",{src:((so=k.profile)==null?void 0:so.photo)||k.anchor.photo,alt:"",className:"sp-avatar",style:{objectFit:"cover"}}):t.jsx("div",{className:"sp-avatar",style:{background:"#FAEEDA",color:"#8a5a10"},children:ye(k.anchor.name)}),t.jsxs("div",{className:"sp-header-info",children:[t.jsx("div",{className:"sp-name",children:((oo=k.profile)==null?void 0:oo.fullname)||k.anchor.name}),t.jsx("div",{className:"sp-role",children:(()=>{const e=k.profile,n=(e==null?void 0:e.title)||"",a=(e==null?void 0:e.fundName)||(e==null?void 0:e.companyName)||"";
9return[n,a].filter(Boolean).join(" · ")||k.anchor.role||W(k.anchor.roleKind)})()}),((ro=k.profile)==null?void 0:ro.linkedinUrl)&&t.jsxs("a",{href:k.profile.linkedinUrl.startsWith("http")?k.profile.linkedinUrl:`https://www.linkedin.com/in/${k.profile.linkedinUrl}`,target:"_blank",rel:"noopener noreferrer",className:"sp-linkedin",children:["↗"," ",k.profile.linkedinUrl.replace(/^https?:\/\//,"").replace(/^www\./,"")]})]})]}),t.jsx("div",{className:"sp-sec-lbl",children:"PROFILE & INTEL"}),k.profileLoading?t.jsx(Ie,{variant:"inline",message:"Loading profile…"}):(()=>{const e=k.profile,n=k.anchor,a=(e==null?void 0:e.role)??k.anchor.roleKind,o=[];o.push(["Role",W(a)]);const l=(e==null?void 0:e.title)||n.title;l&&o.push(["Title",l]),a===2&&(e!=null&&e.fundName)&&o.push(["Fund",e.fundName]);const m=(a!==2?e==null?void 0:e.companyName:null)||n.companyName;m&&o.push(["Company",m]),n.companyWebsite&&o.push(["Website",n.companyWebsite]),e!=null&&e.sector&&o.push(["Sectors",e.sector]),a===2&&(e!=null&&e.checkSize)&&o.push(["Initial Check Size",e.checkSize]),e!=null&&e.school&&o.push(["Education",e.school]),e!=null&&e.experience&&o.push(["Experience",e.experience]);const u=(e==null?void 0:e.location)||n.location;u&&o.push(["Location",u]);const f=(e==null?void 0:e.email)||k.anchor.email||null;f&&o.push(["Email",f]);const g=(e==null?void 0:e.linkedinUrl)||n.linkedinUrl;return g&&o.push(["LinkedIn",g]),t.jsx("div",{className:"sp-intel",children:o.map(([x,w])=>t.jsxs("div",{className:"sp-intel-row",children:[t.jsx("span",{className:"sp-intel-key",children:x}),t.jsx("span",{className:"sp-intel-val",style:{textAlign:"right",maxWidth:"65%",wordBreak:"break-word"},children:x==="LinkedIn"||x==="Website"?t.jsx("a",{href:w.startsWith("http")?w:`https://${w}`,target:"_blank",rel:"noopener noreferrer",style:{color:"#0F6E56",textDecoration:"underline"},children:w}):w})]},x))})})(),!k.profileLoading&&k.profile&&(()=>{const e=k.profile,a=(e.role??k.anchor.roleKind)===2?[...e.commonAdvice?[["COMMON ADVICE",e.commonAdvice]]:[],...e.whatThey?[["WHAT I LOOK FOR IN A FOUNDER",e.whatThey]]:[],...e.favPitchStyle?[["FAVOURITE QUOTE",e.favPitchStyle]]:[]]:[...e.companyOverview?[["COMPANY OVERVIEW",e.companyOverview]]:[],...e.traction?[["TRACTION",e.traction]]:[],...e.superpower?[["SUPERPOWER",e.superpower]]:[],...e.why?[["WHY WE BUILD THIS",e.why]]:[]];return a.length===0?null:t.jsx(t.Fragment,{children:a.map(([o,l])=>t.jsxs("div",{children:[t.jsx("div",{className:"sp-sec-lbl",children:o}),t.jsx("div",{className:"sp-why-fits",style:{whiteSpace:"pre-wrap"},children:l})]},o))})})(),k.mode==="request"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"sp-sec-lbl",children:[t.jsx("span",{className:"sp-lbl-icon",children:"⚡"}),"WARM INTRO PATHS",!k.peopleLoading&&t.jsxs("span",{style:{marginLeft:"auto",fontSize:10,color:"#aaa",fontWeight:600},children:[k.people.length," in ",Ke(k.anchor.name),"'s network"]})]}),t.jsxs("div",{className:"search-box",style:{marginBottom:10},children:[t.jsx("span",{className:"search-ico",children:"🔍"}),t.jsx("input",{type:"text",placeholder:`Search ${Ke(k.anchor.name)}'s network…`,value:k.search,onChange:e=>Ee(n=>n&&{...n,search:e.target.value})})]}),k.peopleLoading?t.jsx(Ie,{variant:"section",message:"Loading warm intro paths…"}):k.peopleError?t.jsx("div",{className:"info-banner",style:{background:"#fdecea",borderColor:"#f3c3bb",color:"#9a3a2a"},children:k.peopleError}):k.search.trim()?k.people.length===0?t.jsxs("div",{style:{padding:20,textAlign:"center",color:"#aaa",fontSize:12},children:["No people in ",Ke(k.anchor.name),"'s network."]}):ys.length===0?t.jsx("div",{style:{padding:20,textAlign:"center",color:"#aaa",fontSize:12},children:"No matches — try a different search."}):t.jsx("div",{className:"sp-team",children:ys.slice(0,200).map(e=>t.jsxs("div",{className:"sp-team-row",children:[e.photo?t.jsx("img",{src:e.photo,alt:"",className:`av sm ${So(e.userId||0)} no-border`,style:{objectFit:"cover"}}):t.jsx("div",{className:`av sm ${So(e.userId||0)} no-border`,children:ye(e.name)}),t.jsxs("div",{className:"sp-team-info",children:[t.jsx("div",{className:"sp-team-name",children:e.name}),t.jsx("div",{className:"sp-team-role",children:e.role})]}),t.jsxs("button",{className:"sp-team-btn",onClick:()=>Ur(e),children:[t.jsx("span",{children:"👤"}),"Ask ",Ke(k.anchor.name)," for intro"]})]},e.key))}):t.jsxs("div",{style:{padding:20,textAlign:"center",color:"#aaa",fontSize:12}
9,children:["Start typing a name to search ",Ke(k.anchor.name),"'s network."]})]})]})]})}),s&&s.mode==="request"&&s.anchor&&s.step==="pick"&&t.jsx("div",{className:"modal-overlay open request-intro-portal",onClick:ee,role:"presentation",children:t.jsxs("div",{className:"modal intro-picker",onClick:e=>e.stopPropagation(),children:[t.jsxs("div",{className:"intro-picker-head",children:[t.jsxs("div",{className:"intro-picker-kicker",children:[t.jsx("span",{children:"Step 1 of 2 · Who to reach"}),t.jsx("span",{className:"intro-picker-kicker-note",children:"Double opt-in · Nothing sends yet"})]}),t.jsx("button",{className:"mod-close intro-picker-close",onClick:ee,"aria-label":"Close",children:"×"}),t.jsxs("h2",{className:"intro-picker-title",children:["Request an intro via ",s.anchor.name,"."]}),t.jsxs("div",{className:"intro-picker-chain",children:[t.jsx(Ye,{name:(r==null?void 0:r.fullName)||"You",photo:Z,label:"Asker",tone:"asker",userId:p,title:oe,company:ne}),t.jsx("span",{className:"intro-pick-link","aria-hidden":"true"}),t.jsx(Ye,{name:s.anchor.name,photo:s.anchor.photo,label:"Connector",tone:"connector",userId:s.anchor.userId,title:V(s.anchor,W).title,company:V(s.anchor,W).company}),t.jsx("span",{className:"intro-pick-link","aria-hidden":"true"}),t.jsx(Ye,{name:((io=s.picked)==null?void 0:io.name)||"Target",photo:(lo=s.picked)==null?void 0:lo.photo,label:"Target",tone:"target",userId:(co=s.picked)==null?void 0:co.userId,title:V(s.picked,W).title,company:V(s.picked,W).company})]})]}),t.jsxs("div",{className:"intro-picker-body",children:[t.jsxs("div",{className:"intro-picker-lede",children:["Search ",ge(s.anchor),"'s network and pick who you want to meet"]}),t.jsx("div",{className:"intro-picker-search",children:t.jsx(En,{value:$e,onChange:qe,onAdd:({name:e,email:n})=>wn("to",e,n)})}),In("to")]}),t.jsxs("div",{className:"intro-picker-foot",children:[t.jsxs("button",{type:"button",className:"intro-picker-go",disabled:!s.picked,onClick:ks,children:["Draft the emails",t.jsx("span",{"aria-hidden":"true",children:" →"})]}),t.jsx("span",{className:"intro-picker-note",children:"Nothing sends yet — you will see both emails first."}),t.jsx("button",{type:"button",className:"intro-picker-cancel",onClick:ee,children:"Cancel"})]})]})}),s&&s.mode==="request"&&s.anchor&&s.picked&&s.step==="compose"&&t.jsx("div",{className:"modal-overlay open request-intro-portal",onClick:ee,role:"presentation",children:t.jsxs("div",{className:"modal req-modal req-modal--wide",onClick:e=>e.stopPropagation(),children:[t.jsxs("div",{className:"modal-head",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"req-step-kicker",children:[t.jsx("span",{children:"Step 2 of 2 · What Gem sends"}),t.jsx("span",{className:"req-step-kicker-note",children:"Double opt-in · Nothing sends yet"})]}),t.jsxs("div",{className:"mod-title",children:["Request an intro to ",s.picked.name,"."]}),t.jsx("div",{className:"mod-sub"})]}),t.jsx("button",{className:"mod-close",onClick:ee,"aria-label":"Close",children:"×"})]}),t.jsxs(ko,{children:[t.jsx(ze,{name:(r==null?void 0:r.fullName)||"You",photo:Z,role:oe,company:ne,badge:"you",badgeLabel:"Asker",avatarTone:"green",compactName:!1}),t.jsx(Yt,{}),t.jsx(ze,{name:s.anchor.name,photo:s.anchor.photo,role:V(s.anchor,W).title,company:V(s.anchor,W).company,kindLabel:"Connector",badge:"connector",badgeLabel:"Connector",avatarTone:"green",compactName:!1}),t.jsx(Yt,{}),t.jsx(ze,{name:s.picked.name,photo:s.picked.photo,role:V(s.picked,W).title,company:V(s.picked,W).company,kindLabel:"Target",badge:"target",badgeLabel:"Target",avatarTone:"green",compactName:!1})]}),t.jsxs("div",{className:"req-body",children:[Tn(s.picked,U(s.picked))&&t.jsx(Mn,{personEmail:U(s.picked),value:lt[s.picked.key]||"",onChange:e=>Ct(n=>({...n,[s.picked.key]:e}))}),t.jsxs("div",{className:"req-sec-lbl",children:["What Gem sends",t.jsxs("span",{className:"req-sec-note",children:["Two emails. The second only exists if"," ",ge(s.anchor)," says yes."]})]}),t.jsx(Ri,{connectorName:K(s.anchor),connectorEmail:U(s.anchor),...U(s.anchor)?{}:{onConnectorEmailChange:e=>it(n=>({...n,[s.anchor.key]:e}))},askerName:(r==null?void 0:r.fullName)||"Me",askerEmail:r==null?void 0:r.email,targetName:K(s.picked),targetEmail:U(s.picked),...U(s.picked)?{}:{onTargetEmailChange:e=>it(n=>({...n,[s.picked.key]:e}))},blurb:s.email2Body,meta:`${r!=null&&r.email?" - copy sent to you":""}`,onBlurbChange:e=>D(n=>n&&{...n,email2Body:e}),layout:"split",disabled:re}),xt&&t.jsx("div",{className:"info-banner",style:{background:"#fdecea",borderColor:"#f3c3bb",color:"#9a3a2a",marginBottom:0,marginTop:12},children:xt}),wt&&t.jsx("div",{className:"info-banner",style:{background:"#E1F5EE",borderColor:"#9FE1CB",color:"#0F6E56",marginBottom:0,marginTop:12},children:wt})]}),t.jsxs("div",{className:"modal-foot req-modal-foot--steps",children:[t.jsx("button",{className:"btn-foot primary",onClick:ws,disabled:re,children:re?"Sending…":`Send to ${ge(s.anchor)}`}),t.jsx("button",{type:"button",className:"btn-foot req-foot-back",onClick:bs,disabled:re,children:"← Back"}),t.jsxs("span",{className:"req-foot-note",children:[s.picked.name," hears nothing until"," ",ge(s.anchor)," accepts."]}),t.jsx("button",{className:"btn-foot req-foot-cancel",onClick:ee,disabled:re,children:"Cancel"})]})]})}),Le&&t.jsx("div",{className:"modal-overlay open",onClick:()=>{et||Je(null)},children:t.jsxs("div",{className:"modal",onClick:e=>e.stopPropagation(),style:{maxWidth:420},children:[t.jsxs("div",{className:"modal-head",children:[t.jsxs("div",{children:[t.jsx("div",{className:"mod-title",children:"Send invitation again?"}),t.jsxs("div",{className:"mod-sub",children:["An invitation already exists for ",Le.email,"."]})]}),t.jsx("button",{className:"mod-close",onClick:()=>Je(null),disabled:et,children:"×"})]}),t.jsx("div",{className:"modal-body",children:t.jsx("p",{style:{margin:0,color:"#5f5a4f",fontSize:14,lineHeight:1.5},children:"Do you want to send the same invitation email again?"})}),t.jsxs("div",{className:"modal-foot",children:[t.jsx("button",{className:"btn-foot",onClick:()=>Je(null),disabled:et,children:"Cancel"}),t.jsx("button",{className:"btn-foot primary",onClick:Er,disabled:et,children:et?"Sending…":"Send again"})]})]})}),t.jsx(Zi,{open:Sa!=null,contactUserId:Sa,prefill:hr??void 0,onClose:()=>{La(null),Ea(null)},onSent:e=>{La(null),Ea(null),qa(e)}}),t.jsx(nl,{open:Ta!=null||Pa!=null,contactUserId:Ta,contactImportId:Pa,prefill:pr??void 0,onClose:()=>{Ma(null),Aa(null),Ra(null)},onScheduled:e=>{Ma(null),Aa(null),Ra(null),qa(e)}}),t.jsx(al,{open:Fa!=null||Ua!=null,contactUserId:Fa,contactImportId:Ua,prefill:fr??void 0,onClose:()=>{fn(null),gn(null),yn(null)},onMuted:(e,n)=>{fn(null),gn(null),yn(null),kr(e,n)}}),t.jsx(kl,{open:Hn!=null,contact:Hn,onClose:()=>yt(null),onSaved:Ir}),t.jsx(Xi,{open:A!=null,name:(A==null?void 0:A.name)||"",email:A==null?void 0:A.email,fromRequestIntro:A==null?void 0:A.fromRequestIntro,onEmailChange:e=>{Oe(n=>n?{...n,email:e,mode:e.trim()?"send":"no_email"}:null)},mode:((A==null?void 0:A.email)||"").trim()?"send":(A==null?void 0:A.mode)||"no_email",inviterName:(r==null?void 0:r.fullName)||"You",personalNote:Xe,onPersonalNoteChange:Vn,sending:Qn||On===(A==null?void 0:A.contactId),onClose:()=>{Qn||Oe(null)},onSendInvite:Sr,onEditProfile:()=>{const e=A==null?void 0:A.contactId;Oe(null),e&&Nr(e)}}),t.jsx(ol,{open:ve!=null||Zo,initialEmail:(ve==null?void 0:ve.email)||"",initialName:(ve==null?void 0:ve.name)||"",quota:De,onClose:()=>{Kn(null),nn(!1)},onSent:e=>{if(ve){wr(e);return}nn(!1),Me(),j("Connector request sent."),setTimeout(()=>j(null),3e3)}}),t.jsx(rl,{open:Xo,onClose:()=>an(!1),onSent:e=>{an(!1),j(`Sent ${e} invite${e===1?"":"s"}`),setTimeout(()=>j(null),3e3)}}),ga&&t.jsx("div",{style:{position:"fixed",bottom:24,left:"50%",transform:"translateX(-50%)",background:"#2a2820",color:"#fff",padding:"12px 22px",borderRadius:10,fontSize:13,fontWeight:600,boxShadow:"0 8px 24px rgba(0,0,0,0.18)",zIndex:300},children:ga}),P&&t.jsx("div",{role:"dialog","aria-modal":"true",onClick:()=>nt(null),style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:400,padding:16},children:t.jsxs("div",{onClick:e=>e.stopPropagation(),style:{background:"#fff",borderRadius:14,width:"min(560px, 100%)",maxHeight:"85vh",overflow:"auto",boxShadow:"0 24px 48px rgba(0,0,0,0.25)"},children:[t.jsxs("div",{style:{padding:"18px 22px",borderBottom:"1px solid #eee",display:"flex",alignItems:"flex-start",ga
9p:12},children:[t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{fontSize:11,color:"#888",textTransform:"uppercase",letterSpacing:.5},children:"Relationship · powered by your calendar"}),t.jsxs("div",{style:{fontSize:18,fontWeight:700,color:"#1a1a1a",marginTop:2},children:["You & ",P.name]}),t.jsx("div",{style:{fontSize:12,color:"#666",marginTop:2},children:P.email})]}),t.jsx("button",{type:"button",onClick:()=>nt(null),"aria-label":"Close",style:{background:"transparent",border:"none",fontSize:22,color:"#888",cursor:"pointer",lineHeight:1},children:"×"})]}),t.jsxs("div",{style:{padding:"10px 22px",borderBottom:"1px solid #eee",background:"#faf8f1",display:"flex",flexWrap:"wrap",alignItems:"center",gap:6},children:[t.jsx("span",{style:{fontSize:11,fontWeight:700,color:"#888",textTransform:"uppercase",letterSpacing:.5,marginRight:4},children:"Window:"}),[{id:"1mo",label:"1 mo"},{id:"3mo",label:"3 mo"},{id:"6mo",label:"6 mo"},{id:"12mo",label:"12 mo"},{id:"24mo",label:"2 yr"},{id:"all",label:"All time"}].map(e=>{const n=P.range===e.id;return t.jsx("button",{type:"button",onClick:()=>br(P.email,P.name,e.id),disabled:P.loading,style:{padding:"4px 10px",borderRadius:999,fontSize:11,fontWeight:600,cursor:P.loading?"wait":"pointer",background:n?"#0F6E56":"#fff",color:n?"#fff":"#1a1a1a",border:n?"1px solid #0F6E56":"1px solid #d8d2c2",transition:"background 0.12s, color 0.12s"},children:e.label},e.id)}),P.loading&&t.jsx("span",{style:{fontSize:11,color:"#888",marginLeft:6},children:"Loading…"})]}),t.jsx("div",{style:{padding:"14px 22px"},children:(()=>{const e=F[P.email.toLowerCase()]||null,n=(e==null?void 0:e.sentCount)||0,a=(e==null?void 0:e.receivedCount)||0,o=n+a,l=(()=>{const f=e!=null&&e.lastSentAt?new Date(e.lastSentAt).getTime():0,g=e!=null&&e.lastReceivedAt?new Date(e.lastReceivedAt).getTime():0,x=Math.max(f,g);return x?new Date(x).toISOString():null})(),m=o>0,u=!P.loading&&!P.error&&P.totalMeetings===0&&!m;return t.jsx(t.Fragment,{children:P.loading?t.jsx(Ie,{variant:"section",message:"Loading relationship history…"}):P.error?t.jsxs("div",{className:"info-banner",style:{background:"#fdecea",borderColor:"#f3c3bb",color:"#9a3a2a"},children:[t.jsx("strong",{children:"Couldn't load meetings:"})," ",P.error]}):u?t.jsx("div",{style:{padding:20,textAlign:"center",color:"#666",fontSize:13},children:"No emails or calendar meetings between you in this window. Try widening the range above."}):t.jsxs(t.Fragment,{children:[m&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{fontSize:11,fontWeight:700,color:"#888",textTransform:"uppercase",letterSpacing:.5,marginBottom:8},children:"Email exchange · last 90 days"}),t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:8,marginBottom:14},children:[t.jsxs("div",{style:{background:"#eef3fb",border:"1px solid #cdddf3",borderRadius:10,padding:"10px 12px"},children:[t.jsx("div",{style:{fontSize:10,fontWeight:700,color:"#2d4a7a",textTransform:"uppercase",letterSpacing:.5},children:"You sent"}),t.jsx("div",{style:{fontSize:20,fontWeight:700,color:"#1a1a1a",marginTop:2},children:n.toLocaleString()}),t.jsx("div",{style:{fontSize:11,color:"#666",marginTop:2},children:e!=null&&e.lastSentAt?`Last ${Rn(e.lastSentAt)}`:"—"})]}),t.jsxs("div",{style:{background:"#eef3fb",border:"1px solid #cdddf3",borderRadius:10,padding:"10px 12px"},children:[t.jsx("div",{style:{fontSize:10,fontWeight:700,color:"#2d4a7a",textTransform:"uppercase",letterSpacing:.5},children:"They sent"}),t.jsx("div",{style:{fontSize:20,fontWeight:700,color:"#1a1a1a",marginTop:2},children:a.toLocaleString()}),t.jsx("div",{style:{fontSize:11,color:"#666",marginTop:2},children:e!=null&&e.lastReceivedAt?`Last ${Rn(e.lastReceivedAt)}`:"—"})]}),t.jsxs("div",{style:{background:"#f7f3e8",border:"1px solid #ece4cf",borderRadius:10,padding:"10px 12px"},children:[t.jsx("div",{style:{fontSize:10,fontWeight:700,color:"#7a6628",textTransform:"uppercase",letterSpacing:.5},children:"Total · last touch"}),t.jsx("div",{style:{fontSize:20,fontWeight:700,color:"#1a1a1a",marginTop:2}
9,children:o.toLocaleString()}),t.jsx("div",{style:{fontSize:11,color:"#666",marginTop:2},children:l?Rn(l):"—"})]})]})]}),P.totalMeetings>0&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{style:{background:"#f7f3e8",border:"1px solid #ece4cf",borderRadius:10,padding:"10px 14px",marginBottom:14,fontSize:13,color:"#333"},children:[t.jsxs("strong",{style:{color:"#0F6E56"},children:[Ml(P.totalMeetings)," on the calendar"]})," ","across ",P.months.length," month",P.months.length===1?"":"s"," ·"," ",t.jsx("span",{style:{color:"#7a6628"},children:P.range==="all"?"all time":P.range==="1mo"?"last 30 days":P.range==="3mo"?"last 3 months":P.range==="6mo"?"last 6 months":P.range==="24mo"?"last 2 years":"last 12 months"}),"."]}),t.jsx("div",{style:{fontSize:11,fontWeight:700,color:"#888",textTransform:"uppercase",letterSpacing:.5,marginBottom:8},children:"By month"}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6,marginBottom:18},children:P.months.slice().reverse().map(f=>{const[g,x]=f.year_month.split("-"),w=new Date(Number(g),Number(x)-1,1).toLocaleDateString(void 0,{month:"long",year:"numeric"});return t.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8,padding:"8px 12px",background:"#fafaf6",border:"1px solid #ece4cf",borderRadius:8},children:[t.jsx("div",{style:{flex:"0 0 130px",fontSize:13,fontWeight:600,color:"#1a1a1a"},children:w}),t.jsxs("div",{style:{flex:"0 0 auto",fontSize:13,fontWeight:700,color:"#0F6E56"},children:[f.meeting_count,"×"]}),t.jsx("div",{style:{flex:1,fontSize:11,color:"#777",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.days.map(L=>Ro(L)).join(" · ")})]},f.year_month)})}),P.recent.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{fontSize:11,fontWeight:700,color:"#888",textTransform:"uppercase",letterSpacing:.5,marginBottom:8},children:"Recent meetings"}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:P.recent.slice(-30).reverse().map((f,g)=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 12px",borderBottom:"1px solid #f1ece0",opacity:f.status==="cancelled"?.55:1},children:[t.jsx("div",{style:{flex:"0 0 110px",fontSize:12,color:"#1a1a1a",fontWeight:600},children:Ro(f.start_at)}),t.jsx("div",{style:{flex:1,fontSize:12,color:"#444",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.event_title||"(untitled meeting)"}),f.status==="cancelled"&&t.jsx("div",{style:{fontSize:10,color:"#a94442",fontWeight:700,textTransform:"uppercase"},children:"Cancelled"})]},`${f.start_at}-${g}`))})]})]})]})})})()})]})})]})}export{rc 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.