1import{j as e}from"./vendor-C_lr6Peh.js";import{Y as g,q as u,X as f,L as b,U as j,ac as y,dz as N,h as w}from"./index-CCfJC9m9.js";import{C as v}from"./calendar-DTAYBCHu.js";import{M as k}from"./map-pin-wEsb6qZq.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};r.SENTRY_RELEASE={id:"0ccb255495e39d589ace3c3ce0094401fe4fff85"};var t=new r.Error().stack;t&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[t]="5f0af7ef-8fe4-47b7-8a3d-e8519edf3d04",r._sentryDebugIdIdentifier="sentry-dbid-5f0af7ef-8fe4-47b7-8a3d-e8519edf3d04")}catch{}})();const S={lead:"Lead",proposal_sent:"Proposal Sent",booked:"Booked",completed:"Completed",archive:"Archive"},m={lead:"bg-blue-50/60 text-blue-700/70 dark:bg-blue-900/20 dark:text-blue-300/70",proposal_sent:"bg-amber-50/60 text-amber-700/70 dark:bg-amber-900/20 dark:text-amber-300/70",booked:"bg-green-50/60 text-green-700/70 dark:bg-green-900/20 dark:text-green-300/70",completed:"bg-gray-50/60 text-gray-600/70 dark:bg-gray-800/20 dark:text-gray-400/70",archive:"bg-stone-50/50 text-stone-500/60 dark:bg-stone-800/20 dark:text-stone-400/50"};function x(r){return r?(typeof r=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(r)?new Date(r+"T12:00:00"):new Date(r)).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"â"}function L({query:r,onSelectContact:t,onClear:d}){const a=r.trim(),p=g(),{data:n=[],isLoading:l,isError:c}=u({queryKey:["/api/crm/contacts","client-search",a,p],enabled:a.length>=2,queryFn:async({signal:s})=>{const i=new URLSearchParams({search:a}),o=await N(`/api/crm/contacts?${i.toString()}`,async h=>(await w("GET",h)).json(),{signal:s});if(!o)throw new Error("Failed to search clients");return o.data}});return e.jsxs("div",{className:"space-y-6","data-testid":"client-search-results",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:d,className:"w-8 h-8 rounded-full border border-border/20 flex items-center justify-center hover:bg-muted/40 transition-colors shrink-0","data-testid":"button-clear-client-search","aria-label":"Clear search",children:e.jsx(f,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-2xl font-display font-extralight tracking-tight",children:"Search Results"}),e.jsx("p",{className:"text-[11px] text-foreground/70 mt-1","data-testid":"text-client-search-count",children:l?"Searching every client...":c?"Search failed. Try again.":`${n.length} match${n.length===1?"":"es"} for "${a}"`})]})]}),l?e.jsx("div",{className:"flex items-center justify-center py-20","data-testid":"text-client-search-loading",children:e.jsx(b,{className:"w-4 h-4 animate-spin text-foreground/60"})}):n.length===0?e.jsxs("div",{className:"text-center py-20",children:[e.jsx(j,{className:"w-8 h-8 mx-auto text-foreground/65 mb-4"}),e.jsx("p",{className:"text-[13px] text-foreground/65","data-testid":"text-client-search-empty",children:c?"Something went wrong searching your clients.":`No clients match "${a}"`}),e.jsx("p",{className:"text-[11px] text-foreground/65 mt-2",children:"Searches names, email addresses, phone numbers, and partner details."})]}):e.jsx("div",{className:"border border-border/12 rounded-xl overflow-hidden",children:n.map((s,i)=>e.jsxs("div",{className:`grid grid-cols-1 sm:grid-cols-[1fr_1fr_140px_140px] items-center px-4 py-4 gap-x-3 gap-y-2 cursor-pointer hover:bg-muted/8 transition-colors group ${i>0?"border-t border-border/10":""}`,onClick:()=>t(s),"data-testid":`row-search-contact-${s.id}`,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-[13px] font-medium truncate group-hover:text-primary transition-colors","data-testid":`text-search-contact-name-${s.id}`,children:s.name}),e.jsx("span",{className:`text-[10px] tracking-[0.1em] uppercase px-1.5 py-0.5 rounded-sm shrink-0 ${m[s.pipelineStage||"lead"]||m.lead}`,children:S[s.pipelineStage||"lead"]||s.pipelineStage})]}),s.partnerName&&e.jsxs("p",{className:"text-[11px] text-foreground
1/70 truncate mt-0.5",children:["& ",s.partnerName]}),e.jsxs("div",{className:"sm:hidden flex flex-wrap items-center gap-x-3 gap-y-1 mt-1.5",children:[s.email&&e.jsxs("span",{className:"text-[11px] text-foreground/70 flex items-center gap-1",children:[e.jsx(y,{className:"w-3 h-3"}),s.email.split(",")[0].trim()]}),s.weddingDate&&e.jsxs("span",{className:"text-[11px] text-foreground/70 flex items-center gap-1",children:[e.jsx(v,{className:"w-3 h-3"}),x(s.weddingDate)]}),s.venue&&e.jsxs("span",{className:"text-[11px] text-foreground/70 flex items-center gap-1",children:[e.jsx(k,{className:"w-3 h-3"}),s.venue]})]})]}),e.jsx("div",{className:"hidden sm:block min-w-0",children:e.jsx("p",{className:"text-[12px] text-foreground/70 truncate",children:s.email?.split(",")[0].trim()||"â"})}),e.jsx("div",{className:"hidden sm:block min-w-0",children:e.jsx("p",{className:"text-[12px] text-foreground/70 truncate",children:x(s.weddingDate)})}),e.jsx("div",{className:"hidden sm:block min-w-0",children:e.jsx("p",{className:"text-[12px] text-foreground/70 truncate",children:s.venue||"â"})})]},s.id))})]})}export{L 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.