1import{j as t,r as m,a as K,H as de}from"./index.esm-BxWFwCRV.js";import{CreditsConfirmationDialog as me}from"./credits-confirmation-dialog-gTheIEcl.js";import{S as ue,a as pe,C as he}from"./search-results-header-By3Q6I_2.js";import{B as ge}from"./button-C-SSWUAC.js";import{I as xe}from"./label-DYLOJOI3.js";import{S as B,a as I,b as O,c as R,d as A}from"./select-B1-_EmGF.js";import{c as z}from"./index-DSDuzvrg.js";import{S as fe}from"./search-CBzGfPz5.js";import{X as ye}from"./sheet-DvMn9DJh.js";import{S as be}from"./search-name-cell-BX0WxdA_.js";import{a as k,b as Ce}from"./data-table-column-header-B6peElYp.js";import{B as X}from"./badge-CtVZLXvY.js";import{C as W}from"./checkbox-ZUXC5Ltz.js";import{P as ne,a as re,b as ae}from"./popover-Cvi_sG6Z.js";import{h as Y,j as q,k as G,T as _e,a4 as je,au as Z,u as se,o as Ne}from"./index-Dg8k4TaQ.js";import{s as ve}from"./index--ZCcDBSi.js";import{d as V}from"./html-text-CZVPxgVx.js";import{C as Se}from"./circle-help-DFlXc0l3.js";import{E as ke}from"./external-link-BT95J2U2.js";import{T as ee}from"./trending-up-B3Gf8uwg.js";import{u as we}from"./use-company-list-actions-Be7Whi1V.js";import{n as te,b as Te,a as Ee}from"./company-enrichment-batch-B024d4gu.js";import{X as Pe,A as Fe}from"./app-layout-Di5W296C.js";import{t as L}from"./index-GQWG8pxW.js";import{u as Ae}from"./use-debounce-BCDrud7K.js";import{b as Le,g as $e}from"./company-bulk-credits-dialog-DWkiwpSR.js";import{S as Me}from"./breadcrumbs-Di82rGXO.js";import"./credit-costs-K_xscHiY.js";import"./billing-utils-BWCKfQOE.js";import"./use-typed-page-DXO81OlP.js";import"./filter-utils-CseKKTR-.js";import"./filter-CrprgqXb.js";import"./createLucideIcon-CDNZ6-WK.js";import"./building-2-DMbCoBho.js";import"./map-pin-BkPmdd13.js";import"./sparkles-fA-GrO8H.js";import"./triangle-alert-BNjnHes0.js";import"./loader-circle-B8EBsjRh.js";import"./building-ByqHc_3B.js";import"./index-CzMU6HRa.js";import"./save-to-list-menu-CklJOjyX.js";import"./command-Dt_1gsNE.js";import"./index-D-HdmRDX.js";import"./index-XmWYkZJ5.js";import"./index-BH5iaPk6.js";import"./index-C_SHgnPd.js";import"./user-round-search-DTNPzy8P.js";import"./refresh-cw-k2ucJxXP.js";import"./company-utils-E8dAqqs8.js";import"./date-utils-COFYKiIG.js";import"./format-C7KB_mWR.js";import"./toDate-BoFoOYoS.js";import"./index-CMdn6XKl.js";import"./index-D4-ptLa7.js";import"./parseISO-BZ6cSQhi.js";import"./company-filter-panel-constants-pCo1BegO.js";import"./circle-check-Cxj0YP_N.js";import"./multi-select-dropdown-DRWZanx0.js";import"./chevron-up-PsQYZ1B6.js";import"./company-search-state-CqZfnc7t.js";import"./index-BdQq_4o_.js";import"./index-C0CRxioY.js";import"./globe-CiYsnStx.js";import"./linkedin-D8IQ3V-p.js";import"./hub-actions-B9KOtnaA.js";import"./chevrons-right-CTwLuiI1.js";import"./chevron-left-D4qpdmxj.js";import"./index-CeXmm55O.js";import"./settings-2-BvuiLzNm.js";import"./debounced-input-ChWul_Ki.js";import"./table-aikJtiyk.js";import"./arrow-up-DUX_b30z.js";import"./chevrons-up-down-CMPk3JOL.js";import"./index-wW2BnLNW.js";import"./log-out-DtCYhMEq.js";import"./decode-9ueDBdkB.js";import"./saved-list-requests-ThpW4OUC.js";import"./app-logo-icon-CicL3Kjq.js";import"./alert-DJht7zHt.js";import"./card-9qfFMYBn.js";import"./index-BgsQtqey.js";const ze=[{value:"all",label:"Any Date"},{value:"today",label:"Today"},{value:"week",label:"Past Week"},{value:"month",label:"Past Month"}];function Be({filters:e,filterOptions:n,searchQuery:a,onSearchChange:o,onSearchSubmit:s,onCompanyChange:i,onLocationChange:c,onEmploymentTypeChange:r,onPostedAfterChange:d,hasActiveFilters:p,onClearFilters:g}){return t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsxs("div",{className:"relative max-w-[280px] min-w-[200px]",children:[t.jsx(fe,{className:"text-muted-foreground absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2"}),t.jsx(xe,{placeholder:"Search job titles...",value:a,onChange:l=>o(l.target.value),onKeyDown:l=>{l.key==="Enter"&&s()},className:z("pl-9",a&&"border-primary")})]}),n.companies.length>0&&t.jsxs(B,{value:e.company_name||"all",onValueChange:l=>i(l==="all"?"":l),children:[t.jsx(I,{className:z("w-[180px] [&>span]:block [&>span]:truncate",e.company_name&&"border-primary"),children:t.jsx(O,{placeholder:"All Companies"})}),t.jsxs(R,{children:[t.jsx(A,{value:"all",children:"All Companies"}),n.companies.map(l=>t.jsx(A,{value:l.value,children:l.label},l.value))]})]}),n.locations.length>0&&t.jsxs(B,{value:e.location||"all",onValueChange:l=>c(l==="all"?"":l),children:[t.jsx(I,{className:z("w-[160px] [&>span]:block [&>span]:truncate",e.location&&"border-primary"),children:t.jsx(O,{placeholder:"All Locations"})}),t.jsxs(R,{children:[t.jsx(A,{value:"all",children:"All Locations"}),n.locations.map(l=>t.jsx(A,{value:l.value,children:l.label},l.value))]})]}),n.employmentTypes.length>0&&t.jsxs(B,{value:e.employment_type||"all",onValueChange:l=>r(l==="all"?"":l),children:[t.jsx(I,{className:z("w-[140px]",e.employment_type&&"border-primary"),children:t.jsx(O,{placeholder:"Job Type"})}),t.jsxs(R,{children:[t.jsx(A,{value:"all",children:"All Types"}),n.employmentTypes.map(l=>t.jsx(A,{value:l.value,children:l.label},l.value))]})]}),t.jsxs(B,{value:e.posted_after||"all",onValueChange:l=>d(l==="all"?"":l),children:[t.jsx(I,{className:z("w-[130px]",e.posted_after&&"border-primary"),children:t.jsx(O,{placeholder:"Posted"})}),t.jsx(R,{children:ze.map(l=>t.jsx(A,{value:l.value,children:l.label},l.value))})]}),p&&t.jsxs(ge,{variant:"ghost",size:"sm",onClick:g,className:"gap-1.5",children:[t.jsx(ye,{className:"h-4 w-4"}),"Clear"]})]})}const Ie=new Set(["united states","united states of america","usa","canada","united kingdom","australia","new zealand","germany","france","japan","south korea","switzerland","netherlands","sweden","norway","denmark","finland","belgium","austria","ireland","israel","singapore"]);function Oe(e){return e?e.toLowerCase().replace(/_/g," ").replace(/-/g," ").split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "):"â"}function Re(e){if(!e)return"â";const n={full_time:"Full Time","full-time":"Full Time",fulltime:"Full Time",part_time:"Part Time","part-time":"Part Time",parttime:"Part Time",contract:"Contract",temporary:"Temporary",temp:"Temporary",internship:"Internship",intern:"Internship",freelance:"Freelance",consultant:"Consultant",remote:"Remote",hybrid:"Hybrid",onsite:"On-site",on_site:"On-site","on-site":"On-site"},a=e.toLowerCase().trim();return n[a]??Oe(e)}function oe(e){const n=[];if(e.employment_type){const o=Re(e.employment_type);o!=="â"&&n.push(o.toLowerCase())}if(e.location&&n.push(e.location),e.salary_range&&n.push(`Salary: ${e.salary_range}`),n.length===0)return"";const a=n.join(" ⢠");return a.charAt(0).toUpperCase()+a.slice(1)+"."}function ie(e){var s;const n=(s=e==null?void 0:e.metrics_data)==null?void 0:s.region_distribution_by_country;if(!n||Object.keys(n).length===0)return null;const a=Object.values(n).reduce((i,c)=>i+c,0);if(a===0)return null;const o=Object.entries(n).reduce((i,[c,r])=>Ie.has(c.toLowerCase())?i+r:i,0);return Math.round(o/a*100)}function Ue(e){var n,a,o;return((n=e==null?void 0:e.logo_urls)==null?void 0:n["200x200"])||((a=e==null?void 0:e.logo_urls)==null?void 0:a["100x100"])||((o=e==null?void 0:e.logo_urls)==null?void 0:o.default)}const Je=e=>{if(e>=1e9){const n=e/1e9;return`$${Number.isInteger(n)?n.toFixed(0):n.toFixed(1)}B`}if(e>=1e6){const n=e/1e6;return`$${Number.isInteger(n)?n.toFixed(0):n.toFixed(1)}M`}if(e>=1e3){const n=e/1e3;return`$${Number.isInteger(n)?n.toFixed(0):n.toFixed(1)}K`}return`$${e}`},De=e=>{const n=Array.from(e.matchAll(/\$?([\d,]+(?:\.\d+)?)/g));if(n.length===0)return e;const a=n.map(o=>{const s=Number(o[1].replace(/,/g,""));return Number.isNaN(s)?null:Je(s)}).filter(o=>!!o);return a.length===1?a[0]:a.length>=2?`${a[0]}-${a[1]}`:e},He=e=>{const n=e.revenue_range;if(!n||typeof n=="string")return typeof n=="string"?De(n):null;const a=n.estimatedMinRevenue,o=n.estimatedMaxRevenue,s=((a==null?void 0:a.unit)||(o==null?void 0:o.unit)||"").toLowerCase(),i=d=>
1{if(d==null)return null;if(s==="million"||d>=1e6){const p=s==="million"?d:d/1e6;return`$${Number.isInteger(p)?p.toFixed(0):p.toFixed(1)}M`}if(s==="billion"||d>=1e9){const p=s==="billion"?d:d/1e9;return`$${Number.isInteger(p)?p.toFixed(0):p.toFixed(1)}B`}if(s==="thousand"||d>=1e3){const p=s==="thousand"?d:d/1e3;return`$${Number.isInteger(p)?p.toFixed(0):p.toFixed(1)}K`}return`$${d}`},c=i(a==null?void 0:a.amount),r=i(o==null?void 0:o.amount);return c&&r?c===r?c:`${c}-${r}`:c||r||null};function Q(e){var n,a,o,s,i,c,r,d,p,g,l,w,S,N,x;return{id:0,uuid:e.company_uuid||"",name:V(e.company_name),email:"",location:e.company_location||e.location||"",industry:e.company_industry||e.industry||"",domain:e.company_domain||"",size:e.company_size||"",foundedYear:"",technologies:[],description:((n=e.company)==null?void 0:n.description)||"",blurb:((a=e.company)==null?void 0:a.description)||oe(e),logo:Ue(e.company),website:e.company_website||((o=e.company)==null?void 0:o.website)||"",linkedin_url:e.company_linkedin_url||((s=e.company)==null?void 0:s.linkedin_url),specialties:((i=e.company)==null?void 0:i.specialties)||[],revenue_range:(c=e.company)==null?void 0:c.revenue_range,job_openings_data:(r=e.company)==null?void 0:r.job_openings_data,job_openings_status:(d=e.company)==null?void 0:d.job_openings_status,metrics_data:(p=e.company)==null?void 0:p.metrics_data,enriched:!!((g=e.company)!=null&&g.is_enriched),is_enriched:(l=e.company)==null?void 0:l.is_enriched,enrichmentStatus:(w=e.company)==null?void 0:w.enrichmentStatus,has_people_access:(S=e.company)==null?void 0:S.has_people_access,updated_at:(N=e.company)==null?void 0:N.updated_at,updated_at_human:(x=e.company)==null?void 0:x.updated_at}}function Ke(e){var c,r,d,p;const n=Q(e),a=[],o=((c=n.job_openings_data)==null?void 0:c.total_jobs_found)??0;n.job_openings_status==="processing"?a.push({label:"Checking hiring",tone:"neutral"}):((r=n.job_openings_data)==null?void 0:r.success)===!0&&o>0?a.push({label:o===1?"1 open role":`${o} open roles`,tone:"positive"}):n.job_openings_status==="completed"&&a.push({label:"No active roles",tone:"danger"});const s=He(n);s&&a.push({label:s,tone:"neutral"});const i=(p=(d=n.metrics_data)==null?void 0:d.employee_metrics)==null?void 0:p.growth_12m_percent;if(i!==void 0){const g=Number.isInteger(i)?i.toFixed(0):i.toFixed(1);a.push({label:`${g}% growth`,tone:i>0?"positive":"neutral"})}return n.foundedYear&&a.push({label:`Founded ${n.foundedYear}`,tone:"neutral"}),a.slice(0,3)}const le=t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"mb-1 font-semibold",children:"Team overlap"}),t.jsx("p",{children:"Higher percentages suggest more of the workforce sits in developed markets such as the US, UK, Canada, and Australia."})]});function Ve({href:e,label:n,icon:a}){return t.jsx(_e,{children:t.jsxs(Y,{children:[t.jsx(q,{asChild:!0,children:t.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 transition-colors hover:text-gray-700",onClick:o=>o.stopPropagation(),children:a})}),t.jsx(G,{children:n})]})})}function Qe({job:e}){const n=V(e.title),a=V(oe(e)),o=80,s=a.length>o?`${a.substring(0,o)}...`:a;return t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[e.job_url?t.jsx("a",{href:e.job_url,target:"_blank",rel:"noopener noreferrer",className:"text-foreground truncate text-sm font-medium capitalize transition-colors hover:text-blue-700 hover:underline",onClick:i=>i.stopPropagation(),children:n}):t.jsx("span",{className:"text-foreground truncate text-sm font-medium capitalize",children:n}),e.job_url&&t.jsx(Ve,{href:e.job_url,label:"View original posting",icon:t.jsx(ke,{className:"h-3.5 w-3.5 shrink-0"})})]}),a&&t.jsx("div",{className:"text-muted-foreground truncate text-xs",children:s})]})}function U({value:e}){return e?t.jsx("span",{className:"text-sm",children:e}):t.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}function Ye({job:e}){const[n,a]=m.useState(!1);if(!e.hiring_manager_name)return t.jsx("span",{className:"text-muted-foreground text-sm",children:"-"});const o=i=>{var r;
1const c=i.split(" ").filter(Boolean);return c.length>=2?(c[0][0]+c[c.length-1][0]).toUpperCase():((r=c[0])==null?void 0:r.substring(0,2).toUpperCase())??""},s=t.jsx("div",{className:"flex items-center",onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:t.jsx("div",{className:"bg-muted text-muted-foreground flex h-10 w-10 shrink-0 items-center justify-center rounded-full border border-gray-200 text-xs font-medium ring-1 ring-stone-200",children:o(e.hiring_manager_name)})});return t.jsxs(ne,{open:n,onOpenChange:a,children:[t.jsx(re,{asChild:!0,children:s}),t.jsx(ae,{className:"w-72",align:"start",side:"bottom",sideOffset:4,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:t.jsx("div",{className:"space-y-3",children:t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-xs font-semibold tracking-[0.14em] text-gray-500 uppercase",children:"Hiring manager"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"bg-muted text-muted-foreground flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-gray-200 text-[11px] font-medium",children:o(e.hiring_manager_name)}),t.jsxs("div",{className:"min-w-0",children:[e.hiring_manager_linkedin?t.jsx("a",{href:e.hiring_manager_linkedin,target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-gray-700 hover:text-gray-900 hover:underline",children:e.hiring_manager_name}):t.jsx("p",{className:"text-sm font-medium text-gray-700",children:e.hiring_manager_name}),e.hiring_manager_title&&t.jsx("p",{className:"text-muted-foreground text-xs",children:e.hiring_manager_title})]})]})]})})})]})}function qe({job:e}){const n=Ke(e);if(n.length===0)return t.jsx("span",{className:"text-muted-foreground text-sm",children:"-"});const a=n.slice(0,2),o=n.slice(2),s=Math.max(0,n.length-a.length);return t.jsxs("div",{className:"flex flex-nowrap items-center gap-1.5 overflow-hidden",children:[a.map(i=>t.jsxs(X,{variant:"secondary",className:i.tone==="positive"?"h-6 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2.5 text-[11px] font-medium text-emerald-700":i.tone==="danger"?"h-6 shrink-0 rounded-full border border-rose-200 bg-rose-50 px-2.5 text-[11px] font-medium text-rose-700":"h-6 max-w-[11rem] shrink-0 rounded-full border border-gray-200 bg-gray-50 px-2.5 text-[11px] font-medium text-gray-700",children:[i.tone==="positive"&&t.jsx(ee,{className:"mr-1 h-3 w-3"}),t.jsx("span",{className:"truncate",children:i.label})]},i.label)),s>0&&t.jsxs(ne,{children:[t.jsx(re,{asChild:!0,children:t.jsxs("button",{type:"button",className:"inline-flex h-6 shrink-0 items-center rounded-full border border-gray-200 bg-gray-50 px-2.5 text-[11px] font-medium text-gray-700 transition-colors hover:bg-gray-100","aria-label":`Show ${s} more signal${s===1?"":"s"}`,children:["+",s]})}),t.jsx(ae,{align:"start",side:"top",sideOffset:8,className:"w-auto max-w-xs rounded-xl border-gray-200 bg-white p-3 shadow-sm",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-xs font-semibold tracking-[0.14em] text-gray-500 uppercase",children:"More signals"}),t.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.map(i=>t.jsxs(X,{variant:"secondary",className:i.tone==="positive"?"h-6 rounded-full border border-emerald-200 bg-emerald-50 px-2.5 text-[11px] font-medium text-emerald-700":i.tone==="danger"?"h-6 rounded-full border border-rose-200 bg-rose-50 px-2.5 text-[11px] font-medium text-rose-700":"h-6 rounded-full border border-gray-200 bg-gray-50 px-2.5 text-[11px] font-medium text-gray-700",children:[i.tone==="positive"&&t.jsx(ee,{className:"mr-1 h-3 w-3"}),i.label]},i.label))})]})})]})]})}function Ge({job:e}){const n=ie(e.company);return n===null?t.jsx("span",{className:"text-muted-foreground text-xs",children:"-"}):t.jsxs(Y,{children:[t.jsx(q,{asChild:!0,children:t.jsxs("span",{className:"text-foreground cursor-help text-sm tabular-nums",children:[n,"%"]})}),t.jsx(G,{side:"bottom",className:"max-w-xs",children:le})]})}function Xe({organizationSlug:e,results:n,selectedItems:a,onSelectAll:o,onToggleSelection:s,onEnrichCompany:i}){const c=r=>e&&r?ve.url({organization:e,company:r}):"#";return[{id:"select",header:()=>{const r=n.map(g=>g.id),d=r.length>0&&r.every(g=>a.includes(g)),p=a.length>0&&!d;return t.jsx(W,{checked:d||p&&"indeterminate",onCheckedChange:o,"aria-label":"Select all"})},cell:({row:r})=>t.jsx(W,{checked:a.includes(r.original.id),onCheckedChange:()=>s(r.original.id),"aria-label":"Select row"}),enableSorting:!1,enableHiding:!1,size:50,meta:{className:"border-r-0 px-4",headerClassName:"h-6"}},{accessorKey:"company_name",header:({column:r})=>t.jsx(k,{column:r,title:"Name"}),enableSorting:!1,size:280,meta:{className:"border-r-0 px-4 py-1",headerClassName:"h-6"},cell:({row:r})=>t.jsx(be,{result:Q(r.original),getProfileUrl:c})},{accessorKey:"title",size:240,header:({column:r})=>t.jsx(k,{column:r,title:"Job Title"}),meta:{className:"border-r-0 px-4 py-1",headerClassName:"h-6"},cell:({row:r})=>t.jsx(Qe,{job:r.original}),enableSorting:!1},{accessorKey:"hiring_manager_name",size:164,header:({column:r})=>t.jsx(k,{column:r,title:"Hiring Manager"}),meta:{className:"border-r-0 px-4 py-1",headerClassName:"h-6"},cell:({row:r})=>t.jsx(Ye,{job:r.original}),enableSorting:!1},{accessorKey:"posted_date",size:190,header:({column:r})=>t.jsx(k,{column:r,title:"Date Posted"}),meta:{className:"border-r-0 px-4 py-1",headerClassName:"h-6"},cell:({row:r})=>t.jsx(U,{value:r.original.posted_date}),enableSorting:!1},{id:"signals",accessorKey:"description",header:({column:r})=>t.jsx(k,{column:r,title:"Signals"}),size:260,meta:{className:"border-r-0 px-4 py-1",headerClassName:"h-6"},cell:({row:r})=>t.jsx(qe,{job:r.original}),enableSorting:!1},{id:"team-overlap",accessorFn:r=>ie(r.company)??-1,size:156,header:({column:r})=>t.jsx(k,{column:r,title:t.jsxs(Y,{children:[t.jsx(q,{asChild:!0,children:t.jsxs("span",{className:"inline-flex cursor-help items-center",children:["Team overlap",t.jsx(Se,{className:"text-muted-foreground ml-1 inline h-3.5 w-3.5"})]})}),t.jsx(G,{side:"bottom",className:"max-w-xs",children:le})]})}),meta:{className:"border-r-0 px-4 py-1",headerClassName:"h-6"},cell:({row:r})=>t.jsx(Ge,{job:r.original}),enableSorting:!1}
1,{id:"size",accessorKey:"company_size",size:112,header:({column:r})=>t.jsx(k,{column:r,title:"Size"}),meta:{className:"border-r-0 px-4 py-1",headerClassName:"h-6"},cell:({row:r})=>t.jsx(U,{value:r.original.company_size}),enableSorting:!1},{id:"industry",accessorKey:"company_industry",header:({column:r})=>t.jsx(k,{column:r,title:"Industry"}),meta:{className:"border-r-0 px-4 py-1",headerClassName:"h-6"},cell:({row:r})=>t.jsx(U,{value:r.original.company_industry||r.original.industry}),enableSorting:!1},{id:"location",accessorKey:"company_location",header:({column:r})=>t.jsx(k,{column:r,title:"Location"}),meta:{className:"border-r-0 px-4 py-1",headerClassName:"h-6"},cell:({row:r})=>t.jsx(U,{value:r.original.company_location||r.original.location}),enableSorting:!1},{id:"actions",size:132,header:({column:r})=>t.jsx(k,{column:r,title:"Actions"}),meta:{className:"border-r-0 px-4 py-1",headerClassName:"h-6"},cell:({row:r})=>{const d=Q(r.original);return d.uuid?t.jsx(ue,{company:d,onEnrich:i,profileUrl:c(d.uuid)}):t.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})},enableSorting:!1}]}function We({results:e,search:n,organizationSlug:a}){const[o,s]=m.useState([]),[i,c]=m.useState(!1),[r,d]=m.useState(null),[p,g]=m.useState(!1),l=m.useCallback(h=>{const f=h.map(y=>y.company_uuid).filter(y=>!!y);return te(f)},[]),w=m.useCallback(h=>{s(f=>f.includes(h)?f.filter(y=>y!==h):[...f,h])},[]),S=m.useCallback(()=>{const h=e.map(y=>y.id);if(h.every(y=>o.includes(y))){s([]);return}s(h)},[e,o]),N=m.useCallback(()=>{s([])},[]),x=m.useMemo(()=>{const h=e.filter(f=>o.includes(f.id));return l(h)},[l,e,o]),{handleAddToList:v,handleCreateList:M}=we({organizationSlug:a,selectedCompanyUuids:x,onSuccess:N,addSuccessMessage:"Companies added to list successfully"}),j=m.useCallback((h,f)=>{let y=[];if(h==="selected"){if(o.length===0)return;y=e.filter($=>o.includes($.id))}else y=e;const F=l(y);if(F.length===0){L.error("No companies found in selected jobs");return}d({companyUuids:F,options:{company:f==="enrich",people:!0,excludedSeniorities:["Managers","Seniors"]}}),g(f==="find-people"),c(!0)},[l,e,o]),P=m.useCallback((h,f="enrich")=>{const y=[...new Set(h.filter(Boolean))];if(y.length===0){L.error("No companies found in selected jobs");return}d({companyUuids:y,options:{company:f==="enrich",people:!0,excludedSeniorities:["Managers","Seniors"]}}),g(f==="find-people"),c(!0)},[]),T=m.useCallback((h,f,y)=>{if(!a)return;const F=te(h);if(F.length===0){L.error("No companies found in selected jobs");return}const $=String(n.id||n.uuid||"");if(!$){L.error("Invalid job search ID");return}K.post(je.url({organization:a}),Te({batchName:`${n.name} - ${y==="find-people"?"Find People":"Enrich"}`,source:"jobs",exploreJobId:$,companyUuids:F,options:f}),{preserveState:!0,preserveScroll:!0,onSuccess:()=>{L.success("Enrichment batch created successfully"),c(!1),d(null),s([])},onError:H=>{L.error(Pe(H,"Failed to create enrichment batch"))}})},[a,n]),u=m.useCallback(h=>{j(h,"enrich")},[j]),C=m.useCallback(h=>{j(h,"find-people")},[j]),b=m.useCallback(h=>{P([h],"enrich")},[P]),_=m.useCallback(h=>{if(!r)return;const f=h||r.options;T(r.companyUuids,f,p?"find-people":"enrich")},[p,r,T]),J=m.useCallback(()=>{c(!1),d(null)},[]),D=m.useCallback(h=>{if(x.length===0){L.error("No companies found in selected jobs");return}T(x,Ee(h),"enrich")},[x,T]);return{selectedItems:o,showCreditsDialog:i,pendingEnrichment:r,findPeopleMode:p,selectedCompanyUuids:x,handleToggleSelection:w,handleSelectAll:S,handleClearSelection:N,handleEnrichClick:u,handleFindPeopleClick:C,handleEnrichCompany:b,handleConfirmEnrichment:_,handleCancelEnrichment:J,handleAddToList:v,handleCreateList:M,handleEnrichFromBar:D}}function Ze({initialFilters:e,searchId:n,organizationSlug:a,perPage:o}){const[s,i]=m.useState(e),[c,r]=m.useState(e.search||""),[d,p]=m.useState(o),[g,l]=m.useState(!1),w=m.useRef(!0),S=m.useRef(s),N=Ae(c,300);m.useEffect(()=>{S.current=s},[s]);const x=m.useCallback((u,C=1,b=d)=>{const _={page:C,per_page:b};return u.search&&(_.search=u.search),u.company_name&&(_.company_name=u.company_name),u.location&&(_.location=u.location),u.employment_type&&(_.employment_type=u.employment_type),u.industry&&(_.industry=u.industry),u.posted_after&&(_.posted_after=u.posted_after),_},[d]),v=m.useCallback((u,C=1,b=d)=>{if(!a||!n)return;l(!0);const _=x(u,C,b);K.get(Z.url({organization:a,search:n}),_,{preserveState:!0,preserveScroll:!0,only:["results","pagination","filters","filterOptions"],onFinish:()=>l(!1)})},[a,n,x,d]);m.useEffect(()=>{if(w.current){w.current=!1;return}const u=S.current;if(N!==u.search){const C={...u,search:N||void 0};if(i(C),!a||!n)return;l(!0);const b=x(C,1);K.get(Z.url({organization:a,search:n}),b,{preserveState:!0,preserveScroll:!0,only:["results","pagination","filters","filterOptions"],onFinish:()=>l(!1)})}},[N,a,n,x]);const M=m.useCallback((u,C)=>{const b={...s,[u]:C||void 0};i(b),v(b)},[s,v]),j=m.useCallback(()=>{const u={};i(u),r(""),v(u)},[v]),P=m.useCallback(u=>{const C=u.pageIndex+1,b=u.pageSize;b!==d?(p(b),v(s,1,b)):v(s,C,b)},[s,v,d]),T=m.useMemo(()=>!!(c||s.search||s.company_name||s.location||s.employment_type||s.industry||s.posted_after),[s,c]);return{filters:s,searchQuery:c,setSearchQuery:r,updateFilter:M,clearFilters:j,handlePaginationChange:P,hasActiveFilters:T,isLoading:g}}function et({search:e,results:n,pagination:a,filters:o={},filterOptions:s={employmentTypes:[],companies:[],locations:[],industries:[]},lists:i}){const c=se(),{filters:r,searchQuery:d,setSearchQuery:p,updateFilter:g,clearFilters:l,handlePaginationChange:w,hasActiveFilters:S,isLoading:N}=Ze({initialFilters:o,searchId:e.id,organizationSlug:c||"",perPage:a.per_page}),{selectedItems:x,selectedCompanyUuids:v,showCreditsDialog:M,pendingEnrichment:j,findPeopleMode:P,handleToggleSelection:T,handleSelectAll:u,handleClearSelection:C,handleFindPeopleClick:b,handleEnrichCompany:_,handleConfirmEnrichment:J,handleCancelEnrichment:D,handleAddToList:h,handleCreateList:f,handleEnrichFromBar:y}=We({results:n,search:e,organizationSlug:c}),F=m.useMemo(()=>Xe({organizationSlug:c,results:n,selectedItems:x,onSelectAll:u,onToggleSelection:T,onEnrichCompany:_}),[c,n,x,u,T,_]),$=m.useCallback(()=>{b("selected")},[b]),H=v.length||x.length,ce=m.useMemo(()=>j?Le({companyCount:j.companyUuids.length,mode:P?"find-people":"enrich",enrichmentOptions:j.options}):null,[P,j]);return t.jsxs("div",{className:"flex h-full flex-col",children:[t.jsxs("div",{className:"flex flex-1 flex-col gap-4 p-4",children:[t.jsx(pe,{searchName:e.n
1ame,currentCount:n.length,totalResults:a.total,filters:{},selectedItems:x,onSelectAllVisible:u,hideFilterButton:!0,hideSelectButton:!0,helperText:"Review hiring companies, then select rows to enrich, save, or find decision-makers from the action bar."}),t.jsx(Be,{filters:r,filterOptions:s,searchQuery:d,onSearchChange:p,onSearchSubmit:()=>g("search",d),onCompanyChange:E=>g("company_name",E),onLocationChange:E=>g("location",E),onEmploymentTypeChange:E=>g("employment_type",E),onPostedAfterChange:E=>g("posted_after",E),hasActiveFilters:S,onClearFilters:l}),t.jsx("div",{className:"overflow-hidden rounded-2xl border border-gray-200 bg-white",children:t.jsx(Ce,{columns:F,data:n,getRowId:E=>E.id,emptyState:S?t.jsx("div",{className:"py-10 text-center text-gray-500",children:"No jobs match your filters"}):t.jsx("div",{className:"py-10 text-center text-gray-500",children:"No jobs found in this search"}),manualPagination:!0,pageCount:a.last_page,totalCount:a.total,initialPageSize:a.per_page,initialPageIndex:a.current_page-1,onPaginationChange:w,hideViewToggle:!0,inlinePagination:!0,selectedRowCount:x.length,isLoading:N,enableColumnResizing:!0,stickyFirstColumn:!0,containerClassName:"max-h-[calc(100vh-16rem)] overflow-auto rounded-none",rowClassName:()=>"hover:bg-gray-50/70"})})]}),j&&t.jsx(me,{open:M,onConfirm:J,onCancel:D,actionType:$e(P?"find-people":"enrich"),context:ce??{}}),x.length>0&&t.jsx(he,{selectedCount:H,lists:i,onClearSelection:C,onAddToList:h,onCreateList:f,onEnrich:y,onFindPeople:$,listActionLabel:"Add to list",enrichActionLabel:"Enrich companies",findPeopleActionLabel:"Find decision-makers"})]})}function En({search:e,results:n,pagination:a,filters:o,filterOptions:s,lists:i}){const c=se(),r=m.useMemo(()=>[{title:Me.jobs.title,href:c?Ne.url({organization:c}):"#"},{title:e.name,href:"#"}],[c,e.name]),d=m.useMemo(()=>`${e.name} - Jobs`,[e.name]);return t.jsxs(Fe,{breadcrumbs:r,children:[t.jsx(de,{title:d}),t.jsx("div",{className:"flex h-full flex-1 flex-col",children:t.jsx(et,{search:e,results:n,pagination:a,filters:o,filterOptions:s,lists:i})})]})}export{En 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.