1import{c as L,j as e,a as b}from"./vendor-query-BxlSJxfF.js";import{a as pe,s as v,u as we,I as ke,a6 as Se,a7 as Ce,a8 as Me,a9 as Le,B as Ae,L as qe,e as le}from"./index-DO0aGFYL.js";import{A as $e,a as Re,b as Ie,c as Fe,d as De,e as We,f as Te,g as Ee}from"./alert-dialog-WBQzXKSB.js";import{B as He}from"./badge-4jZnSn2H.js";import{a as Pe}from"./use-profile-summary-pcsmjbRV.js";import{u as Be}from"./use-shortlist-RQmgZicA.js";import{u as ze}from"./use-connections-Dt1GMJ6D.js";import{H as Oe}from"./Head-CFjoxvyt.js";import{formatDistanceMi as ce}from"./geocode-CX448-fu.js";import{W as Ke}from"./WhatsAppBadge-BI8Oxwmv.js";import{a as de,S as me}from"./seed-visibility-CpNgLkyT.js";import{T as Ue}from"./trending-up-DS_OYcrn.js";import{l as Je,a as Qe,b as Ge}from"./applicant-match-BuS3IVbt.js";import{t as Ye}from"./image-url-_sEuZELz.js";import{u as Ve,W as Ze}from"./use-worker-completion-stats-F_zdcqEi.js";import{g as Xe,u as es}from"./vendor-react-DdNhUK9-.js";import{S as Z}from"./sparkles-B9Io74C_.js";import{M as O}
1from"./map-pin-Clc12hBl.js";import{B as xe}from"./briefcase-DprwYuVO.js";import{A as X}from"./arrow-up-down-BXqJ3rlv.js";import{m as M}from"./vendor-motion-CdL2ySym.js";import{A as ss}from"./arrow-left-DNK6fh5x.js";import{S as ue}from"./search-BkqYkxAv.js";import{F as ts}from"./filter-COnj5I01.js";import{C as z}from"./check-BTT3mgzE.js";import{U as rs}from"./users-4wDC2oQA.js";import{C as as}from"./chevron-right-n5eCbV2c.js";import{U as os}from"./user-plus-e-panZql.js";import{H as ns}from"./heart-BHSL6QMs.js";import{Z as is}from"./zap-3WSssjod.js";import{S as ls}from"./send-C6vNENnO.js";import"./vendor-supabase-Csx7YFID.js";const cs=3;function ds({skills:u,locationLabel:N}){const{t:f}=pe(),S=u.map(p=>p.trim()).filter(Boolean),o=S.length>0,{data:I=[]}=L({queryKey:["skill-rate-stats",de,S.map(p=>p.toLowerCase()).sort()],enabled:o,staleTime:5*60*1e3,queryFn:async()=>{const{data:p,error:w}=await v.from(de).select("skill, worker_count, min_rate, max_rate, avg_rate").in("skill",S);return w||!p?[]:p}});if(!o)return null;const A=I.filter(p=>p.worker_count>=cs&&p.min_rate!=null&&p.max_rate!=null);return A.length===0?null:e.jsx("div",{className:"space-y-1.5",children:A.map(p=>{const w=Math.round(Number(p.min_rate)),E=Math.round(Number(p.max_rate)),q=w===E?`$${w}/hr`:`$${w}â$${E}/hr`,y=N?` ${f.marketRate.near} ${N}`:` ${f.marketRate.nearYou}`,F=p.worker_count===1?f.marketRate.workerSingular:f.marketRate.workersPlural;return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-card bg-card/60 dark:bg-card/60 border border-border/60",style:{boxShadow:"0 1px 4px rgba(0,0,0,0.04)"},children:[e.jsx(Ue,{className:"w-3.5 h-3.5 text-primary/70 shrink-0"}),e.jsxs("p",{className:"text-caption sm:text-xs text-muted-foreground leading-snug",children:[e.jsx("span",{className:"font-semibold text-foreground",children:p.skill}),e.jsx("span",{className:"opacity-70",children:y}),e.jsx("span",{className:"mx-1.5 opacity-40",children:"·"}),e.jsx("span",{className:"font-semibold text-foreground",children:q}),e.jsx("span",{className:"mx-1.5 opacity-40",children:"·"}),e.jsxs("span",{children:[p.worker_count," ",F]})]})]},p.skill)})})}function ms(u,N,f,S){const I=(f-u)*Math.PI/180,A=(S-N)*Math.PI/180,p=Math.sin(I/2)**2+Math.cos(u*Math.PI/180)*Math.cos(f*Math.PI/180)*Math.sin(A/2)**2;return 3958.8*2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p))}const T={relevance:Z,distance:O,jobs:xe,rate_low:X,rate_high:X};function Os(){const{jobId:u}=Xe(),N=es(),{user:f}=we(),{t:S}=pe(),o=S.findWorkers,I=[{value:"relevance",label:o.sortBestMatch,icon:T.relevance},{value:"distance",label:o.sortNearest,icon:T.distance},{value:"jobs",label:o.sortMostJobs,icon:T.jobs},{value:"rate_low",label:o.sortRateLow,icon:T.rate_low},{value:"rate_high",label:o.sortRateHigh,icon:T.rate_high}],{shortlistedWorkerIds:A,toggleShortlist:p}=Be();ze();const[w,E]=b.useState(""),q=b.useDeferredValue(w),[y,F]=b.useState([]),[ee,se]=b.useState(null),[$,K]=b.useState(null),[he,U]=b.useState({}),[J,fe]=b.useState("relevance"),{data:i}=L({queryKey:["find-workers-job",u],queryFn:async()=>{if(!u)return null;const{data:s}=await v.from("jobs").select("id, title, skills, location, lat, lng, start_date, pay, pay_type").eq("id",u).single();return s},enabled:!!u}),{data:C=[],isLoading:ge}=L({queryKey:["searchable-workers-full",me],queryFn:async()=>{const s=v.from("worker_profiles_public").select("user_id, skills, location, total_jobs, reliability_score, approx_lat, approx_lng, is_seed");me||s.eq("is_seed",!1);const[a,t,n]=await Promise.all([v.from("profiles_public").select("user_id, full_name, avatar_url").eq("role","worker"),s,v.from("worker_skill_rates_public").select("worker_id, skill, rate")]),d=Object.fromEntries((t.data??[]).map(l=>[l.user_id,l])),c={};return(n.data??[]).forEach(l=>{l.rate==null||l.rate<=0||(c[l.worker_id]||(c[l.worker_id]=[]),c[l.worker_id].push({skill_name:l.skill,min_rate:l.rate}))}),(a.data??[]).filter(l=>d[l.user_id]).filter(l=>{const r=d[l.user_id],x=!!(l.full_name&&l.full_name.trim()),h=Array.isArray(r==null?void 0:r.skills)&&r.skills.length>0;return x||h}).map(l=>{const r=d[l.user_id];return{user_id:l.user_id,full_name:l.full_name||"Unknown Worker",avatar_url:l.avatar_url,skills:(r==null?void 0:r.skills)??[],location:(r==null?void 0:r.location)??null,approx_lat:(r==null?void 0:r.approx_lat)??null,approx_lng:(r==null?void 0:r.approx_lng)??null,total_jobs:(r==null?void 0:r.total_jobs)??0,reliability_score:(r==null?void 0:r.reliability_score)??null,skill_rates:c[l.user_id]??[]}})},enabled:!!f}),{data:Q=[]}=L({queryKey:["job-existing-applicants",u],queryFn:async()=>
1{if(!u)return[];const{data:s}=await v.from("applications").select("worker_id").eq("job_id",u);return(s??[]).map(a=>a.worker_id)},enabled:!!u}),{data:H={set:[],workerMap:{}}}=L({queryKey:["job-filled-skills",u],queryFn:async()=>{var r;if(!u)return{set:[],workerMap:{}};const{data:s}=await v.from("applications").select("worker_id").eq("job_id",u).eq("status","accepted");if(!s||s.length===0)return{set:[],workerMap:{}};const a=s.map(x=>x.worker_id),t=await Pe(a),n=Object.fromEntries([...t].map(([x,h])=>[x,h.displayName||"Unknown"])),d=new Set,c={},l=(i==null?void 0:i.skills)??[];for(const[x,h]of t)(((r=h.laborer)==null?void 0:r.skills)??[]).forEach(j=>{const k=j.toLowerCase();if(l.some(W=>W.toLowerCase()===k)){d.add(k);const W=c[k]??[],ie=n[x]??"Unknown";W.includes(ie)||W.push(ie),c[k]=W}});return{set:Array.from(d),workerMap:c}},enabled:!!u&&!!i}),_=b.useMemo(()=>new Set(H.set),[H.set]),be=b.useMemo(()=>new Map(Object.entries(H.workerMap??{})),[H.workerMap]),m=(i==null?void 0:i.skills)??[],te=new Set(Q),re=b.useMemo(()=>m.length>0?m:[],[m]),ye=s=>{F(a=>a.includes(s)?a.filter(t=>t!==s):[...a,s])},G=b.useMemo(()=>{const s=q.trim().toLowerCase();if(!s)return new Set;const a=new Set;return m.forEach(t=>{t.toLowerCase().includes(s)&&a.add(t.toLowerCase())}),C.forEach(t=>{t.skills.forEach(n=>{n.toLowerCase().includes(s)&&a.add(n.toLowerCase())})}),a},[q,m,C]),{data:ae=new Set}=L({queryKey:["job-accepted-worker-ids",u],queryFn:async()=>{if(!u)return new Set;const{data:s}=await v.from("applications").select("worker_id").eq("job_id",u).eq("status","accepted");return new Set((s??[]).map(a=>a.worker_id))},enabled:!!u}),Y=b.useMemo(()=>{const s=i==null?void 0:i.start_date;if(!s)return null;const a=new Date(s);return isNaN(a.getTime())?null:a.toISOString().slice(0,10)},[i]),{data:oe=new Set}=L({queryKey:["job-unavailable-workers",u,Y],enabled:!!Y,queryFn:async()=>{const{data:s}=await v.from("availability_slots").select("user_id").eq("available_date",Y).eq("is_blocked",!0);return new Set((s??[]).map(a=>a.user_id))}}),ne=b.useMemo(()=>{const s=q.trim().toLowerCase(),a=i==null?void 0:i.pay;return C.filter(t=>{var n;if(te.has(t.user_id)||t.user_id===(f==null?void 0:f.id)||ae.has(t.user_id)||oe.has(t.user_id)||a!=null&&a>0&&m.length>0&&t.skill_rates.some(c=>c.min_rate<=0?!1:m.some(r=>r.toLowerCase()===c.skill_name.toLowerCase())&&c.min_rate>a))return!1;if(s){const d=t.full_name.toLowerCase().includes(s),c=(n=t.location)==null?void 0:n.toLowerCase().includes(s),l=t.skills.some(r=>r.toLowerCase().includes(s));if(!d&&!c&&!l)return!1}return!(y.length>0&&!y.some(c=>t.skills.some(l=>l.toLowerCase()===c.toLowerCase())))})},[C,q,y,te,f==null?void 0:f.id,ae,oe,i,m]),D=s=>!(i!=null&&i.lat)||!(i!=null&&i.lng)||!s.approx_lat||!s.approx_lng?null:ms(i.lat,i.lng,s.approx_lat,s.approx_lng),P=s=>{const t=(y.length>0?y:m).map(n=>{const d=s.skill_rates.find(c=>c.skill_name.toLowerCase()===n.toLowerCase()&&c.min_rate>0);return(d==null?void 0:d.min_rate)??null}).filter(n=>n!==null);return t.length>0?Math.min(...t):null},{data:V}=Ve(C.map(s=>s.user_id)),B=b.useMemo(()=>[...ne].sort((s,a)=>{switch(J){case"distance":{const t=D(s)??99999,n=D(a)??99999;return t-n}case"jobs":return(a.total_jobs??0)-(s.total_jobs??0);case"rate_low":{const t=P(s)??99999,n=P(a)??99999;return t-n}case"rate_high":{const t=P(s)??0;return(P(a)??0)-t}case"relevance":default:{const t=m.length>0?s.skills.filter(l=>m.some(r=>r.toLowerCase()===l.toLowerCase())).length:0,n=m.length>0?a.skills.filter(l=>m.some(r=>r.toLowerCase()===l.toLowerCase())).length:0;if(n!==t)return n-t;const d=D(s)??99999,c=D(a)??99999;return d-c}}}),[ne,m,i,J]),je=(s,a)=>{const t=s.skill_rates.find(n=>n.skill_name.toLowerCase()===a.toLowerCase()&&n.min_rate>0);return t?t.min_rate:null},ve=(s,a)=>{U(t=>{const n=new Set(t[s]??[]);return n.has(a)?n.delete(a):n.add(a),{...t,[s]:n}})},R=s=>he[s]??new Set,_e=async s=>{var n;if(!f||!u)return;const a=R(s),t=a.size>0?Array.from(a):[];se(s);try{const d=((n=C.find(g=>g.user_id===s))==null?void 0:n.full_name)||"Worker",c=t.length>0?t.join(", "):"",l=c?` for ${c}`:"",{data:r,error:x}=await v.rpc("invite_worker_to_job",{_worker_id:s,_job_id:u,_notification_title:t.length>0?`Hire Request: ${c}`:"Job Invitation",_notification_body:t.length>0?`You've been requested to work on ${c} for "${(i==null?void 0:i.title)||"a job"}"`:`You've been invited to apply for "${(i==null?void 0:i.title)||"a job"}"`,_welcome_message:t.length>0?`Hi ${d}! I'd like to hire you for ${c} on my job "${(i==null?void 0:i.title)||""}". Please check it out and apply!`:`Hi! I'd like to invite you to apply for my job posting "${(i==null?void 0:i.title)||""}". Check it out and apply if you're interested!`});if(x)throw x;const h=(r==null?void 0:r.was_new)??!1;le.success(h?`Hire request sent to ${d}${l}!`:`${d} was already invited to this job.`),U(g=>{const j={...g};return delete j[s],j})}catch(d){le.error(d.message||"Failed to send invitation")}finally{se(null)}},Ne=s=>{if(m.length===0)return 0;const a=s.skills.filter(t=>m.some(n=>n.toLowerCase()===t.toLowerCase())).length;return Math.round(a/m.length*100)};return e.jsxs("div",{className:"px-3 py-4 space-y-4 sm:px-6 sm:py-6 sm:space-y-6 max-w-4xl mx-auto",children:[e.jsx(Oe,{title:o.headTitle,de
1scription:o.headDescription}),e.jsxs(M.div,{initial:{opacity:0,y:-16},animate:{opacity:1,y:0},transition:{duration:.5,ease:[.16,1,.3,1]},className:"relative rounded-card sm:rounded-3xl overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-secondary via-secondary/95 to-secondary/90"}),e.jsx("div",{className:"absolute top-0 right-0 w-48 h-48 bg-primary/15 rounded-full blur-3xl -translate-y-1/2 translate-x-1/4"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-32 h-32 bg-primary/10 rounded-full blur-2xl translate-y-1/2 -translate-x-1/4"}),e.jsx("div",{className:"absolute top-0 left-0 right-0 h-1 bg-gradient-to-r from-primary via-warning to-primary"}),e.jsx("div",{className:"relative p-4 sm:p-6",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("button",{onClick:()=>N(-1),className:"p-2 rounded-xl bg-secondary-foreground/10 text-secondary-foreground hover:bg-secondary-foreground/20 transition-all border border-secondary-foreground/10 backdrop-blur-sm mt-0.5",children:e.jsx(ss,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Z,{className:"w-4 h-4 text-primary"}),e.jsx("span",{className:"text-micro font-bold uppercase tracking-[0.15em] text-primary",children:o.eyebrow})]}),e.jsx("h1",{className:"font-display text-xl sm:text-3xl text-secondary-foreground tracking-tight",children:o.title}),i&&e.jsxs("p",{className:"text-xs sm:text-sm text-secondary-foreground/60 mt-1 truncate",children:[o.forJob," ",e.jsx("span",{className:"text-secondary-foreground/90 font-semibold",children:i.title})]})]}),e.jsxs("div",{className:"hidden sm:flex items-center gap-3 bg-secondary-foreground/10 backdrop-blur-sm rounded-xl px-4 py-2.5 border border-secondary-foreground/10",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-lg font-bold text-secondary-foreground",children:B.length}),e.jsx("p",{className:"text-micro uppercase tracking-wider text-secondary-foreground/50",children:o.available})]}),e.jsx("div",{className:"w-px h-8 bg-secondary-foreground/15"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-lg font-bold text-primary",children:m.length}),e.jsx("p",{className:"text-micro uppercase tracking-wider text-secondary-foreground/50",children:o.skills})]})]})]})})]}),e.jsxs(M.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.08},className:"relative",children:[e.jsx(ue,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(ke,{value:w,onChange:s=>E(s.target.value),placeholder:o.searchPlaceholder,type:"search",inputMode:"search",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,enterKeyHint:"search",className:"pl-11 h-11 sm:h-12 text-sm bg-card/90 backdrop-blur-md border-border/60 rounded-xl shadow-sm focus:shadow-md focus:border-primary/40 transition-all"}),G.size>0&&e.jsxs("div",{className:"flex items-center gap-1.5 mt-2 px-1",children:[e.jsx(ue,{className:"w-3 h-3 text-primary/60 shrink-0"}),e.jsx("span",{className:"text-micro font-semibold text-muted-foreground shrink-0",children:o.matchingSkills}),e.jsx("div",{className:"flex flex-wrap gap-1",children:Array.from(G).map(s=>e.jsx("span",{className:"px-2 py-0.5 rounded-md text-micro font-bold bg-primary/15 text-primary border border-primary/20",children:s},s))})]})]}),e.jsxs(M.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.12},className:"rounded-card bg-card/80 backdrop-blur-md border border-border/60 overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3 flex items-center gap-3 overflow-x-auto scrollbar-hide",children:[e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx(X,{className:"w-3.5 h-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-micro font-bold uppercase tracking-[0.12em] text-muted-foreground",children:o.sort})]}),e.jsx("div",{className:"w-px h-5 bg-border/50 shrink-0"}),e.jsx("div",{className:"flex gap-1.5",children:I.map(s=>{const a=s.icon;return e.jsxs("button",{onClick:()=>
1fe(s.value),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-caption font-semibold border whitespace-nowrap transition-all duration-200 ${J===s.value?"bg-primary text-primary-foreground border-primary shadow-sm":"bg-card text-muted-foreground border-border hover:border-primary/40 hover:text-foreground"}`,children:[e.jsx(a,{className:"w-3 h-3"}),s.label]},s.value)})})]}),re.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-px bg-gradient-to-r from-transparent via-border/50 to-transparent"}),e.jsxs("div",{className:"px-4 py-3 space-y-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ts,{className:"w-3.5 h-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-micro font-bold uppercase tracking-[0.12em] text-muted-foreground",children:o.requiredSkills}),_.size>0&&e.jsx("span",{className:"text-micro font-bold text-success px-1.5 py-0.5 rounded-full bg-success/10",children:o.filledCount(_.size,m.length)})]}),y.length>0&&e.jsx("button",{onClick:()=>F([]),className:"text-micro font-semibold text-destructive hover:text-destructive/80 transition-colors",children:o.clear})]}),m.length>0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted/60 overflow-hidden",children:e.jsx(M.div,{initial:{width:0},animate:{width:`${_.size/m.length*100}%`},transition:{duration:.8,ease:[.16,1,.3,1]},className:`h-full rounded-full ${_.size===m.length?"bg-success":"bg-primary"}`})}),e.jsxs("span",{className:`text-micro font-bold tabular-nums ${_.size===m.length?"text-success":"text-primary"}`,children:[Math.round(_.size/m.length*100),"%"]})]}),e.jsx(Se,{delayDuration:200,children:e.jsx("div",{className:"flex flex-wrap gap-1.5",children:re.map(s=>{const a=y.includes(s),t=_.has(s.toLowerCase()),n=be.get(s.toLowerCase())??[],d=e.jsxs("button",{onClick:()=>ye(s),className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-caption font-semibold border transition-all duration-200 hover:scale-[1.03] active:scale-95 ${t&&a?"bg-success text-success-foreground border-success shadow-md shadow-success/25 ring-2 ring-success/30":t?"bg-success/15 text-success border-success/30":a?"bg-primary text-primary-foreground border-primary shadow-md shadow-primary/25 ring-2 ring-primary/30":"bg-card text-muted-foreground border-border hover:border-primary/40 hover:text-foreground"}`,children:[t&&e.jsx(z,{className:"w-3 h-3"}),a&&!t&&e.jsx(z,{className:"w-3 h-3"}),s,t&&e.jsx("span",{className:"text-micro font-bold uppercase tracking-wider opacity-60",children:o.filledTag})]},s);return t&&n.length>0?e.jsxs(Ce,{children:[e.jsx(Me,{asChild:!0,children:d}),e.jsxs(Le,{side:"bottom",className:"text-xs max-w-[200px]",children:[e.jsx("p",{className:"font-semibold mb-0.5",children:o.coveredBy}),n.map(c=>e.jsx("p",{className:"text-muted-foreground",children:c},c))]})]},s):d})})})]})]})]}),e.jsx(M.div,{initial:{opacity:0}
1,animate:{opacity:1},transition:{delay:.15},className:"flex items-center justify-between px-1",children:e.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-bold text-foreground",children:o.workersFound(B.length)}),Q.length>0&&e.jsx("span",{className:"ml-1.5 text-muted-foreground/70",children:o.alreadyApplied(Q.length)})]})}),e.jsx(ds,{skills:y.length>0?y:m,locationLabel:(i==null?void 0:i.location)??null}),ge?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-12 h-12 rounded-full border-2 border-primary/20 border-t-primary animate-spin"}),e.jsx(Z,{className:"w-4 h-4 text-primary absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:o.findingBest})]}):B.length===0?e.jsxs(M.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"text-center py-16 rounded-card bg-card/80 backdrop-blur-md border border-border/60",children:[e.jsx("div",{className:"w-14 h-14 rounded-card bg-secondary/60 flex items-center justify-center mx-auto mb-3",children:e.jsx(rs,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("p",{className:"text-sm font-semibold text-foreground",children:o.noWorkersFound}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:o.tryAdjusting}),y.length>0&&e.jsx("button",{onClick:()=>F([]),className:"text-xs text-primary mt-3 hover:underline font-medium",children:o.clearAllFilters})]}):e.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:B.map((s,a)=>{const t=A.has(s.user_id),n=s.skills.filter(r=>m.some(x=>x.toLowerCase()===r.toLowerCase())),d=s.full_name.split(" ").map(r=>r[0]).join("").slice(0,2),c=D(s),l=Ne(s);return e.jsxs(M.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:a*.04,duration:.45,ease:[.16,1,.3,1]},className:"group relative rounded-card bg-card/90 backdrop-blur-md border border-border/60 overflow-hidden hover:border-primary/30 hover:shadow-lg hover:shadow-primary/5 transition-all duration-300",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-0.5 bg-gradient-to-r from-transparent via-primary/30 to-transparent opacity-0 group-hover:opacity-100 transition-opacity"}),e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("button",{onClick:()=>N(`/profile/${s.user_id}`),className:"shrink-0 relative",children:[s.avatar_url?e.jsx("img",{src:Ye(s.avatar_url,96),alt:s.full_name,className:"w-12 h-12 rounded-xl object-cover ring-2 ring-border/60 group-hover:ring-primary/40 transition-all shadow-sm",loading:"lazy",decoding:"async"}):e.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-primary/20 to-primary/5 flex items-center justify-center text-sm font-bold text-primary ring-2 ring-border/60 group-hover:ring-primary/40 transition-all shadow-sm",children:d}),e.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 w-3.5 h-3.5 rounded-full bg-success border-2 border-card"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("button",{onClick:()=>N(`/profile/${s.user_id}`),className:"text-left group/name",children:e.jsxs("h4",{className:"font-display text-sm sm:text-base text-foreground group-hover/name:text-primary transition-colors truncate flex items-center gap-1.5",children:[s.full_name,e.jsx(as,{className:"w-3 h-3 text-muted-foreground opacity-0 group-hover/name:opacity-100 transition-opacity"})]})}),e.jsx("div",{className:"mt-0.5",children:e.jsx(Ke,{userId:s.user_id})}),e.jsxs("div",{className:"flex items-center gap-2.5 mt-1 flex-wrap",children:[e.jsxs("span",{className:"flex items-center gap-1 text-caption text-muted-foreground",children:[e.jsx(xe,{className:"w-3 h-3"})," ",o.jobsCount(s.total_jobs)]}),e.jsx(Ze,{stat:(V==null?void 0:V.get(s.user_id))??null}),c!=null?e.jsxs("span",{className:`flex items-center gap-1 text-caption font-medium ${c<=10?"text-success":c<=25?"text-warning":"text-muted-foreground"}`,children:[e.jsx(O,{className:"w-3 h-3"})," ",ce(c)," mi"]}):s.location?e.jsxs("span",{className:"flex items-center gap-1 text-caption text-muted-foreground truncate max-w-[120px]",children:[e.jsx(O,{className:"w-3 h-3"})," ",s.location]}):e.jsxs("span",{className:"flex items-center gap-1 text-caption text-muted-foreground
1/70 italic",title:o.noCoordsTitle,children:[e.jsx(O,{className:"w-3 h-3"})," ",ce(null)]})]})]}),l>0&&(()=>{const x=(s.total_jobs??0)===0?"new":Ge(l);return e.jsx("span",{className:`shrink-0 inline-flex items-center px-2 py-1 rounded-full text-micro font-semibold border ${Qe(x)}`,children:Je(x)})})()]}),n.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[(()=>{const r=n.filter(g=>!_.has(g.toLowerCase())),x=R(s.user_id),h=r.length>0&&r.every(g=>x.has(g));return r.length>1?e.jsx("button",{onClick:()=>{U(g=>{const j=new Set(g[s.user_id]??[]);return h?r.forEach(k=>j.delete(k)):r.forEach(k=>j.add(k)),{...g,[s.user_id]:j}})},className:"text-micro font-semibold text-primary hover:text-primary/80 transition-colors px-1",children:h?o.deselectAll:o.selectAll}):null})(),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.map(r=>{const x=je(s,r),h=_.has(r.toLowerCase()),g=R(s.user_id).has(r),j=G.has(r.toLowerCase());return e.jsxs("button",{onClick:()=>!h&&ve(s.user_id,r),disabled:h,className:`group/skill inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold border transition-all hover:scale-[1.03] active:scale-95 ${h?"bg-success/10 text-success/60 border-success/20 cursor-not-allowed opacity-60":g?"bg-primary text-primary-foreground border-primary shadow-md shadow-primary/20 ring-2 ring-primary/30 ring-offset-1 ring-offset-background":j?"bg-primary/20 text-primary border-primary/40 shadow-md shadow-primary/10 ring-2 ring-primary/25 ring-offset-1 ring-offset-background animate-pulse":"bg-primary/10 text-primary border-primary/25 shadow-sm shadow-primary/5 hover:bg-primary/20 hover:border-primary/40"}`,children:[h?e.jsx(z,{className:"w-3 h-3"}):g?e.jsx(z,{className:"w-3 h-3"}):e.jsx(os,{className:"w-3 h-3 opacity-60 group-hover/skill:opacity-100 transition-opacity"}),e.jsx("span",{children:r}),x!=null&&!h&&e.jsxs("span",{className:`text-micro font-bold px-1.5 py-0.5 rounded-md ${g?"bg-primary-foreground/20 text-primary-foreground":"bg-primary/15 text-primary"}`,children:["$",x,"/hr"]}),h&&e.jsx("span",{className:"text-micro uppercase tracking-wider opacity-70",children:o.filledTag})]},r)})})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-1 border-t border-border/60",children:[e.jsxs("button",{onClick:()=>p.mutate({workerId:s.user_id,jobId:u}),disabled:p.isPending,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-caption font-medium border transition-all h-8 ${t?"bg-destructive/10 text-destructive border-destructive/25 hover:bg-destructive/20":"bg-card text-muted-foreground border-border/60 hover:border-primary/30 hover:text-foreground"}`,children:[e.jsx(ns,{className:`w-3 h-3 ${t?"fill-destructive":""}`}),t?o.saved:o.save]}),e.jsx("div",{className:"flex-1"}),e.jsxs(Ae,{size:"sm",onClick:()=>K(s.user_id),disabled:ee===s.user_id,className:"text-caption h-8 px-4 gap-1.5 rounded-lg shadow-md shadow-primary/15 hover:shadow-lg hover:shadow-primary/25 transition-all",children:[ee===s.user_id?e.jsx(qe,{className:"w-3 h-3 animate-spin"}):e.jsx(is,{className:"w-3 h-3"}),R(s.user_id).size>0?o.hireForSkills(R(s.user_id).size):o.invite]})]})]})]},s.user_id)})}),e.jsx($e,{open:!!$,onOpenChange:s=>{s||K(null)},children:e.jsxs(Re,{children:[e.jsxs(Ie,{children:[e.jsx(Fe,{children:o.confirmHireRequest}),e.jsx(De,{asChild:!0,children:e.jsx("div",{className:"space-y-3",children:(()=>{const s=C.find(n=>n.user_id===$),a=$?R($):new Set,t=Array.from(a);return e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:t.length>0?e.jsxs(e.Fragment,{children:[o.sendHireRequestSkills," ",e.jsx("span",{className:"font-semibold text-foreground",children:(s==null?void 0:s.full_name)||o.workerDefault})," ",o.sendHireRequestSkillsSuffix]}):e.jsxs(e.Fragment,{children:[o.sendJobInvitation," ",e.jsx("span",{className:"font-semibold text-foreground",children:(s==null?void 0:s.full_name)||o.workerDefault}),o.sendJobInvitationSuffix]})}),t.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:t.map(n=>e.jsx(He,{variant:"secondary",className:"text-xs px-2.5 py-1",children:n},n))}),(i==null?void 0:i.title)&&e.jsxs("p",{className:"text-xs text-muted-foreground pt-1",children:[o.jobLabel," ",e.jsx("span",{className:"font-medium text-foreground",children:i.title})]})]})})()})})]}),e.jsxs(We,{children:[e.jsx(Te,{children:o.cancel}),e.jsxs(Ee,{onClick:()=>{$&&(_e($),K(null))},children:[e.jsx(ls,{className:"w-3.5 h-3.5 mr-1.5"}),o.sendRequest]})]})]})})]})}export{Os 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.