PageSourceSearch

https://medarion.ai/assets/PortfolioMonitoringPage-CCgkl4Zs.js

js medarion.ai collected 2026-10-05 12:16:35 UTC 25,926 bytes, 1 lines download raw bytes

1import{F as Ue,ab as He,W as Ge,b as We,r as a,c as f,j as e,ap as be,ac as Je,ag as Qe,n as Ve,aq as Xe,ar as Ye,as as Ze,a4 as et,ad as tt,q as X,at as Y,au as A,S as l,av as c,aw as st,ax as at,am as nt,al as it,R as lt,aa as rt,h as ot,i as u,X as dt,Y as fe,k as ct,a8 as mt,I as ge,ae as Z,N as xt,A as pt,T as ut,L as ht,ay as bt,ao as ft,U as M,af as ye,az as gt}from"./index-Dp6uzjnE.js";const yt=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]],je=Ue("file-question-mark",yt),ve={pending:l.amber,submitted:l.emerald,open:l.blue,declined:l.red,completed:l.slate},jt={pending:l.amber,accepted:l.emerald,revoked:l.slate},vt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ne(n){const[g,h]=n.split("-"),d=Number(h)-1;return`${vt[d]||h} ’${String(g).slice(-2)}`}function Nt({value:n,colorIndex:g=0}){const h=n==null?null:Math.max(0,Math.min(100,Number(n))),d=ye[g%ye.length];return h==null?e.jsx("div",{className:"h-2 rounded-full bg-surface-muted min-w-[48px]",title:"—"}):e.jsx("div",{className:"min-w-[48px]",children:e.jsx(Z,{pct:h,color:d,size:"sm",showPct:!1})})}function kt(){const n=He(),g=Ge(),[h]=We(),d=h.get("highlight")||"",[r,ee]=a.useState(null),[te,we]=a.useState([]),[N,ke]=a.useState(null),[w,Se]=a.useState([]),[k,se]=a.useState(!0),[P,m]=a.useState(null),[T,y]=a.useState(!1),[j,v]=a.useState("invite"),[Ce,S]=a.useState(!1),[E,q]=a.useState(""),[L,ae]=a.useState(""),[ne,C]=a.useState([]),[_e,ie]=a.useState(!1),[F,Ie]=a.useState(""),[$,Re]=a.useState(""),[B,Ae]=a.useState(""),[O,Me]=a.useState(""),[le,Pe]=a.useState(!1),[D,z]=a.useState(""),[K,U]=a.useState(""),[re,H]=a.useState(null),[oe,de]=a.useState(null),[_,Te]=a.useState([]),[Ee,ce]=a.useState(null),[G,qe]=a.useState(""),[I,me]=a.useState(""),[xe,pe]=a.useState(""),[b,x]=a.useState(!1),p=a.useCallback(async()=>{se(!0),m(null);const t=n?"/api/v1/portfolio/admin":"/api/v1/portfolio/investor";try{const[s,i,o,V,Ke]=await Promise.all([f(`${t}/overview`),f(`${t}/runway-chart`),f(`${t}/ai-brief`),f(`${t}/requests`),n?Promise.resolve({results:[]}):f("/api/v1/portfolio/investor/invites").catch(()=>({results:[]}))]);ee(s),we(i.results||[]),ke(o),Se(V.results||[]),Te(Ke.results||[])}catch(s){const i=s instanceof Error?s.message:"Failed to load portfolio";m(n&&i==="forbidden"?"Could not load portfolio data. Ensure you are signed in as platform admin.":i),ee(null)}finally{se(!1)}},[n]);a.useEffect(()=>{document.title="Portfolio Monitoring - Medarion"},[]),a.useEffect(()=>{p()},[p]),a.useEffect(()=>{if(!d||!r?.companies?.length)return;const t=document.getElementById(`portfolio-highlight-${d}`);t&&t.scrollIntoView({behavior:"smooth",block:"center"})},[d,r]),a.useEffect(()=>{if(!T||j!=="existing")return;const t=L.trim();if(t.length<2){C([]);return}let s=!0;const i=window.setTimeout(()=>{ie(!0),f(`/api/v1/profiles?q=${encodeURIComponent(t)}&type=Company&limit=8`).then(o=>{s&&C(o.results||[])}).catch(()=>{s&&C([])}).finally(()=>{s&&ie(!1)})},280);return()=>{s=!1,window.clearTimeout(i)}},[L,T,j]);const W=r?.pillars_meta||[],Le=async()=>{const t=Number(E);if(t){x(!0);try{await M("/api/v1/portfolio/investor/companies",{company_profile_id:t,nrr_pct:F===""?null:Number(F),burn_multiple:$===""?null:Number($),runway_months:B===""?null:Number(B),cash_balance_m:O===""?null:Number(O),at_risk:le}),y(!1),q(""),await p()}catch(s){m(s instanceof Error?s.message:"Add failed")}finally{x(!1)}}},Fe=async()=>{const t=D.trim(),s=K.trim();if(!(!t||!s)){x(!0),H(null);try{await M("/api/v1/portfolio/investor/invite",{email:t,company_name:s}),de(t),z(""),U(""),await p()}catch(i){H(i instanceof Error?i.message:"Invite failed")}finally{x(!1)}}},J=()=>{y(!1),v("invite"),H(null),de(null),z(""),U("")},$e=async t=>{const s=t.invite_url||`${window.location.origin}/auth/signup?portfolio_invite=${t.token}`;try{await navigator.clipboard.writeText(s),ce(t.id),window.setTimeout(()=>ce(i=>i===t.id?null:i),2e3)}catch{m("Could not copy invite link")}},Be=async t=>{x(!0),m(null);try{await M(`/api/v1/portfolio/investor/invites/${t}/resend`,{}),await p()}catch(s){m(s instanceof Error?s.message:"Resend failed")}finally{x(!1)}},R=a.useMemo(()=>_.filter(t=>t.status==="pending"),[_]),ue=a.useMemo(()=>{const t=_.filter(s=>s.status!=="pending").slice(0,5);return[...R,...t]},[_,R]),Oe=async()=>{const t=Number(G);if(!(!t||!I.trim())){x(!0);try{await M("/api/v1/portfolio/investor/requests",{company_profile_id:t,title:I.trim(),body:xe.trim()||null}),S(!1),me(""),pe(""),await p()}catch(s){m(s instanceof Error?s.message:"Request failed")}finally{x(!1)}}},De=async t=>{if(confirm("Remove this company from your portfolio view?"))try{await gt(`/api/v1/portfolio/investor/companies/${t}`),await p()}catch(s){m(s instanceof Error?s.message:"Remove failed")}},Q=a.useMemo(()=>{const t=r?.kpis;return t?[{label:"Portfolio companies",value:String(t.portfolio_companies),hint:"Tracked names"},{label:"At-risk (runway)",value:String(t.at_risk_runway),hint:"Flagged in watchlist"},{label:"Median NRR",value:t.median_nrr_pct!=null?`${Number(t.median_nrr_pct).toFixed(1)}%`:"—",hint:"Net revenue retention"},{label:"Median burn rate",value:t.median_burn_multiple!=null?`${Number(t.median_burn_multiple).toFixed(1)}x`:"—",hint:"Burn multiple (cohort)"}]:null},[r]),ze=a.useMemo(()=>{const t=r?.kpis;return n?[{label:"Portfolio companies",value:t?String(t.portfolio_companies):"—"},{label:"Investor accounts",value:t?.investor_accounts!=null?String(t.investor_accounts):"—"},{label:"At-risk runway",value:t?String(t.at_risk_runway):"—"},{label:"Open requests",value:String(w.filter(s=>s.status==="pending").length)}]:Q?.map(s=>({label:s.label,value:s.value}))??[{label:"Portfolio companies",value:"—"},{label:"At-risk (runway)",value:"—"},{label:"Median NRR",value:"—"},{label:"Median burn rate",value:"—"}]},[r,Q,n,w]),he=e.jsxs("div",{className:"flex flex-wrap gap-2",children:[n?null:e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>y(!0),className:"medarion-btn-primary",children:[e.jsx(be,{className:"h-3.5 w-3.5","aria-hidden":!0})," Add company"]}),e.jsxs("button",{type:"button",onClick:()=>S(!0),className:"medarion-btn-outline",disabled:!r?.companies?.length,children:[e.jsx(je,{className:"h-3.5 w-3.5","aria-hidden":!0})," Request data"]})]}),e.jsxs("button",{type:"button",onClick:()=>{p()},className:"medarion-btn-outline",children:[e.jsx(Je,{className:"h-3.5 w-3.5","aria-hidden":!0})," Refresh"]}),n?null:e.jsxs(Qe,{to:g.link("/crm/dashboard/investor"),className:"medarion-btn-outline 
1!text-primary",children:["Investor CRM ",e.jsx(Ve,{className:"h-3.5 w-3.5","aria-hidden":!0})]})]});return e.jsx(Xe,{badge:Ze,title:Ye,lead:"Unified portfolio view, six-pillar KPI comparison, data requests, and audit-ready uploads from portfolio companies.",stats:ze,statsLoading:k,panel:!1,actions:he,children:e.jsxs("div",{className:n?"":"min-h-screen bg-surface-canvas",children:[e.jsx("div",{className:n?"mb-3":"max-w-[1600px] mx-auto px-4 sm:px-6 pt-4",children:e.jsx(et,{})}),n?null:e.jsx("div",{className:"border-b border-border bg-white",children:e.jsx("div",{className:"max-w-[1600px] mx-auto px-4 sm:px-6 py-6",children:e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-start lg:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-primary",children:"Investor intelligence"}),e.jsx("h1",{className:"text-2xl sm:text-3xl font-semibold text-ink-950 mt-1",children:"Portfolio Monitoring & Intelligence"}),e.jsx("p",{className:"text-sm text-ink-600 mt-1 max-w-2xl",children:"Unified portfolio view, six-pillar KPI comparison, data requests, and audit-ready uploads from portfolio companies."})]}),he]})})}),e.jsxs("div",{className:n?"space-y-3":"max-w-[1600px] mx-auto px-4 sm:px-6 py-6",children:[k?e.jsx(tt,{label:"Loading portfolio intelligence…"}):null,!k&&P?e.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:P}):null,!k&&!P&&r?e.jsxs(e.Fragment,{children:[n?null:e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-6",children:(Q||[]).map((t,s)=>{const{iconColor:i,wellStyle:o}=ft(s);return e.jsxs("div",{className:"medarion-schedra-card p-4",children:[e.jsx("div",{className:"inline-flex p-1.5 rounded-lg mb-2",style:o,children:e.jsx(X,{className:"w-4 h-4",style:{color:i}})}),e.jsx("p",{className:"text-2xl font-semibold text-ink-950 tabular-nums",children:t.value}),e.jsx("p",{className:"text-[11px] font-medium text-ink-800 mt-0.5",children:t.label}),e.jsx("p",{className:"text-[10px] text-ink-500",children:t.hint})]},t.label)})}),n?null:e.jsxs("div",{className:"overflow-hidden rounded-xl border border-border bg-white mb-6",children:[e.jsxs("div",{className:"border-b border-border-light px-3 py-2 flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 whitespace-nowrap",children:[e.jsx(Y,{className:"h-3 w-3 shrink-0 text-primary","aria-hidden":!0}),e.jsx("h2",{className:"shrink-0 text-[10px] font-semibold uppercase tracking-wide text-ink-800 whitespace-nowrap",children:"Outstanding company invites"}),R.length?e.jsx(A,{label:`${R.length} pending`,color:l.amber}):null]}),e.jsxs("button",{type:"button",onClick:()=>{v("invite"),y(!0)},className:"inline-flex shrink-0 items-center gap-1 text-[10px] font-semibold text-primary hover:underline",children:[e.jsx(be,{className:"h-3 w-3","aria-hidden":!0})," Invite unregistered company"]})]}),ue.length===0?e.jsxs("div",{className:"px-4 py-8 text-center",children:[e.jsx("p",{className:"text-xs text-ink-600",children:"Invite companies that aren't on Medarion yet by email — they create an account and join your portfolio."}),e.jsxs("button",{type:"button",onClick:()=>{v("invite"),y(!0)},className:"medarion-btn-primary mt-3",children:[e.jsx(Y,{className:"h-3.5 w-3.5","aria-hidden":!0})," Send invite"]})]}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[640px] text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border-light bg-surface-muted/50",children:[e.jsx("th",{className:c,children:"Company"}),e.jsx("th",{className:c,children:"Email"}),e.jsx("th",{className:c,children:"Status"}),e.jsx("th",{className:c,children:"Sent"}),e.jsx("th",{className:c,children:" "})]})}),e.jsx("tbody",{className:"divide-y divide-border-light",children:ue.map(t=>e.jsxs("tr",{className:"hover:bg-surface-muted/40 transition",children:[e.jsx("td",{className:"px-3 py-2.5 text-[12px] font-medium text-ink-900",children:t.company_name}),e.jsx("td",{className:"px-3 py-2.5 text-[11px] text-ink-600",children:t.email}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsx(A,{label:t.status,color:jt[t.status]||l.slate})}),e.jsx("td",{className:"px-3 py-2.5 text-[11px] tabular-nums text-ink-500",children:t.created_at?new Date(t.created_at).toLocaleDateString():"—"}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>{$e(t)},className:"inline-flex items-center gap-1 text-[10px] font-medium text-ink-600 hover:text-ink-950",children:[e.jsx(st,{className:"h-3 w-3","aria-hidden":!0}),Ee===t.id?"Copied":"Copy link"]}),t.status==="pending"?e.jsx("button",{type:"button",disabled:b,onClick:()=>
1{Be(t.id)},className:"text-[10px] font-medium text-primary hover:underline disabled:opacity-50",children:"Resend"}):null]})})]},t.id))})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-12 gap-3",children:[e.jsxs("div",{className:"xl:col-span-8 space-y-6",children:[e.jsxs("div",{className:"overflow-hidden rounded-xl border border-border bg-white",children:[e.jsx("div",{className:"border-b border-border-light px-3 py-2",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(X,{className:"h-3.5 w-3.5 text-primary","aria-hidden":!0}),e.jsx("h2",{className:"text-[11px] font-semibold text-ink-800",children:"Company benchmark · six pillars"})]})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[720px] text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border-light bg-surface-muted/50",children:[e.jsx("th",{className:`${c} sticky left-0 z-10 bg-surface-muted/50`,children:"Company"}),n?e.jsx("th",{className:c,children:"Investor"}):null,W.map(t=>e.jsx("th",{className:c,title:t.description||t.label,children:e.jsx("span",{className:"line-clamp-2",children:t.label})},t.key)),n?null:e.jsx("th",{className:c,children:" "})]})}),e.jsx("tbody",{className:"divide-y divide-border-light",children:r.companies.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:W.length+2,className:"py-10 text-center",children:e.jsx(at,{icon:X,title:"No portfolio companies tracked",description:n?"Investor accounts have not added holdings yet.":"Invite an unregistered company by email, or add an existing Medarion profile."})})}):r.companies.map((t,s)=>{const i=!!(d&&t.company_slug===d);return e.jsxs("tr",{id:i?`portfolio-highlight-${t.company_slug}`:void 0,className:`transition ${i?"bg-teal-50/80 ring-1 ring-inset ring-teal-200":"hover:bg-surface-muted/40"}`,children:[e.jsx("td",{className:`px-3 py-2.5 sticky left-0 z-10 ${i?"bg-teal-50":"bg-white"}`,children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(nt,{src:t.logo_url,name:t.company_name,size:"sm",rounded:"lg"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(it,{slug:t.company_slug,className:"text-[12px] font-medium text-ink-900 hover:text-primary truncate block",children:t.company_name}),t.at_risk?e.jsx(A,{label:"Runway watch",color:l.amber}):null,i?e.jsx("span",{className:"mt-0.5 inline-block text-[10px] font-semibold uppercase tracking-wide text-teal-700",children:"From Decision Intelligence"}):null]})]})}),n?e.jsx("td",{className:"px-3 py-2.5 text-[10px] text-ink-600",children:t.investor_name||t.investor_email||`#${t.investor_user_id}`}):null,W.map((o,V)=>e.jsxs("td",{className:"px-3 py-2 align-middle",children:[e.jsx(Nt,{value:t.pillar_scores?.[o.key]??null,colorIndex:V}),e.jsx("p",{className:"text-[10px] text-ink-500 mt-0.5 tabular-nums text-center",children:t.pillar_scores?.[o.key]!=null?t.pillar_scores[o.key]:"—"})]},o.key)),n?null:e.jsx("td",{className:"px-3 py-2",children:e.jsx("button",{type:"button",onClick:()=>De(t.id),className:"text-[10px] text-ink-500 hover:text-red-600",children:"Remove"})})]},t.id)})})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"overflow-hidden rounded-xl border border-border bg-white p-4",children:[e.jsx("h2",{className:"text-[11px] font-semibold text-ink-800 mb-1",children:"Cash · burn · runway (cohort trend)"}),e.jsx("p",{className:"text-[11px] text-ink-500 mb-3",children:"Average cash and runway from portfolio companies that have reported those metrics."}),e.jsx("div",{className:"rounded-lg border border-border-light bg-surface-muted/20",style:{height:280},children:te.length===0?e.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-1 px-6 text-center",children:[e.jsx("p",{className:"text-xs text-ink-500",children:"No cash or runway data yet"}),e.jsx("p",{className:"text-[11px] text-ink-400",children:"Add portfolio companies and record cash balance / runway, or collect KPI packs from invitations."})]}):e.jsx(lt,{width:"100%",height:"100%",children:e.jsxs(rt,{data:te,margin:{top:8,right:8,left:0,bottom:0},children:[e.jsx(ot,{stroke:u.grid,strokeDasharray:"4 4",vertical:!1}),e.jsx(dt,{dataKey:"month",tickFormatter:Ne,tick:{fontSize:10,fill:u.axis}
1,axisLine:{stroke:u.grid},tickLine:!1}),e.jsx(fe,{yAxisId:"l",tick:{fontSize:10,fill:u.axis},axisLine:!1,tickLine:!1,width:36}),e.jsx(fe,{yAxisId:"r",orientation:"right",tick:{fontSize:10,fill:u.axis},axisLine:!1,tickLine:!1,width:36}),e.jsx(ct,{contentStyle:u.tooltip,labelFormatter:Ne}),e.jsx(mt,{wrapperStyle:{fontSize:11}}),e.jsx(ge,{yAxisId:"l",type:"monotone",dataKey:"cash_m",name:"Cash ($M)",stroke:u.barPrimary,strokeWidth:2.4,dot:!1}),e.jsx(ge,{yAxisId:"r",type:"monotone",dataKey:"runway_months",name:"Runway (mo)",stroke:u.barSecondary,strokeWidth:2,dot:!1})]})})})]}),e.jsxs("div",{className:"rounded-2xl border border-border bg-white p-4 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(je,{className:"w-4 h-4 text-primary"}),e.jsx("h2",{className:"text-sm font-semibold text-ink-950",children:"Data requests & status"})]}),e.jsx("p",{className:"text-[11px] text-ink-500 mb-3",children:"Track invitations for KPI packs (PDF / Excel). Companies respond via the data portal."}),e.jsx("ul",{className:"space-y-2 max-h-[280px] overflow-y-auto",children:w.length===0?e.jsx("li",{className:"text-xs text-ink-400",children:"No open requests."}):w.map(t=>e.jsxs("li",{className:"rounded-lg border border-border bg-surface-muted/40 px-3 py-2",children:[e.jsxs("div",{className:"flex justify-between gap-2 items-start",children:[e.jsx("p",{className:"text-xs font-medium text-ink-900 line-clamp-2",children:t.title}),e.jsx(A,{label:t.status,color:ve[t.status]??l.slate})]}),e.jsx("p",{className:"text-[10px] text-ink-500 mt-1",children:t.company_name}),n&&(t.investor_name||t.investor_email)?e.jsxs("p",{className:"text-[10px] text-ink-400 mt-0.5",children:["Investor: ",t.investor_name||t.investor_email]}):null,e.jsx("div",{className:"mt-2",children:e.jsx(Z,{pct:t.status==="submitted"?85:t.status==="pending"?35:55,color:ve[t.status]??l.blue,size:"sm",showPct:!1})})]},t.id))})]})]})]}),e.jsx("div",{className:"xl:col-span-4 space-y-4",children:e.jsxs("div",{className:"rounded-2xl border border-border bg-white p-4 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(xt,{className:"w-4 h-4 text-primary"}),e.jsx("h2",{className:"text-sm font-semibold text-ink-950",children:"AI portfolio brief"})]}),e.jsx("ul",{className:"space-y-2 text-xs text-ink-600",children:(N?.bullets||[]).map((t,s)=>e.jsxs("li",{className:"leading-snug flex gap-2",children:[e.jsx(pt,{className:"w-3.5 h-3.5 text-primary shrink-0 mt-0.5"}),t]},s))}),e.jsxs("div",{className:"mt-3 rounded-lg border border-border bg-surface-muted p-2.5",children:[e.jsx("p",{className:"text-[11px] font-semibold text-ink-950 mb-1",children:"Suggested next actions"}),e.jsx("ul",{className:"text-[11px] text-ink-950 space-y-1",children:(N?.suggested_actions||[]).map((t,s)=>e.jsxs("li",{children:["- ",t]},s))})]}),e.jsxs("div",{className:"mt-3",children:[e.jsx("p",{className:"text-[11px] text-ink-500 mb-1",children:"Confidence"}),e.jsx(Z,{pct:N?.confidence??55,color:l.emerald,size:"sm",showPct:!1}),e.jsxs("p",{className:"text-[11px] text-ink-500 mt-1",children:[N?.confidence??"—","% model confidence"]})]}),e.jsxs("p",{className:"text-[10px] text-ink-400 mt-3 flex items-start gap-1",children:[e.jsx(ut,{className:"w-3.5 h-3.5 shrink-0"}),"Heuristic assist — validate against source documents before IC or LP reporting."]})]})})]})]}):null]}),T&&e.jsx("div",{className:"fixed inset-0 z-[70] bg-ink-950/45 flex items-center justify-center p-4",onClick:J,children:e.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border bg-white p-4 shadow-xl",onClick:t=>t.stopPropagation(),children:[e.jsx("h3",{className:"text-sm font-semibold text-ink-950",children:"Add portfolio company"}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-1 rounded-xl border border-border bg-surface-muted p-1",children:[e.jsx("button",{type:"button",onClick:()=>v("existing"),className:`rounded-lg px-3 py-1.5 text-xs font-semibold transition ${j==="existing"?"bg-white text-ink-950 shadow-sm":"text-ink-500 hover:text-ink-800"}`,children:"Existing profile"}),e.jsxs("button",{type:"button",onClick:()=>
1v("invite"),className:`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-semibold transition ${j==="invite"?"bg-white text-ink-950 shadow-sm":"text-ink-500 hover:text-ink-800"}`,children:[e.jsx(Y,{className:"h-3.5 w-3.5","aria-hidden":!0})," Invite by email"]})]}),j==="existing"?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-ink-500 mt-3",children:"Search by company name, then confirm the profile ID shown on the company record."}),e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsx("input",{value:L,onChange:t=>ae(t.target.value),placeholder:"Search company name…",className:"w-full px-3 py-2 rounded-lg border border-border text-sm"}),_e?e.jsxs("p",{className:"text-[11px] text-ink-500 flex items-center gap-1",children:[e.jsx(ht,{className:"h-3 w-3 animate-spin"})," Searching…"]}):null,ne.length>0?e.jsx("ul",{className:"max-h-40 overflow-auto rounded-lg border border-border divide-y divide-border-light bg-white",children:ne.map(t=>e.jsx("li",{children:e.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left text-sm hover:bg-surface-muted",onClick:()=>{q(String(t.id)),ae(t.name),C([])},children:[e.jsx("span",{className:"font-medium text-ink-950",children:t.name}),e.jsxs("span",{className:"ml-2 text-[11px] tabular-nums text-ink-500",children:["ID ",t.id]})]})},t.id))}):null,e.jsx("input",{value:E,onChange:t=>q(t.target.value),placeholder:"Company profile ID (number)",className:"w-full px-3 py-2 rounded-lg border border-border text-sm"}),e.jsx("a",{href:"/search?profile_type=company",className:"inline-flex text-[11px] font-semibold text-ink-700 hover:text-ink-950 underline underline-offset-2",children:"Open Entity Directory →"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx("input",{value:F,onChange:t=>Ie(t.target.value),placeholder:"NRR %",className:"px-3 py-2 rounded-lg border border-border text-sm"}),e.jsx("input",{value:$,onChange:t=>Re(t.target.value),placeholder:"Burn x",className:"px-3 py-2 rounded-lg border border-border text-sm"}),e.jsx("input",{value:B,onChange:t=>Ae(t.target.value),placeholder:"Runway mo",className:"px-3 py-2 rounded-lg border border-border text-sm"}),e.jsx("input",{value:O,onChange:t=>Me(t.target.value),placeholder:"Cash $M",className:"px-3 py-2 rounded-lg border border-border text-sm"})]}),e.jsxs("label",{className:"flex items-center gap-2 text-xs text-ink-950",children:[e.jsx("input",{type:"checkbox",checked:le,onChange:t=>Pe(t.target.checked)}),"At-risk runway watchlist"]})]}),e.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:J,className:"px-3 py-2 text-sm rounded-lg border border-border",children:"Cancel"}),e.jsx("button",{type:"button",disabled:b||!E,onClick:()=>{Le()},className:"px-4 py-2 text-sm rounded-lg bg-primary text-white disabled:opacity-50",children:b?"Saving…":"Save"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-ink-500 mt-3",children:"Invite a company that isn't on Medarion yet. They receive an email, create an account, and appear in your portfolio once they accept."}),e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsx("input",{value:K,onChange:t=>U(t.target.value),placeholder:"Company name",className:"w-full px-3 py-2 rounded-lg border border-border text-sm"}),e.jsx("input",{type:"email",value:D,onChange:t=>z(t.target.value),placeholder:"Company contact email",className:"w-full px-3 py-2 rounded-lg border border-border text-sm"})]}),re?e.jsx("p",{className:"mt-2 text-xs text-red-600",children:re}):null,oe?e.jsxs("p",{className:"mt-2 flex items-center gap-1.5 text-xs text-emerald-700",children:[e.jsx(bt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0})," Invite sent to ",oe,"."]}):null,e.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:J,className:"px-3 py-2 text-sm rounded-lg border border-border",children:"Close"}),e.jsx("button",{type:"button",disabled:b||!D.trim()||!K.trim(),onClick:()=>{Fe()},className:"inline-flex items-center gap-1.5 px-4 py-2 text-sm rounded-lg bg-primary text-white disabled:opacity-50",children:b?"Sending…":"Send invite"})]})]})]})}),Ce&&e.jsx("div",{className:"fixed inset-0 z-[70] bg-ink-950/45 flex items-center justify-center p-4",onClick:()=>S(!1),children:e.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border bg-white p-4 shadow-xl",onClick:t=>t.stopPropagation(),children:[e.jsx("h3",{className:"text-sm font-semibold text-ink-950",children:"Request data from portfolio company"}),e.jsx("p",{className:"text-xs text-ink-500 mt-1",children:"Company must already be in your portfolio."}),e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsxs("select",{value:G,onChange:t=>qe(t.target.value),className:"w-full px-3 py-2 rounded-lg border border-border text-sm bg-surface-muted",children:[e.jsx("option",{value:"",children:"Select company…"}),(r?.companies||[]).map(t=>e.jsx("option",{value:String(t.company_profile_id),children:t.company_name},t.company_profile_id))]}),e.jsx("input",{value:I,onChange:t=>me(t.target.value),placeholder:"Request title",className:"w-full px-3 py-2 rounded-lg border border-border text-sm"}),e.jsx("textarea",{value:xe,onChange:t=>pe(t.target.value),placeholder:"What KPI pack / period do you need?",rows:3,className:"w-full px-3 py-2 rounded-lg border border-border text-sm"})]}),e.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:()=>S(!1),className:"px-3 py-2 text-sm rounded-lg border border-border",children:"Cancel"}),e.jsx("button",{type:"button",disabled:b||!G||!I.trim(),onClick:()=>{Oe()},className:"px-4 py-2 text-sm rounded-lg bg-primary text-white disabled:opacity-50",children:b?"Sending…":"Send request"})]})]})})]})})}export{kt as PortfolioMonitoringPage};

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.