PageSourceSearch

https://authengine-az3zrmtj.manus.space/assets/Discovery-RtqJyvwL.js

js authengine-az3zrmtj.manus.space collected 2026-10-03 05:00:13 UTC 30,964 bytes, 3 lines download raw bytes

1import{r as a,j as e}from"./react-vendor-Dc4PsQq0.js";import{P as Be,f as Ve,a as ne,S as _e,E as Fe}from"./PageHeader-Bi4OJb3E.js";import{u as Qe,t as h,D as de,d as He,a as c,e as xe,f as pe,h as ge,i as me,j as Je,b as Z,k as $,l as O,m as z,n as q,o as v,S as G,p as Ke,q as We,r as Ze,s as Ge,v as Xe}from"./index-5nRfQ--P.js";import{C as ve}from"./checkbox-s2QQwv_K.js";import{L as M,I as X}from"./label-Doc1f-25.js";import{T as Ye,a as es,b as ue,c as D,d as ss,e as f}from"./table-DgJli2Tf.js";import{T as ts}from"./textarea-lTLWfDgQ.js";import{a7 as i,ac as as,a8 as he,ad as cs,g as ye,ae as je,af as rs,ag as ls,$ as Y,ah as De,ai as is,aj as fe,ak as os,k as ns,al as ds,am as be}from"./ui-vendor-BQj_Jcqx.js";import"./data-vendor-BDtrsGNX.js";import"./vendor-C0RMI9HL.js";const xs=["directory","resource_page","niche_blog","citation_source","editorial","forum","other"];function Ne(g,y){try{return g?JSON.parse(g):y}catch{return y}}function we(g){return`"${String(g??"").replaceAll('"','""')}"`}function ps(g){const y=[];let n="",j=!1;for(let d=0;d<g.length;d+=1){const m=g[d];m==='"'&&j&&g[d+1]==='"'?(n+='"',d+=1):m==='"'?j=!j:m===","&&!j?(y.push(n.trim()),n=""):n+=m}return y.push(n.trim()),y}function Ns(){const{activeProject:g}=Qe(),y=h.useUtils(),n=g.id,j=a.useMemo(()=>new URLSearchParams(window.location.search),[]),d=Number(j.get("campaignId"))||null,[m,ee]=a.useState("keyword"),[B,se]=a.useState(()=>j.get("query")??""),[te,Se]=a.useState(8),[I,Ce]=a.useState(""),[N,ke]=a.useState("all"),[L,Re]=a.useState(0),[V,Ie]=a.useState("score_desc"),[w,b]=a.useState(1),[P,_]=a.useState(null),[p,S]=a.useState([]),[A,C]=a.useState([]),[Le,F]=a.useState(!1),[ae,Q]=a.useState(""),Pe=a.useMemo(()=>({projectId:n,search:I||void 0,type:N==="all"?void 0:N,state:"active",minScore:L,sort:V,page:w,pageSize:25}),[n,I,N,L,V,w]),x=h.opportunities.list.useQuery(Pe),Ae=a.useMemo(()=>({opportunityId:P??0}),[P]),H=h.opportunities.detail.useQuery(Ae,{enabled:!!P}),T=h.campaigns.list.useQuery({projectId:n}
1),k=T.data?.find(s=>s.id===d),ce=a.useMemo(()=>[...T.data??[]].sort((s,t)=>s.id===d?-1:t.id===d?1:0),[T.data,d]),J=h.opportunities.discover.useMutation({onSuccess:s=>{i.success(`${s.results.length} candidate${s.results.length===1?"":"s"} analyzed`),b(1),x.refetch(),y.analytics.overview.invalidate({projectId:n})},onError:s=>i.error(s.message)}),E=h.opportunities.rescore.useMutation({onSuccess:()=>{i.success("Evidence and score refreshed"),x.refetch(),H.refetch()},onError:s=>i.error(s.message)}),Te=h.opportunities.update.useMutation({onSuccess:()=>{i.success("Opportunity updated"),_(null),x.refetch()},onError:s=>i.error(s.message)}),re=h.opportunities.bulkUpdateState.useMutation({onSuccess:s=>{i.success(`${s.updated} candidate${s.updated===1?"":"s"} updated`),S([]),x.refetch()},onError:s=>i.error(s.message)}),le=h.campaigns.addOpportunities.useMutation({onSuccess:s=>{i.success(`${s.added} candidate${s.added===1?"":"s"} added to campaign`),C([]),S([]),T.refetch()},onError:s=>i.error(s.message)}),K=h.opportunities.importRows.useMutation({onSuccess:s=>{i.success(`${s.savedIds.length} imported${s.errors.length?`, ${s.errors.length} need review`:""}`),F(!1),Q(""),x.refetch()},onError:s=>i.error(s.message)}),Ee=s=>{s.preventDefault(),J.mutate({projectId:n,mode:m,query:B,limit:te})},Ue=()=>{const t=ae.split(/\r?\n/).map(o=>o.trim()).filter(Boolean).map((o,u)=>{const[R="",l=""]=ps(o);return{url:R.trim(),title:l.trim()||void 0,index:u}}).filter((o,u)=>!(u===0&&o.url.toLowerCase()==="url")).map(({url:o,title:u})=>({url:o,title:u}));if(!t.length)return i.error("Add at least one URL.");K.mutate({projectId:n,rows:t})},$e=async s=>{const t=s.target.files?.[0];if(t){if(t.size>2e6){i.error("CSV files must be smaller than 2 MB."),s.target.value="";return}Q(await t.text()),i.success(`${t.name} loaded for review`),s.target.value=""}},Oe=()=>{const s=x.data?.items??[],t=p.length?s.filter(l=>p.includes(l.id)):s,o=[["URL","Domain","Title","Type","Quality Score","Authority Proxy","Topical Relevance","Spam Risk","AEO Likelihood","Confidence","Source"].map(we).join(","),...t.map(l=>[l.normalizedUrl,l.domain,l.title,l.opportunityType,l.qualityScore,l.authorityProxy,l.to
1picalRelevance,l.spamRisk,l.aeoCitationLikelihood,l.scoreConfidence,l.sourceProvider].map(we).join(","))].join(`
2`),u=URL.createObjectURL(new Blob([o],{type:"text/csv;charset=utf-8"})),R=document.createElement("a");R.href=u,R.download=`${g?.domain}-opportunities.csv`,R.click(),URL.revokeObjectURL(u)},W=Math.max(1,Math.ceil((x.data?.total??0)/25)),U=x.data?.items.map(s=>s.id)??[],ze=U.length>0&&U.every(s=>p.includes(s)),qe=(s,t)=>S(o=>t?Array.from(new Set([...o,s])):o.filter(u=>u!==s)),Me=s=>S(t=>s?Array.from(new Set([...t,...U])):t.filter(o=>!U.includes(o))),r=H.data?.item,ie=Ne(r?.evidenceJson??null,[]),oe=Ne(r?.warningsJson??null,[]);return e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:105",className:"mx-auto max-w-[1500px] space-y-6",children:[e.jsx(Be,{"data-loc":"client/src/pages/Discovery.tsx:106",eyebrow:"Prospecting intelligence",title:"Opportunity discovery",description:"Surface and analyze directories, resource pages, niche publications, and citation sources. Every candidate is scored from observable evidence—not rented authority metrics.",actions:e.jsxs(e.Fragment,{children:[e.jsxs(de,{"data-loc":"client/src/pages/Discovery.tsx:106",open:Le,onOpenChange:F,children:[e.jsx(He,{"data-loc":"client/src/pages/Discovery.tsx:106",asChild:!0,children:e.jsxs(c,{"data-loc":"client/src/pages/Discovery.tsx:106",variant:"outline",children:[e.jsx(as,{"data-loc":"client/src/pages/Discovery.tsx:106",className:"mr-2 h-4 w-4"}),"Import URLs"]})}),e.jsxs(xe,{"data-loc":"client/src/pages/Discovery.tsx:106",children:[e.jsxs(pe,{"data-loc":"client/src/pages/Discovery.tsx:106",children:[e.jsx(ge,{"data-loc":"client/src/pages/Discovery.tsx:106",children:"Import candidate URLs"}),e.jsx(me,{"data-loc":"client/src/pages/Discovery.tsx:106",children:"Upload a CSV or paste one URL per line. CSV rows may use URL, title and can include quoted values. Up to 200 pages will be fetched and scored."})]}),e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:106",className:"rounded-xl border border-dashed p-3",children:[e.jsx(M,{"data-loc":"client/src/pages/Discovery.tsx:106",htmlFor:"candidate-csv",className:"mb-2 block text-xs font-semibold",children:"Choose a CSV file"}),e.jsx(X,{"data-loc":"client/src/pages/Discovery.tsx:106",id:"candidate-csv",type:"file",accept:".csv,text/csv",onChange:$e,className:"cursor-pointer text-xs"})]}),e.jsx(ts,{"data-loc":"client/src/pages/Discovery.tsx:106",value:ae,onChange:s=>Q(s.target.value),className:"min-h-48 font-mono text-xs",placeholder:`https://example.com/resources, Example resources
3https://directory.example.com`}),e.jsxs(Je,{"data-loc":"client/src/pages/Discovery.tsx:106",children:[e.jsx(c,{"data-loc":"client/src/pages/Discovery.tsx:106",variant:"outline",onClick:()=>F(!1),children:"Cancel"}),e.jsxs(c,{"data-loc":"client/src/pages/Discovery.tsx:106",onClick:Ue,disabled:K.isPending,children:[K.isPending&&e.jsx(he,{"data-loc":"client/src/pages/Discovery.tsx:106",className:"mr-2 h-4 w-4 animate-spin"}),"Analyze import"]})]})]})]}),e.jsxs(c,{"data-loc":"client/src/pages/Discovery.tsx:106",variant:"outline",onClick:Oe,disabled:!x.data?.items.length,children:[e.jsx(cs,{"data-loc":"client/src/pages/Discovery.tsx:106",className:"mr-2 h-4 w-4"}),p.length?`Export ${p.length}`:"Export page"]})]})}),d?e.jsx("div",{"data-loc":"client/src/pages/Discovery.tsx:108",className:"rounded-2xl border border-violet-200 bg-violet-50/70 p-4 sm:p-5",children:e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:108",className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:108",children:[e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:108",className:"flex flex-wrap items-center gap-2",children:[e.jsx(Z,{"data-loc":"client/src/pages/Discovery.tsx:108",className:"bg-violet-600 text-white hover:bg-violet-600",children:"Recommended workflow loaded"}),k?e.jsx(Z,{"data-loc":"client/src/pages/Discovery.tsx:108",variant:"outline",className:"border-violet-200 bg-white",children:k.name}):null]}),e.jsx("h2",{"data-loc":"client/src/pages/Discovery.tsx:108",className:"mt-3 text-sm font-semibold",children:"Find evidence-backed prospects for this campaign"}),e.jsxs("p",{"data-loc":"client/src/pages/Discovery.tsx:108",className:"mt-1 text-xs leading-5 text-muted-foreground",children:["1. Run the suggested search. 2. Review each candidate’s evidence. 3. Select the relevant candidates and add them to ",k?.name||"the approved campaign",". Nothing is contacted automatically."]})]}),e.jsxs(c,{"data-loc":"client/src/pages/Discovery.tsx:108",variant:"outline",className:"bg-white",onClick:()=>se(j.get("query")??""),children:[e.jsx(ye,{"data-loc":"client/src/pages/Discovery.tsx:108",className:"mr-2 h-4 w-4"}),"Restore suggested search"]})]})}):null,e.jsxs("form",{"data-loc":"client/src/pages/Discovery.tsx:110",onSubmit:Ee,className:"surface-card rounded-2xl p-4 sm:p-5",children:[e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:111",className:"flex flex-col gap-3 lg:flex-row lg:items-end",children:[e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:111",className:"shrink-0",children:[e.jsx(M,{"data-loc":"client/src/pages/Discovery.tsx:111",className:"mb-2 block text-[11px] font-semibold uppercase tracking-[.14em] text-muted-foreground",children:"Discovery mode"}),e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:111",className:"flex rounded-xl bg-muted p-1",children:[e.jsx("button",{"data-loc":"client/src/pages/Discovery.tsx:111",type:"button",onClick:()=>
3ee("keyword"),className:`rounded-lg px-4 py-2 text-xs font-semibold ${m==="keyword"?"bg-white text-foreground shadow-sm":"text-muted-foreground"}`,children:"Keyword"}),e.jsx("button",{"data-loc":"client/src/pages/Discovery.tsx:111",type:"button",onClick:()=>ee("url"),className:`rounded-lg px-4 py-2 text-xs font-semibold ${m==="url"?"bg-white text-foreground shadow-sm":"text-muted-foreground"}`,children:"Target URL"})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:111",className:"min-w-0 flex-1",children:[e.jsx(M,{"data-loc":"client/src/pages/Discovery.tsx:111",htmlFor:"discovery-query",className:"mb-2 block text-[11px] font-semibold uppercase tracking-[.14em] text-muted-foreground",children:m==="keyword"?"Topic or intent":"Page to analyze"}),e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:111",className:"relative",children:[e.jsx(je,{"data-loc":"client/src/pages/Discovery.tsx:111",className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(X,{"data-loc":"client/src/pages/Discovery.tsx:111",id:"discovery-query",value:B,onChange:s=>se(s.target.value),className:"h-11 pl-10",placeholder:m==="keyword"?"executive coaching resource pages":"https://example.com/resources",required:!0})]})]}),m==="keyword"&&e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:111",className:"w-full lg:w-28",children:[e.jsx(M,{"data-loc":"client/src/pages/Discovery.tsx:111",className:"mb-2 block text-[11px] font-semibold uppercase tracking-[.14em] text-muted-foreground",children:"Results"}),e.jsxs($,{"data-loc":"client/src/pages/Discovery.tsx:111",value:String(te),onValueChange:s=>Se(Number(s)),children:[e.jsx(O,{"data-loc":"client/src/pages/Discovery.tsx:111",className:"h-11",children:e.jsx(z,{"data-loc":"client/src/pages/Discovery.tsx:111"})}),e.jsx(q,{"data-loc":"client/src/pages/Discovery.tsx:111",children:[4,8,12].map(s=>e.jsx(v,{"data-loc":"client/src/pages/Discovery.tsx:111",value:String(s),children:s},s))})]})]}),e.jsxs(c,{"data-loc":"client/src/pages/Discovery.tsx:111",type:"submit",className:"h-11 px-5",disabled:J.isPending||B.trim().length<3,children:[J.isPending?e.jsx(he,{"data-loc":"client/src/pages/Discovery.tsx:111",className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(ye,{"data-loc":"client/src/pages/Discovery.tsx:111",className:"mr-2 h-4 w-4"}),"Discover & score"]})]}),e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:112",className:"mt-4 flex items-start gap-2 rounded-xl border border-violet-100 bg-violet-50/60 px-3 py-2.5 text-[11px] leading-5 text-violet-800",children:[e.jsx(rs,{"data-loc":"client/src/pages/Discovery.tsx:112",className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),e.jsx("span",{"data-loc":"client/src/pages/Discovery.tsx:112",children:"Keyword discovery uses public, attributable search results. Page-level analysis then calculates Authority Engine’s proxy score. A low-confidence score is an invitation to review evidence—not a verdict."})]})]}),e.jsxs("section",{"data-loc":"client/src/pages/Discovery.tsx:115",className:"surface-card overflow-hidden rounded-2xl",children:[e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:116",className:"flex flex-col gap-3 border-b p-4 xl:flex-row xl:items-center xl:justify-between",children:[e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:116",className:"flex flex-1 flex-col gap-2 sm:flex-row",children:[e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:116",className:"relative flex-1 sm:max-w-xs",children:[e.jsx(je,{"data-loc":"client/src/pages/Discovery.tsx:116",className:"absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),e.jsx(X,{"data-loc":"client/src/pages/Discovery.tsx:116",value:I,onChange:s=>{Ce(s.target.value),b(1)},placeholder:"Search candidate sites",className:"h-9 pl-9 text-xs"})]}),e.jsxs($,{"data-loc":"client/src/pages/Discovery.tsx:116",value:N,onValueChange:s=>{ke(s),b(1)},children:[e.jsx(O,{"data-loc":"client/src/pages/Discovery.tsx:116",className:"h-9 w-full text-xs sm:w-40",children:e.jsx(z,{"data-loc":"client/src/pages/Discovery.tsx:116"})}),e.jsxs(q,{"data-loc":"client/src/pages/Discovery.tsx:116",children:[e.jsx(v,{"data-loc":"client/src/pages/Discovery.tsx:116",value:"all",children:"All types"}),xs.map(s=>e.jsx(v,{"data-loc":"client/src/pages/Discovery.tsx:116",value:s,children:Ve(s)},s))]})]}),e.jsxs($,{"data-loc":"client/src/pages/Discovery.tsx:116",value:String(L),onValueChange:s=>{Re(Number(s)),b(1)},children:[e.jsx(O,{"data-loc":"client/src/pages/Discovery.tsx:116",className:"h-9 w-full text-xs sm:w-40",children:e.jsx(z,{"data-loc":"client/src/pages/Discovery.tsx:116"})}),e.jsxs(q,{"data-loc":"client/src/pages/Discovery.tsx:116",children:[e.jsx(v,{"data-loc":"client/src/pages/Discovery.tsx:116",value:"
30",children:"Any score"}),e.jsx(v,{"data-loc":"client/src/pages/Discovery.tsx:116",value:"40",children:"Score 40+"}),e.jsx(v,{"data-loc":"client/src/pages/Discovery.tsx:116",value:"65",children:"Score 65+"}),e.jsx(v,{"data-loc":"client/src/pages/Discovery.tsx:116",value:"80",children:"Score 80+"})]})]}),e.jsxs($,{"data-loc":"client/src/pages/Discovery.tsx:116",value:V,onValueChange:s=>Ie(s),children:[e.jsxs(O,{"data-loc":"client/src/pages/Discovery.tsx:116",className:"h-9 w-full text-xs sm:w-44",children:[e.jsx(ls,{"data-loc":"client/src/pages/Discovery.tsx:116",className:"mr-2 h-3.5 w-3.5"}),e.jsx(z,{"data-loc":"client/src/pages/Discovery.tsx:116"})]}),e.jsxs(q,{"data-loc":"client/src/pages/Discovery.tsx:116",children:[e.jsx(v,{"data-loc":"client/src/pages/Discovery.tsx:116",value:"score_desc",children:"Best score"}),e.jsx(v,{"data-loc":"client/src/pages/Discovery.tsx:116",value:"score_asc",children:"Lowest score"}),e.jsx(v,{"data-loc":"client/src/pages/Discovery.tsx:116",value:"newest",children:"Newest"}),e.jsx(v,{"data-loc":"client/src/pages/Discovery.tsx:116",value:"domain",children:"Domain A–Z"})]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:116",className:"text-xs text-muted-foreground",children:[e.jsx("strong",{"data-loc":"client/src/pages/Discovery.tsx:116",className:"text-foreground tabular-nums",children:x.data?.total??0})," candidates"]})]}),p.length>0&&e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:117",className:"flex flex-col gap-3 border-b bg-violet-50/55 px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("p",{"data-loc":"client/src/pages/Discovery.tsx:117",className:"text-xs font-semibold text-violet-900",children:[p.length," candidate",p.length===1?"":"s"," selected"]}),e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:117",className:"flex flex-wrap gap-2",children:[e.jsxs(c,{"data-loc":"client/src/pages/Discovery.tsx:117",size:"sm",variant:"outline",onClick:()=>C(p),children:[e.jsx(Y,{"data-loc":"client/src/pages/Discovery.tsx:117",className:"mr-2 h-3.5 w-3.5"}),"Add to campaign"]}),e.jsxs(c,{"data-loc":"client/src/pages/Discovery.tsx:117",size:"sm",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>re.mutate({projectId:n,opportunityIds:p,state:"rejected"}),disabled:re.isPending,children:[e.jsx(De,{"data-loc":"client/src/pages/Discovery.tsx:117",className:"mr-2 h-3.5 w-3.5"}),"Reject selected"]}),e.jsx(c,{"data-loc":"client/src/pages/Discovery.tsx:117",size:"sm",variant:"ghost",onClick:()=>S([]),children:"Clear"})]})]}),x.isLoading?e.jsx("div",{"data-loc":"client/src/pages/Discovery.tsx:118",className:"space-y-2 p-4",children:Array.from({length:7},(s,t)=>e.jsx(G,{"data-loc":"client/src/pages/Discovery.tsx:118",className:"h-16 rounded-xl"},t))}):x.data?.items.length?e.jsx("div",{"data-loc":"client/src/pages/Discovery.tsx:118",className:"overflow-x-auto",children:e.jsxs(Ye,{"data-loc":"client/src/pages/Discovery.tsx:118",children:[e.jsx(es,{"data-loc":"client/src/pages/Discovery.tsx:118",children:e.jsxs(ue,{"data-loc":"client/src/pages/Discovery.tsx:118",className:"bg-muted/35",children:[e.jsx(D,{"data-loc":"client/src/pages/Discovery.tsx:118",className:"w-10",children:e.jsx(ve,{"data-loc":"client/src/pages/Discovery.tsx:118",checked:ze,onCheckedChange:s=>Me(s===!0),"aria-label":"Select all candidates on this page"})}),e.jsx(D,{"data-loc":"client/src/pages/Discovery.tsx:118",className:"min-w-72",children:"Candidate"}),e.jsx(D,{"data-loc":"client/src/pages/Discovery.tsx:118",children:"Quality"}),e.jsx(D,{"data-loc":"client/src/pages/Discovery.tsx:118",children:"Score signals"}),e.jsx(D,{"data-loc":"client/src/pages/Discovery.tsx:118",children:"Type"}),e.jsx(D,{"data-loc":"client/src/pages/Discovery.tsx:118",children:"Confidence"}),e.jsx(D,{"data-loc":"client/src/pages/Discovery.tsx:118",className:"text-right",children:"Actions"})]})}),e.jsx(ss,{"data-loc":"client/src/pages/Discovery.tsx:118",children:x.data.items.map(s=>e.jsxs(ue,{"data-loc":"client/src/pages/Discovery.tsx:118",className:"group","data-state":p.includes(s.id
3)?"selected":void 0,children:[e.jsx(f,{"data-loc":"client/src/pages/Discovery.tsx:118",children:e.jsx(ve,{"data-loc":"client/src/pages/Discovery.tsx:118",checked:p.includes(s.id),onCheckedChange:t=>qe(s.id,t===!0),"aria-label":`Select ${s.title||s.domain}`})}),e.jsx(f,{"data-loc":"client/src/pages/Discovery.tsx:118",children:e.jsxs("button",{"data-loc":"client/src/pages/Discovery.tsx:118",className:"max-w-80 text-left",onClick:()=>_(s.id),children:[e.jsx("p",{"data-loc":"client/src/pages/Discovery.tsx:118",className:"truncate text-sm font-semibold group-hover:text-primary",children:s.title||s.domain}),e.jsxs("p",{"data-loc":"client/src/pages/Discovery.tsx:118",className:"mt-1 flex items-center gap-1.5 truncate text-[11px] text-muted-foreground",children:[e.jsx(is,{"data-loc":"client/src/pages/Discovery.tsx:118",className:"h-3 w-3 shrink-0"}),s.domain]})]})}),e.jsx(f,{"data-loc":"client/src/pages/Discovery.tsx:118",children:e.jsx(ne,{"data-loc":"client/src/pages/Discovery.tsx:118",score:s.qualityScore})}),e.jsx(f,{"data-loc":"client/src/pages/Discovery.tsx:118",children:e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:118",className:"grid min-w-44 grid-cols-2 gap-x-4 gap-y-1 text-[10px]",children:[e.jsxs("span",{"data-loc":"client/src/pages/Discovery.tsx:118",className:"text-muted-foreground",children:["Authority ",e.jsx("b",{"data-loc":"client/src/pages/Discovery.tsx:118",className:"float-right text-foreground tabular-nums",children:s.authorityProxy})]}),e.jsxs("span",{"data-loc":"client/src/pages/Discovery.tsx:118",className:"text-muted-foreground",children:["Relevance ",e.jsx("b",{"data-loc":"client/src/pages/Discovery.tsx:118",className:"float-right text-foreground tabular-nums",children:s.topicalRelevance})]}),e.jsxs("span",{"data-loc":"client/src/pages/Discovery.tsx:118",className:"text-muted-foreground",children:["Spam risk ",e.jsx("b",{"data-loc":"client/src/pages/Discovery.tsx:118",className:`float-right tabular-nums ${s.spamRisk>=60?"text-red-600":"text-foreground"}`,children:s.spamRisk})]}),e.jsxs("span",{"data-loc":"client/src/pages/Discovery.tsx:118",className:"text-muted-foreground",children:["AEO ",e.jsx("b",{"data-loc":"client/src/pages/Discovery.tsx:118",className:"float-right text-foreground tabular-nums",children:s.aeoCitationLikelihood})]})]})}),e.jsx(f,{"data-loc":"client/src/pages/Discovery.tsx:118",children:e.jsx(_e,{"data-loc":"client/src/pages/Discovery.tsx:118",value:s.opportunityType})}),e.jsxs(f,{"data-loc":"client/src/pages/Discovery.tsx:118",children:[e.jsxs("span",{"data-loc":"client/src/pages/Discovery.tsx:118",className:"text-xs font-medium tabular-nums",children:[s.scoreConfidence,"%"]}),e.jsx("p",{"data-loc":"client/src/pages/Discovery.tsx:118",className:"mt-1 text-[10px] text-muted-foreground",children:s.sourceProvider})]}),e.jsx(f,{"data-loc":"client/src/pages/Discovery.tsx:118",children:e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:118",className:"flex justify-end gap-1",children:[e.jsx(c,{"data-loc":"client/src/pages/Discovery.tsx:118",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>E.mutate({opportunityId:s.id}),disabled:E.isPending,"aria-label":"Refresh score",children:e.jsx(fe,{"data-loc":"client/src/pages/Discovery.tsx:118",className:"h-3.5 w-3.5"})}),e.jsx(c,{"data-loc":"client/src/pages/Discovery.tsx:118",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>C([s.id]),"aria-label":"Add to campaign",children:e.jsx(Y,{"data-loc":"client/src/pages/Discovery.tsx:118",className:"h-3.5 w-3.5"})}),e.jsx("a",{"data-loc":"client/src/pages/Discovery.tsx:118",href:s.normalizedUrl,target:"_blank",rel:"noreferrer",className:"flex h-8 w-8 items-center justify-center rounded-lg text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":`Open ${s.domain}`,children:e.jsx(os,{"data-loc":"client/src/pages/Discovery.tsx:118",className:"h-3.5 w-3.5"})})]})})]},s.id))})]})}):e.jsx("div",{"data-loc":"client/src/pages/Discovery.tsx:118",className:"p-5",children:e.jsx(Fe,{"data-loc":"client/src/pages/Discovery.tsx:118",icon:ns,title:"No opportunities match",description:I||N!=="all"||L?"Adjust the filters or run a new discovery query.":"Run your first keyword search or analyze a known target URL. Results appear here with evidence and confidence.",action:e.jsx(c,{"data-loc":"client/src/pages/Discovery.tsx:118",onClick:()=>document.getElementById("discovery-query")?.focus(),children:"Start discovery"})})}),e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:119",className:"flex items-center justify-between border-t px-4 py-3",children:[e.jsxs("p",{"data-loc":"client/src/pages/Discovery.tsx:119",className:"text-[11px] text-muted-foreground",children:["Page ",w," of ",W]}),e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:119",className:"flex gap-1",children:[e.jsx(c,{"data-loc":"client/src/pages/Discovery.tsx:119",variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>b(s=>Math.max(1,s-1)),disabled:w===1,children:e.jsx(ds,{"data-loc":"client/src/pages/Discovery.tsx:119",className:"h-3.5 w-3.5"})}),e.jsx(c,{"data-loc":"client/src/pages/Discovery.tsx:119",variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>b(s=>Math.min(W,s+1)),disabled:w>=W,children:e.jsx(be,{"data-loc":"client/src/pages/Discovery.tsx:119",className:"h-3.5 w-3.5"})})]})]})]}),e.jsx(Ke,{"data-loc":"client/src/pages/Discovery.tsx:122",open:!!P,onOpenChange:s=>!s&&_(null),children:e.jsxs(We,{"data-loc":"client/src/pages/Discovery.tsx:122",className:"w-full overflow-y-auto sm:max-w-xl",children:[e.jsxs(Ze,{"data-loc":"client/src/pages/Discovery.tsx:122",children:[e.jsx(Ge,{"data-loc":"client/src/pages/Discovery.tsx:122",children:r?.title||r?.domain||"Opportunity"}),e.jsx(Xe,{"data-loc":"client/src/pages/Discovery.tsx:122",children:r?.normalizedUrl})]}),H.isLoading?e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"space-y-3 p-5",children:[e.jsx(G,{"data-loc":"client/src/pages/Discovery.tsx:122",className:"h-24 rounded-2xl"}),e.jsx(G,{"data-loc":"client/src/pages/Discovery.tsx:122",className:"h-48 rounded-2xl"})]}):r?e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"space-y-5 p-5 pt-2",children:[e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"flex items-center gap-5 rounded-2xl border bg-muted/25 p-5",children:[e.jsx(ne,{"data-loc":"client/src/pages/Discovery.tsx:122",score:r.qualityScore,size:"lg"}),e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:122",children:[e.jsx("p",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"text-sm font-semibold",children:"Authority Engine quality score"}),e.jsxs("p",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"mt-1 text-xs leading-5 text-muted-foreground",children:[r.scoreConfidence,"% confidence · formula ",r.formulaVersion]})]})]}),e.jsx("div",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"grid grid-cols-2 gap-3",children:[{label:"Authority proxy",value:r.authorityProxy},{label:"Topical relevance",value:r.topicalRelevance},{label:"Spam risk",value:r.spamRisk},{label:"AEO likelihood",value:r.aeoCitationLikelihood}].map(s=>e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"rounded-xl border p-3",children:[e.jsx("p",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"text-[10px] uppercase tracking-[.12em] text-muted-foreground",children:s.label}),e.jsx("p",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"mt-2 text-xl font-semibold tabular-nums",children:s.value})]},s.label))}),e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:122",children:[e.jsx("h3",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"text-xs font-semibold uppercase tracking-[.14em] text-muted-foreground",children:"Observed evidence"}),e.jsx("div",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"mt-3 space-y-2",children:ie.length?
3ie.map((s,t)=>e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"rounded-xl border p-3",children:[e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"flex items-center justify-between gap-3",children:[e.jsx("p",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"text-xs font-semibold",children:s.label||"Signal"}),s.source&&e.jsx("span",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"text-[9px] uppercase tracking-wider text-muted-foreground",children:s.source})]}),e.jsx("p",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"mt-1 text-[11px] leading-5 text-muted-foreground",children:s.value||"Observed"})]},t)):e.jsx("p",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"rounded-xl border border-dashed p-4 text-xs text-muted-foreground",children:"No evidence details were stored for this analysis."})})]}),oe.length>0&&e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"rounded-2xl border border-amber-200 bg-amber-50 p-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"flex items-center gap-2 text-xs font-semibold text-amber-800",children:[e.jsx(De,{"data-loc":"client/src/pages/Discovery.tsx:122",className:"h-4 w-4"})," Review warnings"]}),e.jsx("ul",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"mt-2 space-y-1 text-[11px] leading-5 text-amber-700",children:oe.map(s=>e.jsxs("li",{"data-loc":"client/src/pages/Discovery.tsx:122",children:["• ",s]},s))})]}),e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:122",className:"flex flex-wrap gap-2",children:[e.jsxs(c,{"data-loc":"client/src/pages/Discovery.tsx:122",onClick:()=>C([r.id]),children:[e.jsx(Y,{"data-loc":"client/src/pages/Discovery.tsx:122",className:"mr-2 h-4 w-4"}),"Add to campaign"]}),e.jsxs(c,{"data-loc":"client/src/pages/Discovery.tsx:122",variant:"outline",onClick:()=>E.mutate({opportunityId:r.id}),disabled:E.isPending,children:[e.jsx(fe,{"data-loc":"client/src/pages/Discovery.tsx:122",className:"mr-2 h-4 w-4"}),"Refresh evidence"]}),e.jsx(c,{"data-loc":"client/src/pages/Discovery.tsx:122",variant:"ghost",className:"text-destructive hover:text-destructive",onClick:()=>Te.mutate({opportunityId:r.id,state:"rejected"}),children:"Reject"})]})]}):null]})}),e.jsx(de,{"data-loc":"client/src/pages/Discovery.tsx:124",open:A.length>0,onOpenChange:s=>!s&&C([]),children:e.jsxs(xe,{"data-loc":"client/src/pages/Discovery.tsx:124",children:[e.jsxs(pe,{"data-loc":"client/src/pages/Discovery.tsx:124",children:[e.jsxs(ge,{"data-loc":"client/src/pages/Discovery.tsx:124",children:["Add ",A.length>1?`${A.length} candidates`:"candidate"," to campaign"]}),e.jsxs(me,{"data-loc":"client/src/pages/Discovery.tsx:124",children:[k?`${k.name} is recommended for this search and appears first. `:"","Authority Engine starts qualified candidates in Qualified; lower-confidence candidates remain in Discovered for review."]})]}),e.jsx("div",{"data-loc":"client/src/pages/Discovery.tsx:124",className:"grid gap-2",children:ce.length?ce.map(s=>e.jsxs("button",{"data-loc":"client/src/pages/Discovery.tsx:124",onClick:()=>le.mutate({campaignId:s.id,opportunityIds:A}),disabled:le.isPending,className:`flex items-center justify-between rounded-xl border p-4 text-left hover:border-violet-200 hover:bg-violet-50/40 disabled:opacity-60 ${s.id===d?"border-violet-300 bg-violet-50/60":""}`,children:[e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:124",children:[e.jsxs("div",{"data-loc":"client/src/pages/Discovery.tsx:124",className:"flex items-center gap-2",children:[e.jsx("p",{"data-loc":"client/src/pages/Discovery.tsx:124",className:"text-sm font-semibold",children:s.name}),s.id===d?e.jsx(Z,{"data-loc":"client/src/pages/Discovery.tsx:124",className:"bg-violet-600 text-[9px] text-white hover:bg-violet-600",children:"Recommended"}):null]}),e.jsxs("p",{"data-loc":"client/src/pages/Discovery.tsx:124",className:"mt-1 text-[11px] text-muted-foreground",children:[s.total," opportunities · ",s.verified," verified"]})]}),e.jsx(be,{"data-loc":"client/src/pages/Discovery.tsx:124",className:"h-4 w-4 text-muted-foreground"})]},s.id)):e.jsx("div",{"data-loc":"client/src/pages/Discovery.tsx:124",className:"rounded-xl border border-dashed p-5 text-center text-sm text-muted-foreground",children:"Create a campaign first from Website Pages or the Campaigns workspace."})})]})})]})}export{Ns 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.