1import{j as e}from"./ui-DUAVJNs1.js";import{aY as Tt,y as Ye,aZ as Bt,b as Je,i as O,aa as z,T as Mt,B as V,L as Ze,m as It,c as g,a7 as ve,C as Xe,h as Rt,I as Dt,aD as ce,aE as de,aF as me,aG as xe,aH as W,aI as Ot,aJ as zt,aK as Pt,aL as Gt,aM as Wt,A as Vt,a0 as I,g as he,a_ as Ht,ac as Ut,an as qt,aj as Kt,a$ as Yt,b0 as Oe,b1 as Jt,a5 as Zt,b2 as Xt}from"./index-BwywcByt.js";import{a as o,h as Qt,u as es}from"./vendor-CijRnuT2.js";import{u as ts,c as ss,F as as}from"./usePersistForm-D2vwidRP.js";import{T as rs}from"./tooltip-cpWNKtVB.js";import{A as ke,b as Ce,m as _e,r as ns,c as we,e as Se,f as is,h as ls,s as Ee,j as Qe,S as et,o as os,k as cs,l as tt,n as st,p as ds,w as at,q as ms,t as xs,v as hs,x as us,g as K,y as ze,z as rt,B as ps,a as nt,C as it,D as fs,E as gs,i as ae,F as bs,u as ys,G as js,H as Ns,I as ws,J as vs,K as re,d as ee}from"./opportunityDisplay-CPhp1W9Y.js";import{a as ks,O as Cs}from"./OnboardingGate-VDehEHwr.js";import{A as lt}from"./index-jP6-w8o5.js";import{m as ot}from"./proxy-BhiTPxaj.js";import{M as _s}from"./create-proxy-C237khVD.js";import{u as Ss}from"./use-motion-value-DtDV9aFd.js";import{u as ct}from"./use-transform-ZvOwg_lx.js";import{T as Es}from"./target-BeKJ00yz.js";import{T as Ls}from"./trending-up-DaHfh8vf.js";import{E as Pe}from"./external-link-B5wUFyqo.js";import{B as Fs}from"./bookmark-B5TqWHkV.js";import{a as As,b as $s}from"./page-header-BpMFNjLe.js";import{u as Ts}from"./usePaywallCta-BLLE4JEt.js";import{C as Ge}from"./crown-CMQ_2-YL.js";import{R as Bs}from"./rocket-x88WxfFH.js";import{L as Ms}from"./landmark-xxhk00Ca.js";import{C as Is}from"./cloud-Bych6J1T.js";import"./query-ChSzzroE.js";import"./supabase-BNVGBqTv.js";import"./api-CdU8pFCJ.js";import"./form-D9VLyi60.js";import"./label-DAqmlqjg.js";import"./textarea-66W1gQ4l.js";import"./countries-D28X8I43.js";import"./types-BIHdVE_3.js";import"./useSmtpValidation-B8U0e2lk.js";import"./supabaseFunctionError-DWgQwzx3.js";import"./info-BsbI-ler.js";import"./shield-check-BpXTnL80.js";import"./outlook..-DRzDX3na.js";import"./server-DhNaPfHp.js";import"./use-presence-O32z5Cnk.js";import"./single-value--3OEXFt-.js";import"./pricing-5xScLnmC.js";function Rs(t,a,r){const s=t.get();let l=null,n=s,x;const p=typeof s=="string"?s.replace(/[\d.-]/g,""):void 0,d=()=>{l&&(l.stop(),l=null)},y=()=>{d(),l=new Bt({keyframes:[Ve(t.get()),Ve(n)],velocity:t.getVelocity(),type:"spring",restDelta:.001,restSpeed:.01,...r,onUpdate:x})};if(t.attach((u,f)=>{n=u,x=w=>f(We(w,p)),Tt.postRender(y)},d),Ye(a)){const u=a.on("change",w=>t.set(We(w,p))),f=t.on("destroy",u);return()=>{u(),f()}}return d}function We(t,a){return a?t+a:t}function Ve(t){return typeof t=="number"?t:parseFloat(t)}function Ds(t,a={}){const{isStatic:r}=o.useContext(_s),s=()=>Ye(t)?t.get():t;if(r)return ct(s);const l=Ss(s());return o.useInsertionEffect(()=>Rs(l,t,a),[l,JSON.stringify(a)]),l}const Os=Je("BookmarkCheck",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z",key:"169p4p"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}]]);const zs=Je("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]),Ps={queued:"Coach started researching your startup",processing:"Analyzing company profile",researching:"Searching grant, accelerator, and investor programs",generating:"Matching opportunities to your profile",saving:"Building your funding roadmap",completed:"Research complete"},Gs={grants:"Healthcare Grants",cloud_credits:"Cloud Credits",accelerators:"Accelerators",investors:"Investors",non_dilutive:"Non-dilutive funding"};function Ws(t){return t.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function dt(t,a){if(t==="incubators_accelerators")return"Accelerators";const r=a.benefit?.primary_benefit_type?.toLowerCase()??"";return r.includes("credit")?"Cloud Credits":t==="cash_grants"||r.includes("grant")?"Grants":"Cloud Credits"}function Vs(t,a){const r=dt(t,a);return r==="Accelerators"?"Accelerator":r==="Cloud Credits"?"Cloud Credits":r==="Investors"?"Investor":"Grant"}function Hs(t,a){return t.coach_note?.trim()||t.summary?.trim()||t.why_now?.trim()||(a==="incubators_accelerators"?"Accelerator program aligned with your stage and sector":a==="cash_grants"?"Non-dilutive funding aligned with your capital needs":"Funding program aligned with your startup profile")}function Us(t,a){const r=[],s=a?.founder_profile_normalized;return s?.primary_sector&&r.push(s.primary_sector),s?.normalized_stage&&r.push(s.normalized_stage),t.geography_scope&&r.push(t.geography_scope),t.program_format&&r.push(t.program_format),r.slice(0,4)}function mt(t,a){return`${t}::${String(a.name).toLowerCase().trim()}`}function qs(t,a){return[...t].sort((r,s)=>(s.item.match_score??0)-(r.item.match_score??0)).map(({section:r,item:s})=>({id:mt(r,s),name:String(s.name),category:dt(r,s),typeLabel:Vs(r,s),whyItMatches:Hs(s,r),matchTags:Us(s,a),confidence:Math.min(99,Math.round(s.match_score??(s.relevance_band??3)*20))}))}function Ks(t,a){const r=[],s=a?.founder_profile_normalized;if(s?.primary_sector)r.push(s.primary_sector);else if(t?.industry){const p=Array.isArray(t.industry)?t.industry.join(", "):t.industry;p&&r.push(p)}const l=s?.normalized_stage||t?.stage||t?.startup_stage;l&&r.push(`${l} stage`),t?.is_incorporated===!0&&r.push("Incorporated"),t?.open_to_equity===!1&&r.push("Looking for non-dilutive funding");const n=Array.isArray(t?.current_goal)?t.current_goal:[],x=n.length>0?n.slice(0,4).map(p=>Gs[p]||p.replace(/_/g," ")):["Grants","Accelerators","Cloud Credits"].slice(0,3);return{traits:r.slice(0,4),priorities:x.slice(0,4)}}function Ys(t){return{opportunities:t.length,accelerators:t.filter(a=>a.category==="Accelerators").length,grants:t.filter(a=>a.category==="Grants").length,investors:t.filter(a=>a.category==="Investors").length,cloudCredits:t.filter(a=>a.category==="Cloud Credits").length}}function Js(t,a,r,s){const[l,n]=o.useState([]),x=o.useRef(new Set),p=o.useRef(new Set),d=o.useRef(new Set),y=t?.status??"queued";o.useEffect(()=>{x.current.clear(),p.current.clear(),d.current.clear(),n([])},[t?.id]);const u=m=>{n(h=>{const j=m.id??`${m.timestamp.getTime()}-${m.message}`;return h.some(B=>B.id===j)?h:[...h,{...m,id:j}]})};o.useEffect(()=>{if(!t)return;const m=`${t.id}:${y}`;if(x.current.has(m))return;x.current.add(m);const h=Ps[y];h&&u({id:`status-${m}`,timestamp:new Date(t.updated_at||Date.now()),message:h})},[t,y]),o.useEffect(()=>{if(!t)return;const m=s?.founder_profile_normalized;if(m){if(m.primary_sector){const h=`sector-${m.primary_sector}`;d.current.has(h)||(d.current.add(h),u({id:h,timestamp:new Date,message:"Startup classified as",highlight:m.primary_sector}))}if(m.normalized_stage){const h=`stage-${m.normalized_stage}`;d.current.has(h)||(d.current.add(h),u({id:h,timestamp:new Date,message:"Traction profile identified",highlight:m.normalized_stage}))}}},[t,s?.founder_profile_normalized]),o.useEffect(()=>{t&&r.forEach(({section:m,item:h})=>{const j=mt(m,h);p.current.has(j)||(p.current.add(j),u({id:`opp-${j}`,timestamp:new Date,message:"Found opportunity:",highlight:String(h.name)}))})},[t,r]),o.useEffect(()=>{if(!t||y!=="processing"||!a)return;const h=(Array.isArray(a.industry)?a.industry.join(", "):a.industry)?.trim();if(h){const j=`profile-industry-${h}`;d.current.has(j)||(d.current.add(j),u({id:j,timestamp:new Date,message:"Market category detected",highlight:h}))}},[t,y,a?.industry]);const f=o.useMemo(()=>qs(r,s),[r,s]),w=o.useMemo(()=>{const m={Grants:[],Accelerators:[],Investors:[],"Cloud Credits":[]};return f.forEach(h=>{m[h.category].push(h)}),m},[f]),L=o.useMemo(()=>Ys(f),[f]),v=o.useMemo(()=>Ks(a,s),[a,s]),S=y==="completed",R=y==="failed";return{feedEvents:l,discoveries:f,groupedDiscoveries:w,counts:L,whyCoach:v,isComplete:S,isFailed:R,isResearching:!S&&!R}}function Zs(t){return t?ke.flatMap(a=>(Array.isArray(t[a])?t[a]:[]).filter(s=>!!s?.name).map(s=>({section:a,item:s}))):[]}const Xs=["Grants","Accelerators","Investors","Cloud Credits"];function Qs({value:t}){const a=Ds(t,{stiffness:120,damping:18,mass:.6}),r=ct(a,n=>Math.round(n)),[s,l]=o.useState(String(t));return o.useEffect(()=>{a.set(t)},[a,t]),o.useEffect(()=>r.on("change",x=>l(String(x))),[r]),e.jsx("span",{className:"tabular-nums",children:s})}function ea({isComplete:t,counts:a}){const r=[{label:"Opportunities Found",value:a.opportunities},{label:"Accelerators Found",value:a.accelerators},{label:"Grants Found",value:a.grants},{label:"Investors Found",value:a.investors}];return e.jsxs("div",{className:g("rounded-2xl border bg-white px-5 py-6 shadow-sm sm:px-8 sm:py-7",t?"border-emerald-200/80":"border-slate-200/90"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h2",{className:"text-xl font-semibold tracking-tight text-slate-900 sm:text-2xl",children:t?"Research Complete":"Finding opportunities for your startup"}),e.jsx("p",{className:"max-w-2xl text-sm leading-relaxed text-slate-600",children:t?`Coach discovered ${a.opportunities} relevant opportunit${a.opportunities===1?"y":"ies"}.`:"Coach is actively researching grants, accelerators, investors, and funding programs."})]}),e.jsx("div",{className:"mt-6 grid grid-cols-2 gap-3 sm:grid-cols-4",children:r.map(s=>e.jsxs("div",{className:"rounded-xl border border-slate-200/80 bg-slate-50/50 px-3 py-3 text-center",children:[e.jsx("p",{className:"text-2xl font-bold text-slate-900",children:e.jsx(Qs,{value:s.value})}),e.jsx("p",{className:"mt-1 text-[11px] font-medium leading-tight text-slate-500",children:s.label})]},s.label))}),t?e.jsxs("div",{className:"mt-4 flex flex-wrap gap-4 text-sm text-slate-600",children:[e.jsxs("span",{children:[e.jsx("strong",{className:"font-semibold text-slate-900",children:a.opportunities})," ","Opportunities Found"]}),e.jsxs("span",{children:[e.jsx("strong",{className:"font-semibold text-slate-900",children:a.accelerators})," ","Accelerators"]}),e.jsxs("span",{children:[e.jsx("strong",{className:"font-semibold text-slate-900",children:a.grants+a.cloudCredits})," ","Grants"]}),e.jsxs("span",{children:[e.jsx("strong",{className:"font-semibold text-slate-900",children:a.investors})," ","Investors"]})]}):null]})}function ta({events:t,isResearching:a}){const r=o.useRef(null);return o.useEffect(()=>{const s=r.current;s&&(s.scrollTop=s.scrollHeight)},[t.length]),e.jsxs(O,{className:"flex min-h-[420px] flex-col border-slate-200/90 bg-white shadow-sm",children:[e.jsxs(ve,{className:"shrink-0 space-y-1 px-5 pb-3 pt-5 sm:px-6",children:[e.jsx("h3",{className:"text-base font-semibold text-slate-900",children:"Discovery Feed"}),e.jsx("p",{className:"text-sm text-slate-500",children:"Live events as Coach researches."})]}),e.jsxs(z,{className:"flex min-h-0 flex-1 flex-col px-5 pb-5 sm:px-6",children:[e.jsx("ul",{ref:r,className:"min-h-0 flex-1 space-y-0 overflow-y-auto pr-1",children:e.jsx(lt,{initial:!1,children:t.map(s=>e.jsxs(ot.li,{initial:{opacity:0,y:6}
1,animate:{opacity:1,y:0},transition:{duration:.28,ease:"easeOut"},className:"border-b border-slate-100 py-3 last:border-0",children:[e.jsx("p",{className:"text-[11px] font-medium tabular-nums text-slate-400",children:Ws(s.timestamp)}),e.jsxs("p",{className:"mt-0.5 text-sm leading-snug text-slate-800",children:[s.message," ",s.highlight?e.jsx("span",{className:"font-semibold text-slate-900",children:s.highlight}):null]})]},s.id))})}),a&&t.length===0?e.jsxs("div",{className:"mt-4 rounded-xl border border-dashed border-slate-200 bg-slate-50/60 px-4 py-6 text-center",children:[e.jsx(Ze,{className:"mx-auto h-5 w-5 animate-spin text-brand-600","aria-hidden":!0}),e.jsx("p",{className:"mt-2 text-sm font-medium text-slate-700",children:"Searching opportunitiesâ¦"}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-slate-500",children:"We'll display grants, accelerators, and investors as soon as they are discovered."})]}):null,a&&t.length>0?e.jsxs("div",{className:"mt-3 flex items-center gap-2 border-t border-slate-100 pt-3 text-xs text-slate-500",children:[e.jsxs("span",{className:"relative flex h-2 w-2","aria-hidden":!0,children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-brand-400 opacity-50"}),e.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-brand-600"})]}),"Coach is still researchingâ¦"]}):null]})]})}function sa({discovery:t}){return e.jsxs(ot.article,{layout:!0,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.35,ease:"easeOut"},className:"rounded-xl border border-slate-200/90 bg-white p-4 shadow-sm",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-slate-900",children:t.name}),e.jsx("p",{className:"mt-0.5 text-xs font-medium text-slate-500",children:t.typeLabel})]}),e.jsxs("span",{className:"shrink-0 rounded-full bg-brand-50 px-2.5 py-1 text-[11px] font-semibold text-brand-700",children:[t.confidence,"% Match"]})]}),t.matchTags.length>0?e.jsxs("div",{className:"mt-2.5",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-slate-400",children:"Matches"}),e.jsx("ul",{className:"mt-1 space-y-0.5",children:t.matchTags.map(a=>e.jsx("li",{className:"text-xs text-slate-600",children:a},a))})]}):e.jsx("p",{className:"mt-2.5 text-xs leading-relaxed text-slate-600",children:t.whyItMatches})]})}function aa({grouped:t,hasAny:a,isResearching:r}){return e.jsxs(O,{className:"flex min-h-[420px] flex-col border-slate-200/90 bg-white shadow-sm",children:[e.jsxs(ve,{className:"shrink-0 space-y-1 px-5 pb-3 pt-5 sm:px-6",children:[e.jsx("h3",{className:"text-base font-semibold text-slate-900",children:"Opportunity Board"}),e.jsx("p",{className:"text-sm text-slate-500",children:"Discovered programs appear here immediately."})]}),e.jsx(z,{className:"min-h-0 flex-1 space-y-5 overflow-y-auto px-5 pb-5 sm:px-6",children:a?Xs.map(s=>{const l=t[s];return l.length===0?null:e.jsxs("section",{children:[e.jsx("h4",{className:"mb-2.5 text-xs font-semibold uppercase tracking-wide text-slate-500",children:s}),e.jsx("div",{className:"space-y-2.5",children:e.jsx(lt,{initial:!1,children:l.map(n=>e.jsx(sa,{discovery:n},n.id))})})]},s)}):e.jsx("div",{className:"rounded-xl border border-dashed border-slate-200 bg-slate-50/60 px-4 py-10 text-center",children:r?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm font-medium text-slate-700",children:"Searching opportunitiesâ¦"}),e.jsx("p",{className:"mx-auto mt-2 max-w-xs text-xs leading-relaxed text-slate-500",children:"We'll display grants, accelerators, and investors as soon as they are discovered."})]}):e.jsx("p",{className:"text-sm text-slate-500",children:"No opportunities matched this search."})})})]})}function ra({whyCoach:t,isResearching:a}){return t.traits.length===0&&t.priorities.length===0?null:e.jsxs(O,{className:"border-slate-200/90 bg-white shadow-sm",children:[e.jsx(ve,{className:"space-y-1 px-5 pb-3 pt-5 sm:px-6",children:e.jsx("h3",{className:"text-base font-semibold text-slate-900",children:"Why Coach Is Looking Here"})}),e.jsxs(z,{className:"space-y-4 px-5 pb-5 text-sm text-slate-700 sm:px-6",children:[t.traits.length>0?e.jsxs("div",{children:[e.jsx("p",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-slate-500",children:"We identified your startup as"}),e.jsx("ul",{className:"space-y-1",children:t.traits.map(r=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"mt-2 h-1 w-1 shrink-0 rounded-full bg-slate-400"}),e.jsx("span",{children:r})]},r))})]}):null,t.priorities.length>0?e.jsxs("div",{children:[e.jsx("p",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-slate-500",children:a?"Because of this Coach is prioritizing":"Coach prioritized"}),e.jsx("ul",{className:"flex flex-wrap gap-2",children:t.priorities.map(r=>e.jsxs("li",{className:"inline-flex items-center gap-1.5 rounded-full border border-emerald-200/80 bg-emerald-50/70 px-2.5 py-1 text-xs font-medium text-emerald-800",children:[e.jsx(Xe,{className:"h-3 w-3","aria-hidden":!0}),r]},r))})]}):null]})]})}function na({error:t,onRetry:a,retrying:r}){return e.jsx(O,{className:"border-rose-200/80 bg-gradient-to-br from-white via-rose-50/40 to-rose-50/70 shadow-sm",children:e.jsxs(z,{className:"flex flex-col items-center gap-4 px-6 py-10 text-center",children:[e.jsx("span",{className:"inline-flex h-12 w-12 items-center justify-center rounded-full bg-rose-100 text-rose-700",children:e.jsx(Mt,{className:"h-6 w-6","aria-hidden":!0})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Research failed"}),e.jsx("p",{className:"mx-auto max-w-md text-sm text-slate-600",children:t||"Something went wrong while Coach was researching opportunities."})]}),a?e.jsxs(V,{onClick:a,disabled:r,className:"h-10 rounded-xl bg-brand-600 px-5 text-sm font-semibold text-white shadow-sm hover:bg-brand-700",children:[r?e.jsx(Ze,{className:"mr-2 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(It,{className:"mr-2 h-4 w-4","aria-hidden":!0}),"Try again"]}):null]})})}function ia({job:t,companyProfile:a,opportunities:r=[],analysis:s,onRetry:l,retrying:n}){const{feedEvents:x,groupedDiscoveries:p,counts:d,whyCoach:y,isComplete:u,isFailed:f,isResearching:w}=Js(t,a,r,s),L=d.opportunities>0;return f?e.jsx(na,{error:t.error,onRetry:l,retrying:n}):e.jsxs("div",{className:"space-y-5",id:"funding-intelligence-workspace",children:[e.jsx(ea,{isComplete:u,counts:d}),e.jsxs("div",{className:"grid grid-cols-1 gap-5 lg:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]",children:[e.jsxs("div",{className:"space-y-5",children:[e.jsx(ta,{events:x,isResearching:w}),e.jsx(ra,{whyCoach:y,isResearching:w})]}
1),e.jsx(aa,{grouped:p,hasAny:L,isResearching:w})]})]})}function oe({label:t,value:a,valueClassName:r}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("dt",{className:"text-[10px] font-semibold uppercase tracking-[0.06em] text-coach-ink-3",children:t}),e.jsx("dd",{className:g("mt-0.5 text-[13px] font-semibold leading-snug text-coach-ink",r),children:a})]})}function la({record:t,fallbackReason:a,onReview:r}){const{item:s,section:l}=t,n=Ce(s),x=_e(s),p=ns(s),d=we(s)??"â",y=Se(s),u=Qe(l),f=s.benefit?.equity_required?"Required":"None",w=is(s)??"Program support",L=Ee[l],v=ls(s)||(a&&a.trim()?a.trim():null);return e.jsx("section",{role:"button",tabIndex:0,onClick:()=>r(t),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),r(t))},className:g("overflow-hidden rounded-xl border border-amber-200/70 bg-gradient-to-br from-amber-50/25 via-white to-indigo-50/20","shadow-sm ring-1 ring-amber-100/40","cursor-pointer transition-all duration-200","hover:border-amber-300/80 hover:shadow-md hover:ring-amber-200/60","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#2563EB]/40 focus-visible:ring-offset-2"),"aria-label":`Review opportunity: ${s.name}`,children:e.jsxs("div",{className:"grid grid-cols-1 items-start lg:grid-cols-[1fr_240px] xl:grid-cols-[1fr_260px]",children:[e.jsxs("div",{className:"flex flex-col gap-4 p-5 pb-6 sm:gap-5 sm:p-6 lg:border-r lg:border-coach-line",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-amber-800",children:[e.jsx(Es,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),"#1 Recommended · Best next move"]}),e.jsx("h2",{className:"text-lg font-semibold leading-snug tracking-tight text-coach-ink sm:text-xl",children:s.name})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[x?e.jsx("span",{className:"text-sm font-bold text-indigo-700",children:x}):p?e.jsx("span",{className:g("inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] font-semibold",p.className),children:p.label}):null,n?e.jsxs("span",{className:"text-lg font-bold tabular-nums text-coach-money sm:text-2xl",children:[n.replace(" cash",""),e.jsx("span",{className:"ml-1 text-xs font-medium text-coach-ink-3",children:"potential funding"})]}):null]}),v?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-coach-ink-3",children:"Why Coach recommends this"}),e.jsx("p",{className:"max-w-2xl text-base leading-relaxed text-coach-ink-2 sm:text-14px]",children:v})]}):null]}),e.jsxs("div",{className:"border-t border-coach-line bg-coach-inset/25 p-4 pb-5 lg:border-t-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("p",{className:"flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-coach-ink-3",children:[e.jsx(zs,{className:"h-3 w-3 shrink-0 text-indigo-600","aria-hidden":!0}),"Quick snapshot"]}),e.jsx("span",{className:"shrink-0 rounded-full border border-coach-line bg-white px-2 py-0.5 text-[10px] font-semibold text-coach-ink-2",children:L})]}),e.jsxs("div",{className:"mt-2 rounded-lg border border-coach-line/80 bg-white/80 p-2.5",children:[e.jsxs("dl",{className:"grid grid-cols-2 gap-x-3 gap-y-2",children:[e.jsx(oe,{label:"Deadline",value:d}),e.jsx(oe,{label:"Effort",value:y?e.jsx("span",{className:g("inline-flex rounded-full border px-1.5 py-px text-[11px] font-semibold",y.className),children:y.label.replace(" effort","")}):"â"}),e.jsx(oe,{label:"Funding type",value:u}),e.jsx(oe,{label:"Equity",value:f})]}),e.jsxs("div",{className:"mt-2 border-t border-coach-line/80 pt-2",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.06em] text-coach-ink-3",children:"Expected outcome"}),e.jsx("p",{className:"mt-0.5 text-[13px] leading-snug text-coach-ink-2",children:w})]})]})]})]})})}function oa({totalValueLabel:t,opportunityCount:a,strongMatchCount:r}){return e.jsxs("section",{className:"coach-card flex flex-col gap-3 p-4 pb-5 sm:flex-row sm:items-center sm:justify-between sm:gap-4 sm:pb-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-coach-ink-3",children:[e.jsx(Ls,{className:"h-3 w-3 shrink-0 text-coach-money","aria-hidden":!0}),"Funding potential"]}),e.jsx("p",{className:"mt-1 text-3xl font-bold leading-none tabular-nums tracking-tight text-coach-money sm:text-[2rem]",children:t}),e.jsxs("p",{className:"mt-1 text-[13px] text-coach-ink-2",children:["Across ",a," opportunit",a===1?"y":"ies"]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2 rounded-lg border border-coach-line/80 bg-coach-inset/40 px-3 py-2 sm:flex-col sm:items-end sm:gap-0 sm:border-0 sm:bg-transparent sm:px-0 sm:py-0",children:[e.jsx("span",{className:"text-xl font-bold tabular-nums leading-none text-coach-ink sm:text-2xl",children:r}),e.jsx("span",{className:"text-[13px] font-medium text-coach-ink-2",children:"strong matches"})]})]})}const He={all:"All statuses",pipeline:"My pipeline",saved:"Saved",applying:"Ap
1plying",submitted:"Submitted",accepted:"Accepted",funded:"Funded",rejected:"Rejected"},ca={all:"All fits",strong:"Strong fit",good:"Good fit"},da={best_match:"Best match",highest_funding:"Highest funding",deadline:"Deadline",newest:"Newest"},Ne="h-8 w-[7.75rem] shrink-0 rounded-md border-coach-line bg-white px-2.5 text-[13px] shadow-none";function ma({activeTab:t,onTabChange:a,counts:r}){const s=[{key:"all",label:"All",count:r.all},{key:"incubators_accelerators",label:"Accelerators",count:r.incubators_accelerators},{key:"cash_grants",label:"Grants",count:r.cash_grants},{key:"tech_grants",label:"Credits",count:r.tech_grants}];return e.jsx("div",{className:"flex gap-1 overflow-x-auto border-b border-coach-line [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",role:"tablist","aria-label":"Opportunity categories",children:s.map(l=>{const n=t===l.key;return e.jsxs("button",{type:"button",role:"tab","aria-selected":n,disabled:l.disabled,onClick:()=>!l.disabled&&a(l.key),className:g("relative shrink-0 px-3 py-2 text-[13px] font-medium transition-colors",n?"text-[#2563EB] after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:rounded-full after:bg-[#2563EB]":"text-coach-ink-3 hover:text-coach-ink",l.disabled&&"cursor-not-allowed opacity-40"),children:[l.label,e.jsxs("span",{className:g("ml-1 tabular-nums",n?"text-[#2563EB]/80":"text-coach-ink-3"),children:["(",l.count,")"]})]},l.key)})})}function xa({activeCategoryTab:t,onCategoryTabChange:a,tabCounts:r,search:s,onSearchChange:l,fitFilter:n,onFitChange:x,statusFilter:p,onStatusChange:d,pipelineCount:y,sortBy:u,onSortChange:f,hasFiltersApplied:w,onClearFilters:L}){return e.jsxs("div",{className:"border-b border-blue-100/70 bg-gradient-to-b from-blue-50/25 to-white px-4 pt-2.5 pb-4",children:[e.jsx(ma,{activeTab:t,onTabChange:a,counts:r}),e.jsxs("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:[e.jsxs("div",{className:"relative min-w-[12rem] flex-1 sm:max-w-xs",children:[e.jsx(Rt,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[#2563EB]/60","aria-hidden":!0}),e.jsx(Dt,{value:s,onChange:v=>l(v.target.value),placeholder:"Search opportunities...",className:"h-8 border-coach-line bg-white pl-8 text-[13px] shadow-none focus-visible:border-[#2563EB]/40 focus-visible:ring-[#2563EB]/20"})]}),e.jsxs(ce,{value:n,onValueChange:v=>x(v),children:[e.jsx(de,{className:g(Ne,n!=="all"&&"border-[#2563EB]/30 bg-blue-50/50 text-[#2563EB]"),children:e.jsx(me,{children:ca[n]})}),e.jsxs(xe,{children:[e.jsx(W,{value:"all",children:"All fits"}),e.jsx(W,{value:"strong",children:"Strong fit"}),e.jsx(W,{value:"good",children:"Good fit"})]})]}),e.jsxs(ce,{value:p,onValueChange:v=>d(v),children:[e.jsx(de,{className:g(Ne,p!=="all"&&"border-[#2563EB]/30 bg-blue-50/50 text-[#2563EB]"),"aria-label":"Filter by application status",children:e.jsx(me,{children:He[p]})}),e.jsx(xe,{children:et.map(v=>e.jsx(W,{value:v,children:v==="pipeline"?`My pipeline (${y})`:He[v]},v))})]}),e.jsxs(ce,{value:u,onValueChange:v=>f(v),children:[e.jsx(de,{className:g(Ne,u!=="best_match"&&"border-[#2563EB]/30 bg-blue-50/50 text-[#2563EB]"),children:e.jsx(me,{children:da[u]})}),e.jsxs(xe,{children:[e.jsx(W,{value:"best_match",children:"Best match"}),e.jsx(W,{value:"highest_funding",children:"Highest funding"}),e.jsx(W,{value:"deadline",children:"Deadline"}),e.jsx(W,{value:"newest",children:"Newest"})]})]}),w?e.jsx("button",{type:"button",onClick:L,className:"shrink-0 px-1 text-[13px] text-[#2563EB] underline-offset-2 hover:text-[#1d4ed8] hover:underline",children:"Clear filters"}):null]})]})}const ha=["saved","applying","submitted","rejected","accepted","funded"];function ua(t,a){switch(t){case"saved":return{status:"Remind me"};case"applying":return{status:"Remind me",note:"Applying"};case"submitted":return{status:"Registered",note:a?.trim()||void 0};case"rejected":return{status:"Rejected"};case"accepted":return{status:"Registered",note:"Accepted"};case"funded":return{status:"Registered",note:"Funded"};case"dismissed":return{status:"Not interest"};default:return{status:"Not Register"}}}function te({label:t,value:a,tone:r="default"}){const s=!!a;return e.jsxs("div",{className:g("min-w-0 rounded-lg border px-3 py-2",r==="critical"&&s?"border-rose-200 bg-rose-50/70":r==="soon"&&s?"border-amber-200 bg-amber-50/70":"border-coach-line bg-white"),children:[e.jsx("dt",{className:"text-[10px] font-semibold uppercase tracking-wider text-coach-ink-3",children:t}),e.jsx("dd",{className:g("mt-0.5 truncate text-sm font-semibold",s?r==="critical"?"text-rose-800":r==="soon"?"text-amber-800":"text-coach-ink":"font-normal italic text-coach-ink-3"),title:a??void 0,children:a??"Not listed"})]})}function pa({record:t,open:a,onOpenChange:r,onUpdateStatus:s,isUpdating:l=!1}){if(!t)return null;const{item:n,section:x}=t,p=rt[x],d=_e(n),y=os(n),u=Ce(n),f=cs(n),w=tt(n),L=st(n),v=Se(n),S=ds(n),R=at
1(n),P=ms(n),m=xs(n),h=hs(n),j=us(n),B=K(n),_=ze(n.benefit?.cash_amount),D=ze(n.benefit?.credits_amount),A=C=>{const{status:J,note:ne}=ua(C,n.note);s(t,J,ne)},H=()=>{j&&window.open(j,"_blank","noopener,noreferrer"),(B==="discovery"||B==="saved"||B==="applying")&&s(t,"Registered",n.note?.trim()||void 0)},T="text-xs font-semibold uppercase tracking-[0.1em] text-blue-800/70";return e.jsx(Ot,{open:a,onOpenChange:r,children:e.jsxs(zt,{side:"right",className:"flex w-full flex-col gap-0 border-coach-line bg-white p-0 sm:max-w-[min(640px,100vw)]","aria-describedby":"opportunity-drawer-description",children:[e.jsxs(Pt,{className:"shrink-0 space-y-2.5 border-b border-blue-100/80 bg-gradient-to-br from-blue-50/60 via-white to-indigo-50/40 px-5 py-5 pr-12 text-left sm:px-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:g("inline-flex rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide",p.badge),children:Qe(x)}),d?e.jsx("span",{className:"inline-flex items-center rounded-full border border-[#2563EB]/25 bg-[#2563EB]/10 px-2 py-0.5 text-[11px] font-bold text-[#2563EB]",children:d}):null]}),e.jsx(Gt,{className:"text-xl font-semibold leading-tight text-coach-ink sm:text-2xl",children:n.name}),e.jsx(Wt,{id:"opportunity-drawer-description",className:g("text-sm leading-relaxed sm:text-[15px]",y?"text-coach-ink-2":"sr-only"),children:y??`Opportunity details for ${n.name}`})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-5 sm:px-6",children:[e.jsxs("dl",{className:"mb-5 grid grid-cols-2 gap-2 sm:grid-cols-3",children:[e.jsx(te,{label:"Deadline",value:f,tone:w==="critical"?"critical":w==="soon"?"soon":"default"}),e.jsx(te,{label:"Amount",value:u}),e.jsx(te,{label:"Funding type",value:L}),e.jsx(te,{label:"Effort",value:v?.label??null}),e.jsx(te,{label:"Location",value:S})]}),R?e.jsxs("section",{className:"mb-6 rounded-xl border border-emerald-100/90 bg-emerald-50/50 p-4 sm:p-5",children:[e.jsx("h3",{className:T,children:"Why it fits"}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-coach-ink-2 sm:text-[15px]",children:R})]}):null,P?e.jsxs("section",{className:"mb-6 rounded-xl border border-slate-200/80 bg-slate-50/70 p-4 sm:p-5",children:[e.jsx("h3",{className:T,children:"Program overview"}),e.jsx("p",{className:"mt-3 whitespace-pre-wrap text-sm leading-relaxed text-coach-ink-2 sm:text-[15px]",children:P})]}):null,m.length>0?e.jsxs("section",{className:"mb-6 rounded-xl border border-amber-100/80 bg-amber-50/35 p-4 sm:p-5",children:[e.jsx("h3",{className:T,children:"Eligibility"}),e.jsx("ul",{className:"mt-3 list-disc space-y-1.5 pl-5 marker:text-amber-600/80",children:m.map(C=>e.jsx("li",{className:"text-sm text-coach-ink-2 sm:text-[15px]",children:C},C))})]}):null,(n.program_length?.trim()||n.suggested_next_step?.trim())&&e.jsxs("section",{className:"mb-6 rounded-xl border border-blue-100/80 bg-blue-50/35 p-4 sm:p-5",children:[e.jsx("h3",{className:T,children:"Application process"}),e.jsxs("dl",{className:"mt-3 grid grid-cols-1 gap-x-4 gap-y-2.5 text-sm sm:grid-cols-[7rem_minmax(0,1fr)] sm:items-start sm:text-[15px]",children:[n.program_length?.trim()?e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"font-medium text-coach-ink",children:"Timeline"}),e.jsx("dd",{className:"min-w-0 text-coach-ink-2",children:n.program_length.trim()})]}):null,n.suggested_next_step?.trim()?e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"shrink-0 font-medium text-coach-ink sm:whitespace-nowrap",children:"Next step"}),e.jsx("dd",{className:"min-w-0 leading-relaxed text-coach-ink-2",children:n.suggested_next_step.trim()})]}):null]})]}),(_||D||n.benefit?.equity_required)&&e.jsxs("section",{className:"mb-6 rounded-xl border border-emerald-100/80 bg-coach-money-soft/80 p-4 sm:p-5",children:[e.jsx("h3",{className:T,children:"What you get"}),e.jsxs("div",{className:"mt-3 space-y-1 text-sm text-coach-ink-2 sm:text-[15px]",children:[_?e.jsxs("p",{className:"font-semibold text-coach-money",children:[_," cash"]}):null,D?e.jsxs("p",{className:"font-medium text-coach-ink",children:[D," in credits"]}):null,n.benefit?.equity_required?e.jsxs("p",{className:"font-medium text-amber-800",children:["Equity required",n.benefit.equity_terms?.trim()?` â ${n.benef
1it.equity_terms.trim()}`:""]}):null]})]}),h.length>0?e.jsxs("section",{className:"rounded-xl border border-slate-200/80 bg-slate-50/50 p-4 sm:p-5",children:[e.jsx("h3",{className:T,children:"Sources"}),e.jsx("ul",{className:"mt-3 space-y-2",children:h.map((C,J)=>e.jsx("li",{children:e.jsxs("a",{href:C.url,target:"_blank",rel:"noopener noreferrer",className:"group flex items-center justify-between gap-3 rounded-lg border border-coach-line bg-white px-3 py-2.5 text-sm text-coach-ink-2 transition-colors hover:border-[#2563EB]/35 hover:bg-blue-50/60 hover:text-[#1d4ed8]",children:[e.jsx("span",{children:ps(C,J)}),e.jsx(Pe,{className:"h-3.5 w-3.5 shrink-0 opacity-50 group-hover:opacity-100"})]})},C.url))})]}):null]}),e.jsxs("div",{className:"shrink-0 space-y-3 border-t border-blue-100/80 bg-gradient-to-t from-slate-50/90 to-white px-5 py-4 sm:px-6",children:[w!=="normal"&&f?e.jsxs("p",{className:g("flex items-center gap-1.5 text-xs font-medium",w==="critical"?"text-rose-700":"text-amber-700"),children:[e.jsx(nt,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Deadline ",f]}):null,j?e.jsxs(V,{type:"button",variant:"default",className:"h-11 w-full rounded-lg text-sm font-semibold",onClick:H,disabled:l,children:["Apply now",e.jsx(Pe,{className:"ml-2 h-4 w-4","aria-hidden":!0})]}):null,B!=="dismissed"?e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs(ce,{value:B==="discovery"?void 0:B,onValueChange:C=>A(C),disabled:l,children:[e.jsx(de,{className:"h-9 w-full min-w-0 flex-1 border-coach-line bg-white","aria-label":"Update your application progress",children:e.jsx(me,{placeholder:"Update progress"})}),e.jsx(xe,{children:ha.map(C=>e.jsx(W,{value:C,children:it[C]},C))})]})}):null]})]})})}function Ue({record:t,rank:a,onOpen:r,onToggleSave:s,isUpdating:l=!1}){const{item:n,section:x}=t,p=Ce(n),d=at(n,{fallbackToNote:!1}),y=fs(n),u=gs(n),f=ae(n),w=tt(n),L=_e(n),v=Se(n),S=st(n),R=a===2||a===3,P=rt[x],m=K(n),h=m!=="discovery"&&m!=="dismissed",j=m==="saved",B=!!s&&(m==="discovery"||j)&&!f,_=A=>{A.target===A.currentTarget&&(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),r(t))},D=A=>{A.stopPropagation(),s?.(t,!j)};return e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>r(t),onKeyDown:_,"aria-label":`View details for ${n.name}`,className:g("group relative flex h-full w-full flex-col rounded-xl border border-l-4 bg-gradient-to-br to-white p-5 text-left",P.stripe,P.wash,"cursor-pointer transition-all duration-200 ease-out","hover:-translate-y-0.5 hover:border-[#2563EB]/35 hover:shadow-md","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#2563EB]/40 focus-visible:ring-offset-2",R?"border-blue-200/90 shadow-sm ring-1 ring-blue-100/60":"border-coach-line/90",f&&"opacity-70 saturate-50 hover:translate-y-0 hover:shadow-none"),children:[e.jsxs("div",{className:"mb-2 flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:g("inline-flex rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide",P.badge),children:Ee[x]}),f?e.jsx("span",{className:"inline-flex items-center rounded-full border border-slate-200 bg-slate-100 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-slate-500",children:"Closed"}):h?e.jsx("span",{className:g("inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-semibold",bs[m]),children:it[m]}):null]}),e.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[R?e.jsxs("span",{className:"inline-flex items-center rounded-full border border-[#2563EB]/25 bg-[#2563EB]/10 px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide text-[#2563EB]",children:["#",a," match"]}):null,B?e.jsx("button",{type:"button",onClick:D,disabled:l,"aria-pressed":j,"aria-label":j?`Remove ${n.name} from saved`:`Save ${n.name} for later`,title:j?"Remove from saved":"Save for later",className:g("-m-1 rounded-md p-1 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#2563EB]/40",j?"text-[#2563EB] hover:bg-blue-50":"text-coach-ink-3 hover:bg-blue-50 hover:text-[#2563EB]",l&&"opacity-50"),children:j?e.jsx(Os,{className:"h-4 w-4","aria-hidden":!0}):e.jsx(Fs,{className:"h-4 w-4","aria-hidden":!0})}):null]})]}),e.jsx("h3",{className:"text-base font-semibold leading-snug text-coach-ink transition-colors group-hover:text-[#2563EB] sm:text-[17px]",children:n.name}),p?e.jsx("p",{className:"mt-3 text-2xl font-bold leading-none tabular-nums text-coach-money sm:text-3xl",children:p.replace(" cash","")}):e.jsx("p",{className:"mt-3 text-xs font-medium italic text-coach-ink-3",children:"Amount not listed"}),L?e.jsx("p",{className:"mt-2 text-sm font-semibold text-[#2563EB]",children:L}):null,d?e.jsx("p",{className:"mt-2 line-clamp-2 text-[13px] leading-snug text-coach-ink-2 sm:text-sm",children:d}):null,e.jsxs("div",{className:"mt-auto flex flex-wrap items-center gap-x-3 gap-y-1.5 pr-6 pt-3",children:[f?e.jsxs("span",{className:"text-xs font-medium text-coach-ink-3",children:["Closed",y?` · ${y}`:""]}):u&&y?e.jsxs("span",{className:g("inline-flex items-center gap-1 text-xs",w==="critical"?"font-semibold text-coach-flag":w==="soon"?"font-semibold text-amber-700":"font-medium text-coach-ink-3"),children:[e.jsx(nt,{className:g("h-3 w-3",w==="normal"&&"text-[#2563EB]/70"),"aria-hidden":!0}),y]}):we(n)?e.jsx("span",{className:"text-xs text-coach-ink-3",children:we(n)}):e.jsx("span",{className:"text-xs font-medium italic text-coach-ink-3",children:"Deadline not listed"}),v?e.jsx("span",{className:g("inline-flex rounded-full border px-1.5 py-px text-[10px] font-semibold",v.className),children:v.label}):null,S?e.jsx("span",{className:g("text-xs font-medium",S==="Non-dilutive"?"text-emerald-700":"text-amber-700"),children:S}):null]}),e.jsx(Vt,{className:"absolute bottom-5 right-4 h-4 w-4 text-coach-ink-3 op
1acity-0 transition-all duration-200 group-hover:translate-x-0.5 group-hover:text-[#2563EB] group-hover:opacity-100","aria-hidden":!0})]})}const fa=["Match scores","Real amounts","Honest eligibility"],ga="Your funding pipeline opportunities matched to you, from Saved to Funded.",ba="Coach is researching opportunities tailored to your startup.";function ya(){const[t,a]=o.useState(!1);return o.useEffect(()=>{const r=window.matchMedia("(prefers-reduced-motion: reduce)"),s=()=>a(r.matches);return s(),r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[]),t}const b={x:200,y:110},se=[{id:"cash",cx:72,cy:48,accent:"mint"},{id:"cloud",cx:328,cy:52,accent:"indigo"},{id:"rocket",cx:58,cy:178,accent:"indigo"},{id:"ai",cx:342,cy:172,accent:"indigo"},{id:"building",cx:200,cy:28,accent:"indigo"}];function ja({id:t,accent:a}){const r=a==="mint"?"#059669":"#4f46e5";return t==="cash"?e.jsx("text",{textAnchor:"middle",dominantBaseline:"central",fontSize:"13",fontWeight:"700",fill:r,fontFamily:"Inter, system-ui, sans-serif",children:"$"}):t==="cloud"?e.jsx("path",{d:"M-7 2c0-3.3 2.7-5.5 5.5-5.5 1.8 0 3.4.9 4.3 2.2.6-.3 1.3-.5 2-.5 2.5 0 4.5 2 4.5 4.5 0 .3 0 .6-.1.9 1.8.4 3.1 2 3.1 3.9 0 2.2-1.8 4-4 4H-5c-2.8 0-5-2.2-5-5 0-2.4 1.7-4.4 4-4.8z",fill:r,opacity:"0.9"}):t==="rocket"?e.jsx("path",{d:"M0-8 L4 4 L0 2 L-4 4 Z M0 2 L0 8 M-3 6 L3 6",fill:"none",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}):t==="ai"?e.jsx("path",{d:"M0 -7 L1.8 -1.8 L7.5 -1.8 L2.8 1.4 L4.6 7 L0 3.8 L-4.6 7 L-2.8 1.4 L-7.5 -1.8 L-1.8 -1.8 Z",fill:r}):e.jsxs("g",{fill:r,children:[e.jsx("rect",{x:-5,y:-2,width:10,height:9,rx:1}),e.jsx("rect",{x:-3.5,y:-6,width:7,height:4,rx:.5})]})}function xt({className:t,compact:a}){const r=ya();return e.jsxs("div",{className:g("coach-scan-hero mx-auto w-full max-w-[400px]",r&&"coach-scan-hero--static",t),"aria-hidden":!0,children:[e.jsxs("svg",{viewBox:"0 0 400 220",className:g("w-full",a?"h-[88px] sm:h-[96px]":"h-[120px] sm:h-[140px] md:h-[160px]"),role:"img","aria-label":"Scanning the web for funding opportunities",children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"coach-scan-wedge",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:"#6366f1",stopOpacity:"0.18"}),e.jsx("stop",{offset:"100%",stopColor:"#6366f1",stopOpacity:"0"})]}),e.jsxs("radialGradient",{id:"coach-scan-ring",cx:"50%",cy:"50%",r:"50%",children:[e.jsx("stop",{offset:"0%",stopColor:"#6366f1",stopOpacity:"0.22"}),e.jsx("stop",{offset:"100%",stopColor:"#6366f1",stopOpacity:"0"})]}),e.jsx("filter",{id:"coach-scan-soft",x:"-20%",y:"-20%",width:"140%",height:"140%",children:e.jsx("feGaussianBlur",{stdDeviation:"1.5"})})]}),[0,1,2].map(s=>e.jsx("circle",{className:`coach-scan-ring coach-scan-ring-${s}`,cx:b.x,cy:b.y,r:36,fill:"none",stroke:"url(#coach-scan-ring)",strokeWidth:"1.5"},`ring-${s}`)),e.jsx("path",{className:"coach-scan-sweep",d:`M ${b.x} ${b.y} L ${b.x+95} ${b.y-12} A 95 95 0 0 0 ${b.x+88} ${b.y-55} Z`,fill:"url(#coach-scan-wedge)",opacity:"0.55",transform:`rotate(0 ${b.x} ${b.y})`}),se.map((s,l)=>e.jsx("line",{className:`coach-scan-line coach-scan-line-${l}`,x1:s.cx,y1:s.cy,x2:b.x,y2:b.y,stroke:"#a5b4fc",strokeWidth:"1.25",strokeLinecap:"round"},`line-${s.id}`)),se.map((s,l)=>e.jsxs("g",{className:`coach-scan-node coach-scan-node-${l}`,transform:`translate(${s.cx}, ${s.cy})`,children:[e.jsx("circle",{r:16,fill:s.accent==="mint"?"#ecfdf5":"#f5f3ff",stroke:s.accent==="mint"?"#34d399":"#c7d2fe",strokeWidth:"1.25"}),e.jsx(ja,{id:s.id,accent:s.accent})]},s.id)),e.jsxs("g",{className:"coach-scan-hub",transform:`translate(${b.x}, ${b.y})`,children:[e.jsx("rect",{x:-22,y:-22,width:44,height:44,rx:12,fill:"#eef2ff",stroke:"#6366f1",strokeWidth:"1.75"}),e.jsx("path",{d:"M0 -9 L2.2 -2.2 L9 -2.2 L3.4 1.6 L5.6 8.4 L0 4.6 L-5.6 8.4 L-3.4 1.6 L-9 -2.2 L-2.2 -2.2 Z",fill:"#6366f1"})]})]}),e.jsx("style",{children:` 2 .coach-scan-hero { 3 --loop: 7s; 4 } 5 6 .coach-scan-hub { 7 transform-origin: ${b.x}px ${b.y}px; 8 animation: coach-scan-hub-pulse var(--loop) ease-in-out infinite; 9 } 10 11 @keyframes coach-scan-hub-pulse { 12 0%, 100% { transform: translate(${b.x}px, ${b.y}px) scale(1); } 13 50% { transform: translate(${b.x}px, ${b.y}px) scale(1.04); } 14 } 15 16 .coach-scan-ring { 17 transform-origin: ${b.x}px ${b.y}px; 18 opacity: 0; 19 animation: coach-scan-ring-expand var(--loop) ease-out infinite; 20 } 21 .coach-scan-ring-0 { animation-delay: 0s; } 22 .coach-scan-ring-1 { animation-delay: calc(var(--loop) / 3); } 23 .coach-scan-ring-2 { animation-delay: calc(var(--loop) * 2 / 3); } 24 25 @keyframes coach-scan-ring-expand { 26 0% { transform: scale(0.55); opacity: 0.5; } 27 55% { opacity: 0.12; } 28 100% { transform: scale(2.35); opacity: 0; } 29 } 30 31 .coach-scan-sweep { 32 transform-origin: ${b.x}px ${b.y}px; 33 animation: coach-scan-sweep-rotate var(--loop) linear infinite; 34 } 35 36 @keyframes coach-scan-sweep-rotate { 37 from { transform: rotate(0deg); } 38 to { transform: rotate(360deg); } 39 } 40 41 .coach-scan-line { 42 stroke-dasharray: 120; 43 stroke-dashoffset: 120; 44 opacity: 0; 45 } 46 ${se.map((s,l)=>` 47 .coach-scan-line-${l} { 48 animation: coach-scan-line-draw var(--loop) ease-out infinite; 49 animation-delay: ${1+l*.4}s; 50 }`).join("")} 51 52 @keyframes coach-scan-line-draw { 53 0%, 12% { stroke-dashoffset: 120; opacity: 0; } 54 28% { opacity: 0.85; } 55 45%, 88% { stroke-dashoffset: 0; opacity: 0.7; } 56 100% { stroke-dashoffset: 0; opacity: 0; } 57 } 58 59 .coach-scan-node { 60 opacity: 0; 61 } 62 ${se.map((s,l)=>{const n=b.x-s.cx,x=b.y-s.cy;return` 63 .coach-scan-node-${l} { 64 animation: coach-scan-node-${l} var(--loop) ease-out infinite; 65 animation-delay: ${1+l*.4}s; 66 } 67 @keyframes coach-scan-node-${l} { 68 0%, 10% { opacity: 0; transform: translate(${s.cx}px, ${s.cy}px) scale(0.85); } 69 22% { opacity: 1; transform: translate(${s.cx}px, ${s.cy}px) scale(1); } 70 50%, 82% { 71 opacity: 1; 72 transform: translate(${s.cx+n*.12}px, ${s.cy+x*.12}px) scale(1); 73 } 74 100% { opacity: 0; transform: translate(${s.cx+n*.18}px, ${s.cy+x*.18}px) scale(0.92); } 75 }`}).join("")} 76 77 .coach-scan-hero--static .coach-scan-hub, 78 .coach-scan-hero--static .coach-scan-ring, 79 .coach-scan-hero--static .coach-scan-sweep, 80 .coach-scan-hero--static .coach-scan-line, 81 .coach-scan-hero--static .coach-scan-node { 82 animation: none !important; 83 } 84 85 .coach-scan-hero--static .coach-scan-ring { 86 opacity: 0.14; 87 transform: scale(1.35); 88 } 89 .coach-scan-hero--static .coach-scan-ring-1 { transform: scale(1.75); opacity: 0.1; } 90 .coach-scan-hero--static .coach-scan-ring-2 { transform: scale(2.1); opacity: 0.06; } 91 92 .coach-scan-hero--static .coach-scan-sweep { opacity: 0.35; } 93 94 .coach-scan-hero--static .coach-scan-line { 95 stroke-dashoffset: 0; 96 opacity: 0.55; 97 } 98 99 .coach-scan-hero--static .coach-scan-node { 100 opacity: 1; 101 transform: translate(var(--tx), var(--ty)) scale(1); 102 } 103 ${se.map((s,l)=>`.coach-scan-hero--static .coach-scan-node-${l} { --tx: ${s.cx+(b.x-s.cx)*.12}px; --ty: ${s.cy+(b.y-s.cy)*.12}px; }`).join(` 104`)} 105 `})]})}function Na({variant:t="default"}){const a=t==="workspace";return e.jsxs("header",{className:"mt-2 shrink-0 space-y-3 pb-1",children:[e.jsx(As,{className:"text-3xl font-semibold tracking-tight text-slate-900 md:text-4xl",children:a?"Next Move":"Coach"}),e.jsx($s,{className:"whitespace-nowrap text-base leading-relaxed text-slate-600 md:text-lg",children:a?ba:ga})]})}function qe({children:t,className:a,spacious:r}){return e.jsx(O,{className:g("w-full border-slate-200/90 bg-white shadow-sm",a),children:e.jsx(z,{className:g("flex justify-center px-6 py-8 sm:px-10 sm:py-10 md:px-12",r&&"px-8 py-10 sm:px-12 sm:py-12"),children:t})})}function Ke(){return e.jsx(O,{className:"w-full border-slate-200/90 bg-white shadow-sm",children:e.jsxs(z,{className:"flex flex-col items-center px-6 py-8 sm:px-10 sm:py-10 md:px-12",children:[e.jsx(I,{className:"h-[120px] w-full max-w-md rounded-2xl sm:h-[140px]"}),e.jsx(I,{className:"mt-5 h-2.5 w-44"}),e.jsx(I,{className:"mt-4 h-7 w-64 max-w-full sm:h-8 sm:w-80"}),e.jsx(I,{className:"mt-3 h-4 w-full max-w-lg"}),e.jsx(I,{className:"mt-2 h-4 w-full max-w-md"}),e.jsxs("div",{className:"mt-5 flex flex-wrap justify-center gap-2",children:[e.jsx(I,{className:"h-7 w-[7.5rem] rounded-full"}),e.jsx(I,{className:"h-7 w-[7.5rem] rounded-full"}),e.jsx(I,{className:"h-7 w-[8.5rem] rounded-full"})]}),e.jsx(I,{className:"mt-6 h-11 w-44 rounded-[10px]"}),e.jsx(I,{className:"mt-3 h-3 w-56 max-w-full"})]})})}function wa({className:t,onGenerateClick:a}){return e.jsxs("section",{className:g("mx-auto flex w-full max-w-[720px] flex-col items-center text-center",t),children:[e.jsx(xt,{className:"mb-3 sm:mb-4"}),e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.18em] text-indigo-600 sm:text-[11px]",children:"Powered by live AI research"}),e.jsx("h2",{className:"mt-2 text-[22px] font-semibold leading-tight tracking-tight text-slate-900 sm:text-[26px]",children:"Find your next funding move"}),e.jsx("p",{className:"mt-1.5 max-w-[440px] text-[13px] leading-snug text-slate-500 sm:text-[14px]",children:"We scan the web for grants, credits, and accelerators that fit your startup with real amounts and honest eligibility."}),e.jsx("div",{className:"mt-3 flex flex-wrap items-center justify-center gap-1.5 sm:gap-2",children:fa.map(r=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-slate-200/90 bg-slate-50/80 px-2.5 py-1 text-[11px] font-medium text-slate-600 sm:px-3 sm:text-[12px]",children:[e.jsx(Xe,{className:"h-2.5 w-2.5 shrink-0 text-slate-400",strokeWidth:2.5,"aria-hidden":!0}),r]},r))}),e.jsxs(V,{type:"button",onClick:a,className:"mt-4 h-auto rounded-[10px] bg-indigo-600 px-7 py-3 text-sm font-semibold text-white shadow-[0_1px_2px_rgba(15,23,42,0.06),0_4px_12px_rgba(79,70,229,0.22)] transition-[transform,background-color,box-shadow] hover:bg-indigo-700 active:scale-[0.98] sm:mt-5",children:[e.jsx(he,{className:"mr-2 h-4 w-4","aria-hidden":!0}),"Generate my plan"]}),e.jsx("p",{className:"mt-2 text-[11px] text-slate-400",children:"Usually takes a couple of minutes â you can watch the progress live."})]})}const va=[{icon:Bs,category:"Accelerator programs",example:"e.g. Y Combinator, Techstars",fit:94},{icon:Ms,category:"Government grants",example:"e.g. Startup India Seed Fund",fit:88},{icon:Is,category:"Startup credits",example:"e.g. Microsoft Founders Hub",fit:90}];function ka({className:t,onUpgrade:a}){const{ctaLabel:r}=Ts();return e.jsxs("section",{className:g("mx-auto flex w-full max-w-[680px] flex-col items-center gap-5 text-center sm:gap-6",t),children:[e.jsx(xt,{className:"w-full max-w-[440px]"}),e.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-amber-200/90 bg-amber-50/80 px-2 py-1 text-xs font-semibold uppercase tracking-[0.14em] text-amber-700 sm:text-[10px]",children:[e.jsx(Ge,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),"Pro feature"]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-xl font-semibold leading-tight tracking-tight text-slate-900 sm:text-2xl",children:"Meet Coach your AI funding advisor"}),e.jsx("p",{className:"mx-auto max-w-[520px] text-base leading-relaxed text-slate-600 sm:text-md",children:"Unlock grants, credits, and accelerators matched to your startup with scores, real amounts, and a clear next move."})]}),e.jsx("div",{className:"grid w-full grid-cols-1 gap-3 sm:grid-cols-3",children:va.map(s=>e.jsxs("div",{className:"flex flex-col items-center gap-2 rounded-2xl border border-slate-200 bg-white p-4 text-center shadow-sm",children:[e.jsxs("div",{className:"flex w-full items-start justify-between",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-amber-50 text-amber-600",children:e.jsx(s.icon,{className:"h-[18px] w-[18px]","aria-hidden":!0})}),e.jsxs("span",{className:"inline-flex items-center rounded-full bg-emerald-50 px-2 py-0.5 text-[11px] font-bold text-emerald-700 ring-1 ring-emerald-100",children:[s.fit,"% f
105it"]})]}),e.jsx("p",{className:"w-full text-left text-sm font-semibold text-slate-900",children:s.category}),e.jsx("p",{className:"w-full text-left text-xs text-slate-500",children:s.example})]},s.category))}),e.jsx("p",{className:"-mt-2 text-xs text-slate-400",children:"Programs shown are examples. Coach surfaces live matches based on your profile."}),e.jsx("div",{className:"flex w-full flex-col items-center gap-3 pt-1",children:e.jsxs(V,{type:"button",onClick:a,size:"lg",className:"h-auto rounded-[10px] bg-gradient-to-r from-amber-500 to-orange-600 px-8 py-3.5 text-base font-semibold text-white shadow-[0_1px_2px_rgba(15,23,42,0.06),0_4px_12px_rgba(217,119,6,0.22)] transition-[transform,background-color,box-shadow] hover:from-amber-600 hover:to-orange-700 active:scale-[0.98]",children:[e.jsx(Ge,{className:"mr-2 h-5 w-5","aria-hidden":!0}),r]})})]})}const Ca="capitalreach:next-move-filters:v4",ht={search:"",categoryFilter:"all",fitFilter:"all",statusFilter:"all",sortBy:"best_match"};function _a(t){if(!t||typeof t!="object")return ht;const a=t,r=a.categoryFilter,s=a.fitFilter??a.relevanceFilter,l=a.sortBy;return{search:typeof a.search=="string"?a.search:"",categoryFilter:r==="all"||typeof r=="string"&&ke.includes(r)?r:"all",fitFilter:s==="all"||s==="strong"||s==="good"?s:s==="exceptional"?"strong":"all",statusFilter:et.includes(a.statusFilter)?a.statusFilter:"all",sortBy:l==="best_match"||l==="highest_funding"||l==="deadline"||l==="newest"?l:l==="value"?"highest_funding":"best_match"}}function Sa(t){return t<=0?"â":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",notation:"compact",maximumFractionDigits:1}).format(t)}function Ea(t){const a=t.filter(r=>K(r.item)!=="dismissed"&&!ae(r.item));return a.length===0?null:[...a].sort((r,s)=>{const l=(s.item.match_score??0)-(r.item.match_score??0);return l!==0?l:re(s.item)-re(r.item)})[0]}function ur(){const t=Qt(),a=es(),{data:r,isLoading:s,error:l,refetch:n}=ys(),x=js(),{loading:p}=ks(),{job:d,isJobLoading:y,isJobActive:u,generate:f,isGenerating:w}=Ht(),{companyProfile:L}=Ut(),{isLoading:v}=qt(),S=Kt(),R=!v,[P,m]=o.useState(!1),[h,j]=o.useState(!1),[B,_]=ts(Ca,ht,{normalize:_a}),{search:D,categoryFilter:A,fitFilter:H,statusFilter:T,sortBy:C}=B,J=o.useCallback(i=>_(c=>({...c,search:i})),[_]),ne=o.useCallback(i=>_(c=>({...c,categoryFilter:i})),[_]),ut=o.useCallback(i=>_(c=>({...c,fitFilter:i})),[_]),pt=o.useCallback(i=>_(c=>({...c,statusFilter:i})),[_]),ft=o.useCallback(i=>_(c=>({...c,sortBy:i})),[_]),[Le,Z]=o.useState(null),M=r?.data??null,G=M?.analysis??null,X=Ns(G),gt=G?.coach_summary,E=o.useMemo(()=>!G||X?[]:ke.flatMap(i=>(Array.isArray(G[i])?G[i]:[]).filter(N=>!!N?.name).map((N,k)=>({id:`${i}-${String(N.name).toLowerCase().trim()}-${k}`,section:i,item:N}))),[G,X]),Fe=o.useMemo(()=>{let i=0,c=0,N=0,k=0;return E.forEach(({item:$})=>{($.relevance_band??0)>=4&&(i+=1),ws($.status)==="Registered"&&(c+=1),vs($)&&(N+=1),k+=re($)}),{total:E.length,topMatches:i,applied:c,deadlineSoon:N,potentialValue:k}},[E]),ue=o.useMemo(()=>{const i=new Map;return E.forEach((c,N)=>i.set(c.id,N)),i},[E]),pe=o.useMemo(()=>E.filter(c=>{const{section:N,item:k}=c,$=D.trim().toLowerCase();if($&&!`${k.name||""} ${k.provider||""} ${k.coach_note||""} ${k.summary||""} ${Ee[N]}`.toLowerCase().includes($)||A!=="all"&&N!==A)return!1;if(H==="strong"){const q=String(k.relevance_label||"").toLowerCase();if(q!=="exceptional"&&q!=="strong")return!1}if(H==="good"&&String(k.relevance_label||"").toLowerCase()!=="good")return!1;const F=K(k);
105return!(F==="dismissed"||T==="pipeline"&&F==="discovery"||T!=="all"&&T!=="pipeline"&&F!==T)}).sort((c,N)=>{const k=ae(c.item)?1:0,$=ae(N.item)?1:0;if(k!==$)return k-$;if(C==="highest_funding")return re(N.item)-re(c.item);if(C==="deadline"){const ye=ee(c.item),je=ee(N.item),At=ye!==null&&ye>=0?ye:Number.POSITIVE_INFINITY,$t=je!==null&&je>=0?je:Number.POSITIVE_INFINITY;return At-$t}if(C==="newest")return(ue.get(N.id)??0)-(ue.get(c.id)??0);const F=(N.item.match_score??0)-(c.item.match_score??0);if(F!==0)return F;const q=ee(c.item),be=ee(N.item),Lt=q!==null&&q>=0?q:Number.POSITIVE_INFINITY,Ft=be!==null&&be>=0?be:Number.POSITIVE_INFINITY;return Lt-Ft}),[E,D,A,H,T,C,ue]),bt=!!D.trim()||H!=="all"||T!=="all"||C!=="best_match",Ae=o.useCallback(()=>{_(i=>({...i,search:"",fitFilter:"all",statusFilter:"all",sortBy:"best_match"}))},[_]),$e=o.useMemo(()=>{const i=L?.website?.trim()??"";return!!i&&(()=>{try{return new URL(i.startsWith("http")?i:`https://${i}`),!0}catch{return!1}})()},[L]),Te=o.useCallback(i=>{j(i),m(!0)},[]),fe=o.useCallback(()=>{j(!0),m(!0)},[]);o.useEffect(()=>{if(!S)return;t.state?.openSetup&&(fe(),a("/coach",{replace:!0,state:null}))},[S,t.state,a,fe]);const Be=o.useCallback(()=>{if(!$e){Te(!0);return}f()},[$e,f,Te]),yt=o.useCallback(()=>{j(!1),m(!1),f()},[f]);o.useEffect(()=>{d?.id&&u&&Yt(d.id)},[d?.id,u]),o.useEffect(()=>()=>{d?.status==="completed"&&d?.id&&Oe(d.id)&&Jt()},[d?.id,d?.status]),o.useEffect(()=>{if(!u)return;const i=window.setInterval(()=>{n()},4e3);return()=>window.clearInterval(i)},[u,n]),o.useEffect(()=>{d?.status==="completed"&&n()},[d?.status,n]);const jt=!!(d?.id&&Oe(d.id)),U=!!d&&(u||jt&&d?.status==="completed"||d?.status==="failed"&&!M),Nt=o.useMemo(()=>Zs(G),[G]),wt=o.useCallback((i,c,N)=>{x.mutate({id:M?.id,section:i.section,name:String(i.item.name),status:c,...N!==void 0?{note:N}:{}},{onSuccess:()=>{Z(k=>k?.id===i.id?{...k,item:{...k.item,status:c,...N?{note:N}:{note:void 0}}}:k)}})},[M?.id,x]),Me=o.useCallback((i,c)=>{x.mutate({id:M?.id,section:i.section,name:String(i.item.name),status:c?"Remind me":"Not Register"})},[M?.id,x]),vt=o.useMemo(()=>E.filter(({item:i})=>{const c=K(i);return c!=="discovery"&&c!=="dismissed"}).length,[E]),Ie=o.useMemo(()=>{const i=E.filter(({item:F})=>K(F)!=="dismissed"&&!ae(F));if(i.length<2)return null;const c=i.filter(({item:F})=>String(F.application_effort||"").toLowerCase()==="low").length,N=i.map(({item:F})=>ee(F)).filter(F=>F!==null&&F>=0),k=N.length>0?Math.min(...N):null,$=k===null?null:k===0?"today":k===1?"tomorrow":`in ${k} days`;return c>0&&$?`Suggested order: knock out the ${c} low-effort application${c===1?"":"s"} first, then start the bigger ones â the nearest deadline is ${$}.`:c>0?`Suggested order: start with the ${c} low-effort application${c===1?"":"s"} for quick wins, then work up to the higher-effort programs.`:$?`Suggested order: prioritize the dated deadlines first â the nearest is ${$} â then the rolling programs.`:null},[E]),Y=o.useMemo(()=>Ea(E),[E]),kt=o.useMemo(()=>E.filter(({item:i})=>{const c=String(i.relevance_label||"").toLowerCase();return c==="exceptional"||c==="strong"||(i.relevance_band??0)>=4}).length,[E]),Ct=o.useMemo(()=>{const i=E.filter(c=>K(c.item)!=="dismissed");return{all:i.length,incubators_accelerators:i.filter(c=>c.section==="incubators_accelerators").length,cash_grants:i.filter(c=>c.section==="cash_grants").length,tech_grants:i.filter(c=>c.section==="tech_grants").length,investors:0}},[E]),_t=A==="all"?"all":A,St=o.useCallback(i=>{i!=="investors"&&ne(i==="all"?"all":i)},[ne]),Q=o.useMemo(()=>pe.filter(i=>i.id!==Y?.id),[pe,Y?.id]),Re=o.useMemo(()=>Q.slice(0,2),[Q]),De=o.useMemo(()=>Q.slice(2),[Q]),ie=!!M&&!X&&!s&&!l,Et=!!M&&!X,le=!M&&(s||p||y)&&!U,ge=!M&&
105!le&&!U&&d?.status!=="failed";return e.jsx(Zt,{children:e.jsxs(rs,{delayDuration:280,skipDelayDuration:120,children:[e.jsxs("div",{className:"w-full space-y-8 pb-10 pt-2",children:[e.jsx(Na,{variant:U?"workspace":"default"}),e.jsx(Cs,{}),R?S?e.jsxs(e.Fragment,{children:[ge?e.jsx(qe,{children:e.jsx(wa,{onGenerateClick:fe})}):null,le?e.jsx(Ke,{}):null,U&&d?e.jsx(ia,{job:d,companyProfile:L,opportunities:Nt,analysis:G,onRetry:()=>Be(),retrying:w}):null,!U&&!ge&&!le&&!M&&l?e.jsx(O,{className:"border-rose-200 bg-rose-50/50",children:e.jsxs(z,{className:"flex flex-wrap items-center justify-between gap-3 py-8",children:[e.jsx("p",{className:"text-sm text-rose-800",children:l.message||"Something went wrong."}),e.jsx(V,{variant:"outline",size:"sm",onClick:()=>n(),children:"Retry"})]})}):null,!U&&!ge&&!le&&M&&X?u&&d?null:e.jsx(O,{className:"overflow-hidden border-slate-200/90 bg-white shadow-sm",children:e.jsxs(z,{className:"flex flex-col items-center gap-5 px-6 py-12 text-center sm:px-10 sm:py-14",children:[e.jsx("span",{className:"inline-flex h-12 w-12 items-center justify-center rounded-full bg-indigo-100 text-indigo-700",children:e.jsx(he,{className:"h-6 w-6","aria-hidden":!0})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-indigo-700",children:"New coach experience available"}),e.jsx("h2",{className:"text-2xl font-bold tracking-tight text-slate-900 sm:text-3xl",children:"Your plan uses an older format"}),e.jsx("p",{className:"mx-auto max-w-xl text-sm leading-relaxed text-slate-600 sm:text-base",children:"Regenerate to get the new Coach plan â match scores, cash and credit amounts, eligibility checks, live deadlines, and a personal action sequence."})]}),e.jsxs(V,{onClick:()=>Be(),disabled:w||u,className:"h-11 rounded-[10px] bg-indigo-600 px-6 text-sm font-semibold text-white shadow-sm hover:bg-indigo-700",children:[e.jsx(he,{className:"mr-2 h-4 w-4","aria-hidden":!0}),w?"Startingâ¦":"Generate my plan"]})]})}):null,Et&&!U?e.jsxs("div",{className:"space-y-6",children:[ie&&Y?e.jsx(la,{record:Y,fallbackReason:gt?.next_best_move,onReview:Z}):null,ie?e.jsx(oa,{totalValueLabel:Sa(Fe.potentialValue),opportunityCount:Fe.total,strongMatchCount:kt}):null,ie?e.jsx("div",{className:"sticky top-0 z-20 overflow-hidden rounded-coach border border-coach-line bg-white shadow-sm",children:e.jsx(xa,{activeCategoryTab:_t,onCategoryTabChange:St,tabCounts:Ct,search:D,onSearchChange:J,fitFilter:H,onFitChange:ut,statusFilter:T,onStatusChange:pt,pipelineCount:vt,sortBy:C,onSortChange:ft,hasFiltersApplied:bt,onClearFilters:Ae})}):null,ie&&Ie?e.jsxs("p",{className:"flex items-start gap-2 text-sm leading-relaxed text-coach-ink-2",children:[e.jsx(he,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-indigo-500","aria-hidden":!0}),Ie]}):null,s?e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:Array.from({length:4}).map((i,c)=>e.jsx(I,{className:"h-52 w-full rounded-xl"},c))}):l?e.jsx(O,{className:"border-rose-200 bg-rose-50/50",children:e.jsxs(z,{className:"flex flex-wrap items-center justify-between gap-3 py-8",children:[e.jsx("p",{className:"text-sm text-rose-800",children:l.message||"Something went wrong."}),e.jsx(V,{variant:"outline",size:"sm",onClick:()=>n(),children:"Retry"})]})}):pe.length===0&&!Y?e.jsx(O,{className:"border-slate-200 bg-white",children:e.jsxs(z,{className:"py-14 text-center",children:[e.jsx("p",{className:"line-clamp-1 text-base font-semibold text-indigo-950",children:"No opportunities match"}),e.jsx("p",{className:"mt-1 text-sm text-slate-600",children:"Adjust filters or refresh to see new matches."}),e.jsxs("div",{className:"mt-5 flex justify-center gap-2",children:[e.jsxs(V,{variant:"outline",size:"lg",className:ss,onClick:Ae,children:[e.jsx(as,{className:"shrink-0","aria-hidden":!0}),"Clear Filters"]}),e.jsx(V,{size:"lg",onClick:()=>n(),children:"Refresh matches"})]})]})}):Q.length===0&&Y?e.jsx("p",{className:"py-6 text-center text-sm text-coach-ink-3",children:"No other opportunities match your filters."}):e.jsxs(e.Fragment,{children:[Re.length>0?e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:Re.map((i,c)=>e.jsx(Ue,{record:i,rank:c+2,onOpen:Z,onToggleSave:Me,isUpdating:x.isPending},i.id))}):null,De.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("h3",{className:"flex items-center gap-2 text-sm font-semibold text-coach-ink",children:[e.jsx("span",{className:"h-4 w-1 rounded-full bg-[#2563EB]","aria-hidden":!0}),"Remaining opportunities"]}),e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:De.map(i=>e.jsx(Ue,{record:i,onOpen:Z,onToggleSave:Me,isUpdating:x.isPending},i.id))})]}):null]})]}):null]}):e.jsx(qe,{spacious:!0,children:e.jsx(ka,{onUpgrade:()=>a("/payment")})}):e.jsx(Ke,{})]}),S?e.jsxs(e.Fragment,{children:[e.jsx(pa,{record:Le,open:!!Le,onOpenChange:i=>!i&&Z(null),onUpdateStatus:wt,isUpdating:x.isPending}),e.jsx(Xt,{open:P,onOpenChange:i=>{m(i),i||j(!1)},generateOnComplete:h,onGeneratePlan:yt})]}):null]})})}export{ur 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.